@daluo/cli 0.2.1 → 0.3.0

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,67 @@
1
+ function UN(e,t){for(var i=0;i<t.length;i++){const r=t[i];if(typeof r!="string"&&!Array.isArray(r)){for(const a in r)if(a!=="default"&&!(a in e)){const c=Object.getOwnPropertyDescriptor(r,a);c&&Object.defineProperty(e,a,c.get?c:{enumerable:!0,get:()=>r[a]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const a of document.querySelectorAll('link[rel="modulepreload"]'))r(a);new MutationObserver(a=>{for(const c of a)if(c.type==="childList")for(const h of c.addedNodes)h.tagName==="LINK"&&h.rel==="modulepreload"&&r(h)}).observe(document,{childList:!0,subtree:!0});function i(a){const c={};return a.integrity&&(c.integrity=a.integrity),a.referrerPolicy&&(c.referrerPolicy=a.referrerPolicy),a.crossOrigin==="use-credentials"?c.credentials="include":a.crossOrigin==="anonymous"?c.credentials="omit":c.credentials="same-origin",c}function r(a){if(a.ep)return;a.ep=!0;const c=i(a);fetch(a.href,c)}})();function ox(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Sf={exports:{}},Ha={};var E0;function PN(){if(E0)return Ha;E0=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function i(r,a,c){var h=null;if(c!==void 0&&(h=""+c),a.key!==void 0&&(h=""+a.key),"key"in a){c={};for(var f in a)f!=="key"&&(c[f]=a[f])}else c=a;return a=c.ref,{$$typeof:e,type:r,key:h,ref:a!==void 0?a:null,props:c}}return Ha.Fragment=t,Ha.jsx=i,Ha.jsxs=i,Ha}var j0;function qN(){return j0||(j0=1,Sf.exports=PN()),Sf.exports}var u=qN(),bf={exports:{}},Ve={};var T0;function FN(){if(T0)return Ve;T0=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.portal"),i=Symbol.for("react.fragment"),r=Symbol.for("react.strict_mode"),a=Symbol.for("react.profiler"),c=Symbol.for("react.consumer"),h=Symbol.for("react.context"),f=Symbol.for("react.forward_ref"),g=Symbol.for("react.suspense"),m=Symbol.for("react.memo"),v=Symbol.for("react.lazy"),_=Symbol.for("react.activity"),S=Symbol.for("react.view_transition"),y=Symbol.iterator;function x(E){return E===null||typeof E!="object"?null:(E=y&&E[y]||E["@@iterator"],typeof E=="function"?E:null)}var w={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},j=Object.assign,N={};function M(E,J,se){this.props=E,this.context=J,this.refs=N,this.updater=se||w}M.prototype.isReactComponent={},M.prototype.setState=function(E,J){if(typeof E!="object"&&typeof E!="function"&&E!=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,E,J,"setState")},M.prototype.forceUpdate=function(E){this.updater.enqueueForceUpdate(this,E,"forceUpdate")};function A(){}A.prototype=M.prototype;function R(E,J,se){this.props=E,this.context=J,this.refs=N,this.updater=se||w}var I=R.prototype=new A;I.constructor=R,j(I,M.prototype),I.isPureReactComponent=!0;var H=Array.isArray;function O(){}var $={H:null,A:null,T:null,S:null},Q=Object.prototype.hasOwnProperty;function z(E,J,se){var pe=se.ref;return{$$typeof:e,type:E,key:J,ref:pe!==void 0?pe:null,props:se}}function G(E,J){return z(E.type,J,E.props)}function P(E){return typeof E=="object"&&E!==null&&E.$$typeof===e}function L(E){var J={"=":"=0",":":"=2"};return"$"+E.replace(/[=:]/g,function(se){return J[se]})}var F=/\/+/g;function K(E,J){return typeof E=="object"&&E!==null&&E.key!=null?L(""+E.key):J.toString(36)}function q(E){switch(E.status){case"fulfilled":return E.value;case"rejected":throw E.reason;default:switch(typeof E.status=="string"?E.then(O,O):(E.status="pending",E.then(function(J){E.status==="pending"&&(E.status="fulfilled",E.value=J)},function(J){E.status==="pending"&&(E.status="rejected",E.reason=J)})),E.status){case"fulfilled":return E.value;case"rejected":throw E.reason}}throw E}function te(E,J,se,pe,ce){var _e=typeof E;(_e==="undefined"||_e==="boolean")&&(E=null);var ke=!1;if(E===null)ke=!0;else switch(_e){case"bigint":case"string":case"number":ke=!0;break;case"object":switch(E.$$typeof){case e:case t:ke=!0;break;case v:return ke=E._init,te(ke(E._payload),J,se,pe,ce)}}if(ke)return ce=ce(E),ke=pe===""?"."+K(E,0):pe,H(ce)?(se="",ke!=null&&(se=ke.replace(F,"$&/")+"/"),te(ce,J,se,"",function(Ne){return Ne})):ce!=null&&(P(ce)&&(ce=G(ce,se+(ce.key==null||E&&E.key===ce.key?"":(""+ce.key).replace(F,"$&/")+"/")+ke)),J.push(ce)),1;ke=0;var oe=pe===""?".":pe+":";if(H(E))for(var ye=0;ye<E.length;ye++)pe=E[ye],_e=oe+K(pe,ye),ke+=te(pe,J,se,_e,ce);else if(ye=x(E),typeof ye=="function")for(E=ye.call(E),ye=0;!(pe=E.next()).done;)pe=pe.value,_e=oe+K(pe,ye++),ke+=te(pe,J,se,_e,ce);else if(_e==="object"){if(typeof E.then=="function")return te(q(E),J,se,pe,ce);throw J=String(E),Error("Objects are not valid as a React child (found: "+(J==="[object Object]"?"object with keys {"+Object.keys(E).join(", ")+"}":J)+"). If you meant to render a collection of children, use an array instead.")}return ke}function ne(E,J,se){if(E==null)return E;var pe=[],ce=0;return te(E,pe,"","",function(_e){return J.call(se,_e,ce++)}),pe}function ge(E){if(E._status===-1){var J=E._result,se=J();se.then(function(pe){(E._status===0||E._status===-1)&&(E._status=1,E._result=pe,se.status===void 0&&(se.status="fulfilled",se.value=pe))},function(pe){(E._status===0||E._status===-1)&&(E._status=2,E._result=pe,se.status===void 0&&(se.status="rejected",se.reason=pe))}),E._status===-1&&(E._status=0,E._result=se)}if(E._status===1)return E._result.default;throw E._result}var D=typeof reportError=="function"?reportError:function(E){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var J=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof E=="object"&&E!==null&&typeof E.message=="string"?String(E.message):String(E),error:E});if(!window.dispatchEvent(J))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",E);return}console.error(E)};function De(E){var J=$.T,se={};se.types=J!==null?J.types:null,$.T=se;try{var pe=E(),ce=$.S;ce!==null&&ce(se,pe),typeof pe=="object"&&pe!==null&&typeof pe.then=="function"&&pe.then(O,D)}catch(_e){D(_e)}finally{J!==null&&se.types!==null&&(J.types=se.types),$.T=J}}function we(E){var J=$.T;if(J!==null){var se=J.types;se===null?J.types=[E]:se.indexOf(E)===-1&&se.push(E)}else De(we.bind(null,E))}var T={map:ne,forEach:function(E,J,se){ne(E,function(){J.apply(this,arguments)},se)},count:function(E){var J=0;return ne(E,function(){J++}),J},toArray:function(E){return ne(E,function(J){return J})||[]},only:function(E){if(!P(E))throw Error("React.Children.only expected to receive a single React element child.");return E}};return Ve.Activity=_,Ve.Children=T,Ve.Component=M,Ve.Fragment=i,Ve.Profiler=a,Ve.PureComponent=R,Ve.StrictMode=r,Ve.Suspense=g,Ve.ViewTransition=S,Ve.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=$,Ve.__COMPILER_RUNTIME={__proto__:null,c:function(E){return $.H.useMemoCache(E)}},Ve.addTransitionType=we,Ve.cache=function(E){return function(){return E.apply(null,arguments)}},Ve.cacheSignal=function(){return null},Ve.cloneElement=function(E,J,se){if(E==null)throw Error("The argument must be a React element, but you passed "+E+".");var pe=j({},E.props),ce=E.key;if(J!=null)for(_e in J.key!==void 0&&(ce=""+J.key),J)!Q.call(J,_e)||_e==="key"||_e==="__self"||_e==="__source"||_e==="ref"&&J.ref===void 0||(pe[_e]=J[_e]);var _e=arguments.length-2;if(_e===1)pe.children=se;else if(1<_e){for(var ke=Array(_e),oe=0;oe<_e;oe++)ke[oe]=arguments[oe+2];pe.children=ke}return z(E.type,ce,pe)},Ve.createContext=function(E){return E={$$typeof:h,_currentValue:E,_currentValue2:E,_threadCount:0,Provider:null,Consumer:null},E.Provider=E,E.Consumer={$$typeof:c,_context:E},E},Ve.createElement=function(E,J,se){var pe,ce={},_e=null;if(J!=null)for(pe in J.key!==void 0&&(_e=""+J.key),J)Q.call(J,pe)&&pe!=="key"&&pe!=="__self"&&pe!=="__source"&&(ce[pe]=J[pe]);var ke=arguments.length-2;if(ke===1)ce.children=se;else if(1<ke){for(var oe=Array(ke),ye=0;ye<ke;ye++)oe[ye]=arguments[ye+2];ce.children=oe}if(E&&E.defaultProps)for(pe in ke=E.defaultProps,ke)ce[pe]===void 0&&(ce[pe]=ke[pe]);return z(E,_e,ce)},Ve.createRef=function(){return{current:null}},Ve.forwardRef=function(E){return{$$typeof:f,render:E}},Ve.isValidElement=P,Ve.lazy=function(E){return{$$typeof:v,_payload:{_status:-1,_result:E},_init:ge}},Ve.memo=function(E,J){return{$$typeof:m,type:E,compare:J===void 0?null:J}},Ve.startTransition=De,Ve.unstable_useCacheRefresh=function(){return $.H.useCacheRefresh()},Ve.use=function(E){return $.H.use(E)},Ve.useActionState=function(E,J,se){return $.H.useActionState(E,J,se)},Ve.useCallback=function(E,J){return $.H.useCallback(E,J)},Ve.useContext=function(E){return $.H.useContext(E)},Ve.useDebugValue=function(){},Ve.useDeferredValue=function(E,J){return $.H.useDeferredValue(E,J)},Ve.useEffect=function(E,J){return $.H.useEffect(E,J)},Ve.useEffectEvent=function(E){return $.H.useEffectEvent(E)},Ve.useId=function(){return $.H.useId()},Ve.useImperativeHandle=function(E,J,se){return $.H.useImperativeHandle(E,J,se)},Ve.useInsertionEffect=function(E,J){return $.H.useInsertionEffect(E,J)},Ve.useLayoutEffect=function(E,J){return $.H.useLayoutEffect(E,J)},Ve.useMemo=function(E,J){return $.H.useMemo(E,J)},Ve.useOptimistic=function(E,J){return $.H.useOptimistic(E,J)},Ve.useReducer=function(E,J,se){return $.H.useReducer(E,J,se)},Ve.useRef=function(E){return $.H.useRef(E)},Ve.useState=function(E){return $.H.useState(E)},Ve.useSyncExternalStore=function(E,J,se){return $.H.useSyncExternalStore(E,J,se)},Ve.useTransition=function(){return $.H.useTransition()},Ve.version="19.3.1",Ve}var D0;function bp(){return D0||(D0=1,bf.exports=FN()),bf.exports}var C=bp();const $N=ox(C),VN=UN({__proto__:null,default:$N},[C]);var xf={exports:{}},Ia={},wf={exports:{}},Cf={};var M0;function KN(){return M0||(M0=1,(function(e){function t(q,te){var ne=q.length;q.push(te);e:for(;0<ne;){var ge=ne-1>>>1,D=q[ge];if(0<a(D,te))q[ge]=te,q[ne]=D,ne=ge;else break e}}function i(q){return q.length===0?null:q[0]}function r(q){if(q.length===0)return null;var te=q[0],ne=q.pop();if(ne!==te){q[0]=ne;e:for(var ge=0,D=q.length,De=D>>>1;ge<De;){var we=2*(ge+1)-1,T=q[we],E=we+1,J=q[E];if(0>a(T,ne))E<D&&0>a(J,T)?(q[ge]=J,q[E]=ne,ge=E):(q[ge]=T,q[we]=ne,ge=we);else if(E<D&&0>a(J,ne))q[ge]=J,q[E]=ne,ge=E;else break e}}return te}function a(q,te){var ne=q.sortIndex-te.sortIndex;return ne!==0?ne:q.id-te.id}if(e.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var c=performance;e.unstable_now=function(){return c.now()}}else{var h=Date,f=h.now();e.unstable_now=function(){return h.now()-f}}var g=[],m=[],v=1,_=null,S=3,y=!1,x=!1,w=!1,j=!1,N=typeof setTimeout=="function"?setTimeout:null,M=typeof clearTimeout=="function"?clearTimeout:null,A=typeof setImmediate<"u"?setImmediate:null;function R(q){for(var te=i(m);te!==null;){if(te.callback===null)r(m);else if(te.startTime<=q)r(m),te.sortIndex=te.expirationTime,t(g,te);else break;te=i(m)}}function I(q){if(w=!1,R(q),!x)if(i(g)!==null)x=!0,H||(H=!0,P());else{var te=i(m);te!==null&&K(I,te.startTime-q)}}var H=!1,O=-1,$=5,Q=-1;function z(){return j?!0:!(e.unstable_now()-Q<$)}function G(){if(j=!1,H){var q=e.unstable_now();Q=q;var te=!0;try{e:{x=!1,w&&(w=!1,M(O),O=-1),y=!0;var ne=S;try{t:{for(R(q),_=i(g);_!==null&&!(_.expirationTime>q&&z());){var ge=_.callback;if(typeof ge=="function"){_.callback=null,S=_.priorityLevel;var D=ge(_.expirationTime<=q);if(q=e.unstable_now(),typeof D=="function"){_.callback=D,R(q),te=!0;break t}_===i(g)&&r(g),R(q)}else r(g);_=i(g)}if(_!==null)te=!0;else{var De=i(m);De!==null&&K(I,De.startTime-q),te=!1}}break e}finally{_=null,S=ne,y=!1}te=void 0}}finally{te?P():H=!1}}}var P;if(typeof A=="function")P=function(){A(G)};else if(typeof MessageChannel<"u"){var L=new MessageChannel,F=L.port2;L.port1.onmessage=G,P=function(){F.postMessage(null)}}else P=function(){N(G,0)};function K(q,te){O=N(function(){q(e.unstable_now())},te)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(q){q.callback=null},e.unstable_forceFrameRate=function(q){0>q||125<q?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):$=0<q?Math.floor(1e3/q):5},e.unstable_getCurrentPriorityLevel=function(){return S},e.unstable_next=function(q){switch(S){case 1:case 2:case 3:var te=3;break;default:te=S}var ne=S;S=te;try{return q()}finally{S=ne}},e.unstable_requestPaint=function(){j=!0},e.unstable_runWithPriority=function(q,te){switch(q){case 1:case 2:case 3:case 4:case 5:break;default:q=3}var ne=S;S=q;try{return te()}finally{S=ne}},e.unstable_scheduleCallback=function(q,te,ne){var ge=e.unstable_now();switch(typeof ne=="object"&&ne!==null?(ne=ne.delay,ne=typeof ne=="number"&&0<ne?ge+ne:ge):ne=ge,q){case 1:var D=-1;break;case 2:D=250;break;case 5:D=1073741823;break;case 4:D=1e4;break;default:D=5e3}return D=ne+D,q={id:v++,callback:te,priorityLevel:q,startTime:ne,expirationTime:D,sortIndex:-1},ne>ge?(q.sortIndex=ne,t(m,q),i(g)===null&&q===i(m)&&(w?(M(O),O=-1):w=!0,K(I,ne-ge))):(q.sortIndex=D,t(g,q),x||y||(x=!0,H||(H=!0,P()))),q},e.unstable_shouldYield=z,e.unstable_wrapCallback=function(q){var te=S;return function(){var ne=S;S=te;try{return q.apply(this,arguments)}finally{S=ne}}}})(Cf)),Cf}var A0;function YN(){return A0||(A0=1,wf.exports=KN()),wf.exports}var kf={exports:{}},yn={};var R0;function WN(){if(R0)return yn;R0=1;var e=bp();function t(v){var _="https://react.dev/errors/"+v;if(1<arguments.length){_+="?args[]="+encodeURIComponent(arguments[1]);for(var S=2;S<arguments.length;S++)_+="&args[]="+encodeURIComponent(arguments[S])}return"Minified React error #"+v+"; visit "+_+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function i(){}var r={d:{f:i,r:function(){throw Error(t(522))},D:i,C:i,L:i,m:i,X:i,S:i,M:i},p:0,findDOMNode:null},a=Symbol.for("react.portal"),c=Symbol.for("react.recoverable"),h=Symbol.for("react.optimistic_key");function f(v,_,S){var y=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:a,key:y==null?null:y===h?h:""+y,children:v,containerInfo:_,implementation:S}}var g=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function m(v,_){if(v==="font")return"";if(typeof _=="string")return _==="use-credentials"?_:""}return yn.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=r,yn.browser=function(v){return{$$typeof:c,_reason:v}},yn.createPortal=function(v,_){var S=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!_||_.nodeType!==1&&_.nodeType!==9&&_.nodeType!==11)throw Error(t(299));return f(v,_,null,S)},yn.flushSync=function(v){var _=g.T,S=r.p;try{if(g.T=null,r.p=2,v)return v()}finally{g.T=_,r.p=S,r.d.f()}},yn.preconnect=function(v,_){typeof v=="string"&&(_?(_=_.crossOrigin,_=typeof _=="string"?_==="use-credentials"?_:"":void 0):_=null,r.d.C(v,_))},yn.prefetchDNS=function(v){typeof v=="string"&&r.d.D(v)},yn.preinit=function(v,_){if(typeof v=="string"&&_&&typeof _.as=="string"){var S=_.as,y=m(S,_.crossOrigin),x=typeof _.integrity=="string"?_.integrity:void 0,w=typeof _.fetchPriority=="string"?_.fetchPriority:void 0;S==="style"?r.d.S(v,typeof _.precedence=="string"?_.precedence:void 0,{crossOrigin:y,integrity:x,fetchPriority:w}):S==="script"&&r.d.X(v,{crossOrigin:y,integrity:x,fetchPriority:w,nonce:typeof _.nonce=="string"?_.nonce:void 0})}},yn.preinitModule=function(v,_){if(typeof v=="string")if(typeof _=="object"&&_!==null){if(_.as==null||_.as==="script"){var S=m(_.as,_.crossOrigin);r.d.M(v,{crossOrigin:S,integrity:typeof _.integrity=="string"?_.integrity:void 0,nonce:typeof _.nonce=="string"?_.nonce:void 0,fetchPriority:typeof _.fetchPriority=="string"?_.fetchPriority:void 0})}}else _==null&&r.d.M(v)},yn.preload=function(v,_){if(typeof v=="string"&&typeof _=="object"&&_!==null&&typeof _.as=="string"){var S=_.as,y=m(S,_.crossOrigin);r.d.L(v,S,{crossOrigin:y,integrity:typeof _.integrity=="string"?_.integrity:void 0,nonce:typeof _.nonce=="string"?_.nonce:void 0,type:typeof _.type=="string"?_.type:void 0,fetchPriority:typeof _.fetchPriority=="string"?_.fetchPriority:void 0,referrerPolicy:typeof _.referrerPolicy=="string"?_.referrerPolicy:void 0,imageSrcSet:typeof _.imageSrcSet=="string"?_.imageSrcSet:void 0,imageSizes:typeof _.imageSizes=="string"?_.imageSizes:void 0,media:typeof _.media=="string"?_.media:void 0})}},yn.preloadModule=function(v,_){if(typeof v=="string")if(_){var S=m(_.as,_.crossOrigin);r.d.m(v,{as:typeof _.as=="string"&&_.as!=="script"?_.as:void 0,crossOrigin:S,integrity:typeof _.integrity=="string"?_.integrity:void 0,nonce:typeof _.nonce=="string"?_.nonce:void 0,fetchPriority:typeof _.fetchPriority=="string"?_.fetchPriority:void 0})}else r.d.m(v)},yn.requestFormReset=function(v){r.d.r(v)},yn.unstable_batchedUpdates=function(v,_){return v(_)},yn.useFormState=function(v,_,S){return g.H.useFormState(v,_,S)},yn.useFormStatus=function(){return g.H.useHostTransitionStatus()},yn.version="19.3.1",yn}var O0;function XN(){if(O0)return kf.exports;O0=1;function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}return e(),kf.exports=WN(),kf.exports}var B0;function GN(){if(B0)return Ia;B0=1;var e=YN(),t=bp(),i=XN();function r(n){var s="https://react.dev/errors/"+n;if(1<arguments.length){s+="?args[]="+encodeURIComponent(arguments[1]);for(var l=2;l<arguments.length;l++)s+="&args[]="+encodeURIComponent(arguments[l])}return"Minified React error #"+n+"; visit "+s+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function a(n){return!(!n||n.nodeType!==1&&n.nodeType!==9&&n.nodeType!==11)}function c(n){for(var s=n,l=s;l&&!l.alternate;)s=l,(s.flags&4098)!==0&&(n=s.return),l=s.return;for(;s.return;)s=s.return;return s.tag===3?n:null}function h(n){if(n.tag===13){var s=n.memoizedState;if(s===null&&(n=n.alternate,n!==null&&(s=n.memoizedState)),s!==null)return s.dehydrated}return null}function f(n){if(n.tag===31){var s=n.memoizedState;if(s===null&&(n=n.alternate,n!==null&&(s=n.memoizedState)),s!==null)return s.dehydrated}return null}function g(n){if(c(n)!==n)throw Error(r(188))}function m(n){var s=n.alternate;if(!s){if(s=c(n),s===null)throw Error(r(188));return s!==n?null:n}for(var l=n,o=s;;){var d=l.return;if(d===null)break;var p=d.alternate;if(p===null){if(o=d.return,o!==null){l=o;continue}break}if(d.child===p.child){for(p=d.child;p;){if(p===l)return g(d),n;if(p===o)return g(d),s;p=p.sibling}throw Error(r(188))}if(l.return!==o.return)l=d,o=p;else{for(var b=!1,k=d.child;k;){if(k===l){b=!0,l=d,o=p;break}if(k===o){b=!0,o=d,l=p;break}k=k.sibling}if(!b){for(k=p.child;k;){if(k===l){b=!0,l=p,o=d;break}if(k===o){b=!0,o=p,l=d;break}k=k.sibling}if(!b)throw Error(r(189))}}if(l.alternate!==o)throw Error(r(190))}if(l.tag!==3)throw Error(r(188));return l.stateNode.current===l?n:s}function v(n){var s=n.tag;if(s===5||s===26||s===27||s===6)return n;for(n=n.child;n!==null;){if(s=v(n),s!==null)return s;n=n.sibling}return null}function _(n,s,l,o,d,p){for(;n!==null;){if((n.tag===5||n.tag===27||n.tag===6)&&l(n,o,d,p)||(n.tag!==22||n.memoizedState===null)&&(s||n.tag!==5&&n.tag!==27)&&_(n.child,s,l,o,d,p))return!0;n=n.sibling}return!1}function S(n){for(n=n.return;n!==null;){if(n.tag===3||n.tag===5||n.tag===27)return n;n=n.return}return null}function y(n){var s=!1;for(n=n.return;n!==null&&(n.tag===4&&(s=!0),!(n.tag===3||n.tag===5||n.tag===27));)n=n.return;return s}function x(n){var s=[null,null],l=S(n);return l===null||w(s,n,l.child,{foundSelf:!1}),s}function w(n,s,l,o){for(;l!==null;){if(l===s)o.foundSelf=!0;else if(l.tag===5||l.tag===27||l.tag===6){if(o.foundSelf)return n[1]=l,!0;n[0]=l}else if((l.tag!==22||l.memoizedState===null)&&w(n,s,l.child,o))return!0;l=l.sibling}return!1}function j(n){switch(n.tag){case 5:case 27:case 6:return n.stateNode;case 3:return n.stateNode.containerInfo;default:throw Error(r(559))}}var N=null,M=null;function A(n,s,l){return n===l?!0:n===s?(N=n,!0):!1}function R(n,s,l){return n===l?(M=n,!1):n===s?(M!==null&&(N=n),!0):!1}function I(n){if(n===null)return null;do n=n===null?null:n.return;while(n&&n.tag!==5&&n.tag!==27&&n.tag!==3);return n||null}function H(n,s,l){for(var o=0,d=n;d;d=l(d))o++;d=0;for(var p=s;p;p=l(p))d++;for(;0<o-d;)n=l(n),o--;for(;0<d-o;)s=l(s),d--;for(;o--;){if(n===s||s!==null&&n===s.alternate)return n;n=l(n),s=l(s)}return null}var O=Object.assign,$=Symbol.for("react.element"),Q=Symbol.for("react.transitional.element"),z=Symbol.for("react.portal"),G=Symbol.for("react.fragment"),P=Symbol.for("react.strict_mode"),L=Symbol.for("react.profiler"),F=Symbol.for("react.consumer"),K=Symbol.for("react.context"),q=Symbol.for("react.forward_ref"),te=Symbol.for("react.suspense"),ne=Symbol.for("react.suspense_list"),ge=Symbol.for("react.memo"),D=Symbol.for("react.lazy"),De=Symbol.for("react.activity"),we=Symbol.for("react.legacy_hidden"),T=Symbol.for("react.memo_cache_sentinel"),E=Symbol.for("react.view_transition"),J=Symbol.for("react.recoverable"),se=Symbol.iterator;function pe(n){return n===null||typeof n!="object"?null:(n=se&&n[se]||n["@@iterator"],typeof n=="function"?n:null)}var ce=Symbol.for("react.client.reference");function _e(n){if(n==null)return null;if(typeof n=="function")return n.$$typeof===ce?null:n.displayName||n.name||null;if(typeof n=="string")return n;switch(n){case G:return"Fragment";case L:return"Profiler";case P:return"StrictMode";case te:return"Suspense";case ne:return"SuspenseList";case De:return"Activity";case E:return"ViewTransition"}if(typeof n=="object")switch(n.$$typeof){case z:return"Portal";case K:return n.displayName||"Context";case F:return(n._context.displayName||"Context")+".Consumer";case q:var s=n.render;return n=n.displayName,n||(n=s.displayName||s.name||"",n=n!==""?"ForwardRef("+n+")":"ForwardRef"),n;case ge:return s=n.displayName||null,s!==null?s:_e(n.type)||"Memo";case D:s=n._payload,n=n._init;try{return _e(n(s))}catch{}}return null}var ke=Array.isArray,oe=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,ye=i.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Ne={pending:!1,data:null,method:null,action:null},ct=[],ht=-1;function Je(n){return{current:n}}function Ke(n){0>ht||(n.current=ct[ht],ct[ht]=null,ht--)}function qe(n,s){ht++,ct[ht]=n.current,n.current=s}var le=Je(null),me=Je(null),Te=Je(null),He=Je(null);function Ee(n,s){switch(qe(Te,s),qe(me,n),qe(le,null),s.nodeType){case 9:case 11:n=(n=s.documentElement)&&(n=n.namespaceURI)?Ly(n):0;break;default:if(n=s.tagName,s=s.namespaceURI)s=Ly(s),n=zy(s,n);else switch(n){case"svg":n=1;break;case"math":n=2;break;default:n=0}}Ke(le),qe(le,n)}function Be(){Ke(le),Ke(me),Ke(Te)}function jt(n){var s=n.memoizedState;s!==null&&(kl._currentValue=s.memoizedState,qe(He,n)),s=le.current;var l=zy(s,n.type);s!==l&&(qe(me,n),qe(le,l))}function Tt(n){me.current===n&&(Ke(le),Ke(me)),He.current===n&&(Ke(He),kl._currentValue=Ne)}var re,ve;function ze(n){if(re===void 0)try{throw Error()}catch(l){var s=l.stack.trim().match(/\n( *(at )?)/);re=s&&s[1]||"",ve=-1<l.stack.indexOf(`
2
+ at`)?" (<anonymous>)":-1<l.stack.indexOf("@")?"@unknown:0:0":""}return`
3
+ `+re+n+ve}var ae=!1;function be(n,s){if(!n||ae)return"";ae=!0;var l=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var o={DetermineComponentFrameRoot:function(){try{if(s){var de=function(){throw Error()};if(Object.defineProperty(de.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(de,[])}catch(je){var V=je}Reflect.construct(n,[],de)}else{try{de.call()}catch(je){V=je}de=!1;try{var ee=Object.getOwnPropertyDescriptor(n.prototype,"props");Object.defineProperty(n.prototype,"props",{configurable:!0,set:function(){throw Error()}}),de=!0,new n}finally{de&&(ee!==void 0?Object.defineProperty(n.prototype,"props",ee):delete n.prototype.props)}}}else{try{throw Error()}catch(je){V=je}(de=n())&&typeof de.catch=="function"&&de.catch(function(){})}}catch(je){if(je&&V&&typeof je.stack=="string")return[je.stack,V.stack]}return[null,null]}};o.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var d=Object.getOwnPropertyDescriptor(o.DetermineComponentFrameRoot,"name");d&&d.configurable&&Object.defineProperty(o.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var p=o.DetermineComponentFrameRoot(),b=p[0],k=p[1];if(b&&k){var B=b.split(`
4
+ `),W=k.split(`
5
+ `);for(d=o=0;o<B.length&&!B[o].includes("DetermineComponentFrameRoot");)o++;for(;d<W.length&&!W[d].includes("DetermineComponentFrameRoot");)d++;if(o===B.length||d===W.length)for(o=B.length-1,d=W.length-1;1<=o&&0<=d&&B[o]!==W[d];)d--;for(;1<=o&&0<=d;o--,d--)if(B[o]!==W[d]){if(o!==1||d!==1)do if(o--,d--,0>d||B[o]!==W[d]){var ie=`
6
+ `+B[o].replace(" at new "," at ");return n.displayName&&ie.includes("<anonymous>")&&(ie=ie.replace("<anonymous>",n.displayName)),ie}while(1<=o&&0<=d);break}}}finally{ae=!1,Error.prepareStackTrace=l}return(l=n?n.displayName||n.name:"")?ze(l):""}function X(n,s){switch(n.tag){case 26:case 27:case 5:return ze(n.type);case 16:return ze("Lazy");case 13:return n.child!==s&&s!==null?ze("Suspense Fallback"):ze("Suspense");case 19:return ze("SuspenseList");case 0:case 15:return be(n.type,!1);case 11:return be(n.type.render,!1);case 1:return be(n.type,!0);case 31:return ze("Activity");case 30:return ze("ViewTransition");default:return""}}function Se(n){try{var s="",l=null;do s+=X(n,l),l=n,n=n.return;while(n);return s}catch(o){return`
7
+ Error generating stack: `+o.message+`
8
+ `+o.stack}}var Ge=Object.prototype.hasOwnProperty,pt=e.unstable_scheduleCallback,Qe=e.unstable_cancelCallback,Ni=e.unstable_shouldYield,zr=e.unstable_requestPaint,Ft=e.unstable_now,tn=e.unstable_getCurrentPriorityLevel,_i=e.unstable_ImmediatePriority,Nn=e.unstable_UserBlockingPriority,Hr=e.unstable_NormalPriority,he=e.unstable_LowPriority,Ae=e.unstable_IdlePriority,st=e.log,gt=e.unstable_setDisableYieldValue,En=null,Ue=null;function Ut(n){if(typeof st=="function"&&gt(n),Ue&&typeof Ue.setStrictMode=="function")try{Ue.setStrictMode(En,n)}catch{}}var dn=Math.clz32?Math.clz32:Jw,Qw=Math.log,Zw=Math.LN2;function Jw(n){return n>>>=0,n===0?32:31-(Qw(n)/Zw|0)|0}var wo=256,Co=262144,ko=4194304;function Qs(n){var s=n&42;if(s!==0)return s;switch(n&-n){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 n&-n;case 262144:case 524288:case 1048576:case 2097152:return n&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return n&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return n}}function No(n,s,l){var o=n.pendingLanes;if(o===0)return 0;var d=0,p=n.suspendedLanes,b=n.pingedLanes;n=n.warmLanes;var k=o&134217727;return k!==0?(o=k&~p,o!==0?d=Qs(o):(b&=k,b!==0?d=Qs(b):l||(l=k&~n,l!==0&&(d=Qs(l))))):(k=o&~p,k!==0?d=Qs(k):b!==0?d=Qs(b):l||(l=o&~n,l!==0&&(d=Qs(l)))),d===0?0:s!==0&&s!==d&&(s&p)===0&&(p=d&-d,l=s&-s,p>=l||p===32&&(l&4194048)!==0)?s:d}function Kl(n,s){return(n.pendingLanes&~(n.suspendedLanes&~n.pingedLanes)&s)===0}function og(n,s){(s&8)!==0&&(s|=s&32);var l=n.entangledLanes;if(l!==0)for(n=n.entanglements,l&=s;0<l;){var o=31-dn(l),d=1<<o;s|=n[o],l&=~d}return s}function eC(n,s){switch(n){case 1:case 2:case 4:case 8:case 64:return s+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return s+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function cg(){var n=ko;return ko<<=1,(ko&62914560)===0&&(ko=4194304),n}function Ku(n){for(var s=[],l=0;31>l;l++)s.push(n);return s}function Yl(n,s){n.pendingLanes|=s,s!==268435456&&(n.suspendedLanes=0,n.pingedLanes=0,n.warmLanes=0)}function tC(n,s,l,o,d,p){var b=n.pendingLanes;n.pendingLanes=l,n.suspendedLanes=0,n.pingedLanes=0,n.warmLanes=0,n.expiredLanes&=l,n.entangledLanes&=l,n.errorRecoveryDisabledLanes&=l,n.shellSuspendCounter=0;var k=n.entanglements,B=n.expirationTimes,W=n.hiddenUpdates;for(l=b&~l;0<l;){var ie=31-dn(l),de=1<<ie;k[ie]=0,B[ie]=-1;var V=W[ie];if(V!==null)for(W[ie]=null,ie=0;ie<V.length;ie++){var ee=V[ie];ee!==null&&(ee.lane&=-536870913)}l&=~de}o!==0&&ug(n,o,0),p!==0&&d===0&&n.tag!==0&&(n.suspendedLanes|=p&~(b&~s))}function ug(n,s,l){n.pendingLanes|=s,n.suspendedLanes&=~s;var o=31-dn(s);n.entangledLanes|=s,n.entanglements[o]=n.entanglements[o]|1073741824|l&261930}function hg(n,s){var l=n.entangledLanes|=s;for(n=n.entanglements;l;){var o=31-dn(l),d=1<<o;d&s|n[o]&s&&(n[o]|=s),l&=~d}}function dg(n,s){var l=s&-s;return l=(l&42)!==0?1:Yu(l),(l&(n.suspendedLanes|s))!==0?0:l}function Yu(n){switch(n){case 2:n=1;break;case 8:n=4;break;case 32:n=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:n=128;break;case 268435456:n=134217728;break;default:n=0}return n}function Wu(n){return n&=-n,2<n?8<n?(n&134217727)!==0?32:268435456:8:2}function fg(){var n=ye.p;return n!==0?n:(n=window.event,n===void 0?32:S0(n.type))}function mg(n,s){var l=ye.p;try{return ye.p=n,s()}finally{ye.p=l}}var Wi=Math.random().toString(36).slice(2),fn="__reactFiber$"+Wi,Bn="__reactProps$"+Wi,Ir="__reactContainer$"+Wi,pg="__reactEvents$"+Wi,nC="__reactListeners$"+Wi,iC="__reactHandles$"+Wi,gg="__reactResources$"+Wi,Wl="__reactMarker$"+Wi,Eo="__reactLoad$"+Wi;function jo(n){delete n[fn],delete n[Bn],delete n[nC],delete n[iC]}function Zs(n){var s;if(s=n[fn])return s;for(var l=n.parentNode;l;){if(s=l[Ir]||l[fn]){if(l=s.alternate,s.child!==null||l!==null&&l.child!==null)for(n=e0(n);n!==null;){if(l=n[fn])return l;n=e0(n)}return s}n=l,l=n.parentNode}return null}function Ur(n){if(n=n[fn]||n[Ir]){var s=n.tag;if(s===5||s===6||s===13||s===31||s===26||s===27||s===3)return n}return null}function Xl(n){var s=n.tag;if(s===5||s===26||s===27||s===6)return n.stateNode;throw Error(r(33))}function Pr(n){var s=n[gg];return s||(s=n[gg]={hoistableStyles:new Map,hoistableScripts:new Map}),s}function nn(n){n[Wl]=!0}function _g(n){n[Eo]=void 0}var vg=new Set,yg={};function Js(n,s){qr(n,s),qr(n+"Capture",s)}function qr(n,s){for(yg[n]=s,n=0;n<s.length;n++)vg.add(s[n])}var sC=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]*$"),Sg={},bg={};function rC(n){return Ge.call(bg,n)?!0:Ge.call(Sg,n)?!1:sC.test(n)?bg[n]=!0:(Sg[n]=!0,!1)}var dt=!1;function xg(){var n=dt;return dt=!1,n}function To(n,s,l){if(rC(s))if(l===null)n.removeAttribute(s);else{switch(typeof l){case"undefined":case"function":case"symbol":n.removeAttribute(s);return;case"boolean":var o=s.toLowerCase().slice(0,5);if(o!=="data-"&&o!=="aria-"){n.removeAttribute(s);return}}n.setAttribute(s,l)}}function Do(n,s,l){if(l===null)n.removeAttribute(s);else{switch(typeof l){case"undefined":case"function":case"symbol":case"boolean":n.removeAttribute(s);return}n.setAttribute(s,l)}}function Xi(n,s,l,o){if(o===null)n.removeAttribute(l);else{switch(typeof o){case"undefined":case"function":case"symbol":case"boolean":n.removeAttribute(l);return}n.setAttributeNS(s,l,o)}}function Vn(n){switch(typeof n){case"bigint":case"boolean":case"number":case"string":case"undefined":return n;case"object":return n;default:return""}}function wg(n){var s=n.type;return(n=n.nodeName)&&n.toLowerCase()==="input"&&(s==="checkbox"||s==="radio")}function lC(n,s,l){var o=Object.getOwnPropertyDescriptor(n.constructor.prototype,s);if(!n.hasOwnProperty(s)&&typeof o<"u"&&typeof o.get=="function"&&typeof o.set=="function"){var d=o.get,p=o.set;return Object.defineProperty(n,s,{configurable:!0,get:function(){return d.call(this)},set:function(b){l=""+b,p.call(this,b)}}),Object.defineProperty(n,s,{enumerable:o.enumerable}),{getValue:function(){return l},setValue:function(b){l=""+b},stopTracking:function(){n._valueTracker=null,delete n[s]}}}}function Xu(n){if(!n._valueTracker){var s=wg(n)?"checked":"value";n._valueTracker=lC(n,s,""+n[s])}}function Cg(n){if(!n)return!1;var s=n._valueTracker;if(!s)return!0;var l=s.getValue(),o="";return n&&(o=wg(n)?n.checked?"true":"false":n.value),n=o,n!==l?(s.setValue(n),!0):!1}var aC=/[\n"\\]/g;function ii(n){return n.replace(aC,function(s){return"\\"+s.charCodeAt(0).toString(16)+" "})}function Gu(n,s,l,o,d,p,b,k){n.name="",b!=null&&typeof b!="function"&&typeof b!="symbol"&&typeof b!="boolean"?n.type=b:n.removeAttribute("type"),s!=null?b==="number"?(s===0&&n.value===""||n.value!=s)&&(n.value=""+Vn(s)):n.value!==""+Vn(s)&&(n.value=""+Vn(s)):b!=="submit"&&b!=="reset"||n.removeAttribute("value"),s!=null?b==="number"&&n.value==s?Qu(n,Vn(n.value)):Qu(n,Vn(s)):l!=null?Qu(n,Vn(l)):o!=null&&n.removeAttribute("value"),d==null&&p!=null&&(n.defaultChecked=!!p),d!=null&&(n.checked=d&&typeof d!="function"&&typeof d!="symbol"),k!=null&&typeof k!="function"&&typeof k!="symbol"&&typeof k!="boolean"?n.name=""+Vn(k):n.removeAttribute("name")}function kg(n,s,l,o,d,p,b,k){if(p!=null&&typeof p!="function"&&typeof p!="symbol"&&typeof p!="boolean"&&(n.type=p),s!=null||l!=null){if(!(p!=="submit"&&p!=="reset"||s!=null)){Xu(n);return}l=l!=null?""+Vn(l):"",s=s!=null?""+Vn(s):l,k||s===n.value||(n.value=s),n.defaultValue=s}o=o??d,o=typeof o!="function"&&typeof o!="symbol"&&!!o,n.checked=k?n.checked:!!o,n.defaultChecked=!!o,b!=null&&typeof b!="function"&&typeof b!="symbol"&&typeof b!="boolean"&&(n.name=b),Xu(n)}function Qu(n,s){n.defaultValue!==""+s&&(n.defaultValue=""+s)}function Fr(n,s,l,o){if(n=n.options,s){s={};for(var d=0;d<l.length;d++)s["$"+l[d]]=!0;for(l=0;l<n.length;l++)d=s.hasOwnProperty("$"+n[l].value),n[l].selected!==d&&(n[l].selected=d),d&&o&&(n[l].defaultSelected=!0)}else{for(l=""+Vn(l),s=null,d=0;d<n.length;d++){if(n[d].value===l){n[d].selected=!0,o&&(n[d].defaultSelected=!0);return}s!==null||n[d].disabled||(s=n[d])}s!==null&&(s.selected=!0)}}function Ng(n,s,l){if(s!=null&&(s=""+Vn(s),s!==n.value&&(n.value=s),l==null)){n.defaultValue!==s&&(n.defaultValue=s);return}n.defaultValue=l!=null?""+Vn(l):""}function Eg(n,s,l,o){if(s==null){if(o!=null){if(l!=null)throw Error(r(92));if(ke(o)){if(1<o.length)throw Error(r(93));o=o[0]}l=o}l==null&&(l=""),s=l}l=Vn(s),n.defaultValue=l,o=n.textContent,o===l&&o!==""&&o!==null&&(n.value=o),Xu(n)}function $r(n,s){if(s){var l=n.firstChild;if(l&&l===n.lastChild&&l.nodeType===3){l.nodeValue=s;return}}n.textContent=s}var oC=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 jg(n,s,l){var o=s.indexOf("--")===0;l==null||typeof l=="boolean"||l===""?o?n.setProperty(s,""):s==="float"?n.cssFloat="":n[s]="":o?n.setProperty(s,l):typeof l!="number"||l===0||oC.has(s)?s==="float"?n.cssFloat=l:n[s]=(""+l).trim():n[s]=l+"px"}function Tg(n,s,l){if(s!=null&&typeof s!="object")throw Error(r(62));if(n=n.style,l!=null){for(var o in l)!l.hasOwnProperty(o)||s!=null&&s.hasOwnProperty(o)||(o.indexOf("--")===0?n.setProperty(o,""):o==="float"?n.cssFloat="":n[o]="",dt=!0);for(var d in s)o=s[d],s.hasOwnProperty(d)&&l[d]!==o&&(jg(n,d,o),dt=!0)}else for(var p in s)s.hasOwnProperty(p)&&jg(n,p,s[p])}function Zu(n){if(n.indexOf("-")===-1)return!1;switch(n){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 cC=new Map([["acceptCharset","accept-charset"],["htmlFor","for"],["httpEquiv","http-equiv"],["crossOrigin","crossorigin"],["accentHeight","accent-height"],["alignmentBaseline","alignment-baseline"],["arabicForm","arabic-form"],["baselineShift","baseline-shift"],["capHeight","cap-height"],["clipPath","clip-path"],["clipRule","clip-rule"],["colorInterpolation","color-interpolation"],["colorInterpolationFilters","color-interpolation-filters"],["colorProfile","color-profile"],["colorRendering","color-rendering"],["dominantBaseline","dominant-baseline"],["enableBackground","enable-background"],["fillOpacity","fill-opacity"],["fillRule","fill-rule"],["floodColor","flood-color"],["floodOpacity","flood-opacity"],["fontFamily","font-family"],["fontSize","font-size"],["fontSizeAdjust","font-size-adjust"],["fontStretch","font-stretch"],["fontStyle","font-style"],["fontVariant","font-variant"],["fontWeight","font-weight"],["glyphName","glyph-name"],["glyphOrientationHorizontal","glyph-orientation-horizontal"],["glyphOrientationVertical","glyph-orientation-vertical"],["horizAdvX","horiz-adv-x"],["horizOriginX","horiz-origin-x"],["imageRendering","image-rendering"],["letterSpacing","letter-spacing"],["lightingColor","lighting-color"],["markerEnd","marker-end"],["markerMid","marker-mid"],["markerStart","marker-start"],["maskType","mask-type"],["overlinePosition","overline-position"],["overlineThickness","overline-thickness"],["paintOrder","paint-order"],["panose-1","panose-1"],["pointerEvents","pointer-events"],["renderingIntent","rendering-intent"],["shapeRendering","shape-rendering"],["stopColor","stop-color"],["stopOpacity","stop-opacity"],["strikethroughPosition","strikethrough-position"],["strikethroughThickness","strikethrough-thickness"],["strokeDasharray","stroke-dasharray"],["strokeDashoffset","stroke-dashoffset"],["strokeLinecap","stroke-linecap"],["strokeLinejoin","stroke-linejoin"],["strokeMiterlimit","stroke-miterlimit"],["strokeOpacity","stroke-opacity"],["strokeWidth","stroke-width"],["textAnchor","text-anchor"],["textDecoration","text-decoration"],["textRendering","text-rendering"],["transformOrigin","transform-origin"],["underlinePosition","underline-position"],["underlineThickness","underline-thickness"],["unicodeBidi","unicode-bidi"],["unicodeRange","unicode-range"],["unitsPerEm","units-per-em"],["vAlphabetic","v-alphabetic"],["vHanging","v-hanging"],["vIdeographic","v-ideographic"],["vMathematical","v-mathematical"],["vectorEffect","vector-effect"],["vertAdvY","vert-adv-y"],["vertOriginX","vert-origin-x"],["vertOriginY","vert-origin-y"],["wordSpacing","word-spacing"],["writingMode","writing-mode"],["xmlnsXlink","xmlns:xlink"],["xHeight","x-height"]]),uC=/^[\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 Mo(n){return uC.test(""+n)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":n}function Ei(){}var Ju=null;function eh(n){return n=n.target||n.srcElement||window,n.correspondingUseElement&&(n=n.correspondingUseElement),n.nodeType===3?n.parentNode:n}var Vr=null,Kr=null;function Dg(n){var s=Ur(n);if(s&&(n=s.stateNode)){var l=n[Bn]||null;e:switch(n=s.stateNode,s.type){case"input":if(Gu(n,l.value,l.defaultValue,l.defaultValue,l.checked,l.defaultChecked,l.type,l.name),s=l.name,l.type==="radio"&&s!=null){for(l=n;l.parentNode;)l=l.parentNode;for(l=l.querySelectorAll('input[name="'+ii(""+s)+'"][type="radio"]'),s=0;s<l.length;s++){var o=l[s];if(o!==n&&o.form===n.form){var d=o[Bn]||null;if(!d)throw Error(r(90));Gu(o,d.value,d.defaultValue,d.defaultValue,d.checked,d.defaultChecked,d.type,d.name)}}for(s=0;s<l.length;s++)o=l[s],o.form===n.form&&Cg(o)}break e;case"textarea":Ng(n,l.value,l.defaultValue);break e;case"select":s=l.value,s!=null&&Fr(n,!!l.multiple,s,!1)}}}var th=!1;function Mg(n,s,l){if(th)return n(s,l);th=!0;try{var o=n(s);return o}finally{if(th=!1,(Vr!==null||Kr!==null)&&(Mc(),Vr&&(s=Vr,n=Kr,Kr=Vr=null,Dg(s),n)))for(s=0;s<n.length;s++)Dg(n[s])}}function Gl(n,s){var l=n.stateNode;if(l===null)return null;var o=l[Bn]||null;if(o===null)return null;l=o[s];e:switch(s){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(o=!o.disabled)||(n=n.type,o=!(n==="button"||n==="input"||n==="select"||n==="textarea")),n=!o;break e;default:n=!1}if(n)return null;if(l&&typeof l!="function")throw Error(r(231,s,typeof l));return l}var Gi=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),nh=!1;if(Gi)try{var Ql={};Object.defineProperty(Ql,"passive",{get:function(){nh=!0}}),window.addEventListener("test",Ql,Ql),window.removeEventListener("test",Ql,Ql)}catch{nh=!1}var ps=null,ih=null,Ao=null;function Ag(){if(Ao)return Ao;var n,s=ih,l=s.length,o,d="value"in ps?ps.value:ps.textContent,p=d.length;for(n=0;n<l&&s[n]===d[n];n++);var b=l-n;for(o=1;o<=b&&s[l-o]===d[p-o];o++);return Ao=d.slice(n,1<o?1-o:void 0)}function Ro(n){var s=n.keyCode;return"charCode"in n?(n=n.charCode,n===0&&s===13&&(n=13)):n=s,n===10&&(n=13),32<=n||n===13?n:0}function Oo(){return!0}function Rg(){return!1}function jn(n){function s(l,o,d,p,b){this._reactName=l,this._targetInst=d,this.type=o,this.nativeEvent=p,this.target=b,this.currentTarget=null;for(var k in n)n.hasOwnProperty(k)&&(l=n[k],this[k]=l?l(p):p[k]);return this.isDefaultPrevented=(p.defaultPrevented!=null?p.defaultPrevented:p.returnValue===!1)?Oo:Rg,this.isPropagationStopped=Rg,this}return O(s.prototype,{preventDefault:function(){this.defaultPrevented=!0;var l=this.nativeEvent;l&&(l.preventDefault?l.preventDefault():typeof l.returnValue!="unknown"&&(l.returnValue=!1),this.isDefaultPrevented=Oo)},stopPropagation:function(){var l=this.nativeEvent;l&&(l.stopPropagation?l.stopPropagation():typeof l.cancelBubble!="unknown"&&(l.cancelBubble=!0),this.isPropagationStopped=Oo)},persist:function(){},isPersistent:Oo}),s}var gs={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(n){return n.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Bo=jn(gs),Zl=O({},gs,{view:0,detail:0}),hC=jn(Zl),sh,rh,Jl,Lo=O({},Zl,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:ah,button:0,buttons:0,relatedTarget:function(n){return n.relatedTarget===void 0?n.fromElement===n.srcElement?n.toElement:n.fromElement:n.relatedTarget},movementX:function(n){return"movementX"in n?n.movementX:(n!==Jl&&(Jl&&n.type==="mousemove"?(sh=n.screenX-Jl.screenX,rh=n.screenY-Jl.screenY):rh=sh=0,Jl=n),sh)},movementY:function(n){return"movementY"in n?n.movementY:rh}}),Og=jn(Lo),dC=O({},Lo,{dataTransfer:0}),fC=jn(dC),mC=O({},Zl,{relatedTarget:0}),lh=jn(mC),pC=O({},gs,{animationName:0,elapsedTime:0,pseudoElement:0}),gC=jn(pC),_C=O({},gs,{clipboardData:function(n){return"clipboardData"in n?n.clipboardData:window.clipboardData}}),vC=jn(_C),yC=O({},gs,{data:0}),Bg=jn(yC),SC={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},bC={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"},xC={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function wC(n){var s=this.nativeEvent;return s.getModifierState?s.getModifierState(n):(n=xC[n])?!!s[n]:!1}function ah(){return wC}var CC=O({},Zl,{key:function(n){if(n.key){var s=SC[n.key]||n.key;if(s!=="Unidentified")return s}return n.type==="keypress"?(n=Ro(n),n===13?"Enter":String.fromCharCode(n)):n.type==="keydown"||n.type==="keyup"?bC[n.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:ah,charCode:function(n){return n.type==="keypress"?Ro(n):0},keyCode:function(n){return n.type==="keydown"||n.type==="keyup"?n.keyCode:0},which:function(n){return n.type==="keypress"?Ro(n):n.type==="keydown"||n.type==="keyup"?n.keyCode:0}}),kC=jn(CC),NC=O({},Lo,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Lg=jn(NC),EC=O({},gs,{submitter:0}),jC=jn(EC),TC=O({},Zl,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:ah}),DC=jn(TC),MC=O({},gs,{propertyName:0,elapsedTime:0,pseudoElement:0}),AC=jn(MC),RC=O({},Lo,{deltaX:function(n){return"deltaX"in n?n.deltaX:"wheelDeltaX"in n?-n.wheelDeltaX:0},deltaY:function(n){return"deltaY"in n?n.deltaY:"wheelDeltaY"in n?-n.wheelDeltaY:"wheelDelta"in n?-n.wheelDelta:0},deltaZ:0,deltaMode:0}),OC=jn(RC),BC=O({},gs,{newState:0,oldState:0,source:0}),LC=jn(BC),zC=[9,13,27,32],oh=Gi&&"CompositionEvent"in window,ea=null;Gi&&"documentMode"in document&&(ea=document.documentMode);var HC=Gi&&"TextEvent"in window&&!ea,zg=Gi&&(!oh||ea&&8<ea&&11>=ea),Hg=" ",Ig=!1;function Ug(n,s){switch(n){case"keyup":return zC.indexOf(s.keyCode)!==-1;case"keydown":return s.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Pg(n){return n=n.detail,typeof n=="object"&&"data"in n?n.data:null}var Yr=!1;function IC(n,s){switch(n){case"compositionend":return Pg(s);case"keypress":return s.which!==32?null:(Ig=!0,Hg);case"textInput":return n=s.data,n===Hg&&Ig?null:n;default:return null}}function UC(n,s){if(Yr)return n==="compositionend"||!oh&&Ug(n,s)?(n=Ag(),Ao=ih=ps=null,Yr=!1,n):null;switch(n){case"paste":return null;case"keypress":if(!(s.ctrlKey||s.altKey||s.metaKey)||s.ctrlKey&&s.altKey){if(s.char&&1<s.char.length)return s.char;if(s.which)return String.fromCharCode(s.which)}return null;case"compositionend":return zg&&s.locale!=="ko"?null:s.data;default:return null}}var PC={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 qg(n){var s=n&&n.nodeName&&n.nodeName.toLowerCase();return s==="input"?!!PC[n.type]:s==="textarea"}function Fg(n,s,l,o){Vr?Kr?Kr.push(o):Kr=[o]:Vr=o,s=zc(s,"onChange"),0<s.length&&(l=new Bo("onChange","change",null,l,o),n.push({event:l,listeners:s}))}var ta=null,na=null;function qC(n){Dy(n,0)}function zo(n){var s=Xl(n);if(Cg(s))return n}function $g(n,s){if(n==="change")return s}var Vg=!1;if(Gi){var ch;if(Gi){var uh="oninput"in document;if(!uh){var Kg=document.createElement("div");Kg.setAttribute("oninput","return;"),uh=typeof Kg.oninput=="function"}ch=uh}else ch=!1;Vg=ch&&(!document.documentMode||9<document.documentMode)}function Yg(){ta&&(ta.detachEvent("onpropertychange",Wg),na=ta=null)}function Wg(n){if(n.propertyName==="value"&&zo(na)){var s=[];Fg(s,na,n,eh(n)),Mg(qC,s)}}function FC(n,s,l){n==="focusin"?(Yg(),ta=s,na=l,ta.attachEvent("onpropertychange",Wg)):n==="focusout"&&Yg()}function $C(n){if(n==="selectionchange"||n==="keyup"||n==="keydown")return zo(na)}function VC(n,s){if(n==="click")return zo(s)}function KC(n,s){if(n==="input"||n==="change")return zo(s)}function YC(n,s){return n===s&&(n!==0||1/n===1/s)||n!==n&&s!==s}var Kn=typeof Object.is=="function"?Object.is:YC;function ia(n,s){if(Kn(n,s))return!0;if(typeof n!="object"||n===null||typeof s!="object"||s===null)return!1;var l=Object.keys(n),o=Object.keys(s);if(l.length!==o.length)return!1;for(o=0;o<l.length;o++){var d=l[o];if(!Ge.call(s,d)||!Kn(n[d],s[d]))return!1}return!0}function hh(n){if(n=n||(typeof document<"u"?document:void 0),typeof n>"u")return null;try{return n.activeElement||n.body}catch{return n.body}}function Xg(n){for(;n&&n.firstChild;)n=n.firstChild;return n}function Gg(n,s){var l=Xg(n);n=0;for(var o;l;){if(l.nodeType===3){if(o=n+l.textContent.length,n<=s&&o>=s)return{node:l,offset:s-n};n=o}e:{for(;l;){if(l.nextSibling){l=l.nextSibling;break e}l=l.parentNode}l=void 0}l=Xg(l)}}function Qg(n,s){return n&&s?n===s?!0:n&&n.nodeType===3?!1:s&&s.nodeType===3?Qg(n,s.parentNode):"contains"in n?n.contains(s):n.compareDocumentPosition?!!(n.compareDocumentPosition(s)&16):!1:!1}function Zg(n){n=n!=null&&n.ownerDocument!=null&&n.ownerDocument.defaultView!=null?n.ownerDocument.defaultView:window;for(var s=hh(n.document);s instanceof n.HTMLIFrameElement;){try{var l=typeof s.contentWindow.location.href=="string"}catch{l=!1}if(l)n=s.contentWindow;else break;s=hh(n.document)}return s}function dh(n){var s=n&&n.nodeName&&n.nodeName.toLowerCase();return s&&(s==="input"&&(n.type==="text"||n.type==="search"||n.type==="tel"||n.type==="url"||n.type==="password")||s==="textarea"||n.contentEditable==="true")}var WC=Gi&&"documentMode"in document&&11>=document.documentMode,Wr=null,fh=null,sa=null,mh=!1;function Jg(n,s,l){var o=l.window===l?l.document:l.nodeType===9?l:l.ownerDocument;mh||Wr==null||Wr!==hh(o)||(o=Wr,"selectionStart"in o&&dh(o)?o={start:o.selectionStart,end:o.selectionEnd}:(o=(o.ownerDocument&&o.ownerDocument.defaultView||window).getSelection(),o={anchorNode:o.anchorNode,anchorOffset:o.anchorOffset,focusNode:o.focusNode,focusOffset:o.focusOffset}),sa&&ia(sa,o)||(sa=o,o=zc(fh,"onSelect"),0<o.length&&(s=new Bo("onSelect","select",null,s,l),n.push({event:s,listeners:o}),s.target=Wr)))}function er(n,s){var l={};return l[n.toLowerCase()]=s.toLowerCase(),l["Webkit"+n]="webkit"+s,l["Moz"+n]="moz"+s,l}var Xr={animationend:er("Animation","AnimationEnd"),animationiteration:er("Animation","AnimationIteration"),animationstart:er("Animation","AnimationStart"),transitionrun:er("Transition","TransitionRun"),transitionstart:er("Transition","TransitionStart"),transitioncancel:er("Transition","TransitionCancel"),transitionend:er("Transition","TransitionEnd")},ph={},e_={};Gi&&(e_=document.createElement("div").style,"AnimationEvent"in window||(delete Xr.animationend.animation,delete Xr.animationiteration.animation,delete Xr.animationstart.animation),"TransitionEvent"in window||delete Xr.transitionend.transition);function tr(n){if(ph[n])return ph[n];if(!Xr[n])return n;var s=Xr[n],l;for(l in s)if(s.hasOwnProperty(l)&&l in e_)return ph[n]=s[l];return n}var t_=tr("animationend"),n_=tr("animationiteration"),i_=tr("animationstart"),XC=tr("transitionrun"),GC=tr("transitionstart"),QC=tr("transitioncancel"),s_=tr("transitionend"),r_=new Map,gh="abort auxClick beforeToggle cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error fullscreenChange fullscreenError gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");gh.push("scrollEnd");function vi(n,s){r_.set(n,s),Js(s,[n])}var ZC=0;function Qi(n,s){if(n.name!=null&&n.name!=="auto")return n.name;if(s.autoName!==null)return s.autoName;n=xi.identifierPrefix;var l=ZC++;return n="_"+n+"t_"+l.toString(32)+"_",s.autoName=n}function l_(n){if(n==null||typeof n=="string")return n;var s=null,l=pl;if(l!==null)for(var o=0;o<l.length;o++){var d=n[l[o]];if(d!=null){if(d==="none")return"none";s=s==null?d:s+(" "+d)}}return s??n.default}function Zi(n,s){return n=l_(n),s=l_(s),s==null?n==="auto"?null:n:s==="auto"?null:s}var Ho=typeof reportError=="function"?reportError:function(n){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var s=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof n=="object"&&n!==null&&typeof n.message=="string"?String(n.message):String(n),error:n});if(!window.dispatchEvent(s))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",n);return}console.error(n)},si=[],Gr=0,_h=0;function Io(){for(var n=Gr,s=_h=Gr=0;s<n;){var l=si[s];si[s++]=null;var o=si[s];si[s++]=null;var d=si[s];si[s++]=null;var p=si[s];if(si[s++]=null,o!==null&&d!==null){var b=o.pending;b===null?d.next=d:(d.next=b.next,b.next=d),o.pending=d}p!==0&&a_(l,d,p)}}function Uo(n,s,l,o){si[Gr++]=n,si[Gr++]=s,si[Gr++]=l,si[Gr++]=o,_h|=o,n.lanes|=o,n=n.alternate,n!==null&&(n.lanes|=o)}function vh(n,s,l,o){return Uo(n,s,l,o),Po(n)}function nr(n,s){return Uo(n,null,null,s),Po(n)}function a_(n,s,l){n.lanes|=l;var o=n.alternate;o!==null&&(o.lanes|=l);for(var d=!1,p=n.return;p!==null;)p.childLanes|=l,o=p.alternate,o!==null&&(o.childLanes|=l),p.tag===22&&(n=p.stateNode,n===null||n._visibility&1||(d=!0)),n=p,p=p.return;return n.tag===3?(p=n.stateNode,d&&s!==null&&(d=31-dn(l),n=p.hiddenUpdates,o=n[d],o===null?n[d]=[s]:o.push(s),s.lane=l|536870912),p):null}function Po(n){if(50<Na)throw Na=0,Dc=null,Error(r(185));for(var s=n.return;s!==null;)n=s,s=n.return;return n.tag===3?n.stateNode:null}var Qr={};function JC(n,s,l,o){this.tag=n,this.key=l,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=s,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=o,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Ln(n,s,l,o){return new JC(n,s,l,o)}function yh(n){return n=n.prototype,!(!n||!n.isReactComponent)}function Ji(n,s){var l=n.alternate;return l===null?(l=Ln(n.tag,s,n.key,n.mode),l.elementType=n.elementType,l.type=n.type,l.stateNode=n.stateNode,l.alternate=n,n.alternate=l):(l.pendingProps=s,l.type=n.type,l.flags=0,l.subtreeFlags=0,l.deletions=null),l.flags=n.flags&1206910976,l.childLanes=n.childLanes,l.lanes=n.lanes,l.child=n.child,l.memoizedProps=n.memoizedProps,l.memoizedState=n.memoizedState,l.updateQueue=n.updateQueue,s=n.dependencies,l.dependencies=s===null?null:{lanes:s.lanes,firstContext:s.firstContext},l.sibling=n.sibling,l.index=n.index,l.ref=n.ref,l.refCleanup=n.refCleanup,l}function o_(n,s){n.flags&=1206910978;var l=n.alternate;return l===null?(n.childLanes=0,n.lanes=s,n.child=null,n.subtreeFlags=0,n.memoizedProps=null,n.memoizedState=null,n.updateQueue=null,n.dependencies=null,n.stateNode=null):(n.childLanes=l.childLanes,n.lanes=l.lanes,n.child=l.child,n.subtreeFlags=0,n.deletions=null,n.memoizedProps=l.memoizedProps,n.memoizedState=l.memoizedState,n.updateQueue=l.updateQueue,n.type=l.type,s=l.dependencies,n.dependencies=s===null?null:{lanes:s.lanes,firstContext:s.firstContext}),n}function qo(n,s,l,o,d,p){var b=0;if(o=n,typeof o=="function")yh(o)&&(b=1);else if(typeof o=="string")b=EN(n,l,le.current)?26:n==="html"||n==="head"||n==="body"?27:5;else e:switch(o){case De:return n=Ln(31,l,s,d),n.elementType=De,n.lanes=p,n;case G:return ir(l.children,d,p,s);case P:b=8,d|=24;break;case L:return n=Ln(12,l,s,d|2),n.elementType=L,n.lanes=p,n;case te:return n=Ln(13,l,s,d),n.elementType=te,n.lanes=p,n;case ne:return n=Ln(19,l,s,d),n.elementType=ne,n.lanes=p,n;case we:case E:return n=d|32,n=Ln(30,l,s,n),n.elementType=E,n.lanes=p,n.stateNode={autoName:null,paired:null,clones:null,ref:null},n;default:if(typeof o=="object"&&o!==null)switch(o.$$typeof){case K:b=10;break e;case F:b=9;break e;case q:b=11;break e;case ge:b=14;break e;case D:b=16,o=null;break e}b=29,l=Error(r(130,n===null?"null":typeof n,"")),o=null}return s=Ln(b,l,s,d),s.elementType=n,s.type=o,s.lanes=p,s}function ir(n,s,l,o){return n=Ln(7,n,o,s),n.lanes=l,n}function Sh(n,s,l){return n=Ln(6,n,null,s),n.lanes=l,n}function c_(n){var s=Ln(18,null,null,0);return s.stateNode=n,s}function bh(n,s,l){return s=Ln(4,n.children!==null?n.children:[],n.key,s),s.lanes=l,s.stateNode={containerInfo:n.containerInfo,pendingChildren:null,implementation:n.implementation},s}var u_=new WeakMap;function ri(n,s){if(typeof n=="object"&&n!==null){var l=u_.get(n);return l!==void 0?l:(s={value:n,source:s,stack:Se(s)},u_.set(n,s),s)}return{value:n,source:s,stack:Se(s)}}var Zr=[],Jr=0,Fo=null,ra=0,li=[],ai=0,_s=null,ji=1,Ti="";function es(n,s){Zr[Jr++]=ra,Zr[Jr++]=Fo,Fo=n,ra=s}function h_(n,s,l){li[ai++]=ji,li[ai++]=Ti,li[ai++]=_s,_s=n;var o=ji;n=Ti;var d=32-dn(o)-1;o&=~(1<<d),l+=1;var p=32-dn(s)+d;if(30<p){var b=d-d%5;p=(o&(1<<b)-1).toString(32),o>>=b,d-=b,ji=1<<32-dn(s)+d|l<<d|o,Ti=p+n}else ji=1<<p|l<<d|o,Ti=n}function $o(n){n.return!==null&&(es(n,1),h_(n,1,0))}function xh(n){for(;n===Fo;)Fo=Zr[--Jr],Zr[Jr]=null,ra=Zr[--Jr],Zr[Jr]=null;for(;n===_s;)_s=li[--ai],li[ai]=null,Ti=li[--ai],li[ai]=null,ji=li[--ai],li[ai]=null}function d_(n,s){li[ai++]=ji,li[ai++]=Ti,li[ai++]=_s,ji=s.id,Ti=s.overflow,_s=n}var sn=null,Nt=null,et=!1,vs=null,oi=!1,wh=Error(r(519));function ys(n){var s=Error(r(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw la(ri(s,n)),wh}function f_(n){var s=n.stateNode,l=n.type,o=n.memoizedProps;switch(s[fn]=n,s[Bn]=o,l){case"dialog":lt("cancel",s),lt("close",s);break;case"iframe":case"object":case"embed":lt("load",s);break;case"video":case"audio":for(l=0;l<ja.length;l++)lt(ja[l],s);break;case"source":lt("error",s);break;case"img":case"image":case"link":lt("error",s),lt("load",s);break;case"details":lt("toggle",s);break;case"input":lt("invalid",s),kg(s,o.value,o.defaultValue,o.checked,o.defaultChecked,o.type,o.name,!0);break;case"select":lt("invalid",s);break;case"textarea":lt("invalid",s),Eg(s,o.value,o.defaultValue,o.children)}l=o.children,typeof l!="string"&&typeof l!="number"&&typeof l!="bigint"||s.textContent===""+l||o.suppressHydrationWarning===!0||Oy(s.textContent,l)?(o.popover!=null&&(lt("beforetoggle",s),lt("toggle",s)),o.onScroll!=null&&lt("scroll",s),o.onScrollEnd!=null&&lt("scrollend",s),o.onClick!=null&&(s.onclick=Ei),s=!0):s=!1,s||ys(n,!0)}function Vo(n){for(sn=n.return;sn;)switch(sn.tag){case 5:case 31:case 13:oi=!1;return;case 27:case 3:oi=!0;return;default:sn=sn.return}}function el(n){if(n!==sn)return!1;if(!et)return Vo(n),et=!0,!1;var s=n.tag,l;if((l=s!==3&&s!==27)&&((l=s===5)&&(l=n.type,l=!(l!=="form"&&l!=="button")||Jd(n.type,n.memoizedProps)),l=!l),l&&Nt&&ys(n),Vo(n),s===13){if(n=n.memoizedState,n=n!==null?n.dehydrated:null,!n)throw Error(r(317));Nt=Jy(n)}else if(s===31){if(n=n.memoizedState,n=n!==null?n.dehydrated:null,!n)throw Error(r(317));Nt=Jy(n)}else s===27?(s=Nt,Bs(n.type)?(n=cf,cf=null,Nt=n):Nt=s):Nt=sn?ui(n.stateNode.nextSibling):null;return!0}function sr(){Nt=sn=null,et=!1}function Ch(){var n=vs;return n!==null&&(In===null?In=n:In.push.apply(In,n),vs=null),n}function la(n){vs===null?vs=[n]:vs.push(n)}var kh=Je(null),rr=null,ts=null;function Ss(n,s,l){qe(kh,s._currentValue),s._currentValue=l}function ns(n){n._currentValue=kh.current,Ke(kh)}function Ko(n,s,l){for(;n!==null;){var o=n.alternate;if((n.childLanes&s)!==s?(n.childLanes|=s,o!==null&&(o.childLanes|=s)):o!==null&&(o.childLanes&s)!==s&&(o.childLanes|=s),n===l)break;n=n.return}}function Nh(n,s,l,o){var d=n.child;for(d!==null&&(d.return=n);d!==null;){var p=d.dependencies;if(p!==null){var b=d.child;p=p.firstContext;e:for(;p!==null;){var k=p;p=d;for(var B=0;B<s.length;B++)if(k.context===s[B]){p.lanes|=l,k=p.alternate,k!==null&&(k.lanes|=l),Ko(p.return,l,n),o||(b=null);break e}p=k.next}}else if(d.tag===18){if(b=d.return,b===null)throw Error(r(341));b.lanes|=l,p=b.alternate,p!==null&&(p.lanes|=l),Ko(b,l,n),b=null}else d.tag===13&&d.memoizedState!==null&&d.memoizedState.dehydrated===null?(d.lanes|=l,b=d.alternate,b!==null&&(b.lanes|=l),Ko(d.return,l,n),b=d.child,b=b!==null?b.sibling:null):b=d.child;if(b!==null)b.return=d;else for(b=d;b!==null;){if(b===n){b=null;break}if(d=b.sibling,d!==null){d.return=b.return,b=d;break}b=b.return}d=b}}function lr(n,s,l,o){n=null;for(var d=s,p=!1;d!==null;){if(!p){if((d.flags&524288)!==0)p=!0;else if((d.flags&262144)!==0)break}if(d.tag===10){var b=d.alternate;if(b===null)throw Error(r(387));if(b=b.memoizedProps,b!==null){var k=d.type;Kn(d.pendingProps.value,b.value)||(n!==null?n.push(k):n=[k])}}else if(d===He.current){if(b=d.alternate,b===null)throw Error(r(387));b.memoizedState.memoizedState!==d.memoizedState.memoizedState&&(n!==null?n.push(kl):n=[kl])}d=d.return}return n!==null&&Nh(s,n,l,o),s.flags|=262144,n!==null}function Yo(n){for(n=n.firstContext;n!==null;){if(!Kn(n.context._currentValue,n.memoizedValue))return!0;n=n.next}return!1}function ar(n){rr=n,ts=null,n=n.dependencies,n!==null&&(n.firstContext=null)}function mn(n){return m_(rr,n)}function Wo(n,s){return rr===null&&ar(n),m_(n,s)}function m_(n,s){var l=s._currentValue;if(s={context:s,memoizedValue:l,next:null},ts===null){if(n===null)throw Error(r(308));ts=s,n.dependencies={lanes:0,firstContext:s},n.flags|=524288}else ts=ts.next=s;return l}var ek=typeof AbortController<"u"?AbortController:function(){var n=[],s=this.signal={aborted:!1,addEventListener:function(l,o){n.push(o)}};this.abort=function(){s.aborted=!0,n.forEach(function(l){return l()})}},tk=e.unstable_scheduleCallback,nk=e.unstable_NormalPriority,$t={$$typeof:K,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Eh(){return{controller:new ek,data:new Map,refCount:0}}function aa(n){n.refCount--,n.refCount===0&&tk(nk,function(){n.controller.abort()})}function p_(n,s){if((n.pendingLanes&4194048)!==0){var l=n.transitionTypes;for(l===null&&(l=n.transitionTypes=[]),n=0;n<s.length;n++){var o=s[n];l.indexOf(o)===-1&&l.push(o)}}}var oa=null;function ik(n){var s=n.transitionTypes;return n.transitionTypes=null,s}var ca=null,jh=0,or=0,tl=null;function sk(n,s){if(ca===null){var l=ca=[];jh=0,or=$d(),tl={status:"pending",value:void 0,then:function(o){l.push(o)}}}return jh++,s.then(g_,g_),s}function g_(){if(--jh===0&&(oa=null,ca!==null)){tl!==null&&(tl.status="fulfilled");var n=ca;ca=null,or=0,tl=null;for(var s=0;s<n.length;s++)(0,n[s])()}}function rk(n,s){var l=[],o={status:"pending",value:null,reason:null,then:function(d){l.push(d)}};return n.then(function(){o.status="fulfilled",o.value=s;for(var d=0;d<l.length;d++)(0,l[d])(s)},function(d){for(o.status="rejected",o.reason=d,d=0;d<l.length;d++)(0,l[d])(void 0)}),o}var __=oe.S;oe.S=function(n,s){if(cy=Ft(),typeof s=="object"&&s!==null&&typeof s.then=="function"&&sk(n,s),oa!==null)for(var l=yl;l!==null;)p_(l,oa),l=l.next;if(l=n.types,l!==null){for(var o=yl;o!==null;)p_(o,l),o=o.next;if(or!==0){o=oa,o===null&&(o=oa=[]);for(var d=0;d<l.length;d++){var p=l[d];o.indexOf(p)===-1&&o.push(p)}}}__!==null&&__(n,s)};var cr=Je(null);function Th(){var n=cr.current;return n!==null?n:wt.pooledCache}function Xo(n,s){s===null?qe(cr,cr.current):qe(cr,s.pool)}function v_(){var n=Th();return n===null?null:{parent:$t._currentValue,pool:n}}var nl=Error(r(460)),Dh=Error(r(474)),Go=Error(r(542)),Qo={then:function(){}};function y_(n){return n=n.status,n==="fulfilled"||n==="rejected"}function S_(n,s,l){switch(l=n[l],l===void 0?n.push(s):l!==s&&(s.then(Ei,Ei),s=l),s.status){case"fulfilled":return s.value;case"rejected":throw n=s.reason,x_(n),n===void 0&&!("reason"in s)?Error(r(600)):n;default:if(typeof s.status=="string")s.then(Ei,Ei);else{if(n=wt,n!==null&&100<n.shellSuspendCounter)throw Error(r(482));n=s,n.status="pending",n.then(function(o){if(s.status==="pending"){var d=s;d.status="fulfilled",d.value=o}},function(o){if(s.status==="pending"){var d=s;d.status="rejected",d.reason=o}})}switch(s.status){case"fulfilled":return s.value;case"rejected":throw n=s.reason,x_(n),n}throw hr=s,nl}}function ur(n){try{var s=n._init;return s(n._payload)}catch(l){throw l!==null&&typeof l=="object"&&typeof l.then=="function"?(hr=l,nl):l}}var hr=null;function b_(){if(hr===null)throw Error(r(459));var n=hr;return hr=null,n}function x_(n){if(n===nl||n===Go)throw Error(r(483))}var il=null,ua=0;function Zo(n){var s=ua;return ua+=1,il===null&&(il=[]),S_(il,n,s)}function bs(n,s){s=s.props.ref,n.ref=s!==void 0?s:null}function Jo(n,s){throw s.$$typeof===$?Error(r(525)):(n=Object.prototype.toString.call(s),Error(r(31,n==="[object Object]"?"object with keys {"+Object.keys(s).join(", ")+"}":n)))}function w_(n){function s(Y,U){if(n){var Z=Y.deletions;Z===null?(Y.deletions=[U],Y.flags|=16):Z.push(U)}}function l(Y,U){if(!n)return null;for(;U!==null;)s(Y,U),U=U.sibling;return null}function o(Y){for(var U=new Map;Y!==null;)Y.key===null?U.set(Y.index,Y):U.set(Y.key,Y),Y=Y.sibling;return U}function d(Y,U){return Y=Ji(Y,U),Y.index=0,Y.sibling=null,Y}function p(Y,U,Z){return Y.index=Z,n?(Z=Y.alternate,Z!==null?(Z=Z.index,Z<U?(Y.flags|=2,U):Z):(Y.flags|=134217730,U)):(Y.flags|=1048576,U)}function b(Y){return n&&Y.alternate===null&&(Y.flags|=134217730),Y}function k(Y,U,Z,ue){return U===null||U.tag!==6?(U=Sh(Z,Y.mode,ue),U.return=Y,U):(U=d(U,Z),U.return=Y,U)}function B(Y,U,Z,ue){var Oe=Z.type;return Oe===G?(Y=ie(Y,U,Z.props.children,ue,Z.key),bs(Y,Z),Y):U!==null&&(U.elementType===Oe||typeof Oe=="object"&&Oe!==null&&Oe.$$typeof===D&&ur(Oe)===U.type)?(U=d(U,Z.props),bs(U,Z),U.return=Y,U):(U=qo(Z.type,Z.key,Z.props,null,Y.mode,ue),bs(U,Z),U.return=Y,U)}function W(Y,U,Z,ue){return U===null||U.tag!==4||U.stateNode.containerInfo!==Z.containerInfo||U.stateNode.implementation!==Z.implementation?(U=bh(Z,Y.mode,ue),U.return=Y,U):(U=d(U,Z.children||[]),U.return=Y,U)}function ie(Y,U,Z,ue,Oe){return U===null||U.tag!==7?(U=ir(Z,Y.mode,ue,Oe),U.return=Y,U):(U=d(U,Z),U.return=Y,U)}function de(Y,U,Z){if(typeof U=="string"&&U!==""||typeof U=="number"||typeof U=="bigint")return U=Sh(""+U,Y.mode,Z),U.return=Y,U;if(typeof U=="object"&&U!==null){switch(U.$$typeof){case Q:return Z=qo(U.type,U.key,U.props,null,Y.mode,Z),bs(Z,U),Z.return=Y,Z;case z:return U=bh(U,Y.mode,Z),U.return=Y,U;case D:return U=ur(U),de(Y,U,Z)}if(ke(U)||pe(U))return U=ir(U,Y.mode,Z,null),U.return=Y,U;if(typeof U.then=="function")return de(Y,Zo(U),Z);if(U.$$typeof===K)return de(Y,Wo(Y,U),Z);Jo(Y,U)}return null}function V(Y,U,Z,ue){var Oe=U!==null?U.key:null;if(typeof Z=="string"&&Z!==""||typeof Z=="number"||typeof Z=="bigint")return Oe!==null?null:k(Y,U,""+Z,ue);if(typeof Z=="object"&&Z!==null){switch(Z.$$typeof){case Q:return Z.key===Oe?B(Y,U,Z,ue):null;case z:return Z.key===Oe?W(Y,U,Z,ue):null;case D:return Z=ur(Z),V(Y,U,Z,ue)}if(ke(Z)||pe(Z))return Oe!==null?null:ie(Y,U,Z,ue,null);if(typeof Z.then=="function")return V(Y,U,Zo(Z),ue);if(Z.$$typeof===K)return V(Y,U,Wo(Y,Z),ue);Jo(Y,Z)}return null}function ee(Y,U,Z,ue,Oe){if(typeof ue=="string"&&ue!==""||typeof ue=="number"||typeof ue=="bigint")return Y=Y.get(Z)||null,k(U,Y,""+ue,Oe);if(typeof ue=="object"&&ue!==null){switch(ue.$$typeof){case Q:return Y=Y.get(ue.key===null?Z:ue.key)||null,B(U,Y,ue,Oe);case z:return Y=Y.get(ue.key===null?Z:ue.key)||null,W(U,Y,ue,Oe);case D:return ue=ur(ue),ee(Y,U,Z,ue,Oe)}if(ke(ue)||pe(ue))return Y=Y.get(Z)||null,ie(U,Y,ue,Oe,null);if(typeof ue.then=="function")return ee(Y,U,Z,Zo(ue),Oe);if(ue.$$typeof===K)return ee(Y,U,Z,Wo(U,ue),Oe);Jo(U,ue)}return null}function je(Y,U,Z,ue){for(var Oe=null,ot=null,Ie=U,Fe=U=0,Yt=null;Ie!==null&&Fe<Z.length;Fe++){Ie.index>Fe?(Yt=Ie,Ie=null):Yt=Ie.sibling;var ut=V(Y,Ie,Z[Fe],ue);if(ut===null){Ie===null&&(Ie=Yt);break}n&&Ie&&ut.alternate===null&&s(Y,Ie),U=p(ut,U,Fe),ot===null?Oe=ut:ot.sibling=ut,ot=ut,Ie=Yt}if(Fe===Z.length)return l(Y,Ie),et&&es(Y,Fe),Oe;if(Ie===null){for(;Fe<Z.length;Fe++)Ie=de(Y,Z[Fe],ue),Ie!==null&&(U=p(Ie,U,Fe),ot===null?Oe=Ie:ot.sibling=Ie,ot=Ie);return et&&es(Y,Fe),Oe}for(Ie=o(Ie);Fe<Z.length;Fe++)Yt=ee(Ie,Y,Fe,Z[Fe],ue),Yt!==null&&(n&&(ut=Yt.alternate,ut!==null&&Ie.delete(ut.key===null?Fe:ut.key)),U=p(Yt,U,Fe),ot===null?Oe=Yt:ot.sibling=Yt,ot=Yt);return n&&Ie.forEach(function(Us){return s(Y,Us)}),et&&es(Y,Fe),Oe}function Le(Y,U,Z,ue){if(Z==null)throw Error(r(151));for(var Oe=null,ot=null,Ie=U,Fe=U=0,Yt=null,ut=Z.next();Ie!==null&&!ut.done;Fe++,ut=Z.next()){Ie.index>Fe?(Yt=Ie,Ie=null):Yt=Ie.sibling;var Us=V(Y,Ie,ut.value,ue);if(Us===null){Ie===null&&(Ie=Yt);break}n&&Ie&&Us.alternate===null&&s(Y,Ie),U=p(Us,U,Fe),ot===null?Oe=Us:ot.sibling=Us,ot=Us,Ie=Yt}if(ut.done)return l(Y,Ie),et&&es(Y,Fe),Oe;if(Ie===null){for(;!ut.done;Fe++,ut=Z.next())ut=de(Y,ut.value,ue),ut!==null&&(U=p(ut,U,Fe),ot===null?Oe=ut:ot.sibling=ut,ot=ut);return et&&es(Y,Fe),Oe}for(Ie=o(Ie);!ut.done;Fe++,ut=Z.next())ut=ee(Ie,Y,Fe,ut.value,ue),ut!==null&&(n&&(Yt=ut.alternate,Yt!==null&&Ie.delete(Yt.key===null?Fe:Yt.key)),U=p(ut,U,Fe),ot===null?Oe=ut:ot.sibling=ut,ot=ut);return n&&Ie.forEach(function(IN){return s(Y,IN)}),et&&es(Y,Fe),Oe}function Xe(Y,U,Z,ue){if(typeof Z=="object"&&Z!==null&&Z.type===G&&Z.key===null&&Z.props.ref===void 0&&(Z=Z.props.children),typeof Z=="object"&&Z!==null){switch(Z.$$typeof){case Q:e:{for(var Oe=Z.key;U!==null;){if(U.key===Oe){if(Oe=Z.type,Oe===G){if(U.tag===7){l(Y,U.sibling),ue=d(U,Z.props.children),bs(ue,Z),ue.return=Y,Y=ue;break e}}else if(U.elementType===Oe||typeof Oe=="object"&&Oe!==null&&Oe.$$typeof===D&&ur(Oe)===U.type){l(Y,U.sibling),ue=d(U,Z.props),bs(ue,Z),ue.return=Y,Y=ue;break e}l(Y,U);break}else s(Y,U);U=U.sibling}Z.type===G?(ue=ir(Z.props.children,Y.mode,ue,Z.key),bs(ue,Z),ue.return=Y,Y=ue):(ue=qo(Z.type,Z.key,Z.props,null,Y.mode,ue),bs(ue,Z),ue.return=Y,Y=ue)}return b(Y);case z:e:{for(Oe=Z.key;U!==null;){if(U.key===Oe)if(U.tag===4&&U.stateNode.containerInfo===Z.containerInfo&&U.stateNode.implementation===Z.implementation){l(Y,U.sibling),ue=d(U,Z.children||[]),ue.return=Y,Y=ue;break e}else{l(Y,U);break}else s(Y,U);U=U.sibling}ue=bh(Z,Y.mode,ue),ue.return=Y,Y=ue}return b(Y);case D:return Z=ur(Z),Xe(Y,U,Z,ue)}if(ke(Z))return je(Y,U,Z,ue);if(pe(Z)){if(Oe=pe(Z),typeof Oe!="function")throw Error(r(150));return Z=Oe.call(Z),Le(Y,U,Z,ue)}if(typeof Z.then=="function")return Xe(Y,U,Zo(Z),ue);if(Z.$$typeof===K)return Xe(Y,U,Wo(Y,Z),ue);Jo(Y,Z)}return typeof Z=="string"&&Z!==""||typeof Z=="number"||typeof Z=="bigint"?(Z=""+Z,U!==null&&U.tag===6?(l(Y,U.sibling),ue=d(U,Z),ue.return=Y,Y=ue):(l(Y,U),ue=Sh(Z,Y.mode,ue),ue.return=Y,Y=ue),b(Y)):l(Y,U)}return function(Y,U,Z,ue){try{ua=0;var Oe=Xe(Y,U,Z,ue);return il=null,Oe}catch(Ie){if(Ie===nl||Ie===Go)throw Ie;var ot=Ln(29,Ie,null,Y.mode);return ot.lanes=ue,ot.return=Y,ot}}}var dr=w_(!0),C_=w_(!1),xs=!1;function Mh(n){n.updateQueue={baseState:n.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Ah(n,s){n=n.updateQueue,s.updateQueue===n&&(s.updateQueue={baseState:n.baseState,firstBaseUpdate:n.firstBaseUpdate,lastBaseUpdate:n.lastBaseUpdate,shared:n.shared,callbacks:null})}function ws(n){return{lane:n,tag:0,payload:null,callback:null,next:null}}function Cs(n,s,l){var o=n.updateQueue;if(o===null)return null;if(o=o.shared,(mt&2)!==0){var d=o.pending;return d===null?s.next=s:(s.next=d.next,d.next=s),o.pending=s,s=Po(n),a_(n,null,l),s}return Uo(n,o,s,l),Po(n)}function ha(n,s,l){if(s=s.updateQueue,s!==null&&(s=s.shared,(l&4194048)!==0)){var o=s.lanes;o&=n.pendingLanes,l|=o,s.lanes=l,hg(n,l)}}function Rh(n,s){var l=n.updateQueue,o=n.alternate;if(o!==null&&(o=o.updateQueue,l===o)){var d=null,p=null;if(l=l.firstBaseUpdate,l!==null){do{var b={lane:l.lane,tag:l.tag,payload:l.payload,callback:null,next:null};p===null?d=p=b:p=p.next=b,l=l.next}while(l!==null);p===null?d=p=s:p=p.next=s}else d=p=s;l={baseState:o.baseState,firstBaseUpdate:d,lastBaseUpdate:p,shared:o.shared,callbacks:o.callbacks},n.updateQueue=l;return}n=l.lastBaseUpdate,n===null?l.firstBaseUpdate=s:n.next=s,l.lastBaseUpdate=s}var Oh=!1;function da(){if(Oh){var n=tl;if(n!==null)throw n}}function fa(n,s,l,o){Oh=!1;var d=n.updateQueue;xs=!1;var p=d.firstBaseUpdate,b=d.lastBaseUpdate,k=d.shared.pending;if(k!==null){d.shared.pending=null;var B=k,W=B.next;B.next=null,b===null?p=W:b.next=W,b=B;var ie=n.alternate;ie!==null&&(ie=ie.updateQueue,k=ie.lastBaseUpdate,k!==b&&(k===null?ie.firstBaseUpdate=W:k.next=W,ie.lastBaseUpdate=B))}if(p!==null){var de=d.baseState;b=0,ie=W=B=null,k=p;do{var V=k.lane&-536870913,ee=V!==k.lane;if(ee?(at&V)===V:(o&V)===V){V!==0&&V===or&&(Oh=!0),ie!==null&&(ie=ie.next={lane:0,tag:k.tag,payload:k.payload,callback:null,next:null});e:{var je=n,Le=k;V=s;var Xe=l;switch(Le.tag){case 1:if(je=Le.payload,typeof je=="function"){de=je.call(Xe,de,V);break e}de=je;break e;case 3:je.flags=je.flags&-65537|128;case 0:if(je=Le.payload,V=typeof je=="function"?je.call(Xe,de,V):je,V==null)break e;de=O({},de,V);break e;case 2:xs=!0}}V=k.callback,V!==null&&(n.flags|=64,ee&&(n.flags|=8192),ee=d.callbacks,ee===null?d.callbacks=[V]:ee.push(V))}else ee={lane:V,tag:k.tag,payload:k.payload,callback:k.callback,next:null},ie===null?(W=ie=ee,B=de):ie=ie.next=ee,b|=V;if(k=k.next,k===null){if(k=d.shared.pending,k===null)break;ee=k,k=ee.next,ee.next=null,d.lastBaseUpdate=ee,d.shared.pending=null}}while(!0);ie===null&&(B=de),d.baseState=B,d.firstBaseUpdate=W,d.lastBaseUpdate=ie,p===null&&(d.shared.lanes=0),Ms|=b,n.lanes=b,n.memoizedState=de}}function k_(n,s){if(typeof n!="function")throw Error(r(191,n));n.call(s)}function N_(n,s){var l=n.callbacks;if(l!==null)for(n.callbacks=null,n=0;n<l.length;n++)k_(l[n],s)}var ks=Je(null),ec=Je(0);function E_(n,s){n=as,qe(ec,n),qe(ks,s),as=n|s.baseLanes}function Bh(){qe(ec,as),qe(ks,ks.current)}function Lh(){as=ec.current,Ke(ks),Ke(ec)}var pn=Je(null),wn=null;function Ns(n){var s=n.alternate;qe(gn,gn.current&1),qe(pn,n),wn===null&&(s===null||ks.current!==null||s.memoizedState!==null)&&(wn=n)}function zh(n){qe(gn,gn.current),qe(pn,n),wn===null&&(wn=n)}function j_(n){n.tag===22?(qe(gn,gn.current),qe(pn,n),wn===null&&(wn=n)):Es()}function Es(){qe(gn,gn.current),qe(pn,pn.current)}function Yn(n){Ke(pn),wn===n&&(wn=null),Ke(gn)}var gn=Je(0);function ma(n,s){qe(pn,pn.current),qe(gn,s)}function Hh(n){Ke(gn),Ke(pn),wn===n&&(wn=null)}function tc(n){for(var s=n;s!==null;){if(s.tag===13){var l=s.memoizedState;if(l!==null&&(l=l.dehydrated,l===null||af(l)||of(l)))return s}else if(s.tag===19&&s.memoizedProps.revealOrder!=="independent"){if((s.flags&128)!==0)return s}else if(s.child!==null){s.child.return=s,s=s.child;continue}if(s===n)break;for(;s.sibling===null;){if(s.return===null||s.return===n)return null;s=s.return}s.sibling.return=s.return,s=s.sibling}return null}var is=0,We=null,bt=null,Vt=null,nc=!1,sl=!1,fr=!1,ic=0,pa=0,rl=null,lk=0;function Lt(){throw Error(r(321))}function Ih(n,s){if(s===null)return!1;for(var l=0;l<s.length&&l<n.length;l++)if(!Kn(n[l],s[l]))return!1;return!0}function Uh(n,s,l,o,d,p){return is=p,We=s,s.memoizedState=null,s.updateQueue=null,s.lanes=0,oe.H=n===null||n.memoizedState===null?hv:dv,fr=!1,p=l(o,d),fr=!1,sl&&(p=D_(s,l,o,d)),T_(n),p}function T_(n){oe.H=uc;var s=bt!==null&&bt.next!==null;if(is=0,Vt=bt=We=null,nc=!1,pa=0,rl=null,s)throw Error(r(300));n===null||Kt||(n=n.dependencies,n!==null&&Yo(n)&&(Kt=!0))}function D_(n,s,l,o){We=n;var d=0;do{if(sl&&(rl=null),pa=0,sl=!1,25<=d)throw Error(r(301));if(d+=1,Vt=bt=null,n.updateQueue!=null){var p=n.updateQueue;p.lastEffect=null,p.events=null,p.stores=null,p.memoCache!=null&&(p.memoCache.index=0)}oe.H=mk,p=s(l,o)}while(sl);return p}function ak(){var n=oe.H,s=n.useState()[0];return s=typeof s.then=="function"?ga(s):s,n=n.useState()[0],(bt!==null?bt.memoizedState:null)!==n&&(We.flags|=1024),s}function Ph(){var n=ic!==0;return ic=0,n}function qh(n,s,l){s.updateQueue=n.updateQueue,s.flags&=-2053,n.lanes&=~l}function Fh(n){if(nc){for(n=n.memoizedState;n!==null;){var s=n.queue;s!==null&&(s.pending=null),n=n.next}nc=!1}is=0,Vt=bt=We=null,sl=!1,pa=ic=0,rl=null}function Tn(){var n={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Vt===null?We.memoizedState=Vt=n:Vt=Vt.next=n,Vt}function Pt(){if(bt===null){var n=We.alternate;n=n!==null?n.memoizedState:null}else n=bt.next;var s=Vt===null?We.memoizedState:Vt.next;if(s!==null)Vt=s,bt=n;else{if(n===null)throw We.alternate===null?Error(r(467)):Error(r(310));bt=n,n={memoizedState:bt.memoizedState,baseState:bt.baseState,baseQueue:bt.baseQueue,queue:bt.queue,next:null},Vt===null?We.memoizedState=Vt=n:Vt=Vt.next=n}return Vt}function sc(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function ga(n){var s=pa;return pa+=1,rl===null&&(rl=[]),n=S_(rl,n,s),s=We,(Vt===null?s.memoizedState:Vt.next)===null&&(s=s.alternate,oe.H=s===null||s.memoizedState===null?hv:dv),n}function rc(n){if(n!==null&&typeof n=="object"){if(typeof n.then=="function")return ga(n);if(n.$$typeof===J)return;if(n.$$typeof===K)return mn(n)}throw Error(r(438,String(n)))}function $h(n){var s=null,l=We.updateQueue;if(l!==null&&(s=l.memoCache),s==null){var o=We.alternate;o!==null&&(o=o.updateQueue,o!==null&&(o=o.memoCache,o!=null&&(s={data:o.data.map(function(d){return d.slice()}),index:0})))}if(s==null&&(s={data:[],index:0}),l===null&&(l=sc(),We.updateQueue=l),l.memoCache=s,l=s.data[s.index],l===void 0)for(l=s.data[s.index]=Array(n),o=0;o<n;o++)l[o]=T;return s.index++,l}function ss(n,s){return typeof s=="function"?s(n):s}function lc(n){var s=Pt();return Vh(s,bt,n)}function Vh(n,s,l){var o=n.queue;if(o===null)throw Error(r(311));o.lastRenderedReducer=l;var d=n.baseQueue,p=o.pending;if(p!==null){if(d!==null){var b=d.next;d.next=p.next,p.next=b}s.baseQueue=d=p,o.pending=null}if(p=n.baseState,d===null)n.memoizedState=p;else{s=d.next;var k=b=null,B=null,W=s,ie=!1;do{var de=W.lane&-536870913;if(de!==W.lane?(at&de)===de:(is&de)===de){var V=W.revertLane;if(V===0)B!==null&&(B=B.next={lane:0,revertLane:0,gesture:null,action:W.action,hasEagerState:W.hasEagerState,eagerState:W.eagerState,next:null}),de===or&&(ie=!0);else if((is&V)===V){W=W.next,V===or&&(ie=!0);continue}else de={lane:0,revertLane:W.revertLane,gesture:null,action:W.action,hasEagerState:W.hasEagerState,eagerState:W.eagerState,next:null},B===null?(k=B=de,b=p):B=B.next=de,We.lanes|=V,Ms|=V;de=W.action,fr&&l(p,de),p=W.hasEagerState?W.eagerState:l(p,de)}else V={lane:de,revertLane:W.revertLane,gesture:W.gesture,action:W.action,hasEagerState:W.hasEagerState,eagerState:W.eagerState,next:null},B===null?(k=B=V,b=p):B=B.next=V,We.lanes|=de,Ms|=de;W=W.next}while(W!==null&&W!==s);if(B===null?b=p:B.next=k,!Kn(p,n.memoizedState)&&(Kt=!0,ie&&(l=tl,l!==null)))throw l;n.memoizedState=p,n.baseState=b,n.baseQueue=B,o.lastRenderedState=p}return d===null&&(o.lanes=0),[n.memoizedState,o.dispatch]}function Kh(n){var s=Pt(),l=s.queue;if(l===null)throw Error(r(311));l.lastRenderedReducer=n;var o=l.dispatch,d=l.pending,p=s.memoizedState;if(d!==null){l.pending=null;var b=d=d.next;do p=n(p,b.action),b=b.next;while(b!==d);Kn(p,s.memoizedState)||(Kt=!0),s.memoizedState=p,s.baseQueue===null&&(s.baseState=p),l.lastRenderedState=p}return[p,o]}function M_(n,s,l){var o=We,d=Pt(),p=et;if(p){if(l===void 0)throw Error(r(407));l=l()}else l=s();var b=!Kn((bt||d).memoizedState,l);if(b&&(d.memoizedState=l,Kt=!0),d=d.queue,Xh(O_.bind(null,o,d,n),[n]),n=d.getSnapshot!==s||b||Vt!==null&&(Vt.memoizedState.tag&1)!==0,ll(n?9:8,{destroy:void 0},R_.bind(null,o,d,l,s),null),n){if(o.flags|=2048,wt===null)throw Error(r(349));p||(is&127)!==0||A_(o,s,l)}return l}function A_(n,s,l){n.flags|=16384,n={getSnapshot:s,value:l},s=We.updateQueue,s===null?(s=sc(),We.updateQueue=s,s.stores=[n]):(l=s.stores,l===null?s.stores=[n]:l.push(n))}function R_(n,s,l,o){s.value=l,s.getSnapshot=o,B_(s)&&L_(n)}function O_(n,s,l){return l(function(){B_(s)&&L_(n)})}function B_(n){var s=n.getSnapshot;n=n.value;try{var l=s();return!Kn(n,l)}catch{return!0}}function L_(n){var s=nr(n,2);s!==null&&Un(s,n,2)}function Yh(n){var s=Tn();if(typeof n=="function"){var l=n;if(n=l(),fr){Ut(!0);try{l()}finally{Ut(!1)}}}return s.memoizedState=s.baseState=n,s.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:ss,lastRenderedState:n},s}function z_(n,s,l,o){return n.baseState=l,Vh(n,bt,typeof o=="function"?o:ss)}function ok(n,s,l,o,d){if(cc(n))throw Error(r(485));if(n=s.action,n!==null){var p={payload:d,action:n,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(b){p.listeners.push(b)}};oe.T!==null?l(!0):p.isTransition=!1,o(p),l=s.pending,l===null?(p.next=s.pending=p,H_(s,p)):(p.next=l.next,s.pending=l.next=p)}}function H_(n,s){var l=s.action,o=s.payload,d=n.state;if(s.isTransition){var p=oe.T,b={};b.types=p!==null?p.types:null,oe.T=b;try{var k=l(d,o),B=oe.S;B!==null&&B(b,k),I_(n,s,k)}catch(W){Wh(n,s,W)}finally{p!==null&&b.types!==null&&(p.types=b.types),oe.T=p}}else try{p=l(d,o),I_(n,s,p)}catch(W){Wh(n,s,W)}}function I_(n,s,l){l!==null&&typeof l=="object"&&typeof l.then=="function"?l.then(function(o){U_(n,s,o)},function(o){return Wh(n,s,o)}):U_(n,s,l)}function U_(n,s,l){s.status="fulfilled",s.value=l,P_(s),n.state=l,s=n.pending,s!==null&&(l=s.next,l===s?n.pending=null:(l=l.next,s.next=l,H_(n,l)))}function Wh(n,s,l){var o=n.pending;if(n.pending=null,o!==null){o=o.next;do s.status="rejected",s.reason=l,P_(s),s=s.next;while(s!==o)}n.action=null}function P_(n){n=n.listeners;for(var s=0;s<n.length;s++)(0,n[s])()}function q_(n,s){return s}function F_(n,s){if(et){var l=wt.formState;if(l!==null){e:{var o=We;if(et){if(Nt){t:{for(var d=Nt,p=oi;d.nodeType!==8;){if(!p){d=null;break t}if(d=ui(d.nextSibling),d===null){d=null;break t}}p=d.data,d=p==="F!"||p==="F"?d:null}if(d){Nt=ui(d.nextSibling),o=d.data==="F!";break e}}ys(o)}o=!1}o&&(s=l[0])}}return l=Tn(),l.memoizedState=l.baseState=s,o={pending:null,lanes:0,dispatch:null,lastRenderedReducer:q_,lastRenderedState:s},l.queue=o,l=ov.bind(null,We,o),o.dispatch=l,o=Yh(!1),p=ed.bind(null,We,!1,o.queue),o=Tn(),d={state:s,dispatch:null,action:n,pending:null},o.queue=d,l=ok.bind(null,We,d,p,l),d.dispatch=l,o.memoizedState=n,[s,l,!1]}function $_(n){var s=Pt();return V_(s,bt,n)}function V_(n,s,l){if(s=Vh(n,s,q_)[0],n=lc(ss)[0],typeof s=="object"&&s!==null&&typeof s.then=="function")try{var o=ga(s)}catch(b){throw b===nl?Go:b}else o=s;s=Pt();var d=s.queue,p=d.dispatch;return l!==s.memoizedState&&(We.flags|=2048,ll(9,{destroy:void 0},ck.bind(null,d,l),null)),[o,p,n]}function ck(n,s){n.action=s}function K_(n){var s=Pt(),l=bt;if(l!==null)return V_(s,l,n);Pt(),s=s.memoizedState,l=Pt();var o=l.queue.dispatch;return l.memoizedState=n,[s,o,!1]}function ll(n,s,l,o){return n={tag:n,create:l,deps:o,inst:s,next:null},s=We.updateQueue,s===null&&(s=sc(),We.updateQueue=s),l=s.lastEffect,l===null?s.lastEffect=n.next=n:(o=l.next,l.next=n,n.next=o,s.lastEffect=n),n}function Y_(){return Pt().memoizedState}function ac(n,s,l,o){var d=Tn();We.flags|=n,d.memoizedState=ll(1|s,{destroy:void 0},l,o===void 0?null:o)}function oc(n,s,l,o){var d=Pt();o=o===void 0?null:o;var p=d.memoizedState.inst;bt!==null&&o!==null&&Ih(o,bt.memoizedState.deps)?d.memoizedState=ll(s,p,l,o):(We.flags|=n,d.memoizedState=ll(1|s,p,l,o))}function W_(n,s){ac(8390656,8,n,s)}function Xh(n,s){oc(2048,8,n,s)}function uk(n){We.flags|=4;var s=We.updateQueue;if(s===null)s=sc(),We.updateQueue=s,s.events=[n];else{var l=s.events;l===null?s.events=[n]:l.push(n)}}function X_(n){var s=Pt().memoizedState;return uk({ref:s,nextImpl:n}),function(){if((mt&2)!==0)throw Error(r(440));return s.impl.apply(void 0,arguments)}}function G_(n,s){return oc(4,2,n,s)}function Q_(n,s){return oc(4,4,n,s)}function Z_(n,s){if(typeof s=="function"){n=n();var l=s(n);return function(){typeof l=="function"?l():s(null)}}if(s!=null)return n=n(),s.current=n,function(){s.current=null}}function J_(n,s,l){l=l!=null?l.concat([n]):null,oc(4,4,Z_.bind(null,s,n),l)}function Gh(){}function ev(n,s){var l=Pt();s=s===void 0?null:s;var o=l.memoizedState;return s!==null&&Ih(s,o[1])?o[0]:(l.memoizedState=[n,s],n)}function tv(n,s){var l=Pt();s=s===void 0?null:s;var o=l.memoizedState;if(s!==null&&Ih(s,o[1]))return o[0];if(o=n(),fr){Ut(!0);try{n()}finally{Ut(!1)}}return l.memoizedState=[o,s],o}function Qh(n,s,l){return l===void 0||(is&1073741824)!==0&&(at&261930)===0?n.memoizedState=s:(n.memoizedState=l,n=hy(),We.lanes|=n,Ms|=n,l)}function nv(n,s,l,o){return Kn(l,s)?l:ks.current!==null?(n=Qh(n,l,o),Kn(n,s)||(Kt=!0),n):(is&106)===0||(is&1073741824)!==0&&(at&261930)===0?(Kt=!0,n.memoizedState=l):(n=hy(),We.lanes|=n,Ms|=n,s)}function iv(n,s,l,o,d){var p=ye.p;ye.p=p!==0&&8>p?p:8;var b=oe.T,k={};k.types=b!==null?b.types:null,oe.T=k,ed(n,!1,s,l);try{var B=d(),W=oe.S;if(W!==null&&W(k,B),B!==null&&typeof B=="object"&&typeof B.then=="function"){var ie=rk(B,o);_a(n,s,ie,Qn(n))}else _a(n,s,o,Qn(n))}catch(de){_a(n,s,{then:function(){},status:"rejected",reason:de},Qn())}finally{ye.p=p,b!==null&&k.types!==null&&(b.types=k.types),oe.T=b}}function hk(){}function Zh(n,s,l,o){if(n.tag!==5)throw Error(r(476));var d=sv(n).queue;iv(n,d,s,Ne,l===null?hk:function(){return rv(n),l(o)})}function sv(n){var s=n.memoizedState;if(s!==null)return s;s={memoizedState:Ne,baseState:Ne,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:ss,lastRenderedState:Ne},next:null};var l={};return s.next={memoizedState:l,baseState:l,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:ss,lastRenderedState:l},next:null},n.memoizedState=s,n=n.alternate,n!==null&&(n.memoizedState=s),s}function rv(n){var s=sv(n);s.next===null&&(s=n.alternate.memoizedState),_a(n,s.next.queue,{},Qn())}function Jh(){return mn(kl)}function lv(){return Pt().memoizedState}function av(){return Pt().memoizedState}function dk(n){for(var s=n.return;s!==null;){switch(s.tag){case 24:case 3:var l=Qn();n=ws(l);var o=Cs(s,n,l);o!==null&&(Un(o,s,l),ha(o,s,l)),s={cache:Eh()},n.payload=s;return}s=s.return}}function fk(n,s,l){var o=Qn();l={lane:o,revertLane:0,gesture:null,action:l,hasEagerState:!1,eagerState:null,next:null},cc(n)?cv(s,l):(l=vh(n,s,l,o),l!==null&&(Un(l,n,o),uv(l,s,o)))}function ov(n,s,l){var o=Qn();_a(n,s,l,o)}function _a(n,s,l,o){var d={lane:o,revertLane:0,gesture:null,action:l,hasEagerState:!1,eagerState:null,next:null};if(cc(n))cv(s,d);else{var p=n.alternate;if(n.lanes===0&&(p===null||p.lanes===0)&&(p=s.lastRenderedReducer,p!==null))try{var b=s.lastRenderedState,k=p(b,l);if(d.hasEagerState=!0,d.eagerState=k,Kn(k,b))return Uo(n,s,d,0),wt===null&&Io(),!1}catch{}if(l=vh(n,s,d,o),l!==null)return Un(l,n,o),uv(l,s,o),!0}return!1}function ed(n,s,l,o){if(o={lane:2,revertLane:$d(),gesture:null,action:o,hasEagerState:!1,eagerState:null,next:null},cc(n)){if(s)throw Error(r(479))}else s=vh(n,l,o,2),s!==null&&Un(s,n,2)}function cc(n){var s=n.alternate;return n===We||s!==null&&s===We}function cv(n,s){sl=nc=!0;var l=n.pending;l===null?s.next=s:(s.next=l.next,l.next=s),n.pending=s}function uv(n,s,l){if((l&4194048)!==0){var o=s.lanes;o&=n.pendingLanes,l|=o,s.lanes=l,hg(n,l)}}var uc={readContext:mn,use:rc,useCallback:Lt,useContext:Lt,useEffect:Lt,useImperativeHandle:Lt,useLayoutEffect:Lt,useInsertionEffect:Lt,useMemo:Lt,useReducer:Lt,useRef:Lt,useState:Lt,useDebugValue:Lt,useDeferredValue:Lt,useTransition:Lt,useSyncExternalStore:Lt,useId:Lt,useHostTransitionStatus:Lt,useFormState:Lt,useActionState:Lt,useOptimistic:Lt,useMemoCache:Lt,useCacheRefresh:Lt,useEffectEvent:Lt},hv={readContext:mn,use:rc,useCallback:function(n,s){return Tn().memoizedState=[n,s===void 0?null:s],n},useContext:mn,useEffect:W_,useImperativeHandle:function(n,s,l){l=l!=null?l.concat([n]):null,ac(4194308,4,Z_.bind(null,s,n),l)},useLayoutEffect:function(n,s){return ac(4194308,4,n,s)},useInsertionEffect:function(n,s){ac(4,2,n,s)},useMemo:function(n,s){var l=Tn();s=s===void 0?null:s;var o=n();if(fr){Ut(!0);try{n()}finally{Ut(!1)}}return l.memoizedState=[o,s],o},useReducer:function(n,s,l){var o=Tn();if(l!==void 0){var d=l(s);if(fr){Ut(!0);try{l(s)}finally{Ut(!1)}}}else d=s;return o.memoizedState=o.baseState=d,n={pending:null,lanes:0,dispatch:null,lastRenderedReducer:n,lastRenderedState:d},o.queue=n,n=n.dispatch=fk.bind(null,We,n),[o.memoizedState,n]},useRef:function(n){var s=Tn();return n={current:n},s.memoizedState=n},useState:function(n){n=Yh(n);var s=n.queue,l=ov.bind(null,We,s);return s.dispatch=l,[n.memoizedState,l]},useDebugValue:Gh,useDeferredValue:function(n,s){var l=Tn();return Qh(l,n,s)},useTransition:function(){var n=Yh(!1);return n=iv.bind(null,We,n.queue,!0,!1),Tn().memoizedState=n,[!1,n]},useSyncExternalStore:function(n,s,l){var o=We,d=Tn();if(et){if(l===void 0)throw Error(r(407));l=l()}else{if(l=s(),wt===null)throw Error(r(349));(at&127)!==0||A_(o,s,l)}d.memoizedState=l;var p={value:l,getSnapshot:s};return d.queue=p,W_(O_.bind(null,o,p,n),[n]),o.flags|=2048,ll(9,{destroy:void 0},R_.bind(null,o,p,l,s),null),l},useId:function(){var n=Tn(),s=wt.identifierPrefix;if(et){var l=Ti,o=ji;l=(o&~(1<<32-dn(o)-1)).toString(32)+l,s="_"+s+"R_"+l,l=ic++,0<l&&(s+="H"+l.toString(32)),s+="_"}else l=lk++,s="_"+s+"r_"+l.toString(32)+"_";return n.memoizedState=s},useHostTransitionStatus:Jh,useFormState:F_,useActionState:F_,useOptimistic:function(n){var s=Tn();s.memoizedState=s.baseState=n;var l={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return s.queue=l,s=ed.bind(null,We,!0,l),l.dispatch=s,[n,s]},useMemoCache:$h,useCacheRefresh:function(){return Tn().memoizedState=dk.bind(null,We)},useEffectEvent:function(n){var s=Tn(),l={impl:n};return s.memoizedState=l,function(){if((mt&2)!==0)throw Error(r(440));return l.impl.apply(void 0,arguments)}}},dv={readContext:mn,use:rc,useCallback:ev,useContext:mn,useEffect:Xh,useImperativeHandle:J_,useInsertionEffect:G_,useLayoutEffect:Q_,useMemo:tv,useReducer:lc,useRef:Y_,useState:function(){return lc(ss)},useDebugValue:Gh,useDeferredValue:function(n,s){var l=Pt();return nv(l,bt.memoizedState,n,s)},useTransition:function(){var n=lc(ss)[0],s=Pt().memoizedState;return[typeof n=="boolean"?n:ga(n),s]},useSyncExternalStore:M_,useId:lv,useHostTransitionStatus:Jh,useFormState:$_,useActionState:$_,useOptimistic:function(n,s){var l=Pt();return z_(l,bt,n,s)},useMemoCache:$h,useCacheRefresh:av,useEffectEvent:X_},mk={readContext:mn,use:rc,useCallback:ev,useContext:mn,useEffect:Xh,useImperativeHandle:J_,useInsertionEffect:G_,useLayoutEffect:Q_,useMemo:tv,useReducer:Kh,useRef:Y_,useState:function(){return Kh(ss)},useDebugValue:Gh,useDeferredValue:function(n,s){var l=Pt();return bt===null?Qh(l,n,s):nv(l,bt.memoizedState,n,s)},useTransition:function(){var n=Kh(ss)[0],s=Pt().memoizedState;return[typeof n=="boolean"?n:ga(n),s]},useSyncExternalStore:M_,useId:lv,useHostTransitionStatus:Jh,useFormState:K_,useActionState:K_,useOptimistic:function(n,s){var l=Pt();return bt!==null?z_(l,bt,n,s):(l.baseState=n,[n,l.queue.dispatch])},useMemoCache:$h,useCacheRefresh:av,useEffectEvent:X_};function td(n,s,l,o){s=n.memoizedState,l=l(o,s),l=l==null?s:O({},s,l),n.memoizedState=l,n.lanes===0&&(n.updateQueue.baseState=l)}var nd={enqueueSetState:function(n,s,l){n=n._reactInternals;var o=Qn(),d=ws(o);d.payload=s,l!=null&&(d.callback=l),s=Cs(n,d,o),s!==null&&(Un(s,n,o),ha(s,n,o))},enqueueReplaceState:function(n,s,l){n=n._reactInternals;var o=Qn(),d=ws(o);d.tag=1,d.payload=s,l!=null&&(d.callback=l),s=Cs(n,d,o),s!==null&&(Un(s,n,o),ha(s,n,o))},enqueueForceUpdate:function(n,s){n=n._reactInternals;var l=Qn(),o=ws(l);o.tag=2,s!=null&&(o.callback=s),s=Cs(n,o,l),s!==null&&(Un(s,n,l),ha(s,n,l))}};function fv(n,s,l,o,d,p,b){return n=n.stateNode,typeof n.shouldComponentUpdate=="function"?n.shouldComponentUpdate(o,p,b):s.prototype&&s.prototype.isPureReactComponent?!ia(l,o)||!ia(d,p):!0}function mv(n,s,l,o){n=s.state,typeof s.componentWillReceiveProps=="function"&&s.componentWillReceiveProps(l,o),typeof s.UNSAFE_componentWillReceiveProps=="function"&&s.UNSAFE_componentWillReceiveProps(l,o),s.state!==n&&nd.enqueueReplaceState(s,s.state,null)}function mr(n,s){var l=s;if("ref"in s){l={};for(var o in s)o!=="ref"&&(l[o]=s[o])}if(n=n.defaultProps){l===s&&(l=O({},l));for(var d in n)l[d]===void 0&&(l[d]=n[d])}return l}function pv(n){Ho(n)}function gv(n){console.error(n)}function _v(n){Ho(n)}function hc(n,s){try{var l=n.onUncaughtError;l(s.value,{componentStack:s.stack})}catch(o){setTimeout(function(){throw o})}}function vv(n,s,l){try{var o=n.onCaughtError;o(l.value,{componentStack:l.stack,errorBoundary:s.tag===1?s.stateNode:null})}catch(d){setTimeout(function(){throw d})}}function id(n,s,l){return l=ws(l),l.tag=3,l.payload={element:null},l.callback=function(){hc(n,s)},l}function yv(n){return n=ws(n),n.tag=3,n}function Sv(n,s,l,o){var d=l.type.getDerivedStateFromError;if(typeof d=="function"){var p=o.value;n.payload=function(){return d(p)},n.callback=function(){vv(s,l,o)}}var b=l.stateNode;b!==null&&typeof b.componentDidCatch=="function"&&(n.callback=function(){vv(s,l,o),typeof d!="function"&&(As===null?As=new Set([this]):As.add(this));var k=o.stack;this.componentDidCatch(o.value,{componentStack:k!==null?k:""})})}function pk(n,s,l,o,d){if(l.flags|=32768,o!==null&&typeof o=="object"&&typeof o.then=="function"){if(s=l.alternate,s!==null&&lr(s,l,d,!0),l=pn.current,l!==null){switch(l.tag){case 31:case 13:case 19:return wn===null?Ac():l.alternate===null&&zt===0&&(zt=3),l.flags&=-257,l.flags|=65536,l.lanes=d,o===Qo?l.flags|=16384:(s=l.updateQueue,s===null?l.updateQueue=new Set([o]):s.add(o),Pd(n,o,d)),!1;case 22:return l.flags|=65536,o===Qo?l.flags|=16384:(s=l.updateQueue,s===null?(s={transitions:null,markerInstances:null,retryQueue:new Set([o])},l.updateQueue=s):(l=s.retryQueue,l===null?s.retryQueue=new Set([o]):l.add(o)),Pd(n,o,d)),!1}throw Error(r(435,l.tag))}return Pd(n,o,d),Ac(),!1}if(et)return s=pn.current,s!==null?((s.flags&65536)===0&&(s.flags|=256),s.flags|=65536,s.lanes=d,o!==wh&&(n=Error(r(422),{cause:o}),la(ri(n,l)))):(o!==wh&&(s=Error(r(423),{cause:o}),la(ri(s,l))),n=n.current.alternate,n.flags|=65536,d&=-d,n.lanes|=d,o=ri(o,l),d=id(n.stateNode,o,d),Rh(n,d),zt!==4&&(zt=2)),!1;var p=Error(r(520),{cause:o});if(p=ri(p,l),ka===null?ka=[p]:ka.push(p),zt!==4&&(zt=2),s===null)return!0;o=ri(o,l),l=s;do{switch(l.tag){case 3:return l.flags|=65536,n=d&-d,l.lanes|=n,n=id(l.stateNode,o,n),Rh(l,n),!1;case 1:if(s=l.type,p=l.stateNode,(l.flags&128)===0&&(typeof s.getDerivedStateFromError=="function"||p!==null&&typeof p.componentDidCatch=="function"&&(As===null||!As.has(p))))return l.flags|=65536,d&=-d,l.lanes|=d,d=yv(d),Sv(d,n,l,o),Rh(l,d),!1;break;case 22:if(l.memoizedState!==null)return l.flags|=65536,!1}l=l.return}while(l!==null);return!1}var sd=Error(r(461)),Kt=!1;function Qt(n,s,l,o){s.child=n===null?C_(s,null,l,o):dr(s,n.child,l,o)}function bv(n,s,l,o,d){l=l.render;var p=s.ref;if("ref"in o){var b={};for(var k in o)k!=="ref"&&(b[k]=o[k])}else b=o;return ar(s),o=Uh(n,s,l,b,p,d),k=Ph(),n!==null&&!Kt?(qh(n,s,d),rs(n,s,d)):(et&&k&&$o(s),s.flags|=1,Qt(n,s,o,d),s.child)}function xv(n,s,l,o,d){if(n===null){var p=l.type;return typeof p=="function"&&!yh(p)&&p.defaultProps===void 0&&l.compare===null?(s.tag=15,s.type=p,wv(n,s,p,o,d)):(n=qo(l.type,null,o,s,s.mode,d),n.ref=s.ref,n.return=s,s.child=n)}if(p=n.child,!dd(n,d)){var b=p.memoizedProps;if(l=l.compare,l=l!==null?l:ia,l(b,o)&&n.ref===s.ref)return rs(n,s,d)}return s.flags|=1,n=Ji(p,o),n.ref=s.ref,n.return=s,s.child=n}function wv(n,s,l,o,d){if(n!==null){var p=n.memoizedProps;if(ia(p,o)&&n.ref===s.ref)if(Kt=!1,s.pendingProps=o=p,dd(n,d))(n.flags&131072)!==0&&(Kt=!0);else return s.lanes=n.lanes,rs(n,s,d)}return rd(n,s,l,o,d)}function Cv(n,s,l,o){var d=o.children,p=n!==null?n.memoizedState:null;if(n===null&&s.stateNode===null&&(s.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),o.mode==="hidden"){if((s.flags&128)!==0){if(p=p!==null?p.baseLanes|l:l,n!==null){for(o=s.child=n.child,d=0;o!==null;)d=d|o.lanes|o.childLanes,o=o.sibling;o=d&~p}else o=0,s.child=null;return kv(n,s,p,l,o)}if((l&536870912)!==0)s.memoizedState={baseLanes:0,cachePool:null},n!==null&&Xo(s,p!==null?p.cachePool:null),p!==null?E_(s,p):Bh(),j_(s);else return o=s.lanes=536870912,kv(n,s,p!==null?p.baseLanes|l:l,l,o)}else p!==null?(Xo(s,p.cachePool),E_(s,p),Es(),s.memoizedState=null):(n!==null&&Xo(s,null),Bh(),Es());return Qt(n,s,d,l),s.child}function va(n,s){return n!==null&&n.tag===22||s.stateNode!==null||(s.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),s.sibling}function kv(n,s,l,o,d){var p=Th();return p=p===null?null:{parent:$t._currentValue,pool:p},s.memoizedState={baseLanes:l,cachePool:p},n!==null&&Xo(s,null),Bh(),j_(s),n!==null&&lr(n,s,o,!0),s.childLanes=d,null}function dc(n,s){return s=fc({mode:s.mode,children:s.children},n.mode),s.ref=n.ref,n.child=s,s.return=n,s}function Nv(n,s,l){return dr(s,n.child,null,l),n=dc(s,s.pendingProps),n.flags|=2,Yn(s),s.memoizedState=null,n}function gk(n,s,l){var o=s.pendingProps,d=(s.flags&128)!==0;if(s.flags&=-129,n===null){if(et){if(o.mode==="hidden")return n=dc(s,o),s.lanes=536870912,n.memoizedState={baseLanes:0,cachePool:null},va(null,n);if(zh(s),(n=Nt)?(n=Zy(n,oi),n=n!==null&&n.data==="&"?n:null,n!==null&&(s.memoizedState={dehydrated:n,treeContext:_s!==null?{id:ji,overflow:Ti}:null,retryLane:536870912,hydrationErrors:null},l=c_(n),l.return=s,s.child=l,sn=s,Nt=null)):n=null,n===null)throw ys(s);return s.lanes=536870912,null}return dc(s,o)}var p=n.memoizedState;if(p!==null){var b=p.dehydrated;if(zh(s),d)if(s.flags&256)s.flags&=-257,s=Nv(n,s,l);else if(s.memoizedState!==null)s.child=n.child,s.flags|=128,s=null;else throw Error(r(558));else if(Kt||lr(n,s,l,!1),d=(l&n.childLanes)!==0,Kt||d){if(ks.current===null){if(o=wt,o!==null&&(b=dg(o,l),b!==0&&b!==p.retryLane))throw p.retryLane=b,nr(n,b),Un(o,n,b),sd;Ac()}s=Nv(n,s,l)}else n=p.treeContext,Nt=ui(b.nextSibling),sn=s,et=!0,vs=null,oi=!1,n!==null&&d_(s,n),s=dc(s,o),s.flags|=134221824;return s}return n=Ji(n.child,{mode:o.mode,children:o.children}),n.ref=s.ref,s.child=n,n.return=s,n}function al(n,s){var l=s.ref;if(l===null)n!==null&&n.ref!==null&&(s.flags|=4194816);else{if(typeof l!="function"&&typeof l!="object")throw Error(r(284));(n===null||n.ref!==l)&&(s.flags|=4194816)}}function rd(n,s,l,o,d){return ar(s),l=Uh(n,s,l,o,void 0,d),o=Ph(),n!==null&&!Kt?(qh(n,s,d),rs(n,s,d)):(et&&o&&$o(s),s.flags|=1,Qt(n,s,l,d),s.child)}function Ev(n,s,l,o,d,p){return ar(s),s.updateQueue=null,l=D_(s,o,l,d),T_(n),o=Ph(),n!==null&&!Kt?(qh(n,s,p),rs(n,s,p)):(et&&o&&$o(s),s.flags|=1,Qt(n,s,l,p),s.child)}function jv(n,s,l,o,d){if(ar(s),s.stateNode===null){var p=Qr,b=l.contextType;typeof b=="object"&&b!==null&&(p=mn(b)),p=new l(o,p),s.memoizedState=p.state!==null&&p.state!==void 0?p.state:null,p.updater=nd,s.stateNode=p,p._reactInternals=s,p=s.stateNode,p.props=o,p.state=s.memoizedState,p.refs={},Mh(s),b=l.contextType,p.context=typeof b=="object"&&b!==null?mn(b):Qr,p.state=s.memoizedState,b=l.getDerivedStateFromProps,typeof b=="function"&&(td(s,l,b,o),p.state=s.memoizedState),typeof l.getDerivedStateFromProps=="function"||typeof p.getSnapshotBeforeUpdate=="function"||typeof p.UNSAFE_componentWillMount!="function"&&typeof p.componentWillMount!="function"||(b=p.state,typeof p.componentWillMount=="function"&&p.componentWillMount(),typeof p.UNSAFE_componentWillMount=="function"&&p.UNSAFE_componentWillMount(),b!==p.state&&nd.enqueueReplaceState(p,p.state,null),fa(s,o,p,d),da(),p.state=s.memoizedState),typeof p.componentDidMount=="function"&&(s.flags|=4194308),o=!0}else if(n===null){p=s.stateNode;var k=s.memoizedProps,B=mr(l,k);p.props=B;var W=p.context,ie=l.contextType;b=Qr,typeof ie=="object"&&ie!==null&&(b=mn(ie));var de=l.getDerivedStateFromProps;ie=typeof de=="function"||typeof p.getSnapshotBeforeUpdate=="function",k=s.pendingProps!==k,ie||typeof p.UNSAFE_componentWillReceiveProps!="function"&&typeof p.componentWillReceiveProps!="function"||(k||W!==b)&&mv(s,p,o,b),xs=!1;var V=s.memoizedState;p.state=V,fa(s,o,p,d),da(),W=s.memoizedState,k||V!==W||xs?(typeof de=="function"&&(td(s,l,de,o),W=s.memoizedState),(B=xs||fv(s,l,B,o,V,W,b))?(ie||typeof p.UNSAFE_componentWillMount!="function"&&typeof p.componentWillMount!="function"||(typeof p.componentWillMount=="function"&&p.componentWillMount(),typeof p.UNSAFE_componentWillMount=="function"&&p.UNSAFE_componentWillMount()),typeof p.componentDidMount=="function"&&(s.flags|=4194308)):(typeof p.componentDidMount=="function"&&(s.flags|=4194308),s.memoizedProps=o,s.memoizedState=W),p.props=o,p.state=W,p.context=b,o=B):(typeof p.componentDidMount=="function"&&(s.flags|=4194308),o=!1)}else{p=s.stateNode,Ah(n,s),b=s.memoizedProps,ie=mr(l,b),p.props=ie,de=s.pendingProps,V=p.context,W=l.contextType,B=Qr,typeof W=="object"&&W!==null&&(B=mn(W)),k=l.getDerivedStateFromProps,(W=typeof k=="function"||typeof p.getSnapshotBeforeUpdate=="function")||typeof p.UNSAFE_componentWillReceiveProps!="function"&&typeof p.componentWillReceiveProps!="function"||(b!==de||V!==B)&&mv(s,p,o,B),xs=!1,V=s.memoizedState,p.state=V,fa(s,o,p,d),da();var ee=s.memoizedState;b!==de||V!==ee||xs||n!==null&&n.dependencies!==null&&Yo(n.dependencies)?(typeof k=="function"&&(td(s,l,k,o),ee=s.memoizedState),(ie=xs||fv(s,l,ie,o,V,ee,B)||n!==null&&n.dependencies!==null&&Yo(n.dependencies))?(W||typeof p.UNSAFE_componentWillUpdate!="function"&&typeof p.componentWillUpdate!="function"||(typeof p.componentWillUpdate=="function"&&p.componentWillUpdate(o,ee,B),typeof p.UNSAFE_componentWillUpdate=="function"&&p.UNSAFE_componentWillUpdate(o,ee,B)),typeof p.componentDidUpdate=="function"&&(s.flags|=4),typeof p.getSnapshotBeforeUpdate=="function"&&(s.flags|=1024)):(typeof p.componentDidUpdate!="function"||b===n.memoizedProps&&V===n.memoizedState||(s.flags|=4),typeof p.getSnapshotBeforeUpdate!="function"||b===n.memoizedProps&&V===n.memoizedState||(s.flags|=1024),s.memoizedProps=o,s.memoizedState=ee),p.props=o,p.state=ee,p.context=B,o=ie):(typeof p.componentDidUpdate!="function"||b===n.memoizedProps&&V===n.memoizedState||(s.flags|=4),typeof p.getSnapshotBeforeUpdate!="function"||b===n.memoizedProps&&V===n.memoizedState||(s.flags|=1024),o=!1)}return p=o,al(n,s),o=(s.flags&128)!==0,p||o?(p=s.stateNode,l=o&&typeof l.getDerivedStateFromError!="function"?null:p.render(),s.flags|=1,n!==null&&o?(s.child=dr(s,n.child,null,d),s.child=dr(s,null,l,d)):Qt(n,s,l,d),s.memoizedState=p.state,n=s.child):n=rs(n,s,d),n}function Tv(n,s,l,o){return sr(),s.flags|=256,Qt(n,s,l,o),s.child}var ld={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function ad(n){return{baseLanes:n,cachePool:v_()}}function od(n,s,l){return n=n!==null?n.childLanes&~l:0,s&&(n|=Gn),n}function Dv(n,s,l){var o=s.pendingProps,d=!1,p=(s.flags&128)!==0,b;if((b=p)||(b=n!==null&&n.memoizedState===null?!1:(gn.current&2)!==0),b&&(d=!0,s.flags&=-129),b=(s.flags&32)!==0,s.flags&=-33,n===null){if(et){if(d?Ns(s):Es(),(n=Nt)?(n=Zy(n,oi),n=n!==null&&n.data!=="&"?n:null,n!==null&&(s.memoizedState={dehydrated:n,treeContext:_s!==null?{id:ji,overflow:Ti}:null,retryLane:536870912,hydrationErrors:null},l=c_(n),l.return=s,s.child=l,sn=s,Nt=null)):n=null,n===null)throw ys(s);return of(n)?s.lanes=32:s.lanes=536870912,null}return p=o.children,o=o.fallback,d?(Es(),d=s.mode,p=fc({mode:"hidden",children:p},d),o=ir(o,d,l,null),p.return=s,o.return=s,p.sibling=o,s.child=p,o=s.child,o.memoizedState=ad(l),o.childLanes=od(n,b,l),s.memoizedState=ld,va(null,o)):(Ns(s),cd(s,p))}var k=n.memoizedState;if(k!==null){var B=k.dehydrated;if(B!==null)return _k(n,s,p,b,o,B,k,l)}return d?(Es(),d=o.fallback,p=s.mode,k=n.child,B=k.sibling,o=Ji(k,{mode:"hidden",children:o.children}),o.subtreeFlags=k.subtreeFlags&1206910976,B!==null?d=Ji(B,d):(d=ir(d,p,l,null),d.flags|=2),d.return=s,o.return=s,o.sibling=d,s.child=o,va(null,o),o=s.child,d=n.child.memoizedState,d===null?d=ad(l):(p=d.cachePool,p!==null?(k=$t._currentValue,p=p.parent!==k?{parent:k,pool:k}:p):p=v_(),d={baseLanes:d.baseLanes|l,cachePool:p}),o.memoizedState=d,o.childLanes=od(n,b,l),s.memoizedState=ld,va(n.child,o)):(Ns(s),l=n.child,n=l.sibling,l=Ji(l,{mode:"visible",children:o.children}),l.return=s,l.sibling=null,n!==null&&(b=s.deletions,b===null?(s.deletions=[n],s.flags|=16):b.push(n)),s.child=l,s.memoizedState=null,l)}function cd(n,s){return s=fc({mode:"visible",children:s},n.mode),s.return=n,n.child=s}function fc(n,s){return n=Ln(22,n,null,s),n.lanes=0,n}function mc(n,s,l){return dr(s,n.child,null,l),n=cd(s,s.pendingProps.children),n.flags|=2,s.memoizedState=null,n}function _k(n,s,l,o,d,p,b,k){if(l)return s.flags&256?(Ns(s),s.flags&=-257,mc(n,s,k)):s.memoizedState!==null?(Es(),s.child=n.child,s.flags|=128,null):(Es(),p=d.fallback,b=s.mode,d=fc({mode:"visible",children:d.children},b),p=ir(p,b,k,null),p.flags|=2,d.return=s,p.return=s,d.sibling=p,s.child=d,dr(s,n.child,null,k),d=s.child,d.memoizedState=ad(k),d.childLanes=od(n,o,k),s.memoizedState=ld,va(null,d));if(Ns(s),of(p)){if(o=p.nextSibling&&p.nextSibling.dataset,o)var B=o.dgst;return o=B,o!==""&&(d=Error(r(419)),d.stack="",d.digest=o,la({value:d,source:null,stack:null})),mc(n,s,k)}if(Kt||lr(n,s,k,!1),o=(k&n.childLanes)!==0,Kt||o){if(ks.current!==null)return mc(n,s,k);if(o=wt,o!==null&&(d=dg(o,k),d!==0&&d!==b.retryLane))throw b.retryLane=d,nr(n,d),Un(o,n,d),sd;return af(p)||Ac(),mc(n,s,k)}return af(p)?(s.flags|=192,s.child=n.child,null):(n=b.treeContext,Nt=ui(p.nextSibling),sn=s,et=!0,vs=null,oi=!1,n!==null&&d_(s,n),s=cd(s,d.children),s.flags|=134221824,s)}function Mv(n,s,l){n.lanes|=s;var o=n.alternate;o!==null&&(o.lanes|=s),Ko(n.return,s,l)}function Av(n){for(var s=null;n!==null;){var l=n.alternate;l!==null&&tc(l)===null&&(s=n),n=n.sibling}return s}function pc(n,s,l,o,d,p){var b=n.memoizedState;b===null?n.memoizedState={isBackwards:s,rendering:null,renderingStartTime:0,last:o,tail:l,tailMode:d,treeForkCount:p}:(b.isBackwards=s,b.rendering=null,b.renderingStartTime=0,b.last=o,b.tail=l,b.tailMode=d,b.treeForkCount=p)}function ud(n){var s=n.child;for(n.child=null;s!==null;){var l=s.sibling;s.sibling=n.child,n.child=s,s=l}}function hd(n,s,l){var o=s.pendingProps,d=o.revealOrder,p=o.tail;o=o.children;var b=gn.current;if(s.flags&128)return ma(s,b),null;var k=(b&2)!==0;if(k?(b=b&1|2,s.flags|=128):b&=1,ma(s,b),d==="backwards"&&n!==null?(ud(n),Qt(n,s,o,l),ud(n)):Qt(n,s,o,l),o=et?ra:0,!k&&n!==null&&(n.flags&128)!==0)e:for(n=s.child;n!==null;){if(n.tag===13)n.memoizedState!==null&&Mv(n,l,s);else if(n.tag===19)Mv(n,l,s);else if(n.child!==null){n.child.return=n,n=n.child;continue}if(n===s)break e;for(;n.sibling===null;){if(n.return===null||n.return===s)break e;n=n.return}n.sibling.return=n.return,n=n.sibling}switch(d){case"backwards":l=Av(s.child),l===null?(d=s.child,s.child=null):(d=l.sibling,l.sibling=null,ud(s)),pc(s,!0,d,null,p,o);break;case"unstable_legacy-backwards":for(l=null,d=s.child,s.child=null;d!==null;){if(n=d.alternate,n!==null&&tc(n)===null){s.child=d;break}n=d.sibling,d.sibling=l,l=d,d=n}pc(s,!0,l,null,p,o);break;case"together":pc(s,!1,null,null,void 0,o);break;case"independent":s.memoizedState=null;break;default:l=Av(s.child),l===null?(d=s.child,s.child=null):(d=l.sibling,l.sibling=null),pc(s,!1,d,l,p,o)}return s.child}function Rv(n,s,l){var o=s.pendingProps;return Ss(s,s.type,o.value),Qt(n,s,o.children,l),s.child}function rs(n,s,l){if(n!==null&&(s.dependencies=n.dependencies),Ms|=s.lanes,(l&s.childLanes)===0)if(n!==null){if(lr(n,s,l,!1),(l&s.childLanes)===0)return null}else return null;if(n!==null&&s.child!==n.child)throw Error(r(153));if(s.child!==null){for(n=s.child,l=Ji(n,n.pendingProps),s.child=l,l.return=s;n.sibling!==null;)n=n.sibling,l=l.sibling=Ji(n,n.pendingProps),l.return=s;l.sibling=null}return s.child}function dd(n,s){return(n.lanes&s)!==0?!0:(n=n.dependencies,!!(n!==null&&Yo(n)))}function vk(n,s,l){switch(s.tag){case 3:Ee(s,s.stateNode.containerInfo),Ss(s,$t,n.memoizedState.cache),sr();break;case 27:case 5:jt(s);break;case 4:Ee(s,s.stateNode.containerInfo);break;case 10:Ss(s,s.type,s.memoizedProps.value);break;case 31:if(s.memoizedState!==null)return s.flags|=128,zh(s),null;break;case 13:var o=s.memoizedState;if(o!==null){if(o.dehydrated!==null)return Ns(s),s.flags|=128,null;o=lr(n,s,l,!1);var d=s.child.childLanes;return o||(l&d)!==0?Dv(n,s,l):(Ns(s),n=rs(n,s,l),n!==null?n.sibling:null)}Ns(s);break;case 19:if(s.flags&128)return hd(n,s,l);if(d=(n.flags&128)!==0,o=(l&s.childLanes)!==0,o||(lr(n,s,l,!1),o=(l&s.childLanes)!==0),d){if(o)return hd(n,s,l);s.flags|=128}if(d=s.memoizedState,d!==null&&(d.rendering=null,d.tail=null,d.lastEffect=null),ma(s,gn.current),o)break;return null;case 22:return s.lanes=0,Cv(n,s,l,s.pendingProps);case 24:Ss(s,$t,n.memoizedState.cache)}return rs(n,s,l)}function Ov(n,s,l){if(n!==null)if(n.memoizedProps!==s.pendingProps)Kt=!0;else{if(!dd(n,l)&&(s.flags&128)===0)return Kt=!1,vk(n,s,l);Kt=(n.flags&131072)!==0}else Kt=!1,et&&(s.flags&1048576)!==0&&h_(s,ra,s.index);switch(s.lanes=0,s.tag){case 16:e:{var o=s.pendingProps;if(n=ur(s.elementType),s.type=n,typeof n=="function")yh(n)?(o=mr(n,o),s.tag=1,s=jv(null,s,n,o,l)):(s.tag=0,s=rd(null,s,n,o,l));else{if(n!=null){var d=n.$$typeof;if(d===q){s.tag=11,s=bv(null,s,n,o,l);break e}else if(d===ge){s.tag=14,s=xv(null,s,n,o,l);break e}else if(d===K){s.tag=10,s.type=n,s=Rv(null,s,l);break e}}throw s=_e(n)||n,Error(r(306,s,""))}}return s;case 0:return rd(n,s,s.type,s.pendingProps,l);case 1:return o=s.type,d=mr(o,s.pendingProps),jv(n,s,o,d,l);case 3:e:{if(Ee(s,s.stateNode.containerInfo),n===null)throw Error(r(387));o=s.pendingProps;var p=s.memoizedState;d=p.element,Ah(n,s),fa(s,o,null,l);var b=s.memoizedState;if(o=b.cache,Ss(s,$t,o),o!==p.cache&&Nh(s,[$t],l,!0),da(),o=b.element,p.isDehydrated)if(p={element:o,isDehydrated:!1,cache:b.cache},s.updateQueue.baseState=p,s.memoizedState=p,s.flags&256){s=Tv(n,s,o,l);break e}else if(o!==d){d=ri(Error(r(424)),s),la(d),s=Tv(n,s,o,l);break e}else for(n=s.stateNode.containerInfo,n.nodeType===9?n=n.body:n=n.nodeName==="HTML"?n.ownerDocument.body:n,Nt=ui(n.firstChild),sn=s,et=!0,vs=null,oi=!0,l=C_(s,null,o,l),s.child=l;l;)l.flags=l.flags&-3|134221824,l=l.sibling;else{if(sr(),o===d){s=rs(n,s,l);break e}Qt(n,s,o,l)}s=s.child}return s;case 26:return al(n,s),n===null?(l=r0(s.type,null,s.pendingProps,null))?s.memoizedState=l:et||(s.stateNode=Hy(s.type,s.pendingProps,Te.current,s)):s.memoizedState=r0(s.type,n.memoizedProps,s.pendingProps,n.memoizedState),null;case 27:return jt(s),n===null&&et&&(o=s.stateNode=t0(s.type,s.pendingProps,Te.current),sn=s,oi=!0,d=Nt,Bs(s.type)?(cf=d,Nt=ui(o.firstChild)):Nt=d),Qt(n,s,s.pendingProps.children,l),al(n,s),n===null&&(s.flags|=4194304),s.child;case 5:return n===null&&et&&((d=o=Nt)&&(o=dN(o,s.type,s.pendingProps,oi),o!==null?(s.stateNode=o,sn=s,Nt=ui(o.firstChild),oi=!1,d=!0):d=!1),d||ys(s)),jt(s),d=s.type,p=s.pendingProps,b=n!==null?n.memoizedProps:null,o=p.children,Jd(d,p)?o=null:b!==null&&Jd(d,b)&&(s.flags|=32),s.memoizedState!==null&&(d=Uh(n,s,ak,null,null,l),kl._currentValue=d),al(n,s),Qt(n,s,o,l),s.child;case 6:return n===null&&et&&((n=l=Nt)&&(l=fN(l,s.pendingProps,oi),l!==null?(s.stateNode=l,sn=s,Nt=null,n=!0):n=!1),n||ys(s)),null;case 13:return Dv(n,s,l);case 4:return Ee(s,s.stateNode.containerInfo),o=s.pendingProps,n===null?s.child=dr(s,null,o,l):Qt(n,s,o,l),s.child;case 11:return bv(n,s,s.type,s.pendingProps,l);case 7:return o=s.pendingProps,al(n,s),Qt(n,s,o,l),s.child;case 8:return Qt(n,s,s.pendingProps.children,l),s.child;case 12:return Qt(n,s,s.pendingProps.children,l),s.child;case 10:return Rv(n,s,l);case 9:return d=s.type._context,o=s.pendingProps.children,ar(s),d=mn(d),o=o(d),s.flags|=1,Qt(n,s,o,l),s.child;case 14:return xv(n,s,s.type,s.pendingProps,l);case 15:return wv(n,s,s.type,s.pendingProps,l);case 19:return hd(n,s,l);case 31:return gk(n,s,l);case 22:return Cv(n,s,l,s.pendingProps);case 24:return ar(s),o=mn($t),n===null?(d=Th(),d===null&&(d=wt,p=Eh(),d.pooledCache=p,p.refCount++,p!==null&&(d.pooledCacheLanes|=l),d=p),s.memoizedState={parent:o,cache:d},Mh(s),Ss(s,$t,d)):((n.lanes&l)!==0&&(Ah(n,s),fa(s,null,null,l),da()),d=n.memoizedState,p=s.memoizedState,d.parent!==o?(d={parent:o,cache:o},s.memoizedState=d,s.lanes===0&&(s.memoizedState=s.updateQueue.baseState=d),Ss(s,$t,o)):(o=p.cache,Ss(s,$t,o),o!==d.cache&&Nh(s,[$t],l,!0))),Qt(n,s,s.pendingProps.children,l),s.child;case 30:return s.stateNode===null&&(s.stateNode={autoName:null,paired:null,clones:null,ref:null}),o=s.pendingProps,o.name!=null&&o.name!=="auto"?s.flags|=n===null?18882560:18874368:et&&$o(s),n!==null&&n.memoizedProps.name!==o.name?s.flags|=4194816:al(n,s),Qt(n,s,o.children,l),s.child;case 29:throw s.pendingProps}throw Error(r(156,s.tag))}function ls(n){n.flags|=4}function fd(n,s,l,o,d){var p;if((p=(n.mode&32)!==0)&&(p=l===null?c0(s,o):c0(s,o)&&(o.src!==l.src||o.srcSet!==l.srcSet)),p){if(n.flags|=16777216,(d&335544128)===d)if(n.stateNode.complete)n.flags|=8192;else if(py())n.flags|=8192;else throw hr=Qo,Dh}else n.flags&=-16777217}function Bv(n,s){if(s.type!=="stylesheet"||(s.state.loading&4)!==0)n.flags&=-16777217;else if(n.flags|=16777216,!u0(s))if(py())n.flags|=8192;else throw hr=Qo,Dh}function gc(n,s){s!==null&&(n.flags|=4),n.flags&16384&&(s=n.tag!==22?cg():536870912,n.lanes|=s,dl|=s)}function ya(n,s){if(!et)switch(n.tailMode){case"visible":break;case"collapsed":for(var l=n.tail,o=null;l!==null;)l.alternate!==null&&(o=l),l=l.sibling;o===null?s||n.tail===null?n.tail=null:n.tail.sibling=null:o.sibling=null;break;default:for(s=n.tail,l=null;s!==null;)s.alternate!==null&&(l=s),s=s.sibling;l===null?n.tail=null:l.sibling=null}}function Et(n){var s=n.alternate!==null&&n.alternate.child===n.child,l=0,o=0;if(s)for(var d=n.child;d!==null;)l|=d.lanes|d.childLanes,o|=d.subtreeFlags&1206910976,o|=d.flags&1206910976,d.return=n,d=d.sibling;else for(d=n.child;d!==null;)l|=d.lanes|d.childLanes,o|=d.subtreeFlags,o|=d.flags,d.return=n,d=d.sibling;return n.subtreeFlags|=o,n.childLanes=l,s}function yk(n,s,l){var o=s.pendingProps;switch(xh(s),s.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Et(s),null;case 1:return Et(s),null;case 3:return l=s.stateNode,o=null,n!==null&&(o=n.memoizedState.cache),s.memoizedState.cache!==o&&(s.flags|=2048),ns($t),Be(),l.pendingContext&&(l.context=l.pendingContext,l.pendingContext=null),(n===null||n.child===null)&&(el(s)?ls(s):n===null||n.memoizedState.isDehydrated&&(s.flags&256)===0||(s.flags|=1024,Ch())),Et(s),null;case 26:var d=s.type,p=s.memoizedState;return n===null?(ls(s),p!==null?(Et(s),Bv(s,p)):(Et(s),fd(s,d,null,o,l))):p?p!==n.memoizedState?(ls(s),Et(s),Bv(s,p)):(Et(s),s.flags&=-16777217):(n=n.memoizedProps,n!==o&&ls(s),Et(s),fd(s,d,n,o,l)),null;case 27:if(Tt(s),l=Te.current,d=s.type,n!==null&&s.stateNode!=null)n.memoizedProps!==o&&ls(s);else{if(!o){if(s.stateNode===null)throw Error(r(166));return Et(s),s.subtreeFlags&=-33554433,null}n=le.current,el(s)?f_(s):(n=t0(d,o,l),s.stateNode=n,ls(s))}return Et(s),s.subtreeFlags&=-33554433,null;case 5:if(Tt(s),d=s.type,n!==null&&s.stateNode!=null)n.memoizedProps!==o&&ls(s);else{if(!o){if(s.stateNode===null)throw Error(r(166));return Et(s),s.subtreeFlags&=-33554433,null}if(p=le.current,el(s))f_(s);else{var b=Da(Te.current);switch(p){case 1:p=b.createElementNS("http://www.w3.org/2000/svg",d);break;case 2:p=b.createElementNS("http://www.w3.org/1998/Math/MathML",d);break;default:switch(d){case"svg":p=b.createElementNS("http://www.w3.org/2000/svg",d);break;case"math":p=b.createElementNS("http://www.w3.org/1998/Math/MathML",d);break;case"script":p=b.createElement("div"),p.innerHTML="<script><\/script>",p=p.removeChild(p.firstChild);break;case"select":p=typeof o.is=="string"?b.createElement("select",{is:o.is}):b.createElement("select"),o.multiple?p.multiple=!0:o.size&&(p.size=o.size);break;default:p=typeof o.is=="string"?b.createElement(d,{is:o.is}):b.createElement(d)}}p[fn]=s,p[Bn]=o;e:for(b=s.child;b!==null;){if(b.tag===5||b.tag===6)p.appendChild(b.stateNode);else if(b.tag!==4&&b.tag!==27&&b.child!==null){b.child.return=b,b=b.child;continue}if(b===s)break e;for(;b.sibling===null;){if(b.return===null||b.return===s)break e;b=b.return}b.sibling.return=b.return,b=b.sibling}s.stateNode=p;e:switch(vn(p,d,o),d){case"button":case"input":case"select":case"textarea":o=!!o.autoFocus;break e;case"img":o=!0;break e;default:o=!1}o&&ls(s)}}return Et(s),s.subtreeFlags&=-33554433,fd(s,s.type,n===null?null:n.memoizedProps,s.pendingProps,l),null;case 6:if(n&&s.stateNode!=null)n.memoizedProps!==o&&ls(s);else{if(typeof o!="string"&&s.stateNode===null)throw Error(r(166));if(n=Te.current,el(s)){if(n=s.stateNode,l=s.memoizedProps,o=null,d=sn,d!==null)switch(d.tag){case 27:case 5:o=d.memoizedProps}n[fn]=s,n=!!(n.nodeValue===l||o!==null&&o.suppressHydrationWarning===!0||Oy(n.nodeValue,l)),n||ys(s,!0)}else n=Da(n).createTextNode(o),n[fn]=s,s.stateNode=n}return Et(s),null;case 31:if(l=s.memoizedState,n===null||n.memoizedState!==null){if(o=el(s),l!==null){if(n===null){if(!o)throw Error(r(318));if(n=s.memoizedState,n=n!==null?n.dehydrated:null,!n)throw Error(r(557));n[fn]=s}else sr(),(s.flags&128)===0&&(s.memoizedState=null),s.flags|=4;Et(s),n=!1}else l=Ch(),n!==null&&n.memoizedState!==null&&(n.memoizedState.hydrationErrors=l),n=!0;if(!n)return s.flags&256?(Yn(s),s):(Yn(s),null);if((s.flags&128)!==0)throw Error(r(558))}return Et(s),null;case 13:if(o=s.memoizedState,n===null||n.memoizedState!==null&&n.memoizedState.dehydrated!==null){if(d=el(s),o!==null&&o.dehydrated!==null){if(n===null){if(!d)throw Error(r(318));if(d=s.memoizedState,d=d!==null?d.dehydrated:null,!d)throw Error(r(317));d[fn]=s}else sr(),(s.flags&128)===0&&(s.memoizedState=null),s.flags|=4;Et(s),d=!1}else d=Ch(),n!==null&&n.memoizedState!==null&&(n.memoizedState.hydrationErrors=d),d=!0;if(!d)return s.flags&256?(Yn(s),s):(Yn(s),null)}return Yn(s),(s.flags&128)!==0?(s.lanes=l,s):(l=o!==null,n=n!==null&&n.memoizedState!==null,l&&(o=s.child,d=null,o.alternate!==null&&o.alternate.memoizedState!==null&&o.alternate.memoizedState.cachePool!==null&&(d=o.alternate.memoizedState.cachePool.pool),p=null,o.memoizedState!==null&&o.memoizedState.cachePool!==null&&(p=o.memoizedState.cachePool.pool),p!==d&&(o.flags|=2048)),l!==n&&l&&(s.child.flags|=8192),gc(s,s.updateQueue),Et(s),null);case 4:return Be(),n===null&&Wd(s.stateNode.containerInfo),s.flags|=67108864,Et(s),null;case 10:return ns(s.type),Et(s),null;case 19:if(Hh(s),o=s.memoizedState,o===null)return Et(s),null;if(d=(s.flags&128)!==0,p=o.rendering,p===null)if(d)ya(o,!1);else{if(zt!==0||n!==null&&(n.flags&128)!==0)for(n=s.child;n!==null;){if(p=tc(n),p!==null){for(s.flags|=128,ya(o,!1),n=p.updateQueue,s.updateQueue=n,gc(s,n),s.subtreeFlags=0,n=l,l=s.child;l!==null;)o_(l,n),l=l.sibling;return ma(s,gn.current&1|2),et&&es(s,o.treeForkCount),s.child}n=n.sibling}o.tail!==null&&Ft()>jc&&(s.flags|=128,d=!0,ya(o,!1),s.lanes=4194304)}else{if(!d)if(n=tc(p),n!==null){if(s.flags|=128,d=!0,n=n.updateQueue,s.updateQueue=n,gc(s,n),ya(o,!0),o.tail===null&&o.tailMode!=="collapsed"&&o.tailMode!=="visible"&&!p.alternate&&!et)return Et(s),null}else 2*Ft()-o.renderingStartTime>jc&&l!==536870912&&(s.flags|=128,d=!0,ya(o,!1),s.lanes=4194304);o.isBackwards?(p.sibling=s.child,s.child=p):(n=o.last,n!==null?n.sibling=p:s.child=p,o.last=p)}if(o.tail!==null){n=o.tail;e:{for(l=n;l!==null;){if(l.alternate!==null){l=!1;break e}l=l.sibling}l=!0}return o.rendering=n,o.tail=n.sibling,o.renderingStartTime=Ft(),n.sibling=null,p=gn.current,p=d?p&1|2:p&1,o.tailMode==="visible"||o.tailMode==="collapsed"||!l||et?ma(s,p):(l=p,qe(pn,s),qe(gn,l),wn===null&&(wn=s)),et&&es(s,o.treeForkCount),n}return Et(s),null;case 22:case 23:return Yn(s),Lh(),o=s.memoizedState!==null,n!==null?n.memoizedState!==null!==o&&(s.flags|=8192):o&&(s.flags|=8192),o?(l&536870912)!==0&&(s.flags&128)===0&&(Et(s),s.subtreeFlags&6&&(s.flags|=8192)):Et(s),l=s.updateQueue,l!==null&&gc(s,l.retryQueue),l=null,n!==null&&n.memoizedState!==null&&n.memoizedState.cachePool!==null&&(l=n.memoizedState.cachePool.pool),o=null,s.memoizedState!==null&&s.memoizedState.cachePool!==null&&(o=s.memoizedState.cachePool.pool),o!==l&&(s.flags|=2048),n!==null&&Ke(cr),null;case 24:return l=null,n!==null&&(l=n.memoizedState.cache),s.memoizedState.cache!==l&&(s.flags|=2048),ns($t),Et(s),null;case 25:return null;case 30:return s.flags|=33554432,Et(s),null}throw Error(r(156,s.tag))}function Sk(n,s){switch(xh(s),s.tag){case 1:return n=s.flags,n&65536?(s.flags=n&-65537|128,s):null;case 3:return ns($t),Be(),n=s.flags,(n&65536)!==0&&(n&128)===0?(s.flags=n&-65537|128,s):null;case 26:case 27:case 5:return Tt(s),null;case 31:if(s.memoizedState!==null){if(Yn(s),s.alternate===null)throw Error(r(340));sr()}return n=s.flags,n&65536?(s.flags=n&-65537|128,s):null;case 13:if(Yn(s),n=s.memoizedState,n!==null&&n.dehydrated!==null){if(s.alternate===null)throw Error(r(340));sr()}return n=s.flags,n&65536?(s.flags=n&-65537|128,s):null;case 19:return Hh(s),n=s.flags,n&65536?(s.flags=n&-65537|128,n=s.memoizedState,n!==null&&(n.rendering=null,n.tail=null),s.flags|=4,s):null;case 4:return Be(),null;case 10:return ns(s.type),null;case 22:case 23:return Yn(s),Lh(),n!==null&&Ke(cr),n=s.flags,n&65536?(s.flags=n&-65537|128,s):null;case 24:return ns($t),null;case 25:return null;default:return null}}function Lv(n,s){switch(xh(s),s.tag){case 3:ns($t),Be();break;case 26:case 27:case 5:Tt(s);break;case 4:Be();break;case 31:s.memoizedState!==null&&Yn(s);break;case 13:Yn(s);break;case 19:Hh(s);break;case 10:ns(s.type);break;case 22:case 23:Yn(s),Lh(),n!==null&&Ke(cr);break;case 24:ns($t)}}function Sa(n,s){try{var l=s.updateQueue,o=l!==null?l.lastEffect:null;if(o!==null){var d=o.next;l=d;do{if((l.tag&n)===n){o=void 0;var p=l.create,b=l.inst;o=p(),b.destroy=o}l=l.next}while(l!==d)}}catch(k){yt(s,s.return,k)}}function js(n,s,l){try{var o=s.updateQueue,d=o!==null?o.lastEffect:null;if(d!==null){var p=d.next;o=p;do{if((o.tag&n)===n){var b=o.inst,k=b.destroy;if(k!==void 0){b.destroy=void 0,d=s;var B=l,W=k;try{W()}catch(ie){yt(d,B,ie)}}}o=o.next}while(o!==p)}}catch(ie){yt(s,s.return,ie)}}function zv(n){var s=n.updateQueue;if(s!==null){var l=n.stateNode;try{N_(s,l)}catch(o){yt(n,n.return,o)}}}function Hv(n,s,l){l.props=mr(n.type,n.memoizedProps),l.state=n.memoizedState;try{l.componentWillUnmount()}catch(o){yt(n,s,o)}}function Di(n,s){try{var l=n.ref;if(l!==null){switch(n.tag){case 26:case 27:case 5:var o=n.stateNode;break;case 30:var d=n.stateNode,p=Qi(n.memoizedProps,d);(d.ref===null||d.ref.name!==p)&&(d.ref=Vy(p)),o=d.ref;break;case 7:if(n.stateNode===null){var b=new Zn(n);_(n.child,!1,uN,b,void 0,void 0),n.stateNode=b}o=n.stateNode;break;default:o=n.stateNode}typeof l=="function"?n.refCleanup=l(o):l.current=o}}catch(k){yt(n,s,k)}}function _n(n,s){var l=n.ref,o=n.refCleanup;if(l!==null)if(typeof o=="function")try{o()}catch(d){yt(n,s,d)}finally{n.refCleanup=null,n=n.alternate,n!=null&&(n.refCleanup=null)}else if(typeof l=="function")try{l(null)}catch(d){yt(n,s,d)}else l.current=null}function _c(n,s){if((n.tag===5||n.tag===27||n.tag===6)&&n.alternate===null&&s!==null)for(var l=0;l<s.length;l++)Qy(n.stateNode,s[l])}function Iv(n){for(var s=n.return;s!==null&&(pd(s)&&Qy(n.stateNode,s.stateNode),!md(s));)s=s.return}function ba(n){for(var s=n.return;s!==null&&(pd(s)&&hN(n.stateNode,s.stateNode),!md(s));)s=s.return}function md(n){return n.tag===5||n.tag===3||n.tag===27}function pd(n){return n&&n.tag===7&&n.stateNode!==null}function gd(n){var s=n.type,l=n.memoizedProps,o=n.stateNode;try{e:switch(s){case"button":case"input":case"select":case"textarea":l.autoFocus&&o.focus();break e;case"img":l.src?o.src=l.src:l.srcSet&&(o.srcset=l.srcSet)}}catch(d){yt(n,n.return,d)}}function _d(n,s,l){try{var o=n.stateNode;Kk(o,n.type,l,s),o[Bn]=s}catch(d){yt(n,n.return,d)}}function Uv(n){return n.tag===5||n.tag===3||n.tag===26||n.tag===27&&Bs(n.type)||n.tag===4}function vd(n){e:for(;;){for(;n.sibling===null;){if(n.return===null||Uv(n.return))return null;n=n.return}for(n.sibling.return=n.return,n=n.sibling;n.tag!==5&&n.tag!==6&&n.tag!==18;){if(n.tag===27&&Bs(n.type)||n.flags&2||n.child===null||n.tag===4)continue e;n.child.return=n,n=n.child}if(!(n.flags&2))return n.stateNode}}function yd(n,s,l,o){var d=n.tag;if(d===5||d===6)d=n.stateNode,s?(l.nodeType===9?l.body:l.nodeName==="HTML"?l.ownerDocument.body:l).insertBefore(d,s):(s=l.nodeType===9?l.body:l.nodeName==="HTML"?l.ownerDocument.body:l,s.appendChild(d),l=l._reactRootContainer,l!=null||s.onclick!==null||(s.onclick=Ei)),_c(n,o),dt=!0;else if(d!==4&&(d===27&&(_c(n,o),o=null,Bs(n.type)&&(l=n.stateNode,s=null)),n=n.child,n!==null))for(yd(n,s,l,o),n=n.sibling;n!==null;)yd(n,s,l,o),n=n.sibling}function vc(n,s,l,o){var d=n.tag;if(d===5||d===6)d=n.stateNode,s?l.insertBefore(d,s):l.appendChild(d),_c(n,o),dt=!0;else if(d!==4&&(d===27&&(_c(n,o),o=null,Bs(n.type)&&(l=n.stateNode)),n=n.child,n!==null))for(vc(n,s,l,o),n=n.sibling;n!==null;)vc(n,s,l,o),n=n.sibling}function Pv(n){var s=n.stateNode,l=n.memoizedProps;try{for(var o=n.type,d=s.attributes;d.length;)s.removeAttributeNode(d[0]);vn(s,o,l),s[fn]=n,s[Bn]=l}catch(p){yt(n,n.return,p)}}var yc=!1,Wn=null;function qv(n){(n.tag===30||(n.subtreeFlags&33554432)!==0)&&(yc=!0)}var Mi=null;function Fv(){var n=Mi;return Mi=null,n}var zn=0;function ol(n,s,l,o,d){return zn=0,$v(n.child,s,l,o,d)}function $v(n,s,l,o,d){for(var p=!1;n!==null;){if(n.tag===5){var b=n.stateNode;if(o!==null){var k=nf(b);o.push(k),k.view&&(p=!0)}else p||nf(b).view&&(p=!0);yc=!0,Fy(b,zn===0?s:s+"_"+zn,l),zn++}else(n.tag!==22||n.memoizedState===null)&&(n.tag===30&&d||$v(n.child,s,l,o,d)&&(p=!0));n=n.sibling}return p}function Ai(n,s){for(;n!==null;)n.tag===5?$y(n.stateNode,n.memoizedProps):(n.tag!==22||n.memoizedState===null)&&(n.tag===30&&s||Ai(n.child,s)),n=n.sibling}function Sc(n){if((n.subtreeFlags&18874368)!==0)for(n=n.child;n!==null;){if((n.tag!==22||n.memoizedState===null)&&(Sc(n),n.tag===30&&(n.flags&18874368)!==0&&n.stateNode.paired)){var s=n.memoizedProps;if(s.name==null||s.name==="auto")throw Error(r(544));var l=s.name;s=Zi(s.default,s.share),s!=="none"&&(ol(n,l,s,null,!1)||Ai(n.child,!1))}n=n.sibling}}function Sd(n,s){if(n.tag===30){var l=n.stateNode,o=n.memoizedProps,d=Qi(o,l),p=Zi(o.default,l.paired?o.share:o.enter);p!=="none"?ol(n,d,p,null,!1)?(Sc(n),l.paired||s||gl(n,o.onEnter)):Ai(n.child,!1):Sc(n)}else if((n.subtreeFlags&33554432)!==0)for(n=n.child;n!==null;)Sd(n,s),n=n.sibling;else Sc(n)}function bd(n){if(Wn!==null&&Wn.size!==0){var s=Wn;if((n.subtreeFlags&18874368)!==0)for(n=n.child;n!==null;){if(n.tag!==22||n.memoizedState===null){if(n.tag===30&&(n.flags&18874368)!==0){var l=n.memoizedProps,o=l.name;if(o!=null&&o!=="auto"){var d=s.get(o);if(d!==void 0){var p=Zi(l.default,l.share);if(p!=="none"&&(ol(n,o,p,null,!1)?(p=n.stateNode,d.paired=p,p.paired=d,gl(n,l.onShare)):Ai(n.child,!1)),s.delete(o),s.size===0)break}}}bd(n)}n=n.sibling}}}function xd(n){if(n.tag===30){var s=n.memoizedProps,l=Qi(s,n.stateNode),o=Wn!==null?Wn.get(l):void 0,d=Zi(s.default,o!==void 0?s.share:s.exit);d!=="none"&&(ol(n,l,d,null,!1)?o!==void 0?(d=n.stateNode,o.paired=d,d.paired=o,Wn.delete(l),gl(n,s.onShare)):gl(n,s.onExit):Ai(n.child,!1)),Wn!==null&&bd(n)}else if((n.subtreeFlags&33554432)!==0)for(n=n.child;n!==null;)xd(n),n=n.sibling;else Wn!==null&&bd(n)}function Vv(n){for(n=n.child;n!==null;){if(n.tag===30){var s=n.memoizedProps,l=Qi(s,n.stateNode);s=Zi(s.default,s.update),n.flags&=-5,s!=="none"&&ol(n,l,s,n.memoizedState=[],!1)}else(n.subtreeFlags&33554432)!==0&&Vv(n);n=n.sibling}}function wd(n){if((n.subtreeFlags&18874368)!==0)for(n=n.child;n!==null;){if(n.tag!==22||n.memoizedState===null){if(n.tag===30&&(n.flags&18874368)!==0){var s=n.stateNode;s.paired!==null&&(s.paired=null,Ai(n.child,!1))}wd(n)}n=n.sibling}}function bc(n){if(n.tag===30)n.stateNode.paired=null,Ai(n.child,!1),wd(n);else if((n.subtreeFlags&33554432)!==0)for(n=n.child;n!==null;)bc(n),n=n.sibling;else wd(n)}function Kv(n){for(n=n.child;n!==null;)n.tag===30?Ai(n.child,!1):(n.subtreeFlags&33554432)!==0&&Kv(n),n=n.sibling}function Cd(n,s,l,o,d,p,b){for(var k=!1;s!==null;){if(s.tag===5){var B=s.stateNode;if(p!==null&&zn<p.length){var W=p[zn],ie=nf(B);(W.view||ie.view)&&(k=!0);var de;if(de=(n.flags&4)===0)if(ie.clip)de=!0;else{de=W.rect;var V=ie.rect;de=de.y!==V.y||de.x!==V.x||de.height!==V.height||de.width!==V.width}de&&(n.flags|=4),ie.abs?ie=!W.abs:(W=W.rect,ie=ie.rect,ie=W.height!==ie.height||W.width!==ie.width),ie&&(n.flags|=32)}else n.flags|=32;(n.flags&4)!==0&&Fy(B,zn===0?l:l+"_"+zn,d),k&&(n.flags&4)!==0||(Mi===null&&(Mi=[]),Mi.push(B,zn===0?o:o+"_"+zn,s.memoizedProps)),zn++}else(s.tag!==22||s.memoizedState===null)&&(s.tag===30&&b?n.flags|=s.flags&32:Cd(n,s.child,l,o,d,p,b)&&(k=!0));s=s.sibling}return k}function Yv(n,s){for(n=n.child;n!==null;){if(n.tag===30){var l=n.memoizedProps,o=n.stateNode,d=Qi(l,o),p=Zi(l.default,l.update),b;b=n.memoizedState,n.memoizedState=null,o=n;var k=n.child;zn=0,d=Cd(o,k,d,d,p,b,!1),(n.flags&4)!==0&&d&&gl(n,l.onUpdate)}else(n.subtreeFlags&33554432)!==0&&Yv(n);n=n.sibling}}var rn=!1,_t=!1,Ri=!1,kd=!1,Wv=typeof WeakSet=="function"?WeakSet:Set,ln=null,Oi=!1,xa=!1,xc=!1,Nd=!1;function bk(n,s,l){if(n=n.containerInfo,Qd=Nl,n=Zg(n),dh(n)){if("selectionStart"in n)var o={start:n.selectionStart,end:n.selectionEnd};else e:{o=(o=n.ownerDocument)&&o.defaultView||window;var d=o.getSelection&&o.getSelection();if(d&&d.rangeCount!==0){o=d.anchorNode;var p=d.anchorOffset,b=d.focusNode;d=d.focusOffset;try{o.nodeType,b.nodeType}catch{o=null;break e}var k=0,B=-1,W=-1,ie=0,de=0,V=n,ee=null;t:for(;;){for(var je;V!==o||p!==0&&V.nodeType!==3||(B=k+p),V!==b||d!==0&&V.nodeType!==3||(W=k+d),V.nodeType===3&&(k+=V.nodeValue.length),(je=V.firstChild)!==null;)ee=V,V=je;for(;;){if(V===n)break t;if(ee===o&&++ie===p&&(B=k),ee===b&&++de===d&&(W=k),(je=V.nextSibling)!==null)break;V=ee,ee=V.parentNode}V=je}o=B===-1||W===-1?null:{start:B,end:W}}else o=null}o=o||{start:0,end:0}}else o=null;for(Zd={focusedElem:n,selectionRange:o},Nl=!1,l=(l&335544064)===l,ln=s,s=l?9270:1024;ln!==null;){if(n=ln,l&&(o=n.deletions,o!==null))for(p=0;p<o.length;p++)l&&xd(o[p]);if(n.alternate===null&&(n.flags&2)!==0)l&&qv(n),wc(l);else{if(n.tag===22){if(o=n.alternate,n.memoizedState!==null){o!==null&&o.memoizedState===null&&l&&xd(o),wc(l);continue}else if(o!==null&&o.memoizedState!==null){l&&qv(n),wc(l);continue}}o=n.child,(n.subtreeFlags&s)!==0&&o!==null?(o.return=n,ln=o):(l&&Vv(n),wc(l))}}Wn=null}function wc(n){for(;ln!==null;){var s=ln,l=n,o=s.alternate,d=s.flags;switch(s.tag){case 0:case 11:case 15:break;case 1:if((d&1024)!==0&&o!==null){l=void 0,d=o.memoizedProps,o=o.memoizedState;var p=s.stateNode;try{var b=mr(s.type,d);l=p.getSnapshotBeforeUpdate(b,o),p.__reactInternalSnapshotBeforeUpdate=l}catch(k){yt(s,s.return,k)}}break;case 3:if((d&1024)!==0){if(o=s.stateNode.containerInfo,l=o.nodeType,l===9)lf(o);else if(l===1)switch(o.nodeName){case"HEAD":case"HTML":case"BODY":lf(o);break;default:o.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;case 30:l&&o!==null&&(l=Qi(o.memoizedProps,o.stateNode),d=s.memoizedProps,d=Zi(d.default,d.update),d!=="none"&&ol(o,l,d,o.memoizedState=[],!0));break;default:if((d&1024)!==0)throw Error(r(163))}if(o=s.sibling,o!==null){o.return=s.return,ln=o;break}ln=s.return}}function Xv(n,s,l){var o=l.flags;switch(l.tag){case 0:case 11:case 15:Bi(n,l),o&4&&Sa(5,l);break;case 1:if(Bi(n,l),o&4)if(n=l.stateNode,s===null)try{n.componentDidMount()}catch(b){yt(l,l.return,b)}else{var d=mr(l.type,s.memoizedProps);s=s.memoizedState;try{n.componentDidUpdate(d,s,n.__reactInternalSnapshotBeforeUpdate)}catch(b){yt(l,l.return,b)}}o&64&&zv(l),o&512&&Di(l,l.return);break;case 3:if(Bi(n,l),o&64&&(n=l.updateQueue,n!==null)){if(s=null,l.child!==null)switch(l.child.tag){case 27:case 5:s=l.child.stateNode;break;case 1:s=l.child.stateNode}try{N_(n,s)}catch(b){yt(l,l.return,b)}}break;case 27:s===null&&o&4&&Pv(l);case 26:case 5:Bi(n,l),s===null&&o&4&&gd(l),o&512&&Di(l,l.return);break;case 12:Bi(n,l);break;case 31:Bi(n,l),o&4&&Jv(n,l);break;case 13:Bi(n,l),o&4&&ey(n,l),o&64&&(n=l.memoizedState,n!==null&&(n=n.dehydrated,n!==null&&(l=Rk.bind(null,l),mN(n,l))));break;case 22:if(o=l.memoizedState!==null||rn,!o){var p=s!==null&&s.memoizedState!==null||_t;s=rn,d=_t,rn=o,(_t=p)&&!d?(o=2,(l.subtreeFlags&8772)!==0&&(o|=1),bi(n,l,o)):Bi(n,l),rn=s,_t=d}break;case 30:Bi(n,l),o&512&&Di(l,l.return);break;case 7:o&512&&Di(l,l.return);default:Bi(n,l)}}function Ed(n,s){for(n=n.child;n!==null;)Gv(n,s),n=n.sibling}function Gv(n,s){switch(n.tag){case 5:case 26:try{var l=n.stateNode;if(s){var o=l.style;typeof o.setProperty=="function"?o.setProperty("display","none","important"):o.display="none"}else{var d=n.stateNode,p=n.memoizedProps.style,b=p!=null&&p.hasOwnProperty("display")?p.display:null;d.style.display=b==null||typeof b=="boolean"?"":(""+b).trim()}}catch(B){yt(n,n.return,B)}jd(n,s);break;case 6:try{n.stateNode.nodeValue=s?"":n.memoizedProps,dt=!0}catch(B){yt(n,n.return,B)}break;case 18:try{var k=n.stateNode;s?qy(k,!0):qy(n.stateNode,!1)}catch(B){yt(n,n.return,B)}break;case 22:case 23:n.memoizedState===null&&Ed(n,s);break;default:Ed(n,s)}}function jd(n,s){if(n.subtreeFlags&67108864)for(n=n.child;n!==null;){e:{var l=n,o=s;switch(l.tag){case 4:Gv(l,o);break e;case 22:l.memoizedState===null&&jd(l,o);break e;default:jd(l,o)}}n=n.sibling}}function Qv(n){var s=n.alternate;s!==null&&(n.alternate=null,Qv(s)),n.child=null,n.deletions=null,n.sibling=null,n.tag===5&&(s=n.stateNode,s!==null&&jo(s)),n.stateNode=null,n.return=null,n.dependencies=null,n.memoizedProps=null,n.memoizedState=null,n.pendingProps=null,n.stateNode=null,n.updateQueue=null}var Mt=null,Hn=!1;function yi(n,s,l){for(l=l.child;l!==null;)Zv(n,s,l),l=l.sibling}function Zv(n,s,l){if(Ue&&typeof Ue.onCommitFiberUnmount=="function")try{Ue.onCommitFiberUnmount(En,l)}catch{}switch(l.tag){case 26:_t||_n(l,s),yi(n,s,l),l.memoizedState?l.memoizedState.count--:l.stateNode&&!_t&&(l=l.stateNode,l.parentNode.removeChild(l));break;case 27:_t||_n(l,s),ba(l);var o=Mt,d=Hn;Bs(l.type)&&(Mt=l.stateNode,Hn=!1),yi(n,s,l),n0(l.stateNode,l.type,l.memoizedProps),Mt=o,Hn=d;break;case 5:_t||_n(l,s),ba(l);case 6:if(l.tag===6&&ba(l),o=Mt,d=Hn,Mt=null,yi(n,s,l),Mt=o,Hn=d,Mt!==null)if(Hn)try{(Mt.nodeType===9?Mt.body:Mt.nodeName==="HTML"?Mt.ownerDocument.body:Mt).removeChild(l.stateNode),dt=!0}catch(p){yt(l,s,p)}else try{Mt.removeChild(l.stateNode),dt=!0}catch(p){yt(l,s,p)}break;case 18:Mt!==null&&(Hn?(n=Mt,Py(n.nodeType===9?n.body:n.nodeName==="HTML"?n.ownerDocument.body:n,l.stateNode),El(n)):Py(Mt,l.stateNode));break;case 4:o=Mt,d=Hn,Mt=l.stateNode.containerInfo,Hn=!0,yi(n,s,l),Mt=o,Hn=d;break;case 0:case 11:case 14:case 15:js(2,l,s),_t||js(4,l,s),yi(n,s,l);break;case 1:_t||(_n(l,s),o=l.stateNode,typeof o.componentWillUnmount=="function"&&Hv(l,s,o)),yi(n,s,l);break;case 21:yi(n,s,l);break;case 22:_t=(o=_t)||l.memoizedState!==null,yi(n,s,l),_t=o;break;case 30:_n(l,s),yi(n,s,l);break;case 7:_t||_n(l,s),yi(n,s,l);break;default:yi(n,s,l)}}function Jv(n,s){if(s.memoizedState===null&&(n=s.alternate,n!==null&&(n=n.memoizedState,n!==null))){n=n.dehydrated;try{El(n)}catch(l){yt(s,s.return,l)}}}function ey(n,s){if(s.memoizedState===null&&(n=s.alternate,n!==null&&(n=n.memoizedState,n!==null&&(n=n.dehydrated,n!==null))))try{El(n)}catch(l){yt(s,s.return,l)}}function xk(n){switch(n.tag){case 31:case 13:case 19:var s=n.stateNode;return s===null&&(s=n.stateNode=new Wv),s;case 22:return n=n.stateNode,s=n._retryCache,s===null&&(s=n._retryCache=new Wv),s;default:throw Error(r(435,n.tag))}}function Cc(n,s){var l=xk(n);s.forEach(function(o){if(!l.has(o)){l.add(o);var d=Ok.bind(null,n,o);o.then(d,d)}})}function Dn(n,s,l){var o=s.deletions;if(o!==null)for(var d=0;d<o.length;d++){var p=o[d],b=n,k=s,B=k;e:for(;B!==null;){switch(B.tag){case 27:if(Bs(B.type)){Mt=B.stateNode,Hn=!1;break e}break;case 5:Mt=B.stateNode,Hn=!1;break e;case 3:case 4:Mt=B.stateNode.containerInfo,Hn=!0;break e}B=B.return}if(Mt===null)throw Error(r(160));Zv(b,k,p),Mt=null,Hn=!1,b=p.alternate,b!==null&&(b.return=null),p.return=null}if(s.subtreeFlags&13886)for(s=s.child;s!==null;)ty(s,n,l),s=s.sibling}var Si=null;function ty(n,s,l){var o=n.alternate,d=n.flags;switch(n.tag){case 0:case 11:case 14:case 15:if(d&4&&(o=n.updateQueue,o=o!==null?o.events:null,o!==null))for(var p=0;p<o.length;p++){var b=o[p];b.ref.impl=b.nextImpl}Dn(s,n,l),Mn(n),d&4&&(js(3,n,n.return),Sa(3,n),js(5,n,n.return));break;case 1:Dn(s,n,l),Mn(n),d&512&&(_t||o===null||_n(o,o.return)),d&64&&rn&&(n=n.updateQueue,n!==null&&(s=n.callbacks,s!==null&&(l=n.shared.hiddenCallbacks,n.shared.hiddenCallbacks=l===null?s:l.concat(s))));break;case 26:if(p=Si,Dn(s,n,l),Mn(n),d&512&&(_t||o===null||_n(o,o.return)),d&4)if(d=o!==null?o.memoizedState:null,l=n.memoizedState,o===null)if(l===null)if(n.stateNode===null)if(rn)n.stateNode=Hy(n.type,n.memoizedProps,s.containerInfo,n);else{e:{s=n.type,l=n.memoizedProps,d=p.ownerDocument||p;t:switch(s){case"title":o=d.getElementsByTagName("title")[0],(!o||o[Wl]||o[fn]||o.namespaceURI==="http://www.w3.org/2000/svg"||o.hasAttribute("itemprop"))&&(o=d.createElement(s),d.head.insertBefore(o,d.querySelector("head > title"))),vn(o,s,l),o[fn]=n,nn(o),s=o;break e;case"link":if(p=o0("link","href",d).get(s+(l.href||""))){for(b=0;b<p.length;b++)if(o=p[b],o.getAttribute("href")===(l.href==null||l.href===""?null:l.href)&&o.getAttribute("rel")===(l.rel==null?null:l.rel)&&o.getAttribute("title")===(l.title==null?null:l.title)&&o.getAttribute("crossorigin")===(l.crossOrigin==null?null:l.crossOrigin)){p.splice(b,1);break t}}o=d.createElement(s),vn(o,s,l),d.head.appendChild(o);break;case"meta":if(p=o0("meta","content",d).get(s+(l.content||""))){for(b=0;b<p.length;b++)if(o=p[b],o.getAttribute("content")===(l.content==null?null:""+l.content)&&o.getAttribute("name")===(l.name==null?null:l.name)&&o.getAttribute("property")===(l.property==null?null:l.property)&&o.getAttribute("http-equiv")===(l.httpEquiv==null?null:l.httpEquiv)&&o.getAttribute("charset")===(l.charSet==null?null:l.charSet)){p.splice(b,1);break t}}o=d.createElement(s),vn(o,s,l),d.head.appendChild(o);break;default:throw Error(r(468,s))}o[fn]=n,nn(o),s=o}n.stateNode=s}else rn||ff(p,n.type,n.stateNode);else n.stateNode=a0(p,l,n.memoizedProps);else d!==l?(d===null?(s=o.stateNode,s===null||_t||s.parentNode.removeChild(s)):d.count--,l===null?rn||ff(p,n.type,n.stateNode):a0(p,l,n.memoizedProps)):l===null&&n.stateNode!==null&&_d(n,n.memoizedProps,o.memoizedProps);break;case 27:Dn(s,n,l),Mn(n),d&512&&(_t||o===null||_n(o,o.return)),o!==null&&d&4&&_d(n,n.memoizedProps,o.memoizedProps);break;case 5:if(p=Ri,Ri=!1,Dn(s,n,l),Ri=p,Mn(n),d&512&&(_t||o===null||_n(o,o.return)),n.flags&32){s=n.stateNode;try{$r(s,""),dt=!0}catch(ie){yt(n,n.return,ie)}}d&4&&n.stateNode!=null&&(s=n.memoizedProps,_d(n,s,o!==null?o.memoizedProps:s)),d&1024&&(kd=!0);break;case 6:if(Dn(s,n,l),Mn(n),d&4){if(n.stateNode===null)throw Error(r(162));s=n.memoizedProps,l=n.stateNode;try{l.nodeValue=s,dt=!0}catch(ie){yt(n,n.return,ie)}}break;case 3:if(dt=!1,Ic=null,p=Si,Si=Ma(s.containerInfo),Dn(s,n,l),Si=p,Mn(n),d&4&&o!==null&&o.memoizedState.isDehydrated)try{El(s.containerInfo)}catch(ie){yt(n,n.return,ie)}kd&&(kd=!1,ny(n)),dt=!1;break;case 4:d=Ri,Ri=rn,o=xg(),p=Si,Si=Ma(n.stateNode.containerInfo),Dn(s,n,l),Mn(n),Si=p,dt&&xa&&(xc=!0),dt=o,Ri=d;break;case 12:Dn(s,n,l),Mn(n);break;case 31:Dn(s,n,l),Mn(n),d&4&&(s=n.updateQueue,s!==null&&(n.updateQueue=null,Cc(n,s)));break;case 13:Dn(s,n,l),Mn(n),n.child.flags&8192&&n.memoizedState!==null!=(o!==null&&o.memoizedState!==null)&&(Ec=Ft()),d&4&&(s=n.updateQueue,s!==null&&(n.updateQueue=null,Cc(n,s)));break;case 22:p=n.memoizedState!==null,b=o!==null&&o.memoizedState!==null;var k=rn,B=_t,W=Ri;rn=k||p,Ri=W||p,_t=B||b,Dn(s,n,l),_t=B,Ri=W,rn=k,Mn(n),d&8192&&(s=n.stateNode,s._visibility=p?s._visibility&-2:s._visibility|1,!p||o===null||b||rn||_t||(s=b||_t,l=rn,o=_t,rn=p||rn,_t=s,Ts(n,2),rn=l,_t=o),!p&&Ri||Ed(n,p)),d&4&&(s=n.updateQueue,s!==null&&(l=s.retryQueue,l!==null&&(s.retryQueue=null,Cc(n,l))));break;case 19:Dn(s,n,l),Mn(n),d&4&&(s=n.updateQueue,s!==null&&(n.updateQueue=null,Cc(n,s)));break;case 30:d&512&&(_t||o===null||_n(o,o.return)),d=xg(),p=xa,b=(l&335544064)===l,k=n.memoizedProps,xa=b&&Zi(k.default,k.update)!=="none",Dn(s,n,l),Mn(n),b&&o!==null&&dt&&(n.flags|=4),xa=p,dt=d;break;case 21:break;case 7:d&512&&(_t||o===null||_n(o,o.return)),o&&o.stateNode!==null&&(o.stateNode._fragmentFiber=n);default:Dn(s,n,l),Mn(n)}}function Mn(n){var s=n.flags;if(s&2){try{for(var l,o=n.return;o!==null;){if(Uv(o)){l=o;break}o=o.return}o=null;for(var d=n.return;d!==null;){if(pd(d)){var p=d.stateNode;o===null?o=[p]:o.push(p)}if(md(d))break;d=d.return}var b=o;if(l==null)throw Error(r(160));switch(l.tag){case 27:var k=l.stateNode,B=vd(n);vc(n,B,k,b);break;case 5:var W=l.stateNode;l.flags&32&&($r(W,""),l.flags&=-33);var ie=vd(n);vc(n,ie,W,b);break;case 3:case 4:var de=l.stateNode.containerInfo,V=vd(n);yd(n,V,de,b);break;default:throw Error(r(161))}}catch(ee){yt(n,n.return,ee)}n.flags&=-3}s&4096&&(n.flags&=-4097)}function ny(n){if(n.subtreeFlags&1024)for(n=n.child;n!==null;){var s=n;ny(s),s.tag===5&&s.flags&1024&&(s=s.stateNode,Nl=!0,s.reset(),Nl=!1),n=n.sibling}}function cl(n,s){if(s.subtreeFlags&9270)for(s=s.child;s!==null;)iy(s,n),s=s.sibling;else Yv(s)}function iy(n,s){var l=n.alternate;if(l===null)Sd(n,!1);else switch(n.tag){case 3:if(Nd=Oi=!1,Fv(),cl(s,n),!Oi&&!xc){if(n=Mi,n!==null)for(var o=0;o<n.length;o+=3){l=n[o];var d=n[o+1];$y(l,n[o+2]),l=l.ownerDocument.documentElement,l!==null&&l.animate({opacity:[0,0],pointerEvents:["none","none"]},{duration:0,fill:"forwards",pseudoElement:"::view-transition-group("+d+")"})}n=s.containerInfo,n=n.nodeType===9?n.documentElement:n.ownerDocument.documentElement,n!==null&&n.style.viewTransitionName===""&&(n.style.viewTransitionName="none",n.animate({opacity:[0,0],pointerEvents:["none","none"]},{duration:0,fill:"forwards",pseudoElement:"::view-transition-group(root)"}),n.animate({width:[0,0],height:[0,0]},{duration:0,fill:"forwards",pseudoElement:"::view-transition"})),Nd=!0}Mi=null;break;case 5:cl(s,n);break;case 4:o=Oi,Oi=!1,cl(s,n),Oi&&(xc=!0),Oi=o;break;case 22:n.memoizedState===null&&(l.memoizedState!==null?Sd(n,!1):cl(s,n));break;case 30:o=Oi,d=Fv(),Oi=!1,cl(s,n),Oi&&(n.flags|=4);var p=n.memoizedProps,b=n.stateNode;s=Qi(p,b),b=Qi(l.memoizedProps,b);var k=Zi(p.default,p.update);k==="none"?s=!1:(p=l.memoizedState,l.memoizedState=null,l=n.child,zn=0,s=Cd(n,l,s,b,k,p,!0),zn!==(p===null?0:p.length)&&(n.flags|=32)),(n.flags&4)!==0&&s?(gl(n,n.memoizedProps.onUpdate),Mi=d):d!==null&&(d.push.apply(d,Mi),Mi=d),Oi=(n.flags&32)!==0?!0:o;break;default:cl(s,n)}}function Bi(n,s){if(s.subtreeFlags&8772)for(s=s.child;s!==null;)Xv(n,s.alternate,s),s=s.sibling}function Ts(n,s){for(n=n.child;n!==null;){var l=n,o=s;switch(l.tag){case 0:case 11:case 14:case 15:js(4,l,l.return),Ts(l,o);break;case 1:_n(l,l.return);var d=l.stateNode;typeof d.componentWillUnmount=="function"&&Hv(l,l.return,d),Ts(l,o);break;case 27:(o&2)!==0&&n0(l.stateNode,l.type,l.memoizedProps);case 5:_n(l,l.return),l.tag!==5&&l.tag!==27||ba(l),Ts(l,o);break;case 6:ba(l);break;case 26:_n(l,l.return),d=l.stateNode,l.memoizedState!==null||d===null||_t||d.parentNode.removeChild(d),Ts(l,o);break;case 22:l.memoizedState===null&&Ts(l,o);break;case 30:_n(l,l.return),Ts(l,o);break;case 7:_n(l,l.return);default:Ts(l,o)}n=n.sibling}}function bi(n,s,l){for(l=(s.subtreeFlags&8772)!==0?l:l&-2,s=s.child;s!==null;){var o=s.alternate,d=n,p=s,b=p.flags,k=(l&1)!==0;switch(p.tag){case 0:case 11:case 15:bi(d,p,l),Sa(4,p);break;case 1:if(bi(d,p,l),o=p,d=o.stateNode,typeof d.componentDidMount=="function")try{d.componentDidMount()}catch(ie){yt(o,o.return,ie)}if(o=p,d=o.updateQueue,d!==null){var B=o.stateNode;try{var W=d.shared.hiddenCallbacks;if(W!==null)for(d.shared.hiddenCallbacks=null,d=0;d<W.length;d++)k_(W[d],B)}catch(ie){yt(o,o.return,ie)}}k&&b&64&&zv(p),Di(p,p.return);break;case 27:(l&2)!==0&&Pv(p);case 5:p.tag!==5&&p.tag!==27||Iv(p),bi(d,p,l),k&&o===null&&b&4&&gd(p),Di(p,p.return);break;case 6:Iv(p);break;case 26:B=p.stateNode,p.memoizedState!==null||B===null||rn||ff(Ma(B.ownerDocument),p.type,B),bi(d,p,l),k&&o===null&&b&4&&gd(p),Di(p,p.return);break;case 12:bi(d,p,l);break;case 31:bi(d,p,l),k&&b&4&&Jv(d,p);break;case 13:bi(d,p,l),k&&b&4&&ey(d,p);break;case 22:p.memoizedState===null&&bi(d,p,l),Di(p,p.return);break;case 30:bi(d,p,l),Di(p,p.return);break;case 7:Di(p,p.return);default:bi(d,p,l)}s=s.sibling}}function Td(n,s){var l=null;n!==null&&n.memoizedState!==null&&n.memoizedState.cachePool!==null&&(l=n.memoizedState.cachePool.pool),n=null,s.memoizedState!==null&&s.memoizedState.cachePool!==null&&(n=s.memoizedState.cachePool.pool),n!==l&&(n!=null&&n.refCount++,l!=null&&aa(l))}function Dd(n,s){n=null,s.alternate!==null&&(n=s.alternate.memoizedState.cache),s=s.memoizedState.cache,s!==n&&(s.refCount++,n!=null&&aa(n))}function ci(n,s,l,o){var d=(l&335544064)===l;if(s.subtreeFlags&(d?10262:10256))for(s=s.child;s!==null;)sy(n,s,l,o),s=s.sibling;else d&&Kv(s)}function sy(n,s,l,o){var d=(l&335544064)===l;d&&s.alternate===null&&s.return!==null&&s.return.alternate!==null&&bc(s);var p=s.flags;switch(s.tag){case 0:case 11:case 15:ci(n,s,l,o),p&2048&&Sa(9,s);break;case 1:ci(n,s,l,o);break;case 3:ci(n,s,l,o),d&&Nd&&(n=n.containerInfo,n=n.nodeType===9?n.body:n.nodeName==="HTML"?n.ownerDocument.body:n,n.style.viewTransitionName==="root"&&(n.style.viewTransitionName=""),n=n.ownerDocument.documentElement,n!==null&&n.style.viewTransitionName==="none"&&(n.style.viewTransitionName="")),p&2048&&(p=null,s.alternate!==null&&(p=s.alternate.memoizedState.cache),s=s.memoizedState.cache,s!==p&&(s.refCount++,p!=null&&aa(p)));break;case 12:if(p&2048){ci(n,s,l,o),p=s.stateNode;try{var b=s.memoizedProps,k=b.id,B=b.onPostCommit;typeof B=="function"&&B(k,s.alternate===null?"mount":"update",p.passiveEffectDuration,-0)}catch(W){yt(s,s.return,W)}}else ci(n,s,l,o);break;case 31:ci(n,s,l,o);break;case 13:ci(n,s,l,o);break;case 23:break;case 22:b=s.stateNode,k=s.alternate,s.memoizedState!==null?(d&&k!==null&&k.memoizedState===null&&bc(k),b._visibility&2?ci(n,s,l,o):wa(n,s)):(d&&k!==null&&k.memoizedState!==null&&bc(s),b._visibility&2?ci(n,s,l,o):(b._visibility|=2,ul(n,s,l,o,(s.subtreeFlags&10256)!==0||!1))),p&2048&&Td(k,s);break;case 24:ci(n,s,l,o),p&2048&&Dd(s.alternate,s);break;case 30:d&&(p=s.alternate,p!==null&&(Ai(p.child,!0),Ai(s.child,!0))),ci(n,s,l,o);break;default:ci(n,s,l,o)}}function ul(n,s,l,o,d){for(d=d&&((s.subtreeFlags&10256)!==0||!1),s=s.child;s!==null;){var p=n,b=s,k=l,B=o,W=b.flags;switch(b.tag){case 0:case 11:case 15:ul(p,b,k,B,d),Sa(8,b);break;case 23:break;case 22:var ie=b.stateNode;b.memoizedState!==null?ie._visibility&2?ul(p,b,k,B,d):wa(p,b):(ie._visibility|=2,ul(p,b,k,B,d)),d&&W&2048&&Td(b.alternate,b);break;case 24:ul(p,b,k,B,d),d&&W&2048&&Dd(b.alternate,b);break;default:ul(p,b,k,B,d)}s=s.sibling}}function wa(n,s){if(s.subtreeFlags&10256)for(s=s.child;s!==null;){var l=n,o=s,d=o.flags;switch(o.tag){case 22:wa(l,o),d&2048&&Td(o.alternate,o);break;case 24:wa(l,o),d&2048&&Dd(o.alternate,o);break;default:wa(l,o)}s=s.sibling}}var pr=8192;function gr(n,s,l){if(n.subtreeFlags&pr)for(n=n.child;n!==null;)ry(n,s,l),n=n.sibling}function ry(n,s,l){switch(n.tag){case 26:gr(n,s,l),n.flags&pr&&(n.memoizedState!==null?jN(l,Si,n.memoizedState,n.memoizedProps):(n=n.stateNode,(s&335544128)===s&&d0(l,n)));break;case 5:gr(n,s,l),n.flags&pr&&(n=n.stateNode,(s&335544128)===s&&d0(l,n));break;case 3:case 4:var o=Si;Si=Ma(n.stateNode.containerInfo),gr(n,s,l),Si=o;break;case 22:n.memoizedState===null&&(o=n.alternate,o!==null&&o.memoizedState!==null?(o=pr,pr=16777216,gr(n,s,l),pr=o):gr(n,s,l));break;case 30:if((n.flags&pr)!==0&&(o=n.memoizedProps.name,o!=null&&o!=="auto")){var d=n.stateNode;d.paired=null,Wn===null&&(Wn=new Map),Wn.set(o,d)}gr(n,s,l);break;default:gr(n,s,l)}}function ly(n){var s=n.alternate;if(s!==null&&(n=s.child,n!==null)){s.child=null;do s=n.sibling,n.sibling=null,n=s;while(n!==null)}}function Ca(n){var s=n.deletions;if((n.flags&16)!==0){if(s!==null)for(var l=0;l<s.length;l++){var o=s[l];ln=o,oy(o,n)}ly(n)}if(n.subtreeFlags&10256)for(n=n.child;n!==null;)ay(n),n=n.sibling}function ay(n){switch(n.tag){case 0:case 11:case 15:Ca(n),n.flags&2048&&js(9,n,n.return);break;case 3:Ca(n);break;case 12:Ca(n);break;case 22:var s=n.stateNode;n.memoizedState!==null&&s._visibility&2&&(n.return===null||n.return.tag!==13)?(s._visibility&=-3,kc(n)):Ca(n);break;default:Ca(n)}}function kc(n){var s=n.deletions;if((n.flags&16)!==0){if(s!==null)for(var l=0;l<s.length;l++){var o=s[l];ln=o,oy(o,n)}ly(n)}for(n=n.child;n!==null;){switch(s=n,s.tag){case 0:case 11:case 15:js(8,s,s.return),kc(s);break;case 22:l=s.stateNode,l._visibility&2&&(l._visibility&=-3,kc(s));break;default:kc(s)}n=n.sibling}}function oy(n,s){for(;ln!==null;){var l=ln;switch(l.tag){case 0:case 11:case 15:js(8,l,s);break;case 23:case 22:if(l.memoizedState!==null&&l.memoizedState.cachePool!==null){var o=l.memoizedState.cachePool.pool;o!=null&&o.refCount++}break;case 24:aa(l.memoizedState.cache)}if(o=l.child,o!==null)o.return=l,ln=o;else e:for(l=n;ln!==null;){o=ln;var d=o.sibling,p=o.return;if(Qv(o),o===l){ln=null;break e}if(d!==null){d.return=p,ln=d;break e}ln=p}}}var wk={getCacheForType:function(n){var s=mn($t),l=s.data.get(n);return l===void 0&&(l=n(),s.data.set(n,l)),l},cacheSignal:function(){return mn($t).controller.signal}},Ck=typeof WeakMap=="function"?WeakMap:Map,mt=0,wt=null,rt=null,at=0,vt=0,Xn=null,Ds=!1,hl=!1,Md=!1,as=0,zt=0,Ms=0,_r=0,Nc=0,Gn=0,dl=0,ka=null,In=null,Ad=!1,Ec=0,cy=0,jc=1/0,Tc=null,As=null,Rt=0,xi=null,vr=null,Li=0,Rd=0,Od=null,uy=null,fl=null,ml=null,pl=null,Na=0,Dc=null;function Qn(){return(mt&2)!==0&&at!==0?at&-at:oe.T!==null?$d():fg()}function hy(){if(Gn===0)if((at&536870912)===0||et){var n=Co;Co<<=1,(Co&3932160)===0&&(Co=262144),Gn=n}else Gn=536870912;return n=pn.current,n!==null&&(n.flags|=32),Gn}function gl(n,s){if(s!=null){var l=n.stateNode,o=l.ref;o===null&&(o=l.ref=Vy(Qi(n.memoizedProps,l))),ml===null&&(ml=[]),ml.push(s.bind(null,o))}}function Un(n,s,l){(n===wt&&(vt===2||vt===9)||n.cancelPendingCommit!==null)&&(_l(n,0),Rs(n,at,Gn,!1)),Yl(n,l),((mt&2)===0||n!==wt)&&(n===wt&&((mt&2)===0&&(_r|=l),zt===4&&Rs(n,at,Gn,!1)),zi(n))}function dy(n,s,l){if((mt&6)!==0)throw Error(r(327));var o=!l&&(s&127)===0&&(s&n.expiredLanes)===0||Kl(n,s),d=o?Ek(n,s):Ld(n,s,!0),p=o;do{if(d===0){hl&&!o&&Rs(n,s,0,!1);break}else{if(l=n.current.alternate,p&&!kk(l)){d=Ld(n,s,!1),p=!1;continue}if(d===2){if(p=s,n.errorRecoveryDisabledLanes&p)var b=0;else b=n.pendingLanes&-536870913,b=b!==0?b:b&536870912?536870912:0;if(b!==0){s=b;e:{var k=n;d=ka;var B=k.current.memoizedState.isDehydrated;if(B&&(_l(k,b).flags|=256),b=Ld(k,b,!1),b!==2&&b!==6){if(Md&&!B){k.errorRecoveryDisabledLanes|=p,_r|=p,d=4;break e}p=In,In=d,p!==null&&(In===null?In=p:In.push.apply(In,p))}d=b}if(p=!1,d!==2)continue}}if(d===1){_l(n,0),Rs(n,s,0,!0);break}e:{switch(o=n,p=d,p){case 0:case 1:throw Error(r(345));case 4:if((s&4194048)!==s&&(s&62914560)!==s)break;case 6:Rs(o,s,Gn,!Ds);break e;case 2:In=null;break;case 3:case 5:break;default:throw Error(r(329))}if((s&62914560)===s&&(d=Ec+300-Ft(),10<d)){if(Rs(o,s,Gn,!Ds),No(o,0,!0)!==0)break e;Li=s,o.timeoutHandle=tf(fy.bind(null,o,l,In,Tc,Ad,s,Gn,_r,dl,Ds,p,"Throttled",-0,0),d);break e}fy(o,l,In,Tc,Ad,s,Gn,_r,dl,Ds,p,null,-0,0)}}break}while(!0);zi(n)}function fy(n,s,l,o,d,p,b,k,B,W,ie,de,V,ee){n.timeoutHandle=-1;var je=s.subtreeFlags,Le=(p&335544064)===p;if(de=null,(Le||je&8192||(je&16785408)===16785408)&&(de={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:Ei},Wn=null,ry(s,p,de),Le&&(je=de,Le=n.containerInfo,Le=(Le.nodeType===9?Le:Le.ownerDocument).__reactViewTransition,Le!=null&&(je.count++,je.waitingForViewTransition=!0,je=Oa.bind(je),Le.finished.then(je,je))),je=(p&62914560)===p?Ec-Ft():(p&4194048)===p?cy-Ft():0,je=TN(de,je),je!==null)){Li=p,n.cancelPendingCommit=je(by.bind(null,n,s,p,l,o,d,b,k,B,W,ie,de,null,V,ee)),Rs(n,p,b,!W);return}by(n,s,p,l,o,d,b,k,B,W,ie,de)}function kk(n){for(var s=n;;){var l=s.tag;if((l===0||l===11||l===15)&&s.flags&16384&&(l=s.updateQueue,l!==null&&(l=l.stores,l!==null)))for(var o=0;o<l.length;o++){var d=l[o],p=d.getSnapshot;d=d.value;try{if(!Kn(p(),d))return!1}catch{return!1}}if(l=s.child,s.subtreeFlags&16384&&l!==null)l.return=s,s=l;else{if(s===n)break;for(;s.sibling===null;){if(s.return===null||s.return===n)return!0;s=s.return}s.sibling.return=s.return,s=s.sibling}}return!0}function Rs(n,s,l,o){s=og(n,s),s&=~Nc,s&=~_r,n.suspendedLanes|=s,n.pingedLanes&=~s,o&&(n.warmLanes|=s),o=n.expirationTimes;for(var d=s;0<d;){var p=31-dn(d),b=1<<p;o[p]=-1,d&=~b}l!==0&&ug(n,l,s)}function Mc(){return(mt&6)===0?(Ea(0),!1):!0}function Bd(){if(rt!==null){if(vt===0)var n=rt.return;else n=rt,ts=rr=null,Fh(n),il=null,ua=0,n=rt;for(;n!==null;)Lv(n.alternate,n),n=n.return;rt=null}}function _l(n,s){var l=n.timeoutHandle;return l!==-1&&(n.timeoutHandle=-1,Xk(l)),l=n.cancelPendingCommit,l!==null&&(n.cancelPendingCommit=null,l()),Li=0,Bd(),wt=n,rt=l=Ji(n.current,null),at=s,vt=0,Xn=null,Ds=!1,hl=Kl(n,s),Md=!1,dl=Gn=Nc=_r=Ms=zt=0,In=ka=null,Ad=!1,as=og(n,s),Io(),l}function my(n,s){We=null,oe.H=uc,s===nl||s===Go?(s=b_(),vt=3):s===Dh?(s=b_(),vt=4):vt=s===sd?8:s!==null&&typeof s=="object"&&typeof s.then=="function"?6:1,Xn=s,rt===null&&(zt=1,hc(n,ri(s,n.current)))}function py(){var n=pn.current;return n===null?!0:(at&4194048)===at?wn===null:(at&62914560)===at||(at&536870912)!==0?n===wn:!1}function gy(){var n=oe.H;return oe.H=uc,n===null?uc:n}function _y(){var n=oe.A;return oe.A=wk,n}function Ac(){zt=4,Ds||(at&4194048)!==at&&pn.current!==null||(hl=!0),(Ms&134217727)===0&&(_r&134217727)===0||wt===null||Rs(wt,at,Gn,!1)}function Ld(n,s,l){var o=mt;mt|=2;var d=gy(),p=_y();(wt!==n||at!==s)&&(Tc=null,_l(n,s)),s=!1;var b=zt;e:do try{if(vt!==0&&rt!==null){var k=rt,B=Xn;switch(vt){case 8:Bd(),b=6;break e;case 3:case 2:case 9:case 6:pn.current===null&&(s=!0);var W=vt;if(vt=0,Xn=null,vl(n,k,B,W),l&&hl){b=0;break e}break;default:W=vt,vt=0,Xn=null,vl(n,k,B,W)}}Nk(),b=zt;break}catch(ie){my(n,ie)}while(!0);return s&&n.shellSuspendCounter++,ts=rr=null,mt=o,oe.H=d,oe.A=p,rt===null&&(wt=null,at=0,Io()),b}function Nk(){for(;rt!==null;)vy(rt)}function Ek(n,s){var l=mt;mt|=2;var o=gy(),d=_y();wt!==n||at!==s?(Tc=null,jc=Ft()+500,_l(n,s)):hl=Kl(n,s);e:do try{if(vt!==0&&rt!==null){s=rt;var p=Xn;t:switch(vt){case 1:vt=0,Xn=null,vl(n,s,p,1);break;case 2:case 9:if(y_(p)){vt=0,Xn=null,yy(s);break}s=function(){vt!==2&&vt!==9||wt!==n||(vt=7),zi(n)},p.then(s,s);break e;case 3:vt=7;break e;case 4:vt=5;break e;case 7:y_(p)?(vt=0,Xn=null,yy(s)):(vt=0,Xn=null,vl(n,s,p,7));break;case 5:var b=null;switch(rt.tag){case 26:b=rt.memoizedState;case 5:case 27:var k=rt;if(b?u0(b):k.stateNode.complete){vt=0,Xn=null;var B=k.sibling;if(B!==null)rt=B;else{var W=k.return;W!==null?(rt=W,Rc(W)):rt=null}break t}}vt=0,Xn=null,vl(n,s,p,5);break;case 6:vt=0,Xn=null,vl(n,s,p,6);break;case 8:Bd(),zt=6;break e;default:throw Error(r(462))}}jk();break}catch(ie){my(n,ie)}while(!0);return ts=rr=null,oe.H=o,oe.A=d,mt=l,rt!==null?0:(wt=null,at=0,Io(),zt)}function jk(){for(;rt!==null&&!Ni();)vy(rt)}function vy(n){var s=Ov(n.alternate,n,as);n.memoizedProps=n.pendingProps,s===null?Rc(n):rt=s}function yy(n){var s=n,l=s.alternate;switch(s.tag){case 15:case 0:s=Ev(l,s,s.pendingProps,s.type,void 0,at);break;case 11:s=Ev(l,s,s.pendingProps,s.type.render,s.ref,at);break;case 5:Fh(s);var o=s;o===sn&&(et?(Vo(o),o.tag===5&&o.stateNode!=null&&(Nt=o.stateNode)):(Vo(o),et=!0));default:Lv(l,s),s=rt=o_(s,as),s=Ov(l,s,as)}n.memoizedProps=n.pendingProps,s===null?Rc(n):rt=s}function vl(n,s,l,o){ts=rr=null,Fh(s),il=null,ua=0;var d=s.return;try{if(pk(n,d,s,l,at)){zt=1,hc(n,ri(l,n.current)),rt=null;return}}catch(p){if(d!==null)throw rt=d,p;zt=1,hc(n,ri(l,n.current)),rt=null;return}s.flags&32768?(et||o===1?n=!0:hl||(at&536870912)!==0?n=!1:(Ds=n=!0,(o===2||o===9||o===3||o===6)&&(o=pn.current,o!==null&&o.tag===13&&(o.flags|=16384))),Sy(s,n)):Rc(s)}function Rc(n){var s=n;do{if((s.flags&32768)!==0){Sy(s,Ds);return}n=s.return;var l=yk(s.alternate,s,as);if(l!==null){rt=l;return}if(s=s.sibling,s!==null){rt=s;return}rt=s=n}while(s!==null);zt===0&&(zt=5)}function Sy(n,s){do{var l=Sk(n.alternate,n);if(l!==null){l.flags&=32767,rt=l;return}if(l=n.return,l!==null&&(l.flags|=32768,l.subtreeFlags=0,l.deletions=null),!s&&(n=n.sibling,n!==null)){rt=n;return}rt=n=l}while(n!==null);zt=6,rt=null}function by(n,s,l,o,d,p,b,k,B,W,ie,de){n.cancelPendingCommit=null;do Oc();while(Rt!==0);if((mt&6)!==0)throw Error(r(327));if(s!==null){if(s===n.current)throw Error(r(177));n===wt&&(rt=wt=null,at=0),vr=s,xi=n,Li=l,Od=d,uy=o,Tk(n,s,l,b,k,B,de)}}function Tk(n,s,l,o,d,p,b){var k=s.lanes|s.childLanes;if(Rd=k,k|=_h,tC(n,l,k,o,d,p),ml=null,(l&335544064)===l?(pl=ik(n),o=10262):(pl=null,o=10256),(s.subtreeFlags&o)!==0||(s.flags&o)!==0?(n.callbackNode=null,n.callbackPriority=0,Bk(Hr,function(){return Ud(),null})):(n.callbackNode=null,n.callbackPriority=0),yc=!1,o=(s.flags&13878)!==0,(s.subtreeFlags&13878)!==0||o){o=oe.T,oe.T=null,d=ye.p,ye.p=2,p=mt,mt|=4;try{bk(n,s,l)}finally{mt=p,ye.p=d,oe.T=o}}Rt=1,yc?fl=tN(b,n.containerInfo,pl,zd,Hd,Mk,Id,Ud,Dk):(zd(),Hd(),Id())}function Dk(n){if(Rt!==0){var s=xi.onRecoverableError;s(n,{componentStack:null})}}function Mk(){Rt===3&&(Rt=0,iy(vr,xi),Rt=4)}function zd(){if(Rt===1){Rt=0;var n=xi,s=vr,l=Li,o=(s.flags&13878)!==0;if((s.subtreeFlags&13878)!==0||o){o=oe.T,oe.T=null;var d=ye.p;ye.p=2;var p=mt;mt|=4;try{xa=xc=!1,ty(s,n,l),l=Zd;var b=Zg(n.containerInfo),k=l.focusedElem,B=l.selectionRange;if(b!==k&&k&&k.ownerDocument&&Qg(k.ownerDocument.documentElement,k)){if(B!==null&&dh(k)){var W=B.start,ie=B.end;if(ie===void 0&&(ie=W),"selectionStart"in k)k.selectionStart=W,k.selectionEnd=Math.min(ie,k.value.length);else{var de=k.ownerDocument||document,V=de&&de.defaultView||window;if(V.getSelection){var ee=V.getSelection(),je=k.textContent.length,Le=Math.min(B.start,je),Xe=B.end===void 0?Le:Math.min(B.end,je);!ee.extend&&Le>Xe&&(b=Xe,Xe=Le,Le=b);var Y=Gg(k,Le),U=Gg(k,Xe);if(Y&&U&&(ee.rangeCount!==1||ee.anchorNode!==Y.node||ee.anchorOffset!==Y.offset||ee.focusNode!==U.node||ee.focusOffset!==U.offset)){var Z=de.createRange();Z.setStart(Y.node,Y.offset),ee.removeAllRanges(),Le>Xe?(ee.addRange(Z),ee.extend(U.node,U.offset)):(Z.setEnd(U.node,U.offset),ee.addRange(Z))}}}}for(de=[],ee=k;ee=ee.parentNode;)ee.nodeType===1&&de.push({element:ee,left:ee.scrollLeft,top:ee.scrollTop});for(typeof k.focus=="function"&&k.focus(),k=0;k<de.length;k++){var ue=de[k];ue.element.scrollLeft=ue.left,ue.element.scrollTop=ue.top}}Nl=!!Qd,Zd=Qd=null}finally{mt=p,ye.p=d,oe.T=o}}n.current=s,Rt=2}}function Hd(){if(Rt===2){Rt=0;var n=xi,s=vr,l=(s.flags&8772)!==0;if((s.subtreeFlags&8772)!==0||l){l=oe.T,oe.T=null;var o=ye.p;ye.p=2;var d=mt;mt|=4;try{Xv(n,s.alternate,s)}finally{mt=d,ye.p=o,oe.T=l}}Rt=3}}function Id(){if(Rt===4||Rt===3){Rt=0;var n=fl;fl=null,zr();var s=xi,l=vr,o=Li,d=uy,p=(o&335544064)===o?10262:10256;if((l.subtreeFlags&p)!==0||(l.flags&p)!==0?Rt=5:(Rt=0,vr=xi=null,xy(s,s.pendingLanes)),p=s.pendingLanes,p===0&&(As=null),Wu(o),l=l.stateNode,Ue&&typeof Ue.onCommitFiberRoot=="function")try{Ue.onCommitFiberRoot(En,l,void 0,(l.current.flags&128)===128)}catch{}if(d!==null){l=oe.T,p=ye.p,ye.p=2,oe.T=null;try{for(var b=s.onRecoverableError,k=0;k<d.length;k++){var B=d[k];b(B.value,{componentStack:B.stack})}}finally{oe.T=l,ye.p=p}}if(d=ml,b=pl,pl=null,d!==null&&(ml=null,b===null&&(b=[]),n!==null))for(B=0;B<d.length;B++)l=(0,d[B])(b),l!==void 0&&n.finished.finally(l);(Li&3)!==0&&Oc(),zi(s),p=s.pendingLanes,(o&261930)!==0&&(p&42)!==0?s===Dc?Na++:(Na=0,Dc=s):(Na=0,Dc=null),Ea(0)}}function xy(n,s){(n.pooledCacheLanes&=s)===0&&(s=n.pooledCache,s!=null&&(n.pooledCache=null,aa(s)))}function Oc(){return fl!==null&&(fl.skipTransition(),fl=null),zd(),Hd(),Id(),Ud()}function Ud(){if(Rt!==5)return!1;var n=xi,s=Rd;Rd=0;var l=Wu(Li),o=oe.T,d=ye.p;try{ye.p=32>l?32:l,oe.T=null,l=Od,Od=null;var p=xi,b=Li;if(Rt=0,vr=xi=null,Li=0,(mt&6)!==0)throw Error(r(331));var k=mt;if(mt|=4,ay(p.current),sy(p,p.current,b,l),mt=k,Ea(0,!1),Ue&&typeof Ue.onPostCommitFiberRoot=="function")try{Ue.onPostCommitFiberRoot(En,p)}catch{}return!0}finally{ye.p=d,oe.T=o,xy(n,s)}}function wy(n,s,l){s=ri(l,s),s=id(n.stateNode,s,2),n=Cs(n,s,2),n!==null&&(Yl(n,2),zi(n))}function yt(n,s,l){if(n.tag===3)wy(n,n,l);else for(;s!==null;){if(s.tag===3){wy(s,n,l);break}else if(s.tag===1){var o=s.stateNode;if(typeof s.type.getDerivedStateFromError=="function"||typeof o.componentDidCatch=="function"&&(As===null||!As.has(o))){n=ri(l,n),l=yv(2),o=Cs(s,l,2),o!==null&&(Sv(l,o,s,n),Yl(o,2),zi(o));break}}s=s.return}}function Pd(n,s,l){var o=n.pingCache;if(o===null){o=n.pingCache=new Ck;var d=new Set;o.set(s,d)}else d=o.get(s),d===void 0&&(d=new Set,o.set(s,d));d.has(l)||(Md=!0,d.add(l),n=Ak.bind(null,n,s,l),s.then(n,n))}function Ak(n,s,l){var o=n.pingCache;o!==null&&o.delete(s),n.pingedLanes|=n.suspendedLanes&l,n.warmLanes&=~l,wt===n&&(at&l)===l&&((zt===4||zt===3&&(at&62914560)===at&&300>Ft()-Ec)&&(mt&2)===0?_l(n,0):Nc|=l,dl===at&&(dl=0)),zi(n)}function Cy(n,s){s===0&&(s=cg()),n=nr(n,s),n!==null&&(Yl(n,s),zi(n))}function Rk(n){var s=n.memoizedState,l=0;s!==null&&(l=s.retryLane),Cy(n,l)}function Ok(n,s){var l=0;switch(n.tag){case 31:case 13:var o=n.stateNode,d=n.memoizedState;d!==null&&(l=d.retryLane);break;case 19:o=n.stateNode;break;case 22:o=n.stateNode._retryCache;break;default:throw Error(r(314))}o!==null&&o.delete(s),Cy(n,l)}function Bk(n,s){return pt(n,s)}var yl=null,Sl=null,qd=!1,Bc=!1,Fd=!1,Os=0;function zi(n){n!==Sl&&n.next===null&&(Sl===null?yl=Sl=n:Sl=Sl.next=n),Bc=!0,qd||(qd=!0,zk())}function Ea(n,s){if(!Fd&&Bc){Fd=!0;do for(var l=!1,o=yl;o!==null;){if(n!==0){var d=o.pendingLanes;if(d===0)var p=0;else{var b=o.suspendedLanes,k=o.pingedLanes;p=(1<<31-dn(42|n)+1)-1,p&=d&~(b&~k),p=p&201326741?p&201326741|1:p?p|2:0}p!==0&&(l=!0,jy(o,p))}else p=at,p=No(o,o===wt?p:0,o.cancelPendingCommit!==null||o.timeoutHandle!==-1),(p&3)===0||Kl(o,p)||(l=!0,jy(o,p));o=o.next}while(l);Fd=!1}}function Lk(){ky()}function ky(){Bc=qd=!1;var n=0;Os!==0&&Wk()&&(n=Os);for(var s=Ft(),l=null,o=yl;o!==null;){var d=o.next,p=Ny(o,s);p===0?(o.next=null,l===null?yl=d:l.next=d,d===null&&(Sl=l)):(l=o,(n!==0||(p&3)!==0)&&(Bc=!0)),o=d}Rt!==0&&Rt!==5||Ea(n),Os!==0&&(Os=0)}function Ny(n,s){for(var l=n.suspendedLanes,o=n.pingedLanes,d=n.expirationTimes,p=n.pendingLanes&-62914561;0<p;){var b=31-dn(p),k=1<<b,B=d[b];B===-1?((k&l)===0||(k&o)!==0)&&(d[b]=eC(k,s)):B<=s&&(n.expiredLanes|=k),p&=~k}if(s=wt,l=at,l=No(n,n===s?l:0,n.cancelPendingCommit!==null||n.timeoutHandle!==-1),o=n.callbackNode,l===0||n===s&&(vt===2||vt===9)||n.cancelPendingCommit!==null)return o!==null&&o!==null&&Qe(o),n.callbackNode=null,n.callbackPriority=0;if((l&3)===0||Kl(n,l)){if(s=l&-l,s===n.callbackPriority)return s;switch(o!==null&&Qe(o),Wu(l)){case 2:case 8:l=Nn;break;case 32:l=Hr;break;case 268435456:l=Ae;break;default:l=Hr}return o=Ey.bind(null,n),l=pt(l,o),n.callbackPriority=s,n.callbackNode=l,s}return o!==null&&o!==null&&Qe(o),n.callbackPriority=2,n.callbackNode=null,2}function Ey(n,s){if(Rt!==0&&Rt!==5)return n.callbackNode=null,n.callbackPriority=0,null;var l=n.callbackNode;if(Oc()&&n.callbackNode!==l)return null;var o=at;return o=No(n,n===wt?o:0,n.cancelPendingCommit!==null||n.timeoutHandle!==-1),o===0?null:(dy(n,o,s),Ny(n,Ft()),n.callbackNode!=null&&n.callbackNode===l?Ey.bind(null,n):null)}function jy(n,s){if(Oc())return null;dy(n,s,!0)}function zk(){Gk(function(){(mt&6)!==0?pt(_i,Lk):ky()})}function $d(){if(Os===0){var n=or;n===0&&(n=wo,wo<<=1,(wo&261888)===0&&(wo=256)),Os=n}return Os}function Ty(n){return n==null||typeof n=="symbol"||typeof n=="boolean"?null:typeof n=="function"?n:Mo(n)}function Hk(n,s,l,o,d){if(s==="submit"&&l&&l.stateNode===d){var p=Ty((d[Bn]||null).action),b=o.submitter;b&&(s=(s=b[Bn]||null)?Ty(s.formAction):b.getAttribute("formAction"),s!==null&&(p=s,b=null));var k=new Bo("action","action",null,o,d);n.push({event:k,listeners:[{instance:null,listener:function(){if(o.defaultPrevented){if(Os!==0){var B=new FormData(d,b);Zh(l,{pending:!0,data:B,method:d.method,action:p},null,B)}}else typeof p=="function"&&(k.preventDefault(),B=new FormData(d,b),Zh(l,{pending:!0,data:B,method:d.method,action:p},p,B))},currentTarget:d}]})}}for(var Vd=0;Vd<gh.length;Vd++){var Kd=gh[Vd],Ik=Kd.toLowerCase(),Uk=Kd[0].toUpperCase()+Kd.slice(1);vi(Ik,"on"+Uk)}vi(t_,"onAnimationEnd"),vi(n_,"onAnimationIteration"),vi(i_,"onAnimationStart"),vi("dblclick","onDoubleClick"),vi("focusin","onFocus"),vi("focusout","onBlur"),vi(XC,"onTransitionRun"),vi(GC,"onTransitionStart"),vi(QC,"onTransitionCancel"),vi(s_,"onTransitionEnd"),qr("onMouseEnter",["mouseout","mouseover"]),qr("onMouseLeave",["mouseout","mouseover"]),qr("onPointerEnter",["pointerout","pointerover"]),qr("onPointerLeave",["pointerout","pointerover"]),Js("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),Js("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),Js("onBeforeInput",["compositionend","keypress","textInput","paste"]),Js("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),Js("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),Js("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var ja="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(" "),Pk=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(ja));function Dy(n,s){s=(s&4)!==0;for(var l=0;l<n.length;l++){var o=n[l],d=o.event;o=o.listeners;e:{var p=void 0;if(s)for(var b=o.length-1;0<=b;b--){var k=o[b],B=k.instance,W=k.currentTarget;if(k=k.listener,B!==p&&d.isPropagationStopped())break e;p=k,d.currentTarget=W;try{p(d)}catch(ie){Ho(ie)}d.currentTarget=null,p=B}else for(b=0;b<o.length;b++){if(k=o[b],B=k.instance,W=k.currentTarget,k=k.listener,B!==p&&d.isPropagationStopped())break e;p=k,d.currentTarget=W;try{p(d)}catch(ie){Ho(ie)}d.currentTarget=null,p=B}}}}function lt(n,s){var l=s[pg];l===void 0&&(l=s[pg]=new Set);var o=n+"__bubble";l.has(o)||(My(s,n,2,!1),l.add(o))}function Yd(n,s,l){var o=0;s&&(o|=4),My(l,n,o,s)}var Lc="_reactListening"+Math.random().toString(36).slice(2);function Wd(n){if(!n[Lc]){n[Lc]=!0,vg.forEach(function(l){l!=="selectionchange"&&(Pk.has(l)||Yd(l,!1,n),Yd(l,!0,n))});var s=n.nodeType===9?n:n.ownerDocument;s===null||s[Lc]||(s[Lc]=!0,Yd("selectionchange",!1,s))}}function My(n,s,l,o){switch(S0(s)){case 2:var d=RN;break;case 8:d=ON;break;default:d=pf}l=d.bind(null,s,l,n),d=void 0,!nh||s!=="touchstart"&&s!=="touchmove"&&s!=="wheel"||(d=!0),o?d!==void 0?n.addEventListener(s,l,{capture:!0,passive:d}):n.addEventListener(s,l,!0):d!==void 0?n.addEventListener(s,l,{passive:d}):n.addEventListener(s,l,!1)}function Xd(n,s,l,o,d){var p=o;if((s&1)===0&&(s&2)===0&&o!==null)e:for(;;){if(o===null)return;var b=o.tag;if(b===3||b===4){var k=o.stateNode.containerInfo;if(k===d)break;if(b===4)for(b=o.return;b!==null;){var B=b.tag;if((B===3||B===4)&&b.stateNode.containerInfo===d)return;b=b.return}for(;k!==null;){if(b=Zs(k),b===null)return;if(B=b.tag,B===5||B===6||B===26||B===27){o=p=b;continue e}k=k.parentNode}}o=o.return}Mg(function(){var W=p,ie=eh(l),de=[];e:{var V=r_.get(n);if(V!==void 0){var ee=Bo,je=n;switch(n){case"keypress":if(Ro(l)===0)break e;case"keydown":case"keyup":ee=kC;break;case"focusin":je="focus",ee=lh;break;case"focusout":je="blur",ee=lh;break;case"beforeblur":case"afterblur":ee=lh;break;case"click":if(l.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":ee=Og;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":ee=fC;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":ee=DC;break;case t_:case n_:case i_:ee=gC;break;case s_:ee=AC;break;case"scroll":case"scrollend":ee=hC;break;case"wheel":ee=OC;break;case"copy":case"cut":case"paste":ee=vC;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":ee=Lg;break;case"submit":ee=jC;break;case"toggle":case"beforetoggle":ee=LC}var Le=(s&4)!==0,Xe=!Le&&(n==="scroll"||n==="scrollend"),Y=Le?V!==null?V+"Capture":null:V;Le=[];for(var U=W,Z;U!==null;){var ue=U;if(Z=ue.stateNode,ue=ue.tag,ue!==5&&ue!==26&&ue!==27||Z===null||Y===null||(ue=Gl(U,Y),ue!=null&&Le.push(Ta(U,ue,Z))),Xe)break;U=U.return}0<Le.length&&(V=new ee(V,je,null,l,ie),de.push({event:V,listeners:Le}))}}if((s&7)===0){e:{if(ee=n==="mouseover"||n==="pointerover",V=n==="mouseout"||n==="pointerout",ee&&l!==Ju&&(je=l.relatedTarget||l.fromElement)&&(Zs(je)||je[Ir]))break e;(V||ee)&&(je=ie.window===ie?ie:(ee=ie.ownerDocument)?ee.defaultView||ee.parentWindow:window,V?(ee=l.relatedTarget||l.toElement,V=W,ee=ee?Zs(ee):null,ee!==null&&(Xe=c(ee),Le=ee.tag,ee!==Xe||Le!==5&&Le!==27&&Le!==6)&&(ee=null)):(V=null,ee=W),V!==ee&&(Le=Og,ue="onMouseLeave",Y="onMouseEnter",U="mouse",(n==="pointerout"||n==="pointerover")&&(Le=Lg,ue="onPointerLeave",Y="onPointerEnter",U="pointer"),Xe=V==null?je:Xl(V),Z=ee==null?je:Xl(ee),je=new Le(ue,U+"leave",V,l,ie),je.target=Xe,je.relatedTarget=Z,ue=null,Zs(ie)===W&&(Le=new Le(Y,U+"enter",ee,l,ie),Le.target=Z,Le.relatedTarget=Xe,ue=Le),Xe=ue,Le=V&&ee?H(V,ee,qk):null,V!==null&&Ay(de,je,V,Le,!1),ee!==null&&Xe!==null&&Ay(de,Xe,ee,Le,!0)))}e:{if(V=W?Xl(W):window,ee=V.nodeName&&V.nodeName.toLowerCase(),ee==="select"||ee==="input"&&V.type==="file")var Oe=$g;else if(qg(V))if(Vg)Oe=KC;else{Oe=$C;var ot=FC}else ee=V.nodeName,!ee||ee.toLowerCase()!=="input"||V.type!=="checkbox"&&V.type!=="radio"?W&&Zu(W.elementType)&&(Oe=$g):Oe=VC;if(Oe&&(Oe=Oe(n,W))){Fg(de,Oe,l,ie);break e}ot&&ot(n,V,W)}switch(ot=W?Xl(W):window,n){case"focusin":(qg(ot)||ot.contentEditable==="true")&&(Wr=ot,fh=W,sa=null);break;case"focusout":sa=fh=Wr=null;break;case"mousedown":mh=!0;break;case"contextmenu":case"mouseup":case"dragend":mh=!1,Jg(de,l,ie);break;case"selectionchange":if(WC)break;case"keydown":case"keyup":Jg(de,l,ie)}var Ie;if(oh)e:{switch(n){case"compositionstart":var Fe="onCompositionStart";break e;case"compositionend":Fe="onCompositionEnd";break e;case"compositionupdate":Fe="onCompositionUpdate";break e}Fe=void 0}else Yr?Ug(n,l)&&(Fe="onCompositionEnd"):n==="keydown"&&l.keyCode===229&&(Fe="onCompositionStart");Fe&&(zg&&l.locale!=="ko"&&(Yr||Fe!=="onCompositionStart"?Fe==="onCompositionEnd"&&Yr&&(Ie=Ag()):(ps=ie,ih="value"in ps?ps.value:ps.textContent,Yr=!0)),ot=zc(W,Fe),0<ot.length&&(Fe=new Bg(Fe,n,null,l,ie),de.push({event:Fe,listeners:ot}),Ie?Fe.data=Ie:(Ie=Pg(l),Ie!==null&&(Fe.data=Ie)))),(Ie=HC?IC(n,l):UC(n,l))&&(Fe=zc(W,"onBeforeInput"),0<Fe.length&&(ot=new Bg("onBeforeInput","beforeinput",null,l,ie),de.push({event:ot,listeners:Fe}),ot.data=Ie)),Hk(de,n,W,l,ie)}Dy(de,s)})}function Ta(n,s,l){return{instance:n,listener:s,currentTarget:l}}function zc(n,s){for(var l=s+"Capture",o=[];n!==null;){var d=n,p=d.stateNode;if(d=d.tag,d!==5&&d!==26&&d!==27||p===null||(d=Gl(n,l),d!=null&&o.unshift(Ta(n,d,p)),d=Gl(n,s),d!=null&&o.push(Ta(n,d,p))),n.tag===3)return o;n=n.return}return[]}function qk(n){if(n===null)return null;do n=n.return;while(n&&n.tag!==5&&n.tag!==27);return n||null}function Ay(n,s,l,o,d){for(var p=s._reactName,b=[];l!==null&&l!==o;){var k=l,B=k.alternate,W=k.stateNode;if(k=k.tag,B!==null&&B===o)break;k!==5&&k!==26&&k!==27||W===null||(B=W,d?(W=Gl(l,p),W!=null&&b.unshift(Ta(l,W,B))):d||(W=Gl(l,p),W!=null&&b.push(Ta(l,W,B)))),l=l.return}b.length!==0&&n.push({event:s,listeners:b})}var Fk=/\r\n?/g,$k=/\u0000|\uFFFD/g;function Ry(n){return(typeof n=="string"?n:""+n).replace(Fk,`
9
+ `).replace($k,"")}function Oy(n,s){return s=Ry(s),Ry(n)===s}function St(n,s,l,o,d,p){switch(l){case"children":if(typeof o=="string")s==="body"||s==="textarea"&&o===""||$r(n,o);else if(typeof o=="number"||typeof o=="bigint")s!=="body"&&$r(n,""+o);else return;break;case"className":Do(n,"class",o);break;case"tabIndex":Do(n,"tabindex",o);break;case"dir":case"role":case"viewBox":case"width":case"height":Do(n,l,o);break;case"style":Tg(n,o,p);return;case"data":if(s!=="object"){Do(n,"data",o);break}case"src":case"href":if(o===""&&(s!=="a"||l!=="href")){n.removeAttribute(l);break}if(o==null||typeof o=="function"||typeof o=="symbol"||typeof o=="boolean"){n.removeAttribute(l);break}o=Mo(o),n.setAttribute(l,o);break;case"action":case"formAction":if(typeof o=="function"){n.setAttribute(l,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof p=="function"&&(l==="formAction"?(s!=="input"&&St(n,s,"name",d.name,d,null),St(n,s,"formEncType",d.formEncType,d,null),St(n,s,"formMethod",d.formMethod,d,null),St(n,s,"formTarget",d.formTarget,d,null)):(St(n,s,"encType",d.encType,d,null),St(n,s,"method",d.method,d,null),St(n,s,"target",d.target,d,null)));if(o==null||typeof o=="symbol"||typeof o=="boolean"){n.removeAttribute(l);break}o=Mo(o),n.setAttribute(l,o);break;case"onClick":o!=null&&(n.onclick=Ei);return;case"onScroll":o!=null&&lt("scroll",n);return;case"onScrollEnd":o!=null&&lt("scrollend",n);return;case"dangerouslySetInnerHTML":if(o!=null){if(typeof o!="object"||!("__html"in o))throw Error(r(61));if(l=o.__html,l!=null){if(d.children!=null)throw Error(r(60));p?.__html!==l&&(n.innerHTML=l)}}break;case"multiple":n.multiple=o&&typeof o!="function"&&typeof o!="symbol";break;case"muted":n.muted=o&&typeof o!="function"&&typeof o!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(o==null||typeof o=="function"||typeof o=="boolean"||typeof o=="symbol"){n.removeAttribute("xlink:href");break}l=Mo(o),n.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",l);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":o!=null&&typeof o!="function"&&typeof o!="symbol"?n.setAttribute(l,o):n.removeAttribute(l);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"credentialless":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":o&&typeof o!="function"&&typeof o!="symbol"?n.setAttribute(l,""):n.removeAttribute(l);break;case"capture":case"download":o===!0?n.setAttribute(l,""):o!==!1&&o!=null&&typeof o!="function"&&typeof o!="symbol"?n.setAttribute(l,o):n.removeAttribute(l);break;case"cols":case"rows":case"size":case"span":o!=null&&typeof o!="function"&&typeof o!="symbol"&&!isNaN(o)&&1<=o?n.setAttribute(l,o):n.removeAttribute(l);break;case"rowSpan":case"start":o==null||typeof o=="function"||typeof o=="symbol"||isNaN(o)?n.removeAttribute(l):n.setAttribute(l,o);break;case"popover":lt("beforetoggle",n),lt("toggle",n),To(n,"popover",o);break;case"xlinkActuate":Xi(n,"http://www.w3.org/1999/xlink","xlink:actuate",o);break;case"xlinkArcrole":Xi(n,"http://www.w3.org/1999/xlink","xlink:arcrole",o);break;case"xlinkRole":Xi(n,"http://www.w3.org/1999/xlink","xlink:role",o);break;case"xlinkShow":Xi(n,"http://www.w3.org/1999/xlink","xlink:show",o);break;case"xlinkTitle":Xi(n,"http://www.w3.org/1999/xlink","xlink:title",o);break;case"xlinkType":Xi(n,"http://www.w3.org/1999/xlink","xlink:type",o);break;case"xmlBase":Xi(n,"http://www.w3.org/XML/1998/namespace","xml:base",o);break;case"xmlLang":Xi(n,"http://www.w3.org/XML/1998/namespace","xml:lang",o);break;case"xmlSpace":Xi(n,"http://www.w3.org/XML/1998/namespace","xml:space",o);break;case"is":To(n,"is",o);break;case"innerText":case"textContent":return;default:if(!(2<l.length)||l[0]!=="o"&&l[0]!=="O"||l[1]!=="n"&&l[1]!=="N")l=cC.get(l)||l,To(n,l,o);else return}dt=!0}function Gd(n,s,l,o,d,p){switch(l){case"style":Tg(n,o,p);return;case"dangerouslySetInnerHTML":if(o!=null){if(typeof o!="object"||!("__html"in o))throw Error(r(61));if(l=o.__html,l!=null){if(d.children!=null)throw Error(r(60));p?.__html!==l&&(n.innerHTML=l)}}break;case"children":if(typeof o=="string")$r(n,o);else if(typeof o=="number"||typeof o=="bigint")$r(n,""+o);else return;break;case"onScroll":o!=null&&lt("scroll",n);return;case"onScrollEnd":o!=null&&lt("scrollend",n);return;case"onClick":o!=null&&(n.onclick=Ei);return;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":return;case"innerText":case"textContent":return;default:if(!yg.hasOwnProperty(l))e:{if(l[0]==="o"&&l[1]==="n"&&(d=l.endsWith("Capture"),p=l.slice(2,d?l.length-7:void 0),s=n[Bn]||null,s=s!=null?s[l]:null,typeof s=="function"&&n.removeEventListener(p,s,d),typeof o=="function")){typeof s!="function"&&s!==null&&(l in n?n[l]=null:n.hasAttribute(l)&&n.removeAttribute(l)),n.addEventListener(p,o,d);break e}dt=!0,l in n?n[l]=o:o===!0?n.setAttribute(l,""):To(n,l,o)}return}dt=!0}function vn(n,s,l){switch(s){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":lt("error",n),lt("load",n);var o=!1,d=!1,p;for(p in l)if(l.hasOwnProperty(p)){var b=l[p];if(b!=null)switch(p){case"src":o=!0;break;case"srcSet":d=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(r(137,s));default:St(n,s,p,b,l,null)}}d&&St(n,s,"srcSet",l.srcSet,l,null),o&&St(n,s,"src",l.src,l,null);return;case"input":lt("invalid",n);var k=p=b=d=null,B=null,W=null;for(o in l)if(l.hasOwnProperty(o)){var ie=l[o];if(ie!=null)switch(o){case"name":d=ie;break;case"type":b=ie;break;case"checked":B=ie;break;case"defaultChecked":W=ie;break;case"value":p=ie;break;case"defaultValue":k=ie;break;case"children":case"dangerouslySetInnerHTML":if(ie!=null)throw Error(r(137,s));break;default:St(n,s,o,ie,l,null)}}kg(n,p,k,B,W,b,d,!1);return;case"select":lt("invalid",n),o=b=p=null;for(d in l)if(l.hasOwnProperty(d)&&(k=l[d],k!=null))switch(d){case"value":p=k;break;case"defaultValue":b=k;break;case"multiple":o=k;default:St(n,s,d,k,l,null)}s=p,l=b,n.multiple=!!o,s!=null?Fr(n,!!o,s,!1):l!=null&&Fr(n,!!o,l,!0);return;case"textarea":lt("invalid",n),p=d=o=null;for(b in l)if(l.hasOwnProperty(b)&&(k=l[b],k!=null))switch(b){case"value":o=k;break;case"defaultValue":d=k;break;case"children":p=k;break;case"dangerouslySetInnerHTML":if(k!=null)throw Error(r(91));break;default:St(n,s,b,k,l,null)}Eg(n,o,d,p);return;case"option":for(B in l)l.hasOwnProperty(B)&&(o=l[B],o!=null)&&(B==="selected"?n.selected=o&&typeof o!="function"&&typeof o!="symbol":St(n,s,B,o,l,null));return;case"dialog":lt("beforetoggle",n),lt("toggle",n),lt("cancel",n),lt("close",n);break;case"iframe":case"object":lt("load",n);break;case"video":case"audio":for(o=0;o<ja.length;o++)lt(ja[o],n);break;case"image":lt("error",n),lt("load",n);break;case"details":lt("toggle",n);break;case"embed":case"source":case"link":lt("error",n),lt("load",n);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(W in l)if(l.hasOwnProperty(W)&&(o=l[W],o!=null))switch(W){case"children":case"dangerouslySetInnerHTML":throw Error(r(137,s));default:St(n,s,W,o,l,null)}return;default:if(Zu(s)){for(ie in l)l.hasOwnProperty(ie)&&(o=l[ie],o!==void 0&&Gd(n,s,ie,o,l,void 0));return}}for(k in l)l.hasOwnProperty(k)&&(o=l[k],o!=null&&St(n,s,k,o,l,null))}var Vk={};function Kk(n,s,l,o){switch(s){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var d=null,p=null,b=null,k=null,B=null,W=null,ie=null;for(ee in l){var de=l[ee];if(l.hasOwnProperty(ee)&&de!=null)switch(ee){case"checked":break;case"value":break;case"defaultValue":B=de;default:o.hasOwnProperty(ee)||St(n,s,ee,null,o,de)}}for(var V in o){var ee=o[V];if(de=l[V],o.hasOwnProperty(V)&&(ee!=null||de!=null))switch(V){case"type":ee!==de&&(dt=!0),p=ee;break;case"name":ee!==de&&(dt=!0),d=ee;break;case"checked":ee!==de&&(dt=!0),W=ee;break;case"defaultChecked":ee!==de&&(dt=!0),ie=ee;break;case"value":ee!==de&&(dt=!0),b=ee;break;case"defaultValue":ee!==de&&(dt=!0),k=ee;break;case"children":case"dangerouslySetInnerHTML":if(ee!=null)throw Error(r(137,s));break;default:ee!==de&&St(n,s,V,ee,o,de)}}Gu(n,b,k,B,W,ie,p,d);return;case"select":ee=b=k=V=null;for(p in l)if(B=l[p],l.hasOwnProperty(p)&&B!=null)switch(p){case"value":break;case"multiple":ee=B;default:o.hasOwnProperty(p)||St(n,s,p,null,o,B)}for(d in o)if(p=o[d],B=l[d],o.hasOwnProperty(d)&&(p!=null||B!=null))switch(d){case"value":p!==B&&(dt=!0),V=p;break;case"defaultValue":p!==B&&(dt=!0),k=p;break;case"multiple":p!==B&&(dt=!0),b=p;default:p!==B&&St(n,s,d,p,o,B)}s=k,l=b,o=ee,V!=null?Fr(n,!!l,V,!1):!!o!=!!l&&(s!=null?Fr(n,!!l,s,!0):Fr(n,!!l,l?[]:"",!1));return;case"textarea":ee=V=null;for(k in l)if(d=l[k],l.hasOwnProperty(k)&&d!=null&&!o.hasOwnProperty(k))switch(k){case"value":break;case"children":break;default:St(n,s,k,null,o,d)}for(b in o)if(d=o[b],p=l[b],o.hasOwnProperty(b)&&(d!=null||p!=null))switch(b){case"value":d!==p&&(dt=!0),V=d;break;case"defaultValue":d!==p&&(dt=!0),ee=d;break;case"children":break;case"dangerouslySetInnerHTML":if(d!=null)throw Error(r(91));break;default:d!==p&&St(n,s,b,d,o,p)}Ng(n,V,ee);return;case"option":for(var je in l)V=l[je],l.hasOwnProperty(je)&&V!=null&&!o.hasOwnProperty(je)&&(je==="selected"?n.selected=!1:St(n,s,je,null,o,V));for(B in o)V=o[B],ee=l[B],o.hasOwnProperty(B)&&V!==ee&&(V!=null||ee!=null)&&(B==="selected"?(V!==ee&&(dt=!0),n.selected=V&&typeof V!="function"&&typeof V!="symbol"):St(n,s,B,V,o,ee));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 Le in l)V=l[Le],l.hasOwnProperty(Le)&&V!=null&&!o.hasOwnProperty(Le)&&St(n,s,Le,null,o,V);for(W in o)if(V=o[W],ee=l[W],o.hasOwnProperty(W)&&V!==ee&&(V!=null||ee!=null))switch(W){case"children":case"dangerouslySetInnerHTML":if(V!=null)throw Error(r(137,s));break;default:St(n,s,W,V,o,ee)}return;default:if(Zu(s)){for(var Xe in l)V=l[Xe],l.hasOwnProperty(Xe)&&V!==void 0&&!o.hasOwnProperty(Xe)&&Gd(n,s,Xe,void 0,o,V);for(ie in o)V=o[ie],ee=l[ie],!o.hasOwnProperty(ie)||V===ee||V===void 0&&ee===void 0||Gd(n,s,ie,V,o,ee);return}}for(var Y in l)V=l[Y],l.hasOwnProperty(Y)&&V!=null&&!o.hasOwnProperty(Y)&&St(n,s,Y,null,o,V);for(de in o)V=o[de],ee=l[de],!o.hasOwnProperty(de)||V===ee||V==null&&ee==null||St(n,s,de,V,o,ee)}function By(n){switch(n){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function Yk(){if(typeof performance.getEntriesByType=="function"){for(var n=0,s=0,l=performance.getEntriesByType("resource"),o=0;o<l.length;o++){var d=l[o],p=d.transferSize,b=d.initiatorType,k=d.duration;if(p&&k&&By(b)){for(b=0,k=d.responseEnd,o+=1;o<l.length;o++){var B=l[o],W=B.startTime;if(W>k)break;var ie=B.transferSize,de=B.initiatorType;ie&&By(de)&&(B=B.responseEnd,b+=ie*(B<k?1:(k-W)/(B-W)))}if(--o,s+=8*(p+b)/(d.duration/1e3),n++,10<n)break}}if(0<n)return s/n/1e6}return navigator.connection&&(n=navigator.connection.downlink,typeof n=="number")?n:5}var Qd=null,Zd=null;function Da(n){return n.nodeType===9?n:n.ownerDocument}function Ly(n){switch(n){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function zy(n,s){if(n===0)switch(s){case"svg":return 1;case"math":return 2;default:return 0}return n===1&&s==="foreignObject"?0:n}function Hy(n,s,l,o){return l=Da(l).createElement(n),l[fn]=o,l[Bn]=s,vn(l,n,s),nn(l),l}function Jd(n,s){return n==="textarea"||n==="noscript"||typeof s.children=="string"||typeof s.children=="number"||typeof s.children=="bigint"||typeof s.dangerouslySetInnerHTML=="object"&&s.dangerouslySetInnerHTML!==null&&s.dangerouslySetInnerHTML.__html!=null}var ef=null;function Wk(){var n=window.event;return n&&n.type==="popstate"?n===ef?!1:(ef=n,!0):(ef=null,!1)}var tf=typeof setTimeout=="function"?setTimeout:void 0,Xk=typeof clearTimeout=="function"?clearTimeout:void 0,Iy=typeof Promise=="function"?Promise:void 0,Uy=typeof requestAnimationFrame=="function"?requestAnimationFrame:tf,Gk=typeof queueMicrotask=="function"?queueMicrotask:typeof Iy<"u"?function(n){return Iy.resolve(null).then(n).catch(Qk)}:tf;function Qk(n){setTimeout(function(){throw n})}function Bs(n){return n==="head"}function Py(n,s){var l=s,o=0;do{var d=l.nextSibling;if(n.removeChild(l),d&&d.nodeType===8)if(l=d.data,l==="/$"||l==="/&"){if(o===0){n.removeChild(d),El(s);return}o--}else if(l==="$"||l==="$?"||l==="$~"||l==="$!"||l==="&")o++;else if(l==="html")uf(n.ownerDocument.documentElement);else if(l==="head"){l=n.ownerDocument.head,uf(l);for(var p=l.firstChild;p;){var b=p.nextSibling,k=p.nodeName;p[Wl]||k==="SCRIPT"||k==="STYLE"||k==="LINK"&&p.rel.toLowerCase()==="stylesheet"||l.removeChild(p),p=b}}else l==="body"&&uf(n.ownerDocument.body);l=d}while(l);El(s)}function qy(n,s){var l=n;n=0;do{var o=l.nextSibling;if(l.nodeType===1?s?(l._stashedDisplay=l.style.display,l.style.display="none"):(l.style.display=l._stashedDisplay||"",l.getAttribute("style")===""&&l.removeAttribute("style")):l.nodeType===3&&(s?(l._stashedText=l.nodeValue,l.nodeValue=""):l.nodeValue=l._stashedText||""),o&&o.nodeType===8)if(l=o.data,l==="/$"){if(n===0)break;n--}else l!=="$"&&l!=="$?"&&l!=="$~"&&l!=="$!"||n++;l=o}while(l)}function Fy(n,s,l){if(s=CSS.escape(s)!==s?"r-"+btoa(s).replace(/=/g,""):s,n.style.viewTransitionName=s,l!=null&&(n.style.viewTransitionClass=l),l=getComputedStyle(n),l.display==="inline"){if(s=n.getClientRects(),s.length===1)var o=1;else for(var d=o=0;d<s.length;d++){var p=s[d];0<p.width&&0<p.height&&o++}o===1&&(n=n.style,n.display=s.length===1?"inline-block":"block",n.marginTop="-"+l.paddingTop,n.marginBottom="-"+l.paddingBottom)}}function $y(n,s){n=n.style,s=s.style;var l=s!=null?s.hasOwnProperty("viewTransitionName")?s.viewTransitionName:s.hasOwnProperty("view-transition-name")?s["view-transition-name"]:null:null;n.viewTransitionName=l==null||typeof l=="boolean"?"":(""+l).trim(),l=s!=null?s.hasOwnProperty("viewTransitionClass")?s.viewTransitionClass:s.hasOwnProperty("view-transition-class")?s["view-transition-class"]:null:null,n.viewTransitionClass=l==null||typeof l=="boolean"?"":(""+l).trim(),n.display==="inline-block"&&(s==null?n.display=n.margin="":(l=s.display,n.display=l==null||typeof l=="boolean"?"":l,l=s.margin,l!=null?n.margin=l:(l=s.hasOwnProperty("marginTop")?s.marginTop:s["margin-top"],n.marginTop=l==null||typeof l=="boolean"?"":l,s=s.hasOwnProperty("marginBottom")?s.marginBottom:s["margin-bottom"],n.marginBottom=s==null||typeof s=="boolean"?"":s)))}function Zk(n,s,l){return l=l.ownerDocument.defaultView,{rect:n,abs:s.position==="absolute"||s.position==="fixed",clip:s.clipPath!=="none"||s.overflow!=="visible"||s.filter!=="none"||s.mask!=="none"||s.mask!=="none"||s.borderRadius!=="0px",view:0<=n.bottom&&0<=n.right&&n.top<=l.innerHeight&&n.left<=l.innerWidth}}function nf(n){var s=n.getBoundingClientRect(),l=getComputedStyle(n);return Zk(s,l,n)}function Jk(n){return n.documentElement.clientHeight}function eN(n){this.addEventListener("load",n),this.addEventListener("error",n)}function tN(n,s,l,o,d,p,b,k,B){var W=s.nodeType===9?s:s.ownerDocument;try{var ie=W.startViewTransition({update:function(){var V=W.defaultView,ee=V.navigation&&V.navigation.transition,je=W.fonts.status;o();var Le=[];if(je==="loaded"&&(Jk(W),W.fonts.status==="loading"&&Le.push(W.fonts.ready)),je=Le.length,n!==null)for(var Xe=n.suspenseyImages,Y=0,U=0;U<Xe.length;U++){var Z=Xe[U];if(!Z.complete){var ue=Z.getBoundingClientRect();if(0<ue.bottom&&0<ue.right&&ue.top<V.innerHeight&&ue.left<V.innerWidth){if(Y+=h0(Z),Y>Uc){Le.length=je;break}Z=new Promise(eN.bind(Z)),Le.push(Z)}}}if(0<Le.length)return V=Promise.race([Promise.all(Le),new Promise(function(Oe){return setTimeout(Oe,500)})]).then(d,d),(ee?Promise.allSettled([ee.finished,V]):V).then(p,p);if(d(),ee)return ee.finished.then(p,p);p()},types:l});W.__reactViewTransition=ie;var de=[];return ie.ready.then(function(){for(var V=W.documentElement.getAnimations({subtree:!0}),ee=0;ee<V.length;ee++){var je=V[ee],Le=je.effect,Xe=Le.pseudoElement;if(Xe!=null&&Xe.startsWith("::view-transition")){de.push(je),je=Le.getKeyframes();for(var Y=Xe=void 0,U=!0,Z=0;Z<je.length;Z++){var ue=je[Z],Oe=ue.width;if(Xe===void 0)Xe=Oe;else if(Xe!==Oe){U=!1;break}if(Oe=ue.height,Y===void 0)Y=Oe;else if(Y!==Oe){U=!1;break}delete ue.width,delete ue.height,ue.transform==="none"&&delete ue.transform}U&&Xe!==void 0&&Y!==void 0&&(Le.setKeyframes(je),U=getComputedStyle(Le.target,Le.pseudoElement),U.width!==Xe||U.height!==Y)&&(U=je[0],U.width=Xe,U.height=Y,U=je[je.length-1],U.width=Xe,U.height=Y,Le.setKeyframes(je))}}b()},function(V){W.__reactViewTransition===ie&&(W.__reactViewTransition=null);try{typeof V=="object"&&V!==null&&V.name==="InvalidStateError"&&(V.message==="View transition was skipped because document visibility state is hidden."||V.message==="Skipping view transition because document visibility state has become hidden."||V.message==="Skipping view transition because viewport size changed."||V.message==="Transition was aborted because of invalid state")&&(V=null),V!==null&&B(V)}finally{o(),d(),b()}}),ie.finished.finally(function(){for(var V=0;V<de.length;V++)de[V].cancel();W.__reactViewTransition===ie&&(W.__reactViewTransition=null),k()}),ie}catch{return o(),d(),b(),null}}function yr(n,s){this._scope=document.documentElement,this._selector="::view-transition-"+n+"("+s+")"}yr.prototype.animate=function(n,s){return s=typeof s=="number"?{duration:s}:O({},s),s.pseudoElement=this._selector,this._scope.animate(n,s)},yr.prototype.getAnimations=function(){for(var n=this._scope,s=this._selector,l=n.getAnimations({subtree:!0}),o=[],d=0;d<l.length;d++){var p=l[d].effect;p!==null&&p.target===n&&p.pseudoElement===s&&o.push(l[d])}return o},yr.prototype.getComputedStyle=function(){return getComputedStyle(this._scope,this._selector)};function Vy(n){return{name:n,group:new yr("group",n),imagePair:new yr("image-pair",n),old:new yr("old",n),new:new yr("new",n)}}function Zn(n){this._fragmentFiber=n,this._observers=this._eventListeners=null}Zn.prototype.addEventListener=function(n,s,l){var o=null,d=null;if(!(l!=null&&typeof l!="boolean"&&(o=l.signal||null,o!==null&&o.aborted))){this._eventListeners===null&&(this._eventListeners=[]);var p=this._eventListeners;if(Yy(p,n,s,l)===-1){var b=this,k=s;l!=null&&typeof l!="boolean"&&l.once===!0&&(k=function(B){b.removeEventListener(n,s,l),typeof s=="function"?s.call(this,B):s.handleEvent(B)}),o!==null&&(d=b.removeEventListener.bind(b,n,s,l),o.addEventListener("abort",d,{once:!0}),d=o.removeEventListener.bind(o,"abort",d)),o=bl(l),p.push({type:n,listener:s,optionsOrUseCapture:l,attachedListener:k,cleanup:d}),_(this._fragmentFiber.child,!1,nN,n,k,o)}this._eventListeners=p}};function nN(n,s,l,o){return j(n).addEventListener(s,l,o),!1}Zn.prototype.removeEventListener=function(n,s,l){var o=this._eventListeners;if(o!==null&&(s=Yy(o,n,s,l),s!==-1)){var d=o[s];l=d.attachedListener;var p=d.cleanup;d=bl(d.optionsOrUseCapture),_(this._fragmentFiber.child,!1,iN,n,l,d),o.splice(s,1),p!==null&&p()}};function iN(n,s,l,o){return j(n).removeEventListener(s,l,o),!1}function bl(n){return n!=null&&typeof n!="boolean"&&(n.once===!0||n.signal instanceof AbortSignal)?{capture:n.capture,passive:n.passive}:n}function Ky(n){return n==null?"c=0":typeof n=="boolean"?"c="+(n?"1":"0"):"c="+(n.capture?"1":"0")}function Yy(n,s,l,o){if(n.length===0)return-1;o=Ky(o);for(var d=0;d<n.length;d++){var p=n[d];if(p.type===s&&p.listener===l&&Ky(p.optionsOrUseCapture)===o)return d}return-1}Zn.prototype.dispatchEvent=function(n){var s=S(this._fragmentFiber);if(s===null)return!0;s=j(s);var l=this._eventListeners;if(l!==null&&0<l.length||!n.bubbles){var o=s.nodeType===9?s.createComment(""):document.createTextNode("");if(l)for(var d=0;d<l.length;d++){var p=l[d];o.addEventListener(p.type,p.attachedListener,bl(p.optionsOrUseCapture))}if(s.appendChild(o),n=o.dispatchEvent(n),l)for(d=0;d<l.length;d++)p=l[d],o.removeEventListener(p.type,p.attachedListener,bl(p.optionsOrUseCapture));return s.removeChild(o),n}return s.dispatchEvent(n)},Zn.prototype.focus=function(n){_(this._fragmentFiber.child,!0,Wy,n,void 0,void 0)};function Wy(n,s){return n.tag===6?!1:(n=j(n),pN(n,s))}Zn.prototype.focusLast=function(n){var s=[];_(this._fragmentFiber.child,!0,sf,s,void 0,void 0);for(var l=s.length-1;0<=l&&!Wy(s[l],n);l--);};function sf(n,s){return s.push(n),!1}Zn.prototype.blur=function(){var n=S(this._fragmentFiber);n!==null&&(n=j(n),n=Da(n).activeElement,n!==null&&_(this._fragmentFiber.child,!1,sN,n,void 0,void 0))};function sN(n,s){return n.tag===6?!1:(n=j(n),n===s||n.contains(s)?(s.blur(),!0):!1)}Zn.prototype.observeUsing=function(n){this._observers===null&&(this._observers=new Set),this._observers.add(n),_(this._fragmentFiber.child,!1,rN,n,void 0,void 0)};function rN(n,s){return n.tag===6||(n=j(n),s.observe(n)),!1}Zn.prototype.unobserveUsing=function(n){var s=this._observers;if(s!==null&&s.has(n)){s.delete(n),_(this._fragmentFiber.child,!1,lN,n,void 0,void 0);for(var l=s=0;l<wi.length;l++){var o=wi[l];o.fragmentInstance===this&&o.observer===n?n.unobserve(o.instance):wi[s++]=o}wi.length=s}};function lN(n,s){return n.tag===6||(n=j(n),s.unobserve(n)),!1}var wi=[],rf=!1;function aN(n,s,l){wi.push({fragmentInstance:n,observer:s,instance:l}),rf||(rf=!0,gN(function(){rf=!1;var o=wi;wi=[];for(var d=0;d<o.length;d++){var p=o[d];p.observer.unobserve(p.instance)}}))}Zn.prototype.getClientRects=function(){var n=[];return _(this._fragmentFiber.child,!1,oN,n,void 0,void 0),n};function oN(n,s){if(n.tag===6){n=n.stateNode;var l=n.ownerDocument.createRange();l.selectNodeContents(n),s.push.apply(s,l.getClientRects())}else n=j(n),s.push.apply(s,n.getClientRects());return!1}Zn.prototype.getRootNode=function(n){var s=S(this._fragmentFiber);return s===null?this:j(s).getRootNode(n)},Zn.prototype.compareDocumentPosition=function(n){var s=S(this._fragmentFiber);if(s===null)return Node.DOCUMENT_POSITION_DISCONNECTED;var l=[];_(this._fragmentFiber.child,!1,sf,l,void 0,void 0);var o=j(s);if(l.length===0){if(l=o,y(this._fragmentFiber)){e:{for(s=this._fragmentFiber.return;s!==null;){if(s.tag===4){s=s.stateNode.containerInfo;break e}if(s.tag===3||s.tag===5||s.tag===27)break;s=s.return}s=null}s!=null&&(l=s)}s=this._fragmentFiber;var d=o=l.compareDocumentPosition(n);return l===n?d=Node.DOCUMENT_POSITION_CONTAINS:o&Node.DOCUMENT_POSITION_CONTAINED_BY&&(l=x(s)[1],l===null?d=Node.DOCUMENT_POSITION_PRECEDING:(n=j(l).compareDocumentPosition(n),d=n===0||n&Node.DOCUMENT_POSITION_FOLLOWING?Node.DOCUMENT_POSITION_FOLLOWING:Node.DOCUMENT_POSITION_PRECEDING)),d|=Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC}s=j(l[0]),d=j(l[l.length-1]);var p=y(this._fragmentFiber)?s.parentElement:o;if(p==null)return Node.DOCUMENT_POSITION_DISCONNECTED;o=p.compareDocumentPosition(s)&Node.DOCUMENT_POSITION_CONTAINED_BY,p=p.compareDocumentPosition(d)&Node.DOCUMENT_POSITION_CONTAINED_BY;var b=s.compareDocumentPosition(n),k=d.compareDocumentPosition(n),B=b&Node.DOCUMENT_POSITION_CONTAINED_BY||k&Node.DOCUMENT_POSITION_CONTAINED_BY;return k=o&&p&&b&Node.DOCUMENT_POSITION_FOLLOWING&&k&Node.DOCUMENT_POSITION_PRECEDING,s=o&&s===n||p&&d===n||B||k?Node.DOCUMENT_POSITION_CONTAINED_BY:!o&&s===n||!p&&d===n?Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC:b,s&Node.DOCUMENT_POSITION_DISCONNECTED||s&Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC||cN(s,this._fragmentFiber,l[0],l[l.length-1],n)?s:Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC};function cN(n,s,l,o,d){var p=Zs(d);if(n&Node.DOCUMENT_POSITION_CONTAINED_BY){if(l=!!p)e:{for(;p!==null;){if(p.tag===7&&(p===s||p.alternate===s)){l=!0;break e}p=p.return}l=!1}return l}if(n&Node.DOCUMENT_POSITION_CONTAINS){if(p===null)return p=d.ownerDocument,d===p||d===p.documentElement||d===p.body;e:{for(p=s,s=S(s);p!==null;){if(!(p.tag!==5&&p.tag!==3&&p.tag!==27||p!==s&&p.alternate!==s)){p=!0;break e}p=p.return}p=!1}return p}return n&Node.DOCUMENT_POSITION_PRECEDING?((s=!!p)&&!(s=p===l)&&(s=H(l,p,I),s===null?s=!1:(_(s,!0,A,p,l),p=N,N=null,s=p!==null)),s):n&Node.DOCUMENT_POSITION_FOLLOWING?((s=!!p)&&!(s=p===o)&&(s=H(o,p,I),s===null?s=!1:(_(s,!0,R,p,o),p=N,M=N=null,s=p!==null)),s):!1}function Xy(n,s){var l=n.ownerDocument.createRange();l.selectNodeContents(n),n=l.getBoundingClientRect(),window.scrollTo(window.scrollX+n.left,s?window.scrollY+n.top:window.scrollY+n.bottom-window.innerHeight)}Zn.prototype.scrollIntoView=function(n){if(typeof n=="object")throw Error(r(566));var s=[];_(this._fragmentFiber.child,!1,sf,s,void 0,void 0);var l=n!==!1;if(s.length===0){var o=x(this._fragmentFiber);if(o=l?o[1]||o[0]||S(this._fragmentFiber):o[0]||o[1],o===null)return;if(o.tag===6){n=j(o),Xy(n,l);return}if(o=j(o),o.nodeType!==9){if(o.nodeType===11){l="host"in o?o.host:null,l!==null&&l.scrollIntoView(n);return}o.scrollIntoView(n)}}for(o=l?s.length-1:0;o!==(l?-1:s.length);){var d=s[o];d.tag===6?(d=j(d),Xy(d,l)):j(d).scrollIntoView(n),o+=l?-1:1}};function uN(n,s){return n=j(n),Gy(n,s),!1}function Gy(n,s){n.reactFragments==null&&(n.reactFragments=new Set),n.reactFragments.add(s)}function Qy(n,s){var l=s._eventListeners;if(l!==null)for(var o=0;o<l.length;o++){var d=l[o];n.addEventListener(d.type,d.attachedListener,bl(d.optionsOrUseCapture))}n.nodeType!==3&&(l=s._observers,l!==null&&l.forEach(function(p){for(var b=0,k=0;k<wi.length;k++){var B=wi[k];(B.fragmentInstance!==s||B.observer!==p||B.instance!==n)&&(wi[b++]=B)}wi.length=b,p.observe(n)}),Gy(n,s))}function hN(n,s){var l=s._eventListeners;if(l!==null)for(var o=0;o<l.length;o++){var d=l[o];n.removeEventListener(d.type,d.attachedListener,bl(d.optionsOrUseCapture))}n.nodeType!==3&&(l=s._observers,l!==null&&l.forEach(function(p){typeof p.rootMargin=="string"?aN(s,p,n):p.unobserve(n)}),n.reactFragments!=null&&n.reactFragments.delete(s))}function lf(n){var s=n.firstChild;for(s&&s.nodeType===10&&(s=s.nextSibling);s;){var l=s;switch(s=s.nextSibling,l.nodeName){case"HTML":case"HEAD":case"BODY":lf(l),jo(l);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(l.rel.toLowerCase()==="stylesheet")continue}n.removeChild(l)}}function dN(n,s,l,o){for(;n.nodeType===1;){var d=l;if(n.nodeName.toLowerCase()!==s.toLowerCase()){if(!o&&(n.nodeName!=="INPUT"||n.type!=="hidden"))break}else if(o){if(!n[Wl])switch(s){case"meta":if(!n.hasAttribute("itemprop"))break;return n;case"link":if(p=n.getAttribute("rel"),p==="stylesheet"&&n.hasAttribute("data-precedence"))break;if(p!==d.rel||n.getAttribute("href")!==(d.href==null||d.href===""?null:d.href)||n.getAttribute("crossorigin")!==(d.crossOrigin==null?null:d.crossOrigin)||n.getAttribute("title")!==(d.title==null?null:d.title))break;return n;case"style":if(n.hasAttribute("data-precedence"))break;return n;case"script":if(p=n.getAttribute("src"),(p!==(d.src==null?null:d.src)||n.getAttribute("type")!==(d.type==null?null:d.type)||n.getAttribute("crossorigin")!==(d.crossOrigin==null?null:d.crossOrigin))&&p&&n.hasAttribute("async")&&!n.hasAttribute("itemprop"))break;return n;default:return n}}else if(s==="input"&&n.type==="hidden"){var p=d.name==null?null:""+d.name;if(d.type==="hidden"&&n.getAttribute("name")===p)return n}else return n;if(n=ui(n.nextSibling),n===null)break}return null}function fN(n,s,l){if(s==="")return null;for(;n.nodeType!==3;)if((n.nodeType!==1||n.nodeName!=="INPUT"||n.type!=="hidden")&&!l||(n=ui(n.nextSibling),n===null))return null;return n}function Zy(n,s){for(;n.nodeType!==8;)if((n.nodeType!==1||n.nodeName!=="INPUT"||n.type!=="hidden")&&!s||(n=ui(n.nextSibling),n===null))return null;return n}function af(n){return n.data==="$?"||n.data==="$~"}function of(n){return n.data==="$!"||n.data==="$?"&&n.ownerDocument.readyState!=="loading"}function mN(n,s){var l=n.ownerDocument;if(n.data==="$~")n._reactRetry=s;else if(n.data!=="$?"||l.readyState!=="loading")s();else{var o=function(){s(),l.removeEventListener("DOMContentLoaded",o)};l.addEventListener("DOMContentLoaded",o),n._reactRetry=o}}function ui(n){for(;n!=null;n=n.nextSibling){var s=n.nodeType;if(s===1||s===3)break;if(s===8){if(s=n.data,s==="$"||s==="$!"||s==="$?"||s==="$~"||s==="&"||s==="F!"||s==="F")break;if(s==="/$"||s==="/&")return null}}return n}var cf=null;function Jy(n){n=n.nextSibling;for(var s=0;n;){if(n.nodeType===8){var l=n.data;if(l==="/$"||l==="/&"){if(s===0)return ui(n.nextSibling);s--}else l!=="$"&&l!=="$!"&&l!=="$?"&&l!=="$~"&&l!=="&"||s++}n=n.nextSibling}return null}function e0(n){n=n.previousSibling;for(var s=0;n;){if(n.nodeType===8){var l=n.data;if(l==="$"||l==="$!"||l==="$?"||l==="$~"||l==="&"){if(s===0)return n;s--}else l!=="/$"&&l!=="/&"||s++}n=n.previousSibling}return null}function pN(n,s){function l(){o=!0}if(n.ownerDocument.activeElement===n)return!0;var o=!1;try{n.ownerDocument.addEventListener("focus",l,!0),(n.focus||HTMLElement.prototype.focus).call(n,s)}finally{n.ownerDocument.removeEventListener("focus",l,!0)}return o}function gN(n){Uy(function(){Uy(function(s){return n(s)})})}function t0(n,s,l){switch(s=Da(l),n){case"html":if(n=s.documentElement,!n)throw Error(r(452));return n;case"head":if(n=s.head,!n)throw Error(r(453));return n;case"body":if(n=s.body,!n)throw Error(r(454));return n;default:throw Error(r(451))}}function n0(n,s,l){for(var o in l){var d=l[o];l.hasOwnProperty(o)&&d!=null&&St(n,s,o,null,Vk,d)}l.dangerouslySetInnerHTML!=null&&(n.textContent=""),n.onclick===Ei&&(n.onclick=null),jo(n)}function uf(n){for(var s=n.attributes;s.length;)n.removeAttributeNode(s[0]);jo(n)}var hi=new Map,i0=new Set;function Ma(n){if(typeof n.getRootNode=="function"){var s=n.getRootNode();if(s.nodeType===9||s.nodeType===11)return s}return n.nodeType===9?n:n.ownerDocument}var os=ye.d;ye.d={f:_N,r:vN,D:yN,C:SN,L:bN,m:xN,X:CN,S:wN,M:kN};function _N(){var n=os.f(),s=Mc();return n||s}function vN(n){var s=Ur(n);s!==null&&s.tag===5&&s.type==="form"?rv(s):os.r(n)}var xl=typeof document>"u"?null:document;function s0(n,s,l){var o=xl;if(o&&typeof s=="string"&&s){var d=ii(s);d='link[rel="'+n+'"][href="'+d+'"]',typeof l=="string"&&(d+='[crossorigin="'+l+'"]'),i0.has(d)||(i0.add(d),n={rel:n,crossOrigin:l,href:s},o.querySelector(d)===null&&(s=o.createElement("link"),vn(s,"link",n),nn(s),o.head.appendChild(s)))}}function yN(n){os.D(n),s0("dns-prefetch",n,null)}function SN(n,s){os.C(n,s),s0("preconnect",n,s)}function bN(n,s,l){os.L(n,s,l);var o=xl;if(o&&n&&s){var d='link[rel="preload"][as="'+ii(s)+'"]';s==="image"&&l&&l.imageSrcSet?(d+='[imagesrcset="'+ii(l.imageSrcSet)+'"]',typeof l.imageSizes=="string"&&(d+='[imagesizes="'+ii(l.imageSizes)+'"]')):d+='[href="'+ii(n)+'"]';var p=d;switch(s){case"style":p=wl(n);break;case"script":p=Cl(n)}if(!(hi.has(p)||(n=O({rel:"preload",href:s==="image"&&l&&l.imageSrcSet?void 0:n,as:s},l),hi.set(p,n),o.querySelector(d)!==null||s==="style"&&o.querySelector(Aa(p))||s==="script"&&o.querySelector(Ra(p))))){var b=o.createElement("link");vn(b,"link",n),s==="style"&&(b[Eo]=!0,b.onload=b.onerror=function(){_g(b)}),nn(b),o.head.appendChild(b)}}}function xN(n,s){os.m(n,s);var l=xl;if(l&&n){var o=s&&typeof s.as=="string"?s.as:"script",d='link[rel="modulepreload"][as="'+ii(o)+'"][href="'+ii(n)+'"]',p=d;switch(o){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":p=Cl(n)}if(!hi.has(p)&&(n=O({rel:"modulepreload",href:n},s),hi.set(p,n),l.querySelector(d)===null)){switch(o){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(l.querySelector(Ra(p)))return}o=l.createElement("link"),vn(o,"link",n),nn(o),l.head.appendChild(o)}}}function wN(n,s,l){os.S(n,s,l);var o=xl;if(o&&n){var d=Pr(o).hoistableStyles,p=wl(n);s=s||"default";var b=d.get(p);if(!b){var k={loading:0,preload:null};if(b=o.querySelector(Aa(p)))k.loading=5;else{n=O({rel:"stylesheet",href:n,"data-precedence":s},l),(l=hi.get(p))&&hf(n,l);var B=b=o.createElement("link");nn(B),vn(B,"link",n),B._p=new Promise(function(W,ie){B.onload=W,B.onerror=ie}),B.addEventListener("load",function(){k.loading|=1}),B.addEventListener("error",function(){k.loading|=2}),k.loading|=4,Hc(b,s,o)}b={type:"stylesheet",instance:b,count:1,state:k},d.set(p,b)}}}function CN(n,s){os.X(n,s);var l=xl;if(l&&n){var o=Pr(l).hoistableScripts,d=Cl(n),p=o.get(d);p||(p=l.querySelector(Ra(d)),p||(n=O({src:n,async:!0},s),(s=hi.get(d))&&df(n,s),p=l.createElement("script"),nn(p),vn(p,"link",n),l.head.appendChild(p)),p={type:"script",instance:p,count:1,state:null},o.set(d,p))}}function kN(n,s){os.M(n,s);var l=xl;if(l&&n){var o=Pr(l).hoistableScripts,d=Cl(n),p=o.get(d);p||(p=l.querySelector(Ra(d)),p||(n=O({src:n,async:!0,type:"module"},s),(s=hi.get(d))&&df(n,s),p=l.createElement("script"),nn(p),vn(p,"link",n),l.head.appendChild(p)),p={type:"script",instance:p,count:1,state:null},o.set(d,p))}}function r0(n,s,l,o){var d=(d=Te.current)?Ma(d):null;if(!d)throw Error(r(446));switch(n){case"meta":case"title":return null;case"style":return typeof l.precedence=="string"&&typeof l.href=="string"?(l=wl(l.href),s=Pr(d).hoistableStyles,o=s.get(l),o||(o={type:"style",instance:null,count:0,state:null},s.set(l,o)),o):{type:"void",instance:null,count:0,state:null};case"link":if(l.rel==="stylesheet"&&typeof l.href=="string"&&typeof l.precedence=="string"){n=wl(l.href);var p=Pr(d).hoistableStyles,b=p.get(n);if(b||(d=d.ownerDocument||d,b={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},p.set(n,b),(p=d.querySelector(Aa(n)))?p._p||(b.instance=p,b.state.loading=5):(p=hi.get(n),p||(p={rel:"preload",as:"style",href:l.href,crossOrigin:l.crossOrigin,integrity:l.integrity,media:l.media,hrefLang:l.hrefLang,referrerPolicy:l.referrerPolicy},hi.set(n,p)),NN(d,n,p,b.state))),s&&o===null)throw Error(r(528,""));return b}if(s&&o!==null)throw Error(r(529,""));return null;case"script":return s=l.async,l=l.src,typeof l=="string"&&s&&typeof s!="function"&&typeof s!="symbol"?(l=Cl(l),s=Pr(d).hoistableScripts,o=s.get(l),o||(o={type:"script",instance:null,count:0,state:null},s.set(l,o)),o):{type:"void",instance:null,count:0,state:null};default:throw Error(r(444,n))}}function wl(n){return'href="'+ii(n)+'"'}function Aa(n){return'link[rel="stylesheet"]['+n+"]"}function l0(n){return O({},n,{"data-precedence":n.precedence,precedence:null})}function NN(n,s,l,o){if(s=n.querySelector('link[rel="preload"][as="style"]['+s+"]")){if(s[Eo]!==!0){o.loading=1;return}}else s=n.createElement("link"),s[Eo]=!0,s.onload=s.onerror=_g.bind(null,s),vn(s,"link",l),nn(s),n.head.appendChild(s);o.preload=s,s.addEventListener("load",function(){return o.loading|=1}),s.addEventListener("error",function(){return o.loading|=2})}function Cl(n){return'[src="'+ii(n)+'"]'}function Ra(n){return"script[async]"+n}function a0(n,s,l){if(s.count++,s.instance===null)switch(s.type){case"style":var o=n.querySelector('style[data-href~="'+ii(l.href)+'"]');if(o)return s.instance=o,nn(o),o;var d=O({},l,{"data-href":l.href,"data-precedence":l.precedence,href:null,precedence:null});return o=(n.ownerDocument||n).createElement("style"),nn(o),vn(o,"style",d),Hc(o,l.precedence,n),s.instance=o;case"stylesheet":d=wl(l.href);var p=n.querySelector(Aa(d));if(p)return s.state.loading|=4,s.instance=p,nn(p),p;o=l0(l),(d=hi.get(d))&&hf(o,d),p=(n.ownerDocument||n).createElement("link"),nn(p);var b=p;return b._p=new Promise(function(k,B){b.onload=k,b.onerror=B}),vn(p,"link",o),s.state.loading|=4,Hc(p,l.precedence,n),s.instance=p;case"script":return p=Cl(l.src),(d=n.querySelector(Ra(p)))?(s.instance=d,nn(d),d):(o=l,(d=hi.get(p))&&(o=O({},l),df(o,d)),n=n.ownerDocument||n,d=n.createElement("script"),nn(d),vn(d,"link",o),n.head.appendChild(d),s.instance=d);case"void":return null;default:throw Error(r(443,s.type))}else s.type==="stylesheet"&&(s.state.loading&4)===0&&(o=s.instance,s.state.loading|=4,Hc(o,l.precedence,n));return s.instance}function Hc(n,s,l){for(var o=l.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),d=o.length?o[o.length-1]:null,p=d,b=0;b<o.length;b++){var k=o[b];if(k.dataset.precedence===s)p=k;else if(p!==d)break}p?p.parentNode.insertBefore(n,p.nextSibling):(s=l.nodeType===9?l.head:l,s.insertBefore(n,s.firstChild))}function hf(n,s){n.crossOrigin==null&&(n.crossOrigin=s.crossOrigin),n.referrerPolicy==null&&(n.referrerPolicy=s.referrerPolicy),n.title==null&&(n.title=s.title)}function df(n,s){n.crossOrigin==null&&(n.crossOrigin=s.crossOrigin),n.referrerPolicy==null&&(n.referrerPolicy=s.referrerPolicy),n.integrity==null&&(n.integrity=s.integrity)}var Ic=null;function o0(n,s,l){if(Ic===null){var o=new Map,d=Ic=new Map;d.set(l,o)}else d=Ic,o=d.get(l),o||(o=new Map,d.set(l,o));if(o.has(n))return o;for(o.set(n,null),l=l.getElementsByTagName(n),d=0;d<l.length;d++){var p=l[d];if(!(p[Wl]||p[fn]||n==="link"&&p.getAttribute("rel")==="stylesheet")&&p.namespaceURI!=="http://www.w3.org/2000/svg"){var b=p.getAttribute(s)||"";b=n+b;var k=o.get(b);k?k.push(p):o.set(b,[p])}}return o}function ff(n,s,l){n=n.ownerDocument||n,n.head.insertBefore(l,s==="title"?n.querySelector("head > title"):null)}function EN(n,s,l){if(l===1||s.itemProp!=null)return!1;switch(n){case"meta":case"title":return!0;case"style":if(typeof s.precedence!="string"||typeof s.href!="string"||s.href==="")break;return!0;case"link":if(typeof s.rel!="string"||typeof s.href!="string"||s.href===""||s.onLoad||s.onError)break;return s.rel==="stylesheet"?(n=s.disabled,typeof s.precedence=="string"&&n==null):!0;case"script":if(s.async&&typeof s.async!="function"&&typeof s.async!="symbol"&&!s.onLoad&&!s.onError&&s.src&&typeof s.src=="string")return!0}return!1}function c0(n,s){return n==="img"&&s.src!=null&&s.src!==""&&s.onLoad==null&&s.loading!=="lazy"}function u0(n){return!(n.type==="stylesheet"&&(n.state.loading&3)===0)}function h0(n){return(n.width||100)*(n.height||100)*(typeof devicePixelRatio=="number"?devicePixelRatio:1)*.25}function d0(n,s){typeof s.decode=="function"&&(n.imgCount++,s.complete||(n.imgBytes+=h0(s),n.suspenseyImages.push(s)),n=DN.bind(n),s.decode().then(n,n))}function jN(n,s,l,o){if(l.type==="stylesheet"&&(typeof o.media!="string"||matchMedia(o.media).matches!==!1)&&(l.state.loading&4)===0){if(l.instance===null){var d=wl(o.href),p=s.querySelector(Aa(d));if(p){s=p._p,s!==null&&typeof s=="object"&&typeof s.then=="function"&&(n.count++,n=Oa.bind(n),s.then(n,n)),l.state.loading|=4,l.instance=p,nn(p);return}p=s.ownerDocument||s,o=l0(o),(d=hi.get(d))&&hf(o,d),p=p.createElement("link"),nn(p);var b=p;b._p=new Promise(function(k,B){b.onload=k,b.onerror=B}),vn(p,"link",o),l.instance=p}n.stylesheets===null&&(n.stylesheets=new Map),n.stylesheets.set(l,s),(s=l.state.preload)&&(l.state.loading&3)===0&&(n.count++,l=Oa.bind(n),s.addEventListener("load",l),s.addEventListener("error",l))}}var Uc=0;function TN(n,s){return n.stylesheets&&n.count===0&&qc(n,n.stylesheets),0<n.count||0<n.imgCount?function(l){var o=setTimeout(function(){if(n.stylesheets&&qc(n,n.stylesheets),n.unsuspend){var p=n.unsuspend;n.unsuspend=null,p()}},6e4+s);0<n.imgBytes&&Uc===0&&(Uc=62500*Yk());var d=setTimeout(function(){if(n.waitingForImages=!1,n.count===0&&(n.stylesheets&&qc(n,n.stylesheets),n.unsuspend)){var p=n.unsuspend;n.unsuspend=null,p()}},(n.imgBytes>Uc?50:800)+s);return n.unsuspend=l,function(){n.unsuspend=null,clearTimeout(o),clearTimeout(d)}}:null}function f0(n){if(n.count===0&&(n.imgCount===0||!n.waitingForImages)){if(n.stylesheets)qc(n,n.stylesheets);else if(n.unsuspend){var s=n.unsuspend;n.unsuspend=null,s()}}}function Oa(){this.count--,f0(this)}function DN(){this.imgCount--,f0(this)}var Pc=null;function qc(n,s){n.stylesheets=null,n.unsuspend!==null&&(n.count++,Pc=new Map,s.forEach(MN,n),Pc=null,Oa.call(n))}function MN(n,s){if(!(s.state.loading&4)){var l=Pc.get(n);if(l)var o=l.get(null);else{l=new Map,Pc.set(n,l);for(var d=n.querySelectorAll("link[data-precedence],style[data-precedence]"),p=0;p<d.length;p++){var b=d[p];(b.nodeName==="LINK"||b.getAttribute("media")!=="not all")&&(l.set(b.dataset.precedence,b),o=b)}o&&l.set(null,o)}d=s.instance,b=d.getAttribute("data-precedence"),p=l.get(b)||o,p===o&&l.set(null,d),l.set(b,d),this.count++,o=Oa.bind(this),d.addEventListener("load",o),d.addEventListener("error",o),p?p.parentNode.insertBefore(d,p.nextSibling):(n=n.nodeType===9?n.head:n,n.insertBefore(d,n.firstChild)),s.state.loading|=4}}var kl={$$typeof:K,Provider:null,Consumer:null,_currentValue:Ne,_currentValue2:Ne,_threadCount:0};function AN(n,s,l,o,d,p,b,k,B){this.tag=1,this.containerInfo=n,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=Ku(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Ku(0),this.hiddenUpdates=Ku(null),this.identifierPrefix=o,this.onUncaughtError=d,this.onCaughtError=p,this.onRecoverableError=b,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=B,this.transitionTypes=null,this.incompleteTransitions=new Map}function m0(n,s,l,o,d,p,b,k,B,W,ie,de){return n=new AN(n,s,l,b,B,W,ie,de,k),s=1,p===!0&&(s|=24),p=Ln(3,null,null,s),n.current=p,p.stateNode=n,s=Eh(),s.refCount++,n.pooledCache=s,s.refCount++,p.memoizedState={element:o,isDehydrated:l,cache:s},Mh(p),n}function p0(n){return n?(n=Qr,n):Qr}function g0(n,s,l,o,d,p){d=p0(d),o.context===null?o.context=d:o.pendingContext=d,o=ws(s),o.payload={element:l},p=p===void 0?null:p,p!==null&&(o.callback=p),l=Cs(n,o,s),l!==null&&(Un(l,n,s),ha(l,n,s))}function _0(n,s){if(n=n.memoizedState,n!==null&&n.dehydrated!==null){var l=n.retryLane;n.retryLane=l!==0&&l<s?l:s}}function mf(n,s){_0(n,s),(n=n.alternate)&&_0(n,s)}function v0(n){if(n.tag===13||n.tag===31){var s=nr(n,67108864);s!==null&&Un(s,n,67108864),mf(n,67108864)}}function y0(n){if(n.tag===13||n.tag===31){var s=Qn();s=Yu(s);var l=nr(n,s);l!==null&&Un(l,n,s),mf(n,s)}}var Nl=!0;function RN(n,s,l,o){var d=oe.T;oe.T=null;var p=ye.p;try{ye.p=2,pf(n,s,l,o)}finally{ye.p=p,oe.T=d}}function ON(n,s,l,o){var d=oe.T;oe.T=null;var p=ye.p;try{ye.p=8,pf(n,s,l,o)}finally{ye.p=p,oe.T=d}}function pf(n,s,l,o){if(Nl){var d=gf(o);if(d===null)Xd(n,s,o,Fc,l),b0(n,o);else if(LN(d,n,s,l,o))o.stopPropagation();else if(b0(n,o),s&4&&-1<BN.indexOf(n)){for(;d!==null;){var p=Ur(d);if(p!==null)switch(p.tag){case 3:if(p=p.stateNode,p.current.memoizedState.isDehydrated){var b=Qs(p.pendingLanes);if(b!==0){var k=p;for(k.pendingLanes|=2,k.entangledLanes|=2;b;){var B=1<<31-dn(b);k.entanglements[1]|=B,b&=~B}zi(p),(mt&6)===0&&(jc=Ft()+500,Ea(0))}}break;case 31:case 13:k=nr(p,2),k!==null&&Un(k,p,2),Mc(),mf(p,2)}if(p=gf(o),p===null&&Xd(n,s,o,Fc,l),p===d)break;d=p}d!==null&&o.stopPropagation()}else Xd(n,s,o,null,l)}}function gf(n){return n=eh(n),_f(n)}var Fc=null;function _f(n){if(Fc=null,n=Zs(n),n!==null){var s=c(n);if(s===null)n=null;else{var l=s.tag;if(l===13){if(n=h(s),n!==null)return n;n=null}else if(l===31){if(n=f(s),n!==null)return n;n=null}else if(l===3){if(s.stateNode.current.memoizedState.isDehydrated)return s.tag===3?s.stateNode.containerInfo:null;n=null}else s!==n&&(n=null)}}return Fc=n,null}function S0(n){switch(n){case"beforetoggle":case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"seeked":case"submit":case"toggle":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"fullscreenerror":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 2;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"resize":case"scroll":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 8;case"message":switch(tn()){case _i:return 2;case Nn:return 8;case Hr:case he:return 32;case Ae:return 268435456;default:return 32}default:return 32}}var vf=!1,Ls=null,zs=null,Hs=null,Ba=new Map,La=new Map,Is=[],BN="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 b0(n,s){switch(n){case"focusin":case"focusout":Ls=null;break;case"dragenter":case"dragleave":zs=null;break;case"mouseover":case"mouseout":Hs=null;break;case"pointerover":case"pointerout":Ba.delete(s.pointerId);break;case"gotpointercapture":case"lostpointercapture":La.delete(s.pointerId)}}function za(n,s,l,o,d,p){return n===null||n.nativeEvent!==p?(n={blockedOn:s,domEventName:l,eventSystemFlags:o,nativeEvent:p,targetContainers:[d]},s!==null&&(s=Ur(s),s!==null&&v0(s)),n):(n.eventSystemFlags|=o,s=n.targetContainers,d!==null&&s.indexOf(d)===-1&&s.push(d),n)}function LN(n,s,l,o,d){switch(s){case"focusin":return Ls=za(Ls,n,s,l,o,d),!0;case"dragenter":return zs=za(zs,n,s,l,o,d),!0;case"mouseover":return Hs=za(Hs,n,s,l,o,d),!0;case"pointerover":var p=d.pointerId;return Ba.set(p,za(Ba.get(p)||null,n,s,l,o,d)),!0;case"gotpointercapture":return p=d.pointerId,La.set(p,za(La.get(p)||null,n,s,l,o,d)),!0}return!1}function x0(n){var s=Zs(n.target);if(s!==null){var l=c(s);if(l!==null){if(s=l.tag,s===13){if(s=h(l),s!==null){n.blockedOn=s,mg(n.priority,function(){y0(l)});return}}else if(s===31){if(s=f(l),s!==null){n.blockedOn=s,mg(n.priority,function(){y0(l)});return}}else if(s===3&&l.stateNode.current.memoizedState.isDehydrated){n.blockedOn=l.tag===3?l.stateNode.containerInfo:null;return}}}n.blockedOn=null}function $c(n){if(n.blockedOn!==null)return!1;for(var s=n.targetContainers;0<s.length;){var l=gf(n.nativeEvent);if(l===null){l=n.nativeEvent;var o=new l.constructor(l.type,l);Ju=o,l.target.dispatchEvent(o),Ju=null}else return s=Ur(l),s!==null&&v0(s),n.blockedOn=l,!1;s.shift()}return!0}function w0(n,s,l){$c(n)&&l.delete(s)}function zN(){vf=!1,Ls!==null&&$c(Ls)&&(Ls=null),zs!==null&&$c(zs)&&(zs=null),Hs!==null&&$c(Hs)&&(Hs=null),Ba.forEach(w0),La.forEach(w0)}function Vc(n,s){n.blockedOn===s&&(n.blockedOn=null,vf||(vf=!0,e.unstable_scheduleCallback(e.unstable_NormalPriority,zN)))}var Kc=null;function C0(n){Kc!==n&&(Kc=n,e.unstable_scheduleCallback(e.unstable_NormalPriority,function(){Kc===n&&(Kc=null);for(var s=0;s<n.length;s+=3){var l=n[s],o=n[s+1],d=n[s+2];if(typeof o!="function"){if(_f(o||l)===null)continue;break}var p=Ur(l);p!==null&&(n.splice(s,3),s-=3,Zh(p,{pending:!0,data:d,method:l.method,action:o},o,d))}}))}function El(n){function s(B){return Vc(B,n)}Ls!==null&&Vc(Ls,n),zs!==null&&Vc(zs,n),Hs!==null&&Vc(Hs,n),Ba.forEach(s),La.forEach(s);for(var l=0;l<Is.length;l++){var o=Is[l];o.blockedOn===n&&(o.blockedOn=null)}for(;0<Is.length&&(l=Is[0],l.blockedOn===null);)x0(l),l.blockedOn===null&&Is.shift();if(l=(n.ownerDocument||n).$$reactFormReplay,l!=null)for(o=0;o<l.length;o+=3){var d=l[o],p=l[o+1],b=d[Bn]||null;if(typeof p=="function")b||C0(l);else if(b){var k=null;if(p&&p.hasAttribute("formAction")){if(d=p,b=p[Bn]||null)k=b.formAction;else if(_f(d)!==null)continue}else k=b.action;typeof k=="function"?l[o+1]=k:(l.splice(o,3),o-=3),C0(l)}}}function k0(){function n(p){p.canIntercept&&p.info==="react-transition"&&p.intercept({handler:function(){return new Promise(function(b){return d=b})},focusReset:"manual",scroll:"manual"})}function s(){d!==null&&(d(),d=null),o||setTimeout(l,20)}function l(){if(!o&&!navigation.transition){var p=navigation.currentEntry;p&&p.url!=null&&navigation.navigate(p.url,{state:p.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var o=!1,d=null;return navigation.addEventListener("navigate",n),navigation.addEventListener("navigatesuccess",s),navigation.addEventListener("navigateerror",s),setTimeout(l,100),function(){o=!0,navigation.removeEventListener("navigate",n),navigation.removeEventListener("navigatesuccess",s),navigation.removeEventListener("navigateerror",s),d!==null&&(d(),d=null)}}}function yf(n){this._internalRoot=n}Yc.prototype.render=yf.prototype.render=function(n){var s=this._internalRoot;if(s===null)throw Error(r(409));var l=s.current,o=Qn();g0(l,o,n,s,null,null)},Yc.prototype.unmount=yf.prototype.unmount=function(){var n=this._internalRoot;if(n!==null){this._internalRoot=null;var s=n.containerInfo;g0(n.current,2,null,n,null,null),Mc(),s[Ir]=null}};function Yc(n){this._internalRoot=n}Yc.prototype.unstable_scheduleHydration=function(n){if(n){var s=fg();n={blockedOn:null,target:n,priority:s};for(var l=0;l<Is.length&&s!==0&&s<Is[l].priority;l++);Is.splice(l,0,n),l===0&&x0(n)}};var N0=t.version;if(N0!=="19.3.1")throw Error(r(527,N0,"19.3.1"));ye.findDOMNode=function(n){var s=n._reactInternals;if(s===void 0)throw typeof n.render=="function"?Error(r(188)):(n=Object.keys(n).join(","),Error(r(268,n)));return n=m(s),n=n!==null?v(n):null,n=n===null?null:n.stateNode,n};var HN={bundleType:0,version:"19.3.1",rendererPackageName:"react-dom",currentDispatcherRef:oe,reconcilerVersion:"19.3.1"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Wc=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Wc.isDisabled&&Wc.supportsFiber)try{En=Wc.inject(HN),Ue=Wc}catch{}}return Ia.createRoot=function(n,s){if(!a(n))throw Error(r(299));var l=!1,o="",d=pv,p=gv,b=_v;return s!=null&&(s.unstable_strictMode===!0&&(l=!0),s.identifierPrefix!==void 0&&(o=s.identifierPrefix),s.onUncaughtError!==void 0&&(d=s.onUncaughtError),s.onCaughtError!==void 0&&(p=s.onCaughtError),s.onRecoverableError!==void 0&&(b=s.onRecoverableError)),s=m0(n,1,!1,null,null,l,o,null,d,p,b,k0),n[Ir]=s.current,Wd(n),new yf(s)},Ia.hydrateRoot=function(n,s,l){if(!a(n))throw Error(r(299));var o=!1,d="",p=pv,b=gv,k=_v,B=null;return l!=null&&(l.unstable_strictMode===!0&&(o=!0),l.identifierPrefix!==void 0&&(d=l.identifierPrefix),l.onUncaughtError!==void 0&&(p=l.onUncaughtError),l.onCaughtError!==void 0&&(b=l.onCaughtError),l.onRecoverableError!==void 0&&(k=l.onRecoverableError),l.formState!==void 0&&(B=l.formState)),s=m0(n,1,!0,s,l??null,o,d,B,p,b,k,k0),s.context=p0(null),l=s.current,o=Qn(),o=Yu(o),d=ws(o),d.callback=null,Cs(l,d,o),l=o,s.current.lanes=l,Yl(s,l),zi(s),n[Ir]=s.current,Wd(n),new Yc(s)},Ia.version="19.3.1",Ia}var L0;function QN(){if(L0)return xf.exports;L0=1;function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}return e(),xf.exports=GN(),xf.exports}var ZN=QN();async function Re(e,t){const i=await fetch(e,t),r=await i.text(),a=r===""?void 0:JSON.parse(r);if(!i.ok){const c=typeof a=="object"&&a!==null&&typeof a.error=="string"?a.error:`HTTP ${String(i.status)}`;throw new Error(c)}return a}const Ze=e=>({method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(e)});function JN(e={}){return Re(`/sessions?grouped=1${e.archived===!0?"&archived=1":""}`)}function e2(e,t){return Re("/sessions/rename",Ze({session:e,title:t}))}function t2(e){return Re("/sessions/delete",Ze({session:e}))}function n2(e){return Re("/sessions/order",Ze({names:e}))}function cx(e,t){return Re("/sessions/archive",Ze({session:e,archived:t}))}function i2(e,t){return Re("/sessions/labels",Ze({session:e,labels:t}))}function z0(e,t){return Re("/sessions/fork",Ze({session:e,at:t}))}function s2(e){return Re(`/sessions/anchors?session=${encodeURIComponent(e)}`)}function H0(e){return Re(`/files?path=${encodeURIComponent(e)}`)}function r2(e,t={}){const i=t.offset??1,r=t.limit??400;return Re(`/file?path=${encodeURIComponent(e)}&offset=${String(i)}&limit=${String(r)}`)}function l2(e){return Re(`/file-version?path=${encodeURIComponent(e)}`)}function ux(e){return Re("/open-external",Ze(e))}function hx(){return Re("/git")}function a2(e){return Re(`/git/diff?path=${encodeURIComponent(e)}`)}function o2(){return Re("/terminals")}function c2(){return Re("/terminal",Ze({}))}function u2(e){return Re("/terminal/close",Ze({id:e}))}function dx(e,t){return Re("/terminal/send",Ze({id:e,text:t,raw:!0}))}function I0(e,t,i){return Re("/terminal/resize",Ze({id:e,cols:t,rows:i}))}function h2(e,t){return`/terminal/events?id=${encodeURIComponent(e)}&raw=1`}function d2(e){return Re(`/thread?session=${encodeURIComponent(e)}`)}function f2(e){return Re(`/turn-changes?session=${encodeURIComponent(e)}`)}function m2(e,t){return Re("/turn-undo",Ze({session:e,key:t}))}function fx(e){return Re(`/running?session=${encodeURIComponent(e)}`)}function p2(e){return Re("/interrupt",Ze({session:e}))}function g2(e,t){return Re("/answer",Ze({session:e,...t}))}function _2(){return Re("/settings")}function v2(e){return Re("/settings",Ze(e))}function y2(){return Re("/provider")}function Ua(e){return Re("/provider",Ze(e))}function U0(e){return Re("/provider/test",Ze(e))}function pm(e){const t=e===void 0?"":`?session=${encodeURIComponent(e)}`;return Re(`/models${t}`)}function mx(e,t){return Re("/session-model",Ze(t===void 0?{model:e}:{session:t,model:e}))}function S2(e,t){return Re("/session-profile",Ze({session:e,profile:t}))}function b2(e){return Re(`/trajectory?session=${encodeURIComponent(e)}`)}function x2(e,t,i){return Re(`/page?session=${encodeURIComponent(e)}&from=${String(t)}&limit=${String(i)}`)}function px(){return Re("/plugins")}function w2(e,t){return Re("/plugins/toggle",Ze({id:e,enabled:t}))}function C2(e,t={}){const i=new URLSearchParams({session:e});return t.status!==void 0&&i.set("status",t.status),t.ready!==void 0&&i.set("ready",t.ready?"1":"0"),Re(`/team?${i.toString()}`)}function Nf(e){return Re("/workspace",Ze({path:e}))}function k2(e,t,i){return Re("/team/claim",Ze({session:e,taskId:t,expectedRevision:i}))}function N2(){return Re("/subagents")}function E2(e){return Re("/subagents/stop",Ze({agentId:e}))}function j2(){return Re("/tasks")}function T2(e){return Re("/task-stop",Ze({taskId:e}))}function D2(){return Re("/tasks/clear",Ze({}))}function du(e,t,i,r,a){return Re("/chat",Ze({prompt:e,stream:!0,...t===void 0||t===""?{}:{logFile:t},...i===void 0?{}:{sessionId:i},...r===void 0||r.length===0?{}:{images:r},...a===void 0?{}:{planMode:a}}))}function gx(e){if(typeof e!="object"||e===null)return null;const t=e.daluoDesktop;if(typeof t!="object"||t===null)return null;const i=t.pickDirectory;return typeof i!="function"?null:{pickDirectory:async()=>{const r=await i();return typeof r=="string"&&r!==""?r:null}}}function xp(e){const t=/^\/goal(?:\s+([\s\S]*))?$/u.exec(e.trim());if(t===null)return null;const i=(t[1]??"").trim();return i===""?{kind:"usage"}:{kind:"set",objective:i}}function M2(e,t){const i=t.trim();if(i==="")return"resend";const r=[...e].reverse().find(h=>h.role==="user"&&h.source!=="context"&&h.text.trim()!=="");if(r===void 0||r.text.trim()!==i)return"resend";const a=e.lastIndexOf(r);return e.slice(a+1).some(h=>h.role==="assistant")?"resend":"reanswer"}function A2(e,t){const i=e.filter(r=>r.seq<t).map(r=>r.seq);return i.length===0?1:Math.max(...i)}function R2(e,t){const i=t.trim().toLowerCase();return i===""?e:e.filter(r=>`${r.label} ${r.hint??""} ${r.keywords??""}`.toLowerCase().includes(i))}function P0(e,t,i){return i<=0?0:((e+t)%i+i)%i}function O2({items:e,onClose:t}){const[i,r]=C.useState(""),[a,c]=C.useState(0),h=C.useRef(null),f=C.useMemo(()=>R2(e,i),[e,i]);C.useEffect(()=>{h.current?.focus()},[]),C.useEffect(()=>{c(0)},[i]);const g=m=>{m!==void 0&&(t(),m.run())};return u.jsx("div",{className:"cmdk-mask",role:"dialog","data-dsh-part":"dialog","aria-modal":"true","aria-label":"命令面板",onMouseDown:m=>{m.target===m.currentTarget&&t()},children:u.jsxs("div",{className:"cmdk",children:[u.jsx("input",{ref:h,className:"cmdk-input",value:i,placeholder:"搜索会话,或输入动作…",onChange:m=>{r(m.target.value)},onKeyDown:m=>{m.key==="ArrowDown"?(m.preventDefault(),c(v=>P0(v,1,f.length))):m.key==="ArrowUp"?(m.preventDefault(),c(v=>P0(v,-1,f.length))):m.key==="Enter"?(m.preventDefault(),g(f[a])):m.key==="Escape"&&(m.preventDefault(),t())}}),u.jsx("div",{className:"cmdk-list",children:f.length===0?u.jsx("div",{className:"cmdk-empty",children:"没有匹配的会话或动作"}):f.map((m,v)=>{const _=f[v-1]?.group;return u.jsxs("div",{children:[m.group===_?null:u.jsx("div",{className:"cmdk-group",children:m.group}),u.jsxs("button",{className:v===a?"cmdk-item sel":"cmdk-item",onMouseMove:()=>{c(v)},onClick:()=>{g(m)},children:[u.jsx("span",{className:"cmdk-icon g","aria-hidden":"true",children:m.group==="会话"?"▤":"⌘"}),u.jsx("span",{className:"cmdk-label",children:m.label}),m.hint===void 0?null:u.jsx("span",{className:"cmdk-hint",children:m.hint})]})]},m.id)})}),u.jsxs("div",{className:"cmdk-foot",children:[u.jsx("span",{children:"↑↓ 选择"}),u.jsx("span",{children:"↵ 执行"}),u.jsx("span",{children:"esc 关闭"})]})]})})}function q0(e,t,i){return Re("/goal",Ze({session:e,op:t,...i===void 0?{}:{objective:i}}))}function B2(e,t){return Re("/plan-mode",Ze({session:e,active:t}))}function L2(e){return Re(`/refs?query=${encodeURIComponent(e)}`)}function z2(e,t,i){return Re("/queue",Ze({session:e,op:"add",content:t}))}function H2(e,t,i){return Re("/queue",Ze({session:e,op:"edit",id:t,content:i}))}function I2(e,t){return Re("/queue",Ze({session:e,op:"remove",id:t}))}function F0(e,t,i){return Re("/queue",Ze({session:e,op:"steer",id:t,placement:i}))}const U2=4e3;function P2(e){const[t,i]=C.useState(null),[r,a]=C.useState([]),[c,h]=C.useState([]),[f,g]=C.useState(null),[m,v]=C.useState({}),_=C.useRef(e);_.current=e;const S=C.useRef(m);S.current=m;const y=C.useRef(!0),x=C.useCallback(async w=>{const j=_.current,N=w?.silent===!0;try{const[M,A,R]=await Promise.allSettled([j===null?Promise.resolve(null):C2(j,S.current),N2(),j2()]);if(!y.current||_.current!==j)return;M.status==="fulfilled"&&i(M.value),A.status==="fulfilled"&&a(A.value.agents),R.status==="fulfilled"&&h(R.value.tasks);const I=[M,A,R].find(H=>H.status==="rejected");if(g(I===void 0?null:I.reason instanceof Error?I.reason.message:String(I.reason)),N)return}catch(M){if(!y.current)return;g(M instanceof Error?M.message:String(M))}},[]);return C.useEffect(()=>(y.current=!0,()=>{y.current=!1}),[]),C.useEffect(()=>{i(null),g(null),x()},[e,x]),C.useEffect(()=>{x({silent:!0})},[m,x]),C.useEffect(()=>{if(e===null)return;const w=setInterval(()=>{x({silent:!0})},U2);return()=>{clearInterval(w)}},[e,x]),{team:t,agents:r,jobs:c,error:f,reload:x,filter:m,setFilter:v}}const q2={low:"低风险",medium:"中风险",high:"高风险",critical:"极高风险"};function F2(e){if(typeof e!="object"||e===null)return"";const t=e;for(const r of["command","path","file_path","pattern","url","query"]){const a=t[r];if(typeof a=="string"&&a!=="")return a}const i=JSON.stringify(e);return i===void 0?"":i}function $2({ask:e,count:t,onAnswer:i}){const[r,a]=C.useState(!1),[c,h]=C.useState(()=>JSON.stringify(e.input??{},null,2)),[f,g]=C.useState(null),[m,v]=C.useState(!1),_=e.riskLevel??"medium",S=_==="high"||_==="critical",y=F2(e.input),x=e.permissionOptions??[],w=N=>{v(!0),i({id:e.id,...N}).finally(()=>{v(!1)})},j=()=>{try{const N=JSON.parse(c);g(null),w({optionId:"modify",modifiedInput:N})}catch{g("改后的输入不是合法 JSON——没发出去")}};return u.jsxs("div",{className:S?"perm danger":"perm",children:[u.jsxs("div",{className:"t",children:[u.jsx("span",{className:"g",children:"!"}),"需要你确认 · ",e.question,u.jsxs("span",{style:{marginLeft:"auto",color:"var(--text-3)",fontWeight:400},children:[e.origin===void 0?"主代理":`来自 ${e.origin.kind==="subagent"?"子代理":e.origin.kind==="workflow-node"?"工作流节点":"团队成员"} ${e.origin.agentType??e.origin.agentId}`,e.toolName===void 0?"":` · ${e.toolName}`]})]}),u.jsxs("div",{className:"perm-tool",children:[u.jsx("span",{className:S?"badge high":"badge",children:q2[_]??_}),y===""?null:u.jsx("code",{children:y}),t>1?u.jsxs("span",{style:{marginLeft:"auto",color:"var(--text-3)"},children:["还有 ",t," 个等待确认"]}):null]}),S?u.jsx("div",{className:"hint",children:"这是破坏性操作:执行后可能删改工作区内容。看清楚命令再点。"}):null,e.expiresAt===void 0?null:u.jsxs("div",{className:"hint",children:["截止:",new Date(e.expiresAt).toLocaleTimeString("zh-CN"),"(超时按拒绝处理)"]}),r?u.jsxs("div",{className:"perm-modify",children:[u.jsx("textarea",{value:c,onChange:N=>{h(N.target.value)},spellCheck:!1}),f===null?null:u.jsx("div",{className:"err",children:f}),u.jsxs("div",{className:"a",children:[u.jsx("button",{className:"btn",onClick:()=>{a(!1)},children:"取消"}),u.jsx("button",{className:"btn primary",disabled:m,onClick:j,children:"提交改后的输入"})]})]}):u.jsx("div",{className:"a",children:x.length===0?u.jsxs(u.Fragment,{children:[u.jsx("button",{className:"btn",disabled:m,onClick:()=>{w({allow:!1})},children:"拒绝"}),e.allowModify===!0?u.jsx("button",{className:"btn",disabled:m,onClick:()=>{a(!0)},children:"改后批准"}):null,u.jsx("button",{className:"btn primary",disabled:m,onClick:()=>{w({allow:!0})},children:"允许执行"})]}):x.map(N=>u.jsx("button",{className:N.optionId==="deny"?"btn danger":N.optionId==="allow-once"?"btn primary":"btn",title:N.description??N.label,disabled:m,onClick:()=>{if(N.optionId==="modify"){a(!0);return}w({optionId:N.optionId})},children:N.label},N.optionId))})]})}function V2({ask:e,onAnswer:t}){const[i,r]=C.useState([]),[a,c]=C.useState(""),[h,f]=C.useState(!1),g=e.multiSelect===!0,m=e.options??[],v=S=>{f(!0),t({id:e.id,...S}).finally(()=>{f(!1)})},_=S=>{if(!g){v({answer:S,selected:[S]});return}r(y=>y.includes(S)?y.filter(x=>x!==S):[...y,S])};return u.jsxs("div",{className:"ask",children:[u.jsxs("div",{className:"t",children:[u.jsx("span",{className:"g",children:"?"}),"需要你回答 · ",g?`多选${i.length===0?"":`(${String(i.length)} 项已选)`}`:"单选"]}),u.jsx("div",{className:"q",children:e.question}),m.length===0?null:u.jsx("div",{className:"opts",children:m.map(S=>{const y=i.includes(S.label);return u.jsxs("button",{className:y?"opt sel":"opt",disabled:h,onClick:()=>{_(S.label)},children:[u.jsx("span",{className:g?"box":"box radio",children:y?"✓":""}),S.label,S.description===void 0?null:u.jsx("span",{className:"desc",children:S.description})]},S.label)})}),u.jsxs("div",{className:"foot",children:[u.jsx("input",{className:"free",value:a,placeholder:"或者直接说你的想法…",onChange:S=>{c(S.target.value)},onKeyDown:S=>{if(S.key!=="Enter")return;S.preventDefault();const y=a.trim();y!==""&&v({answer:y})}}),g?u.jsxs("button",{className:"btn primary",disabled:h||i.length===0,onClick:()=>{v({selected:[...i]})},children:["提交这 ",i.length," 项"]}):u.jsx("span",{className:"muted",children:"Enter 提交"})]})]})}function K2({record:e}){return u.jsxs("div",{className:"perm expired",children:[u.jsxs("div",{className:"t",children:[u.jsx("span",{className:"g",style:{color:"var(--text-3)"},children:"⌛"}),"已失效 · ",e.reason,u.jsx("span",{style:{marginLeft:"auto",color:"var(--text-3)",fontWeight:400},children:new Date(e.atMs).toLocaleTimeString("zh-CN")})]}),u.jsxs("div",{className:"hint",children:[e.kind==="permission"?"审批":"提问",":",e.question]})]})}function _x(e){const t=Math.max(0,Math.floor(e/1e3));if(t<60)return`${String(t)} 秒`;const i=Math.floor(t/60);if(i<60){const c=t%60;return c===0?`${String(i)} 分`:`${String(i)} 分 ${String(c)} 秒`}const r=Math.floor(i/60),a=i%60;return`${String(r)} 时 ${String(a).padStart(2,"0")} 分`}function $0(e){switch(e.status){case"running":return"运行中";case"idle":return"空闲";case"provisioning":return"启动中";case"failed":return"失败";case"released":return"已释放"}}function gm(e){switch(e.status){case"running":return"run";case"provisioning":return"prov";case"failed":return"fail";case"idle":case"released":return"idle"}}function vx(e){const t={total:e.length,running:0,idle:0,provisioning:0,failed:0};for(const i of e)i.status!=="released"&&(i.status==="running"?t.running+=1:i.status==="provisioning"?t.provisioning+=1:i.status==="failed"?t.failed+=1:t.idle+=1);return t}function yx(e){const t={total:e.length,running:0,completed:0,failed:0,cancelled:0};for(const i of e)i.taskStatus==="running"?t.running+=1:i.taskStatus==="completed"?t.completed+=1:i.taskStatus==="failed"?t.failed+=1:t.cancelled+=1;return t}function Sx(e){let t=0;for(const i of e)i.taskStatus==="running"&&(t+=1);return{running:t,finished:e.length-t}}function Y2(e){switch(e){case"all":return"全部";case"pending":return"待认领";case"in_progress":return"进行中";case"completed":return"已完成"}}function W2(e,t){switch(t){case"all":return e.pending+e.in_progress+e.completed;case"pending":return e.pending;case"in_progress":return e.in_progress;case"completed":return e.completed}}function X2(e,t){return e.filter(i=>i.taskId===t||i.otherTaskId===t)}function G2(e){switch(e.status){case"completed":return"已完成";case"in_progress":return"进行中";case"pending":return e.ready?"待认领":"被阻塞"}}function V0(e){return e.status==="completed"?"idle":e.status==="in_progress"?"run":e.ready?"idle":"prov"}function Ef(e){return e.label!==void 0&&e.label!==""?e.label:e.agentId}function K0(e){if(e.taskStatus==="running")return"正在跑…";const t=(e.replyTail??"").trim().replace(/\s+/g," ");return t===""?"(无文本产出)":t}function Q2(e){return{name:"lead",id:"lead",description:"当前会话 · 决策与合议",context:"fresh",kind:"temp",phase:"active",status:e?"running":"idle",unread:0}}function Z2(e){return e.status==="pending"&&e.ready}function Y0(e){return e.trim()===""?"(空命令)":e}function J2({team:e,agents:t,jobs:i,open:r,onOpen:a}){const c=vx(e?.members??[]),h=yx(t).running,f=Sx(i);return u.jsxs(u.Fragment,{children:[u.jsxs("button",{className:`tp-team-btn${r==="team"?" on":""}`,title:"智能体团队:成员花名册 + 共享任务板",onClick:()=>{a("team")},disabled:e===null,children:[u.jsx("span",{className:"ticon",children:"⊛"}),"智能体团队",u.jsx("span",{className:"n",children:e===null?0:e.members.length+1}),c.running>0?u.jsx("span",{className:"tp-live-dot"}):null]}),t.length===0?null:u.jsxs("button",{className:`chip tp-chip-btn${r==="agents"?" on":""}`,onClick:()=>{a("agents")},children:[u.jsx("span",{className:"g",children:"◉"}),t.length," 个子智能体",h>0?u.jsx("span",{className:"tp-live-dot"}):null,u.jsx("span",{className:"caret",children:"▾"})]}),f.running===0?null:u.jsxs("button",{className:`chip tp-chip-btn live${r==="jobs"?" on":""}`,onClick:()=>{a("jobs")},children:[u.jsx("span",{className:"pulse"}),f.running," 个后台任务运行中",u.jsx("span",{className:"caret",children:"▾"})]})]})}function bu({title:e,count:t,facts:i,foot:r,wide:a,onClose:c,children:h}){return u.jsx("div",{className:"tp-overlay",onMouseDown:c,children:u.jsxs("div",{className:`tp-pop${a===!0?" wide":""}`,role:"dialog","aria-label":e,onMouseDown:f=>{f.stopPropagation()},children:[u.jsxs("div",{className:"tp-pop-head",children:[u.jsx("span",{className:"ttl",children:e}),t===void 0?null:u.jsx("span",{className:"count",children:t}),i===void 0?null:u.jsx("span",{className:"facts",children:i}),u.jsx("button",{className:"tp-close",title:"关闭","aria-label":"关闭弹层",onClick:c,children:"✕"})]}),u.jsx("div",{className:"tp-pop-body",children:h}),r===void 0?null:u.jsx("div",{className:"tp-pop-foot",children:r})]})})}function eE({kind:e,panel:t,session:i,onClose:r,onOpenMember:a}){return e==="agents"?u.jsx(nE,{panel:t,onClose:r}):e==="jobs"?u.jsx(iE,{panel:t,onClose:r}):u.jsx(tE,{panel:t,session:i,onClose:r,onOpenMember:a})}function tE({panel:e,session:t,onClose:i,onOpenMember:r}){const a=e.team,[c,h]=C.useState("all"),[f,g]=C.useState(new Set),[m,v]=C.useState(null),[_,S]=C.useState(null);if(a===null)return u.jsx(bu,{title:"智能体团队",onClose:i,children:u.jsx("div",{className:"tp-empty",children:"还没有团队读数(会话未选中或读取失败)。"})});const y=Q2(a.running),x=vx(a.members),w=M=>{h(M),e.setFilter(M==="all"?{}:{status:M})},j=M=>{g(A=>{const R=new Set(A);return R.has(M)?R.delete(M):R.add(M),R})},N=async M=>{S(null),v(M.id);try{await k2(t,M.id,M.revision)}catch(A){const R=A instanceof Error?A.message:String(A);S(R.includes("revision 过期")?"这张任务刚被改过(revision 过期):读数已刷新,请再试一次。":R)}finally{v(null),await e.reload({silent:!0})}};return u.jsxs(bu,{title:"成员",count:a.members.length+1,wide:!0,facts:u.jsxs(u.Fragment,{children:[u.jsxs("span",{children:["运行中 ",x.running+(a.running?1:0)]}),u.jsx("span",{className:"sep",children:"·"}),u.jsxs("span",{children:["空闲 ",x.idle+(a.running?0:1)]}),u.jsx("span",{className:"sep",children:"·"}),u.jsxs("span",{children:["启动中 ",x.provisioning]}),u.jsx("span",{className:"sep",children:"·"}),u.jsxs("span",{children:["失败 ",x.failed]})]}),onClose:i,foot:u.jsxs(u.Fragment,{children:[u.jsx("span",{children:"认领 / 成员消息是写操作(均走服务端校验)"}),u.jsx("button",{className:"go",onClick:()=>{e.reload({silent:!0})},children:"刷新"})]}),children:[a.failures.length>0?u.jsxs("div",{className:"tp-banner warn",children:[u.jsx("span",{children:"⚠"}),u.jsxs("span",{children:["投影层拒绝了 ",a.failures.length," 条团队事件:",a.failures[0]]})]}):null,_===null?null:u.jsxs("div",{className:"tp-banner err",children:[u.jsx("span",{children:"⚠"}),u.jsx("span",{children:_}),u.jsx("button",{onClick:()=>{S(null)},children:"知道了"})]}),u.jsxs("div",{className:"tp-member-grid",children:[u.jsxs("div",{className:`tp-member lead${y.status==="running"?" running":""}`,children:[u.jsx("div",{className:"tp-ava",children:"●"}),u.jsxs("div",{className:"tp-m-main",children:[u.jsxs("div",{className:"tp-m-name",children:[u.jsx("span",{className:"nm",children:"lead"}),u.jsx("span",{className:"tp-badge lead",children:"LEAD"})]}),u.jsx("div",{className:"tp-m-desc",children:y.description}),u.jsxs("div",{className:"tp-m-status",children:[u.jsx("span",{className:`st-dot ${gm(y)}`}),$0(y)," · 当前会话"]})]})]}),a.members.map(M=>u.jsxs("div",{className:`tp-member${M.status==="failed"?" failed":""}${M.status==="provisioning"?" provisioning":""}${M.status==="running"?" running":""}`,children:[u.jsx("div",{className:"tp-ava",children:(M.status==="running","◌")}),u.jsxs("div",{className:"tp-m-main",children:[u.jsxs("div",{className:"tp-m-name",children:[u.jsx("span",{className:"nm",children:M.name}),u.jsx("span",{className:`tp-badge${M.kind==="seat"?" seat":""}`,children:M.kind==="seat"?"席位":"临时"}),M.unread>0?u.jsx("span",{className:"tp-badge unread",children:M.unread}):null]}),u.jsx("div",{className:"tp-m-desc",children:M.description}),u.jsxs("div",{className:"tp-m-status",children:[u.jsx("span",{className:`st-dot ${gm(M)}`}),M.status==="failed"&&M.error!==void 0?u.jsxs(u.Fragment,{children:["失败 ",u.jsxs("span",{className:"why",children:["· ",M.error]})]}):M.status==="idle"?"空闲 · 可唤醒":$0(M)]})]}),r===void 0?null:u.jsx("button",{className:"tp-talk",type:"button",title:M.status==="failed"||M.status==="provisioning"?"成员不可对话(失败/启动中)":"打开子会话并给它发消息",disabled:M.status==="failed"||M.status==="provisioning",onClick:()=>{r(M.name)},children:"对话"})]},M.id))]}),u.jsxs("div",{className:"tp-tsec",children:[u.jsx("span",{className:"ttl",children:"共享任务"}),u.jsx("span",{className:"count",children:a.counts.pending+a.counts.in_progress+a.counts.completed}),u.jsx("div",{className:"tp-fchips",children:["all","pending","in_progress","completed"].map(M=>u.jsxs("button",{className:`fc${c===M?" on":""}`,onClick:()=>{w(M)},children:[Y2(M)," ",W2(a.counts,M)]},M))})]}),a.tasks.tasks.length===0?u.jsx("div",{className:"tp-empty",children:a.counts.pending+a.counts.in_progress+a.counts.completed===0?"还没有共享任务——Lead 建的活会出现在这里(轮询自动刷新)。":"这个筛选下没有任务。"}):null,a.tasks.tasks.map(M=>{const A=X2(a.warnings,M.id),R=f.has(M.id);return u.jsxs("div",{className:`tp-tcard${R?" open":""}`,children:[u.jsxs("div",{className:"tp-trow1",children:[u.jsx("span",{className:`st-dot ${V0(M)}`}),u.jsx("span",{className:"subj",title:M.subject,children:M.subject}),u.jsxs("span",{className:`tp-tstat${M.status==="completed"?" done":M.status==="in_progress"?" prog":" todo"}`,children:[u.jsx("span",{className:`st-dot ${V0(M)}`}),G2(M)]})]}),M.description===""?null:u.jsx("div",{className:"tp-tdesc",children:M.description}),u.jsxs("div",{className:"tp-tfoot",children:[u.jsx("span",{className:"tid",children:M.id}),u.jsx("span",{children:"·"}),u.jsx("span",{className:"who",children:M.ownerName===void 0?"Owner 未认领":`Owner ${M.ownerName}`}),M.writeScopes.length===0?null:u.jsxs(u.Fragment,{children:[u.jsx("span",{children:"·"}),u.jsxs("span",{className:"scope",children:["写入范围 ",M.writeScopes.join(" ")]})]}),Z2(M)?u.jsx("button",{className:"tp-claim",disabled:a.running||m!==null,title:a.running?"会话在跑:等这一轮结束再认领(任务板同时只许一个写者)":"认领给当前会话(lead)",onClick:()=>{N(M)},children:m===M.id?"认领中…":"认领"}):null,u.jsx("button",{className:"expand",onClick:()=>{j(M.id)},children:R?"收起 ▴":"展开 ▾"})]}),R?u.jsxs("div",{className:"tp-tdetail",children:[u.jsxs("div",{className:"tp-drow",children:[u.jsx("span",{className:"dk",children:"版本"}),u.jsxs("span",{className:"dv",children:[u.jsxs("span",{className:"mono",children:["revision ",M.revision]}),"(CAS:认领/改状态要带这版,spec 决策 21)"]})]}),u.jsxs("div",{className:"tp-drow",children:[u.jsx("span",{className:"dk",children:"阻塞"}),u.jsxs("span",{className:"dv",children:[M.blockedBy.length===0?"无":M.blockedBy.join("、"),M.ready?"":"(未完成,暂不可认领)"]})]}),u.jsxs("div",{className:"tp-drow",children:[u.jsx("span",{className:"dk",children:"写入范围"}),u.jsx("span",{className:"dv",children:M.writeScopes.length===0?"未声明":M.writeScopes.map(I=>u.jsx("span",{className:"tp-scope-chip",children:I},I))})]}),M.obligations.length===0?null:u.jsxs("div",{className:"tp-drow",children:[u.jsx("span",{className:"dk",children:"核验义务"}),u.jsx("span",{className:"dv",children:M.obligations.map(I=>u.jsx("span",{className:"tp-scope-chip",children:I},I))})]}),A.map(I=>{const H=I.taskId===M.id?I.otherTaskId:I.taskId;return u.jsxs("div",{className:"tp-scope-warn",children:[u.jsx("span",{className:"w",children:"⚠"}),u.jsxs("span",{children:["与 ",u.jsx("b",{children:H})," 的写入范围重叠(",I.a," 与 ",I.b,")——只提醒不阻塞,spec 决策 16。"]})]},`${I.taskId}:${I.otherTaskId}:${I.a}:${I.b}`)})]}):null]},M.id)}),a.tasks.hasMore?u.jsxs("div",{className:"tp-more",children:["还有 ",a.tasks.total-a.tasks.tasks.length," 条(筛选/分页由服务端算)"]}):null]})}function nE({panel:e,onClose:t}){const[i,r]=C.useState(null),[a,c]=C.useState(null),[h,f]=C.useState(()=>Date.now());C.useEffect(()=>{const v=setInterval(()=>{f(Date.now())},1e3);return()=>{clearInterval(v)}},[]);const g=yx(e.agents),m=async v=>{c(null),r(v.agentId);try{await E2(v.agentId)}catch(_){c(_ instanceof Error?_.message:String(_))}finally{r(null),await e.reload({silent:!0})}};return u.jsxs(bu,{title:"子智能体",count:e.agents.length,facts:u.jsxs(u.Fragment,{children:[u.jsxs("span",{children:["运行中 ",g.running]}),u.jsx("span",{className:"sep",children:"·"}),u.jsxs("span",{children:["已完成 ",g.completed]}),u.jsx("span",{className:"sep",children:"·"}),u.jsxs("span",{children:["失败 ",g.failed]}),u.jsx("span",{className:"sep",children:"·"}),u.jsxs("span",{children:["已停止 ",g.cancelled]})]}),onClose:t,foot:u.jsxs(u.Fragment,{children:[u.jsx("span",{children:"进程内读数 · 重启即空"}),u.jsx("button",{className:"go",onClick:()=>{e.reload({silent:!0})},children:"刷新"})]}),children:[a===null?null:u.jsxs("div",{className:"tp-banner err",children:[u.jsx("span",{children:"⚠"}),u.jsx("span",{children:a}),u.jsx("button",{onClick:()=>{c(null)},children:"知道了"})]}),e.agents.length===0?u.jsx("div",{className:"tp-empty",children:"没有子智能体在跑,也没有历史记录。"}):null,e.agents.map(v=>{const _=v.taskStatus==="running",S=Date.parse(v.startedAt),y=_&&Number.isFinite(S)?h-S:v.elapsedMs;return u.jsxs("div",{className:"tp-srow",children:[u.jsx("span",{className:`st-dot ${gm({status:_?"running":v.taskStatus==="failed"?"failed":(v.taskStatus==="completed","idle")})}`}),u.jsxs("div",{className:"tp-s-main",children:[u.jsxs("div",{className:"tp-s-title",children:[u.jsx("span",{className:"tp-kind",children:"subagent"}),u.jsx("span",{className:"nm",title:Ef(v),children:Ef(v)})]}),u.jsx("div",{className:"tp-s-sub",title:K0(v),children:K0(v)})]}),u.jsxs("div",{className:"tp-s-right",children:[u.jsx("span",{className:`tp-s-status${_?" run":v.taskStatus==="failed"?" fail":v.taskStatus==="completed"?" done":""}`,children:v.statusText}),u.jsx("span",{className:`tp-s-time${_?" run":""}`,children:_x(y)}),_?u.jsx("button",{className:"tp-stop-btn",title:"停止这只子智能体","aria-label":`停止 ${Ef(v)}`,disabled:i!==null,onClick:()=>{m(v)},children:i===v.agentId?"◌":"■"}):null]})]},v.agentId)})]})}function iE({panel:e,onClose:t}){const[i,r]=C.useState(!1),[a,c]=C.useState(new Set),[h,f]=C.useState(null),[g,m]=C.useState(!1),[v,_]=C.useState(null),[S,y]=C.useState(()=>Date.now());C.useEffect(()=>{const A=setInterval(()=>{y(Date.now())},1e3);return()=>{clearInterval(A)}},[]);const x=Sx(e.jobs),w=i?e.jobs:e.jobs.filter(A=>A.taskStatus==="running"),j=A=>{c(R=>{const I=new Set(R);return I.has(A)?I.delete(A):I.add(A),I})},N=async A=>{_(null),f(A.taskId);try{await T2(A.taskId)}catch(R){_(R instanceof Error?R.message:String(R))}finally{f(null),await e.reload({silent:!0})}},M=async()=>{_(null),m(!0);try{await D2()}catch(A){_(A instanceof Error?A.message:String(A))}finally{m(!1),await e.reload({silent:!0})}};return u.jsxs(bu,{title:"后台任务",facts:u.jsxs(u.Fragment,{children:[u.jsxs("span",{children:[x.running," 个运行中"]}),u.jsx("span",{className:"sep",children:"·"}),u.jsxs("span",{children:["已结束 ",x.finished]})]}),onClose:t,foot:u.jsxs(u.Fragment,{children:[u.jsx("button",{className:i?"on":"",onClick:()=>{r(A=>!A)},children:i?"只看运行中":`查看已结束 ${x.finished}`}),u.jsx("button",{className:"go",disabled:x.finished===0||g,title:x.finished===0?"没有已结束的任务":"清掉已结束条目(运行中的不动)",onClick:()=>{M()},children:g?"清空中…":"清空"})]}),children:[v===null?null:u.jsxs("div",{className:"tp-banner err",children:[u.jsx("span",{children:"⚠"}),u.jsx("span",{children:v}),u.jsx("button",{onClick:()=>{_(null)},children:"知道了"})]}),w.length===0?u.jsx("div",{className:"tp-empty",children:i?"没有后台任务。":"没有正在运行的后台任务。"}):null,w.map(A=>{const R=A.taskStatus==="running",I=Date.parse(A.startedAt),H=R&&Number.isFinite(I)?S-I:void 0,O=a.has(A.taskId);return u.jsxs("div",{className:"tp-jrow",children:[u.jsx("span",{className:`st-dot ${R?"run":A.taskStatus==="failed"?"fail":(A.taskStatus==="completed","idle")}`}),u.jsxs("div",{className:"tp-j-main",children:[u.jsxs("div",{className:"tp-j-cmd",children:[u.jsx("span",{className:"tp-kind",children:"bash"}),u.jsx("span",{className:"nm",title:Y0(A.command),children:Y0(A.command)})]}),u.jsxs("div",{className:"tp-j-sub",children:[u.jsx("span",{children:A.taskId}),u.jsx("span",{className:"sep",children:"·"}),u.jsx("span",{children:R?`已运行 ${_x(H??0)}`:A.statusText}),A.exitCode===void 0?null:u.jsxs(u.Fragment,{children:[u.jsx("span",{className:"sep",children:"·"}),u.jsxs("span",{children:["exit ",A.exitCode]})]}),A.truncated===!0?u.jsxs(u.Fragment,{children:[u.jsx("span",{className:"sep",children:"·"}),u.jsx("span",{children:"输出被截断"})]}):null]}),O?u.jsx("pre",{className:"tp-out",children:A.outputTail===""?"(无输出)":A.outputTail}):null]}),u.jsxs("div",{className:"tp-s-right",children:[u.jsx("span",{className:`tp-s-status${R?" run":A.taskStatus==="failed"?" fail":A.taskStatus==="completed"?" done":""}`,children:A.statusText}),u.jsx("button",{className:"tp-caret-btn",title:O?"收起输出":"展开输出",onClick:()=>{j(A.taskId)},children:O?"▴":"▾"}),R?u.jsx("button",{className:"tp-stop-btn",title:"停止这条后台任务","aria-label":`停止 ${A.taskId}`,disabled:h!==null,onClick:()=>{N(A)},children:h===A.taskId?"◌":"■"}):null]})]},A.taskId)})]})}const sE=[{icon:"◇",title:"摸清这个仓库",desc:"先看 spec 和目录结构,给我一张地图",prompt:"先带我把这个仓库摸一遍:spec 和目录结构各有什么,给我一张地图。"},{icon:"✓",title:"把 check 跑绿",desc:"typecheck + 静态闸 + vitest,红了就修",prompt:"把 npm run check 跑一遍,红了的修到全绿,把每一步的证据贴给我。"},{icon:"↳",title:"审阅未提交的改动",desc:"逐文件说风险,判断要不要拆",prompt:"审阅一下当前未提交的改动:逐个文件说做了什么、风险在哪、该不该拆。"},{icon:"▤",title:"改主页面原型",desc:"布局 / 配色 / 交互,你提我改",prompt:"按刚才的原型改主页面:三栏比例、目标条、输入卡,哪里不对你说。"}],rE=[{name:"/model",desc:"换模型(可跨供应商)",scope:"本会话"},{name:"/compact",desc:"压缩上下文",scope:"本会话"},{name:"/goal",desc:"设定目标并持续追踪",scope:"目标"},{name:"/review",desc:"审阅当前改动",scope:"技能"}];function lE(e){const t=/(-?\d+(?:\.\d+)?)\s*%/u.exec(e);if(t===null)return null;const i=Number(t[1]);return Number.isFinite(i)?Math.min(100,Math.max(0,i)):null}function aE(e){return e===null?"none":e>=95?"danger":e>=80?"warn":"normal"}function Qa(e){const{打开:t,关闭:i,容器:r}=e;C.useEffect(()=>{if(!t)return;const a=h=>{const f=r.current;f!==null&&!f.contains(h.target)&&i()},c=h=>{h.key==="Escape"&&(h.preventDefault(),h.stopPropagation(),i())};return document.addEventListener("mousedown",a,!0),document.addEventListener("keydown",c,!0),()=>{document.removeEventListener("mousedown",a,!0),document.removeEventListener("keydown",c,!0)}},[t,i,r])}function xu(e){return e.kind==="directory"?`${e.path}/`:e.path}const oE=e=>e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");function cE(e,t){return new RegExp(`(^|\\s)@${oE(t)}(?=\\s|$)`).test(e)}function W0(e,t){const i=e.trim(),r=new Set,c=t.filter(h=>{const f=xu(h);return r.has(f)||cE(i,f)?!1:(r.add(f),!0)}).map(h=>`@${xu(h)}`).join(" ");return c===""?i:i===""?c:`${i}
10
+
11
+ ${c}`}function uE(e){const t=[],i=/(@[^\s@]+)/g;let r=0;for(const a of e.matchAll(i)){const c=a.index;c>r&&t.push({text:e.slice(r,c),mention:!1}),t.push({text:a[0],mention:!0}),r=c+a[0].length}return r<e.length&&t.push({text:e.slice(r),mention:!1}),t}function hE(e){return Re("/shell",Ze({command:e}))}function X0(e,t){return{ok:!1,command:e,cwd:"",exitCode:null,stdout:"",stderr:"",truncated:!1,durationMs:0,error:t}}let G0=0;function dE(){return G0+=1,`att-${String(G0)}`}function fE(e){return Re(`/upload?name=${encodeURIComponent(e.name)}`,{method:"POST",headers:{"content-type":"application/octet-stream"},body:e})}function mE(e){return e<1024?`${String(e)} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/1024/1024).toFixed(1)} MB`}function pE(e,t=0){const i=a=>String(a).padStart(2,"0");return`粘贴图片-${`${i(e.getHours())}${i(e.getMinutes())}${i(e.getSeconds())}`}${t===0?"":`-${String(t)}`}.png`}function Q0(e){const t=new Set,i=[];for(const r of e)r.state!=="ok"||r.result===void 0||Bu(r)||t.has(r.result.path)||(t.add(r.result.path),i.push({path:r.result.path,kind:"file"}));return i}function _m(e){const t=new Set,i=[];for(const r of e)r.state!=="ok"||r.result===void 0||!Bu(r)||t.has(r.result.path)||(t.add(r.result.path),i.push({path:r.result.path}));return i}function gE(e){const t=_m(e).length;return t===0?"":Array.from({length:t},(i,r)=>`[图片 #${String(r+1)}]`).join(" ")}function _E(e,t,i){return i.some(r=>r.state!=="ok")?!1:e.trim()!==""||t.length>0||i.length>0}const vE=/\.(?:png|jpe?g|gif|webp|avif|bmp|heic|heif)$/iu;function Bu(e){const t=e.mediaType?.trim().toLowerCase()??"";return t!==""?t.startsWith("image/"):vE.test(e.name)}function yE(e){return e.some(Bu)}function Z0(e,t){return t!==!1?null:yE(e)?"本模型不支持图片":null}function SE({label:e}){const t=lE(e),i=aE(t),r=9.5,a=2*Math.PI*r,c=t===null?0:t/100,h=i==="danger"?"var(--red)":i==="warn"?"var(--amber)":i==="none"?"var(--text-3)":"var(--accent)";return u.jsx("button",{className:`ctx-ring ${i}`,title:`上下文用量:${e.replace(/^ctx\s*/u,"")}(环形图;≥80% 提醒、≥95% 危险)`,"aria-label":`上下文用量 ${e}`,children:u.jsxs("span",{className:"ctx-ring-wrap",children:[u.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24","aria-hidden":"true",children:[u.jsx("circle",{cx:"12",cy:"12",r,fill:"none",stroke:"var(--border-strong)",strokeWidth:"2",opacity:"0.55"}),u.jsx("circle",{cx:"11",cy:"11",r,fill:"none",stroke:h,strokeWidth:"2",strokeLinecap:"round",strokeDasharray:a,strokeDashoffset:a*(1-c),transform:"rotate(-90 12 12)",style:{transition:"stroke-dashoffset .2s ease, stroke .2s ease"}})]}),t===null?null:u.jsx("span",{className:"ctx-pct",children:`${String(Math.round(t))}%`})]})})}const bx=C.forwardRef(function({value:t,onChange:i,onSend:r,contextLabel:a,empty:c=!1,busy:h=!1,onStop:f,onQueue:g,onInterjectAll:m,profile:v,onProfile:_,session:S,planMode:y=!1,planDisabled:x=!1,onTogglePlan:w},j){const N=C.useRef(null),M=C.useRef(null),A=C.useRef(null),R=C.useRef(null),I=C.useCallback(()=>{Q(!1)},[]),H=C.useCallback(()=>{Ke(!1)},[]),O=C.useCallback(()=>{T(null)},[]),[$,Q]=C.useState(!1),[z,G]=C.useState(!1),P=C.useRef(null),L=C.useRef(null),[F,K]=C.useState([]),[q,te]=C.useState(null),[ne,ge]=C.useState(!1),[D,De]=C.useState([]),[we,T]=C.useState(null),[E,J]=C.useState(0),[se,pe]=C.useState([]),[ce,_e]=C.useState(!1),[ke,oe]=C.useState(null),[ye,Ne]=C.useState(!1),[ct,ht]=C.useState(""),[Je,Ke]=C.useState(!1),[qe,le]=C.useState(null),[me,Te]=C.useState(""),[He,Ee]=C.useState(null),[Be,jt]=C.useState(!1),[Tt,re]=C.useState(void 0),[ve,ze]=C.useState(null);C.useEffect(()=>{let he=!1;return pm(S).then(Ae=>{he||(le(Ae),ht(Ae.current),re({name:Ae.current,vision:Ae.currentVision}))}).catch(()=>{he||re(void 0)}),()=>{he=!0}},[S]),C.useEffect(()=>{Z0(F,Tt?.vision??null)===null&&ze(null)},[F,Tt]),Qa({打开:$,关闭:I,容器:N}),Qa({打开:Je,关闭:H,容器:M}),Qa({打开:we?.kind==="mention",关闭:O,容器:A}),Qa({打开:we?.kind==="slash",关闭:O,容器:R});const ae=()=>{P.current?.focus()},be=he=>{for(const Ae of he){const st=dE();K(gt=>[...gt,{id:st,name:Ae.name,state:"uploading",mediaType:Ae.type}]),fE(Ae).then(gt=>{K(En=>En.map(Ue=>Ue.id===st?{...Ue,name:gt.name,state:"ok",result:gt}:Ue))}).catch(gt=>{K(En=>En.map(Ue=>Ue.id===st?{...Ue,state:"failed",error:gt instanceof Error?gt.message:String(gt)}:Ue))})}};C.useImperativeHandle(j,()=>({addFiles:be})),C.useEffect(()=>{const he=P.current;he!==null&&(he.style.height="auto",he.style.height=`${String(Math.min(he.scrollHeight,220))}px`)},[t]);const X=we?.kind==="mention"?se:[],Se=we?.kind==="slash"?rE.filter(he=>he.name.includes(we.query)):[],Ge=_E(t,D,F),pt=F.filter(he=>he.state==="failed");C.useEffect(()=>{if(we?.kind!=="mention")return;const he=we.query;let Ae=!0;Ne(!0);const st=setTimeout(()=>{L2(he).then(gt=>{Ae&&(pe(gt.candidates),_e(gt.truncated),oe(null))}).catch(gt=>{Ae&&(pe([]),_e(!1),oe(gt instanceof Error?gt.message:String(gt)))}).finally(()=>{Ae&&Ne(!1)})},120);return()=>{Ae=!1,clearTimeout(st)}},[we]);const Qe=he=>{const Ae={path:he.path,kind:he.kind};De(st=>st.some(gt=>gt.path===Ae.path)?st:[...st,Ae]),i(t.replace(/@([^\s@]*)$/,"")),T(null),ae()},Ni=he=>{i(`${he} `),T(null),ae()},zr=he=>{i(he);const Ae=/@([^\s@]*)$/.exec(he);if(Ae!==null){T({kind:"mention",query:Ae[1]??""}),J(0);return}if(he.startsWith("/")&&!he.includes(" ")){T({kind:"slash",query:he.slice(1)}),J(0);return}T(null)},Ft=()=>{const he=Z0(F,Tt?.vision??null);return he===null?!1:(ze({text:he,hint:"换一个声明了图片输入的模型,或先把图片移除。"}),!0)},tn=async he=>{if(!(he===ct||Be)){jt(!0),Ee(null);try{await mx(he,S);const Ae=await pm(S);le(Ae),ht(Ae.current),re({name:Ae.current,vision:Ae.currentVision}),Ke(!1),Te("")}catch(Ae){Ee(Ae instanceof Error?Ae.message:String(Ae))}finally{jt(!1)}}},_i=async he=>{const Ae=he.trimStart().slice(1).trim();if(Ae===""){te(X0("","用法:`!<命令>`(例:`!git status`)"));return}ge(!0),te(null);try{te(await hE(Ae)),i(""),De([])}catch(st){te(X0(Ae,st instanceof Error?st.message:String(st)))}finally{ge(!1)}},Nn=()=>{if(ne)return;if(t.trimStart().startsWith("!")){_i(t);return}if(Ft())return;const he=_m(F),Ae=W0(t,[...D,...Q0(F)]);r(Ae.trim()===""&&he.length>0?gE(F):Ae,he.length===0?void 0:he),De([]),K([])},Hr=he=>{if(we!==null){const Ae=we.kind==="mention"?X:Se;if(he.key==="ArrowDown"){he.preventDefault(),J(st=>Ae.length===0?0:(st+1)%Ae.length);return}if(he.key==="ArrowUp"){he.preventDefault(),J(st=>Ae.length===0?0:(st-1+Ae.length)%Ae.length);return}if(he.key==="Escape"){he.preventDefault(),T(null);return}if(he.key==="Enter"||he.key==="Tab"&&we.kind==="slash"){if(Ae.length===0)return;if(he.preventDefault(),we.kind==="mention"){const st=X[E]??X[0];st!==void 0&&Qe(st)}else{const st=Se[E]??Se[0];st!==void 0&&Ni(st.name)}return}}if(he.key==="Enter"&&!he.shiftKey&&(he.metaKey||he.ctrlKey)){he.preventDefault(),m?.();return}if(he.key==="Enter"&&!he.shiftKey){if(he.preventDefault(),h){if(Ft())return;if(_m(F).length>0){ze({text:"运行中不能排队带图",hint:"等这一轮结束再发;或先把图片移除。"});return}if(xp(t)!==null){ze({text:"运行中不能改目标",hint:"等这一轮结束再发;或先停止当前回合。"});return}(t.trim()!==""||D.length>0||F.length>0)&&(g?.(W0(t,[...D,...Q0(F)])),De([]),K([]));return}Ge&&Nn()}};return u.jsxs("div",{className:c?"composer empty-composer":"composer",children:[D.length>0||F.length>0?u.jsxs("div",{className:"chips",children:[D.map(he=>u.jsxs("span",{className:"att",children:[u.jsx("span",{className:"g",children:"@"}),u.jsx("span",{className:"att-path",children:xu(he)}),u.jsx("button",{className:"x",title:"移除引用",onClick:()=>{De(Ae=>Ae.filter(st=>st.path!==he.path))},children:"✕"})]},`ref-${he.path}`)),F.map(he=>{const Ae=he.result,st=Ae?.textLike??!0,gt=he.state==="uploading"?" uploading":he.state==="failed"?" failed":"";return u.jsxs("span",{className:`att${gt}`,title:Ae?.path??he.name,children:[Ae!==void 0&&!Ae.textLike?u.jsx("img",{className:"thumb",src:`/file/raw?path=${encodeURIComponent(Ae.path)}`,alt:""}):u.jsx("span",{className:"g",children:"▤"}),u.jsx("span",{className:"att-name",children:he.name}),Ae===void 0?null:u.jsx("span",{className:"att-size",children:mE(Ae.bytes)}),he.state==="uploading"?u.jsx("span",{className:"att-tag muted",children:"上传中"}):he.state==="failed"?u.jsx("span",{className:"att-tag bad",children:"失败"}):st?u.jsx("span",{className:"att-tag ok",children:"可读"}):Bu(he)?u.jsx("span",{className:"att-tag muted",children:"图片"}):u.jsx("span",{className:"att-tag warn",children:"非文本 · 只落盘"}),he.state==="uploading"?u.jsx("span",{className:"spinner"}):null,u.jsx("button",{className:"x",title:"移除附件(只去掉本次输入里的引用;已上传的文件仍在 .daluo/uploads/,删除要走审批)",onClick:()=>{K(En=>En.filter(Ue=>Ue.id!==he.id))},children:"✕"})]},he.id)})]}):null,we?.kind==="mention"?u.jsxs("div",{className:"menu",ref:A,children:[u.jsxs("div",{className:"menu-head",children:[u.jsx("span",{children:"引用文件 · 工作区 daluo"}),u.jsx("span",{style:{marginLeft:"auto"},children:"↑↓ 选择 · Enter 插入 · Esc 关闭"})]}),X.map((he,Ae)=>u.jsxs("button",{className:Ae===E?"menu-item sel":"menu-item",onMouseDown:st=>{st.preventDefault(),Qe(he)},children:[u.jsx("span",{className:"g",children:he.kind==="directory"?"◻":"▤"}),u.jsx("span",{className:"path",children:xu(he)}),he.kind==="directory"?u.jsx("span",{className:"key",children:"目录"}):null]},`${he.kind}-${he.path}`)),ke!==null?u.jsxs("div",{className:"menu-item empty",children:["候选取不到:",ke]}):null,ke===null&&X.length===0&&!ye?u.jsx("div",{className:"menu-item empty",children:"没有匹配的路径"}):null,ye?u.jsx("div",{className:"menu-item empty",children:"查工作区…"}):null,ce?u.jsx("div",{className:"menu-foot",children:"结果可能被截断(遍历到 5 万条上限就停)——先打几个字符收窄"}):null]}):null,we?.kind==="slash"?u.jsxs("div",{className:"menu",ref:R,children:[u.jsxs("div",{className:"menu-head",children:[u.jsx("span",{children:"技能与指令"}),u.jsx("span",{style:{marginLeft:"auto"},children:"Tab 补全 · Enter 执行 · Esc 关闭"})]}),Se.map((he,Ae)=>u.jsxs("button",{className:Ae===E?"menu-item sel":"menu-item",onMouseDown:st=>{st.preventDefault(),Ni(he.name)},children:[u.jsx("span",{className:"g",children:"›"}),he.name," ",he.desc,u.jsx("span",{className:"key",children:he.scope})]},he.name)),Se.length===0?u.jsx("div",{className:"menu-item",children:"没有匹配的指令"}):null]}):null,u.jsx("input",{ref:L,type:"file",multiple:!0,hidden:!0,onChange:he=>{const Ae=Array.from(he.target.files??[]);he.target.value="",be(Ae)}}),u.jsx("textarea",{"data-dsh-part":"composer-input",ref:P,rows:1,value:t,placeholder:"说一句话就开始(Enter 提交,Shift+Enter 换行)",onChange:he=>{zr(he.target.value)},onKeyDown:Hr,onPaste:he=>{const Ae=Array.from(he.clipboardData.files).filter(gt=>gt.type.startsWith("image/"));if(Ae.length===0)return;he.preventDefault();const st=new Date;be(Ae.map((gt,En)=>new File([gt],pE(st,En),{type:gt.type})))}}),q===null?null:u.jsxs("div",{className:q.ok?"shell-result ok":"shell-result err",children:[u.jsxs("div",{className:"shell-head",children:[u.jsx("span",{className:"shell-prompt",children:"$"}),u.jsx("code",{className:"shell-cmd",children:q.command===""?"(空命令)":q.command}),u.jsx("span",{className:"shell-state",children:q.error!==void 0?q.error:q.ok?`完成 ${(q.durationMs/1e3).toFixed(1)}s`:`退出码 ${String(q.exitCode??"—")}`}),u.jsx("span",{className:"grow"}),u.jsx("span",{className:"shell-note",children:"本机命令 · 不进会话日志(模型看不到)"}),u.jsx("button",{className:"shell-x",title:"收起","aria-label":"收起本机命令结果",onClick:()=>{te(null)},children:"✕"})]}),(()=>{const he=[q.stdout,q.stderr].filter(Ae=>Ae!=="").join("");return he===""?q.error===void 0?u.jsx("div",{className:"shell-empty",children:"(无输出)"}):null:u.jsx("pre",{className:"shell-out",children:q.truncated?`${he}
12
+ …(输出已截断)`:he})})()]}),ve===null?null:u.jsxs("div",{className:"att-error",children:[u.jsx("div",{className:"att-error-title",children:u.jsx("b",{children:ve.text})}),u.jsx("div",{className:"att-error-line dim",children:ve.hint})]}),pt.length===0?null:u.jsxs("div",{className:"att-error",children:[u.jsxs("div",{className:"att-error-title",children:[u.jsx("b",{children:"上传被拒:"}),pt[0]?.error]}),pt.slice(1).map(he=>u.jsxs("div",{className:"att-error-line",children:[he.name,":",he.error]},he.id)),u.jsx("div",{className:"att-error-line dim",children:"大文件请直接放进工作区再用 @ 引用(cp 一次,没有中间层);空文件不上传。"})]}),u.jsxs("div",{className:"composer-bar",children:[u.jsx("button",{className:"tool-btn key",title:"添加附件(也可以把文件拖进来,或直接粘贴截图)",onClick:()=>{L.current?.click()},children:"+"}),u.jsx("button",{className:"tool-btn key",title:"引用文件 @",onClick:()=>{T({kind:"mention",query:""}),J(0),ae()},children:"@"}),u.jsx("button",{className:"tool-btn key",title:"跑本机命令 !",onClick:()=>{i(`${t}!`),ae()},children:"!"}),u.jsx("button",{className:"tool-btn key",title:"技能与指令 /",onClick:()=>{i("/"),T({kind:"slash",query:""}),J(0),ae()},children:"/"}),u.jsx("span",{className:"grow"}),_===void 0?null:u.jsxs("span",{style:{position:"relative"},ref:N,children:[u.jsxs("button",{className:v==="danger-full"?"model-chip profile-chip danger":"model-chip profile-chip",title:"切换这个会话的权限档(写 policy/profile,下一轮生效)",onClick:()=>{Q(he=>!he),Ke(!1),T(null)},children:[u.jsx("span",{className:"g",style:{fontSize:"11px"},children:"⛨"}),v===void 0?"缺省档":J0[v],u.jsx("span",{className:"g g-dim",style:{fontSize:"10px"},children:"▾"})]}),$?u.jsxs("div",{className:"menu",style:{position:"absolute",bottom:"36px",right:0,width:"300px",marginBottom:0},children:[u.jsx("div",{className:"menu-head",children:"会话权限档 · 只影响这个会话"}),["read-only","workspace","danger-full"].map(he=>u.jsxs("button",{className:he===v?"menu-item sel":"menu-item",onClick:()=>{if(Q(!1),he!==v){if(he==="danger-full"){G(!0);return}_(he)}},children:[u.jsx("span",{className:"g",children:he===v?"●":"○"}),J0[he],u.jsx("span",{className:"key",children:bE[he]})]},he)),u.jsx("div",{className:"menu-head",style:{borderTop:"1px solid var(--border)",paddingTop:"6px"},children:"切档写进事件日志,下一轮请求生效"})]}):null]}),u.jsx(SE,{label:a}),u.jsx("button",{className:y===!0?"plan-toggle on":"plan-toggle",type:"button",title:x===!0?"运行中不能切计划模式:等这一轮结束":"计划模式:只读探索,不写文件",disabled:x===!0,onClick:w,children:"◐ 计划模式"}),u.jsxs("span",{style:{position:"relative"},ref:M,children:[u.jsxs("button",{className:"model-chip",title:"选择模型",onClick:()=>{Ke(he=>!he),Q(!1),T(null)},children:[u.jsx("span",{style:{width:"6px",height:"6px",borderRadius:"50%",background:"var(--green)",display:"inline-block"}}),ct,u.jsx("span",{className:"g g-dim",style:{fontSize:"10px"},children:"▾"})]}),Je?(()=>{const he=me.trim().toLowerCase(),Ae=(qe?.groups??[]).map(Ue=>({...Ue,models:Ue.models.filter(Ut=>he===""||Ut.name.toLowerCase().includes(he)||Ue.name.toLowerCase().includes(he))})).filter(Ue=>Ue.models.length>0),st=new Set((qe?.groups??[]).flatMap(Ue=>Ue.models.map(Ut=>Ut.name))),gt=(qe?.models??[]).filter(Ue=>!st.has(Ue)).filter(Ue=>he===""||Ue.toLowerCase().includes(he)),En=Ae.length===0&&gt.length===0;return u.jsxs("div",{className:"menu model-menu",children:[u.jsxs("div",{className:"menu-head",children:["选择模型",Be?" · 切换中…":""]}),u.jsx("input",{className:"model-search",placeholder:"搜索模型或供应商…",value:me,autoFocus:!0,onChange:Ue=>{Te(Ue.target.value)},onKeyDown:Ue=>{Ue.key==="Escape"&&(Ue.preventDefault(),Ke(!1))}}),He===null?null:u.jsx("div",{className:"model-error",children:He}),qe===null?u.jsx("div",{className:"model-note",children:"读取模型列表…"}):null,u.jsxs("div",{className:"model-list",children:[Ae.map(Ue=>u.jsxs("div",{className:"model-group",children:[u.jsxs("div",{className:"model-group-head",children:[Ue.name,Ue.active?u.jsx("span",{className:"model-group-tag",children:"当前供应商"}):null]}),Ue.models.map(Ut=>{const dn=Ut.contextWindowTokens===void 0?"":`${String(Ut.contextWindowTokens)} 上下文`;return u.jsxs("button",{className:Ut.name===ct?"menu-item model-row sel":"menu-item model-row",disabled:Be,onClick:()=>{tn(Ut.name)},children:[u.jsx("span",{className:"g",children:Ut.name===ct?"●":"○"}),u.jsxs("span",{className:"model-row-main",children:[u.jsx("span",{className:"model-name",children:Ut.name}),u.jsx("span",{className:"model-provider",children:Ue.name})]}),u.jsx("span",{className:"key",children:Ut.name===ct?dn===""?"当前":`当前 · ${dn}`:dn})]},`${Ue.id}/${Ut.name}`)})]},Ue.id)),gt.length===0?null:u.jsxs("div",{className:"model-group",children:[u.jsx("div",{className:"model-group-head",children:"其它"}),gt.map(Ue=>u.jsxs("button",{className:Ue===ct?"menu-item model-row sel":"menu-item model-row",disabled:Be,onClick:()=>{tn(Ue)},children:[u.jsx("span",{className:"g",children:Ue===ct?"●":"○"}),u.jsx("span",{className:"model-row-main",children:u.jsx("span",{className:"model-name",children:Ue})}),Ue===ct?u.jsx("span",{className:"key",children:"当前"}):null]},`other/${Ue}`))]})]}),En&&qe!==null?u.jsx("div",{className:"model-note",children:"没有匹配的模型。"}):null]})})():null]}),h?u.jsx("button",{className:"stop",title:"停止","aria-label":"停止",onClick:()=>f?.(),children:"■"}):u.jsx("button",{className:"send",title:"发送","aria-label":"发送",disabled:!Ge,onClick:Nn,children:u.jsx("span",{className:"g",style:{fontSize:"16px"},children:"↵"})})]}),z?u.jsx("div",{className:"modal-mask",role:"dialog","aria-modal":"true","data-dsh-part":"dialog",children:u.jsxs("div",{className:"modal",children:[u.jsxs("h3",{children:[u.jsx("span",{className:"g",style:{color:"var(--red)"},children:"⚠"})," 切到「完全放开」?"]}),u.jsx("p",{children:"这个会话不再限制路径,也不再跑 Guardian 审查:写文件、跑命令都会直接执行。风险和它造成的一切由你自己兜。"}),u.jsxs("div",{className:"modal-actions",children:[u.jsx("button",{className:"btn",onClick:()=>{G(!1)},children:"取消"}),u.jsx("button",{className:"btn danger",onClick:()=>{G(!1),_?.("danger-full")},children:"确认切换"})]})]})}):null]})}),J0={"read-only":"只读",workspace:"可写工作区","danger-full":"完全放开"},bE={"read-only":"只能读",workspace:"工作区内可写","danger-full":"不限路径 · 不审查"};class jl extends Error{constructor(t){super(t),this.name="槽位注册错误"}}const eS=e=>`${e.slot}\0${e.pluginId}\0${e.id}`;class xE{entries=[];listeners=new Set;version=0;register(t,i){if(typeof t!="string"||t==="")throw new jl("pluginId 必须是非空字符串");if(typeof i.slot!="string"||i.slot==="")throw new jl("slot 必须是非空字符串");if(typeof i.id!="string"||i.id==="")throw new jl("id 必须是非空字符串");if(i.Component===void 0||i.Component===null)throw new jl(`slot ${i.slot} 的 Component 为空`);const r=i.order??100;if(!Number.isFinite(r))throw new jl(`order 必须是有限数字(收到 ${String(i.order)})`);const a={slot:i.slot,pluginId:t,id:i.id,order:r,Component:i.Component,...typeof i.title=="string"&&i.title!==""?{title:i.title}:{},...typeof i.forPlugin=="string"&&i.forPlugin!==""?{forPlugin:i.forPlugin}:{}};if(this.entries.some(h=>eS(h)===eS(a)))throw new jl(`重复注册:${i.slot} / ${t} / ${i.id}`);this.entries.push(a),this.emit();let c=!1;return()=>{if(c)return;c=!0;const h=this.entries.indexOf(a);h>=0&&(this.entries.splice(h,1),this.emit())}}componentsOf(t){return this.entries.map((i,r)=>({entry:i,index:r})).filter(i=>i.entry.slot===t).sort((i,r)=>i.entry.order-r.entry.order||i.index-r.index).map(i=>i.entry)}subscribe=t=>(this.listeners.add(t),()=>this.listeners.delete(t));getVersion=()=>this.version;clear(){this.entries=[],this.emit()}emit(){this.version+=1;for(const t of[...this.listeners])t()}}const Tr=new xE,wE={输入卡Dock:"conversation.composer.dock"};function CE({name:e}){const t=C.useSyncExternalStore(Tr.subscribe,Tr.getVersion),i=Tr.componentsOf(e);return i.length===0?null:u.jsx("div",{className:"plugin-slot","data-slot":e,"data-version":t,children:i.map(r=>{const a=r.Component;return u.jsx("div",{className:"plugin-slot-item","data-plugin":r.pluginId,children:u.jsx(a,{})},`${r.pluginId}/${r.id}`)})})}const kE=e=>e==="completed"?"✓ 已完成":e==="paused"?"已暂停":e==="blocked"?"⊘ 已阻塞":"进行中";function NE({goal:e,busy:t,onPause:i,onResume:r,onClear:a}){return e.objective===""?null:u.jsxs("div",{className:`goal-bar${e.status==="completed"?" done":""}${e.status==="paused"?" paused":""}`,children:[u.jsx("span",{className:"tag",children:"◆ 目标"}),u.jsx("span",{className:"txt",title:e.objective,children:e.objective}),u.jsx("span",{className:"goal-status",children:kE(e.status)}),e.status==="active"?u.jsx("button",{className:"goal-icon",type:"button",title:"暂停目标(挂起,不再要求完成表态)","aria-label":"暂停目标",disabled:t,onClick:i,children:"⏸"}):null,e.status==="paused"?u.jsx("button",{className:"goal-icon",type:"button",title:"恢复目标(写回 active)","aria-label":"恢复目标",disabled:t,onClick:r,children:"▶"}):null,u.jsx("button",{className:"goal-icon",type:"button",title:"清除目标(直接消失,历史不删)","aria-label":"清除目标",disabled:t,onClick:a,children:"✕"})]})}function jf(e){return Array.from(e.dataTransfer.types).includes("Files")}function xx(e){const[t,i]=C.useState(!1),r=C.useRef(0);return{dragging:t,handlers:{onDragEnter:a=>{jf(a)&&(a.preventDefault(),r.current+=1,i(!0))},onDragOver:a=>{jf(a)&&(a.preventDefault(),a.dataTransfer.dropEffect="copy")},onDragLeave:a=>{jf(a)&&(r.current=Math.max(0,r.current-1),r.current===0&&i(!1))},onDrop:a=>{a.preventDefault(),r.current=0,i(!1);const c=Array.from(a.dataTransfer.files);c.length>0&&e(c)}}}}function wx(){return u.jsx("div",{className:"drop-overlay",children:u.jsxs("div",{className:"drop-card",children:[u.jsx("div",{className:"drop-icon",children:"+"}),u.jsxs("div",{className:"drop-title",children:["松开上传到 ",u.jsx("code",{children:".daluo/uploads/"})]}),u.jsx("div",{className:"drop-sub",children:"文本 → 模型能 read 到 · 图片等非文本 → 只落盘(模型拿不到内容)"}),u.jsx("div",{className:"drop-sub dim",children:"一次可拖多个 · 单个 ≤ 1 MB(请求体上限同源)"})]})})}function EE({pending:e,onEdit:t,onRemove:i,onSteer:r}){const[a,c]=C.useState(!1),[h,f]=C.useState(null),[g,m]=C.useState(""),[v,_]=C.useState(!1);if(e.length===0)return null;const S=x=>{_(!0),x().finally(()=>{_(!1)})},y=x=>{f(x.id),m(x.content)};return u.jsxs("div",{className:"qdock","data-dsh-part":"queue-dock",children:[u.jsxs("button",{className:"qdock-head",onClick:()=>{c(x=>!x)},"aria-expanded":!a,children:[u.jsx("span",{className:"qicon","aria-hidden":"true",children:"≣"}),u.jsx("b",{children:String(e.length)})," 条排队消息",u.jsx("span",{className:"qchev","aria-hidden":"true",children:a?"▾":"▴"})]}),a?null:u.jsxs(u.Fragment,{children:[u.jsx("div",{className:"qitems",children:e.map((x,w)=>u.jsxs("div",{className:h===x.id?"qrow editing":"qrow",children:[u.jsx("span",{className:"qno",children:String(w+1)}),x.placement==="steering"?u.jsx("span",{className:"qtag",children:"插话"}):null,h===x.id?u.jsxs("span",{className:"qedit",children:[u.jsx("textarea",{value:g,onChange:j=>{m(j.target.value)},rows:2,autoFocus:!0}),u.jsxs("span",{className:"qedit-act",children:[u.jsx("button",{className:"mini primary",disabled:v||g.trim()==="",onClick:()=>{S(async()=>{await t(x.id,g.trim()),f(null)})},children:"保存"}),u.jsx("button",{className:"mini",onClick:()=>{f(null)},children:"取消"})]})]}):u.jsxs(u.Fragment,{children:[u.jsx("span",{className:"qtext",title:x.content,children:x.content}),u.jsxs("span",{className:"qact",children:[u.jsx("button",{title:"编辑",onClick:()=>{y(x)},children:"✎"}),u.jsx("button",{title:"删除",onClick:()=>{S(async()=>{await i(x.id)})},children:"✕"}),u.jsx("button",{title:"插话发送这一条",onClick:()=>{S(async()=>{await r(x.id)})},children:"↑"})]})]})]},x.id))}),u.jsx("div",{className:"qfoot",children:"⌘/Ctrl+Enter 插话发送全部排队消息"})]})]})}async function jE(e){try{return await navigator.clipboard.writeText(e),!0}catch{}try{const t=document.createElement("textarea");t.value=e,t.setAttribute("readonly","readonly"),t.style.position="fixed",t.style.top="-1000px",t.style.opacity="0",document.body.appendChild(t),t.select();const i=document.execCommand("copy");return t.remove(),i}catch{return!1}}function TE(e,t){const i={};return(e[e.length-1]===""?[...e,""]:e).join((i.padRight?" ":"")+","+(i.padLeft===!1?"":" ")).trim()}const DE=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,ME=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,AE={};function tS(e,t){return(AE.jsx?ME:DE).test(e)}const RE=/[ \t\n\f\r]/g;function OE(e){return typeof e=="object"?e.type==="text"?nS(e.value):!1:nS(e)}function nS(e){return e.replace(RE,"")===""}class po{constructor(t,i,r){this.normal=i,this.property=t,r&&(this.space=r)}}po.prototype.normal={};po.prototype.property={};po.prototype.space=void 0;function Cx(e,t){const i={},r={};for(const a of e)Object.assign(i,a.property),Object.assign(r,a.normal);return new po(i,r,t)}function vm(e){return e.toLowerCase()}class Fn{constructor(t,i){this.attribute=i,this.property=t}}Fn.prototype.attribute="";Fn.prototype.booleanish=!1;Fn.prototype.boolean=!1;Fn.prototype.commaOrSpaceSeparated=!1;Fn.prototype.commaSeparated=!1;Fn.prototype.defined=!1;Fn.prototype.mustUseProperty=!1;Fn.prototype.number=!1;Fn.prototype.overloadedBoolean=!1;Fn.prototype.property="";Fn.prototype.spaceSeparated=!1;Fn.prototype.space=void 0;let BE=0;const Ye=Br(),Wt=Br(),ym=Br(),xe=Br(),Ct=Br(),Dr=Br(),ti=Br();function Br(){return 2**++BE}const Sm=Object.freeze(Object.defineProperty({__proto__:null,boolean:Ye,booleanish:Wt,commaOrSpaceSeparated:ti,commaSeparated:Dr,number:xe,overloadedBoolean:ym,spaceSeparated:Ct},Symbol.toStringTag,{value:"Module"})),Tf=Object.keys(Sm);class wp extends Fn{constructor(t,i,r,a){let c=-1;if(super(t,i),iS(this,"space",a),typeof r=="number")for(;++c<Tf.length;){const h=Tf[c];iS(this,Tf[c],(r&Sm[h])===Sm[h])}}}wp.prototype.defined=!0;function iS(e,t,i){i&&(e[t]=i)}function ql(e){const t={},i={};for(const[r,a]of Object.entries(e.properties)){const c=new wp(r,e.transform(e.attributes||{},r),a,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(c.mustUseProperty=!0),t[r]=c,i[vm(r)]=r,i[vm(c.attribute)]=r}return new po(t,i,e.space)}const kx=ql({properties:{ariaActiveDescendant:null,ariaAtomic:Wt,ariaAutoComplete:null,ariaBusy:Wt,ariaChecked:Wt,ariaColCount:xe,ariaColIndex:xe,ariaColSpan:xe,ariaControls:Ct,ariaCurrent:null,ariaDescribedBy:Ct,ariaDetails:null,ariaDisabled:Wt,ariaDropEffect:Ct,ariaErrorMessage:null,ariaExpanded:Wt,ariaFlowTo:Ct,ariaGrabbed:Wt,ariaHasPopup:null,ariaHidden:Wt,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:Ct,ariaLevel:xe,ariaLive:null,ariaModal:Wt,ariaMultiLine:Wt,ariaMultiSelectable:Wt,ariaOrientation:null,ariaOwns:Ct,ariaPlaceholder:null,ariaPosInSet:xe,ariaPressed:Wt,ariaReadOnly:Wt,ariaRelevant:null,ariaRequired:Wt,ariaRoleDescription:Ct,ariaRowCount:xe,ariaRowIndex:xe,ariaRowSpan:xe,ariaSelected:Wt,ariaSetSize:xe,ariaSort:null,ariaValueMax:xe,ariaValueMin:xe,ariaValueNow:xe,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function Nx(e,t){return t in e?e[t]:t}function Ex(e,t){return Nx(e,t.toLowerCase())}const LE=ql({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:Dr,acceptCharset:Ct,accessKey:Ct,action:null,allow:null,allowFullScreen:Ye,allowPaymentRequest:Ye,allowUserMedia:Ye,alpha:Ye,alt:null,as:null,async:Ye,autoCapitalize:null,autoComplete:Ct,autoFocus:Ye,autoPlay:Ye,blocking:Ct,capture:null,charSet:null,checked:Ye,cite:null,className:Ct,closedBy:null,colorSpace:null,cols:xe,colSpan:xe,command:null,commandFor:null,content:null,contentEditable:Wt,controls:Ye,controlsList:Ct,coords:xe|Dr,crossOrigin:null,data:null,dateTime:null,decoding:null,default:Ye,defer:Ye,dir:null,dirName:null,disabled:Ye,download:ym,draggable:Wt,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:Ye,formTarget:null,headers:Ct,height:xe,hidden:ym,high:xe,href:null,hrefLang:null,htmlFor:Ct,httpEquiv:Ct,id:null,imageSizes:null,imageSrcSet:null,inert:Ye,inputMode:null,integrity:null,is:null,isMap:Ye,itemId:null,itemProp:Ct,itemRef:Ct,itemScope:Ye,itemType:Ct,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:Ye,low:xe,manifest:null,max:null,maxLength:xe,media:null,method:null,min:null,minLength:xe,multiple:Ye,muted:Ye,name:null,nonce:null,noModule:Ye,noValidate:Ye,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:Ye,optimum:xe,pattern:null,ping:Ct,placeholder:null,playsInline:Ye,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:Ye,referrerPolicy:null,rel:Ct,required:Ye,reversed:Ye,rows:xe,rowSpan:xe,sandbox:Ct,scope:null,scoped:Ye,seamless:Ye,selected:Ye,shadowRootClonable:Ye,shadowRootCustomElementRegistry:Ye,shadowRootDelegatesFocus:Ye,shadowRootMode:null,shadowRootSerializable:Ye,shape:null,size:xe,sizes:null,slot:null,span:xe,spellCheck:Wt,src:null,srcDoc:null,srcLang:null,srcSet:null,start:xe,step:null,style:null,tabIndex:xe,target:null,title:null,translate:null,type:null,typeMustMatch:Ye,useMap:null,value:Wt,width:xe,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:Ct,axis:null,background:null,bgColor:null,border:xe,borderColor:null,bottomMargin:xe,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:Ye,declare:Ye,event:null,face:null,frame:null,frameBorder:null,hSpace:xe,leftMargin:xe,link:null,longDesc:null,lowSrc:null,marginHeight:xe,marginWidth:xe,noResize:Ye,noHref:Ye,noShade:Ye,noWrap:Ye,object:null,profile:null,prompt:null,rev:null,rightMargin:xe,rules:null,scheme:null,scrolling:Wt,standby:null,summary:null,text:null,topMargin:xe,valueType:null,version:null,vAlign:null,vLink:null,vSpace:xe,allowTransparency:null,autoCorrect:null,autoSave:null,credentialless:Ye,disablePictureInPicture:Ye,disableRemotePlayback:Ye,exportParts:Dr,part:Ct,prefix:null,property:null,results:xe,security:null,unselectable:null},space:"html",transform:Ex}),zE=ql({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",maskType:"mask-type",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:ti,accentHeight:xe,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:xe,amplitude:xe,arabicForm:null,ascent:xe,attributeName:null,attributeType:null,azimuth:xe,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:xe,by:null,calcMode:null,capHeight:xe,className:Ct,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:xe,diffuseConstant:xe,direction:null,display:null,dur:null,divisor:xe,dominantBaseline:null,download:Ye,dx:null,dy:null,edgeMode:null,editable:null,elevation:xe,enableBackground:null,end:null,event:null,exponent:xe,externalResourcesRequired:null,fill:null,fillOpacity:xe,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:Dr,g2:Dr,glyphName:Dr,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:xe,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:xe,horizOriginX:xe,horizOriginY:xe,id:null,ideographic:xe,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:xe,k:xe,k1:xe,k2:xe,k3:xe,k4:xe,kernelMatrix:ti,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:xe,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskType:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:xe,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:xe,overlineThickness:xe,paintOrder:null,panose1:null,path:null,pathLength:xe,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:Ct,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:xe,pointsAtY:xe,pointsAtZ:xe,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:ti,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:ti,rev:ti,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:ti,requiredFeatures:ti,requiredFonts:ti,requiredFormats:ti,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:xe,specularExponent:xe,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:xe,strikethroughThickness:xe,string:null,stroke:null,strokeDashArray:ti,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:xe,strokeOpacity:xe,strokeWidth:null,style:null,surfaceScale:xe,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:ti,tabIndex:xe,tableValues:null,target:null,targetX:xe,targetY:xe,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:ti,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:xe,underlineThickness:xe,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:xe,values:null,vAlphabetic:xe,vMathematical:xe,vectorEffect:null,vHanging:xe,vIdeographic:xe,version:null,vertAdvY:xe,vertOriginX:xe,vertOriginY:xe,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:xe,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:Nx}),jx=ql({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(e,t){return"xlink:"+t.slice(5).toLowerCase()}}),Tx=ql({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:Ex}),Dx=ql({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),HE={classId:"classID",dataType:"datatype",itemId:"itemID",strokeDashArray:"strokeDasharray",strokeDashOffset:"strokeDashoffset",strokeLineCap:"strokeLinecap",strokeLineJoin:"strokeLinejoin",strokeMiterLimit:"strokeMiterlimit",typeOf:"typeof",xLinkActuate:"xlinkActuate",xLinkArcRole:"xlinkArcrole",xLinkHref:"xlinkHref",xLinkRole:"xlinkRole",xLinkShow:"xlinkShow",xLinkTitle:"xlinkTitle",xLinkType:"xlinkType",xmlnsXLink:"xmlnsXlink"},IE=/[A-Z]/g,sS=/-[a-z]/g,UE=/^data[-\w.:]+$/i;function PE(e,t){const i=vm(t);let r=t,a=Fn;if(i in e.normal)return e.property[e.normal[i]];if(i.length>4&&i.slice(0,4)==="data"&&UE.test(t)){if(t.charAt(4)==="-"){const c=t.slice(5).replace(sS,FE);r="data"+c.charAt(0).toUpperCase()+c.slice(1)}else{const c=t.slice(4);if(!sS.test(c)){let h=c.replace(IE,qE);h.charAt(0)!=="-"&&(h="-"+h),t="data"+h}}a=wp}return new a(r,t)}function qE(e){return"-"+e.toLowerCase()}function FE(e){return e.charAt(1).toUpperCase()}const $E=Cx([kx,LE,jx,Tx,Dx],"html"),Cp=Cx([kx,zE,jx,Tx,Dx],"svg");function VE(e){return e.join(" ").trim()}var rS=/\/\*(?:[^*]|\*(?!\/))*\*\//g,KE=/\n/g,YE=/^\s*/,WE=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,XE=/^:\s*/,GE=/^((?:'(?:\\.|[^'\\])*'|"(?:\\.|[^"\\])*"|url\((?:'(?:\\.|[^'\\])*'|"(?:\\.|[^"\\])*"|[^)]*)\)|[^};])+)/,QE=/^[;\s]*/,ZE=`
13
+ `,lS="/",aS="*",Pa="",JE="comment",ej="declaration";function tj(e,t){if(typeof e!="string")throw new TypeError("First argument must be a string");if(!e)return[];t=t||{};var i=1,r=1;function a(x){var w=x.match(KE);w&&(i+=w.length);var j=x.lastIndexOf(ZE);r=~j?x.length-j:r+x.length}function c(){var x={line:i,column:r};return function(w){return w.position=new h(x),m(),w}}function h(x){this.start=x,this.end={line:i,column:r},this.source=t.source}h.prototype.content=e;function f(x){var w=new Error(t.source+":"+i+":"+r+": "+x);if(w.reason=x,w.filename=t.source,w.line=i,w.column=r,w.source=e,!t.silent)throw w}function g(x){var w=x.exec(e);if(w){var j=w[0];return a(j),e=e.slice(j.length),w}}function m(){g(YE)}function v(x){for(var w;w=_();)x.push(w);return x}function _(){var x=c();if(!(lS!=e.charAt(0)||aS!=e.charAt(1))){for(var w=2;Pa!=e.charAt(w)&&(aS!=e.charAt(w)||lS!=e.charAt(w+1));)++w;if(w+=2,Pa===e.charAt(w-1))return f("End of comment missing");var j=e.slice(2,w-2);return r+=2,a(j),e=e.slice(w),r+=2,x({type:JE,comment:j})}}function S(){var x=c(),w=g(WE);if(w){if(_(),!g(XE))return f("property missing ':'");var j=g(GE),N=x({type:ej,property:w[0].replace(rS,Pa).trim(),value:j?j[0].replace(rS,Pa).trim():Pa});return g(QE),N}}function y(){var x=[];v(x);for(var w;w=S();)x.push(w),v(x);return x}return m(),y()}function nj(e,t){let i=null;if(!e||typeof e!="string")return i;const r=tj(e),a=typeof t=="function";return r.forEach(c=>{if(c.type!=="declaration")return;const{property:h,value:f}=c;a?t(h,f,c):f&&(i=i??{},i[h]=f)}),i}const Mx=Ax("end"),kp=Ax("start");function Ax(e){return t;function t(i){const r=i&&i.position&&i.position[e]||{};if(typeof r.line=="number"&&r.line>0&&typeof r.column=="number"&&r.column>0)return{line:r.line,column:r.column,offset:typeof r.offset=="number"&&r.offset>-1?r.offset:void 0}}}function ij(e){const t=kp(e),i=Mx(e);if(t&&i)return{start:t,end:i}}function io(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?oS(e.position):"start"in e||"end"in e?oS(e):"line"in e||"column"in e?bm(e):""}function bm(e){return cS(e&&e.line)+":"+cS(e&&e.column)}function oS(e){return bm(e&&e.start)+"-"+bm(e&&e.end)}function cS(e){return e&&typeof e=="number"?e:1}class kn extends Error{constructor(t,i,r){super(),typeof i=="string"&&(r=i,i=void 0);let a="",c={},h=!1;if(i&&("line"in i&&"column"in i?c={place:i}:"start"in i&&"end"in i?c={place:i}:"type"in i?c={ancestors:[i],place:i.position}:c={...i}),typeof t=="string"?a=t:!c.cause&&t&&(h=!0,a=t.message,c.cause=t),!c.ruleId&&!c.source&&typeof r=="string"){const g=r.indexOf(":");g===-1?c.ruleId=r:(c.source=r.slice(0,g),c.ruleId=r.slice(g+1))}if(!c.place&&c.ancestors&&c.ancestors){const g=c.ancestors[c.ancestors.length-1];g&&(c.place=g.position)}const f=c.place&&"start"in c.place?c.place.start:c.place;this.ancestors=c.ancestors||void 0,this.cause=c.cause||void 0,this.column=f?f.column:void 0,this.fatal=void 0,this.file="",this.message=a,this.line=f?f.line:void 0,this.name=io(c.place)||"1:1",this.place=c.place||void 0,this.reason=this.message,this.ruleId=c.ruleId||void 0,this.source=c.source||void 0,this.stack=h&&c.cause&&typeof c.cause.stack=="string"?c.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}kn.prototype.file="";kn.prototype.name="";kn.prototype.reason="";kn.prototype.message="";kn.prototype.stack="";kn.prototype.column=void 0;kn.prototype.line=void 0;kn.prototype.ancestors=void 0;kn.prototype.cause=void 0;kn.prototype.fatal=void 0;kn.prototype.place=void 0;kn.prototype.ruleId=void 0;kn.prototype.source=void 0;const Np={}.hasOwnProperty,sj=new Map,rj=/[A-Z]/g,lj=/-([a-z])/g,aj=new Set(["table","tbody","thead","tfoot","tr"]),oj=new Set(["td","th"]),Rx="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function cj(e,t){if(!t||t.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const i=t.filePath||void 0;let r;if(t.development){if(typeof t.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");r=_j(i,t.jsxDEV)}else{if(typeof t.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof t.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");r=gj(i,t.jsx,t.jsxs)}const a={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:r,elementAttributeNameCase:t.elementAttributeNameCase||"react",evaluater:t.createEvaluater?t.createEvaluater():void 0,filePath:i,ignoreInvalidStyle:t.ignoreInvalidStyle||!1,passKeys:t.passKeys!==!1,passNode:t.passNode||!1,schema:t.space==="svg"?Cp:$E,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},c=Ox(a,e,void 0);return c&&typeof c!="string"?c:a.create(e,a.Fragment,{children:c||void 0},void 0)}function Ox(e,t,i){if(t.type==="element")return uj(e,t,i);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return hj(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return fj(e,t,i);if(t.type==="mdxjsEsm")return dj(e,t);if(t.type==="root")return mj(e,t,i);if(t.type==="text")return pj(e,t)}function uj(e,t,i){const r=e.schema;let a=r;t.tagName.toLowerCase()==="svg"&&r.space==="html"&&(a=Cp,e.schema=a),e.ancestors.push(t);const c=Lx(e,t.tagName,!1),h=vj(e,t);let f=jp(e,t);return aj.has(t.tagName)&&(f=f.filter(function(g){return typeof g=="string"?!OE(g):!0})),Bx(e,h,c,t),Ep(h,f),e.ancestors.pop(),e.schema=r,e.create(t,c,h,i)}function hj(e,t){if(t.data&&t.data.estree&&e.evaluater){const r=t.data.estree.body[0];return r.type,e.evaluater.evaluateExpression(r.expression)}oo(e,t.position)}function dj(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);oo(e,t.position)}function fj(e,t,i){const r=e.schema;let a=r;t.name==="svg"&&r.space==="html"&&(a=Cp,e.schema=a),e.ancestors.push(t);const c=t.name===null?e.Fragment:Lx(e,t.name,!0),h=yj(e,t),f=jp(e,t);return Bx(e,h,c,t),Ep(h,f),e.ancestors.pop(),e.schema=r,e.create(t,c,h,i)}function mj(e,t,i){const r={};return Ep(r,jp(e,t)),e.create(t,e.Fragment,r,i)}function pj(e,t){return t.value}function Bx(e,t,i,r){typeof i!="string"&&i!==e.Fragment&&e.passNode&&(t.node=r)}function Ep(e,t){if(t.length>0){const i=t.length>1?t:t[0];i&&(e.children=i)}}function gj(e,t,i){return r;function r(a,c,h,f){const m=Array.isArray(h.children)?i:t;return f?m(c,h,f):m(c,h)}}function _j(e,t){return i;function i(r,a,c,h){const f=Array.isArray(c.children),g=kp(r);return t(a,c,h,f,{columnNumber:g?g.column-1:void 0,fileName:e,lineNumber:g?g.line:void 0},void 0)}}function vj(e,t){const i={};let r,a;for(a in t.properties)if(a!=="children"&&Np.call(t.properties,a)){const c=Sj(e,a,t.properties[a]);if(c){const[h,f]=c;e.tableCellAlignToStyle&&h==="align"&&typeof f=="string"&&oj.has(t.tagName)?r=f:i[h]=f}}if(r){const c=i.style||(i.style={});c[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=r}return i}function yj(e,t){const i={};for(const r of t.attributes)if(r.type==="mdxJsxExpressionAttribute")if(r.data&&r.data.estree&&e.evaluater){const c=r.data.estree.body[0];c.type;const h=c.expression;h.type;const f=h.properties[0];f.type,Object.assign(i,e.evaluater.evaluateExpression(f.argument))}else oo(e,t.position);else{const{name:a}=r;let c;if(r.value&&typeof r.value=="object")if(r.value.data&&r.value.data.estree&&e.evaluater){const f=r.value.data.estree.body[0];f.type,c=e.evaluater.evaluateExpression(f.expression)}else oo(e,t.position);else c=r.value===null?!0:r.value;i[a]=c}return i}function jp(e,t){const i=[];let r=-1;const a=e.passKeys?new Map:sj;for(;++r<t.children.length;){const c=t.children[r];let h;if(e.passKeys){const g=c.type==="element"?c.tagName:c.type==="mdxJsxFlowElement"||c.type==="mdxJsxTextElement"?c.name:void 0;if(g){const m=a.get(g)||0;h=g+"-"+m,a.set(g,m+1)}}const f=Ox(e,c,h);f!==void 0&&i.push(f)}return i}function Sj(e,t,i){if(i==null||typeof i=="number"&&Number.isNaN(i))return;const r=PE(e.schema,t);return Array.isArray(i)&&(i=r.commaSeparated?TE(i):VE(i)),r.property==="style"?["style",typeof i=="object"?e.stylePropertyNameCase==="dom"?i:xj(i):bj(e,String(i))]:[e.elementAttributeNameCase==="react"&&r.space?HE[r.property]||r.property:r.attribute,i]}function bj(e,t){const i={};try{nj(t,function(r,a){if(r&&a){let c=r;c.slice(0,2)!=="--"&&(c=c.toLowerCase(),e.stylePropertyNameCase==="dom"&&(c.slice(0,4)==="-ms-"&&(c=c.slice(1)),c=c.replace(lj,kj))),i[c]=a}})}catch(r){if(e.ignoreInvalidStyle)return{};const a=r,c=new kn("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:a,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw c.file=e.filePath||void 0,c.url=Rx+"#cannot-parse-style-attribute",c}return i}function Lx(e,t,i){let r;if(!i)r={type:"Literal",value:t};else if(t.includes(".")){const a=t.split(".");let c=-1,h;for(;++c<a.length;){const f=tS(a[c])?{type:"Identifier",name:a[c]}:{type:"Literal",value:a[c]};h=h?{type:"MemberExpression",object:h,property:f,computed:!!(c&&f.type==="Literal"),optional:!1}:f}r=h}else r=tS(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};if(r.type==="Literal"){const a=r.value;return Np.call(e.components,a)?e.components[a]:a}if(e.evaluater)return e.evaluater.evaluateExpression(r);oo(e)}function oo(e,t){const i=new kn("Cannot handle MDX estrees without `createEvaluater`",{ancestors:e.ancestors,place:t,ruleId:"mdx-estree",source:"hast-util-to-jsx-runtime"});throw i.file=e.filePath||void 0,i.url=Rx+"#cannot-handle-mdx-estrees-without-createevaluater",i}function xj(e){const t={};let i;for(i in e)Np.call(e,i)&&(t[wj(i)]=e[i]);return t}function wj(e){if(e.slice(0,2)==="--")return e;let t=e.replace(rj,Cj);return t.slice(0,3)==="ms-"&&(t="-"+t),t}function Cj(e){return"-"+e.toLowerCase()}function kj(e,t){return t.toUpperCase()}const Df={action:["form"],cite:["blockquote","del","ins","q"],data:["object"],formAction:["button","input"],href:["a","area","base","link"],icon:["menuitem"],itemId:null,manifest:["html"],ping:["a","area"],poster:["video"],src:["audio","embed","iframe","img","input","script","source","track","video"]},Nj={};function Tp(e,t){const i=Nj,r=typeof i.includeImageAlt=="boolean"?i.includeImageAlt:!0,a=typeof i.includeHtml=="boolean"?i.includeHtml:!0;return zx(e,r,a)}function zx(e,t,i){if(Ej(e)){if("value"in e)return e.type==="html"&&!i?"":e.value;if(t&&"alt"in e&&e.alt)return e.alt;if("children"in e)return uS(e.children,t,i)}return Array.isArray(e)?uS(e,t,i):""}function uS(e,t,i){const r=[];let a=-1;for(;++a<e.length;)r[a]=zx(e[a],t,i);return r.join("")}function Ej(e){return!!(e&&typeof e=="object")}const hS=document.createElement("i");function Dp(e){const t="&"+e+";";hS.innerHTML=t;const i=hS.textContent;return i.charCodeAt(i.length-1)===59&&e!=="semi"||i===t?!1:i}function Ci(e,t,i,r){const a=e.length;let c=0,h;if(t<0?t=-t>a?0:a+t:t=t>a?a:t,i=i>0?i:0,r.length<1e4)h=Array.from(r),h.unshift(t,i),e.splice(...h);else for(i&&e.splice(t,i);c<r.length;)h=r.slice(c,c+1e4),h.unshift(t,0),e.splice(...h),c+=1e4,t+=1e4}function pi(e,t){return e.length>0?(Ci(e,e.length,0,t),e):t}const dS={}.hasOwnProperty;function Hx(e){const t={};let i=-1;for(;++i<e.length;)jj(t,e[i]);return t}function jj(e,t){let i;for(i in t){const a=(dS.call(e,i)?e[i]:void 0)||(e[i]={}),c=t[i];let h;if(c)for(h in c){dS.call(a,h)||(a[h]=[]);const f=c[h];Tj(a[h],Array.isArray(f)?f:f?[f]:[])}}}function Tj(e,t){let i=-1;const r=[];for(;++i<t.length;)(t[i].add==="after"?e:r).push(t[i]);Ci(e,0,0,r)}function Ix(e,t){const i=Number.parseInt(e,t);return i<9||i===11||i>13&&i<32||i>126&&i<160||i>55295&&i<57344||i>64975&&i<65008||(i&65535)===65535||(i&65535)===65534||i>1114111?"�":String.fromCodePoint(i)}function ki(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const Sn=Gs(/[A-Za-z]/),xn=Gs(/[\dA-Za-z]/),Dj=Gs(/[#-'*+\--9=?A-Z^-~]/);function wu(e){return e!==null&&(e<32||e===127)}const xm=Gs(/\d/),Mj=Gs(/[\dA-Fa-f]/),Ux=Gs(/[!-/:-@[-`{-~]/);function Pe(e){return e!==null&&e<-2}function kt(e){return e!==null&&(e<0||e===32)}function nt(e){return e===-2||e===-1||e===32}const Lu=Gs(new RegExp("\\p{P}|\\p{S}","u")),Ar=Gs(/\s/);function Gs(e){return t;function t(i){return i!==null&&i>-1&&e.test(String.fromCharCode(i))}}function Fl(e){const t=[];let i=-1,r=0,a=0;for(;++i<e.length;){const c=e.charCodeAt(i);let h="";if(c===37&&xn(e.charCodeAt(i+1))&&xn(e.charCodeAt(i+2)))a=2;else if(c<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(c))||(h=String.fromCharCode(c));else if(c>55295&&c<57344){const f=e.charCodeAt(i+1);c<56320&&f>56319&&f<57344?(h=String.fromCharCode(c,f),a=1):h="�"}else h=String.fromCharCode(c);h&&(t.push(e.slice(r,i),encodeURIComponent(h)),r=i+a+1,h=""),a&&(i+=a,a=0)}return t.join("")+e.slice(r)}function ft(e,t,i,r){const a=r?r-1:1/0;let c=0;return h;function h(g){return nt(g)?(e.enter(i),f(g)):t(g)}function f(g){return nt(g)&&c++<a?(e.consume(g),f):(e.exit(i),t(g))}}function Px(e,t,i,r,a,c){let h=0;return f;function f(v){return nt(v)?(e.enter(r),g(v)):m(v)}function g(v){return nt(v)&&h<c?(e.consume(v),h++,g):(e.exit(r),m(v))}function m(v){return h>=a?t(v):i(v)}}const Aj={tokenize:Rj};function Rj(e){const t=e.attempt(this.parser.constructs.contentInitial,r,a);let i;return t;function r(f){if(f===null){e.consume(f);return}return e.enter("lineEnding"),e.consume(f),e.exit("lineEnding"),ft(e,t,"linePrefix")}function a(f){return e.enter("paragraph"),c(f)}function c(f){const g=e.enter("chunkText",{contentType:"text",previous:i});return i&&(i.next=g),i=g,h(f)}function h(f){if(f===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(f);return}return Pe(f)?(e.consume(f),e.exit("chunkText"),c):(e.consume(f),h)}}let Cu=class{constructor(){this.index=new Map,this.map=[]}add(t,i,r){fS(this,t,i,r,!1)}addBefore(t,i,r){fS(this,t,i,r,!0)}consume(t){if(this.map.sort(function(c,h){return c[0]-h[0]}),this.map.length===0)return;let i=this.map.length;const r=[];for(;i>0;)i-=1,r.push(t.slice(this.map[i][0]+this.map[i][1]),this.map[i][2]),t.length=this.map[i][0];r.push(t.slice()),t.length=0;let a=r.pop();for(;a;){for(const c of a)t.push(c);a=r.pop()}this.map.length=0,this.index.clear()}};function fS(e,t,i,r,a){if(i===0&&r.length===0)return;const c=e.index.get(t);if(c){c[1]+=i,a?(r.push(...c[2]),c[2]=r):c[2].push(...r);return}const h=[t,i,r];e.map.push(h),e.index.set(t,h)}const Oj={tokenize:Bj},mS={tokenize:Lj};function Bj(e){const t=this,i=[];let r=0,a,c,h;return f;function f(A){if(r<i.length){const R=i[r];return t.containerState=R[1],e.attempt(R[0].continuation,g,m)(A)}return m(A)}function g(A){if(r++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,a&&M();const R=t.events.length;let I=R,H;for(;I--;)if(t.events[I][0]==="exit"&&t.events[I][1].type==="chunkFlow"){H=t.events[I][1].end;break}N(r);let O=R;for(;O<t.events.length;)t.events[O][1].end={...H},O++;const $=new Cu;return $.add(I+1,0,t.events.slice(R)),$.add(R,O-R,[]),$.consume(t.events),m(A)}return f(A)}function m(A){if(r===i.length){if(!a)return S(A);if(a.currentConstruct&&a.currentConstruct.concrete)return x(A);t.interrupt=!!(a.currentConstruct&&!a._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(mS,v,_)(A)}function v(A){return a&&M(),N(r),S(A)}function _(A){return t.parser.lazy[t.now().line]=r!==i.length,h=t.now().offset,x(A)}function S(A){return t.containerState={},e.attempt(mS,y,x)(A)}function y(A){return r++,i.push([t.currentConstruct,t.containerState]),S(A)}function x(A){if(A===null){a&&M(),N(0),e.consume(A);return}return a=a||t.parser.flow(t.now()),e.enter("chunkFlow",{_tokenizer:a,contentType:"flow",previous:c}),w(A)}function w(A){if(A===null){j(e.exit("chunkFlow"),!0),N(0),e.consume(A);return}return Pe(A)?(e.consume(A),j(e.exit("chunkFlow")),r=0,t.interrupt=void 0,f):(e.consume(A),w)}function j(A,R){const I=t.sliceStream(A);if(R&&I.push(null),A.previous=c,c&&(c.next=A),c=A,a.defineSkip(A.start),a.write(I),t.parser.lazy[A.start.line]){let H=a.events.length;for(;H--;)if(a.events[H][1].start.offset<h&&(!a.events[H][1].end||a.events[H][1].end.offset>h))return;const O=t.events.length;let $=O,Q,z;for(;$--;)if(t.events[$][0]==="exit"&&t.events[$][1].type==="chunkFlow"){if(Q){z=t.events[$][1].end;break}Q=!0}for(N(r),H=O;H<t.events.length;)t.events[H][1].end={...z},H++;const G=new Cu;G.add($+1,0,t.events.slice(O)),G.add(O,H-O,[]),G.consume(t.events)}}function N(A){let R=i.length;for(;R-- >A;){const I=i[R];t.containerState=I[1],I[0].exit.call(t,e)}i.length=A}function M(){a.write([null]),c=void 0,a=void 0,t.containerState._closeFlow=void 0}}function Lj(e,t,i){return ft(e,e.attempt(this.parser.constructs.document,t,i),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function Ws(e){if(e===null||kt(e)||Ar(e))return 1;if(Lu(e))return 2}function zu(e,t,i){const r=[];let a=-1;for(;++a<e.length;){const c=e[a].resolveAll;c&&!r.includes(c)&&(t=c(t,i),r.push(c))}return t}const wm={name:"attention",resolveAll:zj,tokenize:Hj};function zj(e,t){let i=-1,r;for(;++i<e.length;)if(e[i][0]==="enter"&&e[i][1].type==="attentionSequence"&&e[i][1]._close){let a=i;for(;a--;)if(e[a][0]==="exit"&&e[a][1].type==="attentionSequence"&&e[a][1]._open&&t.sliceSerialize(e[a][1]).charCodeAt(0)===t.sliceSerialize(e[i][1]).charCodeAt(0)){if((e[a][1]._close||e[i][1]._open)&&(e[i][1].end.offset-e[i][1].start.offset)%3&&!((e[a][1].end.offset-e[a][1].start.offset+e[i][1].end.offset-e[i][1].start.offset)%3))continue;const c=e[a][1].end.offset-e[a][1].start.offset>1&&e[i][1].end.offset-e[i][1].start.offset>1?2:1,h={...e[a][1].end},f={...e[i][1].start};pS(h,-c),pS(f,c);const g={type:c>1?"strongSequence":"emphasisSequence",start:h,end:{...e[a][1].end}},m={type:c>1?"strongSequence":"emphasisSequence",start:{...e[i][1].start},end:f},v={type:c>1?"strongText":"emphasisText",start:{...e[a][1].end},end:{...e[i][1].start}},_={type:c>1?"strong":"emphasis",start:{...g.start},end:{...m.end}};e[a][1].end={...g.start},e[i][1].start={...m.end},r=[],e[a][1].end.offset-e[a][1].start.offset&&(r=pi(r,[["enter",e[a][1],t],["exit",e[a][1],t]])),r=pi(r,[["enter",_,t],["enter",g,t],["exit",g,t],["enter",v,t]]),r=pi(r,zu(t.parser.constructs.insideSpan.null,e.slice(a+1,i),t)),r=pi(r,[["exit",v,t],["enter",m,t],["exit",m,t],["exit",_,t]]);let S=0;e[i][1].end.offset-e[i][1].start.offset&&(S=2,r=pi(r,[["enter",e[i][1],t],["exit",e[i][1],t]])),Ci(e,a-1,i-a+3,r),i=a+r.length-S-2;break}}for(i=-1;++i<e.length;)e[i][1].type==="attentionSequence"&&(e[i][1].type="data");return e}function Hj(e,t){const i=this.parser.constructs.attentionMarkers.null,r=this.previous,a=Ws(r);let c;return h;function h(g){return c=g,e.enter("attentionSequence"),f(g)}function f(g){if(g===c)return e.consume(g),f;const m=e.exit("attentionSequence"),v=Ws(g),_=!v||v===2&&a||i.includes(g)&&g!==42&&g!==95,S=!a||a===2&&v||i.includes(r)&&r!==42&&r!==95;return m._open=!!(c===42?_:_&&(a||!S)),m._close=!!(c===42?S:S&&(v||!_)),t(g)}}function pS(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const Ij={name:"autolink",tokenize:Uj};function Uj(e,t,i){let r=0;return a;function a(y){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(y),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),c}function c(y){return Sn(y)?(e.consume(y),h):y===64?i(y):m(y)}function h(y){return y===43||y===45||y===46||xn(y)?(r=1,f(y)):m(y)}function f(y){return y===58?(e.consume(y),r=0,g):(y===43||y===45||y===46||xn(y))&&r++<32?(e.consume(y),f):(r=0,m(y))}function g(y){return y===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(y),e.exit("autolinkMarker"),e.exit("autolink"),t):y===null||y===32||y===60||wu(y)?i(y):(e.consume(y),g)}function m(y){return y===64?(e.consume(y),v):Dj(y)?(e.consume(y),m):i(y)}function v(y){return xn(y)?_(y):i(y)}function _(y){return y===46?(e.consume(y),r=0,v):y===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(y),e.exit("autolinkMarker"),e.exit("autolink"),t):S(y)}function S(y){if((y===45||xn(y))&&r++<63){const x=y===45?S:_;return e.consume(y),x}return i(y)}}const go={partial:!0,tokenize:Pj};function Pj(e,t,i){return r;function r(c){return nt(c)?ft(e,a,"linePrefix")(c):a(c)}function a(c){return c===null||Pe(c)?t(c):i(c)}}const qx={continuation:{tokenize:Fj},exit:$j,name:"blockQuote",tokenize:qj};function qj(e,t,i){const r=this;return a;function a(h){if(h===62){const f=r.containerState;return f.open||(e.enter("blockQuote",{_container:!0}),f.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(h),e.exit("blockQuoteMarker"),c}return i(h)}function c(h){return nt(h)?(e.enter("blockQuotePrefixWhitespace"),e.consume(h),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(h))}}function Fj(e,t,i){const r=this;return a;function a(h){return nt(h)?ft(e,c,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(h):c(h)}function c(h){return e.attempt(qx,t,i)(h)}}function $j(e){e.exit("blockQuote")}const Fx={name:"characterEscape",tokenize:Vj};function Vj(e,t,i){return r;function r(c){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(c),e.exit("escapeMarker"),a}function a(c){return Ux(c)?(e.enter("characterEscapeValue"),e.consume(c),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):i(c)}}const $x={name:"characterReference",tokenize:Kj};function Kj(e,t,i){const r=this;let a=0,c,h;return f;function f(_){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(_),e.exit("characterReferenceMarker"),g}function g(_){return _===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(_),e.exit("characterReferenceMarkerNumeric"),m):(e.enter("characterReferenceValue"),c=31,h=xn,v(_))}function m(_){return _===88||_===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(_),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),c=6,h=Mj,v):(e.enter("characterReferenceValue"),c=7,h=xm,v(_))}function v(_){if(_===59&&a){const S=e.exit("characterReferenceValue");return h===xn&&!Dp(r.sliceSerialize(S))?i(_):(e.enter("characterReferenceMarker"),e.consume(_),e.exit("characterReferenceMarker"),e.exit("characterReference"),t)}return h(_)&&a++<c?(e.consume(_),v):i(_)}}const Cm={partial:!0,tokenize:Yj};function Yj(e,t,i){const r=this;return a;function a(h){return h===null?i(h):(e.enter("lineEnding"),e.consume(h),e.exit("lineEnding"),c)}function c(h){return r.parser.lazy[r.now().line]?i(h):t(h)}}const gS={concrete:!0,name:"codeFenced",tokenize:Wj};function Wj(e,t,i){const r=this,a={partial:!0,tokenize:I};let c=0,h=0,f;return g;function g(H){return m(H)}function m(H){const O=r.events[r.events.length-1];return c=O&&O[1].type==="linePrefix"?O[2].sliceSerialize(O[1],!0).length:0,f=H,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),v(H)}function v(H){return H===f?(h++,e.consume(H),v):h<3?i(H):(e.exit("codeFencedFenceSequence"),nt(H)?ft(e,_,"whitespace")(H):_(H))}function _(H){return H===null||Pe(H)?(e.exit("codeFencedFence"),r.interrupt?t(H):e.check(Cm,w,R)(H)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),S(H))}function S(H){return H===null||Pe(H)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),_(H)):nt(H)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),ft(e,y,"whitespace")(H)):H===96&&H===f?i(H):(e.consume(H),S)}function y(H){return H===null||Pe(H)?_(H):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),x(H))}function x(H){return H===null||Pe(H)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),_(H)):H===96&&H===f?i(H):(e.consume(H),x)}function w(H){return e.attempt(a,R,j)(H)}function j(H){return e.enter("lineEnding"),e.consume(H),e.exit("lineEnding"),N}function N(H){return c>0&&nt(H)?ft(e,M,"linePrefix",c+1)(H):M(H)}function M(H){return H===null||Pe(H)?e.check(Cm,w,R)(H):(e.enter("codeFlowValue"),A(H))}function A(H){return H===null||Pe(H)?(e.exit("codeFlowValue"),M(H)):(e.consume(H),A)}function R(H){return e.exit("codeFenced"),t(H)}function I(H,O,$){let Q=0;return z;function z(K){return H.enter("lineEnding"),H.consume(K),H.exit("lineEnding"),G}function G(K){return H.enter("codeFencedFence"),nt(K)?ft(H,P,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(K):P(K)}function P(K){return K===f?(H.enter("codeFencedFenceSequence"),L(K)):$(K)}function L(K){return K===f?(Q++,H.consume(K),L):Q>=h?(H.exit("codeFencedFenceSequence"),nt(K)?ft(H,F,"whitespace")(K):F(K)):$(K)}function F(K){return K===null||Pe(K)?(H.exit("codeFencedFence"),O(K)):$(K)}}}const Mf={name:"codeIndented",tokenize:Gj},Xj={partial:!0,tokenize:Qj};function Gj(e,t,i){return r;function r(f){return e.enter("codeIndented"),Px(e,a,i,"linePrefix",4,4)(f)}function a(f){return f===null?h(f):Pe(f)?e.attempt(Xj,a,h)(f):(e.enter("codeFlowValue"),c(f))}function c(f){return f===null||Pe(f)?(e.exit("codeFlowValue"),a(f)):(e.consume(f),c)}function h(f){return e.exit("codeIndented"),t(f)}}function Qj(e,t,i){const r=this;return a;function a(h){return r.parser.lazy[r.now().line]?i(h):Pe(h)?(e.enter("lineEnding"),e.consume(h),e.exit("lineEnding"),a):Px(e,t,c,"linePrefix",4,4)(h)}function c(h){return Pe(h)?a(h):i(h)}}const Zj={name:"codeText",previous:eT,resolve:Jj,tokenize:tT};function Jj(e){let t=e.length-4,i=3,r,a;if((e[i][1].type==="lineEnding"||e[i][1].type==="space")&&(e[t][1].type==="lineEnding"||e[t][1].type==="space")){for(r=i;++r<t;)if(e[r][1].type==="codeTextData"){e[i][1].type="codeTextPadding",e[t][1].type="codeTextPadding",i+=2,t-=2;break}}for(r=i-1,t++;++r<=t;)a===void 0?r!==t&&e[r][1].type!=="lineEnding"&&(a=r):(r===t||e[r][1].type==="lineEnding")&&(e[a][1].type="codeTextData",r!==a+2&&(e[a][1].end=e[r-1][1].end,e.splice(a+2,r-a-2),t-=r-a-2,r=a+2),a=void 0);return e}function eT(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function tT(e,t,i){let r=0,a,c;return h;function h(_){return e.enter("codeText"),e.enter("codeTextSequence"),f(_)}function f(_){return _===96?(e.consume(_),r++,f):(e.exit("codeTextSequence"),g(_))}function g(_){return _===null?i(_):_===32?(e.enter("space"),e.consume(_),e.exit("space"),g):_===96?(c=e.enter("codeTextSequence"),a=0,v(_)):Pe(_)?(e.enter("lineEnding"),e.consume(_),e.exit("lineEnding"),g):(e.enter("codeTextData"),m(_))}function m(_){return _===null||_===32||_===96||Pe(_)?(e.exit("codeTextData"),g(_)):(e.consume(_),m)}function v(_){return _===96?(e.consume(_),a++,v):a===r?(e.exit("codeTextSequence"),e.exit("codeText"),t(_)):(c.type="codeTextData",m(_))}}class nT{constructor(t){this.left=t?[...t]:[],this.right=[]}get(t){if(t<0||t>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+t+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return t<this.left.length?this.left[t]:this.right[this.right.length-t+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(t,i){const r=i??Number.POSITIVE_INFINITY;return r<this.left.length?this.left.slice(t,r):t>this.left.length?this.right.slice(this.right.length-r+this.left.length,this.right.length-t+this.left.length).reverse():this.left.slice(t).concat(this.right.slice(this.right.length-r+this.left.length).reverse())}splice(t,i,r){const a=i||0;this.setCursor(Math.trunc(t));const c=this.right.splice(this.right.length-a,Number.POSITIVE_INFINITY);return r&&qa(this.left,r),c.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(t){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(t)}pushMany(t){this.setCursor(Number.POSITIVE_INFINITY),qa(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),qa(this.right,t.reverse())}setCursor(t){if(!(t===this.left.length||t>this.left.length&&this.right.length===0||t<0&&this.left.length===0))if(t<this.left.length){const i=this.left.splice(t,Number.POSITIVE_INFINITY);qa(this.right,i.reverse())}else{const i=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);qa(this.left,i.reverse())}}}function qa(e,t){let i=0;if(t.length<1e4)e.push(...t);else for(;i<t.length;)e.push(...t.slice(i,i+1e4)),i+=1e4}function Vx(e){const t={};let i=-1,r,a,c,h,f,g,m;const v=new nT(e);for(;++i<v.length;){for(;i in t;)i=t[i];if(r=v.get(i),i&&r[1].type==="chunkFlow"&&v.get(i-1)[1].type==="listItemPrefix"&&(g=r[1]._tokenizer.events,c=0,c<g.length&&g[c][1].type==="lineEndingBlank"&&(c+=2),c<g.length&&g[c][1].type==="content"))for(;++c<g.length&&g[c][1].type!=="content";)g[c][1].type==="chunkText"&&(g[c][1]._isInFirstContentOfListItem=!0,c++);if(r[0]==="enter")r[1].contentType&&(Object.assign(t,iT(v,i)),i=t[i],m=!0);else if(r[1]._container){for(c=i,a=void 0;c--;)if(h=v.get(c),h[1].type==="lineEnding"||h[1].type==="lineEndingBlank")h[0]==="enter"&&(a&&(v.get(a)[1].type="lineEndingBlank"),h[1].type="lineEnding",a=c);else if(!(h[1].type==="linePrefix"||h[1].type==="listItemIndent"))break;a&&(r[1].end={...v.get(a)[1].start},f=v.slice(a,i),f.unshift(r),v.splice(a,i-a+1,f))}}return Ci(e,0,Number.POSITIVE_INFINITY,v.slice(0)),!m}function iT(e,t){const i=e.get(t)[1],r=e.get(t)[2];let a=t-1;const c=[];let h=i._tokenizer;h||(h=r.parser[i.contentType](i.start),i._contentTypeTextTrailing&&(h._contentTypeTextTrailing=!0));const f=h.events,g=[],m={};let v,_,S=-1,y=i,x=0,w=0;const j=[w];for(;y;){for(;e.get(++a)[1]!==y;);c.push(a),y._tokenizer||(v=r.sliceStream(y),y.next||v.push(null),_&&h.defineSkip(y.start),y._isInFirstContentOfListItem&&(h._gfmTasklistFirstContentOfListItem=!0),h.write(v),y._isInFirstContentOfListItem&&(h._gfmTasklistFirstContentOfListItem=void 0)),_=y,y=y.next}for(y=i;++S<f.length;)f[S][0]==="exit"&&f[S-1][0]==="enter"&&f[S][1].type===f[S-1][1].type&&f[S][1].start.line!==f[S][1].end.line&&(w=S+1,j.push(w),y._tokenizer=void 0,y.previous=void 0,y=y.next);for(h.events=[],y?(y._tokenizer=void 0,y.previous=void 0):j.pop(),S=j.length;S--;){const N=f.slice(j[S],j[S+1]),M=c.pop();g.push([M,M+N.length-1]),e.splice(M,2,N)}for(g.reverse(),S=-1;++S<g.length;)m[x+g[S][0]]=x+g[S][1],x+=g[S][1]-g[S][0]-1;return m}const sT={resolve:lT,tokenize:aT},rT={partial:!0,tokenize:oT};function lT(e){return Vx(e),e}function aT(e,t){let i;return r;function r(f){return e.enter("content"),i=e.enter("chunkContent",{contentType:"content"}),a(f)}function a(f){return f===null?c(f):Pe(f)?e.check(rT,h,c)(f):(e.consume(f),a)}function c(f){return e.exit("chunkContent"),e.exit("content"),t(f)}function h(f){return e.consume(f),e.exit("chunkContent"),i.next=e.enter("chunkContent",{contentType:"content",previous:i}),i=i.next,a}}function oT(e,t,i){const r=this;return a;function a(h){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(h),e.exit("lineEnding"),ft(e,c,"linePrefix")}function c(h){if(h===null||Pe(h))return i(h);const f=r.events[r.events.length-1];return!r.parser.constructs.disable.null.includes("codeIndented")&&f&&f[1].type==="linePrefix"&&f[2].sliceSerialize(f[1],!0).length>=4?t(h):e.interrupt(r.parser.constructs.flow,i,t)(h)}}function Kx(e,t,i,r,a,c,h,f,g){const m=g||Number.POSITIVE_INFINITY;let v=0;return _;function _(N){return N===60?(e.enter(r),e.enter(a),e.enter(c),e.consume(N),e.exit(c),S):N===null||N===32||N===41||wu(N)?i(N):(e.enter(r),e.enter(h),e.enter(f),e.enter("chunkString",{contentType:"string"}),w(N))}function S(N){return N===62?(e.enter(c),e.consume(N),e.exit(c),e.exit(a),e.exit(r),t):(e.enter(f),e.enter("chunkString",{contentType:"string"}),y(N))}function y(N){return N===62?(e.exit("chunkString"),e.exit(f),S(N)):N===null||N===60||Pe(N)?i(N):(e.consume(N),N===92?x:y)}function x(N){return N===60||N===62||N===92?(e.consume(N),y):y(N)}function w(N){return!v&&(N===null||N===41||kt(N))?(e.exit("chunkString"),e.exit(f),e.exit(h),e.exit(r),t(N)):v<m&&N===40?(e.consume(N),v++,w):N===41?(e.consume(N),v--,w):N===null||N===32||N===40||wu(N)?i(N):(e.consume(N),N===92?j:w)}function j(N){return N===40||N===41||N===92?(e.consume(N),w):w(N)}}function Yx(e,t,i,r,a,c){const h=this;let f=0,g;return m;function m(y){return e.enter(r),e.enter(a),e.consume(y),e.exit(a),e.enter(c),v}function v(y){return f>999||y===null||y===91||y===93&&!g||y===94&&!f&&"_hiddenFootnoteSupport"in h.parser.constructs?i(y):y===93?(e.exit(c),e.enter(a),e.consume(y),e.exit(a),e.exit(r),t):Pe(y)?(e.enter("lineEnding"),e.consume(y),e.exit("lineEnding"),v):(e.enter("chunkString",{contentType:"string"}),_(y))}function _(y){return y===null||y===91||y===93||Pe(y)||f++>999?(e.exit("chunkString"),v(y)):(e.consume(y),g||(g=!nt(y)),y===92?S:_)}function S(y){return y===91||y===92||y===93?(e.consume(y),f++,_):_(y)}}function Wx(e,t,i,r,a,c){let h;return f;function f(S){return S===34||S===39||S===40?(e.enter(r),e.enter(a),e.consume(S),e.exit(a),h=S===40?41:S,g):i(S)}function g(S){return S===h?(e.enter(a),e.consume(S),e.exit(a),e.exit(r),t):(e.enter(c),m(S))}function m(S){return S===h?(e.exit(c),g(h)):S===null?i(S):Pe(S)?(e.enter("lineEnding"),e.consume(S),e.exit("lineEnding"),ft(e,m,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),v(S))}function v(S){return S===h||S===null||Pe(S)?(e.exit("chunkString"),m(S)):(e.consume(S),S===92?_:v)}function _(S){return S===h||S===92?(e.consume(S),v):v(S)}}function so(e,t){let i;return r;function r(a){return Pe(a)?(e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),i=!0,r):nt(a)?ft(e,r,i?"linePrefix":"lineSuffix")(a):t(a)}}const cT={name:"definition",tokenize:hT},uT={partial:!0,tokenize:dT};function hT(e,t,i){const r=this;let a;return c;function c(y){return e.enter("definition"),h(y)}function h(y){return Yx.call(r,e,f,i,"definitionLabel","definitionLabelMarker","definitionLabelString")(y)}function f(y){return a=ki(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),y===58?(e.enter("definitionMarker"),e.consume(y),e.exit("definitionMarker"),g):i(y)}function g(y){return kt(y)?so(e,m)(y):m(y)}function m(y){return Kx(e,v,i,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(y)}function v(y){return e.attempt(uT,_,_)(y)}function _(y){return nt(y)?ft(e,S,"whitespace")(y):S(y)}function S(y){return y===null||Pe(y)?(e.exit("definition"),r.parser.defined.push(a),t(y)):i(y)}}function dT(e,t,i){return r;function r(f){return kt(f)?so(e,a)(f):i(f)}function a(f){return Wx(e,c,i,"definitionTitle","definitionTitleMarker","definitionTitleString")(f)}function c(f){return nt(f)?ft(e,h,"whitespace")(f):h(f)}function h(f){return f===null||Pe(f)?t(f):i(f)}}const fT={name:"hardBreakEscape",tokenize:mT};function mT(e,t,i){return r;function r(c){return e.enter("hardBreakEscape"),e.consume(c),a}function a(c){return Pe(c)?(e.exit("hardBreakEscape"),t(c)):i(c)}}const pT={name:"headingAtx",resolve:gT,tokenize:_T};function gT(e,t){let i=e.length-2,r=3;if(e[r][1].type==="whitespace"&&(r+=2),i-2>r&&e[i][1].type==="whitespace"&&(i-=2),e[i][1].type==="atxHeadingSequence"&&(r===i-1||i-4>r&&e[i-2][1].type==="whitespace")&&(i-=r+1===i?2:4),i>r){const a={type:"atxHeadingText",start:e[r][1].start,end:e[i][1].end},c={type:"chunkText",start:e[r][1].start,end:e[i][1].end,contentType:"text"};Ci(e,r,i-r+1,[["enter",a,t],["enter",c,t],["exit",c,t],["exit",a,t]])}return e}function _T(e,t,i){let r=0;return a;function a(v){return e.enter("atxHeading"),c(v)}function c(v){return e.enter("atxHeadingSequence"),h(v)}function h(v){return v===35&&r++<6?(e.consume(v),h):v===null||kt(v)?(e.exit("atxHeadingSequence"),f(v)):i(v)}function f(v){return v===35?(e.enter("atxHeadingSequence"),g(v)):v===null||Pe(v)?(e.exit("atxHeading"),t(v)):nt(v)?ft(e,f,"whitespace")(v):(e.enter("atxHeadingText"),m(v))}function g(v){return v===35?(e.consume(v),g):(e.exit("atxHeadingSequence"),f(v))}function m(v){return v===null||v===35||kt(v)?(e.exit("atxHeadingText"),f(v)):(e.consume(v),m)}}const Xx=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],km=["pre","script","style","textarea"],vT={concrete:!0,name:"htmlFlow",resolveTo:ST,tokenize:bT},yT={partial:!0,tokenize:xT};function ST(e){let t=e.length;for(;t--&&!(e[t][0]==="enter"&&e[t][1].type==="htmlFlow"););return t>1&&e[t-2][1].type==="linePrefix"&&(e[t][1].start=e[t-2][1].start,e[t+1][1].start=e[t-2][1].start,e.splice(t-2,2)),e}function bT(e,t,i){const r=this;let a,c,h,f,g;return m;function m(T){return v(T)}function v(T){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(T),_}function _(T){return T===33?(e.consume(T),S):T===47?(e.consume(T),c=!0,w):T===63?(e.consume(T),a=3,r.interrupt?t:D):Sn(T)?(e.consume(T),h=String.fromCharCode(T),j):i(T)}function S(T){return T===45?(e.consume(T),a=2,y):T===91?(e.consume(T),a=5,f=0,x):Sn(T)?(e.consume(T),a=4,r.interrupt?t:D):i(T)}function y(T){return T===45?(e.consume(T),r.interrupt?t:D):i(T)}function x(T){const E="CDATA[";return T===E.charCodeAt(f++)?(e.consume(T),f===E.length?r.interrupt?t:P:x):i(T)}function w(T){return Sn(T)?(e.consume(T),h=String.fromCharCode(T),j):i(T)}function j(T){if(T===null||T===47||T===62||kt(T)){const E=T===47,J=h.toLowerCase();return!E&&!c&&km.includes(J)?(a=1,r.interrupt?t(T):P(T)):Xx.includes(h.toLowerCase())?(a=6,E?(e.consume(T),N):r.interrupt?t(T):P(T)):(a=7,r.interrupt&&!r.parser.lazy[r.now().line]?i(T):c?M(T):A(T))}return T===45||xn(T)?(e.consume(T),h+=String.fromCharCode(T),j):i(T)}function N(T){return T===62?(e.consume(T),r.interrupt?t:P):i(T)}function M(T){return nt(T)?(e.consume(T),M):z(T)}function A(T){return T===47?(e.consume(T),z):T===58||T===95||Sn(T)?(e.consume(T),R):nt(T)?(e.consume(T),A):z(T)}function R(T){return T===45||T===46||T===58||T===95||xn(T)?(e.consume(T),R):I(T)}function I(T){return T===61?(e.consume(T),H):nt(T)?(e.consume(T),I):A(T)}function H(T){return T===null||T===60||T===61||T===62||T===96?i(T):T===34||T===39?(e.consume(T),g=T,O):nt(T)?(e.consume(T),H):$(T)}function O(T){return T===g?(e.consume(T),g=null,Q):T===null||Pe(T)?i(T):(e.consume(T),O)}function $(T){return T===null||T===34||T===39||T===47||T===60||T===61||T===62||T===96||kt(T)?I(T):(e.consume(T),$)}function Q(T){return T===47||T===62||nt(T)?A(T):i(T)}function z(T){return T===62?(e.consume(T),G):i(T)}function G(T){return T===null||Pe(T)?P(T):nt(T)?(e.consume(T),G):i(T)}function P(T){return T===45&&a===2?(e.consume(T),q):T===60&&a===1?(e.consume(T),te):T===62&&a===4?(e.consume(T),De):T===63&&a===3?(e.consume(T),D):T===93&&a===5?(e.consume(T),ge):Pe(T)&&(a===6||a===7)?(e.exit("htmlFlowData"),e.check(yT,we,L)(T)):T===null||Pe(T)?(e.exit("htmlFlowData"),L(T)):(e.consume(T),P)}function L(T){return e.check(Cm,F,we)(T)}function F(T){return e.enter("lineEnding"),e.consume(T),e.exit("lineEnding"),K}function K(T){return T===null||Pe(T)?L(T):(e.enter("htmlFlowData"),P(T))}function q(T){return T===45?(e.consume(T),D):P(T)}function te(T){return T===47?(e.consume(T),h="",ne):P(T)}function ne(T){if(T===62){const E=h.toLowerCase();return km.includes(E)?(e.consume(T),De):P(T)}return Sn(T)&&h.length<8?(e.consume(T),h+=String.fromCharCode(T),ne):P(T)}function ge(T){return T===93?(e.consume(T),D):P(T)}function D(T){return T===62?(e.consume(T),De):T===45&&a===2?(e.consume(T),D):P(T)}function De(T){return T===null||Pe(T)?(e.exit("htmlFlowData"),we(T)):(e.consume(T),De)}function we(T){return e.exit("htmlFlow"),t(T)}}function xT(e,t,i){return r;function r(a){return e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),e.attempt(go,t,i)}}const wT={name:"htmlText",tokenize:CT};function CT(e,t,i){const r=this;let a,c,h;return f;function f(D){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(D),g}function g(D){return D===33?(e.consume(D),m):D===47?(e.consume(D),I):D===63?(e.consume(D),A):Sn(D)?(e.consume(D),$):i(D)}function m(D){return D===45?(e.consume(D),v):D===91?(e.consume(D),c=0,x):Sn(D)?(e.consume(D),M):i(D)}function v(D){return D===45?(e.consume(D),y):i(D)}function _(D){return D===null?i(D):D===45?(e.consume(D),S):Pe(D)?(h=_,te(D)):(e.consume(D),_)}function S(D){return D===45?(e.consume(D),y):_(D)}function y(D){return D===62?q(D):D===45?S(D):_(D)}function x(D){const De="CDATA[";return D===De.charCodeAt(c++)?(e.consume(D),c===De.length?w:x):i(D)}function w(D){return D===null?i(D):D===93?(e.consume(D),j):Pe(D)?(h=w,te(D)):(e.consume(D),w)}function j(D){return D===93?(e.consume(D),N):w(D)}function N(D){return D===62?q(D):D===93?(e.consume(D),N):w(D)}function M(D){return D===null||D===62?q(D):Pe(D)?(h=M,te(D)):(e.consume(D),M)}function A(D){return D===null?i(D):D===63?(e.consume(D),R):Pe(D)?(h=A,te(D)):(e.consume(D),A)}function R(D){return D===62?q(D):A(D)}function I(D){return Sn(D)?(e.consume(D),H):i(D)}function H(D){return D===45||xn(D)?(e.consume(D),H):O(D)}function O(D){return Pe(D)?(h=O,te(D)):nt(D)?(e.consume(D),O):q(D)}function $(D){return D===45||xn(D)?(e.consume(D),$):D===47||D===62||kt(D)?Q(D):i(D)}function Q(D){return D===47?(e.consume(D),q):D===58||D===95||Sn(D)?(e.consume(D),z):Pe(D)?(h=Q,te(D)):nt(D)?(e.consume(D),Q):q(D)}function z(D){return D===45||D===46||D===58||D===95||xn(D)?(e.consume(D),z):G(D)}function G(D){return D===61?(e.consume(D),P):Pe(D)?(h=G,te(D)):nt(D)?(e.consume(D),G):Q(D)}function P(D){return D===null||D===60||D===61||D===62||D===96?i(D):D===34||D===39?(e.consume(D),a=D,L):Pe(D)?(h=P,te(D)):nt(D)?(e.consume(D),P):(e.consume(D),F)}function L(D){return D===a?(e.consume(D),a=void 0,K):D===null?i(D):Pe(D)?(h=L,te(D)):(e.consume(D),L)}function F(D){return D===null||D===34||D===39||D===60||D===61||D===96?i(D):D===47||D===62||kt(D)?Q(D):(e.consume(D),F)}function K(D){return D===47||D===62||kt(D)?Q(D):i(D)}function q(D){return D===62?(e.consume(D),e.exit("htmlTextData"),e.exit("htmlText"),t):i(D)}function te(D){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(D),e.exit("lineEnding"),ne}function ne(D){return nt(D)?ft(e,ge,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(D):ge(D)}function ge(D){return e.enter("htmlTextData"),h(D)}}const Mp={name:"labelEnd",resolveAll:jT,resolveTo:TT,tokenize:DT},kT={tokenize:MT},NT={tokenize:AT},ET={tokenize:RT};function jT(e){let t=-1;const i=[];for(;++t<e.length;){const r=e[t][1];if(i.push(e[t]),r.type==="labelImage"||r.type==="labelLink"||r.type==="labelEnd"){const a=r.type==="labelImage"?4:2;r.type="data",t+=a}}return e.length!==i.length&&Ci(e,0,e.length,i),e}function TT(e,t){let i=e.length,r=0,a,c,h;for(;i--;){const v=e[i][1];if(a){if(v.type==="link"||v.type==="labelLink"&&v._inactive)break;e[i][0]==="enter"&&v.type==="labelLink"&&(v._inactive=!0)}else if(c){if(e[i][0]==="enter"&&(v.type==="labelImage"||v.type==="labelLink")&&!v._balanced&&(a=i,v.type!=="labelLink")){r=2;break}}else v.type==="labelEnd"&&(c=i)}const f={type:e[a][1].type==="labelLink"?"link":"image",start:{...e[a][1].start},end:{...e[e.length-1][1].end}},g={type:"label",start:{...e[a][1].start},end:{...e[c][1].end}},m={type:"labelText",start:{...e[a+r+2][1].end},end:{...e[c-2][1].start}};return h=[["enter",f,t],["enter",g,t]],h=pi(h,e.slice(a+1,a+r+3)),h=pi(h,[["enter",m,t]]),h=pi(h,zu(t.parser.constructs.insideSpan.null,e.slice(a+r+4,c-3),t)),h=pi(h,[["exit",m,t],e[c-2],e[c-1],["exit",g,t]]),h=pi(h,e.slice(c+1)),h=pi(h,[["exit",f,t]]),Ci(e,a,e.length,h),e}function DT(e,t,i){const r=this,a=r._labelStarts;let c,h;if(a){for(;a.length>0&&a[a.length-1]._balanced;)a.pop();c=a[a.length-1]}return f;function f(S){return c?c._inactive?_(S):(h=r.parser.defined.includes(ki(r.sliceSerialize({start:c.end,end:r.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(S),e.exit("labelMarker"),e.exit("labelEnd"),g):i(S)}function g(S){return S===40?e.attempt(kT,v,h?v:_)(S):S===91?e.attempt(NT,v,h?m:_)(S):h?v(S):_(S)}function m(S){return e.attempt(ET,v,_)(S)}function v(S){return a.pop(),t(S)}function _(S){return c._balanced=!0,i(S)}}function MT(e,t,i){return r;function r(_){return e.enter("resource"),e.enter("resourceMarker"),e.consume(_),e.exit("resourceMarker"),a}function a(_){return kt(_)?so(e,c)(_):c(_)}function c(_){return _===41?v(_):Kx(e,h,f,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(_)}function h(_){return kt(_)?so(e,g)(_):v(_)}function f(_){return i(_)}function g(_){return _===34||_===39||_===40?Wx(e,m,i,"resourceTitle","resourceTitleMarker","resourceTitleString")(_):v(_)}function m(_){return kt(_)?so(e,v)(_):v(_)}function v(_){return _===41?(e.enter("resourceMarker"),e.consume(_),e.exit("resourceMarker"),e.exit("resource"),t):i(_)}}function AT(e,t,i){const r=this;return a;function a(f){return Yx.call(r,e,c,h,"reference","referenceMarker","referenceString")(f)}function c(f){return r.parser.defined.includes(ki(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(f):i(f)}function h(f){return i(f)}}function RT(e,t,i){return r;function r(c){return e.enter("reference"),e.enter("referenceMarker"),e.consume(c),e.exit("referenceMarker"),a}function a(c){return c===93?(e.enter("referenceMarker"),e.consume(c),e.exit("referenceMarker"),e.exit("reference"),t):i(c)}}const OT={name:"labelStartImage",resolveAll:Mp.resolveAll,tokenize:BT};function BT(e,t,i){const r=this;let a;return c;function c(g){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(g),e.exit("labelImageMarker"),h}function h(g){return g===91?(e.enter("labelMarker"),e.consume(g),e.exit("labelMarker"),a=e.exit("labelImage"),f):i(g)}function f(g){return g===94&&"_hiddenFootnoteSupport"in r.parser.constructs?i(g):(r._labelStarts=r._labelStarts||[],r._labelStarts.push(a),t(g))}}const LT={name:"labelStartLink",resolveAll:Mp.resolveAll,tokenize:zT};function zT(e,t,i){const r=this;let a;return c;function c(f){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(f),e.exit("labelMarker"),a=e.exit("labelLink"),h}function h(f){return f===94&&"_hiddenFootnoteSupport"in r.parser.constructs?i(f):(r._labelStarts=r._labelStarts||[],r._labelStarts.push(a),t(f))}}const Af={name:"lineEnding",tokenize:HT};function HT(e,t){return i;function i(r){return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),ft(e,t,"linePrefix")}}const fu={name:"thematicBreak",tokenize:IT};function IT(e,t,i){let r=0,a;return c;function c(m){return e.enter("thematicBreak"),h(m)}function h(m){return a=m,f(m)}function f(m){return m===a?(e.enter("thematicBreakSequence"),g(m)):r>=3&&(m===null||Pe(m))?(e.exit("thematicBreak"),t(m)):i(m)}function g(m){return m===a?(e.consume(m),r++,g):(e.exit("thematicBreakSequence"),nt(m)?ft(e,f,"whitespace")(m):f(m))}}const qn={continuation:{tokenize:FT},exit:VT,name:"list",tokenize:qT},UT={partial:!0,tokenize:KT},PT={partial:!0,tokenize:$T};function qT(e,t,i){const r=this,a=r.events[r.events.length-1];let c=a&&a[1].type==="linePrefix"?a[2].sliceSerialize(a[1],!0).length:0,h=0;return f;function f(y){const x=r.containerState.type||(y===42||y===43||y===45?"listUnordered":"listOrdered");if(x==="listUnordered"?!r.containerState.marker||y===r.containerState.marker:xm(y)){if(r.containerState.type||(r.containerState.type=x,e.enter(x,{_container:!0})),x==="listUnordered")return e.enter("listItemPrefix"),y===42||y===45?e.check(fu,i,m)(y):m(y);if(!r.interrupt||y===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),g(y)}return i(y)}function g(y){return xm(y)&&++h<10?(e.consume(y),g):(!r.interrupt||h<2)&&(r.containerState.marker?y===r.containerState.marker:y===41||y===46)?(e.exit("listItemValue"),m(y)):i(y)}function m(y){return e.enter("listItemMarker"),e.consume(y),e.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||y,e.check(go,r.interrupt?i:v,e.attempt(UT,S,_))}function v(y){return r.containerState.initialBlankLine=!0,c++,S(y)}function _(y){return nt(y)?(e.enter("listItemPrefixWhitespace"),e.consume(y),e.exit("listItemPrefixWhitespace"),S):i(y)}function S(y){return r.containerState.size=c+r.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(y)}}function FT(e,t,i){const r=this;return r.containerState._closeFlow=void 0,e.check(go,a,c);function a(f){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,ft(e,t,"listItemIndent",r.containerState.size+1)(f)}function c(f){return r.containerState.furtherBlankLines||!nt(f)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,h(f)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(PT,t,h)(f))}function h(f){return r.containerState._closeFlow=!0,r.interrupt=void 0,ft(e,e.attempt(qn,t,i),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(f)}}function $T(e,t,i){const r=this;return ft(e,a,"listItemIndent",r.containerState.size+1);function a(c){const h=r.events[r.events.length-1];return h&&h[1].type==="listItemIndent"&&h[2].sliceSerialize(h[1],!0).length===r.containerState.size?t(c):i(c)}}function VT(e){e.exit(this.containerState.type)}function KT(e,t,i){const r=this;return ft(e,a,"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function a(c){const h=r.events[r.events.length-1];return!nt(c)&&h&&h[1].type==="listItemPrefixWhitespace"?t(c):i(c)}}const _S={name:"setextUnderline",resolveTo:YT,tokenize:WT};function YT(e,t){const i=new Cu;let r=e.length,a,c,h;for(;r--;)if(e[r][0]==="enter"){if(e[r][1].type==="content"){a=r;break}e[r][1].type==="paragraph"&&(c=r)}else e[r][1].type==="content"&&i.add(r,1,[]),!h&&e[r][1].type==="definition"&&(h=r);const f={type:"setextHeading",start:{...e[a][1].start},end:{...e[e.length-1][1].end}};return e[c][1].type="setextHeadingText",h?(i.add(c,0,[["enter",f,t]]),i.add(h+1,0,[["exit",e[a][1],t]]),e[a][1].end={...e[h][1].end}):e[a][1]=f,i.add(e.length,0,[["exit",f,t]]),i.consume(e),e}function WT(e,t,i){const r=this;let a;return c;function c(m){let v=r.events.length,_;for(;v--;)if(r.events[v][1].type!=="lineEnding"&&r.events[v][1].type!=="linePrefix"&&r.events[v][1].type!=="content"){_=r.events[v][1].type==="paragraph";break}return!r.parser.lazy[r.now().line]&&(r.interrupt||_)?(e.enter("setextHeadingLine"),a=m,h(m)):i(m)}function h(m){return e.enter("setextHeadingLineSequence"),f(m)}function f(m){return m===a?(e.consume(m),f):(e.exit("setextHeadingLineSequence"),nt(m)?ft(e,g,"lineSuffix")(m):g(m))}function g(m){return m===null||Pe(m)?(e.exit("setextHeadingLine"),t(m)):i(m)}}const XT={tokenize:GT};function GT(e){const t=this,i=e.attempt(go,r,e.attempt(this.parser.constructs.flowInitial,a,ft(e,e.attempt(this.parser.constructs.flow,a,e.attempt(sT,a)),"linePrefix")));return i;function r(c){if(c===null){e.consume(c);return}return e.enter("lineEndingBlank"),e.consume(c),e.exit("lineEndingBlank"),t.currentConstruct=void 0,i}function a(c){if(c===null){e.consume(c);return}return e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),t.currentConstruct=void 0,i}}const QT={resolveAll:Qx()},ZT=Gx("string"),JT=Gx("text");function Gx(e){return{resolveAll:Qx(e==="text"?eD:void 0),tokenize:t};function t(i){const r=this,a=this.parser.constructs[e],c=i.attempt(a,h,f);return h;function h(v){return m(v)?c(v):f(v)}function f(v){if(v===null){i.consume(v);return}return i.enter("data"),i.consume(v),g}function g(v){return m(v)?(i.exit("data"),c(v)):(i.consume(v),g)}function m(v){if(v===null)return!0;const _=a[v];let S=-1;if(_)for(;++S<_.length;){const y=_[S];if(!y.previous||y.previous.call(r,r.previous))return!0}return!1}}}function Qx(e){return t;function t(i,r){let a=-1,c;for(;++a<=i.length;)c===void 0?i[a]&&i[a][1].type==="data"&&(c=a,a++):(!i[a]||i[a][1].type!=="data")&&(a!==c+2&&(i[c][1].end=i[a-1][1].end,i.splice(c+2,a-c-2),a=c+2),c=void 0);return e?e(i,r):i}}function eD(e,t){const i=new Cu;let r=0;for(;++r<=e.length;)if((r===e.length||e[r][1].type==="lineEnding")&&e[r-1][1].type==="data"){const a=e[r-1][1],c=t.sliceStream(a);let h=c.length,f=-1,g=0,m;for(;h--;){const v=c[h];if(typeof v=="string"){for(f=v.length;v.charCodeAt(f-1)===32;)g++,f--;if(f)break;f=-1}else if(v===-2)m=!0,g++;else if(v!==-1){h++;break}}if(t._contentTypeTextTrailing&&r===e.length&&(g=0),g){const v={type:r===e.length||m||g<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:h?f:a.start._bufferIndex+f,_index:a.start._index+h,line:a.end.line,column:a.end.column-g,offset:a.end.offset-g},end:{...a.end}};a.end={...v.start},a.start.offset===a.end.offset?Object.assign(a,v):i.add(r,0,[["enter",v,t],["exit",v,t]])}r++}return i.consume(e),e}const tD={42:qn,43:qn,45:qn,48:qn,49:qn,50:qn,51:qn,52:qn,53:qn,54:qn,55:qn,56:qn,57:qn,62:qx},nD={91:cT},iD={[-2]:Mf,[-1]:Mf,32:Mf},sD={35:pT,42:fu,45:[_S,fu],60:vT,61:_S,95:fu,96:gS,126:gS},rD={38:$x,92:Fx},lD={[-5]:Af,[-4]:Af,[-3]:Af,33:OT,38:$x,42:wm,60:[Ij,wT],91:LT,92:[fT,Fx],93:Mp,95:wm,96:Zj},aD={null:[wm,QT]},oD={null:[42,95]},cD={null:[]},uD=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:oD,contentInitial:nD,disable:cD,document:tD,flow:sD,flowInitial:iD,insideSpan:aD,string:rD,text:lD},Symbol.toStringTag,{value:"Module"}));function hD(e,t,i){let r={_bufferIndex:-1,_index:0,line:i&&i.line||1,column:i&&i.column||1,offset:i&&i.offset||0};const a={},c=[];let h=[],f=[];const g={attempt:O(I),check:O(H),consume:M,enter:A,exit:R,interrupt:O(H,{interrupt:!0})},m={code:null,containerState:{},defineSkip:w,events:[],now:x,parser:e,previous:null,sliceSerialize:S,sliceStream:y,write:_};let v=t.tokenize.call(m,g);return t.resolveAll&&c.push(t),m;function _(G){return h=pi(h,G),j(),h[h.length-1]!==null?[]:($(t,0),m.events=zu(c,m.events,m),m.events)}function S(G,P){return fD(y(G),P)}function y(G){return dD(h,G)}function x(){const{_bufferIndex:G,_index:P,line:L,column:F,offset:K}=r;return{_bufferIndex:G,_index:P,line:L,column:F,offset:K}}function w(G){a[G.line]=G.column,z()}function j(){for(;r._index<h.length;){const G=h[r._index];if(typeof G=="string"){const P=r._index;for(r._bufferIndex<0&&(r._bufferIndex=0);r._index===P&&r._bufferIndex<G.length;)N(G.charCodeAt(r._bufferIndex))}else N(G)}}function N(G){v=v(G)}function M(G){Pe(G)?(r.line++,r.column=1,r.offset+=G===-3?2:1,z()):G!==-1&&(r.column++,r.offset++),r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===h[r._index].length&&(r._bufferIndex=-1,r._index++)),m.previous=G}function A(G,P){const L=P||{};return L.type=G,L.start=x(),m.events.push(["enter",L,m]),f.push(L),L}function R(G){const P=f.pop();return P.end=x(),m.events.push(["exit",P,m]),P}function I(G,P){$(G,P.from)}function H(G,P){P.restore()}function O(G,P){return L;function L(F,K,q){let te,ne,ge,D;return Array.isArray(F)?we(F):"tokenize"in F?we([F]):De(F);function De(se){return pe;function pe(ce){const _e=ce!==null&&se[ce],ke=ce!==null&&se.null,oe=[...Array.isArray(_e)?_e:_e?[_e]:[],...Array.isArray(ke)?ke:ke?[ke]:[]];return we(oe)(ce)}}function we(se){return te=se,ne=0,se.length===0?q:T(se[ne])}function T(se){return pe;function pe(ce){return D=Q(),ge=se,se.partial||(m.currentConstruct=se),se.name&&m.parser.constructs.disable.null.includes(se.name)?J():se.tokenize.call(P?Object.assign(Object.create(m),P):m,g,E,J)(ce)}}function E(se){return G(ge,D),K}function J(se){return D.restore(),++ne<te.length?T(te[ne]):q}}}function $(G,P){G.resolveAll&&!c.includes(G)&&c.push(G),G.resolve&&Ci(m.events,P,m.events.length-P,G.resolve(m.events.slice(P),m)),G.resolveTo&&(m.events=G.resolveTo(m.events,m))}function Q(){const G=x(),P=m.previous,L=m.currentConstruct,F=m.events.length,K=Array.from(f);return{from:F,restore:q};function q(){r=G,m.previous=P,m.currentConstruct=L,m.events.length=F,f=K,z()}}function z(){r.line in a&&r.column<2&&(r.column=a[r.line],r.offset+=a[r.line]-1)}}function dD(e,t){const i=t.start._index,r=t.start._bufferIndex,a=t.end._index,c=t.end._bufferIndex;let h;if(i===a)h=[e[i].slice(r,c)];else{if(h=e.slice(i,a),r>-1){const f=h[0];typeof f=="string"?h[0]=f.slice(r):h.shift()}c>0&&h.push(e[a].slice(0,c))}return h}function fD(e,t){let i=-1;const r=[];let a;for(;++i<e.length;){const c=e[i];let h;if(typeof c=="string")h=c;else switch(c){case-5:{h="\r";break}case-4:{h=`
14
+ `;break}case-3:{h=`\r
15
+ `;break}case-2:{h=t?" ":" ";break}case-1:{if(!t&&a)continue;h=" ";break}default:h=String.fromCharCode(c)}a=c===-2,r.push(h)}return r.join("")}function mD(e){const r={constructs:Hx([uD,...(e||{}).extensions||[]]),content:a(Aj),defined:[],document:a(Oj),flow:a(XT),lazy:{},string:a(ZT),text:a(JT)};return r;function a(c){return h;function h(f){return hD(r,c,f)}}}function pD(e){for(;!Vx(e););return e}const vS=/[\0\t\n\r]/g;function gD(){let e=1,t="",i=!0,r;return a;function a(c,h,f){c=t+(typeof c=="string"?c.toString():new TextDecoder(h||void 0).decode(c));const g=[];let m=0;for(t="",i&&(c.charCodeAt(0)===65279&&m++,i=void 0);m<c.length;){vS.lastIndex=m;const v=vS.exec(c),_=v&&v.index!==void 0?v.index:c.length,S=c.charCodeAt(_);if(!v){t=c.slice(m);break}if(S===10&&m===_&&r)g.push(-3),r=void 0;else switch(r&&(g.push(-5),r=void 0),m<_&&(g.push(c.slice(m,_)),e+=_-m),S){case 0:{g.push(65533),e++;break}case 9:{const y=Math.ceil(e/4)*4;for(g.push(-2);e++<y;)g.push(-1);break}case 10:{g.push(-4),e=1;break}default:r=!0,e=1}m=_+1}return f&&(r&&g.push(-5),t&&g.push(t),g.push(null)),g}}const _D=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function vD(e){return e.replace(_D,yD)}function yD(e,t,i){if(t)return t;if(i.charCodeAt(0)===35){const a=i.charCodeAt(1),c=a===120||a===88;return Ix(i.slice(c?2:1),c?16:10)}return Dp(i)||e}const Zx={}.hasOwnProperty;function SD(e,t,i){return t&&typeof t=="object"&&(i=t,t=void 0),bD(i)(pD(mD(i).document().write(gD()(e,t,!0))))}function bD(e){const t={afterExit:[],beforeEnter:[],transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:h(me),autolinkProtocol:z,autolinkEmail:z,atxHeading:h(Je),blockQuote:h(oe),characterEscape:z,characterReference:z,codeFenced:h(ye),codeFencedFenceInfo:f,codeFencedFenceMeta:f,codeIndented:h(ye,f),codeText:h(Ne,f),codeTextData:z,data:z,codeFlowValue:z,definition:h(ct),definitionDestinationString:f,definitionLabelString:f,definitionTitleString:f,emphasis:h(ht),hardBreakEscape:h(Ke),hardBreakTrailing:h(Ke),htmlFlow:h(qe,f),htmlFlowData:z,htmlText:h(qe,f),htmlTextData:z,image:h(le),label:f,link:h(me),listItem:h(He),listItemValue:y,listOrdered:h(Te,S),listUnordered:h(Te),paragraph:h(Ee),reference:E,referenceString:f,resourceDestinationString:f,resourceTitleString:f,setextHeading:h(Je),strong:h(Be),thematicBreak:h(Tt)},exit:{atxHeading:m(),atxHeadingSequence:H,autolink:m(),autolinkEmail:ke,autolinkProtocol:_e,blockQuote:m(),characterEscapeValue:G,characterReferenceMarkerHexadecimal:se,characterReferenceMarkerNumeric:se,characterReferenceValue:pe,characterReference:ce,codeFenced:m(N),codeFencedFence:j,codeFencedFenceInfo:x,codeFencedFenceMeta:w,codeFlowValue:G,codeIndented:m(M),codeText:m(q),codeTextData:G,data:G,definition:m(),definitionDestinationString:I,definitionLabelString:A,definitionTitleString:R,emphasis:m(),hardBreakEscape:m(L),hardBreakTrailing:m(L),htmlFlow:m(F),htmlFlowData:G,htmlText:m(K),htmlTextData:G,image:m(ne),label:D,labelText:ge,lineEnding:P,link:m(te),listItem:m(),listOrdered:m(),listUnordered:m(),paragraph:m(),referenceString:J,resourceDestinationString:De,resourceTitleString:we,resource:T,setextHeading:m(Q),setextHeadingLineSequence:$,setextHeadingText:O,strong:m(),thematicBreak:m()}};Jx(t,(e||{}).mdastExtensions||[]);const i={};return r;function r(re){let ve={type:"root",children:[],position:void 0};const ze={stack:[ve],tokenStack:[],config:t,enter:g,exit:v,buffer:f,resume:_,data:i},ae=[],be=[];let X=-1;for(;++X<re.length;)if(be.push(re[X]),re[X][1].type==="listOrdered"||re[X][1].type==="listUnordered")if(re[X][0]==="enter")ae.push(be.length-1);else{const Se=ae.pop();c(be,Se)}for(re=be,X=-1;++X<re.length;){const Se=t[re[X][0]];re[X][0]==="enter"&&t.beforeEnter.length>0&&a(t.beforeEnter,{...ze,sliceSerialize:re[X][2].sliceSerialize},re[X][1]),Zx.call(Se,re[X][1].type)&&Se[re[X][1].type].call({...ze,sliceSerialize:re[X][2].sliceSerialize},re[X][1]),re[X][0]==="exit"&&t.afterExit.length>0&&a(t.afterExit,{...ze,sliceSerialize:re[X][2].sliceSerialize},re[X][1])}if(ze.tokenStack.length>0){const Se=ze.tokenStack[ze.tokenStack.length-1];(Se[1]||yS).call(ze,void 0,Se[0])}for(ve.position={start:Ps(re.length>0?re[0][1].start:{line:1,column:1,offset:0}),end:Ps(re.length>0?re[re.length-2][1].end:{line:1,column:1,offset:0})},X=-1;++X<t.transforms.length;)ve=t.transforms[X](ve)||ve;return ve}function a(re,ve,ze){let ae=-1;for(;++ae<re.length;)re[ae].call(ve,ze)}function c(re,ve){const ze=re.length-1;let ae=ve-1,be=-1,X=!1,Se,Ge,pt,Qe;const Ni=[];for(;++ae<=ze;){const tn=re[ae];switch(tn[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{tn[0]==="enter"?be++:be--,Qe=void 0;break}case"lineEndingBlank":{tn[0]==="enter"&&(Se&&!Qe&&!be&&!pt&&(pt=ae),Qe=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:Qe=void 0}if(!be&&tn[0]==="enter"&&tn[1].type==="listItemPrefix"||be===-1&&tn[0]==="exit"&&(tn[1].type==="listUnordered"||tn[1].type==="listOrdered")){if(Se){let _i=ae;for(Ge=void 0;_i--;){const Nn=re[_i];if(Nn[1].type==="lineEnding"||Nn[1].type==="lineEndingBlank"){if(Nn[0]==="exit")continue;Ge&&(re[Ge][1].type="lineEndingBlank",X=!0),Nn[1].type="lineEnding",Ge=_i}else if(!(Nn[1].type==="linePrefix"||Nn[1].type==="blockQuotePrefix"||Nn[1].type==="blockQuotePrefixWhitespace"||Nn[1].type==="blockQuoteMarker"||Nn[1].type==="listItemIndent"))break}pt&&(!Ge||pt<Ge)&&(Se._spread=!0),Se.end=Object.assign({},Ge?re[Ge][1].start:tn[1].end),Ni.push({at:Ge||ae,event:["exit",Se,tn[2]]})}if(tn[1].type==="listItemPrefix"){const _i={type:"listItem",_spread:!1,start:Object.assign({},tn[1].start),end:void 0};Se=_i,Ni.push({at:ae,event:["enter",_i,tn[2]]}),pt=void 0,Qe=!0}}}const zr=re.splice(ve);let Ft=0;for(ae=-1;++ae<zr.length;){for(;Ft<Ni.length&&Ni[Ft].at===ve+ae;)re.push(Ni[Ft++].event);re.push(zr[ae])}re[ve][1]._spread=X}function h(re,ve){return ze;function ze(ae){g.call(this,re(ae),ae),ve&&ve.call(this,ae)}}function f(){this.stack.push({type:"fragment",children:[]})}function g(re,ve,ze){this.stack[this.stack.length-1].children.push(re),this.stack.push(re),this.tokenStack.push([ve,ze||void 0]),re.position={start:Ps(ve.start),end:void 0}}function m(re){return ve;function ve(ze){re&&re.call(this,ze),v.call(this,ze)}}function v(re,ve){const ze=this.stack.pop(),ae=this.tokenStack.pop();if(!ae)throw new Error("Cannot close `"+re.type+"` ("+io({start:re.start,end:re.end})+"): it’s not open");ae[0].type!==re.type&&(ve?ve.call(this,re,ae[0]):(ae[1]||yS).call(this,re,ae[0])),ze.position.end=Ps(re.end)}function _(){return Tp(this.stack.pop())}function S(){this.data.expectingFirstListItemValue=!0}function y(re){if(this.data.expectingFirstListItemValue){const ve=this.stack[this.stack.length-2];ve.start=Number.parseInt(this.sliceSerialize(re),10),this.data.expectingFirstListItemValue=void 0}}function x(){const re=this.resume(),ve=this.stack[this.stack.length-1];ve.lang=re}function w(){const re=this.resume(),ve=this.stack[this.stack.length-1];ve.meta=re}function j(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function N(){const re=this.resume(),ve=this.stack[this.stack.length-1];ve.value=re.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function M(){const re=this.resume(),ve=this.stack[this.stack.length-1];ve.value=re.replace(/(\r?\n|\r)$/g,"")}function A(re){const ve=this.resume(),ze=this.stack[this.stack.length-1];ze.label=ve,ze.identifier=ki(this.sliceSerialize(re)).toLowerCase()}function R(){const re=this.resume(),ve=this.stack[this.stack.length-1];ve.title=re}function I(){const re=this.resume(),ve=this.stack[this.stack.length-1];ve.url=re}function H(re){const ve=this.stack[this.stack.length-1];if(!ve.depth){const ze=this.sliceSerialize(re).length;ve.depth=ze}}function O(){this.data.setextHeadingSlurpLineEnding=!0}function $(re){const ve=this.stack[this.stack.length-1];ve.depth=this.sliceSerialize(re).codePointAt(0)===61?1:2}function Q(){this.data.setextHeadingSlurpLineEnding=void 0}function z(re){const ze=this.stack[this.stack.length-1].children;let ae=ze[ze.length-1];(!ae||ae.type!=="text")&&(ae=jt(),ae.position={start:Ps(re.start),end:void 0},ze.push(ae)),this.stack.push(ae)}function G(re){const ve=this.stack.pop();ve.value+=this.sliceSerialize(re),ve.position.end=Ps(re.end)}function P(re){const ve=this.stack[this.stack.length-1];if(this.data.atHardBreak){const ze=ve.children[ve.children.length-1];ze.position.end=Ps(re.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(ve.type)&&(z.call(this,re),G.call(this,re))}function L(){this.data.atHardBreak=!0}function F(){const re=this.resume(),ve=this.stack[this.stack.length-1];ve.value=re}function K(){const re=this.resume(),ve=this.stack[this.stack.length-1];ve.value=re}function q(){const re=this.resume(),ve=this.stack[this.stack.length-1];ve.value=re}function te(){const re=this.stack[this.stack.length-1];if(this.data.inReference){const ve=this.data.referenceType||"shortcut";re.type+="Reference",re.referenceType=ve,delete re.url,delete re.title}else delete re.identifier,delete re.label;this.data.referenceType=void 0}function ne(){const re=this.stack[this.stack.length-1];if(this.data.inReference){const ve=this.data.referenceType||"shortcut";re.type+="Reference",re.referenceType=ve,delete re.url,delete re.title}else delete re.identifier,delete re.label;this.data.referenceType=void 0}function ge(re){const ve=this.sliceSerialize(re),ze=this.stack[this.stack.length-2];ze.label=vD(ve),ze.identifier=ki(ve).toLowerCase()}function D(){const re=this.stack[this.stack.length-1],ve=this.resume(),ze=this.stack[this.stack.length-1];if(this.data.inReference=!0,ze.type==="link"){const ae=re.children;ze.children=ae}else ze.alt=ve}function De(){const re=this.resume(),ve=this.stack[this.stack.length-1];ve.url=re}function we(){const re=this.resume(),ve=this.stack[this.stack.length-1];ve.title=re}function T(){this.data.inReference=void 0}function E(){this.data.referenceType="collapsed"}function J(re){const ve=this.resume(),ze=this.stack[this.stack.length-1];ze.label=ve,ze.identifier=ki(this.sliceSerialize(re)).toLowerCase(),this.data.referenceType="full"}function se(re){this.data.characterReferenceType=re.type}function pe(re){const ve=this.sliceSerialize(re),ze=this.data.characterReferenceType;let ae;ze?(ae=Ix(ve,ze==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):ae=Dp(ve);const be=this.stack[this.stack.length-1];be.value+=ae}function ce(re){const ve=this.stack.pop();ve.position.end=Ps(re.end)}function _e(re){G.call(this,re);const ve=this.stack[this.stack.length-1];ve.url=this.sliceSerialize(re)}function ke(re){G.call(this,re);const ve=this.stack[this.stack.length-1];ve.url="mailto:"+this.sliceSerialize(re)}function oe(){return{type:"blockquote",children:[],position:void 0}}function ye(){return{type:"code",lang:null,meta:null,value:"",position:void 0}}function Ne(){return{type:"inlineCode",value:"",position:void 0}}function ct(){return{type:"definition",identifier:"",label:null,title:null,url:"",position:void 0}}function ht(){return{type:"emphasis",children:[],position:void 0}}function Je(){return{type:"heading",depth:0,children:[],position:void 0}}function Ke(){return{type:"break",position:void 0}}function qe(){return{type:"html",value:"",position:void 0}}function le(){return{type:"image",title:null,url:"",alt:null,position:void 0}}function me(){return{type:"link",title:null,url:"",children:[],position:void 0}}function Te(re){return{type:"list",ordered:re.type==="listOrdered",start:null,spread:re._spread,children:[],position:void 0}}function He(re){return{type:"listItem",spread:re._spread,checked:null,children:[],position:void 0}}function Ee(){return{type:"paragraph",children:[],position:void 0}}function Be(){return{type:"strong",children:[],position:void 0}}function jt(){return{type:"text",value:"",position:void 0}}function Tt(){return{type:"thematicBreak",position:void 0}}}function Ps(e){return{line:e.line,column:e.column,offset:e.offset}}function Jx(e,t){let i=-1;for(;++i<t.length;){const r=t[i];Array.isArray(r)?Jx(e,r):xD(e,r)}}function xD(e,t){let i;for(i in t)if(Zx.call(t,i))switch(i){case"canContainEols":{const r=t[i];r&&e[i].push(...r);break}case"transforms":{const r=t[i];r&&e[i].push(...r);break}case"afterExit":case"beforeEnter":{const r=t[i];r&&e[i].push(r);break}case"enter":case"exit":{const r=t[i];r&&Object.assign(e[i],r);break}}}function yS(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+io({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+io({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+io({start:t.start,end:t.end})+") is still open")}function wD(e){const t=this;t.parser=i;function i(r){return SD(r,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function CD(e,t){const i={type:"element",tagName:"blockquote",properties:{},children:e.wrap(e.all(t),!0)};return e.patch(t,i),e.applyData(t,i)}function kD(e,t){const i={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,i),[e.applyData(t,i),{type:"text",value:`
16
+ `}]}function ND(e,t){const i=t.value?t.value+`
17
+ `:"",r={},a=t.lang?t.lang.split(/\s+/):[];a.length>0&&(r.className=["language-"+a[0]]);let c={type:"element",tagName:"code",properties:r,children:[{type:"text",value:i}]};return t.meta&&(c.data={meta:t.meta}),e.patch(t,c),c=e.applyData(t,c),c={type:"element",tagName:"pre",properties:{},children:[c]},e.patch(t,c),c}function ED(e,t){const i={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,i),e.applyData(t,i)}function jD(e,t){const i={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,i),e.applyData(t,i)}function TD(e,t){const i=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",r=String(t.identifier).toUpperCase(),a=Fl(r.toLowerCase()),c=e.footnoteOrder.indexOf(r);let h,f=e.footnoteCounts.get(r);f===void 0?(f=0,e.footnoteOrder.push(r),h=e.footnoteOrder.length):h=c+1,f+=1,e.footnoteCounts.set(r,f);const g={type:"element",tagName:"a",properties:{href:"#"+i+"fn-"+a,id:i+"fnref-"+a+(f>1?"-"+f:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(h)}]};e.patch(t,g);const m={type:"element",tagName:"sup",properties:{},children:[g]};return e.patch(t,m),e.applyData(t,m)}function DD(e,t){const i={type:"element",tagName:"h"+t.depth,properties:{},children:e.all(t)};return e.patch(t,i),e.applyData(t,i)}function MD(e,t){if(e.options.allowDangerousHtml){const i={type:"raw",value:t.value};return e.patch(t,i),e.applyData(t,i)}}function e1(e,t){const i=t.referenceType;let r="]";if(i==="collapsed"?r+="[]":i==="full"&&(r+="["+(t.label||t.identifier)+"]"),t.type==="imageReference")return[{type:"text",value:"!["+t.alt+r}];const a=e.all(t),c=a[0];c&&c.type==="text"?c.value="["+c.value:a.unshift({type:"text",value:"["});const h=a[a.length-1];return h&&h.type==="text"?h.value+=r:a.push({type:"text",value:r}),a}function AD(e,t){const i=String(t.identifier).toUpperCase(),r=e.definitionById.get(i);if(!r)return e1(e,t);const a={src:Fl(r.url||""),alt:t.alt};r.title!==null&&r.title!==void 0&&(a.title=r.title);const c={type:"element",tagName:"img",properties:a,children:[]};return e.patch(t,c),e.applyData(t,c)}function RD(e,t){const i={src:Fl(t.url)};t.alt!==null&&t.alt!==void 0&&(i.alt=t.alt),t.title!==null&&t.title!==void 0&&(i.title=t.title);const r={type:"element",tagName:"img",properties:i,children:[]};return e.patch(t,r),e.applyData(t,r)}function OD(e,t){const i={type:"text",value:t.value.replace(/\r?\n|\r/g," ")};e.patch(t,i);const r={type:"element",tagName:"code",properties:{},children:[i]};return e.patch(t,r),e.applyData(t,r)}function BD(e,t){const i=String(t.identifier).toUpperCase(),r=e.definitionById.get(i);if(!r)return e1(e,t);const a={href:Fl(r.url||"")};r.title!==null&&r.title!==void 0&&(a.title=r.title);const c={type:"element",tagName:"a",properties:a,children:e.all(t)};return e.patch(t,c),e.applyData(t,c)}function LD(e,t){const i={href:Fl(t.url)};t.title!==null&&t.title!==void 0&&(i.title=t.title);const r={type:"element",tagName:"a",properties:i,children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function zD(e,t,i){const r=e.all(t),a=i?HD(i):t1(t),c={},h=[];if(typeof t.checked=="boolean"){const v=r[0];let _;v&&v.type==="element"&&v.tagName==="p"?_=v:(_={type:"element",tagName:"p",properties:{},children:[]},r.unshift(_)),_.children.length>0&&_.children.unshift({type:"text",value:" "}),_.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:t.checked,disabled:!0},children:[]}),c.className=["task-list-item"]}let f=-1;for(;++f<r.length;){const v=r[f];(a||f!==0||v.type!=="element"||v.tagName!=="p")&&h.push({type:"text",value:`
18
+ `}),v.type==="element"&&v.tagName==="p"&&!a?h.push(...v.children):h.push(v)}const g=r[r.length-1];g&&(a||g.type!=="element"||g.tagName!=="p")&&h.push({type:"text",value:`
19
+ `});const m={type:"element",tagName:"li",properties:c,children:h};return e.patch(t,m),e.applyData(t,m)}function HD(e){let t=!1;if(e.type==="list"){t=e.spread||!1;const i=e.children;let r=-1;for(;!t&&++r<i.length;)t=t1(i[r])}return t}function t1(e){const t=e.spread;return t??e.children.length>1}function ID(e,t){const i={},r=e.all(t);let a=-1;for(typeof t.start=="number"&&t.start!==1&&(i.start=t.start);++a<r.length;){const h=r[a];if(h.type==="element"&&h.tagName==="li"&&h.properties&&Array.isArray(h.properties.className)&&h.properties.className.includes("task-list-item")){i.className=["contains-task-list"];break}}const c={type:"element",tagName:t.ordered?"ol":"ul",properties:i,children:e.wrap(r,!0)};return e.patch(t,c),e.applyData(t,c)}function UD(e,t){const i={type:"element",tagName:"p",properties:{},children:e.all(t)};return e.patch(t,i),e.applyData(t,i)}function PD(e,t){const i={type:"root",children:e.wrap(e.all(t))};return e.patch(t,i),e.applyData(t,i)}function qD(e,t){const i={type:"element",tagName:"strong",properties:{},children:e.all(t)};return e.patch(t,i),e.applyData(t,i)}function FD(e,t){const i=e.all(t),r=i.shift(),a=[];if(r){const h={type:"element",tagName:"thead",properties:{},children:e.wrap([r],!0)};e.patch(t.children[0],h),a.push(h)}if(i.length>0){const h={type:"element",tagName:"tbody",properties:{},children:e.wrap(i,!0)},f=kp(t.children[1]),g=Mx(t.children[t.children.length-1]);f&&g&&(h.position={start:f,end:g}),a.push(h)}const c={type:"element",tagName:"table",properties:{},children:e.wrap(a,!0)};return e.patch(t,c),e.applyData(t,c)}function $D(e,t,i){const r=i?i.children:void 0,c=(r?r.indexOf(t):1)===0?"th":"td",h=i&&i.type==="table"?i.align:void 0,f=h?h.length:t.children.length;let g=-1;const m=[];for(;++g<f;){const _=t.children[g],S={},y=h?h[g]:void 0;y&&(S.align=y);let x={type:"element",tagName:c,properties:S,children:[]};_&&(x.children=e.all(_),e.patch(_,x),x=e.applyData(_,x)),m.push(x)}const v={type:"element",tagName:"tr",properties:{},children:e.wrap(m,!0)};return e.patch(t,v),e.applyData(t,v)}function VD(e,t){const i={type:"element",tagName:"td",properties:{},children:e.all(t)};return e.patch(t,i),e.applyData(t,i)}const SS=9,bS=32;function KD(e){const t=String(e),i=/\r?\n|\r/g;let r=i.exec(t),a=0;const c=[];for(;r;)c.push(xS(t.slice(a,r.index),a>0,!0),r[0]),a=r.index+r[0].length,r=i.exec(t);return c.push(xS(t.slice(a),a>0,!1)),c.join("")}function xS(e,t,i){let r=0,a=e.length;if(t){let c=e.codePointAt(r);for(;c===SS||c===bS;)r++,c=e.codePointAt(r)}if(i){let c=e.codePointAt(a-1);for(;c===SS||c===bS;)a--,c=e.codePointAt(a-1)}return a>r?e.slice(r,a):""}function YD(e,t){const i={type:"text",value:KD(String(t.value))};return e.patch(t,i),e.applyData(t,i)}function WD(e,t){const i={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(t,i),e.applyData(t,i)}const XD={blockquote:CD,break:kD,code:ND,delete:ED,emphasis:jD,footnoteReference:TD,heading:DD,html:MD,imageReference:AD,image:RD,inlineCode:OD,linkReference:BD,link:LD,listItem:zD,list:ID,paragraph:UD,root:PD,strong:qD,table:FD,tableCell:VD,tableRow:$D,text:YD,thematicBreak:WD,toml:Xc,yaml:Xc,definition:Xc,footnoteDefinition:Xc};function Xc(){}const n1=-1,Hu=0,ro=1,ku=2,Ap=3,Rp=4,Op=5,Bp=6,i1=7,s1=8,{defineProperty:GD}=Object,r1=typeof self=="object"?self:globalThis,wS=(e,t)=>{switch(e){case"Function":case"SharedWorker":case"Worker":case"eval":case"setInterval":case"setTimeout":throw new TypeError("unable to deserialize "+e)}return new r1[e](t)},QD=(e,t)=>{const i=(a,c)=>(e.set(c,a),a),r=a=>{if(e.has(a))return e.get(a);const[c,h]=t[a];switch(c){case Hu:case n1:return i(h,a);case ro:{const f=i([],a);for(const g of h)f.push(r(g));return f}case ku:{const f=i({},a);for(const[g,m]of h){const v=r(g),_=r(m);v==="__proto__"?GD(f,v,{value:_,configurable:!0,enumerable:!0,writable:!0}):f[v]=_}return f}case Ap:return i(new Date(h),a);case Rp:{const{source:f,flags:g}=h;return i(new RegExp(f,g),a)}case Op:{const f=i(new Map,a);for(const[g,m]of h)f.set(r(g),r(m));return f}case Bp:{const f=i(new Set,a);for(const g of h)f.add(r(g));return f}case i1:{const{name:f,message:g}=h;return i(typeof r1[f]=="function"?wS(f,g):new Error(g),a)}case s1:return i(BigInt(h),a);case"BigInt":return i(Object(BigInt(h)),a);case"ArrayBuffer":return i(new Uint8Array(h).buffer,h);case"DataView":{const{buffer:f}=new Uint8Array(h);return i(new DataView(f),h)}case"-0":return-0}return i(wS(c,h),a)};return r},CS=e=>QD(new Map,e)(0),Cr="",{toString:ZD}={},{keys:JD,is:e3}=Object,Fa=e=>{const t=typeof e;if(t!=="object"||!e)return[Hu,t];const i=ZD.call(e).slice(8,-1);switch(i){case"Array":return[ro,Cr];case"Object":return[ku,Cr];case"Date":return[Ap,Cr];case"RegExp":return[Rp,Cr];case"Map":return[Op,Cr];case"Set":return[Bp,Cr];case"DataView":return[ro,i]}return i.includes("Array")?[ro,i]:e instanceof Error?[i1,e.name||"Error"]:[ku,i]},Gc=([e,t])=>e===Hu&&(t==="function"||t==="symbol"),t3=(e,t,i,r)=>{const a=(h,f)=>{const g=r.push(h)-1;return i.set(f,g),g},c=h=>{if(i.has(h))return i.get(h);let[f,g]=Fa(h);switch(f){case Hu:{let v=h;switch(g){case"bigint":f=s1,v=h.toString();break;case"number":if(!h&&e3(h,-0))return r.push(["-0"])-1;break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+g);v=null;break;case"undefined":return a([n1],h)}return a([f,v],h)}case ro:{if(g){let S=h;return g==="DataView"?S=new Uint8Array(h.buffer):g==="ArrayBuffer"&&(S=new Uint8Array(h)),a([g,[...S]],h)}const v=[],_=a([f,v],h);for(const S of h)v.push(c(S));return _}case ku:{if(g)switch(g){case"BigInt":return a([g,h.toString()],h);case"Boolean":case"Number":case"String":return a([g,h.valueOf()],h)}if(t&&"toJSON"in h)return c(h.toJSON());const v=[],_=a([f,v],h);for(const S of JD(h))(e||!Gc(Fa(h[S])))&&v.push([c(S),c(h[S])]);return _}case Ap:return a([f,isNaN(h.getTime())?Cr:h.toISOString()],h);case Rp:{const{source:v,flags:_}=h;return a([f,{source:v,flags:_}],h)}case Op:{const v=[],_=a([f,v],h);for(const[S,y]of h)(e||!(Gc(Fa(S))||Gc(Fa(y))))&&v.push([c(S),c(y)]);return _}case Bp:{const v=[],_=a([f,v],h);for(const S of h)(e||!Gc(Fa(S)))&&v.push(c(S));return _}}const{message:m}=h;return a([f,{name:g,message:m}],h)};return c},kS=(e,{json:t,lossy:i}={})=>{const r=[];return t3(!(t||i),!!t,new Map,r)(e),r},Nu=typeof structuredClone=="function"?(e,t)=>t&&("json"in t||"lossy"in t)?CS(kS(e,t)):structuredClone(e):(e,t)=>CS(kS(e,t));function n3(e,t){const i=[{type:"text",value:"↩"}];return t>1&&i.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(t)}]}),i}function i3(e,t){return"Back to reference "+(e+1)+(t>1?"-"+t:"")}function s3(e){const t=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",i=e.options.footnoteBackContent||n3,r=e.options.footnoteBackLabel||i3,a=e.options.footnoteLabel||"Footnotes",c=e.options.footnoteLabelTagName||"h2",h=e.options.footnoteLabelProperties||{className:["sr-only"]},f=[];let g=-1;for(;++g<e.footnoteOrder.length;){const m=e.footnoteById.get(e.footnoteOrder[g]);if(!m)continue;const v=e.all(m),_=String(m.identifier).toUpperCase(),S=Fl(_.toLowerCase());let y=0;const x=[],w=e.footnoteCounts.get(_);for(;w!==void 0&&++y<=w;){x.length>0&&x.push({type:"text",value:" "});let M=typeof i=="string"?i:i(g,y);typeof M=="string"&&(M={type:"text",value:M}),x.push({type:"element",tagName:"a",properties:{href:"#"+t+"fnref-"+S+(y>1?"-"+y:""),dataFootnoteBackref:"",ariaLabel:typeof r=="string"?r:r(g,y),className:["data-footnote-backref"]},children:Array.isArray(M)?M:[M]})}const j=v[v.length-1];if(j&&j.type==="element"&&j.tagName==="p"){const M=j.children[j.children.length-1];M&&M.type==="text"?M.value+=" ":j.children.push({type:"text",value:" "}),j.children.push(...x)}else v.push(...x);const N={type:"element",tagName:"li",properties:{id:t+"fn-"+S},children:e.wrap(v,!0)};e.patch(m,N),f.push(N)}if(f.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:c,properties:{...Nu(h),id:"footnote-label"},children:[{type:"text",value:a}]},{type:"text",value:`
20
+ `},{type:"element",tagName:"ol",properties:{},children:e.wrap(f,!0)},{type:"text",value:`
21
+ `}]}}const Iu=(function(e){if(e==null)return o3;if(typeof e=="function")return Uu(e);if(typeof e=="object")return Array.isArray(e)?r3(e):l3(e);if(typeof e=="string")return a3(e);throw new Error("Expected function, string, or object as test")});function r3(e){const t=[];let i=-1;for(;++i<e.length;)t[i]=Iu(e[i]);return Uu(r);function r(...a){let c=-1;for(;++c<t.length;)if(t[c].apply(this,a))return!0;return!1}}function l3(e){const t=e;return Uu(i);function i(r){const a=r;let c;for(c in e)if(a[c]!==t[c])return!1;return!0}}function a3(e){return Uu(t);function t(i){return i&&i.type===e}}function Uu(e){return t;function t(i,r,a){return!!(c3(i)&&e.call(this,i,typeof r=="number"?r:void 0,a||void 0))}}function o3(){return!0}function c3(e){return e!==null&&typeof e=="object"&&"type"in e}const l1=[],u3=!0,mu=!1,Nm="skip";function Em(e,t,i,r){if(!e||typeof e!="object")throw new Error("Unexpected value `"+e+"` for `tree`, expected node");let a=!0,c,h,f,g;if(typeof i=="function"||i&&typeof i=="object"?(c=t,h=i,r&&(a=!1)):(h=t,i&&(a=!1)),typeof h=="function")f=h;else if(h&&typeof h=="object"){if(!(h.enter===null||h.enter===void 0))if(typeof h.enter=="function")f=h.enter;else throw new Error("Unexpected value `"+h.enter+"` for `visitors.enter`, expected optional visitor");if(typeof h.exit=="function")g=h.exit;else throw new Error("Unexpected value `"+h.exit+"` for `visitors.exit`, expected visitor (pass a visitor directly if you only want an enter visitor)")}else throw new Error("Unexpected value `"+h+"` for `enter` or `visitors`, expected visitor or object with visitors");const m=Iu(c),v=a?1:-1;_(e,void 0,[])();function _(S,y,x){const w=S&&typeof S=="object"?S:{};if(typeof w.type=="string"){const N=typeof w.tagName=="string"?w.tagName:typeof w.name=="string"?w.name:void 0;Object.defineProperty(j,"name",{value:"node ("+(S.type+(N?"<"+N+">":""))+")"})}return j;function j(){const N=!c||m(S,y,x[x.length-1]||void 0);let M=l1;if(f&&N&&(M=NS(f(S,x,y)),M[0]===mu))return M;if("children"in S&&S.children){const A=S;if(A.children&&M[0]!==Nm){let R=(a?-1:A.children.length)+v;const I=[...x,A];for(;R>-1&&R<A.children.length;){const H=A.children[R],O=_(H,R,I)();if(O[0]===mu)return O;R=typeof O[1]=="number"?O[1]:R+v}}}if(g&&N){const A=NS(g(S,x,y));if(A[0]===Nm)throw new Error("Unexpected value `"+A[0]+"` from `exit`, expected `CONTINUE`, `EXIT`, index, or nothing");if(A[0]===mu||typeof A[1]=="number")return A}return M}}}function NS(e){return Array.isArray(e)?e:typeof e=="number"?[u3,e]:e==null?l1:[e]}function Lp(e,t,i,r){let a,c,h;c=t,h=i,typeof c=="function"?Em(e,a,jm(c),h):Em(e,a,h3(c),h)}function h3(e){return!e||typeof e!="object"?e:{enter:typeof e.enter=="function"?jm(e.enter):e.enter,exit:typeof e.exit=="function"?jm(e.exit):e.exit}}function jm(e){return t;function t(i,r,a){return e(i,a,r[r.length-1])}}const Tm={}.hasOwnProperty,d3={};function f3(e,t){const i=t||d3,r=new Map,a=new Map,c=new Map,h={...XD,...i.handlers},f={all:m,applyData:p3,definitionById:r,footnoteById:a,footnoteCounts:c,footnoteOrder:[],handlers:h,one:g,options:i,patch:m3,wrap:_3};return Lp(e,function(v){if(v.type==="definition"||v.type==="footnoteDefinition"){const _=v.type==="definition"?r:a,S=String(v.identifier).toUpperCase();_.has(S)||_.set(S,v)}}),f;function g(v,_){const S=v.type,y=f.handlers[S];if(Tm.call(f.handlers,S)&&y)return y(f,v,_);if(f.options.passThrough&&f.options.passThrough.includes(S)){if("children"in v){const{children:w,...j}=v,N=Nu(j);return N.children=f.all(v),N}return Nu(v)}return(f.options.unknownHandler||g3)(f,v,_)}function m(v){const _=[];if("children"in v){const S=v.children;let y=-1;for(;++y<S.length;){const x=f.one(S[y],v);if(x){if(y&&S[y-1].type==="break"&&(!Array.isArray(x)&&x.type==="text"&&(x.value=ES(x.value)),!Array.isArray(x)&&x.type==="element")){const w=x.children[0];w&&w.type==="text"&&(w.value=ES(w.value))}Array.isArray(x)?_.push(...x):_.push(x)}}}return _}}function m3(e,t){e.position&&(t.position=ij(e))}function p3(e,t){let i=t;if(e&&e.data){const r=e.data.hName,a=e.data.hChildren,c=e.data.hProperties;if(typeof r=="string")if(i.type==="element")i.tagName=r;else{const h="children"in i?i.children:[i];i={type:"element",tagName:r,properties:{},children:h}}i.type==="element"&&c&&Object.assign(i.properties,Nu(c)),"children"in i&&i.children&&a!==null&&a!==void 0&&(i.children=a)}return i}function g3(e,t){const i=t.data||{},r="value"in t&&!(Tm.call(i,"hProperties")||Tm.call(i,"hChildren"))?{type:"text",value:t.value}:{type:"element",tagName:"div",properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function _3(e,t){const i=[];let r=-1;for(t&&i.push({type:"text",value:`
22
+ `});++r<e.length;)r&&i.push({type:"text",value:`
23
+ `}),i.push(e[r]);return t&&e.length>0&&i.push({type:"text",value:`
24
+ `}),i}function ES(e){let t=0,i=e.charCodeAt(t);for(;i===9||i===32;)t++,i=e.charCodeAt(t);return e.slice(t)}function jS(e,t){const i=f3(e,t),r=i.one(e,void 0),a=s3(i),c=Array.isArray(r)?{type:"root",children:r}:r||{type:"root",children:[]};return a&&c.children.push({type:"text",value:`
25
+ `},a),c}function v3(e,t){return e&&"run"in e?async function(i,r){const a=jS(i,{file:r,...t});await e.run(a,r)}:function(i,r){return jS(i,{file:r,...e||t})}}function TS(e){if(e)throw e}var Rf,DS;function y3(){if(DS)return Rf;DS=1;var e=Object.prototype.hasOwnProperty,t=Object.prototype.toString,i=Object.defineProperty,r=Object.getOwnPropertyDescriptor,a=function(m){return typeof Array.isArray=="function"?Array.isArray(m):t.call(m)==="[object Array]"},c=function(m){if(!m||t.call(m)!=="[object Object]")return!1;var v=e.call(m,"constructor"),_=m.constructor&&m.constructor.prototype&&e.call(m.constructor.prototype,"isPrototypeOf");if(m.constructor&&!v&&!_)return!1;var S;for(S in m);return typeof S>"u"||e.call(m,S)},h=function(m,v){i&&v.name==="__proto__"?i(m,v.name,{enumerable:!0,configurable:!0,value:v.newValue,writable:!0}):m[v.name]=v.newValue},f=function(m,v){if(v==="__proto__")if(e.call(m,v)){if(r)return r(m,v).value}else return;return m[v]};return Rf=function g(){var m,v,_,S,y,x,w=arguments[0],j=1,N=arguments.length,M=!1;for(typeof w=="boolean"&&(M=w,w=arguments[1]||{},j=2),(w==null||typeof w!="object"&&typeof w!="function")&&(w={});j<N;++j)if(m=arguments[j],m!=null)for(v in m)_=f(w,v),S=f(m,v),w!==S&&(M&&S&&(c(S)||(y=a(S)))?(y?(y=!1,x=_&&a(_)?_:[]):x=_&&c(_)?_:{},h(w,{name:v,newValue:g(M,x,S)})):typeof S<"u"&&h(w,{name:v,newValue:S}));return w},Rf}var S3=y3();const Of=ox(S3);function Dm(e){if(typeof e!="object"||e===null)return!1;const t=Object.getPrototypeOf(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}function b3(){const e=[],t={run:i,use:r};return t;function i(...a){let c=-1;const h=a.pop();if(typeof h!="function")throw new TypeError("Expected function as last argument, not "+h);f(null,...a);function f(g,...m){const v=e[++c];let _=-1;if(g){h(g);return}for(;++_<a.length;)(m[_]===null||m[_]===void 0)&&(m[_]=a[_]);a=m,v?x3(v,f)(...m):h(null,...m)}}function r(a){if(typeof a!="function")throw new TypeError("Expected `middelware` to be a function, not "+a);return e.push(a),t}}function x3(e,t){let i;return r;function r(...h){const f=e.length>h.length;let g;f&&h.push(a);try{g=e.apply(this,h)}catch(m){const v=m;if(f&&i)throw v;return a(v)}f||(g&&g.then&&typeof g.then=="function"?g.then(c,a):g instanceof Error?a(g):c(g))}function a(h,...f){i||(i=!0,t(h,...f))}function c(h){a(null,h)}}const qi={basename:w3,dirname:C3,extname:k3,join:N3,sep:"/"};function w3(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');_o(e);let i=0,r=-1,a=e.length,c;if(t===void 0||t.length===0||t.length>e.length){for(;a--;)if(e.codePointAt(a)===47){if(c){i=a+1;break}}else r<0&&(c=!0,r=a+1);return r<0?"":e.slice(i,r)}if(t===e)return"";let h=-1,f=t.length-1;for(;a--;)if(e.codePointAt(a)===47){if(c){i=a+1;break}}else h<0&&(c=!0,h=a+1),f>-1&&(e.codePointAt(a)===t.codePointAt(f--)?f<0&&(r=a):(f=-1,r=h));return i===r?r=h:r<0&&(r=e.length),e.slice(i,r)}function C3(e){if(_o(e),e.length===0)return".";let t=-1,i=e.length,r;for(;--i;)if(e.codePointAt(i)===47){if(r){t=i;break}}else r||(r=!0);return t<0?e.codePointAt(0)===47?"/":".":t===1&&e.codePointAt(0)===47?"//":e.slice(0,t)}function k3(e){_o(e);let t=e.length,i=-1,r=0,a=-1,c=0,h;for(;t--;){const f=e.codePointAt(t);if(f===47){if(h){r=t+1;break}continue}i<0&&(h=!0,i=t+1),f===46?a<0?a=t:c!==1&&(c=1):a>-1&&(c=-1)}return a<0||i<0||c===0||c===1&&a===i-1&&a===r+1?"":e.slice(a,i)}function N3(...e){let t=-1,i;for(;++t<e.length;)_o(e[t]),e[t]&&(i=i===void 0?e[t]:i+"/"+e[t]);return i===void 0?".":E3(i)}function E3(e){_o(e);const t=e.codePointAt(0)===47;let i=j3(e,!t);return i.length===0&&!t&&(i="."),i.length>0&&e.codePointAt(e.length-1)===47&&(i+="/"),t?"/"+i:i}function j3(e,t){let i="",r=0,a=-1,c=0,h=-1,f,g;for(;++h<=e.length;){if(h<e.length)f=e.codePointAt(h);else{if(f===47)break;f=47}if(f===47){if(!(a===h-1||c===1))if(a!==h-1&&c===2){if(i.length<2||r!==2||i.codePointAt(i.length-1)!==46||i.codePointAt(i.length-2)!==46){if(i.length>2){if(g=i.lastIndexOf("/"),g!==i.length-1){g<0?(i="",r=0):(i=i.slice(0,g),r=i.length-1-i.lastIndexOf("/")),a=h,c=0;continue}}else if(i.length>0){i="",r=0,a=h,c=0;continue}}t&&(i=i.length>0?i+"/..":"..",r=2)}else i.length>0?i+="/"+e.slice(a+1,h):i=e.slice(a+1,h),r=h-a-1;a=h,c=0}else f===46&&c>-1?c++:c=-1}return i}function _o(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const T3={cwd:D3};function D3(){return"/"}function Mm(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function M3(e){if(typeof e=="string")e=new URL(e);else if(!Mm(e)){const t=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw t.code="ERR_INVALID_ARG_TYPE",t}if(e.protocol!=="file:"){const t=new TypeError("The URL must be of scheme file");throw t.code="ERR_INVALID_URL_SCHEME",t}return A3(e)}function A3(e){if(e.hostname!==""){const r=new TypeError('File URL host must be "localhost" or empty on darwin');throw r.code="ERR_INVALID_FILE_URL_HOST",r}const t=e.pathname;let i=-1;for(;++i<t.length;)if(t.codePointAt(i)===37&&t.codePointAt(i+1)===50){const r=t.codePointAt(i+2);if(r===70||r===102){const a=new TypeError("File URL path must not include encoded / characters");throw a.code="ERR_INVALID_FILE_URL_PATH",a}}return decodeURIComponent(t)}const Bf=["history","path","basename","stem","extname","dirname"];class a1{constructor(t){let i;t?Mm(t)?i={path:t}:typeof t=="string"||R3(t)?i={value:t}:i=t:i={},this.cwd="cwd"in i?"":T3.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let r=-1;for(;++r<Bf.length;){const c=Bf[r];c in i&&i[c]!==void 0&&i[c]!==null&&(this[c]=c==="history"?[...i[c]]:i[c])}let a;for(a in i)Bf.includes(a)||(this[a]=i[a])}get basename(){return typeof this.path=="string"?qi.basename(this.path):void 0}set basename(t){zf(t,"basename"),Lf(t,"basename"),this.path=qi.join(this.dirname||"",t)}get dirname(){return typeof this.path=="string"?qi.dirname(this.path):void 0}set dirname(t){MS(this.basename,"dirname"),this.path=qi.join(t||"",this.basename)}get extname(){return typeof this.path=="string"?qi.extname(this.path):void 0}set extname(t){if(Lf(t,"extname"),MS(this.dirname,"extname"),t){if(t.codePointAt(0)!==46)throw new Error("`extname` must start with `.`");if(t.includes(".",1))throw new Error("`extname` cannot contain multiple dots")}this.path=qi.join(this.dirname,this.stem+(t||""))}get path(){return this.history[this.history.length-1]}set path(t){Mm(t)&&(t=M3(t)),zf(t,"path"),this.path!==t&&this.history.push(t)}get stem(){return typeof this.path=="string"?qi.basename(this.path,this.extname):void 0}set stem(t){zf(t,"stem"),Lf(t,"stem"),this.path=qi.join(this.dirname||"",t+(this.extname||""))}fail(t,i,r){const a=this.message(t,i,r);throw a.fatal=!0,a}info(t,i,r){const a=this.message(t,i,r);return a.fatal=void 0,a}message(t,i,r){const a=new kn(t,i,r);return this.path&&(a.name=this.path+":"+a.name,a.file=this.path),a.fatal=!1,this.messages.push(a),a}toString(t){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(t||void 0).decode(this.value)}}function Lf(e,t){if(e&&e.includes(qi.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+qi.sep+"`")}function zf(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function MS(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}function R3(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const O3=(function(e){const r=this.constructor.prototype,a=r[e],c=function(){return a.apply(c,arguments)};return Object.setPrototypeOf(c,r),c}),B3={}.hasOwnProperty;class zp extends O3{constructor(){super("copy"),this.Compiler=void 0,this.Parser=void 0,this.attachers=[],this.compiler=void 0,this.freezeIndex=-1,this.frozen=void 0,this.namespace={},this.parser=void 0,this.transformers=b3()}copy(){const t=new zp;let i=-1;for(;++i<this.attachers.length;){const r=this.attachers[i];t.use(...r)}return t.data(Of(!0,{},this.namespace)),t}data(t,i){return typeof t=="string"?arguments.length===2?(Uf("data",this.frozen),this.namespace[t]=i,this):B3.call(this.namespace,t)&&this.namespace[t]||void 0:t?(Uf("data",this.frozen),this.namespace=t,this):this.namespace}freeze(){if(this.frozen)return this;const t=this;for(;++this.freezeIndex<this.attachers.length;){const[i,...r]=this.attachers[this.freezeIndex];if(r[0]===!1)continue;r[0]===!0&&(r[0]=void 0);const a=i.call(t,...r);typeof a=="function"&&this.transformers.use(a)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(t){this.freeze();const i=Qc(t),r=this.parser||this.Parser;return Hf("parse",r),r(String(i),i)}process(t,i){const r=this;return this.freeze(),Hf("process",this.parser||this.Parser),If("process",this.compiler||this.Compiler),i?a(void 0,i):new Promise(a);function a(c,h){const f=Qc(t),g=r.parse(f);r.run(g,f,function(v,_,S){if(v||!_||!S)return m(v);const y=_,x=r.stringify(y,S);H3(x)?S.value=x:S.result=x,m(v,S)});function m(v,_){v||!_?h(v):c?c(_):i(void 0,_)}}}processSync(t){let i=!1,r;return this.freeze(),Hf("processSync",this.parser||this.Parser),If("processSync",this.compiler||this.Compiler),this.process(t,a),RS("processSync","process",i),r;function a(c,h){i=!0,TS(c),r=h}}run(t,i,r){AS(t),this.freeze();const a=this.transformers;return!r&&typeof i=="function"&&(r=i,i=void 0),r?c(void 0,r):new Promise(c);function c(h,f){const g=Qc(i);a.run(t,g,m);function m(v,_,S){const y=_||t;v?f(v):h?h(y):r(void 0,y,S)}}}runSync(t,i){let r=!1,a;return this.run(t,i,c),RS("runSync","run",r),a;function c(h,f){TS(h),a=f,r=!0}}stringify(t,i){this.freeze();const r=Qc(i),a=this.compiler||this.Compiler;return If("stringify",a),AS(t),a(t,r)}use(t,...i){const r=this.attachers,a=this.namespace;if(Uf("use",this.frozen),t!=null)if(typeof t=="function")g(t,i);else if(typeof t=="object")Array.isArray(t)?f(t):h(t);else throw new TypeError("Expected usable value, not `"+t+"`");return this;function c(m){if(typeof m=="function")g(m,[]);else if(typeof m=="object")if(Array.isArray(m)){const[v,..._]=m;g(v,_)}else h(m);else throw new TypeError("Expected usable value, not `"+m+"`")}function h(m){if(!("plugins"in m)&&!("settings"in m))throw new Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");f(m.plugins),m.settings&&(a.settings=Of(!0,a.settings,m.settings))}function f(m){let v=-1;if(m!=null)if(Array.isArray(m))for(;++v<m.length;){const _=m[v];c(_)}else throw new TypeError("Expected a list of plugins, not `"+m+"`")}function g(m,v){let _=-1,S=-1;for(;++_<r.length;)if(r[_][0]===m){S=_;break}if(S===-1)r.push([m,...v]);else if(v.length>0){let[y,...x]=v;const w=r[S][1];Dm(w)&&Dm(y)&&(y=Of(!0,w,y)),r[S]=[m,y,...x]}}}}const L3=new zp().freeze();function Hf(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function If(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function Uf(e,t){if(t)throw new Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function AS(e){if(!Dm(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function RS(e,t,i){if(!i)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function Qc(e){return z3(e)?e:new a1(e)}function z3(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function H3(e){return typeof e=="string"||I3(e)}function I3(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const U3="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",OS=[],BS={allowDangerousHtml:!0},P3=/^(https?|ircs?|mailto|xmpp)$/i,q3=[{from:"astPlugins",id:"remove-buggy-html-in-markdown-parser"},{from:"allowDangerousHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"allowNode",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowElement"},{from:"allowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowedElements"},{from:"className",id:"remove-classname"},{from:"disallowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"disallowedElements"},{from:"escapeHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"includeElementIndex",id:"#remove-includeelementindex"},{from:"includeNodeIndex",id:"change-includenodeindex-to-includeelementindex"},{from:"linkTarget",id:"remove-linktarget"},{from:"plugins",id:"change-plugins-to-remarkplugins",to:"remarkPlugins"},{from:"rawSourcePos",id:"#remove-rawsourcepos"},{from:"renderers",id:"change-renderers-to-components",to:"components"},{from:"source",id:"change-source-to-children",to:"children"},{from:"sourcePos",id:"#remove-sourcepos"},{from:"transformImageUri",id:"#add-urltransform",to:"urlTransform"},{from:"transformLinkUri",id:"#add-urltransform",to:"urlTransform"}];function F3(e){const t=$3(e),i=V3(e);return K3(t.runSync(t.parse(i),i),e)}function $3(e){const t=e.rehypePlugins||OS,i=e.remarkPlugins||OS,r=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...BS}:BS;return L3().use(wD).use(i).use(v3,r).use(t)}function V3(e){const t=e.children||"",i=new a1;return typeof t=="string"&&(i.value=t),i}function K3(e,t){const i=t.allowedElements,r=t.allowElement,a=t.components,c=t.disallowedElements,h=t.skipHtml,f=t.unwrapDisallowed,g=t.urlTransform||Y3;for(const v of q3)Object.hasOwn(t,v.from)&&(""+v.from+(v.to?"use `"+v.to+"` instead":"remove it")+U3+v.id,void 0);return Lp(e,m),cj(e,{Fragment:u.Fragment,components:a,ignoreInvalidStyle:!0,jsx:u.jsx,jsxs:u.jsxs,passKeys:!0,passNode:!0});function m(v,_,S){if(v.type==="raw"&&S&&typeof _=="number")return h?S.children.splice(_,1):S.children[_]={type:"text",value:v.value},_;if(v.type==="element"){let y;for(y in Df)if(Object.hasOwn(Df,y)&&Object.hasOwn(v.properties,y)){const x=v.properties[y],w=Df[y];(w===null||w.includes(v.tagName))&&(v.properties[y]=g(String(x||""),y,v))}}if(v.type==="element"){let y=i?!i.includes(v.tagName):c?c.includes(v.tagName):!1;if(!y&&r&&typeof _=="number"&&(y=!r(v,_,S)),y&&S&&typeof _=="number")return f&&v.children?S.children.splice(_,1,...v.children):S.children.splice(_,1),_}}}function Y3(e){const t=e.indexOf(":"),i=e.indexOf("?"),r=e.indexOf("#"),a=e.indexOf("/");return t===-1||a!==-1&&t>a||i!==-1&&t>i||r!==-1&&t>r||P3.test(e.slice(0,t))?e:""}function LS(e,t){const i=String(e);if(typeof t!="string")throw new TypeError("Expected character");let r=0,a=i.indexOf(t);for(;a!==-1;)r++,a=i.indexOf(t,a+t.length);return r}function W3(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function X3(e,t,i){const a=Iu((i||{}).ignore||[]),c=G3(t);let h=-1;for(;++h<c.length;)Em(e,f);function f(m,v,_){if(m.type==="text"&&typeof _=="number")return g(m,v,_);if(a(m,_,v[v.length-1]))return Nm}function g(m,v,_){const S=v[v.length-1],y=c[h][0],x=c[h][1];let w=0,j=!1,N=[];y.lastIndex=0;let M=y.exec(m.value);for(;M;){const R=M.index,I={index:M.index,input:M.input,stack:[...v,m]};let H=x(...M,I);if(typeof H=="string"&&(H=H.length>0?{type:"text",value:H}:void 0),H===!1)y.lastIndex=R+1;else{if(w!==R&&A({type:"text",value:m.value.slice(w,R)}),Array.isArray(H))for(const O of H)A(O);else H&&A(H);w=R+M[0].length,j=!0}if(!y.global)break;M=y.exec(m.value)}return j?(w<m.value.length&&A({type:"text",value:m.value.slice(w)}),S.children.splice(_,1,...N)):N=[m],_+N.length;function A(R){const I=N[N.length-1];I&&I.type==="text"&&R.type==="text"?I.value+=R.value:N.push(R)}}}function G3(e){if(!Array.isArray(e))throw new TypeError("Expected find and replace tuple or list of tuples");const t=[],i=!e[0]||Array.isArray(e[0])?e:[e];let r=-1;for(;++r<i.length;){const a=i[r];t.push([Q3(a[0]),Z3(a[1])])}return t}function Q3(e){return typeof e=="string"?new RegExp(W3(e),"g"):e}function Z3(e){return typeof e=="function"?e:function(){return e}}const Pf="phrasing",qf=["autolink","link","image","label"];function J3(){return{transforms:[lM],enter:{literalAutolink:tM,literalAutolinkEmail:Ff,literalAutolinkHttp:Ff,literalAutolinkWww:Ff},exit:{literalAutolink:rM,literalAutolinkEmail:sM,literalAutolinkHttp:nM,literalAutolinkWww:iM}}}function eM(){return{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:Pf,notInConstruct:qf},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:Pf,notInConstruct:qf},{character:":",before:"[ps]",after:"\\/",inConstruct:Pf,notInConstruct:qf}]}}function tM(e){this.enter({type:"link",title:null,url:"",children:[]},e)}function Ff(e){this.config.enter.autolinkProtocol.call(this,e)}function nM(e){this.config.exit.autolinkProtocol.call(this,e)}function iM(e){this.config.exit.data.call(this,e);const t=this.stack[this.stack.length-1];t.type,t.url="http://"+this.sliceSerialize(e)}function sM(e){this.config.exit.autolinkEmail.call(this,e)}function rM(e){this.exit(e)}function lM(e){X3(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,aM],[new RegExp("(?<=^|\\s|\\p{P}|\\p{S})([-.\\w+]+)@([-\\w]+(?:\\.[-\\w]+)+)","gu"),oM]],{ignore:["link","linkReference"]})}function aM(e,t,i,r,a){let c="";if(!o1(a)||(/^w/i.test(t)&&(i=t+i,t="",c="http://"),!cM(i)))return!1;const h=uM(i+r);if(!h[0])return!1;const f={type:"link",title:null,url:c+t+h[0],children:[{type:"text",value:t+h[0]}]};return h[1]?[f,{type:"text",value:h[1]}]:f}function oM(e,t,i,r){return!o1(r,!0)||/[-\d_]$/.test(i)?!1:{type:"link",title:null,url:"mailto:"+t+"@"+i,children:[{type:"text",value:t+"@"+i}]}}function cM(e){const t=e.split(".");return!(t.length<2||t[t.length-1]&&(/_/.test(t[t.length-1])||!/[a-zA-Z\d]/.test(t[t.length-1]))||t[t.length-2]&&(/_/.test(t[t.length-2])||!/[a-zA-Z\d]/.test(t[t.length-2])))}function uM(e){const t=/[!"&'),.:;<>?\]}]+$/.exec(e);if(!t)return[e,void 0];e=e.slice(0,t.index);let i=t[0],r=i.indexOf(")");const a=LS(e,"(");let c=LS(e,")");for(;r!==-1&&a>c;)e+=i.slice(0,r+1),i=i.slice(r+1),r=i.indexOf(")"),c++;return[e,i]}function o1(e,t){const i=e.input.charCodeAt(e.index-1);return(e.index===0||Ar(i)||Lu(i))&&(!t||i!==47)}c1.peek=yM;function hM(){this.buffer()}function dM(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function fM(){this.buffer()}function mM(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function pM(e){const t=this.resume(),i=this.stack[this.stack.length-1];i.type,i.identifier=ki(this.sliceSerialize(e)).toLowerCase(),i.label=t}function gM(e){this.exit(e)}function _M(e){const t=this.resume(),i=this.stack[this.stack.length-1];i.type,i.identifier=ki(this.sliceSerialize(e)).toLowerCase(),i.label=t}function vM(e){this.exit(e)}function yM(){return"["}function c1(e,t,i,r){const a=i.createTracker(r);let c=a.move("[^");const h=i.enter("footnoteReference"),f=i.enter("reference");return c+=a.move(i.safe(i.associationId(e),{after:"]",before:c})),f(),h(),c+=a.move("]"),c}function SM(){return{enter:{gfmFootnoteCallString:hM,gfmFootnoteCall:dM,gfmFootnoteDefinitionLabelString:fM,gfmFootnoteDefinition:mM},exit:{gfmFootnoteCallString:pM,gfmFootnoteCall:gM,gfmFootnoteDefinitionLabelString:_M,gfmFootnoteDefinition:vM}}}function bM(e){let t=!1;return e&&e.firstLineBlank&&(t=!0),{handlers:{footnoteDefinition:i,footnoteReference:c1},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function i(r,a,c,h){const f=c.createTracker(h);let g=f.move("[^");const m=c.enter("footnoteDefinition"),v=c.enter("label");return g+=f.move(c.safe(c.associationId(r),{before:g,after:"]"})),v(),g+=f.move("]:"),r.children&&r.children.length>0&&(f.shift(4),g+=f.move((t?`
26
+ `:" ")+c.indentLines(c.containerFlow(r,f.current()),t?u1:xM))),m(),g}}function xM(e,t,i){return t===0?e:u1(e,t,i)}function u1(e,t,i){return(i?"":" ")+e}const wM=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];Hp.attention=jM;Hp.peek=TM;function CM(){return{canContainEols:["delete"],enter:{strikethrough:NM},exit:{strikethrough:EM}}}function kM(){return{handlers:{delete:Hp},unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:wM}]}}function NM(e){this.enter({type:"delete",children:[],position:void 0},e)}function EM(e){this.exit(e)}function Hp(e,t,i,r){const a=i.createTracker(r),c=i.stack.includes("strikethrough")?"~":"~~",h=i.enter("strikethrough");let f=a.move(c);return f+=i.containerPhrasing(e,{...a.current(),before:f,after:"~"}),f+=a.move(c),h(),f}function jM(){return{construct:"strikethrough",markers:["~"],sizes:[2,1]}}function TM(){return"~"}function DM(e){return e.length}function MM(e,t){const i=t||{},r=(i.align||[]).concat(),a=i.stringLength||DM,c=[],h=[],f=[],g=[];let m=0,v=-1;for(;++v<e.length;){const w=[],j=[];let N=-1;for(e[v].length>m&&(m=e[v].length);++N<e[v].length;){const M=AM(e[v][N]);if(i.alignDelimiters!==!1){const A=a(M);j[N]=A,(g[N]===void 0||A>g[N])&&(g[N]=A)}w.push(M)}h[v]=w,f[v]=j}let _=-1;if(typeof r=="object"&&"length"in r)for(;++_<m;)c[_]=zS(r[_]);else{const w=zS(r);for(;++_<m;)c[_]=w}_=-1;const S=[],y=[];for(;++_<m;){const w=c[_];let j="",N="";w===99?(j=":",N=":"):w===108?j=":":w===114&&(N=":");let M=i.alignDelimiters===!1?1:Math.max(1,g[_]-j.length-N.length);const A=j+"-".repeat(M)+N;i.alignDelimiters!==!1&&(M=j.length+M+N.length,M>g[_]&&(g[_]=M),y[_]=M),S[_]=A}h.splice(1,0,S),f.splice(1,0,y),v=-1;const x=[];for(;++v<h.length;){const w=h[v],j=f[v];_=-1;const N=[];for(;++_<m;){const M=w[_]||"";let A="",R="";if(i.alignDelimiters!==!1){const I=g[_]-(j[_]||0),H=c[_];H===114?A=" ".repeat(I):H===99?I%2?(A=" ".repeat(I/2+.5),R=" ".repeat(I/2-.5)):(A=" ".repeat(I/2),R=A):R=" ".repeat(I)}i.delimiterStart!==!1&&!_&&N.push("|"),i.padding!==!1&&!(i.alignDelimiters===!1&&M==="")&&(i.delimiterStart!==!1||_)&&N.push(" "),i.alignDelimiters!==!1&&N.push(A),N.push(M),i.alignDelimiters!==!1&&N.push(R),i.padding!==!1&&N.push(" "),(i.delimiterEnd!==!1||_!==m-1)&&N.push("|")}x.push(i.delimiterEnd===!1?N.join("").replace(/ +$/,""):N.join(""))}return x.join(`
27
+ `)}function AM(e){return e==null?"":String(e)}function zS(e){const t=typeof e=="string"?e.codePointAt(0):0;return t===67||t===99?99:t===76||t===108?108:t===82||t===114?114:0}const RM=Iu(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function OM(e,t,i,r){const a=i.enter("blockquote"),c=i.createTracker(r);c.move("> "),c.shift(2);const h=i.indentLines(i.containerFlow(e,c.current()),BM);return a(),h}function BM(e,t,i){return">"+(i?"":" ")+e}function LM(e,t){return HS(e,t.inConstruct,!0)&&!HS(e,t.notInConstruct,!1)}function HS(e,t,i){if(typeof t=="string"&&(t=[t]),!t||t.length===0)return i;let r=-1;for(;++r<t.length;)if(e.includes(t[r]))return!0;return!1}function IS(e,t,i,r){let a=-1;for(;++a<i.unsafe.length;){const c=i.unsafe[a];if(c.character===`
28
+ `&&!c.before&&!c.after&&LM(i.stack,c))return/[\t ]/.test(r.before)?"":" "}return`\\
29
+ `}function zM(e,t){const i=String(e);let r=i.indexOf(t),a=r,c=0,h=0;if(typeof t!="string")throw new TypeError("Expected substring");for(;r!==-1;)r===a?++c>h&&(h=c):c=1,a=r+t.length,r=i.indexOf(t,a);return h}function HM(e,t){return!!(t.options.fences===!1&&e.value&&!e.lang&&/[^\n\r ]/.test(e.value)&&!/^[\t ]*(?:[\n\r]|$)|(?:^|[\n\r])[\t ]*$/.test(e.value))}function IM(e){const t=e.options.fence||"`";if(t!=="`"&&t!=="~")throw new Error("Cannot serialize code with `"+t+"` for `options.fence`, expected `` ` `` or `~`");return t}function UM(e,t,i,r){const a=IM(i),c=e.value||"";if(HM(e,i)){const _=i.enter("codeIndented"),S=i.indentLines(c,PM);return _(),S}const h=i.createTracker(r),f=a.repeat(Math.max(zM(c,a)+1,3)),g=i.enter("codeFenced"),m=a==="`"?"GraveAccent":"Tilde";let v=h.move(f);if(e.lang){const _=i.enter(`codeFencedLang${m}`);v+=h.move(i.safe(e.lang,{before:v,after:" ",encode:["`"],...h.current()})),_()}if(e.lang&&e.meta){const _=i.enter(`codeFencedMeta${m}`);v+=h.move(" "),v+=h.move(i.safe(e.meta,{before:v,after:`
30
+ `,encode:["`"],...h.current()})),_()}return v+=h.move(`
31
+ `),c&&(v+=h.move(c+`
32
+ `)),v+=h.move(f),g(),v}function PM(e,t,i){return(i?"":" ")+e}function Ip(e){const t=e.options.quote||'"';if(t!=='"'&&t!=="'")throw new Error("Cannot serialize title with `"+t+"` for `options.quote`, expected `\"`, or `'`");return t}function qM(e,t,i,r){const a=Ip(i),c=a==='"'?"Quote":"Apostrophe",h=i.enter("definition");let f=i.enter("label");const g=i.createTracker(r);let m=g.move("[");return m+=g.move(i.safe(i.associationId(e),{before:m,after:"]",...g.current()})),m+=g.move("]: "),f(),!e.url||/[\0- \u007F]/.test(e.url)?(f=i.enter("destinationLiteral"),m+=g.move("<"),m+=g.move(i.safe(e.url,{before:m,after:">",...g.current()})),m+=g.move(">")):(f=i.enter("destinationRaw"),m+=g.move(i.safe(e.url,{before:m,after:e.title?" ":`
33
+ `,...g.current()}))),f(),e.title&&(f=i.enter(`title${c}`),m+=g.move(" "+a),m+=g.move(i.safe(e.title,{before:m,after:a,...g.current()})),m+=g.move(a),f()),h(),m}function FM(e){const t=e.options.emphasis||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize emphasis with `"+t+"` for `options.emphasis`, expected `*`, or `_`");return t}function Eu(e){const t=e.codePointAt(0);return t===void 0?"":String.fromCodePoint(t)}function Hl(e){const t=e.codePointAt(e.length-2);return t!==void 0&&t>65535?e.slice(-2):e.slice(-1)}function h1(e){return"&#x"+e.toString(16).toUpperCase()+";"}function US(e,t,i){const r=Ws(e),a=Ws(t);return r===void 0?a===void 0?i==="_"?{inside:!0,outside:!0}:{inside:!1,outside:!1}:a===1?{inside:!0,outside:!0}:{inside:!1,outside:!0}:r===1?a===void 0?{inside:!1,outside:!1}:a===1?{inside:!0,outside:!0}:{inside:!1,outside:!1}:a===void 0?{inside:!1,outside:!1}:a===1?{inside:!0,outside:!1}:{inside:!1,outside:!1}}function $M(e){if(e.charCodeAt(0)!==60)return;const t=e.charCodeAt(1);if(t===33){const f=e.charCodeAt(2);return f===45?2:f===91?5:Sn(f)?4:void 0}if(t===63)return 3;const i=t===47,r=i?2:1;let a=r,c=e.charCodeAt(a);if(!Sn(c))return;for(;c===45||xn(c);)c=e.charCodeAt(++a);const h=e.slice(r,a).toLowerCase();return!i&&c!==47&&km.includes(h)?1:Xx.includes(h)?6:7}const VM=new Map([["*",!1],["_",!0]]);function KM(e,t,i){const r=new Set;for(const c of e){const h=i.get(c);if(h&&c.attention&&t.some(f=>f.attention===c.attention))for(const f of h.tokens)r.add(f.attention)}const a=[];for(const c of e)c.attention&&r.delete(c.attention)&&a.push(c.attention);return a.reverse(),a}function d1(e,t,i){const r=[],a=new Map,c=new Map;let h=0;for(;h<e.length;){if(!e[h].attention){h++;continue}const f=e[h].value.charAt(0),g=VM.get(f);let m=h+1;for(;m<e.length&&e[m].attention&&e[m].value.charAt(0)===f;)m++;const v=h?e[h-1].value:t,_=Ws(v.charCodeAt(v.length-1)),S=Ws((m<e.length?e[m].value:i).charCodeAt(0)),y=!S||S===2&&!!_,x=!_||_===2&&!!S,w={tokens:e.slice(h,m),markers:[],start:0,end:0,open:g?y&&(!!_||!x):y,close:g?x&&(!!S||!y):x,split:g!==void 0};for(const j of w.tokens){a.set(j,[...w.tokens]),c.set(j,w);let N=j.value.length;for(;N--;)w.markers.push(j)}w.end=w.markers.length,r.push(w),h=m}for(WM(r,a),h=-1;++h<e.length;){const f=a.get(e[h]);if(f)return{attention:KM(e,f,c),index:h}}}function Zc(e,t){const i=e[t?0:e.length-1];if(!i||i.attention)return;const r=t?Eu(i.value):Hl(i.value),a=h1(r.codePointAt(0));if(t)i.value=a+i.value.slice(r.length);else{let c=i.value.slice(0,i.value.length-r.length),h=0;for(;c.charCodeAt(c.length-1-h)===92;)h++;h%2&&(c+="\\"),i.value=c+a}}function YM(e,t,i,r,a){for(const c of i.attention){const h=t.get(c)||c.sequences[0];for(const f of c.sequences){if(f===h)continue;const g=new Map(t);g.set(c,f);const m=Pp(e,g,r,a),v=d1(m,r,a);if(!v||v.index>i.index)return{chosen:g,mistake:v,tokens:m}}}}function WM(e,t){const i=new Map;for(const r of e){const a=r.tokens[0].value.charAt(0);let c=i.get(a);c||(c=[],i.set(a,c));let h=r.close?c.length:0;for(;h--&&r.start<r.end;){const f=c[h],g=f.end-f.start,m=r.end-r.start;if(r.split?(f.close||r.open)&&m%3&&!((g+m)%3):g!==f.markers.length||g!==m)continue;const v=r.split?g>1&&m>1?2:1:m,_=f.markers.slice(f.end-v,f.end),S=r.markers.slice(r.start,r.start+v),y=_[0],x=S[0];if(y===_[v-1]&&y.value.length===v&&x===S[v-1]&&x.value.length===v&&y.attention===x.attention)t.delete(y),t.delete(x);else{const w=[...new Set([..._,...S])];for(const j of w){const N=t.get(j);N&&N.push(...w)}}f.end-=v,r.start+=v,f.start===f.end&&c.splice(h,1),h=c.length}r.open&&r.start<r.end&&c.push(r)}}function XM(e,t,i){if(t.length===0)throw new Error("Cannot serialize `"+e+"` as attention without markers, expected one or more markers");if(i.length===0)throw new Error("Cannot serialize `"+e+"` as attention without sizes, expected one or more sizes");for(const a of i)if(!Number.isSafeInteger(a)||a<1)throw new Error("Cannot serialize `"+e+"` as attention with `"+a+"` as size, expected positive integer");const r=[];for(const a of t){if(a.length!==1)throw new Error("Cannot serialize `"+e+"` as attention with `"+a+"` as marker, expected a single ascii character");if(!Ux(a.charCodeAt(0)))throw new Error("Cannot serialize `"+e+"` as attention with `"+a+"` as marker, expected ascii punctuation");for(const c of i)r.push(a.repeat(c))}return r}function GM(e,t,i){const r=t.indexStack,a=e.children||[],c=[];let h=-1,f=i.before;r.push(-1);let g=t.createTracker(i);for(;++h<a.length;){const m=a[h];let v;if(r[r.length-1]=h,h+1<a.length){let y=t.handle.handlers[a[h+1].type];y&&y.peek&&(y=y.peek),v=y?Eu(y(a[h+1],e,t,{before:"",after:"",...g.current()})):""}else v=i.after;const _=c[c.length-1];typeof _=="string"&&(f==="\r"||f===`
34
+ `)&&m.type==="html"&&$M(m.value)!==7&&(c[c.length-1]=_.replace(/(\r?\n|\r)$/," "),f=" ",g=t.createTracker(i),g.move(Pu(c,i.before,i.after)));const S=t.handle.handlers[m.type];if(S&&S.attention){const y=Up(m,S.attention,t,g);c.push(y),f=Hl(y.sequences[0])}else{const y=t.handle(m,e,t,{...g.current(),after:v,before:f});if(!y)continue;g.move(y),c.push(y),f=Hl(y)}}return r.pop(),c}function Up(e,t,i,r){const{construct:a,markers:c,sizes:h}=t(e,i),f=XM(e.type,c,h),g=f[0],m=i.enter(a);r.move(g);const v=GM(e,i,{...r.current(),before:g,after:g});return r.move(Pu(v,g,g)),r.move(g),m(),{children:v,sequences:f}}function Pp(e,t,i,r){const a=[];let c,h=Hl(i),f=-1;for(;++f<e.length;){const g=e[f];if(typeof g=="string"){const A={value:g,attention:void 0};c&&c===Eu(g)&&Zc([A],!0),c=void 0,a.push(A),A.value&&(h=Hl(A.value));continue}const m=t.get(g)||g.sequences[0],v=m.charAt(0),_=e[f+1],S=h,y=Eu(_===void 0?r:typeof _=="string"?_:t.get(_)||_.sequences[0]),x=Pp(g.children,t,m,m),w=x.length>0?x[0].value:"",j=US(S.charCodeAt(S.length-1),w.charCodeAt(0),v);j.inside&&Zc(x,!0);const N=x.length>0?Hl(x[x.length-1].value):"",M=US(y.charCodeAt(0),N.charCodeAt(N.length-1),v);M.inside&&Zc(x,!1),j.outside&&S!==`
35
+ `&&S!=="\r"&&Zc(a,!1),M.outside&&(c=y),a.push({value:m,attention:g},...x,{value:m,attention:g}),h=m.charAt(m.length-1)}return a}function Pu(e,t,i){let r=new Map;const a=Pp(e,r,t,i);let c=a,h=d1(c,t,i);for(;h;){const g=YM(e,r,h,t,i);if(!g){c=a;break}r=g.chosen,c=g.tokens,h=g.mistake}let f="";for(const g of c)f+=g.value;return f}qp.attention=f1;qp.peek=QM;function qp(e,t,i,r){const a=i.enter("phrasing"),c=Up(e,f1,i,i.createTracker(r)),h=Pu([c],r.before,r.after);return a(),h}function f1(e,t){return{construct:"emphasis",markers:FM(t)==="*"?["*","_"]:["_","*"],sizes:[1]}}function QM(e,t,i){return i.options.emphasis||"*"}function ZM(e,t){let i=!1;return Lp(e,function(r){if("value"in r&&/\r?\n|\r/.test(r.value)||r.type==="break")return i=!0,mu}),!!((!e.depth||e.depth<3)&&Tp(e)&&(t.options.setext||i))}function JM(e,t,i,r){const a=Math.max(Math.min(6,e.depth||1),1),c=i.createTracker(r);if(ZM(e,i)){const _=i.enter("headingSetext"),S=i.enter("phrasing"),y=i.containerPhrasing(e,{...c.current(),before:`
36
+ `,after:`
37
+ `});return S(),_(),y+`
38
+ `+(a===1?"=":"-").repeat(y.length-(Math.max(y.lastIndexOf("\r"),y.lastIndexOf(`
39
+ `))+1))}const h="#".repeat(a),f=i.enter("headingAtx"),g=i.enter("phrasing");c.move(h+" ");let m=i.containerPhrasing(e,{before:"# ",after:`
40
+ `,...c.current()});const v=m.charCodeAt(0);return(v===9||v===32)&&(m=h1(v)+m.slice(1)),m=m?h+" "+m:h,i.options.closeAtx&&(m+=" "+h),g(),f(),m}m1.peek=eA;function m1(e){return e.value||""}function eA(){return"<"}p1.peek=tA;function p1(e,t,i,r){const a=Ip(i),c=a==='"'?"Quote":"Apostrophe",h=i.enter("image");let f=i.enter("label");const g=i.createTracker(r);let m=g.move("![");return m+=g.move(i.safe(e.alt,{before:m,after:"]",...g.current()})),m+=g.move("]("),f(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(f=i.enter("destinationLiteral"),m+=g.move("<"),m+=g.move(i.safe(e.url,{before:m,after:">",...g.current()})),m+=g.move(">")):(f=i.enter("destinationRaw"),m+=g.move(i.safe(e.url,{before:m,after:e.title?" ":")",...g.current()}))),f(),e.title&&(f=i.enter(`title${c}`),m+=g.move(" "+a),m+=g.move(i.safe(e.title,{before:m,after:a,...g.current()})),m+=g.move(a),f()),m+=g.move(")"),h(),m}function tA(){return"!"}g1.peek=nA;function g1(e,t,i,r){const a=e.referenceType,c=i.enter("imageReference");let h=i.enter("label");const f=i.createTracker(r);let g=f.move("![");const m=i.safe(e.alt,{before:g,after:"]",...f.current()});g+=f.move(m+"]["),h();const v=i.stack;i.stack=v.filter(function(S){return S!=="phrasing"}),h=i.enter("reference");const _=i.safe(i.associationId(e),{before:g,after:"]",...f.current()});return h(),i.stack=v,c(),a==="full"||!m||m!==_?g+=f.move(_+"]"):a==="shortcut"?g=g.slice(0,-1):g+=f.move("]"),g}function nA(){return"!"}_1.peek=iA;function _1(e,t,i){let r=e.value||"",a="`",c=-1;for(;new RegExp("(^|[^`])"+a+"([^`]|$)").test(r);)a+="`";for(/[^\n\r ]/.test(r)&&(/^[\n\r ]/.test(r)&&/[\n\r ]$/.test(r)||/^`|`$/.test(r))&&(r=" "+r+" ");++c<i.unsafe.length;){const h=i.unsafe[c],f=i.compilePattern(h);if(!h.atBreak)continue;let g;for(;g=f.exec(r);){let m=g.index;r.charCodeAt(m)===10&&r.charCodeAt(m-1)===13&&m--,r=r.slice(0,m)+" "+r.slice(g.index+1)}}return a+r+a}function iA(){return"`"}function v1(e,t){const i=Tp(e);return!!(!t.options.resourceLink&&e.url&&!e.title&&e.children&&e.children.length===1&&e.children[0].type==="text"&&(i===e.url||"mailto:"+i===e.url)&&/^[a-z][+\-.a-z]+:/i.test(e.url)&&!/[\0- <>\u007F]/.test(e.url))}y1.peek=sA;function y1(e,t,i,r){const a=Ip(i),c=a==='"'?"Quote":"Apostrophe",h=i.createTracker(r);if(v1(e,i)){const x=i.stack;i.stack=x.filter(function(N){return N!=="phrasing"});const w=i.enter("autolink");let j=h.move("<");return j+=h.move(i.containerPhrasing(e,{before:j,after:">",...h.current()})),j+=h.move(">"),w(),i.stack=x,j}const f=i.enter("link");let g=i.enter("label"),m=h.move("[");const v=i.containerPhrasing(e,{before:m,after:"](",...h.current()});m+=h.move(v),g(),m+=h.move("](");const _=/[\0- \u007F]/.test(e.url),S=r.before.charAt(r.before.length-1);let y=e.title||void 0;if(!y&&!_&&(S===`
41
+ `||S==="\r")){let x=0;for(;x<v.length&&v.charCodeAt(x)!==93;)x+=v.charCodeAt(x)===92?2:1;v.charCodeAt(x+1)===58&&(y="")}return!e.url&&typeof y=="string"||_?(g=i.enter("destinationLiteral"),m+=h.move("<"),m+=h.move(i.safe(e.url,{before:m,after:">",...h.current()})),m+=h.move(">")):(g=i.enter("destinationRaw"),m+=h.move(i.safe(e.url,{before:m,after:typeof y=="string"?" ":")",...h.current()}))),g(),typeof y=="string"&&(g=i.enter(`title${c}`),m+=h.move(" "+a),m+=h.move(i.safe(y,{before:m,after:a,...h.current()})),m+=h.move(a),g()),m+=h.move(")"),f(),m}function sA(e,t,i){return v1(e,i)?"<":"["}S1.peek=rA;function S1(e,t,i,r){const a=e.referenceType,c=i.enter("linkReference");let h=i.enter("label");const f=i.createTracker(r);let g=f.move("[");const m=i.containerPhrasing(e,{before:g,after:"]",...f.current()});g+=f.move(m+"]["),h();const v=i.stack;i.stack=v.filter(function(S){return S!=="phrasing"}),h=i.enter("reference");const _=i.safe(i.associationId(e),{before:g,after:"]",...f.current()});return h(),i.stack=v,c(),a==="full"||!m||m!==_?g+=f.move(_+"]"):a==="shortcut"?g=g.slice(0,-1):g+=f.move("]"),g}function rA(){return"["}function Fp(e){const t=e.options.bullet||"*";if(t!=="*"&&t!=="+"&&t!=="-")throw new Error("Cannot serialize items with `"+t+"` for `options.bullet`, expected `*`, `+`, or `-`");return t}function lA(e){const t=Fp(e),i=e.options.bulletOther;if(!i)return t==="*"?"-":"*";if(i!=="*"&&i!=="+"&&i!=="-")throw new Error("Cannot serialize items with `"+i+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(i===t)throw new Error("Expected `bullet` (`"+t+"`) and `bulletOther` (`"+i+"`) to be different");return i}function aA(e){const t=e.options.bulletOrdered||".";if(t!=="."&&t!==")")throw new Error("Cannot serialize items with `"+t+"` for `options.bulletOrdered`, expected `.` or `)`");return t}function b1(e){const t=e.options.rule||"*";if(t!=="*"&&t!=="-"&&t!=="_")throw new Error("Cannot serialize rules with `"+t+"` for `options.rule`, expected `*`, `-`, or `_`");return t}function oA(e,t,i,r){const a=i.enter("list"),c=i.bulletCurrent;let h=e.ordered?aA(i):Fp(i);const f=e.ordered?h==="."?")":".":lA(i);let g=t&&i.bulletLastUsed?h===i.bulletLastUsed:!1;if(!e.ordered){const v=e.children?e.children[0]:void 0;if((h==="*"||h==="-")&&v&&(!v.children||!v.children[0])&&i.stack[i.stack.length-1]==="list"&&i.stack[i.stack.length-2]==="listItem"&&i.stack[i.stack.length-3]==="list"&&i.stack[i.stack.length-4]==="listItem"&&i.indexStack[i.indexStack.length-1]===0&&i.indexStack[i.indexStack.length-2]===0&&i.indexStack[i.indexStack.length-3]===0&&(g=!0),b1(i)===h&&v){let _=-1;for(;++_<e.children.length;){const S=e.children[_];if(S&&S.type==="listItem"&&S.children&&S.children[0]&&S.children[0].type==="thematicBreak"){g=!0;break}}}}g&&(h=f),i.bulletCurrent=h;const m=i.containerFlow(e,r);return i.bulletLastUsed=h,i.bulletCurrent=c,a(),m}function cA(e){const t=e.options.listItemIndent||"one";if(t!=="tab"&&t!=="one"&&t!=="mixed")throw new Error("Cannot serialize items with `"+t+"` for `options.listItemIndent`, expected `tab`, `one`, or `mixed`");return t}function uA(e,t,i,r){const a=cA(i);let c=i.bulletCurrent||Fp(i);t&&t.type==="list"&&t.ordered&&(c=(typeof t.start=="number"&&t.start>-1?t.start:1)+(i.options.incrementListMarker===!1?0:t.children.indexOf(e))+c);let h=c.length+1;(a==="tab"||a==="mixed"&&(t&&t.type==="list"&&t.spread||e.spread))&&(h=Math.ceil(h/4)*4);const f=i.createTracker(r);f.move(c+" ".repeat(h-c.length)),f.shift(h);const g=i.enter("listItem"),m=i.indentLines(i.containerFlow(e,f.current()),v);return g(),m;function v(_,S,y){return S?(y?"":" ".repeat(h))+_:(y?c:c+" ".repeat(h-c.length))+_}}function hA(e,t,i,r){const a=i.enter("paragraph"),c=i.enter("phrasing"),h=i.containerPhrasing(e,r);return c(),a(),h}function dA(e,t,i,r){if(!e.children.some(function(f){return RM(f)}))return i.containerFlow(e,r);const c=i.enter("phrasing"),h=i.containerPhrasing(e,r);return c(),h}function fA(e){const t=e.options.strong||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize strong with `"+t+"` for `options.strong`, expected `*`, or `_`");return t}$p.attention=x1;$p.peek=mA;function $p(e,t,i,r){const a=i.enter("phrasing"),c=Up(e,x1,i,i.createTracker(r)),h=Pu([c],r.before,r.after);return a(),h}function x1(e,t){return{construct:"strong",markers:fA(t)==="*"?["*","_"]:["_","*"],sizes:[2]}}function mA(e,t,i){return i.options.strong||"*"}function pA(e,t,i,r){const a=t?t.children:[],c=i.indexStack[i.indexStack.length-1];return i.safe(e.value,{...r,afterNode:a[c+1],beforeNode:a[c-1]})}function gA(e){const t=e.options.ruleRepetition||3;if(t<3)throw new Error("Cannot serialize rules with repetition `"+t+"` for `options.ruleRepetition`, expected `3` or more");return t}function _A(e,t,i){const r=(b1(i)+(i.options.ruleSpaces?" ":"")).repeat(gA(i));return i.options.ruleSpaces?r.slice(0,-1):r}const w1={blockquote:OM,break:IS,code:UM,definition:qM,emphasis:qp,hardBreak:IS,heading:JM,html:m1,image:p1,imageReference:g1,inlineCode:_1,link:y1,linkReference:S1,list:oA,listItem:uA,paragraph:hA,root:dA,strong:$p,text:pA,thematicBreak:_A};function vA(){return{enter:{table:yA,tableData:PS,tableHeader:PS,tableRow:bA},exit:{codeText:xA,table:SA,tableData:$f,tableHeader:$f,tableRow:$f}}}function yA(e){const t=e._align;this.enter({type:"table",align:t.map(function(i){return i==="none"?null:i}),children:[]},e),this.data.inTable=!0}function SA(e){this.exit(e),this.data.inTable=void 0}function bA(e){this.enter({type:"tableRow",children:[]},e)}function $f(e){this.exit(e)}function PS(e){this.enter({type:"tableCell",children:[]},e)}function xA(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,wA));const i=this.stack[this.stack.length-1];i.type,i.value=t,this.exit(e)}function wA(e,t){return t==="|"?t:e}function CA(e){const t=e||{},i=t.tableCellPadding,r=t.tablePipeAlign,a=t.stringLength,c=i?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:`
42
+ `,inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[ :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:S,table:h,tableCell:g,tableRow:f}};function h(y,x,w,j){return m(v(y,w,j),y.align)}function f(y,x,w,j){const N=_(y,w,j),M=m([N]);return M.slice(0,M.indexOf(`
43
+ `))}function g(y,x,w,j){const N=w.enter("tableCell"),M=w.enter("phrasing"),A=w.containerPhrasing(y,{...j,before:c,after:c});return M(),N(),A}function m(y,x){return MM(y,{align:x,alignDelimiters:r,padding:i,stringLength:a})}function v(y,x,w){const j=y.children;let N=-1;const M=[],A=x.enter("table");for(;++N<j.length;)M[N]=_(j[N],x,w);return A(),M}function _(y,x,w){const j=y.children;let N=-1;const M=[],A=x.enter("tableRow");for(;++N<j.length;)M[N]=g(j[N],y,x,w);return A(),M}function S(y,x,w){let j=w1.inlineCode(y,x,w);return w.stack.includes("tableCell")&&(j=j.replace(/\|/g,"\\$&")),j}}function kA(){return{exit:{taskListCheckValueChecked:qS,taskListCheckValueUnchecked:qS,paragraph:EA}}}function NA(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:jA}}}function qS(e){const t=this.stack[this.stack.length-2];t.type,t.checked=e.type==="taskListCheckValueChecked"}function EA(e){const t=this.stack[this.stack.length-2];if(t&&t.type==="listItem"&&typeof t.checked=="boolean"){const i=this.stack[this.stack.length-1];i.type;const r=i.children[0];if(r&&r.type==="text"){const a=t.children;let c=-1,h;for(;++c<a.length;){const f=a[c];if(f.type==="paragraph"){h=f;break}}h===i&&(r.value=r.value.slice(1),r.value.length===0?i.children.shift():i.position&&r.position&&typeof r.position.start.offset=="number"&&(r.position.start.column++,r.position.start.offset++,i.position.start=Object.assign({},r.position.start)))}}this.exit(e)}function jA(e,t,i,r){const a=e.children[0],c=typeof e.checked=="boolean"&&a&&a.type==="paragraph",h="["+(e.checked?"x":" ")+"] ",f=i.createTracker(r);c&&f.move(h);let g=w1.listItem(e,t,i,{...r,...f.current()});return c&&(g=g.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,m)),g;function m(v){return v+h}}function TA(){return[J3(),SM(),CM(),vA(),kA()]}function DA(e){return{extensions:[eM(),bM(e),kM(),CA(e),NA()]}}const MA={tokenize:zA,partial:!0},C1={tokenize:HA,partial:!0},k1={tokenize:IA,partial:!0},N1={tokenize:UA,partial:!0},AA={tokenize:PA,partial:!0},E1={name:"wwwAutolink",tokenize:BA,previous:T1},j1={name:"protocolAutolink",tokenize:LA,previous:D1},ds={name:"emailAutolink",tokenize:OA,previous:M1},Yi={};function RA(){return{text:Yi}}let Sr=48;for(;Sr<123;)Yi[Sr]=ds,Sr++,Sr===58?Sr=65:Sr===91&&(Sr=97);Yi[43]=ds;Yi[45]=ds;Yi[46]=ds;Yi[95]=ds;Yi[72]=[ds,j1];Yi[104]=[ds,j1];Yi[87]=[ds,E1];Yi[119]=[ds,E1];function OA(e,t,i){const r=this;let a,c;return h;function h(_){return!Am(_)||!M1.call(r,r.previous)||Vp(r.events)?i(_):(e.enter("literalAutolink"),e.enter("literalAutolinkEmail"),f(_))}function f(_){return Am(_)?(e.consume(_),f):_===64?(e.consume(_),g):i(_)}function g(_){return _===46?e.check(AA,v,m)(_):_===45||_===95||xn(_)?(c=!0,e.consume(_),g):v(_)}function m(_){return e.consume(_),a=!0,g}function v(_){return c&&a&&Sn(r.previous)?(e.exit("literalAutolinkEmail"),e.exit("literalAutolink"),t(_)):i(_)}}function BA(e,t,i){const r=this;return a;function a(h){return h!==87&&h!==119||!T1.call(r,r.previous)||Vp(r.events)?i(h):(e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check(MA,e.attempt(C1,e.attempt(k1,c),i),i)(h))}function c(h){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),t(h)}}function LA(e,t,i){const r=this;let a="",c=!1;return h;function h(_){return(_===72||_===104)&&D1.call(r,r.previous)&&!Vp(r.events)?(e.enter("literalAutolink"),e.enter("literalAutolinkHttp"),a+=String.fromCodePoint(_),e.consume(_),f):i(_)}function f(_){if(Sn(_)&&a.length<5)return a+=String.fromCodePoint(_),e.consume(_),f;if(_===58){const S=a.toLowerCase();if(S==="http"||S==="https")return e.consume(_),g}return i(_)}function g(_){return _===47?(e.consume(_),c?m:(c=!0,g)):i(_)}function m(_){return _===null||wu(_)||kt(_)||Ar(_)||Lu(_)?i(_):e.attempt(C1,e.attempt(k1,v),i)(_)}function v(_){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),t(_)}}function zA(e,t,i){let r=0;return a;function a(h){return(h===87||h===119)&&r<3?(r++,e.consume(h),a):h===46&&r===3?(e.consume(h),c):i(h)}function c(h){return h===null?i(h):t(h)}}function HA(e,t,i){let r,a,c;return h;function h(m){return m===46||m===95?e.check(N1,g,f)(m):m===null||kt(m)||Ar(m)||m!==45&&Lu(m)?g(m):(c=!0,e.consume(m),h)}function f(m){return m===95?r=!0:(a=r,r=void 0),e.consume(m),h}function g(m){return a||r||!c?i(m):t(m)}}function IA(e,t){let i=0,r=0;return a;function a(h){return h===40?(i++,e.consume(h),a):h===41&&r<i?c(h):h===33||h===34||h===38||h===39||h===41||h===42||h===44||h===46||h===58||h===59||h===60||h===63||h===93||h===95||h===126?e.check(N1,t,c)(h):h===null||kt(h)||Ar(h)?t(h):(e.consume(h),a)}function c(h){return h===41&&r++,e.consume(h),a}}function UA(e,t,i){return r;function r(f){return f===33||f===34||f===39||f===41||f===42||f===44||f===46||f===58||f===59||f===63||f===95||f===126?(e.consume(f),r):f===38?(e.consume(f),c):f===93?(e.consume(f),a):f===60||f===null||kt(f)||Ar(f)?t(f):i(f)}function a(f){return f===null||f===40||f===91||kt(f)||Ar(f)?t(f):r(f)}function c(f){return Sn(f)?h(f):i(f)}function h(f){return f===59?(e.consume(f),r):Sn(f)?(e.consume(f),h):i(f)}}function PA(e,t,i){return r;function r(c){return e.consume(c),a}function a(c){return xn(c)?i(c):t(c)}}function T1(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||kt(e)}function D1(e){return!Sn(e)}function M1(e){return!(e===47||Am(e))}function Am(e){return e===43||e===45||e===46||e===95||xn(e)}function Vp(e){let t=e.length,i=!1;for(;t--;){const r=e[t][1];if((r.type==="labelLink"||r.type==="labelImage")&&!r._balanced){i=!0;break}if(r._gfmAutolinkLiteralWalkedInto){i=!1;break}}return e.length>0&&!i&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),i}const qA={tokenize:GA,partial:!0};function FA(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:YA,continuation:{tokenize:WA},exit:XA}},text:{91:{name:"gfmFootnoteCall",tokenize:KA},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:$A,resolveTo:VA}}}}function $A(e,t,i){const r=this;let a=r.events.length;const c=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let h;for(;a--;){const g=r.events[a][1];if(g.type==="labelImage"){h=g;break}if(g.type==="gfmFootnoteCall"||g.type==="labelLink"||g.type==="label"||g.type==="image"||g.type==="link")break}return f;function f(g){if(!h||!h._balanced)return i(g);const m=ki(r.sliceSerialize({start:h.end,end:r.now()}));return m.codePointAt(0)!==94||!c.includes(m.slice(1))?i(g):(e.enter("gfmFootnoteCallLabelMarker"),e.consume(g),e.exit("gfmFootnoteCallLabelMarker"),t(g))}}function VA(e,t){let i=e.length;for(;i--;)if(e[i][1].type==="labelImage"&&e[i][0]==="enter"){e[i][1];break}e[i+1][1].type="data",e[i+3][1].type="gfmFootnoteCallLabelMarker";const r={type:"gfmFootnoteCall",start:Object.assign({},e[i+3][1].start),end:Object.assign({},e[e.length-1][1].end)},a={type:"gfmFootnoteCallMarker",start:Object.assign({},e[i+3][1].end),end:Object.assign({},e[i+3][1].end)};a.end.column++,a.end.offset++,a.end._bufferIndex++;const c={type:"gfmFootnoteCallString",start:Object.assign({},a.end),end:Object.assign({},e[e.length-1][1].start)},h={type:"chunkString",contentType:"string",start:Object.assign({},c.start),end:Object.assign({},c.end)},f=[e[i+1],e[i+2],["enter",r,t],e[i+3],e[i+4],["enter",a,t],["exit",a,t],["enter",c,t],["enter",h,t],["exit",h,t],["exit",c,t],e[e.length-2],e[e.length-1],["exit",r,t]];return e.splice(i,e.length-i+1,...f),e}function KA(e,t,i){const r=this,a=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let c=0,h;return f;function f(_){return e.enter("gfmFootnoteCall"),e.enter("gfmFootnoteCallLabelMarker"),e.consume(_),e.exit("gfmFootnoteCallLabelMarker"),g}function g(_){return _!==94?i(_):(e.enter("gfmFootnoteCallMarker"),e.consume(_),e.exit("gfmFootnoteCallMarker"),e.enter("gfmFootnoteCallString"),e.enter("chunkString").contentType="string",m)}function m(_){if(c>999||_===93&&!h||_===null||_===91||kt(_))return i(_);if(_===93){e.exit("chunkString");const S=e.exit("gfmFootnoteCallString");return a.includes(ki(r.sliceSerialize(S)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(_),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),t):i(_)}return kt(_)||(h=!0),c++,e.consume(_),_===92?v:m}function v(_){return _===91||_===92||_===93?(e.consume(_),c++,m):m(_)}}function YA(e,t,i){const r=this,a=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let c,h=0,f;return g;function g(x){return e.enter("gfmFootnoteDefinition")._container=!0,e.enter("gfmFootnoteDefinitionLabel"),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(x),e.exit("gfmFootnoteDefinitionLabelMarker"),m}function m(x){return x===94?(e.enter("gfmFootnoteDefinitionMarker"),e.consume(x),e.exit("gfmFootnoteDefinitionMarker"),e.enter("gfmFootnoteDefinitionLabelString"),e.enter("chunkString").contentType="string",v):i(x)}function v(x){if(h>999||x===93&&!f||x===null||x===91||kt(x))return i(x);if(x===93){e.exit("chunkString");const w=e.exit("gfmFootnoteDefinitionLabelString");return c=ki(r.sliceSerialize(w)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(x),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),S}return kt(x)||(f=!0),h++,e.consume(x),x===92?_:v}function _(x){return x===91||x===92||x===93?(e.consume(x),h++,v):v(x)}function S(x){return x===58?(e.enter("definitionMarker"),e.consume(x),e.exit("definitionMarker"),a.includes(c)||a.push(c),ft(e,y,"gfmFootnoteDefinitionWhitespace")):i(x)}function y(x){return t(x)}}function WA(e,t,i){return e.check(go,t,e.attempt(qA,t,i))}function XA(e){e.exit("gfmFootnoteDefinition")}function GA(e,t,i){const r=this;return ft(e,a,"gfmFootnoteDefinitionIndent",5);function a(c){const h=r.events[r.events.length-1];return h&&h[1].type==="gfmFootnoteDefinitionIndent"&&h[2].sliceSerialize(h[1],!0).length===4?t(c):i(c)}}function QA(e){let i=(e||{}).singleTilde;const r={name:"strikethrough",tokenize:c,resolveAll:a};return i==null&&(i=!0),{text:{126:r},insideSpan:{null:[r]},attentionMarkers:{null:[126]}};function a(h,f){let g=-1;for(;++g<h.length;)if(h[g][0]==="enter"&&h[g][1].type==="strikethroughSequenceTemporary"&&h[g][1]._close){let m=g;for(;m--;)if(h[m][0]==="exit"&&h[m][1].type==="strikethroughSequenceTemporary"&&h[m][1]._open&&h[g][1].end.offset-h[g][1].start.offset===h[m][1].end.offset-h[m][1].start.offset){h[g][1].type="strikethroughSequence",h[m][1].type="strikethroughSequence";const v={type:"strikethrough",start:Object.assign({},h[m][1].start),end:Object.assign({},h[g][1].end)},_={type:"strikethroughText",start:Object.assign({},h[m][1].end),end:Object.assign({},h[g][1].start)},S=[["enter",v,f],["enter",h[m][1],f],["exit",h[m][1],f],["enter",_,f]],y=f.parser.constructs.insideSpan.null;y&&Ci(S,S.length,0,zu(y,h.slice(m+1,g),f)),Ci(S,S.length,0,[["exit",_,f],["enter",h[g][1],f],["exit",h[g][1],f],["exit",v,f]]),Ci(h,m-1,g-m+3,S),g=m+S.length-2;break}}for(g=-1;++g<h.length;)h[g][1].type==="strikethroughSequenceTemporary"&&(h[g][1].type="data");return h}function c(h,f,g){const m=this.previous,v=this.events;let _=0;return S;function S(x){return m===126&&v[v.length-1][1].type!=="characterEscape"?g(x):(h.enter("strikethroughSequenceTemporary"),y(x))}function y(x){const w=Ws(m);if(x===126)return _>1?g(x):(h.consume(x),_++,y);if(_<2&&!i)return g(x);const j=h.exit("strikethroughSequenceTemporary"),N=Ws(x);return j._open=!N||N===2&&!!w,j._close=!w||w===2&&!!N,f(x)}}}class ZA{constructor(){this.map=[],this.index=new Map}add(t,i,r){JA(this,t,i,r)}consume(t){if(this.map.sort(function(c,h){return c[0]-h[0]}),this.map.length===0)return;let i=this.map.length;const r=[];for(;i>0;)i-=1,r.push(t.slice(this.map[i][0]+this.map[i][1]),this.map[i][2]),t.length=this.map[i][0];r.push(t.slice()),t.length=0;let a=r.pop();for(;a;){for(const c of a)t.push(c);a=r.pop()}this.map.length=0,this.index.clear()}}function JA(e,t,i,r){if(i===0&&r.length===0)return;const a=e.index.get(t);if(a){a[1]+=i,a[2].push(...r);return}const c=[t,i,r];e.map.push(c),e.index.set(t,c)}function eR(e,t){let i=!1;const r=[];for(;t<e.length;){const a=e[t];if(i){if(a[0]==="enter")a[1].type==="tableContent"&&r.push(e[t+1][1].type==="tableDelimiterMarker"?"left":"none");else if(a[1].type==="tableContent"){if(e[t-1][1].type==="tableDelimiterMarker"){const c=r.length-1;r[c]=r[c]==="left"?"center":"right"}}else if(a[1].type==="tableDelimiterRow")break}else a[0]==="enter"&&a[1].type==="tableDelimiterRow"&&(i=!0);t+=1}return r}function tR(){return{flow:{null:{name:"table",tokenize:nR,resolveAll:iR}}}}function nR(e,t,i){const r=this;let a=0,c=0,h;return f;function f(z){let G=r.events.length-1;for(;G>-1;){const{type:F}=r.events[G][1];if(F==="lineEnding"||F==="linePrefix")G--;else break}const P=G>-1?r.events[G][1].type:null,L=P==="tableHead"||P==="tableRow"?H:g;return L===H&&r.parser.lazy[r.now().line]?i(z):L(z)}function g(z){return e.enter("tableHead"),e.enter("tableRow"),m(z)}function m(z){return z===124||(h=!0,c+=1),v(z)}function v(z){return z===null?i(z):Pe(z)?c>1?(c=0,r.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(z),e.exit("lineEnding"),y):i(z):nt(z)?ft(e,v,"whitespace")(z):(c+=1,h&&(h=!1,a+=1),z===124?(e.enter("tableCellDivider"),e.consume(z),e.exit("tableCellDivider"),h=!0,v):(e.enter("data"),_(z)))}function _(z){return z===null||z===124||kt(z)?(e.exit("data"),v(z)):(e.consume(z),z===92?S:_)}function S(z){return z===92||z===124?(e.consume(z),_):_(z)}function y(z){return r.interrupt=!1,r.parser.lazy[r.now().line]?i(z):(e.enter("tableDelimiterRow"),h=!1,nt(z)?ft(e,x,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(z):x(z))}function x(z){return z===45||z===58?j(z):z===124?(h=!0,e.enter("tableCellDivider"),e.consume(z),e.exit("tableCellDivider"),w):I(z)}function w(z){return nt(z)?ft(e,j,"whitespace")(z):j(z)}function j(z){return z===58?(c+=1,h=!0,e.enter("tableDelimiterMarker"),e.consume(z),e.exit("tableDelimiterMarker"),N):z===45?(c+=1,N(z)):z===null||Pe(z)?R(z):I(z)}function N(z){return z===45?(e.enter("tableDelimiterFiller"),M(z)):I(z)}function M(z){return z===45?(e.consume(z),M):z===58?(h=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(z),e.exit("tableDelimiterMarker"),A):(e.exit("tableDelimiterFiller"),A(z))}function A(z){return nt(z)?ft(e,R,"whitespace")(z):R(z)}function R(z){return z===124?x(z):z===null||Pe(z)?!h||a!==c?I(z):(e.exit("tableDelimiterRow"),e.exit("tableHead"),t(z)):I(z)}function I(z){return i(z)}function H(z){return e.enter("tableRow"),O(z)}function O(z){return z===124?(e.enter("tableCellDivider"),e.consume(z),e.exit("tableCellDivider"),O):z===null||Pe(z)?(e.exit("tableRow"),t(z)):nt(z)?ft(e,O,"whitespace")(z):(e.enter("data"),$(z))}function $(z){return z===null||z===124||kt(z)?(e.exit("data"),O(z)):(e.consume(z),z===92?Q:$)}function Q(z){return z===92||z===124?(e.consume(z),$):$(z)}}function iR(e,t){let i=-1,r=!0,a=0,c=[0,0,0,0],h=[0,0,0,0],f=!1,g=0,m,v,_;const S=new ZA;for(;++i<e.length;){const y=e[i],x=y[1];y[0]==="enter"?x.type==="tableHead"?(f=!1,g!==0&&(FS(S,t,g,m,v),v=void 0,g=0),m={type:"table",start:Object.assign({},x.start),end:Object.assign({},x.end)},S.add(i,0,[["enter",m,t]])):x.type==="tableRow"||x.type==="tableDelimiterRow"?(r=!0,_=void 0,c=[0,0,0,0],h=[0,i+1,0,0],f&&(f=!1,v={type:"tableBody",start:Object.assign({},x.start),end:Object.assign({},x.end)},S.add(i,0,[["enter",v,t]])),a=x.type==="tableDelimiterRow"?2:v?3:1):a&&(x.type==="data"||x.type==="tableDelimiterMarker"||x.type==="tableDelimiterFiller")?(r=!1,h[2]===0&&(c[1]!==0&&(h[0]=h[1],_=Jc(S,t,c,a,void 0,_),c=[0,0,0,0]),h[2]=i)):x.type==="tableCellDivider"&&(r?r=!1:(c[1]!==0&&(h[0]=h[1],_=Jc(S,t,c,a,void 0,_)),c=h,h=[c[1],i,0,0])):x.type==="tableHead"?(f=!0,g=i):x.type==="tableRow"||x.type==="tableDelimiterRow"?(g=i,c[1]!==0?(h[0]=h[1],_=Jc(S,t,c,a,i,_)):h[1]!==0&&(_=Jc(S,t,h,a,i,_)),a=0):a&&(x.type==="data"||x.type==="tableDelimiterMarker"||x.type==="tableDelimiterFiller")&&(h[3]=i)}for(g!==0&&FS(S,t,g,m,v),S.consume(t.events),i=-1;++i<t.events.length;){const y=t.events[i];y[0]==="enter"&&y[1].type==="table"&&(y[1]._align=eR(t.events,i))}return e}function Jc(e,t,i,r,a,c){const h=r===1?"tableHeader":r===2?"tableDelimiter":"tableData",f="tableContent";i[0]!==0&&(c.end=Object.assign({},Bl(t.events,i[0])),e.add(i[0],0,[["exit",c,t]]));const g=Bl(t.events,i[1]);if(c={type:h,start:Object.assign({},g),end:Object.assign({},g)},e.add(i[1],0,[["enter",c,t]]),i[2]!==0){const m=Bl(t.events,i[2]),v=Bl(t.events,i[3]),_={type:f,start:Object.assign({},m),end:Object.assign({},v)};if(e.add(i[2],0,[["enter",_,t]]),r!==2){const S=t.events[i[2]],y=t.events[i[3]];if(S[1].end=Object.assign({},y[1].end),S[1].type="chunkText",S[1].contentType="text",i[3]>i[2]+1){const x=i[2]+1,w=i[3]-i[2]-1;e.add(x,w,[])}}e.add(i[3]+1,0,[["exit",_,t]])}return a!==void 0&&(c.end=Object.assign({},Bl(t.events,a)),e.add(a,0,[["exit",c,t]]),c=void 0),c}function FS(e,t,i,r,a){const c=[],h=Bl(t.events,i);a&&(a.end=Object.assign({},h),c.push(["exit",a,t])),r.end=Object.assign({},h),c.push(["exit",r,t]),e.add(i+1,0,c)}function Bl(e,t){const i=e[t],r=i[0]==="enter"?"start":"end";return i[1][r]}const sR={name:"tasklistCheck",tokenize:lR};function rR(){return{text:{91:sR}}}function lR(e,t,i){const r=this;return a;function a(g){return r.previous!==null||!r._gfmTasklistFirstContentOfListItem?i(g):(e.enter("taskListCheck"),e.enter("taskListCheckMarker"),e.consume(g),e.exit("taskListCheckMarker"),c)}function c(g){return kt(g)?(e.enter("taskListCheckValueUnchecked"),e.consume(g),e.exit("taskListCheckValueUnchecked"),h):g===88||g===120?(e.enter("taskListCheckValueChecked"),e.consume(g),e.exit("taskListCheckValueChecked"),h):i(g)}function h(g){return g===93?(e.enter("taskListCheckMarker"),e.consume(g),e.exit("taskListCheckMarker"),e.exit("taskListCheck"),f):i(g)}function f(g){return Pe(g)?t(g):nt(g)?e.check({tokenize:aR},t,i)(g):i(g)}}function aR(e,t,i){return ft(e,r,"whitespace");function r(a){return a===null?i(a):t(a)}}function oR(e){return Hx([RA(),FA(),QA(e),tR(),rR()])}const cR={};function uR(e){const t=this,i=e||cR,r=t.data(),a=r.micromarkExtensions||(r.micromarkExtensions=[]),c=r.fromMarkdownExtensions||(r.fromMarkdownExtensions=[]),h=r.toMarkdownExtensions||(r.toMarkdownExtensions=[]);a.push(oR(i)),c.push(TA()),h.push(DA(i))}function Kp(e){return e.trim()===""?null:u.jsx("div",{className:"md",children:u.jsx(F3,{remarkPlugins:[uR],components:{a:({href:t,children:i})=>{const r=typeof t=="string"&&/^(https?:|mailto:)/i.test(t)?t:void 0;return r===void 0?u.jsx("span",{children:i}):u.jsxs("a",{href:r,target:"_blank",rel:"noreferrer noopener",className:"md-link",children:[u.jsx("span",{className:"md-link-icon","aria-hidden":"true",children:"🌐"}),i]})},pre:({children:t})=>u.jsx("pre",{className:"md-pre",children:t}),table:({children:t})=>u.jsx("div",{className:"md-table-wrap",children:u.jsx("table",{children:t})}),input:({checked:t})=>u.jsx("input",{type:"checkbox",checked:t===!0,readOnly:!0,className:"md-task"})},children:e})})}function hR(e){return Object.entries(e??{}).map(([t,i])=>({key:t,value:i}))}function dR(e){const t={};for(const i of e){const r=i.key.trim();r!==""&&(t[r]=i.value.trim())}return t}function fR(e){const t=e.at(-1);return t===void 0?null:t.seq}function $S(e,t){return t===null?!1:e===null?!0:e.has(t)}function mR(e){const t=[];for(const i of e){if(i.role==="user"){t.push({kind:"user",turn:i});continue}const r=t.at(-1);if(r!==void 0&&r.kind==="assistant"){t[t.length-1]={kind:"assistant",parts:[...r.parts,i]};continue}t.push({kind:"assistant",parts:[i]})}return t}function pR(e,t){return t===void 0?!e:t.kind==="user"}function gR(e){const t=e!==null&&typeof e=="object"?e:{};let i=null;for(const a of["path","file_path","notebook_path","filePath"]){const c=t[a];if(typeof c=="string"&&c!==""){i=c;break}}if(i===null)return null;let r=0;for(const a of["line","start_line","startLine","offset"]){const c=t[a];if(typeof c=="number"&&Number.isFinite(c)&&c>0){r=Math.floor(c);break}}return{path:i,line:r}}function _R(e,t){const i=String(t??""),r=String(e??"");return i===""||!r.startsWith(i)?r:r.slice(i.length).replace(/^[/\\]+/,"")}function vR(e,t){if(!Number.isFinite(e)||e<=1)return 1;const i=Number.isFinite(t)&&t>0?Math.floor(t):1;return Math.max(1,Math.floor(e)-Math.floor(i/4))}function yR(e){return`已编辑 ${String(e)} 个文件`}function SR(e,t){const i=[];return e>0&&i.push(`+${String(e)}`),t>0&&i.push(`−${String(t)}`),i.join(" ")}function Tl(e,t){return{add:e>0?`+${String(e)}`:"",del:t>0?`−${String(t)}`:""}}function bR(e){return e==="A"?"新增":e==="D"?"删除":"修改"}function xR(e){return e.binary===!0?"二进制":SR(e.added,e.removed)}function wR(e){return`撤销本轮对 ${String(e)} 个文件的改动,回到本轮开始前的快照。之后若这些文件又被改过,也会退回那个快照的内容;对话记录不受影响。`}function CR(e){return`另有 ${String(e)} 个写入被拒绝(权限 / Guardian),未计入上面的增删`}function kR(e){return`已撤销本轮 ${String(e)} 个文件的改动`}function NR(e){const t=e.lastIndexOf("/");return t<0?{名:e,目录:""}:{名:e.slice(t+1),目录:e.slice(0,t+1)}}function ER({data:e,session:t,onViewChanges:i,onUndone:r}){const[a,c]=C.useState(!0),[h,f]=C.useState(!1),[g,m]=C.useState(!1),[v,_]=C.useState(!1),[S,y]=C.useState(null),x=e.files.length,w=async()=>{m(!0),y(null);try{await m2(t,e.key),_(!0),f(!1),r()}catch(j){y(j instanceof Error?j.message:String(j))}finally{m(!1)}};return u.jsxs("div",{className:v?"edit-card undone":a?"edit-card open":"edit-card",children:[u.jsxs("div",{className:"edit-head",children:[u.jsxs("button",{type:"button",className:"edit-toggle","aria-expanded":a,onClick:()=>{c(j=>!j)},children:[u.jsx("span",{className:"edit-icon","aria-hidden":"true",children:"▣"}),u.jsx("span",{className:"edit-title",children:v?kR(x):yR(x)}),v?null:u.jsxs("span",{className:"edit-stat",children:[u.jsx("span",{className:"add",children:Tl(e.added,e.removed).add})," ",u.jsx("span",{className:"del",children:Tl(e.added,e.removed).del})]})]}),u.jsxs("span",{className:"edit-actions",children:[!v&&e.undoable&&!h?u.jsx("button",{type:"button",className:"ghost",onClick:()=>{f(!0)},children:"撤销"}):null,i===void 0||v?null:u.jsx("button",{type:"button",className:"ghost",onClick:i,children:"查看变更 ↗"}),u.jsx("span",{className:"edit-caret","aria-hidden":"true",children:"▾"})]})]}),h&&!v?u.jsxs("div",{className:"undo-bar",children:[u.jsx("span",{className:"undo-warn","aria-hidden":"true",children:"⚠"}),u.jsx("span",{className:"grow",children:wR(x)}),u.jsx("button",{type:"button",className:"btn",onClick:()=>{f(!1)},children:"取消"}),u.jsx("button",{type:"button",className:"btn danger",disabled:g,onClick:()=>{w()},children:g?"撤销中…":"确认撤销"})]}):null,S===null?null:u.jsx("div",{className:"edit-error",children:S}),a?u.jsxs(u.Fragment,{children:[u.jsx("div",{className:"edit-files",children:e.files.map(j=>{const{名:N,目录:M}=NR(j.path);return u.jsxs("div",{className:"edit-row",children:[u.jsx("span",{className:v?"edit-name done":"edit-name",children:v?`${bR(j.status)} · ${N}`:N}),u.jsx("span",{className:"edit-dir",children:M}),u.jsx("span",{className:"edit-fstat",children:v?"已回到快照":j.binary===!0?xR(j):u.jsxs(u.Fragment,{children:[Tl(j.added,j.removed).add===""?null:u.jsx("span",{className:"add",children:Tl(j.added,j.removed).add}),Tl(j.added,j.removed).del===""?null:u.jsx("span",{className:"del",children:Tl(j.added,j.removed).del})]})})]},j.path)})}),u.jsxs("div",{className:"edit-foot",children:[e.denied>0?u.jsxs("span",{children:[CR(e.denied),"。 "]}):null,v?"对话与工具行不动;工作区已回到本轮开始前的快照。":"点「查看变更」→ 右栏「变更」页签,看每个文件的真 diff。"]})]}):null]})}function jR({等确认:e,静默秒:t}){const i=C.useRef(Date.now()),[r,a]=C.useState(()=>Date.now());C.useEffect(()=>{const h=setInterval(()=>{a(Date.now())},1e3);return()=>{clearInterval(h)}},[]);const c=Math.max(0,Math.round((r-i.current)/1e3));return u.jsxs("div",{className:"working","aria-live":"polite",children:[u.jsx("span",{className:"work-mark g","aria-hidden":"true",children:"✦"}),u.jsxs("span",{className:"work-dots","aria-hidden":"true",children:[u.jsx("i",{}),u.jsx("i",{}),u.jsx("i",{})]}),e>0?u.jsxs("span",{children:["等待你确认(",e," 条待回答)· 已 ",c," 秒"]}):t>=15?u.jsxs("span",{children:["已 ",t," 秒无新输出(仍在跑,可停止)· 已 ",c," 秒"]}):u.jsxs("span",{children:["思考中,用时 ",c," 秒…"]})]})}const TR=e=>/^(?:\[图片 #\d+\]\s*)+$/u.test(e.trim()),DR=e=>e<1e3?"不到 1 秒":e<6e4?`${String(Math.round(e/1e3))} 秒`:`${String(Math.floor(e/6e4))} 分 ${String(Math.round(e%6e4/1e3))} 秒`,MR=e=>{if(typeof e=="string")return e;if(typeof e=="object"&&e!==null){const t=e;if(typeof t.output=="string")return t.output;if(typeof t.error=="string")return t.error;if(typeof t.content=="string")return t.content;const i=JSON.stringify(e);return i===void 0?"":i}return e===void 0?"":String(e)},Vf=e=>{const t=typeof e.input=="object"&&e.input!==null?e.input:{};for(const i of["command","path","pattern","url","query","file_path"]){const r=t[i];if(typeof r=="string"&&r!=="")return r}return e.toolName},AR=e=>({bash:"运行",run_command:"运行",shell:"运行",read:"读取",read_file:"读取",write:"写入",write_file:"写入",edit:"编辑",str_replace:"编辑",grep:"搜索",search:"搜索",glob:"查找",list:"列目录",ls:"列目录",task:"子任务",subagent:"子任务",todo:"计划",web_fetch:"抓取",web_search:"搜索"})[e]??e,RR=e=>["bash","run_command","shell"].includes(e);function OR({call:e,onOpenFile:t}){const i=MR(e.output),r=gR(e.input),a=e.state!=="running"&&RR(e.toolName)&&i.trim()!=="",[c,h]=C.useState(()=>e.state==="error");C.useEffect(()=>{e.state==="error"&&h(!0)},[e.state]);const f=u.jsxs(u.Fragment,{children:[u.jsx("span",{className:e.state==="running"?"ic g g-run":e.state==="error"?"ic g g-err":"ic g g-ok",children:e.state==="running"?"◌":e.state==="error"?"✕":"✓"}),u.jsx("span",{className:"name",children:AR(e.toolName)}),u.jsx("span",{className:"target",title:Vf(e),children:Vf(e)}),r===null||a?null:u.jsx("span",{className:"tool-inspect",role:"button",tabIndex:0,title:`打开 ${r.path}${r.line>0?`:${String(r.line)}`:""}`,onMouseDown:g=>{g.preventDefault()},onClick:g=>{g.stopPropagation(),t?.(r.path,r.line)},onKeyDown:g=>{g.key!=="Enter"&&g.key!==" "||(g.preventDefault(),g.stopPropagation(),t?.(r.path,r.line))},children:"看文件"}),a?u.jsx("span",{className:"out-hint",children:c?"收起输出":"展开输出"}):null,u.jsx("span",{className:e.state==="running"?"state":"state ok",children:e.state==="running"?"进行中":e.state==="error"?"失败":"完成"})]});return u.jsxs(u.Fragment,{children:[a?u.jsx("button",{type:"button",className:"tool-row clickable","aria-expanded":c,onClick:()=>{h(g=>!g)},children:f}):u.jsx("div",{className:"tool-row",children:f}),a&&c?u.jsxs("div",{className:"terminal",children:[u.jsxs("div",{className:"bar",children:[u.jsx("span",{className:"dot"}),u.jsxs("span",{className:"t",children:["$ ",Vf(e)]})]}),u.jsx("pre",{className:"out",children:i.length>1200?`${i.slice(0,1200)}
44
+ …(已截断)`:i})]}):null]})}function BR({text:e}){const[t,i]=C.useState(!1);return u.jsxs(u.Fragment,{children:[u.jsxs("button",{className:"disclosure","aria-expanded":t,onClick:()=>{i(r=>!r)},children:[u.jsx("span",{className:"g g-accent",children:"✻"}),u.jsx("span",{children:"思考"}),u.jsx("span",{className:"chev",children:"▾"})]}),u.jsx("div",{className:t?"disclosure-body open":"disclosure-body",children:u.jsx("p",{children:e})})]})}function LR({parts:e,model:t,durationMs:i,收尾:r,改动:a,session:c,onViewChanges:h,onOpenFile:f,分叉:g,onFork:m,forkError:v}){const _=e[0],[S,y]=C.useState(null),x=async()=>{const w=e.map(j=>j.text).join("");y(await jE(w)?"ok":"err"),window.setTimeout(()=>{y(null)},2e3)};return u.jsx("div",{className:"turn","data-dsh-part":"message-row","data-seq":_?.seq,"data-seq-list":e.map(w=>String(w.seq)).join(" "),children:u.jsxs("div",{className:"ai",children:[u.jsx("div",{className:"ai-avatar g",children:"●"}),u.jsxs("div",{className:"ai-body","data-dsh-part":"message-body",children:[u.jsxs("div",{className:"ai-head",children:[u.jsx("span",{className:"ai-name",children:"大罗"}),t===void 0?null:u.jsx("span",{className:"ai-model",children:t}),_?.ts===void 0?null:u.jsx("span",{className:"ai-time",children:new Date(_.ts).toLocaleTimeString("zh-CN",{hour:"2-digit",minute:"2-digit"})})]}),r&&i!==void 0?u.jsxs("div",{className:"turn-done",children:[u.jsx("span",{className:"g g-dim","aria-hidden":"true",children:"✓"}),"已完成,用时 ",DR(i)]}):null,e.map((w,j)=>{const N=w.reasoning.trim();return u.jsxs("div",{className:"assistant-part",children:[N===""?null:u.jsx(BR,{text:N}),w.text.trim()===""?null:Kp(w.text),w.toolCalls.map(M=>u.jsx(OR,{call:M,onOpenFile:f},M.toolCallId))]},`${String(w.seq)}-${String(j)}`)}),r===!0&&a!==void 0&&c!==void 0&&c!==""?u.jsx(ER,{data:a,session:c,onViewChanges:h,onUndone:()=>{}}):null,u.jsxs("div",{className:"ai-actions",children:[u.jsx("button",{className:"msg-tool icon-only",title:"复制回答(markdown 原文)","aria-label":"复制回答",onClick:()=>{x()},children:u.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[u.jsx("rect",{x:"9",y:"9",width:"12",height:"12",rx:"2.5"}),u.jsx("path",{d:"M5 15V5.5A2.5 2.5 0 0 1 7.5 3H17"})]})}),g==null||m===void 0?null:u.jsxs("button",{className:"msg-tool fork",title:"新会话保留到这条回答为止,源会话只读",onClick:()=>{m(g)},children:[u.jsx("span",{className:"g",children:"⑂"})," 从这条回答分叉"]}),S===null?null:u.jsx("span",{className:S==="ok"?"copy-hint ok":"copy-hint err",children:S==="ok"?"已复制":"复制失败"})]}),v==null?null:u.jsx("div",{className:"msg-error",children:v})]})]})})}function A1({view:e,loading:t,error:i,liveText:r,liveDropped:a=0,visible:c,onLoadEarlier:h,onRetry:f,onBack:g,questions:m,expired:v,onAnswer:_,busy:S,onViewChanges:y,onOpenFile:x,onFork:w,onReanswer:j,focusSeq:N}){const M=C.useRef(Date.now());C.useEffect(()=>{M.current=Date.now()},[e,r,m.length]);const[A,R]=C.useState(()=>Date.now());C.useEffect(()=>{if(!S)return;const T=setInterval(()=>{R(Date.now())},1e3);return()=>{clearInterval(T)}},[S]);const I=Math.max(0,Math.round((A-M.current)/1e3)),H=e?.session,[O,$]=C.useState(null),Q=C.useCallback(async()=>{if(H===void 0||H===""){$(null);return}try{const T=await f2(H);$(T.ok?T:null)}catch{$(null)}},[H]);C.useEffect(()=>{S||Q()},[Q,S]);const[z,G]=C.useState(null),[P,L]=C.useState(null),[F,K]=C.useState(null),[q,te]=C.useState(null);C.useEffect(()=>{if(H===void 0||H===""){G(null);return}if(S)return;let T=!0;return(async()=>{try{const E=await s2(H);if(!T)return;G(new Set(E.anchors))}catch{T&&G(null)}})(),()=>{T=!1}},[H,S]);const ne=async T=>{if(!(w===void 0||P!==null)){K(null),L(T.at);try{await w(T)}catch(E){K({seq:T.at,message:E instanceof Error?E.message:String(E)})}finally{L(null)}}};if(C.useEffect(()=>{if(N===void 0)return;const T=String(N),E=[...document.querySelectorAll("[data-seq]")].find(se=>se.getAttribute("data-seq")===T||(se.getAttribute("data-seq-list")??"").split(" ").includes(T));if(!(E instanceof HTMLElement))return;E.scrollIntoView({block:"center"}),E.classList.add("msg-flash");const J=window.setTimeout(()=>{E.classList.remove("msg-flash")},2200);return()=>{window.clearTimeout(J)}},[N,e,c]),t&&e===null)return u.jsxs("div",{className:"thread-skeleton","aria-label":"载入会话",children:[u.jsx("div",{className:"sk sk-user"}),u.jsx("div",{className:"sk sk-head"}),u.jsx("div",{className:"sk sk-line"}),u.jsx("div",{className:"sk sk-line"}),u.jsx("div",{className:"sk sk-line short"}),u.jsx("div",{className:"sk sk-head"}),u.jsx("div",{className:"sk sk-line"})]});if(i!==null)return u.jsxs("div",{className:"thread-error-page",children:[u.jsx("div",{className:"warn",children:"⚠"}),u.jsx("h2",{children:"会话读取失败"}),u.jsx("p",{children:"事件日志读不出来(可能是文件被删/权限变化/服务重连中)。这一页不会假装是空会话。"}),u.jsx("p",{className:"detail",children:i}),u.jsxs("div",{className:"actions",children:[u.jsx("button",{className:"btn",onClick:g,children:"返回列表"}),u.jsx("button",{className:"btn primary",onClick:f,children:"重试"})]})]});if(e===null)return null;const ge=e.turns.filter(T=>T.source!=="context"),D=Math.max(0,ge.length-c),De=D===0?ge:ge.slice(D),we=e.todos.filter(T=>T.status==="completed").length;return ge.length===0&&r===""?u.jsx("div",{className:"thread-empty",children:"这个会话还没有消息——在下面输入一句话开始。"}):u.jsxs(u.Fragment,{children:[e.goal===void 0?null:u.jsxs("div",{className:"goal-strip",children:[u.jsx("span",{className:"tag g",children:"◆ 目标"}),u.jsx("span",{className:"txt",children:e.goal.objective}),e.todos.length===0?null:u.jsxs("span",{className:"right",children:[u.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:u.jsx("path",{d:"M20 6 9 17l-5-5"})}),we," / ",e.todos.length," 步"]})]}),D>0?u.jsxs("div",{className:"load-earlier",children:[u.jsxs("button",{className:"btn",onClick:h,children:["载入更早的 ",D," 条"]}),u.jsxs("span",{className:"muted",children:["更早的记录已折叠(",D," 条)"]})]}):null,e.planMode?u.jsx("div",{className:"thread-note",children:"计划模式:只读分析中,不会改文件"}):null,e.todos.length===0?null:u.jsxs("div",{className:"plan",children:[u.jsxs("div",{className:"plan-head",children:[u.jsx("span",{className:"g",children:"◆"}),u.jsx("span",{children:"执行计划"}),u.jsxs("span",{className:"badge chip",children:[we," / ",e.todos.length]})]}),u.jsx("ul",{className:"plan-list",children:e.todos.map(T=>u.jsxs("li",{className:T.status==="completed"?"done":T.status==="in_progress"?"doing":void 0,children:[u.jsx("span",{className:T.status==="in_progress"?"tick g g-accent":"tick g",children:T.status==="completed"?"✓":T.status==="in_progress"?"◌":""}),T.content]},T.id))})]}),(()=>{const T=ce=>{if(ce===void 0)return;const _e=Date.parse(ce);return Number.isNaN(_e)?void 0:_e};let E=0,J=0,se=0;const pe=mR(De);return pe.map((ce,_e)=>{if(ce.kind==="user"){E=T(ce.turn.ts)??E,J=ce.turn.seq,se+=1;const le=se,me=ce.turn.seq;return u.jsxs("div",{className:"turn user-turn","data-seq":ce.turn.seq,children:[(()=>{const Te=w!==void 0&&$S(z,me),He=j!==void 0&&ce.turn.source!=="context"&&ce.turn.text.trim()!=="";return!Te&&!He?null:u.jsxs("div",{className:"msg-tools",children:[Te?u.jsxs("button",{className:"msg-tool fork",title:"新会话保留到这句为止,让它重新答;源会话只读",disabled:P!==null,onClick:()=>{ne({at:me,quote:ce.turn.text,round:le,ts:ce.turn.ts,kind:"user"})},children:[u.jsx("span",{className:"g",children:"⑂"})," 从这句分叉"]}):null,He?u.jsxs("button",{className:"msg-tool primary",title:"从这句问题之前分叉,自动重发同一句话(新会话重跑,源会话保留)",onClick:()=>{te(null),j({seq:ce.turn.seq,text:ce.turn.text,...ce.turn.ts===void 0?{}:{ts:ce.turn.ts},...ce.turn.images===void 0?{}:{images:ce.turn.images}}).catch(Ee=>{te({seq:me,message:Ee instanceof Error?Ee.message:String(Ee)})})},children:[u.jsx("span",{className:"g",children:"↻"})," 重答"]}):null]})})(),u.jsxs("div",{children:[ce.turn.images===void 0||ce.turn.images.length===0?null:u.jsx("div",{className:"user-images",children:ce.turn.images.map(Te=>{const He=`/file/raw?path=${encodeURIComponent(Te.path)}`;return u.jsx("a",{className:"user-image",href:He,target:"_blank",rel:"noreferrer",children:u.jsx("img",{src:He,alt:"",loading:"lazy"})},Te.path)})}),TR(ce.turn.text)?null:u.jsx("div",{className:"user-bubble",children:uE(ce.turn.text).map((Te,He)=>Te.mention?u.jsx("span",{className:"mention",children:Te.text},`m-${String(He)}`):u.jsx("span",{children:Te.text},`t-${String(He)}`))}),u.jsx("div",{className:"user-meta",children:ce.turn.ts===void 0?null:u.jsx("span",{children:new Date(ce.turn.ts).toLocaleTimeString("zh-CN",{hour:"2-digit",minute:"2-digit"})})}),F!==null&&F.seq===me?u.jsx("div",{className:"msg-error",children:F.message}):null,q!==null&&q.seq===me?u.jsx("div",{className:"msg-error",children:q.message}):null]})]},`${String(ce.turn.seq)}-${String(_e)}`)}const ke=ce.parts.at(-1),oe=T(ke?.ts),ye=E>0&&oe!==void 0&&oe>E?oe-E:void 0,Ne=pe[_e+1],ct=O?.turns.find(le=>le.key===J),ht=pR(S,Ne),Je=fR(ce.parts),Ke=w!==void 0&&ht&&$S(z,Je),qe=[...ce.parts].reverse().find(le=>le.text.trim()!=="")?.text.trim()??"(这条回答没有正文)";return u.jsx(LR,{parts:ce.parts,model:e?.model,durationMs:ye,收尾:ht,改动:ct,session:e?.session,onViewChanges:y,onOpenFile:x,分叉:Ke&&Je!==null?{at:Je,quote:qe,round:se,ts:ke?.ts,kind:"assistant"}:null,onFork:le=>{ne(le)},forkError:F!==null&&F.seq===Je?F.message:null},`a-${String(ke?.seq??_e)}-${String(_e)}`)})})(),S?u.jsx(jR,{等确认:m.length,静默秒:I}):null,r===""?null:u.jsx("div",{className:"turn",children:u.jsxs("div",{className:"ai",children:[u.jsx("div",{className:"ai-avatar g",children:"●"}),u.jsxs("div",{className:"ai-body",children:[u.jsxs("div",{className:"ai-head",children:[u.jsx("span",{className:"ai-name",children:"大罗"}),e.model===void 0?null:u.jsx("span",{className:"ai-model",children:e.model})]}),Kp(r),u.jsx("span",{className:"live-cursor",children:"▌"}),a>0?u.jsxs("div",{className:"muted",children:["(有 ",a," 帧增量丢失——以最终消息为准)"]}):null]})]})}),m.map(T=>u.jsx(V2,{ask:T,onAnswer:_},T.id)),v.map(T=>u.jsx(K2,{record:T},`${T.id}-${String(T.atMs)}`))]})}function R1({title:e,running:t,onToggleTheme:i,panels:r,showShare:a=!1,onTrajectory:c,onSideChat:h}){return u.jsxs("header",{className:"topbar",children:[u.jsx("div",{className:"title",id:"conv-title",children:e}),t?u.jsxs("span",{className:"chip live",children:[u.jsx("span",{className:"pulse"}),"运行中"]}):u.jsx("span",{className:"chip",children:"就绪"}),r,u.jsx("div",{className:"grow"}),h===void 0?null:u.jsx("button",{className:"icon-btn g",title:"旁路对话(不影响主会话)","aria-label":"打开旁路对话",onClick:h,children:"⧉"}),c===void 0?null:u.jsx("button",{className:"icon-btn g",title:"轨迹","aria-label":"打开轨迹",onClick:c,children:"▤"}),u.jsx("button",{className:"icon-btn g theme-toggle",title:"主题切换","aria-label":"切换明暗主题",onClick:i,children:"◐"}),a?u.jsx("button",{className:"icon-btn g",title:"分享","aria-label":"分享",children:"↗"}):null,u.jsx("button",{className:"icon-btn g",title:"更多","aria-label":"更多",children:"⋯"})]})}function zR(e,t){return Re(`/team/member?session=${encodeURIComponent(e)}&name=${encodeURIComponent(t)}`)}function VS(e,t,i){return Re("/team/message",Ze({session:e,to:t,content:i}))}function HR(e,t,i){return Re("/team/wake",Ze({session:e,to:t,prompt:i}))}function IR(e,t){return e==="failed"||e==="released"?"disabled":e==="running"||e==="provisioning"?"queue":t?"wake":"queue"}const UR=e=>e==="running"?"运行中":e==="idle"?"空闲":e==="failed"?"失败":e==="provisioning"?"启动中":"已释放";function PR({session:e,name:t,onClose:i}){const[r,a]=C.useState(null),[c,h]=C.useState(null),[f,g]=C.useState(""),[m,v]=C.useState(!1),[_,S]=C.useState(null),y=C.useRef(!0),x=C.useCallback(async(R=!1)=>{R||h(null);try{const I=await zR(e,t);y.current&&a(I)}catch(I){R||h(I instanceof Error?I.message:String(I))}},[e,t]);C.useEffect(()=>{y.current=!0,x();const R=window.setInterval(()=>{x(!0)},3e3);return()=>{y.current=!1,window.clearInterval(R)}},[x]);const w=R=>{S(R),window.setTimeout(()=>{S(null)},2600)},j=async()=>{const R=f.trim();if(!(R===""||r===null||m)&&!(r.member.status==="released"||r.member.status==="failed")){v(!0),h(null);try{if(M==="wake")try{await HR(e,t,R),g(""),w("已唤醒:未读已并入 prompt")}catch(I){if((I instanceof Error?I.message:String(I)).includes("父会话没在跑"))await VS(e,t,R),g(""),w("父会话空闲:已入队,等下次唤醒读取(未送达)");else throw I}else await VS(e,t,R),g(""),w("已入队:等它读取(未送达)");await x(!0)}catch(I){h(I instanceof Error?I.message:String(I))}finally{v(!1)}}},N=r?.member,M=N===void 0?"disabled":IR(N.status,r?.canWake===!0),A=M==="disabled"||m;return u.jsx("div",{className:"tm-mask",onMouseDown:i,children:u.jsxs("aside",{className:"tm-drawer",role:"dialog","aria-label":"子智能体会话",onMouseDown:R=>{R.stopPropagation()},children:[u.jsxs("div",{className:"tm-head",children:[u.jsx("div",{className:"tm-avatar",children:"◆"}),u.jsxs("div",{className:"tm-title",children:[u.jsxs("div",{className:"tm-name-line",children:[u.jsx("span",{className:"tm-kind",children:N?.kind==="seat"?"seat":"temp"}),u.jsx("span",{className:"tm-name",children:t}),N===void 0?null:u.jsx("span",{className:`tm-status ${N.status}`,children:UR(N.status)})]}),u.jsx("div",{className:"tm-sub",children:N?.description??""})]}),u.jsx("button",{className:"tm-close",type:"button",title:"关闭",onClick:i,children:"✕"})]}),c===null?null:u.jsxs("div",{className:"tm-banner err",children:[u.jsx("span",{children:"✕"}),u.jsx("span",{children:c})]}),r===null?u.jsx("div",{className:"tm-empty",children:"读取成员…"}):u.jsxs(u.Fragment,{children:[u.jsxs("div",{className:"tm-info",children:[u.jsxs("span",{children:["子会话:",u.jsx("b",{children:r.child.readable?"只读":"读不到"})]}),u.jsxs("span",{children:["未读:",u.jsx("b",{children:String(r.member.unread)})]}),u.jsxs("span",{children:["待投递:",u.jsx("b",{children:String(r.messages.filter(R=>!R.delivered).length)})]}),u.jsx("span",{className:"tm-info-id",children:r.member.id})]}),r.messages.length===0?null:u.jsxs("div",{className:"tm-pending",children:[u.jsx("div",{className:"tm-pending-head",children:"我发给它的消息"}),r.messages.map(R=>u.jsxs("div",{className:"tm-pmsg",children:[u.jsx("div",{className:"tm-pmsg-text",children:R.content}),u.jsxs("div",{className:"tm-pmsg-meta",children:[u.jsx("span",{children:R.id}),u.jsx("span",{className:R.delivered?"delivered":"queued",children:R.delivered?"已送达":"待投递"})]})]},R.id))]}),u.jsx("div",{className:"tm-thread",children:r.child.readable&&r.child.thread!==void 0?u.jsx(A1,{view:r.child.thread,loading:!1,error:null,liveText:"",liveDropped:0,visible:r.child.thread.total,onLoadEarlier:()=>{},onRetry:()=>{},onBack:i,questions:[],expired:[],onAnswer:async()=>{},busy:!1}):u.jsxs("div",{className:"tm-empty",children:[u.jsx("div",{className:"tm-empty-mark",children:"◌"}),u.jsxs("div",{children:["读不到 ",t," 的子会话"]}),u.jsxs("div",{className:"tm-empty-sub",children:["临时成员会话落在系统临时目录(",u.jsx("code",{children:"/tmp/daluo-peers/…"}),"),清理或释放后可能已不在。",r.member.status==="released"?" 成员已释放:不可发消息、不可唤醒。":""]})]})}),u.jsxs("div",{className:"tm-composer-wrap",children:[u.jsxs("div",{className:"tm-composer",children:[u.jsx("textarea",{className:"tm-input",rows:2,placeholder:r.member.status==="released"?"成员已释放,不能发消息":"给成员发消息(Enter 提交)",value:f,disabled:A,onChange:R=>{g(R.target.value)},onKeyDown:R=>{R.key==="Enter"&&!R.shiftKey&&(R.preventDefault(),j())}}),u.jsx("button",{className:"tm-send",type:"button",disabled:A||f.trim()==="",onClick:()=>{j()},children:m?"…":"发送"})]}),u.jsx("div",{className:"tm-note",children:M==="wake"?"成员空闲:发送将唤醒它(wake_member),并把未读一并送达。":r.member.status==="running"?"成员运行中:发送会入队,等它这一轮结束读取(不做 live 打断)。":"父会话空闲:发送只入队(等下次唤醒读取);唤醒需要父会话进程内的 TeamService。"})]})]}),_===null?null:u.jsxs("div",{className:"tm-toast",children:[u.jsx("span",{children:"✓"}),_]})]})})}const KS=12;function qR({title:e,session:t,thread:i,onToggleTheme:r,onSend:a,onStop:c,onBack:h,onTrajectory:f,onSideChat:g,onViewChanges:m,onOpenFile:v,onFork:_,onReanswer:S,focusSeq:y}){const[x,w]=C.useState(""),[j,N]=C.useState(!1),M=C.useRef(null),A=xx(Ee=>{M.current?.addFiles(Ee)}),[R,I]=C.useState(!1),[H,O]=C.useState(0),$=j||R,[Q,z]=C.useState(KS);C.useEffect(()=>{const Ee=i.view;y===void 0||Ee===null||z(Be=>Math.max(Be,Ee.turns.length))},[y,i.view]);const[G,P]=C.useState([]),[L,F]=C.useState(null),[K,q]=C.useState(null),[te,ne]=C.useState(null),[ge,D]=C.useState(null),De=C.useRef(null),we=Ee=>{De.current!==null&&window.clearTimeout(De.current),D(Ee),De.current=window.setTimeout(()=>{D(null)},2600)};C.useEffect(()=>()=>{De.current!==null&&window.clearTimeout(De.current)},[]);const T=P2(t),[E,J]=C.useState(null),se=C.useRef(null),pe=C.useRef(i.reload);pe.current=i.reload;const ce=C.useRef(0);C.useEffect(()=>{const Ee=se.current;if(Ee===null)return;const Be=i.view?.turns.length??0;Be<=ce.current&&i.liveText===""||(ce.current=Be,Ee.scrollTop=Ee.scrollHeight)},[i.view,i.liveText]),C.useEffect(()=>{if(!$)return;const Ee=setInterval(()=>{O(Be=>Be+1)},1e3);return()=>{clearInterval(Ee)}},[$]),C.useEffect(()=>{if(t===null){I(!1);return}let Ee=!0;const Be=async()=>{try{const Tt=await fx(t);if(!Ee)return;I(re=>(re&&!Tt.running&&pe.current(),Tt.running)),Tt.running||N(!1)}catch{}};Be();const jt=setInterval(()=>{Be()},2e3);return()=>{Ee=!1,clearInterval(jt)}},[t]);const _e=(Ee,Be)=>{const jt=Ee.trim();if(jt==="")return;const Tt=xp(jt);if(Tt!==null){if(w(""),t===null){we("先发一句话建会话,再设目标");return}if(Tt.kind==="usage"){we("用法:/goal <目标>");return}N(!0),q0(t,"set",Tt.objective).then(async()=>{await i.reload(),we("目标已设定")}).catch(re=>{we(re instanceof Error?re.message:String(re))}).finally(()=>{N(!1)});return}w(""),O(0),N(!0),a(jt,Be).finally(()=>{N(!1)})},ke=Ee=>{t!==null&&q0(t,Ee).then(async()=>{await i.reload(),we(Ee==="pause"?"目标已暂停":Ee==="resume"?"目标已恢复":"已清除目标")}).catch(Be=>{we(Be instanceof Error?Be.message:String(Be))})},oe=()=>{if(t===null)return;const Ee=i.view?.planMode!==!0;B2(t,Ee).then(async()=>{await i.reload(),we(Ee?"计划模式已开启(只读)":"计划模式已关闭")}).catch(Be=>{we(Be instanceof Error?Be.message:String(Be))})},ye=async Ee=>{q(null);try{await Ee(),await i.reload()}catch(Be){q(Be instanceof Error?Be.message:String(Be))}},Ne=Ee=>{if(t===null)return;const Be=Ee.trim();Be!==""&&(w(""),ye(async()=>{await z2(t,Be)}))},ct=()=>{if(t===null)return;const Ee=i.view?.inbox.pending??[];Ee.length!==0&&ye(async()=>{for(const Be of Ee)Be.placement!=="steering"&&await F0(t,Be.id,"steering")})},ht=()=>{i.reload()},Je=new Set(G.map(Ee=>Ee.id)),Ke=(i.view?.asks.pending??[]).filter(Ee=>!Je.has(Ee.id)),qe=Ke.filter(Ee=>Ee.kind==="permission"),le=Ke.filter(Ee=>Ee.kind==="question"),me=qe[0],Te=Ee=>{t!==null&&S2(t,Ee).then(async()=>{F(null),await i.reload()}).catch(Be=>{F(Be instanceof Error?Be.message:String(Be))})},He=async Ee=>{if(t===null)return;const Be=Ke.find(jt=>jt.id===Ee.id);try{await g2(t,Ee)}catch(jt){const Tt=jt instanceof Error?jt.message:String(jt);Be!==void 0&&P(re=>[...re,{id:Be.id,kind:Be.kind,question:Be.question,reason:Tt,atMs:Date.now()}])}finally{await i.reload()}};return u.jsxs("div",{className:"view",style:{display:"flex"},...A.handlers,children:[u.jsx(R1,{title:e,running:$,showShare:!0,onToggleTheme:r,onTrajectory:f,...g===void 0?{}:{onSideChat:g},panels:u.jsx(J2,{team:T.team,agents:T.agents,jobs:T.jobs,open:E,onOpen:Ee=>{J(Be=>Be===Ee?null:Ee)}})}),E===null||t===null?null:u.jsx(eE,{kind:E,panel:T,session:t,onClose:()=>{J(null)},onOpenMember:Ee=>{ne(Ee),J(null)}}),u.jsxs("div",{className:"thread",ref:se,"data-dsh-part":"scrollport",children:[i.stream==="closed"&&i.view!==null?u.jsxs("div",{className:"conn-banner",children:[u.jsx("span",{className:"warn",children:"⚠"}),u.jsx("span",{children:"与事件流的连接断开,自动重连中…"}),u.jsx("button",{className:"btn",onClick:ht,children:"立即重连"})]}):null,u.jsx("div",{className:"thread-inner",children:u.jsx(A1,{view:i.view,loading:i.loading,error:i.error,liveText:i.liveText,liveDropped:i.liveDropped,visible:Q,onLoadEarlier:()=>{z(Ee=>Ee+KS)},onRetry:()=>{i.reload()},onBack:h,questions:le,expired:G,onAnswer:He,busy:$,onViewChanges:m,onOpenFile:v,onFork:_,onReanswer:S,focusSeq:y})})]}),u.jsxs("div",{className:"composer-wrap","data-dsh-surface":"composer",children:[ge===null?null:u.jsx("div",{className:"goal-toast",children:ge}),i.view?.goal===void 0?null:u.jsx(NE,{goal:i.view.goal,busy:$,onPause:()=>{ke("pause")},onResume:()=>{ke("resume")},onClear:()=>{ke("clear")}}),me===void 0?null:u.jsx($2,{ask:me,count:qe.length,onAnswer:He}),t===null?null:u.jsx(EE,{pending:i.view?.inbox.pending??[],onEdit:async(Ee,Be)=>{await ye(async()=>{await H2(t,Ee,Be)})},onRemove:async Ee=>{await ye(async()=>{await I2(t,Ee)})},onSteer:async Ee=>{await ye(async()=>{await F0(t,Ee,"steering")})}}),K===null?null:u.jsx("div",{className:"q-error standalone",children:K}),$?u.jsxs("div",{className:"composer-status",children:[u.jsx("span",{className:"g g-run",children:"◌"})," 运行中 · ",H,"s",u.jsxs("span",{style:{marginLeft:"auto"},children:[qe.length>1?`还有 ${String(qe.length)} 个等待确认`:"",(i.view?.inbox.pending.length??0)===0?null:` · 排队 ${String(i.view?.inbox.pending.length)} 条`]})]}):null,u.jsx(CE,{name:wE.输入卡Dock}),u.jsx(bx,{ref:M,value:x,onChange:w,contextLabel:"ctx —",session:t??void 0,profile:i.view?.profile,onProfile:Te,busy:$,onSend:_e,onQueue:Ne,onInterjectAll:ct,planMode:i.view?.planMode===!0,planDisabled:$,onTogglePlan:oe,onStop:()=>{N(!1),c()}})]}),A.dragging?u.jsx(wx,{}):null,te===null||t===null?null:u.jsx(PR,{session:t,name:te,onClose:()=>{ne(null)}})]})}const O1=280,B1=640,Xs=420;function Yp(e){if(e==null||e==="")return Xs;const t=typeof e=="number"?e:Number(e);return Number.isFinite(t)?Math.min(B1,Math.max(O1,Math.round(t))):Xs}const L1="daluo.dock.width",$n=()=>{try{return typeof localStorage>"u"?null:localStorage}catch{return null}};function FR(e=$n()){if(e===null)return Xs;try{return Yp(e.getItem(L1))}catch{return Xs}}function Kf(e=$n(),t){const i=t===void 0?Xs:Yp(t);if(e===null)return i;try{e.setItem(L1,String(i))}catch{}return i}const $R=new Set(["png","jpg","jpeg","gif","webp","svg","bmp","ico","avif","heic"]),VR=new Set(["ts","tsx","js","jsx","mjs","cjs","json","jsonc","css","scss","less","html","htm","vue","svelte","py","rb","go","rs","java","kt","c","h","cc","cpp","hpp","cs","swift","php","lua","sh","bash","zsh","fish","ps1","sql","yaml","yml","toml","ini","xml","gradle","dockerfile","makefile","cmake","proto"]),KR=new Set(["txt","log","csv","tsv","env","lock","gitignore","editorconfig","patch","diff","license"]),YR=new Set(["wasm","zip","gz","tgz","tar","bz2","xz","7z","rar","jar","exe","dll","so","dylib","o","a","class","pyc","woff","woff2","ttf","otf","eot","mp3","mp4","mov","avi","webm","wav","flac","docx","xlsx","pptx","doc","xls","ppt"]);function z1(e){const t=e.slice(e.lastIndexOf("/")+1),i=t.lastIndexOf("."),r=(i>0?t.slice(i+1):t).toLowerCase();return $R.has(r)?"image":r==="pdf"?"pdf":r==="md"||r==="markdown"||r==="mdx"?"markdown":VR.has(r)?"code":KR.has(r)||t==="LICENSE"||t==="Makefile"||t==="Dockerfile"?"text":YR.has(r)?"binary":"text"}function WR(e){return e==="code"||e==="markdown"||e==="text"}const XR={docx:"DOCX",doc:"DOC",xlsx:"XLSX",xls:"XLS",pptx:"PPTX",ppt:"PPT"};function GR(e){const t=e.slice(e.lastIndexOf("/")+1),i=t.lastIndexOf(".");return i<=0?null:XR[t.slice(i+1).toLowerCase()]??null}function Wp(e){const t=e.lastIndexOf("/");return t<0?{dir:"",name:e}:{dir:e.slice(0,t),name:e.slice(t+1)}}function QR(e){return!Number.isFinite(e)||e<0?"—":e<1024?`${String(Math.round(e))} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}function ZR(e){if(e==="")return{行:[],增:0,删:0};const t=[];let i=0,r=0,a=0,c=0;for(const h of e.split(`
45
+ `)){if(h.startsWith("diff --git")||h.startsWith("index ")||h.startsWith("--- ")||h.startsWith("+++ ")||h.startsWith("\\")){t.push({kind:"meta",oldLine:null,newLine:null,text:h});continue}if(h.startsWith("@@")){const f=/-(\d+)(?:,\d+)? \+(\d+)(?:,\d+)?/.exec(h);f!==null&&(i=Number(f[1]),r=Number(f[2]));const g=h.slice(h.indexOf("@@",2)+2).trim();t.push({kind:"hunk",oldLine:null,newLine:null,text:`@@ ${g}`});continue}if(h.startsWith("+")){t.push({kind:"add",oldLine:null,newLine:r,text:h.slice(1)}),r+=1,a+=1;continue}if(h.startsWith("-")){t.push({kind:"del",oldLine:i,newLine:null,text:h.slice(1)}),i+=1,c+=1;continue}if(h.startsWith(" ")){t.push({kind:"ctx",oldLine:i,newLine:r,text:h.slice(1)}),i+=1,r+=1;continue}t.push({kind:"meta",oldLine:null,newLine:null,text:h})}return{行:t,增:a,删:c}}const JR=new Set(["import","from","export","const","let","var","type","interface","function","return","if","else","new","async","await","readonly","true","false","undefined","null","for","of","in","as","void","class","extends","implements","default","this","typeof","switch","case","break","continue","try","catch","throw","def","elif","fn","pub","struct","impl","match","package","func","defer","select","range","and","or","not","is","with","lambda","yield","pass","raise","except","finally","while","do","end"]),YS=e=>/[A-Za-z0-9_$]/.test(e);function e4(e){const t=[];let i="";const r=()=>{i!==""&&(t.push({cls:"",text:i}),i="")};let a=0;for(;a<e.length;){const h=e[a]??"";if(h==="/"&&e[a+1]==="/")return r(),t.push({cls:"c",text:e.slice(a)}),t;if(h==='"'||h==="'"||h==="`"){r();let f=a+1;for(;f<e.length;){const g=e[f]??"";if(g==="\\"&&f+1<e.length){f+=2;continue}if(g===h){f+=1;break}f+=1}t.push({cls:"s",text:e.slice(a,f)}),a=f;continue}if(YS(h)&&!/^\d$/.test(h)){let f=a;for(;f<e.length&&YS(e[f]??"");)f+=1;const g=e.slice(a,f);r(),t.push({cls:JR.has(g)?"k":"",text:g}),a=f;continue}if(/^\d$/.test(h)){let f=a;for(;f<e.length&&/[\d.]/.test(e[f]??"");)f+=1;r(),t.push({cls:"n",text:e.slice(a,f)}),a=f;continue}i+=h,a+=1}r();const c=[];for(const h of t){const f=c[c.length-1];f!==void 0&&f.cls===h.cls?c[c.length-1]={cls:f.cls,text:f.text+h.text}:c.push(h)}return c.length===0?[{cls:"",text:""}]:c}function H1(e){const t=e.worktree.trim()!==""&&e.worktree!=="?"?e.worktree:e.index;return t==="?"?"?":t==="A"?"A":t==="D"?"D":t==="R"||t==="C"?"R":t!==""&&t!==" "?"M":"?"}function t4(e,t){return e===""?t:`${e.endsWith("/")?e.slice(0,-1):e}/${t}`}function WS(e,t){const i=[{id:"copy-rel",label:"复制相对路径",hint:t},{id:"copy-abs",label:"复制绝对路径",hint:t4(e,t)}];return e!==""&&i.push({id:"reveal",label:"在 Finder 中显示",hint:Wp(t).name}),i}function XS(e){return e.kind==="running"?"运行中":e.exitCode!==null?`已退出 ${String(e.exitCode)}`:`已退出 ${e.signal??"未知"}`}const Rm=360,Om=280,n4=620,i4=468,I1="daluo.dock.float",U1="daluo.dock.float.rect",P1="daluo.term.split",Fi=8,vo=()=>typeof window>"u"?{width:1440,height:900}:{width:window.innerWidth,height:window.innerHeight};function co(e=vo()){const t=Math.max(Rm,Math.min(n4,e.width-Fi*2)),i=Math.max(Om,Math.min(i4,e.height-Fi*2));return{x:Math.round((e.width-t)/2),y:56,width:t,height:i}}function q1(e,t=vo()){const i=co(t),r=typeof e=="object"&&e!==null?e:{},a=(_,S)=>{const y=typeof _=="number"?_:Number(_);return Number.isFinite(y)?Math.round(y):S},c=Math.max(Rm,t.width-Fi*2),h=Math.max(Om,t.height-Fi*2),f=Math.min(c,Math.max(Rm,a(r.width,i.width))),g=Math.min(h,Math.max(Om,a(r.height,i.height))),m=Math.min(Math.max(Fi,t.width-f-Fi),Math.max(Fi,a(r.x,i.x))),v=Math.min(Math.max(Fi,t.height-g-Fi),Math.max(Fi,a(r.y,i.y)));return{x:m,y:v,width:f,height:g}}function s4(e,t=vo()){if(e===null||e.trim()==="")return co(t);try{return q1(JSON.parse(e),t)}catch{return co(t)}}function r4(e=$n(),t=vo()){if(e===null)return co(t);try{return s4(e.getItem(U1),t)}catch{return co(t)}}function br(e=$n(),t,i=vo()){const r=q1(t,i);if(e!==null)try{e.setItem(U1,JSON.stringify(r))}catch{}return r}function l4(e=$n()){if(e===null)return!1;try{return e.getItem(I1)==="1"}catch{return!1}}function eu(e=$n(),t){if(e!==null)try{e.setItem(I1,t?"1":"0")}catch{}return t}function a4(e){if(e==null||e==="")return .5;const t=typeof e=="number"?e:Number(e);return Number.isFinite(t)?Math.round(Math.min(.75,Math.max(.25,t))*100)/100:.5}function Xp(e){return a4(e)}const F1="daluo.term.split.ratio";function o4(e=$n()){if(e===null)return .5;try{return Xp(e.getItem(F1))}catch{return .5}}function Yf(e=$n(),t){const i=t===void 0?.5:Xp(t);if(e!==null)try{e.setItem(F1,String(i))}catch{}return i}function c4(e=$n()){if(e===null)return!1;try{return e.getItem(P1)==="1"}catch{return!1}}function Wf(e=$n(),t){if(e!==null)try{e.setItem(P1,t?"1":"0")}catch{}return t}const u4=140,h4=240,uo=176,$1="daluo.files.tree";function Gp(e){if(e==null||e==="")return uo;const t=typeof e=="number"?e:Number(e);return Number.isFinite(t)?Math.min(h4,Math.max(u4,Math.round(t))):uo}function d4(e=$n()){if(e===null)return uo;try{return Gp(e.getItem($1))}catch{return uo}}function GS(e=$n(),t){const i=t===void 0?uo:Gp(t);if(e!==null)try{e.setItem($1,String(i))}catch{}return i}const V1="daluo.dock.float.pinned";function f4(e=$n()){if(e===null)return!1;try{return e.getItem(V1)==="1"}catch{return!1}}function QS(e=$n(),t){if(e!==null)try{e.setItem(V1,t?"1":"0")}catch{}return t}function m4({facts:e,factsError:t,refreshKey:i,onRefresh:r}){const[a,c]=C.useState(null),[h,f]=C.useState(""),[g,m]=C.useState(null),[v,_]=C.useState(""),[S,y]=C.useState(!1),[x,w]=C.useState(!1),[j,N]=C.useState(!1);C.useEffect(()=>{g!==null&&M(g)},[i]);const M=C.useCallback(async O=>{m(O),_(""),w(!0);try{const $=await a2(O);_($.diff),y($.truncated),c(null)}catch($){c($ instanceof Error?$.message:String($))}finally{w(!1)}},[]);if(C.useEffect(()=>{e===null||e.changed.length===0||g===null&&M(e.changed[0]?.path??"")},[e,g,M]),t!==null&&e===null)return u.jsxs("div",{className:"dock-empty",children:["读取 git 状态失败:",t]});if(e===null)return u.jsx("div",{className:"dock-empty",children:"读取 git 状态…"});if(!e.isRepo)return u.jsx("div",{className:"dock-empty",children:"这个工作区不是 git 仓库(或读不到 git)。"});if(e.changed.length===0)return u.jsxs("div",{className:"dock-empty",children:[u.jsx("span",{className:"big",children:"◇"}),"本轮还没有改动",u.jsx("br",{}),"编辑文件或跑工具后会出现在这里"]});const A=e.changed.filter(O=>h.trim()===""||O.path.toLowerCase().includes(h.trim().toLowerCase())),R=g===null?null:ZR(v),I=R?.增??0,H=R?.删??0;return u.jsxs("div",{className:j?"changes expanded":"changes",children:[u.jsxs("div",{className:"changes-head",children:[u.jsx("span",{className:"branch",title:e.root,children:e.branch??"HEAD"}),u.jsxs("span",{className:"sum",children:[e.changed.length," 个改动"]}),R===null?null:u.jsxs("span",{className:"stat",title:"当前选中文件的增删",children:[u.jsxs("span",{className:"plus",children:["+",I]}),u.jsxs("span",{className:"minus",children:["−",H]})]}),u.jsx("span",{className:"grow"}),u.jsx("button",{className:"link-btn",onClick:r,children:"刷新"})]}),u.jsxs("div",{className:"dock-search",children:[u.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.9",children:[u.jsx("circle",{cx:"11",cy:"11",r:"7"}),u.jsx("path",{d:"m20 20-3.5-3.5"})]}),u.jsx("input",{value:h,placeholder:"筛选改动文件…","aria-label":"筛选改动文件",onChange:O=>{f(O.target.value)},onKeyDown:O=>{O.key==="Escape"&&f("")}}),h===""?null:u.jsx("button",{className:"clear",title:"清空 (Esc)",onClick:()=>{f("")},children:"✕"})]}),j?null:u.jsxs("div",{className:"changes-list",children:[A.map(O=>{const $=H1(O);return u.jsxs("div",{className:g===O.path?"change sel":"change",title:O.path,onClick:()=>{M(O.path)},children:[u.jsx("span",{className:`st ${$}`,children:$}),u.jsx("span",{className:"p",children:O.path})]},O.path)}),A.length===0?u.jsx("div",{className:"tree-hint",children:"没有匹配的改动"}):null]}),g===null?null:u.jsxs("div",{className:j?"diff expanded":"diff",children:[u.jsxs("div",{className:"diff-head",children:[u.jsx("span",{className:"path",title:g,children:g}),R===null?null:u.jsxs("span",{className:"stat",children:[u.jsxs("span",{className:"plus",children:["+",R.增]}),u.jsxs("span",{className:"minus",children:["−",R.删]})]}),u.jsx("button",{className:"link-btn",onClick:()=>{N(O=>!O)},children:j?"收起":"展开"})]}),S?u.jsx("div",{className:"hunk",children:"(diff 太大,已截断)"}):null,x?u.jsx("div",{className:"hunk",children:"读取 diff…"}):null,!x&&v===""?u.jsx("div",{className:"hunk",children:"(无 diff 内容)"}):null,R?.行.map((O,$)=>u.jsxs("div",{className:`dl ${O.kind==="add"?"a":O.kind==="del"?"d":O.kind==="hunk"?"h":O.kind==="meta"?"m":"x"}`,children:[u.jsx("span",{className:"dn",children:O.oldLine??""}),u.jsx("span",{className:"dn",children:O.newLine??""}),u.jsx("span",{className:"dc",children:O.text})]},$))]})]})}function p4(e){return Re(`/revert?session=${encodeURIComponent(e)}`)}function g4(e,t){return Re("/revert",Ze({session:e,to:t,plan:!0}))}function _4(e,t){return Re("/revert",Ze({session:e,to:t}))}function v4({session:e,onReverted:t}){const[i,r]=C.useState(null),[a,c]=C.useState(null),[h,f]=C.useState(null),[g,m]=C.useState(null),[v,_]=C.useState(!1),[S,y]=C.useState(null),x=C.useCallback(async()=>{if(e===null){r(null);return}try{r(await p4(e)),m(null)}catch(N){m(N instanceof Error?N.message:String(N))}},[e]);C.useEffect(()=>{c(null),f(null),y(null),x()},[x]);const w=async N=>{if(!(e===null||v)){_(!0),m(null),y(null);try{c(N.toSeq),f((await g4(e,N.toSeq)).plan)}catch(M){m(M instanceof Error?M.message:String(M))}finally{_(!1)}}},j=async()=>{if(!(e===null||h===null||v)){_(!0),m(null);try{const N=await _4(e,h.toSeq);y(`已回退到 seq ${String(N.toSeq)},新会话:${N.logFile}${N.fileRestore!==void 0?`(文件回到快照 ${N.fileRestore.checkpoint.slice(0,8)})`:N.fileRestoreSkipped!==void 0?`(文件未动:${N.fileRestoreSkipped})`:""}`),t?.(N.logFile),f(null),c(null)}catch(N){m(N instanceof Error?N.message:String(N))}finally{_(!1)}}};return e===null?u.jsx("div",{className:"dock-body rw",children:u.jsx("div",{className:"rw-empty",children:"先打开一个会话:回退以会话为锚点(源会话只读,回退产出新会话)。"})}):u.jsxs("div",{className:"dock-body rw",children:[u.jsxs("div",{className:"rw-head",children:[u.jsx("b",{children:"回退(Rewind)"}),u.jsx("span",{className:"rw-sub",children:"文件 + 对话一起回到某条消息那一刻;源会话不动"})]}),g===null?null:u.jsx("div",{className:"rw-error",children:g}),S===null?null:u.jsx("div",{className:"rw-ok",children:S}),i===null?u.jsx("div",{className:"rw-empty",children:"读取锚点…"}):u.jsxs(u.Fragment,{children:[u.jsxs("div",{className:"rw-meta",children:["可回退锚点 ",i.plans.length," 个 · 会话共 ",i.total," 条回合消息"]}),i.plans.length===0?u.jsx("div",{className:"rw-empty",children:"没有可回退的锚点(回合中间不能回退;先完成一轮)。"}):null,u.jsx("div",{className:"rw-list",children:i.plans.map(N=>u.jsx("div",{className:a===N.toSeq?"rw-row on":"rw-row",children:u.jsxs("button",{className:"rw-main",disabled:v,onClick:()=>{w(N)},children:[u.jsxs("span",{className:"rw-seq",children:["seq ",N.toSeq]}),u.jsx("span",{className:"rw-detail",children:N.detail}),N.checkpoint===void 0?null:u.jsxs("span",{className:"rw-tag",children:["快照 ",N.checkpoint.hash.slice(0,8)]})]})},N.toSeq))})]}),h===null?null:u.jsxs("div",{className:"rw-plan",children:[u.jsxs("div",{className:"rw-plan-title",children:["回退到 seq ",h.toSeq,":",h.status]}),u.jsx("div",{className:"rw-detail",children:h.detail}),h.status!=="boundary"?u.jsx("div",{className:"rw-error",children:"这个位置不能当锚点,换一个 seq。"}):u.jsxs("div",{className:"rw-actions",children:[u.jsx("button",{className:"btn",disabled:v,onClick:()=>{j()},children:v?"回退中…":"确认回退(产出新会话)"}),u.jsx("button",{className:"btn",disabled:v,onClick:()=>{f(null),c(null)},children:"取消"})]})]})]})}function y4({root:e,path:t,x:i,y:r,onClose:a,onFeedback:c}){C.useEffect(()=>{const g=()=>{a()},m=v=>{v.key==="Escape"&&a()};return window.addEventListener("pointerdown",g),window.addEventListener("blur",g),window.addEventListener("keydown",m),()=>{window.removeEventListener("pointerdown",g),window.removeEventListener("blur",g),window.removeEventListener("keydown",m)}},[a]);const h=async g=>{if(g==="copy-rel"||g==="copy-abs"){try{await navigator.clipboard.writeText(g==="copy-rel"?t:WS(e,t)[1]?.hint??t),c(`已复制${g==="copy-rel"?"相对":"绝对"}路径`)}catch{c("剪贴板不可用(浏览器拒了)")}a();return}try{await ux({target:"finder",path:t,reveal:!0}),c(`已在 Finder 中选中 ${Wp(t).name}`)}catch(m){c(`Finder 打不开:${m instanceof Error?m.message:String(m)}`)}a()},f=WS(e,t);return u.jsxs("div",{className:"ctx-menu",style:{left:Math.min(i,window.innerWidth-230),top:Math.min(r,window.innerHeight-140)},onPointerDown:g=>{g.stopPropagation()},children:[u.jsx("div",{className:"ctx-head",title:t,children:t}),f.map(g=>u.jsxs("button",{className:"ctx-item",onClick:()=>{h(g.id)},children:[u.jsx("span",{className:"ctx-label",children:g.label}),u.jsx("span",{className:"ctx-hint",title:g.hint,children:g.hint})]},g.id))]})}const Xf=(e,t)=>e===""?t:`${e}/${t}`,S4=e=>e.startsWith(".")||K1.has(e),K1=new Set(["node_modules",".git","dist","build","target","venv",".venv","__pycache__",".next",".cache",".turbo"]);function b4({path:e}){const t=z1(e);return t==="image"?u.jsxs("svg",{className:"ico",width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",children:[u.jsx("rect",{x:"3",y:"4",width:"18",height:"16",rx:"2"}),u.jsx("circle",{cx:"9",cy:"10",r:"1.6"}),u.jsx("path",{d:"m4 18 5-4 4 3 3-2 4 3"})]}):t==="markdown"?u.jsxs("svg",{className:"ico",width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",children:[u.jsx("rect",{x:"3",y:"5",width:"18",height:"14",rx:"2"}),u.jsx("path",{d:"M7 15V9l2.5 3L12 9v6M16 9v6M14.5 13.5 16 15l1.5-1.5"})]}):u.jsxs("svg",{className:"ico",width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",children:[u.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),u.jsx("path",{d:"M14 2v6h6"})]})}function x4({selected:e,onSelect:t,changed:i,q:r,refreshKey:a,onMenu:c}){const[h,f]=C.useState({}),[g,m]=C.useState(new Set([""])),[v,_]=C.useState(null),[S,y]=C.useState({state:"idle",dirs:0}),x=C.useRef({});x.current=h;const w=C.useCallback(async R=>{try{const I=await H0(R);f(H=>({...H,[R]:I})),_(null)}catch(I){_(I instanceof Error?I.message:String(I))}},[]);C.useEffect(()=>{h[""]===void 0&&w("")},[h,w]),C.useEffect(()=>{a!==0&&(f({}),m(new Set([""])),w(""))},[a,w]),C.useEffect(()=>{if(r===""){y({state:"idle",dirs:0});return}let R=!1;const I=async()=>{y({state:"walking",dirs:0});const O=new Set,$=[""];let Q=0;for(;$.length>0&&Q<300&&!R;){const z=$.shift();if(O.has(z))continue;O.add(z),Q+=1;let G=x.current[z];if(G===void 0){try{G=await H0(z)}catch{continue}if(R)return;f(P=>({...P,[z]:G}))}for(const P of G.entries)P.type==="directory"&&!P.name.startsWith(".")&&!K1.has(P.name)&&$.push(Xf(z,P.name))}R||y({state:$.length>0?"capped":"done",dirs:Q})},H=setTimeout(()=>{I()},180);return()=>{R=!0,clearTimeout(H)}},[r]);const j=R=>{m(I=>{const H=new Set(I);return H.has(R)?H.delete(R):H.add(R),H}),h[R]===void 0&&w(R)},N=R=>r===""||R.toLowerCase().includes(r),M=R=>{if(r==="")return!0;const I=h[R];return I===void 0?!1:I.entries.some(H=>{const O=Xf(R,H.name);return H.type==="directory"?M(O):N(O)})},A=(R,I)=>{const H=h[R];if(H===void 0)return g.has(R)?u.jsx("div",{className:"tree-hint",style:{paddingLeft:`${String(8+I*16)}px`},children:"读取中…"},`loading-${R}`):null;const O=[];for(const $ of H.entries){const Q=Xf(R,$.name),z=8+I*16;if($.type==="directory"){if(S4($.name)||!M(Q))continue;const G=g.has(Q)||r!=="";O.push(u.jsxs("div",{className:"tree-item dir",style:{paddingLeft:`${String(z)}px`},onClick:()=>{j(Q)},title:Q,children:[u.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{transform:G?"none":"rotate(-90deg)",flex:"0 0 auto"},children:u.jsx("path",{d:"m6 9 6 6 6-6"})}),u.jsx("svg",{className:"ico",width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",children:u.jsx("path",{d:"M3 7a2 2 0 0 1 2-2h5l2 2h7a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z"})}),u.jsx("span",{className:"nm",children:$.name})]},Q)),G&&O.push(A(Q,I+1))}else if($.type==="file"&&N(Q)){const G=i.get(Q);O.push(u.jsxs("div",{className:e===Q?"tree-item sel":"tree-item",style:{paddingLeft:`${String(z)}px`},onClick:()=>{t(Q)},onContextMenu:P=>{P.preventDefault(),c?.(Q,P.clientX,P.clientY)},title:Q,children:[u.jsx(b4,{path:Q}),u.jsx("span",{className:"nm",children:$.name}),G===void 0?null:u.jsx("span",{className:`tag ${G}`,children:G})]},Q))}}return u.jsx("div",{children:O},`dir-${R}`)};return u.jsxs(u.Fragment,{children:[v===null?null:u.jsxs("div",{className:"dock-empty",children:["目录读不到:",v]}),r!==""?u.jsx("div",{className:"tree-hint",children:S.state==="walking"?"搜索中…":S.state==="capped"?"已搜 300 个目录(到上限,可先展开目录再筛)":`已搜 ${String(S.dirs)} 个目录`}):null,u.jsx("div",{className:"tree",children:A("",0)})]})}function ZS(e){const t=e.split("/").filter(i=>i!=="").at(-1)??"";return{href:`/file/raw?path=${encodeURIComponent(e)}`,download:t===""?"file":t}}const JS=400,w4=2500;function C4({path:e,narrow:t,onBack:i,onNotice:r,onMenu:a,targetLine:c}){const[h,f]=C.useState(null),[g,m]=C.useState(""),[v,_]=C.useState(0),[S,y]=C.useState(0),[x,w]=C.useState(!0),[j,N]=C.useState(null),[M,A]=C.useState(null),[R,I]=C.useState(null),[H,O]=C.useState(null),[$,Q]=C.useState(!1),[z,G]=C.useState(!1),[P,L]=C.useState(!1),[F,K]=C.useState(null),q=C.useRef(null),te=C.useRef(null),ne=C.useRef(null),ge=z1(e),D=WR(ge),De=C.useCallback(async(_e,ke)=>{Q(!0);try{const oe=await r2(e,{offset:_e,limit:JS});f(oe),m(ye=>ke?`${ye}${ye===""?"":`
46
+ `}${oe.text}`:oe.text),_(oe.offset),y(oe.lines),w(oe.eof),N(oe.bytes??null),oe.version!==void 0&&A(oe.version),O(null),I(null),r?.(null)}catch(oe){const ye=oe instanceof Error?oe.message:String(oe);O(ye),r?.(`读不到 ${e}:${ye}`)}finally{Q(!1)}},[e,r]);C.useEffect(()=>{f(null),m(""),_(0),w(!0),A(null),I(null),D&&De(vR(c??1,JS),!1)},[e,D,De,c]),C.useEffect(()=>{if(c===void 0)return;const _e=te.current;_e!==null&&_e.scrollIntoView({block:"center"})},[g,c,v]),C.useEffect(()=>{if(!D||M===null)return;let _e=!1;const ke=setInterval(()=>{l2(e).then(oe=>{_e||I(oe.version)},()=>{})},w4);return()=>{_e=!0,clearInterval(ke)}},[e,D,M]),C.useEffect(()=>()=>{q.current!==null&&clearTimeout(q.current),ne.current!==null&&clearTimeout(ne.current)},[]);const we=async()=>{try{await navigator.clipboard.writeText(e),L(!0),q.current!==null&&clearTimeout(q.current),q.current=setTimeout(()=>{L(!1)},1600)}catch{r?.("剪贴板不可用(浏览器拒了)")}},T=_e=>{K(_e),ne.current!==null&&clearTimeout(ne.current),ne.current=setTimeout(()=>{K(null)},2200)},{dir:E,name:J}=Wp(e),se=S===0?0:v+S-1,pe=R!==null&&M!==null&&R!==M,ce=u.jsxs("div",{className:"pv-head",onContextMenu:_e=>{_e.preventDefault(),a?.(e,_e.clientX,_e.clientY)},children:[t?u.jsx("button",{className:"ib",title:"返回文件树","aria-label":"返回文件树",onClick:i,children:"←"}):null,u.jsxs("span",{className:"pv-path",title:e,children:[E===""?null:u.jsxs("span",{className:"dim",children:[E,"/"]}),u.jsx("b",{children:J})]}),u.jsxs("span",{className:"pv-actions",children:[D?u.jsx("button",{className:z?"ib on":"ib",title:z?"不换行":"自动换行",onClick:()=>{G(_e=>!_e)},children:"↵"}):null,u.jsx("button",{className:P?"ib on":"ib",title:P?"已复制":"复制路径",onClick:()=>{we()},children:"⧉"}),u.jsx("a",{className:"ib",title:"下载","aria-label":"下载",...ZS(e),children:"↓"}),D?u.jsx("button",{className:"ib",title:"从磁盘重载",onClick:()=>{De(1,!1)},children:"↻"}):null,u.jsx("button",{className:"ib",title:"关闭预览","aria-label":"关闭预览",onClick:i,children:"✕"})]})]});if(!D){const _e=ge==="image",ke=ge==="pdf",oe=GR(e),ye=J.includes(".")?J.slice(J.lastIndexOf(".")+1).toUpperCase():"BIN",Ne=async ht=>{try{await ux(ht?{target:"finder",path:e,reveal:!0}:{target:"finder",path:e}),T(ht?"已在 Finder 中显示":"已交给系统默认应用打开")}catch(Je){const Ke=Je instanceof Error?Je.message:String(Je);r?.(`打开失败:${Ke}`),T(`打开失败:${Ke}`)}},ct=u.jsxs(u.Fragment,{children:[u.jsx("button",{className:"ib",title:"复制路径",onClick:()=>{we()},children:"⧉"}),u.jsx("a",{className:"ib",title:"下载","aria-label":"下载",...ZS(e),children:"↓"}),u.jsx("button",{className:"ib",title:"用系统应用打开",onClick:()=>{Ne(!1)},children:"↗"}),u.jsx("button",{className:"ib",title:"关闭预览","aria-label":"关闭预览",onClick:i,children:"✕"})]});return u.jsxs("div",{className:"pv",children:[u.jsxs("div",{className:"pv-head",onContextMenu:ht=>{ht.preventDefault(),a?.(e,ht.clientX,ht.clientY)},children:[t?u.jsx("button",{className:"ib",title:"返回文件树","aria-label":"返回文件树",onClick:i,children:"←"}):null,u.jsxs("span",{className:"pv-path",title:e,children:[E===""?null:u.jsxs("span",{className:"dim",children:[E,"/"]}),u.jsx("b",{children:J})]}),u.jsx("span",{className:"pv-actions",children:ct})]}),_e?u.jsx("div",{className:"pv-body image",children:u.jsx("img",{src:`/file/raw?path=${encodeURIComponent(e)}`,alt:J})}):null,ke?u.jsxs(u.Fragment,{children:[u.jsx("div",{className:"pv-body pdf",children:u.jsx("iframe",{className:"pv-pdf",title:J,src:`/file/raw?path=${encodeURIComponent(e)}`})}),u.jsxs("div",{className:"pv-more",children:[u.jsx("span",{children:"浏览器原生 PDF 查看器"}),u.jsx("span",{className:"dim",children:"· 字节走 /file/raw(application/pdf)"})]})]}):null,_e||ke?null:u.jsxs("div",{className:"pv-boundary",children:[u.jsx("span",{className:"doc-badge",children:oe??ye}),u.jsx("h3",{children:oe===null?"这个文件不做内嵌预览":"Office 文档不内嵌预览"}),u.jsx("p",{children:oe===null?`二进制(${ge})不内嵌、也不当文本读——不装作能看,给真动作:`:"要渲染 .docx / .xlsx / .pptx 得引一套文档内核(解析 + 排版),与「UI 复刻、功能自研」的取舍不一致。不装作能看,给真动作:"}),u.jsxs("div",{className:"pv-boundary-actions",children:[u.jsx("button",{className:"btn primary",onClick:()=>{Ne(!1)},children:"用系统应用打开"}),u.jsx("button",{className:"btn",onClick:()=>{Ne(!0)},children:"在 Finder 中显示"}),u.jsx("button",{className:"btn",onClick:()=>{we()},children:"复制路径"})]}),u.jsx("p",{className:"dim small",children:"「用系统应用打开」= POST /open-external 的 open <文件>(系统默认应用);「Finder 显示」= reveal 选中。"}),F===null?null:u.jsx("p",{className:"pv-note",children:F})]})]})}return u.jsxs("div",{className:"pv",children:[ce,pe?u.jsxs("div",{className:"pv-banner",children:[u.jsx("span",{className:"bi",children:"◈"}),u.jsx("span",{children:"磁盘上的文件已更新(版本对不上)"}),u.jsx("button",{className:"link-btn",onClick:()=>{De(1,!1)},children:"重载"}),u.jsx("span",{className:"grow"}),u.jsx("button",{className:"ib",title:"先不重载",onClick:()=>{I(null)},children:"✕"})]}):null,H!==null?u.jsxs("div",{className:"pv-empty err",children:["读不到:",H]}):null,H===null&&h===null&&$?u.jsx("div",{className:"pv-empty",children:"读取中…"}):null,H===null&&h!==null?ge==="markdown"?u.jsx("div",{className:"pv-body md",children:Kp(g)}):u.jsx("div",{className:z?"pv-body code wrap":"pv-body code",children:g.split(`
47
+ `).map((_e,ke)=>{const oe=v+ke,ye=c!==void 0&&oe===c;return u.jsxs("div",{className:ye?"cl target":"cl",ref:ye?te:void 0,children:[u.jsx("span",{className:"ln",children:oe}),u.jsx("span",{className:"lc",children:e4(_e).map((Ne,ct)=>Ne.cls===""?Ne.text:u.jsx("span",{className:`tok ${Ne.cls}`,children:Ne.text},ct))})]},ke)})}):null,h===null?null:u.jsxs("div",{className:"pv-more",children:[u.jsx("span",{children:x?`已加载 ${String(se)} 行 · 到文件末尾`:`已加载 ${String(se)} 行`}),j===null?null:u.jsxs("span",{className:"dim",children:["· ",QR(j)]}),x?null:u.jsx("button",{className:"link-btn",disabled:$,onClick:()=>{De(v+S,!0)},children:$?"读取中…":"加载更多"})]})]})}const k4=460;function N4({width:e,changed:t,refreshKey:i,root:r,forceSplit:a=!1,onCollapseTree:c,openTarget:h=null}){const[f,g]=C.useState(""),[m,v]=C.useState(null),[_,S]=C.useState(void 0),[y,x]=C.useState(null),[w,j]=C.useState(0),[N,M]=C.useState(null),[A,R]=C.useState(null),I=C.useRef(null),H=a||e>=k4,[O,$]=C.useState(()=>d4()),Q=C.useRef(null);C.useEffect(()=>{h!==null&&(v(h.rel??_R(h.path,r)),S(h.line>0?h.line:void 0),x(null))},[h,r]),C.useEffect(()=>()=>{I.current!==null&&clearTimeout(I.current)},[]);const z=te=>{R(te),I.current!==null&&clearTimeout(I.current),I.current=setTimeout(()=>{R(null)},1800)},G=u.jsxs("div",{className:f===""?"dock-search":"dock-search searching",children:[u.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.9",children:[u.jsx("circle",{cx:"11",cy:"11",r:"7"}),u.jsx("path",{d:"m20 20-3.5-3.5"})]}),u.jsx("input",{value:f,placeholder:"筛选文件…","aria-label":"筛选文件",onChange:te=>{g(te.target.value)},onKeyDown:te=>{te.key==="Escape"&&g("")}}),f===""?u.jsx("kbd",{children:"⌘P"}):u.jsx("button",{className:"clear",title:"清空 (Esc)",onClick:()=>{g("")},children:"✕"})]}),P=te=>{te.button===0&&(te.currentTarget.setPointerCapture(te.pointerId),Q.current={startX:te.clientX,startW:O})},L=te=>{Q.current!==null&&$(Gp(Q.current.startW+(te.clientX-Q.current.startX)))},F=te=>{if(Q.current!==null){Q.current=null;try{te.currentTarget.releasePointerCapture(te.pointerId)}catch{}GS(void 0,O)}},K=u.jsxs("div",{className:"tree-pane",style:a?{flex:`0 0 ${String(O)}px`,width:O}:void 0,children:[a?u.jsxs("div",{className:"pane-head tree-head",children:[u.jsx("span",{children:"文件树"}),u.jsx("span",{className:"grow"}),u.jsx("button",{className:"ib",title:"收起文件树(回双栏)","aria-label":"收起文件树",onClick:()=>{c?.()},children:"✕"})]}):null,G,y===null?null:u.jsx("div",{className:"tree-hint err",children:y}),u.jsx("div",{className:"tree-scroll",children:u.jsx(x4,{selected:m,onSelect:te=>{v(te),S(void 0)},changed:t,q:f.trim().toLowerCase(),refreshKey:i+w,onMenu:(te,ne,ge)=>{M({path:te,x:ne,y:ge})}})}),u.jsx("div",{className:"tree-foot",children:u.jsx("button",{className:"link-btn",onClick:()=>{j(te=>te+1)},children:"刷新目录"})})]}),q=m===null?null:u.jsx(C4,{path:m,narrow:!H,targetLine:_,onBack:()=>{v(null),x(null)},onNotice:x,onMenu:(te,ne,ge)=>{M({path:te,x:ne,y:ge})}});return u.jsxs("div",{className:["files-wrap",H?"split":"single",m===null?"no-pv":"has-pv",a?"force-split":""].join(" "),children:[K,a?u.jsx("span",{className:"dock-splitter tree-splitter",title:"拖动调整文件树宽度(双击复位 176)",role:"separator","aria-orientation":"vertical","aria-label":"拖动调整文件树宽度",onPointerDown:P,onPointerMove:L,onPointerUp:F,onPointerCancel:F,onDoubleClick:()=>{$(GS(void 0,176))}}):null,u.jsx("div",{className:"pv-slot",children:q??(a?u.jsxs("div",{className:"pv-empty",children:[u.jsx("span",{className:"dim",children:"选一个文件看预览"}),u.jsx("span",{className:"smaller",children:"三栏里中间这格是预览;树宽可拖(140–240),栏头 ✕ 收起回双栏"})]}):null)}),N===null?null:u.jsx(y4,{root:r,path:N.path,x:N.x,y:N.y,onClose:()=>{M(null)},onFeedback:z}),A===null?null:u.jsx("div",{className:"dock-toast",children:A})]})}var E4=2,j4=1,T4=class{activate(e){this._terminal=e}dispose(){}fit(){let e=this.proposeDimensions();if(!e||!this._terminal||isNaN(e.cols)||isNaN(e.rows))return;let t=this._terminal._core;(this._terminal.rows!==e.rows||this._terminal.cols!==e.cols)&&(t._renderService.clear(),this._terminal.resize(e.cols,e.rows))}proposeDimensions(){if(!this._terminal||!this._terminal.element||!this._terminal.element.parentElement)return;let e=this._terminal._core._renderService.dimensions;if(e.css.cell.width===0||e.css.cell.height===0)return;let t=this._terminal.options.scrollback===0?0:this._terminal.options.overviewRuler?.width||14,i=window.getComputedStyle(this._terminal.element.parentElement),r=parseInt(i.getPropertyValue("height")),a=Math.max(0,parseInt(i.getPropertyValue("width"))),c=window.getComputedStyle(this._terminal.element),h={top:parseInt(c.getPropertyValue("padding-top")),bottom:parseInt(c.getPropertyValue("padding-bottom")),right:parseInt(c.getPropertyValue("padding-right")),left:parseInt(c.getPropertyValue("padding-left"))},f=h.top+h.bottom,g=h.right+h.left,m=r-f,v=a-g-t;return{cols:Math.max(E4,Math.floor(v/e.css.cell.width)),rows:Math.max(j4,Math.floor(m/e.css.cell.height))}}};var Y1=Object.defineProperty,D4=Object.getOwnPropertyDescriptor,M4=(e,t)=>{for(var i in t)Y1(e,i,{get:t[i],enumerable:!0})},It=(e,t,i,r)=>{for(var a=r>1?void 0:r?D4(t,i):t,c=e.length-1,h;c>=0;c--)(h=e[c])&&(a=(r?h(t,i,a):h(a))||a);return r&&a&&Y1(t,i,a),a},Me=(e,t)=>(i,r)=>t(i,r,e),eb="Terminal input",Bm={get:()=>eb,set:e=>eb=e},tb="Too much output to announce, navigate to rows manually to read",Lm={get:()=>tb,set:e=>tb=e};function A4(e){return e.replace(/\r?\n/g,"\r")}function R4(e,t){return t?"\x1B[200~"+e+"\x1B[201~":e}function O4(e,t){e.clipboardData&&e.clipboardData.setData("text/plain",t.selectionText),e.preventDefault()}function B4(e,t,i,r){if(e.stopPropagation(),e.clipboardData){let a=e.clipboardData.getData("text/plain");W1(a,t,i,r)}}function W1(e,t,i,r){e=A4(e),e=R4(e,i.decPrivateModes.bracketedPasteMode&&r.rawOptions.ignoreBracketedPasteMode!==!0),i.triggerDataEvent(e,!0),t.value=""}function X1(e,t,i){let r=i.getBoundingClientRect(),a=e.clientX-r.left-10,c=e.clientY-r.top-10;t.style.width="20px",t.style.height="20px",t.style.left=`${a}px`,t.style.top=`${c}px`,t.style.zIndex="1000",t.focus()}function nb(e,t,i,r,a){X1(e,t,i),a&&r.rightClickSelect(e),t.value=r.selectionText,t.select()}function Vs(e){return e>65535?(e-=65536,String.fromCharCode((e>>10)+55296)+String.fromCharCode(e%1024+56320)):String.fromCharCode(e)}function qu(e,t=0,i=e.length){let r="";for(let a=t;a<i;++a){let c=e[a];c>65535?(c-=65536,r+=String.fromCharCode((c>>10)+55296)+String.fromCharCode(c%1024+56320)):r+=String.fromCharCode(c)}return r}var L4=class{constructor(){this._interim=0}clear(){this._interim=0}decode(e,t){let i=e.length;if(!i)return 0;let r=0,a=0;if(this._interim){let c=e.charCodeAt(a++);56320<=c&&c<=57343?t[r++]=(this._interim-55296)*1024+c-56320+65536:(t[r++]=this._interim,t[r++]=c),this._interim=0}for(let c=a;c<i;++c){let h=e.charCodeAt(c);if(55296<=h&&h<=56319){if(++c>=i)return this._interim=h,r;let f=e.charCodeAt(c);56320<=f&&f<=57343?t[r++]=(h-55296)*1024+f-56320+65536:(t[r++]=h,t[r++]=f);continue}h!==65279&&(t[r++]=h)}return r}},z4=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(e,t){let i=e.length;if(!i)return 0;let r=0,a,c,h,f,g=0,m=0;if(this.interim[0]){let S=!1,y=this.interim[0];y&=(y&224)===192?31:(y&240)===224?15:7;let x=0,w;for(;(w=this.interim[++x]&63)&&x<4;)y<<=6,y|=w;let j=(this.interim[0]&224)===192?2:(this.interim[0]&240)===224?3:4,N=j-x;for(;m<N;){if(m>=i)return 0;if(w=e[m++],(w&192)!==128){m--,S=!0;break}else this.interim[x++]=w,y<<=6,y|=w&63}S||(j===2?y<128?m--:t[r++]=y:j===3?y<2048||y>=55296&&y<=57343||y===65279||(t[r++]=y):y<65536||y>1114111||(t[r++]=y)),this.interim.fill(0)}let v=i-4,_=m;for(;_<i;){for(;_<v&&!((a=e[_])&128)&&!((c=e[_+1])&128)&&!((h=e[_+2])&128)&&!((f=e[_+3])&128);)t[r++]=a,t[r++]=c,t[r++]=h,t[r++]=f,_+=4;if(a=e[_++],a<128)t[r++]=a;else if((a&224)===192){if(_>=i)return this.interim[0]=a,r;if(c=e[_++],(c&192)!==128){_--;continue}if(g=(a&31)<<6|c&63,g<128){_--;continue}t[r++]=g}else if((a&240)===224){if(_>=i)return this.interim[0]=a,r;if(c=e[_++],(c&192)!==128){_--;continue}if(_>=i)return this.interim[0]=a,this.interim[1]=c,r;if(h=e[_++],(h&192)!==128){_--;continue}if(g=(a&15)<<12|(c&63)<<6|h&63,g<2048||g>=55296&&g<=57343||g===65279)continue;t[r++]=g}else if((a&248)===240){if(_>=i)return this.interim[0]=a,r;if(c=e[_++],(c&192)!==128){_--;continue}if(_>=i)return this.interim[0]=a,this.interim[1]=c,r;if(h=e[_++],(h&192)!==128){_--;continue}if(_>=i)return this.interim[0]=a,this.interim[1]=c,this.interim[2]=h,r;if(f=e[_++],(f&192)!==128){_--;continue}if(g=(a&7)<<18|(c&63)<<12|(h&63)<<6|f&63,g<65536||g>1114111)continue;t[r++]=g}}return r}},G1="",Ks=" ",yo=class Q1{constructor(){this.fg=0,this.bg=0,this.extended=new ju}static toColorRGB(t){return[t>>>16&255,t>>>8&255,t&255]}static fromColorRGB(t){return(t[0]&255)<<16|(t[1]&255)<<8|t[2]&255}clone(){let t=new Q1;return t.fg=this.fg,t.bg=this.bg,t.extended=this.extended.clone(),t}isInverse(){return this.fg&67108864}isBold(){return this.fg&134217728}isUnderline(){return this.hasExtendedAttrs()&&this.extended.underlineStyle!==0?1:this.fg&268435456}isBlink(){return this.fg&536870912}isInvisible(){return this.fg&1073741824}isItalic(){return this.bg&67108864}isDim(){return this.bg&134217728}isStrikethrough(){return this.fg&2147483648}isProtected(){return this.bg&536870912}isOverline(){return this.bg&1073741824}getFgColorMode(){return this.fg&50331648}getBgColorMode(){return this.bg&50331648}isFgRGB(){return(this.fg&50331648)===50331648}isBgRGB(){return(this.bg&50331648)===50331648}isFgPalette(){return(this.fg&50331648)===16777216||(this.fg&50331648)===33554432}isBgPalette(){return(this.bg&50331648)===16777216||(this.bg&50331648)===33554432}isFgDefault(){return(this.fg&50331648)===0}isBgDefault(){return(this.bg&50331648)===0}isAttributeDefault(){return this.fg===0&&this.bg===0}getFgColor(){switch(this.fg&50331648){case 16777216:case 33554432:return this.fg&255;case 50331648:return this.fg&16777215;default:return-1}}getBgColor(){switch(this.bg&50331648){case 16777216:case 33554432:return this.bg&255;case 50331648:return this.bg&16777215;default:return-1}}hasExtendedAttrs(){return this.bg&268435456}updateExtended(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456}getUnderlineColor(){if(this.bg&268435456&&~this.extended.underlineColor)switch(this.extended.underlineColor&50331648){case 16777216:case 33554432:return this.extended.underlineColor&255;case 50331648:return this.extended.underlineColor&16777215;default:return this.getFgColor()}return this.getFgColor()}getUnderlineColorMode(){return this.bg&268435456&&~this.extended.underlineColor?this.extended.underlineColor&50331648:this.getFgColorMode()}isUnderlineColorRGB(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===50331648:this.isFgRGB()}isUnderlineColorPalette(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===16777216||(this.extended.underlineColor&50331648)===33554432:this.isFgPalette()}isUnderlineColorDefault(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===0:this.isFgDefault()}getUnderlineStyle(){return this.fg&268435456?this.bg&268435456?this.extended.underlineStyle:1:0}getUnderlineVariantOffset(){return this.extended.underlineVariantOffset}},ju=class Z1{constructor(t=0,i=0){this._ext=0,this._urlId=0,this._ext=t,this._urlId=i}get ext(){return this._urlId?this._ext&-469762049|this.underlineStyle<<26:this._ext}set ext(t){this._ext=t}get underlineStyle(){return this._urlId?5:(this._ext&469762048)>>26}set underlineStyle(t){this._ext&=-469762049,this._ext|=t<<26&469762048}get underlineColor(){return this._ext&67108863}set underlineColor(t){this._ext&=-67108864,this._ext|=t&67108863}get urlId(){return this._urlId}set urlId(t){this._urlId=t}get underlineVariantOffset(){let t=(this._ext&3758096384)>>29;return t<0?t^4294967288:t}set underlineVariantOffset(t){this._ext&=536870911,this._ext|=t<<29&3758096384}clone(){return new Z1(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}},gi=class J1 extends yo{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new ju,this.combinedData=""}static fromCharData(t){let i=new J1;return i.setFromCharData(t),i}isCombined(){return this.content&2097152}getWidth(){return this.content>>22}getChars(){return this.content&2097152?this.combinedData:this.content&2097151?Vs(this.content&2097151):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):this.content&2097151}setFromCharData(t){this.fg=t[0],this.bg=0;let i=!1;if(t[1].length>2)i=!0;else if(t[1].length===2){let r=t[1].charCodeAt(0);if(55296<=r&&r<=56319){let a=t[1].charCodeAt(1);56320<=a&&a<=57343?this.content=(r-55296)*1024+a-56320+65536|t[2]<<22:i=!0}else i=!0}else this.content=t[1].charCodeAt(0)|t[2]<<22;i&&(this.combinedData=t[1],this.content=2097152|t[2]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},ib="di$target",zm="di$dependencies",Gf=new Map;function H4(e){return e[zm]||[]}function hn(e){if(Gf.has(e))return Gf.get(e);let t=function(i,r,a){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");I4(t,i,a)};return t._id=e,Gf.set(e,t),t}function I4(e,t,i){t[ib]===t?t[zm].push({id:e,index:i}):(t[zm]=[{id:e,index:i}],t[ib]=t)}var Rn=hn("BufferService"),ew=hn("CoreMouseService"),Lr=hn("CoreService"),U4=hn("CharsetService"),Qp=hn("InstantiationService"),tw=hn("LogService"),On=hn("OptionsService"),nw=hn("OscLinkService"),P4=hn("UnicodeService"),So=hn("DecorationService"),Hm=class{constructor(e,t,i){this._bufferService=e,this._optionsService=t,this._oscLinkService=i}provideLinks(e,t){let i=this._bufferService.buffer.lines.get(e-1);if(!i){t(void 0);return}let r=[],a=this._optionsService.rawOptions.linkHandler,c=new gi,h=i.getTrimmedLength(),f=-1,g=-1,m=!1;for(let v=0;v<h;v++)if(!(g===-1&&!i.hasContent(v))){if(i.loadCell(v,c),c.hasExtendedAttrs()&&c.extended.urlId)if(g===-1){g=v,f=c.extended.urlId;continue}else m=c.extended.urlId!==f;else g!==-1&&(m=!0);if(m||g!==-1&&v===h-1){let _=this._oscLinkService.getLinkData(f)?.uri;if(_){let S={start:{x:g+1,y:e},end:{x:v+(!m&&v===h-1?1:0),y:e}},y=!1;if(!a?.allowNonHttpProtocols)try{let x=new URL(_);["http:","https:"].includes(x.protocol)||(y=!0)}catch{y=!0}y||r.push({text:_,range:S,activate:(x,w)=>a?a.activate(x,w,S):q4(x,w),hover:(x,w)=>a?.hover?.(x,w,S),leave:(x,w)=>a?.leave?.(x,w,S)})}m=!1,c.hasExtendedAttrs()&&c.extended.urlId?(g=v,f=c.extended.urlId):(g=-1,f=-1)}}t(r)}};Hm=It([Me(0,Rn),Me(1,On),Me(2,nw)],Hm);function q4(e,t){if(confirm(`Do you want to navigate to ${t}?
48
+
49
+ WARNING: This link could potentially be dangerous`)){let i=window.open();if(i){try{i.opener=null}catch{}i.location.href=t}else console.warn("Opening link blocked as opener could not be cleared")}}var Fu=hn("CharSizeService"),fs=hn("CoreBrowserService"),Zp=hn("MouseService"),ms=hn("RenderService"),F4=hn("SelectionService"),iw=hn("CharacterJoinerService"),$l=hn("ThemeService"),sw=hn("LinkProviderService"),$4=class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?sb.isErrorNoTelemetry(e)?new sb(e.message+`
50
+
51
+ `+e.stack):new Error(e.message+`
52
+
53
+ `+e.stack):e},0)}}addListener(e){return this.listeners.push(e),()=>{this._removeListener(e)}}emit(e){this.listeners.forEach(t=>{t(e)})}_removeListener(e){this.listeners.splice(this.listeners.indexOf(e),1)}setUnexpectedErrorHandler(e){this.unexpectedErrorHandler=e}getUnexpectedErrorHandler(){return this.unexpectedErrorHandler}onUnexpectedError(e){this.unexpectedErrorHandler(e),this.emit(e)}onUnexpectedExternalError(e){this.unexpectedErrorHandler(e)}},V4=new $4;function pu(e){K4(e)||V4.onUnexpectedError(e)}var Im="Canceled";function K4(e){return e instanceof Y4?!0:e instanceof Error&&e.name===Im&&e.message===Im}var Y4=class extends Error{constructor(){super(Im),this.name=this.message}};function W4(e){return new Error(`Illegal argument: ${e}`)}var sb=class Um extends Error{constructor(t){super(t),this.name="CodeExpectedError"}static fromError(t){if(t instanceof Um)return t;let i=new Um;return i.message=t.message,i.stack=t.stack,i}static isErrorNoTelemetry(t){return t.name==="CodeExpectedError"}},Pm=class rw extends Error{constructor(t){super(t||"An unexpected bug occurred."),Object.setPrototypeOf(this,rw.prototype)}};function Jn(e,t=0){return e[e.length-(1+t)]}var X4;(e=>{function t(c){return c<0}e.isLessThan=t;function i(c){return c<=0}e.isLessThanOrEqual=i;function r(c){return c>0}e.isGreaterThan=r;function a(c){return c===0}e.isNeitherLessOrGreaterThan=a,e.greaterThan=1,e.lessThan=-1,e.neitherLessOrGreaterThan=0})(X4||={});function G4(e,t){let i=this,r=!1,a;return function(){return r||(r=!0,t||(a=e.apply(i,arguments))),a}}var lw;(e=>{function t(R){return R&&typeof R=="object"&&typeof R[Symbol.iterator]=="function"}e.is=t;let i=Object.freeze([]);function r(){return i}e.empty=r;function*a(R){yield R}e.single=a;function c(R){return t(R)?R:a(R)}e.wrap=c;function h(R){return R||i}e.from=h;function*f(R){for(let I=R.length-1;I>=0;I--)yield R[I]}e.reverse=f;function g(R){return!R||R[Symbol.iterator]().next().done===!0}e.isEmpty=g;function m(R){return R[Symbol.iterator]().next().value}e.first=m;function v(R,I){let H=0;for(let O of R)if(I(O,H++))return!0;return!1}e.some=v;function _(R,I){for(let H of R)if(I(H))return H}e.find=_;function*S(R,I){for(let H of R)I(H)&&(yield H)}e.filter=S;function*y(R,I){let H=0;for(let O of R)yield I(O,H++)}e.map=y;function*x(R,I){let H=0;for(let O of R)yield*I(O,H++)}e.flatMap=x;function*w(...R){for(let I of R)yield*I}e.concat=w;function j(R,I,H){let O=H;for(let $ of R)O=I(O,$);return O}e.reduce=j;function*N(R,I,H=R.length){for(I<0&&(I+=R.length),H<0?H+=R.length:H>R.length&&(H=R.length);I<H;I++)yield R[I]}e.slice=N;function M(R,I=Number.POSITIVE_INFINITY){let H=[];if(I===0)return[H,R];let O=R[Symbol.iterator]();for(let $=0;$<I;$++){let Q=O.next();if(Q.done)return[H,e.empty()];H.push(Q.value)}return[H,{[Symbol.iterator](){return O}}]}e.consume=M;async function A(R){let I=[];for await(let H of R)I.push(H);return Promise.resolve(I)}e.asyncToArray=A})(lw||={});function Rr(e){if(lw.is(e)){let t=[];for(let i of e)if(i)try{i.dispose()}catch(r){t.push(r)}if(t.length===1)throw t[0];if(t.length>1)throw new AggregateError(t,"Encountered errors while disposing of store");return Array.isArray(e)?[]:e}else if(e)return e.dispose(),e}function Q4(...e){return At(()=>Rr(e))}function At(e){return{dispose:G4(()=>{e()})}}var aw=class ow{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{Rr(this._toDispose)}finally{this._toDispose.clear()}}add(t){if(!t)return t;if(t===this)throw new Error("Cannot register a disposable on itself!");return this._isDisposed?ow.DISABLE_DISPOSED_WARNING||console.warn(new Error("Trying to add a disposable to a DisposableStore that has already been disposed of. The added object will be leaked!").stack):this._toDispose.add(t),t}delete(t){if(t){if(t===this)throw new Error("Cannot dispose a disposable on itself!");this._toDispose.delete(t),t.dispose()}}deleteAndLeak(t){t&&this._toDispose.has(t)&&(this._toDispose.delete(t),void 0)}};aw.DISABLE_DISPOSED_WARNING=!1;var Ys=aw,it=class{constructor(){this._store=new Ys,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)}};it.None=Object.freeze({dispose(){}});var Pl=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}},hs=typeof window=="object"?window:globalThis,qm=class Fm{constructor(t){this.element=t,this.next=Fm.Undefined,this.prev=Fm.Undefined}};qm.Undefined=new qm(void 0);var Ot=qm,rb=class{constructor(){this._first=Ot.Undefined,this._last=Ot.Undefined,this._size=0}get size(){return this._size}isEmpty(){return this._first===Ot.Undefined}clear(){let e=this._first;for(;e!==Ot.Undefined;){let t=e.next;e.prev=Ot.Undefined,e.next=Ot.Undefined,e=t}this._first=Ot.Undefined,this._last=Ot.Undefined,this._size=0}unshift(e){return this._insert(e,!1)}push(e){return this._insert(e,!0)}_insert(e,t){let i=new Ot(e);if(this._first===Ot.Undefined)this._first=i,this._last=i;else if(t){let a=this._last;this._last=i,i.prev=a,a.next=i}else{let a=this._first;this._first=i,i.next=a,a.prev=i}this._size+=1;let r=!1;return()=>{r||(r=!0,this._remove(i))}}shift(){if(this._first!==Ot.Undefined){let e=this._first.element;return this._remove(this._first),e}}pop(){if(this._last!==Ot.Undefined){let e=this._last.element;return this._remove(this._last),e}}_remove(e){if(e.prev!==Ot.Undefined&&e.next!==Ot.Undefined){let t=e.prev;t.next=e.next,e.next.prev=t}else e.prev===Ot.Undefined&&e.next===Ot.Undefined?(this._first=Ot.Undefined,this._last=Ot.Undefined):e.next===Ot.Undefined?(this._last=this._last.prev,this._last.next=Ot.Undefined):e.prev===Ot.Undefined&&(this._first=this._first.next,this._first.prev=Ot.Undefined);this._size-=1}*[Symbol.iterator](){let e=this._first;for(;e!==Ot.Undefined;)yield e.element,e=e.next}},Z4=globalThis.performance&&typeof globalThis.performance.now=="function",J4=class cw{static create(t){return new cw(t)}constructor(t){this._now=Z4&&t===!1?Date.now:globalThis.performance.now.bind(globalThis.performance),this._startTime=this._now(),this._stopTime=-1}stop(){this._stopTime=this._now()}reset(){this._startTime=this._now(),this._stopTime=-1}elapsed(){return this._stopTime!==-1?this._stopTime-this._startTime:this._now()-this._startTime}},bn;(e=>{e.None=()=>it.None;function t(P,L){return _(P,()=>{},0,void 0,!0,void 0,L)}e.defer=t;function i(P){return(L,F=null,K)=>{let q=!1,te;return te=P(ne=>{if(!q)return te?te.dispose():q=!0,L.call(F,ne)},null,K),q&&te.dispose(),te}}e.once=i;function r(P,L,F){return m((K,q=null,te)=>P(ne=>K.call(q,L(ne)),null,te),F)}e.map=r;function a(P,L,F){return m((K,q=null,te)=>P(ne=>{L(ne),K.call(q,ne)},null,te),F)}e.forEach=a;function c(P,L,F){return m((K,q=null,te)=>P(ne=>L(ne)&&K.call(q,ne),null,te),F)}e.filter=c;function h(P){return P}e.signal=h;function f(...P){return(L,F=null,K)=>{let q=Q4(...P.map(te=>te(ne=>L.call(F,ne))));return v(q,K)}}e.any=f;function g(P,L,F,K){let q=F;return r(P,te=>(q=L(q,te),q),K)}e.reduce=g;function m(P,L){let F,K={onWillAddFirstListener(){F=P(q.fire,q)},onDidRemoveLastListener(){F?.dispose()}},q=new Ce(K);return L?.add(q),q.event}function v(P,L){return L instanceof Array?L.push(P):L&&L.add(P),P}function _(P,L,F=100,K=!1,q=!1,te,ne){let ge,D,De,we=0,T,E={leakWarningThreshold:te,onWillAddFirstListener(){ge=P(se=>{we++,D=L(D,se),K&&!De&&(J.fire(D),D=void 0),T=()=>{let pe=D;D=void 0,De=void 0,(!K||we>1)&&J.fire(pe),we=0},typeof F=="number"?(clearTimeout(De),De=setTimeout(T,F)):De===void 0&&(De=0,queueMicrotask(T))})},onWillRemoveListener(){q&&we>0&&T?.()},onDidRemoveLastListener(){T=void 0,ge.dispose()}},J=new Ce(E);return ne?.add(J),J.event}e.debounce=_;function S(P,L=0,F){return e.debounce(P,(K,q)=>K?(K.push(q),K):[q],L,void 0,!0,void 0,F)}e.accumulate=S;function y(P,L=(K,q)=>K===q,F){let K=!0,q;return c(P,te=>{let ne=K||!L(te,q);return K=!1,q=te,ne},F)}e.latch=y;function x(P,L,F){return[e.filter(P,L,F),e.filter(P,K=>!L(K),F)]}e.split=x;function w(P,L=!1,F=[],K){let q=F.slice(),te=P(D=>{q?q.push(D):ge.fire(D)});K&&K.add(te);let ne=()=>{q?.forEach(D=>ge.fire(D)),q=null},ge=new Ce({onWillAddFirstListener(){te||(te=P(D=>ge.fire(D)),K&&K.add(te))},onDidAddFirstListener(){q&&(L?setTimeout(ne):ne())},onDidRemoveLastListener(){te&&te.dispose(),te=null}});return K&&K.add(ge),ge.event}e.buffer=w;function j(P,L){return(F,K,q)=>{let te=L(new M);return P(function(ne){let ge=te.evaluate(ne);ge!==N&&F.call(K,ge)},void 0,q)}}e.chain=j;let N=Symbol("HaltChainable");class M{constructor(){this.steps=[]}map(L){return this.steps.push(L),this}forEach(L){return this.steps.push(F=>(L(F),F)),this}filter(L){return this.steps.push(F=>L(F)?F:N),this}reduce(L,F){let K=F;return this.steps.push(q=>(K=L(K,q),K)),this}latch(L=(F,K)=>F===K){let F=!0,K;return this.steps.push(q=>{let te=F||!L(q,K);return F=!1,K=q,te?q:N}),this}evaluate(L){for(let F of this.steps)if(L=F(L),L===N)break;return L}}function A(P,L,F=K=>K){let K=(...ge)=>ne.fire(F(...ge)),q=()=>P.on(L,K),te=()=>P.removeListener(L,K),ne=new Ce({onWillAddFirstListener:q,onDidRemoveLastListener:te});return ne.event}e.fromNodeEventEmitter=A;function R(P,L,F=K=>K){let K=(...ge)=>ne.fire(F(...ge)),q=()=>P.addEventListener(L,K),te=()=>P.removeEventListener(L,K),ne=new Ce({onWillAddFirstListener:q,onDidRemoveLastListener:te});return ne.event}e.fromDOMEventEmitter=R;function I(P){return new Promise(L=>i(P)(L))}e.toPromise=I;function H(P){let L=new Ce;return P.then(F=>{L.fire(F)},()=>{L.fire(void 0)}).finally(()=>{L.dispose()}),L.event}e.fromPromise=H;function O(P,L){return P(F=>L.fire(F))}e.forward=O;function $(P,L,F){return L(F),P(K=>L(K))}e.runAndSubscribe=$;class Q{constructor(L,F){this._observable=L,this._counter=0,this._hasChanged=!1;let K={onWillAddFirstListener:()=>{L.addObserver(this)},onDidRemoveLastListener:()=>{L.removeObserver(this)}};this.emitter=new Ce(K),F&&F.add(this.emitter)}beginUpdate(L){this._counter++}handlePossibleChange(L){}handleChange(L,F){this._hasChanged=!0}endUpdate(L){this._counter--,this._counter===0&&(this._observable.reportChanges(),this._hasChanged&&(this._hasChanged=!1,this.emitter.fire(this._observable.get())))}}function z(P,L){return new Q(P,L).emitter.event}e.fromObservable=z;function G(P){return(L,F,K)=>{let q=0,te=!1,ne={beginUpdate(){q++},endUpdate(){q--,q===0&&(P.reportChanges(),te&&(te=!1,L.call(F)))},handlePossibleChange(){},handleChange(){te=!0}};P.addObserver(ne),P.reportChanges();let ge={dispose(){P.removeObserver(ne)}};return K instanceof Ys?K.add(ge):Array.isArray(K)&&K.push(ge),ge}}e.fromObservableLight=G})(bn||={});var $m=class Vm{constructor(t){this.listenerCount=0,this.invocationCount=0,this.elapsedOverall=0,this.durations=[],this.name=`${t}_${Vm._idPool++}`,Vm.all.add(this)}start(t){this._stopWatch=new J4,this.listenerCount=t}stop(){if(this._stopWatch){let t=this._stopWatch.elapsed();this.durations.push(t),this.elapsedOverall+=t,this.invocationCount+=1,this._stopWatch=void 0}}};$m.all=new Set,$m._idPool=0;var e5=$m,t5=-1,uw=class hw{constructor(t,i,r=(hw._idPool++).toString(16).padStart(3,"0")){this._errorHandler=t,this.threshold=i,this.name=r,this._warnCountdown=0}dispose(){this._stacks?.clear()}check(t,i){let r=this.threshold;if(r<=0||i<r)return;this._stacks||(this._stacks=new Map);let a=this._stacks.get(t.value)||0;if(this._stacks.set(t.value,a+1),this._warnCountdown-=1,this._warnCountdown<=0){this._warnCountdown=r*.5;let[c,h]=this.getMostFrequentStack(),f=`[${this.name}] potential listener LEAK detected, having ${i} listeners already. MOST frequent listener (${h}):`;console.warn(f),console.warn(c);let g=new s5(f,c);this._errorHandler(g)}return()=>{let c=this._stacks.get(t.value)||0;this._stacks.set(t.value,c-1)}}getMostFrequentStack(){if(!this._stacks)return;let t,i=0;for(let[r,a]of this._stacks)(!t||i<a)&&(t=[r,a],i=a);return t}};uw._idPool=1;var n5=uw,i5=class dw{constructor(t){this.value=t}static create(){let t=new Error;return new dw(t.stack??"")}print(){console.warn(this.value.split(`
54
+ `).slice(2).join(`
55
+ `))}},s5=class extends Error{constructor(e,t){super(e),this.name="ListenerLeakError",this.stack=t}},r5=class extends Error{constructor(e,t){super(e),this.name="ListenerRefusalError",this.stack=t}},l5=0,Qf=class{constructor(e){this.value=e,this.id=l5++}},a5=2,o5,Ce=class{constructor(e){this._size=0,this._options=e,this._leakageMon=this._options?.leakWarningThreshold?new n5(e?.onListenerError??pu,this._options?.leakWarningThreshold??t5):void 0,this._perfMon=this._options?._profName?new e5(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,t,i)=>{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],g=new r5(`${h}. HINT: Stack shows most frequent listener (${f[1]}-times)`,f[0]);return(this._options?.onListenerError||pu)(g),it.None}if(this._disposed)return it.None;t&&(e=e.bind(t));let r=new Qf(e),a;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(r.stack=i5.create(),a=this._leakageMon.check(r.stack,this._size+1)),this._listeners?this._listeners instanceof Qf?(this._deliveryQueue??=new c5,this._listeners=[this._listeners,r]):this._listeners.push(r):(this._options?.onWillAddFirstListener?.(this),this._listeners=r,this._options?.onDidAddFirstListener?.(this)),this._size++;let c=At(()=>{a?.(),this._removeListener(r)});return i instanceof Ys?i.add(c):Array.isArray(i)&&i.push(c),c},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 t=this._listeners,i=t.indexOf(e);if(i===-1)throw console.log("disposed?",this._disposed),console.log("size?",this._size),console.log("arr?",JSON.stringify(this._listeners)),new Error("Attempted to dispose unknown listener");this._size--,t[i]=void 0;let r=this._deliveryQueue.current===this;if(this._size*a5<=t.length){let a=0;for(let c=0;c<t.length;c++)t[c]?t[a++]=t[c]:r&&(this._deliveryQueue.end--,a<this._deliveryQueue.i&&this._deliveryQueue.i--);t.length=a}}_deliver(e,t){if(!e)return;let i=this._options?.onListenerError||pu;if(!i){e.value(t);return}try{e.value(t)}catch(r){i(r)}}_deliverQueue(e){let t=e.current._listeners;for(;e.i<e.end;)this._deliver(t[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 Qf)this._deliver(this._listeners,e);else{let t=this._deliveryQueue;t.enqueue(this,e,this._listeners.length),this._deliverQueue(t)}this._perfMon?.stop()}hasListeners(){return this._size>0}},c5=class{constructor(){this.i=-1,this.end=0}enqueue(e,t,i){this.i=0,this.end=i,this.current=e,this.value=t}reset(){this.i=this.end,this.current=void 0,this.value=void 0}},Km=class{constructor(){this.mapWindowIdToZoomLevel=new Map,this._onDidChangeZoomLevel=new Ce,this.onDidChangeZoomLevel=this._onDidChangeZoomLevel.event,this.mapWindowIdToZoomFactor=new Map,this._onDidChangeFullscreen=new Ce,this.onDidChangeFullscreen=this._onDidChangeFullscreen.event,this.mapWindowIdToFullScreen=new Map}getZoomLevel(t){return this.mapWindowIdToZoomLevel.get(this.getWindowId(t))??0}setZoomLevel(t,i){if(this.getZoomLevel(i)===t)return;let r=this.getWindowId(i);this.mapWindowIdToZoomLevel.set(r,t),this._onDidChangeZoomLevel.fire(r)}getZoomFactor(t){return this.mapWindowIdToZoomFactor.get(this.getWindowId(t))??1}setZoomFactor(t,i){this.mapWindowIdToZoomFactor.set(this.getWindowId(i),t)}setFullscreen(t,i){if(this.isFullscreen(i)===t)return;let r=this.getWindowId(i);this.mapWindowIdToFullScreen.set(r,t),this._onDidChangeFullscreen.fire(r)}isFullscreen(t){return!!this.mapWindowIdToFullScreen.get(this.getWindowId(t))}getWindowId(t){return t.vscodeWindowId}};Km.INSTANCE=new Km;var Jp=Km;function u5(e,t,i){typeof t=="string"&&(t=e.matchMedia(t)),t.addEventListener("change",i)}Jp.INSTANCE.onDidChangeZoomLevel;function h5(e){return Jp.INSTANCE.getZoomFactor(e)}Jp.INSTANCE.onDidChangeFullscreen;var Vl=typeof navigator=="object"?navigator.userAgent:"",Ym=Vl.indexOf("Firefox")>=0,d5=Vl.indexOf("AppleWebKit")>=0,eg=Vl.indexOf("Chrome")>=0,f5=!eg&&Vl.indexOf("Safari")>=0;Vl.indexOf("Electron/")>=0;Vl.indexOf("Android")>=0;var Zf=!1;if(typeof hs.matchMedia=="function"){let e=hs.matchMedia("(display-mode: standalone) or (display-mode: window-controls-overlay)"),t=hs.matchMedia("(display-mode: fullscreen)");Zf=e.matches,u5(hs,e,({matches:i})=>{Zf&&t.matches||(Zf=i)})}var zl="en",Wm=!1,Xm=!1,gu=!1,fw=!1,tu,_u=zl,lb=zl,m5,us,Mr=globalThis,ni;typeof Mr.vscode<"u"&&typeof Mr.vscode.process<"u"?ni=Mr.vscode.process:typeof process<"u"&&typeof process?.versions?.node=="string"&&(ni=process);var p5=typeof ni?.versions?.electron=="string",g5=p5&&ni?.type==="renderer";if(typeof ni=="object"){Wm=ni.platform==="win32",Xm=ni.platform==="darwin",gu=ni.platform==="linux",gu&&ni.env.SNAP&&ni.env.SNAP_REVISION,ni.env.CI||ni.env.BUILD_ARTIFACTSTAGINGDIRECTORY,tu=zl,_u=zl;let e=ni.env.VSCODE_NLS_CONFIG;if(e)try{let t=JSON.parse(e);tu=t.userLocale,lb=t.osLocale,_u=t.resolvedLanguage||zl,m5=t.languagePack?.translationsConfigFile}catch{}fw=!0}else typeof navigator=="object"&&!g5?(us=navigator.userAgent,Wm=us.indexOf("Windows")>=0,Xm=us.indexOf("Macintosh")>=0,(us.indexOf("Macintosh")>=0||us.indexOf("iPad")>=0||us.indexOf("iPhone")>=0)&&navigator.maxTouchPoints&&navigator.maxTouchPoints>0,gu=us.indexOf("Linux")>=0,us?.indexOf("Mobi")>=0,_u=globalThis._VSCODE_NLS_LANGUAGE||zl,tu=navigator.language.toLowerCase(),lb=tu):console.error("Unable to resolve platform.");var mw=Wm,Vi=Xm,_5=gu,ab=fw,Ki=us,qs=_u,v5;(e=>{function t(){return qs}e.value=t;function i(){return qs.length===2?qs==="en":qs.length>=3?qs[0]==="e"&&qs[1]==="n"&&qs[2]==="-":!1}e.isDefaultVariant=i;function r(){return qs==="en"}e.isDefault=r})(v5||={});var y5=typeof Mr.postMessage=="function"&&!Mr.importScripts;(()=>{if(y5){let e=[];Mr.addEventListener("message",i=>{if(i.data&&i.data.vscodeScheduleAsyncWork)for(let r=0,a=e.length;r<a;r++){let c=e[r];if(c.id===i.data.vscodeScheduleAsyncWork){e.splice(r,1),c.callback();return}}});let t=0;return i=>{let r=++t;e.push({id:r,callback:i}),Mr.postMessage({vscodeScheduleAsyncWork:r},"*")}}return e=>setTimeout(e)})();var S5=!!(Ki&&Ki.indexOf("Chrome")>=0);Ki&&Ki.indexOf("Firefox")>=0;!S5&&Ki&&Ki.indexOf("Safari")>=0;Ki&&Ki.indexOf("Edg/")>=0;Ki&&Ki.indexOf("Android")>=0;var Dl=typeof navigator=="object"?navigator:{};ab||document.queryCommandSupported&&document.queryCommandSupported("copy")||Dl&&Dl.clipboard&&Dl.clipboard.writeText,ab||Dl&&Dl.clipboard&&Dl.clipboard.readText;var tg=class{constructor(){this._keyCodeToStr=[],this._strToKeyCode=Object.create(null)}define(e,t){this._keyCodeToStr[e]=t,this._strToKeyCode[t.toLowerCase()]=e}keyCodeToStr(e){return this._keyCodeToStr[e]}strToKeyCode(e){return this._strToKeyCode[e.toLowerCase()]||0}},Jf=new tg,ob=new tg,cb=new tg,b5=new Array(230),pw;(e=>{function t(f){return Jf.keyCodeToStr(f)}e.toString=t;function i(f){return Jf.strToKeyCode(f)}e.fromString=i;function r(f){return ob.keyCodeToStr(f)}e.toUserSettingsUS=r;function a(f){return cb.keyCodeToStr(f)}e.toUserSettingsGeneral=a;function c(f){return ob.strToKeyCode(f)||cb.strToKeyCode(f)}e.fromUserSettings=c;function h(f){if(f>=98&&f<=113)return null;switch(f){case 16:return"Up";case 18:return"Down";case 15:return"Left";case 17:return"Right"}return Jf.keyCodeToStr(f)}e.toElectronAccelerator=h})(pw||={});var x5=class gw{constructor(t,i,r,a,c){this.ctrlKey=t,this.shiftKey=i,this.altKey=r,this.metaKey=a,this.keyCode=c}equals(t){return t instanceof gw&&this.ctrlKey===t.ctrlKey&&this.shiftKey===t.shiftKey&&this.altKey===t.altKey&&this.metaKey===t.metaKey&&this.keyCode===t.keyCode}getHashCode(){let t=this.ctrlKey?"1":"0",i=this.shiftKey?"1":"0",r=this.altKey?"1":"0",a=this.metaKey?"1":"0";return`K${t}${i}${r}${a}${this.keyCode}`}isModifierKey(){return this.keyCode===0||this.keyCode===5||this.keyCode===57||this.keyCode===6||this.keyCode===4}toKeybinding(){return new w5([this])}isDuplicateModifierCase(){return this.ctrlKey&&this.keyCode===5||this.shiftKey&&this.keyCode===4||this.altKey&&this.keyCode===6||this.metaKey&&this.keyCode===57}},w5=class{constructor(e){if(e.length===0)throw W4("chords");this.chords=e}getHashCode(){let e="";for(let t=0,i=this.chords.length;t<i;t++)t!==0&&(e+=";"),e+=this.chords[t].getHashCode();return e}equals(e){if(e===null||this.chords.length!==e.chords.length)return!1;for(let t=0;t<this.chords.length;t++)if(!this.chords[t].equals(e.chords[t]))return!1;return!0}};function C5(e){if(e.charCode){let i=String.fromCharCode(e.charCode).toUpperCase();return pw.fromString(i)}let t=e.keyCode;if(t===3)return 7;if(Ym)switch(t){case 59:return 85;case 60:if(_5)return 97;break;case 61:return 86;case 107:return 109;case 109:return 111;case 173:return 88;case 224:if(Vi)return 57;break}else if(d5&&(Vi&&t===93||!Vi&&t===92))return 57;return b5[t]||0}var k5=Vi?256:2048,N5=512,E5=1024,j5=Vi?2048:256,ub=class{constructor(e){this._standardKeyboardEventBrand=!0;let t=e;this.browserEvent=t,this.target=t.target,this.ctrlKey=t.ctrlKey,this.shiftKey=t.shiftKey,this.altKey=t.altKey,this.metaKey=t.metaKey,this.altGraphKey=t.getModifierState?.("AltGraph"),this.keyCode=C5(t),this.code=t.code,this.ctrlKey=this.ctrlKey||this.keyCode===5,this.altKey=this.altKey||this.keyCode===6,this.shiftKey=this.shiftKey||this.keyCode===4,this.metaKey=this.metaKey||this.keyCode===57,this._asKeybinding=this._computeKeybinding(),this._asKeyCodeChord=this._computeKeyCodeChord()}preventDefault(){this.browserEvent&&this.browserEvent.preventDefault&&this.browserEvent.preventDefault()}stopPropagation(){this.browserEvent&&this.browserEvent.stopPropagation&&this.browserEvent.stopPropagation()}toKeyCodeChord(){return this._asKeyCodeChord}equals(e){return this._asKeybinding===e}_computeKeybinding(){let e=0;this.keyCode!==5&&this.keyCode!==4&&this.keyCode!==6&&this.keyCode!==57&&(e=this.keyCode);let t=0;return this.ctrlKey&&(t|=k5),this.altKey&&(t|=N5),this.shiftKey&&(t|=E5),this.metaKey&&(t|=j5),t|=e,t}_computeKeyCodeChord(){let e=0;return this.keyCode!==5&&this.keyCode!==4&&this.keyCode!==6&&this.keyCode!==57&&(e=this.keyCode),new x5(this.ctrlKey,this.shiftKey,this.altKey,this.metaKey,e)}},hb=new WeakMap;function T5(e){if(!e.parent||e.parent===e)return null;try{let t=e.location,i=e.parent.location;if(t.origin!=="null"&&i.origin!=="null"&&t.origin!==i.origin)return null}catch{return null}return e.parent}var D5=class{static getSameOriginWindowChain(e){let t=hb.get(e);if(!t){t=[],hb.set(e,t);let i=e,r;do r=T5(i),r?t.push({window:new WeakRef(i),iframeElement:i.frameElement||null}):t.push({window:new WeakRef(i),iframeElement:null}),i=r;while(i)}return t.slice(0)}static getPositionOfChildWindowRelativeToAncestorWindow(e,t){if(!t||e===t)return{top:0,left:0};let i=0,r=0,a=this.getSameOriginWindowChain(e);for(let c of a){let h=c.window.deref();if(i+=h?.scrollY??0,r+=h?.scrollX??0,h===t||!c.iframeElement)break;let f=c.iframeElement.getBoundingClientRect();i+=f.top,r+=f.left}return{top:i,left:r}}},nu=class{constructor(e,t){this.timestamp=Date.now(),this.browserEvent=t,this.leftButton=t.button===0,this.middleButton=t.button===1,this.rightButton=t.button===2,this.buttons=t.buttons,this.target=t.target,this.detail=t.detail||1,t.type==="dblclick"&&(this.detail=2),this.ctrlKey=t.ctrlKey,this.shiftKey=t.shiftKey,this.altKey=t.altKey,this.metaKey=t.metaKey,typeof t.pageX=="number"?(this.posx=t.pageX,this.posy=t.pageY):(this.posx=t.clientX+this.target.ownerDocument.body.scrollLeft+this.target.ownerDocument.documentElement.scrollLeft,this.posy=t.clientY+this.target.ownerDocument.body.scrollTop+this.target.ownerDocument.documentElement.scrollTop);let i=D5.getPositionOfChildWindowRelativeToAncestorWindow(e,t.view);this.posx-=i.left,this.posy-=i.top}preventDefault(){this.browserEvent.preventDefault()}stopPropagation(){this.browserEvent.stopPropagation()}},db=class{constructor(e,t=0,i=0){this.browserEvent=e||null,this.target=e?e.target||e.targetNode||e.srcElement:null,this.deltaY=i,this.deltaX=t;let r=!1;if(eg){let a=navigator.userAgent.match(/Chrome\/(\d+)/);r=(a?parseInt(a[1]):123)<=122}if(e){let a=e,c=e,h=e.view?.devicePixelRatio||1;if(typeof a.wheelDeltaY<"u")r?this.deltaY=a.wheelDeltaY/(120*h):this.deltaY=a.wheelDeltaY/120;else if(typeof c.VERTICAL_AXIS<"u"&&c.axis===c.VERTICAL_AXIS)this.deltaY=-c.detail/3;else if(e.type==="wheel"){let f=e;f.deltaMode===f.DOM_DELTA_LINE?Ym&&!Vi?this.deltaY=-e.deltaY/3:this.deltaY=-e.deltaY:this.deltaY=-e.deltaY/40}if(typeof a.wheelDeltaX<"u")f5&&mw?this.deltaX=-(a.wheelDeltaX/120):r?this.deltaX=a.wheelDeltaX/(120*h):this.deltaX=a.wheelDeltaX/120;else if(typeof c.HORIZONTAL_AXIS<"u"&&c.axis===c.HORIZONTAL_AXIS)this.deltaX=-e.detail/3;else if(e.type==="wheel"){let f=e;f.deltaMode===f.DOM_DELTA_LINE?Ym&&!Vi?this.deltaX=-e.deltaX/3:this.deltaX=-e.deltaX:this.deltaX=-e.deltaX/40}this.deltaY===0&&this.deltaX===0&&e.wheelDelta&&(r?this.deltaY=e.wheelDelta/(120*h):this.deltaY=e.wheelDelta/120)}}preventDefault(){this.browserEvent?.preventDefault()}stopPropagation(){this.browserEvent?.stopPropagation()}},_w=Object.freeze(function(e,t){let i=setTimeout(e.bind(t),0);return{dispose(){clearTimeout(i)}}}),M5;(e=>{function t(i){return i===e.None||i===e.Cancelled||i instanceof A5?!0:!i||typeof i!="object"?!1:typeof i.isCancellationRequested=="boolean"&&typeof i.onCancellationRequested=="function"}e.isCancellationToken=t,e.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:bn.None}),e.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:_w})})(M5||={});var A5=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?_w:(this._emitter||(this._emitter=new Ce),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=null)}},ng=class{constructor(e,t){this._isDisposed=!1,this._token=-1,typeof e=="function"&&typeof t=="number"&&this.setIfNotSet(e,t)}dispose(){this.cancel(),this._isDisposed=!0}cancel(){this._token!==-1&&(clearTimeout(this._token),this._token=-1)}cancelAndSet(e,t){if(this._isDisposed)throw new Pm("Calling 'cancelAndSet' on a disposed TimeoutTimer");this.cancel(),this._token=setTimeout(()=>{this._token=-1,e()},t)}setIfNotSet(e,t){if(this._isDisposed)throw new Pm("Calling 'setIfNotSet' on a disposed TimeoutTimer");this._token===-1&&(this._token=setTimeout(()=>{this._token=-1,e()},t))}},R5=class{constructor(){this.disposable=void 0,this.isDisposed=!1}cancel(){this.disposable?.dispose(),this.disposable=void 0}cancelAndSet(e,t,i=globalThis){if(this.isDisposed)throw new Pm("Calling 'cancelAndSet' on a disposed IntervalTimer");this.cancel();let r=i.setInterval(()=>{e()},t);this.disposable=At(()=>{i.clearInterval(r),this.disposable=void 0})}dispose(){this.cancel(),this.isDisposed=!0}},O5;(e=>{async function t(r){let a,c=await Promise.all(r.map(h=>h.then(f=>f,f=>{a||(a=f)})));if(typeof a<"u")throw a;return c}e.settled=t;function i(r){return new Promise(async(a,c)=>{try{await r(a,c)}catch(h){c(h)}})}e.withAsyncBody=i})(O5||={});var fb=class fi{static fromArray(t){return new fi(i=>{i.emitMany(t)})}static fromPromise(t){return new fi(async i=>{i.emitMany(await t)})}static fromPromises(t){return new fi(async i=>{await Promise.all(t.map(async r=>i.emitOne(await r)))})}static merge(t){return new fi(async i=>{await Promise.all(t.map(async r=>{for await(let a of r)i.emitOne(a)}))})}constructor(t,i){this._state=0,this._results=[],this._error=null,this._onReturn=i,this._onStateChanged=new Ce,queueMicrotask(async()=>{let r={emitOne:a=>this.emitOne(a),emitMany:a=>this.emitMany(a),reject:a=>this.reject(a)};try{await Promise.resolve(t(r)),this.resolve()}catch(a){this.reject(a)}finally{r.emitOne=void 0,r.emitMany=void 0,r.reject=void 0}})}[Symbol.asyncIterator](){let t=0;return{next:async()=>{do{if(this._state===2)throw this._error;if(t<this._results.length)return{done:!1,value:this._results[t++]};if(this._state===1)return{done:!0,value:void 0};await bn.toPromise(this._onStateChanged.event)}while(!0)},return:async()=>(this._onReturn?.(),{done:!0,value:void 0})}}static map(t,i){return new fi(async r=>{for await(let a of t)r.emitOne(i(a))})}map(t){return fi.map(this,t)}static filter(t,i){return new fi(async r=>{for await(let a of t)i(a)&&r.emitOne(a)})}filter(t){return fi.filter(this,t)}static coalesce(t){return fi.filter(t,i=>!!i)}coalesce(){return fi.coalesce(this)}static async toPromise(t){let i=[];for await(let r of t)i.push(r);return i}toPromise(){return fi.toPromise(this)}emitOne(t){this._state===0&&(this._results.push(t),this._onStateChanged.fire())}emitMany(t){this._state===0&&(this._results=this._results.concat(t),this._onStateChanged.fire())}resolve(){this._state===0&&(this._state=1,this._onStateChanged.fire())}reject(t){this._state===0&&(this._state=2,this._error=t,this._onStateChanged.fire())}};fb.EMPTY=fb.fromArray([]);var{getWindow:$i,getWindowId:B5,onDidRegisterWindow:L5}=(function(){let e=new Map,t={window:hs,disposables:new Ys};e.set(hs.vscodeWindowId,t);let i=new Ce,r=new Ce,a=new Ce;function c(h,f){return(typeof h=="number"?e.get(h):void 0)??(f?t:void 0)}return{onDidRegisterWindow:i.event,onWillUnregisterWindow:a.event,onDidUnregisterWindow:r.event,registerWindow(h){if(e.has(h.vscodeWindowId))return it.None;let f=new Ys,g={window:h,disposables:f.add(new Ys)};return e.set(h.vscodeWindowId,g),f.add(At(()=>{e.delete(h.vscodeWindowId),r.fire(h)})),f.add($e(h,an.BEFORE_UNLOAD,()=>{a.fire(h)})),i.fire(g),f},getWindows(){return e.values()},getWindowsCount(){return e.size},getWindowId(h){return h.vscodeWindowId},hasWindow(h){return e.has(h)},getWindowById:c,getWindow(h){let f=h;if(f?.ownerDocument?.defaultView)return f.ownerDocument.defaultView.window;let g=h;return g?.view?g.view.window:hs},getDocument(h){return $i(h).document}}})(),z5=class{constructor(e,t,i,r){this._node=e,this._type=t,this._handler=i,this._options=r||!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 $e(e,t,i,r){return new z5(e,t,i,r)}var mb=function(e,t,i,r){return $e(e,t,i,r)},ig,H5=class extends R5{constructor(e){super(),this.defaultTarget=e&&$i(e)}cancelAndSet(e,t,i){return super.cancelAndSet(e,t,i??this.defaultTarget)}},pb=class{constructor(e,t=0){this._runner=e,this.priority=t,this._canceled=!1}dispose(){this._canceled=!0}execute(){if(!this._canceled)try{this._runner()}catch(e){pu(e)}}static sort(e,t){return t.priority-e.priority}};(function(){let e=new Map,t=new Map,i=new Map,r=new Map,a=c=>{i.set(c,!1);let h=e.get(c)??[];for(t.set(c,h),e.set(c,[]),r.set(c,!0);h.length>0;)h.sort(pb.sort),h.shift().execute();r.set(c,!1)};ig=(c,h,f=0)=>{let g=B5(c),m=new pb(h,f),v=e.get(g);return v||(v=[],e.set(g,v)),v.push(m),i.get(g)||(i.set(g,!0),c.requestAnimationFrame(()=>a(g))),m}})();function I5(e){let t=e.getBoundingClientRect(),i=$i(e);return{left:t.left+i.scrollX,top:t.top+i.scrollY,width:t.width,height:t.height}}var an={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"},U5=class{constructor(e){this.domNode=e,this._maxWidth="",this._width="",this._height="",this._top="",this._left="",this._bottom="",this._right="",this._paddingTop="",this._paddingLeft="",this._paddingBottom="",this._paddingRight="",this._fontFamily="",this._fontWeight="",this._fontSize="",this._fontStyle="",this._fontFeatureSettings="",this._fontVariationSettings="",this._textDecoration="",this._lineHeight="",this._letterSpacing="",this._className="",this._display="",this._position="",this._visibility="",this._color="",this._backgroundColor="",this._layerHint=!1,this._contain="none",this._boxShadow=""}setMaxWidth(e){let t=Pn(e);this._maxWidth!==t&&(this._maxWidth=t,this.domNode.style.maxWidth=this._maxWidth)}setWidth(e){let t=Pn(e);this._width!==t&&(this._width=t,this.domNode.style.width=this._width)}setHeight(e){let t=Pn(e);this._height!==t&&(this._height=t,this.domNode.style.height=this._height)}setTop(e){let t=Pn(e);this._top!==t&&(this._top=t,this.domNode.style.top=this._top)}setLeft(e){let t=Pn(e);this._left!==t&&(this._left=t,this.domNode.style.left=this._left)}setBottom(e){let t=Pn(e);this._bottom!==t&&(this._bottom=t,this.domNode.style.bottom=this._bottom)}setRight(e){let t=Pn(e);this._right!==t&&(this._right=t,this.domNode.style.right=this._right)}setPaddingTop(e){let t=Pn(e);this._paddingTop!==t&&(this._paddingTop=t,this.domNode.style.paddingTop=this._paddingTop)}setPaddingLeft(e){let t=Pn(e);this._paddingLeft!==t&&(this._paddingLeft=t,this.domNode.style.paddingLeft=this._paddingLeft)}setPaddingBottom(e){let t=Pn(e);this._paddingBottom!==t&&(this._paddingBottom=t,this.domNode.style.paddingBottom=this._paddingBottom)}setPaddingRight(e){let t=Pn(e);this._paddingRight!==t&&(this._paddingRight=t,this.domNode.style.paddingRight=this._paddingRight)}setFontFamily(e){this._fontFamily!==e&&(this._fontFamily=e,this.domNode.style.fontFamily=this._fontFamily)}setFontWeight(e){this._fontWeight!==e&&(this._fontWeight=e,this.domNode.style.fontWeight=this._fontWeight)}setFontSize(e){let t=Pn(e);this._fontSize!==t&&(this._fontSize=t,this.domNode.style.fontSize=this._fontSize)}setFontStyle(e){this._fontStyle!==e&&(this._fontStyle=e,this.domNode.style.fontStyle=this._fontStyle)}setFontFeatureSettings(e){this._fontFeatureSettings!==e&&(this._fontFeatureSettings=e,this.domNode.style.fontFeatureSettings=this._fontFeatureSettings)}setFontVariationSettings(e){this._fontVariationSettings!==e&&(this._fontVariationSettings=e,this.domNode.style.fontVariationSettings=this._fontVariationSettings)}setTextDecoration(e){this._textDecoration!==e&&(this._textDecoration=e,this.domNode.style.textDecoration=this._textDecoration)}setLineHeight(e){let t=Pn(e);this._lineHeight!==t&&(this._lineHeight=t,this.domNode.style.lineHeight=this._lineHeight)}setLetterSpacing(e){let t=Pn(e);this._letterSpacing!==t&&(this._letterSpacing=t,this.domNode.style.letterSpacing=this._letterSpacing)}setClassName(e){this._className!==e&&(this._className=e,this.domNode.className=this._className)}toggleClassName(e,t){this.domNode.classList.toggle(e,t),this._className=this.domNode.className}setDisplay(e){this._display!==e&&(this._display=e,this.domNode.style.display=this._display)}setPosition(e){this._position!==e&&(this._position=e,this.domNode.style.position=this._position)}setVisibility(e){this._visibility!==e&&(this._visibility=e,this.domNode.style.visibility=this._visibility)}setColor(e){this._color!==e&&(this._color=e,this.domNode.style.color=this._color)}setBackgroundColor(e){this._backgroundColor!==e&&(this._backgroundColor=e,this.domNode.style.backgroundColor=this._backgroundColor)}setLayerHinting(e){this._layerHint!==e&&(this._layerHint=e,this.domNode.style.transform=this._layerHint?"translate3d(0px, 0px, 0px)":"")}setBoxShadow(e){this._boxShadow!==e&&(this._boxShadow=e,this.domNode.style.boxShadow=e)}setContain(e){this._contain!==e&&(this._contain=e,this.domNode.style.contain=this._contain)}setAttribute(e,t){this.domNode.setAttribute(e,t)}removeAttribute(e){this.domNode.removeAttribute(e)}appendChild(e){this.domNode.appendChild(e.domNode)}removeChild(e){this.domNode.removeChild(e.domNode)}};function Pn(e){return typeof e=="number"?`${e}px`:e}function lo(e){return new U5(e)}var vw=class{constructor(){this._hooks=new Ys,this._pointerMoveCallback=null,this._onStopCallback=null}dispose(){this.stopMonitoring(!1),this._hooks.dispose()}stopMonitoring(e,t){if(!this.isMonitoring())return;this._hooks.clear(),this._pointerMoveCallback=null;let i=this._onStopCallback;this._onStopCallback=null,e&&i&&i(t)}isMonitoring(){return!!this._pointerMoveCallback}startMonitoring(e,t,i,r,a){this.isMonitoring()&&this.stopMonitoring(!1),this._pointerMoveCallback=r,this._onStopCallback=a;let c=e;try{e.setPointerCapture(t),this._hooks.add(At(()=>{try{e.releasePointerCapture(t)}catch{}}))}catch{c=$i(e)}this._hooks.add($e(c,an.POINTER_MOVE,h=>{if(h.buttons!==i){this.stopMonitoring(!0);return}h.preventDefault(),this._pointerMoveCallback(h)})),this._hooks.add($e(c,an.POINTER_UP,h=>this.stopMonitoring(!0)))}};function P5(e,t,i){let r=null,a=null;if(typeof i.value=="function"?(r="value",a=i.value,a.length!==0&&console.warn("Memoize should only be used in functions with zero parameters")):typeof i.get=="function"&&(r="get",a=i.get),!a)throw new Error("not supported");let c=`$memoize$${t}`;i[r]=function(...h){return this.hasOwnProperty(c)||Object.defineProperty(this,c,{configurable:!1,enumerable:!1,writable:!1,value:a.apply(this,h)}),this[c]}}var Pi;(e=>(e.Tap="-xterm-gesturetap",e.Change="-xterm-gesturechange",e.Start="-xterm-gesturestart",e.End="-xterm-gesturesend",e.Contextmenu="-xterm-gesturecontextmenu"))(Pi||={});var Za=class Cn extends it{constructor(){super(),this.dispatched=!1,this.targets=new rb,this.ignoreTargets=new rb,this.activeTouches={},this.handle=null,this._lastSetTapCountTime=0,this._register(bn.runAndSubscribe(L5,({window:t,disposables:i})=>{i.add($e(t.document,"touchstart",r=>this.onTouchStart(r),{passive:!1})),i.add($e(t.document,"touchend",r=>this.onTouchEnd(t,r))),i.add($e(t.document,"touchmove",r=>this.onTouchMove(r),{passive:!1}))},{window:hs,disposables:this._store}))}static addTarget(t){if(!Cn.isTouchDevice())return it.None;Cn.INSTANCE||(Cn.INSTANCE=new Cn);let i=Cn.INSTANCE.targets.push(t);return At(i)}static ignoreTarget(t){if(!Cn.isTouchDevice())return it.None;Cn.INSTANCE||(Cn.INSTANCE=new Cn);let i=Cn.INSTANCE.ignoreTargets.push(t);return At(i)}static isTouchDevice(){return"ontouchstart"in hs||navigator.maxTouchPoints>0}dispose(){this.handle&&(this.handle.dispose(),this.handle=null),super.dispose()}onTouchStart(t){let i=Date.now();this.handle&&(this.handle.dispose(),this.handle=null);for(let r=0,a=t.targetTouches.length;r<a;r++){let c=t.targetTouches.item(r);this.activeTouches[c.identifier]={id:c.identifier,initialTarget:c.target,initialTimeStamp:i,initialPageX:c.pageX,initialPageY:c.pageY,rollingTimestamps:[i],rollingPageX:[c.pageX],rollingPageY:[c.pageY]};let h=this.newGestureEvent(Pi.Start,c.target);h.pageX=c.pageX,h.pageY=c.pageY,this.dispatchEvent(h)}this.dispatched&&(t.preventDefault(),t.stopPropagation(),this.dispatched=!1)}onTouchEnd(t,i){let r=Date.now(),a=Object.keys(this.activeTouches).length;for(let c=0,h=i.changedTouches.length;c<h;c++){let f=i.changedTouches.item(c);if(!this.activeTouches.hasOwnProperty(String(f.identifier))){console.warn("move of an UNKNOWN touch",f);continue}let g=this.activeTouches[f.identifier],m=Date.now()-g.initialTimeStamp;if(m<Cn.HOLD_DELAY&&Math.abs(g.initialPageX-Jn(g.rollingPageX))<30&&Math.abs(g.initialPageY-Jn(g.rollingPageY))<30){let v=this.newGestureEvent(Pi.Tap,g.initialTarget);v.pageX=Jn(g.rollingPageX),v.pageY=Jn(g.rollingPageY),this.dispatchEvent(v)}else if(m>=Cn.HOLD_DELAY&&Math.abs(g.initialPageX-Jn(g.rollingPageX))<30&&Math.abs(g.initialPageY-Jn(g.rollingPageY))<30){let v=this.newGestureEvent(Pi.Contextmenu,g.initialTarget);v.pageX=Jn(g.rollingPageX),v.pageY=Jn(g.rollingPageY),this.dispatchEvent(v)}else if(a===1){let v=Jn(g.rollingPageX),_=Jn(g.rollingPageY),S=Jn(g.rollingTimestamps)-g.rollingTimestamps[0],y=v-g.rollingPageX[0],x=_-g.rollingPageY[0],w=[...this.targets].filter(j=>g.initialTarget instanceof Node&&j.contains(g.initialTarget));this.inertia(t,w,r,Math.abs(y)/S,y>0?1:-1,v,Math.abs(x)/S,x>0?1:-1,_)}this.dispatchEvent(this.newGestureEvent(Pi.End,g.initialTarget)),delete this.activeTouches[f.identifier]}this.dispatched&&(i.preventDefault(),i.stopPropagation(),this.dispatched=!1)}newGestureEvent(t,i){let r=document.createEvent("CustomEvent");return r.initEvent(t,!1,!0),r.initialTarget=i,r.tapCount=0,r}dispatchEvent(t){if(t.type===Pi.Tap){let i=new Date().getTime(),r=0;i-this._lastSetTapCountTime>Cn.CLEAR_TAP_COUNT_TIME?r=1:r=2,this._lastSetTapCountTime=i,t.tapCount=r}else(t.type===Pi.Change||t.type===Pi.Contextmenu)&&(this._lastSetTapCountTime=0);if(t.initialTarget instanceof Node){for(let r of this.ignoreTargets)if(r.contains(t.initialTarget))return;let i=[];for(let r of this.targets)if(r.contains(t.initialTarget)){let a=0,c=t.initialTarget;for(;c&&c!==r;)a++,c=c.parentElement;i.push([a,r])}i.sort((r,a)=>r[0]-a[0]);for(let[r,a]of i)a.dispatchEvent(t),this.dispatched=!0}}inertia(t,i,r,a,c,h,f,g,m){this.handle=ig(t,()=>{let v=Date.now(),_=v-r,S=0,y=0,x=!0;a+=Cn.SCROLL_FRICTION*_,f+=Cn.SCROLL_FRICTION*_,a>0&&(x=!1,S=c*a*_),f>0&&(x=!1,y=g*f*_);let w=this.newGestureEvent(Pi.Change);w.translationX=S,w.translationY=y,i.forEach(j=>j.dispatchEvent(w)),x||this.inertia(t,i,v,a,c,h+S,f,g,m+y)})}onTouchMove(t){let i=Date.now();for(let r=0,a=t.changedTouches.length;r<a;r++){let c=t.changedTouches.item(r);if(!this.activeTouches.hasOwnProperty(String(c.identifier))){console.warn("end of an UNKNOWN touch",c);continue}let h=this.activeTouches[c.identifier],f=this.newGestureEvent(Pi.Change,h.initialTarget);f.translationX=c.pageX-Jn(h.rollingPageX),f.translationY=c.pageY-Jn(h.rollingPageY),f.pageX=c.pageX,f.pageY=c.pageY,this.dispatchEvent(f),h.rollingPageX.length>3&&(h.rollingPageX.shift(),h.rollingPageY.shift(),h.rollingTimestamps.shift()),h.rollingPageX.push(c.pageX),h.rollingPageY.push(c.pageY),h.rollingTimestamps.push(i)}this.dispatched&&(t.preventDefault(),t.stopPropagation(),this.dispatched=!1)}};Za.SCROLL_FRICTION=-.005,Za.HOLD_DELAY=700,Za.CLEAR_TAP_COUNT_TIME=400,It([P5],Za,"isTouchDevice",1);var q5=Za,sg=class extends it{onclick(e,t){this._register($e(e,an.CLICK,i=>t(new nu($i(e),i))))}onmousedown(e,t){this._register($e(e,an.MOUSE_DOWN,i=>t(new nu($i(e),i))))}onmouseover(e,t){this._register($e(e,an.MOUSE_OVER,i=>t(new nu($i(e),i))))}onmouseleave(e,t){this._register($e(e,an.MOUSE_LEAVE,i=>t(new nu($i(e),i))))}onkeydown(e,t){this._register($e(e,an.KEY_DOWN,i=>t(new ub(i))))}onkeyup(e,t){this._register($e(e,an.KEY_UP,i=>t(new ub(i))))}oninput(e,t){this._register($e(e,an.INPUT,t))}onblur(e,t){this._register($e(e,an.BLUR,t))}onfocus(e,t){this._register($e(e,an.FOCUS,t))}onchange(e,t){this._register($e(e,an.CHANGE,t))}ignoreGesture(e){return q5.ignoreTarget(e)}},gb=11,F5=class extends sg{constructor(e){super(),this._onActivate=e.onActivate,this.bgDomNode=document.createElement("div"),this.bgDomNode.className="arrow-background",this.bgDomNode.style.position="absolute",this.bgDomNode.style.width=e.bgWidth+"px",this.bgDomNode.style.height=e.bgHeight+"px",typeof e.top<"u"&&(this.bgDomNode.style.top="0px"),typeof e.left<"u"&&(this.bgDomNode.style.left="0px"),typeof e.bottom<"u"&&(this.bgDomNode.style.bottom="0px"),typeof e.right<"u"&&(this.bgDomNode.style.right="0px"),this.domNode=document.createElement("div"),this.domNode.className=e.className,this.domNode.style.position="absolute",this.domNode.style.width=gb+"px",this.domNode.style.height=gb+"px",typeof e.top<"u"&&(this.domNode.style.top=e.top+"px"),typeof e.left<"u"&&(this.domNode.style.left=e.left+"px"),typeof e.bottom<"u"&&(this.domNode.style.bottom=e.bottom+"px"),typeof e.right<"u"&&(this.domNode.style.right=e.right+"px"),this._pointerMoveMonitor=this._register(new vw),this._register(mb(this.bgDomNode,an.POINTER_DOWN,t=>this._arrowPointerDown(t))),this._register(mb(this.domNode,an.POINTER_DOWN,t=>this._arrowPointerDown(t))),this._pointerdownRepeatTimer=this._register(new H5),this._pointerdownScheduleRepeatTimer=this._register(new ng)}_arrowPointerDown(e){if(!e.target||!(e.target instanceof Element))return;let t=()=>{this._pointerdownRepeatTimer.cancelAndSet(()=>this._onActivate(),1e3/24,$i(e))};this._onActivate(),this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancelAndSet(t,200),this._pointerMoveMonitor.startMonitoring(e.target,e.pointerId,e.buttons,i=>{},()=>{this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancel()}),e.preventDefault()}},$5=class Gm{constructor(t,i,r,a,c,h,f){this._forceIntegerValues=t,this._scrollStateBrand=void 0,this._forceIntegerValues&&(i=i|0,r=r|0,a=a|0,c=c|0,h=h|0,f=f|0),this.rawScrollLeft=a,this.rawScrollTop=f,i<0&&(i=0),a+i>r&&(a=r-i),a<0&&(a=0),c<0&&(c=0),f+c>h&&(f=h-c),f<0&&(f=0),this.width=i,this.scrollWidth=r,this.scrollLeft=a,this.height=c,this.scrollHeight=h,this.scrollTop=f}equals(t){return this.rawScrollLeft===t.rawScrollLeft&&this.rawScrollTop===t.rawScrollTop&&this.width===t.width&&this.scrollWidth===t.scrollWidth&&this.scrollLeft===t.scrollLeft&&this.height===t.height&&this.scrollHeight===t.scrollHeight&&this.scrollTop===t.scrollTop}withScrollDimensions(t,i){return new Gm(this._forceIntegerValues,typeof t.width<"u"?t.width:this.width,typeof t.scrollWidth<"u"?t.scrollWidth:this.scrollWidth,i?this.rawScrollLeft:this.scrollLeft,typeof t.height<"u"?t.height:this.height,typeof t.scrollHeight<"u"?t.scrollHeight:this.scrollHeight,i?this.rawScrollTop:this.scrollTop)}withScrollPosition(t){return new Gm(this._forceIntegerValues,this.width,this.scrollWidth,typeof t.scrollLeft<"u"?t.scrollLeft:this.rawScrollLeft,this.height,this.scrollHeight,typeof t.scrollTop<"u"?t.scrollTop:this.rawScrollTop)}createScrollEvent(t,i){let r=this.width!==t.width,a=this.scrollWidth!==t.scrollWidth,c=this.scrollLeft!==t.scrollLeft,h=this.height!==t.height,f=this.scrollHeight!==t.scrollHeight,g=this.scrollTop!==t.scrollTop;return{inSmoothScrolling:i,oldWidth:t.width,oldScrollWidth:t.scrollWidth,oldScrollLeft:t.scrollLeft,width:this.width,scrollWidth:this.scrollWidth,scrollLeft:this.scrollLeft,oldHeight:t.height,oldScrollHeight:t.scrollHeight,oldScrollTop:t.scrollTop,height:this.height,scrollHeight:this.scrollHeight,scrollTop:this.scrollTop,widthChanged:r,scrollWidthChanged:a,scrollLeftChanged:c,heightChanged:h,scrollHeightChanged:f,scrollTopChanged:g}}},V5=class extends it{constructor(e){super(),this._scrollableBrand=void 0,this._onScroll=this._register(new Ce),this.onScroll=this._onScroll.event,this._smoothScrollDuration=e.smoothScrollDuration,this._scheduleAtNextAnimationFrame=e.scheduleAtNextAnimationFrame,this._state=new $5(e.forceIntegerValues,0,0,0,0,0,0),this._smoothScrolling=null}dispose(){this._smoothScrolling&&(this._smoothScrolling.dispose(),this._smoothScrolling=null),super.dispose()}setSmoothScrollDuration(e){this._smoothScrollDuration=e}validateScrollPosition(e){return this._state.withScrollPosition(e)}getScrollDimensions(){return this._state}setScrollDimensions(e,t){let i=this._state.withScrollDimensions(e,t);this._setState(i,!!this._smoothScrolling),this._smoothScrolling?.acceptScrollDimensions(this._state)}getFutureScrollPosition(){return this._smoothScrolling?this._smoothScrolling.to:this._state}getCurrentScrollPosition(){return this._state}setScrollPositionNow(e){let t=this._state.withScrollPosition(e);this._smoothScrolling&&(this._smoothScrolling.dispose(),this._smoothScrolling=null),this._setState(t,!1)}setScrollPositionSmooth(e,t){if(this._smoothScrollDuration===0)return this.setScrollPositionNow(e);if(this._smoothScrolling){e={scrollLeft:typeof e.scrollLeft>"u"?this._smoothScrolling.to.scrollLeft:e.scrollLeft,scrollTop:typeof e.scrollTop>"u"?this._smoothScrolling.to.scrollTop:e.scrollTop};let i=this._state.withScrollPosition(e);if(this._smoothScrolling.to.scrollLeft===i.scrollLeft&&this._smoothScrolling.to.scrollTop===i.scrollTop)return;let r;t?r=new vb(this._smoothScrolling.from,i,this._smoothScrolling.startTime,this._smoothScrolling.duration):r=this._smoothScrolling.combine(this._state,i,this._smoothScrollDuration),this._smoothScrolling.dispose(),this._smoothScrolling=r}else{let i=this._state.withScrollPosition(e);this._smoothScrolling=vb.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 e=this._smoothScrolling.tick(),t=this._state.withScrollPosition(e);if(this._setState(t,!0),!!this._smoothScrolling){if(e.isDone){this._smoothScrolling.dispose(),this._smoothScrolling=null;return}this._smoothScrolling.animationFrameDisposable=this._scheduleAtNextAnimationFrame(()=>{this._smoothScrolling&&(this._smoothScrolling.animationFrameDisposable=null,this._performSmoothScrolling())})}}_setState(e,t){let i=this._state;i.equals(e)||(this._state=e,this._onScroll.fire(this._state.createScrollEvent(i,t)))}},_b=class{constructor(e,t,i){this.scrollLeft=e,this.scrollTop=t,this.isDone=i}};function em(e,t){let i=t-e;return function(r){return e+i*W5(r)}}function K5(e,t,i){return function(r){return r<i?e(r/i):t((r-i)/(1-i))}}var vb=class Qm{constructor(t,i,r,a){this.from=t,this.to=i,this.duration=a,this.startTime=r,this.animationFrameDisposable=null,this._initAnimations()}_initAnimations(){this.scrollLeft=this._initAnimation(this.from.scrollLeft,this.to.scrollLeft,this.to.width),this.scrollTop=this._initAnimation(this.from.scrollTop,this.to.scrollTop,this.to.height)}_initAnimation(t,i,r){if(Math.abs(t-i)>2.5*r){let a,c;return t<i?(a=t+.75*r,c=i-.75*r):(a=t-.75*r,c=i+.75*r),K5(em(t,a),em(c,i),.33)}return em(t,i)}dispose(){this.animationFrameDisposable!==null&&(this.animationFrameDisposable.dispose(),this.animationFrameDisposable=null)}acceptScrollDimensions(t){this.to=t.withScrollPosition(this.to),this._initAnimations()}tick(){return this._tick(Date.now())}_tick(t){let i=(t-this.startTime)/this.duration;if(i<1){let r=this.scrollLeft(i),a=this.scrollTop(i);return new _b(r,a,!1)}return new _b(this.to.scrollLeft,this.to.scrollTop,!0)}combine(t,i,r){return Qm.start(t,i,r)}static start(t,i,r){r=r+10;let a=Date.now()-10;return new Qm(t,i,a,r)}};function Y5(e){return Math.pow(e,3)}function W5(e){return 1-Y5(1-e)}var X5=class extends it{constructor(e,t,i){super(),this._visibility=e,this._visibleClassName=t,this._invisibleClassName=i,this._domNode=null,this._isVisible=!1,this._isNeeded=!1,this._rawShouldBeVisible=!1,this._shouldBeVisible=!1,this._revealTimer=this._register(new ng)}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":"")))}},G5=140,yw=class extends sg{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 X5(e.visibility,"visible scrollbar "+e.extraScrollbarClassName,"invisible scrollbar "+e.extraScrollbarClassName)),this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._pointerMoveMonitor=this._register(new vw),this._shouldRender=!0,this.domNode=lo(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($e(this.domNode.domNode,an.POINTER_DOWN,t=>this._domNodePointerDown(t)))}_createArrow(e){let t=this._register(new F5(e));this.domNode.domNode.appendChild(t.bgDomNode),this.domNode.domNode.appendChild(t.domNode)}_createSlider(e,t,i,r){this.slider=lo(document.createElement("div")),this.slider.setClassName("slider"),this.slider.setPosition("absolute"),this.slider.setTop(e),this.slider.setLeft(t),typeof i=="number"&&this.slider.setWidth(i),typeof r=="number"&&this.slider.setHeight(r),this.slider.setLayerHinting(!0),this.slider.setContain("strict"),this.domNode.domNode.appendChild(this.slider.domNode),this._register($e(this.slider.domNode,an.POINTER_DOWN,a=>{a.button===0&&(a.preventDefault(),this._sliderPointerDown(a))})),this.onclick(this.slider.domNode,a=>{a.leftButton&&a.stopPropagation()})}_onElementSize(e){return this._scrollbarState.setVisibleSize(e)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}_onElementScrollSize(e){return this._scrollbarState.setScrollSize(e)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}_onElementScrollPosition(e){return this._scrollbarState.setScrollPosition(e)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}beginReveal(){this._visibilityController.setShouldBeVisible(!0)}beginHide(){this._visibilityController.setShouldBeVisible(!1)}render(){this._shouldRender&&(this._shouldRender=!1,this._renderDomNode(this._scrollbarState.getRectangleLargeSize(),this._scrollbarState.getRectangleSmallSize()),this._updateSlider(this._scrollbarState.getSliderSize(),this._scrollbarState.getArrowSize()+this._scrollbarState.getSliderPosition()))}_domNodePointerDown(e){e.target===this.domNode.domNode&&this._onPointerDown(e)}delegatePointerDown(e){let t=this.domNode.domNode.getClientRects()[0].top,i=t+this._scrollbarState.getSliderPosition(),r=t+this._scrollbarState.getSliderPosition()+this._scrollbarState.getSliderSize(),a=this._sliderPointerPosition(e);i<=a&&a<=r?e.button===0&&(e.preventDefault(),this._sliderPointerDown(e)):this._onPointerDown(e)}_onPointerDown(e){let t,i;if(e.target===this.domNode.domNode&&typeof e.offsetX=="number"&&typeof e.offsetY=="number")t=e.offsetX,i=e.offsetY;else{let a=I5(this.domNode.domNode);t=e.pageX-a.left,i=e.pageY-a.top}let r=this._pointerDownRelativePosition(t,i);this._setDesiredScrollPositionNow(this._scrollByPage?this._scrollbarState.getDesiredScrollPositionFromOffsetPaged(r):this._scrollbarState.getDesiredScrollPositionFromOffset(r)),e.button===0&&(e.preventDefault(),this._sliderPointerDown(e))}_sliderPointerDown(e){if(!e.target||!(e.target instanceof Element))return;let t=this._sliderPointerPosition(e),i=this._sliderOrthogonalPointerPosition(e),r=this._scrollbarState.clone();this.slider.toggleClassName("active",!0),this._pointerMoveMonitor.startMonitoring(e.target,e.pointerId,e.buttons,a=>{let c=this._sliderOrthogonalPointerPosition(a),h=Math.abs(c-i);if(mw&&h>G5){this._setDesiredScrollPositionNow(r.getScrollPosition());return}let f=this._sliderPointerPosition(a)-t;this._setDesiredScrollPositionNow(r.getDesiredScrollPositionFromDelta(f))},()=>{this.slider.toggleClassName("active",!1),this._host.onDragEnd()}),this._host.onDragStart()}_setDesiredScrollPositionNow(e){let t={};this.writeScrollPosition(t,e),this._scrollable.setScrollPositionNow(t)}updateScrollbarSize(e){this._updateScrollbarSize(e),this._scrollbarState.setScrollbarSize(e),this._shouldRender=!0,this._lazyRender||this.render()}isNeeded(){return this._scrollbarState.isNeeded()}},Sw=class Zm{constructor(t,i,r,a,c,h){this._scrollbarSize=Math.round(i),this._oppositeScrollbarSize=Math.round(r),this._arrowSize=Math.round(t),this._visibleSize=a,this._scrollSize=c,this._scrollPosition=h,this._computedAvailableSize=0,this._computedIsNeeded=!1,this._computedSliderSize=0,this._computedSliderRatio=0,this._computedSliderPosition=0,this._refreshComputedValues()}clone(){return new Zm(this._arrowSize,this._scrollbarSize,this._oppositeScrollbarSize,this._visibleSize,this._scrollSize,this._scrollPosition)}setVisibleSize(t){let i=Math.round(t);return this._visibleSize!==i?(this._visibleSize=i,this._refreshComputedValues(),!0):!1}setScrollSize(t){let i=Math.round(t);return this._scrollSize!==i?(this._scrollSize=i,this._refreshComputedValues(),!0):!1}setScrollPosition(t){let i=Math.round(t);return this._scrollPosition!==i?(this._scrollPosition=i,this._refreshComputedValues(),!0):!1}setScrollbarSize(t){this._scrollbarSize=Math.round(t)}setOppositeScrollbarSize(t){this._oppositeScrollbarSize=Math.round(t)}static _computeValues(t,i,r,a,c){let h=Math.max(0,r-t),f=Math.max(0,h-2*i),g=a>0&&a>r;if(!g)return{computedAvailableSize:Math.round(h),computedIsNeeded:g,computedSliderSize:Math.round(f),computedSliderRatio:0,computedSliderPosition:0};let m=Math.round(Math.max(20,Math.floor(r*f/a))),v=(f-m)/(a-r),_=c*v;return{computedAvailableSize:Math.round(h),computedIsNeeded:g,computedSliderSize:Math.round(m),computedSliderRatio:v,computedSliderPosition:Math.round(_)}}_refreshComputedValues(){let t=Zm._computeValues(this._oppositeScrollbarSize,this._arrowSize,this._visibleSize,this._scrollSize,this._scrollPosition);this._computedAvailableSize=t.computedAvailableSize,this._computedIsNeeded=t.computedIsNeeded,this._computedSliderSize=t.computedSliderSize,this._computedSliderRatio=t.computedSliderRatio,this._computedSliderPosition=t.computedSliderPosition}getArrowSize(){return this._arrowSize}getScrollPosition(){return this._scrollPosition}getRectangleLargeSize(){return this._computedAvailableSize}getRectangleSmallSize(){return this._scrollbarSize}isNeeded(){return this._computedIsNeeded}getSliderSize(){return this._computedSliderSize}getSliderPosition(){return this._computedSliderPosition}getDesiredScrollPositionFromOffset(t){if(!this._computedIsNeeded)return 0;let i=t-this._arrowSize-this._computedSliderSize/2;return Math.round(i/this._computedSliderRatio)}getDesiredScrollPositionFromOffsetPaged(t){if(!this._computedIsNeeded)return 0;let i=t-this._arrowSize,r=this._scrollPosition;return i<this._computedSliderPosition?r-=this._visibleSize:r+=this._visibleSize,r}getDesiredScrollPositionFromDelta(t){if(!this._computedIsNeeded)return 0;let i=this._computedSliderPosition+t;return Math.round(i/this._computedSliderRatio)}},Q5=class extends yw{constructor(e,t,i){let r=e.getScrollDimensions(),a=e.getCurrentScrollPosition();if(super({lazyRender:t.lazyRender,host:i,scrollbarState:new Sw(t.horizontalHasArrows?t.arrowSize:0,t.horizontal===2?0:t.horizontalScrollbarSize,t.vertical===2?0:t.verticalScrollbarSize,r.width,r.scrollWidth,a.scrollLeft),visibility:t.horizontal,extraScrollbarClassName:"horizontal",scrollable:e,scrollByPage:t.scrollByPage}),t.horizontalHasArrows)throw new Error("horizontalHasArrows is not supported in xterm.js");this._createSlider(Math.floor((t.horizontalScrollbarSize-t.horizontalSliderSize)/2),0,void 0,t.horizontalSliderSize)}_updateSlider(e,t){this.slider.setWidth(e),this.slider.setLeft(t)}_renderDomNode(e,t){this.domNode.setWidth(e),this.domNode.setHeight(t),this.domNode.setLeft(0),this.domNode.setBottom(0)}onDidScroll(e){return this._shouldRender=this._onElementScrollSize(e.scrollWidth)||this._shouldRender,this._shouldRender=this._onElementScrollPosition(e.scrollLeft)||this._shouldRender,this._shouldRender=this._onElementSize(e.width)||this._shouldRender,this._shouldRender}_pointerDownRelativePosition(e,t){return e}_sliderPointerPosition(e){return e.pageX}_sliderOrthogonalPointerPosition(e){return e.pageY}_updateScrollbarSize(e){this.slider.setHeight(e)}writeScrollPosition(e,t){e.scrollLeft=t}updateOptions(e){this.updateScrollbarSize(e.horizontal===2?0:e.horizontalScrollbarSize),this._scrollbarState.setOppositeScrollbarSize(e.vertical===2?0:e.verticalScrollbarSize),this._visibilityController.setVisibility(e.horizontal),this._scrollByPage=e.scrollByPage}},Z5=class extends yw{constructor(e,t,i){let r=e.getScrollDimensions(),a=e.getCurrentScrollPosition();if(super({lazyRender:t.lazyRender,host:i,scrollbarState:new Sw(t.verticalHasArrows?t.arrowSize:0,t.vertical===2?0:t.verticalScrollbarSize,0,r.height,r.scrollHeight,a.scrollTop),visibility:t.vertical,extraScrollbarClassName:"vertical",scrollable:e,scrollByPage:t.scrollByPage}),t.verticalHasArrows)throw new Error("horizontalHasArrows is not supported in xterm.js");this._createSlider(0,Math.floor((t.verticalScrollbarSize-t.verticalSliderSize)/2),t.verticalSliderSize,void 0)}_updateSlider(e,t){this.slider.setHeight(e),this.slider.setTop(t)}_renderDomNode(e,t){this.domNode.setWidth(t),this.domNode.setHeight(e),this.domNode.setRight(0),this.domNode.setTop(0)}onDidScroll(e){return this._shouldRender=this._onElementScrollSize(e.scrollHeight)||this._shouldRender,this._shouldRender=this._onElementScrollPosition(e.scrollTop)||this._shouldRender,this._shouldRender=this._onElementSize(e.height)||this._shouldRender,this._shouldRender}_pointerDownRelativePosition(e,t){return t}_sliderPointerPosition(e){return e.pageY}_sliderOrthogonalPointerPosition(e){return e.pageX}_updateScrollbarSize(e){this.slider.setWidth(e)}writeScrollPosition(e,t){e.scrollTop=t}updateOptions(e){this.updateScrollbarSize(e.vertical===2?0:e.verticalScrollbarSize),this._scrollbarState.setOppositeScrollbarSize(0),this._visibilityController.setVisibility(e.vertical),this._scrollByPage=e.scrollByPage}},J5=500,yb=50,eO=class{constructor(e,t,i){this.timestamp=e,this.deltaX=t,this.deltaY=i,this.score=0}},Jm=class{constructor(){this._capacity=5,this._memory=[],this._front=-1,this._rear=-1}isPhysicalMouseWheel(){if(this._front===-1&&this._rear===-1)return!1;let t=1,i=0,r=1,a=this._rear;do{let c=a===this._front?t:Math.pow(2,-r);if(t-=c,i+=this._memory[a].score*c,a===this._front)break;a=(this._capacity+a-1)%this._capacity,r++}while(!0);return i<=.5}acceptStandardWheelEvent(t){if(eg){let i=$i(t.browserEvent),r=h5(i);this.accept(Date.now(),t.deltaX*r,t.deltaY*r)}else this.accept(Date.now(),t.deltaX,t.deltaY)}accept(t,i,r){let a=null,c=new eO(t,i,r);this._front===-1&&this._rear===-1?(this._memory[0]=c,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]=c),c.score=this._computeScore(c,a)}_computeScore(t,i){if(Math.abs(t.deltaX)>0&&Math.abs(t.deltaY)>0)return 1;let r=.5;if((!this._isAlmostInt(t.deltaX)||!this._isAlmostInt(t.deltaY))&&(r+=.25),i){let a=Math.abs(t.deltaX),c=Math.abs(t.deltaY),h=Math.abs(i.deltaX),f=Math.abs(i.deltaY),g=Math.max(Math.min(a,h),1),m=Math.max(Math.min(c,f),1),v=Math.max(a,h),_=Math.max(c,f);v%g===0&&_%m===0&&(r-=.5)}return Math.min(Math.max(r,0),1)}_isAlmostInt(t){return Math.abs(Math.round(t)-t)<.01}};Jm.INSTANCE=new Jm;var tO=Jm,nO=class extends sg{constructor(e,t,i){super(),this._onScroll=this._register(new Ce),this.onScroll=this._onScroll.event,this._onWillScroll=this._register(new Ce),this.onWillScroll=this._onWillScroll.event,this._options=sO(t),this._scrollable=i,this._register(this._scrollable.onScroll(a=>{this._onWillScroll.fire(a),this._onDidScroll(a),this._onScroll.fire(a)}));let r={onMouseWheel:a=>this._onMouseWheel(a),onDragStart:()=>this._onDragStart(),onDragEnd:()=>this._onDragEnd()};this._verticalScrollbar=this._register(new Z5(this._scrollable,this._options,r)),this._horizontalScrollbar=this._register(new Q5(this._scrollable,this._options,r)),this._domNode=document.createElement("div"),this._domNode.className="xterm-scrollable-element "+this._options.className,this._domNode.setAttribute("role","presentation"),this._domNode.style.position="relative",this._domNode.appendChild(e),this._domNode.appendChild(this._horizontalScrollbar.domNode.domNode),this._domNode.appendChild(this._verticalScrollbar.domNode.domNode),this._options.useShadows?(this._leftShadowDomNode=lo(document.createElement("div")),this._leftShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._leftShadowDomNode.domNode),this._topShadowDomNode=lo(document.createElement("div")),this._topShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._topShadowDomNode.domNode),this._topLeftShadowDomNode=lo(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 ng),this._isDragging=!1,this._mouseIsOver=!1,this._shouldRender=!0,this._revealOnScroll=!0}get options(){return this._options}dispose(){this._mouseWheelToDispose=Rr(this._mouseWheelToDispose),super.dispose()}getDomNode(){return this._domNode}getOverviewRulerLayoutInfo(){return{parent:this._domNode,insertBefore:this._verticalScrollbar.domNode.domNode}}delegateVerticalScrollbarPointerDown(e){this._verticalScrollbar.delegatePointerDown(e)}getScrollDimensions(){return this._scrollable.getScrollDimensions()}setScrollDimensions(e){this._scrollable.setScrollDimensions(e,!1)}updateClassName(e){this._options.className=e,Vi&&(this._options.className+=" mac"),this._domNode.className="xterm-scrollable-element "+this._options.className}updateOptions(e){typeof e.handleMouseWheel<"u"&&(this._options.handleMouseWheel=e.handleMouseWheel,this._setListeningToMouseWheel(this._options.handleMouseWheel)),typeof e.mouseWheelScrollSensitivity<"u"&&(this._options.mouseWheelScrollSensitivity=e.mouseWheelScrollSensitivity),typeof e.fastScrollSensitivity<"u"&&(this._options.fastScrollSensitivity=e.fastScrollSensitivity),typeof e.scrollPredominantAxis<"u"&&(this._options.scrollPredominantAxis=e.scrollPredominantAxis),typeof e.horizontal<"u"&&(this._options.horizontal=e.horizontal),typeof e.vertical<"u"&&(this._options.vertical=e.vertical),typeof e.horizontalScrollbarSize<"u"&&(this._options.horizontalScrollbarSize=e.horizontalScrollbarSize),typeof e.verticalScrollbarSize<"u"&&(this._options.verticalScrollbarSize=e.verticalScrollbarSize),typeof e.scrollByPage<"u"&&(this._options.scrollByPage=e.scrollByPage),this._horizontalScrollbar.updateOptions(this._options),this._verticalScrollbar.updateOptions(this._options),this._options.lazyRender||this._render()}setRevealOnScroll(e){this._revealOnScroll=e}delegateScrollFromMouseWheelEvent(e){this._onMouseWheel(new db(e))}_setListeningToMouseWheel(e){if(this._mouseWheelToDispose.length>0!==e&&(this._mouseWheelToDispose=Rr(this._mouseWheelToDispose),e)){let t=i=>{this._onMouseWheel(new db(i))};this._mouseWheelToDispose.push($e(this._listenOnDomNode,an.MOUSE_WHEEL,t,{passive:!1}))}}_onMouseWheel(e){if(e.browserEvent?.defaultPrevented)return;let t=tO.INSTANCE;t.acceptStandardWheelEvent(e);let i=!1;if(e.deltaY||e.deltaX){let a=e.deltaY*this._options.mouseWheelScrollSensitivity,c=e.deltaX*this._options.mouseWheelScrollSensitivity;this._options.scrollPredominantAxis&&(this._options.scrollYToX&&c+a===0?c=a=0:Math.abs(a)>=Math.abs(c)?c=0:a=0),this._options.flipAxes&&([a,c]=[c,a]);let h=!Vi&&e.browserEvent&&e.browserEvent.shiftKey;(this._options.scrollYToX||h)&&!c&&(c=a,a=0),e.browserEvent&&e.browserEvent.altKey&&(c=c*this._options.fastScrollSensitivity,a=a*this._options.fastScrollSensitivity);let f=this._scrollable.getFutureScrollPosition(),g={};if(a){let m=yb*a,v=f.scrollTop-(m<0?Math.floor(m):Math.ceil(m));this._verticalScrollbar.writeScrollPosition(g,v)}if(c){let m=yb*c,v=f.scrollLeft-(m<0?Math.floor(m):Math.ceil(m));this._horizontalScrollbar.writeScrollPosition(g,v)}g=this._scrollable.validateScrollPosition(g),(f.scrollLeft!==g.scrollLeft||f.scrollTop!==g.scrollTop)&&(this._options.mouseWheelSmoothScroll&&t.isPhysicalMouseWheel()?this._scrollable.setScrollPositionSmooth(g):this._scrollable.setScrollPositionNow(g),i=!0)}let r=i;!r&&this._options.alwaysConsumeMouseWheel&&(r=!0),!r&&this._options.consumeMouseWheelIfScrollbarIsNeeded&&(this._verticalScrollbar.isNeeded()||this._horizontalScrollbar.isNeeded())&&(r=!0),r&&(e.preventDefault(),e.stopPropagation())}_onDidScroll(e){this._shouldRender=this._horizontalScrollbar.onDidScroll(e)||this._shouldRender,this._shouldRender=this._verticalScrollbar.onDidScroll(e)||this._shouldRender,this._options.useShadows&&(this._shouldRender=!0),this._revealOnScroll&&this._reveal(),this._options.lazyRender||this._render()}renderNow(){if(!this._options.lazyRender)throw new Error("Please use `lazyRender` together with `renderNow`!");this._render()}_render(){if(this._shouldRender&&(this._shouldRender=!1,this._horizontalScrollbar.render(),this._verticalScrollbar.render(),this._options.useShadows)){let e=this._scrollable.getCurrentScrollPosition(),t=e.scrollTop>0,i=e.scrollLeft>0,r=i?" left":"",a=t?" top":"",c=i||t?" top-left-corner":"";this._leftShadowDomNode.setClassName(`shadow${r}`),this._topShadowDomNode.setClassName(`shadow${a}`),this._topLeftShadowDomNode.setClassName(`shadow${c}${a}${r}`)}}_onDragStart(){this._isDragging=!0,this._reveal()}_onDragEnd(){this._isDragging=!1,this._hide()}_onMouseLeave(e){this._mouseIsOver=!1,this._hide()}_onMouseOver(e){this._mouseIsOver=!0,this._reveal()}_reveal(){this._verticalScrollbar.beginReveal(),this._horizontalScrollbar.beginReveal(),this._scheduleHide()}_hide(){!this._mouseIsOver&&!this._isDragging&&(this._verticalScrollbar.beginHide(),this._horizontalScrollbar.beginHide())}_scheduleHide(){!this._mouseIsOver&&!this._isDragging&&this._hideTimeout.cancelAndSet(()=>this._hide(),J5)}},iO=class extends nO{constructor(e,t,i){super(e,t,i)}setScrollPosition(e){e.reuseAnimation?this._scrollable.setScrollPositionSmooth(e,e.reuseAnimation):this._scrollable.setScrollPositionNow(e)}getScrollPosition(){return this._scrollable.getCurrentScrollPosition()}};function sO(e){let t={lazyRender:typeof e.lazyRender<"u"?e.lazyRender:!1,className:typeof e.className<"u"?e.className:"",useShadows:typeof e.useShadows<"u"?e.useShadows:!0,handleMouseWheel:typeof e.handleMouseWheel<"u"?e.handleMouseWheel:!0,flipAxes:typeof e.flipAxes<"u"?e.flipAxes:!1,consumeMouseWheelIfScrollbarIsNeeded:typeof e.consumeMouseWheelIfScrollbarIsNeeded<"u"?e.consumeMouseWheelIfScrollbarIsNeeded:!1,alwaysConsumeMouseWheel:typeof e.alwaysConsumeMouseWheel<"u"?e.alwaysConsumeMouseWheel:!1,scrollYToX:typeof e.scrollYToX<"u"?e.scrollYToX:!1,mouseWheelScrollSensitivity:typeof e.mouseWheelScrollSensitivity<"u"?e.mouseWheelScrollSensitivity:1,fastScrollSensitivity:typeof e.fastScrollSensitivity<"u"?e.fastScrollSensitivity:5,scrollPredominantAxis:typeof e.scrollPredominantAxis<"u"?e.scrollPredominantAxis:!0,mouseWheelSmoothScroll:typeof e.mouseWheelSmoothScroll<"u"?e.mouseWheelSmoothScroll:!0,arrowSize:typeof e.arrowSize<"u"?e.arrowSize:11,listenOnDomNode:typeof e.listenOnDomNode<"u"?e.listenOnDomNode:null,horizontal:typeof e.horizontal<"u"?e.horizontal:1,horizontalScrollbarSize:typeof e.horizontalScrollbarSize<"u"?e.horizontalScrollbarSize:10,horizontalSliderSize:typeof e.horizontalSliderSize<"u"?e.horizontalSliderSize:0,horizontalHasArrows:typeof e.horizontalHasArrows<"u"?e.horizontalHasArrows:!1,vertical:typeof e.vertical<"u"?e.vertical:1,verticalScrollbarSize:typeof e.verticalScrollbarSize<"u"?e.verticalScrollbarSize:10,verticalHasArrows:typeof e.verticalHasArrows<"u"?e.verticalHasArrows:!1,verticalSliderSize:typeof e.verticalSliderSize<"u"?e.verticalSliderSize:0,scrollByPage:typeof e.scrollByPage<"u"?e.scrollByPage:!1};return t.horizontalSliderSize=typeof e.horizontalSliderSize<"u"?e.horizontalSliderSize:t.horizontalScrollbarSize,t.verticalSliderSize=typeof e.verticalSliderSize<"u"?e.verticalSliderSize:t.verticalScrollbarSize,Vi&&(t.className+=" mac"),t}var ep=class extends it{constructor(e,t,i,r,a,c,h,f){super(),this._bufferService=i,this._optionsService=h,this._renderService=f,this._onRequestScrollLines=this._register(new Ce),this.onRequestScrollLines=this._onRequestScrollLines.event,this._isSyncing=!1,this._isHandlingScroll=!1,this._suppressOnScrollHandler=!1;let g=this._register(new V5({forceIntegerValues:!1,smoothScrollDuration:this._optionsService.rawOptions.smoothScrollDuration,scheduleAtNextAnimationFrame:m=>ig(r.window,m)}));this._register(this._optionsService.onSpecificOptionChange("smoothScrollDuration",()=>{g.setSmoothScrollDuration(this._optionsService.rawOptions.smoothScrollDuration)})),this._scrollableElement=this._register(new iO(t,{vertical:1,horizontal:2,useShadows:!1,mouseWheelSmoothScroll:!0,...this._getChangeOptions()},g)),this._register(this._optionsService.onMultipleOptionChange(["scrollSensitivity","fastScrollSensitivity","overviewRuler"],()=>this._scrollableElement.updateOptions(this._getChangeOptions()))),this._register(a.onProtocolChange(m=>{this._scrollableElement.updateOptions({handleMouseWheel:!(m&16)})})),this._scrollableElement.setScrollDimensions({height:0,scrollHeight:0}),this._register(bn.runAndSubscribe(c.onChangeColors,()=>{this._scrollableElement.getDomNode().style.backgroundColor=c.colors.background.css})),e.appendChild(this._scrollableElement.getDomNode()),this._register(At(()=>this._scrollableElement.getDomNode().remove())),this._styleElement=r.mainDocument.createElement("style"),t.appendChild(this._styleElement),this._register(At(()=>this._styleElement.remove())),this._register(bn.runAndSubscribe(c.onChangeColors,()=>{this._styleElement.textContent=[".xterm .xterm-scrollable-element > .scrollbar > .slider {",` background: ${c.colors.scrollbarSliderBackground.css};`,"}",".xterm .xterm-scrollable-element > .scrollbar > .slider:hover {",` background: ${c.colors.scrollbarSliderHoverBackground.css};`,"}",".xterm .xterm-scrollable-element > .scrollbar > .slider.active {",` background: ${c.colors.scrollbarSliderActiveBackground.css};`,"}"].join(`
56
+ `)})),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(m=>this._handleScroll(m)))}scrollLines(e){let t=this._scrollableElement.getScrollPosition();this._scrollableElement.setScrollPosition({reuseAnimation:!0,scrollTop:t.scrollTop+e*this._renderService.dimensions.css.cell.height})}scrollToLine(e,t){t&&(this._latestYDisp=e),this._scrollableElement.setScrollPosition({reuseAnimation:!t,scrollTop:e*this._renderService.dimensions.css.cell.height})}_getChangeOptions(){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 t=Math.round(e.scrollTop/this._renderService.dimensions.css.cell.height),i=t-this._bufferService.buffer.ydisp;i!==0&&(this._latestYDisp=t,this._onRequestScrollLines.fire(i)),this._isHandlingScroll=!1}};ep=It([Me(2,Rn),Me(3,fs),Me(4,ew),Me(5,$l),Me(6,On),Me(7,ms)],ep);var tp=class extends it{constructor(e,t,i,r,a){super(),this._screenElement=e,this._bufferService=t,this._coreBrowserService=i,this._decorationService=r,this._renderService=a,this._decorationElements=new Map,this._altBufferIsActive=!1,this._dimensionsChanged=!1,this._container=document.createElement("div"),this._container.classList.add("xterm-decoration-container"),this._screenElement.appendChild(this._container),this._register(this._renderService.onRenderedViewportChange(()=>this._doRefreshDecorations())),this._register(this._renderService.onDimensionsChange(()=>{this._dimensionsChanged=!0,this._queueRefresh()})),this._register(this._coreBrowserService.onDprChange(()=>this._queueRefresh())),this._register(this._bufferService.buffers.onBufferActivate(()=>{this._altBufferIsActive=this._bufferService.buffer===this._bufferService.buffers.alt})),this._register(this._decorationService.onDecorationRegistered(()=>this._queueRefresh())),this._register(this._decorationService.onDecorationRemoved(c=>this._removeDecoration(c))),this._register(At(()=>{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 t=this._coreBrowserService.mainDocument.createElement("div");t.classList.add("xterm-decoration"),t.classList.toggle("xterm-decoration-top-layer",e?.options?.layer==="top"),t.style.width=`${Math.round((e.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,t.style.height=`${(e.options.height||1)*this._renderService.dimensions.css.cell.height}px`,t.style.top=`${(e.marker.line-this._bufferService.buffers.active.ydisp)*this._renderService.dimensions.css.cell.height}px`,t.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`;let i=e.options.x??0;return i&&i>this._bufferService.cols&&(t.style.display="none"),this._refreshXPosition(e,t),t}_refreshStyle(e){let t=e.marker.line-this._bufferService.buffers.active.ydisp;if(t<0||t>=this._bufferService.rows)e.element&&(e.element.style.display="none",e.onRenderEmitter.fire(e.element));else{let i=this._decorationElements.get(e);i||(i=this._createElement(e),e.element=i,this._decorationElements.set(e,i),this._container.appendChild(i),e.onDispose(()=>{this._decorationElements.delete(e),i.remove()})),i.style.display=this._altBufferIsActive?"none":"block",this._altBufferIsActive||(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=`${t*this._renderService.dimensions.css.cell.height}px`,i.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`),e.onRenderEmitter.fire(i)}}_refreshXPosition(e,t=e.element){if(!t)return;let i=e.options.x??0;(e.options.anchor||"left")==="right"?t.style.right=i?`${i*this._renderService.dimensions.css.cell.width}px`:"":t.style.left=i?`${i*this._renderService.dimensions.css.cell.width}px`:""}_removeDecoration(e){this._decorationElements.get(e)?.remove(),this._decorationElements.delete(e),e.dispose()}};tp=It([Me(1,Rn),Me(2,fs),Me(3,So),Me(4,ms)],tp);var rO=class{constructor(){this._zones=[],this._zonePool=[],this._zonePoolIndex=0,this._linePadding={full:0,left:0,center:0,right:0}}get zones(){return this._zonePool.length=Math.min(this._zonePool.length,this._zones.length),this._zones}clear(){this._zones.length=0,this._zonePoolIndex=0}addDecoration(e){if(e.options.overviewRulerOptions){for(let t of this._zones)if(t.color===e.options.overviewRulerOptions.color&&t.position===e.options.overviewRulerOptions.position){if(this._lineIntersectsZone(t,e.marker.line))return;if(this._lineAdjacentToZone(t,e.marker.line,e.options.overviewRulerOptions.position)){this._addLineToZone(t,e.marker.line);return}}if(this._zonePoolIndex<this._zonePool.length){this._zonePool[this._zonePoolIndex].color=e.options.overviewRulerOptions.color,this._zonePool[this._zonePoolIndex].position=e.options.overviewRulerOptions.position,this._zonePool[this._zonePoolIndex].startBufferLine=e.marker.line,this._zonePool[this._zonePoolIndex].endBufferLine=e.marker.line,this._zones.push(this._zonePool[this._zonePoolIndex++]);return}this._zones.push({color:e.options.overviewRulerOptions.color,position:e.options.overviewRulerOptions.position,startBufferLine:e.marker.line,endBufferLine:e.marker.line}),this._zonePool.push(this._zones[this._zones.length-1]),this._zonePoolIndex++}}setPadding(e){this._linePadding=e}_lineIntersectsZone(e,t){return t>=e.startBufferLine&&t<=e.endBufferLine}_lineAdjacentToZone(e,t,i){return t>=e.startBufferLine-this._linePadding[i||"full"]&&t<=e.endBufferLine+this._linePadding[i||"full"]}_addLineToZone(e,t){e.startBufferLine=Math.min(e.startBufferLine,t),e.endBufferLine=Math.max(e.endBufferLine,t)}},Hi={full:0,left:0,center:0,right:0},Fs={full:0,left:0,center:0,right:0},$a={full:0,left:0,center:0,right:0},Tu=class extends it{constructor(e,t,i,r,a,c,h,f){super(),this._viewportElement=e,this._screenElement=t,this._bufferService=i,this._decorationService=r,this._renderService=a,this._optionsService=c,this._themeService=h,this._coreBrowserService=f,this._colorZoneStore=new rO,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(At(()=>this._canvas?.remove()));let g=this._canvas.getContext("2d");if(g)this._ctx=g;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),t=Math.ceil((this._canvas.width-1)/3);Fs.full=this._canvas.width,Fs.left=e,Fs.center=t,Fs.right=e,this._refreshDrawHeightConstants(),$a.full=1,$a.left=1,$a.center=1+Fs.left,$a.right=1+Fs.left+Fs.center}_refreshDrawHeightConstants(){Hi.full=Math.round(2*this._coreBrowserService.dpr);let e=this._canvas.height/this._bufferService.buffer.lines.length,t=Math.round(Math.max(Math.min(e,12),6)*this._coreBrowserService.dpr);Hi.left=t,Hi.center=t,Hi.right=t}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*Hi.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*Hi.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*Hi.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*Hi.right)}),this._lastKnownBufferLength=this._bufferService.buffers.normal.lines.length}_refreshCanvasDimensions(){this._canvas.style.width=`${this._width}px`,this._canvas.width=Math.round(this._width*this._coreBrowserService.dpr),this._canvas.style.height=`${this._screenElement.clientHeight}px`,this._canvas.height=Math.round(this._screenElement.clientHeight*this._coreBrowserService.dpr),this._refreshDrawConstants(),this._refreshColorZonePadding()}_refreshDecorations(){this._shouldUpdateDimensions&&this._refreshCanvasDimensions(),this._ctx.clearRect(0,0,this._canvas.width,this._canvas.height),this._colorZoneStore.clear();for(let t of this._decorationService.decorations)this._colorZoneStore.addDecoration(t);this._ctx.lineWidth=1,this._renderRulerOutline();let e=this._colorZoneStore.zones;for(let t of e)t.position!=="full"&&this._renderColorZone(t);for(let t of e)t.position==="full"&&this._renderColorZone(t);this._shouldUpdateDimensions=!1,this._shouldUpdateAnchor=!1}_renderRulerOutline(){this._ctx.fillStyle=this._themeService.colors.overviewRulerBorder.css,this._ctx.fillRect(0,0,1,this._canvas.height),this._optionsService.rawOptions.overviewRuler.showTopBorder&&this._ctx.fillRect(1,0,this._canvas.width-1,1),this._optionsService.rawOptions.overviewRuler.showBottomBorder&&this._ctx.fillRect(1,this._canvas.height-1,this._canvas.width-1,this._canvas.height)}_renderColorZone(e){this._ctx.fillStyle=e.color,this._ctx.fillRect($a[e.position||"full"],Math.round((this._canvas.height-1)*(e.startBufferLine/this._bufferService.buffers.active.lines.length)-Hi[e.position||"full"]/2),Fs[e.position||"full"],Math.round((this._canvas.height-1)*((e.endBufferLine-e.startBufferLine)/this._bufferService.buffers.active.lines.length)+Hi[e.position||"full"]))}_queueRefresh(e,t){this._shouldUpdateDimensions=e||this._shouldUpdateDimensions,this._shouldUpdateAnchor=t||this._shouldUpdateAnchor,this._animationFrame===void 0&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>{this._refreshDecorations(),this._animationFrame=void 0}))}};Tu=It([Me(2,Rn),Me(3,So),Me(4,ms),Me(5,On),Me(6,$l),Me(7,fs)],Tu);var fe;(e=>(e.NUL="\0",e.SOH="",e.STX="",e.ETX="",e.EOT="",e.ENQ="",e.ACK="",e.BEL="\x07",e.BS="\b",e.HT=" ",e.LF=`
57
+ `,e.VT="\v",e.FF="\f",e.CR="\r",e.SO="",e.SI="",e.DLE="",e.DC1="",e.DC2="",e.DC3="",e.DC4="",e.NAK="",e.SYN="",e.ETB="",e.CAN="",e.EM="",e.SUB="",e.ESC="\x1B",e.FS="",e.GS="",e.RS="",e.US="",e.SP=" ",e.DEL=""))(fe||={});var vu;(e=>(e.PAD="€",e.HOP="",e.BPH="‚",e.NBH="ƒ",e.IND="„",e.NEL="…",e.SSA="†",e.ESA="‡",e.HTS="ˆ",e.HTJ="‰",e.VTS="Š",e.PLD="‹",e.PLU="Œ",e.RI="",e.SS2="Ž",e.SS3="",e.DCS="",e.PU1="‘",e.PU2="’",e.STS="“",e.CCH="”",e.MW="•",e.SPA="–",e.EPA="—",e.SOS="˜",e.SGCI="™",e.SCI="š",e.CSI="›",e.ST="œ",e.OSC="",e.PM="ž",e.APC="Ÿ"))(vu||={});var bw;(e=>e.ST=`${fe.ESC}\\`)(bw||={});var np=class{constructor(e,t,i,r,a,c){this._textarea=e,this._compositionView=t,this._bufferService=i,this._optionsService=r,this._coreService=a,this._renderService=c,this._isComposing=!1,this._isSendingComposition=!1,this._compositionPosition={start:0,end:0},this._dataAlreadySent=""}get isComposing(){return this._isComposing}compositionstart(){this._isComposing=!0,this._compositionPosition.start=this._textarea.value.length,this._compositionView.textContent="",this._dataAlreadySent="",this._compositionView.classList.add("active")}compositionupdate(e){this._compositionView.textContent=e.data,this.updateCompositionElements(),setTimeout(()=>{this._compositionPosition.end=this._textarea.value.length},0)}compositionend(){this._finalizeComposition(!0)}keydown(e){if(this._isComposing||this._isSendingComposition){if(e.keyCode===20||e.keyCode===229||e.keyCode===16||e.keyCode===17||e.keyCode===18)return!1;this._finalizeComposition(!1)}return e.keyCode===229?(this._handleAnyTextareaChanges(),!1):!0}_finalizeComposition(e){if(this._compositionView.classList.remove("active"),this._isComposing=!1,e){let t={start:this._compositionPosition.start,end:this._compositionPosition.end};this._isSendingComposition=!0,setTimeout(()=>{if(this._isSendingComposition){this._isSendingComposition=!1;let i;t.start+=this._dataAlreadySent.length,this._isComposing?i=this._textarea.value.substring(t.start,this._compositionPosition.start):i=this._textarea.value.substring(t.start),i.length>0&&this._coreService.triggerDataEvent(i,!0)}},0)}else{this._isSendingComposition=!1;let t=this._textarea.value.substring(this._compositionPosition.start,this._compositionPosition.end);this._coreService.triggerDataEvent(t,!0)}}_handleAnyTextareaChanges(){let e=this._textarea.value;setTimeout(()=>{if(!this._isComposing){let t=this._textarea.value,i=t.replace(e,"");this._dataAlreadySent=i,t.length>e.length?this._coreService.triggerDataEvent(i,!0):t.length<e.length?this._coreService.triggerDataEvent(`${fe.DEL}`,!0):t.length===e.length&&t!==e&&this._coreService.triggerDataEvent(t,!0)}},0)}updateCompositionElements(e){if(this._isComposing){if(this._bufferService.buffer.isCursorInViewport){let t=Math.min(this._bufferService.buffer.x,this._bufferService.cols-1),i=this._renderService.dimensions.css.cell.height,r=this._bufferService.buffer.y*this._renderService.dimensions.css.cell.height,a=t*this._renderService.dimensions.css.cell.width;this._compositionView.style.left=a+"px",this._compositionView.style.top=r+"px",this._compositionView.style.height=i+"px",this._compositionView.style.lineHeight=i+"px",this._compositionView.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._compositionView.style.fontSize=this._optionsService.rawOptions.fontSize+"px";let c=this._compositionView.getBoundingClientRect();this._textarea.style.left=a+"px",this._textarea.style.top=r+"px",this._textarea.style.width=Math.max(c.width,1)+"px",this._textarea.style.height=Math.max(c.height,1)+"px",this._textarea.style.lineHeight=c.height+"px"}e||setTimeout(()=>this.updateCompositionElements(!0),0)}}};np=It([Me(2,Rn),Me(3,On),Me(4,Lr),Me(5,ms)],np);var on=0,cn=0,un=0,Ht=0,Sb={css:"#00000000",rgba:0},Gt;(e=>{function t(a,c,h,f){return f!==void 0?`#${xr(a)}${xr(c)}${xr(h)}${xr(f)}`:`#${xr(a)}${xr(c)}${xr(h)}`}e.toCss=t;function i(a,c,h,f=255){return(a<<24|c<<16|h<<8|f)>>>0}e.toRgba=i;function r(a,c,h,f){return{css:e.toCss(a,c,h,f),rgba:e.toRgba(a,c,h,f)}}e.toColor=r})(Gt||={});var Dt;(e=>{function t(g,m){if(Ht=(m.rgba&255)/255,Ht===1)return{css:m.css,rgba:m.rgba};let v=m.rgba>>24&255,_=m.rgba>>16&255,S=m.rgba>>8&255,y=g.rgba>>24&255,x=g.rgba>>16&255,w=g.rgba>>8&255;on=y+Math.round((v-y)*Ht),cn=x+Math.round((_-x)*Ht),un=w+Math.round((S-w)*Ht);let j=Gt.toCss(on,cn,un),N=Gt.toRgba(on,cn,un);return{css:j,rgba:N}}e.blend=t;function i(g){return(g.rgba&255)===255}e.isOpaque=i;function r(g,m,v){let _=yu.ensureContrastRatio(g.rgba,m.rgba,v);if(_)return Gt.toColor(_>>24&255,_>>16&255,_>>8&255)}e.ensureContrastRatio=r;function a(g){let m=(g.rgba|255)>>>0;return[on,cn,un]=yu.toChannels(m),{css:Gt.toCss(on,cn,un),rgba:m}}e.opaque=a;function c(g,m){return Ht=Math.round(m*255),[on,cn,un]=yu.toChannels(g.rgba),{css:Gt.toCss(on,cn,un,Ht),rgba:Gt.toRgba(on,cn,un,Ht)}}e.opacity=c;function h(g,m){return Ht=g.rgba&255,c(g,Ht*m/255)}e.multiplyOpacity=h;function f(g){return[g.rgba>>24&255,g.rgba>>16&255,g.rgba>>8&255]}e.toColorRGB=f})(Dt||={});var Bt;(e=>{let t,i;try{let a=document.createElement("canvas");a.width=1,a.height=1;let c=a.getContext("2d",{willReadFrequently:!0});c&&(t=c,t.globalCompositeOperation="copy",i=t.createLinearGradient(0,0,1,1))}catch{}function r(a){if(a.match(/#[\da-f]{3,8}/i))switch(a.length){case 4:return on=parseInt(a.slice(1,2).repeat(2),16),cn=parseInt(a.slice(2,3).repeat(2),16),un=parseInt(a.slice(3,4).repeat(2),16),Gt.toColor(on,cn,un);case 5:return on=parseInt(a.slice(1,2).repeat(2),16),cn=parseInt(a.slice(2,3).repeat(2),16),un=parseInt(a.slice(3,4).repeat(2),16),Ht=parseInt(a.slice(4,5).repeat(2),16),Gt.toColor(on,cn,un,Ht);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 c=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(c)return on=parseInt(c[1]),cn=parseInt(c[2]),un=parseInt(c[3]),Ht=Math.round((c[5]===void 0?1:parseFloat(c[5]))*255),Gt.toColor(on,cn,un,Ht);if(!t||!i)throw new Error("css.toColor: Unsupported css format");if(t.fillStyle=i,t.fillStyle=a,typeof t.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(t.fillRect(0,0,1,1),[on,cn,un,Ht]=t.getImageData(0,0,1,1).data,Ht!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:Gt.toRgba(on,cn,un,Ht),css:a}}e.toColor=r})(Bt||={});var An;(e=>{function t(r){return i(r>>16&255,r>>8&255,r&255)}e.relativeLuminance=t;function i(r,a,c){let h=r/255,f=a/255,g=c/255,m=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),_=g<=.03928?g/12.92:Math.pow((g+.055)/1.055,2.4);return m*.2126+v*.7152+_*.0722}e.relativeLuminance2=i})(An||={});var yu;(e=>{function t(h,f){if(Ht=(f&255)/255,Ht===1)return f;let g=f>>24&255,m=f>>16&255,v=f>>8&255,_=h>>24&255,S=h>>16&255,y=h>>8&255;return on=_+Math.round((g-_)*Ht),cn=S+Math.round((m-S)*Ht),un=y+Math.round((v-y)*Ht),Gt.toRgba(on,cn,un)}e.blend=t;function i(h,f,g){let m=An.relativeLuminance(h>>8),v=An.relativeLuminance(f>>8);if(cs(m,v)<g){if(v<m){let y=r(h,f,g),x=cs(m,An.relativeLuminance(y>>8));if(x<g){let w=a(h,f,g),j=cs(m,An.relativeLuminance(w>>8));return x>j?y:w}return y}let _=a(h,f,g),S=cs(m,An.relativeLuminance(_>>8));if(S<g){let y=r(h,f,g),x=cs(m,An.relativeLuminance(y>>8));return S>x?_:y}return _}}e.ensureContrastRatio=i;function r(h,f,g){let m=h>>24&255,v=h>>16&255,_=h>>8&255,S=f>>24&255,y=f>>16&255,x=f>>8&255,w=cs(An.relativeLuminance2(S,y,x),An.relativeLuminance2(m,v,_));for(;w<g&&(S>0||y>0||x>0);)S-=Math.max(0,Math.ceil(S*.1)),y-=Math.max(0,Math.ceil(y*.1)),x-=Math.max(0,Math.ceil(x*.1)),w=cs(An.relativeLuminance2(S,y,x),An.relativeLuminance2(m,v,_));return(S<<24|y<<16|x<<8|255)>>>0}e.reduceLuminance=r;function a(h,f,g){let m=h>>24&255,v=h>>16&255,_=h>>8&255,S=f>>24&255,y=f>>16&255,x=f>>8&255,w=cs(An.relativeLuminance2(S,y,x),An.relativeLuminance2(m,v,_));for(;w<g&&(S<255||y<255||x<255);)S=Math.min(255,S+Math.ceil((255-S)*.1)),y=Math.min(255,y+Math.ceil((255-y)*.1)),x=Math.min(255,x+Math.ceil((255-x)*.1)),w=cs(An.relativeLuminance2(S,y,x),An.relativeLuminance2(m,v,_));return(S<<24|y<<16|x<<8|255)>>>0}e.increaseLuminance=a;function c(h){return[h>>24&255,h>>16&255,h>>8&255,h&255]}e.toChannels=c})(yu||={});function xr(e){let t=e.toString(16);return t.length<2?"0"+t:t}function cs(e,t){return e<t?(t+.05)/(e+.05):(e+.05)/(t+.05)}var lO=class extends yo{constructor(e,t,i){super(),this.content=0,this.combinedData="",this.fg=e.fg,this.bg=e.bg,this.combinedData=t,this._width=i}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()]}},Du=class{constructor(e){this._bufferService=e,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new gi}register(e){let t={id:this._nextCharacterJoinerId++,handler:e};return this._characterJoiners.push(t),t.id}deregister(e){for(let t=0;t<this._characterJoiners.length;t++)if(this._characterJoiners[t].id===e)return this._characterJoiners.splice(t,1),!0;return!1}getJoinedCharacters(e){if(this._characterJoiners.length===0)return[];let t=this._bufferService.buffer.lines.get(e);if(!t||t.length===0)return[];let i=[],r=t.translateToString(!0),a=0,c=0,h=0,f=t.getFg(0),g=t.getBg(0);for(let m=0;m<t.getTrimmedLength();m++)if(t.loadCell(m,this._workCell),this._workCell.getWidth()!==0){if(this._workCell.fg!==f||this._workCell.bg!==g){if(m-a>1){let v=this._getJoinedRanges(r,h,c,t,a);for(let _=0;_<v.length;_++)i.push(v[_])}a=m,h=c,f=this._workCell.fg,g=this._workCell.bg}c+=this._workCell.getChars().length||Ks.length}if(this._bufferService.cols-a>1){let m=this._getJoinedRanges(r,h,c,t,a);for(let v=0;v<m.length;v++)i.push(m[v])}return i}_getJoinedRanges(e,t,i,r,a){let c=e.substring(t,i),h=[];try{h=this._characterJoiners[0].handler(c)}catch(f){console.error(f)}for(let f=1;f<this._characterJoiners.length;f++)try{let g=this._characterJoiners[f].handler(c);for(let m=0;m<g.length;m++)Du._mergeRanges(h,g[m])}catch(g){console.error(g)}return this._stringRangesToCellRanges(h,r,a),h}_stringRangesToCellRanges(e,t,i){let r=0,a=!1,c=0,h=e[r];if(h){for(let f=i;f<this._bufferService.cols;f++){let g=t.getWidth(f),m=t.getString(f).length||Ks.length;if(g!==0){if(!a&&h[0]<=c&&(h[0]=f,a=!0),h[1]<=c){if(h[1]=f,h=e[++r],!h)break;h[0]<=c?(h[0]=f,a=!0):a=!1}c+=m}}h&&(h[1]=this._bufferService.cols)}}static _mergeRanges(e,t){let i=!1;for(let r=0;r<e.length;r++){let a=e[r];if(i){if(t[1]<=a[0])return e[r-1][1]=t[1],e;if(t[1]<=a[1])return e[r-1][1]=Math.max(t[1],a[1]),e.splice(r,1),e;e.splice(r,1),r--}else{if(t[1]<=a[0])return e.splice(r,0,t),e;if(t[1]<=a[1])return a[0]=Math.min(t[0],a[0]),e;t[0]<a[1]&&(a[0]=Math.min(t[0],a[0]),i=!0);continue}}return i?e[e.length-1][1]=t[1]:e.push(t),e}};Du=It([Me(0,Rn)],Du);function aO(e){return 57508<=e&&e<=57558}function oO(e){return 9472<=e&&e<=9631}function cO(e){return aO(e)||oO(e)}function uO(){return{css:{canvas:iu(),cell:iu()},device:{canvas:iu(),cell:iu(),char:{width:0,height:0,left:0,top:0}}}}function iu(){return{width:0,height:0}}var ip=class{constructor(e,t,i,r,a,c,h){this._document=e,this._characterJoinerService=t,this._optionsService=i,this._coreBrowserService=r,this._coreService=a,this._decorationService=c,this._themeService=h,this._workCell=new gi,this._columnSelectMode=!1,this.defaultSpacing=0}handleSelectionChanged(e,t,i){this._selectionStart=e,this._selectionEnd=t,this._columnSelectMode=i}createRow(e,t,i,r,a,c,h,f,g,m,v){let _=[],S=this._characterJoinerService.getJoinedCharacters(t),y=this._themeService.colors,x=e.getNoBgTrimmedLength();i&&x<c+1&&(x=c+1);let w,j=0,N="",M=0,A=0,R=0,I=0,H=!1,O=0,$=!1,Q=0,z=0,G=[],P=m!==-1&&v!==-1;for(let L=0;L<x;L++){e.loadCell(L,this._workCell);let F=this._workCell.getWidth();if(F===0)continue;let K=!1,q=L>=z,te=L,ne=this._workCell;if(S.length>0&&L===S[0][0]&&q){let Ne=S.shift(),ct=this._isCellInSelection(Ne[0],t);for(M=Ne[0]+1;M<Ne[1];M++)q&&=ct===this._isCellInSelection(M,t);q&&=!i||c<Ne[0]||c>=Ne[1],q?(K=!0,ne=new lO(this._workCell,e.translateToString(!0,Ne[0],Ne[1]),Ne[1]-Ne[0]),te=Ne[1]-1,F=ne.getWidth()):z=Ne[1]}let ge=this._isCellInSelection(L,t),D=i&&L===c,De=P&&L>=m&&L<=v,we=!1;this._decorationService.forEachDecorationAtCell(L,t,void 0,Ne=>{we=!0});let T=ne.getChars()||Ks;if(T===" "&&(ne.isUnderline()||ne.isOverline())&&(T=" "),Q=F*f-g.get(T,ne.isBold(),ne.isItalic()),!w)w=this._document.createElement("span");else if(j&&(ge&&$||!ge&&!$&&ne.bg===A)&&(ge&&$&&y.selectionForeground||ne.fg===R)&&ne.extended.ext===I&&De===H&&Q===O&&!D&&!K&&!we&&q){ne.isInvisible()?N+=Ks:N+=T,j++;continue}else j&&(w.textContent=N),w=this._document.createElement("span"),j=0,N="";if(A=ne.bg,R=ne.fg,I=ne.extended.ext,H=De,O=Q,$=ge,K&&c>=L&&c<=te&&(c=L),!this._coreService.isCursorHidden&&D&&this._coreService.isCursorInitialized){if(G.push("xterm-cursor"),this._coreBrowserService.isFocused)h&&G.push("xterm-cursor-blink"),G.push(r==="bar"?"xterm-cursor-bar":r==="underline"?"xterm-cursor-underline":"xterm-cursor-block");else if(a)switch(a){case"outline":G.push("xterm-cursor-outline");break;case"block":G.push("xterm-cursor-block");break;case"bar":G.push("xterm-cursor-bar");break;case"underline":G.push("xterm-cursor-underline");break}}if(ne.isBold()&&G.push("xterm-bold"),ne.isItalic()&&G.push("xterm-italic"),ne.isDim()&&G.push("xterm-dim"),ne.isInvisible()?N=Ks:N=ne.getChars()||Ks,ne.isUnderline()&&(G.push(`xterm-underline-${ne.extended.underlineStyle}`),N===" "&&(N=" "),!ne.isUnderlineColorDefault()))if(ne.isUnderlineColorRGB())w.style.textDecorationColor=`rgb(${yo.toColorRGB(ne.getUnderlineColor()).join(",")})`;else{let Ne=ne.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&ne.isBold()&&Ne<8&&(Ne+=8),w.style.textDecorationColor=y.ansi[Ne].css}ne.isOverline()&&(G.push("xterm-overline"),N===" "&&(N=" ")),ne.isStrikethrough()&&G.push("xterm-strikethrough"),De&&(w.style.textDecoration="underline");let E=ne.getFgColor(),J=ne.getFgColorMode(),se=ne.getBgColor(),pe=ne.getBgColorMode(),ce=!!ne.isInverse();if(ce){let Ne=E;E=se,se=Ne;let ct=J;J=pe,pe=ct}let _e,ke,oe=!1;this._decorationService.forEachDecorationAtCell(L,t,void 0,Ne=>{Ne.options.layer!=="top"&&oe||(Ne.backgroundColorRGB&&(pe=50331648,se=Ne.backgroundColorRGB.rgba>>8&16777215,_e=Ne.backgroundColorRGB),Ne.foregroundColorRGB&&(J=50331648,E=Ne.foregroundColorRGB.rgba>>8&16777215,ke=Ne.foregroundColorRGB),oe=Ne.options.layer==="top")}),!oe&&ge&&(_e=this._coreBrowserService.isFocused?y.selectionBackgroundOpaque:y.selectionInactiveBackgroundOpaque,se=_e.rgba>>8&16777215,pe=50331648,oe=!0,y.selectionForeground&&(J=50331648,E=y.selectionForeground.rgba>>8&16777215,ke=y.selectionForeground)),oe&&G.push("xterm-decoration-top");let ye;switch(pe){case 16777216:case 33554432:ye=y.ansi[se],G.push(`xterm-bg-${se}`);break;case 50331648:ye=Gt.toColor(se>>16,se>>8&255,se&255),this._addStyle(w,`background-color:#${bb((se>>>0).toString(16),"0",6)}`);break;default:ce?(ye=y.foreground,G.push("xterm-bg-257")):ye=y.background}switch(_e||ne.isDim()&&(_e=Dt.multiplyOpacity(ye,.5)),J){case 16777216:case 33554432:ne.isBold()&&E<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(E+=8),this._applyMinimumContrast(w,ye,y.ansi[E],ne,_e,void 0)||G.push(`xterm-fg-${E}`);break;case 50331648:let Ne=Gt.toColor(E>>16&255,E>>8&255,E&255);this._applyMinimumContrast(w,ye,Ne,ne,_e,ke)||this._addStyle(w,`color:#${bb(E.toString(16),"0",6)}`);break;default:this._applyMinimumContrast(w,ye,y.foreground,ne,_e,ke)||ce&&G.push("xterm-fg-257")}G.length&&(w.className=G.join(" "),G.length=0),!D&&!K&&!we&&q?j++:w.textContent=N,Q!==this.defaultSpacing&&(w.style.letterSpacing=`${Q}px`),_.push(w),L=te}return w&&j&&(w.textContent=N),_}_applyMinimumContrast(e,t,i,r,a,c){if(this._optionsService.rawOptions.minimumContrastRatio===1||cO(r.getCode()))return!1;let h=this._getContrastCache(r),f;if(!a&&!c&&(f=h.getColor(t.rgba,i.rgba)),f===void 0){let g=this._optionsService.rawOptions.minimumContrastRatio/(r.isDim()?2:1);f=Dt.ensureContrastRatio(a||t,c||i,g),h.setColor((a||t).rgba,(c||i).rgba,f??null)}return f?(this._addStyle(e,`color:${f.css}`),!0):!1}_getContrastCache(e){return e.isDim()?this._themeService.colors.halfContrastCache:this._themeService.colors.contrastCache}_addStyle(e,t){e.setAttribute("style",`${e.getAttribute("style")||""}${t};`)}_isCellInSelection(e,t){let i=this._selectionStart,r=this._selectionEnd;return!i||!r?!1:this._columnSelectMode?i[0]<=r[0]?e>=i[0]&&t>=i[1]&&e<r[0]&&t<=r[1]:e<i[0]&&t>=i[1]&&e>=r[0]&&t<=r[1]:t>i[1]&&t<r[1]||i[1]===r[1]&&t===i[1]&&e>=i[0]&&e<r[0]||i[1]<r[1]&&t===r[1]&&e<r[0]||i[1]<r[1]&&t===i[1]&&e>=i[0]}};ip=It([Me(1,iw),Me(2,On),Me(3,fs),Me(4,Lr),Me(5,So),Me(6,$l)],ip);function bb(e,t,i){for(;e.length<i;)e=t+e;return e}var hO=class{constructor(e,t){this._flat=new Float32Array(256),this._font="",this._fontSize=0,this._weight="normal",this._weightBold="bold",this._measureElements=[],this._container=e.createElement("div"),this._container.classList.add("xterm-width-cache-measure-container"),this._container.setAttribute("aria-hidden","true"),this._container.style.whiteSpace="pre",this._container.style.fontKerning="none";let i=e.createElement("span");i.classList.add("xterm-char-measure-element");let r=e.createElement("span");r.classList.add("xterm-char-measure-element"),r.style.fontWeight="bold";let a=e.createElement("span");a.classList.add("xterm-char-measure-element"),a.style.fontStyle="italic";let c=e.createElement("span");c.classList.add("xterm-char-measure-element"),c.style.fontWeight="bold",c.style.fontStyle="italic",this._measureElements=[i,r,a,c],this._container.appendChild(i),this._container.appendChild(r),this._container.appendChild(a),this._container.appendChild(c),t.appendChild(this._container),this.clear()}dispose(){this._container.remove(),this._measureElements.length=0,this._holey=void 0}clear(){this._flat.fill(-9999),this._holey=new Map}setFont(e,t,i,r){e===this._font&&t===this._fontSize&&i===this._weight&&r===this._weightBold||(this._font=e,this._fontSize=t,this._weight=i,this._weightBold=r,this._container.style.fontFamily=this._font,this._container.style.fontSize=`${this._fontSize}px`,this._measureElements[0].style.fontWeight=`${i}`,this._measureElements[1].style.fontWeight=`${r}`,this._measureElements[2].style.fontWeight=`${i}`,this._measureElements[3].style.fontWeight=`${r}`,this.clear())}get(e,t,i){let r=0;if(!t&&!i&&e.length===1&&(r=e.charCodeAt(0))<256){if(this._flat[r]!==-9999)return this._flat[r];let h=this._measure(e,0);return h>0&&(this._flat[r]=h),h}let a=e;t&&(a+="B"),i&&(a+="I");let c=this._holey.get(a);if(c===void 0){let h=0;t&&(h|=1),i&&(h|=2),c=this._measure(e,h),c>0&&this._holey.set(a,c)}return c}_measure(e,t){let i=this._measureElements[t];return i.textContent=e.repeat(32),i.offsetWidth/32}},dO=class{constructor(){this.clear()}clear(){this.hasSelection=!1,this.columnSelectMode=!1,this.viewportStartRow=0,this.viewportEndRow=0,this.viewportCappedStartRow=0,this.viewportCappedEndRow=0,this.startCol=0,this.endCol=0,this.selectionStart=void 0,this.selectionEnd=void 0}update(e,t,i,r=!1){if(this.selectionStart=t,this.selectionEnd=i,!t||!i||t[0]===i[0]&&t[1]===i[1]){this.clear();return}let a=e.buffers.active.ydisp,c=t[1]-a,h=i[1]-a,f=Math.max(c,0),g=Math.min(h,e.rows-1);if(f>=e.rows||g<0){this.clear();return}this.hasSelection=!0,this.columnSelectMode=r,this.viewportStartRow=c,this.viewportEndRow=h,this.viewportCappedStartRow=f,this.viewportCappedEndRow=g,this.startCol=t[0],this.endCol=i[0]}isCellSelected(e,t,i){return this.hasSelection?(i-=e.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?t>=this.startCol&&i>=this.viewportCappedStartRow&&t<this.endCol&&i<=this.viewportCappedEndRow:t<this.startCol&&i>=this.viewportCappedStartRow&&t>=this.endCol&&i<=this.viewportCappedEndRow:i>this.viewportStartRow&&i<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&i===this.viewportStartRow&&t>=this.startCol&&t<this.endCol||this.viewportStartRow<this.viewportEndRow&&i===this.viewportEndRow&&t<this.endCol||this.viewportStartRow<this.viewportEndRow&&i===this.viewportStartRow&&t>=this.startCol):!1}};function fO(){return new dO}var tm="xterm-dom-renderer-owner-",di="xterm-rows",su="xterm-fg-",xb="xterm-bg-",Va="xterm-focus",ru="xterm-selection",mO=1,sp=class extends it{constructor(e,t,i,r,a,c,h,f,g,m,v,_,S,y){super(),this._terminal=e,this._document=t,this._element=i,this._screenElement=r,this._viewportElement=a,this._helperContainer=c,this._linkifier2=h,this._charSizeService=g,this._optionsService=m,this._bufferService=v,this._coreService=_,this._coreBrowserService=S,this._themeService=y,this._terminalClass=mO++,this._rowElements=[],this._selectionRenderModel=fO(),this.onRequestRedraw=this._register(new Ce).event,this._rowContainer=this._document.createElement("div"),this._rowContainer.classList.add(di),this._rowContainer.style.lineHeight="normal",this._rowContainer.setAttribute("aria-hidden","true"),this._refreshRowElements(this._bufferService.cols,this._bufferService.rows),this._selectionContainer=this._document.createElement("div"),this._selectionContainer.classList.add(ru),this._selectionContainer.setAttribute("aria-hidden","true"),this.dimensions=uO(),this._updateDimensions(),this._register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this._register(this._themeService.onChangeColors(x=>this._injectCss(x))),this._injectCss(this._themeService.colors),this._rowFactory=f.createInstance(ip,document),this._element.classList.add(tm+this._terminalClass),this._screenElement.appendChild(this._rowContainer),this._screenElement.appendChild(this._selectionContainer),this._register(this._linkifier2.onShowLinkUnderline(x=>this._handleLinkHover(x))),this._register(this._linkifier2.onHideLinkUnderline(x=>this._handleLinkLeave(x))),this._register(At(()=>{this._element.classList.remove(tm+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()})),this._widthCache=new hO(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 i of this._rowElements)i.style.width=`${this.dimensions.css.canvas.width}px`,i.style.height=`${this.dimensions.css.cell.height}px`,i.style.lineHeight=`${this.dimensions.css.cell.height}px`,i.style.overflow="hidden";this._dimensionsStyleElement||(this._dimensionsStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._dimensionsStyleElement));let t=`${this._terminalSelector} .${di} span { display: inline-block; height: 100%; vertical-align: top;}`;this._dimensionsStyleElement.textContent=t,this._selectionContainer.style.height=this._viewportElement.style.height,this._screenElement.style.width=`${this.dimensions.css.canvas.width}px`,this._screenElement.style.height=`${this.dimensions.css.canvas.height}px`}_injectCss(e){this._themeStyleElement||(this._themeStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._themeStyleElement));let t=`${this._terminalSelector} .${di} { pointer-events: none; color: ${e.foreground.css}; font-family: ${this._optionsService.rawOptions.fontFamily}; font-size: ${this._optionsService.rawOptions.fontSize}px; font-kerning: none; white-space: pre}`;t+=`${this._terminalSelector} .${di} .xterm-dim { color: ${Dt.multiplyOpacity(e.foreground,.5).css};}`,t+=`${this._terminalSelector} span:not(.xterm-bold) { font-weight: ${this._optionsService.rawOptions.fontWeight};}${this._terminalSelector} span.xterm-bold { font-weight: ${this._optionsService.rawOptions.fontWeightBold};}${this._terminalSelector} span.xterm-italic { font-style: italic;}`;let i=`blink_underline_${this._terminalClass}`,r=`blink_bar_${this._terminalClass}`,a=`blink_block_${this._terminalClass}`;t+=`@keyframes ${i} { 50% { border-bottom-style: hidden; }}`,t+=`@keyframes ${r} { 50% { box-shadow: none; }}`,t+=`@keyframes ${a} { 0% { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css}; } 50% { background-color: inherit; color: ${e.cursor.css}; }}`,t+=`${this._terminalSelector} .${di}.${Va} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${i} 1s step-end infinite;}${this._terminalSelector} .${di}.${Va} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${r} 1s step-end infinite;}${this._terminalSelector} .${di}.${Va} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${a} 1s step-end infinite;}${this._terminalSelector} .${di} .xterm-cursor.xterm-cursor-block { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css};}${this._terminalSelector} .${di} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${e.cursor.css} !important; color: ${e.cursorAccent.css} !important;}${this._terminalSelector} .${di} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${e.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${di} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${e.cursor.css} inset;}${this._terminalSelector} .${di} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${e.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,t+=`${this._terminalSelector} .${ru} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${ru} div { position: absolute; background-color: ${e.selectionBackgroundOpaque.css};}${this._terminalSelector} .${ru} div { position: absolute; background-color: ${e.selectionInactiveBackgroundOpaque.css};}`;for(let[c,h]of e.ansi.entries())t+=`${this._terminalSelector} .${su}${c} { color: ${h.css}; }${this._terminalSelector} .${su}${c}.xterm-dim { color: ${Dt.multiplyOpacity(h,.5).css}; }${this._terminalSelector} .${xb}${c} { background-color: ${h.css}; }`;t+=`${this._terminalSelector} .${su}257 { color: ${Dt.opaque(e.background).css}; }${this._terminalSelector} .${su}257.xterm-dim { color: ${Dt.multiplyOpacity(Dt.opaque(e.background),.5).css}; }${this._terminalSelector} .${xb}257 { background-color: ${e.foreground.css}; }`,this._themeStyleElement.textContent=t}_setDefaultSpacing(){let e=this.dimensions.css.cell.width-this._widthCache.get("W",!1,!1);this._rowContainer.style.letterSpacing=`${e}px`,this._rowFactory.defaultSpacing=e}handleDevicePixelRatioChange(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}_refreshRowElements(e,t){for(let i=this._rowElements.length;i<=t;i++){let r=this._document.createElement("div");this._rowContainer.appendChild(r),this._rowElements.push(r)}for(;this._rowElements.length>t;)this._rowContainer.removeChild(this._rowElements.pop())}handleResize(e,t){this._refreshRowElements(e,t),this._updateDimensions(),this.handleSelectionChanged(this._selectionRenderModel.selectionStart,this._selectionRenderModel.selectionEnd,this._selectionRenderModel.columnSelectMode)}handleCharSizeChanged(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}handleBlur(){this._rowContainer.classList.remove(Va),this.renderRows(0,this._bufferService.rows-1)}handleFocus(){this._rowContainer.classList.add(Va),this.renderRows(this._bufferService.buffer.y,this._bufferService.buffer.y)}handleSelectionChanged(e,t,i){if(this._selectionContainer.replaceChildren(),this._rowFactory.handleSelectionChanged(e,t,i),this.renderRows(0,this._bufferService.rows-1),!e||!t||(this._selectionRenderModel.update(this._terminal,e,t,i),!this._selectionRenderModel.hasSelection))return;let r=this._selectionRenderModel.viewportStartRow,a=this._selectionRenderModel.viewportEndRow,c=this._selectionRenderModel.viewportCappedStartRow,h=this._selectionRenderModel.viewportCappedEndRow,f=this._document.createDocumentFragment();if(i){let g=e[0]>t[0];f.appendChild(this._createSelectionElement(c,g?t[0]:e[0],g?e[0]:t[0],h-c+1))}else{let g=r===c?e[0]:0,m=c===a?t[0]:this._bufferService.cols;f.appendChild(this._createSelectionElement(c,g,m));let v=h-c-1;if(f.appendChild(this._createSelectionElement(c+1,0,this._bufferService.cols,v)),c!==h){let _=a===h?t[0]:this._bufferService.cols;f.appendChild(this._createSelectionElement(h,0,_))}}this._selectionContainer.appendChild(f)}_createSelectionElement(e,t,i,r=1){let a=this._document.createElement("div"),c=t*this.dimensions.css.cell.width,h=this.dimensions.css.cell.width*(i-t);return c+h>this.dimensions.css.canvas.width&&(h=this.dimensions.css.canvas.width-c),a.style.height=`${r*this.dimensions.css.cell.height}px`,a.style.top=`${e*this.dimensions.css.cell.height}px`,a.style.left=`${c}px`,a.style.width=`${h}px`,a}handleCursorMove(){}_handleOptionsChanged(){this._updateDimensions(),this._injectCss(this._themeService.colors),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}clear(){for(let e of this._rowElements)e.replaceChildren()}renderRows(e,t){let i=this._bufferService.buffer,r=i.ybase+i.y,a=Math.min(i.x,this._bufferService.cols-1),c=this._coreService.decPrivateModes.cursorBlink??this._optionsService.rawOptions.cursorBlink,h=this._coreService.decPrivateModes.cursorStyle??this._optionsService.rawOptions.cursorStyle,f=this._optionsService.rawOptions.cursorInactiveStyle;for(let g=e;g<=t;g++){let m=g+i.ydisp,v=this._rowElements[g],_=i.lines.get(m);if(!v||!_)break;v.replaceChildren(...this._rowFactory.createRow(_,m,m===r,h,f,a,c,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${tm}${this._terminalClass}`}_handleLinkHover(e){this._setCellUnderline(e.x1,e.x2,e.y1,e.y2,e.cols,!0)}_handleLinkLeave(e){this._setCellUnderline(e.x1,e.x2,e.y1,e.y2,e.cols,!1)}_setCellUnderline(e,t,i,r,a,c){i<0&&(e=0),r<0&&(t=0);let h=this._bufferService.rows-1;i=Math.max(Math.min(i,h),0),r=Math.max(Math.min(r,h),0),a=Math.min(a,this._bufferService.cols);let f=this._bufferService.buffer,g=f.ybase+f.y,m=Math.min(f.x,a-1),v=this._optionsService.rawOptions.cursorBlink,_=this._optionsService.rawOptions.cursorStyle,S=this._optionsService.rawOptions.cursorInactiveStyle;for(let y=i;y<=r;++y){let x=y+f.ydisp,w=this._rowElements[y],j=f.lines.get(x);if(!w||!j)break;w.replaceChildren(...this._rowFactory.createRow(j,x,x===g,_,S,m,v,this.dimensions.css.cell.width,this._widthCache,c?y===i?e:0:-1,c?(y===r?t:a)-1:-1))}}};sp=It([Me(7,Qp),Me(8,Fu),Me(9,On),Me(10,Rn),Me(11,Lr),Me(12,fs),Me(13,$l)],sp);var rp=class extends it{constructor(e,t,i){super(),this._optionsService=i,this.width=0,this.height=0,this._onCharSizeChange=this._register(new Ce),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this._register(new gO(this._optionsService))}catch{this._measureStrategy=this._register(new pO(e,t,this._optionsService))}this._register(this._optionsService.onMultipleOptionChange(["fontFamily","fontSize"],()=>this.measure()))}get hasValidSize(){return this.width>0&&this.height>0}measure(){let e=this._measureStrategy.measure();(e.width!==this.width||e.height!==this.height)&&(this.width=e.width,this.height=e.height,this._onCharSizeChange.fire())}};rp=It([Me(2,On)],rp);var xw=class extends it{constructor(){super(...arguments),this._result={width:0,height:0}}_validateAndSet(e,t){e!==void 0&&e>0&&t!==void 0&&t>0&&(this._result.width=e,this._result.height=t)}},pO=class extends xw{constructor(e,t,i){super(),this._document=e,this._parentElement=t,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}},gO=class extends xw{constructor(e){super(),this._optionsService=e,this._canvas=new OffscreenCanvas(100,100),this._ctx=this._canvas.getContext("2d");let t=this._ctx.measureText("W");if(!("width"in t&&"fontBoundingBoxAscent"in t&&"fontBoundingBoxDescent"in t))throw new Error("Required font metrics not supported")}measure(){this._ctx.font=`${this._optionsService.rawOptions.fontSize}px ${this._optionsService.rawOptions.fontFamily}`;let e=this._ctx.measureText("W");return this._validateAndSet(e.width,e.fontBoundingBoxAscent+e.fontBoundingBoxDescent),this._result}},_O=class extends it{constructor(e,t,i){super(),this._textarea=e,this._window=t,this.mainDocument=i,this._isFocused=!1,this._cachedIsFocused=void 0,this._screenDprMonitor=this._register(new vO(this._window)),this._onDprChange=this._register(new Ce),this.onDprChange=this._onDprChange.event,this._onWindowChange=this._register(new Ce),this.onWindowChange=this._onWindowChange.event,this._register(this.onWindowChange(r=>this._screenDprMonitor.setWindow(r))),this._register(bn.forward(this._screenDprMonitor.onDprChange,this._onDprChange)),this._register($e(this._textarea,"focus",()=>this._isFocused=!0)),this._register($e(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}},vO=class extends it{constructor(e){super(),this._parentWindow=e,this._windowResizeListener=this._register(new Pl),this._onDprChange=this._register(new Ce),this.onDprChange=this._onDprChange.event,this._outerListener=()=>this._setDprAndFireIfDiffers(),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._updateDpr(),this._setWindowResizeListener(),this._register(At(()=>this.clearListener()))}setWindow(e){this._parentWindow=e,this._setWindowResizeListener(),this._setDprAndFireIfDiffers()}_setWindowResizeListener(){this._windowResizeListener.value=$e(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)}},yO=class extends it{constructor(){super(),this.linkProviders=[],this._register(At(()=>this.linkProviders.length=0))}registerLinkProvider(e){return this.linkProviders.push(e),{dispose:()=>{let t=this.linkProviders.indexOf(e);t!==-1&&this.linkProviders.splice(t,1)}}}};function rg(e,t,i){let r=i.getBoundingClientRect(),a=e.getComputedStyle(i),c=parseInt(a.getPropertyValue("padding-left")),h=parseInt(a.getPropertyValue("padding-top"));return[t.clientX-r.left-c,t.clientY-r.top-h]}function SO(e,t,i,r,a,c,h,f,g){if(!c)return;let m=rg(e,t,i);if(m)return m[0]=Math.ceil((m[0]+(g?h/2:0))/h),m[1]=Math.ceil(m[1]/f),m[0]=Math.min(Math.max(m[0],1),r+(g?1:0)),m[1]=Math.min(Math.max(m[1],1),a),m}var lp=class{constructor(e,t){this._renderService=e,this._charSizeService=t}getCoords(e,t,i,r,a){return SO(window,e,t,i,r,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,a)}getMouseReportCoords(e,t){let i=rg(window,e,t);if(this._charSizeService.hasValidSize)return i[0]=Math.min(Math.max(i[0],0),this._renderService.dimensions.css.canvas.width-1),i[1]=Math.min(Math.max(i[1],0),this._renderService.dimensions.css.canvas.height-1),{col:Math.floor(i[0]/this._renderService.dimensions.css.cell.width),row:Math.floor(i[1]/this._renderService.dimensions.css.cell.height),x:Math.floor(i[0]),y:Math.floor(i[1])}}};lp=It([Me(0,ms),Me(1,Fu)],lp);var bO=class{constructor(e,t){this._renderCallback=e,this._coreBrowserService=t,this._refreshCallbacks=[]}dispose(){this._animationFrame&&(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}addRefreshCallback(e){return this._refreshCallbacks.push(e),this._animationFrame||(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._innerRefresh())),this._animationFrame}refresh(e,t,i){this._rowCount=i,e=e!==void 0?e:0,t=t!==void 0?t:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,e):e,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,t):t,!this._animationFrame&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._innerRefresh()))}_innerRefresh(){if(this._animationFrame=void 0,this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0){this._runRefreshCallbacks();return}let e=Math.max(this._rowStart,0),t=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(e,t),this._runRefreshCallbacks()}_runRefreshCallbacks(){for(let e of this._refreshCallbacks)e(0);this._refreshCallbacks=[]}},ww={};M4(ww,{getSafariVersion:()=>wO,isChromeOS:()=>Ew,isFirefox:()=>Cw,isIpad:()=>CO,isIphone:()=>kO,isLegacyEdge:()=>xO,isLinux:()=>lg,isMac:()=>Mu,isNode:()=>$u,isSafari:()=>kw,isWindows:()=>Nw});var $u=typeof process<"u"&&"title"in process,bo=$u?"node":navigator.userAgent,xo=$u?"node":navigator.platform,Cw=bo.includes("Firefox"),xO=bo.includes("Edge"),kw=/^((?!chrome|android).)*safari/i.test(bo);function wO(){if(!kw)return 0;let e=bo.match(/Version\/(\d+)/);return e===null||e.length<2?0:parseInt(e[1])}var Mu=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(xo),CO=xo==="iPad",kO=xo==="iPhone",Nw=["Windows","Win16","Win32","WinCE"].includes(xo),lg=xo.indexOf("Linux")>=0,Ew=/\bCrOS\b/.test(bo),jw=class{constructor(){this._tasks=[],this._i=0}enqueue(e){this._tasks.push(e),this._start()}flush(){for(;this._i<this._tasks.length;)this._tasks[this._i]()||this._i++;this.clear()}clear(){this._idleCallback&&(this._cancelCallback(this._idleCallback),this._idleCallback=void 0),this._i=0,this._tasks.length=0}_start(){this._idleCallback||(this._idleCallback=this._requestCallback(this._process.bind(this)))}_process(e){this._idleCallback=void 0;let t=0,i=0,r=e.timeRemaining(),a=0;for(;this._i<this._tasks.length;){if(t=performance.now(),this._tasks[this._i]()||this._i++,t=Math.max(1,performance.now()-t),i=Math.max(t,i),a=e.timeRemaining(),i*1.5>a){r-t<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(r-t))}ms`),this._start();return}r=a}this.clear()}},NO=class extends jw{_requestCallback(e){return setTimeout(()=>e(this._createDeadline(16)))}_cancelCallback(e){clearTimeout(e)}_createDeadline(e){let t=performance.now()+e;return{timeRemaining:()=>Math.max(0,t-performance.now())}}},EO=class extends jw{_requestCallback(e){return requestIdleCallback(e)}_cancelCallback(e){cancelIdleCallback(e)}},Au=!$u&&"requestIdleCallback"in window?EO:NO,jO=class{constructor(){this._queue=new Au}set(e){this._queue.clear(),this._queue.enqueue(e)}flush(){this._queue.flush()}},ap=class extends it{constructor(e,t,i,r,a,c,h,f,g){super(),this._rowCount=e,this._optionsService=i,this._charSizeService=r,this._coreService=a,this._coreBrowserService=f,this._renderer=this._register(new Pl),this._pausedResizeTask=new jO,this._observerDisposable=this._register(new Pl),this._isPaused=!1,this._needsFullRefresh=!1,this._isNextRenderRedrawOnly=!0,this._needsSelectionRefresh=!1,this._canvasWidth=0,this._canvasHeight=0,this._selectionState={start:void 0,end:void 0,columnSelectMode:!1},this._onDimensionsChange=this._register(new Ce),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this._register(new Ce),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this._register(new Ce),this.onRender=this._onRender.event,this._onRefreshRequest=this._register(new Ce),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new bO((m,v)=>this._renderRows(m,v),this._coreBrowserService),this._register(this._renderDebouncer),this._syncOutputHandler=new TO(this._coreBrowserService,this._coreService,()=>this._fullRefresh()),this._register(At(()=>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(c.onDecorationRegistered(()=>this._fullRefresh())),this._register(c.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(g.onChangeColors(()=>this._fullRefresh())),this._registerIntersectionObserver(this._coreBrowserService.window,t),this._register(this._coreBrowserService.onWindowChange(m=>this._registerIntersectionObserver(m,t)))}get dimensions(){return this._renderer.value.dimensions}_registerIntersectionObserver(e,t){if("IntersectionObserver"in e){let i=new e.IntersectionObserver(r=>this._handleIntersectionChange(r[r.length-1]),{threshold:0});i.observe(t),this._observerDisposable.value=At(()=>i.disconnect())}}_handleIntersectionChange(e){this._isPaused=e.isIntersecting===void 0?e.intersectionRatio===0:!e.isIntersecting,!this._isPaused&&!this._charSizeService.hasValidSize&&this._charSizeService.measure(),!this._isPaused&&this._needsFullRefresh&&(this._pausedResizeTask.flush(),this.refreshRows(0,this._rowCount-1),this._needsFullRefresh=!1)}refreshRows(e,t,i=!1){if(this._isPaused){this._needsFullRefresh=!0;return}if(this._coreService.decPrivateModes.synchronizedOutput){this._syncOutputHandler.bufferRows(e,t);return}let r=this._syncOutputHandler.flush();r&&(e=Math.min(e,r.start),t=Math.max(t,r.end)),i||(this._isNextRenderRedrawOnly=!1),this._renderDebouncer.refresh(e,t,this._rowCount)}_renderRows(e,t){if(this._renderer.value){if(this._coreService.decPrivateModes.synchronizedOutput){this._syncOutputHandler.bufferRows(e,t);return}e=Math.min(e,this._rowCount-1),t=Math.min(t,this._rowCount-1),this._renderer.value.renderRows(e,t),this._needsSelectionRefresh&&(this._renderer.value.handleSelectionChanged(this._selectionState.start,this._selectionState.end,this._selectionState.columnSelectMode),this._needsSelectionRefresh=!1),this._isNextRenderRedrawOnly||this._onRenderedViewportChange.fire({start:e,end:t}),this._onRender.fire({start:e,end:t}),this._isNextRenderRedrawOnly=!0}}resize(e,t){this._rowCount=t,this._fireOnCanvasResize()}_handleOptionsChanged(){this._renderer.value&&(this.refreshRows(0,this._rowCount-1),this._fireOnCanvasResize())}_fireOnCanvasResize(){this._renderer.value&&(this._renderer.value.dimensions.css.canvas.width===this._canvasWidth&&this._renderer.value.dimensions.css.canvas.height===this._canvasHeight||this._onDimensionsChange.fire(this._renderer.value.dimensions))}hasRenderer(){return!!this._renderer.value}setRenderer(e){this._renderer.value=e,this._renderer.value&&(this._renderer.value.onRequestRedraw(t=>this.refreshRows(t.start,t.end,!0)),this._needsSelectionRefresh=!0,this._fullRefresh())}addRefreshCallback(e){return this._renderDebouncer.addRefreshCallback(e)}_fullRefresh(){this._isPaused?this._needsFullRefresh=!0:this.refreshRows(0,this._rowCount-1)}clearTextureAtlas(){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,t){this._renderer.value&&(this._isPaused?this._pausedResizeTask.set(()=>this._renderer.value?.handleResize(e,t)):this._renderer.value.handleResize(e,t),this._fullRefresh())}handleCharSizeChanged(){this._renderer.value?.handleCharSizeChanged()}handleBlur(){this._renderer.value?.handleBlur()}handleFocus(){this._renderer.value?.handleFocus()}handleSelectionChanged(e,t,i){this._selectionState.start=e,this._selectionState.end=t,this._selectionState.columnSelectMode=i,this._renderer.value?.handleSelectionChanged(e,t,i)}handleCursorMove(){this._renderer.value?.handleCursorMove()}clear(){this._renderer.value?.clear()}};ap=It([Me(2,On),Me(3,Fu),Me(4,Lr),Me(5,So),Me(6,Rn),Me(7,fs),Me(8,$l)],ap);var TO=class{constructor(e,t,i){this._coreBrowserService=e,this._coreService=t,this._onTimeout=i,this._start=0,this._end=0,this._isBuffering=!1}bufferRows(e,t){this._isBuffering?(this._start=Math.min(this._start,e),this._end=Math.max(this._end,t)):(this._start=e,this._end=t,this._isBuffering=!0),this._timeout===void 0&&(this._timeout=this._coreBrowserService.window.setTimeout(()=>{this._timeout=void 0,this._coreService.decPrivateModes.synchronizedOutput=!1,this._onTimeout()},1e3))}flush(){if(this._timeout!==void 0&&(this._coreBrowserService.window.clearTimeout(this._timeout),this._timeout=void 0),!this._isBuffering)return;let e={start:this._start,end:this._end};return this._isBuffering=!1,e}dispose(){this._timeout!==void 0&&(this._coreBrowserService.window.clearTimeout(this._timeout),this._timeout=void 0)}};function DO(e,t,i,r){let a=i.buffer.x,c=i.buffer.y;if(!i.buffer.hasScrollback)return RO(a,c,e,t,i,r)+Vu(c,t,i,r)+OO(a,c,e,t,i,r);let h;if(c===t)return h=a>e?"D":"C",fo(Math.abs(a-e),ho(h,r));h=c>t?"D":"C";let f=Math.abs(c-t),g=AO(c>t?e:a,i)+(f-1)*i.cols+1+MO(c>t?a:e);return fo(g,ho(h,r))}function MO(e,t){return e-1}function AO(e,t){return t.cols-e}function RO(e,t,i,r,a,c){return Vu(t,r,a,c).length===0?"":fo(Dw(e,t,e,t-Or(t,a),!1,a).length,ho("D",c))}function Vu(e,t,i,r){let a=e-Or(e,i),c=t-Or(t,i),h=Math.abs(a-c)-BO(e,t,i);return fo(h,ho(Tw(e,t),r))}function OO(e,t,i,r,a,c){let h;Vu(t,r,a,c).length>0?h=r-Or(r,a):h=t;let f=r,g=LO(e,t,i,r,a,c);return fo(Dw(e,h,i,f,g==="C",a).length,ho(g,c))}function BO(e,t,i){let r=0,a=e-Or(e,i),c=t-Or(t,i);for(let h=0;h<Math.abs(a-c);h++){let f=Tw(e,t)==="A"?-1:1;i.buffer.lines.get(a+f*h)?.isWrapped&&r++}return r}function Or(e,t){let i=0,r=t.buffer.lines.get(e),a=r?.isWrapped;for(;a&&e>=0&&e<t.rows;)i++,r=t.buffer.lines.get(--e),a=r?.isWrapped;return i}function LO(e,t,i,r,a,c){let h;return Vu(i,r,a,c).length>0?h=r-Or(r,a):h=t,e<i&&h<=r||e>=i&&h<r?"C":"D"}function Tw(e,t){return e>t?"A":"B"}function Dw(e,t,i,r,a,c){let h=e,f=t,g="";for(;(h!==i||f!==r)&&f>=0&&f<c.buffer.lines.length;)h+=a?1:-1,a&&h>c.cols-1?(g+=c.buffer.translateBufferLineToString(f,!1,e,h),h=0,e=0,f++):!a&&h<0&&(g+=c.buffer.translateBufferLineToString(f,!1,0,e+1),h=c.cols-1,e=h,f--);return g+c.buffer.translateBufferLineToString(f,!1,e,h)}function ho(e,t){let i=t?"O":"[";return fe.ESC+i+e}function fo(e,t){e=Math.floor(e);let i="";for(let r=0;r<e;r++)i+=t;return i}var zO=class{constructor(e){this._bufferService=e,this.isSelectAllActive=!1,this.selectionStartLength=0}clearSelection(){this.selectionStart=void 0,this.selectionEnd=void 0,this.isSelectAllActive=!1,this.selectionStartLength=0}get finalSelectionStart(){return this.isSelectAllActive?[0,0]:!this.selectionEnd||!this.selectionStart?this.selectionStart:this.areSelectionValuesReversed()?this.selectionEnd:this.selectionStart}get finalSelectionEnd(){if(this.isSelectAllActive)return[this._bufferService.cols,this._bufferService.buffer.ybase+this._bufferService.rows-1];if(this.selectionStart){if(!this.selectionEnd||this.areSelectionValuesReversed()){let e=this.selectionStart[0]+this.selectionStartLength;return e>this._bufferService.cols?e%this._bufferService.cols===0?[this._bufferService.cols,this.selectionStart[1]+Math.floor(e/this._bufferService.cols)-1]:[e%this._bufferService.cols,this.selectionStart[1]+Math.floor(e/this._bufferService.cols)]:[e,this.selectionStart[1]]}if(this.selectionStartLength&&this.selectionEnd[1]===this.selectionStart[1]){let e=this.selectionStart[0]+this.selectionStartLength;return e>this._bufferService.cols?[e%this._bufferService.cols,this.selectionStart[1]+Math.floor(e/this._bufferService.cols)]:[Math.max(e,this.selectionEnd[0]),this.selectionEnd[1]]}return this.selectionEnd}}areSelectionValuesReversed(){let e=this.selectionStart,t=this.selectionEnd;return!e||!t?!1:e[1]>t[1]||e[1]===t[1]&&e[0]>t[0]}handleTrim(e){return this.selectionStart&&(this.selectionStart[1]-=e),this.selectionEnd&&(this.selectionEnd[1]-=e),this.selectionEnd&&this.selectionEnd[1]<0?(this.clearSelection(),!0):(this.selectionStart&&this.selectionStart[1]<0&&(this.selectionStart[1]=0),!1)}};function wb(e,t){if(e.start.y>e.end.y)throw new Error(`Buffer range end (${e.end.x}, ${e.end.y}) cannot be before start (${e.start.x}, ${e.start.y})`);return t*(e.end.y-e.start.y)+(e.end.x-e.start.x+1)}var nm=50,HO=15,IO=50,UO=500,PO=" ",qO=new RegExp(PO,"g"),op=class extends it{constructor(e,t,i,r,a,c,h,f,g){super(),this._element=e,this._screenElement=t,this._linkifier=i,this._bufferService=r,this._coreService=a,this._mouseService=c,this._optionsService=h,this._renderService=f,this._coreBrowserService=g,this._dragScrollAmount=0,this._enabled=!0,this._workCell=new gi,this._mouseDownTimeStamp=0,this._oldHasSelection=!1,this._oldSelectionStart=void 0,this._oldSelectionEnd=void 0,this._onLinuxMouseSelection=this._register(new Ce),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this._register(new Ce),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this._register(new Ce),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this._register(new Ce),this.onRequestScrollLines=this._onRequestScrollLines.event,this._mouseMoveListener=m=>this._handleMouseMove(m),this._mouseUpListener=m=>this._handleMouseUp(m),this._coreService.onUserInput(()=>{this.hasSelection&&this.clearSelection()}),this._trimListener=this._bufferService.buffer.lines.onTrim(m=>this._handleTrim(m)),this._register(this._bufferService.buffers.onBufferActivate(m=>this._handleBufferActivate(m))),this.enable(),this._model=new zO(this._bufferService),this._activeSelectionMode=0,this._register(At(()=>{this._removeMouseDownListeners()})),this._register(this._bufferService.onResize(m=>{m.rowsChanged&&this.clearSelection()}))}reset(){this.clearSelection()}disable(){this.clearSelection(),this._enabled=!1}enable(){this._enabled=!0}get selectionStart(){return this._model.finalSelectionStart}get selectionEnd(){return this._model.finalSelectionEnd}get hasSelection(){let e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd;return!e||!t?!1:e[0]!==t[0]||e[1]!==t[1]}get selectionText(){let e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd;if(!e||!t)return"";let i=this._bufferService.buffer,r=[];if(this._activeSelectionMode===3){if(e[0]===t[0])return"";let a=e[0]<t[0]?e[0]:t[0],c=e[0]<t[0]?t[0]:e[0];for(let h=e[1];h<=t[1];h++){let f=i.translateBufferLineToString(h,!0,a,c);r.push(f)}}else{let a=e[1]===t[1]?t[0]:void 0;r.push(i.translateBufferLineToString(e[1],!0,e[0],a));for(let c=e[1]+1;c<=t[1]-1;c++){let h=i.lines.get(c),f=i.translateBufferLineToString(c,!0);h?.isWrapped?r[r.length-1]+=f:r.push(f)}if(e[1]!==t[1]){let c=i.lines.get(t[1]),h=i.translateBufferLineToString(t[1],!0,0,t[0]);c&&c.isWrapped?r[r.length-1]+=h:r.push(h)}}return r.map(a=>a.replace(qO," ")).join(Nw?`\r
58
+ `:`
59
+ `)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(e){this._refreshAnimationFrame||(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._refresh())),lg&&e&&this.selectionText.length&&this._onLinuxMouseSelection.fire(this.selectionText)}_refresh(){this._refreshAnimationFrame=void 0,this._onRedrawRequest.fire({start:this._model.finalSelectionStart,end:this._model.finalSelectionEnd,columnSelectMode:this._activeSelectionMode===3})}_isClickInSelection(e){let t=this._getMouseBufferCoords(e),i=this._model.finalSelectionStart,r=this._model.finalSelectionEnd;return!i||!r||!t?!1:this._areCoordsInSelection(t,i,r)}isCellInSelection(e,t){let i=this._model.finalSelectionStart,r=this._model.finalSelectionEnd;return!i||!r?!1:this._areCoordsInSelection([e,t],i,r)}_areCoordsInSelection(e,t,i){return e[1]>t[1]&&e[1]<i[1]||t[1]===i[1]&&e[1]===t[1]&&e[0]>=t[0]&&e[0]<i[0]||t[1]<i[1]&&e[1]===i[1]&&e[0]<i[0]||t[1]<i[1]&&e[1]===t[1]&&e[0]>=t[0]}_selectWordAtCursor(e,t){let i=this._linkifier.currentLink?.link?.range;if(i)return this._model.selectionStart=[i.start.x-1,i.start.y-1],this._model.selectionStartLength=wb(i,this._bufferService.cols),this._model.selectionEnd=void 0,!0;let r=this._getMouseBufferCoords(e);return r?(this._selectWordAt(r,t),this._model.selectionEnd=void 0,!0):!1}selectAll(){this._model.isSelectAllActive=!0,this.refresh(),this._onSelectionChange.fire()}selectLines(e,t){this._model.clearSelection(),e=Math.max(e,0),t=Math.min(t,this._bufferService.buffer.lines.length-1),this._model.selectionStart=[0,e],this._model.selectionEnd=[this._bufferService.cols,t],this.refresh(),this._onSelectionChange.fire()}_handleTrim(e){this._model.handleTrim(e)&&this.refresh()}_getMouseBufferCoords(e){let t=this._mouseService.getCoords(e,this._screenElement,this._bufferService.cols,this._bufferService.rows,!0);if(t)return t[0]--,t[1]--,t[1]+=this._bufferService.buffer.ydisp,t}_getMouseEventScrollAmount(e){let t=rg(this._coreBrowserService.window,e,this._screenElement)[1],i=this._renderService.dimensions.css.canvas.height;return t>=0&&t<=i?0:(t>i&&(t-=i),t=Math.min(Math.max(t,-nm),nm),t/=nm,t/Math.abs(t)+Math.round(t*(HO-1)))}shouldForceSelection(e){return Mu?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(),IO)}_removeMouseDownListeners(){this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.removeEventListener("mousemove",this._mouseMoveListener),this._screenElement.ownerDocument.removeEventListener("mouseup",this._mouseUpListener)),this._coreBrowserService.window.clearInterval(this._dragScrollIntervalTimer),this._dragScrollIntervalTimer=void 0}_handleIncrementalClick(e){this._model.selectionStart&&(this._model.selectionEnd=this._getMouseBufferCoords(e))}_handleSingleClick(e){if(this._model.selectionStartLength=0,this._model.isSelectAllActive=!1,this._activeSelectionMode=this.shouldColumnSelect(e)?3:0,this._model.selectionStart=this._getMouseBufferCoords(e),!this._model.selectionStart)return;this._model.selectionEnd=void 0;let t=this._bufferService.buffer.lines.get(this._model.selectionStart[1]);t&&t.length!==this._model.selectionStart[0]&&t.hasWidth(this._model.selectionStart[0])===0&&this._model.selectionStart[0]++}_handleDoubleClick(e){this._selectWordAtCursor(e,!0)&&(this._activeSelectionMode=1)}_handleTripleClick(e){let t=this._getMouseBufferCoords(e);t&&(this._activeSelectionMode=2,this._selectLineAt(t[1]))}shouldColumnSelect(e){return e.altKey&&!(Mu&&this._optionsService.rawOptions.macOptionClickForcesSelection)}_handleMouseMove(e){if(e.stopImmediatePropagation(),!this._model.selectionStart)return;let t=this._model.selectionEnd?[this._model.selectionEnd[0],this._model.selectionEnd[1]]:null;if(this._model.selectionEnd=this._getMouseBufferCoords(e),!this._model.selectionEnd){this.refresh(!0);return}this._activeSelectionMode===2?this._model.selectionEnd[1]<this._model.selectionStart[1]?this._model.selectionEnd[0]=0:this._model.selectionEnd[0]=this._bufferService.cols:this._activeSelectionMode===1&&this._selectToWordAt(this._model.selectionEnd),this._dragScrollAmount=this._getMouseEventScrollAmount(e),this._activeSelectionMode!==3&&(this._dragScrollAmount>0?this._model.selectionEnd[0]=this._bufferService.cols:this._dragScrollAmount<0&&(this._model.selectionEnd[0]=0));let i=this._bufferService.buffer;if(this._model.selectionEnd[1]<i.lines.length){let r=i.lines.get(this._model.selectionEnd[1]);r&&r.hasWidth(this._model.selectionEnd[0])===0&&this._model.selectionEnd[0]<this._bufferService.cols&&this._model.selectionEnd[0]++}(!t||t[0]!==this._model.selectionEnd[0]||t[1]!==this._model.selectionEnd[1])&&this.refresh(!0)}_dragScroll(){if(!(!this._model.selectionEnd||!this._model.selectionStart)&&this._dragScrollAmount){this._onRequestScrollLines.fire({amount:this._dragScrollAmount,suppressScrollEvent:!1});let e=this._bufferService.buffer;this._dragScrollAmount>0?(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=this._bufferService.cols),this._model.selectionEnd[1]=Math.min(e.ydisp+this._bufferService.rows,e.lines.length-1)):(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=0),this._model.selectionEnd[1]=e.ydisp),this.refresh()}}_handleMouseUp(e){let t=e.timeStamp-this._mouseDownTimeStamp;if(this._removeMouseDownListeners(),this.selectionText.length<=1&&t<UO&&e.altKey&&this._optionsService.rawOptions.altClickMovesCursor){if(this._bufferService.buffer.ybase===this._bufferService.buffer.ydisp){let i=this._mouseService.getCoords(e,this._element,this._bufferService.cols,this._bufferService.rows,!1);if(i&&i[0]!==void 0&&i[1]!==void 0){let r=DO(i[0]-1,i[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(r,!0)}}}else this._fireEventIfSelectionChanged()}_fireEventIfSelectionChanged(){let e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd,i=!!e&&!!t&&(e[0]!==t[0]||e[1]!==t[1]);if(!i){this._oldHasSelection&&this._fireOnSelectionChange(e,t,i);return}!e||!t||(!this._oldSelectionStart||!this._oldSelectionEnd||e[0]!==this._oldSelectionStart[0]||e[1]!==this._oldSelectionStart[1]||t[0]!==this._oldSelectionEnd[0]||t[1]!==this._oldSelectionEnd[1])&&this._fireOnSelectionChange(e,t,i)}_fireOnSelectionChange(e,t,i){this._oldSelectionStart=e,this._oldSelectionEnd=t,this._oldHasSelection=i,this._onSelectionChange.fire()}_handleBufferActivate(e){this.clearSelection(),this._trimListener.dispose(),this._trimListener=e.activeBuffer.lines.onTrim(t=>this._handleTrim(t))}_convertViewportColToCharacterIndex(e,t){let i=t;for(let r=0;t>=r;r++){let a=e.loadCell(r,this._workCell).getChars().length;this._workCell.getWidth()===0?i--:a>1&&t!==r&&(i+=a-1)}return i}setSelection(e,t,i){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[e,t],this._model.selectionStartLength=i,this.refresh(),this._fireEventIfSelectionChanged()}rightClickSelect(e){this._isClickInSelection(e)||(this._selectWordAtCursor(e,!1)&&this.refresh(!0),this._fireEventIfSelectionChanged())}_getWordAt(e,t,i=!0,r=!0){if(e[0]>=this._bufferService.cols)return;let a=this._bufferService.buffer,c=a.lines.get(e[1]);if(!c)return;let h=a.translateBufferLineToString(e[1],!1),f=this._convertViewportColToCharacterIndex(c,e[0]),g=f,m=e[0]-f,v=0,_=0,S=0,y=0;if(h.charAt(f)===" "){for(;f>0&&h.charAt(f-1)===" ";)f--;for(;g<h.length&&h.charAt(g+1)===" ";)g++}else{let j=e[0],N=e[0];c.getWidth(j)===0&&(v++,j--),c.getWidth(N)===2&&(_++,N++);let M=c.getString(N).length;for(M>1&&(y+=M-1,g+=M-1);j>0&&f>0&&!this._isCharWordSeparator(c.loadCell(j-1,this._workCell));){c.loadCell(j-1,this._workCell);let A=this._workCell.getChars().length;this._workCell.getWidth()===0?(v++,j--):A>1&&(S+=A-1,f-=A-1),f--,j--}for(;N<c.length&&g+1<h.length&&!this._isCharWordSeparator(c.loadCell(N+1,this._workCell));){c.loadCell(N+1,this._workCell);let A=this._workCell.getChars().length;this._workCell.getWidth()===2?(_++,N++):A>1&&(y+=A-1,g+=A-1),g++,N++}}g++;let x=f+m-v+S,w=Math.min(this._bufferService.cols,g-f+v+_-S-y);if(!(!t&&h.slice(f,g).trim()==="")){if(i&&x===0&&c.getCodePoint(0)!==32){let j=a.lines.get(e[1]-1);if(j&&c.isWrapped&&j.getCodePoint(this._bufferService.cols-1)!==32){let N=this._getWordAt([this._bufferService.cols-1,e[1]-1],!1,!0,!1);if(N){let M=this._bufferService.cols-N.start;x-=M,w+=M}}}if(r&&x+w===this._bufferService.cols&&c.getCodePoint(this._bufferService.cols-1)!==32){let j=a.lines.get(e[1]+1);if(j?.isWrapped&&j.getCodePoint(0)!==32){let N=this._getWordAt([0,e[1]+1],!1,!1,!0);N&&(w+=N.length)}}return{start:x,length:w}}}_selectWordAt(e,t){let i=this._getWordAt(e,t);if(i){for(;i.start<0;)i.start+=this._bufferService.cols,e[1]--;this._model.selectionStart=[i.start,e[1]],this._model.selectionStartLength=i.length}}_selectToWordAt(e){let t=this._getWordAt(e,!0);if(t){let i=e[1];for(;t.start<0;)t.start+=this._bufferService.cols,i--;if(!this._model.areSelectionValuesReversed())for(;t.start+t.length>this._bufferService.cols;)t.length-=this._bufferService.cols,i++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?t.start:t.start+t.length,i]}}_isCharWordSeparator(e){return e.getWidth()===0?!1:this._optionsService.rawOptions.wordSeparator.indexOf(e.getChars())>=0}_selectLineAt(e){let t=this._bufferService.buffer.getWrappedRangeForLine(e),i={start:{x:0,y:t.first},end:{x:this._bufferService.cols-1,y:t.last}};this._model.selectionStart=[0,t.first],this._model.selectionEnd=void 0,this._model.selectionStartLength=wb(i,this._bufferService.cols)}};op=It([Me(3,Rn),Me(4,Lr),Me(5,Zp),Me(6,On),Me(7,ms),Me(8,fs)],op);var Cb=class{constructor(){this._data={}}set(e,t,i){this._data[e]||(this._data[e]={}),this._data[e][t]=i}get(e,t){return this._data[e]?this._data[e][t]:void 0}clear(){this._data={}}},kb=class{constructor(){this._color=new Cb,this._css=new Cb}setCss(e,t,i){this._css.set(e,t,i)}getCss(e,t){return this._css.get(e,t)}setColor(e,t,i){this._color.set(e,t,i)}getColor(e,t){return this._color.get(e,t)}clear(){this._color.clear(),this._css.clear()}},Zt=Object.freeze((()=>{let e=[Bt.toColor("#2e3436"),Bt.toColor("#cc0000"),Bt.toColor("#4e9a06"),Bt.toColor("#c4a000"),Bt.toColor("#3465a4"),Bt.toColor("#75507b"),Bt.toColor("#06989a"),Bt.toColor("#d3d7cf"),Bt.toColor("#555753"),Bt.toColor("#ef2929"),Bt.toColor("#8ae234"),Bt.toColor("#fce94f"),Bt.toColor("#729fcf"),Bt.toColor("#ad7fa8"),Bt.toColor("#34e2e2"),Bt.toColor("#eeeeec")],t=[0,95,135,175,215,255];for(let i=0;i<216;i++){let r=t[i/36%6|0],a=t[i/6%6|0],c=t[i%6];e.push({css:Gt.toCss(r,a,c),rgba:Gt.toRgba(r,a,c)})}for(let i=0;i<24;i++){let r=8+i*10;e.push({css:Gt.toCss(r,r,r),rgba:Gt.toRgba(r,r,r)})}return e})()),kr=Bt.toColor("#ffffff"),Ja=Bt.toColor("#000000"),Nb=Bt.toColor("#ffffff"),Eb=Ja,Ka={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117},FO=kr,cp=class extends it{constructor(e){super(),this._optionsService=e,this._contrastCache=new kb,this._halfContrastCache=new kb,this._onChangeColors=this._register(new Ce),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:kr,background:Ja,cursor:Nb,cursorAccent:Eb,selectionForeground:void 0,selectionBackgroundTransparent:Ka,selectionBackgroundOpaque:Dt.blend(Ja,Ka),selectionInactiveBackgroundTransparent:Ka,selectionInactiveBackgroundOpaque:Dt.blend(Ja,Ka),scrollbarSliderBackground:Dt.opacity(kr,.2),scrollbarSliderHoverBackground:Dt.opacity(kr,.4),scrollbarSliderActiveBackground:Dt.opacity(kr,.5),overviewRulerBorder:kr,ansi:Zt.slice(),contrastCache:this._contrastCache,halfContrastCache:this._halfContrastCache},this._updateRestoreColors(),this._setTheme(this._optionsService.rawOptions.theme),this._register(this._optionsService.onSpecificOptionChange("minimumContrastRatio",()=>this._contrastCache.clear())),this._register(this._optionsService.onSpecificOptionChange("theme",()=>this._setTheme(this._optionsService.rawOptions.theme)))}get colors(){return this._colors}_setTheme(e={}){let t=this._colors;if(t.foreground=xt(e.foreground,kr),t.background=xt(e.background,Ja),t.cursor=Dt.blend(t.background,xt(e.cursor,Nb)),t.cursorAccent=Dt.blend(t.background,xt(e.cursorAccent,Eb)),t.selectionBackgroundTransparent=xt(e.selectionBackground,Ka),t.selectionBackgroundOpaque=Dt.blend(t.background,t.selectionBackgroundTransparent),t.selectionInactiveBackgroundTransparent=xt(e.selectionInactiveBackground,t.selectionBackgroundTransparent),t.selectionInactiveBackgroundOpaque=Dt.blend(t.background,t.selectionInactiveBackgroundTransparent),t.selectionForeground=e.selectionForeground?xt(e.selectionForeground,Sb):void 0,t.selectionForeground===Sb&&(t.selectionForeground=void 0),Dt.isOpaque(t.selectionBackgroundTransparent)&&(t.selectionBackgroundTransparent=Dt.opacity(t.selectionBackgroundTransparent,.3)),Dt.isOpaque(t.selectionInactiveBackgroundTransparent)&&(t.selectionInactiveBackgroundTransparent=Dt.opacity(t.selectionInactiveBackgroundTransparent,.3)),t.scrollbarSliderBackground=xt(e.scrollbarSliderBackground,Dt.opacity(t.foreground,.2)),t.scrollbarSliderHoverBackground=xt(e.scrollbarSliderHoverBackground,Dt.opacity(t.foreground,.4)),t.scrollbarSliderActiveBackground=xt(e.scrollbarSliderActiveBackground,Dt.opacity(t.foreground,.5)),t.overviewRulerBorder=xt(e.overviewRulerBorder,FO),t.ansi=Zt.slice(),t.ansi[0]=xt(e.black,Zt[0]),t.ansi[1]=xt(e.red,Zt[1]),t.ansi[2]=xt(e.green,Zt[2]),t.ansi[3]=xt(e.yellow,Zt[3]),t.ansi[4]=xt(e.blue,Zt[4]),t.ansi[5]=xt(e.magenta,Zt[5]),t.ansi[6]=xt(e.cyan,Zt[6]),t.ansi[7]=xt(e.white,Zt[7]),t.ansi[8]=xt(e.brightBlack,Zt[8]),t.ansi[9]=xt(e.brightRed,Zt[9]),t.ansi[10]=xt(e.brightGreen,Zt[10]),t.ansi[11]=xt(e.brightYellow,Zt[11]),t.ansi[12]=xt(e.brightBlue,Zt[12]),t.ansi[13]=xt(e.brightMagenta,Zt[13]),t.ansi[14]=xt(e.brightCyan,Zt[14]),t.ansi[15]=xt(e.brightWhite,Zt[15]),e.extendedAnsi){let i=Math.min(t.ansi.length-16,e.extendedAnsi.length);for(let r=0;r<i;r++)t.ansi[r+16]=xt(e.extendedAnsi[r],Zt[r+16])}this._contrastCache.clear(),this._halfContrastCache.clear(),this._updateRestoreColors(),this._onChangeColors.fire(this.colors)}restoreColor(e){this._restoreColor(e),this._onChangeColors.fire(this.colors)}_restoreColor(e){if(e===void 0){for(let t=0;t<this._restoreColors.ansi.length;++t)this._colors.ansi[t]=this._restoreColors.ansi[t];return}switch(e){case 256:this._colors.foreground=this._restoreColors.foreground;break;case 257:this._colors.background=this._restoreColors.background;break;case 258:this._colors.cursor=this._restoreColors.cursor;break;default:this._colors.ansi[e]=this._restoreColors.ansi[e]}}modifyColors(e){e(this._colors),this._onChangeColors.fire(this.colors)}_updateRestoreColors(){this._restoreColors={foreground:this._colors.foreground,background:this._colors.background,cursor:this._colors.cursor,ansi:this._colors.ansi.slice()}}};cp=It([Me(0,On)],cp);function xt(e,t){if(e!==void 0)try{return Bt.toColor(e)}catch{}return t}var $O=class{constructor(...e){this._entries=new Map;for(let[t,i]of e)this.set(t,i)}set(e,t){let i=this._entries.get(e);return this._entries.set(e,t),i}forEach(e){for(let[t,i]of this._entries.entries())e(t,i)}has(e){return this._entries.has(e)}get(e){return this._entries.get(e)}},VO=class{constructor(){this._services=new $O,this._services.set(Qp,this)}setService(e,t){this._services.set(e,t)}getService(e){return this._services.get(e)}createInstance(e,...t){let i=H4(e).sort((c,h)=>c.index-h.index),r=[];for(let c of i){let h=this._services.get(c.id);if(!h)throw new Error(`[createInstance] ${e.name} depends on UNKNOWN service ${c.id._id}.`);r.push(h)}let a=i.length>0?i[0].index:t.length;if(t.length!==a)throw new Error(`[createInstance] First service dependency of ${e.name} at position ${a+1} conflicts with ${t.length} static arguments`);return new e(...t,...r)}},KO={trace:0,debug:1,info:2,warn:3,error:4,off:5},YO="xterm.js: ",up=class extends it{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=KO[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(e){for(let t=0;t<e.length;t++)typeof e[t]=="function"&&(e[t]=e[t]())}_log(e,t,i){this._evalLazyOptionalParams(i),e.call(console,(this._optionsService.options.logger?"":YO)+t,...i)}trace(e,...t){this._logLevel<=0&&this._log(this._optionsService.options.logger?.trace.bind(this._optionsService.options.logger)??console.log,e,t)}debug(e,...t){this._logLevel<=1&&this._log(this._optionsService.options.logger?.debug.bind(this._optionsService.options.logger)??console.log,e,t)}info(e,...t){this._logLevel<=2&&this._log(this._optionsService.options.logger?.info.bind(this._optionsService.options.logger)??console.info,e,t)}warn(e,...t){this._logLevel<=3&&this._log(this._optionsService.options.logger?.warn.bind(this._optionsService.options.logger)??console.warn,e,t)}error(e,...t){this._logLevel<=4&&this._log(this._optionsService.options.logger?.error.bind(this._optionsService.options.logger)??console.error,e,t)}};up=It([Me(0,On)],up);var jb=class extends it{constructor(e){super(),this._maxLength=e,this.onDeleteEmitter=this._register(new Ce),this.onDelete=this.onDeleteEmitter.event,this.onInsertEmitter=this._register(new Ce),this.onInsert=this.onInsertEmitter.event,this.onTrimEmitter=this._register(new Ce),this.onTrim=this.onTrimEmitter.event,this._array=new Array(this._maxLength),this._startIndex=0,this._length=0}get maxLength(){return this._maxLength}set maxLength(e){if(this._maxLength===e)return;let t=new Array(e);for(let i=0;i<Math.min(e,this.length);i++)t[i]=this._array[this._getCyclicIndex(i)];this._array=t,this._maxLength=e,this._startIndex=0}get length(){return this._length}set length(e){if(e>this._length)for(let t=this._length;t<e;t++)this._array[t]=void 0;this._length=e}get(e){return this._array[this._getCyclicIndex(e)]}set(e,t){this._array[this._getCyclicIndex(e)]=t}push(e){this._array[this._getCyclicIndex(this._length)]=e,this._length===this._maxLength?(this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1)):this._length++}recycle(){if(this._length!==this._maxLength)throw new Error("Can only recycle when the buffer is full");return this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1),this._array[this._getCyclicIndex(this._length-1)]}get isFull(){return this._length===this._maxLength}pop(){return this._array[this._getCyclicIndex(this._length---1)]}splice(e,t,...i){if(t){for(let r=e;r<this._length-t;r++)this._array[this._getCyclicIndex(r)]=this._array[this._getCyclicIndex(r+t)];this._length-=t,this.onDeleteEmitter.fire({index:e,amount:t})}for(let r=this._length-1;r>=e;r--)this._array[this._getCyclicIndex(r+i.length)]=this._array[this._getCyclicIndex(r)];for(let r=0;r<i.length;r++)this._array[this._getCyclicIndex(e+r)]=i[r];if(i.length&&this.onInsertEmitter.fire({index:e,amount:i.length}),this._length+i.length>this._maxLength){let r=this._length+i.length-this._maxLength;this._startIndex+=r,this._length=this._maxLength,this.onTrimEmitter.fire(r)}else this._length+=i.length}trimStart(e){e>this._length&&(e=this._length),this._startIndex+=e,this._length-=e,this.onTrimEmitter.fire(e)}shiftElements(e,t,i){if(!(t<=0)){if(e<0||e>=this._length)throw new Error("start argument out of range");if(e+i<0)throw new Error("Cannot shift elements in list beyond index 0");if(i>0){for(let a=t-1;a>=0;a--)this.set(e+a+i,this.get(e+a));let r=e+t+i-this._length;if(r>0)for(this._length+=r;this._length>this._maxLength;)this._length--,this._startIndex++,this.onTrimEmitter.fire(1)}else for(let r=0;r<t;r++)this.set(e+r+i,this.get(e+r))}}_getCyclicIndex(e){return(this._startIndex+e)%this._maxLength}},tt=3,Xt=Object.freeze(new yo),lu=0,im=2,eo=class Mw{constructor(t,i,r=!1){this.isWrapped=r,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(t*tt);let a=i||gi.fromCharData([0,G1,1,0]);for(let c=0;c<t;++c)this.setCell(c,a);this.length=t}get(t){let i=this._data[t*tt+0],r=i&2097151;return[this._data[t*tt+1],i&2097152?this._combined[t]:r?Vs(r):"",i>>22,i&2097152?this._combined[t].charCodeAt(this._combined[t].length-1):r]}set(t,i){this._data[t*tt+1]=i[0],i[1].length>1?(this._combined[t]=i[1],this._data[t*tt+0]=t|2097152|i[2]<<22):this._data[t*tt+0]=i[1].charCodeAt(0)|i[2]<<22}getWidth(t){return this._data[t*tt+0]>>22}hasWidth(t){return this._data[t*tt+0]&12582912}getFg(t){return this._data[t*tt+1]}getBg(t){return this._data[t*tt+2]}hasContent(t){return this._data[t*tt+0]&4194303}getCodePoint(t){let i=this._data[t*tt+0];return i&2097152?this._combined[t].charCodeAt(this._combined[t].length-1):i&2097151}isCombined(t){return this._data[t*tt+0]&2097152}getString(t){let i=this._data[t*tt+0];return i&2097152?this._combined[t]:i&2097151?Vs(i&2097151):""}isProtected(t){return this._data[t*tt+2]&536870912}loadCell(t,i){return lu=t*tt,i.content=this._data[lu+0],i.fg=this._data[lu+1],i.bg=this._data[lu+2],i.content&2097152&&(i.combinedData=this._combined[t]),i.bg&268435456&&(i.extended=this._extendedAttrs[t]),i}setCell(t,i){i.content&2097152&&(this._combined[t]=i.combinedData),i.bg&268435456&&(this._extendedAttrs[t]=i.extended),this._data[t*tt+0]=i.content,this._data[t*tt+1]=i.fg,this._data[t*tt+2]=i.bg}setCellFromCodepoint(t,i,r,a){a.bg&268435456&&(this._extendedAttrs[t]=a.extended),this._data[t*tt+0]=i|r<<22,this._data[t*tt+1]=a.fg,this._data[t*tt+2]=a.bg}addCodepointToCell(t,i,r){let a=this._data[t*tt+0];a&2097152?this._combined[t]+=Vs(i):a&2097151?(this._combined[t]=Vs(a&2097151)+Vs(i),a&=-2097152,a|=2097152):a=i|1<<22,r&&(a&=-12582913,a|=r<<22),this._data[t*tt+0]=a}insertCells(t,i,r){if(t%=this.length,t&&this.getWidth(t-1)===2&&this.setCellFromCodepoint(t-1,0,1,r),i<this.length-t){let a=new gi;for(let c=this.length-t-i-1;c>=0;--c)this.setCell(t+i+c,this.loadCell(t+c,a));for(let c=0;c<i;++c)this.setCell(t+c,r)}else for(let a=t;a<this.length;++a)this.setCell(a,r);this.getWidth(this.length-1)===2&&this.setCellFromCodepoint(this.length-1,0,1,r)}deleteCells(t,i,r){if(t%=this.length,i<this.length-t){let a=new gi;for(let c=0;c<this.length-t-i;++c)this.setCell(t+c,this.loadCell(t+i+c,a));for(let c=this.length-i;c<this.length;++c)this.setCell(c,r)}else for(let a=t;a<this.length;++a)this.setCell(a,r);t&&this.getWidth(t-1)===2&&this.setCellFromCodepoint(t-1,0,1,r),this.getWidth(t)===0&&!this.hasContent(t)&&this.setCellFromCodepoint(t,0,1,r)}replaceCells(t,i,r,a=!1){if(a){for(t&&this.getWidth(t-1)===2&&!this.isProtected(t-1)&&this.setCellFromCodepoint(t-1,0,1,r),i<this.length&&this.getWidth(i-1)===2&&!this.isProtected(i)&&this.setCellFromCodepoint(i,0,1,r);t<i&&t<this.length;)this.isProtected(t)||this.setCell(t,r),t++;return}for(t&&this.getWidth(t-1)===2&&this.setCellFromCodepoint(t-1,0,1,r),i<this.length&&this.getWidth(i-1)===2&&this.setCellFromCodepoint(i,0,1,r);t<i&&t<this.length;)this.setCell(t++,r)}resize(t,i){if(t===this.length)return this._data.length*4*im<this._data.buffer.byteLength;let r=t*tt;if(t>this.length){if(this._data.buffer.byteLength>=r*4)this._data=new Uint32Array(this._data.buffer,0,r);else{let a=new Uint32Array(r);a.set(this._data),this._data=a}for(let a=this.length;a<t;++a)this.setCell(a,i)}else{this._data=this._data.subarray(0,r);let a=Object.keys(this._combined);for(let h=0;h<a.length;h++){let f=parseInt(a[h],10);f>=t&&delete this._combined[f]}let c=Object.keys(this._extendedAttrs);for(let h=0;h<c.length;h++){let f=parseInt(c[h],10);f>=t&&delete this._extendedAttrs[f]}}return this.length=t,r*4*im<this._data.buffer.byteLength}cleanupMemory(){if(this._data.length*4*im<this._data.buffer.byteLength){let t=new Uint32Array(this._data.length);return t.set(this._data),this._data=t,1}return 0}fill(t,i=!1){if(i){for(let r=0;r<this.length;++r)this.isProtected(r)||this.setCell(r,t);return}this._combined={},this._extendedAttrs={};for(let r=0;r<this.length;++r)this.setCell(r,t)}copyFrom(t){this.length!==t.length?this._data=new Uint32Array(t._data):this._data.set(t._data),this.length=t.length,this._combined={};for(let i in t._combined)this._combined[i]=t._combined[i];this._extendedAttrs={};for(let i in t._extendedAttrs)this._extendedAttrs[i]=t._extendedAttrs[i];this.isWrapped=t.isWrapped}clone(){let t=new Mw(0);t._data=new Uint32Array(this._data),t.length=this.length;for(let i in this._combined)t._combined[i]=this._combined[i];for(let i in this._extendedAttrs)t._extendedAttrs[i]=this._extendedAttrs[i];return t.isWrapped=this.isWrapped,t}getTrimmedLength(){for(let t=this.length-1;t>=0;--t)if(this._data[t*tt+0]&4194303)return t+(this._data[t*tt+0]>>22);return 0}getNoBgTrimmedLength(){for(let t=this.length-1;t>=0;--t)if(this._data[t*tt+0]&4194303||this._data[t*tt+2]&50331648)return t+(this._data[t*tt+0]>>22);return 0}copyCellsFrom(t,i,r,a,c){let h=t._data;if(c)for(let g=a-1;g>=0;g--){for(let m=0;m<tt;m++)this._data[(r+g)*tt+m]=h[(i+g)*tt+m];h[(i+g)*tt+2]&268435456&&(this._extendedAttrs[r+g]=t._extendedAttrs[i+g])}else for(let g=0;g<a;g++){for(let m=0;m<tt;m++)this._data[(r+g)*tt+m]=h[(i+g)*tt+m];h[(i+g)*tt+2]&268435456&&(this._extendedAttrs[r+g]=t._extendedAttrs[i+g])}let f=Object.keys(t._combined);for(let g=0;g<f.length;g++){let m=parseInt(f[g],10);m>=i&&(this._combined[m-i+r]=t._combined[m])}}translateToString(t,i,r,a){i=i??0,r=r??this.length,t&&(r=Math.min(r,this.getTrimmedLength())),a&&(a.length=0);let c="";for(;i<r;){let h=this._data[i*tt+0],f=h&2097151,g=h&2097152?this._combined[i]:f?Vs(f):Ks;if(c+=g,a)for(let m=0;m<g.length;++m)a.push(i);i+=h>>22||1}return a&&a.push(i),c}};function WO(e,t,i,r,a,c){let h=[];for(let f=0;f<e.length-1;f++){let g=f,m=e.get(++g);if(!m.isWrapped)continue;let v=[e.get(f)];for(;g<e.length&&m.isWrapped;)v.push(m),m=e.get(++g);if(!c&&r>=f&&r<g){f+=v.length-1;continue}let _=0,S=mo(v,_,t),y=1,x=0;for(;y<v.length;){let j=mo(v,y,t),N=j-x,M=i-S,A=Math.min(N,M);v[_].copyCellsFrom(v[y],x,S,A,!1),S+=A,S===i&&(_++,S=0),x+=A,x===j&&(y++,x=0),S===0&&_!==0&&v[_-1].getWidth(i-1)===2&&(v[_].copyCellsFrom(v[_-1],i-1,S++,1,!1),v[_-1].setCell(i-1,a))}v[_].replaceCells(S,i,a);let w=0;for(let j=v.length-1;j>0&&(j>_||v[j].getTrimmedLength()===0);j--)w++;w>0&&(h.push(f+v.length-w),h.push(w)),f+=v.length-1}return h}function XO(e,t){let i=[],r=0,a=t[r],c=0;for(let h=0;h<e.length;h++)if(a===h){let f=t[++r];e.onDeleteEmitter.fire({index:h-c,amount:f}),h+=f-1,c+=f,a=t[++r]}else i.push(h);return{layout:i,countRemoved:c}}function GO(e,t){let i=[];for(let r=0;r<t.length;r++)i.push(e.get(t[r]));for(let r=0;r<i.length;r++)e.set(r,i[r]);e.length=t.length}function QO(e,t,i){let r=[],a=e.map((g,m)=>mo(e,m,t)).reduce((g,m)=>g+m),c=0,h=0,f=0;for(;f<a;){if(a-f<i){r.push(a-f);break}c+=i;let g=mo(e,h,t);c>g&&(c-=g,h++);let m=e[h].getWidth(c-1)===2;m&&c--;let v=m?i-1:i;r.push(v),f+=v}return r}function mo(e,t,i){if(t===e.length-1)return e[t].getTrimmedLength();let r=!e[t].hasContent(i-1)&&e[t].getWidth(i-1)===1,a=e[t+1].getWidth(0)===2;return r&&a?i-1:i}var Aw=class Rw{constructor(t){this.line=t,this.isDisposed=!1,this._disposables=[],this._id=Rw._nextId++,this._onDispose=this.register(new Ce),this.onDispose=this._onDispose.event}get id(){return this._id}dispose(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire(),Rr(this._disposables),this._disposables.length=0)}register(t){return this._disposables.push(t),t}};Aw._nextId=1;var ZO=Aw,en={},Nr=en.B;en[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:"≥","{":"π","|":"≠","}":"£","~":"·"};en.A={"#":"£"};en.B=void 0;en[4]={"#":"£","@":"¾","[":"ij","\\":"½","]":"|","{":"¨","|":"f","}":"¼","~":"´"};en.C=en[5]={"[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"};en.R={"#":"£","@":"à","[":"°","\\":"ç","]":"§","{":"é","|":"ù","}":"è","~":"¨"};en.Q={"@":"à","[":"â","\\":"ç","]":"ê","^":"î","`":"ô","{":"é","|":"ù","}":"è","~":"û"};en.K={"@":"§","[":"Ä","\\":"Ö","]":"Ü","{":"ä","|":"ö","}":"ü","~":"ß"};en.Y={"#":"£","@":"§","[":"°","\\":"ç","]":"é","`":"ù","{":"à","|":"ò","}":"è","~":"ì"};en.E=en[6]={"@":"Ä","[":"Æ","\\":"Ø","]":"Å","^":"Ü","`":"ä","{":"æ","|":"ø","}":"å","~":"ü"};en.Z={"#":"£","@":"§","[":"¡","\\":"Ñ","]":"¿","{":"°","|":"ñ","}":"ç"};en.H=en[7]={"@":"É","[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"};en["="]={"#":"ù","@":"à","[":"é","\\":"ç","]":"ê","^":"î",_:"è","`":"ô","{":"ä","|":"ö","}":"ü","~":"û"};var Tb=4294967295,Db=class{constructor(e,t,i){this._hasScrollback=e,this._optionsService=t,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=Xt.clone(),this.savedCharset=Nr,this.markers=[],this._nullCell=gi.fromCharData([0,G1,1,0]),this._whitespaceCell=gi.fromCharData([0,Ks,1,32]),this._isClearing=!1,this._memoryCleanupQueue=new Au,this._memoryCleanupPosition=0,this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new jb(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}getNullCell(e){return e?(this._nullCell.fg=e.fg,this._nullCell.bg=e.bg,this._nullCell.extended=e.extended):(this._nullCell.fg=0,this._nullCell.bg=0,this._nullCell.extended=new ju),this._nullCell}getWhitespaceCell(e){return e?(this._whitespaceCell.fg=e.fg,this._whitespaceCell.bg=e.bg,this._whitespaceCell.extended=e.extended):(this._whitespaceCell.fg=0,this._whitespaceCell.bg=0,this._whitespaceCell.extended=new ju),this._whitespaceCell}getBlankLine(e,t){return new eo(this._bufferService.cols,this.getNullCell(e),t)}get hasScrollback(){return this._hasScrollback&&this.lines.maxLength>this._rows}get isCursorInViewport(){let e=this.ybase+this.y-this.ydisp;return e>=0&&e<this._rows}_getCorrectBufferLength(e){if(!this._hasScrollback)return e;let t=e+this._optionsService.rawOptions.scrollback;return t>Tb?Tb:t}fillViewportRows(e){if(this.lines.length===0){e===void 0&&(e=Xt);let t=this._rows;for(;t--;)this.lines.push(this.getBlankLine(e))}}clear(){this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.lines=new jb(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(e,t){let i=this.getNullCell(Xt),r=0,a=this._getCorrectBufferLength(t);if(a>this.lines.maxLength&&(this.lines.maxLength=a),this.lines.length>0){if(this._cols<e)for(let h=0;h<this.lines.length;h++)r+=+this.lines.get(h).resize(e,i);let c=0;if(this._rows<t)for(let h=this._rows;h<t;h++)this.lines.length<t+this.ybase&&(this._optionsService.rawOptions.windowsMode||this._optionsService.rawOptions.windowsPty.backend!==void 0||this._optionsService.rawOptions.windowsPty.buildNumber!==void 0?this.lines.push(new eo(e,i)):this.ybase>0&&this.lines.length<=this.ybase+this.y+c+1?(this.ybase--,c++,this.ydisp>0&&this.ydisp--):this.lines.push(new eo(e,i)));else for(let h=this._rows;h>t;h--)this.lines.length>t+this.ybase&&(this.lines.length>this.ybase+this.y+1?this.lines.pop():(this.ybase++,this.ydisp++));if(a<this.lines.maxLength){let h=this.lines.length-a;h>0&&(this.lines.trimStart(h),this.ybase=Math.max(this.ybase-h,0),this.ydisp=Math.max(this.ydisp-h,0),this.savedY=Math.max(this.savedY-h,0)),this.lines.maxLength=a}this.x=Math.min(this.x,e-1),this.y=Math.min(this.y,t-1),c&&(this.y+=c),this.savedX=Math.min(this.savedX,e-1),this.scrollTop=0}if(this.scrollBottom=t-1,this._isReflowEnabled&&(this._reflow(e,t),this._cols>e))for(let c=0;c<this.lines.length;c++)r+=+this.lines.get(c).resize(e,i);this._cols=e,this._rows=t,this._memoryCleanupQueue.clear(),r>.1*this.lines.length&&(this._memoryCleanupPosition=0,this._memoryCleanupQueue.enqueue(()=>this._batchedMemoryCleanup()))}_batchedMemoryCleanup(){let e=!0;this._memoryCleanupPosition>=this.lines.length&&(this._memoryCleanupPosition=0,e=!1);let t=0;for(;this._memoryCleanupPosition<this.lines.length;)if(t+=this.lines.get(this._memoryCleanupPosition++).cleanupMemory(),t>100)return!0;return e}get _isReflowEnabled(){let e=this._optionsService.rawOptions.windowsPty;return e&&e.buildNumber?this._hasScrollback&&e.backend==="conpty"&&e.buildNumber>=21376:this._hasScrollback&&!this._optionsService.rawOptions.windowsMode}_reflow(e,t){this._cols!==e&&(e>this._cols?this._reflowLarger(e,t):this._reflowSmaller(e,t))}_reflowLarger(e,t){let i=this._optionsService.rawOptions.reflowCursorLine,r=WO(this.lines,this._cols,e,this.ybase+this.y,this.getNullCell(Xt),i);if(r.length>0){let a=XO(this.lines,r);GO(this.lines,a.layout),this._reflowLargerAdjustViewport(e,t,a.countRemoved)}}_reflowLargerAdjustViewport(e,t,i){let r=this.getNullCell(Xt),a=i;for(;a-- >0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length<t&&this.lines.push(new eo(e,r))):(this.ydisp===this.ybase&&this.ydisp--,this.ybase--);this.savedY=Math.max(this.savedY-i,0)}_reflowSmaller(e,t){let i=this._optionsService.rawOptions.reflowCursorLine,r=this.getNullCell(Xt),a=[],c=0;for(let h=this.lines.length-1;h>=0;h--){let f=this.lines.get(h);if(!f||!f.isWrapped&&f.getTrimmedLength()<=e)continue;let g=[f];for(;f.isWrapped&&h>0;)f=this.lines.get(--h),g.unshift(f);if(!i){let A=this.ybase+this.y;if(A>=h&&A<h+g.length)continue}let m=g[g.length-1].getTrimmedLength(),v=QO(g,this._cols,e),_=v.length-g.length,S;this.ybase===0&&this.y!==this.lines.length-1?S=Math.max(0,this.y-this.lines.maxLength+_):S=Math.max(0,this.lines.length-this.lines.maxLength+_);let y=[];for(let A=0;A<_;A++){let R=this.getBlankLine(Xt,!0);y.push(R)}y.length>0&&(a.push({start:h+g.length+c,newLines:y}),c+=y.length),g.push(...y);let x=v.length-1,w=v[x];w===0&&(x--,w=v[x]);let j=g.length-_-1,N=m;for(;j>=0;){let A=Math.min(N,w);if(g[x]===void 0)break;if(g[x].copyCellsFrom(g[j],N-A,w-A,A,!0),w-=A,w===0&&(x--,w=v[x]),N-=A,N===0){j--;let R=Math.max(j,0);N=mo(g,R,this._cols)}}for(let A=0;A<g.length;A++)v[A]<e&&g[A].setCell(v[A],r);let M=_-S;for(;M-- >0;)this.ybase===0?this.y<t-1?(this.y++,this.lines.pop()):(this.ybase++,this.ydisp++):this.ybase<Math.min(this.lines.maxLength,this.lines.length+c)-t&&(this.ybase===this.ydisp&&this.ydisp++,this.ybase++);this.savedY=Math.min(this.savedY+_,this.ybase+t-1)}if(a.length>0){let h=[],f=[];for(let w=0;w<this.lines.length;w++)f.push(this.lines.get(w));let g=this.lines.length,m=g-1,v=0,_=a[v];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+c);let S=0;for(let w=Math.min(this.lines.maxLength-1,g+c-1);w>=0;w--)if(_&&_.start>m+S){for(let j=_.newLines.length-1;j>=0;j--)this.lines.set(w--,_.newLines[j]);w++,h.push({index:m+1,amount:_.newLines.length}),S+=_.newLines.length,_=a[++v]}else this.lines.set(w,f[m--]);let y=0;for(let w=h.length-1;w>=0;w--)h[w].index+=y,this.lines.onInsertEmitter.fire(h[w]),y+=h[w].amount;let x=Math.max(0,g+c-this.lines.maxLength);x>0&&this.lines.onTrimEmitter.fire(x)}}translateBufferLineToString(e,t,i=0,r){let a=this.lines.get(e);return a?a.translateToString(t,i,r):""}getWrappedRangeForLine(e){let t=e,i=e;for(;t>0&&this.lines.get(t).isWrapped;)t--;for(;i+1<this.lines.length&&this.lines.get(i+1).isWrapped;)i++;return{first:t,last:i}}setupTabStops(e){for(e!=null?this.tabs[e]||(e=this.prevStop(e)):(this.tabs={},e=0);e<this._cols;e+=this._optionsService.rawOptions.tabStopWidth)this.tabs[e]=!0}prevStop(e){for(e==null&&(e=this.x);!this.tabs[--e]&&e>0;);return e>=this._cols?this._cols-1:e<0?0:e}nextStop(e){for(e==null&&(e=this.x);!this.tabs[++e]&&e<this._cols;);return e>=this._cols?this._cols-1:e<0?0:e}clearMarkers(e){this._isClearing=!0;for(let t=0;t<this.markers.length;t++)this.markers[t].line===e&&(this.markers[t].dispose(),this.markers.splice(t--,1));this._isClearing=!1}clearAllMarkers(){this._isClearing=!0;for(let e=0;e<this.markers.length;e++)this.markers[e].dispose();this.markers.length=0,this._isClearing=!1}addMarker(e){let t=new ZO(e);return this.markers.push(t),t.register(this.lines.onTrim(i=>{t.line-=i,t.line<0&&t.dispose()})),t.register(this.lines.onInsert(i=>{t.line>=i.index&&(t.line+=i.amount)})),t.register(this.lines.onDelete(i=>{t.line>=i.index&&t.line<i.index+i.amount&&t.dispose(),t.line>i.index&&(t.line-=i.amount)})),t.register(t.onDispose(()=>this._removeMarker(t))),t}_removeMarker(e){this._isClearing||this.markers.splice(this.markers.indexOf(e),1)}},JO=class extends it{constructor(e,t){super(),this._optionsService=e,this._bufferService=t,this._onBufferActivate=this._register(new Ce),this.onBufferActivate=this._onBufferActivate.event,this.reset(),this._register(this._optionsService.onSpecificOptionChange("scrollback",()=>this.resize(this._bufferService.cols,this._bufferService.rows))),this._register(this._optionsService.onSpecificOptionChange("tabStopWidth",()=>this.setupTabStops()))}reset(){this._normal=new Db(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new Db(!1,this._optionsService,this._bufferService),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}),this.setupTabStops()}get alt(){return this._alt}get active(){return this._activeBuffer}get normal(){return this._normal}activateNormalBuffer(){this._activeBuffer!==this._normal&&(this._normal.x=this._alt.x,this._normal.y=this._alt.y,this._alt.clearAllMarkers(),this._alt.clear(),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}))}activateAltBuffer(e){this._activeBuffer!==this._alt&&(this._alt.fillViewportRows(e),this._alt.x=this._normal.x,this._alt.y=this._normal.y,this._activeBuffer=this._alt,this._onBufferActivate.fire({activeBuffer:this._alt,inactiveBuffer:this._normal}))}resize(e,t){this._normal.resize(e,t),this._alt.resize(e,t),this.setupTabStops(e)}setupTabStops(e){this._normal.setupTabStops(e),this._alt.setupTabStops(e)}},Ow=2,Bw=1,hp=class extends it{constructor(e){super(),this.isUserScrolling=!1,this._onResize=this._register(new Ce),this.onResize=this._onResize.event,this._onScroll=this._register(new Ce),this.onScroll=this._onScroll.event,this.cols=Math.max(e.rawOptions.cols||0,Ow),this.rows=Math.max(e.rawOptions.rows||0,Bw),this.buffers=this._register(new JO(e,this)),this._register(this.buffers.onBufferActivate(t=>{this._onScroll.fire(t.activeBuffer.ydisp)}))}get buffer(){return this.buffers.active}resize(e,t){let i=this.cols!==e,r=this.rows!==t;this.cols=e,this.rows=t,this.buffers.resize(e,t),this._onResize.fire({cols:e,rows:t,colsChanged:i,rowsChanged:r})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(e,t=!1){let i=this.buffer,r;r=this._cachedBlankLine,(!r||r.length!==this.cols||r.getFg(0)!==e.fg||r.getBg(0)!==e.bg)&&(r=i.getBlankLine(e,t),this._cachedBlankLine=r),r.isWrapped=t;let a=i.ybase+i.scrollTop,c=i.ybase+i.scrollBottom;if(i.scrollTop===0){let h=i.lines.isFull;c===i.lines.length-1?h?i.lines.recycle().copyFrom(r):i.lines.push(r.clone()):i.lines.splice(c+1,0,r.clone()),h?this.isUserScrolling&&(i.ydisp=Math.max(i.ydisp-1,0)):(i.ybase++,this.isUserScrolling||i.ydisp++)}else{let h=c-a+1;i.lines.shiftElements(a+1,h-1,-1),i.lines.set(c,r.clone())}this.isUserScrolling||(i.ydisp=i.ybase),this._onScroll.fire(i.ydisp)}scrollLines(e,t){let i=this.buffer;if(e<0){if(i.ydisp===0)return;this.isUserScrolling=!0}else e+i.ydisp>=i.ybase&&(this.isUserScrolling=!1);let r=i.ydisp;i.ydisp=Math.max(Math.min(i.ydisp+e,i.ybase),0),r!==i.ydisp&&(t||this._onScroll.fire(i.ydisp))}};hp=It([Me(0,On)],hp);var Ml={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:Mu,windowOptions:{},windowsMode:!1,windowsPty:{},wordSeparator:" ()[]{}',\"`",altClickMovesCursor:!0,convertEol:!1,termName:"xterm",cancelEvents:!1,overviewRuler:{}},eB=["normal","bold","100","200","300","400","500","600","700","800","900"],tB=class extends it{constructor(e){super(),this._onOptionChange=this._register(new Ce),this.onOptionChange=this._onOptionChange.event;let t={...Ml};for(let i in e)if(i in t)try{let r=e[i];t[i]=this._sanitizeAndValidateOption(i,r)}catch(r){console.error(r)}this.rawOptions=t,this.options={...t},this._setupOptions(),this._register(At(()=>{this.rawOptions.linkHandler=null,this.rawOptions.documentOverride=null}))}onSpecificOptionChange(e,t){return this.onOptionChange(i=>{i===e&&t(this.rawOptions[e])})}onMultipleOptionChange(e,t){return this.onOptionChange(i=>{e.indexOf(i)!==-1&&t()})}_setupOptions(){let e=i=>{if(!(i in Ml))throw new Error(`No option with key "${i}"`);return this.rawOptions[i]},t=(i,r)=>{if(!(i in Ml))throw new Error(`No option with key "${i}"`);r=this._sanitizeAndValidateOption(i,r),this.rawOptions[i]!==r&&(this.rawOptions[i]=r,this._onOptionChange.fire(i))};for(let i in this.rawOptions){let r={get:e.bind(this,i),set:t.bind(this,i)};Object.defineProperty(this.options,i,r)}}_sanitizeAndValidateOption(e,t){switch(e){case"cursorStyle":if(t||(t=Ml[e]),!nB(t))throw new Error(`"${t}" is not a valid value for ${e}`);break;case"wordSeparator":t||(t=Ml[e]);break;case"fontWeight":case"fontWeightBold":if(typeof t=="number"&&1<=t&&t<=1e3)break;t=eB.includes(t)?t:Ml[e];break;case"cursorWidth":t=Math.floor(t);case"lineHeight":case"tabStopWidth":if(t<1)throw new Error(`${e} cannot be less than 1, value: ${t}`);break;case"minimumContrastRatio":t=Math.max(1,Math.min(21,Math.round(t*10)/10));break;case"scrollback":if(t=Math.min(t,4294967295),t<0)throw new Error(`${e} cannot be less than 0, value: ${t}`);break;case"fastScrollSensitivity":case"scrollSensitivity":if(t<=0)throw new Error(`${e} cannot be less than or equal to 0, value: ${t}`);break;case"rows":case"cols":if(!t&&t!==0)throw new Error(`${e} must be numeric, value: ${t}`);break;case"windowsPty":t=t??{};break}return t}};function nB(e){return e==="block"||e==="underline"||e==="bar"}function to(e,t=5){if(typeof e!="object")return e;let i=Array.isArray(e)?[]:{};for(let r in e)i[r]=t<=1?e[r]:e[r]&&to(e[r],t-1);return i}var Mb=Object.freeze({insertMode:!1}),Ab=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,cursorBlink:void 0,cursorStyle:void 0,origin:!1,reverseWraparound:!1,sendFocus:!1,synchronizedOutput:!1,wraparound:!0}),dp=class extends it{constructor(e,t,i){super(),this._bufferService=e,this._logService=t,this._optionsService=i,this.isCursorInitialized=!1,this.isCursorHidden=!1,this._onData=this._register(new Ce),this.onData=this._onData.event,this._onUserInput=this._register(new Ce),this.onUserInput=this._onUserInput.event,this._onBinary=this._register(new Ce),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this._register(new Ce),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=to(Mb),this.decPrivateModes=to(Ab)}reset(){this.modes=to(Mb),this.decPrivateModes=to(Ab)}triggerDataEvent(e,t=!1){if(this._optionsService.rawOptions.disableStdin)return;let i=this._bufferService.buffer;t&&this._optionsService.rawOptions.scrollOnUserInput&&i.ybase!==i.ydisp&&this._onRequestScrollToBottom.fire(),t&&this._onUserInput.fire(),this._logService.debug(`sending data "${e}"`),this._logService.trace("sending data (codes)",()=>e.split("").map(r=>r.charCodeAt(0))),this._onData.fire(e)}triggerBinaryEvent(e){this._optionsService.rawOptions.disableStdin||(this._logService.debug(`sending binary "${e}"`),this._logService.trace("sending binary (codes)",()=>e.split("").map(t=>t.charCodeAt(0))),this._onBinary.fire(e))}};dp=It([Me(0,Rn),Me(1,tw),Me(2,On)],dp);var Rb={NONE:{events:0,restrict:()=>!1},X10:{events:1,restrict:e=>e.button===4||e.action!==1?!1:(e.ctrl=!1,e.alt=!1,e.shift=!1,!0)},VT200:{events:19,restrict:e=>e.action!==32},DRAG:{events:23,restrict:e=>!(e.action===32&&e.button===3)},ANY:{events:31,restrict:e=>!0}};function sm(e,t){let i=(e.ctrl?16:0)|(e.shift?4:0)|(e.alt?8:0);return e.button===4?(i|=64,i|=e.action):(i|=e.button&3,e.button&4&&(i|=64),e.button&8&&(i|=128),e.action===32?i|=32:e.action===0&&!t&&(i|=3)),i}var rm=String.fromCharCode,Ob={DEFAULT:e=>{let t=[sm(e,!1)+32,e.col+32,e.row+32];return t[0]>255||t[1]>255||t[2]>255?"":`\x1B[M${rm(t[0])}${rm(t[1])}${rm(t[2])}`},SGR:e=>{let t=e.action===0&&e.button!==4?"m":"M";return`\x1B[<${sm(e,!0)};${e.col};${e.row}${t}`},SGR_PIXELS:e=>{let t=e.action===0&&e.button!==4?"m":"M";return`\x1B[<${sm(e,!0)};${e.x};${e.y}${t}`}},fp=class extends it{constructor(e,t,i){super(),this._bufferService=e,this._coreService=t,this._optionsService=i,this._protocols={},this._encodings={},this._activeProtocol="",this._activeEncoding="",this._lastEvent=null,this._wheelPartialScroll=0,this._onProtocolChange=this._register(new Ce),this.onProtocolChange=this._onProtocolChange.event;for(let r of Object.keys(Rb))this.addProtocol(r,Rb[r]);for(let r of Object.keys(Ob))this.addEncoding(r,Ob[r]);this.reset()}addProtocol(e,t){this._protocols[e]=t}addEncoding(e,t){this._encodings[e]=t}get activeProtocol(){return this._activeProtocol}get areMouseEventsActive(){return this._protocols[this._activeProtocol].events!==0}set activeProtocol(e){if(!this._protocols[e])throw new Error(`unknown protocol "${e}"`);this._activeProtocol=e,this._onProtocolChange.fire(this._protocols[e].events)}get activeEncoding(){return this._activeEncoding}set activeEncoding(e){if(!this._encodings[e])throw new Error(`unknown encoding "${e}"`);this._activeEncoding=e}reset(){this.activeProtocol="NONE",this.activeEncoding="DEFAULT",this._lastEvent=null,this._wheelPartialScroll=0}consumeWheelEvent(e,t,i){if(e.deltaY===0||e.shiftKey||t===void 0||i===void 0)return 0;let r=t/i,a=this._applyScrollModifier(e.deltaY,e);return e.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(a/=r+0,Math.abs(e.deltaY)<50&&(a*=.3),this._wheelPartialScroll+=a,a=Math.floor(Math.abs(this._wheelPartialScroll))*(this._wheelPartialScroll>0?1:-1),this._wheelPartialScroll%=1):e.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(a*=this._bufferService.rows),a}_applyScrollModifier(e,t){return t.altKey||t.ctrlKey||t.shiftKey?e*this._optionsService.rawOptions.fastScrollSensitivity*this._optionsService.rawOptions.scrollSensitivity:e*this._optionsService.rawOptions.scrollSensitivity}triggerMouseEvent(e){if(e.col<0||e.col>=this._bufferService.cols||e.row<0||e.row>=this._bufferService.rows||e.button===4&&e.action===32||e.button===3&&e.action!==32||e.button!==4&&(e.action===2||e.action===3)||(e.col++,e.row++,e.action===32&&this._lastEvent&&this._equalEvents(this._lastEvent,e,this._activeEncoding==="SGR_PIXELS"))||!this._protocols[this._activeProtocol].restrict(e))return!1;let t=this._encodings[this._activeEncoding](e);return t&&(this._activeEncoding==="DEFAULT"?this._coreService.triggerBinaryEvent(t):this._coreService.triggerDataEvent(t,!0)),this._lastEvent=e,!0}explainEvents(e){return{down:!!(e&1),up:!!(e&2),drag:!!(e&4),move:!!(e&8),wheel:!!(e&16)}}_equalEvents(e,t,i){if(i){if(e.x!==t.x||e.y!==t.y)return!1}else if(e.col!==t.col||e.row!==t.row)return!1;return!(e.button!==t.button||e.action!==t.action||e.ctrl!==t.ctrl||e.alt!==t.alt||e.shift!==t.shift)}};fp=It([Me(0,Rn),Me(1,Lr),Me(2,On)],fp);var lm=[[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]],iB=[[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]],Jt;function sB(e,t){let i=0,r=t.length-1,a;if(e<t[0][0]||e>t[r][1])return!1;for(;r>=i;)if(a=i+r>>1,e>t[a][1])i=a+1;else if(e<t[a][0])r=a-1;else return!0;return!1}var rB=class{constructor(){if(this.version="6",!Jt){Jt=new Uint8Array(65536),Jt.fill(1),Jt[0]=0,Jt.fill(0,1,32),Jt.fill(0,127,160),Jt.fill(2,4352,4448),Jt[9001]=2,Jt[9002]=2,Jt.fill(2,11904,42192),Jt[12351]=1,Jt.fill(2,44032,55204),Jt.fill(2,63744,64256),Jt.fill(2,65040,65050),Jt.fill(2,65072,65136),Jt.fill(2,65280,65377),Jt.fill(2,65504,65511);for(let e=0;e<lm.length;++e)Jt.fill(0,lm[e][0],lm[e][1]+1)}}wcwidth(e){return e<32?0:e<127?1:e<65536?Jt[e]:sB(e,iB)?0:e>=131072&&e<=196605||e>=196608&&e<=262141?2:1}charProperties(e,t){let i=this.wcwidth(e),r=i===0&&t!==0;if(r){let a=jr.extractWidth(t);a===0?r=!1:a>i&&(i=a)}return jr.createPropertyValue(0,i,r)}},jr=class Su{constructor(){this._providers=Object.create(null),this._active="",this._onChange=new Ce,this.onChange=this._onChange.event;let t=new rB;this.register(t),this._active=t.version,this._activeProvider=t}static extractShouldJoin(t){return(t&1)!==0}static extractWidth(t){return t>>1&3}static extractCharKind(t){return t>>3}static createPropertyValue(t,i,r=!1){return(t&16777215)<<3|(i&3)<<1|(r?1:0)}dispose(){this._onChange.dispose()}get versions(){return Object.keys(this._providers)}get activeVersion(){return this._active}set activeVersion(t){if(!this._providers[t])throw new Error(`unknown Unicode version "${t}"`);this._active=t,this._activeProvider=this._providers[t],this._onChange.fire(t)}register(t){this._providers[t.version]=t}wcwidth(t){return this._activeProvider.wcwidth(t)}getStringCellWidth(t){let i=0,r=0,a=t.length;for(let c=0;c<a;++c){let h=t.charCodeAt(c);if(55296<=h&&h<=56319){if(++c>=a)return i+this.wcwidth(h);let m=t.charCodeAt(c);56320<=m&&m<=57343?h=(h-55296)*1024+m-56320+65536:i+=this.wcwidth(m)}let f=this.charProperties(h,r),g=Su.extractWidth(f);Su.extractShouldJoin(f)&&(g-=Su.extractWidth(r)),i+=g,r=f}return i}charProperties(t,i){return this._activeProvider.charProperties(t,i)}},lB=class{constructor(){this.glevel=0,this._charsets=[]}reset(){this.charset=void 0,this._charsets=[],this.glevel=0}setgLevel(e){this.glevel=e,this.charset=this._charsets[e]}setgCharset(e,t){this._charsets[e]=t,this.glevel===e&&(this.charset=t)}};function Bb(e){let t=e.buffer.lines.get(e.buffer.ybase+e.buffer.y-1)?.get(e.cols-1),i=e.buffer.lines.get(e.buffer.ybase+e.buffer.y);i&&t&&(i.isWrapped=t[3]!==0&&t[3]!==32)}var Ya=2147483647,aB=256,Lw=class mp{constructor(t=32,i=32){if(this.maxLength=t,this.maxSubParamsLength=i,i>aB)throw new Error("maxSubParamsLength must not be greater than 256");this.params=new Int32Array(t),this.length=0,this._subParams=new Int32Array(i),this._subParamsLength=0,this._subParamsIdx=new Uint16Array(t),this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}static fromArray(t){let i=new mp;if(!t.length)return i;for(let r=Array.isArray(t[0])?1:0;r<t.length;++r){let a=t[r];if(Array.isArray(a))for(let c=0;c<a.length;++c)i.addSubParam(a[c]);else i.addParam(a)}return i}clone(){let t=new mp(this.maxLength,this.maxSubParamsLength);return t.params.set(this.params),t.length=this.length,t._subParams.set(this._subParams),t._subParamsLength=this._subParamsLength,t._subParamsIdx.set(this._subParamsIdx),t._rejectDigits=this._rejectDigits,t._rejectSubDigits=this._rejectSubDigits,t._digitIsSub=this._digitIsSub,t}toArray(){let t=[];for(let i=0;i<this.length;++i){t.push(this.params[i]);let r=this._subParamsIdx[i]>>8,a=this._subParamsIdx[i]&255;a-r>0&&t.push(Array.prototype.slice.call(this._subParams,r,a))}return t}reset(){this.length=0,this._subParamsLength=0,this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}addParam(t){if(this._digitIsSub=!1,this.length>=this.maxLength){this._rejectDigits=!0;return}if(t<-1)throw new Error("values lesser than -1 are not allowed");this._subParamsIdx[this.length]=this._subParamsLength<<8|this._subParamsLength,this.params[this.length++]=t>Ya?Ya:t}addSubParam(t){if(this._digitIsSub=!0,!!this.length){if(this._rejectDigits||this._subParamsLength>=this.maxSubParamsLength){this._rejectSubDigits=!0;return}if(t<-1)throw new Error("values lesser than -1 are not allowed");this._subParams[this._subParamsLength++]=t>Ya?Ya:t,this._subParamsIdx[this.length-1]++}}hasSubParams(t){return(this._subParamsIdx[t]&255)-(this._subParamsIdx[t]>>8)>0}getSubParams(t){let i=this._subParamsIdx[t]>>8,r=this._subParamsIdx[t]&255;return r-i>0?this._subParams.subarray(i,r):null}getSubParamsAll(){let t={};for(let i=0;i<this.length;++i){let r=this._subParamsIdx[i]>>8,a=this._subParamsIdx[i]&255;a-r>0&&(t[i]=this._subParams.slice(r,a))}return t}addDigit(t){let i;if(this._rejectDigits||!(i=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;let r=this._digitIsSub?this._subParams:this.params,a=r[i-1];r[i-1]=~a?Math.min(a*10+t,Ya):t}},Wa=[],oB=class{constructor(){this._state=0,this._active=Wa,this._id=-1,this._handlers=Object.create(null),this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}registerHandler(e,t){this._handlers[e]===void 0&&(this._handlers[e]=[]);let i=this._handlers[e];return i.push(t),{dispose:()=>{let r=i.indexOf(t);r!==-1&&i.splice(r,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=Wa}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=Wa,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||Wa,!this._active.length)this._handlerFb(this._id,"START");else for(let e=this._active.length-1;e>=0;e--)this._active[e].start()}_put(e,t,i){if(!this._active.length)this._handlerFb(this._id,"PUT",qu(e,t,i));else for(let r=this._active.length-1;r>=0;r--)this._active[r].put(e,t,i)}start(){this.reset(),this._state=1}put(e,t,i){if(this._state!==3){if(this._state===1)for(;t<i;){let r=e[t++];if(r===59){this._state=2,this._start();break}if(r<48||57<r){this._state=3;return}this._id===-1&&(this._id=0),this._id=this._id*10+r-48}this._state===2&&i-t>0&&this._put(e,t,i)}}end(e,t=!0){if(this._state!==0){if(this._state!==3)if(this._state===1&&this._start(),!this._active.length)this._handlerFb(this._id,"END",e);else{let i=!1,r=this._active.length-1,a=!1;if(this._stack.paused&&(r=this._stack.loopPosition-1,i=t,a=this._stack.fallThrough,this._stack.paused=!1),!a&&i===!1){for(;r>=0&&(i=this._active[r].end(e),i!==!0);r--)if(i instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!1,i;r--}for(;r>=0;r--)if(i=this._active[r].end(!1),i instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!0,i}this._active=Wa,this._id=-1,this._state=0}}},ei=class{constructor(e){this._handler=e,this._data="",this._hitLimit=!1}start(){this._data="",this._hitLimit=!1}put(e,t,i){this._hitLimit||(this._data+=qu(e,t,i),this._data.length>1e7&&(this._data="",this._hitLimit=!0))}end(e){let t=!1;if(this._hitLimit)t=!1;else if(e&&(t=this._handler(this._data),t instanceof Promise))return t.then(i=>(this._data="",this._hitLimit=!1,i));return this._data="",this._hitLimit=!1,t}},Xa=[],cB=class{constructor(){this._handlers=Object.create(null),this._active=Xa,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=Xa}registerHandler(e,t){this._handlers[e]===void 0&&(this._handlers[e]=[]);let i=this._handlers[e];return i.push(t),{dispose:()=>{let r=i.indexOf(t);r!==-1&&i.splice(r,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=Xa,this._ident=0}hook(e,t){if(this.reset(),this._ident=e,this._active=this._handlers[e]||Xa,!this._active.length)this._handlerFb(this._ident,"HOOK",t);else for(let i=this._active.length-1;i>=0;i--)this._active[i].hook(t)}put(e,t,i){if(!this._active.length)this._handlerFb(this._ident,"PUT",qu(e,t,i));else for(let r=this._active.length-1;r>=0;r--)this._active[r].put(e,t,i)}unhook(e,t=!0){if(!this._active.length)this._handlerFb(this._ident,"UNHOOK",e);else{let i=!1,r=this._active.length-1,a=!1;if(this._stack.paused&&(r=this._stack.loopPosition-1,i=t,a=this._stack.fallThrough,this._stack.paused=!1),!a&&i===!1){for(;r>=0&&(i=this._active[r].unhook(e),i!==!0);r--)if(i instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!1,i;r--}for(;r>=0;r--)if(i=this._active[r].unhook(!1),i instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!0,i}this._active=Xa,this._ident=0}},no=new Lw;no.addParam(0);var Lb=class{constructor(e){this._handler=e,this._data="",this._params=no,this._hitLimit=!1}hook(e){this._params=e.length>1||e.params[0]?e.clone():no,this._data="",this._hitLimit=!1}put(e,t,i){this._hitLimit||(this._data+=qu(e,t,i),this._data.length>1e7&&(this._data="",this._hitLimit=!0))}unhook(e){let t=!1;if(this._hitLimit)t=!1;else if(e&&(t=this._handler(this._data,this._params),t instanceof Promise))return t.then(i=>(this._params=no,this._data="",this._hitLimit=!1,i));return this._params=no,this._data="",this._hitLimit=!1,t}},uB=class{constructor(e){this.table=new Uint8Array(e)}setDefault(e,t){this.table.fill(e<<4|t)}add(e,t,i,r){this.table[t<<8|e]=i<<4|r}addMany(e,t,i,r){for(let a=0;a<e.length;a++)this.table[t<<8|e[a]]=i<<4|r}},mi=160,hB=(function(){let e=new uB(4095),t=Array.apply(null,Array(256)).map((f,g)=>g),i=(f,g)=>t.slice(f,g),r=i(32,127),a=i(0,24);a.push(25),a.push.apply(a,i(28,32));let c=i(0,14),h;e.setDefault(1,0),e.addMany(r,0,2,0);for(h in c)e.addMany([24,26,153,154],h,3,0),e.addMany(i(128,144),h,3,0),e.addMany(i(144,152),h,3,0),e.add(156,h,0,0),e.add(27,h,11,1),e.add(157,h,4,8),e.addMany([152,158,159],h,0,7),e.add(155,h,11,3),e.add(144,h,11,9);return e.addMany(a,0,3,0),e.addMany(a,1,3,1),e.add(127,1,0,1),e.addMany(a,8,0,8),e.addMany(a,3,3,3),e.add(127,3,0,3),e.addMany(a,4,3,4),e.add(127,4,0,4),e.addMany(a,6,3,6),e.addMany(a,5,3,5),e.add(127,5,0,5),e.addMany(a,2,3,2),e.add(127,2,0,2),e.add(93,1,4,8),e.addMany(r,8,5,8),e.add(127,8,5,8),e.addMany([156,27,24,26,7],8,6,0),e.addMany(i(28,32),8,0,8),e.addMany([88,94,95],1,0,7),e.addMany(r,7,0,7),e.addMany(a,7,0,7),e.add(156,7,0,0),e.add(127,7,0,7),e.add(91,1,11,3),e.addMany(i(64,127),3,7,0),e.addMany(i(48,60),3,8,4),e.addMany([60,61,62,63],3,9,4),e.addMany(i(48,60),4,8,4),e.addMany(i(64,127),4,7,0),e.addMany([60,61,62,63],4,0,6),e.addMany(i(32,64),6,0,6),e.add(127,6,0,6),e.addMany(i(64,127),6,0,0),e.addMany(i(32,48),3,9,5),e.addMany(i(32,48),5,9,5),e.addMany(i(48,64),5,0,6),e.addMany(i(64,127),5,7,0),e.addMany(i(32,48),4,9,5),e.addMany(i(32,48),1,9,2),e.addMany(i(32,48),2,9,2),e.addMany(i(48,127),2,10,0),e.addMany(i(48,80),1,10,0),e.addMany(i(81,88),1,10,0),e.addMany([89,90,92],1,10,0),e.addMany(i(96,127),1,10,0),e.add(80,1,11,9),e.addMany(a,9,0,9),e.add(127,9,0,9),e.addMany(i(28,32),9,0,9),e.addMany(i(32,48),9,9,12),e.addMany(i(48,60),9,8,10),e.addMany([60,61,62,63],9,9,10),e.addMany(a,11,0,11),e.addMany(i(32,128),11,0,11),e.addMany(i(28,32),11,0,11),e.addMany(a,10,0,10),e.add(127,10,0,10),e.addMany(i(28,32),10,0,10),e.addMany(i(48,60),10,8,10),e.addMany([60,61,62,63],10,0,11),e.addMany(i(32,48),10,9,12),e.addMany(a,12,0,12),e.add(127,12,0,12),e.addMany(i(28,32),12,0,12),e.addMany(i(32,48),12,9,12),e.addMany(i(48,64),12,0,11),e.addMany(i(64,127),12,12,13),e.addMany(i(64,127),10,12,13),e.addMany(i(64,127),9,12,13),e.addMany(a,13,13,13),e.addMany(r,13,13,13),e.add(127,13,0,13),e.addMany([27,156,24,26],13,14,0),e.add(mi,0,2,0),e.add(mi,8,5,8),e.add(mi,6,0,6),e.add(mi,11,0,11),e.add(mi,13,13,13),e})(),dB=class extends it{constructor(e=hB){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 Lw,this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._printHandlerFb=(t,i,r)=>{},this._executeHandlerFb=t=>{},this._csiHandlerFb=(t,i)=>{},this._escHandlerFb=t=>{},this._errorHandlerFb=t=>t,this._printHandler=this._printHandlerFb,this._executeHandlers=Object.create(null),this._csiHandlers=Object.create(null),this._escHandlers=Object.create(null),this._register(At(()=>{this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null)})),this._oscParser=this._register(new oB),this._dcsParser=this._register(new cB),this._errorHandler=this._errorHandlerFb,this.registerEscHandler({final:"\\"},()=>!0)}_identifier(e,t=[64,126]){let i=0;if(e.prefix){if(e.prefix.length>1)throw new Error("only one byte as prefix supported");if(i=e.prefix.charCodeAt(0),i&&60>i||i>63)throw new Error("prefix must be in range 0x3c .. 0x3f")}if(e.intermediates){if(e.intermediates.length>2)throw new Error("only two bytes as intermediates are supported");for(let a=0;a<e.intermediates.length;++a){let c=e.intermediates.charCodeAt(a);if(32>c||c>47)throw new Error("intermediate must be in range 0x20 .. 0x2f");i<<=8,i|=c}}if(e.final.length!==1)throw new Error("final must be a single byte");let r=e.final.charCodeAt(0);if(t[0]>r||r>t[1])throw new Error(`final must be in range ${t[0]} .. ${t[1]}`);return i<<=8,i|=r,i}identToString(e){let t=[];for(;e;)t.push(String.fromCharCode(e&255)),e>>=8;return t.reverse().join("")}setPrintHandler(e){this._printHandler=e}clearPrintHandler(){this._printHandler=this._printHandlerFb}registerEscHandler(e,t){let i=this._identifier(e,[48,126]);this._escHandlers[i]===void 0&&(this._escHandlers[i]=[]);let r=this._escHandlers[i];return r.push(t),{dispose:()=>{let a=r.indexOf(t);a!==-1&&r.splice(a,1)}}}clearEscHandler(e){this._escHandlers[this._identifier(e,[48,126])]&&delete this._escHandlers[this._identifier(e,[48,126])]}setEscHandlerFallback(e){this._escHandlerFb=e}setExecuteHandler(e,t){this._executeHandlers[e.charCodeAt(0)]=t}clearExecuteHandler(e){this._executeHandlers[e.charCodeAt(0)]&&delete this._executeHandlers[e.charCodeAt(0)]}setExecuteHandlerFallback(e){this._executeHandlerFb=e}registerCsiHandler(e,t){let i=this._identifier(e);this._csiHandlers[i]===void 0&&(this._csiHandlers[i]=[]);let r=this._csiHandlers[i];return r.push(t),{dispose:()=>{let a=r.indexOf(t);a!==-1&&r.splice(a,1)}}}clearCsiHandler(e){this._csiHandlers[this._identifier(e)]&&delete this._csiHandlers[this._identifier(e)]}setCsiHandlerFallback(e){this._csiHandlerFb=e}registerDcsHandler(e,t){return this._dcsParser.registerHandler(this._identifier(e),t)}clearDcsHandler(e){this._dcsParser.clearHandler(this._identifier(e))}setDcsHandlerFallback(e){this._dcsParser.setHandlerFallback(e)}registerOscHandler(e,t){return this._oscParser.registerHandler(e,t)}clearOscHandler(e){this._oscParser.clearHandler(e)}setOscHandlerFallback(e){this._oscParser.setHandlerFallback(e)}setErrorHandler(e){this._errorHandler=e}clearErrorHandler(){this._errorHandler=this._errorHandlerFb}reset(){this.currentState=this.initialState,this._oscParser.reset(),this._dcsParser.reset(),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._parseStack.state!==0&&(this._parseStack.state=2,this._parseStack.handlers=[])}_preserveStack(e,t,i,r,a){this._parseStack.state=e,this._parseStack.handlers=t,this._parseStack.handlerPos=i,this._parseStack.transition=r,this._parseStack.chunkPos=a}parse(e,t,i){let r=0,a=0,c=0,h;if(this._parseStack.state)if(this._parseStack.state===2)this._parseStack.state=0,c=this._parseStack.chunkPos+1;else{if(i===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,g=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(i===!1&&g>-1){for(;g>=0&&(h=f[g](this._params),h!==!0);g--)if(h instanceof Promise)return this._parseStack.handlerPos=g,h}this._parseStack.handlers=[];break;case 4:if(i===!1&&g>-1){for(;g>=0&&(h=f[g](),h!==!0);g--)if(h instanceof Promise)return this._parseStack.handlerPos=g,h}this._parseStack.handlers=[];break;case 6:if(r=e[this._parseStack.chunkPos],h=this._dcsParser.unhook(r!==24&&r!==26,i),h)return h;r===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break;case 5:if(r=e[this._parseStack.chunkPos],h=this._oscParser.end(r!==24&&r!==26,i),h)return h;r===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break}this._parseStack.state=0,c=this._parseStack.chunkPos+1,this.precedingJoinState=0,this.currentState=this._parseStack.transition&15}for(let f=c;f<t;++f){switch(r=e[f],a=this._transitions.table[this.currentState<<8|(r<160?r:mi)],a>>4){case 2:for(let S=f+1;;++S){if(S>=t||(r=e[S])<32||r>126&&r<mi){this._printHandler(e,f,S),f=S-1;break}if(++S>=t||(r=e[S])<32||r>126&&r<mi){this._printHandler(e,f,S),f=S-1;break}if(++S>=t||(r=e[S])<32||r>126&&r<mi){this._printHandler(e,f,S),f=S-1;break}if(++S>=t||(r=e[S])<32||r>126&&r<mi){this._printHandler(e,f,S),f=S-1;break}}break;case 3:this._executeHandlers[r]?this._executeHandlers[r]():this._executeHandlerFb(r),this.precedingJoinState=0;break;case 0:break;case 1:if(this._errorHandler({position:f,code:r,currentState:this.currentState,collect:this._collect,params:this._params,abort:!1}).abort)return;break;case 7:let g=this._csiHandlers[this._collect<<8|r],m=g?g.length-1:-1;for(;m>=0&&(h=g[m](this._params),h!==!0);m--)if(h instanceof Promise)return this._preserveStack(3,g,m,a,f),h;m<0&&this._csiHandlerFb(this._collect<<8|r,this._params),this.precedingJoinState=0;break;case 8:do switch(r){case 59:this._params.addParam(0);break;case 58:this._params.addSubParam(-1);break;default:this._params.addDigit(r-48)}while(++f<t&&(r=e[f])>47&&r<60);f--;break;case 9:this._collect<<=8,this._collect|=r;break;case 10:let v=this._escHandlers[this._collect<<8|r],_=v?v.length-1:-1;for(;_>=0&&(h=v[_](),h!==!0);_--)if(h instanceof Promise)return this._preserveStack(4,v,_,a,f),h;_<0&&this._escHandlerFb(this._collect<<8|r),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|r,this._params);break;case 13:for(let S=f+1;;++S)if(S>=t||(r=e[S])===24||r===26||r===27||r>127&&r<mi){this._dcsParser.put(e,f,S),f=S-1;break}break;case 14:if(h=this._dcsParser.unhook(r!==24&&r!==26),h)return this._preserveStack(6,[],0,a,f),h;r===27&&(a|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0;break;case 4:this._oscParser.start();break;case 5:for(let S=f+1;;S++)if(S>=t||(r=e[S])<32||r>127&&r<mi){this._oscParser.put(e,f,S),f=S-1;break}break;case 6:if(h=this._oscParser.end(r!==24&&r!==26),h)return this._preserveStack(5,[],0,a,f),h;r===27&&(a|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0;break}this.currentState=a&15}}},fB=/^([\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})$/,mB=/^[\da-f]+$/;function zb(e){if(!e)return;let t=e.toLowerCase();if(t.indexOf("rgb:")===0){t=t.slice(4);let i=fB.exec(t);if(i){let r=i[1]?15:i[4]?255:i[7]?4095:65535;return[Math.round(parseInt(i[1]||i[4]||i[7]||i[10],16)/r*255),Math.round(parseInt(i[2]||i[5]||i[8]||i[11],16)/r*255),Math.round(parseInt(i[3]||i[6]||i[9]||i[12],16)/r*255)]}}else if(t.indexOf("#")===0&&(t=t.slice(1),mB.exec(t)&&[3,6,9,12].includes(t.length))){let i=t.length/3,r=[0,0,0];for(let a=0;a<3;++a){let c=parseInt(t.slice(i*a,i*a+i),16);r[a]=i===1?c<<4:i===2?c:i===3?c>>4:c>>8}return r}}function am(e,t){let i=e.toString(16),r=i.length<2?"0"+i:i;switch(t){case 4:return i[0];case 8:return r;case 12:return(r+r).slice(0,3);default:return r+r}}function pB(e,t=16){let[i,r,a]=e;return`rgb:${am(i,t)}/${am(r,t)}/${am(a,t)}`}var gB={"(":0,")":1,"*":2,"+":3,"-":1,".":2},$s=131072,Hb=10;function Ib(e,t){if(e>24)return t.setWinLines||!1;switch(e){case 1:return!!t.restoreWin;case 2:return!!t.minimizeWin;case 3:return!!t.setWinPosition;case 4:return!!t.setWinSizePixels;case 5:return!!t.raiseWin;case 6:return!!t.lowerWin;case 7:return!!t.refreshWin;case 8:return!!t.setWinSizeChars;case 9:return!!t.maximizeWin;case 10:return!!t.fullscreenWin;case 11:return!!t.getWinState;case 13:return!!t.getWinPosition;case 14:return!!t.getWinSizePixels;case 15:return!!t.getScreenSizePixels;case 16:return!!t.getCellSizePixels;case 18:return!!t.getWinSizeChars;case 19:return!!t.getScreenSizeChars;case 20:return!!t.getIconTitle;case 21:return!!t.getWinTitle;case 22:return!!t.pushTitle;case 23:return!!t.popTitle;case 24:return!!t.setWinLines}return!1}var Ub=5e3,Pb=0,_B=class extends it{constructor(e,t,i,r,a,c,h,f,g=new dB){super(),this._bufferService=e,this._charsetService=t,this._coreService=i,this._logService=r,this._optionsService=a,this._oscLinkService=c,this._coreMouseService=h,this._unicodeService=f,this._parser=g,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new L4,this._utf8Decoder=new z4,this._windowTitle="",this._iconName="",this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=Xt.clone(),this._eraseAttrDataInternal=Xt.clone(),this._onRequestBell=this._register(new Ce),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this._register(new Ce),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this._register(new Ce),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this._register(new Ce),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this._register(new Ce),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this._register(new Ce),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this._register(new Ce),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this._register(new Ce),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this._register(new Ce),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this._register(new Ce),this.onLineFeed=this._onLineFeed.event,this._onScroll=this._register(new Ce),this.onScroll=this._onScroll.event,this._onTitleChange=this._register(new Ce),this.onTitleChange=this._onTitleChange.event,this._onColor=this._register(new Ce),this.onColor=this._onColor.event,this._parseStack={paused:!1,cursorStartX:0,cursorStartY:0,decodedLength:0,position:0},this._specialColors=[256,257,258],this._register(this._parser),this._dirtyRowTracker=new pp(this._bufferService),this._activeBuffer=this._bufferService.buffer,this._register(this._bufferService.buffers.onBufferActivate(m=>this._activeBuffer=m.activeBuffer)),this._parser.setCsiHandlerFallback((m,v)=>{this._logService.debug("Unknown CSI code: ",{identifier:this._parser.identToString(m),params:v.toArray()})}),this._parser.setEscHandlerFallback(m=>{this._logService.debug("Unknown ESC code: ",{identifier:this._parser.identToString(m)})}),this._parser.setExecuteHandlerFallback(m=>{this._logService.debug("Unknown EXECUTE code: ",{code:m})}),this._parser.setOscHandlerFallback((m,v,_)=>{this._logService.debug("Unknown OSC code: ",{identifier:m,action:v,data:_})}),this._parser.setDcsHandlerFallback((m,v,_)=>{v==="HOOK"&&(_=_.toArray()),this._logService.debug("Unknown DCS code: ",{identifier:this._parser.identToString(m),action:v,payload:_})}),this._parser.setPrintHandler((m,v,_)=>this.print(m,v,_)),this._parser.registerCsiHandler({final:"@"},m=>this.insertChars(m)),this._parser.registerCsiHandler({intermediates:" ",final:"@"},m=>this.scrollLeft(m)),this._parser.registerCsiHandler({final:"A"},m=>this.cursorUp(m)),this._parser.registerCsiHandler({intermediates:" ",final:"A"},m=>this.scrollRight(m)),this._parser.registerCsiHandler({final:"B"},m=>this.cursorDown(m)),this._parser.registerCsiHandler({final:"C"},m=>this.cursorForward(m)),this._parser.registerCsiHandler({final:"D"},m=>this.cursorBackward(m)),this._parser.registerCsiHandler({final:"E"},m=>this.cursorNextLine(m)),this._parser.registerCsiHandler({final:"F"},m=>this.cursorPrecedingLine(m)),this._parser.registerCsiHandler({final:"G"},m=>this.cursorCharAbsolute(m)),this._parser.registerCsiHandler({final:"H"},m=>this.cursorPosition(m)),this._parser.registerCsiHandler({final:"I"},m=>this.cursorForwardTab(m)),this._parser.registerCsiHandler({final:"J"},m=>this.eraseInDisplay(m,!1)),this._parser.registerCsiHandler({prefix:"?",final:"J"},m=>this.eraseInDisplay(m,!0)),this._parser.registerCsiHandler({final:"K"},m=>this.eraseInLine(m,!1)),this._parser.registerCsiHandler({prefix:"?",final:"K"},m=>this.eraseInLine(m,!0)),this._parser.registerCsiHandler({final:"L"},m=>this.insertLines(m)),this._parser.registerCsiHandler({final:"M"},m=>this.deleteLines(m)),this._parser.registerCsiHandler({final:"P"},m=>this.deleteChars(m)),this._parser.registerCsiHandler({final:"S"},m=>this.scrollUp(m)),this._parser.registerCsiHandler({final:"T"},m=>this.scrollDown(m)),this._parser.registerCsiHandler({final:"X"},m=>this.eraseChars(m)),this._parser.registerCsiHandler({final:"Z"},m=>this.cursorBackwardTab(m)),this._parser.registerCsiHandler({final:"`"},m=>this.charPosAbsolute(m)),this._parser.registerCsiHandler({final:"a"},m=>this.hPositionRelative(m)),this._parser.registerCsiHandler({final:"b"},m=>this.repeatPrecedingCharacter(m)),this._parser.registerCsiHandler({final:"c"},m=>this.sendDeviceAttributesPrimary(m)),this._parser.registerCsiHandler({prefix:">",final:"c"},m=>this.sendDeviceAttributesSecondary(m)),this._parser.registerCsiHandler({final:"d"},m=>this.linePosAbsolute(m)),this._parser.registerCsiHandler({final:"e"},m=>this.vPositionRelative(m)),this._parser.registerCsiHandler({final:"f"},m=>this.hVPosition(m)),this._parser.registerCsiHandler({final:"g"},m=>this.tabClear(m)),this._parser.registerCsiHandler({final:"h"},m=>this.setMode(m)),this._parser.registerCsiHandler({prefix:"?",final:"h"},m=>this.setModePrivate(m)),this._parser.registerCsiHandler({final:"l"},m=>this.resetMode(m)),this._parser.registerCsiHandler({prefix:"?",final:"l"},m=>this.resetModePrivate(m)),this._parser.registerCsiHandler({final:"m"},m=>this.charAttributes(m)),this._parser.registerCsiHandler({final:"n"},m=>this.deviceStatus(m)),this._parser.registerCsiHandler({prefix:"?",final:"n"},m=>this.deviceStatusPrivate(m)),this._parser.registerCsiHandler({intermediates:"!",final:"p"},m=>this.softReset(m)),this._parser.registerCsiHandler({intermediates:" ",final:"q"},m=>this.setCursorStyle(m)),this._parser.registerCsiHandler({final:"r"},m=>this.setScrollRegion(m)),this._parser.registerCsiHandler({final:"s"},m=>this.saveCursor(m)),this._parser.registerCsiHandler({final:"t"},m=>this.windowOptions(m)),this._parser.registerCsiHandler({final:"u"},m=>this.restoreCursor(m)),this._parser.registerCsiHandler({intermediates:"'",final:"}"},m=>this.insertColumns(m)),this._parser.registerCsiHandler({intermediates:"'",final:"~"},m=>this.deleteColumns(m)),this._parser.registerCsiHandler({intermediates:'"',final:"q"},m=>this.selectProtected(m)),this._parser.registerCsiHandler({intermediates:"$",final:"p"},m=>this.requestMode(m,!0)),this._parser.registerCsiHandler({prefix:"?",intermediates:"$",final:"p"},m=>this.requestMode(m,!1)),this._parser.setExecuteHandler(fe.BEL,()=>this.bell()),this._parser.setExecuteHandler(fe.LF,()=>this.lineFeed()),this._parser.setExecuteHandler(fe.VT,()=>this.lineFeed()),this._parser.setExecuteHandler(fe.FF,()=>this.lineFeed()),this._parser.setExecuteHandler(fe.CR,()=>this.carriageReturn()),this._parser.setExecuteHandler(fe.BS,()=>this.backspace()),this._parser.setExecuteHandler(fe.HT,()=>this.tab()),this._parser.setExecuteHandler(fe.SO,()=>this.shiftOut()),this._parser.setExecuteHandler(fe.SI,()=>this.shiftIn()),this._parser.setExecuteHandler(vu.IND,()=>this.index()),this._parser.setExecuteHandler(vu.NEL,()=>this.nextLine()),this._parser.setExecuteHandler(vu.HTS,()=>this.tabSet()),this._parser.registerOscHandler(0,new ei(m=>(this.setTitle(m),this.setIconName(m),!0))),this._parser.registerOscHandler(1,new ei(m=>this.setIconName(m))),this._parser.registerOscHandler(2,new ei(m=>this.setTitle(m))),this._parser.registerOscHandler(4,new ei(m=>this.setOrReportIndexedColor(m))),this._parser.registerOscHandler(8,new ei(m=>this.setHyperlink(m))),this._parser.registerOscHandler(10,new ei(m=>this.setOrReportFgColor(m))),this._parser.registerOscHandler(11,new ei(m=>this.setOrReportBgColor(m))),this._parser.registerOscHandler(12,new ei(m=>this.setOrReportCursorColor(m))),this._parser.registerOscHandler(104,new ei(m=>this.restoreIndexedColor(m))),this._parser.registerOscHandler(110,new ei(m=>this.restoreFgColor(m))),this._parser.registerOscHandler(111,new ei(m=>this.restoreBgColor(m))),this._parser.registerOscHandler(112,new ei(m=>this.restoreCursorColor(m))),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 m in en)this._parser.registerEscHandler({intermediates:"(",final:m},()=>this.selectCharset("("+m)),this._parser.registerEscHandler({intermediates:")",final:m},()=>this.selectCharset(")"+m)),this._parser.registerEscHandler({intermediates:"*",final:m},()=>this.selectCharset("*"+m)),this._parser.registerEscHandler({intermediates:"+",final:m},()=>this.selectCharset("+"+m)),this._parser.registerEscHandler({intermediates:"-",final:m},()=>this.selectCharset("-"+m)),this._parser.registerEscHandler({intermediates:".",final:m},()=>this.selectCharset("."+m)),this._parser.registerEscHandler({intermediates:"/",final:m},()=>this.selectCharset("/"+m));this._parser.registerEscHandler({intermediates:"#",final:"8"},()=>this.screenAlignmentPattern()),this._parser.setErrorHandler(m=>(this._logService.error("Parsing error: ",m),m)),this._parser.registerDcsHandler({intermediates:"$",final:"q"},new Lb((m,v)=>this.requestStatusString(m,v)))}getAttrData(){return this._curAttrData}_preserveStack(e,t,i,r){this._parseStack.paused=!0,this._parseStack.cursorStartX=e,this._parseStack.cursorStartY=t,this._parseStack.decodedLength=i,this._parseStack.position=r}_logSlowResolvingAsync(e){this._logService.logLevel<=3&&Promise.race([e,new Promise((t,i)=>setTimeout(()=>i("#SLOW_TIMEOUT"),Ub))]).catch(t=>{if(t!=="#SLOW_TIMEOUT")throw t;console.warn(`async parser handler taking longer than ${Ub} ms`)})}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(e,t){let i,r=this._activeBuffer.x,a=this._activeBuffer.y,c=0,h=this._parseStack.paused;if(h){if(i=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,t))return this._logSlowResolvingAsync(i),i;r=this._parseStack.cursorStartX,a=this._parseStack.cursorStartY,this._parseStack.paused=!1,e.length>$s&&(c=this._parseStack.position+$s)}if(this._logService.logLevel<=1&&this._logService.debug(`parsing data ${typeof e=="string"?` "${e}"`:` "${Array.prototype.map.call(e,m=>String.fromCharCode(m)).join("")}"`}`),this._logService.logLevel===0&&this._logService.trace("parsing data (codes)",typeof e=="string"?e.split("").map(m=>m.charCodeAt(0)):e),this._parseBuffer.length<e.length&&this._parseBuffer.length<$s&&(this._parseBuffer=new Uint32Array(Math.min(e.length,$s))),h||this._dirtyRowTracker.clearRange(),e.length>$s)for(let m=c;m<e.length;m+=$s){let v=m+$s<e.length?m+$s:e.length,_=typeof e=="string"?this._stringDecoder.decode(e.substring(m,v),this._parseBuffer):this._utf8Decoder.decode(e.subarray(m,v),this._parseBuffer);if(i=this._parser.parse(this._parseBuffer,_))return this._preserveStack(r,a,_,m),this._logSlowResolvingAsync(i),i}else if(!h){let m=typeof e=="string"?this._stringDecoder.decode(e,this._parseBuffer):this._utf8Decoder.decode(e,this._parseBuffer);if(i=this._parser.parse(this._parseBuffer,m))return this._preserveStack(r,a,m,0),this._logSlowResolvingAsync(i),i}(this._activeBuffer.x!==r||this._activeBuffer.y!==a)&&this._onCursorMove.fire();let f=this._dirtyRowTracker.end+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp),g=this._dirtyRowTracker.start+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp);g<this._bufferService.rows&&this._onRequestRefreshRows.fire({start:Math.min(g,this._bufferService.rows-1),end:Math.min(f,this._bufferService.rows-1)})}print(e,t,i){let r,a,c=this._charsetService.charset,h=this._optionsService.rawOptions.screenReaderMode,f=this._bufferService.cols,g=this._coreService.decPrivateModes.wraparound,m=this._coreService.modes.insertMode,v=this._curAttrData,_=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._activeBuffer.x&&i-t>0&&_.getWidth(this._activeBuffer.x-1)===2&&_.setCellFromCodepoint(this._activeBuffer.x-1,0,1,v);let S=this._parser.precedingJoinState;for(let y=t;y<i;++y){if(r=e[y],r<127&&c){let N=c[String.fromCharCode(r)];N&&(r=N.charCodeAt(0))}let x=this._unicodeService.charProperties(r,S);a=jr.extractWidth(x);let w=jr.extractShouldJoin(x),j=w?jr.extractWidth(S):0;if(S=x,h&&this._onA11yChar.fire(Vs(r)),this._getCurrentLinkId()&&this._oscLinkService.addLineToLink(this._getCurrentLinkId(),this._activeBuffer.ybase+this._activeBuffer.y),this._activeBuffer.x+a-j>f){if(g){let N=_,M=this._activeBuffer.x-j;for(this._activeBuffer.x=j,this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData(),!0)):(this._activeBuffer.y>=this._bufferService.rows&&(this._activeBuffer.y=this._bufferService.rows-1),this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!0),_=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y),j>0&&_ instanceof eo&&_.copyCellsFrom(N,M,0,j,!1);M<f;)N.setCellFromCodepoint(M++,0,1,v)}else if(this._activeBuffer.x=f-1,a===2)continue}if(w&&this._activeBuffer.x){let N=_.getWidth(this._activeBuffer.x-1)?1:2;_.addCodepointToCell(this._activeBuffer.x-N,r,a);for(let M=a-j;--M>=0;)_.setCellFromCodepoint(this._activeBuffer.x++,0,0,v);continue}if(m&&(_.insertCells(this._activeBuffer.x,a-j,this._activeBuffer.getNullCell(v)),_.getWidth(f-1)===2&&_.setCellFromCodepoint(f-1,0,1,v)),_.setCellFromCodepoint(this._activeBuffer.x++,r,a,v),a>0)for(;--a;)_.setCellFromCodepoint(this._activeBuffer.x++,0,0,v)}this._parser.precedingJoinState=S,this._activeBuffer.x<f&&i-t>0&&_.getWidth(this._activeBuffer.x)===0&&!_.hasContent(this._activeBuffer.x)&&_.setCellFromCodepoint(this._activeBuffer.x,0,1,v),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(e,t){return e.final==="t"&&!e.prefix&&!e.intermediates?this._parser.registerCsiHandler(e,i=>Ib(i.params[0],this._optionsService.rawOptions.windowOptions)?t(i):!0):this._parser.registerCsiHandler(e,t)}registerDcsHandler(e,t){return this._parser.registerDcsHandler(e,new Lb(t))}registerEscHandler(e,t){return this._parser.registerEscHandler(e,t)}registerOscHandler(e,t){return this._parser.registerOscHandler(e,new ei(t))}bell(){return this._onRequestBell.fire(),!0}lineFeed(){return this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._optionsService.rawOptions.convertEol&&(this._activeBuffer.x=0),this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData())):this._activeBuffer.y>=this._bufferService.rows?this._activeBuffer.y=this._bufferService.rows-1:this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.x>=this._bufferService.cols&&this._activeBuffer.x--,this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._onLineFeed.fire(),!0}carriageReturn(){return this._activeBuffer.x=0,!0}backspace(){if(!this._coreService.decPrivateModes.reverseWraparound)return this._restrictCursor(),this._activeBuffer.x>0&&this._activeBuffer.x--,!0;if(this._restrictCursor(this._bufferService.cols),this._activeBuffer.x>0)this._activeBuffer.x--;else if(this._activeBuffer.x===0&&this._activeBuffer.y>this._activeBuffer.scrollTop&&this._activeBuffer.y<=this._activeBuffer.scrollBottom&&this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y)?.isWrapped){this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.y--,this._activeBuffer.x=this._bufferService.cols-1;let e=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);e.hasWidth(this._activeBuffer.x)&&!e.hasContent(this._activeBuffer.x)&&this._activeBuffer.x--}return this._restrictCursor(),!0}tab(){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let e=this._activeBuffer.x;return this._activeBuffer.x=this._activeBuffer.nextStop(),this._optionsService.rawOptions.screenReaderMode&&this._onA11yTab.fire(this._activeBuffer.x-e),!0}shiftOut(){return this._charsetService.setgLevel(1),!0}shiftIn(){return this._charsetService.setgLevel(0),!0}_restrictCursor(e=this._bufferService.cols-1){this._activeBuffer.x=Math.min(e,Math.max(0,this._activeBuffer.x)),this._activeBuffer.y=this._coreService.decPrivateModes.origin?Math.min(this._activeBuffer.scrollBottom,Math.max(this._activeBuffer.scrollTop,this._activeBuffer.y)):Math.min(this._bufferService.rows-1,Math.max(0,this._activeBuffer.y)),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_setCursor(e,t){this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._coreService.decPrivateModes.origin?(this._activeBuffer.x=e,this._activeBuffer.y=this._activeBuffer.scrollTop+t):(this._activeBuffer.x=e,this._activeBuffer.y=t),this._restrictCursor(),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_moveCursor(e,t){this._restrictCursor(),this._setCursor(this._activeBuffer.x+e,this._activeBuffer.y+t)}cursorUp(e){let t=this._activeBuffer.y-this._activeBuffer.scrollTop;return t>=0?this._moveCursor(0,-Math.min(t,e.params[0]||1)):this._moveCursor(0,-(e.params[0]||1)),!0}cursorDown(e){let t=this._activeBuffer.scrollBottom-this._activeBuffer.y;return t>=0?this._moveCursor(0,Math.min(t,e.params[0]||1)):this._moveCursor(0,e.params[0]||1),!0}cursorForward(e){return this._moveCursor(e.params[0]||1,0),!0}cursorBackward(e){return this._moveCursor(-(e.params[0]||1),0),!0}cursorNextLine(e){return this.cursorDown(e),this._activeBuffer.x=0,!0}cursorPrecedingLine(e){return this.cursorUp(e),this._activeBuffer.x=0,!0}cursorCharAbsolute(e){return this._setCursor((e.params[0]||1)-1,this._activeBuffer.y),!0}cursorPosition(e){return this._setCursor(e.length>=2?(e.params[1]||1)-1:0,(e.params[0]||1)-1),!0}charPosAbsolute(e){return this._setCursor((e.params[0]||1)-1,this._activeBuffer.y),!0}hPositionRelative(e){return this._moveCursor(e.params[0]||1,0),!0}linePosAbsolute(e){return this._setCursor(this._activeBuffer.x,(e.params[0]||1)-1),!0}vPositionRelative(e){return this._moveCursor(0,e.params[0]||1),!0}hVPosition(e){return this.cursorPosition(e),!0}tabClear(e){let t=e.params[0];return t===0?delete this._activeBuffer.tabs[this._activeBuffer.x]:t===3&&(this._activeBuffer.tabs={}),!0}cursorForwardTab(e){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let t=e.params[0]||1;for(;t--;)this._activeBuffer.x=this._activeBuffer.nextStop();return!0}cursorBackwardTab(e){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let t=e.params[0]||1;for(;t--;)this._activeBuffer.x=this._activeBuffer.prevStop();return!0}selectProtected(e){let t=e.params[0];return t===1&&(this._curAttrData.bg|=536870912),(t===2||t===0)&&(this._curAttrData.bg&=-536870913),!0}_eraseInBufferLine(e,t,i,r=!1,a=!1){let c=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);c.replaceCells(t,i,this._activeBuffer.getNullCell(this._eraseAttrData()),a),r&&(c.isWrapped=!1)}_resetBufferLine(e,t=!1){let i=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);i&&(i.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),t),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+e),i.isWrapped=!1)}eraseInDisplay(e,t=!1){this._restrictCursor(this._bufferService.cols);let i;switch(e.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,t);i<this._bufferService.rows;i++)this._resetBufferLine(i,t);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,t),this._activeBuffer.x+1>=this._bufferService.cols&&(this._activeBuffer.lines.get(i+1).isWrapped=!1);i--;)this._resetBufferLine(i,t);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,t);this._dirtyRowTracker.markDirty(0)}break;case 3:let r=this._activeBuffer.lines.length-this._bufferService.rows;r>0&&(this._activeBuffer.lines.trimStart(r),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-r,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-r,0),this._onScroll.fire(0));break}return!0}eraseInLine(e,t=!1){switch(this._restrictCursor(this._bufferService.cols),e.params[0]){case 0:this._eraseInBufferLine(this._activeBuffer.y,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,t);break;case 1:this._eraseInBufferLine(this._activeBuffer.y,0,this._activeBuffer.x+1,!1,t);break;case 2:this._eraseInBufferLine(this._activeBuffer.y,0,this._bufferService.cols,!0,t);break}return this._dirtyRowTracker.markDirty(this._activeBuffer.y),!0}insertLines(e){this._restrictCursor();let t=e.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let i=this._activeBuffer.ybase+this._activeBuffer.y,r=this._bufferService.rows-1-this._activeBuffer.scrollBottom,a=this._bufferService.rows-1+this._activeBuffer.ybase-r+1;for(;t--;)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(e){this._restrictCursor();let t=e.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let i=this._activeBuffer.ybase+this._activeBuffer.y,r;for(r=this._bufferService.rows-1-this._activeBuffer.scrollBottom,r=this._bufferService.rows-1+this._activeBuffer.ybase-r;t--;)this._activeBuffer.lines.splice(i,1),this._activeBuffer.lines.splice(r,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}insertChars(e){this._restrictCursor();let t=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return t&&(t.insertCells(this._activeBuffer.x,e.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}deleteChars(e){this._restrictCursor();let t=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return t&&(t.deleteCells(this._activeBuffer.x,e.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}scrollUp(e){let t=e.params[0]||1;for(;t--;)this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollTop,1),this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollBottom,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollDown(e){let t=e.params[0]||1;for(;t--;)this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollBottom,1),this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollTop,0,this._activeBuffer.getBlankLine(Xt));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollLeft(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let t=e.params[0]||1;for(let i=this._activeBuffer.scrollTop;i<=this._activeBuffer.scrollBottom;++i){let r=this._activeBuffer.lines.get(this._activeBuffer.ybase+i);r.deleteCells(0,t,this._activeBuffer.getNullCell(this._eraseAttrData())),r.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollRight(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let t=e.params[0]||1;for(let i=this._activeBuffer.scrollTop;i<=this._activeBuffer.scrollBottom;++i){let r=this._activeBuffer.lines.get(this._activeBuffer.ybase+i);r.insertCells(0,t,this._activeBuffer.getNullCell(this._eraseAttrData())),r.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}insertColumns(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let t=e.params[0]||1;for(let i=this._activeBuffer.scrollTop;i<=this._activeBuffer.scrollBottom;++i){let r=this._activeBuffer.lines.get(this._activeBuffer.ybase+i);r.insertCells(this._activeBuffer.x,t,this._activeBuffer.getNullCell(this._eraseAttrData())),r.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}deleteColumns(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let t=e.params[0]||1;for(let i=this._activeBuffer.scrollTop;i<=this._activeBuffer.scrollBottom;++i){let r=this._activeBuffer.lines.get(this._activeBuffer.ybase+i);r.deleteCells(this._activeBuffer.x,t,this._activeBuffer.getNullCell(this._eraseAttrData())),r.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}eraseChars(e){this._restrictCursor();let t=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return t&&(t.replaceCells(this._activeBuffer.x,this._activeBuffer.x+(e.params[0]||1),this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}repeatPrecedingCharacter(e){let t=this._parser.precedingJoinState;if(!t)return!0;let i=e.params[0]||1,r=jr.extractWidth(t),a=this._activeBuffer.x-r,c=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).getString(a),h=new Uint32Array(c.length*i),f=0;for(let m=0;m<c.length;){let v=c.codePointAt(m)||0;h[f++]=v,m+=v>65535?2:1}let g=f;for(let m=1;m<i;++m)h.copyWithin(g,0,f),g+=f;return this.print(h,0,g),!0}sendDeviceAttributesPrimary(e){return e.params[0]>0||(this._is("xterm")||this._is("rxvt-unicode")||this._is("screen")?this._coreService.triggerDataEvent(fe.ESC+"[?1;2c"):this._is("linux")&&this._coreService.triggerDataEvent(fe.ESC+"[?6c")),!0}sendDeviceAttributesSecondary(e){return e.params[0]>0||(this._is("xterm")?this._coreService.triggerDataEvent(fe.ESC+"[>0;276;0c"):this._is("rxvt-unicode")?this._coreService.triggerDataEvent(fe.ESC+"[>85;95;0c"):this._is("linux")?this._coreService.triggerDataEvent(e.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent(fe.ESC+"[>83;40003;0c")),!0}_is(e){return(this._optionsService.rawOptions.termName+"").indexOf(e)===0}setMode(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 4:this._coreService.modes.insertMode=!0;break;case 20:this._optionsService.options.convertEol=!0;break}return!0}setModePrivate(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!0;break;case 2:this._charsetService.setgCharset(0,Nr),this._charsetService.setgCharset(1,Nr),this._charsetService.setgCharset(2,Nr),this._charsetService.setgCharset(3,Nr);break;case 3:this._optionsService.rawOptions.windowOptions.setWinLines&&(this._bufferService.resize(132,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!0,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!0;break;case 12:this._optionsService.options.cursorBlink=!0;break;case 45:this._coreService.decPrivateModes.reverseWraparound=!0;break;case 66:this._logService.debug("Serial port requested application keypad."),this._coreService.decPrivateModes.applicationKeypad=!0,this._onRequestSyncScrollBar.fire();break;case 9:this._coreMouseService.activeProtocol="X10";break;case 1e3:this._coreMouseService.activeProtocol="VT200";break;case 1002:this._coreMouseService.activeProtocol="DRAG";break;case 1003:this._coreMouseService.activeProtocol="ANY";break;case 1004:this._coreService.decPrivateModes.sendFocus=!0,this._onRequestSendFocus.fire();break;case 1005:this._logService.debug("DECSET 1005 not supported (see #2507)");break;case 1006:this._coreMouseService.activeEncoding="SGR";break;case 1015:this._logService.debug("DECSET 1015 not supported (see #2507)");break;case 1016:this._coreMouseService.activeEncoding="SGR_PIXELS";break;case 25:this._coreService.isCursorHidden=!1;break;case 1048:this.saveCursor();break;case 1049:this.saveCursor();case 47:case 1047:this._bufferService.buffers.activateAltBuffer(this._eraseAttrData()),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(void 0),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!0;break;case 2026:this._coreService.decPrivateModes.synchronizedOutput=!0;break}return!0}resetMode(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 4:this._coreService.modes.insertMode=!1;break;case 20:this._optionsService.options.convertEol=!1;break}return!0}resetModePrivate(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!1;break;case 3:this._optionsService.rawOptions.windowOptions.setWinLines&&(this._bufferService.resize(80,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!1,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!1;break;case 12:this._optionsService.options.cursorBlink=!1;break;case 45:this._coreService.decPrivateModes.reverseWraparound=!1;break;case 66:this._logService.debug("Switching back to normal keypad."),this._coreService.decPrivateModes.applicationKeypad=!1,this._onRequestSyncScrollBar.fire();break;case 9:case 1e3:case 1002:case 1003:this._coreMouseService.activeProtocol="NONE";break;case 1004:this._coreService.decPrivateModes.sendFocus=!1;break;case 1005:this._logService.debug("DECRST 1005 not supported (see #2507)");break;case 1006:this._coreMouseService.activeEncoding="DEFAULT";break;case 1015:this._logService.debug("DECRST 1015 not supported (see #2507)");break;case 1016:this._coreMouseService.activeEncoding="DEFAULT";break;case 25:this._coreService.isCursorHidden=!0;break;case 1048:this.restoreCursor();break;case 1049:case 47:case 1047:this._bufferService.buffers.activateNormalBuffer(),e.params[t]===1049&&this.restoreCursor(),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(void 0),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!1;break;case 2026:this._coreService.decPrivateModes.synchronizedOutput=!1,this._onRequestRefreshRows.fire(void 0);break}return!0}requestMode(e,t){let i;(w=>(w[w.NOT_RECOGNIZED=0]="NOT_RECOGNIZED",w[w.SET=1]="SET",w[w.RESET=2]="RESET",w[w.PERMANENTLY_SET=3]="PERMANENTLY_SET",w[w.PERMANENTLY_RESET=4]="PERMANENTLY_RESET"))(i||={});let r=this._coreService.decPrivateModes,{activeProtocol:a,activeEncoding:c}=this._coreMouseService,h=this._coreService,{buffers:f,cols:g}=this._bufferService,{active:m,alt:v}=f,_=this._optionsService.rawOptions,S=(w,j)=>(h.triggerDataEvent(`${fe.ESC}[${t?"":"?"}${w};${j}$y`),!0),y=w=>w?1:2,x=e.params[0];return t?x===2?S(x,4):x===4?S(x,y(h.modes.insertMode)):x===12?S(x,3):x===20?S(x,y(_.convertEol)):S(x,0):x===1?S(x,y(r.applicationCursorKeys)):x===3?S(x,_.windowOptions.setWinLines?g===80?2:g===132?1:0:0):x===6?S(x,y(r.origin)):x===7?S(x,y(r.wraparound)):x===8?S(x,3):x===9?S(x,y(a==="X10")):x===12?S(x,y(_.cursorBlink)):x===25?S(x,y(!h.isCursorHidden)):x===45?S(x,y(r.reverseWraparound)):x===66?S(x,y(r.applicationKeypad)):x===67?S(x,4):x===1e3?S(x,y(a==="VT200")):x===1002?S(x,y(a==="DRAG")):x===1003?S(x,y(a==="ANY")):x===1004?S(x,y(r.sendFocus)):x===1005?S(x,4):x===1006?S(x,y(c==="SGR")):x===1015?S(x,4):x===1016?S(x,y(c==="SGR_PIXELS")):x===1048?S(x,1):x===47||x===1047||x===1049?S(x,y(m===v)):x===2004?S(x,y(r.bracketedPasteMode)):x===2026?S(x,y(r.synchronizedOutput)):S(x,0)}_updateAttrColor(e,t,i,r,a){return t===2?(e|=50331648,e&=-16777216,e|=yo.fromColorRGB([i,r,a])):t===5&&(e&=-50331904,e|=33554432|i&255),e}_extractColor(e,t,i){let r=[0,0,-1,0,0,0],a=0,c=0;do{if(r[c+a]=e.params[t+c],e.hasSubParams(t+c)){let h=e.getSubParams(t+c),f=0;do r[1]===5&&(a=1),r[c+f+1+a]=h[f];while(++f<h.length&&f+c+1+a<r.length);break}if(r[1]===5&&c+a>=2||r[1]===2&&c+a>=5)break;r[1]&&(a=1)}while(++c+t<e.length&&c+a<r.length);for(let h=2;h<r.length;++h)r[h]===-1&&(r[h]=0);switch(r[0]){case 38:i.fg=this._updateAttrColor(i.fg,r[1],r[3],r[4],r[5]);break;case 48:i.bg=this._updateAttrColor(i.bg,r[1],r[3],r[4],r[5]);break;case 58:i.extended=i.extended.clone(),i.extended.underlineColor=this._updateAttrColor(i.extended.underlineColor,r[1],r[3],r[4],r[5])}return c}_processUnderline(e,t){t.extended=t.extended.clone(),(!~e||e>5)&&(e=1),t.extended.underlineStyle=e,t.fg|=268435456,e===0&&(t.fg&=-268435457),t.updateExtended()}_processSGR0(e){e.fg=Xt.fg,e.bg=Xt.bg,e.extended=e.extended.clone(),e.extended.underlineStyle=0,e.extended.underlineColor&=-67108864,e.updateExtended()}charAttributes(e){if(e.length===1&&e.params[0]===0)return this._processSGR0(this._curAttrData),!0;let t=e.length,i,r=this._curAttrData;for(let a=0;a<t;a++)i=e.params[a],i>=30&&i<=37?(r.fg&=-50331904,r.fg|=16777216|i-30):i>=40&&i<=47?(r.bg&=-50331904,r.bg|=16777216|i-40):i>=90&&i<=97?(r.fg&=-50331904,r.fg|=16777216|i-90|8):i>=100&&i<=107?(r.bg&=-50331904,r.bg|=16777216|i-100|8):i===0?this._processSGR0(r):i===1?r.fg|=134217728:i===3?r.bg|=67108864:i===4?(r.fg|=268435456,this._processUnderline(e.hasSubParams(a)?e.getSubParams(a)[0]:1,r)):i===5?r.fg|=536870912:i===7?r.fg|=67108864:i===8?r.fg|=1073741824:i===9?r.fg|=2147483648:i===2?r.bg|=134217728:i===21?this._processUnderline(2,r):i===22?(r.fg&=-134217729,r.bg&=-134217729):i===23?r.bg&=-67108865:i===24?(r.fg&=-268435457,this._processUnderline(0,r)):i===25?r.fg&=-536870913:i===27?r.fg&=-67108865:i===28?r.fg&=-1073741825:i===29?r.fg&=2147483647:i===39?(r.fg&=-67108864,r.fg|=Xt.fg&16777215):i===49?(r.bg&=-67108864,r.bg|=Xt.bg&16777215):i===38||i===48||i===58?a+=this._extractColor(e,a,r):i===53?r.bg|=1073741824:i===55?r.bg&=-1073741825:i===59?(r.extended=r.extended.clone(),r.extended.underlineColor=-1,r.updateExtended()):i===100?(r.fg&=-67108864,r.fg|=Xt.fg&16777215,r.bg&=-67108864,r.bg|=Xt.bg&16777215):this._logService.debug("Unknown SGR attribute: %d.",i);return!0}deviceStatus(e){switch(e.params[0]){case 5:this._coreService.triggerDataEvent(`${fe.ESC}[0n`);break;case 6:let t=this._activeBuffer.y+1,i=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${fe.ESC}[${t};${i}R`);break}return!0}deviceStatusPrivate(e){if(e.params[0]===6){let t=this._activeBuffer.y+1,i=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${fe.ESC}[?${t};${i}R`)}return!0}softReset(e){return this._coreService.isCursorHidden=!1,this._onRequestSyncScrollBar.fire(),this._activeBuffer.scrollTop=0,this._activeBuffer.scrollBottom=this._bufferService.rows-1,this._curAttrData=Xt.clone(),this._coreService.reset(),this._charsetService.reset(),this._activeBuffer.savedX=0,this._activeBuffer.savedY=this._activeBuffer.ybase,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,this._coreService.decPrivateModes.origin=!1,!0}setCursorStyle(e){let t=e.length===0?1:e.params[0];if(t===0)this._coreService.decPrivateModes.cursorStyle=void 0,this._coreService.decPrivateModes.cursorBlink=void 0;else{switch(t){case 1:case 2:this._coreService.decPrivateModes.cursorStyle="block";break;case 3:case 4:this._coreService.decPrivateModes.cursorStyle="underline";break;case 5:case 6:this._coreService.decPrivateModes.cursorStyle="bar";break}let i=t%2===1;this._coreService.decPrivateModes.cursorBlink=i}return!0}setScrollRegion(e){let t=e.params[0]||1,i;return(e.length<2||(i=e.params[1])>this._bufferService.rows||i===0)&&(i=this._bufferService.rows),i>t&&(this._activeBuffer.scrollTop=t-1,this._activeBuffer.scrollBottom=i-1,this._setCursor(0,0)),!0}windowOptions(e){if(!Ib(e.params[0],this._optionsService.rawOptions.windowOptions))return!0;let t=e.length>1?e.params[1]:0;switch(e.params[0]){case 14:t!==2&&this._onRequestWindowsOptionsReport.fire(0);break;case 16:this._onRequestWindowsOptionsReport.fire(1);break;case 18:this._bufferService&&this._coreService.triggerDataEvent(`${fe.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);break;case 22:(t===0||t===2)&&(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>Hb&&this._windowTitleStack.shift()),(t===0||t===1)&&(this._iconNameStack.push(this._iconName),this._iconNameStack.length>Hb&&this._iconNameStack.shift());break;case 23:(t===0||t===2)&&this._windowTitleStack.length&&this.setTitle(this._windowTitleStack.pop()),(t===0||t===1)&&this._iconNameStack.length&&this.setIconName(this._iconNameStack.pop());break}return!0}saveCursor(e){return this._activeBuffer.savedX=this._activeBuffer.x,this._activeBuffer.savedY=this._activeBuffer.ybase+this._activeBuffer.y,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,!0}restoreCursor(e){return this._activeBuffer.x=this._activeBuffer.savedX||0,this._activeBuffer.y=Math.max(this._activeBuffer.savedY-this._activeBuffer.ybase,0),this._curAttrData.fg=this._activeBuffer.savedCurAttrData.fg,this._curAttrData.bg=this._activeBuffer.savedCurAttrData.bg,this._charsetService.charset=this._savedCharset,this._activeBuffer.savedCharset&&(this._charsetService.charset=this._activeBuffer.savedCharset),this._restrictCursor(),!0}setTitle(e){return this._windowTitle=e,this._onTitleChange.fire(e),!0}setIconName(e){return this._iconName=e,!0}setOrReportIndexedColor(e){let t=[],i=e.split(";");for(;i.length>1;){let r=i.shift(),a=i.shift();if(/^\d+$/.exec(r)){let c=parseInt(r);if(qb(c))if(a==="?")t.push({type:0,index:c});else{let h=zb(a);h&&t.push({type:1,index:c,color:h})}}}return t.length&&this._onColor.fire(t),!0}setHyperlink(e){let t=e.indexOf(";");if(t===-1)return!0;let i=e.slice(0,t).trim(),r=e.slice(t+1);return r?this._createHyperlink(i,r):i.trim()?!1:this._finishHyperlink()}_createHyperlink(e,t){this._getCurrentLinkId()&&this._finishHyperlink();let i=e.split(":"),r,a=i.findIndex(c=>c.startsWith("id="));return a!==-1&&(r=i[a].slice(3)||void 0),this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=this._oscLinkService.registerLink({id:r,uri:t}),this._curAttrData.updateExtended(),!0}_finishHyperlink(){return this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=0,this._curAttrData.updateExtended(),!0}_setOrReportSpecialColor(e,t){let i=e.split(";");for(let r=0;r<i.length&&!(t>=this._specialColors.length);++r,++t)if(i[r]==="?")this._onColor.fire([{type:0,index:this._specialColors[t]}]);else{let a=zb(i[r]);a&&this._onColor.fire([{type:1,index:this._specialColors[t],color:a}])}return!0}setOrReportFgColor(e){return this._setOrReportSpecialColor(e,0)}setOrReportBgColor(e){return this._setOrReportSpecialColor(e,1)}setOrReportCursorColor(e){return this._setOrReportSpecialColor(e,2)}restoreIndexedColor(e){if(!e)return this._onColor.fire([{type:2}]),!0;let t=[],i=e.split(";");for(let r=0;r<i.length;++r)if(/^\d+$/.exec(i[r])){let a=parseInt(i[r]);qb(a)&&t.push({type:2,index:a})}return t.length&&this._onColor.fire(t),!0}restoreFgColor(e){return this._onColor.fire([{type:2,index:256}]),!0}restoreBgColor(e){return this._onColor.fire([{type:2,index:257}]),!0}restoreCursorColor(e){return this._onColor.fire([{type:2,index:258}]),!0}nextLine(){return this._activeBuffer.x=0,this.index(),!0}keypadApplicationMode(){return this._logService.debug("Serial port requested application keypad."),this._coreService.decPrivateModes.applicationKeypad=!0,this._onRequestSyncScrollBar.fire(),!0}keypadNumericMode(){return this._logService.debug("Switching back to normal keypad."),this._coreService.decPrivateModes.applicationKeypad=!1,this._onRequestSyncScrollBar.fire(),!0}selectDefaultCharset(){return this._charsetService.setgLevel(0),this._charsetService.setgCharset(0,Nr),!0}selectCharset(e){return e.length!==2?(this.selectDefaultCharset(),!0):(e[0]==="/"||this._charsetService.setgCharset(gB[e[0]],en[e[1]]||Nr),!0)}index(){return this._restrictCursor(),this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData())):this._activeBuffer.y>=this._bufferService.rows&&(this._activeBuffer.y=this._bufferService.rows-1),this._restrictCursor(),!0}tabSet(){return this._activeBuffer.tabs[this._activeBuffer.x]=!0,!0}reverseIndex(){if(this._restrictCursor(),this._activeBuffer.y===this._activeBuffer.scrollTop){let e=this._activeBuffer.scrollBottom-this._activeBuffer.scrollTop;this._activeBuffer.lines.shiftElements(this._activeBuffer.ybase+this._activeBuffer.y,e,1),this._activeBuffer.lines.set(this._activeBuffer.ybase+this._activeBuffer.y,this._activeBuffer.getBlankLine(this._eraseAttrData())),this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom)}else this._activeBuffer.y--,this._restrictCursor();return!0}fullReset(){return this._parser.reset(),this._onRequestReset.fire(),!0}reset(){this._curAttrData=Xt.clone(),this._eraseAttrDataInternal=Xt.clone()}_eraseAttrData(){return this._eraseAttrDataInternal.bg&=-67108864,this._eraseAttrDataInternal.bg|=this._curAttrData.bg&67108863,this._eraseAttrDataInternal}setgLevel(e){return this._charsetService.setgLevel(e),!0}screenAlignmentPattern(){let e=new gi;e.content=1<<22|69,e.fg=this._curAttrData.fg,e.bg=this._curAttrData.bg,this._setCursor(0,0);for(let t=0;t<this._bufferService.rows;++t){let i=this._activeBuffer.ybase+this._activeBuffer.y+t,r=this._activeBuffer.lines.get(i);r&&(r.fill(e),r.isWrapped=!1)}return this._dirtyRowTracker.markAllDirty(),this._setCursor(0,0),!0}requestStatusString(e,t){let i=h=>(this._coreService.triggerDataEvent(`${fe.ESC}${h}${fe.ESC}\\`),!0),r=this._bufferService.buffer,a=this._optionsService.rawOptions;return i(e==='"q'?`P1$r${this._curAttrData.isProtected()?1:0}"q`:e==='"p'?'P1$r61;1"p':e==="r"?`P1$r${r.scrollTop+1};${r.scrollBottom+1}r`:e==="m"?"P1$r0m":e===" q"?`P1$r${{block:2,underline:4,bar:6}[a.cursorStyle]-(a.cursorBlink?1:0)} q`:"P0$r")}markRangeDirty(e,t){this._dirtyRowTracker.markRangeDirty(e,t)}},pp=class{constructor(e){this._bufferService=e,this.clearRange()}clearRange(){this.start=this._bufferService.buffer.y,this.end=this._bufferService.buffer.y}markDirty(e){e<this.start?this.start=e:e>this.end&&(this.end=e)}markRangeDirty(e,t){e>t&&(Pb=e,e=t,t=Pb),e<this.start&&(this.start=e),t>this.end&&(this.end=t)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};pp=It([Me(0,Rn)],pp);function qb(e){return 0<=e&&e<256}var vB=5e7,Fb=12,yB=50,SB=class extends it{constructor(e){super(),this._action=e,this._writeBuffer=[],this._callbacks=[],this._pendingData=0,this._bufferOffset=0,this._isSyncWriting=!1,this._syncCalls=0,this._didUserInput=!1,this._onWriteParsed=this._register(new Ce),this.onWriteParsed=this._onWriteParsed.event}handleUserInput(){this._didUserInput=!0}writeSync(e,t){if(t!==void 0&&this._syncCalls>t){this._syncCalls=0;return}if(this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(void 0),this._syncCalls++,this._isSyncWriting)return;this._isSyncWriting=!0;let i;for(;i=this._writeBuffer.shift();){this._action(i);let r=this._callbacks.shift();r&&r()}this._pendingData=0,this._bufferOffset=2147483647,this._isSyncWriting=!1,this._syncCalls=0}write(e,t){if(this._pendingData>vB)throw new Error("write data discarded, use flow control to avoid losing data");if(!this._writeBuffer.length){if(this._bufferOffset=0,this._didUserInput){this._didUserInput=!1,this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(t),this._innerWrite();return}setTimeout(()=>this._innerWrite())}this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(t)}_innerWrite(e=0,t=!0){let i=e||performance.now();for(;this._writeBuffer.length>this._bufferOffset;){let r=this._writeBuffer[this._bufferOffset],a=this._action(r,t);if(a){let h=f=>performance.now()-i>=Fb?setTimeout(()=>this._innerWrite(0,f)):this._innerWrite(i,f);a.catch(f=>(queueMicrotask(()=>{throw f}),Promise.resolve(!1))).then(h);return}let c=this._callbacks[this._bufferOffset];if(c&&c(),this._bufferOffset++,this._pendingData-=r.length,performance.now()-i>=Fb)break}this._writeBuffer.length>this._bufferOffset?(this._bufferOffset>yB&&(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()}},gp=class{constructor(e){this._bufferService=e,this._nextId=1,this._entriesWithId=new Map,this._dataByLinkId=new Map}registerLink(e){let t=this._bufferService.buffer;if(e.id===void 0){let f=t.addMarker(t.ybase+t.y),g={data:e,id:this._nextId++,lines:[f]};return f.onDispose(()=>this._removeMarkerFromLink(g,f)),this._dataByLinkId.set(g.id,g),g.id}let i=e,r=this._getEntryIdKey(i),a=this._entriesWithId.get(r);if(a)return this.addLineToLink(a.id,t.ybase+t.y),a.id;let c=t.addMarker(t.ybase+t.y),h={id:this._nextId++,key:this._getEntryIdKey(i),data:i,lines:[c]};return c.onDispose(()=>this._removeMarkerFromLink(h,c)),this._entriesWithId.set(h.key,h),this._dataByLinkId.set(h.id,h),h.id}addLineToLink(e,t){let i=this._dataByLinkId.get(e);if(i&&i.lines.every(r=>r.line!==t)){let r=this._bufferService.buffer.addMarker(t);i.lines.push(r),r.onDispose(()=>this._removeMarkerFromLink(i,r))}}getLinkData(e){return this._dataByLinkId.get(e)?.data}_getEntryIdKey(e){return`${e.id};;${e.uri}`}_removeMarkerFromLink(e,t){let i=e.lines.indexOf(t);i!==-1&&(e.lines.splice(i,1),e.lines.length===0&&(e.data.id!==void 0&&this._entriesWithId.delete(e.key),this._dataByLinkId.delete(e.id)))}};gp=It([Me(0,Rn)],gp);var $b=!1,bB=class extends it{constructor(e){super(),this._windowsWrappingHeuristics=this._register(new Pl),this._onBinary=this._register(new Ce),this.onBinary=this._onBinary.event,this._onData=this._register(new Ce),this.onData=this._onData.event,this._onLineFeed=this._register(new Ce),this.onLineFeed=this._onLineFeed.event,this._onResize=this._register(new Ce),this.onResize=this._onResize.event,this._onWriteParsed=this._register(new Ce),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this._register(new Ce),this._instantiationService=new VO,this.optionsService=this._register(new tB(e)),this._instantiationService.setService(On,this.optionsService),this._bufferService=this._register(this._instantiationService.createInstance(hp)),this._instantiationService.setService(Rn,this._bufferService),this._logService=this._register(this._instantiationService.createInstance(up)),this._instantiationService.setService(tw,this._logService),this.coreService=this._register(this._instantiationService.createInstance(dp)),this._instantiationService.setService(Lr,this.coreService),this.coreMouseService=this._register(this._instantiationService.createInstance(fp)),this._instantiationService.setService(ew,this.coreMouseService),this.unicodeService=this._register(this._instantiationService.createInstance(jr)),this._instantiationService.setService(P4,this.unicodeService),this._charsetService=this._instantiationService.createInstance(lB),this._instantiationService.setService(U4,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(gp),this._instantiationService.setService(nw,this._oscLinkService),this._inputHandler=this._register(new _B(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService)),this._register(bn.forward(this._inputHandler.onLineFeed,this._onLineFeed)),this._register(this._inputHandler),this._register(bn.forward(this._bufferService.onResize,this._onResize)),this._register(bn.forward(this.coreService.onData,this._onData)),this._register(bn.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 SB((t,i)=>this._inputHandler.parse(t,i))),this._register(bn.forward(this._writeBuffer.onWriteParsed,this._onWriteParsed))}get onScroll(){return this._onScrollApi||(this._onScrollApi=this._register(new Ce),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 t in e)this.optionsService.options[t]=e[t]}write(e,t){this._writeBuffer.write(e,t)}writeSync(e,t){this._logService.logLevel<=3&&!$b&&(this._logService.warn("writeSync is unreliable and will be removed soon."),$b=!0),this._writeBuffer.writeSync(e,t)}input(e,t=!0){this.coreService.triggerDataEvent(e,t)}resize(e,t){isNaN(e)||isNaN(t)||(e=Math.max(e,Ow),t=Math.max(t,Bw),this._bufferService.resize(e,t))}scroll(e,t=!1){this._bufferService.scroll(e,t)}scrollLines(e,t){this._bufferService.scrollLines(e,t)}scrollPages(e){this.scrollLines(e*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(e){this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(e){let t=e-this._bufferService.buffer.ydisp;t!==0&&this.scrollLines(t)}registerEscHandler(e,t){return this._inputHandler.registerEscHandler(e,t)}registerDcsHandler(e,t){return this._inputHandler.registerDcsHandler(e,t)}registerCsiHandler(e,t){return this._inputHandler.registerCsiHandler(e,t)}registerOscHandler(e,t){return this._inputHandler.registerOscHandler(e,t)}_setup(){this._handleWindowsPtyOptionChange()}reset(){this._inputHandler.reset(),this._bufferService.reset(),this._charsetService.reset(),this.coreService.reset(),this.coreMouseService.reset()}_handleWindowsPtyOptionChange(){let e=!1,t=this.optionsService.rawOptions.windowsPty;t&&t.buildNumber!==void 0&&t.buildNumber!==void 0?e=t.backend==="conpty"&&t.buildNumber<21376:this.optionsService.rawOptions.windowsMode&&(e=!0),e?this._enableWindowsWrappingHeuristics():this._windowsWrappingHeuristics.clear()}_enableWindowsWrappingHeuristics(){if(!this._windowsWrappingHeuristics.value){let e=[];e.push(this.onLineFeed(Bb.bind(null,this._bufferService))),e.push(this.registerCsiHandler({final:"H"},()=>(Bb(this._bufferService),!1))),this._windowsWrappingHeuristics.value=At(()=>{for(let t of e)t.dispose()})}}},xB={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 wB(e,t,i,r){let a={type:0,cancel:!1,key:void 0},c=(e.shiftKey?1:0)|(e.altKey?2:0)|(e.ctrlKey?4:0)|(e.metaKey?8:0);switch(e.keyCode){case 0:e.key==="UIKeyInputUpArrow"?t?a.key=fe.ESC+"OA":a.key=fe.ESC+"[A":e.key==="UIKeyInputLeftArrow"?t?a.key=fe.ESC+"OD":a.key=fe.ESC+"[D":e.key==="UIKeyInputRightArrow"?t?a.key=fe.ESC+"OC":a.key=fe.ESC+"[C":e.key==="UIKeyInputDownArrow"&&(t?a.key=fe.ESC+"OB":a.key=fe.ESC+"[B");break;case 8:a.key=e.ctrlKey?"\b":fe.DEL,e.altKey&&(a.key=fe.ESC+a.key);break;case 9:if(e.shiftKey){a.key=fe.ESC+"[Z";break}a.key=fe.HT,a.cancel=!0;break;case 13:a.key=e.altKey?fe.ESC+fe.CR:fe.CR,a.cancel=!0;break;case 27:a.key=fe.ESC,e.altKey&&(a.key=fe.ESC+fe.ESC),a.cancel=!0;break;case 37:if(e.metaKey)break;c?a.key=fe.ESC+"[1;"+(c+1)+"D":t?a.key=fe.ESC+"OD":a.key=fe.ESC+"[D";break;case 39:if(e.metaKey)break;c?a.key=fe.ESC+"[1;"+(c+1)+"C":t?a.key=fe.ESC+"OC":a.key=fe.ESC+"[C";break;case 38:if(e.metaKey)break;c?a.key=fe.ESC+"[1;"+(c+1)+"A":t?a.key=fe.ESC+"OA":a.key=fe.ESC+"[A";break;case 40:if(e.metaKey)break;c?a.key=fe.ESC+"[1;"+(c+1)+"B":t?a.key=fe.ESC+"OB":a.key=fe.ESC+"[B";break;case 45:!e.shiftKey&&!e.ctrlKey&&(a.key=fe.ESC+"[2~");break;case 46:c?a.key=fe.ESC+"[3;"+(c+1)+"~":a.key=fe.ESC+"[3~";break;case 36:c?a.key=fe.ESC+"[1;"+(c+1)+"H":t?a.key=fe.ESC+"OH":a.key=fe.ESC+"[H";break;case 35:c?a.key=fe.ESC+"[1;"+(c+1)+"F":t?a.key=fe.ESC+"OF":a.key=fe.ESC+"[F";break;case 33:e.shiftKey?a.type=2:e.ctrlKey?a.key=fe.ESC+"[5;"+(c+1)+"~":a.key=fe.ESC+"[5~";break;case 34:e.shiftKey?a.type=3:e.ctrlKey?a.key=fe.ESC+"[6;"+(c+1)+"~":a.key=fe.ESC+"[6~";break;case 112:c?a.key=fe.ESC+"[1;"+(c+1)+"P":a.key=fe.ESC+"OP";break;case 113:c?a.key=fe.ESC+"[1;"+(c+1)+"Q":a.key=fe.ESC+"OQ";break;case 114:c?a.key=fe.ESC+"[1;"+(c+1)+"R":a.key=fe.ESC+"OR";break;case 115:c?a.key=fe.ESC+"[1;"+(c+1)+"S":a.key=fe.ESC+"OS";break;case 116:c?a.key=fe.ESC+"[15;"+(c+1)+"~":a.key=fe.ESC+"[15~";break;case 117:c?a.key=fe.ESC+"[17;"+(c+1)+"~":a.key=fe.ESC+"[17~";break;case 118:c?a.key=fe.ESC+"[18;"+(c+1)+"~":a.key=fe.ESC+"[18~";break;case 119:c?a.key=fe.ESC+"[19;"+(c+1)+"~":a.key=fe.ESC+"[19~";break;case 120:c?a.key=fe.ESC+"[20;"+(c+1)+"~":a.key=fe.ESC+"[20~";break;case 121:c?a.key=fe.ESC+"[21;"+(c+1)+"~":a.key=fe.ESC+"[21~";break;case 122:c?a.key=fe.ESC+"[23;"+(c+1)+"~":a.key=fe.ESC+"[23~";break;case 123:c?a.key=fe.ESC+"[24;"+(c+1)+"~":a.key=fe.ESC+"[24~";break;default:if(e.ctrlKey&&!e.shiftKey&&!e.altKey&&!e.metaKey)e.keyCode>=65&&e.keyCode<=90?a.key=String.fromCharCode(e.keyCode-64):e.keyCode===32?a.key=fe.NUL:e.keyCode>=51&&e.keyCode<=55?a.key=String.fromCharCode(e.keyCode-51+27):e.keyCode===56?a.key=fe.DEL:e.keyCode===219?a.key=fe.ESC:e.keyCode===220?a.key=fe.FS:e.keyCode===221&&(a.key=fe.GS);else if((!i||r)&&e.altKey&&!e.metaKey){let h=xB[e.keyCode]?.[e.shiftKey?1:0];if(h)a.key=fe.ESC+h;else if(e.keyCode>=65&&e.keyCode<=90){let f=e.ctrlKey?e.keyCode-64:e.keyCode+32,g=String.fromCharCode(f);e.shiftKey&&(g=g.toUpperCase()),a.key=fe.ESC+g}else if(e.keyCode===32)a.key=fe.ESC+(e.ctrlKey?fe.NUL:" ");else if(e.key==="Dead"&&e.code.startsWith("Key")){let f=e.code.slice(3,4);e.shiftKey||(f=f.toLowerCase()),a.key=fe.ESC+f,a.cancel=!0}}else i&&!e.altKey&&!e.ctrlKey&&!e.shiftKey&&e.metaKey?e.keyCode===65&&(a.type=1):e.key&&!e.ctrlKey&&!e.altKey&&!e.metaKey&&e.keyCode>=48&&e.key.length===1?a.key=e.key:e.key&&e.ctrlKey&&(e.key==="_"&&(a.key=fe.US),e.key==="@"&&(a.key=fe.NUL));break}return a}var qt=0,CB=class{constructor(e){this._getKey=e,this._array=[],this._insertedValues=[],this._flushInsertedTask=new Au,this._isFlushingInserted=!1,this._deletedIndices=[],this._flushDeletedTask=new Au,this._isFlushingDeleted=!1}clear(){this._array.length=0,this._insertedValues.length=0,this._flushInsertedTask.clear(),this._isFlushingInserted=!1,this._deletedIndices.length=0,this._flushDeletedTask.clear(),this._isFlushingDeleted=!1}insert(e){this._flushCleanupDeleted(),this._insertedValues.length===0&&this._flushInsertedTask.enqueue(()=>this._flushInserted()),this._insertedValues.push(e)}_flushInserted(){let e=this._insertedValues.sort((a,c)=>this._getKey(a)-this._getKey(c)),t=0,i=0,r=new Array(this._array.length+this._insertedValues.length);for(let a=0;a<r.length;a++)i>=this._array.length||this._getKey(e[t])<=this._getKey(this._array[i])?(r[a]=e[t],t++):r[a]=this._array[i++];this._array=r,this._insertedValues.length=0}_flushCleanupInserted(){!this._isFlushingInserted&&this._insertedValues.length>0&&this._flushInsertedTask.flush()}delete(e){if(this._flushCleanupInserted(),this._array.length===0)return!1;let t=this._getKey(e);if(t===void 0||(qt=this._search(t),qt===-1)||this._getKey(this._array[qt])!==t)return!1;do if(this._array[qt]===e)return this._deletedIndices.length===0&&this._flushDeletedTask.enqueue(()=>this._flushDeleted()),this._deletedIndices.push(qt),!0;while(++qt<this._array.length&&this._getKey(this._array[qt])===t);return!1}_flushDeleted(){this._isFlushingDeleted=!0;let e=this._deletedIndices.sort((a,c)=>a-c),t=0,i=new Array(this._array.length-e.length),r=0;for(let a=0;a<this._array.length;a++)e[t]===a?t++:i[r++]=this._array[a];this._array=i,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&&(qt=this._search(e),!(qt<0||qt>=this._array.length)&&this._getKey(this._array[qt])===e))do yield this._array[qt];while(++qt<this._array.length&&this._getKey(this._array[qt])===e)}forEachByKey(e,t){if(this._flushCleanupInserted(),this._flushCleanupDeleted(),this._array.length!==0&&(qt=this._search(e),!(qt<0||qt>=this._array.length)&&this._getKey(this._array[qt])===e))do t(this._array[qt]);while(++qt<this._array.length&&this._getKey(this._array[qt])===e)}values(){return this._flushCleanupInserted(),this._flushCleanupDeleted(),[...this._array].values()}_search(e){let t=0,i=this._array.length-1;for(;i>=t;){let r=t+i>>1,a=this._getKey(this._array[r]);if(a>e)i=r-1;else if(a<e)t=r+1;else{for(;r>0&&this._getKey(this._array[r-1])===e;)r--;return r}}return t}},om=0,Vb=0,kB=class extends it{constructor(){super(),this._decorations=new CB(e=>e?.marker.line),this._onDecorationRegistered=this._register(new Ce),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this._register(new Ce),this.onDecorationRemoved=this._onDecorationRemoved.event,this._register(At(()=>this.reset()))}get decorations(){return this._decorations.values()}registerDecoration(e){if(e.marker.isDisposed)return;let t=new NB(e);if(t){let i=t.marker.onDispose(()=>t.dispose()),r=t.onDispose(()=>{r.dispose(),t&&(this._decorations.delete(t)&&this._onDecorationRemoved.fire(t),i.dispose())});this._decorations.insert(t),this._onDecorationRegistered.fire(t)}return t}reset(){for(let e of this._decorations.values())e.dispose();this._decorations.clear()}*getDecorationsAtCell(e,t,i){let r=0,a=0;for(let c of this._decorations.getKeyIterator(t))r=c.options.x??0,a=r+(c.options.width??1),e>=r&&e<a&&(!i||(c.options.layer??"bottom")===i)&&(yield c)}forEachDecorationAtCell(e,t,i,r){this._decorations.forEachByKey(t,a=>{om=a.options.x??0,Vb=om+(a.options.width??1),e>=om&&e<Vb&&(!i||(a.options.layer??"bottom")===i)&&r(a)})}},NB=class extends Ys{constructor(e){super(),this.options=e,this.onRenderEmitter=this.add(new Ce),this.onRender=this.onRenderEmitter.event,this._onDispose=this.add(new Ce),this.onDispose=this._onDispose.event,this._cachedBg=null,this._cachedFg=null,this.marker=e.marker,this.options.overviewRulerOptions&&!this.options.overviewRulerOptions.position&&(this.options.overviewRulerOptions.position="full")}get backgroundColorRGB(){return this._cachedBg===null&&(this.options.backgroundColor?this._cachedBg=Bt.toColor(this.options.backgroundColor):this._cachedBg=void 0),this._cachedBg}get foregroundColorRGB(){return this._cachedFg===null&&(this.options.foregroundColor?this._cachedFg=Bt.toColor(this.options.foregroundColor):this._cachedFg=void 0),this._cachedFg}dispose(){this._onDispose.fire(),super.dispose()}},EB=1e3,jB=class{constructor(e,t=EB){this._renderCallback=e,this._debounceThresholdMS=t,this._lastRefreshMs=0,this._additionalRefreshRequested=!1}dispose(){this._refreshTimeoutID&&clearTimeout(this._refreshTimeoutID)}refresh(e,t,i){this._rowCount=i,e=e!==void 0?e:0,t=t!==void 0?t:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,e):e,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,t):t;let r=performance.now();if(r-this._lastRefreshMs>=this._debounceThresholdMS)this._lastRefreshMs=r,this._innerRefresh();else if(!this._additionalRefreshRequested){let a=r-this._lastRefreshMs,c=this._debounceThresholdMS-a;this._additionalRefreshRequested=!0,this._refreshTimeoutID=window.setTimeout(()=>{this._lastRefreshMs=performance.now(),this._innerRefresh(),this._additionalRefreshRequested=!1,this._refreshTimeoutID=void 0},c)}}_innerRefresh(){if(this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0)return;let e=Math.max(this._rowStart,0),t=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(e,t)}},Kb=20,Ru=class extends it{constructor(e,t,i,r){super(),this._terminal=e,this._coreBrowserService=i,this._renderService=r,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 c=0;c<this._terminal.rows;c++)this._rowElements[c]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[c]);if(this._topBoundaryFocusListener=c=>this._handleBoundaryFocus(c,0),this._bottomBoundaryFocusListener=c=>this._handleBoundaryFocus(c,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 jB(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(c=>this._handleResize(c.rows))),this._register(this._terminal.onRender(c=>this._refreshRows(c.start,c.end))),this._register(this._terminal.onScroll(()=>this._refreshRows())),this._register(this._terminal.onA11yChar(c=>this._handleChar(c))),this._register(this._terminal.onLineFeed(()=>this._handleChar(`
60
+ `))),this._register(this._terminal.onA11yTab(c=>this._handleTab(c))),this._register(this._terminal.onKey(c=>this._handleKey(c.key))),this._register(this._terminal.onBlur(()=>this._clearLiveRegion())),this._register(this._renderService.onDimensionsChange(()=>this._refreshRowsDimensions())),this._register($e(a,"selectionchange",()=>this._handleSelectionChange())),this._register(this._coreBrowserService.onDprChange(()=>this._refreshRowsDimensions())),this._refreshRowsDimensions(),this._refreshRows(),this._register(At(()=>{this._accessibilityContainer.remove(),this._rowElements.length=0}))}_handleTab(e){for(let t=0;t<e;t++)this._handleChar(" ")}_handleChar(e){this._liveRegionLineCount<Kb+1&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==e&&(this._charsToAnnounce+=e):this._charsToAnnounce+=e,e===`
61
+ `&&(this._liveRegionLineCount++,this._liveRegionLineCount===Kb+1&&(this._liveRegion.textContent+=Lm.get())))}_clearLiveRegion(){this._liveRegion.textContent="",this._liveRegionLineCount=0}_handleKey(e){this._clearLiveRegion(),new RegExp("\\p{Control}","u").test(e)||this._charsToConsume.push(e)}_refreshRows(e,t){this._liveRegionDebouncer.refresh(e,t,this._terminal.rows)}_renderRows(e,t){let i=this._terminal.buffer,r=i.lines.length.toString();for(let a=e;a<=t;a++){let c=i.lines.get(i.ydisp+a),h=[],f=c?.translateToString(!0,void 0,void 0,h)||"",g=(i.ydisp+a+1).toString(),m=this._rowElements[a];m&&(f.length===0?(m.textContent=" ",this._rowColumns.set(m,[0,1])):(m.textContent=f,this._rowColumns.set(m,h)),m.setAttribute("aria-posinset",g),m.setAttribute("aria-setsize",r),this._alignRowWidth(m))}this._announceCharacters()}_announceCharacters(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce="")}_handleBoundaryFocus(e,t){let i=e.target,r=this._rowElements[t===0?1:this._rowElements.length-2],a=i.getAttribute("aria-posinset"),c=t===0?"1":`${this._terminal.buffer.lines.length}`;if(a===c||e.relatedTarget!==r)return;let h,f;if(t===0?(h=i,f=this._rowElements.pop(),this._rowContainer.removeChild(f)):(h=this._rowElements.shift(),f=i,this._rowContainer.removeChild(h)),h.removeEventListener("focus",this._topBoundaryFocusListener),f.removeEventListener("focus",this._bottomBoundaryFocusListener),t===0){let g=this._createAccessibilityTreeNode();this._rowElements.unshift(g),this._rowContainer.insertAdjacentElement("afterbegin",g)}else{let g=this._createAccessibilityTreeNode();this._rowElements.push(g),this._rowContainer.appendChild(g)}this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._terminal.scrollLines(t===0?-1:1),this._rowElements[t===0?1:this._rowElements.length-2].focus(),e.preventDefault(),e.stopImmediatePropagation()}_handleSelectionChange(){if(this._rowElements.length===0)return;let e=this._coreBrowserService.mainDocument.getSelection();if(!e)return;if(e.isCollapsed){this._rowContainer.contains(e.anchorNode)&&this._terminal.clearSelection();return}if(!e.anchorNode||!e.focusNode){console.error("anchorNode and/or focusNode are null");return}let t={node:e.anchorNode,offset:e.anchorOffset},i={node:e.focusNode,offset:e.focusOffset};if((t.node.compareDocumentPosition(i.node)&Node.DOCUMENT_POSITION_PRECEDING||t.node===i.node&&t.offset>i.offset)&&([t,i]=[i,t]),t.node.compareDocumentPosition(this._rowElements[0])&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_FOLLOWING)&&(t={node:this._rowElements[0].childNodes[0],offset:0}),!this._rowContainer.contains(t.node))return;let r=this._rowElements.slice(-1)[0];if(i.node.compareDocumentPosition(r)&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_PRECEDING)&&(i={node:r,offset:r.textContent?.length??0}),!this._rowContainer.contains(i.node))return;let a=({node:f,offset:g})=>{let m=f instanceof Text?f.parentNode:f,v=parseInt(m?.getAttribute("aria-posinset"),10)-1;if(isNaN(v))return console.warn("row is invalid. Race condition?"),null;let _=this._rowColumns.get(m);if(!_)return console.warn("columns is null. Race condition?"),null;let S=g<_.length?_[g]:_.slice(-1)[0]+1;return S>=this._terminal.cols&&(++v,S=0),{row:v,column:S}},c=a(t),h=a(i);if(!(!c||!h)){if(c.row>h.row||c.row===h.row&&c.column>=h.column)throw new Error("invalid range");this._terminal.select(c.column,c.row,(h.row-c.row)*this._terminal.cols-c.column+h.column)}}_handleResize(e){this._rowElements[this._rowElements.length-1].removeEventListener("focus",this._bottomBoundaryFocusListener);for(let t=this._rowContainer.children.length;t<this._terminal.rows;t++)this._rowElements[t]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[t]);for(;this._rowElements.length>e;)this._rowContainer.removeChild(this._rowElements.pop());this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions()}_createAccessibilityTreeNode(){let e=this._coreBrowserService.mainDocument.createElement("div");return e.setAttribute("role","listitem"),e.tabIndex=-1,this._refreshRowDimensions(e),e}_refreshRowsDimensions(){if(this._renderService.dimensions.css.cell.height){Object.assign(this._accessibilityContainer.style,{width:`${this._renderService.dimensions.css.canvas.width}px`,fontSize:`${this._terminal.options.fontSize}px`}),this._rowElements.length!==this._terminal.rows&&this._handleResize(this._terminal.rows);for(let e=0;e<this._terminal.rows;e++)this._refreshRowDimensions(this._rowElements[e]),this._alignRowWidth(this._rowElements[e])}}_refreshRowDimensions(e){e.style.height=`${this._renderService.dimensions.css.cell.height}px`}_alignRowWidth(e){e.style.transform="";let t=e.getBoundingClientRect().width,i=this._rowColumns.get(e)?.slice(-1)?.[0];if(!i)return;let r=i*this._renderService.dimensions.css.cell.width;e.style.transform=`scaleX(${r/t})`}};Ru=It([Me(1,Qp),Me(2,fs),Me(3,ms)],Ru);var _p=class extends it{constructor(e,t,i,r,a){super(),this._element=e,this._mouseService=t,this._renderService=i,this._bufferService=r,this._linkProviderService=a,this._linkCacheDisposables=[],this._isMouseOut=!0,this._wasResized=!1,this._activeLine=-1,this._onShowLinkUnderline=this._register(new Ce),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this._register(new Ce),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this._register(At(()=>{Rr(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($e(this._element,"mouseleave",()=>{this._isMouseOut=!0,this._clearCurrentLink()})),this._register($e(this._element,"mousemove",this._handleMouseMove.bind(this))),this._register($e(this._element,"mousedown",this._handleMouseDown.bind(this))),this._register($e(this._element,"mouseup",this._handleMouseUp.bind(this)))}get currentLink(){return this._currentLink}_handleMouseMove(e){this._lastMouseEvent=e;let t=this._positionFromMouseEvent(e,this._element,this._mouseService);if(!t)return;this._isMouseOut=!1;let i=e.composedPath();for(let r=0;r<i.length;r++){let a=i[r];if(a.classList.contains("xterm"))break;if(a.classList.contains("xterm-hover"))return}(!this._lastBufferCell||t.x!==this._lastBufferCell.x||t.y!==this._lastBufferCell.y)&&(this._handleHover(t),this._lastBufferCell=t)}_handleHover(e){if(this._activeLine!==e.y||this._wasResized){this._clearCurrentLink(),this._askForLink(e,!1),this._wasResized=!1;return}this._currentLink&&this._linkAtPosition(this._currentLink.link,e)||(this._clearCurrentLink(),this._askForLink(e,!0))}_askForLink(e,t){(!this._activeProviderReplies||!t)&&(this._activeProviderReplies?.forEach(r=>{r?.forEach(a=>{a.link.dispose&&a.link.dispose()})}),this._activeProviderReplies=new Map,this._activeLine=e.y);let i=!1;for(let[r,a]of this._linkProviderService.linkProviders.entries())t?this._activeProviderReplies?.get(r)&&(i=this._checkLinkProviderResult(r,e,i)):a.provideLinks(e.y,c=>{if(this._isMouseOut)return;let h=c?.map(f=>({link:f}));this._activeProviderReplies?.set(r,h),i=this._checkLinkProviderResult(r,e,i),this._activeProviderReplies?.size===this._linkProviderService.linkProviders.length&&this._removeIntersectingLinks(e.y,this._activeProviderReplies)})}_removeIntersectingLinks(e,t){let i=new Set;for(let r=0;r<t.size;r++){let a=t.get(r);if(a)for(let c=0;c<a.length;c++){let h=a[c],f=h.link.range.start.y<e?0:h.link.range.start.x,g=h.link.range.end.y>e?this._bufferService.cols:h.link.range.end.x;for(let m=f;m<=g;m++){if(i.has(m)){a.splice(c--,1);break}i.add(m)}}}}_checkLinkProviderResult(e,t,i){if(!this._activeProviderReplies)return i;let r=this._activeProviderReplies.get(e),a=!1;for(let c=0;c<e;c++)(!this._activeProviderReplies.has(c)||this._activeProviderReplies.get(c))&&(a=!0);if(!a&&r){let c=r.find(h=>this._linkAtPosition(h.link,t));c&&(i=!0,this._handleNewLink(c))}if(this._activeProviderReplies.size===this._linkProviderService.linkProviders.length&&!i)for(let c=0;c<this._activeProviderReplies.size;c++){let h=this._activeProviderReplies.get(c)?.find(f=>this._linkAtPosition(f.link,t));if(h){i=!0,this._handleNewLink(h);break}}return i}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(e){if(!this._currentLink)return;let t=this._positionFromMouseEvent(e,this._element,this._mouseService);t&&this._mouseDownLink&&TB(this._mouseDownLink.link,this._currentLink.link)&&this._linkAtPosition(this._currentLink.link,t)&&this._currentLink.link.activate(e,this._currentLink.link.text)}_clearCurrentLink(e,t){!this._currentLink||!this._lastMouseEvent||(!e||!t||this._currentLink.link.range.start.y>=e&&this._currentLink.link.range.end.y<=t)&&(this._linkLeave(this._element,this._currentLink.link,this._lastMouseEvent),this._currentLink=void 0,Rr(this._linkCacheDisposables),this._linkCacheDisposables.length=0)}_handleNewLink(e){if(!this._lastMouseEvent)return;let t=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);t&&this._linkAtPosition(e.link,t)&&(this._currentLink=e,this._currentLink.state={decorations:{underline:e.link.decorations===void 0?!0:e.link.decorations.underline,pointerCursor:e.link.decorations===void 0?!0:e.link.decorations.pointerCursor},isHovered:!0},this._linkHover(this._element,e.link,this._lastMouseEvent),e.link.decorations={},Object.defineProperties(e.link.decorations,{pointerCursor:{get:()=>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(e.link,i))}}}),this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange(i=>{if(!this._currentLink)return;let r=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>=r&&this._currentLink.link.range.end.y<=a&&(this._clearCurrentLink(r,a),this._lastMouseEvent)){let c=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);c&&this._askForLink(c,!1)}})))}_linkHover(e,t,i){this._currentLink?.state&&(this._currentLink.state.isHovered=!0,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(t,!0),this._currentLink.state.decorations.pointerCursor&&e.classList.add("xterm-cursor-pointer")),t.hover&&t.hover(i,t.text)}_fireUnderlineEvent(e,t){let i=e.range,r=this._bufferService.buffer.ydisp,a=this._createLinkUnderlineEvent(i.start.x-1,i.start.y-r-1,i.end.x,i.end.y-r-1,void 0);(t?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(a)}_linkLeave(e,t,i){this._currentLink?.state&&(this._currentLink.state.isHovered=!1,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(t,!1),this._currentLink.state.decorations.pointerCursor&&e.classList.remove("xterm-cursor-pointer")),t.leave&&t.leave(i,t.text)}_linkAtPosition(e,t){let i=e.range.start.y*this._bufferService.cols+e.range.start.x,r=e.range.end.y*this._bufferService.cols+e.range.end.x,a=t.y*this._bufferService.cols+t.x;return i<=a&&a<=r}_positionFromMouseEvent(e,t,i){let r=i.getCoords(e,t,this._bufferService.cols,this._bufferService.rows);if(r)return{x:r[0],y:r[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(e,t,i,r,a){return{x1:e,y1:t,x2:i,y2:r,cols:this._bufferService.cols,fg:a}}};_p=It([Me(1,Zp),Me(2,ms),Me(3,Rn),Me(4,sw)],_p);function TB(e,t){return e.text===t.text&&e.range.start.x===t.range.start.x&&e.range.start.y===t.range.start.y&&e.range.end.x===t.range.end.x&&e.range.end.y===t.range.end.y}var DB=class extends bB{constructor(e={}){super(e),this._linkifier=this._register(new Pl),this.browser=ww,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this._register(new Pl),this._onCursorMove=this._register(new Ce),this.onCursorMove=this._onCursorMove.event,this._onKey=this._register(new Ce),this.onKey=this._onKey.event,this._onRender=this._register(new Ce),this.onRender=this._onRender.event,this._onSelectionChange=this._register(new Ce),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this._register(new Ce),this.onTitleChange=this._onTitleChange.event,this._onBell=this._register(new Ce),this.onBell=this._onBell.event,this._onFocus=this._register(new Ce),this._onBlur=this._register(new Ce),this._onA11yCharEmitter=this._register(new Ce),this._onA11yTabEmitter=this._register(new Ce),this._onWillOpen=this._register(new Ce),this._setup(),this._decorationService=this._instantiationService.createInstance(kB),this._instantiationService.setService(So,this._decorationService),this._linkProviderService=this._instantiationService.createInstance(yO),this._instantiationService.setService(sw,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(Hm)),this._register(this._inputHandler.onRequestBell(()=>this._onBell.fire())),this._register(this._inputHandler.onRequestRefreshRows(t=>this.refresh(t?.start??0,t?.end??this.rows-1))),this._register(this._inputHandler.onRequestSendFocus(()=>this._reportFocus())),this._register(this._inputHandler.onRequestReset(()=>this.reset())),this._register(this._inputHandler.onRequestWindowsOptionsReport(t=>this._reportWindowsOptions(t))),this._register(this._inputHandler.onColor(t=>this._handleColorEvent(t))),this._register(bn.forward(this._inputHandler.onCursorMove,this._onCursorMove)),this._register(bn.forward(this._inputHandler.onTitleChange,this._onTitleChange)),this._register(bn.forward(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this._register(bn.forward(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this._register(this._bufferService.onResize(t=>this._afterResize(t.cols,t.rows))),this._register(At(()=>{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 t of e){let i,r="";switch(t.index){case 256:i="foreground",r="10";break;case 257:i="background",r="11";break;case 258:i="cursor",r="12";break;default:i="ansi",r="4;"+t.index}switch(t.type){case 0:let a=Dt.toColorRGB(i==="ansi"?this._themeService.colors.ansi[t.index]:this._themeService.colors[i]);this.coreService.triggerDataEvent(`${fe.ESC}]${r};${pB(a)}${bw.ST}`);break;case 1:if(i==="ansi")this._themeService.modifyColors(c=>c.ansi[t.index]=Gt.toColor(...t.color));else{let c=i;this._themeService.modifyColors(h=>h[c]=Gt.toColor(...t.color))}break;case 2:this._themeService.restoreColor(t.index);break}}}_setup(){super._setup(),this._customKeyEventHandler=void 0}get buffer(){return this.buffers.active}focus(){this.textarea&&this.textarea.focus({preventScroll:!0})}_handleScreenReaderModeOptionChange(e){e?!this._accessibilityManager.value&&this._renderService&&(this._accessibilityManager.value=this._instantiationService.createInstance(Ru,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(e){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(fe.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(fe.ESC+"[O"),this.element.classList.remove("focus"),this._onBlur.fire()}_syncTextArea(){if(!this.textarea||!this.buffer.isCursorInViewport||this._compositionHelper.isComposing||!this._renderService)return;let e=this.buffer.ybase+this.buffer.y,t=this.buffer.lines.get(e);if(!t)return;let i=Math.min(this.buffer.x,this.cols-1),r=this._renderService.dimensions.css.cell.height,a=t.getWidth(i),c=this._renderService.dimensions.css.cell.width*a,h=this.buffer.y*this._renderService.dimensions.css.cell.height,f=i*this._renderService.dimensions.css.cell.width;this.textarea.style.left=f+"px",this.textarea.style.top=h+"px",this.textarea.style.width=c+"px",this.textarea.style.height=r+"px",this.textarea.style.lineHeight=r+"px",this.textarea.style.zIndex="-5"}_initGlobal(){this._bindKeys(),this._register($e(this.element,"copy",t=>{this.hasSelection()&&O4(t,this._selectionService)}));let e=t=>B4(t,this.textarea,this.coreService,this.optionsService);this._register($e(this.textarea,"paste",e)),this._register($e(this.element,"paste",e)),Cw?this._register($e(this.element,"mousedown",t=>{t.button===2&&nb(t,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})):this._register($e(this.element,"contextmenu",t=>{nb(t,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})),lg&&this._register($e(this.element,"auxclick",t=>{t.button===1&&X1(t,this.textarea,this.screenElement)}))}_bindKeys(){this._register($e(this.textarea,"keyup",e=>this._keyUp(e),!0)),this._register($e(this.textarea,"keydown",e=>this._keyDown(e),!0)),this._register($e(this.textarea,"keypress",e=>this._keyPress(e),!0)),this._register($e(this.textarea,"compositionstart",()=>this._compositionHelper.compositionstart())),this._register($e(this.textarea,"compositionupdate",e=>this._compositionHelper.compositionupdate(e))),this._register($e(this.textarea,"compositionend",()=>this._compositionHelper.compositionend())),this._register($e(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 t=this._document.createDocumentFragment();this._viewportElement=this._document.createElement("div"),this._viewportElement.classList.add("xterm-viewport"),t.appendChild(this._viewportElement),this.screenElement=this._document.createElement("div"),this.screenElement.classList.add("xterm-screen"),this._register($e(this.screenElement,"mousemove",a=>this.updateCursorStyle(a))),this._helperContainer=this._document.createElement("div"),this._helperContainer.classList.add("xterm-helpers"),this.screenElement.appendChild(this._helperContainer),t.appendChild(this.screenElement);let i=this.textarea=this._document.createElement("textarea");this.textarea.classList.add("xterm-helper-textarea"),this.textarea.setAttribute("aria-label",Bm.get()),Ew||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",()=>i.readOnly=this.optionsService.rawOptions.disableStdin)),this.textarea.readOnly=this.optionsService.rawOptions.disableStdin,this._coreBrowserService=this._register(this._instantiationService.createInstance(_O,this.textarea,e.ownerDocument.defaultView??window,this._document??typeof window<"u"?window.document:null)),this._instantiationService.setService(fs,this._coreBrowserService),this._register($e(this.textarea,"focus",a=>this._handleTextAreaFocus(a))),this._register($e(this.textarea,"blur",()=>this._handleTextAreaBlur())),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(rp,this._document,this._helperContainer),this._instantiationService.setService(Fu,this._charSizeService),this._themeService=this._instantiationService.createInstance(cp),this._instantiationService.setService($l,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(Du),this._instantiationService.setService(iw,this._characterJoinerService),this._renderService=this._register(this._instantiationService.createInstance(ap,this.rows,this.screenElement)),this._instantiationService.setService(ms,this._renderService),this._register(this._renderService.onRenderedViewportChange(a=>this._onRender.fire(a))),this.onResize(a=>this._renderService.resize(a.cols,a.rows)),this._compositionView=this._document.createElement("div"),this._compositionView.classList.add("composition-view"),this._compositionHelper=this._instantiationService.createInstance(np,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseService=this._instantiationService.createInstance(lp),this._instantiationService.setService(Zp,this._mouseService);let r=this._linkifier.value=this._register(this._instantiationService.createInstance(_p,this.screenElement));this.element.appendChild(t);try{this._onWillOpen.fire(this.element)}catch{}this._renderService.hasRenderer()||this._renderService.setRenderer(this._createRenderer()),this._register(this.onCursorMove(()=>{this._renderService.handleCursorMove(),this._syncTextArea()})),this._register(this.onResize(()=>this._renderService.handleResize(this.cols,this.rows))),this._register(this.onBlur(()=>this._renderService.handleBlur())),this._register(this.onFocus(()=>this._renderService.handleFocus())),this._viewport=this._register(this._instantiationService.createInstance(ep,this.element,this.screenElement)),this._register(this._viewport.onRequestScrollLines(a=>{super.scrollLines(a,!1),this.refresh(0,this.rows-1)})),this._selectionService=this._register(this._instantiationService.createInstance(op,this.element,this.screenElement,r)),this._instantiationService.setService(F4,this._selectionService),this._register(this._selectionService.onRequestScrollLines(a=>this.scrollLines(a.amount,a.suppressScrollEvent))),this._register(this._selectionService.onSelectionChange(()=>this._onSelectionChange.fire())),this._register(this._selectionService.onRequestRedraw(a=>this._renderService.handleSelectionChanged(a.start,a.end,a.columnSelectMode))),this._register(this._selectionService.onLinuxMouseSelection(a=>{this.textarea.value=a,this.textarea.focus(),this.textarea.select()})),this._register(bn.any(this._onScroll.event,this._inputHandler.onScroll)(()=>{this._selectionService.refresh(),this._viewport?.queueSync()})),this._register(this._instantiationService.createInstance(tp,this.screenElement)),this._register($e(this.element,"mousedown",a=>this._selectionService.handleMouseDown(a))),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(Ru,this)),this._register(this.optionsService.onSpecificOptionChange("screenReaderMode",a=>this._handleScreenReaderModeOptionChange(a))),this.options.overviewRuler.width&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(Tu,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange("overviewRuler",a=>{!this._overviewRulerRenderer&&a&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(Tu,this._viewportElement,this.screenElement)))}),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()}_createRenderer(){return this._instantiationService.createInstance(sp,this,this._document,this.element,this.screenElement,this._viewportElement,this._helperContainer,this.linkifier)}bindMouse(){let e=this,t=this.element;function i(c){let h=e._mouseService.getMouseReportCoords(c,e.screenElement);if(!h)return!1;let f,g;switch(c.overrideType||c.type){case"mousemove":g=32,c.buttons===void 0?(f=3,c.button!==void 0&&(f=c.button<3?c.button:3)):f=c.buttons&1?0:c.buttons&4?1:c.buttons&2?2:3;break;case"mouseup":g=0,f=c.button<3?c.button:3;break;case"mousedown":g=1,f=c.button<3?c.button:3;break;case"wheel":if(e._customWheelEventHandler&&e._customWheelEventHandler(c)===!1)return!1;let m=c.deltaY;if(m===0||e.coreMouseService.consumeWheelEvent(c,e._renderService?.dimensions?.device?.cell?.height,e._coreBrowserService?.dpr)===0)return!1;g=m<0?0:1,f=4;break;default:return!1}return g===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:g,ctrl:c.ctrlKey,alt:c.altKey,shift:c.shiftKey})}let r={mouseup:null,wheel:null,mousedrag:null,mousemove:null},a={mouseup:c=>(i(c),c.buttons||(this._document.removeEventListener("mouseup",r.mouseup),r.mousedrag&&this._document.removeEventListener("mousemove",r.mousedrag)),this.cancel(c)),wheel:c=>(i(c),this.cancel(c,!0)),mousedrag:c=>{c.buttons&&i(c)},mousemove:c=>{c.buttons||i(c)}};this._register(this.coreMouseService.onProtocolChange(c=>{c?(this.optionsService.rawOptions.logLevel==="debug"&&this._logService.debug("Binding to mouse events:",this.coreMouseService.explainEvents(c)),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()),c&8?r.mousemove||(t.addEventListener("mousemove",a.mousemove),r.mousemove=a.mousemove):(t.removeEventListener("mousemove",r.mousemove),r.mousemove=null),c&16?r.wheel||(t.addEventListener("wheel",a.wheel,{passive:!1}),r.wheel=a.wheel):(t.removeEventListener("wheel",r.wheel),r.wheel=null),c&2?r.mouseup||(r.mouseup=a.mouseup):(this._document.removeEventListener("mouseup",r.mouseup),r.mouseup=null),c&4?r.mousedrag||(r.mousedrag=a.mousedrag):(this._document.removeEventListener("mousemove",r.mousedrag),r.mousedrag=null)})),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this._register($e(t,"mousedown",c=>{if(c.preventDefault(),this.focus(),!(!this.coreMouseService.areMouseEventsActive||this._selectionService.shouldForceSelection(c)))return i(c),r.mouseup&&this._document.addEventListener("mouseup",r.mouseup),r.mousedrag&&this._document.addEventListener("mousemove",r.mousedrag),this.cancel(c)})),this._register($e(t,"wheel",c=>{if(!r.wheel){if(this._customWheelEventHandler&&this._customWheelEventHandler(c)===!1)return!1;if(!this.buffer.hasScrollback){if(c.deltaY===0)return!1;if(e.coreMouseService.consumeWheelEvent(c,e._renderService?.dimensions?.device?.cell?.height,e._coreBrowserService?.dpr)===0)return this.cancel(c,!0);let h=fe.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?"O":"[")+(c.deltaY<0?"A":"B");return this.coreService.triggerDataEvent(h,!0),this.cancel(c,!0)}}},{passive:!1}))}refresh(e,t){this._renderService?.refreshRows(e,t)}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,t){this._viewport?this._viewport.scrollLines(e):super.scrollLines(e,t),this.refresh(0,this.rows-1)}scrollPages(e){this.scrollLines(e*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(e){e&&this._viewport?this._viewport.scrollToLine(this.buffer.ybase,!0):this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(e){let t=e-this._bufferService.buffer.ydisp;t!==0&&this.scrollLines(t)}paste(e){W1(e,this.textarea,this.coreService,this.optionsService)}attachCustomKeyEventHandler(e){this._customKeyEventHandler=e}attachCustomWheelEventHandler(e){this._customWheelEventHandler=e}registerLinkProvider(e){return this._linkProviderService.registerLinkProvider(e)}registerCharacterJoiner(e){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");let t=this._characterJoinerService.register(e);return this.refresh(0,this.rows-1),t}deregisterCharacterJoiner(e){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");this._characterJoinerService.deregister(e)&&this.refresh(0,this.rows-1)}get markers(){return this.buffer.markers}registerMarker(e){return this.buffer.addMarker(this.buffer.ybase+this.buffer.y+e)}registerDecoration(e){return this._decorationService.registerDecoration(e)}hasSelection(){return this._selectionService?this._selectionService.hasSelection:!1}select(e,t,i){this._selectionService.setSelection(e,t,i)}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,t){this._selectionService?.selectLines(e,t)}_keyDown(e){if(this._keyDownHandled=!1,this._keyDownSeen=!0,this._customKeyEventHandler&&this._customKeyEventHandler(e)===!1)return!1;let t=this.browser.isMac&&this.options.macOptionIsMeta&&e.altKey;if(!t&&!this._compositionHelper.keydown(e))return this.options.scrollOnUserInput&&this.buffer.ybase!==this.buffer.ydisp&&this.scrollToBottom(!0),!1;!t&&(e.key==="Dead"||e.key==="AltGraph")&&(this._unprocessedDeadKey=!0);let i=wB(e,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(e),i.type===3||i.type===2){let r=this.rows-1;return this.scrollLines(i.type===2?-r:r),this.cancel(e,!0)}if(i.type===1&&this.selectAll(),this._isThirdLevelShift(this.browser,e)||(i.cancel&&this.cancel(e,!0),!i.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((i.key===fe.ETX||i.key===fe.CR)&&(this.textarea.value=""),this._onKey.fire({key:i.key,domEvent:e}),this._showCursor(),this.coreService.triggerDataEvent(i.key,!0),!this.optionsService.rawOptions.screenReaderMode||e.altKey||e.ctrlKey)return this.cancel(e,!0);this._keyDownHandled=!0}_isThirdLevelShift(e,t){let i=e.isMac&&!this.options.macOptionIsMeta&&t.altKey&&!t.ctrlKey&&!t.metaKey||e.isWindows&&t.altKey&&t.ctrlKey&&!t.metaKey||e.isWindows&&t.getModifierState("AltGraph");return t.type==="keypress"?i:i&&(!t.keyCode||t.keyCode>47)}_keyUp(e){this._keyDownSeen=!1,!(this._customKeyEventHandler&&this._customKeyEventHandler(e)===!1)&&(MB(e)||this.focus(),this.updateCursorStyle(e),this._keyPressHandled=!1)}_keyPress(e){let t;if(this._keyPressHandled=!1,this._keyDownHandled||this._customKeyEventHandler&&this._customKeyEventHandler(e)===!1)return!1;if(this.cancel(e),e.charCode)t=e.charCode;else if(e.which===null||e.which===void 0)t=e.keyCode;else if(e.which!==0&&e.charCode!==0)t=e.which;else return!1;return!t||(e.altKey||e.ctrlKey||e.metaKey)&&!this._isThirdLevelShift(this.browser,e)?!1:(t=String.fromCharCode(t),this._onKey.fire({key:t,domEvent:e}),this._showCursor(),this.coreService.triggerDataEvent(t,!0),this._keyPressHandled=!0,this._unprocessedDeadKey=!1,!0)}_inputEvent(e){if(e.data&&e.inputType==="insertText"&&(!e.composed||!this._keyDownSeen)&&!this.optionsService.rawOptions.screenReaderMode){if(this._keyPressHandled)return!1;this._unprocessedDeadKey=!1;let t=e.data;return this.coreService.triggerDataEvent(t,!0),this.cancel(e),!0}return!1}resize(e,t){if(e===this.cols&&t===this.rows){this._charSizeService&&!this._charSizeService.hasValidSize&&this._charSizeService.measure();return}super.resize(e,t)}_afterResize(e,t){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(Xt));this._onScroll.fire({position:this.buffer.ydisp}),this.refresh(0,this.rows-1)}}reset(){this.options.rows=this.rows,this.options.cols=this.cols;let 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(fe.ESC+"[I"):this.coreService.triggerDataEvent(fe.ESC+"[O")}_reportWindowsOptions(e){if(this._renderService)switch(e){case 0:let t=this._renderService.dimensions.css.canvas.width.toFixed(0),i=this._renderService.dimensions.css.canvas.height.toFixed(0);this.coreService.triggerDataEvent(`${fe.ESC}[4;${i};${t}t`);break;case 1:let r=this._renderService.dimensions.css.cell.width.toFixed(0),a=this._renderService.dimensions.css.cell.height.toFixed(0);this.coreService.triggerDataEvent(`${fe.ESC}[6;${a};${r}t`);break}}cancel(e,t){if(!(!this.options.cancelEvents&&!t))return e.preventDefault(),e.stopPropagation(),!1}};function MB(e){return e.keyCode===16||e.keyCode===17||e.keyCode===18}var AB=class{constructor(){this._addons=[]}dispose(){for(let e=this._addons.length-1;e>=0;e--)this._addons[e].instance.dispose()}loadAddon(e,t){let i={instance:t,dispose:t.dispose,isDisposed:!1};this._addons.push(i),t.dispose=()=>this._wrappedAddonDispose(i),t.activate(e)}_wrappedAddonDispose(e){if(e.isDisposed)return;let t=-1;for(let i=0;i<this._addons.length;i++)if(this._addons[i]===e){t=i;break}if(t===-1)throw new Error("Could not dispose an addon that has not been loaded");e.isDisposed=!0,e.dispose.apply(e.instance),this._addons.splice(t,1)}},RB=class{constructor(e){this._line=e}get isWrapped(){return this._line.isWrapped}get length(){return this._line.length}getCell(e,t){if(!(e<0||e>=this._line.length))return t?(this._line.loadCell(e,t),t):this._line.loadCell(e,new gi)}translateToString(e,t,i){return this._line.translateToString(e,t,i)}},Yb=class{constructor(e,t){this._buffer=e,this.type=t}init(e){return this._buffer=e,this}get cursorY(){return this._buffer.y}get cursorX(){return this._buffer.x}get viewportY(){return this._buffer.ydisp}get baseY(){return this._buffer.ybase}get length(){return this._buffer.lines.length}getLine(e){let t=this._buffer.lines.get(e);if(t)return new RB(t)}getNullCell(){return new gi}},OB=class extends it{constructor(e){super(),this._core=e,this._onBufferChange=this._register(new Ce),this.onBufferChange=this._onBufferChange.event,this._normal=new Yb(this._core.buffers.normal,"normal"),this._alternate=new Yb(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)}},BB=class{constructor(e){this._core=e}registerCsiHandler(e,t){return this._core.registerCsiHandler(e,i=>t(i.toArray()))}addCsiHandler(e,t){return this.registerCsiHandler(e,t)}registerDcsHandler(e,t){return this._core.registerDcsHandler(e,(i,r)=>t(i,r.toArray()))}addDcsHandler(e,t){return this.registerDcsHandler(e,t)}registerEscHandler(e,t){return this._core.registerEscHandler(e,t)}addEscHandler(e,t){return this.registerEscHandler(e,t)}registerOscHandler(e,t){return this._core.registerOscHandler(e,t)}addOscHandler(e,t){return this.registerOscHandler(e,t)}},LB=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}},zB=["cols","rows"],Ii=0,HB=class extends it{constructor(e){super(),this._core=this._register(new DB(e)),this._addonManager=this._register(new AB),this._publicOptions={...this._core.options};let t=r=>this._core.options[r],i=(r,a)=>{this._checkReadonlyOptions(r),this._core.options[r]=a};for(let r in this._core.options){let a={get:t.bind(this,r),set:i.bind(this,r)};Object.defineProperty(this._publicOptions,r,a)}}_checkReadonlyOptions(e){if(zB.includes(e))throw new Error(`Option "${e}" can only be set in the constructor`)}_checkProposedApi(){if(!this._core.optionsService.rawOptions.allowProposedApi)throw new Error("You must set the allowProposedApi option to true to use proposed API")}get onBell(){return this._core.onBell}get onBinary(){return this._core.onBinary}get onCursorMove(){return this._core.onCursorMove}get onData(){return this._core.onData}get onKey(){return this._core.onKey}get onLineFeed(){return this._core.onLineFeed}get onRender(){return this._core.onRender}get onResize(){return this._core.onResize}get onScroll(){return this._core.onScroll}get onSelectionChange(){return this._core.onSelectionChange}get onTitleChange(){return this._core.onTitleChange}get onWriteParsed(){return this._core.onWriteParsed}get element(){return this._core.element}get parser(){return this._parser||(this._parser=new BB(this._core)),this._parser}get unicode(){return this._checkProposedApi(),new LB(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 OB(this._core))),this._buffer}get markers(){return this._checkProposedApi(),this._core.markers}get modes(){let e=this._core.coreService.decPrivateModes,t="none";switch(this._core.coreMouseService.activeProtocol){case"X10":t="x10";break;case"VT200":t="vt200";break;case"DRAG":t="drag";break;case"ANY":t="any";break}return{applicationCursorKeysMode:e.applicationCursorKeys,applicationKeypadMode:e.applicationKeypad,bracketedPasteMode:e.bracketedPasteMode,insertMode:this._core.coreService.modes.insertMode,mouseTrackingMode:t,originMode:e.origin,reverseWraparoundMode:e.reverseWraparound,sendFocusMode:e.sendFocus,synchronizedOutputMode:e.synchronizedOutput,wraparoundMode:e.wraparound}}get options(){return this._publicOptions}set options(e){for(let t in e)this._publicOptions[t]=e[t]}blur(){this._core.blur()}focus(){this._core.focus()}input(e,t=!0){this._core.input(e,t)}resize(e,t){this._verifyIntegers(e,t),this._core.resize(e,t)}open(e){this._core.open(e)}attachCustomKeyEventHandler(e){this._core.attachCustomKeyEventHandler(e)}attachCustomWheelEventHandler(e){this._core.attachCustomWheelEventHandler(e)}registerLinkProvider(e){return this._core.registerLinkProvider(e)}registerCharacterJoiner(e){return this._checkProposedApi(),this._core.registerCharacterJoiner(e)}deregisterCharacterJoiner(e){this._checkProposedApi(),this._core.deregisterCharacterJoiner(e)}registerMarker(e=0){return this._verifyIntegers(e),this._core.registerMarker(e)}registerDecoration(e){return this._checkProposedApi(),this._verifyPositiveIntegers(e.x??0,e.width??0,e.height??0),this._core.registerDecoration(e)}hasSelection(){return this._core.hasSelection()}select(e,t,i){this._verifyIntegers(e,t,i),this._core.select(e,t,i)}getSelection(){return this._core.getSelection()}getSelectionPosition(){return this._core.getSelectionPosition()}clearSelection(){this._core.clearSelection()}selectAll(){this._core.selectAll()}selectLines(e,t){this._verifyIntegers(e,t),this._core.selectLines(e,t)}dispose(){super.dispose()}scrollLines(e){this._verifyIntegers(e),this._core.scrollLines(e)}scrollPages(e){this._verifyIntegers(e),this._core.scrollPages(e)}scrollToTop(){this._core.scrollToTop()}scrollToBottom(){this._core.scrollToBottom()}scrollToLine(e){this._verifyIntegers(e),this._core.scrollToLine(e)}clear(){this._core.clear()}write(e,t){this._core.write(e,t)}writeln(e,t){this._core.write(e),this._core.write(`\r
62
+ `,t)}paste(e){this._core.paste(e)}refresh(e,t){this._verifyIntegers(e,t),this._core.refresh(e,t)}reset(){this._core.reset()}clearTextureAtlas(){this._core.clearTextureAtlas()}loadAddon(e){this._addonManager.loadAddon(this,e)}static get strings(){return{get promptLabel(){return Bm.get()},set promptLabel(e){Bm.set(e)},get tooMuchOutput(){return Lm.get()},set tooMuchOutput(e){Lm.set(e)}}}_verifyIntegers(...e){for(Ii of e)if(Ii===1/0||isNaN(Ii)||Ii%1!==0)throw new Error("This API only accepts integers")}_verifyPositiveIntegers(...e){for(Ii of e)if(Ii&&(Ii===1/0||isNaN(Ii)||Ii%1!==0||Ii<0))throw new Error("This API only accepts positive integers")}};const IB=12,UB=250,PB={background:"#ffffff",foreground:"#1f2328",cursor:"#1f2328",selectionBackground:"#dbe4ff",black:"#24292f",red:"#cf222e",green:"#116329",yellow:"#9a6700",blue:"#0969da",magenta:"#8250df",cyan:"#1b7c83",white:"#6e7781",brightBlack:"#57606a",brightRed:"#a40e26",brightGreen:"#1a7f37",brightYellow:"#bf8700",brightBlue:"#218bff",brightMagenta:"#a475f9",brightCyan:"#3192aa",brightWhite:"#8c959f"},qB={background:"#16181d",foreground:"#e6e8eb",cursor:"#e6e8eb",selectionBackground:"#33406b",black:"#252a31",red:"#f47174",green:"#6cc98a",yellow:"#e5c07b",blue:"#7aa2f7",magenta:"#bb9af7",cyan:"#7dcfff",white:"#cfd3da",brightBlack:"#6b7280",brightRed:"#ff8b8e",brightGreen:"#93e3ab",brightYellow:"#f2d38a",brightBlue:"#9ab8ff",brightMagenta:"#d0b4ff",brightCyan:"#a4e2ff",brightWhite:"#ffffff"},Wb=()=>document.documentElement.dataset.theme==="dark"?qB:PB;function cm({id:e,active:t,onStatus:i,onProblem:r}){const a=C.useRef(null),c=C.useRef(null),h=C.useRef(null),f=C.useRef(i),g=C.useRef(r);return f.current=i,g.current=r,C.useLayoutEffect(()=>{const m=a.current;if(m===null)return;const v=new HB({fontFamily:"ui-monospace, SFMono-Regular, Menlo, monospace",fontSize:12,lineHeight:1.35,cursorBlink:!0,scrollback:5e3,theme:Wb()}),_=new T4;v.loadAddon(_),v.open(m),c.current=v,h.current=_;let S="",y=null,x=null;const w=()=>{if(y=null,S==="")return;const I=S;S="",dx(e,I).catch(H=>{g.current?.(H instanceof Error?H.message:String(H))})},j=v.onData(I=>{S+=I,y===null&&(y=setTimeout(w,IB))}),N=()=>{x!==null&&clearTimeout(x),x=setTimeout(()=>{v.cols<=0||v.rows<=0||I0(e,v.cols,v.rows).catch(()=>{})},UB)},M=new EventSource(h2(e));M.onmessage=I=>{let H;try{H=JSON.parse(I.data)}catch{return}if(H.kind==="snapshot"){v.reset(),v.write(H.text),f.current(H.status),g.current?.(null);return}if(H.kind==="chunk"){v.write(H.text);return}f.current(H.status)},M.onerror=()=>{g.current?.("终端流断开,正在重连…")};const A=new ResizeObserver(()=>{if(!(m.offsetWidth===0||m.offsetHeight===0))try{_.fit(),N()}catch{}});A.observe(m);const R=new MutationObserver(()=>{v.options.theme=Wb()});return R.observe(document.documentElement,{attributes:!0,attributeFilter:["data-theme"]}),_.fit(),N(),()=>{j.dispose(),M.close(),A.disconnect(),R.disconnect(),y!==null&&clearTimeout(y),x!==null&&clearTimeout(x),v.dispose(),c.current=null,h.current=null}},[e]),C.useEffect(()=>{if(!t)return;const m=c.current;if(m===null)return;const v=setTimeout(()=>{try{h.current?.fit(),m.focus(),I0(e,m.cols,m.rows)}catch{}},0);return()=>{clearTimeout(v)}},[t]),u.jsx("div",{className:t?"term-host active":"term-host",ref:a})}function FB({onStats:e,createSignal:t}){const[i,r]=C.useState([]),[a,c]=C.useState(null),[h,f]=C.useState(null),[g,m]=C.useState(()=>c4()),[v,_]=C.useState(()=>o4()),[S,y]=C.useState(null),x=C.useRef(null),w=C.useRef(null),[j,N]=C.useState(!1),M=C.useRef(t),A=C.useCallback(async()=>{try{const L=await o2();r(L.terminals),c(F=>F!==null&&L.terminals.some(K=>K.id===F)?F:L.terminals[0]?.id??null),y(null)}catch(L){y(L instanceof Error?L.message:String(L))}},[]);C.useEffect(()=>{A();const L=setInterval(()=>{A()},5e3);return()=>{clearInterval(L)}},[A]),C.useEffect(()=>{e?.({running:i.filter(L=>L.status.kind==="running").length,total:i.length})},[i,e]),C.useEffect(()=>{g&&f(L=>L!==null&&L!==a&&i.some(K=>K.id===L)?L:(i.find(K=>K.id!==a&&K.status.kind==="running")??i.find(K=>K.id!==a))?.id??null)},[g,a,i]);const R=C.useCallback(async()=>{if(j)return null;N(!0);try{const L=await c2();return await A(),c(L.id),y(null),L.id}catch(L){return y(L instanceof Error?L.message:String(L)),null}finally{N(!1)}},[j,A]);C.useEffect(()=>{t!==M.current&&(M.current=t,R())},[t,R]);const I=async L=>{try{await u2(L),r(F=>F.filter(K=>K.id!==L)),c(F=>F===L?null:F),f(F=>F===L?null:F),await A()}catch(F){y(F instanceof Error?F.message:String(F))}},H=(L,F)=>{r(K=>K.map(q=>q.id===L?{...q,status:F}:q))},O=L=>{dx(L,"\f").catch(F=>{y(F instanceof Error?F.message:String(F))})},$=async L=>{if(!L){m(Wf(void 0,!1));return}let F=i.find(K=>K.id!==a&&K.status.kind==="running")?.id??i.find(K=>K.id!==a)?.id??null;F===null&&(F=await R()),F!==null&&(f(F),m(Wf(void 0,!0)))},Q=L=>{const F=i.find(K=>K.id===L);return F===void 0?null:F.status.kind==="running"?u.jsx("span",{className:"live-dot"}):u.jsx("span",{className:"exited",children:XS(F.status)})},z=L=>{if(L.button!==0)return;const F=x.current?.clientHeight??0;F<=0||(L.currentTarget.setPointerCapture(L.pointerId),w.current={startY:L.clientY,startRatio:v,height:F})},G=L=>{const F=w.current;if(F===null)return;const K=Xp(F.startRatio+(L.clientY-F.startY)/F.height);_(K),Yf(void 0,K)},P=L=>{if(w.current!==null){w.current=null;try{L.currentTarget.releasePointerCapture(L.pointerId)}catch{}Yf(void 0,v)}};return i.length===0?u.jsxs("div",{className:"dock-empty",children:[u.jsx("span",{className:"big",children:"▮"}),"还没有终端",u.jsx("br",{}),"新建一个(真 PTY,工作区根目录;↑↓ 历史、Ctrl-C、vim 都能用)",u.jsx("div",{style:{marginTop:10},children:u.jsx("button",{className:"btn",disabled:j,onClick:()=>{R()},children:j?"启动中…":"新建终端"})}),S===null?null:u.jsx("div",{className:"err",children:S})]}):u.jsxs("div",{className:"term-stack",children:[u.jsxs("div",{className:"mini-tabs",children:[i.map(L=>u.jsxs("button",{className:L.id===a?"mini-tab active":"mini-tab",title:L.id,onClick:()=>{c(L.id)},children:[L.id,L.status.kind==="running"?u.jsx("span",{className:"live-dot"}):u.jsx("span",{className:"exited",children:XS(L.status)})]},L.id)),u.jsx("button",{className:"mini-tab add",title:"新建终端","aria-label":"新建终端",onClick:()=>{R()},children:"+"}),u.jsx("span",{className:"grow"}),u.jsx("button",{className:g?"ib on":"ib",title:g?"取消上下分屏":"上下分屏(再开一个 PTY)","aria-label":"上下分屏","aria-pressed":g,onClick:()=>{$(!g)},disabled:i.length===0,children:u.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",children:[u.jsx("rect",{x:"3",y:"4",width:"18",height:"16",rx:"2"}),u.jsx("path",{d:"M3 12h18"})]})}),a===null?null:u.jsxs(u.Fragment,{children:[u.jsx("button",{className:"ib",title:"清屏(Ctrl-L)",onClick:()=>{O(a)},children:"⌫"}),u.jsx("button",{className:"ib",title:"关闭这个终端",onClick:()=>{I(a)},children:"✕"})]})]}),S===null?null:u.jsx("div",{className:"tree-hint err",children:S}),g?u.jsxs("div",{className:"term-split",ref:x,children:[u.jsxs("div",{className:"tp",style:{flex:`0 0 ${String(Math.round(v*100))}%`},children:[u.jsxs("div",{className:"tp-head",children:[u.jsx("span",{children:a===null?"没有终端":`${a} · 分屏 1`}),a===null?null:Q(a),u.jsx("span",{className:"grow"}),u.jsx("span",{className:"dim",children:"上"})]}),u.jsx("div",{className:"term-hosts split",children:a===null?u.jsx("div",{className:"dock-empty small",children:"没有终端"}):u.jsx(cm,{id:a,active:!0,onStatus:L=>{H(a,L)},onProblem:L=>{y(L)}})})]}),u.jsx("span",{className:"term-splitter",title:"拖动调整上下比例(双击复位 50%)",role:"separator","aria-orientation":"horizontal","aria-label":"拖动调整终端分屏比例",onPointerDown:z,onPointerMove:G,onPointerUp:P,onPointerCancel:P,onDoubleClick:()=>{_(Yf(void 0,.5))}}),u.jsxs("div",{className:"tp",style:{flex:"1 1 0"},children:[u.jsxs("div",{className:"tp-head",children:[u.jsx("span",{children:h===null?"没有第二个终端":`${h} · 分屏 2`}),h===null?null:Q(h),u.jsx("span",{className:"grow"}),h!==null?u.jsx("button",{className:"ib",title:"关闭这块分屏(终端本身留着)",onClick:()=>{f(null),m(Wf(void 0,!1))},children:"✕"}):u.jsx("button",{className:"link-btn",disabled:j,onClick:()=>{$(!0)},children:j?"启动中…":"新建分屏"})]}),u.jsx("div",{className:"term-hosts split",children:h===null?u.jsx("div",{className:"dock-empty small",children:"点「新建分屏」再开一个 PTY"}):u.jsx(cm,{id:h,active:!0,onStatus:L=>{H(h,L)},onProblem:L=>{y(L)}})})]})]}):u.jsx("div",{className:"term-hosts",children:i.map(L=>u.jsx(cm,{id:L.id,active:L.id===a,onStatus:F=>{H(L.id,F)},onProblem:F=>{y(F)}},L.id))}),u.jsx("div",{className:"term-hint",children:"↑↓ 历史 · Ctrl-C 中断 · ⌫ 清屏(Ctrl-L) · 字节直通真 PTY(xterm.js)"})]})}const Er={start:"开始",files:"文件",term:"终端",diff:"变更",rewind:"回退"},um=[{id:"start",type:"start"},{id:"files",type:"files"},{id:"term",type:"term"},{id:"diff",type:"diff"}],zw="daluo.dock.tabs.v3",Hw="daluo.dock.active.v3";function Xb(){try{const e=JSON.parse(localStorage.getItem(zw)??"null");if(!Array.isArray(e)||e.length===0)return[...um];const t=[];for(const i of e){if(typeof i!="object"||i===null)continue;const r=i;typeof r.id=="string"&&(r.type!=="start"&&r.type!=="files"&&r.type!=="term"&&r.type!=="diff"&&r.type!=="rewind"||t.push({id:r.id,type:r.type}))}return t.length===0?[...um]:t}catch{return[...um]}}function $B(e){try{localStorage.setItem(zw,JSON.stringify(e))}catch{}}function VB(){try{return localStorage.getItem(Hw)}catch{return null}}function hm(e){try{localStorage.setItem(Hw,e)}catch{}}function Iw({tab:e}){return e==="rewind"?u.jsxs("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",children:[u.jsx("path",{d:"M3 12a9 9 0 1 0 3-6.7"}),u.jsx("path",{d:"M3 4v5h5"})]}):e==="start"?u.jsx("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",children:u.jsx("path",{d:"m12 3 2.2 6.8L21 12l-6.8 2.2L12 21l-2.2-6.8L3 12l6.8-2.2L12 3Z"})}):e==="files"?u.jsxs("svg",{className:"ico",width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",children:[u.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),u.jsx("path",{d:"M14 2v6h6"})]}):e==="term"?u.jsxs("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",children:[u.jsx("path",{d:"m4 17 6-6-6-6"}),u.jsx("path",{d:"M12 19h8"})]}):u.jsxs("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",children:[u.jsx("path",{d:"M12 3v18"}),u.jsx("path",{d:"M5 8h14"}),u.jsx("path",{d:"M5 16h14"})]})}function KB({页签s:e,onExpand:t}){const i=[...new Set(e.map(r=>r.type))];return u.jsxs("aside",{className:"dock rail","data-dsh-surface":"details",children:[i.map(r=>u.jsx("button",{className:"rbtn",title:Er[r],"aria-label":Er[r],onClick:()=>{t(r)},children:u.jsx(Iw,{tab:r})},r)),u.jsx("span",{className:"spacer"}),u.jsx("button",{className:"rbtn",title:"展开面板","aria-label":"展开面板",onClick:()=>{t(e[0]?.type??"files")},children:u.jsxs("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",children:[u.jsx("rect",{x:"3",y:"4",width:"18",height:"16",rx:"2"}),u.jsx("path",{d:"M15 4v16"})]})})]})}const YB=`${String(O1)}–${String(B1)} px · 双击复位 ${String(Xs)}`;function wr(){return typeof window>"u"?{width:1440,height:900}:{width:window.innerWidth,height:window.innerHeight}}function WB({去:e,新建终端:t,打开浏览器:i,打开轨迹:r,打开命令面板:a}){const c=[{图标:"▤",名称:"工作区文件",说明:"浏览与打开工作区里的文件",动作:()=>{e("files")}},{图标:"⑂",名称:"代码审查和变更",说明:"Diff:逐文件看真实改动",动作:()=>{e("diff")}},{图标:">_",名称:"新建终端",说明:"开一个真 PTY(工作区根目录)",动作:t},{图标:"◍",名称:"浏览器",说明:"在新标签打开当前页面",动作:i},{图标:"◫",名称:"会话数据诊断",说明:"轨迹与事件流(当前会话)",...r===void 0?{}:{动作:r}},{图标:"⊞",名称:"更多工具",说明:"命令面板(动作与会话跳转)",...a===void 0?{}:{动作:a}}];return u.jsxs("div",{className:"ds-wrap",children:[u.jsx("div",{className:"ds-hero","aria-hidden":"true",children:"✦"}),u.jsx("div",{className:"ds-list",children:c.map(h=>u.jsxs("button",{className:"ds-row",disabled:h.动作===void 0,onClick:()=>{h.动作?.()},children:[u.jsx("span",{className:"ds-ico","aria-hidden":"true",children:h.图标}),u.jsxs("span",{className:"ds-main",children:[u.jsx("span",{className:"ds-name",children:h.名称}),u.jsx("span",{className:"ds-desc",children:h.说明})]}),u.jsx("span",{className:"ds-go","aria-hidden":"true",children:"›"})]},h.名称))}),u.jsx("div",{className:"ds-note",children:"这些入口都接真动作;浏览器原生保留键(⌘P / ⌘T / ⌃`)在网页里抢不到,故不印快捷键。"})]})}function XB({collapsed:e,onToggle:t,changesSignal:i,openFileSignal:r=null,onOpenTrajectory:a,onOpenPalette:c,session:h=null,onOpenSession:f,workspaceRoot:g}){const[m,v]=C.useState(()=>Xb()),[_,S]=C.useState(()=>{const X=VB(),Se=Xb();return X!==null&&Se.some(Ge=>Ge.id===X)?X:Se[0]?.id??"files"}),[y,x]=C.useState(()=>FR()),[w,j]=C.useState(()=>l4()),[N,M]=C.useState(()=>f4()),[A,R]=C.useState(()=>r4()),[I,H]=C.useState(null),[O,$]=C.useState(null),[Q,z]=C.useState(0),[G,P]=C.useState({running:0,total:0}),[L,F]=C.useState(0),[K,q]=C.useState(!1),te=C.useRef(null),ne=C.useCallback(()=>{q(!1)},[]);Qa({打开:K,关闭:ne,容器:te});const ge=C.useRef(0),De=(m.find(X=>X.id===_)??m[0])?.type??"files",we=C.useCallback((X,Se)=>{v(X),Se!==null&&X.some(Ge=>Ge.id===Se)&&(S(Se),hm(Se)),$B(X)},[]),T=C.useCallback(X=>{const Se=m.find(pt=>pt.type===X);if(Se!==void 0){S(Se.id),hm(Se.id);return}ge.current+=1;const Ge={id:`${X}-${String(Date.now())}-${String(ge.current)}`,type:X};we([...m,Ge],Ge.id)},[m,we]),E=C.useCallback(X=>{ge.current+=1;const Se={id:`${X}-${String(Date.now())}-${String(ge.current)}`,type:X};we([...m,Se],Se.id),q(!1)},[m,we]),J=C.useCallback(X=>{const Se=m.findIndex(Qe=>Qe.id===X);if(Se<0)return;const Ge=m.filter(Qe=>Qe.id!==X);if(Ge.length===0){ve(),t();return}const pt=X===_?Ge[Math.min(Se,Ge.length-1)]?.id??null:_;we(Ge,pt)},[m,_,we,t]);C.useEffect(()=>{(r?.nonce??0)>0&&T("files")},[r,T]),C.useEffect(()=>{(i??0)>0&&T("diff")},[i]);const se=C.useRef(null),pe=C.useRef(null),ce=C.useRef(null),_e=C.useRef(y),ke=C.useRef(null),oe=C.useRef(null),ye=C.useCallback(async()=>{try{const X=await hx();H(X),$(null)}catch(X){$(X instanceof Error?X.message:String(X))}},[]);C.useEffect(()=>{ye();const X=setInterval(()=>{ye()},1e4);return()=>{clearInterval(X)}},[ye]),C.useEffect(()=>{if(!w)return;const X=()=>{R(Se=>br(void 0,Se,wr()))};return window.addEventListener("resize",X),()=>{window.removeEventListener("resize",X)}},[w]),C.useEffect(()=>()=>{ke.current!==null&&clearTimeout(ke.current),oe.current!==null&&clearTimeout(oe.current)},[]);const Ne=C.useMemo(()=>{const X=new Map;for(const Se of I?.changed??[])X.set(Se.path,H1(Se));return X},[I]),ct=X=>{X.button===0&&(X.currentTarget.setPointerCapture(X.pointerId),se.current={startX:X.clientX,startW:y},document.body.classList.add("dock-resizing"))},ht=()=>{ke.current!==null&&clearTimeout(ke.current),ke.current=setTimeout(()=>{ke.current=null,Kf(void 0,_e.current)},300)},Je=X=>{if(se.current===null)return;const Se=Yp(se.current.startW+(se.current.startX-X.clientX));_e.current=Se,x(Se),ht()},Ke=X=>{if(se.current!==null){se.current=null,document.body.classList.remove("dock-resizing");try{X.currentTarget.releasePointerCapture(X.pointerId)}catch{}ke.current!==null&&clearTimeout(ke.current),ke.current=null,Kf(void 0,_e.current)}},qe=()=>{_e.current=Xs,x(Kf(void 0,Xs))},le=X=>{R(X),oe.current!==null&&clearTimeout(oe.current),oe.current=setTimeout(()=>{oe.current=null,br(void 0,X,wr())},300)},me=X=>{X.button!==0||N||X.target.closest("button")===null&&(X.currentTarget.setPointerCapture(X.pointerId),pe.current={dx:X.clientX-A.x,dy:X.clientY-A.y})},Te=X=>{pe.current!==null&&le({...A,x:X.clientX-pe.current.dx,y:X.clientY-pe.current.dy})},He=X=>{if(pe.current!==null){pe.current=null;try{X.currentTarget.releasePointerCapture(X.pointerId)}catch{}br(void 0,A,wr())}},Ee=X=>{X.button!==0||N||(X.currentTarget.setPointerCapture(X.pointerId),ce.current={startX:X.clientX,startY:X.clientY,startW:A.width,startH:A.height})},Be=X=>{ce.current!==null&&le({...A,width:ce.current.startW+(X.clientX-ce.current.startX),height:ce.current.startH+(X.clientY-ce.current.startY)})},jt=X=>{if(ce.current!==null){ce.current=null;try{X.currentTarget.releasePointerCapture(X.pointerId)}catch{}br(void 0,A,wr())}},Tt=X=>{if(X){const Se=br(void 0,A,wr());R(Se),j(eu(void 0,!0))}else j(eu(void 0,!1)),br(void 0,A,wr())},re=X=>{M(QS(void 0,X)),X&&j(eu(void 0,!0))},ve=()=>{M(QS(void 0,!1)),eu(void 0,!1),j(!1),br(void 0,A,wr())},ze=()=>{ve(),t()},ae=X=>X==="start"?u.jsx("div",{className:"dock-body start",children:u.jsx(WB,{去:Se=>{T(Se)},新建终端:()=>{T("term"),F(Se=>Se+1)},打开浏览器:()=>{window.open(location.href,"_blank","noopener,noreferrer")},...a===void 0?{}:{打开轨迹:a},...c===void 0?{}:{打开命令面板:c}})}):X==="rewind"?u.jsx(v4,{session:h,...f===void 0?{}:{onReverted:f}}):X==="files"?u.jsx("div",{className:"dock-body files",children:u.jsx(N4,{width:y,changed:Ne,refreshKey:Q,root:g??I?.root??"",openTarget:r===null?null:{path:r.path,line:r.line,...r.rel===void 0?{}:{rel:r.rel},nonce:r.nonce}})}):X==="term"?u.jsx("div",{className:"dock-body term",children:u.jsx(FB,{onStats:P,createSignal:L})}):u.jsx("div",{className:"dock-body diff",children:u.jsx(m4,{facts:I,factsError:O,refreshKey:Q,onRefresh:()=>{z(Se=>Se+1),ye()}})});return e?u.jsx(KB,{页签s:m,onExpand:X=>{T(X),t()}}):u.jsxs("aside",{className:w?N?"dock dock-float fixed":"dock dock-float":"dock",style:w?N?{right:8,top:8,bottom:8,width:A.width}:{left:A.x,top:A.y,width:A.width,height:A.height}:{width:y,flex:`0 0 ${String(y)}px`},children:[w?u.jsxs("div",{className:"dock-float-bar",title:N?"已固定到右栏(禁拖禁缩;点 ⇥ 取消固定)":"拖动浮层(双击收回右栏)",onPointerDown:me,onPointerMove:Te,onPointerUp:He,onPointerCancel:He,onDoubleClick:()=>{Tt(!1)},children:[u.jsx("span",{className:"grip",children:"⠿"}),u.jsxs("span",{className:"float-title",children:["面板 · ",Er[De]]}),u.jsx("span",{className:N?"float-tag on":"float-tag",children:N?"已固定":"浮出"}),u.jsx("span",{className:"grow"}),u.jsx("button",{className:"icon-btn",title:"收回右栏","aria-label":"收回右栏",onClick:ve,children:"⤓"}),u.jsx("button",{className:N?"icon-btn on":"icon-btn",title:N?"取消固定(回浮动)":"固定到右栏","aria-label":N?"取消固定":"固定到右栏","aria-pressed":N,onClick:()=>{re(!N)},children:"⇥"}),u.jsx("button",{className:"icon-btn",title:"关闭(收起到 rail)","aria-label":"关闭面板",onClick:ze,children:"✕"})]}):u.jsx("div",{className:"dock-resize",title:YB,role:"separator","aria-orientation":"vertical","aria-label":"拖动调整右栏宽度",onPointerDown:ct,onPointerMove:Je,onPointerUp:Ke,onPointerCancel:Ke,onDoubleClick:qe}),u.jsxs("div",{className:"dock-tabs",children:[m.map(X=>u.jsxs("button",{className:X.id===_?"dock-tab active":"dock-tab",title:`${Er[X.type]}(${X.id})`,onClick:()=>{S(X.id),hm(X.id)},children:[u.jsx("span",{className:"dock-tab-label",children:Er[X.type]}),u.jsx("span",{className:"dock-tab-x",role:"button","aria-label":`关闭${Er[X.type]}页签`,title:"关闭页签",onClick:Se=>{Se.stopPropagation(),J(X.id)},children:"×"})]},X.id)),u.jsxs("span",{className:"dock-add-wrap",ref:te,children:[u.jsx("button",{className:"dock-tab add",title:"新增页签","aria-label":"新增页签","aria-expanded":K,onClick:()=>{q(X=>!X)},children:"+"}),K?u.jsx("span",{className:"dock-add-menu",children:["start","files","term","diff","rewind"].map(X=>u.jsxs("button",{className:"dock-add-item",onClick:()=>{E(X)},children:[u.jsx(Iw,{tab:X}),Er[X]]},X))}):null]}),u.jsx("span",{className:"grow"}),w?null:u.jsxs(u.Fragment,{children:[u.jsx("button",{className:"icon-btn",title:"浮出面板","aria-label":"浮出面板",onClick:()=>{Tt(!0)},children:u.jsxs("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",children:[u.jsx("rect",{x:"3",y:"4",width:"18",height:"16",rx:"2"}),u.jsx("path",{d:"M9 9h6v6"})]})}),u.jsx("button",{className:"icon-btn",title:"收起面板","aria-label":"收起面板",onClick:ze,children:u.jsxs("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",children:[u.jsx("rect",{x:"3",y:"4",width:"18",height:"16",rx:"2"}),u.jsx("path",{d:"M15 4v16"})]})})]})]}),u.jsx("div",{className:`dock-body-wrap ${De}`,children:ae(De)}),u.jsxs("div",{className:"dock-footer",children:[u.jsxs("button",{className:"status-line",title:I?.root??"工作区",onClick:()=>{T("diff")},children:[u.jsx("span",{className:"dot",style:{background:"var(--green)"}}),I?.branch===void 0?O===null?"工作区已连接":"git 读不到":I.branch,I!==null&&(I.ahead??0)>0?u.jsxs("span",{className:"dim",children:["↑",I.ahead]}):null,I!==null&&(I.behind??0)>0?u.jsxs("span",{className:"dim",children:["↓",I.behind]}):null]}),u.jsx("span",{className:"grow"}),u.jsx("button",{className:"ft-r",title:"打开变更",onClick:()=>{T("diff")},children:I===null?"":`${String(I.changed.length)} 个改动`}),u.jsxs("button",{className:"ft-r",title:"打开终端",onClick:()=>{T("term")},children:[G.running," 个终端运行中"]}),u.jsx("button",{className:"ft-r",title:"新建终端",onClick:()=>{T("term"),F(X=>X+1)},children:"+"})]}),w&&!N?u.jsx("span",{className:"dock-float-grip",title:"拖动缩放浮层",onPointerDown:Ee,onPointerMove:Be,onPointerUp:jt,onPointerCancel:jt}):null]})}function GB(){return Re("/workspace")}function QB(){return Re("/workspaces")}function Gb(e){return Re("/workspace",Ze({path:e}))}function ZB(){return Re("/git/branches")}function JB(e){return Re("/git/branch",Ze({name:e}))}function au(e){return e instanceof Error?e.message:String(e)}function e6({rightText:e,align:t}){const[i,r]=C.useState(null),[a,c]=C.useState(null),[h,f]=C.useState(null),[g,m]=C.useState(null),[v,_]=C.useState(null),[S,y]=C.useState(null),[x,w]=C.useState(!1),j=C.useRef(null),N=gx(typeof window>"u"?void 0:window);C.useEffect(()=>{let Q=!0;return Promise.all([GB(),hx()]).then(([z,G])=>{Q&&(r(z),c(G.branch??null))}).catch(()=>{}),()=>{Q=!1}},[]),C.useEffect(()=>{if(h===null)return;const Q=G=>{j.current?.contains(G.target)===!1&&f(null)},z=G=>{G.key==="Escape"&&(G.preventDefault(),G.stopPropagation(),f(null))};return document.addEventListener("mousedown",Q),document.addEventListener("keydown",z,!0),()=>{document.removeEventListener("mousedown",Q),document.removeEventListener("keydown",z,!0)}},[h]);const M=async Q=>{if(y(null),h===Q){f(null);return}f(Q);try{Q==="dir"&&m(await QB()),Q==="branch"&&_(await ZB())}catch(z){y(au(z))}},A=async Q=>{w(!0),y(null);try{await Gb(Q),location.reload()}catch(z){y(au(z))}finally{w(!1)}},R=async()=>{if(N!==null){w(!0),y(null);try{const Q=await N.pickDirectory();if(Q===null)return;await Gb(Q),location.reload()}catch(Q){y(au(Q))}finally{w(!1)}}},I=async Q=>{w(!0),y(null);try{await JB(Q),location.reload()}catch(z){y(au(z))}finally{w(!1)}},H=t==="composer"?{maxWidth:"812px",margin:"10px auto 0",padding:"0 14px"}:void 0,O=i?.name??"…",$=a??"—";return u.jsxs("div",{className:"env-bar",style:H,ref:j,children:[u.jsxs("button",{className:h==="env"?"env-pill on":"env-pill",title:"执行环境","aria-expanded":h==="env",onClick:()=>{M("env")},children:[u.jsx("span",{className:"g",children:"◻"})," 本地",u.jsx("span",{className:"g chev",children:"▾"})]}),u.jsxs("button",{className:h==="dir"?"env-pill on":"env-pill",title:`工作目录:${i?.root??""}`,"aria-expanded":h==="dir",onClick:()=>{M("dir")},children:[u.jsx("span",{className:"g",children:"▤"})," ",O,u.jsx("span",{className:"g chev",children:"▾"})]}),u.jsxs("button",{className:h==="branch"?"env-pill on":"env-pill",title:"切换分支","aria-expanded":h==="branch",onClick:()=>{M("branch")},children:[u.jsx("span",{className:"g",children:"⑂"})," ",$,u.jsx("span",{className:"g chev",children:"▾"})]}),u.jsxs("span",{className:"env-right",children:[u.jsx("span",{className:"g",children:"·"})," ",e]}),h===null?null:u.jsxs("div",{className:"env-menu",role:"menu",children:[h==="env"?u.jsxs(u.Fragment,{children:[u.jsx("div",{className:"env-menu-head",children:"执行环境"}),u.jsxs("div",{className:"env-item on",role:"menuitem","aria-current":"true",children:[u.jsx("span",{children:"◻ 本地机"}),u.jsx("span",{className:"check",children:"✓"})]}),u.jsxs("div",{className:"env-item","aria-disabled":"true",title:"大罗只在本机执行",children:[u.jsx("span",{children:"☁ 远端执行"}),u.jsx("span",{className:"tag",children:"未支持"})]}),u.jsx("div",{className:"env-note",children:"执行环境 = `serve` 进程所在机器;切换远端/沙箱未实现。"})]}):null,h==="dir"?u.jsxs(u.Fragment,{children:[u.jsx("div",{className:"env-menu-head",children:"切换工作目录"}),S===null?null:u.jsx("div",{className:"env-error",children:S}),g===null?u.jsx("div",{className:"env-note",children:"读取工作区列表…"}):null,(g?.workspaces??[]).map(Q=>u.jsxs("button",{className:Q.active?"env-item on":"env-item",role:"menuitem",disabled:x||!Q.exists||Q.active,title:Q.exists?Q.root:`${Q.root}(目录不在)`,onClick:()=>{A(Q.root)},children:[u.jsxs("span",{className:"env-item-main",children:[u.jsx("span",{children:Q.name}),u.jsx("span",{className:"path",children:Q.root})]}),Q.active?u.jsx("span",{className:"check",children:"✓"}):Q.exists?null:u.jsx("span",{className:"tag",children:"目录不在"})]},`${Q.workspaceId}-${Q.root}`)),g!==null&&(g.workspaces??[]).length===0?u.jsx("div",{className:"env-note",children:"还没有登记过其他工作区。"}):null,N===null?null:u.jsx("button",{className:"env-item",role:"menuitem",disabled:x,title:"打开系统对话框;可在里面新建文件夹",onClick:()=>{R()},children:u.jsxs("span",{className:"env-item-main",children:[u.jsx("span",{children:"打开文件夹…"}),u.jsx("span",{className:"path",children:"系统对话框里可新建目录"})]})}),u.jsx("div",{className:"env-note",children:"切换会重建按根缓存的工具/索引;有会话在跑时会被拒绝。"})]}):null,h==="branch"?u.jsxs(u.Fragment,{children:[u.jsx("div",{className:"env-menu-head",children:"切换分支"}),S===null?null:u.jsx("div",{className:"env-error",children:S}),v===null?u.jsx("div",{className:"env-note",children:"读取分支列表…"}):null,v!==null&&!v.isRepo?u.jsx("div",{className:"env-note",children:"当前工作目录不是 git 仓库。"}):null,v!==null&&v.isRepo&&v.error!==void 0?u.jsx("div",{className:"env-error",children:v.error}):null,(v?.branches??[]).map(Q=>u.jsxs("button",{className:Q.current?"env-item on":"env-item",role:"menuitem",disabled:x||Q.current,onClick:()=>{I(Q.name)},children:[u.jsx("span",{children:Q.name}),Q.current?u.jsx("span",{className:"check",children:"✓"}):null]},Q.name)),v!==null&&v.isRepo&&v.branches.length===0?u.jsx("div",{className:"env-note",children:"没有本地分支。"}):null,u.jsx("div",{className:"env-note",children:"切分支会改整棵工作树;有会话在跑时会被拒绝。"})]}):null]})]})}const t6=[{keys:["Enter"],label:"提交"},{keys:["Shift","Enter"],label:"换行"},{keys:["@"],label:"提文件"},{keys:["!"],label:"跑本机命令"},{keys:["/"],label:"技能"}];function n6(){return u.jsx("span",{className:"kbd-row",style:{justifyContent:"center"},children:t6.map(e=>u.jsxs("span",{children:[e.keys.map((t,i)=>u.jsxs("span",{children:[i>0?"+":"",u.jsx("kbd",{children:t})]},t))," ",e.label]},e.label))})}function i6({onToggleTheme:e,onSend:t}){const[i,r]=C.useState(""),[a,c]=C.useState(void 0),h=C.useRef(null),f=xx(m=>{h.current?.addFiles(m)}),g=(m,v)=>{const _=m.trim();_!==""&&(t(_,v,a),r(""))};return u.jsxs("div",{className:"view",style:{display:"flex"},...f.handlers,children:[u.jsx(R1,{title:"新会话",running:!1,onToggleTheme:e}),u.jsx("div",{className:"empty-body",children:u.jsx("div",{className:"empty-wrap",children:u.jsxs("div",{className:"empty-inner",children:[u.jsxs("div",{className:"empty-hero",children:[u.jsxs("pre",{className:"empty-mark",children:[" ",u.jsx("span",{className:"star",children:"✦"}),`
63
+ ╭───────╮
64
+ │ · `,u.jsx("span",{className:"star",children:"◆"}),` · │
65
+ ╭─┴───────┴─╮
66
+ │ · `,u.jsx("span",{className:"star",children:"✦"})," · ",u.jsx("span",{className:"star",children:"✦"}),` │
67
+ ╰───────────╯`]}),u.jsx("h1",{className:"empty-title",children:"有什么可以帮你的?"}),u.jsx("p",{className:"empty-sub",children:"说一句话就开始"})]}),u.jsx(bx,{ref:h,value:i,onChange:r,contextLabel:"ctx 0%",onSend:g,empty:!0,planMode:a===!0,onTogglePlan:()=>{c(m=>m!==!0)}}),u.jsx(e6,{rightText:"事件流已连接"}),u.jsx("div",{className:"suggestions",children:sE.map(m=>u.jsxs("button",{className:"sugg",onClick:()=>{r(m.prompt)},children:[u.jsx("span",{className:"ico",children:m.icon}),u.jsxs("span",{children:[u.jsx("span",{className:"t",children:m.title}),u.jsx("span",{className:"d",children:m.desc})]})]},m.title))}),u.jsx("div",{className:"empty-foot",children:u.jsx(n6,{})})]})})}),f.dragging?u.jsx(wx,{}):null]})}const s6=e=>{if(e===void 0)return null;const t=new Date(e);return Number.isNaN(t.getTime())?null:t.toLocaleTimeString("zh-CN",{hour:"2-digit",minute:"2-digit"})};function r6({info:e,onBackToSource:t,onClose:i}){const r=s6(e.ts);return u.jsx("div",{className:"modal-backdrop fork-done-backdrop",onClick:i,children:u.jsxs("div",{className:"modal-card fork-done",role:"dialog","data-dsh-part":"dialog","aria-label":"已分叉到新会话",onClick:a=>{a.stopPropagation()},children:[u.jsxs("div",{className:"modal-head",children:[u.jsx("span",{className:"ok",children:"✓"})," 已分叉到新会话",u.jsx("span",{className:"mut",children:"源会话只读"})]}),u.jsxs("div",{className:"modal-body",children:[u.jsxs("blockquote",{className:"fork-quote",children:["「",e.quote,"」"]}),u.jsxs("div",{className:"fork-meta",children:[u.jsxs("span",{className:"chip",children:["第 ",e.round," 轮"]}),u.jsxs("span",{children:["seq #",e.at]}),r===null?null:u.jsx("span",{children:r}),u.jsxs("span",{children:["源:",e.sourceTitle]})]}),u.jsx("div",{className:"modal-note",children:e.kind==="user"?u.jsxs(u.Fragment,{children:["新会话",u.jsx("b",{children:"保留到这句为止"}),",让大罗重新答;源会话没被改动。之后想回到原来的线,从侧栏点源会话即可。"]}):u.jsxs(u.Fragment,{children:["新会话",u.jsx("b",{children:"保留到这条回答为止"}),",从这里接着聊;源会话没被改动。之后想回到原来的线,从侧栏点源会话即可。"]})})]}),u.jsxs("div",{className:"modal-foot",children:[u.jsx("button",{className:"btn",onClick:t,children:"回到源会话"}),u.jsx("button",{className:"btn primary",onClick:i,children:"开始输入"})]})]})})}function l6(){return Re("/plugin-ui")}function a6(e,t){return Re("/plugin-ui",Ze({id:e,value:t}))}function o6(e){const t=e.indexOf(":");return t<=0?"":e.slice(0,t)}function c6(e,t,i){const r=new Map;for(const c of e){const h=o6(c.id);if(h==="")continue;const f=r.get(h);f===void 0?r.set(h,[c]):f.push(c)}const a=[];for(const[c,h]of r){if(i.has(c))continue;const g=h.find(m=>typeof m.pluginTitle=="string"&&m.pluginTitle!=="")?.pluginTitle??t.get(c)??c;a.push({id:c,title:g,rows:h})}return a.sort((c,h)=>c.title.localeCompare(h.title,"zh")||c.id.localeCompare(h.id))}const Qb=200,Zb=4096;function u6(e){switch(e){case"toggle":return"switch";case"select":return"seg";case"text":return"text";case"secret":return"secret";default:return"unsupported"}}function Jb(e){return e.kind!=="text"?"":typeof e.value=="string"?e.value:e.value===void 0||e.value===null?"":String(e.value)}function h6(e,t){return e.kind==="text"?t.length>Qb?`最多 ${String(Qb)} 字符(当前 ${String(t.length)})`:void 0:e.kind==="secret"?t.length>Zb?`最多 ${String(Zb)} 字符(当前 ${String(t.length)})`:void 0:`${e.kind} 行不走草稿`}function Uw(e){return e===!0?"已设置":"未设置"}function d6(e){if(e.kind==="toggle")return e.value===!0?"开":"关";if(e.kind==="select"){const t=(e.options??[]).find(i=>i.value===e.value);return t!==void 0?t.label:e.value===void 0||e.value===null?"":String(e.value)}return e.kind==="secret"?Uw(e.configured):typeof e.value=="string"?e.value:e.value===void 0||e.value===null?"":String(e.value)}function f6({title:e,rows:t,onChanged:i}){const[r,a]=C.useState(null),[c,h]=C.useState(null),[f,g]=C.useState(null),m=async(v,_)=>{if(r===null){a(`row:${v}`);try{await a6(v,_),g("已保存(服务端为准)"),h(null),await i()}catch(S){h(S instanceof Error?S.message:String(S))}finally{a(null)}}};return u.jsxs("div",{className:"plug-page",children:[u.jsxs("div",{className:"set-title",children:[u.jsx("h2",{children:e}),u.jsx("span",{className:"muted",children:"插件设置 · 宿主渲染(密钥不回显明文,保存后以服务端为准)"})]}),c===null?null:u.jsxs("div",{className:"err-bar",children:[u.jsx("span",{className:"warn",children:"⚠"}),u.jsx("span",{className:"grow",children:c}),u.jsx("button",{className:"btn",onClick:()=>{i()},children:"重试"})]}),f===null?null:u.jsxs("div",{className:"save-bar",children:[u.jsx("span",{children:"✓"}),u.jsx("span",{className:"grow",children:f}),u.jsx("button",{className:"btn",onClick:()=>{g(null)},children:"知道了"})]}),u.jsxs("div",{className:"plug-group",children:[u.jsxs("h3",{children:["设置 ",u.jsx("span",{className:"plug-count",children:t.length})]}),u.jsx("div",{className:"plug-rows",children:t.map(v=>u.jsx(m6,{row:v,busy:r,onSave:_=>{m(v.id,_)}},v.id))})]})]})}function m6({row:e,busy:t,onSave:i}){const r=u6(e.kind),[a,c]=C.useState(()=>Jb(e)),h=t===`row:${e.id}`;C.useEffect(()=>{e.kind==="text"&&c(Jb(e))},[e]);const f=r==="text"||r==="secret"?h6(e,a):void 0,g=d6(e);return u.jsxs("div",{className:"plug-row",children:[u.jsxs("div",{className:"plug-row-label",children:[u.jsx("b",{children:e.label}),u.jsx("code",{children:e.id})]}),e.note===void 0?null:u.jsx("div",{className:"plug-row-note",children:e.note}),u.jsxs("div",{className:"plug-row-ctl",children:[r==="switch"?u.jsx("button",{className:`plug-switch${e.value===!0?" on":""}${h?" busy":""}`,role:"switch","aria-checked":e.value===!0,"aria-label":e.label,disabled:t!==null,onClick:()=>{i(e.value!==!0)},title:"立即生效(服务端为准)",children:u.jsx("span",{"aria-hidden":"true"})}):null,r==="seg"?u.jsx("select",{className:"plug-select",value:typeof e.value=="string"?e.value:"",disabled:t!==null,onChange:m=>{i(m.target.value)},"aria-label":e.label,children:(e.options??[]).map(m=>u.jsx("option",{value:m.value,children:m.label},m.value))}):null,r==="text"?u.jsxs(u.Fragment,{children:[u.jsx("input",{className:"plug-input",value:a,disabled:t!==null,onChange:m=>{c(m.target.value)},"aria-label":e.label}),u.jsx("button",{className:"btn",disabled:t!==null||f!==void 0,onClick:()=>{i(a)},children:"保存"})]}):null,r==="secret"?u.jsxs(u.Fragment,{children:[u.jsx("input",{className:"plug-input",type:"password",value:a,placeholder:Uw(e.configured),disabled:t!==null,onChange:m=>{c(m.target.value)},"aria-label":e.label}),u.jsx("button",{className:"btn",disabled:t!==null||a===""||f!==void 0,onClick:()=>{i(a)},children:"保存"}),u.jsx("button",{className:"ghost",disabled:t!==null,onClick:()=>{i("")},title:"清空这个密钥(空串 = 清除)",children:"清除"})]}):null,r==="unsupported"?u.jsxs("span",{className:"muted",children:["不认识的行类型(",e.kind,"),只读"]}):null,u.jsx("span",{className:`plug-row-state${h?" busy":""}`,children:h?"保存中…":g})]}),f===void 0?null:u.jsx("div",{className:"plug-row-note bad",children:f})]})}function p6(e){const t=e.completionOk===!0?`补全 ✓${e.probedModel===void 0?"":`(${e.probedModel})`}`:"补全未测通",i=e.modelsOk===!0?"":" · 清单未拉到",r=[...e.errors??[]];r.length===0&&e.error!==void 0&&e.error!==""&&r.push(e.error);const a=r.length===0?"":` · ${r.join(";")}`;return`${e.completionOk===!0?`连通 ✓ ${String(e.ms)}ms`:"不通"} · ${t}${i}${a}`}function g6(e){return e==="registry"?"注册表":e==="builtin"?"内置":"用户插件"}function _6(e){return e==="active"?"已装载":e==="failed"?"装载失败":e==="pending"?"未就绪":"已停用"}function v6(e){const t=e??{active:0,failed:0,pending:0,disabled:0},i=[`${String(t.active)} 个已装载`];return t.disabled>0&&i.push(`${String(t.disabled)} 个已停用`),t.pending>0&&i.push(`${String(t.pending)} 个未就绪`),t.failed>0&&i.push(`${String(t.failed)} 个装载失败`),i.join(" · ")}function ex(e,t){const i=t.trim().toLowerCase();return i===""?e:e.filter(r=>r.id.toLowerCase().includes(i)||r.title.toLowerCase().includes(i)||r.description.toLowerCase().includes(i))}function y6(e,t){return t?`已启用「${e}」:下一条消息起生效(正在跑的回合不拆)`:`已停用「${e}」:下一条消息起生效(正在跑的回合不拆)`}function S6(e){return e.trim()===""?"没有配置用户插件。把插件写进 daluo.plugins.ts(或 DALUO_PLUGINS)后刷新即可,装载失败的原话会出现在上面。":"没有匹配的用户插件——清掉筛选看看。"}function b6(){const[e,t]=C.useState(null),[i,r]=C.useState(null),[a,c]=C.useState(null),[h,f]=C.useState(""),[g,m]=C.useState(null),v=C.useCallback(async()=>{try{t(await px()),r(null)}catch(x){r(x instanceof Error?x.message:String(x))}},[]);C.useEffect(()=>{v()},[v]);const _=async x=>{if(x.locked||g!==null)return;const w=x.state==="disabled";m(x.id);try{await w2(x.id,w),c(y6(x.id,w)),r(null),await v()}catch(j){r(j instanceof Error?j.message:String(j))}finally{m(null)}};if(i!==null)return u.jsxs("div",{className:"err-bar",children:[u.jsx("span",{className:"warn",children:"⚠"}),u.jsxs("span",{className:"grow",children:["插件列表读不出来:",i]}),u.jsx("button",{className:"btn",onClick:()=>{v()},children:"重试"})]});if(e===null)return u.jsxs("div",{className:"set-title",children:[u.jsx("h2",{children:"插件"}),u.jsx("span",{className:"muted",children:"正在读取当前装配…"})]});if(!e.ok)return u.jsxs(u.Fragment,{children:[u.jsxs("div",{className:"set-title",children:[u.jsx("h2",{children:"插件"}),u.jsx("span",{className:"muted",children:"装配失败 · 失败行不隐藏、不改写原因"})]}),u.jsxs("div",{className:"err-bar",children:[u.jsx("span",{className:"warn",children:"⚠"}),u.jsx("span",{className:"grow",children:e.error??"装配失败"}),u.jsx("button",{className:"btn",onClick:()=>{v()},children:"重试"})]}),u.jsxs("div",{className:"card",children:[u.jsx("h3",{children:"装载失败的行"}),u.jsx("div",{className:"sub",children:"loader 原话照抄(来源 + 原因)。修好配置后重启 serve 或重新装配。"}),(e.rows??[]).map(x=>u.jsxs("div",{className:"plug-logline",children:[u.jsx("code",{children:x.id}),u.jsx("span",{className:"plug-src",children:x.source}),u.jsx("span",{className:"plug-bad",children:x.detail??x.state})]},x.id))]})]});const S=ex(e.builtin??[],h),y=ex(e.user??[],h);return u.jsxs("div",{className:"plug-page",children:[u.jsxs("div",{className:"set-title",children:[u.jsx("h2",{children:"插件"}),u.jsx("span",{className:"muted",children:"装配审计 · 与 agent 实际吃到的是同一份"})]}),u.jsxs("div",{className:"plug-head",children:[u.jsx("span",{className:"plug-dot","aria-hidden":"true"}),u.jsx("span",{children:u.jsx("b",{children:v6(e.counts)})}),u.jsx("span",{className:"grow"}),u.jsx("span",{className:"plug-locknote",children:"🔒 内置插件不允许停止"}),u.jsx("span",{className:"plug-effective",children:"启停立即生效(下一条消息起)"}),u.jsx("button",{className:"btn",onClick:()=>{v()},children:"刷新"})]}),u.jsxs("div",{className:"plug-sources",children:[u.jsx("span",{children:"来源:"}),(e.sources??[]).length===0?u.jsx("span",{children:"没有用户插件配置(daluo.plugins.ts / DALUO_PLUGINS_FILE / DALUO_PLUGINS)"}):(e.sources??[]).map(x=>u.jsx("code",{children:x},x))]}),a===null?null:u.jsxs("div",{className:"save-bar",children:[u.jsx("span",{children:"✓"}),u.jsx("span",{className:"grow",children:a}),u.jsx("button",{className:"btn",onClick:()=>{c(null)},children:"知道了"})]}),u.jsxs("div",{className:"plug-search",children:[u.jsx("span",{"aria-hidden":"true",children:"⌕"}),u.jsx("input",{value:h,onChange:x=>{f(x.target.value)},placeholder:"按 id / 名称 / 职责筛选插件…","aria-label":"筛选插件"}),h===""?null:u.jsx("button",{className:"ghost",onClick:()=>{f("")},children:"清空"})]}),u.jsxs("div",{className:"plug-group",children:[u.jsxs("h3",{children:["内置插件 ",u.jsx("span",{className:"plug-count",children:S.length})]}),u.jsx("div",{className:"sub",children:"三条贡献面的接缝 + 安全/省钱硬闸;只读详情,开关锁定。"}),u.jsx("div",{className:"plug-grid",children:S.map(x=>u.jsx(tx,{card:x,busy:g,onToggle:()=>{_(x)}},x.id))})]}),u.jsxs("div",{className:"plug-group",children:[u.jsxs("h3",{children:["用户插件 ",u.jsx("span",{className:"plug-count",children:y.length})]}),u.jsx("div",{className:"sub",children:"来自 daluo.plugins.ts / DALUO_PLUGINS_FILE / DALUO_PLUGINS;只有这里能启停。"}),y.length===0?u.jsx("div",{className:"plug-empty",children:S6(h)}):u.jsx("div",{className:"plug-grid",children:y.map(x=>u.jsx(tx,{card:x,busy:g,onToggle:()=>{_(x)}},x.id))})]})]})}function tx({card:e,busy:t,onToggle:i}){const[r,a]=C.useState(!1),c=!e.locked,h=e.state==="disabled";return u.jsxs("div",{className:`plug-card${h?" off":""}${r?" open":""}`,children:[u.jsxs("div",{className:"plug-card-main",children:[u.jsx("span",{className:`plug-ico ${e.kind}`,"aria-hidden":"true",children:e.kind==="registry"?"◇":e.kind==="builtin"?"⛨":"✧"}),u.jsxs("div",{className:"plug-body",children:[u.jsxs("div",{className:"plug-title",children:[u.jsx("span",{className:"plug-name",children:e.title}),u.jsx("span",{className:`plug-tag ${e.kind}`,children:g6(e.kind)}),u.jsx("span",{className:`plug-state ${e.state}`,children:_6(e.state)})]}),u.jsx("div",{className:"plug-slug",children:e.id}),e.description===""?null:u.jsx("div",{className:"plug-desc",children:e.description})]}),c?u.jsx("button",{className:`plug-switch${h?"":" on"}${t===e.id?" busy":""}`,role:"switch","aria-checked":!h,"aria-label":`${h?"启用":"停用"} ${e.title}`,disabled:t!==null,onClick:i,title:t!==null?"正在写设置…":h?"启用(下一条消息起生效)":"停用(下一条消息起生效)",children:u.jsx("span",{"aria-hidden":"true"})}):u.jsx("span",{className:"plug-switch locked",title:"内置插件不允许停止","aria-hidden":"true",children:u.jsx("span",{"aria-hidden":"true"})}),u.jsx("button",{className:"plug-expand",onClick:()=>{a(f=>!f)},"aria-expanded":r,"aria-label":"展开详情",children:u.jsx("span",{"aria-hidden":"true",children:r?"▴":"▾"})})]}),r?u.jsxs("div",{className:"plug-detail",children:[u.jsxs("div",{className:"plug-kv",children:[u.jsx("span",{children:"来源"}),u.jsx("code",{children:e.source})]}),u.jsxs("div",{className:"plug-kv",children:[u.jsx("span",{children:"装配顺序"}),u.jsxs("code",{children:["#",e.order]})]}),e.pageUrl===void 0?null:u.jsxs("div",{className:"plug-kv",children:[u.jsx("span",{children:"页面入口"}),u.jsxs("a",{href:e.pageUrl,target:"_blank",rel:"noopener noreferrer",children:[e.pageUrl," ↗"]})]}),e.contributions.length===0?null:u.jsxs("div",{className:"plug-contrib",children:[u.jsx("span",{children:"贡献面"}),e.contributions.map(f=>u.jsxs("div",{className:"plug-contrib-line",children:[u.jsx("b",{children:f.type}),u.jsx("code",{children:f.value}),f.note===void 0?null:u.jsx("span",{children:f.note})]},`${f.type}:${f.value}`))]}),u.jsxs("div",{className:"plug-kv",children:[u.jsx("span",{children:"装载日志"}),u.jsx("code",{className:e.state==="failed"?"bad":"",children:e.log})]}),e.detail===void 0?null:u.jsxs("div",{className:"plug-kv",children:[u.jsx("span",{children:"原因"}),u.jsx("code",{className:"bad",children:e.detail})]}),c?null:u.jsx("div",{className:"plug-lockhint",children:"🔒 内置插件不允许停止(用户定稿):要改行为请改它的配置,而不是停掉它。"})]}):null]})}function x6({onClose:e,session:t,onTheme:i}){const[r,a]=C.useState("appearance"),c=C.useSyncExternalStore(Tr.subscribe,Tr.getVersion),h=C.useMemo(()=>Tr.componentsOf("settings.section"),[c]),[f,g]=C.useState(null),[m,v]=C.useState([]),[_,S]=C.useState(new Map),y=async()=>{try{const[P,L]=await Promise.all([l6(),px()]);v(P.rows);const F=new Map;for(const K of[...L.builtin??[],...L.user??[]])F.set(K.id,K.title);S(F)}catch{}};C.useEffect(()=>{y()},[]);const x=C.useMemo(()=>new Set(h.map(P=>P.forPlugin).filter(P=>typeof P=="string"&&P!=="")),[h]),w=C.useMemo(()=>c6(m,_,x),[m,_,x]),[j,N]=C.useState(null),[M,A]=C.useState(null),[R,I]=C.useState(null),[H,O]=C.useState(null),[$,Q]=C.useState(null),z=async()=>{try{const[P,L,F]=await Promise.all([_2(),y2(),pm(t??void 0)]);N(P),A(L),I(F),O(null)}catch(P){O(P instanceof Error?P.message:String(P))}};C.useEffect(()=>{z()},[]);const G=async P=>{try{N(await v2(P)),O(null)}catch(L){O(L instanceof Error?L.message:String(L))}};return u.jsxs("div",{className:"settings","data-dsh-surface":"settings",children:[u.jsxs("div",{className:"set-nav",children:[u.jsxs("button",{className:"back",onClick:e,title:"返回会话",children:[u.jsx("span",{"aria-hidden":"true",children:"←"})," 返回"]}),u.jsx("div",{className:"gtitle",children:"设置"}),[["◐","外观","appearance"],["◇","模型与提供方","providers"],["✧","插件","plugins"],["ⓘ","关于","about"]].map(([P,L,F])=>u.jsxs("button",{className:f===null&&r===F?"on":"",onClick:()=>{g(null),a(F)},children:[u.jsx("span",{className:"g",children:P}),L]},F)),h.length===0?null:u.jsxs(u.Fragment,{children:[u.jsx("div",{className:"gtitle",children:"插件设置"}),h.map(P=>{const L=`custom:${P.pluginId}/${P.id}`;return u.jsxs("button",{className:f===L?"on":"",onClick:()=>{g(L)},children:[u.jsx("span",{className:"g",children:"✧"}),P.title??P.id]},L)}),w.map(P=>u.jsxs("button",{className:f===`generic:${P.id}`?"on":"",onClick:()=>{g(`generic:${P.id}`)},children:[u.jsx("span",{className:"g",children:"✧"}),P.title]},`generic:${P.id}`))]})]}),u.jsxs("div",{className:"set-body",children:[H===null?null:u.jsxs("div",{className:"err-bar",children:[u.jsx("span",{className:"warn",children:"⚠"}),u.jsx("span",{className:"grow",children:H}),u.jsx("button",{className:"btn",onClick:()=>{z()},children:"重试"})]}),$===null?null:u.jsxs("div",{className:"save-bar",children:[u.jsx("span",{children:"✓"}),u.jsx("span",{className:"grow",children:$}),u.jsx("button",{className:"btn",onClick:()=>{Q(null)},children:"知道了"})]}),f!==null?(()=>{if(f.startsWith("generic:")){const F=f.slice(8),K=w.find(q=>q.id===F);return K===void 0?null:u.jsx(f6,{title:K.title,rows:K.rows,onChanged:y})}const P=h.find(F=>`custom:${F.pluginId}/${F.id}`===f);if(P===void 0)return null;const L=P.Component;return u.jsx(L,{})})():r==="appearance"?u.jsx(w6,{p:{settings:j,保存设置:G,onTheme:i}}):r==="providers"?u.jsx(C6,{p:{providers:M,models:R,session:t,刷新:z,setError:O,setNotice:Q}}):r==="plugins"?u.jsx(b6,{}):u.jsx(k6,{p:{settings:j,providers:M}})]})]})}function w6({p:e}){const{settings:t,保存设置:i,onTheme:r}=e,a=t?.values.theme??"light";return u.jsxs(u.Fragment,{children:[u.jsxs("div",{className:"set-title",children:[u.jsx("h2",{children:"外观"}),u.jsx("span",{className:"muted",children:"只影响这台机器上的这个浏览器 · 立即生效,不需要保存"})]}),u.jsxs("div",{className:"card",children:[u.jsx("h3",{children:"主题"}),u.jsx("div",{className:"sub",children:"深色/浅色都会写进设置文件(`/settings`),换浏览器也一致。"}),u.jsxs("div",{className:"seg",children:[a==="system"?u.jsx("span",{className:"pill",children:"当前:跟随系统(选一个就固定下来)"}):null,["light","dark"].map(c=>u.jsx("button",{className:a===c?"on":"",onClick:()=>{r(c),i({theme:c})},children:c==="light"?"浅色":"深色"},c))]})]}),u.jsxs("div",{className:"card",children:[u.jsx("h3",{children:"字号"}),u.jsx("div",{className:"sub",children:"消息与工具卡的基础字号(会随主题一起写盘)。"}),u.jsx("div",{className:"seg",children:[13,14,16].map(c=>u.jsx("button",{className:(t?.values.fontSize??14)===c?"on":"",onClick:()=>{i({fontSize:c})},children:c===13?"紧凑":c===14?"标准":"宽松"},c))})]})]})}const dm={name:"",baseUrl:"",apiKey:"",clearApiKey:!1,contextWindowTokens:""};function C6({p:e}){const{providers:t,models:i,session:r,刷新:a,setError:c,setNotice:h}=e,[f,g]=C.useState(dm),[m,v]=C.useState(!1),[_,S]=C.useState({}),[y,x]=C.useState(null),w=C.useRef(null),j=y!==null;C.useEffect(()=>{if(!j)return;w.current?.focus();const O=Q=>{const z=Q.target;z instanceof Element&&z.closest(".picker")===null&&z.closest("[data-picker-trigger]")===null&&x(null)},$=Q=>{Q.key==="Escape"&&x(null)};return document.addEventListener("mousedown",O),document.addEventListener("keydown",$),()=>{document.removeEventListener("mousedown",O),document.removeEventListener("keydown",$)}},[j]);const N=async(O,$)=>{v(!0);try{await O(),await a(),c(null),$!==void 0&&h($)}catch(Q){c(Q instanceof Error?Q.message:String(Q))}finally{v(!1)}},M=async()=>{await N(()=>Ua({op:f.id===void 0?"add":"update",...f.id===void 0?{}:{id:f.id},name:f.name,baseUrl:f.baseUrl,...f.apiKey===""?{}:{apiKey:f.apiKey},...f.clearApiKey?{clearApiKey:!0}:{},...f.contextWindowTokens===""?{}:{contextWindowTokens:f.contextWindowTokens}}),f.id===void 0?"已新增提供方":"已保存提供方"),g(dm)},A=O=>{g({id:O.id,name:O.name,baseUrl:O.baseUrl,apiKey:"",clearApiKey:!1,contextWindowTokens:O.contextWindowTokens===void 0?"":String(O.contextWindowTokens)})},R=async O=>{S($=>({...$,[O.id]:"拉取模型清单…"}));try{const $=await U0({id:O.id});if($.modelsOk!==!0){S(z=>({...z,[O.id]:`拉取失败:${($.errors??[]).join(";")||"取不到清单"}`}));return}const Q=$.models??[];S(z=>({...z,[O.id]:`接口返回 ${String(Q.length)} 个模型 · 补全${$.completionOk===!0?" ✓":"未测通"}`})),x({providerId:O.id,name:O.name,全部:Q,选中:O.models.map(z=>z.name),过滤:""})}catch($){S(Q=>({...Q,[O.id]:`拉取失败:${$ instanceof Error?$.message:String($)}`}))}},I=async()=>{if(y===null)return;const O=t?.providers.find(G=>G.id===y.providerId),$=new Map((O?.models??[]).map(G=>[G.name,G.contextWindowTokens])),Q=new Set(y.选中),z=y.全部.filter(G=>Q.has(G)).map(G=>{const P=$.get(G);return P===void 0||P===""?{name:G}:{name:G,contextWindowTokens:P}});await N(()=>Ua({op:"update",id:y.providerId,models:z}),`已保存 ${String(z.length)} 个模型`),x(null)},H=async O=>{S($=>({...$,[O.id]:"测试中…"}));try{const $=await U0({id:O.id});S(Q=>({...Q,[O.id]:p6($)}))}catch($){S(Q=>({...Q,[O.id]:`不通 · ${$ instanceof Error?$.message:String($)}`}))}};return t===null?u.jsx("div",{className:"muted",children:"载入提供方配置…"}):u.jsxs(u.Fragment,{children:[u.jsxs("div",{className:"set-title",children:[u.jsx("h2",{children:"模型与提供方"}),u.jsx("span",{className:"muted",children:"可配多套,随时切换 · 密钥只显示末四位"})]}),u.jsxs("div",{className:"card",children:[u.jsxs("h3",{children:["提供方(",t.providers.length," 套)"]}),u.jsxs("div",{className:"sub",children:["当前:",t.providers.find(O=>O.id===t.activeProviderId)?.name??"未配置"," · 进程实际连接:",t.runningBaseUrl," / ",t.runningModel,t.envOverride.length===0?"":` · 环境变量覆盖:${t.envOverride.join(", ")}`]}),t.providers.length===0?u.jsx("div",{className:"hint",children:"还没有配置提供方。下面填一套(baseURL + 密钥 + 模型清单)就能用。"}):u.jsx("div",{className:"models",children:t.providers.map(O=>u.jsxs("div",{style:{position:"relative"},className:O.id===t.activeProviderId?"model on":"model",children:[u.jsxs("div",{style:{minWidth:0},children:[u.jsxs("div",{children:[u.jsx("span",{className:"nm",children:O.name}),O.id===t.activeProviderId?u.jsx("span",{className:"pill",style:{marginLeft:8},children:"当前"}):null,O.enabled?null:u.jsx("span",{className:"pill",style:{marginLeft:8},children:"已关闭"})]}),u.jsxs("div",{className:"tagm",style:{marginLeft:0},children:[O.baseUrl," · ",O.models.length," 个模型 · 密钥",O.apiKeySet?` 已配置 · …${O.apiKeyHint}`:" 未配置"]}),_[O.id]===void 0?null:u.jsx("div",{className:"hint",children:_[O.id]})]}),u.jsxs("span",{className:"tagm",style:{display:"flex",gap:6,flexWrap:"wrap",justifyContent:"flex-end"},children:[u.jsx("button",{className:"btn",disabled:m,onClick:()=>{H(O)},title:"真打一次提供方:列清单 + 一次最小补全,只报连通/补全状态",children:"测试连通"}),u.jsx("button",{className:"btn","data-picker-trigger":"1",disabled:m,onClick:()=>{R(O)},children:"获取模型"}),u.jsx("button",{className:"btn",disabled:m||O.id===t.activeProviderId||!O.enabled,onClick:()=>{N(()=>Ua({op:"activate",id:O.id}),`已切到 ${O.name}`)},children:"启用"}),u.jsx("button",{className:"btn",disabled:m,onClick:()=>{A(O)},children:"编辑"}),u.jsx("button",{className:"btn",disabled:m,onClick:()=>{N(()=>Ua({op:"update",id:O.id,enabled:!O.enabled}),O.enabled?"已关闭":"已开启")},children:O.enabled?"停用":"开启"}),u.jsx("button",{className:"btn danger",disabled:m||O.id===t.activeProviderId,onClick:()=>{window.confirm(`删除提供方「${O.name}」?`)&&N(()=>Ua({op:"remove",id:O.id}),"已删除")},children:"删除"})]}),y===null||y.providerId!==O.id?null:u.jsxs("div",{className:"picker","data-picker":"1",children:[u.jsxs("div",{className:"picker-head",children:[u.jsx("b",{children:y.name}),u.jsxs("span",{children:["· 接口返回 ",y.全部.length," 个模型 · 已选 ",y.选中.length]}),u.jsxs("span",{style:{marginLeft:"auto",display:"flex",gap:6},children:[u.jsx("button",{className:"btn",onClick:()=>{x({...y,选中:y.全部})},children:"全选"}),u.jsx("button",{className:"btn",onClick:()=>{x({...y,选中:[]})},children:"清空"})]})]}),u.jsx("input",{ref:w,className:"picker-search",value:y.过滤,placeholder:"筛选模型名…(Esc 关闭)",onChange:$=>{x({...y,过滤:$.target.value})}}),u.jsxs("div",{className:"picker-list",children:[y.全部.filter($=>y.过滤.trim()===""||$.toLowerCase().includes(y.过滤.trim().toLowerCase())).map($=>{const Q=y.选中.includes($),z=t.providers.find(G=>G.id===y.providerId)?.models.some(G=>G.name===$)===!0;return u.jsxs("label",{className:Q?"pick on":"pick",children:[u.jsx("input",{type:"checkbox",checked:Q,onChange:()=>{x({...y,选中:Q?y.选中.filter(G=>G!==$):[...y.选中,$]})}}),u.jsx("span",{className:"nm",children:$}),z?null:u.jsx("span",{className:"pill",children:"未添加"})]},$)}),y.全部.filter($=>y.过滤.trim()===""||$.toLowerCase().includes(y.过滤.trim().toLowerCase())).length===0?u.jsx("div",{className:"picker-empty",children:"没有匹配的模型"}):null]}),u.jsxs("div",{className:"section-actions",children:[u.jsx("button",{className:"btn",onClick:()=>{x(null)},children:"取消"}),u.jsxs("button",{className:"btn primary",disabled:m,onClick:()=>{I()},children:["保存勾选的 ",y.选中.length," 个"]})]})]})]},O.id))}),u.jsx("div",{className:"hint",children:"模型清单从提供方接口拉取(`/provider/test` 的 `models`),勾选后才写进配置——默认模型只显示已添加的。"}),u.jsxs("div",{className:"hint",children:["配置文件:",t.configFile]})]}),u.jsxs("div",{className:"card",children:[u.jsx("h3",{children:f.id===void 0?"新增提供方":`编辑:${f.name}`}),u.jsx("div",{className:"sub",children:"模型不在表单里手填:新增后在列表里点「获取模型」从提供方接口拉清单,勾选要用的那些。"}),u.jsxs("div",{className:"form-grid",children:[u.jsxs("label",{children:["名称",u.jsx("input",{value:f.name,placeholder:"DeepSeek / 公司网关",onChange:O=>{g({...f,name:O.target.value})}})]}),u.jsxs("label",{children:["baseURL",u.jsx("input",{value:f.baseUrl,placeholder:"https://api.deepseek.com/v1",onChange:O=>{g({...f,baseUrl:O.target.value})}})]}),u.jsxs("label",{children:["密钥",u.jsx("input",{type:"password",value:f.apiKey,placeholder:f.id===void 0?"sk-…(可留空,用环境变量)":"留空 = 不改",onChange:O=>{g({...f,apiKey:O.target.value})}})]}),u.jsxs("label",{children:["上下文窗口",u.jsx("input",{value:f.contextWindowTokens,placeholder:"1000000(可留空)",onChange:O=>{g({...f,contextWindowTokens:O.target.value})}})]})]}),f.id===void 0?null:u.jsxs("label",{className:"check",children:[u.jsx("input",{type:"checkbox",checked:f.clearApiKey,onChange:O=>{g({...f,clearApiKey:O.target.checked})}}),"清除已存的密钥"]}),u.jsxs("div",{className:"section-actions",children:[f.id===void 0?null:u.jsx("button",{className:"btn",onClick:()=>{g(dm)},children:"取消编辑"}),u.jsx("button",{className:"btn primary",disabled:m||f.baseUrl.trim()==="",onClick:()=>{M()},children:f.id===void 0?"新增":"保存"})]})]}),u.jsxs("div",{className:"card",children:[u.jsx("h3",{children:"默认模型"}),u.jsxs("div",{className:"sub",children:["当前:",i?.current??"—","(",i?.currentSource??"—",")· 新会话默认:",i?.default??"—",r===null?"":" · 改的是这个会话"]}),u.jsx("div",{className:"pills",children:(t.providers.find(O=>O.id===t.activeProviderId)?.models??[]).filter(O=>O.enabled!==!1).map(O=>u.jsx("button",{className:i?.current===O.name?"pill on":"pill",disabled:m,onClick:()=>{v(!0),mx(O.name,r??void 0).then(async()=>{await a(),h(`已切到 ${O.name}`)}).catch($=>{c($ instanceof Error?$.message:String($))}).finally(()=>{v(!1)})},children:O.name},O.name))}),(t.providers.find(O=>O.id===t.activeProviderId)?.models??[]).length===0?u.jsx("div",{className:"hint",children:"当前提供方还没有模型:先在它那一行点「获取模型」,勾选要用的模型保存。"}):null]})]})}function k6({p:e}){const{settings:t,providers:i}=e;return u.jsxs(u.Fragment,{children:[u.jsxs("div",{className:"set-title",children:[u.jsx("h2",{children:"关于"}),u.jsx("span",{className:"muted",children:"大罗 · v0.1"})]}),u.jsxs("div",{className:"card",children:[u.jsx("h3",{children:"本机服务"}),u.jsxs("div",{className:"field",children:[u.jsx("span",{className:"k",children:"地址"}),u.jsx("span",{className:"v",children:location.origin})]}),u.jsxs("div",{className:"field",children:[u.jsx("span",{className:"k",children:"模式"}),u.jsx("span",{className:"v",children:"本机 loopback · 免 token"})]}),u.jsxs("div",{className:"field",children:[u.jsx("span",{className:"k",children:"设置文件"}),u.jsx("span",{className:"v",children:t?.file??"—"})]}),u.jsxs("div",{className:"field",children:[u.jsx("span",{className:"k",children:"提供方配置"}),u.jsx("span",{className:"v",children:i?.configFile??"—"})]})]}),u.jsxs("div",{className:"card",children:[u.jsx("h3",{children:"运行中连接"}),u.jsxs("div",{className:"field",children:[u.jsx("span",{className:"k",children:"baseURL"}),u.jsx("span",{className:"v",children:i?.runningBaseUrl??"—"})]}),u.jsxs("div",{className:"field",children:[u.jsx("span",{className:"k",children:"模型"}),u.jsx("span",{className:"v",children:i?.runningModel??"—"})]}),u.jsxs("div",{className:"field",children:[u.jsx("span",{className:"k",children:"环境变量覆盖"}),u.jsx("span",{className:"v",children:i===null||i.envOverride.length===0?"无":i.envOverride.join(", ")})]})]})]})}const N6=[{mode:"sequence",名:"序",说明:"每格等宽:看清顺序与谁挨着谁(没时间戳的格也在)"},{mode:"duration",名:"时长",说明:"条宽 = 实测时长,空档压缩:谁占了多少干活时间"},{mode:"time",名:"时间",说明:"归零标记,空档保留:真实时间轴上的位置"},{mode:"actual",名:"实际",说明:"位置 + 宽度:真实时间轴上实际发生在哪、各花多久"}],E6=[{kind:"user",名:"用户",图标:"●"},{kind:"assistant-text",名:"回复",图标:"◆"},{kind:"tool-call",名:"工具",图标:"▸"},{kind:"compaction",名:"压缩",图标:"◱"},{kind:"ask",名:"确认",图标:"?"},{kind:"inbox",名:"排队",图标:"▤"},{kind:"feedback",名:"反馈",图标:"✎"},{kind:"goal",名:"目标",图标:"◎"},{kind:"todo",名:"计划",图标:"☑"},{kind:"subagent",名:"子代理",图标:"⧉"},{kind:"workflow",名:"工作流",图标:"⌘"},{kind:"team",名:"团队",图标:"⚇"},{kind:"system",名:"系统",图标:"⚙"},{kind:"context",名:"上下文",图标:"ⓘ"},{kind:"event",名:"事件",图标:"·"}],Pw=new Map(E6.map(e=>[e.kind,e]));function ag(e){return Pw.get(e)?.名??e}function qw(e){return Pw.get(e)?.图标??"·"}const j6=e=>{if(e===void 0)return null;const t=Date.parse(e);return Number.isNaN(t)?null:t},Ga=e=>Math.min(100,Math.max(0,e));function T6(e,t){if(t==="sequence")return e.map(()=>({left:0,width:100}));const i=e.map(f=>j6(f.ts)),r=i.filter(f=>f!==null),a=r.length>0?Math.min(...r):null,c=r.length>0?Math.max(...r):null,h=a===null||c===null?0:c-a;if(t==="duration"){const f=e.reduce((m,v)=>m+(v.durationMs??0),0);if(f<=0)return e.map(()=>null);let g=0;return e.map(m=>{if(m.durationMs===void 0)return null;const v=m.durationMs/f*100,_=g/f*100;return g+=m.durationMs,{left:Ga(_),width:Ga(v)}})}return e.map((f,g)=>{const m=i[g]??null;if(m===null||a===null)return null;const v=h<=0?0:(m-a)/h*100;if(t==="time")return{left:Ga(v),width:.6};const _=h<=0?0:(f.durationMs??0)/h*100;return{left:Ga(v),width:Ga(Math.max(.4,_))}})}function Il(e){if(e===void 0||!Number.isFinite(e)||e<0)return null;if(e<1e3)return`${String(Math.round(e))} ms`;if(e<6e4)return`${(e/1e3).toFixed(1)} s`;const t=Math.floor(e/6e4),i=Math.round(e%6e4/1e3);return`${String(t)} 分 ${String(i)} 秒`}const ou=e=>e.toLocaleString("en-US");function ao(e){if(e===void 0)return"未记录用量";const t=[`提示 ${ou(e.promptTokens)}`,`输出 ${ou(e.completionTokens)}`];return e.cachedTokens!==void 0&&t.push(`缓存 ${ou(e.cachedTokens)}`),e.reasoningTokens!==void 0&&t.push(`推理 ${ou(e.reasoningTokens)}`),t.join(" · ")}function Fw(e){let t=0,i=0,r=0,a=0,c=!1,h=!1,f=!1;for(const g of e){const m=g.usage;m!==void 0&&(c=!0,t+=m.promptTokens,i+=m.completionTokens,m.cachedTokens!==void 0&&(h=!0,r+=m.cachedTokens),m.reasoningTokens!==void 0&&(f=!0,a+=m.reasoningTokens))}if(c)return{promptTokens:t,completionTokens:i,...h?{cachedTokens:r}:{},...f?{reasoningTokens:a}:{}}}function D6(e){const t=e.flatMap(a=>a.steps),i=[...e.flatMap(a=>a.cells),...t.flatMap(a=>a.cells)],r=t.reduce((a,c)=>a+(c.durationMs??0),0);return{轮数:e.length,步数:t.length,格数:i.length,工具数:i.filter(a=>a.kind==="tool-call").length,时长Ms:r>0?r:null,用量:Fw(t)}}function M6(e,t,i){if(i.trim()!=="")return{视图:e,隐藏轮数:0};const r=Math.max(0,e.length-t);return{视图:e.slice(r),隐藏轮数:r}}function A6(e,t){const i=t.trim();return i===""?e:e.filter(r=>Ll(r,i))}function Ll(e,t){const i=t.trim().toLowerCase();return i===""?!0:[e.label??"",ag(e.kind),e.ref??""].some(a=>a.toLowerCase().includes(i))}const cu=8,nx=e=>{for(const t of e)if(t.ts!==void 0)return t.ts},vp=e=>{if(e===void 0)return"";const t=new Date(e);return Number.isNaN(t.getTime())?"":t.toLocaleTimeString("zh-CN",{hour:"2-digit",minute:"2-digit",second:"2-digit"})},yp=e=>typeof e=="object"&&e!==null?e:null;function R6(e,t){if(t!==void 0)for(const i of e){const r=yp(i);if(!(r?.type!=="message/assistant"||!Array.isArray(r.content)))for(const a of r.content){const c=yp(a);if(c?.toolCallId===t)return c.input}}}function O6(e,t){if(t!==void 0)for(const i of e){const r=yp(i);if(r?.type==="tool/result"&&r.toolCallId===t)return r.output}}const uu=e=>{if(e===void 0)return"";if(typeof e=="string")return e;try{return JSON.stringify(e,null,2)}catch{return String(e)}},ix=e=>e!==void 0&&!(typeof e=="string"&&e==="");function B6({session:e,项:t,累计用量:i}){const[r,a]=C.useState("概述"),[c,h]=C.useState(null),[f,g]=C.useState(null),[m,v]=C.useState(!1),{cell:_,step:S}=t,y=_.kind==="tool-call";C.useEffect(()=>{let A=!0;h(null),g(null),a("概述");const R=Math.max(1,_.toSeq-_.fromSeq+1);return x2(e,_.fromSeq,R).then(I=>{A&&h(I)}).catch(I=>{A&&g(I instanceof Error?I.message:String(I))}),()=>{A=!1}},[e,_.fromSeq,_.toSeq]);const x=c?.events??[],w=y?R6(x,_.ref):void 0,j=y?O6(x,_.ref):void 0,N=["概述",...y?["参数","结果"]:[],"计时","用量","原始 JSON"],M=A=>{navigator.clipboard.writeText(A).then(()=>{v(!0),window.setTimeout(()=>{v(!1)},1400)}).catch(()=>{v(!1)})};return u.jsxs("aside",{className:"traj-inspector","aria-label":"轨迹记录详情",children:[u.jsxs("div",{className:"traj-ins-head",children:[u.jsx("span",{className:"ic","aria-hidden":"true",children:qw(_.kind)}),u.jsx("span",{className:"t",children:ag(_.kind)}),u.jsxs("span",{className:"mut",children:["#",_.fromSeq,_.toSeq===_.fromSeq?"":`–${String(_.toSeq)}`]})]}),u.jsx("div",{className:"traj-tabs",role:"tablist",children:N.map(A=>u.jsx("button",{type:"button",role:"tab","aria-selected":r===A,className:r===A?"on":"",onClick:()=>{a(A)},children:A},A))}),u.jsxs("div",{className:"traj-ins-body",children:[f===null?null:u.jsxs("div",{className:"traj-ins-err",children:["正文回查失败:",f]}),r==="概述"?u.jsxs("dl",{className:"traj-facts",children:[u.jsx("dt",{children:"内容"}),u.jsx("dd",{children:_.label??"(无摘录)"}),u.jsx("dt",{children:"seq"}),u.jsxs("dd",{className:"mono",children:["#",_.fromSeq,_.toSeq===_.fromSeq?"":`–${String(_.toSeq)}`]}),u.jsx("dt",{children:"时长"}),u.jsx("dd",{children:Il(_.durationMs)??"不可用"}),u.jsx("dt",{children:"状态"}),u.jsx("dd",{children:_.durationMs===void 0&&_.kind==="tool-call"?"未记录结果时长":"已落盘"}),S?.model===void 0?null:u.jsxs(u.Fragment,{children:[u.jsx("dt",{children:"模型"}),u.jsx("dd",{className:"mono",children:S.model})]}),S?.usage===void 0?null:u.jsxs(u.Fragment,{children:[u.jsx("dt",{children:"用量"}),u.jsx("dd",{children:ao(S.usage)})]})]}):null,r==="参数"?ix(w)?u.jsxs(u.Fragment,{children:[u.jsx("div",{className:"traj-sec",children:"<工具入参>"}),u.jsx("pre",{className:"traj-pre",children:uu(w)}),u.jsx("button",{className:"btn",type:"button",onClick:()=>{M(uu(w))},children:m?"已复制":"复制参数"})]}):u.jsx("div",{className:"traj-ins-empty",children:"这次调用没记到入参"}):null,r==="结果"?c===null?u.jsx("div",{className:"traj-ins-empty",children:"读取中…"}):ix(j)?u.jsxs(u.Fragment,{children:[u.jsx("pre",{className:"traj-pre",children:uu(j)}),u.jsx("button",{className:"btn",type:"button",onClick:()=>{M(uu(j))},children:m?"已复制":"复制结果"})]}):u.jsx("div",{className:"traj-ins-empty",children:"这次调用没记到结果"}):null,r==="计时"?u.jsxs("dl",{className:"traj-facts",children:[u.jsx("dt",{children:"本格时长"}),u.jsx("dd",{children:Il(_.durationMs)??"不可用"}),u.jsx("dt",{children:"请求耗时"}),u.jsx("dd",{children:Il(S?.durationMs)??"不可用"}),u.jsx("dt",{children:"开始时刻"}),u.jsx("dd",{className:"mono",children:vp(_.ts)||"不可用"}),u.jsx("dt",{children:"首 token"}),u.jsx("dd",{children:"不可用(日志不落首 token 时刻,不编)"})]}):null,r==="用量"?u.jsxs("dl",{className:"traj-facts",children:[u.jsx("dt",{children:"本次请求"}),u.jsx("dd",{children:ao(S?.usage)}),u.jsx("dt",{children:"会话累计"}),u.jsx("dd",{children:i})]}):null,r==="原始 JSON"?c===null?u.jsx("div",{className:"traj-ins-empty",children:"读取中…"}):u.jsxs(u.Fragment,{children:[u.jsx("pre",{className:"traj-pre",children:JSON.stringify(x,null,2)}),u.jsx("button",{className:"btn",type:"button",onClick:()=>{M(JSON.stringify(x,null,2))},children:m?"已复制":"复制 JSON"})]}):null]})]})}function L6({session:e,title:t,onBack:i}){const[r,a]=C.useState(null),[c,h]=C.useState(e!==null),[f,g]=C.useState(null),[m,v]=C.useState("sequence"),[_,S]=C.useState(""),[y,x]=C.useState(cu),[w,j]=C.useState(new Set),[N,M]=C.useState(new Set),[A,R]=C.useState(null),[I,H]=C.useState(!1),O=C.useCallback(async()=>{if(e===null){a(null),h(!1);return}h(!0);try{const E=await b2(e);a(E),g(null)}catch(E){g(E instanceof Error?E.message:String(E))}finally{h(!1)}},[e]);C.useEffect(()=>{O()},[O]),C.useEffect(()=>{if(e===null)return;let E=!0;const J=async()=>{try{const pe=await fx(e);if(!E)return;H(pe.running),pe.running&&O()}catch{}};J();const se=window.setInterval(()=>{J()},2e3);return()=>{E=!1,window.clearInterval(se)}},[e,O]);const $=r?.turns??[],Q=r?.preamble??[],{视图:z,隐藏轮数:G}=C.useMemo(()=>M6($,cu,_),[$,_]),P=C.useMemo(()=>A6(Q,_),[Q,_]),L=C.useMemo(()=>D6($),[$]),F=C.useMemo(()=>[...Q.length>0?[0]:[],...z.map(E=>E.fromSeq)],[Q.length,z]),K=F.length>0&&F.every(E=>w.has(E)),q=z.flatMap(E=>E.steps).length>0&&z.flatMap(E=>E.steps).every(E=>N.has(E.fromSeq)),te=C.useMemo(()=>{const E=[];let J=0,se=0;if(P.length>0){const pe=w.has(0);if(E.push({type:"preamble",cells:P,时刻:nx(P),收起:pe}),!pe)for(const ce of P)E.push({type:"cell",项:{cell:ce,railIndex:se}}),se+=1}for(let pe=0;pe<z.length;pe+=1){const ce=z[pe];if(ce===void 0)continue;const _e=$.indexOf(ce)+1;if(!(!(ce.cells.some(oe=>Ll(oe,_))||ce.steps.some(oe=>oe.cells.some(ye=>Ll(ye,_))))&&_.trim()!=="")&&(E.push({type:"turn",轮号:_e,turn:ce,时刻:nx([...ce.cells,...ce.steps.flatMap(oe=>oe.cells)]),步数:ce.steps.length,格数:ce.cells.length+ce.steps.reduce((oe,ye)=>oe+ye.cells.length,0)}),!w.has(ce.fromSeq))){for(const oe of ce.cells)Ll(oe,_)&&(E.push({type:"cell",项:{cell:oe,railIndex:se}}),se+=1);for(const oe of ce.steps)if(J+=1,!(oe.cells.filter(Ne=>Ll(Ne,_)).length===0&&_.trim()!=="")&&(E.push({type:"step",请求号:J,step:oe,格数:oe.cells.length}),!N.has(oe.fromSeq)))for(const Ne of oe.cells)Ll(Ne,_)&&(E.push({type:"cell",项:{cell:Ne,step:oe,railIndex:se}}),se+=1)}}return E},[z,P,$,_,w,N]),ne=[];for(const E of te)E.type==="cell"&&ne.push(E.项.cell);const ge=T6(ne,m),D=(E,J,se,pe)=>{const ce=new Set(J);ce.has(se)?ce.delete(se):ce.add(se),E(ce)},De=()=>{j(K?new Set:new Set(F))},we=()=>{const E=z.flatMap(J=>J.steps).map(J=>J.fromSeq);M(q?new Set:new Set(E))},T=ao(Fw($.flatMap(E=>E.steps)));return e===null?u.jsxs("div",{className:"traj-page",children:[u.jsxs("div",{className:"traj-top",children:[u.jsxs("button",{className:"back",type:"button",onClick:i,children:[u.jsx("span",{"aria-hidden":"true",children:"←"})," 返回"]}),u.jsx("div",{className:"traj-name",children:"轨迹"})]}),u.jsxs("div",{className:"traj-empty",children:[u.jsx("div",{className:"eic",children:"◇"}),u.jsx("div",{className:"et",children:"先选一个会话"}),u.jsx("div",{className:"es",children:"轨迹从会话的事件日志派生;没有会话就没有可看的格。"})]})]}):u.jsxs("div",{className:"traj-page",children:[u.jsxs("div",{className:"traj-top",children:[u.jsxs("button",{className:"back",type:"button",onClick:i,children:[u.jsx("span",{"aria-hidden":"true",children:"←"})," 返回"]}),u.jsxs("div",{className:"traj-name",children:["轨迹 ",u.jsx("span",{className:"mut",children:t})]}),u.jsxs("div",{className:"traj-meta",children:[L.轮数," 轮 · ",L.步数," 步 · ",L.格数+Q.length," 格",L.时长Ms===null?"":` · ${Il(L.时长Ms)??""}`,L.用量===void 0?"":` · ${ao(L.用量)}`]}),u.jsx("div",{className:"grow"}),I?u.jsxs("span",{className:"chip live",children:[u.jsx("span",{className:"pulse"}),"运行中"]}):null,u.jsx("div",{className:"seg",role:"group","aria-label":"导轨投影",children:N6.map(E=>u.jsx("button",{type:"button",className:m===E.mode?"on":"",title:E.说明,"aria-pressed":m===E.mode,onClick:()=>{v(E.mode)},children:E.名},E.mode))}),u.jsx("input",{className:"traj-search",type:"search",value:_,placeholder:"搜索轨迹","aria-label":"搜索轨迹",onChange:E=>{S(E.target.value)}}),u.jsxs("button",{type:"button",className:K?"traj-fold on":"traj-fold","aria-pressed":K,title:K?"展开所有轮次":"收起所有轮次",onClick:De,children:[K?"⊞":"⊟"," 轮次"]}),u.jsxs("button",{type:"button",className:q?"traj-fold on":"traj-fold","aria-pressed":q,title:q?"展开所有请求":"收起所有请求",onClick:we,children:[q?"⊞":"⊟"," 请求"]})]}),f!==null?u.jsxs("div",{className:"conn-banner",children:[u.jsx("span",{className:"warn",children:"⚠"}),u.jsxs("span",{children:["轨迹载入失败:",f]}),u.jsx("button",{className:"btn",type:"button",onClick:()=>{O()},children:"重试"})]}):null,u.jsxs("div",{className:"traj-body",children:[u.jsx("div",{className:"traj-main",children:c&&r===null?u.jsxs("div",{className:"traj-skeleton","aria-label":"载入轨迹",children:[u.jsx("div",{className:"sk sk-head"}),u.jsx("div",{className:"sk sk-line"}),u.jsx("div",{className:"sk sk-line"}),u.jsx("div",{className:"sk sk-line short"})]}):te.length===0?u.jsxs("div",{className:"traj-empty",children:[u.jsx("div",{className:"eic",children:"◇"}),u.jsx("div",{className:"et",children:$.length===0&&Q.length===0?"这个会话还没有轨迹":"没有匹配的格"}),u.jsx("div",{className:"es",children:$.length===0&&Q.length===0?"轨迹由事件日志派生:发一句话、跑一次工具之后就会出现。":"换个关键词,或清空搜索框。"})]}):u.jsxs("table",{className:"traj-table","aria-label":"轨迹账本",children:[u.jsxs("colgroup",{children:[u.jsx("col",{className:"c-kind"}),u.jsx("col",{className:"c-label"}),u.jsx("col",{className:"c-seq"}),u.jsx("col",{className:"c-dur"}),u.jsx("col",{className:"c-rail"})]}),u.jsx("thead",{children:u.jsxs("tr",{children:[u.jsx("th",{children:"类型"}),u.jsx("th",{children:"内容"}),u.jsx("th",{children:"seq"}),u.jsx("th",{children:"时长"}),u.jsx("th",{children:"导轨"})]})}),u.jsxs("tbody",{children:[G>0?u.jsx("tr",{className:"traj-more",children:u.jsx("td",{colSpan:5,children:u.jsxs("button",{type:"button",className:"btn",onClick:()=>{x(E=>E+cu)},children:["载入更早的 ",Math.min(G,cu)," 轮(还剩 ",G," 轮)"]})})}):null,te.map((E,J)=>{if(E.type==="preamble")return u.jsx("tr",{className:"traj-turn-row",onClick:()=>{D(j,w,0)},children:u.jsxs("td",{colSpan:5,children:[u.jsx("span",{className:"chev",children:E.收起?"▸":"▾"}),u.jsx("span",{className:"th",children:"启动前"}),u.jsxs("span",{className:"mut",children:[E.cells.length," 格 · 首次用户消息之前"]}),u.jsx("span",{className:"time",children:vp(E.时刻)})]})},"preamble");if(E.type==="turn"){const oe=w.has(E.turn.fromSeq);return u.jsx("tr",{className:"traj-turn-row",onClick:()=>{D(j,w,E.turn.fromSeq)},children:u.jsxs("td",{colSpan:5,children:[u.jsx("span",{className:"chev",children:oe?"▸":"▾"}),u.jsxs("span",{className:"th",children:["第 ",E.轮号," 轮"]}),u.jsxs("span",{className:"mut",children:[E.步数," 步 · ",E.格数," 格"]}),u.jsx("span",{className:"time",children:vp(E.时刻)})]})},`t-${String(E.turn.fromSeq)}`)}if(E.type==="step"){const oe=N.has(E.step.fromSeq);return u.jsx("tr",{className:"traj-step-row",onClick:()=>{D(M,N,E.step.fromSeq)},children:u.jsxs("td",{colSpan:5,children:[u.jsx("span",{className:"chev",children:oe?"▸":"▾"}),u.jsxs("span",{className:"req",children:["请求 #",E.请求号]}),E.step.model===void 0?null:u.jsx("span",{className:"mut mono",children:E.step.model}),E.step.usage===void 0?null:u.jsx("span",{className:"mut",children:ao(E.step.usage)}),E.step.durationMs===void 0?null:u.jsx("span",{className:"mut",children:Il(E.step.durationMs)}),u.jsxs("span",{className:"mut",children:[E.格数," 格"]})]})},`s-${String(E.step.fromSeq)}`)}const{cell:se,step:pe,railIndex:ce}=E.项,_e=ge[ce]??null,ke=A!==null&&A.cell.fromSeq===se.fromSeq&&A.cell.kind===se.kind;return u.jsxs("tr",{className:ke?"traj-cell-row sel":"traj-cell-row",tabIndex:0,onClick:()=>{R({cell:se,step:pe,railIndex:ce})},onKeyDown:oe=>{oe.key==="Enter"&&R({cell:se,step:pe,railIndex:ce})},children:[u.jsxs("td",{className:"k",children:[u.jsx("span",{className:`ic ${se.kind==="tool-call"?"tool":se.kind==="assistant-text"?"as":""}`,"aria-hidden":"true",children:qw(se.kind)}),ag(se.kind)]}),u.jsx("td",{className:"label",title:se.label??"",children:se.label??"(无摘录)"}),u.jsxs("td",{className:"seq mono",children:["#",se.fromSeq,se.toSeq===se.fromSeq?"":`–${String(se.toSeq)}`]}),u.jsx("td",{className:"dur mono",children:Il(se.durationMs)??"—"}),u.jsx("td",{className:"rail",children:u.jsx("span",{className:"track",children:_e===null?null:u.jsx("i",{className:"bar",style:{left:`${String(_e.left)}%`,width:`${String(_e.width)}%`}})})})]},`c-${String(se.fromSeq)}-${se.kind}-${String(J)}`)})]})]})}),A===null?null:u.jsx(B6,{session:e,项:A,累计用量:T})]})]})}function z6(e,t=20){return Re(`/search?all=1&limit=${String(t)}&q=${encodeURIComponent(e)}`)}const Al={grouping:"workspace",sorting:"recent",filter:"all"},$w="daluo.sidebar.view",H6=["workspace","tree","flat"],I6=["manual","recent"],U6=["active","all","archived"];function P6(e){try{const t=e?.getItem($w);if(t==null)return Al;const i=JSON.parse(t);if(typeof i!="object"||i===null)return Al;const r=i;return{grouping:H6.includes(r.grouping)?r.grouping:Al.grouping,sorting:I6.includes(r.sorting)?r.sorting:Al.sorting,filter:U6.includes(r.filter)?r.filter:Al.filter}}catch{return Al}}function q6(e,t){try{t?.setItem($w,JSON.stringify(e))}catch{}}const Vw=(e,t)=>t===""||(e.title??e.name).toLowerCase().includes(t),Rl=e=>e.reduce((t,i)=>Math.max(t,i.row.lastActiveMs),0);function Ou(e,t){return t==="manual"?e:[...e].sort((i,r)=>r.row.lastActiveMs-i.row.lastActiveMs)}function F6(e){const t=e.lastIndexOf("/");return t>0?e.slice(0,t):"/"}function $6(e,t,i=""){const r=i.trim().toLowerCase(),a=[];for(const h of e)for(const f of h.sessions)Vw(f,r)&&f.archived&&a.push({row:f,group:h});if(t.filter==="archived"){const h=Ou(a,t.sorting);return{sections:[],archivedRows:h,total:0}}if(t.filter==="active"&&a.length>0)return{sections:fm(e,t,r),archivedRows:[],total:sx(fm(e,t,r))};const c=fm(e,t,r);return{sections:c,archivedRows:t.sorting==="manual"?a:Ou(a,t.sorting),total:sx(c)}}function sx(e){return e.reduce((t,i)=>t+i.rows.length,0)}function fm(e,t,i){const r=c=>Ou(c.sessions.filter(h=>!h.archived&&Vw(h,i)).map(h=>({row:h,group:c})),t.sorting);if(t.grouping==="flat"){const c=[];for(const f of e)c.push(...r(f));const h=t.sorting==="manual"?c:Ou(c,t.sorting);return h.length===0?[]:[{key:"flat",title:"全部会话",depth:0,root:"",active:!1,rows:h}]}if(t.grouping==="tree"){const c=new Map;for(const g of e){const m=r(g);if(m.length===0)continue;const v=F6(g.root),_={key:g.root,title:g.name,depth:1,root:g.root,active:g.active,rows:m};c.set(v,[...c.get(v)??[],_])}const h=[...c.keys()];t.sorting==="recent"&&h.sort((g,m)=>Rl(c.get(m).flatMap(v=>v.rows))-Rl(c.get(g).flatMap(v=>v.rows)));const f=[];for(const g of h){const m=c.get(g);t.sorting==="recent"&&m.sort((v,_)=>Rl(_.rows)-Rl(v.rows)),f.push({key:`tree:${g}`,title:g.split("/").filter(Boolean).at(-1)??g,depth:0,root:g,active:!1,rows:[]}),f.push(...m)}return f}const a=[];for(const c of e){const h=r(c);h.length!==0&&a.push({key:c.root,title:c.name,depth:0,root:c.root,active:c.active,rows:h})}return t.sorting==="recent"&&a.sort((c,h)=>Rl(h.rows)-Rl(c.rows)),a}function Kw(e,t=Date.now()){if(!Number.isFinite(e)||e<=0)return"";const i=t-e;if(i<6e4)return"刚刚";if(i<36e5)return`${String(Math.floor(i/6e4))} 分钟前`;if(i<864e5)return`${String(Math.floor(i/36e5))} 小时前`;if(i<1728e5)return"昨天";if(i<7*864e5)return`${String(Math.floor(i/864e5))} 天前`;const r=new Date(e),a=String(r.getMonth()+1).padStart(2,"0"),c=String(r.getDate()).padStart(2,"0");return`${a}-${c}`}function V6(e,t=Date.now()){let i=0;for(const r of e)r.lastActiveMs>i&&(i=r.lastActiveMs);return Kw(i,t)}function K6(e,t=Date.now()){if(!Number.isFinite(e)||e<=0)return"";const i=new Date(e);return new Date(t).toDateString()===i.toDateString()?`${String(i.getHours()).padStart(2,"0")}:${String(i.getMinutes()).padStart(2,"0")}`:`${String(i.getMonth()+1).padStart(2,"0")}-${String(i.getDate()).padStart(2,"0")}`}const Ui=(e,t)=>e!==null&&e.root===t.root&&e.name===t.name;function Y6({text:e,query:t}){if(t==="")return u.jsx(u.Fragment,{children:e});const i=e.toLowerCase().indexOf(t.toLowerCase());return i<0?u.jsx(u.Fragment,{children:e}):u.jsxs(u.Fragment,{children:[e.slice(0,i),u.jsx("mark",{children:e.slice(i,i+t.length)}),e.slice(i+t.length)]})}function W6({labels:e}){return u.jsx("span",{className:"label-chips",children:Object.entries(e).map(([t,i])=>u.jsxs("span",{className:"label-chip",title:`${t}: ${i}`,children:[u.jsx("span",{className:"k",children:t}),i]},t))})}const rx=e=>e.labels??{},X6=[["workspace","按工作区"],["tree","按工作区树"],["flat","单列表"]],G6=[["manual","手动排序"],["recent","最近更新"]],Q6=[["active","隐藏已归档"],["all","全部对话(显示已归档)"],["archived","仅显示已归档"]];function Z6({groups:e,activeName:t,loading:i,loadError:r,onNewChat:a,onOpenFolder:c,onSelect:h,onRename:f,onDelete:g,onPin:m,onArchive:v,onLabels:_,onReload:S,onOpenSettings:y,onOpenSearchHit:x}){const[w,j]=C.useState(""),[N,M]=C.useState([]),[A,R]=C.useState(!1),[I,H]=C.useState(null),[O,$]=C.useState(new Set),[Q,z]=C.useState(null),[G,P]=C.useState(null),[L,F]=C.useState(""),[K,q]=C.useState(null),[te,ne]=C.useState(null),[ge,D]=C.useState(null),[De,we]=C.useState(null),[T,E]=C.useState(null),[J,se]=C.useState([]),[pe,ce]=C.useState(null),[_e,ke]=C.useState(!1),[oe,ye]=C.useState(!1),[Ne,ct]=C.useState(()=>P6(typeof window>"u"?void 0:window.localStorage)),[ht,Je]=C.useState(!1),Ke=C.useRef(null),qe=C.useRef(null);C.useEffect(()=>{const ae=w.trim();if(ae===""){M([]),R(!1),H(null);return}let be=!1;R(!0),H(null);const X=window.setTimeout(()=>{z6(ae).then(Se=>{be||M(Se.hits)}).catch(Se=>{be||(M([]),H(Se instanceof Error?Se.message:String(Se)))}).finally(()=>{be||R(!1)})},250);return()=>{be=!0,window.clearTimeout(X)}},[w]),C.useEffect(()=>{const ae=be=>{(be.metaKey||be.ctrlKey)&&be.key.toLowerCase()==="k"&&(be.preventDefault(),Ke.current?.focus())};return window.addEventListener("keydown",ae),()=>{window.removeEventListener("keydown",ae)}},[]),C.useEffect(()=>{if(!ht)return;const ae=X=>{qe.current!==null&&!qe.current.contains(X.target)&&Je(!1)},be=X=>{X.key==="Escape"&&Je(!1)};return document.addEventListener("mousedown",ae),document.addEventListener("keydown",be),()=>{document.removeEventListener("mousedown",ae),document.removeEventListener("keydown",be)}},[ht]),C.useEffect(()=>{if(De===null)return;const ae=setTimeout(()=>{we(null)},1500);return()=>{clearTimeout(ae)}},[De]);const le=C.useMemo(()=>$6(e,Ne,w),[e,Ne,w]),{sections:me,archivedRows:Te,total:He}=le;C.useEffect(()=>{q6(Ne,typeof window>"u"?void 0:window.localStorage),Ne.filter==="archived"&&ye(!0)},[Ne]);const Ee=ae=>{z(be=>Ui(be,ae)?null:ae),q(null),ne(null)},Be=(ae,be)=>{z(null),P(ae),F(be.title??be.name),D(null)},jt=async(ae,be)=>{const X=L.trim();if(X===""){D({key:ae,message:"名字不能为空"});return}try{await f(be,X),P(null)}catch(Se){D({key:ae,message:Se instanceof Error?Se.message:String(Se)})}},Tt=async ae=>{z(null);const be=`${location.origin}/?session=${encodeURIComponent(ae.name)}`;try{await navigator.clipboard.writeText(be),we(ae)}catch{D({key:ae,message:`复制失败,手动复制:${be}`})}},re=(ae,be)=>{z(null),E({key:ae,row:be}),se(hR(be.labels)),ce(null)},ve=async()=>{if(!(T===null||_e)){ke(!0),ce(null);try{await _(T.row,dR(J)),E(null)}catch(ae){ce(ae instanceof Error?ae.message:String(ae))}finally{ke(!1)}}},ze=async(ae,be)=>{ne(null),z(null);try{await v(be,!0)}catch(X){D({key:ae,message:X instanceof Error?X.message:String(X)})}};return u.jsxs("aside",{className:"sidebar","data-dsh-surface":"sidebar",children:[u.jsxs("div",{className:"brand",children:[u.jsx("div",{className:"brand-mark",title:"大罗 · 层天",children:"✦"}),u.jsx("div",{children:u.jsx("div",{className:"brand-name",children:"大罗"})}),u.jsx("div",{className:"brand-sub",children:document.querySelector('meta[name="daluo-version-label"]')?.getAttribute("content")??""}),u.jsx("button",{className:"icon-btn",title:"收起侧栏","aria-label":"收起侧栏",children:u.jsxs("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",children:[u.jsx("rect",{x:"3",y:"4",width:"18",height:"16",rx:"2"}),u.jsx("path",{d:"M9 4v16"})]})})]}),u.jsxs("button",{className:"new-chat","data-dsh-part":"new-session",onClick:a,children:[u.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:u.jsx("path",{d:"M12 5v14M5 12h14"})}),"新会话",u.jsx("kbd",{children:"⌘N"})]}),c!==void 0?u.jsxs("button",{className:"open-folder","data-dsh-part":"open-folder",title:"选择本机文件夹作为工作区(系统对话框)",onClick:c,children:[u.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",children:u.jsx("path",{d:"M3 7a2 2 0 0 1 2-2h4l2 2h8a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z"})}),"打开文件夹…"]}):null,u.jsxs("div",{className:"search-line",ref:qe,children:[u.jsxs("div",{className:w===""?"search":"search searching",children:[u.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.9",children:[u.jsx("circle",{cx:"11",cy:"11",r:"7"}),u.jsx("path",{d:"m20 20-3.5-3.5"})]}),u.jsx("input",{ref:Ke,value:w,placeholder:"搜索会话…","aria-label":"搜索会话",onChange:ae=>{j(ae.target.value)},onKeyDown:ae=>{ae.key==="Escape"&&(j(""),ae.currentTarget.blur())}}),w===""?u.jsx("kbd",{children:"⌘K"}):u.jsx("button",{className:"clear",title:"清空 (Esc)",onClick:()=>{j(""),Ke.current?.focus()},children:"✕"})]}),u.jsx("button",{className:ht?"sb-view-btn on":"sb-view-btn",type:"button",title:"分组 / 排序 / 筛选","aria-label":"分组 / 排序 / 筛选",onClick:()=>{Je(ae=>!ae)},children:"⇅"}),ht?u.jsxs("div",{className:"sb-view-menu",children:[u.jsx("div",{className:"sb-menu-head",children:"分组方式"}),X6.map(([ae,be])=>u.jsxs("button",{className:"sb-opt",type:"button",onClick:()=>{ct(X=>({...X,grouping:ae})),Je(!1)},children:[u.jsx("span",{className:"g",children:Ne.grouping===ae?"✓":" "}),be]},ae)),u.jsx("div",{className:"sb-menu-head",children:"排序方式"}),G6.map(([ae,be])=>u.jsxs("button",{className:"sb-opt",type:"button",onClick:()=>{ct(X=>({...X,sorting:ae})),Je(!1)},children:[u.jsx("span",{className:"g",children:Ne.sorting===ae?"✓":" "}),be]},ae)),u.jsx("div",{className:"sb-menu-head",children:"筛选会话"}),Q6.map(([ae,be])=>u.jsxs("button",{className:"sb-opt",type:"button",onClick:()=>{ct(X=>({...X,filter:ae})),Je(!1)},children:[u.jsx("span",{className:"g",children:Ne.filter===ae?"✓":" "}),be]},ae))]}):null]}),u.jsxs("div",{className:"sessions",children:[w!==""?u.jsxs("div",{className:"result-meta",children:[He," 个标题结果 · Esc 清空"]}):null,w===""||x===void 0?null:u.jsxs("div",{className:"content-hits",children:[u.jsxs("div",{className:"content-hits-head",children:["内容命中",A?" · 检索中…":N.length===0?" · 无":` · ${String(N.length)}`]}),I===null?null:u.jsx("div",{className:"content-hit-err",children:I}),N.map(ae=>u.jsxs("button",{className:"search-hit",type:"button",title:`${ae.workspace} · ${ae.file} · seq ${String(ae.seq)}`,onClick:()=>{x(ae)},children:[u.jsxs("div",{className:"search-hit-meta",children:[u.jsx("span",{className:"ws",children:ae.workspace}),u.jsx("span",{className:"role",children:ae.role==="user"?"你":"大罗"}),u.jsxs("span",{className:"seq",children:["#",String(ae.seq)]}),u.jsx("span",{className:"ts",children:new Date(ae.ts).toLocaleTimeString("zh-CN",{hour:"2-digit",minute:"2-digit"})})]}),u.jsx("div",{className:"search-hit-snippet",children:ae.snippet})]},`${ae.root}/${ae.file}/${String(ae.seq)}`))]}),i&&e.length===0?u.jsx("div",{className:"sessions-state",children:"读取会话列表…"}):null,r===null?null:u.jsxs("div",{className:"sessions-state",children:[u.jsxs("span",{className:"err",children:["会话列表读不到:",r]}),u.jsx("button",{className:"link-btn",onClick:()=>{S()},children:"重试"})]}),!i&&r===null&&He===0&&w!==""?u.jsxs("div",{className:"empty-result",children:[u.jsx("span",{className:"big",children:"◇"}),"没有找到「",w,"」",u.jsx("br",{}),"按 Esc 清空搜索"]}):null,!i&&r===null&&He===0&&w===""?u.jsxs("div",{className:"empty-result",children:[u.jsx("span",{className:"big",children:"◇"}),Te.length===0?Ne.filter==="archived"?"还没有已归档会话":"还没有会话":Ne.filter==="archived"?"":"没有活跃会话",u.jsx("br",{}),Te.length===0?"点「新会话」开始":Ne.filter==="archived"?"这里只显示已归档会话":`展开下面的「已归档 ${String(Te.length)}」`]}):null,me.map(ae=>u.jsxs("div",{className:`group${ae.depth>0?" tree-child":""}`,"data-open":!O.has(ae.key)||w!=="",children:[u.jsxs("div",{className:"group-label",title:ae.root===""?ae.title:ae.root,style:ae.depth>0?{paddingLeft:"26px"}:void 0,onClick:()=>{$(be=>{const X=new Set(be);return X.has(ae.key)?X.delete(ae.key):X.add(ae.key),X})},children:[u.jsx("svg",{className:"chev",width:"11",height:"11",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.2",children:u.jsx("path",{d:"m6 9 6 6 6-6"})}),u.jsx("span",{className:"g",children:"▤"}),u.jsx("span",{className:"dir",children:ae.title}),ae.active?u.jsx("span",{className:"here",children:"当前"}):null,u.jsx("span",{className:"recent",children:ae.rows.length===0?"":V6(ae.rows.map(be=>be.row))}),ae.rows.length===0?null:u.jsx("span",{className:"count",children:ae.rows.length})]}),u.jsx("div",{className:"group-items",children:ae.rows.map(({row:be,group:X})=>{const Se={root:X.root,name:be.name},Ge=be.title??be.name,pt=Object.keys(rx(be)).length>0;return u.jsxs("div",{className:"row-menu",children:[Ui(G,Se)?u.jsxs("div",{className:"session editing",children:[u.jsx("span",{className:"dot"}),u.jsx("input",{className:"rename-input",ref:Qe=>{Qe!==null&&(Qe.focus({preventScroll:!0}),Qe.select())},value:L,onChange:Qe=>{F(Qe.target.value)},onKeyDown:Qe=>{Qe.key==="Enter"?(Qe.preventDefault(),jt(Se,be)):Qe.key==="Escape"&&(P(null),D(null))},onBlur:()=>{P(null)}})]}):u.jsxs("div",{className:`session${be.name===t&&X.active?" active":""}${Ui(Q,Se)?" menu-open":""}${pt?" has-labels":""}`,onClick:()=>{h(be,X)},children:[u.jsx("span",{className:"dot"}),u.jsx("span",{className:"title",children:u.jsx(Y6,{text:Ge,query:w})}),be.forkedFrom===void 0?null:u.jsx("span",{className:"fork-badge",title:`从 ${be.forkedFrom.file} 的 seq ${String(be.forkedFrom.seq)} 分叉`,children:"分叉"}),Ui(De,Se)?u.jsx("span",{className:"meta",children:"已复制"}):null,Ui(De,Se)?null:be.waiting===!0?u.jsx("span",{className:"meta waiting",children:"!"}):be.running===!0?u.jsx("span",{className:"meta running",children:"●"}):u.jsx("span",{className:"meta",children:K6(be.lastActiveMs)}),X.active?u.jsx("button",{className:"more",title:"会话操作","aria-label":"会话操作",onClick:Qe=>{Qe.stopPropagation(),Ee(Se)},children:"⋯"}):null,pt?u.jsx(W6,{labels:rx(be)}):null]}),Ui(Q,Se)?u.jsxs("div",{className:"menu row-menu-pop",children:[u.jsx("div",{className:"menu-head",children:"会话操作"}),u.jsxs("button",{className:"menu-item",onClick:()=>{Be(Se,be)},children:[u.jsx("span",{className:"g",children:"✎"})," 重命名",u.jsx("span",{className:"key",children:"F2"})]}),u.jsxs("button",{className:"menu-item",onClick:()=>{z(null),m(be).catch(Qe=>{D({key:Se,message:Qe instanceof Error?Qe.message:String(Qe)})})},children:[u.jsx("span",{className:"g",children:"↧"})," 置顶",u.jsx("span",{className:"key"})]}),u.jsxs("button",{className:"menu-item",onClick:()=>{Tt(Se)},children:[u.jsx("span",{className:"g",children:"⑂"})," 复制会话链接",u.jsx("span",{className:"key"})]}),u.jsx("div",{className:"menu-sep"}),u.jsxs("button",{className:"menu-item",onClick:()=>{re(Se,be)},children:[u.jsx("span",{className:"g",children:"⌁"})," 标签…",u.jsx("span",{className:"key"})]}),u.jsxs("button",{className:"menu-item",onClick:()=>{z(null),ne(Se),D(null)},children:[u.jsx("span",{className:"g",children:"▣"})," 归档",u.jsx("span",{className:"key"})]}),u.jsx("div",{className:"menu-sep"}),u.jsxs("button",{className:"menu-item danger",onClick:()=>{z(null),q(Se),D(null)},children:[u.jsx("span",{className:"g",children:"✕"})," 删除会话",u.jsx("span",{className:"key",children:"⌫"})]})]}):null,Ui(te,Se)?u.jsxs("div",{className:"confirm archived-confirm",children:[u.jsxs("div",{className:"t",children:["归档会话 ",u.jsxs("b",{className:"t-name",children:["「",Ge,"」"]}),"?",u.jsx("br",{}),"从主列表移到「已归档」,日志不动;随时可以恢复。"]}),u.jsxs("div",{className:"a",children:[u.jsx("button",{className:"btn",onClick:()=>{ne(null)},children:"取消"}),u.jsx("button",{className:"btn primary",onClick:()=>{ze(Se,be)},children:"归档"})]})]}):null,Ui(K,Se)?u.jsxs("div",{className:"confirm",children:[u.jsxs("div",{className:"t",children:["删除会话 ",u.jsxs("b",{children:["「",Ge,"」"]}),"?",u.jsx("br",{}),"会话日志会一起删除,不可恢复。"]}),u.jsxs("div",{className:"a",children:[u.jsx("button",{className:"btn",onClick:()=>{q(null)},children:"取消"}),u.jsx("button",{className:"btn danger-solid",onClick:()=>{g(be).then(()=>{q(null)},Qe=>{D({key:Se,message:Qe instanceof Error?Qe.message:String(Qe)})})},children:"删除"})]})]}):null,ge!==null&&Ui(ge.key,Se)?u.jsx("div",{className:"action-error",children:ge.message}):null]},`${X.root}/${be.name}`)})})]},ae.key))]}),Te.length===0?null:u.jsxs("div",{className:"archived","data-open":Ne.filter==="archived"?!0:oe,children:[u.jsxs("button",{className:"archived-toggle","aria-expanded":oe,onClick:()=>{ye(ae=>!ae)},children:[u.jsx("span",{className:"chev",children:Ne.filter==="archived"||oe?"▾":"▸"})," 已归档 ",u.jsx("span",{className:"count",children:Te.length})]}),oe||Ne.filter==="archived"?u.jsx("div",{className:"archived-items",children:Te.map(({group:ae,row:be})=>{const X={root:ae.root,name:be.name},Se=be.title??be.name;return u.jsxs("div",{className:"row-menu",children:[u.jsxs("div",{className:"session archived-row",title:"点开查看;取消归档会把它放回主列表",onClick:()=>{h(be,ae)},children:[u.jsx("span",{className:"dot"}),u.jsx("span",{className:"title",children:Se}),u.jsx("button",{className:"unarchive",onClick:Ge=>{Ge.stopPropagation(),v(be,!1).catch(pt=>{D({key:X,message:pt instanceof Error?pt.message:String(pt)})})},children:"取消归档"})]}),ge!==null&&Ui(ge.key,X)?u.jsx("div",{className:"action-error",children:ge.message}):null]},`${ae.root}/${be.name}`)})}):null]}),u.jsx("div",{className:"sidebar-foot",children:u.jsxs("button",{className:"foot-item",onClick:y,children:[u.jsx("span",{className:"g",style:{width:"15px",textAlign:"center"},children:"⚙"}),"设置",u.jsx("span",{className:"spacer"}),u.jsx("kbd",{children:"⌘,"})]})}),T===null?null:u.jsx("div",{className:"modal-backdrop label-backdrop",onClick:()=>{_e||E(null)},children:u.jsxs("div",{className:"modal-card",role:"dialog","aria-label":"编辑标签",onClick:ae=>{ae.stopPropagation()},children:[u.jsxs("div",{className:"modal-head",children:["编辑标签 ",u.jsx("span",{className:"mut",children:T.row.title??T.row.name})]}),u.jsxs("div",{className:"modal-body",children:[u.jsx("div",{className:"label-rows",children:J.map((ae,be)=>u.jsxs("div",{className:"label-row",children:[u.jsx("input",{className:"label-key",value:ae.key,placeholder:"键(如 run / pr / ticket)","aria-label":"标签键",onChange:X=>{const Se=X.target.value;se(Ge=>Ge.map((pt,Qe)=>Qe===be?{...pt,key:Se}:pt))}}),u.jsx("span",{className:"sep",children:"="}),u.jsx("input",{className:"label-val",value:ae.value,placeholder:"值","aria-label":"标签值",onChange:X=>{const Se=X.target.value;se(Ge=>Ge.map((pt,Qe)=>Qe===be?{...pt,value:Se}:pt))}}),u.jsx("button",{className:"label-del",title:"删除",onClick:()=>{se(X=>X.filter((Se,Ge)=>Ge!==be))},children:"✕"})]},be))}),u.jsx("button",{className:"add-label",onClick:()=>{se(ae=>[...ae,{key:"",value:""}])},children:"+ 添加标签"}),u.jsxs("div",{className:"modal-note",children:["标签写进日志(",u.jsx("code",{children:"session/labels"}),"),只作关联标识、不进决策链;",u.jsx("b",{children:"键和值都是自由字符串"}),",",u.jsx("code",{children:"{}"})," 清空。会话在跑时改不了(日志归那一轮写,服务端 409)。"]}),pe===null?null:u.jsx("div",{className:"dialog-error",children:pe})]}),u.jsxs("div",{className:"modal-foot",children:[u.jsx("button",{className:"btn",disabled:_e,onClick:()=>{E(null)},children:"取消"}),u.jsx("button",{className:"btn primary",disabled:_e,onClick:()=>{ve()},children:"保存标签"})]})]})})]})}function J6({tabs:e,active:t,titles:i,onSelect:r,onClose:a,onNew:c}){return e.length===0?null:u.jsxs("div",{className:"session-tabs",role:"tablist","aria-label":"打开的会话",children:[e.map(h=>{const f=i.get(h)??h;return u.jsxs("span",{className:h===t?"session-tab active":"session-tab",children:[u.jsx("button",{role:"tab","aria-selected":h===t,title:f,className:"session-tab-label",onClick:()=>{r(h)},children:f}),u.jsx("button",{className:"session-tab-x",title:"关闭页签","aria-label":`关闭 ${f}`,onClick:g=>{g.stopPropagation(),a(h)},children:"×"})]},h)}),u.jsx("button",{className:"session-tab add",title:"新建会话","aria-label":"新建会话",onClick:c,children:"+"})]})}function eL(e,t,i=Date.now()){const r=t.trim();return r===""?[...e]:[...e,{role:"user",text:r,at:i}]}function lx(e,t,i=Date.now()){const r=(t??"").trim();return[...e,{role:"assistant",text:r===""?"(模型没有返回正文)":r,at:i}]}function tL(e,t=18){const i=(e??"").trim();return i===""?"旁路对话":i.length>t?`旁路 · ${i.slice(0,t)}…`:`旁路 · ${i}`}function nL({open:e,mainTitle:t,onClose:i}){const[r,a]=C.useState([]),[c,h]=C.useState(void 0),[f,g]=C.useState(""),[m,v]=C.useState(!1),[_,S]=C.useState(null),y=async()=>{const x=f.trim();if(!(x===""||m)){g(""),S(null),a(w=>eL(w,x)),v(!0);try{const w=await du(x,c);c===void 0&&(h(w.logFile),cx(w.logFile,!0).catch(()=>{})),a(j=>lx(j,w.reply))}catch(w){const j=w instanceof Error?w.message:String(w);S(j),a(N=>lx(N,`发送失败:${j}`))}finally{v(!1)}}};return e?u.jsxs("aside",{className:"sidechat","aria-label":"旁路对话",children:[u.jsxs("div",{className:"sidechat-head",children:[u.jsx("b",{children:tL(t)}),u.jsx("span",{className:"sidechat-sub",children:"独立小对话 · 不写主会话日志"}),u.jsx("span",{style:{flex:1}}),u.jsx("button",{className:"icon-btn",title:"关闭旁路对话","aria-label":"关闭旁路对话",onClick:i,children:"✕"})]}),u.jsxs("div",{className:"sidechat-list",children:[r.length===0?u.jsx("div",{className:"sidechat-empty",children:"问点不打断主会话的问题(例如「刚才那个报错原文是什么」)。"}):null,r.map((x,w)=>u.jsxs("div",{className:x.role==="user"?"sidechat-msg user":"sidechat-msg ai",children:[u.jsx("div",{className:"sidechat-role",children:x.role==="user"?"你":"大罗"}),u.jsx("div",{className:"sidechat-text",children:x.text})]},`${String(w)}-${String(x.at)}`)),m?u.jsx("div",{className:"sidechat-empty",children:"思考中…"}):null]}),_===null?null:u.jsx("div",{className:"sidechat-error",children:_}),u.jsxs("div",{className:"sidechat-form",children:[u.jsx("textarea",{value:f,rows:2,placeholder:"问一句(Enter 发送,Shift+Enter 换行)",onChange:x=>{g(x.target.value)},onKeyDown:x=>{x.key==="Enter"&&!x.shiftKey&&(x.preventDefault(),y())}}),u.jsx("button",{className:"btn",disabled:m||f.trim()==="",onClick:()=>{y()},children:"发送"})]})]}):null}const Ol={text:"",dropped:0};function iL(e,t){if(e===null||typeof e!="object")return t;const i=e;if(typeof i.delta=="string"&&i.delta!=="")return{text:t.text+i.delta,dropped:t.dropped};if(i.done===!0){const r=typeof i.dropped=="number"&&i.dropped>0?i.dropped:0;return{text:t.text,dropped:t.dropped+r}}return t}function sL(e){if(e===null||typeof e!="object")return null;const t=e,i=t.ui;if(i!==null&&typeof i=="object"){const r=i;if(r.kind==="打开文件"&&typeof r.path=="string"&&r.path!==""){const a=typeof r.line=="number"&&Number.isFinite(r.line)&&r.line>0?Math.floor(r.line):0,c=typeof r.rel=="string"&&r.rel!==""?r.rel:void 0;return{kind:"打开文件",path:r.path,line:a,...c===void 0?{}:{rel:c}}}if(r.kind==="交付文件"&&typeof r.path=="string"&&r.path!==""){const a=typeof r.rel=="string"&&r.rel!==""?r.rel:void 0,c=typeof r.size=="number"&&Number.isFinite(r.size)&&r.size>=0?Math.floor(r.size):0;return{kind:"交付文件",path:r.path,...a===void 0?{}:{rel:a},size:c}}return null}if(typeof t.uiDropped=="number"&&t.uiDropped>0){const r=t.uiDroppedKind==="交付文件"?"交付文件":"打开文件";return{kind:"丢弃",dropped:Math.floor(t.uiDropped),丢的是:r}}return null}function rL(e,t){const[i,r]=C.useState(null),[a,c]=C.useState(!1),[h,f]=C.useState(null),[g,m]=C.useState("connecting"),[v,_]=C.useState(Ol),S=C.useRef(!0),y=C.useRef(e);y.current=e;const x=C.useRef(t);x.current=t;const w=C.useCallback(async()=>{const j=y.current;if(j===null){r(null);return}try{const N=await d2(j);if(!S.current||y.current!==j)return;r(N),f(null),_(Ol)}catch(N){if(!S.current||y.current!==j)return;f(N instanceof Error?N.message:String(N))}},[]);return C.useEffect(()=>(S.current=!0,e===null?(r(null),f(null),_(Ol),c(!1),()=>{S.current=!1}):(c(!0),r(null),f(null),_(Ol),w().finally(()=>{S.current&&c(!1)}),()=>{S.current=!1})),[e,w]),C.useEffect(()=>{if(e===null){m("connecting");return}let j;const N=()=>{j!==void 0&&clearTimeout(j),j=setTimeout(()=>{w()},150)},M=new EventSource(`/events?session=${encodeURIComponent(e)}`);return M.onopen=()=>{m("open"),N()},M.onerror=()=>{m("closed")},M.onmessage=A=>{let R=null;try{R=JSON.parse(A.data)}catch{return}R!==null&&(R.type==="message/assistant"&&_(Ol),N())},()=>{j!==void 0&&clearTimeout(j),M.close(),m("connecting")}},[e,w]),C.useEffect(()=>{if(e===null){_(Ol);return}const j=new EventSource(`/live?session=${encodeURIComponent(e)}`);return j.onmessage=N=>{let M=null;try{M=JSON.parse(N.data)}catch{return}_(R=>iL(M,R));const A=sL(M);A!==null&&x.current?.(A)},()=>{j.close()}},[e]),{view:i,loading:a,error:h,stream:g,liveText:v.text,liveDropped:v.dropped,reload:w}}const Yw="daluo.web.tabs",Sp=12;function Ww(e){return typeof e=="string"&&e!==""&&e.endsWith(".jsonl")&&!e.includes("/")&&!e.includes("\\")}function lL(e){if(e===null)return[];try{const t=JSON.parse(e.getItem(Yw)??"[]");if(!Array.isArray(t))return[];const i=[];for(const r of t)if(!(!Ww(r)||i.includes(r))&&(i.push(r),i.length>=Sp))break;return i}catch{return[]}}function aL(e,t){if(e!==null)try{e.setItem(Yw,JSON.stringify(t))}catch{}}function ax(e,t){if(!Ww(t))return[...e];if(e.includes(t))return[...e];const i=[...e,t];return i.length>Sp?i.slice(i.length-Sp):i}function Xw(e,t){return e.filter(i=>i!==t)}function oL(e,t,i){if(i!==t)return i;const r=e.indexOf(t),a=Xw(e,t);return a.length===0?null:a[Math.min(r<0?0:r,a.length-1)]??null}const Ul=new URLSearchParams(location.search),cL=Ul.get("theme")==="dark"?"dark":"light",uL=Ul.get("view")==="settings"?"settings":Ul.get("view")==="trajectory"?"trajectory":Ul.get("view")==="empty"?"empty":"conv",hu=Ul.get("session"),hL=(()=>{const e=Ul.get("seq"),t=e===null?Number.NaN:Number(e);return Number.isInteger(t)&&t>0?t:void 0})();function dL(){const[e,t]=C.useState(cL),[i,r]=C.useState(uL),[a,c]=C.useState([]),[h,f]=C.useState(!0),[g,m]=C.useState(null),[v,_]=C.useState(hu),[S,y]=C.useState(()=>{const me=lL(typeof localStorage>"u"?null:localStorage);return hu===null?me:ax(me,hu)});C.useEffect(()=>{aL(typeof localStorage>"u"?null:localStorage,S)},[S]);const x=C.useMemo(()=>new Map(a.flatMap(le=>le.sessions.map(me=>[me.name,me.title??me.name]))),[a]),[w,j]=C.useState("新会话"),[N,M]=C.useState(!0),[A,R]=C.useState(!1),[I,H]=C.useState(0),[O,$]=C.useState(null),[Q,z]=C.useState(null),[G,P]=C.useState(null),[L,F]=C.useState(!1),[K,q]=C.useState(null),[te,ne]=C.useState(!1),[ge,D]=C.useState(null),De=rL(v,le=>{if(le.kind==="打开文件"||le.kind==="交付文件"){M(!0);const me=le.kind==="打开文件"?le.line:0;$({path:le.path,line:me,...le.rel===void 0?{}:{rel:le.rel},nonce:Date.now()});return}q(le.丢的是==="交付文件"?`有 ${String(le.dropped)} 条交付请求因界面不可见被丢弃(产物仍在工作区里,可在文件页签手动打开)`:`有 ${String(le.dropped)} 条打开文件请求因界面不可见被丢弃(可在文件页签手动打开)`)});C.useEffect(()=>{document.documentElement.dataset.theme=e},[e]),C.useEffect(()=>{window.__DALUO_PAGE_READY__=!0;const le=[0,400,1500].map(me=>setTimeout(()=>{document.dispatchEvent(new CustomEvent("daluo:page-ready"))},me));return()=>{for(const me of le)clearTimeout(me)}},[]),C.useEffect(()=>{const le=me=>{if((me.metaKey||me.ctrlKey)&&me.key.toLowerCase()==="k"){me.preventDefault(),ne(Te=>!Te);return}if((me.metaKey||me.ctrlKey)&&me.key===","){me.preventDefault(),r("settings");return}(me.metaKey||me.ctrlKey)&&me.key.toLowerCase()==="t"&&(me.preventDefault(),r("trajectory"))};return window.addEventListener("keydown",le),()=>{window.removeEventListener("keydown",le)}},[]);const we=C.useCallback(async()=>{f(!0);try{const le=await JN({archived:!0});c(le.groups),m(null);const me=new URLSearchParams(location.search).get("session")??hu;if(me!==null){for(const Te of le.groups){const He=Te.sessions.find(Ee=>Ee.name===me);if(He!==void 0){_(He.name),j(He.title??He.name);return}}_(me),j(me);return}j(Te=>Te)}catch(le){m(le instanceof Error?le.message:String(le))}finally{f(!1)}},[]);C.useEffect(()=>{we()},[we]),C.useEffect(()=>{if(h||i!=="conv"||v!==null||new URLSearchParams(location.search).get("session")!==null)return;const me=(a.find(Te=>Te.active)??a[0])?.sessions.find(Te=>Te.archived!==!0);me!==void 0&&(_(me.name),j(me.title??me.name),history.replaceState(null,"",`/?session=${encodeURIComponent(me.name)}`))},[h,a,i,v]);const T=()=>{t(le=>le==="dark"?"light":"dark")},E=(le,me)=>{r("conv"),_(le),y(Te=>ax(Te,le)),j(me??le),history.replaceState(null,"",`/?session=${encodeURIComponent(le)}`)},J=()=>{r("empty"),_(null),j("新会话"),history.replaceState(null,"","/")},se=gx(typeof window>"u"?void 0:window),pe=()=>{se!==null&&(z(null),se.pickDirectory().then(async le=>{le!==null&&(await Nf(le),location.href="/")}).catch(le=>{z(le instanceof Error?le.message:String(le))}))},ce=le=>{const me=oL(S,le,v);if(y(Te=>Xw(Te,le)),me===null){J();return}le===v&&E(me)},_e=le=>{E(le.name,le.title??le.name)},ke=(le,me)=>{if(me.active){_e(le);return}z(null),Nf(me.root).then(()=>{location.href=`/?session=${encodeURIComponent(le.name)}`}).catch(Te=>{z(Te instanceof Error?Te.message:String(Te))})},oe=Date.now(),ye=[{id:"action:new",group:"动作",label:"新会话",hint:"⌘N",keywords:"new chat",run:J},{id:"action:settings",group:"动作",label:"打开设置",hint:"⌘,",keywords:"settings 提供方 模型 外观",run:()=>{r("settings")}},{id:"action:trajectory",group:"动作",label:"打开轨迹",hint:"⌘T",keywords:"trajectory 轨迹 时间线 用量 tokens",run:()=>{r("trajectory")}},{id:"action:theme",group:"动作",label:e==="dark"?"切换到浅色主题":"切换到深色主题",hint:"主题",keywords:"theme dark light",run:()=>{t(e==="dark"?"light":"dark")}},{id:"action:reload",group:"动作",label:"刷新会话列表",hint:"R",keywords:"refresh reload",run:()=>{we()}},...a.flatMap(le=>le.sessions.map(me=>({id:`session:${me.name}`,group:"会话",label:me.title??me.name,hint:Kw(me.lastActiveMs,oe),keywords:`${me.name} ${le.name}`,run:()=>{r("conv"),_e(me)}}))).slice(0,80)],Ne=async le=>{if(v===null)return;const me=v,Te=w,He=await z0(me,le.at);E(He.session),await we(),D({session:He.session,source:me,sourceTitle:Te,at:le.at,round:le.round,quote:le.quote.length>160?`${le.quote.slice(0,160)}…`:le.quote,ts:le.ts,kind:le.kind})},ct=le=>{const me=`/?session=${encodeURIComponent(le.file)}&seq=${String(le.seq)}`;if(a.find(He=>He.root===le.root)?.active===!0){location.href=me;return}z(null),Nf(le.root).then(()=>{location.href=me}).catch(He=>{z(He instanceof Error?He.message:String(He))})},ht=async(le,me)=>{if(v!==null){z(null);try{await du(le,v,De.view?.sessionId,me),P(null),q(null)}catch(Te){z(Te instanceof Error?Te.message:String(Te)),P({text:le,...me===void 0?{}:{images:me}})}finally{await De.reload(),await we()}}},Je=async(le,me,Te)=>{if(xp(le)!==null){z("还没有会话:先发一句话建会话,再设目标。");return}z(null);try{const He=await du(le,void 0,void 0,me,Te);P(null),E(He.logFile,le.length>24?`${le.slice(0,24)}…`:le),await we()}catch(He){z(He instanceof Error?He.message:String(He)),P({text:le,...me===void 0?{}:{images:me}})}},Ke=async le=>{if(v===null)return;const me=v,Te=A2(De.view?.turns??[],le.seq),He=await z0(me,Te);E(He.session),await we();const Ee=le.images?.map(Be=>({path:Be.path}));z(null),P(null);try{await du(le.text,He.session,void 0,Ee),q(`已重答:新会话 ${He.session}(源会话 ${me} 保留)`)}catch(Be){z(Be instanceof Error?Be.message:String(Be)),P({text:le.text,...Ee===void 0?{}:{images:Ee}})}finally{await De.reload(),await we()}},qe=async()=>{const le=G;if(le!==null){F(!0),z(null),q(null);try{if(v===null){await Je(le.text,le.images);return}const me=De.view?.turns??[],Te=[...me].reverse().find(He=>He.role==="user"&&He.source!=="context"&&He.text.trim()!=="");if(M2(me,le.text)==="reanswer"&&Te!==void 0){await Ke({seq:Te.seq,text:Te.text,...Te.images===void 0?{}:{images:Te.images}});return}await ht(le.text,le.images)}finally{F(!1)}}};return i==="settings"?u.jsx("div",{className:"app","data-dsh-surface":"root",children:u.jsx(x6,{onClose:()=>{r(v===null?"empty":"conv")},session:v,onTheme:t})}):i==="trajectory"?u.jsx("div",{className:"app","data-dsh-surface":"root",children:u.jsx(L6,{session:v,title:w,onBack:()=>{r(v===null?"empty":"conv")}})}):u.jsxs("div",{className:"app","data-dsh-surface":"root",children:[u.jsx(Z6,{groups:a,activeName:v,loading:h,loadError:g,onNewChat:J,onOpenFolder:se===null?void 0:pe,onRename:async(le,me)=>{await e2(le.name,me),v===le.name&&j(me),await we()},onDelete:async le=>{await t2(le.name),v===le.name&&J(),await we()},onPin:async le=>{const me=a.flatMap(Te=>Te.sessions.map(He=>He.name));await n2([le.name,...me.filter(Te=>Te!==le.name)]),await we()},onArchive:async(le,me)=>{await cx(le.name,me),await we()},onLabels:async(le,me)=>{await i2(le.name,me),await we()},onReload:async()=>{await we()},onOpenSettings:()=>{r("settings")},onSelect:ke,onOpenSearchHit:ct}),u.jsxs("main",{className:"main","data-dsh-surface":"conversation",children:[u.jsx(J6,{tabs:S,active:v,titles:x,onSelect:le=>{E(le)},onClose:ce,onNew:J}),Q===null&&G===null&&K===null?null:u.jsxs("div",{className:`conn-banner${Q===null?" ok":""}`,style:{margin:"10px auto 0",maxWidth:"812px"},children:[u.jsx("span",{className:Q===null?"ok":"warn",children:Q===null?"✓":"⚠"}),u.jsx("span",{children:Q??K??"上一次发送失败:可以直接重试。"}),G===null?null:u.jsx("button",{className:"btn",disabled:L,onClick:()=>{qe()},children:L?"重试中…":"重试"}),u.jsx("button",{className:"btn",onClick:()=>{z(null),P(null),q(null)},children:"知道了"})]}),i==="conv"?u.jsx(qR,{title:w,session:v,thread:De,onToggleTheme:T,onSend:ht,onStop:()=>{v!==null&&p2(v)},onBack:J,onFork:Ne,onReanswer:Ke,focusSeq:hL,onTrajectory:()=>{r("trajectory")},...v===null?{}:{onSideChat:()=>{R(!0)}},onViewChanges:()=>{M(!0),H(le=>le+1)},onOpenFile:(le,me)=>{M(!0),$({path:le,line:me,nonce:Date.now()})}},v??"none"):u.jsx(i6,{onToggleTheme:T,onSend:(le,me,Te)=>{Je(le,me,Te)}})]}),u.jsx(nL,{open:A&&v!==null,mainTitle:w,onClose:()=>{R(!1)}}),te?u.jsx(O2,{items:ye,onClose:()=>{ne(!1)}}):null,u.jsx(XB,{collapsed:!N,changesSignal:I,openFileSignal:O,workspaceRoot:a.find(le=>le.active)?.root??a[0]?.root??"",onToggle:()=>M(le=>!le),onOpenTrajectory:()=>{r("trajectory")},onOpenPalette:()=>{ne(!0)},session:v,onOpenSession:le=>{E(le)}}),ge===null?null:u.jsx(r6,{info:ge,onClose:()=>{D(null)},onBackToSource:()=>{E(ge.source,ge.sourceTitle),D(null)}})]})}const mm="/plugin-client/manifest";function fL(e){if(typeof e!="object"||e===null)return"模块没有默认导出(应导出 { id, apply })";const t=e;if(typeof t.id!="string"||t.id==="")return"模块缺 id";if(typeof t.apply!="function")return"模块缺 apply 函数"}async function mL(e={}){const t=e.fetchImpl??fetch,i=e.importModule??(f=>import(f)),r=e.registry??Tr,a={已加载:[],失败:[]};let c;try{const f=await t(e.manifestUrl??mm,{headers:{accept:"application/json"}});if(!f.ok)throw new Error(`清单端点 HTTP ${String(f.status)}`);c=await f.json()}catch(f){return a.失败.push({id:"(manifest)",src:e.manifestUrl??mm,error:`清单端点不可用:${f instanceof Error?f.message:String(f)}`}),a}const h=typeof c=="object"&&c!==null?c.modules:void 0;if(!Array.isArray(h))return a.失败.push({id:"(manifest)",src:e.manifestUrl??mm,error:"清单里没有 modules 数组"}),a;for(const f of h){const g=f,m=typeof g?.id=="string"?g.id:"",v=typeof g?.src=="string"?g.src:"";if(m===""||v===""){a.失败.push({id:m===""?"(unknown)":m,src:v,error:"清单条目缺 id/src"});continue}try{const _=await i(v),S=typeof _=="object"&&_!==null&&"default"in _?_.default:_,y=fL(S);if(y!==void 0)throw new Error(y);const x=S,w={slots:{register(j,N){const M=N??j.Component;return r.register(x.id,{slot:j.slot,id:j.id,...j.order===void 0?{}:{order:j.order},...typeof j.title=="string"?{title:j.title}:{},...typeof j.forPlugin=="string"?{forPlugin:j.forPlugin}:{},Component:M})}},React:e.React??VN,logger:{debug:(...j)=>console.debug("[client-plugin]",...j),warn:(...j)=>console.warn("[client-plugin]",...j)}};await x.apply(w),a.已加载.push(m)}catch(_){a.失败.push({id:m,src:v,error:_ instanceof Error?_.message:String(_)})}}return a}const Gw=document.getElementById("root");if(Gw===null)throw new Error("找不到 #root:index.html 与 main.tsx 不同步");ZN.createRoot(Gw).render(u.jsx(C.StrictMode,{children:u.jsx(dL,{})}));mL().then(e=>{e.失败.length>0&&console.warn("[client-plugin] 部分客户端插件未加载:",e.失败)}).catch(e=>{console.warn("[client-plugin] 运行时启动失败:",e)});