create-claudeportal 0.3.3 → 0.3.4
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.
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
(function(){const i=document.createElement("link").relList;if(i&&i.supports&&i.supports("modulepreload"))return;for(const o of document.querySelectorAll('link[rel="modulepreload"]'))l(o);new MutationObserver(o=>{for(const h of o)if(h.type==="childList")for(const d of h.addedNodes)d.tagName==="LINK"&&d.rel==="modulepreload"&&l(d)}).observe(document,{childList:!0,subtree:!0});function n(o){const h={};return o.integrity&&(h.integrity=o.integrity),o.referrerPolicy&&(h.referrerPolicy=o.referrerPolicy),o.crossOrigin==="use-credentials"?h.credentials="include":o.crossOrigin==="anonymous"?h.credentials="omit":h.credentials="same-origin",h}function l(o){if(o.ep)return;o.ep=!0;const h=n(o);fetch(o.href,h)}})();var Oh={exports:{}},Vn={};var cg;function oS(){if(cg)return Vn;cg=1;var e=Symbol.for("react.transitional.element"),i=Symbol.for("react.fragment");function n(l,o,h){var d=null;if(h!==void 0&&(d=""+h),o.key!==void 0&&(d=""+o.key),"key"in o){h={};for(var _ in o)_!=="key"&&(h[_]=o[_])}else h=o;return o=h.ref,{$$typeof:e,type:l,key:d,ref:o!==void 0?o:null,props:h}}return Vn.Fragment=i,Vn.jsx=n,Vn.jsxs=n,Vn}var hg;function cS(){return hg||(hg=1,Oh.exports=oS()),Oh.exports}var g=cS(),Lh={exports:{}},_e={};var ug;function hS(){if(ug)return _e;ug=1;var e=Symbol.for("react.transitional.element"),i=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),l=Symbol.for("react.strict_mode"),o=Symbol.for("react.profiler"),h=Symbol.for("react.consumer"),d=Symbol.for("react.context"),_=Symbol.for("react.forward_ref"),p=Symbol.for("react.suspense"),f=Symbol.for("react.memo"),S=Symbol.for("react.lazy"),y=Symbol.for("react.activity"),x=Symbol.iterator;function C(k){return k===null||typeof k!="object"?null:(k=x&&k[x]||k["@@iterator"],typeof k=="function"?k:null)}var b={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},T=Object.assign,M={};function A(k,P,J){this.props=k,this.context=P,this.refs=M,this.updater=J||b}A.prototype.isReactComponent={},A.prototype.setState=function(k,P){if(typeof k!="object"&&typeof k!="function"&&k!=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,k,P,"setState")},A.prototype.forceUpdate=function(k){this.updater.enqueueForceUpdate(this,k,"forceUpdate")};function O(){}O.prototype=A.prototype;function D(k,P,J){this.props=k,this.context=P,this.refs=M,this.updater=J||b}var L=D.prototype=new O;L.constructor=D,T(L,A.prototype),L.isPureReactComponent=!0;var H=Array.isArray;function X(){}var V={H:null,A:null,T:null,S:null},ue=Object.prototype.hasOwnProperty;function ge(k,P,J){var te=J.ref;return{$$typeof:e,type:k,key:P,ref:te!==void 0?te:null,props:J}}function Ye(k,P){return ge(k.type,P,k.props)}function de(k){return typeof k=="object"&&k!==null&&k.$$typeof===e}function Z(k){var P={"=":"=0",":":"=2"};return"$"+k.replace(/[=:]/g,function(J){return P[J]})}var G=/\/+/g;function ie(k,P){return typeof k=="object"&&k!==null&&k.key!=null?Z(""+k.key):P.toString(36)}function ee(k){switch(k.status){case"fulfilled":return k.value;case"rejected":throw k.reason;default:switch(typeof k.status=="string"?k.then(X,X):(k.status="pending",k.then(function(P){k.status==="pending"&&(k.status="fulfilled",k.value=P)},function(P){k.status==="pending"&&(k.status="rejected",k.reason=P)})),k.status){case"fulfilled":return k.value;case"rejected":throw k.reason}}throw k}function R(k,P,J,te,oe){var he=typeof k;(he==="undefined"||he==="boolean")&&(k=null);var be=!1;if(k===null)be=!0;else switch(he){case"bigint":case"string":case"number":be=!0;break;case"object":switch(k.$$typeof){case e:case i:be=!0;break;case S:return be=k._init,R(be(k._payload),P,J,te,oe)}}if(be)return oe=oe(k),be=te===""?"."+ie(k,0):te,H(oe)?(J="",be!=null&&(J=be.replace(G,"$&/")+"/"),R(oe,P,J,"",function(wi){return wi})):oe!=null&&(de(oe)&&(oe=Ye(oe,J+(oe.key==null||k&&k.key===oe.key?"":(""+oe.key).replace(G,"$&/")+"/")+be)),P.push(oe)),1;be=0;var ot=te===""?".":te+":";if(H(k))for(var ze=0;ze<k.length;ze++)te=k[ze],he=ot+ie(te,ze),be+=R(te,P,J,he,oe);else if(ze=C(k),typeof ze=="function")for(k=ze.call(k),ze=0;!(te=k.next()).done;)te=te.value,he=ot+ie(te,ze++),be+=R(te,P,J,he,oe);else if(he==="object"){if(typeof k.then=="function")return R(ee(k),P,J,te,oe);throw P=String(k),Error("Objects are not valid as a React child (found: "+(P==="[object Object]"?"object with keys {"+Object.keys(k).join(", ")+"}":P)+"). If you meant to render a collection of children, use an array instead.")}return be}function I(k,P,J){if(k==null)return k;var te=[],oe=0;return R(k,te,"","",function(he){return P.call(J,he,oe++)}),te}function K(k){if(k._status===-1){var P=k._result;P=P(),P.then(function(J){(k._status===0||k._status===-1)&&(k._status=1,k._result=J)},function(J){(k._status===0||k._status===-1)&&(k._status=2,k._result=J)}),k._status===-1&&(k._status=0,k._result=P)}if(k._status===1)return k._result.default;throw k._result}var ae=typeof reportError=="function"?reportError:function(k){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var P=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof k=="object"&&k!==null&&typeof k.message=="string"?String(k.message):String(k),error:k});if(!window.dispatchEvent(P))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",k);return}console.error(k)},pe={map:I,forEach:function(k,P,J){I(k,function(){P.apply(this,arguments)},J)},count:function(k){var P=0;return I(k,function(){P++}),P},toArray:function(k){return I(k,function(P){return P})||[]},only:function(k){if(!de(k))throw Error("React.Children.only expected to receive a single React element child.");return k}};return _e.Activity=y,_e.Children=pe,_e.Component=A,_e.Fragment=n,_e.Profiler=o,_e.PureComponent=D,_e.StrictMode=l,_e.Suspense=p,_e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=V,_e.__COMPILER_RUNTIME={__proto__:null,c:function(k){return V.H.useMemoCache(k)}},_e.cache=function(k){return function(){return k.apply(null,arguments)}},_e.cacheSignal=function(){return null},_e.cloneElement=function(k,P,J){if(k==null)throw Error("The argument must be a React element, but you passed "+k+".");var te=T({},k.props),oe=k.key;if(P!=null)for(he in P.key!==void 0&&(oe=""+P.key),P)!ue.call(P,he)||he==="key"||he==="__self"||he==="__source"||he==="ref"&&P.ref===void 0||(te[he]=P[he]);var he=arguments.length-2;if(he===1)te.children=J;else if(1<he){for(var be=Array(he),ot=0;ot<he;ot++)be[ot]=arguments[ot+2];te.children=be}return ge(k.type,oe,te)},_e.createContext=function(k){return k={$$typeof:d,_currentValue:k,_currentValue2:k,_threadCount:0,Provider:null,Consumer:null},k.Provider=k,k.Consumer={$$typeof:h,_context:k},k},_e.createElement=function(k,P,J){var te,oe={},he=null;if(P!=null)for(te in P.key!==void 0&&(he=""+P.key),P)ue.call(P,te)&&te!=="key"&&te!=="__self"&&te!=="__source"&&(oe[te]=P[te]);var be=arguments.length-2;if(be===1)oe.children=J;else if(1<be){for(var ot=Array(be),ze=0;ze<be;ze++)ot[ze]=arguments[ze+2];oe.children=ot}if(k&&k.defaultProps)for(te in be=k.defaultProps,be)oe[te]===void 0&&(oe[te]=be[te]);return ge(k,he,oe)},_e.createRef=function(){return{current:null}},_e.forwardRef=function(k){return{$$typeof:_,render:k}},_e.isValidElement=de,_e.lazy=function(k){return{$$typeof:S,_payload:{_status:-1,_result:k},_init:K}},_e.memo=function(k,P){return{$$typeof:f,type:k,compare:P===void 0?null:P}},_e.startTransition=function(k){var P=V.T,J={};V.T=J;try{var te=k(),oe=V.S;oe!==null&&oe(J,te),typeof te=="object"&&te!==null&&typeof te.then=="function"&&te.then(X,ae)}catch(he){ae(he)}finally{P!==null&&J.types!==null&&(P.types=J.types),V.T=P}},_e.unstable_useCacheRefresh=function(){return V.H.useCacheRefresh()},_e.use=function(k){return V.H.use(k)},_e.useActionState=function(k,P,J){return V.H.useActionState(k,P,J)},_e.useCallback=function(k,P){return V.H.useCallback(k,P)},_e.useContext=function(k){return V.H.useContext(k)},_e.useDebugValue=function(){},_e.useDeferredValue=function(k,P){return V.H.useDeferredValue(k,P)},_e.useEffect=function(k,P){return V.H.useEffect(k,P)},_e.useEffectEvent=function(k){return V.H.useEffectEvent(k)},_e.useId=function(){return V.H.useId()},_e.useImperativeHandle=function(k,P,J){return V.H.useImperativeHandle(k,P,J)},_e.useInsertionEffect=function(k,P){return V.H.useInsertionEffect(k,P)},_e.useLayoutEffect=function(k,P){return V.H.useLayoutEffect(k,P)},_e.useMemo=function(k,P){return V.H.useMemo(k,P)},_e.useOptimistic=function(k,P){return V.H.useOptimistic(k,P)},_e.useReducer=function(k,P,J){return V.H.useReducer(k,P,J)},_e.useRef=function(k){return V.H.useRef(k)},_e.useState=function(k){return V.H.useState(k)},_e.useSyncExternalStore=function(k,P,J){return V.H.useSyncExternalStore(k,P,J)},_e.useTransition=function(){return V.H.useTransition()},_e.version="19.2.4",_e}var dg;function Pu(){return dg||(dg=1,Lh.exports=hS()),Lh.exports}var z=Pu(),jh={exports:{}},Zn={},Nh={exports:{}},Hh={};var fg;function uS(){return fg||(fg=1,(function(e){function i(R,I){var K=R.length;R.push(I);e:for(;0<K;){var ae=K-1>>>1,pe=R[ae];if(0<o(pe,I))R[ae]=I,R[K]=pe,K=ae;else break e}}function n(R){return R.length===0?null:R[0]}function l(R){if(R.length===0)return null;var I=R[0],K=R.pop();if(K!==I){R[0]=K;e:for(var ae=0,pe=R.length,k=pe>>>1;ae<k;){var P=2*(ae+1)-1,J=R[P],te=P+1,oe=R[te];if(0>o(J,K))te<pe&&0>o(oe,J)?(R[ae]=oe,R[te]=K,ae=te):(R[ae]=J,R[P]=K,ae=P);else if(te<pe&&0>o(oe,K))R[ae]=oe,R[te]=K,ae=te;else break e}}return I}function o(R,I){var K=R.sortIndex-I.sortIndex;return K!==0?K:R.id-I.id}if(e.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var h=performance;e.unstable_now=function(){return h.now()}}else{var d=Date,_=d.now();e.unstable_now=function(){return d.now()-_}}var p=[],f=[],S=1,y=null,x=3,C=!1,b=!1,T=!1,M=!1,A=typeof setTimeout=="function"?setTimeout:null,O=typeof clearTimeout=="function"?clearTimeout:null,D=typeof setImmediate<"u"?setImmediate:null;function L(R){for(var I=n(f);I!==null;){if(I.callback===null)l(f);else if(I.startTime<=R)l(f),I.sortIndex=I.expirationTime,i(p,I);else break;I=n(f)}}function H(R){if(T=!1,L(R),!b)if(n(p)!==null)b=!0,X||(X=!0,Z());else{var I=n(f);I!==null&&ee(H,I.startTime-R)}}var X=!1,V=-1,ue=5,ge=-1;function Ye(){return M?!0:!(e.unstable_now()-ge<ue)}function de(){if(M=!1,X){var R=e.unstable_now();ge=R;var I=!0;try{e:{b=!1,T&&(T=!1,O(V),V=-1),C=!0;var K=x;try{t:{for(L(R),y=n(p);y!==null&&!(y.expirationTime>R&&Ye());){var ae=y.callback;if(typeof ae=="function"){y.callback=null,x=y.priorityLevel;var pe=ae(y.expirationTime<=R);if(R=e.unstable_now(),typeof pe=="function"){y.callback=pe,L(R),I=!0;break t}y===n(p)&&l(p),L(R)}else l(p);y=n(p)}if(y!==null)I=!0;else{var k=n(f);k!==null&&ee(H,k.startTime-R),I=!1}}break e}finally{y=null,x=K,C=!1}I=void 0}}finally{I?Z():X=!1}}}var Z;if(typeof D=="function")Z=function(){D(de)};else if(typeof MessageChannel<"u"){var G=new MessageChannel,ie=G.port2;G.port1.onmessage=de,Z=function(){ie.postMessage(null)}}else Z=function(){A(de,0)};function ee(R,I){V=A(function(){R(e.unstable_now())},I)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(R){R.callback=null},e.unstable_forceFrameRate=function(R){0>R||125<R?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):ue=0<R?Math.floor(1e3/R):5},e.unstable_getCurrentPriorityLevel=function(){return x},e.unstable_next=function(R){switch(x){case 1:case 2:case 3:var I=3;break;default:I=x}var K=x;x=I;try{return R()}finally{x=K}},e.unstable_requestPaint=function(){M=!0},e.unstable_runWithPriority=function(R,I){switch(R){case 1:case 2:case 3:case 4:case 5:break;default:R=3}var K=x;x=R;try{return I()}finally{x=K}},e.unstable_scheduleCallback=function(R,I,K){var ae=e.unstable_now();switch(typeof K=="object"&&K!==null?(K=K.delay,K=typeof K=="number"&&0<K?ae+K:ae):K=ae,R){case 1:var pe=-1;break;case 2:pe=250;break;case 5:pe=1073741823;break;case 4:pe=1e4;break;default:pe=5e3}return pe=K+pe,R={id:S++,callback:I,priorityLevel:R,startTime:K,expirationTime:pe,sortIndex:-1},K>ae?(R.sortIndex=K,i(f,R),n(p)===null&&R===n(f)&&(T?(O(V),V=-1):T=!0,ee(H,K-ae))):(R.sortIndex=pe,i(p,R),b||C||(b=!0,X||(X=!0,Z()))),R},e.unstable_shouldYield=Ye,e.unstable_wrapCallback=function(R){var I=x;return function(){var K=x;x=I;try{return R.apply(this,arguments)}finally{x=K}}}})(Hh)),Hh}var pg;function dS(){return pg||(pg=1,Nh.exports=uS()),Nh.exports}var Uh={exports:{}},Tt={};var _g;function fS(){if(_g)return Tt;_g=1;var e=Pu();function i(p){var f="https://react.dev/errors/"+p;if(1<arguments.length){f+="?args[]="+encodeURIComponent(arguments[1]);for(var S=2;S<arguments.length;S++)f+="&args[]="+encodeURIComponent(arguments[S])}return"Minified React error #"+p+"; visit "+f+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function n(){}var l={d:{f:n,r:function(){throw Error(i(522))},D:n,C:n,L:n,m:n,X:n,S:n,M:n},p:0,findDOMNode:null},o=Symbol.for("react.portal");function h(p,f,S){var y=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:o,key:y==null?null:""+y,children:p,containerInfo:f,implementation:S}}var d=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function _(p,f){if(p==="font")return"";if(typeof f=="string")return f==="use-credentials"?f:""}return Tt.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=l,Tt.createPortal=function(p,f){var S=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!f||f.nodeType!==1&&f.nodeType!==9&&f.nodeType!==11)throw Error(i(299));return h(p,f,null,S)},Tt.flushSync=function(p){var f=d.T,S=l.p;try{if(d.T=null,l.p=2,p)return p()}finally{d.T=f,l.p=S,l.d.f()}},Tt.preconnect=function(p,f){typeof p=="string"&&(f?(f=f.crossOrigin,f=typeof f=="string"?f==="use-credentials"?f:"":void 0):f=null,l.d.C(p,f))},Tt.prefetchDNS=function(p){typeof p=="string"&&l.d.D(p)},Tt.preinit=function(p,f){if(typeof p=="string"&&f&&typeof f.as=="string"){var S=f.as,y=_(S,f.crossOrigin),x=typeof f.integrity=="string"?f.integrity:void 0,C=typeof f.fetchPriority=="string"?f.fetchPriority:void 0;S==="style"?l.d.S(p,typeof f.precedence=="string"?f.precedence:void 0,{crossOrigin:y,integrity:x,fetchPriority:C}):S==="script"&&l.d.X(p,{crossOrigin:y,integrity:x,fetchPriority:C,nonce:typeof f.nonce=="string"?f.nonce:void 0})}},Tt.preinitModule=function(p,f){if(typeof p=="string")if(typeof f=="object"&&f!==null){if(f.as==null||f.as==="script"){var S=_(f.as,f.crossOrigin);l.d.M(p,{crossOrigin:S,integrity:typeof f.integrity=="string"?f.integrity:void 0,nonce:typeof f.nonce=="string"?f.nonce:void 0})}}else f==null&&l.d.M(p)},Tt.preload=function(p,f){if(typeof p=="string"&&typeof f=="object"&&f!==null&&typeof f.as=="string"){var S=f.as,y=_(S,f.crossOrigin);l.d.L(p,S,{crossOrigin:y,integrity:typeof f.integrity=="string"?f.integrity:void 0,nonce:typeof f.nonce=="string"?f.nonce:void 0,type:typeof f.type=="string"?f.type:void 0,fetchPriority:typeof f.fetchPriority=="string"?f.fetchPriority:void 0,referrerPolicy:typeof f.referrerPolicy=="string"?f.referrerPolicy:void 0,imageSrcSet:typeof f.imageSrcSet=="string"?f.imageSrcSet:void 0,imageSizes:typeof f.imageSizes=="string"?f.imageSizes:void 0,media:typeof f.media=="string"?f.media:void 0})}},Tt.preloadModule=function(p,f){if(typeof p=="string")if(f){var S=_(f.as,f.crossOrigin);l.d.m(p,{as:typeof f.as=="string"&&f.as!=="script"?f.as:void 0,crossOrigin:S,integrity:typeof f.integrity=="string"?f.integrity:void 0})}else l.d.m(p)},Tt.requestFormReset=function(p){l.d.r(p)},Tt.unstable_batchedUpdates=function(p,f){return p(f)},Tt.useFormState=function(p,f,S){return d.H.useFormState(p,f,S)},Tt.useFormStatus=function(){return d.H.useHostTransitionStatus()},Tt.version="19.2.4",Tt}var gg;function pS(){if(gg)return Uh.exports;gg=1;function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(i){console.error(i)}}return e(),Uh.exports=fS(),Uh.exports}var mg;function _S(){if(mg)return Zn;mg=1;var e=dS(),i=Pu(),n=pS();function l(t){var s="https://react.dev/errors/"+t;if(1<arguments.length){s+="?args[]="+encodeURIComponent(arguments[1]);for(var r=2;r<arguments.length;r++)s+="&args[]="+encodeURIComponent(arguments[r])}return"Minified React error #"+t+"; visit "+s+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function o(t){return!(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)}function h(t){var s=t,r=t;if(t.alternate)for(;s.return;)s=s.return;else{t=s;do s=t,(s.flags&4098)!==0&&(r=s.return),t=s.return;while(t)}return s.tag===3?r:null}function d(t){if(t.tag===13){var s=t.memoizedState;if(s===null&&(t=t.alternate,t!==null&&(s=t.memoizedState)),s!==null)return s.dehydrated}return null}function _(t){if(t.tag===31){var s=t.memoizedState;if(s===null&&(t=t.alternate,t!==null&&(s=t.memoizedState)),s!==null)return s.dehydrated}return null}function p(t){if(h(t)!==t)throw Error(l(188))}function f(t){var s=t.alternate;if(!s){if(s=h(t),s===null)throw Error(l(188));return s!==t?null:t}for(var r=t,a=s;;){var c=r.return;if(c===null)break;var u=c.alternate;if(u===null){if(a=c.return,a!==null){r=a;continue}break}if(c.child===u.child){for(u=c.child;u;){if(u===r)return p(c),t;if(u===a)return p(c),s;u=u.sibling}throw Error(l(188))}if(r.return!==a.return)r=c,a=u;else{for(var m=!1,v=c.child;v;){if(v===r){m=!0,r=c,a=u;break}if(v===a){m=!0,a=c,r=u;break}v=v.sibling}if(!m){for(v=u.child;v;){if(v===r){m=!0,r=u,a=c;break}if(v===a){m=!0,a=u,r=c;break}v=v.sibling}if(!m)throw Error(l(189))}}if(r.alternate!==a)throw Error(l(190))}if(r.tag!==3)throw Error(l(188));return r.stateNode.current===r?t:s}function S(t){var s=t.tag;if(s===5||s===26||s===27||s===6)return t;for(t=t.child;t!==null;){if(s=S(t),s!==null)return s;t=t.sibling}return null}var y=Object.assign,x=Symbol.for("react.element"),C=Symbol.for("react.transitional.element"),b=Symbol.for("react.portal"),T=Symbol.for("react.fragment"),M=Symbol.for("react.strict_mode"),A=Symbol.for("react.profiler"),O=Symbol.for("react.consumer"),D=Symbol.for("react.context"),L=Symbol.for("react.forward_ref"),H=Symbol.for("react.suspense"),X=Symbol.for("react.suspense_list"),V=Symbol.for("react.memo"),ue=Symbol.for("react.lazy"),ge=Symbol.for("react.activity"),Ye=Symbol.for("react.memo_cache_sentinel"),de=Symbol.iterator;function Z(t){return t===null||typeof t!="object"?null:(t=de&&t[de]||t["@@iterator"],typeof t=="function"?t:null)}var G=Symbol.for("react.client.reference");function ie(t){if(t==null)return null;if(typeof t=="function")return t.$$typeof===G?null:t.displayName||t.name||null;if(typeof t=="string")return t;switch(t){case T:return"Fragment";case A:return"Profiler";case M:return"StrictMode";case H:return"Suspense";case X:return"SuspenseList";case ge:return"Activity"}if(typeof t=="object")switch(t.$$typeof){case b:return"Portal";case D:return t.displayName||"Context";case O:return(t._context.displayName||"Context")+".Consumer";case L:var s=t.render;return t=t.displayName,t||(t=s.displayName||s.name||"",t=t!==""?"ForwardRef("+t+")":"ForwardRef"),t;case V:return s=t.displayName||null,s!==null?s:ie(t.type)||"Memo";case ue:s=t._payload,t=t._init;try{return ie(t(s))}catch{}}return null}var ee=Array.isArray,R=i.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,I=n.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,K={pending:!1,data:null,method:null,action:null},ae=[],pe=-1;function k(t){return{current:t}}function P(t){0>pe||(t.current=ae[pe],ae[pe]=null,pe--)}function J(t,s){pe++,ae[pe]=t.current,t.current=s}var te=k(null),oe=k(null),he=k(null),be=k(null);function ot(t,s){switch(J(he,s),J(oe,t),J(te,null),s.nodeType){case 9:case 11:t=(t=s.documentElement)&&(t=t.namespaceURI)?z_(t):0;break;default:if(t=s.tagName,s=s.namespaceURI)s=z_(s),t=A_(s,t);else switch(t){case"svg":t=1;break;case"math":t=2;break;default:t=0}}P(te),J(te,t)}function ze(){P(te),P(oe),P(he)}function wi(t){t.memoizedState!==null&&J(be,t);var s=te.current,r=A_(s,t.type);s!==r&&(J(oe,t),J(te,r))}function Ci(t){oe.current===t&&(P(te),P(oe)),be.current===t&&(P(be),Yn._currentValue=K)}var ti,Re;function mi(t){if(ti===void 0)try{throw Error()}catch(r){var s=r.stack.trim().match(/\n( *(at )?)/);ti=s&&s[1]||"",Re=-1<r.stack.indexOf(`
|
|
1
|
+
(function(){const i=document.createElement("link").relList;if(i&&i.supports&&i.supports("modulepreload"))return;for(const o of document.querySelectorAll('link[rel="modulepreload"]'))l(o);new MutationObserver(o=>{for(const h of o)if(h.type==="childList")for(const d of h.addedNodes)d.tagName==="LINK"&&d.rel==="modulepreload"&&l(d)}).observe(document,{childList:!0,subtree:!0});function n(o){const h={};return o.integrity&&(h.integrity=o.integrity),o.referrerPolicy&&(h.referrerPolicy=o.referrerPolicy),o.crossOrigin==="use-credentials"?h.credentials="include":o.crossOrigin==="anonymous"?h.credentials="omit":h.credentials="same-origin",h}function l(o){if(o.ep)return;o.ep=!0;const h=n(o);fetch(o.href,h)}})();var Oh={exports:{}},Vn={};var cg;function oS(){if(cg)return Vn;cg=1;var e=Symbol.for("react.transitional.element"),i=Symbol.for("react.fragment");function n(l,o,h){var d=null;if(h!==void 0&&(d=""+h),o.key!==void 0&&(d=""+o.key),"key"in o){h={};for(var _ in o)_!=="key"&&(h[_]=o[_])}else h=o;return o=h.ref,{$$typeof:e,type:l,key:d,ref:o!==void 0?o:null,props:h}}return Vn.Fragment=i,Vn.jsx=n,Vn.jsxs=n,Vn}var hg;function cS(){return hg||(hg=1,Oh.exports=oS()),Oh.exports}var g=cS(),Lh={exports:{}},_e={};var ug;function hS(){if(ug)return _e;ug=1;var e=Symbol.for("react.transitional.element"),i=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),l=Symbol.for("react.strict_mode"),o=Symbol.for("react.profiler"),h=Symbol.for("react.consumer"),d=Symbol.for("react.context"),_=Symbol.for("react.forward_ref"),p=Symbol.for("react.suspense"),f=Symbol.for("react.memo"),S=Symbol.for("react.lazy"),y=Symbol.for("react.activity"),x=Symbol.iterator;function C(k){return k===null||typeof k!="object"?null:(k=x&&k[x]||k["@@iterator"],typeof k=="function"?k:null)}var b={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},T=Object.assign,M={};function A(k,P,J){this.props=k,this.context=P,this.refs=M,this.updater=J||b}A.prototype.isReactComponent={},A.prototype.setState=function(k,P){if(typeof k!="object"&&typeof k!="function"&&k!=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,k,P,"setState")},A.prototype.forceUpdate=function(k){this.updater.enqueueForceUpdate(this,k,"forceUpdate")};function O(){}O.prototype=A.prototype;function D(k,P,J){this.props=k,this.context=P,this.refs=M,this.updater=J||b}var L=D.prototype=new O;L.constructor=D,T(L,A.prototype),L.isPureReactComponent=!0;var H=Array.isArray;function X(){}var V={H:null,A:null,T:null,S:null},ue=Object.prototype.hasOwnProperty;function ge(k,P,J){var te=J.ref;return{$$typeof:e,type:k,key:P,ref:te!==void 0?te:null,props:J}}function Ke(k,P){return ge(k.type,P,k.props)}function de(k){return typeof k=="object"&&k!==null&&k.$$typeof===e}function Z(k){var P={"=":"=0",":":"=2"};return"$"+k.replace(/[=:]/g,function(J){return P[J]})}var G=/\/+/g;function ie(k,P){return typeof k=="object"&&k!==null&&k.key!=null?Z(""+k.key):P.toString(36)}function ee(k){switch(k.status){case"fulfilled":return k.value;case"rejected":throw k.reason;default:switch(typeof k.status=="string"?k.then(X,X):(k.status="pending",k.then(function(P){k.status==="pending"&&(k.status="fulfilled",k.value=P)},function(P){k.status==="pending"&&(k.status="rejected",k.reason=P)})),k.status){case"fulfilled":return k.value;case"rejected":throw k.reason}}throw k}function R(k,P,J,te,oe){var he=typeof k;(he==="undefined"||he==="boolean")&&(k=null);var be=!1;if(k===null)be=!0;else switch(he){case"bigint":case"string":case"number":be=!0;break;case"object":switch(k.$$typeof){case e:case i:be=!0;break;case S:return be=k._init,R(be(k._payload),P,J,te,oe)}}if(be)return oe=oe(k),be=te===""?"."+ie(k,0):te,H(oe)?(J="",be!=null&&(J=be.replace(G,"$&/")+"/"),R(oe,P,J,"",function(wi){return wi})):oe!=null&&(de(oe)&&(oe=Ke(oe,J+(oe.key==null||k&&k.key===oe.key?"":(""+oe.key).replace(G,"$&/")+"/")+be)),P.push(oe)),1;be=0;var ot=te===""?".":te+":";if(H(k))for(var ze=0;ze<k.length;ze++)te=k[ze],he=ot+ie(te,ze),be+=R(te,P,J,he,oe);else if(ze=C(k),typeof ze=="function")for(k=ze.call(k),ze=0;!(te=k.next()).done;)te=te.value,he=ot+ie(te,ze++),be+=R(te,P,J,he,oe);else if(he==="object"){if(typeof k.then=="function")return R(ee(k),P,J,te,oe);throw P=String(k),Error("Objects are not valid as a React child (found: "+(P==="[object Object]"?"object with keys {"+Object.keys(k).join(", ")+"}":P)+"). If you meant to render a collection of children, use an array instead.")}return be}function I(k,P,J){if(k==null)return k;var te=[],oe=0;return R(k,te,"","",function(he){return P.call(J,he,oe++)}),te}function $(k){if(k._status===-1){var P=k._result;P=P(),P.then(function(J){(k._status===0||k._status===-1)&&(k._status=1,k._result=J)},function(J){(k._status===0||k._status===-1)&&(k._status=2,k._result=J)}),k._status===-1&&(k._status=0,k._result=P)}if(k._status===1)return k._result.default;throw k._result}var ae=typeof reportError=="function"?reportError:function(k){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var P=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof k=="object"&&k!==null&&typeof k.message=="string"?String(k.message):String(k),error:k});if(!window.dispatchEvent(P))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",k);return}console.error(k)},pe={map:I,forEach:function(k,P,J){I(k,function(){P.apply(this,arguments)},J)},count:function(k){var P=0;return I(k,function(){P++}),P},toArray:function(k){return I(k,function(P){return P})||[]},only:function(k){if(!de(k))throw Error("React.Children.only expected to receive a single React element child.");return k}};return _e.Activity=y,_e.Children=pe,_e.Component=A,_e.Fragment=n,_e.Profiler=o,_e.PureComponent=D,_e.StrictMode=l,_e.Suspense=p,_e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=V,_e.__COMPILER_RUNTIME={__proto__:null,c:function(k){return V.H.useMemoCache(k)}},_e.cache=function(k){return function(){return k.apply(null,arguments)}},_e.cacheSignal=function(){return null},_e.cloneElement=function(k,P,J){if(k==null)throw Error("The argument must be a React element, but you passed "+k+".");var te=T({},k.props),oe=k.key;if(P!=null)for(he in P.key!==void 0&&(oe=""+P.key),P)!ue.call(P,he)||he==="key"||he==="__self"||he==="__source"||he==="ref"&&P.ref===void 0||(te[he]=P[he]);var he=arguments.length-2;if(he===1)te.children=J;else if(1<he){for(var be=Array(he),ot=0;ot<he;ot++)be[ot]=arguments[ot+2];te.children=be}return ge(k.type,oe,te)},_e.createContext=function(k){return k={$$typeof:d,_currentValue:k,_currentValue2:k,_threadCount:0,Provider:null,Consumer:null},k.Provider=k,k.Consumer={$$typeof:h,_context:k},k},_e.createElement=function(k,P,J){var te,oe={},he=null;if(P!=null)for(te in P.key!==void 0&&(he=""+P.key),P)ue.call(P,te)&&te!=="key"&&te!=="__self"&&te!=="__source"&&(oe[te]=P[te]);var be=arguments.length-2;if(be===1)oe.children=J;else if(1<be){for(var ot=Array(be),ze=0;ze<be;ze++)ot[ze]=arguments[ze+2];oe.children=ot}if(k&&k.defaultProps)for(te in be=k.defaultProps,be)oe[te]===void 0&&(oe[te]=be[te]);return ge(k,he,oe)},_e.createRef=function(){return{current:null}},_e.forwardRef=function(k){return{$$typeof:_,render:k}},_e.isValidElement=de,_e.lazy=function(k){return{$$typeof:S,_payload:{_status:-1,_result:k},_init:$}},_e.memo=function(k,P){return{$$typeof:f,type:k,compare:P===void 0?null:P}},_e.startTransition=function(k){var P=V.T,J={};V.T=J;try{var te=k(),oe=V.S;oe!==null&&oe(J,te),typeof te=="object"&&te!==null&&typeof te.then=="function"&&te.then(X,ae)}catch(he){ae(he)}finally{P!==null&&J.types!==null&&(P.types=J.types),V.T=P}},_e.unstable_useCacheRefresh=function(){return V.H.useCacheRefresh()},_e.use=function(k){return V.H.use(k)},_e.useActionState=function(k,P,J){return V.H.useActionState(k,P,J)},_e.useCallback=function(k,P){return V.H.useCallback(k,P)},_e.useContext=function(k){return V.H.useContext(k)},_e.useDebugValue=function(){},_e.useDeferredValue=function(k,P){return V.H.useDeferredValue(k,P)},_e.useEffect=function(k,P){return V.H.useEffect(k,P)},_e.useEffectEvent=function(k){return V.H.useEffectEvent(k)},_e.useId=function(){return V.H.useId()},_e.useImperativeHandle=function(k,P,J){return V.H.useImperativeHandle(k,P,J)},_e.useInsertionEffect=function(k,P){return V.H.useInsertionEffect(k,P)},_e.useLayoutEffect=function(k,P){return V.H.useLayoutEffect(k,P)},_e.useMemo=function(k,P){return V.H.useMemo(k,P)},_e.useOptimistic=function(k,P){return V.H.useOptimistic(k,P)},_e.useReducer=function(k,P,J){return V.H.useReducer(k,P,J)},_e.useRef=function(k){return V.H.useRef(k)},_e.useState=function(k){return V.H.useState(k)},_e.useSyncExternalStore=function(k,P,J){return V.H.useSyncExternalStore(k,P,J)},_e.useTransition=function(){return V.H.useTransition()},_e.version="19.2.4",_e}var dg;function Pu(){return dg||(dg=1,Lh.exports=hS()),Lh.exports}var z=Pu(),jh={exports:{}},Zn={},Nh={exports:{}},Hh={};var fg;function uS(){return fg||(fg=1,(function(e){function i(R,I){var $=R.length;R.push(I);e:for(;0<$;){var ae=$-1>>>1,pe=R[ae];if(0<o(pe,I))R[ae]=I,R[$]=pe,$=ae;else break e}}function n(R){return R.length===0?null:R[0]}function l(R){if(R.length===0)return null;var I=R[0],$=R.pop();if($!==I){R[0]=$;e:for(var ae=0,pe=R.length,k=pe>>>1;ae<k;){var P=2*(ae+1)-1,J=R[P],te=P+1,oe=R[te];if(0>o(J,$))te<pe&&0>o(oe,J)?(R[ae]=oe,R[te]=$,ae=te):(R[ae]=J,R[P]=$,ae=P);else if(te<pe&&0>o(oe,$))R[ae]=oe,R[te]=$,ae=te;else break e}}return I}function o(R,I){var $=R.sortIndex-I.sortIndex;return $!==0?$:R.id-I.id}if(e.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var h=performance;e.unstable_now=function(){return h.now()}}else{var d=Date,_=d.now();e.unstable_now=function(){return d.now()-_}}var p=[],f=[],S=1,y=null,x=3,C=!1,b=!1,T=!1,M=!1,A=typeof setTimeout=="function"?setTimeout:null,O=typeof clearTimeout=="function"?clearTimeout:null,D=typeof setImmediate<"u"?setImmediate:null;function L(R){for(var I=n(f);I!==null;){if(I.callback===null)l(f);else if(I.startTime<=R)l(f),I.sortIndex=I.expirationTime,i(p,I);else break;I=n(f)}}function H(R){if(T=!1,L(R),!b)if(n(p)!==null)b=!0,X||(X=!0,Z());else{var I=n(f);I!==null&&ee(H,I.startTime-R)}}var X=!1,V=-1,ue=5,ge=-1;function Ke(){return M?!0:!(e.unstable_now()-ge<ue)}function de(){if(M=!1,X){var R=e.unstable_now();ge=R;var I=!0;try{e:{b=!1,T&&(T=!1,O(V),V=-1),C=!0;var $=x;try{t:{for(L(R),y=n(p);y!==null&&!(y.expirationTime>R&&Ke());){var ae=y.callback;if(typeof ae=="function"){y.callback=null,x=y.priorityLevel;var pe=ae(y.expirationTime<=R);if(R=e.unstable_now(),typeof pe=="function"){y.callback=pe,L(R),I=!0;break t}y===n(p)&&l(p),L(R)}else l(p);y=n(p)}if(y!==null)I=!0;else{var k=n(f);k!==null&&ee(H,k.startTime-R),I=!1}}break e}finally{y=null,x=$,C=!1}I=void 0}}finally{I?Z():X=!1}}}var Z;if(typeof D=="function")Z=function(){D(de)};else if(typeof MessageChannel<"u"){var G=new MessageChannel,ie=G.port2;G.port1.onmessage=de,Z=function(){ie.postMessage(null)}}else Z=function(){A(de,0)};function ee(R,I){V=A(function(){R(e.unstable_now())},I)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(R){R.callback=null},e.unstable_forceFrameRate=function(R){0>R||125<R?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):ue=0<R?Math.floor(1e3/R):5},e.unstable_getCurrentPriorityLevel=function(){return x},e.unstable_next=function(R){switch(x){case 1:case 2:case 3:var I=3;break;default:I=x}var $=x;x=I;try{return R()}finally{x=$}},e.unstable_requestPaint=function(){M=!0},e.unstable_runWithPriority=function(R,I){switch(R){case 1:case 2:case 3:case 4:case 5:break;default:R=3}var $=x;x=R;try{return I()}finally{x=$}},e.unstable_scheduleCallback=function(R,I,$){var ae=e.unstable_now();switch(typeof $=="object"&&$!==null?($=$.delay,$=typeof $=="number"&&0<$?ae+$:ae):$=ae,R){case 1:var pe=-1;break;case 2:pe=250;break;case 5:pe=1073741823;break;case 4:pe=1e4;break;default:pe=5e3}return pe=$+pe,R={id:S++,callback:I,priorityLevel:R,startTime:$,expirationTime:pe,sortIndex:-1},$>ae?(R.sortIndex=$,i(f,R),n(p)===null&&R===n(f)&&(T?(O(V),V=-1):T=!0,ee(H,$-ae))):(R.sortIndex=pe,i(p,R),b||C||(b=!0,X||(X=!0,Z()))),R},e.unstable_shouldYield=Ke,e.unstable_wrapCallback=function(R){var I=x;return function(){var $=x;x=I;try{return R.apply(this,arguments)}finally{x=$}}}})(Hh)),Hh}var pg;function dS(){return pg||(pg=1,Nh.exports=uS()),Nh.exports}var Uh={exports:{}},Tt={};var _g;function fS(){if(_g)return Tt;_g=1;var e=Pu();function i(p){var f="https://react.dev/errors/"+p;if(1<arguments.length){f+="?args[]="+encodeURIComponent(arguments[1]);for(var S=2;S<arguments.length;S++)f+="&args[]="+encodeURIComponent(arguments[S])}return"Minified React error #"+p+"; visit "+f+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function n(){}var l={d:{f:n,r:function(){throw Error(i(522))},D:n,C:n,L:n,m:n,X:n,S:n,M:n},p:0,findDOMNode:null},o=Symbol.for("react.portal");function h(p,f,S){var y=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:o,key:y==null?null:""+y,children:p,containerInfo:f,implementation:S}}var d=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function _(p,f){if(p==="font")return"";if(typeof f=="string")return f==="use-credentials"?f:""}return Tt.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=l,Tt.createPortal=function(p,f){var S=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!f||f.nodeType!==1&&f.nodeType!==9&&f.nodeType!==11)throw Error(i(299));return h(p,f,null,S)},Tt.flushSync=function(p){var f=d.T,S=l.p;try{if(d.T=null,l.p=2,p)return p()}finally{d.T=f,l.p=S,l.d.f()}},Tt.preconnect=function(p,f){typeof p=="string"&&(f?(f=f.crossOrigin,f=typeof f=="string"?f==="use-credentials"?f:"":void 0):f=null,l.d.C(p,f))},Tt.prefetchDNS=function(p){typeof p=="string"&&l.d.D(p)},Tt.preinit=function(p,f){if(typeof p=="string"&&f&&typeof f.as=="string"){var S=f.as,y=_(S,f.crossOrigin),x=typeof f.integrity=="string"?f.integrity:void 0,C=typeof f.fetchPriority=="string"?f.fetchPriority:void 0;S==="style"?l.d.S(p,typeof f.precedence=="string"?f.precedence:void 0,{crossOrigin:y,integrity:x,fetchPriority:C}):S==="script"&&l.d.X(p,{crossOrigin:y,integrity:x,fetchPriority:C,nonce:typeof f.nonce=="string"?f.nonce:void 0})}},Tt.preinitModule=function(p,f){if(typeof p=="string")if(typeof f=="object"&&f!==null){if(f.as==null||f.as==="script"){var S=_(f.as,f.crossOrigin);l.d.M(p,{crossOrigin:S,integrity:typeof f.integrity=="string"?f.integrity:void 0,nonce:typeof f.nonce=="string"?f.nonce:void 0})}}else f==null&&l.d.M(p)},Tt.preload=function(p,f){if(typeof p=="string"&&typeof f=="object"&&f!==null&&typeof f.as=="string"){var S=f.as,y=_(S,f.crossOrigin);l.d.L(p,S,{crossOrigin:y,integrity:typeof f.integrity=="string"?f.integrity:void 0,nonce:typeof f.nonce=="string"?f.nonce:void 0,type:typeof f.type=="string"?f.type:void 0,fetchPriority:typeof f.fetchPriority=="string"?f.fetchPriority:void 0,referrerPolicy:typeof f.referrerPolicy=="string"?f.referrerPolicy:void 0,imageSrcSet:typeof f.imageSrcSet=="string"?f.imageSrcSet:void 0,imageSizes:typeof f.imageSizes=="string"?f.imageSizes:void 0,media:typeof f.media=="string"?f.media:void 0})}},Tt.preloadModule=function(p,f){if(typeof p=="string")if(f){var S=_(f.as,f.crossOrigin);l.d.m(p,{as:typeof f.as=="string"&&f.as!=="script"?f.as:void 0,crossOrigin:S,integrity:typeof f.integrity=="string"?f.integrity:void 0})}else l.d.m(p)},Tt.requestFormReset=function(p){l.d.r(p)},Tt.unstable_batchedUpdates=function(p,f){return p(f)},Tt.useFormState=function(p,f,S){return d.H.useFormState(p,f,S)},Tt.useFormStatus=function(){return d.H.useHostTransitionStatus()},Tt.version="19.2.4",Tt}var gg;function pS(){if(gg)return Uh.exports;gg=1;function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(i){console.error(i)}}return e(),Uh.exports=fS(),Uh.exports}var mg;function _S(){if(mg)return Zn;mg=1;var e=dS(),i=Pu(),n=pS();function l(t){var s="https://react.dev/errors/"+t;if(1<arguments.length){s+="?args[]="+encodeURIComponent(arguments[1]);for(var r=2;r<arguments.length;r++)s+="&args[]="+encodeURIComponent(arguments[r])}return"Minified React error #"+t+"; visit "+s+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function o(t){return!(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)}function h(t){var s=t,r=t;if(t.alternate)for(;s.return;)s=s.return;else{t=s;do s=t,(s.flags&4098)!==0&&(r=s.return),t=s.return;while(t)}return s.tag===3?r:null}function d(t){if(t.tag===13){var s=t.memoizedState;if(s===null&&(t=t.alternate,t!==null&&(s=t.memoizedState)),s!==null)return s.dehydrated}return null}function _(t){if(t.tag===31){var s=t.memoizedState;if(s===null&&(t=t.alternate,t!==null&&(s=t.memoizedState)),s!==null)return s.dehydrated}return null}function p(t){if(h(t)!==t)throw Error(l(188))}function f(t){var s=t.alternate;if(!s){if(s=h(t),s===null)throw Error(l(188));return s!==t?null:t}for(var r=t,a=s;;){var c=r.return;if(c===null)break;var u=c.alternate;if(u===null){if(a=c.return,a!==null){r=a;continue}break}if(c.child===u.child){for(u=c.child;u;){if(u===r)return p(c),t;if(u===a)return p(c),s;u=u.sibling}throw Error(l(188))}if(r.return!==a.return)r=c,a=u;else{for(var m=!1,v=c.child;v;){if(v===r){m=!0,r=c,a=u;break}if(v===a){m=!0,a=c,r=u;break}v=v.sibling}if(!m){for(v=u.child;v;){if(v===r){m=!0,r=u,a=c;break}if(v===a){m=!0,a=u,r=c;break}v=v.sibling}if(!m)throw Error(l(189))}}if(r.alternate!==a)throw Error(l(190))}if(r.tag!==3)throw Error(l(188));return r.stateNode.current===r?t:s}function S(t){var s=t.tag;if(s===5||s===26||s===27||s===6)return t;for(t=t.child;t!==null;){if(s=S(t),s!==null)return s;t=t.sibling}return null}var y=Object.assign,x=Symbol.for("react.element"),C=Symbol.for("react.transitional.element"),b=Symbol.for("react.portal"),T=Symbol.for("react.fragment"),M=Symbol.for("react.strict_mode"),A=Symbol.for("react.profiler"),O=Symbol.for("react.consumer"),D=Symbol.for("react.context"),L=Symbol.for("react.forward_ref"),H=Symbol.for("react.suspense"),X=Symbol.for("react.suspense_list"),V=Symbol.for("react.memo"),ue=Symbol.for("react.lazy"),ge=Symbol.for("react.activity"),Ke=Symbol.for("react.memo_cache_sentinel"),de=Symbol.iterator;function Z(t){return t===null||typeof t!="object"?null:(t=de&&t[de]||t["@@iterator"],typeof t=="function"?t:null)}var G=Symbol.for("react.client.reference");function ie(t){if(t==null)return null;if(typeof t=="function")return t.$$typeof===G?null:t.displayName||t.name||null;if(typeof t=="string")return t;switch(t){case T:return"Fragment";case A:return"Profiler";case M:return"StrictMode";case H:return"Suspense";case X:return"SuspenseList";case ge:return"Activity"}if(typeof t=="object")switch(t.$$typeof){case b:return"Portal";case D:return t.displayName||"Context";case O:return(t._context.displayName||"Context")+".Consumer";case L:var s=t.render;return t=t.displayName,t||(t=s.displayName||s.name||"",t=t!==""?"ForwardRef("+t+")":"ForwardRef"),t;case V:return s=t.displayName||null,s!==null?s:ie(t.type)||"Memo";case ue:s=t._payload,t=t._init;try{return ie(t(s))}catch{}}return null}var ee=Array.isArray,R=i.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,I=n.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,$={pending:!1,data:null,method:null,action:null},ae=[],pe=-1;function k(t){return{current:t}}function P(t){0>pe||(t.current=ae[pe],ae[pe]=null,pe--)}function J(t,s){pe++,ae[pe]=t.current,t.current=s}var te=k(null),oe=k(null),he=k(null),be=k(null);function ot(t,s){switch(J(he,s),J(oe,t),J(te,null),s.nodeType){case 9:case 11:t=(t=s.documentElement)&&(t=t.namespaceURI)?z_(t):0;break;default:if(t=s.tagName,s=s.namespaceURI)s=z_(s),t=A_(s,t);else switch(t){case"svg":t=1;break;case"math":t=2;break;default:t=0}}P(te),J(te,t)}function ze(){P(te),P(oe),P(he)}function wi(t){t.memoizedState!==null&&J(be,t);var s=te.current,r=A_(s,t.type);s!==r&&(J(oe,t),J(te,r))}function Ci(t){oe.current===t&&(P(te),P(oe)),be.current===t&&(P(be),Kn._currentValue=$)}var ti,Re;function mi(t){if(ti===void 0)try{throw Error()}catch(r){var s=r.stack.trim().match(/\n( *(at )?)/);ti=s&&s[1]||"",Re=-1<r.stack.indexOf(`
|
|
2
2
|
at`)?" (<anonymous>)":-1<r.stack.indexOf("@")?"@unknown:0:0":""}return`
|
|
3
|
-
`+ti+t+Re}var mo=!1;function vo(t,s){if(!t||mo)return"";mo=!0;var r=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var a={DetermineComponentFrameRoot:function(){try{if(s){var
|
|
3
|
+
`+ti+t+Re}var mo=!1;function vo(t,s){if(!t||mo)return"";mo=!0;var r=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var a={DetermineComponentFrameRoot:function(){try{if(s){var K=function(){throw Error()};if(Object.defineProperty(K.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(K,[])}catch(W){var U=W}Reflect.construct(t,[],K)}else{try{K.call()}catch(W){U=W}t.call(K.prototype)}}else{try{throw Error()}catch(W){U=W}(K=t())&&typeof K.catch=="function"&&K.catch(function(){})}}catch(W){if(W&&U&&typeof W.stack=="string")return[W.stack,U.stack]}return[null,null]}};a.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var c=Object.getOwnPropertyDescriptor(a.DetermineComponentFrameRoot,"name");c&&c.configurable&&Object.defineProperty(a.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var u=a.DetermineComponentFrameRoot(),m=u[0],v=u[1];if(m&&v){var w=m.split(`
|
|
4
4
|
`),N=v.split(`
|
|
5
5
|
`);for(c=a=0;a<w.length&&!w[a].includes("DetermineComponentFrameRoot");)a++;for(;c<N.length&&!N[c].includes("DetermineComponentFrameRoot");)c++;if(a===w.length||c===N.length)for(a=w.length-1,c=N.length-1;1<=a&&0<=c&&w[a]!==N[c];)c--;for(;1<=a&&0<=c;a--,c--)if(w[a]!==N[c]){if(a!==1||c!==1)do if(a--,c--,0>c||w[a]!==N[c]){var q=`
|
|
6
6
|
`+w[a].replace(" at new "," at ");return t.displayName&&q.includes("<anonymous>")&&(q=q.replace("<anonymous>",t.displayName)),q}while(1<=a&&0<=c);break}}}finally{mo=!1,Error.prepareStackTrace=r}return(r=t?t.displayName||t.name:"")?mi(r):""}function Uv(t,s){switch(t.tag){case 26:case 27:case 5:return mi(t.type);case 16:return mi("Lazy");case 13:return t.child!==s&&s!==null?mi("Suspense Fallback"):mi("Suspense");case 19:return mi("SuspenseList");case 0:case 15:return vo(t.type,!1);case 11:return vo(t.type.render,!1);case 1:return vo(t.type,!0);case 31:return mi("Activity");default:return""}}function od(t){try{var s="",r=null;do s+=Uv(t,r),r=t,t=t.return;while(t);return s}catch(a){return`
|
|
7
7
|
Error generating stack: `+a.message+`
|
|
8
|
-
`+a.stack}}var yo=Object.prototype.hasOwnProperty,So=e.unstable_scheduleCallback,bo=e.unstable_cancelCallback,Wv=e.unstable_shouldYield,qv=e.unstable_requestPaint,Pt=e.unstable_now,Pv=e.unstable_getCurrentPriorityLevel,cd=e.unstable_ImmediatePriority,hd=e.unstable_UserBlockingPriority,xl=e.unstable_NormalPriority,Iv=e.unstable_LowPriority,ud=e.unstable_IdlePriority,$v=e.log,Kv=e.unstable_setDisableYieldValue,rn=null,It=null;function ls(t){if(typeof $v=="function"&&Kv(t),It&&typeof It.setStrictMode=="function")try{It.setStrictMode(rn,t)}catch{}}var $t=Math.clz32?Math.clz32:Gv,Yv=Math.log,Fv=Math.LN2;function Gv(t){return t>>>=0,t===0?32:31-(Yv(t)/Fv|0)|0}var wl=256,Cl=262144,kl=4194304;function Ns(t){var s=t&42;if(s!==0)return s;switch(t&-t){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 t&261888;case 262144:case 524288:case 1048576:case 2097152:return t&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return t&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return t}}function El(t,s,r){var a=t.pendingLanes;if(a===0)return 0;var c=0,u=t.suspendedLanes,m=t.pingedLanes;t=t.warmLanes;var v=a&134217727;return v!==0?(a=v&~u,a!==0?c=Ns(a):(m&=v,m!==0?c=Ns(m):r||(r=v&~t,r!==0&&(c=Ns(r))))):(v=a&~u,v!==0?c=Ns(v):m!==0?c=Ns(m):r||(r=a&~t,r!==0&&(c=Ns(r)))),c===0?0:s!==0&&s!==c&&(s&u)===0&&(u=c&-c,r=s&-s,u>=r||u===32&&(r&4194048)!==0)?s:c}function nn(t,s){return(t.pendingLanes&~(t.suspendedLanes&~t.pingedLanes)&s)===0}function Xv(t,s){switch(t){case 1:case 2:case 4:case 8:case 64:return s+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 s+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 dd(){var t=kl;return kl<<=1,(kl&62914560)===0&&(kl=4194304),t}function xo(t){for(var s=[],r=0;31>r;r++)s.push(t);return s}function ln(t,s){t.pendingLanes|=s,s!==268435456&&(t.suspendedLanes=0,t.pingedLanes=0,t.warmLanes=0)}function Vv(t,s,r,a,c,u){var m=t.pendingLanes;t.pendingLanes=r,t.suspendedLanes=0,t.pingedLanes=0,t.warmLanes=0,t.expiredLanes&=r,t.entangledLanes&=r,t.errorRecoveryDisabledLanes&=r,t.shellSuspendCounter=0;var v=t.entanglements,w=t.expirationTimes,N=t.hiddenUpdates;for(r=m&~r;0<r;){var q=31-$t(r),Y=1<<q;v[q]=0,w[q]=-1;var U=N[q];if(U!==null)for(N[q]=null,q=0;q<U.length;q++){var W=U[q];W!==null&&(W.lane&=-536870913)}r&=~Y}a!==0&&fd(t,a,0),u!==0&&c===0&&t.tag!==0&&(t.suspendedLanes|=u&~(m&~s))}function fd(t,s,r){t.pendingLanes|=s,t.suspendedLanes&=~s;var a=31-$t(s);t.entangledLanes|=s,t.entanglements[a]=t.entanglements[a]|1073741824|r&261930}function pd(t,s){var r=t.entangledLanes|=s;for(t=t.entanglements;r;){var a=31-$t(r),c=1<<a;c&s|t[a]&s&&(t[a]|=s),r&=~c}}function _d(t,s){var r=s&-s;return r=(r&42)!==0?1:wo(r),(r&(t.suspendedLanes|s))!==0?0:r}function wo(t){switch(t){case 2:t=1;break;case 8:t=4;break;case 32:t=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:t=128;break;case 268435456:t=134217728;break;default:t=0}return t}function Co(t){return t&=-t,2<t?8<t?(t&134217727)!==0?32:268435456:8:2}function gd(){var t=I.p;return t!==0?t:(t=window.event,t===void 0?32:ig(t.type))}function md(t,s){var r=I.p;try{return I.p=t,s()}finally{I.p=r}}var as=Math.random().toString(36).slice(2),St="__reactFiber$"+as,Ot="__reactProps$"+as,dr="__reactContainer$"+as,ko="__reactEvents$"+as,Zv="__reactListeners$"+as,Qv="__reactHandles$"+as,vd="__reactResources$"+as,an="__reactMarker$"+as;function Eo(t){delete t[St],delete t[Ot],delete t[ko],delete t[Zv],delete t[Qv]}function fr(t){var s=t[St];if(s)return s;for(var r=t.parentNode;r;){if(s=r[dr]||r[St]){if(r=s.alternate,s.child!==null||r!==null&&r.child!==null)for(t=W_(t);t!==null;){if(r=t[St])return r;t=W_(t)}return s}t=r,r=t.parentNode}return null}function pr(t){if(t=t[St]||t[dr]){var s=t.tag;if(s===5||s===6||s===13||s===31||s===26||s===27||s===3)return t}return null}function on(t){var s=t.tag;if(s===5||s===26||s===27||s===6)return t.stateNode;throw Error(l(33))}function _r(t){var s=t[vd];return s||(s=t[vd]={hoistableStyles:new Map,hoistableScripts:new Map}),s}function ft(t){t[an]=!0}var yd=new Set,Sd={};function Hs(t,s){gr(t,s),gr(t+"Capture",s)}function gr(t,s){for(Sd[t]=s,t=0;t<s.length;t++)yd.add(s[t])}var Jv=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]*$"),bd={},xd={};function e0(t){return yo.call(xd,t)?!0:yo.call(bd,t)?!1:Jv.test(t)?xd[t]=!0:(bd[t]=!0,!1)}function Tl(t,s,r){if(e0(s))if(r===null)t.removeAttribute(s);else{switch(typeof r){case"undefined":case"function":case"symbol":t.removeAttribute(s);return;case"boolean":var a=s.toLowerCase().slice(0,5);if(a!=="data-"&&a!=="aria-"){t.removeAttribute(s);return}}t.setAttribute(s,""+r)}}function Rl(t,s,r){if(r===null)t.removeAttribute(s);else{switch(typeof r){case"undefined":case"function":case"symbol":case"boolean":t.removeAttribute(s);return}t.setAttribute(s,""+r)}}function Ni(t,s,r,a){if(a===null)t.removeAttribute(r);else{switch(typeof a){case"undefined":case"function":case"symbol":case"boolean":t.removeAttribute(r);return}t.setAttributeNS(s,r,""+a)}}function ii(t){switch(typeof t){case"bigint":case"boolean":case"number":case"string":case"undefined":return t;case"object":return t;default:return""}}function wd(t){var s=t.type;return(t=t.nodeName)&&t.toLowerCase()==="input"&&(s==="checkbox"||s==="radio")}function t0(t,s,r){var a=Object.getOwnPropertyDescriptor(t.constructor.prototype,s);if(!t.hasOwnProperty(s)&&typeof a<"u"&&typeof a.get=="function"&&typeof a.set=="function"){var c=a.get,u=a.set;return Object.defineProperty(t,s,{configurable:!0,get:function(){return c.call(this)},set:function(m){r=""+m,u.call(this,m)}}),Object.defineProperty(t,s,{enumerable:a.enumerable}),{getValue:function(){return r},setValue:function(m){r=""+m},stopTracking:function(){t._valueTracker=null,delete t[s]}}}}function To(t){if(!t._valueTracker){var s=wd(t)?"checked":"value";t._valueTracker=t0(t,s,""+t[s])}}function Cd(t){if(!t)return!1;var s=t._valueTracker;if(!s)return!0;var r=s.getValue(),a="";return t&&(a=wd(t)?t.checked?"true":"false":t.value),t=a,t!==r?(s.setValue(t),!0):!1}function Dl(t){if(t=t||(typeof document<"u"?document:void 0),typeof t>"u")return null;try{return t.activeElement||t.body}catch{return t.body}}var i0=/[\n"\\]/g;function si(t){return t.replace(i0,function(s){return"\\"+s.charCodeAt(0).toString(16)+" "})}function Ro(t,s,r,a,c,u,m,v){t.name="",m!=null&&typeof m!="function"&&typeof m!="symbol"&&typeof m!="boolean"?t.type=m:t.removeAttribute("type"),s!=null?m==="number"?(s===0&&t.value===""||t.value!=s)&&(t.value=""+ii(s)):t.value!==""+ii(s)&&(t.value=""+ii(s)):m!=="submit"&&m!=="reset"||t.removeAttribute("value"),s!=null?Do(t,m,ii(s)):r!=null?Do(t,m,ii(r)):a!=null&&t.removeAttribute("value"),c==null&&u!=null&&(t.defaultChecked=!!u),c!=null&&(t.checked=c&&typeof c!="function"&&typeof c!="symbol"),v!=null&&typeof v!="function"&&typeof v!="symbol"&&typeof v!="boolean"?t.name=""+ii(v):t.removeAttribute("name")}function kd(t,s,r,a,c,u,m,v){if(u!=null&&typeof u!="function"&&typeof u!="symbol"&&typeof u!="boolean"&&(t.type=u),s!=null||r!=null){if(!(u!=="submit"&&u!=="reset"||s!=null)){To(t);return}r=r!=null?""+ii(r):"",s=s!=null?""+ii(s):r,v||s===t.value||(t.value=s),t.defaultValue=s}a=a??c,a=typeof a!="function"&&typeof a!="symbol"&&!!a,t.checked=v?t.checked:!!a,t.defaultChecked=!!a,m!=null&&typeof m!="function"&&typeof m!="symbol"&&typeof m!="boolean"&&(t.name=m),To(t)}function Do(t,s,r){s==="number"&&Dl(t.ownerDocument)===t||t.defaultValue===""+r||(t.defaultValue=""+r)}function mr(t,s,r,a){if(t=t.options,s){s={};for(var c=0;c<r.length;c++)s["$"+r[c]]=!0;for(r=0;r<t.length;r++)c=s.hasOwnProperty("$"+t[r].value),t[r].selected!==c&&(t[r].selected=c),c&&a&&(t[r].defaultSelected=!0)}else{for(r=""+ii(r),s=null,c=0;c<t.length;c++){if(t[c].value===r){t[c].selected=!0,a&&(t[c].defaultSelected=!0);return}s!==null||t[c].disabled||(s=t[c])}s!==null&&(s.selected=!0)}}function Ed(t,s,r){if(s!=null&&(s=""+ii(s),s!==t.value&&(t.value=s),r==null)){t.defaultValue!==s&&(t.defaultValue=s);return}t.defaultValue=r!=null?""+ii(r):""}function Td(t,s,r,a){if(s==null){if(a!=null){if(r!=null)throw Error(l(92));if(ee(a)){if(1<a.length)throw Error(l(93));a=a[0]}r=a}r==null&&(r=""),s=r}r=ii(s),t.defaultValue=r,a=t.textContent,a===r&&a!==""&&a!==null&&(t.value=a),To(t)}function vr(t,s){if(s){var r=t.firstChild;if(r&&r===t.lastChild&&r.nodeType===3){r.nodeValue=s;return}}t.textContent=s}var s0=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 Rd(t,s,r){var a=s.indexOf("--")===0;r==null||typeof r=="boolean"||r===""?a?t.setProperty(s,""):s==="float"?t.cssFloat="":t[s]="":a?t.setProperty(s,r):typeof r!="number"||r===0||s0.has(s)?s==="float"?t.cssFloat=r:t[s]=(""+r).trim():t[s]=r+"px"}function Dd(t,s,r){if(s!=null&&typeof s!="object")throw Error(l(62));if(t=t.style,r!=null){for(var a in r)!r.hasOwnProperty(a)||s!=null&&s.hasOwnProperty(a)||(a.indexOf("--")===0?t.setProperty(a,""):a==="float"?t.cssFloat="":t[a]="");for(var c in s)a=s[c],s.hasOwnProperty(c)&&r[c]!==a&&Rd(t,c,a)}else for(var u in s)s.hasOwnProperty(u)&&Rd(t,u,s[u])}function Bo(t){if(t.indexOf("-")===-1)return!1;switch(t){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 r0=new Map([["acceptCharset","accept-charset"],["htmlFor","for"],["httpEquiv","http-equiv"],["crossOrigin","crossorigin"],["accentHeight","accent-height"],["alignmentBaseline","alignment-baseline"],["arabicForm","arabic-form"],["baselineShift","baseline-shift"],["capHeight","cap-height"],["clipPath","clip-path"],["clipRule","clip-rule"],["colorInterpolation","color-interpolation"],["colorInterpolationFilters","color-interpolation-filters"],["colorProfile","color-profile"],["colorRendering","color-rendering"],["dominantBaseline","dominant-baseline"],["enableBackground","enable-background"],["fillOpacity","fill-opacity"],["fillRule","fill-rule"],["floodColor","flood-color"],["floodOpacity","flood-opacity"],["fontFamily","font-family"],["fontSize","font-size"],["fontSizeAdjust","font-size-adjust"],["fontStretch","font-stretch"],["fontStyle","font-style"],["fontVariant","font-variant"],["fontWeight","font-weight"],["glyphName","glyph-name"],["glyphOrientationHorizontal","glyph-orientation-horizontal"],["glyphOrientationVertical","glyph-orientation-vertical"],["horizAdvX","horiz-adv-x"],["horizOriginX","horiz-origin-x"],["imageRendering","image-rendering"],["letterSpacing","letter-spacing"],["lightingColor","lighting-color"],["markerEnd","marker-end"],["markerMid","marker-mid"],["markerStart","marker-start"],["overlinePosition","overline-position"],["overlineThickness","overline-thickness"],["paintOrder","paint-order"],["panose-1","panose-1"],["pointerEvents","pointer-events"],["renderingIntent","rendering-intent"],["shapeRendering","shape-rendering"],["stopColor","stop-color"],["stopOpacity","stop-opacity"],["strikethroughPosition","strikethrough-position"],["strikethroughThickness","strikethrough-thickness"],["strokeDasharray","stroke-dasharray"],["strokeDashoffset","stroke-dashoffset"],["strokeLinecap","stroke-linecap"],["strokeLinejoin","stroke-linejoin"],["strokeMiterlimit","stroke-miterlimit"],["strokeOpacity","stroke-opacity"],["strokeWidth","stroke-width"],["textAnchor","text-anchor"],["textDecoration","text-decoration"],["textRendering","text-rendering"],["transformOrigin","transform-origin"],["underlinePosition","underline-position"],["underlineThickness","underline-thickness"],["unicodeBidi","unicode-bidi"],["unicodeRange","unicode-range"],["unitsPerEm","units-per-em"],["vAlphabetic","v-alphabetic"],["vHanging","v-hanging"],["vIdeographic","v-ideographic"],["vMathematical","v-mathematical"],["vectorEffect","vector-effect"],["vertAdvY","vert-adv-y"],["vertOriginX","vert-origin-x"],["vertOriginY","vert-origin-y"],["wordSpacing","word-spacing"],["writingMode","writing-mode"],["xmlnsXlink","xmlns:xlink"],["xHeight","x-height"]]),n0=/^[\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 Bl(t){return n0.test(""+t)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":t}function Hi(){}var Mo=null;function zo(t){return t=t.target||t.srcElement||window,t.correspondingUseElement&&(t=t.correspondingUseElement),t.nodeType===3?t.parentNode:t}var yr=null,Sr=null;function Bd(t){var s=pr(t);if(s&&(t=s.stateNode)){var r=t[Ot]||null;e:switch(t=s.stateNode,s.type){case"input":if(Ro(t,r.value,r.defaultValue,r.defaultValue,r.checked,r.defaultChecked,r.type,r.name),s=r.name,r.type==="radio"&&s!=null){for(r=t;r.parentNode;)r=r.parentNode;for(r=r.querySelectorAll('input[name="'+si(""+s)+'"][type="radio"]'),s=0;s<r.length;s++){var a=r[s];if(a!==t&&a.form===t.form){var c=a[Ot]||null;if(!c)throw Error(l(90));Ro(a,c.value,c.defaultValue,c.defaultValue,c.checked,c.defaultChecked,c.type,c.name)}}for(s=0;s<r.length;s++)a=r[s],a.form===t.form&&Cd(a)}break e;case"textarea":Ed(t,r.value,r.defaultValue);break e;case"select":s=r.value,s!=null&&mr(t,!!r.multiple,s,!1)}}}var Ao=!1;function Md(t,s,r){if(Ao)return t(s,r);Ao=!0;try{var a=t(s);return a}finally{if(Ao=!1,(yr!==null||Sr!==null)&&(ma(),yr&&(s=yr,t=Sr,Sr=yr=null,Bd(s),t)))for(s=0;s<t.length;s++)Bd(t[s])}}function cn(t,s){var r=t.stateNode;if(r===null)return null;var a=r[Ot]||null;if(a===null)return null;r=a[s];e:switch(s){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(a=!a.disabled)||(t=t.type,a=!(t==="button"||t==="input"||t==="select"||t==="textarea")),t=!a;break e;default:t=!1}if(t)return null;if(r&&typeof r!="function")throw Error(l(231,s,typeof r));return r}var Ui=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Oo=!1;if(Ui)try{var hn={};Object.defineProperty(hn,"passive",{get:function(){Oo=!0}}),window.addEventListener("test",hn,hn),window.removeEventListener("test",hn,hn)}catch{Oo=!1}var os=null,Lo=null,Ml=null;function zd(){if(Ml)return Ml;var t,s=Lo,r=s.length,a,c="value"in os?os.value:os.textContent,u=c.length;for(t=0;t<r&&s[t]===c[t];t++);var m=r-t;for(a=1;a<=m&&s[r-a]===c[u-a];a++);return Ml=c.slice(t,1<a?1-a:void 0)}function zl(t){var s=t.keyCode;return"charCode"in t?(t=t.charCode,t===0&&s===13&&(t=13)):t=s,t===10&&(t=13),32<=t||t===13?t:0}function Al(){return!0}function Ad(){return!1}function Lt(t){function s(r,a,c,u,m){this._reactName=r,this._targetInst=c,this.type=a,this.nativeEvent=u,this.target=m,this.currentTarget=null;for(var v in t)t.hasOwnProperty(v)&&(r=t[v],this[v]=r?r(u):u[v]);return this.isDefaultPrevented=(u.defaultPrevented!=null?u.defaultPrevented:u.returnValue===!1)?Al:Ad,this.isPropagationStopped=Ad,this}return y(s.prototype,{preventDefault:function(){this.defaultPrevented=!0;var r=this.nativeEvent;r&&(r.preventDefault?r.preventDefault():typeof r.returnValue!="unknown"&&(r.returnValue=!1),this.isDefaultPrevented=Al)},stopPropagation:function(){var r=this.nativeEvent;r&&(r.stopPropagation?r.stopPropagation():typeof r.cancelBubble!="unknown"&&(r.cancelBubble=!0),this.isPropagationStopped=Al)},persist:function(){},isPersistent:Al}),s}var Us={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(t){return t.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Ol=Lt(Us),un=y({},Us,{view:0,detail:0}),l0=Lt(un),jo,No,dn,Ll=y({},un,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Uo,button:0,buttons:0,relatedTarget:function(t){return t.relatedTarget===void 0?t.fromElement===t.srcElement?t.toElement:t.fromElement:t.relatedTarget},movementX:function(t){return"movementX"in t?t.movementX:(t!==dn&&(dn&&t.type==="mousemove"?(jo=t.screenX-dn.screenX,No=t.screenY-dn.screenY):No=jo=0,dn=t),jo)},movementY:function(t){return"movementY"in t?t.movementY:No}}),Od=Lt(Ll),a0=y({},Ll,{dataTransfer:0}),o0=Lt(a0),c0=y({},un,{relatedTarget:0}),Ho=Lt(c0),h0=y({},Us,{animationName:0,elapsedTime:0,pseudoElement:0}),u0=Lt(h0),d0=y({},Us,{clipboardData:function(t){return"clipboardData"in t?t.clipboardData:window.clipboardData}}),f0=Lt(d0),p0=y({},Us,{data:0}),Ld=Lt(p0),_0={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},g0={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"},m0={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function v0(t){var s=this.nativeEvent;return s.getModifierState?s.getModifierState(t):(t=m0[t])?!!s[t]:!1}function Uo(){return v0}var y0=y({},un,{key:function(t){if(t.key){var s=_0[t.key]||t.key;if(s!=="Unidentified")return s}return t.type==="keypress"?(t=zl(t),t===13?"Enter":String.fromCharCode(t)):t.type==="keydown"||t.type==="keyup"?g0[t.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Uo,charCode:function(t){return t.type==="keypress"?zl(t):0},keyCode:function(t){return t.type==="keydown"||t.type==="keyup"?t.keyCode:0},which:function(t){return t.type==="keypress"?zl(t):t.type==="keydown"||t.type==="keyup"?t.keyCode:0}}),S0=Lt(y0),b0=y({},Ll,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),jd=Lt(b0),x0=y({},un,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Uo}),w0=Lt(x0),C0=y({},Us,{propertyName:0,elapsedTime:0,pseudoElement:0}),k0=Lt(C0),E0=y({},Ll,{deltaX:function(t){return"deltaX"in t?t.deltaX:"wheelDeltaX"in t?-t.wheelDeltaX:0},deltaY:function(t){return"deltaY"in t?t.deltaY:"wheelDeltaY"in t?-t.wheelDeltaY:"wheelDelta"in t?-t.wheelDelta:0},deltaZ:0,deltaMode:0}),T0=Lt(E0),R0=y({},Us,{newState:0,oldState:0}),D0=Lt(R0),B0=[9,13,27,32],Wo=Ui&&"CompositionEvent"in window,fn=null;Ui&&"documentMode"in document&&(fn=document.documentMode);var M0=Ui&&"TextEvent"in window&&!fn,Nd=Ui&&(!Wo||fn&&8<fn&&11>=fn),Hd=" ",Ud=!1;function Wd(t,s){switch(t){case"keyup":return B0.indexOf(s.keyCode)!==-1;case"keydown":return s.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function qd(t){return t=t.detail,typeof t=="object"&&"data"in t?t.data:null}var br=!1;function z0(t,s){switch(t){case"compositionend":return qd(s);case"keypress":return s.which!==32?null:(Ud=!0,Hd);case"textInput":return t=s.data,t===Hd&&Ud?null:t;default:return null}}function A0(t,s){if(br)return t==="compositionend"||!Wo&&Wd(t,s)?(t=zd(),Ml=Lo=os=null,br=!1,t):null;switch(t){case"paste":return null;case"keypress":if(!(s.ctrlKey||s.altKey||s.metaKey)||s.ctrlKey&&s.altKey){if(s.char&&1<s.char.length)return s.char;if(s.which)return String.fromCharCode(s.which)}return null;case"compositionend":return Nd&&s.locale!=="ko"?null:s.data;default:return null}}var O0={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 Pd(t){var s=t&&t.nodeName&&t.nodeName.toLowerCase();return s==="input"?!!O0[t.type]:s==="textarea"}function Id(t,s,r,a){yr?Sr?Sr.push(a):Sr=[a]:yr=a,s=Ca(s,"onChange"),0<s.length&&(r=new Ol("onChange","change",null,r,a),t.push({event:r,listeners:s}))}var pn=null,_n=null;function L0(t){E_(t,0)}function jl(t){var s=on(t);if(Cd(s))return t}function $d(t,s){if(t==="change")return s}var Kd=!1;if(Ui){var qo;if(Ui){var Po="oninput"in document;if(!Po){var Yd=document.createElement("div");Yd.setAttribute("oninput","return;"),Po=typeof Yd.oninput=="function"}qo=Po}else qo=!1;Kd=qo&&(!document.documentMode||9<document.documentMode)}function Fd(){pn&&(pn.detachEvent("onpropertychange",Gd),_n=pn=null)}function Gd(t){if(t.propertyName==="value"&&jl(_n)){var s=[];Id(s,_n,t,zo(t)),Md(L0,s)}}function j0(t,s,r){t==="focusin"?(Fd(),pn=s,_n=r,pn.attachEvent("onpropertychange",Gd)):t==="focusout"&&Fd()}function N0(t){if(t==="selectionchange"||t==="keyup"||t==="keydown")return jl(_n)}function H0(t,s){if(t==="click")return jl(s)}function U0(t,s){if(t==="input"||t==="change")return jl(s)}function W0(t,s){return t===s&&(t!==0||1/t===1/s)||t!==t&&s!==s}var Kt=typeof Object.is=="function"?Object.is:W0;function gn(t,s){if(Kt(t,s))return!0;if(typeof t!="object"||t===null||typeof s!="object"||s===null)return!1;var r=Object.keys(t),a=Object.keys(s);if(r.length!==a.length)return!1;for(a=0;a<r.length;a++){var c=r[a];if(!yo.call(s,c)||!Kt(t[c],s[c]))return!1}return!0}function Xd(t){for(;t&&t.firstChild;)t=t.firstChild;return t}function Vd(t,s){var r=Xd(t);t=0;for(var a;r;){if(r.nodeType===3){if(a=t+r.textContent.length,t<=s&&a>=s)return{node:r,offset:s-t};t=a}e:{for(;r;){if(r.nextSibling){r=r.nextSibling;break e}r=r.parentNode}r=void 0}r=Xd(r)}}function Zd(t,s){return t&&s?t===s?!0:t&&t.nodeType===3?!1:s&&s.nodeType===3?Zd(t,s.parentNode):"contains"in t?t.contains(s):t.compareDocumentPosition?!!(t.compareDocumentPosition(s)&16):!1:!1}function Qd(t){t=t!=null&&t.ownerDocument!=null&&t.ownerDocument.defaultView!=null?t.ownerDocument.defaultView:window;for(var s=Dl(t.document);s instanceof t.HTMLIFrameElement;){try{var r=typeof s.contentWindow.location.href=="string"}catch{r=!1}if(r)t=s.contentWindow;else break;s=Dl(t.document)}return s}function Io(t){var s=t&&t.nodeName&&t.nodeName.toLowerCase();return s&&(s==="input"&&(t.type==="text"||t.type==="search"||t.type==="tel"||t.type==="url"||t.type==="password")||s==="textarea"||t.contentEditable==="true")}var q0=Ui&&"documentMode"in document&&11>=document.documentMode,xr=null,$o=null,mn=null,Ko=!1;function Jd(t,s,r){var a=r.window===r?r.document:r.nodeType===9?r:r.ownerDocument;Ko||xr==null||xr!==Dl(a)||(a=xr,"selectionStart"in a&&Io(a)?a={start:a.selectionStart,end:a.selectionEnd}:(a=(a.ownerDocument&&a.ownerDocument.defaultView||window).getSelection(),a={anchorNode:a.anchorNode,anchorOffset:a.anchorOffset,focusNode:a.focusNode,focusOffset:a.focusOffset}),mn&&gn(mn,a)||(mn=a,a=Ca($o,"onSelect"),0<a.length&&(s=new Ol("onSelect","select",null,s,r),t.push({event:s,listeners:a}),s.target=xr)))}function Ws(t,s){var r={};return r[t.toLowerCase()]=s.toLowerCase(),r["Webkit"+t]="webkit"+s,r["Moz"+t]="moz"+s,r}var wr={animationend:Ws("Animation","AnimationEnd"),animationiteration:Ws("Animation","AnimationIteration"),animationstart:Ws("Animation","AnimationStart"),transitionrun:Ws("Transition","TransitionRun"),transitionstart:Ws("Transition","TransitionStart"),transitioncancel:Ws("Transition","TransitionCancel"),transitionend:Ws("Transition","TransitionEnd")},Yo={},ef={};Ui&&(ef=document.createElement("div").style,"AnimationEvent"in window||(delete wr.animationend.animation,delete wr.animationiteration.animation,delete wr.animationstart.animation),"TransitionEvent"in window||delete wr.transitionend.transition);function qs(t){if(Yo[t])return Yo[t];if(!wr[t])return t;var s=wr[t],r;for(r in s)if(s.hasOwnProperty(r)&&r in ef)return Yo[t]=s[r];return t}var tf=qs("animationend"),sf=qs("animationiteration"),rf=qs("animationstart"),P0=qs("transitionrun"),I0=qs("transitionstart"),$0=qs("transitioncancel"),nf=qs("transitionend"),lf=new Map,Fo="abort auxClick beforeToggle cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");Fo.push("scrollEnd");function vi(t,s){lf.set(t,s),Hs(s,[t])}var Nl=typeof reportError=="function"?reportError:function(t){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var s=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof t=="object"&&t!==null&&typeof t.message=="string"?String(t.message):String(t),error:t});if(!window.dispatchEvent(s))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",t);return}console.error(t)},ri=[],Cr=0,Go=0;function Hl(){for(var t=Cr,s=Go=Cr=0;s<t;){var r=ri[s];ri[s++]=null;var a=ri[s];ri[s++]=null;var c=ri[s];ri[s++]=null;var u=ri[s];if(ri[s++]=null,a!==null&&c!==null){var m=a.pending;m===null?c.next=c:(c.next=m.next,m.next=c),a.pending=c}u!==0&&af(r,c,u)}}function Ul(t,s,r,a){ri[Cr++]=t,ri[Cr++]=s,ri[Cr++]=r,ri[Cr++]=a,Go|=a,t.lanes|=a,t=t.alternate,t!==null&&(t.lanes|=a)}function Xo(t,s,r,a){return Ul(t,s,r,a),Wl(t)}function Ps(t,s){return Ul(t,null,null,s),Wl(t)}function af(t,s,r){t.lanes|=r;var a=t.alternate;a!==null&&(a.lanes|=r);for(var c=!1,u=t.return;u!==null;)u.childLanes|=r,a=u.alternate,a!==null&&(a.childLanes|=r),u.tag===22&&(t=u.stateNode,t===null||t._visibility&1||(c=!0)),t=u,u=u.return;return t.tag===3?(u=t.stateNode,c&&s!==null&&(c=31-$t(r),t=u.hiddenUpdates,a=t[c],a===null?t[c]=[s]:a.push(s),s.lane=r|536870912),u):null}function Wl(t){if(50<Un)throw Un=0,rh=null,Error(l(185));for(var s=t.return;s!==null;)t=s,s=t.return;return t.tag===3?t.stateNode:null}var kr={};function K0(t,s,r,a){this.tag=t,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=s,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=a,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Yt(t,s,r,a){return new K0(t,s,r,a)}function Vo(t){return t=t.prototype,!(!t||!t.isReactComponent)}function Wi(t,s){var r=t.alternate;return r===null?(r=Yt(t.tag,s,t.key,t.mode),r.elementType=t.elementType,r.type=t.type,r.stateNode=t.stateNode,r.alternate=t,t.alternate=r):(r.pendingProps=s,r.type=t.type,r.flags=0,r.subtreeFlags=0,r.deletions=null),r.flags=t.flags&65011712,r.childLanes=t.childLanes,r.lanes=t.lanes,r.child=t.child,r.memoizedProps=t.memoizedProps,r.memoizedState=t.memoizedState,r.updateQueue=t.updateQueue,s=t.dependencies,r.dependencies=s===null?null:{lanes:s.lanes,firstContext:s.firstContext},r.sibling=t.sibling,r.index=t.index,r.ref=t.ref,r.refCleanup=t.refCleanup,r}function of(t,s){t.flags&=65011714;var r=t.alternate;return r===null?(t.childLanes=0,t.lanes=s,t.child=null,t.subtreeFlags=0,t.memoizedProps=null,t.memoizedState=null,t.updateQueue=null,t.dependencies=null,t.stateNode=null):(t.childLanes=r.childLanes,t.lanes=r.lanes,t.child=r.child,t.subtreeFlags=0,t.deletions=null,t.memoizedProps=r.memoizedProps,t.memoizedState=r.memoizedState,t.updateQueue=r.updateQueue,t.type=r.type,s=r.dependencies,t.dependencies=s===null?null:{lanes:s.lanes,firstContext:s.firstContext}),t}function ql(t,s,r,a,c,u){var m=0;if(a=t,typeof t=="function")Vo(t)&&(m=1);else if(typeof t=="string")m=Vy(t,r,te.current)?26:t==="html"||t==="head"||t==="body"?27:5;else e:switch(t){case ge:return t=Yt(31,r,s,c),t.elementType=ge,t.lanes=u,t;case T:return Is(r.children,c,u,s);case M:m=8,c|=24;break;case A:return t=Yt(12,r,s,c|2),t.elementType=A,t.lanes=u,t;case H:return t=Yt(13,r,s,c),t.elementType=H,t.lanes=u,t;case X:return t=Yt(19,r,s,c),t.elementType=X,t.lanes=u,t;default:if(typeof t=="object"&&t!==null)switch(t.$$typeof){case D:m=10;break e;case O:m=9;break e;case L:m=11;break e;case V:m=14;break e;case ue:m=16,a=null;break e}m=29,r=Error(l(130,t===null?"null":typeof t,"")),a=null}return s=Yt(m,r,s,c),s.elementType=t,s.type=a,s.lanes=u,s}function Is(t,s,r,a){return t=Yt(7,t,a,s),t.lanes=r,t}function Zo(t,s,r){return t=Yt(6,t,null,s),t.lanes=r,t}function cf(t){var s=Yt(18,null,null,0);return s.stateNode=t,s}function Qo(t,s,r){return s=Yt(4,t.children!==null?t.children:[],t.key,s),s.lanes=r,s.stateNode={containerInfo:t.containerInfo,pendingChildren:null,implementation:t.implementation},s}var hf=new WeakMap;function ni(t,s){if(typeof t=="object"&&t!==null){var r=hf.get(t);return r!==void 0?r:(s={value:t,source:s,stack:od(s)},hf.set(t,s),s)}return{value:t,source:s,stack:od(s)}}var Er=[],Tr=0,Pl=null,vn=0,li=[],ai=0,cs=null,ki=1,Ei="";function qi(t,s){Er[Tr++]=vn,Er[Tr++]=Pl,Pl=t,vn=s}function uf(t,s,r){li[ai++]=ki,li[ai++]=Ei,li[ai++]=cs,cs=t;var a=ki;t=Ei;var c=32-$t(a)-1;a&=~(1<<c),r+=1;var u=32-$t(s)+c;if(30<u){var m=c-c%5;u=(a&(1<<m)-1).toString(32),a>>=m,c-=m,ki=1<<32-$t(s)+c|r<<c|a,Ei=u+t}else ki=1<<u|r<<c|a,Ei=t}function Jo(t){t.return!==null&&(qi(t,1),uf(t,1,0))}function ec(t){for(;t===Pl;)Pl=Er[--Tr],Er[Tr]=null,vn=Er[--Tr],Er[Tr]=null;for(;t===cs;)cs=li[--ai],li[ai]=null,Ei=li[--ai],li[ai]=null,ki=li[--ai],li[ai]=null}function df(t,s){li[ai++]=ki,li[ai++]=Ei,li[ai++]=cs,ki=s.id,Ei=s.overflow,cs=t}var bt=null,qe=null,Ee=!1,hs=null,oi=!1,tc=Error(l(519));function us(t){var s=Error(l(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw yn(ni(s,t)),tc}function ff(t){var s=t.stateNode,r=t.type,a=t.memoizedProps;switch(s[St]=t,s[Ot]=a,r){case"dialog":we("cancel",s),we("close",s);break;case"iframe":case"object":case"embed":we("load",s);break;case"video":case"audio":for(r=0;r<qn.length;r++)we(qn[r],s);break;case"source":we("error",s);break;case"img":case"image":case"link":we("error",s),we("load",s);break;case"details":we("toggle",s);break;case"input":we("invalid",s),kd(s,a.value,a.defaultValue,a.checked,a.defaultChecked,a.type,a.name,!0);break;case"select":we("invalid",s);break;case"textarea":we("invalid",s),Td(s,a.value,a.defaultValue,a.children)}r=a.children,typeof r!="string"&&typeof r!="number"&&typeof r!="bigint"||s.textContent===""+r||a.suppressHydrationWarning===!0||B_(s.textContent,r)?(a.popover!=null&&(we("beforetoggle",s),we("toggle",s)),a.onScroll!=null&&we("scroll",s),a.onScrollEnd!=null&&we("scrollend",s),a.onClick!=null&&(s.onclick=Hi),s=!0):s=!1,s||us(t,!0)}function pf(t){for(bt=t.return;bt;)switch(bt.tag){case 5:case 31:case 13:oi=!1;return;case 27:case 3:oi=!0;return;default:bt=bt.return}}function Rr(t){if(t!==bt)return!1;if(!Ee)return pf(t),Ee=!0,!1;var s=t.tag,r;if((r=s!==3&&s!==27)&&((r=s===5)&&(r=t.type,r=!(r!=="form"&&r!=="button")||yh(t.type,t.memoizedProps)),r=!r),r&&qe&&us(t),pf(t),s===13){if(t=t.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(l(317));qe=U_(t)}else if(s===31){if(t=t.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(l(317));qe=U_(t)}else s===27?(s=qe,ks(t.type)?(t=Ch,Ch=null,qe=t):qe=s):qe=bt?hi(t.stateNode.nextSibling):null;return!0}function $s(){qe=bt=null,Ee=!1}function ic(){var t=hs;return t!==null&&(Ut===null?Ut=t:Ut.push.apply(Ut,t),hs=null),t}function yn(t){hs===null?hs=[t]:hs.push(t)}var sc=k(null),Ks=null,Pi=null;function ds(t,s,r){J(sc,s._currentValue),s._currentValue=r}function Ii(t){t._currentValue=sc.current,P(sc)}function rc(t,s,r){for(;t!==null;){var a=t.alternate;if((t.childLanes&s)!==s?(t.childLanes|=s,a!==null&&(a.childLanes|=s)):a!==null&&(a.childLanes&s)!==s&&(a.childLanes|=s),t===r)break;t=t.return}}function nc(t,s,r,a){var c=t.child;for(c!==null&&(c.return=t);c!==null;){var u=c.dependencies;if(u!==null){var m=c.child;u=u.firstContext;e:for(;u!==null;){var v=u;u=c;for(var w=0;w<s.length;w++)if(v.context===s[w]){u.lanes|=r,v=u.alternate,v!==null&&(v.lanes|=r),rc(u.return,r,t),a||(m=null);break e}u=v.next}}else if(c.tag===18){if(m=c.return,m===null)throw Error(l(341));m.lanes|=r,u=m.alternate,u!==null&&(u.lanes|=r),rc(m,r,t),m=null}else m=c.child;if(m!==null)m.return=c;else for(m=c;m!==null;){if(m===t){m=null;break}if(c=m.sibling,c!==null){c.return=m.return,m=c;break}m=m.return}c=m}}function Dr(t,s,r,a){t=null;for(var c=s,u=!1;c!==null;){if(!u){if((c.flags&524288)!==0)u=!0;else if((c.flags&262144)!==0)break}if(c.tag===10){var m=c.alternate;if(m===null)throw Error(l(387));if(m=m.memoizedProps,m!==null){var v=c.type;Kt(c.pendingProps.value,m.value)||(t!==null?t.push(v):t=[v])}}else if(c===be.current){if(m=c.alternate,m===null)throw Error(l(387));m.memoizedState.memoizedState!==c.memoizedState.memoizedState&&(t!==null?t.push(Yn):t=[Yn])}c=c.return}t!==null&&nc(s,t,r,a),s.flags|=262144}function Il(t){for(t=t.firstContext;t!==null;){if(!Kt(t.context._currentValue,t.memoizedValue))return!0;t=t.next}return!1}function Ys(t){Ks=t,Pi=null,t=t.dependencies,t!==null&&(t.firstContext=null)}function xt(t){return _f(Ks,t)}function $l(t,s){return Ks===null&&Ys(t),_f(t,s)}function _f(t,s){var r=s._currentValue;if(s={context:s,memoizedValue:r,next:null},Pi===null){if(t===null)throw Error(l(308));Pi=s,t.dependencies={lanes:0,firstContext:s},t.flags|=524288}else Pi=Pi.next=s;return r}var Y0=typeof AbortController<"u"?AbortController:function(){var t=[],s=this.signal={aborted:!1,addEventListener:function(r,a){t.push(a)}};this.abort=function(){s.aborted=!0,t.forEach(function(r){return r()})}},F0=e.unstable_scheduleCallback,G0=e.unstable_NormalPriority,it={$$typeof:D,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function lc(){return{controller:new Y0,data:new Map,refCount:0}}function Sn(t){t.refCount--,t.refCount===0&&F0(G0,function(){t.controller.abort()})}var bn=null,ac=0,Br=0,Mr=null;function X0(t,s){if(bn===null){var r=bn=[];ac=0,Br=hh(),Mr={status:"pending",value:void 0,then:function(a){r.push(a)}}}return ac++,s.then(gf,gf),s}function gf(){if(--ac===0&&bn!==null){Mr!==null&&(Mr.status="fulfilled");var t=bn;bn=null,Br=0,Mr=null;for(var s=0;s<t.length;s++)(0,t[s])()}}function V0(t,s){var r=[],a={status:"pending",value:null,reason:null,then:function(c){r.push(c)}};return t.then(function(){a.status="fulfilled",a.value=s;for(var c=0;c<r.length;c++)(0,r[c])(s)},function(c){for(a.status="rejected",a.reason=c,c=0;c<r.length;c++)(0,r[c])(void 0)}),a}var mf=R.S;R.S=function(t,s){e_=Pt(),typeof s=="object"&&s!==null&&typeof s.then=="function"&&X0(t,s),mf!==null&&mf(t,s)};var Fs=k(null);function oc(){var t=Fs.current;return t!==null?t:We.pooledCache}function Kl(t,s){s===null?J(Fs,Fs.current):J(Fs,s.pool)}function vf(){var t=oc();return t===null?null:{parent:it._currentValue,pool:t}}var zr=Error(l(460)),cc=Error(l(474)),Yl=Error(l(542)),Fl={then:function(){}};function yf(t){return t=t.status,t==="fulfilled"||t==="rejected"}function Sf(t,s,r){switch(r=t[r],r===void 0?t.push(s):r!==s&&(s.then(Hi,Hi),s=r),s.status){case"fulfilled":return s.value;case"rejected":throw t=s.reason,xf(t),t;default:if(typeof s.status=="string")s.then(Hi,Hi);else{if(t=We,t!==null&&100<t.shellSuspendCounter)throw Error(l(482));t=s,t.status="pending",t.then(function(a){if(s.status==="pending"){var c=s;c.status="fulfilled",c.value=a}},function(a){if(s.status==="pending"){var c=s;c.status="rejected",c.reason=a}})}switch(s.status){case"fulfilled":return s.value;case"rejected":throw t=s.reason,xf(t),t}throw Xs=s,zr}}function Gs(t){try{var s=t._init;return s(t._payload)}catch(r){throw r!==null&&typeof r=="object"&&typeof r.then=="function"?(Xs=r,zr):r}}var Xs=null;function bf(){if(Xs===null)throw Error(l(459));var t=Xs;return Xs=null,t}function xf(t){if(t===zr||t===Yl)throw Error(l(483))}var Ar=null,xn=0;function Gl(t){var s=xn;return xn+=1,Ar===null&&(Ar=[]),Sf(Ar,t,s)}function wn(t,s){s=s.props.ref,t.ref=s!==void 0?s:null}function Xl(t,s){throw s.$$typeof===x?Error(l(525)):(t=Object.prototype.toString.call(s),Error(l(31,t==="[object Object]"?"object with keys {"+Object.keys(s).join(", ")+"}":t)))}function wf(t){function s(B,E){if(t){var j=B.deletions;j===null?(B.deletions=[E],B.flags|=16):j.push(E)}}function r(B,E){if(!t)return null;for(;E!==null;)s(B,E),E=E.sibling;return null}function a(B){for(var E=new Map;B!==null;)B.key!==null?E.set(B.key,B):E.set(B.index,B),B=B.sibling;return E}function c(B,E){return B=Wi(B,E),B.index=0,B.sibling=null,B}function u(B,E,j){return B.index=j,t?(j=B.alternate,j!==null?(j=j.index,j<E?(B.flags|=67108866,E):j):(B.flags|=67108866,E)):(B.flags|=1048576,E)}function m(B){return t&&B.alternate===null&&(B.flags|=67108866),B}function v(B,E,j,$){return E===null||E.tag!==6?(E=Zo(j,B.mode,$),E.return=B,E):(E=c(E,j),E.return=B,E)}function w(B,E,j,$){var le=j.type;return le===T?q(B,E,j.props.children,$,j.key):E!==null&&(E.elementType===le||typeof le=="object"&&le!==null&&le.$$typeof===ue&&Gs(le)===E.type)?(E=c(E,j.props),wn(E,j),E.return=B,E):(E=ql(j.type,j.key,j.props,null,B.mode,$),wn(E,j),E.return=B,E)}function N(B,E,j,$){return E===null||E.tag!==4||E.stateNode.containerInfo!==j.containerInfo||E.stateNode.implementation!==j.implementation?(E=Qo(j,B.mode,$),E.return=B,E):(E=c(E,j.children||[]),E.return=B,E)}function q(B,E,j,$,le){return E===null||E.tag!==7?(E=Is(j,B.mode,$,le),E.return=B,E):(E=c(E,j),E.return=B,E)}function Y(B,E,j){if(typeof E=="string"&&E!==""||typeof E=="number"||typeof E=="bigint")return E=Zo(""+E,B.mode,j),E.return=B,E;if(typeof E=="object"&&E!==null){switch(E.$$typeof){case C:return j=ql(E.type,E.key,E.props,null,B.mode,j),wn(j,E),j.return=B,j;case b:return E=Qo(E,B.mode,j),E.return=B,E;case ue:return E=Gs(E),Y(B,E,j)}if(ee(E)||Z(E))return E=Is(E,B.mode,j,null),E.return=B,E;if(typeof E.then=="function")return Y(B,Gl(E),j);if(E.$$typeof===D)return Y(B,$l(B,E),j);Xl(B,E)}return null}function U(B,E,j,$){var le=E!==null?E.key:null;if(typeof j=="string"&&j!==""||typeof j=="number"||typeof j=="bigint")return le!==null?null:v(B,E,""+j,$);if(typeof j=="object"&&j!==null){switch(j.$$typeof){case C:return j.key===le?w(B,E,j,$):null;case b:return j.key===le?N(B,E,j,$):null;case ue:return j=Gs(j),U(B,E,j,$)}if(ee(j)||Z(j))return le!==null?null:q(B,E,j,$,null);if(typeof j.then=="function")return U(B,E,Gl(j),$);if(j.$$typeof===D)return U(B,E,$l(B,j),$);Xl(B,j)}return null}function W(B,E,j,$,le){if(typeof $=="string"&&$!==""||typeof $=="number"||typeof $=="bigint")return B=B.get(j)||null,v(E,B,""+$,le);if(typeof $=="object"&&$!==null){switch($.$$typeof){case C:return B=B.get($.key===null?j:$.key)||null,w(E,B,$,le);case b:return B=B.get($.key===null?j:$.key)||null,N(E,B,$,le);case ue:return $=Gs($),W(B,E,j,$,le)}if(ee($)||Z($))return B=B.get(j)||null,q(E,B,$,le,null);if(typeof $.then=="function")return W(B,E,j,Gl($),le);if($.$$typeof===D)return W(B,E,j,$l(E,$),le);Xl(E,$)}return null}function re(B,E,j,$){for(var le=null,De=null,ne=E,ve=E=0,ke=null;ne!==null&&ve<j.length;ve++){ne.index>ve?(ke=ne,ne=null):ke=ne.sibling;var Be=U(B,ne,j[ve],$);if(Be===null){ne===null&&(ne=ke);break}t&&ne&&Be.alternate===null&&s(B,ne),E=u(Be,E,ve),De===null?le=Be:De.sibling=Be,De=Be,ne=ke}if(ve===j.length)return r(B,ne),Ee&&qi(B,ve),le;if(ne===null){for(;ve<j.length;ve++)ne=Y(B,j[ve],$),ne!==null&&(E=u(ne,E,ve),De===null?le=ne:De.sibling=ne,De=ne);return Ee&&qi(B,ve),le}for(ne=a(ne);ve<j.length;ve++)ke=W(ne,B,ve,j[ve],$),ke!==null&&(t&&ke.alternate!==null&&ne.delete(ke.key===null?ve:ke.key),E=u(ke,E,ve),De===null?le=ke:De.sibling=ke,De=ke);return t&&ne.forEach(function(Bs){return s(B,Bs)}),Ee&&qi(B,ve),le}function ce(B,E,j,$){if(j==null)throw Error(l(151));for(var le=null,De=null,ne=E,ve=E=0,ke=null,Be=j.next();ne!==null&&!Be.done;ve++,Be=j.next()){ne.index>ve?(ke=ne,ne=null):ke=ne.sibling;var Bs=U(B,ne,Be.value,$);if(Bs===null){ne===null&&(ne=ke);break}t&&ne&&Bs.alternate===null&&s(B,ne),E=u(Bs,E,ve),De===null?le=Bs:De.sibling=Bs,De=Bs,ne=ke}if(Be.done)return r(B,ne),Ee&&qi(B,ve),le;if(ne===null){for(;!Be.done;ve++,Be=j.next())Be=Y(B,Be.value,$),Be!==null&&(E=u(Be,E,ve),De===null?le=Be:De.sibling=Be,De=Be);return Ee&&qi(B,ve),le}for(ne=a(ne);!Be.done;ve++,Be=j.next())Be=W(ne,B,ve,Be.value,$),Be!==null&&(t&&Be.alternate!==null&&ne.delete(Be.key===null?ve:Be.key),E=u(Be,E,ve),De===null?le=Be:De.sibling=Be,De=Be);return t&&ne.forEach(function(aS){return s(B,aS)}),Ee&&qi(B,ve),le}function He(B,E,j,$){if(typeof j=="object"&&j!==null&&j.type===T&&j.key===null&&(j=j.props.children),typeof j=="object"&&j!==null){switch(j.$$typeof){case C:e:{for(var le=j.key;E!==null;){if(E.key===le){if(le=j.type,le===T){if(E.tag===7){r(B,E.sibling),$=c(E,j.props.children),$.return=B,B=$;break e}}else if(E.elementType===le||typeof le=="object"&&le!==null&&le.$$typeof===ue&&Gs(le)===E.type){r(B,E.sibling),$=c(E,j.props),wn($,j),$.return=B,B=$;break e}r(B,E);break}else s(B,E);E=E.sibling}j.type===T?($=Is(j.props.children,B.mode,$,j.key),$.return=B,B=$):($=ql(j.type,j.key,j.props,null,B.mode,$),wn($,j),$.return=B,B=$)}return m(B);case b:e:{for(le=j.key;E!==null;){if(E.key===le)if(E.tag===4&&E.stateNode.containerInfo===j.containerInfo&&E.stateNode.implementation===j.implementation){r(B,E.sibling),$=c(E,j.children||[]),$.return=B,B=$;break e}else{r(B,E);break}else s(B,E);E=E.sibling}$=Qo(j,B.mode,$),$.return=B,B=$}return m(B);case ue:return j=Gs(j),He(B,E,j,$)}if(ee(j))return re(B,E,j,$);if(Z(j)){if(le=Z(j),typeof le!="function")throw Error(l(150));return j=le.call(j),ce(B,E,j,$)}if(typeof j.then=="function")return He(B,E,Gl(j),$);if(j.$$typeof===D)return He(B,E,$l(B,j),$);Xl(B,j)}return typeof j=="string"&&j!==""||typeof j=="number"||typeof j=="bigint"?(j=""+j,E!==null&&E.tag===6?(r(B,E.sibling),$=c(E,j),$.return=B,B=$):(r(B,E),$=Zo(j,B.mode,$),$.return=B,B=$),m(B)):r(B,E)}return function(B,E,j,$){try{xn=0;var le=He(B,E,j,$);return Ar=null,le}catch(ne){if(ne===zr||ne===Yl)throw ne;var De=Yt(29,ne,null,B.mode);return De.lanes=$,De.return=B,De}}}var Vs=wf(!0),Cf=wf(!1),fs=!1;function hc(t){t.updateQueue={baseState:t.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function uc(t,s){t=t.updateQueue,s.updateQueue===t&&(s.updateQueue={baseState:t.baseState,firstBaseUpdate:t.firstBaseUpdate,lastBaseUpdate:t.lastBaseUpdate,shared:t.shared,callbacks:null})}function ps(t){return{lane:t,tag:0,payload:null,callback:null,next:null}}function _s(t,s,r){var a=t.updateQueue;if(a===null)return null;if(a=a.shared,(Me&2)!==0){var c=a.pending;return c===null?s.next=s:(s.next=c.next,c.next=s),a.pending=s,s=Wl(t),af(t,null,r),s}return Ul(t,a,s,r),Wl(t)}function Cn(t,s,r){if(s=s.updateQueue,s!==null&&(s=s.shared,(r&4194048)!==0)){var a=s.lanes;a&=t.pendingLanes,r|=a,s.lanes=r,pd(t,r)}}function dc(t,s){var r=t.updateQueue,a=t.alternate;if(a!==null&&(a=a.updateQueue,r===a)){var c=null,u=null;if(r=r.firstBaseUpdate,r!==null){do{var m={lane:r.lane,tag:r.tag,payload:r.payload,callback:null,next:null};u===null?c=u=m:u=u.next=m,r=r.next}while(r!==null);u===null?c=u=s:u=u.next=s}else c=u=s;r={baseState:a.baseState,firstBaseUpdate:c,lastBaseUpdate:u,shared:a.shared,callbacks:a.callbacks},t.updateQueue=r;return}t=r.lastBaseUpdate,t===null?r.firstBaseUpdate=s:t.next=s,r.lastBaseUpdate=s}var fc=!1;function kn(){if(fc){var t=Mr;if(t!==null)throw t}}function En(t,s,r,a){fc=!1;var c=t.updateQueue;fs=!1;var u=c.firstBaseUpdate,m=c.lastBaseUpdate,v=c.shared.pending;if(v!==null){c.shared.pending=null;var w=v,N=w.next;w.next=null,m===null?u=N:m.next=N,m=w;var q=t.alternate;q!==null&&(q=q.updateQueue,v=q.lastBaseUpdate,v!==m&&(v===null?q.firstBaseUpdate=N:v.next=N,q.lastBaseUpdate=w))}if(u!==null){var Y=c.baseState;m=0,q=N=w=null,v=u;do{var U=v.lane&-536870913,W=U!==v.lane;if(W?(Ce&U)===U:(a&U)===U){U!==0&&U===Br&&(fc=!0),q!==null&&(q=q.next={lane:0,tag:v.tag,payload:v.payload,callback:null,next:null});e:{var re=t,ce=v;U=s;var He=r;switch(ce.tag){case 1:if(re=ce.payload,typeof re=="function"){Y=re.call(He,Y,U);break e}Y=re;break e;case 3:re.flags=re.flags&-65537|128;case 0:if(re=ce.payload,U=typeof re=="function"?re.call(He,Y,U):re,U==null)break e;Y=y({},Y,U);break e;case 2:fs=!0}}U=v.callback,U!==null&&(t.flags|=64,W&&(t.flags|=8192),W=c.callbacks,W===null?c.callbacks=[U]:W.push(U))}else W={lane:U,tag:v.tag,payload:v.payload,callback:v.callback,next:null},q===null?(N=q=W,w=Y):q=q.next=W,m|=U;if(v=v.next,v===null){if(v=c.shared.pending,v===null)break;W=v,v=W.next,W.next=null,c.lastBaseUpdate=W,c.shared.pending=null}}while(!0);q===null&&(w=Y),c.baseState=w,c.firstBaseUpdate=N,c.lastBaseUpdate=q,u===null&&(c.shared.lanes=0),Ss|=m,t.lanes=m,t.memoizedState=Y}}function kf(t,s){if(typeof t!="function")throw Error(l(191,t));t.call(s)}function Ef(t,s){var r=t.callbacks;if(r!==null)for(t.callbacks=null,t=0;t<r.length;t++)kf(r[t],s)}var Or=k(null),Vl=k(0);function Tf(t,s){t=Qi,J(Vl,t),J(Or,s),Qi=t|s.baseLanes}function pc(){J(Vl,Qi),J(Or,Or.current)}function _c(){Qi=Vl.current,P(Or),P(Vl)}var Ft=k(null),ci=null;function gs(t){var s=t.alternate;J(Je,Je.current&1),J(Ft,t),ci===null&&(s===null||Or.current!==null||s.memoizedState!==null)&&(ci=t)}function gc(t){J(Je,Je.current),J(Ft,t),ci===null&&(ci=t)}function Rf(t){t.tag===22?(J(Je,Je.current),J(Ft,t),ci===null&&(ci=t)):ms()}function ms(){J(Je,Je.current),J(Ft,Ft.current)}function Gt(t){P(Ft),ci===t&&(ci=null),P(Je)}var Je=k(0);function Zl(t){for(var s=t;s!==null;){if(s.tag===13){var r=s.memoizedState;if(r!==null&&(r=r.dehydrated,r===null||xh(r)||wh(r)))return s}else if(s.tag===19&&(s.memoizedProps.revealOrder==="forwards"||s.memoizedProps.revealOrder==="backwards"||s.memoizedProps.revealOrder==="unstable_legacy-backwards"||s.memoizedProps.revealOrder==="together")){if((s.flags&128)!==0)return s}else if(s.child!==null){s.child.return=s,s=s.child;continue}if(s===t)break;for(;s.sibling===null;){if(s.return===null||s.return===t)return null;s=s.return}s.sibling.return=s.return,s=s.sibling}return null}var $i=0,me=null,je=null,st=null,Ql=!1,Lr=!1,Zs=!1,Jl=0,Tn=0,jr=null,Z0=0;function Xe(){throw Error(l(321))}function mc(t,s){if(s===null)return!1;for(var r=0;r<s.length&&r<t.length;r++)if(!Kt(t[r],s[r]))return!1;return!0}function vc(t,s,r,a,c,u){return $i=u,me=s,s.memoizedState=null,s.updateQueue=null,s.lanes=0,R.H=t===null||t.memoizedState===null?up:Ac,Zs=!1,u=r(a,c),Zs=!1,Lr&&(u=Bf(s,r,a,c)),Df(t),u}function Df(t){R.H=Bn;var s=je!==null&&je.next!==null;if($i=0,st=je=me=null,Ql=!1,Tn=0,jr=null,s)throw Error(l(300));t===null||rt||(t=t.dependencies,t!==null&&Il(t)&&(rt=!0))}function Bf(t,s,r,a){me=t;var c=0;do{if(Lr&&(jr=null),Tn=0,Lr=!1,25<=c)throw Error(l(301));if(c+=1,st=je=null,t.updateQueue!=null){var u=t.updateQueue;u.lastEffect=null,u.events=null,u.stores=null,u.memoCache!=null&&(u.memoCache.index=0)}R.H=dp,u=s(r,a)}while(Lr);return u}function Q0(){var t=R.H,s=t.useState()[0];return s=typeof s.then=="function"?Rn(s):s,t=t.useState()[0],(je!==null?je.memoizedState:null)!==t&&(me.flags|=1024),s}function yc(){var t=Jl!==0;return Jl=0,t}function Sc(t,s,r){s.updateQueue=t.updateQueue,s.flags&=-2053,t.lanes&=~r}function bc(t){if(Ql){for(t=t.memoizedState;t!==null;){var s=t.queue;s!==null&&(s.pending=null),t=t.next}Ql=!1}$i=0,st=je=me=null,Lr=!1,Tn=Jl=0,jr=null}function Dt(){var t={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return st===null?me.memoizedState=st=t:st=st.next=t,st}function et(){if(je===null){var t=me.alternate;t=t!==null?t.memoizedState:null}else t=je.next;var s=st===null?me.memoizedState:st.next;if(s!==null)st=s,je=t;else{if(t===null)throw me.alternate===null?Error(l(467)):Error(l(310));je=t,t={memoizedState:je.memoizedState,baseState:je.baseState,baseQueue:je.baseQueue,queue:je.queue,next:null},st===null?me.memoizedState=st=t:st=st.next=t}return st}function ea(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Rn(t){var s=Tn;return Tn+=1,jr===null&&(jr=[]),t=Sf(jr,t,s),s=me,(st===null?s.memoizedState:st.next)===null&&(s=s.alternate,R.H=s===null||s.memoizedState===null?up:Ac),t}function ta(t){if(t!==null&&typeof t=="object"){if(typeof t.then=="function")return Rn(t);if(t.$$typeof===D)return xt(t)}throw Error(l(438,String(t)))}function xc(t){var s=null,r=me.updateQueue;if(r!==null&&(s=r.memoCache),s==null){var a=me.alternate;a!==null&&(a=a.updateQueue,a!==null&&(a=a.memoCache,a!=null&&(s={data:a.data.map(function(c){return c.slice()}),index:0})))}if(s==null&&(s={data:[],index:0}),r===null&&(r=ea(),me.updateQueue=r),r.memoCache=s,r=s.data[s.index],r===void 0)for(r=s.data[s.index]=Array(t),a=0;a<t;a++)r[a]=Ye;return s.index++,r}function Ki(t,s){return typeof s=="function"?s(t):s}function ia(t){var s=et();return wc(s,je,t)}function wc(t,s,r){var a=t.queue;if(a===null)throw Error(l(311));a.lastRenderedReducer=r;var c=t.baseQueue,u=a.pending;if(u!==null){if(c!==null){var m=c.next;c.next=u.next,u.next=m}s.baseQueue=c=u,a.pending=null}if(u=t.baseState,c===null)t.memoizedState=u;else{s=c.next;var v=m=null,w=null,N=s,q=!1;do{var Y=N.lane&-536870913;if(Y!==N.lane?(Ce&Y)===Y:($i&Y)===Y){var U=N.revertLane;if(U===0)w!==null&&(w=w.next={lane:0,revertLane:0,gesture:null,action:N.action,hasEagerState:N.hasEagerState,eagerState:N.eagerState,next:null}),Y===Br&&(q=!0);else if(($i&U)===U){N=N.next,U===Br&&(q=!0);continue}else Y={lane:0,revertLane:N.revertLane,gesture:null,action:N.action,hasEagerState:N.hasEagerState,eagerState:N.eagerState,next:null},w===null?(v=w=Y,m=u):w=w.next=Y,me.lanes|=U,Ss|=U;Y=N.action,Zs&&r(u,Y),u=N.hasEagerState?N.eagerState:r(u,Y)}else U={lane:Y,revertLane:N.revertLane,gesture:N.gesture,action:N.action,hasEagerState:N.hasEagerState,eagerState:N.eagerState,next:null},w===null?(v=w=U,m=u):w=w.next=U,me.lanes|=Y,Ss|=Y;N=N.next}while(N!==null&&N!==s);if(w===null?m=u:w.next=v,!Kt(u,t.memoizedState)&&(rt=!0,q&&(r=Mr,r!==null)))throw r;t.memoizedState=u,t.baseState=m,t.baseQueue=w,a.lastRenderedState=u}return c===null&&(a.lanes=0),[t.memoizedState,a.dispatch]}function Cc(t){var s=et(),r=s.queue;if(r===null)throw Error(l(311));r.lastRenderedReducer=t;var a=r.dispatch,c=r.pending,u=s.memoizedState;if(c!==null){r.pending=null;var m=c=c.next;do u=t(u,m.action),m=m.next;while(m!==c);Kt(u,s.memoizedState)||(rt=!0),s.memoizedState=u,s.baseQueue===null&&(s.baseState=u),r.lastRenderedState=u}return[u,a]}function Mf(t,s,r){var a=me,c=et(),u=Ee;if(u){if(r===void 0)throw Error(l(407));r=r()}else r=s();var m=!Kt((je||c).memoizedState,r);if(m&&(c.memoizedState=r,rt=!0),c=c.queue,Tc(Of.bind(null,a,c,t),[t]),c.getSnapshot!==s||m||st!==null&&st.memoizedState.tag&1){if(a.flags|=2048,Nr(9,{destroy:void 0},Af.bind(null,a,c,r,s),null),We===null)throw Error(l(349));u||($i&127)!==0||zf(a,s,r)}return r}function zf(t,s,r){t.flags|=16384,t={getSnapshot:s,value:r},s=me.updateQueue,s===null?(s=ea(),me.updateQueue=s,s.stores=[t]):(r=s.stores,r===null?s.stores=[t]:r.push(t))}function Af(t,s,r,a){s.value=r,s.getSnapshot=a,Lf(s)&&jf(t)}function Of(t,s,r){return r(function(){Lf(s)&&jf(t)})}function Lf(t){var s=t.getSnapshot;t=t.value;try{var r=s();return!Kt(t,r)}catch{return!0}}function jf(t){var s=Ps(t,2);s!==null&&Wt(s,t,2)}function kc(t){var s=Dt();if(typeof t=="function"){var r=t;if(t=r(),Zs){ls(!0);try{r()}finally{ls(!1)}}}return s.memoizedState=s.baseState=t,s.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ki,lastRenderedState:t},s}function Nf(t,s,r,a){return t.baseState=r,wc(t,je,typeof a=="function"?a:Ki)}function J0(t,s,r,a,c){if(na(t))throw Error(l(485));if(t=s.action,t!==null){var u={payload:c,action:t,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(m){u.listeners.push(m)}};R.T!==null?r(!0):u.isTransition=!1,a(u),r=s.pending,r===null?(u.next=s.pending=u,Hf(s,u)):(u.next=r.next,s.pending=r.next=u)}}function Hf(t,s){var r=s.action,a=s.payload,c=t.state;if(s.isTransition){var u=R.T,m={};R.T=m;try{var v=r(c,a),w=R.S;w!==null&&w(m,v),Uf(t,s,v)}catch(N){Ec(t,s,N)}finally{u!==null&&m.types!==null&&(u.types=m.types),R.T=u}}else try{u=r(c,a),Uf(t,s,u)}catch(N){Ec(t,s,N)}}function Uf(t,s,r){r!==null&&typeof r=="object"&&typeof r.then=="function"?r.then(function(a){Wf(t,s,a)},function(a){return Ec(t,s,a)}):Wf(t,s,r)}function Wf(t,s,r){s.status="fulfilled",s.value=r,qf(s),t.state=r,s=t.pending,s!==null&&(r=s.next,r===s?t.pending=null:(r=r.next,s.next=r,Hf(t,r)))}function Ec(t,s,r){var a=t.pending;if(t.pending=null,a!==null){a=a.next;do s.status="rejected",s.reason=r,qf(s),s=s.next;while(s!==a)}t.action=null}function qf(t){t=t.listeners;for(var s=0;s<t.length;s++)(0,t[s])()}function Pf(t,s){return s}function If(t,s){if(Ee){var r=We.formState;if(r!==null){e:{var a=me;if(Ee){if(qe){t:{for(var c=qe,u=oi;c.nodeType!==8;){if(!u){c=null;break t}if(c=hi(c.nextSibling),c===null){c=null;break t}}u=c.data,c=u==="F!"||u==="F"?c:null}if(c){qe=hi(c.nextSibling),a=c.data==="F!";break e}}us(a)}a=!1}a&&(s=r[0])}}return r=Dt(),r.memoizedState=r.baseState=s,a={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Pf,lastRenderedState:s},r.queue=a,r=op.bind(null,me,a),a.dispatch=r,a=kc(!1),u=zc.bind(null,me,!1,a.queue),a=Dt(),c={state:s,dispatch:null,action:t,pending:null},a.queue=c,r=J0.bind(null,me,c,u,r),c.dispatch=r,a.memoizedState=t,[s,r,!1]}function $f(t){var s=et();return Kf(s,je,t)}function Kf(t,s,r){if(s=wc(t,s,Pf)[0],t=ia(Ki)[0],typeof s=="object"&&s!==null&&typeof s.then=="function")try{var a=Rn(s)}catch(m){throw m===zr?Yl:m}else a=s;s=et();var c=s.queue,u=c.dispatch;return r!==s.memoizedState&&(me.flags|=2048,Nr(9,{destroy:void 0},ey.bind(null,c,r),null)),[a,u,t]}function ey(t,s){t.action=s}function Yf(t){var s=et(),r=je;if(r!==null)return Kf(s,r,t);et(),s=s.memoizedState,r=et();var a=r.queue.dispatch;return r.memoizedState=t,[s,a,!1]}function Nr(t,s,r,a){return t={tag:t,create:r,deps:a,inst:s,next:null},s=me.updateQueue,s===null&&(s=ea(),me.updateQueue=s),r=s.lastEffect,r===null?s.lastEffect=t.next=t:(a=r.next,r.next=t,t.next=a,s.lastEffect=t),t}function Ff(){return et().memoizedState}function sa(t,s,r,a){var c=Dt();me.flags|=t,c.memoizedState=Nr(1|s,{destroy:void 0},r,a===void 0?null:a)}function ra(t,s,r,a){var c=et();a=a===void 0?null:a;var u=c.memoizedState.inst;je!==null&&a!==null&&mc(a,je.memoizedState.deps)?c.memoizedState=Nr(s,u,r,a):(me.flags|=t,c.memoizedState=Nr(1|s,u,r,a))}function Gf(t,s){sa(8390656,8,t,s)}function Tc(t,s){ra(2048,8,t,s)}function ty(t){me.flags|=4;var s=me.updateQueue;if(s===null)s=ea(),me.updateQueue=s,s.events=[t];else{var r=s.events;r===null?s.events=[t]:r.push(t)}}function Xf(t){var s=et().memoizedState;return ty({ref:s,nextImpl:t}),function(){if((Me&2)!==0)throw Error(l(440));return s.impl.apply(void 0,arguments)}}function Vf(t,s){return ra(4,2,t,s)}function Zf(t,s){return ra(4,4,t,s)}function Qf(t,s){if(typeof s=="function"){t=t();var r=s(t);return function(){typeof r=="function"?r():s(null)}}if(s!=null)return t=t(),s.current=t,function(){s.current=null}}function Jf(t,s,r){r=r!=null?r.concat([t]):null,ra(4,4,Qf.bind(null,s,t),r)}function Rc(){}function ep(t,s){var r=et();s=s===void 0?null:s;var a=r.memoizedState;return s!==null&&mc(s,a[1])?a[0]:(r.memoizedState=[t,s],t)}function tp(t,s){var r=et();s=s===void 0?null:s;var a=r.memoizedState;if(s!==null&&mc(s,a[1]))return a[0];if(a=t(),Zs){ls(!0);try{t()}finally{ls(!1)}}return r.memoizedState=[a,s],a}function Dc(t,s,r){return r===void 0||($i&1073741824)!==0&&(Ce&261930)===0?t.memoizedState=s:(t.memoizedState=r,t=i_(),me.lanes|=t,Ss|=t,r)}function ip(t,s,r,a){return Kt(r,s)?r:Or.current!==null?(t=Dc(t,r,a),Kt(t,s)||(rt=!0),t):($i&42)===0||($i&1073741824)!==0&&(Ce&261930)===0?(rt=!0,t.memoizedState=r):(t=i_(),me.lanes|=t,Ss|=t,s)}function sp(t,s,r,a,c){var u=I.p;I.p=u!==0&&8>u?u:8;var m=R.T,v={};R.T=v,zc(t,!1,s,r);try{var w=c(),N=R.S;if(N!==null&&N(v,w),w!==null&&typeof w=="object"&&typeof w.then=="function"){var q=V0(w,a);Dn(t,s,q,Zt(t))}else Dn(t,s,a,Zt(t))}catch(Y){Dn(t,s,{then:function(){},status:"rejected",reason:Y},Zt())}finally{I.p=u,m!==null&&v.types!==null&&(m.types=v.types),R.T=m}}function iy(){}function Bc(t,s,r,a){if(t.tag!==5)throw Error(l(476));var c=rp(t).queue;sp(t,c,s,K,r===null?iy:function(){return np(t),r(a)})}function rp(t){var s=t.memoizedState;if(s!==null)return s;s={memoizedState:K,baseState:K,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ki,lastRenderedState:K},next:null};var r={};return s.next={memoizedState:r,baseState:r,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ki,lastRenderedState:r},next:null},t.memoizedState=s,t=t.alternate,t!==null&&(t.memoizedState=s),s}function np(t){var s=rp(t);s.next===null&&(s=t.alternate.memoizedState),Dn(t,s.next.queue,{},Zt())}function Mc(){return xt(Yn)}function lp(){return et().memoizedState}function ap(){return et().memoizedState}function sy(t){for(var s=t.return;s!==null;){switch(s.tag){case 24:case 3:var r=Zt();t=ps(r);var a=_s(s,t,r);a!==null&&(Wt(a,s,r),Cn(a,s,r)),s={cache:lc()},t.payload=s;return}s=s.return}}function ry(t,s,r){var a=Zt();r={lane:a,revertLane:0,gesture:null,action:r,hasEagerState:!1,eagerState:null,next:null},na(t)?cp(s,r):(r=Xo(t,s,r,a),r!==null&&(Wt(r,t,a),hp(r,s,a)))}function op(t,s,r){var a=Zt();Dn(t,s,r,a)}function Dn(t,s,r,a){var c={lane:a,revertLane:0,gesture:null,action:r,hasEagerState:!1,eagerState:null,next:null};if(na(t))cp(s,c);else{var u=t.alternate;if(t.lanes===0&&(u===null||u.lanes===0)&&(u=s.lastRenderedReducer,u!==null))try{var m=s.lastRenderedState,v=u(m,r);if(c.hasEagerState=!0,c.eagerState=v,Kt(v,m))return Ul(t,s,c,0),We===null&&Hl(),!1}catch{}if(r=Xo(t,s,c,a),r!==null)return Wt(r,t,a),hp(r,s,a),!0}return!1}function zc(t,s,r,a){if(a={lane:2,revertLane:hh(),gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null},na(t)){if(s)throw Error(l(479))}else s=Xo(t,r,a,2),s!==null&&Wt(s,t,2)}function na(t){var s=t.alternate;return t===me||s!==null&&s===me}function cp(t,s){Lr=Ql=!0;var r=t.pending;r===null?s.next=s:(s.next=r.next,r.next=s),t.pending=s}function hp(t,s,r){if((r&4194048)!==0){var a=s.lanes;a&=t.pendingLanes,r|=a,s.lanes=r,pd(t,r)}}var Bn={readContext:xt,use:ta,useCallback:Xe,useContext:Xe,useEffect:Xe,useImperativeHandle:Xe,useLayoutEffect:Xe,useInsertionEffect:Xe,useMemo:Xe,useReducer:Xe,useRef:Xe,useState:Xe,useDebugValue:Xe,useDeferredValue:Xe,useTransition:Xe,useSyncExternalStore:Xe,useId:Xe,useHostTransitionStatus:Xe,useFormState:Xe,useActionState:Xe,useOptimistic:Xe,useMemoCache:Xe,useCacheRefresh:Xe};Bn.useEffectEvent=Xe;var up={readContext:xt,use:ta,useCallback:function(t,s){return Dt().memoizedState=[t,s===void 0?null:s],t},useContext:xt,useEffect:Gf,useImperativeHandle:function(t,s,r){r=r!=null?r.concat([t]):null,sa(4194308,4,Qf.bind(null,s,t),r)},useLayoutEffect:function(t,s){return sa(4194308,4,t,s)},useInsertionEffect:function(t,s){sa(4,2,t,s)},useMemo:function(t,s){var r=Dt();s=s===void 0?null:s;var a=t();if(Zs){ls(!0);try{t()}finally{ls(!1)}}return r.memoizedState=[a,s],a},useReducer:function(t,s,r){var a=Dt();if(r!==void 0){var c=r(s);if(Zs){ls(!0);try{r(s)}finally{ls(!1)}}}else c=s;return a.memoizedState=a.baseState=c,t={pending:null,lanes:0,dispatch:null,lastRenderedReducer:t,lastRenderedState:c},a.queue=t,t=t.dispatch=ry.bind(null,me,t),[a.memoizedState,t]},useRef:function(t){var s=Dt();return t={current:t},s.memoizedState=t},useState:function(t){t=kc(t);var s=t.queue,r=op.bind(null,me,s);return s.dispatch=r,[t.memoizedState,r]},useDebugValue:Rc,useDeferredValue:function(t,s){var r=Dt();return Dc(r,t,s)},useTransition:function(){var t=kc(!1);return t=sp.bind(null,me,t.queue,!0,!1),Dt().memoizedState=t,[!1,t]},useSyncExternalStore:function(t,s,r){var a=me,c=Dt();if(Ee){if(r===void 0)throw Error(l(407));r=r()}else{if(r=s(),We===null)throw Error(l(349));(Ce&127)!==0||zf(a,s,r)}c.memoizedState=r;var u={value:r,getSnapshot:s};return c.queue=u,Gf(Of.bind(null,a,u,t),[t]),a.flags|=2048,Nr(9,{destroy:void 0},Af.bind(null,a,u,r,s),null),r},useId:function(){var t=Dt(),s=We.identifierPrefix;if(Ee){var r=Ei,a=ki;r=(a&~(1<<32-$t(a)-1)).toString(32)+r,s="_"+s+"R_"+r,r=Jl++,0<r&&(s+="H"+r.toString(32)),s+="_"}else r=Z0++,s="_"+s+"r_"+r.toString(32)+"_";return t.memoizedState=s},useHostTransitionStatus:Mc,useFormState:If,useActionState:If,useOptimistic:function(t){var s=Dt();s.memoizedState=s.baseState=t;var r={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return s.queue=r,s=zc.bind(null,me,!0,r),r.dispatch=s,[t,s]},useMemoCache:xc,useCacheRefresh:function(){return Dt().memoizedState=sy.bind(null,me)},useEffectEvent:function(t){var s=Dt(),r={impl:t};return s.memoizedState=r,function(){if((Me&2)!==0)throw Error(l(440));return r.impl.apply(void 0,arguments)}}},Ac={readContext:xt,use:ta,useCallback:ep,useContext:xt,useEffect:Tc,useImperativeHandle:Jf,useInsertionEffect:Vf,useLayoutEffect:Zf,useMemo:tp,useReducer:ia,useRef:Ff,useState:function(){return ia(Ki)},useDebugValue:Rc,useDeferredValue:function(t,s){var r=et();return ip(r,je.memoizedState,t,s)},useTransition:function(){var t=ia(Ki)[0],s=et().memoizedState;return[typeof t=="boolean"?t:Rn(t),s]},useSyncExternalStore:Mf,useId:lp,useHostTransitionStatus:Mc,useFormState:$f,useActionState:$f,useOptimistic:function(t,s){var r=et();return Nf(r,je,t,s)},useMemoCache:xc,useCacheRefresh:ap};Ac.useEffectEvent=Xf;var dp={readContext:xt,use:ta,useCallback:ep,useContext:xt,useEffect:Tc,useImperativeHandle:Jf,useInsertionEffect:Vf,useLayoutEffect:Zf,useMemo:tp,useReducer:Cc,useRef:Ff,useState:function(){return Cc(Ki)},useDebugValue:Rc,useDeferredValue:function(t,s){var r=et();return je===null?Dc(r,t,s):ip(r,je.memoizedState,t,s)},useTransition:function(){var t=Cc(Ki)[0],s=et().memoizedState;return[typeof t=="boolean"?t:Rn(t),s]},useSyncExternalStore:Mf,useId:lp,useHostTransitionStatus:Mc,useFormState:Yf,useActionState:Yf,useOptimistic:function(t,s){var r=et();return je!==null?Nf(r,je,t,s):(r.baseState=t,[t,r.queue.dispatch])},useMemoCache:xc,useCacheRefresh:ap};dp.useEffectEvent=Xf;function Oc(t,s,r,a){s=t.memoizedState,r=r(a,s),r=r==null?s:y({},s,r),t.memoizedState=r,t.lanes===0&&(t.updateQueue.baseState=r)}var Lc={enqueueSetState:function(t,s,r){t=t._reactInternals;var a=Zt(),c=ps(a);c.payload=s,r!=null&&(c.callback=r),s=_s(t,c,a),s!==null&&(Wt(s,t,a),Cn(s,t,a))},enqueueReplaceState:function(t,s,r){t=t._reactInternals;var a=Zt(),c=ps(a);c.tag=1,c.payload=s,r!=null&&(c.callback=r),s=_s(t,c,a),s!==null&&(Wt(s,t,a),Cn(s,t,a))},enqueueForceUpdate:function(t,s){t=t._reactInternals;var r=Zt(),a=ps(r);a.tag=2,s!=null&&(a.callback=s),s=_s(t,a,r),s!==null&&(Wt(s,t,r),Cn(s,t,r))}};function fp(t,s,r,a,c,u,m){return t=t.stateNode,typeof t.shouldComponentUpdate=="function"?t.shouldComponentUpdate(a,u,m):s.prototype&&s.prototype.isPureReactComponent?!gn(r,a)||!gn(c,u):!0}function pp(t,s,r,a){t=s.state,typeof s.componentWillReceiveProps=="function"&&s.componentWillReceiveProps(r,a),typeof s.UNSAFE_componentWillReceiveProps=="function"&&s.UNSAFE_componentWillReceiveProps(r,a),s.state!==t&&Lc.enqueueReplaceState(s,s.state,null)}function Qs(t,s){var r=s;if("ref"in s){r={};for(var a in s)a!=="ref"&&(r[a]=s[a])}if(t=t.defaultProps){r===s&&(r=y({},r));for(var c in t)r[c]===void 0&&(r[c]=t[c])}return r}function _p(t){Nl(t)}function gp(t){console.error(t)}function mp(t){Nl(t)}function la(t,s){try{var r=t.onUncaughtError;r(s.value,{componentStack:s.stack})}catch(a){setTimeout(function(){throw a})}}function vp(t,s,r){try{var a=t.onCaughtError;a(r.value,{componentStack:r.stack,errorBoundary:s.tag===1?s.stateNode:null})}catch(c){setTimeout(function(){throw c})}}function jc(t,s,r){return r=ps(r),r.tag=3,r.payload={element:null},r.callback=function(){la(t,s)},r}function yp(t){return t=ps(t),t.tag=3,t}function Sp(t,s,r,a){var c=r.type.getDerivedStateFromError;if(typeof c=="function"){var u=a.value;t.payload=function(){return c(u)},t.callback=function(){vp(s,r,a)}}var m=r.stateNode;m!==null&&typeof m.componentDidCatch=="function"&&(t.callback=function(){vp(s,r,a),typeof c!="function"&&(bs===null?bs=new Set([this]):bs.add(this));var v=a.stack;this.componentDidCatch(a.value,{componentStack:v!==null?v:""})})}function ny(t,s,r,a,c){if(r.flags|=32768,a!==null&&typeof a=="object"&&typeof a.then=="function"){if(s=r.alternate,s!==null&&Dr(s,r,c,!0),r=Ft.current,r!==null){switch(r.tag){case 31:case 13:return ci===null?va():r.alternate===null&&Ve===0&&(Ve=3),r.flags&=-257,r.flags|=65536,r.lanes=c,a===Fl?r.flags|=16384:(s=r.updateQueue,s===null?r.updateQueue=new Set([a]):s.add(a),ah(t,a,c)),!1;case 22:return r.flags|=65536,a===Fl?r.flags|=16384:(s=r.updateQueue,s===null?(s={transitions:null,markerInstances:null,retryQueue:new Set([a])},r.updateQueue=s):(r=s.retryQueue,r===null?s.retryQueue=new Set([a]):r.add(a)),ah(t,a,c)),!1}throw Error(l(435,r.tag))}return ah(t,a,c),va(),!1}if(Ee)return s=Ft.current,s!==null?((s.flags&65536)===0&&(s.flags|=256),s.flags|=65536,s.lanes=c,a!==tc&&(t=Error(l(422),{cause:a}),yn(ni(t,r)))):(a!==tc&&(s=Error(l(423),{cause:a}),yn(ni(s,r))),t=t.current.alternate,t.flags|=65536,c&=-c,t.lanes|=c,a=ni(a,r),c=jc(t.stateNode,a,c),dc(t,c),Ve!==4&&(Ve=2)),!1;var u=Error(l(520),{cause:a});if(u=ni(u,r),Hn===null?Hn=[u]:Hn.push(u),Ve!==4&&(Ve=2),s===null)return!0;a=ni(a,r),r=s;do{switch(r.tag){case 3:return r.flags|=65536,t=c&-c,r.lanes|=t,t=jc(r.stateNode,a,t),dc(r,t),!1;case 1:if(s=r.type,u=r.stateNode,(r.flags&128)===0&&(typeof s.getDerivedStateFromError=="function"||u!==null&&typeof u.componentDidCatch=="function"&&(bs===null||!bs.has(u))))return r.flags|=65536,c&=-c,r.lanes|=c,c=yp(c),Sp(c,t,r,a),dc(r,c),!1}r=r.return}while(r!==null);return!1}var Nc=Error(l(461)),rt=!1;function wt(t,s,r,a){s.child=t===null?Cf(s,null,r,a):Vs(s,t.child,r,a)}function bp(t,s,r,a,c){r=r.render;var u=s.ref;if("ref"in a){var m={};for(var v in a)v!=="ref"&&(m[v]=a[v])}else m=a;return Ys(s),a=vc(t,s,r,m,u,c),v=yc(),t!==null&&!rt?(Sc(t,s,c),Yi(t,s,c)):(Ee&&v&&Jo(s),s.flags|=1,wt(t,s,a,c),s.child)}function xp(t,s,r,a,c){if(t===null){var u=r.type;return typeof u=="function"&&!Vo(u)&&u.defaultProps===void 0&&r.compare===null?(s.tag=15,s.type=u,wp(t,s,u,a,c)):(t=ql(r.type,null,a,s,s.mode,c),t.ref=s.ref,t.return=s,s.child=t)}if(u=t.child,!Kc(t,c)){var m=u.memoizedProps;if(r=r.compare,r=r!==null?r:gn,r(m,a)&&t.ref===s.ref)return Yi(t,s,c)}return s.flags|=1,t=Wi(u,a),t.ref=s.ref,t.return=s,s.child=t}function wp(t,s,r,a,c){if(t!==null){var u=t.memoizedProps;if(gn(u,a)&&t.ref===s.ref)if(rt=!1,s.pendingProps=a=u,Kc(t,c))(t.flags&131072)!==0&&(rt=!0);else return s.lanes=t.lanes,Yi(t,s,c)}return Hc(t,s,r,a,c)}function Cp(t,s,r,a){var c=a.children,u=t!==null?t.memoizedState:null;if(t===null&&s.stateNode===null&&(s.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),a.mode==="hidden"){if((s.flags&128)!==0){if(u=u!==null?u.baseLanes|r:r,t!==null){for(a=s.child=t.child,c=0;a!==null;)c=c|a.lanes|a.childLanes,a=a.sibling;a=c&~u}else a=0,s.child=null;return kp(t,s,u,r,a)}if((r&536870912)!==0)s.memoizedState={baseLanes:0,cachePool:null},t!==null&&Kl(s,u!==null?u.cachePool:null),u!==null?Tf(s,u):pc(),Rf(s);else return a=s.lanes=536870912,kp(t,s,u!==null?u.baseLanes|r:r,r,a)}else u!==null?(Kl(s,u.cachePool),Tf(s,u),ms(),s.memoizedState=null):(t!==null&&Kl(s,null),pc(),ms());return wt(t,s,c,r),s.child}function Mn(t,s){return t!==null&&t.tag===22||s.stateNode!==null||(s.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),s.sibling}function kp(t,s,r,a,c){var u=oc();return u=u===null?null:{parent:it._currentValue,pool:u},s.memoizedState={baseLanes:r,cachePool:u},t!==null&&Kl(s,null),pc(),Rf(s),t!==null&&Dr(t,s,a,!0),s.childLanes=c,null}function aa(t,s){return s=ca({mode:s.mode,children:s.children},t.mode),s.ref=t.ref,t.child=s,s.return=t,s}function Ep(t,s,r){return Vs(s,t.child,null,r),t=aa(s,s.pendingProps),t.flags|=2,Gt(s),s.memoizedState=null,t}function ly(t,s,r){var a=s.pendingProps,c=(s.flags&128)!==0;if(s.flags&=-129,t===null){if(Ee){if(a.mode==="hidden")return t=aa(s,a),s.lanes=536870912,Mn(null,t);if(gc(s),(t=qe)?(t=H_(t,oi),t=t!==null&&t.data==="&"?t:null,t!==null&&(s.memoizedState={dehydrated:t,treeContext:cs!==null?{id:ki,overflow:Ei}:null,retryLane:536870912,hydrationErrors:null},r=cf(t),r.return=s,s.child=r,bt=s,qe=null)):t=null,t===null)throw us(s);return s.lanes=536870912,null}return aa(s,a)}var u=t.memoizedState;if(u!==null){var m=u.dehydrated;if(gc(s),c)if(s.flags&256)s.flags&=-257,s=Ep(t,s,r);else if(s.memoizedState!==null)s.child=t.child,s.flags|=128,s=null;else throw Error(l(558));else if(rt||Dr(t,s,r,!1),c=(r&t.childLanes)!==0,rt||c){if(a=We,a!==null&&(m=_d(a,r),m!==0&&m!==u.retryLane))throw u.retryLane=m,Ps(t,m),Wt(a,t,m),Nc;va(),s=Ep(t,s,r)}else t=u.treeContext,qe=hi(m.nextSibling),bt=s,Ee=!0,hs=null,oi=!1,t!==null&&df(s,t),s=aa(s,a),s.flags|=4096;return s}return t=Wi(t.child,{mode:a.mode,children:a.children}),t.ref=s.ref,s.child=t,t.return=s,t}function oa(t,s){var r=s.ref;if(r===null)t!==null&&t.ref!==null&&(s.flags|=4194816);else{if(typeof r!="function"&&typeof r!="object")throw Error(l(284));(t===null||t.ref!==r)&&(s.flags|=4194816)}}function Hc(t,s,r,a,c){return Ys(s),r=vc(t,s,r,a,void 0,c),a=yc(),t!==null&&!rt?(Sc(t,s,c),Yi(t,s,c)):(Ee&&a&&Jo(s),s.flags|=1,wt(t,s,r,c),s.child)}function Tp(t,s,r,a,c,u){return Ys(s),s.updateQueue=null,r=Bf(s,a,r,c),Df(t),a=yc(),t!==null&&!rt?(Sc(t,s,u),Yi(t,s,u)):(Ee&&a&&Jo(s),s.flags|=1,wt(t,s,r,u),s.child)}function Rp(t,s,r,a,c){if(Ys(s),s.stateNode===null){var u=kr,m=r.contextType;typeof m=="object"&&m!==null&&(u=xt(m)),u=new r(a,u),s.memoizedState=u.state!==null&&u.state!==void 0?u.state:null,u.updater=Lc,s.stateNode=u,u._reactInternals=s,u=s.stateNode,u.props=a,u.state=s.memoizedState,u.refs={},hc(s),m=r.contextType,u.context=typeof m=="object"&&m!==null?xt(m):kr,u.state=s.memoizedState,m=r.getDerivedStateFromProps,typeof m=="function"&&(Oc(s,r,m,a),u.state=s.memoizedState),typeof r.getDerivedStateFromProps=="function"||typeof u.getSnapshotBeforeUpdate=="function"||typeof u.UNSAFE_componentWillMount!="function"&&typeof u.componentWillMount!="function"||(m=u.state,typeof u.componentWillMount=="function"&&u.componentWillMount(),typeof u.UNSAFE_componentWillMount=="function"&&u.UNSAFE_componentWillMount(),m!==u.state&&Lc.enqueueReplaceState(u,u.state,null),En(s,a,u,c),kn(),u.state=s.memoizedState),typeof u.componentDidMount=="function"&&(s.flags|=4194308),a=!0}else if(t===null){u=s.stateNode;var v=s.memoizedProps,w=Qs(r,v);u.props=w;var N=u.context,q=r.contextType;m=kr,typeof q=="object"&&q!==null&&(m=xt(q));var Y=r.getDerivedStateFromProps;q=typeof Y=="function"||typeof u.getSnapshotBeforeUpdate=="function",v=s.pendingProps!==v,q||typeof u.UNSAFE_componentWillReceiveProps!="function"&&typeof u.componentWillReceiveProps!="function"||(v||N!==m)&&pp(s,u,a,m),fs=!1;var U=s.memoizedState;u.state=U,En(s,a,u,c),kn(),N=s.memoizedState,v||U!==N||fs?(typeof Y=="function"&&(Oc(s,r,Y,a),N=s.memoizedState),(w=fs||fp(s,r,w,a,U,N,m))?(q||typeof u.UNSAFE_componentWillMount!="function"&&typeof u.componentWillMount!="function"||(typeof u.componentWillMount=="function"&&u.componentWillMount(),typeof u.UNSAFE_componentWillMount=="function"&&u.UNSAFE_componentWillMount()),typeof u.componentDidMount=="function"&&(s.flags|=4194308)):(typeof u.componentDidMount=="function"&&(s.flags|=4194308),s.memoizedProps=a,s.memoizedState=N),u.props=a,u.state=N,u.context=m,a=w):(typeof u.componentDidMount=="function"&&(s.flags|=4194308),a=!1)}else{u=s.stateNode,uc(t,s),m=s.memoizedProps,q=Qs(r,m),u.props=q,Y=s.pendingProps,U=u.context,N=r.contextType,w=kr,typeof N=="object"&&N!==null&&(w=xt(N)),v=r.getDerivedStateFromProps,(N=typeof v=="function"||typeof u.getSnapshotBeforeUpdate=="function")||typeof u.UNSAFE_componentWillReceiveProps!="function"&&typeof u.componentWillReceiveProps!="function"||(m!==Y||U!==w)&&pp(s,u,a,w),fs=!1,U=s.memoizedState,u.state=U,En(s,a,u,c),kn();var W=s.memoizedState;m!==Y||U!==W||fs||t!==null&&t.dependencies!==null&&Il(t.dependencies)?(typeof v=="function"&&(Oc(s,r,v,a),W=s.memoizedState),(q=fs||fp(s,r,q,a,U,W,w)||t!==null&&t.dependencies!==null&&Il(t.dependencies))?(N||typeof u.UNSAFE_componentWillUpdate!="function"&&typeof u.componentWillUpdate!="function"||(typeof u.componentWillUpdate=="function"&&u.componentWillUpdate(a,W,w),typeof u.UNSAFE_componentWillUpdate=="function"&&u.UNSAFE_componentWillUpdate(a,W,w)),typeof u.componentDidUpdate=="function"&&(s.flags|=4),typeof u.getSnapshotBeforeUpdate=="function"&&(s.flags|=1024)):(typeof u.componentDidUpdate!="function"||m===t.memoizedProps&&U===t.memoizedState||(s.flags|=4),typeof u.getSnapshotBeforeUpdate!="function"||m===t.memoizedProps&&U===t.memoizedState||(s.flags|=1024),s.memoizedProps=a,s.memoizedState=W),u.props=a,u.state=W,u.context=w,a=q):(typeof u.componentDidUpdate!="function"||m===t.memoizedProps&&U===t.memoizedState||(s.flags|=4),typeof u.getSnapshotBeforeUpdate!="function"||m===t.memoizedProps&&U===t.memoizedState||(s.flags|=1024),a=!1)}return u=a,oa(t,s),a=(s.flags&128)!==0,u||a?(u=s.stateNode,r=a&&typeof r.getDerivedStateFromError!="function"?null:u.render(),s.flags|=1,t!==null&&a?(s.child=Vs(s,t.child,null,c),s.child=Vs(s,null,r,c)):wt(t,s,r,c),s.memoizedState=u.state,t=s.child):t=Yi(t,s,c),t}function Dp(t,s,r,a){return $s(),s.flags|=256,wt(t,s,r,a),s.child}var Uc={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Wc(t){return{baseLanes:t,cachePool:vf()}}function qc(t,s,r){return t=t!==null?t.childLanes&~r:0,s&&(t|=Vt),t}function Bp(t,s,r){var a=s.pendingProps,c=!1,u=(s.flags&128)!==0,m;if((m=u)||(m=t!==null&&t.memoizedState===null?!1:(Je.current&2)!==0),m&&(c=!0,s.flags&=-129),m=(s.flags&32)!==0,s.flags&=-33,t===null){if(Ee){if(c?gs(s):ms(),(t=qe)?(t=H_(t,oi),t=t!==null&&t.data!=="&"?t:null,t!==null&&(s.memoizedState={dehydrated:t,treeContext:cs!==null?{id:ki,overflow:Ei}:null,retryLane:536870912,hydrationErrors:null},r=cf(t),r.return=s,s.child=r,bt=s,qe=null)):t=null,t===null)throw us(s);return wh(t)?s.lanes=32:s.lanes=536870912,null}var v=a.children;return a=a.fallback,c?(ms(),c=s.mode,v=ca({mode:"hidden",children:v},c),a=Is(a,c,r,null),v.return=s,a.return=s,v.sibling=a,s.child=v,a=s.child,a.memoizedState=Wc(r),a.childLanes=qc(t,m,r),s.memoizedState=Uc,Mn(null,a)):(gs(s),Pc(s,v))}var w=t.memoizedState;if(w!==null&&(v=w.dehydrated,v!==null)){if(u)s.flags&256?(gs(s),s.flags&=-257,s=Ic(t,s,r)):s.memoizedState!==null?(ms(),s.child=t.child,s.flags|=128,s=null):(ms(),v=a.fallback,c=s.mode,a=ca({mode:"visible",children:a.children},c),v=Is(v,c,r,null),v.flags|=2,a.return=s,v.return=s,a.sibling=v,s.child=a,Vs(s,t.child,null,r),a=s.child,a.memoizedState=Wc(r),a.childLanes=qc(t,m,r),s.memoizedState=Uc,s=Mn(null,a));else if(gs(s),wh(v)){if(m=v.nextSibling&&v.nextSibling.dataset,m)var N=m.dgst;m=N,a=Error(l(419)),a.stack="",a.digest=m,yn({value:a,source:null,stack:null}),s=Ic(t,s,r)}else if(rt||Dr(t,s,r,!1),m=(r&t.childLanes)!==0,rt||m){if(m=We,m!==null&&(a=_d(m,r),a!==0&&a!==w.retryLane))throw w.retryLane=a,Ps(t,a),Wt(m,t,a),Nc;xh(v)||va(),s=Ic(t,s,r)}else xh(v)?(s.flags|=192,s.child=t.child,s=null):(t=w.treeContext,qe=hi(v.nextSibling),bt=s,Ee=!0,hs=null,oi=!1,t!==null&&df(s,t),s=Pc(s,a.children),s.flags|=4096);return s}return c?(ms(),v=a.fallback,c=s.mode,w=t.child,N=w.sibling,a=Wi(w,{mode:"hidden",children:a.children}),a.subtreeFlags=w.subtreeFlags&65011712,N!==null?v=Wi(N,v):(v=Is(v,c,r,null),v.flags|=2),v.return=s,a.return=s,a.sibling=v,s.child=a,Mn(null,a),a=s.child,v=t.child.memoizedState,v===null?v=Wc(r):(c=v.cachePool,c!==null?(w=it._currentValue,c=c.parent!==w?{parent:w,pool:w}:c):c=vf(),v={baseLanes:v.baseLanes|r,cachePool:c}),a.memoizedState=v,a.childLanes=qc(t,m,r),s.memoizedState=Uc,Mn(t.child,a)):(gs(s),r=t.child,t=r.sibling,r=Wi(r,{mode:"visible",children:a.children}),r.return=s,r.sibling=null,t!==null&&(m=s.deletions,m===null?(s.deletions=[t],s.flags|=16):m.push(t)),s.child=r,s.memoizedState=null,r)}function Pc(t,s){return s=ca({mode:"visible",children:s},t.mode),s.return=t,t.child=s}function ca(t,s){return t=Yt(22,t,null,s),t.lanes=0,t}function Ic(t,s,r){return Vs(s,t.child,null,r),t=Pc(s,s.pendingProps.children),t.flags|=2,s.memoizedState=null,t}function Mp(t,s,r){t.lanes|=s;var a=t.alternate;a!==null&&(a.lanes|=s),rc(t.return,s,r)}function $c(t,s,r,a,c,u){var m=t.memoizedState;m===null?t.memoizedState={isBackwards:s,rendering:null,renderingStartTime:0,last:a,tail:r,tailMode:c,treeForkCount:u}:(m.isBackwards=s,m.rendering=null,m.renderingStartTime=0,m.last=a,m.tail=r,m.tailMode=c,m.treeForkCount=u)}function zp(t,s,r){var a=s.pendingProps,c=a.revealOrder,u=a.tail;a=a.children;var m=Je.current,v=(m&2)!==0;if(v?(m=m&1|2,s.flags|=128):m&=1,J(Je,m),wt(t,s,a,r),a=Ee?vn:0,!v&&t!==null&&(t.flags&128)!==0)e:for(t=s.child;t!==null;){if(t.tag===13)t.memoizedState!==null&&Mp(t,r,s);else if(t.tag===19)Mp(t,r,s);else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===s)break e;for(;t.sibling===null;){if(t.return===null||t.return===s)break e;t=t.return}t.sibling.return=t.return,t=t.sibling}switch(c){case"forwards":for(r=s.child,c=null;r!==null;)t=r.alternate,t!==null&&Zl(t)===null&&(c=r),r=r.sibling;r=c,r===null?(c=s.child,s.child=null):(c=r.sibling,r.sibling=null),$c(s,!1,c,r,u,a);break;case"backwards":case"unstable_legacy-backwards":for(r=null,c=s.child,s.child=null;c!==null;){if(t=c.alternate,t!==null&&Zl(t)===null){s.child=c;break}t=c.sibling,c.sibling=r,r=c,c=t}$c(s,!0,r,null,u,a);break;case"together":$c(s,!1,null,null,void 0,a);break;default:s.memoizedState=null}return s.child}function Yi(t,s,r){if(t!==null&&(s.dependencies=t.dependencies),Ss|=s.lanes,(r&s.childLanes)===0)if(t!==null){if(Dr(t,s,r,!1),(r&s.childLanes)===0)return null}else return null;if(t!==null&&s.child!==t.child)throw Error(l(153));if(s.child!==null){for(t=s.child,r=Wi(t,t.pendingProps),s.child=r,r.return=s;t.sibling!==null;)t=t.sibling,r=r.sibling=Wi(t,t.pendingProps),r.return=s;r.sibling=null}return s.child}function Kc(t,s){return(t.lanes&s)!==0?!0:(t=t.dependencies,!!(t!==null&&Il(t)))}function ay(t,s,r){switch(s.tag){case 3:ot(s,s.stateNode.containerInfo),ds(s,it,t.memoizedState.cache),$s();break;case 27:case 5:wi(s);break;case 4:ot(s,s.stateNode.containerInfo);break;case 10:ds(s,s.type,s.memoizedProps.value);break;case 31:if(s.memoizedState!==null)return s.flags|=128,gc(s),null;break;case 13:var a=s.memoizedState;if(a!==null)return a.dehydrated!==null?(gs(s),s.flags|=128,null):(r&s.child.childLanes)!==0?Bp(t,s,r):(gs(s),t=Yi(t,s,r),t!==null?t.sibling:null);gs(s);break;case 19:var c=(t.flags&128)!==0;if(a=(r&s.childLanes)!==0,a||(Dr(t,s,r,!1),a=(r&s.childLanes)!==0),c){if(a)return zp(t,s,r);s.flags|=128}if(c=s.memoizedState,c!==null&&(c.rendering=null,c.tail=null,c.lastEffect=null),J(Je,Je.current),a)break;return null;case 22:return s.lanes=0,Cp(t,s,r,s.pendingProps);case 24:ds(s,it,t.memoizedState.cache)}return Yi(t,s,r)}function Ap(t,s,r){if(t!==null)if(t.memoizedProps!==s.pendingProps)rt=!0;else{if(!Kc(t,r)&&(s.flags&128)===0)return rt=!1,ay(t,s,r);rt=(t.flags&131072)!==0}else rt=!1,Ee&&(s.flags&1048576)!==0&&uf(s,vn,s.index);switch(s.lanes=0,s.tag){case 16:e:{var a=s.pendingProps;if(t=Gs(s.elementType),s.type=t,typeof t=="function")Vo(t)?(a=Qs(t,a),s.tag=1,s=Rp(null,s,t,a,r)):(s.tag=0,s=Hc(null,s,t,a,r));else{if(t!=null){var c=t.$$typeof;if(c===L){s.tag=11,s=bp(null,s,t,a,r);break e}else if(c===V){s.tag=14,s=xp(null,s,t,a,r);break e}}throw s=ie(t)||t,Error(l(306,s,""))}}return s;case 0:return Hc(t,s,s.type,s.pendingProps,r);case 1:return a=s.type,c=Qs(a,s.pendingProps),Rp(t,s,a,c,r);case 3:e:{if(ot(s,s.stateNode.containerInfo),t===null)throw Error(l(387));a=s.pendingProps;var u=s.memoizedState;c=u.element,uc(t,s),En(s,a,null,r);var m=s.memoizedState;if(a=m.cache,ds(s,it,a),a!==u.cache&&nc(s,[it],r,!0),kn(),a=m.element,u.isDehydrated)if(u={element:a,isDehydrated:!1,cache:m.cache},s.updateQueue.baseState=u,s.memoizedState=u,s.flags&256){s=Dp(t,s,a,r);break e}else if(a!==c){c=ni(Error(l(424)),s),yn(c),s=Dp(t,s,a,r);break e}else for(t=s.stateNode.containerInfo,t.nodeType===9?t=t.body:t=t.nodeName==="HTML"?t.ownerDocument.body:t,qe=hi(t.firstChild),bt=s,Ee=!0,hs=null,oi=!0,r=Cf(s,null,a,r),s.child=r;r;)r.flags=r.flags&-3|4096,r=r.sibling;else{if($s(),a===c){s=Yi(t,s,r);break e}wt(t,s,a,r)}s=s.child}return s;case 26:return oa(t,s),t===null?(r=$_(s.type,null,s.pendingProps,null))?s.memoizedState=r:Ee||(r=s.type,t=s.pendingProps,a=ka(he.current).createElement(r),a[St]=s,a[Ot]=t,Ct(a,r,t),ft(a),s.stateNode=a):s.memoizedState=$_(s.type,t.memoizedProps,s.pendingProps,t.memoizedState),null;case 27:return wi(s),t===null&&Ee&&(a=s.stateNode=q_(s.type,s.pendingProps,he.current),bt=s,oi=!0,c=qe,ks(s.type)?(Ch=c,qe=hi(a.firstChild)):qe=c),wt(t,s,s.pendingProps.children,r),oa(t,s),t===null&&(s.flags|=4194304),s.child;case 5:return t===null&&Ee&&((c=a=qe)&&(a=Ny(a,s.type,s.pendingProps,oi),a!==null?(s.stateNode=a,bt=s,qe=hi(a.firstChild),oi=!1,c=!0):c=!1),c||us(s)),wi(s),c=s.type,u=s.pendingProps,m=t!==null?t.memoizedProps:null,a=u.children,yh(c,u)?a=null:m!==null&&yh(c,m)&&(s.flags|=32),s.memoizedState!==null&&(c=vc(t,s,Q0,null,null,r),Yn._currentValue=c),oa(t,s),wt(t,s,a,r),s.child;case 6:return t===null&&Ee&&((t=r=qe)&&(r=Hy(r,s.pendingProps,oi),r!==null?(s.stateNode=r,bt=s,qe=null,t=!0):t=!1),t||us(s)),null;case 13:return Bp(t,s,r);case 4:return ot(s,s.stateNode.containerInfo),a=s.pendingProps,t===null?s.child=Vs(s,null,a,r):wt(t,s,a,r),s.child;case 11:return bp(t,s,s.type,s.pendingProps,r);case 7:return wt(t,s,s.pendingProps,r),s.child;case 8:return wt(t,s,s.pendingProps.children,r),s.child;case 12:return wt(t,s,s.pendingProps.children,r),s.child;case 10:return a=s.pendingProps,ds(s,s.type,a.value),wt(t,s,a.children,r),s.child;case 9:return c=s.type._context,a=s.pendingProps.children,Ys(s),c=xt(c),a=a(c),s.flags|=1,wt(t,s,a,r),s.child;case 14:return xp(t,s,s.type,s.pendingProps,r);case 15:return wp(t,s,s.type,s.pendingProps,r);case 19:return zp(t,s,r);case 31:return ly(t,s,r);case 22:return Cp(t,s,r,s.pendingProps);case 24:return Ys(s),a=xt(it),t===null?(c=oc(),c===null&&(c=We,u=lc(),c.pooledCache=u,u.refCount++,u!==null&&(c.pooledCacheLanes|=r),c=u),s.memoizedState={parent:a,cache:c},hc(s),ds(s,it,c)):((t.lanes&r)!==0&&(uc(t,s),En(s,null,null,r),kn()),c=t.memoizedState,u=s.memoizedState,c.parent!==a?(c={parent:a,cache:a},s.memoizedState=c,s.lanes===0&&(s.memoizedState=s.updateQueue.baseState=c),ds(s,it,a)):(a=u.cache,ds(s,it,a),a!==c.cache&&nc(s,[it],r,!0))),wt(t,s,s.pendingProps.children,r),s.child;case 29:throw s.pendingProps}throw Error(l(156,s.tag))}function Fi(t){t.flags|=4}function Yc(t,s,r,a,c){if((s=(t.mode&32)!==0)&&(s=!1),s){if(t.flags|=16777216,(c&335544128)===c)if(t.stateNode.complete)t.flags|=8192;else if(l_())t.flags|=8192;else throw Xs=Fl,cc}else t.flags&=-16777217}function Op(t,s){if(s.type!=="stylesheet"||(s.state.loading&4)!==0)t.flags&=-16777217;else if(t.flags|=16777216,!X_(s))if(l_())t.flags|=8192;else throw Xs=Fl,cc}function ha(t,s){s!==null&&(t.flags|=4),t.flags&16384&&(s=t.tag!==22?dd():536870912,t.lanes|=s,qr|=s)}function zn(t,s){if(!Ee)switch(t.tailMode){case"hidden":s=t.tail;for(var r=null;s!==null;)s.alternate!==null&&(r=s),s=s.sibling;r===null?t.tail=null:r.sibling=null;break;case"collapsed":r=t.tail;for(var a=null;r!==null;)r.alternate!==null&&(a=r),r=r.sibling;a===null?s||t.tail===null?t.tail=null:t.tail.sibling=null:a.sibling=null}}function Pe(t){var s=t.alternate!==null&&t.alternate.child===t.child,r=0,a=0;if(s)for(var c=t.child;c!==null;)r|=c.lanes|c.childLanes,a|=c.subtreeFlags&65011712,a|=c.flags&65011712,c.return=t,c=c.sibling;else for(c=t.child;c!==null;)r|=c.lanes|c.childLanes,a|=c.subtreeFlags,a|=c.flags,c.return=t,c=c.sibling;return t.subtreeFlags|=a,t.childLanes=r,s}function oy(t,s,r){var a=s.pendingProps;switch(ec(s),s.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Pe(s),null;case 1:return Pe(s),null;case 3:return r=s.stateNode,a=null,t!==null&&(a=t.memoizedState.cache),s.memoizedState.cache!==a&&(s.flags|=2048),Ii(it),ze(),r.pendingContext&&(r.context=r.pendingContext,r.pendingContext=null),(t===null||t.child===null)&&(Rr(s)?Fi(s):t===null||t.memoizedState.isDehydrated&&(s.flags&256)===0||(s.flags|=1024,ic())),Pe(s),null;case 26:var c=s.type,u=s.memoizedState;return t===null?(Fi(s),u!==null?(Pe(s),Op(s,u)):(Pe(s),Yc(s,c,null,a,r))):u?u!==t.memoizedState?(Fi(s),Pe(s),Op(s,u)):(Pe(s),s.flags&=-16777217):(t=t.memoizedProps,t!==a&&Fi(s),Pe(s),Yc(s,c,t,a,r)),null;case 27:if(Ci(s),r=he.current,c=s.type,t!==null&&s.stateNode!=null)t.memoizedProps!==a&&Fi(s);else{if(!a){if(s.stateNode===null)throw Error(l(166));return Pe(s),null}t=te.current,Rr(s)?ff(s):(t=q_(c,a,r),s.stateNode=t,Fi(s))}return Pe(s),null;case 5:if(Ci(s),c=s.type,t!==null&&s.stateNode!=null)t.memoizedProps!==a&&Fi(s);else{if(!a){if(s.stateNode===null)throw Error(l(166));return Pe(s),null}if(u=te.current,Rr(s))ff(s);else{var m=ka(he.current);switch(u){case 1:u=m.createElementNS("http://www.w3.org/2000/svg",c);break;case 2:u=m.createElementNS("http://www.w3.org/1998/Math/MathML",c);break;default:switch(c){case"svg":u=m.createElementNS("http://www.w3.org/2000/svg",c);break;case"math":u=m.createElementNS("http://www.w3.org/1998/Math/MathML",c);break;case"script":u=m.createElement("div"),u.innerHTML="<script><\/script>",u=u.removeChild(u.firstChild);break;case"select":u=typeof a.is=="string"?m.createElement("select",{is:a.is}):m.createElement("select"),a.multiple?u.multiple=!0:a.size&&(u.size=a.size);break;default:u=typeof a.is=="string"?m.createElement(c,{is:a.is}):m.createElement(c)}}u[St]=s,u[Ot]=a;e:for(m=s.child;m!==null;){if(m.tag===5||m.tag===6)u.appendChild(m.stateNode);else if(m.tag!==4&&m.tag!==27&&m.child!==null){m.child.return=m,m=m.child;continue}if(m===s)break e;for(;m.sibling===null;){if(m.return===null||m.return===s)break e;m=m.return}m.sibling.return=m.return,m=m.sibling}s.stateNode=u;e:switch(Ct(u,c,a),c){case"button":case"input":case"select":case"textarea":a=!!a.autoFocus;break e;case"img":a=!0;break e;default:a=!1}a&&Fi(s)}}return Pe(s),Yc(s,s.type,t===null?null:t.memoizedProps,s.pendingProps,r),null;case 6:if(t&&s.stateNode!=null)t.memoizedProps!==a&&Fi(s);else{if(typeof a!="string"&&s.stateNode===null)throw Error(l(166));if(t=he.current,Rr(s)){if(t=s.stateNode,r=s.memoizedProps,a=null,c=bt,c!==null)switch(c.tag){case 27:case 5:a=c.memoizedProps}t[St]=s,t=!!(t.nodeValue===r||a!==null&&a.suppressHydrationWarning===!0||B_(t.nodeValue,r)),t||us(s,!0)}else t=ka(t).createTextNode(a),t[St]=s,s.stateNode=t}return Pe(s),null;case 31:if(r=s.memoizedState,t===null||t.memoizedState!==null){if(a=Rr(s),r!==null){if(t===null){if(!a)throw Error(l(318));if(t=s.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(l(557));t[St]=s}else $s(),(s.flags&128)===0&&(s.memoizedState=null),s.flags|=4;Pe(s),t=!1}else r=ic(),t!==null&&t.memoizedState!==null&&(t.memoizedState.hydrationErrors=r),t=!0;if(!t)return s.flags&256?(Gt(s),s):(Gt(s),null);if((s.flags&128)!==0)throw Error(l(558))}return Pe(s),null;case 13:if(a=s.memoizedState,t===null||t.memoizedState!==null&&t.memoizedState.dehydrated!==null){if(c=Rr(s),a!==null&&a.dehydrated!==null){if(t===null){if(!c)throw Error(l(318));if(c=s.memoizedState,c=c!==null?c.dehydrated:null,!c)throw Error(l(317));c[St]=s}else $s(),(s.flags&128)===0&&(s.memoizedState=null),s.flags|=4;Pe(s),c=!1}else c=ic(),t!==null&&t.memoizedState!==null&&(t.memoizedState.hydrationErrors=c),c=!0;if(!c)return s.flags&256?(Gt(s),s):(Gt(s),null)}return Gt(s),(s.flags&128)!==0?(s.lanes=r,s):(r=a!==null,t=t!==null&&t.memoizedState!==null,r&&(a=s.child,c=null,a.alternate!==null&&a.alternate.memoizedState!==null&&a.alternate.memoizedState.cachePool!==null&&(c=a.alternate.memoizedState.cachePool.pool),u=null,a.memoizedState!==null&&a.memoizedState.cachePool!==null&&(u=a.memoizedState.cachePool.pool),u!==c&&(a.flags|=2048)),r!==t&&r&&(s.child.flags|=8192),ha(s,s.updateQueue),Pe(s),null);case 4:return ze(),t===null&&ph(s.stateNode.containerInfo),Pe(s),null;case 10:return Ii(s.type),Pe(s),null;case 19:if(P(Je),a=s.memoizedState,a===null)return Pe(s),null;if(c=(s.flags&128)!==0,u=a.rendering,u===null)if(c)zn(a,!1);else{if(Ve!==0||t!==null&&(t.flags&128)!==0)for(t=s.child;t!==null;){if(u=Zl(t),u!==null){for(s.flags|=128,zn(a,!1),t=u.updateQueue,s.updateQueue=t,ha(s,t),s.subtreeFlags=0,t=r,r=s.child;r!==null;)of(r,t),r=r.sibling;return J(Je,Je.current&1|2),Ee&&qi(s,a.treeForkCount),s.child}t=t.sibling}a.tail!==null&&Pt()>_a&&(s.flags|=128,c=!0,zn(a,!1),s.lanes=4194304)}else{if(!c)if(t=Zl(u),t!==null){if(s.flags|=128,c=!0,t=t.updateQueue,s.updateQueue=t,ha(s,t),zn(a,!0),a.tail===null&&a.tailMode==="hidden"&&!u.alternate&&!Ee)return Pe(s),null}else 2*Pt()-a.renderingStartTime>_a&&r!==536870912&&(s.flags|=128,c=!0,zn(a,!1),s.lanes=4194304);a.isBackwards?(u.sibling=s.child,s.child=u):(t=a.last,t!==null?t.sibling=u:s.child=u,a.last=u)}return a.tail!==null?(t=a.tail,a.rendering=t,a.tail=t.sibling,a.renderingStartTime=Pt(),t.sibling=null,r=Je.current,J(Je,c?r&1|2:r&1),Ee&&qi(s,a.treeForkCount),t):(Pe(s),null);case 22:case 23:return Gt(s),_c(),a=s.memoizedState!==null,t!==null?t.memoizedState!==null!==a&&(s.flags|=8192):a&&(s.flags|=8192),a?(r&536870912)!==0&&(s.flags&128)===0&&(Pe(s),s.subtreeFlags&6&&(s.flags|=8192)):Pe(s),r=s.updateQueue,r!==null&&ha(s,r.retryQueue),r=null,t!==null&&t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(r=t.memoizedState.cachePool.pool),a=null,s.memoizedState!==null&&s.memoizedState.cachePool!==null&&(a=s.memoizedState.cachePool.pool),a!==r&&(s.flags|=2048),t!==null&&P(Fs),null;case 24:return r=null,t!==null&&(r=t.memoizedState.cache),s.memoizedState.cache!==r&&(s.flags|=2048),Ii(it),Pe(s),null;case 25:return null;case 30:return null}throw Error(l(156,s.tag))}function cy(t,s){switch(ec(s),s.tag){case 1:return t=s.flags,t&65536?(s.flags=t&-65537|128,s):null;case 3:return Ii(it),ze(),t=s.flags,(t&65536)!==0&&(t&128)===0?(s.flags=t&-65537|128,s):null;case 26:case 27:case 5:return Ci(s),null;case 31:if(s.memoizedState!==null){if(Gt(s),s.alternate===null)throw Error(l(340));$s()}return t=s.flags,t&65536?(s.flags=t&-65537|128,s):null;case 13:if(Gt(s),t=s.memoizedState,t!==null&&t.dehydrated!==null){if(s.alternate===null)throw Error(l(340));$s()}return t=s.flags,t&65536?(s.flags=t&-65537|128,s):null;case 19:return P(Je),null;case 4:return ze(),null;case 10:return Ii(s.type),null;case 22:case 23:return Gt(s),_c(),t!==null&&P(Fs),t=s.flags,t&65536?(s.flags=t&-65537|128,s):null;case 24:return Ii(it),null;case 25:return null;default:return null}}function Lp(t,s){switch(ec(s),s.tag){case 3:Ii(it),ze();break;case 26:case 27:case 5:Ci(s);break;case 4:ze();break;case 31:s.memoizedState!==null&&Gt(s);break;case 13:Gt(s);break;case 19:P(Je);break;case 10:Ii(s.type);break;case 22:case 23:Gt(s),_c(),t!==null&&P(Fs);break;case 24:Ii(it)}}function An(t,s){try{var r=s.updateQueue,a=r!==null?r.lastEffect:null;if(a!==null){var c=a.next;r=c;do{if((r.tag&t)===t){a=void 0;var u=r.create,m=r.inst;a=u(),m.destroy=a}r=r.next}while(r!==c)}}catch(v){Oe(s,s.return,v)}}function vs(t,s,r){try{var a=s.updateQueue,c=a!==null?a.lastEffect:null;if(c!==null){var u=c.next;a=u;do{if((a.tag&t)===t){var m=a.inst,v=m.destroy;if(v!==void 0){m.destroy=void 0,c=s;var w=r,N=v;try{N()}catch(q){Oe(c,w,q)}}}a=a.next}while(a!==u)}}catch(q){Oe(s,s.return,q)}}function jp(t){var s=t.updateQueue;if(s!==null){var r=t.stateNode;try{Ef(s,r)}catch(a){Oe(t,t.return,a)}}}function Np(t,s,r){r.props=Qs(t.type,t.memoizedProps),r.state=t.memoizedState;try{r.componentWillUnmount()}catch(a){Oe(t,s,a)}}function On(t,s){try{var r=t.ref;if(r!==null){switch(t.tag){case 26:case 27:case 5:var a=t.stateNode;break;case 30:a=t.stateNode;break;default:a=t.stateNode}typeof r=="function"?t.refCleanup=r(a):r.current=a}}catch(c){Oe(t,s,c)}}function Ti(t,s){var r=t.ref,a=t.refCleanup;if(r!==null)if(typeof a=="function")try{a()}catch(c){Oe(t,s,c)}finally{t.refCleanup=null,t=t.alternate,t!=null&&(t.refCleanup=null)}else if(typeof r=="function")try{r(null)}catch(c){Oe(t,s,c)}else r.current=null}function Hp(t){var s=t.type,r=t.memoizedProps,a=t.stateNode;try{e:switch(s){case"button":case"input":case"select":case"textarea":r.autoFocus&&a.focus();break e;case"img":r.src?a.src=r.src:r.srcSet&&(a.srcset=r.srcSet)}}catch(c){Oe(t,t.return,c)}}function Fc(t,s,r){try{var a=t.stateNode;My(a,t.type,r,s),a[Ot]=s}catch(c){Oe(t,t.return,c)}}function Up(t){return t.tag===5||t.tag===3||t.tag===26||t.tag===27&&ks(t.type)||t.tag===4}function Gc(t){e:for(;;){for(;t.sibling===null;){if(t.return===null||Up(t.return))return null;t=t.return}for(t.sibling.return=t.return,t=t.sibling;t.tag!==5&&t.tag!==6&&t.tag!==18;){if(t.tag===27&&ks(t.type)||t.flags&2||t.child===null||t.tag===4)continue e;t.child.return=t,t=t.child}if(!(t.flags&2))return t.stateNode}}function Xc(t,s,r){var a=t.tag;if(a===5||a===6)t=t.stateNode,s?(r.nodeType===9?r.body:r.nodeName==="HTML"?r.ownerDocument.body:r).insertBefore(t,s):(s=r.nodeType===9?r.body:r.nodeName==="HTML"?r.ownerDocument.body:r,s.appendChild(t),r=r._reactRootContainer,r!=null||s.onclick!==null||(s.onclick=Hi));else if(a!==4&&(a===27&&ks(t.type)&&(r=t.stateNode,s=null),t=t.child,t!==null))for(Xc(t,s,r),t=t.sibling;t!==null;)Xc(t,s,r),t=t.sibling}function ua(t,s,r){var a=t.tag;if(a===5||a===6)t=t.stateNode,s?r.insertBefore(t,s):r.appendChild(t);else if(a!==4&&(a===27&&ks(t.type)&&(r=t.stateNode),t=t.child,t!==null))for(ua(t,s,r),t=t.sibling;t!==null;)ua(t,s,r),t=t.sibling}function Wp(t){var s=t.stateNode,r=t.memoizedProps;try{for(var a=t.type,c=s.attributes;c.length;)s.removeAttributeNode(c[0]);Ct(s,a,r),s[St]=t,s[Ot]=r}catch(u){Oe(t,t.return,u)}}var Gi=!1,nt=!1,Vc=!1,qp=typeof WeakSet=="function"?WeakSet:Set,pt=null;function hy(t,s){if(t=t.containerInfo,mh=za,t=Qd(t),Io(t)){if("selectionStart"in t)var r={start:t.selectionStart,end:t.selectionEnd};else e:{r=(r=t.ownerDocument)&&r.defaultView||window;var a=r.getSelection&&r.getSelection();if(a&&a.rangeCount!==0){r=a.anchorNode;var c=a.anchorOffset,u=a.focusNode;a=a.focusOffset;try{r.nodeType,u.nodeType}catch{r=null;break e}var m=0,v=-1,w=-1,N=0,q=0,Y=t,U=null;t:for(;;){for(var W;Y!==r||c!==0&&Y.nodeType!==3||(v=m+c),Y!==u||a!==0&&Y.nodeType!==3||(w=m+a),Y.nodeType===3&&(m+=Y.nodeValue.length),(W=Y.firstChild)!==null;)U=Y,Y=W;for(;;){if(Y===t)break t;if(U===r&&++N===c&&(v=m),U===u&&++q===a&&(w=m),(W=Y.nextSibling)!==null)break;Y=U,U=Y.parentNode}Y=W}r=v===-1||w===-1?null:{start:v,end:w}}else r=null}r=r||{start:0,end:0}}else r=null;for(vh={focusedElem:t,selectionRange:r},za=!1,pt=s;pt!==null;)if(s=pt,t=s.child,(s.subtreeFlags&1028)!==0&&t!==null)t.return=s,pt=t;else for(;pt!==null;){switch(s=pt,u=s.alternate,t=s.flags,s.tag){case 0:if((t&4)!==0&&(t=s.updateQueue,t=t!==null?t.events:null,t!==null))for(r=0;r<t.length;r++)c=t[r],c.ref.impl=c.nextImpl;break;case 11:case 15:break;case 1:if((t&1024)!==0&&u!==null){t=void 0,r=s,c=u.memoizedProps,u=u.memoizedState,a=r.stateNode;try{var re=Qs(r.type,c);t=a.getSnapshotBeforeUpdate(re,u),a.__reactInternalSnapshotBeforeUpdate=t}catch(ce){Oe(r,r.return,ce)}}break;case 3:if((t&1024)!==0){if(t=s.stateNode.containerInfo,r=t.nodeType,r===9)bh(t);else if(r===1)switch(t.nodeName){case"HEAD":case"HTML":case"BODY":bh(t);break;default:t.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((t&1024)!==0)throw Error(l(163))}if(t=s.sibling,t!==null){t.return=s.return,pt=t;break}pt=s.return}}function Pp(t,s,r){var a=r.flags;switch(r.tag){case 0:case 11:case 15:Vi(t,r),a&4&&An(5,r);break;case 1:if(Vi(t,r),a&4)if(t=r.stateNode,s===null)try{t.componentDidMount()}catch(m){Oe(r,r.return,m)}else{var c=Qs(r.type,s.memoizedProps);s=s.memoizedState;try{t.componentDidUpdate(c,s,t.__reactInternalSnapshotBeforeUpdate)}catch(m){Oe(r,r.return,m)}}a&64&&jp(r),a&512&&On(r,r.return);break;case 3:if(Vi(t,r),a&64&&(t=r.updateQueue,t!==null)){if(s=null,r.child!==null)switch(r.child.tag){case 27:case 5:s=r.child.stateNode;break;case 1:s=r.child.stateNode}try{Ef(t,s)}catch(m){Oe(r,r.return,m)}}break;case 27:s===null&&a&4&&Wp(r);case 26:case 5:Vi(t,r),s===null&&a&4&&Hp(r),a&512&&On(r,r.return);break;case 12:Vi(t,r);break;case 31:Vi(t,r),a&4&&Kp(t,r);break;case 13:Vi(t,r),a&4&&Yp(t,r),a&64&&(t=r.memoizedState,t!==null&&(t=t.dehydrated,t!==null&&(r=yy.bind(null,r),Uy(t,r))));break;case 22:if(a=r.memoizedState!==null||Gi,!a){s=s!==null&&s.memoizedState!==null||nt,c=Gi;var u=nt;Gi=a,(nt=s)&&!u?Zi(t,r,(r.subtreeFlags&8772)!==0):Vi(t,r),Gi=c,nt=u}break;case 30:break;default:Vi(t,r)}}function Ip(t){var s=t.alternate;s!==null&&(t.alternate=null,Ip(s)),t.child=null,t.deletions=null,t.sibling=null,t.tag===5&&(s=t.stateNode,s!==null&&Eo(s)),t.stateNode=null,t.return=null,t.dependencies=null,t.memoizedProps=null,t.memoizedState=null,t.pendingProps=null,t.stateNode=null,t.updateQueue=null}var $e=null,jt=!1;function Xi(t,s,r){for(r=r.child;r!==null;)$p(t,s,r),r=r.sibling}function $p(t,s,r){if(It&&typeof It.onCommitFiberUnmount=="function")try{It.onCommitFiberUnmount(rn,r)}catch{}switch(r.tag){case 26:nt||Ti(r,s),Xi(t,s,r),r.memoizedState?r.memoizedState.count--:r.stateNode&&(r=r.stateNode,r.parentNode.removeChild(r));break;case 27:nt||Ti(r,s);var a=$e,c=jt;ks(r.type)&&($e=r.stateNode,jt=!1),Xi(t,s,r),In(r.stateNode),$e=a,jt=c;break;case 5:nt||Ti(r,s);case 6:if(a=$e,c=jt,$e=null,Xi(t,s,r),$e=a,jt=c,$e!==null)if(jt)try{($e.nodeType===9?$e.body:$e.nodeName==="HTML"?$e.ownerDocument.body:$e).removeChild(r.stateNode)}catch(u){Oe(r,s,u)}else try{$e.removeChild(r.stateNode)}catch(u){Oe(r,s,u)}break;case 18:$e!==null&&(jt?(t=$e,j_(t.nodeType===9?t.body:t.nodeName==="HTML"?t.ownerDocument.body:t,r.stateNode),Xr(t)):j_($e,r.stateNode));break;case 4:a=$e,c=jt,$e=r.stateNode.containerInfo,jt=!0,Xi(t,s,r),$e=a,jt=c;break;case 0:case 11:case 14:case 15:vs(2,r,s),nt||vs(4,r,s),Xi(t,s,r);break;case 1:nt||(Ti(r,s),a=r.stateNode,typeof a.componentWillUnmount=="function"&&Np(r,s,a)),Xi(t,s,r);break;case 21:Xi(t,s,r);break;case 22:nt=(a=nt)||r.memoizedState!==null,Xi(t,s,r),nt=a;break;default:Xi(t,s,r)}}function Kp(t,s){if(s.memoizedState===null&&(t=s.alternate,t!==null&&(t=t.memoizedState,t!==null))){t=t.dehydrated;try{Xr(t)}catch(r){Oe(s,s.return,r)}}}function Yp(t,s){if(s.memoizedState===null&&(t=s.alternate,t!==null&&(t=t.memoizedState,t!==null&&(t=t.dehydrated,t!==null))))try{Xr(t)}catch(r){Oe(s,s.return,r)}}function uy(t){switch(t.tag){case 31:case 13:case 19:var s=t.stateNode;return s===null&&(s=t.stateNode=new qp),s;case 22:return t=t.stateNode,s=t._retryCache,s===null&&(s=t._retryCache=new qp),s;default:throw Error(l(435,t.tag))}}function da(t,s){var r=uy(t);s.forEach(function(a){if(!r.has(a)){r.add(a);var c=Sy.bind(null,t,a);a.then(c,c)}})}function Nt(t,s){var r=s.deletions;if(r!==null)for(var a=0;a<r.length;a++){var c=r[a],u=t,m=s,v=m;e:for(;v!==null;){switch(v.tag){case 27:if(ks(v.type)){$e=v.stateNode,jt=!1;break e}break;case 5:$e=v.stateNode,jt=!1;break e;case 3:case 4:$e=v.stateNode.containerInfo,jt=!0;break e}v=v.return}if($e===null)throw Error(l(160));$p(u,m,c),$e=null,jt=!1,u=c.alternate,u!==null&&(u.return=null),c.return=null}if(s.subtreeFlags&13886)for(s=s.child;s!==null;)Fp(s,t),s=s.sibling}var yi=null;function Fp(t,s){var r=t.alternate,a=t.flags;switch(t.tag){case 0:case 11:case 14:case 15:Nt(s,t),Ht(t),a&4&&(vs(3,t,t.return),An(3,t),vs(5,t,t.return));break;case 1:Nt(s,t),Ht(t),a&512&&(nt||r===null||Ti(r,r.return)),a&64&&Gi&&(t=t.updateQueue,t!==null&&(a=t.callbacks,a!==null&&(r=t.shared.hiddenCallbacks,t.shared.hiddenCallbacks=r===null?a:r.concat(a))));break;case 26:var c=yi;if(Nt(s,t),Ht(t),a&512&&(nt||r===null||Ti(r,r.return)),a&4){var u=r!==null?r.memoizedState:null;if(a=t.memoizedState,r===null)if(a===null)if(t.stateNode===null){e:{a=t.type,r=t.memoizedProps,c=c.ownerDocument||c;t:switch(a){case"title":u=c.getElementsByTagName("title")[0],(!u||u[an]||u[St]||u.namespaceURI==="http://www.w3.org/2000/svg"||u.hasAttribute("itemprop"))&&(u=c.createElement(a),c.head.insertBefore(u,c.querySelector("head > title"))),Ct(u,a,r),u[St]=t,ft(u),a=u;break e;case"link":var m=F_("link","href",c).get(a+(r.href||""));if(m){for(var v=0;v<m.length;v++)if(u=m[v],u.getAttribute("href")===(r.href==null||r.href===""?null:r.href)&&u.getAttribute("rel")===(r.rel==null?null:r.rel)&&u.getAttribute("title")===(r.title==null?null:r.title)&&u.getAttribute("crossorigin")===(r.crossOrigin==null?null:r.crossOrigin)){m.splice(v,1);break t}}u=c.createElement(a),Ct(u,a,r),c.head.appendChild(u);break;case"meta":if(m=F_("meta","content",c).get(a+(r.content||""))){for(v=0;v<m.length;v++)if(u=m[v],u.getAttribute("content")===(r.content==null?null:""+r.content)&&u.getAttribute("name")===(r.name==null?null:r.name)&&u.getAttribute("property")===(r.property==null?null:r.property)&&u.getAttribute("http-equiv")===(r.httpEquiv==null?null:r.httpEquiv)&&u.getAttribute("charset")===(r.charSet==null?null:r.charSet)){m.splice(v,1);break t}}u=c.createElement(a),Ct(u,a,r),c.head.appendChild(u);break;default:throw Error(l(468,a))}u[St]=t,ft(u),a=u}t.stateNode=a}else G_(c,t.type,t.stateNode);else t.stateNode=Y_(c,a,t.memoizedProps);else u!==a?(u===null?r.stateNode!==null&&(r=r.stateNode,r.parentNode.removeChild(r)):u.count--,a===null?G_(c,t.type,t.stateNode):Y_(c,a,t.memoizedProps)):a===null&&t.stateNode!==null&&Fc(t,t.memoizedProps,r.memoizedProps)}break;case 27:Nt(s,t),Ht(t),a&512&&(nt||r===null||Ti(r,r.return)),r!==null&&a&4&&Fc(t,t.memoizedProps,r.memoizedProps);break;case 5:if(Nt(s,t),Ht(t),a&512&&(nt||r===null||Ti(r,r.return)),t.flags&32){c=t.stateNode;try{vr(c,"")}catch(re){Oe(t,t.return,re)}}a&4&&t.stateNode!=null&&(c=t.memoizedProps,Fc(t,c,r!==null?r.memoizedProps:c)),a&1024&&(Vc=!0);break;case 6:if(Nt(s,t),Ht(t),a&4){if(t.stateNode===null)throw Error(l(162));a=t.memoizedProps,r=t.stateNode;try{r.nodeValue=a}catch(re){Oe(t,t.return,re)}}break;case 3:if(Ra=null,c=yi,yi=Ea(s.containerInfo),Nt(s,t),yi=c,Ht(t),a&4&&r!==null&&r.memoizedState.isDehydrated)try{Xr(s.containerInfo)}catch(re){Oe(t,t.return,re)}Vc&&(Vc=!1,Gp(t));break;case 4:a=yi,yi=Ea(t.stateNode.containerInfo),Nt(s,t),Ht(t),yi=a;break;case 12:Nt(s,t),Ht(t);break;case 31:Nt(s,t),Ht(t),a&4&&(a=t.updateQueue,a!==null&&(t.updateQueue=null,da(t,a)));break;case 13:Nt(s,t),Ht(t),t.child.flags&8192&&t.memoizedState!==null!=(r!==null&&r.memoizedState!==null)&&(pa=Pt()),a&4&&(a=t.updateQueue,a!==null&&(t.updateQueue=null,da(t,a)));break;case 22:c=t.memoizedState!==null;var w=r!==null&&r.memoizedState!==null,N=Gi,q=nt;if(Gi=N||c,nt=q||w,Nt(s,t),nt=q,Gi=N,Ht(t),a&8192)e:for(s=t.stateNode,s._visibility=c?s._visibility&-2:s._visibility|1,c&&(r===null||w||Gi||nt||Js(t)),r=null,s=t;;){if(s.tag===5||s.tag===26){if(r===null){w=r=s;try{if(u=w.stateNode,c)m=u.style,typeof m.setProperty=="function"?m.setProperty("display","none","important"):m.display="none";else{v=w.stateNode;var Y=w.memoizedProps.style,U=Y!=null&&Y.hasOwnProperty("display")?Y.display:null;v.style.display=U==null||typeof U=="boolean"?"":(""+U).trim()}}catch(re){Oe(w,w.return,re)}}}else if(s.tag===6){if(r===null){w=s;try{w.stateNode.nodeValue=c?"":w.memoizedProps}catch(re){Oe(w,w.return,re)}}}else if(s.tag===18){if(r===null){w=s;try{var W=w.stateNode;c?N_(W,!0):N_(w.stateNode,!1)}catch(re){Oe(w,w.return,re)}}}else if((s.tag!==22&&s.tag!==23||s.memoizedState===null||s===t)&&s.child!==null){s.child.return=s,s=s.child;continue}if(s===t)break e;for(;s.sibling===null;){if(s.return===null||s.return===t)break e;r===s&&(r=null),s=s.return}r===s&&(r=null),s.sibling.return=s.return,s=s.sibling}a&4&&(a=t.updateQueue,a!==null&&(r=a.retryQueue,r!==null&&(a.retryQueue=null,da(t,r))));break;case 19:Nt(s,t),Ht(t),a&4&&(a=t.updateQueue,a!==null&&(t.updateQueue=null,da(t,a)));break;case 30:break;case 21:break;default:Nt(s,t),Ht(t)}}function Ht(t){var s=t.flags;if(s&2){try{for(var r,a=t.return;a!==null;){if(Up(a)){r=a;break}a=a.return}if(r==null)throw Error(l(160));switch(r.tag){case 27:var c=r.stateNode,u=Gc(t);ua(t,u,c);break;case 5:var m=r.stateNode;r.flags&32&&(vr(m,""),r.flags&=-33);var v=Gc(t);ua(t,v,m);break;case 3:case 4:var w=r.stateNode.containerInfo,N=Gc(t);Xc(t,N,w);break;default:throw Error(l(161))}}catch(q){Oe(t,t.return,q)}t.flags&=-3}s&4096&&(t.flags&=-4097)}function Gp(t){if(t.subtreeFlags&1024)for(t=t.child;t!==null;){var s=t;Gp(s),s.tag===5&&s.flags&1024&&s.stateNode.reset(),t=t.sibling}}function Vi(t,s){if(s.subtreeFlags&8772)for(s=s.child;s!==null;)Pp(t,s.alternate,s),s=s.sibling}function Js(t){for(t=t.child;t!==null;){var s=t;switch(s.tag){case 0:case 11:case 14:case 15:vs(4,s,s.return),Js(s);break;case 1:Ti(s,s.return);var r=s.stateNode;typeof r.componentWillUnmount=="function"&&Np(s,s.return,r),Js(s);break;case 27:In(s.stateNode);case 26:case 5:Ti(s,s.return),Js(s);break;case 22:s.memoizedState===null&&Js(s);break;case 30:Js(s);break;default:Js(s)}t=t.sibling}}function Zi(t,s,r){for(r=r&&(s.subtreeFlags&8772)!==0,s=s.child;s!==null;){var a=s.alternate,c=t,u=s,m=u.flags;switch(u.tag){case 0:case 11:case 15:Zi(c,u,r),An(4,u);break;case 1:if(Zi(c,u,r),a=u,c=a.stateNode,typeof c.componentDidMount=="function")try{c.componentDidMount()}catch(N){Oe(a,a.return,N)}if(a=u,c=a.updateQueue,c!==null){var v=a.stateNode;try{var w=c.shared.hiddenCallbacks;if(w!==null)for(c.shared.hiddenCallbacks=null,c=0;c<w.length;c++)kf(w[c],v)}catch(N){Oe(a,a.return,N)}}r&&m&64&&jp(u),On(u,u.return);break;case 27:Wp(u);case 26:case 5:Zi(c,u,r),r&&a===null&&m&4&&Hp(u),On(u,u.return);break;case 12:Zi(c,u,r);break;case 31:Zi(c,u,r),r&&m&4&&Kp(c,u);break;case 13:Zi(c,u,r),r&&m&4&&Yp(c,u);break;case 22:u.memoizedState===null&&Zi(c,u,r),On(u,u.return);break;case 30:break;default:Zi(c,u,r)}s=s.sibling}}function Zc(t,s){var r=null;t!==null&&t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(r=t.memoizedState.cachePool.pool),t=null,s.memoizedState!==null&&s.memoizedState.cachePool!==null&&(t=s.memoizedState.cachePool.pool),t!==r&&(t!=null&&t.refCount++,r!=null&&Sn(r))}function Qc(t,s){t=null,s.alternate!==null&&(t=s.alternate.memoizedState.cache),s=s.memoizedState.cache,s!==t&&(s.refCount++,t!=null&&Sn(t))}function Si(t,s,r,a){if(s.subtreeFlags&10256)for(s=s.child;s!==null;)Xp(t,s,r,a),s=s.sibling}function Xp(t,s,r,a){var c=s.flags;switch(s.tag){case 0:case 11:case 15:Si(t,s,r,a),c&2048&&An(9,s);break;case 1:Si(t,s,r,a);break;case 3:Si(t,s,r,a),c&2048&&(t=null,s.alternate!==null&&(t=s.alternate.memoizedState.cache),s=s.memoizedState.cache,s!==t&&(s.refCount++,t!=null&&Sn(t)));break;case 12:if(c&2048){Si(t,s,r,a),t=s.stateNode;try{var u=s.memoizedProps,m=u.id,v=u.onPostCommit;typeof v=="function"&&v(m,s.alternate===null?"mount":"update",t.passiveEffectDuration,-0)}catch(w){Oe(s,s.return,w)}}else Si(t,s,r,a);break;case 31:Si(t,s,r,a);break;case 13:Si(t,s,r,a);break;case 23:break;case 22:u=s.stateNode,m=s.alternate,s.memoizedState!==null?u._visibility&2?Si(t,s,r,a):Ln(t,s):u._visibility&2?Si(t,s,r,a):(u._visibility|=2,Hr(t,s,r,a,(s.subtreeFlags&10256)!==0||!1)),c&2048&&Zc(m,s);break;case 24:Si(t,s,r,a),c&2048&&Qc(s.alternate,s);break;default:Si(t,s,r,a)}}function Hr(t,s,r,a,c){for(c=c&&((s.subtreeFlags&10256)!==0||!1),s=s.child;s!==null;){var u=t,m=s,v=r,w=a,N=m.flags;switch(m.tag){case 0:case 11:case 15:Hr(u,m,v,w,c),An(8,m);break;case 23:break;case 22:var q=m.stateNode;m.memoizedState!==null?q._visibility&2?Hr(u,m,v,w,c):Ln(u,m):(q._visibility|=2,Hr(u,m,v,w,c)),c&&N&2048&&Zc(m.alternate,m);break;case 24:Hr(u,m,v,w,c),c&&N&2048&&Qc(m.alternate,m);break;default:Hr(u,m,v,w,c)}s=s.sibling}}function Ln(t,s){if(s.subtreeFlags&10256)for(s=s.child;s!==null;){var r=t,a=s,c=a.flags;switch(a.tag){case 22:Ln(r,a),c&2048&&Zc(a.alternate,a);break;case 24:Ln(r,a),c&2048&&Qc(a.alternate,a);break;default:Ln(r,a)}s=s.sibling}}var jn=8192;function Ur(t,s,r){if(t.subtreeFlags&jn)for(t=t.child;t!==null;)Vp(t,s,r),t=t.sibling}function Vp(t,s,r){switch(t.tag){case 26:Ur(t,s,r),t.flags&jn&&t.memoizedState!==null&&Zy(r,yi,t.memoizedState,t.memoizedProps);break;case 5:Ur(t,s,r);break;case 3:case 4:var a=yi;yi=Ea(t.stateNode.containerInfo),Ur(t,s,r),yi=a;break;case 22:t.memoizedState===null&&(a=t.alternate,a!==null&&a.memoizedState!==null?(a=jn,jn=16777216,Ur(t,s,r),jn=a):Ur(t,s,r));break;default:Ur(t,s,r)}}function Zp(t){var s=t.alternate;if(s!==null&&(t=s.child,t!==null)){s.child=null;do s=t.sibling,t.sibling=null,t=s;while(t!==null)}}function Nn(t){var s=t.deletions;if((t.flags&16)!==0){if(s!==null)for(var r=0;r<s.length;r++){var a=s[r];pt=a,Jp(a,t)}Zp(t)}if(t.subtreeFlags&10256)for(t=t.child;t!==null;)Qp(t),t=t.sibling}function Qp(t){switch(t.tag){case 0:case 11:case 15:Nn(t),t.flags&2048&&vs(9,t,t.return);break;case 3:Nn(t);break;case 12:Nn(t);break;case 22:var s=t.stateNode;t.memoizedState!==null&&s._visibility&2&&(t.return===null||t.return.tag!==13)?(s._visibility&=-3,fa(t)):Nn(t);break;default:Nn(t)}}function fa(t){var s=t.deletions;if((t.flags&16)!==0){if(s!==null)for(var r=0;r<s.length;r++){var a=s[r];pt=a,Jp(a,t)}Zp(t)}for(t=t.child;t!==null;){switch(s=t,s.tag){case 0:case 11:case 15:vs(8,s,s.return),fa(s);break;case 22:r=s.stateNode,r._visibility&2&&(r._visibility&=-3,fa(s));break;default:fa(s)}t=t.sibling}}function Jp(t,s){for(;pt!==null;){var r=pt;switch(r.tag){case 0:case 11:case 15:vs(8,r,s);break;case 23:case 22:if(r.memoizedState!==null&&r.memoizedState.cachePool!==null){var a=r.memoizedState.cachePool.pool;a!=null&&a.refCount++}break;case 24:Sn(r.memoizedState.cache)}if(a=r.child,a!==null)a.return=r,pt=a;else e:for(r=t;pt!==null;){a=pt;var c=a.sibling,u=a.return;if(Ip(a),a===r){pt=null;break e}if(c!==null){c.return=u,pt=c;break e}pt=u}}}var dy={getCacheForType:function(t){var s=xt(it),r=s.data.get(t);return r===void 0&&(r=t(),s.data.set(t,r)),r},cacheSignal:function(){return xt(it).controller.signal}},fy=typeof WeakMap=="function"?WeakMap:Map,Me=0,We=null,xe=null,Ce=0,Ae=0,Xt=null,ys=!1,Wr=!1,Jc=!1,Qi=0,Ve=0,Ss=0,er=0,eh=0,Vt=0,qr=0,Hn=null,Ut=null,th=!1,pa=0,e_=0,_a=1/0,ga=null,bs=null,ct=0,xs=null,Pr=null,Ji=0,ih=0,sh=null,t_=null,Un=0,rh=null;function Zt(){return(Me&2)!==0&&Ce!==0?Ce&-Ce:R.T!==null?hh():gd()}function i_(){if(Vt===0)if((Ce&536870912)===0||Ee){var t=Cl;Cl<<=1,(Cl&3932160)===0&&(Cl=262144),Vt=t}else Vt=536870912;return t=Ft.current,t!==null&&(t.flags|=32),Vt}function Wt(t,s,r){(t===We&&(Ae===2||Ae===9)||t.cancelPendingCommit!==null)&&(Ir(t,0),ws(t,Ce,Vt,!1)),ln(t,r),((Me&2)===0||t!==We)&&(t===We&&((Me&2)===0&&(er|=r),Ve===4&&ws(t,Ce,Vt,!1)),Ri(t))}function s_(t,s,r){if((Me&6)!==0)throw Error(l(327));var a=!r&&(s&127)===0&&(s&t.expiredLanes)===0||nn(t,s),c=a?gy(t,s):lh(t,s,!0),u=a;do{if(c===0){Wr&&!a&&ws(t,s,0,!1);break}else{if(r=t.current.alternate,u&&!py(r)){c=lh(t,s,!1),u=!1;continue}if(c===2){if(u=s,t.errorRecoveryDisabledLanes&u)var m=0;else m=t.pendingLanes&-536870913,m=m!==0?m:m&536870912?536870912:0;if(m!==0){s=m;e:{var v=t;c=Hn;var w=v.current.memoizedState.isDehydrated;if(w&&(Ir(v,m).flags|=256),m=lh(v,m,!1),m!==2){if(Jc&&!w){v.errorRecoveryDisabledLanes|=u,er|=u,c=4;break e}u=Ut,Ut=c,u!==null&&(Ut===null?Ut=u:Ut.push.apply(Ut,u))}c=m}if(u=!1,c!==2)continue}}if(c===1){Ir(t,0),ws(t,s,0,!0);break}e:{switch(a=t,u=c,u){case 0:case 1:throw Error(l(345));case 4:if((s&4194048)!==s)break;case 6:ws(a,s,Vt,!ys);break e;case 2:Ut=null;break;case 3:case 5:break;default:throw Error(l(329))}if((s&62914560)===s&&(c=pa+300-Pt(),10<c)){if(ws(a,s,Vt,!ys),El(a,0,!0)!==0)break e;Ji=s,a.timeoutHandle=O_(r_.bind(null,a,r,Ut,ga,th,s,Vt,er,qr,ys,u,"Throttled",-0,0),c);break e}r_(a,r,Ut,ga,th,s,Vt,er,qr,ys,u,null,-0,0)}}break}while(!0);Ri(t)}function r_(t,s,r,a,c,u,m,v,w,N,q,Y,U,W){if(t.timeoutHandle=-1,Y=s.subtreeFlags,Y&8192||(Y&16785408)===16785408){Y={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:Hi},Vp(s,u,Y);var re=(u&62914560)===u?pa-Pt():(u&4194048)===u?e_-Pt():0;if(re=Qy(Y,re),re!==null){Ji=u,t.cancelPendingCommit=re(d_.bind(null,t,s,u,r,a,c,m,v,w,q,Y,null,U,W)),ws(t,u,m,!N);return}}d_(t,s,u,r,a,c,m,v,w)}function py(t){for(var s=t;;){var r=s.tag;if((r===0||r===11||r===15)&&s.flags&16384&&(r=s.updateQueue,r!==null&&(r=r.stores,r!==null)))for(var a=0;a<r.length;a++){var c=r[a],u=c.getSnapshot;c=c.value;try{if(!Kt(u(),c))return!1}catch{return!1}}if(r=s.child,s.subtreeFlags&16384&&r!==null)r.return=s,s=r;else{if(s===t)break;for(;s.sibling===null;){if(s.return===null||s.return===t)return!0;s=s.return}s.sibling.return=s.return,s=s.sibling}}return!0}function ws(t,s,r,a){s&=~eh,s&=~er,t.suspendedLanes|=s,t.pingedLanes&=~s,a&&(t.warmLanes|=s),a=t.expirationTimes;for(var c=s;0<c;){var u=31-$t(c),m=1<<u;a[u]=-1,c&=~m}r!==0&&fd(t,r,s)}function ma(){return(Me&6)===0?(Wn(0),!1):!0}function nh(){if(xe!==null){if(Ae===0)var t=xe.return;else t=xe,Pi=Ks=null,bc(t),Ar=null,xn=0,t=xe;for(;t!==null;)Lp(t.alternate,t),t=t.return;xe=null}}function Ir(t,s){var r=t.timeoutHandle;r!==-1&&(t.timeoutHandle=-1,Oy(r)),r=t.cancelPendingCommit,r!==null&&(t.cancelPendingCommit=null,r()),Ji=0,nh(),We=t,xe=r=Wi(t.current,null),Ce=s,Ae=0,Xt=null,ys=!1,Wr=nn(t,s),Jc=!1,qr=Vt=eh=er=Ss=Ve=0,Ut=Hn=null,th=!1,(s&8)!==0&&(s|=s&32);var a=t.entangledLanes;if(a!==0)for(t=t.entanglements,a&=s;0<a;){var c=31-$t(a),u=1<<c;s|=t[c],a&=~u}return Qi=s,Hl(),r}function n_(t,s){me=null,R.H=Bn,s===zr||s===Yl?(s=bf(),Ae=3):s===cc?(s=bf(),Ae=4):Ae=s===Nc?8:s!==null&&typeof s=="object"&&typeof s.then=="function"?6:1,Xt=s,xe===null&&(Ve=1,la(t,ni(s,t.current)))}function l_(){var t=Ft.current;return t===null?!0:(Ce&4194048)===Ce?ci===null:(Ce&62914560)===Ce||(Ce&536870912)!==0?t===ci:!1}function a_(){var t=R.H;return R.H=Bn,t===null?Bn:t}function o_(){var t=R.A;return R.A=dy,t}function va(){Ve=4,ys||(Ce&4194048)!==Ce&&Ft.current!==null||(Wr=!0),(Ss&134217727)===0&&(er&134217727)===0||We===null||ws(We,Ce,Vt,!1)}function lh(t,s,r){var a=Me;Me|=2;var c=a_(),u=o_();(We!==t||Ce!==s)&&(ga=null,Ir(t,s)),s=!1;var m=Ve;e:do try{if(Ae!==0&&xe!==null){var v=xe,w=Xt;switch(Ae){case 8:nh(),m=6;break e;case 3:case 2:case 9:case 6:Ft.current===null&&(s=!0);var N=Ae;if(Ae=0,Xt=null,$r(t,v,w,N),r&&Wr){m=0;break e}break;default:N=Ae,Ae=0,Xt=null,$r(t,v,w,N)}}_y(),m=Ve;break}catch(q){n_(t,q)}while(!0);return s&&t.shellSuspendCounter++,Pi=Ks=null,Me=a,R.H=c,R.A=u,xe===null&&(We=null,Ce=0,Hl()),m}function _y(){for(;xe!==null;)c_(xe)}function gy(t,s){var r=Me;Me|=2;var a=a_(),c=o_();We!==t||Ce!==s?(ga=null,_a=Pt()+500,Ir(t,s)):Wr=nn(t,s);e:do try{if(Ae!==0&&xe!==null){s=xe;var u=Xt;t:switch(Ae){case 1:Ae=0,Xt=null,$r(t,s,u,1);break;case 2:case 9:if(yf(u)){Ae=0,Xt=null,h_(s);break}s=function(){Ae!==2&&Ae!==9||We!==t||(Ae=7),Ri(t)},u.then(s,s);break e;case 3:Ae=7;break e;case 4:Ae=5;break e;case 7:yf(u)?(Ae=0,Xt=null,h_(s)):(Ae=0,Xt=null,$r(t,s,u,7));break;case 5:var m=null;switch(xe.tag){case 26:m=xe.memoizedState;case 5:case 27:var v=xe;if(m?X_(m):v.stateNode.complete){Ae=0,Xt=null;var w=v.sibling;if(w!==null)xe=w;else{var N=v.return;N!==null?(xe=N,ya(N)):xe=null}break t}}Ae=0,Xt=null,$r(t,s,u,5);break;case 6:Ae=0,Xt=null,$r(t,s,u,6);break;case 8:nh(),Ve=6;break e;default:throw Error(l(462))}}my();break}catch(q){n_(t,q)}while(!0);return Pi=Ks=null,R.H=a,R.A=c,Me=r,xe!==null?0:(We=null,Ce=0,Hl(),Ve)}function my(){for(;xe!==null&&!Wv();)c_(xe)}function c_(t){var s=Ap(t.alternate,t,Qi);t.memoizedProps=t.pendingProps,s===null?ya(t):xe=s}function h_(t){var s=t,r=s.alternate;switch(s.tag){case 15:case 0:s=Tp(r,s,s.pendingProps,s.type,void 0,Ce);break;case 11:s=Tp(r,s,s.pendingProps,s.type.render,s.ref,Ce);break;case 5:bc(s);default:Lp(r,s),s=xe=of(s,Qi),s=Ap(r,s,Qi)}t.memoizedProps=t.pendingProps,s===null?ya(t):xe=s}function $r(t,s,r,a){Pi=Ks=null,bc(s),Ar=null,xn=0;var c=s.return;try{if(ny(t,c,s,r,Ce)){Ve=1,la(t,ni(r,t.current)),xe=null;return}}catch(u){if(c!==null)throw xe=c,u;Ve=1,la(t,ni(r,t.current)),xe=null;return}s.flags&32768?(Ee||a===1?t=!0:Wr||(Ce&536870912)!==0?t=!1:(ys=t=!0,(a===2||a===9||a===3||a===6)&&(a=Ft.current,a!==null&&a.tag===13&&(a.flags|=16384))),u_(s,t)):ya(s)}function ya(t){var s=t;do{if((s.flags&32768)!==0){u_(s,ys);return}t=s.return;var r=oy(s.alternate,s,Qi);if(r!==null){xe=r;return}if(s=s.sibling,s!==null){xe=s;return}xe=s=t}while(s!==null);Ve===0&&(Ve=5)}function u_(t,s){do{var r=cy(t.alternate,t);if(r!==null){r.flags&=32767,xe=r;return}if(r=t.return,r!==null&&(r.flags|=32768,r.subtreeFlags=0,r.deletions=null),!s&&(t=t.sibling,t!==null)){xe=t;return}xe=t=r}while(t!==null);Ve=6,xe=null}function d_(t,s,r,a,c,u,m,v,w){t.cancelPendingCommit=null;do Sa();while(ct!==0);if((Me&6)!==0)throw Error(l(327));if(s!==null){if(s===t.current)throw Error(l(177));if(u=s.lanes|s.childLanes,u|=Go,Vv(t,r,u,m,v,w),t===We&&(xe=We=null,Ce=0),Pr=s,xs=t,Ji=r,ih=u,sh=c,t_=a,(s.subtreeFlags&10256)!==0||(s.flags&10256)!==0?(t.callbackNode=null,t.callbackPriority=0,by(xl,function(){return m_(),null})):(t.callbackNode=null,t.callbackPriority=0),a=(s.flags&13878)!==0,(s.subtreeFlags&13878)!==0||a){a=R.T,R.T=null,c=I.p,I.p=2,m=Me,Me|=4;try{hy(t,s,r)}finally{Me=m,I.p=c,R.T=a}}ct=1,f_(),p_(),__()}}function f_(){if(ct===1){ct=0;var t=xs,s=Pr,r=(s.flags&13878)!==0;if((s.subtreeFlags&13878)!==0||r){r=R.T,R.T=null;var a=I.p;I.p=2;var c=Me;Me|=4;try{Fp(s,t);var u=vh,m=Qd(t.containerInfo),v=u.focusedElem,w=u.selectionRange;if(m!==v&&v&&v.ownerDocument&&Zd(v.ownerDocument.documentElement,v)){if(w!==null&&Io(v)){var N=w.start,q=w.end;if(q===void 0&&(q=N),"selectionStart"in v)v.selectionStart=N,v.selectionEnd=Math.min(q,v.value.length);else{var Y=v.ownerDocument||document,U=Y&&Y.defaultView||window;if(U.getSelection){var W=U.getSelection(),re=v.textContent.length,ce=Math.min(w.start,re),He=w.end===void 0?ce:Math.min(w.end,re);!W.extend&&ce>He&&(m=He,He=ce,ce=m);var B=Vd(v,ce),E=Vd(v,He);if(B&&E&&(W.rangeCount!==1||W.anchorNode!==B.node||W.anchorOffset!==B.offset||W.focusNode!==E.node||W.focusOffset!==E.offset)){var j=Y.createRange();j.setStart(B.node,B.offset),W.removeAllRanges(),ce>He?(W.addRange(j),W.extend(E.node,E.offset)):(j.setEnd(E.node,E.offset),W.addRange(j))}}}}for(Y=[],W=v;W=W.parentNode;)W.nodeType===1&&Y.push({element:W,left:W.scrollLeft,top:W.scrollTop});for(typeof v.focus=="function"&&v.focus(),v=0;v<Y.length;v++){var $=Y[v];$.element.scrollLeft=$.left,$.element.scrollTop=$.top}}za=!!mh,vh=mh=null}finally{Me=c,I.p=a,R.T=r}}t.current=s,ct=2}}function p_(){if(ct===2){ct=0;var t=xs,s=Pr,r=(s.flags&8772)!==0;if((s.subtreeFlags&8772)!==0||r){r=R.T,R.T=null;var a=I.p;I.p=2;var c=Me;Me|=4;try{Pp(t,s.alternate,s)}finally{Me=c,I.p=a,R.T=r}}ct=3}}function __(){if(ct===4||ct===3){ct=0,qv();var t=xs,s=Pr,r=Ji,a=t_;(s.subtreeFlags&10256)!==0||(s.flags&10256)!==0?ct=5:(ct=0,Pr=xs=null,g_(t,t.pendingLanes));var c=t.pendingLanes;if(c===0&&(bs=null),Co(r),s=s.stateNode,It&&typeof It.onCommitFiberRoot=="function")try{It.onCommitFiberRoot(rn,s,void 0,(s.current.flags&128)===128)}catch{}if(a!==null){s=R.T,c=I.p,I.p=2,R.T=null;try{for(var u=t.onRecoverableError,m=0;m<a.length;m++){var v=a[m];u(v.value,{componentStack:v.stack})}}finally{R.T=s,I.p=c}}(Ji&3)!==0&&Sa(),Ri(t),c=t.pendingLanes,(r&261930)!==0&&(c&42)!==0?t===rh?Un++:(Un=0,rh=t):Un=0,Wn(0)}}function g_(t,s){(t.pooledCacheLanes&=s)===0&&(s=t.pooledCache,s!=null&&(t.pooledCache=null,Sn(s)))}function Sa(){return f_(),p_(),__(),m_()}function m_(){if(ct!==5)return!1;var t=xs,s=ih;ih=0;var r=Co(Ji),a=R.T,c=I.p;try{I.p=32>r?32:r,R.T=null,r=sh,sh=null;var u=xs,m=Ji;if(ct=0,Pr=xs=null,Ji=0,(Me&6)!==0)throw Error(l(331));var v=Me;if(Me|=4,Qp(u.current),Xp(u,u.current,m,r),Me=v,Wn(0,!1),It&&typeof It.onPostCommitFiberRoot=="function")try{It.onPostCommitFiberRoot(rn,u)}catch{}return!0}finally{I.p=c,R.T=a,g_(t,s)}}function v_(t,s,r){s=ni(r,s),s=jc(t.stateNode,s,2),t=_s(t,s,2),t!==null&&(ln(t,2),Ri(t))}function Oe(t,s,r){if(t.tag===3)v_(t,t,r);else for(;s!==null;){if(s.tag===3){v_(s,t,r);break}else if(s.tag===1){var a=s.stateNode;if(typeof s.type.getDerivedStateFromError=="function"||typeof a.componentDidCatch=="function"&&(bs===null||!bs.has(a))){t=ni(r,t),r=yp(2),a=_s(s,r,2),a!==null&&(Sp(r,a,s,t),ln(a,2),Ri(a));break}}s=s.return}}function ah(t,s,r){var a=t.pingCache;if(a===null){a=t.pingCache=new fy;var c=new Set;a.set(s,c)}else c=a.get(s),c===void 0&&(c=new Set,a.set(s,c));c.has(r)||(Jc=!0,c.add(r),t=vy.bind(null,t,s,r),s.then(t,t))}function vy(t,s,r){var a=t.pingCache;a!==null&&a.delete(s),t.pingedLanes|=t.suspendedLanes&r,t.warmLanes&=~r,We===t&&(Ce&r)===r&&(Ve===4||Ve===3&&(Ce&62914560)===Ce&&300>Pt()-pa?(Me&2)===0&&Ir(t,0):eh|=r,qr===Ce&&(qr=0)),Ri(t)}function y_(t,s){s===0&&(s=dd()),t=Ps(t,s),t!==null&&(ln(t,s),Ri(t))}function yy(t){var s=t.memoizedState,r=0;s!==null&&(r=s.retryLane),y_(t,r)}function Sy(t,s){var r=0;switch(t.tag){case 31:case 13:var a=t.stateNode,c=t.memoizedState;c!==null&&(r=c.retryLane);break;case 19:a=t.stateNode;break;case 22:a=t.stateNode._retryCache;break;default:throw Error(l(314))}a!==null&&a.delete(s),y_(t,r)}function by(t,s){return So(t,s)}var ba=null,Kr=null,oh=!1,xa=!1,ch=!1,Cs=0;function Ri(t){t!==Kr&&t.next===null&&(Kr===null?ba=Kr=t:Kr=Kr.next=t),xa=!0,oh||(oh=!0,wy())}function Wn(t,s){if(!ch&&xa){ch=!0;do for(var r=!1,a=ba;a!==null;){if(t!==0){var c=a.pendingLanes;if(c===0)var u=0;else{var m=a.suspendedLanes,v=a.pingedLanes;u=(1<<31-$t(42|t)+1)-1,u&=c&~(m&~v),u=u&201326741?u&201326741|1:u?u|2:0}u!==0&&(r=!0,w_(a,u))}else u=Ce,u=El(a,a===We?u:0,a.cancelPendingCommit!==null||a.timeoutHandle!==-1),(u&3)===0||nn(a,u)||(r=!0,w_(a,u));a=a.next}while(r);ch=!1}}function xy(){S_()}function S_(){xa=oh=!1;var t=0;Cs!==0&&Ay()&&(t=Cs);for(var s=Pt(),r=null,a=ba;a!==null;){var c=a.next,u=b_(a,s);u===0?(a.next=null,r===null?ba=c:r.next=c,c===null&&(Kr=r)):(r=a,(t!==0||(u&3)!==0)&&(xa=!0)),a=c}ct!==0&&ct!==5||Wn(t),Cs!==0&&(Cs=0)}function b_(t,s){for(var r=t.suspendedLanes,a=t.pingedLanes,c=t.expirationTimes,u=t.pendingLanes&-62914561;0<u;){var m=31-$t(u),v=1<<m,w=c[m];w===-1?((v&r)===0||(v&a)!==0)&&(c[m]=Xv(v,s)):w<=s&&(t.expiredLanes|=v),u&=~v}if(s=We,r=Ce,r=El(t,t===s?r:0,t.cancelPendingCommit!==null||t.timeoutHandle!==-1),a=t.callbackNode,r===0||t===s&&(Ae===2||Ae===9)||t.cancelPendingCommit!==null)return a!==null&&a!==null&&bo(a),t.callbackNode=null,t.callbackPriority=0;if((r&3)===0||nn(t,r)){if(s=r&-r,s===t.callbackPriority)return s;switch(a!==null&&bo(a),Co(r)){case 2:case 8:r=hd;break;case 32:r=xl;break;case 268435456:r=ud;break;default:r=xl}return a=x_.bind(null,t),r=So(r,a),t.callbackPriority=s,t.callbackNode=r,s}return a!==null&&a!==null&&bo(a),t.callbackPriority=2,t.callbackNode=null,2}function x_(t,s){if(ct!==0&&ct!==5)return t.callbackNode=null,t.callbackPriority=0,null;var r=t.callbackNode;if(Sa()&&t.callbackNode!==r)return null;var a=Ce;return a=El(t,t===We?a:0,t.cancelPendingCommit!==null||t.timeoutHandle!==-1),a===0?null:(s_(t,a,s),b_(t,Pt()),t.callbackNode!=null&&t.callbackNode===r?x_.bind(null,t):null)}function w_(t,s){if(Sa())return null;s_(t,s,!0)}function wy(){Ly(function(){(Me&6)!==0?So(cd,xy):S_()})}function hh(){if(Cs===0){var t=Br;t===0&&(t=wl,wl<<=1,(wl&261888)===0&&(wl=256)),Cs=t}return Cs}function C_(t){return t==null||typeof t=="symbol"||typeof t=="boolean"?null:typeof t=="function"?t:Bl(""+t)}function k_(t,s){var r=s.ownerDocument.createElement("input");return r.name=s.name,r.value=s.value,t.id&&r.setAttribute("form",t.id),s.parentNode.insertBefore(r,s),t=new FormData(t),r.parentNode.removeChild(r),t}function Cy(t,s,r,a,c){if(s==="submit"&&r&&r.stateNode===c){var u=C_((c[Ot]||null).action),m=a.submitter;m&&(s=(s=m[Ot]||null)?C_(s.formAction):m.getAttribute("formAction"),s!==null&&(u=s,m=null));var v=new Ol("action","action",null,a,c);t.push({event:v,listeners:[{instance:null,listener:function(){if(a.defaultPrevented){if(Cs!==0){var w=m?k_(c,m):new FormData(c);Bc(r,{pending:!0,data:w,method:c.method,action:u},null,w)}}else typeof u=="function"&&(v.preventDefault(),w=m?k_(c,m):new FormData(c),Bc(r,{pending:!0,data:w,method:c.method,action:u},u,w))},currentTarget:c}]})}}for(var uh=0;uh<Fo.length;uh++){var dh=Fo[uh],ky=dh.toLowerCase(),Ey=dh[0].toUpperCase()+dh.slice(1);vi(ky,"on"+Ey)}vi(tf,"onAnimationEnd"),vi(sf,"onAnimationIteration"),vi(rf,"onAnimationStart"),vi("dblclick","onDoubleClick"),vi("focusin","onFocus"),vi("focusout","onBlur"),vi(P0,"onTransitionRun"),vi(I0,"onTransitionStart"),vi($0,"onTransitionCancel"),vi(nf,"onTransitionEnd"),gr("onMouseEnter",["mouseout","mouseover"]),gr("onMouseLeave",["mouseout","mouseover"]),gr("onPointerEnter",["pointerout","pointerover"]),gr("onPointerLeave",["pointerout","pointerover"]),Hs("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),Hs("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),Hs("onBeforeInput",["compositionend","keypress","textInput","paste"]),Hs("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),Hs("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),Hs("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var qn="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(" "),Ty=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(qn));function E_(t,s){s=(s&4)!==0;for(var r=0;r<t.length;r++){var a=t[r],c=a.event;a=a.listeners;e:{var u=void 0;if(s)for(var m=a.length-1;0<=m;m--){var v=a[m],w=v.instance,N=v.currentTarget;if(v=v.listener,w!==u&&c.isPropagationStopped())break e;u=v,c.currentTarget=N;try{u(c)}catch(q){Nl(q)}c.currentTarget=null,u=w}else for(m=0;m<a.length;m++){if(v=a[m],w=v.instance,N=v.currentTarget,v=v.listener,w!==u&&c.isPropagationStopped())break e;u=v,c.currentTarget=N;try{u(c)}catch(q){Nl(q)}c.currentTarget=null,u=w}}}}function we(t,s){var r=s[ko];r===void 0&&(r=s[ko]=new Set);var a=t+"__bubble";r.has(a)||(T_(s,t,2,!1),r.add(a))}function fh(t,s,r){var a=0;s&&(a|=4),T_(r,t,a,s)}var wa="_reactListening"+Math.random().toString(36).slice(2);function ph(t){if(!t[wa]){t[wa]=!0,yd.forEach(function(r){r!=="selectionchange"&&(Ty.has(r)||fh(r,!1,t),fh(r,!0,t))});var s=t.nodeType===9?t:t.ownerDocument;s===null||s[wa]||(s[wa]=!0,fh("selectionchange",!1,s))}}function T_(t,s,r,a){switch(ig(s)){case 2:var c=tS;break;case 8:c=iS;break;default:c=Dh}r=c.bind(null,s,r,t),c=void 0,!Oo||s!=="touchstart"&&s!=="touchmove"&&s!=="wheel"||(c=!0),a?c!==void 0?t.addEventListener(s,r,{capture:!0,passive:c}):t.addEventListener(s,r,!0):c!==void 0?t.addEventListener(s,r,{passive:c}):t.addEventListener(s,r,!1)}function _h(t,s,r,a,c){var u=a;if((s&1)===0&&(s&2)===0&&a!==null)e:for(;;){if(a===null)return;var m=a.tag;if(m===3||m===4){var v=a.stateNode.containerInfo;if(v===c)break;if(m===4)for(m=a.return;m!==null;){var w=m.tag;if((w===3||w===4)&&m.stateNode.containerInfo===c)return;m=m.return}for(;v!==null;){if(m=fr(v),m===null)return;if(w=m.tag,w===5||w===6||w===26||w===27){a=u=m;continue e}v=v.parentNode}}a=a.return}Md(function(){var N=u,q=zo(r),Y=[];e:{var U=lf.get(t);if(U!==void 0){var W=Ol,re=t;switch(t){case"keypress":if(zl(r)===0)break e;case"keydown":case"keyup":W=S0;break;case"focusin":re="focus",W=Ho;break;case"focusout":re="blur",W=Ho;break;case"beforeblur":case"afterblur":W=Ho;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":W=Od;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":W=o0;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":W=w0;break;case tf:case sf:case rf:W=u0;break;case nf:W=k0;break;case"scroll":case"scrollend":W=l0;break;case"wheel":W=T0;break;case"copy":case"cut":case"paste":W=f0;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":W=jd;break;case"toggle":case"beforetoggle":W=D0}var ce=(s&4)!==0,He=!ce&&(t==="scroll"||t==="scrollend"),B=ce?U!==null?U+"Capture":null:U;ce=[];for(var E=N,j;E!==null;){var $=E;if(j=$.stateNode,$=$.tag,$!==5&&$!==26&&$!==27||j===null||B===null||($=cn(E,B),$!=null&&ce.push(Pn(E,$,j))),He)break;E=E.return}0<ce.length&&(U=new W(U,re,null,r,q),Y.push({event:U,listeners:ce}))}}if((s&7)===0){e:{if(U=t==="mouseover"||t==="pointerover",W=t==="mouseout"||t==="pointerout",U&&r!==Mo&&(re=r.relatedTarget||r.fromElement)&&(fr(re)||re[dr]))break e;if((W||U)&&(U=q.window===q?q:(U=q.ownerDocument)?U.defaultView||U.parentWindow:window,W?(re=r.relatedTarget||r.toElement,W=N,re=re?fr(re):null,re!==null&&(He=h(re),ce=re.tag,re!==He||ce!==5&&ce!==27&&ce!==6)&&(re=null)):(W=null,re=N),W!==re)){if(ce=Od,$="onMouseLeave",B="onMouseEnter",E="mouse",(t==="pointerout"||t==="pointerover")&&(ce=jd,$="onPointerLeave",B="onPointerEnter",E="pointer"),He=W==null?U:on(W),j=re==null?U:on(re),U=new ce($,E+"leave",W,r,q),U.target=He,U.relatedTarget=j,$=null,fr(q)===N&&(ce=new ce(B,E+"enter",re,r,q),ce.target=j,ce.relatedTarget=He,$=ce),He=$,W&&re)t:{for(ce=Ry,B=W,E=re,j=0,$=B;$;$=ce($))j++;$=0;for(var le=E;le;le=ce(le))$++;for(;0<j-$;)B=ce(B),j--;for(;0<$-j;)E=ce(E),$--;for(;j--;){if(B===E||E!==null&&B===E.alternate){ce=B;break t}B=ce(B),E=ce(E)}ce=null}else ce=null;W!==null&&R_(Y,U,W,ce,!1),re!==null&&He!==null&&R_(Y,He,re,ce,!0)}}e:{if(U=N?on(N):window,W=U.nodeName&&U.nodeName.toLowerCase(),W==="select"||W==="input"&&U.type==="file")var De=$d;else if(Pd(U))if(Kd)De=U0;else{De=N0;var ne=j0}else W=U.nodeName,!W||W.toLowerCase()!=="input"||U.type!=="checkbox"&&U.type!=="radio"?N&&Bo(N.elementType)&&(De=$d):De=H0;if(De&&(De=De(t,N))){Id(Y,De,r,q);break e}ne&&ne(t,U,N),t==="focusout"&&N&&U.type==="number"&&N.memoizedProps.value!=null&&Do(U,"number",U.value)}switch(ne=N?on(N):window,t){case"focusin":(Pd(ne)||ne.contentEditable==="true")&&(xr=ne,$o=N,mn=null);break;case"focusout":mn=$o=xr=null;break;case"mousedown":Ko=!0;break;case"contextmenu":case"mouseup":case"dragend":Ko=!1,Jd(Y,r,q);break;case"selectionchange":if(q0)break;case"keydown":case"keyup":Jd(Y,r,q)}var ve;if(Wo)e:{switch(t){case"compositionstart":var ke="onCompositionStart";break e;case"compositionend":ke="onCompositionEnd";break e;case"compositionupdate":ke="onCompositionUpdate";break e}ke=void 0}else br?Wd(t,r)&&(ke="onCompositionEnd"):t==="keydown"&&r.keyCode===229&&(ke="onCompositionStart");ke&&(Nd&&r.locale!=="ko"&&(br||ke!=="onCompositionStart"?ke==="onCompositionEnd"&&br&&(ve=zd()):(os=q,Lo="value"in os?os.value:os.textContent,br=!0)),ne=Ca(N,ke),0<ne.length&&(ke=new Ld(ke,t,null,r,q),Y.push({event:ke,listeners:ne}),ve?ke.data=ve:(ve=qd(r),ve!==null&&(ke.data=ve)))),(ve=M0?z0(t,r):A0(t,r))&&(ke=Ca(N,"onBeforeInput"),0<ke.length&&(ne=new Ld("onBeforeInput","beforeinput",null,r,q),Y.push({event:ne,listeners:ke}),ne.data=ve)),Cy(Y,t,N,r,q)}E_(Y,s)})}function Pn(t,s,r){return{instance:t,listener:s,currentTarget:r}}function Ca(t,s){for(var r=s+"Capture",a=[];t!==null;){var c=t,u=c.stateNode;if(c=c.tag,c!==5&&c!==26&&c!==27||u===null||(c=cn(t,r),c!=null&&a.unshift(Pn(t,c,u)),c=cn(t,s),c!=null&&a.push(Pn(t,c,u))),t.tag===3)return a;t=t.return}return[]}function Ry(t){if(t===null)return null;do t=t.return;while(t&&t.tag!==5&&t.tag!==27);return t||null}function R_(t,s,r,a,c){for(var u=s._reactName,m=[];r!==null&&r!==a;){var v=r,w=v.alternate,N=v.stateNode;if(v=v.tag,w!==null&&w===a)break;v!==5&&v!==26&&v!==27||N===null||(w=N,c?(N=cn(r,u),N!=null&&m.unshift(Pn(r,N,w))):c||(N=cn(r,u),N!=null&&m.push(Pn(r,N,w)))),r=r.return}m.length!==0&&t.push({event:s,listeners:m})}var Dy=/\r\n?/g,By=/\u0000|\uFFFD/g;function D_(t){return(typeof t=="string"?t:""+t).replace(Dy,`
|
|
9
|
-
`).replace(By,"")}function B_(t,s){return s=D_(s),D_(t)===s}function Ne(t,s,r,a,c,u){switch(r){case"children":typeof a=="string"?s==="body"||s==="textarea"&&a===""||vr(t,a):(typeof a=="number"||typeof a=="bigint")&&s!=="body"&&vr(t,""+a);break;case"className":Rl(t,"class",a);break;case"tabIndex":Rl(t,"tabindex",a);break;case"dir":case"role":case"viewBox":case"width":case"height":Rl(t,r,a);break;case"style":Dd(t,a,u);break;case"data":if(s!=="object"){Rl(t,"data",a);break}case"src":case"href":if(a===""&&(s!=="a"||r!=="href")){t.removeAttribute(r);break}if(a==null||typeof a=="function"||typeof a=="symbol"||typeof a=="boolean"){t.removeAttribute(r);break}a=Bl(""+a),t.setAttribute(r,a);break;case"action":case"formAction":if(typeof a=="function"){t.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 u=="function"&&(r==="formAction"?(s!=="input"&&Ne(t,s,"name",c.name,c,null),Ne(t,s,"formEncType",c.formEncType,c,null),Ne(t,s,"formMethod",c.formMethod,c,null),Ne(t,s,"formTarget",c.formTarget,c,null)):(Ne(t,s,"encType",c.encType,c,null),Ne(t,s,"method",c.method,c,null),Ne(t,s,"target",c.target,c,null)));if(a==null||typeof a=="symbol"||typeof a=="boolean"){t.removeAttribute(r);break}a=Bl(""+a),t.setAttribute(r,a);break;case"onClick":a!=null&&(t.onclick=Hi);break;case"onScroll":a!=null&&we("scroll",t);break;case"onScrollEnd":a!=null&&we("scrollend",t);break;case"dangerouslySetInnerHTML":if(a!=null){if(typeof a!="object"||!("__html"in a))throw Error(l(61));if(r=a.__html,r!=null){if(c.children!=null)throw Error(l(60));t.innerHTML=r}}break;case"multiple":t.multiple=a&&typeof a!="function"&&typeof a!="symbol";break;case"muted":t.muted=a&&typeof a!="function"&&typeof a!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(a==null||typeof a=="function"||typeof a=="boolean"||typeof a=="symbol"){t.removeAttribute("xlink:href");break}r=Bl(""+a),t.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":a!=null&&typeof a!="function"&&typeof a!="symbol"?t.setAttribute(r,""+a):t.removeAttribute(r);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":a&&typeof a!="function"&&typeof a!="symbol"?t.setAttribute(r,""):t.removeAttribute(r);break;case"capture":case"download":a===!0?t.setAttribute(r,""):a!==!1&&a!=null&&typeof a!="function"&&typeof a!="symbol"?t.setAttribute(r,a):t.removeAttribute(r);break;case"cols":case"rows":case"size":case"span":a!=null&&typeof a!="function"&&typeof a!="symbol"&&!isNaN(a)&&1<=a?t.setAttribute(r,a):t.removeAttribute(r);break;case"rowSpan":case"start":a==null||typeof a=="function"||typeof a=="symbol"||isNaN(a)?t.removeAttribute(r):t.setAttribute(r,a);break;case"popover":we("beforetoggle",t),we("toggle",t),Tl(t,"popover",a);break;case"xlinkActuate":Ni(t,"http://www.w3.org/1999/xlink","xlink:actuate",a);break;case"xlinkArcrole":Ni(t,"http://www.w3.org/1999/xlink","xlink:arcrole",a);break;case"xlinkRole":Ni(t,"http://www.w3.org/1999/xlink","xlink:role",a);break;case"xlinkShow":Ni(t,"http://www.w3.org/1999/xlink","xlink:show",a);break;case"xlinkTitle":Ni(t,"http://www.w3.org/1999/xlink","xlink:title",a);break;case"xlinkType":Ni(t,"http://www.w3.org/1999/xlink","xlink:type",a);break;case"xmlBase":Ni(t,"http://www.w3.org/XML/1998/namespace","xml:base",a);break;case"xmlLang":Ni(t,"http://www.w3.org/XML/1998/namespace","xml:lang",a);break;case"xmlSpace":Ni(t,"http://www.w3.org/XML/1998/namespace","xml:space",a);break;case"is":Tl(t,"is",a);break;case"innerText":case"textContent":break;default:(!(2<r.length)||r[0]!=="o"&&r[0]!=="O"||r[1]!=="n"&&r[1]!=="N")&&(r=r0.get(r)||r,Tl(t,r,a))}}function gh(t,s,r,a,c,u){switch(r){case"style":Dd(t,a,u);break;case"dangerouslySetInnerHTML":if(a!=null){if(typeof a!="object"||!("__html"in a))throw Error(l(61));if(r=a.__html,r!=null){if(c.children!=null)throw Error(l(60));t.innerHTML=r}}break;case"children":typeof a=="string"?vr(t,a):(typeof a=="number"||typeof a=="bigint")&&vr(t,""+a);break;case"onScroll":a!=null&&we("scroll",t);break;case"onScrollEnd":a!=null&&we("scrollend",t);break;case"onClick":a!=null&&(t.onclick=Hi);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!Sd.hasOwnProperty(r))e:{if(r[0]==="o"&&r[1]==="n"&&(c=r.endsWith("Capture"),s=r.slice(2,c?r.length-7:void 0),u=t[Ot]||null,u=u!=null?u[r]:null,typeof u=="function"&&t.removeEventListener(s,u,c),typeof a=="function")){typeof u!="function"&&u!==null&&(r in t?t[r]=null:t.hasAttribute(r)&&t.removeAttribute(r)),t.addEventListener(s,a,c);break e}r in t?t[r]=a:a===!0?t.setAttribute(r,""):Tl(t,r,a)}}}function Ct(t,s,r){switch(s){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":we("error",t),we("load",t);var a=!1,c=!1,u;for(u in r)if(r.hasOwnProperty(u)){var m=r[u];if(m!=null)switch(u){case"src":a=!0;break;case"srcSet":c=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(l(137,s));default:Ne(t,s,u,m,r,null)}}c&&Ne(t,s,"srcSet",r.srcSet,r,null),a&&Ne(t,s,"src",r.src,r,null);return;case"input":we("invalid",t);var v=u=m=c=null,w=null,N=null;for(a in r)if(r.hasOwnProperty(a)){var q=r[a];if(q!=null)switch(a){case"name":c=q;break;case"type":m=q;break;case"checked":w=q;break;case"defaultChecked":N=q;break;case"value":u=q;break;case"defaultValue":v=q;break;case"children":case"dangerouslySetInnerHTML":if(q!=null)throw Error(l(137,s));break;default:Ne(t,s,a,q,r,null)}}kd(t,u,v,w,N,m,c,!1);return;case"select":we("invalid",t),a=m=u=null;for(c in r)if(r.hasOwnProperty(c)&&(v=r[c],v!=null))switch(c){case"value":u=v;break;case"defaultValue":m=v;break;case"multiple":a=v;default:Ne(t,s,c,v,r,null)}s=u,r=m,t.multiple=!!a,s!=null?mr(t,!!a,s,!1):r!=null&&mr(t,!!a,r,!0);return;case"textarea":we("invalid",t),u=c=a=null;for(m in r)if(r.hasOwnProperty(m)&&(v=r[m],v!=null))switch(m){case"value":a=v;break;case"defaultValue":c=v;break;case"children":u=v;break;case"dangerouslySetInnerHTML":if(v!=null)throw Error(l(91));break;default:Ne(t,s,m,v,r,null)}Td(t,a,c,u);return;case"option":for(w in r)r.hasOwnProperty(w)&&(a=r[w],a!=null)&&(w==="selected"?t.selected=a&&typeof a!="function"&&typeof a!="symbol":Ne(t,s,w,a,r,null));return;case"dialog":we("beforetoggle",t),we("toggle",t),we("cancel",t),we("close",t);break;case"iframe":case"object":we("load",t);break;case"video":case"audio":for(a=0;a<qn.length;a++)we(qn[a],t);break;case"image":we("error",t),we("load",t);break;case"details":we("toggle",t);break;case"embed":case"source":case"link":we("error",t),we("load",t);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(N in r)if(r.hasOwnProperty(N)&&(a=r[N],a!=null))switch(N){case"children":case"dangerouslySetInnerHTML":throw Error(l(137,s));default:Ne(t,s,N,a,r,null)}return;default:if(Bo(s)){for(q in r)r.hasOwnProperty(q)&&(a=r[q],a!==void 0&&gh(t,s,q,a,r,void 0));return}}for(v in r)r.hasOwnProperty(v)&&(a=r[v],a!=null&&Ne(t,s,v,a,r,null))}function My(t,s,r,a){switch(s){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var c=null,u=null,m=null,v=null,w=null,N=null,q=null;for(W in r){var Y=r[W];if(r.hasOwnProperty(W)&&Y!=null)switch(W){case"checked":break;case"value":break;case"defaultValue":w=Y;default:a.hasOwnProperty(W)||Ne(t,s,W,null,a,Y)}}for(var U in a){var W=a[U];if(Y=r[U],a.hasOwnProperty(U)&&(W!=null||Y!=null))switch(U){case"type":u=W;break;case"name":c=W;break;case"checked":N=W;break;case"defaultChecked":q=W;break;case"value":m=W;break;case"defaultValue":v=W;break;case"children":case"dangerouslySetInnerHTML":if(W!=null)throw Error(l(137,s));break;default:W!==Y&&Ne(t,s,U,W,a,Y)}}Ro(t,m,v,w,N,q,u,c);return;case"select":W=m=v=U=null;for(u in r)if(w=r[u],r.hasOwnProperty(u)&&w!=null)switch(u){case"value":break;case"multiple":W=w;default:a.hasOwnProperty(u)||Ne(t,s,u,null,a,w)}for(c in a)if(u=a[c],w=r[c],a.hasOwnProperty(c)&&(u!=null||w!=null))switch(c){case"value":U=u;break;case"defaultValue":v=u;break;case"multiple":m=u;default:u!==w&&Ne(t,s,c,u,a,w)}s=v,r=m,a=W,U!=null?mr(t,!!r,U,!1):!!a!=!!r&&(s!=null?mr(t,!!r,s,!0):mr(t,!!r,r?[]:"",!1));return;case"textarea":W=U=null;for(v in r)if(c=r[v],r.hasOwnProperty(v)&&c!=null&&!a.hasOwnProperty(v))switch(v){case"value":break;case"children":break;default:Ne(t,s,v,null,a,c)}for(m in a)if(c=a[m],u=r[m],a.hasOwnProperty(m)&&(c!=null||u!=null))switch(m){case"value":U=c;break;case"defaultValue":W=c;break;case"children":break;case"dangerouslySetInnerHTML":if(c!=null)throw Error(l(91));break;default:c!==u&&Ne(t,s,m,c,a,u)}Ed(t,U,W);return;case"option":for(var re in r)U=r[re],r.hasOwnProperty(re)&&U!=null&&!a.hasOwnProperty(re)&&(re==="selected"?t.selected=!1:Ne(t,s,re,null,a,U));for(w in a)U=a[w],W=r[w],a.hasOwnProperty(w)&&U!==W&&(U!=null||W!=null)&&(w==="selected"?t.selected=U&&typeof U!="function"&&typeof U!="symbol":Ne(t,s,w,U,a,W));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 ce in r)U=r[ce],r.hasOwnProperty(ce)&&U!=null&&!a.hasOwnProperty(ce)&&Ne(t,s,ce,null,a,U);for(N in a)if(U=a[N],W=r[N],a.hasOwnProperty(N)&&U!==W&&(U!=null||W!=null))switch(N){case"children":case"dangerouslySetInnerHTML":if(U!=null)throw Error(l(137,s));break;default:Ne(t,s,N,U,a,W)}return;default:if(Bo(s)){for(var He in r)U=r[He],r.hasOwnProperty(He)&&U!==void 0&&!a.hasOwnProperty(He)&&gh(t,s,He,void 0,a,U);for(q in a)U=a[q],W=r[q],!a.hasOwnProperty(q)||U===W||U===void 0&&W===void 0||gh(t,s,q,U,a,W);return}}for(var B in r)U=r[B],r.hasOwnProperty(B)&&U!=null&&!a.hasOwnProperty(B)&&Ne(t,s,B,null,a,U);for(Y in a)U=a[Y],W=r[Y],!a.hasOwnProperty(Y)||U===W||U==null&&W==null||Ne(t,s,Y,U,a,W)}function M_(t){switch(t){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function zy(){if(typeof performance.getEntriesByType=="function"){for(var t=0,s=0,r=performance.getEntriesByType("resource"),a=0;a<r.length;a++){var c=r[a],u=c.transferSize,m=c.initiatorType,v=c.duration;if(u&&v&&M_(m)){for(m=0,v=c.responseEnd,a+=1;a<r.length;a++){var w=r[a],N=w.startTime;if(N>v)break;var q=w.transferSize,Y=w.initiatorType;q&&M_(Y)&&(w=w.responseEnd,m+=q*(w<v?1:(v-N)/(w-N)))}if(--a,s+=8*(u+m)/(c.duration/1e3),t++,10<t)break}}if(0<t)return s/t/1e6}return navigator.connection&&(t=navigator.connection.downlink,typeof t=="number")?t:5}var mh=null,vh=null;function ka(t){return t.nodeType===9?t:t.ownerDocument}function z_(t){switch(t){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function A_(t,s){if(t===0)switch(s){case"svg":return 1;case"math":return 2;default:return 0}return t===1&&s==="foreignObject"?0:t}function yh(t,s){return t==="textarea"||t==="noscript"||typeof s.children=="string"||typeof s.children=="number"||typeof s.children=="bigint"||typeof s.dangerouslySetInnerHTML=="object"&&s.dangerouslySetInnerHTML!==null&&s.dangerouslySetInnerHTML.__html!=null}var Sh=null;function Ay(){var t=window.event;return t&&t.type==="popstate"?t===Sh?!1:(Sh=t,!0):(Sh=null,!1)}var O_=typeof setTimeout=="function"?setTimeout:void 0,Oy=typeof clearTimeout=="function"?clearTimeout:void 0,L_=typeof Promise=="function"?Promise:void 0,Ly=typeof queueMicrotask=="function"?queueMicrotask:typeof L_<"u"?function(t){return L_.resolve(null).then(t).catch(jy)}:O_;function jy(t){setTimeout(function(){throw t})}function ks(t){return t==="head"}function j_(t,s){var r=s,a=0;do{var c=r.nextSibling;if(t.removeChild(r),c&&c.nodeType===8)if(r=c.data,r==="/$"||r==="/&"){if(a===0){t.removeChild(c),Xr(s);return}a--}else if(r==="$"||r==="$?"||r==="$~"||r==="$!"||r==="&")a++;else if(r==="html")In(t.ownerDocument.documentElement);else if(r==="head"){r=t.ownerDocument.head,In(r);for(var u=r.firstChild;u;){var m=u.nextSibling,v=u.nodeName;u[an]||v==="SCRIPT"||v==="STYLE"||v==="LINK"&&u.rel.toLowerCase()==="stylesheet"||r.removeChild(u),u=m}}else r==="body"&&In(t.ownerDocument.body);r=c}while(r);Xr(s)}function N_(t,s){var r=t;t=0;do{var a=r.nextSibling;if(r.nodeType===1?s?(r._stashedDisplay=r.style.display,r.style.display="none"):(r.style.display=r._stashedDisplay||"",r.getAttribute("style")===""&&r.removeAttribute("style")):r.nodeType===3&&(s?(r._stashedText=r.nodeValue,r.nodeValue=""):r.nodeValue=r._stashedText||""),a&&a.nodeType===8)if(r=a.data,r==="/$"){if(t===0)break;t--}else r!=="$"&&r!=="$?"&&r!=="$~"&&r!=="$!"||t++;r=a}while(r)}function bh(t){var s=t.firstChild;for(s&&s.nodeType===10&&(s=s.nextSibling);s;){var r=s;switch(s=s.nextSibling,r.nodeName){case"HTML":case"HEAD":case"BODY":bh(r),Eo(r);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(r.rel.toLowerCase()==="stylesheet")continue}t.removeChild(r)}}function Ny(t,s,r,a){for(;t.nodeType===1;){var c=r;if(t.nodeName.toLowerCase()!==s.toLowerCase()){if(!a&&(t.nodeName!=="INPUT"||t.type!=="hidden"))break}else if(a){if(!t[an])switch(s){case"meta":if(!t.hasAttribute("itemprop"))break;return t;case"link":if(u=t.getAttribute("rel"),u==="stylesheet"&&t.hasAttribute("data-precedence"))break;if(u!==c.rel||t.getAttribute("href")!==(c.href==null||c.href===""?null:c.href)||t.getAttribute("crossorigin")!==(c.crossOrigin==null?null:c.crossOrigin)||t.getAttribute("title")!==(c.title==null?null:c.title))break;return t;case"style":if(t.hasAttribute("data-precedence"))break;return t;case"script":if(u=t.getAttribute("src"),(u!==(c.src==null?null:c.src)||t.getAttribute("type")!==(c.type==null?null:c.type)||t.getAttribute("crossorigin")!==(c.crossOrigin==null?null:c.crossOrigin))&&u&&t.hasAttribute("async")&&!t.hasAttribute("itemprop"))break;return t;default:return t}}else if(s==="input"&&t.type==="hidden"){var u=c.name==null?null:""+c.name;if(c.type==="hidden"&&t.getAttribute("name")===u)return t}else return t;if(t=hi(t.nextSibling),t===null)break}return null}function Hy(t,s,r){if(s==="")return null;for(;t.nodeType!==3;)if((t.nodeType!==1||t.nodeName!=="INPUT"||t.type!=="hidden")&&!r||(t=hi(t.nextSibling),t===null))return null;return t}function H_(t,s){for(;t.nodeType!==8;)if((t.nodeType!==1||t.nodeName!=="INPUT"||t.type!=="hidden")&&!s||(t=hi(t.nextSibling),t===null))return null;return t}function xh(t){return t.data==="$?"||t.data==="$~"}function wh(t){return t.data==="$!"||t.data==="$?"&&t.ownerDocument.readyState!=="loading"}function Uy(t,s){var r=t.ownerDocument;if(t.data==="$~")t._reactRetry=s;else if(t.data!=="$?"||r.readyState!=="loading")s();else{var a=function(){s(),r.removeEventListener("DOMContentLoaded",a)};r.addEventListener("DOMContentLoaded",a),t._reactRetry=a}}function hi(t){for(;t!=null;t=t.nextSibling){var s=t.nodeType;if(s===1||s===3)break;if(s===8){if(s=t.data,s==="$"||s==="$!"||s==="$?"||s==="$~"||s==="&"||s==="F!"||s==="F")break;if(s==="/$"||s==="/&")return null}}return t}var Ch=null;function U_(t){t=t.nextSibling;for(var s=0;t;){if(t.nodeType===8){var r=t.data;if(r==="/$"||r==="/&"){if(s===0)return hi(t.nextSibling);s--}else r!=="$"&&r!=="$!"&&r!=="$?"&&r!=="$~"&&r!=="&"||s++}t=t.nextSibling}return null}function W_(t){t=t.previousSibling;for(var s=0;t;){if(t.nodeType===8){var r=t.data;if(r==="$"||r==="$!"||r==="$?"||r==="$~"||r==="&"){if(s===0)return t;s--}else r!=="/$"&&r!=="/&"||s++}t=t.previousSibling}return null}function q_(t,s,r){switch(s=ka(r),t){case"html":if(t=s.documentElement,!t)throw Error(l(452));return t;case"head":if(t=s.head,!t)throw Error(l(453));return t;case"body":if(t=s.body,!t)throw Error(l(454));return t;default:throw Error(l(451))}}function In(t){for(var s=t.attributes;s.length;)t.removeAttributeNode(s[0]);Eo(t)}var ui=new Map,P_=new Set;function Ea(t){return typeof t.getRootNode=="function"?t.getRootNode():t.nodeType===9?t:t.ownerDocument}var es=I.d;I.d={f:Wy,r:qy,D:Py,C:Iy,L:$y,m:Ky,X:Fy,S:Yy,M:Gy};function Wy(){var t=es.f(),s=ma();return t||s}function qy(t){var s=pr(t);s!==null&&s.tag===5&&s.type==="form"?np(s):es.r(t)}var Yr=typeof document>"u"?null:document;function I_(t,s,r){var a=Yr;if(a&&typeof s=="string"&&s){var c=si(s);c='link[rel="'+t+'"][href="'+c+'"]',typeof r=="string"&&(c+='[crossorigin="'+r+'"]'),P_.has(c)||(P_.add(c),t={rel:t,crossOrigin:r,href:s},a.querySelector(c)===null&&(s=a.createElement("link"),Ct(s,"link",t),ft(s),a.head.appendChild(s)))}}function Py(t){es.D(t),I_("dns-prefetch",t,null)}function Iy(t,s){es.C(t,s),I_("preconnect",t,s)}function $y(t,s,r){es.L(t,s,r);var a=Yr;if(a&&t&&s){var c='link[rel="preload"][as="'+si(s)+'"]';s==="image"&&r&&r.imageSrcSet?(c+='[imagesrcset="'+si(r.imageSrcSet)+'"]',typeof r.imageSizes=="string"&&(c+='[imagesizes="'+si(r.imageSizes)+'"]')):c+='[href="'+si(t)+'"]';var u=c;switch(s){case"style":u=Fr(t);break;case"script":u=Gr(t)}ui.has(u)||(t=y({rel:"preload",href:s==="image"&&r&&r.imageSrcSet?void 0:t,as:s},r),ui.set(u,t),a.querySelector(c)!==null||s==="style"&&a.querySelector($n(u))||s==="script"&&a.querySelector(Kn(u))||(s=a.createElement("link"),Ct(s,"link",t),ft(s),a.head.appendChild(s)))}}function Ky(t,s){es.m(t,s);var r=Yr;if(r&&t){var a=s&&typeof s.as=="string"?s.as:"script",c='link[rel="modulepreload"][as="'+si(a)+'"][href="'+si(t)+'"]',u=c;switch(a){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":u=Gr(t)}if(!ui.has(u)&&(t=y({rel:"modulepreload",href:t},s),ui.set(u,t),r.querySelector(c)===null)){switch(a){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(r.querySelector(Kn(u)))return}a=r.createElement("link"),Ct(a,"link",t),ft(a),r.head.appendChild(a)}}}function Yy(t,s,r){es.S(t,s,r);var a=Yr;if(a&&t){var c=_r(a).hoistableStyles,u=Fr(t);s=s||"default";var m=c.get(u);if(!m){var v={loading:0,preload:null};if(m=a.querySelector($n(u)))v.loading=5;else{t=y({rel:"stylesheet",href:t,"data-precedence":s},r),(r=ui.get(u))&&kh(t,r);var w=m=a.createElement("link");ft(w),Ct(w,"link",t),w._p=new Promise(function(N,q){w.onload=N,w.onerror=q}),w.addEventListener("load",function(){v.loading|=1}),w.addEventListener("error",function(){v.loading|=2}),v.loading|=4,Ta(m,s,a)}m={type:"stylesheet",instance:m,count:1,state:v},c.set(u,m)}}}function Fy(t,s){es.X(t,s);var r=Yr;if(r&&t){var a=_r(r).hoistableScripts,c=Gr(t),u=a.get(c);u||(u=r.querySelector(Kn(c)),u||(t=y({src:t,async:!0},s),(s=ui.get(c))&&Eh(t,s),u=r.createElement("script"),ft(u),Ct(u,"link",t),r.head.appendChild(u)),u={type:"script",instance:u,count:1,state:null},a.set(c,u))}}function Gy(t,s){es.M(t,s);var r=Yr;if(r&&t){var a=_r(r).hoistableScripts,c=Gr(t),u=a.get(c);u||(u=r.querySelector(Kn(c)),u||(t=y({src:t,async:!0,type:"module"},s),(s=ui.get(c))&&Eh(t,s),u=r.createElement("script"),ft(u),Ct(u,"link",t),r.head.appendChild(u)),u={type:"script",instance:u,count:1,state:null},a.set(c,u))}}function $_(t,s,r,a){var c=(c=he.current)?Ea(c):null;if(!c)throw Error(l(446));switch(t){case"meta":case"title":return null;case"style":return typeof r.precedence=="string"&&typeof r.href=="string"?(s=Fr(r.href),r=_r(c).hoistableStyles,a=r.get(s),a||(a={type:"style",instance:null,count:0,state:null},r.set(s,a)),a):{type:"void",instance:null,count:0,state:null};case"link":if(r.rel==="stylesheet"&&typeof r.href=="string"&&typeof r.precedence=="string"){t=Fr(r.href);var u=_r(c).hoistableStyles,m=u.get(t);if(m||(c=c.ownerDocument||c,m={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},u.set(t,m),(u=c.querySelector($n(t)))&&!u._p&&(m.instance=u,m.state.loading=5),ui.has(t)||(r={rel:"preload",as:"style",href:r.href,crossOrigin:r.crossOrigin,integrity:r.integrity,media:r.media,hrefLang:r.hrefLang,referrerPolicy:r.referrerPolicy},ui.set(t,r),u||Xy(c,t,r,m.state))),s&&a===null)throw Error(l(528,""));return m}if(s&&a!==null)throw Error(l(529,""));return null;case"script":return s=r.async,r=r.src,typeof r=="string"&&s&&typeof s!="function"&&typeof s!="symbol"?(s=Gr(r),r=_r(c).hoistableScripts,a=r.get(s),a||(a={type:"script",instance:null,count:0,state:null},r.set(s,a)),a):{type:"void",instance:null,count:0,state:null};default:throw Error(l(444,t))}}function Fr(t){return'href="'+si(t)+'"'}function $n(t){return'link[rel="stylesheet"]['+t+"]"}function K_(t){return y({},t,{"data-precedence":t.precedence,precedence:null})}function Xy(t,s,r,a){t.querySelector('link[rel="preload"][as="style"]['+s+"]")?a.loading=1:(s=t.createElement("link"),a.preload=s,s.addEventListener("load",function(){return a.loading|=1}),s.addEventListener("error",function(){return a.loading|=2}),Ct(s,"link",r),ft(s),t.head.appendChild(s))}function Gr(t){return'[src="'+si(t)+'"]'}function Kn(t){return"script[async]"+t}function Y_(t,s,r){if(s.count++,s.instance===null)switch(s.type){case"style":var a=t.querySelector('style[data-href~="'+si(r.href)+'"]');if(a)return s.instance=a,ft(a),a;var c=y({},r,{"data-href":r.href,"data-precedence":r.precedence,href:null,precedence:null});return a=(t.ownerDocument||t).createElement("style"),ft(a),Ct(a,"style",c),Ta(a,r.precedence,t),s.instance=a;case"stylesheet":c=Fr(r.href);var u=t.querySelector($n(c));if(u)return s.state.loading|=4,s.instance=u,ft(u),u;a=K_(r),(c=ui.get(c))&&kh(a,c),u=(t.ownerDocument||t).createElement("link"),ft(u);var m=u;return m._p=new Promise(function(v,w){m.onload=v,m.onerror=w}),Ct(u,"link",a),s.state.loading|=4,Ta(u,r.precedence,t),s.instance=u;case"script":return u=Gr(r.src),(c=t.querySelector(Kn(u)))?(s.instance=c,ft(c),c):(a=r,(c=ui.get(u))&&(a=y({},r),Eh(a,c)),t=t.ownerDocument||t,c=t.createElement("script"),ft(c),Ct(c,"link",a),t.head.appendChild(c),s.instance=c);case"void":return null;default:throw Error(l(443,s.type))}else s.type==="stylesheet"&&(s.state.loading&4)===0&&(a=s.instance,s.state.loading|=4,Ta(a,r.precedence,t));return s.instance}function Ta(t,s,r){for(var a=r.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),c=a.length?a[a.length-1]:null,u=c,m=0;m<a.length;m++){var v=a[m];if(v.dataset.precedence===s)u=v;else if(u!==c)break}u?u.parentNode.insertBefore(t,u.nextSibling):(s=r.nodeType===9?r.head:r,s.insertBefore(t,s.firstChild))}function kh(t,s){t.crossOrigin==null&&(t.crossOrigin=s.crossOrigin),t.referrerPolicy==null&&(t.referrerPolicy=s.referrerPolicy),t.title==null&&(t.title=s.title)}function Eh(t,s){t.crossOrigin==null&&(t.crossOrigin=s.crossOrigin),t.referrerPolicy==null&&(t.referrerPolicy=s.referrerPolicy),t.integrity==null&&(t.integrity=s.integrity)}var Ra=null;function F_(t,s,r){if(Ra===null){var a=new Map,c=Ra=new Map;c.set(r,a)}else c=Ra,a=c.get(r),a||(a=new Map,c.set(r,a));if(a.has(t))return a;for(a.set(t,null),r=r.getElementsByTagName(t),c=0;c<r.length;c++){var u=r[c];if(!(u[an]||u[St]||t==="link"&&u.getAttribute("rel")==="stylesheet")&&u.namespaceURI!=="http://www.w3.org/2000/svg"){var m=u.getAttribute(s)||"";m=t+m;var v=a.get(m);v?v.push(u):a.set(m,[u])}}return a}function G_(t,s,r){t=t.ownerDocument||t,t.head.insertBefore(r,s==="title"?t.querySelector("head > title"):null)}function Vy(t,s,r){if(r===1||s.itemProp!=null)return!1;switch(t){case"meta":case"title":return!0;case"style":if(typeof s.precedence!="string"||typeof s.href!="string"||s.href==="")break;return!0;case"link":if(typeof s.rel!="string"||typeof s.href!="string"||s.href===""||s.onLoad||s.onError)break;return s.rel==="stylesheet"?(t=s.disabled,typeof s.precedence=="string"&&t==null):!0;case"script":if(s.async&&typeof s.async!="function"&&typeof s.async!="symbol"&&!s.onLoad&&!s.onError&&s.src&&typeof s.src=="string")return!0}return!1}function X_(t){return!(t.type==="stylesheet"&&(t.state.loading&3)===0)}function Zy(t,s,r,a){if(r.type==="stylesheet"&&(typeof a.media!="string"||matchMedia(a.media).matches!==!1)&&(r.state.loading&4)===0){if(r.instance===null){var c=Fr(a.href),u=s.querySelector($n(c));if(u){s=u._p,s!==null&&typeof s=="object"&&typeof s.then=="function"&&(t.count++,t=Da.bind(t),s.then(t,t)),r.state.loading|=4,r.instance=u,ft(u);return}u=s.ownerDocument||s,a=K_(a),(c=ui.get(c))&&kh(a,c),u=u.createElement("link"),ft(u);var m=u;m._p=new Promise(function(v,w){m.onload=v,m.onerror=w}),Ct(u,"link",a),r.instance=u}t.stylesheets===null&&(t.stylesheets=new Map),t.stylesheets.set(r,s),(s=r.state.preload)&&(r.state.loading&3)===0&&(t.count++,r=Da.bind(t),s.addEventListener("load",r),s.addEventListener("error",r))}}var Th=0;function Qy(t,s){return t.stylesheets&&t.count===0&&Ma(t,t.stylesheets),0<t.count||0<t.imgCount?function(r){var a=setTimeout(function(){if(t.stylesheets&&Ma(t,t.stylesheets),t.unsuspend){var u=t.unsuspend;t.unsuspend=null,u()}},6e4+s);0<t.imgBytes&&Th===0&&(Th=62500*zy());var c=setTimeout(function(){if(t.waitingForImages=!1,t.count===0&&(t.stylesheets&&Ma(t,t.stylesheets),t.unsuspend)){var u=t.unsuspend;t.unsuspend=null,u()}},(t.imgBytes>Th?50:800)+s);return t.unsuspend=r,function(){t.unsuspend=null,clearTimeout(a),clearTimeout(c)}}:null}function Da(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Ma(this,this.stylesheets);else if(this.unsuspend){var t=this.unsuspend;this.unsuspend=null,t()}}}var Ba=null;function Ma(t,s){t.stylesheets=null,t.unsuspend!==null&&(t.count++,Ba=new Map,s.forEach(Jy,t),Ba=null,Da.call(t))}function Jy(t,s){if(!(s.state.loading&4)){var r=Ba.get(t);if(r)var a=r.get(null);else{r=new Map,Ba.set(t,r);for(var c=t.querySelectorAll("link[data-precedence],style[data-precedence]"),u=0;u<c.length;u++){var m=c[u];(m.nodeName==="LINK"||m.getAttribute("media")!=="not all")&&(r.set(m.dataset.precedence,m),a=m)}a&&r.set(null,a)}c=s.instance,m=c.getAttribute("data-precedence"),u=r.get(m)||a,u===a&&r.set(null,c),r.set(m,c),this.count++,a=Da.bind(this),c.addEventListener("load",a),c.addEventListener("error",a),u?u.parentNode.insertBefore(c,u.nextSibling):(t=t.nodeType===9?t.head:t,t.insertBefore(c,t.firstChild)),s.state.loading|=4}}var Yn={$$typeof:D,Provider:null,Consumer:null,_currentValue:K,_currentValue2:K,_threadCount:0};function eS(t,s,r,a,c,u,m,v,w){this.tag=1,this.containerInfo=t,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=xo(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=xo(0),this.hiddenUpdates=xo(null),this.identifierPrefix=a,this.onUncaughtError=c,this.onCaughtError=u,this.onRecoverableError=m,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=w,this.incompleteTransitions=new Map}function V_(t,s,r,a,c,u,m,v,w,N,q,Y){return t=new eS(t,s,r,m,w,N,q,Y,v),s=1,u===!0&&(s|=24),u=Yt(3,null,null,s),t.current=u,u.stateNode=t,s=lc(),s.refCount++,t.pooledCache=s,s.refCount++,u.memoizedState={element:a,isDehydrated:r,cache:s},hc(u),t}function Z_(t){return t?(t=kr,t):kr}function Q_(t,s,r,a,c,u){c=Z_(c),a.context===null?a.context=c:a.pendingContext=c,a=ps(s),a.payload={element:r},u=u===void 0?null:u,u!==null&&(a.callback=u),r=_s(t,a,s),r!==null&&(Wt(r,t,s),Cn(r,t,s))}function J_(t,s){if(t=t.memoizedState,t!==null&&t.dehydrated!==null){var r=t.retryLane;t.retryLane=r!==0&&r<s?r:s}}function Rh(t,s){J_(t,s),(t=t.alternate)&&J_(t,s)}function eg(t){if(t.tag===13||t.tag===31){var s=Ps(t,67108864);s!==null&&Wt(s,t,67108864),Rh(t,67108864)}}function tg(t){if(t.tag===13||t.tag===31){var s=Zt();s=wo(s);var r=Ps(t,s);r!==null&&Wt(r,t,s),Rh(t,s)}}var za=!0;function tS(t,s,r,a){var c=R.T;R.T=null;var u=I.p;try{I.p=2,Dh(t,s,r,a)}finally{I.p=u,R.T=c}}function iS(t,s,r,a){var c=R.T;R.T=null;var u=I.p;try{I.p=8,Dh(t,s,r,a)}finally{I.p=u,R.T=c}}function Dh(t,s,r,a){if(za){var c=Bh(a);if(c===null)_h(t,s,a,Aa,r),sg(t,a);else if(rS(c,t,s,r,a))a.stopPropagation();else if(sg(t,a),s&4&&-1<sS.indexOf(t)){for(;c!==null;){var u=pr(c);if(u!==null)switch(u.tag){case 3:if(u=u.stateNode,u.current.memoizedState.isDehydrated){var m=Ns(u.pendingLanes);if(m!==0){var v=u;for(v.pendingLanes|=2,v.entangledLanes|=2;m;){var w=1<<31-$t(m);v.entanglements[1]|=w,m&=~w}Ri(u),(Me&6)===0&&(_a=Pt()+500,Wn(0))}}break;case 31:case 13:v=Ps(u,2),v!==null&&Wt(v,u,2),ma(),Rh(u,2)}if(u=Bh(a),u===null&&_h(t,s,a,Aa,r),u===c)break;c=u}c!==null&&a.stopPropagation()}else _h(t,s,a,null,r)}}function Bh(t){return t=zo(t),Mh(t)}var Aa=null;function Mh(t){if(Aa=null,t=fr(t),t!==null){var s=h(t);if(s===null)t=null;else{var r=s.tag;if(r===13){if(t=d(s),t!==null)return t;t=null}else if(r===31){if(t=_(s),t!==null)return t;t=null}else if(r===3){if(s.stateNode.current.memoizedState.isDehydrated)return s.tag===3?s.stateNode.containerInfo:null;t=null}else s!==t&&(t=null)}}return Aa=t,null}function ig(t){switch(t){case"beforetoggle":case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"toggle":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 2;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 8;case"message":switch(Pv()){case cd:return 2;case hd:return 8;case xl:case Iv:return 32;case ud:return 268435456;default:return 32}default:return 32}}var zh=!1,Es=null,Ts=null,Rs=null,Fn=new Map,Gn=new Map,Ds=[],sS="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 sg(t,s){switch(t){case"focusin":case"focusout":Es=null;break;case"dragenter":case"dragleave":Ts=null;break;case"mouseover":case"mouseout":Rs=null;break;case"pointerover":case"pointerout":Fn.delete(s.pointerId);break;case"gotpointercapture":case"lostpointercapture":Gn.delete(s.pointerId)}}function Xn(t,s,r,a,c,u){return t===null||t.nativeEvent!==u?(t={blockedOn:s,domEventName:r,eventSystemFlags:a,nativeEvent:u,targetContainers:[c]},s!==null&&(s=pr(s),s!==null&&eg(s)),t):(t.eventSystemFlags|=a,s=t.targetContainers,c!==null&&s.indexOf(c)===-1&&s.push(c),t)}function rS(t,s,r,a,c){switch(s){case"focusin":return Es=Xn(Es,t,s,r,a,c),!0;case"dragenter":return Ts=Xn(Ts,t,s,r,a,c),!0;case"mouseover":return Rs=Xn(Rs,t,s,r,a,c),!0;case"pointerover":var u=c.pointerId;return Fn.set(u,Xn(Fn.get(u)||null,t,s,r,a,c)),!0;case"gotpointercapture":return u=c.pointerId,Gn.set(u,Xn(Gn.get(u)||null,t,s,r,a,c)),!0}return!1}function rg(t){var s=fr(t.target);if(s!==null){var r=h(s);if(r!==null){if(s=r.tag,s===13){if(s=d(r),s!==null){t.blockedOn=s,md(t.priority,function(){tg(r)});return}}else if(s===31){if(s=_(r),s!==null){t.blockedOn=s,md(t.priority,function(){tg(r)});return}}else if(s===3&&r.stateNode.current.memoizedState.isDehydrated){t.blockedOn=r.tag===3?r.stateNode.containerInfo:null;return}}}t.blockedOn=null}function Oa(t){if(t.blockedOn!==null)return!1;for(var s=t.targetContainers;0<s.length;){var r=Bh(t.nativeEvent);if(r===null){r=t.nativeEvent;var a=new r.constructor(r.type,r);Mo=a,r.target.dispatchEvent(a),Mo=null}else return s=pr(r),s!==null&&eg(s),t.blockedOn=r,!1;s.shift()}return!0}function ng(t,s,r){Oa(t)&&r.delete(s)}function nS(){zh=!1,Es!==null&&Oa(Es)&&(Es=null),Ts!==null&&Oa(Ts)&&(Ts=null),Rs!==null&&Oa(Rs)&&(Rs=null),Fn.forEach(ng),Gn.forEach(ng)}function La(t,s){t.blockedOn===s&&(t.blockedOn=null,zh||(zh=!0,e.unstable_scheduleCallback(e.unstable_NormalPriority,nS)))}var ja=null;function lg(t){ja!==t&&(ja=t,e.unstable_scheduleCallback(e.unstable_NormalPriority,function(){ja===t&&(ja=null);for(var s=0;s<t.length;s+=3){var r=t[s],a=t[s+1],c=t[s+2];if(typeof a!="function"){if(Mh(a||r)===null)continue;break}var u=pr(r);u!==null&&(t.splice(s,3),s-=3,Bc(u,{pending:!0,data:c,method:r.method,action:a},a,c))}}))}function Xr(t){function s(w){return La(w,t)}Es!==null&&La(Es,t),Ts!==null&&La(Ts,t),Rs!==null&&La(Rs,t),Fn.forEach(s),Gn.forEach(s);for(var r=0;r<Ds.length;r++){var a=Ds[r];a.blockedOn===t&&(a.blockedOn=null)}for(;0<Ds.length&&(r=Ds[0],r.blockedOn===null);)rg(r),r.blockedOn===null&&Ds.shift();if(r=(t.ownerDocument||t).$$reactFormReplay,r!=null)for(a=0;a<r.length;a+=3){var c=r[a],u=r[a+1],m=c[Ot]||null;if(typeof u=="function")m||lg(r);else if(m){var v=null;if(u&&u.hasAttribute("formAction")){if(c=u,m=u[Ot]||null)v=m.formAction;else if(Mh(c)!==null)continue}else v=m.action;typeof v=="function"?r[a+1]=v:(r.splice(a,3),a-=3),lg(r)}}}function ag(){function t(u){u.canIntercept&&u.info==="react-transition"&&u.intercept({handler:function(){return new Promise(function(m){return c=m})},focusReset:"manual",scroll:"manual"})}function s(){c!==null&&(c(),c=null),a||setTimeout(r,20)}function r(){if(!a&&!navigation.transition){var u=navigation.currentEntry;u&&u.url!=null&&navigation.navigate(u.url,{state:u.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var a=!1,c=null;return navigation.addEventListener("navigate",t),navigation.addEventListener("navigatesuccess",s),navigation.addEventListener("navigateerror",s),setTimeout(r,100),function(){a=!0,navigation.removeEventListener("navigate",t),navigation.removeEventListener("navigatesuccess",s),navigation.removeEventListener("navigateerror",s),c!==null&&(c(),c=null)}}}function Ah(t){this._internalRoot=t}Na.prototype.render=Ah.prototype.render=function(t){var s=this._internalRoot;if(s===null)throw Error(l(409));var r=s.current,a=Zt();Q_(r,a,t,s,null,null)},Na.prototype.unmount=Ah.prototype.unmount=function(){var t=this._internalRoot;if(t!==null){this._internalRoot=null;var s=t.containerInfo;Q_(t.current,2,null,t,null,null),ma(),s[dr]=null}};function Na(t){this._internalRoot=t}Na.prototype.unstable_scheduleHydration=function(t){if(t){var s=gd();t={blockedOn:null,target:t,priority:s};for(var r=0;r<Ds.length&&s!==0&&s<Ds[r].priority;r++);Ds.splice(r,0,t),r===0&&rg(t)}};var og=i.version;if(og!=="19.2.4")throw Error(l(527,og,"19.2.4"));I.findDOMNode=function(t){var s=t._reactInternals;if(s===void 0)throw typeof t.render=="function"?Error(l(188)):(t=Object.keys(t).join(","),Error(l(268,t)));return t=f(s),t=t!==null?S(t):null,t=t===null?null:t.stateNode,t};var lS={bundleType:0,version:"19.2.4",rendererPackageName:"react-dom",currentDispatcherRef:R,reconcilerVersion:"19.2.4"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Ha=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Ha.isDisabled&&Ha.supportsFiber)try{rn=Ha.inject(lS),It=Ha}catch{}}return Zn.createRoot=function(t,s){if(!o(t))throw Error(l(299));var r=!1,a="",c=_p,u=gp,m=mp;return s!=null&&(s.unstable_strictMode===!0&&(r=!0),s.identifierPrefix!==void 0&&(a=s.identifierPrefix),s.onUncaughtError!==void 0&&(c=s.onUncaughtError),s.onCaughtError!==void 0&&(u=s.onCaughtError),s.onRecoverableError!==void 0&&(m=s.onRecoverableError)),s=V_(t,1,!1,null,null,r,a,null,c,u,m,ag),t[dr]=s.current,ph(t),new Ah(s)},Zn.hydrateRoot=function(t,s,r){if(!o(t))throw Error(l(299));var a=!1,c="",u=_p,m=gp,v=mp,w=null;return r!=null&&(r.unstable_strictMode===!0&&(a=!0),r.identifierPrefix!==void 0&&(c=r.identifierPrefix),r.onUncaughtError!==void 0&&(u=r.onUncaughtError),r.onCaughtError!==void 0&&(m=r.onCaughtError),r.onRecoverableError!==void 0&&(v=r.onRecoverableError),r.formState!==void 0&&(w=r.formState)),s=V_(t,1,!0,s,r??null,a,c,w,u,m,v,ag),s.context=Z_(null),r=s.current,a=Zt(),a=wo(a),c=ps(a),c.callback=null,_s(r,c,a),r=a,s.current.lanes=r,ln(s,r),Ri(s),t[dr]=s.current,ph(t),new Na(s)},Zn.version="19.2.4",Zn}var vg;function gS(){if(vg)return jh.exports;vg=1;function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(i){console.error(i)}}return e(),jh.exports=_S(),jh.exports}var mS=gS();const xm="claude-portal",yg="greenhouse-setup",vS=10;function wm(){const e=localStorage.getItem(xm);if(e)try{return JSON.parse(e)}catch{}const i=localStorage.getItem(yg);if(i)try{const n=JSON.parse(i),l={recentProjects:n.projectDir?[n.projectDir]:[],checklist:{},jobHistory:{}};return Cm(l),localStorage.removeItem(yg),l}catch{}return{recentProjects:[],checklist:{},jobHistory:{}}}function Cm(e){localStorage.setItem(xm,JSON.stringify(e))}function km(){return wm().recentProjects}function yS(e){const i=wm();return i.recentProjects=[e,...i.recentProjects.filter(n=>n!==e)].slice(0,vS),Cm(i),i.recentProjects}const Em=z.createContext(null);function SS({children:e}){const[i,n]=z.useState(null),[l,o]=z.useState(km),[h,d]=z.useState(null),[_,p]=z.useState(null),[f,S]=z.useState(!1),[y,x]=z.useState(!0),[C,b]=z.useState("developer"),[T,M]=z.useState(!1),A=z.useCallback(L=>{n(L),o(yS(L)),d(null),p(null)},[]),O=z.useCallback(()=>{n(null),d(null),p(null),b("developer"),M(!1)},[]),D=z.useCallback((L,H)=>{d(L),p(H)},[]);return g.jsx(Em.Provider,{value:{path:i,recentProjects:l,gitBranch:h,gitRemote:_,terminalConnected:f,serverConnected:y,mode:C,setMode:b,editingBrain:T,setEditingBrain:M,setProjectPath:A,clearProject:O,setGitInfo:D,setTerminalConnected:S,setServerConnected:x},children:e})}function Et(){const e=z.useContext(Em);if(!e)throw new Error("useProject must be used within ProjectProvider");return e}const Tm=z.createContext(null);function bS(e){return e.replace(/\x1b\[[?>=!]?[0-9;]*[a-zA-Z]/g,"").replace(/\x1b\][^\x07\x1b]*(?:\x07|\x1b\\)/g,"").replace(/\x1b[()][0-9A-Z]/g,"").replace(/\x1b./g,"").replace(/\r/g,"")}function xS({children:e}){const i=z.useRef(null),[n,l]=z.useState(!1),[o,h]=z.useState([]),d=z.useRef(!1),_=z.useRef(null),p=z.useRef(null),f=z.useRef(null),S=z.useRef(null),y=z.useRef(null),x=z.useRef(null),C=z.useRef(null),b=z.useCallback(H=>{h(X=>{const V=[...X,H];return V.length>100?V.slice(V.length-100):V})},[]),T=z.useCallback((H,X)=>{x.current=H,C.current=X},[]),M=z.useCallback(H=>{const X=i.current;X?.readyState===WebSocket.OPEN&&X.send(JSON.stringify({type:"input",data:H}))},[]),A=z.useCallback(()=>{if(_.current){const H=_.current;_.current=null,setTimeout(()=>M(H+"\r"),300)}},[M]),O=z.useCallback(()=>{d.current||(d.current=!0,l(!0),f.current&&(clearTimeout(f.current),f.current=null),A())},[A]),D=z.useCallback(H=>{d.current?M(H+"\r"):_.current=H},[M]),L=z.useCallback(H=>{i.current&&i.current.close(),f.current&&(clearTimeout(f.current),f.current=null),d.current=!1,l(!1),p.current=null;const X=location.protocol==="https:"?"wss:":"ws:",V=new WebSocket(`${X}//${location.host}/terminal?cwd=${encodeURIComponent(H)}`);return i.current=V,V.onopen=()=>{x.current?.(),setTimeout(()=>{M("claude --dangerously-skip-permissions\r"),p.current=Date.now()},500),f.current=setTimeout(O,15e3)},V.onmessage=ue=>{let ge;try{ge=JSON.parse(ue.data)}catch{return}if(ge.type==="output"){if(ge.data&&S.current?.(ge.data),!d.current&&p.current&&Date.now()-p.current>2e3){const de=bS(ge.data||"");(/>\s*$/.test(de)||de.includes("What can I help"))&&O()}}else ge.type==="exit"?y.current?.():ge.type==="error"&&S.current?.(`\r
|
|
8
|
+
`+a.stack}}var yo=Object.prototype.hasOwnProperty,So=e.unstable_scheduleCallback,bo=e.unstable_cancelCallback,Wv=e.unstable_shouldYield,qv=e.unstable_requestPaint,Pt=e.unstable_now,Pv=e.unstable_getCurrentPriorityLevel,cd=e.unstable_ImmediatePriority,hd=e.unstable_UserBlockingPriority,xl=e.unstable_NormalPriority,Iv=e.unstable_LowPriority,ud=e.unstable_IdlePriority,Yv=e.log,$v=e.unstable_setDisableYieldValue,rn=null,It=null;function ls(t){if(typeof Yv=="function"&&$v(t),It&&typeof It.setStrictMode=="function")try{It.setStrictMode(rn,t)}catch{}}var Yt=Math.clz32?Math.clz32:Gv,Kv=Math.log,Fv=Math.LN2;function Gv(t){return t>>>=0,t===0?32:31-(Kv(t)/Fv|0)|0}var wl=256,Cl=262144,kl=4194304;function Ns(t){var s=t&42;if(s!==0)return s;switch(t&-t){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 t&261888;case 262144:case 524288:case 1048576:case 2097152:return t&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return t&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return t}}function El(t,s,r){var a=t.pendingLanes;if(a===0)return 0;var c=0,u=t.suspendedLanes,m=t.pingedLanes;t=t.warmLanes;var v=a&134217727;return v!==0?(a=v&~u,a!==0?c=Ns(a):(m&=v,m!==0?c=Ns(m):r||(r=v&~t,r!==0&&(c=Ns(r))))):(v=a&~u,v!==0?c=Ns(v):m!==0?c=Ns(m):r||(r=a&~t,r!==0&&(c=Ns(r)))),c===0?0:s!==0&&s!==c&&(s&u)===0&&(u=c&-c,r=s&-s,u>=r||u===32&&(r&4194048)!==0)?s:c}function nn(t,s){return(t.pendingLanes&~(t.suspendedLanes&~t.pingedLanes)&s)===0}function Xv(t,s){switch(t){case 1:case 2:case 4:case 8:case 64:return s+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 s+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 dd(){var t=kl;return kl<<=1,(kl&62914560)===0&&(kl=4194304),t}function xo(t){for(var s=[],r=0;31>r;r++)s.push(t);return s}function ln(t,s){t.pendingLanes|=s,s!==268435456&&(t.suspendedLanes=0,t.pingedLanes=0,t.warmLanes=0)}function Vv(t,s,r,a,c,u){var m=t.pendingLanes;t.pendingLanes=r,t.suspendedLanes=0,t.pingedLanes=0,t.warmLanes=0,t.expiredLanes&=r,t.entangledLanes&=r,t.errorRecoveryDisabledLanes&=r,t.shellSuspendCounter=0;var v=t.entanglements,w=t.expirationTimes,N=t.hiddenUpdates;for(r=m&~r;0<r;){var q=31-Yt(r),K=1<<q;v[q]=0,w[q]=-1;var U=N[q];if(U!==null)for(N[q]=null,q=0;q<U.length;q++){var W=U[q];W!==null&&(W.lane&=-536870913)}r&=~K}a!==0&&fd(t,a,0),u!==0&&c===0&&t.tag!==0&&(t.suspendedLanes|=u&~(m&~s))}function fd(t,s,r){t.pendingLanes|=s,t.suspendedLanes&=~s;var a=31-Yt(s);t.entangledLanes|=s,t.entanglements[a]=t.entanglements[a]|1073741824|r&261930}function pd(t,s){var r=t.entangledLanes|=s;for(t=t.entanglements;r;){var a=31-Yt(r),c=1<<a;c&s|t[a]&s&&(t[a]|=s),r&=~c}}function _d(t,s){var r=s&-s;return r=(r&42)!==0?1:wo(r),(r&(t.suspendedLanes|s))!==0?0:r}function wo(t){switch(t){case 2:t=1;break;case 8:t=4;break;case 32:t=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:t=128;break;case 268435456:t=134217728;break;default:t=0}return t}function Co(t){return t&=-t,2<t?8<t?(t&134217727)!==0?32:268435456:8:2}function gd(){var t=I.p;return t!==0?t:(t=window.event,t===void 0?32:ig(t.type))}function md(t,s){var r=I.p;try{return I.p=t,s()}finally{I.p=r}}var as=Math.random().toString(36).slice(2),St="__reactFiber$"+as,Ot="__reactProps$"+as,dr="__reactContainer$"+as,ko="__reactEvents$"+as,Zv="__reactListeners$"+as,Qv="__reactHandles$"+as,vd="__reactResources$"+as,an="__reactMarker$"+as;function Eo(t){delete t[St],delete t[Ot],delete t[ko],delete t[Zv],delete t[Qv]}function fr(t){var s=t[St];if(s)return s;for(var r=t.parentNode;r;){if(s=r[dr]||r[St]){if(r=s.alternate,s.child!==null||r!==null&&r.child!==null)for(t=W_(t);t!==null;){if(r=t[St])return r;t=W_(t)}return s}t=r,r=t.parentNode}return null}function pr(t){if(t=t[St]||t[dr]){var s=t.tag;if(s===5||s===6||s===13||s===31||s===26||s===27||s===3)return t}return null}function on(t){var s=t.tag;if(s===5||s===26||s===27||s===6)return t.stateNode;throw Error(l(33))}function _r(t){var s=t[vd];return s||(s=t[vd]={hoistableStyles:new Map,hoistableScripts:new Map}),s}function ft(t){t[an]=!0}var yd=new Set,Sd={};function Hs(t,s){gr(t,s),gr(t+"Capture",s)}function gr(t,s){for(Sd[t]=s,t=0;t<s.length;t++)yd.add(s[t])}var Jv=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]*$"),bd={},xd={};function e0(t){return yo.call(xd,t)?!0:yo.call(bd,t)?!1:Jv.test(t)?xd[t]=!0:(bd[t]=!0,!1)}function Tl(t,s,r){if(e0(s))if(r===null)t.removeAttribute(s);else{switch(typeof r){case"undefined":case"function":case"symbol":t.removeAttribute(s);return;case"boolean":var a=s.toLowerCase().slice(0,5);if(a!=="data-"&&a!=="aria-"){t.removeAttribute(s);return}}t.setAttribute(s,""+r)}}function Rl(t,s,r){if(r===null)t.removeAttribute(s);else{switch(typeof r){case"undefined":case"function":case"symbol":case"boolean":t.removeAttribute(s);return}t.setAttribute(s,""+r)}}function Ni(t,s,r,a){if(a===null)t.removeAttribute(r);else{switch(typeof a){case"undefined":case"function":case"symbol":case"boolean":t.removeAttribute(r);return}t.setAttributeNS(s,r,""+a)}}function ii(t){switch(typeof t){case"bigint":case"boolean":case"number":case"string":case"undefined":return t;case"object":return t;default:return""}}function wd(t){var s=t.type;return(t=t.nodeName)&&t.toLowerCase()==="input"&&(s==="checkbox"||s==="radio")}function t0(t,s,r){var a=Object.getOwnPropertyDescriptor(t.constructor.prototype,s);if(!t.hasOwnProperty(s)&&typeof a<"u"&&typeof a.get=="function"&&typeof a.set=="function"){var c=a.get,u=a.set;return Object.defineProperty(t,s,{configurable:!0,get:function(){return c.call(this)},set:function(m){r=""+m,u.call(this,m)}}),Object.defineProperty(t,s,{enumerable:a.enumerable}),{getValue:function(){return r},setValue:function(m){r=""+m},stopTracking:function(){t._valueTracker=null,delete t[s]}}}}function To(t){if(!t._valueTracker){var s=wd(t)?"checked":"value";t._valueTracker=t0(t,s,""+t[s])}}function Cd(t){if(!t)return!1;var s=t._valueTracker;if(!s)return!0;var r=s.getValue(),a="";return t&&(a=wd(t)?t.checked?"true":"false":t.value),t=a,t!==r?(s.setValue(t),!0):!1}function Dl(t){if(t=t||(typeof document<"u"?document:void 0),typeof t>"u")return null;try{return t.activeElement||t.body}catch{return t.body}}var i0=/[\n"\\]/g;function si(t){return t.replace(i0,function(s){return"\\"+s.charCodeAt(0).toString(16)+" "})}function Ro(t,s,r,a,c,u,m,v){t.name="",m!=null&&typeof m!="function"&&typeof m!="symbol"&&typeof m!="boolean"?t.type=m:t.removeAttribute("type"),s!=null?m==="number"?(s===0&&t.value===""||t.value!=s)&&(t.value=""+ii(s)):t.value!==""+ii(s)&&(t.value=""+ii(s)):m!=="submit"&&m!=="reset"||t.removeAttribute("value"),s!=null?Do(t,m,ii(s)):r!=null?Do(t,m,ii(r)):a!=null&&t.removeAttribute("value"),c==null&&u!=null&&(t.defaultChecked=!!u),c!=null&&(t.checked=c&&typeof c!="function"&&typeof c!="symbol"),v!=null&&typeof v!="function"&&typeof v!="symbol"&&typeof v!="boolean"?t.name=""+ii(v):t.removeAttribute("name")}function kd(t,s,r,a,c,u,m,v){if(u!=null&&typeof u!="function"&&typeof u!="symbol"&&typeof u!="boolean"&&(t.type=u),s!=null||r!=null){if(!(u!=="submit"&&u!=="reset"||s!=null)){To(t);return}r=r!=null?""+ii(r):"",s=s!=null?""+ii(s):r,v||s===t.value||(t.value=s),t.defaultValue=s}a=a??c,a=typeof a!="function"&&typeof a!="symbol"&&!!a,t.checked=v?t.checked:!!a,t.defaultChecked=!!a,m!=null&&typeof m!="function"&&typeof m!="symbol"&&typeof m!="boolean"&&(t.name=m),To(t)}function Do(t,s,r){s==="number"&&Dl(t.ownerDocument)===t||t.defaultValue===""+r||(t.defaultValue=""+r)}function mr(t,s,r,a){if(t=t.options,s){s={};for(var c=0;c<r.length;c++)s["$"+r[c]]=!0;for(r=0;r<t.length;r++)c=s.hasOwnProperty("$"+t[r].value),t[r].selected!==c&&(t[r].selected=c),c&&a&&(t[r].defaultSelected=!0)}else{for(r=""+ii(r),s=null,c=0;c<t.length;c++){if(t[c].value===r){t[c].selected=!0,a&&(t[c].defaultSelected=!0);return}s!==null||t[c].disabled||(s=t[c])}s!==null&&(s.selected=!0)}}function Ed(t,s,r){if(s!=null&&(s=""+ii(s),s!==t.value&&(t.value=s),r==null)){t.defaultValue!==s&&(t.defaultValue=s);return}t.defaultValue=r!=null?""+ii(r):""}function Td(t,s,r,a){if(s==null){if(a!=null){if(r!=null)throw Error(l(92));if(ee(a)){if(1<a.length)throw Error(l(93));a=a[0]}r=a}r==null&&(r=""),s=r}r=ii(s),t.defaultValue=r,a=t.textContent,a===r&&a!==""&&a!==null&&(t.value=a),To(t)}function vr(t,s){if(s){var r=t.firstChild;if(r&&r===t.lastChild&&r.nodeType===3){r.nodeValue=s;return}}t.textContent=s}var s0=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 Rd(t,s,r){var a=s.indexOf("--")===0;r==null||typeof r=="boolean"||r===""?a?t.setProperty(s,""):s==="float"?t.cssFloat="":t[s]="":a?t.setProperty(s,r):typeof r!="number"||r===0||s0.has(s)?s==="float"?t.cssFloat=r:t[s]=(""+r).trim():t[s]=r+"px"}function Dd(t,s,r){if(s!=null&&typeof s!="object")throw Error(l(62));if(t=t.style,r!=null){for(var a in r)!r.hasOwnProperty(a)||s!=null&&s.hasOwnProperty(a)||(a.indexOf("--")===0?t.setProperty(a,""):a==="float"?t.cssFloat="":t[a]="");for(var c in s)a=s[c],s.hasOwnProperty(c)&&r[c]!==a&&Rd(t,c,a)}else for(var u in s)s.hasOwnProperty(u)&&Rd(t,u,s[u])}function Bo(t){if(t.indexOf("-")===-1)return!1;switch(t){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 r0=new Map([["acceptCharset","accept-charset"],["htmlFor","for"],["httpEquiv","http-equiv"],["crossOrigin","crossorigin"],["accentHeight","accent-height"],["alignmentBaseline","alignment-baseline"],["arabicForm","arabic-form"],["baselineShift","baseline-shift"],["capHeight","cap-height"],["clipPath","clip-path"],["clipRule","clip-rule"],["colorInterpolation","color-interpolation"],["colorInterpolationFilters","color-interpolation-filters"],["colorProfile","color-profile"],["colorRendering","color-rendering"],["dominantBaseline","dominant-baseline"],["enableBackground","enable-background"],["fillOpacity","fill-opacity"],["fillRule","fill-rule"],["floodColor","flood-color"],["floodOpacity","flood-opacity"],["fontFamily","font-family"],["fontSize","font-size"],["fontSizeAdjust","font-size-adjust"],["fontStretch","font-stretch"],["fontStyle","font-style"],["fontVariant","font-variant"],["fontWeight","font-weight"],["glyphName","glyph-name"],["glyphOrientationHorizontal","glyph-orientation-horizontal"],["glyphOrientationVertical","glyph-orientation-vertical"],["horizAdvX","horiz-adv-x"],["horizOriginX","horiz-origin-x"],["imageRendering","image-rendering"],["letterSpacing","letter-spacing"],["lightingColor","lighting-color"],["markerEnd","marker-end"],["markerMid","marker-mid"],["markerStart","marker-start"],["overlinePosition","overline-position"],["overlineThickness","overline-thickness"],["paintOrder","paint-order"],["panose-1","panose-1"],["pointerEvents","pointer-events"],["renderingIntent","rendering-intent"],["shapeRendering","shape-rendering"],["stopColor","stop-color"],["stopOpacity","stop-opacity"],["strikethroughPosition","strikethrough-position"],["strikethroughThickness","strikethrough-thickness"],["strokeDasharray","stroke-dasharray"],["strokeDashoffset","stroke-dashoffset"],["strokeLinecap","stroke-linecap"],["strokeLinejoin","stroke-linejoin"],["strokeMiterlimit","stroke-miterlimit"],["strokeOpacity","stroke-opacity"],["strokeWidth","stroke-width"],["textAnchor","text-anchor"],["textDecoration","text-decoration"],["textRendering","text-rendering"],["transformOrigin","transform-origin"],["underlinePosition","underline-position"],["underlineThickness","underline-thickness"],["unicodeBidi","unicode-bidi"],["unicodeRange","unicode-range"],["unitsPerEm","units-per-em"],["vAlphabetic","v-alphabetic"],["vHanging","v-hanging"],["vIdeographic","v-ideographic"],["vMathematical","v-mathematical"],["vectorEffect","vector-effect"],["vertAdvY","vert-adv-y"],["vertOriginX","vert-origin-x"],["vertOriginY","vert-origin-y"],["wordSpacing","word-spacing"],["writingMode","writing-mode"],["xmlnsXlink","xmlns:xlink"],["xHeight","x-height"]]),n0=/^[\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 Bl(t){return n0.test(""+t)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":t}function Hi(){}var Mo=null;function zo(t){return t=t.target||t.srcElement||window,t.correspondingUseElement&&(t=t.correspondingUseElement),t.nodeType===3?t.parentNode:t}var yr=null,Sr=null;function Bd(t){var s=pr(t);if(s&&(t=s.stateNode)){var r=t[Ot]||null;e:switch(t=s.stateNode,s.type){case"input":if(Ro(t,r.value,r.defaultValue,r.defaultValue,r.checked,r.defaultChecked,r.type,r.name),s=r.name,r.type==="radio"&&s!=null){for(r=t;r.parentNode;)r=r.parentNode;for(r=r.querySelectorAll('input[name="'+si(""+s)+'"][type="radio"]'),s=0;s<r.length;s++){var a=r[s];if(a!==t&&a.form===t.form){var c=a[Ot]||null;if(!c)throw Error(l(90));Ro(a,c.value,c.defaultValue,c.defaultValue,c.checked,c.defaultChecked,c.type,c.name)}}for(s=0;s<r.length;s++)a=r[s],a.form===t.form&&Cd(a)}break e;case"textarea":Ed(t,r.value,r.defaultValue);break e;case"select":s=r.value,s!=null&&mr(t,!!r.multiple,s,!1)}}}var Ao=!1;function Md(t,s,r){if(Ao)return t(s,r);Ao=!0;try{var a=t(s);return a}finally{if(Ao=!1,(yr!==null||Sr!==null)&&(ma(),yr&&(s=yr,t=Sr,Sr=yr=null,Bd(s),t)))for(s=0;s<t.length;s++)Bd(t[s])}}function cn(t,s){var r=t.stateNode;if(r===null)return null;var a=r[Ot]||null;if(a===null)return null;r=a[s];e:switch(s){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(a=!a.disabled)||(t=t.type,a=!(t==="button"||t==="input"||t==="select"||t==="textarea")),t=!a;break e;default:t=!1}if(t)return null;if(r&&typeof r!="function")throw Error(l(231,s,typeof r));return r}var Ui=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Oo=!1;if(Ui)try{var hn={};Object.defineProperty(hn,"passive",{get:function(){Oo=!0}}),window.addEventListener("test",hn,hn),window.removeEventListener("test",hn,hn)}catch{Oo=!1}var os=null,Lo=null,Ml=null;function zd(){if(Ml)return Ml;var t,s=Lo,r=s.length,a,c="value"in os?os.value:os.textContent,u=c.length;for(t=0;t<r&&s[t]===c[t];t++);var m=r-t;for(a=1;a<=m&&s[r-a]===c[u-a];a++);return Ml=c.slice(t,1<a?1-a:void 0)}function zl(t){var s=t.keyCode;return"charCode"in t?(t=t.charCode,t===0&&s===13&&(t=13)):t=s,t===10&&(t=13),32<=t||t===13?t:0}function Al(){return!0}function Ad(){return!1}function Lt(t){function s(r,a,c,u,m){this._reactName=r,this._targetInst=c,this.type=a,this.nativeEvent=u,this.target=m,this.currentTarget=null;for(var v in t)t.hasOwnProperty(v)&&(r=t[v],this[v]=r?r(u):u[v]);return this.isDefaultPrevented=(u.defaultPrevented!=null?u.defaultPrevented:u.returnValue===!1)?Al:Ad,this.isPropagationStopped=Ad,this}return y(s.prototype,{preventDefault:function(){this.defaultPrevented=!0;var r=this.nativeEvent;r&&(r.preventDefault?r.preventDefault():typeof r.returnValue!="unknown"&&(r.returnValue=!1),this.isDefaultPrevented=Al)},stopPropagation:function(){var r=this.nativeEvent;r&&(r.stopPropagation?r.stopPropagation():typeof r.cancelBubble!="unknown"&&(r.cancelBubble=!0),this.isPropagationStopped=Al)},persist:function(){},isPersistent:Al}),s}var Us={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(t){return t.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Ol=Lt(Us),un=y({},Us,{view:0,detail:0}),l0=Lt(un),jo,No,dn,Ll=y({},un,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Uo,button:0,buttons:0,relatedTarget:function(t){return t.relatedTarget===void 0?t.fromElement===t.srcElement?t.toElement:t.fromElement:t.relatedTarget},movementX:function(t){return"movementX"in t?t.movementX:(t!==dn&&(dn&&t.type==="mousemove"?(jo=t.screenX-dn.screenX,No=t.screenY-dn.screenY):No=jo=0,dn=t),jo)},movementY:function(t){return"movementY"in t?t.movementY:No}}),Od=Lt(Ll),a0=y({},Ll,{dataTransfer:0}),o0=Lt(a0),c0=y({},un,{relatedTarget:0}),Ho=Lt(c0),h0=y({},Us,{animationName:0,elapsedTime:0,pseudoElement:0}),u0=Lt(h0),d0=y({},Us,{clipboardData:function(t){return"clipboardData"in t?t.clipboardData:window.clipboardData}}),f0=Lt(d0),p0=y({},Us,{data:0}),Ld=Lt(p0),_0={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},g0={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"},m0={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function v0(t){var s=this.nativeEvent;return s.getModifierState?s.getModifierState(t):(t=m0[t])?!!s[t]:!1}function Uo(){return v0}var y0=y({},un,{key:function(t){if(t.key){var s=_0[t.key]||t.key;if(s!=="Unidentified")return s}return t.type==="keypress"?(t=zl(t),t===13?"Enter":String.fromCharCode(t)):t.type==="keydown"||t.type==="keyup"?g0[t.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Uo,charCode:function(t){return t.type==="keypress"?zl(t):0},keyCode:function(t){return t.type==="keydown"||t.type==="keyup"?t.keyCode:0},which:function(t){return t.type==="keypress"?zl(t):t.type==="keydown"||t.type==="keyup"?t.keyCode:0}}),S0=Lt(y0),b0=y({},Ll,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),jd=Lt(b0),x0=y({},un,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Uo}),w0=Lt(x0),C0=y({},Us,{propertyName:0,elapsedTime:0,pseudoElement:0}),k0=Lt(C0),E0=y({},Ll,{deltaX:function(t){return"deltaX"in t?t.deltaX:"wheelDeltaX"in t?-t.wheelDeltaX:0},deltaY:function(t){return"deltaY"in t?t.deltaY:"wheelDeltaY"in t?-t.wheelDeltaY:"wheelDelta"in t?-t.wheelDelta:0},deltaZ:0,deltaMode:0}),T0=Lt(E0),R0=y({},Us,{newState:0,oldState:0}),D0=Lt(R0),B0=[9,13,27,32],Wo=Ui&&"CompositionEvent"in window,fn=null;Ui&&"documentMode"in document&&(fn=document.documentMode);var M0=Ui&&"TextEvent"in window&&!fn,Nd=Ui&&(!Wo||fn&&8<fn&&11>=fn),Hd=" ",Ud=!1;function Wd(t,s){switch(t){case"keyup":return B0.indexOf(s.keyCode)!==-1;case"keydown":return s.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function qd(t){return t=t.detail,typeof t=="object"&&"data"in t?t.data:null}var br=!1;function z0(t,s){switch(t){case"compositionend":return qd(s);case"keypress":return s.which!==32?null:(Ud=!0,Hd);case"textInput":return t=s.data,t===Hd&&Ud?null:t;default:return null}}function A0(t,s){if(br)return t==="compositionend"||!Wo&&Wd(t,s)?(t=zd(),Ml=Lo=os=null,br=!1,t):null;switch(t){case"paste":return null;case"keypress":if(!(s.ctrlKey||s.altKey||s.metaKey)||s.ctrlKey&&s.altKey){if(s.char&&1<s.char.length)return s.char;if(s.which)return String.fromCharCode(s.which)}return null;case"compositionend":return Nd&&s.locale!=="ko"?null:s.data;default:return null}}var O0={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 Pd(t){var s=t&&t.nodeName&&t.nodeName.toLowerCase();return s==="input"?!!O0[t.type]:s==="textarea"}function Id(t,s,r,a){yr?Sr?Sr.push(a):Sr=[a]:yr=a,s=Ca(s,"onChange"),0<s.length&&(r=new Ol("onChange","change",null,r,a),t.push({event:r,listeners:s}))}var pn=null,_n=null;function L0(t){E_(t,0)}function jl(t){var s=on(t);if(Cd(s))return t}function Yd(t,s){if(t==="change")return s}var $d=!1;if(Ui){var qo;if(Ui){var Po="oninput"in document;if(!Po){var Kd=document.createElement("div");Kd.setAttribute("oninput","return;"),Po=typeof Kd.oninput=="function"}qo=Po}else qo=!1;$d=qo&&(!document.documentMode||9<document.documentMode)}function Fd(){pn&&(pn.detachEvent("onpropertychange",Gd),_n=pn=null)}function Gd(t){if(t.propertyName==="value"&&jl(_n)){var s=[];Id(s,_n,t,zo(t)),Md(L0,s)}}function j0(t,s,r){t==="focusin"?(Fd(),pn=s,_n=r,pn.attachEvent("onpropertychange",Gd)):t==="focusout"&&Fd()}function N0(t){if(t==="selectionchange"||t==="keyup"||t==="keydown")return jl(_n)}function H0(t,s){if(t==="click")return jl(s)}function U0(t,s){if(t==="input"||t==="change")return jl(s)}function W0(t,s){return t===s&&(t!==0||1/t===1/s)||t!==t&&s!==s}var $t=typeof Object.is=="function"?Object.is:W0;function gn(t,s){if($t(t,s))return!0;if(typeof t!="object"||t===null||typeof s!="object"||s===null)return!1;var r=Object.keys(t),a=Object.keys(s);if(r.length!==a.length)return!1;for(a=0;a<r.length;a++){var c=r[a];if(!yo.call(s,c)||!$t(t[c],s[c]))return!1}return!0}function Xd(t){for(;t&&t.firstChild;)t=t.firstChild;return t}function Vd(t,s){var r=Xd(t);t=0;for(var a;r;){if(r.nodeType===3){if(a=t+r.textContent.length,t<=s&&a>=s)return{node:r,offset:s-t};t=a}e:{for(;r;){if(r.nextSibling){r=r.nextSibling;break e}r=r.parentNode}r=void 0}r=Xd(r)}}function Zd(t,s){return t&&s?t===s?!0:t&&t.nodeType===3?!1:s&&s.nodeType===3?Zd(t,s.parentNode):"contains"in t?t.contains(s):t.compareDocumentPosition?!!(t.compareDocumentPosition(s)&16):!1:!1}function Qd(t){t=t!=null&&t.ownerDocument!=null&&t.ownerDocument.defaultView!=null?t.ownerDocument.defaultView:window;for(var s=Dl(t.document);s instanceof t.HTMLIFrameElement;){try{var r=typeof s.contentWindow.location.href=="string"}catch{r=!1}if(r)t=s.contentWindow;else break;s=Dl(t.document)}return s}function Io(t){var s=t&&t.nodeName&&t.nodeName.toLowerCase();return s&&(s==="input"&&(t.type==="text"||t.type==="search"||t.type==="tel"||t.type==="url"||t.type==="password")||s==="textarea"||t.contentEditable==="true")}var q0=Ui&&"documentMode"in document&&11>=document.documentMode,xr=null,Yo=null,mn=null,$o=!1;function Jd(t,s,r){var a=r.window===r?r.document:r.nodeType===9?r:r.ownerDocument;$o||xr==null||xr!==Dl(a)||(a=xr,"selectionStart"in a&&Io(a)?a={start:a.selectionStart,end:a.selectionEnd}:(a=(a.ownerDocument&&a.ownerDocument.defaultView||window).getSelection(),a={anchorNode:a.anchorNode,anchorOffset:a.anchorOffset,focusNode:a.focusNode,focusOffset:a.focusOffset}),mn&&gn(mn,a)||(mn=a,a=Ca(Yo,"onSelect"),0<a.length&&(s=new Ol("onSelect","select",null,s,r),t.push({event:s,listeners:a}),s.target=xr)))}function Ws(t,s){var r={};return r[t.toLowerCase()]=s.toLowerCase(),r["Webkit"+t]="webkit"+s,r["Moz"+t]="moz"+s,r}var wr={animationend:Ws("Animation","AnimationEnd"),animationiteration:Ws("Animation","AnimationIteration"),animationstart:Ws("Animation","AnimationStart"),transitionrun:Ws("Transition","TransitionRun"),transitionstart:Ws("Transition","TransitionStart"),transitioncancel:Ws("Transition","TransitionCancel"),transitionend:Ws("Transition","TransitionEnd")},Ko={},ef={};Ui&&(ef=document.createElement("div").style,"AnimationEvent"in window||(delete wr.animationend.animation,delete wr.animationiteration.animation,delete wr.animationstart.animation),"TransitionEvent"in window||delete wr.transitionend.transition);function qs(t){if(Ko[t])return Ko[t];if(!wr[t])return t;var s=wr[t],r;for(r in s)if(s.hasOwnProperty(r)&&r in ef)return Ko[t]=s[r];return t}var tf=qs("animationend"),sf=qs("animationiteration"),rf=qs("animationstart"),P0=qs("transitionrun"),I0=qs("transitionstart"),Y0=qs("transitioncancel"),nf=qs("transitionend"),lf=new Map,Fo="abort auxClick beforeToggle cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");Fo.push("scrollEnd");function vi(t,s){lf.set(t,s),Hs(s,[t])}var Nl=typeof reportError=="function"?reportError:function(t){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var s=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof t=="object"&&t!==null&&typeof t.message=="string"?String(t.message):String(t),error:t});if(!window.dispatchEvent(s))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",t);return}console.error(t)},ri=[],Cr=0,Go=0;function Hl(){for(var t=Cr,s=Go=Cr=0;s<t;){var r=ri[s];ri[s++]=null;var a=ri[s];ri[s++]=null;var c=ri[s];ri[s++]=null;var u=ri[s];if(ri[s++]=null,a!==null&&c!==null){var m=a.pending;m===null?c.next=c:(c.next=m.next,m.next=c),a.pending=c}u!==0&&af(r,c,u)}}function Ul(t,s,r,a){ri[Cr++]=t,ri[Cr++]=s,ri[Cr++]=r,ri[Cr++]=a,Go|=a,t.lanes|=a,t=t.alternate,t!==null&&(t.lanes|=a)}function Xo(t,s,r,a){return Ul(t,s,r,a),Wl(t)}function Ps(t,s){return Ul(t,null,null,s),Wl(t)}function af(t,s,r){t.lanes|=r;var a=t.alternate;a!==null&&(a.lanes|=r);for(var c=!1,u=t.return;u!==null;)u.childLanes|=r,a=u.alternate,a!==null&&(a.childLanes|=r),u.tag===22&&(t=u.stateNode,t===null||t._visibility&1||(c=!0)),t=u,u=u.return;return t.tag===3?(u=t.stateNode,c&&s!==null&&(c=31-Yt(r),t=u.hiddenUpdates,a=t[c],a===null?t[c]=[s]:a.push(s),s.lane=r|536870912),u):null}function Wl(t){if(50<Un)throw Un=0,rh=null,Error(l(185));for(var s=t.return;s!==null;)t=s,s=t.return;return t.tag===3?t.stateNode:null}var kr={};function $0(t,s,r,a){this.tag=t,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=s,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=a,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Kt(t,s,r,a){return new $0(t,s,r,a)}function Vo(t){return t=t.prototype,!(!t||!t.isReactComponent)}function Wi(t,s){var r=t.alternate;return r===null?(r=Kt(t.tag,s,t.key,t.mode),r.elementType=t.elementType,r.type=t.type,r.stateNode=t.stateNode,r.alternate=t,t.alternate=r):(r.pendingProps=s,r.type=t.type,r.flags=0,r.subtreeFlags=0,r.deletions=null),r.flags=t.flags&65011712,r.childLanes=t.childLanes,r.lanes=t.lanes,r.child=t.child,r.memoizedProps=t.memoizedProps,r.memoizedState=t.memoizedState,r.updateQueue=t.updateQueue,s=t.dependencies,r.dependencies=s===null?null:{lanes:s.lanes,firstContext:s.firstContext},r.sibling=t.sibling,r.index=t.index,r.ref=t.ref,r.refCleanup=t.refCleanup,r}function of(t,s){t.flags&=65011714;var r=t.alternate;return r===null?(t.childLanes=0,t.lanes=s,t.child=null,t.subtreeFlags=0,t.memoizedProps=null,t.memoizedState=null,t.updateQueue=null,t.dependencies=null,t.stateNode=null):(t.childLanes=r.childLanes,t.lanes=r.lanes,t.child=r.child,t.subtreeFlags=0,t.deletions=null,t.memoizedProps=r.memoizedProps,t.memoizedState=r.memoizedState,t.updateQueue=r.updateQueue,t.type=r.type,s=r.dependencies,t.dependencies=s===null?null:{lanes:s.lanes,firstContext:s.firstContext}),t}function ql(t,s,r,a,c,u){var m=0;if(a=t,typeof t=="function")Vo(t)&&(m=1);else if(typeof t=="string")m=Vy(t,r,te.current)?26:t==="html"||t==="head"||t==="body"?27:5;else e:switch(t){case ge:return t=Kt(31,r,s,c),t.elementType=ge,t.lanes=u,t;case T:return Is(r.children,c,u,s);case M:m=8,c|=24;break;case A:return t=Kt(12,r,s,c|2),t.elementType=A,t.lanes=u,t;case H:return t=Kt(13,r,s,c),t.elementType=H,t.lanes=u,t;case X:return t=Kt(19,r,s,c),t.elementType=X,t.lanes=u,t;default:if(typeof t=="object"&&t!==null)switch(t.$$typeof){case D:m=10;break e;case O:m=9;break e;case L:m=11;break e;case V:m=14;break e;case ue:m=16,a=null;break e}m=29,r=Error(l(130,t===null?"null":typeof t,"")),a=null}return s=Kt(m,r,s,c),s.elementType=t,s.type=a,s.lanes=u,s}function Is(t,s,r,a){return t=Kt(7,t,a,s),t.lanes=r,t}function Zo(t,s,r){return t=Kt(6,t,null,s),t.lanes=r,t}function cf(t){var s=Kt(18,null,null,0);return s.stateNode=t,s}function Qo(t,s,r){return s=Kt(4,t.children!==null?t.children:[],t.key,s),s.lanes=r,s.stateNode={containerInfo:t.containerInfo,pendingChildren:null,implementation:t.implementation},s}var hf=new WeakMap;function ni(t,s){if(typeof t=="object"&&t!==null){var r=hf.get(t);return r!==void 0?r:(s={value:t,source:s,stack:od(s)},hf.set(t,s),s)}return{value:t,source:s,stack:od(s)}}var Er=[],Tr=0,Pl=null,vn=0,li=[],ai=0,cs=null,ki=1,Ei="";function qi(t,s){Er[Tr++]=vn,Er[Tr++]=Pl,Pl=t,vn=s}function uf(t,s,r){li[ai++]=ki,li[ai++]=Ei,li[ai++]=cs,cs=t;var a=ki;t=Ei;var c=32-Yt(a)-1;a&=~(1<<c),r+=1;var u=32-Yt(s)+c;if(30<u){var m=c-c%5;u=(a&(1<<m)-1).toString(32),a>>=m,c-=m,ki=1<<32-Yt(s)+c|r<<c|a,Ei=u+t}else ki=1<<u|r<<c|a,Ei=t}function Jo(t){t.return!==null&&(qi(t,1),uf(t,1,0))}function ec(t){for(;t===Pl;)Pl=Er[--Tr],Er[Tr]=null,vn=Er[--Tr],Er[Tr]=null;for(;t===cs;)cs=li[--ai],li[ai]=null,Ei=li[--ai],li[ai]=null,ki=li[--ai],li[ai]=null}function df(t,s){li[ai++]=ki,li[ai++]=Ei,li[ai++]=cs,ki=s.id,Ei=s.overflow,cs=t}var bt=null,qe=null,Ee=!1,hs=null,oi=!1,tc=Error(l(519));function us(t){var s=Error(l(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw yn(ni(s,t)),tc}function ff(t){var s=t.stateNode,r=t.type,a=t.memoizedProps;switch(s[St]=t,s[Ot]=a,r){case"dialog":we("cancel",s),we("close",s);break;case"iframe":case"object":case"embed":we("load",s);break;case"video":case"audio":for(r=0;r<qn.length;r++)we(qn[r],s);break;case"source":we("error",s);break;case"img":case"image":case"link":we("error",s),we("load",s);break;case"details":we("toggle",s);break;case"input":we("invalid",s),kd(s,a.value,a.defaultValue,a.checked,a.defaultChecked,a.type,a.name,!0);break;case"select":we("invalid",s);break;case"textarea":we("invalid",s),Td(s,a.value,a.defaultValue,a.children)}r=a.children,typeof r!="string"&&typeof r!="number"&&typeof r!="bigint"||s.textContent===""+r||a.suppressHydrationWarning===!0||B_(s.textContent,r)?(a.popover!=null&&(we("beforetoggle",s),we("toggle",s)),a.onScroll!=null&&we("scroll",s),a.onScrollEnd!=null&&we("scrollend",s),a.onClick!=null&&(s.onclick=Hi),s=!0):s=!1,s||us(t,!0)}function pf(t){for(bt=t.return;bt;)switch(bt.tag){case 5:case 31:case 13:oi=!1;return;case 27:case 3:oi=!0;return;default:bt=bt.return}}function Rr(t){if(t!==bt)return!1;if(!Ee)return pf(t),Ee=!0,!1;var s=t.tag,r;if((r=s!==3&&s!==27)&&((r=s===5)&&(r=t.type,r=!(r!=="form"&&r!=="button")||yh(t.type,t.memoizedProps)),r=!r),r&&qe&&us(t),pf(t),s===13){if(t=t.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(l(317));qe=U_(t)}else if(s===31){if(t=t.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(l(317));qe=U_(t)}else s===27?(s=qe,ks(t.type)?(t=Ch,Ch=null,qe=t):qe=s):qe=bt?hi(t.stateNode.nextSibling):null;return!0}function Ys(){qe=bt=null,Ee=!1}function ic(){var t=hs;return t!==null&&(Ut===null?Ut=t:Ut.push.apply(Ut,t),hs=null),t}function yn(t){hs===null?hs=[t]:hs.push(t)}var sc=k(null),$s=null,Pi=null;function ds(t,s,r){J(sc,s._currentValue),s._currentValue=r}function Ii(t){t._currentValue=sc.current,P(sc)}function rc(t,s,r){for(;t!==null;){var a=t.alternate;if((t.childLanes&s)!==s?(t.childLanes|=s,a!==null&&(a.childLanes|=s)):a!==null&&(a.childLanes&s)!==s&&(a.childLanes|=s),t===r)break;t=t.return}}function nc(t,s,r,a){var c=t.child;for(c!==null&&(c.return=t);c!==null;){var u=c.dependencies;if(u!==null){var m=c.child;u=u.firstContext;e:for(;u!==null;){var v=u;u=c;for(var w=0;w<s.length;w++)if(v.context===s[w]){u.lanes|=r,v=u.alternate,v!==null&&(v.lanes|=r),rc(u.return,r,t),a||(m=null);break e}u=v.next}}else if(c.tag===18){if(m=c.return,m===null)throw Error(l(341));m.lanes|=r,u=m.alternate,u!==null&&(u.lanes|=r),rc(m,r,t),m=null}else m=c.child;if(m!==null)m.return=c;else for(m=c;m!==null;){if(m===t){m=null;break}if(c=m.sibling,c!==null){c.return=m.return,m=c;break}m=m.return}c=m}}function Dr(t,s,r,a){t=null;for(var c=s,u=!1;c!==null;){if(!u){if((c.flags&524288)!==0)u=!0;else if((c.flags&262144)!==0)break}if(c.tag===10){var m=c.alternate;if(m===null)throw Error(l(387));if(m=m.memoizedProps,m!==null){var v=c.type;$t(c.pendingProps.value,m.value)||(t!==null?t.push(v):t=[v])}}else if(c===be.current){if(m=c.alternate,m===null)throw Error(l(387));m.memoizedState.memoizedState!==c.memoizedState.memoizedState&&(t!==null?t.push(Kn):t=[Kn])}c=c.return}t!==null&&nc(s,t,r,a),s.flags|=262144}function Il(t){for(t=t.firstContext;t!==null;){if(!$t(t.context._currentValue,t.memoizedValue))return!0;t=t.next}return!1}function Ks(t){$s=t,Pi=null,t=t.dependencies,t!==null&&(t.firstContext=null)}function xt(t){return _f($s,t)}function Yl(t,s){return $s===null&&Ks(t),_f(t,s)}function _f(t,s){var r=s._currentValue;if(s={context:s,memoizedValue:r,next:null},Pi===null){if(t===null)throw Error(l(308));Pi=s,t.dependencies={lanes:0,firstContext:s},t.flags|=524288}else Pi=Pi.next=s;return r}var K0=typeof AbortController<"u"?AbortController:function(){var t=[],s=this.signal={aborted:!1,addEventListener:function(r,a){t.push(a)}};this.abort=function(){s.aborted=!0,t.forEach(function(r){return r()})}},F0=e.unstable_scheduleCallback,G0=e.unstable_NormalPriority,it={$$typeof:D,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function lc(){return{controller:new K0,data:new Map,refCount:0}}function Sn(t){t.refCount--,t.refCount===0&&F0(G0,function(){t.controller.abort()})}var bn=null,ac=0,Br=0,Mr=null;function X0(t,s){if(bn===null){var r=bn=[];ac=0,Br=hh(),Mr={status:"pending",value:void 0,then:function(a){r.push(a)}}}return ac++,s.then(gf,gf),s}function gf(){if(--ac===0&&bn!==null){Mr!==null&&(Mr.status="fulfilled");var t=bn;bn=null,Br=0,Mr=null;for(var s=0;s<t.length;s++)(0,t[s])()}}function V0(t,s){var r=[],a={status:"pending",value:null,reason:null,then:function(c){r.push(c)}};return t.then(function(){a.status="fulfilled",a.value=s;for(var c=0;c<r.length;c++)(0,r[c])(s)},function(c){for(a.status="rejected",a.reason=c,c=0;c<r.length;c++)(0,r[c])(void 0)}),a}var mf=R.S;R.S=function(t,s){e_=Pt(),typeof s=="object"&&s!==null&&typeof s.then=="function"&&X0(t,s),mf!==null&&mf(t,s)};var Fs=k(null);function oc(){var t=Fs.current;return t!==null?t:We.pooledCache}function $l(t,s){s===null?J(Fs,Fs.current):J(Fs,s.pool)}function vf(){var t=oc();return t===null?null:{parent:it._currentValue,pool:t}}var zr=Error(l(460)),cc=Error(l(474)),Kl=Error(l(542)),Fl={then:function(){}};function yf(t){return t=t.status,t==="fulfilled"||t==="rejected"}function Sf(t,s,r){switch(r=t[r],r===void 0?t.push(s):r!==s&&(s.then(Hi,Hi),s=r),s.status){case"fulfilled":return s.value;case"rejected":throw t=s.reason,xf(t),t;default:if(typeof s.status=="string")s.then(Hi,Hi);else{if(t=We,t!==null&&100<t.shellSuspendCounter)throw Error(l(482));t=s,t.status="pending",t.then(function(a){if(s.status==="pending"){var c=s;c.status="fulfilled",c.value=a}},function(a){if(s.status==="pending"){var c=s;c.status="rejected",c.reason=a}})}switch(s.status){case"fulfilled":return s.value;case"rejected":throw t=s.reason,xf(t),t}throw Xs=s,zr}}function Gs(t){try{var s=t._init;return s(t._payload)}catch(r){throw r!==null&&typeof r=="object"&&typeof r.then=="function"?(Xs=r,zr):r}}var Xs=null;function bf(){if(Xs===null)throw Error(l(459));var t=Xs;return Xs=null,t}function xf(t){if(t===zr||t===Kl)throw Error(l(483))}var Ar=null,xn=0;function Gl(t){var s=xn;return xn+=1,Ar===null&&(Ar=[]),Sf(Ar,t,s)}function wn(t,s){s=s.props.ref,t.ref=s!==void 0?s:null}function Xl(t,s){throw s.$$typeof===x?Error(l(525)):(t=Object.prototype.toString.call(s),Error(l(31,t==="[object Object]"?"object with keys {"+Object.keys(s).join(", ")+"}":t)))}function wf(t){function s(B,E){if(t){var j=B.deletions;j===null?(B.deletions=[E],B.flags|=16):j.push(E)}}function r(B,E){if(!t)return null;for(;E!==null;)s(B,E),E=E.sibling;return null}function a(B){for(var E=new Map;B!==null;)B.key!==null?E.set(B.key,B):E.set(B.index,B),B=B.sibling;return E}function c(B,E){return B=Wi(B,E),B.index=0,B.sibling=null,B}function u(B,E,j){return B.index=j,t?(j=B.alternate,j!==null?(j=j.index,j<E?(B.flags|=67108866,E):j):(B.flags|=67108866,E)):(B.flags|=1048576,E)}function m(B){return t&&B.alternate===null&&(B.flags|=67108866),B}function v(B,E,j,Y){return E===null||E.tag!==6?(E=Zo(j,B.mode,Y),E.return=B,E):(E=c(E,j),E.return=B,E)}function w(B,E,j,Y){var le=j.type;return le===T?q(B,E,j.props.children,Y,j.key):E!==null&&(E.elementType===le||typeof le=="object"&&le!==null&&le.$$typeof===ue&&Gs(le)===E.type)?(E=c(E,j.props),wn(E,j),E.return=B,E):(E=ql(j.type,j.key,j.props,null,B.mode,Y),wn(E,j),E.return=B,E)}function N(B,E,j,Y){return E===null||E.tag!==4||E.stateNode.containerInfo!==j.containerInfo||E.stateNode.implementation!==j.implementation?(E=Qo(j,B.mode,Y),E.return=B,E):(E=c(E,j.children||[]),E.return=B,E)}function q(B,E,j,Y,le){return E===null||E.tag!==7?(E=Is(j,B.mode,Y,le),E.return=B,E):(E=c(E,j),E.return=B,E)}function K(B,E,j){if(typeof E=="string"&&E!==""||typeof E=="number"||typeof E=="bigint")return E=Zo(""+E,B.mode,j),E.return=B,E;if(typeof E=="object"&&E!==null){switch(E.$$typeof){case C:return j=ql(E.type,E.key,E.props,null,B.mode,j),wn(j,E),j.return=B,j;case b:return E=Qo(E,B.mode,j),E.return=B,E;case ue:return E=Gs(E),K(B,E,j)}if(ee(E)||Z(E))return E=Is(E,B.mode,j,null),E.return=B,E;if(typeof E.then=="function")return K(B,Gl(E),j);if(E.$$typeof===D)return K(B,Yl(B,E),j);Xl(B,E)}return null}function U(B,E,j,Y){var le=E!==null?E.key:null;if(typeof j=="string"&&j!==""||typeof j=="number"||typeof j=="bigint")return le!==null?null:v(B,E,""+j,Y);if(typeof j=="object"&&j!==null){switch(j.$$typeof){case C:return j.key===le?w(B,E,j,Y):null;case b:return j.key===le?N(B,E,j,Y):null;case ue:return j=Gs(j),U(B,E,j,Y)}if(ee(j)||Z(j))return le!==null?null:q(B,E,j,Y,null);if(typeof j.then=="function")return U(B,E,Gl(j),Y);if(j.$$typeof===D)return U(B,E,Yl(B,j),Y);Xl(B,j)}return null}function W(B,E,j,Y,le){if(typeof Y=="string"&&Y!==""||typeof Y=="number"||typeof Y=="bigint")return B=B.get(j)||null,v(E,B,""+Y,le);if(typeof Y=="object"&&Y!==null){switch(Y.$$typeof){case C:return B=B.get(Y.key===null?j:Y.key)||null,w(E,B,Y,le);case b:return B=B.get(Y.key===null?j:Y.key)||null,N(E,B,Y,le);case ue:return Y=Gs(Y),W(B,E,j,Y,le)}if(ee(Y)||Z(Y))return B=B.get(j)||null,q(E,B,Y,le,null);if(typeof Y.then=="function")return W(B,E,j,Gl(Y),le);if(Y.$$typeof===D)return W(B,E,j,Yl(E,Y),le);Xl(E,Y)}return null}function re(B,E,j,Y){for(var le=null,De=null,ne=E,ve=E=0,ke=null;ne!==null&&ve<j.length;ve++){ne.index>ve?(ke=ne,ne=null):ke=ne.sibling;var Be=U(B,ne,j[ve],Y);if(Be===null){ne===null&&(ne=ke);break}t&&ne&&Be.alternate===null&&s(B,ne),E=u(Be,E,ve),De===null?le=Be:De.sibling=Be,De=Be,ne=ke}if(ve===j.length)return r(B,ne),Ee&&qi(B,ve),le;if(ne===null){for(;ve<j.length;ve++)ne=K(B,j[ve],Y),ne!==null&&(E=u(ne,E,ve),De===null?le=ne:De.sibling=ne,De=ne);return Ee&&qi(B,ve),le}for(ne=a(ne);ve<j.length;ve++)ke=W(ne,B,ve,j[ve],Y),ke!==null&&(t&&ke.alternate!==null&&ne.delete(ke.key===null?ve:ke.key),E=u(ke,E,ve),De===null?le=ke:De.sibling=ke,De=ke);return t&&ne.forEach(function(Bs){return s(B,Bs)}),Ee&&qi(B,ve),le}function ce(B,E,j,Y){if(j==null)throw Error(l(151));for(var le=null,De=null,ne=E,ve=E=0,ke=null,Be=j.next();ne!==null&&!Be.done;ve++,Be=j.next()){ne.index>ve?(ke=ne,ne=null):ke=ne.sibling;var Bs=U(B,ne,Be.value,Y);if(Bs===null){ne===null&&(ne=ke);break}t&&ne&&Bs.alternate===null&&s(B,ne),E=u(Bs,E,ve),De===null?le=Bs:De.sibling=Bs,De=Bs,ne=ke}if(Be.done)return r(B,ne),Ee&&qi(B,ve),le;if(ne===null){for(;!Be.done;ve++,Be=j.next())Be=K(B,Be.value,Y),Be!==null&&(E=u(Be,E,ve),De===null?le=Be:De.sibling=Be,De=Be);return Ee&&qi(B,ve),le}for(ne=a(ne);!Be.done;ve++,Be=j.next())Be=W(ne,B,ve,Be.value,Y),Be!==null&&(t&&Be.alternate!==null&&ne.delete(Be.key===null?ve:Be.key),E=u(Be,E,ve),De===null?le=Be:De.sibling=Be,De=Be);return t&&ne.forEach(function(aS){return s(B,aS)}),Ee&&qi(B,ve),le}function He(B,E,j,Y){if(typeof j=="object"&&j!==null&&j.type===T&&j.key===null&&(j=j.props.children),typeof j=="object"&&j!==null){switch(j.$$typeof){case C:e:{for(var le=j.key;E!==null;){if(E.key===le){if(le=j.type,le===T){if(E.tag===7){r(B,E.sibling),Y=c(E,j.props.children),Y.return=B,B=Y;break e}}else if(E.elementType===le||typeof le=="object"&&le!==null&&le.$$typeof===ue&&Gs(le)===E.type){r(B,E.sibling),Y=c(E,j.props),wn(Y,j),Y.return=B,B=Y;break e}r(B,E);break}else s(B,E);E=E.sibling}j.type===T?(Y=Is(j.props.children,B.mode,Y,j.key),Y.return=B,B=Y):(Y=ql(j.type,j.key,j.props,null,B.mode,Y),wn(Y,j),Y.return=B,B=Y)}return m(B);case b:e:{for(le=j.key;E!==null;){if(E.key===le)if(E.tag===4&&E.stateNode.containerInfo===j.containerInfo&&E.stateNode.implementation===j.implementation){r(B,E.sibling),Y=c(E,j.children||[]),Y.return=B,B=Y;break e}else{r(B,E);break}else s(B,E);E=E.sibling}Y=Qo(j,B.mode,Y),Y.return=B,B=Y}return m(B);case ue:return j=Gs(j),He(B,E,j,Y)}if(ee(j))return re(B,E,j,Y);if(Z(j)){if(le=Z(j),typeof le!="function")throw Error(l(150));return j=le.call(j),ce(B,E,j,Y)}if(typeof j.then=="function")return He(B,E,Gl(j),Y);if(j.$$typeof===D)return He(B,E,Yl(B,j),Y);Xl(B,j)}return typeof j=="string"&&j!==""||typeof j=="number"||typeof j=="bigint"?(j=""+j,E!==null&&E.tag===6?(r(B,E.sibling),Y=c(E,j),Y.return=B,B=Y):(r(B,E),Y=Zo(j,B.mode,Y),Y.return=B,B=Y),m(B)):r(B,E)}return function(B,E,j,Y){try{xn=0;var le=He(B,E,j,Y);return Ar=null,le}catch(ne){if(ne===zr||ne===Kl)throw ne;var De=Kt(29,ne,null,B.mode);return De.lanes=Y,De.return=B,De}}}var Vs=wf(!0),Cf=wf(!1),fs=!1;function hc(t){t.updateQueue={baseState:t.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function uc(t,s){t=t.updateQueue,s.updateQueue===t&&(s.updateQueue={baseState:t.baseState,firstBaseUpdate:t.firstBaseUpdate,lastBaseUpdate:t.lastBaseUpdate,shared:t.shared,callbacks:null})}function ps(t){return{lane:t,tag:0,payload:null,callback:null,next:null}}function _s(t,s,r){var a=t.updateQueue;if(a===null)return null;if(a=a.shared,(Me&2)!==0){var c=a.pending;return c===null?s.next=s:(s.next=c.next,c.next=s),a.pending=s,s=Wl(t),af(t,null,r),s}return Ul(t,a,s,r),Wl(t)}function Cn(t,s,r){if(s=s.updateQueue,s!==null&&(s=s.shared,(r&4194048)!==0)){var a=s.lanes;a&=t.pendingLanes,r|=a,s.lanes=r,pd(t,r)}}function dc(t,s){var r=t.updateQueue,a=t.alternate;if(a!==null&&(a=a.updateQueue,r===a)){var c=null,u=null;if(r=r.firstBaseUpdate,r!==null){do{var m={lane:r.lane,tag:r.tag,payload:r.payload,callback:null,next:null};u===null?c=u=m:u=u.next=m,r=r.next}while(r!==null);u===null?c=u=s:u=u.next=s}else c=u=s;r={baseState:a.baseState,firstBaseUpdate:c,lastBaseUpdate:u,shared:a.shared,callbacks:a.callbacks},t.updateQueue=r;return}t=r.lastBaseUpdate,t===null?r.firstBaseUpdate=s:t.next=s,r.lastBaseUpdate=s}var fc=!1;function kn(){if(fc){var t=Mr;if(t!==null)throw t}}function En(t,s,r,a){fc=!1;var c=t.updateQueue;fs=!1;var u=c.firstBaseUpdate,m=c.lastBaseUpdate,v=c.shared.pending;if(v!==null){c.shared.pending=null;var w=v,N=w.next;w.next=null,m===null?u=N:m.next=N,m=w;var q=t.alternate;q!==null&&(q=q.updateQueue,v=q.lastBaseUpdate,v!==m&&(v===null?q.firstBaseUpdate=N:v.next=N,q.lastBaseUpdate=w))}if(u!==null){var K=c.baseState;m=0,q=N=w=null,v=u;do{var U=v.lane&-536870913,W=U!==v.lane;if(W?(Ce&U)===U:(a&U)===U){U!==0&&U===Br&&(fc=!0),q!==null&&(q=q.next={lane:0,tag:v.tag,payload:v.payload,callback:null,next:null});e:{var re=t,ce=v;U=s;var He=r;switch(ce.tag){case 1:if(re=ce.payload,typeof re=="function"){K=re.call(He,K,U);break e}K=re;break e;case 3:re.flags=re.flags&-65537|128;case 0:if(re=ce.payload,U=typeof re=="function"?re.call(He,K,U):re,U==null)break e;K=y({},K,U);break e;case 2:fs=!0}}U=v.callback,U!==null&&(t.flags|=64,W&&(t.flags|=8192),W=c.callbacks,W===null?c.callbacks=[U]:W.push(U))}else W={lane:U,tag:v.tag,payload:v.payload,callback:v.callback,next:null},q===null?(N=q=W,w=K):q=q.next=W,m|=U;if(v=v.next,v===null){if(v=c.shared.pending,v===null)break;W=v,v=W.next,W.next=null,c.lastBaseUpdate=W,c.shared.pending=null}}while(!0);q===null&&(w=K),c.baseState=w,c.firstBaseUpdate=N,c.lastBaseUpdate=q,u===null&&(c.shared.lanes=0),Ss|=m,t.lanes=m,t.memoizedState=K}}function kf(t,s){if(typeof t!="function")throw Error(l(191,t));t.call(s)}function Ef(t,s){var r=t.callbacks;if(r!==null)for(t.callbacks=null,t=0;t<r.length;t++)kf(r[t],s)}var Or=k(null),Vl=k(0);function Tf(t,s){t=Qi,J(Vl,t),J(Or,s),Qi=t|s.baseLanes}function pc(){J(Vl,Qi),J(Or,Or.current)}function _c(){Qi=Vl.current,P(Or),P(Vl)}var Ft=k(null),ci=null;function gs(t){var s=t.alternate;J(Je,Je.current&1),J(Ft,t),ci===null&&(s===null||Or.current!==null||s.memoizedState!==null)&&(ci=t)}function gc(t){J(Je,Je.current),J(Ft,t),ci===null&&(ci=t)}function Rf(t){t.tag===22?(J(Je,Je.current),J(Ft,t),ci===null&&(ci=t)):ms()}function ms(){J(Je,Je.current),J(Ft,Ft.current)}function Gt(t){P(Ft),ci===t&&(ci=null),P(Je)}var Je=k(0);function Zl(t){for(var s=t;s!==null;){if(s.tag===13){var r=s.memoizedState;if(r!==null&&(r=r.dehydrated,r===null||xh(r)||wh(r)))return s}else if(s.tag===19&&(s.memoizedProps.revealOrder==="forwards"||s.memoizedProps.revealOrder==="backwards"||s.memoizedProps.revealOrder==="unstable_legacy-backwards"||s.memoizedProps.revealOrder==="together")){if((s.flags&128)!==0)return s}else if(s.child!==null){s.child.return=s,s=s.child;continue}if(s===t)break;for(;s.sibling===null;){if(s.return===null||s.return===t)return null;s=s.return}s.sibling.return=s.return,s=s.sibling}return null}var Yi=0,me=null,je=null,st=null,Ql=!1,Lr=!1,Zs=!1,Jl=0,Tn=0,jr=null,Z0=0;function Xe(){throw Error(l(321))}function mc(t,s){if(s===null)return!1;for(var r=0;r<s.length&&r<t.length;r++)if(!$t(t[r],s[r]))return!1;return!0}function vc(t,s,r,a,c,u){return Yi=u,me=s,s.memoizedState=null,s.updateQueue=null,s.lanes=0,R.H=t===null||t.memoizedState===null?up:Ac,Zs=!1,u=r(a,c),Zs=!1,Lr&&(u=Bf(s,r,a,c)),Df(t),u}function Df(t){R.H=Bn;var s=je!==null&&je.next!==null;if(Yi=0,st=je=me=null,Ql=!1,Tn=0,jr=null,s)throw Error(l(300));t===null||rt||(t=t.dependencies,t!==null&&Il(t)&&(rt=!0))}function Bf(t,s,r,a){me=t;var c=0;do{if(Lr&&(jr=null),Tn=0,Lr=!1,25<=c)throw Error(l(301));if(c+=1,st=je=null,t.updateQueue!=null){var u=t.updateQueue;u.lastEffect=null,u.events=null,u.stores=null,u.memoCache!=null&&(u.memoCache.index=0)}R.H=dp,u=s(r,a)}while(Lr);return u}function Q0(){var t=R.H,s=t.useState()[0];return s=typeof s.then=="function"?Rn(s):s,t=t.useState()[0],(je!==null?je.memoizedState:null)!==t&&(me.flags|=1024),s}function yc(){var t=Jl!==0;return Jl=0,t}function Sc(t,s,r){s.updateQueue=t.updateQueue,s.flags&=-2053,t.lanes&=~r}function bc(t){if(Ql){for(t=t.memoizedState;t!==null;){var s=t.queue;s!==null&&(s.pending=null),t=t.next}Ql=!1}Yi=0,st=je=me=null,Lr=!1,Tn=Jl=0,jr=null}function Dt(){var t={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return st===null?me.memoizedState=st=t:st=st.next=t,st}function et(){if(je===null){var t=me.alternate;t=t!==null?t.memoizedState:null}else t=je.next;var s=st===null?me.memoizedState:st.next;if(s!==null)st=s,je=t;else{if(t===null)throw me.alternate===null?Error(l(467)):Error(l(310));je=t,t={memoizedState:je.memoizedState,baseState:je.baseState,baseQueue:je.baseQueue,queue:je.queue,next:null},st===null?me.memoizedState=st=t:st=st.next=t}return st}function ea(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Rn(t){var s=Tn;return Tn+=1,jr===null&&(jr=[]),t=Sf(jr,t,s),s=me,(st===null?s.memoizedState:st.next)===null&&(s=s.alternate,R.H=s===null||s.memoizedState===null?up:Ac),t}function ta(t){if(t!==null&&typeof t=="object"){if(typeof t.then=="function")return Rn(t);if(t.$$typeof===D)return xt(t)}throw Error(l(438,String(t)))}function xc(t){var s=null,r=me.updateQueue;if(r!==null&&(s=r.memoCache),s==null){var a=me.alternate;a!==null&&(a=a.updateQueue,a!==null&&(a=a.memoCache,a!=null&&(s={data:a.data.map(function(c){return c.slice()}),index:0})))}if(s==null&&(s={data:[],index:0}),r===null&&(r=ea(),me.updateQueue=r),r.memoCache=s,r=s.data[s.index],r===void 0)for(r=s.data[s.index]=Array(t),a=0;a<t;a++)r[a]=Ke;return s.index++,r}function $i(t,s){return typeof s=="function"?s(t):s}function ia(t){var s=et();return wc(s,je,t)}function wc(t,s,r){var a=t.queue;if(a===null)throw Error(l(311));a.lastRenderedReducer=r;var c=t.baseQueue,u=a.pending;if(u!==null){if(c!==null){var m=c.next;c.next=u.next,u.next=m}s.baseQueue=c=u,a.pending=null}if(u=t.baseState,c===null)t.memoizedState=u;else{s=c.next;var v=m=null,w=null,N=s,q=!1;do{var K=N.lane&-536870913;if(K!==N.lane?(Ce&K)===K:(Yi&K)===K){var U=N.revertLane;if(U===0)w!==null&&(w=w.next={lane:0,revertLane:0,gesture:null,action:N.action,hasEagerState:N.hasEagerState,eagerState:N.eagerState,next:null}),K===Br&&(q=!0);else if((Yi&U)===U){N=N.next,U===Br&&(q=!0);continue}else K={lane:0,revertLane:N.revertLane,gesture:null,action:N.action,hasEagerState:N.hasEagerState,eagerState:N.eagerState,next:null},w===null?(v=w=K,m=u):w=w.next=K,me.lanes|=U,Ss|=U;K=N.action,Zs&&r(u,K),u=N.hasEagerState?N.eagerState:r(u,K)}else U={lane:K,revertLane:N.revertLane,gesture:N.gesture,action:N.action,hasEagerState:N.hasEagerState,eagerState:N.eagerState,next:null},w===null?(v=w=U,m=u):w=w.next=U,me.lanes|=K,Ss|=K;N=N.next}while(N!==null&&N!==s);if(w===null?m=u:w.next=v,!$t(u,t.memoizedState)&&(rt=!0,q&&(r=Mr,r!==null)))throw r;t.memoizedState=u,t.baseState=m,t.baseQueue=w,a.lastRenderedState=u}return c===null&&(a.lanes=0),[t.memoizedState,a.dispatch]}function Cc(t){var s=et(),r=s.queue;if(r===null)throw Error(l(311));r.lastRenderedReducer=t;var a=r.dispatch,c=r.pending,u=s.memoizedState;if(c!==null){r.pending=null;var m=c=c.next;do u=t(u,m.action),m=m.next;while(m!==c);$t(u,s.memoizedState)||(rt=!0),s.memoizedState=u,s.baseQueue===null&&(s.baseState=u),r.lastRenderedState=u}return[u,a]}function Mf(t,s,r){var a=me,c=et(),u=Ee;if(u){if(r===void 0)throw Error(l(407));r=r()}else r=s();var m=!$t((je||c).memoizedState,r);if(m&&(c.memoizedState=r,rt=!0),c=c.queue,Tc(Of.bind(null,a,c,t),[t]),c.getSnapshot!==s||m||st!==null&&st.memoizedState.tag&1){if(a.flags|=2048,Nr(9,{destroy:void 0},Af.bind(null,a,c,r,s),null),We===null)throw Error(l(349));u||(Yi&127)!==0||zf(a,s,r)}return r}function zf(t,s,r){t.flags|=16384,t={getSnapshot:s,value:r},s=me.updateQueue,s===null?(s=ea(),me.updateQueue=s,s.stores=[t]):(r=s.stores,r===null?s.stores=[t]:r.push(t))}function Af(t,s,r,a){s.value=r,s.getSnapshot=a,Lf(s)&&jf(t)}function Of(t,s,r){return r(function(){Lf(s)&&jf(t)})}function Lf(t){var s=t.getSnapshot;t=t.value;try{var r=s();return!$t(t,r)}catch{return!0}}function jf(t){var s=Ps(t,2);s!==null&&Wt(s,t,2)}function kc(t){var s=Dt();if(typeof t=="function"){var r=t;if(t=r(),Zs){ls(!0);try{r()}finally{ls(!1)}}}return s.memoizedState=s.baseState=t,s.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:$i,lastRenderedState:t},s}function Nf(t,s,r,a){return t.baseState=r,wc(t,je,typeof a=="function"?a:$i)}function J0(t,s,r,a,c){if(na(t))throw Error(l(485));if(t=s.action,t!==null){var u={payload:c,action:t,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(m){u.listeners.push(m)}};R.T!==null?r(!0):u.isTransition=!1,a(u),r=s.pending,r===null?(u.next=s.pending=u,Hf(s,u)):(u.next=r.next,s.pending=r.next=u)}}function Hf(t,s){var r=s.action,a=s.payload,c=t.state;if(s.isTransition){var u=R.T,m={};R.T=m;try{var v=r(c,a),w=R.S;w!==null&&w(m,v),Uf(t,s,v)}catch(N){Ec(t,s,N)}finally{u!==null&&m.types!==null&&(u.types=m.types),R.T=u}}else try{u=r(c,a),Uf(t,s,u)}catch(N){Ec(t,s,N)}}function Uf(t,s,r){r!==null&&typeof r=="object"&&typeof r.then=="function"?r.then(function(a){Wf(t,s,a)},function(a){return Ec(t,s,a)}):Wf(t,s,r)}function Wf(t,s,r){s.status="fulfilled",s.value=r,qf(s),t.state=r,s=t.pending,s!==null&&(r=s.next,r===s?t.pending=null:(r=r.next,s.next=r,Hf(t,r)))}function Ec(t,s,r){var a=t.pending;if(t.pending=null,a!==null){a=a.next;do s.status="rejected",s.reason=r,qf(s),s=s.next;while(s!==a)}t.action=null}function qf(t){t=t.listeners;for(var s=0;s<t.length;s++)(0,t[s])()}function Pf(t,s){return s}function If(t,s){if(Ee){var r=We.formState;if(r!==null){e:{var a=me;if(Ee){if(qe){t:{for(var c=qe,u=oi;c.nodeType!==8;){if(!u){c=null;break t}if(c=hi(c.nextSibling),c===null){c=null;break t}}u=c.data,c=u==="F!"||u==="F"?c:null}if(c){qe=hi(c.nextSibling),a=c.data==="F!";break e}}us(a)}a=!1}a&&(s=r[0])}}return r=Dt(),r.memoizedState=r.baseState=s,a={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Pf,lastRenderedState:s},r.queue=a,r=op.bind(null,me,a),a.dispatch=r,a=kc(!1),u=zc.bind(null,me,!1,a.queue),a=Dt(),c={state:s,dispatch:null,action:t,pending:null},a.queue=c,r=J0.bind(null,me,c,u,r),c.dispatch=r,a.memoizedState=t,[s,r,!1]}function Yf(t){var s=et();return $f(s,je,t)}function $f(t,s,r){if(s=wc(t,s,Pf)[0],t=ia($i)[0],typeof s=="object"&&s!==null&&typeof s.then=="function")try{var a=Rn(s)}catch(m){throw m===zr?Kl:m}else a=s;s=et();var c=s.queue,u=c.dispatch;return r!==s.memoizedState&&(me.flags|=2048,Nr(9,{destroy:void 0},ey.bind(null,c,r),null)),[a,u,t]}function ey(t,s){t.action=s}function Kf(t){var s=et(),r=je;if(r!==null)return $f(s,r,t);et(),s=s.memoizedState,r=et();var a=r.queue.dispatch;return r.memoizedState=t,[s,a,!1]}function Nr(t,s,r,a){return t={tag:t,create:r,deps:a,inst:s,next:null},s=me.updateQueue,s===null&&(s=ea(),me.updateQueue=s),r=s.lastEffect,r===null?s.lastEffect=t.next=t:(a=r.next,r.next=t,t.next=a,s.lastEffect=t),t}function Ff(){return et().memoizedState}function sa(t,s,r,a){var c=Dt();me.flags|=t,c.memoizedState=Nr(1|s,{destroy:void 0},r,a===void 0?null:a)}function ra(t,s,r,a){var c=et();a=a===void 0?null:a;var u=c.memoizedState.inst;je!==null&&a!==null&&mc(a,je.memoizedState.deps)?c.memoizedState=Nr(s,u,r,a):(me.flags|=t,c.memoizedState=Nr(1|s,u,r,a))}function Gf(t,s){sa(8390656,8,t,s)}function Tc(t,s){ra(2048,8,t,s)}function ty(t){me.flags|=4;var s=me.updateQueue;if(s===null)s=ea(),me.updateQueue=s,s.events=[t];else{var r=s.events;r===null?s.events=[t]:r.push(t)}}function Xf(t){var s=et().memoizedState;return ty({ref:s,nextImpl:t}),function(){if((Me&2)!==0)throw Error(l(440));return s.impl.apply(void 0,arguments)}}function Vf(t,s){return ra(4,2,t,s)}function Zf(t,s){return ra(4,4,t,s)}function Qf(t,s){if(typeof s=="function"){t=t();var r=s(t);return function(){typeof r=="function"?r():s(null)}}if(s!=null)return t=t(),s.current=t,function(){s.current=null}}function Jf(t,s,r){r=r!=null?r.concat([t]):null,ra(4,4,Qf.bind(null,s,t),r)}function Rc(){}function ep(t,s){var r=et();s=s===void 0?null:s;var a=r.memoizedState;return s!==null&&mc(s,a[1])?a[0]:(r.memoizedState=[t,s],t)}function tp(t,s){var r=et();s=s===void 0?null:s;var a=r.memoizedState;if(s!==null&&mc(s,a[1]))return a[0];if(a=t(),Zs){ls(!0);try{t()}finally{ls(!1)}}return r.memoizedState=[a,s],a}function Dc(t,s,r){return r===void 0||(Yi&1073741824)!==0&&(Ce&261930)===0?t.memoizedState=s:(t.memoizedState=r,t=i_(),me.lanes|=t,Ss|=t,r)}function ip(t,s,r,a){return $t(r,s)?r:Or.current!==null?(t=Dc(t,r,a),$t(t,s)||(rt=!0),t):(Yi&42)===0||(Yi&1073741824)!==0&&(Ce&261930)===0?(rt=!0,t.memoizedState=r):(t=i_(),me.lanes|=t,Ss|=t,s)}function sp(t,s,r,a,c){var u=I.p;I.p=u!==0&&8>u?u:8;var m=R.T,v={};R.T=v,zc(t,!1,s,r);try{var w=c(),N=R.S;if(N!==null&&N(v,w),w!==null&&typeof w=="object"&&typeof w.then=="function"){var q=V0(w,a);Dn(t,s,q,Zt(t))}else Dn(t,s,a,Zt(t))}catch(K){Dn(t,s,{then:function(){},status:"rejected",reason:K},Zt())}finally{I.p=u,m!==null&&v.types!==null&&(m.types=v.types),R.T=m}}function iy(){}function Bc(t,s,r,a){if(t.tag!==5)throw Error(l(476));var c=rp(t).queue;sp(t,c,s,$,r===null?iy:function(){return np(t),r(a)})}function rp(t){var s=t.memoizedState;if(s!==null)return s;s={memoizedState:$,baseState:$,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:$i,lastRenderedState:$},next:null};var r={};return s.next={memoizedState:r,baseState:r,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:$i,lastRenderedState:r},next:null},t.memoizedState=s,t=t.alternate,t!==null&&(t.memoizedState=s),s}function np(t){var s=rp(t);s.next===null&&(s=t.alternate.memoizedState),Dn(t,s.next.queue,{},Zt())}function Mc(){return xt(Kn)}function lp(){return et().memoizedState}function ap(){return et().memoizedState}function sy(t){for(var s=t.return;s!==null;){switch(s.tag){case 24:case 3:var r=Zt();t=ps(r);var a=_s(s,t,r);a!==null&&(Wt(a,s,r),Cn(a,s,r)),s={cache:lc()},t.payload=s;return}s=s.return}}function ry(t,s,r){var a=Zt();r={lane:a,revertLane:0,gesture:null,action:r,hasEagerState:!1,eagerState:null,next:null},na(t)?cp(s,r):(r=Xo(t,s,r,a),r!==null&&(Wt(r,t,a),hp(r,s,a)))}function op(t,s,r){var a=Zt();Dn(t,s,r,a)}function Dn(t,s,r,a){var c={lane:a,revertLane:0,gesture:null,action:r,hasEagerState:!1,eagerState:null,next:null};if(na(t))cp(s,c);else{var u=t.alternate;if(t.lanes===0&&(u===null||u.lanes===0)&&(u=s.lastRenderedReducer,u!==null))try{var m=s.lastRenderedState,v=u(m,r);if(c.hasEagerState=!0,c.eagerState=v,$t(v,m))return Ul(t,s,c,0),We===null&&Hl(),!1}catch{}if(r=Xo(t,s,c,a),r!==null)return Wt(r,t,a),hp(r,s,a),!0}return!1}function zc(t,s,r,a){if(a={lane:2,revertLane:hh(),gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null},na(t)){if(s)throw Error(l(479))}else s=Xo(t,r,a,2),s!==null&&Wt(s,t,2)}function na(t){var s=t.alternate;return t===me||s!==null&&s===me}function cp(t,s){Lr=Ql=!0;var r=t.pending;r===null?s.next=s:(s.next=r.next,r.next=s),t.pending=s}function hp(t,s,r){if((r&4194048)!==0){var a=s.lanes;a&=t.pendingLanes,r|=a,s.lanes=r,pd(t,r)}}var Bn={readContext:xt,use:ta,useCallback:Xe,useContext:Xe,useEffect:Xe,useImperativeHandle:Xe,useLayoutEffect:Xe,useInsertionEffect:Xe,useMemo:Xe,useReducer:Xe,useRef:Xe,useState:Xe,useDebugValue:Xe,useDeferredValue:Xe,useTransition:Xe,useSyncExternalStore:Xe,useId:Xe,useHostTransitionStatus:Xe,useFormState:Xe,useActionState:Xe,useOptimistic:Xe,useMemoCache:Xe,useCacheRefresh:Xe};Bn.useEffectEvent=Xe;var up={readContext:xt,use:ta,useCallback:function(t,s){return Dt().memoizedState=[t,s===void 0?null:s],t},useContext:xt,useEffect:Gf,useImperativeHandle:function(t,s,r){r=r!=null?r.concat([t]):null,sa(4194308,4,Qf.bind(null,s,t),r)},useLayoutEffect:function(t,s){return sa(4194308,4,t,s)},useInsertionEffect:function(t,s){sa(4,2,t,s)},useMemo:function(t,s){var r=Dt();s=s===void 0?null:s;var a=t();if(Zs){ls(!0);try{t()}finally{ls(!1)}}return r.memoizedState=[a,s],a},useReducer:function(t,s,r){var a=Dt();if(r!==void 0){var c=r(s);if(Zs){ls(!0);try{r(s)}finally{ls(!1)}}}else c=s;return a.memoizedState=a.baseState=c,t={pending:null,lanes:0,dispatch:null,lastRenderedReducer:t,lastRenderedState:c},a.queue=t,t=t.dispatch=ry.bind(null,me,t),[a.memoizedState,t]},useRef:function(t){var s=Dt();return t={current:t},s.memoizedState=t},useState:function(t){t=kc(t);var s=t.queue,r=op.bind(null,me,s);return s.dispatch=r,[t.memoizedState,r]},useDebugValue:Rc,useDeferredValue:function(t,s){var r=Dt();return Dc(r,t,s)},useTransition:function(){var t=kc(!1);return t=sp.bind(null,me,t.queue,!0,!1),Dt().memoizedState=t,[!1,t]},useSyncExternalStore:function(t,s,r){var a=me,c=Dt();if(Ee){if(r===void 0)throw Error(l(407));r=r()}else{if(r=s(),We===null)throw Error(l(349));(Ce&127)!==0||zf(a,s,r)}c.memoizedState=r;var u={value:r,getSnapshot:s};return c.queue=u,Gf(Of.bind(null,a,u,t),[t]),a.flags|=2048,Nr(9,{destroy:void 0},Af.bind(null,a,u,r,s),null),r},useId:function(){var t=Dt(),s=We.identifierPrefix;if(Ee){var r=Ei,a=ki;r=(a&~(1<<32-Yt(a)-1)).toString(32)+r,s="_"+s+"R_"+r,r=Jl++,0<r&&(s+="H"+r.toString(32)),s+="_"}else r=Z0++,s="_"+s+"r_"+r.toString(32)+"_";return t.memoizedState=s},useHostTransitionStatus:Mc,useFormState:If,useActionState:If,useOptimistic:function(t){var s=Dt();s.memoizedState=s.baseState=t;var r={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return s.queue=r,s=zc.bind(null,me,!0,r),r.dispatch=s,[t,s]},useMemoCache:xc,useCacheRefresh:function(){return Dt().memoizedState=sy.bind(null,me)},useEffectEvent:function(t){var s=Dt(),r={impl:t};return s.memoizedState=r,function(){if((Me&2)!==0)throw Error(l(440));return r.impl.apply(void 0,arguments)}}},Ac={readContext:xt,use:ta,useCallback:ep,useContext:xt,useEffect:Tc,useImperativeHandle:Jf,useInsertionEffect:Vf,useLayoutEffect:Zf,useMemo:tp,useReducer:ia,useRef:Ff,useState:function(){return ia($i)},useDebugValue:Rc,useDeferredValue:function(t,s){var r=et();return ip(r,je.memoizedState,t,s)},useTransition:function(){var t=ia($i)[0],s=et().memoizedState;return[typeof t=="boolean"?t:Rn(t),s]},useSyncExternalStore:Mf,useId:lp,useHostTransitionStatus:Mc,useFormState:Yf,useActionState:Yf,useOptimistic:function(t,s){var r=et();return Nf(r,je,t,s)},useMemoCache:xc,useCacheRefresh:ap};Ac.useEffectEvent=Xf;var dp={readContext:xt,use:ta,useCallback:ep,useContext:xt,useEffect:Tc,useImperativeHandle:Jf,useInsertionEffect:Vf,useLayoutEffect:Zf,useMemo:tp,useReducer:Cc,useRef:Ff,useState:function(){return Cc($i)},useDebugValue:Rc,useDeferredValue:function(t,s){var r=et();return je===null?Dc(r,t,s):ip(r,je.memoizedState,t,s)},useTransition:function(){var t=Cc($i)[0],s=et().memoizedState;return[typeof t=="boolean"?t:Rn(t),s]},useSyncExternalStore:Mf,useId:lp,useHostTransitionStatus:Mc,useFormState:Kf,useActionState:Kf,useOptimistic:function(t,s){var r=et();return je!==null?Nf(r,je,t,s):(r.baseState=t,[t,r.queue.dispatch])},useMemoCache:xc,useCacheRefresh:ap};dp.useEffectEvent=Xf;function Oc(t,s,r,a){s=t.memoizedState,r=r(a,s),r=r==null?s:y({},s,r),t.memoizedState=r,t.lanes===0&&(t.updateQueue.baseState=r)}var Lc={enqueueSetState:function(t,s,r){t=t._reactInternals;var a=Zt(),c=ps(a);c.payload=s,r!=null&&(c.callback=r),s=_s(t,c,a),s!==null&&(Wt(s,t,a),Cn(s,t,a))},enqueueReplaceState:function(t,s,r){t=t._reactInternals;var a=Zt(),c=ps(a);c.tag=1,c.payload=s,r!=null&&(c.callback=r),s=_s(t,c,a),s!==null&&(Wt(s,t,a),Cn(s,t,a))},enqueueForceUpdate:function(t,s){t=t._reactInternals;var r=Zt(),a=ps(r);a.tag=2,s!=null&&(a.callback=s),s=_s(t,a,r),s!==null&&(Wt(s,t,r),Cn(s,t,r))}};function fp(t,s,r,a,c,u,m){return t=t.stateNode,typeof t.shouldComponentUpdate=="function"?t.shouldComponentUpdate(a,u,m):s.prototype&&s.prototype.isPureReactComponent?!gn(r,a)||!gn(c,u):!0}function pp(t,s,r,a){t=s.state,typeof s.componentWillReceiveProps=="function"&&s.componentWillReceiveProps(r,a),typeof s.UNSAFE_componentWillReceiveProps=="function"&&s.UNSAFE_componentWillReceiveProps(r,a),s.state!==t&&Lc.enqueueReplaceState(s,s.state,null)}function Qs(t,s){var r=s;if("ref"in s){r={};for(var a in s)a!=="ref"&&(r[a]=s[a])}if(t=t.defaultProps){r===s&&(r=y({},r));for(var c in t)r[c]===void 0&&(r[c]=t[c])}return r}function _p(t){Nl(t)}function gp(t){console.error(t)}function mp(t){Nl(t)}function la(t,s){try{var r=t.onUncaughtError;r(s.value,{componentStack:s.stack})}catch(a){setTimeout(function(){throw a})}}function vp(t,s,r){try{var a=t.onCaughtError;a(r.value,{componentStack:r.stack,errorBoundary:s.tag===1?s.stateNode:null})}catch(c){setTimeout(function(){throw c})}}function jc(t,s,r){return r=ps(r),r.tag=3,r.payload={element:null},r.callback=function(){la(t,s)},r}function yp(t){return t=ps(t),t.tag=3,t}function Sp(t,s,r,a){var c=r.type.getDerivedStateFromError;if(typeof c=="function"){var u=a.value;t.payload=function(){return c(u)},t.callback=function(){vp(s,r,a)}}var m=r.stateNode;m!==null&&typeof m.componentDidCatch=="function"&&(t.callback=function(){vp(s,r,a),typeof c!="function"&&(bs===null?bs=new Set([this]):bs.add(this));var v=a.stack;this.componentDidCatch(a.value,{componentStack:v!==null?v:""})})}function ny(t,s,r,a,c){if(r.flags|=32768,a!==null&&typeof a=="object"&&typeof a.then=="function"){if(s=r.alternate,s!==null&&Dr(s,r,c,!0),r=Ft.current,r!==null){switch(r.tag){case 31:case 13:return ci===null?va():r.alternate===null&&Ve===0&&(Ve=3),r.flags&=-257,r.flags|=65536,r.lanes=c,a===Fl?r.flags|=16384:(s=r.updateQueue,s===null?r.updateQueue=new Set([a]):s.add(a),ah(t,a,c)),!1;case 22:return r.flags|=65536,a===Fl?r.flags|=16384:(s=r.updateQueue,s===null?(s={transitions:null,markerInstances:null,retryQueue:new Set([a])},r.updateQueue=s):(r=s.retryQueue,r===null?s.retryQueue=new Set([a]):r.add(a)),ah(t,a,c)),!1}throw Error(l(435,r.tag))}return ah(t,a,c),va(),!1}if(Ee)return s=Ft.current,s!==null?((s.flags&65536)===0&&(s.flags|=256),s.flags|=65536,s.lanes=c,a!==tc&&(t=Error(l(422),{cause:a}),yn(ni(t,r)))):(a!==tc&&(s=Error(l(423),{cause:a}),yn(ni(s,r))),t=t.current.alternate,t.flags|=65536,c&=-c,t.lanes|=c,a=ni(a,r),c=jc(t.stateNode,a,c),dc(t,c),Ve!==4&&(Ve=2)),!1;var u=Error(l(520),{cause:a});if(u=ni(u,r),Hn===null?Hn=[u]:Hn.push(u),Ve!==4&&(Ve=2),s===null)return!0;a=ni(a,r),r=s;do{switch(r.tag){case 3:return r.flags|=65536,t=c&-c,r.lanes|=t,t=jc(r.stateNode,a,t),dc(r,t),!1;case 1:if(s=r.type,u=r.stateNode,(r.flags&128)===0&&(typeof s.getDerivedStateFromError=="function"||u!==null&&typeof u.componentDidCatch=="function"&&(bs===null||!bs.has(u))))return r.flags|=65536,c&=-c,r.lanes|=c,c=yp(c),Sp(c,t,r,a),dc(r,c),!1}r=r.return}while(r!==null);return!1}var Nc=Error(l(461)),rt=!1;function wt(t,s,r,a){s.child=t===null?Cf(s,null,r,a):Vs(s,t.child,r,a)}function bp(t,s,r,a,c){r=r.render;var u=s.ref;if("ref"in a){var m={};for(var v in a)v!=="ref"&&(m[v]=a[v])}else m=a;return Ks(s),a=vc(t,s,r,m,u,c),v=yc(),t!==null&&!rt?(Sc(t,s,c),Ki(t,s,c)):(Ee&&v&&Jo(s),s.flags|=1,wt(t,s,a,c),s.child)}function xp(t,s,r,a,c){if(t===null){var u=r.type;return typeof u=="function"&&!Vo(u)&&u.defaultProps===void 0&&r.compare===null?(s.tag=15,s.type=u,wp(t,s,u,a,c)):(t=ql(r.type,null,a,s,s.mode,c),t.ref=s.ref,t.return=s,s.child=t)}if(u=t.child,!$c(t,c)){var m=u.memoizedProps;if(r=r.compare,r=r!==null?r:gn,r(m,a)&&t.ref===s.ref)return Ki(t,s,c)}return s.flags|=1,t=Wi(u,a),t.ref=s.ref,t.return=s,s.child=t}function wp(t,s,r,a,c){if(t!==null){var u=t.memoizedProps;if(gn(u,a)&&t.ref===s.ref)if(rt=!1,s.pendingProps=a=u,$c(t,c))(t.flags&131072)!==0&&(rt=!0);else return s.lanes=t.lanes,Ki(t,s,c)}return Hc(t,s,r,a,c)}function Cp(t,s,r,a){var c=a.children,u=t!==null?t.memoizedState:null;if(t===null&&s.stateNode===null&&(s.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),a.mode==="hidden"){if((s.flags&128)!==0){if(u=u!==null?u.baseLanes|r:r,t!==null){for(a=s.child=t.child,c=0;a!==null;)c=c|a.lanes|a.childLanes,a=a.sibling;a=c&~u}else a=0,s.child=null;return kp(t,s,u,r,a)}if((r&536870912)!==0)s.memoizedState={baseLanes:0,cachePool:null},t!==null&&$l(s,u!==null?u.cachePool:null),u!==null?Tf(s,u):pc(),Rf(s);else return a=s.lanes=536870912,kp(t,s,u!==null?u.baseLanes|r:r,r,a)}else u!==null?($l(s,u.cachePool),Tf(s,u),ms(),s.memoizedState=null):(t!==null&&$l(s,null),pc(),ms());return wt(t,s,c,r),s.child}function Mn(t,s){return t!==null&&t.tag===22||s.stateNode!==null||(s.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),s.sibling}function kp(t,s,r,a,c){var u=oc();return u=u===null?null:{parent:it._currentValue,pool:u},s.memoizedState={baseLanes:r,cachePool:u},t!==null&&$l(s,null),pc(),Rf(s),t!==null&&Dr(t,s,a,!0),s.childLanes=c,null}function aa(t,s){return s=ca({mode:s.mode,children:s.children},t.mode),s.ref=t.ref,t.child=s,s.return=t,s}function Ep(t,s,r){return Vs(s,t.child,null,r),t=aa(s,s.pendingProps),t.flags|=2,Gt(s),s.memoizedState=null,t}function ly(t,s,r){var a=s.pendingProps,c=(s.flags&128)!==0;if(s.flags&=-129,t===null){if(Ee){if(a.mode==="hidden")return t=aa(s,a),s.lanes=536870912,Mn(null,t);if(gc(s),(t=qe)?(t=H_(t,oi),t=t!==null&&t.data==="&"?t:null,t!==null&&(s.memoizedState={dehydrated:t,treeContext:cs!==null?{id:ki,overflow:Ei}:null,retryLane:536870912,hydrationErrors:null},r=cf(t),r.return=s,s.child=r,bt=s,qe=null)):t=null,t===null)throw us(s);return s.lanes=536870912,null}return aa(s,a)}var u=t.memoizedState;if(u!==null){var m=u.dehydrated;if(gc(s),c)if(s.flags&256)s.flags&=-257,s=Ep(t,s,r);else if(s.memoizedState!==null)s.child=t.child,s.flags|=128,s=null;else throw Error(l(558));else if(rt||Dr(t,s,r,!1),c=(r&t.childLanes)!==0,rt||c){if(a=We,a!==null&&(m=_d(a,r),m!==0&&m!==u.retryLane))throw u.retryLane=m,Ps(t,m),Wt(a,t,m),Nc;va(),s=Ep(t,s,r)}else t=u.treeContext,qe=hi(m.nextSibling),bt=s,Ee=!0,hs=null,oi=!1,t!==null&&df(s,t),s=aa(s,a),s.flags|=4096;return s}return t=Wi(t.child,{mode:a.mode,children:a.children}),t.ref=s.ref,s.child=t,t.return=s,t}function oa(t,s){var r=s.ref;if(r===null)t!==null&&t.ref!==null&&(s.flags|=4194816);else{if(typeof r!="function"&&typeof r!="object")throw Error(l(284));(t===null||t.ref!==r)&&(s.flags|=4194816)}}function Hc(t,s,r,a,c){return Ks(s),r=vc(t,s,r,a,void 0,c),a=yc(),t!==null&&!rt?(Sc(t,s,c),Ki(t,s,c)):(Ee&&a&&Jo(s),s.flags|=1,wt(t,s,r,c),s.child)}function Tp(t,s,r,a,c,u){return Ks(s),s.updateQueue=null,r=Bf(s,a,r,c),Df(t),a=yc(),t!==null&&!rt?(Sc(t,s,u),Ki(t,s,u)):(Ee&&a&&Jo(s),s.flags|=1,wt(t,s,r,u),s.child)}function Rp(t,s,r,a,c){if(Ks(s),s.stateNode===null){var u=kr,m=r.contextType;typeof m=="object"&&m!==null&&(u=xt(m)),u=new r(a,u),s.memoizedState=u.state!==null&&u.state!==void 0?u.state:null,u.updater=Lc,s.stateNode=u,u._reactInternals=s,u=s.stateNode,u.props=a,u.state=s.memoizedState,u.refs={},hc(s),m=r.contextType,u.context=typeof m=="object"&&m!==null?xt(m):kr,u.state=s.memoizedState,m=r.getDerivedStateFromProps,typeof m=="function"&&(Oc(s,r,m,a),u.state=s.memoizedState),typeof r.getDerivedStateFromProps=="function"||typeof u.getSnapshotBeforeUpdate=="function"||typeof u.UNSAFE_componentWillMount!="function"&&typeof u.componentWillMount!="function"||(m=u.state,typeof u.componentWillMount=="function"&&u.componentWillMount(),typeof u.UNSAFE_componentWillMount=="function"&&u.UNSAFE_componentWillMount(),m!==u.state&&Lc.enqueueReplaceState(u,u.state,null),En(s,a,u,c),kn(),u.state=s.memoizedState),typeof u.componentDidMount=="function"&&(s.flags|=4194308),a=!0}else if(t===null){u=s.stateNode;var v=s.memoizedProps,w=Qs(r,v);u.props=w;var N=u.context,q=r.contextType;m=kr,typeof q=="object"&&q!==null&&(m=xt(q));var K=r.getDerivedStateFromProps;q=typeof K=="function"||typeof u.getSnapshotBeforeUpdate=="function",v=s.pendingProps!==v,q||typeof u.UNSAFE_componentWillReceiveProps!="function"&&typeof u.componentWillReceiveProps!="function"||(v||N!==m)&&pp(s,u,a,m),fs=!1;var U=s.memoizedState;u.state=U,En(s,a,u,c),kn(),N=s.memoizedState,v||U!==N||fs?(typeof K=="function"&&(Oc(s,r,K,a),N=s.memoizedState),(w=fs||fp(s,r,w,a,U,N,m))?(q||typeof u.UNSAFE_componentWillMount!="function"&&typeof u.componentWillMount!="function"||(typeof u.componentWillMount=="function"&&u.componentWillMount(),typeof u.UNSAFE_componentWillMount=="function"&&u.UNSAFE_componentWillMount()),typeof u.componentDidMount=="function"&&(s.flags|=4194308)):(typeof u.componentDidMount=="function"&&(s.flags|=4194308),s.memoizedProps=a,s.memoizedState=N),u.props=a,u.state=N,u.context=m,a=w):(typeof u.componentDidMount=="function"&&(s.flags|=4194308),a=!1)}else{u=s.stateNode,uc(t,s),m=s.memoizedProps,q=Qs(r,m),u.props=q,K=s.pendingProps,U=u.context,N=r.contextType,w=kr,typeof N=="object"&&N!==null&&(w=xt(N)),v=r.getDerivedStateFromProps,(N=typeof v=="function"||typeof u.getSnapshotBeforeUpdate=="function")||typeof u.UNSAFE_componentWillReceiveProps!="function"&&typeof u.componentWillReceiveProps!="function"||(m!==K||U!==w)&&pp(s,u,a,w),fs=!1,U=s.memoizedState,u.state=U,En(s,a,u,c),kn();var W=s.memoizedState;m!==K||U!==W||fs||t!==null&&t.dependencies!==null&&Il(t.dependencies)?(typeof v=="function"&&(Oc(s,r,v,a),W=s.memoizedState),(q=fs||fp(s,r,q,a,U,W,w)||t!==null&&t.dependencies!==null&&Il(t.dependencies))?(N||typeof u.UNSAFE_componentWillUpdate!="function"&&typeof u.componentWillUpdate!="function"||(typeof u.componentWillUpdate=="function"&&u.componentWillUpdate(a,W,w),typeof u.UNSAFE_componentWillUpdate=="function"&&u.UNSAFE_componentWillUpdate(a,W,w)),typeof u.componentDidUpdate=="function"&&(s.flags|=4),typeof u.getSnapshotBeforeUpdate=="function"&&(s.flags|=1024)):(typeof u.componentDidUpdate!="function"||m===t.memoizedProps&&U===t.memoizedState||(s.flags|=4),typeof u.getSnapshotBeforeUpdate!="function"||m===t.memoizedProps&&U===t.memoizedState||(s.flags|=1024),s.memoizedProps=a,s.memoizedState=W),u.props=a,u.state=W,u.context=w,a=q):(typeof u.componentDidUpdate!="function"||m===t.memoizedProps&&U===t.memoizedState||(s.flags|=4),typeof u.getSnapshotBeforeUpdate!="function"||m===t.memoizedProps&&U===t.memoizedState||(s.flags|=1024),a=!1)}return u=a,oa(t,s),a=(s.flags&128)!==0,u||a?(u=s.stateNode,r=a&&typeof r.getDerivedStateFromError!="function"?null:u.render(),s.flags|=1,t!==null&&a?(s.child=Vs(s,t.child,null,c),s.child=Vs(s,null,r,c)):wt(t,s,r,c),s.memoizedState=u.state,t=s.child):t=Ki(t,s,c),t}function Dp(t,s,r,a){return Ys(),s.flags|=256,wt(t,s,r,a),s.child}var Uc={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Wc(t){return{baseLanes:t,cachePool:vf()}}function qc(t,s,r){return t=t!==null?t.childLanes&~r:0,s&&(t|=Vt),t}function Bp(t,s,r){var a=s.pendingProps,c=!1,u=(s.flags&128)!==0,m;if((m=u)||(m=t!==null&&t.memoizedState===null?!1:(Je.current&2)!==0),m&&(c=!0,s.flags&=-129),m=(s.flags&32)!==0,s.flags&=-33,t===null){if(Ee){if(c?gs(s):ms(),(t=qe)?(t=H_(t,oi),t=t!==null&&t.data!=="&"?t:null,t!==null&&(s.memoizedState={dehydrated:t,treeContext:cs!==null?{id:ki,overflow:Ei}:null,retryLane:536870912,hydrationErrors:null},r=cf(t),r.return=s,s.child=r,bt=s,qe=null)):t=null,t===null)throw us(s);return wh(t)?s.lanes=32:s.lanes=536870912,null}var v=a.children;return a=a.fallback,c?(ms(),c=s.mode,v=ca({mode:"hidden",children:v},c),a=Is(a,c,r,null),v.return=s,a.return=s,v.sibling=a,s.child=v,a=s.child,a.memoizedState=Wc(r),a.childLanes=qc(t,m,r),s.memoizedState=Uc,Mn(null,a)):(gs(s),Pc(s,v))}var w=t.memoizedState;if(w!==null&&(v=w.dehydrated,v!==null)){if(u)s.flags&256?(gs(s),s.flags&=-257,s=Ic(t,s,r)):s.memoizedState!==null?(ms(),s.child=t.child,s.flags|=128,s=null):(ms(),v=a.fallback,c=s.mode,a=ca({mode:"visible",children:a.children},c),v=Is(v,c,r,null),v.flags|=2,a.return=s,v.return=s,a.sibling=v,s.child=a,Vs(s,t.child,null,r),a=s.child,a.memoizedState=Wc(r),a.childLanes=qc(t,m,r),s.memoizedState=Uc,s=Mn(null,a));else if(gs(s),wh(v)){if(m=v.nextSibling&&v.nextSibling.dataset,m)var N=m.dgst;m=N,a=Error(l(419)),a.stack="",a.digest=m,yn({value:a,source:null,stack:null}),s=Ic(t,s,r)}else if(rt||Dr(t,s,r,!1),m=(r&t.childLanes)!==0,rt||m){if(m=We,m!==null&&(a=_d(m,r),a!==0&&a!==w.retryLane))throw w.retryLane=a,Ps(t,a),Wt(m,t,a),Nc;xh(v)||va(),s=Ic(t,s,r)}else xh(v)?(s.flags|=192,s.child=t.child,s=null):(t=w.treeContext,qe=hi(v.nextSibling),bt=s,Ee=!0,hs=null,oi=!1,t!==null&&df(s,t),s=Pc(s,a.children),s.flags|=4096);return s}return c?(ms(),v=a.fallback,c=s.mode,w=t.child,N=w.sibling,a=Wi(w,{mode:"hidden",children:a.children}),a.subtreeFlags=w.subtreeFlags&65011712,N!==null?v=Wi(N,v):(v=Is(v,c,r,null),v.flags|=2),v.return=s,a.return=s,a.sibling=v,s.child=a,Mn(null,a),a=s.child,v=t.child.memoizedState,v===null?v=Wc(r):(c=v.cachePool,c!==null?(w=it._currentValue,c=c.parent!==w?{parent:w,pool:w}:c):c=vf(),v={baseLanes:v.baseLanes|r,cachePool:c}),a.memoizedState=v,a.childLanes=qc(t,m,r),s.memoizedState=Uc,Mn(t.child,a)):(gs(s),r=t.child,t=r.sibling,r=Wi(r,{mode:"visible",children:a.children}),r.return=s,r.sibling=null,t!==null&&(m=s.deletions,m===null?(s.deletions=[t],s.flags|=16):m.push(t)),s.child=r,s.memoizedState=null,r)}function Pc(t,s){return s=ca({mode:"visible",children:s},t.mode),s.return=t,t.child=s}function ca(t,s){return t=Kt(22,t,null,s),t.lanes=0,t}function Ic(t,s,r){return Vs(s,t.child,null,r),t=Pc(s,s.pendingProps.children),t.flags|=2,s.memoizedState=null,t}function Mp(t,s,r){t.lanes|=s;var a=t.alternate;a!==null&&(a.lanes|=s),rc(t.return,s,r)}function Yc(t,s,r,a,c,u){var m=t.memoizedState;m===null?t.memoizedState={isBackwards:s,rendering:null,renderingStartTime:0,last:a,tail:r,tailMode:c,treeForkCount:u}:(m.isBackwards=s,m.rendering=null,m.renderingStartTime=0,m.last=a,m.tail=r,m.tailMode=c,m.treeForkCount=u)}function zp(t,s,r){var a=s.pendingProps,c=a.revealOrder,u=a.tail;a=a.children;var m=Je.current,v=(m&2)!==0;if(v?(m=m&1|2,s.flags|=128):m&=1,J(Je,m),wt(t,s,a,r),a=Ee?vn:0,!v&&t!==null&&(t.flags&128)!==0)e:for(t=s.child;t!==null;){if(t.tag===13)t.memoizedState!==null&&Mp(t,r,s);else if(t.tag===19)Mp(t,r,s);else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===s)break e;for(;t.sibling===null;){if(t.return===null||t.return===s)break e;t=t.return}t.sibling.return=t.return,t=t.sibling}switch(c){case"forwards":for(r=s.child,c=null;r!==null;)t=r.alternate,t!==null&&Zl(t)===null&&(c=r),r=r.sibling;r=c,r===null?(c=s.child,s.child=null):(c=r.sibling,r.sibling=null),Yc(s,!1,c,r,u,a);break;case"backwards":case"unstable_legacy-backwards":for(r=null,c=s.child,s.child=null;c!==null;){if(t=c.alternate,t!==null&&Zl(t)===null){s.child=c;break}t=c.sibling,c.sibling=r,r=c,c=t}Yc(s,!0,r,null,u,a);break;case"together":Yc(s,!1,null,null,void 0,a);break;default:s.memoizedState=null}return s.child}function Ki(t,s,r){if(t!==null&&(s.dependencies=t.dependencies),Ss|=s.lanes,(r&s.childLanes)===0)if(t!==null){if(Dr(t,s,r,!1),(r&s.childLanes)===0)return null}else return null;if(t!==null&&s.child!==t.child)throw Error(l(153));if(s.child!==null){for(t=s.child,r=Wi(t,t.pendingProps),s.child=r,r.return=s;t.sibling!==null;)t=t.sibling,r=r.sibling=Wi(t,t.pendingProps),r.return=s;r.sibling=null}return s.child}function $c(t,s){return(t.lanes&s)!==0?!0:(t=t.dependencies,!!(t!==null&&Il(t)))}function ay(t,s,r){switch(s.tag){case 3:ot(s,s.stateNode.containerInfo),ds(s,it,t.memoizedState.cache),Ys();break;case 27:case 5:wi(s);break;case 4:ot(s,s.stateNode.containerInfo);break;case 10:ds(s,s.type,s.memoizedProps.value);break;case 31:if(s.memoizedState!==null)return s.flags|=128,gc(s),null;break;case 13:var a=s.memoizedState;if(a!==null)return a.dehydrated!==null?(gs(s),s.flags|=128,null):(r&s.child.childLanes)!==0?Bp(t,s,r):(gs(s),t=Ki(t,s,r),t!==null?t.sibling:null);gs(s);break;case 19:var c=(t.flags&128)!==0;if(a=(r&s.childLanes)!==0,a||(Dr(t,s,r,!1),a=(r&s.childLanes)!==0),c){if(a)return zp(t,s,r);s.flags|=128}if(c=s.memoizedState,c!==null&&(c.rendering=null,c.tail=null,c.lastEffect=null),J(Je,Je.current),a)break;return null;case 22:return s.lanes=0,Cp(t,s,r,s.pendingProps);case 24:ds(s,it,t.memoizedState.cache)}return Ki(t,s,r)}function Ap(t,s,r){if(t!==null)if(t.memoizedProps!==s.pendingProps)rt=!0;else{if(!$c(t,r)&&(s.flags&128)===0)return rt=!1,ay(t,s,r);rt=(t.flags&131072)!==0}else rt=!1,Ee&&(s.flags&1048576)!==0&&uf(s,vn,s.index);switch(s.lanes=0,s.tag){case 16:e:{var a=s.pendingProps;if(t=Gs(s.elementType),s.type=t,typeof t=="function")Vo(t)?(a=Qs(t,a),s.tag=1,s=Rp(null,s,t,a,r)):(s.tag=0,s=Hc(null,s,t,a,r));else{if(t!=null){var c=t.$$typeof;if(c===L){s.tag=11,s=bp(null,s,t,a,r);break e}else if(c===V){s.tag=14,s=xp(null,s,t,a,r);break e}}throw s=ie(t)||t,Error(l(306,s,""))}}return s;case 0:return Hc(t,s,s.type,s.pendingProps,r);case 1:return a=s.type,c=Qs(a,s.pendingProps),Rp(t,s,a,c,r);case 3:e:{if(ot(s,s.stateNode.containerInfo),t===null)throw Error(l(387));a=s.pendingProps;var u=s.memoizedState;c=u.element,uc(t,s),En(s,a,null,r);var m=s.memoizedState;if(a=m.cache,ds(s,it,a),a!==u.cache&&nc(s,[it],r,!0),kn(),a=m.element,u.isDehydrated)if(u={element:a,isDehydrated:!1,cache:m.cache},s.updateQueue.baseState=u,s.memoizedState=u,s.flags&256){s=Dp(t,s,a,r);break e}else if(a!==c){c=ni(Error(l(424)),s),yn(c),s=Dp(t,s,a,r);break e}else for(t=s.stateNode.containerInfo,t.nodeType===9?t=t.body:t=t.nodeName==="HTML"?t.ownerDocument.body:t,qe=hi(t.firstChild),bt=s,Ee=!0,hs=null,oi=!0,r=Cf(s,null,a,r),s.child=r;r;)r.flags=r.flags&-3|4096,r=r.sibling;else{if(Ys(),a===c){s=Ki(t,s,r);break e}wt(t,s,a,r)}s=s.child}return s;case 26:return oa(t,s),t===null?(r=Y_(s.type,null,s.pendingProps,null))?s.memoizedState=r:Ee||(r=s.type,t=s.pendingProps,a=ka(he.current).createElement(r),a[St]=s,a[Ot]=t,Ct(a,r,t),ft(a),s.stateNode=a):s.memoizedState=Y_(s.type,t.memoizedProps,s.pendingProps,t.memoizedState),null;case 27:return wi(s),t===null&&Ee&&(a=s.stateNode=q_(s.type,s.pendingProps,he.current),bt=s,oi=!0,c=qe,ks(s.type)?(Ch=c,qe=hi(a.firstChild)):qe=c),wt(t,s,s.pendingProps.children,r),oa(t,s),t===null&&(s.flags|=4194304),s.child;case 5:return t===null&&Ee&&((c=a=qe)&&(a=Ny(a,s.type,s.pendingProps,oi),a!==null?(s.stateNode=a,bt=s,qe=hi(a.firstChild),oi=!1,c=!0):c=!1),c||us(s)),wi(s),c=s.type,u=s.pendingProps,m=t!==null?t.memoizedProps:null,a=u.children,yh(c,u)?a=null:m!==null&&yh(c,m)&&(s.flags|=32),s.memoizedState!==null&&(c=vc(t,s,Q0,null,null,r),Kn._currentValue=c),oa(t,s),wt(t,s,a,r),s.child;case 6:return t===null&&Ee&&((t=r=qe)&&(r=Hy(r,s.pendingProps,oi),r!==null?(s.stateNode=r,bt=s,qe=null,t=!0):t=!1),t||us(s)),null;case 13:return Bp(t,s,r);case 4:return ot(s,s.stateNode.containerInfo),a=s.pendingProps,t===null?s.child=Vs(s,null,a,r):wt(t,s,a,r),s.child;case 11:return bp(t,s,s.type,s.pendingProps,r);case 7:return wt(t,s,s.pendingProps,r),s.child;case 8:return wt(t,s,s.pendingProps.children,r),s.child;case 12:return wt(t,s,s.pendingProps.children,r),s.child;case 10:return a=s.pendingProps,ds(s,s.type,a.value),wt(t,s,a.children,r),s.child;case 9:return c=s.type._context,a=s.pendingProps.children,Ks(s),c=xt(c),a=a(c),s.flags|=1,wt(t,s,a,r),s.child;case 14:return xp(t,s,s.type,s.pendingProps,r);case 15:return wp(t,s,s.type,s.pendingProps,r);case 19:return zp(t,s,r);case 31:return ly(t,s,r);case 22:return Cp(t,s,r,s.pendingProps);case 24:return Ks(s),a=xt(it),t===null?(c=oc(),c===null&&(c=We,u=lc(),c.pooledCache=u,u.refCount++,u!==null&&(c.pooledCacheLanes|=r),c=u),s.memoizedState={parent:a,cache:c},hc(s),ds(s,it,c)):((t.lanes&r)!==0&&(uc(t,s),En(s,null,null,r),kn()),c=t.memoizedState,u=s.memoizedState,c.parent!==a?(c={parent:a,cache:a},s.memoizedState=c,s.lanes===0&&(s.memoizedState=s.updateQueue.baseState=c),ds(s,it,a)):(a=u.cache,ds(s,it,a),a!==c.cache&&nc(s,[it],r,!0))),wt(t,s,s.pendingProps.children,r),s.child;case 29:throw s.pendingProps}throw Error(l(156,s.tag))}function Fi(t){t.flags|=4}function Kc(t,s,r,a,c){if((s=(t.mode&32)!==0)&&(s=!1),s){if(t.flags|=16777216,(c&335544128)===c)if(t.stateNode.complete)t.flags|=8192;else if(l_())t.flags|=8192;else throw Xs=Fl,cc}else t.flags&=-16777217}function Op(t,s){if(s.type!=="stylesheet"||(s.state.loading&4)!==0)t.flags&=-16777217;else if(t.flags|=16777216,!X_(s))if(l_())t.flags|=8192;else throw Xs=Fl,cc}function ha(t,s){s!==null&&(t.flags|=4),t.flags&16384&&(s=t.tag!==22?dd():536870912,t.lanes|=s,qr|=s)}function zn(t,s){if(!Ee)switch(t.tailMode){case"hidden":s=t.tail;for(var r=null;s!==null;)s.alternate!==null&&(r=s),s=s.sibling;r===null?t.tail=null:r.sibling=null;break;case"collapsed":r=t.tail;for(var a=null;r!==null;)r.alternate!==null&&(a=r),r=r.sibling;a===null?s||t.tail===null?t.tail=null:t.tail.sibling=null:a.sibling=null}}function Pe(t){var s=t.alternate!==null&&t.alternate.child===t.child,r=0,a=0;if(s)for(var c=t.child;c!==null;)r|=c.lanes|c.childLanes,a|=c.subtreeFlags&65011712,a|=c.flags&65011712,c.return=t,c=c.sibling;else for(c=t.child;c!==null;)r|=c.lanes|c.childLanes,a|=c.subtreeFlags,a|=c.flags,c.return=t,c=c.sibling;return t.subtreeFlags|=a,t.childLanes=r,s}function oy(t,s,r){var a=s.pendingProps;switch(ec(s),s.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Pe(s),null;case 1:return Pe(s),null;case 3:return r=s.stateNode,a=null,t!==null&&(a=t.memoizedState.cache),s.memoizedState.cache!==a&&(s.flags|=2048),Ii(it),ze(),r.pendingContext&&(r.context=r.pendingContext,r.pendingContext=null),(t===null||t.child===null)&&(Rr(s)?Fi(s):t===null||t.memoizedState.isDehydrated&&(s.flags&256)===0||(s.flags|=1024,ic())),Pe(s),null;case 26:var c=s.type,u=s.memoizedState;return t===null?(Fi(s),u!==null?(Pe(s),Op(s,u)):(Pe(s),Kc(s,c,null,a,r))):u?u!==t.memoizedState?(Fi(s),Pe(s),Op(s,u)):(Pe(s),s.flags&=-16777217):(t=t.memoizedProps,t!==a&&Fi(s),Pe(s),Kc(s,c,t,a,r)),null;case 27:if(Ci(s),r=he.current,c=s.type,t!==null&&s.stateNode!=null)t.memoizedProps!==a&&Fi(s);else{if(!a){if(s.stateNode===null)throw Error(l(166));return Pe(s),null}t=te.current,Rr(s)?ff(s):(t=q_(c,a,r),s.stateNode=t,Fi(s))}return Pe(s),null;case 5:if(Ci(s),c=s.type,t!==null&&s.stateNode!=null)t.memoizedProps!==a&&Fi(s);else{if(!a){if(s.stateNode===null)throw Error(l(166));return Pe(s),null}if(u=te.current,Rr(s))ff(s);else{var m=ka(he.current);switch(u){case 1:u=m.createElementNS("http://www.w3.org/2000/svg",c);break;case 2:u=m.createElementNS("http://www.w3.org/1998/Math/MathML",c);break;default:switch(c){case"svg":u=m.createElementNS("http://www.w3.org/2000/svg",c);break;case"math":u=m.createElementNS("http://www.w3.org/1998/Math/MathML",c);break;case"script":u=m.createElement("div"),u.innerHTML="<script><\/script>",u=u.removeChild(u.firstChild);break;case"select":u=typeof a.is=="string"?m.createElement("select",{is:a.is}):m.createElement("select"),a.multiple?u.multiple=!0:a.size&&(u.size=a.size);break;default:u=typeof a.is=="string"?m.createElement(c,{is:a.is}):m.createElement(c)}}u[St]=s,u[Ot]=a;e:for(m=s.child;m!==null;){if(m.tag===5||m.tag===6)u.appendChild(m.stateNode);else if(m.tag!==4&&m.tag!==27&&m.child!==null){m.child.return=m,m=m.child;continue}if(m===s)break e;for(;m.sibling===null;){if(m.return===null||m.return===s)break e;m=m.return}m.sibling.return=m.return,m=m.sibling}s.stateNode=u;e:switch(Ct(u,c,a),c){case"button":case"input":case"select":case"textarea":a=!!a.autoFocus;break e;case"img":a=!0;break e;default:a=!1}a&&Fi(s)}}return Pe(s),Kc(s,s.type,t===null?null:t.memoizedProps,s.pendingProps,r),null;case 6:if(t&&s.stateNode!=null)t.memoizedProps!==a&&Fi(s);else{if(typeof a!="string"&&s.stateNode===null)throw Error(l(166));if(t=he.current,Rr(s)){if(t=s.stateNode,r=s.memoizedProps,a=null,c=bt,c!==null)switch(c.tag){case 27:case 5:a=c.memoizedProps}t[St]=s,t=!!(t.nodeValue===r||a!==null&&a.suppressHydrationWarning===!0||B_(t.nodeValue,r)),t||us(s,!0)}else t=ka(t).createTextNode(a),t[St]=s,s.stateNode=t}return Pe(s),null;case 31:if(r=s.memoizedState,t===null||t.memoizedState!==null){if(a=Rr(s),r!==null){if(t===null){if(!a)throw Error(l(318));if(t=s.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(l(557));t[St]=s}else Ys(),(s.flags&128)===0&&(s.memoizedState=null),s.flags|=4;Pe(s),t=!1}else r=ic(),t!==null&&t.memoizedState!==null&&(t.memoizedState.hydrationErrors=r),t=!0;if(!t)return s.flags&256?(Gt(s),s):(Gt(s),null);if((s.flags&128)!==0)throw Error(l(558))}return Pe(s),null;case 13:if(a=s.memoizedState,t===null||t.memoizedState!==null&&t.memoizedState.dehydrated!==null){if(c=Rr(s),a!==null&&a.dehydrated!==null){if(t===null){if(!c)throw Error(l(318));if(c=s.memoizedState,c=c!==null?c.dehydrated:null,!c)throw Error(l(317));c[St]=s}else Ys(),(s.flags&128)===0&&(s.memoizedState=null),s.flags|=4;Pe(s),c=!1}else c=ic(),t!==null&&t.memoizedState!==null&&(t.memoizedState.hydrationErrors=c),c=!0;if(!c)return s.flags&256?(Gt(s),s):(Gt(s),null)}return Gt(s),(s.flags&128)!==0?(s.lanes=r,s):(r=a!==null,t=t!==null&&t.memoizedState!==null,r&&(a=s.child,c=null,a.alternate!==null&&a.alternate.memoizedState!==null&&a.alternate.memoizedState.cachePool!==null&&(c=a.alternate.memoizedState.cachePool.pool),u=null,a.memoizedState!==null&&a.memoizedState.cachePool!==null&&(u=a.memoizedState.cachePool.pool),u!==c&&(a.flags|=2048)),r!==t&&r&&(s.child.flags|=8192),ha(s,s.updateQueue),Pe(s),null);case 4:return ze(),t===null&&ph(s.stateNode.containerInfo),Pe(s),null;case 10:return Ii(s.type),Pe(s),null;case 19:if(P(Je),a=s.memoizedState,a===null)return Pe(s),null;if(c=(s.flags&128)!==0,u=a.rendering,u===null)if(c)zn(a,!1);else{if(Ve!==0||t!==null&&(t.flags&128)!==0)for(t=s.child;t!==null;){if(u=Zl(t),u!==null){for(s.flags|=128,zn(a,!1),t=u.updateQueue,s.updateQueue=t,ha(s,t),s.subtreeFlags=0,t=r,r=s.child;r!==null;)of(r,t),r=r.sibling;return J(Je,Je.current&1|2),Ee&&qi(s,a.treeForkCount),s.child}t=t.sibling}a.tail!==null&&Pt()>_a&&(s.flags|=128,c=!0,zn(a,!1),s.lanes=4194304)}else{if(!c)if(t=Zl(u),t!==null){if(s.flags|=128,c=!0,t=t.updateQueue,s.updateQueue=t,ha(s,t),zn(a,!0),a.tail===null&&a.tailMode==="hidden"&&!u.alternate&&!Ee)return Pe(s),null}else 2*Pt()-a.renderingStartTime>_a&&r!==536870912&&(s.flags|=128,c=!0,zn(a,!1),s.lanes=4194304);a.isBackwards?(u.sibling=s.child,s.child=u):(t=a.last,t!==null?t.sibling=u:s.child=u,a.last=u)}return a.tail!==null?(t=a.tail,a.rendering=t,a.tail=t.sibling,a.renderingStartTime=Pt(),t.sibling=null,r=Je.current,J(Je,c?r&1|2:r&1),Ee&&qi(s,a.treeForkCount),t):(Pe(s),null);case 22:case 23:return Gt(s),_c(),a=s.memoizedState!==null,t!==null?t.memoizedState!==null!==a&&(s.flags|=8192):a&&(s.flags|=8192),a?(r&536870912)!==0&&(s.flags&128)===0&&(Pe(s),s.subtreeFlags&6&&(s.flags|=8192)):Pe(s),r=s.updateQueue,r!==null&&ha(s,r.retryQueue),r=null,t!==null&&t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(r=t.memoizedState.cachePool.pool),a=null,s.memoizedState!==null&&s.memoizedState.cachePool!==null&&(a=s.memoizedState.cachePool.pool),a!==r&&(s.flags|=2048),t!==null&&P(Fs),null;case 24:return r=null,t!==null&&(r=t.memoizedState.cache),s.memoizedState.cache!==r&&(s.flags|=2048),Ii(it),Pe(s),null;case 25:return null;case 30:return null}throw Error(l(156,s.tag))}function cy(t,s){switch(ec(s),s.tag){case 1:return t=s.flags,t&65536?(s.flags=t&-65537|128,s):null;case 3:return Ii(it),ze(),t=s.flags,(t&65536)!==0&&(t&128)===0?(s.flags=t&-65537|128,s):null;case 26:case 27:case 5:return Ci(s),null;case 31:if(s.memoizedState!==null){if(Gt(s),s.alternate===null)throw Error(l(340));Ys()}return t=s.flags,t&65536?(s.flags=t&-65537|128,s):null;case 13:if(Gt(s),t=s.memoizedState,t!==null&&t.dehydrated!==null){if(s.alternate===null)throw Error(l(340));Ys()}return t=s.flags,t&65536?(s.flags=t&-65537|128,s):null;case 19:return P(Je),null;case 4:return ze(),null;case 10:return Ii(s.type),null;case 22:case 23:return Gt(s),_c(),t!==null&&P(Fs),t=s.flags,t&65536?(s.flags=t&-65537|128,s):null;case 24:return Ii(it),null;case 25:return null;default:return null}}function Lp(t,s){switch(ec(s),s.tag){case 3:Ii(it),ze();break;case 26:case 27:case 5:Ci(s);break;case 4:ze();break;case 31:s.memoizedState!==null&&Gt(s);break;case 13:Gt(s);break;case 19:P(Je);break;case 10:Ii(s.type);break;case 22:case 23:Gt(s),_c(),t!==null&&P(Fs);break;case 24:Ii(it)}}function An(t,s){try{var r=s.updateQueue,a=r!==null?r.lastEffect:null;if(a!==null){var c=a.next;r=c;do{if((r.tag&t)===t){a=void 0;var u=r.create,m=r.inst;a=u(),m.destroy=a}r=r.next}while(r!==c)}}catch(v){Oe(s,s.return,v)}}function vs(t,s,r){try{var a=s.updateQueue,c=a!==null?a.lastEffect:null;if(c!==null){var u=c.next;a=u;do{if((a.tag&t)===t){var m=a.inst,v=m.destroy;if(v!==void 0){m.destroy=void 0,c=s;var w=r,N=v;try{N()}catch(q){Oe(c,w,q)}}}a=a.next}while(a!==u)}}catch(q){Oe(s,s.return,q)}}function jp(t){var s=t.updateQueue;if(s!==null){var r=t.stateNode;try{Ef(s,r)}catch(a){Oe(t,t.return,a)}}}function Np(t,s,r){r.props=Qs(t.type,t.memoizedProps),r.state=t.memoizedState;try{r.componentWillUnmount()}catch(a){Oe(t,s,a)}}function On(t,s){try{var r=t.ref;if(r!==null){switch(t.tag){case 26:case 27:case 5:var a=t.stateNode;break;case 30:a=t.stateNode;break;default:a=t.stateNode}typeof r=="function"?t.refCleanup=r(a):r.current=a}}catch(c){Oe(t,s,c)}}function Ti(t,s){var r=t.ref,a=t.refCleanup;if(r!==null)if(typeof a=="function")try{a()}catch(c){Oe(t,s,c)}finally{t.refCleanup=null,t=t.alternate,t!=null&&(t.refCleanup=null)}else if(typeof r=="function")try{r(null)}catch(c){Oe(t,s,c)}else r.current=null}function Hp(t){var s=t.type,r=t.memoizedProps,a=t.stateNode;try{e:switch(s){case"button":case"input":case"select":case"textarea":r.autoFocus&&a.focus();break e;case"img":r.src?a.src=r.src:r.srcSet&&(a.srcset=r.srcSet)}}catch(c){Oe(t,t.return,c)}}function Fc(t,s,r){try{var a=t.stateNode;My(a,t.type,r,s),a[Ot]=s}catch(c){Oe(t,t.return,c)}}function Up(t){return t.tag===5||t.tag===3||t.tag===26||t.tag===27&&ks(t.type)||t.tag===4}function Gc(t){e:for(;;){for(;t.sibling===null;){if(t.return===null||Up(t.return))return null;t=t.return}for(t.sibling.return=t.return,t=t.sibling;t.tag!==5&&t.tag!==6&&t.tag!==18;){if(t.tag===27&&ks(t.type)||t.flags&2||t.child===null||t.tag===4)continue e;t.child.return=t,t=t.child}if(!(t.flags&2))return t.stateNode}}function Xc(t,s,r){var a=t.tag;if(a===5||a===6)t=t.stateNode,s?(r.nodeType===9?r.body:r.nodeName==="HTML"?r.ownerDocument.body:r).insertBefore(t,s):(s=r.nodeType===9?r.body:r.nodeName==="HTML"?r.ownerDocument.body:r,s.appendChild(t),r=r._reactRootContainer,r!=null||s.onclick!==null||(s.onclick=Hi));else if(a!==4&&(a===27&&ks(t.type)&&(r=t.stateNode,s=null),t=t.child,t!==null))for(Xc(t,s,r),t=t.sibling;t!==null;)Xc(t,s,r),t=t.sibling}function ua(t,s,r){var a=t.tag;if(a===5||a===6)t=t.stateNode,s?r.insertBefore(t,s):r.appendChild(t);else if(a!==4&&(a===27&&ks(t.type)&&(r=t.stateNode),t=t.child,t!==null))for(ua(t,s,r),t=t.sibling;t!==null;)ua(t,s,r),t=t.sibling}function Wp(t){var s=t.stateNode,r=t.memoizedProps;try{for(var a=t.type,c=s.attributes;c.length;)s.removeAttributeNode(c[0]);Ct(s,a,r),s[St]=t,s[Ot]=r}catch(u){Oe(t,t.return,u)}}var Gi=!1,nt=!1,Vc=!1,qp=typeof WeakSet=="function"?WeakSet:Set,pt=null;function hy(t,s){if(t=t.containerInfo,mh=za,t=Qd(t),Io(t)){if("selectionStart"in t)var r={start:t.selectionStart,end:t.selectionEnd};else e:{r=(r=t.ownerDocument)&&r.defaultView||window;var a=r.getSelection&&r.getSelection();if(a&&a.rangeCount!==0){r=a.anchorNode;var c=a.anchorOffset,u=a.focusNode;a=a.focusOffset;try{r.nodeType,u.nodeType}catch{r=null;break e}var m=0,v=-1,w=-1,N=0,q=0,K=t,U=null;t:for(;;){for(var W;K!==r||c!==0&&K.nodeType!==3||(v=m+c),K!==u||a!==0&&K.nodeType!==3||(w=m+a),K.nodeType===3&&(m+=K.nodeValue.length),(W=K.firstChild)!==null;)U=K,K=W;for(;;){if(K===t)break t;if(U===r&&++N===c&&(v=m),U===u&&++q===a&&(w=m),(W=K.nextSibling)!==null)break;K=U,U=K.parentNode}K=W}r=v===-1||w===-1?null:{start:v,end:w}}else r=null}r=r||{start:0,end:0}}else r=null;for(vh={focusedElem:t,selectionRange:r},za=!1,pt=s;pt!==null;)if(s=pt,t=s.child,(s.subtreeFlags&1028)!==0&&t!==null)t.return=s,pt=t;else for(;pt!==null;){switch(s=pt,u=s.alternate,t=s.flags,s.tag){case 0:if((t&4)!==0&&(t=s.updateQueue,t=t!==null?t.events:null,t!==null))for(r=0;r<t.length;r++)c=t[r],c.ref.impl=c.nextImpl;break;case 11:case 15:break;case 1:if((t&1024)!==0&&u!==null){t=void 0,r=s,c=u.memoizedProps,u=u.memoizedState,a=r.stateNode;try{var re=Qs(r.type,c);t=a.getSnapshotBeforeUpdate(re,u),a.__reactInternalSnapshotBeforeUpdate=t}catch(ce){Oe(r,r.return,ce)}}break;case 3:if((t&1024)!==0){if(t=s.stateNode.containerInfo,r=t.nodeType,r===9)bh(t);else if(r===1)switch(t.nodeName){case"HEAD":case"HTML":case"BODY":bh(t);break;default:t.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((t&1024)!==0)throw Error(l(163))}if(t=s.sibling,t!==null){t.return=s.return,pt=t;break}pt=s.return}}function Pp(t,s,r){var a=r.flags;switch(r.tag){case 0:case 11:case 15:Vi(t,r),a&4&&An(5,r);break;case 1:if(Vi(t,r),a&4)if(t=r.stateNode,s===null)try{t.componentDidMount()}catch(m){Oe(r,r.return,m)}else{var c=Qs(r.type,s.memoizedProps);s=s.memoizedState;try{t.componentDidUpdate(c,s,t.__reactInternalSnapshotBeforeUpdate)}catch(m){Oe(r,r.return,m)}}a&64&&jp(r),a&512&&On(r,r.return);break;case 3:if(Vi(t,r),a&64&&(t=r.updateQueue,t!==null)){if(s=null,r.child!==null)switch(r.child.tag){case 27:case 5:s=r.child.stateNode;break;case 1:s=r.child.stateNode}try{Ef(t,s)}catch(m){Oe(r,r.return,m)}}break;case 27:s===null&&a&4&&Wp(r);case 26:case 5:Vi(t,r),s===null&&a&4&&Hp(r),a&512&&On(r,r.return);break;case 12:Vi(t,r);break;case 31:Vi(t,r),a&4&&$p(t,r);break;case 13:Vi(t,r),a&4&&Kp(t,r),a&64&&(t=r.memoizedState,t!==null&&(t=t.dehydrated,t!==null&&(r=yy.bind(null,r),Uy(t,r))));break;case 22:if(a=r.memoizedState!==null||Gi,!a){s=s!==null&&s.memoizedState!==null||nt,c=Gi;var u=nt;Gi=a,(nt=s)&&!u?Zi(t,r,(r.subtreeFlags&8772)!==0):Vi(t,r),Gi=c,nt=u}break;case 30:break;default:Vi(t,r)}}function Ip(t){var s=t.alternate;s!==null&&(t.alternate=null,Ip(s)),t.child=null,t.deletions=null,t.sibling=null,t.tag===5&&(s=t.stateNode,s!==null&&Eo(s)),t.stateNode=null,t.return=null,t.dependencies=null,t.memoizedProps=null,t.memoizedState=null,t.pendingProps=null,t.stateNode=null,t.updateQueue=null}var Ye=null,jt=!1;function Xi(t,s,r){for(r=r.child;r!==null;)Yp(t,s,r),r=r.sibling}function Yp(t,s,r){if(It&&typeof It.onCommitFiberUnmount=="function")try{It.onCommitFiberUnmount(rn,r)}catch{}switch(r.tag){case 26:nt||Ti(r,s),Xi(t,s,r),r.memoizedState?r.memoizedState.count--:r.stateNode&&(r=r.stateNode,r.parentNode.removeChild(r));break;case 27:nt||Ti(r,s);var a=Ye,c=jt;ks(r.type)&&(Ye=r.stateNode,jt=!1),Xi(t,s,r),In(r.stateNode),Ye=a,jt=c;break;case 5:nt||Ti(r,s);case 6:if(a=Ye,c=jt,Ye=null,Xi(t,s,r),Ye=a,jt=c,Ye!==null)if(jt)try{(Ye.nodeType===9?Ye.body:Ye.nodeName==="HTML"?Ye.ownerDocument.body:Ye).removeChild(r.stateNode)}catch(u){Oe(r,s,u)}else try{Ye.removeChild(r.stateNode)}catch(u){Oe(r,s,u)}break;case 18:Ye!==null&&(jt?(t=Ye,j_(t.nodeType===9?t.body:t.nodeName==="HTML"?t.ownerDocument.body:t,r.stateNode),Xr(t)):j_(Ye,r.stateNode));break;case 4:a=Ye,c=jt,Ye=r.stateNode.containerInfo,jt=!0,Xi(t,s,r),Ye=a,jt=c;break;case 0:case 11:case 14:case 15:vs(2,r,s),nt||vs(4,r,s),Xi(t,s,r);break;case 1:nt||(Ti(r,s),a=r.stateNode,typeof a.componentWillUnmount=="function"&&Np(r,s,a)),Xi(t,s,r);break;case 21:Xi(t,s,r);break;case 22:nt=(a=nt)||r.memoizedState!==null,Xi(t,s,r),nt=a;break;default:Xi(t,s,r)}}function $p(t,s){if(s.memoizedState===null&&(t=s.alternate,t!==null&&(t=t.memoizedState,t!==null))){t=t.dehydrated;try{Xr(t)}catch(r){Oe(s,s.return,r)}}}function Kp(t,s){if(s.memoizedState===null&&(t=s.alternate,t!==null&&(t=t.memoizedState,t!==null&&(t=t.dehydrated,t!==null))))try{Xr(t)}catch(r){Oe(s,s.return,r)}}function uy(t){switch(t.tag){case 31:case 13:case 19:var s=t.stateNode;return s===null&&(s=t.stateNode=new qp),s;case 22:return t=t.stateNode,s=t._retryCache,s===null&&(s=t._retryCache=new qp),s;default:throw Error(l(435,t.tag))}}function da(t,s){var r=uy(t);s.forEach(function(a){if(!r.has(a)){r.add(a);var c=Sy.bind(null,t,a);a.then(c,c)}})}function Nt(t,s){var r=s.deletions;if(r!==null)for(var a=0;a<r.length;a++){var c=r[a],u=t,m=s,v=m;e:for(;v!==null;){switch(v.tag){case 27:if(ks(v.type)){Ye=v.stateNode,jt=!1;break e}break;case 5:Ye=v.stateNode,jt=!1;break e;case 3:case 4:Ye=v.stateNode.containerInfo,jt=!0;break e}v=v.return}if(Ye===null)throw Error(l(160));Yp(u,m,c),Ye=null,jt=!1,u=c.alternate,u!==null&&(u.return=null),c.return=null}if(s.subtreeFlags&13886)for(s=s.child;s!==null;)Fp(s,t),s=s.sibling}var yi=null;function Fp(t,s){var r=t.alternate,a=t.flags;switch(t.tag){case 0:case 11:case 14:case 15:Nt(s,t),Ht(t),a&4&&(vs(3,t,t.return),An(3,t),vs(5,t,t.return));break;case 1:Nt(s,t),Ht(t),a&512&&(nt||r===null||Ti(r,r.return)),a&64&&Gi&&(t=t.updateQueue,t!==null&&(a=t.callbacks,a!==null&&(r=t.shared.hiddenCallbacks,t.shared.hiddenCallbacks=r===null?a:r.concat(a))));break;case 26:var c=yi;if(Nt(s,t),Ht(t),a&512&&(nt||r===null||Ti(r,r.return)),a&4){var u=r!==null?r.memoizedState:null;if(a=t.memoizedState,r===null)if(a===null)if(t.stateNode===null){e:{a=t.type,r=t.memoizedProps,c=c.ownerDocument||c;t:switch(a){case"title":u=c.getElementsByTagName("title")[0],(!u||u[an]||u[St]||u.namespaceURI==="http://www.w3.org/2000/svg"||u.hasAttribute("itemprop"))&&(u=c.createElement(a),c.head.insertBefore(u,c.querySelector("head > title"))),Ct(u,a,r),u[St]=t,ft(u),a=u;break e;case"link":var m=F_("link","href",c).get(a+(r.href||""));if(m){for(var v=0;v<m.length;v++)if(u=m[v],u.getAttribute("href")===(r.href==null||r.href===""?null:r.href)&&u.getAttribute("rel")===(r.rel==null?null:r.rel)&&u.getAttribute("title")===(r.title==null?null:r.title)&&u.getAttribute("crossorigin")===(r.crossOrigin==null?null:r.crossOrigin)){m.splice(v,1);break t}}u=c.createElement(a),Ct(u,a,r),c.head.appendChild(u);break;case"meta":if(m=F_("meta","content",c).get(a+(r.content||""))){for(v=0;v<m.length;v++)if(u=m[v],u.getAttribute("content")===(r.content==null?null:""+r.content)&&u.getAttribute("name")===(r.name==null?null:r.name)&&u.getAttribute("property")===(r.property==null?null:r.property)&&u.getAttribute("http-equiv")===(r.httpEquiv==null?null:r.httpEquiv)&&u.getAttribute("charset")===(r.charSet==null?null:r.charSet)){m.splice(v,1);break t}}u=c.createElement(a),Ct(u,a,r),c.head.appendChild(u);break;default:throw Error(l(468,a))}u[St]=t,ft(u),a=u}t.stateNode=a}else G_(c,t.type,t.stateNode);else t.stateNode=K_(c,a,t.memoizedProps);else u!==a?(u===null?r.stateNode!==null&&(r=r.stateNode,r.parentNode.removeChild(r)):u.count--,a===null?G_(c,t.type,t.stateNode):K_(c,a,t.memoizedProps)):a===null&&t.stateNode!==null&&Fc(t,t.memoizedProps,r.memoizedProps)}break;case 27:Nt(s,t),Ht(t),a&512&&(nt||r===null||Ti(r,r.return)),r!==null&&a&4&&Fc(t,t.memoizedProps,r.memoizedProps);break;case 5:if(Nt(s,t),Ht(t),a&512&&(nt||r===null||Ti(r,r.return)),t.flags&32){c=t.stateNode;try{vr(c,"")}catch(re){Oe(t,t.return,re)}}a&4&&t.stateNode!=null&&(c=t.memoizedProps,Fc(t,c,r!==null?r.memoizedProps:c)),a&1024&&(Vc=!0);break;case 6:if(Nt(s,t),Ht(t),a&4){if(t.stateNode===null)throw Error(l(162));a=t.memoizedProps,r=t.stateNode;try{r.nodeValue=a}catch(re){Oe(t,t.return,re)}}break;case 3:if(Ra=null,c=yi,yi=Ea(s.containerInfo),Nt(s,t),yi=c,Ht(t),a&4&&r!==null&&r.memoizedState.isDehydrated)try{Xr(s.containerInfo)}catch(re){Oe(t,t.return,re)}Vc&&(Vc=!1,Gp(t));break;case 4:a=yi,yi=Ea(t.stateNode.containerInfo),Nt(s,t),Ht(t),yi=a;break;case 12:Nt(s,t),Ht(t);break;case 31:Nt(s,t),Ht(t),a&4&&(a=t.updateQueue,a!==null&&(t.updateQueue=null,da(t,a)));break;case 13:Nt(s,t),Ht(t),t.child.flags&8192&&t.memoizedState!==null!=(r!==null&&r.memoizedState!==null)&&(pa=Pt()),a&4&&(a=t.updateQueue,a!==null&&(t.updateQueue=null,da(t,a)));break;case 22:c=t.memoizedState!==null;var w=r!==null&&r.memoizedState!==null,N=Gi,q=nt;if(Gi=N||c,nt=q||w,Nt(s,t),nt=q,Gi=N,Ht(t),a&8192)e:for(s=t.stateNode,s._visibility=c?s._visibility&-2:s._visibility|1,c&&(r===null||w||Gi||nt||Js(t)),r=null,s=t;;){if(s.tag===5||s.tag===26){if(r===null){w=r=s;try{if(u=w.stateNode,c)m=u.style,typeof m.setProperty=="function"?m.setProperty("display","none","important"):m.display="none";else{v=w.stateNode;var K=w.memoizedProps.style,U=K!=null&&K.hasOwnProperty("display")?K.display:null;v.style.display=U==null||typeof U=="boolean"?"":(""+U).trim()}}catch(re){Oe(w,w.return,re)}}}else if(s.tag===6){if(r===null){w=s;try{w.stateNode.nodeValue=c?"":w.memoizedProps}catch(re){Oe(w,w.return,re)}}}else if(s.tag===18){if(r===null){w=s;try{var W=w.stateNode;c?N_(W,!0):N_(w.stateNode,!1)}catch(re){Oe(w,w.return,re)}}}else if((s.tag!==22&&s.tag!==23||s.memoizedState===null||s===t)&&s.child!==null){s.child.return=s,s=s.child;continue}if(s===t)break e;for(;s.sibling===null;){if(s.return===null||s.return===t)break e;r===s&&(r=null),s=s.return}r===s&&(r=null),s.sibling.return=s.return,s=s.sibling}a&4&&(a=t.updateQueue,a!==null&&(r=a.retryQueue,r!==null&&(a.retryQueue=null,da(t,r))));break;case 19:Nt(s,t),Ht(t),a&4&&(a=t.updateQueue,a!==null&&(t.updateQueue=null,da(t,a)));break;case 30:break;case 21:break;default:Nt(s,t),Ht(t)}}function Ht(t){var s=t.flags;if(s&2){try{for(var r,a=t.return;a!==null;){if(Up(a)){r=a;break}a=a.return}if(r==null)throw Error(l(160));switch(r.tag){case 27:var c=r.stateNode,u=Gc(t);ua(t,u,c);break;case 5:var m=r.stateNode;r.flags&32&&(vr(m,""),r.flags&=-33);var v=Gc(t);ua(t,v,m);break;case 3:case 4:var w=r.stateNode.containerInfo,N=Gc(t);Xc(t,N,w);break;default:throw Error(l(161))}}catch(q){Oe(t,t.return,q)}t.flags&=-3}s&4096&&(t.flags&=-4097)}function Gp(t){if(t.subtreeFlags&1024)for(t=t.child;t!==null;){var s=t;Gp(s),s.tag===5&&s.flags&1024&&s.stateNode.reset(),t=t.sibling}}function Vi(t,s){if(s.subtreeFlags&8772)for(s=s.child;s!==null;)Pp(t,s.alternate,s),s=s.sibling}function Js(t){for(t=t.child;t!==null;){var s=t;switch(s.tag){case 0:case 11:case 14:case 15:vs(4,s,s.return),Js(s);break;case 1:Ti(s,s.return);var r=s.stateNode;typeof r.componentWillUnmount=="function"&&Np(s,s.return,r),Js(s);break;case 27:In(s.stateNode);case 26:case 5:Ti(s,s.return),Js(s);break;case 22:s.memoizedState===null&&Js(s);break;case 30:Js(s);break;default:Js(s)}t=t.sibling}}function Zi(t,s,r){for(r=r&&(s.subtreeFlags&8772)!==0,s=s.child;s!==null;){var a=s.alternate,c=t,u=s,m=u.flags;switch(u.tag){case 0:case 11:case 15:Zi(c,u,r),An(4,u);break;case 1:if(Zi(c,u,r),a=u,c=a.stateNode,typeof c.componentDidMount=="function")try{c.componentDidMount()}catch(N){Oe(a,a.return,N)}if(a=u,c=a.updateQueue,c!==null){var v=a.stateNode;try{var w=c.shared.hiddenCallbacks;if(w!==null)for(c.shared.hiddenCallbacks=null,c=0;c<w.length;c++)kf(w[c],v)}catch(N){Oe(a,a.return,N)}}r&&m&64&&jp(u),On(u,u.return);break;case 27:Wp(u);case 26:case 5:Zi(c,u,r),r&&a===null&&m&4&&Hp(u),On(u,u.return);break;case 12:Zi(c,u,r);break;case 31:Zi(c,u,r),r&&m&4&&$p(c,u);break;case 13:Zi(c,u,r),r&&m&4&&Kp(c,u);break;case 22:u.memoizedState===null&&Zi(c,u,r),On(u,u.return);break;case 30:break;default:Zi(c,u,r)}s=s.sibling}}function Zc(t,s){var r=null;t!==null&&t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(r=t.memoizedState.cachePool.pool),t=null,s.memoizedState!==null&&s.memoizedState.cachePool!==null&&(t=s.memoizedState.cachePool.pool),t!==r&&(t!=null&&t.refCount++,r!=null&&Sn(r))}function Qc(t,s){t=null,s.alternate!==null&&(t=s.alternate.memoizedState.cache),s=s.memoizedState.cache,s!==t&&(s.refCount++,t!=null&&Sn(t))}function Si(t,s,r,a){if(s.subtreeFlags&10256)for(s=s.child;s!==null;)Xp(t,s,r,a),s=s.sibling}function Xp(t,s,r,a){var c=s.flags;switch(s.tag){case 0:case 11:case 15:Si(t,s,r,a),c&2048&&An(9,s);break;case 1:Si(t,s,r,a);break;case 3:Si(t,s,r,a),c&2048&&(t=null,s.alternate!==null&&(t=s.alternate.memoizedState.cache),s=s.memoizedState.cache,s!==t&&(s.refCount++,t!=null&&Sn(t)));break;case 12:if(c&2048){Si(t,s,r,a),t=s.stateNode;try{var u=s.memoizedProps,m=u.id,v=u.onPostCommit;typeof v=="function"&&v(m,s.alternate===null?"mount":"update",t.passiveEffectDuration,-0)}catch(w){Oe(s,s.return,w)}}else Si(t,s,r,a);break;case 31:Si(t,s,r,a);break;case 13:Si(t,s,r,a);break;case 23:break;case 22:u=s.stateNode,m=s.alternate,s.memoizedState!==null?u._visibility&2?Si(t,s,r,a):Ln(t,s):u._visibility&2?Si(t,s,r,a):(u._visibility|=2,Hr(t,s,r,a,(s.subtreeFlags&10256)!==0||!1)),c&2048&&Zc(m,s);break;case 24:Si(t,s,r,a),c&2048&&Qc(s.alternate,s);break;default:Si(t,s,r,a)}}function Hr(t,s,r,a,c){for(c=c&&((s.subtreeFlags&10256)!==0||!1),s=s.child;s!==null;){var u=t,m=s,v=r,w=a,N=m.flags;switch(m.tag){case 0:case 11:case 15:Hr(u,m,v,w,c),An(8,m);break;case 23:break;case 22:var q=m.stateNode;m.memoizedState!==null?q._visibility&2?Hr(u,m,v,w,c):Ln(u,m):(q._visibility|=2,Hr(u,m,v,w,c)),c&&N&2048&&Zc(m.alternate,m);break;case 24:Hr(u,m,v,w,c),c&&N&2048&&Qc(m.alternate,m);break;default:Hr(u,m,v,w,c)}s=s.sibling}}function Ln(t,s){if(s.subtreeFlags&10256)for(s=s.child;s!==null;){var r=t,a=s,c=a.flags;switch(a.tag){case 22:Ln(r,a),c&2048&&Zc(a.alternate,a);break;case 24:Ln(r,a),c&2048&&Qc(a.alternate,a);break;default:Ln(r,a)}s=s.sibling}}var jn=8192;function Ur(t,s,r){if(t.subtreeFlags&jn)for(t=t.child;t!==null;)Vp(t,s,r),t=t.sibling}function Vp(t,s,r){switch(t.tag){case 26:Ur(t,s,r),t.flags&jn&&t.memoizedState!==null&&Zy(r,yi,t.memoizedState,t.memoizedProps);break;case 5:Ur(t,s,r);break;case 3:case 4:var a=yi;yi=Ea(t.stateNode.containerInfo),Ur(t,s,r),yi=a;break;case 22:t.memoizedState===null&&(a=t.alternate,a!==null&&a.memoizedState!==null?(a=jn,jn=16777216,Ur(t,s,r),jn=a):Ur(t,s,r));break;default:Ur(t,s,r)}}function Zp(t){var s=t.alternate;if(s!==null&&(t=s.child,t!==null)){s.child=null;do s=t.sibling,t.sibling=null,t=s;while(t!==null)}}function Nn(t){var s=t.deletions;if((t.flags&16)!==0){if(s!==null)for(var r=0;r<s.length;r++){var a=s[r];pt=a,Jp(a,t)}Zp(t)}if(t.subtreeFlags&10256)for(t=t.child;t!==null;)Qp(t),t=t.sibling}function Qp(t){switch(t.tag){case 0:case 11:case 15:Nn(t),t.flags&2048&&vs(9,t,t.return);break;case 3:Nn(t);break;case 12:Nn(t);break;case 22:var s=t.stateNode;t.memoizedState!==null&&s._visibility&2&&(t.return===null||t.return.tag!==13)?(s._visibility&=-3,fa(t)):Nn(t);break;default:Nn(t)}}function fa(t){var s=t.deletions;if((t.flags&16)!==0){if(s!==null)for(var r=0;r<s.length;r++){var a=s[r];pt=a,Jp(a,t)}Zp(t)}for(t=t.child;t!==null;){switch(s=t,s.tag){case 0:case 11:case 15:vs(8,s,s.return),fa(s);break;case 22:r=s.stateNode,r._visibility&2&&(r._visibility&=-3,fa(s));break;default:fa(s)}t=t.sibling}}function Jp(t,s){for(;pt!==null;){var r=pt;switch(r.tag){case 0:case 11:case 15:vs(8,r,s);break;case 23:case 22:if(r.memoizedState!==null&&r.memoizedState.cachePool!==null){var a=r.memoizedState.cachePool.pool;a!=null&&a.refCount++}break;case 24:Sn(r.memoizedState.cache)}if(a=r.child,a!==null)a.return=r,pt=a;else e:for(r=t;pt!==null;){a=pt;var c=a.sibling,u=a.return;if(Ip(a),a===r){pt=null;break e}if(c!==null){c.return=u,pt=c;break e}pt=u}}}var dy={getCacheForType:function(t){var s=xt(it),r=s.data.get(t);return r===void 0&&(r=t(),s.data.set(t,r)),r},cacheSignal:function(){return xt(it).controller.signal}},fy=typeof WeakMap=="function"?WeakMap:Map,Me=0,We=null,xe=null,Ce=0,Ae=0,Xt=null,ys=!1,Wr=!1,Jc=!1,Qi=0,Ve=0,Ss=0,er=0,eh=0,Vt=0,qr=0,Hn=null,Ut=null,th=!1,pa=0,e_=0,_a=1/0,ga=null,bs=null,ct=0,xs=null,Pr=null,Ji=0,ih=0,sh=null,t_=null,Un=0,rh=null;function Zt(){return(Me&2)!==0&&Ce!==0?Ce&-Ce:R.T!==null?hh():gd()}function i_(){if(Vt===0)if((Ce&536870912)===0||Ee){var t=Cl;Cl<<=1,(Cl&3932160)===0&&(Cl=262144),Vt=t}else Vt=536870912;return t=Ft.current,t!==null&&(t.flags|=32),Vt}function Wt(t,s,r){(t===We&&(Ae===2||Ae===9)||t.cancelPendingCommit!==null)&&(Ir(t,0),ws(t,Ce,Vt,!1)),ln(t,r),((Me&2)===0||t!==We)&&(t===We&&((Me&2)===0&&(er|=r),Ve===4&&ws(t,Ce,Vt,!1)),Ri(t))}function s_(t,s,r){if((Me&6)!==0)throw Error(l(327));var a=!r&&(s&127)===0&&(s&t.expiredLanes)===0||nn(t,s),c=a?gy(t,s):lh(t,s,!0),u=a;do{if(c===0){Wr&&!a&&ws(t,s,0,!1);break}else{if(r=t.current.alternate,u&&!py(r)){c=lh(t,s,!1),u=!1;continue}if(c===2){if(u=s,t.errorRecoveryDisabledLanes&u)var m=0;else m=t.pendingLanes&-536870913,m=m!==0?m:m&536870912?536870912:0;if(m!==0){s=m;e:{var v=t;c=Hn;var w=v.current.memoizedState.isDehydrated;if(w&&(Ir(v,m).flags|=256),m=lh(v,m,!1),m!==2){if(Jc&&!w){v.errorRecoveryDisabledLanes|=u,er|=u,c=4;break e}u=Ut,Ut=c,u!==null&&(Ut===null?Ut=u:Ut.push.apply(Ut,u))}c=m}if(u=!1,c!==2)continue}}if(c===1){Ir(t,0),ws(t,s,0,!0);break}e:{switch(a=t,u=c,u){case 0:case 1:throw Error(l(345));case 4:if((s&4194048)!==s)break;case 6:ws(a,s,Vt,!ys);break e;case 2:Ut=null;break;case 3:case 5:break;default:throw Error(l(329))}if((s&62914560)===s&&(c=pa+300-Pt(),10<c)){if(ws(a,s,Vt,!ys),El(a,0,!0)!==0)break e;Ji=s,a.timeoutHandle=O_(r_.bind(null,a,r,Ut,ga,th,s,Vt,er,qr,ys,u,"Throttled",-0,0),c);break e}r_(a,r,Ut,ga,th,s,Vt,er,qr,ys,u,null,-0,0)}}break}while(!0);Ri(t)}function r_(t,s,r,a,c,u,m,v,w,N,q,K,U,W){if(t.timeoutHandle=-1,K=s.subtreeFlags,K&8192||(K&16785408)===16785408){K={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:Hi},Vp(s,u,K);var re=(u&62914560)===u?pa-Pt():(u&4194048)===u?e_-Pt():0;if(re=Qy(K,re),re!==null){Ji=u,t.cancelPendingCommit=re(d_.bind(null,t,s,u,r,a,c,m,v,w,q,K,null,U,W)),ws(t,u,m,!N);return}}d_(t,s,u,r,a,c,m,v,w)}function py(t){for(var s=t;;){var r=s.tag;if((r===0||r===11||r===15)&&s.flags&16384&&(r=s.updateQueue,r!==null&&(r=r.stores,r!==null)))for(var a=0;a<r.length;a++){var c=r[a],u=c.getSnapshot;c=c.value;try{if(!$t(u(),c))return!1}catch{return!1}}if(r=s.child,s.subtreeFlags&16384&&r!==null)r.return=s,s=r;else{if(s===t)break;for(;s.sibling===null;){if(s.return===null||s.return===t)return!0;s=s.return}s.sibling.return=s.return,s=s.sibling}}return!0}function ws(t,s,r,a){s&=~eh,s&=~er,t.suspendedLanes|=s,t.pingedLanes&=~s,a&&(t.warmLanes|=s),a=t.expirationTimes;for(var c=s;0<c;){var u=31-Yt(c),m=1<<u;a[u]=-1,c&=~m}r!==0&&fd(t,r,s)}function ma(){return(Me&6)===0?(Wn(0),!1):!0}function nh(){if(xe!==null){if(Ae===0)var t=xe.return;else t=xe,Pi=$s=null,bc(t),Ar=null,xn=0,t=xe;for(;t!==null;)Lp(t.alternate,t),t=t.return;xe=null}}function Ir(t,s){var r=t.timeoutHandle;r!==-1&&(t.timeoutHandle=-1,Oy(r)),r=t.cancelPendingCommit,r!==null&&(t.cancelPendingCommit=null,r()),Ji=0,nh(),We=t,xe=r=Wi(t.current,null),Ce=s,Ae=0,Xt=null,ys=!1,Wr=nn(t,s),Jc=!1,qr=Vt=eh=er=Ss=Ve=0,Ut=Hn=null,th=!1,(s&8)!==0&&(s|=s&32);var a=t.entangledLanes;if(a!==0)for(t=t.entanglements,a&=s;0<a;){var c=31-Yt(a),u=1<<c;s|=t[c],a&=~u}return Qi=s,Hl(),r}function n_(t,s){me=null,R.H=Bn,s===zr||s===Kl?(s=bf(),Ae=3):s===cc?(s=bf(),Ae=4):Ae=s===Nc?8:s!==null&&typeof s=="object"&&typeof s.then=="function"?6:1,Xt=s,xe===null&&(Ve=1,la(t,ni(s,t.current)))}function l_(){var t=Ft.current;return t===null?!0:(Ce&4194048)===Ce?ci===null:(Ce&62914560)===Ce||(Ce&536870912)!==0?t===ci:!1}function a_(){var t=R.H;return R.H=Bn,t===null?Bn:t}function o_(){var t=R.A;return R.A=dy,t}function va(){Ve=4,ys||(Ce&4194048)!==Ce&&Ft.current!==null||(Wr=!0),(Ss&134217727)===0&&(er&134217727)===0||We===null||ws(We,Ce,Vt,!1)}function lh(t,s,r){var a=Me;Me|=2;var c=a_(),u=o_();(We!==t||Ce!==s)&&(ga=null,Ir(t,s)),s=!1;var m=Ve;e:do try{if(Ae!==0&&xe!==null){var v=xe,w=Xt;switch(Ae){case 8:nh(),m=6;break e;case 3:case 2:case 9:case 6:Ft.current===null&&(s=!0);var N=Ae;if(Ae=0,Xt=null,Yr(t,v,w,N),r&&Wr){m=0;break e}break;default:N=Ae,Ae=0,Xt=null,Yr(t,v,w,N)}}_y(),m=Ve;break}catch(q){n_(t,q)}while(!0);return s&&t.shellSuspendCounter++,Pi=$s=null,Me=a,R.H=c,R.A=u,xe===null&&(We=null,Ce=0,Hl()),m}function _y(){for(;xe!==null;)c_(xe)}function gy(t,s){var r=Me;Me|=2;var a=a_(),c=o_();We!==t||Ce!==s?(ga=null,_a=Pt()+500,Ir(t,s)):Wr=nn(t,s);e:do try{if(Ae!==0&&xe!==null){s=xe;var u=Xt;t:switch(Ae){case 1:Ae=0,Xt=null,Yr(t,s,u,1);break;case 2:case 9:if(yf(u)){Ae=0,Xt=null,h_(s);break}s=function(){Ae!==2&&Ae!==9||We!==t||(Ae=7),Ri(t)},u.then(s,s);break e;case 3:Ae=7;break e;case 4:Ae=5;break e;case 7:yf(u)?(Ae=0,Xt=null,h_(s)):(Ae=0,Xt=null,Yr(t,s,u,7));break;case 5:var m=null;switch(xe.tag){case 26:m=xe.memoizedState;case 5:case 27:var v=xe;if(m?X_(m):v.stateNode.complete){Ae=0,Xt=null;var w=v.sibling;if(w!==null)xe=w;else{var N=v.return;N!==null?(xe=N,ya(N)):xe=null}break t}}Ae=0,Xt=null,Yr(t,s,u,5);break;case 6:Ae=0,Xt=null,Yr(t,s,u,6);break;case 8:nh(),Ve=6;break e;default:throw Error(l(462))}}my();break}catch(q){n_(t,q)}while(!0);return Pi=$s=null,R.H=a,R.A=c,Me=r,xe!==null?0:(We=null,Ce=0,Hl(),Ve)}function my(){for(;xe!==null&&!Wv();)c_(xe)}function c_(t){var s=Ap(t.alternate,t,Qi);t.memoizedProps=t.pendingProps,s===null?ya(t):xe=s}function h_(t){var s=t,r=s.alternate;switch(s.tag){case 15:case 0:s=Tp(r,s,s.pendingProps,s.type,void 0,Ce);break;case 11:s=Tp(r,s,s.pendingProps,s.type.render,s.ref,Ce);break;case 5:bc(s);default:Lp(r,s),s=xe=of(s,Qi),s=Ap(r,s,Qi)}t.memoizedProps=t.pendingProps,s===null?ya(t):xe=s}function Yr(t,s,r,a){Pi=$s=null,bc(s),Ar=null,xn=0;var c=s.return;try{if(ny(t,c,s,r,Ce)){Ve=1,la(t,ni(r,t.current)),xe=null;return}}catch(u){if(c!==null)throw xe=c,u;Ve=1,la(t,ni(r,t.current)),xe=null;return}s.flags&32768?(Ee||a===1?t=!0:Wr||(Ce&536870912)!==0?t=!1:(ys=t=!0,(a===2||a===9||a===3||a===6)&&(a=Ft.current,a!==null&&a.tag===13&&(a.flags|=16384))),u_(s,t)):ya(s)}function ya(t){var s=t;do{if((s.flags&32768)!==0){u_(s,ys);return}t=s.return;var r=oy(s.alternate,s,Qi);if(r!==null){xe=r;return}if(s=s.sibling,s!==null){xe=s;return}xe=s=t}while(s!==null);Ve===0&&(Ve=5)}function u_(t,s){do{var r=cy(t.alternate,t);if(r!==null){r.flags&=32767,xe=r;return}if(r=t.return,r!==null&&(r.flags|=32768,r.subtreeFlags=0,r.deletions=null),!s&&(t=t.sibling,t!==null)){xe=t;return}xe=t=r}while(t!==null);Ve=6,xe=null}function d_(t,s,r,a,c,u,m,v,w){t.cancelPendingCommit=null;do Sa();while(ct!==0);if((Me&6)!==0)throw Error(l(327));if(s!==null){if(s===t.current)throw Error(l(177));if(u=s.lanes|s.childLanes,u|=Go,Vv(t,r,u,m,v,w),t===We&&(xe=We=null,Ce=0),Pr=s,xs=t,Ji=r,ih=u,sh=c,t_=a,(s.subtreeFlags&10256)!==0||(s.flags&10256)!==0?(t.callbackNode=null,t.callbackPriority=0,by(xl,function(){return m_(),null})):(t.callbackNode=null,t.callbackPriority=0),a=(s.flags&13878)!==0,(s.subtreeFlags&13878)!==0||a){a=R.T,R.T=null,c=I.p,I.p=2,m=Me,Me|=4;try{hy(t,s,r)}finally{Me=m,I.p=c,R.T=a}}ct=1,f_(),p_(),__()}}function f_(){if(ct===1){ct=0;var t=xs,s=Pr,r=(s.flags&13878)!==0;if((s.subtreeFlags&13878)!==0||r){r=R.T,R.T=null;var a=I.p;I.p=2;var c=Me;Me|=4;try{Fp(s,t);var u=vh,m=Qd(t.containerInfo),v=u.focusedElem,w=u.selectionRange;if(m!==v&&v&&v.ownerDocument&&Zd(v.ownerDocument.documentElement,v)){if(w!==null&&Io(v)){var N=w.start,q=w.end;if(q===void 0&&(q=N),"selectionStart"in v)v.selectionStart=N,v.selectionEnd=Math.min(q,v.value.length);else{var K=v.ownerDocument||document,U=K&&K.defaultView||window;if(U.getSelection){var W=U.getSelection(),re=v.textContent.length,ce=Math.min(w.start,re),He=w.end===void 0?ce:Math.min(w.end,re);!W.extend&&ce>He&&(m=He,He=ce,ce=m);var B=Vd(v,ce),E=Vd(v,He);if(B&&E&&(W.rangeCount!==1||W.anchorNode!==B.node||W.anchorOffset!==B.offset||W.focusNode!==E.node||W.focusOffset!==E.offset)){var j=K.createRange();j.setStart(B.node,B.offset),W.removeAllRanges(),ce>He?(W.addRange(j),W.extend(E.node,E.offset)):(j.setEnd(E.node,E.offset),W.addRange(j))}}}}for(K=[],W=v;W=W.parentNode;)W.nodeType===1&&K.push({element:W,left:W.scrollLeft,top:W.scrollTop});for(typeof v.focus=="function"&&v.focus(),v=0;v<K.length;v++){var Y=K[v];Y.element.scrollLeft=Y.left,Y.element.scrollTop=Y.top}}za=!!mh,vh=mh=null}finally{Me=c,I.p=a,R.T=r}}t.current=s,ct=2}}function p_(){if(ct===2){ct=0;var t=xs,s=Pr,r=(s.flags&8772)!==0;if((s.subtreeFlags&8772)!==0||r){r=R.T,R.T=null;var a=I.p;I.p=2;var c=Me;Me|=4;try{Pp(t,s.alternate,s)}finally{Me=c,I.p=a,R.T=r}}ct=3}}function __(){if(ct===4||ct===3){ct=0,qv();var t=xs,s=Pr,r=Ji,a=t_;(s.subtreeFlags&10256)!==0||(s.flags&10256)!==0?ct=5:(ct=0,Pr=xs=null,g_(t,t.pendingLanes));var c=t.pendingLanes;if(c===0&&(bs=null),Co(r),s=s.stateNode,It&&typeof It.onCommitFiberRoot=="function")try{It.onCommitFiberRoot(rn,s,void 0,(s.current.flags&128)===128)}catch{}if(a!==null){s=R.T,c=I.p,I.p=2,R.T=null;try{for(var u=t.onRecoverableError,m=0;m<a.length;m++){var v=a[m];u(v.value,{componentStack:v.stack})}}finally{R.T=s,I.p=c}}(Ji&3)!==0&&Sa(),Ri(t),c=t.pendingLanes,(r&261930)!==0&&(c&42)!==0?t===rh?Un++:(Un=0,rh=t):Un=0,Wn(0)}}function g_(t,s){(t.pooledCacheLanes&=s)===0&&(s=t.pooledCache,s!=null&&(t.pooledCache=null,Sn(s)))}function Sa(){return f_(),p_(),__(),m_()}function m_(){if(ct!==5)return!1;var t=xs,s=ih;ih=0;var r=Co(Ji),a=R.T,c=I.p;try{I.p=32>r?32:r,R.T=null,r=sh,sh=null;var u=xs,m=Ji;if(ct=0,Pr=xs=null,Ji=0,(Me&6)!==0)throw Error(l(331));var v=Me;if(Me|=4,Qp(u.current),Xp(u,u.current,m,r),Me=v,Wn(0,!1),It&&typeof It.onPostCommitFiberRoot=="function")try{It.onPostCommitFiberRoot(rn,u)}catch{}return!0}finally{I.p=c,R.T=a,g_(t,s)}}function v_(t,s,r){s=ni(r,s),s=jc(t.stateNode,s,2),t=_s(t,s,2),t!==null&&(ln(t,2),Ri(t))}function Oe(t,s,r){if(t.tag===3)v_(t,t,r);else for(;s!==null;){if(s.tag===3){v_(s,t,r);break}else if(s.tag===1){var a=s.stateNode;if(typeof s.type.getDerivedStateFromError=="function"||typeof a.componentDidCatch=="function"&&(bs===null||!bs.has(a))){t=ni(r,t),r=yp(2),a=_s(s,r,2),a!==null&&(Sp(r,a,s,t),ln(a,2),Ri(a));break}}s=s.return}}function ah(t,s,r){var a=t.pingCache;if(a===null){a=t.pingCache=new fy;var c=new Set;a.set(s,c)}else c=a.get(s),c===void 0&&(c=new Set,a.set(s,c));c.has(r)||(Jc=!0,c.add(r),t=vy.bind(null,t,s,r),s.then(t,t))}function vy(t,s,r){var a=t.pingCache;a!==null&&a.delete(s),t.pingedLanes|=t.suspendedLanes&r,t.warmLanes&=~r,We===t&&(Ce&r)===r&&(Ve===4||Ve===3&&(Ce&62914560)===Ce&&300>Pt()-pa?(Me&2)===0&&Ir(t,0):eh|=r,qr===Ce&&(qr=0)),Ri(t)}function y_(t,s){s===0&&(s=dd()),t=Ps(t,s),t!==null&&(ln(t,s),Ri(t))}function yy(t){var s=t.memoizedState,r=0;s!==null&&(r=s.retryLane),y_(t,r)}function Sy(t,s){var r=0;switch(t.tag){case 31:case 13:var a=t.stateNode,c=t.memoizedState;c!==null&&(r=c.retryLane);break;case 19:a=t.stateNode;break;case 22:a=t.stateNode._retryCache;break;default:throw Error(l(314))}a!==null&&a.delete(s),y_(t,r)}function by(t,s){return So(t,s)}var ba=null,$r=null,oh=!1,xa=!1,ch=!1,Cs=0;function Ri(t){t!==$r&&t.next===null&&($r===null?ba=$r=t:$r=$r.next=t),xa=!0,oh||(oh=!0,wy())}function Wn(t,s){if(!ch&&xa){ch=!0;do for(var r=!1,a=ba;a!==null;){if(t!==0){var c=a.pendingLanes;if(c===0)var u=0;else{var m=a.suspendedLanes,v=a.pingedLanes;u=(1<<31-Yt(42|t)+1)-1,u&=c&~(m&~v),u=u&201326741?u&201326741|1:u?u|2:0}u!==0&&(r=!0,w_(a,u))}else u=Ce,u=El(a,a===We?u:0,a.cancelPendingCommit!==null||a.timeoutHandle!==-1),(u&3)===0||nn(a,u)||(r=!0,w_(a,u));a=a.next}while(r);ch=!1}}function xy(){S_()}function S_(){xa=oh=!1;var t=0;Cs!==0&&Ay()&&(t=Cs);for(var s=Pt(),r=null,a=ba;a!==null;){var c=a.next,u=b_(a,s);u===0?(a.next=null,r===null?ba=c:r.next=c,c===null&&($r=r)):(r=a,(t!==0||(u&3)!==0)&&(xa=!0)),a=c}ct!==0&&ct!==5||Wn(t),Cs!==0&&(Cs=0)}function b_(t,s){for(var r=t.suspendedLanes,a=t.pingedLanes,c=t.expirationTimes,u=t.pendingLanes&-62914561;0<u;){var m=31-Yt(u),v=1<<m,w=c[m];w===-1?((v&r)===0||(v&a)!==0)&&(c[m]=Xv(v,s)):w<=s&&(t.expiredLanes|=v),u&=~v}if(s=We,r=Ce,r=El(t,t===s?r:0,t.cancelPendingCommit!==null||t.timeoutHandle!==-1),a=t.callbackNode,r===0||t===s&&(Ae===2||Ae===9)||t.cancelPendingCommit!==null)return a!==null&&a!==null&&bo(a),t.callbackNode=null,t.callbackPriority=0;if((r&3)===0||nn(t,r)){if(s=r&-r,s===t.callbackPriority)return s;switch(a!==null&&bo(a),Co(r)){case 2:case 8:r=hd;break;case 32:r=xl;break;case 268435456:r=ud;break;default:r=xl}return a=x_.bind(null,t),r=So(r,a),t.callbackPriority=s,t.callbackNode=r,s}return a!==null&&a!==null&&bo(a),t.callbackPriority=2,t.callbackNode=null,2}function x_(t,s){if(ct!==0&&ct!==5)return t.callbackNode=null,t.callbackPriority=0,null;var r=t.callbackNode;if(Sa()&&t.callbackNode!==r)return null;var a=Ce;return a=El(t,t===We?a:0,t.cancelPendingCommit!==null||t.timeoutHandle!==-1),a===0?null:(s_(t,a,s),b_(t,Pt()),t.callbackNode!=null&&t.callbackNode===r?x_.bind(null,t):null)}function w_(t,s){if(Sa())return null;s_(t,s,!0)}function wy(){Ly(function(){(Me&6)!==0?So(cd,xy):S_()})}function hh(){if(Cs===0){var t=Br;t===0&&(t=wl,wl<<=1,(wl&261888)===0&&(wl=256)),Cs=t}return Cs}function C_(t){return t==null||typeof t=="symbol"||typeof t=="boolean"?null:typeof t=="function"?t:Bl(""+t)}function k_(t,s){var r=s.ownerDocument.createElement("input");return r.name=s.name,r.value=s.value,t.id&&r.setAttribute("form",t.id),s.parentNode.insertBefore(r,s),t=new FormData(t),r.parentNode.removeChild(r),t}function Cy(t,s,r,a,c){if(s==="submit"&&r&&r.stateNode===c){var u=C_((c[Ot]||null).action),m=a.submitter;m&&(s=(s=m[Ot]||null)?C_(s.formAction):m.getAttribute("formAction"),s!==null&&(u=s,m=null));var v=new Ol("action","action",null,a,c);t.push({event:v,listeners:[{instance:null,listener:function(){if(a.defaultPrevented){if(Cs!==0){var w=m?k_(c,m):new FormData(c);Bc(r,{pending:!0,data:w,method:c.method,action:u},null,w)}}else typeof u=="function"&&(v.preventDefault(),w=m?k_(c,m):new FormData(c),Bc(r,{pending:!0,data:w,method:c.method,action:u},u,w))},currentTarget:c}]})}}for(var uh=0;uh<Fo.length;uh++){var dh=Fo[uh],ky=dh.toLowerCase(),Ey=dh[0].toUpperCase()+dh.slice(1);vi(ky,"on"+Ey)}vi(tf,"onAnimationEnd"),vi(sf,"onAnimationIteration"),vi(rf,"onAnimationStart"),vi("dblclick","onDoubleClick"),vi("focusin","onFocus"),vi("focusout","onBlur"),vi(P0,"onTransitionRun"),vi(I0,"onTransitionStart"),vi(Y0,"onTransitionCancel"),vi(nf,"onTransitionEnd"),gr("onMouseEnter",["mouseout","mouseover"]),gr("onMouseLeave",["mouseout","mouseover"]),gr("onPointerEnter",["pointerout","pointerover"]),gr("onPointerLeave",["pointerout","pointerover"]),Hs("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),Hs("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),Hs("onBeforeInput",["compositionend","keypress","textInput","paste"]),Hs("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),Hs("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),Hs("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var qn="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(" "),Ty=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(qn));function E_(t,s){s=(s&4)!==0;for(var r=0;r<t.length;r++){var a=t[r],c=a.event;a=a.listeners;e:{var u=void 0;if(s)for(var m=a.length-1;0<=m;m--){var v=a[m],w=v.instance,N=v.currentTarget;if(v=v.listener,w!==u&&c.isPropagationStopped())break e;u=v,c.currentTarget=N;try{u(c)}catch(q){Nl(q)}c.currentTarget=null,u=w}else for(m=0;m<a.length;m++){if(v=a[m],w=v.instance,N=v.currentTarget,v=v.listener,w!==u&&c.isPropagationStopped())break e;u=v,c.currentTarget=N;try{u(c)}catch(q){Nl(q)}c.currentTarget=null,u=w}}}}function we(t,s){var r=s[ko];r===void 0&&(r=s[ko]=new Set);var a=t+"__bubble";r.has(a)||(T_(s,t,2,!1),r.add(a))}function fh(t,s,r){var a=0;s&&(a|=4),T_(r,t,a,s)}var wa="_reactListening"+Math.random().toString(36).slice(2);function ph(t){if(!t[wa]){t[wa]=!0,yd.forEach(function(r){r!=="selectionchange"&&(Ty.has(r)||fh(r,!1,t),fh(r,!0,t))});var s=t.nodeType===9?t:t.ownerDocument;s===null||s[wa]||(s[wa]=!0,fh("selectionchange",!1,s))}}function T_(t,s,r,a){switch(ig(s)){case 2:var c=tS;break;case 8:c=iS;break;default:c=Dh}r=c.bind(null,s,r,t),c=void 0,!Oo||s!=="touchstart"&&s!=="touchmove"&&s!=="wheel"||(c=!0),a?c!==void 0?t.addEventListener(s,r,{capture:!0,passive:c}):t.addEventListener(s,r,!0):c!==void 0?t.addEventListener(s,r,{passive:c}):t.addEventListener(s,r,!1)}function _h(t,s,r,a,c){var u=a;if((s&1)===0&&(s&2)===0&&a!==null)e:for(;;){if(a===null)return;var m=a.tag;if(m===3||m===4){var v=a.stateNode.containerInfo;if(v===c)break;if(m===4)for(m=a.return;m!==null;){var w=m.tag;if((w===3||w===4)&&m.stateNode.containerInfo===c)return;m=m.return}for(;v!==null;){if(m=fr(v),m===null)return;if(w=m.tag,w===5||w===6||w===26||w===27){a=u=m;continue e}v=v.parentNode}}a=a.return}Md(function(){var N=u,q=zo(r),K=[];e:{var U=lf.get(t);if(U!==void 0){var W=Ol,re=t;switch(t){case"keypress":if(zl(r)===0)break e;case"keydown":case"keyup":W=S0;break;case"focusin":re="focus",W=Ho;break;case"focusout":re="blur",W=Ho;break;case"beforeblur":case"afterblur":W=Ho;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":W=Od;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":W=o0;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":W=w0;break;case tf:case sf:case rf:W=u0;break;case nf:W=k0;break;case"scroll":case"scrollend":W=l0;break;case"wheel":W=T0;break;case"copy":case"cut":case"paste":W=f0;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":W=jd;break;case"toggle":case"beforetoggle":W=D0}var ce=(s&4)!==0,He=!ce&&(t==="scroll"||t==="scrollend"),B=ce?U!==null?U+"Capture":null:U;ce=[];for(var E=N,j;E!==null;){var Y=E;if(j=Y.stateNode,Y=Y.tag,Y!==5&&Y!==26&&Y!==27||j===null||B===null||(Y=cn(E,B),Y!=null&&ce.push(Pn(E,Y,j))),He)break;E=E.return}0<ce.length&&(U=new W(U,re,null,r,q),K.push({event:U,listeners:ce}))}}if((s&7)===0){e:{if(U=t==="mouseover"||t==="pointerover",W=t==="mouseout"||t==="pointerout",U&&r!==Mo&&(re=r.relatedTarget||r.fromElement)&&(fr(re)||re[dr]))break e;if((W||U)&&(U=q.window===q?q:(U=q.ownerDocument)?U.defaultView||U.parentWindow:window,W?(re=r.relatedTarget||r.toElement,W=N,re=re?fr(re):null,re!==null&&(He=h(re),ce=re.tag,re!==He||ce!==5&&ce!==27&&ce!==6)&&(re=null)):(W=null,re=N),W!==re)){if(ce=Od,Y="onMouseLeave",B="onMouseEnter",E="mouse",(t==="pointerout"||t==="pointerover")&&(ce=jd,Y="onPointerLeave",B="onPointerEnter",E="pointer"),He=W==null?U:on(W),j=re==null?U:on(re),U=new ce(Y,E+"leave",W,r,q),U.target=He,U.relatedTarget=j,Y=null,fr(q)===N&&(ce=new ce(B,E+"enter",re,r,q),ce.target=j,ce.relatedTarget=He,Y=ce),He=Y,W&&re)t:{for(ce=Ry,B=W,E=re,j=0,Y=B;Y;Y=ce(Y))j++;Y=0;for(var le=E;le;le=ce(le))Y++;for(;0<j-Y;)B=ce(B),j--;for(;0<Y-j;)E=ce(E),Y--;for(;j--;){if(B===E||E!==null&&B===E.alternate){ce=B;break t}B=ce(B),E=ce(E)}ce=null}else ce=null;W!==null&&R_(K,U,W,ce,!1),re!==null&&He!==null&&R_(K,He,re,ce,!0)}}e:{if(U=N?on(N):window,W=U.nodeName&&U.nodeName.toLowerCase(),W==="select"||W==="input"&&U.type==="file")var De=Yd;else if(Pd(U))if($d)De=U0;else{De=N0;var ne=j0}else W=U.nodeName,!W||W.toLowerCase()!=="input"||U.type!=="checkbox"&&U.type!=="radio"?N&&Bo(N.elementType)&&(De=Yd):De=H0;if(De&&(De=De(t,N))){Id(K,De,r,q);break e}ne&&ne(t,U,N),t==="focusout"&&N&&U.type==="number"&&N.memoizedProps.value!=null&&Do(U,"number",U.value)}switch(ne=N?on(N):window,t){case"focusin":(Pd(ne)||ne.contentEditable==="true")&&(xr=ne,Yo=N,mn=null);break;case"focusout":mn=Yo=xr=null;break;case"mousedown":$o=!0;break;case"contextmenu":case"mouseup":case"dragend":$o=!1,Jd(K,r,q);break;case"selectionchange":if(q0)break;case"keydown":case"keyup":Jd(K,r,q)}var ve;if(Wo)e:{switch(t){case"compositionstart":var ke="onCompositionStart";break e;case"compositionend":ke="onCompositionEnd";break e;case"compositionupdate":ke="onCompositionUpdate";break e}ke=void 0}else br?Wd(t,r)&&(ke="onCompositionEnd"):t==="keydown"&&r.keyCode===229&&(ke="onCompositionStart");ke&&(Nd&&r.locale!=="ko"&&(br||ke!=="onCompositionStart"?ke==="onCompositionEnd"&&br&&(ve=zd()):(os=q,Lo="value"in os?os.value:os.textContent,br=!0)),ne=Ca(N,ke),0<ne.length&&(ke=new Ld(ke,t,null,r,q),K.push({event:ke,listeners:ne}),ve?ke.data=ve:(ve=qd(r),ve!==null&&(ke.data=ve)))),(ve=M0?z0(t,r):A0(t,r))&&(ke=Ca(N,"onBeforeInput"),0<ke.length&&(ne=new Ld("onBeforeInput","beforeinput",null,r,q),K.push({event:ne,listeners:ke}),ne.data=ve)),Cy(K,t,N,r,q)}E_(K,s)})}function Pn(t,s,r){return{instance:t,listener:s,currentTarget:r}}function Ca(t,s){for(var r=s+"Capture",a=[];t!==null;){var c=t,u=c.stateNode;if(c=c.tag,c!==5&&c!==26&&c!==27||u===null||(c=cn(t,r),c!=null&&a.unshift(Pn(t,c,u)),c=cn(t,s),c!=null&&a.push(Pn(t,c,u))),t.tag===3)return a;t=t.return}return[]}function Ry(t){if(t===null)return null;do t=t.return;while(t&&t.tag!==5&&t.tag!==27);return t||null}function R_(t,s,r,a,c){for(var u=s._reactName,m=[];r!==null&&r!==a;){var v=r,w=v.alternate,N=v.stateNode;if(v=v.tag,w!==null&&w===a)break;v!==5&&v!==26&&v!==27||N===null||(w=N,c?(N=cn(r,u),N!=null&&m.unshift(Pn(r,N,w))):c||(N=cn(r,u),N!=null&&m.push(Pn(r,N,w)))),r=r.return}m.length!==0&&t.push({event:s,listeners:m})}var Dy=/\r\n?/g,By=/\u0000|\uFFFD/g;function D_(t){return(typeof t=="string"?t:""+t).replace(Dy,`
|
|
9
|
+
`).replace(By,"")}function B_(t,s){return s=D_(s),D_(t)===s}function Ne(t,s,r,a,c,u){switch(r){case"children":typeof a=="string"?s==="body"||s==="textarea"&&a===""||vr(t,a):(typeof a=="number"||typeof a=="bigint")&&s!=="body"&&vr(t,""+a);break;case"className":Rl(t,"class",a);break;case"tabIndex":Rl(t,"tabindex",a);break;case"dir":case"role":case"viewBox":case"width":case"height":Rl(t,r,a);break;case"style":Dd(t,a,u);break;case"data":if(s!=="object"){Rl(t,"data",a);break}case"src":case"href":if(a===""&&(s!=="a"||r!=="href")){t.removeAttribute(r);break}if(a==null||typeof a=="function"||typeof a=="symbol"||typeof a=="boolean"){t.removeAttribute(r);break}a=Bl(""+a),t.setAttribute(r,a);break;case"action":case"formAction":if(typeof a=="function"){t.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 u=="function"&&(r==="formAction"?(s!=="input"&&Ne(t,s,"name",c.name,c,null),Ne(t,s,"formEncType",c.formEncType,c,null),Ne(t,s,"formMethod",c.formMethod,c,null),Ne(t,s,"formTarget",c.formTarget,c,null)):(Ne(t,s,"encType",c.encType,c,null),Ne(t,s,"method",c.method,c,null),Ne(t,s,"target",c.target,c,null)));if(a==null||typeof a=="symbol"||typeof a=="boolean"){t.removeAttribute(r);break}a=Bl(""+a),t.setAttribute(r,a);break;case"onClick":a!=null&&(t.onclick=Hi);break;case"onScroll":a!=null&&we("scroll",t);break;case"onScrollEnd":a!=null&&we("scrollend",t);break;case"dangerouslySetInnerHTML":if(a!=null){if(typeof a!="object"||!("__html"in a))throw Error(l(61));if(r=a.__html,r!=null){if(c.children!=null)throw Error(l(60));t.innerHTML=r}}break;case"multiple":t.multiple=a&&typeof a!="function"&&typeof a!="symbol";break;case"muted":t.muted=a&&typeof a!="function"&&typeof a!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(a==null||typeof a=="function"||typeof a=="boolean"||typeof a=="symbol"){t.removeAttribute("xlink:href");break}r=Bl(""+a),t.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":a!=null&&typeof a!="function"&&typeof a!="symbol"?t.setAttribute(r,""+a):t.removeAttribute(r);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":a&&typeof a!="function"&&typeof a!="symbol"?t.setAttribute(r,""):t.removeAttribute(r);break;case"capture":case"download":a===!0?t.setAttribute(r,""):a!==!1&&a!=null&&typeof a!="function"&&typeof a!="symbol"?t.setAttribute(r,a):t.removeAttribute(r);break;case"cols":case"rows":case"size":case"span":a!=null&&typeof a!="function"&&typeof a!="symbol"&&!isNaN(a)&&1<=a?t.setAttribute(r,a):t.removeAttribute(r);break;case"rowSpan":case"start":a==null||typeof a=="function"||typeof a=="symbol"||isNaN(a)?t.removeAttribute(r):t.setAttribute(r,a);break;case"popover":we("beforetoggle",t),we("toggle",t),Tl(t,"popover",a);break;case"xlinkActuate":Ni(t,"http://www.w3.org/1999/xlink","xlink:actuate",a);break;case"xlinkArcrole":Ni(t,"http://www.w3.org/1999/xlink","xlink:arcrole",a);break;case"xlinkRole":Ni(t,"http://www.w3.org/1999/xlink","xlink:role",a);break;case"xlinkShow":Ni(t,"http://www.w3.org/1999/xlink","xlink:show",a);break;case"xlinkTitle":Ni(t,"http://www.w3.org/1999/xlink","xlink:title",a);break;case"xlinkType":Ni(t,"http://www.w3.org/1999/xlink","xlink:type",a);break;case"xmlBase":Ni(t,"http://www.w3.org/XML/1998/namespace","xml:base",a);break;case"xmlLang":Ni(t,"http://www.w3.org/XML/1998/namespace","xml:lang",a);break;case"xmlSpace":Ni(t,"http://www.w3.org/XML/1998/namespace","xml:space",a);break;case"is":Tl(t,"is",a);break;case"innerText":case"textContent":break;default:(!(2<r.length)||r[0]!=="o"&&r[0]!=="O"||r[1]!=="n"&&r[1]!=="N")&&(r=r0.get(r)||r,Tl(t,r,a))}}function gh(t,s,r,a,c,u){switch(r){case"style":Dd(t,a,u);break;case"dangerouslySetInnerHTML":if(a!=null){if(typeof a!="object"||!("__html"in a))throw Error(l(61));if(r=a.__html,r!=null){if(c.children!=null)throw Error(l(60));t.innerHTML=r}}break;case"children":typeof a=="string"?vr(t,a):(typeof a=="number"||typeof a=="bigint")&&vr(t,""+a);break;case"onScroll":a!=null&&we("scroll",t);break;case"onScrollEnd":a!=null&&we("scrollend",t);break;case"onClick":a!=null&&(t.onclick=Hi);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!Sd.hasOwnProperty(r))e:{if(r[0]==="o"&&r[1]==="n"&&(c=r.endsWith("Capture"),s=r.slice(2,c?r.length-7:void 0),u=t[Ot]||null,u=u!=null?u[r]:null,typeof u=="function"&&t.removeEventListener(s,u,c),typeof a=="function")){typeof u!="function"&&u!==null&&(r in t?t[r]=null:t.hasAttribute(r)&&t.removeAttribute(r)),t.addEventListener(s,a,c);break e}r in t?t[r]=a:a===!0?t.setAttribute(r,""):Tl(t,r,a)}}}function Ct(t,s,r){switch(s){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":we("error",t),we("load",t);var a=!1,c=!1,u;for(u in r)if(r.hasOwnProperty(u)){var m=r[u];if(m!=null)switch(u){case"src":a=!0;break;case"srcSet":c=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(l(137,s));default:Ne(t,s,u,m,r,null)}}c&&Ne(t,s,"srcSet",r.srcSet,r,null),a&&Ne(t,s,"src",r.src,r,null);return;case"input":we("invalid",t);var v=u=m=c=null,w=null,N=null;for(a in r)if(r.hasOwnProperty(a)){var q=r[a];if(q!=null)switch(a){case"name":c=q;break;case"type":m=q;break;case"checked":w=q;break;case"defaultChecked":N=q;break;case"value":u=q;break;case"defaultValue":v=q;break;case"children":case"dangerouslySetInnerHTML":if(q!=null)throw Error(l(137,s));break;default:Ne(t,s,a,q,r,null)}}kd(t,u,v,w,N,m,c,!1);return;case"select":we("invalid",t),a=m=u=null;for(c in r)if(r.hasOwnProperty(c)&&(v=r[c],v!=null))switch(c){case"value":u=v;break;case"defaultValue":m=v;break;case"multiple":a=v;default:Ne(t,s,c,v,r,null)}s=u,r=m,t.multiple=!!a,s!=null?mr(t,!!a,s,!1):r!=null&&mr(t,!!a,r,!0);return;case"textarea":we("invalid",t),u=c=a=null;for(m in r)if(r.hasOwnProperty(m)&&(v=r[m],v!=null))switch(m){case"value":a=v;break;case"defaultValue":c=v;break;case"children":u=v;break;case"dangerouslySetInnerHTML":if(v!=null)throw Error(l(91));break;default:Ne(t,s,m,v,r,null)}Td(t,a,c,u);return;case"option":for(w in r)r.hasOwnProperty(w)&&(a=r[w],a!=null)&&(w==="selected"?t.selected=a&&typeof a!="function"&&typeof a!="symbol":Ne(t,s,w,a,r,null));return;case"dialog":we("beforetoggle",t),we("toggle",t),we("cancel",t),we("close",t);break;case"iframe":case"object":we("load",t);break;case"video":case"audio":for(a=0;a<qn.length;a++)we(qn[a],t);break;case"image":we("error",t),we("load",t);break;case"details":we("toggle",t);break;case"embed":case"source":case"link":we("error",t),we("load",t);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(N in r)if(r.hasOwnProperty(N)&&(a=r[N],a!=null))switch(N){case"children":case"dangerouslySetInnerHTML":throw Error(l(137,s));default:Ne(t,s,N,a,r,null)}return;default:if(Bo(s)){for(q in r)r.hasOwnProperty(q)&&(a=r[q],a!==void 0&&gh(t,s,q,a,r,void 0));return}}for(v in r)r.hasOwnProperty(v)&&(a=r[v],a!=null&&Ne(t,s,v,a,r,null))}function My(t,s,r,a){switch(s){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var c=null,u=null,m=null,v=null,w=null,N=null,q=null;for(W in r){var K=r[W];if(r.hasOwnProperty(W)&&K!=null)switch(W){case"checked":break;case"value":break;case"defaultValue":w=K;default:a.hasOwnProperty(W)||Ne(t,s,W,null,a,K)}}for(var U in a){var W=a[U];if(K=r[U],a.hasOwnProperty(U)&&(W!=null||K!=null))switch(U){case"type":u=W;break;case"name":c=W;break;case"checked":N=W;break;case"defaultChecked":q=W;break;case"value":m=W;break;case"defaultValue":v=W;break;case"children":case"dangerouslySetInnerHTML":if(W!=null)throw Error(l(137,s));break;default:W!==K&&Ne(t,s,U,W,a,K)}}Ro(t,m,v,w,N,q,u,c);return;case"select":W=m=v=U=null;for(u in r)if(w=r[u],r.hasOwnProperty(u)&&w!=null)switch(u){case"value":break;case"multiple":W=w;default:a.hasOwnProperty(u)||Ne(t,s,u,null,a,w)}for(c in a)if(u=a[c],w=r[c],a.hasOwnProperty(c)&&(u!=null||w!=null))switch(c){case"value":U=u;break;case"defaultValue":v=u;break;case"multiple":m=u;default:u!==w&&Ne(t,s,c,u,a,w)}s=v,r=m,a=W,U!=null?mr(t,!!r,U,!1):!!a!=!!r&&(s!=null?mr(t,!!r,s,!0):mr(t,!!r,r?[]:"",!1));return;case"textarea":W=U=null;for(v in r)if(c=r[v],r.hasOwnProperty(v)&&c!=null&&!a.hasOwnProperty(v))switch(v){case"value":break;case"children":break;default:Ne(t,s,v,null,a,c)}for(m in a)if(c=a[m],u=r[m],a.hasOwnProperty(m)&&(c!=null||u!=null))switch(m){case"value":U=c;break;case"defaultValue":W=c;break;case"children":break;case"dangerouslySetInnerHTML":if(c!=null)throw Error(l(91));break;default:c!==u&&Ne(t,s,m,c,a,u)}Ed(t,U,W);return;case"option":for(var re in r)U=r[re],r.hasOwnProperty(re)&&U!=null&&!a.hasOwnProperty(re)&&(re==="selected"?t.selected=!1:Ne(t,s,re,null,a,U));for(w in a)U=a[w],W=r[w],a.hasOwnProperty(w)&&U!==W&&(U!=null||W!=null)&&(w==="selected"?t.selected=U&&typeof U!="function"&&typeof U!="symbol":Ne(t,s,w,U,a,W));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 ce in r)U=r[ce],r.hasOwnProperty(ce)&&U!=null&&!a.hasOwnProperty(ce)&&Ne(t,s,ce,null,a,U);for(N in a)if(U=a[N],W=r[N],a.hasOwnProperty(N)&&U!==W&&(U!=null||W!=null))switch(N){case"children":case"dangerouslySetInnerHTML":if(U!=null)throw Error(l(137,s));break;default:Ne(t,s,N,U,a,W)}return;default:if(Bo(s)){for(var He in r)U=r[He],r.hasOwnProperty(He)&&U!==void 0&&!a.hasOwnProperty(He)&&gh(t,s,He,void 0,a,U);for(q in a)U=a[q],W=r[q],!a.hasOwnProperty(q)||U===W||U===void 0&&W===void 0||gh(t,s,q,U,a,W);return}}for(var B in r)U=r[B],r.hasOwnProperty(B)&&U!=null&&!a.hasOwnProperty(B)&&Ne(t,s,B,null,a,U);for(K in a)U=a[K],W=r[K],!a.hasOwnProperty(K)||U===W||U==null&&W==null||Ne(t,s,K,U,a,W)}function M_(t){switch(t){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function zy(){if(typeof performance.getEntriesByType=="function"){for(var t=0,s=0,r=performance.getEntriesByType("resource"),a=0;a<r.length;a++){var c=r[a],u=c.transferSize,m=c.initiatorType,v=c.duration;if(u&&v&&M_(m)){for(m=0,v=c.responseEnd,a+=1;a<r.length;a++){var w=r[a],N=w.startTime;if(N>v)break;var q=w.transferSize,K=w.initiatorType;q&&M_(K)&&(w=w.responseEnd,m+=q*(w<v?1:(v-N)/(w-N)))}if(--a,s+=8*(u+m)/(c.duration/1e3),t++,10<t)break}}if(0<t)return s/t/1e6}return navigator.connection&&(t=navigator.connection.downlink,typeof t=="number")?t:5}var mh=null,vh=null;function ka(t){return t.nodeType===9?t:t.ownerDocument}function z_(t){switch(t){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function A_(t,s){if(t===0)switch(s){case"svg":return 1;case"math":return 2;default:return 0}return t===1&&s==="foreignObject"?0:t}function yh(t,s){return t==="textarea"||t==="noscript"||typeof s.children=="string"||typeof s.children=="number"||typeof s.children=="bigint"||typeof s.dangerouslySetInnerHTML=="object"&&s.dangerouslySetInnerHTML!==null&&s.dangerouslySetInnerHTML.__html!=null}var Sh=null;function Ay(){var t=window.event;return t&&t.type==="popstate"?t===Sh?!1:(Sh=t,!0):(Sh=null,!1)}var O_=typeof setTimeout=="function"?setTimeout:void 0,Oy=typeof clearTimeout=="function"?clearTimeout:void 0,L_=typeof Promise=="function"?Promise:void 0,Ly=typeof queueMicrotask=="function"?queueMicrotask:typeof L_<"u"?function(t){return L_.resolve(null).then(t).catch(jy)}:O_;function jy(t){setTimeout(function(){throw t})}function ks(t){return t==="head"}function j_(t,s){var r=s,a=0;do{var c=r.nextSibling;if(t.removeChild(r),c&&c.nodeType===8)if(r=c.data,r==="/$"||r==="/&"){if(a===0){t.removeChild(c),Xr(s);return}a--}else if(r==="$"||r==="$?"||r==="$~"||r==="$!"||r==="&")a++;else if(r==="html")In(t.ownerDocument.documentElement);else if(r==="head"){r=t.ownerDocument.head,In(r);for(var u=r.firstChild;u;){var m=u.nextSibling,v=u.nodeName;u[an]||v==="SCRIPT"||v==="STYLE"||v==="LINK"&&u.rel.toLowerCase()==="stylesheet"||r.removeChild(u),u=m}}else r==="body"&&In(t.ownerDocument.body);r=c}while(r);Xr(s)}function N_(t,s){var r=t;t=0;do{var a=r.nextSibling;if(r.nodeType===1?s?(r._stashedDisplay=r.style.display,r.style.display="none"):(r.style.display=r._stashedDisplay||"",r.getAttribute("style")===""&&r.removeAttribute("style")):r.nodeType===3&&(s?(r._stashedText=r.nodeValue,r.nodeValue=""):r.nodeValue=r._stashedText||""),a&&a.nodeType===8)if(r=a.data,r==="/$"){if(t===0)break;t--}else r!=="$"&&r!=="$?"&&r!=="$~"&&r!=="$!"||t++;r=a}while(r)}function bh(t){var s=t.firstChild;for(s&&s.nodeType===10&&(s=s.nextSibling);s;){var r=s;switch(s=s.nextSibling,r.nodeName){case"HTML":case"HEAD":case"BODY":bh(r),Eo(r);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(r.rel.toLowerCase()==="stylesheet")continue}t.removeChild(r)}}function Ny(t,s,r,a){for(;t.nodeType===1;){var c=r;if(t.nodeName.toLowerCase()!==s.toLowerCase()){if(!a&&(t.nodeName!=="INPUT"||t.type!=="hidden"))break}else if(a){if(!t[an])switch(s){case"meta":if(!t.hasAttribute("itemprop"))break;return t;case"link":if(u=t.getAttribute("rel"),u==="stylesheet"&&t.hasAttribute("data-precedence"))break;if(u!==c.rel||t.getAttribute("href")!==(c.href==null||c.href===""?null:c.href)||t.getAttribute("crossorigin")!==(c.crossOrigin==null?null:c.crossOrigin)||t.getAttribute("title")!==(c.title==null?null:c.title))break;return t;case"style":if(t.hasAttribute("data-precedence"))break;return t;case"script":if(u=t.getAttribute("src"),(u!==(c.src==null?null:c.src)||t.getAttribute("type")!==(c.type==null?null:c.type)||t.getAttribute("crossorigin")!==(c.crossOrigin==null?null:c.crossOrigin))&&u&&t.hasAttribute("async")&&!t.hasAttribute("itemprop"))break;return t;default:return t}}else if(s==="input"&&t.type==="hidden"){var u=c.name==null?null:""+c.name;if(c.type==="hidden"&&t.getAttribute("name")===u)return t}else return t;if(t=hi(t.nextSibling),t===null)break}return null}function Hy(t,s,r){if(s==="")return null;for(;t.nodeType!==3;)if((t.nodeType!==1||t.nodeName!=="INPUT"||t.type!=="hidden")&&!r||(t=hi(t.nextSibling),t===null))return null;return t}function H_(t,s){for(;t.nodeType!==8;)if((t.nodeType!==1||t.nodeName!=="INPUT"||t.type!=="hidden")&&!s||(t=hi(t.nextSibling),t===null))return null;return t}function xh(t){return t.data==="$?"||t.data==="$~"}function wh(t){return t.data==="$!"||t.data==="$?"&&t.ownerDocument.readyState!=="loading"}function Uy(t,s){var r=t.ownerDocument;if(t.data==="$~")t._reactRetry=s;else if(t.data!=="$?"||r.readyState!=="loading")s();else{var a=function(){s(),r.removeEventListener("DOMContentLoaded",a)};r.addEventListener("DOMContentLoaded",a),t._reactRetry=a}}function hi(t){for(;t!=null;t=t.nextSibling){var s=t.nodeType;if(s===1||s===3)break;if(s===8){if(s=t.data,s==="$"||s==="$!"||s==="$?"||s==="$~"||s==="&"||s==="F!"||s==="F")break;if(s==="/$"||s==="/&")return null}}return t}var Ch=null;function U_(t){t=t.nextSibling;for(var s=0;t;){if(t.nodeType===8){var r=t.data;if(r==="/$"||r==="/&"){if(s===0)return hi(t.nextSibling);s--}else r!=="$"&&r!=="$!"&&r!=="$?"&&r!=="$~"&&r!=="&"||s++}t=t.nextSibling}return null}function W_(t){t=t.previousSibling;for(var s=0;t;){if(t.nodeType===8){var r=t.data;if(r==="$"||r==="$!"||r==="$?"||r==="$~"||r==="&"){if(s===0)return t;s--}else r!=="/$"&&r!=="/&"||s++}t=t.previousSibling}return null}function q_(t,s,r){switch(s=ka(r),t){case"html":if(t=s.documentElement,!t)throw Error(l(452));return t;case"head":if(t=s.head,!t)throw Error(l(453));return t;case"body":if(t=s.body,!t)throw Error(l(454));return t;default:throw Error(l(451))}}function In(t){for(var s=t.attributes;s.length;)t.removeAttributeNode(s[0]);Eo(t)}var ui=new Map,P_=new Set;function Ea(t){return typeof t.getRootNode=="function"?t.getRootNode():t.nodeType===9?t:t.ownerDocument}var es=I.d;I.d={f:Wy,r:qy,D:Py,C:Iy,L:Yy,m:$y,X:Fy,S:Ky,M:Gy};function Wy(){var t=es.f(),s=ma();return t||s}function qy(t){var s=pr(t);s!==null&&s.tag===5&&s.type==="form"?np(s):es.r(t)}var Kr=typeof document>"u"?null:document;function I_(t,s,r){var a=Kr;if(a&&typeof s=="string"&&s){var c=si(s);c='link[rel="'+t+'"][href="'+c+'"]',typeof r=="string"&&(c+='[crossorigin="'+r+'"]'),P_.has(c)||(P_.add(c),t={rel:t,crossOrigin:r,href:s},a.querySelector(c)===null&&(s=a.createElement("link"),Ct(s,"link",t),ft(s),a.head.appendChild(s)))}}function Py(t){es.D(t),I_("dns-prefetch",t,null)}function Iy(t,s){es.C(t,s),I_("preconnect",t,s)}function Yy(t,s,r){es.L(t,s,r);var a=Kr;if(a&&t&&s){var c='link[rel="preload"][as="'+si(s)+'"]';s==="image"&&r&&r.imageSrcSet?(c+='[imagesrcset="'+si(r.imageSrcSet)+'"]',typeof r.imageSizes=="string"&&(c+='[imagesizes="'+si(r.imageSizes)+'"]')):c+='[href="'+si(t)+'"]';var u=c;switch(s){case"style":u=Fr(t);break;case"script":u=Gr(t)}ui.has(u)||(t=y({rel:"preload",href:s==="image"&&r&&r.imageSrcSet?void 0:t,as:s},r),ui.set(u,t),a.querySelector(c)!==null||s==="style"&&a.querySelector(Yn(u))||s==="script"&&a.querySelector($n(u))||(s=a.createElement("link"),Ct(s,"link",t),ft(s),a.head.appendChild(s)))}}function $y(t,s){es.m(t,s);var r=Kr;if(r&&t){var a=s&&typeof s.as=="string"?s.as:"script",c='link[rel="modulepreload"][as="'+si(a)+'"][href="'+si(t)+'"]',u=c;switch(a){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":u=Gr(t)}if(!ui.has(u)&&(t=y({rel:"modulepreload",href:t},s),ui.set(u,t),r.querySelector(c)===null)){switch(a){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(r.querySelector($n(u)))return}a=r.createElement("link"),Ct(a,"link",t),ft(a),r.head.appendChild(a)}}}function Ky(t,s,r){es.S(t,s,r);var a=Kr;if(a&&t){var c=_r(a).hoistableStyles,u=Fr(t);s=s||"default";var m=c.get(u);if(!m){var v={loading:0,preload:null};if(m=a.querySelector(Yn(u)))v.loading=5;else{t=y({rel:"stylesheet",href:t,"data-precedence":s},r),(r=ui.get(u))&&kh(t,r);var w=m=a.createElement("link");ft(w),Ct(w,"link",t),w._p=new Promise(function(N,q){w.onload=N,w.onerror=q}),w.addEventListener("load",function(){v.loading|=1}),w.addEventListener("error",function(){v.loading|=2}),v.loading|=4,Ta(m,s,a)}m={type:"stylesheet",instance:m,count:1,state:v},c.set(u,m)}}}function Fy(t,s){es.X(t,s);var r=Kr;if(r&&t){var a=_r(r).hoistableScripts,c=Gr(t),u=a.get(c);u||(u=r.querySelector($n(c)),u||(t=y({src:t,async:!0},s),(s=ui.get(c))&&Eh(t,s),u=r.createElement("script"),ft(u),Ct(u,"link",t),r.head.appendChild(u)),u={type:"script",instance:u,count:1,state:null},a.set(c,u))}}function Gy(t,s){es.M(t,s);var r=Kr;if(r&&t){var a=_r(r).hoistableScripts,c=Gr(t),u=a.get(c);u||(u=r.querySelector($n(c)),u||(t=y({src:t,async:!0,type:"module"},s),(s=ui.get(c))&&Eh(t,s),u=r.createElement("script"),ft(u),Ct(u,"link",t),r.head.appendChild(u)),u={type:"script",instance:u,count:1,state:null},a.set(c,u))}}function Y_(t,s,r,a){var c=(c=he.current)?Ea(c):null;if(!c)throw Error(l(446));switch(t){case"meta":case"title":return null;case"style":return typeof r.precedence=="string"&&typeof r.href=="string"?(s=Fr(r.href),r=_r(c).hoistableStyles,a=r.get(s),a||(a={type:"style",instance:null,count:0,state:null},r.set(s,a)),a):{type:"void",instance:null,count:0,state:null};case"link":if(r.rel==="stylesheet"&&typeof r.href=="string"&&typeof r.precedence=="string"){t=Fr(r.href);var u=_r(c).hoistableStyles,m=u.get(t);if(m||(c=c.ownerDocument||c,m={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},u.set(t,m),(u=c.querySelector(Yn(t)))&&!u._p&&(m.instance=u,m.state.loading=5),ui.has(t)||(r={rel:"preload",as:"style",href:r.href,crossOrigin:r.crossOrigin,integrity:r.integrity,media:r.media,hrefLang:r.hrefLang,referrerPolicy:r.referrerPolicy},ui.set(t,r),u||Xy(c,t,r,m.state))),s&&a===null)throw Error(l(528,""));return m}if(s&&a!==null)throw Error(l(529,""));return null;case"script":return s=r.async,r=r.src,typeof r=="string"&&s&&typeof s!="function"&&typeof s!="symbol"?(s=Gr(r),r=_r(c).hoistableScripts,a=r.get(s),a||(a={type:"script",instance:null,count:0,state:null},r.set(s,a)),a):{type:"void",instance:null,count:0,state:null};default:throw Error(l(444,t))}}function Fr(t){return'href="'+si(t)+'"'}function Yn(t){return'link[rel="stylesheet"]['+t+"]"}function $_(t){return y({},t,{"data-precedence":t.precedence,precedence:null})}function Xy(t,s,r,a){t.querySelector('link[rel="preload"][as="style"]['+s+"]")?a.loading=1:(s=t.createElement("link"),a.preload=s,s.addEventListener("load",function(){return a.loading|=1}),s.addEventListener("error",function(){return a.loading|=2}),Ct(s,"link",r),ft(s),t.head.appendChild(s))}function Gr(t){return'[src="'+si(t)+'"]'}function $n(t){return"script[async]"+t}function K_(t,s,r){if(s.count++,s.instance===null)switch(s.type){case"style":var a=t.querySelector('style[data-href~="'+si(r.href)+'"]');if(a)return s.instance=a,ft(a),a;var c=y({},r,{"data-href":r.href,"data-precedence":r.precedence,href:null,precedence:null});return a=(t.ownerDocument||t).createElement("style"),ft(a),Ct(a,"style",c),Ta(a,r.precedence,t),s.instance=a;case"stylesheet":c=Fr(r.href);var u=t.querySelector(Yn(c));if(u)return s.state.loading|=4,s.instance=u,ft(u),u;a=$_(r),(c=ui.get(c))&&kh(a,c),u=(t.ownerDocument||t).createElement("link"),ft(u);var m=u;return m._p=new Promise(function(v,w){m.onload=v,m.onerror=w}),Ct(u,"link",a),s.state.loading|=4,Ta(u,r.precedence,t),s.instance=u;case"script":return u=Gr(r.src),(c=t.querySelector($n(u)))?(s.instance=c,ft(c),c):(a=r,(c=ui.get(u))&&(a=y({},r),Eh(a,c)),t=t.ownerDocument||t,c=t.createElement("script"),ft(c),Ct(c,"link",a),t.head.appendChild(c),s.instance=c);case"void":return null;default:throw Error(l(443,s.type))}else s.type==="stylesheet"&&(s.state.loading&4)===0&&(a=s.instance,s.state.loading|=4,Ta(a,r.precedence,t));return s.instance}function Ta(t,s,r){for(var a=r.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),c=a.length?a[a.length-1]:null,u=c,m=0;m<a.length;m++){var v=a[m];if(v.dataset.precedence===s)u=v;else if(u!==c)break}u?u.parentNode.insertBefore(t,u.nextSibling):(s=r.nodeType===9?r.head:r,s.insertBefore(t,s.firstChild))}function kh(t,s){t.crossOrigin==null&&(t.crossOrigin=s.crossOrigin),t.referrerPolicy==null&&(t.referrerPolicy=s.referrerPolicy),t.title==null&&(t.title=s.title)}function Eh(t,s){t.crossOrigin==null&&(t.crossOrigin=s.crossOrigin),t.referrerPolicy==null&&(t.referrerPolicy=s.referrerPolicy),t.integrity==null&&(t.integrity=s.integrity)}var Ra=null;function F_(t,s,r){if(Ra===null){var a=new Map,c=Ra=new Map;c.set(r,a)}else c=Ra,a=c.get(r),a||(a=new Map,c.set(r,a));if(a.has(t))return a;for(a.set(t,null),r=r.getElementsByTagName(t),c=0;c<r.length;c++){var u=r[c];if(!(u[an]||u[St]||t==="link"&&u.getAttribute("rel")==="stylesheet")&&u.namespaceURI!=="http://www.w3.org/2000/svg"){var m=u.getAttribute(s)||"";m=t+m;var v=a.get(m);v?v.push(u):a.set(m,[u])}}return a}function G_(t,s,r){t=t.ownerDocument||t,t.head.insertBefore(r,s==="title"?t.querySelector("head > title"):null)}function Vy(t,s,r){if(r===1||s.itemProp!=null)return!1;switch(t){case"meta":case"title":return!0;case"style":if(typeof s.precedence!="string"||typeof s.href!="string"||s.href==="")break;return!0;case"link":if(typeof s.rel!="string"||typeof s.href!="string"||s.href===""||s.onLoad||s.onError)break;return s.rel==="stylesheet"?(t=s.disabled,typeof s.precedence=="string"&&t==null):!0;case"script":if(s.async&&typeof s.async!="function"&&typeof s.async!="symbol"&&!s.onLoad&&!s.onError&&s.src&&typeof s.src=="string")return!0}return!1}function X_(t){return!(t.type==="stylesheet"&&(t.state.loading&3)===0)}function Zy(t,s,r,a){if(r.type==="stylesheet"&&(typeof a.media!="string"||matchMedia(a.media).matches!==!1)&&(r.state.loading&4)===0){if(r.instance===null){var c=Fr(a.href),u=s.querySelector(Yn(c));if(u){s=u._p,s!==null&&typeof s=="object"&&typeof s.then=="function"&&(t.count++,t=Da.bind(t),s.then(t,t)),r.state.loading|=4,r.instance=u,ft(u);return}u=s.ownerDocument||s,a=$_(a),(c=ui.get(c))&&kh(a,c),u=u.createElement("link"),ft(u);var m=u;m._p=new Promise(function(v,w){m.onload=v,m.onerror=w}),Ct(u,"link",a),r.instance=u}t.stylesheets===null&&(t.stylesheets=new Map),t.stylesheets.set(r,s),(s=r.state.preload)&&(r.state.loading&3)===0&&(t.count++,r=Da.bind(t),s.addEventListener("load",r),s.addEventListener("error",r))}}var Th=0;function Qy(t,s){return t.stylesheets&&t.count===0&&Ma(t,t.stylesheets),0<t.count||0<t.imgCount?function(r){var a=setTimeout(function(){if(t.stylesheets&&Ma(t,t.stylesheets),t.unsuspend){var u=t.unsuspend;t.unsuspend=null,u()}},6e4+s);0<t.imgBytes&&Th===0&&(Th=62500*zy());var c=setTimeout(function(){if(t.waitingForImages=!1,t.count===0&&(t.stylesheets&&Ma(t,t.stylesheets),t.unsuspend)){var u=t.unsuspend;t.unsuspend=null,u()}},(t.imgBytes>Th?50:800)+s);return t.unsuspend=r,function(){t.unsuspend=null,clearTimeout(a),clearTimeout(c)}}:null}function Da(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Ma(this,this.stylesheets);else if(this.unsuspend){var t=this.unsuspend;this.unsuspend=null,t()}}}var Ba=null;function Ma(t,s){t.stylesheets=null,t.unsuspend!==null&&(t.count++,Ba=new Map,s.forEach(Jy,t),Ba=null,Da.call(t))}function Jy(t,s){if(!(s.state.loading&4)){var r=Ba.get(t);if(r)var a=r.get(null);else{r=new Map,Ba.set(t,r);for(var c=t.querySelectorAll("link[data-precedence],style[data-precedence]"),u=0;u<c.length;u++){var m=c[u];(m.nodeName==="LINK"||m.getAttribute("media")!=="not all")&&(r.set(m.dataset.precedence,m),a=m)}a&&r.set(null,a)}c=s.instance,m=c.getAttribute("data-precedence"),u=r.get(m)||a,u===a&&r.set(null,c),r.set(m,c),this.count++,a=Da.bind(this),c.addEventListener("load",a),c.addEventListener("error",a),u?u.parentNode.insertBefore(c,u.nextSibling):(t=t.nodeType===9?t.head:t,t.insertBefore(c,t.firstChild)),s.state.loading|=4}}var Kn={$$typeof:D,Provider:null,Consumer:null,_currentValue:$,_currentValue2:$,_threadCount:0};function eS(t,s,r,a,c,u,m,v,w){this.tag=1,this.containerInfo=t,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=xo(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=xo(0),this.hiddenUpdates=xo(null),this.identifierPrefix=a,this.onUncaughtError=c,this.onCaughtError=u,this.onRecoverableError=m,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=w,this.incompleteTransitions=new Map}function V_(t,s,r,a,c,u,m,v,w,N,q,K){return t=new eS(t,s,r,m,w,N,q,K,v),s=1,u===!0&&(s|=24),u=Kt(3,null,null,s),t.current=u,u.stateNode=t,s=lc(),s.refCount++,t.pooledCache=s,s.refCount++,u.memoizedState={element:a,isDehydrated:r,cache:s},hc(u),t}function Z_(t){return t?(t=kr,t):kr}function Q_(t,s,r,a,c,u){c=Z_(c),a.context===null?a.context=c:a.pendingContext=c,a=ps(s),a.payload={element:r},u=u===void 0?null:u,u!==null&&(a.callback=u),r=_s(t,a,s),r!==null&&(Wt(r,t,s),Cn(r,t,s))}function J_(t,s){if(t=t.memoizedState,t!==null&&t.dehydrated!==null){var r=t.retryLane;t.retryLane=r!==0&&r<s?r:s}}function Rh(t,s){J_(t,s),(t=t.alternate)&&J_(t,s)}function eg(t){if(t.tag===13||t.tag===31){var s=Ps(t,67108864);s!==null&&Wt(s,t,67108864),Rh(t,67108864)}}function tg(t){if(t.tag===13||t.tag===31){var s=Zt();s=wo(s);var r=Ps(t,s);r!==null&&Wt(r,t,s),Rh(t,s)}}var za=!0;function tS(t,s,r,a){var c=R.T;R.T=null;var u=I.p;try{I.p=2,Dh(t,s,r,a)}finally{I.p=u,R.T=c}}function iS(t,s,r,a){var c=R.T;R.T=null;var u=I.p;try{I.p=8,Dh(t,s,r,a)}finally{I.p=u,R.T=c}}function Dh(t,s,r,a){if(za){var c=Bh(a);if(c===null)_h(t,s,a,Aa,r),sg(t,a);else if(rS(c,t,s,r,a))a.stopPropagation();else if(sg(t,a),s&4&&-1<sS.indexOf(t)){for(;c!==null;){var u=pr(c);if(u!==null)switch(u.tag){case 3:if(u=u.stateNode,u.current.memoizedState.isDehydrated){var m=Ns(u.pendingLanes);if(m!==0){var v=u;for(v.pendingLanes|=2,v.entangledLanes|=2;m;){var w=1<<31-Yt(m);v.entanglements[1]|=w,m&=~w}Ri(u),(Me&6)===0&&(_a=Pt()+500,Wn(0))}}break;case 31:case 13:v=Ps(u,2),v!==null&&Wt(v,u,2),ma(),Rh(u,2)}if(u=Bh(a),u===null&&_h(t,s,a,Aa,r),u===c)break;c=u}c!==null&&a.stopPropagation()}else _h(t,s,a,null,r)}}function Bh(t){return t=zo(t),Mh(t)}var Aa=null;function Mh(t){if(Aa=null,t=fr(t),t!==null){var s=h(t);if(s===null)t=null;else{var r=s.tag;if(r===13){if(t=d(s),t!==null)return t;t=null}else if(r===31){if(t=_(s),t!==null)return t;t=null}else if(r===3){if(s.stateNode.current.memoizedState.isDehydrated)return s.tag===3?s.stateNode.containerInfo:null;t=null}else s!==t&&(t=null)}}return Aa=t,null}function ig(t){switch(t){case"beforetoggle":case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"toggle":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 2;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 8;case"message":switch(Pv()){case cd:return 2;case hd:return 8;case xl:case Iv:return 32;case ud:return 268435456;default:return 32}default:return 32}}var zh=!1,Es=null,Ts=null,Rs=null,Fn=new Map,Gn=new Map,Ds=[],sS="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 sg(t,s){switch(t){case"focusin":case"focusout":Es=null;break;case"dragenter":case"dragleave":Ts=null;break;case"mouseover":case"mouseout":Rs=null;break;case"pointerover":case"pointerout":Fn.delete(s.pointerId);break;case"gotpointercapture":case"lostpointercapture":Gn.delete(s.pointerId)}}function Xn(t,s,r,a,c,u){return t===null||t.nativeEvent!==u?(t={blockedOn:s,domEventName:r,eventSystemFlags:a,nativeEvent:u,targetContainers:[c]},s!==null&&(s=pr(s),s!==null&&eg(s)),t):(t.eventSystemFlags|=a,s=t.targetContainers,c!==null&&s.indexOf(c)===-1&&s.push(c),t)}function rS(t,s,r,a,c){switch(s){case"focusin":return Es=Xn(Es,t,s,r,a,c),!0;case"dragenter":return Ts=Xn(Ts,t,s,r,a,c),!0;case"mouseover":return Rs=Xn(Rs,t,s,r,a,c),!0;case"pointerover":var u=c.pointerId;return Fn.set(u,Xn(Fn.get(u)||null,t,s,r,a,c)),!0;case"gotpointercapture":return u=c.pointerId,Gn.set(u,Xn(Gn.get(u)||null,t,s,r,a,c)),!0}return!1}function rg(t){var s=fr(t.target);if(s!==null){var r=h(s);if(r!==null){if(s=r.tag,s===13){if(s=d(r),s!==null){t.blockedOn=s,md(t.priority,function(){tg(r)});return}}else if(s===31){if(s=_(r),s!==null){t.blockedOn=s,md(t.priority,function(){tg(r)});return}}else if(s===3&&r.stateNode.current.memoizedState.isDehydrated){t.blockedOn=r.tag===3?r.stateNode.containerInfo:null;return}}}t.blockedOn=null}function Oa(t){if(t.blockedOn!==null)return!1;for(var s=t.targetContainers;0<s.length;){var r=Bh(t.nativeEvent);if(r===null){r=t.nativeEvent;var a=new r.constructor(r.type,r);Mo=a,r.target.dispatchEvent(a),Mo=null}else return s=pr(r),s!==null&&eg(s),t.blockedOn=r,!1;s.shift()}return!0}function ng(t,s,r){Oa(t)&&r.delete(s)}function nS(){zh=!1,Es!==null&&Oa(Es)&&(Es=null),Ts!==null&&Oa(Ts)&&(Ts=null),Rs!==null&&Oa(Rs)&&(Rs=null),Fn.forEach(ng),Gn.forEach(ng)}function La(t,s){t.blockedOn===s&&(t.blockedOn=null,zh||(zh=!0,e.unstable_scheduleCallback(e.unstable_NormalPriority,nS)))}var ja=null;function lg(t){ja!==t&&(ja=t,e.unstable_scheduleCallback(e.unstable_NormalPriority,function(){ja===t&&(ja=null);for(var s=0;s<t.length;s+=3){var r=t[s],a=t[s+1],c=t[s+2];if(typeof a!="function"){if(Mh(a||r)===null)continue;break}var u=pr(r);u!==null&&(t.splice(s,3),s-=3,Bc(u,{pending:!0,data:c,method:r.method,action:a},a,c))}}))}function Xr(t){function s(w){return La(w,t)}Es!==null&&La(Es,t),Ts!==null&&La(Ts,t),Rs!==null&&La(Rs,t),Fn.forEach(s),Gn.forEach(s);for(var r=0;r<Ds.length;r++){var a=Ds[r];a.blockedOn===t&&(a.blockedOn=null)}for(;0<Ds.length&&(r=Ds[0],r.blockedOn===null);)rg(r),r.blockedOn===null&&Ds.shift();if(r=(t.ownerDocument||t).$$reactFormReplay,r!=null)for(a=0;a<r.length;a+=3){var c=r[a],u=r[a+1],m=c[Ot]||null;if(typeof u=="function")m||lg(r);else if(m){var v=null;if(u&&u.hasAttribute("formAction")){if(c=u,m=u[Ot]||null)v=m.formAction;else if(Mh(c)!==null)continue}else v=m.action;typeof v=="function"?r[a+1]=v:(r.splice(a,3),a-=3),lg(r)}}}function ag(){function t(u){u.canIntercept&&u.info==="react-transition"&&u.intercept({handler:function(){return new Promise(function(m){return c=m})},focusReset:"manual",scroll:"manual"})}function s(){c!==null&&(c(),c=null),a||setTimeout(r,20)}function r(){if(!a&&!navigation.transition){var u=navigation.currentEntry;u&&u.url!=null&&navigation.navigate(u.url,{state:u.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var a=!1,c=null;return navigation.addEventListener("navigate",t),navigation.addEventListener("navigatesuccess",s),navigation.addEventListener("navigateerror",s),setTimeout(r,100),function(){a=!0,navigation.removeEventListener("navigate",t),navigation.removeEventListener("navigatesuccess",s),navigation.removeEventListener("navigateerror",s),c!==null&&(c(),c=null)}}}function Ah(t){this._internalRoot=t}Na.prototype.render=Ah.prototype.render=function(t){var s=this._internalRoot;if(s===null)throw Error(l(409));var r=s.current,a=Zt();Q_(r,a,t,s,null,null)},Na.prototype.unmount=Ah.prototype.unmount=function(){var t=this._internalRoot;if(t!==null){this._internalRoot=null;var s=t.containerInfo;Q_(t.current,2,null,t,null,null),ma(),s[dr]=null}};function Na(t){this._internalRoot=t}Na.prototype.unstable_scheduleHydration=function(t){if(t){var s=gd();t={blockedOn:null,target:t,priority:s};for(var r=0;r<Ds.length&&s!==0&&s<Ds[r].priority;r++);Ds.splice(r,0,t),r===0&&rg(t)}};var og=i.version;if(og!=="19.2.4")throw Error(l(527,og,"19.2.4"));I.findDOMNode=function(t){var s=t._reactInternals;if(s===void 0)throw typeof t.render=="function"?Error(l(188)):(t=Object.keys(t).join(","),Error(l(268,t)));return t=f(s),t=t!==null?S(t):null,t=t===null?null:t.stateNode,t};var lS={bundleType:0,version:"19.2.4",rendererPackageName:"react-dom",currentDispatcherRef:R,reconcilerVersion:"19.2.4"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Ha=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Ha.isDisabled&&Ha.supportsFiber)try{rn=Ha.inject(lS),It=Ha}catch{}}return Zn.createRoot=function(t,s){if(!o(t))throw Error(l(299));var r=!1,a="",c=_p,u=gp,m=mp;return s!=null&&(s.unstable_strictMode===!0&&(r=!0),s.identifierPrefix!==void 0&&(a=s.identifierPrefix),s.onUncaughtError!==void 0&&(c=s.onUncaughtError),s.onCaughtError!==void 0&&(u=s.onCaughtError),s.onRecoverableError!==void 0&&(m=s.onRecoverableError)),s=V_(t,1,!1,null,null,r,a,null,c,u,m,ag),t[dr]=s.current,ph(t),new Ah(s)},Zn.hydrateRoot=function(t,s,r){if(!o(t))throw Error(l(299));var a=!1,c="",u=_p,m=gp,v=mp,w=null;return r!=null&&(r.unstable_strictMode===!0&&(a=!0),r.identifierPrefix!==void 0&&(c=r.identifierPrefix),r.onUncaughtError!==void 0&&(u=r.onUncaughtError),r.onCaughtError!==void 0&&(m=r.onCaughtError),r.onRecoverableError!==void 0&&(v=r.onRecoverableError),r.formState!==void 0&&(w=r.formState)),s=V_(t,1,!0,s,r??null,a,c,w,u,m,v,ag),s.context=Z_(null),r=s.current,a=Zt(),a=wo(a),c=ps(a),c.callback=null,_s(r,c,a),r=a,s.current.lanes=r,ln(s,r),Ri(s),t[dr]=s.current,ph(t),new Na(s)},Zn.version="19.2.4",Zn}var vg;function gS(){if(vg)return jh.exports;vg=1;function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(i){console.error(i)}}return e(),jh.exports=_S(),jh.exports}var mS=gS();const xm="claude-portal",yg="greenhouse-setup",vS=10;function wm(){const e=localStorage.getItem(xm);if(e)try{return JSON.parse(e)}catch{}const i=localStorage.getItem(yg);if(i)try{const n=JSON.parse(i),l={recentProjects:n.projectDir?[n.projectDir]:[],checklist:{},jobHistory:{}};return Cm(l),localStorage.removeItem(yg),l}catch{}return{recentProjects:[],checklist:{},jobHistory:{}}}function Cm(e){localStorage.setItem(xm,JSON.stringify(e))}function km(){return wm().recentProjects}function yS(e){const i=wm();return i.recentProjects=[e,...i.recentProjects.filter(n=>n!==e)].slice(0,vS),Cm(i),i.recentProjects}const Em=z.createContext(null);function SS({children:e}){const[i,n]=z.useState(null),[l,o]=z.useState(km),[h,d]=z.useState(null),[_,p]=z.useState(null),[f,S]=z.useState(!1),[y,x]=z.useState(!0),[C,b]=z.useState("developer"),[T,M]=z.useState(!1),A=z.useCallback(L=>{n(L),o(yS(L)),d(null),p(null)},[]),O=z.useCallback(()=>{n(null),d(null),p(null),b("developer"),M(!1)},[]),D=z.useCallback((L,H)=>{d(L),p(H)},[]);return g.jsx(Em.Provider,{value:{path:i,recentProjects:l,gitBranch:h,gitRemote:_,terminalConnected:f,serverConnected:y,mode:C,setMode:b,editingBrain:T,setEditingBrain:M,setProjectPath:A,clearProject:O,setGitInfo:D,setTerminalConnected:S,setServerConnected:x},children:e})}function Et(){const e=z.useContext(Em);if(!e)throw new Error("useProject must be used within ProjectProvider");return e}const Tm=z.createContext(null);function bS(e){return e.replace(/\x1b\[[?>=!]?[0-9;]*[a-zA-Z]/g,"").replace(/\x1b\][^\x07\x1b]*(?:\x07|\x1b\\)/g,"").replace(/\x1b[()][0-9A-Z]/g,"").replace(/\x1b./g,"").replace(/\r/g,"")}function xS({children:e}){const i=z.useRef(null),[n,l]=z.useState(!1),[o,h]=z.useState([]),d=z.useRef(!1),_=z.useRef(null),p=z.useRef(null),f=z.useRef(null),S=z.useRef(null),y=z.useRef(null),x=z.useRef(null),C=z.useRef(null),b=z.useCallback(H=>{h(X=>{const V=[...X,H];return V.length>100?V.slice(V.length-100):V})},[]),T=z.useCallback((H,X)=>{x.current=H,C.current=X},[]),M=z.useCallback(H=>{const X=i.current;X?.readyState===WebSocket.OPEN&&X.send(JSON.stringify({type:"input",data:H}))},[]),A=z.useCallback(()=>{if(_.current){const H=_.current;_.current=null,setTimeout(()=>M(H+"\r"),300)}},[M]),O=z.useCallback(()=>{d.current||(d.current=!0,l(!0),f.current&&(clearTimeout(f.current),f.current=null),A())},[A]),D=z.useCallback(H=>{d.current?M(H+"\r"):_.current=H},[M]),L=z.useCallback(H=>{i.current&&i.current.close(),f.current&&(clearTimeout(f.current),f.current=null),d.current=!1,l(!1),p.current=null;const X=location.protocol==="https:"?"wss:":"ws:",V=new WebSocket(`${X}//${location.host}/terminal?cwd=${encodeURIComponent(H)}`);return i.current=V,V.onopen=()=>{x.current?.(),setTimeout(()=>{M("claude --dangerously-skip-permissions\r"),p.current=Date.now()},500),f.current=setTimeout(O,15e3)},V.onmessage=ue=>{let ge;try{ge=JSON.parse(ue.data)}catch{return}if(ge.type==="output"){if(ge.data&&S.current?.(ge.data),!d.current&&p.current&&Date.now()-p.current>2e3){const de=bS(ge.data||"");(/>\s*$/.test(de)||de.includes("What can I help"))&&O()}}else ge.type==="exit"?y.current?.():ge.type==="error"&&S.current?.(`\r
|
|
10
10
|
[Error: ${ge.data||ge.message||"Unknown error"}]\r
|
|
11
11
|
`)},V.onclose=()=>C.current?.(),V},[M,O]);return g.jsx(Tm.Provider,{value:{sendPrompt:D,isReady:n,connect:L,wsRef:i,onOutput:S,onExit:y,setConnectionCallbacks:T,outputLines:o,addOutputLine:b},children:e})}function en(){const e=z.useContext(Tm);if(!e)throw new Error("useTerminal must be used within TerminalProvider");return e}async function _i(e,i){try{const n=await fetch(e,i);return n.ok?await n.json():null}catch{return null}}function Rm(e,i){const n=new URL(e,window.location.origin);return i&&n.searchParams.set("projectPath",i),n.toString()}const oo=[{key:"summarize",name:"Summarize",emoji:"📝",description:"Key points & themes",format:"md",category:"understand",prompt:`create a comprehensive summary covering:
|
|
12
12
|
- Key findings and themes
|
|
@@ -32,8 +32,8 @@ Present findings in a structured format with specific references.`},{key:"transf
|
|
|
32
32
|
Restructure and reformat the information while preserving all key content. If extracting to a table or spreadsheet format, use CSV with the first row as column headers.`}],wS=[{key:"understand",label:"Understand",description:"Tell me what's in here"},{key:"create",label:"Create",description:"Make something from this"}],CS=`IMPORTANT: Do NOT modify, move, rename, or delete any of the original files. Only create new files in the output/ directory.
|
|
33
33
|
If you cannot read a file, note it as skipped in the output with the filename and reason.`,kS="If the folder has more files than you can process in one pass, focus on the most relevant files based on their names and types, and note which files were not reviewed.";function ES(e){const{folderPath:i,templateKey:n,freeformText:l,context:o,fileCount:h}=e,d=n?oo.find(x=>x.key===n):null,_=d?.format||"md",p=new Date().toISOString().slice(0,10),f=d?.key||"output",S=`${i}/output/${f}-${p}.${_}`,y=[CS,""];return h>50&&y.push(kS,""),d&&y.push(`Scan all documents in ${i} and ${d.prompt}`),l&&y.push(d?`
|
|
34
34
|
Also: ${l}`:`Scan all documents in ${i} and ${l}`),o&&y.push("",`Additional instructions: ${o}`),e.styleReference&&(y.push("","Use the following document as a style, tone, and format reference. Match its structure, headings, voice, and level of detail:"),y.push("---BEGIN STYLE REFERENCE---"),y.push(e.styleReference.slice(0,8e3)),y.push("---END STYLE REFERENCE---")),y.push("",`Save the output to ${S}`),y.join(`
|
|
35
|
-
`)}function TS(e){const i=z.useRef(e);i.current=e;const n=z.useRef(null),l=z.useRef(null),o=z.useCallback(()=>{n.current?.close(),n.current=null,l.current&&(clearTimeout(l.current),l.current=null)},[]),h=z.useCallback((d,_)=>{o();const p=`/api/doc-events?folderPath=${encodeURIComponent(d)}`,f=new EventSource(p);n.current=f,f.addEventListener("output-created",S=>{i.current(JSON.parse(S.data)),o()}),l.current=setTimeout(()=>{o(),_()},600*1e3)},[o]);return z.useEffect(()=>o,[o]),{listen:h,close:o}}const Dm=z.createContext(null);function RS({children:e}){const[i,n]=z.useState(null),[l,o]=z.useState(null),[h,d]=z.useState(!1),[_,p]=z.useState(null),[f,S]=z.useState(""),[y,x]=z.useState(""),[C,b]=z.useState({status:"empty"}),[T,M]=z.useState(null),[A,O]=z.useState(!1),{sendPrompt:D}=en(),{path:L,mode:H}=Et(),X=z.useCallback(async de=>{let Z=await _i(`/api/read-output?path=${encodeURIComponent(de)}`);Z||(Z=await _i(`/api/read-file?path=${encodeURIComponent(de)}`)),Z?(b({status:"complete",...Z}),O(!1)):(b({status:"error",message:"Failed to load file"}),O(!1))},[]),V=TS(de=>X(de.path)),ue=z.useCallback(async de=>{n(de),d(!0);const Z=await _i(`/api/folder-scan?folderPath=${encodeURIComponent(de)}`);o(Z||null),d(!1)},[]);z.useEffect(()=>{H==="document"&&L&&!i&&ue(L)},[H,L,i,ue]);const ge=z.useCallback(()=>{n(null),o(null),b({status:"empty"}),O(!1),V.close()},[V]),
|
|
36
|
-
`);H=ue.pop()??"";for(const ge of ue)if(ge.startsWith("data: "))try{const Ye=JSON.parse(ge.slice(6));Ye.tool===M&&Ye.status==="done"&&(L=!0),Ye.tool===M&&Ye.status==="error"&&(L=!1,Ye.error&&h(de=>({...de,[M]:Ye.error})))}catch{}}}y(H=>({...H,[M]:L?"done":"error"}))}catch{y(A=>({...A,[M]:"error"}))}l(null)}const b=x.every(M=>S[M.id]==="done"),T=M=>{switch(M){case"done":return{symbol:"✓",color:"#22c55e"};case"error":return{symbol:"✗",color:"#ef4444"};case"installing":return{symbol:"⏳",color:"#f59e0b"};default:return{symbol:"○",color:"#9ca3af"}}};return g.jsxs("div",{className:"space-y-4",children:[g.jsx("h2",{style:{fontSize:"20px",fontWeight:600,color:"var(--text-primary)"},children:"Install missing tools"}),g.jsx("p",{style:{fontSize:"14px",color:"var(--text-secondary)",marginTop:"-8px"},children:"We'll help you get everything set up step by step."}),g.jsx("div",{className:"space-y-2",children:x.map(M=>{const A=MS[M.id],O=T(S[M.id]),D=d===M.id;return g.jsxs("div",{children:[g.jsx("div",{style:{padding:"16px 20px",background:"var(--bg-secondary)",border:"1px solid var(--border)",borderRadius:D?"12px 12px 0 0":"12px",boxShadow:"0 2px 8px rgba(0,0,0,0.04)"},children:g.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"12px"},children:[g.jsx("span",{style:{color:O.color,fontSize:"16px"},children:O.symbol}),g.jsx("div",{style:{flex:1},children:g.jsx("span",{style:{color:"var(--text-primary)",fontSize:"15px",fontWeight:500},children:M.name})}),S[M.id]==="pending"&&g.jsxs("div",{style:{display:"flex",gap:"6px"},children:[A&&g.jsx("button",{onClick:()=>_(D?null:M.id),style:{padding:"8px 12px",background:"transparent",color:"#6b7280",fontSize:"12px",fontWeight:500,borderRadius:"8px",border:"1px solid #e5e7eb",cursor:"pointer"},children:"Guide"}),g.jsx("button",{onClick:()=>C(M.id),disabled:n!==null,style:{padding:"8px 16px",background:"#22c55e",color:"#fff",fontSize:"13px",fontWeight:600,borderRadius:"8px",border:"none",cursor:"pointer",opacity:n?.5:1},children:"Install"})]}),S[M.id]==="error"&&g.jsx("button",{onClick:()=>C(M.id),disabled:n!==null,style:{padding:"8px 16px",background:"#ef4444",color:"#fff",fontSize:"13px",fontWeight:600,borderRadius:"8px",border:"none",cursor:"pointer"},children:"Retry"}),S[M.id]==="installing"&&g.jsx("span",{style:{fontSize:"13px",color:"#f59e0b",fontWeight:500},children:"Installing..."})]})}),D&&A&&g.jsxs("div",{style:{padding:"16px 20px",background:"rgba(94, 23, 235, 0.03)",border:"1px solid var(--border)",borderTop:"none",borderRadius:"0 0 12px 12px"},children:[g.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"8px"},children:A.steps.map((L,H)=>g.jsxs("div",{style:{display:"flex",gap:"10px",alignItems:"flex-start"},children:[g.jsx("span",{style:{width:"20px",height:"20px",borderRadius:"50%",background:"#5e17eb",color:"#fff",fontSize:"11px",fontWeight:700,display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0},children:H+1}),g.jsx("span",{style:{fontSize:"13px",color:"var(--text-primary)",lineHeight:1.5},children:L})]},H))}),A.link&&g.jsxs("a",{href:A.link,target:"_blank",rel:"noopener noreferrer",style:{display:"inline-block",marginTop:"12px",padding:"8px 16px",background:"#5e17eb",color:"#fff",fontSize:"13px",fontWeight:600,borderRadius:"8px",textDecoration:"none"},children:[A.linkLabel||"Open"," →"]})]}),S[M.id]==="error"&&o[M.id]&&g.jsx("div",{style:{marginTop:"4px",padding:"8px 12px",background:"rgba(239, 68, 68, 0.08)",borderRadius:"8px",fontSize:"12px",color:"#ef4444",lineHeight:1.4,fontFamily:"monospace",whiteSpace:"pre-wrap",wordBreak:"break-word"},children:o[M.id]})]},M.id)})}),b&&g.jsx("button",{onClick:i,style:{width:"100%",padding:"16px",background:"linear-gradient(135deg, #5e17eb, #8b5cf6)",color:"#fff",borderRadius:"12px",fontSize:"16px",fontWeight:700,border:"none",cursor:"pointer",boxShadow:"0 4px 12px rgba(94,23,235,0.3)"},children:"Continue →"})]})}function AS({onProjectSelected:e,mode:i="developer"}){const n=i==="document",[l,o]=z.useState(n?"open":"choose"),[h,d]=z.useState(""),[_,p]=z.useState(!1),[f,S]=z.useState(""),[y,x]=z.useState(""),[C,b]=z.useState(null),[T,M]=z.useState(!1),A=km();async function O(){if(!f.trim())return;M(!0),b(null);const H=await _i("/api/scaffold",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({projectName:f.trim()})});H?.projectDir?e(H.projectDir):b("Failed to create project"),M(!1)}async function D(){if(!y.trim())return;M(!0),b(null);const H=await _i("/api/scaffold",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({projectName:y.trim().split("/").pop()?.replace(/\.git$/,"")||"cloned-repo"})});H?.projectDir?e(H.projectDir):b("Failed to clone repository"),M(!1)}const L={padding:"36px",background:"var(--bg-secondary)",borderRadius:"24px",textAlign:"center",border:"1px solid var(--border)",boxShadow:"0 8px 24px rgba(0,0,0,0.08)",cursor:"pointer",transition:"all 0.3s ease"};return l==="choose"?g.jsxs("div",{className:"animate-in",children:[g.jsx("h2",{style:{fontSize:"28px",fontWeight:700,color:"var(--text-primary)",marginBottom:"8px",textAlign:"center"},children:"Choose a folder"}),g.jsx("p",{style:{color:"var(--text-secondary)",fontSize:"17px",marginBottom:"48px",textAlign:"center"},children:"Where would you like to work?"}),A.length>0&&g.jsxs("div",{style:{marginBottom:"48px"},children:[g.jsx("p",{style:{fontSize:"13px",color:"var(--text-secondary)",fontWeight:600,textTransform:"uppercase",letterSpacing:"0.08em",marginBottom:"16px"},children:"Recent"}),g.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"12px"},children:A.map(H=>g.jsx("button",{onClick:()=>e(H),className:"transition-all duration-300 hover:-translate-y-0.5 active:scale-[0.98]",style:{width:"100%",textAlign:"left",padding:"20px 24px",background:"var(--bg-secondary)",borderRadius:"16px",color:"var(--text-primary)",fontSize:"15px",fontFamily:"'SF Mono', Menlo, monospace",border:"1px solid var(--border)",boxShadow:"0 4px 12px rgba(0,0,0,0.06)",cursor:"pointer",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:H},H))})]}),g.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr 1fr",gap:"20px"},children:[g.jsxs("button",{onClick:async()=>{p(!0);const H=await _i("/api/pick-folder");p(!1),H?.path&&e(H.path)},disabled:_,className:"transition-all duration-300 hover:-translate-y-1 active:scale-[0.97]",style:L,children:[g.jsx("div",{style:{fontSize:"44px",marginBottom:"16px"},children:_?"⏳":"📂"}),g.jsx("div",{style:{color:"var(--text-primary)",fontSize:"16px",fontWeight:700,marginBottom:"6px"},children:_?"Choosing...":"Open existing"}),g.jsx("div",{style:{color:"var(--text-secondary)",fontSize:"14px"},children:"Browse in Finder"})]}),[{m:"create",icon:"✨",label:"Create new",desc:"Start from scratch"},{m:"clone",icon:"📦",label:"Clone repo",desc:"From GitHub"}].map(({m:H,icon:X,label:V,desc:ue})=>g.jsxs("button",{onClick:()=>o(H),className:"transition-all duration-300 hover:-translate-y-1 active:scale-[0.97]",style:L,children:[g.jsx("div",{style:{fontSize:"44px",marginBottom:"16px"},children:X}),g.jsx("div",{style:{color:"var(--text-primary)",fontSize:"16px",fontWeight:700,marginBottom:"6px"},children:V}),g.jsx("div",{style:{color:"var(--text-secondary)",fontSize:"14px"},children:ue})]},H))]}),g.jsx("div",{style:{marginTop:"28px",textAlign:"center"},children:g.jsx("button",{onClick:()=>o("open"),className:"transition-colors",style:{color:"var(--text-secondary)",fontSize:"14px",background:"none",border:"none",cursor:"pointer"},children:"Or enter a path manually →"})})]}):g.jsxs("div",{className:"animate-in",children:[!n&&g.jsx("button",{onClick:()=>o("choose"),className:"text-[var(--text-secondary)] text-base hover:text-[var(--text-primary)] transition-colors mb-8 block",children:"← Back"}),l==="open"&&g.jsxs("div",{children:[g.jsx("h2",{style:{fontSize:"28px",fontWeight:700,color:"var(--text-primary)",marginBottom:"8px"},children:n?"What folder can Claude find your work?":"Open existing project"}),g.jsx("p",{style:{color:"var(--text-secondary)",fontSize:"17px",marginBottom:"40px"},children:n?"Browse to the folder with your documents.":"Enter the path to your project."}),n?g.jsx("button",{onClick:async()=>{p(!0);const H=await _i("/api/pick-folder");p(!1),H?.path&&e(H.path)},disabled:_,className:"w-full hover:-translate-y-0.5 transition-all active:scale-[0.98]",style:{padding:"20px",background:"linear-gradient(135deg, #5e17eb, #8b5cf6)",color:"white",borderRadius:"16px",fontSize:"18px",fontWeight:700,border:"none",cursor:"pointer",boxShadow:"0 4px 12px rgba(94,23,235,0.3)",marginBottom:"40px"},children:_?"⏳ Choosing...":"📂 Browse for folder"}):g.jsxs(g.Fragment,{children:[g.jsx("input",{type:"text",value:h,onChange:H=>d(H.target.value),placeholder:"/path/to/your/project",autoFocus:!0,className:"w-full focus:outline-none transition-all",style:{padding:"20px 24px",background:"var(--bg-secondary)",border:"1px solid var(--border)",borderRadius:"16px",color:"var(--text-primary)",fontFamily:"'SF Mono', Menlo, monospace",fontSize:"15px",boxShadow:"0 4px 12px rgba(0,0,0,0.06)",marginBottom:"16px"}}),g.jsx("button",{onClick:()=>h.trim()&&e(h.trim()),disabled:!h.trim(),className:"w-full hover:-translate-y-0.5 disabled:opacity-30 transition-all active:scale-[0.98]",style:{padding:"20px",background:"linear-gradient(135deg, #5e17eb, #8b5cf6)",color:"white",borderRadius:"16px",fontSize:"18px",fontWeight:700,border:"none",cursor:"pointer",boxShadow:"0 4px 12px rgba(94,23,235,0.3)",marginBottom:"40px"},children:"Open project"})]}),n&&A.length>0&&g.jsxs("div",{style:{marginTop:n?"0":"40px"},children:[g.jsx("p",{style:{fontSize:"13px",color:"var(--text-secondary)",fontWeight:600,textTransform:"uppercase",letterSpacing:"0.08em",marginBottom:"16px"},children:"Recent"}),g.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"12px"},children:A.map(H=>g.jsx("button",{onClick:()=>e(H),className:"transition-all duration-200 hover:-translate-y-0.5 active:scale-[0.98]",style:{width:"100%",textAlign:"left",padding:"20px 24px",background:"var(--bg-secondary)",borderRadius:"16px",color:"var(--text-primary)",fontSize:"15px",fontFamily:"'SF Mono', Menlo, monospace",border:"1px solid var(--border)",cursor:"pointer",boxShadow:"0 4px 12px rgba(0,0,0,0.06)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:H},H))})]})]}),l==="create"&&g.jsxs("div",{className:"space-y-6",children:[g.jsx("h2",{className:"text-2xl font-bold text-[var(--text-primary)]",children:"Create new project"}),g.jsx("input",{type:"text",value:f,onChange:H=>S(H.target.value),placeholder:"my-app",autoFocus:!0,className:"w-full px-6 py-5 bg-[var(--bg-secondary)] border border-[var(--border)] rounded-xl text-[var(--text-primary)] font-mono text-base placeholder:text-[#86868b] focus:outline-none focus:border-[#5e17eb]/50 focus:ring-2 focus:ring-[#5e17eb]/10 transition-all",style:{boxShadow:"0 4px 12px rgba(0,0,0,0.06)"}}),g.jsx("button",{onClick:O,disabled:!f.trim()||T,className:"w-full py-5 bg-gradient-to-r from-[#5e17eb] to-[#8b5cf6] text-white rounded-xl text-lg font-bold hover:-translate-y-0.5 disabled:opacity-30 transition-all active:scale-[0.98]",style:{boxShadow:"0 4px 12px rgba(94,23,235,0.3)"},children:T?"Creating...":"Create project"})]}),l==="clone"&&g.jsxs("div",{className:"space-y-6",children:[g.jsx("h2",{className:"text-2xl font-bold text-[var(--text-primary)]",children:"Clone from GitHub"}),g.jsx("input",{type:"text",value:y,onChange:H=>x(H.target.value),placeholder:"https://github.com/user/repo",autoFocus:!0,className:"w-full px-6 py-5 bg-[var(--bg-secondary)] border border-[var(--border)] rounded-xl text-[var(--text-primary)] font-mono text-base placeholder:text-[#86868b] focus:outline-none focus:border-[#5e17eb]/50 focus:ring-2 focus:ring-[#5e17eb]/10 transition-all",style:{boxShadow:"0 4px 12px rgba(0,0,0,0.06)"}}),g.jsx("button",{onClick:D,disabled:!y.trim()||T,className:"w-full py-5 bg-gradient-to-r from-[#5e17eb] to-[#8b5cf6] text-white rounded-xl text-lg font-bold hover:-translate-y-0.5 disabled:opacity-30 transition-all active:scale-[0.98]",style:{boxShadow:"0 4px 12px rgba(94,23,235,0.3)"},children:T?"Cloning...":"Clone repository"})]}),C&&g.jsx("p",{className:"text-[#ff453a] text-base bg-[#ff453a]/10 px-6 py-4 rounded-xl mt-6",children:C})]})}const Wh=[{type:"image-text",title:"Most people:",content:"See a terminal and think...",imageUrl:"https://media.giphy.com/media/v1.Y2lkPTc5MGI3NjExMG0wamx1NWUwOGcxN2F6ejBva3p3OW5peG5qdWlrcjI1d3JyM2l0dyZlcD12MV9naWZzX3NlYXJjaCZjdD1n/NRXleEopnqL3a/giphy.gif"},{type:"text",title:"What even is the terminal?",content:"Terminal = using our computer without the mouse"},{type:"text",title:"The magic of Claude Code",content:`Once we set it up, we're no longer actually talking directly to our computer.
|
|
35
|
+
`)}function TS(e){const i=z.useRef(e);i.current=e;const n=z.useRef(null),l=z.useRef(null),o=z.useCallback(()=>{n.current?.close(),n.current=null,l.current&&(clearTimeout(l.current),l.current=null)},[]),h=z.useCallback((d,_)=>{o();const p=`/api/doc-events?folderPath=${encodeURIComponent(d)}`,f=new EventSource(p);n.current=f,f.addEventListener("output-created",S=>{i.current(JSON.parse(S.data)),o()}),l.current=setTimeout(()=>{o(),_()},600*1e3)},[o]);return z.useEffect(()=>o,[o]),{listen:h,close:o}}const Dm=z.createContext(null);function RS({children:e}){const[i,n]=z.useState(null),[l,o]=z.useState(null),[h,d]=z.useState(!1),[_,p]=z.useState(null),[f,S]=z.useState(""),[y,x]=z.useState(""),[C,b]=z.useState({status:"empty"}),[T,M]=z.useState(null),[A,O]=z.useState(!1),{sendPrompt:D}=en(),{path:L,mode:H}=Et(),X=z.useCallback(async de=>{let Z=await _i(`/api/read-output?path=${encodeURIComponent(de)}`);Z||(Z=await _i(`/api/read-file?path=${encodeURIComponent(de)}`)),Z?(b({status:"complete",...Z}),O(!1)):(b({status:"error",message:"Failed to load file"}),O(!1))},[]),V=TS(de=>X(de.path)),ue=z.useCallback(async de=>{n(de),d(!0);const Z=await _i(`/api/folder-scan?folderPath=${encodeURIComponent(de)}`);o(Z||null),d(!1)},[]);z.useEffect(()=>{H==="document"&&L&&!i&&ue(L)},[H,L,i,ue]);const ge=z.useCallback(()=>{n(null),o(null),b({status:"empty"}),O(!1),V.close()},[V]),Ke=z.useCallback(async()=>{if(A||!i||!_&&!f.trim())return;if(O(!0),!(await fetch(`/api/ensure-output-dir?folderPath=${encodeURIComponent(i)}`,{method:"POST"})).ok){b({status:"error",message:"Failed to create output directory"}),O(!1);return}const Z=l?.summary.total||0,G=ES({folderPath:i,templateKey:_||void 0,freeformText:f.trim()||void 0,context:y.trim()||void 0,styleReference:T||void 0,fileCount:Z}),ie=_?oo.find(ee=>ee.key===_)?.name||_:"Custom";b({status:"processing",outcome:ie,fileCount:Z}),V.listen(i,()=>{b({status:"error",message:"Timed out waiting for output. Check the terminal for details, or try again with fewer files."}),O(!1)}),D(G)},[A,i,_,f,y,T,l,D,V]);return g.jsx(Dm.Provider,{value:{folderPath:i,folderScan:l,scanLoading:h,scanFolder:ue,clearFolder:ge,selectedOutcome:_,setSelectedOutcome:p,freeformText:f,setFreeformText:S,contextText:y,setContextText:x,styleExampleContent:T,setStyleExampleContent:M,output:C,run:Ke,loadOutput:X,canRun:!!i&&(!!_||!!f.trim())&&!A,isRunning:A},children:e})}function ji(){const e=z.useContext(Dm);if(!e)throw new Error("useDocModeContext must be used within DocModeProvider");return e}function DS(){const{path:e,setGitInfo:i}=Et();z.useEffect(()=>{e&&_i(Rm("/api/project-info",e)).then(n=>{n&&i(n.gitBranch,n.gitRemote)})},[e,i])}function BS({onAllReady:e,onNeedInstall:i}){const[n,l]=z.useState([]),[o,h]=z.useState(!0);z.useEffect(()=>{d()},[]);async function d(){h(!0);const _=await _i("/api/detect");_&&(l(_.tools),_.tools.filter(f=>f.required&&!f.installed).length===0?setTimeout(e,600):i(_.tools)),h(!1)}return g.jsxs("div",{className:"text-center",children:[g.jsx("h2",{className:"text-2xl font-bold text-[var(--text-primary)] mb-3",children:"Getting things ready..."}),g.jsx("p",{className:"text-[var(--text-secondary)] text-base mb-10",children:"Checking what's installed on your machine"}),o?g.jsxs("div",{className:"flex items-center justify-center gap-4 text-[var(--text-secondary)] text-base",children:[g.jsx("div",{className:"w-6 h-6 border-2 border-[#5e17eb]/30 border-t-[#5e17eb] rounded-full animate-spin"}),g.jsx("span",{children:"Scanning..."})]}):g.jsx("div",{className:"space-y-3 text-left",children:n.map(_=>g.jsxs("div",{className:"flex items-center gap-5 px-6 py-5 bg-[var(--bg-secondary)] rounded-2xl border border-[var(--border)]",style:{boxShadow:"0 4px 12px rgba(0,0,0,0.06)"},children:[g.jsx("div",{className:`w-8 h-8 rounded-full flex items-center justify-center text-base font-bold ${_.installed?"bg-[#30d158]/15 text-[#30d158]":"bg-[#ff453a]/15 text-[#ff453a]"}`,children:_.installed?"✓":"✗"}),g.jsx("span",{className:"text-[var(--text-primary)] text-lg font-semibold",children:_.name}),_.version&&g.jsx("span",{className:"text-[var(--text-secondary)] text-sm font-mono ml-auto",children:_.version})]},_.name))})]})}const MS={node:{steps:["Download from nodejs.org (LTS recommended)","Run the installer and follow the prompts","Restart your terminal after installing"],link:"https://nodejs.org",linkLabel:"Download Node.js"},npm:{steps:["npm comes bundled with Node.js","Install Node.js first and npm will be included"]},git:{steps:["Click Install below","Look for a pop-up on your screen and click 'Install'","Wait for it to finish (this can take a few minutes)","Once done, click Retry below to verify"]},claude:{steps:["Click Install below to download Claude Code","Once installed, you'll sign in when the terminal opens"]}};function zS({tools:e,onDone:i}){const[n,l]=z.useState(null),[o,h]=z.useState({}),[d,_]=z.useState(null),[p,f]=z.useState(null),[S,y]=z.useState(()=>{const M={};for(const A of e)M[A.id]=A.installed?"done":"pending";return M}),x=e.filter(M=>!M.installed&&M.required);async function C(M){l(M),y(A=>({...A,[M]:"installing"})),h(A=>{const O={...A};return delete O[M],O});try{const A=await fetch(`/api/install/${encodeURIComponent(M)}`,{method:"POST"});if(!A.ok){const H=await A.text().catch(()=>"Server error");h(X=>({...X,[M]:`Install failed (${A.status}): ${H}`})),y(X=>({...X,[M]:"error"})),l(null);return}const O=A.body?.getReader(),D=new TextDecoder;let L=!1;if(O){let H="";for(;;){const{done:X,value:V}=await O.read();if(X)break;H+=D.decode(V,{stream:!0});const ue=H.split(`
|
|
36
|
+
`);H=ue.pop()??"";for(const ge of ue)if(ge.startsWith("data: "))try{const Ke=JSON.parse(ge.slice(6));Ke.tool===M&&Ke.status==="done"&&(L=!0),Ke.tool===M&&Ke.status==="error"&&(L=!1,Ke.error&&h(de=>({...de,[M]:Ke.error})))}catch{}}}y(H=>({...H,[M]:L?"done":"error"}))}catch{y(A=>({...A,[M]:"error"}))}l(null)}const b=x.every(M=>S[M.id]==="done"),T=M=>{switch(M){case"done":return{symbol:"✓",color:"#22c55e"};case"error":return{symbol:"✗",color:"#ef4444"};case"installing":return{symbol:"⏳",color:"#f59e0b"};default:return{symbol:"○",color:"#9ca3af"}}};return g.jsxs("div",{className:"space-y-4",children:[g.jsx("h2",{style:{fontSize:"20px",fontWeight:600,color:"var(--text-primary)"},children:"Install missing tools"}),g.jsx("p",{style:{fontSize:"14px",color:"var(--text-secondary)",marginTop:"-8px"},children:"We'll help you get everything set up step by step."}),g.jsx("div",{className:"space-y-2",children:x.map(M=>{const A=MS[M.id],O=T(S[M.id]),D=d===M.id;return g.jsxs("div",{children:[g.jsx("div",{style:{padding:"16px 20px",background:"var(--bg-secondary)",border:"1px solid var(--border)",borderRadius:D?"12px 12px 0 0":"12px",boxShadow:"0 2px 8px rgba(0,0,0,0.04)"},children:g.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"12px"},children:[g.jsx("span",{style:{color:O.color,fontSize:"16px"},children:O.symbol}),g.jsx("div",{style:{flex:1},children:g.jsx("span",{style:{color:"var(--text-primary)",fontSize:"15px",fontWeight:500},children:M.name})}),S[M.id]==="pending"&&g.jsxs("div",{style:{display:"flex",gap:"6px"},children:[A&&g.jsx("button",{onClick:()=>_(D?null:M.id),style:{padding:"8px 12px",background:"transparent",color:"#6b7280",fontSize:"12px",fontWeight:500,borderRadius:"8px",border:"1px solid #e5e7eb",cursor:"pointer"},children:"Guide"}),g.jsx("button",{onClick:()=>C(M.id),disabled:n!==null,style:{padding:"8px 16px",background:"#22c55e",color:"#fff",fontSize:"13px",fontWeight:600,borderRadius:"8px",border:"none",cursor:"pointer",opacity:n?.5:1},children:"Install"})]}),S[M.id]==="error"&&g.jsx("button",{onClick:()=>C(M.id),disabled:n!==null,style:{padding:"8px 16px",background:"#ef4444",color:"#fff",fontSize:"13px",fontWeight:600,borderRadius:"8px",border:"none",cursor:"pointer"},children:"Retry"}),S[M.id]==="installing"&&g.jsx("span",{style:{fontSize:"13px",color:"#f59e0b",fontWeight:500},children:"Installing..."})]})}),D&&A&&g.jsxs("div",{style:{padding:"16px 20px",background:"rgba(94, 23, 235, 0.03)",border:"1px solid var(--border)",borderTop:"none",borderRadius:"0 0 12px 12px"},children:[g.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"8px"},children:A.steps.map((L,H)=>g.jsxs("div",{style:{display:"flex",gap:"10px",alignItems:"flex-start"},children:[g.jsx("span",{style:{width:"20px",height:"20px",borderRadius:"50%",background:"#5e17eb",color:"#fff",fontSize:"11px",fontWeight:700,display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0},children:H+1}),g.jsx("span",{style:{fontSize:"13px",color:"var(--text-primary)",lineHeight:1.5},children:L})]},H))}),A.link&&g.jsxs("a",{href:A.link,target:"_blank",rel:"noopener noreferrer",style:{display:"inline-block",marginTop:"12px",padding:"8px 16px",background:"#5e17eb",color:"#fff",fontSize:"13px",fontWeight:600,borderRadius:"8px",textDecoration:"none"},children:[A.linkLabel||"Open"," →"]})]}),S[M.id]==="error"&&o[M.id]&&g.jsx("div",{style:{marginTop:"4px",padding:"8px 12px",background:"rgba(239, 68, 68, 0.08)",borderRadius:"8px",fontSize:"12px",color:"#ef4444",lineHeight:1.4,fontFamily:"monospace",whiteSpace:"pre-wrap",wordBreak:"break-word"},children:o[M.id]})]},M.id)})}),b&&g.jsx("button",{onClick:i,style:{width:"100%",padding:"16px",background:"linear-gradient(135deg, #5e17eb, #8b5cf6)",color:"#fff",borderRadius:"12px",fontSize:"16px",fontWeight:700,border:"none",cursor:"pointer",boxShadow:"0 4px 12px rgba(94,23,235,0.3)"},children:"Continue →"})]})}function AS({onProjectSelected:e,mode:i="developer"}){const n=i==="document",[l,o]=z.useState(n?"open":"choose"),[h,d]=z.useState(""),[_,p]=z.useState(!1),[f,S]=z.useState(""),[y,x]=z.useState(""),[C,b]=z.useState(null),[T,M]=z.useState(!1),A=km();async function O(){if(!f.trim())return;M(!0),b(null);const H=await _i("/api/scaffold",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({projectName:f.trim()})});H?.projectDir?e(H.projectDir):b("Failed to create project"),M(!1)}async function D(){if(!y.trim())return;M(!0),b(null);const H=await _i("/api/scaffold",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({projectName:y.trim().split("/").pop()?.replace(/\.git$/,"")||"cloned-repo"})});H?.projectDir?e(H.projectDir):b("Failed to clone repository"),M(!1)}const L={padding:"36px",background:"var(--bg-secondary)",borderRadius:"24px",textAlign:"center",border:"1px solid var(--border)",boxShadow:"0 8px 24px rgba(0,0,0,0.08)",cursor:"pointer",transition:"all 0.3s ease"};return l==="choose"?g.jsxs("div",{className:"animate-in",children:[g.jsx("h2",{style:{fontSize:"28px",fontWeight:700,color:"var(--text-primary)",marginBottom:"8px",textAlign:"center"},children:"Choose a folder"}),g.jsx("p",{style:{color:"var(--text-secondary)",fontSize:"17px",marginBottom:"48px",textAlign:"center"},children:"Where would you like to work?"}),A.length>0&&g.jsxs("div",{style:{marginBottom:"48px"},children:[g.jsx("p",{style:{fontSize:"13px",color:"var(--text-secondary)",fontWeight:600,textTransform:"uppercase",letterSpacing:"0.08em",marginBottom:"16px"},children:"Recent"}),g.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"12px"},children:A.map(H=>g.jsx("button",{onClick:()=>e(H),className:"transition-all duration-300 hover:-translate-y-0.5 active:scale-[0.98]",style:{width:"100%",textAlign:"left",padding:"20px 24px",background:"var(--bg-secondary)",borderRadius:"16px",color:"var(--text-primary)",fontSize:"15px",fontFamily:"'SF Mono', Menlo, monospace",border:"1px solid var(--border)",boxShadow:"0 4px 12px rgba(0,0,0,0.06)",cursor:"pointer",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:H},H))})]}),g.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr 1fr",gap:"20px"},children:[g.jsxs("button",{onClick:async()=>{p(!0);const H=await _i("/api/pick-folder");p(!1),H?.path&&e(H.path)},disabled:_,className:"transition-all duration-300 hover:-translate-y-1 active:scale-[0.97]",style:L,children:[g.jsx("div",{style:{fontSize:"44px",marginBottom:"16px"},children:_?"⏳":"📂"}),g.jsx("div",{style:{color:"var(--text-primary)",fontSize:"16px",fontWeight:700,marginBottom:"6px"},children:_?"Choosing...":"Open existing"}),g.jsx("div",{style:{color:"var(--text-secondary)",fontSize:"14px"},children:"Browse in Finder"})]}),[{m:"create",icon:"✨",label:"Create new",desc:"Start from scratch"},{m:"clone",icon:"📦",label:"Clone repo",desc:"From GitHub"}].map(({m:H,icon:X,label:V,desc:ue})=>g.jsxs("button",{onClick:()=>o(H),className:"transition-all duration-300 hover:-translate-y-1 active:scale-[0.97]",style:L,children:[g.jsx("div",{style:{fontSize:"44px",marginBottom:"16px"},children:X}),g.jsx("div",{style:{color:"var(--text-primary)",fontSize:"16px",fontWeight:700,marginBottom:"6px"},children:V}),g.jsx("div",{style:{color:"var(--text-secondary)",fontSize:"14px"},children:ue})]},H))]}),g.jsx("div",{style:{marginTop:"28px",textAlign:"center"},children:g.jsx("button",{onClick:()=>o("open"),className:"transition-colors",style:{color:"var(--text-secondary)",fontSize:"14px",background:"none",border:"none",cursor:"pointer"},children:"Or enter a path manually →"})})]}):g.jsxs("div",{className:"animate-in",children:[!n&&g.jsx("button",{onClick:()=>o("choose"),className:"text-[var(--text-secondary)] text-base hover:text-[var(--text-primary)] transition-colors mb-8 block",children:"← Back"}),l==="open"&&g.jsxs("div",{children:[g.jsx("h2",{style:{fontSize:"28px",fontWeight:700,color:"var(--text-primary)",marginBottom:"8px"},children:n?"What folder can Claude find your work?":"Open existing project"}),g.jsx("p",{style:{color:"var(--text-secondary)",fontSize:"17px",marginBottom:"40px"},children:n?"Browse to the folder with your documents.":"Enter the path to your project."}),n?g.jsx("button",{onClick:async()=>{p(!0);const H=await _i("/api/pick-folder");p(!1),H?.path&&e(H.path)},disabled:_,className:"w-full hover:-translate-y-0.5 transition-all active:scale-[0.98]",style:{padding:"20px",background:"linear-gradient(135deg, #5e17eb, #8b5cf6)",color:"white",borderRadius:"16px",fontSize:"18px",fontWeight:700,border:"none",cursor:"pointer",boxShadow:"0 4px 12px rgba(94,23,235,0.3)",marginBottom:"40px"},children:_?"⏳ Choosing...":"📂 Browse for folder"}):g.jsxs(g.Fragment,{children:[g.jsx("input",{type:"text",value:h,onChange:H=>d(H.target.value),placeholder:"/path/to/your/project",autoFocus:!0,className:"w-full focus:outline-none transition-all",style:{padding:"20px 24px",background:"var(--bg-secondary)",border:"1px solid var(--border)",borderRadius:"16px",color:"var(--text-primary)",fontFamily:"'SF Mono', Menlo, monospace",fontSize:"15px",boxShadow:"0 4px 12px rgba(0,0,0,0.06)",marginBottom:"16px"}}),g.jsx("button",{onClick:()=>h.trim()&&e(h.trim()),disabled:!h.trim(),className:"w-full hover:-translate-y-0.5 disabled:opacity-30 transition-all active:scale-[0.98]",style:{padding:"20px",background:"linear-gradient(135deg, #5e17eb, #8b5cf6)",color:"white",borderRadius:"16px",fontSize:"18px",fontWeight:700,border:"none",cursor:"pointer",boxShadow:"0 4px 12px rgba(94,23,235,0.3)",marginBottom:"40px"},children:"Open project"})]}),n&&A.length>0&&g.jsxs("div",{style:{marginTop:n?"0":"40px"},children:[g.jsx("p",{style:{fontSize:"13px",color:"var(--text-secondary)",fontWeight:600,textTransform:"uppercase",letterSpacing:"0.08em",marginBottom:"16px"},children:"Recent"}),g.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"12px"},children:A.map(H=>g.jsx("button",{onClick:()=>e(H),className:"transition-all duration-200 hover:-translate-y-0.5 active:scale-[0.98]",style:{width:"100%",textAlign:"left",padding:"20px 24px",background:"var(--bg-secondary)",borderRadius:"16px",color:"var(--text-primary)",fontSize:"15px",fontFamily:"'SF Mono', Menlo, monospace",border:"1px solid var(--border)",cursor:"pointer",boxShadow:"0 4px 12px rgba(0,0,0,0.06)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:H},H))})]})]}),l==="create"&&g.jsxs("div",{className:"space-y-6",children:[g.jsx("h2",{className:"text-2xl font-bold text-[var(--text-primary)]",children:"Create new project"}),g.jsx("input",{type:"text",value:f,onChange:H=>S(H.target.value),placeholder:"my-app",autoFocus:!0,className:"w-full px-6 py-5 bg-[var(--bg-secondary)] border border-[var(--border)] rounded-xl text-[var(--text-primary)] font-mono text-base placeholder:text-[#86868b] focus:outline-none focus:border-[#5e17eb]/50 focus:ring-2 focus:ring-[#5e17eb]/10 transition-all",style:{boxShadow:"0 4px 12px rgba(0,0,0,0.06)"}}),g.jsx("button",{onClick:O,disabled:!f.trim()||T,className:"w-full py-5 bg-gradient-to-r from-[#5e17eb] to-[#8b5cf6] text-white rounded-xl text-lg font-bold hover:-translate-y-0.5 disabled:opacity-30 transition-all active:scale-[0.98]",style:{boxShadow:"0 4px 12px rgba(94,23,235,0.3)"},children:T?"Creating...":"Create project"})]}),l==="clone"&&g.jsxs("div",{className:"space-y-6",children:[g.jsx("h2",{className:"text-2xl font-bold text-[var(--text-primary)]",children:"Clone from GitHub"}),g.jsx("input",{type:"text",value:y,onChange:H=>x(H.target.value),placeholder:"https://github.com/user/repo",autoFocus:!0,className:"w-full px-6 py-5 bg-[var(--bg-secondary)] border border-[var(--border)] rounded-xl text-[var(--text-primary)] font-mono text-base placeholder:text-[#86868b] focus:outline-none focus:border-[#5e17eb]/50 focus:ring-2 focus:ring-[#5e17eb]/10 transition-all",style:{boxShadow:"0 4px 12px rgba(0,0,0,0.06)"}}),g.jsx("button",{onClick:D,disabled:!y.trim()||T,className:"w-full py-5 bg-gradient-to-r from-[#5e17eb] to-[#8b5cf6] text-white rounded-xl text-lg font-bold hover:-translate-y-0.5 disabled:opacity-30 transition-all active:scale-[0.98]",style:{boxShadow:"0 4px 12px rgba(94,23,235,0.3)"},children:T?"Cloning...":"Clone repository"})]}),C&&g.jsx("p",{className:"text-[#ff453a] text-base bg-[#ff453a]/10 px-6 py-4 rounded-xl mt-6",children:C})]})}const Wh=[{type:"image-text",title:"Most people:",content:"See a terminal and think...",imageUrl:"https://media.giphy.com/media/v1.Y2lkPTc5MGI3NjExMG0wamx1NWUwOGcxN2F6ejBva3p3OW5peG5qdWlrcjI1d3JyM2l0dyZlcD12MV9naWZzX3NlYXJjaCZjdD1n/NRXleEopnqL3a/giphy.gif"},{type:"text",title:"What even is the terminal?",content:"Terminal = using our computer without the mouse"},{type:"text",title:"The magic of Claude Code",content:`Once we set it up, we're no longer actually talking directly to our computer.
|
|
37
37
|
|
|
38
38
|
We're talking to Claude.
|
|
39
39
|
|
|
@@ -76,31 +76,31 @@ Please organise what you know into these 4 categories:
|
|
|
76
76
|
- What they do well
|
|
77
77
|
- Where they fall short
|
|
78
78
|
|
|
79
|
-
Only include things you're confident about from our conversations. Skip any category where you don't have information. Be specific — use real names, numbers, and examples from our chats.`;function jS({onComplete:e,onSkip:i}){const[n,l]=z.useState(!1),[o,h]=z.useState(""),[d,_]=z.useState(!1),[p,f]=z.useState(null),[S,y]=z.useState(!1);function x(){navigator.clipboard.writeText(LS),l(!0),setTimeout(()=>l(!1),2e3)}async function C(){if(o.trim().length<50){f("This doesn't look like a full response. Try pasting the complete reply.");return}_(!0),f(null);try{const b=await fetch("/api/brain/import",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({text:o})}),T=await b.json();if(!b.ok){f(T.error),_(!1);return}y(!0),setTimeout(()=>e(o),1500)}catch{f("Import failed. Try again.")}_(!1)}return S?g.jsxs("div",{style:{textAlign:"center",padding:"40px 0"},children:[g.jsx("div",{style:{fontSize:"48px",marginBottom:"16px"},children:"✓"}),g.jsx("p",{style:{fontSize:"16px",fontWeight:600,color:"#16a34a"},children:"Imported successfully"})]}):g.jsxs("div",{children:[g.jsx("h3",{style:{fontSize:"18px",fontWeight:700,color:"var(--text-primary)",marginBottom:"4px"},children:"Import from ChatGPT"}),g.jsx("p",{style:{fontSize:"13px",color:"var(--text-secondary)",marginBottom:"20px"},children:"Copy this prompt, paste it into ChatGPT or Claude, then paste the response below."}),g.jsxs("div",{style:{padding:"12px 16px",borderRadius:"10px",background:"rgba(94,23,235,0.04)",border:"1px solid rgba(94,23,235,0.1)",marginBottom:"20px",display:"flex",alignItems:"center",justifyContent:"space-between"},children:[g.jsx("span",{style:{fontSize:"13px",color:"var(--text-primary)",fontWeight:500},children:"Step 1: Copy this prompt →"}),g.jsx("button",{onClick:x,style:{padding:"6px 14px",borderRadius:"8px",background:n?"#16a34a":"#5e17eb",color:"#fff",fontSize:"12px",fontWeight:600,border:"none",cursor:"pointer"},children:n?"Copied!":"Copy Prompt"})]}),g.jsx("div",{style:{marginBottom:"8px",fontSize:"13px",color:"var(--text-primary)",fontWeight:500},children:"Step 2: Paste the response here"}),g.jsx("textarea",{value:o,onChange:b=>{h(b.target.value),f(null)},rows:8,placeholder:"Paste ChatGPT's response here...",style:{width:"100%",padding:"12px 16px",borderRadius:"10px",border:"1px solid #e5e7eb",fontSize:"13px",resize:"vertical",outline:"none",fontFamily:"inherit",color:"var(--text-primary)",background:"var(--bg-secondary)"}}),p&&g.jsx("p",{style:{fontSize:"13px",color:"#ef4444",marginTop:"8px"},children:p}),g.jsx("button",{onClick:C,disabled:d||o.length<50,style:{marginTop:"16px",padding:"12px 24px",background:"#5e17eb",color:"#fff",borderRadius:"10px",border:"none",fontSize:"14px",fontWeight:600,cursor:d||o.length<50?"not-allowed":"pointer",opacity:d||o.length<50?.5:1},children:d?"Importing...":"Import →"}),g.jsx("button",{onClick:i,style:{display:"block",marginTop:"16px",background:"none",border:"none",color:"#9ca3af",fontSize:"13px",cursor:"pointer"},children:"Skip this step →"})]})}const NS=[".pdf",".docx",".txt",".md",".csv"],HS=10*1024*1024,US=50*1024*1024;function WS({onComplete:e,onSkip:i}){const[n,l]=z.useState([]),[o,h]=z.useState(!1),[d,_]=z.useState(!1),p=z.useRef(null),f=z.useRef(new Map);function S(A){const O=[];let L=n.reduce((H,X)=>H+X.size,0);for(const H of Array.from(A)){const X="."+H.name.split(".").pop()?.toLowerCase();if(!NS.includes(X)){O.push({name:H.name,size:H.size,status:"error",error:`Unsupported file type: ${X}`});continue}if(H.size>HS){O.push({name:H.name,size:H.size,status:"error",error:"File too large (max 10MB)"});continue}if(L+=H.size,L>US){O.push({name:H.name,size:H.size,status:"error",error:"Total upload limit exceeded (50MB)"});continue}f.current.set(H.name,H),O.push({name:H.name,size:H.size,status:"pending"})}l(H=>[...H,...O])}function y(A){A.preventDefault(),_(!1),A.dataTransfer.files.length>0&&S(A.dataTransfer.files)}function x(A){A.target.files&&S(A.target.files)}function C(A){l(O=>O.filter(D=>D.name!==A)),f.current.delete(A)}async function b(){h(!0);let A=!1;for(let O=0;O<n.length;O++){const D=n[O];if(D.status==="pending"){l(L=>L.map((H,X)=>X===O?{...H,status:"uploading"}:H));try{const L=f.current.get(D.name);if(!L){l(V=>V.map((ue,ge)=>ge===O?{...ue,status:"error",error:"File not found"}:ue));continue}const H=await L.arrayBuffer(),X=await fetch("/api/brain/documents",{method:"POST",headers:{"Content-Type":"application/octet-stream","X-Filename":D.name},body:H});if(X.ok)l(V=>V.map((ue,ge)=>ge===O?{...ue,status:"done"}:ue)),A=!0;else{const V=await X.json();l(ue=>ue.map((ge,Ye)=>Ye===O?{...ge,status:"error",error:V.error}:ge))}}catch{l(L=>L.map((H,X)=>X===O?{...H,status:"error",error:"Upload failed"}:H))}}}h(!1),A&&e()}const T=n.filter(A=>A.status==="pending").length,M=A=>A<1024?`${A}B`:A<1048576?`${Math.round(A/1024)}KB`:`${(A/1048576).toFixed(1)}MB`;return g.jsxs("div",{children:[g.jsx("h3",{style:{fontSize:"18px",fontWeight:700,color:"var(--text-primary)",marginBottom:"4px"},children:"Drop business documents"}),g.jsx("p",{style:{fontSize:"13px",color:"var(--text-secondary)",marginBottom:"20px"},children:"Proposals, brand guides, competitor research, financial reports — anything about your business."}),g.jsxs("div",{onDragOver:A=>{A.preventDefault(),_(!0)},onDragLeave:()=>_(!1),onDrop:y,onClick:()=>p.current?.click(),style:{border:`2px dashed ${d?"#5e17eb":"#d1d5db"}`,borderRadius:"12px",padding:"32px",textAlign:"center",cursor:"pointer",transition:"all 0.15s",background:d?"rgba(94,23,235,0.04)":"transparent"},children:[g.jsx("div",{style:{fontSize:"32px",marginBottom:"8px"},children:"📄"}),g.jsx("p",{style:{fontSize:"14px",color:"var(--text-primary)",fontWeight:500},children:"Drop files here or click to browse"}),g.jsx("p",{style:{fontSize:"12px",color:"#9ca3af",marginTop:"4px"},children:"PDF, DOCX, TXT, MD, CSV — max 10MB each"})]}),g.jsx("input",{ref:p,type:"file",multiple:!0,accept:".pdf,.docx,.txt,.md,.csv",onChange:x,style:{display:"none"}}),n.length>0&&g.jsx("div",{style:{marginTop:"16px",display:"flex",flexDirection:"column",gap:"6px"},children:n.map((A,O)=>g.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"10px",padding:"8px 12px",borderRadius:"8px",background:"#fafafa"},children:[g.jsx("span",{style:{fontSize:"12px",color:A.status==="done"?"#16a34a":A.status==="error"?"#ef4444":A.status==="uploading"?"#f59e0b":"#9ca3af"},children:A.status==="done"?"✓":A.status==="error"?"✗":A.status==="uploading"?"⏳":"○"}),g.jsx("span",{style:{flex:1,fontSize:"13px",color:"var(--text-primary)"},children:A.name}),g.jsx("span",{style:{fontSize:"11px",color:"#9ca3af"},children:M(A.size)}),A.status==="pending"&&g.jsx("button",{onClick:D=>{D.stopPropagation(),C(A.name)},style:{background:"none",border:"none",color:"#d1d5db",cursor:"pointer",fontSize:"14px"},children:"×"}),A.status==="error"&&A.error&&g.jsx("span",{style:{fontSize:"11px",color:"#ef4444"},children:A.error})]},O))}),g.jsxs("div",{style:{display:"flex",gap:"12px",marginTop:"20px"},children:[T>0&&g.jsx("button",{onClick:b,disabled:o,style:{padding:"12px 24px",background:"#5e17eb",color:"#fff",borderRadius:"10px",border:"none",fontSize:"14px",fontWeight:600,cursor:o?"not-allowed":"pointer",opacity:o?.6:1},children:o?"Processing...":`Process ${T} document${T!==1?"s":""} →`}),T===0&&n.length>0&&g.jsx("button",{onClick:e,style:{padding:"12px 24px",background:"#5e17eb",color:"#fff",borderRadius:"10px",border:"none",fontSize:"14px",fontWeight:600,cursor:"pointer"},children:"Continue →"})]}),g.jsx("button",{onClick:i,style:{display:"block",marginTop:"16px",background:"none",border:"none",color:"#9ca3af",fontSize:"13px",cursor:"pointer"},children:"Skip this step →"})]})}function Mm({onDone:e}){const[i,n]=z.useState("website"),[l,o]=z.useState({website:"active",import:"pending",documents:"pending",summary:"pending"}),[h,d]=z.useState(null);z.useEffect(()=>{_()},[]);async function _(){try{const D=await(await fetch("/api/brain-status")).json();d(D)}catch{}}function p(O){n(O),o(D=>({...D,[O]:"active"}))}async function f(O){const D={};O.businessName&&(D.Name=String(O.businessName)),O.businessTypeLabel&&(D["Type Label"]=String(O.businessTypeLabel)),O.businessType&&(D.Type=String(O.businessType)),O.description&&(D.Description=String(O.description)),O.location&&(D.Location=String(O.location)),O.website&&(D.Website=String(O.website)),O.priceRange&&(D.Pricing=String(O.priceRange)),O.emailListDetected&&(D["Email List Detected"]=O.emailListDetected?"Yes":"No"),O.socialProfiles&&Object.keys(O.socialProfiles).length>0&&(D["Social Profiles"]=Object.keys(O.socialProfiles).join(", ")),await fetch("/api/brain/save",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({category:"business",fields:D})}),o(L=>({...L,website:"completed"})),await _(),p("import")}function S(){o(O=>({...O,website:"skipped"})),p("import")}async function y(O){await fetch("/api/brain/import",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({text:O})}),o(D=>({...D,import:"completed"})),await _(),p("documents")}function x(){o(O=>({...O,import:"skipped"})),p("documents")}function C(){o(O=>({...O,documents:"completed"})),p("summary"),_()}function b(){o(O=>({...O,documents:"skipped"})),p("summary"),_()}const T=[{key:"website",label:"Website",emoji:"🔗"},{key:"import",label:"ChatGPT Export",emoji:"🤖"},{key:"documents",label:"Documents",emoji:"📄"}],M=O=>O==="completed"?"✓":O==="skipped"?"○":O==="active"?"●":"○",A=O=>O==="completed"?"#16a34a":O==="active"?"#5e17eb":"#d1d5db";return g.jsxs("div",{style:{display:"flex",gap:"32px",minHeight:"400px"},children:[g.jsxs("div",{style:{width:"200px",flexShrink:0},children:[g.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"8px"},children:T.map(O=>g.jsxs("button",{onClick:()=>n(O.key),style:{display:"flex",alignItems:"center",gap:"10px",padding:"12px 14px",borderRadius:"10px",background:i===O.key?"rgba(94,23,235,0.06)":"transparent",border:i===O.key?"1px solid rgba(94,23,235,0.15)":"1px solid transparent",cursor:"pointer",textAlign:"left",width:"100%"},children:[g.jsx("span",{style:{color:A(l[O.key]),fontSize:"14px",fontWeight:700},children:M(l[O.key])}),g.jsxs("span",{style:{fontSize:"13px",fontWeight:600,color:"var(--text-primary)"},children:[O.emoji," ",O.label]})]},O.key))}),g.jsxs("div",{style:{marginTop:"24px",padding:"16px",borderRadius:"12px",background:"rgba(94,23,235,0.04)",border:"1px solid rgba(94,23,235,0.1)"},children:[g.jsxs("div",{style:{fontSize:"28px",fontWeight:800,color:"#5e17eb",textAlign:"center"},children:[h?.completeness??0,"%"]}),g.jsx("div",{style:{fontSize:"11px",color:"#9ca3af",textAlign:"center",marginTop:"2px"},children:"Brain filled"}),g.jsx("div",{style:{background:"#e5e7eb",height:"6px",borderRadius:"3px",marginTop:"8px",overflow:"hidden"},children:g.jsx("div",{style:{background:"#5e17eb",height:"6px",borderRadius:"3px",width:`${h?.completeness??0}%`,transition:"width 0.5s"}})})]}),g.jsx("button",{onClick:e,style:{display:"block",width:"100%",marginTop:"16px",background:"none",border:"none",color:"#9ca3af",fontSize:"12px",cursor:"pointer"},children:"Skip for now →"})]}),g.jsxs("div",{style:{flex:1},children:[i==="website"&&g.jsx(OS,{onComplete:f,onSkip:S}),i==="import"&&g.jsx(jS,{onComplete:y,onSkip:x}),i==="documents"&&g.jsx(WS,{onComplete:C,onSkip:b}),i==="summary"&&g.jsxs("div",{children:[g.jsxs("h3",{style:{fontSize:"18px",fontWeight:700,color:"var(--text-primary)",marginBottom:"8px"},children:[h?.businessName?`${h.businessName} — `:"","Brain is ",h?.completeness??0,"% complete"]}),g.jsx("p",{style:{fontSize:"13px",color:"var(--text-secondary)",marginBottom:"24px"},children:"You can add more anytime from the sidebar."}),h?.categories&&Object.entries(h.categories).map(([O,D])=>g.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"12px",marginBottom:"10px"},children:[g.jsxs("span",{style:{width:"100px",fontSize:"13px",fontWeight:600,color:"var(--text-primary)"},children:[O==="business"?"🏢":O==="industry"?"📊":O==="voice"?"🎙️":"🎯"," ",O.charAt(0).toUpperCase()+O.slice(1)]}),g.jsx("div",{style:{flex:1,background:"#e5e7eb",height:"8px",borderRadius:"4px",overflow:"hidden"},children:g.jsx("div",{style:{background:"#5e17eb",height:"8px",borderRadius:"4px",width:`${D.percent}%`,transition:"width 0.5s"}})}),g.jsxs("span",{style:{fontSize:"12px",color:"#9ca3af",width:"35px",textAlign:"right"},children:[D.percent,"%"]})]},O)),g.jsx("button",{onClick:e,style:{width:"100%",marginTop:"24px",padding:"16px",background:"linear-gradient(135deg, #5e17eb, #8b5cf6)",color:"#fff",borderRadius:"12px",fontSize:"16px",fontWeight:700,border:"none",cursor:"pointer",boxShadow:"0 4px 12px rgba(94,23,235,0.3)"},children:"Done — Start working →"})]})]})]})}function qS({onProjectSelected:e}){const[i,n]=z.useState("detect"),[l,o]=z.useState([]),[h,d]=z.useState(!1),{setMode:_}=Et(),[p,f]=z.useState("developer");function S(y){f(y),_(y),n(y==="brain"?"brain":"project")}return g.jsxs(g.Fragment,{children:[h&&g.jsx(Bm,{onClose:()=>d(!1)}),g.jsx("div",{className:"h-full flex items-center justify-center",style:{background:"var(--bg-primary)"},children:g.jsxs("div",{className:"w-full max-w-[600px] px-8 animate-in",children:[g.jsxs("div",{style:{marginBottom:"80px",textAlign:"center"},children:[g.jsxs("div",{style:{display:"inline-flex",alignItems:"center",gap:"16px",marginBottom:"12px"},children:[g.jsx("div",{style:{width:"48px",height:"48px",borderRadius:"14px",background:"linear-gradient(135deg, #5e17eb, #8b5cf6)",display:"flex",alignItems:"center",justifyContent:"center",boxShadow:"0 4px 12px rgba(94,23,235,0.3)"},children:g.jsx("span",{style:{color:"white",fontSize:"24px",fontWeight:700},children:"C"})}),g.jsx("h1",{style:{fontSize:"40px",fontWeight:800,color:"var(--text-primary)",letterSpacing:"-0.02em"},children:"Claude Portal"})]}),g.jsx("p",{style:{color:"var(--text-secondary)",fontSize:"20px"},children:"Get more done with AI"})]}),i==="detect"&&g.jsx(BS,{onAllReady:()=>n("mode"),onNeedInstall:y=>{o(y),n("install")}}),i==="install"&&g.jsx(zS,{tools:l,onDone:()=>n("mode")}),i==="mode"&&g.jsxs("div",{className:"animate-in",children:[g.jsx("div",{style:{textAlign:"center",marginBottom:"40px"},children:g.jsx("button",{onClick:()=>d(!0),style:{padding:"14px 28px",borderRadius:"14px",background:"linear-gradient(135deg, rgba(94,23,235,0.08), rgba(139,92,246,0.08))",border:"1px solid rgba(94,23,235,0.2)",color:"#8b5cf6",fontSize:"15px",fontWeight:600,cursor:"pointer",transition:"all 0.2s",display:"inline-flex",alignItems:"center",gap:"8px"},children:"▶ How it works"})}),g.jsx("h2",{style:{fontSize:"28px",fontWeight:700,color:"var(--text-primary)",marginBottom:"8px",textAlign:"center"},children:"How can we help?"}),g.jsx("p",{style:{color:"var(--text-secondary)",fontSize:"17px",marginBottom:"48px",textAlign:"center"},children:"Choose how you'd like to work today"}),g.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"24px"},children:[g.jsxs("button",{onClick:()=>S("brain"),className:"group transition-all duration-300 hover:-translate-y-1 active:scale-[0.98]",style:{width:"100%",padding:"40px",background:"var(--bg-secondary)",borderRadius:"24px",textAlign:"left",border:"2px solid #5e17eb",boxShadow:"0 8px 24px rgba(94,23,235,0.12)",cursor:"pointer",position:"relative"},children:[g.jsx("div",{style:{position:"absolute",top:"16px",right:"16px",background:"#5e17eb",color:"white",fontSize:"11px",fontWeight:700,padding:"4px 12px",borderRadius:"20px",letterSpacing:"0.02em"},children:"Start Here"}),g.jsxs("div",{style:{display:"flex",alignItems:"flex-start",gap:"24px"},children:[g.jsx("div",{style:{width:"64px",height:"64px",borderRadius:"16px",background:"linear-gradient(135deg, #5e17eb, #8b5cf6)",display:"flex",alignItems:"center",justifyContent:"center",boxShadow:"0 4px 12px rgba(94,23,235,0.3)",flexShrink:0,fontSize:"32px"},children:"🧠"}),g.jsxs("div",{children:[g.jsx("div",{style:{color:"var(--text-primary)",fontSize:"22px",fontWeight:700,marginBottom:"8px"},children:"Teach AI your business"}),g.jsx("div",{style:{color:"var(--text-secondary)",fontSize:"16px",lineHeight:1.6},children:"Set up once. Every AI session knows your business — name, pricing, audience, voice."})]})]})]}),g.jsx("button",{onClick:()=>S("developer"),className:"group transition-all duration-300 hover:-translate-y-1 active:scale-[0.98]",style:{width:"100%",padding:"40px",background:"var(--bg-secondary)",borderRadius:"24px",textAlign:"left",border:"1px solid var(--border)",boxShadow:"0 8px 24px rgba(0,0,0,0.08)",cursor:"pointer"},children:g.jsxs("div",{style:{display:"flex",alignItems:"flex-start",gap:"24px"},children:[g.jsx("div",{style:{width:"64px",height:"64px",borderRadius:"16px",background:"linear-gradient(135deg, #5e17eb, #8b5cf6)",display:"flex",alignItems:"center",justifyContent:"center",boxShadow:"0 4px 12px rgba(94,23,235,0.3)",flexShrink:0,fontSize:"32px"},children:"🔨"}),g.jsxs("div",{children:[g.jsx("div",{style:{color:"var(--text-primary)",fontSize:"22px",fontWeight:700,marginBottom:"8px"},children:"Build or improve a project"}),g.jsx("div",{style:{color:"var(--text-secondary)",fontSize:"16px",lineHeight:1.6},children:"Create new features, fix bugs, and get guided checklists to ship with confidence."})]})]})}),g.jsx("button",{onClick:()=>S("document"),className:"group transition-all duration-300 hover:-translate-y-1 active:scale-[0.98]",style:{width:"100%",padding:"40px",background:"var(--bg-secondary)",borderRadius:"24px",textAlign:"left",border:"1px solid var(--border)",boxShadow:"0 8px 24px rgba(0,0,0,0.08)",cursor:"pointer"},children:g.jsxs("div",{style:{display:"flex",alignItems:"flex-start",gap:"24px"},children:[g.jsx("div",{style:{width:"64px",height:"64px",borderRadius:"16px",background:"linear-gradient(135deg, #ffdd27, #ffc107)",display:"flex",alignItems:"center",justifyContent:"center",boxShadow:"0 4px 12px rgba(255,221,39,0.3)",flexShrink:0,fontSize:"32px"},children:"📄"}),g.jsxs("div",{children:[g.jsx("div",{style:{color:"var(--text-primary)",fontSize:"22px",fontWeight:700,marginBottom:"8px"},children:"Make your work faster"}),g.jsx("div",{style:{color:"var(--text-secondary)",fontSize:"16px",lineHeight:1.6},children:"Point AI at your documents and get summaries, reports, and analysis — no coding needed."})]})]})})]})]}),i==="project"&&g.jsx(AS,{onProjectSelected:e,mode:p}),i==="brain"&&g.jsx(Mm,{onDone:()=>n("mode")})]})})]})}function PS(){const{path:e,gitBranch:i,terminalConnected:n,clearProject:l,mode:o,setMode:h}=Et(),d=o==="document",_=p=>({padding:"10px 20px",borderRadius:"10px",fontSize:"14px",fontWeight:500,border:"none",cursor:"pointer",transition:"all 0.2s",background:p?"white":"transparent",color:p?o==="document"?"#5856d6":"#1d1d1f":"#86868b",boxShadow:p?"0 1px 3px rgba(0,0,0,0.1)":"none"});return g.jsxs("div",{style:{height:"56px",display:"flex",alignItems:"center",justifyContent:"space-between",padding:"0 24px",borderBottom:"1px solid #e5e7eb",background:"rgba(255,255,255,0.9)",backdropFilter:"blur(20px)",flexShrink:0,transition:"background 0.2s, border-color 0.2s"},children:[g.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"16px"},children:[d?g.jsx("div",{style:{width:"32px",height:"32px",borderRadius:"10px",background:"linear-gradient(135deg, #5856d6, #af52de)",display:"flex",alignItems:"center",justifyContent:"center",color:"white",fontSize:"15px",fontWeight:700},children:"C"}):g.jsx("div",{style:{width:"12px",height:"12px",borderRadius:"50%",background:"#30d158",boxShadow:"0 0 10px rgba(48,209,88,0.4)"}}),g.jsx("span",{style:{fontFamily:"'SF Mono', Menlo, monospace",fontSize:"13px",color:"#86868b",maxWidth:"200px",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:e?.split("/").filter(Boolean).pop()||e})]}),g.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"20px"},children:[g.jsxs("div",{style:{display:"flex",borderRadius:"12px",padding:"3px",gap:"2px",background:d?"rgba(0,0,0,0.04)":"rgba(255,255,255,0.06)"},children:[g.jsx("button",{onClick:()=>h("developer"),style:_(o==="developer"),children:"🔨 Build"}),g.jsx("button",{onClick:()=>h("document"),style:_(o==="document"),children:"📄 Documents"})]}),i&&g.jsx("span",{style:{fontSize:"12px",fontFamily:"'SF Mono', Menlo, monospace",color:"#86868b"},children:i}),g.jsx("div",{style:{width:"10px",height:"10px",borderRadius:"50%",background:n?"#30d158":"#ff453a",boxShadow:n?"0 0 6px rgba(48,209,88,0.4)":"none"}}),g.jsx("button",{onClick:l,style:{padding:"8px 16px",borderRadius:"8px",fontSize:"14px",fontWeight:500,border:"none",cursor:"pointer",color:"#86868b",background:"transparent",transition:"all 0.2s"},className:d?"hover:bg-black/[0.04]":"hover:bg-white/[0.06]",children:"Switch"})]})]})}function IS(){const{serverConnected:e}=Et();return e?null:g.jsxs("div",{className:"px-4 py-2 bg-red-500/10 border-b border-red-500/20 text-red-400 text-sm text-center shrink-0",children:["Server connection lost. Restart with ",g.jsx("code",{className:"mx-1 font-mono",children:"npm run dev"})]})}function $S({open:e,onToggle:i}){const{mode:n}=Et(),l=n==="document";return g.jsx("div",{style:{width:"52px",display:"flex",flexDirection:"column",alignItems:"center",paddingTop:"20px",borderRight:"1px solid #e5e7eb",background:"#fafafa",flexShrink:0,transition:"background 0.2s"},children:g.jsx("button",{onClick:i,title:"Toggle sidebar",style:{width:"36px",height:"36px",borderRadius:"10px",display:"flex",alignItems:"center",justifyContent:"center",border:"none",cursor:"pointer",transition:"all 0.2s",background:e?l?"rgba(88,86,214,0.1)":"rgba(48,209,88,0.1)":"transparent",color:e?l?"#5856d6":"#30d158":"#86868b"},className:"active:scale-90",children:g.jsx("svg",{width:"18",height:"18",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",children:g.jsx("path",{d:"M2 4h12M2 8h12M2 12h12"})})})})}const KS={business:{emoji:"🏢",label:"Business"},industry:{emoji:"📊",label:"Industry"},voice:{emoji:"🎙️",label:"Voice"},competitors:{emoji:"🎯",label:"Competitors"}};function zm(){const{setEditingBrain:e}=Et(),[i,n]=z.useState(null),[l,o]=z.useState(!0),[h,d]=z.useState(!1);return z.useEffect(()=>{fetch("/api/brain-status").then(_=>_.json()).then(_=>{n(_),o(!1)}).catch(()=>o(!1))},[]),l?null:g.jsxs("div",{style:{borderBottom:"1px solid #e5e7eb"},children:[g.jsxs("button",{onClick:()=>d(!h),style:{width:"100%",padding:"16px 20px",display:"flex",alignItems:"center",justifyContent:"space-between",background:"none",border:"none",cursor:"pointer"},children:[g.jsxs("span",{style:{fontWeight:600,fontSize:"14px",color:"#374151",display:"flex",alignItems:"center",gap:"6px"},children:[g.jsx("span",{style:{fontSize:"10px",color:"#9ca3af",transform:h?"rotate(0deg)":"rotate(90deg)",transition:"transform 0.15s",display:"inline-block"},children:"▶"}),"🧠"," ",i?.businessName||"Business Brain"]}),i?.exists?g.jsxs("span",{style:{background:i.completeness>=70?"#dcfce7":"#f3e8ff",color:i.completeness>=70?"#16a34a":"#7c3aed",fontSize:"12px",padding:"3px 10px",borderRadius:"12px",fontWeight:600},children:[i.completeness,"%"]}):g.jsx("span",{style:{background:"#f3f4f6",color:"#9ca3af",fontSize:"12px",padding:"3px 10px",borderRadius:"12px",fontWeight:600},children:"Not set up"})]}),!h&&i?.exists&&i.categories&&g.jsxs("div",{style:{padding:"0 20px 16px"},children:[Object.entries(i.categories).map(([_,p])=>{const f=KS[_];return f?g.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px",marginBottom:"8px"},children:[g.jsxs("span",{style:{fontSize:"12px",width:"90px",display:"flex",alignItems:"center",gap:"4px"},children:[g.jsx("span",{children:f.emoji}),g.jsx("span",{style:{fontWeight:500,color:"#374151"},children:f.label})]}),g.jsx("div",{style:{flex:1,background:"#e5e7eb",height:"6px",borderRadius:"3px",overflow:"hidden"},children:g.jsx("div",{style:{background:p.percent>=70?"#16a34a":"#5e17eb",height:"6px",borderRadius:"3px",width:`${p.percent}%`,transition:"width 0.5s"}})}),g.jsxs("span",{style:{fontSize:"11px",color:"#9ca3af",width:"30px",textAlign:"right"},children:[p.percent,"%"]})]},_):null}),g.jsxs("button",{onClick:()=>e(!0),style:{marginTop:"4px",padding:"6px 14px",borderRadius:"8px",border:"1px solid rgba(94,23,235,0.2)",background:"rgba(94,23,235,0.04)",color:"#5e17eb",fontSize:"12px",fontWeight:600,cursor:"pointer",width:"100%"},children:["Edit Brain ","→"]})]}),!h&&!i?.exists&&g.jsxs("div",{style:{padding:"0 20px 16px"},children:[g.jsx("p",{style:{fontSize:"12px",color:"#9ca3af",marginBottom:"8px"},children:"Set up your Business Brain to give AI your business context automatically."}),g.jsxs("button",{onClick:()=>e(!0),style:{padding:"6px 14px",borderRadius:"8px",border:"1px solid rgba(94,23,235,0.2)",background:"rgba(94,23,235,0.04)",color:"#5e17eb",fontSize:"12px",fontWeight:600,cursor:"pointer",width:"100%"},children:["Set up Brain ","→"]})]})]})}function YS(e){const{path:i,setServerConnected:n}=Et(),l=z.useRef(e);l.current=e;const o=z.useRef(new Map),h=z.useCallback((d,_)=>{const p=o.current.get(d);p&&clearTimeout(p),o.current.set(d,setTimeout(()=>{l.current(d,_),o.current.delete(d)},400))},[]);z.useEffect(()=>{if(!i)return;const d=`/api/events?projectPath=${encodeURIComponent(i)}`,_=new EventSource(d);return _.addEventListener("health-changed",p=>h("health-changed",JSON.parse(p.data))),_.addEventListener("plan-changed",p=>h("plan-changed",JSON.parse(p.data))),_.addEventListener("push-detected",p=>h("push-detected",JSON.parse(p.data))),_.onopen=()=>n(!0),_.onerror=()=>n(!1),()=>{_.close();for(const p of o.current.values())clearTimeout(p);o.current.clear()}},[i,h,n])}function FS(){const{path:e}=Et(),[i,n]=z.useState([]),[l,o]=z.useState(!1),h=z.useCallback(async()=>{if(!e)return;o(!0);const d=await _i(Rm("/api/health-scan",e));d&&n(d.checks),o(!1)},[e]);return z.useEffect(()=>{h()},[h]),YS(d=>{d==="health-changed"&&h()}),{checks:i,loading:l,failCount:i.filter(d=>d.status==="fail").length,passCount:i.filter(d=>d.status==="pass").length,rescan:h}}function GS({label:e,description:i,status:n,fixPrompt:l}){const{sendPrompt:o}=en(),[h,d]=z.useState(!1);if(n==="pass")return null;const _=()=>{!l||h||(o(l),d(!0),setTimeout(()=>d(!1),3e3))};return g.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"12px",padding:"10px 16px",borderRadius:"8px",transition:"background 0.15s"},children:[g.jsx("div",{style:{width:"8px",height:"8px",borderRadius:"50%",background:"#f59e0b",flexShrink:0}}),g.jsxs("div",{style:{flex:1},children:[g.jsxs("div",{style:{fontSize:"13px",color:"#374151"},children:[e," missing"]}),i&&g.jsx("div",{style:{fontSize:"11px",color:"#9ca3af",marginTop:"1px"},children:i})]}),l&&g.jsx("button",{onClick:_,style:{padding:"6px 14px",background:"#dcfce7",color:"#16a34a",fontSize:"12px",borderRadius:"8px",fontWeight:600,border:h?"1px solid #86efac":"none",cursor:h?"default":"pointer",flexShrink:0,transition:"all 0.15s"},children:h?"✓ Sent":"Fix →"})]})}function XS(){const{checks:e,loading:i,failCount:n,passCount:l}=FS(),[o,h]=z.useState(!1);return g.jsxs("div",{style:{borderBottom:"1px solid #e5e7eb"},children:[g.jsxs("button",{onClick:()=>h(!o),style:{width:"100%",padding:"16px 20px",display:"flex",alignItems:"center",justifyContent:"space-between",background:"none",border:"none",cursor:"pointer",transition:"background 0.15s"},children:[g.jsxs("span",{style:{fontWeight:600,fontSize:"14px",color:"#374151",display:"flex",alignItems:"center",gap:"6px"},children:[g.jsx("span",{style:{fontSize:"10px",color:"#9ca3af",transform:o?"rotate(0deg)":"rotate(90deg)",transition:"transform 0.15s",display:"inline-block"},children:"▶"}),"Project Health"]}),i?g.jsx("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:g.jsx("span",{style:{fontSize:"12px",color:"#9ca3af"},children:"scanning..."})}):n>0?g.jsxs("span",{style:{background:"#fef3c7",color:"#d97706",fontSize:"12px",padding:"3px 10px",borderRadius:"12px",fontWeight:600},children:[n," issue",n!==1?"s":""]}):g.jsx("span",{style:{background:"#dcfce7",color:"#16a34a",fontSize:"12px",padding:"3px 10px",borderRadius:"12px",fontWeight:600},children:"all good"})]}),!o&&g.jsxs("div",{style:{padding:"0 12px 16px",display:"flex",flexDirection:"column",gap:"2px"},children:[e.filter(d=>d.status==="fail").map(d=>g.jsx(GS,{label:d.label,description:d.description,status:d.status,fixPrompt:d.fixPrompt},d.id)),l>0&&g.jsxs("p",{style:{fontSize:"12px",color:"#9ca3af",paddingTop:"8px",paddingLeft:"16px"},children:[l," checks passing"]})]})]})}function VS(){const[e,i]=z.useState([]),[n,l]=z.useState(!0),[o,h]=z.useState(!1);z.useEffect(()=>{fetch("/api/cli-status").then(p=>p.json()).then(p=>{i(p.clis||[]),l(!1)}).catch(()=>l(!1))},[]);const d=e.filter(p=>p.connected).length,_=e.filter(p=>!p.connected).length;return g.jsxs("div",{style:{borderBottom:"1px solid #e5e7eb"},children:[g.jsxs("button",{onClick:()=>h(!o),style:{width:"100%",padding:"16px 20px",display:"flex",alignItems:"center",justifyContent:"space-between",background:"none",border:"none",cursor:"pointer",transition:"background 0.15s"},children:[g.jsxs("span",{style:{fontWeight:600,fontSize:"14px",color:"#374151",display:"flex",alignItems:"center",gap:"6px"},children:[g.jsx("span",{style:{fontSize:"10px",color:"#9ca3af",transform:o?"rotate(0deg)":"rotate(90deg)",transition:"transform 0.15s",display:"inline-block"},children:"▶"}),"CLI Connections"]}),n?g.jsx("span",{style:{fontSize:"12px",color:"#9ca3af"},children:"checking..."}):_>0?g.jsxs("span",{style:{background:"#fef3c7",color:"#d97706",fontSize:"12px",padding:"3px 10px",borderRadius:"12px",fontWeight:600},children:[_," disconnected"]}):g.jsx("span",{style:{background:"#dcfce7",color:"#16a34a",fontSize:"12px",padding:"3px 10px",borderRadius:"12px",fontWeight:600},children:"all connected"})]}),!o&&!n&&g.jsxs("div",{style:{padding:"0 12px 16px",display:"flex",flexDirection:"column",gap:"4px"},children:[e.map(p=>g.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"10px",padding:"8px 12px",borderRadius:"8px",background:p.connected?"rgba(22, 163, 74, 0.04)":"rgba(217, 119, 6, 0.04)"},children:[g.jsx("span",{style:{width:"8px",height:"8px",borderRadius:"50%",background:p.connected?"#16a34a":"#d97706",flexShrink:0}}),g.jsxs("div",{style:{flex:1,minWidth:0},children:[g.jsx("div",{style:{fontSize:"13px",fontWeight:600,color:"#374151"},children:p.label}),g.jsx("div",{style:{fontSize:"11px",color:p.connected?"#6b7280":"#d97706",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:p.detail})]})]},p.id)),d>0&&_===0&&g.jsx("p",{style:{fontSize:"12px",color:"#9ca3af",paddingTop:"4px",paddingLeft:"12px"},children:"All CLIs authenticated and ready"})]})]})}function ZS(){const{sendPrompt:e}=en(),[i,n]=z.useState(!1),[l,o]=z.useState(""),[h,d]=z.useState(""),[_,p]=z.useState(!1),f=l.trim().length>0,S=()=>{if(!f)return;const C=["I want to add a new feature to my app:","",`**What it does:** ${l.trim()}`];h.trim()&&C.push("",`**What success looks like:** ${h.trim()}`),C.push("","Please:","1. Create an implementation plan with numbered steps and files to create/modify","2. Save the plan as a markdown file in docs/plans/","3. Include a testing checklist at the end with specific items to verify","4. Then start building step 1");const b=C.join(`
|
|
79
|
+
Only include things you're confident about from our conversations. Skip any category where you don't have information. Be specific — use real names, numbers, and examples from our chats.`;function jS({onComplete:e,onSkip:i}){const[n,l]=z.useState(!1),[o,h]=z.useState(""),[d,_]=z.useState(!1),[p,f]=z.useState(null),[S,y]=z.useState(!1);function x(){navigator.clipboard.writeText(LS),l(!0),setTimeout(()=>l(!1),2e3)}async function C(){if(o.trim().length<50){f("This doesn't look like a full response. Try pasting the complete reply.");return}_(!0),f(null);try{const b=await fetch("/api/brain/import",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({text:o})}),T=await b.json();if(!b.ok){f(T.error),_(!1);return}y(!0),setTimeout(()=>e(o),1500)}catch{f("Import failed. Try again.")}_(!1)}return S?g.jsxs("div",{style:{textAlign:"center",padding:"40px 0"},children:[g.jsx("div",{style:{fontSize:"48px",marginBottom:"16px"},children:"✓"}),g.jsx("p",{style:{fontSize:"16px",fontWeight:600,color:"#16a34a"},children:"Imported successfully"})]}):g.jsxs("div",{children:[g.jsx("h3",{style:{fontSize:"18px",fontWeight:700,color:"var(--text-primary)",marginBottom:"4px"},children:"Import from ChatGPT"}),g.jsx("p",{style:{fontSize:"13px",color:"var(--text-secondary)",marginBottom:"20px"},children:"Copy this prompt, paste it into ChatGPT or Claude, then paste the response below."}),g.jsxs("div",{style:{padding:"12px 16px",borderRadius:"10px",background:"rgba(94,23,235,0.04)",border:"1px solid rgba(94,23,235,0.1)",marginBottom:"20px",display:"flex",alignItems:"center",justifyContent:"space-between"},children:[g.jsx("span",{style:{fontSize:"13px",color:"var(--text-primary)",fontWeight:500},children:"Step 1: Copy this prompt →"}),g.jsx("button",{onClick:x,style:{padding:"6px 14px",borderRadius:"8px",background:n?"#16a34a":"#5e17eb",color:"#fff",fontSize:"12px",fontWeight:600,border:"none",cursor:"pointer"},children:n?"Copied!":"Copy Prompt"})]}),g.jsx("div",{style:{marginBottom:"8px",fontSize:"13px",color:"var(--text-primary)",fontWeight:500},children:"Step 2: Paste the response here"}),g.jsx("textarea",{value:o,onChange:b=>{h(b.target.value),f(null)},rows:8,placeholder:"Paste ChatGPT's response here...",style:{width:"100%",padding:"12px 16px",borderRadius:"10px",border:"1px solid #e5e7eb",fontSize:"13px",resize:"vertical",outline:"none",fontFamily:"inherit",color:"var(--text-primary)",background:"var(--bg-secondary)"}}),p&&g.jsx("p",{style:{fontSize:"13px",color:"#ef4444",marginTop:"8px"},children:p}),g.jsx("button",{onClick:C,disabled:d||o.length<50,style:{marginTop:"16px",padding:"12px 24px",background:"#5e17eb",color:"#fff",borderRadius:"10px",border:"none",fontSize:"14px",fontWeight:600,cursor:d||o.length<50?"not-allowed":"pointer",opacity:d||o.length<50?.5:1},children:d?"Importing...":"Import →"}),g.jsx("button",{onClick:i,style:{display:"block",marginTop:"16px",background:"none",border:"none",color:"#9ca3af",fontSize:"13px",cursor:"pointer"},children:"Skip this step →"})]})}const NS=[".pdf",".docx",".txt",".md",".csv"],HS=10*1024*1024,US=50*1024*1024;function WS({onComplete:e,onSkip:i}){const[n,l]=z.useState([]),[o,h]=z.useState(!1),[d,_]=z.useState(!1),p=z.useRef(null),f=z.useRef(new Map);function S(A){const O=[];let L=n.reduce((H,X)=>H+X.size,0);for(const H of Array.from(A)){const X="."+H.name.split(".").pop()?.toLowerCase();if(!NS.includes(X)){O.push({name:H.name,size:H.size,status:"error",error:`Unsupported file type: ${X}`});continue}if(H.size>HS){O.push({name:H.name,size:H.size,status:"error",error:"File too large (max 10MB)"});continue}if(L+=H.size,L>US){O.push({name:H.name,size:H.size,status:"error",error:"Total upload limit exceeded (50MB)"});continue}f.current.set(H.name,H),O.push({name:H.name,size:H.size,status:"pending"})}l(H=>[...H,...O])}function y(A){A.preventDefault(),_(!1),A.dataTransfer.files.length>0&&S(A.dataTransfer.files)}function x(A){A.target.files&&S(A.target.files)}function C(A){l(O=>O.filter(D=>D.name!==A)),f.current.delete(A)}async function b(){h(!0);let A=!1;for(let O=0;O<n.length;O++){const D=n[O];if(D.status==="pending"){l(L=>L.map((H,X)=>X===O?{...H,status:"uploading"}:H));try{const L=f.current.get(D.name);if(!L){l(V=>V.map((ue,ge)=>ge===O?{...ue,status:"error",error:"File not found"}:ue));continue}const H=await L.arrayBuffer(),X=await fetch("/api/brain/documents",{method:"POST",headers:{"Content-Type":"application/octet-stream","X-Filename":D.name},body:H});if(X.ok)l(V=>V.map((ue,ge)=>ge===O?{...ue,status:"done"}:ue)),A=!0;else{const V=await X.json();l(ue=>ue.map((ge,Ke)=>Ke===O?{...ge,status:"error",error:V.error}:ge))}}catch{l(L=>L.map((H,X)=>X===O?{...H,status:"error",error:"Upload failed"}:H))}}}h(!1),A&&e()}const T=n.filter(A=>A.status==="pending").length,M=A=>A<1024?`${A}B`:A<1048576?`${Math.round(A/1024)}KB`:`${(A/1048576).toFixed(1)}MB`;return g.jsxs("div",{children:[g.jsx("h3",{style:{fontSize:"18px",fontWeight:700,color:"var(--text-primary)",marginBottom:"4px"},children:"Drop business documents"}),g.jsx("p",{style:{fontSize:"13px",color:"var(--text-secondary)",marginBottom:"20px"},children:"Proposals, brand guides, competitor research, financial reports — anything about your business."}),g.jsxs("div",{onDragOver:A=>{A.preventDefault(),_(!0)},onDragLeave:()=>_(!1),onDrop:y,onClick:()=>p.current?.click(),style:{border:`2px dashed ${d?"#5e17eb":"#d1d5db"}`,borderRadius:"12px",padding:"32px",textAlign:"center",cursor:"pointer",transition:"all 0.15s",background:d?"rgba(94,23,235,0.04)":"transparent"},children:[g.jsx("div",{style:{fontSize:"32px",marginBottom:"8px"},children:"📄"}),g.jsx("p",{style:{fontSize:"14px",color:"var(--text-primary)",fontWeight:500},children:"Drop files here or click to browse"}),g.jsx("p",{style:{fontSize:"12px",color:"#9ca3af",marginTop:"4px"},children:"PDF, DOCX, TXT, MD, CSV — max 10MB each"})]}),g.jsx("input",{ref:p,type:"file",multiple:!0,accept:".pdf,.docx,.txt,.md,.csv",onChange:x,style:{display:"none"}}),n.length>0&&g.jsx("div",{style:{marginTop:"16px",display:"flex",flexDirection:"column",gap:"6px"},children:n.map((A,O)=>g.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"10px",padding:"8px 12px",borderRadius:"8px",background:"#fafafa"},children:[g.jsx("span",{style:{fontSize:"12px",color:A.status==="done"?"#16a34a":A.status==="error"?"#ef4444":A.status==="uploading"?"#f59e0b":"#9ca3af"},children:A.status==="done"?"✓":A.status==="error"?"✗":A.status==="uploading"?"⏳":"○"}),g.jsx("span",{style:{flex:1,fontSize:"13px",color:"var(--text-primary)"},children:A.name}),g.jsx("span",{style:{fontSize:"11px",color:"#9ca3af"},children:M(A.size)}),A.status==="pending"&&g.jsx("button",{onClick:D=>{D.stopPropagation(),C(A.name)},style:{background:"none",border:"none",color:"#d1d5db",cursor:"pointer",fontSize:"14px"},children:"×"}),A.status==="error"&&A.error&&g.jsx("span",{style:{fontSize:"11px",color:"#ef4444"},children:A.error})]},O))}),g.jsxs("div",{style:{display:"flex",gap:"12px",marginTop:"20px"},children:[T>0&&g.jsx("button",{onClick:b,disabled:o,style:{padding:"12px 24px",background:"#5e17eb",color:"#fff",borderRadius:"10px",border:"none",fontSize:"14px",fontWeight:600,cursor:o?"not-allowed":"pointer",opacity:o?.6:1},children:o?"Processing...":`Process ${T} document${T!==1?"s":""} →`}),T===0&&n.length>0&&g.jsx("button",{onClick:e,style:{padding:"12px 24px",background:"#5e17eb",color:"#fff",borderRadius:"10px",border:"none",fontSize:"14px",fontWeight:600,cursor:"pointer"},children:"Continue →"})]}),g.jsx("button",{onClick:i,style:{display:"block",marginTop:"16px",background:"none",border:"none",color:"#9ca3af",fontSize:"13px",cursor:"pointer"},children:"Skip this step →"})]})}function Mm({onDone:e}){const[i,n]=z.useState("website"),[l,o]=z.useState({website:"active",import:"pending",documents:"pending",summary:"pending"}),[h,d]=z.useState(null);z.useEffect(()=>{_()},[]);async function _(){try{const D=await(await fetch("/api/brain-status")).json();d(D)}catch{}}function p(O){n(O),o(D=>({...D,[O]:"active"}))}async function f(O){const D={};O.businessName&&(D.Name=String(O.businessName)),O.businessTypeLabel&&(D["Type Label"]=String(O.businessTypeLabel)),O.businessType&&(D.Type=String(O.businessType)),O.description&&(D.Description=String(O.description)),O.location&&(D.Location=String(O.location)),O.website&&(D.Website=String(O.website)),O.priceRange&&(D.Pricing=String(O.priceRange)),O.emailListDetected&&(D["Email List Detected"]=O.emailListDetected?"Yes":"No"),O.socialProfiles&&Object.keys(O.socialProfiles).length>0&&(D["Social Profiles"]=Object.keys(O.socialProfiles).join(", ")),await fetch("/api/brain/save",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({category:"business",fields:D})}),o(L=>({...L,website:"completed"})),await _(),p("import")}function S(){o(O=>({...O,website:"skipped"})),p("import")}async function y(O){await fetch("/api/brain/import",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({text:O})}),o(D=>({...D,import:"completed"})),await _(),p("documents")}function x(){o(O=>({...O,import:"skipped"})),p("documents")}function C(){o(O=>({...O,documents:"completed"})),p("summary"),_()}function b(){o(O=>({...O,documents:"skipped"})),p("summary"),_()}const T=[{key:"website",label:"Website",emoji:"🔗"},{key:"import",label:"ChatGPT Export",emoji:"🤖"},{key:"documents",label:"Documents",emoji:"📄"}],M=O=>O==="completed"?"✓":O==="skipped"?"○":O==="active"?"●":"○",A=O=>O==="completed"?"#16a34a":O==="active"?"#5e17eb":"#d1d5db";return g.jsxs("div",{style:{display:"flex",gap:"32px",minHeight:"400px",maxHeight:"80vh",overflow:"hidden"},children:[g.jsxs("div",{style:{width:"200px",flexShrink:0,overflowY:"auto"},children:[g.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"8px"},children:T.map(O=>g.jsxs("button",{onClick:()=>n(O.key),style:{display:"flex",alignItems:"center",gap:"10px",padding:"12px 14px",borderRadius:"10px",background:i===O.key?"rgba(94,23,235,0.06)":"transparent",border:i===O.key?"1px solid rgba(94,23,235,0.15)":"1px solid transparent",cursor:"pointer",textAlign:"left",width:"100%"},children:[g.jsx("span",{style:{color:A(l[O.key]),fontSize:"14px",fontWeight:700},children:M(l[O.key])}),g.jsxs("span",{style:{fontSize:"13px",fontWeight:600,color:"var(--text-primary)"},children:[O.emoji," ",O.label]})]},O.key))}),g.jsxs("div",{style:{marginTop:"24px",padding:"16px",borderRadius:"12px",background:"rgba(94,23,235,0.04)",border:"1px solid rgba(94,23,235,0.1)"},children:[g.jsxs("div",{style:{fontSize:"28px",fontWeight:800,color:"#5e17eb",textAlign:"center"},children:[h?.completeness??0,"%"]}),g.jsx("div",{style:{fontSize:"11px",color:"#9ca3af",textAlign:"center",marginTop:"2px"},children:"Brain filled"}),g.jsx("div",{style:{background:"#e5e7eb",height:"6px",borderRadius:"3px",marginTop:"8px",overflow:"hidden"},children:g.jsx("div",{style:{background:"#5e17eb",height:"6px",borderRadius:"3px",width:`${h?.completeness??0}%`,transition:"width 0.5s"}})})]}),g.jsx("button",{onClick:e,style:{display:"block",width:"100%",marginTop:"16px",background:"none",border:"none",color:"#9ca3af",fontSize:"12px",cursor:"pointer"},children:"Skip for now →"})]}),g.jsxs("div",{style:{flex:1,overflowY:"auto"},children:[i==="website"&&g.jsx(OS,{onComplete:f,onSkip:S}),i==="import"&&g.jsx(jS,{onComplete:y,onSkip:x}),i==="documents"&&g.jsx(WS,{onComplete:C,onSkip:b}),i==="summary"&&g.jsxs("div",{children:[g.jsxs("h3",{style:{fontSize:"18px",fontWeight:700,color:"var(--text-primary)",marginBottom:"8px"},children:[h?.businessName?`${h.businessName} — `:"","Brain is ",h?.completeness??0,"% complete"]}),g.jsx("p",{style:{fontSize:"13px",color:"var(--text-secondary)",marginBottom:"24px"},children:"You can add more anytime from the sidebar."}),h?.categories&&Object.entries(h.categories).map(([O,D])=>g.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"12px",marginBottom:"10px"},children:[g.jsxs("span",{style:{width:"100px",fontSize:"13px",fontWeight:600,color:"var(--text-primary)"},children:[O==="business"?"🏢":O==="industry"?"📊":O==="voice"?"🎙️":"🎯"," ",O.charAt(0).toUpperCase()+O.slice(1)]}),g.jsx("div",{style:{flex:1,background:"#e5e7eb",height:"8px",borderRadius:"4px",overflow:"hidden"},children:g.jsx("div",{style:{background:"#5e17eb",height:"8px",borderRadius:"4px",width:`${D.percent}%`,transition:"width 0.5s"}})}),g.jsxs("span",{style:{fontSize:"12px",color:"#9ca3af",width:"35px",textAlign:"right"},children:[D.percent,"%"]})]},O)),g.jsx("button",{onClick:e,style:{width:"100%",marginTop:"24px",padding:"16px",background:"linear-gradient(135deg, #5e17eb, #8b5cf6)",color:"#fff",borderRadius:"12px",fontSize:"16px",fontWeight:700,border:"none",cursor:"pointer",boxShadow:"0 4px 12px rgba(94,23,235,0.3)"},children:"Done — Start working →"})]})]})]})}function qS({onProjectSelected:e}){const[i,n]=z.useState("detect"),[l,o]=z.useState([]),[h,d]=z.useState(!1),{setMode:_}=Et(),[p,f]=z.useState("developer");function S(y){f(y),_(y),n(y==="brain"?"brain":"project")}return g.jsxs(g.Fragment,{children:[h&&g.jsx(Bm,{onClose:()=>d(!1)}),g.jsxs("div",{className:"h-full flex items-center justify-center",style:{background:"var(--bg-primary)",overflowY:"auto"},children:[g.jsxs("div",{className:"w-full max-w-[600px] px-8 animate-in",style:{display:i==="brain"?"none":void 0},children:[g.jsxs("div",{style:{marginBottom:"80px",textAlign:"center"},children:[g.jsxs("div",{style:{display:"inline-flex",alignItems:"center",gap:"16px",marginBottom:"12px"},children:[g.jsx("div",{style:{width:"48px",height:"48px",borderRadius:"14px",background:"linear-gradient(135deg, #5e17eb, #8b5cf6)",display:"flex",alignItems:"center",justifyContent:"center",boxShadow:"0 4px 12px rgba(94,23,235,0.3)"},children:g.jsx("span",{style:{color:"white",fontSize:"24px",fontWeight:700},children:"C"})}),g.jsx("h1",{style:{fontSize:"40px",fontWeight:800,color:"var(--text-primary)",letterSpacing:"-0.02em"},children:"Claude Portal"})]}),g.jsx("p",{style:{color:"var(--text-secondary)",fontSize:"20px"},children:"Get more done with AI"})]}),i==="detect"&&g.jsx(BS,{onAllReady:()=>n("mode"),onNeedInstall:y=>{o(y),n("install")}}),i==="install"&&g.jsx(zS,{tools:l,onDone:()=>n("mode")}),i==="mode"&&g.jsxs("div",{className:"animate-in",children:[g.jsx("div",{style:{textAlign:"center",marginBottom:"40px"},children:g.jsx("button",{onClick:()=>d(!0),style:{padding:"14px 28px",borderRadius:"14px",background:"linear-gradient(135deg, rgba(94,23,235,0.08), rgba(139,92,246,0.08))",border:"1px solid rgba(94,23,235,0.2)",color:"#8b5cf6",fontSize:"15px",fontWeight:600,cursor:"pointer",transition:"all 0.2s",display:"inline-flex",alignItems:"center",gap:"8px"},children:"▶ How it works"})}),g.jsx("h2",{style:{fontSize:"28px",fontWeight:700,color:"var(--text-primary)",marginBottom:"8px",textAlign:"center"},children:"How can we help?"}),g.jsx("p",{style:{color:"var(--text-secondary)",fontSize:"17px",marginBottom:"48px",textAlign:"center"},children:"Choose how you'd like to work today"}),g.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"24px"},children:[g.jsxs("button",{onClick:()=>S("brain"),className:"group transition-all duration-300 hover:-translate-y-1 active:scale-[0.98]",style:{width:"100%",padding:"40px",background:"var(--bg-secondary)",borderRadius:"24px",textAlign:"left",border:"2px solid #5e17eb",boxShadow:"0 8px 24px rgba(94,23,235,0.12)",cursor:"pointer",position:"relative"},children:[g.jsx("div",{style:{position:"absolute",top:"16px",right:"16px",background:"#5e17eb",color:"white",fontSize:"11px",fontWeight:700,padding:"4px 12px",borderRadius:"20px",letterSpacing:"0.02em"},children:"Start Here"}),g.jsxs("div",{style:{display:"flex",alignItems:"flex-start",gap:"24px"},children:[g.jsx("div",{style:{width:"64px",height:"64px",borderRadius:"16px",background:"linear-gradient(135deg, #5e17eb, #8b5cf6)",display:"flex",alignItems:"center",justifyContent:"center",boxShadow:"0 4px 12px rgba(94,23,235,0.3)",flexShrink:0,fontSize:"32px"},children:"🧠"}),g.jsxs("div",{children:[g.jsx("div",{style:{color:"var(--text-primary)",fontSize:"22px",fontWeight:700,marginBottom:"8px"},children:"Teach AI your business"}),g.jsx("div",{style:{color:"var(--text-secondary)",fontSize:"16px",lineHeight:1.6},children:"Set up once. Every AI session knows your business — name, pricing, audience, voice."})]})]})]}),g.jsx("button",{onClick:()=>S("developer"),className:"group transition-all duration-300 hover:-translate-y-1 active:scale-[0.98]",style:{width:"100%",padding:"40px",background:"var(--bg-secondary)",borderRadius:"24px",textAlign:"left",border:"1px solid var(--border)",boxShadow:"0 8px 24px rgba(0,0,0,0.08)",cursor:"pointer"},children:g.jsxs("div",{style:{display:"flex",alignItems:"flex-start",gap:"24px"},children:[g.jsx("div",{style:{width:"64px",height:"64px",borderRadius:"16px",background:"linear-gradient(135deg, #5e17eb, #8b5cf6)",display:"flex",alignItems:"center",justifyContent:"center",boxShadow:"0 4px 12px rgba(94,23,235,0.3)",flexShrink:0,fontSize:"32px"},children:"🔨"}),g.jsxs("div",{children:[g.jsx("div",{style:{color:"var(--text-primary)",fontSize:"22px",fontWeight:700,marginBottom:"8px"},children:"Build or improve a project"}),g.jsx("div",{style:{color:"var(--text-secondary)",fontSize:"16px",lineHeight:1.6},children:"Create new features, fix bugs, and get guided checklists to ship with confidence."})]})]})}),g.jsx("button",{onClick:()=>S("document"),className:"group transition-all duration-300 hover:-translate-y-1 active:scale-[0.98]",style:{width:"100%",padding:"40px",background:"var(--bg-secondary)",borderRadius:"24px",textAlign:"left",border:"1px solid var(--border)",boxShadow:"0 8px 24px rgba(0,0,0,0.08)",cursor:"pointer"},children:g.jsxs("div",{style:{display:"flex",alignItems:"flex-start",gap:"24px"},children:[g.jsx("div",{style:{width:"64px",height:"64px",borderRadius:"16px",background:"linear-gradient(135deg, #ffdd27, #ffc107)",display:"flex",alignItems:"center",justifyContent:"center",boxShadow:"0 4px 12px rgba(255,221,39,0.3)",flexShrink:0,fontSize:"32px"},children:"📄"}),g.jsxs("div",{children:[g.jsx("div",{style:{color:"var(--text-primary)",fontSize:"22px",fontWeight:700,marginBottom:"8px"},children:"Make your work faster"}),g.jsx("div",{style:{color:"var(--text-secondary)",fontSize:"16px",lineHeight:1.6},children:"Point AI at your documents and get summaries, reports, and analysis — no coding needed."})]})]})})]})]}),i==="project"&&g.jsx(AS,{onProjectSelected:e,mode:p})]}),i==="brain"&&g.jsx("div",{style:{position:"absolute",inset:0,display:"flex",alignItems:"center",justifyContent:"center",padding:"32px",overflowY:"auto"},children:g.jsx("div",{style:{width:"100%",maxWidth:"800px"},children:g.jsx(Mm,{onDone:()=>n("mode")})})})]})]})}function PS(){const{path:e,gitBranch:i,terminalConnected:n,clearProject:l,mode:o,setMode:h}=Et(),d=o==="document",_=p=>({padding:"10px 20px",borderRadius:"10px",fontSize:"14px",fontWeight:500,border:"none",cursor:"pointer",transition:"all 0.2s",background:p?"white":"transparent",color:p?o==="document"?"#5856d6":"#1d1d1f":"#86868b",boxShadow:p?"0 1px 3px rgba(0,0,0,0.1)":"none"});return g.jsxs("div",{style:{height:"56px",display:"flex",alignItems:"center",justifyContent:"space-between",padding:"0 24px",borderBottom:"1px solid #e5e7eb",background:"rgba(255,255,255,0.9)",backdropFilter:"blur(20px)",flexShrink:0,transition:"background 0.2s, border-color 0.2s"},children:[g.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"16px"},children:[d?g.jsx("div",{style:{width:"32px",height:"32px",borderRadius:"10px",background:"linear-gradient(135deg, #5856d6, #af52de)",display:"flex",alignItems:"center",justifyContent:"center",color:"white",fontSize:"15px",fontWeight:700},children:"C"}):g.jsx("div",{style:{width:"12px",height:"12px",borderRadius:"50%",background:"#30d158",boxShadow:"0 0 10px rgba(48,209,88,0.4)"}}),g.jsx("span",{style:{fontFamily:"'SF Mono', Menlo, monospace",fontSize:"13px",color:"#86868b",maxWidth:"200px",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:e?.split("/").filter(Boolean).pop()||e})]}),g.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"20px"},children:[g.jsxs("div",{style:{display:"flex",borderRadius:"12px",padding:"3px",gap:"2px",background:d?"rgba(0,0,0,0.04)":"rgba(255,255,255,0.06)"},children:[g.jsx("button",{onClick:()=>h("developer"),style:_(o==="developer"),children:"🔨 Build"}),g.jsx("button",{onClick:()=>h("document"),style:_(o==="document"),children:"📄 Documents"})]}),i&&g.jsx("span",{style:{fontSize:"12px",fontFamily:"'SF Mono', Menlo, monospace",color:"#86868b"},children:i}),g.jsx("div",{style:{width:"10px",height:"10px",borderRadius:"50%",background:n?"#30d158":"#ff453a",boxShadow:n?"0 0 6px rgba(48,209,88,0.4)":"none"}}),g.jsx("button",{onClick:l,style:{padding:"8px 16px",borderRadius:"8px",fontSize:"14px",fontWeight:500,border:"none",cursor:"pointer",color:"#86868b",background:"transparent",transition:"all 0.2s"},className:d?"hover:bg-black/[0.04]":"hover:bg-white/[0.06]",children:"Switch"})]})]})}function IS(){const{serverConnected:e}=Et();return e?null:g.jsxs("div",{className:"px-4 py-2 bg-red-500/10 border-b border-red-500/20 text-red-400 text-sm text-center shrink-0",children:["Server connection lost. Restart with ",g.jsx("code",{className:"mx-1 font-mono",children:"npm run dev"})]})}function YS({open:e,onToggle:i}){const{mode:n}=Et(),l=n==="document";return g.jsx("div",{style:{width:"52px",display:"flex",flexDirection:"column",alignItems:"center",paddingTop:"20px",borderRight:"1px solid #e5e7eb",background:"#fafafa",flexShrink:0,transition:"background 0.2s"},children:g.jsx("button",{onClick:i,title:"Toggle sidebar",style:{width:"36px",height:"36px",borderRadius:"10px",display:"flex",alignItems:"center",justifyContent:"center",border:"none",cursor:"pointer",transition:"all 0.2s",background:e?l?"rgba(88,86,214,0.1)":"rgba(48,209,88,0.1)":"transparent",color:e?l?"#5856d6":"#30d158":"#86868b"},className:"active:scale-90",children:g.jsx("svg",{width:"18",height:"18",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",children:g.jsx("path",{d:"M2 4h12M2 8h12M2 12h12"})})})})}const $S={business:{emoji:"🏢",label:"Business"},industry:{emoji:"📊",label:"Industry"},voice:{emoji:"🎙️",label:"Voice"},competitors:{emoji:"🎯",label:"Competitors"}};function zm(){const{setEditingBrain:e}=Et(),[i,n]=z.useState(null),[l,o]=z.useState(!0),[h,d]=z.useState(!1);return z.useEffect(()=>{fetch("/api/brain-status").then(_=>_.json()).then(_=>{n(_),o(!1)}).catch(()=>o(!1))},[]),l?null:g.jsxs("div",{style:{borderBottom:"1px solid #e5e7eb"},children:[g.jsxs("button",{onClick:()=>d(!h),style:{width:"100%",padding:"16px 20px",display:"flex",alignItems:"center",justifyContent:"space-between",background:"none",border:"none",cursor:"pointer"},children:[g.jsxs("span",{style:{fontWeight:600,fontSize:"14px",color:"#374151",display:"flex",alignItems:"center",gap:"6px"},children:[g.jsx("span",{style:{fontSize:"10px",color:"#9ca3af",transform:h?"rotate(0deg)":"rotate(90deg)",transition:"transform 0.15s",display:"inline-block"},children:"▶"}),"🧠"," ",i?.businessName||"Business Brain"]}),i?.exists?g.jsxs("span",{style:{background:i.completeness>=70?"#dcfce7":"#f3e8ff",color:i.completeness>=70?"#16a34a":"#7c3aed",fontSize:"12px",padding:"3px 10px",borderRadius:"12px",fontWeight:600},children:[i.completeness,"%"]}):g.jsx("span",{style:{background:"#f3f4f6",color:"#9ca3af",fontSize:"12px",padding:"3px 10px",borderRadius:"12px",fontWeight:600},children:"Not set up"})]}),!h&&i?.exists&&i.categories&&g.jsxs("div",{style:{padding:"0 20px 16px"},children:[Object.entries(i.categories).map(([_,p])=>{const f=$S[_];return f?g.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px",marginBottom:"8px"},children:[g.jsxs("span",{style:{fontSize:"12px",width:"90px",display:"flex",alignItems:"center",gap:"4px"},children:[g.jsx("span",{children:f.emoji}),g.jsx("span",{style:{fontWeight:500,color:"#374151"},children:f.label})]}),g.jsx("div",{style:{flex:1,background:"#e5e7eb",height:"6px",borderRadius:"3px",overflow:"hidden"},children:g.jsx("div",{style:{background:p.percent>=70?"#16a34a":"#5e17eb",height:"6px",borderRadius:"3px",width:`${p.percent}%`,transition:"width 0.5s"}})}),g.jsxs("span",{style:{fontSize:"11px",color:"#9ca3af",width:"30px",textAlign:"right"},children:[p.percent,"%"]})]},_):null}),g.jsxs("button",{onClick:()=>e(!0),style:{marginTop:"4px",padding:"6px 14px",borderRadius:"8px",border:"1px solid rgba(94,23,235,0.2)",background:"rgba(94,23,235,0.04)",color:"#5e17eb",fontSize:"12px",fontWeight:600,cursor:"pointer",width:"100%"},children:["Edit Brain ","→"]})]}),!h&&!i?.exists&&g.jsxs("div",{style:{padding:"0 20px 16px"},children:[g.jsx("p",{style:{fontSize:"12px",color:"#9ca3af",marginBottom:"8px"},children:"Set up your Business Brain to give AI your business context automatically."}),g.jsxs("button",{onClick:()=>e(!0),style:{padding:"6px 14px",borderRadius:"8px",border:"1px solid rgba(94,23,235,0.2)",background:"rgba(94,23,235,0.04)",color:"#5e17eb",fontSize:"12px",fontWeight:600,cursor:"pointer",width:"100%"},children:["Set up Brain ","→"]})]})]})}function KS(e){const{path:i,setServerConnected:n}=Et(),l=z.useRef(e);l.current=e;const o=z.useRef(new Map),h=z.useCallback((d,_)=>{const p=o.current.get(d);p&&clearTimeout(p),o.current.set(d,setTimeout(()=>{l.current(d,_),o.current.delete(d)},400))},[]);z.useEffect(()=>{if(!i)return;const d=`/api/events?projectPath=${encodeURIComponent(i)}`,_=new EventSource(d);return _.addEventListener("health-changed",p=>h("health-changed",JSON.parse(p.data))),_.addEventListener("plan-changed",p=>h("plan-changed",JSON.parse(p.data))),_.addEventListener("push-detected",p=>h("push-detected",JSON.parse(p.data))),_.onopen=()=>n(!0),_.onerror=()=>n(!1),()=>{_.close();for(const p of o.current.values())clearTimeout(p);o.current.clear()}},[i,h,n])}function FS(){const{path:e}=Et(),[i,n]=z.useState([]),[l,o]=z.useState(!1),h=z.useCallback(async()=>{if(!e)return;o(!0);const d=await _i(Rm("/api/health-scan",e));d&&n(d.checks),o(!1)},[e]);return z.useEffect(()=>{h()},[h]),KS(d=>{d==="health-changed"&&h()}),{checks:i,loading:l,failCount:i.filter(d=>d.status==="fail").length,passCount:i.filter(d=>d.status==="pass").length,rescan:h}}function GS({label:e,description:i,status:n,fixPrompt:l}){const{sendPrompt:o}=en(),[h,d]=z.useState(!1);if(n==="pass")return null;const _=()=>{!l||h||(o(l),d(!0),setTimeout(()=>d(!1),3e3))};return g.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"12px",padding:"10px 16px",borderRadius:"8px",transition:"background 0.15s"},children:[g.jsx("div",{style:{width:"8px",height:"8px",borderRadius:"50%",background:"#f59e0b",flexShrink:0}}),g.jsxs("div",{style:{flex:1},children:[g.jsxs("div",{style:{fontSize:"13px",color:"#374151"},children:[e," missing"]}),i&&g.jsx("div",{style:{fontSize:"11px",color:"#9ca3af",marginTop:"1px"},children:i})]}),l&&g.jsx("button",{onClick:_,style:{padding:"6px 14px",background:"#dcfce7",color:"#16a34a",fontSize:"12px",borderRadius:"8px",fontWeight:600,border:h?"1px solid #86efac":"none",cursor:h?"default":"pointer",flexShrink:0,transition:"all 0.15s"},children:h?"✓ Sent":"Fix →"})]})}function XS(){const{checks:e,loading:i,failCount:n,passCount:l}=FS(),[o,h]=z.useState(!1);return g.jsxs("div",{style:{borderBottom:"1px solid #e5e7eb"},children:[g.jsxs("button",{onClick:()=>h(!o),style:{width:"100%",padding:"16px 20px",display:"flex",alignItems:"center",justifyContent:"space-between",background:"none",border:"none",cursor:"pointer",transition:"background 0.15s"},children:[g.jsxs("span",{style:{fontWeight:600,fontSize:"14px",color:"#374151",display:"flex",alignItems:"center",gap:"6px"},children:[g.jsx("span",{style:{fontSize:"10px",color:"#9ca3af",transform:o?"rotate(0deg)":"rotate(90deg)",transition:"transform 0.15s",display:"inline-block"},children:"▶"}),"Project Health"]}),i?g.jsx("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:g.jsx("span",{style:{fontSize:"12px",color:"#9ca3af"},children:"scanning..."})}):n>0?g.jsxs("span",{style:{background:"#fef3c7",color:"#d97706",fontSize:"12px",padding:"3px 10px",borderRadius:"12px",fontWeight:600},children:[n," issue",n!==1?"s":""]}):g.jsx("span",{style:{background:"#dcfce7",color:"#16a34a",fontSize:"12px",padding:"3px 10px",borderRadius:"12px",fontWeight:600},children:"all good"})]}),!o&&g.jsxs("div",{style:{padding:"0 12px 16px",display:"flex",flexDirection:"column",gap:"2px"},children:[e.filter(d=>d.status==="fail").map(d=>g.jsx(GS,{label:d.label,description:d.description,status:d.status,fixPrompt:d.fixPrompt},d.id)),l>0&&g.jsxs("p",{style:{fontSize:"12px",color:"#9ca3af",paddingTop:"8px",paddingLeft:"16px"},children:[l," checks passing"]})]})]})}function VS(){const[e,i]=z.useState([]),[n,l]=z.useState(!0),[o,h]=z.useState(!1);z.useEffect(()=>{fetch("/api/cli-status").then(p=>p.json()).then(p=>{i(p.clis||[]),l(!1)}).catch(()=>l(!1))},[]);const d=e.filter(p=>p.connected).length,_=e.filter(p=>!p.connected).length;return g.jsxs("div",{style:{borderBottom:"1px solid #e5e7eb"},children:[g.jsxs("button",{onClick:()=>h(!o),style:{width:"100%",padding:"16px 20px",display:"flex",alignItems:"center",justifyContent:"space-between",background:"none",border:"none",cursor:"pointer",transition:"background 0.15s"},children:[g.jsxs("span",{style:{fontWeight:600,fontSize:"14px",color:"#374151",display:"flex",alignItems:"center",gap:"6px"},children:[g.jsx("span",{style:{fontSize:"10px",color:"#9ca3af",transform:o?"rotate(0deg)":"rotate(90deg)",transition:"transform 0.15s",display:"inline-block"},children:"▶"}),"CLI Connections"]}),n?g.jsx("span",{style:{fontSize:"12px",color:"#9ca3af"},children:"checking..."}):_>0?g.jsxs("span",{style:{background:"#fef3c7",color:"#d97706",fontSize:"12px",padding:"3px 10px",borderRadius:"12px",fontWeight:600},children:[_," disconnected"]}):g.jsx("span",{style:{background:"#dcfce7",color:"#16a34a",fontSize:"12px",padding:"3px 10px",borderRadius:"12px",fontWeight:600},children:"all connected"})]}),!o&&!n&&g.jsxs("div",{style:{padding:"0 12px 16px",display:"flex",flexDirection:"column",gap:"4px"},children:[e.map(p=>g.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"10px",padding:"8px 12px",borderRadius:"8px",background:p.connected?"rgba(22, 163, 74, 0.04)":"rgba(217, 119, 6, 0.04)"},children:[g.jsx("span",{style:{width:"8px",height:"8px",borderRadius:"50%",background:p.connected?"#16a34a":"#d97706",flexShrink:0}}),g.jsxs("div",{style:{flex:1,minWidth:0},children:[g.jsx("div",{style:{fontSize:"13px",fontWeight:600,color:"#374151"},children:p.label}),g.jsx("div",{style:{fontSize:"11px",color:p.connected?"#6b7280":"#d97706",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:p.detail})]})]},p.id)),d>0&&_===0&&g.jsx("p",{style:{fontSize:"12px",color:"#9ca3af",paddingTop:"4px",paddingLeft:"12px"},children:"All CLIs authenticated and ready"})]})]})}function ZS(){const{sendPrompt:e}=en(),[i,n]=z.useState(!1),[l,o]=z.useState(""),[h,d]=z.useState(""),[_,p]=z.useState(!1),f=l.trim().length>0,S=()=>{if(!f)return;const C=["I want to add a new feature to my app:","",`**What it does:** ${l.trim()}`];h.trim()&&C.push("",`**What success looks like:** ${h.trim()}`),C.push("","Please:","1. Create an implementation plan with numbered steps and files to create/modify","2. Save the plan as a markdown file in docs/plans/","3. Include a testing checklist at the end with specific items to verify","4. Then start building step 1");const b=C.join(`
|
|
80
80
|
`);if(e(b),h.trim()){const T=h.trim().split(/[.\n]/).map(M=>M.trim()).filter(M=>M.length>10);T.length>0&&window.dispatchEvent(new CustomEvent("claude-portal:test-items",{detail:{items:T,feature:l.trim().slice(0,40)}}))}p(!0),setTimeout(()=>{o(""),d(""),p(!1)},2e3)},y={width:"100%",padding:"8px 12px",border:"1px solid #e5e7eb",borderRadius:"8px",fontSize:"12px",fontFamily:"inherit",resize:"none",outline:"none",color:"#374151",background:"#fff",boxSizing:"border-box"},x={fontSize:"12px",fontWeight:500,color:"#6b7280",marginBottom:"4px"};return g.jsxs("div",{style:{borderBottom:"1px solid #e5e7eb"},children:[g.jsx("button",{onClick:()=>n(!i),style:{width:"100%",padding:"16px 20px",display:"flex",alignItems:"center",justifyContent:"space-between",background:"none",border:"none",cursor:"pointer"},children:g.jsxs("span",{style:{fontWeight:600,fontSize:"14px",color:"#374151",display:"flex",alignItems:"center",gap:"6px"},children:[g.jsx("span",{style:{fontSize:"10px",color:"#9ca3af",transform:i?"rotate(0deg)":"rotate(90deg)",transition:"transform 0.15s",display:"inline-block"},children:"▶"}),"Build a Feature"]})}),!i&&g.jsxs("div",{style:{padding:"0 20px 16px",display:"flex",flexDirection:"column",gap:"12px"},children:[g.jsxs("div",{children:[g.jsx("div",{style:x,children:"What do you want to build?"}),g.jsx("textarea",{value:l,onChange:C=>o(C.target.value),rows:3,placeholder:"e.g. A settings page where users can update their profile, change password, and toggle dark mode",style:y})]}),g.jsxs("div",{children:[g.jsxs("div",{style:x,children:["What does success look like? ",g.jsx("span",{style:{color:"#9ca3af",fontWeight:400},children:"(optional)"})]}),g.jsx("textarea",{value:h,onChange:C=>d(C.target.value),rows:3,placeholder:"e.g. The page has a form with current values pre-filled. Save button shows a success toast. Password change requires current password.",style:y})]}),g.jsx("button",{onClick:S,disabled:!f||_,style:{padding:"10px 16px",borderRadius:"10px",border:"none",background:_?"#dcfce7":f?"#22c55e":"#e5e7eb",color:_?"#16a34a":f?"#fff":"#9ca3af",fontSize:"13px",fontWeight:600,cursor:f&&!_?"pointer":"not-allowed",transition:"all 0.15s",width:"100%"},children:_?"✓ Sent to Claude":"Build with Claude Code →"})]})]})}function Am(e){return`claude-portal-tests-${e}`}function QS(e){try{const i=localStorage.getItem(Am(e));return i?JSON.parse(i):[]}catch{return[]}}function Sg(e,i){localStorage.setItem(Am(e),JSON.stringify(i))}function JS(){const{path:e}=Et(),[i,n]=z.useState(!1),[l,o]=z.useState([]),[h,d]=z.useState(!1),[_,p]=z.useState("");z.useEffect(()=>{e&&o(QS(e))},[e]),z.useEffect(()=>{const b=T=>{const{items:M,feature:A}=T.detail;if(!M?.length||!e)return;const O=M.map((D,L)=>({id:`auto-${Date.now()}-${L}`,label:D,checked:!1}));o(D=>{const L=[...D,...O];return Sg(e,L),L}),n(!1)};return window.addEventListener("claude-portal:test-items",b),()=>window.removeEventListener("claude-portal:test-items",b)},[e]);const f=z.useCallback(b=>{o(T=>{const M=b(T);return e&&Sg(e,M),M})},[e]),S=z.useCallback(b=>{f(T=>T.map(M=>M.id===b?{...M,checked:!M.checked}:M))},[f]),y=z.useCallback(b=>{f(T=>T.filter(M=>M.id!==b))},[f]),x=()=>{const b=_.trim();b&&(f(T=>[...T,{id:Date.now().toString(),label:b,checked:!1}]),p(""),d(!1))},C=l.filter(b=>b.checked).length;return g.jsxs("div",{style:{borderBottom:"1px solid #e5e7eb"},children:[g.jsxs("button",{onClick:()=>n(!i),style:{width:"100%",padding:"16px 20px",display:"flex",alignItems:"center",justifyContent:"space-between",background:"none",border:"none",cursor:"pointer"},children:[g.jsxs("span",{style:{fontWeight:600,fontSize:"14px",color:"#374151",display:"flex",alignItems:"center",gap:"6px"},children:[g.jsx("span",{style:{fontSize:"10px",color:"#9ca3af",transform:i?"rotate(0deg)":"rotate(90deg)",transition:"transform 0.15s",display:"inline-block"},children:"▶"}),"Feature Testing"]}),l.length>0&&g.jsxs("span",{style:{background:C===l.length?"#dcfce7":"#f3f4f6",color:C===l.length?"#16a34a":"#6b7280",fontSize:"12px",padding:"3px 10px",borderRadius:"12px",fontWeight:600},children:[C,"/",l.length," tested"]})]}),!i&&g.jsxs("div",{style:{padding:"0 20px 16px",display:"flex",flexDirection:"column",gap:"6px"},children:[l.length===0&&!h&&g.jsx("p",{style:{fontSize:"12px",color:"#9ca3af",lineHeight:"1.5",margin:0},children:"Test items will appear here when Claude creates a plan with a testing section."}),l.map(b=>g.jsxs("div",{style:{display:"flex",alignItems:"flex-start",gap:"8px",padding:"6px 0",fontSize:"12px",color:"#374151"},children:[g.jsx("input",{type:"checkbox",checked:b.checked,onChange:()=>S(b.id),style:{marginTop:"2px",accentColor:"#22c55e",cursor:"pointer"}}),g.jsx("span",{onClick:()=>S(b.id),style:{flex:1,cursor:"pointer",textDecoration:b.checked?"line-through":"none",color:b.checked?"#9ca3af":"#374151"},children:b.label}),g.jsx("button",{onClick:()=>y(b.id),"aria-label":`Remove ${b.label}`,style:{background:"none",border:"none",color:"#d1d5db",cursor:"pointer",fontSize:"11px",padding:"0 2px",flexShrink:0,transition:"color 0.15s"},onMouseEnter:T=>T.currentTarget.style.color="#ef4444",onMouseLeave:T=>T.currentTarget.style.color="#d1d5db",children:"✕"})]},b.id)),h?g.jsxs("div",{style:{display:"flex",gap:"6px",marginTop:"4px"},children:[g.jsx("input",{autoFocus:!0,value:_,onChange:b=>p(b.target.value),onKeyDown:b=>{b.key==="Enter"&&x(),b.key==="Escape"&&(d(!1),p(""))},placeholder:"Describe the test...",style:{flex:1,padding:"6px 10px",border:"1px solid #e5e7eb",borderRadius:"6px",fontSize:"12px",outline:"none",color:"#374151"}}),g.jsx("button",{onClick:x,style:{padding:"6px 12px",background:"#22c55e",color:"#fff",border:"none",borderRadius:"6px",fontSize:"12px",fontWeight:600,cursor:"pointer"},children:"Add"})]}):g.jsx("button",{onClick:()=>d(!0),style:{padding:"6px 0",background:"none",border:"none",color:"#22c55e",fontSize:"12px",fontWeight:500,cursor:"pointer",textAlign:"left",marginTop:"4px"},children:"+ Add test item"})]})]})}const Qn=[{id:"bugs",label:"Check for bugs",prompt:"Review all files changed since the last commit for bugs, logic errors, and edge cases. Report what you find."},{id:"diff",label:"Review diff",prompt:"Show me a summary of all changes since the last push — what was added, modified, and removed."},{id:"tests",label:"Run tests",prompt:"Run the test suite and report results. If any tests fail, explain why."},{id:"console",label:"Check console.logs",prompt:"Find any console.log, console.warn, or console.error statements in the changed files that should be removed before pushing."},{id:"build",label:"Build succeeds",prompt:"Run the build command and report if it succeeds. If it fails, explain the errors."},{id:"security",label:"Security check",prompt:"Check the changed files for security issues: hardcoded secrets, SQL injection, XSS vulnerabilities, or exposed API keys."}];function Om(e){return`claude-portal-prepush-${e}`}function eb(e){try{const i=localStorage.getItem(Om(e));return i?JSON.parse(i):{}}catch{return{}}}function tb(e,i){localStorage.setItem(Om(e),JSON.stringify(i))}function ib(){const{path:e}=Et(),{sendPrompt:i}=en(),[n,l]=z.useState(!1),[o,h]=z.useState({});z.useEffect(()=>{e&&h(eb(e))},[e]);const d=z.useCallback(p=>{h(f=>{const S={...f,[p]:!f[p]};return e&&tb(e,S),S})},[e]),_=Qn.filter(p=>o[p.id]).length;return g.jsxs("div",{style:{borderBottom:"1px solid #e5e7eb"},children:[g.jsxs("button",{onClick:()=>l(!n),style:{width:"100%",padding:"16px 20px",display:"flex",alignItems:"center",justifyContent:"space-between",background:"none",border:"none",cursor:"pointer"},children:[g.jsxs("span",{style:{fontWeight:600,fontSize:"14px",color:"#374151",display:"flex",alignItems:"center",gap:"6px"},children:[g.jsx("span",{style:{fontSize:"10px",color:"#9ca3af",transform:n?"rotate(0deg)":"rotate(90deg)",transition:"transform 0.15s",display:"inline-block"},children:"▶"}),"Pre-Push"]}),g.jsxs("span",{style:{background:_===Qn.length?"#dcfce7":"#f3f4f6",color:_===Qn.length?"#16a34a":"#6b7280",fontSize:"12px",padding:"3px 10px",borderRadius:"12px",fontWeight:600},children:[_,"/",Qn.length]})]}),!n&&g.jsx("div",{style:{padding:"0 20px 16px",display:"flex",flexDirection:"column",gap:"4px"},children:Qn.map(p=>g.jsx(sb,{label:p.label,prompt:p.prompt,isChecked:!!o[p.id],onToggle:()=>d(p.id),onRun:()=>i(p.prompt)},p.id))})]})}function sb({label:e,prompt:i,isChecked:n,onToggle:l,onRun:o}){const[h,d]=z.useState(!1),_=()=>{h||(o(),d(!0),setTimeout(()=>d(!1),3e3))};return g.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"10px",padding:"8px 0"},children:[g.jsx("input",{type:"checkbox",checked:n,onChange:l,style:{accentColor:"#22c55e",flexShrink:0}}),g.jsx("span",{style:{flex:1,fontSize:"12px",color:n?"#9ca3af":"#374151",textDecoration:n?"line-through":"none"},children:e}),g.jsx("button",{onClick:_,style:{padding:"4px 10px",background:"#dcfce7",color:"#16a34a",fontSize:"11px",borderRadius:"6px",fontWeight:600,border:h?"1px solid #86efac":"none",cursor:h?"default":"pointer",flexShrink:0,transition:"all 0.15s"},children:h?"✓ Sent":"Run →"})]})}const tu="claude-portal-future-builds";function rb(e){try{return JSON.parse(localStorage.getItem(tu)||"{}")[e]||[]}catch{return[]}}function nb(e,i){try{const n=JSON.parse(localStorage.getItem(tu)||"{}");n[e]=i,localStorage.setItem(tu,JSON.stringify(n))}catch{}}function lb(){const{path:e}=Et(),[i,n]=z.useState([]),[l,o]=z.useState(!1),[h,d]=z.useState(""),[_,p]=z.useState(null),[f,S]=z.useState("");z.useEffect(()=>{e&&n(rb(e))},[e]);const y=D=>{n(D),e&&nb(e,D)},x=()=>{const D=h.trim();if(!D)return;const L={id:Date.now().toString(),text:D,done:!1,createdAt:Date.now()};y([...i,L]),d("")},C=D=>{y(i.map(L=>L.id===D?{...L,done:!L.done}:L))},b=D=>{y(i.filter(L=>L.id!==D))},T=D=>{p(D.id),S(D.text)},M=D=>{const L=f.trim();L&&(y(i.map(H=>H.id===D?{...H,text:L}:H)),p(null))},A=i.filter(D=>D.done).length,O=i.length;return g.jsxs("div",{style:{borderBottom:"1px solid #e5e7eb"},children:[g.jsxs("button",{onClick:()=>o(!l),style:{width:"100%",padding:"16px 20px",display:"flex",alignItems:"center",justifyContent:"space-between",background:"none",border:"none",cursor:"pointer"},children:[g.jsxs("span",{style:{fontWeight:600,fontSize:"14px",color:"#374151",display:"flex",alignItems:"center",gap:"6px"},children:[g.jsx("span",{style:{fontSize:"10px",color:"#9ca3af",transform:l?"rotate(0deg)":"rotate(90deg)",transition:"transform 0.15s",display:"inline-block"},children:"▶"}),"Future Builds"]}),O>0&&g.jsxs("span",{style:{background:A===O?"#dcfce7":"#f3f4f6",color:A===O?"#16a34a":"#6b7280",fontSize:"12px",padding:"3px 10px",borderRadius:"12px",fontWeight:600},children:[A,"/",O]})]}),!l&&g.jsxs("div",{style:{padding:"0 12px 16px",display:"flex",flexDirection:"column",gap:"4px"},children:[g.jsxs("div",{style:{display:"flex",gap:"6px",marginBottom:"8px"},children:[g.jsx("input",{value:h,onChange:D=>d(D.target.value),onKeyDown:D=>D.key==="Enter"&&x(),placeholder:"Add a feature or idea...",style:{flex:1,padding:"8px 12px",fontSize:"13px",border:"1px solid #e5e7eb",borderRadius:"8px",outline:"none",color:"#374151",background:"#fafafa"}}),g.jsx("button",{onClick:x,style:{padding:"8px 14px",background:"#5e17eb",color:"#fff",fontSize:"13px",fontWeight:600,borderRadius:"8px",border:"none",cursor:"pointer",whiteSpace:"nowrap"},children:"+"})]}),i.map(D=>g.jsxs("div",{style:{display:"flex",alignItems:"flex-start",gap:"8px",padding:"8px 10px",borderRadius:"8px",background:D.done?"rgba(22,163,74,0.04)":"#fafafa",transition:"background 0.15s"},children:[g.jsx("input",{type:"checkbox",checked:D.done,onChange:()=>C(D.id),style:{marginTop:"3px",cursor:"pointer",accentColor:"#5e17eb"}}),_===D.id?g.jsx("input",{value:f,onChange:L=>S(L.target.value),onKeyDown:L=>{L.key==="Enter"&&M(D.id),L.key==="Escape"&&p(null)},onBlur:()=>M(D.id),autoFocus:!0,style:{flex:1,padding:"2px 6px",fontSize:"13px",border:"1px solid #d1d5db",borderRadius:"4px",outline:"none"}}):g.jsx("span",{onDoubleClick:()=>T(D),style:{flex:1,fontSize:"13px",color:D.done?"#9ca3af":"#374151",textDecoration:D.done?"line-through":"none",cursor:"default",lineHeight:1.4},children:D.text}),g.jsx("button",{onClick:()=>b(D.id),style:{background:"none",border:"none",cursor:"pointer",color:"#d1d5db",fontSize:"14px",padding:"0 2px",lineHeight:1,transition:"color 0.15s"},onMouseEnter:L=>L.currentTarget.style.color="#ef4444",onMouseLeave:L=>L.currentTarget.style.color="#d1d5db",children:"×"})]},D.id)),i.length===0&&g.jsx("p",{style:{fontSize:"12px",color:"#9ca3af",textAlign:"center",padding:"12px"},children:"Track features, ideas, and things to build next"})]})]})}function ab(){const{path:e,setProjectPath:i}=Et(),n=e?e.split("/").filter(Boolean).pop():"Project",l=async()=>{const o=await _i("/api/pick-folder");o?.path&&i(o.path)};return g.jsxs("div",{style:{display:"flex",flexDirection:"column",height:"100%",background:"#fff"},children:[g.jsxs("div",{style:{padding:"20px 24px 16px",borderBottom:"1px solid #e5e7eb"},children:[g.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:"6px"},children:[g.jsx("div",{style:{fontSize:"11px",textTransform:"uppercase",letterSpacing:"0.05em",color:"#9ca3af"},children:"Project"}),g.jsx("button",{onClick:l,style:{padding:"4px 10px",borderRadius:"6px",border:"1px solid #e5e7eb",background:"#fff",color:"#6b7280",fontSize:"11px",fontWeight:500,cursor:"pointer",transition:"all 0.15s"},children:"Change"})]}),g.jsx("div",{style:{fontSize:"14px",fontWeight:600,color:"#1a2233",wordBreak:"break-all"},children:n}),e&&g.jsx("div",{style:{fontSize:"11px",color:"#9ca3af",marginTop:"2px",wordBreak:"break-all"},children:e})]}),g.jsxs("div",{style:{flex:1,overflowY:"auto"},children:[g.jsx(zm,{}),g.jsx(XS,{}),g.jsx(VS,{}),g.jsx(ZS,{}),g.jsx(JS,{}),g.jsx(ib,{}),g.jsx(lb,{})]})]})}const ob={pdf:"text-red-500",docx:"text-blue-500",doc:"text-blue-500",xlsx:"text-green-500",xls:"text-green-500",csv:"text-green-600",txt:"text-gray-400",md:"text-gray-400",json:"text-yellow-500",html:"text-orange-500",pptx:"text-pink-500"};function cb(e){const i=e.split(".").pop()?.toLowerCase()||"";return ob[i]||"text-gray-400"}function hb(e){return Object.entries(e).sort((i,n)=>n[1]-i[1]).map(([i,n])=>`${n} ${i}`).join(", ")}function ub(){const{folderPath:e,folderScan:i,scanLoading:n,scanFolder:l,clearFolder:o}=ji(),[h,d]=z.useState(""),[_,p]=z.useState(!1),[f,S]=z.useState(!1),[y,x]=z.useState(!1);async function C(){S(!0);const L=await _i("/api/pick-folder");S(!1),L?.path&&l(L.path)}function b(){const L=h.trim();L&&l(L)}function T(L){L.key==="Enter"&&b()}const M=i?.files||[],A=i?.summary.total||0,O=i?.summary.byType||{},D=M.slice(0,20);return g.jsxs("div",{style:{padding:"16px 20px",display:"flex",flexDirection:"column",gap:"10px",borderBottom:"1px solid var(--border)"},children:[g.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[g.jsx("div",{style:{width:"24px",height:"24px",borderRadius:"8px",background:"linear-gradient(135deg, #5e17eb, #8b5cf6)",display:"flex",alignItems:"center",justifyContent:"center",color:"white",fontSize:"11px",fontWeight:700,flexShrink:0},children:"1"}),g.jsx("h3",{style:{fontSize:"13px",fontWeight:700,color:"var(--text-primary)"},children:"Choose folder"})]}),e?g.jsxs("div",{className:"rounded-lg border",style:{background:"var(--bg-secondary)",borderColor:"var(--border)",padding:"10px 12px"},children:[g.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[g.jsx("span",{style:{fontSize:"14px",flexShrink:0},children:"📁"}),g.jsx("span",{style:{fontSize:"13px",fontWeight:600,color:"var(--text-primary)",flex:1,minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:e?.split("/").filter(Boolean).pop()||e}),g.jsxs("span",{style:{fontSize:"11px",padding:"2px 8px",borderRadius:"100px",background:"#eef2ff",color:"#6366f1",fontWeight:600,flexShrink:0,whiteSpace:"nowrap"},children:[A," files"]}),g.jsx("button",{onClick:o,style:{fontSize:"11px",padding:"2px 8px",borderRadius:"100px",border:"1px solid var(--border)",background:"transparent",color:"var(--text-secondary)",cursor:"pointer",flexShrink:0,whiteSpace:"nowrap"},children:"Change"})]}),Object.keys(O).length>0&&g.jsx("p",{style:{fontSize:"11px",color:"var(--text-secondary)",marginTop:"4px"},children:hb(O)}),A>50&&g.jsxs("p",{className:"text-xs text-amber-500 bg-amber-500/10 rounded px-2 py-1",children:["Large folder — processing may take longer for ",A," files."]}),M.length>0&&g.jsxs("div",{children:[g.jsx("button",{onClick:()=>p(L=>!L),className:"text-xs transition-colors",style:{color:"var(--text-secondary)"},children:_?"▲ Hide files":`▼ Show files (${Math.min(20,M.length)} of ${A})`}),_&&g.jsx("ul",{className:"mt-2 space-y-1 max-h-48 overflow-y-auto",children:D.map((L,H)=>g.jsxs("li",{className:"flex items-center gap-2 text-xs",children:[g.jsx("span",{className:`font-mono font-semibold ${cb(L.name)}`,children:L.name.split(".").pop()?.toLowerCase()}),g.jsx("span",{style:{color:"var(--text-primary)"},children:L.name})]},H))})]})]}):g.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"12px"},children:[g.jsx("button",{onClick:C,disabled:f||n,style:{width:"100%",padding:"16px 20px",borderRadius:"14px",fontSize:"15px",fontWeight:600,background:"linear-gradient(135deg, #5e17eb, #8b5cf6)",color:"white",border:"none",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center",gap:"8px",boxShadow:"0 4px 12px rgba(94,23,235,0.3)",opacity:f||n?.5:1,transition:"all 0.2s"},children:f?g.jsxs(g.Fragment,{children:[g.jsx("div",{className:"w-4 h-4 border-2 border-white/30 border-t-white rounded-full animate-spin"}),"Waiting for selection..."]}):g.jsx(g.Fragment,{children:"📂 Browse for folder"})}),y?g.jsxs("div",{className:"flex gap-2",children:[g.jsx("input",{type:"text",value:h,onChange:L=>d(L.target.value),onKeyDown:T,placeholder:"/path/to/documents",autoFocus:!0,className:"flex-1 px-3 py-2.5 rounded-lg text-sm border outline-none focus:ring-2 focus:ring-indigo-400",style:{background:"var(--bg-secondary)",borderColor:"var(--border)",color:"var(--text-primary)"}}),g.jsx("button",{onClick:b,disabled:!h.trim()||n,className:"px-4 py-2.5 rounded-lg text-sm font-medium bg-indigo-500 text-white hover:bg-indigo-600 disabled:opacity-50 transition-colors",children:n?"...":"Scan"})]}):g.jsx("button",{onClick:()=>x(!0),style:{fontSize:"13px",color:"var(--text-secondary)",background:"none",border:"none",cursor:"pointer",margin:"0 auto",display:"block"},children:"Or enter path manually →"})]})]})}function db(){const{selectedOutcome:e,setSelectedOutcome:i,freeformText:n,setFreeformText:l}=ji();return g.jsxs("div",{children:[g.jsxs("div",{className:"flex items-center gap-2",style:{marginBottom:"12px"},children:[g.jsx("div",{style:{width:"24px",height:"24px",borderRadius:"8px",background:"linear-gradient(135deg, #6366f1, #a855f7)",display:"flex",alignItems:"center",justifyContent:"center",color:"white",fontSize:"11px",fontWeight:700,flexShrink:0},children:"2"}),g.jsx("h3",{style:{fontSize:"13px",fontWeight:700,color:"var(--text-primary)"},children:"Choose outcome"})]}),wS.map(o=>{const h=oo.filter(d=>d.category===o.key);return g.jsxs("div",{style:{marginBottom:"12px"},children:[g.jsxs("div",{style:{fontSize:"11px",fontWeight:600,color:"#9ca3af",marginBottom:"6px",textTransform:"uppercase",letterSpacing:"0.04em"},children:[o.label," ",g.jsxs("span",{style:{fontWeight:400,textTransform:"none",letterSpacing:0},children:["— ",o.description]})]}),g.jsx("div",{className:"grid grid-cols-2",style:{gap:"6px"},children:h.map(d=>{const _=e===d.key;return g.jsxs("button",{onClick:()=>i(_?null:d.key),style:{padding:"8px 10px",borderRadius:"10px",border:_?"2px solid #818cf8":"1.5px solid var(--border)",background:_?"#eef2ff":"var(--bg-secondary, #fff)",cursor:"pointer",boxShadow:_?"0 0 0 3px rgba(99,102,241,0.08)":"none",display:"flex",alignItems:"center",gap:"8px",textAlign:"left",transition:"all 0.15s"},children:[g.jsx("span",{style:{fontSize:"15px",flexShrink:0},children:d.emoji}),g.jsxs("div",{style:{minWidth:0},children:[g.jsx("div",{style:{fontSize:"12px",fontWeight:700,color:_?"#4338ca":"var(--text-primary)"},children:d.name}),g.jsx("div",{style:{fontSize:"10px",color:"var(--text-secondary)",lineHeight:1.2},children:d.description})]})]},d.key)})})]},o.key)}),g.jsxs("div",{style:{marginTop:"8px"},children:[g.jsx("div",{style:{fontSize:"11px",fontWeight:500,color:"var(--text-secondary)",marginBottom:"4px"},children:"Or describe what you need:"}),g.jsx("textarea",{value:n,onChange:o=>l(o.target.value),placeholder:"e.g. Find all contract expiry dates and list them by client",rows:2,className:"w-full rounded-lg border outline-none resize-none",style:{padding:"10px 14px",fontSize:"12px",lineHeight:"1.5",background:"var(--bg-secondary)",borderColor:"var(--border)",color:"var(--text-primary)"}})]})]})}const Lm="claude-portal-style-templates",jm=()=>{try{return JSON.parse(localStorage.getItem(Lm)||"[]")}catch{return[]}},fb=e=>localStorage.setItem(Lm,JSON.stringify(e)),pb=e=>jm().filter(i=>i.outcomeKey===e);function _b(e){const i=jm();i.push(e);const n=new Map;for(const o of i){const h=n.get(o.outcomeKey)||[];h.push(o),n.set(o.outcomeKey,h)}const l=[];for(const o of n.values())l.push(...o.slice(-10));fb(l)}const gb={pdf:"📄",md:"📝",docx:"📘",doc:"📘",txt:"📃"},mb=".md,.txt,.csv,.json,.html",qh=3;function vb(e){return e.split(".").pop()?.toLowerCase()||""}function yb({outcomeKey:e,onContentChange:i}){const[n,l]=z.useState([]),[o,h]=z.useState(null),[d,_]=z.useState(!1),[p,f]=z.useState([]),S=z.useRef(null);z.useEffect(()=>{f(e?pb(e):[]),h(null)},[e]);const y=z.useCallback((D,L)=>{if(L){const H=p.find(X=>X.id===L);if(H){i(H.content);return}}if(D.length>0){const H=D.map(X=>X.content).join(`
|
|
81
81
|
|
|
82
82
|
---
|
|
83
83
|
|
|
84
|
-
`);i(H)}else i(null)},[i,p]),x=z.useRef(!1);z.useEffect(()=>{if(!x.current){x.current=!0;return}y(n,o)},[n,o,y]);const C=z.useCallback(async D=>{const L=Array.from(D),H=[];for(const X of L){const V=X.name.split(".").pop()?.toLowerCase()||"";if(["pdf","docx","doc"].includes(V))continue;const ue=await X.text();H.push({name:X.name,content:ue})}H.length!==0&&(l(X=>{const V=qh-X.length;return V<=0?X:[...X,...H.slice(0,V)]}),h(null))},[]),b=z.useCallback(D=>{D.preventDefault(),_(!1),D.dataTransfer.files.length>0&&C(D.dataTransfer.files)},[C]),T=z.useCallback(D=>{D.target.files&&D.target.files.length>0&&C(D.target.files),D.target.value=""},[C]),M=z.useCallback(D=>{l(L=>L.filter((H,X)=>X!==D))},[]),A=z.useCallback(D=>{h(L=>L===D?null:D),l([])},[]),O=n.length>0||o!==null;return g.jsxs("div",{className:"space-y-3",children:[g.jsxs("div",{className:"flex items-center gap-2",style:{marginBottom:"8px"},children:[g.jsx("div",{className:"flex items-center justify-center text-white text-xs font-bold flex-shrink-0",style:{width:"24px",height:"24px",borderRadius:"8px",background:"linear-gradient(135deg, #6366f1, #a855f7)"},children:"✦"}),g.jsx("h3",{className:"text-sm font-semibold",style:{color:"var(--text-primary)"},children:"Show Claude an example"}),g.jsx("span",{className:"text-xs italic",style:{color:"var(--text-secondary)"},children:"optional"})]}),n.map((D,L)=>{const H=vb(D.name),X=gb[H]||"📄",V=D.content.slice(0,80).replace(/\n/g," "),ue={pdf:"#fef2f2",md:"#f0f9ff",docx:"#eff6ff",doc:"#eff6ff",txt:"#f8fafc"};return g.jsxs("div",{className:"flex items-center gap-2.5 rounded-lg border",style:{padding:"10px 12px",background:"var(--bg-secondary)",borderColor:"var(--border)"},children:[g.jsx("div",{className:"flex items-center justify-center flex-shrink-0",style:{width:"32px",height:"32px",borderRadius:"8px",background:ue[H]||"#f8fafc",fontSize:"16px"},children:X}),g.jsxs("div",{className:"flex-1 min-w-0",children:[g.jsx("div",{className:"text-xs font-semibold truncate",style:{color:"var(--text-primary)"},children:D.name}),g.jsx("div",{className:"text-xs truncate",style:{color:"var(--text-secondary)",fontSize:"10px",marginTop:"1px"},children:V})]}),g.jsx("button",{onClick:()=>M(L),"aria-label":`Remove ${D.name}`,className:"flex items-center justify-center flex-shrink-0 border rounded-md transition-colors hover:bg-red-50 hover:border-red-300 hover:text-red-600",style:{width:"20px",height:"20px",borderColor:"var(--border)",color:"var(--text-secondary)",background:"transparent",cursor:"pointer",fontSize:"10px"},children:"✕"})]},L)}),n.length<qh&&g.jsxs("div",{onDragOver:D=>{D.preventDefault(),_(!0)},onDragLeave:()=>_(!1),onDrop:b,onClick:()=>S.current?.click(),className:"relative text-center cursor-pointer transition-all rounded-xl",style:{border:`2px dashed ${d?"#818cf8":"#c7d2fe"}`,borderRadius:"10px",padding:"12px",background:d?"#eef2ff":"transparent"},children:[g.jsx("input",{ref:S,type:"file",multiple:!0,accept:mb,onChange:T,style:{position:"absolute",inset:0,opacity:0,cursor:"pointer"}}),g.jsx("div",{style:{fontSize:"18px",marginBottom:"4px",opacity:.7},children:"📎"}),g.jsxs("div",{style:{fontSize:"11px",color:"#64748b",fontWeight:500,lineHeight:1.4},children:[g.jsx("strong",{style:{color:"#6366f1"},children:"Drop a document"})," to use as a style reference"]}),g.jsx("div",{style:{fontSize:"10px",color:"#94a3b8",marginTop:"2px"},children:"MD, TXT, CSV, JSON, HTML — up to 3"})]}),n.length>0&&g.jsxs("div",{className:"text-right",style:{fontSize:"10px",color:"#94a3b8"},children:[n.length," of ",qh," examples attached"]}),p.length>0&&g.jsxs(g.Fragment,{children:[g.jsxs("div",{className:"flex items-center gap-2",style:{margin:"12px 0 8px"},children:[g.jsx("div",{className:"flex-1",style:{height:"1px",background:"var(--border)"}}),g.jsx("span",{style:{fontSize:"10px",color:"#94a3b8",fontWeight:600,textTransform:"uppercase",letterSpacing:"0.5px",whiteSpace:"nowrap"},children:"or use a saved style"}),g.jsx("div",{className:"flex-1",style:{height:"1px",background:"var(--border)"}})]}),g.jsx("div",{className:"flex flex-wrap gap-1.5",children:p.map(D=>{const L=o===D.id;return g.jsxs("button",{onClick:()=>A(D.id),className:"inline-flex items-center gap-1 rounded-lg text-xs transition-colors",style:{padding:"5px 10px",border:`1px solid ${L?"#818cf8":"var(--border)"}`,background:L?"#eef2ff":"transparent",color:L?"#4338ca":"var(--text-secondary)",cursor:"pointer",fontWeight:500},children:[g.jsx("span",{style:{fontSize:"12px"},children:"⭐"})," ",D.name]},D.id)})})]}),O&&g.jsx("div",{className:"rounded-lg",style:{fontSize:"10px",color:"#6366f1",background:"#eef2ff",border:"1px solid #e0e7ff",borderRadius:"8px",padding:"6px 10px"},children:"✨ Claude will match the tone, structure, and formatting of your example"})]})}function Sb(){const{contextText:e,setContextText:i,canRun:n,run:l,selectedOutcome:o,folderScan:h,isRunning:d}=ji(),_=o?oo.find(f=>f.key===o)?.name||o:"Custom",p=h?.summary.total||0;return g.jsxs("div",{className:"space-y-2",children:[g.jsxs("div",{className:"flex items-center gap-2",style:{marginBottom:"8px"},children:[g.jsx("div",{className:"flex-shrink-0",style:{width:"24px",height:"24px",borderRadius:"8px",background:"linear-gradient(135deg, #5e17eb, #8b5cf6)",display:"flex",alignItems:"center",justifyContent:"center",color:"white",fontSize:"11px",fontWeight:700},children:"3"}),g.jsx("h3",{style:{fontSize:"13px",fontWeight:700,color:"var(--text-primary)"},children:"Additional context"})]}),g.jsx("textarea",{value:e,onChange:f=>i(f.target.value),placeholder:"Any extra instructions, e.g. focus on Q4, ignore drafts, output in French…",rows:2,className:"w-full rounded-lg border outline-none focus:ring-2 focus:ring-indigo-400 resize-none",style:{padding:"10px 14px",fontSize:"12px",lineHeight:"1.5",background:"var(--bg-secondary)",borderColor:"var(--border)",color:"var(--text-primary)"}}),g.jsxs("div",{className:"space-y-1.5",children:[g.jsx("button",{onClick:l,disabled:!n,className:"w-full rounded-lg text-sm font-semibold text-white shadow-lg disabled:opacity-40 disabled:cursor-not-allowed transition-all",style:{padding:"12px 16px",background:"linear-gradient(135deg, #7c3aed, #a855f7)"},children:d?"⏳ Working...":`✨ Go — ${_} ${p} documents`}),g.jsx("p",{className:"text-xs text-center",style:{color:"var(--text-secondary)"},children:"Claude will scan your files and create the output"})]})]})}function bb(){const{selectedOutcome:e}=ji(),[i,n]=z.useState([]),[l,o]=z.useState(!0),[h,d]=z.useState(!0);z.useEffect(()=>{const y=e?`/api/mcp-status?outcome=${e}`:"/api/mcp-status";fetch(y).then(x=>x.json()).then(x=>{n(x.mcps||[]),o(!1)}).catch(()=>o(!1))},[e]);const _=i.filter(y=>y.relevant),p=_.filter(y=>y.installed).length,f=_.length,S={};for(const y of _)S[y.category]||(S[y.category]=[]),S[y.category].push(y);return g.jsxs("div",{style:{padding:"16px 20px",borderBottom:"1px solid var(--border)"},children:[g.jsxs("button",{onClick:()=>d(!h),style:{width:"100%",display:"flex",alignItems:"center",justifyContent:"space-between",background:"none",border:"none",cursor:"pointer",padding:0},children:[g.jsxs("span",{style:{fontWeight:600,fontSize:"13px",color:"var(--text-primary)",display:"flex",alignItems:"center",gap:"6px"},children:[g.jsx("span",{style:{fontSize:"10px",color:"#9ca3af",transform:h?"rotate(0deg)":"rotate(90deg)",transition:"transform 0.15s",display:"inline-block"},children:"▶"}),"Superpowers (MCPs)"]}),l?g.jsx("span",{style:{fontSize:"11px",color:"#9ca3af"},children:"checking..."}):g.jsxs("span",{style:{background:p===f?"rgba(22,163,74,0.1)":"rgba(139,92,246,0.1)",color:p===f?"#16a34a":"#8b5cf6",fontSize:"11px",padding:"2px 8px",borderRadius:"10px",fontWeight:600},children:[p,"/",f," active"]})]}),!h&&!l&&g.jsxs("div",{style:{marginTop:"12px",display:"flex",flexDirection:"column",gap:"12px"},children:[Object.entries(S).map(([y,x])=>g.jsxs("div",{children:[g.jsx("div",{style:{fontSize:"10px",fontWeight:700,textTransform:"uppercase",letterSpacing:"0.05em",color:"#9ca3af",marginBottom:"6px"},children:x[0].categoryLabel}),g.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"4px"},children:x.map(C=>g.jsxs("div",{style:{display:"flex",alignItems:"flex-start",gap:"10px",padding:"8px 10px",borderRadius:"8px",background:C.installed?"rgba(22, 163, 74, 0.04)":"rgba(0, 0, 0, 0.02)"},children:[g.jsx("span",{style:{width:"8px",height:"8px",borderRadius:"50%",marginTop:"4px",background:C.installed?"#16a34a":"#d4d4d8",flexShrink:0}}),g.jsxs("div",{style:{flex:1,minWidth:0},children:[g.jsx("div",{style:{fontSize:"12px",fontWeight:600,color:C.installed?"var(--text-primary)":"#6b7280"},children:C.name}),g.jsx("div",{style:{fontSize:"11px",color:"#9ca3af",marginTop:"1px"},children:C.description}),!C.installed&&C.installHint&&g.jsx("div",{style:{fontSize:"10px",color:"#8b5cf6",marginTop:"4px",fontFamily:"'SF Mono', monospace",background:"rgba(139,92,246,0.06)",padding:"3px 6px",borderRadius:"4px",wordBreak:"break-all"},children:C.installHint})]})]},C.id))})]},y)),_.length===0&&g.jsx("p",{style:{fontSize:"12px",color:"#9ca3af",textAlign:"center",padding:"8px"},children:"Select an outcome to see recommended MCPs"})]})]})}function xb(){const{folderPath:e,selectedOutcome:i,setStyleExampleContent:n}=ji(),[l,o]=z.useState(!1);return g.jsxs("div",{className:"h-full overflow-y-auto",style:{background:"var(--bg-sidebar)"},children:[l&&g.jsx(Bm,{onClose:()=>o(!1)}),g.jsx("div",{style:{padding:"20px 28px 0"},children:g.jsx("button",{onClick:()=>o(!0),style:{width:"100%",padding:"12px 20px",borderRadius:"12px",background:"linear-gradient(135deg, rgba(94,23,235,0.06), rgba(139,92,246,0.06))",border:"1px solid rgba(94,23,235,0.15)",color:"#8b5cf6",fontSize:"14px",fontWeight:600,cursor:"pointer",transition:"all 0.2s",display:"flex",alignItems:"center",justifyContent:"center",gap:"8px"},children:"▶ How it works"})}),g.jsx(ub,{}),g.jsx(zm,{}),e&&g.jsxs(g.Fragment,{children:[g.jsx("div",{style:{padding:"16px 20px",borderBottom:"1px solid var(--border)"},children:g.jsx(db,{})}),g.jsx("div",{style:{padding:"16px 20px",borderBottom:"1px solid var(--border)"},children:g.jsx(yb,{outcomeKey:i,onContentChange:n})}),g.jsx(bb,{}),g.jsx("div",{style:{padding:"16px 20px",paddingBottom:"24px"},children:g.jsx(Sb,{})})]})]})}function wb({open:e}){const{mode:i}=Et(),n=i==="document";return g.jsx("div",{style:{width:e?"340px":"0px",overflow:e?"auto":"hidden",borderRight:"1px solid #e5e7eb",background:"#fff",flexShrink:0,transition:"width 0.2s ease"},children:g.jsx("div",{style:{width:"340px",height:"100%"},children:n?g.jsx(xb,{}):g.jsx(ab,{})})})}var Nm=Object.defineProperty,Cb=Object.getOwnPropertyDescriptor,kb=(e,i)=>{for(var n in i)Nm(e,n,{get:i[n],enumerable:!0})},Qe=(e,i,n,l)=>{for(var o=l>1?void 0:l?Cb(i,n):i,h=e.length-1,d;h>=0;h--)(d=e[h])&&(o=(l?d(i,n,o):d(o))||o);return l&&o&&Nm(i,n,o),o},se=(e,i)=>(n,l)=>i(n,l,e),bg="Terminal input",iu={get:()=>bg,set:e=>bg=e},xg="Too much output to announce, navigate to rows manually to read",su={get:()=>xg,set:e=>xg=e};function Eb(e){return e.replace(/\r?\n/g,"\r")}function Tb(e,i){return i?"\x1B[200~"+e+"\x1B[201~":e}function Rb(e,i){e.clipboardData&&e.clipboardData.setData("text/plain",i.selectionText),e.preventDefault()}function Db(e,i,n,l){if(e.stopPropagation(),e.clipboardData){let o=e.clipboardData.getData("text/plain");Hm(o,i,n,l)}}function Hm(e,i,n,l){e=Eb(e),e=Tb(e,n.decPrivateModes.bracketedPasteMode&&l.rawOptions.ignoreBracketedPasteMode!==!0),n.triggerDataEvent(e,!0),i.value=""}function Um(e,i,n){let l=n.getBoundingClientRect(),o=e.clientX-l.left-10,h=e.clientY-l.top-10;i.style.width="20px",i.style.height="20px",i.style.left=`${o}px`,i.style.top=`${h}px`,i.style.zIndex="1000",i.focus()}function wg(e,i,n,l,o){Um(e,i,n),o&&l.rightClickSelect(e),i.value=l.selectionText,i.select()}function Os(e){return e>65535?(e-=65536,String.fromCharCode((e>>10)+55296)+String.fromCharCode(e%1024+56320)):String.fromCharCode(e)}function co(e,i=0,n=e.length){let l="";for(let o=i;o<n;++o){let h=e[o];h>65535?(h-=65536,l+=String.fromCharCode((h>>10)+55296)+String.fromCharCode(h%1024+56320)):l+=String.fromCharCode(h)}return l}var Bb=class{constructor(){this._interim=0}clear(){this._interim=0}decode(e,i){let n=e.length;if(!n)return 0;let l=0,o=0;if(this._interim){let h=e.charCodeAt(o++);56320<=h&&h<=57343?i[l++]=(this._interim-55296)*1024+h-56320+65536:(i[l++]=this._interim,i[l++]=h),this._interim=0}for(let h=o;h<n;++h){let d=e.charCodeAt(h);if(55296<=d&&d<=56319){if(++h>=n)return this._interim=d,l;let _=e.charCodeAt(h);56320<=_&&_<=57343?i[l++]=(d-55296)*1024+_-56320+65536:(i[l++]=d,i[l++]=_);continue}d!==65279&&(i[l++]=d)}return l}},Mb=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(e,i){let n=e.length;if(!n)return 0;let l=0,o,h,d,_,p=0,f=0;if(this.interim[0]){let x=!1,C=this.interim[0];C&=(C&224)===192?31:(C&240)===224?15:7;let b=0,T;for(;(T=this.interim[++b]&63)&&b<4;)C<<=6,C|=T;let M=(this.interim[0]&224)===192?2:(this.interim[0]&240)===224?3:4,A=M-b;for(;f<A;){if(f>=n)return 0;if(T=e[f++],(T&192)!==128){f--,x=!0;break}else this.interim[b++]=T,C<<=6,C|=T&63}x||(M===2?C<128?f--:i[l++]=C:M===3?C<2048||C>=55296&&C<=57343||C===65279||(i[l++]=C):C<65536||C>1114111||(i[l++]=C)),this.interim.fill(0)}let S=n-4,y=f;for(;y<n;){for(;y<S&&!((o=e[y])&128)&&!((h=e[y+1])&128)&&!((d=e[y+2])&128)&&!((_=e[y+3])&128);)i[l++]=o,i[l++]=h,i[l++]=d,i[l++]=_,y+=4;if(o=e[y++],o<128)i[l++]=o;else if((o&224)===192){if(y>=n)return this.interim[0]=o,l;if(h=e[y++],(h&192)!==128){y--;continue}if(p=(o&31)<<6|h&63,p<128){y--;continue}i[l++]=p}else if((o&240)===224){if(y>=n)return this.interim[0]=o,l;if(h=e[y++],(h&192)!==128){y--;continue}if(y>=n)return this.interim[0]=o,this.interim[1]=h,l;if(d=e[y++],(d&192)!==128){y--;continue}if(p=(o&15)<<12|(h&63)<<6|d&63,p<2048||p>=55296&&p<=57343||p===65279)continue;i[l++]=p}else if((o&248)===240){if(y>=n)return this.interim[0]=o,l;if(h=e[y++],(h&192)!==128){y--;continue}if(y>=n)return this.interim[0]=o,this.interim[1]=h,l;if(d=e[y++],(d&192)!==128){y--;continue}if(y>=n)return this.interim[0]=o,this.interim[1]=h,this.interim[2]=d,l;if(_=e[y++],(_&192)!==128){y--;continue}if(p=(o&7)<<18|(h&63)<<12|(d&63)<<6|_&63,p<65536||p>1114111)continue;i[l++]=p}}return l}},Wm="",Ls=" ",ml=class qm{constructor(){this.fg=0,this.bg=0,this.extended=new Ja}static toColorRGB(i){return[i>>>16&255,i>>>8&255,i&255]}static fromColorRGB(i){return(i[0]&255)<<16|(i[1]&255)<<8|i[2]&255}clone(){let i=new qm;return i.fg=this.fg,i.bg=this.bg,i.extended=this.extended.clone(),i}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}},Ja=class Pm{constructor(i=0,n=0){this._ext=0,this._urlId=0,this._ext=i,this._urlId=n}get ext(){return this._urlId?this._ext&-469762049|this.underlineStyle<<26:this._ext}set ext(i){this._ext=i}get underlineStyle(){return this._urlId?5:(this._ext&469762048)>>26}set underlineStyle(i){this._ext&=-469762049,this._ext|=i<<26&469762048}get underlineColor(){return this._ext&67108863}set underlineColor(i){this._ext&=-67108864,this._ext|=i&67108863}get urlId(){return this._urlId}set urlId(i){this._urlId=i}get underlineVariantOffset(){let i=(this._ext&3758096384)>>29;return i<0?i^4294967288:i}set underlineVariantOffset(i){this._ext&=536870911,this._ext|=i<<29&3758096384}clone(){return new Pm(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}},gi=class Im extends ml{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new Ja,this.combinedData=""}static fromCharData(i){let n=new Im;return n.setFromCharData(i),n}isCombined(){return this.content&2097152}getWidth(){return this.content>>22}getChars(){return this.content&2097152?this.combinedData:this.content&2097151?Os(this.content&2097151):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):this.content&2097151}setFromCharData(i){this.fg=i[0],this.bg=0;let n=!1;if(i[1].length>2)n=!0;else if(i[1].length===2){let l=i[1].charCodeAt(0);if(55296<=l&&l<=56319){let o=i[1].charCodeAt(1);56320<=o&&o<=57343?this.content=(l-55296)*1024+o-56320+65536|i[2]<<22:n=!0}else n=!0}else this.content=i[1].charCodeAt(0)|i[2]<<22;n&&(this.combinedData=i[1],this.content=2097152|i[2]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},Cg="di$target",ru="di$dependencies",Ph=new Map;function zb(e){return e[ru]||[]}function yt(e){if(Ph.has(e))return Ph.get(e);let i=function(n,l,o){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");Ab(i,n,o)};return i._id=e,Ph.set(e,i),i}function Ab(e,i,n){i[Cg]===i?i[ru].push({id:e,index:n}):(i[ru]=[{id:e,index:n}],i[Cg]=i)}var zt=yt("BufferService"),$m=yt("CoreMouseService"),hr=yt("CoreService"),Ob=yt("CharsetService"),Iu=yt("InstantiationService"),Km=yt("LogService"),At=yt("OptionsService"),Ym=yt("OscLinkService"),Lb=yt("UnicodeService"),vl=yt("DecorationService"),nu=class{constructor(e,i,n){this._bufferService=e,this._optionsService=i,this._oscLinkService=n}provideLinks(e,i){let n=this._bufferService.buffer.lines.get(e-1);if(!n){i(void 0);return}let l=[],o=this._optionsService.rawOptions.linkHandler,h=new gi,d=n.getTrimmedLength(),_=-1,p=-1,f=!1;for(let S=0;S<d;S++)if(!(p===-1&&!n.hasContent(S))){if(n.loadCell(S,h),h.hasExtendedAttrs()&&h.extended.urlId)if(p===-1){p=S,_=h.extended.urlId;continue}else f=h.extended.urlId!==_;else p!==-1&&(f=!0);if(f||p!==-1&&S===d-1){let y=this._oscLinkService.getLinkData(_)?.uri;if(y){let x={start:{x:p+1,y:e},end:{x:S+(!f&&S===d-1?1:0),y:e}},C=!1;if(!o?.allowNonHttpProtocols)try{let b=new URL(y);["http:","https:"].includes(b.protocol)||(C=!0)}catch{C=!0}C||l.push({text:y,range:x,activate:(b,T)=>o?o.activate(b,T,x):jb(b,T),hover:(b,T)=>o?.hover?.(b,T,x),leave:(b,T)=>o?.leave?.(b,T,x)})}f=!1,h.hasExtendedAttrs()&&h.extended.urlId?(p=S,_=h.extended.urlId):(p=-1,_=-1)}}i(l)}};nu=Qe([se(0,zt),se(1,At),se(2,Ym)],nu);function jb(e,i){if(confirm(`Do you want to navigate to ${i}?
|
|
84
|
+
`);i(H)}else i(null)},[i,p]),x=z.useRef(!1);z.useEffect(()=>{if(!x.current){x.current=!0;return}y(n,o)},[n,o,y]);const C=z.useCallback(async D=>{const L=Array.from(D),H=[];for(const X of L){const V=X.name.split(".").pop()?.toLowerCase()||"";if(["pdf","docx","doc"].includes(V))continue;const ue=await X.text();H.push({name:X.name,content:ue})}H.length!==0&&(l(X=>{const V=qh-X.length;return V<=0?X:[...X,...H.slice(0,V)]}),h(null))},[]),b=z.useCallback(D=>{D.preventDefault(),_(!1),D.dataTransfer.files.length>0&&C(D.dataTransfer.files)},[C]),T=z.useCallback(D=>{D.target.files&&D.target.files.length>0&&C(D.target.files),D.target.value=""},[C]),M=z.useCallback(D=>{l(L=>L.filter((H,X)=>X!==D))},[]),A=z.useCallback(D=>{h(L=>L===D?null:D),l([])},[]),O=n.length>0||o!==null;return g.jsxs("div",{className:"space-y-3",children:[g.jsxs("div",{className:"flex items-center gap-2",style:{marginBottom:"8px"},children:[g.jsx("div",{className:"flex items-center justify-center text-white text-xs font-bold flex-shrink-0",style:{width:"24px",height:"24px",borderRadius:"8px",background:"linear-gradient(135deg, #6366f1, #a855f7)"},children:"✦"}),g.jsx("h3",{className:"text-sm font-semibold",style:{color:"var(--text-primary)"},children:"Show Claude an example"}),g.jsx("span",{className:"text-xs italic",style:{color:"var(--text-secondary)"},children:"optional"})]}),n.map((D,L)=>{const H=vb(D.name),X=gb[H]||"📄",V=D.content.slice(0,80).replace(/\n/g," "),ue={pdf:"#fef2f2",md:"#f0f9ff",docx:"#eff6ff",doc:"#eff6ff",txt:"#f8fafc"};return g.jsxs("div",{className:"flex items-center gap-2.5 rounded-lg border",style:{padding:"10px 12px",background:"var(--bg-secondary)",borderColor:"var(--border)"},children:[g.jsx("div",{className:"flex items-center justify-center flex-shrink-0",style:{width:"32px",height:"32px",borderRadius:"8px",background:ue[H]||"#f8fafc",fontSize:"16px"},children:X}),g.jsxs("div",{className:"flex-1 min-w-0",children:[g.jsx("div",{className:"text-xs font-semibold truncate",style:{color:"var(--text-primary)"},children:D.name}),g.jsx("div",{className:"text-xs truncate",style:{color:"var(--text-secondary)",fontSize:"10px",marginTop:"1px"},children:V})]}),g.jsx("button",{onClick:()=>M(L),"aria-label":`Remove ${D.name}`,className:"flex items-center justify-center flex-shrink-0 border rounded-md transition-colors hover:bg-red-50 hover:border-red-300 hover:text-red-600",style:{width:"20px",height:"20px",borderColor:"var(--border)",color:"var(--text-secondary)",background:"transparent",cursor:"pointer",fontSize:"10px"},children:"✕"})]},L)}),n.length<qh&&g.jsxs("div",{onDragOver:D=>{D.preventDefault(),_(!0)},onDragLeave:()=>_(!1),onDrop:b,onClick:()=>S.current?.click(),className:"relative text-center cursor-pointer transition-all rounded-xl",style:{border:`2px dashed ${d?"#818cf8":"#c7d2fe"}`,borderRadius:"10px",padding:"12px",background:d?"#eef2ff":"transparent"},children:[g.jsx("input",{ref:S,type:"file",multiple:!0,accept:mb,onChange:T,style:{position:"absolute",inset:0,opacity:0,cursor:"pointer"}}),g.jsx("div",{style:{fontSize:"18px",marginBottom:"4px",opacity:.7},children:"📎"}),g.jsxs("div",{style:{fontSize:"11px",color:"#64748b",fontWeight:500,lineHeight:1.4},children:[g.jsx("strong",{style:{color:"#6366f1"},children:"Drop a document"})," to use as a style reference"]}),g.jsx("div",{style:{fontSize:"10px",color:"#94a3b8",marginTop:"2px"},children:"MD, TXT, CSV, JSON, HTML — up to 3"})]}),n.length>0&&g.jsxs("div",{className:"text-right",style:{fontSize:"10px",color:"#94a3b8"},children:[n.length," of ",qh," examples attached"]}),p.length>0&&g.jsxs(g.Fragment,{children:[g.jsxs("div",{className:"flex items-center gap-2",style:{margin:"12px 0 8px"},children:[g.jsx("div",{className:"flex-1",style:{height:"1px",background:"var(--border)"}}),g.jsx("span",{style:{fontSize:"10px",color:"#94a3b8",fontWeight:600,textTransform:"uppercase",letterSpacing:"0.5px",whiteSpace:"nowrap"},children:"or use a saved style"}),g.jsx("div",{className:"flex-1",style:{height:"1px",background:"var(--border)"}})]}),g.jsx("div",{className:"flex flex-wrap gap-1.5",children:p.map(D=>{const L=o===D.id;return g.jsxs("button",{onClick:()=>A(D.id),className:"inline-flex items-center gap-1 rounded-lg text-xs transition-colors",style:{padding:"5px 10px",border:`1px solid ${L?"#818cf8":"var(--border)"}`,background:L?"#eef2ff":"transparent",color:L?"#4338ca":"var(--text-secondary)",cursor:"pointer",fontWeight:500},children:[g.jsx("span",{style:{fontSize:"12px"},children:"⭐"})," ",D.name]},D.id)})})]}),O&&g.jsx("div",{className:"rounded-lg",style:{fontSize:"10px",color:"#6366f1",background:"#eef2ff",border:"1px solid #e0e7ff",borderRadius:"8px",padding:"6px 10px"},children:"✨ Claude will match the tone, structure, and formatting of your example"})]})}function Sb(){const{contextText:e,setContextText:i,canRun:n,run:l,selectedOutcome:o,folderScan:h,isRunning:d}=ji(),_=o?oo.find(f=>f.key===o)?.name||o:"Custom",p=h?.summary.total||0;return g.jsxs("div",{className:"space-y-2",children:[g.jsxs("div",{className:"flex items-center gap-2",style:{marginBottom:"8px"},children:[g.jsx("div",{className:"flex-shrink-0",style:{width:"24px",height:"24px",borderRadius:"8px",background:"linear-gradient(135deg, #5e17eb, #8b5cf6)",display:"flex",alignItems:"center",justifyContent:"center",color:"white",fontSize:"11px",fontWeight:700},children:"3"}),g.jsx("h3",{style:{fontSize:"13px",fontWeight:700,color:"var(--text-primary)"},children:"Additional context"})]}),g.jsx("textarea",{value:e,onChange:f=>i(f.target.value),placeholder:"Any extra instructions, e.g. focus on Q4, ignore drafts, output in French…",rows:2,className:"w-full rounded-lg border outline-none focus:ring-2 focus:ring-indigo-400 resize-none",style:{padding:"10px 14px",fontSize:"12px",lineHeight:"1.5",background:"var(--bg-secondary)",borderColor:"var(--border)",color:"var(--text-primary)"}}),g.jsxs("div",{className:"space-y-1.5",children:[g.jsx("button",{onClick:l,disabled:!n,className:"w-full rounded-lg text-sm font-semibold text-white shadow-lg disabled:opacity-40 disabled:cursor-not-allowed transition-all",style:{padding:"12px 16px",background:"linear-gradient(135deg, #7c3aed, #a855f7)"},children:d?"⏳ Working...":`✨ Go — ${_} ${p} documents`}),g.jsx("p",{className:"text-xs text-center",style:{color:"var(--text-secondary)"},children:"Claude will scan your files and create the output"})]})]})}function bb(){const{selectedOutcome:e}=ji(),[i,n]=z.useState([]),[l,o]=z.useState(!0),[h,d]=z.useState(!0);z.useEffect(()=>{const y=e?`/api/mcp-status?outcome=${e}`:"/api/mcp-status";fetch(y).then(x=>x.json()).then(x=>{n(x.mcps||[]),o(!1)}).catch(()=>o(!1))},[e]);const _=i.filter(y=>y.relevant),p=_.filter(y=>y.installed).length,f=_.length,S={};for(const y of _)S[y.category]||(S[y.category]=[]),S[y.category].push(y);return g.jsxs("div",{style:{padding:"16px 20px",borderBottom:"1px solid var(--border)"},children:[g.jsxs("button",{onClick:()=>d(!h),style:{width:"100%",display:"flex",alignItems:"center",justifyContent:"space-between",background:"none",border:"none",cursor:"pointer",padding:0},children:[g.jsxs("span",{style:{fontWeight:600,fontSize:"13px",color:"var(--text-primary)",display:"flex",alignItems:"center",gap:"6px"},children:[g.jsx("span",{style:{fontSize:"10px",color:"#9ca3af",transform:h?"rotate(0deg)":"rotate(90deg)",transition:"transform 0.15s",display:"inline-block"},children:"▶"}),"Superpowers (MCPs)"]}),l?g.jsx("span",{style:{fontSize:"11px",color:"#9ca3af"},children:"checking..."}):g.jsxs("span",{style:{background:p===f?"rgba(22,163,74,0.1)":"rgba(139,92,246,0.1)",color:p===f?"#16a34a":"#8b5cf6",fontSize:"11px",padding:"2px 8px",borderRadius:"10px",fontWeight:600},children:[p,"/",f," active"]})]}),!h&&!l&&g.jsxs("div",{style:{marginTop:"12px",display:"flex",flexDirection:"column",gap:"12px"},children:[Object.entries(S).map(([y,x])=>g.jsxs("div",{children:[g.jsx("div",{style:{fontSize:"10px",fontWeight:700,textTransform:"uppercase",letterSpacing:"0.05em",color:"#9ca3af",marginBottom:"6px"},children:x[0].categoryLabel}),g.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"4px"},children:x.map(C=>g.jsxs("div",{style:{display:"flex",alignItems:"flex-start",gap:"10px",padding:"8px 10px",borderRadius:"8px",background:C.installed?"rgba(22, 163, 74, 0.04)":"rgba(0, 0, 0, 0.02)"},children:[g.jsx("span",{style:{width:"8px",height:"8px",borderRadius:"50%",marginTop:"4px",background:C.installed?"#16a34a":"#d4d4d8",flexShrink:0}}),g.jsxs("div",{style:{flex:1,minWidth:0},children:[g.jsx("div",{style:{fontSize:"12px",fontWeight:600,color:C.installed?"var(--text-primary)":"#6b7280"},children:C.name}),g.jsx("div",{style:{fontSize:"11px",color:"#9ca3af",marginTop:"1px"},children:C.description}),!C.installed&&C.installHint&&g.jsx("div",{style:{fontSize:"10px",color:"#8b5cf6",marginTop:"4px",fontFamily:"'SF Mono', monospace",background:"rgba(139,92,246,0.06)",padding:"3px 6px",borderRadius:"4px",wordBreak:"break-all"},children:C.installHint})]})]},C.id))})]},y)),_.length===0&&g.jsx("p",{style:{fontSize:"12px",color:"#9ca3af",textAlign:"center",padding:"8px"},children:"Select an outcome to see recommended MCPs"})]})]})}function xb(){const{folderPath:e,selectedOutcome:i,setStyleExampleContent:n}=ji(),[l,o]=z.useState(!1);return g.jsxs("div",{className:"h-full overflow-y-auto",style:{background:"var(--bg-sidebar)"},children:[l&&g.jsx(Bm,{onClose:()=>o(!1)}),g.jsx("div",{style:{padding:"20px 28px 0"},children:g.jsx("button",{onClick:()=>o(!0),style:{width:"100%",padding:"12px 20px",borderRadius:"12px",background:"linear-gradient(135deg, rgba(94,23,235,0.06), rgba(139,92,246,0.06))",border:"1px solid rgba(94,23,235,0.15)",color:"#8b5cf6",fontSize:"14px",fontWeight:600,cursor:"pointer",transition:"all 0.2s",display:"flex",alignItems:"center",justifyContent:"center",gap:"8px"},children:"▶ How it works"})}),g.jsx(ub,{}),g.jsx(zm,{}),e&&g.jsxs(g.Fragment,{children:[g.jsx("div",{style:{padding:"16px 20px",borderBottom:"1px solid var(--border)"},children:g.jsx(db,{})}),g.jsx("div",{style:{padding:"16px 20px",borderBottom:"1px solid var(--border)"},children:g.jsx(yb,{outcomeKey:i,onContentChange:n})}),g.jsx(bb,{}),g.jsx("div",{style:{padding:"16px 20px",paddingBottom:"24px"},children:g.jsx(Sb,{})})]})]})}function wb({open:e}){const{mode:i}=Et(),n=i==="document";return g.jsx("div",{style:{width:e?"340px":"0px",overflow:e?"auto":"hidden",borderRight:"1px solid #e5e7eb",background:"#fff",flexShrink:0,transition:"width 0.2s ease"},children:g.jsx("div",{style:{width:"340px",height:"100%"},children:n?g.jsx(xb,{}):g.jsx(ab,{})})})}var Nm=Object.defineProperty,Cb=Object.getOwnPropertyDescriptor,kb=(e,i)=>{for(var n in i)Nm(e,n,{get:i[n],enumerable:!0})},Qe=(e,i,n,l)=>{for(var o=l>1?void 0:l?Cb(i,n):i,h=e.length-1,d;h>=0;h--)(d=e[h])&&(o=(l?d(i,n,o):d(o))||o);return l&&o&&Nm(i,n,o),o},se=(e,i)=>(n,l)=>i(n,l,e),bg="Terminal input",iu={get:()=>bg,set:e=>bg=e},xg="Too much output to announce, navigate to rows manually to read",su={get:()=>xg,set:e=>xg=e};function Eb(e){return e.replace(/\r?\n/g,"\r")}function Tb(e,i){return i?"\x1B[200~"+e+"\x1B[201~":e}function Rb(e,i){e.clipboardData&&e.clipboardData.setData("text/plain",i.selectionText),e.preventDefault()}function Db(e,i,n,l){if(e.stopPropagation(),e.clipboardData){let o=e.clipboardData.getData("text/plain");Hm(o,i,n,l)}}function Hm(e,i,n,l){e=Eb(e),e=Tb(e,n.decPrivateModes.bracketedPasteMode&&l.rawOptions.ignoreBracketedPasteMode!==!0),n.triggerDataEvent(e,!0),i.value=""}function Um(e,i,n){let l=n.getBoundingClientRect(),o=e.clientX-l.left-10,h=e.clientY-l.top-10;i.style.width="20px",i.style.height="20px",i.style.left=`${o}px`,i.style.top=`${h}px`,i.style.zIndex="1000",i.focus()}function wg(e,i,n,l,o){Um(e,i,n),o&&l.rightClickSelect(e),i.value=l.selectionText,i.select()}function Os(e){return e>65535?(e-=65536,String.fromCharCode((e>>10)+55296)+String.fromCharCode(e%1024+56320)):String.fromCharCode(e)}function co(e,i=0,n=e.length){let l="";for(let o=i;o<n;++o){let h=e[o];h>65535?(h-=65536,l+=String.fromCharCode((h>>10)+55296)+String.fromCharCode(h%1024+56320)):l+=String.fromCharCode(h)}return l}var Bb=class{constructor(){this._interim=0}clear(){this._interim=0}decode(e,i){let n=e.length;if(!n)return 0;let l=0,o=0;if(this._interim){let h=e.charCodeAt(o++);56320<=h&&h<=57343?i[l++]=(this._interim-55296)*1024+h-56320+65536:(i[l++]=this._interim,i[l++]=h),this._interim=0}for(let h=o;h<n;++h){let d=e.charCodeAt(h);if(55296<=d&&d<=56319){if(++h>=n)return this._interim=d,l;let _=e.charCodeAt(h);56320<=_&&_<=57343?i[l++]=(d-55296)*1024+_-56320+65536:(i[l++]=d,i[l++]=_);continue}d!==65279&&(i[l++]=d)}return l}},Mb=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(e,i){let n=e.length;if(!n)return 0;let l=0,o,h,d,_,p=0,f=0;if(this.interim[0]){let x=!1,C=this.interim[0];C&=(C&224)===192?31:(C&240)===224?15:7;let b=0,T;for(;(T=this.interim[++b]&63)&&b<4;)C<<=6,C|=T;let M=(this.interim[0]&224)===192?2:(this.interim[0]&240)===224?3:4,A=M-b;for(;f<A;){if(f>=n)return 0;if(T=e[f++],(T&192)!==128){f--,x=!0;break}else this.interim[b++]=T,C<<=6,C|=T&63}x||(M===2?C<128?f--:i[l++]=C:M===3?C<2048||C>=55296&&C<=57343||C===65279||(i[l++]=C):C<65536||C>1114111||(i[l++]=C)),this.interim.fill(0)}let S=n-4,y=f;for(;y<n;){for(;y<S&&!((o=e[y])&128)&&!((h=e[y+1])&128)&&!((d=e[y+2])&128)&&!((_=e[y+3])&128);)i[l++]=o,i[l++]=h,i[l++]=d,i[l++]=_,y+=4;if(o=e[y++],o<128)i[l++]=o;else if((o&224)===192){if(y>=n)return this.interim[0]=o,l;if(h=e[y++],(h&192)!==128){y--;continue}if(p=(o&31)<<6|h&63,p<128){y--;continue}i[l++]=p}else if((o&240)===224){if(y>=n)return this.interim[0]=o,l;if(h=e[y++],(h&192)!==128){y--;continue}if(y>=n)return this.interim[0]=o,this.interim[1]=h,l;if(d=e[y++],(d&192)!==128){y--;continue}if(p=(o&15)<<12|(h&63)<<6|d&63,p<2048||p>=55296&&p<=57343||p===65279)continue;i[l++]=p}else if((o&248)===240){if(y>=n)return this.interim[0]=o,l;if(h=e[y++],(h&192)!==128){y--;continue}if(y>=n)return this.interim[0]=o,this.interim[1]=h,l;if(d=e[y++],(d&192)!==128){y--;continue}if(y>=n)return this.interim[0]=o,this.interim[1]=h,this.interim[2]=d,l;if(_=e[y++],(_&192)!==128){y--;continue}if(p=(o&7)<<18|(h&63)<<12|(d&63)<<6|_&63,p<65536||p>1114111)continue;i[l++]=p}}return l}},Wm="",Ls=" ",ml=class qm{constructor(){this.fg=0,this.bg=0,this.extended=new Ja}static toColorRGB(i){return[i>>>16&255,i>>>8&255,i&255]}static fromColorRGB(i){return(i[0]&255)<<16|(i[1]&255)<<8|i[2]&255}clone(){let i=new qm;return i.fg=this.fg,i.bg=this.bg,i.extended=this.extended.clone(),i}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}},Ja=class Pm{constructor(i=0,n=0){this._ext=0,this._urlId=0,this._ext=i,this._urlId=n}get ext(){return this._urlId?this._ext&-469762049|this.underlineStyle<<26:this._ext}set ext(i){this._ext=i}get underlineStyle(){return this._urlId?5:(this._ext&469762048)>>26}set underlineStyle(i){this._ext&=-469762049,this._ext|=i<<26&469762048}get underlineColor(){return this._ext&67108863}set underlineColor(i){this._ext&=-67108864,this._ext|=i&67108863}get urlId(){return this._urlId}set urlId(i){this._urlId=i}get underlineVariantOffset(){let i=(this._ext&3758096384)>>29;return i<0?i^4294967288:i}set underlineVariantOffset(i){this._ext&=536870911,this._ext|=i<<29&3758096384}clone(){return new Pm(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}},gi=class Im extends ml{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new Ja,this.combinedData=""}static fromCharData(i){let n=new Im;return n.setFromCharData(i),n}isCombined(){return this.content&2097152}getWidth(){return this.content>>22}getChars(){return this.content&2097152?this.combinedData:this.content&2097151?Os(this.content&2097151):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):this.content&2097151}setFromCharData(i){this.fg=i[0],this.bg=0;let n=!1;if(i[1].length>2)n=!0;else if(i[1].length===2){let l=i[1].charCodeAt(0);if(55296<=l&&l<=56319){let o=i[1].charCodeAt(1);56320<=o&&o<=57343?this.content=(l-55296)*1024+o-56320+65536|i[2]<<22:n=!0}else n=!0}else this.content=i[1].charCodeAt(0)|i[2]<<22;n&&(this.combinedData=i[1],this.content=2097152|i[2]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},Cg="di$target",ru="di$dependencies",Ph=new Map;function zb(e){return e[ru]||[]}function yt(e){if(Ph.has(e))return Ph.get(e);let i=function(n,l,o){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");Ab(i,n,o)};return i._id=e,Ph.set(e,i),i}function Ab(e,i,n){i[Cg]===i?i[ru].push({id:e,index:n}):(i[ru]=[{id:e,index:n}],i[Cg]=i)}var zt=yt("BufferService"),Ym=yt("CoreMouseService"),hr=yt("CoreService"),Ob=yt("CharsetService"),Iu=yt("InstantiationService"),$m=yt("LogService"),At=yt("OptionsService"),Km=yt("OscLinkService"),Lb=yt("UnicodeService"),vl=yt("DecorationService"),nu=class{constructor(e,i,n){this._bufferService=e,this._optionsService=i,this._oscLinkService=n}provideLinks(e,i){let n=this._bufferService.buffer.lines.get(e-1);if(!n){i(void 0);return}let l=[],o=this._optionsService.rawOptions.linkHandler,h=new gi,d=n.getTrimmedLength(),_=-1,p=-1,f=!1;for(let S=0;S<d;S++)if(!(p===-1&&!n.hasContent(S))){if(n.loadCell(S,h),h.hasExtendedAttrs()&&h.extended.urlId)if(p===-1){p=S,_=h.extended.urlId;continue}else f=h.extended.urlId!==_;else p!==-1&&(f=!0);if(f||p!==-1&&S===d-1){let y=this._oscLinkService.getLinkData(_)?.uri;if(y){let x={start:{x:p+1,y:e},end:{x:S+(!f&&S===d-1?1:0),y:e}},C=!1;if(!o?.allowNonHttpProtocols)try{let b=new URL(y);["http:","https:"].includes(b.protocol)||(C=!0)}catch{C=!0}C||l.push({text:y,range:x,activate:(b,T)=>o?o.activate(b,T,x):jb(b,T),hover:(b,T)=>o?.hover?.(b,T,x),leave:(b,T)=>o?.leave?.(b,T,x)})}f=!1,h.hasExtendedAttrs()&&h.extended.urlId?(p=S,_=h.extended.urlId):(p=-1,_=-1)}}i(l)}};nu=Qe([se(0,zt),se(1,At),se(2,Km)],nu);function jb(e,i){if(confirm(`Do you want to navigate to ${i}?
|
|
85
85
|
|
|
86
|
-
WARNING: This link could potentially be dangerous`)){let n=window.open();if(n){try{n.opener=null}catch{}n.location.href=i}else console.warn("Opening link blocked as opener could not be cleared")}}var ho=yt("CharSizeService"),rs=yt("CoreBrowserService")
|
|
86
|
+
WARNING: This link could potentially be dangerous`)){let n=window.open();if(n){try{n.opener=null}catch{}n.location.href=i}else console.warn("Opening link blocked as opener could not be cleared")}}var ho=yt("CharSizeService"),rs=yt("CoreBrowserService"),Yu=yt("MouseService"),ns=yt("RenderService"),Nb=yt("SelectionService"),Fm=yt("CharacterJoinerService"),tn=yt("ThemeService"),Gm=yt("LinkProviderService"),Hb=class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?kg.isErrorNoTelemetry(e)?new kg(e.message+`
|
|
87
87
|
|
|
88
88
|
`+e.stack):new Error(e.message+`
|
|
89
89
|
|
|
90
|
-
`+e.stack):e},0)}}addListener(e){return this.listeners.push(e),()=>{this._removeListener(e)}}emit(e){this.listeners.forEach(i=>{i(e)})}_removeListener(e){this.listeners.splice(this.listeners.indexOf(e),1)}setUnexpectedErrorHandler(e){this.unexpectedErrorHandler=e}getUnexpectedErrorHandler(){return this.unexpectedErrorHandler}onUnexpectedError(e){this.unexpectedErrorHandler(e),this.emit(e)}onUnexpectedExternalError(e){this.unexpectedErrorHandler(e)}},Ub=new Hb;function Ya(e){Wb(e)||Ub.onUnexpectedError(e)}var lu="Canceled";function Wb(e){return e instanceof qb?!0:e instanceof Error&&e.name===lu&&e.message===lu}var qb=class extends Error{constructor(){super(lu),this.name=this.message}};function Pb(e){return new Error(`Illegal argument: ${e}`)}var kg=class au extends Error{constructor(i){super(i),this.name="CodeExpectedError"}static fromError(i){if(i instanceof au)return i;let n=new au;return n.message=i.message,n.stack=i.stack,n}static isErrorNoTelemetry(i){return i.name==="CodeExpectedError"}},ou=class Xm extends Error{constructor(i){super(i||"An unexpected bug occurred."),Object.setPrototypeOf(this,Xm.prototype)}};function Qt(e,i=0){return e[e.length-(1+i)]}var Ib;(e=>{function i(h){return h<0}e.isLessThan=i;function n(h){return h<=0}e.isLessThanOrEqual=n;function l(h){return h>0}e.isGreaterThan=l;function o(h){return h===0}e.isNeitherLessOrGreaterThan=o,e.greaterThan=1,e.lessThan=-1,e.neitherLessOrGreaterThan=0})(Ib||={});function $b(e,i){let n=this,l=!1,o;return function(){return l||(l=!0,i||(o=e.apply(n,arguments))),o}}var Vm;(e=>{function i(L){return L&&typeof L=="object"&&typeof L[Symbol.iterator]=="function"}e.is=i;let n=Object.freeze([]);function l(){return n}e.empty=l;function*o(L){yield L}e.single=o;function h(L){return i(L)?L:o(L)}e.wrap=h;function d(L){return L||n}e.from=d;function*_(L){for(let H=L.length-1;H>=0;H--)yield L[H]}e.reverse=_;function p(L){return!L||L[Symbol.iterator]().next().done===!0}e.isEmpty=p;function f(L){return L[Symbol.iterator]().next().value}e.first=f;function S(L,H){let X=0;for(let V of L)if(H(V,X++))return!0;return!1}e.some=S;function y(L,H){for(let X of L)if(H(X))return X}e.find=y;function*x(L,H){for(let X of L)H(X)&&(yield X)}e.filter=x;function*C(L,H){let X=0;for(let V of L)yield H(V,X++)}e.map=C;function*b(L,H){let X=0;for(let V of L)yield*H(V,X++)}e.flatMap=b;function*T(...L){for(let H of L)yield*H}e.concat=T;function M(L,H,X){let V=X;for(let ue of L)V=H(V,ue);return V}e.reduce=M;function*A(L,H,X=L.length){for(H<0&&(H+=L.length),X<0?X+=L.length:X>L.length&&(X=L.length);H<X;H++)yield L[H]}e.slice=A;function O(L,H=Number.POSITIVE_INFINITY){let X=[];if(H===0)return[X,L];let V=L[Symbol.iterator]();for(let ue=0;ue<H;ue++){let ge=V.next();if(ge.done)return[X,e.empty()];X.push(ge.value)}return[X,{[Symbol.iterator](){return V}}]}e.consume=O;async function D(L){let H=[];for await(let X of L)H.push(X);return Promise.resolve(H)}e.asyncToArray=D})(Vm||={});function ar(e){if(Vm.is(e)){let i=[];for(let n of e)if(n)try{n.dispose()}catch(l){i.push(l)}if(i.length===1)throw i[0];if(i.length>1)throw new AggregateError(i,"Encountered errors while disposing of store");return Array.isArray(e)?[]:e}else if(e)return e.dispose(),e}function Kb(...e){return Ke(()=>ar(e))}function Ke(e){return{dispose:$b(()=>{e()})}}var Zm=class Qm{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{ar(this._toDispose)}finally{this._toDispose.clear()}}add(i){if(!i)return i;if(i===this)throw new Error("Cannot register a disposable on itself!");return this._isDisposed?Qm.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(i),i}delete(i){if(i){if(i===this)throw new Error("Cannot dispose a disposable on itself!");this._toDispose.delete(i),i.dispose()}}deleteAndLeak(i){i&&this._toDispose.has(i)&&(this._toDispose.delete(i),void 0)}};Zm.DISABLE_DISPOSED_WARNING=!1;var js=Zm,Se=class{constructor(){this._store=new js,this._store}dispose(){this._store.dispose()}_register(i){if(i===this)throw new Error("Cannot register a disposable on itself!");return this._store.add(i)}};Se.None=Object.freeze({dispose(){}});var Jr=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(i){this._isDisposed||i===this._value||(this._value?.dispose(),this._value=i)}clear(){this.value=void 0}dispose(){this._isDisposed=!0,this._value?.dispose(),this._value=void 0}clearAndLeak(){let i=this._value;return this._value=void 0,i}},ss=typeof window=="object"?window:globalThis,cu=class hu{constructor(i){this.element=i,this.next=hu.Undefined,this.prev=hu.Undefined}};cu.Undefined=new cu(void 0);var Fe=cu,Eg=class{constructor(){this._first=Fe.Undefined,this._last=Fe.Undefined,this._size=0}get size(){return this._size}isEmpty(){return this._first===Fe.Undefined}clear(){let e=this._first;for(;e!==Fe.Undefined;){let i=e.next;e.prev=Fe.Undefined,e.next=Fe.Undefined,e=i}this._first=Fe.Undefined,this._last=Fe.Undefined,this._size=0}unshift(e){return this._insert(e,!1)}push(e){return this._insert(e,!0)}_insert(e,i){let n=new Fe(e);if(this._first===Fe.Undefined)this._first=n,this._last=n;else if(i){let o=this._last;this._last=n,n.prev=o,o.next=n}else{let o=this._first;this._first=n,n.next=o,o.prev=n}this._size+=1;let l=!1;return()=>{l||(l=!0,this._remove(n))}}shift(){if(this._first!==Fe.Undefined){let e=this._first.element;return this._remove(this._first),e}}pop(){if(this._last!==Fe.Undefined){let e=this._last.element;return this._remove(this._last),e}}_remove(e){if(e.prev!==Fe.Undefined&&e.next!==Fe.Undefined){let i=e.prev;i.next=e.next,e.next.prev=i}else e.prev===Fe.Undefined&&e.next===Fe.Undefined?(this._first=Fe.Undefined,this._last=Fe.Undefined):e.next===Fe.Undefined?(this._last=this._last.prev,this._last.next=Fe.Undefined):e.prev===Fe.Undefined&&(this._first=this._first.next,this._first.prev=Fe.Undefined);this._size-=1}*[Symbol.iterator](){let e=this._first;for(;e!==Fe.Undefined;)yield e.element,e=e.next}},Yb=globalThis.performance&&typeof globalThis.performance.now=="function",Fb=class Jm{static create(i){return new Jm(i)}constructor(i){this._now=Yb&&i===!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}},kt;(e=>{e.None=()=>Se.None;function i(Z,G){return y(Z,()=>{},0,void 0,!0,void 0,G)}e.defer=i;function n(Z){return(G,ie=null,ee)=>{let R=!1,I;return I=Z(K=>{if(!R)return I?I.dispose():R=!0,G.call(ie,K)},null,ee),R&&I.dispose(),I}}e.once=n;function l(Z,G,ie){return f((ee,R=null,I)=>Z(K=>ee.call(R,G(K)),null,I),ie)}e.map=l;function o(Z,G,ie){return f((ee,R=null,I)=>Z(K=>{G(K),ee.call(R,K)},null,I),ie)}e.forEach=o;function h(Z,G,ie){return f((ee,R=null,I)=>Z(K=>G(K)&&ee.call(R,K),null,I),ie)}e.filter=h;function d(Z){return Z}e.signal=d;function _(...Z){return(G,ie=null,ee)=>{let R=Kb(...Z.map(I=>I(K=>G.call(ie,K))));return S(R,ee)}}e.any=_;function p(Z,G,ie,ee){let R=ie;return l(Z,I=>(R=G(R,I),R),ee)}e.reduce=p;function f(Z,G){let ie,ee={onWillAddFirstListener(){ie=Z(R.fire,R)},onDidRemoveLastListener(){ie?.dispose()}},R=new Q(ee);return G?.add(R),R.event}function S(Z,G){return G instanceof Array?G.push(Z):G&&G.add(Z),Z}function y(Z,G,ie=100,ee=!1,R=!1,I,K){let ae,pe,k,P=0,J,te={leakWarningThreshold:I,onWillAddFirstListener(){ae=Z(he=>{P++,pe=G(pe,he),ee&&!k&&(oe.fire(pe),pe=void 0),J=()=>{let be=pe;pe=void 0,k=void 0,(!ee||P>1)&&oe.fire(be),P=0},typeof ie=="number"?(clearTimeout(k),k=setTimeout(J,ie)):k===void 0&&(k=0,queueMicrotask(J))})},onWillRemoveListener(){R&&P>0&&J?.()},onDidRemoveLastListener(){J=void 0,ae.dispose()}},oe=new Q(te);return K?.add(oe),oe.event}e.debounce=y;function x(Z,G=0,ie){return e.debounce(Z,(ee,R)=>ee?(ee.push(R),ee):[R],G,void 0,!0,void 0,ie)}e.accumulate=x;function C(Z,G=(ee,R)=>ee===R,ie){let ee=!0,R;return h(Z,I=>{let K=ee||!G(I,R);return ee=!1,R=I,K},ie)}e.latch=C;function b(Z,G,ie){return[e.filter(Z,G,ie),e.filter(Z,ee=>!G(ee),ie)]}e.split=b;function T(Z,G=!1,ie=[],ee){let R=ie.slice(),I=Z(pe=>{R?R.push(pe):ae.fire(pe)});ee&&ee.add(I);let K=()=>{R?.forEach(pe=>ae.fire(pe)),R=null},ae=new Q({onWillAddFirstListener(){I||(I=Z(pe=>ae.fire(pe)),ee&&ee.add(I))},onDidAddFirstListener(){R&&(G?setTimeout(K):K())},onDidRemoveLastListener(){I&&I.dispose(),I=null}});return ee&&ee.add(ae),ae.event}e.buffer=T;function M(Z,G){return(ie,ee,R)=>{let I=G(new O);return Z(function(K){let ae=I.evaluate(K);ae!==A&&ie.call(ee,ae)},void 0,R)}}e.chain=M;let A=Symbol("HaltChainable");class O{constructor(){this.steps=[]}map(G){return this.steps.push(G),this}forEach(G){return this.steps.push(ie=>(G(ie),ie)),this}filter(G){return this.steps.push(ie=>G(ie)?ie:A),this}reduce(G,ie){let ee=ie;return this.steps.push(R=>(ee=G(ee,R),ee)),this}latch(G=(ie,ee)=>ie===ee){let ie=!0,ee;return this.steps.push(R=>{let I=ie||!G(R,ee);return ie=!1,ee=R,I?R:A}),this}evaluate(G){for(let ie of this.steps)if(G=ie(G),G===A)break;return G}}function D(Z,G,ie=ee=>ee){let ee=(...ae)=>K.fire(ie(...ae)),R=()=>Z.on(G,ee),I=()=>Z.removeListener(G,ee),K=new Q({onWillAddFirstListener:R,onDidRemoveLastListener:I});return K.event}e.fromNodeEventEmitter=D;function L(Z,G,ie=ee=>ee){let ee=(...ae)=>K.fire(ie(...ae)),R=()=>Z.addEventListener(G,ee),I=()=>Z.removeEventListener(G,ee),K=new Q({onWillAddFirstListener:R,onDidRemoveLastListener:I});return K.event}e.fromDOMEventEmitter=L;function H(Z){return new Promise(G=>n(Z)(G))}e.toPromise=H;function X(Z){let G=new Q;return Z.then(ie=>{G.fire(ie)},()=>{G.fire(void 0)}).finally(()=>{G.dispose()}),G.event}e.fromPromise=X;function V(Z,G){return Z(ie=>G.fire(ie))}e.forward=V;function ue(Z,G,ie){return G(ie),Z(ee=>G(ee))}e.runAndSubscribe=ue;class ge{constructor(G,ie){this._observable=G,this._counter=0,this._hasChanged=!1;let ee={onWillAddFirstListener:()=>{G.addObserver(this)},onDidRemoveLastListener:()=>{G.removeObserver(this)}};this.emitter=new Q(ee),ie&&ie.add(this.emitter)}beginUpdate(G){this._counter++}handlePossibleChange(G){}handleChange(G,ie){this._hasChanged=!0}endUpdate(G){this._counter--,this._counter===0&&(this._observable.reportChanges(),this._hasChanged&&(this._hasChanged=!1,this.emitter.fire(this._observable.get())))}}function Ye(Z,G){return new ge(Z,G).emitter.event}e.fromObservable=Ye;function de(Z){return(G,ie,ee)=>{let R=0,I=!1,K={beginUpdate(){R++},endUpdate(){R--,R===0&&(Z.reportChanges(),I&&(I=!1,G.call(ie)))},handlePossibleChange(){},handleChange(){I=!0}};Z.addObserver(K),Z.reportChanges();let ae={dispose(){Z.removeObserver(K)}};return ee instanceof js?ee.add(ae):Array.isArray(ee)&&ee.push(ae),ae}}e.fromObservableLight=de})(kt||={});var uu=class du{constructor(i){this.listenerCount=0,this.invocationCount=0,this.elapsedOverall=0,this.durations=[],this.name=`${i}_${du._idPool++}`,du.all.add(this)}start(i){this._stopWatch=new Fb,this.listenerCount=i}stop(){if(this._stopWatch){let i=this._stopWatch.elapsed();this.durations.push(i),this.elapsedOverall+=i,this.invocationCount+=1,this._stopWatch=void 0}}};uu.all=new Set,uu._idPool=0;var Gb=uu,Xb=-1,ev=class tv{constructor(i,n,l=(tv._idPool++).toString(16).padStart(3,"0")){this._errorHandler=i,this.threshold=n,this.name=l,this._warnCountdown=0}dispose(){this._stacks?.clear()}check(i,n){let l=this.threshold;if(l<=0||n<l)return;this._stacks||(this._stacks=new Map);let o=this._stacks.get(i.value)||0;if(this._stacks.set(i.value,o+1),this._warnCountdown-=1,this._warnCountdown<=0){this._warnCountdown=l*.5;let[h,d]=this.getMostFrequentStack(),_=`[${this.name}] potential listener LEAK detected, having ${n} listeners already. MOST frequent listener (${d}):`;console.warn(_),console.warn(h);let p=new Qb(_,h);this._errorHandler(p)}return()=>{let h=this._stacks.get(i.value)||0;this._stacks.set(i.value,h-1)}}getMostFrequentStack(){if(!this._stacks)return;let i,n=0;for(let[l,o]of this._stacks)(!i||n<o)&&(i=[l,o],n=o);return i}};ev._idPool=1;var Vb=ev,Zb=class iv{constructor(i){this.value=i}static create(){let i=new Error;return new iv(i.stack??"")}print(){console.warn(this.value.split(`
|
|
90
|
+
`+e.stack):e},0)}}addListener(e){return this.listeners.push(e),()=>{this._removeListener(e)}}emit(e){this.listeners.forEach(i=>{i(e)})}_removeListener(e){this.listeners.splice(this.listeners.indexOf(e),1)}setUnexpectedErrorHandler(e){this.unexpectedErrorHandler=e}getUnexpectedErrorHandler(){return this.unexpectedErrorHandler}onUnexpectedError(e){this.unexpectedErrorHandler(e),this.emit(e)}onUnexpectedExternalError(e){this.unexpectedErrorHandler(e)}},Ub=new Hb;function Ka(e){Wb(e)||Ub.onUnexpectedError(e)}var lu="Canceled";function Wb(e){return e instanceof qb?!0:e instanceof Error&&e.name===lu&&e.message===lu}var qb=class extends Error{constructor(){super(lu),this.name=this.message}};function Pb(e){return new Error(`Illegal argument: ${e}`)}var kg=class au extends Error{constructor(i){super(i),this.name="CodeExpectedError"}static fromError(i){if(i instanceof au)return i;let n=new au;return n.message=i.message,n.stack=i.stack,n}static isErrorNoTelemetry(i){return i.name==="CodeExpectedError"}},ou=class Xm extends Error{constructor(i){super(i||"An unexpected bug occurred."),Object.setPrototypeOf(this,Xm.prototype)}};function Qt(e,i=0){return e[e.length-(1+i)]}var Ib;(e=>{function i(h){return h<0}e.isLessThan=i;function n(h){return h<=0}e.isLessThanOrEqual=n;function l(h){return h>0}e.isGreaterThan=l;function o(h){return h===0}e.isNeitherLessOrGreaterThan=o,e.greaterThan=1,e.lessThan=-1,e.neitherLessOrGreaterThan=0})(Ib||={});function Yb(e,i){let n=this,l=!1,o;return function(){return l||(l=!0,i||(o=e.apply(n,arguments))),o}}var Vm;(e=>{function i(L){return L&&typeof L=="object"&&typeof L[Symbol.iterator]=="function"}e.is=i;let n=Object.freeze([]);function l(){return n}e.empty=l;function*o(L){yield L}e.single=o;function h(L){return i(L)?L:o(L)}e.wrap=h;function d(L){return L||n}e.from=d;function*_(L){for(let H=L.length-1;H>=0;H--)yield L[H]}e.reverse=_;function p(L){return!L||L[Symbol.iterator]().next().done===!0}e.isEmpty=p;function f(L){return L[Symbol.iterator]().next().value}e.first=f;function S(L,H){let X=0;for(let V of L)if(H(V,X++))return!0;return!1}e.some=S;function y(L,H){for(let X of L)if(H(X))return X}e.find=y;function*x(L,H){for(let X of L)H(X)&&(yield X)}e.filter=x;function*C(L,H){let X=0;for(let V of L)yield H(V,X++)}e.map=C;function*b(L,H){let X=0;for(let V of L)yield*H(V,X++)}e.flatMap=b;function*T(...L){for(let H of L)yield*H}e.concat=T;function M(L,H,X){let V=X;for(let ue of L)V=H(V,ue);return V}e.reduce=M;function*A(L,H,X=L.length){for(H<0&&(H+=L.length),X<0?X+=L.length:X>L.length&&(X=L.length);H<X;H++)yield L[H]}e.slice=A;function O(L,H=Number.POSITIVE_INFINITY){let X=[];if(H===0)return[X,L];let V=L[Symbol.iterator]();for(let ue=0;ue<H;ue++){let ge=V.next();if(ge.done)return[X,e.empty()];X.push(ge.value)}return[X,{[Symbol.iterator](){return V}}]}e.consume=O;async function D(L){let H=[];for await(let X of L)H.push(X);return Promise.resolve(H)}e.asyncToArray=D})(Vm||={});function ar(e){if(Vm.is(e)){let i=[];for(let n of e)if(n)try{n.dispose()}catch(l){i.push(l)}if(i.length===1)throw i[0];if(i.length>1)throw new AggregateError(i,"Encountered errors while disposing of store");return Array.isArray(e)?[]:e}else if(e)return e.dispose(),e}function $b(...e){return $e(()=>ar(e))}function $e(e){return{dispose:Yb(()=>{e()})}}var Zm=class Qm{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{ar(this._toDispose)}finally{this._toDispose.clear()}}add(i){if(!i)return i;if(i===this)throw new Error("Cannot register a disposable on itself!");return this._isDisposed?Qm.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(i),i}delete(i){if(i){if(i===this)throw new Error("Cannot dispose a disposable on itself!");this._toDispose.delete(i),i.dispose()}}deleteAndLeak(i){i&&this._toDispose.has(i)&&(this._toDispose.delete(i),void 0)}};Zm.DISABLE_DISPOSED_WARNING=!1;var js=Zm,Se=class{constructor(){this._store=new js,this._store}dispose(){this._store.dispose()}_register(i){if(i===this)throw new Error("Cannot register a disposable on itself!");return this._store.add(i)}};Se.None=Object.freeze({dispose(){}});var Jr=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(i){this._isDisposed||i===this._value||(this._value?.dispose(),this._value=i)}clear(){this.value=void 0}dispose(){this._isDisposed=!0,this._value?.dispose(),this._value=void 0}clearAndLeak(){let i=this._value;return this._value=void 0,i}},ss=typeof window=="object"?window:globalThis,cu=class hu{constructor(i){this.element=i,this.next=hu.Undefined,this.prev=hu.Undefined}};cu.Undefined=new cu(void 0);var Fe=cu,Eg=class{constructor(){this._first=Fe.Undefined,this._last=Fe.Undefined,this._size=0}get size(){return this._size}isEmpty(){return this._first===Fe.Undefined}clear(){let e=this._first;for(;e!==Fe.Undefined;){let i=e.next;e.prev=Fe.Undefined,e.next=Fe.Undefined,e=i}this._first=Fe.Undefined,this._last=Fe.Undefined,this._size=0}unshift(e){return this._insert(e,!1)}push(e){return this._insert(e,!0)}_insert(e,i){let n=new Fe(e);if(this._first===Fe.Undefined)this._first=n,this._last=n;else if(i){let o=this._last;this._last=n,n.prev=o,o.next=n}else{let o=this._first;this._first=n,n.next=o,o.prev=n}this._size+=1;let l=!1;return()=>{l||(l=!0,this._remove(n))}}shift(){if(this._first!==Fe.Undefined){let e=this._first.element;return this._remove(this._first),e}}pop(){if(this._last!==Fe.Undefined){let e=this._last.element;return this._remove(this._last),e}}_remove(e){if(e.prev!==Fe.Undefined&&e.next!==Fe.Undefined){let i=e.prev;i.next=e.next,e.next.prev=i}else e.prev===Fe.Undefined&&e.next===Fe.Undefined?(this._first=Fe.Undefined,this._last=Fe.Undefined):e.next===Fe.Undefined?(this._last=this._last.prev,this._last.next=Fe.Undefined):e.prev===Fe.Undefined&&(this._first=this._first.next,this._first.prev=Fe.Undefined);this._size-=1}*[Symbol.iterator](){let e=this._first;for(;e!==Fe.Undefined;)yield e.element,e=e.next}},Kb=globalThis.performance&&typeof globalThis.performance.now=="function",Fb=class Jm{static create(i){return new Jm(i)}constructor(i){this._now=Kb&&i===!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}},kt;(e=>{e.None=()=>Se.None;function i(Z,G){return y(Z,()=>{},0,void 0,!0,void 0,G)}e.defer=i;function n(Z){return(G,ie=null,ee)=>{let R=!1,I;return I=Z($=>{if(!R)return I?I.dispose():R=!0,G.call(ie,$)},null,ee),R&&I.dispose(),I}}e.once=n;function l(Z,G,ie){return f((ee,R=null,I)=>Z($=>ee.call(R,G($)),null,I),ie)}e.map=l;function o(Z,G,ie){return f((ee,R=null,I)=>Z($=>{G($),ee.call(R,$)},null,I),ie)}e.forEach=o;function h(Z,G,ie){return f((ee,R=null,I)=>Z($=>G($)&&ee.call(R,$),null,I),ie)}e.filter=h;function d(Z){return Z}e.signal=d;function _(...Z){return(G,ie=null,ee)=>{let R=$b(...Z.map(I=>I($=>G.call(ie,$))));return S(R,ee)}}e.any=_;function p(Z,G,ie,ee){let R=ie;return l(Z,I=>(R=G(R,I),R),ee)}e.reduce=p;function f(Z,G){let ie,ee={onWillAddFirstListener(){ie=Z(R.fire,R)},onDidRemoveLastListener(){ie?.dispose()}},R=new Q(ee);return G?.add(R),R.event}function S(Z,G){return G instanceof Array?G.push(Z):G&&G.add(Z),Z}function y(Z,G,ie=100,ee=!1,R=!1,I,$){let ae,pe,k,P=0,J,te={leakWarningThreshold:I,onWillAddFirstListener(){ae=Z(he=>{P++,pe=G(pe,he),ee&&!k&&(oe.fire(pe),pe=void 0),J=()=>{let be=pe;pe=void 0,k=void 0,(!ee||P>1)&&oe.fire(be),P=0},typeof ie=="number"?(clearTimeout(k),k=setTimeout(J,ie)):k===void 0&&(k=0,queueMicrotask(J))})},onWillRemoveListener(){R&&P>0&&J?.()},onDidRemoveLastListener(){J=void 0,ae.dispose()}},oe=new Q(te);return $?.add(oe),oe.event}e.debounce=y;function x(Z,G=0,ie){return e.debounce(Z,(ee,R)=>ee?(ee.push(R),ee):[R],G,void 0,!0,void 0,ie)}e.accumulate=x;function C(Z,G=(ee,R)=>ee===R,ie){let ee=!0,R;return h(Z,I=>{let $=ee||!G(I,R);return ee=!1,R=I,$},ie)}e.latch=C;function b(Z,G,ie){return[e.filter(Z,G,ie),e.filter(Z,ee=>!G(ee),ie)]}e.split=b;function T(Z,G=!1,ie=[],ee){let R=ie.slice(),I=Z(pe=>{R?R.push(pe):ae.fire(pe)});ee&&ee.add(I);let $=()=>{R?.forEach(pe=>ae.fire(pe)),R=null},ae=new Q({onWillAddFirstListener(){I||(I=Z(pe=>ae.fire(pe)),ee&&ee.add(I))},onDidAddFirstListener(){R&&(G?setTimeout($):$())},onDidRemoveLastListener(){I&&I.dispose(),I=null}});return ee&&ee.add(ae),ae.event}e.buffer=T;function M(Z,G){return(ie,ee,R)=>{let I=G(new O);return Z(function($){let ae=I.evaluate($);ae!==A&&ie.call(ee,ae)},void 0,R)}}e.chain=M;let A=Symbol("HaltChainable");class O{constructor(){this.steps=[]}map(G){return this.steps.push(G),this}forEach(G){return this.steps.push(ie=>(G(ie),ie)),this}filter(G){return this.steps.push(ie=>G(ie)?ie:A),this}reduce(G,ie){let ee=ie;return this.steps.push(R=>(ee=G(ee,R),ee)),this}latch(G=(ie,ee)=>ie===ee){let ie=!0,ee;return this.steps.push(R=>{let I=ie||!G(R,ee);return ie=!1,ee=R,I?R:A}),this}evaluate(G){for(let ie of this.steps)if(G=ie(G),G===A)break;return G}}function D(Z,G,ie=ee=>ee){let ee=(...ae)=>$.fire(ie(...ae)),R=()=>Z.on(G,ee),I=()=>Z.removeListener(G,ee),$=new Q({onWillAddFirstListener:R,onDidRemoveLastListener:I});return $.event}e.fromNodeEventEmitter=D;function L(Z,G,ie=ee=>ee){let ee=(...ae)=>$.fire(ie(...ae)),R=()=>Z.addEventListener(G,ee),I=()=>Z.removeEventListener(G,ee),$=new Q({onWillAddFirstListener:R,onDidRemoveLastListener:I});return $.event}e.fromDOMEventEmitter=L;function H(Z){return new Promise(G=>n(Z)(G))}e.toPromise=H;function X(Z){let G=new Q;return Z.then(ie=>{G.fire(ie)},()=>{G.fire(void 0)}).finally(()=>{G.dispose()}),G.event}e.fromPromise=X;function V(Z,G){return Z(ie=>G.fire(ie))}e.forward=V;function ue(Z,G,ie){return G(ie),Z(ee=>G(ee))}e.runAndSubscribe=ue;class ge{constructor(G,ie){this._observable=G,this._counter=0,this._hasChanged=!1;let ee={onWillAddFirstListener:()=>{G.addObserver(this)},onDidRemoveLastListener:()=>{G.removeObserver(this)}};this.emitter=new Q(ee),ie&&ie.add(this.emitter)}beginUpdate(G){this._counter++}handlePossibleChange(G){}handleChange(G,ie){this._hasChanged=!0}endUpdate(G){this._counter--,this._counter===0&&(this._observable.reportChanges(),this._hasChanged&&(this._hasChanged=!1,this.emitter.fire(this._observable.get())))}}function Ke(Z,G){return new ge(Z,G).emitter.event}e.fromObservable=Ke;function de(Z){return(G,ie,ee)=>{let R=0,I=!1,$={beginUpdate(){R++},endUpdate(){R--,R===0&&(Z.reportChanges(),I&&(I=!1,G.call(ie)))},handlePossibleChange(){},handleChange(){I=!0}};Z.addObserver($),Z.reportChanges();let ae={dispose(){Z.removeObserver($)}};return ee instanceof js?ee.add(ae):Array.isArray(ee)&&ee.push(ae),ae}}e.fromObservableLight=de})(kt||={});var uu=class du{constructor(i){this.listenerCount=0,this.invocationCount=0,this.elapsedOverall=0,this.durations=[],this.name=`${i}_${du._idPool++}`,du.all.add(this)}start(i){this._stopWatch=new Fb,this.listenerCount=i}stop(){if(this._stopWatch){let i=this._stopWatch.elapsed();this.durations.push(i),this.elapsedOverall+=i,this.invocationCount+=1,this._stopWatch=void 0}}};uu.all=new Set,uu._idPool=0;var Gb=uu,Xb=-1,ev=class tv{constructor(i,n,l=(tv._idPool++).toString(16).padStart(3,"0")){this._errorHandler=i,this.threshold=n,this.name=l,this._warnCountdown=0}dispose(){this._stacks?.clear()}check(i,n){let l=this.threshold;if(l<=0||n<l)return;this._stacks||(this._stacks=new Map);let o=this._stacks.get(i.value)||0;if(this._stacks.set(i.value,o+1),this._warnCountdown-=1,this._warnCountdown<=0){this._warnCountdown=l*.5;let[h,d]=this.getMostFrequentStack(),_=`[${this.name}] potential listener LEAK detected, having ${n} listeners already. MOST frequent listener (${d}):`;console.warn(_),console.warn(h);let p=new Qb(_,h);this._errorHandler(p)}return()=>{let h=this._stacks.get(i.value)||0;this._stacks.set(i.value,h-1)}}getMostFrequentStack(){if(!this._stacks)return;let i,n=0;for(let[l,o]of this._stacks)(!i||n<o)&&(i=[l,o],n=o);return i}};ev._idPool=1;var Vb=ev,Zb=class iv{constructor(i){this.value=i}static create(){let i=new Error;return new iv(i.stack??"")}print(){console.warn(this.value.split(`
|
|
91
91
|
`).slice(2).join(`
|
|
92
|
-
`))}},Qb=class extends Error{constructor(e,i){super(e),this.name="ListenerLeakError",this.stack=i}},Jb=class extends Error{constructor(e,i){super(e),this.name="ListenerRefusalError",this.stack=i}},ex=0,Ih=class{constructor(e){this.value=e,this.id=ex++}},tx=2,ix,Q=class{constructor(i){this._size=0,this._options=i,this._leakageMon=this._options?.leakWarningThreshold?new Vb(i?.onListenerError??Ya,this._options?.leakWarningThreshold??Xb):void 0,this._perfMon=this._options?._profName?new Gb(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??=(i,n,l)=>{if(this._leakageMon&&this._size>this._leakageMon.threshold**2){let _=`[${this._leakageMon.name}] REFUSES to accept new listeners because it exceeded its threshold by far (${this._size} vs ${this._leakageMon.threshold})`;console.warn(_);let p=this._leakageMon.getMostFrequentStack()??["UNKNOWN stack",-1],f=new Jb(`${_}. HINT: Stack shows most frequent listener (${p[1]}-times)`,p[0]);return(this._options?.onListenerError||Ya)(f),Se.None}if(this._disposed)return Se.None;n&&(i=i.bind(n));let o=new Ih(i),h;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(o.stack=Zb.create(),h=this._leakageMon.check(o.stack,this._size+1)),this._listeners?this._listeners instanceof Ih?(this._deliveryQueue??=new sx,this._listeners=[this._listeners,o]):this._listeners.push(o):(this._options?.onWillAddFirstListener?.(this),this._listeners=o,this._options?.onDidAddFirstListener?.(this)),this._size++;let d=Ke(()=>{h?.(),this._removeListener(o)});return l instanceof js?l.add(d):Array.isArray(l)&&l.push(d),d},this._event}_removeListener(i){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 n=this._listeners,l=n.indexOf(i);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--,n[l]=void 0;let o=this._deliveryQueue.current===this;if(this._size*tx<=n.length){let h=0;for(let d=0;d<n.length;d++)n[d]?n[h++]=n[d]:o&&(this._deliveryQueue.end--,h<this._deliveryQueue.i&&this._deliveryQueue.i--);n.length=h}}_deliver(i,n){if(!i)return;let l=this._options?.onListenerError||Ya;if(!l){i.value(n);return}try{i.value(n)}catch(o){l(o)}}_deliverQueue(i){let n=i.current._listeners;for(;i.i<i.end;)this._deliver(n[i.i++],i.value);i.reset()}fire(i){if(this._deliveryQueue?.current&&(this._deliverQueue(this._deliveryQueue),this._perfMon?.stop()),this._perfMon?.start(this._size),this._listeners)if(this._listeners instanceof Ih)this._deliver(this._listeners,i);else{let n=this._deliveryQueue;n.enqueue(this,i,this._listeners.length),this._deliverQueue(n)}this._perfMon?.stop()}hasListeners(){return this._size>0}},sx=class{constructor(){this.i=-1,this.end=0}enqueue(e,i,n){this.i=0,this.end=n,this.current=e,this.value=i}reset(){this.i=this.end,this.current=void 0,this.value=void 0}},fu=class{constructor(){this.mapWindowIdToZoomLevel=new Map,this._onDidChangeZoomLevel=new Q,this.onDidChangeZoomLevel=this._onDidChangeZoomLevel.event,this.mapWindowIdToZoomFactor=new Map,this._onDidChangeFullscreen=new Q,this.onDidChangeFullscreen=this._onDidChangeFullscreen.event,this.mapWindowIdToFullScreen=new Map}getZoomLevel(i){return this.mapWindowIdToZoomLevel.get(this.getWindowId(i))??0}setZoomLevel(i,n){if(this.getZoomLevel(n)===i)return;let l=this.getWindowId(n);this.mapWindowIdToZoomLevel.set(l,i),this._onDidChangeZoomLevel.fire(l)}getZoomFactor(i){return this.mapWindowIdToZoomFactor.get(this.getWindowId(i))??1}setZoomFactor(i,n){this.mapWindowIdToZoomFactor.set(this.getWindowId(n),i)}setFullscreen(i,n){if(this.isFullscreen(n)===i)return;let l=this.getWindowId(n);this.mapWindowIdToFullScreen.set(l,i),this._onDidChangeFullscreen.fire(l)}isFullscreen(i){return!!this.mapWindowIdToFullScreen.get(this.getWindowId(i))}getWindowId(i){return i.vscodeWindowId}};fu.INSTANCE=new fu;var Ku=fu;function rx(e,i,n){typeof i=="string"&&(i=e.matchMedia(i)),i.addEventListener("change",n)}Ku.INSTANCE.onDidChangeZoomLevel;function nx(e){return Ku.INSTANCE.getZoomFactor(e)}Ku.INSTANCE.onDidChangeFullscreen;var sn=typeof navigator=="object"?navigator.userAgent:"",pu=sn.indexOf("Firefox")>=0,lx=sn.indexOf("AppleWebKit")>=0,Yu=sn.indexOf("Chrome")>=0,ax=!Yu&&sn.indexOf("Safari")>=0;sn.indexOf("Electron/")>=0;sn.indexOf("Android")>=0;var $h=!1;if(typeof ss.matchMedia=="function"){let e=ss.matchMedia("(display-mode: standalone) or (display-mode: window-controls-overlay)"),i=ss.matchMedia("(display-mode: fullscreen)");$h=e.matches,rx(ss,e,({matches:n})=>{$h&&i.matches||($h=n)})}var Qr="en",_u=!1,gu=!1,Fa=!1,sv=!1,Ua,Ga=Qr,Tg=Qr,ox,is,lr=globalThis,ei;typeof lr.vscode<"u"&&typeof lr.vscode.process<"u"?ei=lr.vscode.process:typeof process<"u"&&typeof process?.versions?.node=="string"&&(ei=process);var cx=typeof ei?.versions?.electron=="string",hx=cx&&ei?.type==="renderer";if(typeof ei=="object"){_u=ei.platform==="win32",gu=ei.platform==="darwin",Fa=ei.platform==="linux",Fa&&ei.env.SNAP&&ei.env.SNAP_REVISION,ei.env.CI||ei.env.BUILD_ARTIFACTSTAGINGDIRECTORY,Ua=Qr,Ga=Qr;let e=ei.env.VSCODE_NLS_CONFIG;if(e)try{let i=JSON.parse(e);Ua=i.userLocale,Tg=i.osLocale,Ga=i.resolvedLanguage||Qr,ox=i.languagePack?.translationsConfigFile}catch{}sv=!0}else typeof navigator=="object"&&!hx?(is=navigator.userAgent,_u=is.indexOf("Windows")>=0,gu=is.indexOf("Macintosh")>=0,(is.indexOf("Macintosh")>=0||is.indexOf("iPad")>=0||is.indexOf("iPhone")>=0)&&navigator.maxTouchPoints&&navigator.maxTouchPoints>0,Fa=is.indexOf("Linux")>=0,is?.indexOf("Mobi")>=0,Ga=globalThis._VSCODE_NLS_LANGUAGE||Qr,Ua=navigator.language.toLowerCase(),Tg=Ua):console.error("Unable to resolve platform.");var rv=_u,Oi=gu,ux=Fa,Rg=sv,Li=is,Ms=Ga,dx;(e=>{function i(){return Ms}e.value=i;function n(){return Ms.length===2?Ms==="en":Ms.length>=3?Ms[0]==="e"&&Ms[1]==="n"&&Ms[2]==="-":!1}e.isDefaultVariant=n;function l(){return Ms==="en"}e.isDefault=l})(dx||={});var fx=typeof lr.postMessage=="function"&&!lr.importScripts;(()=>{if(fx){let e=[];lr.addEventListener("message",n=>{if(n.data&&n.data.vscodeScheduleAsyncWork)for(let l=0,o=e.length;l<o;l++){let h=e[l];if(h.id===n.data.vscodeScheduleAsyncWork){e.splice(l,1),h.callback();return}}});let i=0;return n=>{let l=++i;e.push({id:l,callback:n}),lr.postMessage({vscodeScheduleAsyncWork:l},"*")}}return e=>setTimeout(e)})();var px=!!(Li&&Li.indexOf("Chrome")>=0);Li&&Li.indexOf("Firefox")>=0;!px&&Li&&Li.indexOf("Safari")>=0;Li&&Li.indexOf("Edg/")>=0;Li&&Li.indexOf("Android")>=0;var Vr=typeof navigator=="object"?navigator:{};Rg||document.queryCommandSupported&&document.queryCommandSupported("copy")||Vr&&Vr.clipboard&&Vr.clipboard.writeText,Rg||Vr&&Vr.clipboard&&Vr.clipboard.readText;var Fu=class{constructor(){this._keyCodeToStr=[],this._strToKeyCode=Object.create(null)}define(e,i){this._keyCodeToStr[e]=i,this._strToKeyCode[i.toLowerCase()]=e}keyCodeToStr(e){return this._keyCodeToStr[e]}strToKeyCode(e){return this._strToKeyCode[e.toLowerCase()]||0}},Kh=new Fu,Dg=new Fu,Bg=new Fu,_x=new Array(230),nv;(e=>{function i(_){return Kh.keyCodeToStr(_)}e.toString=i;function n(_){return Kh.strToKeyCode(_)}e.fromString=n;function l(_){return Dg.keyCodeToStr(_)}e.toUserSettingsUS=l;function o(_){return Bg.keyCodeToStr(_)}e.toUserSettingsGeneral=o;function h(_){return Dg.strToKeyCode(_)||Bg.strToKeyCode(_)}e.fromUserSettings=h;function d(_){if(_>=98&&_<=113)return null;switch(_){case 16:return"Up";case 18:return"Down";case 15:return"Left";case 17:return"Right"}return Kh.keyCodeToStr(_)}e.toElectronAccelerator=d})(nv||={});var gx=class lv{constructor(i,n,l,o,h){this.ctrlKey=i,this.shiftKey=n,this.altKey=l,this.metaKey=o,this.keyCode=h}equals(i){return i instanceof lv&&this.ctrlKey===i.ctrlKey&&this.shiftKey===i.shiftKey&&this.altKey===i.altKey&&this.metaKey===i.metaKey&&this.keyCode===i.keyCode}getHashCode(){let i=this.ctrlKey?"1":"0",n=this.shiftKey?"1":"0",l=this.altKey?"1":"0",o=this.metaKey?"1":"0";return`K${i}${n}${l}${o}${this.keyCode}`}isModifierKey(){return this.keyCode===0||this.keyCode===5||this.keyCode===57||this.keyCode===6||this.keyCode===4}toKeybinding(){return new mx([this])}isDuplicateModifierCase(){return this.ctrlKey&&this.keyCode===5||this.shiftKey&&this.keyCode===4||this.altKey&&this.keyCode===6||this.metaKey&&this.keyCode===57}},mx=class{constructor(e){if(e.length===0)throw Pb("chords");this.chords=e}getHashCode(){let e="";for(let i=0,n=this.chords.length;i<n;i++)i!==0&&(e+=";"),e+=this.chords[i].getHashCode();return e}equals(e){if(e===null||this.chords.length!==e.chords.length)return!1;for(let i=0;i<this.chords.length;i++)if(!this.chords[i].equals(e.chords[i]))return!1;return!0}};function vx(e){if(e.charCode){let n=String.fromCharCode(e.charCode).toUpperCase();return nv.fromString(n)}let i=e.keyCode;if(i===3)return 7;if(pu)switch(i){case 59:return 85;case 60:if(ux)return 97;break;case 61:return 86;case 107:return 109;case 109:return 111;case 173:return 88;case 224:if(Oi)return 57;break}else if(lx&&(Oi&&i===93||!Oi&&i===92))return 57;return _x[i]||0}var yx=Oi?256:2048,Sx=512,bx=1024,xx=Oi?2048:256,Mg=class{constructor(e){this._standardKeyboardEventBrand=!0;let i=e;this.browserEvent=i,this.target=i.target,this.ctrlKey=i.ctrlKey,this.shiftKey=i.shiftKey,this.altKey=i.altKey,this.metaKey=i.metaKey,this.altGraphKey=i.getModifierState?.("AltGraph"),this.keyCode=vx(i),this.code=i.code,this.ctrlKey=this.ctrlKey||this.keyCode===5,this.altKey=this.altKey||this.keyCode===6,this.shiftKey=this.shiftKey||this.keyCode===4,this.metaKey=this.metaKey||this.keyCode===57,this._asKeybinding=this._computeKeybinding(),this._asKeyCodeChord=this._computeKeyCodeChord()}preventDefault(){this.browserEvent&&this.browserEvent.preventDefault&&this.browserEvent.preventDefault()}stopPropagation(){this.browserEvent&&this.browserEvent.stopPropagation&&this.browserEvent.stopPropagation()}toKeyCodeChord(){return this._asKeyCodeChord}equals(e){return this._asKeybinding===e}_computeKeybinding(){let e=0;this.keyCode!==5&&this.keyCode!==4&&this.keyCode!==6&&this.keyCode!==57&&(e=this.keyCode);let i=0;return this.ctrlKey&&(i|=yx),this.altKey&&(i|=Sx),this.shiftKey&&(i|=bx),this.metaKey&&(i|=xx),i|=e,i}_computeKeyCodeChord(){let e=0;return this.keyCode!==5&&this.keyCode!==4&&this.keyCode!==6&&this.keyCode!==57&&(e=this.keyCode),new gx(this.ctrlKey,this.shiftKey,this.altKey,this.metaKey,e)}},zg=new WeakMap;function wx(e){if(!e.parent||e.parent===e)return null;try{let i=e.location,n=e.parent.location;if(i.origin!=="null"&&n.origin!=="null"&&i.origin!==n.origin)return null}catch{return null}return e.parent}var Cx=class{static getSameOriginWindowChain(e){let i=zg.get(e);if(!i){i=[],zg.set(e,i);let n=e,l;do l=wx(n),l?i.push({window:new WeakRef(n),iframeElement:n.frameElement||null}):i.push({window:new WeakRef(n),iframeElement:null}),n=l;while(n)}return i.slice(0)}static getPositionOfChildWindowRelativeToAncestorWindow(e,i){if(!i||e===i)return{top:0,left:0};let n=0,l=0,o=this.getSameOriginWindowChain(e);for(let h of o){let d=h.window.deref();if(n+=d?.scrollY??0,l+=d?.scrollX??0,d===i||!h.iframeElement)break;let _=h.iframeElement.getBoundingClientRect();n+=_.top,l+=_.left}return{top:n,left:l}}},Wa=class{constructor(i,n){this.timestamp=Date.now(),this.browserEvent=n,this.leftButton=n.button===0,this.middleButton=n.button===1,this.rightButton=n.button===2,this.buttons=n.buttons,this.target=n.target,this.detail=n.detail||1,n.type==="dblclick"&&(this.detail=2),this.ctrlKey=n.ctrlKey,this.shiftKey=n.shiftKey,this.altKey=n.altKey,this.metaKey=n.metaKey,typeof n.pageX=="number"?(this.posx=n.pageX,this.posy=n.pageY):(this.posx=n.clientX+this.target.ownerDocument.body.scrollLeft+this.target.ownerDocument.documentElement.scrollLeft,this.posy=n.clientY+this.target.ownerDocument.body.scrollTop+this.target.ownerDocument.documentElement.scrollTop);let l=Cx.getPositionOfChildWindowRelativeToAncestorWindow(i,n.view);this.posx-=l.left,this.posy-=l.top}preventDefault(){this.browserEvent.preventDefault()}stopPropagation(){this.browserEvent.stopPropagation()}},Ag=class{constructor(e,i=0,n=0){this.browserEvent=e||null,this.target=e?e.target||e.targetNode||e.srcElement:null,this.deltaY=n,this.deltaX=i;let l=!1;if(Yu){let o=navigator.userAgent.match(/Chrome\/(\d+)/);l=(o?parseInt(o[1]):123)<=122}if(e){let o=e,h=e,d=e.view?.devicePixelRatio||1;if(typeof o.wheelDeltaY<"u")l?this.deltaY=o.wheelDeltaY/(120*d):this.deltaY=o.wheelDeltaY/120;else if(typeof h.VERTICAL_AXIS<"u"&&h.axis===h.VERTICAL_AXIS)this.deltaY=-h.detail/3;else if(e.type==="wheel"){let _=e;_.deltaMode===_.DOM_DELTA_LINE?pu&&!Oi?this.deltaY=-e.deltaY/3:this.deltaY=-e.deltaY:this.deltaY=-e.deltaY/40}if(typeof o.wheelDeltaX<"u")ax&&rv?this.deltaX=-(o.wheelDeltaX/120):l?this.deltaX=o.wheelDeltaX/(120*d):this.deltaX=o.wheelDeltaX/120;else if(typeof h.HORIZONTAL_AXIS<"u"&&h.axis===h.HORIZONTAL_AXIS)this.deltaX=-e.detail/3;else if(e.type==="wheel"){let _=e;_.deltaMode===_.DOM_DELTA_LINE?pu&&!Oi?this.deltaX=-e.deltaX/3:this.deltaX=-e.deltaX:this.deltaX=-e.deltaX/40}this.deltaY===0&&this.deltaX===0&&e.wheelDelta&&(l?this.deltaY=e.wheelDelta/(120*d):this.deltaY=e.wheelDelta/120)}}preventDefault(){this.browserEvent?.preventDefault()}stopPropagation(){this.browserEvent?.stopPropagation()}},av=Object.freeze(function(e,i){let n=setTimeout(e.bind(i),0);return{dispose(){clearTimeout(n)}}}),kx;(e=>{function i(n){return n===e.None||n===e.Cancelled||n instanceof Ex?!0:!n||typeof n!="object"?!1:typeof n.isCancellationRequested=="boolean"&&typeof n.onCancellationRequested=="function"}e.isCancellationToken=i,e.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:kt.None}),e.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:av})})(kx||={});var Ex=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?av:(this._emitter||(this._emitter=new Q),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=null)}},Gu=class{constructor(i,n){this._isDisposed=!1,this._token=-1,typeof i=="function"&&typeof n=="number"&&this.setIfNotSet(i,n)}dispose(){this.cancel(),this._isDisposed=!0}cancel(){this._token!==-1&&(clearTimeout(this._token),this._token=-1)}cancelAndSet(i,n){if(this._isDisposed)throw new ou("Calling 'cancelAndSet' on a disposed TimeoutTimer");this.cancel(),this._token=setTimeout(()=>{this._token=-1,i()},n)}setIfNotSet(i,n){if(this._isDisposed)throw new ou("Calling 'setIfNotSet' on a disposed TimeoutTimer");this._token===-1&&(this._token=setTimeout(()=>{this._token=-1,i()},n))}},Tx=class{constructor(){this.disposable=void 0,this.isDisposed=!1}cancel(){this.disposable?.dispose(),this.disposable=void 0}cancelAndSet(e,i,n=globalThis){if(this.isDisposed)throw new ou("Calling 'cancelAndSet' on a disposed IntervalTimer");this.cancel();let l=n.setInterval(()=>{e()},i);this.disposable=Ke(()=>{n.clearInterval(l),this.disposable=void 0})}dispose(){this.cancel(),this.isDisposed=!0}},Rx;(e=>{async function i(l){let o,h=await Promise.all(l.map(d=>d.then(_=>_,_=>{o||(o=_)})));if(typeof o<"u")throw o;return h}e.settled=i;function n(l){return new Promise(async(o,h)=>{try{await l(o,h)}catch(d){h(d)}})}e.withAsyncBody=n})(Rx||={});var Og=class fi{static fromArray(i){return new fi(n=>{n.emitMany(i)})}static fromPromise(i){return new fi(async n=>{n.emitMany(await i)})}static fromPromises(i){return new fi(async n=>{await Promise.all(i.map(async l=>n.emitOne(await l)))})}static merge(i){return new fi(async n=>{await Promise.all(i.map(async l=>{for await(let o of l)n.emitOne(o)}))})}constructor(i,n){this._state=0,this._results=[],this._error=null,this._onReturn=n,this._onStateChanged=new Q,queueMicrotask(async()=>{let l={emitOne:o=>this.emitOne(o),emitMany:o=>this.emitMany(o),reject:o=>this.reject(o)};try{await Promise.resolve(i(l)),this.resolve()}catch(o){this.reject(o)}finally{l.emitOne=void 0,l.emitMany=void 0,l.reject=void 0}})}[Symbol.asyncIterator](){let i=0;return{next:async()=>{do{if(this._state===2)throw this._error;if(i<this._results.length)return{done:!1,value:this._results[i++]};if(this._state===1)return{done:!0,value:void 0};await kt.toPromise(this._onStateChanged.event)}while(!0)},return:async()=>(this._onReturn?.(),{done:!0,value:void 0})}}static map(i,n){return new fi(async l=>{for await(let o of i)l.emitOne(n(o))})}map(i){return fi.map(this,i)}static filter(i,n){return new fi(async l=>{for await(let o of i)n(o)&&l.emitOne(o)})}filter(i){return fi.filter(this,i)}static coalesce(i){return fi.filter(i,n=>!!n)}coalesce(){return fi.coalesce(this)}static async toPromise(i){let n=[];for await(let l of i)n.push(l);return n}toPromise(){return fi.toPromise(this)}emitOne(i){this._state===0&&(this._results.push(i),this._onStateChanged.fire())}emitMany(i){this._state===0&&(this._results=this._results.concat(i),this._onStateChanged.fire())}resolve(){this._state===0&&(this._state=1,this._onStateChanged.fire())}reject(i){this._state===0&&(this._state=2,this._error=i,this._onStateChanged.fire())}};Og.EMPTY=Og.fromArray([]);var{getWindow:Ai,getWindowId:Dx,onDidRegisterWindow:Bx}=(function(){let e=new Map,i={window:ss,disposables:new js};e.set(ss.vscodeWindowId,i);let n=new Q,l=new Q,o=new Q;function h(d,_){return(typeof d=="number"?e.get(d):void 0)??(_?i:void 0)}return{onDidRegisterWindow:n.event,onWillUnregisterWindow:o.event,onDidUnregisterWindow:l.event,registerWindow(d){if(e.has(d.vscodeWindowId))return Se.None;let _=new js,p={window:d,disposables:_.add(new js)};return e.set(d.vscodeWindowId,p),_.add(Ke(()=>{e.delete(d.vscodeWindowId),l.fire(d)})),_.add(fe(d,_t.BEFORE_UNLOAD,()=>{o.fire(d)})),n.fire(p),_},getWindows(){return e.values()},getWindowsCount(){return e.size},getWindowId(d){return d.vscodeWindowId},hasWindow(d){return e.has(d)},getWindowById:h,getWindow(d){let _=d;if(_?.ownerDocument?.defaultView)return _.ownerDocument.defaultView.window;let p=d;return p?.view?p.view.window:ss},getDocument(d){return Ai(d).document}}})(),Mx=class{constructor(e,i,n,l){this._node=e,this._type=i,this._handler=n,this._options=l||!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 fe(e,i,n,l){return new Mx(e,i,n,l)}var Lg=function(e,i,n,l){return fe(e,i,n,l)},Xu,zx=class extends Tx{constructor(e){super(),this.defaultTarget=e&&Ai(e)}cancelAndSet(e,i,n){return super.cancelAndSet(e,i,n??this.defaultTarget)}},jg=class{constructor(e,i=0){this._runner=e,this.priority=i,this._canceled=!1}dispose(){this._canceled=!0}execute(){if(!this._canceled)try{this._runner()}catch(e){Ya(e)}}static sort(e,i){return i.priority-e.priority}};(function(){let e=new Map,i=new Map,n=new Map,l=new Map,o=h=>{n.set(h,!1);let d=e.get(h)??[];for(i.set(h,d),e.set(h,[]),l.set(h,!0);d.length>0;)d.sort(jg.sort),d.shift().execute();l.set(h,!1)};Xu=(h,d,_=0)=>{let p=Dx(h),f=new jg(d,_),S=e.get(p);return S||(S=[],e.set(p,S)),S.push(f),n.get(p)||(n.set(p,!0),h.requestAnimationFrame(()=>o(p))),f}})();function Ax(e){let i=e.getBoundingClientRect(),n=Ai(e);return{left:i.left+n.scrollX,top:i.top+n.scrollY,width:i.width,height:i.height}}var _t={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"},Ox=class{constructor(e){this.domNode=e,this._maxWidth="",this._width="",this._height="",this._top="",this._left="",this._bottom="",this._right="",this._paddingTop="",this._paddingLeft="",this._paddingBottom="",this._paddingRight="",this._fontFamily="",this._fontWeight="",this._fontSize="",this._fontStyle="",this._fontFeatureSettings="",this._fontVariationSettings="",this._textDecoration="",this._lineHeight="",this._letterSpacing="",this._className="",this._display="",this._position="",this._visibility="",this._color="",this._backgroundColor="",this._layerHint=!1,this._contain="none",this._boxShadow=""}setMaxWidth(e){let i=qt(e);this._maxWidth!==i&&(this._maxWidth=i,this.domNode.style.maxWidth=this._maxWidth)}setWidth(e){let i=qt(e);this._width!==i&&(this._width=i,this.domNode.style.width=this._width)}setHeight(e){let i=qt(e);this._height!==i&&(this._height=i,this.domNode.style.height=this._height)}setTop(e){let i=qt(e);this._top!==i&&(this._top=i,this.domNode.style.top=this._top)}setLeft(e){let i=qt(e);this._left!==i&&(this._left=i,this.domNode.style.left=this._left)}setBottom(e){let i=qt(e);this._bottom!==i&&(this._bottom=i,this.domNode.style.bottom=this._bottom)}setRight(e){let i=qt(e);this._right!==i&&(this._right=i,this.domNode.style.right=this._right)}setPaddingTop(e){let i=qt(e);this._paddingTop!==i&&(this._paddingTop=i,this.domNode.style.paddingTop=this._paddingTop)}setPaddingLeft(e){let i=qt(e);this._paddingLeft!==i&&(this._paddingLeft=i,this.domNode.style.paddingLeft=this._paddingLeft)}setPaddingBottom(e){let i=qt(e);this._paddingBottom!==i&&(this._paddingBottom=i,this.domNode.style.paddingBottom=this._paddingBottom)}setPaddingRight(e){let i=qt(e);this._paddingRight!==i&&(this._paddingRight=i,this.domNode.style.paddingRight=this._paddingRight)}setFontFamily(e){this._fontFamily!==e&&(this._fontFamily=e,this.domNode.style.fontFamily=this._fontFamily)}setFontWeight(e){this._fontWeight!==e&&(this._fontWeight=e,this.domNode.style.fontWeight=this._fontWeight)}setFontSize(e){let i=qt(e);this._fontSize!==i&&(this._fontSize=i,this.domNode.style.fontSize=this._fontSize)}setFontStyle(e){this._fontStyle!==e&&(this._fontStyle=e,this.domNode.style.fontStyle=this._fontStyle)}setFontFeatureSettings(e){this._fontFeatureSettings!==e&&(this._fontFeatureSettings=e,this.domNode.style.fontFeatureSettings=this._fontFeatureSettings)}setFontVariationSettings(e){this._fontVariationSettings!==e&&(this._fontVariationSettings=e,this.domNode.style.fontVariationSettings=this._fontVariationSettings)}setTextDecoration(e){this._textDecoration!==e&&(this._textDecoration=e,this.domNode.style.textDecoration=this._textDecoration)}setLineHeight(e){let i=qt(e);this._lineHeight!==i&&(this._lineHeight=i,this.domNode.style.lineHeight=this._lineHeight)}setLetterSpacing(e){let i=qt(e);this._letterSpacing!==i&&(this._letterSpacing=i,this.domNode.style.letterSpacing=this._letterSpacing)}setClassName(e){this._className!==e&&(this._className=e,this.domNode.className=this._className)}toggleClassName(e,i){this.domNode.classList.toggle(e,i),this._className=this.domNode.className}setDisplay(e){this._display!==e&&(this._display=e,this.domNode.style.display=this._display)}setPosition(e){this._position!==e&&(this._position=e,this.domNode.style.position=this._position)}setVisibility(e){this._visibility!==e&&(this._visibility=e,this.domNode.style.visibility=this._visibility)}setColor(e){this._color!==e&&(this._color=e,this.domNode.style.color=this._color)}setBackgroundColor(e){this._backgroundColor!==e&&(this._backgroundColor=e,this.domNode.style.backgroundColor=this._backgroundColor)}setLayerHinting(e){this._layerHint!==e&&(this._layerHint=e,this.domNode.style.transform=this._layerHint?"translate3d(0px, 0px, 0px)":"")}setBoxShadow(e){this._boxShadow!==e&&(this._boxShadow=e,this.domNode.style.boxShadow=e)}setContain(e){this._contain!==e&&(this._contain=e,this.domNode.style.contain=this._contain)}setAttribute(e,i){this.domNode.setAttribute(e,i)}removeAttribute(e){this.domNode.removeAttribute(e)}appendChild(e){this.domNode.appendChild(e.domNode)}removeChild(e){this.domNode.removeChild(e.domNode)}};function qt(e){return typeof e=="number"?`${e}px`:e}function fl(e){return new Ox(e)}var ov=class{constructor(){this._hooks=new js,this._pointerMoveCallback=null,this._onStopCallback=null}dispose(){this.stopMonitoring(!1),this._hooks.dispose()}stopMonitoring(e,i){if(!this.isMonitoring())return;this._hooks.clear(),this._pointerMoveCallback=null;let n=this._onStopCallback;this._onStopCallback=null,e&&n&&n(i)}isMonitoring(){return!!this._pointerMoveCallback}startMonitoring(e,i,n,l,o){this.isMonitoring()&&this.stopMonitoring(!1),this._pointerMoveCallback=l,this._onStopCallback=o;let h=e;try{e.setPointerCapture(i),this._hooks.add(Ke(()=>{try{e.releasePointerCapture(i)}catch{}}))}catch{h=Ai(e)}this._hooks.add(fe(h,_t.POINTER_MOVE,d=>{if(d.buttons!==n){this.stopMonitoring(!0);return}d.preventDefault(),this._pointerMoveCallback(d)})),this._hooks.add(fe(h,_t.POINTER_UP,d=>this.stopMonitoring(!0)))}};function Lx(e,i,n){let l=null,o=null;if(typeof n.value=="function"?(l="value",o=n.value,o.length!==0&&console.warn("Memoize should only be used in functions with zero parameters")):typeof n.get=="function"&&(l="get",o=n.get),!o)throw new Error("not supported");let h=`$memoize$${i}`;n[l]=function(...d){return this.hasOwnProperty(h)||Object.defineProperty(this,h,{configurable:!1,enumerable:!1,writable:!1,value:o.apply(this,d)}),this[h]}}var Mi;(e=>(e.Tap="-xterm-gesturetap",e.Change="-xterm-gesturechange",e.Start="-xterm-gesturestart",e.End="-xterm-gesturesend",e.Contextmenu="-xterm-gesturecontextmenu"))(Mi||={});var al=class Rt extends Se{constructor(){super(),this.dispatched=!1,this.targets=new Eg,this.ignoreTargets=new Eg,this.activeTouches={},this.handle=null,this._lastSetTapCountTime=0,this._register(kt.runAndSubscribe(Bx,({window:i,disposables:n})=>{n.add(fe(i.document,"touchstart",l=>this.onTouchStart(l),{passive:!1})),n.add(fe(i.document,"touchend",l=>this.onTouchEnd(i,l))),n.add(fe(i.document,"touchmove",l=>this.onTouchMove(l),{passive:!1}))},{window:ss,disposables:this._store}))}static addTarget(i){if(!Rt.isTouchDevice())return Se.None;Rt.INSTANCE||(Rt.INSTANCE=new Rt);let n=Rt.INSTANCE.targets.push(i);return Ke(n)}static ignoreTarget(i){if(!Rt.isTouchDevice())return Se.None;Rt.INSTANCE||(Rt.INSTANCE=new Rt);let n=Rt.INSTANCE.ignoreTargets.push(i);return Ke(n)}static isTouchDevice(){return"ontouchstart"in ss||navigator.maxTouchPoints>0}dispose(){this.handle&&(this.handle.dispose(),this.handle=null),super.dispose()}onTouchStart(i){let n=Date.now();this.handle&&(this.handle.dispose(),this.handle=null);for(let l=0,o=i.targetTouches.length;l<o;l++){let h=i.targetTouches.item(l);this.activeTouches[h.identifier]={id:h.identifier,initialTarget:h.target,initialTimeStamp:n,initialPageX:h.pageX,initialPageY:h.pageY,rollingTimestamps:[n],rollingPageX:[h.pageX],rollingPageY:[h.pageY]};let d=this.newGestureEvent(Mi.Start,h.target);d.pageX=h.pageX,d.pageY=h.pageY,this.dispatchEvent(d)}this.dispatched&&(i.preventDefault(),i.stopPropagation(),this.dispatched=!1)}onTouchEnd(i,n){let l=Date.now(),o=Object.keys(this.activeTouches).length;for(let h=0,d=n.changedTouches.length;h<d;h++){let _=n.changedTouches.item(h);if(!this.activeTouches.hasOwnProperty(String(_.identifier))){console.warn("move of an UNKNOWN touch",_);continue}let p=this.activeTouches[_.identifier],f=Date.now()-p.initialTimeStamp;if(f<Rt.HOLD_DELAY&&Math.abs(p.initialPageX-Qt(p.rollingPageX))<30&&Math.abs(p.initialPageY-Qt(p.rollingPageY))<30){let S=this.newGestureEvent(Mi.Tap,p.initialTarget);S.pageX=Qt(p.rollingPageX),S.pageY=Qt(p.rollingPageY),this.dispatchEvent(S)}else if(f>=Rt.HOLD_DELAY&&Math.abs(p.initialPageX-Qt(p.rollingPageX))<30&&Math.abs(p.initialPageY-Qt(p.rollingPageY))<30){let S=this.newGestureEvent(Mi.Contextmenu,p.initialTarget);S.pageX=Qt(p.rollingPageX),S.pageY=Qt(p.rollingPageY),this.dispatchEvent(S)}else if(o===1){let S=Qt(p.rollingPageX),y=Qt(p.rollingPageY),x=Qt(p.rollingTimestamps)-p.rollingTimestamps[0],C=S-p.rollingPageX[0],b=y-p.rollingPageY[0],T=[...this.targets].filter(M=>p.initialTarget instanceof Node&&M.contains(p.initialTarget));this.inertia(i,T,l,Math.abs(C)/x,C>0?1:-1,S,Math.abs(b)/x,b>0?1:-1,y)}this.dispatchEvent(this.newGestureEvent(Mi.End,p.initialTarget)),delete this.activeTouches[_.identifier]}this.dispatched&&(n.preventDefault(),n.stopPropagation(),this.dispatched=!1)}newGestureEvent(i,n){let l=document.createEvent("CustomEvent");return l.initEvent(i,!1,!0),l.initialTarget=n,l.tapCount=0,l}dispatchEvent(i){if(i.type===Mi.Tap){let n=new Date().getTime(),l=0;n-this._lastSetTapCountTime>Rt.CLEAR_TAP_COUNT_TIME?l=1:l=2,this._lastSetTapCountTime=n,i.tapCount=l}else(i.type===Mi.Change||i.type===Mi.Contextmenu)&&(this._lastSetTapCountTime=0);if(i.initialTarget instanceof Node){for(let l of this.ignoreTargets)if(l.contains(i.initialTarget))return;let n=[];for(let l of this.targets)if(l.contains(i.initialTarget)){let o=0,h=i.initialTarget;for(;h&&h!==l;)o++,h=h.parentElement;n.push([o,l])}n.sort((l,o)=>l[0]-o[0]);for(let[l,o]of n)o.dispatchEvent(i),this.dispatched=!0}}inertia(i,n,l,o,h,d,_,p,f){this.handle=Xu(i,()=>{let S=Date.now(),y=S-l,x=0,C=0,b=!0;o+=Rt.SCROLL_FRICTION*y,_+=Rt.SCROLL_FRICTION*y,o>0&&(b=!1,x=h*o*y),_>0&&(b=!1,C=p*_*y);let T=this.newGestureEvent(Mi.Change);T.translationX=x,T.translationY=C,n.forEach(M=>M.dispatchEvent(T)),b||this.inertia(i,n,S,o,h,d+x,_,p,f+C)})}onTouchMove(i){let n=Date.now();for(let l=0,o=i.changedTouches.length;l<o;l++){let h=i.changedTouches.item(l);if(!this.activeTouches.hasOwnProperty(String(h.identifier))){console.warn("end of an UNKNOWN touch",h);continue}let d=this.activeTouches[h.identifier],_=this.newGestureEvent(Mi.Change,d.initialTarget);_.translationX=h.pageX-Qt(d.rollingPageX),_.translationY=h.pageY-Qt(d.rollingPageY),_.pageX=h.pageX,_.pageY=h.pageY,this.dispatchEvent(_),d.rollingPageX.length>3&&(d.rollingPageX.shift(),d.rollingPageY.shift(),d.rollingTimestamps.shift()),d.rollingPageX.push(h.pageX),d.rollingPageY.push(h.pageY),d.rollingTimestamps.push(n)}this.dispatched&&(i.preventDefault(),i.stopPropagation(),this.dispatched=!1)}};al.SCROLL_FRICTION=-.005,al.HOLD_DELAY=700,al.CLEAR_TAP_COUNT_TIME=400,Qe([Lx],al,"isTouchDevice",1);var jx=al,Vu=class extends Se{onclick(e,i){this._register(fe(e,_t.CLICK,n=>i(new Wa(Ai(e),n))))}onmousedown(e,i){this._register(fe(e,_t.MOUSE_DOWN,n=>i(new Wa(Ai(e),n))))}onmouseover(e,i){this._register(fe(e,_t.MOUSE_OVER,n=>i(new Wa(Ai(e),n))))}onmouseleave(e,i){this._register(fe(e,_t.MOUSE_LEAVE,n=>i(new Wa(Ai(e),n))))}onkeydown(e,i){this._register(fe(e,_t.KEY_DOWN,n=>i(new Mg(n))))}onkeyup(e,i){this._register(fe(e,_t.KEY_UP,n=>i(new Mg(n))))}oninput(e,i){this._register(fe(e,_t.INPUT,i))}onblur(e,i){this._register(fe(e,_t.BLUR,i))}onfocus(e,i){this._register(fe(e,_t.FOCUS,i))}onchange(e,i){this._register(fe(e,_t.CHANGE,i))}ignoreGesture(e){return jx.ignoreTarget(e)}},Ng=11,Nx=class extends Vu{constructor(e){super(),this._onActivate=e.onActivate,this.bgDomNode=document.createElement("div"),this.bgDomNode.className="arrow-background",this.bgDomNode.style.position="absolute",this.bgDomNode.style.width=e.bgWidth+"px",this.bgDomNode.style.height=e.bgHeight+"px",typeof e.top<"u"&&(this.bgDomNode.style.top="0px"),typeof e.left<"u"&&(this.bgDomNode.style.left="0px"),typeof e.bottom<"u"&&(this.bgDomNode.style.bottom="0px"),typeof e.right<"u"&&(this.bgDomNode.style.right="0px"),this.domNode=document.createElement("div"),this.domNode.className=e.className,this.domNode.style.position="absolute",this.domNode.style.width=Ng+"px",this.domNode.style.height=Ng+"px",typeof e.top<"u"&&(this.domNode.style.top=e.top+"px"),typeof e.left<"u"&&(this.domNode.style.left=e.left+"px"),typeof e.bottom<"u"&&(this.domNode.style.bottom=e.bottom+"px"),typeof e.right<"u"&&(this.domNode.style.right=e.right+"px"),this._pointerMoveMonitor=this._register(new ov),this._register(Lg(this.bgDomNode,_t.POINTER_DOWN,i=>this._arrowPointerDown(i))),this._register(Lg(this.domNode,_t.POINTER_DOWN,i=>this._arrowPointerDown(i))),this._pointerdownRepeatTimer=this._register(new zx),this._pointerdownScheduleRepeatTimer=this._register(new Gu)}_arrowPointerDown(e){if(!e.target||!(e.target instanceof Element))return;let i=()=>{this._pointerdownRepeatTimer.cancelAndSet(()=>this._onActivate(),1e3/24,Ai(e))};this._onActivate(),this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancelAndSet(i,200),this._pointerMoveMonitor.startMonitoring(e.target,e.pointerId,e.buttons,n=>{},()=>{this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancel()}),e.preventDefault()}},Hx=class mu{constructor(i,n,l,o,h,d,_){this._forceIntegerValues=i,this._scrollStateBrand=void 0,this._forceIntegerValues&&(n=n|0,l=l|0,o=o|0,h=h|0,d=d|0,_=_|0),this.rawScrollLeft=o,this.rawScrollTop=_,n<0&&(n=0),o+n>l&&(o=l-n),o<0&&(o=0),h<0&&(h=0),_+h>d&&(_=d-h),_<0&&(_=0),this.width=n,this.scrollWidth=l,this.scrollLeft=o,this.height=h,this.scrollHeight=d,this.scrollTop=_}equals(i){return this.rawScrollLeft===i.rawScrollLeft&&this.rawScrollTop===i.rawScrollTop&&this.width===i.width&&this.scrollWidth===i.scrollWidth&&this.scrollLeft===i.scrollLeft&&this.height===i.height&&this.scrollHeight===i.scrollHeight&&this.scrollTop===i.scrollTop}withScrollDimensions(i,n){return new mu(this._forceIntegerValues,typeof i.width<"u"?i.width:this.width,typeof i.scrollWidth<"u"?i.scrollWidth:this.scrollWidth,n?this.rawScrollLeft:this.scrollLeft,typeof i.height<"u"?i.height:this.height,typeof i.scrollHeight<"u"?i.scrollHeight:this.scrollHeight,n?this.rawScrollTop:this.scrollTop)}withScrollPosition(i){return new mu(this._forceIntegerValues,this.width,this.scrollWidth,typeof i.scrollLeft<"u"?i.scrollLeft:this.rawScrollLeft,this.height,this.scrollHeight,typeof i.scrollTop<"u"?i.scrollTop:this.rawScrollTop)}createScrollEvent(i,n){let l=this.width!==i.width,o=this.scrollWidth!==i.scrollWidth,h=this.scrollLeft!==i.scrollLeft,d=this.height!==i.height,_=this.scrollHeight!==i.scrollHeight,p=this.scrollTop!==i.scrollTop;return{inSmoothScrolling:n,oldWidth:i.width,oldScrollWidth:i.scrollWidth,oldScrollLeft:i.scrollLeft,width:this.width,scrollWidth:this.scrollWidth,scrollLeft:this.scrollLeft,oldHeight:i.height,oldScrollHeight:i.scrollHeight,oldScrollTop:i.scrollTop,height:this.height,scrollHeight:this.scrollHeight,scrollTop:this.scrollTop,widthChanged:l,scrollWidthChanged:o,scrollLeftChanged:h,heightChanged:d,scrollHeightChanged:_,scrollTopChanged:p}}},Ux=class extends Se{constructor(e){super(),this._scrollableBrand=void 0,this._onScroll=this._register(new Q),this.onScroll=this._onScroll.event,this._smoothScrollDuration=e.smoothScrollDuration,this._scheduleAtNextAnimationFrame=e.scheduleAtNextAnimationFrame,this._state=new Hx(e.forceIntegerValues,0,0,0,0,0,0),this._smoothScrolling=null}dispose(){this._smoothScrolling&&(this._smoothScrolling.dispose(),this._smoothScrolling=null),super.dispose()}setSmoothScrollDuration(e){this._smoothScrollDuration=e}validateScrollPosition(e){return this._state.withScrollPosition(e)}getScrollDimensions(){return this._state}setScrollDimensions(e,i){let n=this._state.withScrollDimensions(e,i);this._setState(n,!!this._smoothScrolling),this._smoothScrolling?.acceptScrollDimensions(this._state)}getFutureScrollPosition(){return this._smoothScrolling?this._smoothScrolling.to:this._state}getCurrentScrollPosition(){return this._state}setScrollPositionNow(e){let i=this._state.withScrollPosition(e);this._smoothScrolling&&(this._smoothScrolling.dispose(),this._smoothScrolling=null),this._setState(i,!1)}setScrollPositionSmooth(e,i){if(this._smoothScrollDuration===0)return this.setScrollPositionNow(e);if(this._smoothScrolling){e={scrollLeft:typeof e.scrollLeft>"u"?this._smoothScrolling.to.scrollLeft:e.scrollLeft,scrollTop:typeof e.scrollTop>"u"?this._smoothScrolling.to.scrollTop:e.scrollTop};let n=this._state.withScrollPosition(e);if(this._smoothScrolling.to.scrollLeft===n.scrollLeft&&this._smoothScrolling.to.scrollTop===n.scrollTop)return;let l;i?l=new Ug(this._smoothScrolling.from,n,this._smoothScrolling.startTime,this._smoothScrolling.duration):l=this._smoothScrolling.combine(this._state,n,this._smoothScrollDuration),this._smoothScrolling.dispose(),this._smoothScrolling=l}else{let n=this._state.withScrollPosition(e);this._smoothScrolling=Ug.start(this._state,n,this._smoothScrollDuration)}this._smoothScrolling.animationFrameDisposable=this._scheduleAtNextAnimationFrame(()=>{this._smoothScrolling&&(this._smoothScrolling.animationFrameDisposable=null,this._performSmoothScrolling())})}hasPendingScrollAnimation(){return!!this._smoothScrolling}_performSmoothScrolling(){if(!this._smoothScrolling)return;let e=this._smoothScrolling.tick(),i=this._state.withScrollPosition(e);if(this._setState(i,!0),!!this._smoothScrolling){if(e.isDone){this._smoothScrolling.dispose(),this._smoothScrolling=null;return}this._smoothScrolling.animationFrameDisposable=this._scheduleAtNextAnimationFrame(()=>{this._smoothScrolling&&(this._smoothScrolling.animationFrameDisposable=null,this._performSmoothScrolling())})}}_setState(e,i){let n=this._state;n.equals(e)||(this._state=e,this._onScroll.fire(this._state.createScrollEvent(n,i)))}},Hg=class{constructor(e,i,n){this.scrollLeft=e,this.scrollTop=i,this.isDone=n}};function Yh(e,i){let n=i-e;return function(l){return e+n*Px(l)}}function Wx(e,i,n){return function(l){return l<n?e(l/n):i((l-n)/(1-n))}}var Ug=class vu{constructor(i,n,l,o){this.from=i,this.to=n,this.duration=o,this.startTime=l,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(i,n,l){if(Math.abs(i-n)>2.5*l){let o,h;return i<n?(o=i+.75*l,h=n-.75*l):(o=i-.75*l,h=n+.75*l),Wx(Yh(i,o),Yh(h,n),.33)}return Yh(i,n)}dispose(){this.animationFrameDisposable!==null&&(this.animationFrameDisposable.dispose(),this.animationFrameDisposable=null)}acceptScrollDimensions(i){this.to=i.withScrollPosition(this.to),this._initAnimations()}tick(){return this._tick(Date.now())}_tick(i){let n=(i-this.startTime)/this.duration;if(n<1){let l=this.scrollLeft(n),o=this.scrollTop(n);return new Hg(l,o,!1)}return new Hg(this.to.scrollLeft,this.to.scrollTop,!0)}combine(i,n,l){return vu.start(i,n,l)}static start(i,n,l){l=l+10;let o=Date.now()-10;return new vu(i,n,o,l)}};function qx(e){return Math.pow(e,3)}function Px(e){return 1-qx(1-e)}var Ix=class extends Se{constructor(e,i,n){super(),this._visibility=e,this._visibleClassName=i,this._invisibleClassName=n,this._domNode=null,this._isVisible=!1,this._isNeeded=!1,this._rawShouldBeVisible=!1,this._shouldBeVisible=!1,this._revealTimer=this._register(new Gu)}setVisibility(e){this._visibility!==e&&(this._visibility=e,this._updateShouldBeVisible())}setShouldBeVisible(e){this._rawShouldBeVisible=e,this._updateShouldBeVisible()}_applyVisibilitySetting(){return this._visibility===2?!1:this._visibility===3?!0:this._rawShouldBeVisible}_updateShouldBeVisible(){let e=this._applyVisibilitySetting();this._shouldBeVisible!==e&&(this._shouldBeVisible=e,this.ensureVisibility())}setIsNeeded(e){this._isNeeded!==e&&(this._isNeeded=e,this.ensureVisibility())}setDomNode(e){this._domNode=e,this._domNode.setClassName(this._invisibleClassName),this.setShouldBeVisible(!1)}ensureVisibility(){if(!this._isNeeded){this._hide(!1);return}this._shouldBeVisible?this._reveal():this._hide(!0)}_reveal(){this._isVisible||(this._isVisible=!0,this._revealTimer.setIfNotSet(()=>{this._domNode?.setClassName(this._visibleClassName)},0))}_hide(e){this._revealTimer.cancel(),this._isVisible&&(this._isVisible=!1,this._domNode?.setClassName(this._invisibleClassName+(e?" fade":"")))}},$x=140,cv=class extends Vu{constructor(e){super(),this._lazyRender=e.lazyRender,this._host=e.host,this._scrollable=e.scrollable,this._scrollByPage=e.scrollByPage,this._scrollbarState=e.scrollbarState,this._visibilityController=this._register(new Ix(e.visibility,"visible scrollbar "+e.extraScrollbarClassName,"invisible scrollbar "+e.extraScrollbarClassName)),this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._pointerMoveMonitor=this._register(new ov),this._shouldRender=!0,this.domNode=fl(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(fe(this.domNode.domNode,_t.POINTER_DOWN,i=>this._domNodePointerDown(i)))}_createArrow(e){let i=this._register(new Nx(e));this.domNode.domNode.appendChild(i.bgDomNode),this.domNode.domNode.appendChild(i.domNode)}_createSlider(e,i,n,l){this.slider=fl(document.createElement("div")),this.slider.setClassName("slider"),this.slider.setPosition("absolute"),this.slider.setTop(e),this.slider.setLeft(i),typeof n=="number"&&this.slider.setWidth(n),typeof l=="number"&&this.slider.setHeight(l),this.slider.setLayerHinting(!0),this.slider.setContain("strict"),this.domNode.domNode.appendChild(this.slider.domNode),this._register(fe(this.slider.domNode,_t.POINTER_DOWN,o=>{o.button===0&&(o.preventDefault(),this._sliderPointerDown(o))})),this.onclick(this.slider.domNode,o=>{o.leftButton&&o.stopPropagation()})}_onElementSize(e){return this._scrollbarState.setVisibleSize(e)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}_onElementScrollSize(e){return this._scrollbarState.setScrollSize(e)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}_onElementScrollPosition(e){return this._scrollbarState.setScrollPosition(e)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}beginReveal(){this._visibilityController.setShouldBeVisible(!0)}beginHide(){this._visibilityController.setShouldBeVisible(!1)}render(){this._shouldRender&&(this._shouldRender=!1,this._renderDomNode(this._scrollbarState.getRectangleLargeSize(),this._scrollbarState.getRectangleSmallSize()),this._updateSlider(this._scrollbarState.getSliderSize(),this._scrollbarState.getArrowSize()+this._scrollbarState.getSliderPosition()))}_domNodePointerDown(e){e.target===this.domNode.domNode&&this._onPointerDown(e)}delegatePointerDown(e){let i=this.domNode.domNode.getClientRects()[0].top,n=i+this._scrollbarState.getSliderPosition(),l=i+this._scrollbarState.getSliderPosition()+this._scrollbarState.getSliderSize(),o=this._sliderPointerPosition(e);n<=o&&o<=l?e.button===0&&(e.preventDefault(),this._sliderPointerDown(e)):this._onPointerDown(e)}_onPointerDown(e){let i,n;if(e.target===this.domNode.domNode&&typeof e.offsetX=="number"&&typeof e.offsetY=="number")i=e.offsetX,n=e.offsetY;else{let o=Ax(this.domNode.domNode);i=e.pageX-o.left,n=e.pageY-o.top}let l=this._pointerDownRelativePosition(i,n);this._setDesiredScrollPositionNow(this._scrollByPage?this._scrollbarState.getDesiredScrollPositionFromOffsetPaged(l):this._scrollbarState.getDesiredScrollPositionFromOffset(l)),e.button===0&&(e.preventDefault(),this._sliderPointerDown(e))}_sliderPointerDown(e){if(!e.target||!(e.target instanceof Element))return;let i=this._sliderPointerPosition(e),n=this._sliderOrthogonalPointerPosition(e),l=this._scrollbarState.clone();this.slider.toggleClassName("active",!0),this._pointerMoveMonitor.startMonitoring(e.target,e.pointerId,e.buttons,o=>{let h=this._sliderOrthogonalPointerPosition(o),d=Math.abs(h-n);if(rv&&d>$x){this._setDesiredScrollPositionNow(l.getScrollPosition());return}let _=this._sliderPointerPosition(o)-i;this._setDesiredScrollPositionNow(l.getDesiredScrollPositionFromDelta(_))},()=>{this.slider.toggleClassName("active",!1),this._host.onDragEnd()}),this._host.onDragStart()}_setDesiredScrollPositionNow(e){let i={};this.writeScrollPosition(i,e),this._scrollable.setScrollPositionNow(i)}updateScrollbarSize(e){this._updateScrollbarSize(e),this._scrollbarState.setScrollbarSize(e),this._shouldRender=!0,this._lazyRender||this.render()}isNeeded(){return this._scrollbarState.isNeeded()}},hv=class yu{constructor(i,n,l,o,h,d){this._scrollbarSize=Math.round(n),this._oppositeScrollbarSize=Math.round(l),this._arrowSize=Math.round(i),this._visibleSize=o,this._scrollSize=h,this._scrollPosition=d,this._computedAvailableSize=0,this._computedIsNeeded=!1,this._computedSliderSize=0,this._computedSliderRatio=0,this._computedSliderPosition=0,this._refreshComputedValues()}clone(){return new yu(this._arrowSize,this._scrollbarSize,this._oppositeScrollbarSize,this._visibleSize,this._scrollSize,this._scrollPosition)}setVisibleSize(i){let n=Math.round(i);return this._visibleSize!==n?(this._visibleSize=n,this._refreshComputedValues(),!0):!1}setScrollSize(i){let n=Math.round(i);return this._scrollSize!==n?(this._scrollSize=n,this._refreshComputedValues(),!0):!1}setScrollPosition(i){let n=Math.round(i);return this._scrollPosition!==n?(this._scrollPosition=n,this._refreshComputedValues(),!0):!1}setScrollbarSize(i){this._scrollbarSize=Math.round(i)}setOppositeScrollbarSize(i){this._oppositeScrollbarSize=Math.round(i)}static _computeValues(i,n,l,o,h){let d=Math.max(0,l-i),_=Math.max(0,d-2*n),p=o>0&&o>l;if(!p)return{computedAvailableSize:Math.round(d),computedIsNeeded:p,computedSliderSize:Math.round(_),computedSliderRatio:0,computedSliderPosition:0};let f=Math.round(Math.max(20,Math.floor(l*_/o))),S=(_-f)/(o-l),y=h*S;return{computedAvailableSize:Math.round(d),computedIsNeeded:p,computedSliderSize:Math.round(f),computedSliderRatio:S,computedSliderPosition:Math.round(y)}}_refreshComputedValues(){let i=yu._computeValues(this._oppositeScrollbarSize,this._arrowSize,this._visibleSize,this._scrollSize,this._scrollPosition);this._computedAvailableSize=i.computedAvailableSize,this._computedIsNeeded=i.computedIsNeeded,this._computedSliderSize=i.computedSliderSize,this._computedSliderRatio=i.computedSliderRatio,this._computedSliderPosition=i.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(i){if(!this._computedIsNeeded)return 0;let n=i-this._arrowSize-this._computedSliderSize/2;return Math.round(n/this._computedSliderRatio)}getDesiredScrollPositionFromOffsetPaged(i){if(!this._computedIsNeeded)return 0;let n=i-this._arrowSize,l=this._scrollPosition;return n<this._computedSliderPosition?l-=this._visibleSize:l+=this._visibleSize,l}getDesiredScrollPositionFromDelta(i){if(!this._computedIsNeeded)return 0;let n=this._computedSliderPosition+i;return Math.round(n/this._computedSliderRatio)}},Kx=class extends cv{constructor(e,i,n){let l=e.getScrollDimensions(),o=e.getCurrentScrollPosition();if(super({lazyRender:i.lazyRender,host:n,scrollbarState:new hv(i.horizontalHasArrows?i.arrowSize:0,i.horizontal===2?0:i.horizontalScrollbarSize,i.vertical===2?0:i.verticalScrollbarSize,l.width,l.scrollWidth,o.scrollLeft),visibility:i.horizontal,extraScrollbarClassName:"horizontal",scrollable:e,scrollByPage:i.scrollByPage}),i.horizontalHasArrows)throw new Error("horizontalHasArrows is not supported in xterm.js");this._createSlider(Math.floor((i.horizontalScrollbarSize-i.horizontalSliderSize)/2),0,void 0,i.horizontalSliderSize)}_updateSlider(e,i){this.slider.setWidth(e),this.slider.setLeft(i)}_renderDomNode(e,i){this.domNode.setWidth(e),this.domNode.setHeight(i),this.domNode.setLeft(0),this.domNode.setBottom(0)}onDidScroll(e){return this._shouldRender=this._onElementScrollSize(e.scrollWidth)||this._shouldRender,this._shouldRender=this._onElementScrollPosition(e.scrollLeft)||this._shouldRender,this._shouldRender=this._onElementSize(e.width)||this._shouldRender,this._shouldRender}_pointerDownRelativePosition(e,i){return e}_sliderPointerPosition(e){return e.pageX}_sliderOrthogonalPointerPosition(e){return e.pageY}_updateScrollbarSize(e){this.slider.setHeight(e)}writeScrollPosition(e,i){e.scrollLeft=i}updateOptions(e){this.updateScrollbarSize(e.horizontal===2?0:e.horizontalScrollbarSize),this._scrollbarState.setOppositeScrollbarSize(e.vertical===2?0:e.verticalScrollbarSize),this._visibilityController.setVisibility(e.horizontal),this._scrollByPage=e.scrollByPage}},Yx=class extends cv{constructor(e,i,n){let l=e.getScrollDimensions(),o=e.getCurrentScrollPosition();if(super({lazyRender:i.lazyRender,host:n,scrollbarState:new hv(i.verticalHasArrows?i.arrowSize:0,i.vertical===2?0:i.verticalScrollbarSize,0,l.height,l.scrollHeight,o.scrollTop),visibility:i.vertical,extraScrollbarClassName:"vertical",scrollable:e,scrollByPage:i.scrollByPage}),i.verticalHasArrows)throw new Error("horizontalHasArrows is not supported in xterm.js");this._createSlider(0,Math.floor((i.verticalScrollbarSize-i.verticalSliderSize)/2),i.verticalSliderSize,void 0)}_updateSlider(e,i){this.slider.setHeight(e),this.slider.setTop(i)}_renderDomNode(e,i){this.domNode.setWidth(i),this.domNode.setHeight(e),this.domNode.setRight(0),this.domNode.setTop(0)}onDidScroll(e){return this._shouldRender=this._onElementScrollSize(e.scrollHeight)||this._shouldRender,this._shouldRender=this._onElementScrollPosition(e.scrollTop)||this._shouldRender,this._shouldRender=this._onElementSize(e.height)||this._shouldRender,this._shouldRender}_pointerDownRelativePosition(e,i){return i}_sliderPointerPosition(e){return e.pageY}_sliderOrthogonalPointerPosition(e){return e.pageX}_updateScrollbarSize(e){this.slider.setWidth(e)}writeScrollPosition(e,i){e.scrollTop=i}updateOptions(e){this.updateScrollbarSize(e.vertical===2?0:e.verticalScrollbarSize),this._scrollbarState.setOppositeScrollbarSize(0),this._visibilityController.setVisibility(e.vertical),this._scrollByPage=e.scrollByPage}},Fx=500,Wg=50,Gx=class{constructor(e,i,n){this.timestamp=e,this.deltaX=i,this.deltaY=n,this.score=0}},Su=class{constructor(){this._capacity=5,this._memory=[],this._front=-1,this._rear=-1}isPhysicalMouseWheel(){if(this._front===-1&&this._rear===-1)return!1;let i=1,n=0,l=1,o=this._rear;do{let h=o===this._front?i:Math.pow(2,-l);if(i-=h,n+=this._memory[o].score*h,o===this._front)break;o=(this._capacity+o-1)%this._capacity,l++}while(!0);return n<=.5}acceptStandardWheelEvent(i){if(Yu){let n=Ai(i.browserEvent),l=nx(n);this.accept(Date.now(),i.deltaX*l,i.deltaY*l)}else this.accept(Date.now(),i.deltaX,i.deltaY)}accept(i,n,l){let o=null,h=new Gx(i,n,l);this._front===-1&&this._rear===-1?(this._memory[0]=h,this._front=0,this._rear=0):(o=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,o)}_computeScore(i,n){if(Math.abs(i.deltaX)>0&&Math.abs(i.deltaY)>0)return 1;let l=.5;if((!this._isAlmostInt(i.deltaX)||!this._isAlmostInt(i.deltaY))&&(l+=.25),n){let o=Math.abs(i.deltaX),h=Math.abs(i.deltaY),d=Math.abs(n.deltaX),_=Math.abs(n.deltaY),p=Math.max(Math.min(o,d),1),f=Math.max(Math.min(h,_),1),S=Math.max(o,d),y=Math.max(h,_);S%p===0&&y%f===0&&(l-=.5)}return Math.min(Math.max(l,0),1)}_isAlmostInt(i){return Math.abs(Math.round(i)-i)<.01}};Su.INSTANCE=new Su;var Xx=Su,Vx=class extends Vu{constructor(e,i,n){super(),this._onScroll=this._register(new Q),this.onScroll=this._onScroll.event,this._onWillScroll=this._register(new Q),this.onWillScroll=this._onWillScroll.event,this._options=Qx(i),this._scrollable=n,this._register(this._scrollable.onScroll(o=>{this._onWillScroll.fire(o),this._onDidScroll(o),this._onScroll.fire(o)}));let l={onMouseWheel:o=>this._onMouseWheel(o),onDragStart:()=>this._onDragStart(),onDragEnd:()=>this._onDragEnd()};this._verticalScrollbar=this._register(new Yx(this._scrollable,this._options,l)),this._horizontalScrollbar=this._register(new Kx(this._scrollable,this._options,l)),this._domNode=document.createElement("div"),this._domNode.className="xterm-scrollable-element "+this._options.className,this._domNode.setAttribute("role","presentation"),this._domNode.style.position="relative",this._domNode.appendChild(e),this._domNode.appendChild(this._horizontalScrollbar.domNode.domNode),this._domNode.appendChild(this._verticalScrollbar.domNode.domNode),this._options.useShadows?(this._leftShadowDomNode=fl(document.createElement("div")),this._leftShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._leftShadowDomNode.domNode),this._topShadowDomNode=fl(document.createElement("div")),this._topShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._topShadowDomNode.domNode),this._topLeftShadowDomNode=fl(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,o=>this._onMouseOver(o)),this.onmouseleave(this._listenOnDomNode,o=>this._onMouseLeave(o)),this._hideTimeout=this._register(new Gu),this._isDragging=!1,this._mouseIsOver=!1,this._shouldRender=!0,this._revealOnScroll=!0}get options(){return this._options}dispose(){this._mouseWheelToDispose=ar(this._mouseWheelToDispose),super.dispose()}getDomNode(){return this._domNode}getOverviewRulerLayoutInfo(){return{parent:this._domNode,insertBefore:this._verticalScrollbar.domNode.domNode}}delegateVerticalScrollbarPointerDown(e){this._verticalScrollbar.delegatePointerDown(e)}getScrollDimensions(){return this._scrollable.getScrollDimensions()}setScrollDimensions(e){this._scrollable.setScrollDimensions(e,!1)}updateClassName(e){this._options.className=e,Oi&&(this._options.className+=" mac"),this._domNode.className="xterm-scrollable-element "+this._options.className}updateOptions(e){typeof e.handleMouseWheel<"u"&&(this._options.handleMouseWheel=e.handleMouseWheel,this._setListeningToMouseWheel(this._options.handleMouseWheel)),typeof e.mouseWheelScrollSensitivity<"u"&&(this._options.mouseWheelScrollSensitivity=e.mouseWheelScrollSensitivity),typeof e.fastScrollSensitivity<"u"&&(this._options.fastScrollSensitivity=e.fastScrollSensitivity),typeof e.scrollPredominantAxis<"u"&&(this._options.scrollPredominantAxis=e.scrollPredominantAxis),typeof e.horizontal<"u"&&(this._options.horizontal=e.horizontal),typeof e.vertical<"u"&&(this._options.vertical=e.vertical),typeof e.horizontalScrollbarSize<"u"&&(this._options.horizontalScrollbarSize=e.horizontalScrollbarSize),typeof e.verticalScrollbarSize<"u"&&(this._options.verticalScrollbarSize=e.verticalScrollbarSize),typeof e.scrollByPage<"u"&&(this._options.scrollByPage=e.scrollByPage),this._horizontalScrollbar.updateOptions(this._options),this._verticalScrollbar.updateOptions(this._options),this._options.lazyRender||this._render()}setRevealOnScroll(e){this._revealOnScroll=e}delegateScrollFromMouseWheelEvent(e){this._onMouseWheel(new Ag(e))}_setListeningToMouseWheel(e){if(this._mouseWheelToDispose.length>0!==e&&(this._mouseWheelToDispose=ar(this._mouseWheelToDispose),e)){let i=n=>{this._onMouseWheel(new Ag(n))};this._mouseWheelToDispose.push(fe(this._listenOnDomNode,_t.MOUSE_WHEEL,i,{passive:!1}))}}_onMouseWheel(e){if(e.browserEvent?.defaultPrevented)return;let i=Xx.INSTANCE;i.acceptStandardWheelEvent(e);let n=!1;if(e.deltaY||e.deltaX){let o=e.deltaY*this._options.mouseWheelScrollSensitivity,h=e.deltaX*this._options.mouseWheelScrollSensitivity;this._options.scrollPredominantAxis&&(this._options.scrollYToX&&h+o===0?h=o=0:Math.abs(o)>=Math.abs(h)?h=0:o=0),this._options.flipAxes&&([o,h]=[h,o]);let d=!Oi&&e.browserEvent&&e.browserEvent.shiftKey;(this._options.scrollYToX||d)&&!h&&(h=o,o=0),e.browserEvent&&e.browserEvent.altKey&&(h=h*this._options.fastScrollSensitivity,o=o*this._options.fastScrollSensitivity);let _=this._scrollable.getFutureScrollPosition(),p={};if(o){let f=Wg*o,S=_.scrollTop-(f<0?Math.floor(f):Math.ceil(f));this._verticalScrollbar.writeScrollPosition(p,S)}if(h){let f=Wg*h,S=_.scrollLeft-(f<0?Math.floor(f):Math.ceil(f));this._horizontalScrollbar.writeScrollPosition(p,S)}p=this._scrollable.validateScrollPosition(p),(_.scrollLeft!==p.scrollLeft||_.scrollTop!==p.scrollTop)&&(this._options.mouseWheelSmoothScroll&&i.isPhysicalMouseWheel()?this._scrollable.setScrollPositionSmooth(p):this._scrollable.setScrollPositionNow(p),n=!0)}let l=n;!l&&this._options.alwaysConsumeMouseWheel&&(l=!0),!l&&this._options.consumeMouseWheelIfScrollbarIsNeeded&&(this._verticalScrollbar.isNeeded()||this._horizontalScrollbar.isNeeded())&&(l=!0),l&&(e.preventDefault(),e.stopPropagation())}_onDidScroll(e){this._shouldRender=this._horizontalScrollbar.onDidScroll(e)||this._shouldRender,this._shouldRender=this._verticalScrollbar.onDidScroll(e)||this._shouldRender,this._options.useShadows&&(this._shouldRender=!0),this._revealOnScroll&&this._reveal(),this._options.lazyRender||this._render()}renderNow(){if(!this._options.lazyRender)throw new Error("Please use `lazyRender` together with `renderNow`!");this._render()}_render(){if(this._shouldRender&&(this._shouldRender=!1,this._horizontalScrollbar.render(),this._verticalScrollbar.render(),this._options.useShadows)){let e=this._scrollable.getCurrentScrollPosition(),i=e.scrollTop>0,n=e.scrollLeft>0,l=n?" left":"",o=i?" top":"",h=n||i?" top-left-corner":"";this._leftShadowDomNode.setClassName(`shadow${l}`),this._topShadowDomNode.setClassName(`shadow${o}`),this._topLeftShadowDomNode.setClassName(`shadow${h}${o}${l}`)}}_onDragStart(){this._isDragging=!0,this._reveal()}_onDragEnd(){this._isDragging=!1,this._hide()}_onMouseLeave(e){this._mouseIsOver=!1,this._hide()}_onMouseOver(e){this._mouseIsOver=!0,this._reveal()}_reveal(){this._verticalScrollbar.beginReveal(),this._horizontalScrollbar.beginReveal(),this._scheduleHide()}_hide(){!this._mouseIsOver&&!this._isDragging&&(this._verticalScrollbar.beginHide(),this._horizontalScrollbar.beginHide())}_scheduleHide(){!this._mouseIsOver&&!this._isDragging&&this._hideTimeout.cancelAndSet(()=>this._hide(),Fx)}},Zx=class extends Vx{constructor(e,i,n){super(e,i,n)}setScrollPosition(e){e.reuseAnimation?this._scrollable.setScrollPositionSmooth(e,e.reuseAnimation):this._scrollable.setScrollPositionNow(e)}getScrollPosition(){return this._scrollable.getCurrentScrollPosition()}};function Qx(e){let i={lazyRender:typeof e.lazyRender<"u"?e.lazyRender:!1,className:typeof e.className<"u"?e.className:"",useShadows:typeof e.useShadows<"u"?e.useShadows:!0,handleMouseWheel:typeof e.handleMouseWheel<"u"?e.handleMouseWheel:!0,flipAxes:typeof e.flipAxes<"u"?e.flipAxes:!1,consumeMouseWheelIfScrollbarIsNeeded:typeof e.consumeMouseWheelIfScrollbarIsNeeded<"u"?e.consumeMouseWheelIfScrollbarIsNeeded:!1,alwaysConsumeMouseWheel:typeof e.alwaysConsumeMouseWheel<"u"?e.alwaysConsumeMouseWheel:!1,scrollYToX:typeof e.scrollYToX<"u"?e.scrollYToX:!1,mouseWheelScrollSensitivity:typeof e.mouseWheelScrollSensitivity<"u"?e.mouseWheelScrollSensitivity:1,fastScrollSensitivity:typeof e.fastScrollSensitivity<"u"?e.fastScrollSensitivity:5,scrollPredominantAxis:typeof e.scrollPredominantAxis<"u"?e.scrollPredominantAxis:!0,mouseWheelSmoothScroll:typeof e.mouseWheelSmoothScroll<"u"?e.mouseWheelSmoothScroll:!0,arrowSize:typeof e.arrowSize<"u"?e.arrowSize:11,listenOnDomNode:typeof e.listenOnDomNode<"u"?e.listenOnDomNode:null,horizontal:typeof e.horizontal<"u"?e.horizontal:1,horizontalScrollbarSize:typeof e.horizontalScrollbarSize<"u"?e.horizontalScrollbarSize:10,horizontalSliderSize:typeof e.horizontalSliderSize<"u"?e.horizontalSliderSize:0,horizontalHasArrows:typeof e.horizontalHasArrows<"u"?e.horizontalHasArrows:!1,vertical:typeof e.vertical<"u"?e.vertical:1,verticalScrollbarSize:typeof e.verticalScrollbarSize<"u"?e.verticalScrollbarSize:10,verticalHasArrows:typeof e.verticalHasArrows<"u"?e.verticalHasArrows:!1,verticalSliderSize:typeof e.verticalSliderSize<"u"?e.verticalSliderSize:0,scrollByPage:typeof e.scrollByPage<"u"?e.scrollByPage:!1};return i.horizontalSliderSize=typeof e.horizontalSliderSize<"u"?e.horizontalSliderSize:i.horizontalScrollbarSize,i.verticalSliderSize=typeof e.verticalSliderSize<"u"?e.verticalSliderSize:i.verticalScrollbarSize,Oi&&(i.className+=" mac"),i}var bu=class extends Se{constructor(e,i,n,l,o,h,d,_){super(),this._bufferService=n,this._optionsService=d,this._renderService=_,this._onRequestScrollLines=this._register(new Q),this.onRequestScrollLines=this._onRequestScrollLines.event,this._isSyncing=!1,this._isHandlingScroll=!1,this._suppressOnScrollHandler=!1;let p=this._register(new Ux({forceIntegerValues:!1,smoothScrollDuration:this._optionsService.rawOptions.smoothScrollDuration,scheduleAtNextAnimationFrame:f=>Xu(l.window,f)}));this._register(this._optionsService.onSpecificOptionChange("smoothScrollDuration",()=>{p.setSmoothScrollDuration(this._optionsService.rawOptions.smoothScrollDuration)})),this._scrollableElement=this._register(new Zx(i,{vertical:1,horizontal:2,useShadows:!1,mouseWheelSmoothScroll:!0,...this._getChangeOptions()},p)),this._register(this._optionsService.onMultipleOptionChange(["scrollSensitivity","fastScrollSensitivity","overviewRuler"],()=>this._scrollableElement.updateOptions(this._getChangeOptions()))),this._register(o.onProtocolChange(f=>{this._scrollableElement.updateOptions({handleMouseWheel:!(f&16)})})),this._scrollableElement.setScrollDimensions({height:0,scrollHeight:0}),this._register(kt.runAndSubscribe(h.onChangeColors,()=>{this._scrollableElement.getDomNode().style.backgroundColor=h.colors.background.css})),e.appendChild(this._scrollableElement.getDomNode()),this._register(Ke(()=>this._scrollableElement.getDomNode().remove())),this._styleElement=l.mainDocument.createElement("style"),i.appendChild(this._styleElement),this._register(Ke(()=>this._styleElement.remove())),this._register(kt.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(`
|
|
93
|
-
`)})),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(f=>this._handleScroll(f)))}scrollLines(e){let i=this._scrollableElement.getScrollPosition();this._scrollableElement.setScrollPosition({reuseAnimation:!0,scrollTop:i.scrollTop+e*this._renderService.dimensions.css.cell.height})}scrollToLine(e,i){i&&(this._latestYDisp=e),this._scrollableElement.setScrollPosition({reuseAnimation:!i,scrollTop:e*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(e){e!==void 0&&(this._latestYDisp=e),this._queuedAnimationFrame===void 0&&(this._queuedAnimationFrame=this._renderService.addRefreshCallback(()=>{this._queuedAnimationFrame=void 0,this._sync(this._latestYDisp)}))}_sync(e=this._bufferService.buffer.ydisp){!this._renderService||this._isSyncing||(this._isSyncing=!0,this._suppressOnScrollHandler=!0,this._scrollableElement.setScrollDimensions({height:this._renderService.dimensions.css.canvas.height,scrollHeight:this._renderService.dimensions.css.cell.height*this._bufferService.buffer.lines.length}),this._suppressOnScrollHandler=!1,e!==this._latestYDisp&&this._scrollableElement.setScrollPosition({scrollTop:e*this._renderService.dimensions.css.cell.height}),this._isSyncing=!1)}_handleScroll(e){if(!this._renderService||this._isHandlingScroll||this._suppressOnScrollHandler)return;this._isHandlingScroll=!0;let i=Math.round(e.scrollTop/this._renderService.dimensions.css.cell.height),n=i-this._bufferService.buffer.ydisp;n!==0&&(this._latestYDisp=i,this._onRequestScrollLines.fire(n)),this._isHandlingScroll=!1}};bu=Qe([se(2,zt),se(3,rs),se(4,$m),se(5,tn),se(6,At),se(7,ns)],bu);var xu=class extends Se{constructor(e,i,n,l,o){super(),this._screenElement=e,this._bufferService=i,this._coreBrowserService=n,this._decorationService=l,this._renderService=o,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(Ke(()=>{this._container.remove(),this._decorationElements.clear()}))}_queueRefresh(){this._animationFrame===void 0&&(this._animationFrame=this._renderService.addRefreshCallback(()=>{this._doRefreshDecorations(),this._animationFrame=void 0}))}_doRefreshDecorations(){for(let e of this._decorationService.decorations)this._renderDecoration(e);this._dimensionsChanged=!1}_renderDecoration(e){this._refreshStyle(e),this._dimensionsChanged&&this._refreshXPosition(e)}_createElement(e){let i=this._coreBrowserService.mainDocument.createElement("div");i.classList.add("xterm-decoration"),i.classList.toggle("xterm-decoration-top-layer",e?.options?.layer==="top"),i.style.width=`${Math.round((e.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,i.style.height=`${(e.options.height||1)*this._renderService.dimensions.css.cell.height}px`,i.style.top=`${(e.marker.line-this._bufferService.buffers.active.ydisp)*this._renderService.dimensions.css.cell.height}px`,i.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`;let n=e.options.x??0;return n&&n>this._bufferService.cols&&(i.style.display="none"),this._refreshXPosition(e,i),i}_refreshStyle(e){let i=e.marker.line-this._bufferService.buffers.active.ydisp;if(i<0||i>=this._bufferService.rows)e.element&&(e.element.style.display="none",e.onRenderEmitter.fire(e.element));else{let n=this._decorationElements.get(e);n||(n=this._createElement(e),e.element=n,this._decorationElements.set(e,n),this._container.appendChild(n),e.onDispose(()=>{this._decorationElements.delete(e),n.remove()})),n.style.display=this._altBufferIsActive?"none":"block",this._altBufferIsActive||(n.style.width=`${Math.round((e.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,n.style.height=`${(e.options.height||1)*this._renderService.dimensions.css.cell.height}px`,n.style.top=`${i*this._renderService.dimensions.css.cell.height}px`,n.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`),e.onRenderEmitter.fire(n)}}_refreshXPosition(e,i=e.element){if(!i)return;let n=e.options.x??0;(e.options.anchor||"left")==="right"?i.style.right=n?`${n*this._renderService.dimensions.css.cell.width}px`:"":i.style.left=n?`${n*this._renderService.dimensions.css.cell.width}px`:""}_removeDecoration(e){this._decorationElements.get(e)?.remove(),this._decorationElements.delete(e),e.dispose()}};xu=Qe([se(1,zt),se(2,rs),se(3,vl),se(4,ns)],xu);var Jx=class{constructor(){this._zones=[],this._zonePool=[],this._zonePoolIndex=0,this._linePadding={full:0,left:0,center:0,right:0}}get zones(){return this._zonePool.length=Math.min(this._zonePool.length,this._zones.length),this._zones}clear(){this._zones.length=0,this._zonePoolIndex=0}addDecoration(e){if(e.options.overviewRulerOptions){for(let i of this._zones)if(i.color===e.options.overviewRulerOptions.color&&i.position===e.options.overviewRulerOptions.position){if(this._lineIntersectsZone(i,e.marker.line))return;if(this._lineAdjacentToZone(i,e.marker.line,e.options.overviewRulerOptions.position)){this._addLineToZone(i,e.marker.line);return}}if(this._zonePoolIndex<this._zonePool.length){this._zonePool[this._zonePoolIndex].color=e.options.overviewRulerOptions.color,this._zonePool[this._zonePoolIndex].position=e.options.overviewRulerOptions.position,this._zonePool[this._zonePoolIndex].startBufferLine=e.marker.line,this._zonePool[this._zonePoolIndex].endBufferLine=e.marker.line,this._zones.push(this._zonePool[this._zonePoolIndex++]);return}this._zones.push({color:e.options.overviewRulerOptions.color,position:e.options.overviewRulerOptions.position,startBufferLine:e.marker.line,endBufferLine:e.marker.line}),this._zonePool.push(this._zones[this._zones.length-1]),this._zonePoolIndex++}}setPadding(e){this._linePadding=e}_lineIntersectsZone(e,i){return i>=e.startBufferLine&&i<=e.endBufferLine}_lineAdjacentToZone(e,i,n){return i>=e.startBufferLine-this._linePadding[n||"full"]&&i<=e.endBufferLine+this._linePadding[n||"full"]}_addLineToZone(e,i){e.startBufferLine=Math.min(e.startBufferLine,i),e.endBufferLine=Math.max(e.endBufferLine,i)}},Di={full:0,left:0,center:0,right:0},zs={full:0,left:0,center:0,right:0},Jn={full:0,left:0,center:0,right:0},eo=class extends Se{constructor(e,i,n,l,o,h,d,_){super(),this._viewportElement=e,this._screenElement=i,this._bufferService=n,this._decorationService=l,this._renderService=o,this._optionsService=h,this._themeService=d,this._coreBrowserService=_,this._colorZoneStore=new Jx,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(Ke(()=>this._canvas?.remove()));let p=this._canvas.getContext("2d");if(p)this._ctx=p;else throw new Error("Ctx cannot be null");this._register(this._decorationService.onDecorationRegistered(()=>this._queueRefresh(void 0,!0))),this._register(this._decorationService.onDecorationRemoved(()=>this._queueRefresh(void 0,!0))),this._register(this._renderService.onRenderedViewportChange(()=>this._queueRefresh())),this._register(this._bufferService.buffers.onBufferActivate(()=>{this._canvas.style.display=this._bufferService.buffer===this._bufferService.buffers.alt?"none":"block"})),this._register(this._bufferService.onScroll(()=>{this._lastKnownBufferLength!==this._bufferService.buffers.normal.lines.length&&(this._refreshDrawHeightConstants(),this._refreshColorZonePadding())})),this._register(this._renderService.onRender(()=>{(!this._containerHeight||this._containerHeight!==this._screenElement.clientHeight)&&(this._queueRefresh(!0),this._containerHeight=this._screenElement.clientHeight)})),this._register(this._coreBrowserService.onDprChange(()=>this._queueRefresh(!0))),this._register(this._optionsService.onSpecificOptionChange("overviewRuler",()=>this._queueRefresh(!0))),this._register(this._themeService.onChangeColors(()=>this._queueRefresh())),this._queueRefresh(!0)}get _width(){return this._optionsService.options.overviewRuler?.width||0}_refreshDrawConstants(){let e=Math.floor((this._canvas.width-1)/3),i=Math.ceil((this._canvas.width-1)/3);zs.full=this._canvas.width,zs.left=e,zs.center=i,zs.right=e,this._refreshDrawHeightConstants(),Jn.full=1,Jn.left=1,Jn.center=1+zs.left,Jn.right=1+zs.left+zs.center}_refreshDrawHeightConstants(){Di.full=Math.round(2*this._coreBrowserService.dpr);let e=this._canvas.height/this._bufferService.buffer.lines.length,i=Math.round(Math.max(Math.min(e,12),6)*this._coreBrowserService.dpr);Di.left=i,Di.center=i,Di.right=i}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*Di.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*Di.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*Di.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*Di.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 i of this._decorationService.decorations)this._colorZoneStore.addDecoration(i);this._ctx.lineWidth=1,this._renderRulerOutline();let e=this._colorZoneStore.zones;for(let i of e)i.position!=="full"&&this._renderColorZone(i);for(let i of e)i.position==="full"&&this._renderColorZone(i);this._shouldUpdateDimensions=!1,this._shouldUpdateAnchor=!1}_renderRulerOutline(){this._ctx.fillStyle=this._themeService.colors.overviewRulerBorder.css,this._ctx.fillRect(0,0,1,this._canvas.height),this._optionsService.rawOptions.overviewRuler.showTopBorder&&this._ctx.fillRect(1,0,this._canvas.width-1,1),this._optionsService.rawOptions.overviewRuler.showBottomBorder&&this._ctx.fillRect(1,this._canvas.height-1,this._canvas.width-1,this._canvas.height)}_renderColorZone(e){this._ctx.fillStyle=e.color,this._ctx.fillRect(Jn[e.position||"full"],Math.round((this._canvas.height-1)*(e.startBufferLine/this._bufferService.buffers.active.lines.length)-Di[e.position||"full"]/2),zs[e.position||"full"],Math.round((this._canvas.height-1)*((e.endBufferLine-e.startBufferLine)/this._bufferService.buffers.active.lines.length)+Di[e.position||"full"]))}_queueRefresh(e,i){this._shouldUpdateDimensions=e||this._shouldUpdateDimensions,this._shouldUpdateAnchor=i||this._shouldUpdateAnchor,this._animationFrame===void 0&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>{this._refreshDecorations(),this._animationFrame=void 0}))}};eo=Qe([se(2,zt),se(3,vl),se(4,ns),se(5,At),se(6,tn),se(7,rs)],eo);var F;(e=>(e.NUL="\0",e.SOH="",e.STX="",e.ETX="",e.EOT="",e.ENQ="",e.ACK="",e.BEL="\x07",e.BS="\b",e.HT=" ",e.LF=`
|
|
94
|
-
`,e.VT="\v",e.FF="\f",e.CR="\r",e.SO="",e.SI="",e.DLE="",e.DC1="",e.DC2="",e.DC3="",e.DC4="",e.NAK="",e.SYN="",e.ETB="",e.CAN="",e.EM="",e.SUB="",e.ESC="\x1B",e.FS="",e.GS="",e.RS="",e.US="",e.SP=" ",e.DEL=""))(F||={});var Xa;(e=>(e.PAD="",e.HOP="",e.BPH="",e.NBH="",e.IND="",e.NEL="
",e.SSA="",e.ESA="",e.HTS="",e.HTJ="",e.VTS="",e.PLD="",e.PLU="",e.RI="",e.SS2="",e.SS3="",e.DCS="",e.PU1="",e.PU2="",e.STS="",e.CCH="",e.MW="",e.SPA="",e.EPA="",e.SOS="",e.SGCI="",e.SCI="",e.CSI="",e.ST="",e.OSC="",e.PM="",e.APC=""))(Xa||={});var uv;(e=>e.ST=`${F.ESC}\\`)(uv||={});var wu=class{constructor(e,i,n,l,o,h){this._textarea=e,this._compositionView=i,this._bufferService=n,this._optionsService=l,this._coreService=o,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(e){this._compositionView.textContent=e.data,this.updateCompositionElements(),setTimeout(()=>{this._compositionPosition.end=this._textarea.value.length},0)}compositionend(){this._finalizeComposition(!0)}keydown(e){if(this._isComposing||this._isSendingComposition){if(e.keyCode===20||e.keyCode===229||e.keyCode===16||e.keyCode===17||e.keyCode===18)return!1;this._finalizeComposition(!1)}return e.keyCode===229?(this._handleAnyTextareaChanges(),!1):!0}_finalizeComposition(e){if(this._compositionView.classList.remove("active"),this._isComposing=!1,e){let i={start:this._compositionPosition.start,end:this._compositionPosition.end};this._isSendingComposition=!0,setTimeout(()=>{if(this._isSendingComposition){this._isSendingComposition=!1;let n;i.start+=this._dataAlreadySent.length,this._isComposing?n=this._textarea.value.substring(i.start,this._compositionPosition.start):n=this._textarea.value.substring(i.start),n.length>0&&this._coreService.triggerDataEvent(n,!0)}},0)}else{this._isSendingComposition=!1;let i=this._textarea.value.substring(this._compositionPosition.start,this._compositionPosition.end);this._coreService.triggerDataEvent(i,!0)}}_handleAnyTextareaChanges(){let e=this._textarea.value;setTimeout(()=>{if(!this._isComposing){let i=this._textarea.value,n=i.replace(e,"");this._dataAlreadySent=n,i.length>e.length?this._coreService.triggerDataEvent(n,!0):i.length<e.length?this._coreService.triggerDataEvent(`${F.DEL}`,!0):i.length===e.length&&i!==e&&this._coreService.triggerDataEvent(i,!0)}},0)}updateCompositionElements(e){if(this._isComposing){if(this._bufferService.buffer.isCursorInViewport){let i=Math.min(this._bufferService.buffer.x,this._bufferService.cols-1),n=this._renderService.dimensions.css.cell.height,l=this._bufferService.buffer.y*this._renderService.dimensions.css.cell.height,o=i*this._renderService.dimensions.css.cell.width;this._compositionView.style.left=o+"px",this._compositionView.style.top=l+"px",this._compositionView.style.height=n+"px",this._compositionView.style.lineHeight=n+"px",this._compositionView.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._compositionView.style.fontSize=this._optionsService.rawOptions.fontSize+"px";let h=this._compositionView.getBoundingClientRect();this._textarea.style.left=o+"px",this._textarea.style.top=l+"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"}e||setTimeout(()=>this.updateCompositionElements(!0),0)}}};wu=Qe([se(2,zt),se(3,At),se(4,hr),se(5,ns)],wu);var gt=0,mt=0,vt=0,Ze=0,qg={css:"#00000000",rgba:0},at;(e=>{function i(o,h,d,_){return _!==void 0?`#${tr(o)}${tr(h)}${tr(d)}${tr(_)}`:`#${tr(o)}${tr(h)}${tr(d)}`}e.toCss=i;function n(o,h,d,_=255){return(o<<24|h<<16|d<<8|_)>>>0}e.toRgba=n;function l(o,h,d,_){return{css:e.toCss(o,h,d,_),rgba:e.toRgba(o,h,d,_)}}e.toColor=l})(at||={});var Ie;(e=>{function i(p,f){if(Ze=(f.rgba&255)/255,Ze===1)return{css:f.css,rgba:f.rgba};let S=f.rgba>>24&255,y=f.rgba>>16&255,x=f.rgba>>8&255,C=p.rgba>>24&255,b=p.rgba>>16&255,T=p.rgba>>8&255;gt=C+Math.round((S-C)*Ze),mt=b+Math.round((y-b)*Ze),vt=T+Math.round((x-T)*Ze);let M=at.toCss(gt,mt,vt),A=at.toRgba(gt,mt,vt);return{css:M,rgba:A}}e.blend=i;function n(p){return(p.rgba&255)===255}e.isOpaque=n;function l(p,f,S){let y=Va.ensureContrastRatio(p.rgba,f.rgba,S);if(y)return at.toColor(y>>24&255,y>>16&255,y>>8&255)}e.ensureContrastRatio=l;function o(p){let f=(p.rgba|255)>>>0;return[gt,mt,vt]=Va.toChannels(f),{css:at.toCss(gt,mt,vt),rgba:f}}e.opaque=o;function h(p,f){return Ze=Math.round(f*255),[gt,mt,vt]=Va.toChannels(p.rgba),{css:at.toCss(gt,mt,vt,Ze),rgba:at.toRgba(gt,mt,vt,Ze)}}e.opacity=h;function d(p,f){return Ze=p.rgba&255,h(p,Ze*f/255)}e.multiplyOpacity=d;function _(p){return[p.rgba>>24&255,p.rgba>>16&255,p.rgba>>8&255]}e.toColorRGB=_})(Ie||={});var Ge;(e=>{let i,n;try{let o=document.createElement("canvas");o.width=1,o.height=1;let h=o.getContext("2d",{willReadFrequently:!0});h&&(i=h,i.globalCompositeOperation="copy",n=i.createLinearGradient(0,0,1,1))}catch{}function l(o){if(o.match(/#[\da-f]{3,8}/i))switch(o.length){case 4:return gt=parseInt(o.slice(1,2).repeat(2),16),mt=parseInt(o.slice(2,3).repeat(2),16),vt=parseInt(o.slice(3,4).repeat(2),16),at.toColor(gt,mt,vt);case 5:return gt=parseInt(o.slice(1,2).repeat(2),16),mt=parseInt(o.slice(2,3).repeat(2),16),vt=parseInt(o.slice(3,4).repeat(2),16),Ze=parseInt(o.slice(4,5).repeat(2),16),at.toColor(gt,mt,vt,Ze);case 7:return{css:o,rgba:(parseInt(o.slice(1),16)<<8|255)>>>0};case 9:return{css:o,rgba:parseInt(o.slice(1),16)>>>0}}let h=o.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 gt=parseInt(h[1]),mt=parseInt(h[2]),vt=parseInt(h[3]),Ze=Math.round((h[5]===void 0?1:parseFloat(h[5]))*255),at.toColor(gt,mt,vt,Ze);if(!i||!n)throw new Error("css.toColor: Unsupported css format");if(i.fillStyle=n,i.fillStyle=o,typeof i.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(i.fillRect(0,0,1,1),[gt,mt,vt,Ze]=i.getImageData(0,0,1,1).data,Ze!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:at.toRgba(gt,mt,vt,Ze),css:o}}e.toColor=l})(Ge||={});var Bt;(e=>{function i(l){return n(l>>16&255,l>>8&255,l&255)}e.relativeLuminance=i;function n(l,o,h){let d=l/255,_=o/255,p=h/255,f=d<=.03928?d/12.92:Math.pow((d+.055)/1.055,2.4),S=_<=.03928?_/12.92:Math.pow((_+.055)/1.055,2.4),y=p<=.03928?p/12.92:Math.pow((p+.055)/1.055,2.4);return f*.2126+S*.7152+y*.0722}e.relativeLuminance2=n})(Bt||={});var Va;(e=>{function i(d,_){if(Ze=(_&255)/255,Ze===1)return _;let p=_>>24&255,f=_>>16&255,S=_>>8&255,y=d>>24&255,x=d>>16&255,C=d>>8&255;return gt=y+Math.round((p-y)*Ze),mt=x+Math.round((f-x)*Ze),vt=C+Math.round((S-C)*Ze),at.toRgba(gt,mt,vt)}e.blend=i;function n(d,_,p){let f=Bt.relativeLuminance(d>>8),S=Bt.relativeLuminance(_>>8);if(ts(f,S)<p){if(S<f){let C=l(d,_,p),b=ts(f,Bt.relativeLuminance(C>>8));if(b<p){let T=o(d,_,p),M=ts(f,Bt.relativeLuminance(T>>8));return b>M?C:T}return C}let y=o(d,_,p),x=ts(f,Bt.relativeLuminance(y>>8));if(x<p){let C=l(d,_,p),b=ts(f,Bt.relativeLuminance(C>>8));return x>b?y:C}return y}}e.ensureContrastRatio=n;function l(d,_,p){let f=d>>24&255,S=d>>16&255,y=d>>8&255,x=_>>24&255,C=_>>16&255,b=_>>8&255,T=ts(Bt.relativeLuminance2(x,C,b),Bt.relativeLuminance2(f,S,y));for(;T<p&&(x>0||C>0||b>0);)x-=Math.max(0,Math.ceil(x*.1)),C-=Math.max(0,Math.ceil(C*.1)),b-=Math.max(0,Math.ceil(b*.1)),T=ts(Bt.relativeLuminance2(x,C,b),Bt.relativeLuminance2(f,S,y));return(x<<24|C<<16|b<<8|255)>>>0}e.reduceLuminance=l;function o(d,_,p){let f=d>>24&255,S=d>>16&255,y=d>>8&255,x=_>>24&255,C=_>>16&255,b=_>>8&255,T=ts(Bt.relativeLuminance2(x,C,b),Bt.relativeLuminance2(f,S,y));for(;T<p&&(x<255||C<255||b<255);)x=Math.min(255,x+Math.ceil((255-x)*.1)),C=Math.min(255,C+Math.ceil((255-C)*.1)),b=Math.min(255,b+Math.ceil((255-b)*.1)),T=ts(Bt.relativeLuminance2(x,C,b),Bt.relativeLuminance2(f,S,y));return(x<<24|C<<16|b<<8|255)>>>0}e.increaseLuminance=o;function h(d){return[d>>24&255,d>>16&255,d>>8&255,d&255]}e.toChannels=h})(Va||={});function tr(e){let i=e.toString(16);return i.length<2?"0"+i:i}function ts(e,i){return e<i?(i+.05)/(e+.05):(e+.05)/(i+.05)}var e1=class extends ml{constructor(e,i,n){super(),this.content=0,this.combinedData="",this.fg=e.fg,this.bg=e.bg,this.combinedData=i,this._width=n}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(e){throw new Error("not implemented")}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},to=class{constructor(e){this._bufferService=e,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new gi}register(e){let i={id:this._nextCharacterJoinerId++,handler:e};return this._characterJoiners.push(i),i.id}deregister(e){for(let i=0;i<this._characterJoiners.length;i++)if(this._characterJoiners[i].id===e)return this._characterJoiners.splice(i,1),!0;return!1}getJoinedCharacters(e){if(this._characterJoiners.length===0)return[];let i=this._bufferService.buffer.lines.get(e);if(!i||i.length===0)return[];let n=[],l=i.translateToString(!0),o=0,h=0,d=0,_=i.getFg(0),p=i.getBg(0);for(let f=0;f<i.getTrimmedLength();f++)if(i.loadCell(f,this._workCell),this._workCell.getWidth()!==0){if(this._workCell.fg!==_||this._workCell.bg!==p){if(f-o>1){let S=this._getJoinedRanges(l,d,h,i,o);for(let y=0;y<S.length;y++)n.push(S[y])}o=f,d=h,_=this._workCell.fg,p=this._workCell.bg}h+=this._workCell.getChars().length||Ls.length}if(this._bufferService.cols-o>1){let f=this._getJoinedRanges(l,d,h,i,o);for(let S=0;S<f.length;S++)n.push(f[S])}return n}_getJoinedRanges(e,i,n,l,o){let h=e.substring(i,n),d=[];try{d=this._characterJoiners[0].handler(h)}catch(_){console.error(_)}for(let _=1;_<this._characterJoiners.length;_++)try{let p=this._characterJoiners[_].handler(h);for(let f=0;f<p.length;f++)to._mergeRanges(d,p[f])}catch(p){console.error(p)}return this._stringRangesToCellRanges(d,l,o),d}_stringRangesToCellRanges(e,i,n){let l=0,o=!1,h=0,d=e[l];if(d){for(let _=n;_<this._bufferService.cols;_++){let p=i.getWidth(_),f=i.getString(_).length||Ls.length;if(p!==0){if(!o&&d[0]<=h&&(d[0]=_,o=!0),d[1]<=h){if(d[1]=_,d=e[++l],!d)break;d[0]<=h?(d[0]=_,o=!0):o=!1}h+=f}}d&&(d[1]=this._bufferService.cols)}}static _mergeRanges(e,i){let n=!1;for(let l=0;l<e.length;l++){let o=e[l];if(n){if(i[1]<=o[0])return e[l-1][1]=i[1],e;if(i[1]<=o[1])return e[l-1][1]=Math.max(i[1],o[1]),e.splice(l,1),e;e.splice(l,1),l--}else{if(i[1]<=o[0])return e.splice(l,0,i),e;if(i[1]<=o[1])return o[0]=Math.min(i[0],o[0]),e;i[0]<o[1]&&(o[0]=Math.min(i[0],o[0]),n=!0);continue}}return n?e[e.length-1][1]=i[1]:e.push(i),e}};to=Qe([se(0,zt)],to);function t1(e){return 57508<=e&&e<=57558}function i1(e){return 9472<=e&&e<=9631}function s1(e){return t1(e)||i1(e)}function r1(){return{css:{canvas:qa(),cell:qa()},device:{canvas:qa(),cell:qa(),char:{width:0,height:0,left:0,top:0}}}}function qa(){return{width:0,height:0}}var Cu=class{constructor(e,i,n,l,o,h,d){this._document=e,this._characterJoinerService=i,this._optionsService=n,this._coreBrowserService=l,this._coreService=o,this._decorationService=h,this._themeService=d,this._workCell=new gi,this._columnSelectMode=!1,this.defaultSpacing=0}handleSelectionChanged(e,i,n){this._selectionStart=e,this._selectionEnd=i,this._columnSelectMode=n}createRow(e,i,n,l,o,h,d,_,p,f,S){let y=[],x=this._characterJoinerService.getJoinedCharacters(i),C=this._themeService.colors,b=e.getNoBgTrimmedLength();n&&b<h+1&&(b=h+1);let T,M=0,A="",O=0,D=0,L=0,H=0,X=!1,V=0,ue=!1,ge=0,Ye=0,de=[],Z=f!==-1&&S!==-1;for(let G=0;G<b;G++){e.loadCell(G,this._workCell);let ie=this._workCell.getWidth();if(ie===0)continue;let ee=!1,R=G>=Ye,I=G,K=this._workCell;if(x.length>0&&G===x[0][0]&&R){let Re=x.shift(),mi=this._isCellInSelection(Re[0],i);for(O=Re[0]+1;O<Re[1];O++)R&&=mi===this._isCellInSelection(O,i);R&&=!n||h<Re[0]||h>=Re[1],R?(ee=!0,K=new e1(this._workCell,e.translateToString(!0,Re[0],Re[1]),Re[1]-Re[0]),I=Re[1]-1,ie=K.getWidth()):Ye=Re[1]}let ae=this._isCellInSelection(G,i),pe=n&&G===h,k=Z&&G>=f&&G<=S,P=!1;this._decorationService.forEachDecorationAtCell(G,i,void 0,Re=>{P=!0});let J=K.getChars()||Ls;if(J===" "&&(K.isUnderline()||K.isOverline())&&(J=" "),ge=ie*_-p.get(J,K.isBold(),K.isItalic()),!T)T=this._document.createElement("span");else if(M&&(ae&&ue||!ae&&!ue&&K.bg===D)&&(ae&&ue&&C.selectionForeground||K.fg===L)&&K.extended.ext===H&&k===X&&ge===V&&!pe&&!ee&&!P&&R){K.isInvisible()?A+=Ls:A+=J,M++;continue}else M&&(T.textContent=A),T=this._document.createElement("span"),M=0,A="";if(D=K.bg,L=K.fg,H=K.extended.ext,X=k,V=ge,ue=ae,ee&&h>=G&&h<=I&&(h=G),!this._coreService.isCursorHidden&&pe&&this._coreService.isCursorInitialized){if(de.push("xterm-cursor"),this._coreBrowserService.isFocused)d&&de.push("xterm-cursor-blink"),de.push(l==="bar"?"xterm-cursor-bar":l==="underline"?"xterm-cursor-underline":"xterm-cursor-block");else if(o)switch(o){case"outline":de.push("xterm-cursor-outline");break;case"block":de.push("xterm-cursor-block");break;case"bar":de.push("xterm-cursor-bar");break;case"underline":de.push("xterm-cursor-underline");break}}if(K.isBold()&&de.push("xterm-bold"),K.isItalic()&&de.push("xterm-italic"),K.isDim()&&de.push("xterm-dim"),K.isInvisible()?A=Ls:A=K.getChars()||Ls,K.isUnderline()&&(de.push(`xterm-underline-${K.extended.underlineStyle}`),A===" "&&(A=" "),!K.isUnderlineColorDefault()))if(K.isUnderlineColorRGB())T.style.textDecorationColor=`rgb(${ml.toColorRGB(K.getUnderlineColor()).join(",")})`;else{let Re=K.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&K.isBold()&&Re<8&&(Re+=8),T.style.textDecorationColor=C.ansi[Re].css}K.isOverline()&&(de.push("xterm-overline"),A===" "&&(A=" ")),K.isStrikethrough()&&de.push("xterm-strikethrough"),k&&(T.style.textDecoration="underline");let te=K.getFgColor(),oe=K.getFgColorMode(),he=K.getBgColor(),be=K.getBgColorMode(),ot=!!K.isInverse();if(ot){let Re=te;te=he,he=Re;let mi=oe;oe=be,be=mi}let ze,wi,Ci=!1;this._decorationService.forEachDecorationAtCell(G,i,void 0,Re=>{Re.options.layer!=="top"&&Ci||(Re.backgroundColorRGB&&(be=50331648,he=Re.backgroundColorRGB.rgba>>8&16777215,ze=Re.backgroundColorRGB),Re.foregroundColorRGB&&(oe=50331648,te=Re.foregroundColorRGB.rgba>>8&16777215,wi=Re.foregroundColorRGB),Ci=Re.options.layer==="top")}),!Ci&&ae&&(ze=this._coreBrowserService.isFocused?C.selectionBackgroundOpaque:C.selectionInactiveBackgroundOpaque,he=ze.rgba>>8&16777215,be=50331648,Ci=!0,C.selectionForeground&&(oe=50331648,te=C.selectionForeground.rgba>>8&16777215,wi=C.selectionForeground)),Ci&&de.push("xterm-decoration-top");let ti;switch(be){case 16777216:case 33554432:ti=C.ansi[he],de.push(`xterm-bg-${he}`);break;case 50331648:ti=at.toColor(he>>16,he>>8&255,he&255),this._addStyle(T,`background-color:#${Pg((he>>>0).toString(16),"0",6)}`);break;default:ot?(ti=C.foreground,de.push("xterm-bg-257")):ti=C.background}switch(ze||K.isDim()&&(ze=Ie.multiplyOpacity(ti,.5)),oe){case 16777216:case 33554432:K.isBold()&&te<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(te+=8),this._applyMinimumContrast(T,ti,C.ansi[te],K,ze,void 0)||de.push(`xterm-fg-${te}`);break;case 50331648:let Re=at.toColor(te>>16&255,te>>8&255,te&255);this._applyMinimumContrast(T,ti,Re,K,ze,wi)||this._addStyle(T,`color:#${Pg(te.toString(16),"0",6)}`);break;default:this._applyMinimumContrast(T,ti,C.foreground,K,ze,wi)||ot&&de.push("xterm-fg-257")}de.length&&(T.className=de.join(" "),de.length=0),!pe&&!ee&&!P&&R?M++:T.textContent=A,ge!==this.defaultSpacing&&(T.style.letterSpacing=`${ge}px`),y.push(T),G=I}return T&&M&&(T.textContent=A),y}_applyMinimumContrast(e,i,n,l,o,h){if(this._optionsService.rawOptions.minimumContrastRatio===1||s1(l.getCode()))return!1;let d=this._getContrastCache(l),_;if(!o&&!h&&(_=d.getColor(i.rgba,n.rgba)),_===void 0){let p=this._optionsService.rawOptions.minimumContrastRatio/(l.isDim()?2:1);_=Ie.ensureContrastRatio(o||i,h||n,p),d.setColor((o||i).rgba,(h||n).rgba,_??null)}return _?(this._addStyle(e,`color:${_.css}`),!0):!1}_getContrastCache(e){return e.isDim()?this._themeService.colors.halfContrastCache:this._themeService.colors.contrastCache}_addStyle(e,i){e.setAttribute("style",`${e.getAttribute("style")||""}${i};`)}_isCellInSelection(e,i){let n=this._selectionStart,l=this._selectionEnd;return!n||!l?!1:this._columnSelectMode?n[0]<=l[0]?e>=n[0]&&i>=n[1]&&e<l[0]&&i<=l[1]:e<n[0]&&i>=n[1]&&e>=l[0]&&i<=l[1]:i>n[1]&&i<l[1]||n[1]===l[1]&&i===n[1]&&e>=n[0]&&e<l[0]||n[1]<l[1]&&i===l[1]&&e<l[0]||n[1]<l[1]&&i===n[1]&&e>=n[0]}};Cu=Qe([se(1,Fm),se(2,At),se(3,rs),se(4,hr),se(5,vl),se(6,tn)],Cu);function Pg(e,i,n){for(;e.length<n;)e=i+e;return e}var n1=class{constructor(e,i){this._flat=new Float32Array(256),this._font="",this._fontSize=0,this._weight="normal",this._weightBold="bold",this._measureElements=[],this._container=e.createElement("div"),this._container.classList.add("xterm-width-cache-measure-container"),this._container.setAttribute("aria-hidden","true"),this._container.style.whiteSpace="pre",this._container.style.fontKerning="none";let n=e.createElement("span");n.classList.add("xterm-char-measure-element");let l=e.createElement("span");l.classList.add("xterm-char-measure-element"),l.style.fontWeight="bold";let o=e.createElement("span");o.classList.add("xterm-char-measure-element"),o.style.fontStyle="italic";let h=e.createElement("span");h.classList.add("xterm-char-measure-element"),h.style.fontWeight="bold",h.style.fontStyle="italic",this._measureElements=[n,l,o,h],this._container.appendChild(n),this._container.appendChild(l),this._container.appendChild(o),this._container.appendChild(h),i.appendChild(this._container),this.clear()}dispose(){this._container.remove(),this._measureElements.length=0,this._holey=void 0}clear(){this._flat.fill(-9999),this._holey=new Map}setFont(e,i,n,l){e===this._font&&i===this._fontSize&&n===this._weight&&l===this._weightBold||(this._font=e,this._fontSize=i,this._weight=n,this._weightBold=l,this._container.style.fontFamily=this._font,this._container.style.fontSize=`${this._fontSize}px`,this._measureElements[0].style.fontWeight=`${n}`,this._measureElements[1].style.fontWeight=`${l}`,this._measureElements[2].style.fontWeight=`${n}`,this._measureElements[3].style.fontWeight=`${l}`,this.clear())}get(e,i,n){let l=0;if(!i&&!n&&e.length===1&&(l=e.charCodeAt(0))<256){if(this._flat[l]!==-9999)return this._flat[l];let d=this._measure(e,0);return d>0&&(this._flat[l]=d),d}let o=e;i&&(o+="B"),n&&(o+="I");let h=this._holey.get(o);if(h===void 0){let d=0;i&&(d|=1),n&&(d|=2),h=this._measure(e,d),h>0&&this._holey.set(o,h)}return h}_measure(e,i){let n=this._measureElements[i];return n.textContent=e.repeat(32),n.offsetWidth/32}},l1=class{constructor(){this.clear()}clear(){this.hasSelection=!1,this.columnSelectMode=!1,this.viewportStartRow=0,this.viewportEndRow=0,this.viewportCappedStartRow=0,this.viewportCappedEndRow=0,this.startCol=0,this.endCol=0,this.selectionStart=void 0,this.selectionEnd=void 0}update(e,i,n,l=!1){if(this.selectionStart=i,this.selectionEnd=n,!i||!n||i[0]===n[0]&&i[1]===n[1]){this.clear();return}let o=e.buffers.active.ydisp,h=i[1]-o,d=n[1]-o,_=Math.max(h,0),p=Math.min(d,e.rows-1);if(_>=e.rows||p<0){this.clear();return}this.hasSelection=!0,this.columnSelectMode=l,this.viewportStartRow=h,this.viewportEndRow=d,this.viewportCappedStartRow=_,this.viewportCappedEndRow=p,this.startCol=i[0],this.endCol=n[0]}isCellSelected(e,i,n){return this.hasSelection?(n-=e.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?i>=this.startCol&&n>=this.viewportCappedStartRow&&i<this.endCol&&n<=this.viewportCappedEndRow:i<this.startCol&&n>=this.viewportCappedStartRow&&i>=this.endCol&&n<=this.viewportCappedEndRow:n>this.viewportStartRow&&n<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&n===this.viewportStartRow&&i>=this.startCol&&i<this.endCol||this.viewportStartRow<this.viewportEndRow&&n===this.viewportEndRow&&i<this.endCol||this.viewportStartRow<this.viewportEndRow&&n===this.viewportStartRow&&i>=this.startCol):!1}};function a1(){return new l1}var Fh="xterm-dom-renderer-owner-",di="xterm-rows",Pa="xterm-fg-",Ig="xterm-bg-",el="xterm-focus",Ia="xterm-selection",o1=1,ku=class extends Se{constructor(e,i,n,l,o,h,d,_,p,f,S,y,x,C){super(),this._terminal=e,this._document=i,this._element=n,this._screenElement=l,this._viewportElement=o,this._helperContainer=h,this._linkifier2=d,this._charSizeService=p,this._optionsService=f,this._bufferService=S,this._coreService=y,this._coreBrowserService=x,this._themeService=C,this._terminalClass=o1++,this._rowElements=[],this._selectionRenderModel=a1(),this.onRequestRedraw=this._register(new Q).event,this._rowContainer=this._document.createElement("div"),this._rowContainer.classList.add(di),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(Ia),this._selectionContainer.setAttribute("aria-hidden","true"),this.dimensions=r1(),this._updateDimensions(),this._register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this._register(this._themeService.onChangeColors(b=>this._injectCss(b))),this._injectCss(this._themeService.colors),this._rowFactory=_.createInstance(Cu,document),this._element.classList.add(Fh+this._terminalClass),this._screenElement.appendChild(this._rowContainer),this._screenElement.appendChild(this._selectionContainer),this._register(this._linkifier2.onShowLinkUnderline(b=>this._handleLinkHover(b))),this._register(this._linkifier2.onHideLinkUnderline(b=>this._handleLinkLeave(b))),this._register(Ke(()=>{this._element.classList.remove(Fh+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()})),this._widthCache=new n1(this._document,this._helperContainer),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}_updateDimensions(){let e=this._coreBrowserService.dpr;this.dimensions.device.char.width=this._charSizeService.width*e,this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*e),this.dimensions.device.cell.width=this.dimensions.device.char.width+Math.round(this._optionsService.rawOptions.letterSpacing),this.dimensions.device.cell.height=Math.floor(this.dimensions.device.char.height*this._optionsService.rawOptions.lineHeight),this.dimensions.device.char.left=0,this.dimensions.device.char.top=0,this.dimensions.device.canvas.width=this.dimensions.device.cell.width*this._bufferService.cols,this.dimensions.device.canvas.height=this.dimensions.device.cell.height*this._bufferService.rows,this.dimensions.css.canvas.width=Math.round(this.dimensions.device.canvas.width/e),this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/e),this.dimensions.css.cell.width=this.dimensions.css.canvas.width/this._bufferService.cols,this.dimensions.css.cell.height=this.dimensions.css.canvas.height/this._bufferService.rows;for(let n of this._rowElements)n.style.width=`${this.dimensions.css.canvas.width}px`,n.style.height=`${this.dimensions.css.cell.height}px`,n.style.lineHeight=`${this.dimensions.css.cell.height}px`,n.style.overflow="hidden";this._dimensionsStyleElement||(this._dimensionsStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._dimensionsStyleElement));let i=`${this._terminalSelector} .${di} span { display: inline-block; height: 100%; vertical-align: top;}`;this._dimensionsStyleElement.textContent=i,this._selectionContainer.style.height=this._viewportElement.style.height,this._screenElement.style.width=`${this.dimensions.css.canvas.width}px`,this._screenElement.style.height=`${this.dimensions.css.canvas.height}px`}_injectCss(e){this._themeStyleElement||(this._themeStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._themeStyleElement));let i=`${this._terminalSelector} .${di} { pointer-events: none; color: ${e.foreground.css}; font-family: ${this._optionsService.rawOptions.fontFamily}; font-size: ${this._optionsService.rawOptions.fontSize}px; font-kerning: none; white-space: pre}`;i+=`${this._terminalSelector} .${di} .xterm-dim { color: ${Ie.multiplyOpacity(e.foreground,.5).css};}`,i+=`${this._terminalSelector} span:not(.xterm-bold) { font-weight: ${this._optionsService.rawOptions.fontWeight};}${this._terminalSelector} span.xterm-bold { font-weight: ${this._optionsService.rawOptions.fontWeightBold};}${this._terminalSelector} span.xterm-italic { font-style: italic;}`;let n=`blink_underline_${this._terminalClass}`,l=`blink_bar_${this._terminalClass}`,o=`blink_block_${this._terminalClass}`;i+=`@keyframes ${n} { 50% { border-bottom-style: hidden; }}`,i+=`@keyframes ${l} { 50% { box-shadow: none; }}`,i+=`@keyframes ${o} { 0% { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css}; } 50% { background-color: inherit; color: ${e.cursor.css}; }}`,i+=`${this._terminalSelector} .${di}.${el} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${n} 1s step-end infinite;}${this._terminalSelector} .${di}.${el} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${l} 1s step-end infinite;}${this._terminalSelector} .${di}.${el} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${o} 1s step-end infinite;}${this._terminalSelector} .${di} .xterm-cursor.xterm-cursor-block { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css};}${this._terminalSelector} .${di} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${e.cursor.css} !important; color: ${e.cursorAccent.css} !important;}${this._terminalSelector} .${di} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${e.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${di} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${e.cursor.css} inset;}${this._terminalSelector} .${di} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${e.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,i+=`${this._terminalSelector} .${Ia} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${Ia} div { position: absolute; background-color: ${e.selectionBackgroundOpaque.css};}${this._terminalSelector} .${Ia} div { position: absolute; background-color: ${e.selectionInactiveBackgroundOpaque.css};}`;for(let[h,d]of e.ansi.entries())i+=`${this._terminalSelector} .${Pa}${h} { color: ${d.css}; }${this._terminalSelector} .${Pa}${h}.xterm-dim { color: ${Ie.multiplyOpacity(d,.5).css}; }${this._terminalSelector} .${Ig}${h} { background-color: ${d.css}; }`;i+=`${this._terminalSelector} .${Pa}257 { color: ${Ie.opaque(e.background).css}; }${this._terminalSelector} .${Pa}257.xterm-dim { color: ${Ie.multiplyOpacity(Ie.opaque(e.background),.5).css}; }${this._terminalSelector} .${Ig}257 { background-color: ${e.foreground.css}; }`,this._themeStyleElement.textContent=i}_setDefaultSpacing(){let e=this.dimensions.css.cell.width-this._widthCache.get("W",!1,!1);this._rowContainer.style.letterSpacing=`${e}px`,this._rowFactory.defaultSpacing=e}handleDevicePixelRatioChange(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}_refreshRowElements(e,i){for(let n=this._rowElements.length;n<=i;n++){let l=this._document.createElement("div");this._rowContainer.appendChild(l),this._rowElements.push(l)}for(;this._rowElements.length>i;)this._rowContainer.removeChild(this._rowElements.pop())}handleResize(e,i){this._refreshRowElements(e,i),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(el),this.renderRows(0,this._bufferService.rows-1)}handleFocus(){this._rowContainer.classList.add(el),this.renderRows(this._bufferService.buffer.y,this._bufferService.buffer.y)}handleSelectionChanged(e,i,n){if(this._selectionContainer.replaceChildren(),this._rowFactory.handleSelectionChanged(e,i,n),this.renderRows(0,this._bufferService.rows-1),!e||!i||(this._selectionRenderModel.update(this._terminal,e,i,n),!this._selectionRenderModel.hasSelection))return;let l=this._selectionRenderModel.viewportStartRow,o=this._selectionRenderModel.viewportEndRow,h=this._selectionRenderModel.viewportCappedStartRow,d=this._selectionRenderModel.viewportCappedEndRow,_=this._document.createDocumentFragment();if(n){let p=e[0]>i[0];_.appendChild(this._createSelectionElement(h,p?i[0]:e[0],p?e[0]:i[0],d-h+1))}else{let p=l===h?e[0]:0,f=h===o?i[0]:this._bufferService.cols;_.appendChild(this._createSelectionElement(h,p,f));let S=d-h-1;if(_.appendChild(this._createSelectionElement(h+1,0,this._bufferService.cols,S)),h!==d){let y=o===d?i[0]:this._bufferService.cols;_.appendChild(this._createSelectionElement(d,0,y))}}this._selectionContainer.appendChild(_)}_createSelectionElement(e,i,n,l=1){let o=this._document.createElement("div"),h=i*this.dimensions.css.cell.width,d=this.dimensions.css.cell.width*(n-i);return h+d>this.dimensions.css.canvas.width&&(d=this.dimensions.css.canvas.width-h),o.style.height=`${l*this.dimensions.css.cell.height}px`,o.style.top=`${e*this.dimensions.css.cell.height}px`,o.style.left=`${h}px`,o.style.width=`${d}px`,o}handleCursorMove(){}_handleOptionsChanged(){this._updateDimensions(),this._injectCss(this._themeService.colors),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}clear(){for(let e of this._rowElements)e.replaceChildren()}renderRows(e,i){let n=this._bufferService.buffer,l=n.ybase+n.y,o=Math.min(n.x,this._bufferService.cols-1),h=this._coreService.decPrivateModes.cursorBlink??this._optionsService.rawOptions.cursorBlink,d=this._coreService.decPrivateModes.cursorStyle??this._optionsService.rawOptions.cursorStyle,_=this._optionsService.rawOptions.cursorInactiveStyle;for(let p=e;p<=i;p++){let f=p+n.ydisp,S=this._rowElements[p],y=n.lines.get(f);if(!S||!y)break;S.replaceChildren(...this._rowFactory.createRow(y,f,f===l,d,_,o,h,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${Fh}${this._terminalClass}`}_handleLinkHover(e){this._setCellUnderline(e.x1,e.x2,e.y1,e.y2,e.cols,!0)}_handleLinkLeave(e){this._setCellUnderline(e.x1,e.x2,e.y1,e.y2,e.cols,!1)}_setCellUnderline(e,i,n,l,o,h){n<0&&(e=0),l<0&&(i=0);let d=this._bufferService.rows-1;n=Math.max(Math.min(n,d),0),l=Math.max(Math.min(l,d),0),o=Math.min(o,this._bufferService.cols);let _=this._bufferService.buffer,p=_.ybase+_.y,f=Math.min(_.x,o-1),S=this._optionsService.rawOptions.cursorBlink,y=this._optionsService.rawOptions.cursorStyle,x=this._optionsService.rawOptions.cursorInactiveStyle;for(let C=n;C<=l;++C){let b=C+_.ydisp,T=this._rowElements[C],M=_.lines.get(b);if(!T||!M)break;T.replaceChildren(...this._rowFactory.createRow(M,b,b===p,y,x,f,S,this.dimensions.css.cell.width,this._widthCache,h?C===n?e:0:-1,h?(C===l?i:o)-1:-1))}}};ku=Qe([se(7,Iu),se(8,ho),se(9,At),se(10,zt),se(11,hr),se(12,rs),se(13,tn)],ku);var Eu=class extends Se{constructor(e,i,n){super(),this._optionsService=n,this.width=0,this.height=0,this._onCharSizeChange=this._register(new Q),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this._register(new h1(this._optionsService))}catch{this._measureStrategy=this._register(new c1(e,i,this._optionsService))}this._register(this._optionsService.onMultipleOptionChange(["fontFamily","fontSize"],()=>this.measure()))}get hasValidSize(){return this.width>0&&this.height>0}measure(){let e=this._measureStrategy.measure();(e.width!==this.width||e.height!==this.height)&&(this.width=e.width,this.height=e.height,this._onCharSizeChange.fire())}};Eu=Qe([se(2,At)],Eu);var dv=class extends Se{constructor(){super(...arguments),this._result={width:0,height:0}}_validateAndSet(e,i){e!==void 0&&e>0&&i!==void 0&&i>0&&(this._result.width=e,this._result.height=i)}},c1=class extends dv{constructor(e,i,n){super(),this._document=e,this._parentElement=i,this._optionsService=n,this._measureElement=this._document.createElement("span"),this._measureElement.classList.add("xterm-char-measure-element"),this._measureElement.textContent="W".repeat(32),this._measureElement.setAttribute("aria-hidden","true"),this._measureElement.style.whiteSpace="pre",this._measureElement.style.fontKerning="none",this._parentElement.appendChild(this._measureElement)}measure(){return this._measureElement.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._measureElement.style.fontSize=`${this._optionsService.rawOptions.fontSize}px`,this._validateAndSet(Number(this._measureElement.offsetWidth)/32,Number(this._measureElement.offsetHeight)),this._result}},h1=class extends dv{constructor(e){super(),this._optionsService=e,this._canvas=new OffscreenCanvas(100,100),this._ctx=this._canvas.getContext("2d");let i=this._ctx.measureText("W");if(!("width"in i&&"fontBoundingBoxAscent"in i&&"fontBoundingBoxDescent"in i))throw new Error("Required font metrics not supported")}measure(){this._ctx.font=`${this._optionsService.rawOptions.fontSize}px ${this._optionsService.rawOptions.fontFamily}`;let e=this._ctx.measureText("W");return this._validateAndSet(e.width,e.fontBoundingBoxAscent+e.fontBoundingBoxDescent),this._result}},u1=class extends Se{constructor(e,i,n){super(),this._textarea=e,this._window=i,this.mainDocument=n,this._isFocused=!1,this._cachedIsFocused=void 0,this._screenDprMonitor=this._register(new d1(this._window)),this._onDprChange=this._register(new Q),this.onDprChange=this._onDprChange.event,this._onWindowChange=this._register(new Q),this.onWindowChange=this._onWindowChange.event,this._register(this.onWindowChange(l=>this._screenDprMonitor.setWindow(l))),this._register(kt.forward(this._screenDprMonitor.onDprChange,this._onDprChange)),this._register(fe(this._textarea,"focus",()=>this._isFocused=!0)),this._register(fe(this._textarea,"blur",()=>this._isFocused=!1))}get window(){return this._window}set window(e){this._window!==e&&(this._window=e,this._onWindowChange.fire(this._window))}get dpr(){return this.window.devicePixelRatio}get isFocused(){return this._cachedIsFocused===void 0&&(this._cachedIsFocused=this._isFocused&&this._textarea.ownerDocument.hasFocus(),queueMicrotask(()=>this._cachedIsFocused=void 0)),this._cachedIsFocused}},d1=class extends Se{constructor(e){super(),this._parentWindow=e,this._windowResizeListener=this._register(new Jr),this._onDprChange=this._register(new Q),this.onDprChange=this._onDprChange.event,this._outerListener=()=>this._setDprAndFireIfDiffers(),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._updateDpr(),this._setWindowResizeListener(),this._register(Ke(()=>this.clearListener()))}setWindow(e){this._parentWindow=e,this._setWindowResizeListener(),this._setDprAndFireIfDiffers()}_setWindowResizeListener(){this._windowResizeListener.value=fe(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)}},f1=class extends Se{constructor(){super(),this.linkProviders=[],this._register(Ke(()=>this.linkProviders.length=0))}registerLinkProvider(e){return this.linkProviders.push(e),{dispose:()=>{let i=this.linkProviders.indexOf(e);i!==-1&&this.linkProviders.splice(i,1)}}}};function Zu(e,i,n){let l=n.getBoundingClientRect(),o=e.getComputedStyle(n),h=parseInt(o.getPropertyValue("padding-left")),d=parseInt(o.getPropertyValue("padding-top"));return[i.clientX-l.left-h,i.clientY-l.top-d]}function p1(e,i,n,l,o,h,d,_,p){if(!h)return;let f=Zu(e,i,n);if(f)return f[0]=Math.ceil((f[0]+(p?d/2:0))/d),f[1]=Math.ceil(f[1]/_),f[0]=Math.min(Math.max(f[0],1),l+(p?1:0)),f[1]=Math.min(Math.max(f[1],1),o),f}var Tu=class{constructor(e,i){this._renderService=e,this._charSizeService=i}getCoords(e,i,n,l,o){return p1(window,e,i,n,l,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,o)}getMouseReportCoords(e,i){let n=Zu(window,e,i);if(this._charSizeService.hasValidSize)return n[0]=Math.min(Math.max(n[0],0),this._renderService.dimensions.css.canvas.width-1),n[1]=Math.min(Math.max(n[1],0),this._renderService.dimensions.css.canvas.height-1),{col:Math.floor(n[0]/this._renderService.dimensions.css.cell.width),row:Math.floor(n[1]/this._renderService.dimensions.css.cell.height),x:Math.floor(n[0]),y:Math.floor(n[1])}}};Tu=Qe([se(0,ns),se(1,ho)],Tu);var _1=class{constructor(e,i){this._renderCallback=e,this._coreBrowserService=i,this._refreshCallbacks=[]}dispose(){this._animationFrame&&(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}addRefreshCallback(e){return this._refreshCallbacks.push(e),this._animationFrame||(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._innerRefresh())),this._animationFrame}refresh(e,i,n){this._rowCount=n,e=e!==void 0?e:0,i=i!==void 0?i:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,e):e,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,i):i,!this._animationFrame&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._innerRefresh()))}_innerRefresh(){if(this._animationFrame=void 0,this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0){this._runRefreshCallbacks();return}let e=Math.max(this._rowStart,0),i=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(e,i),this._runRefreshCallbacks()}_runRefreshCallbacks(){for(let e of this._refreshCallbacks)e(0);this._refreshCallbacks=[]}},fv={};kb(fv,{getSafariVersion:()=>m1,isChromeOS:()=>mv,isFirefox:()=>pv,isIpad:()=>v1,isIphone:()=>y1,isLegacyEdge:()=>g1,isLinux:()=>Qu,isMac:()=>io,isNode:()=>uo,isSafari:()=>_v,isWindows:()=>gv});var uo=typeof process<"u"&&"title"in process,yl=uo?"node":navigator.userAgent,Sl=uo?"node":navigator.platform,pv=yl.includes("Firefox"),g1=yl.includes("Edge"),_v=/^((?!chrome|android).)*safari/i.test(yl);function m1(){if(!_v)return 0;let e=yl.match(/Version\/(\d+)/);return e===null||e.length<2?0:parseInt(e[1])}var io=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(Sl),v1=Sl==="iPad",y1=Sl==="iPhone",gv=["Windows","Win16","Win32","WinCE"].includes(Sl),Qu=Sl.indexOf("Linux")>=0,mv=/\bCrOS\b/.test(yl),vv=class{constructor(){this._tasks=[],this._i=0}enqueue(e){this._tasks.push(e),this._start()}flush(){for(;this._i<this._tasks.length;)this._tasks[this._i]()||this._i++;this.clear()}clear(){this._idleCallback&&(this._cancelCallback(this._idleCallback),this._idleCallback=void 0),this._i=0,this._tasks.length=0}_start(){this._idleCallback||(this._idleCallback=this._requestCallback(this._process.bind(this)))}_process(e){this._idleCallback=void 0;let i=0,n=0,l=e.timeRemaining(),o=0;for(;this._i<this._tasks.length;){if(i=performance.now(),this._tasks[this._i]()||this._i++,i=Math.max(1,performance.now()-i),n=Math.max(i,n),o=e.timeRemaining(),n*1.5>o){l-i<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(l-i))}ms`),this._start();return}l=o}this.clear()}},S1=class extends vv{_requestCallback(e){return setTimeout(()=>e(this._createDeadline(16)))}_cancelCallback(e){clearTimeout(e)}_createDeadline(e){let i=performance.now()+e;return{timeRemaining:()=>Math.max(0,i-performance.now())}}},b1=class extends vv{_requestCallback(e){return requestIdleCallback(e)}_cancelCallback(e){cancelIdleCallback(e)}},so=!uo&&"requestIdleCallback"in window?b1:S1,x1=class{constructor(){this._queue=new so}set(e){this._queue.clear(),this._queue.enqueue(e)}flush(){this._queue.flush()}},Ru=class extends Se{constructor(e,i,n,l,o,h,d,_,p){super(),this._rowCount=e,this._optionsService=n,this._charSizeService=l,this._coreService=o,this._coreBrowserService=_,this._renderer=this._register(new Jr),this._pausedResizeTask=new x1,this._observerDisposable=this._register(new Jr),this._isPaused=!1,this._needsFullRefresh=!1,this._isNextRenderRedrawOnly=!0,this._needsSelectionRefresh=!1,this._canvasWidth=0,this._canvasHeight=0,this._selectionState={start:void 0,end:void 0,columnSelectMode:!1},this._onDimensionsChange=this._register(new Q),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this._register(new Q),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this._register(new Q),this.onRender=this._onRender.event,this._onRefreshRequest=this._register(new Q),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new _1((f,S)=>this._renderRows(f,S),this._coreBrowserService),this._register(this._renderDebouncer),this._syncOutputHandler=new w1(this._coreBrowserService,this._coreService,()=>this._fullRefresh()),this._register(Ke(()=>this._syncOutputHandler.dispose())),this._register(this._coreBrowserService.onDprChange(()=>this.handleDevicePixelRatioChange())),this._register(d.onResize(()=>this._fullRefresh())),this._register(d.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(d.cols,d.rows),this._fullRefresh()})),this._register(this._optionsService.onMultipleOptionChange(["cursorBlink","cursorStyle"],()=>this.refreshRows(d.buffer.y,d.buffer.y,!0))),this._register(p.onChangeColors(()=>this._fullRefresh())),this._registerIntersectionObserver(this._coreBrowserService.window,i),this._register(this._coreBrowserService.onWindowChange(f=>this._registerIntersectionObserver(f,i)))}get dimensions(){return this._renderer.value.dimensions}_registerIntersectionObserver(e,i){if("IntersectionObserver"in e){let n=new e.IntersectionObserver(l=>this._handleIntersectionChange(l[l.length-1]),{threshold:0});n.observe(i),this._observerDisposable.value=Ke(()=>n.disconnect())}}_handleIntersectionChange(e){this._isPaused=e.isIntersecting===void 0?e.intersectionRatio===0:!e.isIntersecting,!this._isPaused&&!this._charSizeService.hasValidSize&&this._charSizeService.measure(),!this._isPaused&&this._needsFullRefresh&&(this._pausedResizeTask.flush(),this.refreshRows(0,this._rowCount-1),this._needsFullRefresh=!1)}refreshRows(e,i,n=!1){if(this._isPaused){this._needsFullRefresh=!0;return}if(this._coreService.decPrivateModes.synchronizedOutput){this._syncOutputHandler.bufferRows(e,i);return}let l=this._syncOutputHandler.flush();l&&(e=Math.min(e,l.start),i=Math.max(i,l.end)),n||(this._isNextRenderRedrawOnly=!1),this._renderDebouncer.refresh(e,i,this._rowCount)}_renderRows(e,i){if(this._renderer.value){if(this._coreService.decPrivateModes.synchronizedOutput){this._syncOutputHandler.bufferRows(e,i);return}e=Math.min(e,this._rowCount-1),i=Math.min(i,this._rowCount-1),this._renderer.value.renderRows(e,i),this._needsSelectionRefresh&&(this._renderer.value.handleSelectionChanged(this._selectionState.start,this._selectionState.end,this._selectionState.columnSelectMode),this._needsSelectionRefresh=!1),this._isNextRenderRedrawOnly||this._onRenderedViewportChange.fire({start:e,end:i}),this._onRender.fire({start:e,end:i}),this._isNextRenderRedrawOnly=!0}}resize(e,i){this._rowCount=i,this._fireOnCanvasResize()}_handleOptionsChanged(){this._renderer.value&&(this.refreshRows(0,this._rowCount-1),this._fireOnCanvasResize())}_fireOnCanvasResize(){this._renderer.value&&(this._renderer.value.dimensions.css.canvas.width===this._canvasWidth&&this._renderer.value.dimensions.css.canvas.height===this._canvasHeight||this._onDimensionsChange.fire(this._renderer.value.dimensions))}hasRenderer(){return!!this._renderer.value}setRenderer(e){this._renderer.value=e,this._renderer.value&&(this._renderer.value.onRequestRedraw(i=>this.refreshRows(i.start,i.end,!0)),this._needsSelectionRefresh=!0,this._fullRefresh())}addRefreshCallback(e){return this._renderDebouncer.addRefreshCallback(e)}_fullRefresh(){this._isPaused?this._needsFullRefresh=!0:this.refreshRows(0,this._rowCount-1)}clearTextureAtlas(){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(e,i){this._renderer.value&&(this._isPaused?this._pausedResizeTask.set(()=>this._renderer.value?.handleResize(e,i)):this._renderer.value.handleResize(e,i),this._fullRefresh())}handleCharSizeChanged(){this._renderer.value?.handleCharSizeChanged()}handleBlur(){this._renderer.value?.handleBlur()}handleFocus(){this._renderer.value?.handleFocus()}handleSelectionChanged(e,i,n){this._selectionState.start=e,this._selectionState.end=i,this._selectionState.columnSelectMode=n,this._renderer.value?.handleSelectionChanged(e,i,n)}handleCursorMove(){this._renderer.value?.handleCursorMove()}clear(){this._renderer.value?.clear()}};Ru=Qe([se(2,At),se(3,ho),se(4,hr),se(5,vl),se(6,zt),se(7,rs),se(8,tn)],Ru);var w1=class{constructor(e,i,n){this._coreBrowserService=e,this._coreService=i,this._onTimeout=n,this._start=0,this._end=0,this._isBuffering=!1}bufferRows(e,i){this._isBuffering?(this._start=Math.min(this._start,e),this._end=Math.max(this._end,i)):(this._start=e,this._end=i,this._isBuffering=!0),this._timeout===void 0&&(this._timeout=this._coreBrowserService.window.setTimeout(()=>{this._timeout=void 0,this._coreService.decPrivateModes.synchronizedOutput=!1,this._onTimeout()},1e3))}flush(){if(this._timeout!==void 0&&(this._coreBrowserService.window.clearTimeout(this._timeout),this._timeout=void 0),!this._isBuffering)return;let e={start:this._start,end:this._end};return this._isBuffering=!1,e}dispose(){this._timeout!==void 0&&(this._coreBrowserService.window.clearTimeout(this._timeout),this._timeout=void 0)}};function C1(e,i,n,l){let o=n.buffer.x,h=n.buffer.y;if(!n.buffer.hasScrollback)return T1(o,h,e,i,n,l)+fo(h,i,n,l)+R1(o,h,e,i,n,l);let d;if(h===i)return d=o>e?"D":"C",_l(Math.abs(o-e),pl(d,l));d=h>i?"D":"C";let _=Math.abs(h-i),p=E1(h>i?e:o,n)+(_-1)*n.cols+1+k1(h>i?o:e);return _l(p,pl(d,l))}function k1(e,i){return e-1}function E1(e,i){return i.cols-e}function T1(e,i,n,l,o,h){return fo(i,l,o,h).length===0?"":_l(Sv(e,i,e,i-or(i,o),!1,o).length,pl("D",h))}function fo(e,i,n,l){let o=e-or(e,n),h=i-or(i,n),d=Math.abs(o-h)-D1(e,i,n);return _l(d,pl(yv(e,i),l))}function R1(e,i,n,l,o,h){let d;fo(i,l,o,h).length>0?d=l-or(l,o):d=i;let _=l,p=B1(e,i,n,l,o,h);return _l(Sv(e,d,n,_,p==="C",o).length,pl(p,h))}function D1(e,i,n){let l=0,o=e-or(e,n),h=i-or(i,n);for(let d=0;d<Math.abs(o-h);d++){let _=yv(e,i)==="A"?-1:1;n.buffer.lines.get(o+_*d)?.isWrapped&&l++}return l}function or(e,i){let n=0,l=i.buffer.lines.get(e),o=l?.isWrapped;for(;o&&e>=0&&e<i.rows;)n++,l=i.buffer.lines.get(--e),o=l?.isWrapped;return n}function B1(e,i,n,l,o,h){let d;return fo(n,l,o,h).length>0?d=l-or(l,o):d=i,e<n&&d<=l||e>=n&&d<l?"C":"D"}function yv(e,i){return e>i?"A":"B"}function Sv(e,i,n,l,o,h){let d=e,_=i,p="";for(;(d!==n||_!==l)&&_>=0&&_<h.buffer.lines.length;)d+=o?1:-1,o&&d>h.cols-1?(p+=h.buffer.translateBufferLineToString(_,!1,e,d),d=0,e=0,_++):!o&&d<0&&(p+=h.buffer.translateBufferLineToString(_,!1,0,e+1),d=h.cols-1,e=d,_--);return p+h.buffer.translateBufferLineToString(_,!1,e,d)}function pl(e,i){let n=i?"O":"[";return F.ESC+n+e}function _l(e,i){e=Math.floor(e);let n="";for(let l=0;l<e;l++)n+=i;return n}var M1=class{constructor(e){this._bufferService=e,this.isSelectAllActive=!1,this.selectionStartLength=0}clearSelection(){this.selectionStart=void 0,this.selectionEnd=void 0,this.isSelectAllActive=!1,this.selectionStartLength=0}get finalSelectionStart(){return this.isSelectAllActive?[0,0]:!this.selectionEnd||!this.selectionStart?this.selectionStart:this.areSelectionValuesReversed()?this.selectionEnd:this.selectionStart}get finalSelectionEnd(){if(this.isSelectAllActive)return[this._bufferService.cols,this._bufferService.buffer.ybase+this._bufferService.rows-1];if(this.selectionStart){if(!this.selectionEnd||this.areSelectionValuesReversed()){let e=this.selectionStart[0]+this.selectionStartLength;return e>this._bufferService.cols?e%this._bufferService.cols===0?[this._bufferService.cols,this.selectionStart[1]+Math.floor(e/this._bufferService.cols)-1]:[e%this._bufferService.cols,this.selectionStart[1]+Math.floor(e/this._bufferService.cols)]:[e,this.selectionStart[1]]}if(this.selectionStartLength&&this.selectionEnd[1]===this.selectionStart[1]){let e=this.selectionStart[0]+this.selectionStartLength;return e>this._bufferService.cols?[e%this._bufferService.cols,this.selectionStart[1]+Math.floor(e/this._bufferService.cols)]:[Math.max(e,this.selectionEnd[0]),this.selectionEnd[1]]}return this.selectionEnd}}areSelectionValuesReversed(){let e=this.selectionStart,i=this.selectionEnd;return!e||!i?!1:e[1]>i[1]||e[1]===i[1]&&e[0]>i[0]}handleTrim(e){return this.selectionStart&&(this.selectionStart[1]-=e),this.selectionEnd&&(this.selectionEnd[1]-=e),this.selectionEnd&&this.selectionEnd[1]<0?(this.clearSelection(),!0):(this.selectionStart&&this.selectionStart[1]<0&&(this.selectionStart[1]=0),!1)}};function $g(e,i){if(e.start.y>e.end.y)throw new Error(`Buffer range end (${e.end.x}, ${e.end.y}) cannot be before start (${e.start.x}, ${e.start.y})`);return i*(e.end.y-e.start.y)+(e.end.x-e.start.x+1)}var Gh=50,z1=15,A1=50,O1=500,L1=" ",j1=new RegExp(L1,"g"),Du=class extends Se{constructor(e,i,n,l,o,h,d,_,p){super(),this._element=e,this._screenElement=i,this._linkifier=n,this._bufferService=l,this._coreService=o,this._mouseService=h,this._optionsService=d,this._renderService=_,this._coreBrowserService=p,this._dragScrollAmount=0,this._enabled=!0,this._workCell=new gi,this._mouseDownTimeStamp=0,this._oldHasSelection=!1,this._oldSelectionStart=void 0,this._oldSelectionEnd=void 0,this._onLinuxMouseSelection=this._register(new Q),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this._register(new Q),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this._register(new Q),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this._register(new Q),this.onRequestScrollLines=this._onRequestScrollLines.event,this._mouseMoveListener=f=>this._handleMouseMove(f),this._mouseUpListener=f=>this._handleMouseUp(f),this._coreService.onUserInput(()=>{this.hasSelection&&this.clearSelection()}),this._trimListener=this._bufferService.buffer.lines.onTrim(f=>this._handleTrim(f)),this._register(this._bufferService.buffers.onBufferActivate(f=>this._handleBufferActivate(f))),this.enable(),this._model=new M1(this._bufferService),this._activeSelectionMode=0,this._register(Ke(()=>{this._removeMouseDownListeners()})),this._register(this._bufferService.onResize(f=>{f.rowsChanged&&this.clearSelection()}))}reset(){this.clearSelection()}disable(){this.clearSelection(),this._enabled=!1}enable(){this._enabled=!0}get selectionStart(){return this._model.finalSelectionStart}get selectionEnd(){return this._model.finalSelectionEnd}get hasSelection(){let e=this._model.finalSelectionStart,i=this._model.finalSelectionEnd;return!e||!i?!1:e[0]!==i[0]||e[1]!==i[1]}get selectionText(){let e=this._model.finalSelectionStart,i=this._model.finalSelectionEnd;if(!e||!i)return"";let n=this._bufferService.buffer,l=[];if(this._activeSelectionMode===3){if(e[0]===i[0])return"";let o=e[0]<i[0]?e[0]:i[0],h=e[0]<i[0]?i[0]:e[0];for(let d=e[1];d<=i[1];d++){let _=n.translateBufferLineToString(d,!0,o,h);l.push(_)}}else{let o=e[1]===i[1]?i[0]:void 0;l.push(n.translateBufferLineToString(e[1],!0,e[0],o));for(let h=e[1]+1;h<=i[1]-1;h++){let d=n.lines.get(h),_=n.translateBufferLineToString(h,!0);d?.isWrapped?l[l.length-1]+=_:l.push(_)}if(e[1]!==i[1]){let h=n.lines.get(i[1]),d=n.translateBufferLineToString(i[1],!0,0,i[0]);h&&h.isWrapped?l[l.length-1]+=d:l.push(d)}}return l.map(o=>o.replace(j1," ")).join(gv?`\r
|
|
92
|
+
`))}},Qb=class extends Error{constructor(e,i){super(e),this.name="ListenerLeakError",this.stack=i}},Jb=class extends Error{constructor(e,i){super(e),this.name="ListenerRefusalError",this.stack=i}},ex=0,Ih=class{constructor(e){this.value=e,this.id=ex++}},tx=2,ix,Q=class{constructor(i){this._size=0,this._options=i,this._leakageMon=this._options?.leakWarningThreshold?new Vb(i?.onListenerError??Ka,this._options?.leakWarningThreshold??Xb):void 0,this._perfMon=this._options?._profName?new Gb(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??=(i,n,l)=>{if(this._leakageMon&&this._size>this._leakageMon.threshold**2){let _=`[${this._leakageMon.name}] REFUSES to accept new listeners because it exceeded its threshold by far (${this._size} vs ${this._leakageMon.threshold})`;console.warn(_);let p=this._leakageMon.getMostFrequentStack()??["UNKNOWN stack",-1],f=new Jb(`${_}. HINT: Stack shows most frequent listener (${p[1]}-times)`,p[0]);return(this._options?.onListenerError||Ka)(f),Se.None}if(this._disposed)return Se.None;n&&(i=i.bind(n));let o=new Ih(i),h;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(o.stack=Zb.create(),h=this._leakageMon.check(o.stack,this._size+1)),this._listeners?this._listeners instanceof Ih?(this._deliveryQueue??=new sx,this._listeners=[this._listeners,o]):this._listeners.push(o):(this._options?.onWillAddFirstListener?.(this),this._listeners=o,this._options?.onDidAddFirstListener?.(this)),this._size++;let d=$e(()=>{h?.(),this._removeListener(o)});return l instanceof js?l.add(d):Array.isArray(l)&&l.push(d),d},this._event}_removeListener(i){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 n=this._listeners,l=n.indexOf(i);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--,n[l]=void 0;let o=this._deliveryQueue.current===this;if(this._size*tx<=n.length){let h=0;for(let d=0;d<n.length;d++)n[d]?n[h++]=n[d]:o&&(this._deliveryQueue.end--,h<this._deliveryQueue.i&&this._deliveryQueue.i--);n.length=h}}_deliver(i,n){if(!i)return;let l=this._options?.onListenerError||Ka;if(!l){i.value(n);return}try{i.value(n)}catch(o){l(o)}}_deliverQueue(i){let n=i.current._listeners;for(;i.i<i.end;)this._deliver(n[i.i++],i.value);i.reset()}fire(i){if(this._deliveryQueue?.current&&(this._deliverQueue(this._deliveryQueue),this._perfMon?.stop()),this._perfMon?.start(this._size),this._listeners)if(this._listeners instanceof Ih)this._deliver(this._listeners,i);else{let n=this._deliveryQueue;n.enqueue(this,i,this._listeners.length),this._deliverQueue(n)}this._perfMon?.stop()}hasListeners(){return this._size>0}},sx=class{constructor(){this.i=-1,this.end=0}enqueue(e,i,n){this.i=0,this.end=n,this.current=e,this.value=i}reset(){this.i=this.end,this.current=void 0,this.value=void 0}},fu=class{constructor(){this.mapWindowIdToZoomLevel=new Map,this._onDidChangeZoomLevel=new Q,this.onDidChangeZoomLevel=this._onDidChangeZoomLevel.event,this.mapWindowIdToZoomFactor=new Map,this._onDidChangeFullscreen=new Q,this.onDidChangeFullscreen=this._onDidChangeFullscreen.event,this.mapWindowIdToFullScreen=new Map}getZoomLevel(i){return this.mapWindowIdToZoomLevel.get(this.getWindowId(i))??0}setZoomLevel(i,n){if(this.getZoomLevel(n)===i)return;let l=this.getWindowId(n);this.mapWindowIdToZoomLevel.set(l,i),this._onDidChangeZoomLevel.fire(l)}getZoomFactor(i){return this.mapWindowIdToZoomFactor.get(this.getWindowId(i))??1}setZoomFactor(i,n){this.mapWindowIdToZoomFactor.set(this.getWindowId(n),i)}setFullscreen(i,n){if(this.isFullscreen(n)===i)return;let l=this.getWindowId(n);this.mapWindowIdToFullScreen.set(l,i),this._onDidChangeFullscreen.fire(l)}isFullscreen(i){return!!this.mapWindowIdToFullScreen.get(this.getWindowId(i))}getWindowId(i){return i.vscodeWindowId}};fu.INSTANCE=new fu;var $u=fu;function rx(e,i,n){typeof i=="string"&&(i=e.matchMedia(i)),i.addEventListener("change",n)}$u.INSTANCE.onDidChangeZoomLevel;function nx(e){return $u.INSTANCE.getZoomFactor(e)}$u.INSTANCE.onDidChangeFullscreen;var sn=typeof navigator=="object"?navigator.userAgent:"",pu=sn.indexOf("Firefox")>=0,lx=sn.indexOf("AppleWebKit")>=0,Ku=sn.indexOf("Chrome")>=0,ax=!Ku&&sn.indexOf("Safari")>=0;sn.indexOf("Electron/")>=0;sn.indexOf("Android")>=0;var Yh=!1;if(typeof ss.matchMedia=="function"){let e=ss.matchMedia("(display-mode: standalone) or (display-mode: window-controls-overlay)"),i=ss.matchMedia("(display-mode: fullscreen)");Yh=e.matches,rx(ss,e,({matches:n})=>{Yh&&i.matches||(Yh=n)})}var Qr="en",_u=!1,gu=!1,Fa=!1,sv=!1,Ua,Ga=Qr,Tg=Qr,ox,is,lr=globalThis,ei;typeof lr.vscode<"u"&&typeof lr.vscode.process<"u"?ei=lr.vscode.process:typeof process<"u"&&typeof process?.versions?.node=="string"&&(ei=process);var cx=typeof ei?.versions?.electron=="string",hx=cx&&ei?.type==="renderer";if(typeof ei=="object"){_u=ei.platform==="win32",gu=ei.platform==="darwin",Fa=ei.platform==="linux",Fa&&ei.env.SNAP&&ei.env.SNAP_REVISION,ei.env.CI||ei.env.BUILD_ARTIFACTSTAGINGDIRECTORY,Ua=Qr,Ga=Qr;let e=ei.env.VSCODE_NLS_CONFIG;if(e)try{let i=JSON.parse(e);Ua=i.userLocale,Tg=i.osLocale,Ga=i.resolvedLanguage||Qr,ox=i.languagePack?.translationsConfigFile}catch{}sv=!0}else typeof navigator=="object"&&!hx?(is=navigator.userAgent,_u=is.indexOf("Windows")>=0,gu=is.indexOf("Macintosh")>=0,(is.indexOf("Macintosh")>=0||is.indexOf("iPad")>=0||is.indexOf("iPhone")>=0)&&navigator.maxTouchPoints&&navigator.maxTouchPoints>0,Fa=is.indexOf("Linux")>=0,is?.indexOf("Mobi")>=0,Ga=globalThis._VSCODE_NLS_LANGUAGE||Qr,Ua=navigator.language.toLowerCase(),Tg=Ua):console.error("Unable to resolve platform.");var rv=_u,Oi=gu,ux=Fa,Rg=sv,Li=is,Ms=Ga,dx;(e=>{function i(){return Ms}e.value=i;function n(){return Ms.length===2?Ms==="en":Ms.length>=3?Ms[0]==="e"&&Ms[1]==="n"&&Ms[2]==="-":!1}e.isDefaultVariant=n;function l(){return Ms==="en"}e.isDefault=l})(dx||={});var fx=typeof lr.postMessage=="function"&&!lr.importScripts;(()=>{if(fx){let e=[];lr.addEventListener("message",n=>{if(n.data&&n.data.vscodeScheduleAsyncWork)for(let l=0,o=e.length;l<o;l++){let h=e[l];if(h.id===n.data.vscodeScheduleAsyncWork){e.splice(l,1),h.callback();return}}});let i=0;return n=>{let l=++i;e.push({id:l,callback:n}),lr.postMessage({vscodeScheduleAsyncWork:l},"*")}}return e=>setTimeout(e)})();var px=!!(Li&&Li.indexOf("Chrome")>=0);Li&&Li.indexOf("Firefox")>=0;!px&&Li&&Li.indexOf("Safari")>=0;Li&&Li.indexOf("Edg/")>=0;Li&&Li.indexOf("Android")>=0;var Vr=typeof navigator=="object"?navigator:{};Rg||document.queryCommandSupported&&document.queryCommandSupported("copy")||Vr&&Vr.clipboard&&Vr.clipboard.writeText,Rg||Vr&&Vr.clipboard&&Vr.clipboard.readText;var Fu=class{constructor(){this._keyCodeToStr=[],this._strToKeyCode=Object.create(null)}define(e,i){this._keyCodeToStr[e]=i,this._strToKeyCode[i.toLowerCase()]=e}keyCodeToStr(e){return this._keyCodeToStr[e]}strToKeyCode(e){return this._strToKeyCode[e.toLowerCase()]||0}},$h=new Fu,Dg=new Fu,Bg=new Fu,_x=new Array(230),nv;(e=>{function i(_){return $h.keyCodeToStr(_)}e.toString=i;function n(_){return $h.strToKeyCode(_)}e.fromString=n;function l(_){return Dg.keyCodeToStr(_)}e.toUserSettingsUS=l;function o(_){return Bg.keyCodeToStr(_)}e.toUserSettingsGeneral=o;function h(_){return Dg.strToKeyCode(_)||Bg.strToKeyCode(_)}e.fromUserSettings=h;function d(_){if(_>=98&&_<=113)return null;switch(_){case 16:return"Up";case 18:return"Down";case 15:return"Left";case 17:return"Right"}return $h.keyCodeToStr(_)}e.toElectronAccelerator=d})(nv||={});var gx=class lv{constructor(i,n,l,o,h){this.ctrlKey=i,this.shiftKey=n,this.altKey=l,this.metaKey=o,this.keyCode=h}equals(i){return i instanceof lv&&this.ctrlKey===i.ctrlKey&&this.shiftKey===i.shiftKey&&this.altKey===i.altKey&&this.metaKey===i.metaKey&&this.keyCode===i.keyCode}getHashCode(){let i=this.ctrlKey?"1":"0",n=this.shiftKey?"1":"0",l=this.altKey?"1":"0",o=this.metaKey?"1":"0";return`K${i}${n}${l}${o}${this.keyCode}`}isModifierKey(){return this.keyCode===0||this.keyCode===5||this.keyCode===57||this.keyCode===6||this.keyCode===4}toKeybinding(){return new mx([this])}isDuplicateModifierCase(){return this.ctrlKey&&this.keyCode===5||this.shiftKey&&this.keyCode===4||this.altKey&&this.keyCode===6||this.metaKey&&this.keyCode===57}},mx=class{constructor(e){if(e.length===0)throw Pb("chords");this.chords=e}getHashCode(){let e="";for(let i=0,n=this.chords.length;i<n;i++)i!==0&&(e+=";"),e+=this.chords[i].getHashCode();return e}equals(e){if(e===null||this.chords.length!==e.chords.length)return!1;for(let i=0;i<this.chords.length;i++)if(!this.chords[i].equals(e.chords[i]))return!1;return!0}};function vx(e){if(e.charCode){let n=String.fromCharCode(e.charCode).toUpperCase();return nv.fromString(n)}let i=e.keyCode;if(i===3)return 7;if(pu)switch(i){case 59:return 85;case 60:if(ux)return 97;break;case 61:return 86;case 107:return 109;case 109:return 111;case 173:return 88;case 224:if(Oi)return 57;break}else if(lx&&(Oi&&i===93||!Oi&&i===92))return 57;return _x[i]||0}var yx=Oi?256:2048,Sx=512,bx=1024,xx=Oi?2048:256,Mg=class{constructor(e){this._standardKeyboardEventBrand=!0;let i=e;this.browserEvent=i,this.target=i.target,this.ctrlKey=i.ctrlKey,this.shiftKey=i.shiftKey,this.altKey=i.altKey,this.metaKey=i.metaKey,this.altGraphKey=i.getModifierState?.("AltGraph"),this.keyCode=vx(i),this.code=i.code,this.ctrlKey=this.ctrlKey||this.keyCode===5,this.altKey=this.altKey||this.keyCode===6,this.shiftKey=this.shiftKey||this.keyCode===4,this.metaKey=this.metaKey||this.keyCode===57,this._asKeybinding=this._computeKeybinding(),this._asKeyCodeChord=this._computeKeyCodeChord()}preventDefault(){this.browserEvent&&this.browserEvent.preventDefault&&this.browserEvent.preventDefault()}stopPropagation(){this.browserEvent&&this.browserEvent.stopPropagation&&this.browserEvent.stopPropagation()}toKeyCodeChord(){return this._asKeyCodeChord}equals(e){return this._asKeybinding===e}_computeKeybinding(){let e=0;this.keyCode!==5&&this.keyCode!==4&&this.keyCode!==6&&this.keyCode!==57&&(e=this.keyCode);let i=0;return this.ctrlKey&&(i|=yx),this.altKey&&(i|=Sx),this.shiftKey&&(i|=bx),this.metaKey&&(i|=xx),i|=e,i}_computeKeyCodeChord(){let e=0;return this.keyCode!==5&&this.keyCode!==4&&this.keyCode!==6&&this.keyCode!==57&&(e=this.keyCode),new gx(this.ctrlKey,this.shiftKey,this.altKey,this.metaKey,e)}},zg=new WeakMap;function wx(e){if(!e.parent||e.parent===e)return null;try{let i=e.location,n=e.parent.location;if(i.origin!=="null"&&n.origin!=="null"&&i.origin!==n.origin)return null}catch{return null}return e.parent}var Cx=class{static getSameOriginWindowChain(e){let i=zg.get(e);if(!i){i=[],zg.set(e,i);let n=e,l;do l=wx(n),l?i.push({window:new WeakRef(n),iframeElement:n.frameElement||null}):i.push({window:new WeakRef(n),iframeElement:null}),n=l;while(n)}return i.slice(0)}static getPositionOfChildWindowRelativeToAncestorWindow(e,i){if(!i||e===i)return{top:0,left:0};let n=0,l=0,o=this.getSameOriginWindowChain(e);for(let h of o){let d=h.window.deref();if(n+=d?.scrollY??0,l+=d?.scrollX??0,d===i||!h.iframeElement)break;let _=h.iframeElement.getBoundingClientRect();n+=_.top,l+=_.left}return{top:n,left:l}}},Wa=class{constructor(i,n){this.timestamp=Date.now(),this.browserEvent=n,this.leftButton=n.button===0,this.middleButton=n.button===1,this.rightButton=n.button===2,this.buttons=n.buttons,this.target=n.target,this.detail=n.detail||1,n.type==="dblclick"&&(this.detail=2),this.ctrlKey=n.ctrlKey,this.shiftKey=n.shiftKey,this.altKey=n.altKey,this.metaKey=n.metaKey,typeof n.pageX=="number"?(this.posx=n.pageX,this.posy=n.pageY):(this.posx=n.clientX+this.target.ownerDocument.body.scrollLeft+this.target.ownerDocument.documentElement.scrollLeft,this.posy=n.clientY+this.target.ownerDocument.body.scrollTop+this.target.ownerDocument.documentElement.scrollTop);let l=Cx.getPositionOfChildWindowRelativeToAncestorWindow(i,n.view);this.posx-=l.left,this.posy-=l.top}preventDefault(){this.browserEvent.preventDefault()}stopPropagation(){this.browserEvent.stopPropagation()}},Ag=class{constructor(e,i=0,n=0){this.browserEvent=e||null,this.target=e?e.target||e.targetNode||e.srcElement:null,this.deltaY=n,this.deltaX=i;let l=!1;if(Ku){let o=navigator.userAgent.match(/Chrome\/(\d+)/);l=(o?parseInt(o[1]):123)<=122}if(e){let o=e,h=e,d=e.view?.devicePixelRatio||1;if(typeof o.wheelDeltaY<"u")l?this.deltaY=o.wheelDeltaY/(120*d):this.deltaY=o.wheelDeltaY/120;else if(typeof h.VERTICAL_AXIS<"u"&&h.axis===h.VERTICAL_AXIS)this.deltaY=-h.detail/3;else if(e.type==="wheel"){let _=e;_.deltaMode===_.DOM_DELTA_LINE?pu&&!Oi?this.deltaY=-e.deltaY/3:this.deltaY=-e.deltaY:this.deltaY=-e.deltaY/40}if(typeof o.wheelDeltaX<"u")ax&&rv?this.deltaX=-(o.wheelDeltaX/120):l?this.deltaX=o.wheelDeltaX/(120*d):this.deltaX=o.wheelDeltaX/120;else if(typeof h.HORIZONTAL_AXIS<"u"&&h.axis===h.HORIZONTAL_AXIS)this.deltaX=-e.detail/3;else if(e.type==="wheel"){let _=e;_.deltaMode===_.DOM_DELTA_LINE?pu&&!Oi?this.deltaX=-e.deltaX/3:this.deltaX=-e.deltaX:this.deltaX=-e.deltaX/40}this.deltaY===0&&this.deltaX===0&&e.wheelDelta&&(l?this.deltaY=e.wheelDelta/(120*d):this.deltaY=e.wheelDelta/120)}}preventDefault(){this.browserEvent?.preventDefault()}stopPropagation(){this.browserEvent?.stopPropagation()}},av=Object.freeze(function(e,i){let n=setTimeout(e.bind(i),0);return{dispose(){clearTimeout(n)}}}),kx;(e=>{function i(n){return n===e.None||n===e.Cancelled||n instanceof Ex?!0:!n||typeof n!="object"?!1:typeof n.isCancellationRequested=="boolean"&&typeof n.onCancellationRequested=="function"}e.isCancellationToken=i,e.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:kt.None}),e.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:av})})(kx||={});var Ex=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?av:(this._emitter||(this._emitter=new Q),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=null)}},Gu=class{constructor(i,n){this._isDisposed=!1,this._token=-1,typeof i=="function"&&typeof n=="number"&&this.setIfNotSet(i,n)}dispose(){this.cancel(),this._isDisposed=!0}cancel(){this._token!==-1&&(clearTimeout(this._token),this._token=-1)}cancelAndSet(i,n){if(this._isDisposed)throw new ou("Calling 'cancelAndSet' on a disposed TimeoutTimer");this.cancel(),this._token=setTimeout(()=>{this._token=-1,i()},n)}setIfNotSet(i,n){if(this._isDisposed)throw new ou("Calling 'setIfNotSet' on a disposed TimeoutTimer");this._token===-1&&(this._token=setTimeout(()=>{this._token=-1,i()},n))}},Tx=class{constructor(){this.disposable=void 0,this.isDisposed=!1}cancel(){this.disposable?.dispose(),this.disposable=void 0}cancelAndSet(e,i,n=globalThis){if(this.isDisposed)throw new ou("Calling 'cancelAndSet' on a disposed IntervalTimer");this.cancel();let l=n.setInterval(()=>{e()},i);this.disposable=$e(()=>{n.clearInterval(l),this.disposable=void 0})}dispose(){this.cancel(),this.isDisposed=!0}},Rx;(e=>{async function i(l){let o,h=await Promise.all(l.map(d=>d.then(_=>_,_=>{o||(o=_)})));if(typeof o<"u")throw o;return h}e.settled=i;function n(l){return new Promise(async(o,h)=>{try{await l(o,h)}catch(d){h(d)}})}e.withAsyncBody=n})(Rx||={});var Og=class fi{static fromArray(i){return new fi(n=>{n.emitMany(i)})}static fromPromise(i){return new fi(async n=>{n.emitMany(await i)})}static fromPromises(i){return new fi(async n=>{await Promise.all(i.map(async l=>n.emitOne(await l)))})}static merge(i){return new fi(async n=>{await Promise.all(i.map(async l=>{for await(let o of l)n.emitOne(o)}))})}constructor(i,n){this._state=0,this._results=[],this._error=null,this._onReturn=n,this._onStateChanged=new Q,queueMicrotask(async()=>{let l={emitOne:o=>this.emitOne(o),emitMany:o=>this.emitMany(o),reject:o=>this.reject(o)};try{await Promise.resolve(i(l)),this.resolve()}catch(o){this.reject(o)}finally{l.emitOne=void 0,l.emitMany=void 0,l.reject=void 0}})}[Symbol.asyncIterator](){let i=0;return{next:async()=>{do{if(this._state===2)throw this._error;if(i<this._results.length)return{done:!1,value:this._results[i++]};if(this._state===1)return{done:!0,value:void 0};await kt.toPromise(this._onStateChanged.event)}while(!0)},return:async()=>(this._onReturn?.(),{done:!0,value:void 0})}}static map(i,n){return new fi(async l=>{for await(let o of i)l.emitOne(n(o))})}map(i){return fi.map(this,i)}static filter(i,n){return new fi(async l=>{for await(let o of i)n(o)&&l.emitOne(o)})}filter(i){return fi.filter(this,i)}static coalesce(i){return fi.filter(i,n=>!!n)}coalesce(){return fi.coalesce(this)}static async toPromise(i){let n=[];for await(let l of i)n.push(l);return n}toPromise(){return fi.toPromise(this)}emitOne(i){this._state===0&&(this._results.push(i),this._onStateChanged.fire())}emitMany(i){this._state===0&&(this._results=this._results.concat(i),this._onStateChanged.fire())}resolve(){this._state===0&&(this._state=1,this._onStateChanged.fire())}reject(i){this._state===0&&(this._state=2,this._error=i,this._onStateChanged.fire())}};Og.EMPTY=Og.fromArray([]);var{getWindow:Ai,getWindowId:Dx,onDidRegisterWindow:Bx}=(function(){let e=new Map,i={window:ss,disposables:new js};e.set(ss.vscodeWindowId,i);let n=new Q,l=new Q,o=new Q;function h(d,_){return(typeof d=="number"?e.get(d):void 0)??(_?i:void 0)}return{onDidRegisterWindow:n.event,onWillUnregisterWindow:o.event,onDidUnregisterWindow:l.event,registerWindow(d){if(e.has(d.vscodeWindowId))return Se.None;let _=new js,p={window:d,disposables:_.add(new js)};return e.set(d.vscodeWindowId,p),_.add($e(()=>{e.delete(d.vscodeWindowId),l.fire(d)})),_.add(fe(d,_t.BEFORE_UNLOAD,()=>{o.fire(d)})),n.fire(p),_},getWindows(){return e.values()},getWindowsCount(){return e.size},getWindowId(d){return d.vscodeWindowId},hasWindow(d){return e.has(d)},getWindowById:h,getWindow(d){let _=d;if(_?.ownerDocument?.defaultView)return _.ownerDocument.defaultView.window;let p=d;return p?.view?p.view.window:ss},getDocument(d){return Ai(d).document}}})(),Mx=class{constructor(e,i,n,l){this._node=e,this._type=i,this._handler=n,this._options=l||!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 fe(e,i,n,l){return new Mx(e,i,n,l)}var Lg=function(e,i,n,l){return fe(e,i,n,l)},Xu,zx=class extends Tx{constructor(e){super(),this.defaultTarget=e&&Ai(e)}cancelAndSet(e,i,n){return super.cancelAndSet(e,i,n??this.defaultTarget)}},jg=class{constructor(e,i=0){this._runner=e,this.priority=i,this._canceled=!1}dispose(){this._canceled=!0}execute(){if(!this._canceled)try{this._runner()}catch(e){Ka(e)}}static sort(e,i){return i.priority-e.priority}};(function(){let e=new Map,i=new Map,n=new Map,l=new Map,o=h=>{n.set(h,!1);let d=e.get(h)??[];for(i.set(h,d),e.set(h,[]),l.set(h,!0);d.length>0;)d.sort(jg.sort),d.shift().execute();l.set(h,!1)};Xu=(h,d,_=0)=>{let p=Dx(h),f=new jg(d,_),S=e.get(p);return S||(S=[],e.set(p,S)),S.push(f),n.get(p)||(n.set(p,!0),h.requestAnimationFrame(()=>o(p))),f}})();function Ax(e){let i=e.getBoundingClientRect(),n=Ai(e);return{left:i.left+n.scrollX,top:i.top+n.scrollY,width:i.width,height:i.height}}var _t={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"},Ox=class{constructor(e){this.domNode=e,this._maxWidth="",this._width="",this._height="",this._top="",this._left="",this._bottom="",this._right="",this._paddingTop="",this._paddingLeft="",this._paddingBottom="",this._paddingRight="",this._fontFamily="",this._fontWeight="",this._fontSize="",this._fontStyle="",this._fontFeatureSettings="",this._fontVariationSettings="",this._textDecoration="",this._lineHeight="",this._letterSpacing="",this._className="",this._display="",this._position="",this._visibility="",this._color="",this._backgroundColor="",this._layerHint=!1,this._contain="none",this._boxShadow=""}setMaxWidth(e){let i=qt(e);this._maxWidth!==i&&(this._maxWidth=i,this.domNode.style.maxWidth=this._maxWidth)}setWidth(e){let i=qt(e);this._width!==i&&(this._width=i,this.domNode.style.width=this._width)}setHeight(e){let i=qt(e);this._height!==i&&(this._height=i,this.domNode.style.height=this._height)}setTop(e){let i=qt(e);this._top!==i&&(this._top=i,this.domNode.style.top=this._top)}setLeft(e){let i=qt(e);this._left!==i&&(this._left=i,this.domNode.style.left=this._left)}setBottom(e){let i=qt(e);this._bottom!==i&&(this._bottom=i,this.domNode.style.bottom=this._bottom)}setRight(e){let i=qt(e);this._right!==i&&(this._right=i,this.domNode.style.right=this._right)}setPaddingTop(e){let i=qt(e);this._paddingTop!==i&&(this._paddingTop=i,this.domNode.style.paddingTop=this._paddingTop)}setPaddingLeft(e){let i=qt(e);this._paddingLeft!==i&&(this._paddingLeft=i,this.domNode.style.paddingLeft=this._paddingLeft)}setPaddingBottom(e){let i=qt(e);this._paddingBottom!==i&&(this._paddingBottom=i,this.domNode.style.paddingBottom=this._paddingBottom)}setPaddingRight(e){let i=qt(e);this._paddingRight!==i&&(this._paddingRight=i,this.domNode.style.paddingRight=this._paddingRight)}setFontFamily(e){this._fontFamily!==e&&(this._fontFamily=e,this.domNode.style.fontFamily=this._fontFamily)}setFontWeight(e){this._fontWeight!==e&&(this._fontWeight=e,this.domNode.style.fontWeight=this._fontWeight)}setFontSize(e){let i=qt(e);this._fontSize!==i&&(this._fontSize=i,this.domNode.style.fontSize=this._fontSize)}setFontStyle(e){this._fontStyle!==e&&(this._fontStyle=e,this.domNode.style.fontStyle=this._fontStyle)}setFontFeatureSettings(e){this._fontFeatureSettings!==e&&(this._fontFeatureSettings=e,this.domNode.style.fontFeatureSettings=this._fontFeatureSettings)}setFontVariationSettings(e){this._fontVariationSettings!==e&&(this._fontVariationSettings=e,this.domNode.style.fontVariationSettings=this._fontVariationSettings)}setTextDecoration(e){this._textDecoration!==e&&(this._textDecoration=e,this.domNode.style.textDecoration=this._textDecoration)}setLineHeight(e){let i=qt(e);this._lineHeight!==i&&(this._lineHeight=i,this.domNode.style.lineHeight=this._lineHeight)}setLetterSpacing(e){let i=qt(e);this._letterSpacing!==i&&(this._letterSpacing=i,this.domNode.style.letterSpacing=this._letterSpacing)}setClassName(e){this._className!==e&&(this._className=e,this.domNode.className=this._className)}toggleClassName(e,i){this.domNode.classList.toggle(e,i),this._className=this.domNode.className}setDisplay(e){this._display!==e&&(this._display=e,this.domNode.style.display=this._display)}setPosition(e){this._position!==e&&(this._position=e,this.domNode.style.position=this._position)}setVisibility(e){this._visibility!==e&&(this._visibility=e,this.domNode.style.visibility=this._visibility)}setColor(e){this._color!==e&&(this._color=e,this.domNode.style.color=this._color)}setBackgroundColor(e){this._backgroundColor!==e&&(this._backgroundColor=e,this.domNode.style.backgroundColor=this._backgroundColor)}setLayerHinting(e){this._layerHint!==e&&(this._layerHint=e,this.domNode.style.transform=this._layerHint?"translate3d(0px, 0px, 0px)":"")}setBoxShadow(e){this._boxShadow!==e&&(this._boxShadow=e,this.domNode.style.boxShadow=e)}setContain(e){this._contain!==e&&(this._contain=e,this.domNode.style.contain=this._contain)}setAttribute(e,i){this.domNode.setAttribute(e,i)}removeAttribute(e){this.domNode.removeAttribute(e)}appendChild(e){this.domNode.appendChild(e.domNode)}removeChild(e){this.domNode.removeChild(e.domNode)}};function qt(e){return typeof e=="number"?`${e}px`:e}function fl(e){return new Ox(e)}var ov=class{constructor(){this._hooks=new js,this._pointerMoveCallback=null,this._onStopCallback=null}dispose(){this.stopMonitoring(!1),this._hooks.dispose()}stopMonitoring(e,i){if(!this.isMonitoring())return;this._hooks.clear(),this._pointerMoveCallback=null;let n=this._onStopCallback;this._onStopCallback=null,e&&n&&n(i)}isMonitoring(){return!!this._pointerMoveCallback}startMonitoring(e,i,n,l,o){this.isMonitoring()&&this.stopMonitoring(!1),this._pointerMoveCallback=l,this._onStopCallback=o;let h=e;try{e.setPointerCapture(i),this._hooks.add($e(()=>{try{e.releasePointerCapture(i)}catch{}}))}catch{h=Ai(e)}this._hooks.add(fe(h,_t.POINTER_MOVE,d=>{if(d.buttons!==n){this.stopMonitoring(!0);return}d.preventDefault(),this._pointerMoveCallback(d)})),this._hooks.add(fe(h,_t.POINTER_UP,d=>this.stopMonitoring(!0)))}};function Lx(e,i,n){let l=null,o=null;if(typeof n.value=="function"?(l="value",o=n.value,o.length!==0&&console.warn("Memoize should only be used in functions with zero parameters")):typeof n.get=="function"&&(l="get",o=n.get),!o)throw new Error("not supported");let h=`$memoize$${i}`;n[l]=function(...d){return this.hasOwnProperty(h)||Object.defineProperty(this,h,{configurable:!1,enumerable:!1,writable:!1,value:o.apply(this,d)}),this[h]}}var Mi;(e=>(e.Tap="-xterm-gesturetap",e.Change="-xterm-gesturechange",e.Start="-xterm-gesturestart",e.End="-xterm-gesturesend",e.Contextmenu="-xterm-gesturecontextmenu"))(Mi||={});var al=class Rt extends Se{constructor(){super(),this.dispatched=!1,this.targets=new Eg,this.ignoreTargets=new Eg,this.activeTouches={},this.handle=null,this._lastSetTapCountTime=0,this._register(kt.runAndSubscribe(Bx,({window:i,disposables:n})=>{n.add(fe(i.document,"touchstart",l=>this.onTouchStart(l),{passive:!1})),n.add(fe(i.document,"touchend",l=>this.onTouchEnd(i,l))),n.add(fe(i.document,"touchmove",l=>this.onTouchMove(l),{passive:!1}))},{window:ss,disposables:this._store}))}static addTarget(i){if(!Rt.isTouchDevice())return Se.None;Rt.INSTANCE||(Rt.INSTANCE=new Rt);let n=Rt.INSTANCE.targets.push(i);return $e(n)}static ignoreTarget(i){if(!Rt.isTouchDevice())return Se.None;Rt.INSTANCE||(Rt.INSTANCE=new Rt);let n=Rt.INSTANCE.ignoreTargets.push(i);return $e(n)}static isTouchDevice(){return"ontouchstart"in ss||navigator.maxTouchPoints>0}dispose(){this.handle&&(this.handle.dispose(),this.handle=null),super.dispose()}onTouchStart(i){let n=Date.now();this.handle&&(this.handle.dispose(),this.handle=null);for(let l=0,o=i.targetTouches.length;l<o;l++){let h=i.targetTouches.item(l);this.activeTouches[h.identifier]={id:h.identifier,initialTarget:h.target,initialTimeStamp:n,initialPageX:h.pageX,initialPageY:h.pageY,rollingTimestamps:[n],rollingPageX:[h.pageX],rollingPageY:[h.pageY]};let d=this.newGestureEvent(Mi.Start,h.target);d.pageX=h.pageX,d.pageY=h.pageY,this.dispatchEvent(d)}this.dispatched&&(i.preventDefault(),i.stopPropagation(),this.dispatched=!1)}onTouchEnd(i,n){let l=Date.now(),o=Object.keys(this.activeTouches).length;for(let h=0,d=n.changedTouches.length;h<d;h++){let _=n.changedTouches.item(h);if(!this.activeTouches.hasOwnProperty(String(_.identifier))){console.warn("move of an UNKNOWN touch",_);continue}let p=this.activeTouches[_.identifier],f=Date.now()-p.initialTimeStamp;if(f<Rt.HOLD_DELAY&&Math.abs(p.initialPageX-Qt(p.rollingPageX))<30&&Math.abs(p.initialPageY-Qt(p.rollingPageY))<30){let S=this.newGestureEvent(Mi.Tap,p.initialTarget);S.pageX=Qt(p.rollingPageX),S.pageY=Qt(p.rollingPageY),this.dispatchEvent(S)}else if(f>=Rt.HOLD_DELAY&&Math.abs(p.initialPageX-Qt(p.rollingPageX))<30&&Math.abs(p.initialPageY-Qt(p.rollingPageY))<30){let S=this.newGestureEvent(Mi.Contextmenu,p.initialTarget);S.pageX=Qt(p.rollingPageX),S.pageY=Qt(p.rollingPageY),this.dispatchEvent(S)}else if(o===1){let S=Qt(p.rollingPageX),y=Qt(p.rollingPageY),x=Qt(p.rollingTimestamps)-p.rollingTimestamps[0],C=S-p.rollingPageX[0],b=y-p.rollingPageY[0],T=[...this.targets].filter(M=>p.initialTarget instanceof Node&&M.contains(p.initialTarget));this.inertia(i,T,l,Math.abs(C)/x,C>0?1:-1,S,Math.abs(b)/x,b>0?1:-1,y)}this.dispatchEvent(this.newGestureEvent(Mi.End,p.initialTarget)),delete this.activeTouches[_.identifier]}this.dispatched&&(n.preventDefault(),n.stopPropagation(),this.dispatched=!1)}newGestureEvent(i,n){let l=document.createEvent("CustomEvent");return l.initEvent(i,!1,!0),l.initialTarget=n,l.tapCount=0,l}dispatchEvent(i){if(i.type===Mi.Tap){let n=new Date().getTime(),l=0;n-this._lastSetTapCountTime>Rt.CLEAR_TAP_COUNT_TIME?l=1:l=2,this._lastSetTapCountTime=n,i.tapCount=l}else(i.type===Mi.Change||i.type===Mi.Contextmenu)&&(this._lastSetTapCountTime=0);if(i.initialTarget instanceof Node){for(let l of this.ignoreTargets)if(l.contains(i.initialTarget))return;let n=[];for(let l of this.targets)if(l.contains(i.initialTarget)){let o=0,h=i.initialTarget;for(;h&&h!==l;)o++,h=h.parentElement;n.push([o,l])}n.sort((l,o)=>l[0]-o[0]);for(let[l,o]of n)o.dispatchEvent(i),this.dispatched=!0}}inertia(i,n,l,o,h,d,_,p,f){this.handle=Xu(i,()=>{let S=Date.now(),y=S-l,x=0,C=0,b=!0;o+=Rt.SCROLL_FRICTION*y,_+=Rt.SCROLL_FRICTION*y,o>0&&(b=!1,x=h*o*y),_>0&&(b=!1,C=p*_*y);let T=this.newGestureEvent(Mi.Change);T.translationX=x,T.translationY=C,n.forEach(M=>M.dispatchEvent(T)),b||this.inertia(i,n,S,o,h,d+x,_,p,f+C)})}onTouchMove(i){let n=Date.now();for(let l=0,o=i.changedTouches.length;l<o;l++){let h=i.changedTouches.item(l);if(!this.activeTouches.hasOwnProperty(String(h.identifier))){console.warn("end of an UNKNOWN touch",h);continue}let d=this.activeTouches[h.identifier],_=this.newGestureEvent(Mi.Change,d.initialTarget);_.translationX=h.pageX-Qt(d.rollingPageX),_.translationY=h.pageY-Qt(d.rollingPageY),_.pageX=h.pageX,_.pageY=h.pageY,this.dispatchEvent(_),d.rollingPageX.length>3&&(d.rollingPageX.shift(),d.rollingPageY.shift(),d.rollingTimestamps.shift()),d.rollingPageX.push(h.pageX),d.rollingPageY.push(h.pageY),d.rollingTimestamps.push(n)}this.dispatched&&(i.preventDefault(),i.stopPropagation(),this.dispatched=!1)}};al.SCROLL_FRICTION=-.005,al.HOLD_DELAY=700,al.CLEAR_TAP_COUNT_TIME=400,Qe([Lx],al,"isTouchDevice",1);var jx=al,Vu=class extends Se{onclick(e,i){this._register(fe(e,_t.CLICK,n=>i(new Wa(Ai(e),n))))}onmousedown(e,i){this._register(fe(e,_t.MOUSE_DOWN,n=>i(new Wa(Ai(e),n))))}onmouseover(e,i){this._register(fe(e,_t.MOUSE_OVER,n=>i(new Wa(Ai(e),n))))}onmouseleave(e,i){this._register(fe(e,_t.MOUSE_LEAVE,n=>i(new Wa(Ai(e),n))))}onkeydown(e,i){this._register(fe(e,_t.KEY_DOWN,n=>i(new Mg(n))))}onkeyup(e,i){this._register(fe(e,_t.KEY_UP,n=>i(new Mg(n))))}oninput(e,i){this._register(fe(e,_t.INPUT,i))}onblur(e,i){this._register(fe(e,_t.BLUR,i))}onfocus(e,i){this._register(fe(e,_t.FOCUS,i))}onchange(e,i){this._register(fe(e,_t.CHANGE,i))}ignoreGesture(e){return jx.ignoreTarget(e)}},Ng=11,Nx=class extends Vu{constructor(e){super(),this._onActivate=e.onActivate,this.bgDomNode=document.createElement("div"),this.bgDomNode.className="arrow-background",this.bgDomNode.style.position="absolute",this.bgDomNode.style.width=e.bgWidth+"px",this.bgDomNode.style.height=e.bgHeight+"px",typeof e.top<"u"&&(this.bgDomNode.style.top="0px"),typeof e.left<"u"&&(this.bgDomNode.style.left="0px"),typeof e.bottom<"u"&&(this.bgDomNode.style.bottom="0px"),typeof e.right<"u"&&(this.bgDomNode.style.right="0px"),this.domNode=document.createElement("div"),this.domNode.className=e.className,this.domNode.style.position="absolute",this.domNode.style.width=Ng+"px",this.domNode.style.height=Ng+"px",typeof e.top<"u"&&(this.domNode.style.top=e.top+"px"),typeof e.left<"u"&&(this.domNode.style.left=e.left+"px"),typeof e.bottom<"u"&&(this.domNode.style.bottom=e.bottom+"px"),typeof e.right<"u"&&(this.domNode.style.right=e.right+"px"),this._pointerMoveMonitor=this._register(new ov),this._register(Lg(this.bgDomNode,_t.POINTER_DOWN,i=>this._arrowPointerDown(i))),this._register(Lg(this.domNode,_t.POINTER_DOWN,i=>this._arrowPointerDown(i))),this._pointerdownRepeatTimer=this._register(new zx),this._pointerdownScheduleRepeatTimer=this._register(new Gu)}_arrowPointerDown(e){if(!e.target||!(e.target instanceof Element))return;let i=()=>{this._pointerdownRepeatTimer.cancelAndSet(()=>this._onActivate(),1e3/24,Ai(e))};this._onActivate(),this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancelAndSet(i,200),this._pointerMoveMonitor.startMonitoring(e.target,e.pointerId,e.buttons,n=>{},()=>{this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancel()}),e.preventDefault()}},Hx=class mu{constructor(i,n,l,o,h,d,_){this._forceIntegerValues=i,this._scrollStateBrand=void 0,this._forceIntegerValues&&(n=n|0,l=l|0,o=o|0,h=h|0,d=d|0,_=_|0),this.rawScrollLeft=o,this.rawScrollTop=_,n<0&&(n=0),o+n>l&&(o=l-n),o<0&&(o=0),h<0&&(h=0),_+h>d&&(_=d-h),_<0&&(_=0),this.width=n,this.scrollWidth=l,this.scrollLeft=o,this.height=h,this.scrollHeight=d,this.scrollTop=_}equals(i){return this.rawScrollLeft===i.rawScrollLeft&&this.rawScrollTop===i.rawScrollTop&&this.width===i.width&&this.scrollWidth===i.scrollWidth&&this.scrollLeft===i.scrollLeft&&this.height===i.height&&this.scrollHeight===i.scrollHeight&&this.scrollTop===i.scrollTop}withScrollDimensions(i,n){return new mu(this._forceIntegerValues,typeof i.width<"u"?i.width:this.width,typeof i.scrollWidth<"u"?i.scrollWidth:this.scrollWidth,n?this.rawScrollLeft:this.scrollLeft,typeof i.height<"u"?i.height:this.height,typeof i.scrollHeight<"u"?i.scrollHeight:this.scrollHeight,n?this.rawScrollTop:this.scrollTop)}withScrollPosition(i){return new mu(this._forceIntegerValues,this.width,this.scrollWidth,typeof i.scrollLeft<"u"?i.scrollLeft:this.rawScrollLeft,this.height,this.scrollHeight,typeof i.scrollTop<"u"?i.scrollTop:this.rawScrollTop)}createScrollEvent(i,n){let l=this.width!==i.width,o=this.scrollWidth!==i.scrollWidth,h=this.scrollLeft!==i.scrollLeft,d=this.height!==i.height,_=this.scrollHeight!==i.scrollHeight,p=this.scrollTop!==i.scrollTop;return{inSmoothScrolling:n,oldWidth:i.width,oldScrollWidth:i.scrollWidth,oldScrollLeft:i.scrollLeft,width:this.width,scrollWidth:this.scrollWidth,scrollLeft:this.scrollLeft,oldHeight:i.height,oldScrollHeight:i.scrollHeight,oldScrollTop:i.scrollTop,height:this.height,scrollHeight:this.scrollHeight,scrollTop:this.scrollTop,widthChanged:l,scrollWidthChanged:o,scrollLeftChanged:h,heightChanged:d,scrollHeightChanged:_,scrollTopChanged:p}}},Ux=class extends Se{constructor(e){super(),this._scrollableBrand=void 0,this._onScroll=this._register(new Q),this.onScroll=this._onScroll.event,this._smoothScrollDuration=e.smoothScrollDuration,this._scheduleAtNextAnimationFrame=e.scheduleAtNextAnimationFrame,this._state=new Hx(e.forceIntegerValues,0,0,0,0,0,0),this._smoothScrolling=null}dispose(){this._smoothScrolling&&(this._smoothScrolling.dispose(),this._smoothScrolling=null),super.dispose()}setSmoothScrollDuration(e){this._smoothScrollDuration=e}validateScrollPosition(e){return this._state.withScrollPosition(e)}getScrollDimensions(){return this._state}setScrollDimensions(e,i){let n=this._state.withScrollDimensions(e,i);this._setState(n,!!this._smoothScrolling),this._smoothScrolling?.acceptScrollDimensions(this._state)}getFutureScrollPosition(){return this._smoothScrolling?this._smoothScrolling.to:this._state}getCurrentScrollPosition(){return this._state}setScrollPositionNow(e){let i=this._state.withScrollPosition(e);this._smoothScrolling&&(this._smoothScrolling.dispose(),this._smoothScrolling=null),this._setState(i,!1)}setScrollPositionSmooth(e,i){if(this._smoothScrollDuration===0)return this.setScrollPositionNow(e);if(this._smoothScrolling){e={scrollLeft:typeof e.scrollLeft>"u"?this._smoothScrolling.to.scrollLeft:e.scrollLeft,scrollTop:typeof e.scrollTop>"u"?this._smoothScrolling.to.scrollTop:e.scrollTop};let n=this._state.withScrollPosition(e);if(this._smoothScrolling.to.scrollLeft===n.scrollLeft&&this._smoothScrolling.to.scrollTop===n.scrollTop)return;let l;i?l=new Ug(this._smoothScrolling.from,n,this._smoothScrolling.startTime,this._smoothScrolling.duration):l=this._smoothScrolling.combine(this._state,n,this._smoothScrollDuration),this._smoothScrolling.dispose(),this._smoothScrolling=l}else{let n=this._state.withScrollPosition(e);this._smoothScrolling=Ug.start(this._state,n,this._smoothScrollDuration)}this._smoothScrolling.animationFrameDisposable=this._scheduleAtNextAnimationFrame(()=>{this._smoothScrolling&&(this._smoothScrolling.animationFrameDisposable=null,this._performSmoothScrolling())})}hasPendingScrollAnimation(){return!!this._smoothScrolling}_performSmoothScrolling(){if(!this._smoothScrolling)return;let e=this._smoothScrolling.tick(),i=this._state.withScrollPosition(e);if(this._setState(i,!0),!!this._smoothScrolling){if(e.isDone){this._smoothScrolling.dispose(),this._smoothScrolling=null;return}this._smoothScrolling.animationFrameDisposable=this._scheduleAtNextAnimationFrame(()=>{this._smoothScrolling&&(this._smoothScrolling.animationFrameDisposable=null,this._performSmoothScrolling())})}}_setState(e,i){let n=this._state;n.equals(e)||(this._state=e,this._onScroll.fire(this._state.createScrollEvent(n,i)))}},Hg=class{constructor(e,i,n){this.scrollLeft=e,this.scrollTop=i,this.isDone=n}};function Kh(e,i){let n=i-e;return function(l){return e+n*Px(l)}}function Wx(e,i,n){return function(l){return l<n?e(l/n):i((l-n)/(1-n))}}var Ug=class vu{constructor(i,n,l,o){this.from=i,this.to=n,this.duration=o,this.startTime=l,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(i,n,l){if(Math.abs(i-n)>2.5*l){let o,h;return i<n?(o=i+.75*l,h=n-.75*l):(o=i-.75*l,h=n+.75*l),Wx(Kh(i,o),Kh(h,n),.33)}return Kh(i,n)}dispose(){this.animationFrameDisposable!==null&&(this.animationFrameDisposable.dispose(),this.animationFrameDisposable=null)}acceptScrollDimensions(i){this.to=i.withScrollPosition(this.to),this._initAnimations()}tick(){return this._tick(Date.now())}_tick(i){let n=(i-this.startTime)/this.duration;if(n<1){let l=this.scrollLeft(n),o=this.scrollTop(n);return new Hg(l,o,!1)}return new Hg(this.to.scrollLeft,this.to.scrollTop,!0)}combine(i,n,l){return vu.start(i,n,l)}static start(i,n,l){l=l+10;let o=Date.now()-10;return new vu(i,n,o,l)}};function qx(e){return Math.pow(e,3)}function Px(e){return 1-qx(1-e)}var Ix=class extends Se{constructor(e,i,n){super(),this._visibility=e,this._visibleClassName=i,this._invisibleClassName=n,this._domNode=null,this._isVisible=!1,this._isNeeded=!1,this._rawShouldBeVisible=!1,this._shouldBeVisible=!1,this._revealTimer=this._register(new Gu)}setVisibility(e){this._visibility!==e&&(this._visibility=e,this._updateShouldBeVisible())}setShouldBeVisible(e){this._rawShouldBeVisible=e,this._updateShouldBeVisible()}_applyVisibilitySetting(){return this._visibility===2?!1:this._visibility===3?!0:this._rawShouldBeVisible}_updateShouldBeVisible(){let e=this._applyVisibilitySetting();this._shouldBeVisible!==e&&(this._shouldBeVisible=e,this.ensureVisibility())}setIsNeeded(e){this._isNeeded!==e&&(this._isNeeded=e,this.ensureVisibility())}setDomNode(e){this._domNode=e,this._domNode.setClassName(this._invisibleClassName),this.setShouldBeVisible(!1)}ensureVisibility(){if(!this._isNeeded){this._hide(!1);return}this._shouldBeVisible?this._reveal():this._hide(!0)}_reveal(){this._isVisible||(this._isVisible=!0,this._revealTimer.setIfNotSet(()=>{this._domNode?.setClassName(this._visibleClassName)},0))}_hide(e){this._revealTimer.cancel(),this._isVisible&&(this._isVisible=!1,this._domNode?.setClassName(this._invisibleClassName+(e?" fade":"")))}},Yx=140,cv=class extends Vu{constructor(e){super(),this._lazyRender=e.lazyRender,this._host=e.host,this._scrollable=e.scrollable,this._scrollByPage=e.scrollByPage,this._scrollbarState=e.scrollbarState,this._visibilityController=this._register(new Ix(e.visibility,"visible scrollbar "+e.extraScrollbarClassName,"invisible scrollbar "+e.extraScrollbarClassName)),this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._pointerMoveMonitor=this._register(new ov),this._shouldRender=!0,this.domNode=fl(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(fe(this.domNode.domNode,_t.POINTER_DOWN,i=>this._domNodePointerDown(i)))}_createArrow(e){let i=this._register(new Nx(e));this.domNode.domNode.appendChild(i.bgDomNode),this.domNode.domNode.appendChild(i.domNode)}_createSlider(e,i,n,l){this.slider=fl(document.createElement("div")),this.slider.setClassName("slider"),this.slider.setPosition("absolute"),this.slider.setTop(e),this.slider.setLeft(i),typeof n=="number"&&this.slider.setWidth(n),typeof l=="number"&&this.slider.setHeight(l),this.slider.setLayerHinting(!0),this.slider.setContain("strict"),this.domNode.domNode.appendChild(this.slider.domNode),this._register(fe(this.slider.domNode,_t.POINTER_DOWN,o=>{o.button===0&&(o.preventDefault(),this._sliderPointerDown(o))})),this.onclick(this.slider.domNode,o=>{o.leftButton&&o.stopPropagation()})}_onElementSize(e){return this._scrollbarState.setVisibleSize(e)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}_onElementScrollSize(e){return this._scrollbarState.setScrollSize(e)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}_onElementScrollPosition(e){return this._scrollbarState.setScrollPosition(e)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}beginReveal(){this._visibilityController.setShouldBeVisible(!0)}beginHide(){this._visibilityController.setShouldBeVisible(!1)}render(){this._shouldRender&&(this._shouldRender=!1,this._renderDomNode(this._scrollbarState.getRectangleLargeSize(),this._scrollbarState.getRectangleSmallSize()),this._updateSlider(this._scrollbarState.getSliderSize(),this._scrollbarState.getArrowSize()+this._scrollbarState.getSliderPosition()))}_domNodePointerDown(e){e.target===this.domNode.domNode&&this._onPointerDown(e)}delegatePointerDown(e){let i=this.domNode.domNode.getClientRects()[0].top,n=i+this._scrollbarState.getSliderPosition(),l=i+this._scrollbarState.getSliderPosition()+this._scrollbarState.getSliderSize(),o=this._sliderPointerPosition(e);n<=o&&o<=l?e.button===0&&(e.preventDefault(),this._sliderPointerDown(e)):this._onPointerDown(e)}_onPointerDown(e){let i,n;if(e.target===this.domNode.domNode&&typeof e.offsetX=="number"&&typeof e.offsetY=="number")i=e.offsetX,n=e.offsetY;else{let o=Ax(this.domNode.domNode);i=e.pageX-o.left,n=e.pageY-o.top}let l=this._pointerDownRelativePosition(i,n);this._setDesiredScrollPositionNow(this._scrollByPage?this._scrollbarState.getDesiredScrollPositionFromOffsetPaged(l):this._scrollbarState.getDesiredScrollPositionFromOffset(l)),e.button===0&&(e.preventDefault(),this._sliderPointerDown(e))}_sliderPointerDown(e){if(!e.target||!(e.target instanceof Element))return;let i=this._sliderPointerPosition(e),n=this._sliderOrthogonalPointerPosition(e),l=this._scrollbarState.clone();this.slider.toggleClassName("active",!0),this._pointerMoveMonitor.startMonitoring(e.target,e.pointerId,e.buttons,o=>{let h=this._sliderOrthogonalPointerPosition(o),d=Math.abs(h-n);if(rv&&d>Yx){this._setDesiredScrollPositionNow(l.getScrollPosition());return}let _=this._sliderPointerPosition(o)-i;this._setDesiredScrollPositionNow(l.getDesiredScrollPositionFromDelta(_))},()=>{this.slider.toggleClassName("active",!1),this._host.onDragEnd()}),this._host.onDragStart()}_setDesiredScrollPositionNow(e){let i={};this.writeScrollPosition(i,e),this._scrollable.setScrollPositionNow(i)}updateScrollbarSize(e){this._updateScrollbarSize(e),this._scrollbarState.setScrollbarSize(e),this._shouldRender=!0,this._lazyRender||this.render()}isNeeded(){return this._scrollbarState.isNeeded()}},hv=class yu{constructor(i,n,l,o,h,d){this._scrollbarSize=Math.round(n),this._oppositeScrollbarSize=Math.round(l),this._arrowSize=Math.round(i),this._visibleSize=o,this._scrollSize=h,this._scrollPosition=d,this._computedAvailableSize=0,this._computedIsNeeded=!1,this._computedSliderSize=0,this._computedSliderRatio=0,this._computedSliderPosition=0,this._refreshComputedValues()}clone(){return new yu(this._arrowSize,this._scrollbarSize,this._oppositeScrollbarSize,this._visibleSize,this._scrollSize,this._scrollPosition)}setVisibleSize(i){let n=Math.round(i);return this._visibleSize!==n?(this._visibleSize=n,this._refreshComputedValues(),!0):!1}setScrollSize(i){let n=Math.round(i);return this._scrollSize!==n?(this._scrollSize=n,this._refreshComputedValues(),!0):!1}setScrollPosition(i){let n=Math.round(i);return this._scrollPosition!==n?(this._scrollPosition=n,this._refreshComputedValues(),!0):!1}setScrollbarSize(i){this._scrollbarSize=Math.round(i)}setOppositeScrollbarSize(i){this._oppositeScrollbarSize=Math.round(i)}static _computeValues(i,n,l,o,h){let d=Math.max(0,l-i),_=Math.max(0,d-2*n),p=o>0&&o>l;if(!p)return{computedAvailableSize:Math.round(d),computedIsNeeded:p,computedSliderSize:Math.round(_),computedSliderRatio:0,computedSliderPosition:0};let f=Math.round(Math.max(20,Math.floor(l*_/o))),S=(_-f)/(o-l),y=h*S;return{computedAvailableSize:Math.round(d),computedIsNeeded:p,computedSliderSize:Math.round(f),computedSliderRatio:S,computedSliderPosition:Math.round(y)}}_refreshComputedValues(){let i=yu._computeValues(this._oppositeScrollbarSize,this._arrowSize,this._visibleSize,this._scrollSize,this._scrollPosition);this._computedAvailableSize=i.computedAvailableSize,this._computedIsNeeded=i.computedIsNeeded,this._computedSliderSize=i.computedSliderSize,this._computedSliderRatio=i.computedSliderRatio,this._computedSliderPosition=i.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(i){if(!this._computedIsNeeded)return 0;let n=i-this._arrowSize-this._computedSliderSize/2;return Math.round(n/this._computedSliderRatio)}getDesiredScrollPositionFromOffsetPaged(i){if(!this._computedIsNeeded)return 0;let n=i-this._arrowSize,l=this._scrollPosition;return n<this._computedSliderPosition?l-=this._visibleSize:l+=this._visibleSize,l}getDesiredScrollPositionFromDelta(i){if(!this._computedIsNeeded)return 0;let n=this._computedSliderPosition+i;return Math.round(n/this._computedSliderRatio)}},$x=class extends cv{constructor(e,i,n){let l=e.getScrollDimensions(),o=e.getCurrentScrollPosition();if(super({lazyRender:i.lazyRender,host:n,scrollbarState:new hv(i.horizontalHasArrows?i.arrowSize:0,i.horizontal===2?0:i.horizontalScrollbarSize,i.vertical===2?0:i.verticalScrollbarSize,l.width,l.scrollWidth,o.scrollLeft),visibility:i.horizontal,extraScrollbarClassName:"horizontal",scrollable:e,scrollByPage:i.scrollByPage}),i.horizontalHasArrows)throw new Error("horizontalHasArrows is not supported in xterm.js");this._createSlider(Math.floor((i.horizontalScrollbarSize-i.horizontalSliderSize)/2),0,void 0,i.horizontalSliderSize)}_updateSlider(e,i){this.slider.setWidth(e),this.slider.setLeft(i)}_renderDomNode(e,i){this.domNode.setWidth(e),this.domNode.setHeight(i),this.domNode.setLeft(0),this.domNode.setBottom(0)}onDidScroll(e){return this._shouldRender=this._onElementScrollSize(e.scrollWidth)||this._shouldRender,this._shouldRender=this._onElementScrollPosition(e.scrollLeft)||this._shouldRender,this._shouldRender=this._onElementSize(e.width)||this._shouldRender,this._shouldRender}_pointerDownRelativePosition(e,i){return e}_sliderPointerPosition(e){return e.pageX}_sliderOrthogonalPointerPosition(e){return e.pageY}_updateScrollbarSize(e){this.slider.setHeight(e)}writeScrollPosition(e,i){e.scrollLeft=i}updateOptions(e){this.updateScrollbarSize(e.horizontal===2?0:e.horizontalScrollbarSize),this._scrollbarState.setOppositeScrollbarSize(e.vertical===2?0:e.verticalScrollbarSize),this._visibilityController.setVisibility(e.horizontal),this._scrollByPage=e.scrollByPage}},Kx=class extends cv{constructor(e,i,n){let l=e.getScrollDimensions(),o=e.getCurrentScrollPosition();if(super({lazyRender:i.lazyRender,host:n,scrollbarState:new hv(i.verticalHasArrows?i.arrowSize:0,i.vertical===2?0:i.verticalScrollbarSize,0,l.height,l.scrollHeight,o.scrollTop),visibility:i.vertical,extraScrollbarClassName:"vertical",scrollable:e,scrollByPage:i.scrollByPage}),i.verticalHasArrows)throw new Error("horizontalHasArrows is not supported in xterm.js");this._createSlider(0,Math.floor((i.verticalScrollbarSize-i.verticalSliderSize)/2),i.verticalSliderSize,void 0)}_updateSlider(e,i){this.slider.setHeight(e),this.slider.setTop(i)}_renderDomNode(e,i){this.domNode.setWidth(i),this.domNode.setHeight(e),this.domNode.setRight(0),this.domNode.setTop(0)}onDidScroll(e){return this._shouldRender=this._onElementScrollSize(e.scrollHeight)||this._shouldRender,this._shouldRender=this._onElementScrollPosition(e.scrollTop)||this._shouldRender,this._shouldRender=this._onElementSize(e.height)||this._shouldRender,this._shouldRender}_pointerDownRelativePosition(e,i){return i}_sliderPointerPosition(e){return e.pageY}_sliderOrthogonalPointerPosition(e){return e.pageX}_updateScrollbarSize(e){this.slider.setWidth(e)}writeScrollPosition(e,i){e.scrollTop=i}updateOptions(e){this.updateScrollbarSize(e.vertical===2?0:e.verticalScrollbarSize),this._scrollbarState.setOppositeScrollbarSize(0),this._visibilityController.setVisibility(e.vertical),this._scrollByPage=e.scrollByPage}},Fx=500,Wg=50,Gx=class{constructor(e,i,n){this.timestamp=e,this.deltaX=i,this.deltaY=n,this.score=0}},Su=class{constructor(){this._capacity=5,this._memory=[],this._front=-1,this._rear=-1}isPhysicalMouseWheel(){if(this._front===-1&&this._rear===-1)return!1;let i=1,n=0,l=1,o=this._rear;do{let h=o===this._front?i:Math.pow(2,-l);if(i-=h,n+=this._memory[o].score*h,o===this._front)break;o=(this._capacity+o-1)%this._capacity,l++}while(!0);return n<=.5}acceptStandardWheelEvent(i){if(Ku){let n=Ai(i.browserEvent),l=nx(n);this.accept(Date.now(),i.deltaX*l,i.deltaY*l)}else this.accept(Date.now(),i.deltaX,i.deltaY)}accept(i,n,l){let o=null,h=new Gx(i,n,l);this._front===-1&&this._rear===-1?(this._memory[0]=h,this._front=0,this._rear=0):(o=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,o)}_computeScore(i,n){if(Math.abs(i.deltaX)>0&&Math.abs(i.deltaY)>0)return 1;let l=.5;if((!this._isAlmostInt(i.deltaX)||!this._isAlmostInt(i.deltaY))&&(l+=.25),n){let o=Math.abs(i.deltaX),h=Math.abs(i.deltaY),d=Math.abs(n.deltaX),_=Math.abs(n.deltaY),p=Math.max(Math.min(o,d),1),f=Math.max(Math.min(h,_),1),S=Math.max(o,d),y=Math.max(h,_);S%p===0&&y%f===0&&(l-=.5)}return Math.min(Math.max(l,0),1)}_isAlmostInt(i){return Math.abs(Math.round(i)-i)<.01}};Su.INSTANCE=new Su;var Xx=Su,Vx=class extends Vu{constructor(e,i,n){super(),this._onScroll=this._register(new Q),this.onScroll=this._onScroll.event,this._onWillScroll=this._register(new Q),this.onWillScroll=this._onWillScroll.event,this._options=Qx(i),this._scrollable=n,this._register(this._scrollable.onScroll(o=>{this._onWillScroll.fire(o),this._onDidScroll(o),this._onScroll.fire(o)}));let l={onMouseWheel:o=>this._onMouseWheel(o),onDragStart:()=>this._onDragStart(),onDragEnd:()=>this._onDragEnd()};this._verticalScrollbar=this._register(new Kx(this._scrollable,this._options,l)),this._horizontalScrollbar=this._register(new $x(this._scrollable,this._options,l)),this._domNode=document.createElement("div"),this._domNode.className="xterm-scrollable-element "+this._options.className,this._domNode.setAttribute("role","presentation"),this._domNode.style.position="relative",this._domNode.appendChild(e),this._domNode.appendChild(this._horizontalScrollbar.domNode.domNode),this._domNode.appendChild(this._verticalScrollbar.domNode.domNode),this._options.useShadows?(this._leftShadowDomNode=fl(document.createElement("div")),this._leftShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._leftShadowDomNode.domNode),this._topShadowDomNode=fl(document.createElement("div")),this._topShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._topShadowDomNode.domNode),this._topLeftShadowDomNode=fl(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,o=>this._onMouseOver(o)),this.onmouseleave(this._listenOnDomNode,o=>this._onMouseLeave(o)),this._hideTimeout=this._register(new Gu),this._isDragging=!1,this._mouseIsOver=!1,this._shouldRender=!0,this._revealOnScroll=!0}get options(){return this._options}dispose(){this._mouseWheelToDispose=ar(this._mouseWheelToDispose),super.dispose()}getDomNode(){return this._domNode}getOverviewRulerLayoutInfo(){return{parent:this._domNode,insertBefore:this._verticalScrollbar.domNode.domNode}}delegateVerticalScrollbarPointerDown(e){this._verticalScrollbar.delegatePointerDown(e)}getScrollDimensions(){return this._scrollable.getScrollDimensions()}setScrollDimensions(e){this._scrollable.setScrollDimensions(e,!1)}updateClassName(e){this._options.className=e,Oi&&(this._options.className+=" mac"),this._domNode.className="xterm-scrollable-element "+this._options.className}updateOptions(e){typeof e.handleMouseWheel<"u"&&(this._options.handleMouseWheel=e.handleMouseWheel,this._setListeningToMouseWheel(this._options.handleMouseWheel)),typeof e.mouseWheelScrollSensitivity<"u"&&(this._options.mouseWheelScrollSensitivity=e.mouseWheelScrollSensitivity),typeof e.fastScrollSensitivity<"u"&&(this._options.fastScrollSensitivity=e.fastScrollSensitivity),typeof e.scrollPredominantAxis<"u"&&(this._options.scrollPredominantAxis=e.scrollPredominantAxis),typeof e.horizontal<"u"&&(this._options.horizontal=e.horizontal),typeof e.vertical<"u"&&(this._options.vertical=e.vertical),typeof e.horizontalScrollbarSize<"u"&&(this._options.horizontalScrollbarSize=e.horizontalScrollbarSize),typeof e.verticalScrollbarSize<"u"&&(this._options.verticalScrollbarSize=e.verticalScrollbarSize),typeof e.scrollByPage<"u"&&(this._options.scrollByPage=e.scrollByPage),this._horizontalScrollbar.updateOptions(this._options),this._verticalScrollbar.updateOptions(this._options),this._options.lazyRender||this._render()}setRevealOnScroll(e){this._revealOnScroll=e}delegateScrollFromMouseWheelEvent(e){this._onMouseWheel(new Ag(e))}_setListeningToMouseWheel(e){if(this._mouseWheelToDispose.length>0!==e&&(this._mouseWheelToDispose=ar(this._mouseWheelToDispose),e)){let i=n=>{this._onMouseWheel(new Ag(n))};this._mouseWheelToDispose.push(fe(this._listenOnDomNode,_t.MOUSE_WHEEL,i,{passive:!1}))}}_onMouseWheel(e){if(e.browserEvent?.defaultPrevented)return;let i=Xx.INSTANCE;i.acceptStandardWheelEvent(e);let n=!1;if(e.deltaY||e.deltaX){let o=e.deltaY*this._options.mouseWheelScrollSensitivity,h=e.deltaX*this._options.mouseWheelScrollSensitivity;this._options.scrollPredominantAxis&&(this._options.scrollYToX&&h+o===0?h=o=0:Math.abs(o)>=Math.abs(h)?h=0:o=0),this._options.flipAxes&&([o,h]=[h,o]);let d=!Oi&&e.browserEvent&&e.browserEvent.shiftKey;(this._options.scrollYToX||d)&&!h&&(h=o,o=0),e.browserEvent&&e.browserEvent.altKey&&(h=h*this._options.fastScrollSensitivity,o=o*this._options.fastScrollSensitivity);let _=this._scrollable.getFutureScrollPosition(),p={};if(o){let f=Wg*o,S=_.scrollTop-(f<0?Math.floor(f):Math.ceil(f));this._verticalScrollbar.writeScrollPosition(p,S)}if(h){let f=Wg*h,S=_.scrollLeft-(f<0?Math.floor(f):Math.ceil(f));this._horizontalScrollbar.writeScrollPosition(p,S)}p=this._scrollable.validateScrollPosition(p),(_.scrollLeft!==p.scrollLeft||_.scrollTop!==p.scrollTop)&&(this._options.mouseWheelSmoothScroll&&i.isPhysicalMouseWheel()?this._scrollable.setScrollPositionSmooth(p):this._scrollable.setScrollPositionNow(p),n=!0)}let l=n;!l&&this._options.alwaysConsumeMouseWheel&&(l=!0),!l&&this._options.consumeMouseWheelIfScrollbarIsNeeded&&(this._verticalScrollbar.isNeeded()||this._horizontalScrollbar.isNeeded())&&(l=!0),l&&(e.preventDefault(),e.stopPropagation())}_onDidScroll(e){this._shouldRender=this._horizontalScrollbar.onDidScroll(e)||this._shouldRender,this._shouldRender=this._verticalScrollbar.onDidScroll(e)||this._shouldRender,this._options.useShadows&&(this._shouldRender=!0),this._revealOnScroll&&this._reveal(),this._options.lazyRender||this._render()}renderNow(){if(!this._options.lazyRender)throw new Error("Please use `lazyRender` together with `renderNow`!");this._render()}_render(){if(this._shouldRender&&(this._shouldRender=!1,this._horizontalScrollbar.render(),this._verticalScrollbar.render(),this._options.useShadows)){let e=this._scrollable.getCurrentScrollPosition(),i=e.scrollTop>0,n=e.scrollLeft>0,l=n?" left":"",o=i?" top":"",h=n||i?" top-left-corner":"";this._leftShadowDomNode.setClassName(`shadow${l}`),this._topShadowDomNode.setClassName(`shadow${o}`),this._topLeftShadowDomNode.setClassName(`shadow${h}${o}${l}`)}}_onDragStart(){this._isDragging=!0,this._reveal()}_onDragEnd(){this._isDragging=!1,this._hide()}_onMouseLeave(e){this._mouseIsOver=!1,this._hide()}_onMouseOver(e){this._mouseIsOver=!0,this._reveal()}_reveal(){this._verticalScrollbar.beginReveal(),this._horizontalScrollbar.beginReveal(),this._scheduleHide()}_hide(){!this._mouseIsOver&&!this._isDragging&&(this._verticalScrollbar.beginHide(),this._horizontalScrollbar.beginHide())}_scheduleHide(){!this._mouseIsOver&&!this._isDragging&&this._hideTimeout.cancelAndSet(()=>this._hide(),Fx)}},Zx=class extends Vx{constructor(e,i,n){super(e,i,n)}setScrollPosition(e){e.reuseAnimation?this._scrollable.setScrollPositionSmooth(e,e.reuseAnimation):this._scrollable.setScrollPositionNow(e)}getScrollPosition(){return this._scrollable.getCurrentScrollPosition()}};function Qx(e){let i={lazyRender:typeof e.lazyRender<"u"?e.lazyRender:!1,className:typeof e.className<"u"?e.className:"",useShadows:typeof e.useShadows<"u"?e.useShadows:!0,handleMouseWheel:typeof e.handleMouseWheel<"u"?e.handleMouseWheel:!0,flipAxes:typeof e.flipAxes<"u"?e.flipAxes:!1,consumeMouseWheelIfScrollbarIsNeeded:typeof e.consumeMouseWheelIfScrollbarIsNeeded<"u"?e.consumeMouseWheelIfScrollbarIsNeeded:!1,alwaysConsumeMouseWheel:typeof e.alwaysConsumeMouseWheel<"u"?e.alwaysConsumeMouseWheel:!1,scrollYToX:typeof e.scrollYToX<"u"?e.scrollYToX:!1,mouseWheelScrollSensitivity:typeof e.mouseWheelScrollSensitivity<"u"?e.mouseWheelScrollSensitivity:1,fastScrollSensitivity:typeof e.fastScrollSensitivity<"u"?e.fastScrollSensitivity:5,scrollPredominantAxis:typeof e.scrollPredominantAxis<"u"?e.scrollPredominantAxis:!0,mouseWheelSmoothScroll:typeof e.mouseWheelSmoothScroll<"u"?e.mouseWheelSmoothScroll:!0,arrowSize:typeof e.arrowSize<"u"?e.arrowSize:11,listenOnDomNode:typeof e.listenOnDomNode<"u"?e.listenOnDomNode:null,horizontal:typeof e.horizontal<"u"?e.horizontal:1,horizontalScrollbarSize:typeof e.horizontalScrollbarSize<"u"?e.horizontalScrollbarSize:10,horizontalSliderSize:typeof e.horizontalSliderSize<"u"?e.horizontalSliderSize:0,horizontalHasArrows:typeof e.horizontalHasArrows<"u"?e.horizontalHasArrows:!1,vertical:typeof e.vertical<"u"?e.vertical:1,verticalScrollbarSize:typeof e.verticalScrollbarSize<"u"?e.verticalScrollbarSize:10,verticalHasArrows:typeof e.verticalHasArrows<"u"?e.verticalHasArrows:!1,verticalSliderSize:typeof e.verticalSliderSize<"u"?e.verticalSliderSize:0,scrollByPage:typeof e.scrollByPage<"u"?e.scrollByPage:!1};return i.horizontalSliderSize=typeof e.horizontalSliderSize<"u"?e.horizontalSliderSize:i.horizontalScrollbarSize,i.verticalSliderSize=typeof e.verticalSliderSize<"u"?e.verticalSliderSize:i.verticalScrollbarSize,Oi&&(i.className+=" mac"),i}var bu=class extends Se{constructor(e,i,n,l,o,h,d,_){super(),this._bufferService=n,this._optionsService=d,this._renderService=_,this._onRequestScrollLines=this._register(new Q),this.onRequestScrollLines=this._onRequestScrollLines.event,this._isSyncing=!1,this._isHandlingScroll=!1,this._suppressOnScrollHandler=!1;let p=this._register(new Ux({forceIntegerValues:!1,smoothScrollDuration:this._optionsService.rawOptions.smoothScrollDuration,scheduleAtNextAnimationFrame:f=>Xu(l.window,f)}));this._register(this._optionsService.onSpecificOptionChange("smoothScrollDuration",()=>{p.setSmoothScrollDuration(this._optionsService.rawOptions.smoothScrollDuration)})),this._scrollableElement=this._register(new Zx(i,{vertical:1,horizontal:2,useShadows:!1,mouseWheelSmoothScroll:!0,...this._getChangeOptions()},p)),this._register(this._optionsService.onMultipleOptionChange(["scrollSensitivity","fastScrollSensitivity","overviewRuler"],()=>this._scrollableElement.updateOptions(this._getChangeOptions()))),this._register(o.onProtocolChange(f=>{this._scrollableElement.updateOptions({handleMouseWheel:!(f&16)})})),this._scrollableElement.setScrollDimensions({height:0,scrollHeight:0}),this._register(kt.runAndSubscribe(h.onChangeColors,()=>{this._scrollableElement.getDomNode().style.backgroundColor=h.colors.background.css})),e.appendChild(this._scrollableElement.getDomNode()),this._register($e(()=>this._scrollableElement.getDomNode().remove())),this._styleElement=l.mainDocument.createElement("style"),i.appendChild(this._styleElement),this._register($e(()=>this._styleElement.remove())),this._register(kt.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(`
|
|
93
|
+
`)})),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(f=>this._handleScroll(f)))}scrollLines(e){let i=this._scrollableElement.getScrollPosition();this._scrollableElement.setScrollPosition({reuseAnimation:!0,scrollTop:i.scrollTop+e*this._renderService.dimensions.css.cell.height})}scrollToLine(e,i){i&&(this._latestYDisp=e),this._scrollableElement.setScrollPosition({reuseAnimation:!i,scrollTop:e*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(e){e!==void 0&&(this._latestYDisp=e),this._queuedAnimationFrame===void 0&&(this._queuedAnimationFrame=this._renderService.addRefreshCallback(()=>{this._queuedAnimationFrame=void 0,this._sync(this._latestYDisp)}))}_sync(e=this._bufferService.buffer.ydisp){!this._renderService||this._isSyncing||(this._isSyncing=!0,this._suppressOnScrollHandler=!0,this._scrollableElement.setScrollDimensions({height:this._renderService.dimensions.css.canvas.height,scrollHeight:this._renderService.dimensions.css.cell.height*this._bufferService.buffer.lines.length}),this._suppressOnScrollHandler=!1,e!==this._latestYDisp&&this._scrollableElement.setScrollPosition({scrollTop:e*this._renderService.dimensions.css.cell.height}),this._isSyncing=!1)}_handleScroll(e){if(!this._renderService||this._isHandlingScroll||this._suppressOnScrollHandler)return;this._isHandlingScroll=!0;let i=Math.round(e.scrollTop/this._renderService.dimensions.css.cell.height),n=i-this._bufferService.buffer.ydisp;n!==0&&(this._latestYDisp=i,this._onRequestScrollLines.fire(n)),this._isHandlingScroll=!1}};bu=Qe([se(2,zt),se(3,rs),se(4,Ym),se(5,tn),se(6,At),se(7,ns)],bu);var xu=class extends Se{constructor(e,i,n,l,o){super(),this._screenElement=e,this._bufferService=i,this._coreBrowserService=n,this._decorationService=l,this._renderService=o,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($e(()=>{this._container.remove(),this._decorationElements.clear()}))}_queueRefresh(){this._animationFrame===void 0&&(this._animationFrame=this._renderService.addRefreshCallback(()=>{this._doRefreshDecorations(),this._animationFrame=void 0}))}_doRefreshDecorations(){for(let e of this._decorationService.decorations)this._renderDecoration(e);this._dimensionsChanged=!1}_renderDecoration(e){this._refreshStyle(e),this._dimensionsChanged&&this._refreshXPosition(e)}_createElement(e){let i=this._coreBrowserService.mainDocument.createElement("div");i.classList.add("xterm-decoration"),i.classList.toggle("xterm-decoration-top-layer",e?.options?.layer==="top"),i.style.width=`${Math.round((e.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,i.style.height=`${(e.options.height||1)*this._renderService.dimensions.css.cell.height}px`,i.style.top=`${(e.marker.line-this._bufferService.buffers.active.ydisp)*this._renderService.dimensions.css.cell.height}px`,i.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`;let n=e.options.x??0;return n&&n>this._bufferService.cols&&(i.style.display="none"),this._refreshXPosition(e,i),i}_refreshStyle(e){let i=e.marker.line-this._bufferService.buffers.active.ydisp;if(i<0||i>=this._bufferService.rows)e.element&&(e.element.style.display="none",e.onRenderEmitter.fire(e.element));else{let n=this._decorationElements.get(e);n||(n=this._createElement(e),e.element=n,this._decorationElements.set(e,n),this._container.appendChild(n),e.onDispose(()=>{this._decorationElements.delete(e),n.remove()})),n.style.display=this._altBufferIsActive?"none":"block",this._altBufferIsActive||(n.style.width=`${Math.round((e.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,n.style.height=`${(e.options.height||1)*this._renderService.dimensions.css.cell.height}px`,n.style.top=`${i*this._renderService.dimensions.css.cell.height}px`,n.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`),e.onRenderEmitter.fire(n)}}_refreshXPosition(e,i=e.element){if(!i)return;let n=e.options.x??0;(e.options.anchor||"left")==="right"?i.style.right=n?`${n*this._renderService.dimensions.css.cell.width}px`:"":i.style.left=n?`${n*this._renderService.dimensions.css.cell.width}px`:""}_removeDecoration(e){this._decorationElements.get(e)?.remove(),this._decorationElements.delete(e),e.dispose()}};xu=Qe([se(1,zt),se(2,rs),se(3,vl),se(4,ns)],xu);var Jx=class{constructor(){this._zones=[],this._zonePool=[],this._zonePoolIndex=0,this._linePadding={full:0,left:0,center:0,right:0}}get zones(){return this._zonePool.length=Math.min(this._zonePool.length,this._zones.length),this._zones}clear(){this._zones.length=0,this._zonePoolIndex=0}addDecoration(e){if(e.options.overviewRulerOptions){for(let i of this._zones)if(i.color===e.options.overviewRulerOptions.color&&i.position===e.options.overviewRulerOptions.position){if(this._lineIntersectsZone(i,e.marker.line))return;if(this._lineAdjacentToZone(i,e.marker.line,e.options.overviewRulerOptions.position)){this._addLineToZone(i,e.marker.line);return}}if(this._zonePoolIndex<this._zonePool.length){this._zonePool[this._zonePoolIndex].color=e.options.overviewRulerOptions.color,this._zonePool[this._zonePoolIndex].position=e.options.overviewRulerOptions.position,this._zonePool[this._zonePoolIndex].startBufferLine=e.marker.line,this._zonePool[this._zonePoolIndex].endBufferLine=e.marker.line,this._zones.push(this._zonePool[this._zonePoolIndex++]);return}this._zones.push({color:e.options.overviewRulerOptions.color,position:e.options.overviewRulerOptions.position,startBufferLine:e.marker.line,endBufferLine:e.marker.line}),this._zonePool.push(this._zones[this._zones.length-1]),this._zonePoolIndex++}}setPadding(e){this._linePadding=e}_lineIntersectsZone(e,i){return i>=e.startBufferLine&&i<=e.endBufferLine}_lineAdjacentToZone(e,i,n){return i>=e.startBufferLine-this._linePadding[n||"full"]&&i<=e.endBufferLine+this._linePadding[n||"full"]}_addLineToZone(e,i){e.startBufferLine=Math.min(e.startBufferLine,i),e.endBufferLine=Math.max(e.endBufferLine,i)}},Di={full:0,left:0,center:0,right:0},zs={full:0,left:0,center:0,right:0},Jn={full:0,left:0,center:0,right:0},eo=class extends Se{constructor(e,i,n,l,o,h,d,_){super(),this._viewportElement=e,this._screenElement=i,this._bufferService=n,this._decorationService=l,this._renderService=o,this._optionsService=h,this._themeService=d,this._coreBrowserService=_,this._colorZoneStore=new Jx,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($e(()=>this._canvas?.remove()));let p=this._canvas.getContext("2d");if(p)this._ctx=p;else throw new Error("Ctx cannot be null");this._register(this._decorationService.onDecorationRegistered(()=>this._queueRefresh(void 0,!0))),this._register(this._decorationService.onDecorationRemoved(()=>this._queueRefresh(void 0,!0))),this._register(this._renderService.onRenderedViewportChange(()=>this._queueRefresh())),this._register(this._bufferService.buffers.onBufferActivate(()=>{this._canvas.style.display=this._bufferService.buffer===this._bufferService.buffers.alt?"none":"block"})),this._register(this._bufferService.onScroll(()=>{this._lastKnownBufferLength!==this._bufferService.buffers.normal.lines.length&&(this._refreshDrawHeightConstants(),this._refreshColorZonePadding())})),this._register(this._renderService.onRender(()=>{(!this._containerHeight||this._containerHeight!==this._screenElement.clientHeight)&&(this._queueRefresh(!0),this._containerHeight=this._screenElement.clientHeight)})),this._register(this._coreBrowserService.onDprChange(()=>this._queueRefresh(!0))),this._register(this._optionsService.onSpecificOptionChange("overviewRuler",()=>this._queueRefresh(!0))),this._register(this._themeService.onChangeColors(()=>this._queueRefresh())),this._queueRefresh(!0)}get _width(){return this._optionsService.options.overviewRuler?.width||0}_refreshDrawConstants(){let e=Math.floor((this._canvas.width-1)/3),i=Math.ceil((this._canvas.width-1)/3);zs.full=this._canvas.width,zs.left=e,zs.center=i,zs.right=e,this._refreshDrawHeightConstants(),Jn.full=1,Jn.left=1,Jn.center=1+zs.left,Jn.right=1+zs.left+zs.center}_refreshDrawHeightConstants(){Di.full=Math.round(2*this._coreBrowserService.dpr);let e=this._canvas.height/this._bufferService.buffer.lines.length,i=Math.round(Math.max(Math.min(e,12),6)*this._coreBrowserService.dpr);Di.left=i,Di.center=i,Di.right=i}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*Di.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*Di.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*Di.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*Di.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 i of this._decorationService.decorations)this._colorZoneStore.addDecoration(i);this._ctx.lineWidth=1,this._renderRulerOutline();let e=this._colorZoneStore.zones;for(let i of e)i.position!=="full"&&this._renderColorZone(i);for(let i of e)i.position==="full"&&this._renderColorZone(i);this._shouldUpdateDimensions=!1,this._shouldUpdateAnchor=!1}_renderRulerOutline(){this._ctx.fillStyle=this._themeService.colors.overviewRulerBorder.css,this._ctx.fillRect(0,0,1,this._canvas.height),this._optionsService.rawOptions.overviewRuler.showTopBorder&&this._ctx.fillRect(1,0,this._canvas.width-1,1),this._optionsService.rawOptions.overviewRuler.showBottomBorder&&this._ctx.fillRect(1,this._canvas.height-1,this._canvas.width-1,this._canvas.height)}_renderColorZone(e){this._ctx.fillStyle=e.color,this._ctx.fillRect(Jn[e.position||"full"],Math.round((this._canvas.height-1)*(e.startBufferLine/this._bufferService.buffers.active.lines.length)-Di[e.position||"full"]/2),zs[e.position||"full"],Math.round((this._canvas.height-1)*((e.endBufferLine-e.startBufferLine)/this._bufferService.buffers.active.lines.length)+Di[e.position||"full"]))}_queueRefresh(e,i){this._shouldUpdateDimensions=e||this._shouldUpdateDimensions,this._shouldUpdateAnchor=i||this._shouldUpdateAnchor,this._animationFrame===void 0&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>{this._refreshDecorations(),this._animationFrame=void 0}))}};eo=Qe([se(2,zt),se(3,vl),se(4,ns),se(5,At),se(6,tn),se(7,rs)],eo);var F;(e=>(e.NUL="\0",e.SOH="",e.STX="",e.ETX="",e.EOT="",e.ENQ="",e.ACK="",e.BEL="\x07",e.BS="\b",e.HT=" ",e.LF=`
|
|
94
|
+
`,e.VT="\v",e.FF="\f",e.CR="\r",e.SO="",e.SI="",e.DLE="",e.DC1="",e.DC2="",e.DC3="",e.DC4="",e.NAK="",e.SYN="",e.ETB="",e.CAN="",e.EM="",e.SUB="",e.ESC="\x1B",e.FS="",e.GS="",e.RS="",e.US="",e.SP=" ",e.DEL=""))(F||={});var Xa;(e=>(e.PAD="",e.HOP="",e.BPH="",e.NBH="",e.IND="",e.NEL="
",e.SSA="",e.ESA="",e.HTS="",e.HTJ="",e.VTS="",e.PLD="",e.PLU="",e.RI="",e.SS2="",e.SS3="",e.DCS="",e.PU1="",e.PU2="",e.STS="",e.CCH="",e.MW="",e.SPA="",e.EPA="",e.SOS="",e.SGCI="",e.SCI="",e.CSI="",e.ST="",e.OSC="",e.PM="",e.APC=""))(Xa||={});var uv;(e=>e.ST=`${F.ESC}\\`)(uv||={});var wu=class{constructor(e,i,n,l,o,h){this._textarea=e,this._compositionView=i,this._bufferService=n,this._optionsService=l,this._coreService=o,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(e){this._compositionView.textContent=e.data,this.updateCompositionElements(),setTimeout(()=>{this._compositionPosition.end=this._textarea.value.length},0)}compositionend(){this._finalizeComposition(!0)}keydown(e){if(this._isComposing||this._isSendingComposition){if(e.keyCode===20||e.keyCode===229||e.keyCode===16||e.keyCode===17||e.keyCode===18)return!1;this._finalizeComposition(!1)}return e.keyCode===229?(this._handleAnyTextareaChanges(),!1):!0}_finalizeComposition(e){if(this._compositionView.classList.remove("active"),this._isComposing=!1,e){let i={start:this._compositionPosition.start,end:this._compositionPosition.end};this._isSendingComposition=!0,setTimeout(()=>{if(this._isSendingComposition){this._isSendingComposition=!1;let n;i.start+=this._dataAlreadySent.length,this._isComposing?n=this._textarea.value.substring(i.start,this._compositionPosition.start):n=this._textarea.value.substring(i.start),n.length>0&&this._coreService.triggerDataEvent(n,!0)}},0)}else{this._isSendingComposition=!1;let i=this._textarea.value.substring(this._compositionPosition.start,this._compositionPosition.end);this._coreService.triggerDataEvent(i,!0)}}_handleAnyTextareaChanges(){let e=this._textarea.value;setTimeout(()=>{if(!this._isComposing){let i=this._textarea.value,n=i.replace(e,"");this._dataAlreadySent=n,i.length>e.length?this._coreService.triggerDataEvent(n,!0):i.length<e.length?this._coreService.triggerDataEvent(`${F.DEL}`,!0):i.length===e.length&&i!==e&&this._coreService.triggerDataEvent(i,!0)}},0)}updateCompositionElements(e){if(this._isComposing){if(this._bufferService.buffer.isCursorInViewport){let i=Math.min(this._bufferService.buffer.x,this._bufferService.cols-1),n=this._renderService.dimensions.css.cell.height,l=this._bufferService.buffer.y*this._renderService.dimensions.css.cell.height,o=i*this._renderService.dimensions.css.cell.width;this._compositionView.style.left=o+"px",this._compositionView.style.top=l+"px",this._compositionView.style.height=n+"px",this._compositionView.style.lineHeight=n+"px",this._compositionView.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._compositionView.style.fontSize=this._optionsService.rawOptions.fontSize+"px";let h=this._compositionView.getBoundingClientRect();this._textarea.style.left=o+"px",this._textarea.style.top=l+"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"}e||setTimeout(()=>this.updateCompositionElements(!0),0)}}};wu=Qe([se(2,zt),se(3,At),se(4,hr),se(5,ns)],wu);var gt=0,mt=0,vt=0,Ze=0,qg={css:"#00000000",rgba:0},at;(e=>{function i(o,h,d,_){return _!==void 0?`#${tr(o)}${tr(h)}${tr(d)}${tr(_)}`:`#${tr(o)}${tr(h)}${tr(d)}`}e.toCss=i;function n(o,h,d,_=255){return(o<<24|h<<16|d<<8|_)>>>0}e.toRgba=n;function l(o,h,d,_){return{css:e.toCss(o,h,d,_),rgba:e.toRgba(o,h,d,_)}}e.toColor=l})(at||={});var Ie;(e=>{function i(p,f){if(Ze=(f.rgba&255)/255,Ze===1)return{css:f.css,rgba:f.rgba};let S=f.rgba>>24&255,y=f.rgba>>16&255,x=f.rgba>>8&255,C=p.rgba>>24&255,b=p.rgba>>16&255,T=p.rgba>>8&255;gt=C+Math.round((S-C)*Ze),mt=b+Math.round((y-b)*Ze),vt=T+Math.round((x-T)*Ze);let M=at.toCss(gt,mt,vt),A=at.toRgba(gt,mt,vt);return{css:M,rgba:A}}e.blend=i;function n(p){return(p.rgba&255)===255}e.isOpaque=n;function l(p,f,S){let y=Va.ensureContrastRatio(p.rgba,f.rgba,S);if(y)return at.toColor(y>>24&255,y>>16&255,y>>8&255)}e.ensureContrastRatio=l;function o(p){let f=(p.rgba|255)>>>0;return[gt,mt,vt]=Va.toChannels(f),{css:at.toCss(gt,mt,vt),rgba:f}}e.opaque=o;function h(p,f){return Ze=Math.round(f*255),[gt,mt,vt]=Va.toChannels(p.rgba),{css:at.toCss(gt,mt,vt,Ze),rgba:at.toRgba(gt,mt,vt,Ze)}}e.opacity=h;function d(p,f){return Ze=p.rgba&255,h(p,Ze*f/255)}e.multiplyOpacity=d;function _(p){return[p.rgba>>24&255,p.rgba>>16&255,p.rgba>>8&255]}e.toColorRGB=_})(Ie||={});var Ge;(e=>{let i,n;try{let o=document.createElement("canvas");o.width=1,o.height=1;let h=o.getContext("2d",{willReadFrequently:!0});h&&(i=h,i.globalCompositeOperation="copy",n=i.createLinearGradient(0,0,1,1))}catch{}function l(o){if(o.match(/#[\da-f]{3,8}/i))switch(o.length){case 4:return gt=parseInt(o.slice(1,2).repeat(2),16),mt=parseInt(o.slice(2,3).repeat(2),16),vt=parseInt(o.slice(3,4).repeat(2),16),at.toColor(gt,mt,vt);case 5:return gt=parseInt(o.slice(1,2).repeat(2),16),mt=parseInt(o.slice(2,3).repeat(2),16),vt=parseInt(o.slice(3,4).repeat(2),16),Ze=parseInt(o.slice(4,5).repeat(2),16),at.toColor(gt,mt,vt,Ze);case 7:return{css:o,rgba:(parseInt(o.slice(1),16)<<8|255)>>>0};case 9:return{css:o,rgba:parseInt(o.slice(1),16)>>>0}}let h=o.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 gt=parseInt(h[1]),mt=parseInt(h[2]),vt=parseInt(h[3]),Ze=Math.round((h[5]===void 0?1:parseFloat(h[5]))*255),at.toColor(gt,mt,vt,Ze);if(!i||!n)throw new Error("css.toColor: Unsupported css format");if(i.fillStyle=n,i.fillStyle=o,typeof i.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(i.fillRect(0,0,1,1),[gt,mt,vt,Ze]=i.getImageData(0,0,1,1).data,Ze!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:at.toRgba(gt,mt,vt,Ze),css:o}}e.toColor=l})(Ge||={});var Bt;(e=>{function i(l){return n(l>>16&255,l>>8&255,l&255)}e.relativeLuminance=i;function n(l,o,h){let d=l/255,_=o/255,p=h/255,f=d<=.03928?d/12.92:Math.pow((d+.055)/1.055,2.4),S=_<=.03928?_/12.92:Math.pow((_+.055)/1.055,2.4),y=p<=.03928?p/12.92:Math.pow((p+.055)/1.055,2.4);return f*.2126+S*.7152+y*.0722}e.relativeLuminance2=n})(Bt||={});var Va;(e=>{function i(d,_){if(Ze=(_&255)/255,Ze===1)return _;let p=_>>24&255,f=_>>16&255,S=_>>8&255,y=d>>24&255,x=d>>16&255,C=d>>8&255;return gt=y+Math.round((p-y)*Ze),mt=x+Math.round((f-x)*Ze),vt=C+Math.round((S-C)*Ze),at.toRgba(gt,mt,vt)}e.blend=i;function n(d,_,p){let f=Bt.relativeLuminance(d>>8),S=Bt.relativeLuminance(_>>8);if(ts(f,S)<p){if(S<f){let C=l(d,_,p),b=ts(f,Bt.relativeLuminance(C>>8));if(b<p){let T=o(d,_,p),M=ts(f,Bt.relativeLuminance(T>>8));return b>M?C:T}return C}let y=o(d,_,p),x=ts(f,Bt.relativeLuminance(y>>8));if(x<p){let C=l(d,_,p),b=ts(f,Bt.relativeLuminance(C>>8));return x>b?y:C}return y}}e.ensureContrastRatio=n;function l(d,_,p){let f=d>>24&255,S=d>>16&255,y=d>>8&255,x=_>>24&255,C=_>>16&255,b=_>>8&255,T=ts(Bt.relativeLuminance2(x,C,b),Bt.relativeLuminance2(f,S,y));for(;T<p&&(x>0||C>0||b>0);)x-=Math.max(0,Math.ceil(x*.1)),C-=Math.max(0,Math.ceil(C*.1)),b-=Math.max(0,Math.ceil(b*.1)),T=ts(Bt.relativeLuminance2(x,C,b),Bt.relativeLuminance2(f,S,y));return(x<<24|C<<16|b<<8|255)>>>0}e.reduceLuminance=l;function o(d,_,p){let f=d>>24&255,S=d>>16&255,y=d>>8&255,x=_>>24&255,C=_>>16&255,b=_>>8&255,T=ts(Bt.relativeLuminance2(x,C,b),Bt.relativeLuminance2(f,S,y));for(;T<p&&(x<255||C<255||b<255);)x=Math.min(255,x+Math.ceil((255-x)*.1)),C=Math.min(255,C+Math.ceil((255-C)*.1)),b=Math.min(255,b+Math.ceil((255-b)*.1)),T=ts(Bt.relativeLuminance2(x,C,b),Bt.relativeLuminance2(f,S,y));return(x<<24|C<<16|b<<8|255)>>>0}e.increaseLuminance=o;function h(d){return[d>>24&255,d>>16&255,d>>8&255,d&255]}e.toChannels=h})(Va||={});function tr(e){let i=e.toString(16);return i.length<2?"0"+i:i}function ts(e,i){return e<i?(i+.05)/(e+.05):(e+.05)/(i+.05)}var e1=class extends ml{constructor(e,i,n){super(),this.content=0,this.combinedData="",this.fg=e.fg,this.bg=e.bg,this.combinedData=i,this._width=n}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(e){throw new Error("not implemented")}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},to=class{constructor(e){this._bufferService=e,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new gi}register(e){let i={id:this._nextCharacterJoinerId++,handler:e};return this._characterJoiners.push(i),i.id}deregister(e){for(let i=0;i<this._characterJoiners.length;i++)if(this._characterJoiners[i].id===e)return this._characterJoiners.splice(i,1),!0;return!1}getJoinedCharacters(e){if(this._characterJoiners.length===0)return[];let i=this._bufferService.buffer.lines.get(e);if(!i||i.length===0)return[];let n=[],l=i.translateToString(!0),o=0,h=0,d=0,_=i.getFg(0),p=i.getBg(0);for(let f=0;f<i.getTrimmedLength();f++)if(i.loadCell(f,this._workCell),this._workCell.getWidth()!==0){if(this._workCell.fg!==_||this._workCell.bg!==p){if(f-o>1){let S=this._getJoinedRanges(l,d,h,i,o);for(let y=0;y<S.length;y++)n.push(S[y])}o=f,d=h,_=this._workCell.fg,p=this._workCell.bg}h+=this._workCell.getChars().length||Ls.length}if(this._bufferService.cols-o>1){let f=this._getJoinedRanges(l,d,h,i,o);for(let S=0;S<f.length;S++)n.push(f[S])}return n}_getJoinedRanges(e,i,n,l,o){let h=e.substring(i,n),d=[];try{d=this._characterJoiners[0].handler(h)}catch(_){console.error(_)}for(let _=1;_<this._characterJoiners.length;_++)try{let p=this._characterJoiners[_].handler(h);for(let f=0;f<p.length;f++)to._mergeRanges(d,p[f])}catch(p){console.error(p)}return this._stringRangesToCellRanges(d,l,o),d}_stringRangesToCellRanges(e,i,n){let l=0,o=!1,h=0,d=e[l];if(d){for(let _=n;_<this._bufferService.cols;_++){let p=i.getWidth(_),f=i.getString(_).length||Ls.length;if(p!==0){if(!o&&d[0]<=h&&(d[0]=_,o=!0),d[1]<=h){if(d[1]=_,d=e[++l],!d)break;d[0]<=h?(d[0]=_,o=!0):o=!1}h+=f}}d&&(d[1]=this._bufferService.cols)}}static _mergeRanges(e,i){let n=!1;for(let l=0;l<e.length;l++){let o=e[l];if(n){if(i[1]<=o[0])return e[l-1][1]=i[1],e;if(i[1]<=o[1])return e[l-1][1]=Math.max(i[1],o[1]),e.splice(l,1),e;e.splice(l,1),l--}else{if(i[1]<=o[0])return e.splice(l,0,i),e;if(i[1]<=o[1])return o[0]=Math.min(i[0],o[0]),e;i[0]<o[1]&&(o[0]=Math.min(i[0],o[0]),n=!0);continue}}return n?e[e.length-1][1]=i[1]:e.push(i),e}};to=Qe([se(0,zt)],to);function t1(e){return 57508<=e&&e<=57558}function i1(e){return 9472<=e&&e<=9631}function s1(e){return t1(e)||i1(e)}function r1(){return{css:{canvas:qa(),cell:qa()},device:{canvas:qa(),cell:qa(),char:{width:0,height:0,left:0,top:0}}}}function qa(){return{width:0,height:0}}var Cu=class{constructor(e,i,n,l,o,h,d){this._document=e,this._characterJoinerService=i,this._optionsService=n,this._coreBrowserService=l,this._coreService=o,this._decorationService=h,this._themeService=d,this._workCell=new gi,this._columnSelectMode=!1,this.defaultSpacing=0}handleSelectionChanged(e,i,n){this._selectionStart=e,this._selectionEnd=i,this._columnSelectMode=n}createRow(e,i,n,l,o,h,d,_,p,f,S){let y=[],x=this._characterJoinerService.getJoinedCharacters(i),C=this._themeService.colors,b=e.getNoBgTrimmedLength();n&&b<h+1&&(b=h+1);let T,M=0,A="",O=0,D=0,L=0,H=0,X=!1,V=0,ue=!1,ge=0,Ke=0,de=[],Z=f!==-1&&S!==-1;for(let G=0;G<b;G++){e.loadCell(G,this._workCell);let ie=this._workCell.getWidth();if(ie===0)continue;let ee=!1,R=G>=Ke,I=G,$=this._workCell;if(x.length>0&&G===x[0][0]&&R){let Re=x.shift(),mi=this._isCellInSelection(Re[0],i);for(O=Re[0]+1;O<Re[1];O++)R&&=mi===this._isCellInSelection(O,i);R&&=!n||h<Re[0]||h>=Re[1],R?(ee=!0,$=new e1(this._workCell,e.translateToString(!0,Re[0],Re[1]),Re[1]-Re[0]),I=Re[1]-1,ie=$.getWidth()):Ke=Re[1]}let ae=this._isCellInSelection(G,i),pe=n&&G===h,k=Z&&G>=f&&G<=S,P=!1;this._decorationService.forEachDecorationAtCell(G,i,void 0,Re=>{P=!0});let J=$.getChars()||Ls;if(J===" "&&($.isUnderline()||$.isOverline())&&(J=" "),ge=ie*_-p.get(J,$.isBold(),$.isItalic()),!T)T=this._document.createElement("span");else if(M&&(ae&&ue||!ae&&!ue&&$.bg===D)&&(ae&&ue&&C.selectionForeground||$.fg===L)&&$.extended.ext===H&&k===X&&ge===V&&!pe&&!ee&&!P&&R){$.isInvisible()?A+=Ls:A+=J,M++;continue}else M&&(T.textContent=A),T=this._document.createElement("span"),M=0,A="";if(D=$.bg,L=$.fg,H=$.extended.ext,X=k,V=ge,ue=ae,ee&&h>=G&&h<=I&&(h=G),!this._coreService.isCursorHidden&&pe&&this._coreService.isCursorInitialized){if(de.push("xterm-cursor"),this._coreBrowserService.isFocused)d&&de.push("xterm-cursor-blink"),de.push(l==="bar"?"xterm-cursor-bar":l==="underline"?"xterm-cursor-underline":"xterm-cursor-block");else if(o)switch(o){case"outline":de.push("xterm-cursor-outline");break;case"block":de.push("xterm-cursor-block");break;case"bar":de.push("xterm-cursor-bar");break;case"underline":de.push("xterm-cursor-underline");break}}if($.isBold()&&de.push("xterm-bold"),$.isItalic()&&de.push("xterm-italic"),$.isDim()&&de.push("xterm-dim"),$.isInvisible()?A=Ls:A=$.getChars()||Ls,$.isUnderline()&&(de.push(`xterm-underline-${$.extended.underlineStyle}`),A===" "&&(A=" "),!$.isUnderlineColorDefault()))if($.isUnderlineColorRGB())T.style.textDecorationColor=`rgb(${ml.toColorRGB($.getUnderlineColor()).join(",")})`;else{let Re=$.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&$.isBold()&&Re<8&&(Re+=8),T.style.textDecorationColor=C.ansi[Re].css}$.isOverline()&&(de.push("xterm-overline"),A===" "&&(A=" ")),$.isStrikethrough()&&de.push("xterm-strikethrough"),k&&(T.style.textDecoration="underline");let te=$.getFgColor(),oe=$.getFgColorMode(),he=$.getBgColor(),be=$.getBgColorMode(),ot=!!$.isInverse();if(ot){let Re=te;te=he,he=Re;let mi=oe;oe=be,be=mi}let ze,wi,Ci=!1;this._decorationService.forEachDecorationAtCell(G,i,void 0,Re=>{Re.options.layer!=="top"&&Ci||(Re.backgroundColorRGB&&(be=50331648,he=Re.backgroundColorRGB.rgba>>8&16777215,ze=Re.backgroundColorRGB),Re.foregroundColorRGB&&(oe=50331648,te=Re.foregroundColorRGB.rgba>>8&16777215,wi=Re.foregroundColorRGB),Ci=Re.options.layer==="top")}),!Ci&&ae&&(ze=this._coreBrowserService.isFocused?C.selectionBackgroundOpaque:C.selectionInactiveBackgroundOpaque,he=ze.rgba>>8&16777215,be=50331648,Ci=!0,C.selectionForeground&&(oe=50331648,te=C.selectionForeground.rgba>>8&16777215,wi=C.selectionForeground)),Ci&&de.push("xterm-decoration-top");let ti;switch(be){case 16777216:case 33554432:ti=C.ansi[he],de.push(`xterm-bg-${he}`);break;case 50331648:ti=at.toColor(he>>16,he>>8&255,he&255),this._addStyle(T,`background-color:#${Pg((he>>>0).toString(16),"0",6)}`);break;default:ot?(ti=C.foreground,de.push("xterm-bg-257")):ti=C.background}switch(ze||$.isDim()&&(ze=Ie.multiplyOpacity(ti,.5)),oe){case 16777216:case 33554432:$.isBold()&&te<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(te+=8),this._applyMinimumContrast(T,ti,C.ansi[te],$,ze,void 0)||de.push(`xterm-fg-${te}`);break;case 50331648:let Re=at.toColor(te>>16&255,te>>8&255,te&255);this._applyMinimumContrast(T,ti,Re,$,ze,wi)||this._addStyle(T,`color:#${Pg(te.toString(16),"0",6)}`);break;default:this._applyMinimumContrast(T,ti,C.foreground,$,ze,wi)||ot&&de.push("xterm-fg-257")}de.length&&(T.className=de.join(" "),de.length=0),!pe&&!ee&&!P&&R?M++:T.textContent=A,ge!==this.defaultSpacing&&(T.style.letterSpacing=`${ge}px`),y.push(T),G=I}return T&&M&&(T.textContent=A),y}_applyMinimumContrast(e,i,n,l,o,h){if(this._optionsService.rawOptions.minimumContrastRatio===1||s1(l.getCode()))return!1;let d=this._getContrastCache(l),_;if(!o&&!h&&(_=d.getColor(i.rgba,n.rgba)),_===void 0){let p=this._optionsService.rawOptions.minimumContrastRatio/(l.isDim()?2:1);_=Ie.ensureContrastRatio(o||i,h||n,p),d.setColor((o||i).rgba,(h||n).rgba,_??null)}return _?(this._addStyle(e,`color:${_.css}`),!0):!1}_getContrastCache(e){return e.isDim()?this._themeService.colors.halfContrastCache:this._themeService.colors.contrastCache}_addStyle(e,i){e.setAttribute("style",`${e.getAttribute("style")||""}${i};`)}_isCellInSelection(e,i){let n=this._selectionStart,l=this._selectionEnd;return!n||!l?!1:this._columnSelectMode?n[0]<=l[0]?e>=n[0]&&i>=n[1]&&e<l[0]&&i<=l[1]:e<n[0]&&i>=n[1]&&e>=l[0]&&i<=l[1]:i>n[1]&&i<l[1]||n[1]===l[1]&&i===n[1]&&e>=n[0]&&e<l[0]||n[1]<l[1]&&i===l[1]&&e<l[0]||n[1]<l[1]&&i===n[1]&&e>=n[0]}};Cu=Qe([se(1,Fm),se(2,At),se(3,rs),se(4,hr),se(5,vl),se(6,tn)],Cu);function Pg(e,i,n){for(;e.length<n;)e=i+e;return e}var n1=class{constructor(e,i){this._flat=new Float32Array(256),this._font="",this._fontSize=0,this._weight="normal",this._weightBold="bold",this._measureElements=[],this._container=e.createElement("div"),this._container.classList.add("xterm-width-cache-measure-container"),this._container.setAttribute("aria-hidden","true"),this._container.style.whiteSpace="pre",this._container.style.fontKerning="none";let n=e.createElement("span");n.classList.add("xterm-char-measure-element");let l=e.createElement("span");l.classList.add("xterm-char-measure-element"),l.style.fontWeight="bold";let o=e.createElement("span");o.classList.add("xterm-char-measure-element"),o.style.fontStyle="italic";let h=e.createElement("span");h.classList.add("xterm-char-measure-element"),h.style.fontWeight="bold",h.style.fontStyle="italic",this._measureElements=[n,l,o,h],this._container.appendChild(n),this._container.appendChild(l),this._container.appendChild(o),this._container.appendChild(h),i.appendChild(this._container),this.clear()}dispose(){this._container.remove(),this._measureElements.length=0,this._holey=void 0}clear(){this._flat.fill(-9999),this._holey=new Map}setFont(e,i,n,l){e===this._font&&i===this._fontSize&&n===this._weight&&l===this._weightBold||(this._font=e,this._fontSize=i,this._weight=n,this._weightBold=l,this._container.style.fontFamily=this._font,this._container.style.fontSize=`${this._fontSize}px`,this._measureElements[0].style.fontWeight=`${n}`,this._measureElements[1].style.fontWeight=`${l}`,this._measureElements[2].style.fontWeight=`${n}`,this._measureElements[3].style.fontWeight=`${l}`,this.clear())}get(e,i,n){let l=0;if(!i&&!n&&e.length===1&&(l=e.charCodeAt(0))<256){if(this._flat[l]!==-9999)return this._flat[l];let d=this._measure(e,0);return d>0&&(this._flat[l]=d),d}let o=e;i&&(o+="B"),n&&(o+="I");let h=this._holey.get(o);if(h===void 0){let d=0;i&&(d|=1),n&&(d|=2),h=this._measure(e,d),h>0&&this._holey.set(o,h)}return h}_measure(e,i){let n=this._measureElements[i];return n.textContent=e.repeat(32),n.offsetWidth/32}},l1=class{constructor(){this.clear()}clear(){this.hasSelection=!1,this.columnSelectMode=!1,this.viewportStartRow=0,this.viewportEndRow=0,this.viewportCappedStartRow=0,this.viewportCappedEndRow=0,this.startCol=0,this.endCol=0,this.selectionStart=void 0,this.selectionEnd=void 0}update(e,i,n,l=!1){if(this.selectionStart=i,this.selectionEnd=n,!i||!n||i[0]===n[0]&&i[1]===n[1]){this.clear();return}let o=e.buffers.active.ydisp,h=i[1]-o,d=n[1]-o,_=Math.max(h,0),p=Math.min(d,e.rows-1);if(_>=e.rows||p<0){this.clear();return}this.hasSelection=!0,this.columnSelectMode=l,this.viewportStartRow=h,this.viewportEndRow=d,this.viewportCappedStartRow=_,this.viewportCappedEndRow=p,this.startCol=i[0],this.endCol=n[0]}isCellSelected(e,i,n){return this.hasSelection?(n-=e.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?i>=this.startCol&&n>=this.viewportCappedStartRow&&i<this.endCol&&n<=this.viewportCappedEndRow:i<this.startCol&&n>=this.viewportCappedStartRow&&i>=this.endCol&&n<=this.viewportCappedEndRow:n>this.viewportStartRow&&n<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&n===this.viewportStartRow&&i>=this.startCol&&i<this.endCol||this.viewportStartRow<this.viewportEndRow&&n===this.viewportEndRow&&i<this.endCol||this.viewportStartRow<this.viewportEndRow&&n===this.viewportStartRow&&i>=this.startCol):!1}};function a1(){return new l1}var Fh="xterm-dom-renderer-owner-",di="xterm-rows",Pa="xterm-fg-",Ig="xterm-bg-",el="xterm-focus",Ia="xterm-selection",o1=1,ku=class extends Se{constructor(e,i,n,l,o,h,d,_,p,f,S,y,x,C){super(),this._terminal=e,this._document=i,this._element=n,this._screenElement=l,this._viewportElement=o,this._helperContainer=h,this._linkifier2=d,this._charSizeService=p,this._optionsService=f,this._bufferService=S,this._coreService=y,this._coreBrowserService=x,this._themeService=C,this._terminalClass=o1++,this._rowElements=[],this._selectionRenderModel=a1(),this.onRequestRedraw=this._register(new Q).event,this._rowContainer=this._document.createElement("div"),this._rowContainer.classList.add(di),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(Ia),this._selectionContainer.setAttribute("aria-hidden","true"),this.dimensions=r1(),this._updateDimensions(),this._register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this._register(this._themeService.onChangeColors(b=>this._injectCss(b))),this._injectCss(this._themeService.colors),this._rowFactory=_.createInstance(Cu,document),this._element.classList.add(Fh+this._terminalClass),this._screenElement.appendChild(this._rowContainer),this._screenElement.appendChild(this._selectionContainer),this._register(this._linkifier2.onShowLinkUnderline(b=>this._handleLinkHover(b))),this._register(this._linkifier2.onHideLinkUnderline(b=>this._handleLinkLeave(b))),this._register($e(()=>{this._element.classList.remove(Fh+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()})),this._widthCache=new n1(this._document,this._helperContainer),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}_updateDimensions(){let e=this._coreBrowserService.dpr;this.dimensions.device.char.width=this._charSizeService.width*e,this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*e),this.dimensions.device.cell.width=this.dimensions.device.char.width+Math.round(this._optionsService.rawOptions.letterSpacing),this.dimensions.device.cell.height=Math.floor(this.dimensions.device.char.height*this._optionsService.rawOptions.lineHeight),this.dimensions.device.char.left=0,this.dimensions.device.char.top=0,this.dimensions.device.canvas.width=this.dimensions.device.cell.width*this._bufferService.cols,this.dimensions.device.canvas.height=this.dimensions.device.cell.height*this._bufferService.rows,this.dimensions.css.canvas.width=Math.round(this.dimensions.device.canvas.width/e),this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/e),this.dimensions.css.cell.width=this.dimensions.css.canvas.width/this._bufferService.cols,this.dimensions.css.cell.height=this.dimensions.css.canvas.height/this._bufferService.rows;for(let n of this._rowElements)n.style.width=`${this.dimensions.css.canvas.width}px`,n.style.height=`${this.dimensions.css.cell.height}px`,n.style.lineHeight=`${this.dimensions.css.cell.height}px`,n.style.overflow="hidden";this._dimensionsStyleElement||(this._dimensionsStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._dimensionsStyleElement));let i=`${this._terminalSelector} .${di} span { display: inline-block; height: 100%; vertical-align: top;}`;this._dimensionsStyleElement.textContent=i,this._selectionContainer.style.height=this._viewportElement.style.height,this._screenElement.style.width=`${this.dimensions.css.canvas.width}px`,this._screenElement.style.height=`${this.dimensions.css.canvas.height}px`}_injectCss(e){this._themeStyleElement||(this._themeStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._themeStyleElement));let i=`${this._terminalSelector} .${di} { pointer-events: none; color: ${e.foreground.css}; font-family: ${this._optionsService.rawOptions.fontFamily}; font-size: ${this._optionsService.rawOptions.fontSize}px; font-kerning: none; white-space: pre}`;i+=`${this._terminalSelector} .${di} .xterm-dim { color: ${Ie.multiplyOpacity(e.foreground,.5).css};}`,i+=`${this._terminalSelector} span:not(.xterm-bold) { font-weight: ${this._optionsService.rawOptions.fontWeight};}${this._terminalSelector} span.xterm-bold { font-weight: ${this._optionsService.rawOptions.fontWeightBold};}${this._terminalSelector} span.xterm-italic { font-style: italic;}`;let n=`blink_underline_${this._terminalClass}`,l=`blink_bar_${this._terminalClass}`,o=`blink_block_${this._terminalClass}`;i+=`@keyframes ${n} { 50% { border-bottom-style: hidden; }}`,i+=`@keyframes ${l} { 50% { box-shadow: none; }}`,i+=`@keyframes ${o} { 0% { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css}; } 50% { background-color: inherit; color: ${e.cursor.css}; }}`,i+=`${this._terminalSelector} .${di}.${el} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${n} 1s step-end infinite;}${this._terminalSelector} .${di}.${el} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${l} 1s step-end infinite;}${this._terminalSelector} .${di}.${el} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${o} 1s step-end infinite;}${this._terminalSelector} .${di} .xterm-cursor.xterm-cursor-block { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css};}${this._terminalSelector} .${di} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${e.cursor.css} !important; color: ${e.cursorAccent.css} !important;}${this._terminalSelector} .${di} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${e.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${di} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${e.cursor.css} inset;}${this._terminalSelector} .${di} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${e.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,i+=`${this._terminalSelector} .${Ia} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${Ia} div { position: absolute; background-color: ${e.selectionBackgroundOpaque.css};}${this._terminalSelector} .${Ia} div { position: absolute; background-color: ${e.selectionInactiveBackgroundOpaque.css};}`;for(let[h,d]of e.ansi.entries())i+=`${this._terminalSelector} .${Pa}${h} { color: ${d.css}; }${this._terminalSelector} .${Pa}${h}.xterm-dim { color: ${Ie.multiplyOpacity(d,.5).css}; }${this._terminalSelector} .${Ig}${h} { background-color: ${d.css}; }`;i+=`${this._terminalSelector} .${Pa}257 { color: ${Ie.opaque(e.background).css}; }${this._terminalSelector} .${Pa}257.xterm-dim { color: ${Ie.multiplyOpacity(Ie.opaque(e.background),.5).css}; }${this._terminalSelector} .${Ig}257 { background-color: ${e.foreground.css}; }`,this._themeStyleElement.textContent=i}_setDefaultSpacing(){let e=this.dimensions.css.cell.width-this._widthCache.get("W",!1,!1);this._rowContainer.style.letterSpacing=`${e}px`,this._rowFactory.defaultSpacing=e}handleDevicePixelRatioChange(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}_refreshRowElements(e,i){for(let n=this._rowElements.length;n<=i;n++){let l=this._document.createElement("div");this._rowContainer.appendChild(l),this._rowElements.push(l)}for(;this._rowElements.length>i;)this._rowContainer.removeChild(this._rowElements.pop())}handleResize(e,i){this._refreshRowElements(e,i),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(el),this.renderRows(0,this._bufferService.rows-1)}handleFocus(){this._rowContainer.classList.add(el),this.renderRows(this._bufferService.buffer.y,this._bufferService.buffer.y)}handleSelectionChanged(e,i,n){if(this._selectionContainer.replaceChildren(),this._rowFactory.handleSelectionChanged(e,i,n),this.renderRows(0,this._bufferService.rows-1),!e||!i||(this._selectionRenderModel.update(this._terminal,e,i,n),!this._selectionRenderModel.hasSelection))return;let l=this._selectionRenderModel.viewportStartRow,o=this._selectionRenderModel.viewportEndRow,h=this._selectionRenderModel.viewportCappedStartRow,d=this._selectionRenderModel.viewportCappedEndRow,_=this._document.createDocumentFragment();if(n){let p=e[0]>i[0];_.appendChild(this._createSelectionElement(h,p?i[0]:e[0],p?e[0]:i[0],d-h+1))}else{let p=l===h?e[0]:0,f=h===o?i[0]:this._bufferService.cols;_.appendChild(this._createSelectionElement(h,p,f));let S=d-h-1;if(_.appendChild(this._createSelectionElement(h+1,0,this._bufferService.cols,S)),h!==d){let y=o===d?i[0]:this._bufferService.cols;_.appendChild(this._createSelectionElement(d,0,y))}}this._selectionContainer.appendChild(_)}_createSelectionElement(e,i,n,l=1){let o=this._document.createElement("div"),h=i*this.dimensions.css.cell.width,d=this.dimensions.css.cell.width*(n-i);return h+d>this.dimensions.css.canvas.width&&(d=this.dimensions.css.canvas.width-h),o.style.height=`${l*this.dimensions.css.cell.height}px`,o.style.top=`${e*this.dimensions.css.cell.height}px`,o.style.left=`${h}px`,o.style.width=`${d}px`,o}handleCursorMove(){}_handleOptionsChanged(){this._updateDimensions(),this._injectCss(this._themeService.colors),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}clear(){for(let e of this._rowElements)e.replaceChildren()}renderRows(e,i){let n=this._bufferService.buffer,l=n.ybase+n.y,o=Math.min(n.x,this._bufferService.cols-1),h=this._coreService.decPrivateModes.cursorBlink??this._optionsService.rawOptions.cursorBlink,d=this._coreService.decPrivateModes.cursorStyle??this._optionsService.rawOptions.cursorStyle,_=this._optionsService.rawOptions.cursorInactiveStyle;for(let p=e;p<=i;p++){let f=p+n.ydisp,S=this._rowElements[p],y=n.lines.get(f);if(!S||!y)break;S.replaceChildren(...this._rowFactory.createRow(y,f,f===l,d,_,o,h,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${Fh}${this._terminalClass}`}_handleLinkHover(e){this._setCellUnderline(e.x1,e.x2,e.y1,e.y2,e.cols,!0)}_handleLinkLeave(e){this._setCellUnderline(e.x1,e.x2,e.y1,e.y2,e.cols,!1)}_setCellUnderline(e,i,n,l,o,h){n<0&&(e=0),l<0&&(i=0);let d=this._bufferService.rows-1;n=Math.max(Math.min(n,d),0),l=Math.max(Math.min(l,d),0),o=Math.min(o,this._bufferService.cols);let _=this._bufferService.buffer,p=_.ybase+_.y,f=Math.min(_.x,o-1),S=this._optionsService.rawOptions.cursorBlink,y=this._optionsService.rawOptions.cursorStyle,x=this._optionsService.rawOptions.cursorInactiveStyle;for(let C=n;C<=l;++C){let b=C+_.ydisp,T=this._rowElements[C],M=_.lines.get(b);if(!T||!M)break;T.replaceChildren(...this._rowFactory.createRow(M,b,b===p,y,x,f,S,this.dimensions.css.cell.width,this._widthCache,h?C===n?e:0:-1,h?(C===l?i:o)-1:-1))}}};ku=Qe([se(7,Iu),se(8,ho),se(9,At),se(10,zt),se(11,hr),se(12,rs),se(13,tn)],ku);var Eu=class extends Se{constructor(e,i,n){super(),this._optionsService=n,this.width=0,this.height=0,this._onCharSizeChange=this._register(new Q),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this._register(new h1(this._optionsService))}catch{this._measureStrategy=this._register(new c1(e,i,this._optionsService))}this._register(this._optionsService.onMultipleOptionChange(["fontFamily","fontSize"],()=>this.measure()))}get hasValidSize(){return this.width>0&&this.height>0}measure(){let e=this._measureStrategy.measure();(e.width!==this.width||e.height!==this.height)&&(this.width=e.width,this.height=e.height,this._onCharSizeChange.fire())}};Eu=Qe([se(2,At)],Eu);var dv=class extends Se{constructor(){super(...arguments),this._result={width:0,height:0}}_validateAndSet(e,i){e!==void 0&&e>0&&i!==void 0&&i>0&&(this._result.width=e,this._result.height=i)}},c1=class extends dv{constructor(e,i,n){super(),this._document=e,this._parentElement=i,this._optionsService=n,this._measureElement=this._document.createElement("span"),this._measureElement.classList.add("xterm-char-measure-element"),this._measureElement.textContent="W".repeat(32),this._measureElement.setAttribute("aria-hidden","true"),this._measureElement.style.whiteSpace="pre",this._measureElement.style.fontKerning="none",this._parentElement.appendChild(this._measureElement)}measure(){return this._measureElement.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._measureElement.style.fontSize=`${this._optionsService.rawOptions.fontSize}px`,this._validateAndSet(Number(this._measureElement.offsetWidth)/32,Number(this._measureElement.offsetHeight)),this._result}},h1=class extends dv{constructor(e){super(),this._optionsService=e,this._canvas=new OffscreenCanvas(100,100),this._ctx=this._canvas.getContext("2d");let i=this._ctx.measureText("W");if(!("width"in i&&"fontBoundingBoxAscent"in i&&"fontBoundingBoxDescent"in i))throw new Error("Required font metrics not supported")}measure(){this._ctx.font=`${this._optionsService.rawOptions.fontSize}px ${this._optionsService.rawOptions.fontFamily}`;let e=this._ctx.measureText("W");return this._validateAndSet(e.width,e.fontBoundingBoxAscent+e.fontBoundingBoxDescent),this._result}},u1=class extends Se{constructor(e,i,n){super(),this._textarea=e,this._window=i,this.mainDocument=n,this._isFocused=!1,this._cachedIsFocused=void 0,this._screenDprMonitor=this._register(new d1(this._window)),this._onDprChange=this._register(new Q),this.onDprChange=this._onDprChange.event,this._onWindowChange=this._register(new Q),this.onWindowChange=this._onWindowChange.event,this._register(this.onWindowChange(l=>this._screenDprMonitor.setWindow(l))),this._register(kt.forward(this._screenDprMonitor.onDprChange,this._onDprChange)),this._register(fe(this._textarea,"focus",()=>this._isFocused=!0)),this._register(fe(this._textarea,"blur",()=>this._isFocused=!1))}get window(){return this._window}set window(e){this._window!==e&&(this._window=e,this._onWindowChange.fire(this._window))}get dpr(){return this.window.devicePixelRatio}get isFocused(){return this._cachedIsFocused===void 0&&(this._cachedIsFocused=this._isFocused&&this._textarea.ownerDocument.hasFocus(),queueMicrotask(()=>this._cachedIsFocused=void 0)),this._cachedIsFocused}},d1=class extends Se{constructor(e){super(),this._parentWindow=e,this._windowResizeListener=this._register(new Jr),this._onDprChange=this._register(new Q),this.onDprChange=this._onDprChange.event,this._outerListener=()=>this._setDprAndFireIfDiffers(),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._updateDpr(),this._setWindowResizeListener(),this._register($e(()=>this.clearListener()))}setWindow(e){this._parentWindow=e,this._setWindowResizeListener(),this._setDprAndFireIfDiffers()}_setWindowResizeListener(){this._windowResizeListener.value=fe(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)}},f1=class extends Se{constructor(){super(),this.linkProviders=[],this._register($e(()=>this.linkProviders.length=0))}registerLinkProvider(e){return this.linkProviders.push(e),{dispose:()=>{let i=this.linkProviders.indexOf(e);i!==-1&&this.linkProviders.splice(i,1)}}}};function Zu(e,i,n){let l=n.getBoundingClientRect(),o=e.getComputedStyle(n),h=parseInt(o.getPropertyValue("padding-left")),d=parseInt(o.getPropertyValue("padding-top"));return[i.clientX-l.left-h,i.clientY-l.top-d]}function p1(e,i,n,l,o,h,d,_,p){if(!h)return;let f=Zu(e,i,n);if(f)return f[0]=Math.ceil((f[0]+(p?d/2:0))/d),f[1]=Math.ceil(f[1]/_),f[0]=Math.min(Math.max(f[0],1),l+(p?1:0)),f[1]=Math.min(Math.max(f[1],1),o),f}var Tu=class{constructor(e,i){this._renderService=e,this._charSizeService=i}getCoords(e,i,n,l,o){return p1(window,e,i,n,l,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,o)}getMouseReportCoords(e,i){let n=Zu(window,e,i);if(this._charSizeService.hasValidSize)return n[0]=Math.min(Math.max(n[0],0),this._renderService.dimensions.css.canvas.width-1),n[1]=Math.min(Math.max(n[1],0),this._renderService.dimensions.css.canvas.height-1),{col:Math.floor(n[0]/this._renderService.dimensions.css.cell.width),row:Math.floor(n[1]/this._renderService.dimensions.css.cell.height),x:Math.floor(n[0]),y:Math.floor(n[1])}}};Tu=Qe([se(0,ns),se(1,ho)],Tu);var _1=class{constructor(e,i){this._renderCallback=e,this._coreBrowserService=i,this._refreshCallbacks=[]}dispose(){this._animationFrame&&(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}addRefreshCallback(e){return this._refreshCallbacks.push(e),this._animationFrame||(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._innerRefresh())),this._animationFrame}refresh(e,i,n){this._rowCount=n,e=e!==void 0?e:0,i=i!==void 0?i:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,e):e,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,i):i,!this._animationFrame&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._innerRefresh()))}_innerRefresh(){if(this._animationFrame=void 0,this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0){this._runRefreshCallbacks();return}let e=Math.max(this._rowStart,0),i=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(e,i),this._runRefreshCallbacks()}_runRefreshCallbacks(){for(let e of this._refreshCallbacks)e(0);this._refreshCallbacks=[]}},fv={};kb(fv,{getSafariVersion:()=>m1,isChromeOS:()=>mv,isFirefox:()=>pv,isIpad:()=>v1,isIphone:()=>y1,isLegacyEdge:()=>g1,isLinux:()=>Qu,isMac:()=>io,isNode:()=>uo,isSafari:()=>_v,isWindows:()=>gv});var uo=typeof process<"u"&&"title"in process,yl=uo?"node":navigator.userAgent,Sl=uo?"node":navigator.platform,pv=yl.includes("Firefox"),g1=yl.includes("Edge"),_v=/^((?!chrome|android).)*safari/i.test(yl);function m1(){if(!_v)return 0;let e=yl.match(/Version\/(\d+)/);return e===null||e.length<2?0:parseInt(e[1])}var io=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(Sl),v1=Sl==="iPad",y1=Sl==="iPhone",gv=["Windows","Win16","Win32","WinCE"].includes(Sl),Qu=Sl.indexOf("Linux")>=0,mv=/\bCrOS\b/.test(yl),vv=class{constructor(){this._tasks=[],this._i=0}enqueue(e){this._tasks.push(e),this._start()}flush(){for(;this._i<this._tasks.length;)this._tasks[this._i]()||this._i++;this.clear()}clear(){this._idleCallback&&(this._cancelCallback(this._idleCallback),this._idleCallback=void 0),this._i=0,this._tasks.length=0}_start(){this._idleCallback||(this._idleCallback=this._requestCallback(this._process.bind(this)))}_process(e){this._idleCallback=void 0;let i=0,n=0,l=e.timeRemaining(),o=0;for(;this._i<this._tasks.length;){if(i=performance.now(),this._tasks[this._i]()||this._i++,i=Math.max(1,performance.now()-i),n=Math.max(i,n),o=e.timeRemaining(),n*1.5>o){l-i<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(l-i))}ms`),this._start();return}l=o}this.clear()}},S1=class extends vv{_requestCallback(e){return setTimeout(()=>e(this._createDeadline(16)))}_cancelCallback(e){clearTimeout(e)}_createDeadline(e){let i=performance.now()+e;return{timeRemaining:()=>Math.max(0,i-performance.now())}}},b1=class extends vv{_requestCallback(e){return requestIdleCallback(e)}_cancelCallback(e){cancelIdleCallback(e)}},so=!uo&&"requestIdleCallback"in window?b1:S1,x1=class{constructor(){this._queue=new so}set(e){this._queue.clear(),this._queue.enqueue(e)}flush(){this._queue.flush()}},Ru=class extends Se{constructor(e,i,n,l,o,h,d,_,p){super(),this._rowCount=e,this._optionsService=n,this._charSizeService=l,this._coreService=o,this._coreBrowserService=_,this._renderer=this._register(new Jr),this._pausedResizeTask=new x1,this._observerDisposable=this._register(new Jr),this._isPaused=!1,this._needsFullRefresh=!1,this._isNextRenderRedrawOnly=!0,this._needsSelectionRefresh=!1,this._canvasWidth=0,this._canvasHeight=0,this._selectionState={start:void 0,end:void 0,columnSelectMode:!1},this._onDimensionsChange=this._register(new Q),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this._register(new Q),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this._register(new Q),this.onRender=this._onRender.event,this._onRefreshRequest=this._register(new Q),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new _1((f,S)=>this._renderRows(f,S),this._coreBrowserService),this._register(this._renderDebouncer),this._syncOutputHandler=new w1(this._coreBrowserService,this._coreService,()=>this._fullRefresh()),this._register($e(()=>this._syncOutputHandler.dispose())),this._register(this._coreBrowserService.onDprChange(()=>this.handleDevicePixelRatioChange())),this._register(d.onResize(()=>this._fullRefresh())),this._register(d.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(d.cols,d.rows),this._fullRefresh()})),this._register(this._optionsService.onMultipleOptionChange(["cursorBlink","cursorStyle"],()=>this.refreshRows(d.buffer.y,d.buffer.y,!0))),this._register(p.onChangeColors(()=>this._fullRefresh())),this._registerIntersectionObserver(this._coreBrowserService.window,i),this._register(this._coreBrowserService.onWindowChange(f=>this._registerIntersectionObserver(f,i)))}get dimensions(){return this._renderer.value.dimensions}_registerIntersectionObserver(e,i){if("IntersectionObserver"in e){let n=new e.IntersectionObserver(l=>this._handleIntersectionChange(l[l.length-1]),{threshold:0});n.observe(i),this._observerDisposable.value=$e(()=>n.disconnect())}}_handleIntersectionChange(e){this._isPaused=e.isIntersecting===void 0?e.intersectionRatio===0:!e.isIntersecting,!this._isPaused&&!this._charSizeService.hasValidSize&&this._charSizeService.measure(),!this._isPaused&&this._needsFullRefresh&&(this._pausedResizeTask.flush(),this.refreshRows(0,this._rowCount-1),this._needsFullRefresh=!1)}refreshRows(e,i,n=!1){if(this._isPaused){this._needsFullRefresh=!0;return}if(this._coreService.decPrivateModes.synchronizedOutput){this._syncOutputHandler.bufferRows(e,i);return}let l=this._syncOutputHandler.flush();l&&(e=Math.min(e,l.start),i=Math.max(i,l.end)),n||(this._isNextRenderRedrawOnly=!1),this._renderDebouncer.refresh(e,i,this._rowCount)}_renderRows(e,i){if(this._renderer.value){if(this._coreService.decPrivateModes.synchronizedOutput){this._syncOutputHandler.bufferRows(e,i);return}e=Math.min(e,this._rowCount-1),i=Math.min(i,this._rowCount-1),this._renderer.value.renderRows(e,i),this._needsSelectionRefresh&&(this._renderer.value.handleSelectionChanged(this._selectionState.start,this._selectionState.end,this._selectionState.columnSelectMode),this._needsSelectionRefresh=!1),this._isNextRenderRedrawOnly||this._onRenderedViewportChange.fire({start:e,end:i}),this._onRender.fire({start:e,end:i}),this._isNextRenderRedrawOnly=!0}}resize(e,i){this._rowCount=i,this._fireOnCanvasResize()}_handleOptionsChanged(){this._renderer.value&&(this.refreshRows(0,this._rowCount-1),this._fireOnCanvasResize())}_fireOnCanvasResize(){this._renderer.value&&(this._renderer.value.dimensions.css.canvas.width===this._canvasWidth&&this._renderer.value.dimensions.css.canvas.height===this._canvasHeight||this._onDimensionsChange.fire(this._renderer.value.dimensions))}hasRenderer(){return!!this._renderer.value}setRenderer(e){this._renderer.value=e,this._renderer.value&&(this._renderer.value.onRequestRedraw(i=>this.refreshRows(i.start,i.end,!0)),this._needsSelectionRefresh=!0,this._fullRefresh())}addRefreshCallback(e){return this._renderDebouncer.addRefreshCallback(e)}_fullRefresh(){this._isPaused?this._needsFullRefresh=!0:this.refreshRows(0,this._rowCount-1)}clearTextureAtlas(){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(e,i){this._renderer.value&&(this._isPaused?this._pausedResizeTask.set(()=>this._renderer.value?.handleResize(e,i)):this._renderer.value.handleResize(e,i),this._fullRefresh())}handleCharSizeChanged(){this._renderer.value?.handleCharSizeChanged()}handleBlur(){this._renderer.value?.handleBlur()}handleFocus(){this._renderer.value?.handleFocus()}handleSelectionChanged(e,i,n){this._selectionState.start=e,this._selectionState.end=i,this._selectionState.columnSelectMode=n,this._renderer.value?.handleSelectionChanged(e,i,n)}handleCursorMove(){this._renderer.value?.handleCursorMove()}clear(){this._renderer.value?.clear()}};Ru=Qe([se(2,At),se(3,ho),se(4,hr),se(5,vl),se(6,zt),se(7,rs),se(8,tn)],Ru);var w1=class{constructor(e,i,n){this._coreBrowserService=e,this._coreService=i,this._onTimeout=n,this._start=0,this._end=0,this._isBuffering=!1}bufferRows(e,i){this._isBuffering?(this._start=Math.min(this._start,e),this._end=Math.max(this._end,i)):(this._start=e,this._end=i,this._isBuffering=!0),this._timeout===void 0&&(this._timeout=this._coreBrowserService.window.setTimeout(()=>{this._timeout=void 0,this._coreService.decPrivateModes.synchronizedOutput=!1,this._onTimeout()},1e3))}flush(){if(this._timeout!==void 0&&(this._coreBrowserService.window.clearTimeout(this._timeout),this._timeout=void 0),!this._isBuffering)return;let e={start:this._start,end:this._end};return this._isBuffering=!1,e}dispose(){this._timeout!==void 0&&(this._coreBrowserService.window.clearTimeout(this._timeout),this._timeout=void 0)}};function C1(e,i,n,l){let o=n.buffer.x,h=n.buffer.y;if(!n.buffer.hasScrollback)return T1(o,h,e,i,n,l)+fo(h,i,n,l)+R1(o,h,e,i,n,l);let d;if(h===i)return d=o>e?"D":"C",_l(Math.abs(o-e),pl(d,l));d=h>i?"D":"C";let _=Math.abs(h-i),p=E1(h>i?e:o,n)+(_-1)*n.cols+1+k1(h>i?o:e);return _l(p,pl(d,l))}function k1(e,i){return e-1}function E1(e,i){return i.cols-e}function T1(e,i,n,l,o,h){return fo(i,l,o,h).length===0?"":_l(Sv(e,i,e,i-or(i,o),!1,o).length,pl("D",h))}function fo(e,i,n,l){let o=e-or(e,n),h=i-or(i,n),d=Math.abs(o-h)-D1(e,i,n);return _l(d,pl(yv(e,i),l))}function R1(e,i,n,l,o,h){let d;fo(i,l,o,h).length>0?d=l-or(l,o):d=i;let _=l,p=B1(e,i,n,l,o,h);return _l(Sv(e,d,n,_,p==="C",o).length,pl(p,h))}function D1(e,i,n){let l=0,o=e-or(e,n),h=i-or(i,n);for(let d=0;d<Math.abs(o-h);d++){let _=yv(e,i)==="A"?-1:1;n.buffer.lines.get(o+_*d)?.isWrapped&&l++}return l}function or(e,i){let n=0,l=i.buffer.lines.get(e),o=l?.isWrapped;for(;o&&e>=0&&e<i.rows;)n++,l=i.buffer.lines.get(--e),o=l?.isWrapped;return n}function B1(e,i,n,l,o,h){let d;return fo(n,l,o,h).length>0?d=l-or(l,o):d=i,e<n&&d<=l||e>=n&&d<l?"C":"D"}function yv(e,i){return e>i?"A":"B"}function Sv(e,i,n,l,o,h){let d=e,_=i,p="";for(;(d!==n||_!==l)&&_>=0&&_<h.buffer.lines.length;)d+=o?1:-1,o&&d>h.cols-1?(p+=h.buffer.translateBufferLineToString(_,!1,e,d),d=0,e=0,_++):!o&&d<0&&(p+=h.buffer.translateBufferLineToString(_,!1,0,e+1),d=h.cols-1,e=d,_--);return p+h.buffer.translateBufferLineToString(_,!1,e,d)}function pl(e,i){let n=i?"O":"[";return F.ESC+n+e}function _l(e,i){e=Math.floor(e);let n="";for(let l=0;l<e;l++)n+=i;return n}var M1=class{constructor(e){this._bufferService=e,this.isSelectAllActive=!1,this.selectionStartLength=0}clearSelection(){this.selectionStart=void 0,this.selectionEnd=void 0,this.isSelectAllActive=!1,this.selectionStartLength=0}get finalSelectionStart(){return this.isSelectAllActive?[0,0]:!this.selectionEnd||!this.selectionStart?this.selectionStart:this.areSelectionValuesReversed()?this.selectionEnd:this.selectionStart}get finalSelectionEnd(){if(this.isSelectAllActive)return[this._bufferService.cols,this._bufferService.buffer.ybase+this._bufferService.rows-1];if(this.selectionStart){if(!this.selectionEnd||this.areSelectionValuesReversed()){let e=this.selectionStart[0]+this.selectionStartLength;return e>this._bufferService.cols?e%this._bufferService.cols===0?[this._bufferService.cols,this.selectionStart[1]+Math.floor(e/this._bufferService.cols)-1]:[e%this._bufferService.cols,this.selectionStart[1]+Math.floor(e/this._bufferService.cols)]:[e,this.selectionStart[1]]}if(this.selectionStartLength&&this.selectionEnd[1]===this.selectionStart[1]){let e=this.selectionStart[0]+this.selectionStartLength;return e>this._bufferService.cols?[e%this._bufferService.cols,this.selectionStart[1]+Math.floor(e/this._bufferService.cols)]:[Math.max(e,this.selectionEnd[0]),this.selectionEnd[1]]}return this.selectionEnd}}areSelectionValuesReversed(){let e=this.selectionStart,i=this.selectionEnd;return!e||!i?!1:e[1]>i[1]||e[1]===i[1]&&e[0]>i[0]}handleTrim(e){return this.selectionStart&&(this.selectionStart[1]-=e),this.selectionEnd&&(this.selectionEnd[1]-=e),this.selectionEnd&&this.selectionEnd[1]<0?(this.clearSelection(),!0):(this.selectionStart&&this.selectionStart[1]<0&&(this.selectionStart[1]=0),!1)}};function Yg(e,i){if(e.start.y>e.end.y)throw new Error(`Buffer range end (${e.end.x}, ${e.end.y}) cannot be before start (${e.start.x}, ${e.start.y})`);return i*(e.end.y-e.start.y)+(e.end.x-e.start.x+1)}var Gh=50,z1=15,A1=50,O1=500,L1=" ",j1=new RegExp(L1,"g"),Du=class extends Se{constructor(e,i,n,l,o,h,d,_,p){super(),this._element=e,this._screenElement=i,this._linkifier=n,this._bufferService=l,this._coreService=o,this._mouseService=h,this._optionsService=d,this._renderService=_,this._coreBrowserService=p,this._dragScrollAmount=0,this._enabled=!0,this._workCell=new gi,this._mouseDownTimeStamp=0,this._oldHasSelection=!1,this._oldSelectionStart=void 0,this._oldSelectionEnd=void 0,this._onLinuxMouseSelection=this._register(new Q),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this._register(new Q),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this._register(new Q),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this._register(new Q),this.onRequestScrollLines=this._onRequestScrollLines.event,this._mouseMoveListener=f=>this._handleMouseMove(f),this._mouseUpListener=f=>this._handleMouseUp(f),this._coreService.onUserInput(()=>{this.hasSelection&&this.clearSelection()}),this._trimListener=this._bufferService.buffer.lines.onTrim(f=>this._handleTrim(f)),this._register(this._bufferService.buffers.onBufferActivate(f=>this._handleBufferActivate(f))),this.enable(),this._model=new M1(this._bufferService),this._activeSelectionMode=0,this._register($e(()=>{this._removeMouseDownListeners()})),this._register(this._bufferService.onResize(f=>{f.rowsChanged&&this.clearSelection()}))}reset(){this.clearSelection()}disable(){this.clearSelection(),this._enabled=!1}enable(){this._enabled=!0}get selectionStart(){return this._model.finalSelectionStart}get selectionEnd(){return this._model.finalSelectionEnd}get hasSelection(){let e=this._model.finalSelectionStart,i=this._model.finalSelectionEnd;return!e||!i?!1:e[0]!==i[0]||e[1]!==i[1]}get selectionText(){let e=this._model.finalSelectionStart,i=this._model.finalSelectionEnd;if(!e||!i)return"";let n=this._bufferService.buffer,l=[];if(this._activeSelectionMode===3){if(e[0]===i[0])return"";let o=e[0]<i[0]?e[0]:i[0],h=e[0]<i[0]?i[0]:e[0];for(let d=e[1];d<=i[1];d++){let _=n.translateBufferLineToString(d,!0,o,h);l.push(_)}}else{let o=e[1]===i[1]?i[0]:void 0;l.push(n.translateBufferLineToString(e[1],!0,e[0],o));for(let h=e[1]+1;h<=i[1]-1;h++){let d=n.lines.get(h),_=n.translateBufferLineToString(h,!0);d?.isWrapped?l[l.length-1]+=_:l.push(_)}if(e[1]!==i[1]){let h=n.lines.get(i[1]),d=n.translateBufferLineToString(i[1],!0,0,i[0]);h&&h.isWrapped?l[l.length-1]+=d:l.push(d)}}return l.map(o=>o.replace(j1," ")).join(gv?`\r
|
|
95
95
|
`:`
|
|
96
|
-
`)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(e){this._refreshAnimationFrame||(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._refresh())),Qu&&e&&this.selectionText.length&&this._onLinuxMouseSelection.fire(this.selectionText)}_refresh(){this._refreshAnimationFrame=void 0,this._onRedrawRequest.fire({start:this._model.finalSelectionStart,end:this._model.finalSelectionEnd,columnSelectMode:this._activeSelectionMode===3})}_isClickInSelection(e){let i=this._getMouseBufferCoords(e),n=this._model.finalSelectionStart,l=this._model.finalSelectionEnd;return!n||!l||!i?!1:this._areCoordsInSelection(i,n,l)}isCellInSelection(e,i){let n=this._model.finalSelectionStart,l=this._model.finalSelectionEnd;return!n||!l?!1:this._areCoordsInSelection([e,i],n,l)}_areCoordsInSelection(e,i,n){return e[1]>i[1]&&e[1]<n[1]||i[1]===n[1]&&e[1]===i[1]&&e[0]>=i[0]&&e[0]<n[0]||i[1]<n[1]&&e[1]===n[1]&&e[0]<n[0]||i[1]<n[1]&&e[1]===i[1]&&e[0]>=i[0]}_selectWordAtCursor(e,i){let n=this._linkifier.currentLink?.link?.range;if(n)return this._model.selectionStart=[n.start.x-1,n.start.y-1],this._model.selectionStartLength=$g(n,this._bufferService.cols),this._model.selectionEnd=void 0,!0;let l=this._getMouseBufferCoords(e);return l?(this._selectWordAt(l,i),this._model.selectionEnd=void 0,!0):!1}selectAll(){this._model.isSelectAllActive=!0,this.refresh(),this._onSelectionChange.fire()}selectLines(e,i){this._model.clearSelection(),e=Math.max(e,0),i=Math.min(i,this._bufferService.buffer.lines.length-1),this._model.selectionStart=[0,e],this._model.selectionEnd=[this._bufferService.cols,i],this.refresh(),this._onSelectionChange.fire()}_handleTrim(e){this._model.handleTrim(e)&&this.refresh()}_getMouseBufferCoords(e){let i=this._mouseService.getCoords(e,this._screenElement,this._bufferService.cols,this._bufferService.rows,!0);if(i)return i[0]--,i[1]--,i[1]+=this._bufferService.buffer.ydisp,i}_getMouseEventScrollAmount(e){let i=Zu(this._coreBrowserService.window,e,this._screenElement)[1],n=this._renderService.dimensions.css.canvas.height;return i>=0&&i<=n?0:(i>n&&(i-=n),i=Math.min(Math.max(i,-Gh),Gh),i/=Gh,i/Math.abs(i)+Math.round(i*(z1-1)))}shouldForceSelection(e){return io?e.altKey&&this._optionsService.rawOptions.macOptionClickForcesSelection:e.shiftKey}handleMouseDown(e){if(this._mouseDownTimeStamp=e.timeStamp,!(e.button===2&&this.hasSelection)&&e.button===0){if(!this._enabled){if(!this.shouldForceSelection(e))return;e.stopPropagation()}e.preventDefault(),this._dragScrollAmount=0,this._enabled&&e.shiftKey?this._handleIncrementalClick(e):e.detail===1?this._handleSingleClick(e):e.detail===2?this._handleDoubleClick(e):e.detail===3&&this._handleTripleClick(e),this._addMouseDownListeners(),this.refresh(!0)}}_addMouseDownListeners(){this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.addEventListener("mousemove",this._mouseMoveListener),this._screenElement.ownerDocument.addEventListener("mouseup",this._mouseUpListener)),this._dragScrollIntervalTimer=this._coreBrowserService.window.setInterval(()=>this._dragScroll(),A1)}_removeMouseDownListeners(){this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.removeEventListener("mousemove",this._mouseMoveListener),this._screenElement.ownerDocument.removeEventListener("mouseup",this._mouseUpListener)),this._coreBrowserService.window.clearInterval(this._dragScrollIntervalTimer),this._dragScrollIntervalTimer=void 0}_handleIncrementalClick(e){this._model.selectionStart&&(this._model.selectionEnd=this._getMouseBufferCoords(e))}_handleSingleClick(e){if(this._model.selectionStartLength=0,this._model.isSelectAllActive=!1,this._activeSelectionMode=this.shouldColumnSelect(e)?3:0,this._model.selectionStart=this._getMouseBufferCoords(e),!this._model.selectionStart)return;this._model.selectionEnd=void 0;let i=this._bufferService.buffer.lines.get(this._model.selectionStart[1]);i&&i.length!==this._model.selectionStart[0]&&i.hasWidth(this._model.selectionStart[0])===0&&this._model.selectionStart[0]++}_handleDoubleClick(e){this._selectWordAtCursor(e,!0)&&(this._activeSelectionMode=1)}_handleTripleClick(e){let i=this._getMouseBufferCoords(e);i&&(this._activeSelectionMode=2,this._selectLineAt(i[1]))}shouldColumnSelect(e){return e.altKey&&!(io&&this._optionsService.rawOptions.macOptionClickForcesSelection)}_handleMouseMove(e){if(e.stopImmediatePropagation(),!this._model.selectionStart)return;let i=this._model.selectionEnd?[this._model.selectionEnd[0],this._model.selectionEnd[1]]:null;if(this._model.selectionEnd=this._getMouseBufferCoords(e),!this._model.selectionEnd){this.refresh(!0);return}this._activeSelectionMode===2?this._model.selectionEnd[1]<this._model.selectionStart[1]?this._model.selectionEnd[0]=0:this._model.selectionEnd[0]=this._bufferService.cols:this._activeSelectionMode===1&&this._selectToWordAt(this._model.selectionEnd),this._dragScrollAmount=this._getMouseEventScrollAmount(e),this._activeSelectionMode!==3&&(this._dragScrollAmount>0?this._model.selectionEnd[0]=this._bufferService.cols:this._dragScrollAmount<0&&(this._model.selectionEnd[0]=0));let n=this._bufferService.buffer;if(this._model.selectionEnd[1]<n.lines.length){let l=n.lines.get(this._model.selectionEnd[1]);l&&l.hasWidth(this._model.selectionEnd[0])===0&&this._model.selectionEnd[0]<this._bufferService.cols&&this._model.selectionEnd[0]++}(!i||i[0]!==this._model.selectionEnd[0]||i[1]!==this._model.selectionEnd[1])&&this.refresh(!0)}_dragScroll(){if(!(!this._model.selectionEnd||!this._model.selectionStart)&&this._dragScrollAmount){this._onRequestScrollLines.fire({amount:this._dragScrollAmount,suppressScrollEvent:!1});let e=this._bufferService.buffer;this._dragScrollAmount>0?(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=this._bufferService.cols),this._model.selectionEnd[1]=Math.min(e.ydisp+this._bufferService.rows,e.lines.length-1)):(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=0),this._model.selectionEnd[1]=e.ydisp),this.refresh()}}_handleMouseUp(e){let i=e.timeStamp-this._mouseDownTimeStamp;if(this._removeMouseDownListeners(),this.selectionText.length<=1&&i<O1&&e.altKey&&this._optionsService.rawOptions.altClickMovesCursor){if(this._bufferService.buffer.ybase===this._bufferService.buffer.ydisp){let n=this._mouseService.getCoords(e,this._element,this._bufferService.cols,this._bufferService.rows,!1);if(n&&n[0]!==void 0&&n[1]!==void 0){let l=C1(n[0]-1,n[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(l,!0)}}}else this._fireEventIfSelectionChanged()}_fireEventIfSelectionChanged(){let e=this._model.finalSelectionStart,i=this._model.finalSelectionEnd,n=!!e&&!!i&&(e[0]!==i[0]||e[1]!==i[1]);if(!n){this._oldHasSelection&&this._fireOnSelectionChange(e,i,n);return}!e||!i||(!this._oldSelectionStart||!this._oldSelectionEnd||e[0]!==this._oldSelectionStart[0]||e[1]!==this._oldSelectionStart[1]||i[0]!==this._oldSelectionEnd[0]||i[1]!==this._oldSelectionEnd[1])&&this._fireOnSelectionChange(e,i,n)}_fireOnSelectionChange(e,i,n){this._oldSelectionStart=e,this._oldSelectionEnd=i,this._oldHasSelection=n,this._onSelectionChange.fire()}_handleBufferActivate(e){this.clearSelection(),this._trimListener.dispose(),this._trimListener=e.activeBuffer.lines.onTrim(i=>this._handleTrim(i))}_convertViewportColToCharacterIndex(e,i){let n=i;for(let l=0;i>=l;l++){let o=e.loadCell(l,this._workCell).getChars().length;this._workCell.getWidth()===0?n--:o>1&&i!==l&&(n+=o-1)}return n}setSelection(e,i,n){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[e,i],this._model.selectionStartLength=n,this.refresh(),this._fireEventIfSelectionChanged()}rightClickSelect(e){this._isClickInSelection(e)||(this._selectWordAtCursor(e,!1)&&this.refresh(!0),this._fireEventIfSelectionChanged())}_getWordAt(e,i,n=!0,l=!0){if(e[0]>=this._bufferService.cols)return;let o=this._bufferService.buffer,h=o.lines.get(e[1]);if(!h)return;let d=o.translateBufferLineToString(e[1],!1),_=this._convertViewportColToCharacterIndex(h,e[0]),p=_,f=e[0]-_,S=0,y=0,x=0,C=0;if(d.charAt(_)===" "){for(;_>0&&d.charAt(_-1)===" ";)_--;for(;p<d.length&&d.charAt(p+1)===" ";)p++}else{let M=e[0],A=e[0];h.getWidth(M)===0&&(S++,M--),h.getWidth(A)===2&&(y++,A++);let O=h.getString(A).length;for(O>1&&(C+=O-1,p+=O-1);M>0&&_>0&&!this._isCharWordSeparator(h.loadCell(M-1,this._workCell));){h.loadCell(M-1,this._workCell);let D=this._workCell.getChars().length;this._workCell.getWidth()===0?(S++,M--):D>1&&(x+=D-1,_-=D-1),_--,M--}for(;A<h.length&&p+1<d.length&&!this._isCharWordSeparator(h.loadCell(A+1,this._workCell));){h.loadCell(A+1,this._workCell);let D=this._workCell.getChars().length;this._workCell.getWidth()===2?(y++,A++):D>1&&(C+=D-1,p+=D-1),p++,A++}}p++;let b=_+f-S+x,T=Math.min(this._bufferService.cols,p-_+S+y-x-C);if(!(!i&&d.slice(_,p).trim()==="")){if(n&&b===0&&h.getCodePoint(0)!==32){let M=o.lines.get(e[1]-1);if(M&&h.isWrapped&&M.getCodePoint(this._bufferService.cols-1)!==32){let A=this._getWordAt([this._bufferService.cols-1,e[1]-1],!1,!0,!1);if(A){let O=this._bufferService.cols-A.start;b-=O,T+=O}}}if(l&&b+T===this._bufferService.cols&&h.getCodePoint(this._bufferService.cols-1)!==32){let M=o.lines.get(e[1]+1);if(M?.isWrapped&&M.getCodePoint(0)!==32){let A=this._getWordAt([0,e[1]+1],!1,!1,!0);A&&(T+=A.length)}}return{start:b,length:T}}}_selectWordAt(e,i){let n=this._getWordAt(e,i);if(n){for(;n.start<0;)n.start+=this._bufferService.cols,e[1]--;this._model.selectionStart=[n.start,e[1]],this._model.selectionStartLength=n.length}}_selectToWordAt(e){let i=this._getWordAt(e,!0);if(i){let n=e[1];for(;i.start<0;)i.start+=this._bufferService.cols,n--;if(!this._model.areSelectionValuesReversed())for(;i.start+i.length>this._bufferService.cols;)i.length-=this._bufferService.cols,n++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?i.start:i.start+i.length,n]}}_isCharWordSeparator(e){return e.getWidth()===0?!1:this._optionsService.rawOptions.wordSeparator.indexOf(e.getChars())>=0}_selectLineAt(e){let i=this._bufferService.buffer.getWrappedRangeForLine(e),n={start:{x:0,y:i.first},end:{x:this._bufferService.cols-1,y:i.last}};this._model.selectionStart=[0,i.first],this._model.selectionEnd=void 0,this._model.selectionStartLength=$g(n,this._bufferService.cols)}};Du=Qe([se(3,zt),se(4,hr),se(5,$u),se(6,At),se(7,ns),se(8,rs)],Du);var Kg=class{constructor(){this._data={}}set(e,i,n){this._data[e]||(this._data[e]={}),this._data[e][i]=n}get(e,i){return this._data[e]?this._data[e][i]:void 0}clear(){this._data={}}},Yg=class{constructor(){this._color=new Kg,this._css=new Kg}setCss(e,i,n){this._css.set(e,i,n)}getCss(e,i){return this._css.get(e,i)}setColor(e,i,n){this._color.set(e,i,n)}getColor(e,i){return this._color.get(e,i)}clear(){this._color.clear(),this._css.clear()}},ht=Object.freeze((()=>{let e=[Ge.toColor("#2e3436"),Ge.toColor("#cc0000"),Ge.toColor("#4e9a06"),Ge.toColor("#c4a000"),Ge.toColor("#3465a4"),Ge.toColor("#75507b"),Ge.toColor("#06989a"),Ge.toColor("#d3d7cf"),Ge.toColor("#555753"),Ge.toColor("#ef2929"),Ge.toColor("#8ae234"),Ge.toColor("#fce94f"),Ge.toColor("#729fcf"),Ge.toColor("#ad7fa8"),Ge.toColor("#34e2e2"),Ge.toColor("#eeeeec")],i=[0,95,135,175,215,255];for(let n=0;n<216;n++){let l=i[n/36%6|0],o=i[n/6%6|0],h=i[n%6];e.push({css:at.toCss(l,o,h),rgba:at.toRgba(l,o,h)})}for(let n=0;n<24;n++){let l=8+n*10;e.push({css:at.toCss(l,l,l),rgba:at.toRgba(l,l,l)})}return e})()),ir=Ge.toColor("#ffffff"),ol=Ge.toColor("#000000"),Fg=Ge.toColor("#ffffff"),Gg=ol,tl={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117},N1=ir,Bu=class extends Se{constructor(e){super(),this._optionsService=e,this._contrastCache=new Yg,this._halfContrastCache=new Yg,this._onChangeColors=this._register(new Q),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:ir,background:ol,cursor:Fg,cursorAccent:Gg,selectionForeground:void 0,selectionBackgroundTransparent:tl,selectionBackgroundOpaque:Ie.blend(ol,tl),selectionInactiveBackgroundTransparent:tl,selectionInactiveBackgroundOpaque:Ie.blend(ol,tl),scrollbarSliderBackground:Ie.opacity(ir,.2),scrollbarSliderHoverBackground:Ie.opacity(ir,.4),scrollbarSliderActiveBackground:Ie.opacity(ir,.5),overviewRulerBorder:ir,ansi:ht.slice(),contrastCache:this._contrastCache,halfContrastCache:this._halfContrastCache},this._updateRestoreColors(),this._setTheme(this._optionsService.rawOptions.theme),this._register(this._optionsService.onSpecificOptionChange("minimumContrastRatio",()=>this._contrastCache.clear())),this._register(this._optionsService.onSpecificOptionChange("theme",()=>this._setTheme(this._optionsService.rawOptions.theme)))}get colors(){return this._colors}_setTheme(e={}){let i=this._colors;if(i.foreground=Ue(e.foreground,ir),i.background=Ue(e.background,ol),i.cursor=Ie.blend(i.background,Ue(e.cursor,Fg)),i.cursorAccent=Ie.blend(i.background,Ue(e.cursorAccent,Gg)),i.selectionBackgroundTransparent=Ue(e.selectionBackground,tl),i.selectionBackgroundOpaque=Ie.blend(i.background,i.selectionBackgroundTransparent),i.selectionInactiveBackgroundTransparent=Ue(e.selectionInactiveBackground,i.selectionBackgroundTransparent),i.selectionInactiveBackgroundOpaque=Ie.blend(i.background,i.selectionInactiveBackgroundTransparent),i.selectionForeground=e.selectionForeground?Ue(e.selectionForeground,qg):void 0,i.selectionForeground===qg&&(i.selectionForeground=void 0),Ie.isOpaque(i.selectionBackgroundTransparent)&&(i.selectionBackgroundTransparent=Ie.opacity(i.selectionBackgroundTransparent,.3)),Ie.isOpaque(i.selectionInactiveBackgroundTransparent)&&(i.selectionInactiveBackgroundTransparent=Ie.opacity(i.selectionInactiveBackgroundTransparent,.3)),i.scrollbarSliderBackground=Ue(e.scrollbarSliderBackground,Ie.opacity(i.foreground,.2)),i.scrollbarSliderHoverBackground=Ue(e.scrollbarSliderHoverBackground,Ie.opacity(i.foreground,.4)),i.scrollbarSliderActiveBackground=Ue(e.scrollbarSliderActiveBackground,Ie.opacity(i.foreground,.5)),i.overviewRulerBorder=Ue(e.overviewRulerBorder,N1),i.ansi=ht.slice(),i.ansi[0]=Ue(e.black,ht[0]),i.ansi[1]=Ue(e.red,ht[1]),i.ansi[2]=Ue(e.green,ht[2]),i.ansi[3]=Ue(e.yellow,ht[3]),i.ansi[4]=Ue(e.blue,ht[4]),i.ansi[5]=Ue(e.magenta,ht[5]),i.ansi[6]=Ue(e.cyan,ht[6]),i.ansi[7]=Ue(e.white,ht[7]),i.ansi[8]=Ue(e.brightBlack,ht[8]),i.ansi[9]=Ue(e.brightRed,ht[9]),i.ansi[10]=Ue(e.brightGreen,ht[10]),i.ansi[11]=Ue(e.brightYellow,ht[11]),i.ansi[12]=Ue(e.brightBlue,ht[12]),i.ansi[13]=Ue(e.brightMagenta,ht[13]),i.ansi[14]=Ue(e.brightCyan,ht[14]),i.ansi[15]=Ue(e.brightWhite,ht[15]),e.extendedAnsi){let n=Math.min(i.ansi.length-16,e.extendedAnsi.length);for(let l=0;l<n;l++)i.ansi[l+16]=Ue(e.extendedAnsi[l],ht[l+16])}this._contrastCache.clear(),this._halfContrastCache.clear(),this._updateRestoreColors(),this._onChangeColors.fire(this.colors)}restoreColor(e){this._restoreColor(e),this._onChangeColors.fire(this.colors)}_restoreColor(e){if(e===void 0){for(let i=0;i<this._restoreColors.ansi.length;++i)this._colors.ansi[i]=this._restoreColors.ansi[i];return}switch(e){case 256:this._colors.foreground=this._restoreColors.foreground;break;case 257:this._colors.background=this._restoreColors.background;break;case 258:this._colors.cursor=this._restoreColors.cursor;break;default:this._colors.ansi[e]=this._restoreColors.ansi[e]}}modifyColors(e){e(this._colors),this._onChangeColors.fire(this.colors)}_updateRestoreColors(){this._restoreColors={foreground:this._colors.foreground,background:this._colors.background,cursor:this._colors.cursor,ansi:this._colors.ansi.slice()}}};Bu=Qe([se(0,At)],Bu);function Ue(e,i){if(e!==void 0)try{return Ge.toColor(e)}catch{}return i}var H1=class{constructor(...e){this._entries=new Map;for(let[i,n]of e)this.set(i,n)}set(e,i){let n=this._entries.get(e);return this._entries.set(e,i),n}forEach(e){for(let[i,n]of this._entries.entries())e(i,n)}has(e){return this._entries.has(e)}get(e){return this._entries.get(e)}},U1=class{constructor(){this._services=new H1,this._services.set(Iu,this)}setService(e,i){this._services.set(e,i)}getService(e){return this._services.get(e)}createInstance(e,...i){let n=zb(e).sort((h,d)=>h.index-d.index),l=[];for(let h of n){let d=this._services.get(h.id);if(!d)throw new Error(`[createInstance] ${e.name} depends on UNKNOWN service ${h.id._id}.`);l.push(d)}let o=n.length>0?n[0].index:i.length;if(i.length!==o)throw new Error(`[createInstance] First service dependency of ${e.name} at position ${o+1} conflicts with ${i.length} static arguments`);return new e(...i,...l)}},W1={trace:0,debug:1,info:2,warn:3,error:4,off:5},q1="xterm.js: ",Mu=class extends Se{constructor(e){super(),this._optionsService=e,this._logLevel=5,this._updateLogLevel(),this._register(this._optionsService.onSpecificOptionChange("logLevel",()=>this._updateLogLevel()))}get logLevel(){return this._logLevel}_updateLogLevel(){this._logLevel=W1[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(e){for(let i=0;i<e.length;i++)typeof e[i]=="function"&&(e[i]=e[i]())}_log(e,i,n){this._evalLazyOptionalParams(n),e.call(console,(this._optionsService.options.logger?"":q1)+i,...n)}trace(e,...i){this._logLevel<=0&&this._log(this._optionsService.options.logger?.trace.bind(this._optionsService.options.logger)??console.log,e,i)}debug(e,...i){this._logLevel<=1&&this._log(this._optionsService.options.logger?.debug.bind(this._optionsService.options.logger)??console.log,e,i)}info(e,...i){this._logLevel<=2&&this._log(this._optionsService.options.logger?.info.bind(this._optionsService.options.logger)??console.info,e,i)}warn(e,...i){this._logLevel<=3&&this._log(this._optionsService.options.logger?.warn.bind(this._optionsService.options.logger)??console.warn,e,i)}error(e,...i){this._logLevel<=4&&this._log(this._optionsService.options.logger?.error.bind(this._optionsService.options.logger)??console.error,e,i)}};Mu=Qe([se(0,At)],Mu);var Xg=class extends Se{constructor(e){super(),this._maxLength=e,this.onDeleteEmitter=this._register(new Q),this.onDelete=this.onDeleteEmitter.event,this.onInsertEmitter=this._register(new Q),this.onInsert=this.onInsertEmitter.event,this.onTrimEmitter=this._register(new Q),this.onTrim=this.onTrimEmitter.event,this._array=new Array(this._maxLength),this._startIndex=0,this._length=0}get maxLength(){return this._maxLength}set maxLength(e){if(this._maxLength===e)return;let i=new Array(e);for(let n=0;n<Math.min(e,this.length);n++)i[n]=this._array[this._getCyclicIndex(n)];this._array=i,this._maxLength=e,this._startIndex=0}get length(){return this._length}set length(e){if(e>this._length)for(let i=this._length;i<e;i++)this._array[i]=void 0;this._length=e}get(e){return this._array[this._getCyclicIndex(e)]}set(e,i){this._array[this._getCyclicIndex(e)]=i}push(e){this._array[this._getCyclicIndex(this._length)]=e,this._length===this._maxLength?(this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1)):this._length++}recycle(){if(this._length!==this._maxLength)throw new Error("Can only recycle when the buffer is full");return this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1),this._array[this._getCyclicIndex(this._length-1)]}get isFull(){return this._length===this._maxLength}pop(){return this._array[this._getCyclicIndex(this._length---1)]}splice(e,i,...n){if(i){for(let l=e;l<this._length-i;l++)this._array[this._getCyclicIndex(l)]=this._array[this._getCyclicIndex(l+i)];this._length-=i,this.onDeleteEmitter.fire({index:e,amount:i})}for(let l=this._length-1;l>=e;l--)this._array[this._getCyclicIndex(l+n.length)]=this._array[this._getCyclicIndex(l)];for(let l=0;l<n.length;l++)this._array[this._getCyclicIndex(e+l)]=n[l];if(n.length&&this.onInsertEmitter.fire({index:e,amount:n.length}),this._length+n.length>this._maxLength){let l=this._length+n.length-this._maxLength;this._startIndex+=l,this._length=this._maxLength,this.onTrimEmitter.fire(l)}else this._length+=n.length}trimStart(e){e>this._length&&(e=this._length),this._startIndex+=e,this._length-=e,this.onTrimEmitter.fire(e)}shiftElements(e,i,n){if(!(i<=0)){if(e<0||e>=this._length)throw new Error("start argument out of range");if(e+n<0)throw new Error("Cannot shift elements in list beyond index 0");if(n>0){for(let o=i-1;o>=0;o--)this.set(e+o+n,this.get(e+o));let l=e+i+n-this._length;if(l>0)for(this._length+=l;this._length>this._maxLength;)this._length--,this._startIndex++,this.onTrimEmitter.fire(1)}else for(let l=0;l<i;l++)this.set(e+l+n,this.get(e+l))}}_getCyclicIndex(e){return(this._startIndex+e)%this._maxLength}},ye=3,lt=Object.freeze(new ml),$a=0,Xh=2,cl=class bv{constructor(i,n,l=!1){this.isWrapped=l,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(i*ye);let o=n||gi.fromCharData([0,Wm,1,0]);for(let h=0;h<i;++h)this.setCell(h,o);this.length=i}get(i){let n=this._data[i*ye+0],l=n&2097151;return[this._data[i*ye+1],n&2097152?this._combined[i]:l?Os(l):"",n>>22,n&2097152?this._combined[i].charCodeAt(this._combined[i].length-1):l]}set(i,n){this._data[i*ye+1]=n[0],n[1].length>1?(this._combined[i]=n[1],this._data[i*ye+0]=i|2097152|n[2]<<22):this._data[i*ye+0]=n[1].charCodeAt(0)|n[2]<<22}getWidth(i){return this._data[i*ye+0]>>22}hasWidth(i){return this._data[i*ye+0]&12582912}getFg(i){return this._data[i*ye+1]}getBg(i){return this._data[i*ye+2]}hasContent(i){return this._data[i*ye+0]&4194303}getCodePoint(i){let n=this._data[i*ye+0];return n&2097152?this._combined[i].charCodeAt(this._combined[i].length-1):n&2097151}isCombined(i){return this._data[i*ye+0]&2097152}getString(i){let n=this._data[i*ye+0];return n&2097152?this._combined[i]:n&2097151?Os(n&2097151):""}isProtected(i){return this._data[i*ye+2]&536870912}loadCell(i,n){return $a=i*ye,n.content=this._data[$a+0],n.fg=this._data[$a+1],n.bg=this._data[$a+2],n.content&2097152&&(n.combinedData=this._combined[i]),n.bg&268435456&&(n.extended=this._extendedAttrs[i]),n}setCell(i,n){n.content&2097152&&(this._combined[i]=n.combinedData),n.bg&268435456&&(this._extendedAttrs[i]=n.extended),this._data[i*ye+0]=n.content,this._data[i*ye+1]=n.fg,this._data[i*ye+2]=n.bg}setCellFromCodepoint(i,n,l,o){o.bg&268435456&&(this._extendedAttrs[i]=o.extended),this._data[i*ye+0]=n|l<<22,this._data[i*ye+1]=o.fg,this._data[i*ye+2]=o.bg}addCodepointToCell(i,n,l){let o=this._data[i*ye+0];o&2097152?this._combined[i]+=Os(n):o&2097151?(this._combined[i]=Os(o&2097151)+Os(n),o&=-2097152,o|=2097152):o=n|1<<22,l&&(o&=-12582913,o|=l<<22),this._data[i*ye+0]=o}insertCells(i,n,l){if(i%=this.length,i&&this.getWidth(i-1)===2&&this.setCellFromCodepoint(i-1,0,1,l),n<this.length-i){let o=new gi;for(let h=this.length-i-n-1;h>=0;--h)this.setCell(i+n+h,this.loadCell(i+h,o));for(let h=0;h<n;++h)this.setCell(i+h,l)}else for(let o=i;o<this.length;++o)this.setCell(o,l);this.getWidth(this.length-1)===2&&this.setCellFromCodepoint(this.length-1,0,1,l)}deleteCells(i,n,l){if(i%=this.length,n<this.length-i){let o=new gi;for(let h=0;h<this.length-i-n;++h)this.setCell(i+h,this.loadCell(i+n+h,o));for(let h=this.length-n;h<this.length;++h)this.setCell(h,l)}else for(let o=i;o<this.length;++o)this.setCell(o,l);i&&this.getWidth(i-1)===2&&this.setCellFromCodepoint(i-1,0,1,l),this.getWidth(i)===0&&!this.hasContent(i)&&this.setCellFromCodepoint(i,0,1,l)}replaceCells(i,n,l,o=!1){if(o){for(i&&this.getWidth(i-1)===2&&!this.isProtected(i-1)&&this.setCellFromCodepoint(i-1,0,1,l),n<this.length&&this.getWidth(n-1)===2&&!this.isProtected(n)&&this.setCellFromCodepoint(n,0,1,l);i<n&&i<this.length;)this.isProtected(i)||this.setCell(i,l),i++;return}for(i&&this.getWidth(i-1)===2&&this.setCellFromCodepoint(i-1,0,1,l),n<this.length&&this.getWidth(n-1)===2&&this.setCellFromCodepoint(n,0,1,l);i<n&&i<this.length;)this.setCell(i++,l)}resize(i,n){if(i===this.length)return this._data.length*4*Xh<this._data.buffer.byteLength;let l=i*ye;if(i>this.length){if(this._data.buffer.byteLength>=l*4)this._data=new Uint32Array(this._data.buffer,0,l);else{let o=new Uint32Array(l);o.set(this._data),this._data=o}for(let o=this.length;o<i;++o)this.setCell(o,n)}else{this._data=this._data.subarray(0,l);let o=Object.keys(this._combined);for(let d=0;d<o.length;d++){let _=parseInt(o[d],10);_>=i&&delete this._combined[_]}let h=Object.keys(this._extendedAttrs);for(let d=0;d<h.length;d++){let _=parseInt(h[d],10);_>=i&&delete this._extendedAttrs[_]}}return this.length=i,l*4*Xh<this._data.buffer.byteLength}cleanupMemory(){if(this._data.length*4*Xh<this._data.buffer.byteLength){let i=new Uint32Array(this._data.length);return i.set(this._data),this._data=i,1}return 0}fill(i,n=!1){if(n){for(let l=0;l<this.length;++l)this.isProtected(l)||this.setCell(l,i);return}this._combined={},this._extendedAttrs={};for(let l=0;l<this.length;++l)this.setCell(l,i)}copyFrom(i){this.length!==i.length?this._data=new Uint32Array(i._data):this._data.set(i._data),this.length=i.length,this._combined={};for(let n in i._combined)this._combined[n]=i._combined[n];this._extendedAttrs={};for(let n in i._extendedAttrs)this._extendedAttrs[n]=i._extendedAttrs[n];this.isWrapped=i.isWrapped}clone(){let i=new bv(0);i._data=new Uint32Array(this._data),i.length=this.length;for(let n in this._combined)i._combined[n]=this._combined[n];for(let n in this._extendedAttrs)i._extendedAttrs[n]=this._extendedAttrs[n];return i.isWrapped=this.isWrapped,i}getTrimmedLength(){for(let i=this.length-1;i>=0;--i)if(this._data[i*ye+0]&4194303)return i+(this._data[i*ye+0]>>22);return 0}getNoBgTrimmedLength(){for(let i=this.length-1;i>=0;--i)if(this._data[i*ye+0]&4194303||this._data[i*ye+2]&50331648)return i+(this._data[i*ye+0]>>22);return 0}copyCellsFrom(i,n,l,o,h){let d=i._data;if(h)for(let p=o-1;p>=0;p--){for(let f=0;f<ye;f++)this._data[(l+p)*ye+f]=d[(n+p)*ye+f];d[(n+p)*ye+2]&268435456&&(this._extendedAttrs[l+p]=i._extendedAttrs[n+p])}else for(let p=0;p<o;p++){for(let f=0;f<ye;f++)this._data[(l+p)*ye+f]=d[(n+p)*ye+f];d[(n+p)*ye+2]&268435456&&(this._extendedAttrs[l+p]=i._extendedAttrs[n+p])}let _=Object.keys(i._combined);for(let p=0;p<_.length;p++){let f=parseInt(_[p],10);f>=n&&(this._combined[f-n+l]=i._combined[f])}}translateToString(i,n,l,o){n=n??0,l=l??this.length,i&&(l=Math.min(l,this.getTrimmedLength())),o&&(o.length=0);let h="";for(;n<l;){let d=this._data[n*ye+0],_=d&2097151,p=d&2097152?this._combined[n]:_?Os(_):Ls;if(h+=p,o)for(let f=0;f<p.length;++f)o.push(n);n+=d>>22||1}return o&&o.push(n),h}};function P1(e,i,n,l,o,h){let d=[];for(let _=0;_<e.length-1;_++){let p=_,f=e.get(++p);if(!f.isWrapped)continue;let S=[e.get(_)];for(;p<e.length&&f.isWrapped;)S.push(f),f=e.get(++p);if(!h&&l>=_&&l<p){_+=S.length-1;continue}let y=0,x=gl(S,y,i),C=1,b=0;for(;C<S.length;){let M=gl(S,C,i),A=M-b,O=n-x,D=Math.min(A,O);S[y].copyCellsFrom(S[C],b,x,D,!1),x+=D,x===n&&(y++,x=0),b+=D,b===M&&(C++,b=0),x===0&&y!==0&&S[y-1].getWidth(n-1)===2&&(S[y].copyCellsFrom(S[y-1],n-1,x++,1,!1),S[y-1].setCell(n-1,o))}S[y].replaceCells(x,n,o);let T=0;for(let M=S.length-1;M>0&&(M>y||S[M].getTrimmedLength()===0);M--)T++;T>0&&(d.push(_+S.length-T),d.push(T)),_+=S.length-1}return d}function I1(e,i){let n=[],l=0,o=i[l],h=0;for(let d=0;d<e.length;d++)if(o===d){let _=i[++l];e.onDeleteEmitter.fire({index:d-h,amount:_}),d+=_-1,h+=_,o=i[++l]}else n.push(d);return{layout:n,countRemoved:h}}function $1(e,i){let n=[];for(let l=0;l<i.length;l++)n.push(e.get(i[l]));for(let l=0;l<n.length;l++)e.set(l,n[l]);e.length=i.length}function K1(e,i,n){let l=[],o=e.map((p,f)=>gl(e,f,i)).reduce((p,f)=>p+f),h=0,d=0,_=0;for(;_<o;){if(o-_<n){l.push(o-_);break}h+=n;let p=gl(e,d,i);h>p&&(h-=p,d++);let f=e[d].getWidth(h-1)===2;f&&h--;let S=f?n-1:n;l.push(S),_+=S}return l}function gl(e,i,n){if(i===e.length-1)return e[i].getTrimmedLength();let l=!e[i].hasContent(n-1)&&e[i].getWidth(n-1)===1,o=e[i+1].getWidth(0)===2;return l&&o?n-1:n}var xv=class wv{constructor(i){this.line=i,this.isDisposed=!1,this._disposables=[],this._id=wv._nextId++,this._onDispose=this.register(new Q),this.onDispose=this._onDispose.event}get id(){return this._id}dispose(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire(),ar(this._disposables),this._disposables.length=0)}register(i){return this._disposables.push(i),i}};xv._nextId=1;var Y1=xv,dt={},sr=dt.B;dt[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:"≥","{":"π","|":"≠","}":"£","~":"·"};dt.A={"#":"£"};dt.B=void 0;dt[4]={"#":"£","@":"¾","[":"ij","\\":"½","]":"|","{":"¨","|":"f","}":"¼","~":"´"};dt.C=dt[5]={"[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"};dt.R={"#":"£","@":"à","[":"°","\\":"ç","]":"§","{":"é","|":"ù","}":"è","~":"¨"};dt.Q={"@":"à","[":"â","\\":"ç","]":"ê","^":"î","`":"ô","{":"é","|":"ù","}":"è","~":"û"};dt.K={"@":"§","[":"Ä","\\":"Ö","]":"Ü","{":"ä","|":"ö","}":"ü","~":"ß"};dt.Y={"#":"£","@":"§","[":"°","\\":"ç","]":"é","`":"ù","{":"à","|":"ò","}":"è","~":"ì"};dt.E=dt[6]={"@":"Ä","[":"Æ","\\":"Ø","]":"Å","^":"Ü","`":"ä","{":"æ","|":"ø","}":"å","~":"ü"};dt.Z={"#":"£","@":"§","[":"¡","\\":"Ñ","]":"¿","{":"°","|":"ñ","}":"ç"};dt.H=dt[7]={"@":"É","[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"};dt["="]={"#":"ù","@":"à","[":"é","\\":"ç","]":"ê","^":"î",_:"è","`":"ô","{":"ä","|":"ö","}":"ü","~":"û"};var Vg=4294967295,Zg=class{constructor(e,i,n){this._hasScrollback=e,this._optionsService=i,this._bufferService=n,this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.tabs={},this.savedY=0,this.savedX=0,this.savedCurAttrData=lt.clone(),this.savedCharset=sr,this.markers=[],this._nullCell=gi.fromCharData([0,Wm,1,0]),this._whitespaceCell=gi.fromCharData([0,Ls,1,32]),this._isClearing=!1,this._memoryCleanupQueue=new so,this._memoryCleanupPosition=0,this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new Xg(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}getNullCell(e){return e?(this._nullCell.fg=e.fg,this._nullCell.bg=e.bg,this._nullCell.extended=e.extended):(this._nullCell.fg=0,this._nullCell.bg=0,this._nullCell.extended=new Ja),this._nullCell}getWhitespaceCell(e){return e?(this._whitespaceCell.fg=e.fg,this._whitespaceCell.bg=e.bg,this._whitespaceCell.extended=e.extended):(this._whitespaceCell.fg=0,this._whitespaceCell.bg=0,this._whitespaceCell.extended=new Ja),this._whitespaceCell}getBlankLine(e,i){return new cl(this._bufferService.cols,this.getNullCell(e),i)}get hasScrollback(){return this._hasScrollback&&this.lines.maxLength>this._rows}get isCursorInViewport(){let e=this.ybase+this.y-this.ydisp;return e>=0&&e<this._rows}_getCorrectBufferLength(e){if(!this._hasScrollback)return e;let i=e+this._optionsService.rawOptions.scrollback;return i>Vg?Vg:i}fillViewportRows(e){if(this.lines.length===0){e===void 0&&(e=lt);let i=this._rows;for(;i--;)this.lines.push(this.getBlankLine(e))}}clear(){this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.lines=new Xg(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(e,i){let n=this.getNullCell(lt),l=0,o=this._getCorrectBufferLength(i);if(o>this.lines.maxLength&&(this.lines.maxLength=o),this.lines.length>0){if(this._cols<e)for(let d=0;d<this.lines.length;d++)l+=+this.lines.get(d).resize(e,n);let h=0;if(this._rows<i)for(let d=this._rows;d<i;d++)this.lines.length<i+this.ybase&&(this._optionsService.rawOptions.windowsMode||this._optionsService.rawOptions.windowsPty.backend!==void 0||this._optionsService.rawOptions.windowsPty.buildNumber!==void 0?this.lines.push(new cl(e,n)):this.ybase>0&&this.lines.length<=this.ybase+this.y+h+1?(this.ybase--,h++,this.ydisp>0&&this.ydisp--):this.lines.push(new cl(e,n)));else for(let d=this._rows;d>i;d--)this.lines.length>i+this.ybase&&(this.lines.length>this.ybase+this.y+1?this.lines.pop():(this.ybase++,this.ydisp++));if(o<this.lines.maxLength){let d=this.lines.length-o;d>0&&(this.lines.trimStart(d),this.ybase=Math.max(this.ybase-d,0),this.ydisp=Math.max(this.ydisp-d,0),this.savedY=Math.max(this.savedY-d,0)),this.lines.maxLength=o}this.x=Math.min(this.x,e-1),this.y=Math.min(this.y,i-1),h&&(this.y+=h),this.savedX=Math.min(this.savedX,e-1),this.scrollTop=0}if(this.scrollBottom=i-1,this._isReflowEnabled&&(this._reflow(e,i),this._cols>e))for(let h=0;h<this.lines.length;h++)l+=+this.lines.get(h).resize(e,n);this._cols=e,this._rows=i,this._memoryCleanupQueue.clear(),l>.1*this.lines.length&&(this._memoryCleanupPosition=0,this._memoryCleanupQueue.enqueue(()=>this._batchedMemoryCleanup()))}_batchedMemoryCleanup(){let e=!0;this._memoryCleanupPosition>=this.lines.length&&(this._memoryCleanupPosition=0,e=!1);let i=0;for(;this._memoryCleanupPosition<this.lines.length;)if(i+=this.lines.get(this._memoryCleanupPosition++).cleanupMemory(),i>100)return!0;return e}get _isReflowEnabled(){let e=this._optionsService.rawOptions.windowsPty;return e&&e.buildNumber?this._hasScrollback&&e.backend==="conpty"&&e.buildNumber>=21376:this._hasScrollback&&!this._optionsService.rawOptions.windowsMode}_reflow(e,i){this._cols!==e&&(e>this._cols?this._reflowLarger(e,i):this._reflowSmaller(e,i))}_reflowLarger(e,i){let n=this._optionsService.rawOptions.reflowCursorLine,l=P1(this.lines,this._cols,e,this.ybase+this.y,this.getNullCell(lt),n);if(l.length>0){let o=I1(this.lines,l);$1(this.lines,o.layout),this._reflowLargerAdjustViewport(e,i,o.countRemoved)}}_reflowLargerAdjustViewport(e,i,n){let l=this.getNullCell(lt),o=n;for(;o-- >0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length<i&&this.lines.push(new cl(e,l))):(this.ydisp===this.ybase&&this.ydisp--,this.ybase--);this.savedY=Math.max(this.savedY-n,0)}_reflowSmaller(e,i){let n=this._optionsService.rawOptions.reflowCursorLine,l=this.getNullCell(lt),o=[],h=0;for(let d=this.lines.length-1;d>=0;d--){let _=this.lines.get(d);if(!_||!_.isWrapped&&_.getTrimmedLength()<=e)continue;let p=[_];for(;_.isWrapped&&d>0;)_=this.lines.get(--d),p.unshift(_);if(!n){let D=this.ybase+this.y;if(D>=d&&D<d+p.length)continue}let f=p[p.length-1].getTrimmedLength(),S=K1(p,this._cols,e),y=S.length-p.length,x;this.ybase===0&&this.y!==this.lines.length-1?x=Math.max(0,this.y-this.lines.maxLength+y):x=Math.max(0,this.lines.length-this.lines.maxLength+y);let C=[];for(let D=0;D<y;D++){let L=this.getBlankLine(lt,!0);C.push(L)}C.length>0&&(o.push({start:d+p.length+h,newLines:C}),h+=C.length),p.push(...C);let b=S.length-1,T=S[b];T===0&&(b--,T=S[b]);let M=p.length-y-1,A=f;for(;M>=0;){let D=Math.min(A,T);if(p[b]===void 0)break;if(p[b].copyCellsFrom(p[M],A-D,T-D,D,!0),T-=D,T===0&&(b--,T=S[b]),A-=D,A===0){M--;let L=Math.max(M,0);A=gl(p,L,this._cols)}}for(let D=0;D<p.length;D++)S[D]<e&&p[D].setCell(S[D],l);let O=y-x;for(;O-- >0;)this.ybase===0?this.y<i-1?(this.y++,this.lines.pop()):(this.ybase++,this.ydisp++):this.ybase<Math.min(this.lines.maxLength,this.lines.length+h)-i&&(this.ybase===this.ydisp&&this.ydisp++,this.ybase++);this.savedY=Math.min(this.savedY+y,this.ybase+i-1)}if(o.length>0){let d=[],_=[];for(let T=0;T<this.lines.length;T++)_.push(this.lines.get(T));let p=this.lines.length,f=p-1,S=0,y=o[S];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+h);let x=0;for(let T=Math.min(this.lines.maxLength-1,p+h-1);T>=0;T--)if(y&&y.start>f+x){for(let M=y.newLines.length-1;M>=0;M--)this.lines.set(T--,y.newLines[M]);T++,d.push({index:f+1,amount:y.newLines.length}),x+=y.newLines.length,y=o[++S]}else this.lines.set(T,_[f--]);let C=0;for(let T=d.length-1;T>=0;T--)d[T].index+=C,this.lines.onInsertEmitter.fire(d[T]),C+=d[T].amount;let b=Math.max(0,p+h-this.lines.maxLength);b>0&&this.lines.onTrimEmitter.fire(b)}}translateBufferLineToString(e,i,n=0,l){let o=this.lines.get(e);return o?o.translateToString(i,n,l):""}getWrappedRangeForLine(e){let i=e,n=e;for(;i>0&&this.lines.get(i).isWrapped;)i--;for(;n+1<this.lines.length&&this.lines.get(n+1).isWrapped;)n++;return{first:i,last:n}}setupTabStops(e){for(e!=null?this.tabs[e]||(e=this.prevStop(e)):(this.tabs={},e=0);e<this._cols;e+=this._optionsService.rawOptions.tabStopWidth)this.tabs[e]=!0}prevStop(e){for(e==null&&(e=this.x);!this.tabs[--e]&&e>0;);return e>=this._cols?this._cols-1:e<0?0:e}nextStop(e){for(e==null&&(e=this.x);!this.tabs[++e]&&e<this._cols;);return e>=this._cols?this._cols-1:e<0?0:e}clearMarkers(e){this._isClearing=!0;for(let i=0;i<this.markers.length;i++)this.markers[i].line===e&&(this.markers[i].dispose(),this.markers.splice(i--,1));this._isClearing=!1}clearAllMarkers(){this._isClearing=!0;for(let e=0;e<this.markers.length;e++)this.markers[e].dispose();this.markers.length=0,this._isClearing=!1}addMarker(e){let i=new Y1(e);return this.markers.push(i),i.register(this.lines.onTrim(n=>{i.line-=n,i.line<0&&i.dispose()})),i.register(this.lines.onInsert(n=>{i.line>=n.index&&(i.line+=n.amount)})),i.register(this.lines.onDelete(n=>{i.line>=n.index&&i.line<n.index+n.amount&&i.dispose(),i.line>n.index&&(i.line-=n.amount)})),i.register(i.onDispose(()=>this._removeMarker(i))),i}_removeMarker(e){this._isClearing||this.markers.splice(this.markers.indexOf(e),1)}},F1=class extends Se{constructor(e,i){super(),this._optionsService=e,this._bufferService=i,this._onBufferActivate=this._register(new Q),this.onBufferActivate=this._onBufferActivate.event,this.reset(),this._register(this._optionsService.onSpecificOptionChange("scrollback",()=>this.resize(this._bufferService.cols,this._bufferService.rows))),this._register(this._optionsService.onSpecificOptionChange("tabStopWidth",()=>this.setupTabStops()))}reset(){this._normal=new Zg(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new Zg(!1,this._optionsService,this._bufferService),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}),this.setupTabStops()}get alt(){return this._alt}get active(){return this._activeBuffer}get normal(){return this._normal}activateNormalBuffer(){this._activeBuffer!==this._normal&&(this._normal.x=this._alt.x,this._normal.y=this._alt.y,this._alt.clearAllMarkers(),this._alt.clear(),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}))}activateAltBuffer(e){this._activeBuffer!==this._alt&&(this._alt.fillViewportRows(e),this._alt.x=this._normal.x,this._alt.y=this._normal.y,this._activeBuffer=this._alt,this._onBufferActivate.fire({activeBuffer:this._alt,inactiveBuffer:this._normal}))}resize(e,i){this._normal.resize(e,i),this._alt.resize(e,i),this.setupTabStops(e)}setupTabStops(e){this._normal.setupTabStops(e),this._alt.setupTabStops(e)}},Cv=2,kv=1,zu=class extends Se{constructor(e){super(),this.isUserScrolling=!1,this._onResize=this._register(new Q),this.onResize=this._onResize.event,this._onScroll=this._register(new Q),this.onScroll=this._onScroll.event,this.cols=Math.max(e.rawOptions.cols||0,Cv),this.rows=Math.max(e.rawOptions.rows||0,kv),this.buffers=this._register(new F1(e,this)),this._register(this.buffers.onBufferActivate(i=>{this._onScroll.fire(i.activeBuffer.ydisp)}))}get buffer(){return this.buffers.active}resize(e,i){let n=this.cols!==e,l=this.rows!==i;this.cols=e,this.rows=i,this.buffers.resize(e,i),this._onResize.fire({cols:e,rows:i,colsChanged:n,rowsChanged:l})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(e,i=!1){let n=this.buffer,l;l=this._cachedBlankLine,(!l||l.length!==this.cols||l.getFg(0)!==e.fg||l.getBg(0)!==e.bg)&&(l=n.getBlankLine(e,i),this._cachedBlankLine=l),l.isWrapped=i;let o=n.ybase+n.scrollTop,h=n.ybase+n.scrollBottom;if(n.scrollTop===0){let d=n.lines.isFull;h===n.lines.length-1?d?n.lines.recycle().copyFrom(l):n.lines.push(l.clone()):n.lines.splice(h+1,0,l.clone()),d?this.isUserScrolling&&(n.ydisp=Math.max(n.ydisp-1,0)):(n.ybase++,this.isUserScrolling||n.ydisp++)}else{let d=h-o+1;n.lines.shiftElements(o+1,d-1,-1),n.lines.set(h,l.clone())}this.isUserScrolling||(n.ydisp=n.ybase),this._onScroll.fire(n.ydisp)}scrollLines(e,i){let n=this.buffer;if(e<0){if(n.ydisp===0)return;this.isUserScrolling=!0}else e+n.ydisp>=n.ybase&&(this.isUserScrolling=!1);let l=n.ydisp;n.ydisp=Math.max(Math.min(n.ydisp+e,n.ybase),0),l!==n.ydisp&&(i||this._onScroll.fire(n.ydisp))}};zu=Qe([se(0,At)],zu);var Zr={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:io,windowOptions:{},windowsMode:!1,windowsPty:{},wordSeparator:" ()[]{}',\"`",altClickMovesCursor:!0,convertEol:!1,termName:"xterm",cancelEvents:!1,overviewRuler:{}},G1=["normal","bold","100","200","300","400","500","600","700","800","900"],X1=class extends Se{constructor(e){super(),this._onOptionChange=this._register(new Q),this.onOptionChange=this._onOptionChange.event;let i={...Zr};for(let n in e)if(n in i)try{let l=e[n];i[n]=this._sanitizeAndValidateOption(n,l)}catch(l){console.error(l)}this.rawOptions=i,this.options={...i},this._setupOptions(),this._register(Ke(()=>{this.rawOptions.linkHandler=null,this.rawOptions.documentOverride=null}))}onSpecificOptionChange(e,i){return this.onOptionChange(n=>{n===e&&i(this.rawOptions[e])})}onMultipleOptionChange(e,i){return this.onOptionChange(n=>{e.indexOf(n)!==-1&&i()})}_setupOptions(){let e=n=>{if(!(n in Zr))throw new Error(`No option with key "${n}"`);return this.rawOptions[n]},i=(n,l)=>{if(!(n in Zr))throw new Error(`No option with key "${n}"`);l=this._sanitizeAndValidateOption(n,l),this.rawOptions[n]!==l&&(this.rawOptions[n]=l,this._onOptionChange.fire(n))};for(let n in this.rawOptions){let l={get:e.bind(this,n),set:i.bind(this,n)};Object.defineProperty(this.options,n,l)}}_sanitizeAndValidateOption(e,i){switch(e){case"cursorStyle":if(i||(i=Zr[e]),!V1(i))throw new Error(`"${i}" is not a valid value for ${e}`);break;case"wordSeparator":i||(i=Zr[e]);break;case"fontWeight":case"fontWeightBold":if(typeof i=="number"&&1<=i&&i<=1e3)break;i=G1.includes(i)?i:Zr[e];break;case"cursorWidth":i=Math.floor(i);case"lineHeight":case"tabStopWidth":if(i<1)throw new Error(`${e} cannot be less than 1, value: ${i}`);break;case"minimumContrastRatio":i=Math.max(1,Math.min(21,Math.round(i*10)/10));break;case"scrollback":if(i=Math.min(i,4294967295),i<0)throw new Error(`${e} cannot be less than 0, value: ${i}`);break;case"fastScrollSensitivity":case"scrollSensitivity":if(i<=0)throw new Error(`${e} cannot be less than or equal to 0, value: ${i}`);break;case"rows":case"cols":if(!i&&i!==0)throw new Error(`${e} must be numeric, value: ${i}`);break;case"windowsPty":i=i??{};break}return i}};function V1(e){return e==="block"||e==="underline"||e==="bar"}function hl(e,i=5){if(typeof e!="object")return e;let n=Array.isArray(e)?[]:{};for(let l in e)n[l]=i<=1?e[l]:e[l]&&hl(e[l],i-1);return n}var Qg=Object.freeze({insertMode:!1}),Jg=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,cursorBlink:void 0,cursorStyle:void 0,origin:!1,reverseWraparound:!1,sendFocus:!1,synchronizedOutput:!1,wraparound:!0}),Au=class extends Se{constructor(e,i,n){super(),this._bufferService=e,this._logService=i,this._optionsService=n,this.isCursorInitialized=!1,this.isCursorHidden=!1,this._onData=this._register(new Q),this.onData=this._onData.event,this._onUserInput=this._register(new Q),this.onUserInput=this._onUserInput.event,this._onBinary=this._register(new Q),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this._register(new Q),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=hl(Qg),this.decPrivateModes=hl(Jg)}reset(){this.modes=hl(Qg),this.decPrivateModes=hl(Jg)}triggerDataEvent(e,i=!1){if(this._optionsService.rawOptions.disableStdin)return;let n=this._bufferService.buffer;i&&this._optionsService.rawOptions.scrollOnUserInput&&n.ybase!==n.ydisp&&this._onRequestScrollToBottom.fire(),i&&this._onUserInput.fire(),this._logService.debug(`sending data "${e}"`),this._logService.trace("sending data (codes)",()=>e.split("").map(l=>l.charCodeAt(0))),this._onData.fire(e)}triggerBinaryEvent(e){this._optionsService.rawOptions.disableStdin||(this._logService.debug(`sending binary "${e}"`),this._logService.trace("sending binary (codes)",()=>e.split("").map(i=>i.charCodeAt(0))),this._onBinary.fire(e))}};Au=Qe([se(0,zt),se(1,Km),se(2,At)],Au);var em={NONE:{events:0,restrict:()=>!1},X10:{events:1,restrict:e=>e.button===4||e.action!==1?!1:(e.ctrl=!1,e.alt=!1,e.shift=!1,!0)},VT200:{events:19,restrict:e=>e.action!==32},DRAG:{events:23,restrict:e=>!(e.action===32&&e.button===3)},ANY:{events:31,restrict:e=>!0}};function Vh(e,i){let n=(e.ctrl?16:0)|(e.shift?4:0)|(e.alt?8:0);return e.button===4?(n|=64,n|=e.action):(n|=e.button&3,e.button&4&&(n|=64),e.button&8&&(n|=128),e.action===32?n|=32:e.action===0&&!i&&(n|=3)),n}var Zh=String.fromCharCode,tm={DEFAULT:e=>{let i=[Vh(e,!1)+32,e.col+32,e.row+32];return i[0]>255||i[1]>255||i[2]>255?"":`\x1B[M${Zh(i[0])}${Zh(i[1])}${Zh(i[2])}`},SGR:e=>{let i=e.action===0&&e.button!==4?"m":"M";return`\x1B[<${Vh(e,!0)};${e.col};${e.row}${i}`},SGR_PIXELS:e=>{let i=e.action===0&&e.button!==4?"m":"M";return`\x1B[<${Vh(e,!0)};${e.x};${e.y}${i}`}},Ou=class extends Se{constructor(e,i,n){super(),this._bufferService=e,this._coreService=i,this._optionsService=n,this._protocols={},this._encodings={},this._activeProtocol="",this._activeEncoding="",this._lastEvent=null,this._wheelPartialScroll=0,this._onProtocolChange=this._register(new Q),this.onProtocolChange=this._onProtocolChange.event;for(let l of Object.keys(em))this.addProtocol(l,em[l]);for(let l of Object.keys(tm))this.addEncoding(l,tm[l]);this.reset()}addProtocol(e,i){this._protocols[e]=i}addEncoding(e,i){this._encodings[e]=i}get activeProtocol(){return this._activeProtocol}get areMouseEventsActive(){return this._protocols[this._activeProtocol].events!==0}set activeProtocol(e){if(!this._protocols[e])throw new Error(`unknown protocol "${e}"`);this._activeProtocol=e,this._onProtocolChange.fire(this._protocols[e].events)}get activeEncoding(){return this._activeEncoding}set activeEncoding(e){if(!this._encodings[e])throw new Error(`unknown encoding "${e}"`);this._activeEncoding=e}reset(){this.activeProtocol="NONE",this.activeEncoding="DEFAULT",this._lastEvent=null,this._wheelPartialScroll=0}consumeWheelEvent(e,i,n){if(e.deltaY===0||e.shiftKey||i===void 0||n===void 0)return 0;let l=i/n,o=this._applyScrollModifier(e.deltaY,e);return e.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(o/=l+0,Math.abs(e.deltaY)<50&&(o*=.3),this._wheelPartialScroll+=o,o=Math.floor(Math.abs(this._wheelPartialScroll))*(this._wheelPartialScroll>0?1:-1),this._wheelPartialScroll%=1):e.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(o*=this._bufferService.rows),o}_applyScrollModifier(e,i){return i.altKey||i.ctrlKey||i.shiftKey?e*this._optionsService.rawOptions.fastScrollSensitivity*this._optionsService.rawOptions.scrollSensitivity:e*this._optionsService.rawOptions.scrollSensitivity}triggerMouseEvent(e){if(e.col<0||e.col>=this._bufferService.cols||e.row<0||e.row>=this._bufferService.rows||e.button===4&&e.action===32||e.button===3&&e.action!==32||e.button!==4&&(e.action===2||e.action===3)||(e.col++,e.row++,e.action===32&&this._lastEvent&&this._equalEvents(this._lastEvent,e,this._activeEncoding==="SGR_PIXELS"))||!this._protocols[this._activeProtocol].restrict(e))return!1;let i=this._encodings[this._activeEncoding](e);return i&&(this._activeEncoding==="DEFAULT"?this._coreService.triggerBinaryEvent(i):this._coreService.triggerDataEvent(i,!0)),this._lastEvent=e,!0}explainEvents(e){return{down:!!(e&1),up:!!(e&2),drag:!!(e&4),move:!!(e&8),wheel:!!(e&16)}}_equalEvents(e,i,n){if(n){if(e.x!==i.x||e.y!==i.y)return!1}else if(e.col!==i.col||e.row!==i.row)return!1;return!(e.button!==i.button||e.action!==i.action||e.ctrl!==i.ctrl||e.alt!==i.alt||e.shift!==i.shift)}};Ou=Qe([se(0,zt),se(1,hr),se(2,At)],Ou);var Qh=[[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]],Z1=[[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]],ut;function Q1(e,i){let n=0,l=i.length-1,o;if(e<i[0][0]||e>i[l][1])return!1;for(;l>=n;)if(o=n+l>>1,e>i[o][1])n=o+1;else if(e<i[o][0])l=o-1;else return!0;return!1}var J1=class{constructor(){if(this.version="6",!ut){ut=new Uint8Array(65536),ut.fill(1),ut[0]=0,ut.fill(0,1,32),ut.fill(0,127,160),ut.fill(2,4352,4448),ut[9001]=2,ut[9002]=2,ut.fill(2,11904,42192),ut[12351]=1,ut.fill(2,44032,55204),ut.fill(2,63744,64256),ut.fill(2,65040,65050),ut.fill(2,65072,65136),ut.fill(2,65280,65377),ut.fill(2,65504,65511);for(let e=0;e<Qh.length;++e)ut.fill(0,Qh[e][0],Qh[e][1]+1)}}wcwidth(e){return e<32?0:e<127?1:e<65536?ut[e]:Q1(e,Z1)?0:e>=131072&&e<=196605||e>=196608&&e<=262141?2:1}charProperties(e,i){let n=this.wcwidth(e),l=n===0&&i!==0;if(l){let o=nr.extractWidth(i);o===0?l=!1:o>n&&(n=o)}return nr.createPropertyValue(0,n,l)}},nr=class Za{constructor(){this._providers=Object.create(null),this._active="",this._onChange=new Q,this.onChange=this._onChange.event;let i=new J1;this.register(i),this._active=i.version,this._activeProvider=i}static extractShouldJoin(i){return(i&1)!==0}static extractWidth(i){return i>>1&3}static extractCharKind(i){return i>>3}static createPropertyValue(i,n,l=!1){return(i&16777215)<<3|(n&3)<<1|(l?1:0)}dispose(){this._onChange.dispose()}get versions(){return Object.keys(this._providers)}get activeVersion(){return this._active}set activeVersion(i){if(!this._providers[i])throw new Error(`unknown Unicode version "${i}"`);this._active=i,this._activeProvider=this._providers[i],this._onChange.fire(i)}register(i){this._providers[i.version]=i}wcwidth(i){return this._activeProvider.wcwidth(i)}getStringCellWidth(i){let n=0,l=0,o=i.length;for(let h=0;h<o;++h){let d=i.charCodeAt(h);if(55296<=d&&d<=56319){if(++h>=o)return n+this.wcwidth(d);let f=i.charCodeAt(h);56320<=f&&f<=57343?d=(d-55296)*1024+f-56320+65536:n+=this.wcwidth(f)}let _=this.charProperties(d,l),p=Za.extractWidth(_);Za.extractShouldJoin(_)&&(p-=Za.extractWidth(l)),n+=p,l=_}return n}charProperties(i,n){return this._activeProvider.charProperties(i,n)}},ew=class{constructor(){this.glevel=0,this._charsets=[]}reset(){this.charset=void 0,this._charsets=[],this.glevel=0}setgLevel(e){this.glevel=e,this.charset=this._charsets[e]}setgCharset(e,i){this._charsets[e]=i,this.glevel===e&&(this.charset=i)}};function im(e){let i=e.buffer.lines.get(e.buffer.ybase+e.buffer.y-1)?.get(e.cols-1),n=e.buffer.lines.get(e.buffer.ybase+e.buffer.y);n&&i&&(n.isWrapped=i[3]!==0&&i[3]!==32)}var il=2147483647,tw=256,Ev=class Lu{constructor(i=32,n=32){if(this.maxLength=i,this.maxSubParamsLength=n,n>tw)throw new Error("maxSubParamsLength must not be greater than 256");this.params=new Int32Array(i),this.length=0,this._subParams=new Int32Array(n),this._subParamsLength=0,this._subParamsIdx=new Uint16Array(i),this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}static fromArray(i){let n=new Lu;if(!i.length)return n;for(let l=Array.isArray(i[0])?1:0;l<i.length;++l){let o=i[l];if(Array.isArray(o))for(let h=0;h<o.length;++h)n.addSubParam(o[h]);else n.addParam(o)}return n}clone(){let i=new Lu(this.maxLength,this.maxSubParamsLength);return i.params.set(this.params),i.length=this.length,i._subParams.set(this._subParams),i._subParamsLength=this._subParamsLength,i._subParamsIdx.set(this._subParamsIdx),i._rejectDigits=this._rejectDigits,i._rejectSubDigits=this._rejectSubDigits,i._digitIsSub=this._digitIsSub,i}toArray(){let i=[];for(let n=0;n<this.length;++n){i.push(this.params[n]);let l=this._subParamsIdx[n]>>8,o=this._subParamsIdx[n]&255;o-l>0&&i.push(Array.prototype.slice.call(this._subParams,l,o))}return i}reset(){this.length=0,this._subParamsLength=0,this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}addParam(i){if(this._digitIsSub=!1,this.length>=this.maxLength){this._rejectDigits=!0;return}if(i<-1)throw new Error("values lesser than -1 are not allowed");this._subParamsIdx[this.length]=this._subParamsLength<<8|this._subParamsLength,this.params[this.length++]=i>il?il:i}addSubParam(i){if(this._digitIsSub=!0,!!this.length){if(this._rejectDigits||this._subParamsLength>=this.maxSubParamsLength){this._rejectSubDigits=!0;return}if(i<-1)throw new Error("values lesser than -1 are not allowed");this._subParams[this._subParamsLength++]=i>il?il:i,this._subParamsIdx[this.length-1]++}}hasSubParams(i){return(this._subParamsIdx[i]&255)-(this._subParamsIdx[i]>>8)>0}getSubParams(i){let n=this._subParamsIdx[i]>>8,l=this._subParamsIdx[i]&255;return l-n>0?this._subParams.subarray(n,l):null}getSubParamsAll(){let i={};for(let n=0;n<this.length;++n){let l=this._subParamsIdx[n]>>8,o=this._subParamsIdx[n]&255;o-l>0&&(i[n]=this._subParams.slice(l,o))}return i}addDigit(i){let n;if(this._rejectDigits||!(n=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;let l=this._digitIsSub?this._subParams:this.params,o=l[n-1];l[n-1]=~o?Math.min(o*10+i,il):i}},sl=[],iw=class{constructor(){this._state=0,this._active=sl,this._id=-1,this._handlers=Object.create(null),this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}registerHandler(e,i){this._handlers[e]===void 0&&(this._handlers[e]=[]);let n=this._handlers[e];return n.push(i),{dispose:()=>{let l=n.indexOf(i);l!==-1&&n.splice(l,1)}}}clearHandler(e){this._handlers[e]&&delete this._handlers[e]}setHandlerFallback(e){this._handlerFb=e}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=sl}reset(){if(this._state===2)for(let e=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;e>=0;--e)this._active[e].end(!1);this._stack.paused=!1,this._active=sl,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||sl,!this._active.length)this._handlerFb(this._id,"START");else for(let e=this._active.length-1;e>=0;e--)this._active[e].start()}_put(e,i,n){if(!this._active.length)this._handlerFb(this._id,"PUT",co(e,i,n));else for(let l=this._active.length-1;l>=0;l--)this._active[l].put(e,i,n)}start(){this.reset(),this._state=1}put(e,i,n){if(this._state!==3){if(this._state===1)for(;i<n;){let l=e[i++];if(l===59){this._state=2,this._start();break}if(l<48||57<l){this._state=3;return}this._id===-1&&(this._id=0),this._id=this._id*10+l-48}this._state===2&&n-i>0&&this._put(e,i,n)}}end(e,i=!0){if(this._state!==0){if(this._state!==3)if(this._state===1&&this._start(),!this._active.length)this._handlerFb(this._id,"END",e);else{let n=!1,l=this._active.length-1,o=!1;if(this._stack.paused&&(l=this._stack.loopPosition-1,n=i,o=this._stack.fallThrough,this._stack.paused=!1),!o&&n===!1){for(;l>=0&&(n=this._active[l].end(e),n!==!0);l--)if(n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=l,this._stack.fallThrough=!1,n;l--}for(;l>=0;l--)if(n=this._active[l].end(!1),n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=l,this._stack.fallThrough=!0,n}this._active=sl,this._id=-1,this._state=0}}},Jt=class{constructor(i){this._handler=i,this._data="",this._hitLimit=!1}start(){this._data="",this._hitLimit=!1}put(i,n,l){this._hitLimit||(this._data+=co(i,n,l),this._data.length>1e7&&(this._data="",this._hitLimit=!0))}end(i){let n=!1;if(this._hitLimit)n=!1;else if(i&&(n=this._handler(this._data),n instanceof Promise))return n.then(l=>(this._data="",this._hitLimit=!1,l));return this._data="",this._hitLimit=!1,n}},rl=[],sw=class{constructor(){this._handlers=Object.create(null),this._active=rl,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=rl}registerHandler(e,i){this._handlers[e]===void 0&&(this._handlers[e]=[]);let n=this._handlers[e];return n.push(i),{dispose:()=>{let l=n.indexOf(i);l!==-1&&n.splice(l,1)}}}clearHandler(e){this._handlers[e]&&delete this._handlers[e]}setHandlerFallback(e){this._handlerFb=e}reset(){if(this._active.length)for(let e=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;e>=0;--e)this._active[e].unhook(!1);this._stack.paused=!1,this._active=rl,this._ident=0}hook(e,i){if(this.reset(),this._ident=e,this._active=this._handlers[e]||rl,!this._active.length)this._handlerFb(this._ident,"HOOK",i);else for(let n=this._active.length-1;n>=0;n--)this._active[n].hook(i)}put(e,i,n){if(!this._active.length)this._handlerFb(this._ident,"PUT",co(e,i,n));else for(let l=this._active.length-1;l>=0;l--)this._active[l].put(e,i,n)}unhook(e,i=!0){if(!this._active.length)this._handlerFb(this._ident,"UNHOOK",e);else{let n=!1,l=this._active.length-1,o=!1;if(this._stack.paused&&(l=this._stack.loopPosition-1,n=i,o=this._stack.fallThrough,this._stack.paused=!1),!o&&n===!1){for(;l>=0&&(n=this._active[l].unhook(e),n!==!0);l--)if(n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=l,this._stack.fallThrough=!1,n;l--}for(;l>=0;l--)if(n=this._active[l].unhook(!1),n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=l,this._stack.fallThrough=!0,n}this._active=rl,this._ident=0}},ul=new Ev;ul.addParam(0);var sm=class{constructor(e){this._handler=e,this._data="",this._params=ul,this._hitLimit=!1}hook(e){this._params=e.length>1||e.params[0]?e.clone():ul,this._data="",this._hitLimit=!1}put(e,i,n){this._hitLimit||(this._data+=co(e,i,n),this._data.length>1e7&&(this._data="",this._hitLimit=!0))}unhook(e){let i=!1;if(this._hitLimit)i=!1;else if(e&&(i=this._handler(this._data,this._params),i instanceof Promise))return i.then(n=>(this._params=ul,this._data="",this._hitLimit=!1,n));return this._params=ul,this._data="",this._hitLimit=!1,i}},rw=class{constructor(e){this.table=new Uint8Array(e)}setDefault(e,i){this.table.fill(e<<4|i)}add(e,i,n,l){this.table[i<<8|e]=n<<4|l}addMany(e,i,n,l){for(let o=0;o<e.length;o++)this.table[i<<8|e[o]]=n<<4|l}},pi=160,nw=(function(){let e=new rw(4095),i=Array.apply(null,Array(256)).map((_,p)=>p),n=(_,p)=>i.slice(_,p),l=n(32,127),o=n(0,24);o.push(25),o.push.apply(o,n(28,32));let h=n(0,14),d;e.setDefault(1,0),e.addMany(l,0,2,0);for(d in h)e.addMany([24,26,153,154],d,3,0),e.addMany(n(128,144),d,3,0),e.addMany(n(144,152),d,3,0),e.add(156,d,0,0),e.add(27,d,11,1),e.add(157,d,4,8),e.addMany([152,158,159],d,0,7),e.add(155,d,11,3),e.add(144,d,11,9);return e.addMany(o,0,3,0),e.addMany(o,1,3,1),e.add(127,1,0,1),e.addMany(o,8,0,8),e.addMany(o,3,3,3),e.add(127,3,0,3),e.addMany(o,4,3,4),e.add(127,4,0,4),e.addMany(o,6,3,6),e.addMany(o,5,3,5),e.add(127,5,0,5),e.addMany(o,2,3,2),e.add(127,2,0,2),e.add(93,1,4,8),e.addMany(l,8,5,8),e.add(127,8,5,8),e.addMany([156,27,24,26,7],8,6,0),e.addMany(n(28,32),8,0,8),e.addMany([88,94,95],1,0,7),e.addMany(l,7,0,7),e.addMany(o,7,0,7),e.add(156,7,0,0),e.add(127,7,0,7),e.add(91,1,11,3),e.addMany(n(64,127),3,7,0),e.addMany(n(48,60),3,8,4),e.addMany([60,61,62,63],3,9,4),e.addMany(n(48,60),4,8,4),e.addMany(n(64,127),4,7,0),e.addMany([60,61,62,63],4,0,6),e.addMany(n(32,64),6,0,6),e.add(127,6,0,6),e.addMany(n(64,127),6,0,0),e.addMany(n(32,48),3,9,5),e.addMany(n(32,48),5,9,5),e.addMany(n(48,64),5,0,6),e.addMany(n(64,127),5,7,0),e.addMany(n(32,48),4,9,5),e.addMany(n(32,48),1,9,2),e.addMany(n(32,48),2,9,2),e.addMany(n(48,127),2,10,0),e.addMany(n(48,80),1,10,0),e.addMany(n(81,88),1,10,0),e.addMany([89,90,92],1,10,0),e.addMany(n(96,127),1,10,0),e.add(80,1,11,9),e.addMany(o,9,0,9),e.add(127,9,0,9),e.addMany(n(28,32),9,0,9),e.addMany(n(32,48),9,9,12),e.addMany(n(48,60),9,8,10),e.addMany([60,61,62,63],9,9,10),e.addMany(o,11,0,11),e.addMany(n(32,128),11,0,11),e.addMany(n(28,32),11,0,11),e.addMany(o,10,0,10),e.add(127,10,0,10),e.addMany(n(28,32),10,0,10),e.addMany(n(48,60),10,8,10),e.addMany([60,61,62,63],10,0,11),e.addMany(n(32,48),10,9,12),e.addMany(o,12,0,12),e.add(127,12,0,12),e.addMany(n(28,32),12,0,12),e.addMany(n(32,48),12,9,12),e.addMany(n(48,64),12,0,11),e.addMany(n(64,127),12,12,13),e.addMany(n(64,127),10,12,13),e.addMany(n(64,127),9,12,13),e.addMany(o,13,13,13),e.addMany(l,13,13,13),e.add(127,13,0,13),e.addMany([27,156,24,26],13,14,0),e.add(pi,0,2,0),e.add(pi,8,5,8),e.add(pi,6,0,6),e.add(pi,11,0,11),e.add(pi,13,13,13),e})(),lw=class extends Se{constructor(e=nw){super(),this._transitions=e,this._parseStack={state:0,handlers:[],handlerPos:0,transition:0,chunkPos:0},this.initialState=0,this.currentState=this.initialState,this._params=new Ev,this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._printHandlerFb=(i,n,l)=>{},this._executeHandlerFb=i=>{},this._csiHandlerFb=(i,n)=>{},this._escHandlerFb=i=>{},this._errorHandlerFb=i=>i,this._printHandler=this._printHandlerFb,this._executeHandlers=Object.create(null),this._csiHandlers=Object.create(null),this._escHandlers=Object.create(null),this._register(Ke(()=>{this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null)})),this._oscParser=this._register(new iw),this._dcsParser=this._register(new sw),this._errorHandler=this._errorHandlerFb,this.registerEscHandler({final:"\\"},()=>!0)}_identifier(e,i=[64,126]){let n=0;if(e.prefix){if(e.prefix.length>1)throw new Error("only one byte as prefix supported");if(n=e.prefix.charCodeAt(0),n&&60>n||n>63)throw new Error("prefix must be in range 0x3c .. 0x3f")}if(e.intermediates){if(e.intermediates.length>2)throw new Error("only two bytes as intermediates are supported");for(let o=0;o<e.intermediates.length;++o){let h=e.intermediates.charCodeAt(o);if(32>h||h>47)throw new Error("intermediate must be in range 0x20 .. 0x2f");n<<=8,n|=h}}if(e.final.length!==1)throw new Error("final must be a single byte");let l=e.final.charCodeAt(0);if(i[0]>l||l>i[1])throw new Error(`final must be in range ${i[0]} .. ${i[1]}`);return n<<=8,n|=l,n}identToString(e){let i=[];for(;e;)i.push(String.fromCharCode(e&255)),e>>=8;return i.reverse().join("")}setPrintHandler(e){this._printHandler=e}clearPrintHandler(){this._printHandler=this._printHandlerFb}registerEscHandler(e,i){let n=this._identifier(e,[48,126]);this._escHandlers[n]===void 0&&(this._escHandlers[n]=[]);let l=this._escHandlers[n];return l.push(i),{dispose:()=>{let o=l.indexOf(i);o!==-1&&l.splice(o,1)}}}clearEscHandler(e){this._escHandlers[this._identifier(e,[48,126])]&&delete this._escHandlers[this._identifier(e,[48,126])]}setEscHandlerFallback(e){this._escHandlerFb=e}setExecuteHandler(e,i){this._executeHandlers[e.charCodeAt(0)]=i}clearExecuteHandler(e){this._executeHandlers[e.charCodeAt(0)]&&delete this._executeHandlers[e.charCodeAt(0)]}setExecuteHandlerFallback(e){this._executeHandlerFb=e}registerCsiHandler(e,i){let n=this._identifier(e);this._csiHandlers[n]===void 0&&(this._csiHandlers[n]=[]);let l=this._csiHandlers[n];return l.push(i),{dispose:()=>{let o=l.indexOf(i);o!==-1&&l.splice(o,1)}}}clearCsiHandler(e){this._csiHandlers[this._identifier(e)]&&delete this._csiHandlers[this._identifier(e)]}setCsiHandlerFallback(e){this._csiHandlerFb=e}registerDcsHandler(e,i){return this._dcsParser.registerHandler(this._identifier(e),i)}clearDcsHandler(e){this._dcsParser.clearHandler(this._identifier(e))}setDcsHandlerFallback(e){this._dcsParser.setHandlerFallback(e)}registerOscHandler(e,i){return this._oscParser.registerHandler(e,i)}clearOscHandler(e){this._oscParser.clearHandler(e)}setOscHandlerFallback(e){this._oscParser.setHandlerFallback(e)}setErrorHandler(e){this._errorHandler=e}clearErrorHandler(){this._errorHandler=this._errorHandlerFb}reset(){this.currentState=this.initialState,this._oscParser.reset(),this._dcsParser.reset(),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._parseStack.state!==0&&(this._parseStack.state=2,this._parseStack.handlers=[])}_preserveStack(e,i,n,l,o){this._parseStack.state=e,this._parseStack.handlers=i,this._parseStack.handlerPos=n,this._parseStack.transition=l,this._parseStack.chunkPos=o}parse(e,i,n){let l=0,o=0,h=0,d;if(this._parseStack.state)if(this._parseStack.state===2)this._parseStack.state=0,h=this._parseStack.chunkPos+1;else{if(n===void 0||this._parseStack.state===1)throw this._parseStack.state=1,new Error("improper continuation due to previous async handler, giving up parsing");let _=this._parseStack.handlers,p=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(n===!1&&p>-1){for(;p>=0&&(d=_[p](this._params),d!==!0);p--)if(d instanceof Promise)return this._parseStack.handlerPos=p,d}this._parseStack.handlers=[];break;case 4:if(n===!1&&p>-1){for(;p>=0&&(d=_[p](),d!==!0);p--)if(d instanceof Promise)return this._parseStack.handlerPos=p,d}this._parseStack.handlers=[];break;case 6:if(l=e[this._parseStack.chunkPos],d=this._dcsParser.unhook(l!==24&&l!==26,n),d)return d;l===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break;case 5:if(l=e[this._parseStack.chunkPos],d=this._oscParser.end(l!==24&&l!==26,n),d)return d;l===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 _=h;_<i;++_){switch(l=e[_],o=this._transitions.table[this.currentState<<8|(l<160?l:pi)],o>>4){case 2:for(let x=_+1;;++x){if(x>=i||(l=e[x])<32||l>126&&l<pi){this._printHandler(e,_,x),_=x-1;break}if(++x>=i||(l=e[x])<32||l>126&&l<pi){this._printHandler(e,_,x),_=x-1;break}if(++x>=i||(l=e[x])<32||l>126&&l<pi){this._printHandler(e,_,x),_=x-1;break}if(++x>=i||(l=e[x])<32||l>126&&l<pi){this._printHandler(e,_,x),_=x-1;break}}break;case 3:this._executeHandlers[l]?this._executeHandlers[l]():this._executeHandlerFb(l),this.precedingJoinState=0;break;case 0:break;case 1:if(this._errorHandler({position:_,code:l,currentState:this.currentState,collect:this._collect,params:this._params,abort:!1}).abort)return;break;case 7:let p=this._csiHandlers[this._collect<<8|l],f=p?p.length-1:-1;for(;f>=0&&(d=p[f](this._params),d!==!0);f--)if(d instanceof Promise)return this._preserveStack(3,p,f,o,_),d;f<0&&this._csiHandlerFb(this._collect<<8|l,this._params),this.precedingJoinState=0;break;case 8:do switch(l){case 59:this._params.addParam(0);break;case 58:this._params.addSubParam(-1);break;default:this._params.addDigit(l-48)}while(++_<i&&(l=e[_])>47&&l<60);_--;break;case 9:this._collect<<=8,this._collect|=l;break;case 10:let S=this._escHandlers[this._collect<<8|l],y=S?S.length-1:-1;for(;y>=0&&(d=S[y](),d!==!0);y--)if(d instanceof Promise)return this._preserveStack(4,S,y,o,_),d;y<0&&this._escHandlerFb(this._collect<<8|l),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|l,this._params);break;case 13:for(let x=_+1;;++x)if(x>=i||(l=e[x])===24||l===26||l===27||l>127&&l<pi){this._dcsParser.put(e,_,x),_=x-1;break}break;case 14:if(d=this._dcsParser.unhook(l!==24&&l!==26),d)return this._preserveStack(6,[],0,o,_),d;l===27&&(o|=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 x=_+1;;x++)if(x>=i||(l=e[x])<32||l>127&&l<pi){this._oscParser.put(e,_,x),_=x-1;break}break;case 6:if(d=this._oscParser.end(l!==24&&l!==26),d)return this._preserveStack(5,[],0,o,_),d;l===27&&(o|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0;break}this.currentState=o&15}}},aw=/^([\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})$/,ow=/^[\da-f]+$/;function rm(e){if(!e)return;let i=e.toLowerCase();if(i.indexOf("rgb:")===0){i=i.slice(4);let n=aw.exec(i);if(n){let l=n[1]?15:n[4]?255:n[7]?4095:65535;return[Math.round(parseInt(n[1]||n[4]||n[7]||n[10],16)/l*255),Math.round(parseInt(n[2]||n[5]||n[8]||n[11],16)/l*255),Math.round(parseInt(n[3]||n[6]||n[9]||n[12],16)/l*255)]}}else if(i.indexOf("#")===0&&(i=i.slice(1),ow.exec(i)&&[3,6,9,12].includes(i.length))){let n=i.length/3,l=[0,0,0];for(let o=0;o<3;++o){let h=parseInt(i.slice(n*o,n*o+n),16);l[o]=n===1?h<<4:n===2?h:n===3?h>>4:h>>8}return l}}function Jh(e,i){let n=e.toString(16),l=n.length<2?"0"+n:n;switch(i){case 4:return n[0];case 8:return l;case 12:return(l+l).slice(0,3);default:return l+l}}function cw(e,i=16){let[n,l,o]=e;return`rgb:${Jh(n,i)}/${Jh(l,i)}/${Jh(o,i)}`}var hw={"(":0,")":1,"*":2,"+":3,"-":1,".":2},As=131072,nm=10;function lm(e,i){if(e>24)return i.setWinLines||!1;switch(e){case 1:return!!i.restoreWin;case 2:return!!i.minimizeWin;case 3:return!!i.setWinPosition;case 4:return!!i.setWinSizePixels;case 5:return!!i.raiseWin;case 6:return!!i.lowerWin;case 7:return!!i.refreshWin;case 8:return!!i.setWinSizeChars;case 9:return!!i.maximizeWin;case 10:return!!i.fullscreenWin;case 11:return!!i.getWinState;case 13:return!!i.getWinPosition;case 14:return!!i.getWinSizePixels;case 15:return!!i.getScreenSizePixels;case 16:return!!i.getCellSizePixels;case 18:return!!i.getWinSizeChars;case 19:return!!i.getScreenSizeChars;case 20:return!!i.getIconTitle;case 21:return!!i.getWinTitle;case 22:return!!i.pushTitle;case 23:return!!i.popTitle;case 24:return!!i.setWinLines}return!1}var am=5e3,om=0,uw=class extends Se{constructor(e,i,n,l,o,h,d,_,p=new lw){super(),this._bufferService=e,this._charsetService=i,this._coreService=n,this._logService=l,this._optionsService=o,this._oscLinkService=h,this._coreMouseService=d,this._unicodeService=_,this._parser=p,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new Bb,this._utf8Decoder=new Mb,this._windowTitle="",this._iconName="",this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=lt.clone(),this._eraseAttrDataInternal=lt.clone(),this._onRequestBell=this._register(new Q),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this._register(new Q),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this._register(new Q),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this._register(new Q),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this._register(new Q),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this._register(new Q),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this._register(new Q),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this._register(new Q),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this._register(new Q),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this._register(new Q),this.onLineFeed=this._onLineFeed.event,this._onScroll=this._register(new Q),this.onScroll=this._onScroll.event,this._onTitleChange=this._register(new Q),this.onTitleChange=this._onTitleChange.event,this._onColor=this._register(new Q),this.onColor=this._onColor.event,this._parseStack={paused:!1,cursorStartX:0,cursorStartY:0,decodedLength:0,position:0},this._specialColors=[256,257,258],this._register(this._parser),this._dirtyRowTracker=new ju(this._bufferService),this._activeBuffer=this._bufferService.buffer,this._register(this._bufferService.buffers.onBufferActivate(f=>this._activeBuffer=f.activeBuffer)),this._parser.setCsiHandlerFallback((f,S)=>{this._logService.debug("Unknown CSI code: ",{identifier:this._parser.identToString(f),params:S.toArray()})}),this._parser.setEscHandlerFallback(f=>{this._logService.debug("Unknown ESC code: ",{identifier:this._parser.identToString(f)})}),this._parser.setExecuteHandlerFallback(f=>{this._logService.debug("Unknown EXECUTE code: ",{code:f})}),this._parser.setOscHandlerFallback((f,S,y)=>{this._logService.debug("Unknown OSC code: ",{identifier:f,action:S,data:y})}),this._parser.setDcsHandlerFallback((f,S,y)=>{S==="HOOK"&&(y=y.toArray()),this._logService.debug("Unknown DCS code: ",{identifier:this._parser.identToString(f),action:S,payload:y})}),this._parser.setPrintHandler((f,S,y)=>this.print(f,S,y)),this._parser.registerCsiHandler({final:"@"},f=>this.insertChars(f)),this._parser.registerCsiHandler({intermediates:" ",final:"@"},f=>this.scrollLeft(f)),this._parser.registerCsiHandler({final:"A"},f=>this.cursorUp(f)),this._parser.registerCsiHandler({intermediates:" ",final:"A"},f=>this.scrollRight(f)),this._parser.registerCsiHandler({final:"B"},f=>this.cursorDown(f)),this._parser.registerCsiHandler({final:"C"},f=>this.cursorForward(f)),this._parser.registerCsiHandler({final:"D"},f=>this.cursorBackward(f)),this._parser.registerCsiHandler({final:"E"},f=>this.cursorNextLine(f)),this._parser.registerCsiHandler({final:"F"},f=>this.cursorPrecedingLine(f)),this._parser.registerCsiHandler({final:"G"},f=>this.cursorCharAbsolute(f)),this._parser.registerCsiHandler({final:"H"},f=>this.cursorPosition(f)),this._parser.registerCsiHandler({final:"I"},f=>this.cursorForwardTab(f)),this._parser.registerCsiHandler({final:"J"},f=>this.eraseInDisplay(f,!1)),this._parser.registerCsiHandler({prefix:"?",final:"J"},f=>this.eraseInDisplay(f,!0)),this._parser.registerCsiHandler({final:"K"},f=>this.eraseInLine(f,!1)),this._parser.registerCsiHandler({prefix:"?",final:"K"},f=>this.eraseInLine(f,!0)),this._parser.registerCsiHandler({final:"L"},f=>this.insertLines(f)),this._parser.registerCsiHandler({final:"M"},f=>this.deleteLines(f)),this._parser.registerCsiHandler({final:"P"},f=>this.deleteChars(f)),this._parser.registerCsiHandler({final:"S"},f=>this.scrollUp(f)),this._parser.registerCsiHandler({final:"T"},f=>this.scrollDown(f)),this._parser.registerCsiHandler({final:"X"},f=>this.eraseChars(f)),this._parser.registerCsiHandler({final:"Z"},f=>this.cursorBackwardTab(f)),this._parser.registerCsiHandler({final:"`"},f=>this.charPosAbsolute(f)),this._parser.registerCsiHandler({final:"a"},f=>this.hPositionRelative(f)),this._parser.registerCsiHandler({final:"b"},f=>this.repeatPrecedingCharacter(f)),this._parser.registerCsiHandler({final:"c"},f=>this.sendDeviceAttributesPrimary(f)),this._parser.registerCsiHandler({prefix:">",final:"c"},f=>this.sendDeviceAttributesSecondary(f)),this._parser.registerCsiHandler({final:"d"},f=>this.linePosAbsolute(f)),this._parser.registerCsiHandler({final:"e"},f=>this.vPositionRelative(f)),this._parser.registerCsiHandler({final:"f"},f=>this.hVPosition(f)),this._parser.registerCsiHandler({final:"g"},f=>this.tabClear(f)),this._parser.registerCsiHandler({final:"h"},f=>this.setMode(f)),this._parser.registerCsiHandler({prefix:"?",final:"h"},f=>this.setModePrivate(f)),this._parser.registerCsiHandler({final:"l"},f=>this.resetMode(f)),this._parser.registerCsiHandler({prefix:"?",final:"l"},f=>this.resetModePrivate(f)),this._parser.registerCsiHandler({final:"m"},f=>this.charAttributes(f)),this._parser.registerCsiHandler({final:"n"},f=>this.deviceStatus(f)),this._parser.registerCsiHandler({prefix:"?",final:"n"},f=>this.deviceStatusPrivate(f)),this._parser.registerCsiHandler({intermediates:"!",final:"p"},f=>this.softReset(f)),this._parser.registerCsiHandler({intermediates:" ",final:"q"},f=>this.setCursorStyle(f)),this._parser.registerCsiHandler({final:"r"},f=>this.setScrollRegion(f)),this._parser.registerCsiHandler({final:"s"},f=>this.saveCursor(f)),this._parser.registerCsiHandler({final:"t"},f=>this.windowOptions(f)),this._parser.registerCsiHandler({final:"u"},f=>this.restoreCursor(f)),this._parser.registerCsiHandler({intermediates:"'",final:"}"},f=>this.insertColumns(f)),this._parser.registerCsiHandler({intermediates:"'",final:"~"},f=>this.deleteColumns(f)),this._parser.registerCsiHandler({intermediates:'"',final:"q"},f=>this.selectProtected(f)),this._parser.registerCsiHandler({intermediates:"$",final:"p"},f=>this.requestMode(f,!0)),this._parser.registerCsiHandler({prefix:"?",intermediates:"$",final:"p"},f=>this.requestMode(f,!1)),this._parser.setExecuteHandler(F.BEL,()=>this.bell()),this._parser.setExecuteHandler(F.LF,()=>this.lineFeed()),this._parser.setExecuteHandler(F.VT,()=>this.lineFeed()),this._parser.setExecuteHandler(F.FF,()=>this.lineFeed()),this._parser.setExecuteHandler(F.CR,()=>this.carriageReturn()),this._parser.setExecuteHandler(F.BS,()=>this.backspace()),this._parser.setExecuteHandler(F.HT,()=>this.tab()),this._parser.setExecuteHandler(F.SO,()=>this.shiftOut()),this._parser.setExecuteHandler(F.SI,()=>this.shiftIn()),this._parser.setExecuteHandler(Xa.IND,()=>this.index()),this._parser.setExecuteHandler(Xa.NEL,()=>this.nextLine()),this._parser.setExecuteHandler(Xa.HTS,()=>this.tabSet()),this._parser.registerOscHandler(0,new Jt(f=>(this.setTitle(f),this.setIconName(f),!0))),this._parser.registerOscHandler(1,new Jt(f=>this.setIconName(f))),this._parser.registerOscHandler(2,new Jt(f=>this.setTitle(f))),this._parser.registerOscHandler(4,new Jt(f=>this.setOrReportIndexedColor(f))),this._parser.registerOscHandler(8,new Jt(f=>this.setHyperlink(f))),this._parser.registerOscHandler(10,new Jt(f=>this.setOrReportFgColor(f))),this._parser.registerOscHandler(11,new Jt(f=>this.setOrReportBgColor(f))),this._parser.registerOscHandler(12,new Jt(f=>this.setOrReportCursorColor(f))),this._parser.registerOscHandler(104,new Jt(f=>this.restoreIndexedColor(f))),this._parser.registerOscHandler(110,new Jt(f=>this.restoreFgColor(f))),this._parser.registerOscHandler(111,new Jt(f=>this.restoreBgColor(f))),this._parser.registerOscHandler(112,new Jt(f=>this.restoreCursorColor(f))),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 f in dt)this._parser.registerEscHandler({intermediates:"(",final:f},()=>this.selectCharset("("+f)),this._parser.registerEscHandler({intermediates:")",final:f},()=>this.selectCharset(")"+f)),this._parser.registerEscHandler({intermediates:"*",final:f},()=>this.selectCharset("*"+f)),this._parser.registerEscHandler({intermediates:"+",final:f},()=>this.selectCharset("+"+f)),this._parser.registerEscHandler({intermediates:"-",final:f},()=>this.selectCharset("-"+f)),this._parser.registerEscHandler({intermediates:".",final:f},()=>this.selectCharset("."+f)),this._parser.registerEscHandler({intermediates:"/",final:f},()=>this.selectCharset("/"+f));this._parser.registerEscHandler({intermediates:"#",final:"8"},()=>this.screenAlignmentPattern()),this._parser.setErrorHandler(f=>(this._logService.error("Parsing error: ",f),f)),this._parser.registerDcsHandler({intermediates:"$",final:"q"},new sm((f,S)=>this.requestStatusString(f,S)))}getAttrData(){return this._curAttrData}_preserveStack(e,i,n,l){this._parseStack.paused=!0,this._parseStack.cursorStartX=e,this._parseStack.cursorStartY=i,this._parseStack.decodedLength=n,this._parseStack.position=l}_logSlowResolvingAsync(e){this._logService.logLevel<=3&&Promise.race([e,new Promise((i,n)=>setTimeout(()=>n("#SLOW_TIMEOUT"),am))]).catch(i=>{if(i!=="#SLOW_TIMEOUT")throw i;console.warn(`async parser handler taking longer than ${am} ms`)})}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(e,i){let n,l=this._activeBuffer.x,o=this._activeBuffer.y,h=0,d=this._parseStack.paused;if(d){if(n=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,i))return this._logSlowResolvingAsync(n),n;l=this._parseStack.cursorStartX,o=this._parseStack.cursorStartY,this._parseStack.paused=!1,e.length>As&&(h=this._parseStack.position+As)}if(this._logService.logLevel<=1&&this._logService.debug(`parsing data ${typeof e=="string"?` "${e}"`:` "${Array.prototype.map.call(e,f=>String.fromCharCode(f)).join("")}"`}`),this._logService.logLevel===0&&this._logService.trace("parsing data (codes)",typeof e=="string"?e.split("").map(f=>f.charCodeAt(0)):e),this._parseBuffer.length<e.length&&this._parseBuffer.length<As&&(this._parseBuffer=new Uint32Array(Math.min(e.length,As))),d||this._dirtyRowTracker.clearRange(),e.length>As)for(let f=h;f<e.length;f+=As){let S=f+As<e.length?f+As:e.length,y=typeof e=="string"?this._stringDecoder.decode(e.substring(f,S),this._parseBuffer):this._utf8Decoder.decode(e.subarray(f,S),this._parseBuffer);if(n=this._parser.parse(this._parseBuffer,y))return this._preserveStack(l,o,y,f),this._logSlowResolvingAsync(n),n}else if(!d){let f=typeof e=="string"?this._stringDecoder.decode(e,this._parseBuffer):this._utf8Decoder.decode(e,this._parseBuffer);if(n=this._parser.parse(this._parseBuffer,f))return this._preserveStack(l,o,f,0),this._logSlowResolvingAsync(n),n}(this._activeBuffer.x!==l||this._activeBuffer.y!==o)&&this._onCursorMove.fire();let _=this._dirtyRowTracker.end+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp),p=this._dirtyRowTracker.start+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp);p<this._bufferService.rows&&this._onRequestRefreshRows.fire({start:Math.min(p,this._bufferService.rows-1),end:Math.min(_,this._bufferService.rows-1)})}print(e,i,n){let l,o,h=this._charsetService.charset,d=this._optionsService.rawOptions.screenReaderMode,_=this._bufferService.cols,p=this._coreService.decPrivateModes.wraparound,f=this._coreService.modes.insertMode,S=this._curAttrData,y=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._activeBuffer.x&&n-i>0&&y.getWidth(this._activeBuffer.x-1)===2&&y.setCellFromCodepoint(this._activeBuffer.x-1,0,1,S);let x=this._parser.precedingJoinState;for(let C=i;C<n;++C){if(l=e[C],l<127&&h){let A=h[String.fromCharCode(l)];A&&(l=A.charCodeAt(0))}let b=this._unicodeService.charProperties(l,x);o=nr.extractWidth(b);let T=nr.extractShouldJoin(b),M=T?nr.extractWidth(x):0;if(x=b,d&&this._onA11yChar.fire(Os(l)),this._getCurrentLinkId()&&this._oscLinkService.addLineToLink(this._getCurrentLinkId(),this._activeBuffer.ybase+this._activeBuffer.y),this._activeBuffer.x+o-M>_){if(p){let A=y,O=this._activeBuffer.x-M;for(this._activeBuffer.x=M,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),y=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y),M>0&&y instanceof cl&&y.copyCellsFrom(A,O,0,M,!1);O<_;)A.setCellFromCodepoint(O++,0,1,S)}else if(this._activeBuffer.x=_-1,o===2)continue}if(T&&this._activeBuffer.x){let A=y.getWidth(this._activeBuffer.x-1)?1:2;y.addCodepointToCell(this._activeBuffer.x-A,l,o);for(let O=o-M;--O>=0;)y.setCellFromCodepoint(this._activeBuffer.x++,0,0,S);continue}if(f&&(y.insertCells(this._activeBuffer.x,o-M,this._activeBuffer.getNullCell(S)),y.getWidth(_-1)===2&&y.setCellFromCodepoint(_-1,0,1,S)),y.setCellFromCodepoint(this._activeBuffer.x++,l,o,S),o>0)for(;--o;)y.setCellFromCodepoint(this._activeBuffer.x++,0,0,S)}this._parser.precedingJoinState=x,this._activeBuffer.x<_&&n-i>0&&y.getWidth(this._activeBuffer.x)===0&&!y.hasContent(this._activeBuffer.x)&&y.setCellFromCodepoint(this._activeBuffer.x,0,1,S),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(e,i){return e.final==="t"&&!e.prefix&&!e.intermediates?this._parser.registerCsiHandler(e,n=>lm(n.params[0],this._optionsService.rawOptions.windowOptions)?i(n):!0):this._parser.registerCsiHandler(e,i)}registerDcsHandler(e,i){return this._parser.registerDcsHandler(e,new sm(i))}registerEscHandler(e,i){return this._parser.registerEscHandler(e,i)}registerOscHandler(e,i){return this._parser.registerOscHandler(e,new Jt(i))}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 e=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);e.hasWidth(this._activeBuffer.x)&&!e.hasContent(this._activeBuffer.x)&&this._activeBuffer.x--}return this._restrictCursor(),!0}tab(){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let e=this._activeBuffer.x;return this._activeBuffer.x=this._activeBuffer.nextStop(),this._optionsService.rawOptions.screenReaderMode&&this._onA11yTab.fire(this._activeBuffer.x-e),!0}shiftOut(){return this._charsetService.setgLevel(1),!0}shiftIn(){return this._charsetService.setgLevel(0),!0}_restrictCursor(e=this._bufferService.cols-1){this._activeBuffer.x=Math.min(e,Math.max(0,this._activeBuffer.x)),this._activeBuffer.y=this._coreService.decPrivateModes.origin?Math.min(this._activeBuffer.scrollBottom,Math.max(this._activeBuffer.scrollTop,this._activeBuffer.y)):Math.min(this._bufferService.rows-1,Math.max(0,this._activeBuffer.y)),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_setCursor(e,i){this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._coreService.decPrivateModes.origin?(this._activeBuffer.x=e,this._activeBuffer.y=this._activeBuffer.scrollTop+i):(this._activeBuffer.x=e,this._activeBuffer.y=i),this._restrictCursor(),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_moveCursor(e,i){this._restrictCursor(),this._setCursor(this._activeBuffer.x+e,this._activeBuffer.y+i)}cursorUp(e){let i=this._activeBuffer.y-this._activeBuffer.scrollTop;return i>=0?this._moveCursor(0,-Math.min(i,e.params[0]||1)):this._moveCursor(0,-(e.params[0]||1)),!0}cursorDown(e){let i=this._activeBuffer.scrollBottom-this._activeBuffer.y;return i>=0?this._moveCursor(0,Math.min(i,e.params[0]||1)):this._moveCursor(0,e.params[0]||1),!0}cursorForward(e){return this._moveCursor(e.params[0]||1,0),!0}cursorBackward(e){return this._moveCursor(-(e.params[0]||1),0),!0}cursorNextLine(e){return this.cursorDown(e),this._activeBuffer.x=0,!0}cursorPrecedingLine(e){return this.cursorUp(e),this._activeBuffer.x=0,!0}cursorCharAbsolute(e){return this._setCursor((e.params[0]||1)-1,this._activeBuffer.y),!0}cursorPosition(e){return this._setCursor(e.length>=2?(e.params[1]||1)-1:0,(e.params[0]||1)-1),!0}charPosAbsolute(e){return this._setCursor((e.params[0]||1)-1,this._activeBuffer.y),!0}hPositionRelative(e){return this._moveCursor(e.params[0]||1,0),!0}linePosAbsolute(e){return this._setCursor(this._activeBuffer.x,(e.params[0]||1)-1),!0}vPositionRelative(e){return this._moveCursor(0,e.params[0]||1),!0}hVPosition(e){return this.cursorPosition(e),!0}tabClear(e){let i=e.params[0];return i===0?delete this._activeBuffer.tabs[this._activeBuffer.x]:i===3&&(this._activeBuffer.tabs={}),!0}cursorForwardTab(e){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let i=e.params[0]||1;for(;i--;)this._activeBuffer.x=this._activeBuffer.nextStop();return!0}cursorBackwardTab(e){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let i=e.params[0]||1;for(;i--;)this._activeBuffer.x=this._activeBuffer.prevStop();return!0}selectProtected(e){let i=e.params[0];return i===1&&(this._curAttrData.bg|=536870912),(i===2||i===0)&&(this._curAttrData.bg&=-536870913),!0}_eraseInBufferLine(e,i,n,l=!1,o=!1){let h=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);h.replaceCells(i,n,this._activeBuffer.getNullCell(this._eraseAttrData()),o),l&&(h.isWrapped=!1)}_resetBufferLine(e,i=!1){let n=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);n&&(n.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),i),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+e),n.isWrapped=!1)}eraseInDisplay(e,i=!1){this._restrictCursor(this._bufferService.cols);let n;switch(e.params[0]){case 0:for(n=this._activeBuffer.y,this._dirtyRowTracker.markDirty(n),this._eraseInBufferLine(n++,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,i);n<this._bufferService.rows;n++)this._resetBufferLine(n,i);this._dirtyRowTracker.markDirty(n);break;case 1:for(n=this._activeBuffer.y,this._dirtyRowTracker.markDirty(n),this._eraseInBufferLine(n,0,this._activeBuffer.x+1,!0,i),this._activeBuffer.x+1>=this._bufferService.cols&&(this._activeBuffer.lines.get(n+1).isWrapped=!1);n--;)this._resetBufferLine(n,i);this._dirtyRowTracker.markDirty(0);break;case 2:if(this._optionsService.rawOptions.scrollOnEraseInDisplay){for(n=this._bufferService.rows,this._dirtyRowTracker.markRangeDirty(0,n-1);n--&&!this._activeBuffer.lines.get(this._activeBuffer.ybase+n)?.getTrimmedLength(););for(;n>=0;n--)this._bufferService.scroll(this._eraseAttrData())}else{for(n=this._bufferService.rows,this._dirtyRowTracker.markDirty(n-1);n--;)this._resetBufferLine(n,i);this._dirtyRowTracker.markDirty(0)}break;case 3:let l=this._activeBuffer.lines.length-this._bufferService.rows;l>0&&(this._activeBuffer.lines.trimStart(l),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-l,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-l,0),this._onScroll.fire(0));break}return!0}eraseInLine(e,i=!1){switch(this._restrictCursor(this._bufferService.cols),e.params[0]){case 0:this._eraseInBufferLine(this._activeBuffer.y,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,i);break;case 1:this._eraseInBufferLine(this._activeBuffer.y,0,this._activeBuffer.x+1,!1,i);break;case 2:this._eraseInBufferLine(this._activeBuffer.y,0,this._bufferService.cols,!0,i);break}return this._dirtyRowTracker.markDirty(this._activeBuffer.y),!0}insertLines(e){this._restrictCursor();let i=e.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let n=this._activeBuffer.ybase+this._activeBuffer.y,l=this._bufferService.rows-1-this._activeBuffer.scrollBottom,o=this._bufferService.rows-1+this._activeBuffer.ybase-l+1;for(;i--;)this._activeBuffer.lines.splice(o-1,1),this._activeBuffer.lines.splice(n,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}deleteLines(e){this._restrictCursor();let i=e.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let n=this._activeBuffer.ybase+this._activeBuffer.y,l;for(l=this._bufferService.rows-1-this._activeBuffer.scrollBottom,l=this._bufferService.rows-1+this._activeBuffer.ybase-l;i--;)this._activeBuffer.lines.splice(n,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}insertChars(e){this._restrictCursor();let i=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return i&&(i.insertCells(this._activeBuffer.x,e.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}deleteChars(e){this._restrictCursor();let i=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return i&&(i.deleteCells(this._activeBuffer.x,e.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}scrollUp(e){let i=e.params[0]||1;for(;i--;)this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollTop,1),this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollBottom,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollDown(e){let i=e.params[0]||1;for(;i--;)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(lt));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollLeft(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let i=e.params[0]||1;for(let n=this._activeBuffer.scrollTop;n<=this._activeBuffer.scrollBottom;++n){let l=this._activeBuffer.lines.get(this._activeBuffer.ybase+n);l.deleteCells(0,i,this._activeBuffer.getNullCell(this._eraseAttrData())),l.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollRight(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let i=e.params[0]||1;for(let n=this._activeBuffer.scrollTop;n<=this._activeBuffer.scrollBottom;++n){let l=this._activeBuffer.lines.get(this._activeBuffer.ybase+n);l.insertCells(0,i,this._activeBuffer.getNullCell(this._eraseAttrData())),l.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}insertColumns(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let i=e.params[0]||1;for(let n=this._activeBuffer.scrollTop;n<=this._activeBuffer.scrollBottom;++n){let l=this._activeBuffer.lines.get(this._activeBuffer.ybase+n);l.insertCells(this._activeBuffer.x,i,this._activeBuffer.getNullCell(this._eraseAttrData())),l.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}deleteColumns(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let i=e.params[0]||1;for(let n=this._activeBuffer.scrollTop;n<=this._activeBuffer.scrollBottom;++n){let l=this._activeBuffer.lines.get(this._activeBuffer.ybase+n);l.deleteCells(this._activeBuffer.x,i,this._activeBuffer.getNullCell(this._eraseAttrData())),l.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}eraseChars(e){this._restrictCursor();let i=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return i&&(i.replaceCells(this._activeBuffer.x,this._activeBuffer.x+(e.params[0]||1),this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}repeatPrecedingCharacter(e){let i=this._parser.precedingJoinState;if(!i)return!0;let n=e.params[0]||1,l=nr.extractWidth(i),o=this._activeBuffer.x-l,h=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).getString(o),d=new Uint32Array(h.length*n),_=0;for(let f=0;f<h.length;){let S=h.codePointAt(f)||0;d[_++]=S,f+=S>65535?2:1}let p=_;for(let f=1;f<n;++f)d.copyWithin(p,0,_),p+=_;return this.print(d,0,p),!0}sendDeviceAttributesPrimary(e){return e.params[0]>0||(this._is("xterm")||this._is("rxvt-unicode")||this._is("screen")?this._coreService.triggerDataEvent(F.ESC+"[?1;2c"):this._is("linux")&&this._coreService.triggerDataEvent(F.ESC+"[?6c")),!0}sendDeviceAttributesSecondary(e){return e.params[0]>0||(this._is("xterm")?this._coreService.triggerDataEvent(F.ESC+"[>0;276;0c"):this._is("rxvt-unicode")?this._coreService.triggerDataEvent(F.ESC+"[>85;95;0c"):this._is("linux")?this._coreService.triggerDataEvent(e.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent(F.ESC+"[>83;40003;0c")),!0}_is(e){return(this._optionsService.rawOptions.termName+"").indexOf(e)===0}setMode(e){for(let i=0;i<e.length;i++)switch(e.params[i]){case 4:this._coreService.modes.insertMode=!0;break;case 20:this._optionsService.options.convertEol=!0;break}return!0}setModePrivate(e){for(let i=0;i<e.length;i++)switch(e.params[i]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!0;break;case 2:this._charsetService.setgCharset(0,sr),this._charsetService.setgCharset(1,sr),this._charsetService.setgCharset(2,sr),this._charsetService.setgCharset(3,sr);break;case 3:this._optionsService.rawOptions.windowOptions.setWinLines&&(this._bufferService.resize(132,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!0,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!0;break;case 12:this._optionsService.options.cursorBlink=!0;break;case 45:this._coreService.decPrivateModes.reverseWraparound=!0;break;case 66:this._logService.debug("Serial port requested application keypad."),this._coreService.decPrivateModes.applicationKeypad=!0,this._onRequestSyncScrollBar.fire();break;case 9:this._coreMouseService.activeProtocol="X10";break;case 1e3:this._coreMouseService.activeProtocol="VT200";break;case 1002:this._coreMouseService.activeProtocol="DRAG";break;case 1003:this._coreMouseService.activeProtocol="ANY";break;case 1004:this._coreService.decPrivateModes.sendFocus=!0,this._onRequestSendFocus.fire();break;case 1005:this._logService.debug("DECSET 1005 not supported (see #2507)");break;case 1006:this._coreMouseService.activeEncoding="SGR";break;case 1015:this._logService.debug("DECSET 1015 not supported (see #2507)");break;case 1016:this._coreMouseService.activeEncoding="SGR_PIXELS";break;case 25:this._coreService.isCursorHidden=!1;break;case 1048:this.saveCursor();break;case 1049:this.saveCursor();case 47:case 1047:this._bufferService.buffers.activateAltBuffer(this._eraseAttrData()),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(void 0),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!0;break;case 2026:this._coreService.decPrivateModes.synchronizedOutput=!0;break}return!0}resetMode(e){for(let i=0;i<e.length;i++)switch(e.params[i]){case 4:this._coreService.modes.insertMode=!1;break;case 20:this._optionsService.options.convertEol=!1;break}return!0}resetModePrivate(e){for(let i=0;i<e.length;i++)switch(e.params[i]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!1;break;case 3:this._optionsService.rawOptions.windowOptions.setWinLines&&(this._bufferService.resize(80,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!1,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!1;break;case 12:this._optionsService.options.cursorBlink=!1;break;case 45:this._coreService.decPrivateModes.reverseWraparound=!1;break;case 66:this._logService.debug("Switching back to normal keypad."),this._coreService.decPrivateModes.applicationKeypad=!1,this._onRequestSyncScrollBar.fire();break;case 9:case 1e3:case 1002:case 1003:this._coreMouseService.activeProtocol="NONE";break;case 1004:this._coreService.decPrivateModes.sendFocus=!1;break;case 1005:this._logService.debug("DECRST 1005 not supported (see #2507)");break;case 1006:this._coreMouseService.activeEncoding="DEFAULT";break;case 1015:this._logService.debug("DECRST 1015 not supported (see #2507)");break;case 1016:this._coreMouseService.activeEncoding="DEFAULT";break;case 25:this._coreService.isCursorHidden=!0;break;case 1048:this.restoreCursor();break;case 1049:case 47:case 1047:this._bufferService.buffers.activateNormalBuffer(),e.params[i]===1049&&this.restoreCursor(),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(void 0),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!1;break;case 2026:this._coreService.decPrivateModes.synchronizedOutput=!1,this._onRequestRefreshRows.fire(void 0);break}return!0}requestMode(e,i){let n;(T=>(T[T.NOT_RECOGNIZED=0]="NOT_RECOGNIZED",T[T.SET=1]="SET",T[T.RESET=2]="RESET",T[T.PERMANENTLY_SET=3]="PERMANENTLY_SET",T[T.PERMANENTLY_RESET=4]="PERMANENTLY_RESET"))(n||={});let l=this._coreService.decPrivateModes,{activeProtocol:o,activeEncoding:h}=this._coreMouseService,d=this._coreService,{buffers:_,cols:p}=this._bufferService,{active:f,alt:S}=_,y=this._optionsService.rawOptions,x=(T,M)=>(d.triggerDataEvent(`${F.ESC}[${i?"":"?"}${T};${M}$y`),!0),C=T=>T?1:2,b=e.params[0];return i?b===2?x(b,4):b===4?x(b,C(d.modes.insertMode)):b===12?x(b,3):b===20?x(b,C(y.convertEol)):x(b,0):b===1?x(b,C(l.applicationCursorKeys)):b===3?x(b,y.windowOptions.setWinLines?p===80?2:p===132?1:0:0):b===6?x(b,C(l.origin)):b===7?x(b,C(l.wraparound)):b===8?x(b,3):b===9?x(b,C(o==="X10")):b===12?x(b,C(y.cursorBlink)):b===25?x(b,C(!d.isCursorHidden)):b===45?x(b,C(l.reverseWraparound)):b===66?x(b,C(l.applicationKeypad)):b===67?x(b,4):b===1e3?x(b,C(o==="VT200")):b===1002?x(b,C(o==="DRAG")):b===1003?x(b,C(o==="ANY")):b===1004?x(b,C(l.sendFocus)):b===1005?x(b,4):b===1006?x(b,C(h==="SGR")):b===1015?x(b,4):b===1016?x(b,C(h==="SGR_PIXELS")):b===1048?x(b,1):b===47||b===1047||b===1049?x(b,C(f===S)):b===2004?x(b,C(l.bracketedPasteMode)):b===2026?x(b,C(l.synchronizedOutput)):x(b,0)}_updateAttrColor(e,i,n,l,o){return i===2?(e|=50331648,e&=-16777216,e|=ml.fromColorRGB([n,l,o])):i===5&&(e&=-50331904,e|=33554432|n&255),e}_extractColor(e,i,n){let l=[0,0,-1,0,0,0],o=0,h=0;do{if(l[h+o]=e.params[i+h],e.hasSubParams(i+h)){let d=e.getSubParams(i+h),_=0;do l[1]===5&&(o=1),l[h+_+1+o]=d[_];while(++_<d.length&&_+h+1+o<l.length);break}if(l[1]===5&&h+o>=2||l[1]===2&&h+o>=5)break;l[1]&&(o=1)}while(++h+i<e.length&&h+o<l.length);for(let d=2;d<l.length;++d)l[d]===-1&&(l[d]=0);switch(l[0]){case 38:n.fg=this._updateAttrColor(n.fg,l[1],l[3],l[4],l[5]);break;case 48:n.bg=this._updateAttrColor(n.bg,l[1],l[3],l[4],l[5]);break;case 58:n.extended=n.extended.clone(),n.extended.underlineColor=this._updateAttrColor(n.extended.underlineColor,l[1],l[3],l[4],l[5])}return h}_processUnderline(e,i){i.extended=i.extended.clone(),(!~e||e>5)&&(e=1),i.extended.underlineStyle=e,i.fg|=268435456,e===0&&(i.fg&=-268435457),i.updateExtended()}_processSGR0(e){e.fg=lt.fg,e.bg=lt.bg,e.extended=e.extended.clone(),e.extended.underlineStyle=0,e.extended.underlineColor&=-67108864,e.updateExtended()}charAttributes(e){if(e.length===1&&e.params[0]===0)return this._processSGR0(this._curAttrData),!0;let i=e.length,n,l=this._curAttrData;for(let o=0;o<i;o++)n=e.params[o],n>=30&&n<=37?(l.fg&=-50331904,l.fg|=16777216|n-30):n>=40&&n<=47?(l.bg&=-50331904,l.bg|=16777216|n-40):n>=90&&n<=97?(l.fg&=-50331904,l.fg|=16777216|n-90|8):n>=100&&n<=107?(l.bg&=-50331904,l.bg|=16777216|n-100|8):n===0?this._processSGR0(l):n===1?l.fg|=134217728:n===3?l.bg|=67108864:n===4?(l.fg|=268435456,this._processUnderline(e.hasSubParams(o)?e.getSubParams(o)[0]:1,l)):n===5?l.fg|=536870912:n===7?l.fg|=67108864:n===8?l.fg|=1073741824:n===9?l.fg|=2147483648:n===2?l.bg|=134217728:n===21?this._processUnderline(2,l):n===22?(l.fg&=-134217729,l.bg&=-134217729):n===23?l.bg&=-67108865:n===24?(l.fg&=-268435457,this._processUnderline(0,l)):n===25?l.fg&=-536870913:n===27?l.fg&=-67108865:n===28?l.fg&=-1073741825:n===29?l.fg&=2147483647:n===39?(l.fg&=-67108864,l.fg|=lt.fg&16777215):n===49?(l.bg&=-67108864,l.bg|=lt.bg&16777215):n===38||n===48||n===58?o+=this._extractColor(e,o,l):n===53?l.bg|=1073741824:n===55?l.bg&=-1073741825:n===59?(l.extended=l.extended.clone(),l.extended.underlineColor=-1,l.updateExtended()):n===100?(l.fg&=-67108864,l.fg|=lt.fg&16777215,l.bg&=-67108864,l.bg|=lt.bg&16777215):this._logService.debug("Unknown SGR attribute: %d.",n);return!0}deviceStatus(e){switch(e.params[0]){case 5:this._coreService.triggerDataEvent(`${F.ESC}[0n`);break;case 6:let i=this._activeBuffer.y+1,n=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${F.ESC}[${i};${n}R`);break}return!0}deviceStatusPrivate(e){if(e.params[0]===6){let i=this._activeBuffer.y+1,n=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${F.ESC}[?${i};${n}R`)}return!0}softReset(e){return this._coreService.isCursorHidden=!1,this._onRequestSyncScrollBar.fire(),this._activeBuffer.scrollTop=0,this._activeBuffer.scrollBottom=this._bufferService.rows-1,this._curAttrData=lt.clone(),this._coreService.reset(),this._charsetService.reset(),this._activeBuffer.savedX=0,this._activeBuffer.savedY=this._activeBuffer.ybase,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,this._coreService.decPrivateModes.origin=!1,!0}setCursorStyle(e){let i=e.length===0?1:e.params[0];if(i===0)this._coreService.decPrivateModes.cursorStyle=void 0,this._coreService.decPrivateModes.cursorBlink=void 0;else{switch(i){case 1:case 2:this._coreService.decPrivateModes.cursorStyle="block";break;case 3:case 4:this._coreService.decPrivateModes.cursorStyle="underline";break;case 5:case 6:this._coreService.decPrivateModes.cursorStyle="bar";break}let n=i%2===1;this._coreService.decPrivateModes.cursorBlink=n}return!0}setScrollRegion(e){let i=e.params[0]||1,n;return(e.length<2||(n=e.params[1])>this._bufferService.rows||n===0)&&(n=this._bufferService.rows),n>i&&(this._activeBuffer.scrollTop=i-1,this._activeBuffer.scrollBottom=n-1,this._setCursor(0,0)),!0}windowOptions(e){if(!lm(e.params[0],this._optionsService.rawOptions.windowOptions))return!0;let i=e.length>1?e.params[1]:0;switch(e.params[0]){case 14:i!==2&&this._onRequestWindowsOptionsReport.fire(0);break;case 16:this._onRequestWindowsOptionsReport.fire(1);break;case 18:this._bufferService&&this._coreService.triggerDataEvent(`${F.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);break;case 22:(i===0||i===2)&&(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>nm&&this._windowTitleStack.shift()),(i===0||i===1)&&(this._iconNameStack.push(this._iconName),this._iconNameStack.length>nm&&this._iconNameStack.shift());break;case 23:(i===0||i===2)&&this._windowTitleStack.length&&this.setTitle(this._windowTitleStack.pop()),(i===0||i===1)&&this._iconNameStack.length&&this.setIconName(this._iconNameStack.pop());break}return!0}saveCursor(e){return this._activeBuffer.savedX=this._activeBuffer.x,this._activeBuffer.savedY=this._activeBuffer.ybase+this._activeBuffer.y,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,!0}restoreCursor(e){return this._activeBuffer.x=this._activeBuffer.savedX||0,this._activeBuffer.y=Math.max(this._activeBuffer.savedY-this._activeBuffer.ybase,0),this._curAttrData.fg=this._activeBuffer.savedCurAttrData.fg,this._curAttrData.bg=this._activeBuffer.savedCurAttrData.bg,this._charsetService.charset=this._savedCharset,this._activeBuffer.savedCharset&&(this._charsetService.charset=this._activeBuffer.savedCharset),this._restrictCursor(),!0}setTitle(e){return this._windowTitle=e,this._onTitleChange.fire(e),!0}setIconName(e){return this._iconName=e,!0}setOrReportIndexedColor(e){let i=[],n=e.split(";");for(;n.length>1;){let l=n.shift(),o=n.shift();if(/^\d+$/.exec(l)){let h=parseInt(l);if(cm(h))if(o==="?")i.push({type:0,index:h});else{let d=rm(o);d&&i.push({type:1,index:h,color:d})}}}return i.length&&this._onColor.fire(i),!0}setHyperlink(e){let i=e.indexOf(";");if(i===-1)return!0;let n=e.slice(0,i).trim(),l=e.slice(i+1);return l?this._createHyperlink(n,l):n.trim()?!1:this._finishHyperlink()}_createHyperlink(e,i){this._getCurrentLinkId()&&this._finishHyperlink();let n=e.split(":"),l,o=n.findIndex(h=>h.startsWith("id="));return o!==-1&&(l=n[o].slice(3)||void 0),this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=this._oscLinkService.registerLink({id:l,uri:i}),this._curAttrData.updateExtended(),!0}_finishHyperlink(){return this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=0,this._curAttrData.updateExtended(),!0}_setOrReportSpecialColor(e,i){let n=e.split(";");for(let l=0;l<n.length&&!(i>=this._specialColors.length);++l,++i)if(n[l]==="?")this._onColor.fire([{type:0,index:this._specialColors[i]}]);else{let o=rm(n[l]);o&&this._onColor.fire([{type:1,index:this._specialColors[i],color:o}])}return!0}setOrReportFgColor(e){return this._setOrReportSpecialColor(e,0)}setOrReportBgColor(e){return this._setOrReportSpecialColor(e,1)}setOrReportCursorColor(e){return this._setOrReportSpecialColor(e,2)}restoreIndexedColor(e){if(!e)return this._onColor.fire([{type:2}]),!0;let i=[],n=e.split(";");for(let l=0;l<n.length;++l)if(/^\d+$/.exec(n[l])){let o=parseInt(n[l]);cm(o)&&i.push({type:2,index:o})}return i.length&&this._onColor.fire(i),!0}restoreFgColor(e){return this._onColor.fire([{type:2,index:256}]),!0}restoreBgColor(e){return this._onColor.fire([{type:2,index:257}]),!0}restoreCursorColor(e){return this._onColor.fire([{type:2,index:258}]),!0}nextLine(){return this._activeBuffer.x=0,this.index(),!0}keypadApplicationMode(){return this._logService.debug("Serial port requested application keypad."),this._coreService.decPrivateModes.applicationKeypad=!0,this._onRequestSyncScrollBar.fire(),!0}keypadNumericMode(){return this._logService.debug("Switching back to normal keypad."),this._coreService.decPrivateModes.applicationKeypad=!1,this._onRequestSyncScrollBar.fire(),!0}selectDefaultCharset(){return this._charsetService.setgLevel(0),this._charsetService.setgCharset(0,sr),!0}selectCharset(e){return e.length!==2?(this.selectDefaultCharset(),!0):(e[0]==="/"||this._charsetService.setgCharset(hw[e[0]],dt[e[1]]||sr),!0)}index(){return this._restrictCursor(),this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData())):this._activeBuffer.y>=this._bufferService.rows&&(this._activeBuffer.y=this._bufferService.rows-1),this._restrictCursor(),!0}tabSet(){return this._activeBuffer.tabs[this._activeBuffer.x]=!0,!0}reverseIndex(){if(this._restrictCursor(),this._activeBuffer.y===this._activeBuffer.scrollTop){let e=this._activeBuffer.scrollBottom-this._activeBuffer.scrollTop;this._activeBuffer.lines.shiftElements(this._activeBuffer.ybase+this._activeBuffer.y,e,1),this._activeBuffer.lines.set(this._activeBuffer.ybase+this._activeBuffer.y,this._activeBuffer.getBlankLine(this._eraseAttrData())),this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom)}else this._activeBuffer.y--,this._restrictCursor();return!0}fullReset(){return this._parser.reset(),this._onRequestReset.fire(),!0}reset(){this._curAttrData=lt.clone(),this._eraseAttrDataInternal=lt.clone()}_eraseAttrData(){return this._eraseAttrDataInternal.bg&=-67108864,this._eraseAttrDataInternal.bg|=this._curAttrData.bg&67108863,this._eraseAttrDataInternal}setgLevel(e){return this._charsetService.setgLevel(e),!0}screenAlignmentPattern(){let e=new gi;e.content=1<<22|69,e.fg=this._curAttrData.fg,e.bg=this._curAttrData.bg,this._setCursor(0,0);for(let i=0;i<this._bufferService.rows;++i){let n=this._activeBuffer.ybase+this._activeBuffer.y+i,l=this._activeBuffer.lines.get(n);l&&(l.fill(e),l.isWrapped=!1)}return this._dirtyRowTracker.markAllDirty(),this._setCursor(0,0),!0}requestStatusString(e,i){let n=d=>(this._coreService.triggerDataEvent(`${F.ESC}${d}${F.ESC}\\`),!0),l=this._bufferService.buffer,o=this._optionsService.rawOptions;return n(e==='"q'?`P1$r${this._curAttrData.isProtected()?1:0}"q`:e==='"p'?'P1$r61;1"p':e==="r"?`P1$r${l.scrollTop+1};${l.scrollBottom+1}r`:e==="m"?"P1$r0m":e===" q"?`P1$r${{block:2,underline:4,bar:6}[o.cursorStyle]-(o.cursorBlink?1:0)} q`:"P0$r")}markRangeDirty(e,i){this._dirtyRowTracker.markRangeDirty(e,i)}},ju=class{constructor(e){this._bufferService=e,this.clearRange()}clearRange(){this.start=this._bufferService.buffer.y,this.end=this._bufferService.buffer.y}markDirty(e){e<this.start?this.start=e:e>this.end&&(this.end=e)}markRangeDirty(e,i){e>i&&(om=e,e=i,i=om),e<this.start&&(this.start=e),i>this.end&&(this.end=i)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};ju=Qe([se(0,zt)],ju);function cm(e){return 0<=e&&e<256}var dw=5e7,hm=12,fw=50,pw=class extends Se{constructor(e){super(),this._action=e,this._writeBuffer=[],this._callbacks=[],this._pendingData=0,this._bufferOffset=0,this._isSyncWriting=!1,this._syncCalls=0,this._didUserInput=!1,this._onWriteParsed=this._register(new Q),this.onWriteParsed=this._onWriteParsed.event}handleUserInput(){this._didUserInput=!0}writeSync(e,i){if(i!==void 0&&this._syncCalls>i){this._syncCalls=0;return}if(this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(void 0),this._syncCalls++,this._isSyncWriting)return;this._isSyncWriting=!0;let n;for(;n=this._writeBuffer.shift();){this._action(n);let l=this._callbacks.shift();l&&l()}this._pendingData=0,this._bufferOffset=2147483647,this._isSyncWriting=!1,this._syncCalls=0}write(e,i){if(this._pendingData>dw)throw new Error("write data discarded, use flow control to avoid losing data");if(!this._writeBuffer.length){if(this._bufferOffset=0,this._didUserInput){this._didUserInput=!1,this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(i),this._innerWrite();return}setTimeout(()=>this._innerWrite())}this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(i)}_innerWrite(e=0,i=!0){let n=e||performance.now();for(;this._writeBuffer.length>this._bufferOffset;){let l=this._writeBuffer[this._bufferOffset],o=this._action(l,i);if(o){let d=_=>performance.now()-n>=hm?setTimeout(()=>this._innerWrite(0,_)):this._innerWrite(n,_);o.catch(_=>(queueMicrotask(()=>{throw _}),Promise.resolve(!1))).then(d);return}let h=this._callbacks[this._bufferOffset];if(h&&h(),this._bufferOffset++,this._pendingData-=l.length,performance.now()-n>=hm)break}this._writeBuffer.length>this._bufferOffset?(this._bufferOffset>fw&&(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()}},Nu=class{constructor(e){this._bufferService=e,this._nextId=1,this._entriesWithId=new Map,this._dataByLinkId=new Map}registerLink(e){let i=this._bufferService.buffer;if(e.id===void 0){let _=i.addMarker(i.ybase+i.y),p={data:e,id:this._nextId++,lines:[_]};return _.onDispose(()=>this._removeMarkerFromLink(p,_)),this._dataByLinkId.set(p.id,p),p.id}let n=e,l=this._getEntryIdKey(n),o=this._entriesWithId.get(l);if(o)return this.addLineToLink(o.id,i.ybase+i.y),o.id;let h=i.addMarker(i.ybase+i.y),d={id:this._nextId++,key:this._getEntryIdKey(n),data:n,lines:[h]};return h.onDispose(()=>this._removeMarkerFromLink(d,h)),this._entriesWithId.set(d.key,d),this._dataByLinkId.set(d.id,d),d.id}addLineToLink(e,i){let n=this._dataByLinkId.get(e);if(n&&n.lines.every(l=>l.line!==i)){let l=this._bufferService.buffer.addMarker(i);n.lines.push(l),l.onDispose(()=>this._removeMarkerFromLink(n,l))}}getLinkData(e){return this._dataByLinkId.get(e)?.data}_getEntryIdKey(e){return`${e.id};;${e.uri}`}_removeMarkerFromLink(e,i){let n=e.lines.indexOf(i);n!==-1&&(e.lines.splice(n,1),e.lines.length===0&&(e.data.id!==void 0&&this._entriesWithId.delete(e.key),this._dataByLinkId.delete(e.id)))}};Nu=Qe([se(0,zt)],Nu);var um=!1,_w=class extends Se{constructor(e){super(),this._windowsWrappingHeuristics=this._register(new Jr),this._onBinary=this._register(new Q),this.onBinary=this._onBinary.event,this._onData=this._register(new Q),this.onData=this._onData.event,this._onLineFeed=this._register(new Q),this.onLineFeed=this._onLineFeed.event,this._onResize=this._register(new Q),this.onResize=this._onResize.event,this._onWriteParsed=this._register(new Q),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this._register(new Q),this._instantiationService=new U1,this.optionsService=this._register(new X1(e)),this._instantiationService.setService(At,this.optionsService),this._bufferService=this._register(this._instantiationService.createInstance(zu)),this._instantiationService.setService(zt,this._bufferService),this._logService=this._register(this._instantiationService.createInstance(Mu)),this._instantiationService.setService(Km,this._logService),this.coreService=this._register(this._instantiationService.createInstance(Au)),this._instantiationService.setService(hr,this.coreService),this.coreMouseService=this._register(this._instantiationService.createInstance(Ou)),this._instantiationService.setService($m,this.coreMouseService),this.unicodeService=this._register(this._instantiationService.createInstance(nr)),this._instantiationService.setService(Lb,this.unicodeService),this._charsetService=this._instantiationService.createInstance(ew),this._instantiationService.setService(Ob,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(Nu),this._instantiationService.setService(Ym,this._oscLinkService),this._inputHandler=this._register(new uw(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService)),this._register(kt.forward(this._inputHandler.onLineFeed,this._onLineFeed)),this._register(this._inputHandler),this._register(kt.forward(this._bufferService.onResize,this._onResize)),this._register(kt.forward(this.coreService.onData,this._onData)),this._register(kt.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 pw((i,n)=>this._inputHandler.parse(i,n))),this._register(kt.forward(this._writeBuffer.onWriteParsed,this._onWriteParsed))}get onScroll(){return this._onScrollApi||(this._onScrollApi=this._register(new Q),this._onScroll.event(e=>{this._onScrollApi?.fire(e.position)})),this._onScrollApi.event}get cols(){return this._bufferService.cols}get rows(){return this._bufferService.rows}get buffers(){return this._bufferService.buffers}get options(){return this.optionsService.options}set options(e){for(let i in e)this.optionsService.options[i]=e[i]}write(e,i){this._writeBuffer.write(e,i)}writeSync(e,i){this._logService.logLevel<=3&&!um&&(this._logService.warn("writeSync is unreliable and will be removed soon."),um=!0),this._writeBuffer.writeSync(e,i)}input(e,i=!0){this.coreService.triggerDataEvent(e,i)}resize(e,i){isNaN(e)||isNaN(i)||(e=Math.max(e,Cv),i=Math.max(i,kv),this._bufferService.resize(e,i))}scroll(e,i=!1){this._bufferService.scroll(e,i)}scrollLines(e,i){this._bufferService.scrollLines(e,i)}scrollPages(e){this.scrollLines(e*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(e){this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(e){let i=e-this._bufferService.buffer.ydisp;i!==0&&this.scrollLines(i)}registerEscHandler(e,i){return this._inputHandler.registerEscHandler(e,i)}registerDcsHandler(e,i){return this._inputHandler.registerDcsHandler(e,i)}registerCsiHandler(e,i){return this._inputHandler.registerCsiHandler(e,i)}registerOscHandler(e,i){return this._inputHandler.registerOscHandler(e,i)}_setup(){this._handleWindowsPtyOptionChange()}reset(){this._inputHandler.reset(),this._bufferService.reset(),this._charsetService.reset(),this.coreService.reset(),this.coreMouseService.reset()}_handleWindowsPtyOptionChange(){let e=!1,i=this.optionsService.rawOptions.windowsPty;i&&i.buildNumber!==void 0&&i.buildNumber!==void 0?e=i.backend==="conpty"&&i.buildNumber<21376:this.optionsService.rawOptions.windowsMode&&(e=!0),e?this._enableWindowsWrappingHeuristics():this._windowsWrappingHeuristics.clear()}_enableWindowsWrappingHeuristics(){if(!this._windowsWrappingHeuristics.value){let e=[];e.push(this.onLineFeed(im.bind(null,this._bufferService))),e.push(this.registerCsiHandler({final:"H"},()=>(im(this._bufferService),!1))),this._windowsWrappingHeuristics.value=Ke(()=>{for(let i of e)i.dispose()})}}},gw={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 mw(e,i,n,l){let o={type:0,cancel:!1,key:void 0},h=(e.shiftKey?1:0)|(e.altKey?2:0)|(e.ctrlKey?4:0)|(e.metaKey?8:0);switch(e.keyCode){case 0:e.key==="UIKeyInputUpArrow"?i?o.key=F.ESC+"OA":o.key=F.ESC+"[A":e.key==="UIKeyInputLeftArrow"?i?o.key=F.ESC+"OD":o.key=F.ESC+"[D":e.key==="UIKeyInputRightArrow"?i?o.key=F.ESC+"OC":o.key=F.ESC+"[C":e.key==="UIKeyInputDownArrow"&&(i?o.key=F.ESC+"OB":o.key=F.ESC+"[B");break;case 8:o.key=e.ctrlKey?"\b":F.DEL,e.altKey&&(o.key=F.ESC+o.key);break;case 9:if(e.shiftKey){o.key=F.ESC+"[Z";break}o.key=F.HT,o.cancel=!0;break;case 13:o.key=e.altKey?F.ESC+F.CR:F.CR,o.cancel=!0;break;case 27:o.key=F.ESC,e.altKey&&(o.key=F.ESC+F.ESC),o.cancel=!0;break;case 37:if(e.metaKey)break;h?o.key=F.ESC+"[1;"+(h+1)+"D":i?o.key=F.ESC+"OD":o.key=F.ESC+"[D";break;case 39:if(e.metaKey)break;h?o.key=F.ESC+"[1;"+(h+1)+"C":i?o.key=F.ESC+"OC":o.key=F.ESC+"[C";break;case 38:if(e.metaKey)break;h?o.key=F.ESC+"[1;"+(h+1)+"A":i?o.key=F.ESC+"OA":o.key=F.ESC+"[A";break;case 40:if(e.metaKey)break;h?o.key=F.ESC+"[1;"+(h+1)+"B":i?o.key=F.ESC+"OB":o.key=F.ESC+"[B";break;case 45:!e.shiftKey&&!e.ctrlKey&&(o.key=F.ESC+"[2~");break;case 46:h?o.key=F.ESC+"[3;"+(h+1)+"~":o.key=F.ESC+"[3~";break;case 36:h?o.key=F.ESC+"[1;"+(h+1)+"H":i?o.key=F.ESC+"OH":o.key=F.ESC+"[H";break;case 35:h?o.key=F.ESC+"[1;"+(h+1)+"F":i?o.key=F.ESC+"OF":o.key=F.ESC+"[F";break;case 33:e.shiftKey?o.type=2:e.ctrlKey?o.key=F.ESC+"[5;"+(h+1)+"~":o.key=F.ESC+"[5~";break;case 34:e.shiftKey?o.type=3:e.ctrlKey?o.key=F.ESC+"[6;"+(h+1)+"~":o.key=F.ESC+"[6~";break;case 112:h?o.key=F.ESC+"[1;"+(h+1)+"P":o.key=F.ESC+"OP";break;case 113:h?o.key=F.ESC+"[1;"+(h+1)+"Q":o.key=F.ESC+"OQ";break;case 114:h?o.key=F.ESC+"[1;"+(h+1)+"R":o.key=F.ESC+"OR";break;case 115:h?o.key=F.ESC+"[1;"+(h+1)+"S":o.key=F.ESC+"OS";break;case 116:h?o.key=F.ESC+"[15;"+(h+1)+"~":o.key=F.ESC+"[15~";break;case 117:h?o.key=F.ESC+"[17;"+(h+1)+"~":o.key=F.ESC+"[17~";break;case 118:h?o.key=F.ESC+"[18;"+(h+1)+"~":o.key=F.ESC+"[18~";break;case 119:h?o.key=F.ESC+"[19;"+(h+1)+"~":o.key=F.ESC+"[19~";break;case 120:h?o.key=F.ESC+"[20;"+(h+1)+"~":o.key=F.ESC+"[20~";break;case 121:h?o.key=F.ESC+"[21;"+(h+1)+"~":o.key=F.ESC+"[21~";break;case 122:h?o.key=F.ESC+"[23;"+(h+1)+"~":o.key=F.ESC+"[23~";break;case 123:h?o.key=F.ESC+"[24;"+(h+1)+"~":o.key=F.ESC+"[24~";break;default:if(e.ctrlKey&&!e.shiftKey&&!e.altKey&&!e.metaKey)e.keyCode>=65&&e.keyCode<=90?o.key=String.fromCharCode(e.keyCode-64):e.keyCode===32?o.key=F.NUL:e.keyCode>=51&&e.keyCode<=55?o.key=String.fromCharCode(e.keyCode-51+27):e.keyCode===56?o.key=F.DEL:e.keyCode===219?o.key=F.ESC:e.keyCode===220?o.key=F.FS:e.keyCode===221&&(o.key=F.GS);else if((!n||l)&&e.altKey&&!e.metaKey){let d=gw[e.keyCode]?.[e.shiftKey?1:0];if(d)o.key=F.ESC+d;else if(e.keyCode>=65&&e.keyCode<=90){let _=e.ctrlKey?e.keyCode-64:e.keyCode+32,p=String.fromCharCode(_);e.shiftKey&&(p=p.toUpperCase()),o.key=F.ESC+p}else if(e.keyCode===32)o.key=F.ESC+(e.ctrlKey?F.NUL:" ");else if(e.key==="Dead"&&e.code.startsWith("Key")){let _=e.code.slice(3,4);e.shiftKey||(_=_.toLowerCase()),o.key=F.ESC+_,o.cancel=!0}}else n&&!e.altKey&&!e.ctrlKey&&!e.shiftKey&&e.metaKey?e.keyCode===65&&(o.type=1):e.key&&!e.ctrlKey&&!e.altKey&&!e.metaKey&&e.keyCode>=48&&e.key.length===1?o.key=e.key:e.key&&e.ctrlKey&&(e.key==="_"&&(o.key=F.US),e.key==="@"&&(o.key=F.NUL));break}return o}var tt=0,vw=class{constructor(e){this._getKey=e,this._array=[],this._insertedValues=[],this._flushInsertedTask=new so,this._isFlushingInserted=!1,this._deletedIndices=[],this._flushDeletedTask=new so,this._isFlushingDeleted=!1}clear(){this._array.length=0,this._insertedValues.length=0,this._flushInsertedTask.clear(),this._isFlushingInserted=!1,this._deletedIndices.length=0,this._flushDeletedTask.clear(),this._isFlushingDeleted=!1}insert(e){this._flushCleanupDeleted(),this._insertedValues.length===0&&this._flushInsertedTask.enqueue(()=>this._flushInserted()),this._insertedValues.push(e)}_flushInserted(){let e=this._insertedValues.sort((o,h)=>this._getKey(o)-this._getKey(h)),i=0,n=0,l=new Array(this._array.length+this._insertedValues.length);for(let o=0;o<l.length;o++)n>=this._array.length||this._getKey(e[i])<=this._getKey(this._array[n])?(l[o]=e[i],i++):l[o]=this._array[n++];this._array=l,this._insertedValues.length=0}_flushCleanupInserted(){!this._isFlushingInserted&&this._insertedValues.length>0&&this._flushInsertedTask.flush()}delete(e){if(this._flushCleanupInserted(),this._array.length===0)return!1;let i=this._getKey(e);if(i===void 0||(tt=this._search(i),tt===-1)||this._getKey(this._array[tt])!==i)return!1;do if(this._array[tt]===e)return this._deletedIndices.length===0&&this._flushDeletedTask.enqueue(()=>this._flushDeleted()),this._deletedIndices.push(tt),!0;while(++tt<this._array.length&&this._getKey(this._array[tt])===i);return!1}_flushDeleted(){this._isFlushingDeleted=!0;let e=this._deletedIndices.sort((o,h)=>o-h),i=0,n=new Array(this._array.length-e.length),l=0;for(let o=0;o<this._array.length;o++)e[i]===o?i++:n[l++]=this._array[o];this._array=n,this._deletedIndices.length=0,this._isFlushingDeleted=!1}_flushCleanupDeleted(){!this._isFlushingDeleted&&this._deletedIndices.length>0&&this._flushDeletedTask.flush()}*getKeyIterator(e){if(this._flushCleanupInserted(),this._flushCleanupDeleted(),this._array.length!==0&&(tt=this._search(e),!(tt<0||tt>=this._array.length)&&this._getKey(this._array[tt])===e))do yield this._array[tt];while(++tt<this._array.length&&this._getKey(this._array[tt])===e)}forEachByKey(e,i){if(this._flushCleanupInserted(),this._flushCleanupDeleted(),this._array.length!==0&&(tt=this._search(e),!(tt<0||tt>=this._array.length)&&this._getKey(this._array[tt])===e))do i(this._array[tt]);while(++tt<this._array.length&&this._getKey(this._array[tt])===e)}values(){return this._flushCleanupInserted(),this._flushCleanupDeleted(),[...this._array].values()}_search(e){let i=0,n=this._array.length-1;for(;n>=i;){let l=i+n>>1,o=this._getKey(this._array[l]);if(o>e)n=l-1;else if(o<e)i=l+1;else{for(;l>0&&this._getKey(this._array[l-1])===e;)l--;return l}}return i}},eu=0,dm=0,yw=class extends Se{constructor(){super(),this._decorations=new vw(e=>e?.marker.line),this._onDecorationRegistered=this._register(new Q),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this._register(new Q),this.onDecorationRemoved=this._onDecorationRemoved.event,this._register(Ke(()=>this.reset()))}get decorations(){return this._decorations.values()}registerDecoration(e){if(e.marker.isDisposed)return;let i=new Sw(e);if(i){let n=i.marker.onDispose(()=>i.dispose()),l=i.onDispose(()=>{l.dispose(),i&&(this._decorations.delete(i)&&this._onDecorationRemoved.fire(i),n.dispose())});this._decorations.insert(i),this._onDecorationRegistered.fire(i)}return i}reset(){for(let e of this._decorations.values())e.dispose();this._decorations.clear()}*getDecorationsAtCell(e,i,n){let l=0,o=0;for(let h of this._decorations.getKeyIterator(i))l=h.options.x??0,o=l+(h.options.width??1),e>=l&&e<o&&(!n||(h.options.layer??"bottom")===n)&&(yield h)}forEachDecorationAtCell(e,i,n,l){this._decorations.forEachByKey(i,o=>{eu=o.options.x??0,dm=eu+(o.options.width??1),e>=eu&&e<dm&&(!n||(o.options.layer??"bottom")===n)&&l(o)})}},Sw=class extends js{constructor(e){super(),this.options=e,this.onRenderEmitter=this.add(new Q),this.onRender=this.onRenderEmitter.event,this._onDispose=this.add(new Q),this.onDispose=this._onDispose.event,this._cachedBg=null,this._cachedFg=null,this.marker=e.marker,this.options.overviewRulerOptions&&!this.options.overviewRulerOptions.position&&(this.options.overviewRulerOptions.position="full")}get backgroundColorRGB(){return this._cachedBg===null&&(this.options.backgroundColor?this._cachedBg=Ge.toColor(this.options.backgroundColor):this._cachedBg=void 0),this._cachedBg}get foregroundColorRGB(){return this._cachedFg===null&&(this.options.foregroundColor?this._cachedFg=Ge.toColor(this.options.foregroundColor):this._cachedFg=void 0),this._cachedFg}dispose(){this._onDispose.fire(),super.dispose()}},bw=1e3,xw=class{constructor(e,i=bw){this._renderCallback=e,this._debounceThresholdMS=i,this._lastRefreshMs=0,this._additionalRefreshRequested=!1}dispose(){this._refreshTimeoutID&&clearTimeout(this._refreshTimeoutID)}refresh(e,i,n){this._rowCount=n,e=e!==void 0?e:0,i=i!==void 0?i:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,e):e,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,i):i;let l=performance.now();if(l-this._lastRefreshMs>=this._debounceThresholdMS)this._lastRefreshMs=l,this._innerRefresh();else if(!this._additionalRefreshRequested){let o=l-this._lastRefreshMs,h=this._debounceThresholdMS-o;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 e=Math.max(this._rowStart,0),i=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(e,i)}},fm=20,ro=class extends Se{constructor(e,i,n,l){super(),this._terminal=e,this._coreBrowserService=n,this._renderService=l,this._rowColumns=new WeakMap,this._liveRegionLineCount=0,this._charsToConsume=[],this._charsToAnnounce="";let o=this._coreBrowserService.mainDocument;this._accessibilityContainer=o.createElement("div"),this._accessibilityContainer.classList.add("xterm-accessibility"),this._rowContainer=o.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=o.createElement("div"),this._liveRegion.classList.add("live-region"),this._liveRegion.setAttribute("aria-live","assertive"),this._accessibilityContainer.appendChild(this._liveRegion),this._liveRegionDebouncer=this._register(new xw(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(`
|
|
97
|
-
`))),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(fe(o,"selectionchange",()=>this._handleSelectionChange())),this._register(this._coreBrowserService.onDprChange(()=>this._refreshRowsDimensions())),this._refreshRowsDimensions(),this._refreshRows(),this._register(
|
|
98
|
-
`&&(this._liveRegionLineCount++,this._liveRegionLineCount===fm+1&&(this._liveRegion.textContent+=su.get())))}_clearLiveRegion(){this._liveRegion.textContent="",this._liveRegionLineCount=0}_handleKey(e){this._clearLiveRegion(),new RegExp("\\p{Control}","u").test(e)||this._charsToConsume.push(e)}_refreshRows(e,i){this._liveRegionDebouncer.refresh(e,i,this._terminal.rows)}_renderRows(e,i){let n=this._terminal.buffer,l=n.lines.length.toString();for(let o=e;o<=i;o++){let h=n.lines.get(n.ydisp+o),d=[],_=h?.translateToString(!0,void 0,void 0,d)||"",p=(n.ydisp+o+1).toString(),f=this._rowElements[o];f&&(_.length===0?(f.textContent=" ",this._rowColumns.set(f,[0,1])):(f.textContent=_,this._rowColumns.set(f,d)),f.setAttribute("aria-posinset",p),f.setAttribute("aria-setsize",l),this._alignRowWidth(f))}this._announceCharacters()}_announceCharacters(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce="")}_handleBoundaryFocus(e,i){let n=e.target,l=this._rowElements[i===0?1:this._rowElements.length-2],o=n.getAttribute("aria-posinset"),h=i===0?"1":`${this._terminal.buffer.lines.length}`;if(o===h||e.relatedTarget!==l)return;let d,_;if(i===0?(d=n,_=this._rowElements.pop(),this._rowContainer.removeChild(_)):(d=this._rowElements.shift(),_=n,this._rowContainer.removeChild(d)),d.removeEventListener("focus",this._topBoundaryFocusListener),_.removeEventListener("focus",this._bottomBoundaryFocusListener),i===0){let p=this._createAccessibilityTreeNode();this._rowElements.unshift(p),this._rowContainer.insertAdjacentElement("afterbegin",p)}else{let p=this._createAccessibilityTreeNode();this._rowElements.push(p),this._rowContainer.appendChild(p)}this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._terminal.scrollLines(i===0?-1:1),this._rowElements[i===0?1:this._rowElements.length-2].focus(),e.preventDefault(),e.stopImmediatePropagation()}_handleSelectionChange(){if(this._rowElements.length===0)return;let e=this._coreBrowserService.mainDocument.getSelection();if(!e)return;if(e.isCollapsed){this._rowContainer.contains(e.anchorNode)&&this._terminal.clearSelection();return}if(!e.anchorNode||!e.focusNode){console.error("anchorNode and/or focusNode are null");return}let i={node:e.anchorNode,offset:e.anchorOffset},n={node:e.focusNode,offset:e.focusOffset};if((i.node.compareDocumentPosition(n.node)&Node.DOCUMENT_POSITION_PRECEDING||i.node===n.node&&i.offset>n.offset)&&([i,n]=[n,i]),i.node.compareDocumentPosition(this._rowElements[0])&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_FOLLOWING)&&(i={node:this._rowElements[0].childNodes[0],offset:0}),!this._rowContainer.contains(i.node))return;let l=this._rowElements.slice(-1)[0];if(n.node.compareDocumentPosition(l)&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_PRECEDING)&&(n={node:l,offset:l.textContent?.length??0}),!this._rowContainer.contains(n.node))return;let o=({node:_,offset:p})=>{let f=_ instanceof Text?_.parentNode:_,S=parseInt(f?.getAttribute("aria-posinset"),10)-1;if(isNaN(S))return console.warn("row is invalid. Race condition?"),null;let y=this._rowColumns.get(f);if(!y)return console.warn("columns is null. Race condition?"),null;let x=p<y.length?y[p]:y.slice(-1)[0]+1;return x>=this._terminal.cols&&(++S,x=0),{row:S,column:x}},h=o(i),d=o(n);if(!(!h||!d)){if(h.row>d.row||h.row===d.row&&h.column>=d.column)throw new Error("invalid range");this._terminal.select(h.column,h.row,(d.row-h.row)*this._terminal.cols-h.column+d.column)}}_handleResize(e){this._rowElements[this._rowElements.length-1].removeEventListener("focus",this._bottomBoundaryFocusListener);for(let i=this._rowContainer.children.length;i<this._terminal.rows;i++)this._rowElements[i]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[i]);for(;this._rowElements.length>e;)this._rowContainer.removeChild(this._rowElements.pop());this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions()}_createAccessibilityTreeNode(){let e=this._coreBrowserService.mainDocument.createElement("div");return e.setAttribute("role","listitem"),e.tabIndex=-1,this._refreshRowDimensions(e),e}_refreshRowsDimensions(){if(this._renderService.dimensions.css.cell.height){Object.assign(this._accessibilityContainer.style,{width:`${this._renderService.dimensions.css.canvas.width}px`,fontSize:`${this._terminal.options.fontSize}px`}),this._rowElements.length!==this._terminal.rows&&this._handleResize(this._terminal.rows);for(let e=0;e<this._terminal.rows;e++)this._refreshRowDimensions(this._rowElements[e]),this._alignRowWidth(this._rowElements[e])}}_refreshRowDimensions(e){e.style.height=`${this._renderService.dimensions.css.cell.height}px`}_alignRowWidth(e){e.style.transform="";let i=e.getBoundingClientRect().width,n=this._rowColumns.get(e)?.slice(-1)?.[0];if(!n)return;let l=n*this._renderService.dimensions.css.cell.width;e.style.transform=`scaleX(${l/i})`}};ro=Qe([se(1,Iu),se(2,rs),se(3,ns)],ro);var Hu=class extends Se{constructor(e,i,n,l,o){super(),this._element=e,this._mouseService=i,this._renderService=n,this._bufferService=l,this._linkProviderService=o,this._linkCacheDisposables=[],this._isMouseOut=!0,this._wasResized=!1,this._activeLine=-1,this._onShowLinkUnderline=this._register(new Q),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this._register(new Q),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this._register(Ke(()=>{ar(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(fe(this._element,"mouseleave",()=>{this._isMouseOut=!0,this._clearCurrentLink()})),this._register(fe(this._element,"mousemove",this._handleMouseMove.bind(this))),this._register(fe(this._element,"mousedown",this._handleMouseDown.bind(this))),this._register(fe(this._element,"mouseup",this._handleMouseUp.bind(this)))}get currentLink(){return this._currentLink}_handleMouseMove(e){this._lastMouseEvent=e;let i=this._positionFromMouseEvent(e,this._element,this._mouseService);if(!i)return;this._isMouseOut=!1;let n=e.composedPath();for(let l=0;l<n.length;l++){let o=n[l];if(o.classList.contains("xterm"))break;if(o.classList.contains("xterm-hover"))return}(!this._lastBufferCell||i.x!==this._lastBufferCell.x||i.y!==this._lastBufferCell.y)&&(this._handleHover(i),this._lastBufferCell=i)}_handleHover(e){if(this._activeLine!==e.y||this._wasResized){this._clearCurrentLink(),this._askForLink(e,!1),this._wasResized=!1;return}this._currentLink&&this._linkAtPosition(this._currentLink.link,e)||(this._clearCurrentLink(),this._askForLink(e,!0))}_askForLink(e,i){(!this._activeProviderReplies||!i)&&(this._activeProviderReplies?.forEach(l=>{l?.forEach(o=>{o.link.dispose&&o.link.dispose()})}),this._activeProviderReplies=new Map,this._activeLine=e.y);let n=!1;for(let[l,o]of this._linkProviderService.linkProviders.entries())i?this._activeProviderReplies?.get(l)&&(n=this._checkLinkProviderResult(l,e,n)):o.provideLinks(e.y,h=>{if(this._isMouseOut)return;let d=h?.map(_=>({link:_}));this._activeProviderReplies?.set(l,d),n=this._checkLinkProviderResult(l,e,n),this._activeProviderReplies?.size===this._linkProviderService.linkProviders.length&&this._removeIntersectingLinks(e.y,this._activeProviderReplies)})}_removeIntersectingLinks(e,i){let n=new Set;for(let l=0;l<i.size;l++){let o=i.get(l);if(o)for(let h=0;h<o.length;h++){let d=o[h],_=d.link.range.start.y<e?0:d.link.range.start.x,p=d.link.range.end.y>e?this._bufferService.cols:d.link.range.end.x;for(let f=_;f<=p;f++){if(n.has(f)){o.splice(h--,1);break}n.add(f)}}}}_checkLinkProviderResult(e,i,n){if(!this._activeProviderReplies)return n;let l=this._activeProviderReplies.get(e),o=!1;for(let h=0;h<e;h++)(!this._activeProviderReplies.has(h)||this._activeProviderReplies.get(h))&&(o=!0);if(!o&&l){let h=l.find(d=>this._linkAtPosition(d.link,i));h&&(n=!0,this._handleNewLink(h))}if(this._activeProviderReplies.size===this._linkProviderService.linkProviders.length&&!n)for(let h=0;h<this._activeProviderReplies.size;h++){let d=this._activeProviderReplies.get(h)?.find(_=>this._linkAtPosition(_.link,i));if(d){n=!0,this._handleNewLink(d);break}}return n}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(e){if(!this._currentLink)return;let i=this._positionFromMouseEvent(e,this._element,this._mouseService);i&&this._mouseDownLink&&ww(this._mouseDownLink.link,this._currentLink.link)&&this._linkAtPosition(this._currentLink.link,i)&&this._currentLink.link.activate(e,this._currentLink.link.text)}_clearCurrentLink(e,i){!this._currentLink||!this._lastMouseEvent||(!e||!i||this._currentLink.link.range.start.y>=e&&this._currentLink.link.range.end.y<=i)&&(this._linkLeave(this._element,this._currentLink.link,this._lastMouseEvent),this._currentLink=void 0,ar(this._linkCacheDisposables),this._linkCacheDisposables.length=0)}_handleNewLink(e){if(!this._lastMouseEvent)return;let i=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);i&&this._linkAtPosition(e.link,i)&&(this._currentLink=e,this._currentLink.state={decorations:{underline:e.link.decorations===void 0?!0:e.link.decorations.underline,pointerCursor:e.link.decorations===void 0?!0:e.link.decorations.pointerCursor},isHovered:!0},this._linkHover(this._element,e.link,this._lastMouseEvent),e.link.decorations={},Object.defineProperties(e.link.decorations,{pointerCursor:{get:()=>this._currentLink?.state?.decorations.pointerCursor,set:n=>{this._currentLink?.state&&this._currentLink.state.decorations.pointerCursor!==n&&(this._currentLink.state.decorations.pointerCursor=n,this._currentLink.state.isHovered&&this._element.classList.toggle("xterm-cursor-pointer",n))}},underline:{get:()=>this._currentLink?.state?.decorations.underline,set:n=>{this._currentLink?.state&&this._currentLink?.state?.decorations.underline!==n&&(this._currentLink.state.decorations.underline=n,this._currentLink.state.isHovered&&this._fireUnderlineEvent(e.link,n))}}}),this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange(n=>{if(!this._currentLink)return;let l=n.start===0?0:n.start+1+this._bufferService.buffer.ydisp,o=this._bufferService.buffer.ydisp+1+n.end;if(this._currentLink.link.range.start.y>=l&&this._currentLink.link.range.end.y<=o&&(this._clearCurrentLink(l,o),this._lastMouseEvent)){let h=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);h&&this._askForLink(h,!1)}})))}_linkHover(e,i,n){this._currentLink?.state&&(this._currentLink.state.isHovered=!0,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(i,!0),this._currentLink.state.decorations.pointerCursor&&e.classList.add("xterm-cursor-pointer")),i.hover&&i.hover(n,i.text)}_fireUnderlineEvent(e,i){let n=e.range,l=this._bufferService.buffer.ydisp,o=this._createLinkUnderlineEvent(n.start.x-1,n.start.y-l-1,n.end.x,n.end.y-l-1,void 0);(i?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(o)}_linkLeave(e,i,n){this._currentLink?.state&&(this._currentLink.state.isHovered=!1,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(i,!1),this._currentLink.state.decorations.pointerCursor&&e.classList.remove("xterm-cursor-pointer")),i.leave&&i.leave(n,i.text)}_linkAtPosition(e,i){let n=e.range.start.y*this._bufferService.cols+e.range.start.x,l=e.range.end.y*this._bufferService.cols+e.range.end.x,o=i.y*this._bufferService.cols+i.x;return n<=o&&o<=l}_positionFromMouseEvent(e,i,n){let l=n.getCoords(e,i,this._bufferService.cols,this._bufferService.rows);if(l)return{x:l[0],y:l[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(e,i,n,l,o){return{x1:e,y1:i,x2:n,y2:l,cols:this._bufferService.cols,fg:o}}};Hu=Qe([se(1,$u),se(2,ns),se(3,zt),se(4,Gm)],Hu);function ww(e,i){return e.text===i.text&&e.range.start.x===i.range.start.x&&e.range.start.y===i.range.start.y&&e.range.end.x===i.range.end.x&&e.range.end.y===i.range.end.y}var Cw=class extends _w{constructor(e={}){super(e),this._linkifier=this._register(new Jr),this.browser=fv,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this._register(new Jr),this._onCursorMove=this._register(new Q),this.onCursorMove=this._onCursorMove.event,this._onKey=this._register(new Q),this.onKey=this._onKey.event,this._onRender=this._register(new Q),this.onRender=this._onRender.event,this._onSelectionChange=this._register(new Q),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this._register(new Q),this.onTitleChange=this._onTitleChange.event,this._onBell=this._register(new Q),this.onBell=this._onBell.event,this._onFocus=this._register(new Q),this._onBlur=this._register(new Q),this._onA11yCharEmitter=this._register(new Q),this._onA11yTabEmitter=this._register(new Q),this._onWillOpen=this._register(new Q),this._setup(),this._decorationService=this._instantiationService.createInstance(yw),this._instantiationService.setService(vl,this._decorationService),this._linkProviderService=this._instantiationService.createInstance(f1),this._instantiationService.setService(Gm,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(nu)),this._register(this._inputHandler.onRequestBell(()=>this._onBell.fire())),this._register(this._inputHandler.onRequestRefreshRows(i=>this.refresh(i?.start??0,i?.end??this.rows-1))),this._register(this._inputHandler.onRequestSendFocus(()=>this._reportFocus())),this._register(this._inputHandler.onRequestReset(()=>this.reset())),this._register(this._inputHandler.onRequestWindowsOptionsReport(i=>this._reportWindowsOptions(i))),this._register(this._inputHandler.onColor(i=>this._handleColorEvent(i))),this._register(kt.forward(this._inputHandler.onCursorMove,this._onCursorMove)),this._register(kt.forward(this._inputHandler.onTitleChange,this._onTitleChange)),this._register(kt.forward(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this._register(kt.forward(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this._register(this._bufferService.onResize(i=>this._afterResize(i.cols,i.rows))),this._register(Ke(()=>{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(e){if(this._themeService)for(let i of e){let n,l="";switch(i.index){case 256:n="foreground",l="10";break;case 257:n="background",l="11";break;case 258:n="cursor",l="12";break;default:n="ansi",l="4;"+i.index}switch(i.type){case 0:let o=Ie.toColorRGB(n==="ansi"?this._themeService.colors.ansi[i.index]:this._themeService.colors[n]);this.coreService.triggerDataEvent(`${F.ESC}]${l};${cw(o)}${uv.ST}`);break;case 1:if(n==="ansi")this._themeService.modifyColors(h=>h.ansi[i.index]=at.toColor(...i.color));else{let h=n;this._themeService.modifyColors(d=>d[h]=at.toColor(...i.color))}break;case 2:this._themeService.restoreColor(i.index);break}}}_setup(){super._setup(),this._customKeyEventHandler=void 0}get buffer(){return this.buffers.active}focus(){this.textarea&&this.textarea.focus({preventScroll:!0})}_handleScreenReaderModeOptionChange(e){e?!this._accessibilityManager.value&&this._renderService&&(this._accessibilityManager.value=this._instantiationService.createInstance(ro,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(e){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(F.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(F.ESC+"[O"),this.element.classList.remove("focus"),this._onBlur.fire()}_syncTextArea(){if(!this.textarea||!this.buffer.isCursorInViewport||this._compositionHelper.isComposing||!this._renderService)return;let e=this.buffer.ybase+this.buffer.y,i=this.buffer.lines.get(e);if(!i)return;let n=Math.min(this.buffer.x,this.cols-1),l=this._renderService.dimensions.css.cell.height,o=i.getWidth(n),h=this._renderService.dimensions.css.cell.width*o,d=this.buffer.y*this._renderService.dimensions.css.cell.height,_=n*this._renderService.dimensions.css.cell.width;this.textarea.style.left=_+"px",this.textarea.style.top=d+"px",this.textarea.style.width=h+"px",this.textarea.style.height=l+"px",this.textarea.style.lineHeight=l+"px",this.textarea.style.zIndex="-5"}_initGlobal(){this._bindKeys(),this._register(fe(this.element,"copy",i=>{this.hasSelection()&&Rb(i,this._selectionService)}));let e=i=>Db(i,this.textarea,this.coreService,this.optionsService);this._register(fe(this.textarea,"paste",e)),this._register(fe(this.element,"paste",e)),pv?this._register(fe(this.element,"mousedown",i=>{i.button===2&&wg(i,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})):this._register(fe(this.element,"contextmenu",i=>{wg(i,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})),Qu&&this._register(fe(this.element,"auxclick",i=>{i.button===1&&Um(i,this.textarea,this.screenElement)}))}_bindKeys(){this._register(fe(this.textarea,"keyup",e=>this._keyUp(e),!0)),this._register(fe(this.textarea,"keydown",e=>this._keyDown(e),!0)),this._register(fe(this.textarea,"keypress",e=>this._keyPress(e),!0)),this._register(fe(this.textarea,"compositionstart",()=>this._compositionHelper.compositionstart())),this._register(fe(this.textarea,"compositionupdate",e=>this._compositionHelper.compositionupdate(e))),this._register(fe(this.textarea,"compositionend",()=>this._compositionHelper.compositionend())),this._register(fe(this.textarea,"input",e=>this._inputEvent(e),!0)),this._register(this.onRender(()=>this._compositionHelper.updateCompositionElements()))}open(e){if(!e)throw new Error("Terminal requires a parent element.");if(e.isConnected||this._logService.debug("Terminal.open was called on an element that was not attached to the DOM"),this.element?.ownerDocument.defaultView&&this._coreBrowserService){this.element.ownerDocument.defaultView!==this._coreBrowserService.window&&(this._coreBrowserService.window=this.element.ownerDocument.defaultView);return}this._document=e.ownerDocument,this.options.documentOverride&&this.options.documentOverride instanceof Document&&(this._document=this.optionsService.rawOptions.documentOverride),this.element=this._document.createElement("div"),this.element.dir="ltr",this.element.classList.add("terminal"),this.element.classList.add("xterm"),e.appendChild(this.element);let i=this._document.createDocumentFragment();this._viewportElement=this._document.createElement("div"),this._viewportElement.classList.add("xterm-viewport"),i.appendChild(this._viewportElement),this.screenElement=this._document.createElement("div"),this.screenElement.classList.add("xterm-screen"),this._register(fe(this.screenElement,"mousemove",o=>this.updateCursorStyle(o))),this._helperContainer=this._document.createElement("div"),this._helperContainer.classList.add("xterm-helpers"),this.screenElement.appendChild(this._helperContainer),i.appendChild(this.screenElement);let n=this.textarea=this._document.createElement("textarea");this.textarea.classList.add("xterm-helper-textarea"),this.textarea.setAttribute("aria-label",iu.get()),mv||this.textarea.setAttribute("aria-multiline","false"),this.textarea.setAttribute("autocorrect","off"),this.textarea.setAttribute("autocapitalize","off"),this.textarea.setAttribute("spellcheck","false"),this.textarea.tabIndex=0,this._register(this.optionsService.onSpecificOptionChange("disableStdin",()=>n.readOnly=this.optionsService.rawOptions.disableStdin)),this.textarea.readOnly=this.optionsService.rawOptions.disableStdin,this._coreBrowserService=this._register(this._instantiationService.createInstance(u1,this.textarea,e.ownerDocument.defaultView??window,this._document??typeof window<"u"?window.document:null)),this._instantiationService.setService(rs,this._coreBrowserService),this._register(fe(this.textarea,"focus",o=>this._handleTextAreaFocus(o))),this._register(fe(this.textarea,"blur",()=>this._handleTextAreaBlur())),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(Eu,this._document,this._helperContainer),this._instantiationService.setService(ho,this._charSizeService),this._themeService=this._instantiationService.createInstance(Bu),this._instantiationService.setService(tn,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(to),this._instantiationService.setService(Fm,this._characterJoinerService),this._renderService=this._register(this._instantiationService.createInstance(Ru,this.rows,this.screenElement)),this._instantiationService.setService(ns,this._renderService),this._register(this._renderService.onRenderedViewportChange(o=>this._onRender.fire(o))),this.onResize(o=>this._renderService.resize(o.cols,o.rows)),this._compositionView=this._document.createElement("div"),this._compositionView.classList.add("composition-view"),this._compositionHelper=this._instantiationService.createInstance(wu,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseService=this._instantiationService.createInstance(Tu),this._instantiationService.setService($u,this._mouseService);let l=this._linkifier.value=this._register(this._instantiationService.createInstance(Hu,this.screenElement));this.element.appendChild(i);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(bu,this.element,this.screenElement)),this._register(this._viewport.onRequestScrollLines(o=>{super.scrollLines(o,!1),this.refresh(0,this.rows-1)})),this._selectionService=this._register(this._instantiationService.createInstance(Du,this.element,this.screenElement,l)),this._instantiationService.setService(Nb,this._selectionService),this._register(this._selectionService.onRequestScrollLines(o=>this.scrollLines(o.amount,o.suppressScrollEvent))),this._register(this._selectionService.onSelectionChange(()=>this._onSelectionChange.fire())),this._register(this._selectionService.onRequestRedraw(o=>this._renderService.handleSelectionChanged(o.start,o.end,o.columnSelectMode))),this._register(this._selectionService.onLinuxMouseSelection(o=>{this.textarea.value=o,this.textarea.focus(),this.textarea.select()})),this._register(kt.any(this._onScroll.event,this._inputHandler.onScroll)(()=>{this._selectionService.refresh(),this._viewport?.queueSync()})),this._register(this._instantiationService.createInstance(xu,this.screenElement)),this._register(fe(this.element,"mousedown",o=>this._selectionService.handleMouseDown(o))),this.coreMouseService.areMouseEventsActive?(this._selectionService.disable(),this.element.classList.add("enable-mouse-events")):this._selectionService.enable(),this.options.screenReaderMode&&(this._accessibilityManager.value=this._instantiationService.createInstance(ro,this)),this._register(this.optionsService.onSpecificOptionChange("screenReaderMode",o=>this._handleScreenReaderModeOptionChange(o))),this.options.overviewRuler.width&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(eo,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange("overviewRuler",o=>{!this._overviewRulerRenderer&&o&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(eo,this._viewportElement,this.screenElement)))}),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()}_createRenderer(){return this._instantiationService.createInstance(ku,this,this._document,this.element,this.screenElement,this._viewportElement,this._helperContainer,this.linkifier)}bindMouse(){let e=this,i=this.element;function n(h){let d=e._mouseService.getMouseReportCoords(h,e.screenElement);if(!d)return!1;let _,p;switch(h.overrideType||h.type){case"mousemove":p=32,h.buttons===void 0?(_=3,h.button!==void 0&&(_=h.button<3?h.button:3)):_=h.buttons&1?0:h.buttons&4?1:h.buttons&2?2:3;break;case"mouseup":p=0,_=h.button<3?h.button:3;break;case"mousedown":p=1,_=h.button<3?h.button:3;break;case"wheel":if(e._customWheelEventHandler&&e._customWheelEventHandler(h)===!1)return!1;let f=h.deltaY;if(f===0||e.coreMouseService.consumeWheelEvent(h,e._renderService?.dimensions?.device?.cell?.height,e._coreBrowserService?.dpr)===0)return!1;p=f<0?0:1,_=4;break;default:return!1}return p===void 0||_===void 0||_>4?!1:e.coreMouseService.triggerMouseEvent({col:d.col,row:d.row,x:d.x,y:d.y,button:_,action:p,ctrl:h.ctrlKey,alt:h.altKey,shift:h.shiftKey})}let l={mouseup:null,wheel:null,mousedrag:null,mousemove:null},o={mouseup:h=>(n(h),h.buttons||(this._document.removeEventListener("mouseup",l.mouseup),l.mousedrag&&this._document.removeEventListener("mousemove",l.mousedrag)),this.cancel(h)),wheel:h=>(n(h),this.cancel(h,!0)),mousedrag:h=>{h.buttons&&n(h)},mousemove:h=>{h.buttons||n(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?l.mousemove||(i.addEventListener("mousemove",o.mousemove),l.mousemove=o.mousemove):(i.removeEventListener("mousemove",l.mousemove),l.mousemove=null),h&16?l.wheel||(i.addEventListener("wheel",o.wheel,{passive:!1}),l.wheel=o.wheel):(i.removeEventListener("wheel",l.wheel),l.wheel=null),h&2?l.mouseup||(l.mouseup=o.mouseup):(this._document.removeEventListener("mouseup",l.mouseup),l.mouseup=null),h&4?l.mousedrag||(l.mousedrag=o.mousedrag):(this._document.removeEventListener("mousemove",l.mousedrag),l.mousedrag=null)})),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this._register(fe(i,"mousedown",h=>{if(h.preventDefault(),this.focus(),!(!this.coreMouseService.areMouseEventsActive||this._selectionService.shouldForceSelection(h)))return n(h),l.mouseup&&this._document.addEventListener("mouseup",l.mouseup),l.mousedrag&&this._document.addEventListener("mousemove",l.mousedrag),this.cancel(h)})),this._register(fe(i,"wheel",h=>{if(!l.wheel){if(this._customWheelEventHandler&&this._customWheelEventHandler(h)===!1)return!1;if(!this.buffer.hasScrollback){if(h.deltaY===0)return!1;if(e.coreMouseService.consumeWheelEvent(h,e._renderService?.dimensions?.device?.cell?.height,e._coreBrowserService?.dpr)===0)return this.cancel(h,!0);let d=F.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?"O":"[")+(h.deltaY<0?"A":"B");return this.coreService.triggerDataEvent(d,!0),this.cancel(h,!0)}}},{passive:!1}))}refresh(e,i){this._renderService?.refreshRows(e,i)}updateCursorStyle(e){this._selectionService?.shouldColumnSelect(e)?this.element.classList.add("column-select"):this.element.classList.remove("column-select")}_showCursor(){this.coreService.isCursorInitialized||(this.coreService.isCursorInitialized=!0,this.refresh(this.buffer.y,this.buffer.y))}scrollLines(e,i){this._viewport?this._viewport.scrollLines(e):super.scrollLines(e,i),this.refresh(0,this.rows-1)}scrollPages(e){this.scrollLines(e*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(e){e&&this._viewport?this._viewport.scrollToLine(this.buffer.ybase,!0):this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(e){let i=e-this._bufferService.buffer.ydisp;i!==0&&this.scrollLines(i)}paste(e){Hm(e,this.textarea,this.coreService,this.optionsService)}attachCustomKeyEventHandler(e){this._customKeyEventHandler=e}attachCustomWheelEventHandler(e){this._customWheelEventHandler=e}registerLinkProvider(e){return this._linkProviderService.registerLinkProvider(e)}registerCharacterJoiner(e){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");let i=this._characterJoinerService.register(e);return this.refresh(0,this.rows-1),i}deregisterCharacterJoiner(e){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");this._characterJoinerService.deregister(e)&&this.refresh(0,this.rows-1)}get markers(){return this.buffer.markers}registerMarker(e){return this.buffer.addMarker(this.buffer.ybase+this.buffer.y+e)}registerDecoration(e){return this._decorationService.registerDecoration(e)}hasSelection(){return this._selectionService?this._selectionService.hasSelection:!1}select(e,i,n){this._selectionService.setSelection(e,i,n)}getSelection(){return this._selectionService?this._selectionService.selectionText:""}getSelectionPosition(){if(!(!this._selectionService||!this._selectionService.hasSelection))return{start:{x:this._selectionService.selectionStart[0],y:this._selectionService.selectionStart[1]},end:{x:this._selectionService.selectionEnd[0],y:this._selectionService.selectionEnd[1]}}}clearSelection(){this._selectionService?.clearSelection()}selectAll(){this._selectionService?.selectAll()}selectLines(e,i){this._selectionService?.selectLines(e,i)}_keyDown(e){if(this._keyDownHandled=!1,this._keyDownSeen=!0,this._customKeyEventHandler&&this._customKeyEventHandler(e)===!1)return!1;let i=this.browser.isMac&&this.options.macOptionIsMeta&&e.altKey;if(!i&&!this._compositionHelper.keydown(e))return this.options.scrollOnUserInput&&this.buffer.ybase!==this.buffer.ydisp&&this.scrollToBottom(!0),!1;!i&&(e.key==="Dead"||e.key==="AltGraph")&&(this._unprocessedDeadKey=!0);let n=mw(e,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(e),n.type===3||n.type===2){let l=this.rows-1;return this.scrollLines(n.type===2?-l:l),this.cancel(e,!0)}if(n.type===1&&this.selectAll(),this._isThirdLevelShift(this.browser,e)||(n.cancel&&this.cancel(e,!0),!n.key)||e.key&&!e.ctrlKey&&!e.altKey&&!e.metaKey&&e.key.length===1&&e.key.charCodeAt(0)>=65&&e.key.charCodeAt(0)<=90)return!0;if(this._unprocessedDeadKey)return this._unprocessedDeadKey=!1,!0;if((n.key===F.ETX||n.key===F.CR)&&(this.textarea.value=""),this._onKey.fire({key:n.key,domEvent:e}),this._showCursor(),this.coreService.triggerDataEvent(n.key,!0),!this.optionsService.rawOptions.screenReaderMode||e.altKey||e.ctrlKey)return this.cancel(e,!0);this._keyDownHandled=!0}_isThirdLevelShift(e,i){let n=e.isMac&&!this.options.macOptionIsMeta&&i.altKey&&!i.ctrlKey&&!i.metaKey||e.isWindows&&i.altKey&&i.ctrlKey&&!i.metaKey||e.isWindows&&i.getModifierState("AltGraph");return i.type==="keypress"?n:n&&(!i.keyCode||i.keyCode>47)}_keyUp(e){this._keyDownSeen=!1,!(this._customKeyEventHandler&&this._customKeyEventHandler(e)===!1)&&(kw(e)||this.focus(),this.updateCursorStyle(e),this._keyPressHandled=!1)}_keyPress(e){let i;if(this._keyPressHandled=!1,this._keyDownHandled||this._customKeyEventHandler&&this._customKeyEventHandler(e)===!1)return!1;if(this.cancel(e),e.charCode)i=e.charCode;else if(e.which===null||e.which===void 0)i=e.keyCode;else if(e.which!==0&&e.charCode!==0)i=e.which;else return!1;return!i||(e.altKey||e.ctrlKey||e.metaKey)&&!this._isThirdLevelShift(this.browser,e)?!1:(i=String.fromCharCode(i),this._onKey.fire({key:i,domEvent:e}),this._showCursor(),this.coreService.triggerDataEvent(i,!0),this._keyPressHandled=!0,this._unprocessedDeadKey=!1,!0)}_inputEvent(e){if(e.data&&e.inputType==="insertText"&&(!e.composed||!this._keyDownSeen)&&!this.optionsService.rawOptions.screenReaderMode){if(this._keyPressHandled)return!1;this._unprocessedDeadKey=!1;let i=e.data;return this.coreService.triggerDataEvent(i,!0),this.cancel(e),!0}return!1}resize(e,i){if(e===this.cols&&i===this.rows){this._charSizeService&&!this._charSizeService.hasValidSize&&this._charSizeService.measure();return}super.resize(e,i)}_afterResize(e,i){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 e=1;e<this.rows;e++)this.buffer.lines.push(this.buffer.getBlankLine(lt));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 e=this._customKeyEventHandler;this._setup(),super.reset(),this._selectionService?.reset(),this._decorationService.reset(),this._customKeyEventHandler=e,this.refresh(0,this.rows-1)}clearTextureAtlas(){this._renderService?.clearTextureAtlas()}_reportFocus(){this.element?.classList.contains("focus")?this.coreService.triggerDataEvent(F.ESC+"[I"):this.coreService.triggerDataEvent(F.ESC+"[O")}_reportWindowsOptions(e){if(this._renderService)switch(e){case 0:let i=this._renderService.dimensions.css.canvas.width.toFixed(0),n=this._renderService.dimensions.css.canvas.height.toFixed(0);this.coreService.triggerDataEvent(`${F.ESC}[4;${n};${i}t`);break;case 1:let l=this._renderService.dimensions.css.cell.width.toFixed(0),o=this._renderService.dimensions.css.cell.height.toFixed(0);this.coreService.triggerDataEvent(`${F.ESC}[6;${o};${l}t`);break}}cancel(e,i){if(!(!this.options.cancelEvents&&!i))return e.preventDefault(),e.stopPropagation(),!1}};function kw(e){return e.keyCode===16||e.keyCode===17||e.keyCode===18}var Ew=class{constructor(){this._addons=[]}dispose(){for(let e=this._addons.length-1;e>=0;e--)this._addons[e].instance.dispose()}loadAddon(e,i){let n={instance:i,dispose:i.dispose,isDisposed:!1};this._addons.push(n),i.dispose=()=>this._wrappedAddonDispose(n),i.activate(e)}_wrappedAddonDispose(e){if(e.isDisposed)return;let i=-1;for(let n=0;n<this._addons.length;n++)if(this._addons[n]===e){i=n;break}if(i===-1)throw new Error("Could not dispose an addon that has not been loaded");e.isDisposed=!0,e.dispose.apply(e.instance),this._addons.splice(i,1)}},Tw=class{constructor(e){this._line=e}get isWrapped(){return this._line.isWrapped}get length(){return this._line.length}getCell(e,i){if(!(e<0||e>=this._line.length))return i?(this._line.loadCell(e,i),i):this._line.loadCell(e,new gi)}translateToString(e,i,n){return this._line.translateToString(e,i,n)}},pm=class{constructor(e,i){this._buffer=e,this.type=i}init(e){return this._buffer=e,this}get cursorY(){return this._buffer.y}get cursorX(){return this._buffer.x}get viewportY(){return this._buffer.ydisp}get baseY(){return this._buffer.ybase}get length(){return this._buffer.lines.length}getLine(e){let i=this._buffer.lines.get(e);if(i)return new Tw(i)}getNullCell(){return new gi}},Rw=class extends Se{constructor(e){super(),this._core=e,this._onBufferChange=this._register(new Q),this.onBufferChange=this._onBufferChange.event,this._normal=new pm(this._core.buffers.normal,"normal"),this._alternate=new pm(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)}},Dw=class{constructor(e){this._core=e}registerCsiHandler(e,i){return this._core.registerCsiHandler(e,n=>i(n.toArray()))}addCsiHandler(e,i){return this.registerCsiHandler(e,i)}registerDcsHandler(e,i){return this._core.registerDcsHandler(e,(n,l)=>i(n,l.toArray()))}addDcsHandler(e,i){return this.registerDcsHandler(e,i)}registerEscHandler(e,i){return this._core.registerEscHandler(e,i)}addEscHandler(e,i){return this.registerEscHandler(e,i)}registerOscHandler(e,i){return this._core.registerOscHandler(e,i)}addOscHandler(e,i){return this.registerOscHandler(e,i)}},Bw=class{constructor(e){this._core=e}register(e){this._core.unicodeService.register(e)}get versions(){return this._core.unicodeService.versions}get activeVersion(){return this._core.unicodeService.activeVersion}set activeVersion(e){this._core.unicodeService.activeVersion=e}},Mw=["cols","rows"],Bi=0,zw=class extends Se{constructor(e){super(),this._core=this._register(new Cw(e)),this._addonManager=this._register(new Ew),this._publicOptions={...this._core.options};let i=l=>this._core.options[l],n=(l,o)=>{this._checkReadonlyOptions(l),this._core.options[l]=o};for(let l in this._core.options){let o={get:i.bind(this,l),set:n.bind(this,l)};Object.defineProperty(this._publicOptions,l,o)}}_checkReadonlyOptions(e){if(Mw.includes(e))throw new Error(`Option "${e}" can only be set in the constructor`)}_checkProposedApi(){if(!this._core.optionsService.rawOptions.allowProposedApi)throw new Error("You must set the allowProposedApi option to true to use proposed API")}get onBell(){return this._core.onBell}get onBinary(){return this._core.onBinary}get onCursorMove(){return this._core.onCursorMove}get onData(){return this._core.onData}get onKey(){return this._core.onKey}get onLineFeed(){return this._core.onLineFeed}get onRender(){return this._core.onRender}get onResize(){return this._core.onResize}get onScroll(){return this._core.onScroll}get onSelectionChange(){return this._core.onSelectionChange}get onTitleChange(){return this._core.onTitleChange}get onWriteParsed(){return this._core.onWriteParsed}get element(){return this._core.element}get parser(){return this._parser||(this._parser=new Dw(this._core)),this._parser}get unicode(){return this._checkProposedApi(),new Bw(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 Rw(this._core))),this._buffer}get markers(){return this._checkProposedApi(),this._core.markers}get modes(){let e=this._core.coreService.decPrivateModes,i="none";switch(this._core.coreMouseService.activeProtocol){case"X10":i="x10";break;case"VT200":i="vt200";break;case"DRAG":i="drag";break;case"ANY":i="any";break}return{applicationCursorKeysMode:e.applicationCursorKeys,applicationKeypadMode:e.applicationKeypad,bracketedPasteMode:e.bracketedPasteMode,insertMode:this._core.coreService.modes.insertMode,mouseTrackingMode:i,originMode:e.origin,reverseWraparoundMode:e.reverseWraparound,sendFocusMode:e.sendFocus,synchronizedOutputMode:e.synchronizedOutput,wraparoundMode:e.wraparound}}get options(){return this._publicOptions}set options(e){for(let i in e)this._publicOptions[i]=e[i]}blur(){this._core.blur()}focus(){this._core.focus()}input(e,i=!0){this._core.input(e,i)}resize(e,i){this._verifyIntegers(e,i),this._core.resize(e,i)}open(e){this._core.open(e)}attachCustomKeyEventHandler(e){this._core.attachCustomKeyEventHandler(e)}attachCustomWheelEventHandler(e){this._core.attachCustomWheelEventHandler(e)}registerLinkProvider(e){return this._core.registerLinkProvider(e)}registerCharacterJoiner(e){return this._checkProposedApi(),this._core.registerCharacterJoiner(e)}deregisterCharacterJoiner(e){this._checkProposedApi(),this._core.deregisterCharacterJoiner(e)}registerMarker(e=0){return this._verifyIntegers(e),this._core.registerMarker(e)}registerDecoration(e){return this._checkProposedApi(),this._verifyPositiveIntegers(e.x??0,e.width??0,e.height??0),this._core.registerDecoration(e)}hasSelection(){return this._core.hasSelection()}select(e,i,n){this._verifyIntegers(e,i,n),this._core.select(e,i,n)}getSelection(){return this._core.getSelection()}getSelectionPosition(){return this._core.getSelectionPosition()}clearSelection(){this._core.clearSelection()}selectAll(){this._core.selectAll()}selectLines(e,i){this._verifyIntegers(e,i),this._core.selectLines(e,i)}dispose(){super.dispose()}scrollLines(e){this._verifyIntegers(e),this._core.scrollLines(e)}scrollPages(e){this._verifyIntegers(e),this._core.scrollPages(e)}scrollToTop(){this._core.scrollToTop()}scrollToBottom(){this._core.scrollToBottom()}scrollToLine(e){this._verifyIntegers(e),this._core.scrollToLine(e)}clear(){this._core.clear()}write(e,i){this._core.write(e,i)}writeln(e,i){this._core.write(e),this._core.write(`\r
|
|
96
|
+
`)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(e){this._refreshAnimationFrame||(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._refresh())),Qu&&e&&this.selectionText.length&&this._onLinuxMouseSelection.fire(this.selectionText)}_refresh(){this._refreshAnimationFrame=void 0,this._onRedrawRequest.fire({start:this._model.finalSelectionStart,end:this._model.finalSelectionEnd,columnSelectMode:this._activeSelectionMode===3})}_isClickInSelection(e){let i=this._getMouseBufferCoords(e),n=this._model.finalSelectionStart,l=this._model.finalSelectionEnd;return!n||!l||!i?!1:this._areCoordsInSelection(i,n,l)}isCellInSelection(e,i){let n=this._model.finalSelectionStart,l=this._model.finalSelectionEnd;return!n||!l?!1:this._areCoordsInSelection([e,i],n,l)}_areCoordsInSelection(e,i,n){return e[1]>i[1]&&e[1]<n[1]||i[1]===n[1]&&e[1]===i[1]&&e[0]>=i[0]&&e[0]<n[0]||i[1]<n[1]&&e[1]===n[1]&&e[0]<n[0]||i[1]<n[1]&&e[1]===i[1]&&e[0]>=i[0]}_selectWordAtCursor(e,i){let n=this._linkifier.currentLink?.link?.range;if(n)return this._model.selectionStart=[n.start.x-1,n.start.y-1],this._model.selectionStartLength=Yg(n,this._bufferService.cols),this._model.selectionEnd=void 0,!0;let l=this._getMouseBufferCoords(e);return l?(this._selectWordAt(l,i),this._model.selectionEnd=void 0,!0):!1}selectAll(){this._model.isSelectAllActive=!0,this.refresh(),this._onSelectionChange.fire()}selectLines(e,i){this._model.clearSelection(),e=Math.max(e,0),i=Math.min(i,this._bufferService.buffer.lines.length-1),this._model.selectionStart=[0,e],this._model.selectionEnd=[this._bufferService.cols,i],this.refresh(),this._onSelectionChange.fire()}_handleTrim(e){this._model.handleTrim(e)&&this.refresh()}_getMouseBufferCoords(e){let i=this._mouseService.getCoords(e,this._screenElement,this._bufferService.cols,this._bufferService.rows,!0);if(i)return i[0]--,i[1]--,i[1]+=this._bufferService.buffer.ydisp,i}_getMouseEventScrollAmount(e){let i=Zu(this._coreBrowserService.window,e,this._screenElement)[1],n=this._renderService.dimensions.css.canvas.height;return i>=0&&i<=n?0:(i>n&&(i-=n),i=Math.min(Math.max(i,-Gh),Gh),i/=Gh,i/Math.abs(i)+Math.round(i*(z1-1)))}shouldForceSelection(e){return io?e.altKey&&this._optionsService.rawOptions.macOptionClickForcesSelection:e.shiftKey}handleMouseDown(e){if(this._mouseDownTimeStamp=e.timeStamp,!(e.button===2&&this.hasSelection)&&e.button===0){if(!this._enabled){if(!this.shouldForceSelection(e))return;e.stopPropagation()}e.preventDefault(),this._dragScrollAmount=0,this._enabled&&e.shiftKey?this._handleIncrementalClick(e):e.detail===1?this._handleSingleClick(e):e.detail===2?this._handleDoubleClick(e):e.detail===3&&this._handleTripleClick(e),this._addMouseDownListeners(),this.refresh(!0)}}_addMouseDownListeners(){this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.addEventListener("mousemove",this._mouseMoveListener),this._screenElement.ownerDocument.addEventListener("mouseup",this._mouseUpListener)),this._dragScrollIntervalTimer=this._coreBrowserService.window.setInterval(()=>this._dragScroll(),A1)}_removeMouseDownListeners(){this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.removeEventListener("mousemove",this._mouseMoveListener),this._screenElement.ownerDocument.removeEventListener("mouseup",this._mouseUpListener)),this._coreBrowserService.window.clearInterval(this._dragScrollIntervalTimer),this._dragScrollIntervalTimer=void 0}_handleIncrementalClick(e){this._model.selectionStart&&(this._model.selectionEnd=this._getMouseBufferCoords(e))}_handleSingleClick(e){if(this._model.selectionStartLength=0,this._model.isSelectAllActive=!1,this._activeSelectionMode=this.shouldColumnSelect(e)?3:0,this._model.selectionStart=this._getMouseBufferCoords(e),!this._model.selectionStart)return;this._model.selectionEnd=void 0;let i=this._bufferService.buffer.lines.get(this._model.selectionStart[1]);i&&i.length!==this._model.selectionStart[0]&&i.hasWidth(this._model.selectionStart[0])===0&&this._model.selectionStart[0]++}_handleDoubleClick(e){this._selectWordAtCursor(e,!0)&&(this._activeSelectionMode=1)}_handleTripleClick(e){let i=this._getMouseBufferCoords(e);i&&(this._activeSelectionMode=2,this._selectLineAt(i[1]))}shouldColumnSelect(e){return e.altKey&&!(io&&this._optionsService.rawOptions.macOptionClickForcesSelection)}_handleMouseMove(e){if(e.stopImmediatePropagation(),!this._model.selectionStart)return;let i=this._model.selectionEnd?[this._model.selectionEnd[0],this._model.selectionEnd[1]]:null;if(this._model.selectionEnd=this._getMouseBufferCoords(e),!this._model.selectionEnd){this.refresh(!0);return}this._activeSelectionMode===2?this._model.selectionEnd[1]<this._model.selectionStart[1]?this._model.selectionEnd[0]=0:this._model.selectionEnd[0]=this._bufferService.cols:this._activeSelectionMode===1&&this._selectToWordAt(this._model.selectionEnd),this._dragScrollAmount=this._getMouseEventScrollAmount(e),this._activeSelectionMode!==3&&(this._dragScrollAmount>0?this._model.selectionEnd[0]=this._bufferService.cols:this._dragScrollAmount<0&&(this._model.selectionEnd[0]=0));let n=this._bufferService.buffer;if(this._model.selectionEnd[1]<n.lines.length){let l=n.lines.get(this._model.selectionEnd[1]);l&&l.hasWidth(this._model.selectionEnd[0])===0&&this._model.selectionEnd[0]<this._bufferService.cols&&this._model.selectionEnd[0]++}(!i||i[0]!==this._model.selectionEnd[0]||i[1]!==this._model.selectionEnd[1])&&this.refresh(!0)}_dragScroll(){if(!(!this._model.selectionEnd||!this._model.selectionStart)&&this._dragScrollAmount){this._onRequestScrollLines.fire({amount:this._dragScrollAmount,suppressScrollEvent:!1});let e=this._bufferService.buffer;this._dragScrollAmount>0?(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=this._bufferService.cols),this._model.selectionEnd[1]=Math.min(e.ydisp+this._bufferService.rows,e.lines.length-1)):(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=0),this._model.selectionEnd[1]=e.ydisp),this.refresh()}}_handleMouseUp(e){let i=e.timeStamp-this._mouseDownTimeStamp;if(this._removeMouseDownListeners(),this.selectionText.length<=1&&i<O1&&e.altKey&&this._optionsService.rawOptions.altClickMovesCursor){if(this._bufferService.buffer.ybase===this._bufferService.buffer.ydisp){let n=this._mouseService.getCoords(e,this._element,this._bufferService.cols,this._bufferService.rows,!1);if(n&&n[0]!==void 0&&n[1]!==void 0){let l=C1(n[0]-1,n[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(l,!0)}}}else this._fireEventIfSelectionChanged()}_fireEventIfSelectionChanged(){let e=this._model.finalSelectionStart,i=this._model.finalSelectionEnd,n=!!e&&!!i&&(e[0]!==i[0]||e[1]!==i[1]);if(!n){this._oldHasSelection&&this._fireOnSelectionChange(e,i,n);return}!e||!i||(!this._oldSelectionStart||!this._oldSelectionEnd||e[0]!==this._oldSelectionStart[0]||e[1]!==this._oldSelectionStart[1]||i[0]!==this._oldSelectionEnd[0]||i[1]!==this._oldSelectionEnd[1])&&this._fireOnSelectionChange(e,i,n)}_fireOnSelectionChange(e,i,n){this._oldSelectionStart=e,this._oldSelectionEnd=i,this._oldHasSelection=n,this._onSelectionChange.fire()}_handleBufferActivate(e){this.clearSelection(),this._trimListener.dispose(),this._trimListener=e.activeBuffer.lines.onTrim(i=>this._handleTrim(i))}_convertViewportColToCharacterIndex(e,i){let n=i;for(let l=0;i>=l;l++){let o=e.loadCell(l,this._workCell).getChars().length;this._workCell.getWidth()===0?n--:o>1&&i!==l&&(n+=o-1)}return n}setSelection(e,i,n){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[e,i],this._model.selectionStartLength=n,this.refresh(),this._fireEventIfSelectionChanged()}rightClickSelect(e){this._isClickInSelection(e)||(this._selectWordAtCursor(e,!1)&&this.refresh(!0),this._fireEventIfSelectionChanged())}_getWordAt(e,i,n=!0,l=!0){if(e[0]>=this._bufferService.cols)return;let o=this._bufferService.buffer,h=o.lines.get(e[1]);if(!h)return;let d=o.translateBufferLineToString(e[1],!1),_=this._convertViewportColToCharacterIndex(h,e[0]),p=_,f=e[0]-_,S=0,y=0,x=0,C=0;if(d.charAt(_)===" "){for(;_>0&&d.charAt(_-1)===" ";)_--;for(;p<d.length&&d.charAt(p+1)===" ";)p++}else{let M=e[0],A=e[0];h.getWidth(M)===0&&(S++,M--),h.getWidth(A)===2&&(y++,A++);let O=h.getString(A).length;for(O>1&&(C+=O-1,p+=O-1);M>0&&_>0&&!this._isCharWordSeparator(h.loadCell(M-1,this._workCell));){h.loadCell(M-1,this._workCell);let D=this._workCell.getChars().length;this._workCell.getWidth()===0?(S++,M--):D>1&&(x+=D-1,_-=D-1),_--,M--}for(;A<h.length&&p+1<d.length&&!this._isCharWordSeparator(h.loadCell(A+1,this._workCell));){h.loadCell(A+1,this._workCell);let D=this._workCell.getChars().length;this._workCell.getWidth()===2?(y++,A++):D>1&&(C+=D-1,p+=D-1),p++,A++}}p++;let b=_+f-S+x,T=Math.min(this._bufferService.cols,p-_+S+y-x-C);if(!(!i&&d.slice(_,p).trim()==="")){if(n&&b===0&&h.getCodePoint(0)!==32){let M=o.lines.get(e[1]-1);if(M&&h.isWrapped&&M.getCodePoint(this._bufferService.cols-1)!==32){let A=this._getWordAt([this._bufferService.cols-1,e[1]-1],!1,!0,!1);if(A){let O=this._bufferService.cols-A.start;b-=O,T+=O}}}if(l&&b+T===this._bufferService.cols&&h.getCodePoint(this._bufferService.cols-1)!==32){let M=o.lines.get(e[1]+1);if(M?.isWrapped&&M.getCodePoint(0)!==32){let A=this._getWordAt([0,e[1]+1],!1,!1,!0);A&&(T+=A.length)}}return{start:b,length:T}}}_selectWordAt(e,i){let n=this._getWordAt(e,i);if(n){for(;n.start<0;)n.start+=this._bufferService.cols,e[1]--;this._model.selectionStart=[n.start,e[1]],this._model.selectionStartLength=n.length}}_selectToWordAt(e){let i=this._getWordAt(e,!0);if(i){let n=e[1];for(;i.start<0;)i.start+=this._bufferService.cols,n--;if(!this._model.areSelectionValuesReversed())for(;i.start+i.length>this._bufferService.cols;)i.length-=this._bufferService.cols,n++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?i.start:i.start+i.length,n]}}_isCharWordSeparator(e){return e.getWidth()===0?!1:this._optionsService.rawOptions.wordSeparator.indexOf(e.getChars())>=0}_selectLineAt(e){let i=this._bufferService.buffer.getWrappedRangeForLine(e),n={start:{x:0,y:i.first},end:{x:this._bufferService.cols-1,y:i.last}};this._model.selectionStart=[0,i.first],this._model.selectionEnd=void 0,this._model.selectionStartLength=Yg(n,this._bufferService.cols)}};Du=Qe([se(3,zt),se(4,hr),se(5,Yu),se(6,At),se(7,ns),se(8,rs)],Du);var $g=class{constructor(){this._data={}}set(e,i,n){this._data[e]||(this._data[e]={}),this._data[e][i]=n}get(e,i){return this._data[e]?this._data[e][i]:void 0}clear(){this._data={}}},Kg=class{constructor(){this._color=new $g,this._css=new $g}setCss(e,i,n){this._css.set(e,i,n)}getCss(e,i){return this._css.get(e,i)}setColor(e,i,n){this._color.set(e,i,n)}getColor(e,i){return this._color.get(e,i)}clear(){this._color.clear(),this._css.clear()}},ht=Object.freeze((()=>{let e=[Ge.toColor("#2e3436"),Ge.toColor("#cc0000"),Ge.toColor("#4e9a06"),Ge.toColor("#c4a000"),Ge.toColor("#3465a4"),Ge.toColor("#75507b"),Ge.toColor("#06989a"),Ge.toColor("#d3d7cf"),Ge.toColor("#555753"),Ge.toColor("#ef2929"),Ge.toColor("#8ae234"),Ge.toColor("#fce94f"),Ge.toColor("#729fcf"),Ge.toColor("#ad7fa8"),Ge.toColor("#34e2e2"),Ge.toColor("#eeeeec")],i=[0,95,135,175,215,255];for(let n=0;n<216;n++){let l=i[n/36%6|0],o=i[n/6%6|0],h=i[n%6];e.push({css:at.toCss(l,o,h),rgba:at.toRgba(l,o,h)})}for(let n=0;n<24;n++){let l=8+n*10;e.push({css:at.toCss(l,l,l),rgba:at.toRgba(l,l,l)})}return e})()),ir=Ge.toColor("#ffffff"),ol=Ge.toColor("#000000"),Fg=Ge.toColor("#ffffff"),Gg=ol,tl={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117},N1=ir,Bu=class extends Se{constructor(e){super(),this._optionsService=e,this._contrastCache=new Kg,this._halfContrastCache=new Kg,this._onChangeColors=this._register(new Q),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:ir,background:ol,cursor:Fg,cursorAccent:Gg,selectionForeground:void 0,selectionBackgroundTransparent:tl,selectionBackgroundOpaque:Ie.blend(ol,tl),selectionInactiveBackgroundTransparent:tl,selectionInactiveBackgroundOpaque:Ie.blend(ol,tl),scrollbarSliderBackground:Ie.opacity(ir,.2),scrollbarSliderHoverBackground:Ie.opacity(ir,.4),scrollbarSliderActiveBackground:Ie.opacity(ir,.5),overviewRulerBorder:ir,ansi:ht.slice(),contrastCache:this._contrastCache,halfContrastCache:this._halfContrastCache},this._updateRestoreColors(),this._setTheme(this._optionsService.rawOptions.theme),this._register(this._optionsService.onSpecificOptionChange("minimumContrastRatio",()=>this._contrastCache.clear())),this._register(this._optionsService.onSpecificOptionChange("theme",()=>this._setTheme(this._optionsService.rawOptions.theme)))}get colors(){return this._colors}_setTheme(e={}){let i=this._colors;if(i.foreground=Ue(e.foreground,ir),i.background=Ue(e.background,ol),i.cursor=Ie.blend(i.background,Ue(e.cursor,Fg)),i.cursorAccent=Ie.blend(i.background,Ue(e.cursorAccent,Gg)),i.selectionBackgroundTransparent=Ue(e.selectionBackground,tl),i.selectionBackgroundOpaque=Ie.blend(i.background,i.selectionBackgroundTransparent),i.selectionInactiveBackgroundTransparent=Ue(e.selectionInactiveBackground,i.selectionBackgroundTransparent),i.selectionInactiveBackgroundOpaque=Ie.blend(i.background,i.selectionInactiveBackgroundTransparent),i.selectionForeground=e.selectionForeground?Ue(e.selectionForeground,qg):void 0,i.selectionForeground===qg&&(i.selectionForeground=void 0),Ie.isOpaque(i.selectionBackgroundTransparent)&&(i.selectionBackgroundTransparent=Ie.opacity(i.selectionBackgroundTransparent,.3)),Ie.isOpaque(i.selectionInactiveBackgroundTransparent)&&(i.selectionInactiveBackgroundTransparent=Ie.opacity(i.selectionInactiveBackgroundTransparent,.3)),i.scrollbarSliderBackground=Ue(e.scrollbarSliderBackground,Ie.opacity(i.foreground,.2)),i.scrollbarSliderHoverBackground=Ue(e.scrollbarSliderHoverBackground,Ie.opacity(i.foreground,.4)),i.scrollbarSliderActiveBackground=Ue(e.scrollbarSliderActiveBackground,Ie.opacity(i.foreground,.5)),i.overviewRulerBorder=Ue(e.overviewRulerBorder,N1),i.ansi=ht.slice(),i.ansi[0]=Ue(e.black,ht[0]),i.ansi[1]=Ue(e.red,ht[1]),i.ansi[2]=Ue(e.green,ht[2]),i.ansi[3]=Ue(e.yellow,ht[3]),i.ansi[4]=Ue(e.blue,ht[4]),i.ansi[5]=Ue(e.magenta,ht[5]),i.ansi[6]=Ue(e.cyan,ht[6]),i.ansi[7]=Ue(e.white,ht[7]),i.ansi[8]=Ue(e.brightBlack,ht[8]),i.ansi[9]=Ue(e.brightRed,ht[9]),i.ansi[10]=Ue(e.brightGreen,ht[10]),i.ansi[11]=Ue(e.brightYellow,ht[11]),i.ansi[12]=Ue(e.brightBlue,ht[12]),i.ansi[13]=Ue(e.brightMagenta,ht[13]),i.ansi[14]=Ue(e.brightCyan,ht[14]),i.ansi[15]=Ue(e.brightWhite,ht[15]),e.extendedAnsi){let n=Math.min(i.ansi.length-16,e.extendedAnsi.length);for(let l=0;l<n;l++)i.ansi[l+16]=Ue(e.extendedAnsi[l],ht[l+16])}this._contrastCache.clear(),this._halfContrastCache.clear(),this._updateRestoreColors(),this._onChangeColors.fire(this.colors)}restoreColor(e){this._restoreColor(e),this._onChangeColors.fire(this.colors)}_restoreColor(e){if(e===void 0){for(let i=0;i<this._restoreColors.ansi.length;++i)this._colors.ansi[i]=this._restoreColors.ansi[i];return}switch(e){case 256:this._colors.foreground=this._restoreColors.foreground;break;case 257:this._colors.background=this._restoreColors.background;break;case 258:this._colors.cursor=this._restoreColors.cursor;break;default:this._colors.ansi[e]=this._restoreColors.ansi[e]}}modifyColors(e){e(this._colors),this._onChangeColors.fire(this.colors)}_updateRestoreColors(){this._restoreColors={foreground:this._colors.foreground,background:this._colors.background,cursor:this._colors.cursor,ansi:this._colors.ansi.slice()}}};Bu=Qe([se(0,At)],Bu);function Ue(e,i){if(e!==void 0)try{return Ge.toColor(e)}catch{}return i}var H1=class{constructor(...e){this._entries=new Map;for(let[i,n]of e)this.set(i,n)}set(e,i){let n=this._entries.get(e);return this._entries.set(e,i),n}forEach(e){for(let[i,n]of this._entries.entries())e(i,n)}has(e){return this._entries.has(e)}get(e){return this._entries.get(e)}},U1=class{constructor(){this._services=new H1,this._services.set(Iu,this)}setService(e,i){this._services.set(e,i)}getService(e){return this._services.get(e)}createInstance(e,...i){let n=zb(e).sort((h,d)=>h.index-d.index),l=[];for(let h of n){let d=this._services.get(h.id);if(!d)throw new Error(`[createInstance] ${e.name} depends on UNKNOWN service ${h.id._id}.`);l.push(d)}let o=n.length>0?n[0].index:i.length;if(i.length!==o)throw new Error(`[createInstance] First service dependency of ${e.name} at position ${o+1} conflicts with ${i.length} static arguments`);return new e(...i,...l)}},W1={trace:0,debug:1,info:2,warn:3,error:4,off:5},q1="xterm.js: ",Mu=class extends Se{constructor(e){super(),this._optionsService=e,this._logLevel=5,this._updateLogLevel(),this._register(this._optionsService.onSpecificOptionChange("logLevel",()=>this._updateLogLevel()))}get logLevel(){return this._logLevel}_updateLogLevel(){this._logLevel=W1[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(e){for(let i=0;i<e.length;i++)typeof e[i]=="function"&&(e[i]=e[i]())}_log(e,i,n){this._evalLazyOptionalParams(n),e.call(console,(this._optionsService.options.logger?"":q1)+i,...n)}trace(e,...i){this._logLevel<=0&&this._log(this._optionsService.options.logger?.trace.bind(this._optionsService.options.logger)??console.log,e,i)}debug(e,...i){this._logLevel<=1&&this._log(this._optionsService.options.logger?.debug.bind(this._optionsService.options.logger)??console.log,e,i)}info(e,...i){this._logLevel<=2&&this._log(this._optionsService.options.logger?.info.bind(this._optionsService.options.logger)??console.info,e,i)}warn(e,...i){this._logLevel<=3&&this._log(this._optionsService.options.logger?.warn.bind(this._optionsService.options.logger)??console.warn,e,i)}error(e,...i){this._logLevel<=4&&this._log(this._optionsService.options.logger?.error.bind(this._optionsService.options.logger)??console.error,e,i)}};Mu=Qe([se(0,At)],Mu);var Xg=class extends Se{constructor(e){super(),this._maxLength=e,this.onDeleteEmitter=this._register(new Q),this.onDelete=this.onDeleteEmitter.event,this.onInsertEmitter=this._register(new Q),this.onInsert=this.onInsertEmitter.event,this.onTrimEmitter=this._register(new Q),this.onTrim=this.onTrimEmitter.event,this._array=new Array(this._maxLength),this._startIndex=0,this._length=0}get maxLength(){return this._maxLength}set maxLength(e){if(this._maxLength===e)return;let i=new Array(e);for(let n=0;n<Math.min(e,this.length);n++)i[n]=this._array[this._getCyclicIndex(n)];this._array=i,this._maxLength=e,this._startIndex=0}get length(){return this._length}set length(e){if(e>this._length)for(let i=this._length;i<e;i++)this._array[i]=void 0;this._length=e}get(e){return this._array[this._getCyclicIndex(e)]}set(e,i){this._array[this._getCyclicIndex(e)]=i}push(e){this._array[this._getCyclicIndex(this._length)]=e,this._length===this._maxLength?(this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1)):this._length++}recycle(){if(this._length!==this._maxLength)throw new Error("Can only recycle when the buffer is full");return this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1),this._array[this._getCyclicIndex(this._length-1)]}get isFull(){return this._length===this._maxLength}pop(){return this._array[this._getCyclicIndex(this._length---1)]}splice(e,i,...n){if(i){for(let l=e;l<this._length-i;l++)this._array[this._getCyclicIndex(l)]=this._array[this._getCyclicIndex(l+i)];this._length-=i,this.onDeleteEmitter.fire({index:e,amount:i})}for(let l=this._length-1;l>=e;l--)this._array[this._getCyclicIndex(l+n.length)]=this._array[this._getCyclicIndex(l)];for(let l=0;l<n.length;l++)this._array[this._getCyclicIndex(e+l)]=n[l];if(n.length&&this.onInsertEmitter.fire({index:e,amount:n.length}),this._length+n.length>this._maxLength){let l=this._length+n.length-this._maxLength;this._startIndex+=l,this._length=this._maxLength,this.onTrimEmitter.fire(l)}else this._length+=n.length}trimStart(e){e>this._length&&(e=this._length),this._startIndex+=e,this._length-=e,this.onTrimEmitter.fire(e)}shiftElements(e,i,n){if(!(i<=0)){if(e<0||e>=this._length)throw new Error("start argument out of range");if(e+n<0)throw new Error("Cannot shift elements in list beyond index 0");if(n>0){for(let o=i-1;o>=0;o--)this.set(e+o+n,this.get(e+o));let l=e+i+n-this._length;if(l>0)for(this._length+=l;this._length>this._maxLength;)this._length--,this._startIndex++,this.onTrimEmitter.fire(1)}else for(let l=0;l<i;l++)this.set(e+l+n,this.get(e+l))}}_getCyclicIndex(e){return(this._startIndex+e)%this._maxLength}},ye=3,lt=Object.freeze(new ml),Ya=0,Xh=2,cl=class bv{constructor(i,n,l=!1){this.isWrapped=l,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(i*ye);let o=n||gi.fromCharData([0,Wm,1,0]);for(let h=0;h<i;++h)this.setCell(h,o);this.length=i}get(i){let n=this._data[i*ye+0],l=n&2097151;return[this._data[i*ye+1],n&2097152?this._combined[i]:l?Os(l):"",n>>22,n&2097152?this._combined[i].charCodeAt(this._combined[i].length-1):l]}set(i,n){this._data[i*ye+1]=n[0],n[1].length>1?(this._combined[i]=n[1],this._data[i*ye+0]=i|2097152|n[2]<<22):this._data[i*ye+0]=n[1].charCodeAt(0)|n[2]<<22}getWidth(i){return this._data[i*ye+0]>>22}hasWidth(i){return this._data[i*ye+0]&12582912}getFg(i){return this._data[i*ye+1]}getBg(i){return this._data[i*ye+2]}hasContent(i){return this._data[i*ye+0]&4194303}getCodePoint(i){let n=this._data[i*ye+0];return n&2097152?this._combined[i].charCodeAt(this._combined[i].length-1):n&2097151}isCombined(i){return this._data[i*ye+0]&2097152}getString(i){let n=this._data[i*ye+0];return n&2097152?this._combined[i]:n&2097151?Os(n&2097151):""}isProtected(i){return this._data[i*ye+2]&536870912}loadCell(i,n){return Ya=i*ye,n.content=this._data[Ya+0],n.fg=this._data[Ya+1],n.bg=this._data[Ya+2],n.content&2097152&&(n.combinedData=this._combined[i]),n.bg&268435456&&(n.extended=this._extendedAttrs[i]),n}setCell(i,n){n.content&2097152&&(this._combined[i]=n.combinedData),n.bg&268435456&&(this._extendedAttrs[i]=n.extended),this._data[i*ye+0]=n.content,this._data[i*ye+1]=n.fg,this._data[i*ye+2]=n.bg}setCellFromCodepoint(i,n,l,o){o.bg&268435456&&(this._extendedAttrs[i]=o.extended),this._data[i*ye+0]=n|l<<22,this._data[i*ye+1]=o.fg,this._data[i*ye+2]=o.bg}addCodepointToCell(i,n,l){let o=this._data[i*ye+0];o&2097152?this._combined[i]+=Os(n):o&2097151?(this._combined[i]=Os(o&2097151)+Os(n),o&=-2097152,o|=2097152):o=n|1<<22,l&&(o&=-12582913,o|=l<<22),this._data[i*ye+0]=o}insertCells(i,n,l){if(i%=this.length,i&&this.getWidth(i-1)===2&&this.setCellFromCodepoint(i-1,0,1,l),n<this.length-i){let o=new gi;for(let h=this.length-i-n-1;h>=0;--h)this.setCell(i+n+h,this.loadCell(i+h,o));for(let h=0;h<n;++h)this.setCell(i+h,l)}else for(let o=i;o<this.length;++o)this.setCell(o,l);this.getWidth(this.length-1)===2&&this.setCellFromCodepoint(this.length-1,0,1,l)}deleteCells(i,n,l){if(i%=this.length,n<this.length-i){let o=new gi;for(let h=0;h<this.length-i-n;++h)this.setCell(i+h,this.loadCell(i+n+h,o));for(let h=this.length-n;h<this.length;++h)this.setCell(h,l)}else for(let o=i;o<this.length;++o)this.setCell(o,l);i&&this.getWidth(i-1)===2&&this.setCellFromCodepoint(i-1,0,1,l),this.getWidth(i)===0&&!this.hasContent(i)&&this.setCellFromCodepoint(i,0,1,l)}replaceCells(i,n,l,o=!1){if(o){for(i&&this.getWidth(i-1)===2&&!this.isProtected(i-1)&&this.setCellFromCodepoint(i-1,0,1,l),n<this.length&&this.getWidth(n-1)===2&&!this.isProtected(n)&&this.setCellFromCodepoint(n,0,1,l);i<n&&i<this.length;)this.isProtected(i)||this.setCell(i,l),i++;return}for(i&&this.getWidth(i-1)===2&&this.setCellFromCodepoint(i-1,0,1,l),n<this.length&&this.getWidth(n-1)===2&&this.setCellFromCodepoint(n,0,1,l);i<n&&i<this.length;)this.setCell(i++,l)}resize(i,n){if(i===this.length)return this._data.length*4*Xh<this._data.buffer.byteLength;let l=i*ye;if(i>this.length){if(this._data.buffer.byteLength>=l*4)this._data=new Uint32Array(this._data.buffer,0,l);else{let o=new Uint32Array(l);o.set(this._data),this._data=o}for(let o=this.length;o<i;++o)this.setCell(o,n)}else{this._data=this._data.subarray(0,l);let o=Object.keys(this._combined);for(let d=0;d<o.length;d++){let _=parseInt(o[d],10);_>=i&&delete this._combined[_]}let h=Object.keys(this._extendedAttrs);for(let d=0;d<h.length;d++){let _=parseInt(h[d],10);_>=i&&delete this._extendedAttrs[_]}}return this.length=i,l*4*Xh<this._data.buffer.byteLength}cleanupMemory(){if(this._data.length*4*Xh<this._data.buffer.byteLength){let i=new Uint32Array(this._data.length);return i.set(this._data),this._data=i,1}return 0}fill(i,n=!1){if(n){for(let l=0;l<this.length;++l)this.isProtected(l)||this.setCell(l,i);return}this._combined={},this._extendedAttrs={};for(let l=0;l<this.length;++l)this.setCell(l,i)}copyFrom(i){this.length!==i.length?this._data=new Uint32Array(i._data):this._data.set(i._data),this.length=i.length,this._combined={};for(let n in i._combined)this._combined[n]=i._combined[n];this._extendedAttrs={};for(let n in i._extendedAttrs)this._extendedAttrs[n]=i._extendedAttrs[n];this.isWrapped=i.isWrapped}clone(){let i=new bv(0);i._data=new Uint32Array(this._data),i.length=this.length;for(let n in this._combined)i._combined[n]=this._combined[n];for(let n in this._extendedAttrs)i._extendedAttrs[n]=this._extendedAttrs[n];return i.isWrapped=this.isWrapped,i}getTrimmedLength(){for(let i=this.length-1;i>=0;--i)if(this._data[i*ye+0]&4194303)return i+(this._data[i*ye+0]>>22);return 0}getNoBgTrimmedLength(){for(let i=this.length-1;i>=0;--i)if(this._data[i*ye+0]&4194303||this._data[i*ye+2]&50331648)return i+(this._data[i*ye+0]>>22);return 0}copyCellsFrom(i,n,l,o,h){let d=i._data;if(h)for(let p=o-1;p>=0;p--){for(let f=0;f<ye;f++)this._data[(l+p)*ye+f]=d[(n+p)*ye+f];d[(n+p)*ye+2]&268435456&&(this._extendedAttrs[l+p]=i._extendedAttrs[n+p])}else for(let p=0;p<o;p++){for(let f=0;f<ye;f++)this._data[(l+p)*ye+f]=d[(n+p)*ye+f];d[(n+p)*ye+2]&268435456&&(this._extendedAttrs[l+p]=i._extendedAttrs[n+p])}let _=Object.keys(i._combined);for(let p=0;p<_.length;p++){let f=parseInt(_[p],10);f>=n&&(this._combined[f-n+l]=i._combined[f])}}translateToString(i,n,l,o){n=n??0,l=l??this.length,i&&(l=Math.min(l,this.getTrimmedLength())),o&&(o.length=0);let h="";for(;n<l;){let d=this._data[n*ye+0],_=d&2097151,p=d&2097152?this._combined[n]:_?Os(_):Ls;if(h+=p,o)for(let f=0;f<p.length;++f)o.push(n);n+=d>>22||1}return o&&o.push(n),h}};function P1(e,i,n,l,o,h){let d=[];for(let _=0;_<e.length-1;_++){let p=_,f=e.get(++p);if(!f.isWrapped)continue;let S=[e.get(_)];for(;p<e.length&&f.isWrapped;)S.push(f),f=e.get(++p);if(!h&&l>=_&&l<p){_+=S.length-1;continue}let y=0,x=gl(S,y,i),C=1,b=0;for(;C<S.length;){let M=gl(S,C,i),A=M-b,O=n-x,D=Math.min(A,O);S[y].copyCellsFrom(S[C],b,x,D,!1),x+=D,x===n&&(y++,x=0),b+=D,b===M&&(C++,b=0),x===0&&y!==0&&S[y-1].getWidth(n-1)===2&&(S[y].copyCellsFrom(S[y-1],n-1,x++,1,!1),S[y-1].setCell(n-1,o))}S[y].replaceCells(x,n,o);let T=0;for(let M=S.length-1;M>0&&(M>y||S[M].getTrimmedLength()===0);M--)T++;T>0&&(d.push(_+S.length-T),d.push(T)),_+=S.length-1}return d}function I1(e,i){let n=[],l=0,o=i[l],h=0;for(let d=0;d<e.length;d++)if(o===d){let _=i[++l];e.onDeleteEmitter.fire({index:d-h,amount:_}),d+=_-1,h+=_,o=i[++l]}else n.push(d);return{layout:n,countRemoved:h}}function Y1(e,i){let n=[];for(let l=0;l<i.length;l++)n.push(e.get(i[l]));for(let l=0;l<n.length;l++)e.set(l,n[l]);e.length=i.length}function $1(e,i,n){let l=[],o=e.map((p,f)=>gl(e,f,i)).reduce((p,f)=>p+f),h=0,d=0,_=0;for(;_<o;){if(o-_<n){l.push(o-_);break}h+=n;let p=gl(e,d,i);h>p&&(h-=p,d++);let f=e[d].getWidth(h-1)===2;f&&h--;let S=f?n-1:n;l.push(S),_+=S}return l}function gl(e,i,n){if(i===e.length-1)return e[i].getTrimmedLength();let l=!e[i].hasContent(n-1)&&e[i].getWidth(n-1)===1,o=e[i+1].getWidth(0)===2;return l&&o?n-1:n}var xv=class wv{constructor(i){this.line=i,this.isDisposed=!1,this._disposables=[],this._id=wv._nextId++,this._onDispose=this.register(new Q),this.onDispose=this._onDispose.event}get id(){return this._id}dispose(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire(),ar(this._disposables),this._disposables.length=0)}register(i){return this._disposables.push(i),i}};xv._nextId=1;var K1=xv,dt={},sr=dt.B;dt[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:"≥","{":"π","|":"≠","}":"£","~":"·"};dt.A={"#":"£"};dt.B=void 0;dt[4]={"#":"£","@":"¾","[":"ij","\\":"½","]":"|","{":"¨","|":"f","}":"¼","~":"´"};dt.C=dt[5]={"[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"};dt.R={"#":"£","@":"à","[":"°","\\":"ç","]":"§","{":"é","|":"ù","}":"è","~":"¨"};dt.Q={"@":"à","[":"â","\\":"ç","]":"ê","^":"î","`":"ô","{":"é","|":"ù","}":"è","~":"û"};dt.K={"@":"§","[":"Ä","\\":"Ö","]":"Ü","{":"ä","|":"ö","}":"ü","~":"ß"};dt.Y={"#":"£","@":"§","[":"°","\\":"ç","]":"é","`":"ù","{":"à","|":"ò","}":"è","~":"ì"};dt.E=dt[6]={"@":"Ä","[":"Æ","\\":"Ø","]":"Å","^":"Ü","`":"ä","{":"æ","|":"ø","}":"å","~":"ü"};dt.Z={"#":"£","@":"§","[":"¡","\\":"Ñ","]":"¿","{":"°","|":"ñ","}":"ç"};dt.H=dt[7]={"@":"É","[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"};dt["="]={"#":"ù","@":"à","[":"é","\\":"ç","]":"ê","^":"î",_:"è","`":"ô","{":"ä","|":"ö","}":"ü","~":"û"};var Vg=4294967295,Zg=class{constructor(e,i,n){this._hasScrollback=e,this._optionsService=i,this._bufferService=n,this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.tabs={},this.savedY=0,this.savedX=0,this.savedCurAttrData=lt.clone(),this.savedCharset=sr,this.markers=[],this._nullCell=gi.fromCharData([0,Wm,1,0]),this._whitespaceCell=gi.fromCharData([0,Ls,1,32]),this._isClearing=!1,this._memoryCleanupQueue=new so,this._memoryCleanupPosition=0,this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new Xg(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}getNullCell(e){return e?(this._nullCell.fg=e.fg,this._nullCell.bg=e.bg,this._nullCell.extended=e.extended):(this._nullCell.fg=0,this._nullCell.bg=0,this._nullCell.extended=new Ja),this._nullCell}getWhitespaceCell(e){return e?(this._whitespaceCell.fg=e.fg,this._whitespaceCell.bg=e.bg,this._whitespaceCell.extended=e.extended):(this._whitespaceCell.fg=0,this._whitespaceCell.bg=0,this._whitespaceCell.extended=new Ja),this._whitespaceCell}getBlankLine(e,i){return new cl(this._bufferService.cols,this.getNullCell(e),i)}get hasScrollback(){return this._hasScrollback&&this.lines.maxLength>this._rows}get isCursorInViewport(){let e=this.ybase+this.y-this.ydisp;return e>=0&&e<this._rows}_getCorrectBufferLength(e){if(!this._hasScrollback)return e;let i=e+this._optionsService.rawOptions.scrollback;return i>Vg?Vg:i}fillViewportRows(e){if(this.lines.length===0){e===void 0&&(e=lt);let i=this._rows;for(;i--;)this.lines.push(this.getBlankLine(e))}}clear(){this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.lines=new Xg(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(e,i){let n=this.getNullCell(lt),l=0,o=this._getCorrectBufferLength(i);if(o>this.lines.maxLength&&(this.lines.maxLength=o),this.lines.length>0){if(this._cols<e)for(let d=0;d<this.lines.length;d++)l+=+this.lines.get(d).resize(e,n);let h=0;if(this._rows<i)for(let d=this._rows;d<i;d++)this.lines.length<i+this.ybase&&(this._optionsService.rawOptions.windowsMode||this._optionsService.rawOptions.windowsPty.backend!==void 0||this._optionsService.rawOptions.windowsPty.buildNumber!==void 0?this.lines.push(new cl(e,n)):this.ybase>0&&this.lines.length<=this.ybase+this.y+h+1?(this.ybase--,h++,this.ydisp>0&&this.ydisp--):this.lines.push(new cl(e,n)));else for(let d=this._rows;d>i;d--)this.lines.length>i+this.ybase&&(this.lines.length>this.ybase+this.y+1?this.lines.pop():(this.ybase++,this.ydisp++));if(o<this.lines.maxLength){let d=this.lines.length-o;d>0&&(this.lines.trimStart(d),this.ybase=Math.max(this.ybase-d,0),this.ydisp=Math.max(this.ydisp-d,0),this.savedY=Math.max(this.savedY-d,0)),this.lines.maxLength=o}this.x=Math.min(this.x,e-1),this.y=Math.min(this.y,i-1),h&&(this.y+=h),this.savedX=Math.min(this.savedX,e-1),this.scrollTop=0}if(this.scrollBottom=i-1,this._isReflowEnabled&&(this._reflow(e,i),this._cols>e))for(let h=0;h<this.lines.length;h++)l+=+this.lines.get(h).resize(e,n);this._cols=e,this._rows=i,this._memoryCleanupQueue.clear(),l>.1*this.lines.length&&(this._memoryCleanupPosition=0,this._memoryCleanupQueue.enqueue(()=>this._batchedMemoryCleanup()))}_batchedMemoryCleanup(){let e=!0;this._memoryCleanupPosition>=this.lines.length&&(this._memoryCleanupPosition=0,e=!1);let i=0;for(;this._memoryCleanupPosition<this.lines.length;)if(i+=this.lines.get(this._memoryCleanupPosition++).cleanupMemory(),i>100)return!0;return e}get _isReflowEnabled(){let e=this._optionsService.rawOptions.windowsPty;return e&&e.buildNumber?this._hasScrollback&&e.backend==="conpty"&&e.buildNumber>=21376:this._hasScrollback&&!this._optionsService.rawOptions.windowsMode}_reflow(e,i){this._cols!==e&&(e>this._cols?this._reflowLarger(e,i):this._reflowSmaller(e,i))}_reflowLarger(e,i){let n=this._optionsService.rawOptions.reflowCursorLine,l=P1(this.lines,this._cols,e,this.ybase+this.y,this.getNullCell(lt),n);if(l.length>0){let o=I1(this.lines,l);Y1(this.lines,o.layout),this._reflowLargerAdjustViewport(e,i,o.countRemoved)}}_reflowLargerAdjustViewport(e,i,n){let l=this.getNullCell(lt),o=n;for(;o-- >0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length<i&&this.lines.push(new cl(e,l))):(this.ydisp===this.ybase&&this.ydisp--,this.ybase--);this.savedY=Math.max(this.savedY-n,0)}_reflowSmaller(e,i){let n=this._optionsService.rawOptions.reflowCursorLine,l=this.getNullCell(lt),o=[],h=0;for(let d=this.lines.length-1;d>=0;d--){let _=this.lines.get(d);if(!_||!_.isWrapped&&_.getTrimmedLength()<=e)continue;let p=[_];for(;_.isWrapped&&d>0;)_=this.lines.get(--d),p.unshift(_);if(!n){let D=this.ybase+this.y;if(D>=d&&D<d+p.length)continue}let f=p[p.length-1].getTrimmedLength(),S=$1(p,this._cols,e),y=S.length-p.length,x;this.ybase===0&&this.y!==this.lines.length-1?x=Math.max(0,this.y-this.lines.maxLength+y):x=Math.max(0,this.lines.length-this.lines.maxLength+y);let C=[];for(let D=0;D<y;D++){let L=this.getBlankLine(lt,!0);C.push(L)}C.length>0&&(o.push({start:d+p.length+h,newLines:C}),h+=C.length),p.push(...C);let b=S.length-1,T=S[b];T===0&&(b--,T=S[b]);let M=p.length-y-1,A=f;for(;M>=0;){let D=Math.min(A,T);if(p[b]===void 0)break;if(p[b].copyCellsFrom(p[M],A-D,T-D,D,!0),T-=D,T===0&&(b--,T=S[b]),A-=D,A===0){M--;let L=Math.max(M,0);A=gl(p,L,this._cols)}}for(let D=0;D<p.length;D++)S[D]<e&&p[D].setCell(S[D],l);let O=y-x;for(;O-- >0;)this.ybase===0?this.y<i-1?(this.y++,this.lines.pop()):(this.ybase++,this.ydisp++):this.ybase<Math.min(this.lines.maxLength,this.lines.length+h)-i&&(this.ybase===this.ydisp&&this.ydisp++,this.ybase++);this.savedY=Math.min(this.savedY+y,this.ybase+i-1)}if(o.length>0){let d=[],_=[];for(let T=0;T<this.lines.length;T++)_.push(this.lines.get(T));let p=this.lines.length,f=p-1,S=0,y=o[S];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+h);let x=0;for(let T=Math.min(this.lines.maxLength-1,p+h-1);T>=0;T--)if(y&&y.start>f+x){for(let M=y.newLines.length-1;M>=0;M--)this.lines.set(T--,y.newLines[M]);T++,d.push({index:f+1,amount:y.newLines.length}),x+=y.newLines.length,y=o[++S]}else this.lines.set(T,_[f--]);let C=0;for(let T=d.length-1;T>=0;T--)d[T].index+=C,this.lines.onInsertEmitter.fire(d[T]),C+=d[T].amount;let b=Math.max(0,p+h-this.lines.maxLength);b>0&&this.lines.onTrimEmitter.fire(b)}}translateBufferLineToString(e,i,n=0,l){let o=this.lines.get(e);return o?o.translateToString(i,n,l):""}getWrappedRangeForLine(e){let i=e,n=e;for(;i>0&&this.lines.get(i).isWrapped;)i--;for(;n+1<this.lines.length&&this.lines.get(n+1).isWrapped;)n++;return{first:i,last:n}}setupTabStops(e){for(e!=null?this.tabs[e]||(e=this.prevStop(e)):(this.tabs={},e=0);e<this._cols;e+=this._optionsService.rawOptions.tabStopWidth)this.tabs[e]=!0}prevStop(e){for(e==null&&(e=this.x);!this.tabs[--e]&&e>0;);return e>=this._cols?this._cols-1:e<0?0:e}nextStop(e){for(e==null&&(e=this.x);!this.tabs[++e]&&e<this._cols;);return e>=this._cols?this._cols-1:e<0?0:e}clearMarkers(e){this._isClearing=!0;for(let i=0;i<this.markers.length;i++)this.markers[i].line===e&&(this.markers[i].dispose(),this.markers.splice(i--,1));this._isClearing=!1}clearAllMarkers(){this._isClearing=!0;for(let e=0;e<this.markers.length;e++)this.markers[e].dispose();this.markers.length=0,this._isClearing=!1}addMarker(e){let i=new K1(e);return this.markers.push(i),i.register(this.lines.onTrim(n=>{i.line-=n,i.line<0&&i.dispose()})),i.register(this.lines.onInsert(n=>{i.line>=n.index&&(i.line+=n.amount)})),i.register(this.lines.onDelete(n=>{i.line>=n.index&&i.line<n.index+n.amount&&i.dispose(),i.line>n.index&&(i.line-=n.amount)})),i.register(i.onDispose(()=>this._removeMarker(i))),i}_removeMarker(e){this._isClearing||this.markers.splice(this.markers.indexOf(e),1)}},F1=class extends Se{constructor(e,i){super(),this._optionsService=e,this._bufferService=i,this._onBufferActivate=this._register(new Q),this.onBufferActivate=this._onBufferActivate.event,this.reset(),this._register(this._optionsService.onSpecificOptionChange("scrollback",()=>this.resize(this._bufferService.cols,this._bufferService.rows))),this._register(this._optionsService.onSpecificOptionChange("tabStopWidth",()=>this.setupTabStops()))}reset(){this._normal=new Zg(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new Zg(!1,this._optionsService,this._bufferService),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}),this.setupTabStops()}get alt(){return this._alt}get active(){return this._activeBuffer}get normal(){return this._normal}activateNormalBuffer(){this._activeBuffer!==this._normal&&(this._normal.x=this._alt.x,this._normal.y=this._alt.y,this._alt.clearAllMarkers(),this._alt.clear(),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}))}activateAltBuffer(e){this._activeBuffer!==this._alt&&(this._alt.fillViewportRows(e),this._alt.x=this._normal.x,this._alt.y=this._normal.y,this._activeBuffer=this._alt,this._onBufferActivate.fire({activeBuffer:this._alt,inactiveBuffer:this._normal}))}resize(e,i){this._normal.resize(e,i),this._alt.resize(e,i),this.setupTabStops(e)}setupTabStops(e){this._normal.setupTabStops(e),this._alt.setupTabStops(e)}},Cv=2,kv=1,zu=class extends Se{constructor(e){super(),this.isUserScrolling=!1,this._onResize=this._register(new Q),this.onResize=this._onResize.event,this._onScroll=this._register(new Q),this.onScroll=this._onScroll.event,this.cols=Math.max(e.rawOptions.cols||0,Cv),this.rows=Math.max(e.rawOptions.rows||0,kv),this.buffers=this._register(new F1(e,this)),this._register(this.buffers.onBufferActivate(i=>{this._onScroll.fire(i.activeBuffer.ydisp)}))}get buffer(){return this.buffers.active}resize(e,i){let n=this.cols!==e,l=this.rows!==i;this.cols=e,this.rows=i,this.buffers.resize(e,i),this._onResize.fire({cols:e,rows:i,colsChanged:n,rowsChanged:l})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(e,i=!1){let n=this.buffer,l;l=this._cachedBlankLine,(!l||l.length!==this.cols||l.getFg(0)!==e.fg||l.getBg(0)!==e.bg)&&(l=n.getBlankLine(e,i),this._cachedBlankLine=l),l.isWrapped=i;let o=n.ybase+n.scrollTop,h=n.ybase+n.scrollBottom;if(n.scrollTop===0){let d=n.lines.isFull;h===n.lines.length-1?d?n.lines.recycle().copyFrom(l):n.lines.push(l.clone()):n.lines.splice(h+1,0,l.clone()),d?this.isUserScrolling&&(n.ydisp=Math.max(n.ydisp-1,0)):(n.ybase++,this.isUserScrolling||n.ydisp++)}else{let d=h-o+1;n.lines.shiftElements(o+1,d-1,-1),n.lines.set(h,l.clone())}this.isUserScrolling||(n.ydisp=n.ybase),this._onScroll.fire(n.ydisp)}scrollLines(e,i){let n=this.buffer;if(e<0){if(n.ydisp===0)return;this.isUserScrolling=!0}else e+n.ydisp>=n.ybase&&(this.isUserScrolling=!1);let l=n.ydisp;n.ydisp=Math.max(Math.min(n.ydisp+e,n.ybase),0),l!==n.ydisp&&(i||this._onScroll.fire(n.ydisp))}};zu=Qe([se(0,At)],zu);var Zr={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:io,windowOptions:{},windowsMode:!1,windowsPty:{},wordSeparator:" ()[]{}',\"`",altClickMovesCursor:!0,convertEol:!1,termName:"xterm",cancelEvents:!1,overviewRuler:{}},G1=["normal","bold","100","200","300","400","500","600","700","800","900"],X1=class extends Se{constructor(e){super(),this._onOptionChange=this._register(new Q),this.onOptionChange=this._onOptionChange.event;let i={...Zr};for(let n in e)if(n in i)try{let l=e[n];i[n]=this._sanitizeAndValidateOption(n,l)}catch(l){console.error(l)}this.rawOptions=i,this.options={...i},this._setupOptions(),this._register($e(()=>{this.rawOptions.linkHandler=null,this.rawOptions.documentOverride=null}))}onSpecificOptionChange(e,i){return this.onOptionChange(n=>{n===e&&i(this.rawOptions[e])})}onMultipleOptionChange(e,i){return this.onOptionChange(n=>{e.indexOf(n)!==-1&&i()})}_setupOptions(){let e=n=>{if(!(n in Zr))throw new Error(`No option with key "${n}"`);return this.rawOptions[n]},i=(n,l)=>{if(!(n in Zr))throw new Error(`No option with key "${n}"`);l=this._sanitizeAndValidateOption(n,l),this.rawOptions[n]!==l&&(this.rawOptions[n]=l,this._onOptionChange.fire(n))};for(let n in this.rawOptions){let l={get:e.bind(this,n),set:i.bind(this,n)};Object.defineProperty(this.options,n,l)}}_sanitizeAndValidateOption(e,i){switch(e){case"cursorStyle":if(i||(i=Zr[e]),!V1(i))throw new Error(`"${i}" is not a valid value for ${e}`);break;case"wordSeparator":i||(i=Zr[e]);break;case"fontWeight":case"fontWeightBold":if(typeof i=="number"&&1<=i&&i<=1e3)break;i=G1.includes(i)?i:Zr[e];break;case"cursorWidth":i=Math.floor(i);case"lineHeight":case"tabStopWidth":if(i<1)throw new Error(`${e} cannot be less than 1, value: ${i}`);break;case"minimumContrastRatio":i=Math.max(1,Math.min(21,Math.round(i*10)/10));break;case"scrollback":if(i=Math.min(i,4294967295),i<0)throw new Error(`${e} cannot be less than 0, value: ${i}`);break;case"fastScrollSensitivity":case"scrollSensitivity":if(i<=0)throw new Error(`${e} cannot be less than or equal to 0, value: ${i}`);break;case"rows":case"cols":if(!i&&i!==0)throw new Error(`${e} must be numeric, value: ${i}`);break;case"windowsPty":i=i??{};break}return i}};function V1(e){return e==="block"||e==="underline"||e==="bar"}function hl(e,i=5){if(typeof e!="object")return e;let n=Array.isArray(e)?[]:{};for(let l in e)n[l]=i<=1?e[l]:e[l]&&hl(e[l],i-1);return n}var Qg=Object.freeze({insertMode:!1}),Jg=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,cursorBlink:void 0,cursorStyle:void 0,origin:!1,reverseWraparound:!1,sendFocus:!1,synchronizedOutput:!1,wraparound:!0}),Au=class extends Se{constructor(e,i,n){super(),this._bufferService=e,this._logService=i,this._optionsService=n,this.isCursorInitialized=!1,this.isCursorHidden=!1,this._onData=this._register(new Q),this.onData=this._onData.event,this._onUserInput=this._register(new Q),this.onUserInput=this._onUserInput.event,this._onBinary=this._register(new Q),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this._register(new Q),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=hl(Qg),this.decPrivateModes=hl(Jg)}reset(){this.modes=hl(Qg),this.decPrivateModes=hl(Jg)}triggerDataEvent(e,i=!1){if(this._optionsService.rawOptions.disableStdin)return;let n=this._bufferService.buffer;i&&this._optionsService.rawOptions.scrollOnUserInput&&n.ybase!==n.ydisp&&this._onRequestScrollToBottom.fire(),i&&this._onUserInput.fire(),this._logService.debug(`sending data "${e}"`),this._logService.trace("sending data (codes)",()=>e.split("").map(l=>l.charCodeAt(0))),this._onData.fire(e)}triggerBinaryEvent(e){this._optionsService.rawOptions.disableStdin||(this._logService.debug(`sending binary "${e}"`),this._logService.trace("sending binary (codes)",()=>e.split("").map(i=>i.charCodeAt(0))),this._onBinary.fire(e))}};Au=Qe([se(0,zt),se(1,$m),se(2,At)],Au);var em={NONE:{events:0,restrict:()=>!1},X10:{events:1,restrict:e=>e.button===4||e.action!==1?!1:(e.ctrl=!1,e.alt=!1,e.shift=!1,!0)},VT200:{events:19,restrict:e=>e.action!==32},DRAG:{events:23,restrict:e=>!(e.action===32&&e.button===3)},ANY:{events:31,restrict:e=>!0}};function Vh(e,i){let n=(e.ctrl?16:0)|(e.shift?4:0)|(e.alt?8:0);return e.button===4?(n|=64,n|=e.action):(n|=e.button&3,e.button&4&&(n|=64),e.button&8&&(n|=128),e.action===32?n|=32:e.action===0&&!i&&(n|=3)),n}var Zh=String.fromCharCode,tm={DEFAULT:e=>{let i=[Vh(e,!1)+32,e.col+32,e.row+32];return i[0]>255||i[1]>255||i[2]>255?"":`\x1B[M${Zh(i[0])}${Zh(i[1])}${Zh(i[2])}`},SGR:e=>{let i=e.action===0&&e.button!==4?"m":"M";return`\x1B[<${Vh(e,!0)};${e.col};${e.row}${i}`},SGR_PIXELS:e=>{let i=e.action===0&&e.button!==4?"m":"M";return`\x1B[<${Vh(e,!0)};${e.x};${e.y}${i}`}},Ou=class extends Se{constructor(e,i,n){super(),this._bufferService=e,this._coreService=i,this._optionsService=n,this._protocols={},this._encodings={},this._activeProtocol="",this._activeEncoding="",this._lastEvent=null,this._wheelPartialScroll=0,this._onProtocolChange=this._register(new Q),this.onProtocolChange=this._onProtocolChange.event;for(let l of Object.keys(em))this.addProtocol(l,em[l]);for(let l of Object.keys(tm))this.addEncoding(l,tm[l]);this.reset()}addProtocol(e,i){this._protocols[e]=i}addEncoding(e,i){this._encodings[e]=i}get activeProtocol(){return this._activeProtocol}get areMouseEventsActive(){return this._protocols[this._activeProtocol].events!==0}set activeProtocol(e){if(!this._protocols[e])throw new Error(`unknown protocol "${e}"`);this._activeProtocol=e,this._onProtocolChange.fire(this._protocols[e].events)}get activeEncoding(){return this._activeEncoding}set activeEncoding(e){if(!this._encodings[e])throw new Error(`unknown encoding "${e}"`);this._activeEncoding=e}reset(){this.activeProtocol="NONE",this.activeEncoding="DEFAULT",this._lastEvent=null,this._wheelPartialScroll=0}consumeWheelEvent(e,i,n){if(e.deltaY===0||e.shiftKey||i===void 0||n===void 0)return 0;let l=i/n,o=this._applyScrollModifier(e.deltaY,e);return e.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(o/=l+0,Math.abs(e.deltaY)<50&&(o*=.3),this._wheelPartialScroll+=o,o=Math.floor(Math.abs(this._wheelPartialScroll))*(this._wheelPartialScroll>0?1:-1),this._wheelPartialScroll%=1):e.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(o*=this._bufferService.rows),o}_applyScrollModifier(e,i){return i.altKey||i.ctrlKey||i.shiftKey?e*this._optionsService.rawOptions.fastScrollSensitivity*this._optionsService.rawOptions.scrollSensitivity:e*this._optionsService.rawOptions.scrollSensitivity}triggerMouseEvent(e){if(e.col<0||e.col>=this._bufferService.cols||e.row<0||e.row>=this._bufferService.rows||e.button===4&&e.action===32||e.button===3&&e.action!==32||e.button!==4&&(e.action===2||e.action===3)||(e.col++,e.row++,e.action===32&&this._lastEvent&&this._equalEvents(this._lastEvent,e,this._activeEncoding==="SGR_PIXELS"))||!this._protocols[this._activeProtocol].restrict(e))return!1;let i=this._encodings[this._activeEncoding](e);return i&&(this._activeEncoding==="DEFAULT"?this._coreService.triggerBinaryEvent(i):this._coreService.triggerDataEvent(i,!0)),this._lastEvent=e,!0}explainEvents(e){return{down:!!(e&1),up:!!(e&2),drag:!!(e&4),move:!!(e&8),wheel:!!(e&16)}}_equalEvents(e,i,n){if(n){if(e.x!==i.x||e.y!==i.y)return!1}else if(e.col!==i.col||e.row!==i.row)return!1;return!(e.button!==i.button||e.action!==i.action||e.ctrl!==i.ctrl||e.alt!==i.alt||e.shift!==i.shift)}};Ou=Qe([se(0,zt),se(1,hr),se(2,At)],Ou);var Qh=[[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]],Z1=[[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]],ut;function Q1(e,i){let n=0,l=i.length-1,o;if(e<i[0][0]||e>i[l][1])return!1;for(;l>=n;)if(o=n+l>>1,e>i[o][1])n=o+1;else if(e<i[o][0])l=o-1;else return!0;return!1}var J1=class{constructor(){if(this.version="6",!ut){ut=new Uint8Array(65536),ut.fill(1),ut[0]=0,ut.fill(0,1,32),ut.fill(0,127,160),ut.fill(2,4352,4448),ut[9001]=2,ut[9002]=2,ut.fill(2,11904,42192),ut[12351]=1,ut.fill(2,44032,55204),ut.fill(2,63744,64256),ut.fill(2,65040,65050),ut.fill(2,65072,65136),ut.fill(2,65280,65377),ut.fill(2,65504,65511);for(let e=0;e<Qh.length;++e)ut.fill(0,Qh[e][0],Qh[e][1]+1)}}wcwidth(e){return e<32?0:e<127?1:e<65536?ut[e]:Q1(e,Z1)?0:e>=131072&&e<=196605||e>=196608&&e<=262141?2:1}charProperties(e,i){let n=this.wcwidth(e),l=n===0&&i!==0;if(l){let o=nr.extractWidth(i);o===0?l=!1:o>n&&(n=o)}return nr.createPropertyValue(0,n,l)}},nr=class Za{constructor(){this._providers=Object.create(null),this._active="",this._onChange=new Q,this.onChange=this._onChange.event;let i=new J1;this.register(i),this._active=i.version,this._activeProvider=i}static extractShouldJoin(i){return(i&1)!==0}static extractWidth(i){return i>>1&3}static extractCharKind(i){return i>>3}static createPropertyValue(i,n,l=!1){return(i&16777215)<<3|(n&3)<<1|(l?1:0)}dispose(){this._onChange.dispose()}get versions(){return Object.keys(this._providers)}get activeVersion(){return this._active}set activeVersion(i){if(!this._providers[i])throw new Error(`unknown Unicode version "${i}"`);this._active=i,this._activeProvider=this._providers[i],this._onChange.fire(i)}register(i){this._providers[i.version]=i}wcwidth(i){return this._activeProvider.wcwidth(i)}getStringCellWidth(i){let n=0,l=0,o=i.length;for(let h=0;h<o;++h){let d=i.charCodeAt(h);if(55296<=d&&d<=56319){if(++h>=o)return n+this.wcwidth(d);let f=i.charCodeAt(h);56320<=f&&f<=57343?d=(d-55296)*1024+f-56320+65536:n+=this.wcwidth(f)}let _=this.charProperties(d,l),p=Za.extractWidth(_);Za.extractShouldJoin(_)&&(p-=Za.extractWidth(l)),n+=p,l=_}return n}charProperties(i,n){return this._activeProvider.charProperties(i,n)}},ew=class{constructor(){this.glevel=0,this._charsets=[]}reset(){this.charset=void 0,this._charsets=[],this.glevel=0}setgLevel(e){this.glevel=e,this.charset=this._charsets[e]}setgCharset(e,i){this._charsets[e]=i,this.glevel===e&&(this.charset=i)}};function im(e){let i=e.buffer.lines.get(e.buffer.ybase+e.buffer.y-1)?.get(e.cols-1),n=e.buffer.lines.get(e.buffer.ybase+e.buffer.y);n&&i&&(n.isWrapped=i[3]!==0&&i[3]!==32)}var il=2147483647,tw=256,Ev=class Lu{constructor(i=32,n=32){if(this.maxLength=i,this.maxSubParamsLength=n,n>tw)throw new Error("maxSubParamsLength must not be greater than 256");this.params=new Int32Array(i),this.length=0,this._subParams=new Int32Array(n),this._subParamsLength=0,this._subParamsIdx=new Uint16Array(i),this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}static fromArray(i){let n=new Lu;if(!i.length)return n;for(let l=Array.isArray(i[0])?1:0;l<i.length;++l){let o=i[l];if(Array.isArray(o))for(let h=0;h<o.length;++h)n.addSubParam(o[h]);else n.addParam(o)}return n}clone(){let i=new Lu(this.maxLength,this.maxSubParamsLength);return i.params.set(this.params),i.length=this.length,i._subParams.set(this._subParams),i._subParamsLength=this._subParamsLength,i._subParamsIdx.set(this._subParamsIdx),i._rejectDigits=this._rejectDigits,i._rejectSubDigits=this._rejectSubDigits,i._digitIsSub=this._digitIsSub,i}toArray(){let i=[];for(let n=0;n<this.length;++n){i.push(this.params[n]);let l=this._subParamsIdx[n]>>8,o=this._subParamsIdx[n]&255;o-l>0&&i.push(Array.prototype.slice.call(this._subParams,l,o))}return i}reset(){this.length=0,this._subParamsLength=0,this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}addParam(i){if(this._digitIsSub=!1,this.length>=this.maxLength){this._rejectDigits=!0;return}if(i<-1)throw new Error("values lesser than -1 are not allowed");this._subParamsIdx[this.length]=this._subParamsLength<<8|this._subParamsLength,this.params[this.length++]=i>il?il:i}addSubParam(i){if(this._digitIsSub=!0,!!this.length){if(this._rejectDigits||this._subParamsLength>=this.maxSubParamsLength){this._rejectSubDigits=!0;return}if(i<-1)throw new Error("values lesser than -1 are not allowed");this._subParams[this._subParamsLength++]=i>il?il:i,this._subParamsIdx[this.length-1]++}}hasSubParams(i){return(this._subParamsIdx[i]&255)-(this._subParamsIdx[i]>>8)>0}getSubParams(i){let n=this._subParamsIdx[i]>>8,l=this._subParamsIdx[i]&255;return l-n>0?this._subParams.subarray(n,l):null}getSubParamsAll(){let i={};for(let n=0;n<this.length;++n){let l=this._subParamsIdx[n]>>8,o=this._subParamsIdx[n]&255;o-l>0&&(i[n]=this._subParams.slice(l,o))}return i}addDigit(i){let n;if(this._rejectDigits||!(n=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;let l=this._digitIsSub?this._subParams:this.params,o=l[n-1];l[n-1]=~o?Math.min(o*10+i,il):i}},sl=[],iw=class{constructor(){this._state=0,this._active=sl,this._id=-1,this._handlers=Object.create(null),this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}registerHandler(e,i){this._handlers[e]===void 0&&(this._handlers[e]=[]);let n=this._handlers[e];return n.push(i),{dispose:()=>{let l=n.indexOf(i);l!==-1&&n.splice(l,1)}}}clearHandler(e){this._handlers[e]&&delete this._handlers[e]}setHandlerFallback(e){this._handlerFb=e}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=sl}reset(){if(this._state===2)for(let e=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;e>=0;--e)this._active[e].end(!1);this._stack.paused=!1,this._active=sl,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||sl,!this._active.length)this._handlerFb(this._id,"START");else for(let e=this._active.length-1;e>=0;e--)this._active[e].start()}_put(e,i,n){if(!this._active.length)this._handlerFb(this._id,"PUT",co(e,i,n));else for(let l=this._active.length-1;l>=0;l--)this._active[l].put(e,i,n)}start(){this.reset(),this._state=1}put(e,i,n){if(this._state!==3){if(this._state===1)for(;i<n;){let l=e[i++];if(l===59){this._state=2,this._start();break}if(l<48||57<l){this._state=3;return}this._id===-1&&(this._id=0),this._id=this._id*10+l-48}this._state===2&&n-i>0&&this._put(e,i,n)}}end(e,i=!0){if(this._state!==0){if(this._state!==3)if(this._state===1&&this._start(),!this._active.length)this._handlerFb(this._id,"END",e);else{let n=!1,l=this._active.length-1,o=!1;if(this._stack.paused&&(l=this._stack.loopPosition-1,n=i,o=this._stack.fallThrough,this._stack.paused=!1),!o&&n===!1){for(;l>=0&&(n=this._active[l].end(e),n!==!0);l--)if(n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=l,this._stack.fallThrough=!1,n;l--}for(;l>=0;l--)if(n=this._active[l].end(!1),n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=l,this._stack.fallThrough=!0,n}this._active=sl,this._id=-1,this._state=0}}},Jt=class{constructor(i){this._handler=i,this._data="",this._hitLimit=!1}start(){this._data="",this._hitLimit=!1}put(i,n,l){this._hitLimit||(this._data+=co(i,n,l),this._data.length>1e7&&(this._data="",this._hitLimit=!0))}end(i){let n=!1;if(this._hitLimit)n=!1;else if(i&&(n=this._handler(this._data),n instanceof Promise))return n.then(l=>(this._data="",this._hitLimit=!1,l));return this._data="",this._hitLimit=!1,n}},rl=[],sw=class{constructor(){this._handlers=Object.create(null),this._active=rl,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=rl}registerHandler(e,i){this._handlers[e]===void 0&&(this._handlers[e]=[]);let n=this._handlers[e];return n.push(i),{dispose:()=>{let l=n.indexOf(i);l!==-1&&n.splice(l,1)}}}clearHandler(e){this._handlers[e]&&delete this._handlers[e]}setHandlerFallback(e){this._handlerFb=e}reset(){if(this._active.length)for(let e=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;e>=0;--e)this._active[e].unhook(!1);this._stack.paused=!1,this._active=rl,this._ident=0}hook(e,i){if(this.reset(),this._ident=e,this._active=this._handlers[e]||rl,!this._active.length)this._handlerFb(this._ident,"HOOK",i);else for(let n=this._active.length-1;n>=0;n--)this._active[n].hook(i)}put(e,i,n){if(!this._active.length)this._handlerFb(this._ident,"PUT",co(e,i,n));else for(let l=this._active.length-1;l>=0;l--)this._active[l].put(e,i,n)}unhook(e,i=!0){if(!this._active.length)this._handlerFb(this._ident,"UNHOOK",e);else{let n=!1,l=this._active.length-1,o=!1;if(this._stack.paused&&(l=this._stack.loopPosition-1,n=i,o=this._stack.fallThrough,this._stack.paused=!1),!o&&n===!1){for(;l>=0&&(n=this._active[l].unhook(e),n!==!0);l--)if(n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=l,this._stack.fallThrough=!1,n;l--}for(;l>=0;l--)if(n=this._active[l].unhook(!1),n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=l,this._stack.fallThrough=!0,n}this._active=rl,this._ident=0}},ul=new Ev;ul.addParam(0);var sm=class{constructor(e){this._handler=e,this._data="",this._params=ul,this._hitLimit=!1}hook(e){this._params=e.length>1||e.params[0]?e.clone():ul,this._data="",this._hitLimit=!1}put(e,i,n){this._hitLimit||(this._data+=co(e,i,n),this._data.length>1e7&&(this._data="",this._hitLimit=!0))}unhook(e){let i=!1;if(this._hitLimit)i=!1;else if(e&&(i=this._handler(this._data,this._params),i instanceof Promise))return i.then(n=>(this._params=ul,this._data="",this._hitLimit=!1,n));return this._params=ul,this._data="",this._hitLimit=!1,i}},rw=class{constructor(e){this.table=new Uint8Array(e)}setDefault(e,i){this.table.fill(e<<4|i)}add(e,i,n,l){this.table[i<<8|e]=n<<4|l}addMany(e,i,n,l){for(let o=0;o<e.length;o++)this.table[i<<8|e[o]]=n<<4|l}},pi=160,nw=(function(){let e=new rw(4095),i=Array.apply(null,Array(256)).map((_,p)=>p),n=(_,p)=>i.slice(_,p),l=n(32,127),o=n(0,24);o.push(25),o.push.apply(o,n(28,32));let h=n(0,14),d;e.setDefault(1,0),e.addMany(l,0,2,0);for(d in h)e.addMany([24,26,153,154],d,3,0),e.addMany(n(128,144),d,3,0),e.addMany(n(144,152),d,3,0),e.add(156,d,0,0),e.add(27,d,11,1),e.add(157,d,4,8),e.addMany([152,158,159],d,0,7),e.add(155,d,11,3),e.add(144,d,11,9);return e.addMany(o,0,3,0),e.addMany(o,1,3,1),e.add(127,1,0,1),e.addMany(o,8,0,8),e.addMany(o,3,3,3),e.add(127,3,0,3),e.addMany(o,4,3,4),e.add(127,4,0,4),e.addMany(o,6,3,6),e.addMany(o,5,3,5),e.add(127,5,0,5),e.addMany(o,2,3,2),e.add(127,2,0,2),e.add(93,1,4,8),e.addMany(l,8,5,8),e.add(127,8,5,8),e.addMany([156,27,24,26,7],8,6,0),e.addMany(n(28,32),8,0,8),e.addMany([88,94,95],1,0,7),e.addMany(l,7,0,7),e.addMany(o,7,0,7),e.add(156,7,0,0),e.add(127,7,0,7),e.add(91,1,11,3),e.addMany(n(64,127),3,7,0),e.addMany(n(48,60),3,8,4),e.addMany([60,61,62,63],3,9,4),e.addMany(n(48,60),4,8,4),e.addMany(n(64,127),4,7,0),e.addMany([60,61,62,63],4,0,6),e.addMany(n(32,64),6,0,6),e.add(127,6,0,6),e.addMany(n(64,127),6,0,0),e.addMany(n(32,48),3,9,5),e.addMany(n(32,48),5,9,5),e.addMany(n(48,64),5,0,6),e.addMany(n(64,127),5,7,0),e.addMany(n(32,48),4,9,5),e.addMany(n(32,48),1,9,2),e.addMany(n(32,48),2,9,2),e.addMany(n(48,127),2,10,0),e.addMany(n(48,80),1,10,0),e.addMany(n(81,88),1,10,0),e.addMany([89,90,92],1,10,0),e.addMany(n(96,127),1,10,0),e.add(80,1,11,9),e.addMany(o,9,0,9),e.add(127,9,0,9),e.addMany(n(28,32),9,0,9),e.addMany(n(32,48),9,9,12),e.addMany(n(48,60),9,8,10),e.addMany([60,61,62,63],9,9,10),e.addMany(o,11,0,11),e.addMany(n(32,128),11,0,11),e.addMany(n(28,32),11,0,11),e.addMany(o,10,0,10),e.add(127,10,0,10),e.addMany(n(28,32),10,0,10),e.addMany(n(48,60),10,8,10),e.addMany([60,61,62,63],10,0,11),e.addMany(n(32,48),10,9,12),e.addMany(o,12,0,12),e.add(127,12,0,12),e.addMany(n(28,32),12,0,12),e.addMany(n(32,48),12,9,12),e.addMany(n(48,64),12,0,11),e.addMany(n(64,127),12,12,13),e.addMany(n(64,127),10,12,13),e.addMany(n(64,127),9,12,13),e.addMany(o,13,13,13),e.addMany(l,13,13,13),e.add(127,13,0,13),e.addMany([27,156,24,26],13,14,0),e.add(pi,0,2,0),e.add(pi,8,5,8),e.add(pi,6,0,6),e.add(pi,11,0,11),e.add(pi,13,13,13),e})(),lw=class extends Se{constructor(e=nw){super(),this._transitions=e,this._parseStack={state:0,handlers:[],handlerPos:0,transition:0,chunkPos:0},this.initialState=0,this.currentState=this.initialState,this._params=new Ev,this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._printHandlerFb=(i,n,l)=>{},this._executeHandlerFb=i=>{},this._csiHandlerFb=(i,n)=>{},this._escHandlerFb=i=>{},this._errorHandlerFb=i=>i,this._printHandler=this._printHandlerFb,this._executeHandlers=Object.create(null),this._csiHandlers=Object.create(null),this._escHandlers=Object.create(null),this._register($e(()=>{this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null)})),this._oscParser=this._register(new iw),this._dcsParser=this._register(new sw),this._errorHandler=this._errorHandlerFb,this.registerEscHandler({final:"\\"},()=>!0)}_identifier(e,i=[64,126]){let n=0;if(e.prefix){if(e.prefix.length>1)throw new Error("only one byte as prefix supported");if(n=e.prefix.charCodeAt(0),n&&60>n||n>63)throw new Error("prefix must be in range 0x3c .. 0x3f")}if(e.intermediates){if(e.intermediates.length>2)throw new Error("only two bytes as intermediates are supported");for(let o=0;o<e.intermediates.length;++o){let h=e.intermediates.charCodeAt(o);if(32>h||h>47)throw new Error("intermediate must be in range 0x20 .. 0x2f");n<<=8,n|=h}}if(e.final.length!==1)throw new Error("final must be a single byte");let l=e.final.charCodeAt(0);if(i[0]>l||l>i[1])throw new Error(`final must be in range ${i[0]} .. ${i[1]}`);return n<<=8,n|=l,n}identToString(e){let i=[];for(;e;)i.push(String.fromCharCode(e&255)),e>>=8;return i.reverse().join("")}setPrintHandler(e){this._printHandler=e}clearPrintHandler(){this._printHandler=this._printHandlerFb}registerEscHandler(e,i){let n=this._identifier(e,[48,126]);this._escHandlers[n]===void 0&&(this._escHandlers[n]=[]);let l=this._escHandlers[n];return l.push(i),{dispose:()=>{let o=l.indexOf(i);o!==-1&&l.splice(o,1)}}}clearEscHandler(e){this._escHandlers[this._identifier(e,[48,126])]&&delete this._escHandlers[this._identifier(e,[48,126])]}setEscHandlerFallback(e){this._escHandlerFb=e}setExecuteHandler(e,i){this._executeHandlers[e.charCodeAt(0)]=i}clearExecuteHandler(e){this._executeHandlers[e.charCodeAt(0)]&&delete this._executeHandlers[e.charCodeAt(0)]}setExecuteHandlerFallback(e){this._executeHandlerFb=e}registerCsiHandler(e,i){let n=this._identifier(e);this._csiHandlers[n]===void 0&&(this._csiHandlers[n]=[]);let l=this._csiHandlers[n];return l.push(i),{dispose:()=>{let o=l.indexOf(i);o!==-1&&l.splice(o,1)}}}clearCsiHandler(e){this._csiHandlers[this._identifier(e)]&&delete this._csiHandlers[this._identifier(e)]}setCsiHandlerFallback(e){this._csiHandlerFb=e}registerDcsHandler(e,i){return this._dcsParser.registerHandler(this._identifier(e),i)}clearDcsHandler(e){this._dcsParser.clearHandler(this._identifier(e))}setDcsHandlerFallback(e){this._dcsParser.setHandlerFallback(e)}registerOscHandler(e,i){return this._oscParser.registerHandler(e,i)}clearOscHandler(e){this._oscParser.clearHandler(e)}setOscHandlerFallback(e){this._oscParser.setHandlerFallback(e)}setErrorHandler(e){this._errorHandler=e}clearErrorHandler(){this._errorHandler=this._errorHandlerFb}reset(){this.currentState=this.initialState,this._oscParser.reset(),this._dcsParser.reset(),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._parseStack.state!==0&&(this._parseStack.state=2,this._parseStack.handlers=[])}_preserveStack(e,i,n,l,o){this._parseStack.state=e,this._parseStack.handlers=i,this._parseStack.handlerPos=n,this._parseStack.transition=l,this._parseStack.chunkPos=o}parse(e,i,n){let l=0,o=0,h=0,d;if(this._parseStack.state)if(this._parseStack.state===2)this._parseStack.state=0,h=this._parseStack.chunkPos+1;else{if(n===void 0||this._parseStack.state===1)throw this._parseStack.state=1,new Error("improper continuation due to previous async handler, giving up parsing");let _=this._parseStack.handlers,p=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(n===!1&&p>-1){for(;p>=0&&(d=_[p](this._params),d!==!0);p--)if(d instanceof Promise)return this._parseStack.handlerPos=p,d}this._parseStack.handlers=[];break;case 4:if(n===!1&&p>-1){for(;p>=0&&(d=_[p](),d!==!0);p--)if(d instanceof Promise)return this._parseStack.handlerPos=p,d}this._parseStack.handlers=[];break;case 6:if(l=e[this._parseStack.chunkPos],d=this._dcsParser.unhook(l!==24&&l!==26,n),d)return d;l===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break;case 5:if(l=e[this._parseStack.chunkPos],d=this._oscParser.end(l!==24&&l!==26,n),d)return d;l===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 _=h;_<i;++_){switch(l=e[_],o=this._transitions.table[this.currentState<<8|(l<160?l:pi)],o>>4){case 2:for(let x=_+1;;++x){if(x>=i||(l=e[x])<32||l>126&&l<pi){this._printHandler(e,_,x),_=x-1;break}if(++x>=i||(l=e[x])<32||l>126&&l<pi){this._printHandler(e,_,x),_=x-1;break}if(++x>=i||(l=e[x])<32||l>126&&l<pi){this._printHandler(e,_,x),_=x-1;break}if(++x>=i||(l=e[x])<32||l>126&&l<pi){this._printHandler(e,_,x),_=x-1;break}}break;case 3:this._executeHandlers[l]?this._executeHandlers[l]():this._executeHandlerFb(l),this.precedingJoinState=0;break;case 0:break;case 1:if(this._errorHandler({position:_,code:l,currentState:this.currentState,collect:this._collect,params:this._params,abort:!1}).abort)return;break;case 7:let p=this._csiHandlers[this._collect<<8|l],f=p?p.length-1:-1;for(;f>=0&&(d=p[f](this._params),d!==!0);f--)if(d instanceof Promise)return this._preserveStack(3,p,f,o,_),d;f<0&&this._csiHandlerFb(this._collect<<8|l,this._params),this.precedingJoinState=0;break;case 8:do switch(l){case 59:this._params.addParam(0);break;case 58:this._params.addSubParam(-1);break;default:this._params.addDigit(l-48)}while(++_<i&&(l=e[_])>47&&l<60);_--;break;case 9:this._collect<<=8,this._collect|=l;break;case 10:let S=this._escHandlers[this._collect<<8|l],y=S?S.length-1:-1;for(;y>=0&&(d=S[y](),d!==!0);y--)if(d instanceof Promise)return this._preserveStack(4,S,y,o,_),d;y<0&&this._escHandlerFb(this._collect<<8|l),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|l,this._params);break;case 13:for(let x=_+1;;++x)if(x>=i||(l=e[x])===24||l===26||l===27||l>127&&l<pi){this._dcsParser.put(e,_,x),_=x-1;break}break;case 14:if(d=this._dcsParser.unhook(l!==24&&l!==26),d)return this._preserveStack(6,[],0,o,_),d;l===27&&(o|=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 x=_+1;;x++)if(x>=i||(l=e[x])<32||l>127&&l<pi){this._oscParser.put(e,_,x),_=x-1;break}break;case 6:if(d=this._oscParser.end(l!==24&&l!==26),d)return this._preserveStack(5,[],0,o,_),d;l===27&&(o|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0;break}this.currentState=o&15}}},aw=/^([\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})$/,ow=/^[\da-f]+$/;function rm(e){if(!e)return;let i=e.toLowerCase();if(i.indexOf("rgb:")===0){i=i.slice(4);let n=aw.exec(i);if(n){let l=n[1]?15:n[4]?255:n[7]?4095:65535;return[Math.round(parseInt(n[1]||n[4]||n[7]||n[10],16)/l*255),Math.round(parseInt(n[2]||n[5]||n[8]||n[11],16)/l*255),Math.round(parseInt(n[3]||n[6]||n[9]||n[12],16)/l*255)]}}else if(i.indexOf("#")===0&&(i=i.slice(1),ow.exec(i)&&[3,6,9,12].includes(i.length))){let n=i.length/3,l=[0,0,0];for(let o=0;o<3;++o){let h=parseInt(i.slice(n*o,n*o+n),16);l[o]=n===1?h<<4:n===2?h:n===3?h>>4:h>>8}return l}}function Jh(e,i){let n=e.toString(16),l=n.length<2?"0"+n:n;switch(i){case 4:return n[0];case 8:return l;case 12:return(l+l).slice(0,3);default:return l+l}}function cw(e,i=16){let[n,l,o]=e;return`rgb:${Jh(n,i)}/${Jh(l,i)}/${Jh(o,i)}`}var hw={"(":0,")":1,"*":2,"+":3,"-":1,".":2},As=131072,nm=10;function lm(e,i){if(e>24)return i.setWinLines||!1;switch(e){case 1:return!!i.restoreWin;case 2:return!!i.minimizeWin;case 3:return!!i.setWinPosition;case 4:return!!i.setWinSizePixels;case 5:return!!i.raiseWin;case 6:return!!i.lowerWin;case 7:return!!i.refreshWin;case 8:return!!i.setWinSizeChars;case 9:return!!i.maximizeWin;case 10:return!!i.fullscreenWin;case 11:return!!i.getWinState;case 13:return!!i.getWinPosition;case 14:return!!i.getWinSizePixels;case 15:return!!i.getScreenSizePixels;case 16:return!!i.getCellSizePixels;case 18:return!!i.getWinSizeChars;case 19:return!!i.getScreenSizeChars;case 20:return!!i.getIconTitle;case 21:return!!i.getWinTitle;case 22:return!!i.pushTitle;case 23:return!!i.popTitle;case 24:return!!i.setWinLines}return!1}var am=5e3,om=0,uw=class extends Se{constructor(e,i,n,l,o,h,d,_,p=new lw){super(),this._bufferService=e,this._charsetService=i,this._coreService=n,this._logService=l,this._optionsService=o,this._oscLinkService=h,this._coreMouseService=d,this._unicodeService=_,this._parser=p,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new Bb,this._utf8Decoder=new Mb,this._windowTitle="",this._iconName="",this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=lt.clone(),this._eraseAttrDataInternal=lt.clone(),this._onRequestBell=this._register(new Q),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this._register(new Q),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this._register(new Q),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this._register(new Q),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this._register(new Q),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this._register(new Q),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this._register(new Q),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this._register(new Q),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this._register(new Q),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this._register(new Q),this.onLineFeed=this._onLineFeed.event,this._onScroll=this._register(new Q),this.onScroll=this._onScroll.event,this._onTitleChange=this._register(new Q),this.onTitleChange=this._onTitleChange.event,this._onColor=this._register(new Q),this.onColor=this._onColor.event,this._parseStack={paused:!1,cursorStartX:0,cursorStartY:0,decodedLength:0,position:0},this._specialColors=[256,257,258],this._register(this._parser),this._dirtyRowTracker=new ju(this._bufferService),this._activeBuffer=this._bufferService.buffer,this._register(this._bufferService.buffers.onBufferActivate(f=>this._activeBuffer=f.activeBuffer)),this._parser.setCsiHandlerFallback((f,S)=>{this._logService.debug("Unknown CSI code: ",{identifier:this._parser.identToString(f),params:S.toArray()})}),this._parser.setEscHandlerFallback(f=>{this._logService.debug("Unknown ESC code: ",{identifier:this._parser.identToString(f)})}),this._parser.setExecuteHandlerFallback(f=>{this._logService.debug("Unknown EXECUTE code: ",{code:f})}),this._parser.setOscHandlerFallback((f,S,y)=>{this._logService.debug("Unknown OSC code: ",{identifier:f,action:S,data:y})}),this._parser.setDcsHandlerFallback((f,S,y)=>{S==="HOOK"&&(y=y.toArray()),this._logService.debug("Unknown DCS code: ",{identifier:this._parser.identToString(f),action:S,payload:y})}),this._parser.setPrintHandler((f,S,y)=>this.print(f,S,y)),this._parser.registerCsiHandler({final:"@"},f=>this.insertChars(f)),this._parser.registerCsiHandler({intermediates:" ",final:"@"},f=>this.scrollLeft(f)),this._parser.registerCsiHandler({final:"A"},f=>this.cursorUp(f)),this._parser.registerCsiHandler({intermediates:" ",final:"A"},f=>this.scrollRight(f)),this._parser.registerCsiHandler({final:"B"},f=>this.cursorDown(f)),this._parser.registerCsiHandler({final:"C"},f=>this.cursorForward(f)),this._parser.registerCsiHandler({final:"D"},f=>this.cursorBackward(f)),this._parser.registerCsiHandler({final:"E"},f=>this.cursorNextLine(f)),this._parser.registerCsiHandler({final:"F"},f=>this.cursorPrecedingLine(f)),this._parser.registerCsiHandler({final:"G"},f=>this.cursorCharAbsolute(f)),this._parser.registerCsiHandler({final:"H"},f=>this.cursorPosition(f)),this._parser.registerCsiHandler({final:"I"},f=>this.cursorForwardTab(f)),this._parser.registerCsiHandler({final:"J"},f=>this.eraseInDisplay(f,!1)),this._parser.registerCsiHandler({prefix:"?",final:"J"},f=>this.eraseInDisplay(f,!0)),this._parser.registerCsiHandler({final:"K"},f=>this.eraseInLine(f,!1)),this._parser.registerCsiHandler({prefix:"?",final:"K"},f=>this.eraseInLine(f,!0)),this._parser.registerCsiHandler({final:"L"},f=>this.insertLines(f)),this._parser.registerCsiHandler({final:"M"},f=>this.deleteLines(f)),this._parser.registerCsiHandler({final:"P"},f=>this.deleteChars(f)),this._parser.registerCsiHandler({final:"S"},f=>this.scrollUp(f)),this._parser.registerCsiHandler({final:"T"},f=>this.scrollDown(f)),this._parser.registerCsiHandler({final:"X"},f=>this.eraseChars(f)),this._parser.registerCsiHandler({final:"Z"},f=>this.cursorBackwardTab(f)),this._parser.registerCsiHandler({final:"`"},f=>this.charPosAbsolute(f)),this._parser.registerCsiHandler({final:"a"},f=>this.hPositionRelative(f)),this._parser.registerCsiHandler({final:"b"},f=>this.repeatPrecedingCharacter(f)),this._parser.registerCsiHandler({final:"c"},f=>this.sendDeviceAttributesPrimary(f)),this._parser.registerCsiHandler({prefix:">",final:"c"},f=>this.sendDeviceAttributesSecondary(f)),this._parser.registerCsiHandler({final:"d"},f=>this.linePosAbsolute(f)),this._parser.registerCsiHandler({final:"e"},f=>this.vPositionRelative(f)),this._parser.registerCsiHandler({final:"f"},f=>this.hVPosition(f)),this._parser.registerCsiHandler({final:"g"},f=>this.tabClear(f)),this._parser.registerCsiHandler({final:"h"},f=>this.setMode(f)),this._parser.registerCsiHandler({prefix:"?",final:"h"},f=>this.setModePrivate(f)),this._parser.registerCsiHandler({final:"l"},f=>this.resetMode(f)),this._parser.registerCsiHandler({prefix:"?",final:"l"},f=>this.resetModePrivate(f)),this._parser.registerCsiHandler({final:"m"},f=>this.charAttributes(f)),this._parser.registerCsiHandler({final:"n"},f=>this.deviceStatus(f)),this._parser.registerCsiHandler({prefix:"?",final:"n"},f=>this.deviceStatusPrivate(f)),this._parser.registerCsiHandler({intermediates:"!",final:"p"},f=>this.softReset(f)),this._parser.registerCsiHandler({intermediates:" ",final:"q"},f=>this.setCursorStyle(f)),this._parser.registerCsiHandler({final:"r"},f=>this.setScrollRegion(f)),this._parser.registerCsiHandler({final:"s"},f=>this.saveCursor(f)),this._parser.registerCsiHandler({final:"t"},f=>this.windowOptions(f)),this._parser.registerCsiHandler({final:"u"},f=>this.restoreCursor(f)),this._parser.registerCsiHandler({intermediates:"'",final:"}"},f=>this.insertColumns(f)),this._parser.registerCsiHandler({intermediates:"'",final:"~"},f=>this.deleteColumns(f)),this._parser.registerCsiHandler({intermediates:'"',final:"q"},f=>this.selectProtected(f)),this._parser.registerCsiHandler({intermediates:"$",final:"p"},f=>this.requestMode(f,!0)),this._parser.registerCsiHandler({prefix:"?",intermediates:"$",final:"p"},f=>this.requestMode(f,!1)),this._parser.setExecuteHandler(F.BEL,()=>this.bell()),this._parser.setExecuteHandler(F.LF,()=>this.lineFeed()),this._parser.setExecuteHandler(F.VT,()=>this.lineFeed()),this._parser.setExecuteHandler(F.FF,()=>this.lineFeed()),this._parser.setExecuteHandler(F.CR,()=>this.carriageReturn()),this._parser.setExecuteHandler(F.BS,()=>this.backspace()),this._parser.setExecuteHandler(F.HT,()=>this.tab()),this._parser.setExecuteHandler(F.SO,()=>this.shiftOut()),this._parser.setExecuteHandler(F.SI,()=>this.shiftIn()),this._parser.setExecuteHandler(Xa.IND,()=>this.index()),this._parser.setExecuteHandler(Xa.NEL,()=>this.nextLine()),this._parser.setExecuteHandler(Xa.HTS,()=>this.tabSet()),this._parser.registerOscHandler(0,new Jt(f=>(this.setTitle(f),this.setIconName(f),!0))),this._parser.registerOscHandler(1,new Jt(f=>this.setIconName(f))),this._parser.registerOscHandler(2,new Jt(f=>this.setTitle(f))),this._parser.registerOscHandler(4,new Jt(f=>this.setOrReportIndexedColor(f))),this._parser.registerOscHandler(8,new Jt(f=>this.setHyperlink(f))),this._parser.registerOscHandler(10,new Jt(f=>this.setOrReportFgColor(f))),this._parser.registerOscHandler(11,new Jt(f=>this.setOrReportBgColor(f))),this._parser.registerOscHandler(12,new Jt(f=>this.setOrReportCursorColor(f))),this._parser.registerOscHandler(104,new Jt(f=>this.restoreIndexedColor(f))),this._parser.registerOscHandler(110,new Jt(f=>this.restoreFgColor(f))),this._parser.registerOscHandler(111,new Jt(f=>this.restoreBgColor(f))),this._parser.registerOscHandler(112,new Jt(f=>this.restoreCursorColor(f))),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 f in dt)this._parser.registerEscHandler({intermediates:"(",final:f},()=>this.selectCharset("("+f)),this._parser.registerEscHandler({intermediates:")",final:f},()=>this.selectCharset(")"+f)),this._parser.registerEscHandler({intermediates:"*",final:f},()=>this.selectCharset("*"+f)),this._parser.registerEscHandler({intermediates:"+",final:f},()=>this.selectCharset("+"+f)),this._parser.registerEscHandler({intermediates:"-",final:f},()=>this.selectCharset("-"+f)),this._parser.registerEscHandler({intermediates:".",final:f},()=>this.selectCharset("."+f)),this._parser.registerEscHandler({intermediates:"/",final:f},()=>this.selectCharset("/"+f));this._parser.registerEscHandler({intermediates:"#",final:"8"},()=>this.screenAlignmentPattern()),this._parser.setErrorHandler(f=>(this._logService.error("Parsing error: ",f),f)),this._parser.registerDcsHandler({intermediates:"$",final:"q"},new sm((f,S)=>this.requestStatusString(f,S)))}getAttrData(){return this._curAttrData}_preserveStack(e,i,n,l){this._parseStack.paused=!0,this._parseStack.cursorStartX=e,this._parseStack.cursorStartY=i,this._parseStack.decodedLength=n,this._parseStack.position=l}_logSlowResolvingAsync(e){this._logService.logLevel<=3&&Promise.race([e,new Promise((i,n)=>setTimeout(()=>n("#SLOW_TIMEOUT"),am))]).catch(i=>{if(i!=="#SLOW_TIMEOUT")throw i;console.warn(`async parser handler taking longer than ${am} ms`)})}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(e,i){let n,l=this._activeBuffer.x,o=this._activeBuffer.y,h=0,d=this._parseStack.paused;if(d){if(n=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,i))return this._logSlowResolvingAsync(n),n;l=this._parseStack.cursorStartX,o=this._parseStack.cursorStartY,this._parseStack.paused=!1,e.length>As&&(h=this._parseStack.position+As)}if(this._logService.logLevel<=1&&this._logService.debug(`parsing data ${typeof e=="string"?` "${e}"`:` "${Array.prototype.map.call(e,f=>String.fromCharCode(f)).join("")}"`}`),this._logService.logLevel===0&&this._logService.trace("parsing data (codes)",typeof e=="string"?e.split("").map(f=>f.charCodeAt(0)):e),this._parseBuffer.length<e.length&&this._parseBuffer.length<As&&(this._parseBuffer=new Uint32Array(Math.min(e.length,As))),d||this._dirtyRowTracker.clearRange(),e.length>As)for(let f=h;f<e.length;f+=As){let S=f+As<e.length?f+As:e.length,y=typeof e=="string"?this._stringDecoder.decode(e.substring(f,S),this._parseBuffer):this._utf8Decoder.decode(e.subarray(f,S),this._parseBuffer);if(n=this._parser.parse(this._parseBuffer,y))return this._preserveStack(l,o,y,f),this._logSlowResolvingAsync(n),n}else if(!d){let f=typeof e=="string"?this._stringDecoder.decode(e,this._parseBuffer):this._utf8Decoder.decode(e,this._parseBuffer);if(n=this._parser.parse(this._parseBuffer,f))return this._preserveStack(l,o,f,0),this._logSlowResolvingAsync(n),n}(this._activeBuffer.x!==l||this._activeBuffer.y!==o)&&this._onCursorMove.fire();let _=this._dirtyRowTracker.end+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp),p=this._dirtyRowTracker.start+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp);p<this._bufferService.rows&&this._onRequestRefreshRows.fire({start:Math.min(p,this._bufferService.rows-1),end:Math.min(_,this._bufferService.rows-1)})}print(e,i,n){let l,o,h=this._charsetService.charset,d=this._optionsService.rawOptions.screenReaderMode,_=this._bufferService.cols,p=this._coreService.decPrivateModes.wraparound,f=this._coreService.modes.insertMode,S=this._curAttrData,y=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._activeBuffer.x&&n-i>0&&y.getWidth(this._activeBuffer.x-1)===2&&y.setCellFromCodepoint(this._activeBuffer.x-1,0,1,S);let x=this._parser.precedingJoinState;for(let C=i;C<n;++C){if(l=e[C],l<127&&h){let A=h[String.fromCharCode(l)];A&&(l=A.charCodeAt(0))}let b=this._unicodeService.charProperties(l,x);o=nr.extractWidth(b);let T=nr.extractShouldJoin(b),M=T?nr.extractWidth(x):0;if(x=b,d&&this._onA11yChar.fire(Os(l)),this._getCurrentLinkId()&&this._oscLinkService.addLineToLink(this._getCurrentLinkId(),this._activeBuffer.ybase+this._activeBuffer.y),this._activeBuffer.x+o-M>_){if(p){let A=y,O=this._activeBuffer.x-M;for(this._activeBuffer.x=M,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),y=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y),M>0&&y instanceof cl&&y.copyCellsFrom(A,O,0,M,!1);O<_;)A.setCellFromCodepoint(O++,0,1,S)}else if(this._activeBuffer.x=_-1,o===2)continue}if(T&&this._activeBuffer.x){let A=y.getWidth(this._activeBuffer.x-1)?1:2;y.addCodepointToCell(this._activeBuffer.x-A,l,o);for(let O=o-M;--O>=0;)y.setCellFromCodepoint(this._activeBuffer.x++,0,0,S);continue}if(f&&(y.insertCells(this._activeBuffer.x,o-M,this._activeBuffer.getNullCell(S)),y.getWidth(_-1)===2&&y.setCellFromCodepoint(_-1,0,1,S)),y.setCellFromCodepoint(this._activeBuffer.x++,l,o,S),o>0)for(;--o;)y.setCellFromCodepoint(this._activeBuffer.x++,0,0,S)}this._parser.precedingJoinState=x,this._activeBuffer.x<_&&n-i>0&&y.getWidth(this._activeBuffer.x)===0&&!y.hasContent(this._activeBuffer.x)&&y.setCellFromCodepoint(this._activeBuffer.x,0,1,S),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(e,i){return e.final==="t"&&!e.prefix&&!e.intermediates?this._parser.registerCsiHandler(e,n=>lm(n.params[0],this._optionsService.rawOptions.windowOptions)?i(n):!0):this._parser.registerCsiHandler(e,i)}registerDcsHandler(e,i){return this._parser.registerDcsHandler(e,new sm(i))}registerEscHandler(e,i){return this._parser.registerEscHandler(e,i)}registerOscHandler(e,i){return this._parser.registerOscHandler(e,new Jt(i))}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 e=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);e.hasWidth(this._activeBuffer.x)&&!e.hasContent(this._activeBuffer.x)&&this._activeBuffer.x--}return this._restrictCursor(),!0}tab(){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let e=this._activeBuffer.x;return this._activeBuffer.x=this._activeBuffer.nextStop(),this._optionsService.rawOptions.screenReaderMode&&this._onA11yTab.fire(this._activeBuffer.x-e),!0}shiftOut(){return this._charsetService.setgLevel(1),!0}shiftIn(){return this._charsetService.setgLevel(0),!0}_restrictCursor(e=this._bufferService.cols-1){this._activeBuffer.x=Math.min(e,Math.max(0,this._activeBuffer.x)),this._activeBuffer.y=this._coreService.decPrivateModes.origin?Math.min(this._activeBuffer.scrollBottom,Math.max(this._activeBuffer.scrollTop,this._activeBuffer.y)):Math.min(this._bufferService.rows-1,Math.max(0,this._activeBuffer.y)),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_setCursor(e,i){this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._coreService.decPrivateModes.origin?(this._activeBuffer.x=e,this._activeBuffer.y=this._activeBuffer.scrollTop+i):(this._activeBuffer.x=e,this._activeBuffer.y=i),this._restrictCursor(),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_moveCursor(e,i){this._restrictCursor(),this._setCursor(this._activeBuffer.x+e,this._activeBuffer.y+i)}cursorUp(e){let i=this._activeBuffer.y-this._activeBuffer.scrollTop;return i>=0?this._moveCursor(0,-Math.min(i,e.params[0]||1)):this._moveCursor(0,-(e.params[0]||1)),!0}cursorDown(e){let i=this._activeBuffer.scrollBottom-this._activeBuffer.y;return i>=0?this._moveCursor(0,Math.min(i,e.params[0]||1)):this._moveCursor(0,e.params[0]||1),!0}cursorForward(e){return this._moveCursor(e.params[0]||1,0),!0}cursorBackward(e){return this._moveCursor(-(e.params[0]||1),0),!0}cursorNextLine(e){return this.cursorDown(e),this._activeBuffer.x=0,!0}cursorPrecedingLine(e){return this.cursorUp(e),this._activeBuffer.x=0,!0}cursorCharAbsolute(e){return this._setCursor((e.params[0]||1)-1,this._activeBuffer.y),!0}cursorPosition(e){return this._setCursor(e.length>=2?(e.params[1]||1)-1:0,(e.params[0]||1)-1),!0}charPosAbsolute(e){return this._setCursor((e.params[0]||1)-1,this._activeBuffer.y),!0}hPositionRelative(e){return this._moveCursor(e.params[0]||1,0),!0}linePosAbsolute(e){return this._setCursor(this._activeBuffer.x,(e.params[0]||1)-1),!0}vPositionRelative(e){return this._moveCursor(0,e.params[0]||1),!0}hVPosition(e){return this.cursorPosition(e),!0}tabClear(e){let i=e.params[0];return i===0?delete this._activeBuffer.tabs[this._activeBuffer.x]:i===3&&(this._activeBuffer.tabs={}),!0}cursorForwardTab(e){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let i=e.params[0]||1;for(;i--;)this._activeBuffer.x=this._activeBuffer.nextStop();return!0}cursorBackwardTab(e){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let i=e.params[0]||1;for(;i--;)this._activeBuffer.x=this._activeBuffer.prevStop();return!0}selectProtected(e){let i=e.params[0];return i===1&&(this._curAttrData.bg|=536870912),(i===2||i===0)&&(this._curAttrData.bg&=-536870913),!0}_eraseInBufferLine(e,i,n,l=!1,o=!1){let h=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);h.replaceCells(i,n,this._activeBuffer.getNullCell(this._eraseAttrData()),o),l&&(h.isWrapped=!1)}_resetBufferLine(e,i=!1){let n=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);n&&(n.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),i),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+e),n.isWrapped=!1)}eraseInDisplay(e,i=!1){this._restrictCursor(this._bufferService.cols);let n;switch(e.params[0]){case 0:for(n=this._activeBuffer.y,this._dirtyRowTracker.markDirty(n),this._eraseInBufferLine(n++,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,i);n<this._bufferService.rows;n++)this._resetBufferLine(n,i);this._dirtyRowTracker.markDirty(n);break;case 1:for(n=this._activeBuffer.y,this._dirtyRowTracker.markDirty(n),this._eraseInBufferLine(n,0,this._activeBuffer.x+1,!0,i),this._activeBuffer.x+1>=this._bufferService.cols&&(this._activeBuffer.lines.get(n+1).isWrapped=!1);n--;)this._resetBufferLine(n,i);this._dirtyRowTracker.markDirty(0);break;case 2:if(this._optionsService.rawOptions.scrollOnEraseInDisplay){for(n=this._bufferService.rows,this._dirtyRowTracker.markRangeDirty(0,n-1);n--&&!this._activeBuffer.lines.get(this._activeBuffer.ybase+n)?.getTrimmedLength(););for(;n>=0;n--)this._bufferService.scroll(this._eraseAttrData())}else{for(n=this._bufferService.rows,this._dirtyRowTracker.markDirty(n-1);n--;)this._resetBufferLine(n,i);this._dirtyRowTracker.markDirty(0)}break;case 3:let l=this._activeBuffer.lines.length-this._bufferService.rows;l>0&&(this._activeBuffer.lines.trimStart(l),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-l,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-l,0),this._onScroll.fire(0));break}return!0}eraseInLine(e,i=!1){switch(this._restrictCursor(this._bufferService.cols),e.params[0]){case 0:this._eraseInBufferLine(this._activeBuffer.y,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,i);break;case 1:this._eraseInBufferLine(this._activeBuffer.y,0,this._activeBuffer.x+1,!1,i);break;case 2:this._eraseInBufferLine(this._activeBuffer.y,0,this._bufferService.cols,!0,i);break}return this._dirtyRowTracker.markDirty(this._activeBuffer.y),!0}insertLines(e){this._restrictCursor();let i=e.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let n=this._activeBuffer.ybase+this._activeBuffer.y,l=this._bufferService.rows-1-this._activeBuffer.scrollBottom,o=this._bufferService.rows-1+this._activeBuffer.ybase-l+1;for(;i--;)this._activeBuffer.lines.splice(o-1,1),this._activeBuffer.lines.splice(n,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}deleteLines(e){this._restrictCursor();let i=e.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let n=this._activeBuffer.ybase+this._activeBuffer.y,l;for(l=this._bufferService.rows-1-this._activeBuffer.scrollBottom,l=this._bufferService.rows-1+this._activeBuffer.ybase-l;i--;)this._activeBuffer.lines.splice(n,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}insertChars(e){this._restrictCursor();let i=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return i&&(i.insertCells(this._activeBuffer.x,e.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}deleteChars(e){this._restrictCursor();let i=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return i&&(i.deleteCells(this._activeBuffer.x,e.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}scrollUp(e){let i=e.params[0]||1;for(;i--;)this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollTop,1),this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollBottom,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollDown(e){let i=e.params[0]||1;for(;i--;)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(lt));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollLeft(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let i=e.params[0]||1;for(let n=this._activeBuffer.scrollTop;n<=this._activeBuffer.scrollBottom;++n){let l=this._activeBuffer.lines.get(this._activeBuffer.ybase+n);l.deleteCells(0,i,this._activeBuffer.getNullCell(this._eraseAttrData())),l.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollRight(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let i=e.params[0]||1;for(let n=this._activeBuffer.scrollTop;n<=this._activeBuffer.scrollBottom;++n){let l=this._activeBuffer.lines.get(this._activeBuffer.ybase+n);l.insertCells(0,i,this._activeBuffer.getNullCell(this._eraseAttrData())),l.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}insertColumns(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let i=e.params[0]||1;for(let n=this._activeBuffer.scrollTop;n<=this._activeBuffer.scrollBottom;++n){let l=this._activeBuffer.lines.get(this._activeBuffer.ybase+n);l.insertCells(this._activeBuffer.x,i,this._activeBuffer.getNullCell(this._eraseAttrData())),l.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}deleteColumns(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let i=e.params[0]||1;for(let n=this._activeBuffer.scrollTop;n<=this._activeBuffer.scrollBottom;++n){let l=this._activeBuffer.lines.get(this._activeBuffer.ybase+n);l.deleteCells(this._activeBuffer.x,i,this._activeBuffer.getNullCell(this._eraseAttrData())),l.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}eraseChars(e){this._restrictCursor();let i=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return i&&(i.replaceCells(this._activeBuffer.x,this._activeBuffer.x+(e.params[0]||1),this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}repeatPrecedingCharacter(e){let i=this._parser.precedingJoinState;if(!i)return!0;let n=e.params[0]||1,l=nr.extractWidth(i),o=this._activeBuffer.x-l,h=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).getString(o),d=new Uint32Array(h.length*n),_=0;for(let f=0;f<h.length;){let S=h.codePointAt(f)||0;d[_++]=S,f+=S>65535?2:1}let p=_;for(let f=1;f<n;++f)d.copyWithin(p,0,_),p+=_;return this.print(d,0,p),!0}sendDeviceAttributesPrimary(e){return e.params[0]>0||(this._is("xterm")||this._is("rxvt-unicode")||this._is("screen")?this._coreService.triggerDataEvent(F.ESC+"[?1;2c"):this._is("linux")&&this._coreService.triggerDataEvent(F.ESC+"[?6c")),!0}sendDeviceAttributesSecondary(e){return e.params[0]>0||(this._is("xterm")?this._coreService.triggerDataEvent(F.ESC+"[>0;276;0c"):this._is("rxvt-unicode")?this._coreService.triggerDataEvent(F.ESC+"[>85;95;0c"):this._is("linux")?this._coreService.triggerDataEvent(e.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent(F.ESC+"[>83;40003;0c")),!0}_is(e){return(this._optionsService.rawOptions.termName+"").indexOf(e)===0}setMode(e){for(let i=0;i<e.length;i++)switch(e.params[i]){case 4:this._coreService.modes.insertMode=!0;break;case 20:this._optionsService.options.convertEol=!0;break}return!0}setModePrivate(e){for(let i=0;i<e.length;i++)switch(e.params[i]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!0;break;case 2:this._charsetService.setgCharset(0,sr),this._charsetService.setgCharset(1,sr),this._charsetService.setgCharset(2,sr),this._charsetService.setgCharset(3,sr);break;case 3:this._optionsService.rawOptions.windowOptions.setWinLines&&(this._bufferService.resize(132,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!0,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!0;break;case 12:this._optionsService.options.cursorBlink=!0;break;case 45:this._coreService.decPrivateModes.reverseWraparound=!0;break;case 66:this._logService.debug("Serial port requested application keypad."),this._coreService.decPrivateModes.applicationKeypad=!0,this._onRequestSyncScrollBar.fire();break;case 9:this._coreMouseService.activeProtocol="X10";break;case 1e3:this._coreMouseService.activeProtocol="VT200";break;case 1002:this._coreMouseService.activeProtocol="DRAG";break;case 1003:this._coreMouseService.activeProtocol="ANY";break;case 1004:this._coreService.decPrivateModes.sendFocus=!0,this._onRequestSendFocus.fire();break;case 1005:this._logService.debug("DECSET 1005 not supported (see #2507)");break;case 1006:this._coreMouseService.activeEncoding="SGR";break;case 1015:this._logService.debug("DECSET 1015 not supported (see #2507)");break;case 1016:this._coreMouseService.activeEncoding="SGR_PIXELS";break;case 25:this._coreService.isCursorHidden=!1;break;case 1048:this.saveCursor();break;case 1049:this.saveCursor();case 47:case 1047:this._bufferService.buffers.activateAltBuffer(this._eraseAttrData()),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(void 0),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!0;break;case 2026:this._coreService.decPrivateModes.synchronizedOutput=!0;break}return!0}resetMode(e){for(let i=0;i<e.length;i++)switch(e.params[i]){case 4:this._coreService.modes.insertMode=!1;break;case 20:this._optionsService.options.convertEol=!1;break}return!0}resetModePrivate(e){for(let i=0;i<e.length;i++)switch(e.params[i]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!1;break;case 3:this._optionsService.rawOptions.windowOptions.setWinLines&&(this._bufferService.resize(80,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!1,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!1;break;case 12:this._optionsService.options.cursorBlink=!1;break;case 45:this._coreService.decPrivateModes.reverseWraparound=!1;break;case 66:this._logService.debug("Switching back to normal keypad."),this._coreService.decPrivateModes.applicationKeypad=!1,this._onRequestSyncScrollBar.fire();break;case 9:case 1e3:case 1002:case 1003:this._coreMouseService.activeProtocol="NONE";break;case 1004:this._coreService.decPrivateModes.sendFocus=!1;break;case 1005:this._logService.debug("DECRST 1005 not supported (see #2507)");break;case 1006:this._coreMouseService.activeEncoding="DEFAULT";break;case 1015:this._logService.debug("DECRST 1015 not supported (see #2507)");break;case 1016:this._coreMouseService.activeEncoding="DEFAULT";break;case 25:this._coreService.isCursorHidden=!0;break;case 1048:this.restoreCursor();break;case 1049:case 47:case 1047:this._bufferService.buffers.activateNormalBuffer(),e.params[i]===1049&&this.restoreCursor(),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(void 0),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!1;break;case 2026:this._coreService.decPrivateModes.synchronizedOutput=!1,this._onRequestRefreshRows.fire(void 0);break}return!0}requestMode(e,i){let n;(T=>(T[T.NOT_RECOGNIZED=0]="NOT_RECOGNIZED",T[T.SET=1]="SET",T[T.RESET=2]="RESET",T[T.PERMANENTLY_SET=3]="PERMANENTLY_SET",T[T.PERMANENTLY_RESET=4]="PERMANENTLY_RESET"))(n||={});let l=this._coreService.decPrivateModes,{activeProtocol:o,activeEncoding:h}=this._coreMouseService,d=this._coreService,{buffers:_,cols:p}=this._bufferService,{active:f,alt:S}=_,y=this._optionsService.rawOptions,x=(T,M)=>(d.triggerDataEvent(`${F.ESC}[${i?"":"?"}${T};${M}$y`),!0),C=T=>T?1:2,b=e.params[0];return i?b===2?x(b,4):b===4?x(b,C(d.modes.insertMode)):b===12?x(b,3):b===20?x(b,C(y.convertEol)):x(b,0):b===1?x(b,C(l.applicationCursorKeys)):b===3?x(b,y.windowOptions.setWinLines?p===80?2:p===132?1:0:0):b===6?x(b,C(l.origin)):b===7?x(b,C(l.wraparound)):b===8?x(b,3):b===9?x(b,C(o==="X10")):b===12?x(b,C(y.cursorBlink)):b===25?x(b,C(!d.isCursorHidden)):b===45?x(b,C(l.reverseWraparound)):b===66?x(b,C(l.applicationKeypad)):b===67?x(b,4):b===1e3?x(b,C(o==="VT200")):b===1002?x(b,C(o==="DRAG")):b===1003?x(b,C(o==="ANY")):b===1004?x(b,C(l.sendFocus)):b===1005?x(b,4):b===1006?x(b,C(h==="SGR")):b===1015?x(b,4):b===1016?x(b,C(h==="SGR_PIXELS")):b===1048?x(b,1):b===47||b===1047||b===1049?x(b,C(f===S)):b===2004?x(b,C(l.bracketedPasteMode)):b===2026?x(b,C(l.synchronizedOutput)):x(b,0)}_updateAttrColor(e,i,n,l,o){return i===2?(e|=50331648,e&=-16777216,e|=ml.fromColorRGB([n,l,o])):i===5&&(e&=-50331904,e|=33554432|n&255),e}_extractColor(e,i,n){let l=[0,0,-1,0,0,0],o=0,h=0;do{if(l[h+o]=e.params[i+h],e.hasSubParams(i+h)){let d=e.getSubParams(i+h),_=0;do l[1]===5&&(o=1),l[h+_+1+o]=d[_];while(++_<d.length&&_+h+1+o<l.length);break}if(l[1]===5&&h+o>=2||l[1]===2&&h+o>=5)break;l[1]&&(o=1)}while(++h+i<e.length&&h+o<l.length);for(let d=2;d<l.length;++d)l[d]===-1&&(l[d]=0);switch(l[0]){case 38:n.fg=this._updateAttrColor(n.fg,l[1],l[3],l[4],l[5]);break;case 48:n.bg=this._updateAttrColor(n.bg,l[1],l[3],l[4],l[5]);break;case 58:n.extended=n.extended.clone(),n.extended.underlineColor=this._updateAttrColor(n.extended.underlineColor,l[1],l[3],l[4],l[5])}return h}_processUnderline(e,i){i.extended=i.extended.clone(),(!~e||e>5)&&(e=1),i.extended.underlineStyle=e,i.fg|=268435456,e===0&&(i.fg&=-268435457),i.updateExtended()}_processSGR0(e){e.fg=lt.fg,e.bg=lt.bg,e.extended=e.extended.clone(),e.extended.underlineStyle=0,e.extended.underlineColor&=-67108864,e.updateExtended()}charAttributes(e){if(e.length===1&&e.params[0]===0)return this._processSGR0(this._curAttrData),!0;let i=e.length,n,l=this._curAttrData;for(let o=0;o<i;o++)n=e.params[o],n>=30&&n<=37?(l.fg&=-50331904,l.fg|=16777216|n-30):n>=40&&n<=47?(l.bg&=-50331904,l.bg|=16777216|n-40):n>=90&&n<=97?(l.fg&=-50331904,l.fg|=16777216|n-90|8):n>=100&&n<=107?(l.bg&=-50331904,l.bg|=16777216|n-100|8):n===0?this._processSGR0(l):n===1?l.fg|=134217728:n===3?l.bg|=67108864:n===4?(l.fg|=268435456,this._processUnderline(e.hasSubParams(o)?e.getSubParams(o)[0]:1,l)):n===5?l.fg|=536870912:n===7?l.fg|=67108864:n===8?l.fg|=1073741824:n===9?l.fg|=2147483648:n===2?l.bg|=134217728:n===21?this._processUnderline(2,l):n===22?(l.fg&=-134217729,l.bg&=-134217729):n===23?l.bg&=-67108865:n===24?(l.fg&=-268435457,this._processUnderline(0,l)):n===25?l.fg&=-536870913:n===27?l.fg&=-67108865:n===28?l.fg&=-1073741825:n===29?l.fg&=2147483647:n===39?(l.fg&=-67108864,l.fg|=lt.fg&16777215):n===49?(l.bg&=-67108864,l.bg|=lt.bg&16777215):n===38||n===48||n===58?o+=this._extractColor(e,o,l):n===53?l.bg|=1073741824:n===55?l.bg&=-1073741825:n===59?(l.extended=l.extended.clone(),l.extended.underlineColor=-1,l.updateExtended()):n===100?(l.fg&=-67108864,l.fg|=lt.fg&16777215,l.bg&=-67108864,l.bg|=lt.bg&16777215):this._logService.debug("Unknown SGR attribute: %d.",n);return!0}deviceStatus(e){switch(e.params[0]){case 5:this._coreService.triggerDataEvent(`${F.ESC}[0n`);break;case 6:let i=this._activeBuffer.y+1,n=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${F.ESC}[${i};${n}R`);break}return!0}deviceStatusPrivate(e){if(e.params[0]===6){let i=this._activeBuffer.y+1,n=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${F.ESC}[?${i};${n}R`)}return!0}softReset(e){return this._coreService.isCursorHidden=!1,this._onRequestSyncScrollBar.fire(),this._activeBuffer.scrollTop=0,this._activeBuffer.scrollBottom=this._bufferService.rows-1,this._curAttrData=lt.clone(),this._coreService.reset(),this._charsetService.reset(),this._activeBuffer.savedX=0,this._activeBuffer.savedY=this._activeBuffer.ybase,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,this._coreService.decPrivateModes.origin=!1,!0}setCursorStyle(e){let i=e.length===0?1:e.params[0];if(i===0)this._coreService.decPrivateModes.cursorStyle=void 0,this._coreService.decPrivateModes.cursorBlink=void 0;else{switch(i){case 1:case 2:this._coreService.decPrivateModes.cursorStyle="block";break;case 3:case 4:this._coreService.decPrivateModes.cursorStyle="underline";break;case 5:case 6:this._coreService.decPrivateModes.cursorStyle="bar";break}let n=i%2===1;this._coreService.decPrivateModes.cursorBlink=n}return!0}setScrollRegion(e){let i=e.params[0]||1,n;return(e.length<2||(n=e.params[1])>this._bufferService.rows||n===0)&&(n=this._bufferService.rows),n>i&&(this._activeBuffer.scrollTop=i-1,this._activeBuffer.scrollBottom=n-1,this._setCursor(0,0)),!0}windowOptions(e){if(!lm(e.params[0],this._optionsService.rawOptions.windowOptions))return!0;let i=e.length>1?e.params[1]:0;switch(e.params[0]){case 14:i!==2&&this._onRequestWindowsOptionsReport.fire(0);break;case 16:this._onRequestWindowsOptionsReport.fire(1);break;case 18:this._bufferService&&this._coreService.triggerDataEvent(`${F.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);break;case 22:(i===0||i===2)&&(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>nm&&this._windowTitleStack.shift()),(i===0||i===1)&&(this._iconNameStack.push(this._iconName),this._iconNameStack.length>nm&&this._iconNameStack.shift());break;case 23:(i===0||i===2)&&this._windowTitleStack.length&&this.setTitle(this._windowTitleStack.pop()),(i===0||i===1)&&this._iconNameStack.length&&this.setIconName(this._iconNameStack.pop());break}return!0}saveCursor(e){return this._activeBuffer.savedX=this._activeBuffer.x,this._activeBuffer.savedY=this._activeBuffer.ybase+this._activeBuffer.y,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,!0}restoreCursor(e){return this._activeBuffer.x=this._activeBuffer.savedX||0,this._activeBuffer.y=Math.max(this._activeBuffer.savedY-this._activeBuffer.ybase,0),this._curAttrData.fg=this._activeBuffer.savedCurAttrData.fg,this._curAttrData.bg=this._activeBuffer.savedCurAttrData.bg,this._charsetService.charset=this._savedCharset,this._activeBuffer.savedCharset&&(this._charsetService.charset=this._activeBuffer.savedCharset),this._restrictCursor(),!0}setTitle(e){return this._windowTitle=e,this._onTitleChange.fire(e),!0}setIconName(e){return this._iconName=e,!0}setOrReportIndexedColor(e){let i=[],n=e.split(";");for(;n.length>1;){let l=n.shift(),o=n.shift();if(/^\d+$/.exec(l)){let h=parseInt(l);if(cm(h))if(o==="?")i.push({type:0,index:h});else{let d=rm(o);d&&i.push({type:1,index:h,color:d})}}}return i.length&&this._onColor.fire(i),!0}setHyperlink(e){let i=e.indexOf(";");if(i===-1)return!0;let n=e.slice(0,i).trim(),l=e.slice(i+1);return l?this._createHyperlink(n,l):n.trim()?!1:this._finishHyperlink()}_createHyperlink(e,i){this._getCurrentLinkId()&&this._finishHyperlink();let n=e.split(":"),l,o=n.findIndex(h=>h.startsWith("id="));return o!==-1&&(l=n[o].slice(3)||void 0),this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=this._oscLinkService.registerLink({id:l,uri:i}),this._curAttrData.updateExtended(),!0}_finishHyperlink(){return this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=0,this._curAttrData.updateExtended(),!0}_setOrReportSpecialColor(e,i){let n=e.split(";");for(let l=0;l<n.length&&!(i>=this._specialColors.length);++l,++i)if(n[l]==="?")this._onColor.fire([{type:0,index:this._specialColors[i]}]);else{let o=rm(n[l]);o&&this._onColor.fire([{type:1,index:this._specialColors[i],color:o}])}return!0}setOrReportFgColor(e){return this._setOrReportSpecialColor(e,0)}setOrReportBgColor(e){return this._setOrReportSpecialColor(e,1)}setOrReportCursorColor(e){return this._setOrReportSpecialColor(e,2)}restoreIndexedColor(e){if(!e)return this._onColor.fire([{type:2}]),!0;let i=[],n=e.split(";");for(let l=0;l<n.length;++l)if(/^\d+$/.exec(n[l])){let o=parseInt(n[l]);cm(o)&&i.push({type:2,index:o})}return i.length&&this._onColor.fire(i),!0}restoreFgColor(e){return this._onColor.fire([{type:2,index:256}]),!0}restoreBgColor(e){return this._onColor.fire([{type:2,index:257}]),!0}restoreCursorColor(e){return this._onColor.fire([{type:2,index:258}]),!0}nextLine(){return this._activeBuffer.x=0,this.index(),!0}keypadApplicationMode(){return this._logService.debug("Serial port requested application keypad."),this._coreService.decPrivateModes.applicationKeypad=!0,this._onRequestSyncScrollBar.fire(),!0}keypadNumericMode(){return this._logService.debug("Switching back to normal keypad."),this._coreService.decPrivateModes.applicationKeypad=!1,this._onRequestSyncScrollBar.fire(),!0}selectDefaultCharset(){return this._charsetService.setgLevel(0),this._charsetService.setgCharset(0,sr),!0}selectCharset(e){return e.length!==2?(this.selectDefaultCharset(),!0):(e[0]==="/"||this._charsetService.setgCharset(hw[e[0]],dt[e[1]]||sr),!0)}index(){return this._restrictCursor(),this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData())):this._activeBuffer.y>=this._bufferService.rows&&(this._activeBuffer.y=this._bufferService.rows-1),this._restrictCursor(),!0}tabSet(){return this._activeBuffer.tabs[this._activeBuffer.x]=!0,!0}reverseIndex(){if(this._restrictCursor(),this._activeBuffer.y===this._activeBuffer.scrollTop){let e=this._activeBuffer.scrollBottom-this._activeBuffer.scrollTop;this._activeBuffer.lines.shiftElements(this._activeBuffer.ybase+this._activeBuffer.y,e,1),this._activeBuffer.lines.set(this._activeBuffer.ybase+this._activeBuffer.y,this._activeBuffer.getBlankLine(this._eraseAttrData())),this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom)}else this._activeBuffer.y--,this._restrictCursor();return!0}fullReset(){return this._parser.reset(),this._onRequestReset.fire(),!0}reset(){this._curAttrData=lt.clone(),this._eraseAttrDataInternal=lt.clone()}_eraseAttrData(){return this._eraseAttrDataInternal.bg&=-67108864,this._eraseAttrDataInternal.bg|=this._curAttrData.bg&67108863,this._eraseAttrDataInternal}setgLevel(e){return this._charsetService.setgLevel(e),!0}screenAlignmentPattern(){let e=new gi;e.content=1<<22|69,e.fg=this._curAttrData.fg,e.bg=this._curAttrData.bg,this._setCursor(0,0);for(let i=0;i<this._bufferService.rows;++i){let n=this._activeBuffer.ybase+this._activeBuffer.y+i,l=this._activeBuffer.lines.get(n);l&&(l.fill(e),l.isWrapped=!1)}return this._dirtyRowTracker.markAllDirty(),this._setCursor(0,0),!0}requestStatusString(e,i){let n=d=>(this._coreService.triggerDataEvent(`${F.ESC}${d}${F.ESC}\\`),!0),l=this._bufferService.buffer,o=this._optionsService.rawOptions;return n(e==='"q'?`P1$r${this._curAttrData.isProtected()?1:0}"q`:e==='"p'?'P1$r61;1"p':e==="r"?`P1$r${l.scrollTop+1};${l.scrollBottom+1}r`:e==="m"?"P1$r0m":e===" q"?`P1$r${{block:2,underline:4,bar:6}[o.cursorStyle]-(o.cursorBlink?1:0)} q`:"P0$r")}markRangeDirty(e,i){this._dirtyRowTracker.markRangeDirty(e,i)}},ju=class{constructor(e){this._bufferService=e,this.clearRange()}clearRange(){this.start=this._bufferService.buffer.y,this.end=this._bufferService.buffer.y}markDirty(e){e<this.start?this.start=e:e>this.end&&(this.end=e)}markRangeDirty(e,i){e>i&&(om=e,e=i,i=om),e<this.start&&(this.start=e),i>this.end&&(this.end=i)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};ju=Qe([se(0,zt)],ju);function cm(e){return 0<=e&&e<256}var dw=5e7,hm=12,fw=50,pw=class extends Se{constructor(e){super(),this._action=e,this._writeBuffer=[],this._callbacks=[],this._pendingData=0,this._bufferOffset=0,this._isSyncWriting=!1,this._syncCalls=0,this._didUserInput=!1,this._onWriteParsed=this._register(new Q),this.onWriteParsed=this._onWriteParsed.event}handleUserInput(){this._didUserInput=!0}writeSync(e,i){if(i!==void 0&&this._syncCalls>i){this._syncCalls=0;return}if(this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(void 0),this._syncCalls++,this._isSyncWriting)return;this._isSyncWriting=!0;let n;for(;n=this._writeBuffer.shift();){this._action(n);let l=this._callbacks.shift();l&&l()}this._pendingData=0,this._bufferOffset=2147483647,this._isSyncWriting=!1,this._syncCalls=0}write(e,i){if(this._pendingData>dw)throw new Error("write data discarded, use flow control to avoid losing data");if(!this._writeBuffer.length){if(this._bufferOffset=0,this._didUserInput){this._didUserInput=!1,this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(i),this._innerWrite();return}setTimeout(()=>this._innerWrite())}this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(i)}_innerWrite(e=0,i=!0){let n=e||performance.now();for(;this._writeBuffer.length>this._bufferOffset;){let l=this._writeBuffer[this._bufferOffset],o=this._action(l,i);if(o){let d=_=>performance.now()-n>=hm?setTimeout(()=>this._innerWrite(0,_)):this._innerWrite(n,_);o.catch(_=>(queueMicrotask(()=>{throw _}),Promise.resolve(!1))).then(d);return}let h=this._callbacks[this._bufferOffset];if(h&&h(),this._bufferOffset++,this._pendingData-=l.length,performance.now()-n>=hm)break}this._writeBuffer.length>this._bufferOffset?(this._bufferOffset>fw&&(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()}},Nu=class{constructor(e){this._bufferService=e,this._nextId=1,this._entriesWithId=new Map,this._dataByLinkId=new Map}registerLink(e){let i=this._bufferService.buffer;if(e.id===void 0){let _=i.addMarker(i.ybase+i.y),p={data:e,id:this._nextId++,lines:[_]};return _.onDispose(()=>this._removeMarkerFromLink(p,_)),this._dataByLinkId.set(p.id,p),p.id}let n=e,l=this._getEntryIdKey(n),o=this._entriesWithId.get(l);if(o)return this.addLineToLink(o.id,i.ybase+i.y),o.id;let h=i.addMarker(i.ybase+i.y),d={id:this._nextId++,key:this._getEntryIdKey(n),data:n,lines:[h]};return h.onDispose(()=>this._removeMarkerFromLink(d,h)),this._entriesWithId.set(d.key,d),this._dataByLinkId.set(d.id,d),d.id}addLineToLink(e,i){let n=this._dataByLinkId.get(e);if(n&&n.lines.every(l=>l.line!==i)){let l=this._bufferService.buffer.addMarker(i);n.lines.push(l),l.onDispose(()=>this._removeMarkerFromLink(n,l))}}getLinkData(e){return this._dataByLinkId.get(e)?.data}_getEntryIdKey(e){return`${e.id};;${e.uri}`}_removeMarkerFromLink(e,i){let n=e.lines.indexOf(i);n!==-1&&(e.lines.splice(n,1),e.lines.length===0&&(e.data.id!==void 0&&this._entriesWithId.delete(e.key),this._dataByLinkId.delete(e.id)))}};Nu=Qe([se(0,zt)],Nu);var um=!1,_w=class extends Se{constructor(e){super(),this._windowsWrappingHeuristics=this._register(new Jr),this._onBinary=this._register(new Q),this.onBinary=this._onBinary.event,this._onData=this._register(new Q),this.onData=this._onData.event,this._onLineFeed=this._register(new Q),this.onLineFeed=this._onLineFeed.event,this._onResize=this._register(new Q),this.onResize=this._onResize.event,this._onWriteParsed=this._register(new Q),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this._register(new Q),this._instantiationService=new U1,this.optionsService=this._register(new X1(e)),this._instantiationService.setService(At,this.optionsService),this._bufferService=this._register(this._instantiationService.createInstance(zu)),this._instantiationService.setService(zt,this._bufferService),this._logService=this._register(this._instantiationService.createInstance(Mu)),this._instantiationService.setService($m,this._logService),this.coreService=this._register(this._instantiationService.createInstance(Au)),this._instantiationService.setService(hr,this.coreService),this.coreMouseService=this._register(this._instantiationService.createInstance(Ou)),this._instantiationService.setService(Ym,this.coreMouseService),this.unicodeService=this._register(this._instantiationService.createInstance(nr)),this._instantiationService.setService(Lb,this.unicodeService),this._charsetService=this._instantiationService.createInstance(ew),this._instantiationService.setService(Ob,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(Nu),this._instantiationService.setService(Km,this._oscLinkService),this._inputHandler=this._register(new uw(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService)),this._register(kt.forward(this._inputHandler.onLineFeed,this._onLineFeed)),this._register(this._inputHandler),this._register(kt.forward(this._bufferService.onResize,this._onResize)),this._register(kt.forward(this.coreService.onData,this._onData)),this._register(kt.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 pw((i,n)=>this._inputHandler.parse(i,n))),this._register(kt.forward(this._writeBuffer.onWriteParsed,this._onWriteParsed))}get onScroll(){return this._onScrollApi||(this._onScrollApi=this._register(new Q),this._onScroll.event(e=>{this._onScrollApi?.fire(e.position)})),this._onScrollApi.event}get cols(){return this._bufferService.cols}get rows(){return this._bufferService.rows}get buffers(){return this._bufferService.buffers}get options(){return this.optionsService.options}set options(e){for(let i in e)this.optionsService.options[i]=e[i]}write(e,i){this._writeBuffer.write(e,i)}writeSync(e,i){this._logService.logLevel<=3&&!um&&(this._logService.warn("writeSync is unreliable and will be removed soon."),um=!0),this._writeBuffer.writeSync(e,i)}input(e,i=!0){this.coreService.triggerDataEvent(e,i)}resize(e,i){isNaN(e)||isNaN(i)||(e=Math.max(e,Cv),i=Math.max(i,kv),this._bufferService.resize(e,i))}scroll(e,i=!1){this._bufferService.scroll(e,i)}scrollLines(e,i){this._bufferService.scrollLines(e,i)}scrollPages(e){this.scrollLines(e*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(e){this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(e){let i=e-this._bufferService.buffer.ydisp;i!==0&&this.scrollLines(i)}registerEscHandler(e,i){return this._inputHandler.registerEscHandler(e,i)}registerDcsHandler(e,i){return this._inputHandler.registerDcsHandler(e,i)}registerCsiHandler(e,i){return this._inputHandler.registerCsiHandler(e,i)}registerOscHandler(e,i){return this._inputHandler.registerOscHandler(e,i)}_setup(){this._handleWindowsPtyOptionChange()}reset(){this._inputHandler.reset(),this._bufferService.reset(),this._charsetService.reset(),this.coreService.reset(),this.coreMouseService.reset()}_handleWindowsPtyOptionChange(){let e=!1,i=this.optionsService.rawOptions.windowsPty;i&&i.buildNumber!==void 0&&i.buildNumber!==void 0?e=i.backend==="conpty"&&i.buildNumber<21376:this.optionsService.rawOptions.windowsMode&&(e=!0),e?this._enableWindowsWrappingHeuristics():this._windowsWrappingHeuristics.clear()}_enableWindowsWrappingHeuristics(){if(!this._windowsWrappingHeuristics.value){let e=[];e.push(this.onLineFeed(im.bind(null,this._bufferService))),e.push(this.registerCsiHandler({final:"H"},()=>(im(this._bufferService),!1))),this._windowsWrappingHeuristics.value=$e(()=>{for(let i of e)i.dispose()})}}},gw={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 mw(e,i,n,l){let o={type:0,cancel:!1,key:void 0},h=(e.shiftKey?1:0)|(e.altKey?2:0)|(e.ctrlKey?4:0)|(e.metaKey?8:0);switch(e.keyCode){case 0:e.key==="UIKeyInputUpArrow"?i?o.key=F.ESC+"OA":o.key=F.ESC+"[A":e.key==="UIKeyInputLeftArrow"?i?o.key=F.ESC+"OD":o.key=F.ESC+"[D":e.key==="UIKeyInputRightArrow"?i?o.key=F.ESC+"OC":o.key=F.ESC+"[C":e.key==="UIKeyInputDownArrow"&&(i?o.key=F.ESC+"OB":o.key=F.ESC+"[B");break;case 8:o.key=e.ctrlKey?"\b":F.DEL,e.altKey&&(o.key=F.ESC+o.key);break;case 9:if(e.shiftKey){o.key=F.ESC+"[Z";break}o.key=F.HT,o.cancel=!0;break;case 13:o.key=e.altKey?F.ESC+F.CR:F.CR,o.cancel=!0;break;case 27:o.key=F.ESC,e.altKey&&(o.key=F.ESC+F.ESC),o.cancel=!0;break;case 37:if(e.metaKey)break;h?o.key=F.ESC+"[1;"+(h+1)+"D":i?o.key=F.ESC+"OD":o.key=F.ESC+"[D";break;case 39:if(e.metaKey)break;h?o.key=F.ESC+"[1;"+(h+1)+"C":i?o.key=F.ESC+"OC":o.key=F.ESC+"[C";break;case 38:if(e.metaKey)break;h?o.key=F.ESC+"[1;"+(h+1)+"A":i?o.key=F.ESC+"OA":o.key=F.ESC+"[A";break;case 40:if(e.metaKey)break;h?o.key=F.ESC+"[1;"+(h+1)+"B":i?o.key=F.ESC+"OB":o.key=F.ESC+"[B";break;case 45:!e.shiftKey&&!e.ctrlKey&&(o.key=F.ESC+"[2~");break;case 46:h?o.key=F.ESC+"[3;"+(h+1)+"~":o.key=F.ESC+"[3~";break;case 36:h?o.key=F.ESC+"[1;"+(h+1)+"H":i?o.key=F.ESC+"OH":o.key=F.ESC+"[H";break;case 35:h?o.key=F.ESC+"[1;"+(h+1)+"F":i?o.key=F.ESC+"OF":o.key=F.ESC+"[F";break;case 33:e.shiftKey?o.type=2:e.ctrlKey?o.key=F.ESC+"[5;"+(h+1)+"~":o.key=F.ESC+"[5~";break;case 34:e.shiftKey?o.type=3:e.ctrlKey?o.key=F.ESC+"[6;"+(h+1)+"~":o.key=F.ESC+"[6~";break;case 112:h?o.key=F.ESC+"[1;"+(h+1)+"P":o.key=F.ESC+"OP";break;case 113:h?o.key=F.ESC+"[1;"+(h+1)+"Q":o.key=F.ESC+"OQ";break;case 114:h?o.key=F.ESC+"[1;"+(h+1)+"R":o.key=F.ESC+"OR";break;case 115:h?o.key=F.ESC+"[1;"+(h+1)+"S":o.key=F.ESC+"OS";break;case 116:h?o.key=F.ESC+"[15;"+(h+1)+"~":o.key=F.ESC+"[15~";break;case 117:h?o.key=F.ESC+"[17;"+(h+1)+"~":o.key=F.ESC+"[17~";break;case 118:h?o.key=F.ESC+"[18;"+(h+1)+"~":o.key=F.ESC+"[18~";break;case 119:h?o.key=F.ESC+"[19;"+(h+1)+"~":o.key=F.ESC+"[19~";break;case 120:h?o.key=F.ESC+"[20;"+(h+1)+"~":o.key=F.ESC+"[20~";break;case 121:h?o.key=F.ESC+"[21;"+(h+1)+"~":o.key=F.ESC+"[21~";break;case 122:h?o.key=F.ESC+"[23;"+(h+1)+"~":o.key=F.ESC+"[23~";break;case 123:h?o.key=F.ESC+"[24;"+(h+1)+"~":o.key=F.ESC+"[24~";break;default:if(e.ctrlKey&&!e.shiftKey&&!e.altKey&&!e.metaKey)e.keyCode>=65&&e.keyCode<=90?o.key=String.fromCharCode(e.keyCode-64):e.keyCode===32?o.key=F.NUL:e.keyCode>=51&&e.keyCode<=55?o.key=String.fromCharCode(e.keyCode-51+27):e.keyCode===56?o.key=F.DEL:e.keyCode===219?o.key=F.ESC:e.keyCode===220?o.key=F.FS:e.keyCode===221&&(o.key=F.GS);else if((!n||l)&&e.altKey&&!e.metaKey){let d=gw[e.keyCode]?.[e.shiftKey?1:0];if(d)o.key=F.ESC+d;else if(e.keyCode>=65&&e.keyCode<=90){let _=e.ctrlKey?e.keyCode-64:e.keyCode+32,p=String.fromCharCode(_);e.shiftKey&&(p=p.toUpperCase()),o.key=F.ESC+p}else if(e.keyCode===32)o.key=F.ESC+(e.ctrlKey?F.NUL:" ");else if(e.key==="Dead"&&e.code.startsWith("Key")){let _=e.code.slice(3,4);e.shiftKey||(_=_.toLowerCase()),o.key=F.ESC+_,o.cancel=!0}}else n&&!e.altKey&&!e.ctrlKey&&!e.shiftKey&&e.metaKey?e.keyCode===65&&(o.type=1):e.key&&!e.ctrlKey&&!e.altKey&&!e.metaKey&&e.keyCode>=48&&e.key.length===1?o.key=e.key:e.key&&e.ctrlKey&&(e.key==="_"&&(o.key=F.US),e.key==="@"&&(o.key=F.NUL));break}return o}var tt=0,vw=class{constructor(e){this._getKey=e,this._array=[],this._insertedValues=[],this._flushInsertedTask=new so,this._isFlushingInserted=!1,this._deletedIndices=[],this._flushDeletedTask=new so,this._isFlushingDeleted=!1}clear(){this._array.length=0,this._insertedValues.length=0,this._flushInsertedTask.clear(),this._isFlushingInserted=!1,this._deletedIndices.length=0,this._flushDeletedTask.clear(),this._isFlushingDeleted=!1}insert(e){this._flushCleanupDeleted(),this._insertedValues.length===0&&this._flushInsertedTask.enqueue(()=>this._flushInserted()),this._insertedValues.push(e)}_flushInserted(){let e=this._insertedValues.sort((o,h)=>this._getKey(o)-this._getKey(h)),i=0,n=0,l=new Array(this._array.length+this._insertedValues.length);for(let o=0;o<l.length;o++)n>=this._array.length||this._getKey(e[i])<=this._getKey(this._array[n])?(l[o]=e[i],i++):l[o]=this._array[n++];this._array=l,this._insertedValues.length=0}_flushCleanupInserted(){!this._isFlushingInserted&&this._insertedValues.length>0&&this._flushInsertedTask.flush()}delete(e){if(this._flushCleanupInserted(),this._array.length===0)return!1;let i=this._getKey(e);if(i===void 0||(tt=this._search(i),tt===-1)||this._getKey(this._array[tt])!==i)return!1;do if(this._array[tt]===e)return this._deletedIndices.length===0&&this._flushDeletedTask.enqueue(()=>this._flushDeleted()),this._deletedIndices.push(tt),!0;while(++tt<this._array.length&&this._getKey(this._array[tt])===i);return!1}_flushDeleted(){this._isFlushingDeleted=!0;let e=this._deletedIndices.sort((o,h)=>o-h),i=0,n=new Array(this._array.length-e.length),l=0;for(let o=0;o<this._array.length;o++)e[i]===o?i++:n[l++]=this._array[o];this._array=n,this._deletedIndices.length=0,this._isFlushingDeleted=!1}_flushCleanupDeleted(){!this._isFlushingDeleted&&this._deletedIndices.length>0&&this._flushDeletedTask.flush()}*getKeyIterator(e){if(this._flushCleanupInserted(),this._flushCleanupDeleted(),this._array.length!==0&&(tt=this._search(e),!(tt<0||tt>=this._array.length)&&this._getKey(this._array[tt])===e))do yield this._array[tt];while(++tt<this._array.length&&this._getKey(this._array[tt])===e)}forEachByKey(e,i){if(this._flushCleanupInserted(),this._flushCleanupDeleted(),this._array.length!==0&&(tt=this._search(e),!(tt<0||tt>=this._array.length)&&this._getKey(this._array[tt])===e))do i(this._array[tt]);while(++tt<this._array.length&&this._getKey(this._array[tt])===e)}values(){return this._flushCleanupInserted(),this._flushCleanupDeleted(),[...this._array].values()}_search(e){let i=0,n=this._array.length-1;for(;n>=i;){let l=i+n>>1,o=this._getKey(this._array[l]);if(o>e)n=l-1;else if(o<e)i=l+1;else{for(;l>0&&this._getKey(this._array[l-1])===e;)l--;return l}}return i}},eu=0,dm=0,yw=class extends Se{constructor(){super(),this._decorations=new vw(e=>e?.marker.line),this._onDecorationRegistered=this._register(new Q),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this._register(new Q),this.onDecorationRemoved=this._onDecorationRemoved.event,this._register($e(()=>this.reset()))}get decorations(){return this._decorations.values()}registerDecoration(e){if(e.marker.isDisposed)return;let i=new Sw(e);if(i){let n=i.marker.onDispose(()=>i.dispose()),l=i.onDispose(()=>{l.dispose(),i&&(this._decorations.delete(i)&&this._onDecorationRemoved.fire(i),n.dispose())});this._decorations.insert(i),this._onDecorationRegistered.fire(i)}return i}reset(){for(let e of this._decorations.values())e.dispose();this._decorations.clear()}*getDecorationsAtCell(e,i,n){let l=0,o=0;for(let h of this._decorations.getKeyIterator(i))l=h.options.x??0,o=l+(h.options.width??1),e>=l&&e<o&&(!n||(h.options.layer??"bottom")===n)&&(yield h)}forEachDecorationAtCell(e,i,n,l){this._decorations.forEachByKey(i,o=>{eu=o.options.x??0,dm=eu+(o.options.width??1),e>=eu&&e<dm&&(!n||(o.options.layer??"bottom")===n)&&l(o)})}},Sw=class extends js{constructor(e){super(),this.options=e,this.onRenderEmitter=this.add(new Q),this.onRender=this.onRenderEmitter.event,this._onDispose=this.add(new Q),this.onDispose=this._onDispose.event,this._cachedBg=null,this._cachedFg=null,this.marker=e.marker,this.options.overviewRulerOptions&&!this.options.overviewRulerOptions.position&&(this.options.overviewRulerOptions.position="full")}get backgroundColorRGB(){return this._cachedBg===null&&(this.options.backgroundColor?this._cachedBg=Ge.toColor(this.options.backgroundColor):this._cachedBg=void 0),this._cachedBg}get foregroundColorRGB(){return this._cachedFg===null&&(this.options.foregroundColor?this._cachedFg=Ge.toColor(this.options.foregroundColor):this._cachedFg=void 0),this._cachedFg}dispose(){this._onDispose.fire(),super.dispose()}},bw=1e3,xw=class{constructor(e,i=bw){this._renderCallback=e,this._debounceThresholdMS=i,this._lastRefreshMs=0,this._additionalRefreshRequested=!1}dispose(){this._refreshTimeoutID&&clearTimeout(this._refreshTimeoutID)}refresh(e,i,n){this._rowCount=n,e=e!==void 0?e:0,i=i!==void 0?i:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,e):e,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,i):i;let l=performance.now();if(l-this._lastRefreshMs>=this._debounceThresholdMS)this._lastRefreshMs=l,this._innerRefresh();else if(!this._additionalRefreshRequested){let o=l-this._lastRefreshMs,h=this._debounceThresholdMS-o;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 e=Math.max(this._rowStart,0),i=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(e,i)}},fm=20,ro=class extends Se{constructor(e,i,n,l){super(),this._terminal=e,this._coreBrowserService=n,this._renderService=l,this._rowColumns=new WeakMap,this._liveRegionLineCount=0,this._charsToConsume=[],this._charsToAnnounce="";let o=this._coreBrowserService.mainDocument;this._accessibilityContainer=o.createElement("div"),this._accessibilityContainer.classList.add("xterm-accessibility"),this._rowContainer=o.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=o.createElement("div"),this._liveRegion.classList.add("live-region"),this._liveRegion.setAttribute("aria-live","assertive"),this._accessibilityContainer.appendChild(this._liveRegion),this._liveRegionDebouncer=this._register(new xw(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(`
|
|
97
|
+
`))),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(fe(o,"selectionchange",()=>this._handleSelectionChange())),this._register(this._coreBrowserService.onDprChange(()=>this._refreshRowsDimensions())),this._refreshRowsDimensions(),this._refreshRows(),this._register($e(()=>{this._accessibilityContainer.remove(),this._rowElements.length=0}))}_handleTab(e){for(let i=0;i<e;i++)this._handleChar(" ")}_handleChar(e){this._liveRegionLineCount<fm+1&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==e&&(this._charsToAnnounce+=e):this._charsToAnnounce+=e,e===`
|
|
98
|
+
`&&(this._liveRegionLineCount++,this._liveRegionLineCount===fm+1&&(this._liveRegion.textContent+=su.get())))}_clearLiveRegion(){this._liveRegion.textContent="",this._liveRegionLineCount=0}_handleKey(e){this._clearLiveRegion(),new RegExp("\\p{Control}","u").test(e)||this._charsToConsume.push(e)}_refreshRows(e,i){this._liveRegionDebouncer.refresh(e,i,this._terminal.rows)}_renderRows(e,i){let n=this._terminal.buffer,l=n.lines.length.toString();for(let o=e;o<=i;o++){let h=n.lines.get(n.ydisp+o),d=[],_=h?.translateToString(!0,void 0,void 0,d)||"",p=(n.ydisp+o+1).toString(),f=this._rowElements[o];f&&(_.length===0?(f.textContent=" ",this._rowColumns.set(f,[0,1])):(f.textContent=_,this._rowColumns.set(f,d)),f.setAttribute("aria-posinset",p),f.setAttribute("aria-setsize",l),this._alignRowWidth(f))}this._announceCharacters()}_announceCharacters(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce="")}_handleBoundaryFocus(e,i){let n=e.target,l=this._rowElements[i===0?1:this._rowElements.length-2],o=n.getAttribute("aria-posinset"),h=i===0?"1":`${this._terminal.buffer.lines.length}`;if(o===h||e.relatedTarget!==l)return;let d,_;if(i===0?(d=n,_=this._rowElements.pop(),this._rowContainer.removeChild(_)):(d=this._rowElements.shift(),_=n,this._rowContainer.removeChild(d)),d.removeEventListener("focus",this._topBoundaryFocusListener),_.removeEventListener("focus",this._bottomBoundaryFocusListener),i===0){let p=this._createAccessibilityTreeNode();this._rowElements.unshift(p),this._rowContainer.insertAdjacentElement("afterbegin",p)}else{let p=this._createAccessibilityTreeNode();this._rowElements.push(p),this._rowContainer.appendChild(p)}this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._terminal.scrollLines(i===0?-1:1),this._rowElements[i===0?1:this._rowElements.length-2].focus(),e.preventDefault(),e.stopImmediatePropagation()}_handleSelectionChange(){if(this._rowElements.length===0)return;let e=this._coreBrowserService.mainDocument.getSelection();if(!e)return;if(e.isCollapsed){this._rowContainer.contains(e.anchorNode)&&this._terminal.clearSelection();return}if(!e.anchorNode||!e.focusNode){console.error("anchorNode and/or focusNode are null");return}let i={node:e.anchorNode,offset:e.anchorOffset},n={node:e.focusNode,offset:e.focusOffset};if((i.node.compareDocumentPosition(n.node)&Node.DOCUMENT_POSITION_PRECEDING||i.node===n.node&&i.offset>n.offset)&&([i,n]=[n,i]),i.node.compareDocumentPosition(this._rowElements[0])&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_FOLLOWING)&&(i={node:this._rowElements[0].childNodes[0],offset:0}),!this._rowContainer.contains(i.node))return;let l=this._rowElements.slice(-1)[0];if(n.node.compareDocumentPosition(l)&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_PRECEDING)&&(n={node:l,offset:l.textContent?.length??0}),!this._rowContainer.contains(n.node))return;let o=({node:_,offset:p})=>{let f=_ instanceof Text?_.parentNode:_,S=parseInt(f?.getAttribute("aria-posinset"),10)-1;if(isNaN(S))return console.warn("row is invalid. Race condition?"),null;let y=this._rowColumns.get(f);if(!y)return console.warn("columns is null. Race condition?"),null;let x=p<y.length?y[p]:y.slice(-1)[0]+1;return x>=this._terminal.cols&&(++S,x=0),{row:S,column:x}},h=o(i),d=o(n);if(!(!h||!d)){if(h.row>d.row||h.row===d.row&&h.column>=d.column)throw new Error("invalid range");this._terminal.select(h.column,h.row,(d.row-h.row)*this._terminal.cols-h.column+d.column)}}_handleResize(e){this._rowElements[this._rowElements.length-1].removeEventListener("focus",this._bottomBoundaryFocusListener);for(let i=this._rowContainer.children.length;i<this._terminal.rows;i++)this._rowElements[i]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[i]);for(;this._rowElements.length>e;)this._rowContainer.removeChild(this._rowElements.pop());this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions()}_createAccessibilityTreeNode(){let e=this._coreBrowserService.mainDocument.createElement("div");return e.setAttribute("role","listitem"),e.tabIndex=-1,this._refreshRowDimensions(e),e}_refreshRowsDimensions(){if(this._renderService.dimensions.css.cell.height){Object.assign(this._accessibilityContainer.style,{width:`${this._renderService.dimensions.css.canvas.width}px`,fontSize:`${this._terminal.options.fontSize}px`}),this._rowElements.length!==this._terminal.rows&&this._handleResize(this._terminal.rows);for(let e=0;e<this._terminal.rows;e++)this._refreshRowDimensions(this._rowElements[e]),this._alignRowWidth(this._rowElements[e])}}_refreshRowDimensions(e){e.style.height=`${this._renderService.dimensions.css.cell.height}px`}_alignRowWidth(e){e.style.transform="";let i=e.getBoundingClientRect().width,n=this._rowColumns.get(e)?.slice(-1)?.[0];if(!n)return;let l=n*this._renderService.dimensions.css.cell.width;e.style.transform=`scaleX(${l/i})`}};ro=Qe([se(1,Iu),se(2,rs),se(3,ns)],ro);var Hu=class extends Se{constructor(e,i,n,l,o){super(),this._element=e,this._mouseService=i,this._renderService=n,this._bufferService=l,this._linkProviderService=o,this._linkCacheDisposables=[],this._isMouseOut=!0,this._wasResized=!1,this._activeLine=-1,this._onShowLinkUnderline=this._register(new Q),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this._register(new Q),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this._register($e(()=>{ar(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(fe(this._element,"mouseleave",()=>{this._isMouseOut=!0,this._clearCurrentLink()})),this._register(fe(this._element,"mousemove",this._handleMouseMove.bind(this))),this._register(fe(this._element,"mousedown",this._handleMouseDown.bind(this))),this._register(fe(this._element,"mouseup",this._handleMouseUp.bind(this)))}get currentLink(){return this._currentLink}_handleMouseMove(e){this._lastMouseEvent=e;let i=this._positionFromMouseEvent(e,this._element,this._mouseService);if(!i)return;this._isMouseOut=!1;let n=e.composedPath();for(let l=0;l<n.length;l++){let o=n[l];if(o.classList.contains("xterm"))break;if(o.classList.contains("xterm-hover"))return}(!this._lastBufferCell||i.x!==this._lastBufferCell.x||i.y!==this._lastBufferCell.y)&&(this._handleHover(i),this._lastBufferCell=i)}_handleHover(e){if(this._activeLine!==e.y||this._wasResized){this._clearCurrentLink(),this._askForLink(e,!1),this._wasResized=!1;return}this._currentLink&&this._linkAtPosition(this._currentLink.link,e)||(this._clearCurrentLink(),this._askForLink(e,!0))}_askForLink(e,i){(!this._activeProviderReplies||!i)&&(this._activeProviderReplies?.forEach(l=>{l?.forEach(o=>{o.link.dispose&&o.link.dispose()})}),this._activeProviderReplies=new Map,this._activeLine=e.y);let n=!1;for(let[l,o]of this._linkProviderService.linkProviders.entries())i?this._activeProviderReplies?.get(l)&&(n=this._checkLinkProviderResult(l,e,n)):o.provideLinks(e.y,h=>{if(this._isMouseOut)return;let d=h?.map(_=>({link:_}));this._activeProviderReplies?.set(l,d),n=this._checkLinkProviderResult(l,e,n),this._activeProviderReplies?.size===this._linkProviderService.linkProviders.length&&this._removeIntersectingLinks(e.y,this._activeProviderReplies)})}_removeIntersectingLinks(e,i){let n=new Set;for(let l=0;l<i.size;l++){let o=i.get(l);if(o)for(let h=0;h<o.length;h++){let d=o[h],_=d.link.range.start.y<e?0:d.link.range.start.x,p=d.link.range.end.y>e?this._bufferService.cols:d.link.range.end.x;for(let f=_;f<=p;f++){if(n.has(f)){o.splice(h--,1);break}n.add(f)}}}}_checkLinkProviderResult(e,i,n){if(!this._activeProviderReplies)return n;let l=this._activeProviderReplies.get(e),o=!1;for(let h=0;h<e;h++)(!this._activeProviderReplies.has(h)||this._activeProviderReplies.get(h))&&(o=!0);if(!o&&l){let h=l.find(d=>this._linkAtPosition(d.link,i));h&&(n=!0,this._handleNewLink(h))}if(this._activeProviderReplies.size===this._linkProviderService.linkProviders.length&&!n)for(let h=0;h<this._activeProviderReplies.size;h++){let d=this._activeProviderReplies.get(h)?.find(_=>this._linkAtPosition(_.link,i));if(d){n=!0,this._handleNewLink(d);break}}return n}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(e){if(!this._currentLink)return;let i=this._positionFromMouseEvent(e,this._element,this._mouseService);i&&this._mouseDownLink&&ww(this._mouseDownLink.link,this._currentLink.link)&&this._linkAtPosition(this._currentLink.link,i)&&this._currentLink.link.activate(e,this._currentLink.link.text)}_clearCurrentLink(e,i){!this._currentLink||!this._lastMouseEvent||(!e||!i||this._currentLink.link.range.start.y>=e&&this._currentLink.link.range.end.y<=i)&&(this._linkLeave(this._element,this._currentLink.link,this._lastMouseEvent),this._currentLink=void 0,ar(this._linkCacheDisposables),this._linkCacheDisposables.length=0)}_handleNewLink(e){if(!this._lastMouseEvent)return;let i=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);i&&this._linkAtPosition(e.link,i)&&(this._currentLink=e,this._currentLink.state={decorations:{underline:e.link.decorations===void 0?!0:e.link.decorations.underline,pointerCursor:e.link.decorations===void 0?!0:e.link.decorations.pointerCursor},isHovered:!0},this._linkHover(this._element,e.link,this._lastMouseEvent),e.link.decorations={},Object.defineProperties(e.link.decorations,{pointerCursor:{get:()=>this._currentLink?.state?.decorations.pointerCursor,set:n=>{this._currentLink?.state&&this._currentLink.state.decorations.pointerCursor!==n&&(this._currentLink.state.decorations.pointerCursor=n,this._currentLink.state.isHovered&&this._element.classList.toggle("xterm-cursor-pointer",n))}},underline:{get:()=>this._currentLink?.state?.decorations.underline,set:n=>{this._currentLink?.state&&this._currentLink?.state?.decorations.underline!==n&&(this._currentLink.state.decorations.underline=n,this._currentLink.state.isHovered&&this._fireUnderlineEvent(e.link,n))}}}),this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange(n=>{if(!this._currentLink)return;let l=n.start===0?0:n.start+1+this._bufferService.buffer.ydisp,o=this._bufferService.buffer.ydisp+1+n.end;if(this._currentLink.link.range.start.y>=l&&this._currentLink.link.range.end.y<=o&&(this._clearCurrentLink(l,o),this._lastMouseEvent)){let h=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);h&&this._askForLink(h,!1)}})))}_linkHover(e,i,n){this._currentLink?.state&&(this._currentLink.state.isHovered=!0,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(i,!0),this._currentLink.state.decorations.pointerCursor&&e.classList.add("xterm-cursor-pointer")),i.hover&&i.hover(n,i.text)}_fireUnderlineEvent(e,i){let n=e.range,l=this._bufferService.buffer.ydisp,o=this._createLinkUnderlineEvent(n.start.x-1,n.start.y-l-1,n.end.x,n.end.y-l-1,void 0);(i?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(o)}_linkLeave(e,i,n){this._currentLink?.state&&(this._currentLink.state.isHovered=!1,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(i,!1),this._currentLink.state.decorations.pointerCursor&&e.classList.remove("xterm-cursor-pointer")),i.leave&&i.leave(n,i.text)}_linkAtPosition(e,i){let n=e.range.start.y*this._bufferService.cols+e.range.start.x,l=e.range.end.y*this._bufferService.cols+e.range.end.x,o=i.y*this._bufferService.cols+i.x;return n<=o&&o<=l}_positionFromMouseEvent(e,i,n){let l=n.getCoords(e,i,this._bufferService.cols,this._bufferService.rows);if(l)return{x:l[0],y:l[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(e,i,n,l,o){return{x1:e,y1:i,x2:n,y2:l,cols:this._bufferService.cols,fg:o}}};Hu=Qe([se(1,Yu),se(2,ns),se(3,zt),se(4,Gm)],Hu);function ww(e,i){return e.text===i.text&&e.range.start.x===i.range.start.x&&e.range.start.y===i.range.start.y&&e.range.end.x===i.range.end.x&&e.range.end.y===i.range.end.y}var Cw=class extends _w{constructor(e={}){super(e),this._linkifier=this._register(new Jr),this.browser=fv,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this._register(new Jr),this._onCursorMove=this._register(new Q),this.onCursorMove=this._onCursorMove.event,this._onKey=this._register(new Q),this.onKey=this._onKey.event,this._onRender=this._register(new Q),this.onRender=this._onRender.event,this._onSelectionChange=this._register(new Q),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this._register(new Q),this.onTitleChange=this._onTitleChange.event,this._onBell=this._register(new Q),this.onBell=this._onBell.event,this._onFocus=this._register(new Q),this._onBlur=this._register(new Q),this._onA11yCharEmitter=this._register(new Q),this._onA11yTabEmitter=this._register(new Q),this._onWillOpen=this._register(new Q),this._setup(),this._decorationService=this._instantiationService.createInstance(yw),this._instantiationService.setService(vl,this._decorationService),this._linkProviderService=this._instantiationService.createInstance(f1),this._instantiationService.setService(Gm,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(nu)),this._register(this._inputHandler.onRequestBell(()=>this._onBell.fire())),this._register(this._inputHandler.onRequestRefreshRows(i=>this.refresh(i?.start??0,i?.end??this.rows-1))),this._register(this._inputHandler.onRequestSendFocus(()=>this._reportFocus())),this._register(this._inputHandler.onRequestReset(()=>this.reset())),this._register(this._inputHandler.onRequestWindowsOptionsReport(i=>this._reportWindowsOptions(i))),this._register(this._inputHandler.onColor(i=>this._handleColorEvent(i))),this._register(kt.forward(this._inputHandler.onCursorMove,this._onCursorMove)),this._register(kt.forward(this._inputHandler.onTitleChange,this._onTitleChange)),this._register(kt.forward(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this._register(kt.forward(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this._register(this._bufferService.onResize(i=>this._afterResize(i.cols,i.rows))),this._register($e(()=>{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(e){if(this._themeService)for(let i of e){let n,l="";switch(i.index){case 256:n="foreground",l="10";break;case 257:n="background",l="11";break;case 258:n="cursor",l="12";break;default:n="ansi",l="4;"+i.index}switch(i.type){case 0:let o=Ie.toColorRGB(n==="ansi"?this._themeService.colors.ansi[i.index]:this._themeService.colors[n]);this.coreService.triggerDataEvent(`${F.ESC}]${l};${cw(o)}${uv.ST}`);break;case 1:if(n==="ansi")this._themeService.modifyColors(h=>h.ansi[i.index]=at.toColor(...i.color));else{let h=n;this._themeService.modifyColors(d=>d[h]=at.toColor(...i.color))}break;case 2:this._themeService.restoreColor(i.index);break}}}_setup(){super._setup(),this._customKeyEventHandler=void 0}get buffer(){return this.buffers.active}focus(){this.textarea&&this.textarea.focus({preventScroll:!0})}_handleScreenReaderModeOptionChange(e){e?!this._accessibilityManager.value&&this._renderService&&(this._accessibilityManager.value=this._instantiationService.createInstance(ro,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(e){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(F.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(F.ESC+"[O"),this.element.classList.remove("focus"),this._onBlur.fire()}_syncTextArea(){if(!this.textarea||!this.buffer.isCursorInViewport||this._compositionHelper.isComposing||!this._renderService)return;let e=this.buffer.ybase+this.buffer.y,i=this.buffer.lines.get(e);if(!i)return;let n=Math.min(this.buffer.x,this.cols-1),l=this._renderService.dimensions.css.cell.height,o=i.getWidth(n),h=this._renderService.dimensions.css.cell.width*o,d=this.buffer.y*this._renderService.dimensions.css.cell.height,_=n*this._renderService.dimensions.css.cell.width;this.textarea.style.left=_+"px",this.textarea.style.top=d+"px",this.textarea.style.width=h+"px",this.textarea.style.height=l+"px",this.textarea.style.lineHeight=l+"px",this.textarea.style.zIndex="-5"}_initGlobal(){this._bindKeys(),this._register(fe(this.element,"copy",i=>{this.hasSelection()&&Rb(i,this._selectionService)}));let e=i=>Db(i,this.textarea,this.coreService,this.optionsService);this._register(fe(this.textarea,"paste",e)),this._register(fe(this.element,"paste",e)),pv?this._register(fe(this.element,"mousedown",i=>{i.button===2&&wg(i,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})):this._register(fe(this.element,"contextmenu",i=>{wg(i,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})),Qu&&this._register(fe(this.element,"auxclick",i=>{i.button===1&&Um(i,this.textarea,this.screenElement)}))}_bindKeys(){this._register(fe(this.textarea,"keyup",e=>this._keyUp(e),!0)),this._register(fe(this.textarea,"keydown",e=>this._keyDown(e),!0)),this._register(fe(this.textarea,"keypress",e=>this._keyPress(e),!0)),this._register(fe(this.textarea,"compositionstart",()=>this._compositionHelper.compositionstart())),this._register(fe(this.textarea,"compositionupdate",e=>this._compositionHelper.compositionupdate(e))),this._register(fe(this.textarea,"compositionend",()=>this._compositionHelper.compositionend())),this._register(fe(this.textarea,"input",e=>this._inputEvent(e),!0)),this._register(this.onRender(()=>this._compositionHelper.updateCompositionElements()))}open(e){if(!e)throw new Error("Terminal requires a parent element.");if(e.isConnected||this._logService.debug("Terminal.open was called on an element that was not attached to the DOM"),this.element?.ownerDocument.defaultView&&this._coreBrowserService){this.element.ownerDocument.defaultView!==this._coreBrowserService.window&&(this._coreBrowserService.window=this.element.ownerDocument.defaultView);return}this._document=e.ownerDocument,this.options.documentOverride&&this.options.documentOverride instanceof Document&&(this._document=this.optionsService.rawOptions.documentOverride),this.element=this._document.createElement("div"),this.element.dir="ltr",this.element.classList.add("terminal"),this.element.classList.add("xterm"),e.appendChild(this.element);let i=this._document.createDocumentFragment();this._viewportElement=this._document.createElement("div"),this._viewportElement.classList.add("xterm-viewport"),i.appendChild(this._viewportElement),this.screenElement=this._document.createElement("div"),this.screenElement.classList.add("xterm-screen"),this._register(fe(this.screenElement,"mousemove",o=>this.updateCursorStyle(o))),this._helperContainer=this._document.createElement("div"),this._helperContainer.classList.add("xterm-helpers"),this.screenElement.appendChild(this._helperContainer),i.appendChild(this.screenElement);let n=this.textarea=this._document.createElement("textarea");this.textarea.classList.add("xterm-helper-textarea"),this.textarea.setAttribute("aria-label",iu.get()),mv||this.textarea.setAttribute("aria-multiline","false"),this.textarea.setAttribute("autocorrect","off"),this.textarea.setAttribute("autocapitalize","off"),this.textarea.setAttribute("spellcheck","false"),this.textarea.tabIndex=0,this._register(this.optionsService.onSpecificOptionChange("disableStdin",()=>n.readOnly=this.optionsService.rawOptions.disableStdin)),this.textarea.readOnly=this.optionsService.rawOptions.disableStdin,this._coreBrowserService=this._register(this._instantiationService.createInstance(u1,this.textarea,e.ownerDocument.defaultView??window,this._document??typeof window<"u"?window.document:null)),this._instantiationService.setService(rs,this._coreBrowserService),this._register(fe(this.textarea,"focus",o=>this._handleTextAreaFocus(o))),this._register(fe(this.textarea,"blur",()=>this._handleTextAreaBlur())),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(Eu,this._document,this._helperContainer),this._instantiationService.setService(ho,this._charSizeService),this._themeService=this._instantiationService.createInstance(Bu),this._instantiationService.setService(tn,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(to),this._instantiationService.setService(Fm,this._characterJoinerService),this._renderService=this._register(this._instantiationService.createInstance(Ru,this.rows,this.screenElement)),this._instantiationService.setService(ns,this._renderService),this._register(this._renderService.onRenderedViewportChange(o=>this._onRender.fire(o))),this.onResize(o=>this._renderService.resize(o.cols,o.rows)),this._compositionView=this._document.createElement("div"),this._compositionView.classList.add("composition-view"),this._compositionHelper=this._instantiationService.createInstance(wu,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseService=this._instantiationService.createInstance(Tu),this._instantiationService.setService(Yu,this._mouseService);let l=this._linkifier.value=this._register(this._instantiationService.createInstance(Hu,this.screenElement));this.element.appendChild(i);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(bu,this.element,this.screenElement)),this._register(this._viewport.onRequestScrollLines(o=>{super.scrollLines(o,!1),this.refresh(0,this.rows-1)})),this._selectionService=this._register(this._instantiationService.createInstance(Du,this.element,this.screenElement,l)),this._instantiationService.setService(Nb,this._selectionService),this._register(this._selectionService.onRequestScrollLines(o=>this.scrollLines(o.amount,o.suppressScrollEvent))),this._register(this._selectionService.onSelectionChange(()=>this._onSelectionChange.fire())),this._register(this._selectionService.onRequestRedraw(o=>this._renderService.handleSelectionChanged(o.start,o.end,o.columnSelectMode))),this._register(this._selectionService.onLinuxMouseSelection(o=>{this.textarea.value=o,this.textarea.focus(),this.textarea.select()})),this._register(kt.any(this._onScroll.event,this._inputHandler.onScroll)(()=>{this._selectionService.refresh(),this._viewport?.queueSync()})),this._register(this._instantiationService.createInstance(xu,this.screenElement)),this._register(fe(this.element,"mousedown",o=>this._selectionService.handleMouseDown(o))),this.coreMouseService.areMouseEventsActive?(this._selectionService.disable(),this.element.classList.add("enable-mouse-events")):this._selectionService.enable(),this.options.screenReaderMode&&(this._accessibilityManager.value=this._instantiationService.createInstance(ro,this)),this._register(this.optionsService.onSpecificOptionChange("screenReaderMode",o=>this._handleScreenReaderModeOptionChange(o))),this.options.overviewRuler.width&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(eo,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange("overviewRuler",o=>{!this._overviewRulerRenderer&&o&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(eo,this._viewportElement,this.screenElement)))}),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()}_createRenderer(){return this._instantiationService.createInstance(ku,this,this._document,this.element,this.screenElement,this._viewportElement,this._helperContainer,this.linkifier)}bindMouse(){let e=this,i=this.element;function n(h){let d=e._mouseService.getMouseReportCoords(h,e.screenElement);if(!d)return!1;let _,p;switch(h.overrideType||h.type){case"mousemove":p=32,h.buttons===void 0?(_=3,h.button!==void 0&&(_=h.button<3?h.button:3)):_=h.buttons&1?0:h.buttons&4?1:h.buttons&2?2:3;break;case"mouseup":p=0,_=h.button<3?h.button:3;break;case"mousedown":p=1,_=h.button<3?h.button:3;break;case"wheel":if(e._customWheelEventHandler&&e._customWheelEventHandler(h)===!1)return!1;let f=h.deltaY;if(f===0||e.coreMouseService.consumeWheelEvent(h,e._renderService?.dimensions?.device?.cell?.height,e._coreBrowserService?.dpr)===0)return!1;p=f<0?0:1,_=4;break;default:return!1}return p===void 0||_===void 0||_>4?!1:e.coreMouseService.triggerMouseEvent({col:d.col,row:d.row,x:d.x,y:d.y,button:_,action:p,ctrl:h.ctrlKey,alt:h.altKey,shift:h.shiftKey})}let l={mouseup:null,wheel:null,mousedrag:null,mousemove:null},o={mouseup:h=>(n(h),h.buttons||(this._document.removeEventListener("mouseup",l.mouseup),l.mousedrag&&this._document.removeEventListener("mousemove",l.mousedrag)),this.cancel(h)),wheel:h=>(n(h),this.cancel(h,!0)),mousedrag:h=>{h.buttons&&n(h)},mousemove:h=>{h.buttons||n(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?l.mousemove||(i.addEventListener("mousemove",o.mousemove),l.mousemove=o.mousemove):(i.removeEventListener("mousemove",l.mousemove),l.mousemove=null),h&16?l.wheel||(i.addEventListener("wheel",o.wheel,{passive:!1}),l.wheel=o.wheel):(i.removeEventListener("wheel",l.wheel),l.wheel=null),h&2?l.mouseup||(l.mouseup=o.mouseup):(this._document.removeEventListener("mouseup",l.mouseup),l.mouseup=null),h&4?l.mousedrag||(l.mousedrag=o.mousedrag):(this._document.removeEventListener("mousemove",l.mousedrag),l.mousedrag=null)})),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this._register(fe(i,"mousedown",h=>{if(h.preventDefault(),this.focus(),!(!this.coreMouseService.areMouseEventsActive||this._selectionService.shouldForceSelection(h)))return n(h),l.mouseup&&this._document.addEventListener("mouseup",l.mouseup),l.mousedrag&&this._document.addEventListener("mousemove",l.mousedrag),this.cancel(h)})),this._register(fe(i,"wheel",h=>{if(!l.wheel){if(this._customWheelEventHandler&&this._customWheelEventHandler(h)===!1)return!1;if(!this.buffer.hasScrollback){if(h.deltaY===0)return!1;if(e.coreMouseService.consumeWheelEvent(h,e._renderService?.dimensions?.device?.cell?.height,e._coreBrowserService?.dpr)===0)return this.cancel(h,!0);let d=F.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?"O":"[")+(h.deltaY<0?"A":"B");return this.coreService.triggerDataEvent(d,!0),this.cancel(h,!0)}}},{passive:!1}))}refresh(e,i){this._renderService?.refreshRows(e,i)}updateCursorStyle(e){this._selectionService?.shouldColumnSelect(e)?this.element.classList.add("column-select"):this.element.classList.remove("column-select")}_showCursor(){this.coreService.isCursorInitialized||(this.coreService.isCursorInitialized=!0,this.refresh(this.buffer.y,this.buffer.y))}scrollLines(e,i){this._viewport?this._viewport.scrollLines(e):super.scrollLines(e,i),this.refresh(0,this.rows-1)}scrollPages(e){this.scrollLines(e*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(e){e&&this._viewport?this._viewport.scrollToLine(this.buffer.ybase,!0):this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(e){let i=e-this._bufferService.buffer.ydisp;i!==0&&this.scrollLines(i)}paste(e){Hm(e,this.textarea,this.coreService,this.optionsService)}attachCustomKeyEventHandler(e){this._customKeyEventHandler=e}attachCustomWheelEventHandler(e){this._customWheelEventHandler=e}registerLinkProvider(e){return this._linkProviderService.registerLinkProvider(e)}registerCharacterJoiner(e){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");let i=this._characterJoinerService.register(e);return this.refresh(0,this.rows-1),i}deregisterCharacterJoiner(e){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");this._characterJoinerService.deregister(e)&&this.refresh(0,this.rows-1)}get markers(){return this.buffer.markers}registerMarker(e){return this.buffer.addMarker(this.buffer.ybase+this.buffer.y+e)}registerDecoration(e){return this._decorationService.registerDecoration(e)}hasSelection(){return this._selectionService?this._selectionService.hasSelection:!1}select(e,i,n){this._selectionService.setSelection(e,i,n)}getSelection(){return this._selectionService?this._selectionService.selectionText:""}getSelectionPosition(){if(!(!this._selectionService||!this._selectionService.hasSelection))return{start:{x:this._selectionService.selectionStart[0],y:this._selectionService.selectionStart[1]},end:{x:this._selectionService.selectionEnd[0],y:this._selectionService.selectionEnd[1]}}}clearSelection(){this._selectionService?.clearSelection()}selectAll(){this._selectionService?.selectAll()}selectLines(e,i){this._selectionService?.selectLines(e,i)}_keyDown(e){if(this._keyDownHandled=!1,this._keyDownSeen=!0,this._customKeyEventHandler&&this._customKeyEventHandler(e)===!1)return!1;let i=this.browser.isMac&&this.options.macOptionIsMeta&&e.altKey;if(!i&&!this._compositionHelper.keydown(e))return this.options.scrollOnUserInput&&this.buffer.ybase!==this.buffer.ydisp&&this.scrollToBottom(!0),!1;!i&&(e.key==="Dead"||e.key==="AltGraph")&&(this._unprocessedDeadKey=!0);let n=mw(e,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(e),n.type===3||n.type===2){let l=this.rows-1;return this.scrollLines(n.type===2?-l:l),this.cancel(e,!0)}if(n.type===1&&this.selectAll(),this._isThirdLevelShift(this.browser,e)||(n.cancel&&this.cancel(e,!0),!n.key)||e.key&&!e.ctrlKey&&!e.altKey&&!e.metaKey&&e.key.length===1&&e.key.charCodeAt(0)>=65&&e.key.charCodeAt(0)<=90)return!0;if(this._unprocessedDeadKey)return this._unprocessedDeadKey=!1,!0;if((n.key===F.ETX||n.key===F.CR)&&(this.textarea.value=""),this._onKey.fire({key:n.key,domEvent:e}),this._showCursor(),this.coreService.triggerDataEvent(n.key,!0),!this.optionsService.rawOptions.screenReaderMode||e.altKey||e.ctrlKey)return this.cancel(e,!0);this._keyDownHandled=!0}_isThirdLevelShift(e,i){let n=e.isMac&&!this.options.macOptionIsMeta&&i.altKey&&!i.ctrlKey&&!i.metaKey||e.isWindows&&i.altKey&&i.ctrlKey&&!i.metaKey||e.isWindows&&i.getModifierState("AltGraph");return i.type==="keypress"?n:n&&(!i.keyCode||i.keyCode>47)}_keyUp(e){this._keyDownSeen=!1,!(this._customKeyEventHandler&&this._customKeyEventHandler(e)===!1)&&(kw(e)||this.focus(),this.updateCursorStyle(e),this._keyPressHandled=!1)}_keyPress(e){let i;if(this._keyPressHandled=!1,this._keyDownHandled||this._customKeyEventHandler&&this._customKeyEventHandler(e)===!1)return!1;if(this.cancel(e),e.charCode)i=e.charCode;else if(e.which===null||e.which===void 0)i=e.keyCode;else if(e.which!==0&&e.charCode!==0)i=e.which;else return!1;return!i||(e.altKey||e.ctrlKey||e.metaKey)&&!this._isThirdLevelShift(this.browser,e)?!1:(i=String.fromCharCode(i),this._onKey.fire({key:i,domEvent:e}),this._showCursor(),this.coreService.triggerDataEvent(i,!0),this._keyPressHandled=!0,this._unprocessedDeadKey=!1,!0)}_inputEvent(e){if(e.data&&e.inputType==="insertText"&&(!e.composed||!this._keyDownSeen)&&!this.optionsService.rawOptions.screenReaderMode){if(this._keyPressHandled)return!1;this._unprocessedDeadKey=!1;let i=e.data;return this.coreService.triggerDataEvent(i,!0),this.cancel(e),!0}return!1}resize(e,i){if(e===this.cols&&i===this.rows){this._charSizeService&&!this._charSizeService.hasValidSize&&this._charSizeService.measure();return}super.resize(e,i)}_afterResize(e,i){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 e=1;e<this.rows;e++)this.buffer.lines.push(this.buffer.getBlankLine(lt));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 e=this._customKeyEventHandler;this._setup(),super.reset(),this._selectionService?.reset(),this._decorationService.reset(),this._customKeyEventHandler=e,this.refresh(0,this.rows-1)}clearTextureAtlas(){this._renderService?.clearTextureAtlas()}_reportFocus(){this.element?.classList.contains("focus")?this.coreService.triggerDataEvent(F.ESC+"[I"):this.coreService.triggerDataEvent(F.ESC+"[O")}_reportWindowsOptions(e){if(this._renderService)switch(e){case 0:let i=this._renderService.dimensions.css.canvas.width.toFixed(0),n=this._renderService.dimensions.css.canvas.height.toFixed(0);this.coreService.triggerDataEvent(`${F.ESC}[4;${n};${i}t`);break;case 1:let l=this._renderService.dimensions.css.cell.width.toFixed(0),o=this._renderService.dimensions.css.cell.height.toFixed(0);this.coreService.triggerDataEvent(`${F.ESC}[6;${o};${l}t`);break}}cancel(e,i){if(!(!this.options.cancelEvents&&!i))return e.preventDefault(),e.stopPropagation(),!1}};function kw(e){return e.keyCode===16||e.keyCode===17||e.keyCode===18}var Ew=class{constructor(){this._addons=[]}dispose(){for(let e=this._addons.length-1;e>=0;e--)this._addons[e].instance.dispose()}loadAddon(e,i){let n={instance:i,dispose:i.dispose,isDisposed:!1};this._addons.push(n),i.dispose=()=>this._wrappedAddonDispose(n),i.activate(e)}_wrappedAddonDispose(e){if(e.isDisposed)return;let i=-1;for(let n=0;n<this._addons.length;n++)if(this._addons[n]===e){i=n;break}if(i===-1)throw new Error("Could not dispose an addon that has not been loaded");e.isDisposed=!0,e.dispose.apply(e.instance),this._addons.splice(i,1)}},Tw=class{constructor(e){this._line=e}get isWrapped(){return this._line.isWrapped}get length(){return this._line.length}getCell(e,i){if(!(e<0||e>=this._line.length))return i?(this._line.loadCell(e,i),i):this._line.loadCell(e,new gi)}translateToString(e,i,n){return this._line.translateToString(e,i,n)}},pm=class{constructor(e,i){this._buffer=e,this.type=i}init(e){return this._buffer=e,this}get cursorY(){return this._buffer.y}get cursorX(){return this._buffer.x}get viewportY(){return this._buffer.ydisp}get baseY(){return this._buffer.ybase}get length(){return this._buffer.lines.length}getLine(e){let i=this._buffer.lines.get(e);if(i)return new Tw(i)}getNullCell(){return new gi}},Rw=class extends Se{constructor(e){super(),this._core=e,this._onBufferChange=this._register(new Q),this.onBufferChange=this._onBufferChange.event,this._normal=new pm(this._core.buffers.normal,"normal"),this._alternate=new pm(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)}},Dw=class{constructor(e){this._core=e}registerCsiHandler(e,i){return this._core.registerCsiHandler(e,n=>i(n.toArray()))}addCsiHandler(e,i){return this.registerCsiHandler(e,i)}registerDcsHandler(e,i){return this._core.registerDcsHandler(e,(n,l)=>i(n,l.toArray()))}addDcsHandler(e,i){return this.registerDcsHandler(e,i)}registerEscHandler(e,i){return this._core.registerEscHandler(e,i)}addEscHandler(e,i){return this.registerEscHandler(e,i)}registerOscHandler(e,i){return this._core.registerOscHandler(e,i)}addOscHandler(e,i){return this.registerOscHandler(e,i)}},Bw=class{constructor(e){this._core=e}register(e){this._core.unicodeService.register(e)}get versions(){return this._core.unicodeService.versions}get activeVersion(){return this._core.unicodeService.activeVersion}set activeVersion(e){this._core.unicodeService.activeVersion=e}},Mw=["cols","rows"],Bi=0,zw=class extends Se{constructor(e){super(),this._core=this._register(new Cw(e)),this._addonManager=this._register(new Ew),this._publicOptions={...this._core.options};let i=l=>this._core.options[l],n=(l,o)=>{this._checkReadonlyOptions(l),this._core.options[l]=o};for(let l in this._core.options){let o={get:i.bind(this,l),set:n.bind(this,l)};Object.defineProperty(this._publicOptions,l,o)}}_checkReadonlyOptions(e){if(Mw.includes(e))throw new Error(`Option "${e}" can only be set in the constructor`)}_checkProposedApi(){if(!this._core.optionsService.rawOptions.allowProposedApi)throw new Error("You must set the allowProposedApi option to true to use proposed API")}get onBell(){return this._core.onBell}get onBinary(){return this._core.onBinary}get onCursorMove(){return this._core.onCursorMove}get onData(){return this._core.onData}get onKey(){return this._core.onKey}get onLineFeed(){return this._core.onLineFeed}get onRender(){return this._core.onRender}get onResize(){return this._core.onResize}get onScroll(){return this._core.onScroll}get onSelectionChange(){return this._core.onSelectionChange}get onTitleChange(){return this._core.onTitleChange}get onWriteParsed(){return this._core.onWriteParsed}get element(){return this._core.element}get parser(){return this._parser||(this._parser=new Dw(this._core)),this._parser}get unicode(){return this._checkProposedApi(),new Bw(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 Rw(this._core))),this._buffer}get markers(){return this._checkProposedApi(),this._core.markers}get modes(){let e=this._core.coreService.decPrivateModes,i="none";switch(this._core.coreMouseService.activeProtocol){case"X10":i="x10";break;case"VT200":i="vt200";break;case"DRAG":i="drag";break;case"ANY":i="any";break}return{applicationCursorKeysMode:e.applicationCursorKeys,applicationKeypadMode:e.applicationKeypad,bracketedPasteMode:e.bracketedPasteMode,insertMode:this._core.coreService.modes.insertMode,mouseTrackingMode:i,originMode:e.origin,reverseWraparoundMode:e.reverseWraparound,sendFocusMode:e.sendFocus,synchronizedOutputMode:e.synchronizedOutput,wraparoundMode:e.wraparound}}get options(){return this._publicOptions}set options(e){for(let i in e)this._publicOptions[i]=e[i]}blur(){this._core.blur()}focus(){this._core.focus()}input(e,i=!0){this._core.input(e,i)}resize(e,i){this._verifyIntegers(e,i),this._core.resize(e,i)}open(e){this._core.open(e)}attachCustomKeyEventHandler(e){this._core.attachCustomKeyEventHandler(e)}attachCustomWheelEventHandler(e){this._core.attachCustomWheelEventHandler(e)}registerLinkProvider(e){return this._core.registerLinkProvider(e)}registerCharacterJoiner(e){return this._checkProposedApi(),this._core.registerCharacterJoiner(e)}deregisterCharacterJoiner(e){this._checkProposedApi(),this._core.deregisterCharacterJoiner(e)}registerMarker(e=0){return this._verifyIntegers(e),this._core.registerMarker(e)}registerDecoration(e){return this._checkProposedApi(),this._verifyPositiveIntegers(e.x??0,e.width??0,e.height??0),this._core.registerDecoration(e)}hasSelection(){return this._core.hasSelection()}select(e,i,n){this._verifyIntegers(e,i,n),this._core.select(e,i,n)}getSelection(){return this._core.getSelection()}getSelectionPosition(){return this._core.getSelectionPosition()}clearSelection(){this._core.clearSelection()}selectAll(){this._core.selectAll()}selectLines(e,i){this._verifyIntegers(e,i),this._core.selectLines(e,i)}dispose(){super.dispose()}scrollLines(e){this._verifyIntegers(e),this._core.scrollLines(e)}scrollPages(e){this._verifyIntegers(e),this._core.scrollPages(e)}scrollToTop(){this._core.scrollToTop()}scrollToBottom(){this._core.scrollToBottom()}scrollToLine(e){this._verifyIntegers(e),this._core.scrollToLine(e)}clear(){this._core.clear()}write(e,i){this._core.write(e,i)}writeln(e,i){this._core.write(e),this._core.write(`\r
|
|
99
99
|
`,i)}paste(e){this._core.paste(e)}refresh(e,i){this._verifyIntegers(e,i),this._core.refresh(e,i)}reset(){this._core.reset()}clearTextureAtlas(){this._core.clearTextureAtlas()}loadAddon(e){this._addonManager.loadAddon(this,e)}static get strings(){return{get promptLabel(){return iu.get()},set promptLabel(e){iu.set(e)},get tooMuchOutput(){return su.get()},set tooMuchOutput(e){su.set(e)}}}_verifyIntegers(...e){for(Bi of e)if(Bi===1/0||isNaN(Bi)||Bi%1!==0)throw new Error("This API only accepts integers")}_verifyPositiveIntegers(...e){for(Bi of e)if(Bi&&(Bi===1/0||isNaN(Bi)||Bi%1!==0||Bi<0))throw new Error("This API only accepts positive integers")}};var Aw=2,Ow=1,Lw=class{activate(e){this._terminal=e}dispose(){}fit(){let e=this.proposeDimensions();if(!e||!this._terminal||isNaN(e.cols)||isNaN(e.rows))return;let i=this._terminal._core;(this._terminal.rows!==e.rows||this._terminal.cols!==e.cols)&&(i._renderService.clear(),this._terminal.resize(e.cols,e.rows))}proposeDimensions(){if(!this._terminal||!this._terminal.element||!this._terminal.element.parentElement)return;let e=this._terminal._core._renderService.dimensions;if(e.css.cell.width===0||e.css.cell.height===0)return;let i=this._terminal.options.scrollback===0?0:this._terminal.options.overviewRuler?.width||14,n=window.getComputedStyle(this._terminal.element.parentElement),l=parseInt(n.getPropertyValue("height")),o=Math.max(0,parseInt(n.getPropertyValue("width"))),h=window.getComputedStyle(this._terminal.element),d={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.top+d.bottom,p=d.right+d.left,f=l-_,S=o-p-i;return{cols:Math.max(Aw,Math.floor(S/e.css.cell.width)),rows:Math.max(Ow,Math.floor(f/e.css.cell.height))}}};var jw=class{constructor(i,n,l,o={}){this._terminal=i,this._regex=n,this._handler=l,this._options=o}provideLinks(i,n){let l=Hw.computeLink(i,this._regex,this._terminal,this._handler);n(this._addCallbacks(l))}_addCallbacks(i){return i.map(n=>(n.leave=this._options.leave,n.hover=(l,o)=>{if(this._options.hover){let{range:h}=n;this._options.hover(l,o,h)}},n))}};function Nw(e){try{let i=new URL(e),n=i.password&&i.username?`${i.protocol}//${i.username}:${i.password}@${i.host}`:i.username?`${i.protocol}//${i.username}@${i.host}`:`${i.protocol}//${i.host}`;return e.toLocaleLowerCase().startsWith(n.toLocaleLowerCase())}catch{return!1}}var Hw=class Qa{static computeLink(i,n,l,o){let h=new RegExp(n.source,(n.flags||"")+"g"),[d,_]=Qa._getWindowedLineStrings(i-1,l),p=d.join(""),f,S=[];for(;f=h.exec(p);){let y=f[0];if(!Nw(y))continue;let[x,C]=Qa._mapStrIdx(l,_,0,f.index),[b,T]=Qa._mapStrIdx(l,x,C,y.length);if(x===-1||C===-1||b===-1||T===-1)continue;let M={start:{x:C+1,y:x+1},end:{x:T,y:b+1}};S.push({range:M,text:y,activate:o})}return S}static _getWindowedLineStrings(i,n){let l,o=i,h=i,d=0,_="",p=[];if(l=n.buffer.active.getLine(i)){let f=l.translateToString(!0);if(l.isWrapped&&f[0]!==" "){for(d=0;(l=n.buffer.active.getLine(--o))&&d<2048&&(_=l.translateToString(!0),d+=_.length,p.push(_),!(!l.isWrapped||_.indexOf(" ")!==-1)););p.reverse()}for(p.push(f),d=0;(l=n.buffer.active.getLine(++h))&&l.isWrapped&&d<2048&&(_=l.translateToString(!0),d+=_.length,p.push(_),_.indexOf(" ")===-1););}return[p,o]}static _mapStrIdx(i,n,l,o){let h=i.buffer.active,d=h.getNullCell(),_=l;for(;o;){let p=h.getLine(n);if(!p)return[-1,-1];for(let f=_;f<p.length;++f){p.getCell(f,d);let S=d.getChars();if(d.getWidth()&&(o-=S.length||1,f===p.length-1&&S==="")){let y=h.getLine(n+1);y&&y.isWrapped&&(y.getCell(0,d),d.getWidth()===2&&(o+=1))}if(o<0)return[n,f]}n++,_=0}return[n,_]}},Uw=/(https?|HTTPS?):[/]{2}[^\s"'!*(){}|\\\^<>`]*[^\s"':,.!?{}|\\\^~\[\]`()<>]/;function Ww(e,i){let n=window.open();if(n){try{n.opener=null}catch{}n.location.href=i}else console.warn("Opening link blocked as opener could not be cleared")}var qw=class{constructor(i=Ww,n={}){this._handler=i,this._options=n}activate(i){this._terminal=i;let n=this._options,l=n.urlRegex||Uw;this._linkProvider=this._terminal.registerLinkProvider(new jw(this._terminal,l,this._handler,n))}dispose(){this._linkProvider?.dispose()}};function Pw(){const e=z.useRef(null),{connect:i,wsRef:n,onOutput:l,onExit:o,setConnectionCallbacks:h,addOutputLine:d}=en(),{path:_,setTerminalConnected:p}=Et();return z.useEffect(()=>{if(!e.current||!_)return;const f=new zw({theme:{background:"#1a1a2e",foreground:"#e0e0e0",cursor:"#4ade80",selectionBackground:"rgba(74, 222, 128, 0.3)"},fontFamily:"'Inconsolata', 'Menlo', 'Courier New', monospace",fontSize:14,cursorBlink:!0}),S=new Lw;f.loadAddon(S),f.loadAddon(new qw),f.open(e.current),S.fit(),l.current=C=>{f.write(C),C.replace(/\x1b\[[?>=!]?[0-9;]*[a-zA-Z]/g,"").replace(/\x1b\][^\x07\x1b]*(?:\x07|\x1b\\)/g,"").replace(/\x1b[()][0-9A-Z]/g,"").replace(/\x1b./g,"").replace(/\r/g,"").split(`
|
|
100
100
|
`).map(M=>M.trim()).filter(M=>M.length>0).filter(M=>!M.match(/^\(thinking\)$/)).forEach(M=>d(M))},o.current=()=>f.writeln(`\r
|
|
101
101
|
[Process exited. Refresh to restart]`),h(()=>p(!0),()=>{p(!1),f.writeln(`\r
|
|
102
|
-
[Connection lost]`)});const y=i(_);f.onData(C=>{y?.readyState===WebSocket.OPEN&&y.send(JSON.stringify({type:"input",data:C}))});const x=new ResizeObserver(()=>{S.fit(),y?.readyState===WebSocket.OPEN&&y.send(JSON.stringify({type:"resize",cols:f.cols,rows:f.rows}))});return x.observe(e.current),()=>{x.disconnect(),f.dispose(),y?.close()}},[_]),g.jsx("div",{ref:e,className:"h-full w-full"})}function Iw(){const[e,i]=z.useState(!1),[n,l]=z.useState(!1),{sendPrompt:o}=en(),h=()=>{o("Run the dev server for this project so I can preview it in the browser. Use npm run dev or the appropriate command. IMPORTANT: Make sure it runs on port 5173 — the preview panel is connected to that port. If the framework defaults to a different port, configure it to use 5173 (e.g. --port 5173)."),l(!0),setTimeout(()=>{i(!0),l(!1)},4e3)},d=()=>{i(!1),setTimeout(()=>i(!0),100)};return e?g.jsxs("div",{className:"h-full flex flex-col",style:{background:"#f8fafc"},children:[g.jsxs("div",{style:{padding:"8px 16px",borderBottom:"1px solid #e5e7eb",display:"flex",alignItems:"center",justifyContent:"space-between",flexShrink:0,background:"#fff"},children:[g.jsx("span",{style:{fontSize:"12px",color:"#9ca3af",fontFamily:"'SF Mono', monospace"},children:"localhost:5173 (errors → terminal)"}),g.jsx("button",{onClick:d,style:{padding:"4px 10px",borderRadius:"6px",border:"1px solid #e5e7eb",background:"#fff",color:"#6b7280",fontSize:"12px",cursor:"pointer"},children:"↻ Refresh"})]}),g.jsx("iframe",{src:"/api/dev-preview/?port=5173",style:{flex:1,border:"none",width:"100%"},sandbox:"allow-scripts allow-same-origin allow-forms allow-popups",title:"Live Preview"})]}):g.jsx("div",{className:"h-full flex items-center justify-center",style:{background:"#f8fafc"},children:g.jsxs("div",{className:"text-center",children:[g.jsx("div",{className:"text-3xl mb-3",children:"🌐"}),g.jsx("div",{style:{color:"#374151",fontSize:"15px",fontWeight:600,marginBottom:"4px"},children:"Live Preview"}),g.jsx("div",{style:{color:"#9ca3af",fontSize:"12px",marginBottom:"20px"},children:"localhost:5173"}),g.jsx("button",{onClick:h,disabled:n,style:{padding:"10px 24px",borderRadius:"10px",border:"none",background:n?"#e5e7eb":"#22c55e",color:n?"#9ca3af":"#fff",fontSize:"14px",fontWeight:600,cursor:n?"not-allowed":"pointer",transition:"all 0.15s"},children:n?"⏳ Starting...":"▶ View Tool"}),g.jsx("div",{style:{color:"#9ca3af",fontSize:"11px",marginTop:"10px"},children:"Starts the dev server and shows your app here"})]})})}function Ju(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var ur=Ju();function Tv(e){ur=e}var rr={exec:()=>null};function Te(e,i=""){let n=typeof e=="string"?e:e.source,l={replace:(o,h)=>{let d=typeof h=="string"?h:h.source;return d=d.replace(Mt.caret,"$1"),n=n.replace(o,d),l},getRegex:()=>new RegExp(n,i)};return l}var
|
|
103
|
-
]`).replace("lheading",Dv).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},sC=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,rC=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,Mv=/^( {2,}|\\)\n(?!\s*$)/,nC=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,_o=/[\p{P}\p{S}]/u,nd=/[\s\p{P}\p{S}]/u,zv=/[^\s\p{P}\p{S}]/u,lC=Te(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,nd).getRegex(),Av=/(?!~)[\p{P}\p{S}]/u,aC=/(?!~)[\s\p{P}\p{S}]/u,oC=/(?:[^\s\p{P}\p{S}]|~)/u,Ov=/(?![*_])[\p{P}\p{S}]/u,cC=/(?![*_])[\s\p{P}\p{S}]/u,hC=/(?:[^\s\p{P}\p{S}]|[*_])/u,uC=Te(/link|precode-code|html/,"g").replace("link",/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-"
|
|
102
|
+
[Connection lost]`)});const y=i(_);f.onData(C=>{y?.readyState===WebSocket.OPEN&&y.send(JSON.stringify({type:"input",data:C}))});const x=new ResizeObserver(()=>{S.fit(),y?.readyState===WebSocket.OPEN&&y.send(JSON.stringify({type:"resize",cols:f.cols,rows:f.rows}))});return x.observe(e.current),()=>{x.disconnect(),f.dispose(),y?.close()}},[_]),g.jsx("div",{ref:e,className:"h-full w-full"})}function Iw(){const[e,i]=z.useState(!1),[n,l]=z.useState(!1),{sendPrompt:o}=en(),h=()=>{o("Run the dev server for this project so I can preview it in the browser. Use npm run dev or the appropriate command. IMPORTANT: Make sure it runs on port 5173 — the preview panel is connected to that port. If the framework defaults to a different port, configure it to use 5173 (e.g. --port 5173)."),l(!0),setTimeout(()=>{i(!0),l(!1)},4e3)},d=()=>{i(!1),setTimeout(()=>i(!0),100)};return e?g.jsxs("div",{className:"h-full flex flex-col",style:{background:"#f8fafc"},children:[g.jsxs("div",{style:{padding:"8px 16px",borderBottom:"1px solid #e5e7eb",display:"flex",alignItems:"center",justifyContent:"space-between",flexShrink:0,background:"#fff"},children:[g.jsx("span",{style:{fontSize:"12px",color:"#9ca3af",fontFamily:"'SF Mono', monospace"},children:"localhost:5173 (errors → terminal)"}),g.jsx("button",{onClick:d,style:{padding:"4px 10px",borderRadius:"6px",border:"1px solid #e5e7eb",background:"#fff",color:"#6b7280",fontSize:"12px",cursor:"pointer"},children:"↻ Refresh"})]}),g.jsx("iframe",{src:"/api/dev-preview/?port=5173",style:{flex:1,border:"none",width:"100%"},sandbox:"allow-scripts allow-same-origin allow-forms allow-popups",title:"Live Preview"})]}):g.jsx("div",{className:"h-full flex items-center justify-center",style:{background:"#f8fafc"},children:g.jsxs("div",{className:"text-center",children:[g.jsx("div",{className:"text-3xl mb-3",children:"🌐"}),g.jsx("div",{style:{color:"#374151",fontSize:"15px",fontWeight:600,marginBottom:"4px"},children:"Live Preview"}),g.jsx("div",{style:{color:"#9ca3af",fontSize:"12px",marginBottom:"20px"},children:"localhost:5173"}),g.jsx("button",{onClick:h,disabled:n,style:{padding:"10px 24px",borderRadius:"10px",border:"none",background:n?"#e5e7eb":"#22c55e",color:n?"#9ca3af":"#fff",fontSize:"14px",fontWeight:600,cursor:n?"not-allowed":"pointer",transition:"all 0.15s"},children:n?"⏳ Starting...":"▶ View Tool"}),g.jsx("div",{style:{color:"#9ca3af",fontSize:"11px",marginTop:"10px"},children:"Starts the dev server and shows your app here"})]})})}function Ju(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var ur=Ju();function Tv(e){ur=e}var rr={exec:()=>null};function Te(e,i=""){let n=typeof e=="string"?e:e.source,l={replace:(o,h)=>{let d=typeof h=="string"?h:h.source;return d=d.replace(Mt.caret,"$1"),n=n.replace(o,d),l},getRegex:()=>new RegExp(n,i)};return l}var Yw=(()=>{try{return!!new RegExp("(?<=1)(?<!1)")}catch{return!1}})(),Mt={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] +\S/,listReplaceTask:/^\[[ xX]\] +/,listTaskCheckbox:/\[[ xX]\]/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:e=>new RegExp(`^( {0,3}${e})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),hrRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),fencesBeginRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}(?:\`\`\`|~~~)`),headingBeginRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}#`),htmlBeginRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}<(?:[a-z].*>|!--)`,"i"),blockquoteBeginRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}>`)},$w=/^(?:[ \t]*(?:\n|$))+/,Kw=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,Fw=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,bl=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,Gw=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,ed=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,Rv=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,Dv=Te(Rv).replace(/bull/g,ed).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,"").getRegex(),Xw=Te(Rv).replace(/bull/g,ed).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),td=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,Vw=/^[^\n]+/,id=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,Zw=Te(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",id).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),Qw=Te(/^(bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,ed).getRegex(),po="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",sd=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,Jw=Te("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))","i").replace("comment",sd).replace("tag",po).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),Bv=Te(td).replace("hr",bl).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",po).getRegex(),eC=Te(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",Bv).getRegex(),rd={blockquote:eC,code:Kw,def:Zw,fences:Fw,heading:Gw,hr:bl,html:Jw,lheading:Dv,list:Qw,newline:$w,paragraph:Bv,table:rr,text:Vw},_m=Te("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",bl).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code","(?: {4}| {0,3} )[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",po).getRegex(),tC={...rd,lheading:Xw,table:_m,paragraph:Te(td).replace("hr",bl).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",_m).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",po).getRegex()},iC={...rd,html:Te(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",sd).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:rr,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:Te(td).replace("hr",bl).replace("heading",` *#{1,6} *[^
|
|
103
|
+
]`).replace("lheading",Dv).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},sC=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,rC=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,Mv=/^( {2,}|\\)\n(?!\s*$)/,nC=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,_o=/[\p{P}\p{S}]/u,nd=/[\s\p{P}\p{S}]/u,zv=/[^\s\p{P}\p{S}]/u,lC=Te(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,nd).getRegex(),Av=/(?!~)[\p{P}\p{S}]/u,aC=/(?!~)[\s\p{P}\p{S}]/u,oC=/(?:[^\s\p{P}\p{S}]|~)/u,Ov=/(?![*_])[\p{P}\p{S}]/u,cC=/(?![*_])[\s\p{P}\p{S}]/u,hC=/(?:[^\s\p{P}\p{S}]|[*_])/u,uC=Te(/link|precode-code|html/,"g").replace("link",/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-",Yw?"(?<!`)()":"(^^|[^`])").replace("code",/(?<b>`+)[^`]+\k<b>(?!`)/).replace("html",/<(?! )[^<>]*?>/).getRegex(),Lv=/^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/,dC=Te(Lv,"u").replace(/punct/g,_o).getRegex(),fC=Te(Lv,"u").replace(/punct/g,Av).getRegex(),jv="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",pC=Te(jv,"gu").replace(/notPunctSpace/g,zv).replace(/punctSpace/g,nd).replace(/punct/g,_o).getRegex(),_C=Te(jv,"gu").replace(/notPunctSpace/g,oC).replace(/punctSpace/g,aC).replace(/punct/g,Av).getRegex(),gC=Te("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,zv).replace(/punctSpace/g,nd).replace(/punct/g,_o).getRegex(),mC=Te(/^~~?(?:((?!~)punct)|[^\s~])/,"u").replace(/punct/g,Ov).getRegex(),vC="^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)",yC=Te(vC,"gu").replace(/notPunctSpace/g,hC).replace(/punctSpace/g,cC).replace(/punct/g,Ov).getRegex(),SC=Te(/\\(punct)/,"gu").replace(/punct/g,_o).getRegex(),bC=Te(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email",/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),xC=Te(sd).replace("(?:-->|$)","-->").getRegex(),wC=Te("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment",xC).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),no=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+[^`]*?`+(?!`)|[^\[\]\\`])*?/,CC=Te(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace("label",no).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),Nv=Te(/^!?\[(label)\]\[(ref)\]/).replace("label",no).replace("ref",id).getRegex(),Hv=Te(/^!?\[(ref)\](?:\[\])?/).replace("ref",id).getRegex(),kC=Te("reflink|nolink(?!\\()","g").replace("reflink",Nv).replace("nolink",Hv).getRegex(),gm=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,ld={_backpedal:rr,anyPunctuation:SC,autolink:bC,blockSkip:uC,br:Mv,code:rC,del:rr,delLDelim:rr,delRDelim:rr,emStrongLDelim:dC,emStrongRDelimAst:pC,emStrongRDelimUnd:gC,escape:sC,link:CC,nolink:Hv,punctuation:lC,reflink:Nv,reflinkSearch:kC,tag:wC,text:nC,url:rr},EC={...ld,link:Te(/^!?\[(label)\]\((.*?)\)/).replace("label",no).getRegex(),reflink:Te(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",no).getRegex()},Uu={...ld,emStrongRDelimAst:_C,emStrongLDelim:fC,delLDelim:mC,delRDelim:yC,url:Te(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol",gm).replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/,text:Te(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol",gm).getRegex()},TC={...Uu,br:Te(Mv).replace("{2,}","*").getRegex(),text:Te(Uu.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},$a={normal:rd,gfm:tC,pedantic:iC},nl={normal:ld,gfm:Uu,breaks:TC,pedantic:EC},RC={"&":"&","<":"<",">":">",'"':""","'":"'"},mm=e=>RC[e];function zi(e,i){if(i){if(Mt.escapeTest.test(e))return e.replace(Mt.escapeReplace,mm)}else if(Mt.escapeTestNoEncode.test(e))return e.replace(Mt.escapeReplaceNoEncode,mm);return e}function vm(e){try{e=encodeURI(e).replace(Mt.percentDecode,"%")}catch{return null}return e}function ym(e,i){let n=e.replace(Mt.findPipe,(h,d,_)=>{let p=!1,f=d;for(;--f>=0&&_[f]==="\\";)p=!p;return p?"|":" |"}),l=n.split(Mt.splitPipe),o=0;if(l[0].trim()||l.shift(),l.length>0&&!l.at(-1)?.trim()&&l.pop(),i)if(l.length>i)l.splice(i);else for(;l.length<i;)l.push("");for(;o<l.length;o++)l[o]=l[o].trim().replace(Mt.slashPipe,"|");return l}function ll(e,i,n){let l=e.length;if(l===0)return"";let o=0;for(;o<l&&e.charAt(l-o-1)===i;)o++;return e.slice(0,l-o)}function DC(e,i){if(e.indexOf(i[1])===-1)return-1;let n=0;for(let l=0;l<e.length;l++)if(e[l]==="\\")l++;else if(e[l]===i[0])n++;else if(e[l]===i[1]&&(n--,n<0))return l;return n>0?-2:-1}function BC(e,i=0){let n=i,l="";for(let o of e)if(o===" "){let h=4-n%4;l+=" ".repeat(h),n+=h}else l+=o,n++;return l}function Sm(e,i,n,l,o){let h=i.href,d=i.title||null,_=e[1].replace(o.other.outputLinkReplace,"$1");l.state.inLink=!0;let p={type:e[0].charAt(0)==="!"?"image":"link",raw:n,href:h,title:d,text:_,tokens:l.inlineTokens(_)};return l.state.inLink=!1,p}function MC(e,i,n){let l=e.match(n.other.indentCodeCompensation);if(l===null)return i;let o=l[1];return i.split(`
|
|
104
104
|
`).map(h=>{let d=h.match(n.other.beginningSpace);if(d===null)return h;let[_]=d;return _.length>=o.length?h.slice(o.length):h}).join(`
|
|
105
105
|
`)}var lo=class{options;rules;lexer;constructor(e){this.options=e||ur}space(e){let i=this.rules.block.newline.exec(e);if(i&&i[0].length>0)return{type:"space",raw:i[0]}}code(e){let i=this.rules.block.code.exec(e);if(i){let n=i[0].replace(this.rules.other.codeRemoveIndent,"");return{type:"code",raw:i[0],codeBlockStyle:"indented",text:this.options.pedantic?n:ll(n,`
|
|
106
106
|
`)}}}fences(e){let i=this.rules.block.fences.exec(e);if(i){let n=i[0],l=MC(n,i[3]||"",this.rules);return{type:"code",raw:n,lang:i[2]?i[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):i[2],text:l}}}heading(e){let i=this.rules.block.heading.exec(e);if(i){let n=i[2].trim();if(this.rules.other.endingHash.test(n)){let l=ll(n,"#");(this.options.pedantic||!l||this.rules.other.endingSpaceChar.test(l))&&(n=l.trim())}return{type:"heading",raw:i[0],depth:i[1].length,text:n,tokens:this.lexer.inline(n)}}}hr(e){let i=this.rules.block.hr.exec(e);if(i)return{type:"hr",raw:ll(i[0],`
|
|
@@ -124,7 +124,7 @@ ${S}`:S;let y=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTo
|
|
|
124
124
|
`+x}C=!x.trim(),f+=H+`
|
|
125
125
|
`,e=e.substring(H.length+1),y=X.slice(b)}}o.loose||(d?o.loose=!0:this.rules.other.doubleBlankLine.test(f)&&(d=!0)),o.items.push({type:"list_item",raw:f,task:!!this.options.gfm&&this.rules.other.listIsTask.test(S),loose:!1,text:S,tokens:[]}),o.raw+=f}let _=o.items.at(-1);if(_)_.raw=_.raw.trimEnd(),_.text=_.text.trimEnd();else return;o.raw=o.raw.trimEnd();for(let p of o.items){if(this.lexer.state.top=!1,p.tokens=this.lexer.blockTokens(p.text,[]),p.task){if(p.text=p.text.replace(this.rules.other.listReplaceTask,""),p.tokens[0]?.type==="text"||p.tokens[0]?.type==="paragraph"){p.tokens[0].raw=p.tokens[0].raw.replace(this.rules.other.listReplaceTask,""),p.tokens[0].text=p.tokens[0].text.replace(this.rules.other.listReplaceTask,"");for(let S=this.lexer.inlineQueue.length-1;S>=0;S--)if(this.rules.other.listIsTask.test(this.lexer.inlineQueue[S].src)){this.lexer.inlineQueue[S].src=this.lexer.inlineQueue[S].src.replace(this.rules.other.listReplaceTask,"");break}}let f=this.rules.other.listTaskCheckbox.exec(p.raw);if(f){let S={type:"checkbox",raw:f[0]+" ",checked:f[0]!=="[ ]"};p.checked=S.checked,o.loose?p.tokens[0]&&["paragraph","text"].includes(p.tokens[0].type)&&"tokens"in p.tokens[0]&&p.tokens[0].tokens?(p.tokens[0].raw=S.raw+p.tokens[0].raw,p.tokens[0].text=S.raw+p.tokens[0].text,p.tokens[0].tokens.unshift(S)):p.tokens.unshift({type:"paragraph",raw:S.raw,text:S.raw,tokens:[S]}):p.tokens.unshift(S)}}if(!o.loose){let f=p.tokens.filter(y=>y.type==="space"),S=f.length>0&&f.some(y=>this.rules.other.anyLine.test(y.raw));o.loose=S}}if(o.loose)for(let p of o.items){p.loose=!0;for(let f of p.tokens)f.type==="text"&&(f.type="paragraph")}return o}}html(e){let i=this.rules.block.html.exec(e);if(i)return{type:"html",block:!0,raw:i[0],pre:i[1]==="pre"||i[1]==="script"||i[1]==="style",text:i[0]}}def(e){let i=this.rules.block.def.exec(e);if(i){let n=i[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal," "),l=i[2]?i[2].replace(this.rules.other.hrefBrackets,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",o=i[3]?i[3].substring(1,i[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):i[3];return{type:"def",tag:n,raw:i[0],href:l,title:o}}}table(e){let i=this.rules.block.table.exec(e);if(!i||!this.rules.other.tableDelimiter.test(i[2]))return;let n=ym(i[1]),l=i[2].replace(this.rules.other.tableAlignChars,"").split("|"),o=i[3]?.trim()?i[3].replace(this.rules.other.tableRowBlankLine,"").split(`
|
|
126
126
|
`):[],h={type:"table",raw:i[0],header:[],align:[],rows:[]};if(n.length===l.length){for(let d of l)this.rules.other.tableAlignRight.test(d)?h.align.push("right"):this.rules.other.tableAlignCenter.test(d)?h.align.push("center"):this.rules.other.tableAlignLeft.test(d)?h.align.push("left"):h.align.push(null);for(let d=0;d<n.length;d++)h.header.push({text:n[d],tokens:this.lexer.inline(n[d]),header:!0,align:h.align[d]});for(let d of o)h.rows.push(ym(d,h.header.length).map((_,p)=>({text:_,tokens:this.lexer.inline(_),header:!1,align:h.align[p]})));return h}}lheading(e){let i=this.rules.block.lheading.exec(e);if(i)return{type:"heading",raw:i[0],depth:i[2].charAt(0)==="="?1:2,text:i[1],tokens:this.lexer.inline(i[1])}}paragraph(e){let i=this.rules.block.paragraph.exec(e);if(i){let n=i[1].charAt(i[1].length-1)===`
|
|
127
|
-
`?i[1].slice(0,-1):i[1];return{type:"paragraph",raw:i[0],text:n,tokens:this.lexer.inline(n)}}}text(e){let i=this.rules.block.text.exec(e);if(i)return{type:"text",raw:i[0],text:i[0],tokens:this.lexer.inline(i[0])}}escape(e){let i=this.rules.inline.escape.exec(e);if(i)return{type:"escape",raw:i[0],text:i[1]}}tag(e){let i=this.rules.inline.tag.exec(e);if(i)return!this.lexer.state.inLink&&this.rules.other.startATag.test(i[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(i[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(i[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(i[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:i[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:i[0]}}link(e){let i=this.rules.inline.link.exec(e);if(i){let n=i[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(n)){if(!this.rules.other.endAngleBracket.test(n))return;let h=ll(n.slice(0,-1),"\\");if((n.length-h.length)%2===0)return}else{let h=DC(i[2],"()");if(h===-2)return;if(h>-1){let d=(i[0].indexOf("!")===0?5:4)+i[1].length+h;i[2]=i[2].substring(0,h),i[0]=i[0].substring(0,d).trim(),i[3]=""}}let l=i[2],o="";if(this.options.pedantic){let h=this.rules.other.pedanticHrefTitle.exec(l);h&&(l=h[1],o=h[3])}else o=i[3]?i[3].slice(1,-1):"";return l=l.trim(),this.rules.other.startAngleBracket.test(l)&&(this.options.pedantic&&!this.rules.other.endAngleBracket.test(n)?l=l.slice(1):l=l.slice(1,-1)),Sm(i,{href:l&&l.replace(this.rules.inline.anyPunctuation,"$1"),title:o&&o.replace(this.rules.inline.anyPunctuation,"$1")},i[0],this.lexer,this.rules)}}reflink(e,i){let n;if((n=this.rules.inline.reflink.exec(e))||(n=this.rules.inline.nolink.exec(e))){let l=(n[2]||n[1]).replace(this.rules.other.multipleSpaceGlobal," "),o=i[l.toLowerCase()];if(!o){let h=n[0].charAt(0);return{type:"text",raw:h,text:h}}return Sm(n,o,n[0],this.lexer,this.rules)}}emStrong(e,i,n=""){let l=this.rules.inline.emStrongLDelim.exec(e);if(!(!l||l[3]&&n.match(this.rules.other.unicodeAlphaNumeric))&&(!(l[1]||l[2])||!n||this.rules.inline.punctuation.exec(n))){let o=[...l[0]].length-1,h,d,_=o,p=0,f=l[0][0]==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(f.lastIndex=0,i=i.slice(-1*e.length+o);(l=f.exec(i))!=null;){if(h=l[1]||l[2]||l[3]||l[4]||l[5]||l[6],!h)continue;if(d=[...h].length,l[3]||l[4]){_+=d;continue}else if((l[5]||l[6])&&o%3&&!((o+d)%3)){p+=d;continue}if(_-=d,_>0)continue;d=Math.min(d,d+_+p);let S=[...l[0]][0].length,y=e.slice(0,o+l.index+S+d);if(Math.min(o,d)%2){let C=y.slice(1,-1);return{type:"em",raw:y,text:C,tokens:this.lexer.inlineTokens(C)}}let x=y.slice(2,-2);return{type:"strong",raw:y,text:x,tokens:this.lexer.inlineTokens(x)}}}}codespan(e){let i=this.rules.inline.code.exec(e);if(i){let n=i[2].replace(this.rules.other.newLineCharGlobal," "),l=this.rules.other.nonSpaceChar.test(n),o=this.rules.other.startingSpaceChar.test(n)&&this.rules.other.endingSpaceChar.test(n);return l&&o&&(n=n.substring(1,n.length-1)),{type:"codespan",raw:i[0],text:n}}}br(e){let i=this.rules.inline.br.exec(e);if(i)return{type:"br",raw:i[0]}}del(e,i,n=""){let l=this.rules.inline.delLDelim.exec(e);if(l&&(!l[1]||!n||this.rules.inline.punctuation.exec(n))){let o=[...l[0]].length-1,h,d,_=o,p=this.rules.inline.delRDelim;for(p.lastIndex=0,i=i.slice(-1*e.length+o);(l=p.exec(i))!=null;){if(h=l[1]||l[2]||l[3]||l[4]||l[5]||l[6],!h||(d=[...h].length,d!==o))continue;if(l[3]||l[4]){_+=d;continue}if(_-=d,_>0)continue;d=Math.min(d,d+_);let f=[...l[0]][0].length,S=e.slice(0,o+l.index+f+d),y=S.slice(o,-o);return{type:"del",raw:S,text:y,tokens:this.lexer.inlineTokens(y)}}}}autolink(e){let i=this.rules.inline.autolink.exec(e);if(i){let n,l;return i[2]==="@"?(n=i[1],l="mailto:"+n):(n=i[1],l=n),{type:"link",raw:i[0],text:n,href:l,tokens:[{type:"text",raw:n,text:n}]}}}url(e){let i;if(i=this.rules.inline.url.exec(e)){let n,l;if(i[2]==="@")n=i[0],l="mailto:"+n;else{let o;do o=i[0],i[0]=this.rules.inline._backpedal.exec(i[0])?.[0]??"";while(o!==i[0]);n=i[0],i[1]==="www."?l="http://"+i[0]:l=i[0]}return{type:"link",raw:i[0],text:n,href:l,tokens:[{type:"text",raw:n,text:n}]}}}inlineText(e){let i=this.rules.inline.text.exec(e);if(i){let n=this.lexer.state.inRawBlock;return{type:"text",raw:i[0],text:i[0],escaped:n}}}},bi=class Wu{tokens;options;state;inlineQueue;tokenizer;constructor(i){this.tokens=[],this.tokens.links=Object.create(null),this.options=i||ur,this.options.tokenizer=this.options.tokenizer||new lo,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};let n={other:Mt,block
|
|
127
|
+
`?i[1].slice(0,-1):i[1];return{type:"paragraph",raw:i[0],text:n,tokens:this.lexer.inline(n)}}}text(e){let i=this.rules.block.text.exec(e);if(i)return{type:"text",raw:i[0],text:i[0],tokens:this.lexer.inline(i[0])}}escape(e){let i=this.rules.inline.escape.exec(e);if(i)return{type:"escape",raw:i[0],text:i[1]}}tag(e){let i=this.rules.inline.tag.exec(e);if(i)return!this.lexer.state.inLink&&this.rules.other.startATag.test(i[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(i[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(i[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(i[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:i[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:i[0]}}link(e){let i=this.rules.inline.link.exec(e);if(i){let n=i[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(n)){if(!this.rules.other.endAngleBracket.test(n))return;let h=ll(n.slice(0,-1),"\\");if((n.length-h.length)%2===0)return}else{let h=DC(i[2],"()");if(h===-2)return;if(h>-1){let d=(i[0].indexOf("!")===0?5:4)+i[1].length+h;i[2]=i[2].substring(0,h),i[0]=i[0].substring(0,d).trim(),i[3]=""}}let l=i[2],o="";if(this.options.pedantic){let h=this.rules.other.pedanticHrefTitle.exec(l);h&&(l=h[1],o=h[3])}else o=i[3]?i[3].slice(1,-1):"";return l=l.trim(),this.rules.other.startAngleBracket.test(l)&&(this.options.pedantic&&!this.rules.other.endAngleBracket.test(n)?l=l.slice(1):l=l.slice(1,-1)),Sm(i,{href:l&&l.replace(this.rules.inline.anyPunctuation,"$1"),title:o&&o.replace(this.rules.inline.anyPunctuation,"$1")},i[0],this.lexer,this.rules)}}reflink(e,i){let n;if((n=this.rules.inline.reflink.exec(e))||(n=this.rules.inline.nolink.exec(e))){let l=(n[2]||n[1]).replace(this.rules.other.multipleSpaceGlobal," "),o=i[l.toLowerCase()];if(!o){let h=n[0].charAt(0);return{type:"text",raw:h,text:h}}return Sm(n,o,n[0],this.lexer,this.rules)}}emStrong(e,i,n=""){let l=this.rules.inline.emStrongLDelim.exec(e);if(!(!l||l[3]&&n.match(this.rules.other.unicodeAlphaNumeric))&&(!(l[1]||l[2])||!n||this.rules.inline.punctuation.exec(n))){let o=[...l[0]].length-1,h,d,_=o,p=0,f=l[0][0]==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(f.lastIndex=0,i=i.slice(-1*e.length+o);(l=f.exec(i))!=null;){if(h=l[1]||l[2]||l[3]||l[4]||l[5]||l[6],!h)continue;if(d=[...h].length,l[3]||l[4]){_+=d;continue}else if((l[5]||l[6])&&o%3&&!((o+d)%3)){p+=d;continue}if(_-=d,_>0)continue;d=Math.min(d,d+_+p);let S=[...l[0]][0].length,y=e.slice(0,o+l.index+S+d);if(Math.min(o,d)%2){let C=y.slice(1,-1);return{type:"em",raw:y,text:C,tokens:this.lexer.inlineTokens(C)}}let x=y.slice(2,-2);return{type:"strong",raw:y,text:x,tokens:this.lexer.inlineTokens(x)}}}}codespan(e){let i=this.rules.inline.code.exec(e);if(i){let n=i[2].replace(this.rules.other.newLineCharGlobal," "),l=this.rules.other.nonSpaceChar.test(n),o=this.rules.other.startingSpaceChar.test(n)&&this.rules.other.endingSpaceChar.test(n);return l&&o&&(n=n.substring(1,n.length-1)),{type:"codespan",raw:i[0],text:n}}}br(e){let i=this.rules.inline.br.exec(e);if(i)return{type:"br",raw:i[0]}}del(e,i,n=""){let l=this.rules.inline.delLDelim.exec(e);if(l&&(!l[1]||!n||this.rules.inline.punctuation.exec(n))){let o=[...l[0]].length-1,h,d,_=o,p=this.rules.inline.delRDelim;for(p.lastIndex=0,i=i.slice(-1*e.length+o);(l=p.exec(i))!=null;){if(h=l[1]||l[2]||l[3]||l[4]||l[5]||l[6],!h||(d=[...h].length,d!==o))continue;if(l[3]||l[4]){_+=d;continue}if(_-=d,_>0)continue;d=Math.min(d,d+_);let f=[...l[0]][0].length,S=e.slice(0,o+l.index+f+d),y=S.slice(o,-o);return{type:"del",raw:S,text:y,tokens:this.lexer.inlineTokens(y)}}}}autolink(e){let i=this.rules.inline.autolink.exec(e);if(i){let n,l;return i[2]==="@"?(n=i[1],l="mailto:"+n):(n=i[1],l=n),{type:"link",raw:i[0],text:n,href:l,tokens:[{type:"text",raw:n,text:n}]}}}url(e){let i;if(i=this.rules.inline.url.exec(e)){let n,l;if(i[2]==="@")n=i[0],l="mailto:"+n;else{let o;do o=i[0],i[0]=this.rules.inline._backpedal.exec(i[0])?.[0]??"";while(o!==i[0]);n=i[0],i[1]==="www."?l="http://"+i[0]:l=i[0]}return{type:"link",raw:i[0],text:n,href:l,tokens:[{type:"text",raw:n,text:n}]}}}inlineText(e){let i=this.rules.inline.text.exec(e);if(i){let n=this.lexer.state.inRawBlock;return{type:"text",raw:i[0],text:i[0],escaped:n}}}},bi=class Wu{tokens;options;state;inlineQueue;tokenizer;constructor(i){this.tokens=[],this.tokens.links=Object.create(null),this.options=i||ur,this.options.tokenizer=this.options.tokenizer||new lo,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};let n={other:Mt,block:$a.normal,inline:nl.normal};this.options.pedantic?(n.block=$a.pedantic,n.inline=nl.pedantic):this.options.gfm&&(n.block=$a.gfm,this.options.breaks?n.inline=nl.breaks:n.inline=nl.gfm),this.tokenizer.rules=n}static get rules(){return{block:$a,inline:nl}}static lex(i,n){return new Wu(n).lex(i)}static lexInline(i,n){return new Wu(n).inlineTokens(i)}lex(i){i=i.replace(Mt.carriageReturn,`
|
|
128
128
|
`),this.blockTokens(i,this.tokens);for(let n=0;n<this.inlineQueue.length;n++){let l=this.inlineQueue[n];this.inlineTokens(l.src,l.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(i,n=[],l=!1){for(this.options.pedantic&&(i=i.replace(Mt.tabCharGlobal," ").replace(Mt.spaceLine,""));i;){let o;if(this.options.extensions?.block?.some(d=>(o=d.call({lexer:this},i,n))?(i=i.substring(o.raw.length),n.push(o),!0):!1))continue;if(o=this.tokenizer.space(i)){i=i.substring(o.raw.length);let d=n.at(-1);o.raw.length===1&&d!==void 0?d.raw+=`
|
|
129
129
|
`:n.push(o);continue}if(o=this.tokenizer.code(i)){i=i.substring(o.raw.length);let d=n.at(-1);d?.type==="paragraph"||d?.type==="text"?(d.raw+=(d.raw.endsWith(`
|
|
130
130
|
`)?"":`
|
|
@@ -158,4 +158,4 @@ ${e}</tr>
|
|
|
158
158
|
`}tablecell(e){let i=this.parser.parseInline(e.tokens),n=e.header?"th":"td";return(e.align?`<${n} align="${e.align}">`:`<${n}>`)+i+`</${n}>
|
|
159
159
|
`}strong({tokens:e}){return`<strong>${this.parser.parseInline(e)}</strong>`}em({tokens:e}){return`<em>${this.parser.parseInline(e)}</em>`}codespan({text:e}){return`<code>${zi(e,!0)}</code>`}br(e){return"<br>"}del({tokens:e}){return`<del>${this.parser.parseInline(e)}</del>`}link({href:e,title:i,tokens:n}){let l=this.parser.parseInline(n),o=vm(e);if(o===null)return l;e=o;let h='<a href="'+e+'"';return i&&(h+=' title="'+zi(i)+'"'),h+=">"+l+"</a>",h}image({href:e,title:i,text:n,tokens:l}){l&&(n=this.parser.parseInline(l,this.parser.textRenderer));let o=vm(e);if(o===null)return zi(n);e=o;let h=`<img src="${e}" alt="${zi(n)}"`;return i&&(h+=` title="${zi(i)}"`),h+=">",h}text(e){return"tokens"in e&&e.tokens?this.parser.parseInline(e.tokens):"escaped"in e&&e.escaped?e.text:zi(e.text)}},ad=class{strong({text:e}){return e}em({text:e}){return e}codespan({text:e}){return e}del({text:e}){return e}html({text:e}){return e}text({text:e}){return e}link({text:e}){return""+e}image({text:e}){return""+e}br(){return""}checkbox({raw:e}){return e}},xi=class qu{options;renderer;textRenderer;constructor(i){this.options=i||ur,this.options.renderer=this.options.renderer||new ao,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new ad}static parse(i,n){return new qu(n).parse(i)}static parseInline(i,n){return new qu(n).parseInline(i)}parse(i){let n="";for(let l=0;l<i.length;l++){let o=i[l];if(this.options.extensions?.renderers?.[o.type]){let d=o,_=this.options.extensions.renderers[d.type].call({parser:this},d);if(_!==!1||!["space","hr","heading","code","table","blockquote","list","html","def","paragraph","text"].includes(d.type)){n+=_||"";continue}}let h=o;switch(h.type){case"space":{n+=this.renderer.space(h);break}case"hr":{n+=this.renderer.hr(h);break}case"heading":{n+=this.renderer.heading(h);break}case"code":{n+=this.renderer.code(h);break}case"table":{n+=this.renderer.table(h);break}case"blockquote":{n+=this.renderer.blockquote(h);break}case"list":{n+=this.renderer.list(h);break}case"checkbox":{n+=this.renderer.checkbox(h);break}case"html":{n+=this.renderer.html(h);break}case"def":{n+=this.renderer.def(h);break}case"paragraph":{n+=this.renderer.paragraph(h);break}case"text":{n+=this.renderer.text(h);break}default:{let d='Token with "'+h.type+'" type was not found.';if(this.options.silent)return console.error(d),"";throw new Error(d)}}}return n}parseInline(i,n=this.renderer){let l="";for(let o=0;o<i.length;o++){let h=i[o];if(this.options.extensions?.renderers?.[h.type]){let _=this.options.extensions.renderers[h.type].call({parser:this},h);if(_!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(h.type)){l+=_||"";continue}}let d=h;switch(d.type){case"escape":{l+=n.text(d);break}case"html":{l+=n.html(d);break}case"link":{l+=n.link(d);break}case"image":{l+=n.image(d);break}case"checkbox":{l+=n.checkbox(d);break}case"strong":{l+=n.strong(d);break}case"em":{l+=n.em(d);break}case"codespan":{l+=n.codespan(d);break}case"br":{l+=n.br(d);break}case"del":{l+=n.del(d);break}case"text":{l+=n.text(d);break}default:{let _='Token with "'+d.type+'" type was not found.';if(this.options.silent)return console.error(_),"";throw new Error(_)}}}return l}},dl=class{options;block;constructor(e){this.options=e||ur}static passThroughHooks=new Set(["preprocess","postprocess","processAllTokens","emStrongMask"]);static passThroughHooksRespectAsync=new Set(["preprocess","postprocess","processAllTokens"]);preprocess(e){return e}postprocess(e){return e}processAllTokens(e){return e}emStrongMask(e){return e}provideLexer(){return this.block?bi.lex:bi.lexInline}provideParser(){return this.block?xi.parse:xi.parseInline}},zC=class{defaults=Ju();options=this.setOptions;parse=this.parseMarkdown(!0);parseInline=this.parseMarkdown(!1);Parser=xi;Renderer=ao;TextRenderer=ad;Lexer=bi;Tokenizer=lo;Hooks=dl;constructor(...e){this.use(...e)}walkTokens(e,i){let n=[];for(let l of e)switch(n=n.concat(i.call(this,l)),l.type){case"table":{let o=l;for(let h of o.header)n=n.concat(this.walkTokens(h.tokens,i));for(let h of o.rows)for(let d of h)n=n.concat(this.walkTokens(d.tokens,i));break}case"list":{let o=l;n=n.concat(this.walkTokens(o.items,i));break}default:{let o=l;this.defaults.extensions?.childTokens?.[o.type]?this.defaults.extensions.childTokens[o.type].forEach(h=>{let d=o[h].flat(1/0);n=n.concat(this.walkTokens(d,i))}):o.tokens&&(n=n.concat(this.walkTokens(o.tokens,i)))}}return n}use(...e){let i=this.defaults.extensions||{renderers:{},childTokens:{}};return e.forEach(n=>{let l={...n};if(l.async=this.defaults.async||l.async||!1,n.extensions&&(n.extensions.forEach(o=>{if(!o.name)throw new Error("extension name required");if("renderer"in o){let h=i.renderers[o.name];h?i.renderers[o.name]=function(...d){let _=o.renderer.apply(this,d);return _===!1&&(_=h.apply(this,d)),_}:i.renderers[o.name]=o.renderer}if("tokenizer"in o){if(!o.level||o.level!=="block"&&o.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");let h=i[o.level];h?h.unshift(o.tokenizer):i[o.level]=[o.tokenizer],o.start&&(o.level==="block"?i.startBlock?i.startBlock.push(o.start):i.startBlock=[o.start]:o.level==="inline"&&(i.startInline?i.startInline.push(o.start):i.startInline=[o.start]))}"childTokens"in o&&o.childTokens&&(i.childTokens[o.name]=o.childTokens)}),l.extensions=i),n.renderer){let o=this.defaults.renderer||new ao(this.defaults);for(let h in n.renderer){if(!(h in o))throw new Error(`renderer '${h}' does not exist`);if(["options","parser"].includes(h))continue;let d=h,_=n.renderer[d],p=o[d];o[d]=(...f)=>{let S=_.apply(o,f);return S===!1&&(S=p.apply(o,f)),S||""}}l.renderer=o}if(n.tokenizer){let o=this.defaults.tokenizer||new lo(this.defaults);for(let h in n.tokenizer){if(!(h in o))throw new Error(`tokenizer '${h}' does not exist`);if(["options","rules","lexer"].includes(h))continue;let d=h,_=n.tokenizer[d],p=o[d];o[d]=(...f)=>{let S=_.apply(o,f);return S===!1&&(S=p.apply(o,f)),S}}l.tokenizer=o}if(n.hooks){let o=this.defaults.hooks||new dl;for(let h in n.hooks){if(!(h in o))throw new Error(`hook '${h}' does not exist`);if(["options","block"].includes(h))continue;let d=h,_=n.hooks[d],p=o[d];dl.passThroughHooks.has(h)?o[d]=f=>{if(this.defaults.async&&dl.passThroughHooksRespectAsync.has(h))return(async()=>{let y=await _.call(o,f);return p.call(o,y)})();let S=_.call(o,f);return p.call(o,S)}:o[d]=(...f)=>{if(this.defaults.async)return(async()=>{let y=await _.apply(o,f);return y===!1&&(y=await p.apply(o,f)),y})();let S=_.apply(o,f);return S===!1&&(S=p.apply(o,f)),S}}l.hooks=o}if(n.walkTokens){let o=this.defaults.walkTokens,h=n.walkTokens;l.walkTokens=function(d){let _=[];return _.push(h.call(this,d)),o&&(_=_.concat(o.call(this,d))),_}}this.defaults={...this.defaults,...l}}),this}setOptions(e){return this.defaults={...this.defaults,...e},this}lexer(e,i){return bi.lex(e,i??this.defaults)}parser(e,i){return xi.parse(e,i??this.defaults)}parseMarkdown(e){return(i,n)=>{let l={...n},o={...this.defaults,...l},h=this.onError(!!o.silent,!!o.async);if(this.defaults.async===!0&&l.async===!1)return h(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));if(typeof i>"u"||i===null)return h(new Error("marked(): input parameter is undefined or null"));if(typeof i!="string")return h(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(i)+", string expected"));if(o.hooks&&(o.hooks.options=o,o.hooks.block=e),o.async)return(async()=>{let d=o.hooks?await o.hooks.preprocess(i):i,_=await(o.hooks?await o.hooks.provideLexer():e?bi.lex:bi.lexInline)(d,o),p=o.hooks?await o.hooks.processAllTokens(_):_;o.walkTokens&&await Promise.all(this.walkTokens(p,o.walkTokens));let f=await(o.hooks?await o.hooks.provideParser():e?xi.parse:xi.parseInline)(p,o);return o.hooks?await o.hooks.postprocess(f):f})().catch(h);try{o.hooks&&(i=o.hooks.preprocess(i));let d=(o.hooks?o.hooks.provideLexer():e?bi.lex:bi.lexInline)(i,o);o.hooks&&(d=o.hooks.processAllTokens(d)),o.walkTokens&&this.walkTokens(d,o.walkTokens);let _=(o.hooks?o.hooks.provideParser():e?xi.parse:xi.parseInline)(d,o);return o.hooks&&(_=o.hooks.postprocess(_)),_}catch(d){return h(d)}}}onError(e,i){return n=>{if(n.message+=`
|
|
160
160
|
Please report this to https://github.com/markedjs/marked.`,e){let l="<p>An error occurred:</p><pre>"+zi(n.message+"",!0)+"</pre>";return i?Promise.resolve(l):l}if(i)return Promise.reject(n);throw n}}},cr=new zC;function Le(e,i){return cr.parse(e,i)}Le.options=Le.setOptions=function(e){return cr.setOptions(e),Le.defaults=cr.defaults,Tv(Le.defaults),Le};Le.getDefaults=Ju;Le.defaults=ur;Le.use=function(...e){return cr.use(...e),Le.defaults=cr.defaults,Tv(Le.defaults),Le};Le.walkTokens=function(e,i){return cr.walkTokens(e,i)};Le.parseInline=cr.parseInline;Le.Parser=xi;Le.parser=xi.parse;Le.Renderer=ao;Le.TextRenderer=ad;Le.Lexer=bi;Le.lexer=bi.lex;Le.Tokenizer=lo;Le.Hooks=dl;Le.parse=Le;Le.options;Le.setOptions;Le.use;Le.walkTokens;Le.parseInline;xi.parse;bi.lex;function AC(e){return e.replace(/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,"").replace(/\bon\w+\s*=\s*"[^"]*"/gi,"").replace(/\bon\w+\s*=\s*'[^']*'/gi,"").replace(/javascript\s*:/gi,"")}function bm(e){const i=[];let n="",l=!1;for(const o of e){if(o==='"'){l=!l;continue}if(o===","&&!l){i.push(n.trim()),n="";continue}n+=o}return i.push(n.trim()),i}function OC({content:e}){const i=e.trim().split(`
|
|
161
|
-
`).filter(Boolean);if(i.length===0)return g.jsx("p",{className:"text-sm text-[var(--text-secondary)]",children:"Empty CSV"});const n=bm(i[0]),l=i.slice(1).map(o=>bm(o));return g.jsx("div",{className:"overflow-auto",children:g.jsxs("table",{className:"text-sm border-collapse w-full",children:[g.jsx("thead",{children:g.jsx("tr",{children:n.map((o,h)=>g.jsx("th",{className:"border border-[var(--border)] px-3 py-1.5 text-left font-semibold bg-[var(--bg-sidebar)] text-[var(--text-primary)]",children:o.trim()},h))})}),g.jsx("tbody",{children:l.map((o,h)=>g.jsx("tr",{className:"even:bg-[var(--bg-sidebar)]",children:o.map((d,_)=>g.jsx("td",{className:"border border-[var(--border)] px-3 py-1.5 text-[var(--text-primary)]",children:d.trim()},_))},h))})]})})}const go="h-full bg-[var(--bg-secondary)] flex flex-col";function LC({output:e}){return e.status==="empty"?g.jsx(NC,{}):e.status==="processing"?g.jsx(HC,{outcome:e.outcome,fileCount:e.fileCount}):e.status==="error"?g.jsx(UC,{message:e.message}):g.jsx(jC,{output:e})}function jC({output:e}){const{selectedOutcome:i}=ji(),[n,l]=z.useState(!1),[o,h]=z.useState(""),[d,_]=z.useState(null),p=e.path.split("/").pop()||e.path,f=e.path.endsWith(".csv"),S=()=>{navigator.clipboard.writeText(e.content)},y=()=>{const C=new Blob([e.content],{type:"text/plain"}),b=URL.createObjectURL(C),T=document.createElement("a");T.href=b,T.download=p,T.click(),URL.revokeObjectURL(b)},x=()=>{if(d||!o.trim())return;const C=o.trim();_b({id:crypto.randomUUID(),name:C,outcomeKey:i||"custom",content:e.content,createdAt:Date.now()}),_(C)};return g.jsxs("div",{className:`${go}`,children:[g.jsxs("div",{className:"flex items-center justify-between px-4 py-2 border-b border-[var(--border)] shrink-0",children:[g.jsx("span",{className:"text-sm font-medium text-[var(--text-primary)] truncate",children:p}),g.jsxs("div",{className:"flex gap-2 ml-2 shrink-0",children:[g.jsx("button",{onClick:S,"aria-label":"Copy output to clipboard",className:"text-xs px-3 py-1 rounded border border-[var(--border)] text-[var(--text-secondary)] hover:text-[var(--text-primary)] hover:bg-[var(--bg-sidebar)] transition-colors",children:"Copy"}),g.jsx("button",{onClick:y,"aria-label":"Download output file",className:"text-xs px-3 py-1 rounded border border-[var(--border)] text-[var(--text-secondary)] hover:text-[var(--text-primary)] hover:bg-[var(--bg-sidebar)] transition-colors",children:"Download"})]})]}),g.jsx("div",{className:"flex-1 overflow-auto px-4 py-3 min-h-0",children:f?g.jsx(OC,{content:e.content}):g.jsx("div",{className:"output-prose",dangerouslySetInnerHTML:{__html:AC(Le.parse(e.content,{async:!1}))}})}),g.jsxs("div",{className:"shrink-0 px-4 py-1.5 border-t border-[var(--border)] text-xs text-green-600",children:["✓ Saved to ",e.path]}),g.jsx("div",{className:"shrink-0 px-4 py-2 border-t border-[var(--border)]",children:d?g.jsxs("p",{className:"text-xs text-indigo-600 font-medium",children:["⭐ Saved as ‘",d,"’"]}):n?g.jsxs("div",{className:"flex gap-2",children:[g.jsx("input",{type:"text",value:o,onChange:C=>h(C.target.value),placeholder:"Template name...",className:"flex-1 text-xs px-2 py-1 rounded border border-[var(--border)] bg-[var(--bg-secondary)] text-[var(--text-primary)] outline-none focus:ring-1 focus:ring-indigo-400",autoFocus:!0,onKeyDown:C=>{C.key==="Enter"&&x()}}),g.jsx("button",{onClick:x,className:"text-xs px-3 py-1 rounded bg-indigo-600 text-white font-medium hover:bg-indigo-700 transition-colors",children:"Save"})]}):g.jsx("button",{onClick:()=>l(!0),className:"w-full text-xs py-2 rounded-lg border border-dashed transition-colors hover:border-indigo-400 hover:text-indigo-600",style:{borderColor:"var(--border)",color:"var(--text-secondary)",background:"transparent",cursor:"pointer"},children:"⭐ Like this style? Save it as a template"})})]})}function NC(){const{loadOutput:e}=ji(),[i,n]=z.useState(!1),l=async()=>{n(!0);try{const h=await(await fetch("/api/pick-file")).json();if(h?.path){const _=await(await fetch(`/api/read-file?path=${encodeURIComponent(h.path)}`)).json();(_?.content||_?.binary)&&await e(h.path)}}catch{}n(!1)};return g.jsxs("div",{className:`${go} items-center justify-center gap-3`,children:[g.jsx("span",{className:"text-4xl",children:"📄"}),g.jsx("p",{className:"text-base font-medium text-[var(--text-primary)]",children:"Your output will appear here"}),g.jsx("p",{className:"text-sm text-[var(--text-secondary)]",children:"Pick a folder and outcome, then hit Go"}),g.jsx("button",{onClick:l,disabled:i,style:{padding:"8px 20px",borderRadius:"10px",border:"1px solid var(--border)",background:"transparent",color:"var(--text-secondary)",fontSize:"13px",fontWeight:500,cursor:i?"not-allowed":"pointer",marginTop:"8px",transition:"all 0.15s"},children:i?"Opening...":"📂 Open a document"})]})}function HC({outcome:e,fileCount:i}){const{folderPath:n,loadOutput:l}=ji(),[o,h]=z.useState(!1),d=async()=>{if(n){h(!0);try{const p=await(await fetch(`/api/latest-output?folderPath=${encodeURIComponent(n)}`)).json();p?.path&&await l(p.path)}catch{}h(!1)}};return g.jsxs("div",{className:`${go} items-center justify-center gap-2`,children:[g.jsx("span",{className:"text-4xl animate-pulse",children:"⏳"}),g.jsxs("p",{className:"text-base font-medium text-[var(--text-primary)]",children:[e," — ",i," documents..."]}),g.jsx("p",{className:"text-sm text-[var(--text-secondary)]",children:"Claude is working — check the terminal for progress"}),g.jsx("button",{onClick:d,disabled:o,style:{padding:"8px 18px",borderRadius:"8px",border:"1px solid var(--border)",background:"transparent",color:"var(--text-secondary)",fontSize:"12px",fontWeight:500,cursor:o?"not-allowed":"pointer",marginTop:"12px"},children:o?"Checking...":"Check if done"})]})}function UC({message:e}){const{folderPath:i,loadOutput:n}=ji(),[l,o]=z.useState(!1),[h,d]=z.useState(!1),_=async()=>{if(i){o(!0),d(!1);try{const f=await(await fetch(`/api/latest-output?folderPath=${encodeURIComponent(i)}`)).json();f?.path?await n(f.path):d(!0)}catch{d(!0)}o(!1)}};return g.jsxs("div",{className:`${go} items-center justify-center gap-3`,children:[g.jsx("span",{className:"text-4xl",children:"⚠️"}),g.jsx("p",{style:{fontSize:"13px",color:"#dc2626",textAlign:"center",maxWidth:"300px"},children:e}),g.jsx("button",{onClick:_,disabled:l,style:{padding:"10px 24px",borderRadius:"10px",border:"none",background:"#6366f1",color:"#fff",fontSize:"14px",fontWeight:600,cursor:l?"not-allowed":"pointer",opacity:l?.6:1,marginTop:"8px"},children:l?"Checking...":"Check for output"}),h&&g.jsx("p",{style:{fontSize:"12px",color:"#f59e0b",textAlign:"center"},children:"No output file found yet. Claude may still be working — try again in a moment."}),g.jsx("p",{style:{fontSize:"11px",color:"#9ca3af",textAlign:"center"},children:"Click to check if Claude has finished writing the output file"})]})}function WC(){const[e,i]=z.useState(!0),{mode:n}=Et(),l=ji();return DS(),z.useEffect(()=>(n==="document"?document.documentElement.classList.add("doc-mode"):document.documentElement.classList.remove("doc-mode"),()=>document.documentElement.classList.remove("doc-mode")),[n]),g.jsxs("div",{className:"h-full flex flex-col",style:{background:"#f8fafc"},children:[g.jsx(PS,{}),g.jsx(IS,{}),g.jsxs("div",{className:"flex-1 flex min-h-0",children:[g.jsx(
|
|
161
|
+
`).filter(Boolean);if(i.length===0)return g.jsx("p",{className:"text-sm text-[var(--text-secondary)]",children:"Empty CSV"});const n=bm(i[0]),l=i.slice(1).map(o=>bm(o));return g.jsx("div",{className:"overflow-auto",children:g.jsxs("table",{className:"text-sm border-collapse w-full",children:[g.jsx("thead",{children:g.jsx("tr",{children:n.map((o,h)=>g.jsx("th",{className:"border border-[var(--border)] px-3 py-1.5 text-left font-semibold bg-[var(--bg-sidebar)] text-[var(--text-primary)]",children:o.trim()},h))})}),g.jsx("tbody",{children:l.map((o,h)=>g.jsx("tr",{className:"even:bg-[var(--bg-sidebar)]",children:o.map((d,_)=>g.jsx("td",{className:"border border-[var(--border)] px-3 py-1.5 text-[var(--text-primary)]",children:d.trim()},_))},h))})]})})}const go="h-full bg-[var(--bg-secondary)] flex flex-col";function LC({output:e}){return e.status==="empty"?g.jsx(NC,{}):e.status==="processing"?g.jsx(HC,{outcome:e.outcome,fileCount:e.fileCount}):e.status==="error"?g.jsx(UC,{message:e.message}):g.jsx(jC,{output:e})}function jC({output:e}){const{selectedOutcome:i}=ji(),[n,l]=z.useState(!1),[o,h]=z.useState(""),[d,_]=z.useState(null),p=e.path.split("/").pop()||e.path,f=e.path.endsWith(".csv"),S=()=>{navigator.clipboard.writeText(e.content)},y=()=>{const C=new Blob([e.content],{type:"text/plain"}),b=URL.createObjectURL(C),T=document.createElement("a");T.href=b,T.download=p,T.click(),URL.revokeObjectURL(b)},x=()=>{if(d||!o.trim())return;const C=o.trim();_b({id:crypto.randomUUID(),name:C,outcomeKey:i||"custom",content:e.content,createdAt:Date.now()}),_(C)};return g.jsxs("div",{className:`${go}`,children:[g.jsxs("div",{className:"flex items-center justify-between px-4 py-2 border-b border-[var(--border)] shrink-0",children:[g.jsx("span",{className:"text-sm font-medium text-[var(--text-primary)] truncate",children:p}),g.jsxs("div",{className:"flex gap-2 ml-2 shrink-0",children:[g.jsx("button",{onClick:S,"aria-label":"Copy output to clipboard",className:"text-xs px-3 py-1 rounded border border-[var(--border)] text-[var(--text-secondary)] hover:text-[var(--text-primary)] hover:bg-[var(--bg-sidebar)] transition-colors",children:"Copy"}),g.jsx("button",{onClick:y,"aria-label":"Download output file",className:"text-xs px-3 py-1 rounded border border-[var(--border)] text-[var(--text-secondary)] hover:text-[var(--text-primary)] hover:bg-[var(--bg-sidebar)] transition-colors",children:"Download"})]})]}),g.jsx("div",{className:"flex-1 overflow-auto px-4 py-3 min-h-0",children:f?g.jsx(OC,{content:e.content}):g.jsx("div",{className:"output-prose",dangerouslySetInnerHTML:{__html:AC(Le.parse(e.content,{async:!1}))}})}),g.jsxs("div",{className:"shrink-0 px-4 py-1.5 border-t border-[var(--border)] text-xs text-green-600",children:["✓ Saved to ",e.path]}),g.jsx("div",{className:"shrink-0 px-4 py-2 border-t border-[var(--border)]",children:d?g.jsxs("p",{className:"text-xs text-indigo-600 font-medium",children:["⭐ Saved as ‘",d,"’"]}):n?g.jsxs("div",{className:"flex gap-2",children:[g.jsx("input",{type:"text",value:o,onChange:C=>h(C.target.value),placeholder:"Template name...",className:"flex-1 text-xs px-2 py-1 rounded border border-[var(--border)] bg-[var(--bg-secondary)] text-[var(--text-primary)] outline-none focus:ring-1 focus:ring-indigo-400",autoFocus:!0,onKeyDown:C=>{C.key==="Enter"&&x()}}),g.jsx("button",{onClick:x,className:"text-xs px-3 py-1 rounded bg-indigo-600 text-white font-medium hover:bg-indigo-700 transition-colors",children:"Save"})]}):g.jsx("button",{onClick:()=>l(!0),className:"w-full text-xs py-2 rounded-lg border border-dashed transition-colors hover:border-indigo-400 hover:text-indigo-600",style:{borderColor:"var(--border)",color:"var(--text-secondary)",background:"transparent",cursor:"pointer"},children:"⭐ Like this style? Save it as a template"})})]})}function NC(){const{loadOutput:e}=ji(),[i,n]=z.useState(!1),l=async()=>{n(!0);try{const h=await(await fetch("/api/pick-file")).json();if(h?.path){const _=await(await fetch(`/api/read-file?path=${encodeURIComponent(h.path)}`)).json();(_?.content||_?.binary)&&await e(h.path)}}catch{}n(!1)};return g.jsxs("div",{className:`${go} items-center justify-center gap-3`,children:[g.jsx("span",{className:"text-4xl",children:"📄"}),g.jsx("p",{className:"text-base font-medium text-[var(--text-primary)]",children:"Your output will appear here"}),g.jsx("p",{className:"text-sm text-[var(--text-secondary)]",children:"Pick a folder and outcome, then hit Go"}),g.jsx("button",{onClick:l,disabled:i,style:{padding:"8px 20px",borderRadius:"10px",border:"1px solid var(--border)",background:"transparent",color:"var(--text-secondary)",fontSize:"13px",fontWeight:500,cursor:i?"not-allowed":"pointer",marginTop:"8px",transition:"all 0.15s"},children:i?"Opening...":"📂 Open a document"})]})}function HC({outcome:e,fileCount:i}){const{folderPath:n,loadOutput:l}=ji(),[o,h]=z.useState(!1),d=async()=>{if(n){h(!0);try{const p=await(await fetch(`/api/latest-output?folderPath=${encodeURIComponent(n)}`)).json();p?.path&&await l(p.path)}catch{}h(!1)}};return g.jsxs("div",{className:`${go} items-center justify-center gap-2`,children:[g.jsx("span",{className:"text-4xl animate-pulse",children:"⏳"}),g.jsxs("p",{className:"text-base font-medium text-[var(--text-primary)]",children:[e," — ",i," documents..."]}),g.jsx("p",{className:"text-sm text-[var(--text-secondary)]",children:"Claude is working — check the terminal for progress"}),g.jsx("button",{onClick:d,disabled:o,style:{padding:"8px 18px",borderRadius:"8px",border:"1px solid var(--border)",background:"transparent",color:"var(--text-secondary)",fontSize:"12px",fontWeight:500,cursor:o?"not-allowed":"pointer",marginTop:"12px"},children:o?"Checking...":"Check if done"})]})}function UC({message:e}){const{folderPath:i,loadOutput:n}=ji(),[l,o]=z.useState(!1),[h,d]=z.useState(!1),_=async()=>{if(i){o(!0),d(!1);try{const f=await(await fetch(`/api/latest-output?folderPath=${encodeURIComponent(i)}`)).json();f?.path?await n(f.path):d(!0)}catch{d(!0)}o(!1)}};return g.jsxs("div",{className:`${go} items-center justify-center gap-3`,children:[g.jsx("span",{className:"text-4xl",children:"⚠️"}),g.jsx("p",{style:{fontSize:"13px",color:"#dc2626",textAlign:"center",maxWidth:"300px"},children:e}),g.jsx("button",{onClick:_,disabled:l,style:{padding:"10px 24px",borderRadius:"10px",border:"none",background:"#6366f1",color:"#fff",fontSize:"14px",fontWeight:600,cursor:l?"not-allowed":"pointer",opacity:l?.6:1,marginTop:"8px"},children:l?"Checking...":"Check for output"}),h&&g.jsx("p",{style:{fontSize:"12px",color:"#f59e0b",textAlign:"center"},children:"No output file found yet. Claude may still be working — try again in a moment."}),g.jsx("p",{style:{fontSize:"11px",color:"#9ca3af",textAlign:"center"},children:"Click to check if Claude has finished writing the output file"})]})}function WC(){const[e,i]=z.useState(!0),{mode:n}=Et(),l=ji();return DS(),z.useEffect(()=>(n==="document"?document.documentElement.classList.add("doc-mode"):document.documentElement.classList.remove("doc-mode"),()=>document.documentElement.classList.remove("doc-mode")),[n]),g.jsxs("div",{className:"h-full flex flex-col",style:{background:"#f8fafc"},children:[g.jsx(PS,{}),g.jsx(IS,{}),g.jsxs("div",{className:"flex-1 flex min-h-0",children:[g.jsx(YS,{open:e,onToggle:()=>i(!e)}),g.jsx(wb,{open:e}),g.jsxs("div",{className:"flex-1 flex min-w-0",children:[g.jsx("div",{className:"flex-1 min-w-0 flex flex-col",style:{background:"#1a1a2e"},children:g.jsx(Pw,{})}),g.jsx("div",{style:{width:"45%",flexShrink:0,borderLeft:"1px solid #e5e7eb"},children:n==="developer"?g.jsx(Iw,{}):g.jsx(LC,{output:l.output})})]})]})]})}function qC(){return g.jsx(RS,{children:g.jsx(WC,{})})}function PC(){const{path:e,editingBrain:i,setEditingBrain:n,setProjectPath:l}=Et();return i&&e?g.jsx("div",{className:"h-full flex items-center justify-center",style:{background:"var(--bg-primary)"},children:g.jsx("div",{className:"w-full max-w-[600px] px-8",children:g.jsx(Mm,{onDone:()=>n(!1)})})}):e?g.jsx(qC,{}):g.jsx(qS,{onProjectSelected:l})}function IC(){return g.jsx(SS,{children:g.jsx(xS,{children:g.jsx(PC,{})})})}mS.createRoot(document.getElementById("root")).render(g.jsx(z.StrictMode,{children:g.jsx(IC,{})}));
|