termbridge 0.3.2 → 0.3.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,103 @@
1
+ function g2(t,e){for(var i=0;i<e.length;i++){const n=e[i];if(typeof n!="string"&&!Array.isArray(n)){for(const a in n)if(a!=="default"&&!(a in t)){const l=Object.getOwnPropertyDescriptor(n,a);l&&Object.defineProperty(t,a,l.get?l:{enumerable:!0,get:()=>n[a]})}}}return Object.freeze(Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}))}(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const a of document.querySelectorAll('link[rel="modulepreload"]'))n(a);new MutationObserver(a=>{for(const l of a)if(l.type==="childList")for(const u of l.addedNodes)u.tagName==="LINK"&&u.rel==="modulepreload"&&n(u)}).observe(document,{childList:!0,subtree:!0});function i(a){const l={};return a.integrity&&(l.integrity=a.integrity),a.referrerPolicy&&(l.referrerPolicy=a.referrerPolicy),a.crossOrigin==="use-credentials"?l.credentials="include":a.crossOrigin==="anonymous"?l.credentials="omit":l.credentials="same-origin",l}function n(a){if(a.ep)return;a.ep=!0;const l=i(a);fetch(a.href,l)}})();function Z1(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var w_={exports:{}},Kc={};var vy;function v2(){if(vy)return Kc;vy=1;var t=Symbol.for("react.transitional.element"),e=Symbol.for("react.fragment");function i(n,a,l){var u=null;if(l!==void 0&&(u=""+l),a.key!==void 0&&(u=""+a.key),"key"in a){l={};for(var h in a)h!=="key"&&(l[h]=a[h])}else l=a;return a=l.ref,{$$typeof:t,type:n,key:u,ref:a!==void 0?a:null,props:l}}return Kc.Fragment=e,Kc.jsx=i,Kc.jsxs=i,Kc}var Sy;function S2(){return Sy||(Sy=1,w_.exports=v2()),w_.exports}var U=S2(),C_={exports:{}},Xc={},x_={exports:{}},k_={};var yy;function y2(){return yy||(yy=1,(function(t){function e(E,M){var z=E.length;E.push(M);e:for(;0<z;){var q=z-1>>>1,G=E[q];if(0<a(G,M))E[q]=M,E[z]=G,z=q;else break e}}function i(E){return E.length===0?null:E[0]}function n(E){if(E.length===0)return null;var M=E[0],z=E.pop();if(z!==M){E[0]=z;e:for(var q=0,G=E.length,B=G>>>1;q<B;){var K=2*(q+1)-1,te=E[K],ne=K+1,de=E[ne];if(0>a(te,z))ne<G&&0>a(de,te)?(E[q]=de,E[ne]=z,q=ne):(E[q]=te,E[K]=z,q=K);else if(ne<G&&0>a(de,z))E[q]=de,E[ne]=z,q=ne;else break e}}return M}function a(E,M){var z=E.sortIndex-M.sortIndex;return z!==0?z:E.id-M.id}if(t.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var l=performance;t.unstable_now=function(){return l.now()}}else{var u=Date,h=u.now();t.unstable_now=function(){return u.now()-h}}var f=[],d=[],g=1,v=null,p=3,S=!1,y=!1,C=!1,x=!1,R=typeof setTimeout=="function"?setTimeout:null,L=typeof clearTimeout=="function"?clearTimeout:null,N=typeof setImmediate<"u"?setImmediate:null;function T(E){for(var M=i(d);M!==null;){if(M.callback===null)n(d);else if(M.startTime<=E)n(d),M.sortIndex=M.expirationTime,e(f,M);else break;M=i(d)}}function W(E){if(C=!1,T(E),!y)if(i(f)!==null)y=!0,D||(D=!0,A());else{var M=i(d);M!==null&&$(W,M.startTime-E)}}var D=!1,I=-1,H=5,V=-1;function se(){return x?!0:!(t.unstable_now()-V<H)}function Q(){if(x=!1,D){var E=t.unstable_now();V=E;var M=!0;try{e:{y=!1,C&&(C=!1,L(I),I=-1),S=!0;var z=p;try{t:{for(T(E),v=i(f);v!==null&&!(v.expirationTime>E&&se());){var q=v.callback;if(typeof q=="function"){v.callback=null,p=v.priorityLevel;var G=q(v.expirationTime<=E);if(E=t.unstable_now(),typeof G=="function"){v.callback=G,T(E),M=!0;break t}v===i(f)&&n(f),T(E)}else n(f);v=i(f)}if(v!==null)M=!0;else{var B=i(d);B!==null&&$(W,B.startTime-E),M=!1}}break e}finally{v=null,p=z,S=!1}M=void 0}}finally{M?A():D=!1}}}var A;if(typeof N=="function")A=function(){N(Q)};else if(typeof MessageChannel<"u"){var O=new MessageChannel,P=O.port2;O.port1.onmessage=Q,A=function(){P.postMessage(null)}}else A=function(){R(Q,0)};function $(E,M){I=R(function(){E(t.unstable_now())},M)}t.unstable_IdlePriority=5,t.unstable_ImmediatePriority=1,t.unstable_LowPriority=4,t.unstable_NormalPriority=3,t.unstable_Profiling=null,t.unstable_UserBlockingPriority=2,t.unstable_cancelCallback=function(E){E.callback=null},t.unstable_forceFrameRate=function(E){0>E||125<E?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):H=0<E?Math.floor(1e3/E):5},t.unstable_getCurrentPriorityLevel=function(){return p},t.unstable_next=function(E){switch(p){case 1:case 2:case 3:var M=3;break;default:M=p}var z=p;p=M;try{return E()}finally{p=z}},t.unstable_requestPaint=function(){x=!0},t.unstable_runWithPriority=function(E,M){switch(E){case 1:case 2:case 3:case 4:case 5:break;default:E=3}var z=p;p=E;try{return M()}finally{p=z}},t.unstable_scheduleCallback=function(E,M,z){var q=t.unstable_now();switch(typeof z=="object"&&z!==null?(z=z.delay,z=typeof z=="number"&&0<z?q+z:q):z=q,E){case 1:var G=-1;break;case 2:G=250;break;case 5:G=1073741823;break;case 4:G=1e4;break;default:G=5e3}return G=z+G,E={id:g++,callback:M,priorityLevel:E,startTime:z,expirationTime:G,sortIndex:-1},z>q?(E.sortIndex=z,e(d,E),i(f)===null&&E===i(d)&&(C?(L(I),I=-1):C=!0,$(W,z-q))):(E.sortIndex=G,e(f,E),y||S||(y=!0,D||(D=!0,A()))),E},t.unstable_shouldYield=se,t.unstable_wrapCallback=function(E){var M=p;return function(){var z=p;p=M;try{return E.apply(this,arguments)}finally{p=z}}}})(k_)),k_}var by;function b2(){return by||(by=1,x_.exports=y2()),x_.exports}var E_={exports:{}},Ke={};var wy;function w2(){if(wy)return Ke;wy=1;var t=Symbol.for("react.transitional.element"),e=Symbol.for("react.portal"),i=Symbol.for("react.fragment"),n=Symbol.for("react.strict_mode"),a=Symbol.for("react.profiler"),l=Symbol.for("react.consumer"),u=Symbol.for("react.context"),h=Symbol.for("react.forward_ref"),f=Symbol.for("react.suspense"),d=Symbol.for("react.memo"),g=Symbol.for("react.lazy"),v=Symbol.for("react.activity"),p=Symbol.iterator;function S(B){return B===null||typeof B!="object"?null:(B=p&&B[p]||B["@@iterator"],typeof B=="function"?B:null)}var y={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},C=Object.assign,x={};function R(B,K,te){this.props=B,this.context=K,this.refs=x,this.updater=te||y}R.prototype.isReactComponent={},R.prototype.setState=function(B,K){if(typeof B!="object"&&typeof B!="function"&&B!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,B,K,"setState")},R.prototype.forceUpdate=function(B){this.updater.enqueueForceUpdate(this,B,"forceUpdate")};function L(){}L.prototype=R.prototype;function N(B,K,te){this.props=B,this.context=K,this.refs=x,this.updater=te||y}var T=N.prototype=new L;T.constructor=N,C(T,R.prototype),T.isPureReactComponent=!0;var W=Array.isArray;function D(){}var I={H:null,A:null,T:null,S:null},H=Object.prototype.hasOwnProperty;function V(B,K,te){var ne=te.ref;return{$$typeof:t,type:B,key:K,ref:ne!==void 0?ne:null,props:te}}function se(B,K){return V(B.type,K,B.props)}function Q(B){return typeof B=="object"&&B!==null&&B.$$typeof===t}function A(B){var K={"=":"=0",":":"=2"};return"$"+B.replace(/[=:]/g,function(te){return K[te]})}var O=/\/+/g;function P(B,K){return typeof B=="object"&&B!==null&&B.key!=null?A(""+B.key):K.toString(36)}function $(B){switch(B.status){case"fulfilled":return B.value;case"rejected":throw B.reason;default:switch(typeof B.status=="string"?B.then(D,D):(B.status="pending",B.then(function(K){B.status==="pending"&&(B.status="fulfilled",B.value=K)},function(K){B.status==="pending"&&(B.status="rejected",B.reason=K)})),B.status){case"fulfilled":return B.value;case"rejected":throw B.reason}}throw B}function E(B,K,te,ne,de){var ue=typeof B;(ue==="undefined"||ue==="boolean")&&(B=null);var he=!1;if(B===null)he=!0;else switch(ue){case"bigint":case"string":case"number":he=!0;break;case"object":switch(B.$$typeof){case t:case e:he=!0;break;case g:return he=B._init,E(he(B._payload),K,te,ne,de)}}if(he)return de=de(B),he=ne===""?"."+P(B,0):ne,W(de)?(te="",he!=null&&(te=he.replace(O,"$&/")+"/"),E(de,K,te,"",function(Ee){return Ee})):de!=null&&(Q(de)&&(de=se(de,te+(de.key==null||B&&B.key===de.key?"":(""+de.key).replace(O,"$&/")+"/")+he)),K.push(de)),1;he=0;var Se=ne===""?".":ne+":";if(W(B))for(var we=0;we<B.length;we++)ne=B[we],ue=Se+P(ne,we),he+=E(ne,K,te,ue,de);else if(we=S(B),typeof we=="function")for(B=we.call(B),we=0;!(ne=B.next()).done;)ne=ne.value,ue=Se+P(ne,we++),he+=E(ne,K,te,ue,de);else if(ue==="object"){if(typeof B.then=="function")return E($(B),K,te,ne,de);throw K=String(B),Error("Objects are not valid as a React child (found: "+(K==="[object Object]"?"object with keys {"+Object.keys(B).join(", ")+"}":K)+"). If you meant to render a collection of children, use an array instead.")}return he}function M(B,K,te){if(B==null)return B;var ne=[],de=0;return E(B,ne,"","",function(ue){return K.call(te,ue,de++)}),ne}function z(B){if(B._status===-1){var K=B._result;K=K(),K.then(function(te){(B._status===0||B._status===-1)&&(B._status=1,B._result=te)},function(te){(B._status===0||B._status===-1)&&(B._status=2,B._result=te)}),B._status===-1&&(B._status=0,B._result=K)}if(B._status===1)return B._result.default;throw B._result}var q=typeof reportError=="function"?reportError:function(B){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var K=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof B=="object"&&B!==null&&typeof B.message=="string"?String(B.message):String(B),error:B});if(!window.dispatchEvent(K))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",B);return}console.error(B)},G={map:M,forEach:function(B,K,te){M(B,function(){K.apply(this,arguments)},te)},count:function(B){var K=0;return M(B,function(){K++}),K},toArray:function(B){return M(B,function(K){return K})||[]},only:function(B){if(!Q(B))throw Error("React.Children.only expected to receive a single React element child.");return B}};return Ke.Activity=v,Ke.Children=G,Ke.Component=R,Ke.Fragment=i,Ke.Profiler=a,Ke.PureComponent=N,Ke.StrictMode=n,Ke.Suspense=f,Ke.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=I,Ke.__COMPILER_RUNTIME={__proto__:null,c:function(B){return I.H.useMemoCache(B)}},Ke.cache=function(B){return function(){return B.apply(null,arguments)}},Ke.cacheSignal=function(){return null},Ke.cloneElement=function(B,K,te){if(B==null)throw Error("The argument must be a React element, but you passed "+B+".");var ne=C({},B.props),de=B.key;if(K!=null)for(ue in K.key!==void 0&&(de=""+K.key),K)!H.call(K,ue)||ue==="key"||ue==="__self"||ue==="__source"||ue==="ref"&&K.ref===void 0||(ne[ue]=K[ue]);var ue=arguments.length-2;if(ue===1)ne.children=te;else if(1<ue){for(var he=Array(ue),Se=0;Se<ue;Se++)he[Se]=arguments[Se+2];ne.children=he}return V(B.type,de,ne)},Ke.createContext=function(B){return B={$$typeof:u,_currentValue:B,_currentValue2:B,_threadCount:0,Provider:null,Consumer:null},B.Provider=B,B.Consumer={$$typeof:l,_context:B},B},Ke.createElement=function(B,K,te){var ne,de={},ue=null;if(K!=null)for(ne in K.key!==void 0&&(ue=""+K.key),K)H.call(K,ne)&&ne!=="key"&&ne!=="__self"&&ne!=="__source"&&(de[ne]=K[ne]);var he=arguments.length-2;if(he===1)de.children=te;else if(1<he){for(var Se=Array(he),we=0;we<he;we++)Se[we]=arguments[we+2];de.children=Se}if(B&&B.defaultProps)for(ne in he=B.defaultProps,he)de[ne]===void 0&&(de[ne]=he[ne]);return V(B,ue,de)},Ke.createRef=function(){return{current:null}},Ke.forwardRef=function(B){return{$$typeof:h,render:B}},Ke.isValidElement=Q,Ke.lazy=function(B){return{$$typeof:g,_payload:{_status:-1,_result:B},_init:z}},Ke.memo=function(B,K){return{$$typeof:d,type:B,compare:K===void 0?null:K}},Ke.startTransition=function(B){var K=I.T,te={};I.T=te;try{var ne=B(),de=I.S;de!==null&&de(te,ne),typeof ne=="object"&&ne!==null&&typeof ne.then=="function"&&ne.then(D,q)}catch(ue){q(ue)}finally{K!==null&&te.types!==null&&(K.types=te.types),I.T=K}},Ke.unstable_useCacheRefresh=function(){return I.H.useCacheRefresh()},Ke.use=function(B){return I.H.use(B)},Ke.useActionState=function(B,K,te){return I.H.useActionState(B,K,te)},Ke.useCallback=function(B,K){return I.H.useCallback(B,K)},Ke.useContext=function(B){return I.H.useContext(B)},Ke.useDebugValue=function(){},Ke.useDeferredValue=function(B,K){return I.H.useDeferredValue(B,K)},Ke.useEffect=function(B,K){return I.H.useEffect(B,K)},Ke.useEffectEvent=function(B){return I.H.useEffectEvent(B)},Ke.useId=function(){return I.H.useId()},Ke.useImperativeHandle=function(B,K,te){return I.H.useImperativeHandle(B,K,te)},Ke.useInsertionEffect=function(B,K){return I.H.useInsertionEffect(B,K)},Ke.useLayoutEffect=function(B,K){return I.H.useLayoutEffect(B,K)},Ke.useMemo=function(B,K){return I.H.useMemo(B,K)},Ke.useOptimistic=function(B,K){return I.H.useOptimistic(B,K)},Ke.useReducer=function(B,K,te){return I.H.useReducer(B,K,te)},Ke.useRef=function(B){return I.H.useRef(B)},Ke.useState=function(B){return I.H.useState(B)},Ke.useSyncExternalStore=function(B,K,te){return I.H.useSyncExternalStore(B,K,te)},Ke.useTransition=function(){return I.H.useTransition()},Ke.version="19.2.3",Ke}var Cy;function Du(){return Cy||(Cy=1,E_.exports=w2()),E_.exports}var T_={exports:{}},is={};var xy;function C2(){if(xy)return is;xy=1;var t=Du();function e(f){var d="https://react.dev/errors/"+f;if(1<arguments.length){d+="?args[]="+encodeURIComponent(arguments[1]);for(var g=2;g<arguments.length;g++)d+="&args[]="+encodeURIComponent(arguments[g])}return"Minified React error #"+f+"; visit "+d+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function i(){}var n={d:{f:i,r:function(){throw Error(e(522))},D:i,C:i,L:i,m:i,X:i,S:i,M:i},p:0,findDOMNode:null},a=Symbol.for("react.portal");function l(f,d,g){var v=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:a,key:v==null?null:""+v,children:f,containerInfo:d,implementation:g}}var u=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function h(f,d){if(f==="font")return"";if(typeof d=="string")return d==="use-credentials"?d:""}return is.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=n,is.createPortal=function(f,d){var g=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!d||d.nodeType!==1&&d.nodeType!==9&&d.nodeType!==11)throw Error(e(299));return l(f,d,null,g)},is.flushSync=function(f){var d=u.T,g=n.p;try{if(u.T=null,n.p=2,f)return f()}finally{u.T=d,n.p=g,n.d.f()}},is.preconnect=function(f,d){typeof f=="string"&&(d?(d=d.crossOrigin,d=typeof d=="string"?d==="use-credentials"?d:"":void 0):d=null,n.d.C(f,d))},is.prefetchDNS=function(f){typeof f=="string"&&n.d.D(f)},is.preinit=function(f,d){if(typeof f=="string"&&d&&typeof d.as=="string"){var g=d.as,v=h(g,d.crossOrigin),p=typeof d.integrity=="string"?d.integrity:void 0,S=typeof d.fetchPriority=="string"?d.fetchPriority:void 0;g==="style"?n.d.S(f,typeof d.precedence=="string"?d.precedence:void 0,{crossOrigin:v,integrity:p,fetchPriority:S}):g==="script"&&n.d.X(f,{crossOrigin:v,integrity:p,fetchPriority:S,nonce:typeof d.nonce=="string"?d.nonce:void 0})}},is.preinitModule=function(f,d){if(typeof f=="string")if(typeof d=="object"&&d!==null){if(d.as==null||d.as==="script"){var g=h(d.as,d.crossOrigin);n.d.M(f,{crossOrigin:g,integrity:typeof d.integrity=="string"?d.integrity:void 0,nonce:typeof d.nonce=="string"?d.nonce:void 0})}}else d==null&&n.d.M(f)},is.preload=function(f,d){if(typeof f=="string"&&typeof d=="object"&&d!==null&&typeof d.as=="string"){var g=d.as,v=h(g,d.crossOrigin);n.d.L(f,g,{crossOrigin:v,integrity:typeof d.integrity=="string"?d.integrity:void 0,nonce:typeof d.nonce=="string"?d.nonce:void 0,type:typeof d.type=="string"?d.type:void 0,fetchPriority:typeof d.fetchPriority=="string"?d.fetchPriority:void 0,referrerPolicy:typeof d.referrerPolicy=="string"?d.referrerPolicy:void 0,imageSrcSet:typeof d.imageSrcSet=="string"?d.imageSrcSet:void 0,imageSizes:typeof d.imageSizes=="string"?d.imageSizes:void 0,media:typeof d.media=="string"?d.media:void 0})}},is.preloadModule=function(f,d){if(typeof f=="string")if(d){var g=h(d.as,d.crossOrigin);n.d.m(f,{as:typeof d.as=="string"&&d.as!=="script"?d.as:void 0,crossOrigin:g,integrity:typeof d.integrity=="string"?d.integrity:void 0})}else n.d.m(f)},is.requestFormReset=function(f){n.d.r(f)},is.unstable_batchedUpdates=function(f,d){return f(d)},is.useFormState=function(f,d,g){return u.H.useFormState(f,d,g)},is.useFormStatus=function(){return u.H.useHostTransitionStatus()},is.version="19.2.3",is}var ky;function Q1(){if(ky)return T_.exports;ky=1;function t(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(t)}catch(e){console.error(e)}}return t(),T_.exports=C2(),T_.exports}var Ey;function x2(){if(Ey)return Xc;Ey=1;var t=b2(),e=Du(),i=Q1();function n(s){var r="https://react.dev/errors/"+s;if(1<arguments.length){r+="?args[]="+encodeURIComponent(arguments[1]);for(var o=2;o<arguments.length;o++)r+="&args[]="+encodeURIComponent(arguments[o])}return"Minified React error #"+s+"; visit "+r+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function a(s){return!(!s||s.nodeType!==1&&s.nodeType!==9&&s.nodeType!==11)}function l(s){var r=s,o=s;if(s.alternate)for(;r.return;)r=r.return;else{s=r;do r=s,(r.flags&4098)!==0&&(o=r.return),s=r.return;while(s)}return r.tag===3?o:null}function u(s){if(s.tag===13){var r=s.memoizedState;if(r===null&&(s=s.alternate,s!==null&&(r=s.memoizedState)),r!==null)return r.dehydrated}return null}function h(s){if(s.tag===31){var r=s.memoizedState;if(r===null&&(s=s.alternate,s!==null&&(r=s.memoizedState)),r!==null)return r.dehydrated}return null}function f(s){if(l(s)!==s)throw Error(n(188))}function d(s){var r=s.alternate;if(!r){if(r=l(s),r===null)throw Error(n(188));return r!==s?null:s}for(var o=s,c=r;;){var m=o.return;if(m===null)break;var _=m.alternate;if(_===null){if(c=m.return,c!==null){o=c;continue}break}if(m.child===_.child){for(_=m.child;_;){if(_===o)return f(m),s;if(_===c)return f(m),r;_=_.sibling}throw Error(n(188))}if(o.return!==c.return)o=m,c=_;else{for(var b=!1,k=m.child;k;){if(k===o){b=!0,o=m,c=_;break}if(k===c){b=!0,c=m,o=_;break}k=k.sibling}if(!b){for(k=_.child;k;){if(k===o){b=!0,o=_,c=m;break}if(k===c){b=!0,c=_,o=m;break}k=k.sibling}if(!b)throw Error(n(189))}}if(o.alternate!==c)throw Error(n(190))}if(o.tag!==3)throw Error(n(188));return o.stateNode.current===o?s:r}function g(s){var r=s.tag;if(r===5||r===26||r===27||r===6)return s;for(s=s.child;s!==null;){if(r=g(s),r!==null)return r;s=s.sibling}return null}var v=Object.assign,p=Symbol.for("react.element"),S=Symbol.for("react.transitional.element"),y=Symbol.for("react.portal"),C=Symbol.for("react.fragment"),x=Symbol.for("react.strict_mode"),R=Symbol.for("react.profiler"),L=Symbol.for("react.consumer"),N=Symbol.for("react.context"),T=Symbol.for("react.forward_ref"),W=Symbol.for("react.suspense"),D=Symbol.for("react.suspense_list"),I=Symbol.for("react.memo"),H=Symbol.for("react.lazy"),V=Symbol.for("react.activity"),se=Symbol.for("react.memo_cache_sentinel"),Q=Symbol.iterator;function A(s){return s===null||typeof s!="object"?null:(s=Q&&s[Q]||s["@@iterator"],typeof s=="function"?s:null)}var O=Symbol.for("react.client.reference");function P(s){if(s==null)return null;if(typeof s=="function")return s.$$typeof===O?null:s.displayName||s.name||null;if(typeof s=="string")return s;switch(s){case C:return"Fragment";case R:return"Profiler";case x:return"StrictMode";case W:return"Suspense";case D:return"SuspenseList";case V:return"Activity"}if(typeof s=="object")switch(s.$$typeof){case y:return"Portal";case N:return s.displayName||"Context";case L:return(s._context.displayName||"Context")+".Consumer";case T:var r=s.render;return s=s.displayName,s||(s=r.displayName||r.name||"",s=s!==""?"ForwardRef("+s+")":"ForwardRef"),s;case I:return r=s.displayName||null,r!==null?r:P(s.type)||"Memo";case H:r=s._payload,s=s._init;try{return P(s(r))}catch{}}return null}var $=Array.isArray,E=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,M=i.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,z={pending:!1,data:null,method:null,action:null},q=[],G=-1;function B(s){return{current:s}}function K(s){0>G||(s.current=q[G],q[G]=null,G--)}function te(s,r){G++,q[G]=s.current,s.current=r}var ne=B(null),de=B(null),ue=B(null),he=B(null);function Se(s,r){switch(te(ue,r),te(de,s),te(ne,null),r.nodeType){case 9:case 11:s=(s=r.documentElement)&&(s=s.namespaceURI)?FS(s):0;break;default:if(s=r.tagName,r=r.namespaceURI)r=FS(r),s=$S(r,s);else switch(s){case"svg":s=1;break;case"math":s=2;break;default:s=0}}K(ne),te(ne,s)}function we(){K(ne),K(de),K(ue)}function Ee(s){s.memoizedState!==null&&te(he,s);var r=ne.current,o=$S(r,s.type);r!==o&&(te(de,s),te(ne,o))}function Le(s){de.current===s&&(K(ne),K(de)),he.current===s&&(K(he),Vc._currentValue=z)}var it,Ze;function ke(s){if(it===void 0)try{throw Error()}catch(o){var r=o.stack.trim().match(/\n( *(at )?)/);it=r&&r[1]||"",Ze=-1<o.stack.indexOf(`
2
+ at`)?" (<anonymous>)":-1<o.stack.indexOf("@")?"@unknown:0:0":""}return`
3
+ `+it+s+Ze}var ze=!1;function pe(s,r){if(!s||ze)return"";ze=!0;var o=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var c={DetermineComponentFrameRoot:function(){try{if(r){var oe=function(){throw Error()};if(Object.defineProperty(oe.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(oe,[])}catch(ie){var ee=ie}Reflect.construct(s,[],oe)}else{try{oe.call()}catch(ie){ee=ie}s.call(oe.prototype)}}else{try{throw Error()}catch(ie){ee=ie}(oe=s())&&typeof oe.catch=="function"&&oe.catch(function(){})}}catch(ie){if(ie&&ee&&typeof ie.stack=="string")return[ie.stack,ee.stack]}return[null,null]}};c.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var m=Object.getOwnPropertyDescriptor(c.DetermineComponentFrameRoot,"name");m&&m.configurable&&Object.defineProperty(c.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var _=c.DetermineComponentFrameRoot(),b=_[0],k=_[1];if(b&&k){var F=b.split(`
4
+ `),Z=k.split(`
5
+ `);for(m=c=0;c<F.length&&!F[c].includes("DetermineComponentFrameRoot");)c++;for(;m<Z.length&&!Z[m].includes("DetermineComponentFrameRoot");)m++;if(c===F.length||m===Z.length)for(c=F.length-1,m=Z.length-1;1<=c&&0<=m&&F[c]!==Z[m];)m--;for(;1<=c&&0<=m;c--,m--)if(F[c]!==Z[m]){if(c!==1||m!==1)do if(c--,m--,0>m||F[c]!==Z[m]){var re=`
6
+ `+F[c].replace(" at new "," at ");return s.displayName&&re.includes("<anonymous>")&&(re=re.replace("<anonymous>",s.displayName)),re}while(1<=c&&0<=m);break}}}finally{ze=!1,Error.prepareStackTrace=o}return(o=s?s.displayName||s.name:"")?ke(o):""}function mt(s,r){switch(s.tag){case 26:case 27:case 5:return ke(s.type);case 16:return ke("Lazy");case 13:return s.child!==r&&r!==null?ke("Suspense Fallback"):ke("Suspense");case 19:return ke("SuspenseList");case 0:case 15:return pe(s.type,!1);case 11:return pe(s.type.render,!1);case 1:return pe(s.type,!0);case 31:return ke("Activity");default:return""}}function yt(s){try{var r="",o=null;do r+=mt(s,o),o=s,s=s.return;while(s);return r}catch(c){return`
7
+ Error generating stack: `+c.message+`
8
+ `+c.stack}}var ge=Object.prototype.hasOwnProperty,ye=t.unstable_scheduleCallback,me=t.unstable_cancelCallback,Ut=t.unstable_shouldYield,Be=t.unstable_requestPaint,Xe=t.unstable_now,je=t.unstable_getCurrentPriorityLevel,_t=t.unstable_ImmediatePriority,qe=t.unstable_UserBlockingPriority,Ms=t.unstable_NormalPriority,ns=t.unstable_LowPriority,Xn=t.unstable_IdlePriority,Zn=t.log,$r=t.unstable_setDisableYieldValue,Ks=null,ri=null;function $i(s){if(typeof Zn=="function"&&$r(s),ri&&typeof ri.setStrictMode=="function")try{ri.setStrictMode(Ks,s)}catch{}}var At=Math.clz32?Math.clz32:un,ni=Math.log,Xs=Math.LN2;function un(s){return s>>>=0,s===0?32:31-(ni(s)/Xs|0)|0}var Zs=256,kt=262144,Er=4194304;function Wi(s){var r=s&42;if(r!==0)return r;switch(s&-s){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 s&261888;case 262144:case 524288:case 1048576:case 2097152:return s&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return s&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return s}}function As(s,r,o){var c=s.pendingLanes;if(c===0)return 0;var m=0,_=s.suspendedLanes,b=s.pingedLanes;s=s.warmLanes;var k=c&134217727;return k!==0?(c=k&~_,c!==0?m=Wi(c):(b&=k,b!==0?m=Wi(b):o||(o=k&~s,o!==0&&(m=Wi(o))))):(k=c&~_,k!==0?m=Wi(k):b!==0?m=Wi(b):o||(o=c&~s,o!==0&&(m=Wi(o)))),m===0?0:r!==0&&r!==m&&(r&_)===0&&(_=m&-m,o=r&-r,_>=o||_===32&&(o&4194048)!==0)?r:m}function Tr(s,r){return(s.pendingLanes&~(s.suspendedLanes&~s.pingedLanes)&r)===0}function Qn(s,r){switch(s){case 1:case 2:case 4:case 8:case 64:return r+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return r+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function es(){var s=Er;return Er<<=1,(Er&62914560)===0&&(Er=4194304),s}function Qs(s){for(var r=[],o=0;31>o;o++)r.push(s);return r}function Ft(s,r){s.pendingLanes|=r,r!==268435456&&(s.suspendedLanes=0,s.pingedLanes=0,s.warmLanes=0)}function He(s,r,o,c,m,_){var b=s.pendingLanes;s.pendingLanes=o,s.suspendedLanes=0,s.pingedLanes=0,s.warmLanes=0,s.expiredLanes&=o,s.entangledLanes&=o,s.errorRecoveryDisabledLanes&=o,s.shellSuspendCounter=0;var k=s.entanglements,F=s.expirationTimes,Z=s.hiddenUpdates;for(o=b&~o;0<o;){var re=31-At(o),oe=1<<re;k[re]=0,F[re]=-1;var ee=Z[re];if(ee!==null)for(Z[re]=null,re=0;re<ee.length;re++){var ie=ee[re];ie!==null&&(ie.lane&=-536870913)}o&=~oe}c!==0&&Lt(s,c,0),_!==0&&m===0&&s.tag!==0&&(s.suspendedLanes|=_&~(b&~r))}function Lt(s,r,o){s.pendingLanes|=r,s.suspendedLanes&=~r;var c=31-At(r);s.entangledLanes|=r,s.entanglements[c]=s.entanglements[c]|1073741824|o&261930}function Vo(s,r){var o=s.entangledLanes|=r;for(s=s.entanglements;o;){var c=31-At(o),m=1<<c;m&r|s[c]&r&&(s[c]|=r),o&=~m}}function Js(s,r){var o=r&-r;return o=(o&42)!==0?1:ji(o),(o&(s.suspendedLanes|r))!==0?0:o}function ji(s){switch(s){case 2:s=1;break;case 8:s=4;break;case 32:s=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:s=128;break;case 268435456:s=134217728;break;default:s=0}return s}function be(s){return s&=-s,2<s?8<s?(s&134217727)!==0?32:268435456:8:2}function ft(){var s=M.p;return s!==0?s:(s=window.event,s===void 0?32:hy(s.type))}function Qe(s,r){var o=M.p;try{return M.p=s,r()}finally{M.p=o}}var $e=Math.random().toString(36).slice(2),Re="__reactFiber$"+$e,Ue="__reactProps$"+$e,$t="__reactContainer$"+$e,Bt="__reactEvents$"+$e,er="__reactListeners$"+$e,tr="__reactHandles$"+$e,Rr="__reactResources$"+$e,Ls="__reactMarker$"+$e;function Mr(s){delete s[Re],delete s[Ue],delete s[Bt],delete s[er],delete s[tr]}function ci(s){var r=s[Re];if(r)return r;for(var o=s.parentNode;o;){if(r=o[$t]||o[Re]){if(o=r.alternate,r.child!==null||o!==null&&o.child!==null)for(s=KS(s);s!==null;){if(o=s[Re])return o;s=KS(s)}return r}s=o,o=s.parentNode}return null}function _s(s){if(s=s[Re]||s[$t]){var r=s.tag;if(r===5||r===6||r===13||r===31||r===26||r===27||r===3)return s}return null}function ui(s){var r=s.tag;if(r===5||r===26||r===27||r===6)return s.stateNode;throw Error(n(33))}function Ei(s){var r=s[Rr];return r||(r=s[Rr]={hoistableStyles:new Map,hoistableScripts:new Map}),r}function Ce(s){s[Ls]=!0}var hn=new Set,Iu={};function ps(s,r){ir(s,r),ir(s+"Capture",r)}function ir(s,r){for(Iu[s]=r,s=0;s<r.length;s++)hn.add(r[s])}var Ar=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]*$"),Jn={},tc={};function qo(s){return ge.call(tc,s)?!0:ge.call(Jn,s)?!1:Ar.test(s)?tc[s]=!0:(Jn[s]=!0,!1)}function Wr(s,r,o){if(qo(r))if(o===null)s.removeAttribute(r);else{switch(typeof o){case"undefined":case"function":case"symbol":s.removeAttribute(r);return;case"boolean":var c=r.toLowerCase().slice(0,5);if(c!=="data-"&&c!=="aria-"){s.removeAttribute(r);return}}s.setAttribute(r,""+o)}}function dn(s,r,o){if(o===null)s.removeAttribute(r);else{switch(typeof o){case"undefined":case"function":case"symbol":case"boolean":s.removeAttribute(r);return}s.setAttribute(r,""+o)}}function sr(s,r,o,c){if(c===null)s.removeAttribute(o);else{switch(typeof c){case"undefined":case"function":case"symbol":case"boolean":s.removeAttribute(o);return}s.setAttributeNS(r,o,""+c)}}function at(s){switch(typeof s){case"bigint":case"boolean":case"number":case"string":case"undefined":return s;case"object":return s;default:return""}}function ic(s){var r=s.type;return(s=s.nodeName)&&s.toLowerCase()==="input"&&(r==="checkbox"||r==="radio")}function yf(s,r,o){var c=Object.getOwnPropertyDescriptor(s.constructor.prototype,r);if(!s.hasOwnProperty(r)&&typeof c<"u"&&typeof c.get=="function"&&typeof c.set=="function"){var m=c.get,_=c.set;return Object.defineProperty(s,r,{configurable:!0,get:function(){return m.call(this)},set:function(b){o=""+b,_.call(this,b)}}),Object.defineProperty(s,r,{enumerable:c.enumerable}),{getValue:function(){return o},setValue:function(b){o=""+b},stopTracking:function(){s._valueTracker=null,delete s[r]}}}}function sc(s){if(!s._valueTracker){var r=ic(s)?"checked":"value";s._valueTracker=yf(s,r,""+s[r])}}function Uu(s){if(!s)return!1;var r=s._valueTracker;if(!r)return!0;var o=r.getValue(),c="";return s&&(c=ic(s)?s.checked?"true":"false":s.value),s=c,s!==o?(r.setValue(s),!0):!1}function ea(s){if(s=s||(typeof document<"u"?document:void 0),typeof s>"u")return null;try{return s.activeElement||s.body}catch{return s.body}}var pt=/[\n"\\]/g;function Vi(s){return s.replace(pt,function(r){return"\\"+r.charCodeAt(0).toString(16)+" "})}function Vt(s,r,o,c,m,_,b,k){s.name="",b!=null&&typeof b!="function"&&typeof b!="symbol"&&typeof b!="boolean"?s.type=b:s.removeAttribute("type"),r!=null?b==="number"?(r===0&&s.value===""||s.value!=r)&&(s.value=""+at(r)):s.value!==""+at(r)&&(s.value=""+at(r)):b!=="submit"&&b!=="reset"||s.removeAttribute("value"),r!=null?ta(s,b,at(r)):o!=null?ta(s,b,at(o)):c!=null&&s.removeAttribute("value"),m==null&&_!=null&&(s.defaultChecked=!!_),m!=null&&(s.checked=m&&typeof m!="function"&&typeof m!="symbol"),k!=null&&typeof k!="function"&&typeof k!="symbol"&&typeof k!="boolean"?s.name=""+at(k):s.removeAttribute("name")}function Yo(s,r,o,c,m,_,b,k){if(_!=null&&typeof _!="function"&&typeof _!="symbol"&&typeof _!="boolean"&&(s.type=_),r!=null||o!=null){if(!(_!=="submit"&&_!=="reset"||r!=null)){sc(s);return}o=o!=null?""+at(o):"",r=r!=null?""+at(r):o,k||r===s.value||(s.value=r),s.defaultValue=r}c=c??m,c=typeof c!="function"&&typeof c!="symbol"&&!!c,s.checked=k?s.checked:!!c,s.defaultChecked=!!c,b!=null&&typeof b!="function"&&typeof b!="symbol"&&typeof b!="boolean"&&(s.name=b),sc(s)}function ta(s,r,o){r==="number"&&ea(s.ownerDocument)===s||s.defaultValue===""+o||(s.defaultValue=""+o)}function fn(s,r,o,c){if(s=s.options,r){r={};for(var m=0;m<o.length;m++)r["$"+o[m]]=!0;for(o=0;o<s.length;o++)m=r.hasOwnProperty("$"+s[o].value),s[o].selected!==m&&(s[o].selected=m),m&&c&&(s[o].defaultSelected=!0)}else{for(o=""+at(o),r=null,m=0;m<s.length;m++){if(s[m].value===o){s[m].selected=!0,c&&(s[m].defaultSelected=!0);return}r!==null||s[m].disabled||(r=s[m])}r!==null&&(r.selected=!0)}}function Go(s,r,o){if(r!=null&&(r=""+at(r),r!==s.value&&(s.value=r),o==null)){s.defaultValue!==r&&(s.defaultValue=r);return}s.defaultValue=o!=null?""+at(o):""}function Ti(s,r,o,c){if(r==null){if(c!=null){if(o!=null)throw Error(n(92));if($(c)){if(1<c.length)throw Error(n(93));c=c[0]}o=c}o==null&&(o=""),r=o}o=at(r),s.defaultValue=o,c=s.textContent,c===o&&c!==""&&c!==null&&(s.value=c),sc(s)}function ia(s,r){if(r){var o=s.firstChild;if(o&&o===s.lastChild&&o.nodeType===3){o.nodeValue=r;return}}s.textContent=r}var bf=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 rc(s,r,o){var c=r.indexOf("--")===0;o==null||typeof o=="boolean"||o===""?c?s.setProperty(r,""):r==="float"?s.cssFloat="":s[r]="":c?s.setProperty(r,o):typeof o!="number"||o===0||bf.has(r)?r==="float"?s.cssFloat=o:s[r]=(""+o).trim():s[r]=o+"px"}function nc(s,r,o){if(r!=null&&typeof r!="object")throw Error(n(62));if(s=s.style,o!=null){for(var c in o)!o.hasOwnProperty(c)||r!=null&&r.hasOwnProperty(c)||(c.indexOf("--")===0?s.setProperty(c,""):c==="float"?s.cssFloat="":s[c]="");for(var m in r)c=r[m],r.hasOwnProperty(m)&&o[m]!==c&&rc(s,m,c)}else for(var _ in r)r.hasOwnProperty(_)&&rc(s,_,r[_])}function ac(s){if(s.indexOf("-")===-1)return!1;switch(s){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 Fu=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"]]),wf=/^[\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 Lr(s){return wf.test(""+s)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":s}function Ri(){}var sa=null;function jr(s){return s=s.target||s.srcElement||window,s.correspondingUseElement&&(s=s.correspondingUseElement),s.nodeType===3?s.parentNode:s}var as=null,Ds=null;function rr(s){var r=_s(s);if(r&&(s=r.stateNode)){var o=s[Ue]||null;e:switch(s=r.stateNode,r.type){case"input":if(Vt(s,o.value,o.defaultValue,o.defaultValue,o.checked,o.defaultChecked,o.type,o.name),r=o.name,o.type==="radio"&&r!=null){for(o=s;o.parentNode;)o=o.parentNode;for(o=o.querySelectorAll('input[name="'+Vi(""+r)+'"][type="radio"]'),r=0;r<o.length;r++){var c=o[r];if(c!==s&&c.form===s.form){var m=c[Ue]||null;if(!m)throw Error(n(90));Vt(c,m.value,m.defaultValue,m.defaultValue,m.checked,m.defaultChecked,m.type,m.name)}}for(r=0;r<o.length;r++)c=o[r],c.form===s.form&&Uu(c)}break e;case"textarea":Go(s,o.value,o.defaultValue);break e;case"select":r=o.value,r!=null&&fn(s,!!o.multiple,r,!1)}}}var mn=!1;function nr(s,r,o){if(mn)return s(r,o);mn=!0;try{var c=s(r);return c}finally{if(mn=!1,(as!==null||Ds!==null)&&(Mh(),as&&(r=as,s=Ds,Ds=as=null,rr(r),s)))for(r=0;r<s.length;r++)rr(s[r])}}function Os(s,r){var o=s.stateNode;if(o===null)return null;var c=o[Ue]||null;if(c===null)return null;o=c[r];e:switch(r){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(c=!c.disabled)||(s=s.type,c=!(s==="button"||s==="input"||s==="select"||s==="textarea")),s=!c;break e;default:s=!1}if(s)return null;if(o&&typeof o!="function")throw Error(n(231,r,typeof o));return o}var ar=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Ko=!1;if(ar)try{var ra={};Object.defineProperty(ra,"passive",{get:function(){Ko=!0}}),window.addEventListener("test",ra,ra),window.removeEventListener("test",ra,ra)}catch{Ko=!1}var Dr=null,Xo=null,Zo=null;function oc(){if(Zo)return Zo;var s,r=Xo,o=r.length,c,m="value"in Dr?Dr.value:Dr.textContent,_=m.length;for(s=0;s<o&&r[s]===m[s];s++);var b=o-s;for(c=1;c<=b&&r[o-c]===m[_-c];c++);return Zo=m.slice(s,1<c?1-c:void 0)}function Xa(s){var r=s.keyCode;return"charCode"in s?(s=s.charCode,s===0&&r===13&&(s=13)):s=r,s===10&&(s=13),32<=s||s===13?s:0}function _n(){return!0}function $u(){return!1}function qt(s){function r(o,c,m,_,b){this._reactName=o,this._targetInst=m,this.type=c,this.nativeEvent=_,this.target=b,this.currentTarget=null;for(var k in s)s.hasOwnProperty(k)&&(o=s[k],this[k]=o?o(_):_[k]);return this.isDefaultPrevented=(_.defaultPrevented!=null?_.defaultPrevented:_.returnValue===!1)?_n:$u,this.isPropagationStopped=$u,this}return v(r.prototype,{preventDefault:function(){this.defaultPrevented=!0;var o=this.nativeEvent;o&&(o.preventDefault?o.preventDefault():typeof o.returnValue!="unknown"&&(o.returnValue=!1),this.isDefaultPrevented=_n)},stopPropagation:function(){var o=this.nativeEvent;o&&(o.stopPropagation?o.stopPropagation():typeof o.cancelBubble!="unknown"&&(o.cancelBubble=!0),this.isPropagationStopped=_n)},persist:function(){},isPersistent:_n}),r}var pn={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(s){return s.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Za=qt(pn),Qa=v({},pn,{view:0,detail:0}),Cf=qt(Qa),lc,cc,Ja,Mi=v({},Qa,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:el,button:0,buttons:0,relatedTarget:function(s){return s.relatedTarget===void 0?s.fromElement===s.srcElement?s.toElement:s.fromElement:s.relatedTarget},movementX:function(s){return"movementX"in s?s.movementX:(s!==Ja&&(Ja&&s.type==="mousemove"?(lc=s.screenX-Ja.screenX,cc=s.screenY-Ja.screenY):cc=lc=0,Ja=s),lc)},movementY:function(s){return"movementY"in s?s.movementY:cc}}),bt=qt(Mi),Bs=v({},Mi,{dataTransfer:0}),uc=qt(Bs),Qo=v({},Qa,{relatedTarget:0}),eo=qt(Qo),to=v({},pn,{animationName:0,elapsedTime:0,pseudoElement:0}),na=qt(to),hc=v({},pn,{clipboardData:function(s){return"clipboardData"in s?s.clipboardData:window.clipboardData}}),dc=qt(hc),fc=v({},pn,{data:0}),Jo=qt(fc),Wu={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},xf={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"},kf={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function Ef(s){var r=this.nativeEvent;return r.getModifierState?r.getModifierState(s):(s=kf[s])?!!r[s]:!1}function el(){return Ef}var Tf=v({},Qa,{key:function(s){if(s.key){var r=Wu[s.key]||s.key;if(r!=="Unidentified")return r}return s.type==="keypress"?(s=Xa(s),s===13?"Enter":String.fromCharCode(s)):s.type==="keydown"||s.type==="keyup"?xf[s.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:el,charCode:function(s){return s.type==="keypress"?Xa(s):0},keyCode:function(s){return s.type==="keydown"||s.type==="keyup"?s.keyCode:0},which:function(s){return s.type==="keypress"?Xa(s):s.type==="keydown"||s.type==="keyup"?s.keyCode:0}}),ju=qt(Tf),Vu=v({},Mi,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),io=qt(Vu),tl=v({},Qa,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:el}),Rf=qt(tl),qu=v({},pn,{propertyName:0,elapsedTime:0,pseudoElement:0}),Mf=qt(qu),Af=v({},Mi,{deltaX:function(s){return"deltaX"in s?s.deltaX:"wheelDeltaX"in s?-s.wheelDeltaX:0},deltaY:function(s){return"deltaY"in s?s.deltaY:"wheelDeltaY"in s?-s.wheelDeltaY:"wheelDelta"in s?-s.wheelDelta:0},deltaZ:0,deltaMode:0}),J=qt(Af),ce=v({},pn,{newState:0,oldState:0}),fe=qt(ce),_e=[9,13,27,32],De=ar&&"CompositionEvent"in window,Ne=null;ar&&"documentMode"in document&&(Ne=document.documentMode);var et=ar&&"TextEvent"in window&&!Ne,Xt=ar&&(!De||Ne&&8<Ne&&11>=Ne),Si=" ",Vr=!1;function Or(s,r){switch(s){case"keyup":return _e.indexOf(r.keyCode)!==-1;case"keydown":return r.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function os(s){return s=s.detail,typeof s=="object"&&"data"in s?s.data:null}var ls=!1;function gn(s,r){switch(s){case"compositionend":return os(r);case"keypress":return r.which!==32?null:(Vr=!0,Si);case"textInput":return s=r.data,s===Si&&Vr?null:s;default:return null}}function Zt(s,r){if(ls)return s==="compositionend"||!De&&Or(s,r)?(s=oc(),Zo=Xo=Dr=null,ls=!1,s):null;switch(s){case"paste":return null;case"keypress":if(!(r.ctrlKey||r.altKey||r.metaKey)||r.ctrlKey&&r.altKey){if(r.char&&1<r.char.length)return r.char;if(r.which)return String.fromCharCode(r.which)}return null;case"compositionend":return Xt&&r.locale!=="ko"?null:r.data;default:return null}}var Dt={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 or(s){var r=s&&s.nodeName&&s.nodeName.toLowerCase();return r==="input"?!!Dt[s.type]:r==="textarea"}function qr(s,r,o,c){as?Ds?Ds.push(c):Ds=[c]:as=c,r=Ph(r,"onChange"),0<r.length&&(o=new Za("onChange","change",null,o,c),s.push({event:o,listeners:r}))}var lr=null,ts=null;function We(s){NS(s,0)}function Br(s){var r=ui(s);if(Uu(r))return s}function Yu(s,r){if(s==="change")return r}var so=!1;if(ar){var ro;if(ar){var aa="oninput"in document;if(!aa){var vn=document.createElement("div");vn.setAttribute("oninput","return;"),aa=typeof vn.oninput=="function"}ro=aa}else ro=!1;so=ro&&(!document.documentMode||9<document.documentMode)}function mc(){lr&&(lr.detachEvent("onpropertychange",_c),ts=lr=null)}function _c(s){if(s.propertyName==="value"&&Br(ts)){var r=[];qr(r,ts,s,jr(s)),nr(We,r)}}function Gu(s,r,o){s==="focusin"?(mc(),lr=r,ts=o,lr.attachEvent("onpropertychange",_c)):s==="focusout"&&mc()}function wt(s){if(s==="selectionchange"||s==="keyup"||s==="keydown")return Br(ts)}function gs(s,r){if(s==="click")return Br(r)}function Ns(s,r){if(s==="input"||s==="change")return Br(r)}function Yr(s,r){return s===r&&(s!==0||1/s===1/r)||s!==s&&r!==r}var yi=typeof Object.is=="function"?Object.is:Yr;function oa(s,r){if(yi(s,r))return!0;if(typeof s!="object"||s===null||typeof r!="object"||r===null)return!1;var o=Object.keys(s),c=Object.keys(r);if(o.length!==c.length)return!1;for(c=0;c<o.length;c++){var m=o[c];if(!ge.call(r,m)||!yi(s[m],r[m]))return!1}return!0}function no(s){for(;s&&s.firstChild;)s=s.firstChild;return s}function ao(s,r){var o=no(s);s=0;for(var c;o;){if(o.nodeType===3){if(c=s+o.textContent.length,s<=r&&c>=r)return{node:o,offset:r-s};s=c}e:{for(;o;){if(o.nextSibling){o=o.nextSibling;break e}o=o.parentNode}o=void 0}o=no(o)}}function ov(s,r){return s&&r?s===r?!0:s&&s.nodeType===3?!1:r&&r.nodeType===3?ov(s,r.parentNode):"contains"in s?s.contains(r):s.compareDocumentPosition?!!(s.compareDocumentPosition(r)&16):!1:!1}function lv(s){s=s!=null&&s.ownerDocument!=null&&s.ownerDocument.defaultView!=null?s.ownerDocument.defaultView:window;for(var r=ea(s.document);r instanceof s.HTMLIFrameElement;){try{var o=typeof r.contentWindow.location.href=="string"}catch{o=!1}if(o)s=r.contentWindow;else break;r=ea(s.document)}return r}function Lf(s){var r=s&&s.nodeName&&s.nodeName.toLowerCase();return r&&(r==="input"&&(s.type==="text"||s.type==="search"||s.type==="tel"||s.type==="url"||s.type==="password")||r==="textarea"||s.contentEditable==="true")}var Xx=ar&&"documentMode"in document&&11>=document.documentMode,il=null,Df=null,pc=null,Of=!1;function cv(s,r,o){var c=o.window===o?o.document:o.nodeType===9?o:o.ownerDocument;Of||il==null||il!==ea(c)||(c=il,"selectionStart"in c&&Lf(c)?c={start:c.selectionStart,end:c.selectionEnd}:(c=(c.ownerDocument&&c.ownerDocument.defaultView||window).getSelection(),c={anchorNode:c.anchorNode,anchorOffset:c.anchorOffset,focusNode:c.focusNode,focusOffset:c.focusOffset}),pc&&oa(pc,c)||(pc=c,c=Ph(Df,"onSelect"),0<c.length&&(r=new Za("onSelect","select",null,r,o),s.push({event:r,listeners:c}),r.target=il)))}function oo(s,r){var o={};return o[s.toLowerCase()]=r.toLowerCase(),o["Webkit"+s]="webkit"+r,o["Moz"+s]="moz"+r,o}var sl={animationend:oo("Animation","AnimationEnd"),animationiteration:oo("Animation","AnimationIteration"),animationstart:oo("Animation","AnimationStart"),transitionrun:oo("Transition","TransitionRun"),transitionstart:oo("Transition","TransitionStart"),transitioncancel:oo("Transition","TransitionCancel"),transitionend:oo("Transition","TransitionEnd")},Bf={},uv={};ar&&(uv=document.createElement("div").style,"AnimationEvent"in window||(delete sl.animationend.animation,delete sl.animationiteration.animation,delete sl.animationstart.animation),"TransitionEvent"in window||delete sl.transitionend.transition);function lo(s){if(Bf[s])return Bf[s];if(!sl[s])return s;var r=sl[s],o;for(o in r)if(r.hasOwnProperty(o)&&o in uv)return Bf[s]=r[o];return s}var hv=lo("animationend"),dv=lo("animationiteration"),fv=lo("animationstart"),Zx=lo("transitionrun"),Qx=lo("transitionstart"),Jx=lo("transitioncancel"),mv=lo("transitionend"),_v=new Map,Nf="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(" ");Nf.push("scrollEnd");function Nr(s,r){_v.set(s,r),ps(r,[s])}var Ku=typeof reportError=="function"?reportError:function(s){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var r=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof s=="object"&&s!==null&&typeof s.message=="string"?String(s.message):String(s),error:s});if(!window.dispatchEvent(r))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",s);return}console.error(s)},cr=[],rl=0,Pf=0;function Xu(){for(var s=rl,r=Pf=rl=0;r<s;){var o=cr[r];cr[r++]=null;var c=cr[r];cr[r++]=null;var m=cr[r];cr[r++]=null;var _=cr[r];if(cr[r++]=null,c!==null&&m!==null){var b=c.pending;b===null?m.next=m:(m.next=b.next,b.next=m),c.pending=m}_!==0&&pv(o,m,_)}}function Zu(s,r,o,c){cr[rl++]=s,cr[rl++]=r,cr[rl++]=o,cr[rl++]=c,Pf|=c,s.lanes|=c,s=s.alternate,s!==null&&(s.lanes|=c)}function zf(s,r,o,c){return Zu(s,r,o,c),Qu(s)}function co(s,r){return Zu(s,null,null,r),Qu(s)}function pv(s,r,o){s.lanes|=o;var c=s.alternate;c!==null&&(c.lanes|=o);for(var m=!1,_=s.return;_!==null;)_.childLanes|=o,c=_.alternate,c!==null&&(c.childLanes|=o),_.tag===22&&(s=_.stateNode,s===null||s._visibility&1||(m=!0)),s=_,_=_.return;return s.tag===3?(_=s.stateNode,m&&r!==null&&(m=31-At(o),s=_.hiddenUpdates,c=s[m],c===null?s[m]=[r]:c.push(r),r.lane=o|536870912),_):null}function Qu(s){if(50<Hc)throw Hc=0,qm=null,Error(n(185));for(var r=s.return;r!==null;)s=r,r=s.return;return s.tag===3?s.stateNode:null}var nl={};function e5(s,r,o,c){this.tag=s,this.key=o,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=r,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=c,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Ps(s,r,o,c){return new e5(s,r,o,c)}function Hf(s){return s=s.prototype,!(!s||!s.isReactComponent)}function Sn(s,r){var o=s.alternate;return o===null?(o=Ps(s.tag,r,s.key,s.mode),o.elementType=s.elementType,o.type=s.type,o.stateNode=s.stateNode,o.alternate=s,s.alternate=o):(o.pendingProps=r,o.type=s.type,o.flags=0,o.subtreeFlags=0,o.deletions=null),o.flags=s.flags&65011712,o.childLanes=s.childLanes,o.lanes=s.lanes,o.child=s.child,o.memoizedProps=s.memoizedProps,o.memoizedState=s.memoizedState,o.updateQueue=s.updateQueue,r=s.dependencies,o.dependencies=r===null?null:{lanes:r.lanes,firstContext:r.firstContext},o.sibling=s.sibling,o.index=s.index,o.ref=s.ref,o.refCleanup=s.refCleanup,o}function gv(s,r){s.flags&=65011714;var o=s.alternate;return o===null?(s.childLanes=0,s.lanes=r,s.child=null,s.subtreeFlags=0,s.memoizedProps=null,s.memoizedState=null,s.updateQueue=null,s.dependencies=null,s.stateNode=null):(s.childLanes=o.childLanes,s.lanes=o.lanes,s.child=o.child,s.subtreeFlags=0,s.deletions=null,s.memoizedProps=o.memoizedProps,s.memoizedState=o.memoizedState,s.updateQueue=o.updateQueue,s.type=o.type,r=o.dependencies,s.dependencies=r===null?null:{lanes:r.lanes,firstContext:r.firstContext}),s}function Ju(s,r,o,c,m,_){var b=0;if(c=s,typeof s=="function")Hf(s)&&(b=1);else if(typeof s=="string")b=n2(s,o,ne.current)?26:s==="html"||s==="head"||s==="body"?27:5;else e:switch(s){case V:return s=Ps(31,o,r,m),s.elementType=V,s.lanes=_,s;case C:return uo(o.children,m,_,r);case x:b=8,m|=24;break;case R:return s=Ps(12,o,r,m|2),s.elementType=R,s.lanes=_,s;case W:return s=Ps(13,o,r,m),s.elementType=W,s.lanes=_,s;case D:return s=Ps(19,o,r,m),s.elementType=D,s.lanes=_,s;default:if(typeof s=="object"&&s!==null)switch(s.$$typeof){case N:b=10;break e;case L:b=9;break e;case T:b=11;break e;case I:b=14;break e;case H:b=16,c=null;break e}b=29,o=Error(n(130,s===null?"null":typeof s,"")),c=null}return r=Ps(b,o,r,m),r.elementType=s,r.type=c,r.lanes=_,r}function uo(s,r,o,c){return s=Ps(7,s,c,r),s.lanes=o,s}function If(s,r,o){return s=Ps(6,s,null,r),s.lanes=o,s}function vv(s){var r=Ps(18,null,null,0);return r.stateNode=s,r}function Uf(s,r,o){return r=Ps(4,s.children!==null?s.children:[],s.key,r),r.lanes=o,r.stateNode={containerInfo:s.containerInfo,pendingChildren:null,implementation:s.implementation},r}var Sv=new WeakMap;function ur(s,r){if(typeof s=="object"&&s!==null){var o=Sv.get(s);return o!==void 0?o:(r={value:s,source:r,stack:yt(r)},Sv.set(s,r),r)}return{value:s,source:r,stack:yt(r)}}var al=[],ol=0,eh=null,gc=0,hr=[],dr=0,la=null,Gr=1,Kr="";function yn(s,r){al[ol++]=gc,al[ol++]=eh,eh=s,gc=r}function yv(s,r,o){hr[dr++]=Gr,hr[dr++]=Kr,hr[dr++]=la,la=s;var c=Gr;s=Kr;var m=32-At(c)-1;c&=~(1<<m),o+=1;var _=32-At(r)+m;if(30<_){var b=m-m%5;_=(c&(1<<b)-1).toString(32),c>>=b,m-=b,Gr=1<<32-At(r)+m|o<<m|c,Kr=_+s}else Gr=1<<_|o<<m|c,Kr=s}function Ff(s){s.return!==null&&(yn(s,1),yv(s,1,0))}function $f(s){for(;s===eh;)eh=al[--ol],al[ol]=null,gc=al[--ol],al[ol]=null;for(;s===la;)la=hr[--dr],hr[dr]=null,Kr=hr[--dr],hr[dr]=null,Gr=hr[--dr],hr[dr]=null}function bv(s,r){hr[dr++]=Gr,hr[dr++]=Kr,hr[dr++]=la,Gr=r.id,Kr=r.overflow,la=s}var qi=null,Nt=null,dt=!1,ca=null,fr=!1,Wf=Error(n(519));function ua(s){var r=Error(n(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw vc(ur(r,s)),Wf}function wv(s){var r=s.stateNode,o=s.type,c=s.memoizedProps;switch(r[Re]=s,r[Ue]=c,o){case"dialog":ct("cancel",r),ct("close",r);break;case"iframe":case"object":case"embed":ct("load",r);break;case"video":case"audio":for(o=0;o<Uc.length;o++)ct(Uc[o],r);break;case"source":ct("error",r);break;case"img":case"image":case"link":ct("error",r),ct("load",r);break;case"details":ct("toggle",r);break;case"input":ct("invalid",r),Yo(r,c.value,c.defaultValue,c.checked,c.defaultChecked,c.type,c.name,!0);break;case"select":ct("invalid",r);break;case"textarea":ct("invalid",r),Ti(r,c.value,c.defaultValue,c.children)}o=c.children,typeof o!="string"&&typeof o!="number"&&typeof o!="bigint"||r.textContent===""+o||c.suppressHydrationWarning===!0||IS(r.textContent,o)?(c.popover!=null&&(ct("beforetoggle",r),ct("toggle",r)),c.onScroll!=null&&ct("scroll",r),c.onScrollEnd!=null&&ct("scrollend",r),c.onClick!=null&&(r.onclick=Ri),r=!0):r=!1,r||ua(s,!0)}function Cv(s){for(qi=s.return;qi;)switch(qi.tag){case 5:case 31:case 13:fr=!1;return;case 27:case 3:fr=!0;return;default:qi=qi.return}}function ll(s){if(s!==qi)return!1;if(!dt)return Cv(s),dt=!0,!1;var r=s.tag,o;if((o=r!==3&&r!==27)&&((o=r===5)&&(o=s.type,o=!(o!=="form"&&o!=="button")||o_(s.type,s.memoizedProps)),o=!o),o&&Nt&&ua(s),Cv(s),r===13){if(s=s.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error(n(317));Nt=GS(s)}else if(r===31){if(s=s.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error(n(317));Nt=GS(s)}else r===27?(r=Nt,xa(s.type)?(s=d_,d_=null,Nt=s):Nt=r):Nt=qi?_r(s.stateNode.nextSibling):null;return!0}function ho(){Nt=qi=null,dt=!1}function jf(){var s=ca;return s!==null&&(bs===null?bs=s:bs.push.apply(bs,s),ca=null),s}function vc(s){ca===null?ca=[s]:ca.push(s)}var Vf=B(null),fo=null,bn=null;function ha(s,r,o){te(Vf,r._currentValue),r._currentValue=o}function wn(s){s._currentValue=Vf.current,K(Vf)}function qf(s,r,o){for(;s!==null;){var c=s.alternate;if((s.childLanes&r)!==r?(s.childLanes|=r,c!==null&&(c.childLanes|=r)):c!==null&&(c.childLanes&r)!==r&&(c.childLanes|=r),s===o)break;s=s.return}}function Yf(s,r,o,c){var m=s.child;for(m!==null&&(m.return=s);m!==null;){var _=m.dependencies;if(_!==null){var b=m.child;_=_.firstContext;e:for(;_!==null;){var k=_;_=m;for(var F=0;F<r.length;F++)if(k.context===r[F]){_.lanes|=o,k=_.alternate,k!==null&&(k.lanes|=o),qf(_.return,o,s),c||(b=null);break e}_=k.next}}else if(m.tag===18){if(b=m.return,b===null)throw Error(n(341));b.lanes|=o,_=b.alternate,_!==null&&(_.lanes|=o),qf(b,o,s),b=null}else b=m.child;if(b!==null)b.return=m;else for(b=m;b!==null;){if(b===s){b=null;break}if(m=b.sibling,m!==null){m.return=b.return,b=m;break}b=b.return}m=b}}function cl(s,r,o,c){s=null;for(var m=r,_=!1;m!==null;){if(!_){if((m.flags&524288)!==0)_=!0;else if((m.flags&262144)!==0)break}if(m.tag===10){var b=m.alternate;if(b===null)throw Error(n(387));if(b=b.memoizedProps,b!==null){var k=m.type;yi(m.pendingProps.value,b.value)||(s!==null?s.push(k):s=[k])}}else if(m===he.current){if(b=m.alternate,b===null)throw Error(n(387));b.memoizedState.memoizedState!==m.memoizedState.memoizedState&&(s!==null?s.push(Vc):s=[Vc])}m=m.return}s!==null&&Yf(r,s,o,c),r.flags|=262144}function th(s){for(s=s.firstContext;s!==null;){if(!yi(s.context._currentValue,s.memoizedValue))return!0;s=s.next}return!1}function mo(s){fo=s,bn=null,s=s.dependencies,s!==null&&(s.firstContext=null)}function Yi(s){return xv(fo,s)}function ih(s,r){return fo===null&&mo(s),xv(s,r)}function xv(s,r){var o=r._currentValue;if(r={context:r,memoizedValue:o,next:null},bn===null){if(s===null)throw Error(n(308));bn=r,s.dependencies={lanes:0,firstContext:r},s.flags|=524288}else bn=bn.next=r;return o}var t5=typeof AbortController<"u"?AbortController:function(){var s=[],r=this.signal={aborted:!1,addEventListener:function(o,c){s.push(c)}};this.abort=function(){r.aborted=!0,s.forEach(function(o){return o()})}},i5=t.unstable_scheduleCallback,s5=t.unstable_NormalPriority,hi={$$typeof:N,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Gf(){return{controller:new t5,data:new Map,refCount:0}}function Sc(s){s.refCount--,s.refCount===0&&i5(s5,function(){s.controller.abort()})}var yc=null,Kf=0,ul=0,hl=null;function r5(s,r){if(yc===null){var o=yc=[];Kf=0,ul=Qm(),hl={status:"pending",value:void 0,then:function(c){o.push(c)}}}return Kf++,r.then(kv,kv),r}function kv(){if(--Kf===0&&yc!==null){hl!==null&&(hl.status="fulfilled");var s=yc;yc=null,ul=0,hl=null;for(var r=0;r<s.length;r++)(0,s[r])()}}function n5(s,r){var o=[],c={status:"pending",value:null,reason:null,then:function(m){o.push(m)}};return s.then(function(){c.status="fulfilled",c.value=r;for(var m=0;m<o.length;m++)(0,o[m])(r)},function(m){for(c.status="rejected",c.reason=m,m=0;m<o.length;m++)(0,o[m])(void 0)}),c}var Ev=E.S;E.S=function(s,r){cS=Xe(),typeof r=="object"&&r!==null&&typeof r.then=="function"&&r5(s,r),Ev!==null&&Ev(s,r)};var _o=B(null);function Xf(){var s=_o.current;return s!==null?s:Ot.pooledCache}function sh(s,r){r===null?te(_o,_o.current):te(_o,r.pool)}function Tv(){var s=Xf();return s===null?null:{parent:hi._currentValue,pool:s}}var dl=Error(n(460)),Zf=Error(n(474)),rh=Error(n(542)),nh={then:function(){}};function Rv(s){return s=s.status,s==="fulfilled"||s==="rejected"}function Mv(s,r,o){switch(o=s[o],o===void 0?s.push(r):o!==r&&(r.then(Ri,Ri),r=o),r.status){case"fulfilled":return r.value;case"rejected":throw s=r.reason,Lv(s),s;default:if(typeof r.status=="string")r.then(Ri,Ri);else{if(s=Ot,s!==null&&100<s.shellSuspendCounter)throw Error(n(482));s=r,s.status="pending",s.then(function(c){if(r.status==="pending"){var m=r;m.status="fulfilled",m.value=c}},function(c){if(r.status==="pending"){var m=r;m.status="rejected",m.reason=c}})}switch(r.status){case"fulfilled":return r.value;case"rejected":throw s=r.reason,Lv(s),s}throw go=r,dl}}function po(s){try{var r=s._init;return r(s._payload)}catch(o){throw o!==null&&typeof o=="object"&&typeof o.then=="function"?(go=o,dl):o}}var go=null;function Av(){if(go===null)throw Error(n(459));var s=go;return go=null,s}function Lv(s){if(s===dl||s===rh)throw Error(n(483))}var fl=null,bc=0;function ah(s){var r=bc;return bc+=1,fl===null&&(fl=[]),Mv(fl,s,r)}function wc(s,r){r=r.props.ref,s.ref=r!==void 0?r:null}function oh(s,r){throw r.$$typeof===p?Error(n(525)):(s=Object.prototype.toString.call(r),Error(n(31,s==="[object Object]"?"object with keys {"+Object.keys(r).join(", ")+"}":s)))}function Dv(s){function r(Y,j){if(s){var X=Y.deletions;X===null?(Y.deletions=[j],Y.flags|=16):X.push(j)}}function o(Y,j){if(!s)return null;for(;j!==null;)r(Y,j),j=j.sibling;return null}function c(Y){for(var j=new Map;Y!==null;)Y.key!==null?j.set(Y.key,Y):j.set(Y.index,Y),Y=Y.sibling;return j}function m(Y,j){return Y=Sn(Y,j),Y.index=0,Y.sibling=null,Y}function _(Y,j,X){return Y.index=X,s?(X=Y.alternate,X!==null?(X=X.index,X<j?(Y.flags|=67108866,j):X):(Y.flags|=67108866,j)):(Y.flags|=1048576,j)}function b(Y){return s&&Y.alternate===null&&(Y.flags|=67108866),Y}function k(Y,j,X,ae){return j===null||j.tag!==6?(j=If(X,Y.mode,ae),j.return=Y,j):(j=m(j,X),j.return=Y,j)}function F(Y,j,X,ae){var Ie=X.type;return Ie===C?re(Y,j,X.props.children,ae,X.key):j!==null&&(j.elementType===Ie||typeof Ie=="object"&&Ie!==null&&Ie.$$typeof===H&&po(Ie)===j.type)?(j=m(j,X.props),wc(j,X),j.return=Y,j):(j=Ju(X.type,X.key,X.props,null,Y.mode,ae),wc(j,X),j.return=Y,j)}function Z(Y,j,X,ae){return j===null||j.tag!==4||j.stateNode.containerInfo!==X.containerInfo||j.stateNode.implementation!==X.implementation?(j=Uf(X,Y.mode,ae),j.return=Y,j):(j=m(j,X.children||[]),j.return=Y,j)}function re(Y,j,X,ae,Ie){return j===null||j.tag!==7?(j=uo(X,Y.mode,ae,Ie),j.return=Y,j):(j=m(j,X),j.return=Y,j)}function oe(Y,j,X){if(typeof j=="string"&&j!==""||typeof j=="number"||typeof j=="bigint")return j=If(""+j,Y.mode,X),j.return=Y,j;if(typeof j=="object"&&j!==null){switch(j.$$typeof){case S:return X=Ju(j.type,j.key,j.props,null,Y.mode,X),wc(X,j),X.return=Y,X;case y:return j=Uf(j,Y.mode,X),j.return=Y,j;case H:return j=po(j),oe(Y,j,X)}if($(j)||A(j))return j=uo(j,Y.mode,X,null),j.return=Y,j;if(typeof j.then=="function")return oe(Y,ah(j),X);if(j.$$typeof===N)return oe(Y,ih(Y,j),X);oh(Y,j)}return null}function ee(Y,j,X,ae){var Ie=j!==null?j.key:null;if(typeof X=="string"&&X!==""||typeof X=="number"||typeof X=="bigint")return Ie!==null?null:k(Y,j,""+X,ae);if(typeof X=="object"&&X!==null){switch(X.$$typeof){case S:return X.key===Ie?F(Y,j,X,ae):null;case y:return X.key===Ie?Z(Y,j,X,ae):null;case H:return X=po(X),ee(Y,j,X,ae)}if($(X)||A(X))return Ie!==null?null:re(Y,j,X,ae,null);if(typeof X.then=="function")return ee(Y,j,ah(X),ae);if(X.$$typeof===N)return ee(Y,j,ih(Y,X),ae);oh(Y,X)}return null}function ie(Y,j,X,ae,Ie){if(typeof ae=="string"&&ae!==""||typeof ae=="number"||typeof ae=="bigint")return Y=Y.get(X)||null,k(j,Y,""+ae,Ie);if(typeof ae=="object"&&ae!==null){switch(ae.$$typeof){case S:return Y=Y.get(ae.key===null?X:ae.key)||null,F(j,Y,ae,Ie);case y:return Y=Y.get(ae.key===null?X:ae.key)||null,Z(j,Y,ae,Ie);case H:return ae=po(ae),ie(Y,j,X,ae,Ie)}if($(ae)||A(ae))return Y=Y.get(X)||null,re(j,Y,ae,Ie,null);if(typeof ae.then=="function")return ie(Y,j,X,ah(ae),Ie);if(ae.$$typeof===N)return ie(Y,j,X,ih(j,ae),Ie);oh(j,ae)}return null}function Te(Y,j,X,ae){for(var Ie=null,gt=null,Oe=j,tt=j=0,ht=null;Oe!==null&&tt<X.length;tt++){Oe.index>tt?(ht=Oe,Oe=null):ht=Oe.sibling;var vt=ee(Y,Oe,X[tt],ae);if(vt===null){Oe===null&&(Oe=ht);break}s&&Oe&&vt.alternate===null&&r(Y,Oe),j=_(vt,j,tt),gt===null?Ie=vt:gt.sibling=vt,gt=vt,Oe=ht}if(tt===X.length)return o(Y,Oe),dt&&yn(Y,tt),Ie;if(Oe===null){for(;tt<X.length;tt++)Oe=oe(Y,X[tt],ae),Oe!==null&&(j=_(Oe,j,tt),gt===null?Ie=Oe:gt.sibling=Oe,gt=Oe);return dt&&yn(Y,tt),Ie}for(Oe=c(Oe);tt<X.length;tt++)ht=ie(Oe,Y,tt,X[tt],ae),ht!==null&&(s&&ht.alternate!==null&&Oe.delete(ht.key===null?tt:ht.key),j=_(ht,j,tt),gt===null?Ie=ht:gt.sibling=ht,gt=ht);return s&&Oe.forEach(function(Ma){return r(Y,Ma)}),dt&&yn(Y,tt),Ie}function Fe(Y,j,X,ae){if(X==null)throw Error(n(151));for(var Ie=null,gt=null,Oe=j,tt=j=0,ht=null,vt=X.next();Oe!==null&&!vt.done;tt++,vt=X.next()){Oe.index>tt?(ht=Oe,Oe=null):ht=Oe.sibling;var Ma=ee(Y,Oe,vt.value,ae);if(Ma===null){Oe===null&&(Oe=ht);break}s&&Oe&&Ma.alternate===null&&r(Y,Oe),j=_(Ma,j,tt),gt===null?Ie=Ma:gt.sibling=Ma,gt=Ma,Oe=ht}if(vt.done)return o(Y,Oe),dt&&yn(Y,tt),Ie;if(Oe===null){for(;!vt.done;tt++,vt=X.next())vt=oe(Y,vt.value,ae),vt!==null&&(j=_(vt,j,tt),gt===null?Ie=vt:gt.sibling=vt,gt=vt);return dt&&yn(Y,tt),Ie}for(Oe=c(Oe);!vt.done;tt++,vt=X.next())vt=ie(Oe,Y,tt,vt.value,ae),vt!==null&&(s&&vt.alternate!==null&&Oe.delete(vt.key===null?tt:vt.key),j=_(vt,j,tt),gt===null?Ie=vt:gt.sibling=vt,gt=vt);return s&&Oe.forEach(function(p2){return r(Y,p2)}),dt&&yn(Y,tt),Ie}function Rt(Y,j,X,ae){if(typeof X=="object"&&X!==null&&X.type===C&&X.key===null&&(X=X.props.children),typeof X=="object"&&X!==null){switch(X.$$typeof){case S:e:{for(var Ie=X.key;j!==null;){if(j.key===Ie){if(Ie=X.type,Ie===C){if(j.tag===7){o(Y,j.sibling),ae=m(j,X.props.children),ae.return=Y,Y=ae;break e}}else if(j.elementType===Ie||typeof Ie=="object"&&Ie!==null&&Ie.$$typeof===H&&po(Ie)===j.type){o(Y,j.sibling),ae=m(j,X.props),wc(ae,X),ae.return=Y,Y=ae;break e}o(Y,j);break}else r(Y,j);j=j.sibling}X.type===C?(ae=uo(X.props.children,Y.mode,ae,X.key),ae.return=Y,Y=ae):(ae=Ju(X.type,X.key,X.props,null,Y.mode,ae),wc(ae,X),ae.return=Y,Y=ae)}return b(Y);case y:e:{for(Ie=X.key;j!==null;){if(j.key===Ie)if(j.tag===4&&j.stateNode.containerInfo===X.containerInfo&&j.stateNode.implementation===X.implementation){o(Y,j.sibling),ae=m(j,X.children||[]),ae.return=Y,Y=ae;break e}else{o(Y,j);break}else r(Y,j);j=j.sibling}ae=Uf(X,Y.mode,ae),ae.return=Y,Y=ae}return b(Y);case H:return X=po(X),Rt(Y,j,X,ae)}if($(X))return Te(Y,j,X,ae);if(A(X)){if(Ie=A(X),typeof Ie!="function")throw Error(n(150));return X=Ie.call(X),Fe(Y,j,X,ae)}if(typeof X.then=="function")return Rt(Y,j,ah(X),ae);if(X.$$typeof===N)return Rt(Y,j,ih(Y,X),ae);oh(Y,X)}return typeof X=="string"&&X!==""||typeof X=="number"||typeof X=="bigint"?(X=""+X,j!==null&&j.tag===6?(o(Y,j.sibling),ae=m(j,X),ae.return=Y,Y=ae):(o(Y,j),ae=If(X,Y.mode,ae),ae.return=Y,Y=ae),b(Y)):o(Y,j)}return function(Y,j,X,ae){try{bc=0;var Ie=Rt(Y,j,X,ae);return fl=null,Ie}catch(Oe){if(Oe===dl||Oe===rh)throw Oe;var gt=Ps(29,Oe,null,Y.mode);return gt.lanes=ae,gt.return=Y,gt}}}var vo=Dv(!0),Ov=Dv(!1),da=!1;function Qf(s){s.updateQueue={baseState:s.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Jf(s,r){s=s.updateQueue,r.updateQueue===s&&(r.updateQueue={baseState:s.baseState,firstBaseUpdate:s.firstBaseUpdate,lastBaseUpdate:s.lastBaseUpdate,shared:s.shared,callbacks:null})}function fa(s){return{lane:s,tag:0,payload:null,callback:null,next:null}}function ma(s,r,o){var c=s.updateQueue;if(c===null)return null;if(c=c.shared,(St&2)!==0){var m=c.pending;return m===null?r.next=r:(r.next=m.next,m.next=r),c.pending=r,r=Qu(s),pv(s,null,o),r}return Zu(s,c,r,o),Qu(s)}function Cc(s,r,o){if(r=r.updateQueue,r!==null&&(r=r.shared,(o&4194048)!==0)){var c=r.lanes;c&=s.pendingLanes,o|=c,r.lanes=o,Vo(s,o)}}function em(s,r){var o=s.updateQueue,c=s.alternate;if(c!==null&&(c=c.updateQueue,o===c)){var m=null,_=null;if(o=o.firstBaseUpdate,o!==null){do{var b={lane:o.lane,tag:o.tag,payload:o.payload,callback:null,next:null};_===null?m=_=b:_=_.next=b,o=o.next}while(o!==null);_===null?m=_=r:_=_.next=r}else m=_=r;o={baseState:c.baseState,firstBaseUpdate:m,lastBaseUpdate:_,shared:c.shared,callbacks:c.callbacks},s.updateQueue=o;return}s=o.lastBaseUpdate,s===null?o.firstBaseUpdate=r:s.next=r,o.lastBaseUpdate=r}var tm=!1;function xc(){if(tm){var s=hl;if(s!==null)throw s}}function kc(s,r,o,c){tm=!1;var m=s.updateQueue;da=!1;var _=m.firstBaseUpdate,b=m.lastBaseUpdate,k=m.shared.pending;if(k!==null){m.shared.pending=null;var F=k,Z=F.next;F.next=null,b===null?_=Z:b.next=Z,b=F;var re=s.alternate;re!==null&&(re=re.updateQueue,k=re.lastBaseUpdate,k!==b&&(k===null?re.firstBaseUpdate=Z:k.next=Z,re.lastBaseUpdate=F))}if(_!==null){var oe=m.baseState;b=0,re=Z=F=null,k=_;do{var ee=k.lane&-536870913,ie=ee!==k.lane;if(ie?(ut&ee)===ee:(c&ee)===ee){ee!==0&&ee===ul&&(tm=!0),re!==null&&(re=re.next={lane:0,tag:k.tag,payload:k.payload,callback:null,next:null});e:{var Te=s,Fe=k;ee=r;var Rt=o;switch(Fe.tag){case 1:if(Te=Fe.payload,typeof Te=="function"){oe=Te.call(Rt,oe,ee);break e}oe=Te;break e;case 3:Te.flags=Te.flags&-65537|128;case 0:if(Te=Fe.payload,ee=typeof Te=="function"?Te.call(Rt,oe,ee):Te,ee==null)break e;oe=v({},oe,ee);break e;case 2:da=!0}}ee=k.callback,ee!==null&&(s.flags|=64,ie&&(s.flags|=8192),ie=m.callbacks,ie===null?m.callbacks=[ee]:ie.push(ee))}else ie={lane:ee,tag:k.tag,payload:k.payload,callback:k.callback,next:null},re===null?(Z=re=ie,F=oe):re=re.next=ie,b|=ee;if(k=k.next,k===null){if(k=m.shared.pending,k===null)break;ie=k,k=ie.next,ie.next=null,m.lastBaseUpdate=ie,m.shared.pending=null}}while(!0);re===null&&(F=oe),m.baseState=F,m.firstBaseUpdate=Z,m.lastBaseUpdate=re,_===null&&(m.shared.lanes=0),Sa|=b,s.lanes=b,s.memoizedState=oe}}function Bv(s,r){if(typeof s!="function")throw Error(n(191,s));s.call(r)}function Nv(s,r){var o=s.callbacks;if(o!==null)for(s.callbacks=null,s=0;s<o.length;s++)Bv(o[s],r)}var ml=B(null),lh=B(0);function Pv(s,r){s=Ln,te(lh,s),te(ml,r),Ln=s|r.baseLanes}function im(){te(lh,Ln),te(ml,ml.current)}function sm(){Ln=lh.current,K(ml),K(lh)}var zs=B(null),mr=null;function _a(s){var r=s.alternate;te(ai,ai.current&1),te(zs,s),mr===null&&(r===null||ml.current!==null||r.memoizedState!==null)&&(mr=s)}function rm(s){te(ai,ai.current),te(zs,s),mr===null&&(mr=s)}function zv(s){s.tag===22?(te(ai,ai.current),te(zs,s),mr===null&&(mr=s)):pa()}function pa(){te(ai,ai.current),te(zs,zs.current)}function Hs(s){K(zs),mr===s&&(mr=null),K(ai)}var ai=B(0);function ch(s){for(var r=s;r!==null;){if(r.tag===13){var o=r.memoizedState;if(o!==null&&(o=o.dehydrated,o===null||u_(o)||h_(o)))return r}else if(r.tag===19&&(r.memoizedProps.revealOrder==="forwards"||r.memoizedProps.revealOrder==="backwards"||r.memoizedProps.revealOrder==="unstable_legacy-backwards"||r.memoizedProps.revealOrder==="together")){if((r.flags&128)!==0)return r}else if(r.child!==null){r.child.return=r,r=r.child;continue}if(r===s)break;for(;r.sibling===null;){if(r.return===null||r.return===s)return null;r=r.return}r.sibling.return=r.return,r=r.sibling}return null}var Cn=0,Je=null,Et=null,di=null,uh=!1,_l=!1,So=!1,hh=0,Ec=0,pl=null,a5=0;function Qt(){throw Error(n(321))}function nm(s,r){if(r===null)return!1;for(var o=0;o<r.length&&o<s.length;o++)if(!yi(s[o],r[o]))return!1;return!0}function am(s,r,o,c,m,_){return Cn=_,Je=r,r.memoizedState=null,r.updateQueue=null,r.lanes=0,E.H=s===null||s.memoizedState===null?y0:bm,So=!1,_=o(c,m),So=!1,_l&&(_=Iv(r,o,c,m)),Hv(s),_}function Hv(s){E.H=Mc;var r=Et!==null&&Et.next!==null;if(Cn=0,di=Et=Je=null,uh=!1,Ec=0,pl=null,r)throw Error(n(300));s===null||fi||(s=s.dependencies,s!==null&&th(s)&&(fi=!0))}function Iv(s,r,o,c){Je=s;var m=0;do{if(_l&&(pl=null),Ec=0,_l=!1,25<=m)throw Error(n(301));if(m+=1,di=Et=null,s.updateQueue!=null){var _=s.updateQueue;_.lastEffect=null,_.events=null,_.stores=null,_.memoCache!=null&&(_.memoCache.index=0)}E.H=b0,_=r(o,c)}while(_l);return _}function o5(){var s=E.H,r=s.useState()[0];return r=typeof r.then=="function"?Tc(r):r,s=s.useState()[0],(Et!==null?Et.memoizedState:null)!==s&&(Je.flags|=1024),r}function om(){var s=hh!==0;return hh=0,s}function lm(s,r,o){r.updateQueue=s.updateQueue,r.flags&=-2053,s.lanes&=~o}function cm(s){if(uh){for(s=s.memoizedState;s!==null;){var r=s.queue;r!==null&&(r.pending=null),s=s.next}uh=!1}Cn=0,di=Et=Je=null,_l=!1,Ec=hh=0,pl=null}function cs(){var s={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return di===null?Je.memoizedState=di=s:di=di.next=s,di}function oi(){if(Et===null){var s=Je.alternate;s=s!==null?s.memoizedState:null}else s=Et.next;var r=di===null?Je.memoizedState:di.next;if(r!==null)di=r,Et=s;else{if(s===null)throw Je.alternate===null?Error(n(467)):Error(n(310));Et=s,s={memoizedState:Et.memoizedState,baseState:Et.baseState,baseQueue:Et.baseQueue,queue:Et.queue,next:null},di===null?Je.memoizedState=di=s:di=di.next=s}return di}function dh(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Tc(s){var r=Ec;return Ec+=1,pl===null&&(pl=[]),s=Mv(pl,s,r),r=Je,(di===null?r.memoizedState:di.next)===null&&(r=r.alternate,E.H=r===null||r.memoizedState===null?y0:bm),s}function fh(s){if(s!==null&&typeof s=="object"){if(typeof s.then=="function")return Tc(s);if(s.$$typeof===N)return Yi(s)}throw Error(n(438,String(s)))}function um(s){var r=null,o=Je.updateQueue;if(o!==null&&(r=o.memoCache),r==null){var c=Je.alternate;c!==null&&(c=c.updateQueue,c!==null&&(c=c.memoCache,c!=null&&(r={data:c.data.map(function(m){return m.slice()}),index:0})))}if(r==null&&(r={data:[],index:0}),o===null&&(o=dh(),Je.updateQueue=o),o.memoCache=r,o=r.data[r.index],o===void 0)for(o=r.data[r.index]=Array(s),c=0;c<s;c++)o[c]=se;return r.index++,o}function xn(s,r){return typeof r=="function"?r(s):r}function mh(s){var r=oi();return hm(r,Et,s)}function hm(s,r,o){var c=s.queue;if(c===null)throw Error(n(311));c.lastRenderedReducer=o;var m=s.baseQueue,_=c.pending;if(_!==null){if(m!==null){var b=m.next;m.next=_.next,_.next=b}r.baseQueue=m=_,c.pending=null}if(_=s.baseState,m===null)s.memoizedState=_;else{r=m.next;var k=b=null,F=null,Z=r,re=!1;do{var oe=Z.lane&-536870913;if(oe!==Z.lane?(ut&oe)===oe:(Cn&oe)===oe){var ee=Z.revertLane;if(ee===0)F!==null&&(F=F.next={lane:0,revertLane:0,gesture:null,action:Z.action,hasEagerState:Z.hasEagerState,eagerState:Z.eagerState,next:null}),oe===ul&&(re=!0);else if((Cn&ee)===ee){Z=Z.next,ee===ul&&(re=!0);continue}else oe={lane:0,revertLane:Z.revertLane,gesture:null,action:Z.action,hasEagerState:Z.hasEagerState,eagerState:Z.eagerState,next:null},F===null?(k=F=oe,b=_):F=F.next=oe,Je.lanes|=ee,Sa|=ee;oe=Z.action,So&&o(_,oe),_=Z.hasEagerState?Z.eagerState:o(_,oe)}else ee={lane:oe,revertLane:Z.revertLane,gesture:Z.gesture,action:Z.action,hasEagerState:Z.hasEagerState,eagerState:Z.eagerState,next:null},F===null?(k=F=ee,b=_):F=F.next=ee,Je.lanes|=oe,Sa|=oe;Z=Z.next}while(Z!==null&&Z!==r);if(F===null?b=_:F.next=k,!yi(_,s.memoizedState)&&(fi=!0,re&&(o=hl,o!==null)))throw o;s.memoizedState=_,s.baseState=b,s.baseQueue=F,c.lastRenderedState=_}return m===null&&(c.lanes=0),[s.memoizedState,c.dispatch]}function dm(s){var r=oi(),o=r.queue;if(o===null)throw Error(n(311));o.lastRenderedReducer=s;var c=o.dispatch,m=o.pending,_=r.memoizedState;if(m!==null){o.pending=null;var b=m=m.next;do _=s(_,b.action),b=b.next;while(b!==m);yi(_,r.memoizedState)||(fi=!0),r.memoizedState=_,r.baseQueue===null&&(r.baseState=_),o.lastRenderedState=_}return[_,c]}function Uv(s,r,o){var c=Je,m=oi(),_=dt;if(_){if(o===void 0)throw Error(n(407));o=o()}else o=r();var b=!yi((Et||m).memoizedState,o);if(b&&(m.memoizedState=o,fi=!0),m=m.queue,_m(Wv.bind(null,c,m,s),[s]),m.getSnapshot!==r||b||di!==null&&di.memoizedState.tag&1){if(c.flags|=2048,gl(9,{destroy:void 0},$v.bind(null,c,m,o,r),null),Ot===null)throw Error(n(349));_||(Cn&127)!==0||Fv(c,r,o)}return o}function Fv(s,r,o){s.flags|=16384,s={getSnapshot:r,value:o},r=Je.updateQueue,r===null?(r=dh(),Je.updateQueue=r,r.stores=[s]):(o=r.stores,o===null?r.stores=[s]:o.push(s))}function $v(s,r,o,c){r.value=o,r.getSnapshot=c,jv(r)&&Vv(s)}function Wv(s,r,o){return o(function(){jv(r)&&Vv(s)})}function jv(s){var r=s.getSnapshot;s=s.value;try{var o=r();return!yi(s,o)}catch{return!0}}function Vv(s){var r=co(s,2);r!==null&&ws(r,s,2)}function fm(s){var r=cs();if(typeof s=="function"){var o=s;if(s=o(),So){$i(!0);try{o()}finally{$i(!1)}}}return r.memoizedState=r.baseState=s,r.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:xn,lastRenderedState:s},r}function qv(s,r,o,c){return s.baseState=o,hm(s,Et,typeof c=="function"?c:xn)}function l5(s,r,o,c,m){if(gh(s))throw Error(n(485));if(s=r.action,s!==null){var _={payload:m,action:s,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(b){_.listeners.push(b)}};E.T!==null?o(!0):_.isTransition=!1,c(_),o=r.pending,o===null?(_.next=r.pending=_,Yv(r,_)):(_.next=o.next,r.pending=o.next=_)}}function Yv(s,r){var o=r.action,c=r.payload,m=s.state;if(r.isTransition){var _=E.T,b={};E.T=b;try{var k=o(m,c),F=E.S;F!==null&&F(b,k),Gv(s,r,k)}catch(Z){mm(s,r,Z)}finally{_!==null&&b.types!==null&&(_.types=b.types),E.T=_}}else try{_=o(m,c),Gv(s,r,_)}catch(Z){mm(s,r,Z)}}function Gv(s,r,o){o!==null&&typeof o=="object"&&typeof o.then=="function"?o.then(function(c){Kv(s,r,c)},function(c){return mm(s,r,c)}):Kv(s,r,o)}function Kv(s,r,o){r.status="fulfilled",r.value=o,Xv(r),s.state=o,r=s.pending,r!==null&&(o=r.next,o===r?s.pending=null:(o=o.next,r.next=o,Yv(s,o)))}function mm(s,r,o){var c=s.pending;if(s.pending=null,c!==null){c=c.next;do r.status="rejected",r.reason=o,Xv(r),r=r.next;while(r!==c)}s.action=null}function Xv(s){s=s.listeners;for(var r=0;r<s.length;r++)(0,s[r])()}function Zv(s,r){return r}function Qv(s,r){if(dt){var o=Ot.formState;if(o!==null){e:{var c=Je;if(dt){if(Nt){t:{for(var m=Nt,_=fr;m.nodeType!==8;){if(!_){m=null;break t}if(m=_r(m.nextSibling),m===null){m=null;break t}}_=m.data,m=_==="F!"||_==="F"?m:null}if(m){Nt=_r(m.nextSibling),c=m.data==="F!";break e}}ua(c)}c=!1}c&&(r=o[0])}}return o=cs(),o.memoizedState=o.baseState=r,c={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Zv,lastRenderedState:r},o.queue=c,o=g0.bind(null,Je,c),c.dispatch=o,c=fm(!1),_=ym.bind(null,Je,!1,c.queue),c=cs(),m={state:r,dispatch:null,action:s,pending:null},c.queue=m,o=l5.bind(null,Je,m,_,o),m.dispatch=o,c.memoizedState=s,[r,o,!1]}function Jv(s){var r=oi();return e0(r,Et,s)}function e0(s,r,o){if(r=hm(s,r,Zv)[0],s=mh(xn)[0],typeof r=="object"&&r!==null&&typeof r.then=="function")try{var c=Tc(r)}catch(b){throw b===dl?rh:b}else c=r;r=oi();var m=r.queue,_=m.dispatch;return o!==r.memoizedState&&(Je.flags|=2048,gl(9,{destroy:void 0},c5.bind(null,m,o),null)),[c,_,s]}function c5(s,r){s.action=r}function t0(s){var r=oi(),o=Et;if(o!==null)return e0(r,o,s);oi(),r=r.memoizedState,o=oi();var c=o.queue.dispatch;return o.memoizedState=s,[r,c,!1]}function gl(s,r,o,c){return s={tag:s,create:o,deps:c,inst:r,next:null},r=Je.updateQueue,r===null&&(r=dh(),Je.updateQueue=r),o=r.lastEffect,o===null?r.lastEffect=s.next=s:(c=o.next,o.next=s,s.next=c,r.lastEffect=s),s}function i0(){return oi().memoizedState}function _h(s,r,o,c){var m=cs();Je.flags|=s,m.memoizedState=gl(1|r,{destroy:void 0},o,c===void 0?null:c)}function ph(s,r,o,c){var m=oi();c=c===void 0?null:c;var _=m.memoizedState.inst;Et!==null&&c!==null&&nm(c,Et.memoizedState.deps)?m.memoizedState=gl(r,_,o,c):(Je.flags|=s,m.memoizedState=gl(1|r,_,o,c))}function s0(s,r){_h(8390656,8,s,r)}function _m(s,r){ph(2048,8,s,r)}function u5(s){Je.flags|=4;var r=Je.updateQueue;if(r===null)r=dh(),Je.updateQueue=r,r.events=[s];else{var o=r.events;o===null?r.events=[s]:o.push(s)}}function r0(s){var r=oi().memoizedState;return u5({ref:r,nextImpl:s}),function(){if((St&2)!==0)throw Error(n(440));return r.impl.apply(void 0,arguments)}}function n0(s,r){return ph(4,2,s,r)}function a0(s,r){return ph(4,4,s,r)}function o0(s,r){if(typeof r=="function"){s=s();var o=r(s);return function(){typeof o=="function"?o():r(null)}}if(r!=null)return s=s(),r.current=s,function(){r.current=null}}function l0(s,r,o){o=o!=null?o.concat([s]):null,ph(4,4,o0.bind(null,r,s),o)}function pm(){}function c0(s,r){var o=oi();r=r===void 0?null:r;var c=o.memoizedState;return r!==null&&nm(r,c[1])?c[0]:(o.memoizedState=[s,r],s)}function u0(s,r){var o=oi();r=r===void 0?null:r;var c=o.memoizedState;if(r!==null&&nm(r,c[1]))return c[0];if(c=s(),So){$i(!0);try{s()}finally{$i(!1)}}return o.memoizedState=[c,r],c}function gm(s,r,o){return o===void 0||(Cn&1073741824)!==0&&(ut&261930)===0?s.memoizedState=r:(s.memoizedState=o,s=hS(),Je.lanes|=s,Sa|=s,o)}function h0(s,r,o,c){return yi(o,r)?o:ml.current!==null?(s=gm(s,o,c),yi(s,r)||(fi=!0),s):(Cn&42)===0||(Cn&1073741824)!==0&&(ut&261930)===0?(fi=!0,s.memoizedState=o):(s=hS(),Je.lanes|=s,Sa|=s,r)}function d0(s,r,o,c,m){var _=M.p;M.p=_!==0&&8>_?_:8;var b=E.T,k={};E.T=k,ym(s,!1,r,o);try{var F=m(),Z=E.S;if(Z!==null&&Z(k,F),F!==null&&typeof F=="object"&&typeof F.then=="function"){var re=n5(F,c);Rc(s,r,re,Fs(s))}else Rc(s,r,c,Fs(s))}catch(oe){Rc(s,r,{then:function(){},status:"rejected",reason:oe},Fs())}finally{M.p=_,b!==null&&k.types!==null&&(b.types=k.types),E.T=b}}function h5(){}function vm(s,r,o,c){if(s.tag!==5)throw Error(n(476));var m=f0(s).queue;d0(s,m,r,z,o===null?h5:function(){return m0(s),o(c)})}function f0(s){var r=s.memoizedState;if(r!==null)return r;r={memoizedState:z,baseState:z,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:xn,lastRenderedState:z},next:null};var o={};return r.next={memoizedState:o,baseState:o,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:xn,lastRenderedState:o},next:null},s.memoizedState=r,s=s.alternate,s!==null&&(s.memoizedState=r),r}function m0(s){var r=f0(s);r.next===null&&(r=s.alternate.memoizedState),Rc(s,r.next.queue,{},Fs())}function Sm(){return Yi(Vc)}function _0(){return oi().memoizedState}function p0(){return oi().memoizedState}function d5(s){for(var r=s.return;r!==null;){switch(r.tag){case 24:case 3:var o=Fs();s=fa(o);var c=ma(r,s,o);c!==null&&(ws(c,r,o),Cc(c,r,o)),r={cache:Gf()},s.payload=r;return}r=r.return}}function f5(s,r,o){var c=Fs();o={lane:c,revertLane:0,gesture:null,action:o,hasEagerState:!1,eagerState:null,next:null},gh(s)?v0(r,o):(o=zf(s,r,o,c),o!==null&&(ws(o,s,c),S0(o,r,c)))}function g0(s,r,o){var c=Fs();Rc(s,r,o,c)}function Rc(s,r,o,c){var m={lane:c,revertLane:0,gesture:null,action:o,hasEagerState:!1,eagerState:null,next:null};if(gh(s))v0(r,m);else{var _=s.alternate;if(s.lanes===0&&(_===null||_.lanes===0)&&(_=r.lastRenderedReducer,_!==null))try{var b=r.lastRenderedState,k=_(b,o);if(m.hasEagerState=!0,m.eagerState=k,yi(k,b))return Zu(s,r,m,0),Ot===null&&Xu(),!1}catch{}if(o=zf(s,r,m,c),o!==null)return ws(o,s,c),S0(o,r,c),!0}return!1}function ym(s,r,o,c){if(c={lane:2,revertLane:Qm(),gesture:null,action:c,hasEagerState:!1,eagerState:null,next:null},gh(s)){if(r)throw Error(n(479))}else r=zf(s,o,c,2),r!==null&&ws(r,s,2)}function gh(s){var r=s.alternate;return s===Je||r!==null&&r===Je}function v0(s,r){_l=uh=!0;var o=s.pending;o===null?r.next=r:(r.next=o.next,o.next=r),s.pending=r}function S0(s,r,o){if((o&4194048)!==0){var c=r.lanes;c&=s.pendingLanes,o|=c,r.lanes=o,Vo(s,o)}}var Mc={readContext:Yi,use:fh,useCallback:Qt,useContext:Qt,useEffect:Qt,useImperativeHandle:Qt,useLayoutEffect:Qt,useInsertionEffect:Qt,useMemo:Qt,useReducer:Qt,useRef:Qt,useState:Qt,useDebugValue:Qt,useDeferredValue:Qt,useTransition:Qt,useSyncExternalStore:Qt,useId:Qt,useHostTransitionStatus:Qt,useFormState:Qt,useActionState:Qt,useOptimistic:Qt,useMemoCache:Qt,useCacheRefresh:Qt};Mc.useEffectEvent=Qt;var y0={readContext:Yi,use:fh,useCallback:function(s,r){return cs().memoizedState=[s,r===void 0?null:r],s},useContext:Yi,useEffect:s0,useImperativeHandle:function(s,r,o){o=o!=null?o.concat([s]):null,_h(4194308,4,o0.bind(null,r,s),o)},useLayoutEffect:function(s,r){return _h(4194308,4,s,r)},useInsertionEffect:function(s,r){_h(4,2,s,r)},useMemo:function(s,r){var o=cs();r=r===void 0?null:r;var c=s();if(So){$i(!0);try{s()}finally{$i(!1)}}return o.memoizedState=[c,r],c},useReducer:function(s,r,o){var c=cs();if(o!==void 0){var m=o(r);if(So){$i(!0);try{o(r)}finally{$i(!1)}}}else m=r;return c.memoizedState=c.baseState=m,s={pending:null,lanes:0,dispatch:null,lastRenderedReducer:s,lastRenderedState:m},c.queue=s,s=s.dispatch=f5.bind(null,Je,s),[c.memoizedState,s]},useRef:function(s){var r=cs();return s={current:s},r.memoizedState=s},useState:function(s){s=fm(s);var r=s.queue,o=g0.bind(null,Je,r);return r.dispatch=o,[s.memoizedState,o]},useDebugValue:pm,useDeferredValue:function(s,r){var o=cs();return gm(o,s,r)},useTransition:function(){var s=fm(!1);return s=d0.bind(null,Je,s.queue,!0,!1),cs().memoizedState=s,[!1,s]},useSyncExternalStore:function(s,r,o){var c=Je,m=cs();if(dt){if(o===void 0)throw Error(n(407));o=o()}else{if(o=r(),Ot===null)throw Error(n(349));(ut&127)!==0||Fv(c,r,o)}m.memoizedState=o;var _={value:o,getSnapshot:r};return m.queue=_,s0(Wv.bind(null,c,_,s),[s]),c.flags|=2048,gl(9,{destroy:void 0},$v.bind(null,c,_,o,r),null),o},useId:function(){var s=cs(),r=Ot.identifierPrefix;if(dt){var o=Kr,c=Gr;o=(c&~(1<<32-At(c)-1)).toString(32)+o,r="_"+r+"R_"+o,o=hh++,0<o&&(r+="H"+o.toString(32)),r+="_"}else o=a5++,r="_"+r+"r_"+o.toString(32)+"_";return s.memoizedState=r},useHostTransitionStatus:Sm,useFormState:Qv,useActionState:Qv,useOptimistic:function(s){var r=cs();r.memoizedState=r.baseState=s;var o={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return r.queue=o,r=ym.bind(null,Je,!0,o),o.dispatch=r,[s,r]},useMemoCache:um,useCacheRefresh:function(){return cs().memoizedState=d5.bind(null,Je)},useEffectEvent:function(s){var r=cs(),o={impl:s};return r.memoizedState=o,function(){if((St&2)!==0)throw Error(n(440));return o.impl.apply(void 0,arguments)}}},bm={readContext:Yi,use:fh,useCallback:c0,useContext:Yi,useEffect:_m,useImperativeHandle:l0,useInsertionEffect:n0,useLayoutEffect:a0,useMemo:u0,useReducer:mh,useRef:i0,useState:function(){return mh(xn)},useDebugValue:pm,useDeferredValue:function(s,r){var o=oi();return h0(o,Et.memoizedState,s,r)},useTransition:function(){var s=mh(xn)[0],r=oi().memoizedState;return[typeof s=="boolean"?s:Tc(s),r]},useSyncExternalStore:Uv,useId:_0,useHostTransitionStatus:Sm,useFormState:Jv,useActionState:Jv,useOptimistic:function(s,r){var o=oi();return qv(o,Et,s,r)},useMemoCache:um,useCacheRefresh:p0};bm.useEffectEvent=r0;var b0={readContext:Yi,use:fh,useCallback:c0,useContext:Yi,useEffect:_m,useImperativeHandle:l0,useInsertionEffect:n0,useLayoutEffect:a0,useMemo:u0,useReducer:dm,useRef:i0,useState:function(){return dm(xn)},useDebugValue:pm,useDeferredValue:function(s,r){var o=oi();return Et===null?gm(o,s,r):h0(o,Et.memoizedState,s,r)},useTransition:function(){var s=dm(xn)[0],r=oi().memoizedState;return[typeof s=="boolean"?s:Tc(s),r]},useSyncExternalStore:Uv,useId:_0,useHostTransitionStatus:Sm,useFormState:t0,useActionState:t0,useOptimistic:function(s,r){var o=oi();return Et!==null?qv(o,Et,s,r):(o.baseState=s,[s,o.queue.dispatch])},useMemoCache:um,useCacheRefresh:p0};b0.useEffectEvent=r0;function wm(s,r,o,c){r=s.memoizedState,o=o(c,r),o=o==null?r:v({},r,o),s.memoizedState=o,s.lanes===0&&(s.updateQueue.baseState=o)}var Cm={enqueueSetState:function(s,r,o){s=s._reactInternals;var c=Fs(),m=fa(c);m.payload=r,o!=null&&(m.callback=o),r=ma(s,m,c),r!==null&&(ws(r,s,c),Cc(r,s,c))},enqueueReplaceState:function(s,r,o){s=s._reactInternals;var c=Fs(),m=fa(c);m.tag=1,m.payload=r,o!=null&&(m.callback=o),r=ma(s,m,c),r!==null&&(ws(r,s,c),Cc(r,s,c))},enqueueForceUpdate:function(s,r){s=s._reactInternals;var o=Fs(),c=fa(o);c.tag=2,r!=null&&(c.callback=r),r=ma(s,c,o),r!==null&&(ws(r,s,o),Cc(r,s,o))}};function w0(s,r,o,c,m,_,b){return s=s.stateNode,typeof s.shouldComponentUpdate=="function"?s.shouldComponentUpdate(c,_,b):r.prototype&&r.prototype.isPureReactComponent?!oa(o,c)||!oa(m,_):!0}function C0(s,r,o,c){s=r.state,typeof r.componentWillReceiveProps=="function"&&r.componentWillReceiveProps(o,c),typeof r.UNSAFE_componentWillReceiveProps=="function"&&r.UNSAFE_componentWillReceiveProps(o,c),r.state!==s&&Cm.enqueueReplaceState(r,r.state,null)}function yo(s,r){var o=r;if("ref"in r){o={};for(var c in r)c!=="ref"&&(o[c]=r[c])}if(s=s.defaultProps){o===r&&(o=v({},o));for(var m in s)o[m]===void 0&&(o[m]=s[m])}return o}function x0(s){Ku(s)}function k0(s){console.error(s)}function E0(s){Ku(s)}function vh(s,r){try{var o=s.onUncaughtError;o(r.value,{componentStack:r.stack})}catch(c){setTimeout(function(){throw c})}}function T0(s,r,o){try{var c=s.onCaughtError;c(o.value,{componentStack:o.stack,errorBoundary:r.tag===1?r.stateNode:null})}catch(m){setTimeout(function(){throw m})}}function xm(s,r,o){return o=fa(o),o.tag=3,o.payload={element:null},o.callback=function(){vh(s,r)},o}function R0(s){return s=fa(s),s.tag=3,s}function M0(s,r,o,c){var m=o.type.getDerivedStateFromError;if(typeof m=="function"){var _=c.value;s.payload=function(){return m(_)},s.callback=function(){T0(r,o,c)}}var b=o.stateNode;b!==null&&typeof b.componentDidCatch=="function"&&(s.callback=function(){T0(r,o,c),typeof m!="function"&&(ya===null?ya=new Set([this]):ya.add(this));var k=c.stack;this.componentDidCatch(c.value,{componentStack:k!==null?k:""})})}function m5(s,r,o,c,m){if(o.flags|=32768,c!==null&&typeof c=="object"&&typeof c.then=="function"){if(r=o.alternate,r!==null&&cl(r,o,m,!0),o=zs.current,o!==null){switch(o.tag){case 31:case 13:return mr===null?Ah():o.alternate===null&&Jt===0&&(Jt=3),o.flags&=-257,o.flags|=65536,o.lanes=m,c===nh?o.flags|=16384:(r=o.updateQueue,r===null?o.updateQueue=new Set([c]):r.add(c),Km(s,c,m)),!1;case 22:return o.flags|=65536,c===nh?o.flags|=16384:(r=o.updateQueue,r===null?(r={transitions:null,markerInstances:null,retryQueue:new Set([c])},o.updateQueue=r):(o=r.retryQueue,o===null?r.retryQueue=new Set([c]):o.add(c)),Km(s,c,m)),!1}throw Error(n(435,o.tag))}return Km(s,c,m),Ah(),!1}if(dt)return r=zs.current,r!==null?((r.flags&65536)===0&&(r.flags|=256),r.flags|=65536,r.lanes=m,c!==Wf&&(s=Error(n(422),{cause:c}),vc(ur(s,o)))):(c!==Wf&&(r=Error(n(423),{cause:c}),vc(ur(r,o))),s=s.current.alternate,s.flags|=65536,m&=-m,s.lanes|=m,c=ur(c,o),m=xm(s.stateNode,c,m),em(s,m),Jt!==4&&(Jt=2)),!1;var _=Error(n(520),{cause:c});if(_=ur(_,o),zc===null?zc=[_]:zc.push(_),Jt!==4&&(Jt=2),r===null)return!0;c=ur(c,o),o=r;do{switch(o.tag){case 3:return o.flags|=65536,s=m&-m,o.lanes|=s,s=xm(o.stateNode,c,s),em(o,s),!1;case 1:if(r=o.type,_=o.stateNode,(o.flags&128)===0&&(typeof r.getDerivedStateFromError=="function"||_!==null&&typeof _.componentDidCatch=="function"&&(ya===null||!ya.has(_))))return o.flags|=65536,m&=-m,o.lanes|=m,m=R0(m),M0(m,s,o,c),em(o,m),!1}o=o.return}while(o!==null);return!1}var km=Error(n(461)),fi=!1;function Gi(s,r,o,c){r.child=s===null?Ov(r,null,o,c):vo(r,s.child,o,c)}function A0(s,r,o,c,m){o=o.render;var _=r.ref;if("ref"in c){var b={};for(var k in c)k!=="ref"&&(b[k]=c[k])}else b=c;return mo(r),c=am(s,r,o,b,_,m),k=om(),s!==null&&!fi?(lm(s,r,m),kn(s,r,m)):(dt&&k&&Ff(r),r.flags|=1,Gi(s,r,c,m),r.child)}function L0(s,r,o,c,m){if(s===null){var _=o.type;return typeof _=="function"&&!Hf(_)&&_.defaultProps===void 0&&o.compare===null?(r.tag=15,r.type=_,D0(s,r,_,c,m)):(s=Ju(o.type,null,c,r,r.mode,m),s.ref=r.ref,s.return=r,r.child=s)}if(_=s.child,!Om(s,m)){var b=_.memoizedProps;if(o=o.compare,o=o!==null?o:oa,o(b,c)&&s.ref===r.ref)return kn(s,r,m)}return r.flags|=1,s=Sn(_,c),s.ref=r.ref,s.return=r,r.child=s}function D0(s,r,o,c,m){if(s!==null){var _=s.memoizedProps;if(oa(_,c)&&s.ref===r.ref)if(fi=!1,r.pendingProps=c=_,Om(s,m))(s.flags&131072)!==0&&(fi=!0);else return r.lanes=s.lanes,kn(s,r,m)}return Em(s,r,o,c,m)}function O0(s,r,o,c){var m=c.children,_=s!==null?s.memoizedState:null;if(s===null&&r.stateNode===null&&(r.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),c.mode==="hidden"){if((r.flags&128)!==0){if(_=_!==null?_.baseLanes|o:o,s!==null){for(c=r.child=s.child,m=0;c!==null;)m=m|c.lanes|c.childLanes,c=c.sibling;c=m&~_}else c=0,r.child=null;return B0(s,r,_,o,c)}if((o&536870912)!==0)r.memoizedState={baseLanes:0,cachePool:null},s!==null&&sh(r,_!==null?_.cachePool:null),_!==null?Pv(r,_):im(),zv(r);else return c=r.lanes=536870912,B0(s,r,_!==null?_.baseLanes|o:o,o,c)}else _!==null?(sh(r,_.cachePool),Pv(r,_),pa(),r.memoizedState=null):(s!==null&&sh(r,null),im(),pa());return Gi(s,r,m,o),r.child}function Ac(s,r){return s!==null&&s.tag===22||r.stateNode!==null||(r.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),r.sibling}function B0(s,r,o,c,m){var _=Xf();return _=_===null?null:{parent:hi._currentValue,pool:_},r.memoizedState={baseLanes:o,cachePool:_},s!==null&&sh(r,null),im(),zv(r),s!==null&&cl(s,r,c,!0),r.childLanes=m,null}function Sh(s,r){return r=bh({mode:r.mode,children:r.children},s.mode),r.ref=s.ref,s.child=r,r.return=s,r}function N0(s,r,o){return vo(r,s.child,null,o),s=Sh(r,r.pendingProps),s.flags|=2,Hs(r),r.memoizedState=null,s}function _5(s,r,o){var c=r.pendingProps,m=(r.flags&128)!==0;if(r.flags&=-129,s===null){if(dt){if(c.mode==="hidden")return s=Sh(r,c),r.lanes=536870912,Ac(null,s);if(rm(r),(s=Nt)?(s=YS(s,fr),s=s!==null&&s.data==="&"?s:null,s!==null&&(r.memoizedState={dehydrated:s,treeContext:la!==null?{id:Gr,overflow:Kr}:null,retryLane:536870912,hydrationErrors:null},o=vv(s),o.return=r,r.child=o,qi=r,Nt=null)):s=null,s===null)throw ua(r);return r.lanes=536870912,null}return Sh(r,c)}var _=s.memoizedState;if(_!==null){var b=_.dehydrated;if(rm(r),m)if(r.flags&256)r.flags&=-257,r=N0(s,r,o);else if(r.memoizedState!==null)r.child=s.child,r.flags|=128,r=null;else throw Error(n(558));else if(fi||cl(s,r,o,!1),m=(o&s.childLanes)!==0,fi||m){if(c=Ot,c!==null&&(b=Js(c,o),b!==0&&b!==_.retryLane))throw _.retryLane=b,co(s,b),ws(c,s,b),km;Ah(),r=N0(s,r,o)}else s=_.treeContext,Nt=_r(b.nextSibling),qi=r,dt=!0,ca=null,fr=!1,s!==null&&bv(r,s),r=Sh(r,c),r.flags|=4096;return r}return s=Sn(s.child,{mode:c.mode,children:c.children}),s.ref=r.ref,r.child=s,s.return=r,s}function yh(s,r){var o=r.ref;if(o===null)s!==null&&s.ref!==null&&(r.flags|=4194816);else{if(typeof o!="function"&&typeof o!="object")throw Error(n(284));(s===null||s.ref!==o)&&(r.flags|=4194816)}}function Em(s,r,o,c,m){return mo(r),o=am(s,r,o,c,void 0,m),c=om(),s!==null&&!fi?(lm(s,r,m),kn(s,r,m)):(dt&&c&&Ff(r),r.flags|=1,Gi(s,r,o,m),r.child)}function P0(s,r,o,c,m,_){return mo(r),r.updateQueue=null,o=Iv(r,c,o,m),Hv(s),c=om(),s!==null&&!fi?(lm(s,r,_),kn(s,r,_)):(dt&&c&&Ff(r),r.flags|=1,Gi(s,r,o,_),r.child)}function z0(s,r,o,c,m){if(mo(r),r.stateNode===null){var _=nl,b=o.contextType;typeof b=="object"&&b!==null&&(_=Yi(b)),_=new o(c,_),r.memoizedState=_.state!==null&&_.state!==void 0?_.state:null,_.updater=Cm,r.stateNode=_,_._reactInternals=r,_=r.stateNode,_.props=c,_.state=r.memoizedState,_.refs={},Qf(r),b=o.contextType,_.context=typeof b=="object"&&b!==null?Yi(b):nl,_.state=r.memoizedState,b=o.getDerivedStateFromProps,typeof b=="function"&&(wm(r,o,b,c),_.state=r.memoizedState),typeof o.getDerivedStateFromProps=="function"||typeof _.getSnapshotBeforeUpdate=="function"||typeof _.UNSAFE_componentWillMount!="function"&&typeof _.componentWillMount!="function"||(b=_.state,typeof _.componentWillMount=="function"&&_.componentWillMount(),typeof _.UNSAFE_componentWillMount=="function"&&_.UNSAFE_componentWillMount(),b!==_.state&&Cm.enqueueReplaceState(_,_.state,null),kc(r,c,_,m),xc(),_.state=r.memoizedState),typeof _.componentDidMount=="function"&&(r.flags|=4194308),c=!0}else if(s===null){_=r.stateNode;var k=r.memoizedProps,F=yo(o,k);_.props=F;var Z=_.context,re=o.contextType;b=nl,typeof re=="object"&&re!==null&&(b=Yi(re));var oe=o.getDerivedStateFromProps;re=typeof oe=="function"||typeof _.getSnapshotBeforeUpdate=="function",k=r.pendingProps!==k,re||typeof _.UNSAFE_componentWillReceiveProps!="function"&&typeof _.componentWillReceiveProps!="function"||(k||Z!==b)&&C0(r,_,c,b),da=!1;var ee=r.memoizedState;_.state=ee,kc(r,c,_,m),xc(),Z=r.memoizedState,k||ee!==Z||da?(typeof oe=="function"&&(wm(r,o,oe,c),Z=r.memoizedState),(F=da||w0(r,o,F,c,ee,Z,b))?(re||typeof _.UNSAFE_componentWillMount!="function"&&typeof _.componentWillMount!="function"||(typeof _.componentWillMount=="function"&&_.componentWillMount(),typeof _.UNSAFE_componentWillMount=="function"&&_.UNSAFE_componentWillMount()),typeof _.componentDidMount=="function"&&(r.flags|=4194308)):(typeof _.componentDidMount=="function"&&(r.flags|=4194308),r.memoizedProps=c,r.memoizedState=Z),_.props=c,_.state=Z,_.context=b,c=F):(typeof _.componentDidMount=="function"&&(r.flags|=4194308),c=!1)}else{_=r.stateNode,Jf(s,r),b=r.memoizedProps,re=yo(o,b),_.props=re,oe=r.pendingProps,ee=_.context,Z=o.contextType,F=nl,typeof Z=="object"&&Z!==null&&(F=Yi(Z)),k=o.getDerivedStateFromProps,(Z=typeof k=="function"||typeof _.getSnapshotBeforeUpdate=="function")||typeof _.UNSAFE_componentWillReceiveProps!="function"&&typeof _.componentWillReceiveProps!="function"||(b!==oe||ee!==F)&&C0(r,_,c,F),da=!1,ee=r.memoizedState,_.state=ee,kc(r,c,_,m),xc();var ie=r.memoizedState;b!==oe||ee!==ie||da||s!==null&&s.dependencies!==null&&th(s.dependencies)?(typeof k=="function"&&(wm(r,o,k,c),ie=r.memoizedState),(re=da||w0(r,o,re,c,ee,ie,F)||s!==null&&s.dependencies!==null&&th(s.dependencies))?(Z||typeof _.UNSAFE_componentWillUpdate!="function"&&typeof _.componentWillUpdate!="function"||(typeof _.componentWillUpdate=="function"&&_.componentWillUpdate(c,ie,F),typeof _.UNSAFE_componentWillUpdate=="function"&&_.UNSAFE_componentWillUpdate(c,ie,F)),typeof _.componentDidUpdate=="function"&&(r.flags|=4),typeof _.getSnapshotBeforeUpdate=="function"&&(r.flags|=1024)):(typeof _.componentDidUpdate!="function"||b===s.memoizedProps&&ee===s.memoizedState||(r.flags|=4),typeof _.getSnapshotBeforeUpdate!="function"||b===s.memoizedProps&&ee===s.memoizedState||(r.flags|=1024),r.memoizedProps=c,r.memoizedState=ie),_.props=c,_.state=ie,_.context=F,c=re):(typeof _.componentDidUpdate!="function"||b===s.memoizedProps&&ee===s.memoizedState||(r.flags|=4),typeof _.getSnapshotBeforeUpdate!="function"||b===s.memoizedProps&&ee===s.memoizedState||(r.flags|=1024),c=!1)}return _=c,yh(s,r),c=(r.flags&128)!==0,_||c?(_=r.stateNode,o=c&&typeof o.getDerivedStateFromError!="function"?null:_.render(),r.flags|=1,s!==null&&c?(r.child=vo(r,s.child,null,m),r.child=vo(r,null,o,m)):Gi(s,r,o,m),r.memoizedState=_.state,s=r.child):s=kn(s,r,m),s}function H0(s,r,o,c){return ho(),r.flags|=256,Gi(s,r,o,c),r.child}var Tm={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Rm(s){return{baseLanes:s,cachePool:Tv()}}function Mm(s,r,o){return s=s!==null?s.childLanes&~o:0,r&&(s|=Us),s}function I0(s,r,o){var c=r.pendingProps,m=!1,_=(r.flags&128)!==0,b;if((b=_)||(b=s!==null&&s.memoizedState===null?!1:(ai.current&2)!==0),b&&(m=!0,r.flags&=-129),b=(r.flags&32)!==0,r.flags&=-33,s===null){if(dt){if(m?_a(r):pa(),(s=Nt)?(s=YS(s,fr),s=s!==null&&s.data!=="&"?s:null,s!==null&&(r.memoizedState={dehydrated:s,treeContext:la!==null?{id:Gr,overflow:Kr}:null,retryLane:536870912,hydrationErrors:null},o=vv(s),o.return=r,r.child=o,qi=r,Nt=null)):s=null,s===null)throw ua(r);return h_(s)?r.lanes=32:r.lanes=536870912,null}var k=c.children;return c=c.fallback,m?(pa(),m=r.mode,k=bh({mode:"hidden",children:k},m),c=uo(c,m,o,null),k.return=r,c.return=r,k.sibling=c,r.child=k,c=r.child,c.memoizedState=Rm(o),c.childLanes=Mm(s,b,o),r.memoizedState=Tm,Ac(null,c)):(_a(r),Am(r,k))}var F=s.memoizedState;if(F!==null&&(k=F.dehydrated,k!==null)){if(_)r.flags&256?(_a(r),r.flags&=-257,r=Lm(s,r,o)):r.memoizedState!==null?(pa(),r.child=s.child,r.flags|=128,r=null):(pa(),k=c.fallback,m=r.mode,c=bh({mode:"visible",children:c.children},m),k=uo(k,m,o,null),k.flags|=2,c.return=r,k.return=r,c.sibling=k,r.child=c,vo(r,s.child,null,o),c=r.child,c.memoizedState=Rm(o),c.childLanes=Mm(s,b,o),r.memoizedState=Tm,r=Ac(null,c));else if(_a(r),h_(k)){if(b=k.nextSibling&&k.nextSibling.dataset,b)var Z=b.dgst;b=Z,c=Error(n(419)),c.stack="",c.digest=b,vc({value:c,source:null,stack:null}),r=Lm(s,r,o)}else if(fi||cl(s,r,o,!1),b=(o&s.childLanes)!==0,fi||b){if(b=Ot,b!==null&&(c=Js(b,o),c!==0&&c!==F.retryLane))throw F.retryLane=c,co(s,c),ws(b,s,c),km;u_(k)||Ah(),r=Lm(s,r,o)}else u_(k)?(r.flags|=192,r.child=s.child,r=null):(s=F.treeContext,Nt=_r(k.nextSibling),qi=r,dt=!0,ca=null,fr=!1,s!==null&&bv(r,s),r=Am(r,c.children),r.flags|=4096);return r}return m?(pa(),k=c.fallback,m=r.mode,F=s.child,Z=F.sibling,c=Sn(F,{mode:"hidden",children:c.children}),c.subtreeFlags=F.subtreeFlags&65011712,Z!==null?k=Sn(Z,k):(k=uo(k,m,o,null),k.flags|=2),k.return=r,c.return=r,c.sibling=k,r.child=c,Ac(null,c),c=r.child,k=s.child.memoizedState,k===null?k=Rm(o):(m=k.cachePool,m!==null?(F=hi._currentValue,m=m.parent!==F?{parent:F,pool:F}:m):m=Tv(),k={baseLanes:k.baseLanes|o,cachePool:m}),c.memoizedState=k,c.childLanes=Mm(s,b,o),r.memoizedState=Tm,Ac(s.child,c)):(_a(r),o=s.child,s=o.sibling,o=Sn(o,{mode:"visible",children:c.children}),o.return=r,o.sibling=null,s!==null&&(b=r.deletions,b===null?(r.deletions=[s],r.flags|=16):b.push(s)),r.child=o,r.memoizedState=null,o)}function Am(s,r){return r=bh({mode:"visible",children:r},s.mode),r.return=s,s.child=r}function bh(s,r){return s=Ps(22,s,null,r),s.lanes=0,s}function Lm(s,r,o){return vo(r,s.child,null,o),s=Am(r,r.pendingProps.children),s.flags|=2,r.memoizedState=null,s}function U0(s,r,o){s.lanes|=r;var c=s.alternate;c!==null&&(c.lanes|=r),qf(s.return,r,o)}function Dm(s,r,o,c,m,_){var b=s.memoizedState;b===null?s.memoizedState={isBackwards:r,rendering:null,renderingStartTime:0,last:c,tail:o,tailMode:m,treeForkCount:_}:(b.isBackwards=r,b.rendering=null,b.renderingStartTime=0,b.last=c,b.tail=o,b.tailMode=m,b.treeForkCount=_)}function F0(s,r,o){var c=r.pendingProps,m=c.revealOrder,_=c.tail;c=c.children;var b=ai.current,k=(b&2)!==0;if(k?(b=b&1|2,r.flags|=128):b&=1,te(ai,b),Gi(s,r,c,o),c=dt?gc:0,!k&&s!==null&&(s.flags&128)!==0)e:for(s=r.child;s!==null;){if(s.tag===13)s.memoizedState!==null&&U0(s,o,r);else if(s.tag===19)U0(s,o,r);else if(s.child!==null){s.child.return=s,s=s.child;continue}if(s===r)break e;for(;s.sibling===null;){if(s.return===null||s.return===r)break e;s=s.return}s.sibling.return=s.return,s=s.sibling}switch(m){case"forwards":for(o=r.child,m=null;o!==null;)s=o.alternate,s!==null&&ch(s)===null&&(m=o),o=o.sibling;o=m,o===null?(m=r.child,r.child=null):(m=o.sibling,o.sibling=null),Dm(r,!1,m,o,_,c);break;case"backwards":case"unstable_legacy-backwards":for(o=null,m=r.child,r.child=null;m!==null;){if(s=m.alternate,s!==null&&ch(s)===null){r.child=m;break}s=m.sibling,m.sibling=o,o=m,m=s}Dm(r,!0,o,null,_,c);break;case"together":Dm(r,!1,null,null,void 0,c);break;default:r.memoizedState=null}return r.child}function kn(s,r,o){if(s!==null&&(r.dependencies=s.dependencies),Sa|=r.lanes,(o&r.childLanes)===0)if(s!==null){if(cl(s,r,o,!1),(o&r.childLanes)===0)return null}else return null;if(s!==null&&r.child!==s.child)throw Error(n(153));if(r.child!==null){for(s=r.child,o=Sn(s,s.pendingProps),r.child=o,o.return=r;s.sibling!==null;)s=s.sibling,o=o.sibling=Sn(s,s.pendingProps),o.return=r;o.sibling=null}return r.child}function Om(s,r){return(s.lanes&r)!==0?!0:(s=s.dependencies,!!(s!==null&&th(s)))}function p5(s,r,o){switch(r.tag){case 3:Se(r,r.stateNode.containerInfo),ha(r,hi,s.memoizedState.cache),ho();break;case 27:case 5:Ee(r);break;case 4:Se(r,r.stateNode.containerInfo);break;case 10:ha(r,r.type,r.memoizedProps.value);break;case 31:if(r.memoizedState!==null)return r.flags|=128,rm(r),null;break;case 13:var c=r.memoizedState;if(c!==null)return c.dehydrated!==null?(_a(r),r.flags|=128,null):(o&r.child.childLanes)!==0?I0(s,r,o):(_a(r),s=kn(s,r,o),s!==null?s.sibling:null);_a(r);break;case 19:var m=(s.flags&128)!==0;if(c=(o&r.childLanes)!==0,c||(cl(s,r,o,!1),c=(o&r.childLanes)!==0),m){if(c)return F0(s,r,o);r.flags|=128}if(m=r.memoizedState,m!==null&&(m.rendering=null,m.tail=null,m.lastEffect=null),te(ai,ai.current),c)break;return null;case 22:return r.lanes=0,O0(s,r,o,r.pendingProps);case 24:ha(r,hi,s.memoizedState.cache)}return kn(s,r,o)}function $0(s,r,o){if(s!==null)if(s.memoizedProps!==r.pendingProps)fi=!0;else{if(!Om(s,o)&&(r.flags&128)===0)return fi=!1,p5(s,r,o);fi=(s.flags&131072)!==0}else fi=!1,dt&&(r.flags&1048576)!==0&&yv(r,gc,r.index);switch(r.lanes=0,r.tag){case 16:e:{var c=r.pendingProps;if(s=po(r.elementType),r.type=s,typeof s=="function")Hf(s)?(c=yo(s,c),r.tag=1,r=z0(null,r,s,c,o)):(r.tag=0,r=Em(null,r,s,c,o));else{if(s!=null){var m=s.$$typeof;if(m===T){r.tag=11,r=A0(null,r,s,c,o);break e}else if(m===I){r.tag=14,r=L0(null,r,s,c,o);break e}}throw r=P(s)||s,Error(n(306,r,""))}}return r;case 0:return Em(s,r,r.type,r.pendingProps,o);case 1:return c=r.type,m=yo(c,r.pendingProps),z0(s,r,c,m,o);case 3:e:{if(Se(r,r.stateNode.containerInfo),s===null)throw Error(n(387));c=r.pendingProps;var _=r.memoizedState;m=_.element,Jf(s,r),kc(r,c,null,o);var b=r.memoizedState;if(c=b.cache,ha(r,hi,c),c!==_.cache&&Yf(r,[hi],o,!0),xc(),c=b.element,_.isDehydrated)if(_={element:c,isDehydrated:!1,cache:b.cache},r.updateQueue.baseState=_,r.memoizedState=_,r.flags&256){r=H0(s,r,c,o);break e}else if(c!==m){m=ur(Error(n(424)),r),vc(m),r=H0(s,r,c,o);break e}else for(s=r.stateNode.containerInfo,s.nodeType===9?s=s.body:s=s.nodeName==="HTML"?s.ownerDocument.body:s,Nt=_r(s.firstChild),qi=r,dt=!0,ca=null,fr=!0,o=Ov(r,null,c,o),r.child=o;o;)o.flags=o.flags&-3|4096,o=o.sibling;else{if(ho(),c===m){r=kn(s,r,o);break e}Gi(s,r,c,o)}r=r.child}return r;case 26:return yh(s,r),s===null?(o=JS(r.type,null,r.pendingProps,null))?r.memoizedState=o:dt||(o=r.type,s=r.pendingProps,c=zh(ue.current).createElement(o),c[Re]=r,c[Ue]=s,Ki(c,o,s),Ce(c),r.stateNode=c):r.memoizedState=JS(r.type,s.memoizedProps,r.pendingProps,s.memoizedState),null;case 27:return Ee(r),s===null&&dt&&(c=r.stateNode=XS(r.type,r.pendingProps,ue.current),qi=r,fr=!0,m=Nt,xa(r.type)?(d_=m,Nt=_r(c.firstChild)):Nt=m),Gi(s,r,r.pendingProps.children,o),yh(s,r),s===null&&(r.flags|=4194304),r.child;case 5:return s===null&&dt&&((m=c=Nt)&&(c=q5(c,r.type,r.pendingProps,fr),c!==null?(r.stateNode=c,qi=r,Nt=_r(c.firstChild),fr=!1,m=!0):m=!1),m||ua(r)),Ee(r),m=r.type,_=r.pendingProps,b=s!==null?s.memoizedProps:null,c=_.children,o_(m,_)?c=null:b!==null&&o_(m,b)&&(r.flags|=32),r.memoizedState!==null&&(m=am(s,r,o5,null,null,o),Vc._currentValue=m),yh(s,r),Gi(s,r,c,o),r.child;case 6:return s===null&&dt&&((s=o=Nt)&&(o=Y5(o,r.pendingProps,fr),o!==null?(r.stateNode=o,qi=r,Nt=null,s=!0):s=!1),s||ua(r)),null;case 13:return I0(s,r,o);case 4:return Se(r,r.stateNode.containerInfo),c=r.pendingProps,s===null?r.child=vo(r,null,c,o):Gi(s,r,c,o),r.child;case 11:return A0(s,r,r.type,r.pendingProps,o);case 7:return Gi(s,r,r.pendingProps,o),r.child;case 8:return Gi(s,r,r.pendingProps.children,o),r.child;case 12:return Gi(s,r,r.pendingProps.children,o),r.child;case 10:return c=r.pendingProps,ha(r,r.type,c.value),Gi(s,r,c.children,o),r.child;case 9:return m=r.type._context,c=r.pendingProps.children,mo(r),m=Yi(m),c=c(m),r.flags|=1,Gi(s,r,c,o),r.child;case 14:return L0(s,r,r.type,r.pendingProps,o);case 15:return D0(s,r,r.type,r.pendingProps,o);case 19:return F0(s,r,o);case 31:return _5(s,r,o);case 22:return O0(s,r,o,r.pendingProps);case 24:return mo(r),c=Yi(hi),s===null?(m=Xf(),m===null&&(m=Ot,_=Gf(),m.pooledCache=_,_.refCount++,_!==null&&(m.pooledCacheLanes|=o),m=_),r.memoizedState={parent:c,cache:m},Qf(r),ha(r,hi,m)):((s.lanes&o)!==0&&(Jf(s,r),kc(r,null,null,o),xc()),m=s.memoizedState,_=r.memoizedState,m.parent!==c?(m={parent:c,cache:c},r.memoizedState=m,r.lanes===0&&(r.memoizedState=r.updateQueue.baseState=m),ha(r,hi,c)):(c=_.cache,ha(r,hi,c),c!==m.cache&&Yf(r,[hi],o,!0))),Gi(s,r,r.pendingProps.children,o),r.child;case 29:throw r.pendingProps}throw Error(n(156,r.tag))}function En(s){s.flags|=4}function Bm(s,r,o,c,m){if((r=(s.mode&32)!==0)&&(r=!1),r){if(s.flags|=16777216,(m&335544128)===m)if(s.stateNode.complete)s.flags|=8192;else if(_S())s.flags|=8192;else throw go=nh,Zf}else s.flags&=-16777217}function W0(s,r){if(r.type!=="stylesheet"||(r.state.loading&4)!==0)s.flags&=-16777217;else if(s.flags|=16777216,!ry(r))if(_S())s.flags|=8192;else throw go=nh,Zf}function wh(s,r){r!==null&&(s.flags|=4),s.flags&16384&&(r=s.tag!==22?es():536870912,s.lanes|=r,bl|=r)}function Lc(s,r){if(!dt)switch(s.tailMode){case"hidden":r=s.tail;for(var o=null;r!==null;)r.alternate!==null&&(o=r),r=r.sibling;o===null?s.tail=null:o.sibling=null;break;case"collapsed":o=s.tail;for(var c=null;o!==null;)o.alternate!==null&&(c=o),o=o.sibling;c===null?r||s.tail===null?s.tail=null:s.tail.sibling=null:c.sibling=null}}function Pt(s){var r=s.alternate!==null&&s.alternate.child===s.child,o=0,c=0;if(r)for(var m=s.child;m!==null;)o|=m.lanes|m.childLanes,c|=m.subtreeFlags&65011712,c|=m.flags&65011712,m.return=s,m=m.sibling;else for(m=s.child;m!==null;)o|=m.lanes|m.childLanes,c|=m.subtreeFlags,c|=m.flags,m.return=s,m=m.sibling;return s.subtreeFlags|=c,s.childLanes=o,r}function g5(s,r,o){var c=r.pendingProps;switch($f(r),r.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Pt(r),null;case 1:return Pt(r),null;case 3:return o=r.stateNode,c=null,s!==null&&(c=s.memoizedState.cache),r.memoizedState.cache!==c&&(r.flags|=2048),wn(hi),we(),o.pendingContext&&(o.context=o.pendingContext,o.pendingContext=null),(s===null||s.child===null)&&(ll(r)?En(r):s===null||s.memoizedState.isDehydrated&&(r.flags&256)===0||(r.flags|=1024,jf())),Pt(r),null;case 26:var m=r.type,_=r.memoizedState;return s===null?(En(r),_!==null?(Pt(r),W0(r,_)):(Pt(r),Bm(r,m,null,c,o))):_?_!==s.memoizedState?(En(r),Pt(r),W0(r,_)):(Pt(r),r.flags&=-16777217):(s=s.memoizedProps,s!==c&&En(r),Pt(r),Bm(r,m,s,c,o)),null;case 27:if(Le(r),o=ue.current,m=r.type,s!==null&&r.stateNode!=null)s.memoizedProps!==c&&En(r);else{if(!c){if(r.stateNode===null)throw Error(n(166));return Pt(r),null}s=ne.current,ll(r)?wv(r):(s=XS(m,c,o),r.stateNode=s,En(r))}return Pt(r),null;case 5:if(Le(r),m=r.type,s!==null&&r.stateNode!=null)s.memoizedProps!==c&&En(r);else{if(!c){if(r.stateNode===null)throw Error(n(166));return Pt(r),null}if(_=ne.current,ll(r))wv(r);else{var b=zh(ue.current);switch(_){case 1:_=b.createElementNS("http://www.w3.org/2000/svg",m);break;case 2:_=b.createElementNS("http://www.w3.org/1998/Math/MathML",m);break;default:switch(m){case"svg":_=b.createElementNS("http://www.w3.org/2000/svg",m);break;case"math":_=b.createElementNS("http://www.w3.org/1998/Math/MathML",m);break;case"script":_=b.createElement("div"),_.innerHTML="<script><\/script>",_=_.removeChild(_.firstChild);break;case"select":_=typeof c.is=="string"?b.createElement("select",{is:c.is}):b.createElement("select"),c.multiple?_.multiple=!0:c.size&&(_.size=c.size);break;default:_=typeof c.is=="string"?b.createElement(m,{is:c.is}):b.createElement(m)}}_[Re]=r,_[Ue]=c;e:for(b=r.child;b!==null;){if(b.tag===5||b.tag===6)_.appendChild(b.stateNode);else if(b.tag!==4&&b.tag!==27&&b.child!==null){b.child.return=b,b=b.child;continue}if(b===r)break e;for(;b.sibling===null;){if(b.return===null||b.return===r)break e;b=b.return}b.sibling.return=b.return,b=b.sibling}r.stateNode=_;e:switch(Ki(_,m,c),m){case"button":case"input":case"select":case"textarea":c=!!c.autoFocus;break e;case"img":c=!0;break e;default:c=!1}c&&En(r)}}return Pt(r),Bm(r,r.type,s===null?null:s.memoizedProps,r.pendingProps,o),null;case 6:if(s&&r.stateNode!=null)s.memoizedProps!==c&&En(r);else{if(typeof c!="string"&&r.stateNode===null)throw Error(n(166));if(s=ue.current,ll(r)){if(s=r.stateNode,o=r.memoizedProps,c=null,m=qi,m!==null)switch(m.tag){case 27:case 5:c=m.memoizedProps}s[Re]=r,s=!!(s.nodeValue===o||c!==null&&c.suppressHydrationWarning===!0||IS(s.nodeValue,o)),s||ua(r,!0)}else s=zh(s).createTextNode(c),s[Re]=r,r.stateNode=s}return Pt(r),null;case 31:if(o=r.memoizedState,s===null||s.memoizedState!==null){if(c=ll(r),o!==null){if(s===null){if(!c)throw Error(n(318));if(s=r.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error(n(557));s[Re]=r}else ho(),(r.flags&128)===0&&(r.memoizedState=null),r.flags|=4;Pt(r),s=!1}else o=jf(),s!==null&&s.memoizedState!==null&&(s.memoizedState.hydrationErrors=o),s=!0;if(!s)return r.flags&256?(Hs(r),r):(Hs(r),null);if((r.flags&128)!==0)throw Error(n(558))}return Pt(r),null;case 13:if(c=r.memoizedState,s===null||s.memoizedState!==null&&s.memoizedState.dehydrated!==null){if(m=ll(r),c!==null&&c.dehydrated!==null){if(s===null){if(!m)throw Error(n(318));if(m=r.memoizedState,m=m!==null?m.dehydrated:null,!m)throw Error(n(317));m[Re]=r}else ho(),(r.flags&128)===0&&(r.memoizedState=null),r.flags|=4;Pt(r),m=!1}else m=jf(),s!==null&&s.memoizedState!==null&&(s.memoizedState.hydrationErrors=m),m=!0;if(!m)return r.flags&256?(Hs(r),r):(Hs(r),null)}return Hs(r),(r.flags&128)!==0?(r.lanes=o,r):(o=c!==null,s=s!==null&&s.memoizedState!==null,o&&(c=r.child,m=null,c.alternate!==null&&c.alternate.memoizedState!==null&&c.alternate.memoizedState.cachePool!==null&&(m=c.alternate.memoizedState.cachePool.pool),_=null,c.memoizedState!==null&&c.memoizedState.cachePool!==null&&(_=c.memoizedState.cachePool.pool),_!==m&&(c.flags|=2048)),o!==s&&o&&(r.child.flags|=8192),wh(r,r.updateQueue),Pt(r),null);case 4:return we(),s===null&&i_(r.stateNode.containerInfo),Pt(r),null;case 10:return wn(r.type),Pt(r),null;case 19:if(K(ai),c=r.memoizedState,c===null)return Pt(r),null;if(m=(r.flags&128)!==0,_=c.rendering,_===null)if(m)Lc(c,!1);else{if(Jt!==0||s!==null&&(s.flags&128)!==0)for(s=r.child;s!==null;){if(_=ch(s),_!==null){for(r.flags|=128,Lc(c,!1),s=_.updateQueue,r.updateQueue=s,wh(r,s),r.subtreeFlags=0,s=o,o=r.child;o!==null;)gv(o,s),o=o.sibling;return te(ai,ai.current&1|2),dt&&yn(r,c.treeForkCount),r.child}s=s.sibling}c.tail!==null&&Xe()>Th&&(r.flags|=128,m=!0,Lc(c,!1),r.lanes=4194304)}else{if(!m)if(s=ch(_),s!==null){if(r.flags|=128,m=!0,s=s.updateQueue,r.updateQueue=s,wh(r,s),Lc(c,!0),c.tail===null&&c.tailMode==="hidden"&&!_.alternate&&!dt)return Pt(r),null}else 2*Xe()-c.renderingStartTime>Th&&o!==536870912&&(r.flags|=128,m=!0,Lc(c,!1),r.lanes=4194304);c.isBackwards?(_.sibling=r.child,r.child=_):(s=c.last,s!==null?s.sibling=_:r.child=_,c.last=_)}return c.tail!==null?(s=c.tail,c.rendering=s,c.tail=s.sibling,c.renderingStartTime=Xe(),s.sibling=null,o=ai.current,te(ai,m?o&1|2:o&1),dt&&yn(r,c.treeForkCount),s):(Pt(r),null);case 22:case 23:return Hs(r),sm(),c=r.memoizedState!==null,s!==null?s.memoizedState!==null!==c&&(r.flags|=8192):c&&(r.flags|=8192),c?(o&536870912)!==0&&(r.flags&128)===0&&(Pt(r),r.subtreeFlags&6&&(r.flags|=8192)):Pt(r),o=r.updateQueue,o!==null&&wh(r,o.retryQueue),o=null,s!==null&&s.memoizedState!==null&&s.memoizedState.cachePool!==null&&(o=s.memoizedState.cachePool.pool),c=null,r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(c=r.memoizedState.cachePool.pool),c!==o&&(r.flags|=2048),s!==null&&K(_o),null;case 24:return o=null,s!==null&&(o=s.memoizedState.cache),r.memoizedState.cache!==o&&(r.flags|=2048),wn(hi),Pt(r),null;case 25:return null;case 30:return null}throw Error(n(156,r.tag))}function v5(s,r){switch($f(r),r.tag){case 1:return s=r.flags,s&65536?(r.flags=s&-65537|128,r):null;case 3:return wn(hi),we(),s=r.flags,(s&65536)!==0&&(s&128)===0?(r.flags=s&-65537|128,r):null;case 26:case 27:case 5:return Le(r),null;case 31:if(r.memoizedState!==null){if(Hs(r),r.alternate===null)throw Error(n(340));ho()}return s=r.flags,s&65536?(r.flags=s&-65537|128,r):null;case 13:if(Hs(r),s=r.memoizedState,s!==null&&s.dehydrated!==null){if(r.alternate===null)throw Error(n(340));ho()}return s=r.flags,s&65536?(r.flags=s&-65537|128,r):null;case 19:return K(ai),null;case 4:return we(),null;case 10:return wn(r.type),null;case 22:case 23:return Hs(r),sm(),s!==null&&K(_o),s=r.flags,s&65536?(r.flags=s&-65537|128,r):null;case 24:return wn(hi),null;case 25:return null;default:return null}}function j0(s,r){switch($f(r),r.tag){case 3:wn(hi),we();break;case 26:case 27:case 5:Le(r);break;case 4:we();break;case 31:r.memoizedState!==null&&Hs(r);break;case 13:Hs(r);break;case 19:K(ai);break;case 10:wn(r.type);break;case 22:case 23:Hs(r),sm(),s!==null&&K(_o);break;case 24:wn(hi)}}function Dc(s,r){try{var o=r.updateQueue,c=o!==null?o.lastEffect:null;if(c!==null){var m=c.next;o=m;do{if((o.tag&s)===s){c=void 0;var _=o.create,b=o.inst;c=_(),b.destroy=c}o=o.next}while(o!==m)}}catch(k){xt(r,r.return,k)}}function ga(s,r,o){try{var c=r.updateQueue,m=c!==null?c.lastEffect:null;if(m!==null){var _=m.next;c=_;do{if((c.tag&s)===s){var b=c.inst,k=b.destroy;if(k!==void 0){b.destroy=void 0,m=r;var F=o,Z=k;try{Z()}catch(re){xt(m,F,re)}}}c=c.next}while(c!==_)}}catch(re){xt(r,r.return,re)}}function V0(s){var r=s.updateQueue;if(r!==null){var o=s.stateNode;try{Nv(r,o)}catch(c){xt(s,s.return,c)}}}function q0(s,r,o){o.props=yo(s.type,s.memoizedProps),o.state=s.memoizedState;try{o.componentWillUnmount()}catch(c){xt(s,r,c)}}function Oc(s,r){try{var o=s.ref;if(o!==null){switch(s.tag){case 26:case 27:case 5:var c=s.stateNode;break;case 30:c=s.stateNode;break;default:c=s.stateNode}typeof o=="function"?s.refCleanup=o(c):o.current=c}}catch(m){xt(s,r,m)}}function Xr(s,r){var o=s.ref,c=s.refCleanup;if(o!==null)if(typeof c=="function")try{c()}catch(m){xt(s,r,m)}finally{s.refCleanup=null,s=s.alternate,s!=null&&(s.refCleanup=null)}else if(typeof o=="function")try{o(null)}catch(m){xt(s,r,m)}else o.current=null}function Y0(s){var r=s.type,o=s.memoizedProps,c=s.stateNode;try{e:switch(r){case"button":case"input":case"select":case"textarea":o.autoFocus&&c.focus();break e;case"img":o.src?c.src=o.src:o.srcSet&&(c.srcset=o.srcSet)}}catch(m){xt(s,s.return,m)}}function Nm(s,r,o){try{var c=s.stateNode;U5(c,s.type,o,r),c[Ue]=r}catch(m){xt(s,s.return,m)}}function G0(s){return s.tag===5||s.tag===3||s.tag===26||s.tag===27&&xa(s.type)||s.tag===4}function Pm(s){e:for(;;){for(;s.sibling===null;){if(s.return===null||G0(s.return))return null;s=s.return}for(s.sibling.return=s.return,s=s.sibling;s.tag!==5&&s.tag!==6&&s.tag!==18;){if(s.tag===27&&xa(s.type)||s.flags&2||s.child===null||s.tag===4)continue e;s.child.return=s,s=s.child}if(!(s.flags&2))return s.stateNode}}function zm(s,r,o){var c=s.tag;if(c===5||c===6)s=s.stateNode,r?(o.nodeType===9?o.body:o.nodeName==="HTML"?o.ownerDocument.body:o).insertBefore(s,r):(r=o.nodeType===9?o.body:o.nodeName==="HTML"?o.ownerDocument.body:o,r.appendChild(s),o=o._reactRootContainer,o!=null||r.onclick!==null||(r.onclick=Ri));else if(c!==4&&(c===27&&xa(s.type)&&(o=s.stateNode,r=null),s=s.child,s!==null))for(zm(s,r,o),s=s.sibling;s!==null;)zm(s,r,o),s=s.sibling}function Ch(s,r,o){var c=s.tag;if(c===5||c===6)s=s.stateNode,r?o.insertBefore(s,r):o.appendChild(s);else if(c!==4&&(c===27&&xa(s.type)&&(o=s.stateNode),s=s.child,s!==null))for(Ch(s,r,o),s=s.sibling;s!==null;)Ch(s,r,o),s=s.sibling}function K0(s){var r=s.stateNode,o=s.memoizedProps;try{for(var c=s.type,m=r.attributes;m.length;)r.removeAttributeNode(m[0]);Ki(r,c,o),r[Re]=s,r[Ue]=o}catch(_){xt(s,s.return,_)}}var Tn=!1,mi=!1,Hm=!1,X0=typeof WeakSet=="function"?WeakSet:Set,Ai=null;function S5(s,r){if(s=s.containerInfo,n_=jh,s=lv(s),Lf(s)){if("selectionStart"in s)var o={start:s.selectionStart,end:s.selectionEnd};else e:{o=(o=s.ownerDocument)&&o.defaultView||window;var c=o.getSelection&&o.getSelection();if(c&&c.rangeCount!==0){o=c.anchorNode;var m=c.anchorOffset,_=c.focusNode;c=c.focusOffset;try{o.nodeType,_.nodeType}catch{o=null;break e}var b=0,k=-1,F=-1,Z=0,re=0,oe=s,ee=null;t:for(;;){for(var ie;oe!==o||m!==0&&oe.nodeType!==3||(k=b+m),oe!==_||c!==0&&oe.nodeType!==3||(F=b+c),oe.nodeType===3&&(b+=oe.nodeValue.length),(ie=oe.firstChild)!==null;)ee=oe,oe=ie;for(;;){if(oe===s)break t;if(ee===o&&++Z===m&&(k=b),ee===_&&++re===c&&(F=b),(ie=oe.nextSibling)!==null)break;oe=ee,ee=oe.parentNode}oe=ie}o=k===-1||F===-1?null:{start:k,end:F}}else o=null}o=o||{start:0,end:0}}else o=null;for(a_={focusedElem:s,selectionRange:o},jh=!1,Ai=r;Ai!==null;)if(r=Ai,s=r.child,(r.subtreeFlags&1028)!==0&&s!==null)s.return=r,Ai=s;else for(;Ai!==null;){switch(r=Ai,_=r.alternate,s=r.flags,r.tag){case 0:if((s&4)!==0&&(s=r.updateQueue,s=s!==null?s.events:null,s!==null))for(o=0;o<s.length;o++)m=s[o],m.ref.impl=m.nextImpl;break;case 11:case 15:break;case 1:if((s&1024)!==0&&_!==null){s=void 0,o=r,m=_.memoizedProps,_=_.memoizedState,c=o.stateNode;try{var Te=yo(o.type,m);s=c.getSnapshotBeforeUpdate(Te,_),c.__reactInternalSnapshotBeforeUpdate=s}catch(Fe){xt(o,o.return,Fe)}}break;case 3:if((s&1024)!==0){if(s=r.stateNode.containerInfo,o=s.nodeType,o===9)c_(s);else if(o===1)switch(s.nodeName){case"HEAD":case"HTML":case"BODY":c_(s);break;default:s.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((s&1024)!==0)throw Error(n(163))}if(s=r.sibling,s!==null){s.return=r.return,Ai=s;break}Ai=r.return}}function Z0(s,r,o){var c=o.flags;switch(o.tag){case 0:case 11:case 15:Mn(s,o),c&4&&Dc(5,o);break;case 1:if(Mn(s,o),c&4)if(s=o.stateNode,r===null)try{s.componentDidMount()}catch(b){xt(o,o.return,b)}else{var m=yo(o.type,r.memoizedProps);r=r.memoizedState;try{s.componentDidUpdate(m,r,s.__reactInternalSnapshotBeforeUpdate)}catch(b){xt(o,o.return,b)}}c&64&&V0(o),c&512&&Oc(o,o.return);break;case 3:if(Mn(s,o),c&64&&(s=o.updateQueue,s!==null)){if(r=null,o.child!==null)switch(o.child.tag){case 27:case 5:r=o.child.stateNode;break;case 1:r=o.child.stateNode}try{Nv(s,r)}catch(b){xt(o,o.return,b)}}break;case 27:r===null&&c&4&&K0(o);case 26:case 5:Mn(s,o),r===null&&c&4&&Y0(o),c&512&&Oc(o,o.return);break;case 12:Mn(s,o);break;case 31:Mn(s,o),c&4&&eS(s,o);break;case 13:Mn(s,o),c&4&&tS(s,o),c&64&&(s=o.memoizedState,s!==null&&(s=s.dehydrated,s!==null&&(o=R5.bind(null,o),G5(s,o))));break;case 22:if(c=o.memoizedState!==null||Tn,!c){r=r!==null&&r.memoizedState!==null||mi,m=Tn;var _=mi;Tn=c,(mi=r)&&!_?An(s,o,(o.subtreeFlags&8772)!==0):Mn(s,o),Tn=m,mi=_}break;case 30:break;default:Mn(s,o)}}function Q0(s){var r=s.alternate;r!==null&&(s.alternate=null,Q0(r)),s.child=null,s.deletions=null,s.sibling=null,s.tag===5&&(r=s.stateNode,r!==null&&Mr(r)),s.stateNode=null,s.return=null,s.dependencies=null,s.memoizedProps=null,s.memoizedState=null,s.pendingProps=null,s.stateNode=null,s.updateQueue=null}var Wt=null,vs=!1;function Rn(s,r,o){for(o=o.child;o!==null;)J0(s,r,o),o=o.sibling}function J0(s,r,o){if(ri&&typeof ri.onCommitFiberUnmount=="function")try{ri.onCommitFiberUnmount(Ks,o)}catch{}switch(o.tag){case 26:mi||Xr(o,r),Rn(s,r,o),o.memoizedState?o.memoizedState.count--:o.stateNode&&(o=o.stateNode,o.parentNode.removeChild(o));break;case 27:mi||Xr(o,r);var c=Wt,m=vs;xa(o.type)&&(Wt=o.stateNode,vs=!1),Rn(s,r,o),$c(o.stateNode),Wt=c,vs=m;break;case 5:mi||Xr(o,r);case 6:if(c=Wt,m=vs,Wt=null,Rn(s,r,o),Wt=c,vs=m,Wt!==null)if(vs)try{(Wt.nodeType===9?Wt.body:Wt.nodeName==="HTML"?Wt.ownerDocument.body:Wt).removeChild(o.stateNode)}catch(_){xt(o,r,_)}else try{Wt.removeChild(o.stateNode)}catch(_){xt(o,r,_)}break;case 18:Wt!==null&&(vs?(s=Wt,VS(s.nodeType===9?s.body:s.nodeName==="HTML"?s.ownerDocument.body:s,o.stateNode),Ml(s)):VS(Wt,o.stateNode));break;case 4:c=Wt,m=vs,Wt=o.stateNode.containerInfo,vs=!0,Rn(s,r,o),Wt=c,vs=m;break;case 0:case 11:case 14:case 15:ga(2,o,r),mi||ga(4,o,r),Rn(s,r,o);break;case 1:mi||(Xr(o,r),c=o.stateNode,typeof c.componentWillUnmount=="function"&&q0(o,r,c)),Rn(s,r,o);break;case 21:Rn(s,r,o);break;case 22:mi=(c=mi)||o.memoizedState!==null,Rn(s,r,o),mi=c;break;default:Rn(s,r,o)}}function eS(s,r){if(r.memoizedState===null&&(s=r.alternate,s!==null&&(s=s.memoizedState,s!==null))){s=s.dehydrated;try{Ml(s)}catch(o){xt(r,r.return,o)}}}function tS(s,r){if(r.memoizedState===null&&(s=r.alternate,s!==null&&(s=s.memoizedState,s!==null&&(s=s.dehydrated,s!==null))))try{Ml(s)}catch(o){xt(r,r.return,o)}}function y5(s){switch(s.tag){case 31:case 13:case 19:var r=s.stateNode;return r===null&&(r=s.stateNode=new X0),r;case 22:return s=s.stateNode,r=s._retryCache,r===null&&(r=s._retryCache=new X0),r;default:throw Error(n(435,s.tag))}}function xh(s,r){var o=y5(s);r.forEach(function(c){if(!o.has(c)){o.add(c);var m=M5.bind(null,s,c);c.then(m,m)}})}function Ss(s,r){var o=r.deletions;if(o!==null)for(var c=0;c<o.length;c++){var m=o[c],_=s,b=r,k=b;e:for(;k!==null;){switch(k.tag){case 27:if(xa(k.type)){Wt=k.stateNode,vs=!1;break e}break;case 5:Wt=k.stateNode,vs=!1;break e;case 3:case 4:Wt=k.stateNode.containerInfo,vs=!0;break e}k=k.return}if(Wt===null)throw Error(n(160));J0(_,b,m),Wt=null,vs=!1,_=m.alternate,_!==null&&(_.return=null),m.return=null}if(r.subtreeFlags&13886)for(r=r.child;r!==null;)iS(r,s),r=r.sibling}var Pr=null;function iS(s,r){var o=s.alternate,c=s.flags;switch(s.tag){case 0:case 11:case 14:case 15:Ss(r,s),ys(s),c&4&&(ga(3,s,s.return),Dc(3,s),ga(5,s,s.return));break;case 1:Ss(r,s),ys(s),c&512&&(mi||o===null||Xr(o,o.return)),c&64&&Tn&&(s=s.updateQueue,s!==null&&(c=s.callbacks,c!==null&&(o=s.shared.hiddenCallbacks,s.shared.hiddenCallbacks=o===null?c:o.concat(c))));break;case 26:var m=Pr;if(Ss(r,s),ys(s),c&512&&(mi||o===null||Xr(o,o.return)),c&4){var _=o!==null?o.memoizedState:null;if(c=s.memoizedState,o===null)if(c===null)if(s.stateNode===null){e:{c=s.type,o=s.memoizedProps,m=m.ownerDocument||m;t:switch(c){case"title":_=m.getElementsByTagName("title")[0],(!_||_[Ls]||_[Re]||_.namespaceURI==="http://www.w3.org/2000/svg"||_.hasAttribute("itemprop"))&&(_=m.createElement(c),m.head.insertBefore(_,m.querySelector("head > title"))),Ki(_,c,o),_[Re]=s,Ce(_),c=_;break e;case"link":var b=iy("link","href",m).get(c+(o.href||""));if(b){for(var k=0;k<b.length;k++)if(_=b[k],_.getAttribute("href")===(o.href==null||o.href===""?null:o.href)&&_.getAttribute("rel")===(o.rel==null?null:o.rel)&&_.getAttribute("title")===(o.title==null?null:o.title)&&_.getAttribute("crossorigin")===(o.crossOrigin==null?null:o.crossOrigin)){b.splice(k,1);break t}}_=m.createElement(c),Ki(_,c,o),m.head.appendChild(_);break;case"meta":if(b=iy("meta","content",m).get(c+(o.content||""))){for(k=0;k<b.length;k++)if(_=b[k],_.getAttribute("content")===(o.content==null?null:""+o.content)&&_.getAttribute("name")===(o.name==null?null:o.name)&&_.getAttribute("property")===(o.property==null?null:o.property)&&_.getAttribute("http-equiv")===(o.httpEquiv==null?null:o.httpEquiv)&&_.getAttribute("charset")===(o.charSet==null?null:o.charSet)){b.splice(k,1);break t}}_=m.createElement(c),Ki(_,c,o),m.head.appendChild(_);break;default:throw Error(n(468,c))}_[Re]=s,Ce(_),c=_}s.stateNode=c}else sy(m,s.type,s.stateNode);else s.stateNode=ty(m,c,s.memoizedProps);else _!==c?(_===null?o.stateNode!==null&&(o=o.stateNode,o.parentNode.removeChild(o)):_.count--,c===null?sy(m,s.type,s.stateNode):ty(m,c,s.memoizedProps)):c===null&&s.stateNode!==null&&Nm(s,s.memoizedProps,o.memoizedProps)}break;case 27:Ss(r,s),ys(s),c&512&&(mi||o===null||Xr(o,o.return)),o!==null&&c&4&&Nm(s,s.memoizedProps,o.memoizedProps);break;case 5:if(Ss(r,s),ys(s),c&512&&(mi||o===null||Xr(o,o.return)),s.flags&32){m=s.stateNode;try{ia(m,"")}catch(Te){xt(s,s.return,Te)}}c&4&&s.stateNode!=null&&(m=s.memoizedProps,Nm(s,m,o!==null?o.memoizedProps:m)),c&1024&&(Hm=!0);break;case 6:if(Ss(r,s),ys(s),c&4){if(s.stateNode===null)throw Error(n(162));c=s.memoizedProps,o=s.stateNode;try{o.nodeValue=c}catch(Te){xt(s,s.return,Te)}}break;case 3:if(Uh=null,m=Pr,Pr=Hh(r.containerInfo),Ss(r,s),Pr=m,ys(s),c&4&&o!==null&&o.memoizedState.isDehydrated)try{Ml(r.containerInfo)}catch(Te){xt(s,s.return,Te)}Hm&&(Hm=!1,sS(s));break;case 4:c=Pr,Pr=Hh(s.stateNode.containerInfo),Ss(r,s),ys(s),Pr=c;break;case 12:Ss(r,s),ys(s);break;case 31:Ss(r,s),ys(s),c&4&&(c=s.updateQueue,c!==null&&(s.updateQueue=null,xh(s,c)));break;case 13:Ss(r,s),ys(s),s.child.flags&8192&&s.memoizedState!==null!=(o!==null&&o.memoizedState!==null)&&(Eh=Xe()),c&4&&(c=s.updateQueue,c!==null&&(s.updateQueue=null,xh(s,c)));break;case 22:m=s.memoizedState!==null;var F=o!==null&&o.memoizedState!==null,Z=Tn,re=mi;if(Tn=Z||m,mi=re||F,Ss(r,s),mi=re,Tn=Z,ys(s),c&8192)e:for(r=s.stateNode,r._visibility=m?r._visibility&-2:r._visibility|1,m&&(o===null||F||Tn||mi||bo(s)),o=null,r=s;;){if(r.tag===5||r.tag===26){if(o===null){F=o=r;try{if(_=F.stateNode,m)b=_.style,typeof b.setProperty=="function"?b.setProperty("display","none","important"):b.display="none";else{k=F.stateNode;var oe=F.memoizedProps.style,ee=oe!=null&&oe.hasOwnProperty("display")?oe.display:null;k.style.display=ee==null||typeof ee=="boolean"?"":(""+ee).trim()}}catch(Te){xt(F,F.return,Te)}}}else if(r.tag===6){if(o===null){F=r;try{F.stateNode.nodeValue=m?"":F.memoizedProps}catch(Te){xt(F,F.return,Te)}}}else if(r.tag===18){if(o===null){F=r;try{var ie=F.stateNode;m?qS(ie,!0):qS(F.stateNode,!1)}catch(Te){xt(F,F.return,Te)}}}else if((r.tag!==22&&r.tag!==23||r.memoizedState===null||r===s)&&r.child!==null){r.child.return=r,r=r.child;continue}if(r===s)break e;for(;r.sibling===null;){if(r.return===null||r.return===s)break e;o===r&&(o=null),r=r.return}o===r&&(o=null),r.sibling.return=r.return,r=r.sibling}c&4&&(c=s.updateQueue,c!==null&&(o=c.retryQueue,o!==null&&(c.retryQueue=null,xh(s,o))));break;case 19:Ss(r,s),ys(s),c&4&&(c=s.updateQueue,c!==null&&(s.updateQueue=null,xh(s,c)));break;case 30:break;case 21:break;default:Ss(r,s),ys(s)}}function ys(s){var r=s.flags;if(r&2){try{for(var o,c=s.return;c!==null;){if(G0(c)){o=c;break}c=c.return}if(o==null)throw Error(n(160));switch(o.tag){case 27:var m=o.stateNode,_=Pm(s);Ch(s,_,m);break;case 5:var b=o.stateNode;o.flags&32&&(ia(b,""),o.flags&=-33);var k=Pm(s);Ch(s,k,b);break;case 3:case 4:var F=o.stateNode.containerInfo,Z=Pm(s);zm(s,Z,F);break;default:throw Error(n(161))}}catch(re){xt(s,s.return,re)}s.flags&=-3}r&4096&&(s.flags&=-4097)}function sS(s){if(s.subtreeFlags&1024)for(s=s.child;s!==null;){var r=s;sS(r),r.tag===5&&r.flags&1024&&r.stateNode.reset(),s=s.sibling}}function Mn(s,r){if(r.subtreeFlags&8772)for(r=r.child;r!==null;)Z0(s,r.alternate,r),r=r.sibling}function bo(s){for(s=s.child;s!==null;){var r=s;switch(r.tag){case 0:case 11:case 14:case 15:ga(4,r,r.return),bo(r);break;case 1:Xr(r,r.return);var o=r.stateNode;typeof o.componentWillUnmount=="function"&&q0(r,r.return,o),bo(r);break;case 27:$c(r.stateNode);case 26:case 5:Xr(r,r.return),bo(r);break;case 22:r.memoizedState===null&&bo(r);break;case 30:bo(r);break;default:bo(r)}s=s.sibling}}function An(s,r,o){for(o=o&&(r.subtreeFlags&8772)!==0,r=r.child;r!==null;){var c=r.alternate,m=s,_=r,b=_.flags;switch(_.tag){case 0:case 11:case 15:An(m,_,o),Dc(4,_);break;case 1:if(An(m,_,o),c=_,m=c.stateNode,typeof m.componentDidMount=="function")try{m.componentDidMount()}catch(Z){xt(c,c.return,Z)}if(c=_,m=c.updateQueue,m!==null){var k=c.stateNode;try{var F=m.shared.hiddenCallbacks;if(F!==null)for(m.shared.hiddenCallbacks=null,m=0;m<F.length;m++)Bv(F[m],k)}catch(Z){xt(c,c.return,Z)}}o&&b&64&&V0(_),Oc(_,_.return);break;case 27:K0(_);case 26:case 5:An(m,_,o),o&&c===null&&b&4&&Y0(_),Oc(_,_.return);break;case 12:An(m,_,o);break;case 31:An(m,_,o),o&&b&4&&eS(m,_);break;case 13:An(m,_,o),o&&b&4&&tS(m,_);break;case 22:_.memoizedState===null&&An(m,_,o),Oc(_,_.return);break;case 30:break;default:An(m,_,o)}r=r.sibling}}function Im(s,r){var o=null;s!==null&&s.memoizedState!==null&&s.memoizedState.cachePool!==null&&(o=s.memoizedState.cachePool.pool),s=null,r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(s=r.memoizedState.cachePool.pool),s!==o&&(s!=null&&s.refCount++,o!=null&&Sc(o))}function Um(s,r){s=null,r.alternate!==null&&(s=r.alternate.memoizedState.cache),r=r.memoizedState.cache,r!==s&&(r.refCount++,s!=null&&Sc(s))}function zr(s,r,o,c){if(r.subtreeFlags&10256)for(r=r.child;r!==null;)rS(s,r,o,c),r=r.sibling}function rS(s,r,o,c){var m=r.flags;switch(r.tag){case 0:case 11:case 15:zr(s,r,o,c),m&2048&&Dc(9,r);break;case 1:zr(s,r,o,c);break;case 3:zr(s,r,o,c),m&2048&&(s=null,r.alternate!==null&&(s=r.alternate.memoizedState.cache),r=r.memoizedState.cache,r!==s&&(r.refCount++,s!=null&&Sc(s)));break;case 12:if(m&2048){zr(s,r,o,c),s=r.stateNode;try{var _=r.memoizedProps,b=_.id,k=_.onPostCommit;typeof k=="function"&&k(b,r.alternate===null?"mount":"update",s.passiveEffectDuration,-0)}catch(F){xt(r,r.return,F)}}else zr(s,r,o,c);break;case 31:zr(s,r,o,c);break;case 13:zr(s,r,o,c);break;case 23:break;case 22:_=r.stateNode,b=r.alternate,r.memoizedState!==null?_._visibility&2?zr(s,r,o,c):Bc(s,r):_._visibility&2?zr(s,r,o,c):(_._visibility|=2,vl(s,r,o,c,(r.subtreeFlags&10256)!==0||!1)),m&2048&&Im(b,r);break;case 24:zr(s,r,o,c),m&2048&&Um(r.alternate,r);break;default:zr(s,r,o,c)}}function vl(s,r,o,c,m){for(m=m&&((r.subtreeFlags&10256)!==0||!1),r=r.child;r!==null;){var _=s,b=r,k=o,F=c,Z=b.flags;switch(b.tag){case 0:case 11:case 15:vl(_,b,k,F,m),Dc(8,b);break;case 23:break;case 22:var re=b.stateNode;b.memoizedState!==null?re._visibility&2?vl(_,b,k,F,m):Bc(_,b):(re._visibility|=2,vl(_,b,k,F,m)),m&&Z&2048&&Im(b.alternate,b);break;case 24:vl(_,b,k,F,m),m&&Z&2048&&Um(b.alternate,b);break;default:vl(_,b,k,F,m)}r=r.sibling}}function Bc(s,r){if(r.subtreeFlags&10256)for(r=r.child;r!==null;){var o=s,c=r,m=c.flags;switch(c.tag){case 22:Bc(o,c),m&2048&&Im(c.alternate,c);break;case 24:Bc(o,c),m&2048&&Um(c.alternate,c);break;default:Bc(o,c)}r=r.sibling}}var Nc=8192;function Sl(s,r,o){if(s.subtreeFlags&Nc)for(s=s.child;s!==null;)nS(s,r,o),s=s.sibling}function nS(s,r,o){switch(s.tag){case 26:Sl(s,r,o),s.flags&Nc&&s.memoizedState!==null&&a2(o,Pr,s.memoizedState,s.memoizedProps);break;case 5:Sl(s,r,o);break;case 3:case 4:var c=Pr;Pr=Hh(s.stateNode.containerInfo),Sl(s,r,o),Pr=c;break;case 22:s.memoizedState===null&&(c=s.alternate,c!==null&&c.memoizedState!==null?(c=Nc,Nc=16777216,Sl(s,r,o),Nc=c):Sl(s,r,o));break;default:Sl(s,r,o)}}function aS(s){var r=s.alternate;if(r!==null&&(s=r.child,s!==null)){r.child=null;do r=s.sibling,s.sibling=null,s=r;while(s!==null)}}function Pc(s){var r=s.deletions;if((s.flags&16)!==0){if(r!==null)for(var o=0;o<r.length;o++){var c=r[o];Ai=c,lS(c,s)}aS(s)}if(s.subtreeFlags&10256)for(s=s.child;s!==null;)oS(s),s=s.sibling}function oS(s){switch(s.tag){case 0:case 11:case 15:Pc(s),s.flags&2048&&ga(9,s,s.return);break;case 3:Pc(s);break;case 12:Pc(s);break;case 22:var r=s.stateNode;s.memoizedState!==null&&r._visibility&2&&(s.return===null||s.return.tag!==13)?(r._visibility&=-3,kh(s)):Pc(s);break;default:Pc(s)}}function kh(s){var r=s.deletions;if((s.flags&16)!==0){if(r!==null)for(var o=0;o<r.length;o++){var c=r[o];Ai=c,lS(c,s)}aS(s)}for(s=s.child;s!==null;){switch(r=s,r.tag){case 0:case 11:case 15:ga(8,r,r.return),kh(r);break;case 22:o=r.stateNode,o._visibility&2&&(o._visibility&=-3,kh(r));break;default:kh(r)}s=s.sibling}}function lS(s,r){for(;Ai!==null;){var o=Ai;switch(o.tag){case 0:case 11:case 15:ga(8,o,r);break;case 23:case 22:if(o.memoizedState!==null&&o.memoizedState.cachePool!==null){var c=o.memoizedState.cachePool.pool;c!=null&&c.refCount++}break;case 24:Sc(o.memoizedState.cache)}if(c=o.child,c!==null)c.return=o,Ai=c;else e:for(o=s;Ai!==null;){c=Ai;var m=c.sibling,_=c.return;if(Q0(c),c===o){Ai=null;break e}if(m!==null){m.return=_,Ai=m;break e}Ai=_}}}var b5={getCacheForType:function(s){var r=Yi(hi),o=r.data.get(s);return o===void 0&&(o=s(),r.data.set(s,o)),o},cacheSignal:function(){return Yi(hi).controller.signal}},w5=typeof WeakMap=="function"?WeakMap:Map,St=0,Ot=null,lt=null,ut=0,Ct=0,Is=null,va=!1,yl=!1,Fm=!1,Ln=0,Jt=0,Sa=0,wo=0,$m=0,Us=0,bl=0,zc=null,bs=null,Wm=!1,Eh=0,cS=0,Th=1/0,Rh=null,ya=null,bi=0,ba=null,wl=null,Dn=0,jm=0,Vm=null,uS=null,Hc=0,qm=null;function Fs(){return(St&2)!==0&&ut!==0?ut&-ut:E.T!==null?Qm():ft()}function hS(){if(Us===0)if((ut&536870912)===0||dt){var s=kt;kt<<=1,(kt&3932160)===0&&(kt=262144),Us=s}else Us=536870912;return s=zs.current,s!==null&&(s.flags|=32),Us}function ws(s,r,o){(s===Ot&&(Ct===2||Ct===9)||s.cancelPendingCommit!==null)&&(Cl(s,0),wa(s,ut,Us,!1)),Ft(s,o),((St&2)===0||s!==Ot)&&(s===Ot&&((St&2)===0&&(wo|=o),Jt===4&&wa(s,ut,Us,!1)),Zr(s))}function dS(s,r,o){if((St&6)!==0)throw Error(n(327));var c=!o&&(r&127)===0&&(r&s.expiredLanes)===0||Tr(s,r),m=c?k5(s,r):Gm(s,r,!0),_=c;do{if(m===0){yl&&!c&&wa(s,r,0,!1);break}else{if(o=s.current.alternate,_&&!C5(o)){m=Gm(s,r,!1),_=!1;continue}if(m===2){if(_=r,s.errorRecoveryDisabledLanes&_)var b=0;else b=s.pendingLanes&-536870913,b=b!==0?b:b&536870912?536870912:0;if(b!==0){r=b;e:{var k=s;m=zc;var F=k.current.memoizedState.isDehydrated;if(F&&(Cl(k,b).flags|=256),b=Gm(k,b,!1),b!==2){if(Fm&&!F){k.errorRecoveryDisabledLanes|=_,wo|=_,m=4;break e}_=bs,bs=m,_!==null&&(bs===null?bs=_:bs.push.apply(bs,_))}m=b}if(_=!1,m!==2)continue}}if(m===1){Cl(s,0),wa(s,r,0,!0);break}e:{switch(c=s,_=m,_){case 0:case 1:throw Error(n(345));case 4:if((r&4194048)!==r)break;case 6:wa(c,r,Us,!va);break e;case 2:bs=null;break;case 3:case 5:break;default:throw Error(n(329))}if((r&62914560)===r&&(m=Eh+300-Xe(),10<m)){if(wa(c,r,Us,!va),As(c,0,!0)!==0)break e;Dn=r,c.timeoutHandle=WS(fS.bind(null,c,o,bs,Rh,Wm,r,Us,wo,bl,va,_,"Throttled",-0,0),m);break e}fS(c,o,bs,Rh,Wm,r,Us,wo,bl,va,_,null,-0,0)}}break}while(!0);Zr(s)}function fS(s,r,o,c,m,_,b,k,F,Z,re,oe,ee,ie){if(s.timeoutHandle=-1,oe=r.subtreeFlags,oe&8192||(oe&16785408)===16785408){oe={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:Ri},nS(r,_,oe);var Te=(_&62914560)===_?Eh-Xe():(_&4194048)===_?cS-Xe():0;if(Te=o2(oe,Te),Te!==null){Dn=_,s.cancelPendingCommit=Te(bS.bind(null,s,r,_,o,c,m,b,k,F,re,oe,null,ee,ie)),wa(s,_,b,!Z);return}}bS(s,r,_,o,c,m,b,k,F)}function C5(s){for(var r=s;;){var o=r.tag;if((o===0||o===11||o===15)&&r.flags&16384&&(o=r.updateQueue,o!==null&&(o=o.stores,o!==null)))for(var c=0;c<o.length;c++){var m=o[c],_=m.getSnapshot;m=m.value;try{if(!yi(_(),m))return!1}catch{return!1}}if(o=r.child,r.subtreeFlags&16384&&o!==null)o.return=r,r=o;else{if(r===s)break;for(;r.sibling===null;){if(r.return===null||r.return===s)return!0;r=r.return}r.sibling.return=r.return,r=r.sibling}}return!0}function wa(s,r,o,c){r&=~$m,r&=~wo,s.suspendedLanes|=r,s.pingedLanes&=~r,c&&(s.warmLanes|=r),c=s.expirationTimes;for(var m=r;0<m;){var _=31-At(m),b=1<<_;c[_]=-1,m&=~b}o!==0&&Lt(s,o,r)}function Mh(){return(St&6)===0?(Ic(0),!1):!0}function Ym(){if(lt!==null){if(Ct===0)var s=lt.return;else s=lt,bn=fo=null,cm(s),fl=null,bc=0,s=lt;for(;s!==null;)j0(s.alternate,s),s=s.return;lt=null}}function Cl(s,r){var o=s.timeoutHandle;o!==-1&&(s.timeoutHandle=-1,W5(o)),o=s.cancelPendingCommit,o!==null&&(s.cancelPendingCommit=null,o()),Dn=0,Ym(),Ot=s,lt=o=Sn(s.current,null),ut=r,Ct=0,Is=null,va=!1,yl=Tr(s,r),Fm=!1,bl=Us=$m=wo=Sa=Jt=0,bs=zc=null,Wm=!1,(r&8)!==0&&(r|=r&32);var c=s.entangledLanes;if(c!==0)for(s=s.entanglements,c&=r;0<c;){var m=31-At(c),_=1<<m;r|=s[m],c&=~_}return Ln=r,Xu(),o}function mS(s,r){Je=null,E.H=Mc,r===dl||r===rh?(r=Av(),Ct=3):r===Zf?(r=Av(),Ct=4):Ct=r===km?8:r!==null&&typeof r=="object"&&typeof r.then=="function"?6:1,Is=r,lt===null&&(Jt=1,vh(s,ur(r,s.current)))}function _S(){var s=zs.current;return s===null?!0:(ut&4194048)===ut?mr===null:(ut&62914560)===ut||(ut&536870912)!==0?s===mr:!1}function pS(){var s=E.H;return E.H=Mc,s===null?Mc:s}function gS(){var s=E.A;return E.A=b5,s}function Ah(){Jt=4,va||(ut&4194048)!==ut&&zs.current!==null||(yl=!0),(Sa&134217727)===0&&(wo&134217727)===0||Ot===null||wa(Ot,ut,Us,!1)}function Gm(s,r,o){var c=St;St|=2;var m=pS(),_=gS();(Ot!==s||ut!==r)&&(Rh=null,Cl(s,r)),r=!1;var b=Jt;e:do try{if(Ct!==0&&lt!==null){var k=lt,F=Is;switch(Ct){case 8:Ym(),b=6;break e;case 3:case 2:case 9:case 6:zs.current===null&&(r=!0);var Z=Ct;if(Ct=0,Is=null,xl(s,k,F,Z),o&&yl){b=0;break e}break;default:Z=Ct,Ct=0,Is=null,xl(s,k,F,Z)}}x5(),b=Jt;break}catch(re){mS(s,re)}while(!0);return r&&s.shellSuspendCounter++,bn=fo=null,St=c,E.H=m,E.A=_,lt===null&&(Ot=null,ut=0,Xu()),b}function x5(){for(;lt!==null;)vS(lt)}function k5(s,r){var o=St;St|=2;var c=pS(),m=gS();Ot!==s||ut!==r?(Rh=null,Th=Xe()+500,Cl(s,r)):yl=Tr(s,r);e:do try{if(Ct!==0&&lt!==null){r=lt;var _=Is;t:switch(Ct){case 1:Ct=0,Is=null,xl(s,r,_,1);break;case 2:case 9:if(Rv(_)){Ct=0,Is=null,SS(r);break}r=function(){Ct!==2&&Ct!==9||Ot!==s||(Ct=7),Zr(s)},_.then(r,r);break e;case 3:Ct=7;break e;case 4:Ct=5;break e;case 7:Rv(_)?(Ct=0,Is=null,SS(r)):(Ct=0,Is=null,xl(s,r,_,7));break;case 5:var b=null;switch(lt.tag){case 26:b=lt.memoizedState;case 5:case 27:var k=lt;if(b?ry(b):k.stateNode.complete){Ct=0,Is=null;var F=k.sibling;if(F!==null)lt=F;else{var Z=k.return;Z!==null?(lt=Z,Lh(Z)):lt=null}break t}}Ct=0,Is=null,xl(s,r,_,5);break;case 6:Ct=0,Is=null,xl(s,r,_,6);break;case 8:Ym(),Jt=6;break e;default:throw Error(n(462))}}E5();break}catch(re){mS(s,re)}while(!0);return bn=fo=null,E.H=c,E.A=m,St=o,lt!==null?0:(Ot=null,ut=0,Xu(),Jt)}function E5(){for(;lt!==null&&!Ut();)vS(lt)}function vS(s){var r=$0(s.alternate,s,Ln);s.memoizedProps=s.pendingProps,r===null?Lh(s):lt=r}function SS(s){var r=s,o=r.alternate;switch(r.tag){case 15:case 0:r=P0(o,r,r.pendingProps,r.type,void 0,ut);break;case 11:r=P0(o,r,r.pendingProps,r.type.render,r.ref,ut);break;case 5:cm(r);default:j0(o,r),r=lt=gv(r,Ln),r=$0(o,r,Ln)}s.memoizedProps=s.pendingProps,r===null?Lh(s):lt=r}function xl(s,r,o,c){bn=fo=null,cm(r),fl=null,bc=0;var m=r.return;try{if(m5(s,m,r,o,ut)){Jt=1,vh(s,ur(o,s.current)),lt=null;return}}catch(_){if(m!==null)throw lt=m,_;Jt=1,vh(s,ur(o,s.current)),lt=null;return}r.flags&32768?(dt||c===1?s=!0:yl||(ut&536870912)!==0?s=!1:(va=s=!0,(c===2||c===9||c===3||c===6)&&(c=zs.current,c!==null&&c.tag===13&&(c.flags|=16384))),yS(r,s)):Lh(r)}function Lh(s){var r=s;do{if((r.flags&32768)!==0){yS(r,va);return}s=r.return;var o=g5(r.alternate,r,Ln);if(o!==null){lt=o;return}if(r=r.sibling,r!==null){lt=r;return}lt=r=s}while(r!==null);Jt===0&&(Jt=5)}function yS(s,r){do{var o=v5(s.alternate,s);if(o!==null){o.flags&=32767,lt=o;return}if(o=s.return,o!==null&&(o.flags|=32768,o.subtreeFlags=0,o.deletions=null),!r&&(s=s.sibling,s!==null)){lt=s;return}lt=s=o}while(s!==null);Jt=6,lt=null}function bS(s,r,o,c,m,_,b,k,F){s.cancelPendingCommit=null;do Dh();while(bi!==0);if((St&6)!==0)throw Error(n(327));if(r!==null){if(r===s.current)throw Error(n(177));if(_=r.lanes|r.childLanes,_|=Pf,He(s,o,_,b,k,F),s===Ot&&(lt=Ot=null,ut=0),wl=r,ba=s,Dn=o,jm=_,Vm=m,uS=c,(r.subtreeFlags&10256)!==0||(r.flags&10256)!==0?(s.callbackNode=null,s.callbackPriority=0,A5(Ms,function(){return ES(),null})):(s.callbackNode=null,s.callbackPriority=0),c=(r.flags&13878)!==0,(r.subtreeFlags&13878)!==0||c){c=E.T,E.T=null,m=M.p,M.p=2,b=St,St|=4;try{S5(s,r,o)}finally{St=b,M.p=m,E.T=c}}bi=1,wS(),CS(),xS()}}function wS(){if(bi===1){bi=0;var s=ba,r=wl,o=(r.flags&13878)!==0;if((r.subtreeFlags&13878)!==0||o){o=E.T,E.T=null;var c=M.p;M.p=2;var m=St;St|=4;try{iS(r,s);var _=a_,b=lv(s.containerInfo),k=_.focusedElem,F=_.selectionRange;if(b!==k&&k&&k.ownerDocument&&ov(k.ownerDocument.documentElement,k)){if(F!==null&&Lf(k)){var Z=F.start,re=F.end;if(re===void 0&&(re=Z),"selectionStart"in k)k.selectionStart=Z,k.selectionEnd=Math.min(re,k.value.length);else{var oe=k.ownerDocument||document,ee=oe&&oe.defaultView||window;if(ee.getSelection){var ie=ee.getSelection(),Te=k.textContent.length,Fe=Math.min(F.start,Te),Rt=F.end===void 0?Fe:Math.min(F.end,Te);!ie.extend&&Fe>Rt&&(b=Rt,Rt=Fe,Fe=b);var Y=ao(k,Fe),j=ao(k,Rt);if(Y&&j&&(ie.rangeCount!==1||ie.anchorNode!==Y.node||ie.anchorOffset!==Y.offset||ie.focusNode!==j.node||ie.focusOffset!==j.offset)){var X=oe.createRange();X.setStart(Y.node,Y.offset),ie.removeAllRanges(),Fe>Rt?(ie.addRange(X),ie.extend(j.node,j.offset)):(X.setEnd(j.node,j.offset),ie.addRange(X))}}}}for(oe=[],ie=k;ie=ie.parentNode;)ie.nodeType===1&&oe.push({element:ie,left:ie.scrollLeft,top:ie.scrollTop});for(typeof k.focus=="function"&&k.focus(),k=0;k<oe.length;k++){var ae=oe[k];ae.element.scrollLeft=ae.left,ae.element.scrollTop=ae.top}}jh=!!n_,a_=n_=null}finally{St=m,M.p=c,E.T=o}}s.current=r,bi=2}}function CS(){if(bi===2){bi=0;var s=ba,r=wl,o=(r.flags&8772)!==0;if((r.subtreeFlags&8772)!==0||o){o=E.T,E.T=null;var c=M.p;M.p=2;var m=St;St|=4;try{Z0(s,r.alternate,r)}finally{St=m,M.p=c,E.T=o}}bi=3}}function xS(){if(bi===4||bi===3){bi=0,Be();var s=ba,r=wl,o=Dn,c=uS;(r.subtreeFlags&10256)!==0||(r.flags&10256)!==0?bi=5:(bi=0,wl=ba=null,kS(s,s.pendingLanes));var m=s.pendingLanes;if(m===0&&(ya=null),be(o),r=r.stateNode,ri&&typeof ri.onCommitFiberRoot=="function")try{ri.onCommitFiberRoot(Ks,r,void 0,(r.current.flags&128)===128)}catch{}if(c!==null){r=E.T,m=M.p,M.p=2,E.T=null;try{for(var _=s.onRecoverableError,b=0;b<c.length;b++){var k=c[b];_(k.value,{componentStack:k.stack})}}finally{E.T=r,M.p=m}}(Dn&3)!==0&&Dh(),Zr(s),m=s.pendingLanes,(o&261930)!==0&&(m&42)!==0?s===qm?Hc++:(Hc=0,qm=s):Hc=0,Ic(0)}}function kS(s,r){(s.pooledCacheLanes&=r)===0&&(r=s.pooledCache,r!=null&&(s.pooledCache=null,Sc(r)))}function Dh(){return wS(),CS(),xS(),ES()}function ES(){if(bi!==5)return!1;var s=ba,r=jm;jm=0;var o=be(Dn),c=E.T,m=M.p;try{M.p=32>o?32:o,E.T=null,o=Vm,Vm=null;var _=ba,b=Dn;if(bi=0,wl=ba=null,Dn=0,(St&6)!==0)throw Error(n(331));var k=St;if(St|=4,oS(_.current),rS(_,_.current,b,o),St=k,Ic(0,!1),ri&&typeof ri.onPostCommitFiberRoot=="function")try{ri.onPostCommitFiberRoot(Ks,_)}catch{}return!0}finally{M.p=m,E.T=c,kS(s,r)}}function TS(s,r,o){r=ur(o,r),r=xm(s.stateNode,r,2),s=ma(s,r,2),s!==null&&(Ft(s,2),Zr(s))}function xt(s,r,o){if(s.tag===3)TS(s,s,o);else for(;r!==null;){if(r.tag===3){TS(r,s,o);break}else if(r.tag===1){var c=r.stateNode;if(typeof r.type.getDerivedStateFromError=="function"||typeof c.componentDidCatch=="function"&&(ya===null||!ya.has(c))){s=ur(o,s),o=R0(2),c=ma(r,o,2),c!==null&&(M0(o,c,r,s),Ft(c,2),Zr(c));break}}r=r.return}}function Km(s,r,o){var c=s.pingCache;if(c===null){c=s.pingCache=new w5;var m=new Set;c.set(r,m)}else m=c.get(r),m===void 0&&(m=new Set,c.set(r,m));m.has(o)||(Fm=!0,m.add(o),s=T5.bind(null,s,r,o),r.then(s,s))}function T5(s,r,o){var c=s.pingCache;c!==null&&c.delete(r),s.pingedLanes|=s.suspendedLanes&o,s.warmLanes&=~o,Ot===s&&(ut&o)===o&&(Jt===4||Jt===3&&(ut&62914560)===ut&&300>Xe()-Eh?(St&2)===0&&Cl(s,0):$m|=o,bl===ut&&(bl=0)),Zr(s)}function RS(s,r){r===0&&(r=es()),s=co(s,r),s!==null&&(Ft(s,r),Zr(s))}function R5(s){var r=s.memoizedState,o=0;r!==null&&(o=r.retryLane),RS(s,o)}function M5(s,r){var o=0;switch(s.tag){case 31:case 13:var c=s.stateNode,m=s.memoizedState;m!==null&&(o=m.retryLane);break;case 19:c=s.stateNode;break;case 22:c=s.stateNode._retryCache;break;default:throw Error(n(314))}c!==null&&c.delete(r),RS(s,o)}function A5(s,r){return ye(s,r)}var Oh=null,kl=null,Xm=!1,Bh=!1,Zm=!1,Ca=0;function Zr(s){s!==kl&&s.next===null&&(kl===null?Oh=kl=s:kl=kl.next=s),Bh=!0,Xm||(Xm=!0,D5())}function Ic(s,r){if(!Zm&&Bh){Zm=!0;do for(var o=!1,c=Oh;c!==null;){if(s!==0){var m=c.pendingLanes;if(m===0)var _=0;else{var b=c.suspendedLanes,k=c.pingedLanes;_=(1<<31-At(42|s)+1)-1,_&=m&~(b&~k),_=_&201326741?_&201326741|1:_?_|2:0}_!==0&&(o=!0,DS(c,_))}else _=ut,_=As(c,c===Ot?_:0,c.cancelPendingCommit!==null||c.timeoutHandle!==-1),(_&3)===0||Tr(c,_)||(o=!0,DS(c,_));c=c.next}while(o);Zm=!1}}function L5(){MS()}function MS(){Bh=Xm=!1;var s=0;Ca!==0&&$5()&&(s=Ca);for(var r=Xe(),o=null,c=Oh;c!==null;){var m=c.next,_=AS(c,r);_===0?(c.next=null,o===null?Oh=m:o.next=m,m===null&&(kl=o)):(o=c,(s!==0||(_&3)!==0)&&(Bh=!0)),c=m}bi!==0&&bi!==5||Ic(s),Ca!==0&&(Ca=0)}function AS(s,r){for(var o=s.suspendedLanes,c=s.pingedLanes,m=s.expirationTimes,_=s.pendingLanes&-62914561;0<_;){var b=31-At(_),k=1<<b,F=m[b];F===-1?((k&o)===0||(k&c)!==0)&&(m[b]=Qn(k,r)):F<=r&&(s.expiredLanes|=k),_&=~k}if(r=Ot,o=ut,o=As(s,s===r?o:0,s.cancelPendingCommit!==null||s.timeoutHandle!==-1),c=s.callbackNode,o===0||s===r&&(Ct===2||Ct===9)||s.cancelPendingCommit!==null)return c!==null&&c!==null&&me(c),s.callbackNode=null,s.callbackPriority=0;if((o&3)===0||Tr(s,o)){if(r=o&-o,r===s.callbackPriority)return r;switch(c!==null&&me(c),be(o)){case 2:case 8:o=qe;break;case 32:o=Ms;break;case 268435456:o=Xn;break;default:o=Ms}return c=LS.bind(null,s),o=ye(o,c),s.callbackPriority=r,s.callbackNode=o,r}return c!==null&&c!==null&&me(c),s.callbackPriority=2,s.callbackNode=null,2}function LS(s,r){if(bi!==0&&bi!==5)return s.callbackNode=null,s.callbackPriority=0,null;var o=s.callbackNode;if(Dh()&&s.callbackNode!==o)return null;var c=ut;return c=As(s,s===Ot?c:0,s.cancelPendingCommit!==null||s.timeoutHandle!==-1),c===0?null:(dS(s,c,r),AS(s,Xe()),s.callbackNode!=null&&s.callbackNode===o?LS.bind(null,s):null)}function DS(s,r){if(Dh())return null;dS(s,r,!0)}function D5(){j5(function(){(St&6)!==0?ye(_t,L5):MS()})}function Qm(){if(Ca===0){var s=ul;s===0&&(s=Zs,Zs<<=1,(Zs&261888)===0&&(Zs=256)),Ca=s}return Ca}function OS(s){return s==null||typeof s=="symbol"||typeof s=="boolean"?null:typeof s=="function"?s:Lr(""+s)}function BS(s,r){var o=r.ownerDocument.createElement("input");return o.name=r.name,o.value=r.value,s.id&&o.setAttribute("form",s.id),r.parentNode.insertBefore(o,r),s=new FormData(s),o.parentNode.removeChild(o),s}function O5(s,r,o,c,m){if(r==="submit"&&o&&o.stateNode===m){var _=OS((m[Ue]||null).action),b=c.submitter;b&&(r=(r=b[Ue]||null)?OS(r.formAction):b.getAttribute("formAction"),r!==null&&(_=r,b=null));var k=new Za("action","action",null,c,m);s.push({event:k,listeners:[{instance:null,listener:function(){if(c.defaultPrevented){if(Ca!==0){var F=b?BS(m,b):new FormData(m);vm(o,{pending:!0,data:F,method:m.method,action:_},null,F)}}else typeof _=="function"&&(k.preventDefault(),F=b?BS(m,b):new FormData(m),vm(o,{pending:!0,data:F,method:m.method,action:_},_,F))},currentTarget:m}]})}}for(var Jm=0;Jm<Nf.length;Jm++){var e_=Nf[Jm],B5=e_.toLowerCase(),N5=e_[0].toUpperCase()+e_.slice(1);Nr(B5,"on"+N5)}Nr(hv,"onAnimationEnd"),Nr(dv,"onAnimationIteration"),Nr(fv,"onAnimationStart"),Nr("dblclick","onDoubleClick"),Nr("focusin","onFocus"),Nr("focusout","onBlur"),Nr(Zx,"onTransitionRun"),Nr(Qx,"onTransitionStart"),Nr(Jx,"onTransitionCancel"),Nr(mv,"onTransitionEnd"),ir("onMouseEnter",["mouseout","mouseover"]),ir("onMouseLeave",["mouseout","mouseover"]),ir("onPointerEnter",["pointerout","pointerover"]),ir("onPointerLeave",["pointerout","pointerover"]),ps("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),ps("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),ps("onBeforeInput",["compositionend","keypress","textInput","paste"]),ps("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),ps("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),ps("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Uc="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(" "),P5=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(Uc));function NS(s,r){r=(r&4)!==0;for(var o=0;o<s.length;o++){var c=s[o],m=c.event;c=c.listeners;e:{var _=void 0;if(r)for(var b=c.length-1;0<=b;b--){var k=c[b],F=k.instance,Z=k.currentTarget;if(k=k.listener,F!==_&&m.isPropagationStopped())break e;_=k,m.currentTarget=Z;try{_(m)}catch(re){Ku(re)}m.currentTarget=null,_=F}else for(b=0;b<c.length;b++){if(k=c[b],F=k.instance,Z=k.currentTarget,k=k.listener,F!==_&&m.isPropagationStopped())break e;_=k,m.currentTarget=Z;try{_(m)}catch(re){Ku(re)}m.currentTarget=null,_=F}}}}function ct(s,r){var o=r[Bt];o===void 0&&(o=r[Bt]=new Set);var c=s+"__bubble";o.has(c)||(PS(r,s,2,!1),o.add(c))}function t_(s,r,o){var c=0;r&&(c|=4),PS(o,s,c,r)}var Nh="_reactListening"+Math.random().toString(36).slice(2);function i_(s){if(!s[Nh]){s[Nh]=!0,hn.forEach(function(o){o!=="selectionchange"&&(P5.has(o)||t_(o,!1,s),t_(o,!0,s))});var r=s.nodeType===9?s:s.ownerDocument;r===null||r[Nh]||(r[Nh]=!0,t_("selectionchange",!1,r))}}function PS(s,r,o,c){switch(hy(r)){case 2:var m=u2;break;case 8:m=h2;break;default:m=g_}o=m.bind(null,r,o,s),m=void 0,!Ko||r!=="touchstart"&&r!=="touchmove"&&r!=="wheel"||(m=!0),c?m!==void 0?s.addEventListener(r,o,{capture:!0,passive:m}):s.addEventListener(r,o,!0):m!==void 0?s.addEventListener(r,o,{passive:m}):s.addEventListener(r,o,!1)}function s_(s,r,o,c,m){var _=c;if((r&1)===0&&(r&2)===0&&c!==null)e:for(;;){if(c===null)return;var b=c.tag;if(b===3||b===4){var k=c.stateNode.containerInfo;if(k===m)break;if(b===4)for(b=c.return;b!==null;){var F=b.tag;if((F===3||F===4)&&b.stateNode.containerInfo===m)return;b=b.return}for(;k!==null;){if(b=ci(k),b===null)return;if(F=b.tag,F===5||F===6||F===26||F===27){c=_=b;continue e}k=k.parentNode}}c=c.return}nr(function(){var Z=_,re=jr(o),oe=[];e:{var ee=_v.get(s);if(ee!==void 0){var ie=Za,Te=s;switch(s){case"keypress":if(Xa(o)===0)break e;case"keydown":case"keyup":ie=ju;break;case"focusin":Te="focus",ie=eo;break;case"focusout":Te="blur",ie=eo;break;case"beforeblur":case"afterblur":ie=eo;break;case"click":if(o.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":ie=bt;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":ie=uc;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":ie=Rf;break;case hv:case dv:case fv:ie=na;break;case mv:ie=Mf;break;case"scroll":case"scrollend":ie=Cf;break;case"wheel":ie=J;break;case"copy":case"cut":case"paste":ie=dc;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":ie=io;break;case"toggle":case"beforetoggle":ie=fe}var Fe=(r&4)!==0,Rt=!Fe&&(s==="scroll"||s==="scrollend"),Y=Fe?ee!==null?ee+"Capture":null:ee;Fe=[];for(var j=Z,X;j!==null;){var ae=j;if(X=ae.stateNode,ae=ae.tag,ae!==5&&ae!==26&&ae!==27||X===null||Y===null||(ae=Os(j,Y),ae!=null&&Fe.push(Fc(j,ae,X))),Rt)break;j=j.return}0<Fe.length&&(ee=new ie(ee,Te,null,o,re),oe.push({event:ee,listeners:Fe}))}}if((r&7)===0){e:{if(ee=s==="mouseover"||s==="pointerover",ie=s==="mouseout"||s==="pointerout",ee&&o!==sa&&(Te=o.relatedTarget||o.fromElement)&&(ci(Te)||Te[$t]))break e;if((ie||ee)&&(ee=re.window===re?re:(ee=re.ownerDocument)?ee.defaultView||ee.parentWindow:window,ie?(Te=o.relatedTarget||o.toElement,ie=Z,Te=Te?ci(Te):null,Te!==null&&(Rt=l(Te),Fe=Te.tag,Te!==Rt||Fe!==5&&Fe!==27&&Fe!==6)&&(Te=null)):(ie=null,Te=Z),ie!==Te)){if(Fe=bt,ae="onMouseLeave",Y="onMouseEnter",j="mouse",(s==="pointerout"||s==="pointerover")&&(Fe=io,ae="onPointerLeave",Y="onPointerEnter",j="pointer"),Rt=ie==null?ee:ui(ie),X=Te==null?ee:ui(Te),ee=new Fe(ae,j+"leave",ie,o,re),ee.target=Rt,ee.relatedTarget=X,ae=null,ci(re)===Z&&(Fe=new Fe(Y,j+"enter",Te,o,re),Fe.target=X,Fe.relatedTarget=Rt,ae=Fe),Rt=ae,ie&&Te)t:{for(Fe=z5,Y=ie,j=Te,X=0,ae=Y;ae;ae=Fe(ae))X++;ae=0;for(var Ie=j;Ie;Ie=Fe(Ie))ae++;for(;0<X-ae;)Y=Fe(Y),X--;for(;0<ae-X;)j=Fe(j),ae--;for(;X--;){if(Y===j||j!==null&&Y===j.alternate){Fe=Y;break t}Y=Fe(Y),j=Fe(j)}Fe=null}else Fe=null;ie!==null&&zS(oe,ee,ie,Fe,!1),Te!==null&&Rt!==null&&zS(oe,Rt,Te,Fe,!0)}}e:{if(ee=Z?ui(Z):window,ie=ee.nodeName&&ee.nodeName.toLowerCase(),ie==="select"||ie==="input"&&ee.type==="file")var gt=Yu;else if(or(ee))if(so)gt=Ns;else{gt=wt;var Oe=Gu}else ie=ee.nodeName,!ie||ie.toLowerCase()!=="input"||ee.type!=="checkbox"&&ee.type!=="radio"?Z&&ac(Z.elementType)&&(gt=Yu):gt=gs;if(gt&&(gt=gt(s,Z))){qr(oe,gt,o,re);break e}Oe&&Oe(s,ee,Z),s==="focusout"&&Z&&ee.type==="number"&&Z.memoizedProps.value!=null&&ta(ee,"number",ee.value)}switch(Oe=Z?ui(Z):window,s){case"focusin":(or(Oe)||Oe.contentEditable==="true")&&(il=Oe,Df=Z,pc=null);break;case"focusout":pc=Df=il=null;break;case"mousedown":Of=!0;break;case"contextmenu":case"mouseup":case"dragend":Of=!1,cv(oe,o,re);break;case"selectionchange":if(Xx)break;case"keydown":case"keyup":cv(oe,o,re)}var tt;if(De)e:{switch(s){case"compositionstart":var ht="onCompositionStart";break e;case"compositionend":ht="onCompositionEnd";break e;case"compositionupdate":ht="onCompositionUpdate";break e}ht=void 0}else ls?Or(s,o)&&(ht="onCompositionEnd"):s==="keydown"&&o.keyCode===229&&(ht="onCompositionStart");ht&&(Xt&&o.locale!=="ko"&&(ls||ht!=="onCompositionStart"?ht==="onCompositionEnd"&&ls&&(tt=oc()):(Dr=re,Xo="value"in Dr?Dr.value:Dr.textContent,ls=!0)),Oe=Ph(Z,ht),0<Oe.length&&(ht=new Jo(ht,s,null,o,re),oe.push({event:ht,listeners:Oe}),tt?ht.data=tt:(tt=os(o),tt!==null&&(ht.data=tt)))),(tt=et?gn(s,o):Zt(s,o))&&(ht=Ph(Z,"onBeforeInput"),0<ht.length&&(Oe=new Jo("onBeforeInput","beforeinput",null,o,re),oe.push({event:Oe,listeners:ht}),Oe.data=tt)),O5(oe,s,Z,o,re)}NS(oe,r)})}function Fc(s,r,o){return{instance:s,listener:r,currentTarget:o}}function Ph(s,r){for(var o=r+"Capture",c=[];s!==null;){var m=s,_=m.stateNode;if(m=m.tag,m!==5&&m!==26&&m!==27||_===null||(m=Os(s,o),m!=null&&c.unshift(Fc(s,m,_)),m=Os(s,r),m!=null&&c.push(Fc(s,m,_))),s.tag===3)return c;s=s.return}return[]}function z5(s){if(s===null)return null;do s=s.return;while(s&&s.tag!==5&&s.tag!==27);return s||null}function zS(s,r,o,c,m){for(var _=r._reactName,b=[];o!==null&&o!==c;){var k=o,F=k.alternate,Z=k.stateNode;if(k=k.tag,F!==null&&F===c)break;k!==5&&k!==26&&k!==27||Z===null||(F=Z,m?(Z=Os(o,_),Z!=null&&b.unshift(Fc(o,Z,F))):m||(Z=Os(o,_),Z!=null&&b.push(Fc(o,Z,F)))),o=o.return}b.length!==0&&s.push({event:r,listeners:b})}var H5=/\r\n?/g,I5=/\u0000|\uFFFD/g;function HS(s){return(typeof s=="string"?s:""+s).replace(H5,`
9
+ `).replace(I5,"")}function IS(s,r){return r=HS(r),HS(s)===r}function Tt(s,r,o,c,m,_){switch(o){case"children":typeof c=="string"?r==="body"||r==="textarea"&&c===""||ia(s,c):(typeof c=="number"||typeof c=="bigint")&&r!=="body"&&ia(s,""+c);break;case"className":dn(s,"class",c);break;case"tabIndex":dn(s,"tabindex",c);break;case"dir":case"role":case"viewBox":case"width":case"height":dn(s,o,c);break;case"style":nc(s,c,_);break;case"data":if(r!=="object"){dn(s,"data",c);break}case"src":case"href":if(c===""&&(r!=="a"||o!=="href")){s.removeAttribute(o);break}if(c==null||typeof c=="function"||typeof c=="symbol"||typeof c=="boolean"){s.removeAttribute(o);break}c=Lr(""+c),s.setAttribute(o,c);break;case"action":case"formAction":if(typeof c=="function"){s.setAttribute(o,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof _=="function"&&(o==="formAction"?(r!=="input"&&Tt(s,r,"name",m.name,m,null),Tt(s,r,"formEncType",m.formEncType,m,null),Tt(s,r,"formMethod",m.formMethod,m,null),Tt(s,r,"formTarget",m.formTarget,m,null)):(Tt(s,r,"encType",m.encType,m,null),Tt(s,r,"method",m.method,m,null),Tt(s,r,"target",m.target,m,null)));if(c==null||typeof c=="symbol"||typeof c=="boolean"){s.removeAttribute(o);break}c=Lr(""+c),s.setAttribute(o,c);break;case"onClick":c!=null&&(s.onclick=Ri);break;case"onScroll":c!=null&&ct("scroll",s);break;case"onScrollEnd":c!=null&&ct("scrollend",s);break;case"dangerouslySetInnerHTML":if(c!=null){if(typeof c!="object"||!("__html"in c))throw Error(n(61));if(o=c.__html,o!=null){if(m.children!=null)throw Error(n(60));s.innerHTML=o}}break;case"multiple":s.multiple=c&&typeof c!="function"&&typeof c!="symbol";break;case"muted":s.muted=c&&typeof c!="function"&&typeof c!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(c==null||typeof c=="function"||typeof c=="boolean"||typeof c=="symbol"){s.removeAttribute("xlink:href");break}o=Lr(""+c),s.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",o);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":c!=null&&typeof c!="function"&&typeof c!="symbol"?s.setAttribute(o,""+c):s.removeAttribute(o);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":c&&typeof c!="function"&&typeof c!="symbol"?s.setAttribute(o,""):s.removeAttribute(o);break;case"capture":case"download":c===!0?s.setAttribute(o,""):c!==!1&&c!=null&&typeof c!="function"&&typeof c!="symbol"?s.setAttribute(o,c):s.removeAttribute(o);break;case"cols":case"rows":case"size":case"span":c!=null&&typeof c!="function"&&typeof c!="symbol"&&!isNaN(c)&&1<=c?s.setAttribute(o,c):s.removeAttribute(o);break;case"rowSpan":case"start":c==null||typeof c=="function"||typeof c=="symbol"||isNaN(c)?s.removeAttribute(o):s.setAttribute(o,c);break;case"popover":ct("beforetoggle",s),ct("toggle",s),Wr(s,"popover",c);break;case"xlinkActuate":sr(s,"http://www.w3.org/1999/xlink","xlink:actuate",c);break;case"xlinkArcrole":sr(s,"http://www.w3.org/1999/xlink","xlink:arcrole",c);break;case"xlinkRole":sr(s,"http://www.w3.org/1999/xlink","xlink:role",c);break;case"xlinkShow":sr(s,"http://www.w3.org/1999/xlink","xlink:show",c);break;case"xlinkTitle":sr(s,"http://www.w3.org/1999/xlink","xlink:title",c);break;case"xlinkType":sr(s,"http://www.w3.org/1999/xlink","xlink:type",c);break;case"xmlBase":sr(s,"http://www.w3.org/XML/1998/namespace","xml:base",c);break;case"xmlLang":sr(s,"http://www.w3.org/XML/1998/namespace","xml:lang",c);break;case"xmlSpace":sr(s,"http://www.w3.org/XML/1998/namespace","xml:space",c);break;case"is":Wr(s,"is",c);break;case"innerText":case"textContent":break;default:(!(2<o.length)||o[0]!=="o"&&o[0]!=="O"||o[1]!=="n"&&o[1]!=="N")&&(o=Fu.get(o)||o,Wr(s,o,c))}}function r_(s,r,o,c,m,_){switch(o){case"style":nc(s,c,_);break;case"dangerouslySetInnerHTML":if(c!=null){if(typeof c!="object"||!("__html"in c))throw Error(n(61));if(o=c.__html,o!=null){if(m.children!=null)throw Error(n(60));s.innerHTML=o}}break;case"children":typeof c=="string"?ia(s,c):(typeof c=="number"||typeof c=="bigint")&&ia(s,""+c);break;case"onScroll":c!=null&&ct("scroll",s);break;case"onScrollEnd":c!=null&&ct("scrollend",s);break;case"onClick":c!=null&&(s.onclick=Ri);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!Iu.hasOwnProperty(o))e:{if(o[0]==="o"&&o[1]==="n"&&(m=o.endsWith("Capture"),r=o.slice(2,m?o.length-7:void 0),_=s[Ue]||null,_=_!=null?_[o]:null,typeof _=="function"&&s.removeEventListener(r,_,m),typeof c=="function")){typeof _!="function"&&_!==null&&(o in s?s[o]=null:s.hasAttribute(o)&&s.removeAttribute(o)),s.addEventListener(r,c,m);break e}o in s?s[o]=c:c===!0?s.setAttribute(o,""):Wr(s,o,c)}}}function Ki(s,r,o){switch(r){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":ct("error",s),ct("load",s);var c=!1,m=!1,_;for(_ in o)if(o.hasOwnProperty(_)){var b=o[_];if(b!=null)switch(_){case"src":c=!0;break;case"srcSet":m=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(n(137,r));default:Tt(s,r,_,b,o,null)}}m&&Tt(s,r,"srcSet",o.srcSet,o,null),c&&Tt(s,r,"src",o.src,o,null);return;case"input":ct("invalid",s);var k=_=b=m=null,F=null,Z=null;for(c in o)if(o.hasOwnProperty(c)){var re=o[c];if(re!=null)switch(c){case"name":m=re;break;case"type":b=re;break;case"checked":F=re;break;case"defaultChecked":Z=re;break;case"value":_=re;break;case"defaultValue":k=re;break;case"children":case"dangerouslySetInnerHTML":if(re!=null)throw Error(n(137,r));break;default:Tt(s,r,c,re,o,null)}}Yo(s,_,k,F,Z,b,m,!1);return;case"select":ct("invalid",s),c=b=_=null;for(m in o)if(o.hasOwnProperty(m)&&(k=o[m],k!=null))switch(m){case"value":_=k;break;case"defaultValue":b=k;break;case"multiple":c=k;default:Tt(s,r,m,k,o,null)}r=_,o=b,s.multiple=!!c,r!=null?fn(s,!!c,r,!1):o!=null&&fn(s,!!c,o,!0);return;case"textarea":ct("invalid",s),_=m=c=null;for(b in o)if(o.hasOwnProperty(b)&&(k=o[b],k!=null))switch(b){case"value":c=k;break;case"defaultValue":m=k;break;case"children":_=k;break;case"dangerouslySetInnerHTML":if(k!=null)throw Error(n(91));break;default:Tt(s,r,b,k,o,null)}Ti(s,c,m,_);return;case"option":for(F in o)o.hasOwnProperty(F)&&(c=o[F],c!=null)&&(F==="selected"?s.selected=c&&typeof c!="function"&&typeof c!="symbol":Tt(s,r,F,c,o,null));return;case"dialog":ct("beforetoggle",s),ct("toggle",s),ct("cancel",s),ct("close",s);break;case"iframe":case"object":ct("load",s);break;case"video":case"audio":for(c=0;c<Uc.length;c++)ct(Uc[c],s);break;case"image":ct("error",s),ct("load",s);break;case"details":ct("toggle",s);break;case"embed":case"source":case"link":ct("error",s),ct("load",s);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(Z in o)if(o.hasOwnProperty(Z)&&(c=o[Z],c!=null))switch(Z){case"children":case"dangerouslySetInnerHTML":throw Error(n(137,r));default:Tt(s,r,Z,c,o,null)}return;default:if(ac(r)){for(re in o)o.hasOwnProperty(re)&&(c=o[re],c!==void 0&&r_(s,r,re,c,o,void 0));return}}for(k in o)o.hasOwnProperty(k)&&(c=o[k],c!=null&&Tt(s,r,k,c,o,null))}function U5(s,r,o,c){switch(r){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var m=null,_=null,b=null,k=null,F=null,Z=null,re=null;for(ie in o){var oe=o[ie];if(o.hasOwnProperty(ie)&&oe!=null)switch(ie){case"checked":break;case"value":break;case"defaultValue":F=oe;default:c.hasOwnProperty(ie)||Tt(s,r,ie,null,c,oe)}}for(var ee in c){var ie=c[ee];if(oe=o[ee],c.hasOwnProperty(ee)&&(ie!=null||oe!=null))switch(ee){case"type":_=ie;break;case"name":m=ie;break;case"checked":Z=ie;break;case"defaultChecked":re=ie;break;case"value":b=ie;break;case"defaultValue":k=ie;break;case"children":case"dangerouslySetInnerHTML":if(ie!=null)throw Error(n(137,r));break;default:ie!==oe&&Tt(s,r,ee,ie,c,oe)}}Vt(s,b,k,F,Z,re,_,m);return;case"select":ie=b=k=ee=null;for(_ in o)if(F=o[_],o.hasOwnProperty(_)&&F!=null)switch(_){case"value":break;case"multiple":ie=F;default:c.hasOwnProperty(_)||Tt(s,r,_,null,c,F)}for(m in c)if(_=c[m],F=o[m],c.hasOwnProperty(m)&&(_!=null||F!=null))switch(m){case"value":ee=_;break;case"defaultValue":k=_;break;case"multiple":b=_;default:_!==F&&Tt(s,r,m,_,c,F)}r=k,o=b,c=ie,ee!=null?fn(s,!!o,ee,!1):!!c!=!!o&&(r!=null?fn(s,!!o,r,!0):fn(s,!!o,o?[]:"",!1));return;case"textarea":ie=ee=null;for(k in o)if(m=o[k],o.hasOwnProperty(k)&&m!=null&&!c.hasOwnProperty(k))switch(k){case"value":break;case"children":break;default:Tt(s,r,k,null,c,m)}for(b in c)if(m=c[b],_=o[b],c.hasOwnProperty(b)&&(m!=null||_!=null))switch(b){case"value":ee=m;break;case"defaultValue":ie=m;break;case"children":break;case"dangerouslySetInnerHTML":if(m!=null)throw Error(n(91));break;default:m!==_&&Tt(s,r,b,m,c,_)}Go(s,ee,ie);return;case"option":for(var Te in o)ee=o[Te],o.hasOwnProperty(Te)&&ee!=null&&!c.hasOwnProperty(Te)&&(Te==="selected"?s.selected=!1:Tt(s,r,Te,null,c,ee));for(F in c)ee=c[F],ie=o[F],c.hasOwnProperty(F)&&ee!==ie&&(ee!=null||ie!=null)&&(F==="selected"?s.selected=ee&&typeof ee!="function"&&typeof ee!="symbol":Tt(s,r,F,ee,c,ie));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 Fe in o)ee=o[Fe],o.hasOwnProperty(Fe)&&ee!=null&&!c.hasOwnProperty(Fe)&&Tt(s,r,Fe,null,c,ee);for(Z in c)if(ee=c[Z],ie=o[Z],c.hasOwnProperty(Z)&&ee!==ie&&(ee!=null||ie!=null))switch(Z){case"children":case"dangerouslySetInnerHTML":if(ee!=null)throw Error(n(137,r));break;default:Tt(s,r,Z,ee,c,ie)}return;default:if(ac(r)){for(var Rt in o)ee=o[Rt],o.hasOwnProperty(Rt)&&ee!==void 0&&!c.hasOwnProperty(Rt)&&r_(s,r,Rt,void 0,c,ee);for(re in c)ee=c[re],ie=o[re],!c.hasOwnProperty(re)||ee===ie||ee===void 0&&ie===void 0||r_(s,r,re,ee,c,ie);return}}for(var Y in o)ee=o[Y],o.hasOwnProperty(Y)&&ee!=null&&!c.hasOwnProperty(Y)&&Tt(s,r,Y,null,c,ee);for(oe in c)ee=c[oe],ie=o[oe],!c.hasOwnProperty(oe)||ee===ie||ee==null&&ie==null||Tt(s,r,oe,ee,c,ie)}function US(s){switch(s){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function F5(){if(typeof performance.getEntriesByType=="function"){for(var s=0,r=0,o=performance.getEntriesByType("resource"),c=0;c<o.length;c++){var m=o[c],_=m.transferSize,b=m.initiatorType,k=m.duration;if(_&&k&&US(b)){for(b=0,k=m.responseEnd,c+=1;c<o.length;c++){var F=o[c],Z=F.startTime;if(Z>k)break;var re=F.transferSize,oe=F.initiatorType;re&&US(oe)&&(F=F.responseEnd,b+=re*(F<k?1:(k-Z)/(F-Z)))}if(--c,r+=8*(_+b)/(m.duration/1e3),s++,10<s)break}}if(0<s)return r/s/1e6}return navigator.connection&&(s=navigator.connection.downlink,typeof s=="number")?s:5}var n_=null,a_=null;function zh(s){return s.nodeType===9?s:s.ownerDocument}function FS(s){switch(s){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function $S(s,r){if(s===0)switch(r){case"svg":return 1;case"math":return 2;default:return 0}return s===1&&r==="foreignObject"?0:s}function o_(s,r){return s==="textarea"||s==="noscript"||typeof r.children=="string"||typeof r.children=="number"||typeof r.children=="bigint"||typeof r.dangerouslySetInnerHTML=="object"&&r.dangerouslySetInnerHTML!==null&&r.dangerouslySetInnerHTML.__html!=null}var l_=null;function $5(){var s=window.event;return s&&s.type==="popstate"?s===l_?!1:(l_=s,!0):(l_=null,!1)}var WS=typeof setTimeout=="function"?setTimeout:void 0,W5=typeof clearTimeout=="function"?clearTimeout:void 0,jS=typeof Promise=="function"?Promise:void 0,j5=typeof queueMicrotask=="function"?queueMicrotask:typeof jS<"u"?function(s){return jS.resolve(null).then(s).catch(V5)}:WS;function V5(s){setTimeout(function(){throw s})}function xa(s){return s==="head"}function VS(s,r){var o=r,c=0;do{var m=o.nextSibling;if(s.removeChild(o),m&&m.nodeType===8)if(o=m.data,o==="/$"||o==="/&"){if(c===0){s.removeChild(m),Ml(r);return}c--}else if(o==="$"||o==="$?"||o==="$~"||o==="$!"||o==="&")c++;else if(o==="html")$c(s.ownerDocument.documentElement);else if(o==="head"){o=s.ownerDocument.head,$c(o);for(var _=o.firstChild;_;){var b=_.nextSibling,k=_.nodeName;_[Ls]||k==="SCRIPT"||k==="STYLE"||k==="LINK"&&_.rel.toLowerCase()==="stylesheet"||o.removeChild(_),_=b}}else o==="body"&&$c(s.ownerDocument.body);o=m}while(o);Ml(r)}function qS(s,r){var o=s;s=0;do{var c=o.nextSibling;if(o.nodeType===1?r?(o._stashedDisplay=o.style.display,o.style.display="none"):(o.style.display=o._stashedDisplay||"",o.getAttribute("style")===""&&o.removeAttribute("style")):o.nodeType===3&&(r?(o._stashedText=o.nodeValue,o.nodeValue=""):o.nodeValue=o._stashedText||""),c&&c.nodeType===8)if(o=c.data,o==="/$"){if(s===0)break;s--}else o!=="$"&&o!=="$?"&&o!=="$~"&&o!=="$!"||s++;o=c}while(o)}function c_(s){var r=s.firstChild;for(r&&r.nodeType===10&&(r=r.nextSibling);r;){var o=r;switch(r=r.nextSibling,o.nodeName){case"HTML":case"HEAD":case"BODY":c_(o),Mr(o);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(o.rel.toLowerCase()==="stylesheet")continue}s.removeChild(o)}}function q5(s,r,o,c){for(;s.nodeType===1;){var m=o;if(s.nodeName.toLowerCase()!==r.toLowerCase()){if(!c&&(s.nodeName!=="INPUT"||s.type!=="hidden"))break}else if(c){if(!s[Ls])switch(r){case"meta":if(!s.hasAttribute("itemprop"))break;return s;case"link":if(_=s.getAttribute("rel"),_==="stylesheet"&&s.hasAttribute("data-precedence"))break;if(_!==m.rel||s.getAttribute("href")!==(m.href==null||m.href===""?null:m.href)||s.getAttribute("crossorigin")!==(m.crossOrigin==null?null:m.crossOrigin)||s.getAttribute("title")!==(m.title==null?null:m.title))break;return s;case"style":if(s.hasAttribute("data-precedence"))break;return s;case"script":if(_=s.getAttribute("src"),(_!==(m.src==null?null:m.src)||s.getAttribute("type")!==(m.type==null?null:m.type)||s.getAttribute("crossorigin")!==(m.crossOrigin==null?null:m.crossOrigin))&&_&&s.hasAttribute("async")&&!s.hasAttribute("itemprop"))break;return s;default:return s}}else if(r==="input"&&s.type==="hidden"){var _=m.name==null?null:""+m.name;if(m.type==="hidden"&&s.getAttribute("name")===_)return s}else return s;if(s=_r(s.nextSibling),s===null)break}return null}function Y5(s,r,o){if(r==="")return null;for(;s.nodeType!==3;)if((s.nodeType!==1||s.nodeName!=="INPUT"||s.type!=="hidden")&&!o||(s=_r(s.nextSibling),s===null))return null;return s}function YS(s,r){for(;s.nodeType!==8;)if((s.nodeType!==1||s.nodeName!=="INPUT"||s.type!=="hidden")&&!r||(s=_r(s.nextSibling),s===null))return null;return s}function u_(s){return s.data==="$?"||s.data==="$~"}function h_(s){return s.data==="$!"||s.data==="$?"&&s.ownerDocument.readyState!=="loading"}function G5(s,r){var o=s.ownerDocument;if(s.data==="$~")s._reactRetry=r;else if(s.data!=="$?"||o.readyState!=="loading")r();else{var c=function(){r(),o.removeEventListener("DOMContentLoaded",c)};o.addEventListener("DOMContentLoaded",c),s._reactRetry=c}}function _r(s){for(;s!=null;s=s.nextSibling){var r=s.nodeType;if(r===1||r===3)break;if(r===8){if(r=s.data,r==="$"||r==="$!"||r==="$?"||r==="$~"||r==="&"||r==="F!"||r==="F")break;if(r==="/$"||r==="/&")return null}}return s}var d_=null;function GS(s){s=s.nextSibling;for(var r=0;s;){if(s.nodeType===8){var o=s.data;if(o==="/$"||o==="/&"){if(r===0)return _r(s.nextSibling);r--}else o!=="$"&&o!=="$!"&&o!=="$?"&&o!=="$~"&&o!=="&"||r++}s=s.nextSibling}return null}function KS(s){s=s.previousSibling;for(var r=0;s;){if(s.nodeType===8){var o=s.data;if(o==="$"||o==="$!"||o==="$?"||o==="$~"||o==="&"){if(r===0)return s;r--}else o!=="/$"&&o!=="/&"||r++}s=s.previousSibling}return null}function XS(s,r,o){switch(r=zh(o),s){case"html":if(s=r.documentElement,!s)throw Error(n(452));return s;case"head":if(s=r.head,!s)throw Error(n(453));return s;case"body":if(s=r.body,!s)throw Error(n(454));return s;default:throw Error(n(451))}}function $c(s){for(var r=s.attributes;r.length;)s.removeAttributeNode(r[0]);Mr(s)}var pr=new Map,ZS=new Set;function Hh(s){return typeof s.getRootNode=="function"?s.getRootNode():s.nodeType===9?s:s.ownerDocument}var On=M.d;M.d={f:K5,r:X5,D:Z5,C:Q5,L:J5,m:e2,X:i2,S:t2,M:s2};function K5(){var s=On.f(),r=Mh();return s||r}function X5(s){var r=_s(s);r!==null&&r.tag===5&&r.type==="form"?m0(r):On.r(s)}var El=typeof document>"u"?null:document;function QS(s,r,o){var c=El;if(c&&typeof r=="string"&&r){var m=Vi(r);m='link[rel="'+s+'"][href="'+m+'"]',typeof o=="string"&&(m+='[crossorigin="'+o+'"]'),ZS.has(m)||(ZS.add(m),s={rel:s,crossOrigin:o,href:r},c.querySelector(m)===null&&(r=c.createElement("link"),Ki(r,"link",s),Ce(r),c.head.appendChild(r)))}}function Z5(s){On.D(s),QS("dns-prefetch",s,null)}function Q5(s,r){On.C(s,r),QS("preconnect",s,r)}function J5(s,r,o){On.L(s,r,o);var c=El;if(c&&s&&r){var m='link[rel="preload"][as="'+Vi(r)+'"]';r==="image"&&o&&o.imageSrcSet?(m+='[imagesrcset="'+Vi(o.imageSrcSet)+'"]',typeof o.imageSizes=="string"&&(m+='[imagesizes="'+Vi(o.imageSizes)+'"]')):m+='[href="'+Vi(s)+'"]';var _=m;switch(r){case"style":_=Tl(s);break;case"script":_=Rl(s)}pr.has(_)||(s=v({rel:"preload",href:r==="image"&&o&&o.imageSrcSet?void 0:s,as:r},o),pr.set(_,s),c.querySelector(m)!==null||r==="style"&&c.querySelector(Wc(_))||r==="script"&&c.querySelector(jc(_))||(r=c.createElement("link"),Ki(r,"link",s),Ce(r),c.head.appendChild(r)))}}function e2(s,r){On.m(s,r);var o=El;if(o&&s){var c=r&&typeof r.as=="string"?r.as:"script",m='link[rel="modulepreload"][as="'+Vi(c)+'"][href="'+Vi(s)+'"]',_=m;switch(c){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":_=Rl(s)}if(!pr.has(_)&&(s=v({rel:"modulepreload",href:s},r),pr.set(_,s),o.querySelector(m)===null)){switch(c){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(o.querySelector(jc(_)))return}c=o.createElement("link"),Ki(c,"link",s),Ce(c),o.head.appendChild(c)}}}function t2(s,r,o){On.S(s,r,o);var c=El;if(c&&s){var m=Ei(c).hoistableStyles,_=Tl(s);r=r||"default";var b=m.get(_);if(!b){var k={loading:0,preload:null};if(b=c.querySelector(Wc(_)))k.loading=5;else{s=v({rel:"stylesheet",href:s,"data-precedence":r},o),(o=pr.get(_))&&f_(s,o);var F=b=c.createElement("link");Ce(F),Ki(F,"link",s),F._p=new Promise(function(Z,re){F.onload=Z,F.onerror=re}),F.addEventListener("load",function(){k.loading|=1}),F.addEventListener("error",function(){k.loading|=2}),k.loading|=4,Ih(b,r,c)}b={type:"stylesheet",instance:b,count:1,state:k},m.set(_,b)}}}function i2(s,r){On.X(s,r);var o=El;if(o&&s){var c=Ei(o).hoistableScripts,m=Rl(s),_=c.get(m);_||(_=o.querySelector(jc(m)),_||(s=v({src:s,async:!0},r),(r=pr.get(m))&&m_(s,r),_=o.createElement("script"),Ce(_),Ki(_,"link",s),o.head.appendChild(_)),_={type:"script",instance:_,count:1,state:null},c.set(m,_))}}function s2(s,r){On.M(s,r);var o=El;if(o&&s){var c=Ei(o).hoistableScripts,m=Rl(s),_=c.get(m);_||(_=o.querySelector(jc(m)),_||(s=v({src:s,async:!0,type:"module"},r),(r=pr.get(m))&&m_(s,r),_=o.createElement("script"),Ce(_),Ki(_,"link",s),o.head.appendChild(_)),_={type:"script",instance:_,count:1,state:null},c.set(m,_))}}function JS(s,r,o,c){var m=(m=ue.current)?Hh(m):null;if(!m)throw Error(n(446));switch(s){case"meta":case"title":return null;case"style":return typeof o.precedence=="string"&&typeof o.href=="string"?(r=Tl(o.href),o=Ei(m).hoistableStyles,c=o.get(r),c||(c={type:"style",instance:null,count:0,state:null},o.set(r,c)),c):{type:"void",instance:null,count:0,state:null};case"link":if(o.rel==="stylesheet"&&typeof o.href=="string"&&typeof o.precedence=="string"){s=Tl(o.href);var _=Ei(m).hoistableStyles,b=_.get(s);if(b||(m=m.ownerDocument||m,b={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},_.set(s,b),(_=m.querySelector(Wc(s)))&&!_._p&&(b.instance=_,b.state.loading=5),pr.has(s)||(o={rel:"preload",as:"style",href:o.href,crossOrigin:o.crossOrigin,integrity:o.integrity,media:o.media,hrefLang:o.hrefLang,referrerPolicy:o.referrerPolicy},pr.set(s,o),_||r2(m,s,o,b.state))),r&&c===null)throw Error(n(528,""));return b}if(r&&c!==null)throw Error(n(529,""));return null;case"script":return r=o.async,o=o.src,typeof o=="string"&&r&&typeof r!="function"&&typeof r!="symbol"?(r=Rl(o),o=Ei(m).hoistableScripts,c=o.get(r),c||(c={type:"script",instance:null,count:0,state:null},o.set(r,c)),c):{type:"void",instance:null,count:0,state:null};default:throw Error(n(444,s))}}function Tl(s){return'href="'+Vi(s)+'"'}function Wc(s){return'link[rel="stylesheet"]['+s+"]"}function ey(s){return v({},s,{"data-precedence":s.precedence,precedence:null})}function r2(s,r,o,c){s.querySelector('link[rel="preload"][as="style"]['+r+"]")?c.loading=1:(r=s.createElement("link"),c.preload=r,r.addEventListener("load",function(){return c.loading|=1}),r.addEventListener("error",function(){return c.loading|=2}),Ki(r,"link",o),Ce(r),s.head.appendChild(r))}function Rl(s){return'[src="'+Vi(s)+'"]'}function jc(s){return"script[async]"+s}function ty(s,r,o){if(r.count++,r.instance===null)switch(r.type){case"style":var c=s.querySelector('style[data-href~="'+Vi(o.href)+'"]');if(c)return r.instance=c,Ce(c),c;var m=v({},o,{"data-href":o.href,"data-precedence":o.precedence,href:null,precedence:null});return c=(s.ownerDocument||s).createElement("style"),Ce(c),Ki(c,"style",m),Ih(c,o.precedence,s),r.instance=c;case"stylesheet":m=Tl(o.href);var _=s.querySelector(Wc(m));if(_)return r.state.loading|=4,r.instance=_,Ce(_),_;c=ey(o),(m=pr.get(m))&&f_(c,m),_=(s.ownerDocument||s).createElement("link"),Ce(_);var b=_;return b._p=new Promise(function(k,F){b.onload=k,b.onerror=F}),Ki(_,"link",c),r.state.loading|=4,Ih(_,o.precedence,s),r.instance=_;case"script":return _=Rl(o.src),(m=s.querySelector(jc(_)))?(r.instance=m,Ce(m),m):(c=o,(m=pr.get(_))&&(c=v({},o),m_(c,m)),s=s.ownerDocument||s,m=s.createElement("script"),Ce(m),Ki(m,"link",c),s.head.appendChild(m),r.instance=m);case"void":return null;default:throw Error(n(443,r.type))}else r.type==="stylesheet"&&(r.state.loading&4)===0&&(c=r.instance,r.state.loading|=4,Ih(c,o.precedence,s));return r.instance}function Ih(s,r,o){for(var c=o.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),m=c.length?c[c.length-1]:null,_=m,b=0;b<c.length;b++){var k=c[b];if(k.dataset.precedence===r)_=k;else if(_!==m)break}_?_.parentNode.insertBefore(s,_.nextSibling):(r=o.nodeType===9?o.head:o,r.insertBefore(s,r.firstChild))}function f_(s,r){s.crossOrigin==null&&(s.crossOrigin=r.crossOrigin),s.referrerPolicy==null&&(s.referrerPolicy=r.referrerPolicy),s.title==null&&(s.title=r.title)}function m_(s,r){s.crossOrigin==null&&(s.crossOrigin=r.crossOrigin),s.referrerPolicy==null&&(s.referrerPolicy=r.referrerPolicy),s.integrity==null&&(s.integrity=r.integrity)}var Uh=null;function iy(s,r,o){if(Uh===null){var c=new Map,m=Uh=new Map;m.set(o,c)}else m=Uh,c=m.get(o),c||(c=new Map,m.set(o,c));if(c.has(s))return c;for(c.set(s,null),o=o.getElementsByTagName(s),m=0;m<o.length;m++){var _=o[m];if(!(_[Ls]||_[Re]||s==="link"&&_.getAttribute("rel")==="stylesheet")&&_.namespaceURI!=="http://www.w3.org/2000/svg"){var b=_.getAttribute(r)||"";b=s+b;var k=c.get(b);k?k.push(_):c.set(b,[_])}}return c}function sy(s,r,o){s=s.ownerDocument||s,s.head.insertBefore(o,r==="title"?s.querySelector("head > title"):null)}function n2(s,r,o){if(o===1||r.itemProp!=null)return!1;switch(s){case"meta":case"title":return!0;case"style":if(typeof r.precedence!="string"||typeof r.href!="string"||r.href==="")break;return!0;case"link":if(typeof r.rel!="string"||typeof r.href!="string"||r.href===""||r.onLoad||r.onError)break;return r.rel==="stylesheet"?(s=r.disabled,typeof r.precedence=="string"&&s==null):!0;case"script":if(r.async&&typeof r.async!="function"&&typeof r.async!="symbol"&&!r.onLoad&&!r.onError&&r.src&&typeof r.src=="string")return!0}return!1}function ry(s){return!(s.type==="stylesheet"&&(s.state.loading&3)===0)}function a2(s,r,o,c){if(o.type==="stylesheet"&&(typeof c.media!="string"||matchMedia(c.media).matches!==!1)&&(o.state.loading&4)===0){if(o.instance===null){var m=Tl(c.href),_=r.querySelector(Wc(m));if(_){r=_._p,r!==null&&typeof r=="object"&&typeof r.then=="function"&&(s.count++,s=Fh.bind(s),r.then(s,s)),o.state.loading|=4,o.instance=_,Ce(_);return}_=r.ownerDocument||r,c=ey(c),(m=pr.get(m))&&f_(c,m),_=_.createElement("link"),Ce(_);var b=_;b._p=new Promise(function(k,F){b.onload=k,b.onerror=F}),Ki(_,"link",c),o.instance=_}s.stylesheets===null&&(s.stylesheets=new Map),s.stylesheets.set(o,r),(r=o.state.preload)&&(o.state.loading&3)===0&&(s.count++,o=Fh.bind(s),r.addEventListener("load",o),r.addEventListener("error",o))}}var __=0;function o2(s,r){return s.stylesheets&&s.count===0&&Wh(s,s.stylesheets),0<s.count||0<s.imgCount?function(o){var c=setTimeout(function(){if(s.stylesheets&&Wh(s,s.stylesheets),s.unsuspend){var _=s.unsuspend;s.unsuspend=null,_()}},6e4+r);0<s.imgBytes&&__===0&&(__=62500*F5());var m=setTimeout(function(){if(s.waitingForImages=!1,s.count===0&&(s.stylesheets&&Wh(s,s.stylesheets),s.unsuspend)){var _=s.unsuspend;s.unsuspend=null,_()}},(s.imgBytes>__?50:800)+r);return s.unsuspend=o,function(){s.unsuspend=null,clearTimeout(c),clearTimeout(m)}}:null}function Fh(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Wh(this,this.stylesheets);else if(this.unsuspend){var s=this.unsuspend;this.unsuspend=null,s()}}}var $h=null;function Wh(s,r){s.stylesheets=null,s.unsuspend!==null&&(s.count++,$h=new Map,r.forEach(l2,s),$h=null,Fh.call(s))}function l2(s,r){if(!(r.state.loading&4)){var o=$h.get(s);if(o)var c=o.get(null);else{o=new Map,$h.set(s,o);for(var m=s.querySelectorAll("link[data-precedence],style[data-precedence]"),_=0;_<m.length;_++){var b=m[_];(b.nodeName==="LINK"||b.getAttribute("media")!=="not all")&&(o.set(b.dataset.precedence,b),c=b)}c&&o.set(null,c)}m=r.instance,b=m.getAttribute("data-precedence"),_=o.get(b)||c,_===c&&o.set(null,m),o.set(b,m),this.count++,c=Fh.bind(this),m.addEventListener("load",c),m.addEventListener("error",c),_?_.parentNode.insertBefore(m,_.nextSibling):(s=s.nodeType===9?s.head:s,s.insertBefore(m,s.firstChild)),r.state.loading|=4}}var Vc={$$typeof:N,Provider:null,Consumer:null,_currentValue:z,_currentValue2:z,_threadCount:0};function c2(s,r,o,c,m,_,b,k,F){this.tag=1,this.containerInfo=s,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=Qs(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Qs(0),this.hiddenUpdates=Qs(null),this.identifierPrefix=c,this.onUncaughtError=m,this.onCaughtError=_,this.onRecoverableError=b,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=F,this.incompleteTransitions=new Map}function ny(s,r,o,c,m,_,b,k,F,Z,re,oe){return s=new c2(s,r,o,b,F,Z,re,oe,k),r=1,_===!0&&(r|=24),_=Ps(3,null,null,r),s.current=_,_.stateNode=s,r=Gf(),r.refCount++,s.pooledCache=r,r.refCount++,_.memoizedState={element:c,isDehydrated:o,cache:r},Qf(_),s}function ay(s){return s?(s=nl,s):nl}function oy(s,r,o,c,m,_){m=ay(m),c.context===null?c.context=m:c.pendingContext=m,c=fa(r),c.payload={element:o},_=_===void 0?null:_,_!==null&&(c.callback=_),o=ma(s,c,r),o!==null&&(ws(o,s,r),Cc(o,s,r))}function ly(s,r){if(s=s.memoizedState,s!==null&&s.dehydrated!==null){var o=s.retryLane;s.retryLane=o!==0&&o<r?o:r}}function p_(s,r){ly(s,r),(s=s.alternate)&&ly(s,r)}function cy(s){if(s.tag===13||s.tag===31){var r=co(s,67108864);r!==null&&ws(r,s,67108864),p_(s,67108864)}}function uy(s){if(s.tag===13||s.tag===31){var r=Fs();r=ji(r);var o=co(s,r);o!==null&&ws(o,s,r),p_(s,r)}}var jh=!0;function u2(s,r,o,c){var m=E.T;E.T=null;var _=M.p;try{M.p=2,g_(s,r,o,c)}finally{M.p=_,E.T=m}}function h2(s,r,o,c){var m=E.T;E.T=null;var _=M.p;try{M.p=8,g_(s,r,o,c)}finally{M.p=_,E.T=m}}function g_(s,r,o,c){if(jh){var m=v_(c);if(m===null)s_(s,r,c,Vh,o),dy(s,c);else if(f2(m,s,r,o,c))c.stopPropagation();else if(dy(s,c),r&4&&-1<d2.indexOf(s)){for(;m!==null;){var _=_s(m);if(_!==null)switch(_.tag){case 3:if(_=_.stateNode,_.current.memoizedState.isDehydrated){var b=Wi(_.pendingLanes);if(b!==0){var k=_;for(k.pendingLanes|=2,k.entangledLanes|=2;b;){var F=1<<31-At(b);k.entanglements[1]|=F,b&=~F}Zr(_),(St&6)===0&&(Th=Xe()+500,Ic(0))}}break;case 31:case 13:k=co(_,2),k!==null&&ws(k,_,2),Mh(),p_(_,2)}if(_=v_(c),_===null&&s_(s,r,c,Vh,o),_===m)break;m=_}m!==null&&c.stopPropagation()}else s_(s,r,c,null,o)}}function v_(s){return s=jr(s),S_(s)}var Vh=null;function S_(s){if(Vh=null,s=ci(s),s!==null){var r=l(s);if(r===null)s=null;else{var o=r.tag;if(o===13){if(s=u(r),s!==null)return s;s=null}else if(o===31){if(s=h(r),s!==null)return s;s=null}else if(o===3){if(r.stateNode.current.memoizedState.isDehydrated)return r.tag===3?r.stateNode.containerInfo:null;s=null}else r!==s&&(s=null)}}return Vh=s,null}function hy(s){switch(s){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(je()){case _t:return 2;case qe:return 8;case Ms:case ns:return 32;case Xn:return 268435456;default:return 32}default:return 32}}var y_=!1,ka=null,Ea=null,Ta=null,qc=new Map,Yc=new Map,Ra=[],d2="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 dy(s,r){switch(s){case"focusin":case"focusout":ka=null;break;case"dragenter":case"dragleave":Ea=null;break;case"mouseover":case"mouseout":Ta=null;break;case"pointerover":case"pointerout":qc.delete(r.pointerId);break;case"gotpointercapture":case"lostpointercapture":Yc.delete(r.pointerId)}}function Gc(s,r,o,c,m,_){return s===null||s.nativeEvent!==_?(s={blockedOn:r,domEventName:o,eventSystemFlags:c,nativeEvent:_,targetContainers:[m]},r!==null&&(r=_s(r),r!==null&&cy(r)),s):(s.eventSystemFlags|=c,r=s.targetContainers,m!==null&&r.indexOf(m)===-1&&r.push(m),s)}function f2(s,r,o,c,m){switch(r){case"focusin":return ka=Gc(ka,s,r,o,c,m),!0;case"dragenter":return Ea=Gc(Ea,s,r,o,c,m),!0;case"mouseover":return Ta=Gc(Ta,s,r,o,c,m),!0;case"pointerover":var _=m.pointerId;return qc.set(_,Gc(qc.get(_)||null,s,r,o,c,m)),!0;case"gotpointercapture":return _=m.pointerId,Yc.set(_,Gc(Yc.get(_)||null,s,r,o,c,m)),!0}return!1}function fy(s){var r=ci(s.target);if(r!==null){var o=l(r);if(o!==null){if(r=o.tag,r===13){if(r=u(o),r!==null){s.blockedOn=r,Qe(s.priority,function(){uy(o)});return}}else if(r===31){if(r=h(o),r!==null){s.blockedOn=r,Qe(s.priority,function(){uy(o)});return}}else if(r===3&&o.stateNode.current.memoizedState.isDehydrated){s.blockedOn=o.tag===3?o.stateNode.containerInfo:null;return}}}s.blockedOn=null}function qh(s){if(s.blockedOn!==null)return!1;for(var r=s.targetContainers;0<r.length;){var o=v_(s.nativeEvent);if(o===null){o=s.nativeEvent;var c=new o.constructor(o.type,o);sa=c,o.target.dispatchEvent(c),sa=null}else return r=_s(o),r!==null&&cy(r),s.blockedOn=o,!1;r.shift()}return!0}function my(s,r,o){qh(s)&&o.delete(r)}function m2(){y_=!1,ka!==null&&qh(ka)&&(ka=null),Ea!==null&&qh(Ea)&&(Ea=null),Ta!==null&&qh(Ta)&&(Ta=null),qc.forEach(my),Yc.forEach(my)}function Yh(s,r){s.blockedOn===r&&(s.blockedOn=null,y_||(y_=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,m2)))}var Gh=null;function _y(s){Gh!==s&&(Gh=s,t.unstable_scheduleCallback(t.unstable_NormalPriority,function(){Gh===s&&(Gh=null);for(var r=0;r<s.length;r+=3){var o=s[r],c=s[r+1],m=s[r+2];if(typeof c!="function"){if(S_(c||o)===null)continue;break}var _=_s(o);_!==null&&(s.splice(r,3),r-=3,vm(_,{pending:!0,data:m,method:o.method,action:c},c,m))}}))}function Ml(s){function r(F){return Yh(F,s)}ka!==null&&Yh(ka,s),Ea!==null&&Yh(Ea,s),Ta!==null&&Yh(Ta,s),qc.forEach(r),Yc.forEach(r);for(var o=0;o<Ra.length;o++){var c=Ra[o];c.blockedOn===s&&(c.blockedOn=null)}for(;0<Ra.length&&(o=Ra[0],o.blockedOn===null);)fy(o),o.blockedOn===null&&Ra.shift();if(o=(s.ownerDocument||s).$$reactFormReplay,o!=null)for(c=0;c<o.length;c+=3){var m=o[c],_=o[c+1],b=m[Ue]||null;if(typeof _=="function")b||_y(o);else if(b){var k=null;if(_&&_.hasAttribute("formAction")){if(m=_,b=_[Ue]||null)k=b.formAction;else if(S_(m)!==null)continue}else k=b.action;typeof k=="function"?o[c+1]=k:(o.splice(c,3),c-=3),_y(o)}}}function py(){function s(_){_.canIntercept&&_.info==="react-transition"&&_.intercept({handler:function(){return new Promise(function(b){return m=b})},focusReset:"manual",scroll:"manual"})}function r(){m!==null&&(m(),m=null),c||setTimeout(o,20)}function o(){if(!c&&!navigation.transition){var _=navigation.currentEntry;_&&_.url!=null&&navigation.navigate(_.url,{state:_.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var c=!1,m=null;return navigation.addEventListener("navigate",s),navigation.addEventListener("navigatesuccess",r),navigation.addEventListener("navigateerror",r),setTimeout(o,100),function(){c=!0,navigation.removeEventListener("navigate",s),navigation.removeEventListener("navigatesuccess",r),navigation.removeEventListener("navigateerror",r),m!==null&&(m(),m=null)}}}function b_(s){this._internalRoot=s}Kh.prototype.render=b_.prototype.render=function(s){var r=this._internalRoot;if(r===null)throw Error(n(409));var o=r.current,c=Fs();oy(o,c,s,r,null,null)},Kh.prototype.unmount=b_.prototype.unmount=function(){var s=this._internalRoot;if(s!==null){this._internalRoot=null;var r=s.containerInfo;oy(s.current,2,null,s,null,null),Mh(),r[$t]=null}};function Kh(s){this._internalRoot=s}Kh.prototype.unstable_scheduleHydration=function(s){if(s){var r=ft();s={blockedOn:null,target:s,priority:r};for(var o=0;o<Ra.length&&r!==0&&r<Ra[o].priority;o++);Ra.splice(o,0,s),o===0&&fy(s)}};var gy=e.version;if(gy!=="19.2.3")throw Error(n(527,gy,"19.2.3"));M.findDOMNode=function(s){var r=s._reactInternals;if(r===void 0)throw typeof s.render=="function"?Error(n(188)):(s=Object.keys(s).join(","),Error(n(268,s)));return s=d(r),s=s!==null?g(s):null,s=s===null?null:s.stateNode,s};var _2={bundleType:0,version:"19.2.3",rendererPackageName:"react-dom",currentDispatcherRef:E,reconcilerVersion:"19.2.3"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Xh=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Xh.isDisabled&&Xh.supportsFiber)try{Ks=Xh.inject(_2),ri=Xh}catch{}}return Xc.createRoot=function(s,r){if(!a(s))throw Error(n(299));var o=!1,c="",m=x0,_=k0,b=E0;return r!=null&&(r.unstable_strictMode===!0&&(o=!0),r.identifierPrefix!==void 0&&(c=r.identifierPrefix),r.onUncaughtError!==void 0&&(m=r.onUncaughtError),r.onCaughtError!==void 0&&(_=r.onCaughtError),r.onRecoverableError!==void 0&&(b=r.onRecoverableError)),r=ny(s,1,!1,null,null,o,c,null,m,_,b,py),s[$t]=r.current,i_(s),new b_(r)},Xc.hydrateRoot=function(s,r,o){if(!a(s))throw Error(n(299));var c=!1,m="",_=x0,b=k0,k=E0,F=null;return o!=null&&(o.unstable_strictMode===!0&&(c=!0),o.identifierPrefix!==void 0&&(m=o.identifierPrefix),o.onUncaughtError!==void 0&&(_=o.onUncaughtError),o.onCaughtError!==void 0&&(b=o.onCaughtError),o.onRecoverableError!==void 0&&(k=o.onRecoverableError),o.formState!==void 0&&(F=o.formState)),r=ny(s,1,!0,r,o??null,c,m,F,_,b,k,py),r.context=ay(null),o=r.current,c=Fs(),c=ji(c),m=fa(c),m.callback=null,ma(o,m,c),o=c,r.current.lanes=o,Ft(r,o),Zr(r),s[$t]=r.current,i_(s),new Kh(r)},Xc.version="19.2.3",Xc}var Ty;function k2(){if(Ty)return C_.exports;Ty=1;function t(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(t)}catch(e){console.error(e)}}return t(),C_.exports=x2(),C_.exports}var E2=k2();const Cp=new WeakMap,T2=new WeakMap,Bd={current:[]};let R_=!1,bu=0;const mu=new Set,Zh=new Map;function J1(t){for(const e of t){if(Bd.current.includes(e))continue;Bd.current.push(e),e.recompute();const i=T2.get(e);if(i)for(const n of i){const a=Cp.get(n);a?.length&&J1(a)}}}function R2(t){const e={prevVal:t.prevState,currentVal:t.state};for(const i of t.listeners)i(e)}function M2(t){const e={prevVal:t.prevState,currentVal:t.state};for(const i of t.listeners)i(e)}function ew(t){if(bu>0&&!Zh.has(t)&&Zh.set(t,t.prevState),mu.add(t),!(bu>0)&&!R_)try{for(R_=!0;mu.size>0;){const e=Array.from(mu);mu.clear();for(const i of e){const n=Zh.get(i)??i.prevState;i.prevState=n,R2(i)}for(const i of e){const n=Cp.get(i);n&&(Bd.current.push(i),J1(n))}for(const i of e){const n=Cp.get(i);if(n)for(const a of n)M2(a)}}}finally{R_=!1,Bd.current=[],Zh.clear()}}function wu(t){bu++;try{t()}finally{if(bu--,bu===0){const e=mu.values().next().value;e&&ew(e)}}}function A2(t){return typeof t=="function"}class L2{constructor(e,i){this.listeners=new Set,this.subscribe=n=>{var a,l;this.listeners.add(n);const u=(l=(a=this.options)==null?void 0:a.onSubscribe)==null?void 0:l.call(a,n,this);return()=>{this.listeners.delete(n),u?.()}},this.prevState=e,this.state=e,this.options=i}setState(e){var i,n,a;this.prevState=this.state,(i=this.options)!=null&&i.updateFn?this.state=this.options.updateFn(this.prevState)(e):A2(e)?this.state=e(this.prevState):this.state=e,(a=(n=this.options)==null?void 0:n.onUpdate)==null||a.call(n),ew(this)}}const ja="__TSR_index",Ry="popstate",My="beforeunload";function D2(t){let e=t.getLocation();const i=new Set,n=(u,h)=>{e=t.getLocation(),i.forEach(f=>f({location:e,action:u,navigateOpts:h}))},a=u=>{t.notifyOnIndexChange??!0?n(u):e=t.getLocation()},l=async({task:u,navigateOpts:h,...f})=>{if(h?.ignoreBlocker??!1)return u(),{type:"SUCCESS"};const g=t.getBlockers?.()??[],v=f.type==="PUSH"||f.type==="REPLACE";if(typeof document<"u"&&g.length&&v)for(const p of g){const S=Nd(f.path,f.state);if(await p.blockerFn({currentLocation:e,nextLocation:S,action:f.type}))return t.onBlocked?.(),{type:"BLOCKED"}}return u(),{type:"SUCCESS"}};return{get location(){return e},get length(){return t.getLength()},subscribers:i,subscribe:u=>(i.add(u),()=>{i.delete(u)}),push:(u,h,f)=>{const d=e.state[ja];return h=Ay(d+1,h),l({task:()=>{t.pushState(u,h),n({type:"PUSH"},f)},navigateOpts:f,type:"PUSH",path:u,state:h})},replace:(u,h,f)=>{const d=e.state[ja];return h=Ay(d,h),l({task:()=>{t.replaceState(u,h),n({type:"REPLACE"},f)},navigateOpts:f,type:"REPLACE",path:u,state:h})},go:(u,h)=>{l({task:()=>{t.go(u),a({type:"GO",index:u})},navigateOpts:h,type:"GO"})},back:u=>{l({task:()=>{t.back(u?.ignoreBlocker??!1),a({type:"BACK"})},navigateOpts:u,type:"BACK"})},forward:u=>{l({task:()=>{t.forward(u?.ignoreBlocker??!1),a({type:"FORWARD"})},navigateOpts:u,type:"FORWARD"})},canGoBack:()=>e.state[ja]!==0,createHref:u=>t.createHref(u),block:u=>{if(!t.setBlockers)return()=>{};const h=t.getBlockers?.()??[];return t.setBlockers([...h,u]),()=>{const f=t.getBlockers?.()??[];t.setBlockers?.(f.filter(d=>d!==u))}},flush:()=>t.flush?.(),destroy:()=>t.destroy?.(),notify:n}}function Ay(t,e){e||(e={});const i=Rg();return{...e,key:i,__TSR_key:i,[ja]:t}}function O2(t){const e=typeof document<"u"?window:void 0,i=e.history.pushState,n=e.history.replaceState;let a=[];const l=()=>a,u=H=>a=H,h=(H=>H),f=(()=>Nd(`${e.location.pathname}${e.location.search}${e.location.hash}`,e.history.state));if(!e.history.state?.__TSR_key&&!e.history.state?.key){const H=Rg();e.history.replaceState({[ja]:0,key:H,__TSR_key:H},"")}let d=f(),g,v=!1,p=!1,S=!1,y=!1;const C=()=>d;let x,R;const L=()=>{x&&(I._ignoreSubscribers=!0,(x.isPush?e.history.pushState:e.history.replaceState)(x.state,"",x.href),I._ignoreSubscribers=!1,x=void 0,R=void 0,g=void 0)},N=(H,V,se)=>{const Q=h(V);R||(g=d),d=Nd(V,se),x={href:Q,state:se,isPush:x?.isPush||H==="push"},R||(R=Promise.resolve().then(()=>L()))},T=H=>{d=f(),I.notify({type:H})},W=async()=>{if(p){p=!1;return}const H=f(),V=H.state[ja]-d.state[ja],se=V===1,Q=V===-1,A=!se&&!Q||v;v=!1;const O=A?"GO":Q?"BACK":"FORWARD",P=A?{type:"GO",index:V}:{type:Q?"BACK":"FORWARD"};if(S)S=!1;else{const $=l();if(typeof document<"u"&&$.length){for(const E of $)if(await E.blockerFn({currentLocation:d,nextLocation:H,action:O})){p=!0,e.history.go(1),I.notify(P);return}}}d=f(),I.notify(P)},D=H=>{if(y){y=!1;return}let V=!1;const se=l();if(typeof document<"u"&&se.length)for(const Q of se){const A=Q.enableBeforeUnload??!0;if(A===!0){V=!0;break}if(typeof A=="function"&&A()===!0){V=!0;break}}if(V)return H.preventDefault(),H.returnValue=""},I=D2({getLocation:C,getLength:()=>e.history.length,pushState:(H,V)=>N("push",H,V),replaceState:(H,V)=>N("replace",H,V),back:H=>(H&&(S=!0),y=!0,e.history.back()),forward:H=>{H&&(S=!0),y=!0,e.history.forward()},go:H=>{v=!0,e.history.go(H)},createHref:H=>h(H),flush:L,destroy:()=>{e.history.pushState=i,e.history.replaceState=n,e.removeEventListener(My,D,{capture:!0}),e.removeEventListener(Ry,W)},onBlocked:()=>{g&&d!==g&&(d=g)},getBlockers:l,setBlockers:u,notifyOnIndexChange:!1});return e.addEventListener(My,D,{capture:!0}),e.addEventListener(Ry,W),e.history.pushState=function(...H){const V=i.apply(e.history,H);return I._ignoreSubscribers||T("PUSH"),V},e.history.replaceState=function(...H){const V=n.apply(e.history,H);return I._ignoreSubscribers||T("REPLACE"),V},I}function B2(t){let e=t.replace(/[\x00-\x1f\x7f]/g,"");return e.startsWith("//")&&(e="/"+e.replace(/^\/+/,"")),e}function Nd(t,e){const i=B2(t),n=i.indexOf("#"),a=i.indexOf("?"),l=Rg();return{href:i,pathname:i.substring(0,n>0?a>0?Math.min(n,a):n:a>0?a:i.length),hash:n>-1?i.substring(n):"",search:a>-1?i.slice(a,n===-1?void 0:n):"",state:e||{[ja]:0,key:l,__TSR_key:l}}}function Rg(){return(Math.random()+1).toString(36).substring(7)}function Pd(t){return t[t.length-1]}function N2(t){return typeof t=="function"}function Ua(t,e){return N2(t)?t(e):t}const P2=Object.prototype.hasOwnProperty;function br(t,e,i=0){if(t===e)return t;if(i>500)return e;const n=e,a=Oy(t)&&Oy(n);if(!a&&!(zd(t)&&zd(n)))return n;const l=a?t:Ly(t);if(!l)return n;const u=a?n:Ly(n);if(!u)return n;const h=l.length,f=u.length,d=a?new Array(f):{};let g=0;for(let v=0;v<f;v++){const p=a?v:u[v],S=t[p],y=n[p];if(S===y){d[p]=S,(a?v<h:P2.call(t,p))&&g++;continue}if(S===null||y===null||typeof S!="object"||typeof y!="object"){d[p]=y;continue}const C=br(S,y,i+1);d[p]=C,C===S&&g++}return h===f&&g===h?t:d}function Ly(t){const e=[],i=Object.getOwnPropertyNames(t);for(const a of i){if(!Object.prototype.propertyIsEnumerable.call(t,a))return!1;e.push(a)}const n=Object.getOwnPropertySymbols(t);for(const a of n){if(!Object.prototype.propertyIsEnumerable.call(t,a))return!1;e.push(a)}return e}function zd(t){if(!Dy(t))return!1;const e=t.constructor;if(typeof e>"u")return!0;const i=e.prototype;return!(!Dy(i)||!i.hasOwnProperty("isPrototypeOf"))}function Dy(t){return Object.prototype.toString.call(t)==="[object Object]"}function Oy(t){return Array.isArray(t)&&t.length===Object.keys(t).length}function Do(t,e,i){if(t===e)return!0;if(typeof t!=typeof e)return!1;if(Array.isArray(t)&&Array.isArray(e)){if(t.length!==e.length)return!1;for(let n=0,a=t.length;n<a;n++)if(!Do(t[n],e[n],i))return!1;return!0}if(zd(t)&&zd(e)){const n=i?.ignoreUndefined??!0;if(i?.partial){for(const u in e)if((!n||e[u]!==void 0)&&!Do(t[u],e[u],i))return!1;return!0}let a=0;if(!n)a=Object.keys(t).length;else for(const u in t)t[u]!==void 0&&a++;let l=0;for(const u in e)if((!n||e[u]!==void 0)&&(l++,l>a||!Do(t[u],e[u],i)))return!1;return a===l}return!1}function ql(t){let e,i;const n=new Promise((a,l)=>{e=a,i=l});return n.status="pending",n.resolve=a=>{n.status="resolved",n.value=a,e(a),t?.(a)},n.reject=a=>{n.status="rejected",i(a)},n}function Va(t){return!!(t&&typeof t=="object"&&typeof t.then=="function")}function z2(t){return t.replace(/[\x00-\x1f\x7f]/g,"")}function By(t){let e;try{e=decodeURI(t)}catch{e=t.replaceAll(/%[0-9A-F]{2}/gi,i=>{try{return decodeURI(i)}catch{return i}})}return z2(e)}const tw=["http:","https:","mailto:","tel:"];function Hd(t){if(!t)return!1;try{const e=new URL(t);return!tw.includes(e.protocol)}catch{return!1}}const H2={"&":"\\u0026",">":"\\u003e","<":"\\u003c","\u2028":"\\u2028","\u2029":"\\u2029"},I2=/[&><\u2028\u2029]/g;function U2(t){return t.replace(I2,e=>H2[e])}function Ny(t,e){if(!t)return t;const i=/%25|%5C/gi;let n=0,a="",l;for(;(l=i.exec(t))!==null;)a+=By(t.slice(n,l.index))+l[0],n=i.lastIndex;return a=a+By(n?t.slice(n):t),a.startsWith("//")&&(a="/"+a.replace(/^\/+/,"")),a}var F2="Invariant failed";function Yn(t,e){if(!t)throw new Error(F2)}function Id(t){const e=new Map;let i,n;const a=l=>{l.next&&(l.prev?(l.prev.next=l.next,l.next.prev=l.prev,l.next=void 0,n&&(n.next=l,l.prev=n)):(l.next.prev=void 0,i=l.next,l.next=void 0,n&&(l.prev=n,n.next=l)),n=l)};return{get(l){const u=e.get(l);if(u)return a(u),u.value},set(l,u){if(e.size>=t&&i){const f=i;e.delete(f.key),f.next&&(i=f.next,f.next.prev=void 0),f===n&&(n=void 0)}const h=e.get(l);if(h)h.value=u,a(h);else{const f={key:l,value:u,prev:n};n&&(n.next=f),n=f,i||(i=f),e.set(l,f)}},clear(){e.clear(),i=void 0,n=void 0}}}const Yl=0,Ho=1,Io=2,Tu=3,zl=4,$2=5,W2=/^([^{]*)\{\$([a-zA-Z_$][a-zA-Z0-9_$]*)\}([^}]*)$/,j2=/^([^{]*)\{-\$([a-zA-Z_$][a-zA-Z0-9_$]*)\}([^}]*)$/,V2=/^([^{]*)\{\$\}([^}]*)$/;function Mg(t,e,i=new Uint16Array(6)){const n=t.indexOf("/",e),a=n===-1?t.length:n,l=t.substring(e,a);if(!l||!l.includes("$"))return i[0]=Yl,i[1]=e,i[2]=e,i[3]=a,i[4]=a,i[5]=a,i;if(l==="$"){const d=t.length;return i[0]=Io,i[1]=e,i[2]=e,i[3]=d,i[4]=d,i[5]=d,i}if(l.charCodeAt(0)===36)return i[0]=Ho,i[1]=e,i[2]=e+1,i[3]=a,i[4]=a,i[5]=a,i;const u=l.match(V2);if(u){const g=u[1].length;return i[0]=Io,i[1]=e+g,i[2]=e+g+1,i[3]=e+g+2,i[4]=e+g+3,i[5]=t.length,i}const h=l.match(j2);if(h){const d=h[1],g=h[2],v=h[3],p=d.length;return i[0]=Tu,i[1]=e+p,i[2]=e+p+3,i[3]=e+p+3+g.length,i[4]=a-v.length,i[5]=a,i}const f=l.match(W2);if(f){const d=f[1],g=f[2],v=f[3],p=d.length;return i[0]=Ho,i[1]=e+p,i[2]=e+p+2,i[3]=e+p+2+g.length,i[4]=a-v.length,i[5]=a,i}return i[0]=Yl,i[1]=e,i[2]=e,i[3]=a,i[4]=a,i[5]=a,i}function rf(t,e,i,n,a,l,u){u?.(i);let h=n;{const f=i.fullPath??i.from,d=f.length,g=i.options?.caseSensitive??t,v=!!(i.options?.params?.parse&&i.options?.skipRouteOnParseError?.params);for(;h<d;){const S=Mg(f,h,e);let y;const C=h,x=S[5];switch(h=x+1,l++,S[0]){case Yl:{const L=f.substring(S[2],S[3]);if(g){const N=a.static?.get(L);if(N)y=N;else{a.static??=new Map;const T=Ro(i.fullPath??i.from);T.parent=a,T.depth=l,y=T,a.static.set(L,T)}}else{const N=L.toLowerCase(),T=a.staticInsensitive?.get(N);if(T)y=T;else{a.staticInsensitive??=new Map;const W=Ro(i.fullPath??i.from);W.parent=a,W.depth=l,y=W,a.staticInsensitive.set(N,W)}}break}case Ho:{const L=f.substring(C,S[1]),N=f.substring(S[4],x),T=g&&!!(L||N),W=L?T?L:L.toLowerCase():void 0,D=N?T?N:N.toLowerCase():void 0,I=!v&&a.dynamic?.find(H=>!H.skipOnParamError&&H.caseSensitive===T&&H.prefix===W&&H.suffix===D);if(I)y=I;else{const H=A_(Ho,i.fullPath??i.from,T,W,D);y=H,H.depth=l,H.parent=a,a.dynamic??=[],a.dynamic.push(H)}break}case Tu:{const L=f.substring(C,S[1]),N=f.substring(S[4],x),T=g&&!!(L||N),W=L?T?L:L.toLowerCase():void 0,D=N?T?N:N.toLowerCase():void 0,I=!v&&a.optional?.find(H=>!H.skipOnParamError&&H.caseSensitive===T&&H.prefix===W&&H.suffix===D);if(I)y=I;else{const H=A_(Tu,i.fullPath??i.from,T,W,D);y=H,H.parent=a,H.depth=l,a.optional??=[],a.optional.push(H)}break}case Io:{const L=f.substring(C,S[1]),N=f.substring(S[4],x),T=g&&!!(L||N),W=L?T?L:L.toLowerCase():void 0,D=N?T?N:N.toLowerCase():void 0,I=A_(Io,i.fullPath??i.from,T,W,D);y=I,I.parent=a,I.depth=l,a.wildcard??=[],a.wildcard.push(I)}}a=y}if(v&&i.children&&!i.isRoot&&i.id&&i.id.charCodeAt(i.id.lastIndexOf("/")+1)===95){const S=Ro(i.fullPath??i.from);S.kind=$2,S.parent=a,l++,S.depth=l,a.pathless??=[],a.pathless.push(S),a=S}const p=(i.path||!i.children)&&!i.isRoot;if(p&&f.endsWith("/")){const S=Ro(i.fullPath??i.from);S.kind=zl,S.parent=a,l++,S.depth=l,a.index=S,a=S}a.parse=i.options?.params?.parse??null,a.skipOnParamError=v,a.parsingPriority=i.options?.skipRouteOnParseError?.priority??0,p&&!a.route&&(a.route=i,a.fullPath=i.fullPath??i.from)}if(i.children)for(const f of i.children)rf(t,e,f,h,a,l,u)}function M_(t,e){if(t.skipOnParamError&&!e.skipOnParamError)return-1;if(!t.skipOnParamError&&e.skipOnParamError)return 1;if(t.skipOnParamError&&e.skipOnParamError&&(t.parsingPriority||e.parsingPriority))return e.parsingPriority-t.parsingPriority;if(t.prefix&&e.prefix&&t.prefix!==e.prefix){if(t.prefix.startsWith(e.prefix))return-1;if(e.prefix.startsWith(t.prefix))return 1}if(t.suffix&&e.suffix&&t.suffix!==e.suffix){if(t.suffix.endsWith(e.suffix))return-1;if(e.suffix.endsWith(t.suffix))return 1}return t.prefix&&!e.prefix?-1:!t.prefix&&e.prefix?1:t.suffix&&!e.suffix?-1:!t.suffix&&e.suffix?1:t.caseSensitive&&!e.caseSensitive?-1:!t.caseSensitive&&e.caseSensitive?1:0}function Ha(t){if(t.pathless)for(const e of t.pathless)Ha(e);if(t.static)for(const e of t.static.values())Ha(e);if(t.staticInsensitive)for(const e of t.staticInsensitive.values())Ha(e);if(t.dynamic?.length){t.dynamic.sort(M_);for(const e of t.dynamic)Ha(e)}if(t.optional?.length){t.optional.sort(M_);for(const e of t.optional)Ha(e)}if(t.wildcard?.length){t.wildcard.sort(M_);for(const e of t.wildcard)Ha(e)}}function Ro(t){return{kind:Yl,depth:0,pathless:null,index:null,static:null,staticInsensitive:null,dynamic:null,optional:null,wildcard:null,route:null,fullPath:t,parent:null,parse:null,skipOnParamError:!1,parsingPriority:0}}function A_(t,e,i,n,a){return{kind:t,depth:0,pathless:null,index:null,static:null,staticInsensitive:null,dynamic:null,optional:null,wildcard:null,route:null,fullPath:e,parent:null,parse:null,skipOnParamError:!1,parsingPriority:0,caseSensitive:i,prefix:n,suffix:a}}function q2(t,e){const i=Ro("/"),n=new Uint16Array(6);for(const a of t)rf(!1,n,a,1,i,0);Ha(i),e.masksTree=i,e.flatCache=Id(1e3)}function Y2(t,e){t||="/";const i=e.flatCache.get(t);if(i)return i;const n=Ag(t,e.masksTree);return e.flatCache.set(t,n),n}function G2(t,e,i,n,a){t||="/",n||="/";const l=e?`case\0${t}`:t;let u=a.singleCache.get(l);if(!u){u=Ro("/");const h=new Uint16Array(6);rf(e,h,{from:t},1,u,0),a.singleCache.set(l,u)}return Ag(n,u,i)}function K2(t,e,i=!1){const n=i?t:`nofuzz\0${t}`,a=e.matchCache.get(n);if(a!==void 0)return a;t||="/";let l;try{l=Ag(t,e.segmentTree,i)}catch(u){if(u instanceof URIError)l=null;else throw u}return l&&(l.branch=Q2(l.route)),e.matchCache.set(n,l),l}function X2(t){return t==="/"?t:t.replace(/\/{1,}$/,"")}function Z2(t,e=!1,i){const n=Ro(t.fullPath),a=new Uint16Array(6),l={},u={};let h=0;return rf(e,a,t,1,n,0,d=>{if(i?.(d,h),Yn(!(d.id in l),`Duplicate routes found with id: ${String(d.id)}`),l[d.id]=d,h!==0&&d.path){const g=X2(d.fullPath);(!u[g]||d.fullPath.endsWith("/"))&&(u[g]=d)}h++}),Ha(n),{processedTree:{segmentTree:n,singleCache:Id(1e3),matchCache:Id(1e3),flatCache:null,masksTree:null},routesById:l,routesByPath:u}}function Ag(t,e,i=!1){const n=t.split("/"),a=ek(t,n,e,i);if(!a)return null;const[l]=iw(t,n,a);return{route:a.node.route,rawParams:l,parsedParams:a.parsedParams}}function iw(t,e,i){const n=J2(i.node);let a=null;const l={};let u=i.extract?.part??0,h=i.extract?.node??0,f=i.extract?.path??0;for(;h<n.length;u++,h++,f++){const d=n[h],g=e[u],v=f;if(g&&(f+=g.length),d.kind===Ho){a??=i.node.fullPath.split("/");const p=a[h],S=d.prefix?.length??0;if(p.charCodeAt(S)===123){const C=d.suffix?.length??0,x=p.substring(S+2,p.length-C-1),R=g.substring(S,g.length-C);l[x]=decodeURIComponent(R)}else{const C=p.substring(1);l[C]=decodeURIComponent(g)}}else if(d.kind===Tu){if(i.skipped&1<<h){u--;continue}a??=i.node.fullPath.split("/");const p=a[h],S=d.prefix?.length??0,y=d.suffix?.length??0,C=p.substring(S+3,p.length-y-1),x=d.suffix||d.prefix?g.substring(S,g.length-y):g;x&&(l[C]=decodeURIComponent(x))}else if(d.kind===Io){const p=d,S=t.substring(v+(p.prefix?.length??0),t.length-(p.suffix?.length??0)),y=decodeURIComponent(S);l["*"]=y,l._splat=y;break}}return i.rawParams&&Object.assign(l,i.rawParams),[l,{part:u,node:h,path:f}]}function Q2(t){const e=[t];for(;t.parentRoute;)t=t.parentRoute,e.push(t);return e.reverse(),e}function J2(t){const e=Array(t.depth+1);do e[t.depth]=t,t=t.parent;while(t);return e}function ek(t,e,i,n){if(t==="/"&&i.index)return{node:i.index,skipped:0};const a=!Pd(e),l=a&&t!=="/",u=e.length-(a?1:0),h=[{node:i,index:1,skipped:0,depth:1,statics:1,dynamics:0,optionals:0}];let f=null,d=null,g=null;for(;h.length;){const v=h.pop(),{node:p,index:S,skipped:y,depth:C,statics:x,dynamics:R,optionals:L}=v;let{extract:N,rawParams:T,parsedParams:W}=v;if(p.skipOnParamError){if(!L_(t,e,v))continue;T=v.rawParams,N=v.extract,W=v.parsedParams}n&&p.route&&p.kind!==zl&&Zc(d,v)&&(d=v);const D=S===u;if(D&&(p.route&&!l&&Zc(g,v)&&(g=v),!p.optional&&!p.wildcard&&!p.index&&!p.pathless))continue;const I=D?void 0:e[S];let H;if(D&&p.index){const V={node:p.index,index:S,skipped:y,depth:C+1,statics:x,dynamics:R,optionals:L,extract:N,rawParams:T,parsedParams:W};if(p.index.skipOnParamError&&!L_(t,e,V))continue;if(x===u&&!R&&!L&&!y)return V;Zc(g,V)&&(g=V)}if(p.wildcard&&Zc(f,v))for(const V of p.wildcard){const{prefix:se,suffix:Q}=V;if(se&&(D||!(V.caseSensitive?I:H??=I.toLowerCase()).startsWith(se)))continue;if(Q){if(D)continue;const O=e.slice(S).join("/").slice(-Q.length);if((V.caseSensitive?O:O.toLowerCase())!==Q)continue}const A={node:V,index:u,skipped:y,depth:C,statics:x,dynamics:R,optionals:L,extract:N,rawParams:T,parsedParams:W};if(!(V.skipOnParamError&&!L_(t,e,A))){f=A;break}}if(p.optional){const V=y|1<<C,se=C+1;for(let Q=p.optional.length-1;Q>=0;Q--){const A=p.optional[Q];h.push({node:A,index:S,skipped:V,depth:se,statics:x,dynamics:R,optionals:L,extract:N,rawParams:T,parsedParams:W})}if(!D)for(let Q=p.optional.length-1;Q>=0;Q--){const A=p.optional[Q],{prefix:O,suffix:P}=A;if(O||P){const $=A.caseSensitive?I:H??=I.toLowerCase();if(O&&!$.startsWith(O)||P&&!$.endsWith(P))continue}h.push({node:A,index:S+1,skipped:y,depth:se,statics:x,dynamics:R,optionals:L+1,extract:N,rawParams:T,parsedParams:W})}}if(!D&&p.dynamic&&I)for(let V=p.dynamic.length-1;V>=0;V--){const se=p.dynamic[V],{prefix:Q,suffix:A}=se;if(Q||A){const O=se.caseSensitive?I:H??=I.toLowerCase();if(Q&&!O.startsWith(Q)||A&&!O.endsWith(A))continue}h.push({node:se,index:S+1,skipped:y,depth:C+1,statics:x,dynamics:R+1,optionals:L,extract:N,rawParams:T,parsedParams:W})}if(!D&&p.staticInsensitive){const V=p.staticInsensitive.get(H??=I.toLowerCase());V&&h.push({node:V,index:S+1,skipped:y,depth:C+1,statics:x+1,dynamics:R,optionals:L,extract:N,rawParams:T,parsedParams:W})}if(!D&&p.static){const V=p.static.get(I);V&&h.push({node:V,index:S+1,skipped:y,depth:C+1,statics:x+1,dynamics:R,optionals:L,extract:N,rawParams:T,parsedParams:W})}if(p.pathless){const V=C+1;for(let se=p.pathless.length-1;se>=0;se--){const Q=p.pathless[se];h.push({node:Q,index:S,skipped:y,depth:V,statics:x,dynamics:R,optionals:L,extract:N,rawParams:T,parsedParams:W})}}}if(g&&f)return Zc(f,g)?g:f;if(g)return g;if(f)return f;if(n&&d){let v=d.index;for(let S=0;S<d.index;S++)v+=e[S].length;const p=v===t.length?"/":t.slice(v);return d.rawParams??={},d.rawParams["**"]=decodeURIComponent(p),d}return null}function L_(t,e,i){try{const[n,a]=iw(t,e,i);i.rawParams=n,i.extract=a;const l=i.node.parse(n);return i.parsedParams=Object.assign({},i.parsedParams,l),!0}catch{return null}}function Zc(t,e){return t?e.statics>t.statics||e.statics===t.statics&&(e.dynamics>t.dynamics||e.dynamics===t.dynamics&&(e.optionals>t.optionals||e.optionals===t.optionals&&((e.node.kind===zl)>(t.node.kind===zl)||e.node.kind===zl==(t.node.kind===zl)&&e.depth>t.depth))):!0}function gd(t){return Lg(t.filter(e=>e!==void 0).join("/"))}function Lg(t){return t.replace(/\/{2,}/g,"/")}function sw(t){return t==="/"?t:t.replace(/^\/{1,}/,"")}function qa(t){const e=t.length;return e>1&&t[e-1]==="/"?t.replace(/\/{1,}$/,""):t}function rw(t){return qa(sw(t))}function Ud(t,e){return t?.endsWith("/")&&t!=="/"&&t!==`${e}/`?t.slice(0,-1):t}function tk(t,e,i){return Ud(t,i)===Ud(e,i)}function ik({base:t,to:e,trailingSlash:i="never",cache:n}){const a=e.startsWith("/"),l=!a&&e===".";let u;if(n){u=a?e:l?t:t+"\0"+e;const v=n.get(u);if(v)return v}let h;if(l)h=t.split("/");else if(a)h=e.split("/");else{for(h=t.split("/");h.length>1&&Pd(h)==="";)h.pop();const v=e.split("/");for(let p=0,S=v.length;p<S;p++){const y=v[p];y===""?p?p===S-1&&h.push(y):h=[y]:y===".."?h.pop():y==="."||h.push(y)}}h.length>1&&(Pd(h)===""?i==="never"&&h.pop():i==="always"&&h.push(""));let f,d="";for(let v=0;v<h.length;v++){v>0&&(d+="/");const p=h[v];if(!p)continue;f=Mg(p,0,f);const S=f[0];if(S===Yl){d+=p;continue}const y=f[5],C=p.substring(0,f[1]),x=p.substring(f[4],y),R=p.substring(f[2],f[3]);S===Ho?d+=C||x?`${C}{$${R}}${x}`:`$${R}`:S===Io?d+=C||x?`${C}{$}${x}`:"$":d+=`${C}{-$${R}}${x}`}d=Lg(d);const g=d||"/";return u&&n&&n.set(u,g),g}function D_(t,e,i){const n=e[t];return typeof n!="string"?n:t==="_splat"?encodeURI(n):sk(n,i)}function O_({path:t,params:e,decodeCharMap:i}){let n=!1;const a={};if(!t||t==="/")return{interpolatedPath:"/",usedParams:a,isMissingParams:n};if(!t.includes("$"))return{interpolatedPath:t,usedParams:a,isMissingParams:n};const l=t.length;let u=0,h,f="";for(;u<l;){const g=u;h=Mg(t,g,h);const v=h[5];if(u=v+1,g===v)continue;const p=h[0];if(p===Yl){f+="/"+t.substring(g,v);continue}if(p===Io){const S=e._splat;a._splat=S,a["*"]=S;const y=t.substring(g,h[1]),C=t.substring(h[4],v);if(!S){n=!0,(y||C)&&(f+="/"+y+C);continue}const x=D_("_splat",e,i);f+="/"+y+x+C;continue}if(p===Ho){const S=t.substring(h[2],h[3]);!n&&!(S in e)&&(n=!0),a[S]=e[S];const y=t.substring(g,h[1]),C=t.substring(h[4],v),x=D_(S,e,i)??"undefined";f+="/"+y+x+C;continue}if(p===Tu){const S=t.substring(h[2],h[3]),y=e[S];if(y==null)continue;a[S]=y;const C=t.substring(g,h[1]),x=t.substring(h[4],v),R=D_(S,e,i)??"";f+="/"+C+R+x;continue}}return t.endsWith("/")&&(f+="/"),{usedParams:a,interpolatedPath:f||"/",isMissingParams:n}}function sk(t,e){let i=encodeURIComponent(t);if(e)for(const[n,a]of e)i=i.replaceAll(n,a);return i}function Ys(t){return!!t?.isNotFound}function rk(){try{if(typeof window<"u"&&typeof window.sessionStorage=="object")return window.sessionStorage}catch{}}const Fd="tsr-scroll-restoration-v1_3",nk=(t,e)=>{let i;return(...n)=>{i||(i=setTimeout(()=>{t(...n),i=null},e))}};function ak(){const t=rk();if(!t)return null;const e=t.getItem(Fd);let i=e?JSON.parse(e):{};return{state:i,set:n=>{i=Ua(n,i)||i;try{t.setItem(Fd,JSON.stringify(i))}catch{console.warn("[ts-router] Could not persist scroll restoration state to sessionStorage.")}}}}const Qh=ak(),xp=t=>t.state.__TSR_key||t.href;function ok(t){const e=[];let i;for(;i=t.parentNode;)e.push(`${t.tagName}:nth-child(${Array.prototype.indexOf.call(i.children,t)+1})`),t=i;return`${e.reverse().join(" > ")}`.toLowerCase()}let $d=!1;function nw({storageKey:t,key:e,behavior:i,shouldScrollRestoration:n,scrollToTopSelectors:a,location:l}){let u;try{u=JSON.parse(sessionStorage.getItem(t)||"{}")}catch(d){console.error(d);return}const h=e||window.history.state?.__TSR_key,f=u[h];$d=!0;e:{if(n&&f&&Object.keys(f).length>0){for(const v in f){const p=f[v];if(v==="window")window.scrollTo({top:p.scrollY,left:p.scrollX,behavior:i});else if(v){const S=document.querySelector(v);S&&(S.scrollLeft=p.scrollX,S.scrollTop=p.scrollY)}}break e}const d=(l??window.location).hash.split("#",2)[1];if(d){const v=window.history.state?.__hashScrollIntoViewOptions??!0;if(v){const p=document.getElementById(d);p&&p.scrollIntoView(v)}break e}const g={top:0,left:0,behavior:i};if(window.scrollTo(g),a)for(const v of a){if(v==="window")continue;const p=typeof v=="function"?v():document.querySelector(v);p&&p.scrollTo(g)}}$d=!1}function lk(t,e){if(!Qh&&!t.isServer||((t.options.scrollRestoration??!1)&&(t.isScrollRestoring=!0),t.isServer||t.isScrollRestorationSetup||!Qh))return;t.isScrollRestorationSetup=!0,$d=!1;const n=t.options.getScrollRestorationKey||xp;window.history.scrollRestoration="manual";const a=l=>{if($d||!t.isScrollRestoring)return;let u="";if(l.target===document||l.target===window)u="window";else{const f=l.target.getAttribute("data-scroll-restoration-id");f?u=`[data-scroll-restoration-id="${f}"]`:u=ok(l.target)}const h=n(t.state.location);Qh.set(f=>{const d=f[h]||={},g=d[u]||={};if(u==="window")g.scrollX=window.scrollX||0,g.scrollY=window.scrollY||0;else if(u){const v=document.querySelector(u);v&&(g.scrollX=v.scrollLeft||0,g.scrollY=v.scrollTop||0)}return f})};typeof document<"u"&&document.addEventListener("scroll",nk(a,100),!0),t.subscribe("onRendered",l=>{const u=n(l.toLocation);if(!t.resetNextScroll){t.resetNextScroll=!0;return}typeof t.options.scrollRestoration=="function"&&!t.options.scrollRestoration({location:t.latestLocation})||(nw({storageKey:Fd,key:u,behavior:t.options.scrollRestorationBehavior,shouldScrollRestoration:t.isScrollRestoring,scrollToTopSelectors:t.options.scrollToTopSelectors,location:t.history.location}),t.isScrollRestoring&&Qh.set(h=>(h[u]||={},h)))})}function ck(t){if(typeof document<"u"&&document.querySelector){const e=t.state.location.state.__hashScrollIntoViewOptions??!0;if(e&&t.state.location.hash!==""){const i=document.getElementById(t.state.location.hash);i&&i.scrollIntoView(e)}}}function uk(t,e=String){const i=new URLSearchParams;for(const n in t){const a=t[n];a!==void 0&&i.set(n,e(a))}return i.toString()}function B_(t){return t?t==="false"?!1:t==="true"?!0:+t*0===0&&+t+""===t?+t:t:""}function hk(t){const e=new URLSearchParams(t),i={};for(const[n,a]of e.entries()){const l=i[n];l==null?i[n]=B_(a):Array.isArray(l)?l.push(B_(a)):i[n]=[l,B_(a)]}return i}const dk=mk(JSON.parse),fk=_k(JSON.stringify,JSON.parse);function mk(t){return e=>{e[0]==="?"&&(e=e.substring(1));const i=hk(e);for(const n in i){const a=i[n];if(typeof a=="string")try{i[n]=t(a)}catch{}}return i}}function _k(t,e){const i=typeof e=="function";function n(a){if(typeof a=="object"&&a!==null)try{return t(a)}catch{}else if(i&&typeof a=="string")try{return e(a),t(a)}catch{}return a}return a=>{const l=uk(a,n);return l?`?${l}`:""}}const qs="__root__";function aw(t){if(t.statusCode=t.statusCode||t.code||307,typeof t.href=="string"&&Hd(t.href))throw new Error(`Redirect blocked: unsafe protocol in href "${t.href}". Only ${tw.join(", ")} protocols are allowed.`);if(!t.reloadDocument&&typeof t.href=="string")try{new URL(t.href),t.reloadDocument=!0}catch{}const e=new Headers(t.headers);t.href&&e.get("Location")===null&&e.set("Location",t.href);const i=new Response(null,{status:t.statusCode,headers:e});if(i.options=t,t.throw)throw i;return i}function xr(t){return t instanceof Response&&!!t.options}const vd=t=>{if(!t.rendered)return t.rendered=!0,t.onReady?.()},nf=(t,e)=>!!(t.preload&&!t.router.state.matches.some(i=>i.id===e)),$l=(t,e,i=!0)=>{const n={...t.router.options.context??{}},a=i?e:e-1;for(let l=0;l<=a;l++){const u=t.matches[l];if(!u)continue;const h=t.router.getMatch(u.id);h&&Object.assign(n,h.__routeContext,h.__beforeLoadContext)}return n},ow=(t,e)=>{const i=t.router.routesById[e.routeId??""]??t.router.routeTree;!i.options.notFoundComponent&&t.router.options?.defaultNotFoundComponent&&(i.options.notFoundComponent=t.router.options.defaultNotFoundComponent),Yn(i.options.notFoundComponent);const n=t.matches.find(a=>a.routeId===i.id);Yn(n,"Could not find match for route: "+i.id),t.updateMatch(n.id,a=>({...a,status:"notFound",error:e,isFetching:!1})),e.routerCode==="BEFORE_LOAD"&&i.parentRoute&&(e.routeId=i.parentRoute.id,ow(t,e))},Fa=(t,e,i)=>{if(!(!xr(i)&&!Ys(i))){if(xr(i)&&i.redirectHandled&&!i.options.reloadDocument)throw i;if(e){e._nonReactive.beforeLoadPromise?.resolve(),e._nonReactive.loaderPromise?.resolve(),e._nonReactive.beforeLoadPromise=void 0,e._nonReactive.loaderPromise=void 0;const n=xr(i)?"redirected":"notFound";e._nonReactive.error=i,t.updateMatch(e.id,a=>({...a,status:n,context:$l(t,e.index),isFetching:!1,error:i})),Ys(i)&&!i.routeId&&(i.routeId=e.routeId),e._nonReactive.loadPromise?.resolve()}throw xr(i)?(t.rendered=!0,i.options._fromLocation=t.location,i.redirectHandled=!0,i=t.router.resolveRedirect(i),i):(ow(t,i),i)}},lw=(t,e)=>{const i=t.router.getMatch(e);return!!(!t.router.isServer&&i._nonReactive.dehydrated||t.router.isServer&&i.ssr===!1)},Qc=(t,e,i,n)=>{const{id:a,routeId:l}=t.matches[e],u=t.router.looseRoutesById[l];if(i instanceof Promise)throw i;i.routerCode=n,t.firstBadMatchIndex??=e,Fa(t,t.router.getMatch(a),i);try{u.options.onError?.(i)}catch(h){i=h,Fa(t,t.router.getMatch(a),i)}t.updateMatch(a,h=>(h._nonReactive.beforeLoadPromise?.resolve(),h._nonReactive.beforeLoadPromise=void 0,h._nonReactive.loadPromise?.resolve(),{...h,error:i,status:"error",isFetching:!1,updatedAt:Date.now(),abortController:new AbortController}))},pk=(t,e,i,n)=>{const a=t.router.getMatch(e),l=t.matches[i-1]?.id,u=l?t.router.getMatch(l):void 0;if(t.router.isShell()){a.ssr=n.id===qs;return}if(u?.ssr===!1){a.ssr=!1;return}const h=S=>S===!0&&u?.ssr==="data-only"?"data-only":S,f=t.router.options.defaultSsr??!0;if(n.options.ssr===void 0){a.ssr=h(f);return}if(typeof n.options.ssr!="function"){a.ssr=h(n.options.ssr);return}const{search:d,params:g}=a,v={search:Jh(d,a.searchError),params:Jh(g,a.paramsError),location:t.location,matches:t.matches.map(S=>({index:S.index,pathname:S.pathname,fullPath:S.fullPath,staticData:S.staticData,id:S.id,routeId:S.routeId,search:Jh(S.search,S.searchError),params:Jh(S.params,S.paramsError),ssr:S.ssr}))},p=n.options.ssr(v);if(Va(p))return p.then(S=>{a.ssr=h(S??f)});a.ssr=h(p??f)},cw=(t,e,i,n)=>{if(n._nonReactive.pendingTimeout!==void 0)return;const a=i.options.pendingMs??t.router.options.defaultPendingMs;if(!!(t.onReady&&!t.router.isServer&&!nf(t,e)&&(i.options.loader||i.options.beforeLoad||dw(i))&&typeof a=="number"&&a!==1/0&&(i.options.pendingComponent??t.router.options?.defaultPendingComponent))){const u=setTimeout(()=>{vd(t)},a);n._nonReactive.pendingTimeout=u}},gk=(t,e,i)=>{const n=t.router.getMatch(e);if(!n._nonReactive.beforeLoadPromise&&!n._nonReactive.loaderPromise)return;cw(t,e,i,n);const a=()=>{const l=t.router.getMatch(e);l.preload&&(l.status==="redirected"||l.status==="notFound")&&Fa(t,l,l.error)};return n._nonReactive.beforeLoadPromise?n._nonReactive.beforeLoadPromise.then(a):a()},vk=(t,e,i,n)=>{const a=t.router.getMatch(e),l=a._nonReactive.loadPromise;a._nonReactive.loadPromise=ql(()=>{l?.resolve()});const{paramsError:u,searchError:h}=a;u&&Qc(t,i,u,"PARSE_PARAMS"),h&&Qc(t,i,h,"VALIDATE_SEARCH"),cw(t,e,n,a);const f=new AbortController,d=t.matches[i-1]?.id;(d?t.router.getMatch(d):void 0)?.context??t.router.options.context;let v=!1;const p=()=>{v||(v=!0,t.updateMatch(e,D=>({...D,isFetching:"beforeLoad",fetchCount:D.fetchCount+1,abortController:f})))},S=()=>{a._nonReactive.beforeLoadPromise?.resolve(),a._nonReactive.beforeLoadPromise=void 0,t.updateMatch(e,D=>({...D,isFetching:!1}))};if(!n.options.beforeLoad){wu(()=>{p(),S()});return}a._nonReactive.beforeLoadPromise=ql();const y={...$l(t,i,!1),...a.__routeContext},{search:C,params:x,cause:R}=a,L=nf(t,e),N={search:C,abortController:f,params:x,preload:L,context:y,location:t.location,navigate:D=>t.router.navigate({...D,_fromLocation:t.location}),buildLocation:t.router.buildLocation,cause:L?"preload":R,matches:t.matches,...t.router.options.additionalContext},T=D=>{if(D===void 0){wu(()=>{p(),S()});return}(xr(D)||Ys(D))&&(p(),Qc(t,i,D,"BEFORE_LOAD")),wu(()=>{p(),t.updateMatch(e,I=>({...I,__beforeLoadContext:D})),S()})};let W;try{if(W=n.options.beforeLoad(N),Va(W))return p(),W.catch(D=>{Qc(t,i,D,"BEFORE_LOAD")}).then(T)}catch(D){p(),Qc(t,i,D,"BEFORE_LOAD")}T(W)},Sk=(t,e)=>{const{id:i,routeId:n}=t.matches[e],a=t.router.looseRoutesById[n],l=()=>{if(t.router.isServer){const f=pk(t,i,e,a);if(Va(f))return f.then(h)}return h()},u=()=>vk(t,i,e,a),h=()=>{if(lw(t,i))return;const f=gk(t,i,a);return Va(f)?f.then(u):u()};return l()},yk=(t,e,i)=>{const n=t.router.getMatch(e);if(!n||!i.options.head&&!i.options.scripts&&!i.options.headers)return;const a={ssr:t.router.options.ssr,matches:t.matches,match:n,params:n.params,loaderData:n.loaderData};return Promise.all([i.options.head?.(a),i.options.scripts?.(a),i.options.headers?.(a)]).then(([l,u,h])=>{const f=l?.meta,d=l?.links,g=l?.scripts,v=l?.styles;return{meta:f,links:d,headScripts:g,headers:h,scripts:u,styles:v}})},uw=(t,e,i,n)=>{const a=t.matchPromises[i-1],{params:l,loaderDeps:u,abortController:h,cause:f}=t.router.getMatch(e),d=$l(t,i),g=nf(t,e);return{params:l,deps:u,preload:!!g,parentMatchPromise:a,abortController:h,context:d,location:t.location,navigate:v=>t.router.navigate({...v,_fromLocation:t.location}),cause:g?"preload":f,route:n,...t.router.options.additionalContext}},Py=async(t,e,i,n)=>{try{const a=t.router.getMatch(e);try{(!t.router.isServer||a.ssr===!0)&&hw(n);const l=n.options.loader?.(uw(t,e,i,n)),u=n.options.loader&&Va(l);if((u||n._lazyPromise||n._componentsPromise||n.options.head||n.options.scripts||n.options.headers||a._nonReactive.minPendingPromise)&&t.updateMatch(e,d=>({...d,isFetching:"loader"})),n.options.loader){const d=u?await l:l;Fa(t,t.router.getMatch(e),d),d!==void 0&&t.updateMatch(e,g=>({...g,loaderData:d}))}n._lazyPromise&&await n._lazyPromise;const f=a._nonReactive.minPendingPromise;f&&await f,n._componentsPromise&&await n._componentsPromise,t.updateMatch(e,d=>({...d,error:void 0,context:$l(t,i),status:"success",isFetching:!1,updatedAt:Date.now()}))}catch(l){let u=l;if(u?.name==="AbortError"){t.updateMatch(e,f=>({...f,status:f.status==="pending"?"success":f.status,isFetching:!1,context:$l(t,i)}));return}const h=a._nonReactive.minPendingPromise;h&&await h,Ys(l)&&await n.options.notFoundComponent?.preload?.(),Fa(t,t.router.getMatch(e),l);try{n.options.onError?.(l)}catch(f){u=f,Fa(t,t.router.getMatch(e),f)}t.updateMatch(e,f=>({...f,error:u,context:$l(t,i),status:"error",isFetching:!1}))}}catch(a){const l=t.router.getMatch(e);l&&(l._nonReactive.loaderPromise=void 0),Fa(t,l,a)}},bk=async(t,e)=>{const{id:i,routeId:n}=t.matches[e];let a=!1,l=!1;const u=t.router.looseRoutesById[n];if(lw(t,i)){if(t.router.isServer)return t.router.getMatch(i)}else{const d=t.router.getMatch(i);if(d._nonReactive.loaderPromise){if(d.status==="success"&&!t.sync&&!d.preload)return d;await d._nonReactive.loaderPromise;const g=t.router.getMatch(i),v=g._nonReactive.error||g.error;v&&Fa(t,g,v)}else{const g=Date.now()-d.updatedAt,v=nf(t,i),p=v?u.options.preloadStaleTime??t.router.options.defaultPreloadStaleTime??3e4:u.options.staleTime??t.router.options.defaultStaleTime??0,S=u.options.shouldReload,y=typeof S=="function"?S(uw(t,i,e,u)):S,C=!!v&&!t.router.state.matches.some(N=>N.id===i),x=t.router.getMatch(i);x._nonReactive.loaderPromise=ql(),C!==x.preload&&t.updateMatch(i,N=>({...N,preload:C}));const{status:R,invalid:L}=x;a=R==="success"&&(L||(y??g>p)),v&&u.options.preload===!1||(a&&!t.sync?(l=!0,(async()=>{try{await Py(t,i,e,u);const N=t.router.getMatch(i);N._nonReactive.loaderPromise?.resolve(),N._nonReactive.loadPromise?.resolve(),N._nonReactive.loaderPromise=void 0}catch(N){xr(N)&&await t.router.navigate(N.options)}})()):(R!=="success"||a&&t.sync)&&await Py(t,i,e,u))}}const h=t.router.getMatch(i);l||(h._nonReactive.loaderPromise?.resolve(),h._nonReactive.loadPromise?.resolve()),clearTimeout(h._nonReactive.pendingTimeout),h._nonReactive.pendingTimeout=void 0,l||(h._nonReactive.loaderPromise=void 0),h._nonReactive.dehydrated=void 0;const f=l?h.isFetching:!1;return f!==h.isFetching||h.invalid!==!1?(t.updateMatch(i,d=>({...d,isFetching:f,invalid:!1})),t.router.getMatch(i)):h};async function zy(t){const e=Object.assign(t,{matchPromises:[]});!e.router.isServer&&e.router.state.matches.some(i=>i._forcePending)&&vd(e);try{for(let h=0;h<e.matches.length;h++){const f=Sk(e,h);Va(f)&&await f}const i=e.firstBadMatchIndex??e.matches.length;for(let h=0;h<i;h++)e.matchPromises.push(bk(e,h));const a=(await Promise.allSettled(e.matchPromises)).filter(h=>h.status==="rejected").map(h=>h.reason);let l;for(const h of a){if(xr(h))throw h;!l&&Ys(h)&&(l=h)}for(const h of e.matches){const{id:f,routeId:d}=h,g=e.router.looseRoutesById[d];try{const v=yk(e,f,g);if(v){const p=await v;e.updateMatch(f,S=>({...S,...p}))}}catch(v){console.error(`Error executing head for route ${d}:`,v)}}if(l)throw l;const u=vd(e);Va(u)&&await u}catch(i){if(Ys(i)&&!e.preload){const n=vd(e);throw Va(n)&&await n,i}if(xr(i))throw i}return e.matches}async function hw(t){if(!t._lazyLoaded&&t._lazyPromise===void 0&&(t.lazyFn?t._lazyPromise=t.lazyFn().then(e=>{const{id:i,...n}=e.options;Object.assign(t.options,n),t._lazyLoaded=!0,t._lazyPromise=void 0}):t._lazyLoaded=!0),!t._componentsLoaded&&t._componentsPromise===void 0){const e=()=>{const i=[];for(const n of fw){const a=t.options[n]?.preload;a&&i.push(a())}if(i.length)return Promise.all(i).then(()=>{t._componentsLoaded=!0,t._componentsPromise=void 0});t._componentsLoaded=!0,t._componentsPromise=void 0};t._componentsPromise=t._lazyPromise?t._lazyPromise.then(e):e()}return t._componentsPromise}function Jh(t,e){return e?{status:"error",error:e}:{status:"success",value:t}}function dw(t){for(const e of fw)if(t.options[e]?.preload)return!0;return!1}const fw=["component","errorComponent","pendingComponent","notFoundComponent"];function wk(t){return{input:({url:e})=>{for(const i of t)e=kp(i,e);return e},output:({url:e})=>{for(let i=t.length-1;i>=0;i--)e=mw(t[i],e);return e}}}function Ck(t){const e=rw(t.basepath),i=`/${e}`,n=`${i}/`,a=t.caseSensitive?i:i.toLowerCase(),l=t.caseSensitive?n:n.toLowerCase();return{input:({url:u})=>{const h=t.caseSensitive?u.pathname:u.pathname.toLowerCase();return h===a?u.pathname="/":h.startsWith(l)&&(u.pathname=u.pathname.slice(i.length)),u},output:({url:u})=>(u.pathname=gd(["/",e,u.pathname]),u)}}function kp(t,e){const i=t?.input?.({url:e});if(i){if(typeof i=="string")return new URL(i);if(i instanceof URL)return i}return e}function mw(t,e){const i=t?.output?.({url:e});if(i){if(typeof i=="string")return new URL(i);if(i instanceof URL)return i}return e}function Oo(t){const e=t.resolvedLocation,i=t.location,n=e?.pathname!==i.pathname,a=e?.href!==i.href,l=e?.hash!==i.hash;return{fromLocation:e,toLocation:i,pathChanged:n,hrefChanged:a,hashChanged:l}}class xk{constructor(e){this.tempLocationKey=`${Math.round(Math.random()*1e7)}`,this.resetNextScroll=!0,this.shouldViewTransition=void 0,this.isViewTransitionTypesSupported=void 0,this.subscribers=new Set,this.isScrollRestoring=!1,this.isScrollRestorationSetup=!1,this.startTransition=i=>i(),this.update=i=>{i.notFoundRoute&&console.warn("The notFoundRoute API is deprecated and will be removed in the next major version. See https://tanstack.com/router/v1/docs/framework/react/guide/not-found-errors#migrating-from-notfoundroute for more info.");const n=this.options,a=this.basepath??n?.basepath??"/",l=this.basepath===void 0,u=n?.rewrite;this.options={...n,...i},this.isServer=this.options.isServer??typeof document>"u",this.pathParamsDecodeCharMap=this.options.pathParamsAllowedCharacters?new Map(this.options.pathParamsAllowedCharacters.map(p=>[encodeURIComponent(p),p])):void 0,(!this.history||this.options.history&&this.options.history!==this.history)&&(this.options.history?this.history=this.options.history:this.isServer||(this.history=O2())),this.origin=this.options.origin,this.origin||(!this.isServer&&window?.origin&&window.origin!=="null"?this.origin=window.origin:this.origin="http://localhost"),this.history&&this.updateLatestLocation(),this.options.routeTree!==this.routeTree&&(this.routeTree=this.options.routeTree,this.buildRouteTree()),!this.__store&&this.latestLocation&&(this.__store=new L2(Ek(this.latestLocation),{onUpdate:()=>{this.__store.state={...this.state,cachedMatches:this.state.cachedMatches.filter(p=>!["redirected"].includes(p.status))}}}),lk(this));let h=!1;const f=this.options.basepath??"/",d=this.options.rewrite;if(l||a!==f||u!==d){this.basepath=f;const p=[];rw(f)!==""&&p.push(Ck({basepath:f})),d&&p.push(d),this.rewrite=p.length===0?void 0:p.length===1?p[0]:wk(p),this.history&&this.updateLatestLocation(),h=!0}h&&this.__store&&(this.__store.state={...this.state,location:this.latestLocation}),typeof window<"u"&&"CSS"in window&&typeof window.CSS?.supports=="function"&&(this.isViewTransitionTypesSupported=window.CSS.supports("selector(:active-view-transition-type(a)"))},this.updateLatestLocation=()=>{this.latestLocation=this.parseLocation(this.history.location,this.latestLocation)},this.buildRouteTree=()=>{const{routesById:i,routesByPath:n,processedTree:a}=Z2(this.routeTree,this.options.caseSensitive,(u,h)=>{u.init({originalIndex:h})});this.options.routeMasks&&q2(this.options.routeMasks,a),this.routesById=i,this.routesByPath=n,this.processedTree=a;const l=this.options.notFoundRoute;l&&(l.init({originalIndex:99999999999}),this.routesById[l.id]=l)},this.subscribe=(i,n)=>{const a={eventType:i,fn:n};return this.subscribers.add(a),()=>{this.subscribers.delete(a)}},this.emit=i=>{this.subscribers.forEach(n=>{n.eventType===i.type&&n.fn(i)})},this.parseLocation=(i,n)=>{const a=({href:f,state:d})=>{const g=new URL(f,this.origin),v=kp(this.rewrite,g),p=this.options.parseSearch(v.search),S=this.options.stringifySearch(p);return v.search=S,{href:v.href.replace(v.origin,""),publicHref:f,url:v,pathname:Ny(v.pathname),searchStr:S,search:br(n?.search,p),hash:v.hash.split("#").reverse()[0]??"",state:br(n?.state,d)}},l=a(i),{__tempLocation:u,__tempKey:h}=l.state;if(u&&(!h||h===this.tempLocationKey)){const f=a(u);return f.state.key=l.state.key,f.state.__TSR_key=l.state.__TSR_key,delete f.state.__tempLocation,{...f,maskedLocation:l}}return l},this.resolvePathCache=Id(1e3),this.resolvePathWithBase=(i,n)=>ik({base:i,to:Lg(n),trailingSlash:this.options.trailingSlash,cache:this.resolvePathCache}),this.matchRoutes=(i,n,a)=>typeof i=="string"?this.matchRoutesInternal({pathname:i,search:n},a):this.matchRoutesInternal(i,n),this.getMatchedRoutes=i=>Tk({pathname:i,routesById:this.routesById,processedTree:this.processedTree}),this.cancelMatch=i=>{const n=this.getMatch(i);n&&(n.abortController.abort(),clearTimeout(n._nonReactive.pendingTimeout),n._nonReactive.pendingTimeout=void 0)},this.cancelMatches=()=>{const i=this.state.matches.filter(l=>l.status==="pending"),n=this.state.matches.filter(l=>l.isFetching==="loader");new Set([...this.state.pendingMatches??[],...i,...n]).forEach(l=>{this.cancelMatch(l.id)})},this.buildLocation=i=>{const n=(l={})=>{const u=l._fromLocation||this.pendingBuiltLocation||this.latestLocation,h=this.matchRoutes(u,{_buildLocation:!0}),f=Pd(h);l.from;const d=l.unsafeRelative==="path"?u.pathname:l.from??f.fullPath,g=this.resolvePathWithBase(d,"."),v=f.search,p={...f.params},S=l.to?this.resolvePathWithBase(g,`${l.to}`):this.resolvePathWithBase(g,"."),y=l.params===!1||l.params===null?{}:(l.params??!0)===!0?p:Object.assign(p,Ua(l.params,p)),C=O_({path:S,params:y}).interpolatedPath,x=this.matchRoutes(C,void 0,{_buildLocation:!0}).map(se=>this.looseRoutesById[se.routeId]);if(Object.keys(y).length>0)for(const se of x){const Q=se.options.params?.stringify??se.options.stringifyParams;Q&&Object.assign(y,Q(y))}const R=i.leaveParams?S:Ny(O_({path:S,params:y,decodeCharMap:this.pathParamsDecodeCharMap}).interpolatedPath);let L=v;if(i._includeValidateSearch&&this.options.search?.strict){const se={};x.forEach(Q=>{if(Q.options.validateSearch)try{Object.assign(se,Ep(Q.options.validateSearch,{...se,...L}))}catch{}}),L=se}L=Rk({search:L,dest:l,destRoutes:x,_includeValidateSearch:i._includeValidateSearch}),L=br(v,L);const N=this.options.stringifySearch(L),T=l.hash===!0?u.hash:l.hash?Ua(l.hash,u.hash):void 0,W=T?`#${T}`:"";let D=l.state===!0?u.state:l.state?Ua(l.state,u.state):{};D=br(u.state,D);const I=`${R}${N}${W}`,H=new URL(I,this.origin),V=mw(this.rewrite,H);return{publicHref:V.pathname+V.search+V.hash,href:I,url:V,pathname:R,search:L,searchStr:N,state:D,hash:T??"",unmaskOnReload:l.unmaskOnReload}},a=(l={},u)=>{const h=n(l);let f=u?n(u):void 0;if(!f){const d={};if(this.options.routeMasks){const g=Y2(h.pathname,this.processedTree);if(g){Object.assign(d,g.rawParams);const{from:v,params:p,...S}=g.route,y=p===!1||p===null?{}:(p??!0)===!0?d:Object.assign(d,Ua(p,d));u={from:i.from,...S,params:y},f=n(u)}}}return f&&(h.maskedLocation=f),h};return i.mask?a(i,{from:i.from,...i.mask}):a(i)},this.commitLocation=({viewTransition:i,ignoreBlocker:n,...a})=>{const l=()=>{const f=["key","__TSR_key","__TSR_index","__hashScrollIntoViewOptions"];f.forEach(g=>{a.state[g]=this.latestLocation.state[g]});const d=Do(a.state,this.latestLocation.state);return f.forEach(g=>{delete a.state[g]}),d},u=qa(this.latestLocation.href)===qa(a.href),h=this.commitLocationPromise;if(this.commitLocationPromise=ql(()=>{h?.resolve()}),u&&l())this.load();else{let{maskedLocation:f,hashScrollIntoView:d,url:g,...v}=a;f&&(v={...f,state:{...f.state,__tempKey:void 0,__tempLocation:{...v,search:v.searchStr,state:{...v.state,__tempKey:void 0,__tempLocation:void 0,__TSR_key:void 0,key:void 0}}}},(v.unmaskOnReload??this.options.unmaskOnReload??!1)&&(v.state.__tempKey=this.tempLocationKey)),v.state.__hashScrollIntoViewOptions=d??this.options.defaultHashScrollIntoView??!0,this.shouldViewTransition=i,this.history[a.replace?"replace":"push"](v.publicHref,v.state,{ignoreBlocker:n})}return this.resetNextScroll=a.resetScroll??!0,this.history.subscribers.size||this.load(),this.commitLocationPromise},this.buildAndCommitLocation=({replace:i,resetScroll:n,hashScrollIntoView:a,viewTransition:l,ignoreBlocker:u,href:h,...f}={})=>{if(h){const v=this.history.location.state.__TSR_index,p=Nd(h,{__TSR_index:i?v:v+1}),S=new URL(p.pathname,this.origin),y=kp(this.rewrite,S);f.to=y.pathname,f.search=this.options.parseSearch(p.search),f.hash=p.hash.slice(1)}const d=this.buildLocation({...f,_includeValidateSearch:!0});this.pendingBuiltLocation=d;const g=this.commitLocation({...d,viewTransition:l,replace:i,resetScroll:n,hashScrollIntoView:a,ignoreBlocker:u});return Promise.resolve().then(()=>{this.pendingBuiltLocation===d&&(this.pendingBuiltLocation=void 0)}),g},this.navigate=async({to:i,reloadDocument:n,href:a,publicHref:l,...u})=>{let h=!1;if(a)try{new URL(`${a}`),h=!0}catch{}if(h&&!n&&(n=!0),n){if(i!==void 0||!a){const d=this.buildLocation({to:i,...u});a=a??d.url.href,l=l??d.url.href}const f=!h&&l?l:a;if(Hd(f))return Promise.resolve();if(!u.ignoreBlocker){const g=this.history.getBlockers?.()??[];for(const v of g)if(v?.blockerFn&&await v.blockerFn({currentLocation:this.latestLocation,nextLocation:this.latestLocation,action:"PUSH"}))return Promise.resolve()}return u.replace?window.location.replace(f):window.location.href=f,Promise.resolve()}return this.buildAndCommitLocation({...u,href:a,to:i,_isNavigate:!0})},this.beforeLoad=()=>{if(this.cancelMatches(),this.updateLatestLocation(),this.isServer){const n=this.buildLocation({to:this.latestLocation.pathname,search:!0,params:!0,hash:!0,state:!0,_includeValidateSearch:!0});if(this.latestLocation.publicHref!==n.publicHref||n.url.origin!==this.origin){const a=this.getParsedLocationHref(n);throw aw({href:a})}}const i=this.matchRoutes(this.latestLocation);this.__store.setState(n=>({...n,status:"pending",statusCode:200,isLoading:!0,location:this.latestLocation,pendingMatches:i,cachedMatches:n.cachedMatches.filter(a=>!i.some(l=>l.id===a.id))}))},this.load=async i=>{let n,a,l;for(l=new Promise(h=>{this.startTransition(async()=>{try{this.beforeLoad();const f=this.latestLocation,d=this.state.resolvedLocation;this.state.redirect||this.emit({type:"onBeforeNavigate",...Oo({resolvedLocation:d,location:f})}),this.emit({type:"onBeforeLoad",...Oo({resolvedLocation:d,location:f})}),await zy({router:this,sync:i?.sync,matches:this.state.pendingMatches,location:f,updateMatch:this.updateMatch,onReady:async()=>{this.startTransition(()=>{this.startViewTransition(async()=>{let g=[],v=[],p=[];wu(()=>{this.__store.setState(S=>{const y=S.matches,C=S.pendingMatches||S.matches;return g=y.filter(x=>!C.some(R=>R.id===x.id)),v=C.filter(x=>!y.some(R=>R.id===x.id)),p=C.filter(x=>y.some(R=>R.id===x.id)),{...S,isLoading:!1,loadedAt:Date.now(),matches:C,pendingMatches:void 0,cachedMatches:[...S.cachedMatches,...g.filter(x=>x.status!=="error"&&x.status!=="notFound")]}}),this.clearExpiredCache()}),[[g,"onLeave"],[v,"onEnter"],[p,"onStay"]].forEach(([S,y])=>{S.forEach(C=>{this.looseRoutesById[C.routeId].options[y]?.(C)})})})})}})}catch(f){xr(f)?(n=f,this.isServer||this.navigate({...n.options,replace:!0,ignoreBlocker:!0})):Ys(f)&&(a=f),this.__store.setState(d=>({...d,statusCode:n?n.status:a?404:d.matches.some(g=>g.status==="error")?500:200,redirect:n}))}this.latestLoadPromise===l&&(this.commitLocationPromise?.resolve(),this.latestLoadPromise=void 0,this.commitLocationPromise=void 0),h()})}),this.latestLoadPromise=l,await l;this.latestLoadPromise&&l!==this.latestLoadPromise;)await this.latestLoadPromise;let u;this.hasNotFoundMatch()?u=404:this.__store.state.matches.some(h=>h.status==="error")&&(u=500),u!==void 0&&this.__store.setState(h=>({...h,statusCode:u}))},this.startViewTransition=i=>{const n=this.shouldViewTransition??this.options.defaultViewTransition;if(delete this.shouldViewTransition,n&&typeof document<"u"&&"startViewTransition"in document&&typeof document.startViewTransition=="function"){let a;if(typeof n=="object"&&this.isViewTransitionTypesSupported){const l=this.latestLocation,u=this.state.resolvedLocation,h=typeof n.types=="function"?n.types(Oo({resolvedLocation:u,location:l})):n.types;if(h===!1){i();return}a={update:i,types:h}}else a=i;document.startViewTransition(a)}else i()},this.updateMatch=(i,n)=>{this.startTransition(()=>{const a=this.state.pendingMatches?.some(l=>l.id===i)?"pendingMatches":this.state.matches.some(l=>l.id===i)?"matches":this.state.cachedMatches.some(l=>l.id===i)?"cachedMatches":"";a&&this.__store.setState(l=>({...l,[a]:l[a]?.map(u=>u.id===i?n(u):u)}))})},this.getMatch=i=>{const n=a=>a.id===i;return this.state.cachedMatches.find(n)??this.state.pendingMatches?.find(n)??this.state.matches.find(n)},this.invalidate=i=>{const n=a=>i?.filter?.(a)??!0?{...a,invalid:!0,...i?.forcePending||a.status==="error"||a.status==="notFound"?{status:"pending",error:void 0}:void 0}:a;return this.__store.setState(a=>({...a,matches:a.matches.map(n),cachedMatches:a.cachedMatches.map(n),pendingMatches:a.pendingMatches?.map(n)})),this.shouldViewTransition=!1,this.load({sync:i?.sync})},this.getParsedLocationHref=i=>{let n=i.url.href;return this.origin&&i.url.origin===this.origin&&(n=n.replace(this.origin,"")||"/"),n},this.resolveRedirect=i=>{const n=i.headers.get("Location");if(i.options.href){if(n)try{const a=new URL(n);if(this.origin&&a.origin===this.origin){const l=a.pathname+a.search+a.hash;i.options.href=l,i.headers.set("Location",l)}}catch{}}else{const a=this.buildLocation(i.options),l=this.getParsedLocationHref(a);i.options.href=l,i.headers.set("Location",l)}return i.headers.get("Location")||i.headers.set("Location",i.options.href),i},this.clearCache=i=>{const n=i?.filter;n!==void 0?this.__store.setState(a=>({...a,cachedMatches:a.cachedMatches.filter(l=>!n(l))})):this.__store.setState(a=>({...a,cachedMatches:[]}))},this.clearExpiredCache=()=>{const i=n=>{const a=this.looseRoutesById[n.routeId];if(!a.options.loader)return!0;const l=(n.preload?a.options.preloadGcTime??this.options.defaultPreloadGcTime:a.options.gcTime??this.options.defaultGcTime)??300*1e3;return n.status==="error"?!0:Date.now()-n.updatedAt>=l};this.clearCache({filter:i})},this.loadRouteChunk=hw,this.preloadRoute=async i=>{const n=this.buildLocation(i);let a=this.matchRoutes(n,{throwOnError:!0,preload:!0,dest:i});const l=new Set([...this.state.matches,...this.state.pendingMatches??[]].map(h=>h.id)),u=new Set([...l,...this.state.cachedMatches.map(h=>h.id)]);wu(()=>{a.forEach(h=>{u.has(h.id)||this.__store.setState(f=>({...f,cachedMatches:[...f.cachedMatches,h]}))})});try{return a=await zy({router:this,matches:a,location:n,preload:!0,updateMatch:(h,f)=>{l.has(h)?a=a.map(d=>d.id===h?f(d):d):this.updateMatch(h,f)}}),a}catch(h){if(xr(h))return h.options.reloadDocument?void 0:await this.preloadRoute({...h.options,_fromLocation:n});Ys(h)||console.error(h);return}},this.matchRoute=(i,n)=>{const a={...i,to:i.to?this.resolvePathWithBase(i.from||"",i.to):void 0,params:i.params||{},leaveParams:!0},l=this.buildLocation(a);if(n?.pending&&this.state.status!=="pending")return!1;const h=(n?.pending===void 0?!this.state.isLoading:n.pending)?this.latestLocation:this.state.resolvedLocation||this.state.location,f=G2(l.pathname,n?.caseSensitive??!1,n?.fuzzy??!1,h.pathname,this.processedTree);return!f||i.params&&!Do(f.rawParams,i.params,{partial:!0})?!1:n?.includeSearch??!0?Do(h.search,l.search,{partial:!0})?f.rawParams:!1:f.rawParams},this.hasNotFoundMatch=()=>this.__store.state.matches.some(i=>i.status==="notFound"||i.globalNotFound),this.update({defaultPreloadDelay:50,defaultPendingMs:1e3,defaultPendingMinMs:500,context:void 0,...e,caseSensitive:e.caseSensitive??!1,notFoundMode:e.notFoundMode??"fuzzy",stringifySearch:e.stringifySearch??fk,parseSearch:e.parseSearch??dk}),typeof document<"u"&&(self.__TSR_ROUTER__=this)}isShell(){return!!this.options.isShell}isPrerendering(){return!!this.options.isPrerendering}get state(){return this.__store.state}get looseRoutesById(){return this.routesById}matchRoutesInternal(e,i){const n=this.getMatchedRoutes(e.pathname),{foundRoute:a,routeParams:l,parsedParams:u}=n;let{matchedRoutes:h}=n,f=!1;(a?a.path!=="/"&&l["**"]:qa(e.pathname))&&(this.options.notFoundRoute?h=[...h,this.options.notFoundRoute]:f=!0);const d=(()=>{if(f){if(this.options.notFoundMode!=="root")for(let p=h.length-1;p>=0;p--){const S=h[p];if(S.children)return S.id}return qs}})(),g=[],v=p=>p?.id?p.context??this.options.context??void 0:this.options.context??void 0;return h.forEach((p,S)=>{const y=g[S-1],[C,x,R]=(()=>{const P=y?.search??e.search,$=y?._strictSearch??void 0;try{const E=Ep(p.options.validateSearch,{...P})??void 0;return[{...P,...E},{...$,...E},void 0]}catch(E){let M=E;if(E instanceof Wd||(M=new Wd(E.message,{cause:E})),i?.throwOnError)throw M;return[P,{},M]}})(),L=p.options.loaderDeps?.({search:C})??"",N=L?JSON.stringify(L):"",{interpolatedPath:T,usedParams:W}=O_({path:p.fullPath,params:l,decodeCharMap:this.pathParamsDecodeCharMap}),D=p.id+T+N,I=this.getMatch(D),H=this.state.matches.find(P=>P.routeId===p.id),V=I?._strictParams??W;let se;if(!I)if(p.options.skipRouteOnParseError)for(const P in W)P in u&&(V[P]=u[P]);else{const P=p.options.params?.parse??p.options.parseParams;if(P)try{Object.assign(V,P(V))}catch($){if(Ys($)||xr($)?se=$:se=new kk($.message,{cause:$}),i?.throwOnError)throw se}}Object.assign(l,V);const Q=H?"stay":"enter";let A;if(I)A={...I,cause:Q,params:H?br(H.params,l):l,_strictParams:V,search:br(H?H.search:I.search,C),_strictSearch:x};else{const P=p.options.loader||p.options.beforeLoad||p.lazyFn||dw(p)?"pending":"success";A={id:D,ssr:this.isServer?void 0:p.options.ssr,index:S,routeId:p.id,params:H?br(H.params,l):l,_strictParams:V,pathname:T,updatedAt:Date.now(),search:H?br(H.search,C):C,_strictSearch:x,searchError:void 0,status:P,isFetching:!1,error:void 0,paramsError:se,__routeContext:void 0,_nonReactive:{loadPromise:ql()},__beforeLoadContext:void 0,context:{},abortController:new AbortController,fetchCount:0,cause:Q,loaderDeps:H?br(H.loaderDeps,L):L,invalid:!1,preload:!1,links:void 0,scripts:void 0,headScripts:void 0,meta:void 0,staticData:p.options.staticData||{},fullPath:p.fullPath}}i?.preload||(A.globalNotFound=d===p.id),A.searchError=R;const O=v(y);A.context={...O,...A.__routeContext,...A.__beforeLoadContext},g.push(A)}),g.forEach((p,S)=>{const y=this.looseRoutesById[p.routeId];if(!this.getMatch(p.id)&&i?._buildLocation!==!0){const x=g[S-1],R=v(x);if(y.options.context){const L={deps:p.loaderDeps,params:p.params,context:R??{},location:e,navigate:N=>this.navigate({...N,_fromLocation:e}),buildLocation:this.buildLocation,cause:p.cause,abortController:p.abortController,preload:!!p.preload,matches:g};p.__routeContext=y.options.context(L)??void 0}p.context={...R,...p.__routeContext,...p.__beforeLoadContext}}}),g}}class Wd extends Error{}class kk extends Error{}function Ek(t){return{loadedAt:0,isLoading:!1,isTransitioning:!1,status:"idle",resolvedLocation:void 0,location:t,matches:[],pendingMatches:[],cachedMatches:[],statusCode:200}}function Ep(t,e){if(t==null)return{};if("~standard"in t){const i=t["~standard"].validate(e);if(i instanceof Promise)throw new Wd("Async validation not supported");if(i.issues)throw new Wd(JSON.stringify(i.issues,void 0,2),{cause:i});return i.value}return"parse"in t?t.parse(e):typeof t=="function"?t(e):{}}function Tk({pathname:t,routesById:e,processedTree:i}){const n={},a=qa(t);let l,u;const h=K2(a,i,!0);return h&&(l=h.route,Object.assign(n,h.rawParams),u=Object.assign({},h.parsedParams)),{matchedRoutes:h?.branch||[e[qs]],routeParams:n,foundRoute:l,parsedParams:u}}function Rk({search:t,dest:e,destRoutes:i,_includeValidateSearch:n}){const a=i.reduce((h,f)=>{const d=[];if("search"in f.options)f.options.search?.middlewares&&d.push(...f.options.search.middlewares);else if(f.options.preSearchFilters||f.options.postSearchFilters){const g=({search:v,next:p})=>{let S=v;"preSearchFilters"in f.options&&f.options.preSearchFilters&&(S=f.options.preSearchFilters.reduce((C,x)=>x(C),v));const y=p(S);return"postSearchFilters"in f.options&&f.options.postSearchFilters?f.options.postSearchFilters.reduce((C,x)=>x(C),y):y};d.push(g)}if(n&&f.options.validateSearch){const g=({search:v,next:p})=>{const S=p(v);try{return{...S,...Ep(f.options.validateSearch,S)??void 0}}catch{return S}};d.push(g)}return h.concat(d)},[])??[],l=({search:h})=>e.search?e.search===!0?h:Ua(e.search,h):{};a.push(l);const u=(h,f)=>{if(h>=a.length)return f;const d=a[h];return d({search:f,next:v=>u(h+1,v)})};return u(0,t)}const Mk="Error preloading route! ☝️";class _w{constructor(e){if(this.init=i=>{this.originalIndex=i.originalIndex;const n=this.options,a=!n?.path&&!n?.id;this.parentRoute=this.options.getParentRoute?.(),a?this._path=qs:this.parentRoute||Yn(!1);let l=a?qs:n?.path;l&&l!=="/"&&(l=sw(l));const u=n?.id||l;let h=a?qs:gd([this.parentRoute.id===qs?"":this.parentRoute.id,u]);l===qs&&(l="/"),h!==qs&&(h=gd(["/",h]));const f=h===qs?"/":gd([this.parentRoute.fullPath,l]);this._path=l,this._id=h,this._fullPath=f,this._to=qa(f)},this.addChildren=i=>this._addFileChildren(i),this._addFileChildren=i=>(Array.isArray(i)&&(this.children=i),typeof i=="object"&&i!==null&&(this.children=Object.values(i)),this),this._addFileTypes=()=>this,this.updateLoader=i=>(Object.assign(this.options,i),this),this.update=i=>(Object.assign(this.options,i),this),this.lazy=i=>(this.lazyFn=i,this),this.redirect=i=>aw({from:this.fullPath,...i}),this.options=e||{},this.isRoot=!e?.getParentRoute,e?.id&&e?.path)throw new Error("Route cannot have both an 'id' and a 'path' option.")}get to(){return this._to}get id(){return this._id}get path(){return this._path}get fullPath(){return this._fullPath}}class Ak extends _w{constructor(e){super(e)}}var w=Du();const Ve=Z1(w),pw=g2({__proto__:null,default:Ve},[w]),ed=typeof window<"u"?w.useLayoutEffect:w.useEffect;function N_(t){const e=w.useRef({value:t,prev:null}),i=e.current.value;return t!==i&&(e.current={value:t,prev:i}),e.current.prev}function Lk(t,e,i={},n={}){w.useEffect(()=>{if(!t.current||n.disabled||typeof IntersectionObserver!="function")return;const a=new IntersectionObserver(([l])=>{e(l)},i);return a.observe(t.current),()=>{a.disconnect()}},[e,i,n.disabled,t])}function Dk(t){const e=w.useRef(null);return w.useImperativeHandle(t,()=>e.current,[]),e}function Dg(t){const e=t.errorComponent??af;return U.jsx(Ok,{getResetKey:t.getResetKey,onCatch:t.onCatch,children:({error:i,reset:n})=>i?w.createElement(e,{error:i,reset:n}):t.children})}class Ok extends w.Component{constructor(){super(...arguments),this.state={error:null}}static getDerivedStateFromProps(e){return{resetKey:e.getResetKey()}}static getDerivedStateFromError(e){return{error:e}}reset(){this.setState({error:null})}componentDidUpdate(e,i){i.error&&i.resetKey!==this.state.resetKey&&this.reset()}componentDidCatch(e,i){this.props.onCatch&&this.props.onCatch(e,i)}render(){return this.props.children({error:this.state.resetKey!==this.props.getResetKey()?null:this.state.error,reset:()=>{this.reset()}})}}function af({error:t}){const[e,i]=w.useState(!1);return U.jsxs("div",{style:{padding:".5rem",maxWidth:"100%"},children:[U.jsxs("div",{style:{display:"flex",alignItems:"center",gap:".5rem"},children:[U.jsx("strong",{style:{fontSize:"1rem"},children:"Something went wrong!"}),U.jsx("button",{style:{appearance:"none",fontSize:".6em",border:"1px solid currentColor",padding:".1rem .2rem",fontWeight:"bold",borderRadius:".25rem"},onClick:()=>i(n=>!n),children:e?"Hide Error":"Show Error"})]}),U.jsx("div",{style:{height:".25rem"}}),e?U.jsx("div",{children:U.jsx("pre",{style:{fontSize:".7em",border:"1px solid red",borderRadius:".25rem",padding:".3rem",color:"red",overflow:"auto"},children:t.message?U.jsx("code",{children:t.message}):null})}):null]})}function Bk({children:t,fallback:e=null}){return Nk()?U.jsx(Ve.Fragment,{children:t}):U.jsx(Ve.Fragment,{children:e})}function Nk(){return Ve.useSyncExternalStore(Pk,()=>!0,()=>!1)}function Pk(){return()=>{}}var P_={exports:{}},z_={},H_={exports:{}},I_={};var Hy;function zk(){if(Hy)return I_;Hy=1;var t=Du();function e(v,p){return v===p&&(v!==0||1/v===1/p)||v!==v&&p!==p}var i=typeof Object.is=="function"?Object.is:e,n=t.useState,a=t.useEffect,l=t.useLayoutEffect,u=t.useDebugValue;function h(v,p){var S=p(),y=n({inst:{value:S,getSnapshot:p}}),C=y[0].inst,x=y[1];return l(function(){C.value=S,C.getSnapshot=p,f(C)&&x({inst:C})},[v,S,p]),a(function(){return f(C)&&x({inst:C}),v(function(){f(C)&&x({inst:C})})},[v]),u(S),S}function f(v){var p=v.getSnapshot;v=v.value;try{var S=p();return!i(v,S)}catch{return!0}}function d(v,p){return p()}var g=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?d:h;return I_.useSyncExternalStore=t.useSyncExternalStore!==void 0?t.useSyncExternalStore:g,I_}var Iy;function Hk(){return Iy||(Iy=1,H_.exports=zk()),H_.exports}var Uy;function Ik(){if(Uy)return z_;Uy=1;var t=Du(),e=Hk();function i(d,g){return d===g&&(d!==0||1/d===1/g)||d!==d&&g!==g}var n=typeof Object.is=="function"?Object.is:i,a=e.useSyncExternalStore,l=t.useRef,u=t.useEffect,h=t.useMemo,f=t.useDebugValue;return z_.useSyncExternalStoreWithSelector=function(d,g,v,p,S){var y=l(null);if(y.current===null){var C={hasValue:!1,value:null};y.current=C}else C=y.current;y=h(function(){function R(D){if(!L){if(L=!0,N=D,D=p(D),S!==void 0&&C.hasValue){var I=C.value;if(S(I,D))return T=I}return T=D}if(I=T,n(N,D))return I;var H=p(D);return S!==void 0&&S(I,H)?(N=D,I):(N=D,T=H)}var L=!1,N,T,W=v===void 0?null:v;return[function(){return R(g())},W===null?void 0:function(){return R(W())}]},[g,v,p,S]);var x=a(d,y[0],y[1]);return u(function(){C.hasValue=!0,C.value=x},[x]),f(x),x},z_}var Fy;function Uk(){return Fy||(Fy=1,P_.exports=Ik()),P_.exports}var Fk=Uk();function $k(t,e=n=>n,i={}){const n=i.equal??Wk;return Fk.useSyncExternalStoreWithSelector(t.subscribe,()=>t.state,()=>t.state,e,n)}function Wk(t,e){if(Object.is(t,e))return!0;if(typeof t!="object"||t===null||typeof e!="object"||e===null)return!1;if(t instanceof Map&&e instanceof Map){if(t.size!==e.size)return!1;for(const[n,a]of t)if(!e.has(n)||!Object.is(a,e.get(n)))return!1;return!0}if(t instanceof Set&&e instanceof Set){if(t.size!==e.size)return!1;for(const n of t)if(!e.has(n))return!1;return!0}if(t instanceof Date&&e instanceof Date)return t.getTime()===e.getTime();const i=$y(t);if(i.length!==$y(e).length)return!1;for(let n=0;n<i.length;n++)if(!Object.prototype.hasOwnProperty.call(e,i[n])||!Object.is(t[i[n]],e[i[n]]))return!1;return!0}function $y(t){return Object.keys(t).concat(Object.getOwnPropertySymbols(t))}const U_=w.createContext(null);function gw(){return typeof document>"u"?U_:window.__TSR_ROUTER_CONTEXT__?window.__TSR_ROUTER_CONTEXT__:(window.__TSR_ROUTER_CONTEXT__=U_,U_)}function Gs(t){const e=w.useContext(gw());return t?.warn,e}function Ts(t){const e=Gs({warn:t?.router===void 0}),i=t?.router||e,n=w.useRef(void 0);return $k(i.__store,a=>{if(t?.select){if(t.structuralSharing??i.options.defaultStructuralSharing){const l=br(n.current,t.select(a));return n.current=l,l}return t.select(a)}return a})}const of=w.createContext(void 0),jk=w.createContext(void 0);function an(t){const e=w.useContext(t.from?jk:of);return Ts({select:n=>{const a=n.matches.find(l=>t.from?t.from===l.routeId:l.id===e);if(Yn(!((t.shouldThrow??!0)&&!a),`Could not find ${t.from?`an active match from "${t.from}"`:"a nearest match!"}`),a!==void 0)return t.select?t.select(a):a},structuralSharing:t.structuralSharing})}function Og(t){return an({from:t.from,strict:t.strict,structuralSharing:t.structuralSharing,select:e=>t.select?t.select(e.loaderData):e.loaderData})}function Bg(t){const{select:e,...i}=t;return an({...i,select:n=>e?e(n.loaderDeps):n.loaderDeps})}function lf(t){return an({from:t.from,shouldThrow:t.shouldThrow,structuralSharing:t.structuralSharing,strict:t.strict,select:e=>{const i=t.strict===!1?e.params:e._strictParams;return t.select?t.select(i):i}})}function Ng(t){return an({from:t.from,strict:t.strict,shouldThrow:t.shouldThrow,structuralSharing:t.structuralSharing,select:e=>t.select?t.select(e.search):e.search})}function Ou(t){const e=Gs();return w.useCallback(i=>e.navigate({...i,from:i.from??t?.from}),[t?.from,e])}var Pg=Q1();const vw=Z1(Pg);function Vk(t,e){const i=Gs(),[n,a]=w.useState(!1),l=w.useRef(!1),u=Dk(e),{activeProps:h,inactiveProps:f,activeOptions:d,to:g,preload:v,preloadDelay:p,hashScrollIntoView:S,replace:y,startTransition:C,resetScroll:x,viewTransition:R,children:L,target:N,disabled:T,style:W,className:D,onClick:I,onFocus:H,onMouseEnter:V,onMouseLeave:se,onTouchStart:Q,ignoreBlocker:A,params:O,search:P,hash:$,state:E,mask:M,reloadDocument:z,unsafeRelative:q,from:G,_fromLocation:B,...K}=t,te=Ts({select:Be=>Be.location.search,structuralSharing:!0}),ne=t.from,de=w.useMemo(()=>({...t,from:ne}),[i,te,ne,t._fromLocation,t.hash,t.to,t.search,t.params,t.state,t.mask,t.unsafeRelative]),ue=w.useMemo(()=>i.buildLocation({...de}),[i,de]),he=w.useMemo(()=>{if(T)return;let Be=ue.maskedLocation?ue.maskedLocation.url.href:ue.url.href,Xe=!1;return i.origin&&(Be.startsWith(i.origin)?Be=i.history.createHref(Be.replace(i.origin,""))||"/":Xe=!0),{href:Be,external:Xe}},[T,ue.maskedLocation,ue.url,i.origin,i.history]),Se=w.useMemo(()=>{if(he?.external)return Hd(he.href)?void 0:he.href;try{return new URL(g),Hd(g)?void 0:g}catch{}},[g,he]),we=t.reloadDocument||Se?!1:v??i.options.defaultPreload,Ee=p??i.options.defaultPreloadDelay??0,Le=Ts({select:Be=>{if(Se)return!1;if(d?.exact){if(!tk(Be.location.pathname,ue.pathname,i.basepath))return!1}else{const Xe=Ud(Be.location.pathname,i.basepath),je=Ud(ue.pathname,i.basepath);if(!(Xe.startsWith(je)&&(Xe.length===je.length||Xe[je.length]==="/")))return!1}return(d?.includeSearch??!0)&&!Do(Be.location.search,ue.search,{partial:!d?.exact,ignoreUndefined:!d?.explicitUndefined})?!1:d?.includeHash?Be.location.hash===ue.hash:!0}}),it=w.useCallback(()=>{i.preloadRoute({...de}).catch(Be=>{console.warn(Be),console.warn(Mk)})},[i,de]),Ze=w.useCallback(Be=>{Be?.isIntersecting&&it()},[it]);Lk(u,Ze,Xk,{disabled:!!T||we!=="viewport"}),w.useEffect(()=>{l.current||!T&&we==="render"&&(it(),l.current=!0)},[T,it,we]);const ke=Be=>{const Xe=Be.currentTarget.getAttribute("target"),je=N!==void 0?N:Xe;if(!T&&!Zk(Be)&&!Be.defaultPrevented&&(!je||je==="_self")&&Be.button===0){Be.preventDefault(),Pg.flushSync(()=>{a(!0)});const _t=i.subscribe("onResolved",()=>{_t(),a(!1)});i.navigate({...de,replace:y,resetScroll:x,hashScrollIntoView:S,startTransition:C,viewTransition:R,ignoreBlocker:A})}};if(Se)return{...K,ref:u,href:Se,...L&&{children:L},...N&&{target:N},...T&&{disabled:T},...W&&{style:W},...D&&{className:D},...I&&{onClick:I},...H&&{onFocus:H},...V&&{onMouseEnter:V},...se&&{onMouseLeave:se},...Q&&{onTouchStart:Q}};const ze=Be=>{T||we&&it()},pe=ze,mt=Be=>{if(!(T||!we))if(!Ee)it();else{const Xe=Be.target;if(Jc.has(Xe))return;const je=setTimeout(()=>{Jc.delete(Xe),it()},Ee);Jc.set(Xe,je)}},yt=Be=>{if(T||!we||!Ee)return;const Xe=Be.target,je=Jc.get(Xe);je&&(clearTimeout(je),Jc.delete(Xe))},ge=Le?Ua(h,{})??qk:F_,ye=Le?F_:Ua(f,{})??F_,me=[D,ge.className,ye.className].filter(Boolean).join(" "),Ut=(W||ge.style||ye.style)&&{...W,...ge.style,...ye.style};return{...K,...ge,...ye,href:he?.href,ref:u,onClick:eu([I,ke]),onFocus:eu([H,ze]),onMouseEnter:eu([V,mt]),onMouseLeave:eu([se,yt]),onTouchStart:eu([Q,pe]),disabled:!!T,target:N,...Ut&&{style:Ut},...me&&{className:me},...T&&Yk,...Le&&Gk,...n&&Kk}}const F_={},qk={className:"active"},Yk={role:"link","aria-disabled":!0},Gk={"data-status":"active","aria-current":"page"},Kk={"data-transitioning":"transitioning"},Jc=new WeakMap,Xk={rootMargin:"100px"},eu=t=>e=>{for(const i of t)if(i){if(e.defaultPrevented)return;i(e)}},Sw=w.forwardRef((t,e)=>{const{_asChild:i,...n}=t,{type:a,ref:l,...u}=Vk(n,e),h=typeof n.children=="function"?n.children({isActive:u["data-status"]==="active"}):n.children;return i===void 0&&delete u.disabled,w.createElement(i||"a",{...u,ref:l},h)});function Zk(t){return!!(t.metaKey||t.altKey||t.ctrlKey||t.shiftKey)}class Qk extends _w{constructor(e){super(e),this.useMatch=i=>an({select:i?.select,from:this.id,structuralSharing:i?.structuralSharing}),this.useRouteContext=i=>an({...i,from:this.id,select:n=>i?.select?i.select(n.context):n.context}),this.useSearch=i=>Ng({select:i?.select,structuralSharing:i?.structuralSharing,from:this.id}),this.useParams=i=>lf({select:i?.select,structuralSharing:i?.structuralSharing,from:this.id}),this.useLoaderDeps=i=>Bg({...i,from:this.id}),this.useLoaderData=i=>Og({...i,from:this.id}),this.useNavigate=()=>Ou({from:this.fullPath}),this.Link=Ve.forwardRef((i,n)=>U.jsx(Sw,{ref:n,from:this.fullPath,...i})),this.$$typeof=Symbol.for("react.memo")}}function zg(t){return new Qk(t)}class Jk extends Ak{constructor(e){super(e),this.useMatch=i=>an({select:i?.select,from:this.id,structuralSharing:i?.structuralSharing}),this.useRouteContext=i=>an({...i,from:this.id,select:n=>i?.select?i.select(n.context):n.context}),this.useSearch=i=>Ng({select:i?.select,structuralSharing:i?.structuralSharing,from:this.id}),this.useParams=i=>lf({select:i?.select,structuralSharing:i?.structuralSharing,from:this.id}),this.useLoaderDeps=i=>Bg({...i,from:this.id}),this.useLoaderData=i=>Og({...i,from:this.id}),this.useNavigate=()=>Ou({from:this.fullPath}),this.Link=Ve.forwardRef((i,n)=>U.jsx(Sw,{ref:n,from:this.fullPath,...i})),this.$$typeof=Symbol.for("react.memo")}}function eE(t){return new Jk(t)}function Wy(t){return typeof t=="object"?new jy(t,{silent:!0}).createRoute(t):new jy(t,{silent:!0}).createRoute}class jy{constructor(e,i){this.path=e,this.createRoute=n=>{this.silent;const a=zg(n);return a.isRoot=!1,a},this.silent=i?.silent}}class Vy{constructor(e){this.useMatch=i=>an({select:i?.select,from:this.options.id,structuralSharing:i?.structuralSharing}),this.useRouteContext=i=>an({from:this.options.id,select:n=>i?.select?i.select(n.context):n.context}),this.useSearch=i=>Ng({select:i?.select,structuralSharing:i?.structuralSharing,from:this.options.id}),this.useParams=i=>lf({select:i?.select,structuralSharing:i?.structuralSharing,from:this.options.id}),this.useLoaderDeps=i=>Bg({...i,from:this.options.id}),this.useLoaderData=i=>Og({...i,from:this.options.id}),this.useNavigate=()=>{const i=Gs();return Ou({from:i.routesById[this.options.id].fullPath})},this.options=e,this.$$typeof=Symbol.for("react.memo")}}function qy(t){return typeof t=="object"?new Vy(t):e=>new Vy({id:t,...e})}function tE(){const t=Gs(),e=w.useRef({router:t,mounted:!1}),[i,n]=w.useState(!1),{hasPendingMatches:a,isLoading:l}=Ts({select:v=>({isLoading:v.isLoading,hasPendingMatches:v.matches.some(p=>p.status==="pending")}),structuralSharing:!0}),u=N_(l),h=l||i||a,f=N_(h),d=l||a,g=N_(d);return t.startTransition=v=>{n(!0),w.startTransition(()=>{v(),n(!1)})},w.useEffect(()=>{const v=t.history.subscribe(t.load),p=t.buildLocation({to:t.latestLocation.pathname,search:!0,params:!0,hash:!0,state:!0,_includeValidateSearch:!0});return qa(t.latestLocation.publicHref)!==qa(p.publicHref)&&t.commitLocation({...p,replace:!0}),()=>{v()}},[t,t.history]),ed(()=>{if(typeof window<"u"&&t.ssr||e.current.router===t&&e.current.mounted)return;e.current={router:t,mounted:!0},(async()=>{try{await t.load()}catch(p){console.error(p)}})()},[t]),ed(()=>{u&&!l&&t.emit({type:"onLoad",...Oo(t.state)})},[u,t,l]),ed(()=>{g&&!d&&t.emit({type:"onBeforeRouteMount",...Oo(t.state)})},[d,g,t]),ed(()=>{if(f&&!h){const v=Oo(t.state);t.emit({type:"onResolved",...v}),t.__store.setState(p=>({...p,status:"idle",resolvedLocation:p.location})),v.hrefChanged&&ck(t)}},[h,f,t]),null}function iE(t){const e=Ts({select:i=>`not-found-${i.location.pathname}-${i.status}`});return U.jsx(Dg,{getResetKey:()=>e,onCatch:(i,n)=>{if(Ys(i))t.onCatch?.(i,n);else throw i},errorComponent:({error:i})=>{if(Ys(i))return t.fallback?.(i);throw i},children:t.children})}function sE(){return U.jsx("p",{children:"Not Found"})}function Nl(t){return U.jsx(U.Fragment,{children:t.children})}function yw(t,e,i){return e.options.notFoundComponent?U.jsx(e.options.notFoundComponent,{...i}):t.options.defaultNotFoundComponent?U.jsx(t.options.defaultNotFoundComponent,{...i}):U.jsx(sE,{})}function rE({children:t}){const e=Gs();return e.isServer?U.jsx("script",{nonce:e.options.ssr?.nonce,dangerouslySetInnerHTML:{__html:t+";document.currentScript.remove()"}}):null}function nE(){const t=Gs();if(!t.isScrollRestoring||!t.isServer||typeof t.options.scrollRestoration=="function"&&!t.options.scrollRestoration({location:t.latestLocation}))return null;const i=(t.options.getScrollRestorationKey||xp)(t.latestLocation),n=i!==xp(t.latestLocation)?i:void 0,a={storageKey:Fd,shouldScrollRestoration:!0};return n&&(a.key=n),U.jsx(rE,{children:`(${nw.toString()})(${U2(JSON.stringify(a))})`})}const bw=w.memo(function({matchId:e}){const i=Gs(),n=Ts({select:R=>{const L=R.matches.find(N=>N.id===e);return Yn(L),{routeId:L.routeId,ssr:L.ssr,_displayPending:L._displayPending}},structuralSharing:!0}),a=i.routesById[n.routeId],l=a.options.pendingComponent??i.options.defaultPendingComponent,u=l?U.jsx(l,{}):null,h=a.options.errorComponent??i.options.defaultErrorComponent,f=a.options.onCatch??i.options.defaultOnCatch,d=a.isRoot?a.options.notFoundComponent??i.options.notFoundRoute?.options.component:a.options.notFoundComponent,g=n.ssr===!1||n.ssr==="data-only",v=(!a.isRoot||a.options.wrapInSuspense||g)&&(a.options.wrapInSuspense??l??(a.options.errorComponent?.preload||g))?w.Suspense:Nl,p=h?Dg:Nl,S=d?iE:Nl,y=Ts({select:R=>R.loadedAt}),C=Ts({select:R=>{const L=R.matches.findIndex(N=>N.id===e);return R.matches[L-1]?.routeId}}),x=a.isRoot?a.options.shellComponent??Nl:Nl;return U.jsxs(x,{children:[U.jsx(of.Provider,{value:e,children:U.jsx(v,{fallback:u,children:U.jsx(p,{getResetKey:()=>y,errorComponent:h||af,onCatch:(R,L)=>{if(Ys(R))throw R;f?.(R,L)},children:U.jsx(S,{fallback:R=>{if(!d||R.routeId&&R.routeId!==n.routeId||!R.routeId&&!a.isRoot)throw R;return w.createElement(d,R)},children:g||n._displayPending?U.jsx(Bk,{fallback:u,children:U.jsx(Yy,{matchId:e})}):U.jsx(Yy,{matchId:e})})})})}),C===qs&&i.options.scrollRestoration?U.jsxs(U.Fragment,{children:[U.jsx(aE,{}),U.jsx(nE,{})]}):null]})});function aE(){const t=Gs(),e=w.useRef(void 0);return U.jsx("script",{suppressHydrationWarning:!0,ref:i=>{i&&(e.current===void 0||e.current.href!==t.latestLocation.href)&&(t.emit({type:"onRendered",...Oo(t.state)}),e.current=t.latestLocation)}},t.latestLocation.state.__TSR_key)}const Yy=w.memo(function({matchId:e}){const i=Gs(),{match:n,key:a,routeId:l}=Ts({select:f=>{const d=f.matches.find(y=>y.id===e),g=d.routeId,p=(i.routesById[g].options.remountDeps??i.options.defaultRemountDeps)?.({routeId:g,loaderDeps:d.loaderDeps,params:d._strictParams,search:d._strictSearch});return{key:p?JSON.stringify(p):void 0,routeId:g,match:{id:d.id,status:d.status,error:d.error,invalid:d.invalid,_forcePending:d._forcePending,_displayPending:d._displayPending}}},structuralSharing:!0}),u=i.routesById[l],h=w.useMemo(()=>{const f=u.options.component??i.options.defaultComponent;return f?U.jsx(f,{},a):U.jsx(ww,{})},[a,u.options.component,i.options.defaultComponent]);if(n._displayPending)throw i.getMatch(n.id)?._nonReactive.displayPendingPromise;if(n._forcePending)throw i.getMatch(n.id)?._nonReactive.minPendingPromise;if(n.status==="pending"){const f=u.options.pendingMinMs??i.options.defaultPendingMinMs;if(f){const d=i.getMatch(n.id);if(d&&!d._nonReactive.minPendingPromise&&!i.isServer){const g=ql();d._nonReactive.minPendingPromise=g,setTimeout(()=>{g.resolve(),d._nonReactive.minPendingPromise=void 0},f)}}throw i.getMatch(n.id)?._nonReactive.loadPromise}if(n.status==="notFound")return Yn(Ys(n.error)),yw(i,u,n.error);if(n.status==="redirected")throw Yn(xr(n.error)),i.getMatch(n.id)?._nonReactive.loadPromise;if(n.status==="error"){if(i.isServer){const f=(u.options.errorComponent??i.options.defaultErrorComponent)||af;return U.jsx(f,{error:n.error,reset:void 0,info:{componentStack:""}})}throw n.error}return h}),ww=w.memo(function(){const e=Gs(),i=w.useContext(of),n=Ts({select:d=>d.matches.find(g=>g.id===i)?.routeId}),a=e.routesById[n],l=Ts({select:d=>{const v=d.matches.find(p=>p.id===i);return Yn(v),v.globalNotFound}}),u=Ts({select:d=>{const g=d.matches,v=g.findIndex(p=>p.id===i);return g[v+1]?.id}}),h=e.options.defaultPendingComponent?U.jsx(e.options.defaultPendingComponent,{}):null;if(l)return yw(e,a,void 0);if(!u)return null;const f=U.jsx(bw,{matchId:u});return n===qs?U.jsx(w.Suspense,{fallback:h,children:f}):f});function oE(){const t=Gs(),i=t.routesById[qs].options.pendingComponent??t.options.defaultPendingComponent,n=i?U.jsx(i,{}):null,a=t.isServer||typeof document<"u"&&t.ssr?Nl:w.Suspense,l=U.jsxs(a,{fallback:n,children:[!t.isServer&&U.jsx(tE,{}),U.jsx(lE,{})]});return t.options.InnerWrap?U.jsx(t.options.InnerWrap,{children:l}):l}function lE(){const t=Gs(),e=Ts({select:a=>a.matches[0]?.id}),i=Ts({select:a=>a.loadedAt}),n=e?U.jsx(bw,{matchId:e}):null;return U.jsx(of.Provider,{value:e,children:t.options.disableGlobalCatchBoundary?n:U.jsx(Dg,{getResetKey:()=>i,errorComponent:af,onCatch:a=>{a.message||a.toString()},children:n})})}const cE=t=>new uE(t);class uE extends xk{constructor(e){super(e)}}typeof globalThis<"u"?(globalThis.createFileRoute=Wy,globalThis.createLazyFileRoute=qy):typeof window<"u"&&(window.createFileRoute=Wy,window.createLazyFileRoute=qy);function hE({router:t,children:e,...i}){Object.keys(i).length>0&&t.update({...t.options,...i,context:{...t.options.context,...i.context}});const n=gw(),a=U.jsx(n.Provider,{value:t,children:e});return t.options.Wrap?U.jsx(t.options.Wrap,{children:a}):a}function dE({router:t,...e}){return U.jsx(hE,{router:t,...e,children:U.jsx(oE,{})})}function Cw(){return typeof window<"u"}function xw(t){var e;return(t==null||(e=t.ownerDocument)==null?void 0:e.defaultView)||window}function fE(t){return Cw()?t instanceof Element||t instanceof xw(t).Element:!1}function mE(t){return Cw()?t instanceof HTMLElement||t instanceof xw(t).HTMLElement:!1}const Gy={};function Hg(t,e){const i=w.useRef(Gy);return i.current===Gy&&(i.current=t(e)),i}const $_=pw[`useInsertionEffect${Math.random().toFixed(1)}`.slice(0,-3)],_E=$_&&$_!==w.useLayoutEffect?$_:t=>t();function jd(t){const e=Hg(pE).current;return e.next=t,_E(e.effect),e.trampoline}function pE(){const t={next:void 0,callback:gE,trampoline:(...e)=>t.callback?.(...e),effect:()=>{t.callback=t.next}};return t}function gE(){}const vE=()=>{},Wl=typeof document<"u"?w.useLayoutEffect:vE;function Tp(t,e){if(t&&!e)return t;if(!t&&e)return e;if(t||e)return{...t,...e}}const Cu={};function kw(t,e,i,n,a){let l={...Rp(t,Cu)};return e&&(l=Sd(l,e)),i&&(l=Sd(l,i)),n&&(l=Sd(l,n)),l}function SE(t){if(t.length===0)return Cu;if(t.length===1)return Rp(t[0],Cu);let e={...Rp(t[0],Cu)};for(let i=1;i<t.length;i+=1)e=Sd(e,t[i]);return e}function Sd(t,e){return Ew(e)?e(t):yE(t,e)}function yE(t,e){if(!e)return t;for(const i in e){const n=e[i];switch(i){case"style":{t[i]=Tp(t.style,n);break}case"className":{t[i]=Tw(t.className,n);break}default:bE(i,n)?t[i]=wE(t[i],n):t[i]=n}}return t}function bE(t,e){const i=t.charCodeAt(0),n=t.charCodeAt(1),a=t.charCodeAt(2);return i===111&&n===110&&a>=65&&a<=90&&(typeof e=="function"||typeof e>"u")}function Ew(t){return typeof t=="function"}function Rp(t,e){return Ew(t)?t(e):t??Cu}function wE(t,e){return e?t?i=>{if(CE(i)){const a=i;Mp(a);const l=e(a);return a.baseUIHandlerPrevented||t?.(a),l}const n=e(i);return t?.(i),n}:e:t}function Mp(t){return t.preventBaseUIHandler=()=>{t.baseUIHandlerPrevented=!0},t}function Tw(t,e){return e?t?e+" "+t:e:t}function CE(t){return t!=null&&typeof t=="object"&&"nativeEvent"in t}function Ig(t,...e){const i=new URL("https://base-ui.com/production-error");return i.searchParams.set("code",t.toString()),e.forEach(n=>i.searchParams.append("args[]",n)),`Base UI error #${t}; visit ${i} for the full message.`}const xE=w.createContext(void 0);function kE(t=!1){const e=w.useContext(xE);if(e===void 0&&!t)throw new Error(Ig(16));return e}function EE(t){const{focusableWhenDisabled:e,disabled:i,composite:n=!1,tabIndex:a=0,isNativeButton:l}=t,u=n&&e!==!1,h=n&&e===!1;return{props:w.useMemo(()=>{const d={onKeyDown(g){i&&e&&g.key!=="Tab"&&g.preventDefault()}};return n||(d.tabIndex=a,!l&&i&&(d.tabIndex=e?a:-1)),(l&&(e||u)||!l&&i)&&(d["aria-disabled"]=i),l&&(!e||h)&&(d.disabled=i),d},[n,i,e,u,h,l,a])}}function TE(t={}){const{disabled:e=!1,focusableWhenDisabled:i,tabIndex:n=0,native:a=!0}=t,l=w.useRef(null),u=kE(!0)!==void 0,h=jd(()=>{const p=l.current;return!!(p?.tagName==="A"&&p?.href)}),{props:f}=EE({focusableWhenDisabled:i,disabled:e,composite:u,tabIndex:n,isNativeButton:a}),d=w.useCallback(()=>{const p=l.current;RE(p)&&u&&e&&f.disabled===void 0&&p.disabled&&(p.disabled=!1)},[e,f.disabled,u]);Wl(d,[d]);const g=w.useCallback((p={})=>{const{onClick:S,onMouseDown:y,onKeyUp:C,onKeyDown:x,onPointerDown:R,...L}=p;return kw({type:a?"button":void 0,onClick(T){if(e){T.preventDefault();return}S?.(T)},onMouseDown(T){e||y?.(T)},onKeyDown(T){if(e||(Mp(T),x?.(T)),T.baseUIHandlerPrevented)return;const W=T.target===T.currentTarget&&!a&&!h()&&!e,D=T.key==="Enter",I=T.key===" ";W&&((I||D)&&T.preventDefault(),D&&S?.(T))},onKeyUp(T){e||(Mp(T),C?.(T)),!T.baseUIHandlerPrevented&&T.target===T.currentTarget&&!a&&!e&&T.key===" "&&S?.(T)},onPointerDown(T){if(e){T.preventDefault();return}R?.(T)}},a?void 0:{role:"button"},f,L)},[e,f,a,h]),v=jd(p=>{l.current=p,d()});return{getButtonProps:g,buttonRef:v}}function RE(t){return mE(t)&&t.tagName==="BUTTON"}function Ky(t,e,i,n){const a=Hg(Rw).current;return AE(a,t,e,i,n)&&Mw(a,[t,e,i,n]),a.callback}function ME(t){const e=Hg(Rw).current;return LE(e,t)&&Mw(e,t),e.callback}function Rw(){return{callback:null,cleanup:null,refs:[]}}function AE(t,e,i,n,a){return t.refs[0]!==e||t.refs[1]!==i||t.refs[2]!==n||t.refs[3]!==a}function LE(t,e){return t.refs.length!==e.length||t.refs.some((i,n)=>i!==e[n])}function Mw(t,e){if(t.refs=e,e.every(i=>i==null)){t.callback=null;return}t.callback=i=>{if(t.cleanup&&(t.cleanup(),t.cleanup=null),i!=null){const n=Array(e.length).fill(null);for(let a=0;a<e.length;a+=1){const l=e[a];if(l!=null)switch(typeof l){case"function":{const u=l(i);typeof u=="function"&&(n[a]=u);break}case"object":{l.current=i;break}}}t.cleanup=()=>{for(let a=0;a<e.length;a+=1){const l=e[a];if(l!=null)switch(typeof l){case"function":{const u=n[a];typeof u=="function"?u():l(null);break}case"object":{l.current=null;break}}}}}}}const DE=parseInt(w.version,10);function OE(t){return DE>=t}function Xy(t){if(!w.isValidElement(t))return null;const e=t,i=e.props;return(OE(19)?i?.ref:e.ref)??null}function BE(t,e){const i={};for(const n in t){const a=t[n];if(e?.hasOwnProperty(n)){const l=e[n](a);l!=null&&Object.assign(i,l);continue}a===!0?i[`data-${n.toLowerCase()}`]="":a&&(i[`data-${n.toLowerCase()}`]=a.toString())}return i}function NE(t,e){return typeof t=="function"?t(e):t}function PE(t,e){return typeof t=="function"?t(e):t}function Ir(){}const $n=Object.freeze({});function Aw(t,e,i={}){const n=e.render,a=zE(e,i);if(i.enabled===!1)return null;const l=i.state??$n;return HE(t,n,a,l)}function zE(t,e={}){const{className:i,style:n,render:a}=t,{state:l=$n,ref:u,props:h,stateAttributesMapping:f,enabled:d=!0}=e,g=d?NE(i,l):void 0,v=d?PE(n,l):void 0,p=d?BE(l,f):$n,S=d?Tp(p,Array.isArray(h)?SE(h):h)??$n:$n;return typeof document<"u"&&(d?Array.isArray(u)?S.ref=ME([S.ref,Xy(a),...u]):S.ref=Ky(S.ref,Xy(a),u):Ky(null,null)),d?(g!==void 0&&(S.className=Tw(S.className,g)),v!==void 0&&(S.style=Tp(S.style,v)),S):$n}function HE(t,e,i,n){if(e){if(typeof e=="function")return e(i,n);const a=kw(i,e.props);return a.ref=i.ref,w.cloneElement(e,a)}if(t&&typeof t=="string")return IE(t,i);throw new Error(Ig(8))}function IE(t,e){return t==="button"?w.createElement("button",{type:"button",...e,key:e.key}):t==="img"?w.createElement("img",{alt:"",...e,key:e.key}):w.createElement(t,e)}const UE=w.forwardRef(function(e,i){const{render:n,className:a,disabled:l=!1,focusableWhenDisabled:u=!1,nativeButton:h=!0,...f}=e,{getButtonProps:d,buttonRef:g}=TE({disabled:l,focusableWhenDisabled:u,native:h}),v=w.useMemo(()=>({disabled:l}),[l]);return Aw("button",e,{state:v,ref:[i,g],props:[f,d]})});function Lw(t){var e,i,n="";if(typeof t=="string"||typeof t=="number")n+=t;else if(typeof t=="object")if(Array.isArray(t)){var a=t.length;for(e=0;e<a;e++)t[e]&&(i=Lw(t[e]))&&(n&&(n+=" "),n+=i)}else for(i in t)t[i]&&(n&&(n+=" "),n+=i);return n}function Dw(){for(var t,e,i=0,n="",a=arguments.length;i<a;i++)(t=arguments[i])&&(e=Lw(t))&&(n&&(n+=" "),n+=e);return n}const Zy=t=>typeof t=="boolean"?`${t}`:t===0?"0":t,Qy=Dw,FE=(t,e)=>i=>{var n;if(e?.variants==null)return Qy(t,i?.class,i?.className);const{variants:a,defaultVariants:l}=e,u=Object.keys(a).map(d=>{const g=i?.[d],v=l?.[d];if(g===null)return null;const p=Zy(g)||Zy(v);return a[d][p]}),h=i&&Object.entries(i).reduce((d,g)=>{let[v,p]=g;return p===void 0||(d[v]=p),d},{}),f=e==null||(n=e.compoundVariants)===null||n===void 0?void 0:n.reduce((d,g)=>{let{class:v,className:p,...S}=g;return Object.entries(S).every(y=>{let[C,x]=y;return Array.isArray(x)?x.includes({...l,...h}[C]):{...l,...h}[C]===x})?[...d,v,p]:d},[]);return Qy(t,u,f,i?.class,i?.className)},$E=(t,e)=>{const i=new Array(t.length+e.length);for(let n=0;n<t.length;n++)i[n]=t[n];for(let n=0;n<e.length;n++)i[t.length+n]=e[n];return i},WE=(t,e)=>({classGroupId:t,validator:e}),Ow=(t=new Map,e=null,i)=>({nextPart:t,validators:e,classGroupId:i}),Vd="-",Jy=[],jE="arbitrary..",VE=t=>{const e=YE(t),{conflictingClassGroups:i,conflictingClassGroupModifiers:n}=t;return{getClassGroupId:u=>{if(u.startsWith("[")&&u.endsWith("]"))return qE(u);const h=u.split(Vd),f=h[0]===""&&h.length>1?1:0;return Bw(h,f,e)},getConflictingClassGroupIds:(u,h)=>{if(h){const f=n[u],d=i[u];return f?d?$E(d,f):f:d||Jy}return i[u]||Jy}}},Bw=(t,e,i)=>{if(t.length-e===0)return i.classGroupId;const a=t[e],l=i.nextPart.get(a);if(l){const d=Bw(t,e+1,l);if(d)return d}const u=i.validators;if(u===null)return;const h=e===0?t.join(Vd):t.slice(e).join(Vd),f=u.length;for(let d=0;d<f;d++){const g=u[d];if(g.validator(h))return g.classGroupId}},qE=t=>t.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const e=t.slice(1,-1),i=e.indexOf(":"),n=e.slice(0,i);return n?jE+n:void 0})(),YE=t=>{const{theme:e,classGroups:i}=t;return GE(i,e)},GE=(t,e)=>{const i=Ow();for(const n in t){const a=t[n];Ug(a,i,n,e)}return i},Ug=(t,e,i,n)=>{const a=t.length;for(let l=0;l<a;l++){const u=t[l];KE(u,e,i,n)}},KE=(t,e,i,n)=>{if(typeof t=="string"){XE(t,e,i);return}if(typeof t=="function"){ZE(t,e,i,n);return}QE(t,e,i,n)},XE=(t,e,i)=>{const n=t===""?e:Nw(e,t);n.classGroupId=i},ZE=(t,e,i,n)=>{if(JE(t)){Ug(t(n),e,i,n);return}e.validators===null&&(e.validators=[]),e.validators.push(WE(i,t))},QE=(t,e,i,n)=>{const a=Object.entries(t),l=a.length;for(let u=0;u<l;u++){const[h,f]=a[u];Ug(f,Nw(e,h),i,n)}},Nw=(t,e)=>{let i=t;const n=e.split(Vd),a=n.length;for(let l=0;l<a;l++){const u=n[l];let h=i.nextPart.get(u);h||(h=Ow(),i.nextPart.set(u,h)),i=h}return i},JE=t=>"isThemeGetter"in t&&t.isThemeGetter===!0,eT=t=>{if(t<1)return{get:()=>{},set:()=>{}};let e=0,i=Object.create(null),n=Object.create(null);const a=(l,u)=>{i[l]=u,e++,e>t&&(e=0,n=i,i=Object.create(null))};return{get(l){let u=i[l];if(u!==void 0)return u;if((u=n[l])!==void 0)return a(l,u),u},set(l,u){l in i?i[l]=u:a(l,u)}}},Ap="!",eb=":",tT=[],tb=(t,e,i,n,a)=>({modifiers:t,hasImportantModifier:e,baseClassName:i,maybePostfixModifierPosition:n,isExternal:a}),iT=t=>{const{prefix:e,experimentalParseClassName:i}=t;let n=a=>{const l=[];let u=0,h=0,f=0,d;const g=a.length;for(let C=0;C<g;C++){const x=a[C];if(u===0&&h===0){if(x===eb){l.push(a.slice(f,C)),f=C+1;continue}if(x==="/"){d=C;continue}}x==="["?u++:x==="]"?u--:x==="("?h++:x===")"&&h--}const v=l.length===0?a:a.slice(f);let p=v,S=!1;v.endsWith(Ap)?(p=v.slice(0,-1),S=!0):v.startsWith(Ap)&&(p=v.slice(1),S=!0);const y=d&&d>f?d-f:void 0;return tb(l,S,p,y)};if(e){const a=e+eb,l=n;n=u=>u.startsWith(a)?l(u.slice(a.length)):tb(tT,!1,u,void 0,!0)}if(i){const a=n;n=l=>i({className:l,parseClassName:a})}return n},sT=t=>{const e=new Map;return t.orderSensitiveModifiers.forEach((i,n)=>{e.set(i,1e6+n)}),i=>{const n=[];let a=[];for(let l=0;l<i.length;l++){const u=i[l],h=u[0]==="[",f=e.has(u);h||f?(a.length>0&&(a.sort(),n.push(...a),a=[]),n.push(u)):a.push(u)}return a.length>0&&(a.sort(),n.push(...a)),n}},rT=t=>({cache:eT(t.cacheSize),parseClassName:iT(t),sortModifiers:sT(t),...VE(t)}),nT=/\s+/,aT=(t,e)=>{const{parseClassName:i,getClassGroupId:n,getConflictingClassGroupIds:a,sortModifiers:l}=e,u=[],h=t.trim().split(nT);let f="";for(let d=h.length-1;d>=0;d-=1){const g=h[d],{isExternal:v,modifiers:p,hasImportantModifier:S,baseClassName:y,maybePostfixModifierPosition:C}=i(g);if(v){f=g+(f.length>0?" "+f:f);continue}let x=!!C,R=n(x?y.substring(0,C):y);if(!R){if(!x){f=g+(f.length>0?" "+f:f);continue}if(R=n(y),!R){f=g+(f.length>0?" "+f:f);continue}x=!1}const L=p.length===0?"":p.length===1?p[0]:l(p).join(":"),N=S?L+Ap:L,T=N+R;if(u.indexOf(T)>-1)continue;u.push(T);const W=a(R,x);for(let D=0;D<W.length;++D){const I=W[D];u.push(N+I)}f=g+(f.length>0?" "+f:f)}return f},oT=(...t)=>{let e=0,i,n,a="";for(;e<t.length;)(i=t[e++])&&(n=Pw(i))&&(a&&(a+=" "),a+=n);return a},Pw=t=>{if(typeof t=="string")return t;let e,i="";for(let n=0;n<t.length;n++)t[n]&&(e=Pw(t[n]))&&(i&&(i+=" "),i+=e);return i},lT=(t,...e)=>{let i,n,a,l;const u=f=>{const d=e.reduce((g,v)=>v(g),t());return i=rT(d),n=i.cache.get,a=i.cache.set,l=h,h(f)},h=f=>{const d=n(f);if(d)return d;const g=aT(f,i);return a(f,g),g};return l=u,(...f)=>l(oT(...f))},cT=[],wi=t=>{const e=i=>i[t]||cT;return e.isThemeGetter=!0,e},zw=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,Hw=/^\((?:(\w[\w-]*):)?(.+)\)$/i,uT=/^\d+\/\d+$/,hT=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,dT=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,fT=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,mT=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,_T=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Al=t=>uT.test(t),rt=t=>!!t&&!Number.isNaN(Number(t)),Aa=t=>!!t&&Number.isInteger(Number(t)),W_=t=>t.endsWith("%")&&rt(t.slice(0,-1)),Bn=t=>hT.test(t),pT=()=>!0,gT=t=>dT.test(t)&&!fT.test(t),Iw=()=>!1,vT=t=>mT.test(t),ST=t=>_T.test(t),yT=t=>!Me(t)&&!Ae(t),bT=t=>Kl(t,$w,Iw),Me=t=>zw.test(t),Co=t=>Kl(t,Ww,gT),j_=t=>Kl(t,ET,rt),ib=t=>Kl(t,Uw,Iw),wT=t=>Kl(t,Fw,ST),td=t=>Kl(t,jw,vT),Ae=t=>Hw.test(t),tu=t=>Xl(t,Ww),CT=t=>Xl(t,TT),sb=t=>Xl(t,Uw),xT=t=>Xl(t,$w),kT=t=>Xl(t,Fw),id=t=>Xl(t,jw,!0),Kl=(t,e,i)=>{const n=zw.exec(t);return n?n[1]?e(n[1]):i(n[2]):!1},Xl=(t,e,i=!1)=>{const n=Hw.exec(t);return n?n[1]?e(n[1]):i:!1},Uw=t=>t==="position"||t==="percentage",Fw=t=>t==="image"||t==="url",$w=t=>t==="length"||t==="size"||t==="bg-size",Ww=t=>t==="length",ET=t=>t==="number",TT=t=>t==="family-name",jw=t=>t==="shadow",RT=()=>{const t=wi("color"),e=wi("font"),i=wi("text"),n=wi("font-weight"),a=wi("tracking"),l=wi("leading"),u=wi("breakpoint"),h=wi("container"),f=wi("spacing"),d=wi("radius"),g=wi("shadow"),v=wi("inset-shadow"),p=wi("text-shadow"),S=wi("drop-shadow"),y=wi("blur"),C=wi("perspective"),x=wi("aspect"),R=wi("ease"),L=wi("animate"),N=()=>["auto","avoid","all","avoid-page","page","left","right","column"],T=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],W=()=>[...T(),Ae,Me],D=()=>["auto","hidden","clip","visible","scroll"],I=()=>["auto","contain","none"],H=()=>[Ae,Me,f],V=()=>[Al,"full","auto",...H()],se=()=>[Aa,"none","subgrid",Ae,Me],Q=()=>["auto",{span:["full",Aa,Ae,Me]},Aa,Ae,Me],A=()=>[Aa,"auto",Ae,Me],O=()=>["auto","min","max","fr",Ae,Me],P=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],$=()=>["start","end","center","stretch","center-safe","end-safe"],E=()=>["auto",...H()],M=()=>[Al,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...H()],z=()=>[t,Ae,Me],q=()=>[...T(),sb,ib,{position:[Ae,Me]}],G=()=>["no-repeat",{repeat:["","x","y","space","round"]}],B=()=>["auto","cover","contain",xT,bT,{size:[Ae,Me]}],K=()=>[W_,tu,Co],te=()=>["","none","full",d,Ae,Me],ne=()=>["",rt,tu,Co],de=()=>["solid","dashed","dotted","double"],ue=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],he=()=>[rt,W_,sb,ib],Se=()=>["","none",y,Ae,Me],we=()=>["none",rt,Ae,Me],Ee=()=>["none",rt,Ae,Me],Le=()=>[rt,Ae,Me],it=()=>[Al,"full",...H()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[Bn],breakpoint:[Bn],color:[pT],container:[Bn],"drop-shadow":[Bn],ease:["in","out","in-out"],font:[yT],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[Bn],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[Bn],shadow:[Bn],spacing:["px",rt],text:[Bn],"text-shadow":[Bn],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",Al,Me,Ae,x]}],container:["container"],columns:[{columns:[rt,Me,Ae,h]}],"break-after":[{"break-after":N()}],"break-before":[{"break-before":N()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:W()}],overflow:[{overflow:D()}],"overflow-x":[{"overflow-x":D()}],"overflow-y":[{"overflow-y":D()}],overscroll:[{overscroll:I()}],"overscroll-x":[{"overscroll-x":I()}],"overscroll-y":[{"overscroll-y":I()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:V()}],"inset-x":[{"inset-x":V()}],"inset-y":[{"inset-y":V()}],start:[{start:V()}],end:[{end:V()}],top:[{top:V()}],right:[{right:V()}],bottom:[{bottom:V()}],left:[{left:V()}],visibility:["visible","invisible","collapse"],z:[{z:[Aa,"auto",Ae,Me]}],basis:[{basis:[Al,"full","auto",h,...H()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[rt,Al,"auto","initial","none",Me]}],grow:[{grow:["",rt,Ae,Me]}],shrink:[{shrink:["",rt,Ae,Me]}],order:[{order:[Aa,"first","last","none",Ae,Me]}],"grid-cols":[{"grid-cols":se()}],"col-start-end":[{col:Q()}],"col-start":[{"col-start":A()}],"col-end":[{"col-end":A()}],"grid-rows":[{"grid-rows":se()}],"row-start-end":[{row:Q()}],"row-start":[{"row-start":A()}],"row-end":[{"row-end":A()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":O()}],"auto-rows":[{"auto-rows":O()}],gap:[{gap:H()}],"gap-x":[{"gap-x":H()}],"gap-y":[{"gap-y":H()}],"justify-content":[{justify:[...P(),"normal"]}],"justify-items":[{"justify-items":[...$(),"normal"]}],"justify-self":[{"justify-self":["auto",...$()]}],"align-content":[{content:["normal",...P()]}],"align-items":[{items:[...$(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...$(),{baseline:["","last"]}]}],"place-content":[{"place-content":P()}],"place-items":[{"place-items":[...$(),"baseline"]}],"place-self":[{"place-self":["auto",...$()]}],p:[{p:H()}],px:[{px:H()}],py:[{py:H()}],ps:[{ps:H()}],pe:[{pe:H()}],pt:[{pt:H()}],pr:[{pr:H()}],pb:[{pb:H()}],pl:[{pl:H()}],m:[{m:E()}],mx:[{mx:E()}],my:[{my:E()}],ms:[{ms:E()}],me:[{me:E()}],mt:[{mt:E()}],mr:[{mr:E()}],mb:[{mb:E()}],ml:[{ml:E()}],"space-x":[{"space-x":H()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":H()}],"space-y-reverse":["space-y-reverse"],size:[{size:M()}],w:[{w:[h,"screen",...M()]}],"min-w":[{"min-w":[h,"screen","none",...M()]}],"max-w":[{"max-w":[h,"screen","none","prose",{screen:[u]},...M()]}],h:[{h:["screen","lh",...M()]}],"min-h":[{"min-h":["screen","lh","none",...M()]}],"max-h":[{"max-h":["screen","lh",...M()]}],"font-size":[{text:["base",i,tu,Co]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[n,Ae,j_]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",W_,Me]}],"font-family":[{font:[CT,Me,e]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[a,Ae,Me]}],"line-clamp":[{"line-clamp":[rt,"none",Ae,j_]}],leading:[{leading:[l,...H()]}],"list-image":[{"list-image":["none",Ae,Me]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",Ae,Me]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:z()}],"text-color":[{text:z()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...de(),"wavy"]}],"text-decoration-thickness":[{decoration:[rt,"from-font","auto",Ae,Co]}],"text-decoration-color":[{decoration:z()}],"underline-offset":[{"underline-offset":[rt,"auto",Ae,Me]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:H()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",Ae,Me]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",Ae,Me]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:q()}],"bg-repeat":[{bg:G()}],"bg-size":[{bg:B()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},Aa,Ae,Me],radial:["",Ae,Me],conic:[Aa,Ae,Me]},kT,wT]}],"bg-color":[{bg:z()}],"gradient-from-pos":[{from:K()}],"gradient-via-pos":[{via:K()}],"gradient-to-pos":[{to:K()}],"gradient-from":[{from:z()}],"gradient-via":[{via:z()}],"gradient-to":[{to:z()}],rounded:[{rounded:te()}],"rounded-s":[{"rounded-s":te()}],"rounded-e":[{"rounded-e":te()}],"rounded-t":[{"rounded-t":te()}],"rounded-r":[{"rounded-r":te()}],"rounded-b":[{"rounded-b":te()}],"rounded-l":[{"rounded-l":te()}],"rounded-ss":[{"rounded-ss":te()}],"rounded-se":[{"rounded-se":te()}],"rounded-ee":[{"rounded-ee":te()}],"rounded-es":[{"rounded-es":te()}],"rounded-tl":[{"rounded-tl":te()}],"rounded-tr":[{"rounded-tr":te()}],"rounded-br":[{"rounded-br":te()}],"rounded-bl":[{"rounded-bl":te()}],"border-w":[{border:ne()}],"border-w-x":[{"border-x":ne()}],"border-w-y":[{"border-y":ne()}],"border-w-s":[{"border-s":ne()}],"border-w-e":[{"border-e":ne()}],"border-w-t":[{"border-t":ne()}],"border-w-r":[{"border-r":ne()}],"border-w-b":[{"border-b":ne()}],"border-w-l":[{"border-l":ne()}],"divide-x":[{"divide-x":ne()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":ne()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...de(),"hidden","none"]}],"divide-style":[{divide:[...de(),"hidden","none"]}],"border-color":[{border:z()}],"border-color-x":[{"border-x":z()}],"border-color-y":[{"border-y":z()}],"border-color-s":[{"border-s":z()}],"border-color-e":[{"border-e":z()}],"border-color-t":[{"border-t":z()}],"border-color-r":[{"border-r":z()}],"border-color-b":[{"border-b":z()}],"border-color-l":[{"border-l":z()}],"divide-color":[{divide:z()}],"outline-style":[{outline:[...de(),"none","hidden"]}],"outline-offset":[{"outline-offset":[rt,Ae,Me]}],"outline-w":[{outline:["",rt,tu,Co]}],"outline-color":[{outline:z()}],shadow:[{shadow:["","none",g,id,td]}],"shadow-color":[{shadow:z()}],"inset-shadow":[{"inset-shadow":["none",v,id,td]}],"inset-shadow-color":[{"inset-shadow":z()}],"ring-w":[{ring:ne()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:z()}],"ring-offset-w":[{"ring-offset":[rt,Co]}],"ring-offset-color":[{"ring-offset":z()}],"inset-ring-w":[{"inset-ring":ne()}],"inset-ring-color":[{"inset-ring":z()}],"text-shadow":[{"text-shadow":["none",p,id,td]}],"text-shadow-color":[{"text-shadow":z()}],opacity:[{opacity:[rt,Ae,Me]}],"mix-blend":[{"mix-blend":[...ue(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":ue()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[rt]}],"mask-image-linear-from-pos":[{"mask-linear-from":he()}],"mask-image-linear-to-pos":[{"mask-linear-to":he()}],"mask-image-linear-from-color":[{"mask-linear-from":z()}],"mask-image-linear-to-color":[{"mask-linear-to":z()}],"mask-image-t-from-pos":[{"mask-t-from":he()}],"mask-image-t-to-pos":[{"mask-t-to":he()}],"mask-image-t-from-color":[{"mask-t-from":z()}],"mask-image-t-to-color":[{"mask-t-to":z()}],"mask-image-r-from-pos":[{"mask-r-from":he()}],"mask-image-r-to-pos":[{"mask-r-to":he()}],"mask-image-r-from-color":[{"mask-r-from":z()}],"mask-image-r-to-color":[{"mask-r-to":z()}],"mask-image-b-from-pos":[{"mask-b-from":he()}],"mask-image-b-to-pos":[{"mask-b-to":he()}],"mask-image-b-from-color":[{"mask-b-from":z()}],"mask-image-b-to-color":[{"mask-b-to":z()}],"mask-image-l-from-pos":[{"mask-l-from":he()}],"mask-image-l-to-pos":[{"mask-l-to":he()}],"mask-image-l-from-color":[{"mask-l-from":z()}],"mask-image-l-to-color":[{"mask-l-to":z()}],"mask-image-x-from-pos":[{"mask-x-from":he()}],"mask-image-x-to-pos":[{"mask-x-to":he()}],"mask-image-x-from-color":[{"mask-x-from":z()}],"mask-image-x-to-color":[{"mask-x-to":z()}],"mask-image-y-from-pos":[{"mask-y-from":he()}],"mask-image-y-to-pos":[{"mask-y-to":he()}],"mask-image-y-from-color":[{"mask-y-from":z()}],"mask-image-y-to-color":[{"mask-y-to":z()}],"mask-image-radial":[{"mask-radial":[Ae,Me]}],"mask-image-radial-from-pos":[{"mask-radial-from":he()}],"mask-image-radial-to-pos":[{"mask-radial-to":he()}],"mask-image-radial-from-color":[{"mask-radial-from":z()}],"mask-image-radial-to-color":[{"mask-radial-to":z()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":T()}],"mask-image-conic-pos":[{"mask-conic":[rt]}],"mask-image-conic-from-pos":[{"mask-conic-from":he()}],"mask-image-conic-to-pos":[{"mask-conic-to":he()}],"mask-image-conic-from-color":[{"mask-conic-from":z()}],"mask-image-conic-to-color":[{"mask-conic-to":z()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:q()}],"mask-repeat":[{mask:G()}],"mask-size":[{mask:B()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",Ae,Me]}],filter:[{filter:["","none",Ae,Me]}],blur:[{blur:Se()}],brightness:[{brightness:[rt,Ae,Me]}],contrast:[{contrast:[rt,Ae,Me]}],"drop-shadow":[{"drop-shadow":["","none",S,id,td]}],"drop-shadow-color":[{"drop-shadow":z()}],grayscale:[{grayscale:["",rt,Ae,Me]}],"hue-rotate":[{"hue-rotate":[rt,Ae,Me]}],invert:[{invert:["",rt,Ae,Me]}],saturate:[{saturate:[rt,Ae,Me]}],sepia:[{sepia:["",rt,Ae,Me]}],"backdrop-filter":[{"backdrop-filter":["","none",Ae,Me]}],"backdrop-blur":[{"backdrop-blur":Se()}],"backdrop-brightness":[{"backdrop-brightness":[rt,Ae,Me]}],"backdrop-contrast":[{"backdrop-contrast":[rt,Ae,Me]}],"backdrop-grayscale":[{"backdrop-grayscale":["",rt,Ae,Me]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[rt,Ae,Me]}],"backdrop-invert":[{"backdrop-invert":["",rt,Ae,Me]}],"backdrop-opacity":[{"backdrop-opacity":[rt,Ae,Me]}],"backdrop-saturate":[{"backdrop-saturate":[rt,Ae,Me]}],"backdrop-sepia":[{"backdrop-sepia":["",rt,Ae,Me]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":H()}],"border-spacing-x":[{"border-spacing-x":H()}],"border-spacing-y":[{"border-spacing-y":H()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",Ae,Me]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[rt,"initial",Ae,Me]}],ease:[{ease:["linear","initial",R,Ae,Me]}],delay:[{delay:[rt,Ae,Me]}],animate:[{animate:["none",L,Ae,Me]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[C,Ae,Me]}],"perspective-origin":[{"perspective-origin":W()}],rotate:[{rotate:we()}],"rotate-x":[{"rotate-x":we()}],"rotate-y":[{"rotate-y":we()}],"rotate-z":[{"rotate-z":we()}],scale:[{scale:Ee()}],"scale-x":[{"scale-x":Ee()}],"scale-y":[{"scale-y":Ee()}],"scale-z":[{"scale-z":Ee()}],"scale-3d":["scale-3d"],skew:[{skew:Le()}],"skew-x":[{"skew-x":Le()}],"skew-y":[{"skew-y":Le()}],transform:[{transform:[Ae,Me,"","none","gpu","cpu"]}],"transform-origin":[{origin:W()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:it()}],"translate-x":[{"translate-x":it()}],"translate-y":[{"translate-y":it()}],"translate-z":[{"translate-z":it()}],"translate-none":["translate-none"],accent:[{accent:z()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:z()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",Ae,Me]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":H()}],"scroll-mx":[{"scroll-mx":H()}],"scroll-my":[{"scroll-my":H()}],"scroll-ms":[{"scroll-ms":H()}],"scroll-me":[{"scroll-me":H()}],"scroll-mt":[{"scroll-mt":H()}],"scroll-mr":[{"scroll-mr":H()}],"scroll-mb":[{"scroll-mb":H()}],"scroll-ml":[{"scroll-ml":H()}],"scroll-p":[{"scroll-p":H()}],"scroll-px":[{"scroll-px":H()}],"scroll-py":[{"scroll-py":H()}],"scroll-ps":[{"scroll-ps":H()}],"scroll-pe":[{"scroll-pe":H()}],"scroll-pt":[{"scroll-pt":H()}],"scroll-pr":[{"scroll-pr":H()}],"scroll-pb":[{"scroll-pb":H()}],"scroll-pl":[{"scroll-pl":H()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",Ae,Me]}],fill:[{fill:["none",...z()]}],"stroke-w":[{stroke:[rt,tu,Co,j_]}],stroke:[{stroke:["none",...z()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},MT=lT(RT);function Vw(...t){return MT(Dw(t))}const AT=FE("focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:aria-invalid:border-destructive/50 rounded-md border border-transparent bg-clip-padding text-sm font-medium focus-visible:ring-[3px] aria-invalid:ring-[3px] [&_svg:not([class*='size-'])]:size-4 inline-flex items-center justify-center whitespace-nowrap transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none shrink-0 [&_svg]:shrink-0 outline-none group/button select-none",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/80",outline:"border-border bg-background hover:bg-muted hover:text-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50 aria-expanded:bg-muted aria-expanded:text-foreground shadow-xs",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80 aria-expanded:bg-secondary aria-expanded:text-secondary-foreground",ghost:"hover:bg-muted hover:text-foreground dark:hover:bg-muted/50 aria-expanded:bg-muted aria-expanded:text-foreground",toolbar:"hover:bg-input hover:text-foreground aria-expanded:bg-input aria-expanded:text-foreground",destructive:"bg-destructive/10 hover:bg-destructive/20 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/20 text-destructive focus-visible:border-destructive/40 dark:hover:bg-destructive/30",link:"text-primary underline-offset-4 hover:underline",headless:"border-0 bg-transparent rounded-none font-normal text-[inherit] whitespace-normal transition-none justify-start"},size:{default:"h-9 gap-1.5 px-2.5 in-data-[slot=button-group]:rounded-md has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2",xs:"h-6 gap-1 rounded-md px-2 text-xs in-data-[slot=button-group]:rounded-md has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3",sm:"h-8 gap-1 rounded-md px-2.5 in-data-[slot=button-group]:rounded-md has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5",lg:"h-10 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-3 has-data-[icon=inline-start]:pl-3",icon:"size-9","icon-xs":"size-6 rounded-md in-data-[slot=button-group]:rounded-md [&_svg:not([class*='size-'])]:size-3","icon-sm":"size-8 rounded-md in-data-[slot=button-group]:rounded-md","icon-lg":"size-10",headless:"h-auto w-auto gap-0 p-0"}},defaultVariants:{variant:"default",size:"default"}});function yd({className:t,variant:e="default",size:i="default",...n}){return U.jsx(UE,{"data-slot":"button",className:Vw(AT({variant:e,size:i,className:t})),...n})}let rb=(function(t){return t.disabled="data-disabled",t.valid="data-valid",t.invalid="data-invalid",t.touched="data-touched",t.dirty="data-dirty",t.filled="data-filled",t.focused="data-focused",t})({});const LT={badInput:!1,customError:!1,patternMismatch:!1,rangeOverflow:!1,rangeUnderflow:!1,stepMismatch:!1,tooLong:!1,tooShort:!1,typeMismatch:!1,valid:null,valueMissing:!1},DT={valid(t){return t===null?null:t?{[rb.valid]:""}:{[rb.invalid]:""}}},OT=w.createContext({invalid:void 0,name:void 0,validityData:{state:LT,errors:[],error:"",value:"",initialValue:null},setValidityData:Ir,disabled:void 0,touched:!1,setTouched:Ir,dirty:!1,setDirty:Ir,filled:!1,setFilled:Ir,focused:!1,setFocused:Ir,validate:()=>null,validationMode:"onSubmit",validationDebounceTime:0,shouldValidateOnChange:()=>!1,state:{disabled:!1,valid:null,touched:!1,dirty:!1,filled:!1,focused:!1},markedDirtyRef:{current:!1},validation:{getValidationProps:(t=$n)=>t,getInputValidationProps:(t=$n)=>t,inputRef:{current:null},commit:async()=>{}}});function Lp(t=!0){const e=w.useContext(OT);if(e.setValidityData===Ir&&!t)throw new Error(Ig(28));return e}const BT=w.createContext({formRef:{current:{fields:new Map}},errors:{},clearErrors:Ir,validationMode:"onSubmit",submitAttemptedRef:{current:!1}});function NT(){return w.useContext(BT)}const PT={...pw};let nb=0;function zT(t,e="mui"){const[i,n]=w.useState(t),a=t||i;return w.useEffect(()=>{i==null&&(nb+=1,n(`${e}-${nb}`))},[i,e]),a}const ab=PT.useId;function HT(t,e){if(ab!==void 0){const i=ab();return t??(e?`${e}-${i}`:i)}return zT(t,e)}function IT(t){return HT(t,"base-ui")}const UT=w.createContext({controlId:void 0,setControlId:Ir,labelId:void 0,setLabelId:Ir,messageIds:[],setMessageIds:Ir,getDescriptionProps:t=>t});function qw(){return w.useContext(UT)}function FT(t,e){return{...t,state:{...t.state,valid:!e&&t.state.valid}}}function $T({controlled:t,default:e,name:i,state:n="value"}){const{current:a}=w.useRef(t!==void 0),[l,u]=w.useState(e),h=a?t:l,f=w.useCallback(d=>{a||u(d)},[]);return[h,f]}function WT(t={}){const{id:e,implicit:i=!1,controlRef:n}=t,{controlId:a,setControlId:l}=qw(),u=IT(e);return Wl(()=>{if(!(!i&&!e||l===Ir)){if(i){const h=n?.current;fE(h)&&h.closest("label")!=null?l(e??null):l(a??u)}else e&&l(e);return()=>{e&&l(void 0)}}},[e,n,a,l,i,u]),a??u}function jT(t){const{enabled:e=!0,value:i,id:n,name:a,controlRef:l,commit:u}=t,{formRef:h}=NT(),{invalid:f,markedDirtyRef:d,validityData:g,setValidityData:v}=Lp(),p=jd(t.getValue);Wl(()=>{if(!e)return;let S=i;S===void 0&&(S=p()),g.initialValue===null&&S!==null&&v(y=>({...y,initialValue:S}))},[e,v,i,g.initialValue,p]),Wl(()=>{!e||!n||h.current.fields.set(n,{getValue:p,name:a,controlRef:l,validityData:FT(g,f),validate(S=!0){let y=i;y===void 0&&(y=p()),d.current=!0,S?Pg.flushSync(()=>u(y)):u(y)}})},[u,l,e,h,p,n,f,d,a,g,i]),Wl(()=>{const S=h.current.fields;return()=>{n&&S.delete(n)}},[h,n])}const VT="none";function qT(t,e,i,n){let a=!1,l=!1;const u=$n;return{reason:t,event:e??new Event("base-ui"),cancel(){a=!0},allowPropagation(){l=!0},get isCanceled(){return a},get isPropagationAllowed(){return l},trigger:i,...u}}const YT=w.forwardRef(function(e,i){const{render:n,className:a,id:l,name:u,value:h,disabled:f=!1,onValueChange:d,defaultValue:g,...v}=e,{state:p,name:S,disabled:y}=Lp(),C=y||f,x=S??u,R=w.useMemo(()=>({...p,disabled:C}),[p,C]),{setTouched:L,setDirty:N,validityData:T,setFocused:W,setFilled:D,validationMode:I,validation:H}=Lp(),{labelId:V}=qw(),se=WT({id:l});Wl(()=>{const E=h!=null;H.inputRef.current?.value||E&&h!==""?D(!0):E&&h===""&&D(!1)},[H.inputRef,D,h]);const[Q,A]=$T({controlled:h,default:g,name:"FieldControl",state:"value"}),O=h!==void 0,P=jd((E,M)=>{d?.(E,M),!M.isCanceled&&A(E)});return jT({id:se,name:x,commit:H.commit,value:Q,getValue:()=>H.inputRef.current?.value,controlRef:H.inputRef}),Aw("input",e,{ref:i,state:R,props:[{id:se,disabled:C,name:x,ref:H.inputRef,"aria-labelledby":V,...O?{value:Q}:{defaultValue:g},onChange(E){const M=E.currentTarget.value;P(M,qT(VT,E.nativeEvent)),N(M!==T.initialValue),D(M!=="")},onFocus(){W(!0)},onBlur(E){L(!0),W(!1),I==="onBlur"&&H.commit(E.currentTarget.value)},onKeyDown(E){E.currentTarget.tagName==="INPUT"&&E.key==="Enter"&&(L(!0),H.commit(E.currentTarget.value))}},H.getInputValidationProps(),v],stateAttributesMapping:DT})}),GT=w.forwardRef(function(e,i){return U.jsx(YT,{ref:i,...e})});function KT({className:t,type:e,...i}){return U.jsx(GT,{type:e,"data-slot":"input",className:Vw("dark:bg-input/30 border-input focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:aria-invalid:border-destructive/50 h-9 rounded-md border bg-transparent px-2.5 py-1 text-base shadow-xs transition-[color,box-shadow] file:h-7 file:text-sm file:font-medium focus-visible:ring-[3px] aria-invalid:ring-[3px] file:text-foreground placeholder:text-muted-foreground w-full min-w-0 outline-none file:inline-flex file:border-0 file:bg-transparent disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50",t),...i})}function ob(){return typeof window>"u"?"light":window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}function XT({getStoredTheme:t,setStoredTheme:e}){const[i,n]=w.useState("system"),[a,l]=w.useState(!0),u=w.useRef(null);w.useEffect(()=>{Promise.resolve(t()).then(d=>{(d==="light"||d==="dark"||d==="system")&&n(d),l(!1)})},[t]);const h=i==="system"?ob():i;w.useEffect(()=>{if(a||u.current===h)return;u.current=h;const d=document.documentElement;d.classList.remove("light","dark"),d.classList.add(h)},[h,a]),w.useEffect(()=>{if(i!=="system")return;const d=window.matchMedia("(prefers-color-scheme: dark)"),g=()=>{const v=ob();if(u.current===v)return;u.current=v;const p=document.documentElement;p.classList.remove("light","dark"),p.classList.add(v)};return d.addEventListener("change",g),()=>d.removeEventListener("change",g)},[i]);const f=w.useCallback(async d=>{n(d),await e(d)},[e]);return w.useMemo(()=>({theme:i,setTheme:f,resolvedTheme:h,isLoading:a}),[i,f,h,a])}var Yw=Object.defineProperty,ZT=Object.getOwnPropertyDescriptor,QT=(t,e)=>{for(var i in e)Yw(t,i,{get:e[i],enumerable:!0})},si=(t,e,i,n)=>{for(var a=n>1?void 0:n?ZT(e,i):e,l=t.length-1,u;l>=0;l--)(u=t[l])&&(a=(n?u(e,i,a):u(a))||a);return n&&a&&Yw(e,i,a),a},xe=(t,e)=>(i,n)=>e(i,n,t),lb="Terminal input",Dp={get:()=>lb,set:t=>lb=t},cb="Too much output to announce, navigate to rows manually to read",Op={get:()=>cb,set:t=>cb=t};function JT(t){return t.replace(/\r?\n/g,"\r")}function eR(t,e){return e?"\x1B[200~"+t+"\x1B[201~":t}function tR(t,e){t.clipboardData&&t.clipboardData.setData("text/plain",e.selectionText),t.preventDefault()}function iR(t,e,i,n){if(t.stopPropagation(),t.clipboardData){let a=t.clipboardData.getData("text/plain");Gw(a,e,i,n)}}function Gw(t,e,i,n){t=JT(t),t=eR(t,i.decPrivateModes.bracketedPasteMode&&n.rawOptions.ignoreBracketedPasteMode!==!0),i.triggerDataEvent(t,!0),e.value=""}function Kw(t,e,i){let n=i.getBoundingClientRect(),a=t.clientX-n.left-10,l=t.clientY-n.top-10;e.style.width="20px",e.style.height="20px",e.style.left=`${a}px`,e.style.top=`${l}px`,e.style.zIndex="1000",e.focus()}function ub(t,e,i,n,a){Kw(t,e,i),a&&n.rightClickSelect(t),e.value=n.selectionText,e.select()}function Ia(t){return t>65535?(t-=65536,String.fromCharCode((t>>10)+55296)+String.fromCharCode(t%1024+56320)):String.fromCharCode(t)}function cf(t,e=0,i=t.length){let n="";for(let a=e;a<i;++a){let l=t[a];l>65535?(l-=65536,n+=String.fromCharCode((l>>10)+55296)+String.fromCharCode(l%1024+56320)):n+=String.fromCharCode(l)}return n}var sR=class{constructor(){this._interim=0}clear(){this._interim=0}decode(e,i){let n=e.length;if(!n)return 0;let a=0,l=0;if(this._interim){let u=e.charCodeAt(l++);56320<=u&&u<=57343?i[a++]=(this._interim-55296)*1024+u-56320+65536:(i[a++]=this._interim,i[a++]=u),this._interim=0}for(let u=l;u<n;++u){let h=e.charCodeAt(u);if(55296<=h&&h<=56319){if(++u>=n)return this._interim=h,a;let f=e.charCodeAt(u);56320<=f&&f<=57343?i[a++]=(h-55296)*1024+f-56320+65536:(i[a++]=h,i[a++]=f);continue}h!==65279&&(i[a++]=h)}return a}},rR=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(e,i){let n=e.length;if(!n)return 0;let a=0,l,u,h,f,d=0,g=0;if(this.interim[0]){let S=!1,y=this.interim[0];y&=(y&224)===192?31:(y&240)===224?15:7;let C=0,x;for(;(x=this.interim[++C]&63)&&C<4;)y<<=6,y|=x;let R=(this.interim[0]&224)===192?2:(this.interim[0]&240)===224?3:4,L=R-C;for(;g<L;){if(g>=n)return 0;if(x=e[g++],(x&192)!==128){g--,S=!0;break}else this.interim[C++]=x,y<<=6,y|=x&63}S||(R===2?y<128?g--:i[a++]=y:R===3?y<2048||y>=55296&&y<=57343||y===65279||(i[a++]=y):y<65536||y>1114111||(i[a++]=y)),this.interim.fill(0)}let v=n-4,p=g;for(;p<n;){for(;p<v&&!((l=e[p])&128)&&!((u=e[p+1])&128)&&!((h=e[p+2])&128)&&!((f=e[p+3])&128);)i[a++]=l,i[a++]=u,i[a++]=h,i[a++]=f,p+=4;if(l=e[p++],l<128)i[a++]=l;else if((l&224)===192){if(p>=n)return this.interim[0]=l,a;if(u=e[p++],(u&192)!==128){p--;continue}if(d=(l&31)<<6|u&63,d<128){p--;continue}i[a++]=d}else if((l&240)===224){if(p>=n)return this.interim[0]=l,a;if(u=e[p++],(u&192)!==128){p--;continue}if(p>=n)return this.interim[0]=l,this.interim[1]=u,a;if(h=e[p++],(h&192)!==128){p--;continue}if(d=(l&15)<<12|(u&63)<<6|h&63,d<2048||d>=55296&&d<=57343||d===65279)continue;i[a++]=d}else if((l&248)===240){if(p>=n)return this.interim[0]=l,a;if(u=e[p++],(u&192)!==128){p--;continue}if(p>=n)return this.interim[0]=l,this.interim[1]=u,a;if(h=e[p++],(h&192)!==128){p--;continue}if(p>=n)return this.interim[0]=l,this.interim[1]=u,this.interim[2]=h,a;if(f=e[p++],(f&192)!==128){p--;continue}if(d=(l&7)<<18|(u&63)<<12|(h&63)<<6|f&63,d<65536||d>1114111)continue;i[a++]=d}}return a}},Xw="",$a=" ",Bu=class Zw{constructor(){this.fg=0,this.bg=0,this.extended=new qd}static toColorRGB(e){return[e>>>16&255,e>>>8&255,e&255]}static fromColorRGB(e){return(e[0]&255)<<16|(e[1]&255)<<8|e[2]&255}clone(){let e=new Zw;return e.fg=this.fg,e.bg=this.bg,e.extended=this.extended.clone(),e}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}},qd=class Qw{constructor(e=0,i=0){this._ext=0,this._urlId=0,this._ext=e,this._urlId=i}get ext(){return this._urlId?this._ext&-469762049|this.underlineStyle<<26:this._ext}set ext(e){this._ext=e}get underlineStyle(){return this._urlId?5:(this._ext&469762048)>>26}set underlineStyle(e){this._ext&=-469762049,this._ext|=e<<26&469762048}get underlineColor(){return this._ext&67108863}set underlineColor(e){this._ext&=-67108864,this._ext|=e&67108863}get urlId(){return this._urlId}set urlId(e){this._urlId=e}get underlineVariantOffset(){let e=(this._ext&3758096384)>>29;return e<0?e^4294967288:e}set underlineVariantOffset(e){this._ext&=536870911,this._ext|=e<<29&3758096384}clone(){return new Qw(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}},kr=class Jw extends Bu{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new qd,this.combinedData=""}static fromCharData(e){let i=new Jw;return i.setFromCharData(e),i}isCombined(){return this.content&2097152}getWidth(){return this.content>>22}getChars(){return this.content&2097152?this.combinedData:this.content&2097151?Ia(this.content&2097151):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):this.content&2097151}setFromCharData(e){this.fg=e[0],this.bg=0;let i=!1;if(e[1].length>2)i=!0;else if(e[1].length===2){let n=e[1].charCodeAt(0);if(55296<=n&&n<=56319){let a=e[1].charCodeAt(1);56320<=a&&a<=57343?this.content=(n-55296)*1024+a-56320+65536|e[2]<<22:i=!0}else i=!0}else this.content=e[1].charCodeAt(0)|e[2]<<22;i&&(this.combinedData=e[1],this.content=2097152|e[2]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},hb="di$target",Bp="di$dependencies",V_=new Map;function nR(t){return t[Bp]||[]}function Ii(t){if(V_.has(t))return V_.get(t);let e=function(i,n,a){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");aR(e,i,a)};return e._id=t,V_.set(t,e),e}function aR(t,e,i){e[hb]===e?e[Bp].push({id:t,index:i}):(e[Bp]=[{id:t,index:i}],e[hb]=e)}var fs=Ii("BufferService"),eC=Ii("CoreMouseService"),Wo=Ii("CoreService"),oR=Ii("CharsetService"),Fg=Ii("InstantiationService"),tC=Ii("LogService"),ms=Ii("OptionsService"),iC=Ii("OscLinkService"),lR=Ii("UnicodeService"),Nu=Ii("DecorationService"),Np=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 a=[],l=this._optionsService.rawOptions.linkHandler,u=new kr,h=n.getTrimmedLength(),f=-1,d=-1,g=!1;for(let v=0;v<h;v++)if(!(d===-1&&!n.hasContent(v))){if(n.loadCell(v,u),u.hasExtendedAttrs()&&u.extended.urlId)if(d===-1){d=v,f=u.extended.urlId;continue}else g=u.extended.urlId!==f;else d!==-1&&(g=!0);if(g||d!==-1&&v===h-1){let p=this._oscLinkService.getLinkData(f)?.uri;if(p){let S={start:{x:d+1,y:e},end:{x:v+(!g&&v===h-1?1:0),y:e}},y=!1;if(!l?.allowNonHttpProtocols)try{let C=new URL(p);["http:","https:"].includes(C.protocol)||(y=!0)}catch{y=!0}y||a.push({text:p,range:S,activate:(C,x)=>l?l.activate(C,x,S):cR(C,x),hover:(C,x)=>l?.hover?.(C,x,S),leave:(C,x)=>l?.leave?.(C,x,S)})}g=!1,u.hasExtendedAttrs()&&u.extended.urlId?(d=v,f=u.extended.urlId):(d=-1,f=-1)}}i(a)}};Np=si([xe(0,fs),xe(1,ms),xe(2,iC)],Np);function cR(t,e){if(confirm(`Do you want to navigate to ${e}?
10
+
11
+ WARNING: This link could potentially be dangerous`)){let i=window.open();if(i){try{i.opener=null}catch{}i.location.href=e}else console.warn("Opening link blocked as opener could not be cleared")}}var uf=Ii("CharSizeService"),Gn=Ii("CoreBrowserService"),$g=Ii("MouseService"),Kn=Ii("RenderService"),uR=Ii("SelectionService"),sC=Ii("CharacterJoinerService"),Zl=Ii("ThemeService"),rC=Ii("LinkProviderService"),hR=class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?db.isErrorNoTelemetry(e)?new db(e.message+`
12
+
13
+ `+e.stack):new Error(e.message+`
14
+
15
+ `+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)}},dR=new hR;function bd(t){fR(t)||dR.onUnexpectedError(t)}var Pp="Canceled";function fR(t){return t instanceof mR?!0:t instanceof Error&&t.name===Pp&&t.message===Pp}var mR=class extends Error{constructor(){super(Pp),this.name=this.message}};function _R(t){return new Error(`Illegal argument: ${t}`)}var db=class zp extends Error{constructor(e){super(e),this.name="CodeExpectedError"}static fromError(e){if(e instanceof zp)return e;let i=new zp;return i.message=e.message,i.stack=e.stack,i}static isErrorNoTelemetry(e){return e.name==="CodeExpectedError"}},Hp=class nC extends Error{constructor(e){super(e||"An unexpected bug occurred."),Object.setPrototypeOf(this,nC.prototype)}};function $s(t,e=0){return t[t.length-(1+e)]}var pR;(t=>{function e(l){return l<0}t.isLessThan=e;function i(l){return l<=0}t.isLessThanOrEqual=i;function n(l){return l>0}t.isGreaterThan=n;function a(l){return l===0}t.isNeitherLessOrGreaterThan=a,t.greaterThan=1,t.lessThan=-1,t.neitherLessOrGreaterThan=0})(pR||={});function gR(t,e){let i=this,n=!1,a;return function(){return n||(n=!0,e||(a=t.apply(i,arguments))),a}}var aC;(t=>{function e(T){return T&&typeof T=="object"&&typeof T[Symbol.iterator]=="function"}t.is=e;let i=Object.freeze([]);function n(){return i}t.empty=n;function*a(T){yield T}t.single=a;function l(T){return e(T)?T:a(T)}t.wrap=l;function u(T){return T||i}t.from=u;function*h(T){for(let W=T.length-1;W>=0;W--)yield T[W]}t.reverse=h;function f(T){return!T||T[Symbol.iterator]().next().done===!0}t.isEmpty=f;function d(T){return T[Symbol.iterator]().next().value}t.first=d;function g(T,W){let D=0;for(let I of T)if(W(I,D++))return!0;return!1}t.some=g;function v(T,W){for(let D of T)if(W(D))return D}t.find=v;function*p(T,W){for(let D of T)W(D)&&(yield D)}t.filter=p;function*S(T,W){let D=0;for(let I of T)yield W(I,D++)}t.map=S;function*y(T,W){let D=0;for(let I of T)yield*W(I,D++)}t.flatMap=y;function*C(...T){for(let W of T)yield*W}t.concat=C;function x(T,W,D){let I=D;for(let H of T)I=W(I,H);return I}t.reduce=x;function*R(T,W,D=T.length){for(W<0&&(W+=T.length),D<0?D+=T.length:D>T.length&&(D=T.length);W<D;W++)yield T[W]}t.slice=R;function L(T,W=Number.POSITIVE_INFINITY){let D=[];if(W===0)return[D,T];let I=T[Symbol.iterator]();for(let H=0;H<W;H++){let V=I.next();if(V.done)return[D,t.empty()];D.push(V.value)}return[D,{[Symbol.iterator](){return I}}]}t.consume=L;async function N(T){let W=[];for await(let D of T)W.push(D);return Promise.resolve(W)}t.asyncToArray=N})(aC||={});function Uo(t){if(aC.is(t)){let e=[];for(let i of t)if(i)try{i.dispose()}catch(n){e.push(n)}if(e.length===1)throw e[0];if(e.length>1)throw new AggregateError(e,"Encountered errors while disposing of store");return Array.isArray(t)?[]:t}else if(t)return t.dispose(),t}function vR(...t){return jt(()=>Uo(t))}function jt(t){return{dispose:gR(()=>{t()})}}var oC=class lC{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{Uo(this._toDispose)}finally{this._toDispose.clear()}}add(e){if(!e)return e;if(e===this)throw new Error("Cannot register a disposable on itself!");return this._isDisposed?lC.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(e),e}delete(e){if(e){if(e===this)throw new Error("Cannot dispose a disposable on itself!");this._toDispose.delete(e),e.dispose()}}deleteAndLeak(e){e&&this._toDispose.has(e)&&(this._toDispose.delete(e),void 0)}};oC.DISABLE_DISPOSED_WARNING=!1;var Ya=oC,nt=class{constructor(){this._store=new Ya,this._store}dispose(){this._store.dispose()}_register(e){if(e===this)throw new Error("Cannot register a disposable on itself!");return this._store.add(e)}};nt.None=Object.freeze({dispose(){}});var Gl=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(e){this._isDisposed||e===this._value||(this._value?.dispose(),this._value=e)}clear(){this.value=void 0}dispose(){this._isDisposed=!0,this._value?.dispose(),this._value=void 0}clearAndLeak(){let e=this._value;return this._value=void 0,e}},jn=typeof window=="object"?window:globalThis,Ip=class Up{constructor(e){this.element=e,this.next=Up.Undefined,this.prev=Up.Undefined}};Ip.Undefined=new Ip(void 0);var Yt=Ip,fb=class{constructor(){this._first=Yt.Undefined,this._last=Yt.Undefined,this._size=0}get size(){return this._size}isEmpty(){return this._first===Yt.Undefined}clear(){let e=this._first;for(;e!==Yt.Undefined;){let i=e.next;e.prev=Yt.Undefined,e.next=Yt.Undefined,e=i}this._first=Yt.Undefined,this._last=Yt.Undefined,this._size=0}unshift(e){return this._insert(e,!1)}push(e){return this._insert(e,!0)}_insert(e,i){let n=new Yt(e);if(this._first===Yt.Undefined)this._first=n,this._last=n;else if(i){let l=this._last;this._last=n,n.prev=l,l.next=n}else{let l=this._first;this._first=n,n.next=l,l.prev=n}this._size+=1;let a=!1;return()=>{a||(a=!0,this._remove(n))}}shift(){if(this._first!==Yt.Undefined){let e=this._first.element;return this._remove(this._first),e}}pop(){if(this._last!==Yt.Undefined){let e=this._last.element;return this._remove(this._last),e}}_remove(e){if(e.prev!==Yt.Undefined&&e.next!==Yt.Undefined){let i=e.prev;i.next=e.next,e.next.prev=i}else e.prev===Yt.Undefined&&e.next===Yt.Undefined?(this._first=Yt.Undefined,this._last=Yt.Undefined):e.next===Yt.Undefined?(this._last=this._last.prev,this._last.next=Yt.Undefined):e.prev===Yt.Undefined&&(this._first=this._first.next,this._first.prev=Yt.Undefined);this._size-=1}*[Symbol.iterator](){let e=this._first;for(;e!==Yt.Undefined;)yield e.element,e=e.next}},SR=globalThis.performance&&typeof globalThis.performance.now=="function",yR=class cC{static create(e){return new cC(e)}constructor(e){this._now=SR&&e===!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}},Qi;(t=>{t.None=()=>nt.None;function e(A,O){return v(A,()=>{},0,void 0,!0,void 0,O)}t.defer=e;function i(A){return(O,P=null,$)=>{let E=!1,M;return M=A(z=>{if(!E)return M?M.dispose():E=!0,O.call(P,z)},null,$),E&&M.dispose(),M}}t.once=i;function n(A,O,P){return d(($,E=null,M)=>A(z=>$.call(E,O(z)),null,M),P)}t.map=n;function a(A,O,P){return d(($,E=null,M)=>A(z=>{O(z),$.call(E,z)},null,M),P)}t.forEach=a;function l(A,O,P){return d(($,E=null,M)=>A(z=>O(z)&&$.call(E,z),null,M),P)}t.filter=l;function u(A){return A}t.signal=u;function h(...A){return(O,P=null,$)=>{let E=vR(...A.map(M=>M(z=>O.call(P,z))));return g(E,$)}}t.any=h;function f(A,O,P,$){let E=P;return n(A,M=>(E=O(E,M),E),$)}t.reduce=f;function d(A,O){let P,$={onWillAddFirstListener(){P=A(E.fire,E)},onDidRemoveLastListener(){P?.dispose()}},E=new ve($);return O?.add(E),E.event}function g(A,O){return O instanceof Array?O.push(A):O&&O.add(A),A}function v(A,O,P=100,$=!1,E=!1,M,z){let q,G,B,K=0,te,ne={leakWarningThreshold:M,onWillAddFirstListener(){q=A(ue=>{K++,G=O(G,ue),$&&!B&&(de.fire(G),G=void 0),te=()=>{let he=G;G=void 0,B=void 0,(!$||K>1)&&de.fire(he),K=0},typeof P=="number"?(clearTimeout(B),B=setTimeout(te,P)):B===void 0&&(B=0,queueMicrotask(te))})},onWillRemoveListener(){E&&K>0&&te?.()},onDidRemoveLastListener(){te=void 0,q.dispose()}},de=new ve(ne);return z?.add(de),de.event}t.debounce=v;function p(A,O=0,P){return t.debounce(A,($,E)=>$?($.push(E),$):[E],O,void 0,!0,void 0,P)}t.accumulate=p;function S(A,O=($,E)=>$===E,P){let $=!0,E;return l(A,M=>{let z=$||!O(M,E);return $=!1,E=M,z},P)}t.latch=S;function y(A,O,P){return[t.filter(A,O,P),t.filter(A,$=>!O($),P)]}t.split=y;function C(A,O=!1,P=[],$){let E=P.slice(),M=A(G=>{E?E.push(G):q.fire(G)});$&&$.add(M);let z=()=>{E?.forEach(G=>q.fire(G)),E=null},q=new ve({onWillAddFirstListener(){M||(M=A(G=>q.fire(G)),$&&$.add(M))},onDidAddFirstListener(){E&&(O?setTimeout(z):z())},onDidRemoveLastListener(){M&&M.dispose(),M=null}});return $&&$.add(q),q.event}t.buffer=C;function x(A,O){return(P,$,E)=>{let M=O(new L);return A(function(z){let q=M.evaluate(z);q!==R&&P.call($,q)},void 0,E)}}t.chain=x;let R=Symbol("HaltChainable");class L{constructor(){this.steps=[]}map(O){return this.steps.push(O),this}forEach(O){return this.steps.push(P=>(O(P),P)),this}filter(O){return this.steps.push(P=>O(P)?P:R),this}reduce(O,P){let $=P;return this.steps.push(E=>($=O($,E),$)),this}latch(O=(P,$)=>P===$){let P=!0,$;return this.steps.push(E=>{let M=P||!O(E,$);return P=!1,$=E,M?E:R}),this}evaluate(O){for(let P of this.steps)if(O=P(O),O===R)break;return O}}function N(A,O,P=$=>$){let $=(...q)=>z.fire(P(...q)),E=()=>A.on(O,$),M=()=>A.removeListener(O,$),z=new ve({onWillAddFirstListener:E,onDidRemoveLastListener:M});return z.event}t.fromNodeEventEmitter=N;function T(A,O,P=$=>$){let $=(...q)=>z.fire(P(...q)),E=()=>A.addEventListener(O,$),M=()=>A.removeEventListener(O,$),z=new ve({onWillAddFirstListener:E,onDidRemoveLastListener:M});return z.event}t.fromDOMEventEmitter=T;function W(A){return new Promise(O=>i(A)(O))}t.toPromise=W;function D(A){let O=new ve;return A.then(P=>{O.fire(P)},()=>{O.fire(void 0)}).finally(()=>{O.dispose()}),O.event}t.fromPromise=D;function I(A,O){return A(P=>O.fire(P))}t.forward=I;function H(A,O,P){return O(P),A($=>O($))}t.runAndSubscribe=H;class V{constructor(O,P){this._observable=O,this._counter=0,this._hasChanged=!1;let $={onWillAddFirstListener:()=>{O.addObserver(this)},onDidRemoveLastListener:()=>{O.removeObserver(this)}};this.emitter=new ve($),P&&P.add(this.emitter)}beginUpdate(O){this._counter++}handlePossibleChange(O){}handleChange(O,P){this._hasChanged=!0}endUpdate(O){this._counter--,this._counter===0&&(this._observable.reportChanges(),this._hasChanged&&(this._hasChanged=!1,this.emitter.fire(this._observable.get())))}}function se(A,O){return new V(A,O).emitter.event}t.fromObservable=se;function Q(A){return(O,P,$)=>{let E=0,M=!1,z={beginUpdate(){E++},endUpdate(){E--,E===0&&(A.reportChanges(),M&&(M=!1,O.call(P)))},handlePossibleChange(){},handleChange(){M=!0}};A.addObserver(z),A.reportChanges();let q={dispose(){A.removeObserver(z)}};return $ instanceof Ya?$.add(q):Array.isArray($)&&$.push(q),q}}t.fromObservableLight=Q})(Qi||={});var Fp=class $p{constructor(e){this.listenerCount=0,this.invocationCount=0,this.elapsedOverall=0,this.durations=[],this.name=`${e}_${$p._idPool++}`,$p.all.add(this)}start(e){this._stopWatch=new yR,this.listenerCount=e}stop(){if(this._stopWatch){let e=this._stopWatch.elapsed();this.durations.push(e),this.elapsedOverall+=e,this.invocationCount+=1,this._stopWatch=void 0}}};Fp.all=new Set,Fp._idPool=0;var bR=Fp,wR=-1,uC=class hC{constructor(e,i,n=(hC._idPool++).toString(16).padStart(3,"0")){this._errorHandler=e,this.threshold=i,this.name=n,this._warnCountdown=0}dispose(){this._stacks?.clear()}check(e,i){let n=this.threshold;if(n<=0||i<n)return;this._stacks||(this._stacks=new Map);let a=this._stacks.get(e.value)||0;if(this._stacks.set(e.value,a+1),this._warnCountdown-=1,this._warnCountdown<=0){this._warnCountdown=n*.5;let[l,u]=this.getMostFrequentStack(),h=`[${this.name}] potential listener LEAK detected, having ${i} listeners already. MOST frequent listener (${u}):`;console.warn(h),console.warn(l);let f=new kR(h,l);this._errorHandler(f)}return()=>{let l=this._stacks.get(e.value)||0;this._stacks.set(e.value,l-1)}}getMostFrequentStack(){if(!this._stacks)return;let e,i=0;for(let[n,a]of this._stacks)(!e||i<a)&&(e=[n,a],i=a);return e}};uC._idPool=1;var CR=uC,xR=class dC{constructor(e){this.value=e}static create(){let e=new Error;return new dC(e.stack??"")}print(){console.warn(this.value.split(`
16
+ `).slice(2).join(`
17
+ `))}},kR=class extends Error{constructor(t,e){super(t),this.name="ListenerLeakError",this.stack=e}},ER=class extends Error{constructor(t,e){super(t),this.name="ListenerRefusalError",this.stack=e}},TR=0,q_=class{constructor(e){this.value=e,this.id=TR++}},RR=2,MR,ve=class{constructor(e){this._size=0,this._options=e,this._leakageMon=this._options?.leakWarningThreshold?new CR(e?.onListenerError??bd,this._options?.leakWarningThreshold??wR):void 0,this._perfMon=this._options?._profName?new bR(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??=(e,i,n)=>{if(this._leakageMon&&this._size>this._leakageMon.threshold**2){let h=`[${this._leakageMon.name}] REFUSES to accept new listeners because it exceeded its threshold by far (${this._size} vs ${this._leakageMon.threshold})`;console.warn(h);let f=this._leakageMon.getMostFrequentStack()??["UNKNOWN stack",-1],d=new ER(`${h}. HINT: Stack shows most frequent listener (${f[1]}-times)`,f[0]);return(this._options?.onListenerError||bd)(d),nt.None}if(this._disposed)return nt.None;i&&(e=e.bind(i));let a=new q_(e),l;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(a.stack=xR.create(),l=this._leakageMon.check(a.stack,this._size+1)),this._listeners?this._listeners instanceof q_?(this._deliveryQueue??=new AR,this._listeners=[this._listeners,a]):this._listeners.push(a):(this._options?.onWillAddFirstListener?.(this),this._listeners=a,this._options?.onDidAddFirstListener?.(this)),this._size++;let u=jt(()=>{l?.(),this._removeListener(a)});return n instanceof Ya?n.add(u):Array.isArray(n)&&n.push(u),u},this._event}_removeListener(e){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 i=this._listeners,n=i.indexOf(e);if(n===-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--,i[n]=void 0;let a=this._deliveryQueue.current===this;if(this._size*RR<=i.length){let l=0;for(let u=0;u<i.length;u++)i[u]?i[l++]=i[u]:a&&(this._deliveryQueue.end--,l<this._deliveryQueue.i&&this._deliveryQueue.i--);i.length=l}}_deliver(e,i){if(!e)return;let n=this._options?.onListenerError||bd;if(!n){e.value(i);return}try{e.value(i)}catch(a){n(a)}}_deliverQueue(e){let i=e.current._listeners;for(;e.i<e.end;)this._deliver(i[e.i++],e.value);e.reset()}fire(e){if(this._deliveryQueue?.current&&(this._deliverQueue(this._deliveryQueue),this._perfMon?.stop()),this._perfMon?.start(this._size),this._listeners)if(this._listeners instanceof q_)this._deliver(this._listeners,e);else{let i=this._deliveryQueue;i.enqueue(this,e,this._listeners.length),this._deliverQueue(i)}this._perfMon?.stop()}hasListeners(){return this._size>0}},AR=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}},Wp=class{constructor(){this.mapWindowIdToZoomLevel=new Map,this._onDidChangeZoomLevel=new ve,this.onDidChangeZoomLevel=this._onDidChangeZoomLevel.event,this.mapWindowIdToZoomFactor=new Map,this._onDidChangeFullscreen=new ve,this.onDidChangeFullscreen=this._onDidChangeFullscreen.event,this.mapWindowIdToFullScreen=new Map}getZoomLevel(e){return this.mapWindowIdToZoomLevel.get(this.getWindowId(e))??0}setZoomLevel(e,i){if(this.getZoomLevel(i)===e)return;let n=this.getWindowId(i);this.mapWindowIdToZoomLevel.set(n,e),this._onDidChangeZoomLevel.fire(n)}getZoomFactor(e){return this.mapWindowIdToZoomFactor.get(this.getWindowId(e))??1}setZoomFactor(e,i){this.mapWindowIdToZoomFactor.set(this.getWindowId(i),e)}setFullscreen(e,i){if(this.isFullscreen(i)===e)return;let n=this.getWindowId(i);this.mapWindowIdToFullScreen.set(n,e),this._onDidChangeFullscreen.fire(n)}isFullscreen(e){return!!this.mapWindowIdToFullScreen.get(this.getWindowId(e))}getWindowId(e){return e.vscodeWindowId}};Wp.INSTANCE=new Wp;var Wg=Wp;function LR(t,e,i){typeof e=="string"&&(e=t.matchMedia(e)),e.addEventListener("change",i)}Wg.INSTANCE.onDidChangeZoomLevel;function DR(t){return Wg.INSTANCE.getZoomFactor(t)}Wg.INSTANCE.onDidChangeFullscreen;var Ql=typeof navigator=="object"?navigator.userAgent:"",jp=Ql.indexOf("Firefox")>=0,OR=Ql.indexOf("AppleWebKit")>=0,jg=Ql.indexOf("Chrome")>=0,BR=!jg&&Ql.indexOf("Safari")>=0;Ql.indexOf("Electron/")>=0;Ql.indexOf("Android")>=0;var Y_=!1;if(typeof jn.matchMedia=="function"){let t=jn.matchMedia("(display-mode: standalone) or (display-mode: window-controls-overlay)"),e=jn.matchMedia("(display-mode: fullscreen)");Y_=t.matches,LR(jn,t,({matches:i})=>{Y_&&e.matches||(Y_=i)})}var Hl="en",Vp=!1,qp=!1,wd=!1,fC=!1,sd,Cd=Hl,mb=Hl,NR,In,Bo=globalThis,js;typeof Bo.vscode<"u"&&typeof Bo.vscode.process<"u"?js=Bo.vscode.process:typeof process<"u"&&typeof process?.versions?.node=="string"&&(js=process);var PR=typeof js?.versions?.electron=="string",zR=PR&&js?.type==="renderer";if(typeof js=="object"){Vp=js.platform==="win32",qp=js.platform==="darwin",wd=js.platform==="linux",wd&&js.env.SNAP&&js.env.SNAP_REVISION,js.env.CI||js.env.BUILD_ARTIFACTSTAGINGDIRECTORY,sd=Hl,Cd=Hl;let t=js.env.VSCODE_NLS_CONFIG;if(t)try{let e=JSON.parse(t);sd=e.userLocale,mb=e.osLocale,Cd=e.resolvedLanguage||Hl,NR=e.languagePack?.translationsConfigFile}catch{}fC=!0}else typeof navigator=="object"&&!zR?(In=navigator.userAgent,Vp=In.indexOf("Windows")>=0,qp=In.indexOf("Macintosh")>=0,(In.indexOf("Macintosh")>=0||In.indexOf("iPad")>=0||In.indexOf("iPhone")>=0)&&navigator.maxTouchPoints&&navigator.maxTouchPoints>0,wd=In.indexOf("Linux")>=0,In?.indexOf("Mobi")>=0,Cd=globalThis._VSCODE_NLS_LANGUAGE||Hl,sd=navigator.language.toLowerCase(),mb=sd):console.error("Unable to resolve platform.");var mC=Vp,rn=qp,HR=wd,_b=fC,on=In,La=Cd,IR;(t=>{function e(){return La}t.value=e;function i(){return La.length===2?La==="en":La.length>=3?La[0]==="e"&&La[1]==="n"&&La[2]==="-":!1}t.isDefaultVariant=i;function n(){return La==="en"}t.isDefault=n})(IR||={});var UR=typeof Bo.postMessage=="function"&&!Bo.importScripts;(()=>{if(UR){let t=[];Bo.addEventListener("message",i=>{if(i.data&&i.data.vscodeScheduleAsyncWork)for(let n=0,a=t.length;n<a;n++){let l=t[n];if(l.id===i.data.vscodeScheduleAsyncWork){t.splice(n,1),l.callback();return}}});let e=0;return i=>{let n=++e;t.push({id:n,callback:i}),Bo.postMessage({vscodeScheduleAsyncWork:n},"*")}}return t=>setTimeout(t)})();var FR=!!(on&&on.indexOf("Chrome")>=0);on&&on.indexOf("Firefox")>=0;!FR&&on&&on.indexOf("Safari")>=0;on&&on.indexOf("Edg/")>=0;on&&on.indexOf("Android")>=0;var Ll=typeof navigator=="object"?navigator:{};_b||document.queryCommandSupported&&document.queryCommandSupported("copy")||Ll&&Ll.clipboard&&Ll.clipboard.writeText,_b||Ll&&Ll.clipboard&&Ll.clipboard.readText;var Vg=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}},G_=new Vg,pb=new Vg,gb=new Vg,$R=new Array(230),_C;(t=>{function e(h){return G_.keyCodeToStr(h)}t.toString=e;function i(h){return G_.strToKeyCode(h)}t.fromString=i;function n(h){return pb.keyCodeToStr(h)}t.toUserSettingsUS=n;function a(h){return gb.keyCodeToStr(h)}t.toUserSettingsGeneral=a;function l(h){return pb.strToKeyCode(h)||gb.strToKeyCode(h)}t.fromUserSettings=l;function u(h){if(h>=98&&h<=113)return null;switch(h){case 16:return"Up";case 18:return"Down";case 15:return"Left";case 17:return"Right"}return G_.keyCodeToStr(h)}t.toElectronAccelerator=u})(_C||={});var WR=class pC{constructor(e,i,n,a,l){this.ctrlKey=e,this.shiftKey=i,this.altKey=n,this.metaKey=a,this.keyCode=l}equals(e){return e instanceof pC&&this.ctrlKey===e.ctrlKey&&this.shiftKey===e.shiftKey&&this.altKey===e.altKey&&this.metaKey===e.metaKey&&this.keyCode===e.keyCode}getHashCode(){let e=this.ctrlKey?"1":"0",i=this.shiftKey?"1":"0",n=this.altKey?"1":"0",a=this.metaKey?"1":"0";return`K${e}${i}${n}${a}${this.keyCode}`}isModifierKey(){return this.keyCode===0||this.keyCode===5||this.keyCode===57||this.keyCode===6||this.keyCode===4}toKeybinding(){return new jR([this])}isDuplicateModifierCase(){return this.ctrlKey&&this.keyCode===5||this.shiftKey&&this.keyCode===4||this.altKey&&this.keyCode===6||this.metaKey&&this.keyCode===57}},jR=class{constructor(e){if(e.length===0)throw _R("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 VR(t){if(t.charCode){let i=String.fromCharCode(t.charCode).toUpperCase();return _C.fromString(i)}let e=t.keyCode;if(e===3)return 7;if(jp)switch(e){case 59:return 85;case 60:if(HR)return 97;break;case 61:return 86;case 107:return 109;case 109:return 111;case 173:return 88;case 224:if(rn)return 57;break}else if(OR&&(rn&&e===93||!rn&&e===92))return 57;return $R[e]||0}var qR=rn?256:2048,YR=512,GR=1024,KR=rn?2048:256,vb=class{constructor(t){this._standardKeyboardEventBrand=!0;let e=t;this.browserEvent=e,this.target=e.target,this.ctrlKey=e.ctrlKey,this.shiftKey=e.shiftKey,this.altKey=e.altKey,this.metaKey=e.metaKey,this.altGraphKey=e.getModifierState?.("AltGraph"),this.keyCode=VR(e),this.code=e.code,this.ctrlKey=this.ctrlKey||this.keyCode===5,this.altKey=this.altKey||this.keyCode===6,this.shiftKey=this.shiftKey||this.keyCode===4,this.metaKey=this.metaKey||this.keyCode===57,this._asKeybinding=this._computeKeybinding(),this._asKeyCodeChord=this._computeKeyCodeChord()}preventDefault(){this.browserEvent&&this.browserEvent.preventDefault&&this.browserEvent.preventDefault()}stopPropagation(){this.browserEvent&&this.browserEvent.stopPropagation&&this.browserEvent.stopPropagation()}toKeyCodeChord(){return this._asKeyCodeChord}equals(t){return this._asKeybinding===t}_computeKeybinding(){let t=0;this.keyCode!==5&&this.keyCode!==4&&this.keyCode!==6&&this.keyCode!==57&&(t=this.keyCode);let e=0;return this.ctrlKey&&(e|=qR),this.altKey&&(e|=YR),this.shiftKey&&(e|=GR),this.metaKey&&(e|=KR),e|=t,e}_computeKeyCodeChord(){let t=0;return this.keyCode!==5&&this.keyCode!==4&&this.keyCode!==6&&this.keyCode!==57&&(t=this.keyCode),new WR(this.ctrlKey,this.shiftKey,this.altKey,this.metaKey,t)}},Sb=new WeakMap;function XR(t){if(!t.parent||t.parent===t)return null;try{let e=t.location,i=t.parent.location;if(e.origin!=="null"&&i.origin!=="null"&&e.origin!==i.origin)return null}catch{return null}return t.parent}var ZR=class{static getSameOriginWindowChain(t){let e=Sb.get(t);if(!e){e=[],Sb.set(t,e);let i=t,n;do n=XR(i),n?e.push({window:new WeakRef(i),iframeElement:i.frameElement||null}):e.push({window:new WeakRef(i),iframeElement:null}),i=n;while(i)}return e.slice(0)}static getPositionOfChildWindowRelativeToAncestorWindow(t,e){if(!e||t===e)return{top:0,left:0};let i=0,n=0,a=this.getSameOriginWindowChain(t);for(let l of a){let u=l.window.deref();if(i+=u?.scrollY??0,n+=u?.scrollX??0,u===e||!l.iframeElement)break;let h=l.iframeElement.getBoundingClientRect();i+=h.top,n+=h.left}return{top:i,left:n}}},rd=class{constructor(e,i){this.timestamp=Date.now(),this.browserEvent=i,this.leftButton=i.button===0,this.middleButton=i.button===1,this.rightButton=i.button===2,this.buttons=i.buttons,this.target=i.target,this.detail=i.detail||1,i.type==="dblclick"&&(this.detail=2),this.ctrlKey=i.ctrlKey,this.shiftKey=i.shiftKey,this.altKey=i.altKey,this.metaKey=i.metaKey,typeof i.pageX=="number"?(this.posx=i.pageX,this.posy=i.pageY):(this.posx=i.clientX+this.target.ownerDocument.body.scrollLeft+this.target.ownerDocument.documentElement.scrollLeft,this.posy=i.clientY+this.target.ownerDocument.body.scrollTop+this.target.ownerDocument.documentElement.scrollTop);let n=ZR.getPositionOfChildWindowRelativeToAncestorWindow(e,i.view);this.posx-=n.left,this.posy-=n.top}preventDefault(){this.browserEvent.preventDefault()}stopPropagation(){this.browserEvent.stopPropagation()}},yb=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 a=!1;if(jg){let l=navigator.userAgent.match(/Chrome\/(\d+)/);a=(l?parseInt(l[1]):123)<=122}if(e){let l=e,u=e,h=e.view?.devicePixelRatio||1;if(typeof l.wheelDeltaY<"u")a?this.deltaY=l.wheelDeltaY/(120*h):this.deltaY=l.wheelDeltaY/120;else if(typeof u.VERTICAL_AXIS<"u"&&u.axis===u.VERTICAL_AXIS)this.deltaY=-u.detail/3;else if(e.type==="wheel"){let f=e;f.deltaMode===f.DOM_DELTA_LINE?jp&&!rn?this.deltaY=-e.deltaY/3:this.deltaY=-e.deltaY:this.deltaY=-e.deltaY/40}if(typeof l.wheelDeltaX<"u")BR&&mC?this.deltaX=-(l.wheelDeltaX/120):a?this.deltaX=l.wheelDeltaX/(120*h):this.deltaX=l.wheelDeltaX/120;else if(typeof u.HORIZONTAL_AXIS<"u"&&u.axis===u.HORIZONTAL_AXIS)this.deltaX=-e.detail/3;else if(e.type==="wheel"){let f=e;f.deltaMode===f.DOM_DELTA_LINE?jp&&!rn?this.deltaX=-e.deltaX/3:this.deltaX=-e.deltaX:this.deltaX=-e.deltaX/40}this.deltaY===0&&this.deltaX===0&&e.wheelDelta&&(a?this.deltaY=e.wheelDelta/(120*h):this.deltaY=e.wheelDelta/120)}}preventDefault(){this.browserEvent?.preventDefault()}stopPropagation(){this.browserEvent?.stopPropagation()}},gC=Object.freeze(function(t,e){let i=setTimeout(t.bind(e),0);return{dispose(){clearTimeout(i)}}}),QR;(t=>{function e(i){return i===t.None||i===t.Cancelled||i instanceof JR?!0:!i||typeof i!="object"?!1:typeof i.isCancellationRequested=="boolean"&&typeof i.onCancellationRequested=="function"}t.isCancellationToken=e,t.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:Qi.None}),t.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:gC})})(QR||={});var JR=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?gC:(this._emitter||(this._emitter=new ve),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=null)}},qg=class{constructor(e,i){this._isDisposed=!1,this._token=-1,typeof e=="function"&&typeof i=="number"&&this.setIfNotSet(e,i)}dispose(){this.cancel(),this._isDisposed=!0}cancel(){this._token!==-1&&(clearTimeout(this._token),this._token=-1)}cancelAndSet(e,i){if(this._isDisposed)throw new Hp("Calling 'cancelAndSet' on a disposed TimeoutTimer");this.cancel(),this._token=setTimeout(()=>{this._token=-1,e()},i)}setIfNotSet(e,i){if(this._isDisposed)throw new Hp("Calling 'setIfNotSet' on a disposed TimeoutTimer");this._token===-1&&(this._token=setTimeout(()=>{this._token=-1,e()},i))}},eM=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 Hp("Calling 'cancelAndSet' on a disposed IntervalTimer");this.cancel();let a=n.setInterval(()=>{e()},i);this.disposable=jt(()=>{n.clearInterval(a),this.disposable=void 0})}dispose(){this.cancel(),this.isDisposed=!0}},tM;(t=>{async function e(n){let a,l=await Promise.all(n.map(u=>u.then(h=>h,h=>{a||(a=h)})));if(typeof a<"u")throw a;return l}t.settled=e;function i(n){return new Promise(async(a,l)=>{try{await n(a,l)}catch(u){l(u)}})}t.withAsyncBody=i})(tM||={});var bb=class vr{static fromArray(e){return new vr(i=>{i.emitMany(e)})}static fromPromise(e){return new vr(async i=>{i.emitMany(await e)})}static fromPromises(e){return new vr(async i=>{await Promise.all(e.map(async n=>i.emitOne(await n)))})}static merge(e){return new vr(async i=>{await Promise.all(e.map(async n=>{for await(let a of n)i.emitOne(a)}))})}constructor(e,i){this._state=0,this._results=[],this._error=null,this._onReturn=i,this._onStateChanged=new ve,queueMicrotask(async()=>{let n={emitOne:a=>this.emitOne(a),emitMany:a=>this.emitMany(a),reject:a=>this.reject(a)};try{await Promise.resolve(e(n)),this.resolve()}catch(a){this.reject(a)}finally{n.emitOne=void 0,n.emitMany=void 0,n.reject=void 0}})}[Symbol.asyncIterator](){let e=0;return{next:async()=>{do{if(this._state===2)throw this._error;if(e<this._results.length)return{done:!1,value:this._results[e++]};if(this._state===1)return{done:!0,value:void 0};await Qi.toPromise(this._onStateChanged.event)}while(!0)},return:async()=>(this._onReturn?.(),{done:!0,value:void 0})}}static map(e,i){return new vr(async n=>{for await(let a of e)n.emitOne(i(a))})}map(e){return vr.map(this,e)}static filter(e,i){return new vr(async n=>{for await(let a of e)i(a)&&n.emitOne(a)})}filter(e){return vr.filter(this,e)}static coalesce(e){return vr.filter(e,i=>!!i)}coalesce(){return vr.coalesce(this)}static async toPromise(e){let i=[];for await(let n of e)i.push(n);return i}toPromise(){return vr.toPromise(this)}emitOne(e){this._state===0&&(this._results.push(e),this._onStateChanged.fire())}emitMany(e){this._state===0&&(this._results=this._results.concat(e),this._onStateChanged.fire())}resolve(){this._state===0&&(this._state=1,this._onStateChanged.fire())}reject(e){this._state===0&&(this._state=2,this._error=e,this._onStateChanged.fire())}};bb.EMPTY=bb.fromArray([]);var{getWindow:sn,getWindowId:iM,onDidRegisterWindow:sM}=(function(){let t=new Map,e={window:jn,disposables:new Ya};t.set(jn.vscodeWindowId,e);let i=new ve,n=new ve,a=new ve;function l(u,h){return(typeof u=="number"?t.get(u):void 0)??(h?e:void 0)}return{onDidRegisterWindow:i.event,onWillUnregisterWindow:a.event,onDidUnregisterWindow:n.event,registerWindow(u){if(t.has(u.vscodeWindowId))return nt.None;let h=new Ya,f={window:u,disposables:h.add(new Ya)};return t.set(u.vscodeWindowId,f),h.add(jt(()=>{t.delete(u.vscodeWindowId),n.fire(u)})),h.add(Ye(u,Di.BEFORE_UNLOAD,()=>{a.fire(u)})),i.fire(f),h},getWindows(){return t.values()},getWindowsCount(){return t.size},getWindowId(u){return u.vscodeWindowId},hasWindow(u){return t.has(u)},getWindowById:l,getWindow(u){let h=u;if(h?.ownerDocument?.defaultView)return h.ownerDocument.defaultView.window;let f=u;return f?.view?f.view.window:jn},getDocument(u){return sn(u).document}}})(),rM=class{constructor(e,i,n,a){this._node=e,this._type=i,this._handler=n,this._options=a||!1,this._node.addEventListener(this._type,this._handler,this._options)}dispose(){this._handler&&(this._node.removeEventListener(this._type,this._handler,this._options),this._node=null,this._handler=null)}};function Ye(t,e,i,n){return new rM(t,e,i,n)}var wb=function(t,e,i,n){return Ye(t,e,i,n)},Yg,nM=class extends eM{constructor(t){super(),this.defaultTarget=t&&sn(t)}cancelAndSet(t,e,i){return super.cancelAndSet(t,e,i??this.defaultTarget)}},Cb=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){bd(e)}}static sort(e,i){return i.priority-e.priority}};(function(){let t=new Map,e=new Map,i=new Map,n=new Map,a=l=>{i.set(l,!1);let u=t.get(l)??[];for(e.set(l,u),t.set(l,[]),n.set(l,!0);u.length>0;)u.sort(Cb.sort),u.shift().execute();n.set(l,!1)};Yg=(l,u,h=0)=>{let f=iM(l),d=new Cb(u,h),g=t.get(f);return g||(g=[],t.set(f,g)),g.push(d),i.get(f)||(i.set(f,!0),l.requestAnimationFrame(()=>a(f))),d}})();function aM(t){let e=t.getBoundingClientRect(),i=sn(t);return{left:e.left+i.scrollX,top:e.top+i.scrollY,width:e.width,height:e.height}}var Di={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"},oM=class{constructor(t){this.domNode=t,this._maxWidth="",this._width="",this._height="",this._top="",this._left="",this._bottom="",this._right="",this._paddingTop="",this._paddingLeft="",this._paddingBottom="",this._paddingRight="",this._fontFamily="",this._fontWeight="",this._fontSize="",this._fontStyle="",this._fontFeatureSettings="",this._fontVariationSettings="",this._textDecoration="",this._lineHeight="",this._letterSpacing="",this._className="",this._display="",this._position="",this._visibility="",this._color="",this._backgroundColor="",this._layerHint=!1,this._contain="none",this._boxShadow=""}setMaxWidth(t){let e=Cs(t);this._maxWidth!==e&&(this._maxWidth=e,this.domNode.style.maxWidth=this._maxWidth)}setWidth(t){let e=Cs(t);this._width!==e&&(this._width=e,this.domNode.style.width=this._width)}setHeight(t){let e=Cs(t);this._height!==e&&(this._height=e,this.domNode.style.height=this._height)}setTop(t){let e=Cs(t);this._top!==e&&(this._top=e,this.domNode.style.top=this._top)}setLeft(t){let e=Cs(t);this._left!==e&&(this._left=e,this.domNode.style.left=this._left)}setBottom(t){let e=Cs(t);this._bottom!==e&&(this._bottom=e,this.domNode.style.bottom=this._bottom)}setRight(t){let e=Cs(t);this._right!==e&&(this._right=e,this.domNode.style.right=this._right)}setPaddingTop(t){let e=Cs(t);this._paddingTop!==e&&(this._paddingTop=e,this.domNode.style.paddingTop=this._paddingTop)}setPaddingLeft(t){let e=Cs(t);this._paddingLeft!==e&&(this._paddingLeft=e,this.domNode.style.paddingLeft=this._paddingLeft)}setPaddingBottom(t){let e=Cs(t);this._paddingBottom!==e&&(this._paddingBottom=e,this.domNode.style.paddingBottom=this._paddingBottom)}setPaddingRight(t){let e=Cs(t);this._paddingRight!==e&&(this._paddingRight=e,this.domNode.style.paddingRight=this._paddingRight)}setFontFamily(t){this._fontFamily!==t&&(this._fontFamily=t,this.domNode.style.fontFamily=this._fontFamily)}setFontWeight(t){this._fontWeight!==t&&(this._fontWeight=t,this.domNode.style.fontWeight=this._fontWeight)}setFontSize(t){let e=Cs(t);this._fontSize!==e&&(this._fontSize=e,this.domNode.style.fontSize=this._fontSize)}setFontStyle(t){this._fontStyle!==t&&(this._fontStyle=t,this.domNode.style.fontStyle=this._fontStyle)}setFontFeatureSettings(t){this._fontFeatureSettings!==t&&(this._fontFeatureSettings=t,this.domNode.style.fontFeatureSettings=this._fontFeatureSettings)}setFontVariationSettings(t){this._fontVariationSettings!==t&&(this._fontVariationSettings=t,this.domNode.style.fontVariationSettings=this._fontVariationSettings)}setTextDecoration(t){this._textDecoration!==t&&(this._textDecoration=t,this.domNode.style.textDecoration=this._textDecoration)}setLineHeight(t){let e=Cs(t);this._lineHeight!==e&&(this._lineHeight=e,this.domNode.style.lineHeight=this._lineHeight)}setLetterSpacing(t){let e=Cs(t);this._letterSpacing!==e&&(this._letterSpacing=e,this.domNode.style.letterSpacing=this._letterSpacing)}setClassName(t){this._className!==t&&(this._className=t,this.domNode.className=this._className)}toggleClassName(t,e){this.domNode.classList.toggle(t,e),this._className=this.domNode.className}setDisplay(t){this._display!==t&&(this._display=t,this.domNode.style.display=this._display)}setPosition(t){this._position!==t&&(this._position=t,this.domNode.style.position=this._position)}setVisibility(t){this._visibility!==t&&(this._visibility=t,this.domNode.style.visibility=this._visibility)}setColor(t){this._color!==t&&(this._color=t,this.domNode.style.color=this._color)}setBackgroundColor(t){this._backgroundColor!==t&&(this._backgroundColor=t,this.domNode.style.backgroundColor=this._backgroundColor)}setLayerHinting(t){this._layerHint!==t&&(this._layerHint=t,this.domNode.style.transform=this._layerHint?"translate3d(0px, 0px, 0px)":"")}setBoxShadow(t){this._boxShadow!==t&&(this._boxShadow=t,this.domNode.style.boxShadow=t)}setContain(t){this._contain!==t&&(this._contain=t,this.domNode.style.contain=this._contain)}setAttribute(t,e){this.domNode.setAttribute(t,e)}removeAttribute(t){this.domNode.removeAttribute(t)}appendChild(t){this.domNode.appendChild(t.domNode)}removeChild(t){this.domNode.removeChild(t.domNode)}};function Cs(t){return typeof t=="number"?`${t}px`:t}function xu(t){return new oM(t)}var vC=class{constructor(){this._hooks=new Ya,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,a,l){this.isMonitoring()&&this.stopMonitoring(!1),this._pointerMoveCallback=a,this._onStopCallback=l;let u=e;try{e.setPointerCapture(i),this._hooks.add(jt(()=>{try{e.releasePointerCapture(i)}catch{}}))}catch{u=sn(e)}this._hooks.add(Ye(u,Di.POINTER_MOVE,h=>{if(h.buttons!==n){this.stopMonitoring(!0);return}h.preventDefault(),this._pointerMoveCallback(h)})),this._hooks.add(Ye(u,Di.POINTER_UP,h=>this.stopMonitoring(!0)))}};function lM(t,e,i){let n=null,a=null;if(typeof i.value=="function"?(n="value",a=i.value,a.length!==0&&console.warn("Memoize should only be used in functions with zero parameters")):typeof i.get=="function"&&(n="get",a=i.get),!a)throw new Error("not supported");let l=`$memoize$${e}`;i[n]=function(...u){return this.hasOwnProperty(l)||Object.defineProperty(this,l,{configurable:!1,enumerable:!1,writable:!1,value:a.apply(this,u)}),this[l]}}var tn;(t=>(t.Tap="-xterm-gesturetap",t.Change="-xterm-gesturechange",t.Start="-xterm-gesturestart",t.End="-xterm-gesturesend",t.Contextmenu="-xterm-gesturecontextmenu"))(tn||={});var _u=class ss extends nt{constructor(){super(),this.dispatched=!1,this.targets=new fb,this.ignoreTargets=new fb,this.activeTouches={},this.handle=null,this._lastSetTapCountTime=0,this._register(Qi.runAndSubscribe(sM,({window:e,disposables:i})=>{i.add(Ye(e.document,"touchstart",n=>this.onTouchStart(n),{passive:!1})),i.add(Ye(e.document,"touchend",n=>this.onTouchEnd(e,n))),i.add(Ye(e.document,"touchmove",n=>this.onTouchMove(n),{passive:!1}))},{window:jn,disposables:this._store}))}static addTarget(e){if(!ss.isTouchDevice())return nt.None;ss.INSTANCE||(ss.INSTANCE=new ss);let i=ss.INSTANCE.targets.push(e);return jt(i)}static ignoreTarget(e){if(!ss.isTouchDevice())return nt.None;ss.INSTANCE||(ss.INSTANCE=new ss);let i=ss.INSTANCE.ignoreTargets.push(e);return jt(i)}static isTouchDevice(){return"ontouchstart"in jn||navigator.maxTouchPoints>0}dispose(){this.handle&&(this.handle.dispose(),this.handle=null),super.dispose()}onTouchStart(e){let i=Date.now();this.handle&&(this.handle.dispose(),this.handle=null);for(let n=0,a=e.targetTouches.length;n<a;n++){let l=e.targetTouches.item(n);this.activeTouches[l.identifier]={id:l.identifier,initialTarget:l.target,initialTimeStamp:i,initialPageX:l.pageX,initialPageY:l.pageY,rollingTimestamps:[i],rollingPageX:[l.pageX],rollingPageY:[l.pageY]};let u=this.newGestureEvent(tn.Start,l.target);u.pageX=l.pageX,u.pageY=l.pageY,this.dispatchEvent(u)}this.dispatched&&(e.preventDefault(),e.stopPropagation(),this.dispatched=!1)}onTouchEnd(e,i){let n=Date.now(),a=Object.keys(this.activeTouches).length;for(let l=0,u=i.changedTouches.length;l<u;l++){let h=i.changedTouches.item(l);if(!this.activeTouches.hasOwnProperty(String(h.identifier))){console.warn("move of an UNKNOWN touch",h);continue}let f=this.activeTouches[h.identifier],d=Date.now()-f.initialTimeStamp;if(d<ss.HOLD_DELAY&&Math.abs(f.initialPageX-$s(f.rollingPageX))<30&&Math.abs(f.initialPageY-$s(f.rollingPageY))<30){let g=this.newGestureEvent(tn.Tap,f.initialTarget);g.pageX=$s(f.rollingPageX),g.pageY=$s(f.rollingPageY),this.dispatchEvent(g)}else if(d>=ss.HOLD_DELAY&&Math.abs(f.initialPageX-$s(f.rollingPageX))<30&&Math.abs(f.initialPageY-$s(f.rollingPageY))<30){let g=this.newGestureEvent(tn.Contextmenu,f.initialTarget);g.pageX=$s(f.rollingPageX),g.pageY=$s(f.rollingPageY),this.dispatchEvent(g)}else if(a===1){let g=$s(f.rollingPageX),v=$s(f.rollingPageY),p=$s(f.rollingTimestamps)-f.rollingTimestamps[0],S=g-f.rollingPageX[0],y=v-f.rollingPageY[0],C=[...this.targets].filter(x=>f.initialTarget instanceof Node&&x.contains(f.initialTarget));this.inertia(e,C,n,Math.abs(S)/p,S>0?1:-1,g,Math.abs(y)/p,y>0?1:-1,v)}this.dispatchEvent(this.newGestureEvent(tn.End,f.initialTarget)),delete this.activeTouches[h.identifier]}this.dispatched&&(i.preventDefault(),i.stopPropagation(),this.dispatched=!1)}newGestureEvent(e,i){let n=document.createEvent("CustomEvent");return n.initEvent(e,!1,!0),n.initialTarget=i,n.tapCount=0,n}dispatchEvent(e){if(e.type===tn.Tap){let i=new Date().getTime(),n=0;i-this._lastSetTapCountTime>ss.CLEAR_TAP_COUNT_TIME?n=1:n=2,this._lastSetTapCountTime=i,e.tapCount=n}else(e.type===tn.Change||e.type===tn.Contextmenu)&&(this._lastSetTapCountTime=0);if(e.initialTarget instanceof Node){for(let n of this.ignoreTargets)if(n.contains(e.initialTarget))return;let i=[];for(let n of this.targets)if(n.contains(e.initialTarget)){let a=0,l=e.initialTarget;for(;l&&l!==n;)a++,l=l.parentElement;i.push([a,n])}i.sort((n,a)=>n[0]-a[0]);for(let[n,a]of i)a.dispatchEvent(e),this.dispatched=!0}}inertia(e,i,n,a,l,u,h,f,d){this.handle=Yg(e,()=>{let g=Date.now(),v=g-n,p=0,S=0,y=!0;a+=ss.SCROLL_FRICTION*v,h+=ss.SCROLL_FRICTION*v,a>0&&(y=!1,p=l*a*v),h>0&&(y=!1,S=f*h*v);let C=this.newGestureEvent(tn.Change);C.translationX=p,C.translationY=S,i.forEach(x=>x.dispatchEvent(C)),y||this.inertia(e,i,g,a,l,u+p,h,f,d+S)})}onTouchMove(e){let i=Date.now();for(let n=0,a=e.changedTouches.length;n<a;n++){let l=e.changedTouches.item(n);if(!this.activeTouches.hasOwnProperty(String(l.identifier))){console.warn("end of an UNKNOWN touch",l);continue}let u=this.activeTouches[l.identifier],h=this.newGestureEvent(tn.Change,u.initialTarget);h.translationX=l.pageX-$s(u.rollingPageX),h.translationY=l.pageY-$s(u.rollingPageY),h.pageX=l.pageX,h.pageY=l.pageY,this.dispatchEvent(h),u.rollingPageX.length>3&&(u.rollingPageX.shift(),u.rollingPageY.shift(),u.rollingTimestamps.shift()),u.rollingPageX.push(l.pageX),u.rollingPageY.push(l.pageY),u.rollingTimestamps.push(i)}this.dispatched&&(e.preventDefault(),e.stopPropagation(),this.dispatched=!1)}};_u.SCROLL_FRICTION=-.005,_u.HOLD_DELAY=700,_u.CLEAR_TAP_COUNT_TIME=400,si([lM],_u,"isTouchDevice",1);var cM=_u,Gg=class extends nt{onclick(e,i){this._register(Ye(e,Di.CLICK,n=>i(new rd(sn(e),n))))}onmousedown(e,i){this._register(Ye(e,Di.MOUSE_DOWN,n=>i(new rd(sn(e),n))))}onmouseover(e,i){this._register(Ye(e,Di.MOUSE_OVER,n=>i(new rd(sn(e),n))))}onmouseleave(e,i){this._register(Ye(e,Di.MOUSE_LEAVE,n=>i(new rd(sn(e),n))))}onkeydown(e,i){this._register(Ye(e,Di.KEY_DOWN,n=>i(new vb(n))))}onkeyup(e,i){this._register(Ye(e,Di.KEY_UP,n=>i(new vb(n))))}oninput(e,i){this._register(Ye(e,Di.INPUT,i))}onblur(e,i){this._register(Ye(e,Di.BLUR,i))}onfocus(e,i){this._register(Ye(e,Di.FOCUS,i))}onchange(e,i){this._register(Ye(e,Di.CHANGE,i))}ignoreGesture(e){return cM.ignoreTarget(e)}},xb=11,uM=class extends Gg{constructor(t){super(),this._onActivate=t.onActivate,this.bgDomNode=document.createElement("div"),this.bgDomNode.className="arrow-background",this.bgDomNode.style.position="absolute",this.bgDomNode.style.width=t.bgWidth+"px",this.bgDomNode.style.height=t.bgHeight+"px",typeof t.top<"u"&&(this.bgDomNode.style.top="0px"),typeof t.left<"u"&&(this.bgDomNode.style.left="0px"),typeof t.bottom<"u"&&(this.bgDomNode.style.bottom="0px"),typeof t.right<"u"&&(this.bgDomNode.style.right="0px"),this.domNode=document.createElement("div"),this.domNode.className=t.className,this.domNode.style.position="absolute",this.domNode.style.width=xb+"px",this.domNode.style.height=xb+"px",typeof t.top<"u"&&(this.domNode.style.top=t.top+"px"),typeof t.left<"u"&&(this.domNode.style.left=t.left+"px"),typeof t.bottom<"u"&&(this.domNode.style.bottom=t.bottom+"px"),typeof t.right<"u"&&(this.domNode.style.right=t.right+"px"),this._pointerMoveMonitor=this._register(new vC),this._register(wb(this.bgDomNode,Di.POINTER_DOWN,e=>this._arrowPointerDown(e))),this._register(wb(this.domNode,Di.POINTER_DOWN,e=>this._arrowPointerDown(e))),this._pointerdownRepeatTimer=this._register(new nM),this._pointerdownScheduleRepeatTimer=this._register(new qg)}_arrowPointerDown(t){if(!t.target||!(t.target instanceof Element))return;let e=()=>{this._pointerdownRepeatTimer.cancelAndSet(()=>this._onActivate(),1e3/24,sn(t))};this._onActivate(),this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancelAndSet(e,200),this._pointerMoveMonitor.startMonitoring(t.target,t.pointerId,t.buttons,i=>{},()=>{this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancel()}),t.preventDefault()}},hM=class Yp{constructor(e,i,n,a,l,u,h){this._forceIntegerValues=e,this._scrollStateBrand=void 0,this._forceIntegerValues&&(i=i|0,n=n|0,a=a|0,l=l|0,u=u|0,h=h|0),this.rawScrollLeft=a,this.rawScrollTop=h,i<0&&(i=0),a+i>n&&(a=n-i),a<0&&(a=0),l<0&&(l=0),h+l>u&&(h=u-l),h<0&&(h=0),this.width=i,this.scrollWidth=n,this.scrollLeft=a,this.height=l,this.scrollHeight=u,this.scrollTop=h}equals(e){return this.rawScrollLeft===e.rawScrollLeft&&this.rawScrollTop===e.rawScrollTop&&this.width===e.width&&this.scrollWidth===e.scrollWidth&&this.scrollLeft===e.scrollLeft&&this.height===e.height&&this.scrollHeight===e.scrollHeight&&this.scrollTop===e.scrollTop}withScrollDimensions(e,i){return new Yp(this._forceIntegerValues,typeof e.width<"u"?e.width:this.width,typeof e.scrollWidth<"u"?e.scrollWidth:this.scrollWidth,i?this.rawScrollLeft:this.scrollLeft,typeof e.height<"u"?e.height:this.height,typeof e.scrollHeight<"u"?e.scrollHeight:this.scrollHeight,i?this.rawScrollTop:this.scrollTop)}withScrollPosition(e){return new Yp(this._forceIntegerValues,this.width,this.scrollWidth,typeof e.scrollLeft<"u"?e.scrollLeft:this.rawScrollLeft,this.height,this.scrollHeight,typeof e.scrollTop<"u"?e.scrollTop:this.rawScrollTop)}createScrollEvent(e,i){let n=this.width!==e.width,a=this.scrollWidth!==e.scrollWidth,l=this.scrollLeft!==e.scrollLeft,u=this.height!==e.height,h=this.scrollHeight!==e.scrollHeight,f=this.scrollTop!==e.scrollTop;return{inSmoothScrolling:i,oldWidth:e.width,oldScrollWidth:e.scrollWidth,oldScrollLeft:e.scrollLeft,width:this.width,scrollWidth:this.scrollWidth,scrollLeft:this.scrollLeft,oldHeight:e.height,oldScrollHeight:e.scrollHeight,oldScrollTop:e.scrollTop,height:this.height,scrollHeight:this.scrollHeight,scrollTop:this.scrollTop,widthChanged:n,scrollWidthChanged:a,scrollLeftChanged:l,heightChanged:u,scrollHeightChanged:h,scrollTopChanged:f}}},dM=class extends nt{constructor(t){super(),this._scrollableBrand=void 0,this._onScroll=this._register(new ve),this.onScroll=this._onScroll.event,this._smoothScrollDuration=t.smoothScrollDuration,this._scheduleAtNextAnimationFrame=t.scheduleAtNextAnimationFrame,this._state=new hM(t.forceIntegerValues,0,0,0,0,0,0),this._smoothScrolling=null}dispose(){this._smoothScrolling&&(this._smoothScrolling.dispose(),this._smoothScrolling=null),super.dispose()}setSmoothScrollDuration(t){this._smoothScrollDuration=t}validateScrollPosition(t){return this._state.withScrollPosition(t)}getScrollDimensions(){return this._state}setScrollDimensions(t,e){let i=this._state.withScrollDimensions(t,e);this._setState(i,!!this._smoothScrolling),this._smoothScrolling?.acceptScrollDimensions(this._state)}getFutureScrollPosition(){return this._smoothScrolling?this._smoothScrolling.to:this._state}getCurrentScrollPosition(){return this._state}setScrollPositionNow(t){let e=this._state.withScrollPosition(t);this._smoothScrolling&&(this._smoothScrolling.dispose(),this._smoothScrolling=null),this._setState(e,!1)}setScrollPositionSmooth(t,e){if(this._smoothScrollDuration===0)return this.setScrollPositionNow(t);if(this._smoothScrolling){t={scrollLeft:typeof t.scrollLeft>"u"?this._smoothScrolling.to.scrollLeft:t.scrollLeft,scrollTop:typeof t.scrollTop>"u"?this._smoothScrolling.to.scrollTop:t.scrollTop};let i=this._state.withScrollPosition(t);if(this._smoothScrolling.to.scrollLeft===i.scrollLeft&&this._smoothScrolling.to.scrollTop===i.scrollTop)return;let n;e?n=new Eb(this._smoothScrolling.from,i,this._smoothScrolling.startTime,this._smoothScrolling.duration):n=this._smoothScrolling.combine(this._state,i,this._smoothScrollDuration),this._smoothScrolling.dispose(),this._smoothScrolling=n}else{let i=this._state.withScrollPosition(t);this._smoothScrolling=Eb.start(this._state,i,this._smoothScrollDuration)}this._smoothScrolling.animationFrameDisposable=this._scheduleAtNextAnimationFrame(()=>{this._smoothScrolling&&(this._smoothScrolling.animationFrameDisposable=null,this._performSmoothScrolling())})}hasPendingScrollAnimation(){return!!this._smoothScrolling}_performSmoothScrolling(){if(!this._smoothScrolling)return;let t=this._smoothScrolling.tick(),e=this._state.withScrollPosition(t);if(this._setState(e,!0),!!this._smoothScrolling){if(t.isDone){this._smoothScrolling.dispose(),this._smoothScrolling=null;return}this._smoothScrolling.animationFrameDisposable=this._scheduleAtNextAnimationFrame(()=>{this._smoothScrolling&&(this._smoothScrolling.animationFrameDisposable=null,this._performSmoothScrolling())})}}_setState(t,e){let i=this._state;i.equals(t)||(this._state=t,this._onScroll.fire(this._state.createScrollEvent(i,e)))}},kb=class{constructor(e,i,n){this.scrollLeft=e,this.scrollTop=i,this.isDone=n}};function K_(t,e){let i=e-t;return function(n){return t+i*_M(n)}}function fM(t,e,i){return function(n){return n<i?t(n/i):e((n-i)/(1-i))}}var Eb=class Gp{constructor(e,i,n,a){this.from=e,this.to=i,this.duration=a,this.startTime=n,this.animationFrameDisposable=null,this._initAnimations()}_initAnimations(){this.scrollLeft=this._initAnimation(this.from.scrollLeft,this.to.scrollLeft,this.to.width),this.scrollTop=this._initAnimation(this.from.scrollTop,this.to.scrollTop,this.to.height)}_initAnimation(e,i,n){if(Math.abs(e-i)>2.5*n){let a,l;return e<i?(a=e+.75*n,l=i-.75*n):(a=e-.75*n,l=i+.75*n),fM(K_(e,a),K_(l,i),.33)}return K_(e,i)}dispose(){this.animationFrameDisposable!==null&&(this.animationFrameDisposable.dispose(),this.animationFrameDisposable=null)}acceptScrollDimensions(e){this.to=e.withScrollPosition(this.to),this._initAnimations()}tick(){return this._tick(Date.now())}_tick(e){let i=(e-this.startTime)/this.duration;if(i<1){let n=this.scrollLeft(i),a=this.scrollTop(i);return new kb(n,a,!1)}return new kb(this.to.scrollLeft,this.to.scrollTop,!0)}combine(e,i,n){return Gp.start(e,i,n)}static start(e,i,n){n=n+10;let a=Date.now()-10;return new Gp(e,i,a,n)}};function mM(t){return Math.pow(t,3)}function _M(t){return 1-mM(1-t)}var pM=class extends nt{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 qg)}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":"")))}},gM=140,SC=class extends Gg{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 pM(e.visibility,"visible scrollbar "+e.extraScrollbarClassName,"invisible scrollbar "+e.extraScrollbarClassName)),this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._pointerMoveMonitor=this._register(new vC),this._shouldRender=!0,this.domNode=xu(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(Ye(this.domNode.domNode,Di.POINTER_DOWN,i=>this._domNodePointerDown(i)))}_createArrow(e){let i=this._register(new uM(e));this.domNode.domNode.appendChild(i.bgDomNode),this.domNode.domNode.appendChild(i.domNode)}_createSlider(e,i,n,a){this.slider=xu(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 a=="number"&&this.slider.setHeight(a),this.slider.setLayerHinting(!0),this.slider.setContain("strict"),this.domNode.domNode.appendChild(this.slider.domNode),this._register(Ye(this.slider.domNode,Di.POINTER_DOWN,l=>{l.button===0&&(l.preventDefault(),this._sliderPointerDown(l))})),this.onclick(this.slider.domNode,l=>{l.leftButton&&l.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(),a=i+this._scrollbarState.getSliderPosition()+this._scrollbarState.getSliderSize(),l=this._sliderPointerPosition(e);n<=l&&l<=a?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 l=aM(this.domNode.domNode);i=e.pageX-l.left,n=e.pageY-l.top}let a=this._pointerDownRelativePosition(i,n);this._setDesiredScrollPositionNow(this._scrollByPage?this._scrollbarState.getDesiredScrollPositionFromOffsetPaged(a):this._scrollbarState.getDesiredScrollPositionFromOffset(a)),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),a=this._scrollbarState.clone();this.slider.toggleClassName("active",!0),this._pointerMoveMonitor.startMonitoring(e.target,e.pointerId,e.buttons,l=>{let u=this._sliderOrthogonalPointerPosition(l),h=Math.abs(u-n);if(mC&&h>gM){this._setDesiredScrollPositionNow(a.getScrollPosition());return}let f=this._sliderPointerPosition(l)-i;this._setDesiredScrollPositionNow(a.getDesiredScrollPositionFromDelta(f))},()=>{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()}},yC=class Kp{constructor(e,i,n,a,l,u){this._scrollbarSize=Math.round(i),this._oppositeScrollbarSize=Math.round(n),this._arrowSize=Math.round(e),this._visibleSize=a,this._scrollSize=l,this._scrollPosition=u,this._computedAvailableSize=0,this._computedIsNeeded=!1,this._computedSliderSize=0,this._computedSliderRatio=0,this._computedSliderPosition=0,this._refreshComputedValues()}clone(){return new Kp(this._arrowSize,this._scrollbarSize,this._oppositeScrollbarSize,this._visibleSize,this._scrollSize,this._scrollPosition)}setVisibleSize(e){let i=Math.round(e);return this._visibleSize!==i?(this._visibleSize=i,this._refreshComputedValues(),!0):!1}setScrollSize(e){let i=Math.round(e);return this._scrollSize!==i?(this._scrollSize=i,this._refreshComputedValues(),!0):!1}setScrollPosition(e){let i=Math.round(e);return this._scrollPosition!==i?(this._scrollPosition=i,this._refreshComputedValues(),!0):!1}setScrollbarSize(e){this._scrollbarSize=Math.round(e)}setOppositeScrollbarSize(e){this._oppositeScrollbarSize=Math.round(e)}static _computeValues(e,i,n,a,l){let u=Math.max(0,n-e),h=Math.max(0,u-2*i),f=a>0&&a>n;if(!f)return{computedAvailableSize:Math.round(u),computedIsNeeded:f,computedSliderSize:Math.round(h),computedSliderRatio:0,computedSliderPosition:0};let d=Math.round(Math.max(20,Math.floor(n*h/a))),g=(h-d)/(a-n),v=l*g;return{computedAvailableSize:Math.round(u),computedIsNeeded:f,computedSliderSize:Math.round(d),computedSliderRatio:g,computedSliderPosition:Math.round(v)}}_refreshComputedValues(){let e=Kp._computeValues(this._oppositeScrollbarSize,this._arrowSize,this._visibleSize,this._scrollSize,this._scrollPosition);this._computedAvailableSize=e.computedAvailableSize,this._computedIsNeeded=e.computedIsNeeded,this._computedSliderSize=e.computedSliderSize,this._computedSliderRatio=e.computedSliderRatio,this._computedSliderPosition=e.computedSliderPosition}getArrowSize(){return this._arrowSize}getScrollPosition(){return this._scrollPosition}getRectangleLargeSize(){return this._computedAvailableSize}getRectangleSmallSize(){return this._scrollbarSize}isNeeded(){return this._computedIsNeeded}getSliderSize(){return this._computedSliderSize}getSliderPosition(){return this._computedSliderPosition}getDesiredScrollPositionFromOffset(e){if(!this._computedIsNeeded)return 0;let i=e-this._arrowSize-this._computedSliderSize/2;return Math.round(i/this._computedSliderRatio)}getDesiredScrollPositionFromOffsetPaged(e){if(!this._computedIsNeeded)return 0;let i=e-this._arrowSize,n=this._scrollPosition;return i<this._computedSliderPosition?n-=this._visibleSize:n+=this._visibleSize,n}getDesiredScrollPositionFromDelta(e){if(!this._computedIsNeeded)return 0;let i=this._computedSliderPosition+e;return Math.round(i/this._computedSliderRatio)}},vM=class extends SC{constructor(e,i,n){let a=e.getScrollDimensions(),l=e.getCurrentScrollPosition();if(super({lazyRender:i.lazyRender,host:n,scrollbarState:new yC(i.horizontalHasArrows?i.arrowSize:0,i.horizontal===2?0:i.horizontalScrollbarSize,i.vertical===2?0:i.verticalScrollbarSize,a.width,a.scrollWidth,l.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}},SM=class extends SC{constructor(t,e,i){let n=t.getScrollDimensions(),a=t.getCurrentScrollPosition();if(super({lazyRender:e.lazyRender,host:i,scrollbarState:new yC(e.verticalHasArrows?e.arrowSize:0,e.vertical===2?0:e.verticalScrollbarSize,0,n.height,n.scrollHeight,a.scrollTop),visibility:e.vertical,extraScrollbarClassName:"vertical",scrollable:t,scrollByPage:e.scrollByPage}),e.verticalHasArrows)throw new Error("horizontalHasArrows is not supported in xterm.js");this._createSlider(0,Math.floor((e.verticalScrollbarSize-e.verticalSliderSize)/2),e.verticalSliderSize,void 0)}_updateSlider(t,e){this.slider.setHeight(t),this.slider.setTop(e)}_renderDomNode(t,e){this.domNode.setWidth(e),this.domNode.setHeight(t),this.domNode.setRight(0),this.domNode.setTop(0)}onDidScroll(t){return this._shouldRender=this._onElementScrollSize(t.scrollHeight)||this._shouldRender,this._shouldRender=this._onElementScrollPosition(t.scrollTop)||this._shouldRender,this._shouldRender=this._onElementSize(t.height)||this._shouldRender,this._shouldRender}_pointerDownRelativePosition(t,e){return e}_sliderPointerPosition(t){return t.pageY}_sliderOrthogonalPointerPosition(t){return t.pageX}_updateScrollbarSize(t){this.slider.setWidth(t)}writeScrollPosition(t,e){t.scrollTop=e}updateOptions(t){this.updateScrollbarSize(t.vertical===2?0:t.verticalScrollbarSize),this._scrollbarState.setOppositeScrollbarSize(0),this._visibilityController.setVisibility(t.vertical),this._scrollByPage=t.scrollByPage}},yM=500,Tb=50,bM=class{constructor(e,i,n){this.timestamp=e,this.deltaX=i,this.deltaY=n,this.score=0}},Xp=class{constructor(){this._capacity=5,this._memory=[],this._front=-1,this._rear=-1}isPhysicalMouseWheel(){if(this._front===-1&&this._rear===-1)return!1;let e=1,i=0,n=1,a=this._rear;do{let l=a===this._front?e:Math.pow(2,-n);if(e-=l,i+=this._memory[a].score*l,a===this._front)break;a=(this._capacity+a-1)%this._capacity,n++}while(!0);return i<=.5}acceptStandardWheelEvent(e){if(jg){let i=sn(e.browserEvent),n=DR(i);this.accept(Date.now(),e.deltaX*n,e.deltaY*n)}else this.accept(Date.now(),e.deltaX,e.deltaY)}accept(e,i,n){let a=null,l=new bM(e,i,n);this._front===-1&&this._rear===-1?(this._memory[0]=l,this._front=0,this._rear=0):(a=this._memory[this._rear],this._rear=(this._rear+1)%this._capacity,this._rear===this._front&&(this._front=(this._front+1)%this._capacity),this._memory[this._rear]=l),l.score=this._computeScore(l,a)}_computeScore(e,i){if(Math.abs(e.deltaX)>0&&Math.abs(e.deltaY)>0)return 1;let n=.5;if((!this._isAlmostInt(e.deltaX)||!this._isAlmostInt(e.deltaY))&&(n+=.25),i){let a=Math.abs(e.deltaX),l=Math.abs(e.deltaY),u=Math.abs(i.deltaX),h=Math.abs(i.deltaY),f=Math.max(Math.min(a,u),1),d=Math.max(Math.min(l,h),1),g=Math.max(a,u),v=Math.max(l,h);g%f===0&&v%d===0&&(n-=.5)}return Math.min(Math.max(n,0),1)}_isAlmostInt(e){return Math.abs(Math.round(e)-e)<.01}};Xp.INSTANCE=new Xp;var wM=Xp,CM=class extends Gg{constructor(t,e,i){super(),this._onScroll=this._register(new ve),this.onScroll=this._onScroll.event,this._onWillScroll=this._register(new ve),this.onWillScroll=this._onWillScroll.event,this._options=kM(e),this._scrollable=i,this._register(this._scrollable.onScroll(a=>{this._onWillScroll.fire(a),this._onDidScroll(a),this._onScroll.fire(a)}));let n={onMouseWheel:a=>this._onMouseWheel(a),onDragStart:()=>this._onDragStart(),onDragEnd:()=>this._onDragEnd()};this._verticalScrollbar=this._register(new SM(this._scrollable,this._options,n)),this._horizontalScrollbar=this._register(new vM(this._scrollable,this._options,n)),this._domNode=document.createElement("div"),this._domNode.className="xterm-scrollable-element "+this._options.className,this._domNode.setAttribute("role","presentation"),this._domNode.style.position="relative",this._domNode.appendChild(t),this._domNode.appendChild(this._horizontalScrollbar.domNode.domNode),this._domNode.appendChild(this._verticalScrollbar.domNode.domNode),this._options.useShadows?(this._leftShadowDomNode=xu(document.createElement("div")),this._leftShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._leftShadowDomNode.domNode),this._topShadowDomNode=xu(document.createElement("div")),this._topShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._topShadowDomNode.domNode),this._topLeftShadowDomNode=xu(document.createElement("div")),this._topLeftShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._topLeftShadowDomNode.domNode)):(this._leftShadowDomNode=null,this._topShadowDomNode=null,this._topLeftShadowDomNode=null),this._listenOnDomNode=this._options.listenOnDomNode||this._domNode,this._mouseWheelToDispose=[],this._setListeningToMouseWheel(this._options.handleMouseWheel),this.onmouseover(this._listenOnDomNode,a=>this._onMouseOver(a)),this.onmouseleave(this._listenOnDomNode,a=>this._onMouseLeave(a)),this._hideTimeout=this._register(new qg),this._isDragging=!1,this._mouseIsOver=!1,this._shouldRender=!0,this._revealOnScroll=!0}get options(){return this._options}dispose(){this._mouseWheelToDispose=Uo(this._mouseWheelToDispose),super.dispose()}getDomNode(){return this._domNode}getOverviewRulerLayoutInfo(){return{parent:this._domNode,insertBefore:this._verticalScrollbar.domNode.domNode}}delegateVerticalScrollbarPointerDown(t){this._verticalScrollbar.delegatePointerDown(t)}getScrollDimensions(){return this._scrollable.getScrollDimensions()}setScrollDimensions(t){this._scrollable.setScrollDimensions(t,!1)}updateClassName(t){this._options.className=t,rn&&(this._options.className+=" mac"),this._domNode.className="xterm-scrollable-element "+this._options.className}updateOptions(t){typeof t.handleMouseWheel<"u"&&(this._options.handleMouseWheel=t.handleMouseWheel,this._setListeningToMouseWheel(this._options.handleMouseWheel)),typeof t.mouseWheelScrollSensitivity<"u"&&(this._options.mouseWheelScrollSensitivity=t.mouseWheelScrollSensitivity),typeof t.fastScrollSensitivity<"u"&&(this._options.fastScrollSensitivity=t.fastScrollSensitivity),typeof t.scrollPredominantAxis<"u"&&(this._options.scrollPredominantAxis=t.scrollPredominantAxis),typeof t.horizontal<"u"&&(this._options.horizontal=t.horizontal),typeof t.vertical<"u"&&(this._options.vertical=t.vertical),typeof t.horizontalScrollbarSize<"u"&&(this._options.horizontalScrollbarSize=t.horizontalScrollbarSize),typeof t.verticalScrollbarSize<"u"&&(this._options.verticalScrollbarSize=t.verticalScrollbarSize),typeof t.scrollByPage<"u"&&(this._options.scrollByPage=t.scrollByPage),this._horizontalScrollbar.updateOptions(this._options),this._verticalScrollbar.updateOptions(this._options),this._options.lazyRender||this._render()}setRevealOnScroll(t){this._revealOnScroll=t}delegateScrollFromMouseWheelEvent(t){this._onMouseWheel(new yb(t))}_setListeningToMouseWheel(t){if(this._mouseWheelToDispose.length>0!==t&&(this._mouseWheelToDispose=Uo(this._mouseWheelToDispose),t)){let e=i=>{this._onMouseWheel(new yb(i))};this._mouseWheelToDispose.push(Ye(this._listenOnDomNode,Di.MOUSE_WHEEL,e,{passive:!1}))}}_onMouseWheel(t){if(t.browserEvent?.defaultPrevented)return;let e=wM.INSTANCE;e.acceptStandardWheelEvent(t);let i=!1;if(t.deltaY||t.deltaX){let a=t.deltaY*this._options.mouseWheelScrollSensitivity,l=t.deltaX*this._options.mouseWheelScrollSensitivity;this._options.scrollPredominantAxis&&(this._options.scrollYToX&&l+a===0?l=a=0:Math.abs(a)>=Math.abs(l)?l=0:a=0),this._options.flipAxes&&([a,l]=[l,a]);let u=!rn&&t.browserEvent&&t.browserEvent.shiftKey;(this._options.scrollYToX||u)&&!l&&(l=a,a=0),t.browserEvent&&t.browserEvent.altKey&&(l=l*this._options.fastScrollSensitivity,a=a*this._options.fastScrollSensitivity);let h=this._scrollable.getFutureScrollPosition(),f={};if(a){let d=Tb*a,g=h.scrollTop-(d<0?Math.floor(d):Math.ceil(d));this._verticalScrollbar.writeScrollPosition(f,g)}if(l){let d=Tb*l,g=h.scrollLeft-(d<0?Math.floor(d):Math.ceil(d));this._horizontalScrollbar.writeScrollPosition(f,g)}f=this._scrollable.validateScrollPosition(f),(h.scrollLeft!==f.scrollLeft||h.scrollTop!==f.scrollTop)&&(this._options.mouseWheelSmoothScroll&&e.isPhysicalMouseWheel()?this._scrollable.setScrollPositionSmooth(f):this._scrollable.setScrollPositionNow(f),i=!0)}let n=i;!n&&this._options.alwaysConsumeMouseWheel&&(n=!0),!n&&this._options.consumeMouseWheelIfScrollbarIsNeeded&&(this._verticalScrollbar.isNeeded()||this._horizontalScrollbar.isNeeded())&&(n=!0),n&&(t.preventDefault(),t.stopPropagation())}_onDidScroll(t){this._shouldRender=this._horizontalScrollbar.onDidScroll(t)||this._shouldRender,this._shouldRender=this._verticalScrollbar.onDidScroll(t)||this._shouldRender,this._options.useShadows&&(this._shouldRender=!0),this._revealOnScroll&&this._reveal(),this._options.lazyRender||this._render()}renderNow(){if(!this._options.lazyRender)throw new Error("Please use `lazyRender` together with `renderNow`!");this._render()}_render(){if(this._shouldRender&&(this._shouldRender=!1,this._horizontalScrollbar.render(),this._verticalScrollbar.render(),this._options.useShadows)){let t=this._scrollable.getCurrentScrollPosition(),e=t.scrollTop>0,i=t.scrollLeft>0,n=i?" left":"",a=e?" top":"",l=i||e?" top-left-corner":"";this._leftShadowDomNode.setClassName(`shadow${n}`),this._topShadowDomNode.setClassName(`shadow${a}`),this._topLeftShadowDomNode.setClassName(`shadow${l}${a}${n}`)}}_onDragStart(){this._isDragging=!0,this._reveal()}_onDragEnd(){this._isDragging=!1,this._hide()}_onMouseLeave(t){this._mouseIsOver=!1,this._hide()}_onMouseOver(t){this._mouseIsOver=!0,this._reveal()}_reveal(){this._verticalScrollbar.beginReveal(),this._horizontalScrollbar.beginReveal(),this._scheduleHide()}_hide(){!this._mouseIsOver&&!this._isDragging&&(this._verticalScrollbar.beginHide(),this._horizontalScrollbar.beginHide())}_scheduleHide(){!this._mouseIsOver&&!this._isDragging&&this._hideTimeout.cancelAndSet(()=>this._hide(),yM)}},xM=class extends CM{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 kM(t){let e={lazyRender:typeof t.lazyRender<"u"?t.lazyRender:!1,className:typeof t.className<"u"?t.className:"",useShadows:typeof t.useShadows<"u"?t.useShadows:!0,handleMouseWheel:typeof t.handleMouseWheel<"u"?t.handleMouseWheel:!0,flipAxes:typeof t.flipAxes<"u"?t.flipAxes:!1,consumeMouseWheelIfScrollbarIsNeeded:typeof t.consumeMouseWheelIfScrollbarIsNeeded<"u"?t.consumeMouseWheelIfScrollbarIsNeeded:!1,alwaysConsumeMouseWheel:typeof t.alwaysConsumeMouseWheel<"u"?t.alwaysConsumeMouseWheel:!1,scrollYToX:typeof t.scrollYToX<"u"?t.scrollYToX:!1,mouseWheelScrollSensitivity:typeof t.mouseWheelScrollSensitivity<"u"?t.mouseWheelScrollSensitivity:1,fastScrollSensitivity:typeof t.fastScrollSensitivity<"u"?t.fastScrollSensitivity:5,scrollPredominantAxis:typeof t.scrollPredominantAxis<"u"?t.scrollPredominantAxis:!0,mouseWheelSmoothScroll:typeof t.mouseWheelSmoothScroll<"u"?t.mouseWheelSmoothScroll:!0,arrowSize:typeof t.arrowSize<"u"?t.arrowSize:11,listenOnDomNode:typeof t.listenOnDomNode<"u"?t.listenOnDomNode:null,horizontal:typeof t.horizontal<"u"?t.horizontal:1,horizontalScrollbarSize:typeof t.horizontalScrollbarSize<"u"?t.horizontalScrollbarSize:10,horizontalSliderSize:typeof t.horizontalSliderSize<"u"?t.horizontalSliderSize:0,horizontalHasArrows:typeof t.horizontalHasArrows<"u"?t.horizontalHasArrows:!1,vertical:typeof t.vertical<"u"?t.vertical:1,verticalScrollbarSize:typeof t.verticalScrollbarSize<"u"?t.verticalScrollbarSize:10,verticalHasArrows:typeof t.verticalHasArrows<"u"?t.verticalHasArrows:!1,verticalSliderSize:typeof t.verticalSliderSize<"u"?t.verticalSliderSize:0,scrollByPage:typeof t.scrollByPage<"u"?t.scrollByPage:!1};return e.horizontalSliderSize=typeof t.horizontalSliderSize<"u"?t.horizontalSliderSize:e.horizontalScrollbarSize,e.verticalSliderSize=typeof t.verticalSliderSize<"u"?t.verticalSliderSize:e.verticalScrollbarSize,rn&&(e.className+=" mac"),e}var Zp=class extends nt{constructor(e,i,n,a,l,u,h,f){super(),this._bufferService=n,this._optionsService=h,this._renderService=f,this._onRequestScrollLines=this._register(new ve),this.onRequestScrollLines=this._onRequestScrollLines.event,this._isSyncing=!1,this._isHandlingScroll=!1,this._suppressOnScrollHandler=!1;let d=this._register(new dM({forceIntegerValues:!1,smoothScrollDuration:this._optionsService.rawOptions.smoothScrollDuration,scheduleAtNextAnimationFrame:g=>Yg(a.window,g)}));this._register(this._optionsService.onSpecificOptionChange("smoothScrollDuration",()=>{d.setSmoothScrollDuration(this._optionsService.rawOptions.smoothScrollDuration)})),this._scrollableElement=this._register(new xM(i,{vertical:1,horizontal:2,useShadows:!1,mouseWheelSmoothScroll:!0,...this._getChangeOptions()},d)),this._register(this._optionsService.onMultipleOptionChange(["scrollSensitivity","fastScrollSensitivity","overviewRuler"],()=>this._scrollableElement.updateOptions(this._getChangeOptions()))),this._register(l.onProtocolChange(g=>{this._scrollableElement.updateOptions({handleMouseWheel:!(g&16)})})),this._scrollableElement.setScrollDimensions({height:0,scrollHeight:0}),this._register(Qi.runAndSubscribe(u.onChangeColors,()=>{this._scrollableElement.getDomNode().style.backgroundColor=u.colors.background.css})),e.appendChild(this._scrollableElement.getDomNode()),this._register(jt(()=>this._scrollableElement.getDomNode().remove())),this._styleElement=a.mainDocument.createElement("style"),i.appendChild(this._styleElement),this._register(jt(()=>this._styleElement.remove())),this._register(Qi.runAndSubscribe(u.onChangeColors,()=>{this._styleElement.textContent=[".xterm .xterm-scrollable-element > .scrollbar > .slider {",` background: ${u.colors.scrollbarSliderBackground.css};`,"}",".xterm .xterm-scrollable-element > .scrollbar > .slider:hover {",` background: ${u.colors.scrollbarSliderHoverBackground.css};`,"}",".xterm .xterm-scrollable-element > .scrollbar > .slider.active {",` background: ${u.colors.scrollbarSliderActiveBackground.css};`,"}"].join(`
18
+ `)})),this._register(this._bufferService.onResize(()=>this.queueSync())),this._register(this._bufferService.buffers.onBufferActivate(()=>{this._latestYDisp=void 0,this.queueSync()})),this._register(this._bufferService.onScroll(()=>this._sync())),this._register(this._scrollableElement.onScroll(g=>this._handleScroll(g)))}scrollLines(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}};Zp=si([xe(2,fs),xe(3,Gn),xe(4,eC),xe(5,Zl),xe(6,ms),xe(7,Kn)],Zp);var Qp=class extends nt{constructor(e,i,n,a,l){super(),this._screenElement=e,this._bufferService=i,this._coreBrowserService=n,this._decorationService=a,this._renderService=l,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(u=>this._removeDecoration(u))),this._register(jt(()=>{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()}};Qp=si([xe(1,fs),xe(2,Gn),xe(3,Nu),xe(4,Kn)],Qp);var EM=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)}},Qr={full:0,left:0,center:0,right:0},Da={full:0,left:0,center:0,right:0},iu={full:0,left:0,center:0,right:0},Yd=class extends nt{constructor(e,i,n,a,l,u,h,f){super(),this._viewportElement=e,this._screenElement=i,this._bufferService=n,this._decorationService=a,this._renderService=l,this._optionsService=u,this._themeService=h,this._coreBrowserService=f,this._colorZoneStore=new EM,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(jt(()=>this._canvas?.remove()));let d=this._canvas.getContext("2d");if(d)this._ctx=d;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);Da.full=this._canvas.width,Da.left=e,Da.center=i,Da.right=e,this._refreshDrawHeightConstants(),iu.full=1,iu.left=1,iu.center=1+Da.left,iu.right=1+Da.left+Da.center}_refreshDrawHeightConstants(){Qr.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);Qr.left=i,Qr.center=i,Qr.right=i}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*Qr.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*Qr.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*Qr.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*Qr.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(iu[e.position||"full"],Math.round((this._canvas.height-1)*(e.startBufferLine/this._bufferService.buffers.active.lines.length)-Qr[e.position||"full"]/2),Da[e.position||"full"],Math.round((this._canvas.height-1)*((e.endBufferLine-e.startBufferLine)/this._bufferService.buffers.active.lines.length)+Qr[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}))}};Yd=si([xe(2,fs),xe(3,Nu),xe(4,Kn),xe(5,ms),xe(6,Zl),xe(7,Gn)],Yd);var le;(t=>(t.NUL="\0",t.SOH="",t.STX="",t.ETX="",t.EOT="",t.ENQ="",t.ACK="",t.BEL="\x07",t.BS="\b",t.HT=" ",t.LF=`
19
+ `,t.VT="\v",t.FF="\f",t.CR="\r",t.SO="",t.SI="",t.DLE="",t.DC1="",t.DC2="",t.DC3="",t.DC4="",t.NAK="",t.SYN="",t.ETB="",t.CAN="",t.EM="",t.SUB="",t.ESC="\x1B",t.FS="",t.GS="",t.RS="",t.US="",t.SP=" ",t.DEL=""))(le||={});var xd;(t=>(t.PAD="€",t.HOP="",t.BPH="‚",t.NBH="ƒ",t.IND="„",t.NEL="…",t.SSA="†",t.ESA="‡",t.HTS="ˆ",t.HTJ="‰",t.VTS="Š",t.PLD="‹",t.PLU="Œ",t.RI="",t.SS2="Ž",t.SS3="",t.DCS="",t.PU1="‘",t.PU2="’",t.STS="“",t.CCH="”",t.MW="•",t.SPA="–",t.EPA="—",t.SOS="˜",t.SGCI="™",t.SCI="š",t.CSI="›",t.ST="œ",t.OSC="",t.PM="ž",t.APC="Ÿ"))(xd||={});var bC;(t=>t.ST=`${le.ESC}\\`)(bC||={});var Jp=class{constructor(e,i,n,a,l,u){this._textarea=e,this._compositionView=i,this._bufferService=n,this._optionsService=a,this._coreService=l,this._renderService=u,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(`${le.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,a=this._bufferService.buffer.y*this._renderService.dimensions.css.cell.height,l=i*this._renderService.dimensions.css.cell.width;this._compositionView.style.left=l+"px",this._compositionView.style.top=a+"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 u=this._compositionView.getBoundingClientRect();this._textarea.style.left=l+"px",this._textarea.style.top=a+"px",this._textarea.style.width=Math.max(u.width,1)+"px",this._textarea.style.height=Math.max(u.height,1)+"px",this._textarea.style.lineHeight=u.height+"px"}e||setTimeout(()=>this.updateCompositionElements(!0),0)}}};Jp=si([xe(2,fs),xe(3,ms),xe(4,Wo),xe(5,Kn)],Jp);var Oi=0,Bi=0,Ni=0,ti=0,Rb={css:"#00000000",rgba:0},gi;(t=>{function e(a,l,u,h){return h!==void 0?`#${xo(a)}${xo(l)}${xo(u)}${xo(h)}`:`#${xo(a)}${xo(l)}${xo(u)}`}t.toCss=e;function i(a,l,u,h=255){return(a<<24|l<<16|u<<8|h)>>>0}t.toRgba=i;function n(a,l,u,h){return{css:t.toCss(a,l,u,h),rgba:t.toRgba(a,l,u,h)}}t.toColor=n})(gi||={});var Ht;(t=>{function e(f,d){if(ti=(d.rgba&255)/255,ti===1)return{css:d.css,rgba:d.rgba};let g=d.rgba>>24&255,v=d.rgba>>16&255,p=d.rgba>>8&255,S=f.rgba>>24&255,y=f.rgba>>16&255,C=f.rgba>>8&255;Oi=S+Math.round((g-S)*ti),Bi=y+Math.round((v-y)*ti),Ni=C+Math.round((p-C)*ti);let x=gi.toCss(Oi,Bi,Ni),R=gi.toRgba(Oi,Bi,Ni);return{css:x,rgba:R}}t.blend=e;function i(f){return(f.rgba&255)===255}t.isOpaque=i;function n(f,d,g){let v=kd.ensureContrastRatio(f.rgba,d.rgba,g);if(v)return gi.toColor(v>>24&255,v>>16&255,v>>8&255)}t.ensureContrastRatio=n;function a(f){let d=(f.rgba|255)>>>0;return[Oi,Bi,Ni]=kd.toChannels(d),{css:gi.toCss(Oi,Bi,Ni),rgba:d}}t.opaque=a;function l(f,d){return ti=Math.round(d*255),[Oi,Bi,Ni]=kd.toChannels(f.rgba),{css:gi.toCss(Oi,Bi,Ni,ti),rgba:gi.toRgba(Oi,Bi,Ni,ti)}}t.opacity=l;function u(f,d){return ti=f.rgba&255,l(f,ti*d/255)}t.multiplyOpacity=u;function h(f){return[f.rgba>>24&255,f.rgba>>16&255,f.rgba>>8&255]}t.toColorRGB=h})(Ht||={});var Gt;(t=>{let e,i;try{let a=document.createElement("canvas");a.width=1,a.height=1;let l=a.getContext("2d",{willReadFrequently:!0});l&&(e=l,e.globalCompositeOperation="copy",i=e.createLinearGradient(0,0,1,1))}catch{}function n(a){if(a.match(/#[\da-f]{3,8}/i))switch(a.length){case 4:return Oi=parseInt(a.slice(1,2).repeat(2),16),Bi=parseInt(a.slice(2,3).repeat(2),16),Ni=parseInt(a.slice(3,4).repeat(2),16),gi.toColor(Oi,Bi,Ni);case 5:return Oi=parseInt(a.slice(1,2).repeat(2),16),Bi=parseInt(a.slice(2,3).repeat(2),16),Ni=parseInt(a.slice(3,4).repeat(2),16),ti=parseInt(a.slice(4,5).repeat(2),16),gi.toColor(Oi,Bi,Ni,ti);case 7:return{css:a,rgba:(parseInt(a.slice(1),16)<<8|255)>>>0};case 9:return{css:a,rgba:parseInt(a.slice(1),16)>>>0}}let l=a.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(l)return Oi=parseInt(l[1]),Bi=parseInt(l[2]),Ni=parseInt(l[3]),ti=Math.round((l[5]===void 0?1:parseFloat(l[5]))*255),gi.toColor(Oi,Bi,Ni,ti);if(!e||!i)throw new Error("css.toColor: Unsupported css format");if(e.fillStyle=i,e.fillStyle=a,typeof e.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(e.fillRect(0,0,1,1),[Oi,Bi,Ni,ti]=e.getImageData(0,0,1,1).data,ti!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:gi.toRgba(Oi,Bi,Ni,ti),css:a}}t.toColor=n})(Gt||={});var us;(t=>{function e(n){return i(n>>16&255,n>>8&255,n&255)}t.relativeLuminance=e;function i(n,a,l){let u=n/255,h=a/255,f=l/255,d=u<=.03928?u/12.92:Math.pow((u+.055)/1.055,2.4),g=h<=.03928?h/12.92:Math.pow((h+.055)/1.055,2.4),v=f<=.03928?f/12.92:Math.pow((f+.055)/1.055,2.4);return d*.2126+g*.7152+v*.0722}t.relativeLuminance2=i})(us||={});var kd;(t=>{function e(u,h){if(ti=(h&255)/255,ti===1)return h;let f=h>>24&255,d=h>>16&255,g=h>>8&255,v=u>>24&255,p=u>>16&255,S=u>>8&255;return Oi=v+Math.round((f-v)*ti),Bi=p+Math.round((d-p)*ti),Ni=S+Math.round((g-S)*ti),gi.toRgba(Oi,Bi,Ni)}t.blend=e;function i(u,h,f){let d=us.relativeLuminance(u>>8),g=us.relativeLuminance(h>>8);if(Nn(d,g)<f){if(g<d){let S=n(u,h,f),y=Nn(d,us.relativeLuminance(S>>8));if(y<f){let C=a(u,h,f),x=Nn(d,us.relativeLuminance(C>>8));return y>x?S:C}return S}let v=a(u,h,f),p=Nn(d,us.relativeLuminance(v>>8));if(p<f){let S=n(u,h,f),y=Nn(d,us.relativeLuminance(S>>8));return p>y?v:S}return v}}t.ensureContrastRatio=i;function n(u,h,f){let d=u>>24&255,g=u>>16&255,v=u>>8&255,p=h>>24&255,S=h>>16&255,y=h>>8&255,C=Nn(us.relativeLuminance2(p,S,y),us.relativeLuminance2(d,g,v));for(;C<f&&(p>0||S>0||y>0);)p-=Math.max(0,Math.ceil(p*.1)),S-=Math.max(0,Math.ceil(S*.1)),y-=Math.max(0,Math.ceil(y*.1)),C=Nn(us.relativeLuminance2(p,S,y),us.relativeLuminance2(d,g,v));return(p<<24|S<<16|y<<8|255)>>>0}t.reduceLuminance=n;function a(u,h,f){let d=u>>24&255,g=u>>16&255,v=u>>8&255,p=h>>24&255,S=h>>16&255,y=h>>8&255,C=Nn(us.relativeLuminance2(p,S,y),us.relativeLuminance2(d,g,v));for(;C<f&&(p<255||S<255||y<255);)p=Math.min(255,p+Math.ceil((255-p)*.1)),S=Math.min(255,S+Math.ceil((255-S)*.1)),y=Math.min(255,y+Math.ceil((255-y)*.1)),C=Nn(us.relativeLuminance2(p,S,y),us.relativeLuminance2(d,g,v));return(p<<24|S<<16|y<<8|255)>>>0}t.increaseLuminance=a;function l(u){return[u>>24&255,u>>16&255,u>>8&255,u&255]}t.toChannels=l})(kd||={});function xo(t){let e=t.toString(16);return e.length<2?"0"+e:e}function Nn(t,e){return t<e?(e+.05)/(t+.05):(t+.05)/(e+.05)}var TM=class extends Bu{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()]}},Gd=class{constructor(t){this._bufferService=t,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new kr}register(t){let e={id:this._nextCharacterJoinerId++,handler:t};return this._characterJoiners.push(e),e.id}deregister(t){for(let e=0;e<this._characterJoiners.length;e++)if(this._characterJoiners[e].id===t)return this._characterJoiners.splice(e,1),!0;return!1}getJoinedCharacters(t){if(this._characterJoiners.length===0)return[];let e=this._bufferService.buffer.lines.get(t);if(!e||e.length===0)return[];let i=[],n=e.translateToString(!0),a=0,l=0,u=0,h=e.getFg(0),f=e.getBg(0);for(let d=0;d<e.getTrimmedLength();d++)if(e.loadCell(d,this._workCell),this._workCell.getWidth()!==0){if(this._workCell.fg!==h||this._workCell.bg!==f){if(d-a>1){let g=this._getJoinedRanges(n,u,l,e,a);for(let v=0;v<g.length;v++)i.push(g[v])}a=d,u=l,h=this._workCell.fg,f=this._workCell.bg}l+=this._workCell.getChars().length||$a.length}if(this._bufferService.cols-a>1){let d=this._getJoinedRanges(n,u,l,e,a);for(let g=0;g<d.length;g++)i.push(d[g])}return i}_getJoinedRanges(t,e,i,n,a){let l=t.substring(e,i),u=[];try{u=this._characterJoiners[0].handler(l)}catch(h){console.error(h)}for(let h=1;h<this._characterJoiners.length;h++)try{let f=this._characterJoiners[h].handler(l);for(let d=0;d<f.length;d++)Gd._mergeRanges(u,f[d])}catch(f){console.error(f)}return this._stringRangesToCellRanges(u,n,a),u}_stringRangesToCellRanges(t,e,i){let n=0,a=!1,l=0,u=t[n];if(u){for(let h=i;h<this._bufferService.cols;h++){let f=e.getWidth(h),d=e.getString(h).length||$a.length;if(f!==0){if(!a&&u[0]<=l&&(u[0]=h,a=!0),u[1]<=l){if(u[1]=h,u=t[++n],!u)break;u[0]<=l?(u[0]=h,a=!0):a=!1}l+=d}}u&&(u[1]=this._bufferService.cols)}}static _mergeRanges(t,e){let i=!1;for(let n=0;n<t.length;n++){let a=t[n];if(i){if(e[1]<=a[0])return t[n-1][1]=e[1],t;if(e[1]<=a[1])return t[n-1][1]=Math.max(e[1],a[1]),t.splice(n,1),t;t.splice(n,1),n--}else{if(e[1]<=a[0])return t.splice(n,0,e),t;if(e[1]<=a[1])return a[0]=Math.min(e[0],a[0]),t;e[0]<a[1]&&(a[0]=Math.min(e[0],a[0]),i=!0);continue}}return i?t[t.length-1][1]=e[1]:t.push(e),t}};Gd=si([xe(0,fs)],Gd);function RM(t){return 57508<=t&&t<=57558}function MM(t){return 9472<=t&&t<=9631}function AM(t){return RM(t)||MM(t)}function LM(){return{css:{canvas:nd(),cell:nd()},device:{canvas:nd(),cell:nd(),char:{width:0,height:0,left:0,top:0}}}}function nd(){return{width:0,height:0}}var eg=class{constructor(e,i,n,a,l,u,h){this._document=e,this._characterJoinerService=i,this._optionsService=n,this._coreBrowserService=a,this._coreService=l,this._decorationService=u,this._themeService=h,this._workCell=new kr,this._columnSelectMode=!1,this.defaultSpacing=0}handleSelectionChanged(e,i,n){this._selectionStart=e,this._selectionEnd=i,this._columnSelectMode=n}createRow(e,i,n,a,l,u,h,f,d,g,v){let p=[],S=this._characterJoinerService.getJoinedCharacters(i),y=this._themeService.colors,C=e.getNoBgTrimmedLength();n&&C<u+1&&(C=u+1);let x,R=0,L="",N=0,T=0,W=0,D=0,I=!1,H=0,V=!1,se=0,Q=0,A=[],O=g!==-1&&v!==-1;for(let P=0;P<C;P++){e.loadCell(P,this._workCell);let $=this._workCell.getWidth();if($===0)continue;let E=!1,M=P>=Q,z=P,q=this._workCell;if(S.length>0&&P===S[0][0]&&M){let ke=S.shift(),ze=this._isCellInSelection(ke[0],i);for(N=ke[0]+1;N<ke[1];N++)M&&=ze===this._isCellInSelection(N,i);M&&=!n||u<ke[0]||u>=ke[1],M?(E=!0,q=new TM(this._workCell,e.translateToString(!0,ke[0],ke[1]),ke[1]-ke[0]),z=ke[1]-1,$=q.getWidth()):Q=ke[1]}let G=this._isCellInSelection(P,i),B=n&&P===u,K=O&&P>=g&&P<=v,te=!1;this._decorationService.forEachDecorationAtCell(P,i,void 0,ke=>{te=!0});let ne=q.getChars()||$a;if(ne===" "&&(q.isUnderline()||q.isOverline())&&(ne=" "),se=$*f-d.get(ne,q.isBold(),q.isItalic()),!x)x=this._document.createElement("span");else if(R&&(G&&V||!G&&!V&&q.bg===T)&&(G&&V&&y.selectionForeground||q.fg===W)&&q.extended.ext===D&&K===I&&se===H&&!B&&!E&&!te&&M){q.isInvisible()?L+=$a:L+=ne,R++;continue}else R&&(x.textContent=L),x=this._document.createElement("span"),R=0,L="";if(T=q.bg,W=q.fg,D=q.extended.ext,I=K,H=se,V=G,E&&u>=P&&u<=z&&(u=P),!this._coreService.isCursorHidden&&B&&this._coreService.isCursorInitialized){if(A.push("xterm-cursor"),this._coreBrowserService.isFocused)h&&A.push("xterm-cursor-blink"),A.push(a==="bar"?"xterm-cursor-bar":a==="underline"?"xterm-cursor-underline":"xterm-cursor-block");else if(l)switch(l){case"outline":A.push("xterm-cursor-outline");break;case"block":A.push("xterm-cursor-block");break;case"bar":A.push("xterm-cursor-bar");break;case"underline":A.push("xterm-cursor-underline");break}}if(q.isBold()&&A.push("xterm-bold"),q.isItalic()&&A.push("xterm-italic"),q.isDim()&&A.push("xterm-dim"),q.isInvisible()?L=$a:L=q.getChars()||$a,q.isUnderline()&&(A.push(`xterm-underline-${q.extended.underlineStyle}`),L===" "&&(L=" "),!q.isUnderlineColorDefault()))if(q.isUnderlineColorRGB())x.style.textDecorationColor=`rgb(${Bu.toColorRGB(q.getUnderlineColor()).join(",")})`;else{let ke=q.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&q.isBold()&&ke<8&&(ke+=8),x.style.textDecorationColor=y.ansi[ke].css}q.isOverline()&&(A.push("xterm-overline"),L===" "&&(L=" ")),q.isStrikethrough()&&A.push("xterm-strikethrough"),K&&(x.style.textDecoration="underline");let de=q.getFgColor(),ue=q.getFgColorMode(),he=q.getBgColor(),Se=q.getBgColorMode(),we=!!q.isInverse();if(we){let ke=de;de=he,he=ke;let ze=ue;ue=Se,Se=ze}let Ee,Le,it=!1;this._decorationService.forEachDecorationAtCell(P,i,void 0,ke=>{ke.options.layer!=="top"&&it||(ke.backgroundColorRGB&&(Se=50331648,he=ke.backgroundColorRGB.rgba>>8&16777215,Ee=ke.backgroundColorRGB),ke.foregroundColorRGB&&(ue=50331648,de=ke.foregroundColorRGB.rgba>>8&16777215,Le=ke.foregroundColorRGB),it=ke.options.layer==="top")}),!it&&G&&(Ee=this._coreBrowserService.isFocused?y.selectionBackgroundOpaque:y.selectionInactiveBackgroundOpaque,he=Ee.rgba>>8&16777215,Se=50331648,it=!0,y.selectionForeground&&(ue=50331648,de=y.selectionForeground.rgba>>8&16777215,Le=y.selectionForeground)),it&&A.push("xterm-decoration-top");let Ze;switch(Se){case 16777216:case 33554432:Ze=y.ansi[he],A.push(`xterm-bg-${he}`);break;case 50331648:Ze=gi.toColor(he>>16,he>>8&255,he&255),this._addStyle(x,`background-color:#${Mb((he>>>0).toString(16),"0",6)}`);break;default:we?(Ze=y.foreground,A.push("xterm-bg-257")):Ze=y.background}switch(Ee||q.isDim()&&(Ee=Ht.multiplyOpacity(Ze,.5)),ue){case 16777216:case 33554432:q.isBold()&&de<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(de+=8),this._applyMinimumContrast(x,Ze,y.ansi[de],q,Ee,void 0)||A.push(`xterm-fg-${de}`);break;case 50331648:let ke=gi.toColor(de>>16&255,de>>8&255,de&255);this._applyMinimumContrast(x,Ze,ke,q,Ee,Le)||this._addStyle(x,`color:#${Mb(de.toString(16),"0",6)}`);break;default:this._applyMinimumContrast(x,Ze,y.foreground,q,Ee,Le)||we&&A.push("xterm-fg-257")}A.length&&(x.className=A.join(" "),A.length=0),!B&&!E&&!te&&M?R++:x.textContent=L,se!==this.defaultSpacing&&(x.style.letterSpacing=`${se}px`),p.push(x),P=z}return x&&R&&(x.textContent=L),p}_applyMinimumContrast(e,i,n,a,l,u){if(this._optionsService.rawOptions.minimumContrastRatio===1||AM(a.getCode()))return!1;let h=this._getContrastCache(a),f;if(!l&&!u&&(f=h.getColor(i.rgba,n.rgba)),f===void 0){let d=this._optionsService.rawOptions.minimumContrastRatio/(a.isDim()?2:1);f=Ht.ensureContrastRatio(l||i,u||n,d),h.setColor((l||i).rgba,(u||n).rgba,f??null)}return f?(this._addStyle(e,`color:${f.css}`),!0):!1}_getContrastCache(e){return e.isDim()?this._themeService.colors.halfContrastCache:this._themeService.colors.contrastCache}_addStyle(e,i){e.setAttribute("style",`${e.getAttribute("style")||""}${i};`)}_isCellInSelection(e,i){let n=this._selectionStart,a=this._selectionEnd;return!n||!a?!1:this._columnSelectMode?n[0]<=a[0]?e>=n[0]&&i>=n[1]&&e<a[0]&&i<=a[1]:e<n[0]&&i>=n[1]&&e>=a[0]&&i<=a[1]:i>n[1]&&i<a[1]||n[1]===a[1]&&i===n[1]&&e>=n[0]&&e<a[0]||n[1]<a[1]&&i===a[1]&&e<a[0]||n[1]<a[1]&&i===n[1]&&e>=n[0]}};eg=si([xe(1,sC),xe(2,ms),xe(3,Gn),xe(4,Wo),xe(5,Nu),xe(6,Zl)],eg);function Mb(t,e,i){for(;t.length<i;)t=e+t;return t}var DM=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 a=e.createElement("span");a.classList.add("xterm-char-measure-element"),a.style.fontWeight="bold";let l=e.createElement("span");l.classList.add("xterm-char-measure-element"),l.style.fontStyle="italic";let u=e.createElement("span");u.classList.add("xterm-char-measure-element"),u.style.fontWeight="bold",u.style.fontStyle="italic",this._measureElements=[n,a,l,u],this._container.appendChild(n),this._container.appendChild(a),this._container.appendChild(l),this._container.appendChild(u),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,a){e===this._font&&i===this._fontSize&&n===this._weight&&a===this._weightBold||(this._font=e,this._fontSize=i,this._weight=n,this._weightBold=a,this._container.style.fontFamily=this._font,this._container.style.fontSize=`${this._fontSize}px`,this._measureElements[0].style.fontWeight=`${n}`,this._measureElements[1].style.fontWeight=`${a}`,this._measureElements[2].style.fontWeight=`${n}`,this._measureElements[3].style.fontWeight=`${a}`,this.clear())}get(e,i,n){let a=0;if(!i&&!n&&e.length===1&&(a=e.charCodeAt(0))<256){if(this._flat[a]!==-9999)return this._flat[a];let h=this._measure(e,0);return h>0&&(this._flat[a]=h),h}let l=e;i&&(l+="B"),n&&(l+="I");let u=this._holey.get(l);if(u===void 0){let h=0;i&&(h|=1),n&&(h|=2),u=this._measure(e,h),u>0&&this._holey.set(l,u)}return u}_measure(e,i){let n=this._measureElements[i];return n.textContent=e.repeat(32),n.offsetWidth/32}},OM=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,a=!1){if(this.selectionStart=i,this.selectionEnd=n,!i||!n||i[0]===n[0]&&i[1]===n[1]){this.clear();return}let l=e.buffers.active.ydisp,u=i[1]-l,h=n[1]-l,f=Math.max(u,0),d=Math.min(h,e.rows-1);if(f>=e.rows||d<0){this.clear();return}this.hasSelection=!0,this.columnSelectMode=a,this.viewportStartRow=u,this.viewportEndRow=h,this.viewportCappedStartRow=f,this.viewportCappedEndRow=d,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 BM(){return new OM}var X_="xterm-dom-renderer-owner-",gr="xterm-rows",ad="xterm-fg-",Ab="xterm-bg-",su="xterm-focus",od="xterm-selection",NM=1,tg=class extends nt{constructor(e,i,n,a,l,u,h,f,d,g,v,p,S,y){super(),this._terminal=e,this._document=i,this._element=n,this._screenElement=a,this._viewportElement=l,this._helperContainer=u,this._linkifier2=h,this._charSizeService=d,this._optionsService=g,this._bufferService=v,this._coreService=p,this._coreBrowserService=S,this._themeService=y,this._terminalClass=NM++,this._rowElements=[],this._selectionRenderModel=BM(),this.onRequestRedraw=this._register(new ve).event,this._rowContainer=this._document.createElement("div"),this._rowContainer.classList.add(gr),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(od),this._selectionContainer.setAttribute("aria-hidden","true"),this.dimensions=LM(),this._updateDimensions(),this._register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this._register(this._themeService.onChangeColors(C=>this._injectCss(C))),this._injectCss(this._themeService.colors),this._rowFactory=f.createInstance(eg,document),this._element.classList.add(X_+this._terminalClass),this._screenElement.appendChild(this._rowContainer),this._screenElement.appendChild(this._selectionContainer),this._register(this._linkifier2.onShowLinkUnderline(C=>this._handleLinkHover(C))),this._register(this._linkifier2.onHideLinkUnderline(C=>this._handleLinkLeave(C))),this._register(jt(()=>{this._element.classList.remove(X_+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()})),this._widthCache=new DM(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} .${gr} 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} .${gr} { 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} .${gr} .xterm-dim { color: ${Ht.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}`,a=`blink_bar_${this._terminalClass}`,l=`blink_block_${this._terminalClass}`;i+=`@keyframes ${n} { 50% { border-bottom-style: hidden; }}`,i+=`@keyframes ${a} { 50% { box-shadow: none; }}`,i+=`@keyframes ${l} { 0% { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css}; } 50% { background-color: inherit; color: ${e.cursor.css}; }}`,i+=`${this._terminalSelector} .${gr}.${su} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${n} 1s step-end infinite;}${this._terminalSelector} .${gr}.${su} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${a} 1s step-end infinite;}${this._terminalSelector} .${gr}.${su} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${l} 1s step-end infinite;}${this._terminalSelector} .${gr} .xterm-cursor.xterm-cursor-block { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css};}${this._terminalSelector} .${gr} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${e.cursor.css} !important; color: ${e.cursorAccent.css} !important;}${this._terminalSelector} .${gr} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${e.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${gr} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${e.cursor.css} inset;}${this._terminalSelector} .${gr} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${e.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,i+=`${this._terminalSelector} .${od} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${od} div { position: absolute; background-color: ${e.selectionBackgroundOpaque.css};}${this._terminalSelector} .${od} div { position: absolute; background-color: ${e.selectionInactiveBackgroundOpaque.css};}`;for(let[u,h]of e.ansi.entries())i+=`${this._terminalSelector} .${ad}${u} { color: ${h.css}; }${this._terminalSelector} .${ad}${u}.xterm-dim { color: ${Ht.multiplyOpacity(h,.5).css}; }${this._terminalSelector} .${Ab}${u} { background-color: ${h.css}; }`;i+=`${this._terminalSelector} .${ad}257 { color: ${Ht.opaque(e.background).css}; }${this._terminalSelector} .${ad}257.xterm-dim { color: ${Ht.multiplyOpacity(Ht.opaque(e.background),.5).css}; }${this._terminalSelector} .${Ab}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 a=this._document.createElement("div");this._rowContainer.appendChild(a),this._rowElements.push(a)}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(su),this.renderRows(0,this._bufferService.rows-1)}handleFocus(){this._rowContainer.classList.add(su),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 a=this._selectionRenderModel.viewportStartRow,l=this._selectionRenderModel.viewportEndRow,u=this._selectionRenderModel.viewportCappedStartRow,h=this._selectionRenderModel.viewportCappedEndRow,f=this._document.createDocumentFragment();if(n){let d=e[0]>i[0];f.appendChild(this._createSelectionElement(u,d?i[0]:e[0],d?e[0]:i[0],h-u+1))}else{let d=a===u?e[0]:0,g=u===l?i[0]:this._bufferService.cols;f.appendChild(this._createSelectionElement(u,d,g));let v=h-u-1;if(f.appendChild(this._createSelectionElement(u+1,0,this._bufferService.cols,v)),u!==h){let p=l===h?i[0]:this._bufferService.cols;f.appendChild(this._createSelectionElement(h,0,p))}}this._selectionContainer.appendChild(f)}_createSelectionElement(e,i,n,a=1){let l=this._document.createElement("div"),u=i*this.dimensions.css.cell.width,h=this.dimensions.css.cell.width*(n-i);return u+h>this.dimensions.css.canvas.width&&(h=this.dimensions.css.canvas.width-u),l.style.height=`${a*this.dimensions.css.cell.height}px`,l.style.top=`${e*this.dimensions.css.cell.height}px`,l.style.left=`${u}px`,l.style.width=`${h}px`,l}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,a=n.ybase+n.y,l=Math.min(n.x,this._bufferService.cols-1),u=this._coreService.decPrivateModes.cursorBlink??this._optionsService.rawOptions.cursorBlink,h=this._coreService.decPrivateModes.cursorStyle??this._optionsService.rawOptions.cursorStyle,f=this._optionsService.rawOptions.cursorInactiveStyle;for(let d=e;d<=i;d++){let g=d+n.ydisp,v=this._rowElements[d],p=n.lines.get(g);if(!v||!p)break;v.replaceChildren(...this._rowFactory.createRow(p,g,g===a,h,f,l,u,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${X_}${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,a,l,u){n<0&&(e=0),a<0&&(i=0);let h=this._bufferService.rows-1;n=Math.max(Math.min(n,h),0),a=Math.max(Math.min(a,h),0),l=Math.min(l,this._bufferService.cols);let f=this._bufferService.buffer,d=f.ybase+f.y,g=Math.min(f.x,l-1),v=this._optionsService.rawOptions.cursorBlink,p=this._optionsService.rawOptions.cursorStyle,S=this._optionsService.rawOptions.cursorInactiveStyle;for(let y=n;y<=a;++y){let C=y+f.ydisp,x=this._rowElements[y],R=f.lines.get(C);if(!x||!R)break;x.replaceChildren(...this._rowFactory.createRow(R,C,C===d,p,S,g,v,this.dimensions.css.cell.width,this._widthCache,u?y===n?e:0:-1,u?(y===a?i:l)-1:-1))}}};tg=si([xe(7,Fg),xe(8,uf),xe(9,ms),xe(10,fs),xe(11,Wo),xe(12,Gn),xe(13,Zl)],tg);var ig=class extends nt{constructor(e,i,n){super(),this._optionsService=n,this.width=0,this.height=0,this._onCharSizeChange=this._register(new ve),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this._register(new zM(this._optionsService))}catch{this._measureStrategy=this._register(new PM(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())}};ig=si([xe(2,ms)],ig);var wC=class extends nt{constructor(){super(...arguments),this._result={width:0,height:0}}_validateAndSet(t,e){t!==void 0&&t>0&&e!==void 0&&e>0&&(this._result.width=t,this._result.height=e)}},PM=class extends wC{constructor(t,e,i){super(),this._document=t,this._parentElement=e,this._optionsService=i,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}},zM=class extends wC{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}},HM=class extends nt{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 IM(this._window)),this._onDprChange=this._register(new ve),this.onDprChange=this._onDprChange.event,this._onWindowChange=this._register(new ve),this.onWindowChange=this._onWindowChange.event,this._register(this.onWindowChange(a=>this._screenDprMonitor.setWindow(a))),this._register(Qi.forward(this._screenDprMonitor.onDprChange,this._onDprChange)),this._register(Ye(this._textarea,"focus",()=>this._isFocused=!0)),this._register(Ye(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}},IM=class extends nt{constructor(e){super(),this._parentWindow=e,this._windowResizeListener=this._register(new Gl),this._onDprChange=this._register(new ve),this.onDprChange=this._onDprChange.event,this._outerListener=()=>this._setDprAndFireIfDiffers(),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._updateDpr(),this._setWindowResizeListener(),this._register(jt(()=>this.clearListener()))}setWindow(e){this._parentWindow=e,this._setWindowResizeListener(),this._setDprAndFireIfDiffers()}_setWindowResizeListener(){this._windowResizeListener.value=Ye(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)}},UM=class extends nt{constructor(){super(),this.linkProviders=[],this._register(jt(()=>this.linkProviders.length=0))}registerLinkProvider(t){return this.linkProviders.push(t),{dispose:()=>{let e=this.linkProviders.indexOf(t);e!==-1&&this.linkProviders.splice(e,1)}}}};function Kg(t,e,i){let n=i.getBoundingClientRect(),a=t.getComputedStyle(i),l=parseInt(a.getPropertyValue("padding-left")),u=parseInt(a.getPropertyValue("padding-top"));return[e.clientX-n.left-l,e.clientY-n.top-u]}function FM(t,e,i,n,a,l,u,h,f){if(!l)return;let d=Kg(t,e,i);if(d)return d[0]=Math.ceil((d[0]+(f?u/2:0))/u),d[1]=Math.ceil(d[1]/h),d[0]=Math.min(Math.max(d[0],1),n+(f?1:0)),d[1]=Math.min(Math.max(d[1],1),a),d}var sg=class{constructor(e,i){this._renderService=e,this._charSizeService=i}getCoords(e,i,n,a,l){return FM(window,e,i,n,a,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,l)}getMouseReportCoords(e,i){let n=Kg(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])}}};sg=si([xe(0,Kn),xe(1,uf)],sg);var $M=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=[]}},CC={};QT(CC,{getSafariVersion:()=>jM,isChromeOS:()=>TC,isFirefox:()=>xC,isIpad:()=>VM,isIphone:()=>qM,isLegacyEdge:()=>WM,isLinux:()=>Xg,isMac:()=>Kd,isNode:()=>hf,isSafari:()=>kC,isWindows:()=>EC});var hf=typeof process<"u"&&"title"in process,Pu=hf?"node":navigator.userAgent,zu=hf?"node":navigator.platform,xC=Pu.includes("Firefox"),WM=Pu.includes("Edge"),kC=/^((?!chrome|android).)*safari/i.test(Pu);function jM(){if(!kC)return 0;let t=Pu.match(/Version\/(\d+)/);return t===null||t.length<2?0:parseInt(t[1])}var Kd=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(zu),VM=zu==="iPad",qM=zu==="iPhone",EC=["Windows","Win16","Win32","WinCE"].includes(zu),Xg=zu.indexOf("Linux")>=0,TC=/\bCrOS\b/.test(Pu),RC=class{constructor(){this._tasks=[],this._i=0}enqueue(t){this._tasks.push(t),this._start()}flush(){for(;this._i<this._tasks.length;)this._tasks[this._i]()||this._i++;this.clear()}clear(){this._idleCallback&&(this._cancelCallback(this._idleCallback),this._idleCallback=void 0),this._i=0,this._tasks.length=0}_start(){this._idleCallback||(this._idleCallback=this._requestCallback(this._process.bind(this)))}_process(t){this._idleCallback=void 0;let e=0,i=0,n=t.timeRemaining(),a=0;for(;this._i<this._tasks.length;){if(e=performance.now(),this._tasks[this._i]()||this._i++,e=Math.max(1,performance.now()-e),i=Math.max(e,i),a=t.timeRemaining(),i*1.5>a){n-e<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(n-e))}ms`),this._start();return}n=a}this.clear()}},YM=class extends RC{_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())}}},GM=class extends RC{_requestCallback(t){return requestIdleCallback(t)}_cancelCallback(t){cancelIdleCallback(t)}},Xd=!hf&&"requestIdleCallback"in window?GM:YM,KM=class{constructor(){this._queue=new Xd}set(e){this._queue.clear(),this._queue.enqueue(e)}flush(){this._queue.flush()}},rg=class extends nt{constructor(e,i,n,a,l,u,h,f,d){super(),this._rowCount=e,this._optionsService=n,this._charSizeService=a,this._coreService=l,this._coreBrowserService=f,this._renderer=this._register(new Gl),this._pausedResizeTask=new KM,this._observerDisposable=this._register(new Gl),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 ve),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this._register(new ve),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this._register(new ve),this.onRender=this._onRender.event,this._onRefreshRequest=this._register(new ve),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new $M((g,v)=>this._renderRows(g,v),this._coreBrowserService),this._register(this._renderDebouncer),this._syncOutputHandler=new XM(this._coreBrowserService,this._coreService,()=>this._fullRefresh()),this._register(jt(()=>this._syncOutputHandler.dispose())),this._register(this._coreBrowserService.onDprChange(()=>this.handleDevicePixelRatioChange())),this._register(h.onResize(()=>this._fullRefresh())),this._register(h.buffers.onBufferActivate(()=>this._renderer.value?.clear())),this._register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this._register(this._charSizeService.onCharSizeChange(()=>this.handleCharSizeChanged())),this._register(u.onDecorationRegistered(()=>this._fullRefresh())),this._register(u.onDecorationRemoved(()=>this._fullRefresh())),this._register(this._optionsService.onMultipleOptionChange(["customGlyphs","drawBoldTextInBrightColors","letterSpacing","lineHeight","fontFamily","fontSize","fontWeight","fontWeightBold","minimumContrastRatio","rescaleOverlappingGlyphs"],()=>{this.clear(),this.handleResize(h.cols,h.rows),this._fullRefresh()})),this._register(this._optionsService.onMultipleOptionChange(["cursorBlink","cursorStyle"],()=>this.refreshRows(h.buffer.y,h.buffer.y,!0))),this._register(d.onChangeColors(()=>this._fullRefresh())),this._registerIntersectionObserver(this._coreBrowserService.window,i),this._register(this._coreBrowserService.onWindowChange(g=>this._registerIntersectionObserver(g,i)))}get dimensions(){return this._renderer.value.dimensions}_registerIntersectionObserver(e,i){if("IntersectionObserver"in e){let n=new e.IntersectionObserver(a=>this._handleIntersectionChange(a[a.length-1]),{threshold:0});n.observe(i),this._observerDisposable.value=jt(()=>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 a=this._syncOutputHandler.flush();a&&(e=Math.min(e,a.start),i=Math.max(i,a.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()}};rg=si([xe(2,ms),xe(3,uf),xe(4,Wo),xe(5,Nu),xe(6,fs),xe(7,Gn),xe(8,Zl)],rg);var XM=class{constructor(t,e,i){this._coreBrowserService=t,this._coreService=e,this._onTimeout=i,this._start=0,this._end=0,this._isBuffering=!1}bufferRows(t,e){this._isBuffering?(this._start=Math.min(this._start,t),this._end=Math.max(this._end,e)):(this._start=t,this._end=e,this._isBuffering=!0),this._timeout===void 0&&(this._timeout=this._coreBrowserService.window.setTimeout(()=>{this._timeout=void 0,this._coreService.decPrivateModes.synchronizedOutput=!1,this._onTimeout()},1e3))}flush(){if(this._timeout!==void 0&&(this._coreBrowserService.window.clearTimeout(this._timeout),this._timeout=void 0),!this._isBuffering)return;let t={start:this._start,end:this._end};return this._isBuffering=!1,t}dispose(){this._timeout!==void 0&&(this._coreBrowserService.window.clearTimeout(this._timeout),this._timeout=void 0)}};function ZM(t,e,i,n){let a=i.buffer.x,l=i.buffer.y;if(!i.buffer.hasScrollback)return eA(a,l,t,e,i,n)+df(l,e,i,n)+tA(a,l,t,e,i,n);let u;if(l===e)return u=a>t?"D":"C",Mu(Math.abs(a-t),Ru(u,n));u=l>e?"D":"C";let h=Math.abs(l-e),f=JM(l>e?t:a,i)+(h-1)*i.cols+1+QM(l>e?a:t);return Mu(f,Ru(u,n))}function QM(t,e){return t-1}function JM(t,e){return e.cols-t}function eA(t,e,i,n,a,l){return df(e,n,a,l).length===0?"":Mu(AC(t,e,t,e-Fo(e,a),!1,a).length,Ru("D",l))}function df(t,e,i,n){let a=t-Fo(t,i),l=e-Fo(e,i),u=Math.abs(a-l)-iA(t,e,i);return Mu(u,Ru(MC(t,e),n))}function tA(t,e,i,n,a,l){let u;df(e,n,a,l).length>0?u=n-Fo(n,a):u=e;let h=n,f=sA(t,e,i,n,a,l);return Mu(AC(t,u,i,h,f==="C",a).length,Ru(f,l))}function iA(t,e,i){let n=0,a=t-Fo(t,i),l=e-Fo(e,i);for(let u=0;u<Math.abs(a-l);u++){let h=MC(t,e)==="A"?-1:1;i.buffer.lines.get(a+h*u)?.isWrapped&&n++}return n}function Fo(t,e){let i=0,n=e.buffer.lines.get(t),a=n?.isWrapped;for(;a&&t>=0&&t<e.rows;)i++,n=e.buffer.lines.get(--t),a=n?.isWrapped;return i}function sA(t,e,i,n,a,l){let u;return df(i,n,a,l).length>0?u=n-Fo(n,a):u=e,t<i&&u<=n||t>=i&&u<n?"C":"D"}function MC(t,e){return t>e?"A":"B"}function AC(t,e,i,n,a,l){let u=t,h=e,f="";for(;(u!==i||h!==n)&&h>=0&&h<l.buffer.lines.length;)u+=a?1:-1,a&&u>l.cols-1?(f+=l.buffer.translateBufferLineToString(h,!1,t,u),u=0,t=0,h++):!a&&u<0&&(f+=l.buffer.translateBufferLineToString(h,!1,0,t+1),u=l.cols-1,t=u,h--);return f+l.buffer.translateBufferLineToString(h,!1,t,u)}function Ru(t,e){let i=e?"O":"[";return le.ESC+i+t}function Mu(t,e){t=Math.floor(t);let i="";for(let n=0;n<t;n++)i+=e;return i}var rA=class{constructor(t){this._bufferService=t,this.isSelectAllActive=!1,this.selectionStartLength=0}clearSelection(){this.selectionStart=void 0,this.selectionEnd=void 0,this.isSelectAllActive=!1,this.selectionStartLength=0}get finalSelectionStart(){return this.isSelectAllActive?[0,0]:!this.selectionEnd||!this.selectionStart?this.selectionStart:this.areSelectionValuesReversed()?this.selectionEnd:this.selectionStart}get finalSelectionEnd(){if(this.isSelectAllActive)return[this._bufferService.cols,this._bufferService.buffer.ybase+this._bufferService.rows-1];if(this.selectionStart){if(!this.selectionEnd||this.areSelectionValuesReversed()){let t=this.selectionStart[0]+this.selectionStartLength;return t>this._bufferService.cols?t%this._bufferService.cols===0?[this._bufferService.cols,this.selectionStart[1]+Math.floor(t/this._bufferService.cols)-1]:[t%this._bufferService.cols,this.selectionStart[1]+Math.floor(t/this._bufferService.cols)]:[t,this.selectionStart[1]]}if(this.selectionStartLength&&this.selectionEnd[1]===this.selectionStart[1]){let t=this.selectionStart[0]+this.selectionStartLength;return t>this._bufferService.cols?[t%this._bufferService.cols,this.selectionStart[1]+Math.floor(t/this._bufferService.cols)]:[Math.max(t,this.selectionEnd[0]),this.selectionEnd[1]]}return this.selectionEnd}}areSelectionValuesReversed(){let t=this.selectionStart,e=this.selectionEnd;return!t||!e?!1:t[1]>e[1]||t[1]===e[1]&&t[0]>e[0]}handleTrim(t){return this.selectionStart&&(this.selectionStart[1]-=t),this.selectionEnd&&(this.selectionEnd[1]-=t),this.selectionEnd&&this.selectionEnd[1]<0?(this.clearSelection(),!0):(this.selectionStart&&this.selectionStart[1]<0&&(this.selectionStart[1]=0),!1)}};function Lb(t,e){if(t.start.y>t.end.y)throw new Error(`Buffer range end (${t.end.x}, ${t.end.y}) cannot be before start (${t.start.x}, ${t.start.y})`);return e*(t.end.y-t.start.y)+(t.end.x-t.start.x+1)}var Z_=50,nA=15,aA=50,oA=500,lA=" ",cA=new RegExp(lA,"g"),ng=class extends nt{constructor(e,i,n,a,l,u,h,f,d){super(),this._element=e,this._screenElement=i,this._linkifier=n,this._bufferService=a,this._coreService=l,this._mouseService=u,this._optionsService=h,this._renderService=f,this._coreBrowserService=d,this._dragScrollAmount=0,this._enabled=!0,this._workCell=new kr,this._mouseDownTimeStamp=0,this._oldHasSelection=!1,this._oldSelectionStart=void 0,this._oldSelectionEnd=void 0,this._onLinuxMouseSelection=this._register(new ve),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this._register(new ve),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this._register(new ve),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this._register(new ve),this.onRequestScrollLines=this._onRequestScrollLines.event,this._mouseMoveListener=g=>this._handleMouseMove(g),this._mouseUpListener=g=>this._handleMouseUp(g),this._coreService.onUserInput(()=>{this.hasSelection&&this.clearSelection()}),this._trimListener=this._bufferService.buffer.lines.onTrim(g=>this._handleTrim(g)),this._register(this._bufferService.buffers.onBufferActivate(g=>this._handleBufferActivate(g))),this.enable(),this._model=new rA(this._bufferService),this._activeSelectionMode=0,this._register(jt(()=>{this._removeMouseDownListeners()})),this._register(this._bufferService.onResize(g=>{g.rowsChanged&&this.clearSelection()}))}reset(){this.clearSelection()}disable(){this.clearSelection(),this._enabled=!1}enable(){this._enabled=!0}get selectionStart(){return this._model.finalSelectionStart}get selectionEnd(){return this._model.finalSelectionEnd}get hasSelection(){let 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,a=[];if(this._activeSelectionMode===3){if(e[0]===i[0])return"";let l=e[0]<i[0]?e[0]:i[0],u=e[0]<i[0]?i[0]:e[0];for(let h=e[1];h<=i[1];h++){let f=n.translateBufferLineToString(h,!0,l,u);a.push(f)}}else{let l=e[1]===i[1]?i[0]:void 0;a.push(n.translateBufferLineToString(e[1],!0,e[0],l));for(let u=e[1]+1;u<=i[1]-1;u++){let h=n.lines.get(u),f=n.translateBufferLineToString(u,!0);h?.isWrapped?a[a.length-1]+=f:a.push(f)}if(e[1]!==i[1]){let u=n.lines.get(i[1]),h=n.translateBufferLineToString(i[1],!0,0,i[0]);u&&u.isWrapped?a[a.length-1]+=h:a.push(h)}}return a.map(l=>l.replace(cA," ")).join(EC?`\r
20
+ `:`
21
+ `)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(e){this._refreshAnimationFrame||(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._refresh())),Xg&&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,a=this._model.finalSelectionEnd;return!n||!a||!i?!1:this._areCoordsInSelection(i,n,a)}isCellInSelection(e,i){let n=this._model.finalSelectionStart,a=this._model.finalSelectionEnd;return!n||!a?!1:this._areCoordsInSelection([e,i],n,a)}_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=Lb(n,this._bufferService.cols),this._model.selectionEnd=void 0,!0;let a=this._getMouseBufferCoords(e);return a?(this._selectWordAt(a,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=Kg(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,-Z_),Z_),i/=Z_,i/Math.abs(i)+Math.round(i*(nA-1)))}shouldForceSelection(e){return Kd?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(),aA)}_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&&!(Kd&&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 a=n.lines.get(this._model.selectionEnd[1]);a&&a.hasWidth(this._model.selectionEnd[0])===0&&this._model.selectionEnd[0]<this._bufferService.cols&&this._model.selectionEnd[0]++}(!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<oA&&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 a=ZM(n[0]-1,n[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(a,!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 a=0;i>=a;a++){let l=e.loadCell(a,this._workCell).getChars().length;this._workCell.getWidth()===0?n--:l>1&&i!==a&&(n+=l-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,a=!0){if(e[0]>=this._bufferService.cols)return;let l=this._bufferService.buffer,u=l.lines.get(e[1]);if(!u)return;let h=l.translateBufferLineToString(e[1],!1),f=this._convertViewportColToCharacterIndex(u,e[0]),d=f,g=e[0]-f,v=0,p=0,S=0,y=0;if(h.charAt(f)===" "){for(;f>0&&h.charAt(f-1)===" ";)f--;for(;d<h.length&&h.charAt(d+1)===" ";)d++}else{let R=e[0],L=e[0];u.getWidth(R)===0&&(v++,R--),u.getWidth(L)===2&&(p++,L++);let N=u.getString(L).length;for(N>1&&(y+=N-1,d+=N-1);R>0&&f>0&&!this._isCharWordSeparator(u.loadCell(R-1,this._workCell));){u.loadCell(R-1,this._workCell);let T=this._workCell.getChars().length;this._workCell.getWidth()===0?(v++,R--):T>1&&(S+=T-1,f-=T-1),f--,R--}for(;L<u.length&&d+1<h.length&&!this._isCharWordSeparator(u.loadCell(L+1,this._workCell));){u.loadCell(L+1,this._workCell);let T=this._workCell.getChars().length;this._workCell.getWidth()===2?(p++,L++):T>1&&(y+=T-1,d+=T-1),d++,L++}}d++;let C=f+g-v+S,x=Math.min(this._bufferService.cols,d-f+v+p-S-y);if(!(!i&&h.slice(f,d).trim()==="")){if(n&&C===0&&u.getCodePoint(0)!==32){let R=l.lines.get(e[1]-1);if(R&&u.isWrapped&&R.getCodePoint(this._bufferService.cols-1)!==32){let L=this._getWordAt([this._bufferService.cols-1,e[1]-1],!1,!0,!1);if(L){let N=this._bufferService.cols-L.start;C-=N,x+=N}}}if(a&&C+x===this._bufferService.cols&&u.getCodePoint(this._bufferService.cols-1)!==32){let R=l.lines.get(e[1]+1);if(R?.isWrapped&&R.getCodePoint(0)!==32){let L=this._getWordAt([0,e[1]+1],!1,!1,!0);L&&(x+=L.length)}}return{start:C,length:x}}}_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=Lb(n,this._bufferService.cols)}};ng=si([xe(3,fs),xe(4,Wo),xe(5,$g),xe(6,ms),xe(7,Kn),xe(8,Gn)],ng);var Db=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={}}},Ob=class{constructor(){this._color=new Db,this._css=new Db}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()}},Ci=Object.freeze((()=>{let t=[Gt.toColor("#2e3436"),Gt.toColor("#cc0000"),Gt.toColor("#4e9a06"),Gt.toColor("#c4a000"),Gt.toColor("#3465a4"),Gt.toColor("#75507b"),Gt.toColor("#06989a"),Gt.toColor("#d3d7cf"),Gt.toColor("#555753"),Gt.toColor("#ef2929"),Gt.toColor("#8ae234"),Gt.toColor("#fce94f"),Gt.toColor("#729fcf"),Gt.toColor("#ad7fa8"),Gt.toColor("#34e2e2"),Gt.toColor("#eeeeec")],e=[0,95,135,175,215,255];for(let i=0;i<216;i++){let n=e[i/36%6|0],a=e[i/6%6|0],l=e[i%6];t.push({css:gi.toCss(n,a,l),rgba:gi.toRgba(n,a,l)})}for(let i=0;i<24;i++){let n=8+i*10;t.push({css:gi.toCss(n,n,n),rgba:gi.toRgba(n,n,n)})}return t})()),Eo=Gt.toColor("#ffffff"),pu=Gt.toColor("#000000"),Bb=Gt.toColor("#ffffff"),Nb=pu,ru={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117},uA=Eo,ag=class extends nt{constructor(e){super(),this._optionsService=e,this._contrastCache=new Ob,this._halfContrastCache=new Ob,this._onChangeColors=this._register(new ve),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:Eo,background:pu,cursor:Bb,cursorAccent:Nb,selectionForeground:void 0,selectionBackgroundTransparent:ru,selectionBackgroundOpaque:Ht.blend(pu,ru),selectionInactiveBackgroundTransparent:ru,selectionInactiveBackgroundOpaque:Ht.blend(pu,ru),scrollbarSliderBackground:Ht.opacity(Eo,.2),scrollbarSliderHoverBackground:Ht.opacity(Eo,.4),scrollbarSliderActiveBackground:Ht.opacity(Eo,.5),overviewRulerBorder:Eo,ansi:Ci.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=Mt(e.foreground,Eo),i.background=Mt(e.background,pu),i.cursor=Ht.blend(i.background,Mt(e.cursor,Bb)),i.cursorAccent=Ht.blend(i.background,Mt(e.cursorAccent,Nb)),i.selectionBackgroundTransparent=Mt(e.selectionBackground,ru),i.selectionBackgroundOpaque=Ht.blend(i.background,i.selectionBackgroundTransparent),i.selectionInactiveBackgroundTransparent=Mt(e.selectionInactiveBackground,i.selectionBackgroundTransparent),i.selectionInactiveBackgroundOpaque=Ht.blend(i.background,i.selectionInactiveBackgroundTransparent),i.selectionForeground=e.selectionForeground?Mt(e.selectionForeground,Rb):void 0,i.selectionForeground===Rb&&(i.selectionForeground=void 0),Ht.isOpaque(i.selectionBackgroundTransparent)&&(i.selectionBackgroundTransparent=Ht.opacity(i.selectionBackgroundTransparent,.3)),Ht.isOpaque(i.selectionInactiveBackgroundTransparent)&&(i.selectionInactiveBackgroundTransparent=Ht.opacity(i.selectionInactiveBackgroundTransparent,.3)),i.scrollbarSliderBackground=Mt(e.scrollbarSliderBackground,Ht.opacity(i.foreground,.2)),i.scrollbarSliderHoverBackground=Mt(e.scrollbarSliderHoverBackground,Ht.opacity(i.foreground,.4)),i.scrollbarSliderActiveBackground=Mt(e.scrollbarSliderActiveBackground,Ht.opacity(i.foreground,.5)),i.overviewRulerBorder=Mt(e.overviewRulerBorder,uA),i.ansi=Ci.slice(),i.ansi[0]=Mt(e.black,Ci[0]),i.ansi[1]=Mt(e.red,Ci[1]),i.ansi[2]=Mt(e.green,Ci[2]),i.ansi[3]=Mt(e.yellow,Ci[3]),i.ansi[4]=Mt(e.blue,Ci[4]),i.ansi[5]=Mt(e.magenta,Ci[5]),i.ansi[6]=Mt(e.cyan,Ci[6]),i.ansi[7]=Mt(e.white,Ci[7]),i.ansi[8]=Mt(e.brightBlack,Ci[8]),i.ansi[9]=Mt(e.brightRed,Ci[9]),i.ansi[10]=Mt(e.brightGreen,Ci[10]),i.ansi[11]=Mt(e.brightYellow,Ci[11]),i.ansi[12]=Mt(e.brightBlue,Ci[12]),i.ansi[13]=Mt(e.brightMagenta,Ci[13]),i.ansi[14]=Mt(e.brightCyan,Ci[14]),i.ansi[15]=Mt(e.brightWhite,Ci[15]),e.extendedAnsi){let n=Math.min(i.ansi.length-16,e.extendedAnsi.length);for(let a=0;a<n;a++)i.ansi[a+16]=Mt(e.extendedAnsi[a],Ci[a+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()}}};ag=si([xe(0,ms)],ag);function Mt(t,e){if(t!==void 0)try{return Gt.toColor(t)}catch{}return e}var hA=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)}},dA=class{constructor(){this._services=new hA,this._services.set(Fg,this)}setService(t,e){this._services.set(t,e)}getService(t){return this._services.get(t)}createInstance(t,...e){let i=nR(t).sort((l,u)=>l.index-u.index),n=[];for(let l of i){let u=this._services.get(l.id);if(!u)throw new Error(`[createInstance] ${t.name} depends on UNKNOWN service ${l.id._id}.`);n.push(u)}let a=i.length>0?i[0].index:e.length;if(e.length!==a)throw new Error(`[createInstance] First service dependency of ${t.name} at position ${a+1} conflicts with ${e.length} static arguments`);return new t(...e,...n)}},fA={trace:0,debug:1,info:2,warn:3,error:4,off:5},mA="xterm.js: ",og=class extends nt{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=fA[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?"":mA)+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)}};og=si([xe(0,ms)],og);var Pb=class extends nt{constructor(e){super(),this._maxLength=e,this.onDeleteEmitter=this._register(new ve),this.onDelete=this.onDeleteEmitter.event,this.onInsertEmitter=this._register(new ve),this.onInsert=this.onInsertEmitter.event,this.onTrimEmitter=this._register(new ve),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 a=e;a<this._length-i;a++)this._array[this._getCyclicIndex(a)]=this._array[this._getCyclicIndex(a+i)];this._length-=i,this.onDeleteEmitter.fire({index:e,amount:i})}for(let a=this._length-1;a>=e;a--)this._array[this._getCyclicIndex(a+n.length)]=this._array[this._getCyclicIndex(a)];for(let a=0;a<n.length;a++)this._array[this._getCyclicIndex(e+a)]=n[a];if(n.length&&this.onInsertEmitter.fire({index:e,amount:n.length}),this._length+n.length>this._maxLength){let a=this._length+n.length-this._maxLength;this._startIndex+=a,this._length=this._maxLength,this.onTrimEmitter.fire(a)}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 l=i-1;l>=0;l--)this.set(e+l+n,this.get(e+l));let a=e+i+n-this._length;if(a>0)for(this._length+=a;this._length>this._maxLength;)this._length--,this._startIndex++,this.onTrimEmitter.fire(1)}else for(let a=0;a<i;a++)this.set(e+a+n,this.get(e+a))}}_getCyclicIndex(e){return(this._startIndex+e)%this._maxLength}},st=3,_i=Object.freeze(new Bu),ld=0,Q_=2,gu=class LC{constructor(e,i,n=!1){this.isWrapped=n,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(e*st);let a=i||kr.fromCharData([0,Xw,1,0]);for(let l=0;l<e;++l)this.setCell(l,a);this.length=e}get(e){let i=this._data[e*st+0],n=i&2097151;return[this._data[e*st+1],i&2097152?this._combined[e]:n?Ia(n):"",i>>22,i&2097152?this._combined[e].charCodeAt(this._combined[e].length-1):n]}set(e,i){this._data[e*st+1]=i[0],i[1].length>1?(this._combined[e]=i[1],this._data[e*st+0]=e|2097152|i[2]<<22):this._data[e*st+0]=i[1].charCodeAt(0)|i[2]<<22}getWidth(e){return this._data[e*st+0]>>22}hasWidth(e){return this._data[e*st+0]&12582912}getFg(e){return this._data[e*st+1]}getBg(e){return this._data[e*st+2]}hasContent(e){return this._data[e*st+0]&4194303}getCodePoint(e){let i=this._data[e*st+0];return i&2097152?this._combined[e].charCodeAt(this._combined[e].length-1):i&2097151}isCombined(e){return this._data[e*st+0]&2097152}getString(e){let i=this._data[e*st+0];return i&2097152?this._combined[e]:i&2097151?Ia(i&2097151):""}isProtected(e){return this._data[e*st+2]&536870912}loadCell(e,i){return ld=e*st,i.content=this._data[ld+0],i.fg=this._data[ld+1],i.bg=this._data[ld+2],i.content&2097152&&(i.combinedData=this._combined[e]),i.bg&268435456&&(i.extended=this._extendedAttrs[e]),i}setCell(e,i){i.content&2097152&&(this._combined[e]=i.combinedData),i.bg&268435456&&(this._extendedAttrs[e]=i.extended),this._data[e*st+0]=i.content,this._data[e*st+1]=i.fg,this._data[e*st+2]=i.bg}setCellFromCodepoint(e,i,n,a){a.bg&268435456&&(this._extendedAttrs[e]=a.extended),this._data[e*st+0]=i|n<<22,this._data[e*st+1]=a.fg,this._data[e*st+2]=a.bg}addCodepointToCell(e,i,n){let a=this._data[e*st+0];a&2097152?this._combined[e]+=Ia(i):a&2097151?(this._combined[e]=Ia(a&2097151)+Ia(i),a&=-2097152,a|=2097152):a=i|1<<22,n&&(a&=-12582913,a|=n<<22),this._data[e*st+0]=a}insertCells(e,i,n){if(e%=this.length,e&&this.getWidth(e-1)===2&&this.setCellFromCodepoint(e-1,0,1,n),i<this.length-e){let a=new kr;for(let l=this.length-e-i-1;l>=0;--l)this.setCell(e+i+l,this.loadCell(e+l,a));for(let l=0;l<i;++l)this.setCell(e+l,n)}else for(let a=e;a<this.length;++a)this.setCell(a,n);this.getWidth(this.length-1)===2&&this.setCellFromCodepoint(this.length-1,0,1,n)}deleteCells(e,i,n){if(e%=this.length,i<this.length-e){let a=new kr;for(let l=0;l<this.length-e-i;++l)this.setCell(e+l,this.loadCell(e+i+l,a));for(let l=this.length-i;l<this.length;++l)this.setCell(l,n)}else for(let a=e;a<this.length;++a)this.setCell(a,n);e&&this.getWidth(e-1)===2&&this.setCellFromCodepoint(e-1,0,1,n),this.getWidth(e)===0&&!this.hasContent(e)&&this.setCellFromCodepoint(e,0,1,n)}replaceCells(e,i,n,a=!1){if(a){for(e&&this.getWidth(e-1)===2&&!this.isProtected(e-1)&&this.setCellFromCodepoint(e-1,0,1,n),i<this.length&&this.getWidth(i-1)===2&&!this.isProtected(i)&&this.setCellFromCodepoint(i,0,1,n);e<i&&e<this.length;)this.isProtected(e)||this.setCell(e,n),e++;return}for(e&&this.getWidth(e-1)===2&&this.setCellFromCodepoint(e-1,0,1,n),i<this.length&&this.getWidth(i-1)===2&&this.setCellFromCodepoint(i,0,1,n);e<i&&e<this.length;)this.setCell(e++,n)}resize(e,i){if(e===this.length)return this._data.length*4*Q_<this._data.buffer.byteLength;let n=e*st;if(e>this.length){if(this._data.buffer.byteLength>=n*4)this._data=new Uint32Array(this._data.buffer,0,n);else{let a=new Uint32Array(n);a.set(this._data),this._data=a}for(let a=this.length;a<e;++a)this.setCell(a,i)}else{this._data=this._data.subarray(0,n);let a=Object.keys(this._combined);for(let u=0;u<a.length;u++){let h=parseInt(a[u],10);h>=e&&delete this._combined[h]}let l=Object.keys(this._extendedAttrs);for(let u=0;u<l.length;u++){let h=parseInt(l[u],10);h>=e&&delete this._extendedAttrs[h]}}return this.length=e,n*4*Q_<this._data.buffer.byteLength}cleanupMemory(){if(this._data.length*4*Q_<this._data.buffer.byteLength){let e=new Uint32Array(this._data.length);return e.set(this._data),this._data=e,1}return 0}fill(e,i=!1){if(i){for(let n=0;n<this.length;++n)this.isProtected(n)||this.setCell(n,e);return}this._combined={},this._extendedAttrs={};for(let n=0;n<this.length;++n)this.setCell(n,e)}copyFrom(e){this.length!==e.length?this._data=new Uint32Array(e._data):this._data.set(e._data),this.length=e.length,this._combined={};for(let i in e._combined)this._combined[i]=e._combined[i];this._extendedAttrs={};for(let i in e._extendedAttrs)this._extendedAttrs[i]=e._extendedAttrs[i];this.isWrapped=e.isWrapped}clone(){let e=new LC(0);e._data=new Uint32Array(this._data),e.length=this.length;for(let i in this._combined)e._combined[i]=this._combined[i];for(let i in this._extendedAttrs)e._extendedAttrs[i]=this._extendedAttrs[i];return e.isWrapped=this.isWrapped,e}getTrimmedLength(){for(let e=this.length-1;e>=0;--e)if(this._data[e*st+0]&4194303)return e+(this._data[e*st+0]>>22);return 0}getNoBgTrimmedLength(){for(let e=this.length-1;e>=0;--e)if(this._data[e*st+0]&4194303||this._data[e*st+2]&50331648)return e+(this._data[e*st+0]>>22);return 0}copyCellsFrom(e,i,n,a,l){let u=e._data;if(l)for(let f=a-1;f>=0;f--){for(let d=0;d<st;d++)this._data[(n+f)*st+d]=u[(i+f)*st+d];u[(i+f)*st+2]&268435456&&(this._extendedAttrs[n+f]=e._extendedAttrs[i+f])}else for(let f=0;f<a;f++){for(let d=0;d<st;d++)this._data[(n+f)*st+d]=u[(i+f)*st+d];u[(i+f)*st+2]&268435456&&(this._extendedAttrs[n+f]=e._extendedAttrs[i+f])}let h=Object.keys(e._combined);for(let f=0;f<h.length;f++){let d=parseInt(h[f],10);d>=i&&(this._combined[d-i+n]=e._combined[d])}}translateToString(e,i,n,a){i=i??0,n=n??this.length,e&&(n=Math.min(n,this.getTrimmedLength())),a&&(a.length=0);let l="";for(;i<n;){let u=this._data[i*st+0],h=u&2097151,f=u&2097152?this._combined[i]:h?Ia(h):$a;if(l+=f,a)for(let d=0;d<f.length;++d)a.push(i);i+=u>>22||1}return a&&a.push(i),l}};function _A(t,e,i,n,a,l){let u=[];for(let h=0;h<t.length-1;h++){let f=h,d=t.get(++f);if(!d.isWrapped)continue;let g=[t.get(h)];for(;f<t.length&&d.isWrapped;)g.push(d),d=t.get(++f);if(!l&&n>=h&&n<f){h+=g.length-1;continue}let v=0,p=Au(g,v,e),S=1,y=0;for(;S<g.length;){let x=Au(g,S,e),R=x-y,L=i-p,N=Math.min(R,L);g[v].copyCellsFrom(g[S],y,p,N,!1),p+=N,p===i&&(v++,p=0),y+=N,y===x&&(S++,y=0),p===0&&v!==0&&g[v-1].getWidth(i-1)===2&&(g[v].copyCellsFrom(g[v-1],i-1,p++,1,!1),g[v-1].setCell(i-1,a))}g[v].replaceCells(p,i,a);let C=0;for(let x=g.length-1;x>0&&(x>v||g[x].getTrimmedLength()===0);x--)C++;C>0&&(u.push(h+g.length-C),u.push(C)),h+=g.length-1}return u}function pA(t,e){let i=[],n=0,a=e[n],l=0;for(let u=0;u<t.length;u++)if(a===u){let h=e[++n];t.onDeleteEmitter.fire({index:u-l,amount:h}),u+=h-1,l+=h,a=e[++n]}else i.push(u);return{layout:i,countRemoved:l}}function gA(t,e){let i=[];for(let n=0;n<e.length;n++)i.push(t.get(e[n]));for(let n=0;n<i.length;n++)t.set(n,i[n]);t.length=e.length}function vA(t,e,i){let n=[],a=t.map((f,d)=>Au(t,d,e)).reduce((f,d)=>f+d),l=0,u=0,h=0;for(;h<a;){if(a-h<i){n.push(a-h);break}l+=i;let f=Au(t,u,e);l>f&&(l-=f,u++);let d=t[u].getWidth(l-1)===2;d&&l--;let g=d?i-1:i;n.push(g),h+=g}return n}function Au(t,e,i){if(e===t.length-1)return t[e].getTrimmedLength();let n=!t[e].hasContent(i-1)&&t[e].getWidth(i-1)===1,a=t[e+1].getWidth(0)===2;return n&&a?i-1:i}var DC=class OC{constructor(e){this.line=e,this.isDisposed=!1,this._disposables=[],this._id=OC._nextId++,this._onDispose=this.register(new ve),this.onDispose=this._onDispose.event}get id(){return this._id}dispose(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire(),Uo(this._disposables),this._disposables.length=0)}register(e){return this._disposables.push(e),e}};DC._nextId=1;var SA=DC,ki={},To=ki.B;ki[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:"≥","{":"π","|":"≠","}":"£","~":"·"};ki.A={"#":"£"};ki.B=void 0;ki[4]={"#":"£","@":"¾","[":"ij","\\":"½","]":"|","{":"¨","|":"f","}":"¼","~":"´"};ki.C=ki[5]={"[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"};ki.R={"#":"£","@":"à","[":"°","\\":"ç","]":"§","{":"é","|":"ù","}":"è","~":"¨"};ki.Q={"@":"à","[":"â","\\":"ç","]":"ê","^":"î","`":"ô","{":"é","|":"ù","}":"è","~":"û"};ki.K={"@":"§","[":"Ä","\\":"Ö","]":"Ü","{":"ä","|":"ö","}":"ü","~":"ß"};ki.Y={"#":"£","@":"§","[":"°","\\":"ç","]":"é","`":"ù","{":"à","|":"ò","}":"è","~":"ì"};ki.E=ki[6]={"@":"Ä","[":"Æ","\\":"Ø","]":"Å","^":"Ü","`":"ä","{":"æ","|":"ø","}":"å","~":"ü"};ki.Z={"#":"£","@":"§","[":"¡","\\":"Ñ","]":"¿","{":"°","|":"ñ","}":"ç"};ki.H=ki[7]={"@":"É","[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"};ki["="]={"#":"ù","@":"à","[":"é","\\":"ç","]":"ê","^":"î",_:"è","`":"ô","{":"ä","|":"ö","}":"ü","~":"û"};var zb=4294967295,Hb=class{constructor(t,e,i){this._hasScrollback=t,this._optionsService=e,this._bufferService=i,this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.tabs={},this.savedY=0,this.savedX=0,this.savedCurAttrData=_i.clone(),this.savedCharset=To,this.markers=[],this._nullCell=kr.fromCharData([0,Xw,1,0]),this._whitespaceCell=kr.fromCharData([0,$a,1,32]),this._isClearing=!1,this._memoryCleanupQueue=new Xd,this._memoryCleanupPosition=0,this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new Pb(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}getNullCell(t){return t?(this._nullCell.fg=t.fg,this._nullCell.bg=t.bg,this._nullCell.extended=t.extended):(this._nullCell.fg=0,this._nullCell.bg=0,this._nullCell.extended=new qd),this._nullCell}getWhitespaceCell(t){return t?(this._whitespaceCell.fg=t.fg,this._whitespaceCell.bg=t.bg,this._whitespaceCell.extended=t.extended):(this._whitespaceCell.fg=0,this._whitespaceCell.bg=0,this._whitespaceCell.extended=new qd),this._whitespaceCell}getBlankLine(t,e){return new gu(this._bufferService.cols,this.getNullCell(t),e)}get hasScrollback(){return this._hasScrollback&&this.lines.maxLength>this._rows}get isCursorInViewport(){let t=this.ybase+this.y-this.ydisp;return t>=0&&t<this._rows}_getCorrectBufferLength(t){if(!this._hasScrollback)return t;let e=t+this._optionsService.rawOptions.scrollback;return e>zb?zb:e}fillViewportRows(t){if(this.lines.length===0){t===void 0&&(t=_i);let e=this._rows;for(;e--;)this.lines.push(this.getBlankLine(t))}}clear(){this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.lines=new Pb(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(t,e){let i=this.getNullCell(_i),n=0,a=this._getCorrectBufferLength(e);if(a>this.lines.maxLength&&(this.lines.maxLength=a),this.lines.length>0){if(this._cols<t)for(let u=0;u<this.lines.length;u++)n+=+this.lines.get(u).resize(t,i);let l=0;if(this._rows<e)for(let u=this._rows;u<e;u++)this.lines.length<e+this.ybase&&(this._optionsService.rawOptions.windowsMode||this._optionsService.rawOptions.windowsPty.backend!==void 0||this._optionsService.rawOptions.windowsPty.buildNumber!==void 0?this.lines.push(new gu(t,i)):this.ybase>0&&this.lines.length<=this.ybase+this.y+l+1?(this.ybase--,l++,this.ydisp>0&&this.ydisp--):this.lines.push(new gu(t,i)));else for(let u=this._rows;u>e;u--)this.lines.length>e+this.ybase&&(this.lines.length>this.ybase+this.y+1?this.lines.pop():(this.ybase++,this.ydisp++));if(a<this.lines.maxLength){let u=this.lines.length-a;u>0&&(this.lines.trimStart(u),this.ybase=Math.max(this.ybase-u,0),this.ydisp=Math.max(this.ydisp-u,0),this.savedY=Math.max(this.savedY-u,0)),this.lines.maxLength=a}this.x=Math.min(this.x,t-1),this.y=Math.min(this.y,e-1),l&&(this.y+=l),this.savedX=Math.min(this.savedX,t-1),this.scrollTop=0}if(this.scrollBottom=e-1,this._isReflowEnabled&&(this._reflow(t,e),this._cols>t))for(let l=0;l<this.lines.length;l++)n+=+this.lines.get(l).resize(t,i);this._cols=t,this._rows=e,this._memoryCleanupQueue.clear(),n>.1*this.lines.length&&(this._memoryCleanupPosition=0,this._memoryCleanupQueue.enqueue(()=>this._batchedMemoryCleanup()))}_batchedMemoryCleanup(){let t=!0;this._memoryCleanupPosition>=this.lines.length&&(this._memoryCleanupPosition=0,t=!1);let e=0;for(;this._memoryCleanupPosition<this.lines.length;)if(e+=this.lines.get(this._memoryCleanupPosition++).cleanupMemory(),e>100)return!0;return t}get _isReflowEnabled(){let t=this._optionsService.rawOptions.windowsPty;return t&&t.buildNumber?this._hasScrollback&&t.backend==="conpty"&&t.buildNumber>=21376:this._hasScrollback&&!this._optionsService.rawOptions.windowsMode}_reflow(t,e){this._cols!==t&&(t>this._cols?this._reflowLarger(t,e):this._reflowSmaller(t,e))}_reflowLarger(t,e){let i=this._optionsService.rawOptions.reflowCursorLine,n=_A(this.lines,this._cols,t,this.ybase+this.y,this.getNullCell(_i),i);if(n.length>0){let a=pA(this.lines,n);gA(this.lines,a.layout),this._reflowLargerAdjustViewport(t,e,a.countRemoved)}}_reflowLargerAdjustViewport(t,e,i){let n=this.getNullCell(_i),a=i;for(;a-- >0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length<e&&this.lines.push(new gu(t,n))):(this.ydisp===this.ybase&&this.ydisp--,this.ybase--);this.savedY=Math.max(this.savedY-i,0)}_reflowSmaller(t,e){let i=this._optionsService.rawOptions.reflowCursorLine,n=this.getNullCell(_i),a=[],l=0;for(let u=this.lines.length-1;u>=0;u--){let h=this.lines.get(u);if(!h||!h.isWrapped&&h.getTrimmedLength()<=t)continue;let f=[h];for(;h.isWrapped&&u>0;)h=this.lines.get(--u),f.unshift(h);if(!i){let N=this.ybase+this.y;if(N>=u&&N<u+f.length)continue}let d=f[f.length-1].getTrimmedLength(),g=vA(f,this._cols,t),v=g.length-f.length,p;this.ybase===0&&this.y!==this.lines.length-1?p=Math.max(0,this.y-this.lines.maxLength+v):p=Math.max(0,this.lines.length-this.lines.maxLength+v);let S=[];for(let N=0;N<v;N++){let T=this.getBlankLine(_i,!0);S.push(T)}S.length>0&&(a.push({start:u+f.length+l,newLines:S}),l+=S.length),f.push(...S);let y=g.length-1,C=g[y];C===0&&(y--,C=g[y]);let x=f.length-v-1,R=d;for(;x>=0;){let N=Math.min(R,C);if(f[y]===void 0)break;if(f[y].copyCellsFrom(f[x],R-N,C-N,N,!0),C-=N,C===0&&(y--,C=g[y]),R-=N,R===0){x--;let T=Math.max(x,0);R=Au(f,T,this._cols)}}for(let N=0;N<f.length;N++)g[N]<t&&f[N].setCell(g[N],n);let L=v-p;for(;L-- >0;)this.ybase===0?this.y<e-1?(this.y++,this.lines.pop()):(this.ybase++,this.ydisp++):this.ybase<Math.min(this.lines.maxLength,this.lines.length+l)-e&&(this.ybase===this.ydisp&&this.ydisp++,this.ybase++);this.savedY=Math.min(this.savedY+v,this.ybase+e-1)}if(a.length>0){let u=[],h=[];for(let C=0;C<this.lines.length;C++)h.push(this.lines.get(C));let f=this.lines.length,d=f-1,g=0,v=a[g];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+l);let p=0;for(let C=Math.min(this.lines.maxLength-1,f+l-1);C>=0;C--)if(v&&v.start>d+p){for(let x=v.newLines.length-1;x>=0;x--)this.lines.set(C--,v.newLines[x]);C++,u.push({index:d+1,amount:v.newLines.length}),p+=v.newLines.length,v=a[++g]}else this.lines.set(C,h[d--]);let S=0;for(let C=u.length-1;C>=0;C--)u[C].index+=S,this.lines.onInsertEmitter.fire(u[C]),S+=u[C].amount;let y=Math.max(0,f+l-this.lines.maxLength);y>0&&this.lines.onTrimEmitter.fire(y)}}translateBufferLineToString(t,e,i=0,n){let a=this.lines.get(t);return a?a.translateToString(e,i,n):""}getWrappedRangeForLine(t){let e=t,i=t;for(;e>0&&this.lines.get(e).isWrapped;)e--;for(;i+1<this.lines.length&&this.lines.get(i+1).isWrapped;)i++;return{first:e,last:i}}setupTabStops(t){for(t!=null?this.tabs[t]||(t=this.prevStop(t)):(this.tabs={},t=0);t<this._cols;t+=this._optionsService.rawOptions.tabStopWidth)this.tabs[t]=!0}prevStop(t){for(t==null&&(t=this.x);!this.tabs[--t]&&t>0;);return t>=this._cols?this._cols-1:t<0?0:t}nextStop(t){for(t==null&&(t=this.x);!this.tabs[++t]&&t<this._cols;);return t>=this._cols?this._cols-1:t<0?0:t}clearMarkers(t){this._isClearing=!0;for(let e=0;e<this.markers.length;e++)this.markers[e].line===t&&(this.markers[e].dispose(),this.markers.splice(e--,1));this._isClearing=!1}clearAllMarkers(){this._isClearing=!0;for(let t=0;t<this.markers.length;t++)this.markers[t].dispose();this.markers.length=0,this._isClearing=!1}addMarker(t){let e=new SA(t);return this.markers.push(e),e.register(this.lines.onTrim(i=>{e.line-=i,e.line<0&&e.dispose()})),e.register(this.lines.onInsert(i=>{e.line>=i.index&&(e.line+=i.amount)})),e.register(this.lines.onDelete(i=>{e.line>=i.index&&e.line<i.index+i.amount&&e.dispose(),e.line>i.index&&(e.line-=i.amount)})),e.register(e.onDispose(()=>this._removeMarker(e))),e}_removeMarker(t){this._isClearing||this.markers.splice(this.markers.indexOf(t),1)}},yA=class extends nt{constructor(e,i){super(),this._optionsService=e,this._bufferService=i,this._onBufferActivate=this._register(new ve),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 Hb(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new Hb(!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)}},BC=2,NC=1,lg=class extends nt{constructor(e){super(),this.isUserScrolling=!1,this._onResize=this._register(new ve),this.onResize=this._onResize.event,this._onScroll=this._register(new ve),this.onScroll=this._onScroll.event,this.cols=Math.max(e.rawOptions.cols||0,BC),this.rows=Math.max(e.rawOptions.rows||0,NC),this.buffers=this._register(new yA(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,a=this.rows!==i;this.cols=e,this.rows=i,this.buffers.resize(e,i),this._onResize.fire({cols:e,rows:i,colsChanged:n,rowsChanged:a})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(e,i=!1){let n=this.buffer,a;a=this._cachedBlankLine,(!a||a.length!==this.cols||a.getFg(0)!==e.fg||a.getBg(0)!==e.bg)&&(a=n.getBlankLine(e,i),this._cachedBlankLine=a),a.isWrapped=i;let l=n.ybase+n.scrollTop,u=n.ybase+n.scrollBottom;if(n.scrollTop===0){let h=n.lines.isFull;u===n.lines.length-1?h?n.lines.recycle().copyFrom(a):n.lines.push(a.clone()):n.lines.splice(u+1,0,a.clone()),h?this.isUserScrolling&&(n.ydisp=Math.max(n.ydisp-1,0)):(n.ybase++,this.isUserScrolling||n.ydisp++)}else{let h=u-l+1;n.lines.shiftElements(l+1,h-1,-1),n.lines.set(u,a.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 a=n.ydisp;n.ydisp=Math.max(Math.min(n.ydisp+e,n.ybase),0),a!==n.ydisp&&(i||this._onScroll.fire(n.ydisp))}};lg=si([xe(0,ms)],lg);var Dl={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:Kd,windowOptions:{},windowsMode:!1,windowsPty:{},wordSeparator:" ()[]{}',\"`",altClickMovesCursor:!0,convertEol:!1,termName:"xterm",cancelEvents:!1,overviewRuler:{}},bA=["normal","bold","100","200","300","400","500","600","700","800","900"],wA=class extends nt{constructor(e){super(),this._onOptionChange=this._register(new ve),this.onOptionChange=this._onOptionChange.event;let i={...Dl};for(let n in e)if(n in i)try{let a=e[n];i[n]=this._sanitizeAndValidateOption(n,a)}catch(a){console.error(a)}this.rawOptions=i,this.options={...i},this._setupOptions(),this._register(jt(()=>{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 Dl))throw new Error(`No option with key "${n}"`);return this.rawOptions[n]},i=(n,a)=>{if(!(n in Dl))throw new Error(`No option with key "${n}"`);a=this._sanitizeAndValidateOption(n,a),this.rawOptions[n]!==a&&(this.rawOptions[n]=a,this._onOptionChange.fire(n))};for(let n in this.rawOptions){let a={get:e.bind(this,n),set:i.bind(this,n)};Object.defineProperty(this.options,n,a)}}_sanitizeAndValidateOption(e,i){switch(e){case"cursorStyle":if(i||(i=Dl[e]),!CA(i))throw new Error(`"${i}" is not a valid value for ${e}`);break;case"wordSeparator":i||(i=Dl[e]);break;case"fontWeight":case"fontWeightBold":if(typeof i=="number"&&1<=i&&i<=1e3)break;i=bA.includes(i)?i:Dl[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 CA(t){return t==="block"||t==="underline"||t==="bar"}function vu(t,e=5){if(typeof t!="object")return t;let i=Array.isArray(t)?[]:{};for(let n in t)i[n]=e<=1?t[n]:t[n]&&vu(t[n],e-1);return i}var Ib=Object.freeze({insertMode:!1}),Ub=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,cursorBlink:void 0,cursorStyle:void 0,origin:!1,reverseWraparound:!1,sendFocus:!1,synchronizedOutput:!1,wraparound:!0}),cg=class extends nt{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 ve),this.onData=this._onData.event,this._onUserInput=this._register(new ve),this.onUserInput=this._onUserInput.event,this._onBinary=this._register(new ve),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this._register(new ve),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=vu(Ib),this.decPrivateModes=vu(Ub)}reset(){this.modes=vu(Ib),this.decPrivateModes=vu(Ub)}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(a=>a.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))}};cg=si([xe(0,fs),xe(1,tC),xe(2,ms)],cg);var Fb={NONE:{events:0,restrict:()=>!1},X10:{events:1,restrict:t=>t.button===4||t.action!==1?!1:(t.ctrl=!1,t.alt=!1,t.shift=!1,!0)},VT200:{events:19,restrict:t=>t.action!==32},DRAG:{events:23,restrict:t=>!(t.action===32&&t.button===3)},ANY:{events:31,restrict:t=>!0}};function J_(t,e){let i=(t.ctrl?16:0)|(t.shift?4:0)|(t.alt?8:0);return t.button===4?(i|=64,i|=t.action):(i|=t.button&3,t.button&4&&(i|=64),t.button&8&&(i|=128),t.action===32?i|=32:t.action===0&&!e&&(i|=3)),i}var ep=String.fromCharCode,$b={DEFAULT:t=>{let e=[J_(t,!1)+32,t.col+32,t.row+32];return e[0]>255||e[1]>255||e[2]>255?"":`\x1B[M${ep(e[0])}${ep(e[1])}${ep(e[2])}`},SGR:t=>{let e=t.action===0&&t.button!==4?"m":"M";return`\x1B[<${J_(t,!0)};${t.col};${t.row}${e}`},SGR_PIXELS:t=>{let e=t.action===0&&t.button!==4?"m":"M";return`\x1B[<${J_(t,!0)};${t.x};${t.y}${e}`}},ug=class extends nt{constructor(t,e,i){super(),this._bufferService=t,this._coreService=e,this._optionsService=i,this._protocols={},this._encodings={},this._activeProtocol="",this._activeEncoding="",this._lastEvent=null,this._wheelPartialScroll=0,this._onProtocolChange=this._register(new ve),this.onProtocolChange=this._onProtocolChange.event;for(let n of Object.keys(Fb))this.addProtocol(n,Fb[n]);for(let n of Object.keys($b))this.addEncoding(n,$b[n]);this.reset()}addProtocol(t,e){this._protocols[t]=e}addEncoding(t,e){this._encodings[t]=e}get activeProtocol(){return this._activeProtocol}get areMouseEventsActive(){return this._protocols[this._activeProtocol].events!==0}set activeProtocol(t){if(!this._protocols[t])throw new Error(`unknown protocol "${t}"`);this._activeProtocol=t,this._onProtocolChange.fire(this._protocols[t].events)}get activeEncoding(){return this._activeEncoding}set activeEncoding(t){if(!this._encodings[t])throw new Error(`unknown encoding "${t}"`);this._activeEncoding=t}reset(){this.activeProtocol="NONE",this.activeEncoding="DEFAULT",this._lastEvent=null,this._wheelPartialScroll=0}consumeWheelEvent(t,e,i){if(t.deltaY===0||t.shiftKey||e===void 0||i===void 0)return 0;let n=e/i,a=this._applyScrollModifier(t.deltaY,t);return t.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(a/=n+0,Math.abs(t.deltaY)<50&&(a*=.3),this._wheelPartialScroll+=a,a=Math.floor(Math.abs(this._wheelPartialScroll))*(this._wheelPartialScroll>0?1:-1),this._wheelPartialScroll%=1):t.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(a*=this._bufferService.rows),a}_applyScrollModifier(t,e){return e.altKey||e.ctrlKey||e.shiftKey?t*this._optionsService.rawOptions.fastScrollSensitivity*this._optionsService.rawOptions.scrollSensitivity:t*this._optionsService.rawOptions.scrollSensitivity}triggerMouseEvent(t){if(t.col<0||t.col>=this._bufferService.cols||t.row<0||t.row>=this._bufferService.rows||t.button===4&&t.action===32||t.button===3&&t.action!==32||t.button!==4&&(t.action===2||t.action===3)||(t.col++,t.row++,t.action===32&&this._lastEvent&&this._equalEvents(this._lastEvent,t,this._activeEncoding==="SGR_PIXELS"))||!this._protocols[this._activeProtocol].restrict(t))return!1;let e=this._encodings[this._activeEncoding](t);return e&&(this._activeEncoding==="DEFAULT"?this._coreService.triggerBinaryEvent(e):this._coreService.triggerDataEvent(e,!0)),this._lastEvent=t,!0}explainEvents(t){return{down:!!(t&1),up:!!(t&2),drag:!!(t&4),move:!!(t&8),wheel:!!(t&16)}}_equalEvents(t,e,i){if(i){if(t.x!==e.x||t.y!==e.y)return!1}else if(t.col!==e.col||t.row!==e.row)return!1;return!(t.button!==e.button||t.action!==e.action||t.ctrl!==e.ctrl||t.alt!==e.alt||t.shift!==e.shift)}};ug=si([xe(0,fs),xe(1,Wo),xe(2,ms)],ug);var tp=[[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]],xA=[[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]],xi;function kA(t,e){let i=0,n=e.length-1,a;if(t<e[0][0]||t>e[n][1])return!1;for(;n>=i;)if(a=i+n>>1,t>e[a][1])i=a+1;else if(t<e[a][0])n=a-1;else return!0;return!1}var EA=class{constructor(){if(this.version="6",!xi){xi=new Uint8Array(65536),xi.fill(1),xi[0]=0,xi.fill(0,1,32),xi.fill(0,127,160),xi.fill(2,4352,4448),xi[9001]=2,xi[9002]=2,xi.fill(2,11904,42192),xi[12351]=1,xi.fill(2,44032,55204),xi.fill(2,63744,64256),xi.fill(2,65040,65050),xi.fill(2,65072,65136),xi.fill(2,65280,65377),xi.fill(2,65504,65511);for(let e=0;e<tp.length;++e)xi.fill(0,tp[e][0],tp[e][1]+1)}}wcwidth(e){return e<32?0:e<127?1:e<65536?xi[e]:kA(e,xA)?0:e>=131072&&e<=196605||e>=196608&&e<=262141?2:1}charProperties(e,i){let n=this.wcwidth(e),a=n===0&&i!==0;if(a){let l=Mo.extractWidth(i);l===0?a=!1:l>n&&(n=l)}return Mo.createPropertyValue(0,n,a)}},Mo=class Ed{constructor(){this._providers=Object.create(null),this._active="",this._onChange=new ve,this.onChange=this._onChange.event;let e=new EA;this.register(e),this._active=e.version,this._activeProvider=e}static extractShouldJoin(e){return(e&1)!==0}static extractWidth(e){return e>>1&3}static extractCharKind(e){return e>>3}static createPropertyValue(e,i,n=!1){return(e&16777215)<<3|(i&3)<<1|(n?1:0)}dispose(){this._onChange.dispose()}get versions(){return Object.keys(this._providers)}get activeVersion(){return this._active}set activeVersion(e){if(!this._providers[e])throw new Error(`unknown Unicode version "${e}"`);this._active=e,this._activeProvider=this._providers[e],this._onChange.fire(e)}register(e){this._providers[e.version]=e}wcwidth(e){return this._activeProvider.wcwidth(e)}getStringCellWidth(e){let i=0,n=0,a=e.length;for(let l=0;l<a;++l){let u=e.charCodeAt(l);if(55296<=u&&u<=56319){if(++l>=a)return i+this.wcwidth(u);let d=e.charCodeAt(l);56320<=d&&d<=57343?u=(u-55296)*1024+d-56320+65536:i+=this.wcwidth(d)}let h=this.charProperties(u,n),f=Ed.extractWidth(h);Ed.extractShouldJoin(h)&&(f-=Ed.extractWidth(n)),i+=f,n=h}return i}charProperties(e,i){return this._activeProvider.charProperties(e,i)}},TA=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 Wb(t){let e=t.buffer.lines.get(t.buffer.ybase+t.buffer.y-1)?.get(t.cols-1),i=t.buffer.lines.get(t.buffer.ybase+t.buffer.y);i&&e&&(i.isWrapped=e[3]!==0&&e[3]!==32)}var nu=2147483647,RA=256,PC=class hg{constructor(e=32,i=32){if(this.maxLength=e,this.maxSubParamsLength=i,i>RA)throw new Error("maxSubParamsLength must not be greater than 256");this.params=new Int32Array(e),this.length=0,this._subParams=new Int32Array(i),this._subParamsLength=0,this._subParamsIdx=new Uint16Array(e),this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}static fromArray(e){let i=new hg;if(!e.length)return i;for(let n=Array.isArray(e[0])?1:0;n<e.length;++n){let a=e[n];if(Array.isArray(a))for(let l=0;l<a.length;++l)i.addSubParam(a[l]);else i.addParam(a)}return i}clone(){let e=new hg(this.maxLength,this.maxSubParamsLength);return e.params.set(this.params),e.length=this.length,e._subParams.set(this._subParams),e._subParamsLength=this._subParamsLength,e._subParamsIdx.set(this._subParamsIdx),e._rejectDigits=this._rejectDigits,e._rejectSubDigits=this._rejectSubDigits,e._digitIsSub=this._digitIsSub,e}toArray(){let e=[];for(let i=0;i<this.length;++i){e.push(this.params[i]);let n=this._subParamsIdx[i]>>8,a=this._subParamsIdx[i]&255;a-n>0&&e.push(Array.prototype.slice.call(this._subParams,n,a))}return e}reset(){this.length=0,this._subParamsLength=0,this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}addParam(e){if(this._digitIsSub=!1,this.length>=this.maxLength){this._rejectDigits=!0;return}if(e<-1)throw new Error("values lesser than -1 are not allowed");this._subParamsIdx[this.length]=this._subParamsLength<<8|this._subParamsLength,this.params[this.length++]=e>nu?nu:e}addSubParam(e){if(this._digitIsSub=!0,!!this.length){if(this._rejectDigits||this._subParamsLength>=this.maxSubParamsLength){this._rejectSubDigits=!0;return}if(e<-1)throw new Error("values lesser than -1 are not allowed");this._subParams[this._subParamsLength++]=e>nu?nu:e,this._subParamsIdx[this.length-1]++}}hasSubParams(e){return(this._subParamsIdx[e]&255)-(this._subParamsIdx[e]>>8)>0}getSubParams(e){let i=this._subParamsIdx[e]>>8,n=this._subParamsIdx[e]&255;return n-i>0?this._subParams.subarray(i,n):null}getSubParamsAll(){let e={};for(let i=0;i<this.length;++i){let n=this._subParamsIdx[i]>>8,a=this._subParamsIdx[i]&255;a-n>0&&(e[i]=this._subParams.slice(n,a))}return e}addDigit(e){let i;if(this._rejectDigits||!(i=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;let n=this._digitIsSub?this._subParams:this.params,a=n[i-1];n[i-1]=~a?Math.min(a*10+e,nu):e}},au=[],MA=class{constructor(){this._state=0,this._active=au,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 a=n.indexOf(i);a!==-1&&n.splice(a,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=au}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=au,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||au,!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",cf(e,i,n));else for(let a=this._active.length-1;a>=0;a--)this._active[a].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 a=e[i++];if(a===59){this._state=2,this._start();break}if(a<48||57<a){this._state=3;return}this._id===-1&&(this._id=0),this._id=this._id*10+a-48}this._state===2&&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,a=this._active.length-1,l=!1;if(this._stack.paused&&(a=this._stack.loopPosition-1,n=i,l=this._stack.fallThrough,this._stack.paused=!1),!l&&n===!1){for(;a>=0&&(n=this._active[a].end(e),n!==!0);a--)if(n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=a,this._stack.fallThrough=!1,n;a--}for(;a>=0;a--)if(n=this._active[a].end(!1),n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=a,this._stack.fallThrough=!0,n}this._active=au,this._id=-1,this._state=0}}},Ws=class{constructor(e){this._handler=e,this._data="",this._hitLimit=!1}start(){this._data="",this._hitLimit=!1}put(e,i,n){this._hitLimit||(this._data+=cf(e,i,n),this._data.length>1e7&&(this._data="",this._hitLimit=!0))}end(e){let i=!1;if(this._hitLimit)i=!1;else if(e&&(i=this._handler(this._data),i instanceof Promise))return i.then(n=>(this._data="",this._hitLimit=!1,n));return this._data="",this._hitLimit=!1,i}},ou=[],AA=class{constructor(){this._handlers=Object.create(null),this._active=ou,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=ou}registerHandler(e,i){this._handlers[e]===void 0&&(this._handlers[e]=[]);let n=this._handlers[e];return n.push(i),{dispose:()=>{let a=n.indexOf(i);a!==-1&&n.splice(a,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=ou,this._ident=0}hook(e,i){if(this.reset(),this._ident=e,this._active=this._handlers[e]||ou,!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",cf(e,i,n));else for(let a=this._active.length-1;a>=0;a--)this._active[a].put(e,i,n)}unhook(e,i=!0){if(!this._active.length)this._handlerFb(this._ident,"UNHOOK",e);else{let n=!1,a=this._active.length-1,l=!1;if(this._stack.paused&&(a=this._stack.loopPosition-1,n=i,l=this._stack.fallThrough,this._stack.paused=!1),!l&&n===!1){for(;a>=0&&(n=this._active[a].unhook(e),n!==!0);a--)if(n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=a,this._stack.fallThrough=!1,n;a--}for(;a>=0;a--)if(n=this._active[a].unhook(!1),n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=a,this._stack.fallThrough=!0,n}this._active=ou,this._ident=0}},Su=new PC;Su.addParam(0);var jb=class{constructor(t){this._handler=t,this._data="",this._params=Su,this._hitLimit=!1}hook(t){this._params=t.length>1||t.params[0]?t.clone():Su,this._data="",this._hitLimit=!1}put(t,e,i){this._hitLimit||(this._data+=cf(t,e,i),this._data.length>1e7&&(this._data="",this._hitLimit=!0))}unhook(t){let e=!1;if(this._hitLimit)e=!1;else if(t&&(e=this._handler(this._data,this._params),e instanceof Promise))return e.then(i=>(this._params=Su,this._data="",this._hitLimit=!1,i));return this._params=Su,this._data="",this._hitLimit=!1,e}},LA=class{constructor(e){this.table=new Uint8Array(e)}setDefault(e,i){this.table.fill(e<<4|i)}add(e,i,n,a){this.table[i<<8|e]=n<<4|a}addMany(e,i,n,a){for(let l=0;l<e.length;l++)this.table[i<<8|e[l]]=n<<4|a}},wr=160,DA=(function(){let t=new LA(4095),e=Array.apply(null,Array(256)).map((h,f)=>f),i=(h,f)=>e.slice(h,f),n=i(32,127),a=i(0,24);a.push(25),a.push.apply(a,i(28,32));let l=i(0,14),u;t.setDefault(1,0),t.addMany(n,0,2,0);for(u in l)t.addMany([24,26,153,154],u,3,0),t.addMany(i(128,144),u,3,0),t.addMany(i(144,152),u,3,0),t.add(156,u,0,0),t.add(27,u,11,1),t.add(157,u,4,8),t.addMany([152,158,159],u,0,7),t.add(155,u,11,3),t.add(144,u,11,9);return t.addMany(a,0,3,0),t.addMany(a,1,3,1),t.add(127,1,0,1),t.addMany(a,8,0,8),t.addMany(a,3,3,3),t.add(127,3,0,3),t.addMany(a,4,3,4),t.add(127,4,0,4),t.addMany(a,6,3,6),t.addMany(a,5,3,5),t.add(127,5,0,5),t.addMany(a,2,3,2),t.add(127,2,0,2),t.add(93,1,4,8),t.addMany(n,8,5,8),t.add(127,8,5,8),t.addMany([156,27,24,26,7],8,6,0),t.addMany(i(28,32),8,0,8),t.addMany([88,94,95],1,0,7),t.addMany(n,7,0,7),t.addMany(a,7,0,7),t.add(156,7,0,0),t.add(127,7,0,7),t.add(91,1,11,3),t.addMany(i(64,127),3,7,0),t.addMany(i(48,60),3,8,4),t.addMany([60,61,62,63],3,9,4),t.addMany(i(48,60),4,8,4),t.addMany(i(64,127),4,7,0),t.addMany([60,61,62,63],4,0,6),t.addMany(i(32,64),6,0,6),t.add(127,6,0,6),t.addMany(i(64,127),6,0,0),t.addMany(i(32,48),3,9,5),t.addMany(i(32,48),5,9,5),t.addMany(i(48,64),5,0,6),t.addMany(i(64,127),5,7,0),t.addMany(i(32,48),4,9,5),t.addMany(i(32,48),1,9,2),t.addMany(i(32,48),2,9,2),t.addMany(i(48,127),2,10,0),t.addMany(i(48,80),1,10,0),t.addMany(i(81,88),1,10,0),t.addMany([89,90,92],1,10,0),t.addMany(i(96,127),1,10,0),t.add(80,1,11,9),t.addMany(a,9,0,9),t.add(127,9,0,9),t.addMany(i(28,32),9,0,9),t.addMany(i(32,48),9,9,12),t.addMany(i(48,60),9,8,10),t.addMany([60,61,62,63],9,9,10),t.addMany(a,11,0,11),t.addMany(i(32,128),11,0,11),t.addMany(i(28,32),11,0,11),t.addMany(a,10,0,10),t.add(127,10,0,10),t.addMany(i(28,32),10,0,10),t.addMany(i(48,60),10,8,10),t.addMany([60,61,62,63],10,0,11),t.addMany(i(32,48),10,9,12),t.addMany(a,12,0,12),t.add(127,12,0,12),t.addMany(i(28,32),12,0,12),t.addMany(i(32,48),12,9,12),t.addMany(i(48,64),12,0,11),t.addMany(i(64,127),12,12,13),t.addMany(i(64,127),10,12,13),t.addMany(i(64,127),9,12,13),t.addMany(a,13,13,13),t.addMany(n,13,13,13),t.add(127,13,0,13),t.addMany([27,156,24,26],13,14,0),t.add(wr,0,2,0),t.add(wr,8,5,8),t.add(wr,6,0,6),t.add(wr,11,0,11),t.add(wr,13,13,13),t})(),OA=class extends nt{constructor(e=DA){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 PC,this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._printHandlerFb=(i,n,a)=>{},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(jt(()=>{this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null)})),this._oscParser=this._register(new MA),this._dcsParser=this._register(new AA),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 l=0;l<e.intermediates.length;++l){let u=e.intermediates.charCodeAt(l);if(32>u||u>47)throw new Error("intermediate must be in range 0x20 .. 0x2f");n<<=8,n|=u}}if(e.final.length!==1)throw new Error("final must be a single byte");let a=e.final.charCodeAt(0);if(i[0]>a||a>i[1])throw new Error(`final must be in range ${i[0]} .. ${i[1]}`);return n<<=8,n|=a,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 a=this._escHandlers[n];return a.push(i),{dispose:()=>{let l=a.indexOf(i);l!==-1&&a.splice(l,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 a=this._csiHandlers[n];return a.push(i),{dispose:()=>{let l=a.indexOf(i);l!==-1&&a.splice(l,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,a,l){this._parseStack.state=e,this._parseStack.handlers=i,this._parseStack.handlerPos=n,this._parseStack.transition=a,this._parseStack.chunkPos=l}parse(e,i,n){let a=0,l=0,u=0,h;if(this._parseStack.state)if(this._parseStack.state===2)this._parseStack.state=0,u=this._parseStack.chunkPos+1;else{if(n===void 0||this._parseStack.state===1)throw this._parseStack.state=1,new Error("improper continuation due to previous async handler, giving up parsing");let f=this._parseStack.handlers,d=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(n===!1&&d>-1){for(;d>=0&&(h=f[d](this._params),h!==!0);d--)if(h instanceof Promise)return this._parseStack.handlerPos=d,h}this._parseStack.handlers=[];break;case 4:if(n===!1&&d>-1){for(;d>=0&&(h=f[d](),h!==!0);d--)if(h instanceof Promise)return this._parseStack.handlerPos=d,h}this._parseStack.handlers=[];break;case 6:if(a=e[this._parseStack.chunkPos],h=this._dcsParser.unhook(a!==24&&a!==26,n),h)return h;a===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break;case 5:if(a=e[this._parseStack.chunkPos],h=this._oscParser.end(a!==24&&a!==26,n),h)return h;a===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break}this._parseStack.state=0,u=this._parseStack.chunkPos+1,this.precedingJoinState=0,this.currentState=this._parseStack.transition&15}for(let f=u;f<i;++f){switch(a=e[f],l=this._transitions.table[this.currentState<<8|(a<160?a:wr)],l>>4){case 2:for(let S=f+1;;++S){if(S>=i||(a=e[S])<32||a>126&&a<wr){this._printHandler(e,f,S),f=S-1;break}if(++S>=i||(a=e[S])<32||a>126&&a<wr){this._printHandler(e,f,S),f=S-1;break}if(++S>=i||(a=e[S])<32||a>126&&a<wr){this._printHandler(e,f,S),f=S-1;break}if(++S>=i||(a=e[S])<32||a>126&&a<wr){this._printHandler(e,f,S),f=S-1;break}}break;case 3:this._executeHandlers[a]?this._executeHandlers[a]():this._executeHandlerFb(a),this.precedingJoinState=0;break;case 0:break;case 1:if(this._errorHandler({position:f,code:a,currentState:this.currentState,collect:this._collect,params:this._params,abort:!1}).abort)return;break;case 7:let d=this._csiHandlers[this._collect<<8|a],g=d?d.length-1:-1;for(;g>=0&&(h=d[g](this._params),h!==!0);g--)if(h instanceof Promise)return this._preserveStack(3,d,g,l,f),h;g<0&&this._csiHandlerFb(this._collect<<8|a,this._params),this.precedingJoinState=0;break;case 8:do switch(a){case 59:this._params.addParam(0);break;case 58:this._params.addSubParam(-1);break;default:this._params.addDigit(a-48)}while(++f<i&&(a=e[f])>47&&a<60);f--;break;case 9:this._collect<<=8,this._collect|=a;break;case 10:let v=this._escHandlers[this._collect<<8|a],p=v?v.length-1:-1;for(;p>=0&&(h=v[p](),h!==!0);p--)if(h instanceof Promise)return this._preserveStack(4,v,p,l,f),h;p<0&&this._escHandlerFb(this._collect<<8|a),this.precedingJoinState=0;break;case 11:this._params.reset(),this._params.addParam(0),this._collect=0;break;case 12:this._dcsParser.hook(this._collect<<8|a,this._params);break;case 13:for(let S=f+1;;++S)if(S>=i||(a=e[S])===24||a===26||a===27||a>127&&a<wr){this._dcsParser.put(e,f,S),f=S-1;break}break;case 14:if(h=this._dcsParser.unhook(a!==24&&a!==26),h)return this._preserveStack(6,[],0,l,f),h;a===27&&(l|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0;break;case 4:this._oscParser.start();break;case 5:for(let S=f+1;;S++)if(S>=i||(a=e[S])<32||a>127&&a<wr){this._oscParser.put(e,f,S),f=S-1;break}break;case 6:if(h=this._oscParser.end(a!==24&&a!==26),h)return this._preserveStack(5,[],0,l,f),h;a===27&&(l|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0;break}this.currentState=l&15}}},BA=/^([\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})$/,NA=/^[\da-f]+$/;function Vb(t){if(!t)return;let e=t.toLowerCase();if(e.indexOf("rgb:")===0){e=e.slice(4);let i=BA.exec(e);if(i){let n=i[1]?15:i[4]?255:i[7]?4095:65535;return[Math.round(parseInt(i[1]||i[4]||i[7]||i[10],16)/n*255),Math.round(parseInt(i[2]||i[5]||i[8]||i[11],16)/n*255),Math.round(parseInt(i[3]||i[6]||i[9]||i[12],16)/n*255)]}}else if(e.indexOf("#")===0&&(e=e.slice(1),NA.exec(e)&&[3,6,9,12].includes(e.length))){let i=e.length/3,n=[0,0,0];for(let a=0;a<3;++a){let l=parseInt(e.slice(i*a,i*a+i),16);n[a]=i===1?l<<4:i===2?l:i===3?l>>4:l>>8}return n}}function ip(t,e){let i=t.toString(16),n=i.length<2?"0"+i:i;switch(e){case 4:return i[0];case 8:return n;case 12:return(n+n).slice(0,3);default:return n+n}}function PA(t,e=16){let[i,n,a]=t;return`rgb:${ip(i,e)}/${ip(n,e)}/${ip(a,e)}`}var zA={"(":0,")":1,"*":2,"+":3,"-":1,".":2},Oa=131072,qb=10;function Yb(t,e){if(t>24)return e.setWinLines||!1;switch(t){case 1:return!!e.restoreWin;case 2:return!!e.minimizeWin;case 3:return!!e.setWinPosition;case 4:return!!e.setWinSizePixels;case 5:return!!e.raiseWin;case 6:return!!e.lowerWin;case 7:return!!e.refreshWin;case 8:return!!e.setWinSizeChars;case 9:return!!e.maximizeWin;case 10:return!!e.fullscreenWin;case 11:return!!e.getWinState;case 13:return!!e.getWinPosition;case 14:return!!e.getWinSizePixels;case 15:return!!e.getScreenSizePixels;case 16:return!!e.getCellSizePixels;case 18:return!!e.getWinSizeChars;case 19:return!!e.getScreenSizeChars;case 20:return!!e.getIconTitle;case 21:return!!e.getWinTitle;case 22:return!!e.pushTitle;case 23:return!!e.popTitle;case 24:return!!e.setWinLines}return!1}var Gb=5e3,Kb=0,HA=class extends nt{constructor(t,e,i,n,a,l,u,h,f=new OA){super(),this._bufferService=t,this._charsetService=e,this._coreService=i,this._logService=n,this._optionsService=a,this._oscLinkService=l,this._coreMouseService=u,this._unicodeService=h,this._parser=f,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new sR,this._utf8Decoder=new rR,this._windowTitle="",this._iconName="",this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=_i.clone(),this._eraseAttrDataInternal=_i.clone(),this._onRequestBell=this._register(new ve),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this._register(new ve),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this._register(new ve),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this._register(new ve),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this._register(new ve),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this._register(new ve),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this._register(new ve),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this._register(new ve),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this._register(new ve),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this._register(new ve),this.onLineFeed=this._onLineFeed.event,this._onScroll=this._register(new ve),this.onScroll=this._onScroll.event,this._onTitleChange=this._register(new ve),this.onTitleChange=this._onTitleChange.event,this._onColor=this._register(new ve),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 dg(this._bufferService),this._activeBuffer=this._bufferService.buffer,this._register(this._bufferService.buffers.onBufferActivate(d=>this._activeBuffer=d.activeBuffer)),this._parser.setCsiHandlerFallback((d,g)=>{this._logService.debug("Unknown CSI code: ",{identifier:this._parser.identToString(d),params:g.toArray()})}),this._parser.setEscHandlerFallback(d=>{this._logService.debug("Unknown ESC code: ",{identifier:this._parser.identToString(d)})}),this._parser.setExecuteHandlerFallback(d=>{this._logService.debug("Unknown EXECUTE code: ",{code:d})}),this._parser.setOscHandlerFallback((d,g,v)=>{this._logService.debug("Unknown OSC code: ",{identifier:d,action:g,data:v})}),this._parser.setDcsHandlerFallback((d,g,v)=>{g==="HOOK"&&(v=v.toArray()),this._logService.debug("Unknown DCS code: ",{identifier:this._parser.identToString(d),action:g,payload:v})}),this._parser.setPrintHandler((d,g,v)=>this.print(d,g,v)),this._parser.registerCsiHandler({final:"@"},d=>this.insertChars(d)),this._parser.registerCsiHandler({intermediates:" ",final:"@"},d=>this.scrollLeft(d)),this._parser.registerCsiHandler({final:"A"},d=>this.cursorUp(d)),this._parser.registerCsiHandler({intermediates:" ",final:"A"},d=>this.scrollRight(d)),this._parser.registerCsiHandler({final:"B"},d=>this.cursorDown(d)),this._parser.registerCsiHandler({final:"C"},d=>this.cursorForward(d)),this._parser.registerCsiHandler({final:"D"},d=>this.cursorBackward(d)),this._parser.registerCsiHandler({final:"E"},d=>this.cursorNextLine(d)),this._parser.registerCsiHandler({final:"F"},d=>this.cursorPrecedingLine(d)),this._parser.registerCsiHandler({final:"G"},d=>this.cursorCharAbsolute(d)),this._parser.registerCsiHandler({final:"H"},d=>this.cursorPosition(d)),this._parser.registerCsiHandler({final:"I"},d=>this.cursorForwardTab(d)),this._parser.registerCsiHandler({final:"J"},d=>this.eraseInDisplay(d,!1)),this._parser.registerCsiHandler({prefix:"?",final:"J"},d=>this.eraseInDisplay(d,!0)),this._parser.registerCsiHandler({final:"K"},d=>this.eraseInLine(d,!1)),this._parser.registerCsiHandler({prefix:"?",final:"K"},d=>this.eraseInLine(d,!0)),this._parser.registerCsiHandler({final:"L"},d=>this.insertLines(d)),this._parser.registerCsiHandler({final:"M"},d=>this.deleteLines(d)),this._parser.registerCsiHandler({final:"P"},d=>this.deleteChars(d)),this._parser.registerCsiHandler({final:"S"},d=>this.scrollUp(d)),this._parser.registerCsiHandler({final:"T"},d=>this.scrollDown(d)),this._parser.registerCsiHandler({final:"X"},d=>this.eraseChars(d)),this._parser.registerCsiHandler({final:"Z"},d=>this.cursorBackwardTab(d)),this._parser.registerCsiHandler({final:"`"},d=>this.charPosAbsolute(d)),this._parser.registerCsiHandler({final:"a"},d=>this.hPositionRelative(d)),this._parser.registerCsiHandler({final:"b"},d=>this.repeatPrecedingCharacter(d)),this._parser.registerCsiHandler({final:"c"},d=>this.sendDeviceAttributesPrimary(d)),this._parser.registerCsiHandler({prefix:">",final:"c"},d=>this.sendDeviceAttributesSecondary(d)),this._parser.registerCsiHandler({final:"d"},d=>this.linePosAbsolute(d)),this._parser.registerCsiHandler({final:"e"},d=>this.vPositionRelative(d)),this._parser.registerCsiHandler({final:"f"},d=>this.hVPosition(d)),this._parser.registerCsiHandler({final:"g"},d=>this.tabClear(d)),this._parser.registerCsiHandler({final:"h"},d=>this.setMode(d)),this._parser.registerCsiHandler({prefix:"?",final:"h"},d=>this.setModePrivate(d)),this._parser.registerCsiHandler({final:"l"},d=>this.resetMode(d)),this._parser.registerCsiHandler({prefix:"?",final:"l"},d=>this.resetModePrivate(d)),this._parser.registerCsiHandler({final:"m"},d=>this.charAttributes(d)),this._parser.registerCsiHandler({final:"n"},d=>this.deviceStatus(d)),this._parser.registerCsiHandler({prefix:"?",final:"n"},d=>this.deviceStatusPrivate(d)),this._parser.registerCsiHandler({intermediates:"!",final:"p"},d=>this.softReset(d)),this._parser.registerCsiHandler({intermediates:" ",final:"q"},d=>this.setCursorStyle(d)),this._parser.registerCsiHandler({final:"r"},d=>this.setScrollRegion(d)),this._parser.registerCsiHandler({final:"s"},d=>this.saveCursor(d)),this._parser.registerCsiHandler({final:"t"},d=>this.windowOptions(d)),this._parser.registerCsiHandler({final:"u"},d=>this.restoreCursor(d)),this._parser.registerCsiHandler({intermediates:"'",final:"}"},d=>this.insertColumns(d)),this._parser.registerCsiHandler({intermediates:"'",final:"~"},d=>this.deleteColumns(d)),this._parser.registerCsiHandler({intermediates:'"',final:"q"},d=>this.selectProtected(d)),this._parser.registerCsiHandler({intermediates:"$",final:"p"},d=>this.requestMode(d,!0)),this._parser.registerCsiHandler({prefix:"?",intermediates:"$",final:"p"},d=>this.requestMode(d,!1)),this._parser.setExecuteHandler(le.BEL,()=>this.bell()),this._parser.setExecuteHandler(le.LF,()=>this.lineFeed()),this._parser.setExecuteHandler(le.VT,()=>this.lineFeed()),this._parser.setExecuteHandler(le.FF,()=>this.lineFeed()),this._parser.setExecuteHandler(le.CR,()=>this.carriageReturn()),this._parser.setExecuteHandler(le.BS,()=>this.backspace()),this._parser.setExecuteHandler(le.HT,()=>this.tab()),this._parser.setExecuteHandler(le.SO,()=>this.shiftOut()),this._parser.setExecuteHandler(le.SI,()=>this.shiftIn()),this._parser.setExecuteHandler(xd.IND,()=>this.index()),this._parser.setExecuteHandler(xd.NEL,()=>this.nextLine()),this._parser.setExecuteHandler(xd.HTS,()=>this.tabSet()),this._parser.registerOscHandler(0,new Ws(d=>(this.setTitle(d),this.setIconName(d),!0))),this._parser.registerOscHandler(1,new Ws(d=>this.setIconName(d))),this._parser.registerOscHandler(2,new Ws(d=>this.setTitle(d))),this._parser.registerOscHandler(4,new Ws(d=>this.setOrReportIndexedColor(d))),this._parser.registerOscHandler(8,new Ws(d=>this.setHyperlink(d))),this._parser.registerOscHandler(10,new Ws(d=>this.setOrReportFgColor(d))),this._parser.registerOscHandler(11,new Ws(d=>this.setOrReportBgColor(d))),this._parser.registerOscHandler(12,new Ws(d=>this.setOrReportCursorColor(d))),this._parser.registerOscHandler(104,new Ws(d=>this.restoreIndexedColor(d))),this._parser.registerOscHandler(110,new Ws(d=>this.restoreFgColor(d))),this._parser.registerOscHandler(111,new Ws(d=>this.restoreBgColor(d))),this._parser.registerOscHandler(112,new Ws(d=>this.restoreCursorColor(d))),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 d in ki)this._parser.registerEscHandler({intermediates:"(",final:d},()=>this.selectCharset("("+d)),this._parser.registerEscHandler({intermediates:")",final:d},()=>this.selectCharset(")"+d)),this._parser.registerEscHandler({intermediates:"*",final:d},()=>this.selectCharset("*"+d)),this._parser.registerEscHandler({intermediates:"+",final:d},()=>this.selectCharset("+"+d)),this._parser.registerEscHandler({intermediates:"-",final:d},()=>this.selectCharset("-"+d)),this._parser.registerEscHandler({intermediates:".",final:d},()=>this.selectCharset("."+d)),this._parser.registerEscHandler({intermediates:"/",final:d},()=>this.selectCharset("/"+d));this._parser.registerEscHandler({intermediates:"#",final:"8"},()=>this.screenAlignmentPattern()),this._parser.setErrorHandler(d=>(this._logService.error("Parsing error: ",d),d)),this._parser.registerDcsHandler({intermediates:"$",final:"q"},new jb((d,g)=>this.requestStatusString(d,g)))}getAttrData(){return this._curAttrData}_preserveStack(t,e,i,n){this._parseStack.paused=!0,this._parseStack.cursorStartX=t,this._parseStack.cursorStartY=e,this._parseStack.decodedLength=i,this._parseStack.position=n}_logSlowResolvingAsync(t){this._logService.logLevel<=3&&Promise.race([t,new Promise((e,i)=>setTimeout(()=>i("#SLOW_TIMEOUT"),Gb))]).catch(e=>{if(e!=="#SLOW_TIMEOUT")throw e;console.warn(`async parser handler taking longer than ${Gb} ms`)})}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(t,e){let i,n=this._activeBuffer.x,a=this._activeBuffer.y,l=0,u=this._parseStack.paused;if(u){if(i=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,e))return this._logSlowResolvingAsync(i),i;n=this._parseStack.cursorStartX,a=this._parseStack.cursorStartY,this._parseStack.paused=!1,t.length>Oa&&(l=this._parseStack.position+Oa)}if(this._logService.logLevel<=1&&this._logService.debug(`parsing data ${typeof t=="string"?` "${t}"`:` "${Array.prototype.map.call(t,d=>String.fromCharCode(d)).join("")}"`}`),this._logService.logLevel===0&&this._logService.trace("parsing data (codes)",typeof t=="string"?t.split("").map(d=>d.charCodeAt(0)):t),this._parseBuffer.length<t.length&&this._parseBuffer.length<Oa&&(this._parseBuffer=new Uint32Array(Math.min(t.length,Oa))),u||this._dirtyRowTracker.clearRange(),t.length>Oa)for(let d=l;d<t.length;d+=Oa){let g=d+Oa<t.length?d+Oa:t.length,v=typeof t=="string"?this._stringDecoder.decode(t.substring(d,g),this._parseBuffer):this._utf8Decoder.decode(t.subarray(d,g),this._parseBuffer);if(i=this._parser.parse(this._parseBuffer,v))return this._preserveStack(n,a,v,d),this._logSlowResolvingAsync(i),i}else if(!u){let d=typeof t=="string"?this._stringDecoder.decode(t,this._parseBuffer):this._utf8Decoder.decode(t,this._parseBuffer);if(i=this._parser.parse(this._parseBuffer,d))return this._preserveStack(n,a,d,0),this._logSlowResolvingAsync(i),i}(this._activeBuffer.x!==n||this._activeBuffer.y!==a)&&this._onCursorMove.fire();let h=this._dirtyRowTracker.end+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp),f=this._dirtyRowTracker.start+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp);f<this._bufferService.rows&&this._onRequestRefreshRows.fire({start:Math.min(f,this._bufferService.rows-1),end:Math.min(h,this._bufferService.rows-1)})}print(t,e,i){let n,a,l=this._charsetService.charset,u=this._optionsService.rawOptions.screenReaderMode,h=this._bufferService.cols,f=this._coreService.decPrivateModes.wraparound,d=this._coreService.modes.insertMode,g=this._curAttrData,v=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._activeBuffer.x&&i-e>0&&v.getWidth(this._activeBuffer.x-1)===2&&v.setCellFromCodepoint(this._activeBuffer.x-1,0,1,g);let p=this._parser.precedingJoinState;for(let S=e;S<i;++S){if(n=t[S],n<127&&l){let R=l[String.fromCharCode(n)];R&&(n=R.charCodeAt(0))}let y=this._unicodeService.charProperties(n,p);a=Mo.extractWidth(y);let C=Mo.extractShouldJoin(y),x=C?Mo.extractWidth(p):0;if(p=y,u&&this._onA11yChar.fire(Ia(n)),this._getCurrentLinkId()&&this._oscLinkService.addLineToLink(this._getCurrentLinkId(),this._activeBuffer.ybase+this._activeBuffer.y),this._activeBuffer.x+a-x>h){if(f){let R=v,L=this._activeBuffer.x-x;for(this._activeBuffer.x=x,this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData(),!0)):(this._activeBuffer.y>=this._bufferService.rows&&(this._activeBuffer.y=this._bufferService.rows-1),this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!0),v=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y),x>0&&v instanceof gu&&v.copyCellsFrom(R,L,0,x,!1);L<h;)R.setCellFromCodepoint(L++,0,1,g)}else if(this._activeBuffer.x=h-1,a===2)continue}if(C&&this._activeBuffer.x){let R=v.getWidth(this._activeBuffer.x-1)?1:2;v.addCodepointToCell(this._activeBuffer.x-R,n,a);for(let L=a-x;--L>=0;)v.setCellFromCodepoint(this._activeBuffer.x++,0,0,g);continue}if(d&&(v.insertCells(this._activeBuffer.x,a-x,this._activeBuffer.getNullCell(g)),v.getWidth(h-1)===2&&v.setCellFromCodepoint(h-1,0,1,g)),v.setCellFromCodepoint(this._activeBuffer.x++,n,a,g),a>0)for(;--a;)v.setCellFromCodepoint(this._activeBuffer.x++,0,0,g)}this._parser.precedingJoinState=p,this._activeBuffer.x<h&&i-e>0&&v.getWidth(this._activeBuffer.x)===0&&!v.hasContent(this._activeBuffer.x)&&v.setCellFromCodepoint(this._activeBuffer.x,0,1,g),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(t,e){return t.final==="t"&&!t.prefix&&!t.intermediates?this._parser.registerCsiHandler(t,i=>Yb(i.params[0],this._optionsService.rawOptions.windowOptions)?e(i):!0):this._parser.registerCsiHandler(t,e)}registerDcsHandler(t,e){return this._parser.registerDcsHandler(t,new jb(e))}registerEscHandler(t,e){return this._parser.registerEscHandler(t,e)}registerOscHandler(t,e){return this._parser.registerOscHandler(t,new Ws(e))}bell(){return this._onRequestBell.fire(),!0}lineFeed(){return this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._optionsService.rawOptions.convertEol&&(this._activeBuffer.x=0),this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData())):this._activeBuffer.y>=this._bufferService.rows?this._activeBuffer.y=this._bufferService.rows-1:this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.x>=this._bufferService.cols&&this._activeBuffer.x--,this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._onLineFeed.fire(),!0}carriageReturn(){return this._activeBuffer.x=0,!0}backspace(){if(!this._coreService.decPrivateModes.reverseWraparound)return this._restrictCursor(),this._activeBuffer.x>0&&this._activeBuffer.x--,!0;if(this._restrictCursor(this._bufferService.cols),this._activeBuffer.x>0)this._activeBuffer.x--;else if(this._activeBuffer.x===0&&this._activeBuffer.y>this._activeBuffer.scrollTop&&this._activeBuffer.y<=this._activeBuffer.scrollBottom&&this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y)?.isWrapped){this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.y--,this._activeBuffer.x=this._bufferService.cols-1;let t=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);t.hasWidth(this._activeBuffer.x)&&!t.hasContent(this._activeBuffer.x)&&this._activeBuffer.x--}return this._restrictCursor(),!0}tab(){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let t=this._activeBuffer.x;return this._activeBuffer.x=this._activeBuffer.nextStop(),this._optionsService.rawOptions.screenReaderMode&&this._onA11yTab.fire(this._activeBuffer.x-t),!0}shiftOut(){return this._charsetService.setgLevel(1),!0}shiftIn(){return this._charsetService.setgLevel(0),!0}_restrictCursor(t=this._bufferService.cols-1){this._activeBuffer.x=Math.min(t,Math.max(0,this._activeBuffer.x)),this._activeBuffer.y=this._coreService.decPrivateModes.origin?Math.min(this._activeBuffer.scrollBottom,Math.max(this._activeBuffer.scrollTop,this._activeBuffer.y)):Math.min(this._bufferService.rows-1,Math.max(0,this._activeBuffer.y)),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_setCursor(t,e){this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._coreService.decPrivateModes.origin?(this._activeBuffer.x=t,this._activeBuffer.y=this._activeBuffer.scrollTop+e):(this._activeBuffer.x=t,this._activeBuffer.y=e),this._restrictCursor(),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_moveCursor(t,e){this._restrictCursor(),this._setCursor(this._activeBuffer.x+t,this._activeBuffer.y+e)}cursorUp(t){let e=this._activeBuffer.y-this._activeBuffer.scrollTop;return e>=0?this._moveCursor(0,-Math.min(e,t.params[0]||1)):this._moveCursor(0,-(t.params[0]||1)),!0}cursorDown(t){let e=this._activeBuffer.scrollBottom-this._activeBuffer.y;return e>=0?this._moveCursor(0,Math.min(e,t.params[0]||1)):this._moveCursor(0,t.params[0]||1),!0}cursorForward(t){return this._moveCursor(t.params[0]||1,0),!0}cursorBackward(t){return this._moveCursor(-(t.params[0]||1),0),!0}cursorNextLine(t){return this.cursorDown(t),this._activeBuffer.x=0,!0}cursorPrecedingLine(t){return this.cursorUp(t),this._activeBuffer.x=0,!0}cursorCharAbsolute(t){return this._setCursor((t.params[0]||1)-1,this._activeBuffer.y),!0}cursorPosition(t){return this._setCursor(t.length>=2?(t.params[1]||1)-1:0,(t.params[0]||1)-1),!0}charPosAbsolute(t){return this._setCursor((t.params[0]||1)-1,this._activeBuffer.y),!0}hPositionRelative(t){return this._moveCursor(t.params[0]||1,0),!0}linePosAbsolute(t){return this._setCursor(this._activeBuffer.x,(t.params[0]||1)-1),!0}vPositionRelative(t){return this._moveCursor(0,t.params[0]||1),!0}hVPosition(t){return this.cursorPosition(t),!0}tabClear(t){let e=t.params[0];return e===0?delete this._activeBuffer.tabs[this._activeBuffer.x]:e===3&&(this._activeBuffer.tabs={}),!0}cursorForwardTab(t){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let e=t.params[0]||1;for(;e--;)this._activeBuffer.x=this._activeBuffer.nextStop();return!0}cursorBackwardTab(t){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let e=t.params[0]||1;for(;e--;)this._activeBuffer.x=this._activeBuffer.prevStop();return!0}selectProtected(t){let e=t.params[0];return e===1&&(this._curAttrData.bg|=536870912),(e===2||e===0)&&(this._curAttrData.bg&=-536870913),!0}_eraseInBufferLine(t,e,i,n=!1,a=!1){let l=this._activeBuffer.lines.get(this._activeBuffer.ybase+t);l.replaceCells(e,i,this._activeBuffer.getNullCell(this._eraseAttrData()),a),n&&(l.isWrapped=!1)}_resetBufferLine(t,e=!1){let i=this._activeBuffer.lines.get(this._activeBuffer.ybase+t);i&&(i.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),e),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+t),i.isWrapped=!1)}eraseInDisplay(t,e=!1){this._restrictCursor(this._bufferService.cols);let i;switch(t.params[0]){case 0:for(i=this._activeBuffer.y,this._dirtyRowTracker.markDirty(i),this._eraseInBufferLine(i++,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,e);i<this._bufferService.rows;i++)this._resetBufferLine(i,e);this._dirtyRowTracker.markDirty(i);break;case 1:for(i=this._activeBuffer.y,this._dirtyRowTracker.markDirty(i),this._eraseInBufferLine(i,0,this._activeBuffer.x+1,!0,e),this._activeBuffer.x+1>=this._bufferService.cols&&(this._activeBuffer.lines.get(i+1).isWrapped=!1);i--;)this._resetBufferLine(i,e);this._dirtyRowTracker.markDirty(0);break;case 2:if(this._optionsService.rawOptions.scrollOnEraseInDisplay){for(i=this._bufferService.rows,this._dirtyRowTracker.markRangeDirty(0,i-1);i--&&!this._activeBuffer.lines.get(this._activeBuffer.ybase+i)?.getTrimmedLength(););for(;i>=0;i--)this._bufferService.scroll(this._eraseAttrData())}else{for(i=this._bufferService.rows,this._dirtyRowTracker.markDirty(i-1);i--;)this._resetBufferLine(i,e);this._dirtyRowTracker.markDirty(0)}break;case 3:let n=this._activeBuffer.lines.length-this._bufferService.rows;n>0&&(this._activeBuffer.lines.trimStart(n),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-n,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-n,0),this._onScroll.fire(0));break}return!0}eraseInLine(t,e=!1){switch(this._restrictCursor(this._bufferService.cols),t.params[0]){case 0:this._eraseInBufferLine(this._activeBuffer.y,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,e);break;case 1:this._eraseInBufferLine(this._activeBuffer.y,0,this._activeBuffer.x+1,!1,e);break;case 2:this._eraseInBufferLine(this._activeBuffer.y,0,this._bufferService.cols,!0,e);break}return this._dirtyRowTracker.markDirty(this._activeBuffer.y),!0}insertLines(t){this._restrictCursor();let e=t.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let i=this._activeBuffer.ybase+this._activeBuffer.y,n=this._bufferService.rows-1-this._activeBuffer.scrollBottom,a=this._bufferService.rows-1+this._activeBuffer.ybase-n+1;for(;e--;)this._activeBuffer.lines.splice(a-1,1),this._activeBuffer.lines.splice(i,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}deleteLines(t){this._restrictCursor();let e=t.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let i=this._activeBuffer.ybase+this._activeBuffer.y,n;for(n=this._bufferService.rows-1-this._activeBuffer.scrollBottom,n=this._bufferService.rows-1+this._activeBuffer.ybase-n;e--;)this._activeBuffer.lines.splice(i,1),this._activeBuffer.lines.splice(n,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}insertChars(t){this._restrictCursor();let e=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return e&&(e.insertCells(this._activeBuffer.x,t.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}deleteChars(t){this._restrictCursor();let e=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return e&&(e.deleteCells(this._activeBuffer.x,t.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}scrollUp(t){let e=t.params[0]||1;for(;e--;)this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollTop,1),this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollBottom,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollDown(t){let e=t.params[0]||1;for(;e--;)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(_i));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollLeft(t){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let e=t.params[0]||1;for(let i=this._activeBuffer.scrollTop;i<=this._activeBuffer.scrollBottom;++i){let n=this._activeBuffer.lines.get(this._activeBuffer.ybase+i);n.deleteCells(0,e,this._activeBuffer.getNullCell(this._eraseAttrData())),n.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollRight(t){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let e=t.params[0]||1;for(let i=this._activeBuffer.scrollTop;i<=this._activeBuffer.scrollBottom;++i){let n=this._activeBuffer.lines.get(this._activeBuffer.ybase+i);n.insertCells(0,e,this._activeBuffer.getNullCell(this._eraseAttrData())),n.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}insertColumns(t){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let e=t.params[0]||1;for(let i=this._activeBuffer.scrollTop;i<=this._activeBuffer.scrollBottom;++i){let n=this._activeBuffer.lines.get(this._activeBuffer.ybase+i);n.insertCells(this._activeBuffer.x,e,this._activeBuffer.getNullCell(this._eraseAttrData())),n.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}deleteColumns(t){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let e=t.params[0]||1;for(let i=this._activeBuffer.scrollTop;i<=this._activeBuffer.scrollBottom;++i){let n=this._activeBuffer.lines.get(this._activeBuffer.ybase+i);n.deleteCells(this._activeBuffer.x,e,this._activeBuffer.getNullCell(this._eraseAttrData())),n.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}eraseChars(t){this._restrictCursor();let e=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return e&&(e.replaceCells(this._activeBuffer.x,this._activeBuffer.x+(t.params[0]||1),this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}repeatPrecedingCharacter(t){let e=this._parser.precedingJoinState;if(!e)return!0;let i=t.params[0]||1,n=Mo.extractWidth(e),a=this._activeBuffer.x-n,l=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).getString(a),u=new Uint32Array(l.length*i),h=0;for(let d=0;d<l.length;){let g=l.codePointAt(d)||0;u[h++]=g,d+=g>65535?2:1}let f=h;for(let d=1;d<i;++d)u.copyWithin(f,0,h),f+=h;return this.print(u,0,f),!0}sendDeviceAttributesPrimary(t){return t.params[0]>0||(this._is("xterm")||this._is("rxvt-unicode")||this._is("screen")?this._coreService.triggerDataEvent(le.ESC+"[?1;2c"):this._is("linux")&&this._coreService.triggerDataEvent(le.ESC+"[?6c")),!0}sendDeviceAttributesSecondary(t){return t.params[0]>0||(this._is("xterm")?this._coreService.triggerDataEvent(le.ESC+"[>0;276;0c"):this._is("rxvt-unicode")?this._coreService.triggerDataEvent(le.ESC+"[>85;95;0c"):this._is("linux")?this._coreService.triggerDataEvent(t.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent(le.ESC+"[>83;40003;0c")),!0}_is(t){return(this._optionsService.rawOptions.termName+"").indexOf(t)===0}setMode(t){for(let e=0;e<t.length;e++)switch(t.params[e]){case 4:this._coreService.modes.insertMode=!0;break;case 20:this._optionsService.options.convertEol=!0;break}return!0}setModePrivate(t){for(let e=0;e<t.length;e++)switch(t.params[e]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!0;break;case 2:this._charsetService.setgCharset(0,To),this._charsetService.setgCharset(1,To),this._charsetService.setgCharset(2,To),this._charsetService.setgCharset(3,To);break;case 3:this._optionsService.rawOptions.windowOptions.setWinLines&&(this._bufferService.resize(132,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!0,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!0;break;case 12:this._optionsService.options.cursorBlink=!0;break;case 45:this._coreService.decPrivateModes.reverseWraparound=!0;break;case 66:this._logService.debug("Serial port requested application keypad."),this._coreService.decPrivateModes.applicationKeypad=!0,this._onRequestSyncScrollBar.fire();break;case 9:this._coreMouseService.activeProtocol="X10";break;case 1e3:this._coreMouseService.activeProtocol="VT200";break;case 1002:this._coreMouseService.activeProtocol="DRAG";break;case 1003:this._coreMouseService.activeProtocol="ANY";break;case 1004:this._coreService.decPrivateModes.sendFocus=!0,this._onRequestSendFocus.fire();break;case 1005:this._logService.debug("DECSET 1005 not supported (see #2507)");break;case 1006:this._coreMouseService.activeEncoding="SGR";break;case 1015:this._logService.debug("DECSET 1015 not supported (see #2507)");break;case 1016:this._coreMouseService.activeEncoding="SGR_PIXELS";break;case 25:this._coreService.isCursorHidden=!1;break;case 1048:this.saveCursor();break;case 1049:this.saveCursor();case 47:case 1047:this._bufferService.buffers.activateAltBuffer(this._eraseAttrData()),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(void 0),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!0;break;case 2026:this._coreService.decPrivateModes.synchronizedOutput=!0;break}return!0}resetMode(t){for(let e=0;e<t.length;e++)switch(t.params[e]){case 4:this._coreService.modes.insertMode=!1;break;case 20:this._optionsService.options.convertEol=!1;break}return!0}resetModePrivate(t){for(let e=0;e<t.length;e++)switch(t.params[e]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!1;break;case 3:this._optionsService.rawOptions.windowOptions.setWinLines&&(this._bufferService.resize(80,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!1,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!1;break;case 12:this._optionsService.options.cursorBlink=!1;break;case 45:this._coreService.decPrivateModes.reverseWraparound=!1;break;case 66:this._logService.debug("Switching back to normal keypad."),this._coreService.decPrivateModes.applicationKeypad=!1,this._onRequestSyncScrollBar.fire();break;case 9:case 1e3:case 1002:case 1003:this._coreMouseService.activeProtocol="NONE";break;case 1004:this._coreService.decPrivateModes.sendFocus=!1;break;case 1005:this._logService.debug("DECRST 1005 not supported (see #2507)");break;case 1006:this._coreMouseService.activeEncoding="DEFAULT";break;case 1015:this._logService.debug("DECRST 1015 not supported (see #2507)");break;case 1016:this._coreMouseService.activeEncoding="DEFAULT";break;case 25:this._coreService.isCursorHidden=!0;break;case 1048:this.restoreCursor();break;case 1049:case 47:case 1047:this._bufferService.buffers.activateNormalBuffer(),t.params[e]===1049&&this.restoreCursor(),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(void 0),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!1;break;case 2026:this._coreService.decPrivateModes.synchronizedOutput=!1,this._onRequestRefreshRows.fire(void 0);break}return!0}requestMode(t,e){let i;(C=>(C[C.NOT_RECOGNIZED=0]="NOT_RECOGNIZED",C[C.SET=1]="SET",C[C.RESET=2]="RESET",C[C.PERMANENTLY_SET=3]="PERMANENTLY_SET",C[C.PERMANENTLY_RESET=4]="PERMANENTLY_RESET"))(i||={});let n=this._coreService.decPrivateModes,{activeProtocol:a,activeEncoding:l}=this._coreMouseService,u=this._coreService,{buffers:h,cols:f}=this._bufferService,{active:d,alt:g}=h,v=this._optionsService.rawOptions,p=(C,x)=>(u.triggerDataEvent(`${le.ESC}[${e?"":"?"}${C};${x}$y`),!0),S=C=>C?1:2,y=t.params[0];return e?y===2?p(y,4):y===4?p(y,S(u.modes.insertMode)):y===12?p(y,3):y===20?p(y,S(v.convertEol)):p(y,0):y===1?p(y,S(n.applicationCursorKeys)):y===3?p(y,v.windowOptions.setWinLines?f===80?2:f===132?1:0:0):y===6?p(y,S(n.origin)):y===7?p(y,S(n.wraparound)):y===8?p(y,3):y===9?p(y,S(a==="X10")):y===12?p(y,S(v.cursorBlink)):y===25?p(y,S(!u.isCursorHidden)):y===45?p(y,S(n.reverseWraparound)):y===66?p(y,S(n.applicationKeypad)):y===67?p(y,4):y===1e3?p(y,S(a==="VT200")):y===1002?p(y,S(a==="DRAG")):y===1003?p(y,S(a==="ANY")):y===1004?p(y,S(n.sendFocus)):y===1005?p(y,4):y===1006?p(y,S(l==="SGR")):y===1015?p(y,4):y===1016?p(y,S(l==="SGR_PIXELS")):y===1048?p(y,1):y===47||y===1047||y===1049?p(y,S(d===g)):y===2004?p(y,S(n.bracketedPasteMode)):y===2026?p(y,S(n.synchronizedOutput)):p(y,0)}_updateAttrColor(t,e,i,n,a){return e===2?(t|=50331648,t&=-16777216,t|=Bu.fromColorRGB([i,n,a])):e===5&&(t&=-50331904,t|=33554432|i&255),t}_extractColor(t,e,i){let n=[0,0,-1,0,0,0],a=0,l=0;do{if(n[l+a]=t.params[e+l],t.hasSubParams(e+l)){let u=t.getSubParams(e+l),h=0;do n[1]===5&&(a=1),n[l+h+1+a]=u[h];while(++h<u.length&&h+l+1+a<n.length);break}if(n[1]===5&&l+a>=2||n[1]===2&&l+a>=5)break;n[1]&&(a=1)}while(++l+e<t.length&&l+a<n.length);for(let u=2;u<n.length;++u)n[u]===-1&&(n[u]=0);switch(n[0]){case 38:i.fg=this._updateAttrColor(i.fg,n[1],n[3],n[4],n[5]);break;case 48:i.bg=this._updateAttrColor(i.bg,n[1],n[3],n[4],n[5]);break;case 58:i.extended=i.extended.clone(),i.extended.underlineColor=this._updateAttrColor(i.extended.underlineColor,n[1],n[3],n[4],n[5])}return l}_processUnderline(t,e){e.extended=e.extended.clone(),(!~t||t>5)&&(t=1),e.extended.underlineStyle=t,e.fg|=268435456,t===0&&(e.fg&=-268435457),e.updateExtended()}_processSGR0(t){t.fg=_i.fg,t.bg=_i.bg,t.extended=t.extended.clone(),t.extended.underlineStyle=0,t.extended.underlineColor&=-67108864,t.updateExtended()}charAttributes(t){if(t.length===1&&t.params[0]===0)return this._processSGR0(this._curAttrData),!0;let e=t.length,i,n=this._curAttrData;for(let a=0;a<e;a++)i=t.params[a],i>=30&&i<=37?(n.fg&=-50331904,n.fg|=16777216|i-30):i>=40&&i<=47?(n.bg&=-50331904,n.bg|=16777216|i-40):i>=90&&i<=97?(n.fg&=-50331904,n.fg|=16777216|i-90|8):i>=100&&i<=107?(n.bg&=-50331904,n.bg|=16777216|i-100|8):i===0?this._processSGR0(n):i===1?n.fg|=134217728:i===3?n.bg|=67108864:i===4?(n.fg|=268435456,this._processUnderline(t.hasSubParams(a)?t.getSubParams(a)[0]:1,n)):i===5?n.fg|=536870912:i===7?n.fg|=67108864:i===8?n.fg|=1073741824:i===9?n.fg|=2147483648:i===2?n.bg|=134217728:i===21?this._processUnderline(2,n):i===22?(n.fg&=-134217729,n.bg&=-134217729):i===23?n.bg&=-67108865:i===24?(n.fg&=-268435457,this._processUnderline(0,n)):i===25?n.fg&=-536870913:i===27?n.fg&=-67108865:i===28?n.fg&=-1073741825:i===29?n.fg&=2147483647:i===39?(n.fg&=-67108864,n.fg|=_i.fg&16777215):i===49?(n.bg&=-67108864,n.bg|=_i.bg&16777215):i===38||i===48||i===58?a+=this._extractColor(t,a,n):i===53?n.bg|=1073741824:i===55?n.bg&=-1073741825:i===59?(n.extended=n.extended.clone(),n.extended.underlineColor=-1,n.updateExtended()):i===100?(n.fg&=-67108864,n.fg|=_i.fg&16777215,n.bg&=-67108864,n.bg|=_i.bg&16777215):this._logService.debug("Unknown SGR attribute: %d.",i);return!0}deviceStatus(t){switch(t.params[0]){case 5:this._coreService.triggerDataEvent(`${le.ESC}[0n`);break;case 6:let e=this._activeBuffer.y+1,i=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${le.ESC}[${e};${i}R`);break}return!0}deviceStatusPrivate(t){if(t.params[0]===6){let e=this._activeBuffer.y+1,i=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${le.ESC}[?${e};${i}R`)}return!0}softReset(t){return this._coreService.isCursorHidden=!1,this._onRequestSyncScrollBar.fire(),this._activeBuffer.scrollTop=0,this._activeBuffer.scrollBottom=this._bufferService.rows-1,this._curAttrData=_i.clone(),this._coreService.reset(),this._charsetService.reset(),this._activeBuffer.savedX=0,this._activeBuffer.savedY=this._activeBuffer.ybase,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,this._coreService.decPrivateModes.origin=!1,!0}setCursorStyle(t){let e=t.length===0?1:t.params[0];if(e===0)this._coreService.decPrivateModes.cursorStyle=void 0,this._coreService.decPrivateModes.cursorBlink=void 0;else{switch(e){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 i=e%2===1;this._coreService.decPrivateModes.cursorBlink=i}return!0}setScrollRegion(t){let e=t.params[0]||1,i;return(t.length<2||(i=t.params[1])>this._bufferService.rows||i===0)&&(i=this._bufferService.rows),i>e&&(this._activeBuffer.scrollTop=e-1,this._activeBuffer.scrollBottom=i-1,this._setCursor(0,0)),!0}windowOptions(t){if(!Yb(t.params[0],this._optionsService.rawOptions.windowOptions))return!0;let e=t.length>1?t.params[1]:0;switch(t.params[0]){case 14:e!==2&&this._onRequestWindowsOptionsReport.fire(0);break;case 16:this._onRequestWindowsOptionsReport.fire(1);break;case 18:this._bufferService&&this._coreService.triggerDataEvent(`${le.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);break;case 22:(e===0||e===2)&&(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>qb&&this._windowTitleStack.shift()),(e===0||e===1)&&(this._iconNameStack.push(this._iconName),this._iconNameStack.length>qb&&this._iconNameStack.shift());break;case 23:(e===0||e===2)&&this._windowTitleStack.length&&this.setTitle(this._windowTitleStack.pop()),(e===0||e===1)&&this._iconNameStack.length&&this.setIconName(this._iconNameStack.pop());break}return!0}saveCursor(t){return this._activeBuffer.savedX=this._activeBuffer.x,this._activeBuffer.savedY=this._activeBuffer.ybase+this._activeBuffer.y,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,!0}restoreCursor(t){return this._activeBuffer.x=this._activeBuffer.savedX||0,this._activeBuffer.y=Math.max(this._activeBuffer.savedY-this._activeBuffer.ybase,0),this._curAttrData.fg=this._activeBuffer.savedCurAttrData.fg,this._curAttrData.bg=this._activeBuffer.savedCurAttrData.bg,this._charsetService.charset=this._savedCharset,this._activeBuffer.savedCharset&&(this._charsetService.charset=this._activeBuffer.savedCharset),this._restrictCursor(),!0}setTitle(t){return this._windowTitle=t,this._onTitleChange.fire(t),!0}setIconName(t){return this._iconName=t,!0}setOrReportIndexedColor(t){let e=[],i=t.split(";");for(;i.length>1;){let n=i.shift(),a=i.shift();if(/^\d+$/.exec(n)){let l=parseInt(n);if(Xb(l))if(a==="?")e.push({type:0,index:l});else{let u=Vb(a);u&&e.push({type:1,index:l,color:u})}}}return e.length&&this._onColor.fire(e),!0}setHyperlink(t){let e=t.indexOf(";");if(e===-1)return!0;let i=t.slice(0,e).trim(),n=t.slice(e+1);return n?this._createHyperlink(i,n):i.trim()?!1:this._finishHyperlink()}_createHyperlink(t,e){this._getCurrentLinkId()&&this._finishHyperlink();let i=t.split(":"),n,a=i.findIndex(l=>l.startsWith("id="));return a!==-1&&(n=i[a].slice(3)||void 0),this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=this._oscLinkService.registerLink({id:n,uri:e}),this._curAttrData.updateExtended(),!0}_finishHyperlink(){return this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=0,this._curAttrData.updateExtended(),!0}_setOrReportSpecialColor(t,e){let i=t.split(";");for(let n=0;n<i.length&&!(e>=this._specialColors.length);++n,++e)if(i[n]==="?")this._onColor.fire([{type:0,index:this._specialColors[e]}]);else{let a=Vb(i[n]);a&&this._onColor.fire([{type:1,index:this._specialColors[e],color:a}])}return!0}setOrReportFgColor(t){return this._setOrReportSpecialColor(t,0)}setOrReportBgColor(t){return this._setOrReportSpecialColor(t,1)}setOrReportCursorColor(t){return this._setOrReportSpecialColor(t,2)}restoreIndexedColor(t){if(!t)return this._onColor.fire([{type:2}]),!0;let e=[],i=t.split(";");for(let n=0;n<i.length;++n)if(/^\d+$/.exec(i[n])){let a=parseInt(i[n]);Xb(a)&&e.push({type:2,index:a})}return e.length&&this._onColor.fire(e),!0}restoreFgColor(t){return this._onColor.fire([{type:2,index:256}]),!0}restoreBgColor(t){return this._onColor.fire([{type:2,index:257}]),!0}restoreCursorColor(t){return this._onColor.fire([{type:2,index:258}]),!0}nextLine(){return this._activeBuffer.x=0,this.index(),!0}keypadApplicationMode(){return this._logService.debug("Serial port requested application keypad."),this._coreService.decPrivateModes.applicationKeypad=!0,this._onRequestSyncScrollBar.fire(),!0}keypadNumericMode(){return this._logService.debug("Switching back to normal keypad."),this._coreService.decPrivateModes.applicationKeypad=!1,this._onRequestSyncScrollBar.fire(),!0}selectDefaultCharset(){return this._charsetService.setgLevel(0),this._charsetService.setgCharset(0,To),!0}selectCharset(t){return t.length!==2?(this.selectDefaultCharset(),!0):(t[0]==="/"||this._charsetService.setgCharset(zA[t[0]],ki[t[1]]||To),!0)}index(){return this._restrictCursor(),this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData())):this._activeBuffer.y>=this._bufferService.rows&&(this._activeBuffer.y=this._bufferService.rows-1),this._restrictCursor(),!0}tabSet(){return this._activeBuffer.tabs[this._activeBuffer.x]=!0,!0}reverseIndex(){if(this._restrictCursor(),this._activeBuffer.y===this._activeBuffer.scrollTop){let t=this._activeBuffer.scrollBottom-this._activeBuffer.scrollTop;this._activeBuffer.lines.shiftElements(this._activeBuffer.ybase+this._activeBuffer.y,t,1),this._activeBuffer.lines.set(this._activeBuffer.ybase+this._activeBuffer.y,this._activeBuffer.getBlankLine(this._eraseAttrData())),this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom)}else this._activeBuffer.y--,this._restrictCursor();return!0}fullReset(){return this._parser.reset(),this._onRequestReset.fire(),!0}reset(){this._curAttrData=_i.clone(),this._eraseAttrDataInternal=_i.clone()}_eraseAttrData(){return this._eraseAttrDataInternal.bg&=-67108864,this._eraseAttrDataInternal.bg|=this._curAttrData.bg&67108863,this._eraseAttrDataInternal}setgLevel(t){return this._charsetService.setgLevel(t),!0}screenAlignmentPattern(){let t=new kr;t.content=1<<22|69,t.fg=this._curAttrData.fg,t.bg=this._curAttrData.bg,this._setCursor(0,0);for(let e=0;e<this._bufferService.rows;++e){let i=this._activeBuffer.ybase+this._activeBuffer.y+e,n=this._activeBuffer.lines.get(i);n&&(n.fill(t),n.isWrapped=!1)}return this._dirtyRowTracker.markAllDirty(),this._setCursor(0,0),!0}requestStatusString(t,e){let i=u=>(this._coreService.triggerDataEvent(`${le.ESC}${u}${le.ESC}\\`),!0),n=this._bufferService.buffer,a=this._optionsService.rawOptions;return i(t==='"q'?`P1$r${this._curAttrData.isProtected()?1:0}"q`:t==='"p'?'P1$r61;1"p':t==="r"?`P1$r${n.scrollTop+1};${n.scrollBottom+1}r`:t==="m"?"P1$r0m":t===" q"?`P1$r${{block:2,underline:4,bar:6}[a.cursorStyle]-(a.cursorBlink?1:0)} q`:"P0$r")}markRangeDirty(t,e){this._dirtyRowTracker.markRangeDirty(t,e)}},dg=class{constructor(t){this._bufferService=t,this.clearRange()}clearRange(){this.start=this._bufferService.buffer.y,this.end=this._bufferService.buffer.y}markDirty(t){t<this.start?this.start=t:t>this.end&&(this.end=t)}markRangeDirty(t,e){t>e&&(Kb=t,t=e,e=Kb),t<this.start&&(this.start=t),e>this.end&&(this.end=e)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};dg=si([xe(0,fs)],dg);function Xb(t){return 0<=t&&t<256}var IA=5e7,Zb=12,UA=50,FA=class extends nt{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 ve),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 a=this._callbacks.shift();a&&a()}this._pendingData=0,this._bufferOffset=2147483647,this._isSyncWriting=!1,this._syncCalls=0}write(e,i){if(this._pendingData>IA)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 a=this._writeBuffer[this._bufferOffset],l=this._action(a,i);if(l){let h=f=>performance.now()-n>=Zb?setTimeout(()=>this._innerWrite(0,f)):this._innerWrite(n,f);l.catch(f=>(queueMicrotask(()=>{throw f}),Promise.resolve(!1))).then(h);return}let u=this._callbacks[this._bufferOffset];if(u&&u(),this._bufferOffset++,this._pendingData-=a.length,performance.now()-n>=Zb)break}this._writeBuffer.length>this._bufferOffset?(this._bufferOffset>UA&&(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()}},fg=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 f=i.addMarker(i.ybase+i.y),d={data:e,id:this._nextId++,lines:[f]};return f.onDispose(()=>this._removeMarkerFromLink(d,f)),this._dataByLinkId.set(d.id,d),d.id}let n=e,a=this._getEntryIdKey(n),l=this._entriesWithId.get(a);if(l)return this.addLineToLink(l.id,i.ybase+i.y),l.id;let u=i.addMarker(i.ybase+i.y),h={id:this._nextId++,key:this._getEntryIdKey(n),data:n,lines:[u]};return u.onDispose(()=>this._removeMarkerFromLink(h,u)),this._entriesWithId.set(h.key,h),this._dataByLinkId.set(h.id,h),h.id}addLineToLink(e,i){let n=this._dataByLinkId.get(e);if(n&&n.lines.every(a=>a.line!==i)){let a=this._bufferService.buffer.addMarker(i);n.lines.push(a),a.onDispose(()=>this._removeMarkerFromLink(n,a))}}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)))}};fg=si([xe(0,fs)],fg);var Qb=!1,$A=class extends nt{constructor(e){super(),this._windowsWrappingHeuristics=this._register(new Gl),this._onBinary=this._register(new ve),this.onBinary=this._onBinary.event,this._onData=this._register(new ve),this.onData=this._onData.event,this._onLineFeed=this._register(new ve),this.onLineFeed=this._onLineFeed.event,this._onResize=this._register(new ve),this.onResize=this._onResize.event,this._onWriteParsed=this._register(new ve),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this._register(new ve),this._instantiationService=new dA,this.optionsService=this._register(new wA(e)),this._instantiationService.setService(ms,this.optionsService),this._bufferService=this._register(this._instantiationService.createInstance(lg)),this._instantiationService.setService(fs,this._bufferService),this._logService=this._register(this._instantiationService.createInstance(og)),this._instantiationService.setService(tC,this._logService),this.coreService=this._register(this._instantiationService.createInstance(cg)),this._instantiationService.setService(Wo,this.coreService),this.coreMouseService=this._register(this._instantiationService.createInstance(ug)),this._instantiationService.setService(eC,this.coreMouseService),this.unicodeService=this._register(this._instantiationService.createInstance(Mo)),this._instantiationService.setService(lR,this.unicodeService),this._charsetService=this._instantiationService.createInstance(TA),this._instantiationService.setService(oR,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(fg),this._instantiationService.setService(iC,this._oscLinkService),this._inputHandler=this._register(new HA(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService)),this._register(Qi.forward(this._inputHandler.onLineFeed,this._onLineFeed)),this._register(this._inputHandler),this._register(Qi.forward(this._bufferService.onResize,this._onResize)),this._register(Qi.forward(this.coreService.onData,this._onData)),this._register(Qi.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 FA((i,n)=>this._inputHandler.parse(i,n))),this._register(Qi.forward(this._writeBuffer.onWriteParsed,this._onWriteParsed))}get onScroll(){return this._onScrollApi||(this._onScrollApi=this._register(new ve),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&&!Qb&&(this._logService.warn("writeSync is unreliable and will be removed soon."),Qb=!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,BC),i=Math.max(i,NC),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(Wb.bind(null,this._bufferService))),e.push(this.registerCsiHandler({final:"H"},()=>(Wb(this._bufferService),!1))),this._windowsWrappingHeuristics.value=jt(()=>{for(let i of e)i.dispose()})}}},WA={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 jA(t,e,i,n){let a={type:0,cancel:!1,key:void 0},l=(t.shiftKey?1:0)|(t.altKey?2:0)|(t.ctrlKey?4:0)|(t.metaKey?8:0);switch(t.keyCode){case 0:t.key==="UIKeyInputUpArrow"?e?a.key=le.ESC+"OA":a.key=le.ESC+"[A":t.key==="UIKeyInputLeftArrow"?e?a.key=le.ESC+"OD":a.key=le.ESC+"[D":t.key==="UIKeyInputRightArrow"?e?a.key=le.ESC+"OC":a.key=le.ESC+"[C":t.key==="UIKeyInputDownArrow"&&(e?a.key=le.ESC+"OB":a.key=le.ESC+"[B");break;case 8:a.key=t.ctrlKey?"\b":le.DEL,t.altKey&&(a.key=le.ESC+a.key);break;case 9:if(t.shiftKey){a.key=le.ESC+"[Z";break}a.key=le.HT,a.cancel=!0;break;case 13:a.key=t.altKey?le.ESC+le.CR:le.CR,a.cancel=!0;break;case 27:a.key=le.ESC,t.altKey&&(a.key=le.ESC+le.ESC),a.cancel=!0;break;case 37:if(t.metaKey)break;l?a.key=le.ESC+"[1;"+(l+1)+"D":e?a.key=le.ESC+"OD":a.key=le.ESC+"[D";break;case 39:if(t.metaKey)break;l?a.key=le.ESC+"[1;"+(l+1)+"C":e?a.key=le.ESC+"OC":a.key=le.ESC+"[C";break;case 38:if(t.metaKey)break;l?a.key=le.ESC+"[1;"+(l+1)+"A":e?a.key=le.ESC+"OA":a.key=le.ESC+"[A";break;case 40:if(t.metaKey)break;l?a.key=le.ESC+"[1;"+(l+1)+"B":e?a.key=le.ESC+"OB":a.key=le.ESC+"[B";break;case 45:!t.shiftKey&&!t.ctrlKey&&(a.key=le.ESC+"[2~");break;case 46:l?a.key=le.ESC+"[3;"+(l+1)+"~":a.key=le.ESC+"[3~";break;case 36:l?a.key=le.ESC+"[1;"+(l+1)+"H":e?a.key=le.ESC+"OH":a.key=le.ESC+"[H";break;case 35:l?a.key=le.ESC+"[1;"+(l+1)+"F":e?a.key=le.ESC+"OF":a.key=le.ESC+"[F";break;case 33:t.shiftKey?a.type=2:t.ctrlKey?a.key=le.ESC+"[5;"+(l+1)+"~":a.key=le.ESC+"[5~";break;case 34:t.shiftKey?a.type=3:t.ctrlKey?a.key=le.ESC+"[6;"+(l+1)+"~":a.key=le.ESC+"[6~";break;case 112:l?a.key=le.ESC+"[1;"+(l+1)+"P":a.key=le.ESC+"OP";break;case 113:l?a.key=le.ESC+"[1;"+(l+1)+"Q":a.key=le.ESC+"OQ";break;case 114:l?a.key=le.ESC+"[1;"+(l+1)+"R":a.key=le.ESC+"OR";break;case 115:l?a.key=le.ESC+"[1;"+(l+1)+"S":a.key=le.ESC+"OS";break;case 116:l?a.key=le.ESC+"[15;"+(l+1)+"~":a.key=le.ESC+"[15~";break;case 117:l?a.key=le.ESC+"[17;"+(l+1)+"~":a.key=le.ESC+"[17~";break;case 118:l?a.key=le.ESC+"[18;"+(l+1)+"~":a.key=le.ESC+"[18~";break;case 119:l?a.key=le.ESC+"[19;"+(l+1)+"~":a.key=le.ESC+"[19~";break;case 120:l?a.key=le.ESC+"[20;"+(l+1)+"~":a.key=le.ESC+"[20~";break;case 121:l?a.key=le.ESC+"[21;"+(l+1)+"~":a.key=le.ESC+"[21~";break;case 122:l?a.key=le.ESC+"[23;"+(l+1)+"~":a.key=le.ESC+"[23~";break;case 123:l?a.key=le.ESC+"[24;"+(l+1)+"~":a.key=le.ESC+"[24~";break;default:if(t.ctrlKey&&!t.shiftKey&&!t.altKey&&!t.metaKey)t.keyCode>=65&&t.keyCode<=90?a.key=String.fromCharCode(t.keyCode-64):t.keyCode===32?a.key=le.NUL:t.keyCode>=51&&t.keyCode<=55?a.key=String.fromCharCode(t.keyCode-51+27):t.keyCode===56?a.key=le.DEL:t.keyCode===219?a.key=le.ESC:t.keyCode===220?a.key=le.FS:t.keyCode===221&&(a.key=le.GS);else if((!i||n)&&t.altKey&&!t.metaKey){let u=WA[t.keyCode]?.[t.shiftKey?1:0];if(u)a.key=le.ESC+u;else if(t.keyCode>=65&&t.keyCode<=90){let h=t.ctrlKey?t.keyCode-64:t.keyCode+32,f=String.fromCharCode(h);t.shiftKey&&(f=f.toUpperCase()),a.key=le.ESC+f}else if(t.keyCode===32)a.key=le.ESC+(t.ctrlKey?le.NUL:" ");else if(t.key==="Dead"&&t.code.startsWith("Key")){let h=t.code.slice(3,4);t.shiftKey||(h=h.toLowerCase()),a.key=le.ESC+h,a.cancel=!0}}else i&&!t.altKey&&!t.ctrlKey&&!t.shiftKey&&t.metaKey?t.keyCode===65&&(a.type=1):t.key&&!t.ctrlKey&&!t.altKey&&!t.metaKey&&t.keyCode>=48&&t.key.length===1?a.key=t.key:t.key&&t.ctrlKey&&(t.key==="_"&&(a.key=le.US),t.key==="@"&&(a.key=le.NUL));break}return a}var li=0,VA=class{constructor(e){this._getKey=e,this._array=[],this._insertedValues=[],this._flushInsertedTask=new Xd,this._isFlushingInserted=!1,this._deletedIndices=[],this._flushDeletedTask=new Xd,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((l,u)=>this._getKey(l)-this._getKey(u)),i=0,n=0,a=new Array(this._array.length+this._insertedValues.length);for(let l=0;l<a.length;l++)n>=this._array.length||this._getKey(e[i])<=this._getKey(this._array[n])?(a[l]=e[i],i++):a[l]=this._array[n++];this._array=a,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||(li=this._search(i),li===-1)||this._getKey(this._array[li])!==i)return!1;do if(this._array[li]===e)return this._deletedIndices.length===0&&this._flushDeletedTask.enqueue(()=>this._flushDeleted()),this._deletedIndices.push(li),!0;while(++li<this._array.length&&this._getKey(this._array[li])===i);return!1}_flushDeleted(){this._isFlushingDeleted=!0;let e=this._deletedIndices.sort((l,u)=>l-u),i=0,n=new Array(this._array.length-e.length),a=0;for(let l=0;l<this._array.length;l++)e[i]===l?i++:n[a++]=this._array[l];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&&(li=this._search(e),!(li<0||li>=this._array.length)&&this._getKey(this._array[li])===e))do yield this._array[li];while(++li<this._array.length&&this._getKey(this._array[li])===e)}forEachByKey(e,i){if(this._flushCleanupInserted(),this._flushCleanupDeleted(),this._array.length!==0&&(li=this._search(e),!(li<0||li>=this._array.length)&&this._getKey(this._array[li])===e))do i(this._array[li]);while(++li<this._array.length&&this._getKey(this._array[li])===e)}values(){return this._flushCleanupInserted(),this._flushCleanupDeleted(),[...this._array].values()}_search(e){let i=0,n=this._array.length-1;for(;n>=i;){let a=i+n>>1,l=this._getKey(this._array[a]);if(l>e)n=a-1;else if(l<e)i=a+1;else{for(;a>0&&this._getKey(this._array[a-1])===e;)a--;return a}}return i}},sp=0,Jb=0,qA=class extends nt{constructor(){super(),this._decorations=new VA(t=>t?.marker.line),this._onDecorationRegistered=this._register(new ve),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this._register(new ve),this.onDecorationRemoved=this._onDecorationRemoved.event,this._register(jt(()=>this.reset()))}get decorations(){return this._decorations.values()}registerDecoration(t){if(t.marker.isDisposed)return;let e=new YA(t);if(e){let i=e.marker.onDispose(()=>e.dispose()),n=e.onDispose(()=>{n.dispose(),e&&(this._decorations.delete(e)&&this._onDecorationRemoved.fire(e),i.dispose())});this._decorations.insert(e),this._onDecorationRegistered.fire(e)}return e}reset(){for(let t of this._decorations.values())t.dispose();this._decorations.clear()}*getDecorationsAtCell(t,e,i){let n=0,a=0;for(let l of this._decorations.getKeyIterator(e))n=l.options.x??0,a=n+(l.options.width??1),t>=n&&t<a&&(!i||(l.options.layer??"bottom")===i)&&(yield l)}forEachDecorationAtCell(t,e,i,n){this._decorations.forEachByKey(e,a=>{sp=a.options.x??0,Jb=sp+(a.options.width??1),t>=sp&&t<Jb&&(!i||(a.options.layer??"bottom")===i)&&n(a)})}},YA=class extends Ya{constructor(t){super(),this.options=t,this.onRenderEmitter=this.add(new ve),this.onRender=this.onRenderEmitter.event,this._onDispose=this.add(new ve),this.onDispose=this._onDispose.event,this._cachedBg=null,this._cachedFg=null,this.marker=t.marker,this.options.overviewRulerOptions&&!this.options.overviewRulerOptions.position&&(this.options.overviewRulerOptions.position="full")}get backgroundColorRGB(){return this._cachedBg===null&&(this.options.backgroundColor?this._cachedBg=Gt.toColor(this.options.backgroundColor):this._cachedBg=void 0),this._cachedBg}get foregroundColorRGB(){return this._cachedFg===null&&(this.options.foregroundColor?this._cachedFg=Gt.toColor(this.options.foregroundColor):this._cachedFg=void 0),this._cachedFg}dispose(){this._onDispose.fire(),super.dispose()}},GA=1e3,KA=class{constructor(e,i=GA){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 a=performance.now();if(a-this._lastRefreshMs>=this._debounceThresholdMS)this._lastRefreshMs=a,this._innerRefresh();else if(!this._additionalRefreshRequested){let l=a-this._lastRefreshMs,u=this._debounceThresholdMS-l;this._additionalRefreshRequested=!0,this._refreshTimeoutID=window.setTimeout(()=>{this._lastRefreshMs=performance.now(),this._innerRefresh(),this._additionalRefreshRequested=!1,this._refreshTimeoutID=void 0},u)}}_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)}},e1=20,Zd=class extends nt{constructor(t,e,i,n){super(),this._terminal=t,this._coreBrowserService=i,this._renderService=n,this._rowColumns=new WeakMap,this._liveRegionLineCount=0,this._charsToConsume=[],this._charsToAnnounce="";let a=this._coreBrowserService.mainDocument;this._accessibilityContainer=a.createElement("div"),this._accessibilityContainer.classList.add("xterm-accessibility"),this._rowContainer=a.createElement("div"),this._rowContainer.setAttribute("role","list"),this._rowContainer.classList.add("xterm-accessibility-tree"),this._rowElements=[];for(let l=0;l<this._terminal.rows;l++)this._rowElements[l]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[l]);if(this._topBoundaryFocusListener=l=>this._handleBoundaryFocus(l,0),this._bottomBoundaryFocusListener=l=>this._handleBoundaryFocus(l,1),this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._accessibilityContainer.appendChild(this._rowContainer),this._liveRegion=a.createElement("div"),this._liveRegion.classList.add("live-region"),this._liveRegion.setAttribute("aria-live","assertive"),this._accessibilityContainer.appendChild(this._liveRegion),this._liveRegionDebouncer=this._register(new KA(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(l=>this._handleResize(l.rows))),this._register(this._terminal.onRender(l=>this._refreshRows(l.start,l.end))),this._register(this._terminal.onScroll(()=>this._refreshRows())),this._register(this._terminal.onA11yChar(l=>this._handleChar(l))),this._register(this._terminal.onLineFeed(()=>this._handleChar(`
22
+ `))),this._register(this._terminal.onA11yTab(l=>this._handleTab(l))),this._register(this._terminal.onKey(l=>this._handleKey(l.key))),this._register(this._terminal.onBlur(()=>this._clearLiveRegion())),this._register(this._renderService.onDimensionsChange(()=>this._refreshRowsDimensions())),this._register(Ye(a,"selectionchange",()=>this._handleSelectionChange())),this._register(this._coreBrowserService.onDprChange(()=>this._refreshRowsDimensions())),this._refreshRowsDimensions(),this._refreshRows(),this._register(jt(()=>{this._accessibilityContainer.remove(),this._rowElements.length=0}))}_handleTab(t){for(let e=0;e<t;e++)this._handleChar(" ")}_handleChar(t){this._liveRegionLineCount<e1+1&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==t&&(this._charsToAnnounce+=t):this._charsToAnnounce+=t,t===`
23
+ `&&(this._liveRegionLineCount++,this._liveRegionLineCount===e1+1&&(this._liveRegion.textContent+=Op.get())))}_clearLiveRegion(){this._liveRegion.textContent="",this._liveRegionLineCount=0}_handleKey(t){this._clearLiveRegion(),new RegExp("\\p{Control}","u").test(t)||this._charsToConsume.push(t)}_refreshRows(t,e){this._liveRegionDebouncer.refresh(t,e,this._terminal.rows)}_renderRows(t,e){let i=this._terminal.buffer,n=i.lines.length.toString();for(let a=t;a<=e;a++){let l=i.lines.get(i.ydisp+a),u=[],h=l?.translateToString(!0,void 0,void 0,u)||"",f=(i.ydisp+a+1).toString(),d=this._rowElements[a];d&&(h.length===0?(d.textContent=" ",this._rowColumns.set(d,[0,1])):(d.textContent=h,this._rowColumns.set(d,u)),d.setAttribute("aria-posinset",f),d.setAttribute("aria-setsize",n),this._alignRowWidth(d))}this._announceCharacters()}_announceCharacters(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce="")}_handleBoundaryFocus(t,e){let i=t.target,n=this._rowElements[e===0?1:this._rowElements.length-2],a=i.getAttribute("aria-posinset"),l=e===0?"1":`${this._terminal.buffer.lines.length}`;if(a===l||t.relatedTarget!==n)return;let u,h;if(e===0?(u=i,h=this._rowElements.pop(),this._rowContainer.removeChild(h)):(u=this._rowElements.shift(),h=i,this._rowContainer.removeChild(u)),u.removeEventListener("focus",this._topBoundaryFocusListener),h.removeEventListener("focus",this._bottomBoundaryFocusListener),e===0){let f=this._createAccessibilityTreeNode();this._rowElements.unshift(f),this._rowContainer.insertAdjacentElement("afterbegin",f)}else{let f=this._createAccessibilityTreeNode();this._rowElements.push(f),this._rowContainer.appendChild(f)}this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._terminal.scrollLines(e===0?-1:1),this._rowElements[e===0?1:this._rowElements.length-2].focus(),t.preventDefault(),t.stopImmediatePropagation()}_handleSelectionChange(){if(this._rowElements.length===0)return;let t=this._coreBrowserService.mainDocument.getSelection();if(!t)return;if(t.isCollapsed){this._rowContainer.contains(t.anchorNode)&&this._terminal.clearSelection();return}if(!t.anchorNode||!t.focusNode){console.error("anchorNode and/or focusNode are null");return}let e={node:t.anchorNode,offset:t.anchorOffset},i={node:t.focusNode,offset:t.focusOffset};if((e.node.compareDocumentPosition(i.node)&Node.DOCUMENT_POSITION_PRECEDING||e.node===i.node&&e.offset>i.offset)&&([e,i]=[i,e]),e.node.compareDocumentPosition(this._rowElements[0])&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_FOLLOWING)&&(e={node:this._rowElements[0].childNodes[0],offset:0}),!this._rowContainer.contains(e.node))return;let n=this._rowElements.slice(-1)[0];if(i.node.compareDocumentPosition(n)&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_PRECEDING)&&(i={node:n,offset:n.textContent?.length??0}),!this._rowContainer.contains(i.node))return;let a=({node:h,offset:f})=>{let d=h instanceof Text?h.parentNode:h,g=parseInt(d?.getAttribute("aria-posinset"),10)-1;if(isNaN(g))return console.warn("row is invalid. Race condition?"),null;let v=this._rowColumns.get(d);if(!v)return console.warn("columns is null. Race condition?"),null;let p=f<v.length?v[f]:v.slice(-1)[0]+1;return p>=this._terminal.cols&&(++g,p=0),{row:g,column:p}},l=a(e),u=a(i);if(!(!l||!u)){if(l.row>u.row||l.row===u.row&&l.column>=u.column)throw new Error("invalid range");this._terminal.select(l.column,l.row,(u.row-l.row)*this._terminal.cols-l.column+u.column)}}_handleResize(t){this._rowElements[this._rowElements.length-1].removeEventListener("focus",this._bottomBoundaryFocusListener);for(let e=this._rowContainer.children.length;e<this._terminal.rows;e++)this._rowElements[e]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[e]);for(;this._rowElements.length>t;)this._rowContainer.removeChild(this._rowElements.pop());this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions()}_createAccessibilityTreeNode(){let t=this._coreBrowserService.mainDocument.createElement("div");return t.setAttribute("role","listitem"),t.tabIndex=-1,this._refreshRowDimensions(t),t}_refreshRowsDimensions(){if(this._renderService.dimensions.css.cell.height){Object.assign(this._accessibilityContainer.style,{width:`${this._renderService.dimensions.css.canvas.width}px`,fontSize:`${this._terminal.options.fontSize}px`}),this._rowElements.length!==this._terminal.rows&&this._handleResize(this._terminal.rows);for(let t=0;t<this._terminal.rows;t++)this._refreshRowDimensions(this._rowElements[t]),this._alignRowWidth(this._rowElements[t])}}_refreshRowDimensions(t){t.style.height=`${this._renderService.dimensions.css.cell.height}px`}_alignRowWidth(t){t.style.transform="";let e=t.getBoundingClientRect().width,i=this._rowColumns.get(t)?.slice(-1)?.[0];if(!i)return;let n=i*this._renderService.dimensions.css.cell.width;t.style.transform=`scaleX(${n/e})`}};Zd=si([xe(1,Fg),xe(2,Gn),xe(3,Kn)],Zd);var mg=class extends nt{constructor(t,e,i,n,a){super(),this._element=t,this._mouseService=e,this._renderService=i,this._bufferService=n,this._linkProviderService=a,this._linkCacheDisposables=[],this._isMouseOut=!0,this._wasResized=!1,this._activeLine=-1,this._onShowLinkUnderline=this._register(new ve),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this._register(new ve),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this._register(jt(()=>{Uo(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(Ye(this._element,"mouseleave",()=>{this._isMouseOut=!0,this._clearCurrentLink()})),this._register(Ye(this._element,"mousemove",this._handleMouseMove.bind(this))),this._register(Ye(this._element,"mousedown",this._handleMouseDown.bind(this))),this._register(Ye(this._element,"mouseup",this._handleMouseUp.bind(this)))}get currentLink(){return this._currentLink}_handleMouseMove(t){this._lastMouseEvent=t;let e=this._positionFromMouseEvent(t,this._element,this._mouseService);if(!e)return;this._isMouseOut=!1;let i=t.composedPath();for(let n=0;n<i.length;n++){let a=i[n];if(a.classList.contains("xterm"))break;if(a.classList.contains("xterm-hover"))return}(!this._lastBufferCell||e.x!==this._lastBufferCell.x||e.y!==this._lastBufferCell.y)&&(this._handleHover(e),this._lastBufferCell=e)}_handleHover(t){if(this._activeLine!==t.y||this._wasResized){this._clearCurrentLink(),this._askForLink(t,!1),this._wasResized=!1;return}this._currentLink&&this._linkAtPosition(this._currentLink.link,t)||(this._clearCurrentLink(),this._askForLink(t,!0))}_askForLink(t,e){(!this._activeProviderReplies||!e)&&(this._activeProviderReplies?.forEach(n=>{n?.forEach(a=>{a.link.dispose&&a.link.dispose()})}),this._activeProviderReplies=new Map,this._activeLine=t.y);let i=!1;for(let[n,a]of this._linkProviderService.linkProviders.entries())e?this._activeProviderReplies?.get(n)&&(i=this._checkLinkProviderResult(n,t,i)):a.provideLinks(t.y,l=>{if(this._isMouseOut)return;let u=l?.map(h=>({link:h}));this._activeProviderReplies?.set(n,u),i=this._checkLinkProviderResult(n,t,i),this._activeProviderReplies?.size===this._linkProviderService.linkProviders.length&&this._removeIntersectingLinks(t.y,this._activeProviderReplies)})}_removeIntersectingLinks(t,e){let i=new Set;for(let n=0;n<e.size;n++){let a=e.get(n);if(a)for(let l=0;l<a.length;l++){let u=a[l],h=u.link.range.start.y<t?0:u.link.range.start.x,f=u.link.range.end.y>t?this._bufferService.cols:u.link.range.end.x;for(let d=h;d<=f;d++){if(i.has(d)){a.splice(l--,1);break}i.add(d)}}}}_checkLinkProviderResult(t,e,i){if(!this._activeProviderReplies)return i;let n=this._activeProviderReplies.get(t),a=!1;for(let l=0;l<t;l++)(!this._activeProviderReplies.has(l)||this._activeProviderReplies.get(l))&&(a=!0);if(!a&&n){let l=n.find(u=>this._linkAtPosition(u.link,e));l&&(i=!0,this._handleNewLink(l))}if(this._activeProviderReplies.size===this._linkProviderService.linkProviders.length&&!i)for(let l=0;l<this._activeProviderReplies.size;l++){let u=this._activeProviderReplies.get(l)?.find(h=>this._linkAtPosition(h.link,e));if(u){i=!0,this._handleNewLink(u);break}}return i}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(t){if(!this._currentLink)return;let e=this._positionFromMouseEvent(t,this._element,this._mouseService);e&&this._mouseDownLink&&XA(this._mouseDownLink.link,this._currentLink.link)&&this._linkAtPosition(this._currentLink.link,e)&&this._currentLink.link.activate(t,this._currentLink.link.text)}_clearCurrentLink(t,e){!this._currentLink||!this._lastMouseEvent||(!t||!e||this._currentLink.link.range.start.y>=t&&this._currentLink.link.range.end.y<=e)&&(this._linkLeave(this._element,this._currentLink.link,this._lastMouseEvent),this._currentLink=void 0,Uo(this._linkCacheDisposables),this._linkCacheDisposables.length=0)}_handleNewLink(t){if(!this._lastMouseEvent)return;let e=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);e&&this._linkAtPosition(t.link,e)&&(this._currentLink=t,this._currentLink.state={decorations:{underline:t.link.decorations===void 0?!0:t.link.decorations.underline,pointerCursor:t.link.decorations===void 0?!0:t.link.decorations.pointerCursor},isHovered:!0},this._linkHover(this._element,t.link,this._lastMouseEvent),t.link.decorations={},Object.defineProperties(t.link.decorations,{pointerCursor:{get:()=>this._currentLink?.state?.decorations.pointerCursor,set:i=>{this._currentLink?.state&&this._currentLink.state.decorations.pointerCursor!==i&&(this._currentLink.state.decorations.pointerCursor=i,this._currentLink.state.isHovered&&this._element.classList.toggle("xterm-cursor-pointer",i))}},underline:{get:()=>this._currentLink?.state?.decorations.underline,set:i=>{this._currentLink?.state&&this._currentLink?.state?.decorations.underline!==i&&(this._currentLink.state.decorations.underline=i,this._currentLink.state.isHovered&&this._fireUnderlineEvent(t.link,i))}}}),this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange(i=>{if(!this._currentLink)return;let n=i.start===0?0:i.start+1+this._bufferService.buffer.ydisp,a=this._bufferService.buffer.ydisp+1+i.end;if(this._currentLink.link.range.start.y>=n&&this._currentLink.link.range.end.y<=a&&(this._clearCurrentLink(n,a),this._lastMouseEvent)){let l=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);l&&this._askForLink(l,!1)}})))}_linkHover(t,e,i){this._currentLink?.state&&(this._currentLink.state.isHovered=!0,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(e,!0),this._currentLink.state.decorations.pointerCursor&&t.classList.add("xterm-cursor-pointer")),e.hover&&e.hover(i,e.text)}_fireUnderlineEvent(t,e){let i=t.range,n=this._bufferService.buffer.ydisp,a=this._createLinkUnderlineEvent(i.start.x-1,i.start.y-n-1,i.end.x,i.end.y-n-1,void 0);(e?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(a)}_linkLeave(t,e,i){this._currentLink?.state&&(this._currentLink.state.isHovered=!1,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(e,!1),this._currentLink.state.decorations.pointerCursor&&t.classList.remove("xterm-cursor-pointer")),e.leave&&e.leave(i,e.text)}_linkAtPosition(t,e){let i=t.range.start.y*this._bufferService.cols+t.range.start.x,n=t.range.end.y*this._bufferService.cols+t.range.end.x,a=e.y*this._bufferService.cols+e.x;return i<=a&&a<=n}_positionFromMouseEvent(t,e,i){let n=i.getCoords(t,e,this._bufferService.cols,this._bufferService.rows);if(n)return{x:n[0],y:n[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(t,e,i,n,a){return{x1:t,y1:e,x2:i,y2:n,cols:this._bufferService.cols,fg:a}}};mg=si([xe(1,$g),xe(2,Kn),xe(3,fs),xe(4,rC)],mg);function XA(t,e){return t.text===e.text&&t.range.start.x===e.range.start.x&&t.range.start.y===e.range.start.y&&t.range.end.x===e.range.end.x&&t.range.end.y===e.range.end.y}var ZA=class extends $A{constructor(e={}){super(e),this._linkifier=this._register(new Gl),this.browser=CC,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this._register(new Gl),this._onCursorMove=this._register(new ve),this.onCursorMove=this._onCursorMove.event,this._onKey=this._register(new ve),this.onKey=this._onKey.event,this._onRender=this._register(new ve),this.onRender=this._onRender.event,this._onSelectionChange=this._register(new ve),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this._register(new ve),this.onTitleChange=this._onTitleChange.event,this._onBell=this._register(new ve),this.onBell=this._onBell.event,this._onFocus=this._register(new ve),this._onBlur=this._register(new ve),this._onA11yCharEmitter=this._register(new ve),this._onA11yTabEmitter=this._register(new ve),this._onWillOpen=this._register(new ve),this._setup(),this._decorationService=this._instantiationService.createInstance(qA),this._instantiationService.setService(Nu,this._decorationService),this._linkProviderService=this._instantiationService.createInstance(UM),this._instantiationService.setService(rC,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(Np)),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(Qi.forward(this._inputHandler.onCursorMove,this._onCursorMove)),this._register(Qi.forward(this._inputHandler.onTitleChange,this._onTitleChange)),this._register(Qi.forward(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this._register(Qi.forward(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this._register(this._bufferService.onResize(i=>this._afterResize(i.cols,i.rows))),this._register(jt(()=>{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,a="";switch(i.index){case 256:n="foreground",a="10";break;case 257:n="background",a="11";break;case 258:n="cursor",a="12";break;default:n="ansi",a="4;"+i.index}switch(i.type){case 0:let l=Ht.toColorRGB(n==="ansi"?this._themeService.colors.ansi[i.index]:this._themeService.colors[n]);this.coreService.triggerDataEvent(`${le.ESC}]${a};${PA(l)}${bC.ST}`);break;case 1:if(n==="ansi")this._themeService.modifyColors(u=>u.ansi[i.index]=gi.toColor(...i.color));else{let u=n;this._themeService.modifyColors(h=>h[u]=gi.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(Zd,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(e){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(le.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(le.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),a=this._renderService.dimensions.css.cell.height,l=i.getWidth(n),u=this._renderService.dimensions.css.cell.width*l,h=this.buffer.y*this._renderService.dimensions.css.cell.height,f=n*this._renderService.dimensions.css.cell.width;this.textarea.style.left=f+"px",this.textarea.style.top=h+"px",this.textarea.style.width=u+"px",this.textarea.style.height=a+"px",this.textarea.style.lineHeight=a+"px",this.textarea.style.zIndex="-5"}_initGlobal(){this._bindKeys(),this._register(Ye(this.element,"copy",i=>{this.hasSelection()&&tR(i,this._selectionService)}));let e=i=>iR(i,this.textarea,this.coreService,this.optionsService);this._register(Ye(this.textarea,"paste",e)),this._register(Ye(this.element,"paste",e)),xC?this._register(Ye(this.element,"mousedown",i=>{i.button===2&&ub(i,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})):this._register(Ye(this.element,"contextmenu",i=>{ub(i,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})),Xg&&this._register(Ye(this.element,"auxclick",i=>{i.button===1&&Kw(i,this.textarea,this.screenElement)}))}_bindKeys(){this._register(Ye(this.textarea,"keyup",e=>this._keyUp(e),!0)),this._register(Ye(this.textarea,"keydown",e=>this._keyDown(e),!0)),this._register(Ye(this.textarea,"keypress",e=>this._keyPress(e),!0)),this._register(Ye(this.textarea,"compositionstart",()=>this._compositionHelper.compositionstart())),this._register(Ye(this.textarea,"compositionupdate",e=>this._compositionHelper.compositionupdate(e))),this._register(Ye(this.textarea,"compositionend",()=>this._compositionHelper.compositionend())),this._register(Ye(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(Ye(this.screenElement,"mousemove",l=>this.updateCursorStyle(l))),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",Dp.get()),TC||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(HM,this.textarea,e.ownerDocument.defaultView??window,this._document??typeof window<"u"?window.document:null)),this._instantiationService.setService(Gn,this._coreBrowserService),this._register(Ye(this.textarea,"focus",l=>this._handleTextAreaFocus(l))),this._register(Ye(this.textarea,"blur",()=>this._handleTextAreaBlur())),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(ig,this._document,this._helperContainer),this._instantiationService.setService(uf,this._charSizeService),this._themeService=this._instantiationService.createInstance(ag),this._instantiationService.setService(Zl,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(Gd),this._instantiationService.setService(sC,this._characterJoinerService),this._renderService=this._register(this._instantiationService.createInstance(rg,this.rows,this.screenElement)),this._instantiationService.setService(Kn,this._renderService),this._register(this._renderService.onRenderedViewportChange(l=>this._onRender.fire(l))),this.onResize(l=>this._renderService.resize(l.cols,l.rows)),this._compositionView=this._document.createElement("div"),this._compositionView.classList.add("composition-view"),this._compositionHelper=this._instantiationService.createInstance(Jp,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseService=this._instantiationService.createInstance(sg),this._instantiationService.setService($g,this._mouseService);let a=this._linkifier.value=this._register(this._instantiationService.createInstance(mg,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(Zp,this.element,this.screenElement)),this._register(this._viewport.onRequestScrollLines(l=>{super.scrollLines(l,!1),this.refresh(0,this.rows-1)})),this._selectionService=this._register(this._instantiationService.createInstance(ng,this.element,this.screenElement,a)),this._instantiationService.setService(uR,this._selectionService),this._register(this._selectionService.onRequestScrollLines(l=>this.scrollLines(l.amount,l.suppressScrollEvent))),this._register(this._selectionService.onSelectionChange(()=>this._onSelectionChange.fire())),this._register(this._selectionService.onRequestRedraw(l=>this._renderService.handleSelectionChanged(l.start,l.end,l.columnSelectMode))),this._register(this._selectionService.onLinuxMouseSelection(l=>{this.textarea.value=l,this.textarea.focus(),this.textarea.select()})),this._register(Qi.any(this._onScroll.event,this._inputHandler.onScroll)(()=>{this._selectionService.refresh(),this._viewport?.queueSync()})),this._register(this._instantiationService.createInstance(Qp,this.screenElement)),this._register(Ye(this.element,"mousedown",l=>this._selectionService.handleMouseDown(l))),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(Zd,this)),this._register(this.optionsService.onSpecificOptionChange("screenReaderMode",l=>this._handleScreenReaderModeOptionChange(l))),this.options.overviewRuler.width&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(Yd,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange("overviewRuler",l=>{!this._overviewRulerRenderer&&l&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(Yd,this._viewportElement,this.screenElement)))}),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()}_createRenderer(){return this._instantiationService.createInstance(tg,this,this._document,this.element,this.screenElement,this._viewportElement,this._helperContainer,this.linkifier)}bindMouse(){let e=this,i=this.element;function n(u){let h=e._mouseService.getMouseReportCoords(u,e.screenElement);if(!h)return!1;let f,d;switch(u.overrideType||u.type){case"mousemove":d=32,u.buttons===void 0?(f=3,u.button!==void 0&&(f=u.button<3?u.button:3)):f=u.buttons&1?0:u.buttons&4?1:u.buttons&2?2:3;break;case"mouseup":d=0,f=u.button<3?u.button:3;break;case"mousedown":d=1,f=u.button<3?u.button:3;break;case"wheel":if(e._customWheelEventHandler&&e._customWheelEventHandler(u)===!1)return!1;let g=u.deltaY;if(g===0||e.coreMouseService.consumeWheelEvent(u,e._renderService?.dimensions?.device?.cell?.height,e._coreBrowserService?.dpr)===0)return!1;d=g<0?0:1,f=4;break;default:return!1}return d===void 0||f===void 0||f>4?!1:e.coreMouseService.triggerMouseEvent({col:h.col,row:h.row,x:h.x,y:h.y,button:f,action:d,ctrl:u.ctrlKey,alt:u.altKey,shift:u.shiftKey})}let a={mouseup:null,wheel:null,mousedrag:null,mousemove:null},l={mouseup:u=>(n(u),u.buttons||(this._document.removeEventListener("mouseup",a.mouseup),a.mousedrag&&this._document.removeEventListener("mousemove",a.mousedrag)),this.cancel(u)),wheel:u=>(n(u),this.cancel(u,!0)),mousedrag:u=>{u.buttons&&n(u)},mousemove:u=>{u.buttons||n(u)}};this._register(this.coreMouseService.onProtocolChange(u=>{u?(this.optionsService.rawOptions.logLevel==="debug"&&this._logService.debug("Binding to mouse events:",this.coreMouseService.explainEvents(u)),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()),u&8?a.mousemove||(i.addEventListener("mousemove",l.mousemove),a.mousemove=l.mousemove):(i.removeEventListener("mousemove",a.mousemove),a.mousemove=null),u&16?a.wheel||(i.addEventListener("wheel",l.wheel,{passive:!1}),a.wheel=l.wheel):(i.removeEventListener("wheel",a.wheel),a.wheel=null),u&2?a.mouseup||(a.mouseup=l.mouseup):(this._document.removeEventListener("mouseup",a.mouseup),a.mouseup=null),u&4?a.mousedrag||(a.mousedrag=l.mousedrag):(this._document.removeEventListener("mousemove",a.mousedrag),a.mousedrag=null)})),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this._register(Ye(i,"mousedown",u=>{if(u.preventDefault(),this.focus(),!(!this.coreMouseService.areMouseEventsActive||this._selectionService.shouldForceSelection(u)))return n(u),a.mouseup&&this._document.addEventListener("mouseup",a.mouseup),a.mousedrag&&this._document.addEventListener("mousemove",a.mousedrag),this.cancel(u)})),this._register(Ye(i,"wheel",u=>{if(!a.wheel){if(this._customWheelEventHandler&&this._customWheelEventHandler(u)===!1)return!1;if(!this.buffer.hasScrollback){if(u.deltaY===0)return!1;if(e.coreMouseService.consumeWheelEvent(u,e._renderService?.dimensions?.device?.cell?.height,e._coreBrowserService?.dpr)===0)return this.cancel(u,!0);let h=le.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?"O":"[")+(u.deltaY<0?"A":"B");return this.coreService.triggerDataEvent(h,!0),this.cancel(u,!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){Gw(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=jA(e,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(e),n.type===3||n.type===2){let a=this.rows-1;return this.scrollLines(n.type===2?-a:a),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===le.ETX||n.key===le.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)&&(QA(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(_i));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(le.ESC+"[I"):this.coreService.triggerDataEvent(le.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(`${le.ESC}[4;${n};${i}t`);break;case 1:let a=this._renderService.dimensions.css.cell.width.toFixed(0),l=this._renderService.dimensions.css.cell.height.toFixed(0);this.coreService.triggerDataEvent(`${le.ESC}[6;${l};${a}t`);break}}cancel(e,i){if(!(!this.options.cancelEvents&&!i))return e.preventDefault(),e.stopPropagation(),!1}};function QA(t){return t.keyCode===16||t.keyCode===17||t.keyCode===18}var JA=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)}},eL=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 kr)}translateToString(e,i,n){return this._line.translateToString(e,i,n)}},t1=class{constructor(t,e){this._buffer=t,this.type=e}init(t){return this._buffer=t,this}get cursorY(){return this._buffer.y}get cursorX(){return this._buffer.x}get viewportY(){return this._buffer.ydisp}get baseY(){return this._buffer.ybase}get length(){return this._buffer.lines.length}getLine(t){let e=this._buffer.lines.get(t);if(e)return new eL(e)}getNullCell(){return new kr}},tL=class extends nt{constructor(t){super(),this._core=t,this._onBufferChange=this._register(new ve),this.onBufferChange=this._onBufferChange.event,this._normal=new t1(this._core.buffers.normal,"normal"),this._alternate=new t1(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)}},iL=class{constructor(t){this._core=t}registerCsiHandler(t,e){return this._core.registerCsiHandler(t,i=>e(i.toArray()))}addCsiHandler(t,e){return this.registerCsiHandler(t,e)}registerDcsHandler(t,e){return this._core.registerDcsHandler(t,(i,n)=>e(i,n.toArray()))}addDcsHandler(t,e){return this.registerDcsHandler(t,e)}registerEscHandler(t,e){return this._core.registerEscHandler(t,e)}addEscHandler(t,e){return this.registerEscHandler(t,e)}registerOscHandler(t,e){return this._core.registerOscHandler(t,e)}addOscHandler(t,e){return this.registerOscHandler(t,e)}},sL=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}},rL=["cols","rows"],Jr=0,nL=class extends nt{constructor(t){super(),this._core=this._register(new ZA(t)),this._addonManager=this._register(new JA),this._publicOptions={...this._core.options};let e=n=>this._core.options[n],i=(n,a)=>{this._checkReadonlyOptions(n),this._core.options[n]=a};for(let n in this._core.options){let a={get:e.bind(this,n),set:i.bind(this,n)};Object.defineProperty(this._publicOptions,n,a)}}_checkReadonlyOptions(t){if(rL.includes(t))throw new Error(`Option "${t}" can only be set in the constructor`)}_checkProposedApi(){if(!this._core.optionsService.rawOptions.allowProposedApi)throw new Error("You must set the allowProposedApi option to true to use proposed API")}get onBell(){return this._core.onBell}get onBinary(){return this._core.onBinary}get onCursorMove(){return this._core.onCursorMove}get onData(){return this._core.onData}get onKey(){return this._core.onKey}get onLineFeed(){return this._core.onLineFeed}get onRender(){return this._core.onRender}get onResize(){return this._core.onResize}get onScroll(){return this._core.onScroll}get onSelectionChange(){return this._core.onSelectionChange}get onTitleChange(){return this._core.onTitleChange}get onWriteParsed(){return this._core.onWriteParsed}get element(){return this._core.element}get parser(){return this._parser||(this._parser=new iL(this._core)),this._parser}get unicode(){return this._checkProposedApi(),new sL(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 tL(this._core))),this._buffer}get markers(){return this._checkProposedApi(),this._core.markers}get modes(){let t=this._core.coreService.decPrivateModes,e="none";switch(this._core.coreMouseService.activeProtocol){case"X10":e="x10";break;case"VT200":e="vt200";break;case"DRAG":e="drag";break;case"ANY":e="any";break}return{applicationCursorKeysMode:t.applicationCursorKeys,applicationKeypadMode:t.applicationKeypad,bracketedPasteMode:t.bracketedPasteMode,insertMode:this._core.coreService.modes.insertMode,mouseTrackingMode:e,originMode:t.origin,reverseWraparoundMode:t.reverseWraparound,sendFocusMode:t.sendFocus,synchronizedOutputMode:t.synchronizedOutput,wraparoundMode:t.wraparound}}get options(){return this._publicOptions}set options(t){for(let e in t)this._publicOptions[e]=t[e]}blur(){this._core.blur()}focus(){this._core.focus()}input(t,e=!0){this._core.input(t,e)}resize(t,e){this._verifyIntegers(t,e),this._core.resize(t,e)}open(t){this._core.open(t)}attachCustomKeyEventHandler(t){this._core.attachCustomKeyEventHandler(t)}attachCustomWheelEventHandler(t){this._core.attachCustomWheelEventHandler(t)}registerLinkProvider(t){return this._core.registerLinkProvider(t)}registerCharacterJoiner(t){return this._checkProposedApi(),this._core.registerCharacterJoiner(t)}deregisterCharacterJoiner(t){this._checkProposedApi(),this._core.deregisterCharacterJoiner(t)}registerMarker(t=0){return this._verifyIntegers(t),this._core.registerMarker(t)}registerDecoration(t){return this._checkProposedApi(),this._verifyPositiveIntegers(t.x??0,t.width??0,t.height??0),this._core.registerDecoration(t)}hasSelection(){return this._core.hasSelection()}select(t,e,i){this._verifyIntegers(t,e,i),this._core.select(t,e,i)}getSelection(){return this._core.getSelection()}getSelectionPosition(){return this._core.getSelectionPosition()}clearSelection(){this._core.clearSelection()}selectAll(){this._core.selectAll()}selectLines(t,e){this._verifyIntegers(t,e),this._core.selectLines(t,e)}dispose(){super.dispose()}scrollLines(t){this._verifyIntegers(t),this._core.scrollLines(t)}scrollPages(t){this._verifyIntegers(t),this._core.scrollPages(t)}scrollToTop(){this._core.scrollToTop()}scrollToBottom(){this._core.scrollToBottom()}scrollToLine(t){this._verifyIntegers(t),this._core.scrollToLine(t)}clear(){this._core.clear()}write(t,e){this._core.write(t,e)}writeln(t,e){this._core.write(t),this._core.write(`\r
24
+ `,e)}paste(t){this._core.paste(t)}refresh(t,e){this._verifyIntegers(t,e),this._core.refresh(t,e)}reset(){this._core.reset()}clearTextureAtlas(){this._core.clearTextureAtlas()}loadAddon(t){this._addonManager.loadAddon(this,t)}static get strings(){return{get promptLabel(){return Dp.get()},set promptLabel(t){Dp.set(t)},get tooMuchOutput(){return Op.get()},set tooMuchOutput(t){Op.set(t)}}}_verifyIntegers(...t){for(Jr of t)if(Jr===1/0||isNaN(Jr)||Jr%1!==0)throw new Error("This API only accepts integers")}_verifyPositiveIntegers(...t){for(Jr of t)if(Jr&&(Jr===1/0||isNaN(Jr)||Jr%1!==0||Jr<0))throw new Error("This API only accepts positive integers")}};var aL=2,oL=1,lL=class{activate(t){this._terminal=t}dispose(){}fit(){let t=this.proposeDimensions();if(!t||!this._terminal||isNaN(t.cols)||isNaN(t.rows))return;let e=this._terminal._core;(this._terminal.rows!==t.rows||this._terminal.cols!==t.cols)&&(e._renderService.clear(),this._terminal.resize(t.cols,t.rows))}proposeDimensions(){if(!this._terminal||!this._terminal.element||!this._terminal.element.parentElement)return;let t=this._terminal._core._renderService.dimensions;if(t.css.cell.width===0||t.css.cell.height===0)return;let e=this._terminal.options.scrollback===0?0:this._terminal.options.overviewRuler?.width||14,i=window.getComputedStyle(this._terminal.element.parentElement),n=parseInt(i.getPropertyValue("height")),a=Math.max(0,parseInt(i.getPropertyValue("width"))),l=window.getComputedStyle(this._terminal.element),u={top:parseInt(l.getPropertyValue("padding-top")),bottom:parseInt(l.getPropertyValue("padding-bottom")),right:parseInt(l.getPropertyValue("padding-right")),left:parseInt(l.getPropertyValue("padding-left"))},h=u.top+u.bottom,f=u.right+u.left,d=n-h,g=a-f-e;return{cols:Math.max(aL,Math.floor(g/t.css.cell.width)),rows:Math.max(oL,Math.floor(d/t.css.cell.height))}}};var cL=class{constructor(t,e,i,n={}){this._terminal=t,this._regex=e,this._handler=i,this._options=n}provideLinks(t,e){let i=hL.computeLink(t,this._regex,this._terminal,this._handler);e(this._addCallbacks(i))}_addCallbacks(t){return t.map(e=>(e.leave=this._options.leave,e.hover=(i,n)=>{if(this._options.hover){let{range:a}=e;this._options.hover(i,n,a)}},e))}};function uL(t){try{let e=new URL(t),i=e.password&&e.username?`${e.protocol}//${e.username}:${e.password}@${e.host}`:e.username?`${e.protocol}//${e.username}@${e.host}`:`${e.protocol}//${e.host}`;return t.toLocaleLowerCase().startsWith(i.toLocaleLowerCase())}catch{return!1}}var hL=class Td{static computeLink(e,i,n,a){let l=new RegExp(i.source,(i.flags||"")+"g"),[u,h]=Td._getWindowedLineStrings(e-1,n),f=u.join(""),d,g=[];for(;d=l.exec(f);){let v=d[0];if(!uL(v))continue;let[p,S]=Td._mapStrIdx(n,h,0,d.index),[y,C]=Td._mapStrIdx(n,p,S,v.length);if(p===-1||S===-1||y===-1||C===-1)continue;let x={start:{x:S+1,y:p+1},end:{x:C,y:y+1}};g.push({range:x,text:v,activate:a})}return g}static _getWindowedLineStrings(e,i){let n,a=e,l=e,u=0,h="",f=[];if(n=i.buffer.active.getLine(e)){let d=n.translateToString(!0);if(n.isWrapped&&d[0]!==" "){for(u=0;(n=i.buffer.active.getLine(--a))&&u<2048&&(h=n.translateToString(!0),u+=h.length,f.push(h),!(!n.isWrapped||h.indexOf(" ")!==-1)););f.reverse()}for(f.push(d),u=0;(n=i.buffer.active.getLine(++l))&&n.isWrapped&&u<2048&&(h=n.translateToString(!0),u+=h.length,f.push(h),h.indexOf(" ")===-1););}return[f,a]}static _mapStrIdx(e,i,n,a){let l=e.buffer.active,u=l.getNullCell(),h=n;for(;a;){let f=l.getLine(i);if(!f)return[-1,-1];for(let d=h;d<f.length;++d){f.getCell(d,u);let g=u.getChars();if(u.getWidth()&&(a-=g.length||1,d===f.length-1&&g==="")){let v=l.getLine(i+1);v&&v.isWrapped&&(v.getCell(0,u),u.getWidth()===2&&(a+=1))}if(a<0)return[i,d]}i++,h=0}return[i,h]}},dL=/(https?|HTTPS?):[/]{2}[^\s"'!*(){}|\\\^<>`]*[^\s"':,.!?{}|\\\^~\[\]`()<>]/;function fL(t,e){let i=window.open();if(i){try{i.opener=null}catch{}i.location.href=e}else console.warn("Opening link blocked as opener could not be cleared")}var mL=class{constructor(e=fL,i={}){this._handler=e,this._options=i}activate(e){this._terminal=e;let i=this._options,n=i.urlRegex||dL;this._linkProvider=this._terminal.registerLinkProvider(new cL(this._terminal,n,this._handler,i))}dispose(){this._linkProvider?.dispose()}};var _L=(t,e,i,n)=>{for(var a=e,l=t.length-1,u;l>=0;l--)(u=t[l])&&(a=u(a)||a);return a},pL=(t,e)=>(i,n)=>e(i,n,t),gL=class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(t){setTimeout(()=>{throw t.stack?i1.isErrorNoTelemetry(t)?new i1(t.message+`
25
+
26
+ `+t.stack):new Error(t.message+`
27
+
28
+ `+t.stack):t},0)}}addListener(t){return this.listeners.push(t),()=>{this._removeListener(t)}}emit(t){this.listeners.forEach(e=>{e(t)})}_removeListener(t){this.listeners.splice(this.listeners.indexOf(t),1)}setUnexpectedErrorHandler(t){this.unexpectedErrorHandler=t}getUnexpectedErrorHandler(){return this.unexpectedErrorHandler}onUnexpectedError(t){this.unexpectedErrorHandler(t),this.emit(t)}onUnexpectedExternalError(t){this.unexpectedErrorHandler(t)}},vL=new gL;function rp(t){SL(t)||vL.onUnexpectedError(t)}var _g="Canceled";function SL(t){return t instanceof yL?!0:t instanceof Error&&t.name===_g&&t.message===_g}var yL=class extends Error{constructor(){super(_g),this.name=this.message}},i1=class pg extends Error{constructor(e){super(e),this.name="CodeExpectedError"}static fromError(e){if(e instanceof pg)return e;let i=new pg;return i.message=e.message,i.stack=e.stack,i}static isErrorNoTelemetry(e){return e.name==="CodeExpectedError"}},bL;(t=>{function e(l){return l<0}t.isLessThan=e;function i(l){return l<=0}t.isLessThanOrEqual=i;function n(l){return l>0}t.isGreaterThan=n;function a(l){return l===0}t.isNeitherLessOrGreaterThan=a,t.greaterThan=1,t.lessThan=-1,t.neitherLessOrGreaterThan=0})(bL||={});function wL(t,e){let i=this,n=!1,a;return function(){return n||(n=!0,e||(a=t.apply(i,arguments))),a}}var zC;(t=>{function e(T){return T&&typeof T=="object"&&typeof T[Symbol.iterator]=="function"}t.is=e;let i=Object.freeze([]);function n(){return i}t.empty=n;function*a(T){yield T}t.single=a;function l(T){return e(T)?T:a(T)}t.wrap=l;function u(T){return T||i}t.from=u;function*h(T){for(let W=T.length-1;W>=0;W--)yield T[W]}t.reverse=h;function f(T){return!T||T[Symbol.iterator]().next().done===!0}t.isEmpty=f;function d(T){return T[Symbol.iterator]().next().value}t.first=d;function g(T,W){let D=0;for(let I of T)if(W(I,D++))return!0;return!1}t.some=g;function v(T,W){for(let D of T)if(W(D))return D}t.find=v;function*p(T,W){for(let D of T)W(D)&&(yield D)}t.filter=p;function*S(T,W){let D=0;for(let I of T)yield W(I,D++)}t.map=S;function*y(T,W){let D=0;for(let I of T)yield*W(I,D++)}t.flatMap=y;function*C(...T){for(let W of T)yield*W}t.concat=C;function x(T,W,D){let I=D;for(let H of T)I=W(I,H);return I}t.reduce=x;function*R(T,W,D=T.length){for(W<0&&(W+=T.length),D<0?D+=T.length:D>T.length&&(D=T.length);W<D;W++)yield T[W]}t.slice=R;function L(T,W=Number.POSITIVE_INFINITY){let D=[];if(W===0)return[D,T];let I=T[Symbol.iterator]();for(let H=0;H<W;H++){let V=I.next();if(V.done)return[D,t.empty()];D.push(V.value)}return[D,{[Symbol.iterator](){return I}}]}t.consume=L;async function N(T){let W=[];for await(let D of T)W.push(D);return Promise.resolve(W)}t.asyncToArray=N})(zC||={});function HC(t){if(zC.is(t)){let e=[];for(let i of t)if(i)try{i.dispose()}catch(n){e.push(n)}if(e.length===1)throw e[0];if(e.length>1)throw new AggregateError(e,"Encountered errors while disposing of store");return Array.isArray(t)?[]:t}else if(t)return t.dispose(),t}function IC(...t){return rs(()=>HC(t))}function rs(t){return{dispose:wL(()=>{t()})}}var UC=class FC{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{HC(this._toDispose)}finally{this._toDispose.clear()}}add(e){if(!e)return e;if(e===this)throw new Error("Cannot register a disposable on itself!");return this._isDisposed?FC.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(e),e}delete(e){if(e){if(e===this)throw new Error("Cannot dispose a disposable on itself!");this._toDispose.delete(e),e.dispose()}}deleteAndLeak(e){e&&this._toDispose.has(e)&&(this._toDispose.delete(e),void 0)}};UC.DISABLE_DISPOSED_WARNING=!1;var jl=UC,Ur=class{constructor(){this._store=new jl,this._store}dispose(){this._store.dispose()}_register(e){if(e===this)throw new Error("Cannot register a disposable on itself!");return this._store.add(e)}};Ur.None=Object.freeze({dispose(){}});var lu=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(t){this._isDisposed||t===this._value||(this._value?.dispose(),this._value=t)}clear(){this.value=void 0}dispose(){this._isDisposed=!0,this._value?.dispose(),this._value=void 0}clearAndLeak(){let t=this._value;return this._value=void 0,t}},Zg=typeof process<"u"&&"title"in process,ff=Zg?"node":navigator.userAgent,CL=Zg?"node":navigator.platform,xL=ff.includes("Firefox"),kL=ff.includes("Edge"),$C=/^((?!chrome|android).)*safari/i.test(ff);function EL(){if(!$C)return 0;let t=ff.match(/Version\/(\d+)/);return t===null||t.length<2?0:parseInt(t[1])}CL.indexOf("Linux")>=0;var TL="",Pi=0,zi=0,Hi=0,ii=0,Sr={css:"#00000000",rgba:0},ds;(t=>{function e(a,l,u,h){return h!==void 0?`#${ko(a)}${ko(l)}${ko(u)}${ko(h)}`:`#${ko(a)}${ko(l)}${ko(u)}`}t.toCss=e;function i(a,l,u,h=255){return(a<<24|l<<16|u<<8|h)>>>0}t.toRgba=i;function n(a,l,u,h){return{css:t.toCss(a,l,u,h),rgba:t.toRgba(a,l,u,h)}}t.toColor=n})(ds||={});var yu;(t=>{function e(f,d){if(ii=(d.rgba&255)/255,ii===1)return{css:d.css,rgba:d.rgba};let g=d.rgba>>24&255,v=d.rgba>>16&255,p=d.rgba>>8&255,S=f.rgba>>24&255,y=f.rgba>>16&255,C=f.rgba>>8&255;Pi=S+Math.round((g-S)*ii),zi=y+Math.round((v-y)*ii),Hi=C+Math.round((p-C)*ii);let x=ds.toCss(Pi,zi,Hi),R=ds.toRgba(Pi,zi,Hi);return{css:x,rgba:R}}t.blend=e;function i(f){return(f.rgba&255)===255}t.isOpaque=i;function n(f,d,g){let v=No.ensureContrastRatio(f.rgba,d.rgba,g);if(v)return ds.toColor(v>>24&255,v>>16&255,v>>8&255)}t.ensureContrastRatio=n;function a(f){let d=(f.rgba|255)>>>0;return[Pi,zi,Hi]=No.toChannels(d),{css:ds.toCss(Pi,zi,Hi),rgba:d}}t.opaque=a;function l(f,d){return ii=Math.round(d*255),[Pi,zi,Hi]=No.toChannels(f.rgba),{css:ds.toCss(Pi,zi,Hi,ii),rgba:ds.toRgba(Pi,zi,Hi,ii)}}t.opacity=l;function u(f,d){return ii=f.rgba&255,l(f,ii*d/255)}t.multiplyOpacity=u;function h(f){return[f.rgba>>24&255,f.rgba>>16&255,f.rgba>>8&255]}t.toColorRGB=h})(yu||={});var RL;(t=>{let e,i;try{let a=document.createElement("canvas");a.width=1,a.height=1;let l=a.getContext("2d",{willReadFrequently:!0});l&&(e=l,e.globalCompositeOperation="copy",i=e.createLinearGradient(0,0,1,1))}catch{}function n(a){if(a.match(/#[\da-f]{3,8}/i))switch(a.length){case 4:return Pi=parseInt(a.slice(1,2).repeat(2),16),zi=parseInt(a.slice(2,3).repeat(2),16),Hi=parseInt(a.slice(3,4).repeat(2),16),ds.toColor(Pi,zi,Hi);case 5:return Pi=parseInt(a.slice(1,2).repeat(2),16),zi=parseInt(a.slice(2,3).repeat(2),16),Hi=parseInt(a.slice(3,4).repeat(2),16),ii=parseInt(a.slice(4,5).repeat(2),16),ds.toColor(Pi,zi,Hi,ii);case 7:return{css:a,rgba:(parseInt(a.slice(1),16)<<8|255)>>>0};case 9:return{css:a,rgba:parseInt(a.slice(1),16)>>>0}}let l=a.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(l)return Pi=parseInt(l[1]),zi=parseInt(l[2]),Hi=parseInt(l[3]),ii=Math.round((l[5]===void 0?1:parseFloat(l[5]))*255),ds.toColor(Pi,zi,Hi,ii);if(!e||!i)throw new Error("css.toColor: Unsupported css format");if(e.fillStyle=i,e.fillStyle=a,typeof e.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(e.fillRect(0,0,1,1),[Pi,zi,Hi,ii]=e.getImageData(0,0,1,1).data,ii!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:ds.toRgba(Pi,zi,Hi,ii),css:a}}t.toColor=n})(RL||={});var hs;(t=>{function e(n){return i(n>>16&255,n>>8&255,n&255)}t.relativeLuminance=e;function i(n,a,l){let u=n/255,h=a/255,f=l/255,d=u<=.03928?u/12.92:Math.pow((u+.055)/1.055,2.4),g=h<=.03928?h/12.92:Math.pow((h+.055)/1.055,2.4),v=f<=.03928?f/12.92:Math.pow((f+.055)/1.055,2.4);return d*.2126+g*.7152+v*.0722}t.relativeLuminance2=i})(hs||={});var No;(t=>{function e(u,h){if(ii=(h&255)/255,ii===1)return h;let f=h>>24&255,d=h>>16&255,g=h>>8&255,v=u>>24&255,p=u>>16&255,S=u>>8&255;return Pi=v+Math.round((f-v)*ii),zi=p+Math.round((d-p)*ii),Hi=S+Math.round((g-S)*ii),ds.toRgba(Pi,zi,Hi)}t.blend=e;function i(u,h,f){let d=hs.relativeLuminance(u>>8),g=hs.relativeLuminance(h>>8);if(Pn(d,g)<f){if(g<d){let S=n(u,h,f),y=Pn(d,hs.relativeLuminance(S>>8));if(y<f){let C=a(u,h,f),x=Pn(d,hs.relativeLuminance(C>>8));return y>x?S:C}return S}let v=a(u,h,f),p=Pn(d,hs.relativeLuminance(v>>8));if(p<f){let S=n(u,h,f),y=Pn(d,hs.relativeLuminance(S>>8));return p>y?v:S}return v}}t.ensureContrastRatio=i;function n(u,h,f){let d=u>>24&255,g=u>>16&255,v=u>>8&255,p=h>>24&255,S=h>>16&255,y=h>>8&255,C=Pn(hs.relativeLuminance2(p,S,y),hs.relativeLuminance2(d,g,v));for(;C<f&&(p>0||S>0||y>0);)p-=Math.max(0,Math.ceil(p*.1)),S-=Math.max(0,Math.ceil(S*.1)),y-=Math.max(0,Math.ceil(y*.1)),C=Pn(hs.relativeLuminance2(p,S,y),hs.relativeLuminance2(d,g,v));return(p<<24|S<<16|y<<8|255)>>>0}t.reduceLuminance=n;function a(u,h,f){let d=u>>24&255,g=u>>16&255,v=u>>8&255,p=h>>24&255,S=h>>16&255,y=h>>8&255,C=Pn(hs.relativeLuminance2(p,S,y),hs.relativeLuminance2(d,g,v));for(;C<f&&(p<255||S<255||y<255);)p=Math.min(255,p+Math.ceil((255-p)*.1)),S=Math.min(255,S+Math.ceil((255-S)*.1)),y=Math.min(255,y+Math.ceil((255-y)*.1)),C=Pn(hs.relativeLuminance2(p,S,y),hs.relativeLuminance2(d,g,v));return(p<<24|S<<16|y<<8|255)>>>0}t.increaseLuminance=a;function l(u){return[u>>24&255,u>>16&255,u>>8&255,u&255]}t.toChannels=l})(No||={});function ko(t){let e=t.toString(16);return e.length<2?"0"+e:e}function Pn(t,e){return t<e?(e+.05)/(t+.05):(t+.05)/(e+.05)}function pi(t){if(!t)throw new Error("value must not be falsy");return t}function Qg(t){return 57508<=t&&t<=57558}function ML(t){return 57520<=t&&t<=57527}function AL(t){return 57344<=t&&t<=63743}function LL(t){return 9472<=t&&t<=9631}function DL(t){return t>=128512&&t<=128591||t>=127744&&t<=128511||t>=128640&&t<=128767||t>=9728&&t<=9983||t>=9984&&t<=10175||t>=65024&&t<=65039||t>=129280&&t<=129535||t>=127462&&t<=127487}function OL(t,e,i,n){return e===1&&i>Math.ceil(n*1.5)&&t!==void 0&&t>255&&!DL(t)&&!Qg(t)&&!AL(t)}function WC(t){return Qg(t)||LL(t)}function BL(){return{css:{canvas:cd(),cell:cd()},device:{canvas:cd(),cell:cd(),char:{width:0,height:0,left:0,top:0}}}}function cd(){return{width:0,height:0}}function NL(t,e,i=0){return(t-(Math.round(e)*2-i))%(Math.round(e)*2)}var Xi=0,Li=0,en=!1,zn=!1,ud=!1,xs,np=0,PL=class{constructor(t,e,i,n,a,l){this._terminal=t,this._optionService=e,this._selectionRenderModel=i,this._decorationService=n,this._coreBrowserService=a,this._themeService=l,this.result={fg:0,bg:0,ext:0}}resolve(t,e,i,n){if(this.result.bg=t.bg,this.result.fg=t.fg,this.result.ext=t.bg&268435456?t.extended.ext:0,Li=0,Xi=0,zn=!1,en=!1,ud=!1,xs=this._themeService.colors,np=0,t.getCode()!==0&&t.extended.underlineStyle===4){let a=Math.max(1,Math.floor(this._optionService.rawOptions.fontSize*this._coreBrowserService.dpr/15));np=e*n%(Math.round(a)*2)}if(this._decorationService.forEachDecorationAtCell(e,i,"bottom",a=>{a.backgroundColorRGB&&(Li=a.backgroundColorRGB.rgba>>8&16777215,zn=!0),a.foregroundColorRGB&&(Xi=a.foregroundColorRGB.rgba>>8&16777215,en=!0)}),ud=this._selectionRenderModel.isCellSelected(this._terminal,e,i),ud){if(this.result.fg&67108864||(this.result.bg&50331648)!==0){if(this.result.fg&67108864)switch(this.result.fg&50331648){case 16777216:case 33554432:Li=this._themeService.colors.ansi[this.result.fg&255].rgba;break;case 50331648:Li=(this.result.fg&16777215)<<8|255;break;default:Li=this._themeService.colors.foreground.rgba}else switch(this.result.bg&50331648){case 16777216:case 33554432:Li=this._themeService.colors.ansi[this.result.bg&255].rgba;break;case 50331648:Li=(this.result.bg&16777215)<<8|255;break}Li=No.blend(Li,(this._coreBrowserService.isFocused?xs.selectionBackgroundOpaque:xs.selectionInactiveBackgroundOpaque).rgba&4294967040|128)>>8&16777215}else Li=(this._coreBrowserService.isFocused?xs.selectionBackgroundOpaque:xs.selectionInactiveBackgroundOpaque).rgba>>8&16777215;if(zn=!0,xs.selectionForeground&&(Xi=xs.selectionForeground.rgba>>8&16777215,en=!0),WC(t.getCode())){if(this.result.fg&67108864&&(this.result.bg&50331648)===0)Xi=(this._coreBrowserService.isFocused?xs.selectionBackgroundOpaque:xs.selectionInactiveBackgroundOpaque).rgba>>8&16777215;else{if(this.result.fg&67108864)switch(this.result.bg&50331648){case 16777216:case 33554432:Xi=this._themeService.colors.ansi[this.result.bg&255].rgba;break;case 50331648:Xi=(this.result.bg&16777215)<<8|255;break}else switch(this.result.fg&50331648){case 16777216:case 33554432:Xi=this._themeService.colors.ansi[this.result.fg&255].rgba;break;case 50331648:Xi=(this.result.fg&16777215)<<8|255;break;default:Xi=this._themeService.colors.foreground.rgba}Xi=No.blend(Xi,(this._coreBrowserService.isFocused?xs.selectionBackgroundOpaque:xs.selectionInactiveBackgroundOpaque).rgba&4294967040|128)>>8&16777215}en=!0}}this._decorationService.forEachDecorationAtCell(e,i,"top",a=>{a.backgroundColorRGB&&(Li=a.backgroundColorRGB.rgba>>8&16777215,zn=!0),a.foregroundColorRGB&&(Xi=a.foregroundColorRGB.rgba>>8&16777215,en=!0)}),zn&&(ud?Li=t.bg&-16777216&-134217729|Li|50331648:Li=t.bg&-16777216|Li|50331648),en&&(Xi=t.fg&-16777216&-67108865|Xi|50331648),this.result.fg&67108864&&(zn&&!en&&((this.result.bg&50331648)===0?Xi=this.result.fg&-134217728|xs.background.rgba>>8&16777215&16777215|50331648:Xi=this.result.fg&-134217728|this.result.bg&67108863,en=!0),!zn&&en&&((this.result.fg&50331648)===0?Li=this.result.bg&-67108864|xs.foreground.rgba>>8&16777215&16777215|50331648:Li=this.result.bg&-67108864|this.result.fg&67108863,zn=!0)),xs=void 0,this.result.bg=zn?Li:this.result.bg,this.result.fg=en?Xi:this.result.fg,this.result.ext&=536870911,this.result.ext|=np<<29&3758096384}},zL=.5,jC=xL||kL?"bottom":"ideographic",HL={"▀":[{x:0,y:0,w:8,h:4}],"▁":[{x:0,y:7,w:8,h:1}],"▂":[{x:0,y:6,w:8,h:2}],"▃":[{x:0,y:5,w:8,h:3}],"▄":[{x:0,y:4,w:8,h:4}],"▅":[{x:0,y:3,w:8,h:5}],"▆":[{x:0,y:2,w:8,h:6}],"▇":[{x:0,y:1,w:8,h:7}],"█":[{x:0,y:0,w:8,h:8}],"▉":[{x:0,y:0,w:7,h:8}],"▊":[{x:0,y:0,w:6,h:8}],"▋":[{x:0,y:0,w:5,h:8}],"▌":[{x:0,y:0,w:4,h:8}],"▍":[{x:0,y:0,w:3,h:8}],"▎":[{x:0,y:0,w:2,h:8}],"▏":[{x:0,y:0,w:1,h:8}],"▐":[{x:4,y:0,w:4,h:8}],"▔":[{x:0,y:0,w:8,h:1}],"▕":[{x:7,y:0,w:1,h:8}],"▖":[{x:0,y:4,w:4,h:4}],"▗":[{x:4,y:4,w:4,h:4}],"▘":[{x:0,y:0,w:4,h:4}],"▙":[{x:0,y:0,w:4,h:8},{x:0,y:4,w:8,h:4}],"▚":[{x:0,y:0,w:4,h:4},{x:4,y:4,w:4,h:4}],"▛":[{x:0,y:0,w:4,h:8},{x:4,y:0,w:4,h:4}],"▜":[{x:0,y:0,w:8,h:4},{x:4,y:0,w:4,h:8}],"▝":[{x:4,y:0,w:4,h:4}],"▞":[{x:4,y:0,w:4,h:4},{x:0,y:4,w:4,h:4}],"▟":[{x:4,y:0,w:4,h:8},{x:0,y:4,w:8,h:4}],"🭰":[{x:1,y:0,w:1,h:8}],"🭱":[{x:2,y:0,w:1,h:8}],"🭲":[{x:3,y:0,w:1,h:8}],"🭳":[{x:4,y:0,w:1,h:8}],"🭴":[{x:5,y:0,w:1,h:8}],"🭵":[{x:6,y:0,w:1,h:8}],"🭶":[{x:0,y:1,w:8,h:1}],"🭷":[{x:0,y:2,w:8,h:1}],"🭸":[{x:0,y:3,w:8,h:1}],"🭹":[{x:0,y:4,w:8,h:1}],"🭺":[{x:0,y:5,w:8,h:1}],"🭻":[{x:0,y:6,w:8,h:1}],"🭼":[{x:0,y:0,w:1,h:8},{x:0,y:7,w:8,h:1}],"🭽":[{x:0,y:0,w:1,h:8},{x:0,y:0,w:8,h:1}],"🭾":[{x:7,y:0,w:1,h:8},{x:0,y:0,w:8,h:1}],"🭿":[{x:7,y:0,w:1,h:8},{x:0,y:7,w:8,h:1}],"🮀":[{x:0,y:0,w:8,h:1},{x:0,y:7,w:8,h:1}],"🮁":[{x:0,y:0,w:8,h:1},{x:0,y:2,w:8,h:1},{x:0,y:4,w:8,h:1},{x:0,y:7,w:8,h:1}],"🮂":[{x:0,y:0,w:8,h:2}],"🮃":[{x:0,y:0,w:8,h:3}],"🮄":[{x:0,y:0,w:8,h:5}],"🮅":[{x:0,y:0,w:8,h:6}],"🮆":[{x:0,y:0,w:8,h:7}],"🮇":[{x:6,y:0,w:2,h:8}],"🮈":[{x:5,y:0,w:3,h:8}],"🮉":[{x:3,y:0,w:5,h:8}],"🮊":[{x:2,y:0,w:6,h:8}],"🮋":[{x:1,y:0,w:7,h:8}],"🮕":[{x:0,y:0,w:2,h:2},{x:4,y:0,w:2,h:2},{x:2,y:2,w:2,h:2},{x:6,y:2,w:2,h:2},{x:0,y:4,w:2,h:2},{x:4,y:4,w:2,h:2},{x:2,y:6,w:2,h:2},{x:6,y:6,w:2,h:2}],"🮖":[{x:2,y:0,w:2,h:2},{x:6,y:0,w:2,h:2},{x:0,y:2,w:2,h:2},{x:4,y:2,w:2,h:2},{x:2,y:4,w:2,h:2},{x:6,y:4,w:2,h:2},{x:0,y:6,w:2,h:2},{x:4,y:6,w:2,h:2}],"🮗":[{x:0,y:2,w:8,h:2},{x:0,y:6,w:8,h:2}]},IL={"░":[[1,0,0,0],[0,0,0,0],[0,0,1,0],[0,0,0,0]],"▒":[[1,0],[0,0],[0,1],[0,0]],"▓":[[0,1],[1,1],[1,0],[1,1]]},UL={"─":{1:"M0,.5 L1,.5"},"━":{3:"M0,.5 L1,.5"},"│":{1:"M.5,0 L.5,1"},"┃":{3:"M.5,0 L.5,1"},"┌":{1:"M0.5,1 L.5,.5 L1,.5"},"┏":{3:"M0.5,1 L.5,.5 L1,.5"},"┐":{1:"M0,.5 L.5,.5 L.5,1"},"┓":{3:"M0,.5 L.5,.5 L.5,1"},"└":{1:"M.5,0 L.5,.5 L1,.5"},"┗":{3:"M.5,0 L.5,.5 L1,.5"},"┘":{1:"M.5,0 L.5,.5 L0,.5"},"┛":{3:"M.5,0 L.5,.5 L0,.5"},"├":{1:"M.5,0 L.5,1 M.5,.5 L1,.5"},"┣":{3:"M.5,0 L.5,1 M.5,.5 L1,.5"},"┤":{1:"M.5,0 L.5,1 M.5,.5 L0,.5"},"┫":{3:"M.5,0 L.5,1 M.5,.5 L0,.5"},"┬":{1:"M0,.5 L1,.5 M.5,.5 L.5,1"},"┳":{3:"M0,.5 L1,.5 M.5,.5 L.5,1"},"┴":{1:"M0,.5 L1,.5 M.5,.5 L.5,0"},"┻":{3:"M0,.5 L1,.5 M.5,.5 L.5,0"},"┼":{1:"M0,.5 L1,.5 M.5,0 L.5,1"},"╋":{3:"M0,.5 L1,.5 M.5,0 L.5,1"},"╴":{1:"M.5,.5 L0,.5"},"╸":{3:"M.5,.5 L0,.5"},"╵":{1:"M.5,.5 L.5,0"},"╹":{3:"M.5,.5 L.5,0"},"╶":{1:"M.5,.5 L1,.5"},"╺":{3:"M.5,.5 L1,.5"},"╷":{1:"M.5,.5 L.5,1"},"╻":{3:"M.5,.5 L.5,1"},"═":{1:(t,e)=>`M0,${.5-e} L1,${.5-e} M0,${.5+e} L1,${.5+e}`},"║":{1:(t,e)=>`M${.5-t},0 L${.5-t},1 M${.5+t},0 L${.5+t},1`},"╒":{1:(t,e)=>`M.5,1 L.5,${.5-e} L1,${.5-e} M.5,${.5+e} L1,${.5+e}`},"╓":{1:(t,e)=>`M${.5-t},1 L${.5-t},.5 L1,.5 M${.5+t},.5 L${.5+t},1`},"╔":{1:(t,e)=>`M1,${.5-e} L${.5-t},${.5-e} L${.5-t},1 M1,${.5+e} L${.5+t},${.5+e} L${.5+t},1`},"╕":{1:(t,e)=>`M0,${.5-e} L.5,${.5-e} L.5,1 M0,${.5+e} L.5,${.5+e}`},"╖":{1:(t,e)=>`M${.5+t},1 L${.5+t},.5 L0,.5 M${.5-t},.5 L${.5-t},1`},"╗":{1:(t,e)=>`M0,${.5+e} L${.5-t},${.5+e} L${.5-t},1 M0,${.5-e} L${.5+t},${.5-e} L${.5+t},1`},"╘":{1:(t,e)=>`M.5,0 L.5,${.5+e} L1,${.5+e} M.5,${.5-e} L1,${.5-e}`},"╙":{1:(t,e)=>`M1,.5 L${.5-t},.5 L${.5-t},0 M${.5+t},.5 L${.5+t},0`},"╚":{1:(t,e)=>`M1,${.5-e} L${.5+t},${.5-e} L${.5+t},0 M1,${.5+e} L${.5-t},${.5+e} L${.5-t},0`},"╛":{1:(t,e)=>`M0,${.5+e} L.5,${.5+e} L.5,0 M0,${.5-e} L.5,${.5-e}`},"╜":{1:(t,e)=>`M0,.5 L${.5+t},.5 L${.5+t},0 M${.5-t},.5 L${.5-t},0`},"╝":{1:(t,e)=>`M0,${.5-e} L${.5-t},${.5-e} L${.5-t},0 M0,${.5+e} L${.5+t},${.5+e} L${.5+t},0`},"╞":{1:(t,e)=>`M.5,0 L.5,1 M.5,${.5-e} L1,${.5-e} M.5,${.5+e} L1,${.5+e}`},"╟":{1:(t,e)=>`M${.5-t},0 L${.5-t},1 M${.5+t},0 L${.5+t},1 M${.5+t},.5 L1,.5`},"╠":{1:(t,e)=>`M${.5-t},0 L${.5-t},1 M1,${.5+e} L${.5+t},${.5+e} L${.5+t},1 M1,${.5-e} L${.5+t},${.5-e} L${.5+t},0`},"╡":{1:(t,e)=>`M.5,0 L.5,1 M0,${.5-e} L.5,${.5-e} M0,${.5+e} L.5,${.5+e}`},"╢":{1:(t,e)=>`M0,.5 L${.5-t},.5 M${.5-t},0 L${.5-t},1 M${.5+t},0 L${.5+t},1`},"╣":{1:(t,e)=>`M${.5+t},0 L${.5+t},1 M0,${.5+e} L${.5-t},${.5+e} L${.5-t},1 M0,${.5-e} L${.5-t},${.5-e} L${.5-t},0`},"╤":{1:(t,e)=>`M0,${.5-e} L1,${.5-e} M0,${.5+e} L1,${.5+e} M.5,${.5+e} L.5,1`},"╥":{1:(t,e)=>`M0,.5 L1,.5 M${.5-t},.5 L${.5-t},1 M${.5+t},.5 L${.5+t},1`},"╦":{1:(t,e)=>`M0,${.5-e} L1,${.5-e} M0,${.5+e} L${.5-t},${.5+e} L${.5-t},1 M1,${.5+e} L${.5+t},${.5+e} L${.5+t},1`},"╧":{1:(t,e)=>`M.5,0 L.5,${.5-e} M0,${.5-e} L1,${.5-e} M0,${.5+e} L1,${.5+e}`},"╨":{1:(t,e)=>`M0,.5 L1,.5 M${.5-t},.5 L${.5-t},0 M${.5+t},.5 L${.5+t},0`},"╩":{1:(t,e)=>`M0,${.5+e} L1,${.5+e} M0,${.5-e} L${.5-t},${.5-e} L${.5-t},0 M1,${.5-e} L${.5+t},${.5-e} L${.5+t},0`},"╪":{1:(t,e)=>`M.5,0 L.5,1 M0,${.5-e} L1,${.5-e} M0,${.5+e} L1,${.5+e}`},"╫":{1:(t,e)=>`M0,.5 L1,.5 M${.5-t},0 L${.5-t},1 M${.5+t},0 L${.5+t},1`},"╬":{1:(t,e)=>`M0,${.5+e} L${.5-t},${.5+e} L${.5-t},1 M1,${.5+e} L${.5+t},${.5+e} L${.5+t},1 M0,${.5-e} L${.5-t},${.5-e} L${.5-t},0 M1,${.5-e} L${.5+t},${.5-e} L${.5+t},0`},"╱":{1:"M1,0 L0,1"},"╲":{1:"M0,0 L1,1"},"╳":{1:"M1,0 L0,1 M0,0 L1,1"},"╼":{1:"M.5,.5 L0,.5",3:"M.5,.5 L1,.5"},"╽":{1:"M.5,.5 L.5,0",3:"M.5,.5 L.5,1"},"╾":{1:"M.5,.5 L1,.5",3:"M.5,.5 L0,.5"},"╿":{1:"M.5,.5 L.5,1",3:"M.5,.5 L.5,0"},"┍":{1:"M.5,.5 L.5,1",3:"M.5,.5 L1,.5"},"┎":{1:"M.5,.5 L1,.5",3:"M.5,.5 L.5,1"},"┑":{1:"M.5,.5 L.5,1",3:"M.5,.5 L0,.5"},"┒":{1:"M.5,.5 L0,.5",3:"M.5,.5 L.5,1"},"┕":{1:"M.5,.5 L.5,0",3:"M.5,.5 L1,.5"},"┖":{1:"M.5,.5 L1,.5",3:"M.5,.5 L.5,0"},"┙":{1:"M.5,.5 L.5,0",3:"M.5,.5 L0,.5"},"┚":{1:"M.5,.5 L0,.5",3:"M.5,.5 L.5,0"},"┝":{1:"M.5,0 L.5,1",3:"M.5,.5 L1,.5"},"┞":{1:"M0.5,1 L.5,.5 L1,.5",3:"M.5,.5 L.5,0"},"┟":{1:"M.5,0 L.5,.5 L1,.5",3:"M.5,.5 L.5,1"},"┠":{1:"M.5,.5 L1,.5",3:"M.5,0 L.5,1"},"┡":{1:"M.5,.5 L.5,1",3:"M.5,0 L.5,.5 L1,.5"},"┢":{1:"M.5,.5 L.5,0",3:"M0.5,1 L.5,.5 L1,.5"},"┥":{1:"M.5,0 L.5,1",3:"M.5,.5 L0,.5"},"┦":{1:"M0,.5 L.5,.5 L.5,1",3:"M.5,.5 L.5,0"},"┧":{1:"M.5,0 L.5,.5 L0,.5",3:"M.5,.5 L.5,1"},"┨":{1:"M.5,.5 L0,.5",3:"M.5,0 L.5,1"},"┩":{1:"M.5,.5 L.5,1",3:"M.5,0 L.5,.5 L0,.5"},"┪":{1:"M.5,.5 L.5,0",3:"M0,.5 L.5,.5 L.5,1"},"┭":{1:"M0.5,1 L.5,.5 L1,.5",3:"M.5,.5 L0,.5"},"┮":{1:"M0,.5 L.5,.5 L.5,1",3:"M.5,.5 L1,.5"},"┯":{1:"M.5,.5 L.5,1",3:"M0,.5 L1,.5"},"┰":{1:"M0,.5 L1,.5",3:"M.5,.5 L.5,1"},"┱":{1:"M.5,.5 L1,.5",3:"M0,.5 L.5,.5 L.5,1"},"┲":{1:"M.5,.5 L0,.5",3:"M0.5,1 L.5,.5 L1,.5"},"┵":{1:"M.5,0 L.5,.5 L1,.5",3:"M.5,.5 L0,.5"},"┶":{1:"M.5,0 L.5,.5 L0,.5",3:"M.5,.5 L1,.5"},"┷":{1:"M.5,.5 L.5,0",3:"M0,.5 L1,.5"},"┸":{1:"M0,.5 L1,.5",3:"M.5,.5 L.5,0"},"┹":{1:"M.5,.5 L1,.5",3:"M.5,0 L.5,.5 L0,.5"},"┺":{1:"M.5,.5 L0,.5",3:"M.5,0 L.5,.5 L1,.5"},"┽":{1:"M.5,0 L.5,1 M.5,.5 L1,.5",3:"M.5,.5 L0,.5"},"┾":{1:"M.5,0 L.5,1 M.5,.5 L0,.5",3:"M.5,.5 L1,.5"},"┿":{1:"M.5,0 L.5,1",3:"M0,.5 L1,.5"},"╀":{1:"M0,.5 L1,.5 M.5,.5 L.5,1",3:"M.5,.5 L.5,0"},"╁":{1:"M.5,.5 L.5,0 M0,.5 L1,.5",3:"M.5,.5 L.5,1"},"╂":{1:"M0,.5 L1,.5",3:"M.5,0 L.5,1"},"╃":{1:"M0.5,1 L.5,.5 L1,.5",3:"M.5,0 L.5,.5 L0,.5"},"╄":{1:"M0,.5 L.5,.5 L.5,1",3:"M.5,0 L.5,.5 L1,.5"},"╅":{1:"M.5,0 L.5,.5 L1,.5",3:"M0,.5 L.5,.5 L.5,1"},"╆":{1:"M.5,0 L.5,.5 L0,.5",3:"M0.5,1 L.5,.5 L1,.5"},"╇":{1:"M.5,.5 L.5,1",3:"M.5,.5 L.5,0 M0,.5 L1,.5"},"╈":{1:"M.5,.5 L.5,0",3:"M0,.5 L1,.5 M.5,.5 L.5,1"},"╉":{1:"M.5,.5 L1,.5",3:"M.5,0 L.5,1 M.5,.5 L0,.5"},"╊":{1:"M.5,.5 L0,.5",3:"M.5,0 L.5,1 M.5,.5 L1,.5"},"╌":{1:"M.1,.5 L.4,.5 M.6,.5 L.9,.5"},"╍":{3:"M.1,.5 L.4,.5 M.6,.5 L.9,.5"},"┄":{1:"M.0667,.5 L.2667,.5 M.4,.5 L.6,.5 M.7333,.5 L.9333,.5"},"┅":{3:"M.0667,.5 L.2667,.5 M.4,.5 L.6,.5 M.7333,.5 L.9333,.5"},"┈":{1:"M.05,.5 L.2,.5 M.3,.5 L.45,.5 M.55,.5 L.7,.5 M.8,.5 L.95,.5"},"┉":{3:"M.05,.5 L.2,.5 M.3,.5 L.45,.5 M.55,.5 L.7,.5 M.8,.5 L.95,.5"},"╎":{1:"M.5,.1 L.5,.4 M.5,.6 L.5,.9"},"╏":{3:"M.5,.1 L.5,.4 M.5,.6 L.5,.9"},"┆":{1:"M.5,.0667 L.5,.2667 M.5,.4 L.5,.6 M.5,.7333 L.5,.9333"},"┇":{3:"M.5,.0667 L.5,.2667 M.5,.4 L.5,.6 M.5,.7333 L.5,.9333"},"┊":{1:"M.5,.05 L.5,.2 M.5,.3 L.5,.45 L.5,.55 M.5,.7 L.5,.95"},"┋":{3:"M.5,.05 L.5,.2 M.5,.3 L.5,.45 L.5,.55 M.5,.7 L.5,.95"},"╭":{1:(t,e)=>`M.5,1 L.5,${.5+e/.15*.5} C.5,${.5+e/.15*.5},.5,.5,1,.5`},"╮":{1:(t,e)=>`M.5,1 L.5,${.5+e/.15*.5} C.5,${.5+e/.15*.5},.5,.5,0,.5`},"╯":{1:(t,e)=>`M.5,0 L.5,${.5-e/.15*.5} C.5,${.5-e/.15*.5},.5,.5,0,.5`},"╰":{1:(t,e)=>`M.5,0 L.5,${.5-e/.15*.5} C.5,${.5-e/.15*.5},.5,.5,1,.5`}},Lu={"":{d:"M.3,1 L.03,1 L.03,.88 C.03,.82,.06,.78,.11,.73 C.15,.7,.2,.68,.28,.65 L.43,.6 C.49,.58,.53,.56,.56,.53 C.59,.5,.6,.47,.6,.43 L.6,.27 L.4,.27 L.69,.1 L.98,.27 L.78,.27 L.78,.46 C.78,.52,.76,.56,.72,.61 C.68,.66,.63,.67,.56,.7 L.48,.72 C.42,.74,.38,.76,.35,.78 C.32,.8,.31,.84,.31,.88 L.31,1 M.3,.5 L.03,.59 L.03,.09 L.3,.09 L.3,.655",type:0},"":{d:"M.7,.4 L.7,.47 L.2,.47 L.2,.03 L.355,.03 L.355,.4 L.705,.4 M.7,.5 L.86,.5 L.86,.95 L.69,.95 L.44,.66 L.46,.86 L.46,.95 L.3,.95 L.3,.49 L.46,.49 L.71,.78 L.69,.565 L.69,.5",type:0},"":{d:"M.25,.94 C.16,.94,.11,.92,.11,.87 L.11,.53 C.11,.48,.15,.455,.23,.45 L.23,.3 C.23,.25,.26,.22,.31,.19 C.36,.16,.43,.15,.51,.15 C.59,.15,.66,.16,.71,.19 C.77,.22,.79,.26,.79,.3 L.79,.45 C.87,.45,.91,.48,.91,.53 L.91,.87 C.91,.92,.86,.94,.77,.94 L.24,.94 M.53,.2 C.49,.2,.45,.21,.42,.23 C.39,.25,.38,.27,.38,.3 L.38,.45 L.68,.45 L.68,.3 C.68,.27,.67,.25,.64,.23 C.61,.21,.58,.2,.53,.2 M.58,.82 L.58,.66 C.63,.65,.65,.63,.65,.6 C.65,.58,.64,.57,.61,.56 C.58,.55,.56,.54,.52,.54 C.48,.54,.46,.55,.43,.56 C.4,.57,.39,.59,.39,.6 C.39,.63,.41,.64,.46,.66 L.46,.82 L.57,.82",type:0},"":{d:"M0,0 L1,.5 L0,1",type:0,rightPadding:2},"":{d:"M-1,-.5 L1,.5 L-1,1.5",type:1,leftPadding:1,rightPadding:1},"":{d:"M1,0 L0,.5 L1,1",type:0,leftPadding:2},"":{d:"M2,-.5 L0,.5 L2,1.5",type:1,leftPadding:1,rightPadding:1},"":{d:"M0,0 L0,1 C0.552,1,1,0.776,1,.5 C1,0.224,0.552,0,0,0",type:0,rightPadding:1},"":{d:"M.2,1 C.422,1,.8,.826,.78,.5 C.8,.174,0.422,0,.2,0",type:1,rightPadding:1},"":{d:"M1,0 L1,1 C0.448,1,0,0.776,0,.5 C0,0.224,0.448,0,1,0",type:0,leftPadding:1},"":{d:"M.8,1 C0.578,1,0.2,.826,.22,.5 C0.2,0.174,0.578,0,0.8,0",type:1,leftPadding:1},"":{d:"M-.5,-.5 L1.5,1.5 L-.5,1.5",type:0},"":{d:"M-.5,-.5 L1.5,1.5",type:1,leftPadding:1,rightPadding:1},"":{d:"M1.5,-.5 L-.5,1.5 L1.5,1.5",type:0},"":{d:"M1.5,-.5 L-.5,1.5 L-.5,-.5",type:0},"":{d:"M1.5,-.5 L-.5,1.5",type:1,leftPadding:1,rightPadding:1},"":{d:"M-.5,-.5 L1.5,1.5 L1.5,-.5",type:0}};Lu[""]=Lu[""];Lu[""]=Lu[""];function FL(t,e,i,n,a,l,u,h){let f=HL[e];if(f)return $L(t,f,i,n,a,l),!0;let d=IL[e];if(d)return WL(t,d,i,n,a,l),!0;let g=UL[e];if(g)return jL(t,g,i,n,a,l,h),!0;let v=Lu[e];return v?(VL(t,v,i,n,a,l,u,h),!0):!1}function $L(t,e,i,n,a,l){for(let u=0;u<e.length;u++){let h=e[u],f=a/8,d=l/8;t.fillRect(i+h.x*f,n+h.y*d,h.w*f,h.h*d)}}var s1=new Map;function WL(t,e,i,n,a,l){let u=s1.get(e);u||(u=new Map,s1.set(e,u));let h=t.fillStyle;if(typeof h!="string")throw new Error(`Unexpected fillStyle type "${h}"`);let f=u.get(h);if(!f){let d=e[0].length,g=e.length,v=t.canvas.ownerDocument.createElement("canvas");v.width=d,v.height=g;let p=pi(v.getContext("2d")),S=new ImageData(d,g),y,C,x,R;if(h.startsWith("#"))y=parseInt(h.slice(1,3),16),C=parseInt(h.slice(3,5),16),x=parseInt(h.slice(5,7),16),R=h.length>7&&parseInt(h.slice(7,9),16)||1;else if(h.startsWith("rgba"))[y,C,x,R]=h.substring(5,h.length-1).split(",").map(L=>parseFloat(L));else throw new Error(`Unexpected fillStyle color format "${h}" when drawing pattern glyph`);for(let L=0;L<g;L++)for(let N=0;N<d;N++)S.data[(L*d+N)*4]=y,S.data[(L*d+N)*4+1]=C,S.data[(L*d+N)*4+2]=x,S.data[(L*d+N)*4+3]=e[L][N]*(R*255);p.putImageData(S,0,0),f=pi(t.createPattern(v,null)),u.set(h,f)}t.fillStyle=f,t.fillRect(i,n,a,l)}function jL(t,e,i,n,a,l,u){t.strokeStyle=t.fillStyle;for(let[h,f]of Object.entries(e)){t.beginPath(),t.lineWidth=u*Number.parseInt(h);let d;if(typeof f=="function"){let g=.15/l*a;d=f(.15,g)}else d=f;for(let g of d.split(" ")){let v=g[0],p=VC[v];if(!p){console.error(`Could not find drawing instructions for "${v}"`);continue}let S=g.substring(1).split(",");!S[0]||!S[1]||p(t,qC(S,a,l,i,n,!0,u))}t.stroke(),t.closePath()}}function VL(t,e,i,n,a,l,u,h){let f=new Path2D;f.rect(i,n,a,l),t.clip(f),t.beginPath();let d=u/12;t.lineWidth=h*d;for(let g of e.d.split(" ")){let v=g[0],p=VC[v];if(!p){console.error(`Could not find drawing instructions for "${v}"`);continue}let S=g.substring(1).split(",");!S[0]||!S[1]||p(t,qC(S,a,l,i,n,!1,h,(e.leftPadding??0)*(d/2),(e.rightPadding??0)*(d/2)))}e.type===1?(t.strokeStyle=t.fillStyle,t.stroke()):t.fill(),t.closePath()}function r1(t,e,i=0){return Math.max(Math.min(t,e),i)}var VC={C:(t,e)=>t.bezierCurveTo(e[0],e[1],e[2],e[3],e[4],e[5]),L:(t,e)=>t.lineTo(e[0],e[1]),M:(t,e)=>t.moveTo(e[0],e[1])};function qC(t,e,i,n,a,l,u,h=0,f=0){let d=t.map(g=>parseFloat(g)||parseInt(g));if(d.length<2)throw new Error("Too few arguments for instruction");for(let g=0;g<d.length;g+=2)d[g]*=e-h*u-f*u,l&&d[g]!==0&&(d[g]=r1(Math.round(d[g]+.5)-.5,e,0)),d[g]+=n+h*u;for(let g=1;g<d.length;g+=2)d[g]*=i,l&&d[g]!==0&&(d[g]=r1(Math.round(d[g]+.5)-.5,i,0)),d[g]+=a;return d}var n1=class{constructor(){this._data={}}set(t,e,i){this._data[t]||(this._data[t]={}),this._data[t][e]=i}get(t,e){return this._data[t]?this._data[t][e]:void 0}clear(){this._data={}}},a1=class{constructor(){this._data=new n1}set(e,i,n,a,l){this._data.get(e,i)||this._data.set(e,i,new n1),this._data.get(e,i).set(n,a,l)}get(e,i,n,a){return this._data.get(e,i)?.get(n,a)}clear(){this._data.clear()}},YC=class{constructor(){this._tasks=[],this._i=0}enqueue(t){this._tasks.push(t),this._start()}flush(){for(;this._i<this._tasks.length;)this._tasks[this._i]()||this._i++;this.clear()}clear(){this._idleCallback&&(this._cancelCallback(this._idleCallback),this._idleCallback=void 0),this._i=0,this._tasks.length=0}_start(){this._idleCallback||(this._idleCallback=this._requestCallback(this._process.bind(this)))}_process(t){this._idleCallback=void 0;let e=0,i=0,n=t.timeRemaining(),a=0;for(;this._i<this._tasks.length;){if(e=performance.now(),this._tasks[this._i]()||this._i++,e=Math.max(1,performance.now()-e),i=Math.max(e,i),a=t.timeRemaining(),i*1.5>a){n-e<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(n-e))}ms`),this._start();return}n=a}this.clear()}},qL=class extends YC{_requestCallback(t){return setTimeout(()=>t(this._createDeadline(16)))}_cancelCallback(t){clearTimeout(t)}_createDeadline(t){let e=performance.now()+t;return{timeRemaining:()=>Math.max(0,e-performance.now())}}},YL=class extends YC{_requestCallback(t){return requestIdleCallback(t)}_cancelCallback(t){cancelIdleCallback(t)}},GL=!Zg&&"requestIdleCallback"in window?YL:qL,Il=class GC{constructor(){this.fg=0,this.bg=0,this.extended=new KC}static toColorRGB(e){return[e>>>16&255,e>>>8&255,e&255]}static fromColorRGB(e){return(e[0]&255)<<16|(e[1]&255)<<8|e[2]&255}clone(){let e=new GC;return e.fg=this.fg,e.bg=this.bg,e.extended=this.extended.clone(),e}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}},KC=class XC{constructor(e=0,i=0){this._ext=0,this._urlId=0,this._ext=e,this._urlId=i}get ext(){return this._urlId?this._ext&-469762049|this.underlineStyle<<26:this._ext}set ext(e){this._ext=e}get underlineStyle(){return this._urlId?5:(this._ext&469762048)>>26}set underlineStyle(e){this._ext&=-469762049,this._ext|=e<<26&469762048}get underlineColor(){return this._ext&67108863}set underlineColor(e){this._ext&=-67108864,this._ext|=e&67108863}get urlId(){return this._urlId}set urlId(e){this._urlId=e}get underlineVariantOffset(){let e=(this._ext&3758096384)>>29;return e<0?e^4294967288:e}set underlineVariantOffset(e){this._ext&=536870911,this._ext|=e<<29&3758096384}clone(){return new XC(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}},KL=globalThis.performance&&typeof globalThis.performance.now=="function",XL=class ZC{static create(e){return new ZC(e)}constructor(e){this._now=KL&&e===!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}},Vn;(t=>{t.None=()=>Ur.None;function e(A,O){return v(A,()=>{},0,void 0,!0,void 0,O)}t.defer=e;function i(A){return(O,P=null,$)=>{let E=!1,M;return M=A(z=>{if(!E)return M?M.dispose():E=!0,O.call(P,z)},null,$),E&&M.dispose(),M}}t.once=i;function n(A,O,P){return d(($,E=null,M)=>A(z=>$.call(E,O(z)),null,M),P)}t.map=n;function a(A,O,P){return d(($,E=null,M)=>A(z=>{O(z),$.call(E,z)},null,M),P)}t.forEach=a;function l(A,O,P){return d(($,E=null,M)=>A(z=>O(z)&&$.call(E,z),null,M),P)}t.filter=l;function u(A){return A}t.signal=u;function h(...A){return(O,P=null,$)=>{let E=IC(...A.map(M=>M(z=>O.call(P,z))));return g(E,$)}}t.any=h;function f(A,O,P,$){let E=P;return n(A,M=>(E=O(E,M),E),$)}t.reduce=f;function d(A,O){let P,$={onWillAddFirstListener(){P=A(E.fire,E)},onDidRemoveLastListener(){P?.dispose()}},E=new It($);return O?.add(E),E.event}function g(A,O){return O instanceof Array?O.push(A):O&&O.add(A),A}function v(A,O,P=100,$=!1,E=!1,M,z){let q,G,B,K=0,te,ne={leakWarningThreshold:M,onWillAddFirstListener(){q=A(ue=>{K++,G=O(G,ue),$&&!B&&(de.fire(G),G=void 0),te=()=>{let he=G;G=void 0,B=void 0,(!$||K>1)&&de.fire(he),K=0},typeof P=="number"?(clearTimeout(B),B=setTimeout(te,P)):B===void 0&&(B=0,queueMicrotask(te))})},onWillRemoveListener(){E&&K>0&&te?.()},onDidRemoveLastListener(){te=void 0,q.dispose()}},de=new It(ne);return z?.add(de),de.event}t.debounce=v;function p(A,O=0,P){return t.debounce(A,($,E)=>$?($.push(E),$):[E],O,void 0,!0,void 0,P)}t.accumulate=p;function S(A,O=($,E)=>$===E,P){let $=!0,E;return l(A,M=>{let z=$||!O(M,E);return $=!1,E=M,z},P)}t.latch=S;function y(A,O,P){return[t.filter(A,O,P),t.filter(A,$=>!O($),P)]}t.split=y;function C(A,O=!1,P=[],$){let E=P.slice(),M=A(G=>{E?E.push(G):q.fire(G)});$&&$.add(M);let z=()=>{E?.forEach(G=>q.fire(G)),E=null},q=new It({onWillAddFirstListener(){M||(M=A(G=>q.fire(G)),$&&$.add(M))},onDidAddFirstListener(){E&&(O?setTimeout(z):z())},onDidRemoveLastListener(){M&&M.dispose(),M=null}});return $&&$.add(q),q.event}t.buffer=C;function x(A,O){return(P,$,E)=>{let M=O(new L);return A(function(z){let q=M.evaluate(z);q!==R&&P.call($,q)},void 0,E)}}t.chain=x;let R=Symbol("HaltChainable");class L{constructor(){this.steps=[]}map(O){return this.steps.push(O),this}forEach(O){return this.steps.push(P=>(O(P),P)),this}filter(O){return this.steps.push(P=>O(P)?P:R),this}reduce(O,P){let $=P;return this.steps.push(E=>($=O($,E),$)),this}latch(O=(P,$)=>P===$){let P=!0,$;return this.steps.push(E=>{let M=P||!O(E,$);return P=!1,$=E,M?E:R}),this}evaluate(O){for(let P of this.steps)if(O=P(O),O===R)break;return O}}function N(A,O,P=$=>$){let $=(...q)=>z.fire(P(...q)),E=()=>A.on(O,$),M=()=>A.removeListener(O,$),z=new It({onWillAddFirstListener:E,onDidRemoveLastListener:M});return z.event}t.fromNodeEventEmitter=N;function T(A,O,P=$=>$){let $=(...q)=>z.fire(P(...q)),E=()=>A.addEventListener(O,$),M=()=>A.removeEventListener(O,$),z=new It({onWillAddFirstListener:E,onDidRemoveLastListener:M});return z.event}t.fromDOMEventEmitter=T;function W(A){return new Promise(O=>i(A)(O))}t.toPromise=W;function D(A){let O=new It;return A.then(P=>{O.fire(P)},()=>{O.fire(void 0)}).finally(()=>{O.dispose()}),O.event}t.fromPromise=D;function I(A,O){return A(P=>O.fire(P))}t.forward=I;function H(A,O,P){return O(P),A($=>O($))}t.runAndSubscribe=H;class V{constructor(O,P){this._observable=O,this._counter=0,this._hasChanged=!1;let $={onWillAddFirstListener:()=>{O.addObserver(this)},onDidRemoveLastListener:()=>{O.removeObserver(this)}};this.emitter=new It($),P&&P.add(this.emitter)}beginUpdate(O){this._counter++}handlePossibleChange(O){}handleChange(O,P){this._hasChanged=!0}endUpdate(O){this._counter--,this._counter===0&&(this._observable.reportChanges(),this._hasChanged&&(this._hasChanged=!1,this.emitter.fire(this._observable.get())))}}function se(A,O){return new V(A,O).emitter.event}t.fromObservable=se;function Q(A){return(O,P,$)=>{let E=0,M=!1,z={beginUpdate(){E++},endUpdate(){E--,E===0&&(A.reportChanges(),M&&(M=!1,O.call(P)))},handlePossibleChange(){},handleChange(){M=!0}};A.addObserver(z),A.reportChanges();let q={dispose(){A.removeObserver(z)}};return $ instanceof jl?$.add(q):Array.isArray($)&&$.push(q),q}}t.fromObservableLight=Q})(Vn||={});var gg=class vg{constructor(e){this.listenerCount=0,this.invocationCount=0,this.elapsedOverall=0,this.durations=[],this.name=`${e}_${vg._idPool++}`,vg.all.add(this)}start(e){this._stopWatch=new XL,this.listenerCount=e}stop(){if(this._stopWatch){let e=this._stopWatch.elapsed();this.durations.push(e),this.elapsedOverall+=e,this.invocationCount+=1,this._stopWatch=void 0}}};gg.all=new Set,gg._idPool=0;var ZL=gg,QL=-1,QC=class JC{constructor(e,i,n=(JC._idPool++).toString(16).padStart(3,"0")){this._errorHandler=e,this.threshold=i,this.name=n,this._warnCountdown=0}dispose(){this._stacks?.clear()}check(e,i){let n=this.threshold;if(n<=0||i<n)return;this._stacks||(this._stacks=new Map);let a=this._stacks.get(e.value)||0;if(this._stacks.set(e.value,a+1),this._warnCountdown-=1,this._warnCountdown<=0){this._warnCountdown=n*.5;let[l,u]=this.getMostFrequentStack(),h=`[${this.name}] potential listener LEAK detected, having ${i} listeners already. MOST frequent listener (${u}):`;console.warn(h),console.warn(l);let f=new t3(h,l);this._errorHandler(f)}return()=>{let l=this._stacks.get(e.value)||0;this._stacks.set(e.value,l-1)}}getMostFrequentStack(){if(!this._stacks)return;let e,i=0;for(let[n,a]of this._stacks)(!e||i<a)&&(e=[n,a],i=a);return e}};QC._idPool=1;var JL=QC,e3=class ex{constructor(e){this.value=e}static create(){let e=new Error;return new ex(e.stack??"")}print(){console.warn(this.value.split(`
29
+ `).slice(2).join(`
30
+ `))}},t3=class extends Error{constructor(t,e){super(t),this.name="ListenerLeakError",this.stack=e}},i3=class extends Error{constructor(t,e){super(t),this.name="ListenerRefusalError",this.stack=e}},s3=0,ap=class{constructor(t){this.value=t,this.id=s3++}},r3=2,n3,It=class{constructor(e){this._size=0,this._options=e,this._leakageMon=this._options?.leakWarningThreshold?new JL(e?.onListenerError??rp,this._options?.leakWarningThreshold??QL):void 0,this._perfMon=this._options?._profName?new ZL(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??=(e,i,n)=>{if(this._leakageMon&&this._size>this._leakageMon.threshold**2){let h=`[${this._leakageMon.name}] REFUSES to accept new listeners because it exceeded its threshold by far (${this._size} vs ${this._leakageMon.threshold})`;console.warn(h);let f=this._leakageMon.getMostFrequentStack()??["UNKNOWN stack",-1],d=new i3(`${h}. HINT: Stack shows most frequent listener (${f[1]}-times)`,f[0]);return(this._options?.onListenerError||rp)(d),Ur.None}if(this._disposed)return Ur.None;i&&(e=e.bind(i));let a=new ap(e),l;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(a.stack=e3.create(),l=this._leakageMon.check(a.stack,this._size+1)),this._listeners?this._listeners instanceof ap?(this._deliveryQueue??=new a3,this._listeners=[this._listeners,a]):this._listeners.push(a):(this._options?.onWillAddFirstListener?.(this),this._listeners=a,this._options?.onDidAddFirstListener?.(this)),this._size++;let u=rs(()=>{l?.(),this._removeListener(a)});return n instanceof jl?n.add(u):Array.isArray(n)&&n.push(u),u},this._event}_removeListener(e){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 i=this._listeners,n=i.indexOf(e);if(n===-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--,i[n]=void 0;let a=this._deliveryQueue.current===this;if(this._size*r3<=i.length){let l=0;for(let u=0;u<i.length;u++)i[u]?i[l++]=i[u]:a&&(this._deliveryQueue.end--,l<this._deliveryQueue.i&&this._deliveryQueue.i--);i.length=l}}_deliver(e,i){if(!e)return;let n=this._options?.onListenerError||rp;if(!n){e.value(i);return}try{e.value(i)}catch(a){n(a)}}_deliverQueue(e){let i=e.current._listeners;for(;e.i<e.end;)this._deliver(i[e.i++],e.value);e.reset()}fire(e){if(this._deliveryQueue?.current&&(this._deliverQueue(this._deliveryQueue),this._perfMon?.stop()),this._perfMon?.start(this._size),this._listeners)if(this._listeners instanceof ap)this._deliver(this._listeners,e);else{let i=this._deliveryQueue;i.enqueue(this,e,this._listeners.length),this._deliverQueue(i)}this._perfMon?.stop()}hasListeners(){return this._size>0}},a3=class{constructor(){this.i=-1,this.end=0}enqueue(t,e,i){this.i=0,this.end=i,this.current=t,this.value=e}reset(){this.i=this.end,this.current=void 0,this.value=void 0}},o1={texturePage:0,texturePosition:{x:0,y:0},texturePositionClipSpace:{x:0,y:0},offset:{x:0,y:0},size:{x:0,y:0},sizeClipSpace:{x:0,y:0}},cu=2,uu,Pa=class Pl{constructor(e,i,n){this._document=e,this._config=i,this._unicodeService=n,this._didWarmUp=!1,this._cacheMap=new a1,this._cacheMapCombined=new a1,this._pages=[],this._activePages=[],this._workBoundingBox={top:0,left:0,bottom:0,right:0},this._workAttributeData=new Il,this._textureSize=512,this._onAddTextureAtlasCanvas=new It,this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=new It,this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._requestClearModel=!1,this._createNewPage(),this._tmpCanvas=tx(e,this._config.deviceCellWidth*4+cu*2,this._config.deviceCellHeight+cu*2),this._tmpCtx=pi(this._tmpCanvas.getContext("2d",{alpha:this._config.allowTransparency,willReadFrequently:!0}))}get pages(){return this._pages}dispose(){this._tmpCanvas.remove();for(let e of this.pages)e.canvas.remove();this._onAddTextureAtlasCanvas.dispose()}warmUp(){this._didWarmUp||(this._doWarmUp(),this._didWarmUp=!0)}_doWarmUp(){let e=new GL;for(let i=33;i<126;i++)e.enqueue(()=>{if(!this._cacheMap.get(i,0,0,0)){let n=this._drawToCache(i,0,0,0,!1,void 0);this._cacheMap.set(i,0,0,0,n)}})}beginFrame(){return this._requestClearModel}clearTexture(){if(!(this._pages[0].currentRow.x===0&&this._pages[0].currentRow.y===0)){for(let e of this._pages)e.clear();this._cacheMap.clear(),this._cacheMapCombined.clear(),this._didWarmUp=!1}}_createNewPage(){if(Pl.maxAtlasPages&&this._pages.length>=Math.max(4,Pl.maxAtlasPages)){let i=this._pages.filter(d=>d.canvas.width*2<=(Pl.maxTextureSize||4096)).sort((d,g)=>g.canvas.width!==d.canvas.width?g.canvas.width-d.canvas.width:g.percentageUsed-d.percentageUsed),n=-1,a=0;for(let d=0;d<i.length;d++)if(i[d].canvas.width!==a)n=d,a=i[d].canvas.width;else if(d-n===3)break;let l=i.slice(n,n+4),u=l.map(d=>d.glyphs[0].texturePage).sort((d,g)=>d>g?1:-1),h=this.pages.length-l.length,f=this._mergePages(l,h);f.version++;for(let d=u.length-1;d>=0;d--)this._deletePage(u[d]);this.pages.push(f),this._requestClearModel=!0,this._onAddTextureAtlasCanvas.fire(f.canvas)}let e=new op(this._document,this._textureSize);return this._pages.push(e),this._activePages.push(e),this._onAddTextureAtlasCanvas.fire(e.canvas),e}_mergePages(e,i){let n=e[0].canvas.width*2,a=new op(this._document,n,e);for(let[l,u]of e.entries()){let h=l*u.canvas.width%n,f=Math.floor(l/2)*u.canvas.height;a.ctx.drawImage(u.canvas,h,f);for(let g of u.glyphs)g.texturePage=i,g.sizeClipSpace.x=g.size.x/n,g.sizeClipSpace.y=g.size.y/n,g.texturePosition.x+=h,g.texturePosition.y+=f,g.texturePositionClipSpace.x=g.texturePosition.x/n,g.texturePositionClipSpace.y=g.texturePosition.y/n;this._onRemoveTextureAtlasCanvas.fire(u.canvas);let d=this._activePages.indexOf(u);d!==-1&&this._activePages.splice(d,1)}return a}_deletePage(e){this._pages.splice(e,1);for(let i=e;i<this._pages.length;i++){let n=this._pages[i];for(let a of n.glyphs)a.texturePage--;n.version++}}getRasterizedGlyphCombinedChar(e,i,n,a,l,u){return this._getFromCacheMap(this._cacheMapCombined,e,i,n,a,l,u)}getRasterizedGlyph(e,i,n,a,l,u){return this._getFromCacheMap(this._cacheMap,e,i,n,a,l,u)}_getFromCacheMap(e,i,n,a,l,u,h){return uu=e.get(i,n,a,l),uu||(uu=this._drawToCache(i,n,a,l,u,h),e.set(i,n,a,l,uu)),uu}_getColorFromAnsiIndex(e){if(e>=this._config.colors.ansi.length)throw new Error("No color found for idx "+e);return this._config.colors.ansi[e]}_getBackgroundColor(e,i,n,a){if(this._config.allowTransparency)return Sr;let l;switch(e){case 16777216:case 33554432:l=this._getColorFromAnsiIndex(i);break;case 50331648:let u=Il.toColorRGB(i);l=ds.toColor(u[0],u[1],u[2]);break;default:n?l=yu.opaque(this._config.colors.foreground):l=this._config.colors.background;break}return this._config.allowTransparency||(l=yu.opaque(l)),l}_getForegroundColor(e,i,n,a,l,u,h,f,d,g){let v=this._getMinimumContrastColor(e,i,n,a,l,u,h,d,f,g);if(v)return v;let p;switch(l){case 16777216:case 33554432:this._config.drawBoldTextInBrightColors&&d&&u<8&&(u+=8),p=this._getColorFromAnsiIndex(u);break;case 50331648:let S=Il.toColorRGB(u);p=ds.toColor(S[0],S[1],S[2]);break;default:h?p=this._config.colors.background:p=this._config.colors.foreground}return this._config.allowTransparency&&(p=yu.opaque(p)),f&&(p=yu.multiplyOpacity(p,zL)),p}_resolveBackgroundRgba(e,i,n){switch(e){case 16777216:case 33554432:return this._getColorFromAnsiIndex(i).rgba;case 50331648:return i<<8;default:return n?this._config.colors.foreground.rgba:this._config.colors.background.rgba}}_resolveForegroundRgba(e,i,n,a){switch(e){case 16777216:case 33554432:return this._config.drawBoldTextInBrightColors&&a&&i<8&&(i+=8),this._getColorFromAnsiIndex(i).rgba;case 50331648:return i<<8;default:return n?this._config.colors.background.rgba:this._config.colors.foreground.rgba}}_getMinimumContrastColor(e,i,n,a,l,u,h,f,d,g){if(this._config.minimumContrastRatio===1||g)return;let v=this._getContrastCache(d),p=v.getColor(e,a);if(p!==void 0)return p||void 0;let S=this._resolveBackgroundRgba(i,n,h),y=this._resolveForegroundRgba(l,u,h,f),C=No.ensureContrastRatio(S,y,this._config.minimumContrastRatio/(d?2:1));if(!C){v.setColor(e,a,null);return}let x=ds.toColor(C>>24&255,C>>16&255,C>>8&255);return v.setColor(e,a,x),x}_getContrastCache(e){return e?this._config.colors.halfContrastCache:this._config.colors.contrastCache}_drawToCache(e,i,n,a,l,u){let h=typeof e=="number"?String.fromCharCode(e):e;u&&this._tmpCanvas.parentElement!==u&&(this._tmpCanvas.style.display="none",u.append(this._tmpCanvas));let f=Math.min(this._config.deviceCellWidth*Math.max(h.length,2)+cu*2,this._config.deviceMaxTextureSize);this._tmpCanvas.width<f&&(this._tmpCanvas.width=f);let d=Math.min(this._config.deviceCellHeight+cu*4,this._textureSize);if(this._tmpCanvas.height<d&&(this._tmpCanvas.height=d),this._tmpCtx.save(),this._workAttributeData.fg=n,this._workAttributeData.bg=i,this._workAttributeData.extended.ext=a,!!this._workAttributeData.isInvisible())return o1;let g=!!this._workAttributeData.isBold(),v=!!this._workAttributeData.isInverse(),p=!!this._workAttributeData.isDim(),S=!!this._workAttributeData.isItalic(),y=!!this._workAttributeData.isUnderline(),C=!!this._workAttributeData.isStrikethrough(),x=!!this._workAttributeData.isOverline(),R=this._workAttributeData.getFgColor(),L=this._workAttributeData.getFgColorMode(),N=this._workAttributeData.getBgColor(),T=this._workAttributeData.getBgColorMode();if(v){let G=R;R=N,N=G;let B=L;L=T,T=B}let W=this._getBackgroundColor(T,N,v,p);this._tmpCtx.globalCompositeOperation="copy",this._tmpCtx.fillStyle=W.css,this._tmpCtx.fillRect(0,0,this._tmpCanvas.width,this._tmpCanvas.height),this._tmpCtx.globalCompositeOperation="source-over";let D=g?this._config.fontWeightBold:this._config.fontWeight,I=S?"italic":"";this._tmpCtx.font=`${I} ${D} ${this._config.fontSize*this._config.devicePixelRatio}px ${this._config.fontFamily}`,this._tmpCtx.textBaseline=jC;let H=h.length===1&&Qg(h.charCodeAt(0)),V=h.length===1&&ML(h.charCodeAt(0)),se=this._getForegroundColor(i,T,N,n,L,R,v,p,g,WC(h.charCodeAt(0)));this._tmpCtx.fillStyle=se.css;let Q=V?0:cu*2,A=!1;this._config.customGlyphs!==!1&&(A=FL(this._tmpCtx,h,Q,Q,this._config.deviceCellWidth,this._config.deviceCellHeight,this._config.fontSize,this._config.devicePixelRatio));let O=!H,P;if(typeof e=="number"?P=this._unicodeService.wcwidth(e):P=this._unicodeService.getStringCellWidth(e),y){this._tmpCtx.save();let G=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/15)),B=G%2===1?.5:0;if(this._tmpCtx.lineWidth=G,this._workAttributeData.isUnderlineColorDefault())this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle;else if(this._workAttributeData.isUnderlineColorRGB())O=!1,this._tmpCtx.strokeStyle=`rgb(${Il.toColorRGB(this._workAttributeData.getUnderlineColor()).join(",")})`;else{O=!1;let he=this._workAttributeData.getUnderlineColor();this._config.drawBoldTextInBrightColors&&this._workAttributeData.isBold()&&he<8&&(he+=8),this._tmpCtx.strokeStyle=this._getColorFromAnsiIndex(he).css}this._tmpCtx.beginPath();let K=Q,te=Math.ceil(Q+this._config.deviceCharHeight)-B-(l?G*2:0),ne=te+G,de=te+G*2,ue=this._workAttributeData.getUnderlineVariantOffset();for(let he=0;he<P;he++){this._tmpCtx.save();let Se=K+he*this._config.deviceCellWidth,we=K+(he+1)*this._config.deviceCellWidth,Ee=Se+this._config.deviceCellWidth/2;switch(this._workAttributeData.extended.underlineStyle){case 2:this._tmpCtx.moveTo(Se,te),this._tmpCtx.lineTo(we,te),this._tmpCtx.moveTo(Se,de),this._tmpCtx.lineTo(we,de);break;case 3:let Le=G<=1?de:Math.ceil(Q+this._config.deviceCharHeight-G/2)-B,it=G<=1?te:Math.ceil(Q+this._config.deviceCharHeight+G/2)-B,Ze=new Path2D;Ze.rect(Se,te,this._config.deviceCellWidth,de-te),this._tmpCtx.clip(Ze),this._tmpCtx.moveTo(Se-this._config.deviceCellWidth/2,ne),this._tmpCtx.bezierCurveTo(Se-this._config.deviceCellWidth/2,it,Se,it,Se,ne),this._tmpCtx.bezierCurveTo(Se,Le,Ee,Le,Ee,ne),this._tmpCtx.bezierCurveTo(Ee,it,we,it,we,ne),this._tmpCtx.bezierCurveTo(we,Le,we+this._config.deviceCellWidth/2,Le,we+this._config.deviceCellWidth/2,ne);break;case 4:let ke=ue===0?0:ue>=G?G*2-ue:G-ue;ue>=G||ke===0?(this._tmpCtx.setLineDash([Math.round(G),Math.round(G)]),this._tmpCtx.moveTo(Se+ke,te),this._tmpCtx.lineTo(we,te)):(this._tmpCtx.setLineDash([Math.round(G),Math.round(G)]),this._tmpCtx.moveTo(Se,te),this._tmpCtx.lineTo(Se+ke,te),this._tmpCtx.moveTo(Se+ke+G,te),this._tmpCtx.lineTo(we,te)),ue=NL(we-Se,G,ue);break;case 5:let ze=.6,pe=.3,mt=we-Se,yt=Math.floor(ze*mt),ge=Math.floor(pe*mt),ye=mt-yt-ge;this._tmpCtx.setLineDash([yt,ge,ye]),this._tmpCtx.moveTo(Se,te),this._tmpCtx.lineTo(we,te);break;default:this._tmpCtx.moveTo(Se,te),this._tmpCtx.lineTo(we,te);break}this._tmpCtx.stroke(),this._tmpCtx.restore()}if(this._tmpCtx.restore(),!A&&this._config.fontSize>=12&&!this._config.allowTransparency&&h!==" "){this._tmpCtx.save(),this._tmpCtx.textBaseline="alphabetic";let he=this._tmpCtx.measureText(h);if(this._tmpCtx.restore(),"actualBoundingBoxDescent"in he&&he.actualBoundingBoxDescent>0){this._tmpCtx.save();let Se=new Path2D;Se.rect(K,te-Math.ceil(G/2),this._config.deviceCellWidth*P,de-te+Math.ceil(G/2)),this._tmpCtx.clip(Se),this._tmpCtx.lineWidth=this._config.devicePixelRatio*3,this._tmpCtx.strokeStyle=W.css,this._tmpCtx.strokeText(h,Q,Q+this._config.deviceCharHeight),this._tmpCtx.restore()}}}if(x){let G=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/15)),B=G%2===1?.5:0;this._tmpCtx.lineWidth=G,this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle,this._tmpCtx.beginPath(),this._tmpCtx.moveTo(Q,Q+B),this._tmpCtx.lineTo(Q+this._config.deviceCharWidth*P,Q+B),this._tmpCtx.stroke()}if(A||this._tmpCtx.fillText(h,Q,Q+this._config.deviceCharHeight),h==="_"&&!this._config.allowTransparency){let G=lp(this._tmpCtx.getImageData(Q,Q,this._config.deviceCellWidth,this._config.deviceCellHeight),W,se,O);if(G)for(let B=1;B<=5&&(this._tmpCtx.save(),this._tmpCtx.fillStyle=W.css,this._tmpCtx.fillRect(0,0,this._tmpCanvas.width,this._tmpCanvas.height),this._tmpCtx.restore(),this._tmpCtx.fillText(h,Q,Q+this._config.deviceCharHeight-B),G=lp(this._tmpCtx.getImageData(Q,Q,this._config.deviceCellWidth,this._config.deviceCellHeight),W,se,O),!!G);B++);}if(C){let G=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/10)),B=this._tmpCtx.lineWidth%2===1?.5:0;this._tmpCtx.lineWidth=G,this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle,this._tmpCtx.beginPath(),this._tmpCtx.moveTo(Q,Q+Math.floor(this._config.deviceCharHeight/2)-B),this._tmpCtx.lineTo(Q+this._config.deviceCharWidth*P,Q+Math.floor(this._config.deviceCharHeight/2)-B),this._tmpCtx.stroke()}this._tmpCtx.restore();let $=this._tmpCtx.getImageData(0,0,this._tmpCanvas.width,this._tmpCanvas.height),E;if(this._config.allowTransparency?E=o3($):E=lp($,W,se,O),E)return o1;let M=this._findGlyphBoundingBox($,this._workBoundingBox,f,V,A,Q),z,q;for(;;){if(this._activePages.length===0){let G=this._createNewPage();z=G,q=G.currentRow,q.height=M.size.y;break}z=this._activePages[this._activePages.length-1],q=z.currentRow;for(let G of this._activePages)M.size.y<=G.currentRow.height&&(z=G,q=G.currentRow);for(let G=this._activePages.length-1;G>=0;G--)for(let B of this._activePages[G].fixedRows)B.height<=q.height&&M.size.y<=B.height&&(z=this._activePages[G],q=B);if(M.size.x>this._textureSize){this._overflowSizePage||(this._overflowSizePage=new op(this._document,this._config.deviceMaxTextureSize),this.pages.push(this._overflowSizePage),this._requestClearModel=!0,this._onAddTextureAtlasCanvas.fire(this._overflowSizePage.canvas)),z=this._overflowSizePage,q=this._overflowSizePage.currentRow,q.x+M.size.x>=z.canvas.width&&(q.x=0,q.y+=q.height,q.height=0);break}if(q.y+M.size.y>=z.canvas.height||q.height>M.size.y+2){let G=!1;if(z.currentRow.y+z.currentRow.height+M.size.y>=z.canvas.height){let B;for(let K of this._activePages)if(K.currentRow.y+K.currentRow.height+M.size.y<K.canvas.height){B=K;break}if(B)z=B;else if(Pl.maxAtlasPages&&this._pages.length>=Pl.maxAtlasPages&&q.y+M.size.y<=z.canvas.height&&q.height>=M.size.y&&q.x+M.size.x<=z.canvas.width)G=!0;else{let K=this._createNewPage();z=K,q=K.currentRow,q.height=M.size.y,G=!0}}G||(z.currentRow.height>0&&z.fixedRows.push(z.currentRow),q={x:0,y:z.currentRow.y+z.currentRow.height,height:M.size.y},z.fixedRows.push(q),z.currentRow={x:0,y:q.y+q.height,height:0})}if(q.x+M.size.x<=z.canvas.width)break;q===z.currentRow?(q.x=0,q.y+=q.height,q.height=0):z.fixedRows.splice(z.fixedRows.indexOf(q),1)}return M.texturePage=this._pages.indexOf(z),M.texturePosition.x=q.x,M.texturePosition.y=q.y,M.texturePositionClipSpace.x=q.x/z.canvas.width,M.texturePositionClipSpace.y=q.y/z.canvas.height,M.sizeClipSpace.x/=z.canvas.width,M.sizeClipSpace.y/=z.canvas.height,q.height=Math.max(q.height,M.size.y),q.x+=M.size.x,z.ctx.putImageData($,M.texturePosition.x-this._workBoundingBox.left,M.texturePosition.y-this._workBoundingBox.top,this._workBoundingBox.left,this._workBoundingBox.top,M.size.x,M.size.y),z.addGlyph(M),z.version++,M}_findGlyphBoundingBox(e,i,n,a,l,u){i.top=0;let h=a?this._config.deviceCellHeight:this._tmpCanvas.height,f=a?this._config.deviceCellWidth:n,d=!1;for(let g=0;g<h;g++){for(let v=0;v<f;v++){let p=g*this._tmpCanvas.width*4+v*4+3;if(e.data[p]!==0){i.top=g,d=!0;break}}if(d)break}i.left=0,d=!1;for(let g=0;g<u+f;g++){for(let v=0;v<h;v++){let p=v*this._tmpCanvas.width*4+g*4+3;if(e.data[p]!==0){i.left=g,d=!0;break}}if(d)break}i.right=f,d=!1;for(let g=u+f-1;g>=u;g--){for(let v=0;v<h;v++){let p=v*this._tmpCanvas.width*4+g*4+3;if(e.data[p]!==0){i.right=g,d=!0;break}}if(d)break}i.bottom=h,d=!1;for(let g=h-1;g>=0;g--){for(let v=0;v<f;v++){let p=g*this._tmpCanvas.width*4+v*4+3;if(e.data[p]!==0){i.bottom=g,d=!0;break}}if(d)break}return{texturePage:0,texturePosition:{x:0,y:0},texturePositionClipSpace:{x:0,y:0},size:{x:i.right-i.left+1,y:i.bottom-i.top+1},sizeClipSpace:{x:i.right-i.left+1,y:i.bottom-i.top+1},offset:{x:-i.left+u+(a||l?Math.floor((this._config.deviceCellWidth-this._config.deviceCharWidth)/2):0),y:-i.top+u+(a||l?this._config.lineHeight===1?0:Math.round((this._config.deviceCellHeight-this._config.deviceCharHeight)/2):0)}}}},op=class{constructor(t,e,i){if(this._usedPixels=0,this._glyphs=[],this.version=0,this.currentRow={x:0,y:0,height:0},this.fixedRows=[],i)for(let n of i)this._glyphs.push(...n.glyphs),this._usedPixels+=n._usedPixels;this.canvas=tx(t,e,e),this.ctx=pi(this.canvas.getContext("2d",{alpha:!0}))}get percentageUsed(){return this._usedPixels/(this.canvas.width*this.canvas.height)}get glyphs(){return this._glyphs}addGlyph(t){this._glyphs.push(t),this._usedPixels+=t.size.x*t.size.y}clear(){this.ctx.clearRect(0,0,this.canvas.width,this.canvas.height),this.currentRow.x=0,this.currentRow.y=0,this.currentRow.height=0,this.fixedRows.length=0,this.version++}};function lp(t,e,i,n){let a=e.rgba>>>24,l=e.rgba>>>16&255,u=e.rgba>>>8&255,h=i.rgba>>>24,f=i.rgba>>>16&255,d=i.rgba>>>8&255,g=Math.floor((Math.abs(a-h)+Math.abs(l-f)+Math.abs(u-d))/12),v=!0;for(let p=0;p<t.data.length;p+=4)t.data[p]===a&&t.data[p+1]===l&&t.data[p+2]===u||n&&Math.abs(t.data[p]-a)+Math.abs(t.data[p+1]-l)+Math.abs(t.data[p+2]-u)<g?t.data[p+3]=0:v=!1;return v}function o3(t){for(let e=0;e<t.data.length;e+=4)if(t.data[e+3]>0)return!1;return!0}function tx(t,e,i){let n=t.createElement("canvas");return n.width=e,n.height=i,n}function l3(t,e,i,n,a,l,u,h){let f={foreground:l.foreground,background:l.background,cursor:Sr,cursorAccent:Sr,selectionForeground:Sr,selectionBackgroundTransparent:Sr,selectionBackgroundOpaque:Sr,selectionInactiveBackgroundTransparent:Sr,selectionInactiveBackgroundOpaque:Sr,overviewRulerBorder:Sr,scrollbarSliderBackground:Sr,scrollbarSliderHoverBackground:Sr,scrollbarSliderActiveBackground:Sr,ansi:l.ansi.slice(),contrastCache:l.contrastCache,halfContrastCache:l.halfContrastCache};return{customGlyphs:a.customGlyphs,devicePixelRatio:u,deviceMaxTextureSize:h,letterSpacing:a.letterSpacing,lineHeight:a.lineHeight,deviceCellWidth:t,deviceCellHeight:e,deviceCharWidth:i,deviceCharHeight:n,fontFamily:a.fontFamily,fontSize:a.fontSize,fontWeight:a.fontWeight,fontWeightBold:a.fontWeightBold,allowTransparency:a.allowTransparency,drawBoldTextInBrightColors:a.drawBoldTextInBrightColors,minimumContrastRatio:a.minimumContrastRatio,colors:f}}function l1(t,e){for(let i=0;i<t.colors.ansi.length;i++)if(t.colors.ansi[i].rgba!==e.colors.ansi[i].rgba)return!1;return t.devicePixelRatio===e.devicePixelRatio&&t.customGlyphs===e.customGlyphs&&t.lineHeight===e.lineHeight&&t.letterSpacing===e.letterSpacing&&t.fontFamily===e.fontFamily&&t.fontSize===e.fontSize&&t.fontWeight===e.fontWeight&&t.fontWeightBold===e.fontWeightBold&&t.allowTransparency===e.allowTransparency&&t.deviceCharWidth===e.deviceCharWidth&&t.deviceCharHeight===e.deviceCharHeight&&t.drawBoldTextInBrightColors===e.drawBoldTextInBrightColors&&t.minimumContrastRatio===e.minimumContrastRatio&&t.colors.foreground.rgba===e.colors.foreground.rgba&&t.colors.background.rgba===e.colors.background.rgba}function c3(t){return(t&50331648)===16777216||(t&50331648)===33554432}var Cr=[];function ix(t,e,i,n,a,l,u,h,f){let d=l3(n,a,l,u,e,i,h,f);for(let p=0;p<Cr.length;p++){let S=Cr[p],y=S.ownedBy.indexOf(t);if(y>=0){if(l1(S.config,d))return S.atlas;S.ownedBy.length===1?(S.atlas.dispose(),Cr.splice(p,1)):S.ownedBy.splice(y,1);break}}for(let p=0;p<Cr.length;p++){let S=Cr[p];if(l1(S.config,d))return S.ownedBy.push(t),S.atlas}let g=t._core,v={atlas:new Pa(document,d,g.unicodeService),config:d,ownedBy:[t]};return Cr.push(v),v.atlas}function c1(t){for(let e=0;e<Cr.length;e++){let i=Cr[e].ownedBy.indexOf(t);if(i!==-1){Cr[e].ownedBy.length===1?(Cr[e].atlas.dispose(),Cr.splice(e,1)):Cr[e].ownedBy.splice(i,1);break}}}var hd=600,u3=class{constructor(t,e){this._renderCallback=t,this._coreBrowserService=e,this.isCursorVisible=!0,this._coreBrowserService.isFocused&&this._restartInterval()}get isPaused(){return!(this._blinkStartTimeout||this._blinkInterval)}dispose(){this._blinkInterval&&(this._coreBrowserService.window.clearInterval(this._blinkInterval),this._blinkInterval=void 0),this._blinkStartTimeout&&(this._coreBrowserService.window.clearTimeout(this._blinkStartTimeout),this._blinkStartTimeout=void 0),this._animationFrame&&(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}restartBlinkAnimation(){this.isPaused||(this._animationTimeRestarted=Date.now(),this.isCursorVisible=!0,this._animationFrame||(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>{this._renderCallback(),this._animationFrame=void 0})))}_restartInterval(t=hd){this._blinkInterval&&(this._coreBrowserService.window.clearInterval(this._blinkInterval),this._blinkInterval=void 0),this._blinkStartTimeout=this._coreBrowserService.window.setTimeout(()=>{if(this._animationTimeRestarted){let e=hd-(Date.now()-this._animationTimeRestarted);if(this._animationTimeRestarted=void 0,e>0){this._restartInterval(e);return}}this.isCursorVisible=!1,this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>{this._renderCallback(),this._animationFrame=void 0}),this._blinkInterval=this._coreBrowserService.window.setInterval(()=>{if(this._animationTimeRestarted){let e=hd-(Date.now()-this._animationTimeRestarted);this._animationTimeRestarted=void 0,this._restartInterval(e);return}this.isCursorVisible=!this.isCursorVisible,this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>{this._renderCallback(),this._animationFrame=void 0})},hd)},t)}pause(){this.isCursorVisible=!0,this._blinkInterval&&(this._coreBrowserService.window.clearInterval(this._blinkInterval),this._blinkInterval=void 0),this._blinkStartTimeout&&(this._coreBrowserService.window.clearTimeout(this._blinkStartTimeout),this._blinkStartTimeout=void 0),this._animationFrame&&(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}resume(){this.pause(),this._animationTimeRestarted=void 0,this._restartInterval(),this.restartBlinkAnimation()}};function u1(t,e,i){let n=new e.ResizeObserver(a=>{let l=a.find(f=>f.target===t);if(!l)return;if(!("devicePixelContentBoxSize"in l)){n?.disconnect(),n=void 0;return}let u=l.devicePixelContentBoxSize[0].inlineSize,h=l.devicePixelContentBoxSize[0].blockSize;u>0&&h>0&&i(u,h)});try{n.observe(t,{box:["device-pixel-content-box"]})}catch{n.disconnect(),n=void 0}return rs(()=>n?.disconnect())}function h3(t){return t>65535?(t-=65536,String.fromCharCode((t>>10)+55296)+String.fromCharCode(t%1024+56320)):String.fromCharCode(t)}var h1=class sx extends Il{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new KC,this.combinedData=""}static fromCharData(e){let i=new sx;return i.setFromCharData(e),i}isCombined(){return this.content&2097152}getWidth(){return this.content>>22}getChars(){return this.content&2097152?this.combinedData:this.content&2097151?h3(this.content&2097151):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):this.content&2097151}setFromCharData(e){this.fg=e[0],this.bg=0;let i=!1;if(e[1].length>2)i=!0;else if(e[1].length===2){let n=e[1].charCodeAt(0);if(55296<=n&&n<=56319){let a=e[1].charCodeAt(1);56320<=a&&a<=57343?this.content=(n-55296)*1024+a-56320+65536|e[2]<<22:i=!0}else i=!0}else this.content=e[1].charCodeAt(0)|e[2]<<22;i&&(this.combinedData=e[1],this.content=2097152|e[2]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},rx=new Float32Array([2,0,0,0,0,-2,0,0,0,0,1,0,-1,1,0,1]);function nx(t,e,i){let n=pi(t.createProgram());if(t.attachShader(n,pi(d1(t,t.VERTEX_SHADER,e))),t.attachShader(n,pi(d1(t,t.FRAGMENT_SHADER,i))),t.linkProgram(n),t.getProgramParameter(n,t.LINK_STATUS))return n;console.error(t.getProgramInfoLog(n)),t.deleteProgram(n)}function d1(t,e,i){let n=pi(t.createShader(e));if(t.shaderSource(n,i),t.compileShader(n),t.getShaderParameter(n,t.COMPILE_STATUS))return n;console.error(t.getShaderInfoLog(n)),t.deleteShader(n)}function d3(t,e){let i=Math.min(t.length*2,e),n=new Float32Array(i);for(let a=0;a<t.length;a++)n[a]=t[a];return n}var f3=class{constructor(t){this.texture=t,this.version=-1}},m3=`#version 300 es
31
+ layout (location = 0) in vec2 a_unitquad;
32
+ layout (location = 1) in vec2 a_cellpos;
33
+ layout (location = 2) in vec2 a_offset;
34
+ layout (location = 3) in vec2 a_size;
35
+ layout (location = 4) in float a_texpage;
36
+ layout (location = 5) in vec2 a_texcoord;
37
+ layout (location = 6) in vec2 a_texsize;
38
+
39
+ uniform mat4 u_projection;
40
+ uniform vec2 u_resolution;
41
+
42
+ out vec2 v_texcoord;
43
+ flat out int v_texpage;
44
+
45
+ void main() {
46
+ vec2 zeroToOne = (a_offset / u_resolution) + a_cellpos + (a_unitquad * a_size);
47
+ gl_Position = u_projection * vec4(zeroToOne, 0.0, 1.0);
48
+ v_texpage = int(a_texpage);
49
+ v_texcoord = a_texcoord + a_unitquad * a_texsize;
50
+ }`;function _3(t){let e="";for(let i=1;i<t;i++)e+=` else if (v_texpage == ${i}) { outColor = texture(u_texture[${i}], v_texcoord); }`;return`#version 300 es
51
+ precision lowp float;
52
+
53
+ in vec2 v_texcoord;
54
+ flat in int v_texpage;
55
+
56
+ uniform sampler2D u_texture[${t}];
57
+
58
+ out vec4 outColor;
59
+
60
+ void main() {
61
+ if (v_texpage == 0) {
62
+ outColor = texture(u_texture[0], v_texcoord);
63
+ } ${e}
64
+ }`}var za=11,Ol=za*Float32Array.BYTES_PER_ELEMENT,p3=2,ei=0,zt,cp=0,hu=0,g3=class extends Ur{constructor(t,e,i,n){super(),this._terminal=t,this._gl=e,this._dimensions=i,this._optionsService=n,this._activeBuffer=0,this._vertices={count:0,attributes:new Float32Array(0),attributesBuffers:[new Float32Array(0),new Float32Array(0)]};let a=this._gl;Pa.maxAtlasPages===void 0&&(Pa.maxAtlasPages=Math.min(32,pi(a.getParameter(a.MAX_TEXTURE_IMAGE_UNITS))),Pa.maxTextureSize=pi(a.getParameter(a.MAX_TEXTURE_SIZE))),this._program=pi(nx(a,m3,_3(Pa.maxAtlasPages))),this._register(rs(()=>a.deleteProgram(this._program))),this._projectionLocation=pi(a.getUniformLocation(this._program,"u_projection")),this._resolutionLocation=pi(a.getUniformLocation(this._program,"u_resolution")),this._textureLocation=pi(a.getUniformLocation(this._program,"u_texture")),this._vertexArrayObject=a.createVertexArray(),a.bindVertexArray(this._vertexArrayObject);let l=new Float32Array([0,0,1,0,0,1,1,1]),u=a.createBuffer();this._register(rs(()=>a.deleteBuffer(u))),a.bindBuffer(a.ARRAY_BUFFER,u),a.bufferData(a.ARRAY_BUFFER,l,a.STATIC_DRAW),a.enableVertexAttribArray(0),a.vertexAttribPointer(0,2,this._gl.FLOAT,!1,0,0);let h=new Uint8Array([0,1,2,3]),f=a.createBuffer();this._register(rs(()=>a.deleteBuffer(f))),a.bindBuffer(a.ELEMENT_ARRAY_BUFFER,f),a.bufferData(a.ELEMENT_ARRAY_BUFFER,h,a.STATIC_DRAW),this._attributesBuffer=pi(a.createBuffer()),this._register(rs(()=>a.deleteBuffer(this._attributesBuffer))),a.bindBuffer(a.ARRAY_BUFFER,this._attributesBuffer),a.enableVertexAttribArray(2),a.vertexAttribPointer(2,2,a.FLOAT,!1,Ol,0),a.vertexAttribDivisor(2,1),a.enableVertexAttribArray(3),a.vertexAttribPointer(3,2,a.FLOAT,!1,Ol,2*Float32Array.BYTES_PER_ELEMENT),a.vertexAttribDivisor(3,1),a.enableVertexAttribArray(4),a.vertexAttribPointer(4,1,a.FLOAT,!1,Ol,4*Float32Array.BYTES_PER_ELEMENT),a.vertexAttribDivisor(4,1),a.enableVertexAttribArray(5),a.vertexAttribPointer(5,2,a.FLOAT,!1,Ol,5*Float32Array.BYTES_PER_ELEMENT),a.vertexAttribDivisor(5,1),a.enableVertexAttribArray(6),a.vertexAttribPointer(6,2,a.FLOAT,!1,Ol,7*Float32Array.BYTES_PER_ELEMENT),a.vertexAttribDivisor(6,1),a.enableVertexAttribArray(1),a.vertexAttribPointer(1,2,a.FLOAT,!1,Ol,9*Float32Array.BYTES_PER_ELEMENT),a.vertexAttribDivisor(1,1),a.useProgram(this._program);let d=new Int32Array(Pa.maxAtlasPages);for(let g=0;g<Pa.maxAtlasPages;g++)d[g]=g;a.uniform1iv(this._textureLocation,d),a.uniformMatrix4fv(this._projectionLocation,!1,rx),this._atlasTextures=[];for(let g=0;g<Pa.maxAtlasPages;g++){let v=new f3(pi(a.createTexture()));this._register(rs(()=>a.deleteTexture(v.texture))),a.activeTexture(a.TEXTURE0+g),a.bindTexture(a.TEXTURE_2D,v.texture),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_WRAP_S,a.CLAMP_TO_EDGE),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_WRAP_T,a.CLAMP_TO_EDGE),a.texImage2D(a.TEXTURE_2D,0,a.RGBA,1,1,0,a.RGBA,a.UNSIGNED_BYTE,new Uint8Array([255,0,0,255])),this._atlasTextures[g]=v}a.enable(a.BLEND),a.blendFunc(a.SRC_ALPHA,a.ONE_MINUS_SRC_ALPHA),this.handleResize()}beginFrame(){return this._atlas?this._atlas.beginFrame():!0}updateCell(t,e,i,n,a,l,u,h,f){this._updateCell(this._vertices.attributes,t,e,i,n,a,l,u,h,f)}_updateCell(t,e,i,n,a,l,u,h,f,d){if(ei=(i*this._terminal.cols+e)*za,n===0||n===void 0){t.fill(0,ei,ei+za-1-p3);return}this._atlas&&(h&&h.length>1?zt=this._atlas.getRasterizedGlyphCombinedChar(h,a,l,u,!1,this._terminal.element):zt=this._atlas.getRasterizedGlyph(n,a,l,u,!1,this._terminal.element),cp=Math.floor((this._dimensions.device.cell.width-this._dimensions.device.char.width)/2),a!==d&&zt.offset.x>cp?(hu=zt.offset.x-cp,t[ei]=-(zt.offset.x-hu)+this._dimensions.device.char.left,t[ei+1]=-zt.offset.y+this._dimensions.device.char.top,t[ei+2]=(zt.size.x-hu)/this._dimensions.device.canvas.width,t[ei+3]=zt.size.y/this._dimensions.device.canvas.height,t[ei+4]=zt.texturePage,t[ei+5]=zt.texturePositionClipSpace.x+hu/this._atlas.pages[zt.texturePage].canvas.width,t[ei+6]=zt.texturePositionClipSpace.y,t[ei+7]=zt.sizeClipSpace.x-hu/this._atlas.pages[zt.texturePage].canvas.width,t[ei+8]=zt.sizeClipSpace.y):(t[ei]=-zt.offset.x+this._dimensions.device.char.left,t[ei+1]=-zt.offset.y+this._dimensions.device.char.top,t[ei+2]=zt.size.x/this._dimensions.device.canvas.width,t[ei+3]=zt.size.y/this._dimensions.device.canvas.height,t[ei+4]=zt.texturePage,t[ei+5]=zt.texturePositionClipSpace.x,t[ei+6]=zt.texturePositionClipSpace.y,t[ei+7]=zt.sizeClipSpace.x,t[ei+8]=zt.sizeClipSpace.y),this._optionsService.rawOptions.rescaleOverlappingGlyphs&&OL(n,f,zt.size.x,this._dimensions.device.cell.width)&&(t[ei+2]=(this._dimensions.device.cell.width-1)/this._dimensions.device.canvas.width))}clear(){let t=this._terminal,e=t.cols*t.rows*za;this._vertices.count!==e?this._vertices.attributes=new Float32Array(e):this._vertices.attributes.fill(0);let i=0;for(;i<this._vertices.attributesBuffers.length;i++)this._vertices.count!==e?this._vertices.attributesBuffers[i]=new Float32Array(e):this._vertices.attributesBuffers[i].fill(0);this._vertices.count=e,i=0;for(let n=0;n<t.rows;n++)for(let a=0;a<t.cols;a++)this._vertices.attributes[i+9]=a/t.cols,this._vertices.attributes[i+10]=n/t.rows,i+=za}handleResize(){let t=this._gl;t.useProgram(this._program),t.viewport(0,0,t.canvas.width,t.canvas.height),t.uniform2f(this._resolutionLocation,t.canvas.width,t.canvas.height),this.clear()}render(t){if(!this._atlas)return;let e=this._gl;e.useProgram(this._program),e.bindVertexArray(this._vertexArrayObject),this._activeBuffer=(this._activeBuffer+1)%2;let i=this._vertices.attributesBuffers[this._activeBuffer],n=0;for(let a=0;a<t.lineLengths.length;a++){let l=a*this._terminal.cols*za,u=this._vertices.attributes.subarray(l,l+t.lineLengths[a]*za);i.set(u,n),n+=u.length}e.bindBuffer(e.ARRAY_BUFFER,this._attributesBuffer),e.bufferData(e.ARRAY_BUFFER,i.subarray(0,n),e.STREAM_DRAW);for(let a=0;a<this._atlas.pages.length;a++)this._atlas.pages[a].version!==this._atlasTextures[a].version&&this._bindAtlasPageTexture(e,this._atlas,a);e.drawElementsInstanced(e.TRIANGLE_STRIP,4,e.UNSIGNED_BYTE,0,n/za)}setAtlas(t){this._atlas=t;for(let e of this._atlasTextures)e.version=-1}_bindAtlasPageTexture(t,e,i){t.activeTexture(t.TEXTURE0+i),t.bindTexture(t.TEXTURE_2D,this._atlasTextures[i].texture),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,t.RGBA,t.UNSIGNED_BYTE,e.pages[i].canvas),t.generateMipmap(t.TEXTURE_2D),this._atlasTextures[i].version=e.pages[i].version}setDimensions(t){this._dimensions=t}},v3=class{constructor(){this.clear()}clear(){this.hasSelection=!1,this.columnSelectMode=!1,this.viewportStartRow=0,this.viewportEndRow=0,this.viewportCappedStartRow=0,this.viewportCappedEndRow=0,this.startCol=0,this.endCol=0,this.selectionStart=void 0,this.selectionEnd=void 0}update(t,e,i,n=!1){if(this.selectionStart=e,this.selectionEnd=i,!e||!i||e[0]===i[0]&&e[1]===i[1]){this.clear();return}let a=t.buffers.active.ydisp,l=e[1]-a,u=i[1]-a,h=Math.max(l,0),f=Math.min(u,t.rows-1);if(h>=t.rows||f<0){this.clear();return}this.hasSelection=!0,this.columnSelectMode=n,this.viewportStartRow=l,this.viewportEndRow=u,this.viewportCappedStartRow=h,this.viewportCappedEndRow=f,this.startCol=e[0],this.endCol=i[0]}isCellSelected(t,e,i){return this.hasSelection?(i-=t.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?e>=this.startCol&&i>=this.viewportCappedStartRow&&e<this.endCol&&i<=this.viewportCappedEndRow:e<this.startCol&&i>=this.viewportCappedStartRow&&e>=this.endCol&&i<=this.viewportCappedEndRow:i>this.viewportStartRow&&i<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&i===this.viewportStartRow&&e>=this.startCol&&e<this.endCol||this.viewportStartRow<this.viewportEndRow&&i===this.viewportEndRow&&e<this.endCol||this.viewportStartRow<this.viewportEndRow&&i===this.viewportStartRow&&e>=this.startCol):!1}};function S3(){return new v3}var Qd=4,Rd=1,Md=2,up=3,y3=2147483648,b3=class{constructor(){this.cells=new Uint32Array(0),this.lineLengths=new Uint32Array(0),this.selection=S3()}resize(t,e){let i=t*e*Qd;i!==this.cells.length&&(this.cells=new Uint32Array(i),this.lineLengths=new Uint32Array(e))}clear(){this.cells.fill(0,0),this.lineLengths.fill(0,0)}},w3=`#version 300 es
65
+ layout (location = 0) in vec2 a_position;
66
+ layout (location = 1) in vec2 a_size;
67
+ layout (location = 2) in vec4 a_color;
68
+ layout (location = 3) in vec2 a_unitquad;
69
+
70
+ uniform mat4 u_projection;
71
+
72
+ out vec4 v_color;
73
+
74
+ void main() {
75
+ vec2 zeroToOne = a_position + (a_unitquad * a_size);
76
+ gl_Position = u_projection * vec4(zeroToOne, 0.0, 1.0);
77
+ v_color = a_color;
78
+ }`,C3=`#version 300 es
79
+ precision lowp float;
80
+
81
+ in vec4 v_color;
82
+
83
+ out vec4 outColor;
84
+
85
+ void main() {
86
+ outColor = v_color;
87
+ }`,Fn=8,hp=Fn*Float32Array.BYTES_PER_ELEMENT,x3=20*Fn,f1=class{constructor(){this.attributes=new Float32Array(x3),this.count=0}},Hn=0,m1=0,_1=0,p1=0,g1=0,v1=0,S1=0,k3=class extends Ur{constructor(t,e,i,n){super(),this._terminal=t,this._gl=e,this._dimensions=i,this._themeService=n,this._vertices=new f1,this._verticesCursor=new f1;let a=this._gl;this._program=pi(nx(a,w3,C3)),this._register(rs(()=>a.deleteProgram(this._program))),this._projectionLocation=pi(a.getUniformLocation(this._program,"u_projection")),this._vertexArrayObject=a.createVertexArray(),a.bindVertexArray(this._vertexArrayObject);let l=new Float32Array([0,0,1,0,0,1,1,1]),u=a.createBuffer();this._register(rs(()=>a.deleteBuffer(u))),a.bindBuffer(a.ARRAY_BUFFER,u),a.bufferData(a.ARRAY_BUFFER,l,a.STATIC_DRAW),a.enableVertexAttribArray(3),a.vertexAttribPointer(3,2,this._gl.FLOAT,!1,0,0);let h=new Uint8Array([0,1,2,3]),f=a.createBuffer();this._register(rs(()=>a.deleteBuffer(f))),a.bindBuffer(a.ELEMENT_ARRAY_BUFFER,f),a.bufferData(a.ELEMENT_ARRAY_BUFFER,h,a.STATIC_DRAW),this._attributesBuffer=pi(a.createBuffer()),this._register(rs(()=>a.deleteBuffer(this._attributesBuffer))),a.bindBuffer(a.ARRAY_BUFFER,this._attributesBuffer),a.enableVertexAttribArray(0),a.vertexAttribPointer(0,2,a.FLOAT,!1,hp,0),a.vertexAttribDivisor(0,1),a.enableVertexAttribArray(1),a.vertexAttribPointer(1,2,a.FLOAT,!1,hp,2*Float32Array.BYTES_PER_ELEMENT),a.vertexAttribDivisor(1,1),a.enableVertexAttribArray(2),a.vertexAttribPointer(2,4,a.FLOAT,!1,hp,4*Float32Array.BYTES_PER_ELEMENT),a.vertexAttribDivisor(2,1),this._updateCachedColors(n.colors),this._register(this._themeService.onChangeColors(d=>{this._updateCachedColors(d),this._updateViewportRectangle()}))}renderBackgrounds(){this._renderVertices(this._vertices)}renderCursor(){this._renderVertices(this._verticesCursor)}_renderVertices(t){let e=this._gl;e.useProgram(this._program),e.bindVertexArray(this._vertexArrayObject),e.uniformMatrix4fv(this._projectionLocation,!1,rx),e.bindBuffer(e.ARRAY_BUFFER,this._attributesBuffer),e.bufferData(e.ARRAY_BUFFER,t.attributes,e.DYNAMIC_DRAW),e.drawElementsInstanced(this._gl.TRIANGLE_STRIP,4,e.UNSIGNED_BYTE,0,t.count)}handleResize(){this._updateViewportRectangle()}setDimensions(t){this._dimensions=t}_updateCachedColors(t){this._bgFloat=this._colorToFloat32Array(t.background),this._cursorFloat=this._colorToFloat32Array(t.cursor)}_updateViewportRectangle(){this._addRectangleFloat(this._vertices.attributes,0,0,0,this._terminal.cols*this._dimensions.device.cell.width,this._terminal.rows*this._dimensions.device.cell.height,this._bgFloat)}updateBackgrounds(t){let e=this._terminal,i=this._vertices,n=1,a,l,u,h,f,d,g,v,p,S,y;for(a=0;a<e.rows;a++){for(u=-1,h=0,f=0,d=!1,l=0;l<e.cols;l++)g=(a*e.cols+l)*Qd,v=t.cells[g+Rd],p=t.cells[g+Md],S=!!(p&67108864),(v!==h||p!==f&&(d||S))&&((h!==0||d&&f!==0)&&(y=n++*Fn,this._updateRectangle(i,y,f,h,u,l,a)),u=l,h=v,f=p,d=S);(h!==0||d&&f!==0)&&(y=n++*Fn,this._updateRectangle(i,y,f,h,u,e.cols,a))}i.count=n}updateCursor(t){let e=this._verticesCursor,i=t.cursor;if(!i||i.style==="block"){e.count=0;return}let n,a=0;(i.style==="bar"||i.style==="outline")&&(n=a++*Fn,this._addRectangleFloat(e.attributes,n,i.x*this._dimensions.device.cell.width,i.y*this._dimensions.device.cell.height,i.style==="bar"?i.dpr*i.cursorWidth:i.dpr,this._dimensions.device.cell.height,this._cursorFloat)),(i.style==="underline"||i.style==="outline")&&(n=a++*Fn,this._addRectangleFloat(e.attributes,n,i.x*this._dimensions.device.cell.width,(i.y+1)*this._dimensions.device.cell.height-i.dpr,i.width*this._dimensions.device.cell.width,i.dpr,this._cursorFloat)),i.style==="outline"&&(n=a++*Fn,this._addRectangleFloat(e.attributes,n,i.x*this._dimensions.device.cell.width,i.y*this._dimensions.device.cell.height,i.width*this._dimensions.device.cell.width,i.dpr,this._cursorFloat),n=a++*Fn,this._addRectangleFloat(e.attributes,n,(i.x+i.width)*this._dimensions.device.cell.width-i.dpr,i.y*this._dimensions.device.cell.height,i.dpr,this._dimensions.device.cell.height,this._cursorFloat)),e.count=a}_updateRectangle(t,e,i,n,a,l,u){if(i&67108864)switch(i&50331648){case 16777216:case 33554432:Hn=this._themeService.colors.ansi[i&255].rgba;break;case 50331648:Hn=(i&16777215)<<8;break;default:Hn=this._themeService.colors.foreground.rgba}else switch(n&50331648){case 16777216:case 33554432:Hn=this._themeService.colors.ansi[n&255].rgba;break;case 50331648:Hn=(n&16777215)<<8;break;default:Hn=this._themeService.colors.background.rgba}t.attributes.length<e+4&&(t.attributes=d3(t.attributes,this._terminal.rows*this._terminal.cols*Fn)),m1=a*this._dimensions.device.cell.width,_1=u*this._dimensions.device.cell.height,p1=(Hn>>24&255)/255,g1=(Hn>>16&255)/255,v1=(Hn>>8&255)/255,S1=1,this._addRectangle(t.attributes,e,m1,_1,(l-a)*this._dimensions.device.cell.width,this._dimensions.device.cell.height,p1,g1,v1,S1)}_addRectangle(t,e,i,n,a,l,u,h,f,d){t[e]=i/this._dimensions.device.canvas.width,t[e+1]=n/this._dimensions.device.canvas.height,t[e+2]=a/this._dimensions.device.canvas.width,t[e+3]=l/this._dimensions.device.canvas.height,t[e+4]=u,t[e+5]=h,t[e+6]=f,t[e+7]=d}_addRectangleFloat(t,e,i,n,a,l,u){t[e]=i/this._dimensions.device.canvas.width,t[e+1]=n/this._dimensions.device.canvas.height,t[e+2]=a/this._dimensions.device.canvas.width,t[e+3]=l/this._dimensions.device.canvas.height,t[e+4]=u[0],t[e+5]=u[1],t[e+6]=u[2],t[e+7]=u[3]}_colorToFloat32Array(t){return new Float32Array([(t.rgba>>24&255)/255,(t.rgba>>16&255)/255,(t.rgba>>8&255)/255,(t.rgba&255)/255])}},E3=class extends Ur{constructor(t,e,i,n,a,l,u,h){super(),this._container=e,this._alpha=a,this._coreBrowserService=l,this._optionsService=u,this._themeService=h,this._deviceCharWidth=0,this._deviceCharHeight=0,this._deviceCellWidth=0,this._deviceCellHeight=0,this._deviceCharLeft=0,this._deviceCharTop=0,this._canvas=this._coreBrowserService.mainDocument.createElement("canvas"),this._canvas.classList.add(`xterm-${i}-layer`),this._canvas.style.zIndex=n.toString(),this._initCanvas(),this._container.appendChild(this._canvas),this._register(this._themeService.onChangeColors(f=>{this._refreshCharAtlas(t,f),this.reset(t)})),this._register(rs(()=>{this._canvas.remove()}))}_initCanvas(){this._ctx=pi(this._canvas.getContext("2d",{alpha:this._alpha})),this._alpha||this._clearAll()}handleBlur(t){}handleFocus(t){}handleCursorMove(t){}handleGridChanged(t,e,i){}handleSelectionChanged(t,e,i,n=!1){}_setTransparency(t,e){if(e===this._alpha)return;let i=this._canvas;this._alpha=e,this._canvas=this._canvas.cloneNode(),this._initCanvas(),this._container.replaceChild(this._canvas,i),this._refreshCharAtlas(t,this._themeService.colors),this.handleGridChanged(t,0,t.rows-1)}_refreshCharAtlas(t,e){this._deviceCharWidth<=0&&this._deviceCharHeight<=0||(this._charAtlas=ix(t,this._optionsService.rawOptions,e,this._deviceCellWidth,this._deviceCellHeight,this._deviceCharWidth,this._deviceCharHeight,this._coreBrowserService.dpr,2048),this._charAtlas.warmUp())}resize(t,e){this._deviceCellWidth=e.device.cell.width,this._deviceCellHeight=e.device.cell.height,this._deviceCharWidth=e.device.char.width,this._deviceCharHeight=e.device.char.height,this._deviceCharLeft=e.device.char.left,this._deviceCharTop=e.device.char.top,this._canvas.width=e.device.canvas.width,this._canvas.height=e.device.canvas.height,this._canvas.style.width=`${e.css.canvas.width}px`,this._canvas.style.height=`${e.css.canvas.height}px`,this._alpha||this._clearAll(),this._refreshCharAtlas(t,this._themeService.colors)}_fillBottomLineAtCells(t,e,i=1){this._ctx.fillRect(t*this._deviceCellWidth,(e+1)*this._deviceCellHeight-this._coreBrowserService.dpr-1,i*this._deviceCellWidth,this._coreBrowserService.dpr)}_clearAll(){this._alpha?this._ctx.clearRect(0,0,this._canvas.width,this._canvas.height):(this._ctx.fillStyle=this._themeService.colors.background.css,this._ctx.fillRect(0,0,this._canvas.width,this._canvas.height))}_clearCells(t,e,i,n){this._alpha?this._ctx.clearRect(t*this._deviceCellWidth,e*this._deviceCellHeight,i*this._deviceCellWidth,n*this._deviceCellHeight):(this._ctx.fillStyle=this._themeService.colors.background.css,this._ctx.fillRect(t*this._deviceCellWidth,e*this._deviceCellHeight,i*this._deviceCellWidth,n*this._deviceCellHeight))}_fillCharTrueColor(t,e,i,n){this._ctx.font=this._getFont(t,!1,!1),this._ctx.textBaseline=jC,this._clipCell(i,n,e.getWidth()),this._ctx.fillText(e.getChars(),i*this._deviceCellWidth+this._deviceCharLeft,n*this._deviceCellHeight+this._deviceCharTop+this._deviceCharHeight)}_clipCell(t,e,i){this._ctx.beginPath(),this._ctx.rect(t*this._deviceCellWidth,e*this._deviceCellHeight,i*this._deviceCellWidth,this._deviceCellHeight),this._ctx.clip()}_getFont(t,e,i){let n=e?t.options.fontWeightBold:t.options.fontWeight;return`${i?"italic":""} ${n} ${t.options.fontSize*this._coreBrowserService.dpr}px ${t.options.fontFamily}`}},T3=class extends E3{constructor(t,e,i,n,a,l,u){super(i,t,"link",e,!0,a,l,u),this._register(n.onShowLinkUnderline(h=>this._handleShowLinkUnderline(h))),this._register(n.onHideLinkUnderline(h=>this._handleHideLinkUnderline(h)))}resize(t,e){super.resize(t,e),this._state=void 0}reset(t){this._clearCurrentLink()}_clearCurrentLink(){if(this._state){this._clearCells(this._state.x1,this._state.y1,this._state.cols-this._state.x1,1);let t=this._state.y2-this._state.y1-1;t>0&&this._clearCells(0,this._state.y1+1,this._state.cols,t),this._clearCells(0,this._state.y2,this._state.x2,1),this._state=void 0}}_handleShowLinkUnderline(t){if(t.fg===257?this._ctx.fillStyle=this._themeService.colors.background.css:t.fg!==void 0&&c3(t.fg)?this._ctx.fillStyle=this._themeService.colors.ansi[t.fg].css:this._ctx.fillStyle=this._themeService.colors.foreground.css,t.y1===t.y2)this._fillBottomLineAtCells(t.x1,t.y1,t.x2-t.x1);else{this._fillBottomLineAtCells(t.x1,t.y1,t.cols-t.x1);for(let e=t.y1+1;e<t.y2;e++)this._fillBottomLineAtCells(0,e,t.cols);this._fillBottomLineAtCells(0,t.y2,t.x2)}this._state=t}_handleHideLinkUnderline(t){this._clearCurrentLink()}},Ao=typeof window=="object"?window:globalThis,Sg=class{constructor(){this.mapWindowIdToZoomLevel=new Map,this._onDidChangeZoomLevel=new It,this.onDidChangeZoomLevel=this._onDidChangeZoomLevel.event,this.mapWindowIdToZoomFactor=new Map,this._onDidChangeFullscreen=new It,this.onDidChangeFullscreen=this._onDidChangeFullscreen.event,this.mapWindowIdToFullScreen=new Map}getZoomLevel(e){return this.mapWindowIdToZoomLevel.get(this.getWindowId(e))??0}setZoomLevel(e,i){if(this.getZoomLevel(i)===e)return;let n=this.getWindowId(i);this.mapWindowIdToZoomLevel.set(n,e),this._onDidChangeZoomLevel.fire(n)}getZoomFactor(e){return this.mapWindowIdToZoomFactor.get(this.getWindowId(e))??1}setZoomFactor(e,i){this.mapWindowIdToZoomFactor.set(this.getWindowId(i),e)}setFullscreen(e,i){if(this.isFullscreen(i)===e)return;let n=this.getWindowId(i);this.mapWindowIdToFullScreen.set(n,e),this._onDidChangeFullscreen.fire(n)}isFullscreen(e){return!!this.mapWindowIdToFullScreen.get(this.getWindowId(e))}getWindowId(e){return e.vscodeWindowId}};Sg.INSTANCE=new Sg;var ax=Sg;function R3(t,e,i){typeof e=="string"&&(e=t.matchMedia(e)),e.addEventListener("change",i)}ax.INSTANCE.onDidChangeZoomLevel;ax.INSTANCE.onDidChangeFullscreen;var Jl=typeof navigator=="object"?navigator.userAgent:"";Jl.indexOf("Firefox")>=0;Jl.indexOf("AppleWebKit")>=0;var M3=Jl.indexOf("Chrome")>=0;!M3&&Jl.indexOf("Safari")>=0;Jl.indexOf("Electron/")>=0;Jl.indexOf("Android")>=0;var dp=!1;if(typeof Ao.matchMedia=="function"){let t=Ao.matchMedia("(display-mode: standalone) or (display-mode: window-controls-overlay)"),e=Ao.matchMedia("(display-mode: fullscreen)");dp=t.matches,R3(Ao,t,({matches:i})=>{dp&&e.matches||(dp=i)})}var Ul="en",fp=!1,ox=!1,dd,Ad=Ul,y1=Ul,A3,Un,Po=globalThis,Vs;typeof Po.vscode<"u"&&typeof Po.vscode.process<"u"?Vs=Po.vscode.process:typeof process<"u"&&typeof process?.versions?.node=="string"&&(Vs=process);var L3=typeof Vs?.versions?.electron=="string",D3=L3&&Vs?.type==="renderer";if(typeof Vs=="object"){Vs.platform,Vs.platform,fp=Vs.platform==="linux",fp&&Vs.env.SNAP&&Vs.env.SNAP_REVISION,Vs.env.CI||Vs.env.BUILD_ARTIFACTSTAGINGDIRECTORY,dd=Ul,Ad=Ul;let t=Vs.env.VSCODE_NLS_CONFIG;if(t)try{let e=JSON.parse(t);dd=e.userLocale,y1=e.osLocale,Ad=e.resolvedLanguage||Ul,A3=e.languagePack?.translationsConfigFile}catch{}ox=!0}else typeof navigator=="object"&&!D3?(Un=navigator.userAgent,Un.indexOf("Windows")>=0,Un.indexOf("Macintosh")>=0,(Un.indexOf("Macintosh")>=0||Un.indexOf("iPad")>=0||Un.indexOf("iPhone")>=0)&&navigator.maxTouchPoints&&navigator.maxTouchPoints>0,fp=Un.indexOf("Linux")>=0,Un?.indexOf("Mobi")>=0,Ad=globalThis._VSCODE_NLS_LANGUAGE||Ul,dd=navigator.language.toLowerCase(),y1=dd):console.error("Unable to resolve platform.");var b1=ox,ln=Un,Ba=Ad,O3;(t=>{function e(){return Ba}t.value=e;function i(){return Ba.length===2?Ba==="en":Ba.length>=3?Ba[0]==="e"&&Ba[1]==="n"&&Ba[2]==="-":!1}t.isDefaultVariant=i;function n(){return Ba==="en"}t.isDefault=n})(O3||={});var B3=typeof Po.postMessage=="function"&&!Po.importScripts;(()=>{if(B3){let t=[];Po.addEventListener("message",i=>{if(i.data&&i.data.vscodeScheduleAsyncWork)for(let n=0,a=t.length;n<a;n++){let l=t[n];if(l.id===i.data.vscodeScheduleAsyncWork){t.splice(n,1),l.callback();return}}});let e=0;return i=>{let n=++e;t.push({id:n,callback:i}),Po.postMessage({vscodeScheduleAsyncWork:n},"*")}}return t=>setTimeout(t)})();var N3=!!(ln&&ln.indexOf("Chrome")>=0);ln&&ln.indexOf("Firefox")>=0;!N3&&ln&&ln.indexOf("Safari")>=0;ln&&ln.indexOf("Edg/")>=0;ln&&ln.indexOf("Android")>=0;var Bl=typeof navigator=="object"?navigator:{};b1||document.queryCommandSupported&&document.queryCommandSupported("copy")||Bl&&Bl.clipboard&&Bl.clipboard.writeText,b1||Bl&&Bl.clipboard&&Bl.clipboard.readText;var Jg=class{constructor(){this._keyCodeToStr=[],this._strToKeyCode=Object.create(null)}define(t,e){this._keyCodeToStr[t]=e,this._strToKeyCode[e.toLowerCase()]=t}keyCodeToStr(t){return this._keyCodeToStr[t]}strToKeyCode(t){return this._strToKeyCode[t.toLowerCase()]||0}},mp=new Jg,w1=new Jg,C1=new Jg;new Array(230);var P3;(t=>{function e(h){return mp.keyCodeToStr(h)}t.toString=e;function i(h){return mp.strToKeyCode(h)}t.fromString=i;function n(h){return w1.keyCodeToStr(h)}t.toUserSettingsUS=n;function a(h){return C1.keyCodeToStr(h)}t.toUserSettingsGeneral=a;function l(h){return w1.strToKeyCode(h)||C1.strToKeyCode(h)}t.fromUserSettings=l;function u(h){if(h>=98&&h<=113)return null;switch(h){case 16:return"Up";case 18:return"Down";case 15:return"Left";case 17:return"Right"}return mp.keyCodeToStr(h)}t.toElectronAccelerator=u})(P3||={});var lx=Object.freeze(function(t,e){let i=setTimeout(t.bind(e),0);return{dispose(){clearTimeout(i)}}}),z3;(t=>{function e(i){return i===t.None||i===t.Cancelled||i instanceof H3?!0:!i||typeof i!="object"?!1:typeof i.isCancellationRequested=="boolean"&&typeof i.onCancellationRequested=="function"}t.isCancellationToken=e,t.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:Vn.None}),t.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:lx})})(z3||={});var H3=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?lx:(this._emitter||(this._emitter=new It),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=null)}},I3;(t=>{async function e(n){let a,l=await Promise.all(n.map(u=>u.then(h=>h,h=>{a||(a=h)})));if(typeof a<"u")throw a;return l}t.settled=e;function i(n){return new Promise(async(a,l)=>{try{await n(a,l)}catch(u){l(u)}})}t.withAsyncBody=i})(I3||={});var x1=class yr{static fromArray(e){return new yr(i=>{i.emitMany(e)})}static fromPromise(e){return new yr(async i=>{i.emitMany(await e)})}static fromPromises(e){return new yr(async i=>{await Promise.all(e.map(async n=>i.emitOne(await n)))})}static merge(e){return new yr(async i=>{await Promise.all(e.map(async n=>{for await(let a of n)i.emitOne(a)}))})}constructor(e,i){this._state=0,this._results=[],this._error=null,this._onReturn=i,this._onStateChanged=new It,queueMicrotask(async()=>{let n={emitOne:a=>this.emitOne(a),emitMany:a=>this.emitMany(a),reject:a=>this.reject(a)};try{await Promise.resolve(e(n)),this.resolve()}catch(a){this.reject(a)}finally{n.emitOne=void 0,n.emitMany=void 0,n.reject=void 0}})}[Symbol.asyncIterator](){let e=0;return{next:async()=>{do{if(this._state===2)throw this._error;if(e<this._results.length)return{done:!1,value:this._results[e++]};if(this._state===1)return{done:!0,value:void 0};await Vn.toPromise(this._onStateChanged.event)}while(!0)},return:async()=>(this._onReturn?.(),{done:!0,value:void 0})}}static map(e,i){return new yr(async n=>{for await(let a of e)n.emitOne(i(a))})}map(e){return yr.map(this,e)}static filter(e,i){return new yr(async n=>{for await(let a of e)i(a)&&n.emitOne(a)})}filter(e){return yr.filter(this,e)}static coalesce(e){return yr.filter(e,i=>!!i)}coalesce(){return yr.coalesce(this)}static async toPromise(e){let i=[];for await(let n of e)i.push(n);return i}toPromise(){return yr.toPromise(this)}emitOne(e){this._state===0&&(this._results.push(e),this._onStateChanged.fire())}emitMany(e){this._state===0&&(this._results=this._results.concat(e),this._onStateChanged.fire())}resolve(){this._state===0&&(this._state=1,this._onStateChanged.fire())}reject(e){this._state===0&&(this._state=2,this._error=e,this._onStateChanged.fire())}};x1.EMPTY=x1.fromArray([]);var{getWindow:U3}=(function(){let t=new Map,e={window:Ao,disposables:new jl};t.set(Ao.vscodeWindowId,e);let i=new It,n=new It,a=new It;function l(u,h){return(typeof u=="number"?t.get(u):void 0)??(h?e:void 0)}return{onDidRegisterWindow:i.event,onWillUnregisterWindow:a.event,onDidUnregisterWindow:n.event,registerWindow(u){if(t.has(u.vscodeWindowId))return Ur.None;let h=new jl,f={window:u,disposables:h.add(new jl)};return t.set(u.vscodeWindowId,f),h.add(rs(()=>{t.delete(u.vscodeWindowId),n.fire(u)})),h.add(yg(u,$3.BEFORE_UNLOAD,()=>{a.fire(u)})),i.fire(f),h},getWindows(){return t.values()},getWindowsCount(){return t.size},getWindowId(u){return u.vscodeWindowId},hasWindow(u){return t.has(u)},getWindowById:l,getWindow(u){let h=u;if(h?.ownerDocument?.defaultView)return h.ownerDocument.defaultView.window;let f=u;return f?.view?f.view.window:Ao},getDocument(u){return U3(u).document}}})(),F3=class{constructor(t,e,i,n){this._node=t,this._type=e,this._handler=i,this._options=n||!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 yg(t,e,i,n){return new F3(t,e,i,n)}var $3={BEFORE_UNLOAD:"beforeunload"},W3=class extends Ur{constructor(t,e,i,n,a,l,u,h,f){super(),this._terminal=t,this._characterJoinerService=e,this._charSizeService=i,this._coreBrowserService=n,this._coreService=a,this._decorationService=l,this._optionsService=u,this._themeService=h,this._cursorBlinkStateManager=new lu,this._charAtlasDisposable=this._register(new lu),this._observerDisposable=this._register(new lu),this._model=new b3,this._workCell=new h1,this._workCell2=new h1,this._rectangleRenderer=this._register(new lu),this._glyphRenderer=this._register(new lu),this._onChangeTextureAtlas=this._register(new It),this.onChangeTextureAtlas=this._onChangeTextureAtlas.event,this._onAddTextureAtlasCanvas=this._register(new It),this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=this._register(new It),this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._onRequestRedraw=this._register(new It),this.onRequestRedraw=this._onRequestRedraw.event,this._onContextLoss=this._register(new It),this.onContextLoss=this._onContextLoss.event,this._canvas=this._coreBrowserService.mainDocument.createElement("canvas");let d={antialias:!1,depth:!1,preserveDrawingBuffer:f};if(this._gl=this._canvas.getContext("webgl2",d),!this._gl)throw new Error("WebGL2 not supported "+this._gl);this._register(this._themeService.onChangeColors(()=>this._handleColorChange())),this._cellColorResolver=new PL(this._terminal,this._optionsService,this._model.selection,this._decorationService,this._coreBrowserService,this._themeService),this._core=this._terminal._core,this._renderLayers=[new T3(this._core.screenElement,2,this._terminal,this._core.linkifier,this._coreBrowserService,u,this._themeService)],this.dimensions=BL(),this._devicePixelRatio=this._coreBrowserService.dpr,this._updateDimensions(),this._updateCursorBlink(),this._register(u.onOptionChange(()=>this._handleOptionsChanged())),this._deviceMaxTextureSize=this._gl.getParameter(this._gl.MAX_TEXTURE_SIZE),this._register(yg(this._canvas,"webglcontextlost",g=>{console.log("webglcontextlost event received"),g.preventDefault(),this._contextRestorationTimeout=setTimeout(()=>{this._contextRestorationTimeout=void 0,console.warn("webgl context not restored; firing onContextLoss"),this._onContextLoss.fire(g)},3e3)})),this._register(yg(this._canvas,"webglcontextrestored",g=>{console.warn("webglcontextrestored event received"),clearTimeout(this._contextRestorationTimeout),this._contextRestorationTimeout=void 0,c1(this._terminal),this._initializeWebGLState(),this._requestRedrawViewport()})),this._observerDisposable.value=u1(this._canvas,this._coreBrowserService.window,(g,v)=>this._setCanvasDevicePixelDimensions(g,v)),this._register(this._coreBrowserService.onWindowChange(g=>{this._observerDisposable.value=u1(this._canvas,g,(v,p)=>this._setCanvasDevicePixelDimensions(v,p))})),this._core.screenElement.appendChild(this._canvas),[this._rectangleRenderer.value,this._glyphRenderer.value]=this._initializeWebGLState(),this._isAttached=this._core.screenElement.isConnected,this._register(rs(()=>{for(let g of this._renderLayers)g.dispose();this._canvas.parentElement?.removeChild(this._canvas),c1(this._terminal)}))}get textureAtlas(){return this._charAtlas?.pages[0].canvas}_handleColorChange(){this._refreshCharAtlas(),this._clearModel(!0)}handleDevicePixelRatioChange(){this._devicePixelRatio!==this._coreBrowserService.dpr&&(this._devicePixelRatio=this._coreBrowserService.dpr,this.handleResize(this._terminal.cols,this._terminal.rows))}handleResize(t,e){this._updateDimensions(),this._model.resize(this._terminal.cols,this._terminal.rows);for(let i of this._renderLayers)i.resize(this._terminal,this.dimensions);this._canvas.width=this.dimensions.device.canvas.width,this._canvas.height=this.dimensions.device.canvas.height,this._canvas.style.width=`${this.dimensions.css.canvas.width}px`,this._canvas.style.height=`${this.dimensions.css.canvas.height}px`,this._core.screenElement.style.width=`${this.dimensions.css.canvas.width}px`,this._core.screenElement.style.height=`${this.dimensions.css.canvas.height}px`,this._rectangleRenderer.value?.setDimensions(this.dimensions),this._rectangleRenderer.value?.handleResize(),this._glyphRenderer.value?.setDimensions(this.dimensions),this._glyphRenderer.value?.handleResize(),this._refreshCharAtlas(),this._clearModel(!1)}handleCharSizeChanged(){this.handleResize(this._terminal.cols,this._terminal.rows)}handleBlur(){for(let t of this._renderLayers)t.handleBlur(this._terminal);this._cursorBlinkStateManager.value?.pause(),this._requestRedrawViewport()}handleFocus(){for(let t of this._renderLayers)t.handleFocus(this._terminal);this._cursorBlinkStateManager.value?.resume(),this._requestRedrawViewport()}handleSelectionChanged(t,e,i){for(let n of this._renderLayers)n.handleSelectionChanged(this._terminal,t,e,i);this._model.selection.update(this._core,t,e,i),this._requestRedrawViewport()}handleCursorMove(){for(let t of this._renderLayers)t.handleCursorMove(this._terminal);this._cursorBlinkStateManager.value?.restartBlinkAnimation()}_handleOptionsChanged(){this._updateDimensions(),this._refreshCharAtlas(),this._updateCursorBlink()}_initializeWebGLState(){return this._rectangleRenderer.value=new k3(this._terminal,this._gl,this.dimensions,this._themeService),this._glyphRenderer.value=new g3(this._terminal,this._gl,this.dimensions,this._optionsService),this.handleCharSizeChanged(),[this._rectangleRenderer.value,this._glyphRenderer.value]}_refreshCharAtlas(){if(this.dimensions.device.char.width<=0&&this.dimensions.device.char.height<=0){this._isAttached=!1;return}let t=ix(this._terminal,this._optionsService.rawOptions,this._themeService.colors,this.dimensions.device.cell.width,this.dimensions.device.cell.height,this.dimensions.device.char.width,this.dimensions.device.char.height,this._coreBrowserService.dpr,this._deviceMaxTextureSize);this._charAtlas!==t&&(this._onChangeTextureAtlas.fire(t.pages[0].canvas),this._charAtlasDisposable.value=IC(Vn.forward(t.onAddTextureAtlasCanvas,this._onAddTextureAtlasCanvas),Vn.forward(t.onRemoveTextureAtlasCanvas,this._onRemoveTextureAtlasCanvas))),this._charAtlas=t,this._charAtlas.warmUp(),this._glyphRenderer.value?.setAtlas(this._charAtlas)}_clearModel(t){this._model.clear(),t&&this._glyphRenderer.value?.clear()}clearTextureAtlas(){this._charAtlas?.clearTexture(),this._clearModel(!0),this._requestRedrawViewport()}clear(){this._clearModel(!0);for(let t of this._renderLayers)t.reset(this._terminal);this._cursorBlinkStateManager.value?.restartBlinkAnimation(),this._updateCursorBlink()}renderRows(t,e){if(!this._isAttached)if(this._core.screenElement?.isConnected&&this._charSizeService.width&&this._charSizeService.height)this._updateDimensions(),this._refreshCharAtlas(),this._isAttached=!0;else return;for(let i of this._renderLayers)i.handleGridChanged(this._terminal,t,e);!this._glyphRenderer.value||!this._rectangleRenderer.value||(this._glyphRenderer.value.beginFrame()?(this._clearModel(!0),this._updateModel(0,this._terminal.rows-1)):this._updateModel(t,e),this._rectangleRenderer.value.renderBackgrounds(),this._glyphRenderer.value.render(this._model),(!this._cursorBlinkStateManager.value||this._cursorBlinkStateManager.value.isCursorVisible)&&this._rectangleRenderer.value.renderCursor())}_updateCursorBlink(){this._coreService.decPrivateModes.cursorBlink??this._terminal.options.cursorBlink?this._cursorBlinkStateManager.value=new u3(()=>{this._requestRedrawCursor()},this._coreBrowserService):this._cursorBlinkStateManager.clear(),this._requestRedrawCursor()}_updateModel(t,e){let i=this._core,n=this._workCell,a,l,u,h,f,d,g=0,v=!0,p,S,y,C,x,R,L,N,T;t=k1(t,i.rows-1,0),e=k1(e,i.rows-1,0);let W=this._coreService.decPrivateModes.cursorStyle??i.options.cursorStyle??"block",D=this._terminal.buffer.active.baseY+this._terminal.buffer.active.cursorY,I=D-i.buffer.ydisp,H=Math.min(this._terminal.buffer.active.cursorX,i.cols-1),V=-1,se=this._coreService.isCursorInitialized&&!this._coreService.isCursorHidden&&(!this._cursorBlinkStateManager.value||this._cursorBlinkStateManager.value.isCursorVisible);this._model.cursor=void 0;let Q=!1;for(l=t;l<=e;l++)for(u=l+i.buffer.ydisp,h=i.buffer.lines.get(u),this._model.lineLengths[l]=0,y=D===u,g=0,f=this._characterJoinerService.getJoinedCharacters(u),N=0;N<i.cols;N++){if(a=this._cellColorResolver.result.bg,h.loadCell(N,n),N===0&&(a=this._cellColorResolver.result.bg),d=!1,v=N>=g,p=N,f.length>0&&N===f[0][0]&&v){S=f.shift();let A=this._model.selection.isCellSelected(this._terminal,S[0],u);for(L=S[0]+1;L<S[1];L++)v&&=A===this._model.selection.isCellSelected(this._terminal,L,u);v&&=!y||H<S[0]||H>=S[1],v?(d=!0,n=new j3(n,h.translateToString(!0,S[0],S[1]),S[1]-S[0]),p=S[1]-1):g=S[1]}if(C=n.getChars(),x=n.getCode(),L=(l*i.cols+N)*Qd,this._cellColorResolver.resolve(n,N,u,this.dimensions.device.cell.width),se&&u===D&&(N===H&&(this._model.cursor={x:H,y:I,width:n.getWidth(),style:this._coreBrowserService.isFocused?W:i.options.cursorInactiveStyle,cursorWidth:i.options.cursorWidth,dpr:this._devicePixelRatio},V=H+n.getWidth()-1),N>=H&&N<=V&&(this._coreBrowserService.isFocused&&W==="block"||this._coreBrowserService.isFocused===!1&&i.options.cursorInactiveStyle==="block")&&(this._cellColorResolver.result.fg=50331648|this._themeService.colors.cursorAccent.rgba>>8&16777215,this._cellColorResolver.result.bg=50331648|this._themeService.colors.cursor.rgba>>8&16777215)),x!==0&&(this._model.lineLengths[l]=N+1),!(this._model.cells[L]===x&&this._model.cells[L+Rd]===this._cellColorResolver.result.bg&&this._model.cells[L+Md]===this._cellColorResolver.result.fg&&this._model.cells[L+up]===this._cellColorResolver.result.ext)&&(Q=!0,C.length>1&&(x|=y3),this._model.cells[L]=x,this._model.cells[L+Rd]=this._cellColorResolver.result.bg,this._model.cells[L+Md]=this._cellColorResolver.result.fg,this._model.cells[L+up]=this._cellColorResolver.result.ext,R=n.getWidth(),this._glyphRenderer.value.updateCell(N,l,x,this._cellColorResolver.result.bg,this._cellColorResolver.result.fg,this._cellColorResolver.result.ext,C,R,a),d)){for(n=this._workCell,N++;N<=p;N++)T=(l*i.cols+N)*Qd,this._glyphRenderer.value.updateCell(N,l,0,0,0,0,TL,0,0),this._model.cells[T]=0,this._model.cells[T+Rd]=this._cellColorResolver.result.bg,this._model.cells[T+Md]=this._cellColorResolver.result.fg,this._model.cells[T+up]=this._cellColorResolver.result.ext;N--}}Q&&this._rectangleRenderer.value.updateBackgrounds(this._model),this._rectangleRenderer.value.updateCursor(this._model)}_updateDimensions(){!this._charSizeService.width||!this._charSizeService.height||(this.dimensions.device.char.width=Math.floor(this._charSizeService.width*this._devicePixelRatio),this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*this._devicePixelRatio),this.dimensions.device.cell.height=Math.floor(this.dimensions.device.char.height*this._optionsService.rawOptions.lineHeight),this.dimensions.device.char.top=this._optionsService.rawOptions.lineHeight===1?0:Math.round((this.dimensions.device.cell.height-this.dimensions.device.char.height)/2),this.dimensions.device.cell.width=this.dimensions.device.char.width+Math.round(this._optionsService.rawOptions.letterSpacing),this.dimensions.device.char.left=Math.floor(this._optionsService.rawOptions.letterSpacing/2),this.dimensions.device.canvas.height=this._terminal.rows*this.dimensions.device.cell.height,this.dimensions.device.canvas.width=this._terminal.cols*this.dimensions.device.cell.width,this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/this._devicePixelRatio),this.dimensions.css.canvas.width=Math.round(this.dimensions.device.canvas.width/this._devicePixelRatio),this.dimensions.css.cell.height=this.dimensions.device.cell.height/this._devicePixelRatio,this.dimensions.css.cell.width=this.dimensions.device.cell.width/this._devicePixelRatio)}_setCanvasDevicePixelDimensions(t,e){this._canvas.width===t&&this._canvas.height===e||(this._canvas.width=t,this._canvas.height=e,this._requestRedrawViewport())}_requestRedrawViewport(){this._onRequestRedraw.fire({start:0,end:this._terminal.rows-1})}_requestRedrawCursor(){let t=this._terminal.buffer.active.cursorY;this._onRequestRedraw.fire({start:t,end:t})}},j3=class extends Il{constructor(t,e,i){super(),this.content=0,this.combinedData="",this.fg=t.fg,this.bg=t.bg,this.combinedData=e,this._width=i}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(t){throw new Error("not implemented")}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}};function k1(t,e,i=0){return Math.max(Math.min(t,e),i)}var E1="di$target",T1="di$dependencies",_p=new Map;function cn(t){if(_p.has(t))return _p.get(t);let e=function(i,n,a){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");V3(e,i,a)};return e._id=t,_p.set(t,e),e}function V3(t,e,i){e[E1]===e?e[T1].push({id:t,index:i}):(e[T1]=[{id:t,index:i}],e[E1]=e)}cn("BufferService");cn("CoreMouseService");cn("CoreService");cn("CharsetService");cn("InstantiationService");cn("LogService");var q3=cn("OptionsService");cn("OscLinkService");cn("UnicodeService");cn("DecorationService");var Y3={trace:0,debug:1,info:2,warn:3,error:4,off:5},G3="xterm.js: ",R1=class extends Ur{constructor(t){super(),this._optionsService=t,this._logLevel=5,this._updateLogLevel(),this._register(this._optionsService.onSpecificOptionChange("logLevel",()=>this._updateLogLevel()))}get logLevel(){return this._logLevel}_updateLogLevel(){this._logLevel=Y3[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(t){for(let e=0;e<t.length;e++)typeof t[e]=="function"&&(t[e]=t[e]())}_log(t,e,i){this._evalLazyOptionalParams(i),t.call(console,(this._optionsService.options.logger?"":G3)+e,...i)}trace(t,...e){this._logLevel<=0&&this._log(this._optionsService.options.logger?.trace.bind(this._optionsService.options.logger)??console.log,t,e)}debug(t,...e){this._logLevel<=1&&this._log(this._optionsService.options.logger?.debug.bind(this._optionsService.options.logger)??console.log,t,e)}info(t,...e){this._logLevel<=2&&this._log(this._optionsService.options.logger?.info.bind(this._optionsService.options.logger)??console.info,t,e)}warn(t,...e){this._logLevel<=3&&this._log(this._optionsService.options.logger?.warn.bind(this._optionsService.options.logger)??console.warn,t,e)}error(t,...e){this._logLevel<=4&&this._log(this._optionsService.options.logger?.error.bind(this._optionsService.options.logger)??console.error,t,e)}};R1=_L([pL(0,q3)],R1);var K3=class extends Ur{constructor(t){if($C&&EL()<16){let e={antialias:!1,depth:!1,preserveDrawingBuffer:!0};if(!document.createElement("canvas").getContext("webgl2",e))throw new Error("Webgl2 is only supported on Safari 16 and above")}super(),this._preserveDrawingBuffer=t,this._onChangeTextureAtlas=this._register(new It),this.onChangeTextureAtlas=this._onChangeTextureAtlas.event,this._onAddTextureAtlasCanvas=this._register(new It),this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=this._register(new It),this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._onContextLoss=this._register(new It),this.onContextLoss=this._onContextLoss.event}activate(t){let e=t._core;if(!t.element){this._register(e.onWillOpen(()=>this.activate(t)));return}this._terminal=t;let i=e.coreService,n=e.optionsService,a=e,l=a._renderService,u=a._characterJoinerService,h=a._charSizeService,f=a._coreBrowserService,d=a._decorationService;a._logService;let g=a._themeService;this._renderer=this._register(new W3(t,u,h,f,i,d,n,g,this._preserveDrawingBuffer)),this._register(Vn.forward(this._renderer.onContextLoss,this._onContextLoss)),this._register(Vn.forward(this._renderer.onChangeTextureAtlas,this._onChangeTextureAtlas)),this._register(Vn.forward(this._renderer.onAddTextureAtlasCanvas,this._onAddTextureAtlasCanvas)),this._register(Vn.forward(this._renderer.onRemoveTextureAtlasCanvas,this._onRemoveTextureAtlasCanvas)),l.setRenderer(this._renderer),this._register(rs(()=>{if(this._terminal._core._store._isDisposed)return;let v=this._terminal._core._renderService;v.setRenderer(this._terminal._core._createRenderer()),v.handleResize(t.cols,t.rows)}))}get textureAtlas(){return this._renderer?.textureAtlas}clearTextureAtlas(){this._renderer?.clearTextureAtlas()}};const X3=(t,e,i)=>`${i.location.protocol==="https:"?"wss":"ws"}://${i.location.host}/__tb/ws/terminal/${t}?csrf=${encodeURIComponent(e)}`,Z3={background:"#0a0a0a",foreground:"#e4e4e7",cursor:"#e4e4e7",cursorAccent:"#09090b",selectionBackground:"#3f3f46",black:"#18181b",red:"#ef4444",green:"#22c55e",yellow:"#eab308",blue:"#3b82f6",magenta:"#a855f7",cyan:"#06b6d4",white:"#e4e4e7",brightBlack:"#52525b",brightRed:"#f87171",brightGreen:"#4ade80",brightYellow:"#facc15",brightBlue:"#60a5fa",brightMagenta:"#c084fc",brightCyan:"#22d3ee",brightWhite:"#fafafa"},Q3=t=>{const e=t.element?.querySelector(".xterm-viewport");if(!e)return 0;const i=e.offsetWidth-e.clientWidth;return i>0?i:0},J3=t=>{if(typeof t!="string")return null;try{return JSON.parse(t)}catch{return null}},eD=(t,e,i,n={})=>{const a=n.createTerminal??(()=>new nL({allowProposedApi:!0,cursorBlink:!0,fontFamily:"Menlo, Monaco, 'Courier New', monospace",fontSize:12,lineHeight:1.2,scrollback:5e3,theme:Z3})),l=n.createFitAddon??(()=>new lL),u=n.WebSocketImpl??WebSocket,h=n.windowRef??window,f=h,d=a(),g=l(),v=new mL;let p=null,S=null,y=null,C=null,x=0;const R=6;let L=!1,N=!1,T=null;d.loadAddon(g),d.loadAddon(v),d.open(t),f.__TERMbridgeExposeTerminal&&(f.__TERMbridgeTerminal=d);let W=null,D="connecting";const I=new Set;let H=0,V=null,se=!1;const Q=10,A=1e3,O=3e4,P=ge=>{if(D!==ge){D=ge;for(const ye of I)ye(ge)}},$=()=>{const ge=A*2**H;return Math.min(ge,O)},E=ge=>{!N||!W||W.send(JSON.stringify(ge))},M=()=>{se||(W=new u(X3(e,i,h)),W.addEventListener("open",()=>{N=!0,H=0,T=null,P("connected"),G()}),W.addEventListener("message",ge=>{const ye=J3(ge.data);ye&&ye.type==="output"&&d.write(ye.data)}),W.addEventListener("close",()=>{if(N=!1,se){P("disconnected");return}if(H>=Q){P("disconnected");return}P("reconnecting");const ge=$();H+=1,V=window.setTimeout(()=>{V=null,M()},ge)}),W.addEventListener("error",()=>{}))};M();const z=()=>{const ge=g.proposeDimensions(),ye=t.clientWidth||d.element?.clientWidth||0,me=t.clientHeight||d.element?.clientHeight||0;if(!ge||ge.cols<1||ge.rows<1||ye<1||me<1){B();return}const Ut=Q3(d),Be=ye/ge.cols,Xe=Math.ceil(Ut/Be),je=Math.max(1,ge.cols-Xe),_t=ge.rows;T&&T.cols===je&&T.rows===_t||(T={cols:je,rows:_t},x=0,d.resize(je,_t),d.scrollToBottom(),E({type:"resize",cols:je,rows:_t}))},q=()=>{if(C!==null&&(clearTimeout(C),C=null),y===null){L=!1;return}L?clearTimeout(y):h.cancelAnimationFrame?.(y),y=null,L=!1},G=()=>{q();const ge=h.requestAnimationFrame;if(typeof ge=="function"){L=!1,y=ge(()=>{y=null,z()});return}L=!0,y=window.setTimeout(()=>{y=null,L=!1,z()},16)},B=()=>{x>=R||(x+=1,C=window.setTimeout(()=>{C=null,G()},50))};d.onData(ge=>{E({type:"input",data:ge})}),h.addEventListener("resize",G);const K=h.ResizeObserver;if(typeof K=="function"){const ge=new K(()=>{G()});S=ge,ge.observe(t)}if(typeof h.WebGLRenderingContext<"u")try{p=new K3,p.onContextLoss(()=>{p?.dispose(),p=null}),d.loadAddon(p)}catch{}G();const te=h.document?.fonts?.ready;te&&te.then(()=>G()).catch(()=>{});const ne=ge=>{E({type:"control",key:ge})},de=ge=>{ge&&E({type:"input",data:ge})},ue=(ge,ye)=>{!Number.isFinite(ye)||ye===0||E({type:"scroll",mode:ge,amount:ye})},he=()=>{if(se=!0,h.removeEventListener("resize",G),S?.disconnect(),S=null,q(),V!==null&&(clearTimeout(V),V=null),I.clear(),W?.close(),p){try{p.dispose()}catch{}p=null}d.dispose()},Se=()=>D,we=ge=>(I.add(ge),()=>{I.delete(ge)}),Ee=new Set,Le=()=>{const ge=d.buffer.active;return{viewportY:ge.viewportY,baseY:ge.baseY,maxY:ge.baseY}},it=()=>{const ge=Le();for(const ye of Ee)ye(ge)};return d.onScroll(()=>{it()}),{sendControl:ne,sendInput:de,sendScroll:ue,destroy:he,getConnectionState:Se,onConnectionStateChange:we,scrollLines:ge=>{d.scrollLines(ge)},scrollPages:ge=>{d.scrollPages(ge)},scrollToTop:()=>{d.scrollToTop()},scrollToBottom:()=>{d.scrollToBottom()},scrollToLine:ge=>{d.scrollToLine(ge)},getScrollInfo:Le,onScroll:ge=>(Ee.add(ge),()=>{Ee.delete(ge)})}};const tD=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),iD=t=>t.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,i,n)=>n?n.toUpperCase():i.toLowerCase()),M1=t=>{const e=iD(t);return e.charAt(0).toUpperCase()+e.slice(1)},cx=(...t)=>t.filter((e,i,n)=>!!e&&e.trim()!==""&&n.indexOf(e)===i).join(" ").trim(),sD=t=>{for(const e in t)if(e.startsWith("aria-")||e==="role"||e==="title")return!0};var rD={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};const nD=w.forwardRef(({color:t="currentColor",size:e=24,strokeWidth:i=2,absoluteStrokeWidth:n,className:a="",children:l,iconNode:u,...h},f)=>w.createElement("svg",{ref:f,...rD,width:e,height:e,stroke:t,strokeWidth:n?Number(i)*24/Number(e):i,className:cx("lucide",a),...!l&&!sD(h)&&{"aria-hidden":"true"},...h},[...u.map(([d,g])=>w.createElement(d,g)),...Array.isArray(l)?l:[l]]));const Ji=(t,e)=>{const i=w.forwardRef(({className:n,...a},l)=>w.createElement(nD,{ref:l,iconNode:e,className:cx(`lucide-${tD(M1(t))}`,`lucide-${t}`,n),...a}));return i.displayName=M1(t),i};const aD=[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]],oD=Ji("arrow-down",aD);const lD=[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]],cD=Ji("arrow-left",lD);const uD=[["path",{d:"M17 12H3",key:"8awo09"}],["path",{d:"m11 18 6-6-6-6",key:"8c2y43"}],["path",{d:"M21 5v14",key:"nzette"}]],hD=Ji("arrow-right-to-line",uD);const dD=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]],fD=Ji("arrow-right",dD);const mD=[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],_D=Ji("arrow-up",mD);const pD=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],gD=Ji("check",pD);const vD=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],SD=Ji("chevron-down",vD);const yD=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],bD=Ji("chevron-up",yD);const wD=[["path",{d:"m7 6 5 5 5-5",key:"1lc07p"}],["path",{d:"m7 13 5 5 5-5",key:"1d48rs"}]],CD=Ji("chevrons-down",wD);const xD=[["path",{d:"m17 11-5-5-5 5",key:"e8nh98"}],["path",{d:"m17 18-5-5-5 5",key:"2avn1x"}]],kD=Ji("chevrons-up",xD);const ED=[["path",{d:"M15 6v12a3 3 0 1 0 3-3H6a3 3 0 1 0 3 3V6a3 3 0 1 0-3 3h12a3 3 0 1 0-3-3",key:"11bfej"}]],TD=Ji("command",ED);const RD=[["path",{d:"M20 4v7a4 4 0 0 1-4 4H4",key:"6o5b7l"}],["path",{d:"m9 10-5 5 5 5",key:"1kshq7"}]],MD=Ji("corner-down-left",RD);const AD=[["rect",{width:"20",height:"14",x:"2",y:"3",rx:"2",key:"48i651"}],["line",{x1:"8",x2:"16",y1:"21",y2:"21",key:"1svkeh"}],["line",{x1:"12",x2:"12",y1:"17",y2:"21",key:"vw1qmm"}]],A1=Ji("monitor",AD);const LD=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],DD=Ji("plus",LD);const OD=[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]],BD=Ji("send",OD);const ND=[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]],ux=Ji("terminal",ND);const PD=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],zD=Ji("x",PD);let L1,ku,vi=typeof window<"u"&&window.document&&window.document.createElement?w.useLayoutEffect:w.useEffect,Fl=t=>(e,i)=>"calc("+e+" + ("+i+" - "+e+") * "+t+")",ks=typeof window<"u"?window.navigator.userAgent:null,Wn="unknown",Kt="unknown";if(typeof window<"u"&&navigator.userAgentData){var pp;!((pp=navigator.userAgentData.brands)===null||pp===void 0)&&pp.some(t=>t.brand==="Chromium")&&(Wn="chromium"),navigator.userAgentData.platform==="Android"&&(Kt="android")}if(Kt==="unknown"&&ks?.match(/android/i)&&(Kt="android"),Wn==="unknown"&&(ks?.match(/Chrome/i)?Wn="chromium":ks?.match(/Firefox/i)?Wn="gecko":ks?.match(/Safari|iPhone/i)&&(Wn="webkit")),Wn==="webkit"){if(ks?.match(/iPhone/i))Kt="ios";else if(ks?.match(/iPad/i))Kt="ipados";else if(ks?.match(/Macintosh/i))try{document?.createEvent("TouchEvent"),Kt="ipados"}catch{Kt="macos"}}var hx={};hx={mapping:{Sheet:{componentName:"a",elementNames:{root:0,view:1,backdrop:2,backdropTrap:3,primaryScrollTrapRoot:4,secondaryScrollTrapRoot:5,scrollContainer:6,frontSpacer:7,backSpacer:8,detentMarker:9,contentWrapper:10,content:11,bleedingBackground:12,stickyContainer:13,sticky:14,leftEdge:15,trigger:16,handle:17,outlet:18},variationSetsNames:{openness:"A",staging:"B",opennessClosedStatus:"C",position:"D",positionCoveredStatus:"E",placement:"F",track:"G",swipeDisabled:"H",swipeOutDisabledWithDetent:"I",swipeOvershootDisabled:"J",bleedDisabled:"K",inertOutside:"L",backdropSwipeable:"M",scrollContainerShouldBePassThrough:"N",swipeTrap:"M"},variationValuesNames:{open:"a",opening:"b",closed:"c",closing:"d",none:"e",top:"f",bottom:"g",left:"h",right:"i",horizontal:"j",vertical:"k",front:"l",covered:"m",true:"o",false:"p",auto:"q",center:"r",pending:"s","flushing-to-preparing-open":"t","flushing-to-preparing-opening":"u","preparing-open":"v","preparing-opening":"x","safe-to-unmount":"y",content:"z",root:"aa","going-down":"ab","going-up":"ac",indeterminate:"ad",idle:"ae","come-back":"af",out:"ag",stepping:"ah",both:"ai",none:"aj"}},ScrollTrap:{componentName:"b",elementNames:{root:0,stabiliser:1},variationSetsNames:{active:"A",axis:"B",automaticallyDisabledForOptimisation:"C"},variationValuesNames:{true:"a",false:"b",horizontal:"e",vertical:"f",both:"g",none:"h"}},Scroll:{componentName:"c",elementNames:{root:0,view:1,scrollContainer:2,content:3,UAScrollbarMeasurer:4,spy:5,startSpacer:6,endSpacer:7},variationSetsNames:{axis:"A",contentPlacement:"B",scrollTrapX:"C",scrollTrapY:"D",scrollGestureOvershoot:"E",scrollDisabled:"F",side:"G",pageScroll:"H",overflowX:"I",overflowY:"J",skipScrollAnimation:"K",scrollAnchoring:"L",scrollSnapType:"M",scrollPadding:"N",scrollTimelineName:"O",nativeScrollbar:"P",scrollOngoing:"Q"},variationValuesNames:{true:"a",false:"b",x:"c",y:"d",both:"e",unset:"f",contain:"g",start:"h",end:"i",center:"j",auto:"k",default:"l",none:"m",mandatoryX:"n",mandatoryY:"o",proximityX:"p",proximityY:"q"}},SlideShow:{componentName:"d",elementNames:{},variationSetsNames:{},variationValuesNames:{}},VisuallyHidden:{componentName:"e",elementNames:{root:0},variationSetsNames:{},variationValuesNames:{}},SpecialWrapper:{componentName:"f",elementNames:{root:0,content:1},variationSetsNames:{},variationValuesNames:{}},Fixed:{componentName:"g",elementNames:{root:0},variationSetsNames:{},variationValuesNames:{}},SheetStack:{componentName:"h",elementNames:{root:0,outlet:1},variationSetsNames:{},variationValuesNames:{}},AutoFocusTarget:{componentName:"i",elementNames:{root:0},variationSetsNames:{},variationValuesNames:{}}}};let mf=hx.mapping,HD=t=>{var e;return(e=mf[t].componentName)!==null&&e!==void 0?e:null},ID=(t,e)=>{var i;return(i=mf[t].elementNames[e])!==null&&i!==void 0?i:null},UD=(t,e)=>{var i;return(i=mf[t].variationSetsNames[e])!==null&&i!==void 0?i:null},FD=(t,e)=>{var i;return(i=mf[t].variationValuesNames[e])!==null&&i!==void 0?i:null},Ui=(t,e)=>w.useCallback((i,n=[],a)=>{var l,u;let h,f,d=(u=a==null||(l=a.dataSilk)===null||l===void 0?void 0:l.filter(Boolean).join(" "))!==null&&u!==void 0?u:"";{let g=HD(t);if(h=g+ID(t,i),e)for(let v=0;v<n.length;v++){let p=n[v],S=e[p],y=UD(t,p),C=FD(t,S);h+=S!=null?" "+g+y+C:""}f={className:a?.className,"data-silk":h+" "+d}}return f},[t,...e?Object.values(e):[]]),du=new WeakMap;var $D=typeof Float32Array=="function";function fd(t,e,i){return(((1-3*i+3*e)*t+(3*i-6*e))*t+3*e)*t}function D1(t,e,i){return 3*(1-3*i+3*e)*t*t+2*(3*i-6*e)*t+3*e}function WD(t){return t}var jD=function(t,e,i,n){if(!(0<=t&&t<=1&&0<=i&&i<=1))throw Error("bezier x values must be in [0, 1] range");if(t===e&&i===n)return WD;for(var a=$D?new Float32Array(11):Array(11),l=0;l<11;++l)a[l]=fd(.1*l,t,i);return function(u){return u===0||u===1?u:fd((function(h){for(var f=0,d=1;d!==10&&a[d]<=h;++d)f+=.1;var g=f+(h-a[--d])/(a[d+1]-a[d])*.1,v=D1(g,t,i);return v>=.001?(function(p,S,y,C){for(var x=0;x<4;++x){var R=D1(S,y,C);if(R===0)break;var L=fd(S,y,C)-p;S-=L/R}return S})(h,g,t,i):v===0?g:(function(p,S,y,C,x){var R,L,N=0;do(R=fd(L=S+(y-S)/2,C,x)-p)>0?y=L:S=L;while(Math.abs(R)>1e-7&&++N<10);return L})(h,f,f+.1,t,i)})(u),e,n)}};let Jd=t=>typeof t=="string"?document.querySelector(t):t?.(),dx=(t,e)=>Array.isArray(t)?t.includes(e):t===e,bg=t=>t?.getAttribute("data-silk-clone")==="true",VD=new Set(["checkbox","radio","range","color","file","image","button","submit","reset"]),Lo=t=>t instanceof HTMLInputElement&&!VD.has(t.type)||t instanceof HTMLTextAreaElement||t instanceof HTMLElement&&t.isContentEditable,O1=t=>t instanceof HTMLInputElement&&t.type==="color"||t instanceof HTMLSelectElement,ev=typeof window<"u"&&window.matchMedia("(prefers-reduced-motion: reduce)").matches,ef=()=>{var t;return window.innerHeight-200>((t=window.visualViewport)===null||t===void 0?void 0:t.height)};function nn({nativeEvent:t,defaultBehavior:e,handler:i}){let n=e;if(i)if(typeof i=="function"){let a={...e,nativeEvent:t,changeDefault:function(l){n={...e,...l},Object.assign(this,l)}};a.changeDefault=a.changeDefault.bind(a),i(a)}else n={...e,...i};return n}function fx(t){return(t.startsWith("rgb(")||t.startsWith("rgba("))&&t.endsWith(")")?t.substring(t.indexOf("(")+1,t.indexOf(")")).split(",").map(n=>n.trim()).slice(0,3).map(n=>parseFloat(n)):null}let B1=t=>{let e=null;return t.startsWith("rgb(")||t.startsWith("rgba(")?e=fx(t):t.startsWith("#")&&(e=(function(i){let n=i.replace(/^#/,""),a=n.length===3?n.split("").map(f=>f+f).join(""):n;if(!/^[0-9A-Fa-f]{6}$/.test(a))return null;let l=parseInt(a.slice(0,2),16),u=parseInt(a.slice(2,4),16),h=parseInt(a.slice(4,6),16);return[l,u,h]})(t)),e},qD=({color:t,overlays:e})=>{let i=[...t],n=e.length;for(let a=0;a<n;a++){let l=e[a],u=l.alpha;for(let h=0;h<3;h++)i[h]=(1-u)*i[h]+u*l.color[h]}return"rgb("+i.join(",")+")"},YD=t=>{w.useEffect(()=>{let e=()=>{ef()?t(!0):t(!1)};return e(),visualViewport.addEventListener("resize",e),()=>{visualViewport.removeEventListener("resize",e)}},[t])},GD=t=>t.matches('[data-silk~="0ad"]:not([data-silk~="0ai"]) *, [data-silk~="0ab"] *'),mx=t=>{let[e,i]=w.useState(!1),n=w.useCallback(a=>{t.current&&i(!!a&&!GD(t.current))},[t]);return YD(n),e},_x=()=>Kt==="android"&&Wn==="chromium"&&typeof window<"u"&&!window.matchMedia("(display-mode: standalone), (display-mode: minimal-ui), (display-mode: fullscreen)").matches,KD=()=>{var t,e,i;return typeof window<"u"&&window.navigator.standalone&&((t=document.querySelector("meta[name='viewport']"))===null||t===void 0?void 0:t.content.includes("viewport-fit=cover"))&&((e=document.querySelector("meta[name='apple-mobile-web-app-capable']"))===null||e===void 0?void 0:e.content)==="yes"&&((i=document.querySelector("meta[name='apple-mobile-web-app-status-bar-style']"))===null||i===void 0?void 0:i.content)==="black-translucent"},Wa=()=>Wn==="webkit",XD=()=>typeof document<"u"?document.querySelector('meta[name="theme-color"]'):null,Hu=({genericContext:t,customContext:e,value:i,children:n})=>e?U.jsx(e.Provider,{value:i,children:U.jsx(t.Provider,{value:i,children:n})}):U.jsx(t.Provider,{value:i,children:n});Hu.displayName="CustomisableContext";function wg(t){for(let e=0;e<t.length;e++)if(!t[e].matches('[data-silk~="0ad"]'))return t[e];return t[0]}let px=(t,e)=>{var i;let{safelyFocusableElements:n,safelyTabbableElements:a}=_f(e,["[data-silk~='0ac']"]),l=Ge.autoFocusTargets.filter(v=>v.layerId==="any"||v.layerId===t),u=l.filter(v=>dx(v.timing,"present")),h=n.filter(v=>u.map(p=>p.element).includes(v)),f=wg(h),d=wg(a);((i=f??d)!==null&&i!==void 0?i:e).focus({preventScroll:!0})},N1=(t,e,i)=>{let{focus:n}=nn({nativeEvent:null,defaultBehavior:{focus:!0},handler:i});n&&px(t,e)},ZD=(t,e,i,n)=>{if(!e.contains(document.activeElement)&&document.contains(document.activeElement))return;let{focus:a}=nn({nativeEvent:null,defaultBehavior:{focus:!0},handler:i});if(a){var l;let u=Ge.autoFocusTargets.filter(p=>p.layerId==="any"||p.layerId===t),h=u.filter(p=>dx(p.timing,"dismiss")&&!e.contains(p.element)),{safelyFocusableElements:f}=_f(document.body),d=f.filter(p=>h.map(S=>S.element).includes(p)),g=wg(d);((l=g??n)!==null&&l!==void 0?l:document.body).focus({preventScroll:!0})}},P1=t=>{t.parentNode!=null&&t.parentNode.removeChild(t)},z1=()=>{let t=document.createElement("div");return t.tabIndex=0,t.style.position="fixed",t.setAttribute("aria-hidden","true"),t.setAttribute("data-silk","0aa"),t},QD=t=>{let e=z1(),i=z1();return t.insertAdjacentElement("beforebegin",e),t.insertAdjacentElement("afterend",i),()=>{P1(e),P1(i)}},JD=t=>!!(t.offsetWidth||t.offsetHeight||t.getClientRects().length),_f=(t,e=[])=>{let i=["input:not([disabled]):not([type=hidden])","select:not([disabled])","textarea:not([disabled])","button:not([disabled])","a[href]","area[href]","summary","iframe","object","embed","audio[controls]","video[controls]","[contenteditable]","[tabindex]:not([disabled])",...e],n=i.join(","),a=t?[...t.matches(n)?[t]:[],...t.querySelectorAll(n)]:[],l=[...e,"[aria-hidden='true']","[aria-hidden='true'] *","[inert]","[inert] *"],u=a.map(p=>({element:p,tabbable:p.matches(':not([hidden]):not([tabindex^="-"])'),skippable:p.matches(l.join(","))||!JD(p)})),h=u.filter(p=>!p.skippable),f=h.map(p=>p.element),d=u.filter(p=>p.tabbable),g=d.filter(p=>!p.skippable),v=g.map(p=>p.element);return{allFocusableElementsWithData:u,safelyFocusableElements:f,allTabbableElementsWithData:d,safelyTabbableElements:v}},gx=(t,e)=>{let{safelyTabbableElements:i,allTabbableElementsWithData:n,allFocusableElementsWithData:a}=_f(t,["[data-silk~='0ac']"]),l=[...n],u=[...a];return e&&[l,u].forEach(h=>{h.unshift({element:t.previousElementSibling,tabbable:!0,skippable:!0}),h.push({element:t.nextElementSibling,tabbable:!0,skippable:!0})}),{safelyTabbableElements:i,allTabbableElementsWithGuardsWithData:l,allFocusableElementsWithGuardsWithData:u}},eO=(t,e)=>{let i;return(i=e.slice(0,t).reverse().find(n=>n.skippable===!1))||(i=e.slice(t+1-e.length).reverse().find(n=>n.skippable===!1)),i},H1=(t,e)=>{let i;return(i=e.slice(t+1).find(n=>n.skippable===!1))||(i=e.slice(0,t).find(n=>n.skippable===!1)),i},tO=({rootElements:t,e,fromElement:i,toElement:n,fallbackElement:a})=>{if(!n)return;let l=[],u=[],h=[];t.forEach(x=>{let{safelyTabbableElements:R,allTabbableElementsWithGuardsWithData:L,allFocusableElementsWithGuardsWithData:N}=gx(x,!0);l=[...l,...R],u=[...u,...L],h=[...h,...N]});let f=u.findIndex(x=>x.element===i),d=u.findIndex(x=>x.element===n),g=u[d],v=h.findIndex(x=>x.element===n),p=!!n&&t.includes(n)&&n.getAttribute("tabindex")==="-1";if(v===-1&&!p){let x=t.find(R=>R.getAttribute("tabindex")==="-1");x?.focus()}if(g?.skippable){var S,y,C;l.length?l.length===1?i===l[0]?(e.preventDefault(),e.stopPropagation(),requestAnimationFrame(()=>i.focus())):l[0].focus():f?d<f?(y=eO(d,u))===null||y===void 0||y.element.focus():(C=H1(d,u))===null||C===void 0||C.element.focus():(S=H1(d,u))===null||S===void 0||S.element.focus():a?.focus()}},vx=(t,e,i,n,a)=>{var l;if(!((l=t.target)===null||l===void 0)&&l.matches("[data-silk-clone]"))return;let u=[],h=[];i.forEach(f=>{let{safelyFocusableElements:d,safelyTabbableElements:g}=_f(f);u=[...u,...d],h=[...h,...g]}),i.includes(t.target)||u.includes(t.target)?t.target&&a(t.target):n?n.focus():h.length?h[0].focus():e.focus()},iO=(t,e)=>{var i;if(!((i=t.relatedTarget)===null||i===void 0)&&i.matches("[data-silk-clone]"))return;let n=Ld??t.target,a=Vl??t.relatedTarget;tO({rootElements:e,e:t,fromElement:n,toElement:a}),Ld=null,Vl=null},sO=(t,e,i,n,a)=>{let l=i.find(u=>u.contains(t.target));t.key!=="Tab"||l||(t.preventDefault(),t.stopPropagation(),vx(t,e,i,n,a))},Ld=null,Vl=null,rO=({rootElements:t,viewElement:e,elementFocusedLast:i,setElementFocusedLast:n})=>{let a=[];t.forEach(d=>{a.push(QD(d))});let l=(function(d,g=document){let v=new Set(d),p=new Set,S=document.createTreeWalker(g,NodeFilter.SHOW_ELEMENT,{acceptNode:R=>(R instanceof HTMLElement&&R.dataset.liveAnnouncer==="true"&&v.add(R),R.tagName==="HEAD"||R.tagName==="SCRIPT"||v.has(R)||R.parentElement&&p.has(R.parentElement)?NodeFilter.FILTER_REJECT:R instanceof HTMLElement&&R.getAttribute("role")==="row"||d.some(L=>R.contains(L))?NodeFilter.FILTER_SKIP:NodeFilter.FILTER_ACCEPT)}),y=R=>{var L;let N=(L=du.get(R))!==null&&L!==void 0?L:0;(R.getAttribute("aria-hidden")!=="true"||N!==0)&&(N===0&&R.setAttribute("aria-hidden","true"),p.add(R),du.set(R,N+1))},C=S.nextNode();for(;C!=null;)y(C),C=S.nextNode();let x=new MutationObserver(R=>{for(let L of R)if(L.type==="childList"&&L.addedNodes.length!==0&&![...v,...p].some(N=>N.contains(L.target)))for(let N of L.addedNodes)N instanceof HTMLElement&&N.dataset.liveAnnouncer==="true"?v.add(N):N instanceof Element&&y(N)});return x.observe(g,{childList:!0,subtree:!0}),()=>{for(let R of(x.disconnect(),p)){let L=du.get(R);L===1?(R.removeAttribute("aria-hidden"),du.delete(R)):L!==void 0&&du.set(R,L-1)}}})(t,document),u=d=>iO(d,t),h=d=>vx(d,e,t,i,n),f=d=>sO(d,e,t,i,n);return document.addEventListener("keydown",f),document.addEventListener("focusout",u),document.addEventListener("focusin",h),()=>{document.removeEventListener("focusout",u),document.removeEventListener("focusin",h),document.removeEventListener("keydown",f),l(),a.forEach(d=>d())}},pf=new Set,nO=t=>{pf.add(t)},aO=t=>{pf.delete(t)},Sx=(t,e,i,n)=>{let a=t[e],l=a.onClickOutside,u=a.dismissOverlayIfNotAlertDialog,h=a.viewElement,f=a.scrollContainerElement,d=a.backdropElement;if(f===n.target||d===n.target||!h?.contains(n.target)&&!i.find(g=>g.element.contains(n.target))&&(function(g){for(let v of Ge.automaticLayerElements)if(v.contains(g))return!1;return!0})(n.target)){let g=!0,v=!0;if(l){let{dismiss:p,stopOverlayPropagation:S}=nn({nativeEvent:n,defaultBehavior:{dismiss:!0,stopOverlayPropagation:!0},handler:l});g=p,v=S}g&&u&&u(),e>0&&!v&&Sx(t,e-1,i,n)}},Cg=null,oO=(t,e,i)=>{var n;if(pf.size||!((n=t.target)===null||n===void 0)&&n.matches('[data-silk~="0ak"] *')||t.target===document.body&&Cg!==document.body||!t.target||!t.target.isConnected)return;let a=e.length;Sx(e,a-1,i,t),Cg=null},lO=(t,e)=>{let i=a=>Cg=a.target,n=a=>oO(a,t,e);return document.addEventListener("pointerdown",i,{capture:!0}),document.addEventListener("click",n,{capture:!0}),()=>{document.removeEventListener("pointerdown",i,{capture:!0}),document.removeEventListener("click",n,{capture:!0})}},yx=(t,e,i)=>{let n=t[e],a=n.onEscapeKeyDown,l=n.dismissOverlayIfNotAlertDialog,u=!0,h=!0,f=!0;if(a){let{dismiss:d,nativePreventDefault:g,stopOverlayPropagation:v}=nn({nativeEvent:i,defaultBehavior:{nativePreventDefault:!0,dismiss:!0,stopOverlayPropagation:!0},handler:a});u=g,h=d,f=v}u&&i.preventDefault(),h&&l&&l(),e>0&&!f&&yx(t,e-1,i)},cO=(t,e)=>{if(t.key!=="Escape"||pf.size)return;let i=e.length;yx(e,i-1,t)},uO=t=>{let e=i=>cO(i,t);return document.addEventListener("keydown",e),()=>{document.removeEventListener("keydown",e)}},hO=t=>(t.setAttribute("aria-hidden","true"),()=>t.removeAttribute("aria-hidden")),dO=t=>{let{allTabbableElementsWithGuardsWithData:e}=gx(t);e.forEach(i=>{i.element.tabIndex=-1})},fO=t=>{var e;return t instanceof HTMLInputElement&&(!!(t.type==="password"||t.type==="text"&&t.autocomplete==="username"||!((e=t.closest("form"))===null||e===void 0)&&e.querySelector('input[type="password"]'))||void 0)},mO=t=>{var e,i;let n=t.getBoundingClientRect(),a=n.height,l=(i=(e=window.visualViewport)===null||e===void 0?void 0:e.height)!==null&&i!==void 0?i:0,u=l-n.bottom;return u>-a/2&&u<a+32},gp=t=>{var e;return(e=t?.closest('[data-silk~="0ab"], [data-silk~="0ad"]'))===null||e===void 0?void 0:e.matches('[data-silk~="0ah"]')},_O=()=>{let t=a=>{let l=a.target;if(gp(l)){var u;(u=l?.closest('[data-silk~="0ah"]'))===null||u===void 0||u.focus({preventScroll:!0}),document.removeEventListener("touchstart",t,{capture:!0})}},e=a=>{let l=a.target,u=a.relatedTarget;if(!u)return document.addEventListener("touchstart",t,{capture:!0,passive:!1});if(gp(u)&&(O1(u)&&document.addEventListener("touchstart",t,{capture:!0,passive:!1}),!(!Lo(u)&&!O1(u)||bg(l))))if(!fO(u)&&Lo(l)&&mO(l)){let h=l.cloneNode(!1);h.removeAttribute("id"),h.setAttribute("data-silk-clone","true"),h.style.setProperty("position","fixed"),h.style.setProperty("left","0"),h.style.setProperty("top","0"),h.style.setProperty("transform","translateY(-3000px) scale(0)"),document.documentElement.appendChild(h),Vl=u,h?.focus({preventScroll:!0}),setTimeout(()=>{Ld=l,Vl=u,u?.focus({preventScroll:!0}),h.remove()},32)}else Vl=u,u?.focus({preventScroll:!0})},i=a=>{var l;let u=a.target;!(u!==document.activeElement||!Lo(u)||ef())&&gp(u)&&((l=u?.closest('[data-silk~="0ab"], [data-silk~="0ad"]'))===null||l===void 0||l.focus({preventScroll:!0}))},n=a=>{var l;let u=a.target;if(!u||!("setSelectionRange"in u)||!(["password","search","tel","text","url"].includes(u.type)||u instanceof HTMLTextAreaElement)||u._silk_focusedBefore===!0)return;let h=u.value.length;(l=u.setSelectionRange)===null||l===void 0||l.call(u,h,h),u._silk_focusedBefore=!0};return document.addEventListener("blur",e,{capture:!0,passive:!1}),document.addEventListener("touchstart",t,{capture:!0,passive:!0}),document.addEventListener("touchend",i,{capture:!0,passive:!0}),document.addEventListener("focusin",n),()=>{document.removeEventListener("blur",e,{capture:!0}),document.removeEventListener("touchend",i,{capture:!0}),document.removeEventListener("touchstart",t,{capture:!0}),document.removeEventListener("focusin",n)}},bx=["translate","translateX","translateY","translateZ","scale","scaleX","scaleY","scaleZ","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],wx=null,Cx=t=>{wx=t},pO={sheets:[],addSheet:function(t){let e;if(!t.id)return;let i=this.findSheet(t.id);return i?(t.stackId&&(i.stackId=t.stackId),t.sendToOpennessMachine&&(i.sendToOpennessMachine=t.sendToOpennessMachine),e=i):(e={stackingIndex:-1,travelAnimations:[],aggregatedTravelCallback:function(n,a){let l=this.travelAnimations;for(let u=0,h=l.length;u<h;u++)l[u].callback(n,a)},stackingAnimations:[],aggregatedStackingCallback:function(n,a){let l=this.stackingAnimations;for(let u=0,h=l.length;u<h;u++)l[u].callback(n,a)},belowSheetsInStack:[],outlets:new Set,...t},this.sheets.push(e)),this.updateBelowSheetsInStackOfAllSheets(),e},attemptToRemoveSheet:function(t,e){let i=this.findSheet(t);if(i)if(i.outlets.size===0){var n;let a=(n=this.findSheet(t))===null||n===void 0?void 0:n.stackId;this.sheets=this.sheets.filter(l=>l.id!==t),a&&this.updateSelfAndAboveTravelProgressSumInStack(a)}else e&&e(i)},attemptToRemoveSheetOrCleanup:function(t){this.attemptToRemoveSheet(t,e=>{e.sendToOpennessMachine=null})},findSheet:function(t){return this.sheets.find(e=>e.id===t)},addOutletToSheet:function(t,e){let i=this.findSheet(t);i?i.outlets.add(e):this.addSheet({id:t,outlets:new Set([e])})},removeOutletFromSheet:function(t,e){let i=this.findSheet(t);i?.outlets.delete(e),this.attemptToRemoveSheet(t)},sheetStacks:[],addSheetStack:function(t){let e;return this.findSheetStack(t.id)||(e={stackingAnimations:[],aggregatedStackingCallback:function(n,a){let l=this.stackingAnimations;for(let u=0,h=l.length;u<h;u++)l[u].callback(n,a)},...t},this.sheetStacks.push(e)),this.updateBelowSheetsInStackOfAllSheets(),e},removeSheetStack:function(t){t&&(this.sheetStacks=this.sheetStacks.filter(e=>e.id!==t),this.removeAllOutletPersistedStylesFromStack(t))},findSheetStack:function(t){return this.sheetStacks.find(e=>e.id===t)},updateBelowSheetsInStackOfAllSheets:function(){this.sheets.forEach(t=>{let e,i=t.stackId;if(i){e=this.findSheetStack(i);let n=this.sheets.filter(l=>l.stackId===t.stackId),a=n.filter(l=>l.stackId===t.stackId&&l.stackingIndex>t.stackingIndex);e&&(a.unshift(e),e.stackingIndex=n.length-1),t.belowSheetsInStack=a,this.updateSelfAndAboveTravelProgressSumInStack(i)}})},updateSheetStackingIndex:function(t,e){let i=this.findSheet(t);i&&(i.stackingIndex=e),this.updateBelowSheetsInStackOfAllSheets()},updateSheetTravelProgress:function(t,e){let i=this.findSheet(t);i&&i.stackId&&(i.travelProgress=e,this.updateSelfAndAboveTravelProgressSumInStack(i.stackId))},updateSelfAndAboveTravelProgressSumInStack:function(t){let e=this.sheets.filter(a=>a.stackId===t).sort((a,l)=>l.stackingIndex-a.stackingIndex),i=this.findSheetStack(t);i&&e.unshift(i);let n=e.length;for(let a=0;a<n;a++){let l=e[a];l.selfAndAboveTravelProgressSum=[];for(let u=0;u<n;u++)u<=a?l.selfAndAboveTravelProgressSum[u]=0:l.selfAndAboveTravelProgressSum[u]=e.slice(a+1,u+1).reduce((h,f)=>h+f.travelProgress,0)}},addAnimationToSheetOrStack:function({type:t,sheetId:e,stackId:i,element:n,config:a}){let l=a.hasOwnProperty("properties")?a.properties:a,u=[];Object.entries(l).forEach(([v,p])=>{if(p!=="ignore"&&p&&typeof p!="string")if(typeof p=="function")if(bx.includes(v)){let S=u.findIndex(C=>C[0]==="transform"),y=C=>v+"("+p(C)+")";if(S!==-1){let C=u[S][1];u[S][1]=x=>C(x)+" "+y(x)}else u.push(["transform",y])}else if(v==="transform"){let S=u.findIndex(y=>y[0]==="transform");if(S!==-1){let y=u[S][1];u[S][1]=C=>y(C)+" "+p(C)}else u.push(["transform",p])}else u.push([v,p]);else if(v==="opacity"){let S=["opacity",({tween:y})=>y(p[0],p[1])];u.push(S)}else{if(!v.startsWith("scale")&&(!isNaN(p[0])||!isNaN(p[1])))throw Error("Keyframe values used with a 'transform' property require a unit (e.g. 'px', 'em' or '%').");let S=u.findIndex(C=>C[0]==="transform"),y=({tween:C})=>v+"("+C(p[0],p[1])+")";if(S!==-1){let C=u[S][1];u[S][1]=x=>C(x)+" "+y(x)}else u.push(["transform",y])}});let h=u.map(v=>[(v[0].startsWith("webkit")||v[0].startsWith("moz")?"-":"")+v[0].replace(/[A-Z]/g,"-$&").toLowerCase(),v[1]]),f=h.length,d={target:n,config:u,dashedPropertiesAsArray:h,callback:(v,p)=>{for(let S=0;S<f;S++){let[y,C]=h[S];n.style.setProperty(y,C({progress:v,tween:p}))}}},g=i?this.findSheetStack(i):this.findSheet(e);g&&(t==="travel"?g.travelAnimations.push(d):g.stackingAnimations.push(d))},removeAnimationFromSheetOrStack:function({sheetId:t,stackId:e,type:i,element:n}){let a=e?this.findSheetStack(e):this.findSheet(t);if(a)if(i==="travel"){let l=a.travelAnimations.filter(u=>u.target!==n);a.travelAnimations=l}else{let l=a.stackingAnimations.filter(u=>u.target!==n);a.stackingAnimations=l}},removeAllOutletPersistedStylesFromSheet:function(t){let e=this.findSheet(t);e&&[...e.travelAnimations,...e.stackingAnimations].forEach(i=>{i.dashedPropertiesAsArray.forEach(([n])=>{i.target.style.removeProperty(n)})})},removeAllOutletPersistedStylesFromStack:function(t){let e=this.findSheetStack(t);e&&e.stackingAnimations.forEach(i=>{i.dashedPropertiesAsArray.forEach(([n])=>{i.target.style.removeProperty(n)})})},getAggregatedStackingCallbackForSheetsBelow:function(t){let e,i=this.findSheet(t);return i&&(e=n=>{let a=i.belowSheetsInStack,l=a.length;for(let u=0;u<l;u++){let h=a[u],f=h.selfAndAboveTravelProgressSum[l-1]+n,d=Fl(f);h.aggregatedStackingCallback(f,d)}}),e},automaticIslandElements:new Set([]),automaticLayerElements:new Set([]),automaticLayerAndIslandDetectionCleanup:null,focusContainmentRootElements:[],focusContainmentCleanup:()=>{},escapeKeyDownListenerCleanup:null,clickOutsideListenerCleanup:null,processLayersAndIslandsChangesTimeout:null,setupAutomaticLayerAndIslandDetection:function(t){let e=document.documentElement,i=document.body,n=()=>{let l,u=new Set([]),h=new Set([]),f=(function(x){let R=x.parentElement;for(;R&&R!==document.body;){if(R.parentElement===document.body)return R;R=R.parentElement}return x.parentElement===document.body?x:null})(t);l=f?f.nextElementSibling:i.firstElementChild;let d=x=>x.matches('[data-silk~="0ag"], [data-silk~="0ab"], [data-silk~="0aa"], [data-silk-clone]'),g=x=>x.tagName!=="SCRIPT";for(;l;)!d(l)&&g(l)&&u.add(l),l=l.nextElementSibling;let v=e.children;for(let x=0;x<v.length;x++){let R=v[x];R.tagName==="HEAD"||R.tagName==="BODY"||d(R)||h.add(R)}let p=new Set([...u].filter(x=>!this.automaticLayerElements.has(x))),S=new Set([...this.automaticLayerElements].filter(x=>!u.has(x)));this.automaticLayerElements=u;let y=new Set([...h].filter(x=>!this.automaticIslandElements.has(x))),C=new Set([...this.automaticIslandElements].filter(x=>!h.has(x)));this.automaticIslandElements=h,p.forEach(x=>{this.updateLayer({automatic:!0,layerId:null,viewElement:x,inertOutside:!1,onPresentAutoFocus:{focus:!1},onDismissAutoFocus:{focus:!1},dismissOverlayIfNotAlertDialog:()=>{},onClickOutside:{stopOverlayPropagation:!1},onEscapeKeyDown:{stopOverlayPropagation:!1}})}),S.forEach(x=>this.removeLayer(null,x)),y.forEach(x=>this.addIsland({element:x,automatic:!0})),C.forEach(x=>this.removeIsland(null,x))};n();let a=new MutationObserver(()=>{n()});a.observe(e,{childList:!0}),a.observe(i,{childList:!0}),this.automaticLayerAndIslandDetectionCleanup=function(){a.disconnect(),this.layers.forEach(l=>{l.automatic&&this.removeLayer(null,l.viewElement)}),this.automaticLayerElements=new Set([]),this.islands.forEach(l=>{l.automatic&&this.removeIsland(null,l.element)}),this.automaticIslandElements=new Set([]),this.automaticLayerAndIslandDetectionCleanup=null}},moveFocusIfNecessary:function(t,e,i,n,a,l){let u=!1;for(let h=0;h<e.length;h++)if(e[h].contains(document.activeElement)){u=!0;break}if(i.length){let h=i.filter(f=>!f.automatic&&!f.external);if(h.length){let f=h[h.length-1];return N1(f.layerId,f.viewElement,f.onPresentAutoFocus)}}if(a.length&&!u){let h=t[t.length-1];if(!h.external)return N1(h.layerId,h.viewElement,h.onPresentAutoFocus)}if(n.length&&n.find(f=>f.focusWasInside)){let f=n[0];if(!f.external)return ZD(f.layerId,f.viewElement,f.onDismissAutoFocus,f.elementFocusedLastBeforeShowing)}if(l.length&&l.find(f=>f.focusWasInside)){let f=t[t.length-1];if(f)return px(f.layerId,f.viewElement)}},processLayersAndIslandsChanges:function(){var t;clearTimeout(this.processLayersAndIslandsChangesTimeout);let e=()=>{let n=this.layers.length,a=new Set([]),l;if(this.layers.some(v=>v.inertOutside)){this.islands.filter(p=>!p.componentId||p.componentId.length===0).forEach(p=>a.add(p.element));for(let p=n-1;p>=0;p--){let S=this.layers[p];if(S.external&&S.inertOutside){a=new Set([]);break}a.add(S.viewElement);let y=this.islands.filter(x=>x.componentId&&S.layerContextId&&x.componentId.includes(S.layerContextId)),C=this.islands.filter(x=>x.componentId&&S.layerStackContextId&&x.componentId.includes(S.layerStackContextId));if([...y,...C].forEach(x=>{a.add(x.element)}),S.inertOutside){l=S;break}l=S}}let h=[...a],f=!(function(v,p){if(v.length!==p.length)return!1;let S=new Set;for(let y of v)S.add(y);for(let y of p)if(!S.has(y))return!1;return!0})(this.focusContainmentRootElements,h);if(this.focusContainmentRootElements=h,f){var d;this.focusContainmentCleanup(),this.focusContainmentCleanup=()=>{},(d=this.automaticLayerAndIslandDetectionCleanup)===null||d===void 0||d.call(this),l&&(this.setupAutomaticLayerAndIslandDetection(l?.viewElement),this.focusContainmentCleanup=rO({rootElements:this.focusContainmentRootElements,viewElement:l?.viewElement,elementFocusedLast:wx,setElementFocusedLast:Cx}))}this.moveFocusIfNecessary(this.layers,this.focusContainmentRootElements,this.layersJustAdded,this.layersJustRemoved,this.layersJustWentToInertOutsideTrue,this.islandsJustRemoved),this.escapeKeyDownListenerCleanup&&(this.escapeKeyDownListenerCleanup(),this.escapeKeyDownListenerCleanup=null),this.clickOutsideListenerCleanup&&(this.clickOutsideListenerCleanup(),this.clickOutsideListenerCleanup=null),n>0&&(this.escapeKeyDownListenerCleanup=uO(this.layers),this.clickOutsideListenerCleanup=lO(this.layers,this.islands));let g=this.layersJustRemoved.length;if(g)for(let v=0;v<g;v++){let p=this.layersJustRemoved[v],S=p.viewElement,y=p.automatic;S&&!y&&(hO(S),dO(S))}this.islandsJustRemoved=[],this.layersJustAdded=[],this.layersJustRemoved=[],this.layersJustWentToInertOutsideTrue=[]};((t=this.layersJustAdded[this.layersJustAdded.length-1])===null||t===void 0?void 0:t.external)?e():this.processLayersAndIslandsChangesTimeout=setTimeout(e,16)},autoFocusTargets:[],addAutoFocusTarget:function({layerId:t,element:e,timing:i}){this.autoFocusTargets.push({layerId:t,element:e,timing:i})},removeAutoFocusTarget:function(t){this.autoFocusTargets=this.autoFocusTargets.filter(e=>e.element!==t)},islands:[],islandsJustRemoved:[],addIsland:function(t){var e;let i=this.islands[this.islands.length-1],n=((e=t.id)!==null&&e!==void 0?e:i)?i.id+1:0;return this.islands.push({...t,id:n}),this.processLayersAndIslandsChanges(),n},removeIsland:function(t,e){this.islands=this.islands.filter(i=>{if(t&&i.id&&i.id!==t||e&&i.element&&i.element!==e)return!0;{let n=i.element.contains(document.activeElement);return this.islandsJustRemoved.push({...i,focusWasInside:n}),!1}}),this.processLayersAndIslandsChanges()},layers:[],layersJustAdded:[],layersJustRemoved:[],layersJustWentToInertOutsideTrue:[],updateLayer:function(t){let e=t.layerId,i=t.viewElement,n=!1,a=this.layers;for(let u=0;u<a.length;u++){let h=a[u];if(e!==null?h.layerId===e:h.viewElement===i){let d={...h,...t};!h.inertOutside&&t.inertOutside&&this.layersJustWentToInertOutsideTrue.push(d),a[u]=d,n=!0;break}}if(!n){var l;let u={...t,elementFocusedLastBeforeShowing:(l=t.elementFocusedLastBeforeShowing)!==null&&l!==void 0?l:document.activeElement};a.push(u),this.layersJustAdded.push(u)}this.processLayersAndIslandsChanges()},removeLayer:function(t,e){var i;this.layers=this.layers.filter(n=>{if(t&&n.layerId&&n.layerId!==t||e&&n.viewElement&&n.viewElement!==e)return!0;{var a;let l=(a=n.viewElement)===null||a===void 0?void 0:a.contains(document.activeElement);return this.layersJustRemoved.push({...n,focusWasInside:l}),!1}}),this.layers.filter(n=>!n.automatic).length===0&&((i=this.automaticLayerAndIslandDetectionCleanup)===null||i===void 0||i.call(this)),this.processLayersAndIslandsChanges()},nativeFocusScrollPreventers:[],nativeFocusScrollPreventionCleanup:null,addNativeFocusScrollPreventer:function(t){this.nativeFocusScrollPreventers.push({id:t}),this.processNativeFocusScrollPreventersChanges()},removeNativeFocusScrollPreventer:function(t){this.nativeFocusScrollPreventers=this.nativeFocusScrollPreventers.filter(e=>e.id!==t),this.processNativeFocusScrollPreventersChanges()},processNativeFocusScrollPreventersChanges:function(){let t=this.nativeFocusScrollPreventers.length;if(Wa()&&(Kt==="ios"||Kt==="ipados"))if(t)this.nativeFocusScrollPreventionCleanup||(this.nativeFocusScrollPreventionCleanup=_O());else{var e;(e=this.nativeFocusScrollPreventionCleanup)===null||e===void 0||e.call(this),this.nativeFocusScrollPreventionCleanup=null}},fixedComponents:[],addFixedComponent:function(t){this.fixedComponents.push(t)},updateFixedComponent:function(t){let e=this.fixedComponents.find(i=>i.id===t.id);e&&(t.element&&(e.element=t.element),t.initialInlineCSSTransform&&(e.initialInlineCSSTransform=t.initialInlineCSSTransform),typeof t.compensated=="boolean"&&(e.compensated=t.compensated))},removeFixedComponent:function(t){this.fixedComponents=this.fixedComponents.filter(e=>e.id!==t)},findActualFixedComponentsInsideOutlet:function(t){return this.fixedComponents.filter(e=>{if(e.element&&t)return t.contains(e.element)&&window.getComputedStyle(e.element).getPropertyValue("position")==="fixed"})},themeColorMetaTag:null,underlyingThemeColor:null,themeColorDimmingOverlays:[],storeThemeColorMetaTag:function(){if(this.themeColorMetaTag=XD(),!this.themeColorMetaTag){let t=document.createElement("meta");t.name="theme-color",t.content=window.getComputedStyle(document.body).backgroundColor,document.head.appendChild(t),this.themeColorMetaTag=t}},getAndStoreUnderlyingThemeColorAsRGBArray:function(){let t;if(this.themeColorDimmingOverlays.length>0)t=this.underlyingThemeColor;else{var e;this.themeColorMetaTag||this.storeThemeColorMetaTag();let i=(e=this.themeColorMetaTag)===null||e===void 0?void 0:e.content;(t=B1(i))||(console.warn("`themeColorDimming` prop ignored: Only `theme-color` meta tag with a value in `rgb()`, `rgba()`, or hexadecimal format is supported."),t=[0,0,0]),this.underlyingThemeColor=t}return t},updateUnderlyingThemeColor:function(t){let e=B1(t);if(!e)throw Error("The color provided to `updateThemeColor` doesn't match `rgb()`, `rgba()`, or hexadecimal format.");this.underlyingThemeColor=e,this.setActualThemeColor()},setActualThemeColor:function(){var t;this.themeColorMetaTag||this.storeThemeColorMetaTag(),(t=this.themeColorMetaTag)===null||t===void 0||t.setAttribute("content",qD({color:this.underlyingThemeColor,overlays:this.themeColorDimmingOverlays}))},findThemeColorDimmingOverlay:function(t){return this.themeColorDimmingOverlays.find(e=>e.dimmingOverlayId===t)},findIndexThemeColorDimmingOverlay:function(t){return this.themeColorDimmingOverlays.findIndex(e=>e.dimmingOverlayId===t)},updateThemeColorDimmingOverlay:function(t){let e=t;e.color&&(e={...e,color:fx(e.color)});let i=this.findThemeColorDimmingOverlay(e.dimmingOverlayId);return i?Object.assign(i,e):(i=e,this.themeColorDimmingOverlays.push(e)),this.setActualThemeColor(),i},updateThemeColorDimmingOverlayAlphaValue:function(t,e){t.alpha=e,this.setActualThemeColor()},removeThemeColorDimmingOverlay:function(t){let e=this.findThemeColorDimmingOverlay(t);e&&(e.abortRemoval=!1,setTimeout(()=>{e?.abortRemoval||(this.themeColorDimmingOverlays=this.themeColorDimmingOverlays.filter(i=>i.dimmingOverlayId!==t),this.setActualThemeColor(),this.themeColorDimmingOverlays.length!==0||(this.underlyingThemeColor=null,this.themeColorMetaTag=null))},20))}};var Ge=pO;let xx=t=>{let e=w.useRef(null);return vi(()=>{e.current=t}),w.useCallback((...i)=>{let n=e.current;return n(...i)},[])},tv=t=>t==="layout"?vi:w.useEffect,xg=t=>{var e=t?.lastIndexOf(":");return e===-1?"":t?.substring(e+1)},gO=t=>{let e=[],i=[],n=(a,l,{partOfInitial:u})=>{Array.isArray(a)?a.forEach(h=>n(h,l,{partOfInitial:u})):(l+=(l?".":"")+a.name,u&&i.push(l+":"+a.initial),Object.entries(a.states).forEach(([h,f])=>{let d=l+":"+h;f.machine=l,f.path=d,f.reactive=!a.silentOnly,e.push(f),f.machines&&n(f.machines,d,{partOfInitial:u&&a.initial===h})}))};return n(t,"",{partOfInitial:!0}),[i,e]},I1=(t,e)=>t.includes(":")?t:e.substring(0,e.lastIndexOf(":")+1)+t,U1=t=>{let e=t.split("."),i=[];return e.forEach((n,a)=>{let l=i[a-1],u=(l?l.full+".":"")+n,h=u.substring(0,u.lastIndexOf(":")),f=u.substring(u.lastIndexOf(":")+1);i.push({full:u,withoutState:h,state:f})}),i},vO=({checkedPoolOfStates:t,referencePoolOfStates:e,callbackOnExclusion:i,callbackOnPresent:n})=>t.filter(l=>{let u=!0;return l.forEach(h=>{e.forEach(f=>{f.forEach(d=>{h.withoutState===d.withoutState&&(h.state!==d.state?(u=!1,i?.({decomposedCheckedState:l,checkedStatePiece:h,decomposedReferenceState:f,referenceStatePiece:d})):n({decomposedCheckedState:l,checkedStatePiece:h,decomposedReferenceState:f,referenceStatePiece:d}))})})}),u}),SO=t=>{let[e,i]=gO(t);return[e,(n,a)=>{let l,u=typeof a=="string"?a:a.type,h=[];i.forEach(T=>{n.includes(T.path)&&(!a.machine||a.machine===T.machine)&&T.messages&&Object.entries(T.messages).forEach(([W,D])=>{if(W===u){if(typeof D=="string")l=W,h.push(I1(D,T.path));else for(let I of D)if(!I.guard||I.guard(n,a)){l=W,h.push(I1(I.target,T.path));break}}})});let f=n.map(T=>U1(T)),d=h.map(T=>U1(T)),g=[],v=vO({checkedPoolOfStates:f,referencePoolOfStates:d,callbackOnExclusion:({decomposedCheckedState:T})=>{g.push(T[T.length-1].full)},callbackOnPresent:({referenceStatePiece:T})=>{T.unchanged=!0}}),p=v.map(T=>T[T.length-1].full),S=[],y=[];d.forEach(T=>{T.forEach((W,D)=>{if(!W.unchanged){var I,H;D<T.length-1&&S.push(W.full);let V=i.find(se=>se.path===W.full);(I=V.machines)===null||I===void 0||(H=I.forEach)===null||H===void 0||H.call(I,se=>{let Q=()=>{d.find(O=>O.find(P=>P.withoutState===`${V.path}.${se.name}`))||y.push(`${V.path}.${se.name}:${se.initial}`)};D<T.length-1?V.path+se.name!==T[D+1].withoutState&&Q():Q();let A=O=>{var P,$;(P=i.find(M=>M.path===O).machines)===null||P===void 0||($=P.forEach)===null||$===void 0||$.call(P,M=>{d.find(z=>z.find(q=>q.withoutState===`${V.path}.${M.name}`))||y.push(`${O}.${M.name}:${M.initial}`),A(`${O}.${M.name}:${M.initial}`)})};A(`${V.path}.${se.name}:${se.initial}`)})}})});let C=[...h,...S,...y],x=[...p,...C],R=[...g,...C],L=i.filter(T=>R.includes(T.path)),N=L.some(T=>T.reactive);return{exitedStates:g,transitionTaken:l,enteredStates:C,nextStates:x,reactive:N}}]},Dd=(t,e)=>t?.toStrings().filter(i=>i?.startsWith(e)).filter(i=>{var n;return!(!((n=i?.slice(e.length))===null||n===void 0)&&n.includes("."))})[0],F1=t=>{let[e,i]=w.useMemo(()=>SO(t),[t]),n=w.useRef(),a=w.useRef([]),l=w.useRef([]),u=w.useRef([]),h=w.useRef([]),f=w.useRef(e),d=w.useRef({toStrings:()=>e,matches:y=>zo(e,y),lastMessageTreatedRef:n,exitActionsRef:a,transitionActionsRef:l,entryActionsRef:u,selectorsRef:h}),[g,v]=w.useState({...d.current,silent:d.current}),p=w.useRef([]),S=w.useCallback(y=>{p.current.push(y);let C=x=>{let{nextStates:R,exitedStates:L,transitionTaken:N,enteredStates:T,reactive:W}=i(f.current,p.current[0]),D=f.current;if(f.current=R,a.current.forEach(I=>{L.includes(I.state)&&(typeof I.guard=="function"?I.guard(D,p.current[0]):I.guard)&&I.callback(p.current[0],I.params)}),l.current.forEach(I=>{L.includes(I.state)&&I.transition===N&&(typeof I.guard=="function"?I.guard(D,p.current[0]):I.guard)&&I.callback(p.current[0],I.params)}),u.current.forEach(I=>{T.includes(I.state)&&(typeof I.guard=="function"?I.guard(D,p.current[0]):I.guard)&&I.callback(p.current[0],I.params)}),n.current=typeof p.current[0]=="string"?{type:p.current[0]}:p.current[0],p.current.shift(),p.current.length)C(W||x);else{let I=R.slice();d.current.toStrings=()=>I,d.current.matches=H=>zo(I,H),d.current.getValues=()=>[xg(I.toStrings)],h.current.forEach(H=>{let V=H.current.selection;H.current.toStrings=()=>[Dd(d.current,V)],H.current.matches=se=>zo([Dd(d.current,V)],se),H.current.getValues=()=>[xg(Dd(d.current,V))]}),(x||W)&&v({...d.current,silent:d.current})}};p.current.length===1&&C()},[i]);return[g,S]},yO=(t,e,i,{message:n="",delay:a=null,...l}={delay:null})=>{w.useEffect(()=>{let u;return e.matches(i)&&(u=setTimeout(()=>t({type:"",...l}),a??0)),()=>{u&&clearTimeout(u)}},[e,i,a,t,n,l])},Hr=(t,e,{shallow:i=!0}={})=>{let n=w.useMemo(()=>Dd(t,e),[t,e]),a=w.useRef({lastMessageTreatedRef:t?.lastMessageTreatedRef,exitActionsRef:t?.exitActionsRef,transitionActionsRef:t?.transitionActionsRef,entryActionsRef:t?.entryActionsRef,toStrings:()=>[n],matches:u=>zo([n],u),selection:e,getValues:()=>[xg(n)]}),l=w.useRef(Symbol());return vi(()=>{t.selectorsRef.current.find(h=>h.id===l.current)||t.selectorsRef.current.push(a)},[]),w.useMemo(()=>({...a.current,silent:a.current}),[n])},zo=(t,e)=>Array.isArray(e)?e.some(i=>t.includes(i))||t.some(i=>e.some(n=>i?.startsWith(n)&&i?.charAt(n.length)===".")):t.includes(e)||t.some(i=>i?.startsWith(e)&&i?.charAt(e.length)==="."),Pe=(t,e,i)=>{let{state:n,callback:a,params:l,empty:u=!1}=i,h=!i.hasOwnProperty("guard")||i.guard,f=w.useMemo(()=>l?Object.values(l):[],[l]),d=w.useMemo(()=>e.entryActionsRef,[e]),g=tv(t==="before-paint"?"layout":"normal"),v=xx(S=>{(S?.matches&&S?.matches(n)||!S?.matches&&zo(S,n))&&(typeof h=="function"&&h()||typeof h!="function"&&h)&&a(S.lastMessageTreatedRef.current,l)}),p=w.useRef(Symbol());g(()=>{if(!u)if(t==="immediate"){let S={id:p.current,state:n,guard:h,callback:a,params:l},y=d.current.findIndex(C=>C.id===p.current);y===-1?d.current.push(S):d.current[y]=S}else v(e)},t==="immediate"?[t,n,h,a,d,...f]:[t,v,e]),w.useEffect(()=>()=>{d.current=d.current.filter(S=>S.id!==p.current)},[])},ot=(t,e)=>{let{state:i,transition:n,callback:a,params:l}=e,u=!e.hasOwnProperty("guard")||e.guard,h=w.useMemo(()=>l?Object.values(l):[],[l]),f=w.useMemo(()=>t.transitionActionsRef,[t]),d=w.useRef(Symbol());w.useEffect(()=>{let g={id:d.current,state:i,transition:n,guard:u,callback:a,params:l},v=f.current.findIndex(p=>p.id===d.current);v===-1?f.current.push(g):f.current[v]=g},[i,n,u,a,f,...h]),w.useEffect(()=>()=>{f.current=f.current.filter(g=>g.id!==d.current)},[])},Na=(t,e,i)=>{let{state:n,callback:a,params:l}=i,u=!i.hasOwnProperty("guard")||i.guard,h=w.useMemo(()=>l?Object.values(l):[],[l]),f=w.useMemo(()=>e.exitActionsRef,[e]),d=tv("normal");xx(v=>{(v?.matches&&v?.matches(n)||!v?.matches&&zo(v,n))&&(typeof u=="function"&&u()||typeof u!="function"&&u)&&a(v.lastMessageTreatedRef.current,l)});let g=w.useRef(Symbol());d(()=>{{let v={id:g.current,state:n,guard:u,callback:a,params:l},p=f.current.findIndex(S=>S.id===g.current);p===-1?f.current.push(v):f.current[p]=v}return()=>{}},[t,n,u,a,f,...h]),w.useEffect(()=>()=>{f.current=f.current.filter(v=>v.id!==g.current)},[])},Es=(t,e,i)=>{let{state:n,callback:a,params:l,name:u}=i,h=!i.hasOwnProperty("guard")||i.guard,f=l?Object.values(l):[],d=typeof t=="string"?t:t.start,g=typeof t=="string"?t:t.update,v=w.useRef(null);Pe("immediate",e,{state:n,guard:h,callback:w.useCallback(()=>{v.current=a(null,l)},[a,l]),params:l,empty:d!=="immediate"});let p=tv(g==="before-paint"?"layout":"normal"),S=w.useRef(!1);p(()=>{let y,C=e?.matches&&e?.matches(n)||!e?.matches&&zo(e,n)||n==="",x=typeof h=="function"&&h()||typeof h!="function"&&h;return C&&x&&(y=d==="immediate"?S.current?a(null,l):v.current:a(null,l)),C&&!S.current&&(S.current=!0),()=>{var R;!((R=e.silent)===null||R===void 0)&&R.matches(n)||(S.current=!1,v.current=null),y?.()}},[n!==""?e:null,n,h,a,...f])},bO=t=>{let e=w.useRef({value:t}),[i,n]=w.useState({value:t,silent:e.current}),a=w.useCallback(l=>{let u=typeof l=="function"?l(e.current.value):l;e.current.value=u,n({value:u,silent:e.current})},[]);return[i,a]};function kx(...t){return e=>t.forEach(i=>{typeof i=="function"?i(e):i!=null&&(i.current=e)})}function Rs(...t){return w.useCallback(kx(...t),t)}var wO=(t,e)=>{let i=()=>{e?.()},n=l=>{l.preventDefault(),window.addEventListener("touchend",i,{once:!0})},a=t.current;return a.addEventListener("touchstart",n,{passive:!1}),()=>{a&&(a.removeEventListener("touchstart",n,{passive:!1}),window.removeEventListener("touchend",i))}};let vp=!1,$1=0;function $o(t){var e;if(w.useId!==void 0)return w.useId();let[i,n]=w.useState(vp?++$1:null);return vi(()=>{i===null&&n(++$1)},[]),w.useEffect(()=>{vp===!1&&(vp=!0)},[]),(e=i)!==null&&e!==void 0?e:void 0}let Fi=w.forwardRef((t,e)=>{let{children:i,...n}=t,a=w.Children.toArray(i),l=a.find(xO);if(l){let u=l.props.children,h=a.map(f=>f!==l?f:w.Children.count(u)>1?w.Children.only(null):w.isValidElement(u)?u.props.children:null);return U.jsx(kg,{...n,ref:e,children:w.isValidElement(u)?w.cloneElement(u,void 0,h):null})}return U.jsx(kg,{...n,ref:e,children:i})});Fi.displayName="Slot.Root";let kg=w.forwardRef((t,e)=>{let{children:i,...n}=t,a=(function(l){var u,h;let f=(u=Object.getOwnPropertyDescriptor(l.props,"ref"))===null||u===void 0?void 0:u.get,d=f&&"isReactWarning"in f&&f.isReactWarning;return d?l.ref:(d=(f=(h=Object.getOwnPropertyDescriptor(l,"ref"))===null||h===void 0?void 0:h.get)&&"isReactWarning"in f&&f.isReactWarning)?l.props.ref:l.props.ref||l.ref})(i);return w.isValidElement(i)?w.cloneElement(i,{...(function(l,u){let h={...u};for(let f in u){let d=l[f],g=u[f];/^on[A-Z]/.test(f)?d&&g?h[f]=(...p)=>{g(...p),d(...p)}:d&&(h[f]=d):f==="style"?h[f]={...d,...g}:f==="className"&&(h[f]=[d,g].filter(Boolean).join(" "))}return{...l,...h}})(n,i.props),ref:e?kx(e,a):a}):w.Children.count(i)>1?w.Children.only(null):null});kg.displayName="Slot.Anonymous";let CO=({children:t})=>U.jsx(U.Fragment,{children:t});function xO(t){return w.isValidElement(t)&&t.type===CO}let md=0,Ex=[0,0],Eg=!1,W1=()=>{clearTimeout(L1),Eg=!0,L1=setTimeout(()=>Eg=!1,50)},j1=()=>{Eg||window.scrollTo(...Ex)},Tx=Ve.forwardRef((t,e)=>{let{asChild:i,active:n=!0,automaticallyDisabledForOptimisation:a=!0,axis:l="both",preventBodyScroll:u,children:h,"data-silk":f,className:d,...g}=t,v=f?.includes("0ae"),p=w.useRef(null),S=Rs(p,e);vi(()=>{if(Ex=[window.screenX,window.scrollY],n&&u)if(md===0){let R=window.innerWidth,L=document.documentElement.clientWidth,N=window.innerHeight,T=document.documentElement.clientHeight;document.body.style.setProperty("overflow","hidden");let W=`${R-L}px`,D=`${N-T}px`;document.querySelectorAll("[data-silk~='0al']").forEach(H=>{H.style.setProperty("--x-collapsed-scrollbar-thickness",W),H.style.setProperty("--y-collapsed-scrollbar-thickness",D)}),document.body.style.setProperty("padding-right",W),document.body.style.setProperty("padding-bottom",D),window.addEventListener("resize",W1),window.addEventListener("scroll",j1,{passive:!1}),md++}else md++;return()=>{if(n&&u&&--md==0){let R=document.querySelectorAll("[data-silk~='0al']");document.body.style.removeProperty("overflow"),R.forEach(L=>{L.style.removeProperty("--x-collapsed-scrollbar-thickness"),L.style.removeProperty("--y-collapsed-scrollbar-thickness")}),document.body.style.removeProperty("padding-right"),document.body.style.removeProperty("padding-bottom"),window.removeEventListener("scroll",j1),window.removeEventListener("resize",W1)}}},[u,n]),w.useEffect(()=>{let R,L=p.current;return!v&&n&&L&&(R=new ResizeObserver(N=>{N.forEach(()=>{L.scrollTo(300,300)})})).observe(L,{box:"border-box"}),()=>{!v&&n&&L&&R&&(R.unobserve(L),R.disconnect())}},[n,v]);let y=w.useCallback(R=>{let L=R.currentTarget;L.scrollTo(300,300),Kt!=="ios"&&Kt!=="ipados"||CSS.supports("overscroll-behavior: contain")||(L.style.setProperty("overflow","hidden"),setTimeout(()=>{L.style.setProperty("overflow","auto")},10))},[]),C=i?Fi:"div",x=Ui("ScrollTrap",{active:n,automaticallyDisabledForOptimisation:a,axis:l});return U.jsx(C,{...x("root",["active","automaticallyDisabledForOptimisation","axis"],{className:d,dataSilk:[f,"0ac","0ae"]}),onScroll:v?void 0:y,...g,ref:S,children:h})});Tx.displayName="Sheet.Anonymous";let Rx=Ve.forwardRef((t,e)=>{let{asChild:i,className:n,dataSilk:a,children:l,...u}=t,h=i?Fi:"div",f=Ui("ScrollTrap",{});return U.jsx(h,{...f("stabiliser",[],{className:n,dataSilk:[a]}),...u,ref:e,children:l})});Rx.displayName="Sheet.DDD";let qn={Root:Tx,Stabiliser:Rx},Mx=()=>{let t=$o();return w.useCallback(i=>{i?Ge.addFixedComponent({id:t,element:i}):Ge.removeFixedComponent(t)},[t])},kO=Ve.forwardRef((t,e)=>{let{asChild:i,children:n,className:a,"data-silk":l,...u}=t,h=Mx(),f=Rs(h,e),d=Ui("Fixed",{});return U.jsx(qn.Root,{...d("root",[],{className:a,dataSilk:[l,"0al"]}),asChild:i,...u,ref:f,children:n})});kO.displayName="Fixed.Root";let EO=Ve.forwardRef((t,e)=>{let{asChild:i,children:n,...a}=t;return U.jsx(qn.Stabiliser,{asChild:i,...a,ref:e,children:n})});EO.displayName="Fixed.Content";let Ga=Ve.createContext(null);Ga.displayName="Sheet.GenericContext";let Fr=Ve.createContext(null);Fr.displayName="Sheet.Anonymous";var TO=function(t){let e="cubic-bezier(";if(!t.startsWith(e))return null;let i=t.slice(e.length,-1),n=i.split(",").map(a=>parseFloat(a.trim()));return n.length!==4||n.some(isNaN)?null:n},RO=({mass:t,stiffness:e,damping:i,initialVelocity:n=0,fromPosition:a,toPosition:l,precision:u})=>{let h=[],f=0,d=Math.abs(l-a),g=0,v=n,p=!1,S=!1,y=-(1e-6*e),C=-(.001*i),x=u/22,R=10*u;for(;!(p&&S);){let N=y*(g-d),T=C*v,W=(N+T)/t;v+=W,g+=v,p=Math.abs(v)<=x,S=Math.abs(d-g)<=R;let D=g/d;h.push(D),f++}return{progressValuesArray:h,duration:f}};let Od=()=>CSS.supports("transition-timing-function","linear(0, 1)")&&!Wa(),MO=({origin:t=0,destination:e=1,animationConfig:i})=>{var n,a,l,u,h,f,d,g,v;let p=[],S;if(i&&i.easing&&i.easing!=="spring")if(i.easing==="linear"){S=(f=i.duration)!==null&&f!==void 0?f:250;let y=S,C=1/(y-1);for(let x=0;x<y;x++){let R=x*C;p.push(isNaN(R)?0:R)}}else{let y;S=(d=i.duration)!==null&&d!==void 0?d:250;let C=S;y=i.easing==="ease"?[.25,.1,.25,1]:i.easing==="ease-in"?[.42,0,1,1]:i.easing==="ease-out"?[0,0,.58,1]:i.easing==="ease-in-out"?[.42,0,.58,1]:i.easing.startsWith("cubic-bezier")&&(g=TO(i.easing))!==null&&g!==void 0?g:[.25,.1,.25,1];let x=jD(...y);for(let R=0;R<=C;R++)p.push(x(R/C))}else{let y=RO({stiffness:(n=i?.stiffness)!==null&&n!==void 0?n:300,damping:(a=i?.damping)!==null&&a!==void 0?a:34,mass:(l=i?.mass)!==null&&l!==void 0?l:1,initialVelocity:(u=i?.initialVelocity)!==null&&u!==void 0?u:0,precision:(h=i?.precision)!==null&&h!==void 0?h:.1,fromPosition:t,toPosition:e});p=y.progressValuesArray,S=y.duration}return{progressValuesArray:p,easing:"linear",duration:S,delay:(v=i?.delay)!==null&&v!==void 0?v:0}},Sp=(t,e)=>{let i={};return t.forEach(([n,a])=>{let l=Fl(e);i[n]=a({progress:e,tween:l})}),i},V1=({type:t,progressValuesArray:e,target:i,templatesPerProperty:n,reversedStackingIndex:a,selfAndAboveTravelProgressSum:l})=>{let u=a!=null,h=f=>t==="travel"?f:u&&l?l?.[a]+f:0;return{target:i,keyframes:Od()?[Sp(n,h(e[0])),Sp(n,h(e[e.length-1]))]:e.map(f=>Sp(n,h(f)))}},AO=({sheetId:t,destinationDetent:e,setSegment:i,viewElement:n,scrollContainer:a,travellingElement:l,contentPlacement:u,positionToScrollTo:h,scrollAxis:f,animationConfig:d,onTravel:g,onTravelStart:v,onTravelEnd:p,runOnTravelStart:S,rAFLoopEndCallback:y,dimensions:C,trackToTravelOn:x})=>{let R,L,N=Ge.findSheet(t);if(!N)return;let T=[],W=[];T=N.travelAnimations,N.belowSheetsInStack.forEach(pe=>{W.push(...pe.stackingAnimations.map(mt=>({...mt,reversedStackingIndex:N.belowSheetsInStack.length-1,selfAndAboveTravelProgressSum:pe.selfAndAboveTravelProgressSum})))}),S&&v?.();let D=!(d.hasOwnProperty("contentMove")&&!d.contentMove),I=C.current.view.travelAxis.unitless,H=C.current.content.travelAxis.unitless,V=n.getBoundingClientRect(),se=l.getBoundingClientRect(),Q=u!=="center"?H:H+(I-H)/2,A=se.top-V.top,O=se.left-V.left,P=0;switch(x){case"top":P=A+Q;break;case"bottom":P=A-Q;break;case"left":P=O+Q;break;case"right":P=O-Q}let $=Math.max(Math.abs(P)/Q,0),E=C.current.progressValueAtDetents[e].exact,M=E*Q,z=x==="left"||x==="top"?M:-M,{progressValuesArray:q,easing:G,duration:B,delay:K}=MO({origin:P,destination:z,animationConfig:d}),te=E-$,ne=(function(pe,mt){let yt=[];for(let ge=0;ge<pe.length-1;ge+=mt)yt.push(pe[ge]);return pe.length%mt!=0&&yt.push(pe[pe.length-1]),yt})(q,8),de=ne.map(pe=>$+te*pe),ue=[];T.length&&ue?.push(...T.map(pe=>V1({type:"travel",progressValuesArray:de,target:pe.target,templatesPerProperty:pe.config}))),W.length&&ue?.push(...W.map(pe=>V1({type:"stacking",progressValuesArray:de,target:pe.target,templatesPerProperty:pe.config,reversedStackingIndex:pe.reversedStackingIndex,selfAndAboveTravelProgressSum:pe.selfAndAboveTravelProgressSum}))),R=f==="x"?"X":"Y";let he=pe=>({transform:"translate"+R+"("+(P-z)*(1-pe)+"px)"});L=Od()?[he(ne[0]),he(ne[ne.length-1])]:ne.map(pe=>({transform:"translate"+R+"("+(P-z)*(1-pe)+"px)"}));let Se=()=>{a.scrollTo({left:f==="x"?h:0,top:f==="y"?h:0})},we=pe=>{let mt;if(!D)return pe();mt=Od()?l.animate(L,{easing:"linear("+ne.join(",")+")",duration:B,delay:K}):l.animate(L,{easing:G,duration:B,delay:K});let yt=()=>{pe(),mt.removeEventListener("finish",yt)};mt.addEventListener("finish",yt)},Ee=pe=>{if(!ue.length)return pe();let mt=[],yt=Od();ue?.forEach(({target:ge,keyframes:ye})=>{let me;me=yt?ge.animate(ye,{easing:"linear("+ne.join(",")+")",duration:B,delay:K}):ge.animate(ye,{easing:G,duration:B,delay:K});let Ut=new Promise(Be=>{let Xe=()=>{Object.entries(ye[ye.length-1]).forEach(([je,_t])=>{ge.style.setProperty((je.startsWith("webkit")||je.startsWith("moz")?"-":"")+je.replace(/[A-Z]/g,"-$&").toLowerCase(),_t)}),me.removeEventListener("finish",Xe),Be()};me.addEventListener("finish",Xe)});mt.push(Ut)}),Promise.all(mt).then(()=>{pe()})},Le=null,it=pe=>{(function mt(yt,ge,ye){let me=C.current.progressValueAtDetents,Ut=me.length;Le||(Le=yt);let Be=yt-Le,Xe=Math.floor(Be);if(Xe<q.length){let je=$+te*q[Xe];if(je<0)ge(je,[0,0]);else if(je>1)ge(je,[1,1]);else for(let _t=0;_t<Ut;_t++){let qe=me[_t],Ms=qe.after;je>Ms&&_t+1<Ut&&je<me[_t+1].before?ge(je,[_t,_t+1]):je>qe.before&&je<Ms&&ge(je,[_t,_t])}requestAnimationFrame(()=>mt(document.timeline.currentTime,ge,ye))}else{let je=Math.min(Ut-1,e);ge(E,[je,je]),D||ue?.length||y==null||y(),ye()}})(document.timeline.currentTime,(mt,yt)=>{g?.({progress:mt,range:{start:yt[0],end:yt[1]},progressAtDetents:C.current.exactProgressValueAtDetents}),i(yt)},pe)},Ze=pe=>new Promise(mt=>{pe(()=>mt())}),ke=()=>{p?.()},ze=async()=>{await Promise.all([Ze(we),Ze(Ee),Ze(it)]),ke()};requestAnimationFrame(()=>{requestAnimationFrame(()=>{(D||e!==0)&&Se(),ze()})})},LO=({desiredDestinationDetent:t,currentDetent:e})=>typeof t=="number"?t:e,DO=({trackToTravelOn:t,destinationDetent:e,detentCountExcludingZero:i,actualSwipeOutDisabledWithDetent:n,hasOppositeTracks:a,contentPlacement:l,elementsDimensions:u,snapBackAcceleratorTravelAxisSize:h})=>{var f;if(((f=u.detentMarkers)===null||f===void 0?void 0:f.length)<=e-1)return{positionToScrollTo:null,scrollAxis:null};let d=e===0,g=e===1,v=e===i,p=t==="right"||t==="bottom",S=u.view.travelAxis.unitless,y=u.content.travelAxis.unitless,C=u.snapOutAccelerator.travelAxis.unitless,x=u.detentMarkers,R=d?0:x[e-1].accumulatedOffsets.travelAxis.unitless,L=0;if(a)v?L=S-(S-y)/2+u.snapOutAccelerator.travelAxis.unitless:d&&(L=p?0:1e4);else if(p)v?L=1e4:n&&g||d?L=0:v||n&&g||d||(L=n?x[e-1].accumulatedOffsets.travelAxis.unitless-x[0].travelAxis.unitless:R+C);else if(t==="left"||t==="top"){let N;N=n?g?2*h:v?0:h:d?C:v?h:0,L=l==="center"?e===0?y+(S-y)/2-R+N:0:y-R+N}return{positionToScrollTo:L,scrollAxis:t==="left"||t==="right"||t==="horizontal"?"x":"y"}};var OO=({destinationDetent:t,behavior:e="instant",runTravelCallbacksAndAnimations:i=!0,runOnTravelStart:n,animationConfig:a,rAFLoopEndCallback:l,trackToTravelOn:u,contentPlacement:h,onTravel:f,onTravelStart:d,onTravelEnd:g,fullTravelCallback:v,setProgrammaticScrollOngoing:p,currentDetent:S,segment:y,setSegment:C,lastProgressValue:x,dimensions:R,viewRef:L,scrollContainerRef:N,contentWrapperRef:T,sheetId:W,stackId:D,actualSwipeOutDisabledWithDetent:I,hasOppositeTracks:H,snapBackAcceleratorTravelAxisSize:V})=>{if(t===void 0&&S===null)return;let se=R.current,Q=N.current;if(Q&&se.content){let A=LO({desiredDestinationDetent:t,currentDetent:S}),O=R.current.detentMarkers.length,{positionToScrollTo:P,scrollAxis:$}=DO({destinationDetent:A,detentCountExcludingZero:O,trackToTravelOn:u,actualSwipeOutDisabledWithDetent:I,hasOppositeTracks:H,contentPlacement:h,snapBackAcceleratorTravelAxisSize:V,elementsDimensions:se});if(P!==null&&$!==null){if(p(!0),e==="smooth")AO({sheetId:W,destinationDetent:A,setSegment:C,viewElement:L.current,scrollContainer:Q,travellingElement:T.current,positionToScrollTo:P,contentPlacement:h,scrollAxis:$,animationConfig:a,onTravel:f,onTravelStart:d,onTravelEnd:g,runOnTravelStart:n,rAFLoopEndCallback:l,dimensions:R,trackToTravelOn:u});else if(i&&n&&d?.(),$==="x"?(Q.scrollTo(P,0),Q.scrollLeft=P):(Q.scrollTo(0,P),Q.scrollTop=P),C([A,A]),i){let E=R.current.progressValueAtDetents[A].exact;v?.(E,y),g?.()}}}};let fu=t=>{let e=w.useRef(null);return vi(()=>{e.current=t}),w.useCallback((...i)=>{let n=e.current;return n(...i)},[])},BO=t=>{let e,i=()=>{t(),e=requestAnimationFrame(i)};return i(),()=>{cancelAnimationFrame(e)}},NO=(()=>{let t=!0;typeof window>"u"||CSS.supports("scroll-snap-align: start")||(t=!1);let e=!0;return typeof window>"u"||"IntersectionObserver"in window&&"IntersectionObserverEntry"in window&&"intersectionRatio"in window.IntersectionObserverEntry.prototype||(e=!1),t&&e})(),tf={gentle:{stiffness:560,damping:68,mass:1.85},smooth:{stiffness:580,damping:60,mass:1.35},snappy:{stiffness:350,damping:34,mass:.9},brisk:{stiffness:350,damping:28,mass:.65},bouncy:{stiffness:240,damping:19,mass:.7},elastic:{stiffness:260,damping:20,mass:1}},yp=(t,e)=>{var i;let n=typeof t=="string",a=n?tf[t]:(i=tf[t?.preset])!==null&&i!==void 0?i:null,l=a||t?.easing==="spring"||["ease","ease-in","ease-out","ease-in-out","linear"].includes(t?.easing);return{skip:ev,easing:"spring",...n?{}:t,...a??{},...l?{}:e}},PO=(t,e)=>t.includes("skipOpening:true")||e.skipOpening,q1=(t,e)=>!t.includes("skipOpening:true")&&!e.skipOpening,zO=(t,e)=>t.includes("skipClosing:true")||e.skipClosing,HO=(t,e)=>!t.includes("skipClosing:true")&&!e.skipClosing,Y1=t=>t.includes("openness:closed.status:safe-to-unmount"),IO=()=>{let t="false",[e,i]=F1(w.useMemo(()=>[{name:"staging",initial:"none",states:{none:{messages:{OPEN:[{guard:(y,C)=>Y1(y)&&q1(y,C),target:"opening"},{guard:Y1,target:"open"}],OPEN_PREPARED:[{guard:q1,target:"opening"},{target:"open"}],ACTUALLY_CLOSE:[{guard:HO,target:"closing"}],ACTUALLY_STEP:"stepping",GO_DOWN:[{guard:(y,C)=>!C.skipOpening,target:"going-down"},{target:"go-down"}],GO_UP:"going-up"}},open:{messages:{NEXT:"none"}},opening:{messages:{NEXT:"none"}},stepping:{messages:{NEXT:"none"}},closing:{messages:{NEXT:"none"}},"go-down":{messages:{NEXT:"none"}},"going-down":{messages:{NEXT:"none"}},"going-up":{messages:{NEXT:"none"}}}},{name:"longRunning",initial:t,states:{false:{messages:{TO_TRUE:"true"}},true:{messages:{TO_FALSE:"false"}}}},{name:"openness",initial:"closed",states:{closed:{messages:{READY_TO_OPEN:[{guard:(y,C)=>!C.skipOpening,target:"opening"},{target:"open"}]},machines:{name:"status",initial:"safe-to-unmount",states:{pending:{messages:{OPEN:[{guard:PO,target:"openness:closed.status:flushing-to-preparing-open"},{target:"openness:closed.status:flushing-to-preparing-opening"}],"":"safe-to-unmount"}},"flushing-to-preparing-open":{messages:{"":"preparing-open"}},"flushing-to-preparing-opening":{messages:{"":"preparing-opening"}},"preparing-open":{},"preparing-opening":{},"safe-to-unmount":{}}}},opening:{messages:{NEXT:"open"}},open:{messages:{ACTUALLY_CLOSE:[{guard:zO,target:"openness:closed.status:pending"}],SWIPED_OUT:"openness:closed.status:pending",READY_TO_CLOSE:[{guard:(y,C)=>!C.skipClosing,target:"closing"}]},machines:[{name:"scroll",initial:"ended",states:{ended:{messages:{SCROLL_START:"ongoing"},machines:[{name:"afterPaintEffectsRun",initial:"false",states:{false:{messages:{OCCURRED:"true"}},true:{}}}]},ongoing:{messages:{SCROLL_END:"ended"}}}},{name:"move",initial:"ended",states:{ended:{messages:{MOVE_START:"ongoing"}},ongoing:{messages:{MOVE_END:"ended"}}}},{name:"swipe",silentOnly:!0,initial:"unstarted",states:{unstarted:{messages:{SWIPE_START:"ongoing"}},ongoing:{messages:{SWIPE_END:"ended"}},ended:{messages:{SWIPE_START:"ongoing",SWIPE_RESET:"unstarted"}}}},{name:"evaluateCloseMessage",silentOnly:!0,initial:"false",states:{false:{messages:{CLOSE:"true"}},true:{messages:{CLOSE:"false"}}}},{name:"evaluateStepMessage",silentOnly:!0,initial:"false",states:{false:{messages:{STEP:"true"}},true:{messages:{STEP:"false"}}}}]},closing:{messages:{NEXT:"openness:closed.status:pending"}}}},{name:"skipOpening",initial:"false",states:{true:{messages:{TO_FALSE:"false"}},false:{messages:{TO_TRUE:"true"}}}},{name:"skipClosing",initial:"false",states:{true:{messages:{TO_FALSE:"false"}},false:{messages:{TO_TRUE:"true"}}}},{name:"scrollContainerTouch",silentOnly:!0,initial:"ended",states:{ended:{messages:{TOUCH_START:"ongoing"}},ongoing:{messages:{TOUCH_END:"ended"}}}},{name:"backStuck",silentOnly:!0,initial:"false",states:{false:{messages:{STUCK_START:"true"}},true:{messages:{STUCK_END:"false"}}}},{name:"frontStuck",silentOnly:!0,initial:"false",states:{false:{messages:{STUCK_START:"true"}},true:{messages:{STUCK_END:"false"}}}}],[t])),[n,a]=F1(w.useMemo(()=>[{name:"active",initial:"false",states:{false:{messages:{TO_TRUE:"true"}},true:{messages:{TO_FALSE:"false"}}}},{name:"position",initial:"out",states:{out:{messages:{READY_TO_GO_FRONT:[{guard:(y,C)=>C.skipOpening,target:"position:front.status:idle"},{target:"position:front.status:opening"}]}},front:{machines:[{name:"status",initial:"opening",states:{opening:{messages:{NEXT:"idle"}},closing:{messages:{NEXT:"position:out"}},idle:{messages:{READY_TO_GO_DOWN:[{guard:(y,C)=>C.skipOpening,target:"position:covered.status:idle"},{target:"position:covered.status:going-down"}],READY_TO_GO_OUT:"closing",GO_OUT:"position:out"}}}}]},covered:{machines:[{name:"status",initial:"going-down",states:{"going-down":{messages:{NEXT:"idle"}},"going-up":{messages:{NEXT:"indeterminate"}},indeterminate:{messages:{GOTO_idle:"idle",GOTO_front:"position:front.status:idle"}},idle:{messages:{READY_TO_GO_DOWN:[{guard:(y,C)=>C.skipOpening,target:"come-back"},{target:"going-down"}],READY_TO_GO_UP:"going-up",GO_UP:"indeterminate"}},"come-back":{messages:{"":"idle"}}}}]}}}],[])),l=w.useMemo(()=>n.matches("position:out")?"out":n.matches("position:front")?"front":n.matches("position:covered")?"covered":void 0,[n]),u=w.useMemo(()=>n.matches("position:covered.status:idle")?"idle":n.matches("position:covered.status:going-down")?"going-down":n.matches("position:covered.status:going-up")?"going-up":null,[n]),h=Hr(e,"staging"),f=w.useMemo(()=>h.getValues()[0],[h]),[d,g]=bO(-1),v=$o(),p=$o();return w.useMemo(()=>({titleId:v,descriptionId:p,staging:f,opennessState:e,sendToOpennessMachine:i,positionState:n,sendToPositionMachine:a,layerPosition:l,layerCovered:u,stackingIndex:d,assignStackingIndex:g}),[v,p,f,e,i,n,a,l,u,d,g])},Ax=Ve.forwardRef((t,e)=>{let i,{forComponent:n,as:a,children:l,className:u,"data-silk":h,initialState:f,onPresentAutoFocus:d,onDismissAutoFocus:g,onTravelStatusChange:v,onTravelRangeChange:p,swipeDismissal:S=!0,swipe:y=!0,snapOutAcceleration:C="auto",snapToEndDetentsAcceleration:x="auto",onTravel:R,onTravelStart:L,onTravelEnd:N,detents:T,inertOutside:W=!0,nativeEdgeSwipePrevention:D=!1,onSwipeFromEdgeToGoBackAttempt:I,onClickOutside:H,onEscapeKeyDown:V,onFocusInside:se,nativeFocusScrollPrevention:Q=!0,contentPlacement:A=null,tracks:O,swipeOvershoot:P=!0,swipeTrap:$,enteringAnimationSettings:E,exitingAnimationSettings:M,steppingAnimationSettings:z,id:q,...G}=t,B=n??Ga,K=w.useContext(B)||{},{license:te,StackContext:ne,CustomSheetContext:de,sheetRole:ue,open:he,onOpenChange:Se,elementFocusedLastBeforeShowing:we,onSafeToUnmountChange:Ee,setLongRunning:Le,setStaging:it,defaultActiveDetent:Ze,activeDetent:ke,onActiveDetentChange:ze,sheetId:pe}=K,{titleId:mt,descriptionId:yt,staging:ge,opennessState:ye,sendToOpennessMachine:me,positionState:Ut,sendToPositionMachine:Be,layerCovered:Xe,stackingIndex:je,assignStackingIndex:_t}=IO(),qe=Hr(ye,"staging"),{stackId:Ms,setSheetsCount:ns,updateSheetStagingDataInStack:Xn,removeSheetStagingDataInStack:Zn,updateSheetDataInStack:$r,removeSheetDataFromStack:Ks,getPreviousSheetDataInStack:ri}=ne?w.useContext(ne):{},{ancestorPrimarySwipeTrapActiveOnYAxis:$i}=w.useContext(Fr)||{},At=Mx(),ni=w.useRef(null),Xs=Rs(ni,At,e),un=w.useRef(null),Zs=w.useRef(null),kt=w.useRef(null),Er=w.useRef(null),Wi=w.useRef(null),As=w.useRef(null),Tr=w.useRef(null),Qn=w.useRef([]),es=w.useMemo(()=>T?typeof T=="string"?[T,"var(--silk-aF)"]:[...T,"var(--silk-aF)"]:["var(--silk-aF)"],[T]),Qs=w.useRef(null);w.useEffect(()=>{Qs.current===null&&Number.isInteger(ke)&&ke>0&&(Qs.current=ke)},[]);let Ft=w.useMemo(()=>Number.isInteger(Ze)?Ze:Number.isInteger(ke)&&ke>0?ke:Qs.current?Qs.current:1,[ke,Ze]),{actualTrack:He,actualPlacement:Lt}=w.useMemo(()=>{let J={actualPlacement:null,actualTrack:null};return A&&!O?(J.actualPlacement=A,A!=="center"?J.actualTrack=A:J.actualTrack="bottom"):O&&!A?Array.isArray(O)?(J.actualPlacement="center",J.actualTrack=O.includes("left")?"horizontal":"vertical"):(J.actualPlacement=O,J.actualTrack=O):O||A?O&&A&&(J.actualPlacement=A,Array.isArray(O)?J.actualTrack=O.includes("left")?"horizontal":"vertical":J.actualTrack=O):(J.actualPlacement="bottom",J.actualTrack="bottom"),[{state:"staging:opening",configTrack:E?.track},{state:"staging:closing",configTrack:M?.track}].forEach(({state:fe,configTrack:_e})=>{ye.matches(fe)&&_e&&(_e==="top"&&J.actualTrack==="bottom"||_e==="bottom"&&J.actualTrack==="top"?J.actualTrack="vertical":(_e==="left"&&J.actualTrack==="right"||_e==="right"&&J.actualTrack==="left")&&(J.actualTrack="horizontal"))}),J},[A,O,E?.track,M?.track,ye]);w.useMemo(()=>He==="horizontal",[He]);let Vo=w.useMemo(()=>He==="vertical",[He]);w.useEffect(()=>{if(A?.includes("top")&&O&&O!=="top"||A?.includes("bottom")&&O&&O!=="bottom"||!A?.includes("center")&&O&&O.includes("top")&&O.includes("bottom")||A?.includes("left")&&O&&O!=="left"||A?.includes("right")&&O&&O!=="right"||!A?.includes("center")&&O&&O.includes("left")&&O.includes("right"))throw Error(`'placement' prop value '${A}' cannot be used with 'tracks' prop value '${O}'.`)},[A,O]);let Js=w.useMemo(()=>E?.track||(He==="horizontal"?"right":He==="vertical"?"bottom":He),[E?.track,He]),ji=w.useMemo(()=>yp(E,tf.smooth),[E]),be=w.useMemo(()=>yp(M,{easing:"spring",stiffness:520,damping:44,mass:1}),[M]),ft=w.useMemo(()=>yp(z??E,tf.smooth),[z,E]),Qe=w.useMemo(()=>ue==="alertdialog"||!S,[S,ue]),$e=(He!=="horizontal"&&He!=="vertical"||!!Qe)&&!P,[Re,Ue,$t,Bt]=w.useMemo(()=>{let J=!1,ce=!1,fe=!1,_e=!1;return y&&NO?Qe&&(T?(fe=!0,ye.matches("openness:open")&&!ye.matches("staging:closing")&&(ce=!0)):ye.matches("openness:open")&&!ye.matches("staging:closing")&&($e===!1&&Wa()?_e=!0:J=!0)):ye.matches("openness:closed")||(J=!0),[J,ce,fe,_e]},[y,ye,Qe,T,$e]),er=w.useMemo(()=>qe.getValues()[0]!=="none",[qe]),tr=["right","left","horizontal"].includes(He)?"horizontal":"vertical",[Rr,Ls]=w.useState(!1),[Mr,ci]=w.useState(!1),_s=w.useMemo(()=>!W&&(W?void 0:Rr!==!0),[W,Rr]),ui=w.useMemo(()=>$e===!0?x==="auto"?10:1:0,[$e,x]),Ei=w.useRef(null);w.useEffect(()=>(pe&&(Ei.current=Ge.addSheet({id:pe,stackId:Ms,stackingIndex:-1,sendToOpennessMachine:me})),()=>{pe&&Ge.attemptToRemoveSheetOrCleanup(pe)}),[me,pe,Ms]),w.useEffect(()=>(Q&&Ge.addNativeFocusScrollPreventer(pe),()=>{Q&&Ge.removeNativeFocusScrollPreventer(pe)}),[Q,pe]);let Ce=w.useMemo(()=>ri?.(pe),[ri,pe]),[hn,Iu]=w.useState(null),ps=w.useMemo(()=>R&&hn?J=>{hn(J),R(J)}:R&&!hn?R:!R&&hn?hn:null,[R,hn]),ir=w.useCallback(()=>{N?.();let J=at.current.exactProgressValueAtDetents[pt.current[0]];qt.current=J,Ge.updateSheetTravelProgress(pe,J)},[N,pe]),Ar=w.useMemo(()=>{let J;if(je.value>0)J=ps?(ce,fe)=>{ps({progress:ce,range:fe,progressAtDetents:at.current.exactProgressValueAtDetents});let _e=Fl(ce);Ei.current.aggregatedTravelCallback(ce,_e)}:ce=>{let fe=Fl(ce);Ei.current.aggregatedTravelCallback(ce,fe)};else{let ce=Ge.getAggregatedStackingCallbackForSheetsBelow(pe);J=ce?ps?(fe,_e)=>{ps({progress:fe,range:_e,progressAtDetents:at.current.exactProgressValueAtDetents});let De=Fl(fe);Ei.current.aggregatedTravelCallback(fe,De),ce(fe,De)}:fe=>{let _e=Fl(fe);Ei.current.aggregatedTravelCallback(fe,_e),ce(fe,_e)}:()=>{}}return J},[je.value,ps,pe]),Jn=w.useRef(!1),tc=w.useMemo(()=>{let J;return He==="bottom"||He==="vertical"?J="translateY(-2px)":He==="top"?J="translateY(2px)":He==="right"||He==="horizontal"?J="translateX(-2px)":He==="left"&&(J="translateX(2px)"),ce=>{ce>0&&ce<1&&!Jn.current?(Wi.current.style.setProperty("transform",J),Jn.current=!0):(ce>1||ce<=0)&&Jn.current&&(Wi.current.style.removeProperty("transform"),Jn.current=!1)}},[He]),qo=w.useMemo(()=>Bt?J=>tc(J):Ar,[tc,Bt,Ar]),[Wr,dn]=w.useState("both"),sr=mx(ni);w.useEffect(()=>{var J,ce;let fe,_e,De;if(typeof $=="boolean")fe={x:$,y:$};else{let{x:Xt,y:Si}=$||{};fe={x:Xt,y:Si}}let Ne=(Kt==="ios"||Kt==="ipados")&&W&&!$i,et=_x();tr==="vertical"&&(_e=fe.x,De=!!Ne||!et&&((J=fe.y)===null||J===void 0||J)),tr==="horizontal"&&(De=!!Ne||fe.y,_e=(ce=fe.x)===null||ce===void 0||ce),De=!!De||sr,dn(_e&&!De?"horizontal":!_e&&De?"vertical":_e&&De?"both":"none")},[$i,W,$,sr,tr]);let at=w.useRef({}),[ic,yf]=w.useState(0),[sc,Uu]=w.useState(()=>()=>({top:null,bottom:null})),ea=w.useRef([]),pt=w.useRef([0,0]),Vi=w.useRef(0),Vt=w.useRef(null),Yo=w.useRef(()=>{}),ta=w.useRef(!1),fn=w.useRef(!1),Go=w.useCallback(J=>fn.current=J,[]),Ti=fu(({destinationDetent:J,trackToTravelOn:ce=He==="vertical"?"bottom":He==="horizontal"?"right":He,behavior:fe="instant",runTravelCallbacksAndAnimations:_e=!0,runOnTravelStart:De=!0,animationConfig:Ne,rAFLoopEndCallback:et,travelEndCallback:Xt})=>{OO({destinationDetent:J,behavior:fe,runTravelCallbacksAndAnimations:_e,runOnTravelStart:De,trackToTravelOn:ce,animationConfig:Ne,rAFLoopEndCallback:et,onTravel:ps,onTravelStart:L,onTravelEnd:()=>{Xt?.(),ir()},segment:pt,fullTravelCallback:Ar,sheetId:pe,stackId:Ms,dimensions:at,snapBackAcceleratorTravelAxisSize:ui,actualSwipeOutDisabledWithDetent:Ue,lastProgressValue:qt,viewRef:ni,scrollContainerRef:kt,contentWrapperRef:Wi,currentDetent:pt.current[0]===pt.current[1]?pt.current[0]:null,setSegment:nr,setProgrammaticScrollOngoing:Go,contentPlacement:Lt,hasOppositeTracks:He==="horizontal"||He==="vertical"})}),ia=w.useCallback(()=>{pt.current[0]===pt.current[1]&&Ti({runTravelCallbacksAndAnimations:!1,destinationDetent:pt.current[0]})},[pe,He,Ue,Bt,ui]),bf=w.useCallback(J=>{$r?.({sheetId:pe,sendToOpennessMachine:me,sendToPositionMachine:Be})},[$r,pe,me,Be]),rc=w.useCallback(()=>{Ks?.(pe)},[Ks,pe]),nc=w.useMemo(()=>ue==="alertdialog"?()=>{}:()=>me({type:"CLOSE"}),[me,ue]),ac=w.useCallback(()=>{Ge.updateLayer({layerId:pe,layerContextId:de,layerStackContextId:ne,inertOutside:W,onPresentAutoFocus:d,onDismissAutoFocus:g,dismissOverlayIfNotAlertDialog:nc,onClickOutside:H,onEscapeKeyDown:V,viewElement:ni.current,backdropElement:Zs.current,scrollContainerElement:kt.current,elementFocusedLastBeforeShowing:we.current})},[pe,de,ne,W,d,g,nc,H,V,we]),Fu=w.useCallback(()=>{Ge.removeLayer(pe)},[pe]),wf=w.useCallback(()=>{let J=_e=>["ArrowDown","ArrowUp","PageDown","PageUp","End","Home"," "].includes(_e.key),ce=_e=>{if(J(_e)){var De,Ne;(De=kt.current)===null||De===void 0||De.style.setProperty("overflow","hidden"),(Ne=kt.current)===null||Ne===void 0||Ne.style.setProperty("scroll-snap-type","none")}},fe=_e=>{if(J(_e)){var De,Ne;(De=kt.current)===null||De===void 0||De.style.removeProperty("overflow"),(Ne=kt.current)===null||Ne===void 0||Ne.style.removeProperty("scroll-snap-type")}};return document.addEventListener("keydown",ce),document.addEventListener("keyup",fe),()=>{document.removeEventListener("keydown",ce),document.removeEventListener("keyup",fe)}},[]),Lr=w.useCallback(()=>{_t(J=>J+1),Ge.updateSheetStackingIndex(pe,je.silent.value)},[_t,je.silent,pe]),Ri=w.useCallback(()=>{_t(J=>J-1),Ge.updateSheetStackingIndex(pe,je.silent.value)},[_t,je.silent,pe]),sa=Hr(Ut,"active");Es("after-paint",sa,{state:"active:true",callback:ac}),Es("after-paint",sa,{state:"active:true",callback:wf}),Pe("after-paint",sa,{state:"active:false",callback:Fu});let jr=Hr(Ut,"position"),as=Hr(Ut,"position:covered.status");ot(jr,{state:"position:out",transition:"READY_TO_GO_FRONT",callback:w.useCallback(J=>{Ce?.sendToPositionMachine({type:"READY_TO_GO_DOWN",skipOpening:J.skipOpening}),Lr()},[Lr,Ce])}),ot(Ut,{state:"position:front.status:opening",transition:"NEXT",callback:w.useCallback(()=>{Ce?.sendToPositionMachine("NEXT")},[Ce])}),ot(Ut,{state:"position:front.status:idle",transition:"READY_TO_GO_OUT",callback:w.useCallback(()=>{Ce?.sendToPositionMachine("READY_TO_GO_UP")},[Ce])}),ot(Ut,{state:"position:front.status:idle",transition:"GO_OUT",callback:w.useCallback(()=>{Ar?.(0,{start:0,end:0}),ir(),Ce?.sendToPositionMachine("GO_UP"),Ri()},[Ar,ir,Ce,Ri])}),ot(Ut,{state:"position:front.status:idle",transition:"READY_TO_GO_DOWN",callback:w.useCallback(J=>{Ce?.sendToPositionMachine({type:"READY_TO_GO_DOWN",skipOpening:J.skipOpening}),Lr()},[Lr,Ce])}),ot(Ut,{state:"position:front.status:closing",transition:"NEXT",callback:w.useCallback(()=>{Ce?.sendToPositionMachine("NEXT"),Ri()},[Ce,Ri])}),ot(as,{state:"position:covered.status:going-down",transition:"NEXT",callback:w.useCallback(()=>{Ce?.sendToPositionMachine("NEXT")},[Ce])}),ot(as,{state:"position:covered.status:idle",transition:"READY_TO_GO_DOWN",callback:w.useCallback(J=>{Ce?.sendToPositionMachine({type:"READY_TO_GO_DOWN",skipOpening:J.skipOpening}),Lr()},[Lr,Ce])}),ot(as,{state:"position:covered.status:idle",transition:"READY_TO_GO_UP",callback:w.useCallback(()=>{Ce?.sendToPositionMachine("READY_TO_GO_UP")},[Ce])}),ot(as,{state:"position:covered.status:idle",transition:"GO_UP",callback:w.useCallback(()=>{Ce?.sendToPositionMachine("GO_UP"),Ri()},[Ri,Ce])}),Pe("immediate",as,{state:"position:covered.status:come-back",callback:w.useCallback(()=>Be(""),[Be])}),ot(as,{state:"position:covered.status:going-up",transition:"NEXT",callback:w.useCallback(()=>{Ce?.sendToPositionMachine("NEXT"),Ri()},[Ce,Ri])}),Pe("immediate",as,{state:"position:covered.status:indeterminate",callback:w.useCallback(()=>{je.silent.value===0?Be("GOTO_front"):Be("GOTO_idle")},[je.silent,Be])});let Ds=w.useCallback(()=>Ce?.sendToOpennessMachine({machine:"staging",type:"NEXT"}),[Ce]),rr=w.useCallback((J,{newState:ce})=>{it(ce),Xn?.({sheetId:pe,staging:ce})},[i,it,Xn,pe]),mn=w.useCallback((J,{newState:ce})=>{v?.(ce)},[v]),nr=w.useMemo(()=>{let J=ce=>{Vi.current=ce[1],queueMicrotask(()=>{let fe=ce[0],_e=ce[1];(fe!==pt.current[0]||_e!==pt.current[1])&&(pt.current=ce,fe===_e&&(Vt.current===null&&ze?ze(_e):fe===Vt.current&&(Vt.current=null)))})};return p&&$e===!1?J=ce=>{Vi.current=ce[1],queueMicrotask(()=>{let fe=ce[0],_e=ce[1];(fe!==pt.current[0]||_e!==pt.current[1])&&(pt.current=ce,p({start:fe,end:_e}),fe===_e&&(Vt.current===null&&ze?ze(_e):fe===Vt.current&&(Vt.current=null)))})}:$e===!0&&(J=$t?ce=>{Vi.current=ce[1],queueMicrotask(()=>{let fe=ce[0],_e=ce[1];if(fe!==pt.current[0]||_e!==pt.current[1]){let De=es.length;Ue&&fe===1&&_e===1?me({machine:"backStuck",type:"STUCK_START"}):fe===De&&_e===De?me({machine:"frontStuck",type:"STUCK_START"}):to.current?me({machine:"frontStuck",type:"STUCK_END"}):Qo.current&&me({machine:"backStuck",type:"STUCK_END"}),pt.current=ce,p?.({start:fe,end:_e}),fe===_e&&(Vt.current===null&&ze?ze(_e):fe===Vt.current&&(Vt.current=null))}})}:ce=>{Vi.current=ce[1],queueMicrotask(()=>{let fe=ce[0],_e=ce[1];if(fe!==pt.current[0]||_e!==pt.current[1]){let De=es.length;fe===De&&_e===De?me({machine:"frontStuck",type:"STUCK_START"}):to.current&&me({machine:"frontStuck",type:"STUCK_END"}),pt.current=ce,p?.({start:fe,end:_e}),fe===_e&&(Vt.current===null&&ze?ze(_e):fe===Vt.current&&(Vt.current=null))}})}),J},[p,$e,ze,$t,Ue,es.length,me]),Os=w.useCallback(J=>{let ce={destinationDetent:J==="front"?at.current.detentMarkers.length:1,runTravelCallbacksAndAnimations:!1};if(Ti(ce),Wa()){var fe;(fe=kt.current)===null||fe===void 0||fe.style.setProperty("overflow","hidden"),setTimeout(()=>{var _e;(_e=kt.current)===null||_e===void 0||_e.style.removeProperty("overflow")},CSS.supports("overscroll-behavior","none")?1:10)}ta.current=!1},[Ti]),ar=w.useCallback((J,ce)=>{let fe=pt.current[0],_e=ce??null;if(_e===null){var De,Ne;_e=(J??"up")==="up"?(De=pt.current[0])<es.length?De+1:1:(Ne=pt.current[0])>1?Ne-1:es.length}return _e===0||_e===fe?null:_e},[es]),Ko=w.useCallback(({direction:J,detent:ce,behavior:fe})=>{let _e=()=>{let De=ar(J,ce);De&&me({type:"ACTUALLY_STEP",detent:De,behavior:fe})};ye.silent.matches("openness:open.scroll:ended.afterPaintEffectsRun:true")?_e():dc.current=_e},[ye.silent,ar,me]),ra=w.useCallback((J,ce)=>{Vt.current=J,ze?.(J),Ti({destinationDetent:J,behavior:ce??(ft.skip?"instant":"smooth"),animationConfig:ft,travelEndCallback:()=>me({machine:"staging",type:"NEXT"})})},[ze,Ti,ft,me]),Dr=w.useCallback((J,ce,fe,_e)=>{let De;if(J==="auto"){let Ne=_e==="center"?fe+(ce-fe)/2:fe;De=Wn==="chromium"?Ne<=1440?70+.25*Ne:.3*Ne:Wa()?Kt==="ios"||Kt==="ipados"?Ne<=716?15+.1*Ne:.12*Ne:.5*Ne:10}else if(typeof J=="function"){let Ne=parseInt(J(fe),10);De=Ne<1?1:Ne>fe/2?fe/2:Ne}else J==="initial"&&(De=1);return De},[]),Xo=w.useCallback(()=>{if(ni.current){let J=(ce,fe)=>ni.current.style.setProperty(ce,fe);J("--silk-aD",at.current.view.travelAxis.px),J("--silk-aE",at.current.view.crossAxis.px),J("--silk-aF",at.current.content.travelAxis.px),J("--silk-aG",at.current.content.crossAxis.px),J("--silk-aH",at.current.frontSpacer.travelAxis.px),J("--silk-aI",at.current.backSpacer.travelAxis.px),J("--silk-aJ",at.current.snapOutAccelerator.travelAxis.px),J("--silk-aK",at.current.detentMarkers[0].travelAxis.px)}},[]),Zo=w.useCallback(J=>{let ce=ni.current,fe=As.current,_e=[];Qn.current.forEach(Dt=>{_e.push(window.getComputedStyle(Dt))});let De=Dt=>parseFloat(Dt),Ne=Dt=>parseInt(Dt,10),et=Dt=>He==="right"||He==="left"||He==="horizontal"?Dt==="travelAxis"?"width":"height":Dt==="travelAxis"?"height":"width",Xt=Dt=>{let or,qr,lr,ts,We,Br;return qr=De(or=Dt.getPropertyValue(et("travelAxis"))),lr=Ne(or),We=Ne(ts=Dt.getPropertyValue(et("crossAxis"))),Br=Ne(ts),{travelAxis:{px:or,unitless:qr,unitlessRoundedDown:lr},crossAxis:{px:ts,unitless:We,unitlessRoundedDown:Br}}},Si=()=>{let Dt,or,qr=window.getComputedStyle(ni.current),lr=window.getComputedStyle(As.current),ts=0;yf(wt=>wt+1),at.current={view:{...Xt(qr)},scroll:{},snapOutAccelerator:{travelAxis:{}},frontSpacer:{travelAxis:{}},backSpacer:{travelAxis:{}},content:{...Xt(lr)},detentMarkers:[..._e.map((wt,gs)=>{let Ns=Xt(wt);return gs!==_e.length-1&&(ts+=Ns.travelAxis.unitless),{...Ns,accumulatedOffsets:{travelAxis:{px:ts+"px",unitless:ts,unitlessRoundedDown:null}}}})],progressValueAtDetents:[]};let We=at.current;We.scroll=We.view;let Br=Dr(C,We.view.travelAxis.unitless,We.content.travelAxis.unitless,Lt);We.snapOutAccelerator.travelAxis.px=Br+"px",We.snapOutAccelerator.travelAxis.unitless=Br,We.snapOutAccelerator.travelAxis.unitlessRoundedDown=Ne(Br);let Yu=We.detentMarkers.length,so=We.content.travelAxis.unitless-ts;We.detentMarkers[Yu-1]={travelAxis:{px:so+"px",unitless:so,unitlessRoundedDown:null},crossAxis:{px:"1px",unitless:1,unitlessRoundedDown:1},accumulatedOffsets:{travelAxis:{px:ts+so+"px",unitless:ts+so,unitlessRoundedDown:null}}};let ro=wt=>({before:wt(-2.1),exact:wt(0),after:wt(2.1)}),aa=We.content.travelAxis.unitless,vn=[ro(wt=>wt/aa)],mc;We.detentMarkers.slice(0,-1).forEach(wt=>{let gs=wt.accumulatedOffsets.travelAxis.unitless;vn.push(ro(Ns=>(gs+Ns)/aa))}),vn.push(ro(wt=>(aa+wt)/aa)),mc=vn[Ft];let _c=ea.current.length>0?ea.current[pt.current[1]]:0,Gu=(function(wt,gs){let Ns=0;for(let Yr=1;Yr<gs.length;Yr++){let yi=gs[Yr];Math.abs(yi-wt)<Math.abs(gs[Ns]-wt)&&(Ns=Yr)}return Ns})(_c??1,vn.map(wt=>wt.exact));nr([Gu,Gu]),We.progressValueAtDetents=vn,We.exactProgressValueAtDetents=vn.map(wt=>wt.exact),ea.current=We.progressValueAtDetents.map(wt=>wt.exact),We.progressValueAtInitialDetent=mc,Dt=Bt?He==="horizontal"||He==="vertical"?We.view.travelAxis.unitless/2+1:1:Ue?We.content.travelAxis.unitless-at.current.detentMarkers[0].travelAxis.unitless+ui:He==="horizontal"||He==="vertical"?We.view.travelAxis.unitless/2+We.view.travelAxis.unitless-(We.view.travelAxis.unitless-We.content.travelAxis.unitless)/2+We.snapOutAccelerator.travelAxis.unitless:Lt==="center"?We.view.travelAxis.unitless-(We.view.travelAxis.unitless-We.content.travelAxis.unitless)/2+We.snapOutAccelerator.travelAxis.unitless:We.view.travelAxis.unitless-(We.view.travelAxis.unitless-We.content.travelAxis.unitless)+We.snapOutAccelerator.travelAxis.unitless,We.frontSpacer.travelAxis.unitless=Dt,We.frontSpacer.travelAxis.px=Dt+"px",or=$e===!0&&x==="auto"?We.view.travelAxis.unitless+ui:He==="horizontal"||He==="vertical"?Bt?We.view.travelAxis.unitless/2:We.view.travelAxis.unitless/2+We.view.travelAxis.unitless-(We.view.travelAxis.unitless-We.content.travelAxis.unitless)/2+We.snapOutAccelerator.travelAxis.unitless:We.view.travelAxis.unitless,We.backSpacer.travelAxis.unitless=or,We.backSpacer.travelAxis.px=or+"px",Xo(),Uu(()=>()=>{let wt,gs;if(!ni.current)return{top:null,bottom:null};let Ns=ni.current.getBoundingClientRect(),Yr=Ns.top,yi=Ns.bottom,oa=Vo||He==="top"||He==="bottom",no=We.view[oa?"travelAxis":"crossAxis"].unitless,ao=We.content[oa?"travelAxis":"crossAxis"].unitless;return Lt==="left"||Lt==="right"||Lt==="center"?(wt=Yr+(no-ao)/2,gs=yi-(no-ao)/2):Lt==="top"?(wt=Yr,gs=yi-(no-ao)):Lt==="bottom"&&(wt=Yr+(no-ao),gs=yi),{top:wt,bottom:gs}})};Si();let Vr=(Dt,or)=>{let qr=new ResizeObserver(lr=>{lr.forEach(()=>or())});return qr.observe(Dt,{box:"border-box"}),qr},Or=()=>{Si(),Ti({runTravelCallbacksAndAnimations:!1})},os=!0,ls=Vr(ce,()=>{os?os=!1:Or()}),gn=!0,Zt=Vr(fe,()=>{gn?(Si(),gn=!1):Or()});return()=>{ls&&ce&&(ls.unobserve(ce),ls.disconnect()),Zt&&fe&&(Zt.unobserve(fe),Zt.disconnect())}},[He,Dr,C,Ft,$e,Xo,ui,x,Ti,nr,Lt,Ue,Bt,es]),oc=w.useCallback(J=>{let ce,fe=0,_e=J,De=0;return Ne=>{ce=Ne;let et=_e-Ne;return fe=et,(et===0||Math.abs(et)<Math.abs(De/2))&&ye.silent.matches("scrollContainerTouch:ongoing")&&(ce=_e-De/2,fe=_e-ce),Math.abs(fe)>=.1&&.35>Math.abs(fe)&&(ce=fe>=0?_e-.1:_e+.1,fe=fe>=0?.1:-.1),Ne<=0&&(ce=0),_e=ce,De=fe,ce}},[ye.silent]),Xa=w.useCallback(()=>{var J;let ce,fe,_e=He==="right"||He==="left"||He==="horizontal"?"scrollLeft":"scrollTop",De=kt.current,Ne=at.current.snapOutAccelerator.travelAxis.unitless,et=at.current.content.travelAxis.unitless,Xt=at.current.scroll.travelAxis.unitless,Si=oc((J=qt.current)!==null&&J!==void 0?J:at.current.progressValueAtDetents[pt.current[1]].exact),Vr=He==="right"||He==="bottom",Or=He==="left"||He==="top";if(Vr||Or){let os;if(Bt)os=Or?Zt=>1-Zt/et:Zt=>1+Zt/et;else if(Vr)if(Lt!=="center"){let Zt=Ue?at.current.detentMarkers[0].travelAxis.unitless-ui:-Ne;os=Dt=>(Dt+Zt)/et}else{let Zt=et+(Xt-et)/2;os=Dt=>(Dt-Ne)/Zt}else if(Or)if(Lt!=="center")os=Zt=>(et+ui-Zt)/et;else{let Zt=et+(Xt-et)/2;os=Dt=>(Zt+ui-Dt)/Zt}let ls=$e===!0?1:10,gn=$e===!0&&Ue?at.current.progressValueAtDetents[1].exact:0;fe=()=>{ce=De[_e];let Zt=Math.min(Math.max(os(ce),gn),ls);return Math.min(Math.max(Si(Zt),gn),ls)}}else if(He==="horizontal"||He==="vertical"){let os=(Xt-et)/2,ls=Bt?0:Ne+Xt-os,gn=et+os;fe=()=>{ce=De[_e];let Zt=1-Math.abs(ce-ls)/gn;return Math.max(Si(Math.max(Zt,0)),0)}}return fe},[He,oc,$e,Bt,Lt,Ue,ui,ic]),_n=w.useRef(),$u=w.useCallback(()=>{let J=kt.current,ce=()=>{me({machine:"openness:open.move",type:"MOVE_END"});for(let _e=0;_e<at.current.progressValueAtDetents.length;_e++){let De=at.current.progressValueAtDetents[_e].exact;qt.current>De-.01&&qt.current<De+.01&&(me({machine:"openness:open.scroll",type:"SCROLL_END"}),me({machine:"openness:open.swipe",type:"SWIPE_END"}))}},fe=()=>{fn.current?Go(!1):(hc.current||me({machine:"openness:open.scroll",type:"SCROLL_START"}),to.current||Qo.current||(Jo.current||me({machine:"openness:open.swipe",type:"SWIPE_START"}),fc.current||me({machine:"openness:open.move",type:"MOVE_START"}))),clearTimeout(_n.current),_n.current=setTimeout(ce,200)};return J.addEventListener("scroll",fe),()=>{J.removeEventListener("scroll",fe),clearTimeout(_n.current)}},[me,Go]),qt=w.useRef(null),pn=w.useCallback(()=>{let J;if(qo){let ce=at.current.progressValueAtDetents,fe=ce.length,_e=Xa();J=BO(()=>{let De,Ne=_e();if(qt.current!==Ne){for(let et=0;et<fe;et++){let Xt=ce[et],Si=Xt.after;Ne>Si&&et+1<fe&&Ne<ce[et+1].before?(De={start:et,end:et+1},nr([et,et+1])):Ne>Xt.before&&Ne<Si?(De={start:et,end:et},nr([et,et])):Ne<=0&&(De={start:0,end:0},nr([0,0]))}Yo.current(Ne,De),qt.current=Ne}})}return()=>{J?.()}},[nr,qo,Xa]),Za=w.useCallback(J=>{let ce=1e5,fe=_e=>{ce<Math.abs(_e.deltaY)?window.removeEventListener("wheel",fe,{passive:!1}):_e.preventDefault(),ce=Math.abs(_e.deltaY)};return window.addEventListener("wheel",fe,{passive:!1}),setTimeout(()=>{J("SWIPED_OUT")},100),()=>window.removeEventListener("wheel",fe,{passive:!1})},[]),Qa=w.useCallback((J,{send:ce})=>{let fe,_e=ni.current,De=As.current,Ne=kt.current,et=!1,Xt=()=>et=!0;window.addEventListener("wheel",Xt,{passive:!0,once:!0});let Si=new IntersectionObserver(function(Vr){for(let Or of Vr)Or.isIntersecting||(_e.style.setProperty("pointer-events","none","important"),_e.style.setProperty("opacity","0","important"),_e.style.setProperty("position","fixed","important"),_e.style.setProperty("top","-100px","important"),_e.style.setProperty("left","-100px","important"),De.style.setProperty("pointer-events","none","important"),Ne.style.setProperty("width","1px","important"),Ne.style.setProperty("height","1px","important"),Ne.style.setProperty("clip-path","inset(0)","important"),requestAnimationFrame(()=>{et?fe=Za(ce):ce("SWIPED_OUT")}))},{root:_e,threshold:[0]});return Si.observe(De),()=>{fe?.(),window.removeEventListener("wheel",Xt,{passive:!0,once:!0}),Si&&(Si.unobserve(De),Si.disconnect())}},[Za]),Cf=w.useRef(()=>0),lc=w.useCallback(()=>{let J=ni.current,ce=fe=>{nn({nativeEvent:fe,defaultBehavior:{},handler:se})};return J?.addEventListener("focus",ce,{capture:!0}),()=>{J?.removeEventListener("focus",ce,{capture:!0})}},[se]),cc=w.useCallback(J=>{kt.current.contains(J.target)&&me({machine:"scrollContainerTouch",type:"TOUCH_START"})},[me]),Ja=w.useCallback(J=>{kt.current.contains(J.target)&&me({machine:"scrollContainerTouch",type:"TOUCH_END"})},[me]);Pe("immediate",qe,{state:"staging:none",callback:rr,params:{newState:"none"}}),ot(qe,{state:"staging:none",transition:"OPEN",callback:w.useCallback(()=>Ce?.sendToOpennessMachine({machine:"staging",type:"GO_DOWN",skipOpening:ji?.skip}),[Ce,ji?.skip])}),ot(qe,{state:"staging:none",transition:"OPEN_PREPARED",callback:w.useCallback(J=>Ce?.sendToOpennessMachine({machine:"staging",type:"GO_DOWN",skipOpening:J.skipOpening}),[Ce])}),ot(qe,{state:"staging:none",transition:"GO_DOWN",callback:w.useCallback(J=>Ce?.sendToOpennessMachine({machine:"staging",type:"GO_DOWN",skipOpening:J.skipOpening}),[Ce])}),ot(qe,{state:"staging:none",transition:"ACTUALLY_CLOSE",callback:w.useCallback(()=>Ce?.sendToOpennessMachine({machine:"staging",type:"GO_UP"}),[Ce])}),ot(qe,{state:"staging:none",transition:"GO_UP",callback:w.useCallback(J=>Ce?.sendToOpennessMachine({machine:"staging",type:"GO_UP",skipClosing:J.skipClosing}),[Ce])}),Pe("immediate",qe,{state:"staging:open",callback:rr,params:{newState:"open"}}),Pe("immediate",qe,{state:"staging:open",callback:w.useCallback(()=>{me({machine:"longRunning",type:"TO_TRUE"})},[me])}),Pe("immediate",qe,{state:"staging:open",callback:w.useCallback(()=>{he||Se==null||Se(!0)},[he,Se])}),Pe("after-paint",qe,{state:"staging:open",callback:w.useCallback(()=>{requestAnimationFrame(()=>{me({machine:"openness",type:"READY_TO_OPEN",skipOpening:!0}),me({machine:"staging",type:"NEXT"})})},[me])}),ot(qe,{state:"staging:open",transition:"NEXT",callback:Ds}),Pe("immediate",qe,{state:"staging:opening",callback:rr,params:{newState:"opening"}}),Pe("immediate",qe,{state:"staging:opening",callback:w.useCallback(()=>{me({machine:"longRunning",type:"TO_TRUE"})},[me])}),Pe("immediate",qe,{state:"staging:opening",callback:w.useCallback(()=>{he||Se==null||Se(!0)},[he,Se])}),Pe("before-paint",qe,{state:"staging:opening",callback:w.useCallback(()=>{L?.(),Ar(0,{start:0,end:0})},[Ar,L])}),Pe("after-paint",qe,{state:"staging:opening",callback:w.useCallback(()=>{requestAnimationFrame(()=>{me({machine:"openness",type:"READY_TO_OPEN",skipOpening:!1})})},[me])}),Es("after-paint",qe,{state:"staging:opening",callback:w.useCallback(()=>(nO(pe),()=>aO(pe)),[pe])}),ot(qe,{state:"staging:opening",transition:"NEXT",callback:Ds}),Pe("immediate",qe,{state:"staging:stepping",callback:rr,params:{newState:"stepping"}}),Pe("after-paint",qe,{state:"staging:stepping",callback:w.useCallback(({detent:J,behavior:ce})=>{v?.("stepping"),ra(J,ce)},[v,ra])}),Na("immediate",qe,{state:"staging:stepping",callback:w.useCallback(()=>{v?.("idleInside")},[v])}),Pe("immediate",qe,{state:"staging:closing",callback:rr,params:{newState:"closing"}}),Pe("immediate",qe,{state:"staging:closing",callback:w.useCallback(()=>{he&&Se?.(!1)},[he,Se])}),Pe("after-paint",qe,{state:"staging:closing",callback:w.useCallback(()=>{me({machine:"openness",type:"READY_TO_CLOSE"})},[me])}),ot(qe,{state:"staging:closing",transition:"NEXT",callback:Ds}),Pe("immediate",qe,{state:"staging:go-down",callback:rr,params:{newState:"go-down"}}),ot(qe,{state:"staging:go-down",transition:"NEXT",callback:Ds}),Pe("immediate",qe,{state:"staging:going-down",callback:rr,params:{newState:"going-down"}}),ot(qe,{state:"staging:going-down",transition:"NEXT",callback:Ds}),Pe("immediate",qe,{state:"staging:going-up",callback:rr,params:{newState:"going-up"}}),ot(qe,{state:"staging:going-up",transition:"NEXT",callback:Ds});let Mi=Hr(ye,"longRunning");Pe("immediate",Mi,{state:"longRunning:true",callback:w.useCallback(()=>{we.current===null&&(we.current=document.activeElement)},[we])}),Pe("immediate",Mi,{state:"longRunning:true",callback:w.useCallback(()=>{Le(!0),ns?.(J=>J+1)},[Le,ns])}),Es("before-paint",Mi,{state:"longRunning:true",callback:Zo}),Pe("before-paint",Mi,{state:"longRunning:true",guard:!ji.skip,callback:w.useCallback(()=>{Ti({trackToTravelOn:Js,runTravelCallbacksAndAnimations:!1,destinationDetent:0})},[Ti,Js])}),Es("after-paint",Mi,{state:"longRunning:true",guard:D,callback:w.useCallback(()=>wO(un,I),[I])}),Es("after-paint",Mi,{state:"longRunning:true",callback:bf}),Pe("immediate",Mi,{state:"longRunning:false",callback:w.useCallback(()=>{Le(!1),ns?.(J=>J-1)},[Le,ns])}),Pe("immediate",Mi,{state:"longRunning:false",callback:w.useCallback(()=>{we.current=null},[we])}),Pe("before-paint",Mi,{state:"longRunning:false",callback:w.useCallback(()=>{Ge.removeAllOutletPersistedStylesFromSheet(pe)},[pe])}),Pe("after-paint",Mi,{state:"longRunning:false",callback:rc}),Es("before-paint",sa,{state:"active:true",callback:ia});let bt=Hr(ye,"openness"),Bs=Hr(ye,"openness:closed.status");Pe("immediate",bt,{state:"openness:closed",callback:mn,params:{newState:"idleOutside"}}),Pe("immediate",bt,{state:"openness:closed",callback:w.useCallback(()=>{me({machine:"longRunning",type:"TO_FALSE"})},[me])}),Pe("immediate",bt,{state:"openness:closed",callback:w.useCallback(()=>{he&&Se?.(!1)},[he,Se])}),Pe("immediate",bt,{state:"openness:closed",callback:w.useCallback(()=>{Be({machine:"active",type:"TO_FALSE"})},[Be])}),Pe("after-paint",bt,{state:"openness:closed",callback:w.useCallback(()=>{clearTimeout(_n.current),qt.current=null,nr([0,0]),Jn.current=!1,_t(-1),ta.current=!1},[_t,nr])}),ot(bt,{state:"openness:closed",transition:"READY_TO_OPEN",callback:w.useCallback(J=>{Be({machine:"position",type:"READY_TO_GO_FRONT",skipOpening:J.skipOpening})},[Be])}),yO(me,Bs,"openness:closed.status:pending",{delay:3e3}),Na("immediate",Bs,{state:"openness:closed.status:pending",callback:w.useCallback(()=>{me("SWIPE_RESET")},[me])}),Pe("before-paint",Bs,{state:"openness:closed.status:flushing-to-preparing-opening",callback:w.useCallback(()=>{me({machine:"openness:closed.status",type:""})},[me])}),Pe("before-paint",Bs,{state:"openness:closed.status:flushing-to-preparing-open",callback:w.useCallback(()=>{me({machine:"openness:closed.status",type:""})},[me])}),Pe("after-paint",Bs,{state:"openness:closed.status:preparing-opening",callback:w.useCallback(()=>{me({machine:"staging",type:"OPEN_PREPARED",skipOpening:!1})},[me])}),Pe("after-paint",Bs,{state:"openness:closed.status:preparing-open",callback:w.useCallback(()=>{me({machine:"staging",type:"OPEN_PREPARED",skipOpening:!0})},[me])}),Pe("immediate",Bs,{state:"openness:closed.status:safe-to-unmount",callback:w.useCallback(()=>{Ee?.(!0)},[Ee])}),Na("immediate",Bs,{state:"openness:closed.status:safe-to-unmount",callback:w.useCallback(()=>{Ee?.(!1)},[Ee])}),Pe("immediate",bt,{state:"openness:opening",callback:mn,params:{newState:"entering"}}),Pe("before-paint",bt,{state:"openness:opening",callback:w.useCallback(()=>{Vt.current=Ft,ze?.(Ft),Ti({trackToTravelOn:Js,destinationDetent:Ft,behavior:"smooth",animationConfig:ji,travelEndCallback:()=>me("NEXT"),runOnTravelStart:!1})},[Js,ze,Ti,Ft,ji,me])}),ot(bt,{state:"openness:opening",transition:"NEXT",callback:w.useCallback(()=>{Be("NEXT"),me({machine:"staging",type:"NEXT"})},[Be,me])}),Pe("immediate",bt,{state:"openness:open",callback:mn,params:{newState:"idleInside"}}),Pe("immediate",bt,{state:"openness:open",callback:w.useCallback(()=>{Be({machine:"active",type:"TO_TRUE"})},[Be])}),Pe("before-paint",bt,{state:"openness:open",guard:ji.skip,callback:w.useCallback(()=>{Vt.current=Ft,ze?.(Ft),Ti({trackToTravelOn:Js,destinationDetent:Ft})},[Ft,ze,Ti,Js])}),Es("before-paint",bt,{state:"openness:open",callback:w.useCallback(()=>{if(Wa()&&Qe){var J;(J=kt.current)===null||J===void 0||J.style.setProperty("will-change","transform"),requestAnimationFrame(()=>{var ce;return(ce=kt.current)===null||ce===void 0?void 0:ce.style.removeProperty("will-change","transform")})}},[Qe]),params:{unusedDep:ic}}),Es("before-paint",bt,{state:"openness:open",guard:!Re,callback:$u}),Pe("after-paint",qe,{state:"staging:open",guard:$e===!0&&x==="auto",callback:w.useCallback(()=>{Ft===es.length?me({machine:"frontStuck",type:"STUCK_START"}):Qe&&Ft===1&&me({machine:"backStuck",type:"STUCK_START"})},[me,Ft,es,Qe])}),Es("after-paint",bt,{state:"openness:open",guard:!Re&&!Bt&&!Ue,callback:Qa,params:{send:me}}),Es("after-paint",bt,{state:"openness:open",callback:lc}),ot(bt,{state:"openness:open",transition:"READY_TO_CLOSE",callback:w.useCallback(()=>Be("READY_TO_GO_OUT"),[Be])}),ot(bt,{state:"openness:open",transition:"ACTUALLY_CLOSE",callback:w.useCallback(()=>{Vt.current=null,ze?.(0),L?.(),Be("GO_OUT")},[ze,L,Be])}),ot(bt,{state:"openness:open",transition:"SWIPED_OUT",callback:w.useCallback(()=>{var J;(J=kt.current)===null||J===void 0||J.style.setProperty("scroll-snap-type","none","important"),Vt.current=null,ze?.(0),Be("GO_OUT")},[ze,Be])}),Na("immediate",bt,{state:"openness:open",callback:w.useCallback(()=>{me("SWIPE_END")},[me])});let uc=Hr(ye,"backStuck"),Qo=w.useRef(!1);ot(uc,{state:"backStuck:false",transition:"STUCK_START",callback:w.useCallback(()=>Qo.current=!0,[])}),ot(uc,{state:"backStuck:true",transition:"STUCK_END",callback:w.useCallback(()=>Qo.current=!1,[])}),ot(uc,{state:"backStuck:false",transition:"STUCK_START",guard:$e===!0&&x==="auto",callback:w.useCallback(()=>{ye.silent.matches("scrollContainerTouch:ended")&&Os("back")},[ye.silent,Os])});let eo=Hr(ye,"frontStuck"),to=w.useRef(!1);ot(eo,{state:"frontStuck:false",transition:"STUCK_START",callback:w.useCallback(()=>to.current=!0,[])}),ot(eo,{state:"frontStuck:true",transition:"STUCK_END",callback:w.useCallback(()=>to.current=!1,[])}),ot(eo,{state:"frontStuck:false",transition:"STUCK_START",guard:$e===!0&&x==="auto",callback:w.useCallback(()=>{ye.silent.matches("openness:open")&&ye.silent.matches("scrollContainerTouch:ended")&&Os("front")},[ye.silent,Os])}),Pe("immediate",ye,{state:"scrollContainerTouch:ended",guard:$e===!0&&x==="auto",callback:w.useCallback(()=>{ta.current&&setTimeout(()=>{requestAnimationFrame(()=>{ye.silent.matches("openness:open")&&(ye.silent.matches("backStuck:true")?Os("back"):ye.silent.matches("frontStuck:true")&&Os("front"))})},80)},[ye.silent,Os])});let na=Hr(ye,"openness:open.scroll"),hc=w.useRef(!1);Pe("immediate",na,{state:"openness:open.scroll:ongoing",callback:w.useCallback(()=>hc.current=!0,[])}),Na("immediate",na,{state:"openness:open.scroll:ongoing",callback:w.useCallback(()=>hc.current=!1,[])}),Pe("immediate",na,{state:"openness:open.scroll:ongoing",callback:w.useCallback(()=>{ta.current=!0},[])}),Es({start:"immediate",update:"before-paint"},na,{state:"openness:open.scroll:ongoing",callback:pn});let dc=w.useRef(()=>{});Pe("after-paint",na,{state:"openness:open.scroll:ended",callback:w.useCallback(()=>{me({machine:"openness:open.scroll:ended.afterPaintEffectsRun",type:"OCCURRED"}),dc.current(),dc.current=()=>{}},[me])}),Na("immediate",na,{state:"openness:open.scroll:ended",callback:w.useCallback(()=>{me({machine:"openness:open.scroll:ended.afterPaintEffectsRun",type:"RESET"})},[me])});let fc=w.useRef(!1);Pe("immediate",ye,{state:"openness:open.move:ongoing",callback:w.useCallback(()=>{fc.current=!0,Yo.current=qo},[qo])}),Na("immediate",ye,{state:"openness:open.move:ongoing",callback:w.useCallback(()=>{fc.current=!1,Yo.current=()=>{}},[])});let Jo=w.useRef(!1);Pe("immediate",ye,{state:"openness:open.swipe:ongoing",callback:w.useCallback(()=>Jo.current=!0,[])}),Na("immediate",ye,{state:"openness:open.swipe:ongoing",callback:w.useCallback(()=>Jo.current=!1,[])}),Pe("immediate",ye,{state:"openness:open.swipe:ongoing",callback:w.useCallback(()=>L?.(),[L])}),Pe("immediate",ye,{state:"openness:open.swipe:ongoing",callback:mn,params:{newState:"stepping"}}),Pe("immediate",ye,{state:"openness:open.swipe:ended",callback:w.useCallback(()=>ir(),[ir])}),Pe("immediate",ye,{state:"openness:open.swipe:ended",guard:typeof v=="function",callback:w.useCallback(()=>{ye.silent.matches("openness:open")&&v("idleInside")},[ye.silent,v])});let Wu=w.useCallback(()=>{!jr.matches("position:front")||pt.current[0]===0&&pt.current[1]===0||Qe&&pt.current[0]!==pt.current[1]?he===!1&&Se?.(!0):me("ACTUALLY_CLOSE")},[jr,me,he,Se,Qe]);ot(ye,{state:"openness:open.evaluateCloseMessage:true",transition:"CLOSE",callback:Wu}),ot(ye,{state:"openness:open.evaluateCloseMessage:false",transition:"CLOSE",callback:Wu}),ot(ye,{state:"openness:open.evaluateStepMessage:true",transition:"STEP",callback:Ko}),ot(ye,{state:"openness:open.evaluateStepMessage:false",transition:"STEP",callback:Ko}),Pe("immediate",bt,{state:"openness:closing",callback:mn,params:{newState:"exiting"}}),Pe("before-paint",bt,{state:"openness:closing",callback:w.useCallback(()=>{Vt.current=0,ze?.(0),Ti({trackToTravelOn:be.track,destinationDetent:0,behavior:"smooth",animationConfig:be,travelEndCallback:()=>me("NEXT")})},[ze,Ti,be,me])}),ot(bt,{state:"openness:closing",transition:"NEXT",callback:w.useCallback(()=>{Be("NEXT"),me({machine:"staging",type:"NEXT"})},[Be,me])});let xf=w.useCallback(()=>me({machine:"skipOpening",type:ji.skip?"TO_TRUE":"TO_FALSE"}),[me,ji.skip]);Es("after-paint",ye,{state:"",callback:xf});let kf=w.useCallback(()=>me({machine:"skipClosing",type:be.skip?"TO_TRUE":"TO_FALSE"}),[me,be.skip]);Es("after-paint",ye,{state:"",callback:kf}),w.useEffect(()=>{he!==void 0&&me(he?"OPEN":"CLOSE")},[he,me]);let Ef=fu(()=>{rc(),Zn?.(pe),Ge.removeAllOutletPersistedStylesFromSheet(pe)}),el=w.useRef(!0),Tf=fu(()=>{he&&Se?.(!1)});w.useEffect(()=>()=>{!el.current&&(Tf(),rr(null,{newState:"none"}),Ef(),Le(!1),Mi.silent.matches("longRunning:true")&&ns?.(J=>J-1))},[]),w.useEffect(()=>()=>el.current=!1),w.useEffect(()=>{ke!==void 0&&pt.current[0]!==ke&&pt.current[1]!==ke&&Vt.current!==ke&&me({type:"STEP",activeDetent:ke})},[ke,me]),w.useEffect(()=>{let J=()=>{var ce;return(ce=kt.current)===null||ce===void 0?void 0:ce.scrollTo(0,0)};return window.addEventListener("unload",J),()=>window.removeEventListener("unload",J)},[]);let ju=fu((J,ce)=>{Ei.current&&!bt.matches("openness:closed")&&Ar(J,ce)}),Vu=fu(Fu);w.useEffect(()=>()=>{ju(0,{start:0,end:0}),Ei.current&&Vu(),Cx(null)},[Mi.silent,ns,ju,Vu]);let io=Ui("Sheet",{staging:qe.getValues()[0],openness:bt.getValues()[0],opennessClosedStatus:Bs.getValues()[0],position:jr.getValues()[0],positionCoveredStatus:as.getValues()[0],placement:Lt,track:He,swipeDisabled:Re,swipeOutDisabledWithDetent:Ue,swipeOvershootDisabled:$e,swipeTrap:Wr,scrollContainerShouldBePassThrough:_s}),tl=w.useMemo(()=>!Bs.matches(["openness:closed.status:flushing-to-preparing-open","openness:closed.status:flushing-to-preparing-opening","openness:closed.status:safe-to-unmount"]),[Bs]),Rf=w.useMemo(()=>bt.matches("openness:closed")&&tl,[tl,bt]),qu=w.useMemo(()=>qe.matches(["staging:opening","staging:open"]),[qe]),Mf=w.useMemo(()=>tl||qu,[tl,qu]),Af=w.useMemo(()=>W&&(jr.matches(["position:front","position:covered"])||ge!=="none"),[W,jr,ge]);return U.jsx(Hu,{genericContext:Ga,customContext:de,value:K,children:U.jsx(Fr.Provider,{value:{sheetContext:B,titleId:mt,descriptionId:yt,styleAttributes:io,backdropRef:Zs,scrollContainerRef:kt,frontSpacerRef:Er,contentWrapperRef:Wi,contentRef:As,backSpacerRef:Tr,detentMarkersRefs:Qn,leftEdgeRef:un,setBackdropSwipeable:Ls,setBleedingBackgroundPresent:ci,detents:es,longRunningState:Mi,staging:ge,layerCovered:Xe,placement:Lt,track:He,travelAxis:tr,nativeEdgeSwipePrevention:D,bleedingBackgroundPresent:Mr,setBackdropTravelHandler:Iu,ancestorPrimarySwipeTrapActiveOnYAxis:Wr==="vertical"||Wr==="both",scrollContainerTouchStartHandler:cc,scrollContainerTouchEndHandler:Ja,getContentCoordinatesWhenRestingOnLastDetent:sc,getOffsetFromCurrentToNextDetent:Cf},children:Mf&&U.jsxs("div",{id:pe,...io("view",["track","staging","openness","opennessClosedStatus","scrollContainerShouldBePassThrough"],{className:u,dataSilk:[h,"0ab",Q&&"0ah",er&&"0aj",Rf&&"0ak","0al"]}),ref:Xs,"aria-labelledby":mt,"aria-describedby":yt,...G,role:ue,tabIndex:-1,children:[U.jsx(qn.Root,{...io("primaryScrollTrapRoot",["track","scrollContainerShouldBePassThrough"]),active:Wr!=="none",axis:Wr,children:U.jsx(qn.Stabiliser,{children:l})}),U.jsx(qn.Root,{...io("secondaryScrollTrapRoot",["scrollContainerShouldBePassThrough"]),automaticallyDisabledForOptimisation:!1,preventBodyScroll:Af})]})})})});Ax.displayName="Sheet.Anonymous";class ec extends Ve.Component{static getDerivedStateFromError(e){return{hasError:!0}}componentDidCatch(e){console.error(e)}render(){return this.state.hasError?U.jsx("h1",{children:"Something went wrong."}):this.props.children}constructor(e){super(e),this.state={hasError:!1}}}let Lx=Ve.forwardRef((t,e)=>{let{asChild:i,children:n,className:a,"data-silk":l,...u}=t,h=i?Fi:"span",f=Ui("VisuallyHidden",{});return U.jsx(h,{...f("root",[],{className:a,dataSilk:[l]}),...u,ref:e,children:n})});Lx.displayName="VisuallyHidden.Root";let UO={Root:Lx},gf=Ve.createContext(null);gf.displayName="SheetStack.GenericContext";let Eu=[],FO=(t,e)=>{let i=()=>{let[n,a]=(function(h){let f=0,d=0;for(;h;)f+=h.offsetLeft,d+=h.offsetTop,h=h.offsetParent;return[f,d]})(t),l={top:a+scrollY,bottom:Math.max(t.offsetHeight-(a+scrollY+innerHeight),0),left:n+scrollX,right:Math.max(t.offsetWidth-(n+scrollX+innerWidth),0),height:innerHeight,width:innerWidth},u=l.top<=0&&l.bottom<=0&&l.left<=0&&l.right<=0?null:l;e(u)};Eu.push({element:t,callback:i}),i(),Eu.length===1&&(ku=(function(n,a){let l;return function(){clearTimeout(l),l=window.setTimeout(()=>{clearTimeout(l),n()},100)}})(()=>{Eu.forEach(n=>n.callback())}),window.addEventListener("scroll",ku),window.addEventListener("resize",ku))},$O=t=>{(Eu=Eu.filter(e=>e.element!==t)).length||(window.removeEventListener("scroll",ku),window.removeEventListener("resize",ku))},iv=(t,e)=>{let i=w.useId(),n=w.useRef(null),a=Rs(n,e),{sheetId:l,stackId:u,sheetsCount:h,travelAnimation:f,stackingAnimation:d,style:g}=t,{sheetId:v,longRunning:p}=vf(l),[S,y]=w.useState(null),{willChangesValuesString:C,outletTransformedOnAnimation:x,nonAnimatedTravelStyles:R,nonAnimatedStackingStyles:L,clippedToViewport:N}=w.useMemo(()=>{let V=[],se={},Q={},A=!1,O=!1;return[f,d].forEach((P,$)=>{if(P){let E=P.hasOwnProperty("properties")?P.properties:P;Object.entries(E).forEach(([M,z])=>{!z||(M==="clipBoundary"&&(O=!0),typeof z=="string"&&($===0?se[M]=z:Q[M]=z),bx.includes(M)||M==="transform"?V.includes("transform")||(V.push("transform"),A=!0):M!=="opacity"||V.includes("opacity")||V.push("opacity"))})}}),{willChangesValuesString:V.join(", "),outletTransformedOnAnimation:A,nonAnimatedTravelStyles:se,nonAnimatedStackingStyles:Q,clippedToViewport:O}},[d,f]),{modifiedTravelAnimation:T,modifiedNonAnimatedTravelStyles:W,modifiedStackingAnimation:D,modifiedNonAnimatedStackingStyles:I}=w.useMemo(()=>{let V;if(S){let{top:$,bottom:E,left:M,right:z}=S;V=`${$-.1}px ${z}px ${E}px ${M}px`}let se=($,E)=>{let M,z,q;if(!$)return[];let{top:G,left:B,height:K,width:te}=S||{},ne=$.hasOwnProperty("properties")?$.properties:$,de=ne.clipBoundary,ue=ne.clipBorderRadius,he=ne.clipTransformOrigin;if(de&&(he||(he="50% 50% 0"),q=he.split(" ").map(Ze=>Ze==="top"||Ze==="left"?"0%":Ze==="bottom"||Ze==="right"?"100%":Ze).map((Ze,ke)=>{if(ke===0){let ze=Ze;return Ze.includes("%")?ze=Ze.replace(/\b\d+%/,pe=>parseFloat(pe)/100*te+"px"):Ze==="0"&&(ze="0px"),"calc("+B+"px + "+ze+")"}if(ke===1){let ze=Ze;return Ze.includes("%")?ze=Ze.replace(/\b\d+%/,pe=>parseFloat(pe)/100*K+"px"):Ze==="0"&&(ze="0px"),"calc("+G+"px + "+ze+")"}}).join(" ")),de)if(de==="layout-viewport")if(V){if(typeof ue=="string")M=`inset(${V} round ${ue})`;else if(Array.isArray(ue)){let Ee=`inset(${V} round `;M=({tween:Le})=>Ee+Le(...ue)+")"}else if(typeof ue=="function"){let Ee=`inset(${V} round `;M=Le=>Ee+ue(Le)+")"}else M=`inset(${V})`;z="0.001px"}else z=ue??null;else if(typeof de=="function")if(V){if(typeof ue=="string")M=Ee=>de(Ee)!=="none"?`inset(${V} round ${ue})`:"none";else if(Array.isArray(ue)){let Ee=`inset(${V} round `;M=Le=>de(Le)!=="none"?Ee+Le.tween(...ue)+")":"none"}else if(typeof ue=="function"){let Ee=`inset(${V} round `;M=Le=>de(Le)!=="none"?Ee+ue(Le)+")":"none"}else M=Ee=>de(Ee)!=="none"?`inset(${V})`:"none";z="0.001px"}else ue&&(z=Ee=>{if(de(Ee)==="layout-viewport")return ue});else de==="none"&&(M="none",z=ue??null);else{let Ee={...ne},Le={...E};return delete Ee.clipBoundary,delete Ee.clipBorderRadius,delete Ee.clipTransformOrigin,delete Le.clipBoundary,delete Le.clipBorderRadius,delete Le.clipTransformOrigin,[Ee,Le]}let Se={...ne},we={...E};return delete Se.clipBoundary,delete Se.clipBorderRadius,delete Se.clipTransformOrigin,delete we.clipBoundary,delete we.clipBorderRadius,delete we.clipTransformOrigin,typeof M=="string"?we.clipPath=M:Se.clipPath=M,typeof z=="string"?we.borderRadius=z:Se.borderRadius=z,typeof q=="string"&&(we.transformOrigin=q),[Se,we]},[Q,A]=se(f,R),[O,P]=se(d,L);return{modifiedTravelAnimation:Q,modifiedNonAnimatedTravelStyles:A,modifiedStackingAnimation:O,modifiedNonAnimatedStackingStyles:P}},[S,L,R,d,f]);vi(()=>{let V=n.current,se=i&&N&&(!u&&p||u&&h>=1);if(se)return FO(V,y),()=>{se&&$O(V)}},[i,N,p,u,h]);let H=w.useMemo(()=>u?{...g,...h>=1?I:{},willChange:h>=1?C+(g?.willChange?", "+g?.willChange:""):g?.willChange}:{...g,...p?W:{},...h>=1?I:{},willChange:p?C+(g?.willChange?", "+g?.willChange:""):g?.willChange},[u,g,W,I,p,h,C]);return vi(()=>{let V,se=Ge.findActualFixedComponentsInsideOutlet(n.current);if(se.length)return x&&(V=(Q=>{let A=()=>{se.forEach(P=>{if(!P.element||P.compensated)return;let $=0,E=0,M=P.element.style.transform,z=window.getComputedStyle(P.element),q=z.getPropertyValue("--silk-fixed-side"),G=z.getPropertyValue("transform");Ge.updateFixedComponent({id:P.id,initialInlineCSSTransform:M,compensated:!0}),$=q.includes("bottom")?-1*(n.current.offsetHeight-(scrollY+window.innerHeight)):scrollY,E=q.includes("right")?-1*(n.current.offsetWidth-(scrollX+window.innerWidth)):scrollX,(Math.abs($)!==0||Math.abs(E)!==0)&&P.element.style.setProperty("transform",(G!=="none"?G+" ":"")+"translateX("+E+"px) translateY("+$+"px)")})},O=()=>{window.removeEventListener("resize",A),window.removeEventListener("scroll",A),se.forEach(P=>{P.element&&P.compensated&&(P.initialInlineCSSTransform?(P.element.style.setProperty("transform",P.initialInlineCSSTransform),Ge.updateFixedComponent({id:P.id,initialInlineCSSTransform:void 0,compensated:!1})):(P.element.style.removeProperty("transform"),Ge.updateFixedComponent({id:P.id,compensated:!1})))})};return Q?(A(),window.addEventListener("resize",A),window.addEventListener("scroll",A)):O(),O})(u?h>0:p)),V},[p,i,x,h,u]),vi(()=>(Ge.addOutletToSheet(v,i),()=>Ge.removeOutletFromSheet(v,i)),[i,v]),vi(()=>{let V=n.current;return T&&Ge.addAnimationToSheetOrStack({sheetId:v,type:"travel",element:V,config:T}),D&&Ge.addAnimationToSheetOrStack({sheetId:u?null:v,stackId:u,type:"stacking",element:V,config:D}),()=>{T&&Ge.removeAnimationFromSheetOrStack({sheetId:v,type:"travel",element:V}),D&&Ge.removeAnimationFromSheetOrStack({sheetId:u?null:v,stackId:u,type:"stacking",element:V})}},[v,u,T,D]),{ref:n,outletId:i,styleValue:H,composedRef:a}},vf=t=>w.useContext(t??Ga)||{};ec.displayName="Sheet.ErrorBoundary",Fi.displayName="Sheet.Slot.Root";let jo=Ve.forwardRef((t,e)=>{let{asChild:i,forComponent:n,travelAnimation:a,stackingAnimation:l,style:u,className:h,...f}=t,{staging:d,StackContext:g}=vf(n),v=g??Ve.createContext(null),{sheetsCount:p}=w.useContext(v)||{},{styleValue:S,composedRef:y}=iv({sheetId:n,sheetsCount:p,travelAnimation:a,stackingAnimation:l,style:u},e),C=w.useMemo(()=>d!=="none",[d]),x=i?Fi:"div",R=Ui("Sheet",{});return U.jsx(x,{style:S,...R("outlet",[],{className:h,dataSilk:[C&&"0aj"]}),...f,ref:y})});jo.displayName="Sheet.Outlet";let sv=Ve.forwardRef(({asChild:t,...e},i)=>{let n=t?Fi:"button",{forComponent:a,className:l,"data-silk":u,onPress:h,onClick:f,children:d,action:g="present",travelAnimation:v,stackingAnimation:p,...S}=e,{sheetRole:y,sheetId:C,open:x,onOpenChange:R,elementFocusedLastBeforeShowing:L}=vf(a),N=Ge.findSheet(C),T=w.useRef(null),W=Rs(T,i),D=w.useMemo(()=>(y==="dialog"||y==="alertdialog")&&g==="present"?"dialog":void 0,[g,y]),I=w.useMemo(()=>g==="present"||g==="dismiss"?x:void 0,[g,x]),H=Ui("Sheet",{});return U.jsx(jo,{forComponent:a,asChild:!0,travelAnimation:v,stackingAnimation:p,children:U.jsx(n,{...H("trigger",[],{className:l,dataSilk:[u]}),onClick:V=>{var se,Q;let{forceFocus:A,runAction:O}=nn({nativeEvent:V,defaultBehavior:{forceFocus:!0,runAction:!0},handler:h});A&&((se=T.current)===null||se===void 0||se.focus({preventScroll:!0})),O&&(g==="present"?(L.current=T.current,R(!0)):g==="dismiss"?R(!1):(g==="step"||g.type==="step")&&(N==null||(Q=N.sendToOpennessMachine)===null||Q===void 0||Q.call(N,{type:"STEP",direction:g==="step"?"up":g.direction,detent:g==="step"?null:g.detent}))),f?.(V)},"aria-haspopup":D,"aria-controls":C,"aria-expanded":I,ref:W,...S,children:d})})});sv.displayName="Sheet.Trigger";let Dx=Ve.forwardRef((t,e)=>{let{children:i,className:n,action:a="step",...l}=t,{detents:u}=w.useContext(Fr)||{},h=u.length===1&&a!=="dismiss",f=Ui("Sheet",{});return U.jsx(sv,{...f("handle",[],{className:n}),action:a,disabled:h,...l,ref:e,children:U.jsx(UO.Root,{children:i??(a==="dismiss"?"Dismiss":"Cycle")})})});Dx.displayName="Sheet.Handle";let Ox=t=>{var e;let[i,n]=w.useState(!1);return w.useEffect(()=>(n(!0),()=>n(!1)),[]),i?vw.createPortal(t.children,(e=t.container)!==null&&e!==void 0?e:document.body):null};Ox.displayName="Sheet.Portal";let WO=({rootRef:t})=>(w.useEffect(()=>{let e=t.current;if(!e)return;getComputedStyle(e).getPropertyValue("--silk-aY").trim()!=="1"&&console.warn("The CSS styles for Silk are not found. Please refer to the documentation on how to import them.")},[t]),null),Bx=Ve.forwardRef((t,e)=>{let{className:i,"data-silk":n,license:a,sheetRole:l,componentId:u,forComponent:h,defaultPresented:f,presented:d,onPresentedChange:g,defaultActiveDetent:v,activeDetent:p,onActiveDetentChange:S,onSafeToUnmountChange:y,...C}=t,x=w.useRef(null),R=Rs(x,e),L=f!=null&&f,[N,T]=w.useState(L),W=d!==void 0&&g!==void 0,D=w.useMemo(()=>W?d:N,[W,d,N]),I=w.useMemo(()=>W?g:T,[W,g,T]),H=w.useRef(null),[V,se]=w.useState(!L),Q=w.useCallback(G=>{y?.(G),se(G)},[y]),[A,O]=w.useState(D),[P,$]=w.useState("none"),E=h==="closest"?gf:h,M=$o(),z={license:a,StackContext:E,CustomSheetContext:u,sheetId:M,sheetRole:l,open:D,onOpenChange:I,onSafeToUnmountChange:Q,defaultActiveDetent:v,activeDetent:p,onActiveDetentChange:S,safeToUnmount:V,longRunning:A,setLongRunning:O,staging:P,setStaging:$,elementFocusedLastBeforeShowing:H,...C},q=Ui("Sheet");return U.jsxs(ec,{children:[U.jsx(WO,{rootRef:x}),U.jsx(Hu,{genericContext:Ga,customContext:u,value:z,children:U.jsx(jo,{...q("root",[],{className:i,dataSilk:[n]}),ref:R,...C})})]})});Bx.displayName="Sheet.Root";let Nx=Ve.forwardRef((t,e)=>{let{forComponent:i}=t,{open:n,safeToUnmount:a}=vf(i);return(n||!a)&&U.jsx(Ax,{...t,ref:e})});Nx.displayName="Sheet.View";let Px=Ve.forwardRef(({asChild:t,swipeable:e=!0,...i},n)=>{let{longRunningState:a,backdropRef:l,styleAttributes:u,setBackdropSwipeable:h,setBackdropTravelHandler:f}=w.useContext(Fr)||{},{className:d,"data-silk":g,children:v,travelAnimation:p,stackingAnimation:S,themeColorDimming:y=!1,...C}=i,x=Rs(l,n);w.useEffect(()=>(h(e),()=>{h(!1)}),[h,e]);let R=w.useMemo(()=>({opacity:({progress:D})=>Math.min(.33*D,.33),...p}),[p]),[L,N]=w.useState(R),T=$o(),W=w.useRef(0);return vi(()=>{let D=!1,I=()=>{D&&Ge.removeThemeColorDimmingOverlay(T)};if(a.matches("longRunning:true")){let H;if(!(D=!!(Wa()&&!KD()&&y==="auto"&&R.opacity&&Ge.getAndStoreUnderlyingThemeColorAsRGBArray())))return;let{opacity:V,...se}=R;if(N({opacity:"ignore",...se}),Array.isArray(V)){let[Q,A]=V;H=({progress:O})=>Q+(A-Q)*O}else typeof V=="function"&&(H=V,N({opacity:"ignore",...se}));if(H&&l&&f){let Q=window.getComputedStyle(l.current).backgroundColor,A=Ge.updateThemeColorDimmingOverlay({abortRemoval:!0,dimmingOverlayId:T,color:Q,alpha:W.current}),O=P=>{var $;let E=H(P);Ge.updateThemeColorDimmingOverlayAlphaValue(A,E),($=l.current)===null||$===void 0||$.style.setProperty("opacity",E),W.current=E};f(()=>O)}}return a.matches("longRunning:false")&&I(),()=>{I()}},[a,T,l,f,y,p,R]),U.jsx(jo,{...u("backdrop",["scrollContainerShouldBePassThrough"],{className:d,dataSilk:[g]}),travelAnimation:L,stackingAnimation:S,...C,ref:x,asChild:t,children:v})});Px.displayName="Sheet.Backdrop";let zx=Ve.forwardRef((t,e)=>{var i;let{asChild:n,children:a,className:l,"data-silk":u,travelAnimation:h,stackingAnimation:f,style:d,...g}=t,v=n?Fi:"div",{StackContext:p}=w.useContext(Ga)||{},S=p??Ve.createContext(null),{sheetsCount:y}=w.useContext(S)||{},{styleValue:C,composedRef:x}=iv({sheetId:Ga,sheetsCount:y,travelAnimation:h,stackingAnimation:f,style:d},e),{scrollContainerRef:R,frontSpacerRef:L,contentWrapperRef:N,contentRef:T,backSpacerRef:W,detentMarkersRefs:D,leftEdgeRef:I,nativeEdgeSwipePrevention:H,scrollContainerTouchStartHandler:V,scrollContainerTouchEndHandler:se,styleAttributes:Q,detents:A,bleedingBackgroundPresent:O}=w.useContext(Fr)||{},P=Rs(T,x);return U.jsxs("div",{...Q("scrollContainer",["track","swipeDisabled","swipeOvershootDisabled","staging","positionCoveredStatus","scrollContainerShouldBePassThrough","swipeTrap"],{dataSilk:["0ac"]}),ref:R,onTouchStart:V,onTouchEnd:se,children:[U.jsx("div",{...Q("frontSpacer",["track"]),ref:L}),U.jsxs("div",{...Q("contentWrapper",["placement","track","swipeOvershootDisabled","swipeOutDisabledWithDetent","staging","position"]),ref:N,children:[U.jsx(v,{...Q("content",["track","placement","scrollContainerShouldBePassThrough"],{className:l,dataSilk:[u,O&&"0af"]}),style:C,...g,ref:P,children:a}),H&&U.jsx("div",{...Q("leftEdge",["track"]),ref:I})]}),U.jsx("div",{...Q("backSpacer",["track"]),ref:W,children:A.map(($,E)=>U.jsx("div",{ref:M=>{D.current.length>A.length&&(D.current=D.current.slice(0,A.length)),D.current[E]=M},...Q("detentMarker",["track","swipeOutDisabledWithDetent"]),style:{"--silk-aA":(i=A[E-1])!==null&&i!==void 0?i:"0px","--silk-aB":$,"--silk-aC":E}},E))})]})});zx.displayName="Sheet.Content";let Hx=Ve.forwardRef(({asChild:t,...e},i)=>{let{className:n,"data-silk":a,...l}=e,{staging:u,placement:h,track:f,setBleedingBackgroundPresent:d}=w.useContext(Fr)||{};w.useEffect(()=>(d(!0),()=>{d(!1)}),[d]);let g=f==="horizontal"||f==="vertical",v=Ui("Sheet",{staging:u,placement:h,track:f,bleedDisabled:g});return U.jsx(jo,{asChild:t,...v("bleedingBackground",["staging","placement","track","bleedDisabled"],{className:n,dataSilk:[a]}),...l,ref:i})});Hx.displayName="Sheet.BleedingBackground";let jO=Ve.forwardRef((t,e)=>{let{className:i,"data-silk":n,...a}=t,{travelAxis:l}=w.useContext(Fr)||{},u=w.useMemo(()=>l==="vertical"?"horizontal":"vertical",[l]),[h,f]=w.useState(!1);w.useEffect(()=>f(Wa()),[]);let d=Ui("SpecialWrapper");return U.jsx(qn.Root,{...d("root",[],{className:i,dataSilk:[n]}),active:h,axis:u,...a,ref:e})});jO.displayName="Sheet.SpecialWrapper.Root";let VO=Ve.forwardRef((t,e)=>U.jsx(qn.Stabiliser,{...t,ref:e}));VO.displayName="Sheet.SpecialWrapper.Content";let qO=Ve.forwardRef((t,e)=>{let{asChild:i,travelAnimation:n,stackingAnimation:a,...l}=t,u=i?Fi:"h2",{titleId:h}=w.useContext(Fr);return U.jsx(jo,{asChild:!0,travelAnimation:n,stackingAnimation:a,children:U.jsx(u,{id:h,ref:e,...l})})});qO.displayName="Sheet.Title";let YO=Ve.forwardRef((t,e)=>{let{asChild:i,travelAnimation:n,stackingAnimation:a,...l}=t,{descriptionId:u}=w.useContext(Fr),h=i?Fi:"p";return U.jsx(jo,{asChild:!0,travelAnimation:n,stackingAnimation:a,children:U.jsx(h,{id:u,...l,ref:e})})});YO.displayName="Sheet.Description";let Ka={Root:Bx,Trigger:sv,View:Nx,Backdrop:Px,Content:zx,BleedingBackground:Hx,Handle:Dx,Portal:Ox};ec.displayName="SheetStack.ErrorBoundary";let GO=Ve.forwardRef((t,e)=>{let{componentId:i,className:n,"data-silk":a,asChild:l,...u}=t,h=w.useId();vi(()=>(Ge.addSheetStack({id:h}),()=>Ge.removeSheetStack(h)),[h]);let[f,d]=w.useState([]),g=w.useCallback(I=>{d(H=>{let V,se=H.findIndex(Q=>Q.sheetId===I.sheetId);return se!==-1?(V=[...H])[se]=I:V=[...H,I],V})},[]),v=w.useCallback(I=>{d(H=>H.filter(V=>V.sheetId!==I))},[]),p=w.useCallback(I=>{let H=f.findIndex(V=>V.sheetId===I);return H===-1?f[f.length-1]:f[H-1]},[f]),[S,y]=w.useState(0);vi(()=>{S===0&&Ge.removeAllOutletPersistedStylesFromStack(h)},[S,h]);let[C,x]=w.useState([]),R=w.useCallback(I=>{x(H=>{let V=H.findIndex(se=>se.sheetId===I.sheetId);if(V===-1)return[...H,I];{let se=[...H];return se[V]=I,se}})},[]),L=w.useCallback(I=>{x(H=>H.filter(V=>V.sheetId!==I))},[]),N=w.useMemo(()=>C.some(I=>I.staging!=="none")?"not-none":"none",[C]),T=w.useMemo(()=>({stackId:h,sheetsCount:S,setSheetsCount:y,updateSheetStagingDataInStack:R,removeSheetStagingDataInStack:L,sheetsInStackMergedStaging:N,updateSheetDataInStack:g,removeSheetDataFromStack:v,getPreviousSheetDataInStack:p}),[h,S,R,L,N,g,v,p]),W=l?Fi:"div",D=Ui("SheetStack");return U.jsx(ec,{children:U.jsx(Hu,{genericContext:gf,customContext:i,value:T,children:U.jsx(W,{...D("root",[],{className:n,dataSilk:[a]}),ref:e,...u})})})});GO.displayName="SheetStack.Root";let KO=Ve.forwardRef((t,e)=>{let{forComponent:i="closest",asChild:n,stackingAnimation:a,style:l,className:u,...h}=t,f=i==="closest"?gf:i,{stackId:d,sheetsCount:g,sheetsInStackMergedStaging:v}=w.useContext(f);vi(()=>{Ge.addSheetStack({id:d})},[d]);let{styleValue:p,composedRef:S}=iv({sheetsCount:g,stackId:d,stackingAnimation:a,style:l},e),y=w.useMemo(()=>v!=="none",[v]),C=Ui("SheetStack",{}),x=n?Fi:"div";return U.jsx(x,{style:p,...C("outlet",[],{className:u,dataSilk:[y&&"0aj"]}),...h,ref:S})});KO.displayName="SheetStack.Outlet";let rv=Ve.createContext(null);rv.displayName="Scroll.GenericContext";let Sf=Ve.createContext({contentRef:null});Sf.displayName="Scroll.Anonymous";let Ix=t=>w.useContext(t??rv)||{},XO=Kt==="android"?102:54,bp=ev||Kt==="android"?"instant":"smooth",ZO=(t,e,i=300)=>{let n,a=t.scrollTop,l=()=>{clearTimeout(n),t.removeEventListener("scroll",u),e()},u=()=>{let h=t.scrollTop;if(h>a){l();return}a=h,clearTimeout(n),n=setTimeout(l,i)};n=setTimeout(l,i),t.addEventListener("scroll",u)},wp=t=>{if(!t)return{top:0,bottom:0};let e=t.getBoundingClientRect(),i=window.getComputedStyle(t),n=e.top+parseFloat(i.borderTopWidth),a=e.bottom-parseFloat(i.borderBottomWidth);return{top:n,bottom:a}},G1=()=>{let t=window.visualViewport.height,e=window.visualViewport.offsetTop;return{top:e,bottom:e+t}},QO=(t,e)=>Math.abs(Math.min(t+e,0)),JO=(t,e)=>Math.max(t-e,0),K1=(t,e,i)=>{t.style.setProperty("height",e+"px"),i.current=e},eB=({scrollContainer:t,elementTop:e,elementBottom:i,behavior:n,scrollMarginTop:a,scrollMarginBottom:l,scrollPortTop:u,scrollPortBottom:h,visualViewportTop:f,visualViewportBottom:d,beforeScrollCallback:g})=>{if(!t)return;let v=e-Math.max(u,f),p=Math.min(h,d)-i;if(v<a){let S=Math.max(-t.scrollTop,v-a);S!==0&&(g(),t.scrollBy({top:S,behavior:n}))}else if(p<l){let S=t.scrollHeight-t.clientHeight-t.scrollTop,y=Math.min(S,l-p);y!==0&&(g(),t.scrollBy({top:y,behavior:n}))}};ec.displayName="Scroll.ErrorBoundary";let tB=Ve.forwardRef((t,e)=>{let{asChild:i,className:n,componentId:a,componentRef:l,"data-silk":u,...h}=t,f=i?Fi:"div",d=w.useRef(()=>{}),g=w.useCallback((...C)=>{let x=d.current;return x(...C)},[]),v=w.useRef(()=>{}),p=w.useCallback((...C)=>{let x=v.current;return x(...C)},[]),S=w.useMemo(()=>({componentRef:l,scrollToRef:d,scrollTo:g,scrollByRef:v,scrollBy:p}),[l,p,g]),y=Ui("Scroll",{});return U.jsx(ec,{children:U.jsx(Hu,{genericContext:rv,customContext:a,value:S,children:U.jsx(f,{...y("root",[],{className:n,dataSilk:[u]}),...h,ref:e})})})});tB.displayName="Scroll.Root";let _d=null,Ux=()=>{let t=w.useRef(null);vi(()=>{_d===null&&t.current&&(_d=t.current.offsetWidth-t.current.clientWidth,document.body.style.setProperty("--ua-scrollbar-thickness",_d+"px"))},[]);let e=Ui("Scroll"),i=U.jsx("div",{...e("UAScrollbarMeasurer"),ref:t});return _d===null?typeof window<"u"?vw.createPortal(i,document.body):U.jsx(U.Fragment,{children:i}):null};Ux.displayName="Scroll.Anonymous";let pd=(t,e,i,n=!1)=>typeof t=="boolean"?t:typeof t?.[e]=="boolean"?t[e]:typeof t?.[i]=="boolean"?t[i]:n,iB=Ve.forwardRef((t,e)=>{let{asChild:i,children:n,className:a,"data-silk":l,forComponent:u,axis:h="y",pageScroll:f=!1,nativePageScrollReplacement:d=!1,safeArea:g="visual-viewport",scrollGestureTrap:v=!1,scrollGestureOvershoot:p=!0,scrollGesture:S="auto",onScrollStart:y,onScroll:C,onScrollEnd:x,onFocusInside:R,nativeFocusScrollPrevention:L=!0,scrollAnimationSettings:N={skip:"auto"},scrollAnchoring:T=!0,scrollSnapType:W="none",scrollPadding:D="auto",scrollTimelineName:I="none",nativeScrollbar:H=!0,...V}=t,[se,Q,A,O]=w.useMemo(()=>{let be=pd(v,"xStart","x"),ft=pd(v,"xEnd","x"),Qe=pd(v,"yStart","y"),$e=pd(v,"yEnd","y"),Re=be,Ue=ft,$t=Qe,Bt=$e;return h==="y"?Ue=Re=be!==ft||be:Bt=$t=Qe!==$e||Qe,[Re,Ue,$t,Bt]},[v,h]),P=w.useMemo(()=>se!==Q,[Q,se]),$=w.useMemo(()=>A!==O,[O,A]),E=w.useMemo(()=>{if(W==="proximity"){if(h==="y")return"proximityY";if(h==="x")return"proximityX"}else{if(W!=="mandatory")return"none";if(h==="y")return"mandatoryY";if(h==="x")return"mandatoryX"}},[h,W]),M=i?Fi:"div",z=w.useRef(null),q=Rs(z,e),G=w.useRef(null),B=w.useRef(null),K=w.useRef(null),te=w.useRef(null),ne=w.useRef(null),de=w.useRef(null),ue=$o(),{componentRef:he,scrollToRef:Se,scrollByRef:we}=Ix(u)||{},{getContentCoordinatesWhenRestingOnLastDetent:Ee,contentRef:Le}=w.useContext(Fr)||{},it=w.useMemo(()=>S===!1||S!=="auto",[S]),[Ze,ke]=w.useState(!1),[ze,pe]=w.useState(!1);vi(()=>{f&&(be=>{let ft="data-silk-native-page-scroll-replaced",Qe=document.documentElement.getAttribute(ft);if(!f&&Qe!=="true")return;let $e=window.matchMedia("(display-mode: standalone)").matches||window.navigator.standalone;if(be!==!0&&(be!=="auto"||(Kt==="android"||Kt==="ios"||Kt==="ipados")&&!$e)){var Ue,$t;pe(!1);let Bt=new Event("silk-page-scroll-data-change");if(document.dispatchEvent(Bt),Qe==="false")return;let er=($t=(Ue=G.current)===null||Ue===void 0?void 0:Ue.scrollTop)!==null&&$t!==void 0?$t:0;document.documentElement.setAttribute(ft,"false"),Qe==="true"&&window.scrollTo(0,er)}else{pe(!0),G.current;let Bt=new Event("silk-page-scroll-data-change");if(document.dispatchEvent(Bt),Qe==="true")return;let er=window.pageYOffset;if(document.documentElement.setAttribute(ft,"true"),!G.current)return;G.current.scrollTop=er}})(d)},[f,d]);let[mt,yt]=w.useState(!0),[ge,ye]=w.useState(!0);vi(()=>{let be=G.current,ft=B.current,Qe=K.current,$e=te.current,Re=new ResizeObserver(()=>{be&&(h==="y"&&be.scrollHeight>be.clientHeight?yt(!0):yt(!1),h==="x"&&be.scrollWidth>be.clientWidth?ye(!0):ye(!1))});return be&&ft&&Qe&&$e&&(Re.observe(be,{box:"border-box"}),Re.observe(ft,{box:"border-box"}),Re.observe(Qe,{box:"border-box"}),Re.observe($e,{box:"border-box"})),()=>{Re&&Re.disconnect()}},[h,it]);let[me,Ut]=w.useState(!1);vi(()=>{Ut(mt||ge?!0:()=>!1)},[mt,ge]);let[Be,Xe]=w.useState(!1);w.useEffect(()=>{Xe(_x())},[]);let je=w.useRef(!1),_t=w.useRef(!1),qe=P||$,[Ms,ns]=w.useState(se),[Xn,Zn]=w.useState(A);w.useEffect(()=>{let be;if(qe){let ft=ne.current,Qe=de.current;if(!ft||!Qe)return;(be=new IntersectionObserver($e=>{for(let Re of $e)Re.target===ft?Re.isIntersecting?(je.current=!0,h==="x"?ns(se):Zn(A)):je.current=!1:Re.target===Qe&&(Re.isIntersecting?(_t.current=!0,h==="x"?ns(Q):Zn(O)):_t.current=!1),je.current&&_t.current&&(h==="x"?ns(!1):Zn(!1))},{root:G.current,rootMargin:"0px",threshold:[1]})).observe(ft),be.observe(Qe)}return()=>{be&&be.disconnect()}},[Q,se,O,A,h,qe]);let $r=w.useRef(!1),Ks=w.useRef(),ri=w.useRef(""),$i=w.useRef(void 0);w.useEffect(()=>{let be=G.current;if(!be)return;let ft=$e=>{Ft.current=!1,nn({nativeEvent:$e,defaultBehavior:{},handler:x});let Re=document.activeElement;(Kt=="ios"||Kt=="ipados")&&Re&&Lo(Re)&&($i.current===void 0&&(ri.current=Re.style.getPropertyValue("opacity"),Re.style.setProperty("opacity","0.9999","important")),clearTimeout($i.current),$i.current=void 0,$i.current=setTimeout(()=>{ri.current===""?Re.style.removeProperty("opacity"):Re.style.setProperty("opacity",ri.current),$i.current=void 0},55))},Qe=$e=>{if(!$r.current){let{dismissKeyboard:Re}=nn({nativeEvent:$e,defaultBehavior:{dismissKeyboard:!1},handler:y});Re&&!$r.current&&!Ft.current&&ef()&&be.focus({preventScroll:!0})}clearTimeout(Ks.current),Ks.current=setTimeout(()=>{$r.current=!1,ke(!1),"onscrollend"in window||ft(null)},90),$r.current=!0,ke(!0)};return be.addEventListener("scroll",Qe),"onscrollend"in window&&be.addEventListener("scrollend",ft),()=>{be.removeEventListener("scroll",Qe),"onscrollend"in window&&be.removeEventListener("scrollend",ft)}},[x,y]),w.useEffect(()=>(L&&Ge.addNativeFocusScrollPreventer(ue),()=>{L&&Ge.removeNativeFocusScrollPreventer(ue)}),[L,ue]);let At=w.useMemo(()=>f&&!ze,[ze,f]),ni=w.useMemo(()=>h==="y"?At?()=>window.scrollY:()=>{var be;return(be=G.current)===null||be===void 0?void 0:be.scrollTop}:At?()=>window.scrollX:()=>{var be;return(be=G.current)===null||be===void 0?void 0:be.scrollLeft},[h,At]),Xs=w.useMemo(()=>h==="y"?At?()=>document.body.scrollHeight-window.innerHeight:()=>{let be=G.current;return be?.scrollHeight-be?.offsetHeight}:At?()=>document.body.scrollWidth-window.innerWidth:()=>{let be=G.current;return be?.scrollWidth-be?.offsetWidth},[h,At]),un=w.useCallback(()=>ni()/Xs(),[ni,Xs]),Zs=w.useCallback(be=>{C?.({progress:un(),distance:ni(),availableDistance:Xs(),nativeEvent:be})},[un,ni,Xs,C]);w.useEffect(()=>(At&&C&&document.addEventListener("scroll",Zs),()=>{At&&C&&document.removeEventListener("scroll",Zs)}),[At,C,Zs]);let kt=w.useCallback((be,{progress:ft,distance:Qe,animationSettings:$e={skip:"default"}})=>{let Re=Qe??(ft??NaN)*Xs();if(isNaN(Re))return;let Ue=$e?.skip,$t=At?window:G.current;$t?.[be==="to"?"scrollTo":"scrollBy"]({[h==="y"?"top":"left"]:Re,behavior:Ue===!0?"instant":Ue===!1?"smooth":Ue==="default"?"auto":ev?"instant":"smooth"})},[h,Xs,At]),Er=w.useCallback(be=>kt("to",be),[kt]),Wi=w.useCallback(be=>kt("by",be),[kt]);w.useEffect(()=>{Se.current=Er,we.current=Wi},[Wi,we,Er,Se]),w.useImperativeHandle(he,()=>({getProgress:un,getDistance:ni,getAvailableDistance:Xs,scrollTo:Er,scrollBy:Wi}),[Xs,ni,un,Er,Wi]);let As=w.useRef(!1),Tr=w.useRef(),Qn=w.useRef(),es=w.useRef(0),Qs=w.useRef(0),Ft=w.useRef(!1),He=w.useCallback(({scrollIntoPlace:be=!0,scrollBehavior:ft,safeViewport:Qe="visual-viewport"})=>{let $e,Re;if(!G.current||!B.current||!te.current||!K.current||h!=="y"||Qe==="none"||Le?.current&&Ee().top===null||!Le?.current&&Ee)return;if(Le?.current){let{top:ci,bottom:_s}=wp(G.current),ui=Le.current.getBoundingClientRect(),Ei=ui.top,Ce=ui.bottom;$e=Ee().top+(ci-Ei),Re=Ee().bottom-(Ce-_s)}else{let{top:ci,bottom:_s}=wp(G.current);$e=ci,Re=_s}let{top:Ue,bottom:$t}=G1(),Bt=Math.min(Re,Qe==="visual-viewport"?$t:window.innerHeight),er=QO($e,Qe==="visual-viewport"?Ue:0),tr=JO(Re,Qe==="visual-viewport"?$t:window.innerHeight);if(1>Math.abs(es.current-er)&&1>Math.abs(Qs.current-tr))return;let Rr=-1*(Bt-te.current.getBoundingClientRect().top),Ls=G.current.offsetHeight-B.current.offsetHeight>=0,Mr=()=>{K1(K.current,er,es),K1(te.current,tr,Qs)};if(ft==="smooth"&&(Rr<0||Ls)?be&&(Ft.current=!0,Ls?G.current.scrollTo({top:0,behavior:ft}):G.current.scrollBy({top:Rr,behavior:ft}),Qs.current=tr,ZO(G.current,()=>{G.current&&Ls&&G.current.scrollTo({top:0,behavior:"instant"}),Mr()})):Mr(),!be)return{spacersHeightSetter:Mr,verticalScrollOffsetRequired:Rr}},[h,Ee,Le]),Lt=w.useCallback(()=>He({scrollBehavior:bp,safeViewport:g}),[g,He]);vi(()=>{Lt()},[Lt]),w.useEffect(()=>{let be=G.current,ft=Re=>{clearTimeout(Tr.current),clearTimeout(Qn.current);let Ue=Re.target;if(Ue===be)return;let{scrollIntoView:$t}=nn({nativeEvent:Re,defaultBehavior:{scrollIntoView:!0},handler:R});if(!Lo(Ue)||bg(Ue))return;let Bt=Ue.getBoundingClientRect().top-0,er=Ue.getBoundingClientRect().bottom-0,{top:tr,bottom:Rr}=wp(G.current),Ls=tr-0,Mr=Rr-0,ci=()=>{if(clearTimeout(Tr.current),clearTimeout(Qn.current),!ef())return;As.current=!0;let{top:_s,bottom:ui}=G1(),{spacersHeightSetter:Ei=()=>{}}=He({scrollIntoPlace:!1,scrollBehavior:"smooth",safeViewport:g})||{};Ei(),$t&&eB({scrollContainer:G.current,behavior:bp,scrollMarginTop:64,scrollMarginBottom:XO,elementTop:Bt,elementBottom:er,scrollPortTop:Ls,scrollPortBottom:Mr,visualViewportTop:_s,visualViewportBottom:ui,beforeScrollCallback:()=>Ft.current=!0}),visualViewport.removeEventListener("resize",ci)};As.current?(ci(),visualViewport.addEventListener("resize",ci),Tr.current=setTimeout(()=>{visualViewport.removeEventListener("resize",ci)},900)):(visualViewport.addEventListener("resize",ci),Qn.current=setTimeout(()=>{visualViewport.removeEventListener("resize",ci),ci()},900))},Qe=Re=>{let Ue=Re.target;!Lo(Ue)||bg(Ue)||Lo(Re.relatedTarget)||(As.current=!1,He({scrollBehavior:bp,safeViewport:g==="none"?"none":"layout-viewport"}))},$e=()=>{var Re;(Re=G.current)===null||Re===void 0||Re.removeEventListener("scroll",Lt),setTimeout(()=>{Lt(),setTimeout(()=>{var Ue;(Ue=G.current)===null||Ue===void 0||Ue.addEventListener("scroll",Lt,{once:!0})},200)},1),setTimeout(()=>Lt,350)};return be?.addEventListener("focus",ft,{capture:!0}),be?.addEventListener("blur",Qe,{capture:!0}),visualViewport.addEventListener("resize",$e),be?.addEventListener("scroll",Lt,{once:!0}),()=>{be?.removeEventListener("focus",ft,{capture:!0}),be?.removeEventListener("blur",Qe,{capture:!0}),visualViewport.removeEventListener("resize",$e),be?.removeEventListener("scroll",Lt)}},[R,g,He,Lt]);let Vo=mx(G),Js=w.useMemo(()=>f&&!ze,[ze,f]),ji=Ui("Scroll",{axis:h,scrollTrapX:Ms,scrollTrapY:!Be&&Xn||Vo&&!Js,scrollGestureOvershoot:p,scrollDisabled:it,pageScroll:f,nativePageScrollReplacement:d,overflowX:ge,overflowY:mt,skipScrollAnimation:N?.skip,scrollAnchoring:T,scrollSnapType:E,nativeScrollbar:H,scrollOngoing:Ze});return U.jsxs(Sf.Provider,{value:{contentRef:B,axis:h,styleAttributes:ji,nativeFocusScrollPrevention:L,swipeTrapIncapable:Js,focusable:me,pageScroll:f,nativePageScrollReplacement:d,scrollContainerRef:G,swipeTrapObserverRequired:qe,startScrollSpyRef:ne,endScrollSpyRef:de,startSpacerRef:K,endSpacerRef:te,scrollHandler:Zs,scrollPadding:D,scrollTimelineName:I},children:[f&&d!==!0&&U.jsx("style",{dangerouslySetInnerHTML:{__html:`
88
+ html[data-silk-native-page-scroll-replaced="false"] > body {
89
+ scroll-padding: ${D};
90
+ scroll-timeline-axis: ${I} ${h};
91
+ }
92
+ `}}),f&&d===!0&&U.jsx("script",{id:"silk-scroll-nativePageScrollReplacement-true",dangerouslySetInnerHTML:{__html:`
93
+ document.documentElement.setAttribute("data-silk-native-page-scroll-replaced", "true");
94
+ `}}),f&&d===!1&&U.jsx("script",{id:"silk-scroll-nativePageScrollReplacement-false",dangerouslySetInnerHTML:{__html:`
95
+ document.documentElement.setAttribute("data-silk-native-page-scroll-replaced", "false");
96
+ `}}),f&&d==="auto"&&U.jsx("script",{id:"silk-scroll-nativePageScrollReplacement-auto",dangerouslySetInnerHTML:{__html:`
97
+ const standalone =
98
+ window.matchMedia('(display-mode: standalone)').matches || window.navigator.standalone;
99
+ const mobile = window.navigator.userAgent?.match(/android|iPhone|iPad/i);
100
+
101
+ document.documentElement.setAttribute("data-standalone", !!standalone);
102
+ document.documentElement.setAttribute("data-silk-native-page-scroll-replaced", !(mobile && !standalone));
103
+ `}}),U.jsx(Ux,{}),U.jsx(M,{...ji("view",["axis","pageScroll","skipScrollAnimation","scrollOngoing"],{className:a,dataSilk:[l]}),...V,ref:q,children:n})]})});iB.displayName="Scroll.View";let Tg=Ve.forwardRef(({side:t,...e},i)=>{let{axis:n}=w.useContext(Sf)||{},a=Ui("Scroll",{side:t,axis:n});return U.jsx("div",{...a("spy",["side","axis"]),ref:i,...e})});Tg.displayName="Scroll.Anonymous";let sB=Ve.forwardRef((t,e)=>{let{asChild:i,className:n,"data-silk":a,...l}=t,u=i?Fi:"div",{contentRef:h,styleAttributes:f,nativeFocusScrollPrevention:d,swipeTrapIncapable:g,focusable:v,axis:p,pageScroll:S,nativePageScrollReplacement:y,scrollContainerRef:C,swipeTrapObserverRequired:x,startScrollSpyRef:R,endScrollSpyRef:L,startSpacerRef:N,endSpacerRef:T,scrollHandler:W,scrollPadding:D,scrollTimelineName:I}=w.useContext(Sf)||{},H=Rs(h,e);return U.jsxs("div",{...f("scrollContainer",["axis","pageScroll","scrollTrapX","scrollTrapY","scrollGestureOvershoot","scrollDisabled","overflowX","overflowY","skipScrollAnimation","scrollAnchoring","scrollSnapType","nativeScrollbar"],{dataSilk:[a,"0ad",d&&"0ah",g&&"0ai"]}),style:{scrollPadding:D,scrollTimeline:I+" "+p},tabIndex:v?0:d?-1:void 0,role:S&&!y?void 0:"region",onScroll:W,ref:C,children:[x&&U.jsx(Tg,{side:"start",ref:R}),p==="y"&&U.jsx("div",{ref:N,...f("startSpacer",["axis","pageScroll"])}),U.jsx(u,{...f("content",["axis","scrollTrapX","scrollTrapY","overflowX","overflowY"],{className:n,dataSilk:[a]}),...l,ref:H}),p==="y"&&U.jsx("div",{ref:T,...f("endSpacer",["axis","pageScroll"])}),x&&U.jsx(Tg,{side:"end",ref:L})]})});sB.displayName="Scroll.Content";let rB=Ve.forwardRef(({asChild:t,...e},i)=>{let n=t?Fi:"button",{forComponent:a,onPress:l,onClick:u,children:h,action:f,...d}=e,{type:g,...v}=f||{},{scrollTo:p,scrollBy:S}=Ix(a),y=w.useRef(null),C=Rs(y,i);return U.jsx(n,{onClick:x=>{var R;let{forceFocus:L,runAction:N}=nn({nativeEvent:x,defaultBehavior:{forceFocus:!0,runAction:!0},handler:l});if(L&&((R=y.current)===null||R===void 0||R.focus({preventScroll:!0})),N){if(g==="scroll-to")return p(v);if(g==="scroll-by")return S(v)}u?.(x)},ref:C,...d,children:h})});rB.displayName="Sheet.Trigger";let nB=t=>w.useContext(t??Ga)||{},aB=Ve.forwardRef((t,e)=>{let{asChild:i,className:n,"data-silk":a,timing:l,forComponent:u,tabIndex:h,...f}=t,d=i?Fi:"div",{sheetId:g}=u?nB(u):{},v=g??"any",p=w.useCallback(N=>{Ge.addAutoFocusTarget({layerId:v,element:N,timing:l})},[v,l]),S=w.useCallback(N=>{Ge.removeAutoFocusTarget(N)},[]),y=w.useRef(null),C=w.useCallback(N=>{N?p(N):S(y.current),y.current=N},[p,S]),x=w.useRef(!0);w.useEffect(()=>(y.current&&!x.current&&p(y.current),x.current=!1,()=>{y.current&&S(y.current)}),[p,S]);let R=Rs(C,e),L=Ui("AutoFocusTarget",{});return U.jsx(d,{...L("root",[],{className:n,dataSilk:[a]}),...i||Number.isInteger(h)?{}:{tabIndex:-1},...f,ref:R})});aB.displayName="AutoFocusTarget.Root";let oB=Ve.forwardRef((t,e)=>{let{asChild:i,disabled:n=!1,children:a,contentGetter:l,forComponent:u,...h}=t,f=w.useRef(null),d=Rs(f,e),g=w.useMemo(()=>!!a,[a]);return w.useEffect(()=>{let v,p;if(!n){let S,y=!1;if(g&&f.current?S=f.current:l&&(S=Jd(l))&&(y=!0),S){let C=Array.isArray(u)?u:u?[u]:[];v=Ge.addIsland({componentId:C,element:S}),y&&(p=new MutationObserver(()=>{Jd(l)||(Ge.removeIsland(v),p.disconnect())})).observe(S.parentElement,{childList:!0})}}return()=>{n||(Ge.removeIsland(v),p?.disconnect())}},[e,n,g,l,u]),a?U.jsx(qn.Root,{active:!n,asChild:i,"data-silk":"0ag",...h,ref:d,children:a}):null});oB.displayName="Island.Root";let lB=Ve.forwardRef((t,e)=>{let{asChild:i,children:n,...a}=t;return U.jsx(qn.Stabiliser,{asChild:i,...a,ref:e,children:n})});lB.displayName="Island.Content";let cB=Ve.forwardRef(({asChild:t,children:e,contentGetter:i,disabled:n=!1,selfManagedInertOutside:a=!0,...l},u)=>{let h=$o(),f=w.useRef(null),d=Rs(f,u),g=t?Fi:"div",v=w.useMemo(()=>!!e,[e]);return vi(()=>{let p;if(!n&&h){let S,y=!1;v&&f.current?S=f.current:i&&(S=Jd(i))&&(y=!0),S&&(Ge.updateLayer({external:!0,layerId:h,viewElement:S,inertOutside:a,onPresentAutoFocus:{focus:!1},onDismissAutoFocus:{focus:!1},defaultClickOutsideAction:()=>{},defaultEscapeKeyDownAction:()=>{}}),y&&(p=new MutationObserver(()=>{Jd(i)||(Ge.removeLayer(h),p.disconnect())})).observe(S.parentElement,{childList:!0}))}return()=>{!n&&h&&(Ge.removeLayer(h),p?.disconnect())}},[v,i,n,h,a]),U.jsx(g,{ref:d,...l,children:e})});cB.displayName="ExternalOverlay.Root";const Fx=Ve.forwardRef(({children:t,license:e="commercial",...i},n)=>U.jsx(Ka.Root,{license:e,...i,ref:n,children:t}));Fx.displayName="BottomSheet.Root";const $x=Ve.forwardRef(({children:t,className:e,...i},n)=>U.jsx(Ka.View,{className:`BottomSheet-view ${e??""}`.trim(),nativeEdgeSwipePrevention:!0,...i,ref:n,children:t}));$x.displayName="BottomSheet.View";const Wx=Ve.forwardRef(({className:t,...e},i)=>U.jsx(Ka.Backdrop,{className:`BottomSheet-backdrop ${t??""}`.trim(),themeColorDimming:!1,...e,ref:i}));Wx.displayName="BottomSheet.Backdrop";const jx=Ve.forwardRef(({children:t,className:e,...i},n)=>U.jsxs(Ka.Content,{className:`BottomSheet-content ${e??""}`.trim(),...i,ref:n,children:[U.jsx(Ka.BleedingBackground,{className:"BottomSheet-bleedingBackground"}),t]}));jx.displayName="BottomSheet.Content";const Vx=Ve.forwardRef(({className:t,...e},i)=>U.jsx(Ka.Handle,{className:`BottomSheet-handle ${t??""}`.trim(),action:"dismiss",...e,ref:i}));Vx.displayName="BottomSheet.Handle";const uB=Ka.Portal,hB=Ka.Trigger,Zi={Root:Fx,Portal:uB,View:$x,Backdrop:Wx,Content:jx,Trigger:hB,Handle:Vx},nv=w.forwardRef(({label:t,icon:e,className:i,type:n,variant:a="secondary",size:l="icon","aria-label":u,...h},f)=>U.jsx(yd,{ref:f,type:n??"button",variant:a,size:l,"aria-label":u??t,className:`h-11 w-11 rounded-full bg-input/50 ${i??""}`.trim(),...h,children:e}));nv.displayName="SheetTriggerButton";const qx=({eyebrow:t,title:e,countLabel:i})=>U.jsxs("div",{className:"flex items-center justify-between px-1 pb-4",children:[U.jsxs("div",{className:"space-y-1",children:[U.jsx("p",{className:"text-xs font-semibold text-muted-foreground",children:t}),U.jsx("p",{className:"text-sm font-medium text-foreground",children:e})]}),i?U.jsx("span",{className:"text-xs text-muted-foreground",children:i}):null]}),Yx=({children:t})=>U.jsx("div",{className:"no-scrollbar max-h-[min(55vh,360px)] space-y-2 overflow-y-auto px-1",children:t}),dB=({message:t})=>U.jsx("div",{className:"rounded-2xl border border-border/60 bg-background/70 px-4 py-5 text-sm text-muted-foreground",children:t}),sf=w.forwardRef(({label:t,description:e,active:i=!1,onSelect:n,leading:a,trailing:l,ariaLabel:u,showActiveIcon:h=!0,onClick:f,type:d,className:g,...v},p)=>{const S=C=>{f?.(C),n?.()},y=l??(h&&i?U.jsx("span",{className:"flex h-8 w-8 items-center justify-center text-primary",children:U.jsx(gD,{className:"size-6","aria-hidden":"true"})}):null);return U.jsx("button",{ref:p,type:d??"button","aria-label":u??t,"aria-current":i?"page":void 0,className:`w-full rounded-2xl border px-4 py-3 text-left transition ${i?"border-primary/60 bg-primary/10 text-foreground":"border-transparent bg-background/70 text-foreground hover:bg-background/90"} ${g??""}`.trim(),onClick:S,...v,children:U.jsxs("div",{className:"flex items-center justify-between gap-3",children:[U.jsxs("div",{className:"flex min-w-0 items-center gap-3",children:[a?U.jsx("span",{className:"flex h-10 w-10 items-center justify-center rounded-xl bg-muted/40 text-foreground",children:a}):null,U.jsxs("div",{className:"min-w-0",children:[U.jsx("span",{className:"text-sm font-medium",children:t}),e?U.jsx("div",{className:"pt-1 text-xs text-muted-foreground",children:e}):null]})]}),y]})})});sf.displayName="SheetOptionButton";const fB=t=>{const e=t.status==="running"?"Running":"Closed",i=t.source==="tmux"?"Tmux":"Mock";return`${e} - ${i}`},mB=({terminals:t,activeTerminalId:e,listState:i,onSelectTerminal:n})=>{const a=i==="loading"?"Loading terminals":i==="error"?"Unable to load terminals":i==="empty"?"No terminals available":null;return U.jsxs(Zi.Root,{children:[U.jsx(Zi.Trigger,{asChild:!0,children:U.jsx(nv,{label:"Terminals",icon:U.jsx(ux,{className:"size-4","aria-hidden":"true"})})}),U.jsx(Zi.Portal,{children:U.jsxs(Zi.View,{children:[U.jsx(Zi.Backdrop,{}),U.jsxs(Zi.Content,{className:"px-4 pb-[calc(env(safe-area-inset-bottom,0px)+16px)] pt-3",children:[U.jsx("div",{className:"flex items-center justify-center pb-3",children:U.jsx(Zi.Handle,{})}),U.jsx(qx,{eyebrow:"Terminals",title:"Select a session",countLabel:i==="ready"?`${t.length} total`:null}),U.jsx(Yx,{children:a?U.jsx(dB,{message:a}):t.map(l=>{const u=l.id===e,h=l.label||l.id;return U.jsx(Zi.Trigger,{asChild:!0,action:"dismiss",children:U.jsx(sf,{label:h,description:fB(l),active:u,ariaLabel:`Open ${h}`,onSelect:()=>n(l.id)})},l.id)})})]})]})})]})},_B=({activeView:t,onViewChange:e})=>U.jsxs(Zi.Root,{children:[U.jsx(Zi.Trigger,{asChild:!0,children:U.jsx(nv,{label:"Views",icon:U.jsx(A1,{className:"size-4","aria-hidden":"true"})})}),U.jsx(Zi.Portal,{children:U.jsxs(Zi.View,{children:[U.jsx(Zi.Backdrop,{}),U.jsxs(Zi.Content,{className:"px-4 pb-[calc(env(safe-area-inset-bottom,0px)+16px)] pt-3",children:[U.jsx("div",{className:"flex items-center justify-center pb-3",children:U.jsx(Zi.Handle,{})}),U.jsx(qx,{eyebrow:"Views",title:"Choose your workspace"}),U.jsxs(Yx,{children:[U.jsx(Zi.Trigger,{asChild:!0,action:"dismiss",children:U.jsx(sf,{label:"Terminal",description:"Run commands and manage sessions",active:t==="terminal",leading:U.jsx(ux,{className:"size-4","aria-hidden":"true"}),ariaLabel:"Switch to Terminal",onSelect:()=>e("terminal")})}),U.jsx(Zi.Trigger,{asChild:!0,action:"dismiss",children:U.jsx(sf,{label:"Preview",description:"Open the live preview",active:t==="preview",leading:U.jsx(A1,{className:"size-4","aria-hidden":"true"}),ariaLabel:"Switch to Preview",onSelect:()=>e("preview")})})]})]})]})})]}),pB=({clientRef:t,terminals:e,activeTerminalId:i,activeTerminalSource:n=null,activeView:a,onViewChange:l,showViewToggle:u=!1,onScrollAction:h,listState:f,onSelectTerminal:d})=>{const g=w.useRef(null),[v,p]=w.useState(""),[S,y]=w.useState(!1),[C,x]=w.useState(!1),[R,L]=w.useState(!1);w.useEffect(()=>{if(!S){x(!1),L(!1);return}const D=g.current,I=()=>{const Q=D.scrollWidth-D.clientWidth,A=D.scrollLeft>0,O=D.scrollLeft<Q-1;x(A),L(Q>0&&O)};I();const H=()=>I();D.addEventListener("scroll",H,{passive:!0});const V=window.ResizeObserver,se=typeof V=="function"?new V(I):null;return se?.observe(D),window.addEventListener("resize",I),()=>{D.removeEventListener("scroll",H),se?.disconnect(),window.removeEventListener("resize",I)}},[S]);const N=w.useMemo(()=>[{id:"enter",label:"Enter",kind:"input",data:"\r",icon:MD},{id:"page-up",label:"Page Up",kind:"scroll",mode:"pages",amount:-1,icon:kD},{id:"page-down",label:"Page Down",kind:"scroll",mode:"pages",amount:1,icon:CD},{id:"line-up",label:"Line Up",kind:"scroll",mode:"lines",amount:-1,icon:bD},{id:"line-down",label:"Line Down",kind:"scroll",mode:"lines",amount:1,icon:SD},{id:"up",label:"Up",kind:"control",key:"up",icon:_D},{id:"down",label:"Down",kind:"control",key:"down",icon:oD},{id:"left",label:"Left",kind:"control",key:"left",icon:cD},{id:"right",label:"Right",kind:"control",key:"right",icon:fD},{id:"tab",label:"Tab",kind:"control",key:"tab",icon:hD},{id:"esc",label:"Esc",kind:"control",key:"esc",icon:zD},{id:"ctrl-c",label:"Ctrl+C",kind:"control",key:"ctrl_c",icon:TD}],[]),T=()=>{const D=t.current;D&&(v&&D.sendInput(v),D.sendInput("\r"),p(""))},W=D=>{const I=t.current;if(!I)return;if(D.kind==="input"){I.sendInput(D.data);return}if(D.kind==="control"){I.sendControl(D.key);return}if(h?.(D.mode,D.amount),n==="tmux"){I.sendScroll(D.mode,D.amount);return}if(I.getScrollInfo().maxY>0){if(D.mode==="lines"){I.scrollLines(D.amount);return}I.scrollPages(D.amount);return}I.sendScroll(D.mode,D.amount)};return U.jsxs("div",{className:"min-w-0",children:[S?U.jsx("div",{className:"pt-3",children:U.jsxs("div",{className:"relative",children:[U.jsx("div",{className:"h-auto",children:U.jsx("div",{ref:g,id:"terminal-actions","data-testid":"terminal-actions-scroll",className:"no-scrollbar flex h-full w-full items-center gap-2 overflow-x-auto px-3 snap-x snap-mandatory scroll-px-3",children:N.map(D=>{const I=D.icon;return U.jsxs(yd,{type:"button",variant:"secondary",size:"sm","aria-label":D.label,className:"bg-input/50 snap-start whitespace-nowrap px-3 py-2",onClick:()=>W(D),children:[U.jsx(I,{className:"size-4","aria-hidden":"true"}),U.jsx("span",{children:D.label})]},D.id)})})}),C?U.jsx("div",{"data-testid":"terminal-actions-gradient-left",className:"pointer-events-none absolute inset-y-0 left-0 z-10 w-16 bg-gradient-to-r from-background to-transparent"}):null,R?U.jsx("div",{"data-testid":"terminal-actions-gradient-right",className:"pointer-events-none absolute inset-y-0 right-0 z-10 w-16 bg-gradient-to-l from-background to-transparent"}):null]})}):null,U.jsx("div",{className:"px-3 py-3",children:U.jsxs("div",{className:"flex w-full min-w-0 items-center gap-3",children:[U.jsx(yd,{type:"button",variant:"secondary",size:"icon","aria-label":"Add","aria-expanded":S,"aria-controls":"terminal-actions",className:"h-11 w-11 rounded-full bg-input/50",onClick:()=>y(D=>!D),children:U.jsx(DD,{className:`size-4 transition-transform duration-200 ${S?"rotate-45":""}`})}),U.jsxs("div",{className:"relative flex-1 min-w-0",children:[U.jsx(KT,{placeholder:"Message","aria-label":"Message",className:"h-11 rounded-full border-none bg-input/50 pl-4 pr-8",value:v,onChange:D=>p(D.target.value),onKeyDown:D=>{D.key==="Enter"&&(D.preventDefault(),T())}}),U.jsx(yd,{type:"button",variant:"default",size:"sm","aria-label":"Send",className:"absolute right-1 top-1/2 h-9 w-9 -translate-y-1/2 rounded-full",onClick:T,children:U.jsx(BD,{className:"size-4"})})]}),U.jsxs("div",{className:"-ml-1 flex flex-shrink-0 items-center gap-2",children:[U.jsx(mB,{terminals:e,activeTerminalId:i,listState:f,onSelectTerminal:d}),u?U.jsx(_B,{activeView:a,onViewChange:l}):null]})]})})]})},gB={connected:"Connected",connecting:"Connecting",disconnected:"Disconnected",reconnecting:"Reconnecting"},vB={connected:"bg-emerald-500",connecting:"bg-sky-400",disconnected:"bg-rose-500",reconnecting:"bg-amber-400"},SB=({connectionState:t,scrollInfo:e,hasTerminal:i,sessionLabel:n,showScroll:a=!0,scrollOverride:l,position:u="fixed",className:h})=>{const f=i?gB[t]:"No session",d=i?n??"Session":"No session",g=i?vB[t]:"bg-muted-foreground/50",v=i&&(t==="connecting"||t==="reconnecting")?"animate-pulse":"",p=Math.max(0,Math.round(e.viewportY)),S=Math.max(0,Math.round(e.maxY)),y=l?.label??`${p} / ${S}`,C=a&&(l?.show??(i&&S>0&&p<S)),x=u==="fixed"?"fixed left-0 right-0 top-0 z-20":"relative z-10";return U.jsxs("div",{className:`pointer-events-none flex items-center gap-3 bg-background/80 px-3 py-2 backdrop-blur-[2px] ${x} ${h??""}`.trim(),children:[U.jsx("div",{"data-testid":"session-status",className:"flex items-center gap-2 rounded-full border border-border/40 bg-background/40 px-3 py-1.5 text-xs font-medium text-foreground shadow-sm",children:U.jsx("span",{children:d})}),C?U.jsxs("div",{"data-testid":"scroll-status",className:"flex items-center gap-2 rounded-full border border-border/40 bg-background/40 px-3 py-1.5 text-xs font-medium text-foreground shadow-sm",children:[U.jsx("span",{className:"text-xs text-muted-foreground",children:"Scroll"}),U.jsx("span",{children:y})]}):null,U.jsxs("div",{"data-testid":"connection-status","data-state":i?t:"idle",className:"ml-auto flex items-center gap-2 rounded-full border border-border/40 bg-background/40 px-3 py-1.5 text-xs font-medium text-foreground shadow-sm",children:[U.jsx("span",{className:`h-1.5 w-1.5 rounded-full ${g} ${v}`}),U.jsx("span",{children:f})]})]})},Gx=({terminalId:t,onSelectTerminal:e})=>{const i=w.useRef(null),n=w.useRef(null),[a,l]=w.useState("loading"),[u,h]=w.useState([]),[f,d]=w.useState(null),[g,v]=w.useState("connecting"),[p,S]=w.useState(null),[y,C]=w.useState(null),[x,R]=w.useState("terminal"),[L,N]=w.useState({viewportY:0,baseY:0,maxY:0}),[T,W]=w.useState(null);w.useEffect(()=>{let E=!0;return(async()=>{try{const[z,q,G]=await Promise.all([fetch("/__tb/api/terminals"),fetch("/__tb/api/csrf"),fetch("/__tb/api/config")]);if(!z.ok||!q.ok||!G.ok)throw new Error("api request failed");const[B,K,te]=await Promise.all([z.json(),q.json(),G.json()]),ne=B.terminals;if(!E)return;if(h(ne),d(K.csrfToken),S(te.proxyPort),C(te.devProxyUrl),ne.length===0){l("empty");return}l("ready")}catch{E&&l("error")}})(),()=>{E=!1}},[]);const D=w.useMemo(()=>a!=="ready"||!t?null:u.some(E=>E.id===t)?t:null,[a,t,u]),I=w.useMemo(()=>a!=="ready"||!D?null:u.find(E=>E.id===D)?.source??null,[a,D,u]),H=w.useMemo(()=>{if(a!=="ready"||!D)return null;const E=u.find(M=>M.id===D);return E?.label??E?.id},[a,D,u]);w.useEffect(()=>{if(a!=="ready"||u.length===0||(t?u.some(z=>z.id===t):!1))return;const M=u[0]?.id;M&&e&&e(M)},[a,u,t,e]),w.useEffect(()=>{if(a!=="ready"||!D||!f||!i.current)return;v("connecting");const E=eD(i.current,D,f);n.current=E,N(E.getScrollInfo());const M=E.onConnectionStateChange(q=>{v(q)}),z=E.onScroll(q=>{N(q)});return()=>{M(),z(),n.current=null,E.destroy(),N({viewportY:0,baseY:0,maxY:0}),W(null)}},[a,D,f]);const V=a==="loading"?"Loading terminal":a==="empty"?"No terminals available":a==="error"?"Unable to load terminals":D?null:"Loading terminal",se=e??(()=>{}),Q=p!==null,A=Q?x:"terminal",O=I==="tmux"&&T?{label:`${T.offset}${T.mode==="pages"?"p":"l"}`,show:T.offset>0}:void 0,P=(E,M)=>{I==="tmux"&&W(z=>{const q=E,G=z?.mode===q?z.offset:0,B=Math.max(0,G+-M);return B===0?null:{offset:B,mode:q}})};return U.jsx("div",{className:"relative h-full w-full bg-background text-foreground",children:U.jsxs("div",{className:"grid h-full w-full grid-rows-[auto_minmax(0,1fr)_auto]",children:[U.jsx(SB,{connectionState:g,scrollInfo:L,hasTerminal:!!D,sessionLabel:H,showScroll:!1,scrollOverride:O,position:"static"}),U.jsxs("div",{className:`relative min-h-0 min-w-0 ${A==="preview"?"bg-black":""}`,children:[V&&A==="terminal"?U.jsx("div",{className:"terminal-status absolute inset-0 z-20 flex items-center justify-center bg-background/85 text-xs font-medium text-muted-foreground",role:"status",children:V}):null,Q?U.jsx("iframe",{src:y??"/",title:"Preview",className:`h-full w-full border-0 ${A==="preview"?"":"invisible absolute inset-0"}`,sandbox:"allow-same-origin allow-scripts allow-forms allow-popups","data-testid":"preview-iframe"}):null,U.jsx("div",{ref:i,className:`terminal-host h-full w-full ${A==="preview"?"invisible absolute inset-0":""}`,"data-testid":"terminal-host"})]}),U.jsx(pB,{clientRef:n,terminals:u,activeTerminalId:D,activeTerminalSource:I,activeView:A,onViewChange:R,showViewToggle:Q,onScrollAction:P,listState:a,onSelectTerminal:se})]})})},yB=()=>{const t=Ou(),e=w.useCallback(i=>{t({to:"/terminal/$terminalId",params:{terminalId:i}})},[t]);return U.jsx(Gx,{terminalId:null,onSelectTerminal:e})},bB=()=>{const t=Ou(),{terminalId:e}=lf({from:"/terminal/$terminalId"}),i=w.useCallback(n=>{t({to:"/terminal/$terminalId",params:{terminalId:n}})},[t]);return U.jsx(Gx,{terminalId:e,onSelectTerminal:i})},av=eE({component:()=>U.jsx(ww,{})}),wB=zg({getParentRoute:()=>av,path:"/",component:yB}),CB=zg({getParentRoute:()=>av,path:"/terminal/$terminalId",component:bB}),xB=av.addChildren([wB,CB]),kB=cE({routeTree:xB,basepath:"/__tb/app"}),Kx="termbridge.theme",EB=()=>{if(typeof window>"u")return null;const t=window.localStorage.getItem(Kx);return t==="light"||t==="dark"||t==="system"?t:null},TB=t=>{typeof window>"u"||window.localStorage.setItem(Kx,t)},RB=()=>(XT({getStoredTheme:EB,setStoredTheme:TB}),U.jsx(dE,{router:kB})),MB=t=>{E2.createRoot(t).render(U.jsx(RB,{}))},X1=document.getElementById("root");X1&&MB(X1);