@daluo/cli 0.2.1 → 0.2.2

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 LN(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 rx(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var yf={exports:{}},Ha={};var N0;function zN(){if(N0)return Ha;N0=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 E0;function HN(){return E0||(E0=1,yf.exports=zN()),yf.exports}var u=HN(),Sf={exports:{}},Fe={};var j0;function IN(){if(j0)return Fe;j0=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 b(j){return j===null||typeof j!="object"?null:(j=y&&j[y]||j["@@iterator"],typeof j=="function"?j:null)}var w={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},E=Object.assign,N={};function A(j,Z,re){this.props=j,this.context=Z,this.refs=N,this.updater=re||w}A.prototype.isReactComponent={},A.prototype.setState=function(j,Z){if(typeof j!="object"&&typeof j!="function"&&j!=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,j,Z,"setState")},A.prototype.forceUpdate=function(j){this.updater.enqueueForceUpdate(this,j,"forceUpdate")};function R(){}R.prototype=A.prototype;function B(j,Z,re){this.props=j,this.context=Z,this.refs=N,this.updater=re||w}var q=B.prototype=new R;q.constructor=B,E(q,A.prototype),q.isPureReactComponent=!0;var z=Array.isArray;function D(){}var $={H:null,A:null,T:null,S:null},ae=Object.prototype.hasOwnProperty;function I(j,Z,re){var ie=re.ref;return{$$typeof:e,type:j,key:Z,ref:ie!==void 0?ie:null,props:re}}function G(j,Z){return I(j.type,Z,j.props)}function F(j){return typeof j=="object"&&j!==null&&j.$$typeof===e}function O(j){var Z={"=":"=0",":":"=2"};return"$"+j.replace(/[=:]/g,function(re){return Z[re]})}var U=/\/+/g;function K(j,Z){return typeof j=="object"&&j!==null&&j.key!=null?O(""+j.key):Z.toString(36)}function V(j){switch(j.status){case"fulfilled":return j.value;case"rejected":throw j.reason;default:switch(typeof j.status=="string"?j.then(D,D):(j.status="pending",j.then(function(Z){j.status==="pending"&&(j.status="fulfilled",j.value=Z)},function(Z){j.status==="pending"&&(j.status="rejected",j.reason=Z)})),j.status){case"fulfilled":return j.value;case"rejected":throw j.reason}}throw j}function se(j,Z,re,ie,pe){var ve=typeof j;(ve==="undefined"||ve==="boolean")&&(j=null);var je=!1;if(j===null)je=!0;else switch(ve){case"bigint":case"string":case"number":je=!0;break;case"object":switch(j.$$typeof){case e:case t:je=!0;break;case v:return je=j._init,se(je(j._payload),Z,re,ie,pe)}}if(je)return pe=pe(j),je=ie===""?"."+K(j,0):ie,z(pe)?(re="",je!=null&&(re=je.replace(U,"$&/")+"/"),se(pe,Z,re,"",function(Ae){return Ae})):pe!=null&&(F(pe)&&(pe=G(pe,re+(pe.key==null||j&&j.key===pe.key?"":(""+pe.key).replace(U,"$&/")+"/")+je)),Z.push(pe)),1;je=0;var de=ie===""?".":ie+":";if(z(j))for(var be=0;be<j.length;be++)ie=j[be],ve=de+K(ie,be),je+=se(ie,Z,re,ve,pe);else if(be=b(j),typeof be=="function")for(j=be.call(j),be=0;!(ie=j.next()).done;)ie=ie.value,ve=de+K(ie,be++),je+=se(ie,Z,re,ve,pe);else if(ve==="object"){if(typeof j.then=="function")return se(V(j),Z,re,ie,pe);throw Z=String(j),Error("Objects are not valid as a React child (found: "+(Z==="[object Object]"?"object with keys {"+Object.keys(j).join(", ")+"}":Z)+"). If you meant to render a collection of children, use an array instead.")}return je}function ee(j,Z,re){if(j==null)return j;var ie=[],pe=0;return se(j,ie,"","",function(ve){return Z.call(re,ve,pe++)}),ie}function ge(j){if(j._status===-1){var Z=j._result,re=Z();re.then(function(ie){(j._status===0||j._status===-1)&&(j._status=1,j._result=ie,re.status===void 0&&(re.status="fulfilled",re.value=ie))},function(ie){(j._status===0||j._status===-1)&&(j._status=2,j._result=ie,re.status===void 0&&(re.status="rejected",re.reason=ie))}),j._status===-1&&(j._status=0,j._result=re)}if(j._status===1)return j._result.default;throw j._result}var T=typeof reportError=="function"?reportError:function(j){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var Z=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof j=="object"&&j!==null&&typeof j.message=="string"?String(j.message):String(j),error:j});if(!window.dispatchEvent(Z))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",j);return}console.error(j)};function De(j){var Z=$.T,re={};re.types=Z!==null?Z.types:null,$.T=re;try{var ie=j(),pe=$.S;pe!==null&&pe(re,ie),typeof ie=="object"&&ie!==null&&typeof ie.then=="function"&&ie.then(D,T)}catch(ve){T(ve)}finally{Z!==null&&re.types!==null&&(Z.types=re.types),$.T=Z}}function me(j){var Z=$.T;if(Z!==null){var re=Z.types;re===null?Z.types=[j]:re.indexOf(j)===-1&&re.push(j)}else De(me.bind(null,j))}var M={map:ee,forEach:function(j,Z,re){ee(j,function(){Z.apply(this,arguments)},re)},count:function(j){var Z=0;return ee(j,function(){Z++}),Z},toArray:function(j){return ee(j,function(Z){return Z})||[]},only:function(j){if(!F(j))throw Error("React.Children.only expected to receive a single React element child.");return j}};return Fe.Activity=_,Fe.Children=M,Fe.Component=A,Fe.Fragment=i,Fe.Profiler=a,Fe.PureComponent=B,Fe.StrictMode=r,Fe.Suspense=g,Fe.ViewTransition=S,Fe.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=$,Fe.__COMPILER_RUNTIME={__proto__:null,c:function(j){return $.H.useMemoCache(j)}},Fe.addTransitionType=me,Fe.cache=function(j){return function(){return j.apply(null,arguments)}},Fe.cacheSignal=function(){return null},Fe.cloneElement=function(j,Z,re){if(j==null)throw Error("The argument must be a React element, but you passed "+j+".");var ie=E({},j.props),pe=j.key;if(Z!=null)for(ve in Z.key!==void 0&&(pe=""+Z.key),Z)!ae.call(Z,ve)||ve==="key"||ve==="__self"||ve==="__source"||ve==="ref"&&Z.ref===void 0||(ie[ve]=Z[ve]);var ve=arguments.length-2;if(ve===1)ie.children=re;else if(1<ve){for(var je=Array(ve),de=0;de<ve;de++)je[de]=arguments[de+2];ie.children=je}return I(j.type,pe,ie)},Fe.createContext=function(j){return j={$$typeof:h,_currentValue:j,_currentValue2:j,_threadCount:0,Provider:null,Consumer:null},j.Provider=j,j.Consumer={$$typeof:c,_context:j},j},Fe.createElement=function(j,Z,re){var ie,pe={},ve=null;if(Z!=null)for(ie in Z.key!==void 0&&(ve=""+Z.key),Z)ae.call(Z,ie)&&ie!=="key"&&ie!=="__self"&&ie!=="__source"&&(pe[ie]=Z[ie]);var je=arguments.length-2;if(je===1)pe.children=re;else if(1<je){for(var de=Array(je),be=0;be<je;be++)de[be]=arguments[be+2];pe.children=de}if(j&&j.defaultProps)for(ie in je=j.defaultProps,je)pe[ie]===void 0&&(pe[ie]=je[ie]);return I(j,ve,pe)},Fe.createRef=function(){return{current:null}},Fe.forwardRef=function(j){return{$$typeof:f,render:j}},Fe.isValidElement=F,Fe.lazy=function(j){return{$$typeof:v,_payload:{_status:-1,_result:j},_init:ge}},Fe.memo=function(j,Z){return{$$typeof:m,type:j,compare:Z===void 0?null:Z}},Fe.startTransition=De,Fe.unstable_useCacheRefresh=function(){return $.H.useCacheRefresh()},Fe.use=function(j){return $.H.use(j)},Fe.useActionState=function(j,Z,re){return $.H.useActionState(j,Z,re)},Fe.useCallback=function(j,Z){return $.H.useCallback(j,Z)},Fe.useContext=function(j){return $.H.useContext(j)},Fe.useDebugValue=function(){},Fe.useDeferredValue=function(j,Z){return $.H.useDeferredValue(j,Z)},Fe.useEffect=function(j,Z){return $.H.useEffect(j,Z)},Fe.useEffectEvent=function(j){return $.H.useEffectEvent(j)},Fe.useId=function(){return $.H.useId()},Fe.useImperativeHandle=function(j,Z,re){return $.H.useImperativeHandle(j,Z,re)},Fe.useInsertionEffect=function(j,Z){return $.H.useInsertionEffect(j,Z)},Fe.useLayoutEffect=function(j,Z){return $.H.useLayoutEffect(j,Z)},Fe.useMemo=function(j,Z){return $.H.useMemo(j,Z)},Fe.useOptimistic=function(j,Z){return $.H.useOptimistic(j,Z)},Fe.useReducer=function(j,Z,re){return $.H.useReducer(j,Z,re)},Fe.useRef=function(j){return $.H.useRef(j)},Fe.useState=function(j){return $.H.useState(j)},Fe.useSyncExternalStore=function(j,Z,re){return $.H.useSyncExternalStore(j,Z,re)},Fe.useTransition=function(){return $.H.useTransition()},Fe.version="19.3.1",Fe}var T0;function Sp(){return T0||(T0=1,Sf.exports=IN()),Sf.exports}var C=Sp();const UN=rx(C),PN=LN({__proto__:null,default:UN},[C]);var bf={exports:{}},Ia={},xf={exports:{}},wf={};var D0;function qN(){return D0||(D0=1,(function(e){function t(V,se){var ee=V.length;V.push(se);e:for(;0<ee;){var ge=ee-1>>>1,T=V[ge];if(0<a(T,se))V[ge]=se,V[ee]=T,ee=ge;else break e}}function i(V){return V.length===0?null:V[0]}function r(V){if(V.length===0)return null;var se=V[0],ee=V.pop();if(ee!==se){V[0]=ee;e:for(var ge=0,T=V.length,De=T>>>1;ge<De;){var me=2*(ge+1)-1,M=V[me],j=me+1,Z=V[j];if(0>a(M,ee))j<T&&0>a(Z,M)?(V[ge]=Z,V[j]=ee,ge=j):(V[ge]=M,V[me]=ee,ge=me);else if(j<T&&0>a(Z,ee))V[ge]=Z,V[j]=ee,ge=j;else break e}}return se}function a(V,se){var ee=V.sortIndex-se.sortIndex;return ee!==0?ee:V.id-se.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,b=!1,w=!1,E=!1,N=typeof setTimeout=="function"?setTimeout:null,A=typeof clearTimeout=="function"?clearTimeout:null,R=typeof setImmediate<"u"?setImmediate:null;function B(V){for(var se=i(m);se!==null;){if(se.callback===null)r(m);else if(se.startTime<=V)r(m),se.sortIndex=se.expirationTime,t(g,se);else break;se=i(m)}}function q(V){if(w=!1,B(V),!b)if(i(g)!==null)b=!0,z||(z=!0,F());else{var se=i(m);se!==null&&K(q,se.startTime-V)}}var z=!1,D=-1,$=5,ae=-1;function I(){return E?!0:!(e.unstable_now()-ae<$)}function G(){if(E=!1,z){var V=e.unstable_now();ae=V;var se=!0;try{e:{b=!1,w&&(w=!1,A(D),D=-1),y=!0;var ee=S;try{t:{for(B(V),_=i(g);_!==null&&!(_.expirationTime>V&&I());){var ge=_.callback;if(typeof ge=="function"){_.callback=null,S=_.priorityLevel;var T=ge(_.expirationTime<=V);if(V=e.unstable_now(),typeof T=="function"){_.callback=T,B(V),se=!0;break t}_===i(g)&&r(g),B(V)}else r(g);_=i(g)}if(_!==null)se=!0;else{var De=i(m);De!==null&&K(q,De.startTime-V),se=!1}}break e}finally{_=null,S=ee,y=!1}se=void 0}}finally{se?F():z=!1}}}var F;if(typeof R=="function")F=function(){R(G)};else if(typeof MessageChannel<"u"){var O=new MessageChannel,U=O.port2;O.port1.onmessage=G,F=function(){U.postMessage(null)}}else F=function(){N(G,0)};function K(V,se){D=N(function(){V(e.unstable_now())},se)}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(V){V.callback=null},e.unstable_forceFrameRate=function(V){0>V||125<V?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):$=0<V?Math.floor(1e3/V):5},e.unstable_getCurrentPriorityLevel=function(){return S},e.unstable_next=function(V){switch(S){case 1:case 2:case 3:var se=3;break;default:se=S}var ee=S;S=se;try{return V()}finally{S=ee}},e.unstable_requestPaint=function(){E=!0},e.unstable_runWithPriority=function(V,se){switch(V){case 1:case 2:case 3:case 4:case 5:break;default:V=3}var ee=S;S=V;try{return se()}finally{S=ee}},e.unstable_scheduleCallback=function(V,se,ee){var ge=e.unstable_now();switch(typeof ee=="object"&&ee!==null?(ee=ee.delay,ee=typeof ee=="number"&&0<ee?ge+ee:ge):ee=ge,V){case 1:var T=-1;break;case 2:T=250;break;case 5:T=1073741823;break;case 4:T=1e4;break;default:T=5e3}return T=ee+T,V={id:v++,callback:se,priorityLevel:V,startTime:ee,expirationTime:T,sortIndex:-1},ee>ge?(V.sortIndex=ee,t(m,V),i(g)===null&&V===i(m)&&(w?(A(D),D=-1):w=!0,K(q,ee-ge))):(V.sortIndex=T,t(g,V),b||y||(b=!0,z||(z=!0,F()))),V},e.unstable_shouldYield=I,e.unstable_wrapCallback=function(V){var se=S;return function(){var ee=S;S=se;try{return V.apply(this,arguments)}finally{S=ee}}}})(wf)),wf}var M0;function FN(){return M0||(M0=1,xf.exports=qN()),xf.exports}var Cf={exports:{}},vn={};var A0;function $N(){if(A0)return vn;A0=1;var e=Sp();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 vn.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=r,vn.browser=function(v){return{$$typeof:c,_reason:v}},vn.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)},vn.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()}},vn.preconnect=function(v,_){typeof v=="string"&&(_?(_=_.crossOrigin,_=typeof _=="string"?_==="use-credentials"?_:"":void 0):_=null,r.d.C(v,_))},vn.prefetchDNS=function(v){typeof v=="string"&&r.d.D(v)},vn.preinit=function(v,_){if(typeof v=="string"&&_&&typeof _.as=="string"){var S=_.as,y=m(S,_.crossOrigin),b=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:b,fetchPriority:w}):S==="script"&&r.d.X(v,{crossOrigin:y,integrity:b,fetchPriority:w,nonce:typeof _.nonce=="string"?_.nonce:void 0})}},vn.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)},vn.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})}},vn.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)},vn.requestFormReset=function(v){r.d.r(v)},vn.unstable_batchedUpdates=function(v,_){return v(_)},vn.useFormState=function(v,_,S){return g.H.useFormState(v,_,S)},vn.useFormStatus=function(){return g.H.useHostTransitionStatus()},vn.version="19.3.1",vn}var R0;function VN(){if(R0)return Cf.exports;R0=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(),Cf.exports=$N(),Cf.exports}var O0;function KN(){if(O0)return Ia;O0=1;var e=FN(),t=Sp(),i=VN();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 x=!1,k=d.child;k;){if(k===l){x=!0,l=d,o=p;break}if(k===o){x=!0,o=d,l=p;break}k=k.sibling}if(!x){for(k=p.child;k;){if(k===l){x=!0,l=p,o=d;break}if(k===o){x=!0,o=p,l=d;break}k=k.sibling}if(!x)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 b(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 E(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,A=null;function R(n,s,l){return n===l?!0:n===s?(N=n,!0):!1}function B(n,s,l){return n===l?(A=n,!1):n===s?(A!==null&&(N=n),!0):!1}function q(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 z(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 D=Object.assign,$=Symbol.for("react.element"),ae=Symbol.for("react.transitional.element"),I=Symbol.for("react.portal"),G=Symbol.for("react.fragment"),F=Symbol.for("react.strict_mode"),O=Symbol.for("react.profiler"),U=Symbol.for("react.consumer"),K=Symbol.for("react.context"),V=Symbol.for("react.forward_ref"),se=Symbol.for("react.suspense"),ee=Symbol.for("react.suspense_list"),ge=Symbol.for("react.memo"),T=Symbol.for("react.lazy"),De=Symbol.for("react.activity"),me=Symbol.for("react.legacy_hidden"),M=Symbol.for("react.memo_cache_sentinel"),j=Symbol.for("react.view_transition"),Z=Symbol.for("react.recoverable"),re=Symbol.iterator;function ie(n){return n===null||typeof n!="object"?null:(n=re&&n[re]||n["@@iterator"],typeof n=="function"?n:null)}var pe=Symbol.for("react.client.reference");function ve(n){if(n==null)return null;if(typeof n=="function")return n.$$typeof===pe?null:n.displayName||n.name||null;if(typeof n=="string")return n;switch(n){case G:return"Fragment";case O:return"Profiler";case F:return"StrictMode";case se:return"Suspense";case ee:return"SuspenseList";case De:return"Activity";case j:return"ViewTransition"}if(typeof n=="object")switch(n.$$typeof){case I:return"Portal";case K:return n.displayName||"Context";case U:return(n._context.displayName||"Context")+".Consumer";case V: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:ve(n.type)||"Memo";case T:s=n._payload,n=n._init;try{return ve(n(s))}catch{}}return null}var je=Array.isArray,de=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,be=i.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Ae={pending:!1,data:null,method:null,action:null},st=[],oe=-1;function _e(n){return{current:n}}function Ce(n){0>oe||(n.current=st[oe],st[oe]=null,oe--)}function Ee(n,s){oe++,st[oe]=n.current,n.current=s}var at=_e(null),We=_e(null),ut=_e(null),Te=_e(null);function ze(n,s){switch(Ee(ut,s),Ee(We,n),Ee(at,null),s.nodeType){case 9:case 11:n=(n=s.documentElement)&&(n=n.namespaceURI)?By(n):0;break;default:if(n=s.tagName,s=s.namespaceURI)s=By(s),n=Ly(s,n);else switch(n){case"svg":n=1;break;case"math":n=2;break;default:n=0}}Ce(at),Ee(at,n)}function mt(){Ce(at),Ce(We),Ce(ut)}function Ot(n){var s=n.memoizedState;s!==null&&(kl._currentValue=s.memoizedState,Ee(Te,n)),s=at.current;var l=Ly(s,n.type);s!==l&&(Ee(We,n),Ee(at,l))}function jt(n){We.current===n&&(Ce(at),Ce(We)),Te.current===n&&(Ce(Te),kl._currentValue=Ae)}var le,Se;function ne(n){if(le===void 0)try{throw Error()}catch(l){var s=l.stack.trim().match(/\n( *(at )?)/);le=s&&s[1]||"",Se=-1<l.stack.indexOf(`
2
+ at`)?" (<anonymous>)":-1<l.stack.indexOf("@")?"@unknown:0:0":""}return`
3
+ `+le+n+Se}var H=!1;function ye(n,s){if(!n||H)return"";H=!0;var l=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var o={DetermineComponentFrameRoot:function(){try{if(s){var he=function(){throw Error()};if(Object.defineProperty(he.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(he,[])}catch(Ne){var Y=Ne}Reflect.construct(n,[],he)}else{try{he.call()}catch(Ne){Y=Ne}he=!1;try{var J=Object.getOwnPropertyDescriptor(n.prototype,"props");Object.defineProperty(n.prototype,"props",{configurable:!0,set:function(){throw Error()}}),he=!0,new n}finally{he&&(J!==void 0?Object.defineProperty(n.prototype,"props",J):delete n.prototype.props)}}}else{try{throw Error()}catch(Ne){Y=Ne}(he=n())&&typeof he.catch=="function"&&he.catch(function(){})}}catch(Ne){if(Ne&&Y&&typeof Ne.stack=="string")return[Ne.stack,Y.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(),x=p[0],k=p[1];if(x&&k){var L=x.split(`
4
+ `),X=k.split(`
5
+ `);for(d=o=0;o<L.length&&!L[o].includes("DetermineComponentFrameRoot");)o++;for(;d<X.length&&!X[d].includes("DetermineComponentFrameRoot");)d++;if(o===L.length||d===X.length)for(o=L.length-1,d=X.length-1;1<=o&&0<=d&&L[o]!==X[d];)d--;for(;1<=o&&0<=d;o--,d--)if(L[o]!==X[d]){if(o!==1||d!==1)do if(o--,d--,0>d||L[o]!==X[d]){var te=`
6
+ `+L[o].replace(" at new "," at ");return n.displayName&&te.includes("<anonymous>")&&(te=te.replace("<anonymous>",n.displayName)),te}while(1<=o&&0<=d);break}}}finally{H=!1,Error.prepareStackTrace=l}return(l=n?n.displayName||n.name:"")?ne(l):""}function ke(n,s){switch(n.tag){case 26:case 27:case 5:return ne(n.type);case 16:return ne("Lazy");case 13:return n.child!==s&&s!==null?ne("Suspense Fallback"):ne("Suspense");case 19:return ne("SuspenseList");case 0:case 15:return ye(n.type,!1);case 11:return ye(n.type.render,!1);case 1:return ye(n.type,!0);case 31:return ne("Activity");case 30:return ne("ViewTransition");default:return""}}function Xe(n){try{var s="",l=null;do s+=ke(n,l),l=n,n=n.return;while(n);return s}catch(o){return`
7
+ Error generating stack: `+o.message+`
8
+ `+o.stack}}var ot=Object.prototype.hasOwnProperty,et=e.unstable_scheduleCallback,ni=e.unstable_cancelCallback,Ni=e.unstable_shouldYield,zr=e.unstable_requestPaint,qt=e.unstable_now,en=e.unstable_getCurrentPriorityLevel,_i=e.unstable_ImmediatePriority,kn=e.unstable_UserBlockingPriority,Hr=e.unstable_NormalPriority,ue=e.unstable_LowPriority,Re=e.unstable_IdlePriority,tt=e.log,pt=e.unstable_setDisableYieldValue,Nn=null,Ie=null;function It(n){if(typeof tt=="function"&&pt(n),Ie&&typeof Ie.setStrictMode=="function")try{Ie.setStrictMode(Nn,n)}catch{}}var hn=Math.clz32?Math.clz32:Xw,Yw=Math.log,Ww=Math.LN2;function Xw(n){return n>>>=0,n===0?32:31-(Yw(n)/Ww|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,x=n.pingedLanes;n=n.warmLanes;var k=o&134217727;return k!==0?(o=k&~p,o!==0?d=Qs(o):(x&=k,x!==0?d=Qs(x):l||(l=k&~n,l!==0&&(d=Qs(l))))):(k=o&~p,k!==0?d=Qs(k):x!==0?d=Qs(x):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 ag(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-hn(l),d=1<<o;s|=n[o],l&=~d}return s}function Gw(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 og(){var n=ko;return ko<<=1,(ko&62914560)===0&&(ko=4194304),n}function Vu(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 Qw(n,s,l,o,d,p){var x=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,L=n.expirationTimes,X=n.hiddenUpdates;for(l=x&~l;0<l;){var te=31-hn(l),he=1<<te;k[te]=0,L[te]=-1;var Y=X[te];if(Y!==null)for(X[te]=null,te=0;te<Y.length;te++){var J=Y[te];J!==null&&(J.lane&=-536870913)}l&=~he}o!==0&&cg(n,o,0),p!==0&&d===0&&n.tag!==0&&(n.suspendedLanes|=p&~(x&~s))}function cg(n,s,l){n.pendingLanes|=s,n.suspendedLanes&=~s;var o=31-hn(s);n.entangledLanes|=s,n.entanglements[o]=n.entanglements[o]|1073741824|l&261930}function ug(n,s){var l=n.entangledLanes|=s;for(n=n.entanglements;l;){var o=31-hn(l),d=1<<o;d&s|n[o]&s&&(n[o]|=s),l&=~d}}function hg(n,s){var l=s&-s;return l=(l&42)!==0?1:Ku(l),(l&(n.suspendedLanes|s))!==0?0:l}function Ku(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 Yu(n){return n&=-n,2<n?8<n?(n&134217727)!==0?32:268435456:8:2}function dg(){var n=be.p;return n!==0?n:(n=window.event,n===void 0?32:y0(n.type))}function fg(n,s){var l=be.p;try{return be.p=n,s()}finally{be.p=l}}var Wi=Math.random().toString(36).slice(2),dn="__reactFiber$"+Wi,On="__reactProps$"+Wi,Ir="__reactContainer$"+Wi,mg="__reactEvents$"+Wi,Zw="__reactListeners$"+Wi,Jw="__reactHandles$"+Wi,pg="__reactResources$"+Wi,Wl="__reactMarker$"+Wi,Eo="__reactLoad$"+Wi;function jo(n){delete n[dn],delete n[On],delete n[Zw],delete n[Jw]}function Zs(n){var s;if(s=n[dn])return s;for(var l=n.parentNode;l;){if(s=l[Ir]||l[dn]){if(l=s.alternate,s.child!==null||l!==null&&l.child!==null)for(n=Jy(n);n!==null;){if(l=n[dn])return l;n=Jy(n)}return s}n=l,l=n.parentNode}return null}function Ur(n){if(n=n[dn]||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[pg];return s||(s=n[pg]={hoistableStyles:new Map,hoistableScripts:new Map}),s}function tn(n){n[Wl]=!0}function gg(n){n[Eo]=void 0}var _g=new Set,vg={};function Js(n,s){qr(n,s),qr(n+"Capture",s)}function qr(n,s){for(vg[n]=s,n=0;n<s.length;n++)_g.add(s[n])}var eC=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]*$"),yg={},Sg={};function tC(n){return ot.call(Sg,n)?!0:ot.call(yg,n)?!1:eC.test(n)?Sg[n]=!0:(yg[n]=!0,!1)}var ht=!1;function bg(){var n=ht;return ht=!1,n}function To(n,s,l){if(tC(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 $n(n){switch(typeof n){case"bigint":case"boolean":case"number":case"string":case"undefined":return n;case"object":return n;default:return""}}function xg(n){var s=n.type;return(n=n.nodeName)&&n.toLowerCase()==="input"&&(s==="checkbox"||s==="radio")}function nC(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(x){l=""+x,p.call(this,x)}}),Object.defineProperty(n,s,{enumerable:o.enumerable}),{getValue:function(){return l},setValue:function(x){l=""+x},stopTracking:function(){n._valueTracker=null,delete n[s]}}}}function Wu(n){if(!n._valueTracker){var s=xg(n)?"checked":"value";n._valueTracker=nC(n,s,""+n[s])}}function wg(n){if(!n)return!1;var s=n._valueTracker;if(!s)return!0;var l=s.getValue(),o="";return n&&(o=xg(n)?n.checked?"true":"false":n.value),n=o,n!==l?(s.setValue(n),!0):!1}var iC=/[\n"\\]/g;function ii(n){return n.replace(iC,function(s){return"\\"+s.charCodeAt(0).toString(16)+" "})}function Xu(n,s,l,o,d,p,x,k){n.name="",x!=null&&typeof x!="function"&&typeof x!="symbol"&&typeof x!="boolean"?n.type=x:n.removeAttribute("type"),s!=null?x==="number"?(s===0&&n.value===""||n.value!=s)&&(n.value=""+$n(s)):n.value!==""+$n(s)&&(n.value=""+$n(s)):x!=="submit"&&x!=="reset"||n.removeAttribute("value"),s!=null?x==="number"&&n.value==s?Gu(n,$n(n.value)):Gu(n,$n(s)):l!=null?Gu(n,$n(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=""+$n(k):n.removeAttribute("name")}function Cg(n,s,l,o,d,p,x,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)){Wu(n);return}l=l!=null?""+$n(l):"",s=s!=null?""+$n(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,x!=null&&typeof x!="function"&&typeof x!="symbol"&&typeof x!="boolean"&&(n.name=x),Wu(n)}function Gu(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=""+$n(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 kg(n,s,l){if(s!=null&&(s=""+$n(s),s!==n.value&&(n.value=s),l==null)){n.defaultValue!==s&&(n.defaultValue=s);return}n.defaultValue=l!=null?""+$n(l):""}function Ng(n,s,l,o){if(s==null){if(o!=null){if(l!=null)throw Error(r(92));if(je(o)){if(1<o.length)throw Error(r(93));o=o[0]}l=o}l==null&&(l=""),s=l}l=$n(s),n.defaultValue=l,o=n.textContent,o===l&&o!==""&&o!==null&&(n.value=o),Wu(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 sC=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 Eg(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||sC.has(s)?s==="float"?n.cssFloat=l:n[s]=(""+l).trim():n[s]=l+"px"}function jg(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]="",ht=!0);for(var d in s)o=s[d],s.hasOwnProperty(d)&&l[d]!==o&&(Eg(n,d,o),ht=!0)}else for(var p in s)s.hasOwnProperty(p)&&Eg(n,p,s[p])}function Qu(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 rC=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"]]),lC=/^[\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 lC.test(""+n)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":n}function Ei(){}var Zu=null;function Ju(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 Tg(n){var s=Ur(n);if(s&&(n=s.stateNode)){var l=n[On]||null;e:switch(n=s.stateNode,s.type){case"input":if(Xu(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[On]||null;if(!d)throw Error(r(90));Xu(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&&wg(o)}break e;case"textarea":kg(n,l.value,l.defaultValue);break e;case"select":s=l.value,s!=null&&Fr(n,!!l.multiple,s,!1)}}}var eh=!1;function Dg(n,s,l){if(eh)return n(s,l);eh=!0;try{var o=n(s);return o}finally{if(eh=!1,(Vr!==null||Kr!==null)&&(Mc(),Vr&&(s=Vr,n=Kr,Kr=Vr=null,Tg(s),n)))for(s=0;s<n.length;s++)Tg(n[s])}}function Gl(n,s){var l=n.stateNode;if(l===null)return null;var o=l[On]||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"),th=!1;if(Gi)try{var Ql={};Object.defineProperty(Ql,"passive",{get:function(){th=!0}}),window.addEventListener("test",Ql,Ql),window.removeEventListener("test",Ql,Ql)}catch{th=!1}var ps=null,nh=null,Ao=null;function Mg(){if(Ao)return Ao;var n,s=nh,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 x=l-n;for(o=1;o<=x&&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 Ag(){return!1}function En(n){function s(l,o,d,p,x){this._reactName=l,this._targetInst=d,this.type=o,this.nativeEvent=p,this.target=x,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:Ag,this.isPropagationStopped=Ag,this}return D(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=En(gs),Zl=D({},gs,{view:0,detail:0}),aC=En(Zl),ih,sh,Jl,Lo=D({},Zl,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:lh,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"?(ih=n.screenX-Jl.screenX,sh=n.screenY-Jl.screenY):sh=ih=0,Jl=n),ih)},movementY:function(n){return"movementY"in n?n.movementY:sh}}),Rg=En(Lo),oC=D({},Lo,{dataTransfer:0}),cC=En(oC),uC=D({},Zl,{relatedTarget:0}),rh=En(uC),hC=D({},gs,{animationName:0,elapsedTime:0,pseudoElement:0}),dC=En(hC),fC=D({},gs,{clipboardData:function(n){return"clipboardData"in n?n.clipboardData:window.clipboardData}}),mC=En(fC),pC=D({},gs,{data:0}),Og=En(pC),gC={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},_C={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"},vC={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function yC(n){var s=this.nativeEvent;return s.getModifierState?s.getModifierState(n):(n=vC[n])?!!s[n]:!1}function lh(){return yC}var SC=D({},Zl,{key:function(n){if(n.key){var s=gC[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"?_C[n.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:lh,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}}),bC=En(SC),xC=D({},Lo,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Bg=En(xC),wC=D({},gs,{submitter:0}),CC=En(wC),kC=D({},Zl,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:lh}),NC=En(kC),EC=D({},gs,{propertyName:0,elapsedTime:0,pseudoElement:0}),jC=En(EC),TC=D({},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}),DC=En(TC),MC=D({},gs,{newState:0,oldState:0,source:0}),AC=En(MC),RC=[9,13,27,32],ah=Gi&&"CompositionEvent"in window,ea=null;Gi&&"documentMode"in document&&(ea=document.documentMode);var OC=Gi&&"TextEvent"in window&&!ea,Lg=Gi&&(!ah||ea&&8<ea&&11>=ea),zg=" ",Hg=!1;function Ig(n,s){switch(n){case"keyup":return RC.indexOf(s.keyCode)!==-1;case"keydown":return s.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Ug(n){return n=n.detail,typeof n=="object"&&"data"in n?n.data:null}var Yr=!1;function BC(n,s){switch(n){case"compositionend":return Ug(s);case"keypress":return s.which!==32?null:(Hg=!0,zg);case"textInput":return n=s.data,n===zg&&Hg?null:n;default:return null}}function LC(n,s){if(Yr)return n==="compositionend"||!ah&&Ig(n,s)?(n=Mg(),Ao=nh=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 Lg&&s.locale!=="ko"?null:s.data;default:return null}}var zC={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 Pg(n){var s=n&&n.nodeName&&n.nodeName.toLowerCase();return s==="input"?!!zC[n.type]:s==="textarea"}function qg(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 HC(n){Ty(n,0)}function zo(n){var s=Xl(n);if(wg(s))return n}function Fg(n,s){if(n==="change")return s}var $g=!1;if(Gi){var oh;if(Gi){var ch="oninput"in document;if(!ch){var Vg=document.createElement("div");Vg.setAttribute("oninput","return;"),ch=typeof Vg.oninput=="function"}oh=ch}else oh=!1;$g=oh&&(!document.documentMode||9<document.documentMode)}function Kg(){ta&&(ta.detachEvent("onpropertychange",Yg),na=ta=null)}function Yg(n){if(n.propertyName==="value"&&zo(na)){var s=[];qg(s,na,n,Ju(n)),Dg(HC,s)}}function IC(n,s,l){n==="focusin"?(Kg(),ta=s,na=l,ta.attachEvent("onpropertychange",Yg)):n==="focusout"&&Kg()}function UC(n){if(n==="selectionchange"||n==="keyup"||n==="keydown")return zo(na)}function PC(n,s){if(n==="click")return zo(s)}function qC(n,s){if(n==="input"||n==="change")return zo(s)}function FC(n,s){return n===s&&(n!==0||1/n===1/s)||n!==n&&s!==s}var Vn=typeof Object.is=="function"?Object.is:FC;function ia(n,s){if(Vn(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(!ot.call(s,d)||!Vn(n[d],s[d]))return!1}return!0}function uh(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 Wg(n){for(;n&&n.firstChild;)n=n.firstChild;return n}function Xg(n,s){var l=Wg(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=Wg(l)}}function Gg(n,s){return n&&s?n===s?!0:n&&n.nodeType===3?!1:s&&s.nodeType===3?Gg(n,s.parentNode):"contains"in n?n.contains(s):n.compareDocumentPosition?!!(n.compareDocumentPosition(s)&16):!1:!1}function Qg(n){n=n!=null&&n.ownerDocument!=null&&n.ownerDocument.defaultView!=null?n.ownerDocument.defaultView:window;for(var s=uh(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=uh(n.document)}return s}function hh(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 $C=Gi&&"documentMode"in document&&11>=document.documentMode,Wr=null,dh=null,sa=null,fh=!1;function Zg(n,s,l){var o=l.window===l?l.document:l.nodeType===9?l:l.ownerDocument;fh||Wr==null||Wr!==uh(o)||(o=Wr,"selectionStart"in o&&hh(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(dh,"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")},mh={},Jg={};Gi&&(Jg=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(mh[n])return mh[n];if(!Xr[n])return n;var s=Xr[n],l;for(l in s)if(s.hasOwnProperty(l)&&l in Jg)return mh[n]=s[l];return n}var e_=tr("animationend"),t_=tr("animationiteration"),n_=tr("animationstart"),VC=tr("transitionrun"),KC=tr("transitionstart"),YC=tr("transitioncancel"),i_=tr("transitionend"),s_=new Map,ph="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(" ");ph.push("scrollEnd");function vi(n,s){s_.set(n,s),Js(s,[n])}var WC=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=WC++;return n="_"+n+"t_"+l.toString(32)+"_",s.autoName=n}function r_(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=r_(n),s=r_(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,gh=0;function Io(){for(var n=Gr,s=gh=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 x=o.pending;x===null?d.next=d:(d.next=x.next,x.next=d),o.pending=d}p!==0&&l_(l,d,p)}}function Uo(n,s,l,o){si[Gr++]=n,si[Gr++]=s,si[Gr++]=l,si[Gr++]=o,gh|=o,n.lanes|=o,n=n.alternate,n!==null&&(n.lanes|=o)}function _h(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 l_(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-hn(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 XC(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 Bn(n,s,l,o){return new XC(n,s,l,o)}function vh(n){return n=n.prototype,!(!n||!n.isReactComponent)}function Ji(n,s){var l=n.alternate;return l===null?(l=Bn(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 a_(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 x=0;if(o=n,typeof o=="function")vh(o)&&(x=1);else if(typeof o=="string")x=wN(n,l,at.current)?26:n==="html"||n==="head"||n==="body"?27:5;else e:switch(o){case De:return n=Bn(31,l,s,d),n.elementType=De,n.lanes=p,n;case G:return ir(l.children,d,p,s);case F:x=8,d|=24;break;case O:return n=Bn(12,l,s,d|2),n.elementType=O,n.lanes=p,n;case se:return n=Bn(13,l,s,d),n.elementType=se,n.lanes=p,n;case ee:return n=Bn(19,l,s,d),n.elementType=ee,n.lanes=p,n;case me:case j:return n=d|32,n=Bn(30,l,s,n),n.elementType=j,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:x=10;break e;case U:x=9;break e;case V:x=11;break e;case ge:x=14;break e;case T:x=16,o=null;break e}x=29,l=Error(r(130,n===null?"null":typeof n,"")),o=null}return s=Bn(x,l,s,d),s.elementType=n,s.type=o,s.lanes=p,s}function ir(n,s,l,o){return n=Bn(7,n,o,s),n.lanes=l,n}function yh(n,s,l){return n=Bn(6,n,null,s),n.lanes=l,n}function o_(n){var s=Bn(18,null,null,0);return s.stateNode=n,s}function Sh(n,s,l){return s=Bn(4,n.children!==null?n.children:[],n.key,s),s.lanes=l,s.stateNode={containerInfo:n.containerInfo,pendingChildren:null,implementation:n.implementation},s}var c_=new WeakMap;function ri(n,s){if(typeof n=="object"&&n!==null){var l=c_.get(n);return l!==void 0?l:(s={value:n,source:s,stack:Xe(s)},c_.set(n,s),s)}return{value:n,source:s,stack:Xe(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 u_(n,s,l){li[ai++]=ji,li[ai++]=Ti,li[ai++]=_s,_s=n;var o=ji;n=Ti;var d=32-hn(o)-1;o&=~(1<<d),l+=1;var p=32-hn(s)+d;if(30<p){var x=d-d%5;p=(o&(1<<x)-1).toString(32),o>>=x,d-=x,ji=1<<32-hn(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),u_(n,1,0))}function bh(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 h_(n,s){li[ai++]=ji,li[ai++]=Ti,li[ai++]=_s,ji=s.id,Ti=s.overflow,_s=n}var nn=null,kt=null,Ge=!1,vs=null,oi=!1,xh=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)),xh}function d_(n){var s=n.stateNode,l=n.type,o=n.memoizedProps;switch(s[dn]=n,s[On]=o,l){case"dialog":it("cancel",s),it("close",s);break;case"iframe":case"object":case"embed":it("load",s);break;case"video":case"audio":for(l=0;l<ja.length;l++)it(ja[l],s);break;case"source":it("error",s);break;case"img":case"image":case"link":it("error",s),it("load",s);break;case"details":it("toggle",s);break;case"input":it("invalid",s),Cg(s,o.value,o.defaultValue,o.checked,o.defaultChecked,o.type,o.name,!0);break;case"select":it("invalid",s);break;case"textarea":it("invalid",s),Ng(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||Ry(s.textContent,l)?(o.popover!=null&&(it("beforetoggle",s),it("toggle",s)),o.onScroll!=null&&it("scroll",s),o.onScrollEnd!=null&&it("scrollend",s),o.onClick!=null&&(s.onclick=Ei),s=!0):s=!1,s||ys(n,!0)}function Vo(n){for(nn=n.return;nn;)switch(nn.tag){case 5:case 31:case 13:oi=!1;return;case 27:case 3:oi=!0;return;default:nn=nn.return}}function el(n){if(n!==nn)return!1;if(!Ge)return Vo(n),Ge=!0,!1;var s=n.tag,l;if((l=s!==3&&s!==27)&&((l=s===5)&&(l=n.type,l=!(l!=="form"&&l!=="button")||Zd(n.type,n.memoizedProps)),l=!l),l&&kt&&ys(n),Vo(n),s===13){if(n=n.memoizedState,n=n!==null?n.dehydrated:null,!n)throw Error(r(317));kt=Zy(n)}else if(s===31){if(n=n.memoizedState,n=n!==null?n.dehydrated:null,!n)throw Error(r(317));kt=Zy(n)}else s===27?(s=kt,Bs(n.type)?(n=of,of=null,kt=n):kt=s):kt=nn?ui(n.stateNode.nextSibling):null;return!0}function sr(){kt=nn=null,Ge=!1}function wh(){var n=vs;return n!==null&&(Hn===null?Hn=n:Hn.push.apply(Hn,n),vs=null),n}function la(n){vs===null?vs=[n]:vs.push(n)}var Ch=_e(null),rr=null,ts=null;function Ss(n,s,l){Ee(Ch,s._currentValue),s._currentValue=l}function ns(n){n._currentValue=Ch.current,Ce(Ch)}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 kh(n,s,l,o){var d=n.child;for(d!==null&&(d.return=n);d!==null;){var p=d.dependencies;if(p!==null){var x=d.child;p=p.firstContext;e:for(;p!==null;){var k=p;p=d;for(var L=0;L<s.length;L++)if(k.context===s[L]){p.lanes|=l,k=p.alternate,k!==null&&(k.lanes|=l),Ko(p.return,l,n),o||(x=null);break e}p=k.next}}else if(d.tag===18){if(x=d.return,x===null)throw Error(r(341));x.lanes|=l,p=x.alternate,p!==null&&(p.lanes|=l),Ko(x,l,n),x=null}else d.tag===13&&d.memoizedState!==null&&d.memoizedState.dehydrated===null?(d.lanes|=l,x=d.alternate,x!==null&&(x.lanes|=l),Ko(d.return,l,n),x=d.child,x=x!==null?x.sibling:null):x=d.child;if(x!==null)x.return=d;else for(x=d;x!==null;){if(x===n){x=null;break}if(d=x.sibling,d!==null){d.return=x.return,x=d;break}x=x.return}d=x}}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 x=d.alternate;if(x===null)throw Error(r(387));if(x=x.memoizedProps,x!==null){var k=d.type;Vn(d.pendingProps.value,x.value)||(n!==null?n.push(k):n=[k])}}else if(d===Te.current){if(x=d.alternate,x===null)throw Error(r(387));x.memoizedState.memoizedState!==d.memoizedState.memoizedState&&(n!==null?n.push(kl):n=[kl])}d=d.return}return n!==null&&kh(s,n,l,o),s.flags|=262144,n!==null}function Yo(n){for(n=n.firstContext;n!==null;){if(!Vn(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 fn(n){return f_(rr,n)}function Wo(n,s){return rr===null&&ar(n),f_(n,s)}function f_(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 GC=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()})}},QC=e.unstable_scheduleCallback,ZC=e.unstable_NormalPriority,Ft={$$typeof:K,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Nh(){return{controller:new GC,data:new Map,refCount:0}}function aa(n){n.refCount--,n.refCount===0&&QC(ZC,function(){n.controller.abort()})}function m_(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 JC(n){var s=n.transitionTypes;return n.transitionTypes=null,s}var ca=null,Eh=0,or=0,tl=null;function ek(n,s){if(ca===null){var l=ca=[];Eh=0,or=Fd(),tl={status:"pending",value:void 0,then:function(o){l.push(o)}}}return Eh++,s.then(p_,p_),s}function p_(){if(--Eh===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 tk(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 g_=de.S;de.S=function(n,s){if(oy=qt(),typeof s=="object"&&s!==null&&typeof s.then=="function"&&ek(n,s),oa!==null)for(var l=yl;l!==null;)m_(l,oa),l=l.next;if(l=n.types,l!==null){for(var o=yl;o!==null;)m_(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)}}}g_!==null&&g_(n,s)};var cr=_e(null);function jh(){var n=cr.current;return n!==null?n:xt.pooledCache}function Xo(n,s){s===null?Ee(cr,cr.current):Ee(cr,s.pool)}function __(){var n=jh();return n===null?null:{parent:Ft._currentValue,pool:n}}var nl=Error(r(460)),Th=Error(r(474)),Go=Error(r(542)),Qo={then:function(){}};function v_(n){return n=n.status,n==="fulfilled"||n==="rejected"}function y_(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,b_(n),n===void 0&&!("reason"in s)?Error(r(600)):n;default:if(typeof s.status=="string")s.then(Ei,Ei);else{if(n=xt,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,b_(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 S_(){if(hr===null)throw Error(r(459));var n=hr;return hr=null,n}function b_(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=[]),y_(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 x_(n){function s(W,P){if(n){var Q=W.deletions;Q===null?(W.deletions=[P],W.flags|=16):Q.push(P)}}function l(W,P){if(!n)return null;for(;P!==null;)s(W,P),P=P.sibling;return null}function o(W){for(var P=new Map;W!==null;)W.key===null?P.set(W.index,W):P.set(W.key,W),W=W.sibling;return P}function d(W,P){return W=Ji(W,P),W.index=0,W.sibling=null,W}function p(W,P,Q){return W.index=Q,n?(Q=W.alternate,Q!==null?(Q=Q.index,Q<P?(W.flags|=2,P):Q):(W.flags|=134217730,P)):(W.flags|=1048576,P)}function x(W){return n&&W.alternate===null&&(W.flags|=134217730),W}function k(W,P,Q,ce){return P===null||P.tag!==6?(P=yh(Q,W.mode,ce),P.return=W,P):(P=d(P,Q),P.return=W,P)}function L(W,P,Q,ce){var Be=Q.type;return Be===G?(W=te(W,P,Q.props.children,ce,Q.key),bs(W,Q),W):P!==null&&(P.elementType===Be||typeof Be=="object"&&Be!==null&&Be.$$typeof===T&&ur(Be)===P.type)?(P=d(P,Q.props),bs(P,Q),P.return=W,P):(P=qo(Q.type,Q.key,Q.props,null,W.mode,ce),bs(P,Q),P.return=W,P)}function X(W,P,Q,ce){return P===null||P.tag!==4||P.stateNode.containerInfo!==Q.containerInfo||P.stateNode.implementation!==Q.implementation?(P=Sh(Q,W.mode,ce),P.return=W,P):(P=d(P,Q.children||[]),P.return=W,P)}function te(W,P,Q,ce,Be){return P===null||P.tag!==7?(P=ir(Q,W.mode,ce,Be),P.return=W,P):(P=d(P,Q),P.return=W,P)}function he(W,P,Q){if(typeof P=="string"&&P!==""||typeof P=="number"||typeof P=="bigint")return P=yh(""+P,W.mode,Q),P.return=W,P;if(typeof P=="object"&&P!==null){switch(P.$$typeof){case ae:return Q=qo(P.type,P.key,P.props,null,W.mode,Q),bs(Q,P),Q.return=W,Q;case I:return P=Sh(P,W.mode,Q),P.return=W,P;case T:return P=ur(P),he(W,P,Q)}if(je(P)||ie(P))return P=ir(P,W.mode,Q,null),P.return=W,P;if(typeof P.then=="function")return he(W,Zo(P),Q);if(P.$$typeof===K)return he(W,Wo(W,P),Q);Jo(W,P)}return null}function Y(W,P,Q,ce){var Be=P!==null?P.key:null;if(typeof Q=="string"&&Q!==""||typeof Q=="number"||typeof Q=="bigint")return Be!==null?null:k(W,P,""+Q,ce);if(typeof Q=="object"&&Q!==null){switch(Q.$$typeof){case ae:return Q.key===Be?L(W,P,Q,ce):null;case I:return Q.key===Be?X(W,P,Q,ce):null;case T:return Q=ur(Q),Y(W,P,Q,ce)}if(je(Q)||ie(Q))return Be!==null?null:te(W,P,Q,ce,null);if(typeof Q.then=="function")return Y(W,P,Zo(Q),ce);if(Q.$$typeof===K)return Y(W,P,Wo(W,Q),ce);Jo(W,Q)}return null}function J(W,P,Q,ce,Be){if(typeof ce=="string"&&ce!==""||typeof ce=="number"||typeof ce=="bigint")return W=W.get(Q)||null,k(P,W,""+ce,Be);if(typeof ce=="object"&&ce!==null){switch(ce.$$typeof){case ae:return W=W.get(ce.key===null?Q:ce.key)||null,L(P,W,ce,Be);case I:return W=W.get(ce.key===null?Q:ce.key)||null,X(P,W,ce,Be);case T:return ce=ur(ce),J(W,P,Q,ce,Be)}if(je(ce)||ie(ce))return W=W.get(Q)||null,te(P,W,ce,Be,null);if(typeof ce.then=="function")return J(W,P,Q,Zo(ce),Be);if(ce.$$typeof===K)return J(W,P,Q,Wo(P,ce),Be);Jo(P,ce)}return null}function Ne(W,P,Q,ce){for(var Be=null,lt=null,He=P,Pe=P=0,Kt=null;He!==null&&Pe<Q.length;Pe++){He.index>Pe?(Kt=He,He=null):Kt=He.sibling;var ct=Y(W,He,Q[Pe],ce);if(ct===null){He===null&&(He=Kt);break}n&&He&&ct.alternate===null&&s(W,He),P=p(ct,P,Pe),lt===null?Be=ct:lt.sibling=ct,lt=ct,He=Kt}if(Pe===Q.length)return l(W,He),Ge&&es(W,Pe),Be;if(He===null){for(;Pe<Q.length;Pe++)He=he(W,Q[Pe],ce),He!==null&&(P=p(He,P,Pe),lt===null?Be=He:lt.sibling=He,lt=He);return Ge&&es(W,Pe),Be}for(He=o(He);Pe<Q.length;Pe++)Kt=J(He,W,Pe,Q[Pe],ce),Kt!==null&&(n&&(ct=Kt.alternate,ct!==null&&He.delete(ct.key===null?Pe:ct.key)),P=p(Kt,P,Pe),lt===null?Be=Kt:lt.sibling=Kt,lt=Kt);return n&&He.forEach(function(Us){return s(W,Us)}),Ge&&es(W,Pe),Be}function Le(W,P,Q,ce){if(Q==null)throw Error(r(151));for(var Be=null,lt=null,He=P,Pe=P=0,Kt=null,ct=Q.next();He!==null&&!ct.done;Pe++,ct=Q.next()){He.index>Pe?(Kt=He,He=null):Kt=He.sibling;var Us=Y(W,He,ct.value,ce);if(Us===null){He===null&&(He=Kt);break}n&&He&&Us.alternate===null&&s(W,He),P=p(Us,P,Pe),lt===null?Be=Us:lt.sibling=Us,lt=Us,He=Kt}if(ct.done)return l(W,He),Ge&&es(W,Pe),Be;if(He===null){for(;!ct.done;Pe++,ct=Q.next())ct=he(W,ct.value,ce),ct!==null&&(P=p(ct,P,Pe),lt===null?Be=ct:lt.sibling=ct,lt=ct);return Ge&&es(W,Pe),Be}for(He=o(He);!ct.done;Pe++,ct=Q.next())ct=J(He,W,Pe,ct.value,ce),ct!==null&&(n&&(Kt=ct.alternate,Kt!==null&&He.delete(Kt.key===null?Pe:Kt.key)),P=p(ct,P,Pe),lt===null?Be=ct:lt.sibling=ct,lt=ct);return n&&He.forEach(function(BN){return s(W,BN)}),Ge&&es(W,Pe),Be}function Ke(W,P,Q,ce){if(typeof Q=="object"&&Q!==null&&Q.type===G&&Q.key===null&&Q.props.ref===void 0&&(Q=Q.props.children),typeof Q=="object"&&Q!==null){switch(Q.$$typeof){case ae:e:{for(var Be=Q.key;P!==null;){if(P.key===Be){if(Be=Q.type,Be===G){if(P.tag===7){l(W,P.sibling),ce=d(P,Q.props.children),bs(ce,Q),ce.return=W,W=ce;break e}}else if(P.elementType===Be||typeof Be=="object"&&Be!==null&&Be.$$typeof===T&&ur(Be)===P.type){l(W,P.sibling),ce=d(P,Q.props),bs(ce,Q),ce.return=W,W=ce;break e}l(W,P);break}else s(W,P);P=P.sibling}Q.type===G?(ce=ir(Q.props.children,W.mode,ce,Q.key),bs(ce,Q),ce.return=W,W=ce):(ce=qo(Q.type,Q.key,Q.props,null,W.mode,ce),bs(ce,Q),ce.return=W,W=ce)}return x(W);case I:e:{for(Be=Q.key;P!==null;){if(P.key===Be)if(P.tag===4&&P.stateNode.containerInfo===Q.containerInfo&&P.stateNode.implementation===Q.implementation){l(W,P.sibling),ce=d(P,Q.children||[]),ce.return=W,W=ce;break e}else{l(W,P);break}else s(W,P);P=P.sibling}ce=Sh(Q,W.mode,ce),ce.return=W,W=ce}return x(W);case T:return Q=ur(Q),Ke(W,P,Q,ce)}if(je(Q))return Ne(W,P,Q,ce);if(ie(Q)){if(Be=ie(Q),typeof Be!="function")throw Error(r(150));return Q=Be.call(Q),Le(W,P,Q,ce)}if(typeof Q.then=="function")return Ke(W,P,Zo(Q),ce);if(Q.$$typeof===K)return Ke(W,P,Wo(W,Q),ce);Jo(W,Q)}return typeof Q=="string"&&Q!==""||typeof Q=="number"||typeof Q=="bigint"?(Q=""+Q,P!==null&&P.tag===6?(l(W,P.sibling),ce=d(P,Q),ce.return=W,W=ce):(l(W,P),ce=yh(Q,W.mode,ce),ce.return=W,W=ce),x(W)):l(W,P)}return function(W,P,Q,ce){try{ua=0;var Be=Ke(W,P,Q,ce);return il=null,Be}catch(He){if(He===nl||He===Go)throw He;var lt=Bn(29,He,null,W.mode);return lt.lanes=ce,lt.return=W,lt}}}var dr=x_(!0),w_=x_(!1),xs=!1;function Dh(n){n.updateQueue={baseState:n.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Mh(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,(ft&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),l_(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,ug(n,l)}}function Ah(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 x={lane:l.lane,tag:l.tag,payload:l.payload,callback:null,next:null};p===null?d=p=x:p=p.next=x,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 Rh=!1;function da(){if(Rh){var n=tl;if(n!==null)throw n}}function fa(n,s,l,o){Rh=!1;var d=n.updateQueue;xs=!1;var p=d.firstBaseUpdate,x=d.lastBaseUpdate,k=d.shared.pending;if(k!==null){d.shared.pending=null;var L=k,X=L.next;L.next=null,x===null?p=X:x.next=X,x=L;var te=n.alternate;te!==null&&(te=te.updateQueue,k=te.lastBaseUpdate,k!==x&&(k===null?te.firstBaseUpdate=X:k.next=X,te.lastBaseUpdate=L))}if(p!==null){var he=d.baseState;x=0,te=X=L=null,k=p;do{var Y=k.lane&-536870913,J=Y!==k.lane;if(J?(rt&Y)===Y:(o&Y)===Y){Y!==0&&Y===or&&(Rh=!0),te!==null&&(te=te.next={lane:0,tag:k.tag,payload:k.payload,callback:null,next:null});e:{var Ne=n,Le=k;Y=s;var Ke=l;switch(Le.tag){case 1:if(Ne=Le.payload,typeof Ne=="function"){he=Ne.call(Ke,he,Y);break e}he=Ne;break e;case 3:Ne.flags=Ne.flags&-65537|128;case 0:if(Ne=Le.payload,Y=typeof Ne=="function"?Ne.call(Ke,he,Y):Ne,Y==null)break e;he=D({},he,Y);break e;case 2:xs=!0}}Y=k.callback,Y!==null&&(n.flags|=64,J&&(n.flags|=8192),J=d.callbacks,J===null?d.callbacks=[Y]:J.push(Y))}else J={lane:Y,tag:k.tag,payload:k.payload,callback:k.callback,next:null},te===null?(X=te=J,L=he):te=te.next=J,x|=Y;if(k=k.next,k===null){if(k=d.shared.pending,k===null)break;J=k,k=J.next,J.next=null,d.lastBaseUpdate=J,d.shared.pending=null}}while(!0);te===null&&(L=he),d.baseState=L,d.firstBaseUpdate=X,d.lastBaseUpdate=te,p===null&&(d.shared.lanes=0),Ms|=x,n.lanes=x,n.memoizedState=he}}function C_(n,s){if(typeof n!="function")throw Error(r(191,n));n.call(s)}function k_(n,s){var l=n.callbacks;if(l!==null)for(n.callbacks=null,n=0;n<l.length;n++)C_(l[n],s)}var ks=_e(null),ec=_e(0);function N_(n,s){n=as,Ee(ec,n),Ee(ks,s),as=n|s.baseLanes}function Oh(){Ee(ec,as),Ee(ks,ks.current)}function Bh(){as=ec.current,Ce(ks),Ce(ec)}var mn=_e(null),xn=null;function Ns(n){var s=n.alternate;Ee(pn,pn.current&1),Ee(mn,n),xn===null&&(s===null||ks.current!==null||s.memoizedState!==null)&&(xn=n)}function Lh(n){Ee(pn,pn.current),Ee(mn,n),xn===null&&(xn=n)}function E_(n){n.tag===22?(Ee(pn,pn.current),Ee(mn,n),xn===null&&(xn=n)):Es()}function Es(){Ee(pn,pn.current),Ee(mn,mn.current)}function Kn(n){Ce(mn),xn===n&&(xn=null),Ce(pn)}var pn=_e(0);function ma(n,s){Ee(mn,mn.current),Ee(pn,s)}function zh(n){Ce(pn),Ce(mn),xn===n&&(xn=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||lf(l)||af(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,Ve=null,St=null,$t=null,nc=!1,sl=!1,fr=!1,ic=0,pa=0,rl=null,nk=0;function Bt(){throw Error(r(321))}function Hh(n,s){if(s===null)return!1;for(var l=0;l<s.length&&l<n.length;l++)if(!Vn(n[l],s[l]))return!1;return!0}function Ih(n,s,l,o,d,p){return is=p,Ve=s,s.memoizedState=null,s.updateQueue=null,s.lanes=0,de.H=n===null||n.memoizedState===null?uv:hv,fr=!1,p=l(o,d),fr=!1,sl&&(p=T_(s,l,o,d)),j_(n),p}function j_(n){de.H=uc;var s=St!==null&&St.next!==null;if(is=0,$t=St=Ve=null,nc=!1,pa=0,rl=null,s)throw Error(r(300));n===null||Vt||(n=n.dependencies,n!==null&&Yo(n)&&(Vt=!0))}function T_(n,s,l,o){Ve=n;var d=0;do{if(sl&&(rl=null),pa=0,sl=!1,25<=d)throw Error(r(301));if(d+=1,$t=St=null,n.updateQueue!=null){var p=n.updateQueue;p.lastEffect=null,p.events=null,p.stores=null,p.memoCache!=null&&(p.memoCache.index=0)}de.H=uk,p=s(l,o)}while(sl);return p}function ik(){var n=de.H,s=n.useState()[0];return s=typeof s.then=="function"?ga(s):s,n=n.useState()[0],(St!==null?St.memoizedState:null)!==n&&(Ve.flags|=1024),s}function Uh(){var n=ic!==0;return ic=0,n}function Ph(n,s,l){s.updateQueue=n.updateQueue,s.flags&=-2053,n.lanes&=~l}function qh(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,$t=St=Ve=null,sl=!1,pa=ic=0,rl=null}function jn(){var n={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return $t===null?Ve.memoizedState=$t=n:$t=$t.next=n,$t}function Ut(){if(St===null){var n=Ve.alternate;n=n!==null?n.memoizedState:null}else n=St.next;var s=$t===null?Ve.memoizedState:$t.next;if(s!==null)$t=s,St=n;else{if(n===null)throw Ve.alternate===null?Error(r(467)):Error(r(310));St=n,n={memoizedState:St.memoizedState,baseState:St.baseState,baseQueue:St.baseQueue,queue:St.queue,next:null},$t===null?Ve.memoizedState=$t=n:$t=$t.next=n}return $t}function sc(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function ga(n){var s=pa;return pa+=1,rl===null&&(rl=[]),n=y_(rl,n,s),s=Ve,($t===null?s.memoizedState:$t.next)===null&&(s=s.alternate,de.H=s===null||s.memoizedState===null?uv:hv),n}function rc(n){if(n!==null&&typeof n=="object"){if(typeof n.then=="function")return ga(n);if(n.$$typeof===Z)return;if(n.$$typeof===K)return fn(n)}throw Error(r(438,String(n)))}function Fh(n){var s=null,l=Ve.updateQueue;if(l!==null&&(s=l.memoCache),s==null){var o=Ve.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(),Ve.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]=M;return s.index++,l}function ss(n,s){return typeof s=="function"?s(n):s}function lc(n){var s=Ut();return $h(s,St,n)}function $h(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 x=d.next;d.next=p.next,p.next=x}s.baseQueue=d=p,o.pending=null}if(p=n.baseState,d===null)n.memoizedState=p;else{s=d.next;var k=x=null,L=null,X=s,te=!1;do{var he=X.lane&-536870913;if(he!==X.lane?(rt&he)===he:(is&he)===he){var Y=X.revertLane;if(Y===0)L!==null&&(L=L.next={lane:0,revertLane:0,gesture:null,action:X.action,hasEagerState:X.hasEagerState,eagerState:X.eagerState,next:null}),he===or&&(te=!0);else if((is&Y)===Y){X=X.next,Y===or&&(te=!0);continue}else he={lane:0,revertLane:X.revertLane,gesture:null,action:X.action,hasEagerState:X.hasEagerState,eagerState:X.eagerState,next:null},L===null?(k=L=he,x=p):L=L.next=he,Ve.lanes|=Y,Ms|=Y;he=X.action,fr&&l(p,he),p=X.hasEagerState?X.eagerState:l(p,he)}else Y={lane:he,revertLane:X.revertLane,gesture:X.gesture,action:X.action,hasEagerState:X.hasEagerState,eagerState:X.eagerState,next:null},L===null?(k=L=Y,x=p):L=L.next=Y,Ve.lanes|=he,Ms|=he;X=X.next}while(X!==null&&X!==s);if(L===null?x=p:L.next=k,!Vn(p,n.memoizedState)&&(Vt=!0,te&&(l=tl,l!==null)))throw l;n.memoizedState=p,n.baseState=x,n.baseQueue=L,o.lastRenderedState=p}return d===null&&(o.lanes=0),[n.memoizedState,o.dispatch]}function Vh(n){var s=Ut(),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 x=d=d.next;do p=n(p,x.action),x=x.next;while(x!==d);Vn(p,s.memoizedState)||(Vt=!0),s.memoizedState=p,s.baseQueue===null&&(s.baseState=p),l.lastRenderedState=p}return[p,o]}function D_(n,s,l){var o=Ve,d=Ut(),p=Ge;if(p){if(l===void 0)throw Error(r(407));l=l()}else l=s();var x=!Vn((St||d).memoizedState,l);if(x&&(d.memoizedState=l,Vt=!0),d=d.queue,Wh(R_.bind(null,o,d,n),[n]),n=d.getSnapshot!==s||x||$t!==null&&($t.memoizedState.tag&1)!==0,ll(n?9:8,{destroy:void 0},A_.bind(null,o,d,l,s),null),n){if(o.flags|=2048,xt===null)throw Error(r(349));p||(is&127)!==0||M_(o,s,l)}return l}function M_(n,s,l){n.flags|=16384,n={getSnapshot:s,value:l},s=Ve.updateQueue,s===null?(s=sc(),Ve.updateQueue=s,s.stores=[n]):(l=s.stores,l===null?s.stores=[n]:l.push(n))}function A_(n,s,l,o){s.value=l,s.getSnapshot=o,O_(s)&&B_(n)}function R_(n,s,l){return l(function(){O_(s)&&B_(n)})}function O_(n){var s=n.getSnapshot;n=n.value;try{var l=s();return!Vn(n,l)}catch{return!0}}function B_(n){var s=nr(n,2);s!==null&&In(s,n,2)}function Kh(n){var s=jn();if(typeof n=="function"){var l=n;if(n=l(),fr){It(!0);try{l()}finally{It(!1)}}}return s.memoizedState=s.baseState=n,s.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:ss,lastRenderedState:n},s}function L_(n,s,l,o){return n.baseState=l,$h(n,St,typeof o=="function"?o:ss)}function sk(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(x){p.listeners.push(x)}};de.T!==null?l(!0):p.isTransition=!1,o(p),l=s.pending,l===null?(p.next=s.pending=p,z_(s,p)):(p.next=l.next,s.pending=l.next=p)}}function z_(n,s){var l=s.action,o=s.payload,d=n.state;if(s.isTransition){var p=de.T,x={};x.types=p!==null?p.types:null,de.T=x;try{var k=l(d,o),L=de.S;L!==null&&L(x,k),H_(n,s,k)}catch(X){Yh(n,s,X)}finally{p!==null&&x.types!==null&&(p.types=x.types),de.T=p}}else try{p=l(d,o),H_(n,s,p)}catch(X){Yh(n,s,X)}}function H_(n,s,l){l!==null&&typeof l=="object"&&typeof l.then=="function"?l.then(function(o){I_(n,s,o)},function(o){return Yh(n,s,o)}):I_(n,s,l)}function I_(n,s,l){s.status="fulfilled",s.value=l,U_(s),n.state=l,s=n.pending,s!==null&&(l=s.next,l===s?n.pending=null:(l=l.next,s.next=l,z_(n,l)))}function Yh(n,s,l){var o=n.pending;if(n.pending=null,o!==null){o=o.next;do s.status="rejected",s.reason=l,U_(s),s=s.next;while(s!==o)}n.action=null}function U_(n){n=n.listeners;for(var s=0;s<n.length;s++)(0,n[s])()}function P_(n,s){return s}function q_(n,s){if(Ge){var l=xt.formState;if(l!==null){e:{var o=Ve;if(Ge){if(kt){t:{for(var d=kt,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){kt=ui(d.nextSibling),o=d.data==="F!";break e}}ys(o)}o=!1}o&&(s=l[0])}}return l=jn(),l.memoizedState=l.baseState=s,o={pending:null,lanes:0,dispatch:null,lastRenderedReducer:P_,lastRenderedState:s},l.queue=o,l=av.bind(null,Ve,o),o.dispatch=l,o=Kh(!1),p=Jh.bind(null,Ve,!1,o.queue),o=jn(),d={state:s,dispatch:null,action:n,pending:null},o.queue=d,l=sk.bind(null,Ve,d,p,l),d.dispatch=l,o.memoizedState=n,[s,l,!1]}function F_(n){var s=Ut();return $_(s,St,n)}function $_(n,s,l){if(s=$h(n,s,P_)[0],n=lc(ss)[0],typeof s=="object"&&s!==null&&typeof s.then=="function")try{var o=ga(s)}catch(x){throw x===nl?Go:x}else o=s;s=Ut();var d=s.queue,p=d.dispatch;return l!==s.memoizedState&&(Ve.flags|=2048,ll(9,{destroy:void 0},rk.bind(null,d,l),null)),[o,p,n]}function rk(n,s){n.action=s}function V_(n){var s=Ut(),l=St;if(l!==null)return $_(s,l,n);Ut(),s=s.memoizedState,l=Ut();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=Ve.updateQueue,s===null&&(s=sc(),Ve.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 K_(){return Ut().memoizedState}function ac(n,s,l,o){var d=jn();Ve.flags|=n,d.memoizedState=ll(1|s,{destroy:void 0},l,o===void 0?null:o)}function oc(n,s,l,o){var d=Ut();o=o===void 0?null:o;var p=d.memoizedState.inst;St!==null&&o!==null&&Hh(o,St.memoizedState.deps)?d.memoizedState=ll(s,p,l,o):(Ve.flags|=n,d.memoizedState=ll(1|s,p,l,o))}function Y_(n,s){ac(8390656,8,n,s)}function Wh(n,s){oc(2048,8,n,s)}function lk(n){Ve.flags|=4;var s=Ve.updateQueue;if(s===null)s=sc(),Ve.updateQueue=s,s.events=[n];else{var l=s.events;l===null?s.events=[n]:l.push(n)}}function W_(n){var s=Ut().memoizedState;return lk({ref:s,nextImpl:n}),function(){if((ft&2)!==0)throw Error(r(440));return s.impl.apply(void 0,arguments)}}function X_(n,s){return oc(4,2,n,s)}function G_(n,s){return oc(4,4,n,s)}function Q_(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 Z_(n,s,l){l=l!=null?l.concat([n]):null,oc(4,4,Q_.bind(null,s,n),l)}function Xh(){}function J_(n,s){var l=Ut();s=s===void 0?null:s;var o=l.memoizedState;return s!==null&&Hh(s,o[1])?o[0]:(l.memoizedState=[n,s],n)}function ev(n,s){var l=Ut();s=s===void 0?null:s;var o=l.memoizedState;if(s!==null&&Hh(s,o[1]))return o[0];if(o=n(),fr){It(!0);try{n()}finally{It(!1)}}return l.memoizedState=[o,s],o}function Gh(n,s,l){return l===void 0||(is&1073741824)!==0&&(rt&261930)===0?n.memoizedState=s:(n.memoizedState=l,n=uy(),Ve.lanes|=n,Ms|=n,l)}function tv(n,s,l,o){return Vn(l,s)?l:ks.current!==null?(n=Gh(n,l,o),Vn(n,s)||(Vt=!0),n):(is&106)===0||(is&1073741824)!==0&&(rt&261930)===0?(Vt=!0,n.memoizedState=l):(n=uy(),Ve.lanes|=n,Ms|=n,s)}function nv(n,s,l,o,d){var p=be.p;be.p=p!==0&&8>p?p:8;var x=de.T,k={};k.types=x!==null?x.types:null,de.T=k,Jh(n,!1,s,l);try{var L=d(),X=de.S;if(X!==null&&X(k,L),L!==null&&typeof L=="object"&&typeof L.then=="function"){var te=tk(L,o);_a(n,s,te,Gn(n))}else _a(n,s,o,Gn(n))}catch(he){_a(n,s,{then:function(){},status:"rejected",reason:he},Gn())}finally{be.p=p,x!==null&&k.types!==null&&(x.types=k.types),de.T=x}}function ak(){}function Qh(n,s,l,o){if(n.tag!==5)throw Error(r(476));var d=iv(n).queue;nv(n,d,s,Ae,l===null?ak:function(){return sv(n),l(o)})}function iv(n){var s=n.memoizedState;if(s!==null)return s;s={memoizedState:Ae,baseState:Ae,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:ss,lastRenderedState:Ae},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 sv(n){var s=iv(n);s.next===null&&(s=n.alternate.memoizedState),_a(n,s.next.queue,{},Gn())}function Zh(){return fn(kl)}function rv(){return Ut().memoizedState}function lv(){return Ut().memoizedState}function ok(n){for(var s=n.return;s!==null;){switch(s.tag){case 24:case 3:var l=Gn();n=ws(l);var o=Cs(s,n,l);o!==null&&(In(o,s,l),ha(o,s,l)),s={cache:Nh()},n.payload=s;return}s=s.return}}function ck(n,s,l){var o=Gn();l={lane:o,revertLane:0,gesture:null,action:l,hasEagerState:!1,eagerState:null,next:null},cc(n)?ov(s,l):(l=_h(n,s,l,o),l!==null&&(In(l,n,o),cv(l,s,o)))}function av(n,s,l){var o=Gn();_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))ov(s,d);else{var p=n.alternate;if(n.lanes===0&&(p===null||p.lanes===0)&&(p=s.lastRenderedReducer,p!==null))try{var x=s.lastRenderedState,k=p(x,l);if(d.hasEagerState=!0,d.eagerState=k,Vn(k,x))return Uo(n,s,d,0),xt===null&&Io(),!1}catch{}if(l=_h(n,s,d,o),l!==null)return In(l,n,o),cv(l,s,o),!0}return!1}function Jh(n,s,l,o){if(o={lane:2,revertLane:Fd(),gesture:null,action:o,hasEagerState:!1,eagerState:null,next:null},cc(n)){if(s)throw Error(r(479))}else s=_h(n,l,o,2),s!==null&&In(s,n,2)}function cc(n){var s=n.alternate;return n===Ve||s!==null&&s===Ve}function ov(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 cv(n,s,l){if((l&4194048)!==0){var o=s.lanes;o&=n.pendingLanes,l|=o,s.lanes=l,ug(n,l)}}var uc={readContext:fn,use:rc,useCallback:Bt,useContext:Bt,useEffect:Bt,useImperativeHandle:Bt,useLayoutEffect:Bt,useInsertionEffect:Bt,useMemo:Bt,useReducer:Bt,useRef:Bt,useState:Bt,useDebugValue:Bt,useDeferredValue:Bt,useTransition:Bt,useSyncExternalStore:Bt,useId:Bt,useHostTransitionStatus:Bt,useFormState:Bt,useActionState:Bt,useOptimistic:Bt,useMemoCache:Bt,useCacheRefresh:Bt,useEffectEvent:Bt},uv={readContext:fn,use:rc,useCallback:function(n,s){return jn().memoizedState=[n,s===void 0?null:s],n},useContext:fn,useEffect:Y_,useImperativeHandle:function(n,s,l){l=l!=null?l.concat([n]):null,ac(4194308,4,Q_.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=jn();s=s===void 0?null:s;var o=n();if(fr){It(!0);try{n()}finally{It(!1)}}return l.memoizedState=[o,s],o},useReducer:function(n,s,l){var o=jn();if(l!==void 0){var d=l(s);if(fr){It(!0);try{l(s)}finally{It(!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=ck.bind(null,Ve,n),[o.memoizedState,n]},useRef:function(n){var s=jn();return n={current:n},s.memoizedState=n},useState:function(n){n=Kh(n);var s=n.queue,l=av.bind(null,Ve,s);return s.dispatch=l,[n.memoizedState,l]},useDebugValue:Xh,useDeferredValue:function(n,s){var l=jn();return Gh(l,n,s)},useTransition:function(){var n=Kh(!1);return n=nv.bind(null,Ve,n.queue,!0,!1),jn().memoizedState=n,[!1,n]},useSyncExternalStore:function(n,s,l){var o=Ve,d=jn();if(Ge){if(l===void 0)throw Error(r(407));l=l()}else{if(l=s(),xt===null)throw Error(r(349));(rt&127)!==0||M_(o,s,l)}d.memoizedState=l;var p={value:l,getSnapshot:s};return d.queue=p,Y_(R_.bind(null,o,p,n),[n]),o.flags|=2048,ll(9,{destroy:void 0},A_.bind(null,o,p,l,s),null),l},useId:function(){var n=jn(),s=xt.identifierPrefix;if(Ge){var l=Ti,o=ji;l=(o&~(1<<32-hn(o)-1)).toString(32)+l,s="_"+s+"R_"+l,l=ic++,0<l&&(s+="H"+l.toString(32)),s+="_"}else l=nk++,s="_"+s+"r_"+l.toString(32)+"_";return n.memoizedState=s},useHostTransitionStatus:Zh,useFormState:q_,useActionState:q_,useOptimistic:function(n){var s=jn();s.memoizedState=s.baseState=n;var l={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return s.queue=l,s=Jh.bind(null,Ve,!0,l),l.dispatch=s,[n,s]},useMemoCache:Fh,useCacheRefresh:function(){return jn().memoizedState=ok.bind(null,Ve)},useEffectEvent:function(n){var s=jn(),l={impl:n};return s.memoizedState=l,function(){if((ft&2)!==0)throw Error(r(440));return l.impl.apply(void 0,arguments)}}},hv={readContext:fn,use:rc,useCallback:J_,useContext:fn,useEffect:Wh,useImperativeHandle:Z_,useInsertionEffect:X_,useLayoutEffect:G_,useMemo:ev,useReducer:lc,useRef:K_,useState:function(){return lc(ss)},useDebugValue:Xh,useDeferredValue:function(n,s){var l=Ut();return tv(l,St.memoizedState,n,s)},useTransition:function(){var n=lc(ss)[0],s=Ut().memoizedState;return[typeof n=="boolean"?n:ga(n),s]},useSyncExternalStore:D_,useId:rv,useHostTransitionStatus:Zh,useFormState:F_,useActionState:F_,useOptimistic:function(n,s){var l=Ut();return L_(l,St,n,s)},useMemoCache:Fh,useCacheRefresh:lv,useEffectEvent:W_},uk={readContext:fn,use:rc,useCallback:J_,useContext:fn,useEffect:Wh,useImperativeHandle:Z_,useInsertionEffect:X_,useLayoutEffect:G_,useMemo:ev,useReducer:Vh,useRef:K_,useState:function(){return Vh(ss)},useDebugValue:Xh,useDeferredValue:function(n,s){var l=Ut();return St===null?Gh(l,n,s):tv(l,St.memoizedState,n,s)},useTransition:function(){var n=Vh(ss)[0],s=Ut().memoizedState;return[typeof n=="boolean"?n:ga(n),s]},useSyncExternalStore:D_,useId:rv,useHostTransitionStatus:Zh,useFormState:V_,useActionState:V_,useOptimistic:function(n,s){var l=Ut();return St!==null?L_(l,St,n,s):(l.baseState=n,[n,l.queue.dispatch])},useMemoCache:Fh,useCacheRefresh:lv,useEffectEvent:W_};function ed(n,s,l,o){s=n.memoizedState,l=l(o,s),l=l==null?s:D({},s,l),n.memoizedState=l,n.lanes===0&&(n.updateQueue.baseState=l)}var td={enqueueSetState:function(n,s,l){n=n._reactInternals;var o=Gn(),d=ws(o);d.payload=s,l!=null&&(d.callback=l),s=Cs(n,d,o),s!==null&&(In(s,n,o),ha(s,n,o))},enqueueReplaceState:function(n,s,l){n=n._reactInternals;var o=Gn(),d=ws(o);d.tag=1,d.payload=s,l!=null&&(d.callback=l),s=Cs(n,d,o),s!==null&&(In(s,n,o),ha(s,n,o))},enqueueForceUpdate:function(n,s){n=n._reactInternals;var l=Gn(),o=ws(l);o.tag=2,s!=null&&(o.callback=s),s=Cs(n,o,l),s!==null&&(In(s,n,l),ha(s,n,l))}};function dv(n,s,l,o,d,p,x){return n=n.stateNode,typeof n.shouldComponentUpdate=="function"?n.shouldComponentUpdate(o,p,x):s.prototype&&s.prototype.isPureReactComponent?!ia(l,o)||!ia(d,p):!0}function fv(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&&td.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=D({},l));for(var d in n)l[d]===void 0&&(l[d]=n[d])}return l}function mv(n){Ho(n)}function pv(n){console.error(n)}function gv(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 _v(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 nd(n,s,l){return l=ws(l),l.tag=3,l.payload={element:null},l.callback=function(){hc(n,s)},l}function vv(n){return n=ws(n),n.tag=3,n}function yv(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(){_v(s,l,o)}}var x=l.stateNode;x!==null&&typeof x.componentDidCatch=="function"&&(n.callback=function(){_v(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 hk(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=mn.current,l!==null){switch(l.tag){case 31:case 13:case 19:return xn===null?Ac():l.alternate===null&&Lt===0&&(Lt=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),Ud(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)),Ud(n,o,d)),!1}throw Error(r(435,l.tag))}return Ud(n,o,d),Ac(),!1}if(Ge)return s=mn.current,s!==null?((s.flags&65536)===0&&(s.flags|=256),s.flags|=65536,s.lanes=d,o!==xh&&(n=Error(r(422),{cause:o}),la(ri(n,l)))):(o!==xh&&(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=nd(n.stateNode,o,d),Ah(n,d),Lt!==4&&(Lt=2)),!1;var p=Error(r(520),{cause:o});if(p=ri(p,l),ka===null?ka=[p]:ka.push(p),Lt!==4&&(Lt=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=nd(l.stateNode,o,n),Ah(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=vv(d),yv(d,n,l,o),Ah(l,d),!1;break;case 22:if(l.memoizedState!==null)return l.flags|=65536,!1}l=l.return}while(l!==null);return!1}var id=Error(r(461)),Vt=!1;function Gt(n,s,l,o){s.child=n===null?w_(s,null,l,o):dr(s,n.child,l,o)}function Sv(n,s,l,o,d){l=l.render;var p=s.ref;if("ref"in o){var x={};for(var k in o)k!=="ref"&&(x[k]=o[k])}else x=o;return ar(s),o=Ih(n,s,l,x,p,d),k=Uh(),n!==null&&!Vt?(Ph(n,s,d),rs(n,s,d)):(Ge&&k&&$o(s),s.flags|=1,Gt(n,s,o,d),s.child)}function bv(n,s,l,o,d){if(n===null){var p=l.type;return typeof p=="function"&&!vh(p)&&p.defaultProps===void 0&&l.compare===null?(s.tag=15,s.type=p,xv(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,!hd(n,d)){var x=p.memoizedProps;if(l=l.compare,l=l!==null?l:ia,l(x,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 xv(n,s,l,o,d){if(n!==null){var p=n.memoizedProps;if(ia(p,o)&&n.ref===s.ref)if(Vt=!1,s.pendingProps=o=p,hd(n,d))(n.flags&131072)!==0&&(Vt=!0);else return s.lanes=n.lanes,rs(n,s,d)}return sd(n,s,l,o,d)}function wv(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 Cv(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?N_(s,p):Oh(),E_(s);else return o=s.lanes=536870912,Cv(n,s,p!==null?p.baseLanes|l:l,l,o)}else p!==null?(Xo(s,p.cachePool),N_(s,p),Es(),s.memoizedState=null):(n!==null&&Xo(s,null),Oh(),Es());return Gt(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 Cv(n,s,l,o,d){var p=jh();return p=p===null?null:{parent:Ft._currentValue,pool:p},s.memoizedState={baseLanes:l,cachePool:p},n!==null&&Xo(s,null),Oh(),E_(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 kv(n,s,l){return dr(s,n.child,null,l),n=dc(s,s.pendingProps),n.flags|=2,Kn(s),s.memoizedState=null,n}function dk(n,s,l){var o=s.pendingProps,d=(s.flags&128)!==0;if(s.flags&=-129,n===null){if(Ge){if(o.mode==="hidden")return n=dc(s,o),s.lanes=536870912,n.memoizedState={baseLanes:0,cachePool:null},va(null,n);if(Lh(s),(n=kt)?(n=Qy(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=o_(n),l.return=s,s.child=l,nn=s,kt=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 x=p.dehydrated;if(Lh(s),d)if(s.flags&256)s.flags&=-257,s=kv(n,s,l);else if(s.memoizedState!==null)s.child=n.child,s.flags|=128,s=null;else throw Error(r(558));else if(Vt||lr(n,s,l,!1),d=(l&n.childLanes)!==0,Vt||d){if(ks.current===null){if(o=xt,o!==null&&(x=hg(o,l),x!==0&&x!==p.retryLane))throw p.retryLane=x,nr(n,x),In(o,n,x),id;Ac()}s=kv(n,s,l)}else n=p.treeContext,kt=ui(x.nextSibling),nn=s,Ge=!0,vs=null,oi=!1,n!==null&&h_(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 sd(n,s,l,o,d){return ar(s),l=Ih(n,s,l,o,void 0,d),o=Uh(),n!==null&&!Vt?(Ph(n,s,d),rs(n,s,d)):(Ge&&o&&$o(s),s.flags|=1,Gt(n,s,l,d),s.child)}function Nv(n,s,l,o,d,p){return ar(s),s.updateQueue=null,l=T_(s,o,l,d),j_(n),o=Uh(),n!==null&&!Vt?(Ph(n,s,p),rs(n,s,p)):(Ge&&o&&$o(s),s.flags|=1,Gt(n,s,l,p),s.child)}function Ev(n,s,l,o,d){if(ar(s),s.stateNode===null){var p=Qr,x=l.contextType;typeof x=="object"&&x!==null&&(p=fn(x)),p=new l(o,p),s.memoizedState=p.state!==null&&p.state!==void 0?p.state:null,p.updater=td,s.stateNode=p,p._reactInternals=s,p=s.stateNode,p.props=o,p.state=s.memoizedState,p.refs={},Dh(s),x=l.contextType,p.context=typeof x=="object"&&x!==null?fn(x):Qr,p.state=s.memoizedState,x=l.getDerivedStateFromProps,typeof x=="function"&&(ed(s,l,x,o),p.state=s.memoizedState),typeof l.getDerivedStateFromProps=="function"||typeof p.getSnapshotBeforeUpdate=="function"||typeof p.UNSAFE_componentWillMount!="function"&&typeof p.componentWillMount!="function"||(x=p.state,typeof p.componentWillMount=="function"&&p.componentWillMount(),typeof p.UNSAFE_componentWillMount=="function"&&p.UNSAFE_componentWillMount(),x!==p.state&&td.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,L=mr(l,k);p.props=L;var X=p.context,te=l.contextType;x=Qr,typeof te=="object"&&te!==null&&(x=fn(te));var he=l.getDerivedStateFromProps;te=typeof he=="function"||typeof p.getSnapshotBeforeUpdate=="function",k=s.pendingProps!==k,te||typeof p.UNSAFE_componentWillReceiveProps!="function"&&typeof p.componentWillReceiveProps!="function"||(k||X!==x)&&fv(s,p,o,x),xs=!1;var Y=s.memoizedState;p.state=Y,fa(s,o,p,d),da(),X=s.memoizedState,k||Y!==X||xs?(typeof he=="function"&&(ed(s,l,he,o),X=s.memoizedState),(L=xs||dv(s,l,L,o,Y,X,x))?(te||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=X),p.props=o,p.state=X,p.context=x,o=L):(typeof p.componentDidMount=="function"&&(s.flags|=4194308),o=!1)}else{p=s.stateNode,Mh(n,s),x=s.memoizedProps,te=mr(l,x),p.props=te,he=s.pendingProps,Y=p.context,X=l.contextType,L=Qr,typeof X=="object"&&X!==null&&(L=fn(X)),k=l.getDerivedStateFromProps,(X=typeof k=="function"||typeof p.getSnapshotBeforeUpdate=="function")||typeof p.UNSAFE_componentWillReceiveProps!="function"&&typeof p.componentWillReceiveProps!="function"||(x!==he||Y!==L)&&fv(s,p,o,L),xs=!1,Y=s.memoizedState,p.state=Y,fa(s,o,p,d),da();var J=s.memoizedState;x!==he||Y!==J||xs||n!==null&&n.dependencies!==null&&Yo(n.dependencies)?(typeof k=="function"&&(ed(s,l,k,o),J=s.memoizedState),(te=xs||dv(s,l,te,o,Y,J,L)||n!==null&&n.dependencies!==null&&Yo(n.dependencies))?(X||typeof p.UNSAFE_componentWillUpdate!="function"&&typeof p.componentWillUpdate!="function"||(typeof p.componentWillUpdate=="function"&&p.componentWillUpdate(o,J,L),typeof p.UNSAFE_componentWillUpdate=="function"&&p.UNSAFE_componentWillUpdate(o,J,L)),typeof p.componentDidUpdate=="function"&&(s.flags|=4),typeof p.getSnapshotBeforeUpdate=="function"&&(s.flags|=1024)):(typeof p.componentDidUpdate!="function"||x===n.memoizedProps&&Y===n.memoizedState||(s.flags|=4),typeof p.getSnapshotBeforeUpdate!="function"||x===n.memoizedProps&&Y===n.memoizedState||(s.flags|=1024),s.memoizedProps=o,s.memoizedState=J),p.props=o,p.state=J,p.context=L,o=te):(typeof p.componentDidUpdate!="function"||x===n.memoizedProps&&Y===n.memoizedState||(s.flags|=4),typeof p.getSnapshotBeforeUpdate!="function"||x===n.memoizedProps&&Y===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)):Gt(n,s,l,d),s.memoizedState=p.state,n=s.child):n=rs(n,s,d),n}function jv(n,s,l,o){return sr(),s.flags|=256,Gt(n,s,l,o),s.child}var rd={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function ld(n){return{baseLanes:n,cachePool:__()}}function ad(n,s,l){return n=n!==null?n.childLanes&~l:0,s&&(n|=Xn),n}function Tv(n,s,l){var o=s.pendingProps,d=!1,p=(s.flags&128)!==0,x;if((x=p)||(x=n!==null&&n.memoizedState===null?!1:(pn.current&2)!==0),x&&(d=!0,s.flags&=-129),x=(s.flags&32)!==0,s.flags&=-33,n===null){if(Ge){if(d?Ns(s):Es(),(n=kt)?(n=Qy(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=o_(n),l.return=s,s.child=l,nn=s,kt=null)):n=null,n===null)throw ys(s);return af(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=ld(l),o.childLanes=ad(n,x,l),s.memoizedState=rd,va(null,o)):(Ns(s),od(s,p))}var k=n.memoizedState;if(k!==null){var L=k.dehydrated;if(L!==null)return fk(n,s,p,x,o,L,k,l)}return d?(Es(),d=o.fallback,p=s.mode,k=n.child,L=k.sibling,o=Ji(k,{mode:"hidden",children:o.children}),o.subtreeFlags=k.subtreeFlags&1206910976,L!==null?d=Ji(L,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=ld(l):(p=d.cachePool,p!==null?(k=Ft._currentValue,p=p.parent!==k?{parent:k,pool:k}:p):p=__(),d={baseLanes:d.baseLanes|l,cachePool:p}),o.memoizedState=d,o.childLanes=ad(n,x,l),s.memoizedState=rd,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&&(x=s.deletions,x===null?(s.deletions=[n],s.flags|=16):x.push(n)),s.child=l,s.memoizedState=null,l)}function od(n,s){return s=fc({mode:"visible",children:s},n.mode),s.return=n,n.child=s}function fc(n,s){return n=Bn(22,n,null,s),n.lanes=0,n}function mc(n,s,l){return dr(s,n.child,null,l),n=od(s,s.pendingProps.children),n.flags|=2,s.memoizedState=null,n}function fk(n,s,l,o,d,p,x,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,x=s.mode,d=fc({mode:"visible",children:d.children},x),p=ir(p,x,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=ld(k),d.childLanes=ad(n,o,k),s.memoizedState=rd,va(null,d));if(Ns(s),af(p)){if(o=p.nextSibling&&p.nextSibling.dataset,o)var L=o.dgst;return o=L,o!==""&&(d=Error(r(419)),d.stack="",d.digest=o,la({value:d,source:null,stack:null})),mc(n,s,k)}if(Vt||lr(n,s,k,!1),o=(k&n.childLanes)!==0,Vt||o){if(ks.current!==null)return mc(n,s,k);if(o=xt,o!==null&&(d=hg(o,k),d!==0&&d!==x.retryLane))throw x.retryLane=d,nr(n,d),In(o,n,d),id;return lf(p)||Ac(),mc(n,s,k)}return lf(p)?(s.flags|=192,s.child=n.child,null):(n=x.treeContext,kt=ui(p.nextSibling),nn=s,Ge=!0,vs=null,oi=!1,n!==null&&h_(s,n),s=od(s,d.children),s.flags|=134221824,s)}function Dv(n,s,l){n.lanes|=s;var o=n.alternate;o!==null&&(o.lanes|=s),Ko(n.return,s,l)}function Mv(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 x=n.memoizedState;x===null?n.memoizedState={isBackwards:s,rendering:null,renderingStartTime:0,last:o,tail:l,tailMode:d,treeForkCount:p}:(x.isBackwards=s,x.rendering=null,x.renderingStartTime=0,x.last=o,x.tail=l,x.tailMode=d,x.treeForkCount=p)}function cd(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 ud(n,s,l){var o=s.pendingProps,d=o.revealOrder,p=o.tail;o=o.children;var x=pn.current;if(s.flags&128)return ma(s,x),null;var k=(x&2)!==0;if(k?(x=x&1|2,s.flags|=128):x&=1,ma(s,x),d==="backwards"&&n!==null?(cd(n),Gt(n,s,o,l),cd(n)):Gt(n,s,o,l),o=Ge?ra:0,!k&&n!==null&&(n.flags&128)!==0)e:for(n=s.child;n!==null;){if(n.tag===13)n.memoizedState!==null&&Dv(n,l,s);else if(n.tag===19)Dv(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=Mv(s.child),l===null?(d=s.child,s.child=null):(d=l.sibling,l.sibling=null,cd(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=Mv(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 Av(n,s,l){var o=s.pendingProps;return Ss(s,s.type,o.value),Gt(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 hd(n,s){return(n.lanes&s)!==0?!0:(n=n.dependencies,!!(n!==null&&Yo(n)))}function mk(n,s,l){switch(s.tag){case 3:ze(s,s.stateNode.containerInfo),Ss(s,Ft,n.memoizedState.cache),sr();break;case 27:case 5:Ot(s);break;case 4:ze(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,Lh(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?Tv(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 ud(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 ud(n,s,l);s.flags|=128}if(d=s.memoizedState,d!==null&&(d.rendering=null,d.tail=null,d.lastEffect=null),ma(s,pn.current),o)break;return null;case 22:return s.lanes=0,wv(n,s,l,s.pendingProps);case 24:Ss(s,Ft,n.memoizedState.cache)}return rs(n,s,l)}function Rv(n,s,l){if(n!==null)if(n.memoizedProps!==s.pendingProps)Vt=!0;else{if(!hd(n,l)&&(s.flags&128)===0)return Vt=!1,mk(n,s,l);Vt=(n.flags&131072)!==0}else Vt=!1,Ge&&(s.flags&1048576)!==0&&u_(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")vh(n)?(o=mr(n,o),s.tag=1,s=Ev(null,s,n,o,l)):(s.tag=0,s=sd(null,s,n,o,l));else{if(n!=null){var d=n.$$typeof;if(d===V){s.tag=11,s=Sv(null,s,n,o,l);break e}else if(d===ge){s.tag=14,s=bv(null,s,n,o,l);break e}else if(d===K){s.tag=10,s.type=n,s=Av(null,s,l);break e}}throw s=ve(n)||n,Error(r(306,s,""))}}return s;case 0:return sd(n,s,s.type,s.pendingProps,l);case 1:return o=s.type,d=mr(o,s.pendingProps),Ev(n,s,o,d,l);case 3:e:{if(ze(s,s.stateNode.containerInfo),n===null)throw Error(r(387));o=s.pendingProps;var p=s.memoizedState;d=p.element,Mh(n,s),fa(s,o,null,l);var x=s.memoizedState;if(o=x.cache,Ss(s,Ft,o),o!==p.cache&&kh(s,[Ft],l,!0),da(),o=x.element,p.isDehydrated)if(p={element:o,isDehydrated:!1,cache:x.cache},s.updateQueue.baseState=p,s.memoizedState=p,s.flags&256){s=jv(n,s,o,l);break e}else if(o!==d){d=ri(Error(r(424)),s),la(d),s=jv(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,kt=ui(n.firstChild),nn=s,Ge=!0,vs=null,oi=!0,l=w_(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}Gt(n,s,o,l)}s=s.child}return s;case 26:return al(n,s),n===null?(l=s0(s.type,null,s.pendingProps,null))?s.memoizedState=l:Ge||(s.stateNode=zy(s.type,s.pendingProps,ut.current,s)):s.memoizedState=s0(s.type,n.memoizedProps,s.pendingProps,n.memoizedState),null;case 27:return Ot(s),n===null&&Ge&&(o=s.stateNode=e0(s.type,s.pendingProps,ut.current),nn=s,oi=!0,d=kt,Bs(s.type)?(of=d,kt=ui(o.firstChild)):kt=d),Gt(n,s,s.pendingProps.children,l),al(n,s),n===null&&(s.flags|=4194304),s.child;case 5:return n===null&&Ge&&((d=o=kt)&&(o=oN(o,s.type,s.pendingProps,oi),o!==null?(s.stateNode=o,nn=s,kt=ui(o.firstChild),oi=!1,d=!0):d=!1),d||ys(s)),Ot(s),d=s.type,p=s.pendingProps,x=n!==null?n.memoizedProps:null,o=p.children,Zd(d,p)?o=null:x!==null&&Zd(d,x)&&(s.flags|=32),s.memoizedState!==null&&(d=Ih(n,s,ik,null,null,l),kl._currentValue=d),al(n,s),Gt(n,s,o,l),s.child;case 6:return n===null&&Ge&&((n=l=kt)&&(l=cN(l,s.pendingProps,oi),l!==null?(s.stateNode=l,nn=s,kt=null,n=!0):n=!1),n||ys(s)),null;case 13:return Tv(n,s,l);case 4:return ze(s,s.stateNode.containerInfo),o=s.pendingProps,n===null?s.child=dr(s,null,o,l):Gt(n,s,o,l),s.child;case 11:return Sv(n,s,s.type,s.pendingProps,l);case 7:return o=s.pendingProps,al(n,s),Gt(n,s,o,l),s.child;case 8:return Gt(n,s,s.pendingProps.children,l),s.child;case 12:return Gt(n,s,s.pendingProps.children,l),s.child;case 10:return Av(n,s,l);case 9:return d=s.type._context,o=s.pendingProps.children,ar(s),d=fn(d),o=o(d),s.flags|=1,Gt(n,s,o,l),s.child;case 14:return bv(n,s,s.type,s.pendingProps,l);case 15:return xv(n,s,s.type,s.pendingProps,l);case 19:return ud(n,s,l);case 31:return dk(n,s,l);case 22:return wv(n,s,l,s.pendingProps);case 24:return ar(s),o=fn(Ft),n===null?(d=jh(),d===null&&(d=xt,p=Nh(),d.pooledCache=p,p.refCount++,p!==null&&(d.pooledCacheLanes|=l),d=p),s.memoizedState={parent:o,cache:d},Dh(s),Ss(s,Ft,d)):((n.lanes&l)!==0&&(Mh(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,Ft,o)):(o=p.cache,Ss(s,Ft,o),o!==d.cache&&kh(s,[Ft],l,!0))),Gt(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:Ge&&$o(s),n!==null&&n.memoizedProps.name!==o.name?s.flags|=4194816:al(n,s),Gt(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 dd(n,s,l,o,d){var p;if((p=(n.mode&32)!==0)&&(p=l===null?o0(s,o):o0(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(my())n.flags|=8192;else throw hr=Qo,Th}else n.flags&=-16777217}function Ov(n,s){if(s.type!=="stylesheet"||(s.state.loading&4)!==0)n.flags&=-16777217;else if(n.flags|=16777216,!c0(s))if(my())n.flags|=8192;else throw hr=Qo,Th}function gc(n,s){s!==null&&(n.flags|=4),n.flags&16384&&(s=n.tag!==22?og():536870912,n.lanes|=s,dl|=s)}function ya(n,s){if(!Ge)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 Nt(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 pk(n,s,l){var o=s.pendingProps;switch(bh(s),s.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Nt(s),null;case 1:return Nt(s),null;case 3:return l=s.stateNode,o=null,n!==null&&(o=n.memoizedState.cache),s.memoizedState.cache!==o&&(s.flags|=2048),ns(Ft),mt(),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,wh())),Nt(s),null;case 26:var d=s.type,p=s.memoizedState;return n===null?(ls(s),p!==null?(Nt(s),Ov(s,p)):(Nt(s),dd(s,d,null,o,l))):p?p!==n.memoizedState?(ls(s),Nt(s),Ov(s,p)):(Nt(s),s.flags&=-16777217):(n=n.memoizedProps,n!==o&&ls(s),Nt(s),dd(s,d,n,o,l)),null;case 27:if(jt(s),l=ut.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 Nt(s),s.subtreeFlags&=-33554433,null}n=at.current,el(s)?d_(s):(n=e0(d,o,l),s.stateNode=n,ls(s))}return Nt(s),s.subtreeFlags&=-33554433,null;case 5:if(jt(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 Nt(s),s.subtreeFlags&=-33554433,null}if(p=at.current,el(s))d_(s);else{var x=Da(ut.current);switch(p){case 1:p=x.createElementNS("http://www.w3.org/2000/svg",d);break;case 2:p=x.createElementNS("http://www.w3.org/1998/Math/MathML",d);break;default:switch(d){case"svg":p=x.createElementNS("http://www.w3.org/2000/svg",d);break;case"math":p=x.createElementNS("http://www.w3.org/1998/Math/MathML",d);break;case"script":p=x.createElement("div"),p.innerHTML="<script><\/script>",p=p.removeChild(p.firstChild);break;case"select":p=typeof o.is=="string"?x.createElement("select",{is:o.is}):x.createElement("select"),o.multiple?p.multiple=!0:o.size&&(p.size=o.size);break;default:p=typeof o.is=="string"?x.createElement(d,{is:o.is}):x.createElement(d)}}p[dn]=s,p[On]=o;e:for(x=s.child;x!==null;){if(x.tag===5||x.tag===6)p.appendChild(x.stateNode);else if(x.tag!==4&&x.tag!==27&&x.child!==null){x.child.return=x,x=x.child;continue}if(x===s)break e;for(;x.sibling===null;){if(x.return===null||x.return===s)break e;x=x.return}x.sibling.return=x.return,x=x.sibling}s.stateNode=p;e:switch(_n(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 Nt(s),s.subtreeFlags&=-33554433,dd(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=ut.current,el(s)){if(n=s.stateNode,l=s.memoizedProps,o=null,d=nn,d!==null)switch(d.tag){case 27:case 5:o=d.memoizedProps}n[dn]=s,n=!!(n.nodeValue===l||o!==null&&o.suppressHydrationWarning===!0||Ry(n.nodeValue,l)),n||ys(s,!0)}else n=Da(n).createTextNode(o),n[dn]=s,s.stateNode=n}return Nt(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[dn]=s}else sr(),(s.flags&128)===0&&(s.memoizedState=null),s.flags|=4;Nt(s),n=!1}else l=wh(),n!==null&&n.memoizedState!==null&&(n.memoizedState.hydrationErrors=l),n=!0;if(!n)return s.flags&256?(Kn(s),s):(Kn(s),null);if((s.flags&128)!==0)throw Error(r(558))}return Nt(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[dn]=s}else sr(),(s.flags&128)===0&&(s.memoizedState=null),s.flags|=4;Nt(s),d=!1}else d=wh(),n!==null&&n.memoizedState!==null&&(n.memoizedState.hydrationErrors=d),d=!0;if(!d)return s.flags&256?(Kn(s),s):(Kn(s),null)}return Kn(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),Nt(s),null);case 4:return mt(),n===null&&Yd(s.stateNode.containerInfo),s.flags|=67108864,Nt(s),null;case 10:return ns(s.type),Nt(s),null;case 19:if(zh(s),o=s.memoizedState,o===null)return Nt(s),null;if(d=(s.flags&128)!==0,p=o.rendering,p===null)if(d)ya(o,!1);else{if(Lt!==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;)a_(l,n),l=l.sibling;return ma(s,pn.current&1|2),Ge&&es(s,o.treeForkCount),s.child}n=n.sibling}o.tail!==null&&qt()>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&&!Ge)return Nt(s),null}else 2*qt()-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=qt(),n.sibling=null,p=pn.current,p=d?p&1|2:p&1,o.tailMode==="visible"||o.tailMode==="collapsed"||!l||Ge?ma(s,p):(l=p,Ee(mn,s),Ee(pn,l),xn===null&&(xn=s)),Ge&&es(s,o.treeForkCount),n}return Nt(s),null;case 22:case 23:return Kn(s),Bh(),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&&(Nt(s),s.subtreeFlags&6&&(s.flags|=8192)):Nt(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&&Ce(cr),null;case 24:return l=null,n!==null&&(l=n.memoizedState.cache),s.memoizedState.cache!==l&&(s.flags|=2048),ns(Ft),Nt(s),null;case 25:return null;case 30:return s.flags|=33554432,Nt(s),null}throw Error(r(156,s.tag))}function gk(n,s){switch(bh(s),s.tag){case 1:return n=s.flags,n&65536?(s.flags=n&-65537|128,s):null;case 3:return ns(Ft),mt(),n=s.flags,(n&65536)!==0&&(n&128)===0?(s.flags=n&-65537|128,s):null;case 26:case 27:case 5:return jt(s),null;case 31:if(s.memoizedState!==null){if(Kn(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(Kn(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 zh(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 mt(),null;case 10:return ns(s.type),null;case 22:case 23:return Kn(s),Bh(),n!==null&&Ce(cr),n=s.flags,n&65536?(s.flags=n&-65537|128,s):null;case 24:return ns(Ft),null;case 25:return null;default:return null}}function Bv(n,s){switch(bh(s),s.tag){case 3:ns(Ft),mt();break;case 26:case 27:case 5:jt(s);break;case 4:mt();break;case 31:s.memoizedState!==null&&Kn(s);break;case 13:Kn(s);break;case 19:zh(s);break;case 10:ns(s.type);break;case 22:case 23:Kn(s),Bh(),n!==null&&Ce(cr);break;case 24:ns(Ft)}}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,x=l.inst;o=p(),x.destroy=o}l=l.next}while(l!==d)}}catch(k){vt(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 x=o.inst,k=x.destroy;if(k!==void 0){x.destroy=void 0,d=s;var L=l,X=k;try{X()}catch(te){vt(d,L,te)}}}o=o.next}while(o!==p)}}catch(te){vt(s,s.return,te)}}function Lv(n){var s=n.updateQueue;if(s!==null){var l=n.stateNode;try{k_(s,l)}catch(o){vt(n,n.return,o)}}}function zv(n,s,l){l.props=mr(n.type,n.memoizedProps),l.state=n.memoizedState;try{l.componentWillUnmount()}catch(o){vt(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=$y(p)),o=d.ref;break;case 7:if(n.stateNode===null){var x=new Qn(n);_(n.child,!1,lN,x,void 0,void 0),n.stateNode=x}o=n.stateNode;break;default:o=n.stateNode}typeof l=="function"?n.refCleanup=l(o):l.current=o}}catch(k){vt(n,s,k)}}function gn(n,s){var l=n.ref,o=n.refCleanup;if(l!==null)if(typeof o=="function")try{o()}catch(d){vt(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){vt(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++)Gy(n.stateNode,s[l])}function Hv(n){for(var s=n.return;s!==null&&(md(s)&&Gy(n.stateNode,s.stateNode),!fd(s));)s=s.return}function ba(n){for(var s=n.return;s!==null&&(md(s)&&aN(n.stateNode,s.stateNode),!fd(s));)s=s.return}function fd(n){return n.tag===5||n.tag===3||n.tag===27}function md(n){return n&&n.tag===7&&n.stateNode!==null}function pd(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){vt(n,n.return,d)}}function gd(n,s,l){try{var o=n.stateNode;qk(o,n.type,l,s),o[On]=s}catch(d){vt(n,n.return,d)}}function Iv(n){return n.tag===5||n.tag===3||n.tag===26||n.tag===27&&Bs(n.type)||n.tag===4}function _d(n){e:for(;;){for(;n.sibling===null;){if(n.return===null||Iv(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 vd(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),ht=!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(vd(n,s,l,o),n=n.sibling;n!==null;)vd(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),ht=!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 Uv(n){var s=n.stateNode,l=n.memoizedProps;try{for(var o=n.type,d=s.attributes;d.length;)s.removeAttributeNode(d[0]);_n(s,o,l),s[dn]=n,s[On]=l}catch(p){vt(n,n.return,p)}}var yc=!1,Yn=null;function Pv(n){(n.tag===30||(n.subtreeFlags&33554432)!==0)&&(yc=!0)}var Mi=null;function qv(){var n=Mi;return Mi=null,n}var Ln=0;function ol(n,s,l,o,d){return Ln=0,Fv(n.child,s,l,o,d)}function Fv(n,s,l,o,d){for(var p=!1;n!==null;){if(n.tag===5){var x=n.stateNode;if(o!==null){var k=tf(x);o.push(k),k.view&&(p=!0)}else p||tf(x).view&&(p=!0);yc=!0,qy(x,Ln===0?s:s+"_"+Ln,l),Ln++}else(n.tag!==22||n.memoizedState===null)&&(n.tag===30&&d||Fv(n.child,s,l,o,d)&&(p=!0));n=n.sibling}return p}function Ai(n,s){for(;n!==null;)n.tag===5?Fy(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 yd(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;)yd(n,s),n=n.sibling;else Sc(n)}function Sd(n){if(Yn!==null&&Yn.size!==0){var s=Yn;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}}}Sd(n)}n=n.sibling}}}function bd(n){if(n.tag===30){var s=n.memoizedProps,l=Qi(s,n.stateNode),o=Yn!==null?Yn.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,Yn.delete(l),gl(n,s.onShare)):gl(n,s.onExit):Ai(n.child,!1)),Yn!==null&&Sd(n)}else if((n.subtreeFlags&33554432)!==0)for(n=n.child;n!==null;)bd(n),n=n.sibling;else Yn!==null&&Sd(n)}function $v(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&&$v(n);n=n.sibling}}function xd(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))}xd(n)}n=n.sibling}}function bc(n){if(n.tag===30)n.stateNode.paired=null,Ai(n.child,!1),xd(n);else if((n.subtreeFlags&33554432)!==0)for(n=n.child;n!==null;)bc(n),n=n.sibling;else xd(n)}function Vv(n){for(n=n.child;n!==null;)n.tag===30?Ai(n.child,!1):(n.subtreeFlags&33554432)!==0&&Vv(n),n=n.sibling}function wd(n,s,l,o,d,p,x){for(var k=!1;s!==null;){if(s.tag===5){var L=s.stateNode;if(p!==null&&Ln<p.length){var X=p[Ln],te=tf(L);(X.view||te.view)&&(k=!0);var he;if(he=(n.flags&4)===0)if(te.clip)he=!0;else{he=X.rect;var Y=te.rect;he=he.y!==Y.y||he.x!==Y.x||he.height!==Y.height||he.width!==Y.width}he&&(n.flags|=4),te.abs?te=!X.abs:(X=X.rect,te=te.rect,te=X.height!==te.height||X.width!==te.width),te&&(n.flags|=32)}else n.flags|=32;(n.flags&4)!==0&&qy(L,Ln===0?l:l+"_"+Ln,d),k&&(n.flags&4)!==0||(Mi===null&&(Mi=[]),Mi.push(L,Ln===0?o:o+"_"+Ln,s.memoizedProps)),Ln++}else(s.tag!==22||s.memoizedState===null)&&(s.tag===30&&x?n.flags|=s.flags&32:wd(n,s.child,l,o,d,p,x)&&(k=!0));s=s.sibling}return k}function Kv(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),x;x=n.memoizedState,n.memoizedState=null,o=n;var k=n.child;Ln=0,d=wd(o,k,d,d,p,x,!1),(n.flags&4)!==0&&d&&gl(n,l.onUpdate)}else(n.subtreeFlags&33554432)!==0&&Kv(n);n=n.sibling}}var sn=!1,gt=!1,Ri=!1,Cd=!1,Yv=typeof WeakSet=="function"?WeakSet:Set,rn=null,Oi=!1,xa=!1,xc=!1,kd=!1;function _k(n,s,l){if(n=n.containerInfo,Gd=Nl,n=Qg(n),hh(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,x=d.focusNode;d=d.focusOffset;try{o.nodeType,x.nodeType}catch{o=null;break e}var k=0,L=-1,X=-1,te=0,he=0,Y=n,J=null;t:for(;;){for(var Ne;Y!==o||p!==0&&Y.nodeType!==3||(L=k+p),Y!==x||d!==0&&Y.nodeType!==3||(X=k+d),Y.nodeType===3&&(k+=Y.nodeValue.length),(Ne=Y.firstChild)!==null;)J=Y,Y=Ne;for(;;){if(Y===n)break t;if(J===o&&++te===p&&(L=k),J===x&&++he===d&&(X=k),(Ne=Y.nextSibling)!==null)break;Y=J,J=Y.parentNode}Y=Ne}o=L===-1||X===-1?null:{start:L,end:X}}else o=null}o=o||{start:0,end:0}}else o=null;for(Qd={focusedElem:n,selectionRange:o},Nl=!1,l=(l&335544064)===l,rn=s,s=l?9270:1024;rn!==null;){if(n=rn,l&&(o=n.deletions,o!==null))for(p=0;p<o.length;p++)l&&bd(o[p]);if(n.alternate===null&&(n.flags&2)!==0)l&&Pv(n),wc(l);else{if(n.tag===22){if(o=n.alternate,n.memoizedState!==null){o!==null&&o.memoizedState===null&&l&&bd(o),wc(l);continue}else if(o!==null&&o.memoizedState!==null){l&&Pv(n),wc(l);continue}}o=n.child,(n.subtreeFlags&s)!==0&&o!==null?(o.return=n,rn=o):(l&&$v(n),wc(l))}}Yn=null}function wc(n){for(;rn!==null;){var s=rn,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 x=mr(s.type,d);l=p.getSnapshotBeforeUpdate(x,o),p.__reactInternalSnapshotBeforeUpdate=l}catch(k){vt(s,s.return,k)}}break;case 3:if((d&1024)!==0){if(o=s.stateNode.containerInfo,l=o.nodeType,l===9)rf(o);else if(l===1)switch(o.nodeName){case"HEAD":case"HTML":case"BODY":rf(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,rn=o;break}rn=s.return}}function Wv(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(x){vt(l,l.return,x)}else{var d=mr(l.type,s.memoizedProps);s=s.memoizedState;try{n.componentDidUpdate(d,s,n.__reactInternalSnapshotBeforeUpdate)}catch(x){vt(l,l.return,x)}}o&64&&Lv(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{k_(n,s)}catch(x){vt(l,l.return,x)}}break;case 27:s===null&&o&4&&Uv(l);case 26:case 5:Bi(n,l),s===null&&o&4&&pd(l),o&512&&Di(l,l.return);break;case 12:Bi(n,l);break;case 31:Bi(n,l),o&4&&Zv(n,l);break;case 13:Bi(n,l),o&4&&Jv(n,l),o&64&&(n=l.memoizedState,n!==null&&(n=n.dehydrated,n!==null&&(l=Tk.bind(null,l),uN(n,l))));break;case 22:if(o=l.memoizedState!==null||sn,!o){var p=s!==null&&s.memoizedState!==null||gt;s=sn,d=gt,sn=o,(gt=p)&&!d?(o=2,(l.subtreeFlags&8772)!==0&&(o|=1),bi(n,l,o)):Bi(n,l),sn=s,gt=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 Nd(n,s){for(n=n.child;n!==null;)Xv(n,s),n=n.sibling}function Xv(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,x=p!=null&&p.hasOwnProperty("display")?p.display:null;d.style.display=x==null||typeof x=="boolean"?"":(""+x).trim()}}catch(L){vt(n,n.return,L)}Ed(n,s);break;case 6:try{n.stateNode.nodeValue=s?"":n.memoizedProps,ht=!0}catch(L){vt(n,n.return,L)}break;case 18:try{var k=n.stateNode;s?Py(k,!0):Py(n.stateNode,!1)}catch(L){vt(n,n.return,L)}break;case 22:case 23:n.memoizedState===null&&Nd(n,s);break;default:Nd(n,s)}}function Ed(n,s){if(n.subtreeFlags&67108864)for(n=n.child;n!==null;){e:{var l=n,o=s;switch(l.tag){case 4:Xv(l,o);break e;case 22:l.memoizedState===null&&Ed(l,o);break e;default:Ed(l,o)}}n=n.sibling}}function Gv(n){var s=n.alternate;s!==null&&(n.alternate=null,Gv(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 Tt=null,zn=!1;function yi(n,s,l){for(l=l.child;l!==null;)Qv(n,s,l),l=l.sibling}function Qv(n,s,l){if(Ie&&typeof Ie.onCommitFiberUnmount=="function")try{Ie.onCommitFiberUnmount(Nn,l)}catch{}switch(l.tag){case 26:gt||gn(l,s),yi(n,s,l),l.memoizedState?l.memoizedState.count--:l.stateNode&&!gt&&(l=l.stateNode,l.parentNode.removeChild(l));break;case 27:gt||gn(l,s),ba(l);var o=Tt,d=zn;Bs(l.type)&&(Tt=l.stateNode,zn=!1),yi(n,s,l),t0(l.stateNode,l.type,l.memoizedProps),Tt=o,zn=d;break;case 5:gt||gn(l,s),ba(l);case 6:if(l.tag===6&&ba(l),o=Tt,d=zn,Tt=null,yi(n,s,l),Tt=o,zn=d,Tt!==null)if(zn)try{(Tt.nodeType===9?Tt.body:Tt.nodeName==="HTML"?Tt.ownerDocument.body:Tt).removeChild(l.stateNode),ht=!0}catch(p){vt(l,s,p)}else try{Tt.removeChild(l.stateNode),ht=!0}catch(p){vt(l,s,p)}break;case 18:Tt!==null&&(zn?(n=Tt,Uy(n.nodeType===9?n.body:n.nodeName==="HTML"?n.ownerDocument.body:n,l.stateNode),El(n)):Uy(Tt,l.stateNode));break;case 4:o=Tt,d=zn,Tt=l.stateNode.containerInfo,zn=!0,yi(n,s,l),Tt=o,zn=d;break;case 0:case 11:case 14:case 15:js(2,l,s),gt||js(4,l,s),yi(n,s,l);break;case 1:gt||(gn(l,s),o=l.stateNode,typeof o.componentWillUnmount=="function"&&zv(l,s,o)),yi(n,s,l);break;case 21:yi(n,s,l);break;case 22:gt=(o=gt)||l.memoizedState!==null,yi(n,s,l),gt=o;break;case 30:gn(l,s),yi(n,s,l);break;case 7:gt||gn(l,s),yi(n,s,l);break;default:yi(n,s,l)}}function Zv(n,s){if(s.memoizedState===null&&(n=s.alternate,n!==null&&(n=n.memoizedState,n!==null))){n=n.dehydrated;try{El(n)}catch(l){vt(s,s.return,l)}}}function Jv(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){vt(s,s.return,l)}}function vk(n){switch(n.tag){case 31:case 13:case 19:var s=n.stateNode;return s===null&&(s=n.stateNode=new Yv),s;case 22:return n=n.stateNode,s=n._retryCache,s===null&&(s=n._retryCache=new Yv),s;default:throw Error(r(435,n.tag))}}function Cc(n,s){var l=vk(n);s.forEach(function(o){if(!l.has(o)){l.add(o);var d=Dk.bind(null,n,o);o.then(d,d)}})}function Tn(n,s,l){var o=s.deletions;if(o!==null)for(var d=0;d<o.length;d++){var p=o[d],x=n,k=s,L=k;e:for(;L!==null;){switch(L.tag){case 27:if(Bs(L.type)){Tt=L.stateNode,zn=!1;break e}break;case 5:Tt=L.stateNode,zn=!1;break e;case 3:case 4:Tt=L.stateNode.containerInfo,zn=!0;break e}L=L.return}if(Tt===null)throw Error(r(160));Qv(x,k,p),Tt=null,zn=!1,x=p.alternate,x!==null&&(x.return=null),p.return=null}if(s.subtreeFlags&13886)for(s=s.child;s!==null;)ey(s,n,l),s=s.sibling}var Si=null;function ey(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 x=o[p];x.ref.impl=x.nextImpl}Tn(s,n,l),Dn(n),d&4&&(js(3,n,n.return),Sa(3,n),js(5,n,n.return));break;case 1:Tn(s,n,l),Dn(n),d&512&&(gt||o===null||gn(o,o.return)),d&64&&sn&&(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,Tn(s,n,l),Dn(n),d&512&&(gt||o===null||gn(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(sn)n.stateNode=zy(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[dn]||o.namespaceURI==="http://www.w3.org/2000/svg"||o.hasAttribute("itemprop"))&&(o=d.createElement(s),d.head.insertBefore(o,d.querySelector("head > title"))),_n(o,s,l),o[dn]=n,tn(o),s=o;break e;case"link":if(p=a0("link","href",d).get(s+(l.href||""))){for(x=0;x<p.length;x++)if(o=p[x],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(x,1);break t}}o=d.createElement(s),_n(o,s,l),d.head.appendChild(o);break;case"meta":if(p=a0("meta","content",d).get(s+(l.content||""))){for(x=0;x<p.length;x++)if(o=p[x],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(x,1);break t}}o=d.createElement(s),_n(o,s,l),d.head.appendChild(o);break;default:throw Error(r(468,s))}o[dn]=n,tn(o),s=o}n.stateNode=s}else sn||df(p,n.type,n.stateNode);else n.stateNode=l0(p,l,n.memoizedProps);else d!==l?(d===null?(s=o.stateNode,s===null||gt||s.parentNode.removeChild(s)):d.count--,l===null?sn||df(p,n.type,n.stateNode):l0(p,l,n.memoizedProps)):l===null&&n.stateNode!==null&&gd(n,n.memoizedProps,o.memoizedProps);break;case 27:Tn(s,n,l),Dn(n),d&512&&(gt||o===null||gn(o,o.return)),o!==null&&d&4&&gd(n,n.memoizedProps,o.memoizedProps);break;case 5:if(p=Ri,Ri=!1,Tn(s,n,l),Ri=p,Dn(n),d&512&&(gt||o===null||gn(o,o.return)),n.flags&32){s=n.stateNode;try{$r(s,""),ht=!0}catch(te){vt(n,n.return,te)}}d&4&&n.stateNode!=null&&(s=n.memoizedProps,gd(n,s,o!==null?o.memoizedProps:s)),d&1024&&(Cd=!0);break;case 6:if(Tn(s,n,l),Dn(n),d&4){if(n.stateNode===null)throw Error(r(162));s=n.memoizedProps,l=n.stateNode;try{l.nodeValue=s,ht=!0}catch(te){vt(n,n.return,te)}}break;case 3:if(ht=!1,Ic=null,p=Si,Si=Ma(s.containerInfo),Tn(s,n,l),Si=p,Dn(n),d&4&&o!==null&&o.memoizedState.isDehydrated)try{El(s.containerInfo)}catch(te){vt(n,n.return,te)}Cd&&(Cd=!1,ty(n)),ht=!1;break;case 4:d=Ri,Ri=sn,o=bg(),p=Si,Si=Ma(n.stateNode.containerInfo),Tn(s,n,l),Dn(n),Si=p,ht&&xa&&(xc=!0),ht=o,Ri=d;break;case 12:Tn(s,n,l),Dn(n);break;case 31:Tn(s,n,l),Dn(n),d&4&&(s=n.updateQueue,s!==null&&(n.updateQueue=null,Cc(n,s)));break;case 13:Tn(s,n,l),Dn(n),n.child.flags&8192&&n.memoizedState!==null!=(o!==null&&o.memoizedState!==null)&&(Ec=qt()),d&4&&(s=n.updateQueue,s!==null&&(n.updateQueue=null,Cc(n,s)));break;case 22:p=n.memoizedState!==null,x=o!==null&&o.memoizedState!==null;var k=sn,L=gt,X=Ri;sn=k||p,Ri=X||p,gt=L||x,Tn(s,n,l),gt=L,Ri=X,sn=k,Dn(n),d&8192&&(s=n.stateNode,s._visibility=p?s._visibility&-2:s._visibility|1,!p||o===null||x||sn||gt||(s=x||gt,l=sn,o=gt,sn=p||sn,gt=s,Ts(n,2),sn=l,gt=o),!p&&Ri||Nd(n,p)),d&4&&(s=n.updateQueue,s!==null&&(l=s.retryQueue,l!==null&&(s.retryQueue=null,Cc(n,l))));break;case 19:Tn(s,n,l),Dn(n),d&4&&(s=n.updateQueue,s!==null&&(n.updateQueue=null,Cc(n,s)));break;case 30:d&512&&(gt||o===null||gn(o,o.return)),d=bg(),p=xa,x=(l&335544064)===l,k=n.memoizedProps,xa=x&&Zi(k.default,k.update)!=="none",Tn(s,n,l),Dn(n),x&&o!==null&&ht&&(n.flags|=4),xa=p,ht=d;break;case 21:break;case 7:d&512&&(gt||o===null||gn(o,o.return)),o&&o.stateNode!==null&&(o.stateNode._fragmentFiber=n);default:Tn(s,n,l),Dn(n)}}function Dn(n){var s=n.flags;if(s&2){try{for(var l,o=n.return;o!==null;){if(Iv(o)){l=o;break}o=o.return}o=null;for(var d=n.return;d!==null;){if(md(d)){var p=d.stateNode;o===null?o=[p]:o.push(p)}if(fd(d))break;d=d.return}var x=o;if(l==null)throw Error(r(160));switch(l.tag){case 27:var k=l.stateNode,L=_d(n);vc(n,L,k,x);break;case 5:var X=l.stateNode;l.flags&32&&($r(X,""),l.flags&=-33);var te=_d(n);vc(n,te,X,x);break;case 3:case 4:var he=l.stateNode.containerInfo,Y=_d(n);vd(n,Y,he,x);break;default:throw Error(r(161))}}catch(J){vt(n,n.return,J)}n.flags&=-3}s&4096&&(n.flags&=-4097)}function ty(n){if(n.subtreeFlags&1024)for(n=n.child;n!==null;){var s=n;ty(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;)ny(s,n),s=s.sibling;else Kv(s)}function ny(n,s){var l=n.alternate;if(l===null)yd(n,!1);else switch(n.tag){case 3:if(kd=Oi=!1,qv(),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];Fy(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"})),kd=!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?yd(n,!1):cl(s,n));break;case 30:o=Oi,d=qv(),Oi=!1,cl(s,n),Oi&&(n.flags|=4);var p=n.memoizedProps,x=n.stateNode;s=Qi(p,x),x=Qi(l.memoizedProps,x);var k=Zi(p.default,p.update);k==="none"?s=!1:(p=l.memoizedState,l.memoizedState=null,l=n.child,Ln=0,s=wd(n,l,s,x,k,p,!0),Ln!==(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;)Wv(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:gn(l,l.return);var d=l.stateNode;typeof d.componentWillUnmount=="function"&&zv(l,l.return,d),Ts(l,o);break;case 27:(o&2)!==0&&t0(l.stateNode,l.type,l.memoizedProps);case 5:gn(l,l.return),l.tag!==5&&l.tag!==27||ba(l),Ts(l,o);break;case 6:ba(l);break;case 26:gn(l,l.return),d=l.stateNode,l.memoizedState!==null||d===null||gt||d.parentNode.removeChild(d),Ts(l,o);break;case 22:l.memoizedState===null&&Ts(l,o);break;case 30:gn(l,l.return),Ts(l,o);break;case 7:gn(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,x=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(te){vt(o,o.return,te)}if(o=p,d=o.updateQueue,d!==null){var L=o.stateNode;try{var X=d.shared.hiddenCallbacks;if(X!==null)for(d.shared.hiddenCallbacks=null,d=0;d<X.length;d++)C_(X[d],L)}catch(te){vt(o,o.return,te)}}k&&x&64&&Lv(p),Di(p,p.return);break;case 27:(l&2)!==0&&Uv(p);case 5:p.tag!==5&&p.tag!==27||Hv(p),bi(d,p,l),k&&o===null&&x&4&&pd(p),Di(p,p.return);break;case 6:Hv(p);break;case 26:L=p.stateNode,p.memoizedState!==null||L===null||sn||df(Ma(L.ownerDocument),p.type,L),bi(d,p,l),k&&o===null&&x&4&&pd(p),Di(p,p.return);break;case 12:bi(d,p,l);break;case 31:bi(d,p,l),k&&x&4&&Zv(d,p);break;case 13:bi(d,p,l),k&&x&4&&Jv(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 jd(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 Td(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;)iy(n,s,l,o),s=s.sibling;else d&&Vv(s)}function iy(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&&kd&&(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 x=s.memoizedProps,k=x.id,L=x.onPostCommit;typeof L=="function"&&L(k,s.alternate===null?"mount":"update",p.passiveEffectDuration,-0)}catch(X){vt(s,s.return,X)}}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:x=s.stateNode,k=s.alternate,s.memoizedState!==null?(d&&k!==null&&k.memoizedState===null&&bc(k),x._visibility&2?ci(n,s,l,o):wa(n,s)):(d&&k!==null&&k.memoizedState!==null&&bc(s),x._visibility&2?ci(n,s,l,o):(x._visibility|=2,ul(n,s,l,o,(s.subtreeFlags&10256)!==0||!1))),p&2048&&jd(k,s);break;case 24:ci(n,s,l,o),p&2048&&Td(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,x=s,k=l,L=o,X=x.flags;switch(x.tag){case 0:case 11:case 15:ul(p,x,k,L,d),Sa(8,x);break;case 23:break;case 22:var te=x.stateNode;x.memoizedState!==null?te._visibility&2?ul(p,x,k,L,d):wa(p,x):(te._visibility|=2,ul(p,x,k,L,d)),d&&X&2048&&jd(x.alternate,x);break;case 24:ul(p,x,k,L,d),d&&X&2048&&Td(x.alternate,x);break;default:ul(p,x,k,L,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&&jd(o.alternate,o);break;case 24:wa(l,o),d&2048&&Td(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;)sy(n,s,l),n=n.sibling}function sy(n,s,l){switch(n.tag){case 26:gr(n,s,l),n.flags&pr&&(n.memoizedState!==null?CN(l,Si,n.memoizedState,n.memoizedProps):(n=n.stateNode,(s&335544128)===s&&h0(l,n)));break;case 5:gr(n,s,l),n.flags&pr&&(n=n.stateNode,(s&335544128)===s&&h0(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,Yn===null&&(Yn=new Map),Yn.set(o,d)}gr(n,s,l);break;default:gr(n,s,l)}}function ry(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];rn=o,ay(o,n)}ry(n)}if(n.subtreeFlags&10256)for(n=n.child;n!==null;)ly(n),n=n.sibling}function ly(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];rn=o,ay(o,n)}ry(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 ay(n,s){for(;rn!==null;){var l=rn;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,rn=o;else e:for(l=n;rn!==null;){o=rn;var d=o.sibling,p=o.return;if(Gv(o),o===l){rn=null;break e}if(d!==null){d.return=p,rn=d;break e}rn=p}}}var yk={getCacheForType:function(n){var s=fn(Ft),l=s.data.get(n);return l===void 0&&(l=n(),s.data.set(n,l)),l},cacheSignal:function(){return fn(Ft).controller.signal}},Sk=typeof WeakMap=="function"?WeakMap:Map,ft=0,xt=null,nt=null,rt=0,_t=0,Wn=null,Ds=!1,hl=!1,Dd=!1,as=0,Lt=0,Ms=0,_r=0,Nc=0,Xn=0,dl=0,ka=null,Hn=null,Md=!1,Ec=0,oy=0,jc=1/0,Tc=null,As=null,Mt=0,xi=null,vr=null,Li=0,Ad=0,Rd=null,cy=null,fl=null,ml=null,pl=null,Na=0,Dc=null;function Gn(){return(ft&2)!==0&&rt!==0?rt&-rt:de.T!==null?Fd():dg()}function uy(){if(Xn===0)if((rt&536870912)===0||Ge){var n=Co;Co<<=1,(Co&3932160)===0&&(Co=262144),Xn=n}else Xn=536870912;return n=mn.current,n!==null&&(n.flags|=32),Xn}function gl(n,s){if(s!=null){var l=n.stateNode,o=l.ref;o===null&&(o=l.ref=$y(Qi(n.memoizedProps,l))),ml===null&&(ml=[]),ml.push(s.bind(null,o))}}function In(n,s,l){(n===xt&&(_t===2||_t===9)||n.cancelPendingCommit!==null)&&(_l(n,0),Rs(n,rt,Xn,!1)),Yl(n,l),((ft&2)===0||n!==xt)&&(n===xt&&((ft&2)===0&&(_r|=l),Lt===4&&Rs(n,rt,Xn,!1)),zi(n))}function hy(n,s,l){if((ft&6)!==0)throw Error(r(327));var o=!l&&(s&127)===0&&(s&n.expiredLanes)===0||Kl(n,s),d=o?wk(n,s):Bd(n,s,!0),p=o;do{if(d===0){hl&&!o&&Rs(n,s,0,!1);break}else{if(l=n.current.alternate,p&&!bk(l)){d=Bd(n,s,!1),p=!1;continue}if(d===2){if(p=s,n.errorRecoveryDisabledLanes&p)var x=0;else x=n.pendingLanes&-536870913,x=x!==0?x:x&536870912?536870912:0;if(x!==0){s=x;e:{var k=n;d=ka;var L=k.current.memoizedState.isDehydrated;if(L&&(_l(k,x).flags|=256),x=Bd(k,x,!1),x!==2&&x!==6){if(Dd&&!L){k.errorRecoveryDisabledLanes|=p,_r|=p,d=4;break e}p=Hn,Hn=d,p!==null&&(Hn===null?Hn=p:Hn.push.apply(Hn,p))}d=x}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,Xn,!Ds);break e;case 2:Hn=null;break;case 3:case 5:break;default:throw Error(r(329))}if((s&62914560)===s&&(d=Ec+300-qt(),10<d)){if(Rs(o,s,Xn,!Ds),No(o,0,!0)!==0)break e;Li=s,o.timeoutHandle=ef(dy.bind(null,o,l,Hn,Tc,Md,s,Xn,_r,dl,Ds,p,"Throttled",-0,0),d);break e}dy(o,l,Hn,Tc,Md,s,Xn,_r,dl,Ds,p,null,-0,0)}}break}while(!0);zi(n)}function dy(n,s,l,o,d,p,x,k,L,X,te,he,Y,J){n.timeoutHandle=-1;var Ne=s.subtreeFlags,Le=(p&335544064)===p;if(he=null,(Le||Ne&8192||(Ne&16785408)===16785408)&&(he={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:Ei},Yn=null,sy(s,p,he),Le&&(Ne=he,Le=n.containerInfo,Le=(Le.nodeType===9?Le:Le.ownerDocument).__reactViewTransition,Le!=null&&(Ne.count++,Ne.waitingForViewTransition=!0,Ne=Oa.bind(Ne),Le.finished.then(Ne,Ne))),Ne=(p&62914560)===p?Ec-qt():(p&4194048)===p?oy-qt():0,Ne=kN(he,Ne),Ne!==null)){Li=p,n.cancelPendingCommit=Ne(Sy.bind(null,n,s,p,l,o,d,x,k,L,X,te,he,null,Y,J)),Rs(n,p,x,!X);return}Sy(n,s,p,l,o,d,x,k,L,X,te,he)}function bk(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(!Vn(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=ag(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-hn(d),x=1<<p;o[p]=-1,d&=~x}l!==0&&cg(n,l,s)}function Mc(){return(ft&6)===0?(Ea(0),!1):!0}function Od(){if(nt!==null){if(_t===0)var n=nt.return;else n=nt,ts=rr=null,qh(n),il=null,ua=0,n=nt;for(;n!==null;)Bv(n.alternate,n),n=n.return;nt=null}}function _l(n,s){var l=n.timeoutHandle;return l!==-1&&(n.timeoutHandle=-1,Vk(l)),l=n.cancelPendingCommit,l!==null&&(n.cancelPendingCommit=null,l()),Li=0,Od(),xt=n,nt=l=Ji(n.current,null),rt=s,_t=0,Wn=null,Ds=!1,hl=Kl(n,s),Dd=!1,dl=Xn=Nc=_r=Ms=Lt=0,Hn=ka=null,Md=!1,as=ag(n,s),Io(),l}function fy(n,s){Ve=null,de.H=uc,s===nl||s===Go?(s=S_(),_t=3):s===Th?(s=S_(),_t=4):_t=s===id?8:s!==null&&typeof s=="object"&&typeof s.then=="function"?6:1,Wn=s,nt===null&&(Lt=1,hc(n,ri(s,n.current)))}function my(){var n=mn.current;return n===null?!0:(rt&4194048)===rt?xn===null:(rt&62914560)===rt||(rt&536870912)!==0?n===xn:!1}function py(){var n=de.H;return de.H=uc,n===null?uc:n}function gy(){var n=de.A;return de.A=yk,n}function Ac(){Lt=4,Ds||(rt&4194048)!==rt&&mn.current!==null||(hl=!0),(Ms&134217727)===0&&(_r&134217727)===0||xt===null||Rs(xt,rt,Xn,!1)}function Bd(n,s,l){var o=ft;ft|=2;var d=py(),p=gy();(xt!==n||rt!==s)&&(Tc=null,_l(n,s)),s=!1;var x=Lt;e:do try{if(_t!==0&&nt!==null){var k=nt,L=Wn;switch(_t){case 8:Od(),x=6;break e;case 3:case 2:case 9:case 6:mn.current===null&&(s=!0);var X=_t;if(_t=0,Wn=null,vl(n,k,L,X),l&&hl){x=0;break e}break;default:X=_t,_t=0,Wn=null,vl(n,k,L,X)}}xk(),x=Lt;break}catch(te){fy(n,te)}while(!0);return s&&n.shellSuspendCounter++,ts=rr=null,ft=o,de.H=d,de.A=p,nt===null&&(xt=null,rt=0,Io()),x}function xk(){for(;nt!==null;)_y(nt)}function wk(n,s){var l=ft;ft|=2;var o=py(),d=gy();xt!==n||rt!==s?(Tc=null,jc=qt()+500,_l(n,s)):hl=Kl(n,s);e:do try{if(_t!==0&&nt!==null){s=nt;var p=Wn;t:switch(_t){case 1:_t=0,Wn=null,vl(n,s,p,1);break;case 2:case 9:if(v_(p)){_t=0,Wn=null,vy(s);break}s=function(){_t!==2&&_t!==9||xt!==n||(_t=7),zi(n)},p.then(s,s);break e;case 3:_t=7;break e;case 4:_t=5;break e;case 7:v_(p)?(_t=0,Wn=null,vy(s)):(_t=0,Wn=null,vl(n,s,p,7));break;case 5:var x=null;switch(nt.tag){case 26:x=nt.memoizedState;case 5:case 27:var k=nt;if(x?c0(x):k.stateNode.complete){_t=0,Wn=null;var L=k.sibling;if(L!==null)nt=L;else{var X=k.return;X!==null?(nt=X,Rc(X)):nt=null}break t}}_t=0,Wn=null,vl(n,s,p,5);break;case 6:_t=0,Wn=null,vl(n,s,p,6);break;case 8:Od(),Lt=6;break e;default:throw Error(r(462))}}Ck();break}catch(te){fy(n,te)}while(!0);return ts=rr=null,de.H=o,de.A=d,ft=l,nt!==null?0:(xt=null,rt=0,Io(),Lt)}function Ck(){for(;nt!==null&&!Ni();)_y(nt)}function _y(n){var s=Rv(n.alternate,n,as);n.memoizedProps=n.pendingProps,s===null?Rc(n):nt=s}function vy(n){var s=n,l=s.alternate;switch(s.tag){case 15:case 0:s=Nv(l,s,s.pendingProps,s.type,void 0,rt);break;case 11:s=Nv(l,s,s.pendingProps,s.type.render,s.ref,rt);break;case 5:qh(s);var o=s;o===nn&&(Ge?(Vo(o),o.tag===5&&o.stateNode!=null&&(kt=o.stateNode)):(Vo(o),Ge=!0));default:Bv(l,s),s=nt=a_(s,as),s=Rv(l,s,as)}n.memoizedProps=n.pendingProps,s===null?Rc(n):nt=s}function vl(n,s,l,o){ts=rr=null,qh(s),il=null,ua=0;var d=s.return;try{if(hk(n,d,s,l,rt)){Lt=1,hc(n,ri(l,n.current)),nt=null;return}}catch(p){if(d!==null)throw nt=d,p;Lt=1,hc(n,ri(l,n.current)),nt=null;return}s.flags&32768?(Ge||o===1?n=!0:hl||(rt&536870912)!==0?n=!1:(Ds=n=!0,(o===2||o===9||o===3||o===6)&&(o=mn.current,o!==null&&o.tag===13&&(o.flags|=16384))),yy(s,n)):Rc(s)}function Rc(n){var s=n;do{if((s.flags&32768)!==0){yy(s,Ds);return}n=s.return;var l=pk(s.alternate,s,as);if(l!==null){nt=l;return}if(s=s.sibling,s!==null){nt=s;return}nt=s=n}while(s!==null);Lt===0&&(Lt=5)}function yy(n,s){do{var l=gk(n.alternate,n);if(l!==null){l.flags&=32767,nt=l;return}if(l=n.return,l!==null&&(l.flags|=32768,l.subtreeFlags=0,l.deletions=null),!s&&(n=n.sibling,n!==null)){nt=n;return}nt=n=l}while(n!==null);Lt=6,nt=null}function Sy(n,s,l,o,d,p,x,k,L,X,te,he){n.cancelPendingCommit=null;do Oc();while(Mt!==0);if((ft&6)!==0)throw Error(r(327));if(s!==null){if(s===n.current)throw Error(r(177));n===xt&&(nt=xt=null,rt=0),vr=s,xi=n,Li=l,Rd=d,cy=o,kk(n,s,l,x,k,L,he)}}function kk(n,s,l,o,d,p,x){var k=s.lanes|s.childLanes;if(Ad=k,k|=gh,Qw(n,l,k,o,d,p),ml=null,(l&335544064)===l?(pl=JC(n),o=10262):(pl=null,o=10256),(s.subtreeFlags&o)!==0||(s.flags&o)!==0?(n.callbackNode=null,n.callbackPriority=0,Mk(Hr,function(){return Id(),null})):(n.callbackNode=null,n.callbackPriority=0),yc=!1,o=(s.flags&13878)!==0,(s.subtreeFlags&13878)!==0||o){o=de.T,de.T=null,d=be.p,be.p=2,p=ft,ft|=4;try{_k(n,s,l)}finally{ft=p,be.p=d,de.T=o}}Mt=1,yc?fl=Qk(x,n.containerInfo,pl,Ld,zd,Ek,Hd,Id,Nk):(Ld(),zd(),Hd())}function Nk(n){if(Mt!==0){var s=xi.onRecoverableError;s(n,{componentStack:null})}}function Ek(){Mt===3&&(Mt=0,ny(vr,xi),Mt=4)}function Ld(){if(Mt===1){Mt=0;var n=xi,s=vr,l=Li,o=(s.flags&13878)!==0;if((s.subtreeFlags&13878)!==0||o){o=de.T,de.T=null;var d=be.p;be.p=2;var p=ft;ft|=4;try{xa=xc=!1,ey(s,n,l),l=Qd;var x=Qg(n.containerInfo),k=l.focusedElem,L=l.selectionRange;if(x!==k&&k&&k.ownerDocument&&Gg(k.ownerDocument.documentElement,k)){if(L!==null&&hh(k)){var X=L.start,te=L.end;if(te===void 0&&(te=X),"selectionStart"in k)k.selectionStart=X,k.selectionEnd=Math.min(te,k.value.length);else{var he=k.ownerDocument||document,Y=he&&he.defaultView||window;if(Y.getSelection){var J=Y.getSelection(),Ne=k.textContent.length,Le=Math.min(L.start,Ne),Ke=L.end===void 0?Le:Math.min(L.end,Ne);!J.extend&&Le>Ke&&(x=Ke,Ke=Le,Le=x);var W=Xg(k,Le),P=Xg(k,Ke);if(W&&P&&(J.rangeCount!==1||J.anchorNode!==W.node||J.anchorOffset!==W.offset||J.focusNode!==P.node||J.focusOffset!==P.offset)){var Q=he.createRange();Q.setStart(W.node,W.offset),J.removeAllRanges(),Le>Ke?(J.addRange(Q),J.extend(P.node,P.offset)):(Q.setEnd(P.node,P.offset),J.addRange(Q))}}}}for(he=[],J=k;J=J.parentNode;)J.nodeType===1&&he.push({element:J,left:J.scrollLeft,top:J.scrollTop});for(typeof k.focus=="function"&&k.focus(),k=0;k<he.length;k++){var ce=he[k];ce.element.scrollLeft=ce.left,ce.element.scrollTop=ce.top}}Nl=!!Gd,Qd=Gd=null}finally{ft=p,be.p=d,de.T=o}}n.current=s,Mt=2}}function zd(){if(Mt===2){Mt=0;var n=xi,s=vr,l=(s.flags&8772)!==0;if((s.subtreeFlags&8772)!==0||l){l=de.T,de.T=null;var o=be.p;be.p=2;var d=ft;ft|=4;try{Wv(n,s.alternate,s)}finally{ft=d,be.p=o,de.T=l}}Mt=3}}function Hd(){if(Mt===4||Mt===3){Mt=0;var n=fl;fl=null,zr();var s=xi,l=vr,o=Li,d=cy,p=(o&335544064)===o?10262:10256;if((l.subtreeFlags&p)!==0||(l.flags&p)!==0?Mt=5:(Mt=0,vr=xi=null,by(s,s.pendingLanes)),p=s.pendingLanes,p===0&&(As=null),Yu(o),l=l.stateNode,Ie&&typeof Ie.onCommitFiberRoot=="function")try{Ie.onCommitFiberRoot(Nn,l,void 0,(l.current.flags&128)===128)}catch{}if(d!==null){l=de.T,p=be.p,be.p=2,de.T=null;try{for(var x=s.onRecoverableError,k=0;k<d.length;k++){var L=d[k];x(L.value,{componentStack:L.stack})}}finally{de.T=l,be.p=p}}if(d=ml,x=pl,pl=null,d!==null&&(ml=null,x===null&&(x=[]),n!==null))for(L=0;L<d.length;L++)l=(0,d[L])(x),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 by(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),Ld(),zd(),Hd(),Id()}function Id(){if(Mt!==5)return!1;var n=xi,s=Ad;Ad=0;var l=Yu(Li),o=de.T,d=be.p;try{be.p=32>l?32:l,de.T=null,l=Rd,Rd=null;var p=xi,x=Li;if(Mt=0,vr=xi=null,Li=0,(ft&6)!==0)throw Error(r(331));var k=ft;if(ft|=4,ly(p.current),iy(p,p.current,x,l),ft=k,Ea(0,!1),Ie&&typeof Ie.onPostCommitFiberRoot=="function")try{Ie.onPostCommitFiberRoot(Nn,p)}catch{}return!0}finally{be.p=d,de.T=o,by(n,s)}}function xy(n,s,l){s=ri(l,s),s=nd(n.stateNode,s,2),n=Cs(n,s,2),n!==null&&(Yl(n,2),zi(n))}function vt(n,s,l){if(n.tag===3)xy(n,n,l);else for(;s!==null;){if(s.tag===3){xy(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=vv(2),o=Cs(s,l,2),o!==null&&(yv(l,o,s,n),Yl(o,2),zi(o));break}}s=s.return}}function Ud(n,s,l){var o=n.pingCache;if(o===null){o=n.pingCache=new Sk;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)||(Dd=!0,d.add(l),n=jk.bind(null,n,s,l),s.then(n,n))}function jk(n,s,l){var o=n.pingCache;o!==null&&o.delete(s),n.pingedLanes|=n.suspendedLanes&l,n.warmLanes&=~l,xt===n&&(rt&l)===l&&((Lt===4||Lt===3&&(rt&62914560)===rt&&300>qt()-Ec)&&(ft&2)===0?_l(n,0):Nc|=l,dl===rt&&(dl=0)),zi(n)}function wy(n,s){s===0&&(s=og()),n=nr(n,s),n!==null&&(Yl(n,s),zi(n))}function Tk(n){var s=n.memoizedState,l=0;s!==null&&(l=s.retryLane),wy(n,l)}function Dk(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),wy(n,l)}function Mk(n,s){return et(n,s)}var yl=null,Sl=null,Pd=!1,Bc=!1,qd=!1,Os=0;function zi(n){n!==Sl&&n.next===null&&(Sl===null?yl=Sl=n:Sl=Sl.next=n),Bc=!0,Pd||(Pd=!0,Rk())}function Ea(n,s){if(!qd&&Bc){qd=!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 x=o.suspendedLanes,k=o.pingedLanes;p=(1<<31-hn(42|n)+1)-1,p&=d&~(x&~k),p=p&201326741?p&201326741|1:p?p|2:0}p!==0&&(l=!0,Ey(o,p))}else p=rt,p=No(o,o===xt?p:0,o.cancelPendingCommit!==null||o.timeoutHandle!==-1),(p&3)===0||Kl(o,p)||(l=!0,Ey(o,p));o=o.next}while(l);qd=!1}}function Ak(){Cy()}function Cy(){Bc=Pd=!1;var n=0;Os!==0&&$k()&&(n=Os);for(var s=qt(),l=null,o=yl;o!==null;){var d=o.next,p=ky(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}Mt!==0&&Mt!==5||Ea(n),Os!==0&&(Os=0)}function ky(n,s){for(var l=n.suspendedLanes,o=n.pingedLanes,d=n.expirationTimes,p=n.pendingLanes&-62914561;0<p;){var x=31-hn(p),k=1<<x,L=d[x];L===-1?((k&l)===0||(k&o)!==0)&&(d[x]=Gw(k,s)):L<=s&&(n.expiredLanes|=k),p&=~k}if(s=xt,l=rt,l=No(n,n===s?l:0,n.cancelPendingCommit!==null||n.timeoutHandle!==-1),o=n.callbackNode,l===0||n===s&&(_t===2||_t===9)||n.cancelPendingCommit!==null)return o!==null&&o!==null&&ni(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&&ni(o),Yu(l)){case 2:case 8:l=kn;break;case 32:l=Hr;break;case 268435456:l=Re;break;default:l=Hr}return o=Ny.bind(null,n),l=et(l,o),n.callbackPriority=s,n.callbackNode=l,s}return o!==null&&o!==null&&ni(o),n.callbackPriority=2,n.callbackNode=null,2}function Ny(n,s){if(Mt!==0&&Mt!==5)return n.callbackNode=null,n.callbackPriority=0,null;var l=n.callbackNode;if(Oc()&&n.callbackNode!==l)return null;var o=rt;return o=No(n,n===xt?o:0,n.cancelPendingCommit!==null||n.timeoutHandle!==-1),o===0?null:(hy(n,o,s),ky(n,qt()),n.callbackNode!=null&&n.callbackNode===l?Ny.bind(null,n):null)}function Ey(n,s){if(Oc())return null;hy(n,s,!0)}function Rk(){Kk(function(){(ft&6)!==0?et(_i,Ak):Cy()})}function Fd(){if(Os===0){var n=or;n===0&&(n=wo,wo<<=1,(wo&261888)===0&&(wo=256)),Os=n}return Os}function jy(n){return n==null||typeof n=="symbol"||typeof n=="boolean"?null:typeof n=="function"?n:Mo(n)}function Ok(n,s,l,o,d){if(s==="submit"&&l&&l.stateNode===d){var p=jy((d[On]||null).action),x=o.submitter;x&&(s=(s=x[On]||null)?jy(s.formAction):x.getAttribute("formAction"),s!==null&&(p=s,x=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 L=new FormData(d,x);Qh(l,{pending:!0,data:L,method:d.method,action:p},null,L)}}else typeof p=="function"&&(k.preventDefault(),L=new FormData(d,x),Qh(l,{pending:!0,data:L,method:d.method,action:p},p,L))},currentTarget:d}]})}}for(var $d=0;$d<ph.length;$d++){var Vd=ph[$d],Bk=Vd.toLowerCase(),Lk=Vd[0].toUpperCase()+Vd.slice(1);vi(Bk,"on"+Lk)}vi(e_,"onAnimationEnd"),vi(t_,"onAnimationIteration"),vi(n_,"onAnimationStart"),vi("dblclick","onDoubleClick"),vi("focusin","onFocus"),vi("focusout","onBlur"),vi(VC,"onTransitionRun"),vi(KC,"onTransitionStart"),vi(YC,"onTransitionCancel"),vi(i_,"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(" "),zk=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(ja));function Ty(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 x=o.length-1;0<=x;x--){var k=o[x],L=k.instance,X=k.currentTarget;if(k=k.listener,L!==p&&d.isPropagationStopped())break e;p=k,d.currentTarget=X;try{p(d)}catch(te){Ho(te)}d.currentTarget=null,p=L}else for(x=0;x<o.length;x++){if(k=o[x],L=k.instance,X=k.currentTarget,k=k.listener,L!==p&&d.isPropagationStopped())break e;p=k,d.currentTarget=X;try{p(d)}catch(te){Ho(te)}d.currentTarget=null,p=L}}}}function it(n,s){var l=s[mg];l===void 0&&(l=s[mg]=new Set);var o=n+"__bubble";l.has(o)||(Dy(s,n,2,!1),l.add(o))}function Kd(n,s,l){var o=0;s&&(o|=4),Dy(l,n,o,s)}var Lc="_reactListening"+Math.random().toString(36).slice(2);function Yd(n){if(!n[Lc]){n[Lc]=!0,_g.forEach(function(l){l!=="selectionchange"&&(zk.has(l)||Kd(l,!1,n),Kd(l,!0,n))});var s=n.nodeType===9?n:n.ownerDocument;s===null||s[Lc]||(s[Lc]=!0,Kd("selectionchange",!1,s))}}function Dy(n,s,l,o){switch(y0(s)){case 2:var d=TN;break;case 8:d=DN;break;default:d=mf}l=d.bind(null,s,l,n),d=void 0,!th||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 Wd(n,s,l,o,d){var p=o;if((s&1)===0&&(s&2)===0&&o!==null)e:for(;;){if(o===null)return;var x=o.tag;if(x===3||x===4){var k=o.stateNode.containerInfo;if(k===d)break;if(x===4)for(x=o.return;x!==null;){var L=x.tag;if((L===3||L===4)&&x.stateNode.containerInfo===d)return;x=x.return}for(;k!==null;){if(x=Zs(k),x===null)return;if(L=x.tag,L===5||L===6||L===26||L===27){o=p=x;continue e}k=k.parentNode}}o=o.return}Dg(function(){var X=p,te=Ju(l),he=[];e:{var Y=s_.get(n);if(Y!==void 0){var J=Bo,Ne=n;switch(n){case"keypress":if(Ro(l)===0)break e;case"keydown":case"keyup":J=bC;break;case"focusin":Ne="focus",J=rh;break;case"focusout":Ne="blur",J=rh;break;case"beforeblur":case"afterblur":J=rh;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":J=Rg;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":J=cC;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":J=NC;break;case e_:case t_:case n_:J=dC;break;case i_:J=jC;break;case"scroll":case"scrollend":J=aC;break;case"wheel":J=DC;break;case"copy":case"cut":case"paste":J=mC;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":J=Bg;break;case"submit":J=CC;break;case"toggle":case"beforetoggle":J=AC}var Le=(s&4)!==0,Ke=!Le&&(n==="scroll"||n==="scrollend"),W=Le?Y!==null?Y+"Capture":null:Y;Le=[];for(var P=X,Q;P!==null;){var ce=P;if(Q=ce.stateNode,ce=ce.tag,ce!==5&&ce!==26&&ce!==27||Q===null||W===null||(ce=Gl(P,W),ce!=null&&Le.push(Ta(P,ce,Q))),Ke)break;P=P.return}0<Le.length&&(Y=new J(Y,Ne,null,l,te),he.push({event:Y,listeners:Le}))}}if((s&7)===0){e:{if(J=n==="mouseover"||n==="pointerover",Y=n==="mouseout"||n==="pointerout",J&&l!==Zu&&(Ne=l.relatedTarget||l.fromElement)&&(Zs(Ne)||Ne[Ir]))break e;(Y||J)&&(Ne=te.window===te?te:(J=te.ownerDocument)?J.defaultView||J.parentWindow:window,Y?(J=l.relatedTarget||l.toElement,Y=X,J=J?Zs(J):null,J!==null&&(Ke=c(J),Le=J.tag,J!==Ke||Le!==5&&Le!==27&&Le!==6)&&(J=null)):(Y=null,J=X),Y!==J&&(Le=Rg,ce="onMouseLeave",W="onMouseEnter",P="mouse",(n==="pointerout"||n==="pointerover")&&(Le=Bg,ce="onPointerLeave",W="onPointerEnter",P="pointer"),Ke=Y==null?Ne:Xl(Y),Q=J==null?Ne:Xl(J),Ne=new Le(ce,P+"leave",Y,l,te),Ne.target=Ke,Ne.relatedTarget=Q,ce=null,Zs(te)===X&&(Le=new Le(W,P+"enter",J,l,te),Le.target=Q,Le.relatedTarget=Ke,ce=Le),Ke=ce,Le=Y&&J?z(Y,J,Hk):null,Y!==null&&My(he,Ne,Y,Le,!1),J!==null&&Ke!==null&&My(he,Ke,J,Le,!0)))}e:{if(Y=X?Xl(X):window,J=Y.nodeName&&Y.nodeName.toLowerCase(),J==="select"||J==="input"&&Y.type==="file")var Be=Fg;else if(Pg(Y))if($g)Be=qC;else{Be=UC;var lt=IC}else J=Y.nodeName,!J||J.toLowerCase()!=="input"||Y.type!=="checkbox"&&Y.type!=="radio"?X&&Qu(X.elementType)&&(Be=Fg):Be=PC;if(Be&&(Be=Be(n,X))){qg(he,Be,l,te);break e}lt&&lt(n,Y,X)}switch(lt=X?Xl(X):window,n){case"focusin":(Pg(lt)||lt.contentEditable==="true")&&(Wr=lt,dh=X,sa=null);break;case"focusout":sa=dh=Wr=null;break;case"mousedown":fh=!0;break;case"contextmenu":case"mouseup":case"dragend":fh=!1,Zg(he,l,te);break;case"selectionchange":if($C)break;case"keydown":case"keyup":Zg(he,l,te)}var He;if(ah)e:{switch(n){case"compositionstart":var Pe="onCompositionStart";break e;case"compositionend":Pe="onCompositionEnd";break e;case"compositionupdate":Pe="onCompositionUpdate";break e}Pe=void 0}else Yr?Ig(n,l)&&(Pe="onCompositionEnd"):n==="keydown"&&l.keyCode===229&&(Pe="onCompositionStart");Pe&&(Lg&&l.locale!=="ko"&&(Yr||Pe!=="onCompositionStart"?Pe==="onCompositionEnd"&&Yr&&(He=Mg()):(ps=te,nh="value"in ps?ps.value:ps.textContent,Yr=!0)),lt=zc(X,Pe),0<lt.length&&(Pe=new Og(Pe,n,null,l,te),he.push({event:Pe,listeners:lt}),He?Pe.data=He:(He=Ug(l),He!==null&&(Pe.data=He)))),(He=OC?BC(n,l):LC(n,l))&&(Pe=zc(X,"onBeforeInput"),0<Pe.length&&(lt=new Og("onBeforeInput","beforeinput",null,l,te),he.push({event:lt,listeners:Pe}),lt.data=He)),Ok(he,n,X,l,te)}Ty(he,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 Hk(n){if(n===null)return null;do n=n.return;while(n&&n.tag!==5&&n.tag!==27);return n||null}function My(n,s,l,o,d){for(var p=s._reactName,x=[];l!==null&&l!==o;){var k=l,L=k.alternate,X=k.stateNode;if(k=k.tag,L!==null&&L===o)break;k!==5&&k!==26&&k!==27||X===null||(L=X,d?(X=Gl(l,p),X!=null&&x.unshift(Ta(l,X,L))):d||(X=Gl(l,p),X!=null&&x.push(Ta(l,X,L)))),l=l.return}x.length!==0&&n.push({event:s,listeners:x})}var Ik=/\r\n?/g,Uk=/\u0000|\uFFFD/g;function Ay(n){return(typeof n=="string"?n:""+n).replace(Ik,`
9
+ `).replace(Uk,"")}function Ry(n,s){return s=Ay(s),Ay(n)===s}function yt(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":jg(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"&&yt(n,s,"name",d.name,d,null),yt(n,s,"formEncType",d.formEncType,d,null),yt(n,s,"formMethod",d.formMethod,d,null),yt(n,s,"formTarget",d.formTarget,d,null)):(yt(n,s,"encType",d.encType,d,null),yt(n,s,"method",d.method,d,null),yt(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&&it("scroll",n);return;case"onScrollEnd":o!=null&&it("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":it("beforetoggle",n),it("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=rC.get(l)||l,To(n,l,o);else return}ht=!0}function Xd(n,s,l,o,d,p){switch(l){case"style":jg(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&&it("scroll",n);return;case"onScrollEnd":o!=null&&it("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(!vg.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[On]||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}ht=!0,l in n?n[l]=o:o===!0?n.setAttribute(l,""):To(n,l,o)}return}ht=!0}function _n(n,s,l){switch(s){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":it("error",n),it("load",n);var o=!1,d=!1,p;for(p in l)if(l.hasOwnProperty(p)){var x=l[p];if(x!=null)switch(p){case"src":o=!0;break;case"srcSet":d=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(r(137,s));default:yt(n,s,p,x,l,null)}}d&&yt(n,s,"srcSet",l.srcSet,l,null),o&&yt(n,s,"src",l.src,l,null);return;case"input":it("invalid",n);var k=p=x=d=null,L=null,X=null;for(o in l)if(l.hasOwnProperty(o)){var te=l[o];if(te!=null)switch(o){case"name":d=te;break;case"type":x=te;break;case"checked":L=te;break;case"defaultChecked":X=te;break;case"value":p=te;break;case"defaultValue":k=te;break;case"children":case"dangerouslySetInnerHTML":if(te!=null)throw Error(r(137,s));break;default:yt(n,s,o,te,l,null)}}Cg(n,p,k,L,X,x,d,!1);return;case"select":it("invalid",n),o=x=p=null;for(d in l)if(l.hasOwnProperty(d)&&(k=l[d],k!=null))switch(d){case"value":p=k;break;case"defaultValue":x=k;break;case"multiple":o=k;default:yt(n,s,d,k,l,null)}s=p,l=x,n.multiple=!!o,s!=null?Fr(n,!!o,s,!1):l!=null&&Fr(n,!!o,l,!0);return;case"textarea":it("invalid",n),p=d=o=null;for(x in l)if(l.hasOwnProperty(x)&&(k=l[x],k!=null))switch(x){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:yt(n,s,x,k,l,null)}Ng(n,o,d,p);return;case"option":for(L in l)l.hasOwnProperty(L)&&(o=l[L],o!=null)&&(L==="selected"?n.selected=o&&typeof o!="function"&&typeof o!="symbol":yt(n,s,L,o,l,null));return;case"dialog":it("beforetoggle",n),it("toggle",n),it("cancel",n),it("close",n);break;case"iframe":case"object":it("load",n);break;case"video":case"audio":for(o=0;o<ja.length;o++)it(ja[o],n);break;case"image":it("error",n),it("load",n);break;case"details":it("toggle",n);break;case"embed":case"source":case"link":it("error",n),it("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(X in l)if(l.hasOwnProperty(X)&&(o=l[X],o!=null))switch(X){case"children":case"dangerouslySetInnerHTML":throw Error(r(137,s));default:yt(n,s,X,o,l,null)}return;default:if(Qu(s)){for(te in l)l.hasOwnProperty(te)&&(o=l[te],o!==void 0&&Xd(n,s,te,o,l,void 0));return}}for(k in l)l.hasOwnProperty(k)&&(o=l[k],o!=null&&yt(n,s,k,o,l,null))}var Pk={};function qk(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,x=null,k=null,L=null,X=null,te=null;for(J in l){var he=l[J];if(l.hasOwnProperty(J)&&he!=null)switch(J){case"checked":break;case"value":break;case"defaultValue":L=he;default:o.hasOwnProperty(J)||yt(n,s,J,null,o,he)}}for(var Y in o){var J=o[Y];if(he=l[Y],o.hasOwnProperty(Y)&&(J!=null||he!=null))switch(Y){case"type":J!==he&&(ht=!0),p=J;break;case"name":J!==he&&(ht=!0),d=J;break;case"checked":J!==he&&(ht=!0),X=J;break;case"defaultChecked":J!==he&&(ht=!0),te=J;break;case"value":J!==he&&(ht=!0),x=J;break;case"defaultValue":J!==he&&(ht=!0),k=J;break;case"children":case"dangerouslySetInnerHTML":if(J!=null)throw Error(r(137,s));break;default:J!==he&&yt(n,s,Y,J,o,he)}}Xu(n,x,k,L,X,te,p,d);return;case"select":J=x=k=Y=null;for(p in l)if(L=l[p],l.hasOwnProperty(p)&&L!=null)switch(p){case"value":break;case"multiple":J=L;default:o.hasOwnProperty(p)||yt(n,s,p,null,o,L)}for(d in o)if(p=o[d],L=l[d],o.hasOwnProperty(d)&&(p!=null||L!=null))switch(d){case"value":p!==L&&(ht=!0),Y=p;break;case"defaultValue":p!==L&&(ht=!0),k=p;break;case"multiple":p!==L&&(ht=!0),x=p;default:p!==L&&yt(n,s,d,p,o,L)}s=k,l=x,o=J,Y!=null?Fr(n,!!l,Y,!1):!!o!=!!l&&(s!=null?Fr(n,!!l,s,!0):Fr(n,!!l,l?[]:"",!1));return;case"textarea":J=Y=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:yt(n,s,k,null,o,d)}for(x in o)if(d=o[x],p=l[x],o.hasOwnProperty(x)&&(d!=null||p!=null))switch(x){case"value":d!==p&&(ht=!0),Y=d;break;case"defaultValue":d!==p&&(ht=!0),J=d;break;case"children":break;case"dangerouslySetInnerHTML":if(d!=null)throw Error(r(91));break;default:d!==p&&yt(n,s,x,d,o,p)}kg(n,Y,J);return;case"option":for(var Ne in l)Y=l[Ne],l.hasOwnProperty(Ne)&&Y!=null&&!o.hasOwnProperty(Ne)&&(Ne==="selected"?n.selected=!1:yt(n,s,Ne,null,o,Y));for(L in o)Y=o[L],J=l[L],o.hasOwnProperty(L)&&Y!==J&&(Y!=null||J!=null)&&(L==="selected"?(Y!==J&&(ht=!0),n.selected=Y&&typeof Y!="function"&&typeof Y!="symbol"):yt(n,s,L,Y,o,J));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)Y=l[Le],l.hasOwnProperty(Le)&&Y!=null&&!o.hasOwnProperty(Le)&&yt(n,s,Le,null,o,Y);for(X in o)if(Y=o[X],J=l[X],o.hasOwnProperty(X)&&Y!==J&&(Y!=null||J!=null))switch(X){case"children":case"dangerouslySetInnerHTML":if(Y!=null)throw Error(r(137,s));break;default:yt(n,s,X,Y,o,J)}return;default:if(Qu(s)){for(var Ke in l)Y=l[Ke],l.hasOwnProperty(Ke)&&Y!==void 0&&!o.hasOwnProperty(Ke)&&Xd(n,s,Ke,void 0,o,Y);for(te in o)Y=o[te],J=l[te],!o.hasOwnProperty(te)||Y===J||Y===void 0&&J===void 0||Xd(n,s,te,Y,o,J);return}}for(var W in l)Y=l[W],l.hasOwnProperty(W)&&Y!=null&&!o.hasOwnProperty(W)&&yt(n,s,W,null,o,Y);for(he in o)Y=o[he],J=l[he],!o.hasOwnProperty(he)||Y===J||Y==null&&J==null||yt(n,s,he,Y,o,J)}function Oy(n){switch(n){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function Fk(){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,x=d.initiatorType,k=d.duration;if(p&&k&&Oy(x)){for(x=0,k=d.responseEnd,o+=1;o<l.length;o++){var L=l[o],X=L.startTime;if(X>k)break;var te=L.transferSize,he=L.initiatorType;te&&Oy(he)&&(L=L.responseEnd,x+=te*(L<k?1:(k-X)/(L-X)))}if(--o,s+=8*(p+x)/(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 Gd=null,Qd=null;function Da(n){return n.nodeType===9?n:n.ownerDocument}function By(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 Ly(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 zy(n,s,l,o){return l=Da(l).createElement(n),l[dn]=o,l[On]=s,_n(l,n,s),tn(l),l}function Zd(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 Jd=null;function $k(){var n=window.event;return n&&n.type==="popstate"?n===Jd?!1:(Jd=n,!0):(Jd=null,!1)}var ef=typeof setTimeout=="function"?setTimeout:void 0,Vk=typeof clearTimeout=="function"?clearTimeout:void 0,Hy=typeof Promise=="function"?Promise:void 0,Iy=typeof requestAnimationFrame=="function"?requestAnimationFrame:ef,Kk=typeof queueMicrotask=="function"?queueMicrotask:typeof Hy<"u"?function(n){return Hy.resolve(null).then(n).catch(Yk)}:ef;function Yk(n){setTimeout(function(){throw n})}function Bs(n){return n==="head"}function Uy(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")cf(n.ownerDocument.documentElement);else if(l==="head"){l=n.ownerDocument.head,cf(l);for(var p=l.firstChild;p;){var x=p.nextSibling,k=p.nodeName;p[Wl]||k==="SCRIPT"||k==="STYLE"||k==="LINK"&&p.rel.toLowerCase()==="stylesheet"||l.removeChild(p),p=x}}else l==="body"&&cf(n.ownerDocument.body);l=d}while(l);El(s)}function Py(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 qy(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 Fy(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 Wk(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 tf(n){var s=n.getBoundingClientRect(),l=getComputedStyle(n);return Wk(s,l,n)}function Xk(n){return n.documentElement.clientHeight}function Gk(n){this.addEventListener("load",n),this.addEventListener("error",n)}function Qk(n,s,l,o,d,p,x,k,L){var X=s.nodeType===9?s:s.ownerDocument;try{var te=X.startViewTransition({update:function(){var Y=X.defaultView,J=Y.navigation&&Y.navigation.transition,Ne=X.fonts.status;o();var Le=[];if(Ne==="loaded"&&(Xk(X),X.fonts.status==="loading"&&Le.push(X.fonts.ready)),Ne=Le.length,n!==null)for(var Ke=n.suspenseyImages,W=0,P=0;P<Ke.length;P++){var Q=Ke[P];if(!Q.complete){var ce=Q.getBoundingClientRect();if(0<ce.bottom&&0<ce.right&&ce.top<Y.innerHeight&&ce.left<Y.innerWidth){if(W+=u0(Q),W>Uc){Le.length=Ne;break}Q=new Promise(Gk.bind(Q)),Le.push(Q)}}}if(0<Le.length)return Y=Promise.race([Promise.all(Le),new Promise(function(Be){return setTimeout(Be,500)})]).then(d,d),(J?Promise.allSettled([J.finished,Y]):Y).then(p,p);if(d(),J)return J.finished.then(p,p);p()},types:l});X.__reactViewTransition=te;var he=[];return te.ready.then(function(){for(var Y=X.documentElement.getAnimations({subtree:!0}),J=0;J<Y.length;J++){var Ne=Y[J],Le=Ne.effect,Ke=Le.pseudoElement;if(Ke!=null&&Ke.startsWith("::view-transition")){he.push(Ne),Ne=Le.getKeyframes();for(var W=Ke=void 0,P=!0,Q=0;Q<Ne.length;Q++){var ce=Ne[Q],Be=ce.width;if(Ke===void 0)Ke=Be;else if(Ke!==Be){P=!1;break}if(Be=ce.height,W===void 0)W=Be;else if(W!==Be){P=!1;break}delete ce.width,delete ce.height,ce.transform==="none"&&delete ce.transform}P&&Ke!==void 0&&W!==void 0&&(Le.setKeyframes(Ne),P=getComputedStyle(Le.target,Le.pseudoElement),P.width!==Ke||P.height!==W)&&(P=Ne[0],P.width=Ke,P.height=W,P=Ne[Ne.length-1],P.width=Ke,P.height=W,Le.setKeyframes(Ne))}}x()},function(Y){X.__reactViewTransition===te&&(X.__reactViewTransition=null);try{typeof Y=="object"&&Y!==null&&Y.name==="InvalidStateError"&&(Y.message==="View transition was skipped because document visibility state is hidden."||Y.message==="Skipping view transition because document visibility state has become hidden."||Y.message==="Skipping view transition because viewport size changed."||Y.message==="Transition was aborted because of invalid state")&&(Y=null),Y!==null&&L(Y)}finally{o(),d(),x()}}),te.finished.finally(function(){for(var Y=0;Y<he.length;Y++)he[Y].cancel();X.__reactViewTransition===te&&(X.__reactViewTransition=null),k()}),te}catch{return o(),d(),x(),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}:D({},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 $y(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 Qn(n){this._fragmentFiber=n,this._observers=this._eventListeners=null}Qn.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(Ky(p,n,s,l)===-1){var x=this,k=s;l!=null&&typeof l!="boolean"&&l.once===!0&&(k=function(L){x.removeEventListener(n,s,l),typeof s=="function"?s.call(this,L):s.handleEvent(L)}),o!==null&&(d=x.removeEventListener.bind(x,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,Zk,n,k,o)}this._eventListeners=p}};function Zk(n,s,l,o){return E(n).addEventListener(s,l,o),!1}Qn.prototype.removeEventListener=function(n,s,l){var o=this._eventListeners;if(o!==null&&(s=Ky(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,Jk,n,l,d),o.splice(s,1),p!==null&&p()}};function Jk(n,s,l,o){return E(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 Vy(n){return n==null?"c=0":typeof n=="boolean"?"c="+(n?"1":"0"):"c="+(n.capture?"1":"0")}function Ky(n,s,l,o){if(n.length===0)return-1;o=Vy(o);for(var d=0;d<n.length;d++){var p=n[d];if(p.type===s&&p.listener===l&&Vy(p.optionsOrUseCapture)===o)return d}return-1}Qn.prototype.dispatchEvent=function(n){var s=S(this._fragmentFiber);if(s===null)return!0;s=E(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)},Qn.prototype.focus=function(n){_(this._fragmentFiber.child,!0,Yy,n,void 0,void 0)};function Yy(n,s){return n.tag===6?!1:(n=E(n),hN(n,s))}Qn.prototype.focusLast=function(n){var s=[];_(this._fragmentFiber.child,!0,nf,s,void 0,void 0);for(var l=s.length-1;0<=l&&!Yy(s[l],n);l--);};function nf(n,s){return s.push(n),!1}Qn.prototype.blur=function(){var n=S(this._fragmentFiber);n!==null&&(n=E(n),n=Da(n).activeElement,n!==null&&_(this._fragmentFiber.child,!1,eN,n,void 0,void 0))};function eN(n,s){return n.tag===6?!1:(n=E(n),n===s||n.contains(s)?(s.blur(),!0):!1)}Qn.prototype.observeUsing=function(n){this._observers===null&&(this._observers=new Set),this._observers.add(n),_(this._fragmentFiber.child,!1,tN,n,void 0,void 0)};function tN(n,s){return n.tag===6||(n=E(n),s.observe(n)),!1}Qn.prototype.unobserveUsing=function(n){var s=this._observers;if(s!==null&&s.has(n)){s.delete(n),_(this._fragmentFiber.child,!1,nN,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 nN(n,s){return n.tag===6||(n=E(n),s.unobserve(n)),!1}var wi=[],sf=!1;function iN(n,s,l){wi.push({fragmentInstance:n,observer:s,instance:l}),sf||(sf=!0,dN(function(){sf=!1;var o=wi;wi=[];for(var d=0;d<o.length;d++){var p=o[d];p.observer.unobserve(p.instance)}}))}Qn.prototype.getClientRects=function(){var n=[];return _(this._fragmentFiber.child,!1,sN,n,void 0,void 0),n};function sN(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=E(n),s.push.apply(s,n.getClientRects());return!1}Qn.prototype.getRootNode=function(n){var s=S(this._fragmentFiber);return s===null?this:E(s).getRootNode(n)},Qn.prototype.compareDocumentPosition=function(n){var s=S(this._fragmentFiber);if(s===null)return Node.DOCUMENT_POSITION_DISCONNECTED;var l=[];_(this._fragmentFiber.child,!1,nf,l,void 0,void 0);var o=E(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=b(s)[1],l===null?d=Node.DOCUMENT_POSITION_PRECEDING:(n=E(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=E(l[0]),d=E(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 x=s.compareDocumentPosition(n),k=d.compareDocumentPosition(n),L=x&Node.DOCUMENT_POSITION_CONTAINED_BY||k&Node.DOCUMENT_POSITION_CONTAINED_BY;return k=o&&p&&x&Node.DOCUMENT_POSITION_FOLLOWING&&k&Node.DOCUMENT_POSITION_PRECEDING,s=o&&s===n||p&&d===n||L||k?Node.DOCUMENT_POSITION_CONTAINED_BY:!o&&s===n||!p&&d===n?Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC:x,s&Node.DOCUMENT_POSITION_DISCONNECTED||s&Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC||rN(s,this._fragmentFiber,l[0],l[l.length-1],n)?s:Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC};function rN(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=z(l,p,q),s===null?s=!1:(_(s,!0,R,p,l),p=N,N=null,s=p!==null)),s):n&Node.DOCUMENT_POSITION_FOLLOWING?((s=!!p)&&!(s=p===o)&&(s=z(o,p,q),s===null?s=!1:(_(s,!0,B,p,o),p=N,A=N=null,s=p!==null)),s):!1}function Wy(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)}Qn.prototype.scrollIntoView=function(n){if(typeof n=="object")throw Error(r(566));var s=[];_(this._fragmentFiber.child,!1,nf,s,void 0,void 0);var l=n!==!1;if(s.length===0){var o=b(this._fragmentFiber);if(o=l?o[1]||o[0]||S(this._fragmentFiber):o[0]||o[1],o===null)return;if(o.tag===6){n=E(o),Wy(n,l);return}if(o=E(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=E(d),Wy(d,l)):E(d).scrollIntoView(n),o+=l?-1:1}};function lN(n,s){return n=E(n),Xy(n,s),!1}function Xy(n,s){n.reactFragments==null&&(n.reactFragments=new Set),n.reactFragments.add(s)}function Gy(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 x=0,k=0;k<wi.length;k++){var L=wi[k];(L.fragmentInstance!==s||L.observer!==p||L.instance!==n)&&(wi[x++]=L)}wi.length=x,p.observe(n)}),Xy(n,s))}function aN(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"?iN(s,p,n):p.unobserve(n)}),n.reactFragments!=null&&n.reactFragments.delete(s))}function rf(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":rf(l),jo(l);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(l.rel.toLowerCase()==="stylesheet")continue}n.removeChild(l)}}function oN(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 cN(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 Qy(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 lf(n){return n.data==="$?"||n.data==="$~"}function af(n){return n.data==="$!"||n.data==="$?"&&n.ownerDocument.readyState!=="loading"}function uN(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 of=null;function Zy(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 Jy(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 hN(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 dN(n){Iy(function(){Iy(function(s){return n(s)})})}function e0(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 t0(n,s,l){for(var o in l){var d=l[o];l.hasOwnProperty(o)&&d!=null&&yt(n,s,o,null,Pk,d)}l.dangerouslySetInnerHTML!=null&&(n.textContent=""),n.onclick===Ei&&(n.onclick=null),jo(n)}function cf(n){for(var s=n.attributes;s.length;)n.removeAttributeNode(s[0]);jo(n)}var hi=new Map,n0=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=be.d;be.d={f:fN,r:mN,D:pN,C:gN,L:_N,m:vN,X:SN,S:yN,M:bN};function fN(){var n=os.f(),s=Mc();return n||s}function mN(n){var s=Ur(n);s!==null&&s.tag===5&&s.type==="form"?sv(s):os.r(n)}var xl=typeof document>"u"?null:document;function i0(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+'"]'),n0.has(d)||(n0.add(d),n={rel:n,crossOrigin:l,href:s},o.querySelector(d)===null&&(s=o.createElement("link"),_n(s,"link",n),tn(s),o.head.appendChild(s)))}}function pN(n){os.D(n),i0("dns-prefetch",n,null)}function gN(n,s){os.C(n,s),i0("preconnect",n,s)}function _N(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=D({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 x=o.createElement("link");_n(x,"link",n),s==="style"&&(x[Eo]=!0,x.onload=x.onerror=function(){gg(x)}),tn(x),o.head.appendChild(x)}}}function vN(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=D({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"),_n(o,"link",n),tn(o),l.head.appendChild(o)}}}function yN(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 x=d.get(p);if(!x){var k={loading:0,preload:null};if(x=o.querySelector(Aa(p)))k.loading=5;else{n=D({rel:"stylesheet",href:n,"data-precedence":s},l),(l=hi.get(p))&&uf(n,l);var L=x=o.createElement("link");tn(L),_n(L,"link",n),L._p=new Promise(function(X,te){L.onload=X,L.onerror=te}),L.addEventListener("load",function(){k.loading|=1}),L.addEventListener("error",function(){k.loading|=2}),k.loading|=4,Hc(x,s,o)}x={type:"stylesheet",instance:x,count:1,state:k},d.set(p,x)}}}function SN(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=D({src:n,async:!0},s),(s=hi.get(d))&&hf(n,s),p=l.createElement("script"),tn(p),_n(p,"link",n),l.head.appendChild(p)),p={type:"script",instance:p,count:1,state:null},o.set(d,p))}}function bN(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=D({src:n,async:!0,type:"module"},s),(s=hi.get(d))&&hf(n,s),p=l.createElement("script"),tn(p),_n(p,"link",n),l.head.appendChild(p)),p={type:"script",instance:p,count:1,state:null},o.set(d,p))}}function s0(n,s,l,o){var d=(d=ut.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,x=p.get(n);if(x||(d=d.ownerDocument||d,x={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},p.set(n,x),(p=d.querySelector(Aa(n)))?p._p||(x.instance=p,x.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)),xN(d,n,p,x.state))),s&&o===null)throw Error(r(528,""));return x}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 r0(n){return D({},n,{"data-precedence":n.precedence,precedence:null})}function xN(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=gg.bind(null,s),_n(s,"link",l),tn(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 l0(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,tn(o),o;var d=D({},l,{"data-href":l.href,"data-precedence":l.precedence,href:null,precedence:null});return o=(n.ownerDocument||n).createElement("style"),tn(o),_n(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,tn(p),p;o=r0(l),(d=hi.get(d))&&uf(o,d),p=(n.ownerDocument||n).createElement("link"),tn(p);var x=p;return x._p=new Promise(function(k,L){x.onload=k,x.onerror=L}),_n(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,tn(d),d):(o=l,(d=hi.get(p))&&(o=D({},l),hf(o,d)),n=n.ownerDocument||n,d=n.createElement("script"),tn(d),_n(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,x=0;x<o.length;x++){var k=o[x];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 uf(n,s){n.crossOrigin==null&&(n.crossOrigin=s.crossOrigin),n.referrerPolicy==null&&(n.referrerPolicy=s.referrerPolicy),n.title==null&&(n.title=s.title)}function hf(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 a0(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[dn]||n==="link"&&p.getAttribute("rel")==="stylesheet")&&p.namespaceURI!=="http://www.w3.org/2000/svg"){var x=p.getAttribute(s)||"";x=n+x;var k=o.get(x);k?k.push(p):o.set(x,[p])}}return o}function df(n,s,l){n=n.ownerDocument||n,n.head.insertBefore(l,s==="title"?n.querySelector("head > title"):null)}function wN(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 o0(n,s){return n==="img"&&s.src!=null&&s.src!==""&&s.onLoad==null&&s.loading!=="lazy"}function c0(n){return!(n.type==="stylesheet"&&(n.state.loading&3)===0)}function u0(n){return(n.width||100)*(n.height||100)*(typeof devicePixelRatio=="number"?devicePixelRatio:1)*.25}function h0(n,s){typeof s.decode=="function"&&(n.imgCount++,s.complete||(n.imgBytes+=u0(s),n.suspenseyImages.push(s)),n=NN.bind(n),s.decode().then(n,n))}function CN(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,tn(p);return}p=s.ownerDocument||s,o=r0(o),(d=hi.get(d))&&uf(o,d),p=p.createElement("link"),tn(p);var x=p;x._p=new Promise(function(k,L){x.onload=k,x.onerror=L}),_n(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 kN(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*Fk());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 d0(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--,d0(this)}function NN(){this.imgCount--,d0(this)}var Pc=null;function qc(n,s){n.stylesheets=null,n.unsuspend!==null&&(n.count++,Pc=new Map,s.forEach(EN,n),Pc=null,Oa.call(n))}function EN(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 x=d[p];(x.nodeName==="LINK"||x.getAttribute("media")!=="not all")&&(l.set(x.dataset.precedence,x),o=x)}o&&l.set(null,o)}d=s.instance,x=d.getAttribute("data-precedence"),p=l.get(x)||o,p===o&&l.set(null,d),l.set(x,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:Ae,_currentValue2:Ae,_threadCount:0};function jN(n,s,l,o,d,p,x,k,L){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=Vu(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Vu(0),this.hiddenUpdates=Vu(null),this.identifierPrefix=o,this.onUncaughtError=d,this.onCaughtError=p,this.onRecoverableError=x,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=L,this.transitionTypes=null,this.incompleteTransitions=new Map}function f0(n,s,l,o,d,p,x,k,L,X,te,he){return n=new jN(n,s,l,x,L,X,te,he,k),s=1,p===!0&&(s|=24),p=Bn(3,null,null,s),n.current=p,p.stateNode=n,s=Nh(),s.refCount++,n.pooledCache=s,s.refCount++,p.memoizedState={element:o,isDehydrated:l,cache:s},Dh(p),n}function m0(n){return n?(n=Qr,n):Qr}function p0(n,s,l,o,d,p){d=m0(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&&(In(l,n,s),ha(l,n,s))}function g0(n,s){if(n=n.memoizedState,n!==null&&n.dehydrated!==null){var l=n.retryLane;n.retryLane=l!==0&&l<s?l:s}}function ff(n,s){g0(n,s),(n=n.alternate)&&g0(n,s)}function _0(n){if(n.tag===13||n.tag===31){var s=nr(n,67108864);s!==null&&In(s,n,67108864),ff(n,67108864)}}function v0(n){if(n.tag===13||n.tag===31){var s=Gn();s=Ku(s);var l=nr(n,s);l!==null&&In(l,n,s),ff(n,s)}}var Nl=!0;function TN(n,s,l,o){var d=de.T;de.T=null;var p=be.p;try{be.p=2,mf(n,s,l,o)}finally{be.p=p,de.T=d}}function DN(n,s,l,o){var d=de.T;de.T=null;var p=be.p;try{be.p=8,mf(n,s,l,o)}finally{be.p=p,de.T=d}}function mf(n,s,l,o){if(Nl){var d=pf(o);if(d===null)Wd(n,s,o,Fc,l),S0(n,o);else if(AN(d,n,s,l,o))o.stopPropagation();else if(S0(n,o),s&4&&-1<MN.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 x=Qs(p.pendingLanes);if(x!==0){var k=p;for(k.pendingLanes|=2,k.entangledLanes|=2;x;){var L=1<<31-hn(x);k.entanglements[1]|=L,x&=~L}zi(p),(ft&6)===0&&(jc=qt()+500,Ea(0))}}break;case 31:case 13:k=nr(p,2),k!==null&&In(k,p,2),Mc(),ff(p,2)}if(p=pf(o),p===null&&Wd(n,s,o,Fc,l),p===d)break;d=p}d!==null&&o.stopPropagation()}else Wd(n,s,o,null,l)}}function pf(n){return n=Ju(n),gf(n)}var Fc=null;function gf(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 y0(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(en()){case _i:return 2;case kn:return 8;case Hr:case ue:return 32;case Re:return 268435456;default:return 32}default:return 32}}var _f=!1,Ls=null,zs=null,Hs=null,Ba=new Map,La=new Map,Is=[],MN="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 S0(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&&_0(s)),n):(n.eventSystemFlags|=o,s=n.targetContainers,d!==null&&s.indexOf(d)===-1&&s.push(d),n)}function AN(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 b0(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,fg(n.priority,function(){v0(l)});return}}else if(s===31){if(s=f(l),s!==null){n.blockedOn=s,fg(n.priority,function(){v0(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=pf(n.nativeEvent);if(l===null){l=n.nativeEvent;var o=new l.constructor(l.type,l);Zu=o,l.target.dispatchEvent(o),Zu=null}else return s=Ur(l),s!==null&&_0(s),n.blockedOn=l,!1;s.shift()}return!0}function x0(n,s,l){$c(n)&&l.delete(s)}function RN(){_f=!1,Ls!==null&&$c(Ls)&&(Ls=null),zs!==null&&$c(zs)&&(zs=null),Hs!==null&&$c(Hs)&&(Hs=null),Ba.forEach(x0),La.forEach(x0)}function Vc(n,s){n.blockedOn===s&&(n.blockedOn=null,_f||(_f=!0,e.unstable_scheduleCallback(e.unstable_NormalPriority,RN)))}var Kc=null;function w0(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(gf(o||l)===null)continue;break}var p=Ur(l);p!==null&&(n.splice(s,3),s-=3,Qh(p,{pending:!0,data:d,method:l.method,action:o},o,d))}}))}function El(n){function s(L){return Vc(L,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);)b0(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],x=d[On]||null;if(typeof p=="function")x||w0(l);else if(x){var k=null;if(p&&p.hasAttribute("formAction")){if(d=p,x=p[On]||null)k=x.formAction;else if(gf(d)!==null)continue}else k=x.action;typeof k=="function"?l[o+1]=k:(l.splice(o,3),o-=3),w0(l)}}}function C0(){function n(p){p.canIntercept&&p.info==="react-transition"&&p.intercept({handler:function(){return new Promise(function(x){return d=x})},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 vf(n){this._internalRoot=n}Yc.prototype.render=vf.prototype.render=function(n){var s=this._internalRoot;if(s===null)throw Error(r(409));var l=s.current,o=Gn();p0(l,o,n,s,null,null)},Yc.prototype.unmount=vf.prototype.unmount=function(){var n=this._internalRoot;if(n!==null){this._internalRoot=null;var s=n.containerInfo;p0(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=dg();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&&b0(n)}};var k0=t.version;if(k0!=="19.3.1")throw Error(r(527,k0,"19.3.1"));be.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 ON={bundleType:0,version:"19.3.1",rendererPackageName:"react-dom",currentDispatcherRef:de,reconcilerVersion:"19.3.1"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Wc=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Wc.isDisabled&&Wc.supportsFiber)try{Nn=Wc.inject(ON),Ie=Wc}catch{}}return Ia.createRoot=function(n,s){if(!a(n))throw Error(r(299));var l=!1,o="",d=mv,p=pv,x=gv;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&&(x=s.onRecoverableError)),s=f0(n,1,!1,null,null,l,o,null,d,p,x,C0),n[Ir]=s.current,Yd(n),new vf(s)},Ia.hydrateRoot=function(n,s,l){if(!a(n))throw Error(r(299));var o=!1,d="",p=mv,x=pv,k=gv,L=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&&(x=l.onCaughtError),l.onRecoverableError!==void 0&&(k=l.onRecoverableError),l.formState!==void 0&&(L=l.formState)),s=f0(n,1,!0,s,l??null,o,d,L,p,x,k,C0),s.context=m0(null),l=s.current,o=Gn(),o=Ku(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,Yd(n),new Yc(s)},Ia.version="19.3.1",Ia}var B0;function YN(){if(B0)return bf.exports;B0=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(),bf.exports=KN(),bf.exports}var WN=YN();async function Oe(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 Ye=e=>({method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(e)});function XN(e={}){return Oe(`/sessions?grouped=1${e.archived===!0?"&archived=1":""}`)}function GN(e,t){return Oe("/sessions/rename",Ye({session:e,title:t}))}function QN(e){return Oe("/sessions/delete",Ye({session:e}))}function ZN(e){return Oe("/sessions/order",Ye({names:e}))}function lx(e,t){return Oe("/sessions/archive",Ye({session:e,archived:t}))}function JN(e,t){return Oe("/sessions/labels",Ye({session:e,labels:t}))}function L0(e,t){return Oe("/sessions/fork",Ye({session:e,at:t}))}function e2(e){return Oe(`/sessions/anchors?session=${encodeURIComponent(e)}`)}function z0(e){return Oe(`/files?path=${encodeURIComponent(e)}`)}function t2(e,t={}){const i=t.offset??1,r=t.limit??400;return Oe(`/file?path=${encodeURIComponent(e)}&offset=${String(i)}&limit=${String(r)}`)}function n2(e){return Oe(`/file-version?path=${encodeURIComponent(e)}`)}function ax(e){return Oe("/open-external",Ye(e))}function ox(){return Oe("/git")}function i2(e){return Oe(`/git/diff?path=${encodeURIComponent(e)}`)}function s2(){return Oe("/terminals")}function r2(){return Oe("/terminal",Ye({}))}function l2(e){return Oe("/terminal/close",Ye({id:e}))}function cx(e,t){return Oe("/terminal/send",Ye({id:e,text:t,raw:!0}))}function H0(e,t,i){return Oe("/terminal/resize",Ye({id:e,cols:t,rows:i}))}function a2(e,t){return`/terminal/events?id=${encodeURIComponent(e)}&raw=1`}function o2(e){return Oe(`/thread?session=${encodeURIComponent(e)}`)}function c2(e){return Oe(`/turn-changes?session=${encodeURIComponent(e)}`)}function u2(e,t){return Oe("/turn-undo",Ye({session:e,key:t}))}function ux(e){return Oe(`/running?session=${encodeURIComponent(e)}`)}function h2(e){return Oe("/interrupt",Ye({session:e}))}function d2(e,t){return Oe("/answer",Ye({session:e,...t}))}function f2(){return Oe("/settings")}function m2(e){return Oe("/settings",Ye(e))}function p2(){return Oe("/provider")}function Ua(e){return Oe("/provider",Ye(e))}function I0(e){return Oe("/provider/test",Ye(e))}function mm(e){const t=e===void 0?"":`?session=${encodeURIComponent(e)}`;return Oe(`/models${t}`)}function hx(e,t){return Oe("/session-model",Ye(t===void 0?{model:e}:{session:t,model:e}))}function g2(e,t){return Oe("/session-profile",Ye({session:e,profile:t}))}function _2(e){return Oe(`/trajectory?session=${encodeURIComponent(e)}`)}function v2(e,t,i){return Oe(`/page?session=${encodeURIComponent(e)}&from=${String(t)}&limit=${String(i)}`)}function dx(){return Oe("/plugins")}function y2(e,t){return Oe("/plugins/toggle",Ye({id:e,enabled:t}))}function S2(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"),Oe(`/team?${i.toString()}`)}function U0(e){return Oe("/workspace",Ye({path:e}))}function b2(e,t,i){return Oe("/team/claim",Ye({session:e,taskId:t,expectedRevision:i}))}function x2(){return Oe("/subagents")}function w2(e){return Oe("/subagents/stop",Ye({agentId:e}))}function C2(){return Oe("/tasks")}function k2(e){return Oe("/task-stop",Ye({taskId:e}))}function N2(){return Oe("/tasks/clear",Ye({}))}function hu(e,t,i,r,a){return Oe("/chat",Ye({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 bp(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 E2(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 j2(e,t){const i=e.filter(r=>r.seq<t).map(r=>r.seq);return i.length===0?1:Math.max(...i)}function T2(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 D2({items:e,onClose:t}){const[i,r]=C.useState(""),[a,c]=C.useState(0),h=C.useRef(null),f=C.useMemo(()=>T2(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 Oe("/goal",Ye({session:e,op:t,...i===void 0?{}:{objective:i}}))}function M2(e,t){return Oe("/plan-mode",Ye({session:e,active:t}))}function A2(e){return Oe(`/refs?query=${encodeURIComponent(e)}`)}function R2(e,t,i){return Oe("/queue",Ye({session:e,op:"add",content:t}))}function O2(e,t,i){return Oe("/queue",Ye({session:e,op:"edit",id:t,content:i}))}function B2(e,t){return Oe("/queue",Ye({session:e,op:"remove",id:t}))}function F0(e,t,i){return Oe("/queue",Ye({session:e,op:"steer",id:t,placement:i}))}const L2=4e3;function z2(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),b=C.useCallback(async w=>{const E=_.current,N=w?.silent===!0;try{const[A,R,B]=await Promise.allSettled([E===null?Promise.resolve(null):S2(E,S.current),x2(),C2()]);if(!y.current||_.current!==E)return;A.status==="fulfilled"&&i(A.value),R.status==="fulfilled"&&a(R.value.agents),B.status==="fulfilled"&&h(B.value.tasks);const q=[A,R,B].find(z=>z.status==="rejected");if(g(q===void 0?null:q.reason instanceof Error?q.reason.message:String(q.reason)),N)return}catch(A){if(!y.current)return;g(A instanceof Error?A.message:String(A))}},[]);return C.useEffect(()=>(y.current=!0,()=>{y.current=!1}),[]),C.useEffect(()=>{i(null),g(null),b()},[e,b]),C.useEffect(()=>{b({silent:!0})},[m,b]),C.useEffect(()=>{if(e===null)return;const w=setInterval(()=>{b({silent:!0})},L2);return()=>{clearInterval(w)}},[e,b]),{team:t,agents:r,jobs:c,error:f,reload:b,filter:m,setFilter:v}}const H2={low:"低风险",medium:"中风险",high:"高风险",critical:"极高风险"};function I2(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 U2({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=I2(e.input),b=e.permissionOptions??[],w=N=>{v(!0),i({id:e.id,...N}).finally(()=>{v(!1)})},E=()=>{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:H2[_]??_}),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:E,children:"提交改后的输入"})]})]}):u.jsx("div",{className:"a",children:b.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:"允许执行"})]}):b.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 P2({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(b=>b!==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 q2({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 fx(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 pm(e){switch(e.status){case"running":return"run";case"provisioning":return"prov";case"failed":return"fail";case"idle":case"released":return"idle"}}function mx(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 px(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 gx(e){let t=0;for(const i of e)i.taskStatus==="running"&&(t+=1);return{running:t,finished:e.length-t}}function F2(e){switch(e){case"all":return"全部";case"pending":return"待认领";case"in_progress":return"进行中";case"completed":return"已完成"}}function $2(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 V2(e,t){return e.filter(i=>i.taskId===t||i.otherTaskId===t)}function K2(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 kf(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 Y2(e){return{name:"lead",id:"lead",description:"当前会话 · 决策与合议",context:"fresh",kind:"temp",phase:"active",status:e?"running":"idle",unread:0}}function W2(e){return e.status==="pending"&&e.ready}function Y0(e){return e.trim()===""?"(空命令)":e}function X2({team:e,agents:t,jobs:i,open:r,onOpen:a}){const c=mx(e?.members??[]),h=px(t).running,f=gx(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 Su({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 G2({kind:e,panel:t,session:i,onClose:r,onOpenMember:a}){return e==="agents"?u.jsx(Z2,{panel:t,onClose:r}):e==="jobs"?u.jsx(J2,{panel:t,onClose:r}):u.jsx(Q2,{panel:t,session:i,onClose:r,onOpenMember:a})}function Q2({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(Su,{title:"智能体团队",onClose:i,children:u.jsx("div",{className:"tp-empty",children:"还没有团队读数(会话未选中或读取失败)。"})});const y=Y2(a.running),b=mx(a.members),w=A=>{h(A),e.setFilter(A==="all"?{}:{status:A})},E=A=>{g(R=>{const B=new Set(R);return B.has(A)?B.delete(A):B.add(A),B})},N=async A=>{S(null),v(A.id);try{await b2(t,A.id,A.revision)}catch(R){const B=R instanceof Error?R.message:String(R);S(B.includes("revision 过期")?"这张任务刚被改过(revision 过期):读数已刷新,请再试一次。":B)}finally{v(null),await e.reload({silent:!0})}};return u.jsxs(Su,{title:"成员",count:a.members.length+1,wide:!0,facts:u.jsxs(u.Fragment,{children:[u.jsxs("span",{children:["运行中 ",b.running+(a.running?1:0)]}),u.jsx("span",{className:"sep",children:"·"}),u.jsxs("span",{children:["空闲 ",b.idle+(a.running?0:1)]}),u.jsx("span",{className:"sep",children:"·"}),u.jsxs("span",{children:["启动中 ",b.provisioning]}),u.jsx("span",{className:"sep",children:"·"}),u.jsxs("span",{children:["失败 ",b.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 ${pm(y)}`}),$0(y)," · 当前会话"]})]})]}),a.members.map(A=>u.jsxs("div",{className:`tp-member${A.status==="failed"?" failed":""}${A.status==="provisioning"?" provisioning":""}${A.status==="running"?" running":""}`,children:[u.jsx("div",{className:"tp-ava",children:(A.status==="running","◌")}),u.jsxs("div",{className:"tp-m-main",children:[u.jsxs("div",{className:"tp-m-name",children:[u.jsx("span",{className:"nm",children:A.name}),u.jsx("span",{className:`tp-badge${A.kind==="seat"?" seat":""}`,children:A.kind==="seat"?"席位":"临时"}),A.unread>0?u.jsx("span",{className:"tp-badge unread",children:A.unread}):null]}),u.jsx("div",{className:"tp-m-desc",children:A.description}),u.jsxs("div",{className:"tp-m-status",children:[u.jsx("span",{className:`st-dot ${pm(A)}`}),A.status==="failed"&&A.error!==void 0?u.jsxs(u.Fragment,{children:["失败 ",u.jsxs("span",{className:"why",children:["· ",A.error]})]}):A.status==="idle"?"空闲 · 可唤醒":$0(A)]})]}),r===void 0?null:u.jsx("button",{className:"tp-talk",type:"button",title:A.status==="failed"||A.status==="provisioning"?"成员不可对话(失败/启动中)":"打开子会话并给它发消息",disabled:A.status==="failed"||A.status==="provisioning",onClick:()=>{r(A.name)},children:"对话"})]},A.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(A=>u.jsxs("button",{className:`fc${c===A?" on":""}`,onClick:()=>{w(A)},children:[F2(A)," ",$2(a.counts,A)]},A))})]}),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(A=>{const R=V2(a.warnings,A.id),B=f.has(A.id);return u.jsxs("div",{className:`tp-tcard${B?" open":""}`,children:[u.jsxs("div",{className:"tp-trow1",children:[u.jsx("span",{className:`st-dot ${V0(A)}`}),u.jsx("span",{className:"subj",title:A.subject,children:A.subject}),u.jsxs("span",{className:`tp-tstat${A.status==="completed"?" done":A.status==="in_progress"?" prog":" todo"}`,children:[u.jsx("span",{className:`st-dot ${V0(A)}`}),K2(A)]})]}),A.description===""?null:u.jsx("div",{className:"tp-tdesc",children:A.description}),u.jsxs("div",{className:"tp-tfoot",children:[u.jsx("span",{className:"tid",children:A.id}),u.jsx("span",{children:"·"}),u.jsx("span",{className:"who",children:A.ownerName===void 0?"Owner 未认领":`Owner ${A.ownerName}`}),A.writeScopes.length===0?null:u.jsxs(u.Fragment,{children:[u.jsx("span",{children:"·"}),u.jsxs("span",{className:"scope",children:["写入范围 ",A.writeScopes.join(" ")]})]}),W2(A)?u.jsx("button",{className:"tp-claim",disabled:a.running||m!==null,title:a.running?"会话在跑:等这一轮结束再认领(任务板同时只许一个写者)":"认领给当前会话(lead)",onClick:()=>{N(A)},children:m===A.id?"认领中…":"认领"}):null,u.jsx("button",{className:"expand",onClick:()=>{E(A.id)},children:B?"收起 ▴":"展开 ▾"})]}),B?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 ",A.revision]}),"(CAS:认领/改状态要带这版,spec 决策 21)"]})]}),u.jsxs("div",{className:"tp-drow",children:[u.jsx("span",{className:"dk",children:"阻塞"}),u.jsxs("span",{className:"dv",children:[A.blockedBy.length===0?"无":A.blockedBy.join("、"),A.ready?"":"(未完成,暂不可认领)"]})]}),u.jsxs("div",{className:"tp-drow",children:[u.jsx("span",{className:"dk",children:"写入范围"}),u.jsx("span",{className:"dv",children:A.writeScopes.length===0?"未声明":A.writeScopes.map(q=>u.jsx("span",{className:"tp-scope-chip",children:q},q))})]}),A.obligations.length===0?null:u.jsxs("div",{className:"tp-drow",children:[u.jsx("span",{className:"dk",children:"核验义务"}),u.jsx("span",{className:"dv",children:A.obligations.map(q=>u.jsx("span",{className:"tp-scope-chip",children:q},q))})]}),R.map(q=>{const z=q.taskId===A.id?q.otherTaskId:q.taskId;return u.jsxs("div",{className:"tp-scope-warn",children:[u.jsx("span",{className:"w",children:"⚠"}),u.jsxs("span",{children:["与 ",u.jsx("b",{children:z})," 的写入范围重叠(",q.a," 与 ",q.b,")——只提醒不阻塞,spec 决策 16。"]})]},`${q.taskId}:${q.otherTaskId}:${q.a}:${q.b}`)})]}):null]},A.id)}),a.tasks.hasMore?u.jsxs("div",{className:"tp-more",children:["还有 ",a.tasks.total-a.tasks.tasks.length," 条(筛选/分页由服务端算)"]}):null]})}function Z2({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=px(e.agents),m=async v=>{c(null),r(v.agentId);try{await w2(v.agentId)}catch(_){c(_ instanceof Error?_.message:String(_))}finally{r(null),await e.reload({silent:!0})}};return u.jsxs(Su,{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 ${pm({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:kf(v),children:kf(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:fx(y)}),_?u.jsx("button",{className:"tp-stop-btn",title:"停止这只子智能体","aria-label":`停止 ${kf(v)}`,disabled:i!==null,onClick:()=>{m(v)},children:i===v.agentId?"◌":"■"}):null]})]},v.agentId)})]})}function J2({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 R=setInterval(()=>{y(Date.now())},1e3);return()=>{clearInterval(R)}},[]);const b=gx(e.jobs),w=i?e.jobs:e.jobs.filter(R=>R.taskStatus==="running"),E=R=>{c(B=>{const q=new Set(B);return q.has(R)?q.delete(R):q.add(R),q})},N=async R=>{_(null),f(R.taskId);try{await k2(R.taskId)}catch(B){_(B instanceof Error?B.message:String(B))}finally{f(null),await e.reload({silent:!0})}},A=async()=>{_(null),m(!0);try{await N2()}catch(R){_(R instanceof Error?R.message:String(R))}finally{m(!1),await e.reload({silent:!0})}};return u.jsxs(Su,{title:"后台任务",facts:u.jsxs(u.Fragment,{children:[u.jsxs("span",{children:[b.running," 个运行中"]}),u.jsx("span",{className:"sep",children:"·"}),u.jsxs("span",{children:["已结束 ",b.finished]})]}),onClose:t,foot:u.jsxs(u.Fragment,{children:[u.jsx("button",{className:i?"on":"",onClick:()=>{r(R=>!R)},children:i?"只看运行中":`查看已结束 ${b.finished}`}),u.jsx("button",{className:"go",disabled:b.finished===0||g,title:b.finished===0?"没有已结束的任务":"清掉已结束条目(运行中的不动)",onClick:()=>{A()},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(R=>{const B=R.taskStatus==="running",q=Date.parse(R.startedAt),z=B&&Number.isFinite(q)?S-q:void 0,D=a.has(R.taskId);return u.jsxs("div",{className:"tp-jrow",children:[u.jsx("span",{className:`st-dot ${B?"run":R.taskStatus==="failed"?"fail":(R.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(R.command),children:Y0(R.command)})]}),u.jsxs("div",{className:"tp-j-sub",children:[u.jsx("span",{children:R.taskId}),u.jsx("span",{className:"sep",children:"·"}),u.jsx("span",{children:B?`已运行 ${fx(z??0)}`:R.statusText}),R.exitCode===void 0?null:u.jsxs(u.Fragment,{children:[u.jsx("span",{className:"sep",children:"·"}),u.jsxs("span",{children:["exit ",R.exitCode]})]}),R.truncated===!0?u.jsxs(u.Fragment,{children:[u.jsx("span",{className:"sep",children:"·"}),u.jsx("span",{children:"输出被截断"})]}):null]}),D?u.jsx("pre",{className:"tp-out",children:R.outputTail===""?"(无输出)":R.outputTail}):null]}),u.jsxs("div",{className:"tp-s-right",children:[u.jsx("span",{className:`tp-s-status${B?" run":R.taskStatus==="failed"?" fail":R.taskStatus==="completed"?" done":""}`,children:R.statusText}),u.jsx("button",{className:"tp-caret-btn",title:D?"收起输出":"展开输出",onClick:()=>{E(R.taskId)},children:D?"▴":"▾"}),B?u.jsx("button",{className:"tp-stop-btn",title:"停止这条后台任务","aria-label":`停止 ${R.taskId}`,disabled:h!==null,onClick:()=>{N(R)},children:h===R.taskId?"◌":"■"}):null]})]},R.taskId)})]})}const eE=[{icon:"◇",title:"摸清这个仓库",desc:"先看 spec 和目录结构,给我一张地图",prompt:"先带我把这个仓库摸一遍:spec 和目录结构各有什么,给我一张地图。"},{icon:"✓",title:"把 check 跑绿",desc:"typecheck + 静态闸 + vitest,红了就修",prompt:"把 npm run check 跑一遍,红了的修到全绿,把每一步的证据贴给我。"},{icon:"↳",title:"审阅未提交的改动",desc:"逐文件说风险,判断要不要拆",prompt:"审阅一下当前未提交的改动:逐个文件说做了什么、风险在哪、该不该拆。"},{icon:"▤",title:"改主页面原型",desc:"布局 / 配色 / 交互,你提我改",prompt:"按刚才的原型改主页面:三栏比例、目标条、输入卡,哪里不对你说。"}],tE=[{name:"/model",desc:"换模型(可跨供应商)",scope:"本会话"},{name:"/compact",desc:"压缩上下文",scope:"本会话"},{name:"/goal",desc:"设定目标并持续追踪",scope:"目标"},{name:"/review",desc:"审阅当前改动",scope:"技能"}];function nE(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 iE(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 bu(e){return e.kind==="directory"?`${e.path}/`:e.path}const sE=e=>e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");function rE(e,t){return new RegExp(`(^|\\s)@${sE(t)}(?=\\s|$)`).test(e)}function W0(e,t){const i=e.trim(),r=new Set,c=t.filter(h=>{const f=bu(h);return r.has(f)||rE(i,f)?!1:(r.add(f),!0)}).map(h=>`@${bu(h)}`).join(" ");return c===""?i:i===""?c:`${i}
10
+
11
+ ${c}`}function lE(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 aE(e){return Oe("/shell",Ye({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 oE(){return G0+=1,`att-${String(G0)}`}function cE(e){return Oe(`/upload?name=${encodeURIComponent(e.name)}`,{method:"POST",headers:{"content-type":"application/octet-stream"},body:e})}function uE(e){return e<1024?`${String(e)} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/1024/1024).toFixed(1)} MB`}function hE(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||Ou(r)||t.has(r.result.path)||(t.add(r.result.path),i.push({path:r.result.path,kind:"file"}));return i}function gm(e){const t=new Set,i=[];for(const r of e)r.state!=="ok"||r.result===void 0||!Ou(r)||t.has(r.result.path)||(t.add(r.result.path),i.push({path:r.result.path}));return i}function dE(e){const t=gm(e).length;return t===0?"":Array.from({length:t},(i,r)=>`[图片 #${String(r+1)}]`).join(" ")}function fE(e,t,i){return i.some(r=>r.state!=="ok")?!1:e.trim()!==""||t.length>0||i.length>0}const mE=/\.(?:png|jpe?g|gif|webp|avif|bmp|heic|heif)$/iu;function Ou(e){const t=e.mediaType?.trim().toLowerCase()??"";return t!==""?t.startsWith("image/"):mE.test(e.name)}function pE(e){return e.some(Ou)}function Z0(e,t){return t!==!1?null:pE(e)?"本模型不支持图片":null}function gE({label:e}){const t=nE(e),i=iE(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 _x=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:b=!1,onTogglePlan:w},E){const N=C.useRef(null),A=C.useRef(null),R=C.useRef(null),B=C.useRef(null),q=C.useCallback(()=>{ae(!1)},[]),z=C.useCallback(()=>{Ce(!1)},[]),D=C.useCallback(()=>{M(null)},[]),[$,ae]=C.useState(!1),[I,G]=C.useState(!1),F=C.useRef(null),O=C.useRef(null),[U,K]=C.useState([]),[V,se]=C.useState(null),[ee,ge]=C.useState(!1),[T,De]=C.useState([]),[me,M]=C.useState(null),[j,Z]=C.useState(0),[re,ie]=C.useState([]),[pe,ve]=C.useState(!1),[je,de]=C.useState(null),[be,Ae]=C.useState(!1),[st,oe]=C.useState(""),[_e,Ce]=C.useState(!1),[Ee,at]=C.useState(null),[We,ut]=C.useState(""),[Te,ze]=C.useState(null),[mt,Ot]=C.useState(!1),[jt,le]=C.useState(void 0),[Se,ne]=C.useState(null);C.useEffect(()=>{let ue=!1;return mm(S).then(Re=>{ue||(at(Re),oe(Re.current),le({name:Re.current,vision:Re.currentVision}))}).catch(()=>{ue||le(void 0)}),()=>{ue=!0}},[S]),C.useEffect(()=>{Z0(U,jt?.vision??null)===null&&ne(null)},[U,jt]),Qa({打开:$,关闭:q,容器:N}),Qa({打开:_e,关闭:z,容器:A}),Qa({打开:me?.kind==="mention",关闭:D,容器:R}),Qa({打开:me?.kind==="slash",关闭:D,容器:B});const H=()=>{F.current?.focus()},ye=ue=>{for(const Re of ue){const tt=oE();K(pt=>[...pt,{id:tt,name:Re.name,state:"uploading",mediaType:Re.type}]),cE(Re).then(pt=>{K(Nn=>Nn.map(Ie=>Ie.id===tt?{...Ie,name:pt.name,state:"ok",result:pt}:Ie))}).catch(pt=>{K(Nn=>Nn.map(Ie=>Ie.id===tt?{...Ie,state:"failed",error:pt instanceof Error?pt.message:String(pt)}:Ie))})}};C.useImperativeHandle(E,()=>({addFiles:ye})),C.useEffect(()=>{const ue=F.current;ue!==null&&(ue.style.height="auto",ue.style.height=`${String(Math.min(ue.scrollHeight,220))}px`)},[t]);const ke=me?.kind==="mention"?re:[],Xe=me?.kind==="slash"?tE.filter(ue=>ue.name.includes(me.query)):[],ot=fE(t,T,U),et=U.filter(ue=>ue.state==="failed");C.useEffect(()=>{if(me?.kind!=="mention")return;const ue=me.query;let Re=!0;Ae(!0);const tt=setTimeout(()=>{A2(ue).then(pt=>{Re&&(ie(pt.candidates),ve(pt.truncated),de(null))}).catch(pt=>{Re&&(ie([]),ve(!1),de(pt instanceof Error?pt.message:String(pt)))}).finally(()=>{Re&&Ae(!1)})},120);return()=>{Re=!1,clearTimeout(tt)}},[me]);const ni=ue=>{const Re={path:ue.path,kind:ue.kind};De(tt=>tt.some(pt=>pt.path===Re.path)?tt:[...tt,Re]),i(t.replace(/@([^\s@]*)$/,"")),M(null),H()},Ni=ue=>{i(`${ue} `),M(null),H()},zr=ue=>{i(ue);const Re=/@([^\s@]*)$/.exec(ue);if(Re!==null){M({kind:"mention",query:Re[1]??""}),Z(0);return}if(ue.startsWith("/")&&!ue.includes(" ")){M({kind:"slash",query:ue.slice(1)}),Z(0);return}M(null)},qt=()=>{const ue=Z0(U,jt?.vision??null);return ue===null?!1:(ne({text:ue,hint:"换一个声明了图片输入的模型,或先把图片移除。"}),!0)},en=async ue=>{if(!(ue===st||mt)){Ot(!0),ze(null);try{await hx(ue,S);const Re=await mm(S);at(Re),oe(Re.current),le({name:Re.current,vision:Re.currentVision}),Ce(!1),ut("")}catch(Re){ze(Re instanceof Error?Re.message:String(Re))}finally{Ot(!1)}}},_i=async ue=>{const Re=ue.trimStart().slice(1).trim();if(Re===""){se(X0("","用法:`!<命令>`(例:`!git status`)"));return}ge(!0),se(null);try{se(await aE(Re)),i(""),De([])}catch(tt){se(X0(Re,tt instanceof Error?tt.message:String(tt)))}finally{ge(!1)}},kn=()=>{if(ee)return;if(t.trimStart().startsWith("!")){_i(t);return}if(qt())return;const ue=gm(U),Re=W0(t,[...T,...Q0(U)]);r(Re.trim()===""&&ue.length>0?dE(U):Re,ue.length===0?void 0:ue),De([]),K([])},Hr=ue=>{if(me!==null){const Re=me.kind==="mention"?ke:Xe;if(ue.key==="ArrowDown"){ue.preventDefault(),Z(tt=>Re.length===0?0:(tt+1)%Re.length);return}if(ue.key==="ArrowUp"){ue.preventDefault(),Z(tt=>Re.length===0?0:(tt-1+Re.length)%Re.length);return}if(ue.key==="Escape"){ue.preventDefault(),M(null);return}if(ue.key==="Enter"||ue.key==="Tab"&&me.kind==="slash"){if(Re.length===0)return;if(ue.preventDefault(),me.kind==="mention"){const tt=ke[j]??ke[0];tt!==void 0&&ni(tt)}else{const tt=Xe[j]??Xe[0];tt!==void 0&&Ni(tt.name)}return}}if(ue.key==="Enter"&&!ue.shiftKey&&(ue.metaKey||ue.ctrlKey)){ue.preventDefault(),m?.();return}if(ue.key==="Enter"&&!ue.shiftKey){if(ue.preventDefault(),h){if(qt())return;if(gm(U).length>0){ne({text:"运行中不能排队带图",hint:"等这一轮结束再发;或先把图片移除。"});return}if(bp(t)!==null){ne({text:"运行中不能改目标",hint:"等这一轮结束再发;或先停止当前回合。"});return}(t.trim()!==""||T.length>0||U.length>0)&&(g?.(W0(t,[...T,...Q0(U)])),De([]),K([]));return}ot&&kn()}};return u.jsxs("div",{className:c?"composer empty-composer":"composer",children:[T.length>0||U.length>0?u.jsxs("div",{className:"chips",children:[T.map(ue=>u.jsxs("span",{className:"att",children:[u.jsx("span",{className:"g",children:"@"}),u.jsx("span",{className:"att-path",children:bu(ue)}),u.jsx("button",{className:"x",title:"移除引用",onClick:()=>{De(Re=>Re.filter(tt=>tt.path!==ue.path))},children:"✕"})]},`ref-${ue.path}`)),U.map(ue=>{const Re=ue.result,tt=Re?.textLike??!0,pt=ue.state==="uploading"?" uploading":ue.state==="failed"?" failed":"";return u.jsxs("span",{className:`att${pt}`,title:Re?.path??ue.name,children:[Re!==void 0&&!Re.textLike?u.jsx("img",{className:"thumb",src:`/file/raw?path=${encodeURIComponent(Re.path)}`,alt:""}):u.jsx("span",{className:"g",children:"▤"}),u.jsx("span",{className:"att-name",children:ue.name}),Re===void 0?null:u.jsx("span",{className:"att-size",children:uE(Re.bytes)}),ue.state==="uploading"?u.jsx("span",{className:"att-tag muted",children:"上传中"}):ue.state==="failed"?u.jsx("span",{className:"att-tag bad",children:"失败"}):tt?u.jsx("span",{className:"att-tag ok",children:"可读"}):Ou(ue)?u.jsx("span",{className:"att-tag muted",children:"图片"}):u.jsx("span",{className:"att-tag warn",children:"非文本 · 只落盘"}),ue.state==="uploading"?u.jsx("span",{className:"spinner"}):null,u.jsx("button",{className:"x",title:"移除附件(只去掉本次输入里的引用;已上传的文件仍在 .daluo/uploads/,删除要走审批)",onClick:()=>{K(Nn=>Nn.filter(Ie=>Ie.id!==ue.id))},children:"✕"})]},ue.id)})]}):null,me?.kind==="mention"?u.jsxs("div",{className:"menu",ref:R,children:[u.jsxs("div",{className:"menu-head",children:[u.jsx("span",{children:"引用文件 · 工作区 daluo"}),u.jsx("span",{style:{marginLeft:"auto"},children:"↑↓ 选择 · Enter 插入 · Esc 关闭"})]}),ke.map((ue,Re)=>u.jsxs("button",{className:Re===j?"menu-item sel":"menu-item",onMouseDown:tt=>{tt.preventDefault(),ni(ue)},children:[u.jsx("span",{className:"g",children:ue.kind==="directory"?"◻":"▤"}),u.jsx("span",{className:"path",children:bu(ue)}),ue.kind==="directory"?u.jsx("span",{className:"key",children:"目录"}):null]},`${ue.kind}-${ue.path}`)),je!==null?u.jsxs("div",{className:"menu-item empty",children:["候选取不到:",je]}):null,je===null&&ke.length===0&&!be?u.jsx("div",{className:"menu-item empty",children:"没有匹配的路径"}):null,be?u.jsx("div",{className:"menu-item empty",children:"查工作区…"}):null,pe?u.jsx("div",{className:"menu-foot",children:"结果可能被截断(遍历到 5 万条上限就停)——先打几个字符收窄"}):null]}):null,me?.kind==="slash"?u.jsxs("div",{className:"menu",ref:B,children:[u.jsxs("div",{className:"menu-head",children:[u.jsx("span",{children:"技能与指令"}),u.jsx("span",{style:{marginLeft:"auto"},children:"Tab 补全 · Enter 执行 · Esc 关闭"})]}),Xe.map((ue,Re)=>u.jsxs("button",{className:Re===j?"menu-item sel":"menu-item",onMouseDown:tt=>{tt.preventDefault(),Ni(ue.name)},children:[u.jsx("span",{className:"g",children:"›"}),ue.name," ",ue.desc,u.jsx("span",{className:"key",children:ue.scope})]},ue.name)),Xe.length===0?u.jsx("div",{className:"menu-item",children:"没有匹配的指令"}):null]}):null,u.jsx("input",{ref:O,type:"file",multiple:!0,hidden:!0,onChange:ue=>{const Re=Array.from(ue.target.files??[]);ue.target.value="",ye(Re)}}),u.jsx("textarea",{"data-dsh-part":"composer-input",ref:F,rows:1,value:t,placeholder:"说一句话就开始(Enter 提交,Shift+Enter 换行)",onChange:ue=>{zr(ue.target.value)},onKeyDown:Hr,onPaste:ue=>{const Re=Array.from(ue.clipboardData.files).filter(pt=>pt.type.startsWith("image/"));if(Re.length===0)return;ue.preventDefault();const tt=new Date;ye(Re.map((pt,Nn)=>new File([pt],hE(tt,Nn),{type:pt.type})))}}),V===null?null:u.jsxs("div",{className:V.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:V.command===""?"(空命令)":V.command}),u.jsx("span",{className:"shell-state",children:V.error!==void 0?V.error:V.ok?`完成 ${(V.durationMs/1e3).toFixed(1)}s`:`退出码 ${String(V.exitCode??"—")}`}),u.jsx("span",{className:"grow"}),u.jsx("span",{className:"shell-note",children:"本机命令 · 不进会话日志(模型看不到)"}),u.jsx("button",{className:"shell-x",title:"收起","aria-label":"收起本机命令结果",onClick:()=>{se(null)},children:"✕"})]}),(()=>{const ue=[V.stdout,V.stderr].filter(Re=>Re!=="").join("");return ue===""?V.error===void 0?u.jsx("div",{className:"shell-empty",children:"(无输出)"}):null:u.jsx("pre",{className:"shell-out",children:V.truncated?`${ue}
12
+ …(输出已截断)`:ue})})()]}),Se===null?null:u.jsxs("div",{className:"att-error",children:[u.jsx("div",{className:"att-error-title",children:u.jsx("b",{children:Se.text})}),u.jsx("div",{className:"att-error-line dim",children:Se.hint})]}),et.length===0?null:u.jsxs("div",{className:"att-error",children:[u.jsxs("div",{className:"att-error-title",children:[u.jsx("b",{children:"上传被拒:"}),et[0]?.error]}),et.slice(1).map(ue=>u.jsxs("div",{className:"att-error-line",children:[ue.name,":",ue.error]},ue.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:()=>{O.current?.click()},children:"+"}),u.jsx("button",{className:"tool-btn key",title:"引用文件 @",onClick:()=>{M({kind:"mention",query:""}),Z(0),H()},children:"@"}),u.jsx("button",{className:"tool-btn key",title:"跑本机命令 !",onClick:()=>{i(`${t}!`),H()},children:"!"}),u.jsx("button",{className:"tool-btn key",title:"技能与指令 /",onClick:()=>{i("/"),M({kind:"slash",query:""}),Z(0),H()},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:()=>{ae(ue=>!ue),Ce(!1),M(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(ue=>u.jsxs("button",{className:ue===v?"menu-item sel":"menu-item",onClick:()=>{if(ae(!1),ue!==v){if(ue==="danger-full"){G(!0);return}_(ue)}},children:[u.jsx("span",{className:"g",children:ue===v?"●":"○"}),J0[ue],u.jsx("span",{className:"key",children:_E[ue]})]},ue)),u.jsx("div",{className:"menu-head",style:{borderTop:"1px solid var(--border)",paddingTop:"6px"},children:"切档写进事件日志,下一轮请求生效"})]}):null]}),u.jsx(gE,{label:a}),u.jsx("button",{className:y===!0?"plan-toggle on":"plan-toggle",type:"button",title:b===!0?"运行中不能切计划模式:等这一轮结束":"计划模式:只读探索,不写文件",disabled:b===!0,onClick:w,children:"◐ 计划模式"}),u.jsxs("span",{style:{position:"relative"},ref:A,children:[u.jsxs("button",{className:"model-chip",title:"选择模型",onClick:()=>{Ce(ue=>!ue),ae(!1),M(null)},children:[u.jsx("span",{style:{width:"6px",height:"6px",borderRadius:"50%",background:"var(--green)",display:"inline-block"}}),st,u.jsx("span",{className:"g g-dim",style:{fontSize:"10px"},children:"▾"})]}),_e?(()=>{const ue=We.trim().toLowerCase(),Re=(Ee?.groups??[]).map(Ie=>({...Ie,models:Ie.models.filter(It=>ue===""||It.name.toLowerCase().includes(ue)||Ie.name.toLowerCase().includes(ue))})).filter(Ie=>Ie.models.length>0),tt=new Set((Ee?.groups??[]).flatMap(Ie=>Ie.models.map(It=>It.name))),pt=(Ee?.models??[]).filter(Ie=>!tt.has(Ie)).filter(Ie=>ue===""||Ie.toLowerCase().includes(ue)),Nn=Re.length===0&&pt.length===0;return u.jsxs("div",{className:"menu model-menu",children:[u.jsxs("div",{className:"menu-head",children:["选择模型",mt?" · 切换中…":""]}),u.jsx("input",{className:"model-search",placeholder:"搜索模型或供应商…",value:We,autoFocus:!0,onChange:Ie=>{ut(Ie.target.value)},onKeyDown:Ie=>{Ie.key==="Escape"&&(Ie.preventDefault(),Ce(!1))}}),Te===null?null:u.jsx("div",{className:"model-error",children:Te}),Ee===null?u.jsx("div",{className:"model-note",children:"读取模型列表…"}):null,u.jsxs("div",{className:"model-list",children:[Re.map(Ie=>u.jsxs("div",{className:"model-group",children:[u.jsxs("div",{className:"model-group-head",children:[Ie.name,Ie.active?u.jsx("span",{className:"model-group-tag",children:"当前供应商"}):null]}),Ie.models.map(It=>{const hn=It.contextWindowTokens===void 0?"":`${String(It.contextWindowTokens)} 上下文`;return u.jsxs("button",{className:It.name===st?"menu-item model-row sel":"menu-item model-row",disabled:mt,onClick:()=>{en(It.name)},children:[u.jsx("span",{className:"g",children:It.name===st?"●":"○"}),u.jsxs("span",{className:"model-row-main",children:[u.jsx("span",{className:"model-name",children:It.name}),u.jsx("span",{className:"model-provider",children:Ie.name})]}),u.jsx("span",{className:"key",children:It.name===st?hn===""?"当前":`当前 · ${hn}`:hn})]},`${Ie.id}/${It.name}`)})]},Ie.id)),pt.length===0?null:u.jsxs("div",{className:"model-group",children:[u.jsx("div",{className:"model-group-head",children:"其它"}),pt.map(Ie=>u.jsxs("button",{className:Ie===st?"menu-item model-row sel":"menu-item model-row",disabled:mt,onClick:()=>{en(Ie)},children:[u.jsx("span",{className:"g",children:Ie===st?"●":"○"}),u.jsx("span",{className:"model-row-main",children:u.jsx("span",{className:"model-name",children:Ie})}),Ie===st?u.jsx("span",{className:"key",children:"当前"}):null]},`other/${Ie}`))]})]}),Nn&&Ee!==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:!ot,onClick:kn,children:u.jsx("span",{className:"g",style:{fontSize:"16px"},children:"↵"})})]}),I?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":"完全放开"},_E={"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 vE{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 vE,yE={输入卡Dock:"conversation.composer.dock"};function SE({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 bE=e=>e==="completed"?"✓ 已完成":e==="paused"?"已暂停":e==="blocked"?"⊘ 已阻塞":"进行中";function xE({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:bE(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 Nf(e){return Array.from(e.dataTransfer.types).includes("Files")}function vx(e){const[t,i]=C.useState(!1),r=C.useRef(0);return{dragging:t,handlers:{onDragEnter:a=>{Nf(a)&&(a.preventDefault(),r.current+=1,i(!0))},onDragOver:a=>{Nf(a)&&(a.preventDefault(),a.dataTransfer.dropEffect="copy")},onDragLeave:a=>{Nf(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 yx(){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 wE({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=b=>{_(!0),b().finally(()=>{_(!1)})},y=b=>{f(b.id),m(b.content)};return u.jsxs("div",{className:"qdock","data-dsh-part":"queue-dock",children:[u.jsxs("button",{className:"qdock-head",onClick:()=>{c(b=>!b)},"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((b,w)=>u.jsxs("div",{className:h===b.id?"qrow editing":"qrow",children:[u.jsx("span",{className:"qno",children:String(w+1)}),b.placement==="steering"?u.jsx("span",{className:"qtag",children:"插话"}):null,h===b.id?u.jsxs("span",{className:"qedit",children:[u.jsx("textarea",{value:g,onChange:E=>{m(E.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(b.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:b.content,children:b.content}),u.jsxs("span",{className:"qact",children:[u.jsx("button",{title:"编辑",onClick:()=>{y(b)},children:"✎"}),u.jsx("button",{title:"删除",onClick:()=>{S(async()=>{await i(b.id)})},children:"✕"}),u.jsx("button",{title:"插话发送这一条",onClick:()=>{S(async()=>{await r(b.id)})},children:"↑"})]})]})]},b.id))}),u.jsx("div",{className:"qfoot",children:"⌘/Ctrl+Enter 插话发送全部排队消息"})]})]})}async function CE(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 kE(e,t){const i={};return(e[e.length-1]===""?[...e,""]:e).join((i.padRight?" ":"")+","+(i.padLeft===!1?"":" ")).trim()}const NE=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,EE=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,jE={};function tS(e,t){return(jE.jsx?EE:NE).test(e)}const TE=/[ \t\n\f\r]/g;function DE(e){return typeof e=="object"?e.type==="text"?nS(e.value):!1:nS(e)}function nS(e){return e.replace(TE,"")===""}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 Sx(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 _m(e){return e.toLowerCase()}class qn{constructor(t,i){this.attribute=i,this.property=t}}qn.prototype.attribute="";qn.prototype.booleanish=!1;qn.prototype.boolean=!1;qn.prototype.commaOrSpaceSeparated=!1;qn.prototype.commaSeparated=!1;qn.prototype.defined=!1;qn.prototype.mustUseProperty=!1;qn.prototype.number=!1;qn.prototype.overloadedBoolean=!1;qn.prototype.property="";qn.prototype.spaceSeparated=!1;qn.prototype.space=void 0;let ME=0;const $e=Br(),Yt=Br(),vm=Br(),xe=Br(),wt=Br(),Dr=Br(),ei=Br();function Br(){return 2**++ME}const ym=Object.freeze(Object.defineProperty({__proto__:null,boolean:$e,booleanish:Yt,commaOrSpaceSeparated:ei,commaSeparated:Dr,number:xe,overloadedBoolean:vm,spaceSeparated:wt},Symbol.toStringTag,{value:"Module"})),Ef=Object.keys(ym);class xp extends qn{constructor(t,i,r,a){let c=-1;if(super(t,i),iS(this,"space",a),typeof r=="number")for(;++c<Ef.length;){const h=Ef[c];iS(this,Ef[c],(r&ym[h])===ym[h])}}}xp.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 xp(r,e.transform(e.attributes||{},r),a,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(c.mustUseProperty=!0),t[r]=c,i[_m(r)]=r,i[_m(c.attribute)]=r}return new po(t,i,e.space)}const bx=ql({properties:{ariaActiveDescendant:null,ariaAtomic:Yt,ariaAutoComplete:null,ariaBusy:Yt,ariaChecked:Yt,ariaColCount:xe,ariaColIndex:xe,ariaColSpan:xe,ariaControls:wt,ariaCurrent:null,ariaDescribedBy:wt,ariaDetails:null,ariaDisabled:Yt,ariaDropEffect:wt,ariaErrorMessage:null,ariaExpanded:Yt,ariaFlowTo:wt,ariaGrabbed:Yt,ariaHasPopup:null,ariaHidden:Yt,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:wt,ariaLevel:xe,ariaLive:null,ariaModal:Yt,ariaMultiLine:Yt,ariaMultiSelectable:Yt,ariaOrientation:null,ariaOwns:wt,ariaPlaceholder:null,ariaPosInSet:xe,ariaPressed:Yt,ariaReadOnly:Yt,ariaRelevant:null,ariaRequired:Yt,ariaRoleDescription:wt,ariaRowCount:xe,ariaRowIndex:xe,ariaRowSpan:xe,ariaSelected:Yt,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 xx(e,t){return t in e?e[t]:t}function wx(e,t){return xx(e,t.toLowerCase())}const AE=ql({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:Dr,acceptCharset:wt,accessKey:wt,action:null,allow:null,allowFullScreen:$e,allowPaymentRequest:$e,allowUserMedia:$e,alpha:$e,alt:null,as:null,async:$e,autoCapitalize:null,autoComplete:wt,autoFocus:$e,autoPlay:$e,blocking:wt,capture:null,charSet:null,checked:$e,cite:null,className:wt,closedBy:null,colorSpace:null,cols:xe,colSpan:xe,command:null,commandFor:null,content:null,contentEditable:Yt,controls:$e,controlsList:wt,coords:xe|Dr,crossOrigin:null,data:null,dateTime:null,decoding:null,default:$e,defer:$e,dir:null,dirName:null,disabled:$e,download:vm,draggable:Yt,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:$e,formTarget:null,headers:wt,height:xe,hidden:vm,high:xe,href:null,hrefLang:null,htmlFor:wt,httpEquiv:wt,id:null,imageSizes:null,imageSrcSet:null,inert:$e,inputMode:null,integrity:null,is:null,isMap:$e,itemId:null,itemProp:wt,itemRef:wt,itemScope:$e,itemType:wt,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:$e,low:xe,manifest:null,max:null,maxLength:xe,media:null,method:null,min:null,minLength:xe,multiple:$e,muted:$e,name:null,nonce:null,noModule:$e,noValidate:$e,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:$e,optimum:xe,pattern:null,ping:wt,placeholder:null,playsInline:$e,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:$e,referrerPolicy:null,rel:wt,required:$e,reversed:$e,rows:xe,rowSpan:xe,sandbox:wt,scope:null,scoped:$e,seamless:$e,selected:$e,shadowRootClonable:$e,shadowRootCustomElementRegistry:$e,shadowRootDelegatesFocus:$e,shadowRootMode:null,shadowRootSerializable:$e,shape:null,size:xe,sizes:null,slot:null,span:xe,spellCheck:Yt,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:$e,useMap:null,value:Yt,width:xe,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:wt,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:$e,declare:$e,event:null,face:null,frame:null,frameBorder:null,hSpace:xe,leftMargin:xe,link:null,longDesc:null,lowSrc:null,marginHeight:xe,marginWidth:xe,noResize:$e,noHref:$e,noShade:$e,noWrap:$e,object:null,profile:null,prompt:null,rev:null,rightMargin:xe,rules:null,scheme:null,scrolling:Yt,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:$e,disablePictureInPicture:$e,disableRemotePlayback:$e,exportParts:Dr,part:wt,prefix:null,property:null,results:xe,security:null,unselectable:null},space:"html",transform:wx}),RE=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:ei,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:wt,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:$e,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:ei,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:wt,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:xe,pointsAtY:xe,pointsAtZ:xe,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:ei,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:ei,rev:ei,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:ei,requiredFeatures:ei,requiredFonts:ei,requiredFormats:ei,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:ei,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:ei,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:ei,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:xx}),Cx=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()}}),kx=ql({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:wx}),Nx=ql({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),OE={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"},BE=/[A-Z]/g,sS=/-[a-z]/g,LE=/^data[-\w.:]+$/i;function zE(e,t){const i=_m(t);let r=t,a=qn;if(i in e.normal)return e.property[e.normal[i]];if(i.length>4&&i.slice(0,4)==="data"&&LE.test(t)){if(t.charAt(4)==="-"){const c=t.slice(5).replace(sS,IE);r="data"+c.charAt(0).toUpperCase()+c.slice(1)}else{const c=t.slice(4);if(!sS.test(c)){let h=c.replace(BE,HE);h.charAt(0)!=="-"&&(h="-"+h),t="data"+h}}a=xp}return new a(r,t)}function HE(e){return"-"+e.toLowerCase()}function IE(e){return e.charAt(1).toUpperCase()}const UE=Sx([bx,AE,Cx,kx,Nx],"html"),wp=Sx([bx,RE,Cx,kx,Nx],"svg");function PE(e){return e.join(" ").trim()}var rS=/\/\*(?:[^*]|\*(?!\/))*\*\//g,qE=/\n/g,FE=/^\s*/,$E=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,VE=/^:\s*/,KE=/^((?:'(?:\\.|[^'\\])*'|"(?:\\.|[^"\\])*"|url\((?:'(?:\\.|[^'\\])*'|"(?:\\.|[^"\\])*"|[^)]*)\)|[^};])+)/,YE=/^[;\s]*/,WE=`
13
+ `,lS="/",aS="*",Pa="",XE="comment",GE="declaration";function QE(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(b){var w=b.match(qE);w&&(i+=w.length);var E=b.lastIndexOf(WE);r=~E?b.length-E:r+b.length}function c(){var b={line:i,column:r};return function(w){return w.position=new h(b),m(),w}}function h(b){this.start=b,this.end={line:i,column:r},this.source=t.source}h.prototype.content=e;function f(b){var w=new Error(t.source+":"+i+":"+r+": "+b);if(w.reason=b,w.filename=t.source,w.line=i,w.column=r,w.source=e,!t.silent)throw w}function g(b){var w=b.exec(e);if(w){var E=w[0];return a(E),e=e.slice(E.length),w}}function m(){g(FE)}function v(b){for(var w;w=_();)b.push(w);return b}function _(){var b=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 E=e.slice(2,w-2);return r+=2,a(E),e=e.slice(w),r+=2,b({type:XE,comment:E})}}function S(){var b=c(),w=g($E);if(w){if(_(),!g(VE))return f("property missing ':'");var E=g(KE),N=b({type:GE,property:w[0].replace(rS,Pa).trim(),value:E?E[0].replace(rS,Pa).trim():Pa});return g(YE),N}}function y(){var b=[];v(b);for(var w;w=S();)b.push(w),v(b);return b}return m(),y()}function ZE(e,t){let i=null;if(!e||typeof e!="string")return i;const r=QE(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 Ex=jx("end"),Cp=jx("start");function jx(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 JE(e){const t=Cp(e),i=Ex(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?Sm(e):""}function Sm(e){return cS(e&&e.line)+":"+cS(e&&e.column)}function oS(e){return Sm(e&&e.start)+"-"+Sm(e&&e.end)}function cS(e){return e&&typeof e=="number"?e:1}class Cn 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}}Cn.prototype.file="";Cn.prototype.name="";Cn.prototype.reason="";Cn.prototype.message="";Cn.prototype.stack="";Cn.prototype.column=void 0;Cn.prototype.line=void 0;Cn.prototype.ancestors=void 0;Cn.prototype.cause=void 0;Cn.prototype.fatal=void 0;Cn.prototype.place=void 0;Cn.prototype.ruleId=void 0;Cn.prototype.source=void 0;const kp={}.hasOwnProperty,ej=new Map,tj=/[A-Z]/g,nj=/-([a-z])/g,ij=new Set(["table","tbody","thead","tfoot","tr"]),sj=new Set(["td","th"]),Tx="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function rj(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=fj(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=dj(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"?wp:UE,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},c=Dx(a,e,void 0);return c&&typeof c!="string"?c:a.create(e,a.Fragment,{children:c||void 0},void 0)}function Dx(e,t,i){if(t.type==="element")return lj(e,t,i);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return aj(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return cj(e,t,i);if(t.type==="mdxjsEsm")return oj(e,t);if(t.type==="root")return uj(e,t,i);if(t.type==="text")return hj(e,t)}function lj(e,t,i){const r=e.schema;let a=r;t.tagName.toLowerCase()==="svg"&&r.space==="html"&&(a=wp,e.schema=a),e.ancestors.push(t);const c=Ax(e,t.tagName,!1),h=mj(e,t);let f=Ep(e,t);return ij.has(t.tagName)&&(f=f.filter(function(g){return typeof g=="string"?!DE(g):!0})),Mx(e,h,c,t),Np(h,f),e.ancestors.pop(),e.schema=r,e.create(t,c,h,i)}function aj(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 oj(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);oo(e,t.position)}function cj(e,t,i){const r=e.schema;let a=r;t.name==="svg"&&r.space==="html"&&(a=wp,e.schema=a),e.ancestors.push(t);const c=t.name===null?e.Fragment:Ax(e,t.name,!0),h=pj(e,t),f=Ep(e,t);return Mx(e,h,c,t),Np(h,f),e.ancestors.pop(),e.schema=r,e.create(t,c,h,i)}function uj(e,t,i){const r={};return Np(r,Ep(e,t)),e.create(t,e.Fragment,r,i)}function hj(e,t){return t.value}function Mx(e,t,i,r){typeof i!="string"&&i!==e.Fragment&&e.passNode&&(t.node=r)}function Np(e,t){if(t.length>0){const i=t.length>1?t:t[0];i&&(e.children=i)}}function dj(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 fj(e,t){return i;function i(r,a,c,h){const f=Array.isArray(c.children),g=Cp(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 mj(e,t){const i={};let r,a;for(a in t.properties)if(a!=="children"&&kp.call(t.properties,a)){const c=gj(e,a,t.properties[a]);if(c){const[h,f]=c;e.tableCellAlignToStyle&&h==="align"&&typeof f=="string"&&sj.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 pj(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 Ep(e,t){const i=[];let r=-1;const a=e.passKeys?new Map:ej;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=Dx(e,c,h);f!==void 0&&i.push(f)}return i}function gj(e,t,i){if(i==null||typeof i=="number"&&Number.isNaN(i))return;const r=zE(e.schema,t);return Array.isArray(i)&&(i=r.commaSeparated?kE(i):PE(i)),r.property==="style"?["style",typeof i=="object"?e.stylePropertyNameCase==="dom"?i:vj(i):_j(e,String(i))]:[e.elementAttributeNameCase==="react"&&r.space?OE[r.property]||r.property:r.attribute,i]}function _j(e,t){const i={};try{ZE(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(nj,bj))),i[c]=a}})}catch(r){if(e.ignoreInvalidStyle)return{};const a=r,c=new Cn("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=Tx+"#cannot-parse-style-attribute",c}return i}function Ax(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 kp.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 Cn("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=Tx+"#cannot-handle-mdx-estrees-without-createevaluater",i}function vj(e){const t={};let i;for(i in e)kp.call(e,i)&&(t[yj(i)]=e[i]);return t}function yj(e){if(e.slice(0,2)==="--")return e;let t=e.replace(tj,Sj);return t.slice(0,3)==="ms-"&&(t="-"+t),t}function Sj(e){return"-"+e.toLowerCase()}function bj(e,t){return t.toUpperCase()}const jf={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"]},xj={};function jp(e,t){const i=xj,r=typeof i.includeImageAlt=="boolean"?i.includeImageAlt:!0,a=typeof i.includeHtml=="boolean"?i.includeHtml:!0;return Rx(e,r,a)}function Rx(e,t,i){if(wj(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]=Rx(e[a],t,i);return r.join("")}function wj(e){return!!(e&&typeof e=="object")}const hS=document.createElement("i");function Tp(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 Ox(e){const t={};let i=-1;for(;++i<e.length;)Cj(t,e[i]);return t}function Cj(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];kj(a[h],Array.isArray(f)?f:f?[f]:[])}}}function kj(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 Bx(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 yn=Gs(/[A-Za-z]/),bn=Gs(/[\dA-Za-z]/),Nj=Gs(/[#-'*+\--9=?A-Z^-~]/);function xu(e){return e!==null&&(e<32||e===127)}const bm=Gs(/\d/),Ej=Gs(/[\dA-Fa-f]/),Lx=Gs(/[!-/:-@[-`{-~]/);function Ue(e){return e!==null&&e<-2}function Ct(e){return e!==null&&(e<0||e===32)}function Ze(e){return e===-2||e===-1||e===32}const Bu=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&&bn(e.charCodeAt(i+1))&&bn(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 dt(e,t,i,r){const a=r?r-1:1/0;let c=0;return h;function h(g){return Ze(g)?(e.enter(i),f(g)):t(g)}function f(g){return Ze(g)&&c++<a?(e.consume(g),f):(e.exit(i),t(g))}}function zx(e,t,i,r,a,c){let h=0;return f;function f(v){return Ze(v)?(e.enter(r),g(v)):m(v)}function g(v){return Ze(v)&&h<c?(e.consume(v),h++,g):(e.exit(r),m(v))}function m(v){return h>=a?t(v):i(v)}}const jj={tokenize:Tj};function Tj(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"),dt(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 Ue(f)?(e.consume(f),e.exit("chunkText"),c):(e.consume(f),h)}}let wu=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 Dj={tokenize:Mj},mS={tokenize:Aj};function Mj(e){const t=this,i=[];let r=0,a,c,h;return f;function f(R){if(r<i.length){const B=i[r];return t.containerState=B[1],e.attempt(B[0].continuation,g,m)(R)}return m(R)}function g(R){if(r++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,a&&A();const B=t.events.length;let q=B,z;for(;q--;)if(t.events[q][0]==="exit"&&t.events[q][1].type==="chunkFlow"){z=t.events[q][1].end;break}N(r);let D=B;for(;D<t.events.length;)t.events[D][1].end={...z},D++;const $=new wu;return $.add(q+1,0,t.events.slice(B)),$.add(B,D-B,[]),$.consume(t.events),m(R)}return f(R)}function m(R){if(r===i.length){if(!a)return S(R);if(a.currentConstruct&&a.currentConstruct.concrete)return b(R);t.interrupt=!!(a.currentConstruct&&!a._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(mS,v,_)(R)}function v(R){return a&&A(),N(r),S(R)}function _(R){return t.parser.lazy[t.now().line]=r!==i.length,h=t.now().offset,b(R)}function S(R){return t.containerState={},e.attempt(mS,y,b)(R)}function y(R){return r++,i.push([t.currentConstruct,t.containerState]),S(R)}function b(R){if(R===null){a&&A(),N(0),e.consume(R);return}return a=a||t.parser.flow(t.now()),e.enter("chunkFlow",{_tokenizer:a,contentType:"flow",previous:c}),w(R)}function w(R){if(R===null){E(e.exit("chunkFlow"),!0),N(0),e.consume(R);return}return Ue(R)?(e.consume(R),E(e.exit("chunkFlow")),r=0,t.interrupt=void 0,f):(e.consume(R),w)}function E(R,B){const q=t.sliceStream(R);if(B&&q.push(null),R.previous=c,c&&(c.next=R),c=R,a.defineSkip(R.start),a.write(q),t.parser.lazy[R.start.line]){let z=a.events.length;for(;z--;)if(a.events[z][1].start.offset<h&&(!a.events[z][1].end||a.events[z][1].end.offset>h))return;const D=t.events.length;let $=D,ae,I;for(;$--;)if(t.events[$][0]==="exit"&&t.events[$][1].type==="chunkFlow"){if(ae){I=t.events[$][1].end;break}ae=!0}for(N(r),z=D;z<t.events.length;)t.events[z][1].end={...I},z++;const G=new wu;G.add($+1,0,t.events.slice(D)),G.add(D,z-D,[]),G.consume(t.events)}}function N(R){let B=i.length;for(;B-- >R;){const q=i[B];t.containerState=q[1],q[0].exit.call(t,e)}i.length=R}function A(){a.write([null]),c=void 0,a=void 0,t.containerState._closeFlow=void 0}}function Aj(e,t,i){return dt(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||Ct(e)||Ar(e))return 1;if(Bu(e))return 2}function Lu(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 xm={name:"attention",resolveAll:Rj,tokenize:Oj};function Rj(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,Lu(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 Oj(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 Bj={name:"autolink",tokenize:Lj};function Lj(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 yn(y)?(e.consume(y),h):y===64?i(y):m(y)}function h(y){return y===43||y===45||y===46||bn(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||bn(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||xu(y)?i(y):(e.consume(y),g)}function m(y){return y===64?(e.consume(y),v):Nj(y)?(e.consume(y),m):i(y)}function v(y){return bn(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||bn(y))&&r++<63){const b=y===45?S:_;return e.consume(y),b}return i(y)}}const go={partial:!0,tokenize:zj};function zj(e,t,i){return r;function r(c){return Ze(c)?dt(e,a,"linePrefix")(c):a(c)}function a(c){return c===null||Ue(c)?t(c):i(c)}}const Hx={continuation:{tokenize:Ij},exit:Uj,name:"blockQuote",tokenize:Hj};function Hj(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 Ze(h)?(e.enter("blockQuotePrefixWhitespace"),e.consume(h),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(h))}}function Ij(e,t,i){const r=this;return a;function a(h){return Ze(h)?dt(e,c,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(h):c(h)}function c(h){return e.attempt(Hx,t,i)(h)}}function Uj(e){e.exit("blockQuote")}const Ix={name:"characterEscape",tokenize:Pj};function Pj(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 Lx(c)?(e.enter("characterEscapeValue"),e.consume(c),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):i(c)}}const Ux={name:"characterReference",tokenize:qj};function qj(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=bn,v(_))}function m(_){return _===88||_===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(_),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),c=6,h=Ej,v):(e.enter("characterReferenceValue"),c=7,h=bm,v(_))}function v(_){if(_===59&&a){const S=e.exit("characterReferenceValue");return h===bn&&!Tp(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 wm={partial:!0,tokenize:Fj};function Fj(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:$j};function $j(e,t,i){const r=this,a={partial:!0,tokenize:q};let c=0,h=0,f;return g;function g(z){return m(z)}function m(z){const D=r.events[r.events.length-1];return c=D&&D[1].type==="linePrefix"?D[2].sliceSerialize(D[1],!0).length:0,f=z,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),v(z)}function v(z){return z===f?(h++,e.consume(z),v):h<3?i(z):(e.exit("codeFencedFenceSequence"),Ze(z)?dt(e,_,"whitespace")(z):_(z))}function _(z){return z===null||Ue(z)?(e.exit("codeFencedFence"),r.interrupt?t(z):e.check(wm,w,B)(z)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),S(z))}function S(z){return z===null||Ue(z)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),_(z)):Ze(z)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),dt(e,y,"whitespace")(z)):z===96&&z===f?i(z):(e.consume(z),S)}function y(z){return z===null||Ue(z)?_(z):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),b(z))}function b(z){return z===null||Ue(z)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),_(z)):z===96&&z===f?i(z):(e.consume(z),b)}function w(z){return e.attempt(a,B,E)(z)}function E(z){return e.enter("lineEnding"),e.consume(z),e.exit("lineEnding"),N}function N(z){return c>0&&Ze(z)?dt(e,A,"linePrefix",c+1)(z):A(z)}function A(z){return z===null||Ue(z)?e.check(wm,w,B)(z):(e.enter("codeFlowValue"),R(z))}function R(z){return z===null||Ue(z)?(e.exit("codeFlowValue"),A(z)):(e.consume(z),R)}function B(z){return e.exit("codeFenced"),t(z)}function q(z,D,$){let ae=0;return I;function I(K){return z.enter("lineEnding"),z.consume(K),z.exit("lineEnding"),G}function G(K){return z.enter("codeFencedFence"),Ze(K)?dt(z,F,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(K):F(K)}function F(K){return K===f?(z.enter("codeFencedFenceSequence"),O(K)):$(K)}function O(K){return K===f?(ae++,z.consume(K),O):ae>=h?(z.exit("codeFencedFenceSequence"),Ze(K)?dt(z,U,"whitespace")(K):U(K)):$(K)}function U(K){return K===null||Ue(K)?(z.exit("codeFencedFence"),D(K)):$(K)}}}const Tf={name:"codeIndented",tokenize:Kj},Vj={partial:!0,tokenize:Yj};function Kj(e,t,i){return r;function r(f){return e.enter("codeIndented"),zx(e,a,i,"linePrefix",4,4)(f)}function a(f){return f===null?h(f):Ue(f)?e.attempt(Vj,a,h)(f):(e.enter("codeFlowValue"),c(f))}function c(f){return f===null||Ue(f)?(e.exit("codeFlowValue"),a(f)):(e.consume(f),c)}function h(f){return e.exit("codeIndented"),t(f)}}function Yj(e,t,i){const r=this;return a;function a(h){return r.parser.lazy[r.now().line]?i(h):Ue(h)?(e.enter("lineEnding"),e.consume(h),e.exit("lineEnding"),a):zx(e,t,c,"linePrefix",4,4)(h)}function c(h){return Ue(h)?a(h):i(h)}}const Wj={name:"codeText",previous:Gj,resolve:Xj,tokenize:Qj};function Xj(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 Gj(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function Qj(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(_)):Ue(_)?(e.enter("lineEnding"),e.consume(_),e.exit("lineEnding"),g):(e.enter("codeTextData"),m(_))}function m(_){return _===null||_===32||_===96||Ue(_)?(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 Zj{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 Px(e){const t={};let i=-1,r,a,c,h,f,g,m;const v=new Zj(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,Jj(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 Jj(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,b=0,w=0;const E=[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,E.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):E.pop(),S=E.length;S--;){const N=f.slice(E[S],E[S+1]),A=c.pop();g.push([A,A+N.length-1]),e.splice(A,2,N)}for(g.reverse(),S=-1;++S<g.length;)m[b+g[S][0]]=b+g[S][1],b+=g[S][1]-g[S][0]-1;return m}const eT={resolve:nT,tokenize:iT},tT={partial:!0,tokenize:sT};function nT(e){return Px(e),e}function iT(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):Ue(f)?e.check(tT,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 sT(e,t,i){const r=this;return a;function a(h){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(h),e.exit("lineEnding"),dt(e,c,"linePrefix")}function c(h){if(h===null||Ue(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 qx(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||xu(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||Ue(N)?i(N):(e.consume(N),N===92?b:y)}function b(N){return N===60||N===62||N===92?(e.consume(N),y):y(N)}function w(N){return!v&&(N===null||N===41||Ct(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||xu(N)?i(N):(e.consume(N),N===92?E:w)}function E(N){return N===40||N===41||N===92?(e.consume(N),w):w(N)}}function Fx(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):Ue(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||Ue(y)||f++>999?(e.exit("chunkString"),v(y)):(e.consume(y),g||(g=!Ze(y)),y===92?S:_)}function S(y){return y===91||y===92||y===93?(e.consume(y),f++,_):_(y)}}function $x(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):Ue(S)?(e.enter("lineEnding"),e.consume(S),e.exit("lineEnding"),dt(e,m,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),v(S))}function v(S){return S===h||S===null||Ue(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 Ue(a)?(e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),i=!0,r):Ze(a)?dt(e,r,i?"linePrefix":"lineSuffix")(a):t(a)}}const rT={name:"definition",tokenize:aT},lT={partial:!0,tokenize:oT};function aT(e,t,i){const r=this;let a;return c;function c(y){return e.enter("definition"),h(y)}function h(y){return Fx.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 Ct(y)?so(e,m)(y):m(y)}function m(y){return qx(e,v,i,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(y)}function v(y){return e.attempt(lT,_,_)(y)}function _(y){return Ze(y)?dt(e,S,"whitespace")(y):S(y)}function S(y){return y===null||Ue(y)?(e.exit("definition"),r.parser.defined.push(a),t(y)):i(y)}}function oT(e,t,i){return r;function r(f){return Ct(f)?so(e,a)(f):i(f)}function a(f){return $x(e,c,i,"definitionTitle","definitionTitleMarker","definitionTitleString")(f)}function c(f){return Ze(f)?dt(e,h,"whitespace")(f):h(f)}function h(f){return f===null||Ue(f)?t(f):i(f)}}const cT={name:"hardBreakEscape",tokenize:uT};function uT(e,t,i){return r;function r(c){return e.enter("hardBreakEscape"),e.consume(c),a}function a(c){return Ue(c)?(e.exit("hardBreakEscape"),t(c)):i(c)}}const hT={name:"headingAtx",resolve:dT,tokenize:fT};function dT(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 fT(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||Ct(v)?(e.exit("atxHeadingSequence"),f(v)):i(v)}function f(v){return v===35?(e.enter("atxHeadingSequence"),g(v)):v===null||Ue(v)?(e.exit("atxHeading"),t(v)):Ze(v)?dt(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||Ct(v)?(e.exit("atxHeadingText"),f(v)):(e.consume(v),m)}}const Vx=["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"],Cm=["pre","script","style","textarea"],mT={concrete:!0,name:"htmlFlow",resolveTo:gT,tokenize:_T},pT={partial:!0,tokenize:vT};function gT(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 _T(e,t,i){const r=this;let a,c,h,f,g;return m;function m(M){return v(M)}function v(M){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(M),_}function _(M){return M===33?(e.consume(M),S):M===47?(e.consume(M),c=!0,w):M===63?(e.consume(M),a=3,r.interrupt?t:T):yn(M)?(e.consume(M),h=String.fromCharCode(M),E):i(M)}function S(M){return M===45?(e.consume(M),a=2,y):M===91?(e.consume(M),a=5,f=0,b):yn(M)?(e.consume(M),a=4,r.interrupt?t:T):i(M)}function y(M){return M===45?(e.consume(M),r.interrupt?t:T):i(M)}function b(M){const j="CDATA[";return M===j.charCodeAt(f++)?(e.consume(M),f===j.length?r.interrupt?t:F:b):i(M)}function w(M){return yn(M)?(e.consume(M),h=String.fromCharCode(M),E):i(M)}function E(M){if(M===null||M===47||M===62||Ct(M)){const j=M===47,Z=h.toLowerCase();return!j&&!c&&Cm.includes(Z)?(a=1,r.interrupt?t(M):F(M)):Vx.includes(h.toLowerCase())?(a=6,j?(e.consume(M),N):r.interrupt?t(M):F(M)):(a=7,r.interrupt&&!r.parser.lazy[r.now().line]?i(M):c?A(M):R(M))}return M===45||bn(M)?(e.consume(M),h+=String.fromCharCode(M),E):i(M)}function N(M){return M===62?(e.consume(M),r.interrupt?t:F):i(M)}function A(M){return Ze(M)?(e.consume(M),A):I(M)}function R(M){return M===47?(e.consume(M),I):M===58||M===95||yn(M)?(e.consume(M),B):Ze(M)?(e.consume(M),R):I(M)}function B(M){return M===45||M===46||M===58||M===95||bn(M)?(e.consume(M),B):q(M)}function q(M){return M===61?(e.consume(M),z):Ze(M)?(e.consume(M),q):R(M)}function z(M){return M===null||M===60||M===61||M===62||M===96?i(M):M===34||M===39?(e.consume(M),g=M,D):Ze(M)?(e.consume(M),z):$(M)}function D(M){return M===g?(e.consume(M),g=null,ae):M===null||Ue(M)?i(M):(e.consume(M),D)}function $(M){return M===null||M===34||M===39||M===47||M===60||M===61||M===62||M===96||Ct(M)?q(M):(e.consume(M),$)}function ae(M){return M===47||M===62||Ze(M)?R(M):i(M)}function I(M){return M===62?(e.consume(M),G):i(M)}function G(M){return M===null||Ue(M)?F(M):Ze(M)?(e.consume(M),G):i(M)}function F(M){return M===45&&a===2?(e.consume(M),V):M===60&&a===1?(e.consume(M),se):M===62&&a===4?(e.consume(M),De):M===63&&a===3?(e.consume(M),T):M===93&&a===5?(e.consume(M),ge):Ue(M)&&(a===6||a===7)?(e.exit("htmlFlowData"),e.check(pT,me,O)(M)):M===null||Ue(M)?(e.exit("htmlFlowData"),O(M)):(e.consume(M),F)}function O(M){return e.check(wm,U,me)(M)}function U(M){return e.enter("lineEnding"),e.consume(M),e.exit("lineEnding"),K}function K(M){return M===null||Ue(M)?O(M):(e.enter("htmlFlowData"),F(M))}function V(M){return M===45?(e.consume(M),T):F(M)}function se(M){return M===47?(e.consume(M),h="",ee):F(M)}function ee(M){if(M===62){const j=h.toLowerCase();return Cm.includes(j)?(e.consume(M),De):F(M)}return yn(M)&&h.length<8?(e.consume(M),h+=String.fromCharCode(M),ee):F(M)}function ge(M){return M===93?(e.consume(M),T):F(M)}function T(M){return M===62?(e.consume(M),De):M===45&&a===2?(e.consume(M),T):F(M)}function De(M){return M===null||Ue(M)?(e.exit("htmlFlowData"),me(M)):(e.consume(M),De)}function me(M){return e.exit("htmlFlow"),t(M)}}function vT(e,t,i){return r;function r(a){return e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),e.attempt(go,t,i)}}const yT={name:"htmlText",tokenize:ST};function ST(e,t,i){const r=this;let a,c,h;return f;function f(T){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(T),g}function g(T){return T===33?(e.consume(T),m):T===47?(e.consume(T),q):T===63?(e.consume(T),R):yn(T)?(e.consume(T),$):i(T)}function m(T){return T===45?(e.consume(T),v):T===91?(e.consume(T),c=0,b):yn(T)?(e.consume(T),A):i(T)}function v(T){return T===45?(e.consume(T),y):i(T)}function _(T){return T===null?i(T):T===45?(e.consume(T),S):Ue(T)?(h=_,se(T)):(e.consume(T),_)}function S(T){return T===45?(e.consume(T),y):_(T)}function y(T){return T===62?V(T):T===45?S(T):_(T)}function b(T){const De="CDATA[";return T===De.charCodeAt(c++)?(e.consume(T),c===De.length?w:b):i(T)}function w(T){return T===null?i(T):T===93?(e.consume(T),E):Ue(T)?(h=w,se(T)):(e.consume(T),w)}function E(T){return T===93?(e.consume(T),N):w(T)}function N(T){return T===62?V(T):T===93?(e.consume(T),N):w(T)}function A(T){return T===null||T===62?V(T):Ue(T)?(h=A,se(T)):(e.consume(T),A)}function R(T){return T===null?i(T):T===63?(e.consume(T),B):Ue(T)?(h=R,se(T)):(e.consume(T),R)}function B(T){return T===62?V(T):R(T)}function q(T){return yn(T)?(e.consume(T),z):i(T)}function z(T){return T===45||bn(T)?(e.consume(T),z):D(T)}function D(T){return Ue(T)?(h=D,se(T)):Ze(T)?(e.consume(T),D):V(T)}function $(T){return T===45||bn(T)?(e.consume(T),$):T===47||T===62||Ct(T)?ae(T):i(T)}function ae(T){return T===47?(e.consume(T),V):T===58||T===95||yn(T)?(e.consume(T),I):Ue(T)?(h=ae,se(T)):Ze(T)?(e.consume(T),ae):V(T)}function I(T){return T===45||T===46||T===58||T===95||bn(T)?(e.consume(T),I):G(T)}function G(T){return T===61?(e.consume(T),F):Ue(T)?(h=G,se(T)):Ze(T)?(e.consume(T),G):ae(T)}function F(T){return T===null||T===60||T===61||T===62||T===96?i(T):T===34||T===39?(e.consume(T),a=T,O):Ue(T)?(h=F,se(T)):Ze(T)?(e.consume(T),F):(e.consume(T),U)}function O(T){return T===a?(e.consume(T),a=void 0,K):T===null?i(T):Ue(T)?(h=O,se(T)):(e.consume(T),O)}function U(T){return T===null||T===34||T===39||T===60||T===61||T===96?i(T):T===47||T===62||Ct(T)?ae(T):(e.consume(T),U)}function K(T){return T===47||T===62||Ct(T)?ae(T):i(T)}function V(T){return T===62?(e.consume(T),e.exit("htmlTextData"),e.exit("htmlText"),t):i(T)}function se(T){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(T),e.exit("lineEnding"),ee}function ee(T){return Ze(T)?dt(e,ge,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(T):ge(T)}function ge(T){return e.enter("htmlTextData"),h(T)}}const Dp={name:"labelEnd",resolveAll:CT,resolveTo:kT,tokenize:NT},bT={tokenize:ET},xT={tokenize:jT},wT={tokenize:TT};function CT(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 kT(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,Lu(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 NT(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(bT,v,h?v:_)(S):S===91?e.attempt(xT,v,h?m:_)(S):h?v(S):_(S)}function m(S){return e.attempt(wT,v,_)(S)}function v(S){return a.pop(),t(S)}function _(S){return c._balanced=!0,i(S)}}function ET(e,t,i){return r;function r(_){return e.enter("resource"),e.enter("resourceMarker"),e.consume(_),e.exit("resourceMarker"),a}function a(_){return Ct(_)?so(e,c)(_):c(_)}function c(_){return _===41?v(_):qx(e,h,f,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(_)}function h(_){return Ct(_)?so(e,g)(_):v(_)}function f(_){return i(_)}function g(_){return _===34||_===39||_===40?$x(e,m,i,"resourceTitle","resourceTitleMarker","resourceTitleString")(_):v(_)}function m(_){return Ct(_)?so(e,v)(_):v(_)}function v(_){return _===41?(e.enter("resourceMarker"),e.consume(_),e.exit("resourceMarker"),e.exit("resource"),t):i(_)}}function jT(e,t,i){const r=this;return a;function a(f){return Fx.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 TT(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 DT={name:"labelStartImage",resolveAll:Dp.resolveAll,tokenize:MT};function MT(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 AT={name:"labelStartLink",resolveAll:Dp.resolveAll,tokenize:RT};function RT(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 Df={name:"lineEnding",tokenize:OT};function OT(e,t){return i;function i(r){return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),dt(e,t,"linePrefix")}}const du={name:"thematicBreak",tokenize:BT};function BT(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||Ue(m))?(e.exit("thematicBreak"),t(m)):i(m)}function g(m){return m===a?(e.consume(m),r++,g):(e.exit("thematicBreakSequence"),Ze(m)?dt(e,f,"whitespace")(m):f(m))}}const Pn={continuation:{tokenize:IT},exit:PT,name:"list",tokenize:HT},LT={partial:!0,tokenize:qT},zT={partial:!0,tokenize:UT};function HT(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 b=r.containerState.type||(y===42||y===43||y===45?"listUnordered":"listOrdered");if(b==="listUnordered"?!r.containerState.marker||y===r.containerState.marker:bm(y)){if(r.containerState.type||(r.containerState.type=b,e.enter(b,{_container:!0})),b==="listUnordered")return e.enter("listItemPrefix"),y===42||y===45?e.check(du,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 bm(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(LT,S,_))}function v(y){return r.containerState.initialBlankLine=!0,c++,S(y)}function _(y){return Ze(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 IT(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,dt(e,t,"listItemIndent",r.containerState.size+1)(f)}function c(f){return r.containerState.furtherBlankLines||!Ze(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(zT,t,h)(f))}function h(f){return r.containerState._closeFlow=!0,r.interrupt=void 0,dt(e,e.attempt(Pn,t,i),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(f)}}function UT(e,t,i){const r=this;return dt(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 PT(e){e.exit(this.containerState.type)}function qT(e,t,i){const r=this;return dt(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!Ze(c)&&h&&h[1].type==="listItemPrefixWhitespace"?t(c):i(c)}}const _S={name:"setextUnderline",resolveTo:FT,tokenize:$T};function FT(e,t){const i=new wu;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 $T(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"),Ze(m)?dt(e,g,"lineSuffix")(m):g(m))}function g(m){return m===null||Ue(m)?(e.exit("setextHeadingLine"),t(m)):i(m)}}const VT={tokenize:KT};function KT(e){const t=this,i=e.attempt(go,r,e.attempt(this.parser.constructs.flowInitial,a,dt(e,e.attempt(this.parser.constructs.flow,a,e.attempt(eT,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 YT={resolveAll:Yx()},WT=Kx("string"),XT=Kx("text");function Kx(e){return{resolveAll:Yx(e==="text"?GT: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 Yx(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 GT(e,t){const i=new wu;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 QT={42:Pn,43:Pn,45:Pn,48:Pn,49:Pn,50:Pn,51:Pn,52:Pn,53:Pn,54:Pn,55:Pn,56:Pn,57:Pn,62:Hx},ZT={91:rT},JT={[-2]:Tf,[-1]:Tf,32:Tf},eD={35:hT,42:du,45:[_S,du],60:mT,61:_S,95:du,96:gS,126:gS},tD={38:Ux,92:Ix},nD={[-5]:Df,[-4]:Df,[-3]:Df,33:DT,38:Ux,42:xm,60:[Bj,yT],91:AT,92:[cT,Ix],93:Dp,95:xm,96:Wj},iD={null:[xm,YT]},sD={null:[42,95]},rD={null:[]},lD=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:sD,contentInitial:ZT,disable:rD,document:QT,flow:eD,flowInitial:JT,insideSpan:iD,string:tD,text:nD},Symbol.toStringTag,{value:"Module"}));function aD(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:D(q),check:D(z),consume:A,enter:R,exit:B,interrupt:D(z,{interrupt:!0})},m={code:null,containerState:{},defineSkip:w,events:[],now:b,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),E(),h[h.length-1]!==null?[]:($(t,0),m.events=Lu(c,m.events,m),m.events)}function S(G,F){return cD(y(G),F)}function y(G){return oD(h,G)}function b(){const{_bufferIndex:G,_index:F,line:O,column:U,offset:K}=r;return{_bufferIndex:G,_index:F,line:O,column:U,offset:K}}function w(G){a[G.line]=G.column,I()}function E(){for(;r._index<h.length;){const G=h[r._index];if(typeof G=="string"){const F=r._index;for(r._bufferIndex<0&&(r._bufferIndex=0);r._index===F&&r._bufferIndex<G.length;)N(G.charCodeAt(r._bufferIndex))}else N(G)}}function N(G){v=v(G)}function A(G){Ue(G)?(r.line++,r.column=1,r.offset+=G===-3?2:1,I()):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 R(G,F){const O=F||{};return O.type=G,O.start=b(),m.events.push(["enter",O,m]),f.push(O),O}function B(G){const F=f.pop();return F.end=b(),m.events.push(["exit",F,m]),F}function q(G,F){$(G,F.from)}function z(G,F){F.restore()}function D(G,F){return O;function O(U,K,V){let se,ee,ge,T;return Array.isArray(U)?me(U):"tokenize"in U?me([U]):De(U);function De(re){return ie;function ie(pe){const ve=pe!==null&&re[pe],je=pe!==null&&re.null,de=[...Array.isArray(ve)?ve:ve?[ve]:[],...Array.isArray(je)?je:je?[je]:[]];return me(de)(pe)}}function me(re){return se=re,ee=0,re.length===0?V:M(re[ee])}function M(re){return ie;function ie(pe){return T=ae(),ge=re,re.partial||(m.currentConstruct=re),re.name&&m.parser.constructs.disable.null.includes(re.name)?Z():re.tokenize.call(F?Object.assign(Object.create(m),F):m,g,j,Z)(pe)}}function j(re){return G(ge,T),K}function Z(re){return T.restore(),++ee<se.length?M(se[ee]):V}}}function $(G,F){G.resolveAll&&!c.includes(G)&&c.push(G),G.resolve&&Ci(m.events,F,m.events.length-F,G.resolve(m.events.slice(F),m)),G.resolveTo&&(m.events=G.resolveTo(m.events,m))}function ae(){const G=b(),F=m.previous,O=m.currentConstruct,U=m.events.length,K=Array.from(f);return{from:U,restore:V};function V(){r=G,m.previous=F,m.currentConstruct=O,m.events.length=U,f=K,I()}}function I(){r.line in a&&r.column<2&&(r.column=a[r.line],r.offset+=a[r.line]-1)}}function oD(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 cD(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 uD(e){const r={constructs:Ox([lD,...(e||{}).extensions||[]]),content:a(jj),defined:[],document:a(Dj),flow:a(VT),lazy:{},string:a(WT),text:a(XT)};return r;function a(c){return h;function h(f){return aD(r,c,f)}}}function hD(e){for(;!Px(e););return e}const vS=/[\0\t\n\r]/g;function dD(){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 fD=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function mD(e){return e.replace(fD,pD)}function pD(e,t,i){if(t)return t;if(i.charCodeAt(0)===35){const a=i.charCodeAt(1),c=a===120||a===88;return Bx(i.slice(c?2:1),c?16:10)}return Tp(i)||e}const Wx={}.hasOwnProperty;function gD(e,t,i){return t&&typeof t=="object"&&(i=t,t=void 0),_D(i)(hD(uD(i).document().write(dD()(e,t,!0))))}function _D(e){const t={afterExit:[],beforeEnter:[],transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:h(We),autolinkProtocol:I,autolinkEmail:I,atxHeading:h(_e),blockQuote:h(de),characterEscape:I,characterReference:I,codeFenced:h(be),codeFencedFenceInfo:f,codeFencedFenceMeta:f,codeIndented:h(be,f),codeText:h(Ae,f),codeTextData:I,data:I,codeFlowValue:I,definition:h(st),definitionDestinationString:f,definitionLabelString:f,definitionTitleString:f,emphasis:h(oe),hardBreakEscape:h(Ce),hardBreakTrailing:h(Ce),htmlFlow:h(Ee,f),htmlFlowData:I,htmlText:h(Ee,f),htmlTextData:I,image:h(at),label:f,link:h(We),listItem:h(Te),listItemValue:y,listOrdered:h(ut,S),listUnordered:h(ut),paragraph:h(ze),reference:j,referenceString:f,resourceDestinationString:f,resourceTitleString:f,setextHeading:h(_e),strong:h(mt),thematicBreak:h(jt)},exit:{atxHeading:m(),atxHeadingSequence:z,autolink:m(),autolinkEmail:je,autolinkProtocol:ve,blockQuote:m(),characterEscapeValue:G,characterReferenceMarkerHexadecimal:re,characterReferenceMarkerNumeric:re,characterReferenceValue:ie,characterReference:pe,codeFenced:m(N),codeFencedFence:E,codeFencedFenceInfo:b,codeFencedFenceMeta:w,codeFlowValue:G,codeIndented:m(A),codeText:m(V),codeTextData:G,data:G,definition:m(),definitionDestinationString:q,definitionLabelString:R,definitionTitleString:B,emphasis:m(),hardBreakEscape:m(O),hardBreakTrailing:m(O),htmlFlow:m(U),htmlFlowData:G,htmlText:m(K),htmlTextData:G,image:m(ee),label:T,labelText:ge,lineEnding:F,link:m(se),listItem:m(),listOrdered:m(),listUnordered:m(),paragraph:m(),referenceString:Z,resourceDestinationString:De,resourceTitleString:me,resource:M,setextHeading:m(ae),setextHeadingLineSequence:$,setextHeadingText:D,strong:m(),thematicBreak:m()}};Xx(t,(e||{}).mdastExtensions||[]);const i={};return r;function r(le){let Se={type:"root",children:[],position:void 0};const ne={stack:[Se],tokenStack:[],config:t,enter:g,exit:v,buffer:f,resume:_,data:i},H=[],ye=[];let ke=-1;for(;++ke<le.length;)if(ye.push(le[ke]),le[ke][1].type==="listOrdered"||le[ke][1].type==="listUnordered")if(le[ke][0]==="enter")H.push(ye.length-1);else{const Xe=H.pop();c(ye,Xe)}for(le=ye,ke=-1;++ke<le.length;){const Xe=t[le[ke][0]];le[ke][0]==="enter"&&t.beforeEnter.length>0&&a(t.beforeEnter,{...ne,sliceSerialize:le[ke][2].sliceSerialize},le[ke][1]),Wx.call(Xe,le[ke][1].type)&&Xe[le[ke][1].type].call({...ne,sliceSerialize:le[ke][2].sliceSerialize},le[ke][1]),le[ke][0]==="exit"&&t.afterExit.length>0&&a(t.afterExit,{...ne,sliceSerialize:le[ke][2].sliceSerialize},le[ke][1])}if(ne.tokenStack.length>0){const Xe=ne.tokenStack[ne.tokenStack.length-1];(Xe[1]||yS).call(ne,void 0,Xe[0])}for(Se.position={start:Ps(le.length>0?le[0][1].start:{line:1,column:1,offset:0}),end:Ps(le.length>0?le[le.length-2][1].end:{line:1,column:1,offset:0})},ke=-1;++ke<t.transforms.length;)Se=t.transforms[ke](Se)||Se;return Se}function a(le,Se,ne){let H=-1;for(;++H<le.length;)le[H].call(Se,ne)}function c(le,Se){const ne=le.length-1;let H=Se-1,ye=-1,ke=!1,Xe,ot,et,ni;const Ni=[];for(;++H<=ne;){const en=le[H];switch(en[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{en[0]==="enter"?ye++:ye--,ni=void 0;break}case"lineEndingBlank":{en[0]==="enter"&&(Xe&&!ni&&!ye&&!et&&(et=H),ni=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:ni=void 0}if(!ye&&en[0]==="enter"&&en[1].type==="listItemPrefix"||ye===-1&&en[0]==="exit"&&(en[1].type==="listUnordered"||en[1].type==="listOrdered")){if(Xe){let _i=H;for(ot=void 0;_i--;){const kn=le[_i];if(kn[1].type==="lineEnding"||kn[1].type==="lineEndingBlank"){if(kn[0]==="exit")continue;ot&&(le[ot][1].type="lineEndingBlank",ke=!0),kn[1].type="lineEnding",ot=_i}else if(!(kn[1].type==="linePrefix"||kn[1].type==="blockQuotePrefix"||kn[1].type==="blockQuotePrefixWhitespace"||kn[1].type==="blockQuoteMarker"||kn[1].type==="listItemIndent"))break}et&&(!ot||et<ot)&&(Xe._spread=!0),Xe.end=Object.assign({},ot?le[ot][1].start:en[1].end),Ni.push({at:ot||H,event:["exit",Xe,en[2]]})}if(en[1].type==="listItemPrefix"){const _i={type:"listItem",_spread:!1,start:Object.assign({},en[1].start),end:void 0};Xe=_i,Ni.push({at:H,event:["enter",_i,en[2]]}),et=void 0,ni=!0}}}const zr=le.splice(Se);let qt=0;for(H=-1;++H<zr.length;){for(;qt<Ni.length&&Ni[qt].at===Se+H;)le.push(Ni[qt++].event);le.push(zr[H])}le[Se][1]._spread=ke}function h(le,Se){return ne;function ne(H){g.call(this,le(H),H),Se&&Se.call(this,H)}}function f(){this.stack.push({type:"fragment",children:[]})}function g(le,Se,ne){this.stack[this.stack.length-1].children.push(le),this.stack.push(le),this.tokenStack.push([Se,ne||void 0]),le.position={start:Ps(Se.start),end:void 0}}function m(le){return Se;function Se(ne){le&&le.call(this,ne),v.call(this,ne)}}function v(le,Se){const ne=this.stack.pop(),H=this.tokenStack.pop();if(!H)throw new Error("Cannot close `"+le.type+"` ("+io({start:le.start,end:le.end})+"): it’s not open");H[0].type!==le.type&&(Se?Se.call(this,le,H[0]):(H[1]||yS).call(this,le,H[0])),ne.position.end=Ps(le.end)}function _(){return jp(this.stack.pop())}function S(){this.data.expectingFirstListItemValue=!0}function y(le){if(this.data.expectingFirstListItemValue){const Se=this.stack[this.stack.length-2];Se.start=Number.parseInt(this.sliceSerialize(le),10),this.data.expectingFirstListItemValue=void 0}}function b(){const le=this.resume(),Se=this.stack[this.stack.length-1];Se.lang=le}function w(){const le=this.resume(),Se=this.stack[this.stack.length-1];Se.meta=le}function E(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function N(){const le=this.resume(),Se=this.stack[this.stack.length-1];Se.value=le.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function A(){const le=this.resume(),Se=this.stack[this.stack.length-1];Se.value=le.replace(/(\r?\n|\r)$/g,"")}function R(le){const Se=this.resume(),ne=this.stack[this.stack.length-1];ne.label=Se,ne.identifier=ki(this.sliceSerialize(le)).toLowerCase()}function B(){const le=this.resume(),Se=this.stack[this.stack.length-1];Se.title=le}function q(){const le=this.resume(),Se=this.stack[this.stack.length-1];Se.url=le}function z(le){const Se=this.stack[this.stack.length-1];if(!Se.depth){const ne=this.sliceSerialize(le).length;Se.depth=ne}}function D(){this.data.setextHeadingSlurpLineEnding=!0}function $(le){const Se=this.stack[this.stack.length-1];Se.depth=this.sliceSerialize(le).codePointAt(0)===61?1:2}function ae(){this.data.setextHeadingSlurpLineEnding=void 0}function I(le){const ne=this.stack[this.stack.length-1].children;let H=ne[ne.length-1];(!H||H.type!=="text")&&(H=Ot(),H.position={start:Ps(le.start),end:void 0},ne.push(H)),this.stack.push(H)}function G(le){const Se=this.stack.pop();Se.value+=this.sliceSerialize(le),Se.position.end=Ps(le.end)}function F(le){const Se=this.stack[this.stack.length-1];if(this.data.atHardBreak){const ne=Se.children[Se.children.length-1];ne.position.end=Ps(le.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(Se.type)&&(I.call(this,le),G.call(this,le))}function O(){this.data.atHardBreak=!0}function U(){const le=this.resume(),Se=this.stack[this.stack.length-1];Se.value=le}function K(){const le=this.resume(),Se=this.stack[this.stack.length-1];Se.value=le}function V(){const le=this.resume(),Se=this.stack[this.stack.length-1];Se.value=le}function se(){const le=this.stack[this.stack.length-1];if(this.data.inReference){const Se=this.data.referenceType||"shortcut";le.type+="Reference",le.referenceType=Se,delete le.url,delete le.title}else delete le.identifier,delete le.label;this.data.referenceType=void 0}function ee(){const le=this.stack[this.stack.length-1];if(this.data.inReference){const Se=this.data.referenceType||"shortcut";le.type+="Reference",le.referenceType=Se,delete le.url,delete le.title}else delete le.identifier,delete le.label;this.data.referenceType=void 0}function ge(le){const Se=this.sliceSerialize(le),ne=this.stack[this.stack.length-2];ne.label=mD(Se),ne.identifier=ki(Se).toLowerCase()}function T(){const le=this.stack[this.stack.length-1],Se=this.resume(),ne=this.stack[this.stack.length-1];if(this.data.inReference=!0,ne.type==="link"){const H=le.children;ne.children=H}else ne.alt=Se}function De(){const le=this.resume(),Se=this.stack[this.stack.length-1];Se.url=le}function me(){const le=this.resume(),Se=this.stack[this.stack.length-1];Se.title=le}function M(){this.data.inReference=void 0}function j(){this.data.referenceType="collapsed"}function Z(le){const Se=this.resume(),ne=this.stack[this.stack.length-1];ne.label=Se,ne.identifier=ki(this.sliceSerialize(le)).toLowerCase(),this.data.referenceType="full"}function re(le){this.data.characterReferenceType=le.type}function ie(le){const Se=this.sliceSerialize(le),ne=this.data.characterReferenceType;let H;ne?(H=Bx(Se,ne==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):H=Tp(Se);const ye=this.stack[this.stack.length-1];ye.value+=H}function pe(le){const Se=this.stack.pop();Se.position.end=Ps(le.end)}function ve(le){G.call(this,le);const Se=this.stack[this.stack.length-1];Se.url=this.sliceSerialize(le)}function je(le){G.call(this,le);const Se=this.stack[this.stack.length-1];Se.url="mailto:"+this.sliceSerialize(le)}function de(){return{type:"blockquote",children:[],position:void 0}}function be(){return{type:"code",lang:null,meta:null,value:"",position:void 0}}function Ae(){return{type:"inlineCode",value:"",position:void 0}}function st(){return{type:"definition",identifier:"",label:null,title:null,url:"",position:void 0}}function oe(){return{type:"emphasis",children:[],position:void 0}}function _e(){return{type:"heading",depth:0,children:[],position:void 0}}function Ce(){return{type:"break",position:void 0}}function Ee(){return{type:"html",value:"",position:void 0}}function at(){return{type:"image",title:null,url:"",alt:null,position:void 0}}function We(){return{type:"link",title:null,url:"",children:[],position:void 0}}function ut(le){return{type:"list",ordered:le.type==="listOrdered",start:null,spread:le._spread,children:[],position:void 0}}function Te(le){return{type:"listItem",spread:le._spread,checked:null,children:[],position:void 0}}function ze(){return{type:"paragraph",children:[],position:void 0}}function mt(){return{type:"strong",children:[],position:void 0}}function Ot(){return{type:"text",value:"",position:void 0}}function jt(){return{type:"thematicBreak",position:void 0}}}function Ps(e){return{line:e.line,column:e.column,offset:e.offset}}function Xx(e,t){let i=-1;for(;++i<t.length;){const r=t[i];Array.isArray(r)?Xx(e,r):vD(e,r)}}function vD(e,t){let i;for(i in t)if(Wx.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 yD(e){const t=this;t.parser=i;function i(r){return gD(r,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function SD(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 bD(e,t){const i={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,i),[e.applyData(t,i),{type:"text",value:`
16
+ `}]}function xD(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 wD(e,t){const i={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,i),e.applyData(t,i)}function CD(e,t){const i={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,i),e.applyData(t,i)}function kD(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 ND(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 ED(e,t){if(e.options.allowDangerousHtml){const i={type:"raw",value:t.value};return e.patch(t,i),e.applyData(t,i)}}function Gx(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 jD(e,t){const i=String(t.identifier).toUpperCase(),r=e.definitionById.get(i);if(!r)return Gx(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 TD(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 DD(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 MD(e,t){const i=String(t.identifier).toUpperCase(),r=e.definitionById.get(i);if(!r)return Gx(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 AD(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 RD(e,t,i){const r=e.all(t),a=i?OD(i):Qx(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 OD(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=Qx(i[r])}return t}function Qx(e){const t=e.spread;return t??e.children.length>1}function BD(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 LD(e,t){const i={type:"element",tagName:"p",properties:{},children:e.all(t)};return e.patch(t,i),e.applyData(t,i)}function zD(e,t){const i={type:"root",children:e.wrap(e.all(t))};return e.patch(t,i),e.applyData(t,i)}function HD(e,t){const i={type:"element",tagName:"strong",properties:{},children:e.all(t)};return e.patch(t,i),e.applyData(t,i)}function ID(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=Cp(t.children[1]),g=Ex(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 UD(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 b={type:"element",tagName:c,properties:S,children:[]};_&&(b.children=e.all(_),e.patch(_,b),b=e.applyData(_,b)),m.push(b)}const v={type:"element",tagName:"tr",properties:{},children:e.wrap(m,!0)};return e.patch(t,v),e.applyData(t,v)}function PD(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 qD(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 FD(e,t){const i={type:"text",value:qD(String(t.value))};return e.patch(t,i),e.applyData(t,i)}function $D(e,t){const i={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(t,i),e.applyData(t,i)}const VD={blockquote:SD,break:bD,code:xD,delete:wD,emphasis:CD,footnoteReference:kD,heading:ND,html:ED,imageReference:jD,image:TD,inlineCode:DD,linkReference:MD,link:AD,listItem:RD,list:BD,paragraph:LD,root:zD,strong:HD,table:ID,tableCell:PD,tableRow:UD,text:FD,thematicBreak:$D,toml:Xc,yaml:Xc,definition:Xc,footnoteDefinition:Xc};function Xc(){}const Zx=-1,zu=0,ro=1,Cu=2,Mp=3,Ap=4,Rp=5,Op=6,Jx=7,e1=8,{defineProperty:KD}=Object,t1=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 t1[e](t)},YD=(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 zu:case Zx:return i(h,a);case ro:{const f=i([],a);for(const g of h)f.push(r(g));return f}case Cu:{const f=i({},a);for(const[g,m]of h){const v=r(g),_=r(m);v==="__proto__"?KD(f,v,{value:_,configurable:!0,enumerable:!0,writable:!0}):f[v]=_}return f}case Mp:return i(new Date(h),a);case Ap:{const{source:f,flags:g}=h;return i(new RegExp(f,g),a)}case Rp:{const f=i(new Map,a);for(const[g,m]of h)f.set(r(g),r(m));return f}case Op:{const f=i(new Set,a);for(const g of h)f.add(r(g));return f}case Jx:{const{name:f,message:g}=h;return i(typeof t1[f]=="function"?wS(f,g):new Error(g),a)}case e1: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=>YD(new Map,e)(0),Cr="",{toString:WD}={},{keys:XD,is:GD}=Object,Fa=e=>{const t=typeof e;if(t!=="object"||!e)return[zu,t];const i=WD.call(e).slice(8,-1);switch(i){case"Array":return[ro,Cr];case"Object":return[Cu,Cr];case"Date":return[Mp,Cr];case"RegExp":return[Ap,Cr];case"Map":return[Rp,Cr];case"Set":return[Op,Cr];case"DataView":return[ro,i]}return i.includes("Array")?[ro,i]:e instanceof Error?[Jx,e.name||"Error"]:[Cu,i]},Gc=([e,t])=>e===zu&&(t==="function"||t==="symbol"),QD=(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 zu:{let v=h;switch(g){case"bigint":f=e1,v=h.toString();break;case"number":if(!h&&GD(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([Zx],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 Cu:{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 XD(h))(e||!Gc(Fa(h[S])))&&v.push([c(S),c(h[S])]);return _}case Mp:return a([f,isNaN(h.getTime())?Cr:h.toISOString()],h);case Ap:{const{source:v,flags:_}=h;return a([f,{source:v,flags:_}],h)}case Rp:{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 Op:{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 QD(!(t||i),!!t,new Map,r)(e),r},ku=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 ZD(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 JD(e,t){return"Back to reference "+(e+1)+(t>1?"-"+t:"")}function e3(e){const t=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",i=e.options.footnoteBackContent||ZD,r=e.options.footnoteBackLabel||JD,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 b=[],w=e.footnoteCounts.get(_);for(;w!==void 0&&++y<=w;){b.length>0&&b.push({type:"text",value:" "});let A=typeof i=="string"?i:i(g,y);typeof A=="string"&&(A={type:"text",value:A}),b.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(A)?A:[A]})}const E=v[v.length-1];if(E&&E.type==="element"&&E.tagName==="p"){const A=E.children[E.children.length-1];A&&A.type==="text"?A.value+=" ":E.children.push({type:"text",value:" "}),E.children.push(...b)}else v.push(...b);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:{...ku(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 Hu=(function(e){if(e==null)return s3;if(typeof e=="function")return Iu(e);if(typeof e=="object")return Array.isArray(e)?t3(e):n3(e);if(typeof e=="string")return i3(e);throw new Error("Expected function, string, or object as test")});function t3(e){const t=[];let i=-1;for(;++i<e.length;)t[i]=Hu(e[i]);return Iu(r);function r(...a){let c=-1;for(;++c<t.length;)if(t[c].apply(this,a))return!0;return!1}}function n3(e){const t=e;return Iu(i);function i(r){const a=r;let c;for(c in e)if(a[c]!==t[c])return!1;return!0}}function i3(e){return Iu(t);function t(i){return i&&i.type===e}}function Iu(e){return t;function t(i,r,a){return!!(r3(i)&&e.call(this,i,typeof r=="number"?r:void 0,a||void 0))}}function s3(){return!0}function r3(e){return e!==null&&typeof e=="object"&&"type"in e}const n1=[],l3=!0,fu=!1,km="skip";function Nm(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=Hu(c),v=a?1:-1;_(e,void 0,[])();function _(S,y,b){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(E,"name",{value:"node ("+(S.type+(N?"<"+N+">":""))+")"})}return E;function E(){const N=!c||m(S,y,b[b.length-1]||void 0);let A=n1;if(f&&N&&(A=NS(f(S,b,y)),A[0]===fu))return A;if("children"in S&&S.children){const R=S;if(R.children&&A[0]!==km){let B=(a?-1:R.children.length)+v;const q=[...b,R];for(;B>-1&&B<R.children.length;){const z=R.children[B],D=_(z,B,q)();if(D[0]===fu)return D;B=typeof D[1]=="number"?D[1]:B+v}}}if(g&&N){const R=NS(g(S,b,y));if(R[0]===km)throw new Error("Unexpected value `"+R[0]+"` from `exit`, expected `CONTINUE`, `EXIT`, index, or nothing");if(R[0]===fu||typeof R[1]=="number")return R}return A}}}function NS(e){return Array.isArray(e)?e:typeof e=="number"?[l3,e]:e==null?n1:[e]}function Bp(e,t,i,r){let a,c,h;c=t,h=i,typeof c=="function"?Nm(e,a,Em(c),h):Nm(e,a,a3(c),h)}function a3(e){return!e||typeof e!="object"?e:{enter:typeof e.enter=="function"?Em(e.enter):e.enter,exit:typeof e.exit=="function"?Em(e.exit):e.exit}}function Em(e){return t;function t(i,r,a){return e(i,a,r[r.length-1])}}const jm={}.hasOwnProperty,o3={};function c3(e,t){const i=t||o3,r=new Map,a=new Map,c=new Map,h={...VD,...i.handlers},f={all:m,applyData:h3,definitionById:r,footnoteById:a,footnoteCounts:c,footnoteOrder:[],handlers:h,one:g,options:i,patch:u3,wrap:f3};return Bp(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(jm.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,...E}=v,N=ku(E);return N.children=f.all(v),N}return ku(v)}return(f.options.unknownHandler||d3)(f,v,_)}function m(v){const _=[];if("children"in v){const S=v.children;let y=-1;for(;++y<S.length;){const b=f.one(S[y],v);if(b){if(y&&S[y-1].type==="break"&&(!Array.isArray(b)&&b.type==="text"&&(b.value=ES(b.value)),!Array.isArray(b)&&b.type==="element")){const w=b.children[0];w&&w.type==="text"&&(w.value=ES(w.value))}Array.isArray(b)?_.push(...b):_.push(b)}}}return _}}function u3(e,t){e.position&&(t.position=JE(e))}function h3(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,ku(c)),"children"in i&&i.children&&a!==null&&a!==void 0&&(i.children=a)}return i}function d3(e,t){const i=t.data||{},r="value"in t&&!(jm.call(i,"hProperties")||jm.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 f3(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=c3(e,t),r=i.one(e,void 0),a=e3(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 m3(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 Mf,DS;function p3(){if(DS)return Mf;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 Mf=function g(){var m,v,_,S,y,b,w=arguments[0],E=1,N=arguments.length,A=!1;for(typeof w=="boolean"&&(A=w,w=arguments[1]||{},E=2),(w==null||typeof w!="object"&&typeof w!="function")&&(w={});E<N;++E)if(m=arguments[E],m!=null)for(v in m)_=f(w,v),S=f(m,v),w!==S&&(A&&S&&(c(S)||(y=a(S)))?(y?(y=!1,b=_&&a(_)?_:[]):b=_&&c(_)?_:{},h(w,{name:v,newValue:g(A,b,S)})):typeof S<"u"&&h(w,{name:v,newValue:S}));return w},Mf}var g3=p3();const Af=rx(g3);function Tm(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 _3(){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?v3(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 v3(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:y3,dirname:S3,extname:b3,join:x3,sep:"/"};function y3(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 S3(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 b3(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 x3(...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?".":w3(i)}function w3(e){_o(e);const t=e.codePointAt(0)===47;let i=C3(e,!t);return i.length===0&&!t&&(i="."),i.length>0&&e.codePointAt(e.length-1)===47&&(i+="/"),t?"/"+i:i}function C3(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 k3={cwd:N3};function N3(){return"/"}function Dm(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function E3(e){if(typeof e=="string")e=new URL(e);else if(!Dm(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 j3(e)}function j3(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 Rf=["history","path","basename","stem","extname","dirname"];class i1{constructor(t){let i;t?Dm(t)?i={path:t}:typeof t=="string"||T3(t)?i={value:t}:i=t:i={},this.cwd="cwd"in i?"":k3.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let r=-1;for(;++r<Rf.length;){const c=Rf[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)Rf.includes(a)||(this[a]=i[a])}get basename(){return typeof this.path=="string"?qi.basename(this.path):void 0}set basename(t){Bf(t,"basename"),Of(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(Of(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){Dm(t)&&(t=E3(t)),Bf(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){Bf(t,"stem"),Of(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 Cn(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 Of(e,t){if(e&&e.includes(qi.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+qi.sep+"`")}function Bf(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 T3(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const D3=(function(e){const r=this.constructor.prototype,a=r[e],c=function(){return a.apply(c,arguments)};return Object.setPrototypeOf(c,r),c}),M3={}.hasOwnProperty;class Lp extends D3{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=_3()}copy(){const t=new Lp;let i=-1;for(;++i<this.attachers.length;){const r=this.attachers[i];t.use(...r)}return t.data(Af(!0,{},this.namespace)),t}data(t,i){return typeof t=="string"?arguments.length===2?(Hf("data",this.frozen),this.namespace[t]=i,this):M3.call(this.namespace,t)&&this.namespace[t]||void 0:t?(Hf("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 Lf("parse",r),r(String(i),i)}process(t,i){const r=this;return this.freeze(),Lf("process",this.parser||this.Parser),zf("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=_,b=r.stringify(y,S);O3(b)?S.value=b:S.result=b,m(v,S)});function m(v,_){v||!_?h(v):c?c(_):i(void 0,_)}}}processSync(t){let i=!1,r;return this.freeze(),Lf("processSync",this.parser||this.Parser),zf("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 zf("stringify",a),AS(t),a(t,r)}use(t,...i){const r=this.attachers,a=this.namespace;if(Hf("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=Af(!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,...b]=v;const w=r[S][1];Tm(w)&&Tm(y)&&(y=Af(!0,w,y)),r[S]=[m,y,...b]}}}}const A3=new Lp().freeze();function Lf(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function zf(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function Hf(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(!Tm(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 R3(e)?e:new i1(e)}function R3(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function O3(e){return typeof e=="string"||B3(e)}function B3(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const L3="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",OS=[],BS={allowDangerousHtml:!0},z3=/^(https?|ircs?|mailto|xmpp)$/i,H3=[{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 I3(e){const t=U3(e),i=P3(e);return q3(t.runSync(t.parse(i),i),e)}function U3(e){const t=e.rehypePlugins||OS,i=e.remarkPlugins||OS,r=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...BS}:BS;return A3().use(yD).use(i).use(m3,r).use(t)}function P3(e){const t=e.children||"",i=new i1;return typeof t=="string"&&(i.value=t),i}function q3(e,t){const i=t.allowedElements,r=t.allowElement,a=t.components,c=t.disallowedElements,h=t.skipHtml,f=t.unwrapDisallowed,g=t.urlTransform||F3;for(const v of H3)Object.hasOwn(t,v.from)&&(""+v.from+(v.to?"use `"+v.to+"` instead":"remove it")+L3+v.id,void 0);return Bp(e,m),rj(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 jf)if(Object.hasOwn(jf,y)&&Object.hasOwn(v.properties,y)){const b=v.properties[y],w=jf[y];(w===null||w.includes(v.tagName))&&(v.properties[y]=g(String(b||""),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 F3(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||z3.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 $3(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function V3(e,t,i){const a=Hu((i||{}).ignore||[]),c=K3(t);let h=-1;for(;++h<c.length;)Nm(e,f);function f(m,v,_){if(m.type==="text"&&typeof _=="number")return g(m,v,_);if(a(m,_,v[v.length-1]))return km}function g(m,v,_){const S=v[v.length-1],y=c[h][0],b=c[h][1];let w=0,E=!1,N=[];y.lastIndex=0;let A=y.exec(m.value);for(;A;){const B=A.index,q={index:A.index,input:A.input,stack:[...v,m]};let z=b(...A,q);if(typeof z=="string"&&(z=z.length>0?{type:"text",value:z}:void 0),z===!1)y.lastIndex=B+1;else{if(w!==B&&R({type:"text",value:m.value.slice(w,B)}),Array.isArray(z))for(const D of z)R(D);else z&&R(z);w=B+A[0].length,E=!0}if(!y.global)break;A=y.exec(m.value)}return E?(w<m.value.length&&R({type:"text",value:m.value.slice(w)}),S.children.splice(_,1,...N)):N=[m],_+N.length;function R(B){const q=N[N.length-1];q&&q.type==="text"&&B.type==="text"?q.value+=B.value:N.push(B)}}}function K3(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([Y3(a[0]),W3(a[1])])}return t}function Y3(e){return typeof e=="string"?new RegExp($3(e),"g"):e}function W3(e){return typeof e=="function"?e:function(){return e}}const If="phrasing",Uf=["autolink","link","image","label"];function X3(){return{transforms:[nM],enter:{literalAutolink:Q3,literalAutolinkEmail:Pf,literalAutolinkHttp:Pf,literalAutolinkWww:Pf},exit:{literalAutolink:tM,literalAutolinkEmail:eM,literalAutolinkHttp:Z3,literalAutolinkWww:J3}}}function G3(){return{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:If,notInConstruct:Uf},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:If,notInConstruct:Uf},{character:":",before:"[ps]",after:"\\/",inConstruct:If,notInConstruct:Uf}]}}function Q3(e){this.enter({type:"link",title:null,url:"",children:[]},e)}function Pf(e){this.config.enter.autolinkProtocol.call(this,e)}function Z3(e){this.config.exit.autolinkProtocol.call(this,e)}function J3(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 eM(e){this.config.exit.autolinkEmail.call(this,e)}function tM(e){this.exit(e)}function nM(e){V3(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,iM],[new RegExp("(?<=^|\\s|\\p{P}|\\p{S})([-.\\w+]+)@([-\\w]+(?:\\.[-\\w]+)+)","gu"),sM]],{ignore:["link","linkReference"]})}function iM(e,t,i,r,a){let c="";if(!s1(a)||(/^w/i.test(t)&&(i=t+i,t="",c="http://"),!rM(i)))return!1;const h=lM(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 sM(e,t,i,r){return!s1(r,!0)||/[-\d_]$/.test(i)?!1:{type:"link",title:null,url:"mailto:"+t+"@"+i,children:[{type:"text",value:t+"@"+i}]}}function rM(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 lM(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 s1(e,t){const i=e.input.charCodeAt(e.index-1);return(e.index===0||Ar(i)||Bu(i))&&(!t||i!==47)}r1.peek=pM;function aM(){this.buffer()}function oM(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function cM(){this.buffer()}function uM(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function hM(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 dM(e){this.exit(e)}function fM(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 mM(e){this.exit(e)}function pM(){return"["}function r1(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 gM(){return{enter:{gfmFootnoteCallString:aM,gfmFootnoteCall:oM,gfmFootnoteDefinitionLabelString:cM,gfmFootnoteDefinition:uM},exit:{gfmFootnoteCallString:hM,gfmFootnoteCall:dM,gfmFootnoteDefinitionLabelString:fM,gfmFootnoteDefinition:mM}}}function _M(e){let t=!1;return e&&e.firstLineBlank&&(t=!0),{handlers:{footnoteDefinition:i,footnoteReference:r1},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?l1:vM))),m(),g}}function vM(e,t,i){return t===0?e:l1(e,t,i)}function l1(e,t,i){return(i?"":" ")+e}const yM=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];zp.attention=CM;zp.peek=kM;function SM(){return{canContainEols:["delete"],enter:{strikethrough:xM},exit:{strikethrough:wM}}}function bM(){return{handlers:{delete:zp},unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:yM}]}}function xM(e){this.enter({type:"delete",children:[],position:void 0},e)}function wM(e){this.exit(e)}function zp(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 CM(){return{construct:"strikethrough",markers:["~"],sizes:[2,1]}}function kM(){return"~"}function NM(e){return e.length}function EM(e,t){const i=t||{},r=(i.align||[]).concat(),a=i.stringLength||NM,c=[],h=[],f=[],g=[];let m=0,v=-1;for(;++v<e.length;){const w=[],E=[];let N=-1;for(e[v].length>m&&(m=e[v].length);++N<e[v].length;){const A=jM(e[v][N]);if(i.alignDelimiters!==!1){const R=a(A);E[N]=R,(g[N]===void 0||R>g[N])&&(g[N]=R)}w.push(A)}h[v]=w,f[v]=E}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 E="",N="";w===99?(E=":",N=":"):w===108?E=":":w===114&&(N=":");let A=i.alignDelimiters===!1?1:Math.max(1,g[_]-E.length-N.length);const R=E+"-".repeat(A)+N;i.alignDelimiters!==!1&&(A=E.length+A+N.length,A>g[_]&&(g[_]=A),y[_]=A),S[_]=R}h.splice(1,0,S),f.splice(1,0,y),v=-1;const b=[];for(;++v<h.length;){const w=h[v],E=f[v];_=-1;const N=[];for(;++_<m;){const A=w[_]||"";let R="",B="";if(i.alignDelimiters!==!1){const q=g[_]-(E[_]||0),z=c[_];z===114?R=" ".repeat(q):z===99?q%2?(R=" ".repeat(q/2+.5),B=" ".repeat(q/2-.5)):(R=" ".repeat(q/2),B=R):B=" ".repeat(q)}i.delimiterStart!==!1&&!_&&N.push("|"),i.padding!==!1&&!(i.alignDelimiters===!1&&A==="")&&(i.delimiterStart!==!1||_)&&N.push(" "),i.alignDelimiters!==!1&&N.push(R),N.push(A),i.alignDelimiters!==!1&&N.push(B),i.padding!==!1&&N.push(" "),(i.delimiterEnd!==!1||_!==m-1)&&N.push("|")}b.push(i.delimiterEnd===!1?N.join("").replace(/ +$/,""):N.join(""))}return b.join(`
27
+ `)}function jM(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 TM=Hu(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function DM(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()),MM);return a(),h}function MM(e,t,i){return">"+(i?"":" ")+e}function AM(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&&AM(i.stack,c))return/[\t ]/.test(r.before)?"":" "}return`\\
29
+ `}function RM(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 OM(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 BM(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 LM(e,t,i,r){const a=BM(i),c=e.value||"";if(OM(e,i)){const _=i.enter("codeIndented"),S=i.indentLines(c,zM);return _(),S}const h=i.createTracker(r),f=a.repeat(Math.max(RM(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 zM(e,t,i){return(i?"":" ")+e}function Hp(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 HM(e,t,i,r){const a=Hp(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 IM(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 Nu(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 a1(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 UM(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:yn(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(!yn(c))return;for(;c===45||bn(c);)c=e.charCodeAt(++a);const h=e.slice(r,a).toLowerCase();return!i&&c!==47&&Cm.includes(h)?1:Vx.includes(h)?6:7}const PM=new Map([["*",!1],["_",!0]]);function qM(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 o1(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=PM.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&&!!_,b=!_||_===2&&!!S,w={tokens:e.slice(h,m),markers:[],start:0,end:0,open:g?y&&(!!_||!b):y,close:g?b&&(!!S||!y):b,split:g!==void 0};for(const E of w.tokens){a.set(E,[...w.tokens]),c.set(E,w);let N=E.value.length;for(;N--;)w.markers.push(E)}w.end=w.markers.length,r.push(w),h=m}for($M(r,a),h=-1;++h<e.length;){const f=a.get(e[h]);if(f)return{attention:qM(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?Nu(i.value):Hl(i.value),a=a1(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 FM(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=Up(e,g,r,a),v=o1(m,r,a);if(!v||v.index>i.index)return{chosen:g,mistake:v,tokens:m}}}}function $M(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],b=S[0];if(y===_[v-1]&&y.value.length===v&&b===S[v-1]&&b.value.length===v&&y.attention===b.attention)t.delete(y),t.delete(b);else{const w=[...new Set([..._,...S])];for(const E of w){const N=t.get(E);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 VM(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(!Lx(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 KM(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?Nu(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"&&UM(m.value)!==7&&(c[c.length-1]=_.replace(/(\r?\n|\r)$/," "),f=" ",g=t.createTracker(i),g.move(Uu(c,i.before,i.after)));const S=t.handle.handlers[m.type];if(S&&S.attention){const y=Ip(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 Ip(e,t,i,r){const{construct:a,markers:c,sizes:h}=t(e,i),f=VM(e.type,c,h),g=f[0],m=i.enter(a);r.move(g);const v=KM(e,i,{...r.current(),before:g,after:g});return r.move(Uu(v,g,g)),r.move(g),m(),{children:v,sequences:f}}function Up(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 R={value:g,attention:void 0};c&&c===Nu(g)&&Zc([R],!0),c=void 0,a.push(R),R.value&&(h=Hl(R.value));continue}const m=t.get(g)||g.sequences[0],v=m.charAt(0),_=e[f+1],S=h,y=Nu(_===void 0?r:typeof _=="string"?_:t.get(_)||_.sequences[0]),b=Up(g.children,t,m,m),w=b.length>0?b[0].value:"",E=US(S.charCodeAt(S.length-1),w.charCodeAt(0),v);E.inside&&Zc(b,!0);const N=b.length>0?Hl(b[b.length-1].value):"",A=US(y.charCodeAt(0),N.charCodeAt(N.length-1),v);A.inside&&Zc(b,!1),E.outside&&S!==`
35
+ `&&S!=="\r"&&Zc(a,!1),A.outside&&(c=y),a.push({value:m,attention:g},...b,{value:m,attention:g}),h=m.charAt(m.length-1)}return a}function Uu(e,t,i){let r=new Map;const a=Up(e,r,t,i);let c=a,h=o1(c,t,i);for(;h;){const g=FM(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}Pp.attention=c1;Pp.peek=YM;function Pp(e,t,i,r){const a=i.enter("phrasing"),c=Ip(e,c1,i,i.createTracker(r)),h=Uu([c],r.before,r.after);return a(),h}function c1(e,t){return{construct:"emphasis",markers:IM(t)==="*"?["*","_"]:["_","*"],sizes:[1]}}function YM(e,t,i){return i.options.emphasis||"*"}function WM(e,t){let i=!1;return Bp(e,function(r){if("value"in r&&/\r?\n|\r/.test(r.value)||r.type==="break")return i=!0,fu}),!!((!e.depth||e.depth<3)&&jp(e)&&(t.options.setext||i))}function XM(e,t,i,r){const a=Math.max(Math.min(6,e.depth||1),1),c=i.createTracker(r);if(WM(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=a1(v)+m.slice(1)),m=m?h+" "+m:h,i.options.closeAtx&&(m+=" "+h),g(),f(),m}u1.peek=GM;function u1(e){return e.value||""}function GM(){return"<"}h1.peek=QM;function h1(e,t,i,r){const a=Hp(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 QM(){return"!"}d1.peek=ZM;function d1(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 ZM(){return"!"}f1.peek=JM;function f1(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 JM(){return"`"}function m1(e,t){const i=jp(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))}p1.peek=eA;function p1(e,t,i,r){const a=Hp(i),c=a==='"'?"Quote":"Apostrophe",h=i.createTracker(r);if(m1(e,i)){const b=i.stack;i.stack=b.filter(function(N){return N!=="phrasing"});const w=i.enter("autolink");let E=h.move("<");return E+=h.move(i.containerPhrasing(e,{before:E,after:">",...h.current()})),E+=h.move(">"),w(),i.stack=b,E}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 b=0;for(;b<v.length&&v.charCodeAt(b)!==93;)b+=v.charCodeAt(b)===92?2:1;v.charCodeAt(b+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 eA(e,t,i){return m1(e,i)?"<":"["}g1.peek=tA;function g1(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 tA(){return"["}function qp(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 nA(e){const t=qp(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 iA(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 _1(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 sA(e,t,i,r){const a=i.enter("list"),c=i.bulletCurrent;let h=e.ordered?iA(i):qp(i);const f=e.ordered?h==="."?")":".":nA(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),_1(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 rA(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 lA(e,t,i,r){const a=rA(i);let c=i.bulletCurrent||qp(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 aA(e,t,i,r){const a=i.enter("paragraph"),c=i.enter("phrasing"),h=i.containerPhrasing(e,r);return c(),a(),h}function oA(e,t,i,r){if(!e.children.some(function(f){return TM(f)}))return i.containerFlow(e,r);const c=i.enter("phrasing"),h=i.containerPhrasing(e,r);return c(),h}function cA(e){const t=e.options.strong||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize strong with `"+t+"` for `options.strong`, expected `*`, or `_`");return t}Fp.attention=v1;Fp.peek=uA;function Fp(e,t,i,r){const a=i.enter("phrasing"),c=Ip(e,v1,i,i.createTracker(r)),h=Uu([c],r.before,r.after);return a(),h}function v1(e,t){return{construct:"strong",markers:cA(t)==="*"?["*","_"]:["_","*"],sizes:[2]}}function uA(e,t,i){return i.options.strong||"*"}function hA(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 dA(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 fA(e,t,i){const r=(_1(i)+(i.options.ruleSpaces?" ":"")).repeat(dA(i));return i.options.ruleSpaces?r.slice(0,-1):r}const y1={blockquote:DM,break:IS,code:LM,definition:HM,emphasis:Pp,hardBreak:IS,heading:XM,html:u1,image:h1,imageReference:d1,inlineCode:f1,link:p1,linkReference:g1,list:sA,listItem:lA,paragraph:aA,root:oA,strong:Fp,text:hA,thematicBreak:fA};function mA(){return{enter:{table:pA,tableData:PS,tableHeader:PS,tableRow:_A},exit:{codeText:vA,table:gA,tableData:qf,tableHeader:qf,tableRow:qf}}}function pA(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 gA(e){this.exit(e),this.data.inTable=void 0}function _A(e){this.enter({type:"tableRow",children:[]},e)}function qf(e){this.exit(e)}function PS(e){this.enter({type:"tableCell",children:[]},e)}function vA(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,yA));const i=this.stack[this.stack.length-1];i.type,i.value=t,this.exit(e)}function yA(e,t){return t==="|"?t:e}function SA(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,b,w,E){return m(v(y,w,E),y.align)}function f(y,b,w,E){const N=_(y,w,E),A=m([N]);return A.slice(0,A.indexOf(`
43
+ `))}function g(y,b,w,E){const N=w.enter("tableCell"),A=w.enter("phrasing"),R=w.containerPhrasing(y,{...E,before:c,after:c});return A(),N(),R}function m(y,b){return EM(y,{align:b,alignDelimiters:r,padding:i,stringLength:a})}function v(y,b,w){const E=y.children;let N=-1;const A=[],R=b.enter("table");for(;++N<E.length;)A[N]=_(E[N],b,w);return R(),A}function _(y,b,w){const E=y.children;let N=-1;const A=[],R=b.enter("tableRow");for(;++N<E.length;)A[N]=g(E[N],y,b,w);return R(),A}function S(y,b,w){let E=y1.inlineCode(y,b,w);return w.stack.includes("tableCell")&&(E=E.replace(/\|/g,"\\$&")),E}}function bA(){return{exit:{taskListCheckValueChecked:qS,taskListCheckValueUnchecked:qS,paragraph:wA}}}function xA(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:CA}}}function qS(e){const t=this.stack[this.stack.length-2];t.type,t.checked=e.type==="taskListCheckValueChecked"}function wA(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 CA(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=y1.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 kA(){return[X3(),gM(),SM(),mA(),bA()]}function NA(e){return{extensions:[G3(),_M(e),bM(),SA(e),xA()]}}const EA={tokenize:RA,partial:!0},S1={tokenize:OA,partial:!0},b1={tokenize:BA,partial:!0},x1={tokenize:LA,partial:!0},jA={tokenize:zA,partial:!0},w1={name:"wwwAutolink",tokenize:MA,previous:k1},C1={name:"protocolAutolink",tokenize:AA,previous:N1},ds={name:"emailAutolink",tokenize:DA,previous:E1},Yi={};function TA(){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,C1];Yi[104]=[ds,C1];Yi[87]=[ds,w1];Yi[119]=[ds,w1];function DA(e,t,i){const r=this;let a,c;return h;function h(_){return!Mm(_)||!E1.call(r,r.previous)||$p(r.events)?i(_):(e.enter("literalAutolink"),e.enter("literalAutolinkEmail"),f(_))}function f(_){return Mm(_)?(e.consume(_),f):_===64?(e.consume(_),g):i(_)}function g(_){return _===46?e.check(jA,v,m)(_):_===45||_===95||bn(_)?(c=!0,e.consume(_),g):v(_)}function m(_){return e.consume(_),a=!0,g}function v(_){return c&&a&&yn(r.previous)?(e.exit("literalAutolinkEmail"),e.exit("literalAutolink"),t(_)):i(_)}}function MA(e,t,i){const r=this;return a;function a(h){return h!==87&&h!==119||!k1.call(r,r.previous)||$p(r.events)?i(h):(e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check(EA,e.attempt(S1,e.attempt(b1,c),i),i)(h))}function c(h){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),t(h)}}function AA(e,t,i){const r=this;let a="",c=!1;return h;function h(_){return(_===72||_===104)&&N1.call(r,r.previous)&&!$p(r.events)?(e.enter("literalAutolink"),e.enter("literalAutolinkHttp"),a+=String.fromCodePoint(_),e.consume(_),f):i(_)}function f(_){if(yn(_)&&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||xu(_)||Ct(_)||Ar(_)||Bu(_)?i(_):e.attempt(S1,e.attempt(b1,v),i)(_)}function v(_){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),t(_)}}function RA(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 OA(e,t,i){let r,a,c;return h;function h(m){return m===46||m===95?e.check(x1,g,f)(m):m===null||Ct(m)||Ar(m)||m!==45&&Bu(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 BA(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(x1,t,c)(h):h===null||Ct(h)||Ar(h)?t(h):(e.consume(h),a)}function c(h){return h===41&&r++,e.consume(h),a}}function LA(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||Ct(f)||Ar(f)?t(f):i(f)}function a(f){return f===null||f===40||f===91||Ct(f)||Ar(f)?t(f):r(f)}function c(f){return yn(f)?h(f):i(f)}function h(f){return f===59?(e.consume(f),r):yn(f)?(e.consume(f),h):i(f)}}function zA(e,t,i){return r;function r(c){return e.consume(c),a}function a(c){return bn(c)?i(c):t(c)}}function k1(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||Ct(e)}function N1(e){return!yn(e)}function E1(e){return!(e===47||Mm(e))}function Mm(e){return e===43||e===45||e===46||e===95||bn(e)}function $p(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 HA={tokenize:KA,partial:!0};function IA(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:FA,continuation:{tokenize:$A},exit:VA}},text:{91:{name:"gfmFootnoteCall",tokenize:qA},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:UA,resolveTo:PA}}}}function UA(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 PA(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 qA(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||Ct(_))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 Ct(_)||(h=!0),c++,e.consume(_),_===92?v:m}function v(_){return _===91||_===92||_===93?(e.consume(_),c++,m):m(_)}}function FA(e,t,i){const r=this,a=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let c,h=0,f;return g;function g(b){return e.enter("gfmFootnoteDefinition")._container=!0,e.enter("gfmFootnoteDefinitionLabel"),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(b),e.exit("gfmFootnoteDefinitionLabelMarker"),m}function m(b){return b===94?(e.enter("gfmFootnoteDefinitionMarker"),e.consume(b),e.exit("gfmFootnoteDefinitionMarker"),e.enter("gfmFootnoteDefinitionLabelString"),e.enter("chunkString").contentType="string",v):i(b)}function v(b){if(h>999||b===93&&!f||b===null||b===91||Ct(b))return i(b);if(b===93){e.exit("chunkString");const w=e.exit("gfmFootnoteDefinitionLabelString");return c=ki(r.sliceSerialize(w)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(b),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),S}return Ct(b)||(f=!0),h++,e.consume(b),b===92?_:v}function _(b){return b===91||b===92||b===93?(e.consume(b),h++,v):v(b)}function S(b){return b===58?(e.enter("definitionMarker"),e.consume(b),e.exit("definitionMarker"),a.includes(c)||a.push(c),dt(e,y,"gfmFootnoteDefinitionWhitespace")):i(b)}function y(b){return t(b)}}function $A(e,t,i){return e.check(go,t,e.attempt(HA,t,i))}function VA(e){e.exit("gfmFootnoteDefinition")}function KA(e,t,i){const r=this;return dt(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 YA(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,Lu(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(b){return m===126&&v[v.length-1][1].type!=="characterEscape"?g(b):(h.enter("strikethroughSequenceTemporary"),y(b))}function y(b){const w=Ws(m);if(b===126)return _>1?g(b):(h.consume(b),_++,y);if(_<2&&!i)return g(b);const E=h.exit("strikethroughSequenceTemporary"),N=Ws(b);return E._open=!N||N===2&&!!w,E._close=!w||w===2&&!!N,f(b)}}}class WA{constructor(){this.map=[],this.index=new Map}add(t,i,r){XA(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 XA(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 GA(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 QA(){return{flow:{null:{name:"table",tokenize:ZA,resolveAll:JA}}}}function ZA(e,t,i){const r=this;let a=0,c=0,h;return f;function f(I){let G=r.events.length-1;for(;G>-1;){const{type:U}=r.events[G][1];if(U==="lineEnding"||U==="linePrefix")G--;else break}const F=G>-1?r.events[G][1].type:null,O=F==="tableHead"||F==="tableRow"?z:g;return O===z&&r.parser.lazy[r.now().line]?i(I):O(I)}function g(I){return e.enter("tableHead"),e.enter("tableRow"),m(I)}function m(I){return I===124||(h=!0,c+=1),v(I)}function v(I){return I===null?i(I):Ue(I)?c>1?(c=0,r.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(I),e.exit("lineEnding"),y):i(I):Ze(I)?dt(e,v,"whitespace")(I):(c+=1,h&&(h=!1,a+=1),I===124?(e.enter("tableCellDivider"),e.consume(I),e.exit("tableCellDivider"),h=!0,v):(e.enter("data"),_(I)))}function _(I){return I===null||I===124||Ct(I)?(e.exit("data"),v(I)):(e.consume(I),I===92?S:_)}function S(I){return I===92||I===124?(e.consume(I),_):_(I)}function y(I){return r.interrupt=!1,r.parser.lazy[r.now().line]?i(I):(e.enter("tableDelimiterRow"),h=!1,Ze(I)?dt(e,b,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(I):b(I))}function b(I){return I===45||I===58?E(I):I===124?(h=!0,e.enter("tableCellDivider"),e.consume(I),e.exit("tableCellDivider"),w):q(I)}function w(I){return Ze(I)?dt(e,E,"whitespace")(I):E(I)}function E(I){return I===58?(c+=1,h=!0,e.enter("tableDelimiterMarker"),e.consume(I),e.exit("tableDelimiterMarker"),N):I===45?(c+=1,N(I)):I===null||Ue(I)?B(I):q(I)}function N(I){return I===45?(e.enter("tableDelimiterFiller"),A(I)):q(I)}function A(I){return I===45?(e.consume(I),A):I===58?(h=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(I),e.exit("tableDelimiterMarker"),R):(e.exit("tableDelimiterFiller"),R(I))}function R(I){return Ze(I)?dt(e,B,"whitespace")(I):B(I)}function B(I){return I===124?b(I):I===null||Ue(I)?!h||a!==c?q(I):(e.exit("tableDelimiterRow"),e.exit("tableHead"),t(I)):q(I)}function q(I){return i(I)}function z(I){return e.enter("tableRow"),D(I)}function D(I){return I===124?(e.enter("tableCellDivider"),e.consume(I),e.exit("tableCellDivider"),D):I===null||Ue(I)?(e.exit("tableRow"),t(I)):Ze(I)?dt(e,D,"whitespace")(I):(e.enter("data"),$(I))}function $(I){return I===null||I===124||Ct(I)?(e.exit("data"),D(I)):(e.consume(I),I===92?ae:$)}function ae(I){return I===92||I===124?(e.consume(I),$):$(I)}}function JA(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 WA;for(;++i<e.length;){const y=e[i],b=y[1];y[0]==="enter"?b.type==="tableHead"?(f=!1,g!==0&&(FS(S,t,g,m,v),v=void 0,g=0),m={type:"table",start:Object.assign({},b.start),end:Object.assign({},b.end)},S.add(i,0,[["enter",m,t]])):b.type==="tableRow"||b.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({},b.start),end:Object.assign({},b.end)},S.add(i,0,[["enter",v,t]])),a=b.type==="tableDelimiterRow"?2:v?3:1):a&&(b.type==="data"||b.type==="tableDelimiterMarker"||b.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)):b.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])):b.type==="tableHead"?(f=!0,g=i):b.type==="tableRow"||b.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&&(b.type==="data"||b.type==="tableDelimiterMarker"||b.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=GA(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 b=i[2]+1,w=i[3]-i[2]-1;e.add(b,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 eR={name:"tasklistCheck",tokenize:nR};function tR(){return{text:{91:eR}}}function nR(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 Ct(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 Ue(g)?t(g):Ze(g)?e.check({tokenize:iR},t,i)(g):i(g)}}function iR(e,t,i){return dt(e,r,"whitespace");function r(a){return a===null?i(a):t(a)}}function sR(e){return Ox([TA(),IA(),YA(e),QA(),tR()])}const rR={};function lR(e){const t=this,i=e||rR,r=t.data(),a=r.micromarkExtensions||(r.micromarkExtensions=[]),c=r.fromMarkdownExtensions||(r.fromMarkdownExtensions=[]),h=r.toMarkdownExtensions||(r.toMarkdownExtensions=[]);a.push(sR(i)),c.push(kA()),h.push(NA(i))}function Vp(e){return e.trim()===""?null:u.jsx("div",{className:"md",children:u.jsx(I3,{remarkPlugins:[lR],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 aR(e){return Object.entries(e??{}).map(([t,i])=>({key:t,value:i}))}function oR(e){const t={};for(const i of e){const r=i.key.trim();r!==""&&(t[r]=i.value.trim())}return t}function cR(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 uR(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 hR(e,t){return t===void 0?!e:t.kind==="user"}function dR(e){return`已编辑 ${String(e)} 个文件`}function fR(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 mR(e){return e==="A"?"新增":e==="D"?"删除":"修改"}function pR(e){return e.binary===!0?"二进制":fR(e.added,e.removed)}function gR(e){return`撤销本轮对 ${String(e)} 个文件的改动,回到本轮开始前的快照。之后若这些文件又被改过,也会退回那个快照的内容;对话记录不受影响。`}function _R(e){return`另有 ${String(e)} 个写入被拒绝(权限 / Guardian),未计入上面的增删`}function vR(e){return`已撤销本轮 ${String(e)} 个文件的改动`}function yR(e){const t=e.lastIndexOf("/");return t<0?{名:e,目录:""}:{名:e.slice(t+1),目录:e.slice(0,t+1)}}function SR({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),b=e.files.length,w=async()=>{m(!0),y(null);try{await u2(t,e.key),_(!0),f(!1),r()}catch(E){y(E instanceof Error?E.message:String(E))}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(E=>!E)},children:[u.jsx("span",{className:"edit-icon","aria-hidden":"true",children:"▣"}),u.jsx("span",{className:"edit-title",children:v?vR(b):dR(b)}),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:gR(b)}),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(E=>{const{名:N,目录:A}=yR(E.path);return u.jsxs("div",{className:"edit-row",children:[u.jsx("span",{className:v?"edit-name done":"edit-name",children:v?`${mR(E.status)} · ${N}`:N}),u.jsx("span",{className:"edit-dir",children:A}),u.jsx("span",{className:"edit-fstat",children:v?"已回到快照":E.binary===!0?pR(E):u.jsxs(u.Fragment,{children:[Tl(E.added,E.removed).add===""?null:u.jsx("span",{className:"add",children:Tl(E.added,E.removed).add}),Tl(E.added,E.removed).del===""?null:u.jsx("span",{className:"del",children:Tl(E.added,E.removed).del})]})})]},E.path)})}),u.jsxs("div",{className:"edit-foot",children:[e.denied>0?u.jsxs("span",{children:[_R(e.denied),"。 "]}):null,v?"对话与工具行不动;工作区已回到本轮开始前的快照。":"点「查看变更」→ 右栏「变更」页签,看每个文件的真 diff。"]})]}):null]})}function bR({等确认: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 xR=e=>/^(?:\[图片 #\d+\]\s*)+$/u.test(e.trim()),wR=e=>e<1e3?"不到 1 秒":e<6e4?`${String(Math.round(e/1e3))} 秒`:`${String(Math.floor(e/6e4))} 分 ${String(Math.round(e%6e4/1e3))} 秒`,CR=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)},Ff=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},kR=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,NR=e=>["bash","run_command","shell"].includes(e);function ER({call:e}){const t=CR(e.output),i=e.state!=="running"&&NR(e.toolName)&&t.trim()!=="",[r,a]=C.useState(()=>e.state==="error");C.useEffect(()=>{e.state==="error"&&a(!0)},[e.state]);const c=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:kR(e.toolName)}),u.jsx("span",{className:"target",title:Ff(e),children:Ff(e)}),i?u.jsx("span",{className:"out-hint",children:r?"收起输出":"展开输出"}):null,u.jsx("span",{className:e.state==="running"?"state":"state ok",children:e.state==="running"?"进行中":e.state==="error"?"失败":"完成"})]});return u.jsxs(u.Fragment,{children:[i?u.jsx("button",{type:"button",className:"tool-row clickable","aria-expanded":r,onClick:()=>{a(h=>!h)},children:c}):u.jsx("div",{className:"tool-row",children:c}),i&&r?u.jsxs("div",{className:"terminal",children:[u.jsxs("div",{className:"bar",children:[u.jsx("span",{className:"dot"}),u.jsxs("span",{className:"t",children:["$ ",Ff(e)]})]}),u.jsx("pre",{className:"out",children:t.length>1200?`${t.slice(0,1200)}
44
+ …(已截断)`:t})]}):null]})}function jR({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 TR({parts:e,model:t,durationMs:i,收尾:r,改动:a,session:c,onViewChanges:h,分叉:f,onFork:g,forkError:m}){const v=e[0],[_,S]=C.useState(null),y=async()=>{const b=e.map(w=>w.text).join("");S(await CE(b)?"ok":"err"),window.setTimeout(()=>{S(null)},2e3)};return u.jsx("div",{className:"turn","data-dsh-part":"message-row","data-seq":v?.seq,"data-seq-list":e.map(b=>String(b.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}),v?.ts===void 0?null:u.jsx("span",{className:"ai-time",children:new Date(v.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:"✓"}),"已完成,用时 ",wR(i)]}):null,e.map((b,w)=>{const E=b.reasoning.trim();return u.jsxs("div",{className:"assistant-part",children:[E===""?null:u.jsx(jR,{text:E}),b.text.trim()===""?null:Vp(b.text),b.toolCalls.map(N=>u.jsx(ER,{call:N},N.toolCallId))]},`${String(b.seq)}-${String(w)}`)}),r===!0&&a!==void 0&&c!==void 0&&c!==""?u.jsx(SR,{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:()=>{y()},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"})]})}),f==null||g===void 0?null:u.jsxs("button",{className:"msg-tool fork",title:"新会话保留到这条回答为止,源会话只读",onClick:()=>{g(f)},children:[u.jsx("span",{className:"g",children:"⑂"})," 从这条回答分叉"]}),_===null?null:u.jsx("span",{className:_==="ok"?"copy-hint ok":"copy-hint err",children:_==="ok"?"已复制":"复制失败"})]}),m==null?null:u.jsx("div",{className:"msg-error",children:m})]})]})})}function j1({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,onFork:b,onReanswer:w,focusSeq:E}){const N=C.useRef(Date.now());C.useEffect(()=>{N.current=Date.now()},[e,r,m.length]);const[A,R]=C.useState(()=>Date.now());C.useEffect(()=>{if(!S)return;const me=setInterval(()=>{R(Date.now())},1e3);return()=>{clearInterval(me)}},[S]);const B=Math.max(0,Math.round((A-N.current)/1e3)),q=e?.session,[z,D]=C.useState(null),$=C.useCallback(async()=>{if(q===void 0||q===""){D(null);return}try{const me=await c2(q);D(me.ok?me:null)}catch{D(null)}},[q]);C.useEffect(()=>{S||$()},[$,S]);const[ae,I]=C.useState(null),[G,F]=C.useState(null),[O,U]=C.useState(null),[K,V]=C.useState(null);C.useEffect(()=>{if(q===void 0||q===""){I(null);return}if(S)return;let me=!0;return(async()=>{try{const M=await e2(q);if(!me)return;I(new Set(M.anchors))}catch{me&&I(null)}})(),()=>{me=!1}},[q,S]);const se=async me=>{if(!(b===void 0||G!==null)){U(null),F(me.at);try{await b(me)}catch(M){U({seq:me.at,message:M instanceof Error?M.message:String(M)})}finally{F(null)}}};if(C.useEffect(()=>{if(E===void 0)return;const me=String(E),M=[...document.querySelectorAll("[data-seq]")].find(Z=>Z.getAttribute("data-seq")===me||(Z.getAttribute("data-seq-list")??"").split(" ").includes(me));if(!(M instanceof HTMLElement))return;M.scrollIntoView({block:"center"}),M.classList.add("msg-flash");const j=window.setTimeout(()=>{M.classList.remove("msg-flash")},2200);return()=>{window.clearTimeout(j)}},[E,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 ee=e.turns.filter(me=>me.source!=="context"),ge=Math.max(0,ee.length-c),T=ge===0?ee:ee.slice(ge),De=e.todos.filter(me=>me.status==="completed").length;return ee.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"})}),De," / ",e.todos.length," 步"]})]}),ge>0?u.jsxs("div",{className:"load-earlier",children:[u.jsxs("button",{className:"btn",onClick:h,children:["载入更早的 ",ge," 条"]}),u.jsxs("span",{className:"muted",children:["更早的记录已折叠(",ge," 条)"]})]}):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:[De," / ",e.todos.length]})]}),u.jsx("ul",{className:"plan-list",children:e.todos.map(me=>u.jsxs("li",{className:me.status==="completed"?"done":me.status==="in_progress"?"doing":void 0,children:[u.jsx("span",{className:me.status==="in_progress"?"tick g g-accent":"tick g",children:me.status==="completed"?"✓":me.status==="in_progress"?"◌":""}),me.content]},me.id))})]}),(()=>{const me=ie=>{if(ie===void 0)return;const pe=Date.parse(ie);return Number.isNaN(pe)?void 0:pe};let M=0,j=0,Z=0;const re=uR(T);return re.map((ie,pe)=>{if(ie.kind==="user"){M=me(ie.turn.ts)??M,j=ie.turn.seq,Z+=1;const Ee=Z,at=ie.turn.seq;return u.jsxs("div",{className:"turn user-turn","data-seq":ie.turn.seq,children:[(()=>{const We=b!==void 0&&$S(ae,at),ut=w!==void 0&&ie.turn.source!=="context"&&ie.turn.text.trim()!=="";return!We&&!ut?null:u.jsxs("div",{className:"msg-tools",children:[We?u.jsxs("button",{className:"msg-tool fork",title:"新会话保留到这句为止,让它重新答;源会话只读",disabled:G!==null,onClick:()=>{se({at,quote:ie.turn.text,round:Ee,ts:ie.turn.ts,kind:"user"})},children:[u.jsx("span",{className:"g",children:"⑂"})," 从这句分叉"]}):null,ut?u.jsxs("button",{className:"msg-tool primary",title:"从这句问题之前分叉,自动重发同一句话(新会话重跑,源会话保留)",onClick:()=>{V(null),w({seq:ie.turn.seq,text:ie.turn.text,...ie.turn.ts===void 0?{}:{ts:ie.turn.ts},...ie.turn.images===void 0?{}:{images:ie.turn.images}}).catch(Te=>{V({seq:at,message:Te instanceof Error?Te.message:String(Te)})})},children:[u.jsx("span",{className:"g",children:"↻"})," 重答"]}):null]})})(),u.jsxs("div",{children:[ie.turn.images===void 0||ie.turn.images.length===0?null:u.jsx("div",{className:"user-images",children:ie.turn.images.map(We=>{const ut=`/file/raw?path=${encodeURIComponent(We.path)}`;return u.jsx("a",{className:"user-image",href:ut,target:"_blank",rel:"noreferrer",children:u.jsx("img",{src:ut,alt:"",loading:"lazy"})},We.path)})}),xR(ie.turn.text)?null:u.jsx("div",{className:"user-bubble",children:lE(ie.turn.text).map((We,ut)=>We.mention?u.jsx("span",{className:"mention",children:We.text},`m-${String(ut)}`):u.jsx("span",{children:We.text},`t-${String(ut)}`))}),u.jsx("div",{className:"user-meta",children:ie.turn.ts===void 0?null:u.jsx("span",{children:new Date(ie.turn.ts).toLocaleTimeString("zh-CN",{hour:"2-digit",minute:"2-digit"})})}),O!==null&&O.seq===at?u.jsx("div",{className:"msg-error",children:O.message}):null,K!==null&&K.seq===at?u.jsx("div",{className:"msg-error",children:K.message}):null]})]},`${String(ie.turn.seq)}-${String(pe)}`)}const ve=ie.parts.at(-1),je=me(ve?.ts),de=M>0&&je!==void 0&&je>M?je-M:void 0,be=re[pe+1],Ae=z?.turns.find(Ee=>Ee.key===j),st=hR(S,be),oe=cR(ie.parts),_e=b!==void 0&&st&&$S(ae,oe),Ce=[...ie.parts].reverse().find(Ee=>Ee.text.trim()!=="")?.text.trim()??"(这条回答没有正文)";return u.jsx(TR,{parts:ie.parts,model:e?.model,durationMs:de,收尾:st,改动:Ae,session:e?.session,onViewChanges:y,分叉:_e&&oe!==null?{at:oe,quote:Ce,round:Z,ts:ve?.ts,kind:"assistant"}:null,onFork:Ee=>{se(Ee)},forkError:O!==null&&O.seq===oe?O.message:null},`a-${String(ve?.seq??pe)}-${String(pe)}`)})})(),S?u.jsx(bR,{等确认:m.length,静默秒:B}):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})]}),Vp(r),u.jsx("span",{className:"live-cursor",children:"▌"}),a>0?u.jsxs("div",{className:"muted",children:["(有 ",a," 帧增量丢失——以最终消息为准)"]}):null]})]})}),m.map(me=>u.jsx(P2,{ask:me,onAnswer:_},me.id)),v.map(me=>u.jsx(q2,{record:me},`${me.id}-${String(me.atMs)}`))]})}function T1({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 DR(e,t){return Oe(`/team/member?session=${encodeURIComponent(e)}&name=${encodeURIComponent(t)}`)}function VS(e,t,i){return Oe("/team/message",Ye({session:e,to:t,content:i}))}function MR(e,t,i){return Oe("/team/wake",Ye({session:e,to:t,prompt:i}))}function AR(e,t){return e==="failed"||e==="released"?"disabled":e==="running"||e==="provisioning"?"queue":t?"wake":"queue"}const RR=e=>e==="running"?"运行中":e==="idle"?"空闲":e==="failed"?"失败":e==="provisioning"?"启动中":"已释放";function OR({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),b=C.useCallback(async(B=!1)=>{B||h(null);try{const q=await DR(e,t);y.current&&a(q)}catch(q){B||h(q instanceof Error?q.message:String(q))}},[e,t]);C.useEffect(()=>{y.current=!0,b();const B=window.setInterval(()=>{b(!0)},3e3);return()=>{y.current=!1,window.clearInterval(B)}},[b]);const w=B=>{S(B),window.setTimeout(()=>{S(null)},2600)},E=async()=>{const B=f.trim();if(!(B===""||r===null||m)&&!(r.member.status==="released"||r.member.status==="failed")){v(!0),h(null);try{if(A==="wake")try{await MR(e,t,B),g(""),w("已唤醒:未读已并入 prompt")}catch(q){if((q instanceof Error?q.message:String(q)).includes("父会话没在跑"))await VS(e,t,B),g(""),w("父会话空闲:已入队,等下次唤醒读取(未送达)");else throw q}else await VS(e,t,B),g(""),w("已入队:等它读取(未送达)");await b(!0)}catch(q){h(q instanceof Error?q.message:String(q))}finally{v(!1)}}},N=r?.member,A=N===void 0?"disabled":AR(N.status,r?.canWake===!0),R=A==="disabled"||m;return u.jsx("div",{className:"tm-mask",onMouseDown:i,children:u.jsxs("aside",{className:"tm-drawer",role:"dialog","aria-label":"子智能体会话",onMouseDown:B=>{B.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:RR(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(B=>!B.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(B=>u.jsxs("div",{className:"tm-pmsg",children:[u.jsx("div",{className:"tm-pmsg-text",children:B.content}),u.jsxs("div",{className:"tm-pmsg-meta",children:[u.jsx("span",{children:B.id}),u.jsx("span",{className:B.delivered?"delivered":"queued",children:B.delivered?"已送达":"待投递"})]})]},B.id))]}),u.jsx("div",{className:"tm-thread",children:r.child.readable&&r.child.thread!==void 0?u.jsx(j1,{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:R,onChange:B=>{g(B.target.value)},onKeyDown:B=>{B.key==="Enter"&&!B.shiftKey&&(B.preventDefault(),E())}}),u.jsx("button",{className:"tm-send",type:"button",disabled:R||f.trim()==="",onClick:()=>{E()},children:m?"…":"发送"})]}),u.jsx("div",{className:"tm-note",children:A==="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 BR({title:e,session:t,thread:i,onToggleTheme:r,onSend:a,onStop:c,onBack:h,onTrajectory:f,onSideChat:g,onViewChanges:m,onFork:v,onReanswer:_,focusSeq:S}){const[y,b]=C.useState(""),[w,E]=C.useState(!1),N=C.useRef(null),A=vx(Te=>{N.current?.addFiles(Te)}),[R,B]=C.useState(!1),[q,z]=C.useState(0),D=w||R,[$,ae]=C.useState(KS);C.useEffect(()=>{const Te=i.view;S===void 0||Te===null||ae(ze=>Math.max(ze,Te.turns.length))},[S,i.view]);const[I,G]=C.useState([]),[F,O]=C.useState(null),[U,K]=C.useState(null),[V,se]=C.useState(null),[ee,ge]=C.useState(null),T=C.useRef(null),De=Te=>{T.current!==null&&window.clearTimeout(T.current),ge(Te),T.current=window.setTimeout(()=>{ge(null)},2600)};C.useEffect(()=>()=>{T.current!==null&&window.clearTimeout(T.current)},[]);const me=z2(t),[M,j]=C.useState(null),Z=C.useRef(null),re=C.useRef(i.reload);re.current=i.reload;const ie=C.useRef(0);C.useEffect(()=>{const Te=Z.current;if(Te===null)return;const ze=i.view?.turns.length??0;ze<=ie.current&&i.liveText===""||(ie.current=ze,Te.scrollTop=Te.scrollHeight)},[i.view,i.liveText]),C.useEffect(()=>{if(!D)return;const Te=setInterval(()=>{z(ze=>ze+1)},1e3);return()=>{clearInterval(Te)}},[D]),C.useEffect(()=>{if(t===null){B(!1);return}let Te=!0;const ze=async()=>{try{const Ot=await ux(t);if(!Te)return;B(jt=>(jt&&!Ot.running&&re.current(),Ot.running)),Ot.running||E(!1)}catch{}};ze();const mt=setInterval(()=>{ze()},2e3);return()=>{Te=!1,clearInterval(mt)}},[t]);const pe=(Te,ze)=>{const mt=Te.trim();if(mt==="")return;const Ot=bp(mt);if(Ot!==null){if(b(""),t===null){De("先发一句话建会话,再设目标");return}if(Ot.kind==="usage"){De("用法:/goal <目标>");return}E(!0),q0(t,"set",Ot.objective).then(async()=>{await i.reload(),De("目标已设定")}).catch(jt=>{De(jt instanceof Error?jt.message:String(jt))}).finally(()=>{E(!1)});return}b(""),z(0),E(!0),a(mt,ze).finally(()=>{E(!1)})},ve=Te=>{t!==null&&q0(t,Te).then(async()=>{await i.reload(),De(Te==="pause"?"目标已暂停":Te==="resume"?"目标已恢复":"已清除目标")}).catch(ze=>{De(ze instanceof Error?ze.message:String(ze))})},je=()=>{if(t===null)return;const Te=i.view?.planMode!==!0;M2(t,Te).then(async()=>{await i.reload(),De(Te?"计划模式已开启(只读)":"计划模式已关闭")}).catch(ze=>{De(ze instanceof Error?ze.message:String(ze))})},de=async Te=>{K(null);try{await Te(),await i.reload()}catch(ze){K(ze instanceof Error?ze.message:String(ze))}},be=Te=>{if(t===null)return;const ze=Te.trim();ze!==""&&(b(""),de(async()=>{await R2(t,ze)}))},Ae=()=>{if(t===null)return;const Te=i.view?.inbox.pending??[];Te.length!==0&&de(async()=>{for(const ze of Te)ze.placement!=="steering"&&await F0(t,ze.id,"steering")})},st=()=>{i.reload()},oe=new Set(I.map(Te=>Te.id)),_e=(i.view?.asks.pending??[]).filter(Te=>!oe.has(Te.id)),Ce=_e.filter(Te=>Te.kind==="permission"),Ee=_e.filter(Te=>Te.kind==="question"),at=Ce[0],We=Te=>{t!==null&&g2(t,Te).then(async()=>{O(null),await i.reload()}).catch(ze=>{O(ze instanceof Error?ze.message:String(ze))})},ut=async Te=>{if(t===null)return;const ze=_e.find(mt=>mt.id===Te.id);try{await d2(t,Te)}catch(mt){const Ot=mt instanceof Error?mt.message:String(mt);ze!==void 0&&G(jt=>[...jt,{id:ze.id,kind:ze.kind,question:ze.question,reason:Ot,atMs:Date.now()}])}finally{await i.reload()}};return u.jsxs("div",{className:"view",style:{display:"flex"},...A.handlers,children:[u.jsx(T1,{title:e,running:D,showShare:!0,onToggleTheme:r,onTrajectory:f,...g===void 0?{}:{onSideChat:g},panels:u.jsx(X2,{team:me.team,agents:me.agents,jobs:me.jobs,open:M,onOpen:Te=>{j(ze=>ze===Te?null:Te)}})}),M===null||t===null?null:u.jsx(G2,{kind:M,panel:me,session:t,onClose:()=>{j(null)},onOpenMember:Te=>{se(Te),j(null)}}),u.jsxs("div",{className:"thread",ref:Z,"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:st,children:"立即重连"})]}):null,u.jsx("div",{className:"thread-inner",children:u.jsx(j1,{view:i.view,loading:i.loading,error:i.error,liveText:i.liveText,liveDropped:i.liveDropped,visible:$,onLoadEarlier:()=>{ae(Te=>Te+KS)},onRetry:()=>{i.reload()},onBack:h,questions:Ee,expired:I,onAnswer:ut,busy:D,onViewChanges:m,onFork:v,onReanswer:_,focusSeq:S})})]}),u.jsxs("div",{className:"composer-wrap","data-dsh-surface":"composer",children:[ee===null?null:u.jsx("div",{className:"goal-toast",children:ee}),i.view?.goal===void 0?null:u.jsx(xE,{goal:i.view.goal,busy:D,onPause:()=>{ve("pause")},onResume:()=>{ve("resume")},onClear:()=>{ve("clear")}}),at===void 0?null:u.jsx(U2,{ask:at,count:Ce.length,onAnswer:ut}),t===null?null:u.jsx(wE,{pending:i.view?.inbox.pending??[],onEdit:async(Te,ze)=>{await de(async()=>{await O2(t,Te,ze)})},onRemove:async Te=>{await de(async()=>{await B2(t,Te)})},onSteer:async Te=>{await de(async()=>{await F0(t,Te,"steering")})}}),U===null?null:u.jsx("div",{className:"q-error standalone",children:U}),D?u.jsxs("div",{className:"composer-status",children:[u.jsx("span",{className:"g g-run",children:"◌"})," 运行中 · ",q,"s",u.jsxs("span",{style:{marginLeft:"auto"},children:[Ce.length>1?`还有 ${String(Ce.length)} 个等待确认`:"",(i.view?.inbox.pending.length??0)===0?null:` · 排队 ${String(i.view?.inbox.pending.length)} 条`]})]}):null,u.jsx(SE,{name:yE.输入卡Dock}),u.jsx(_x,{ref:N,value:y,onChange:b,contextLabel:"ctx —",session:t??void 0,profile:i.view?.profile,onProfile:We,busy:D,onSend:pe,onQueue:be,onInterjectAll:Ae,planMode:i.view?.planMode===!0,planDisabled:D,onTogglePlan:je,onStop:()=>{E(!1),c()}})]}),A.dragging?u.jsx(yx,{}):null,V===null||t===null?null:u.jsx(OR,{session:t,name:V,onClose:()=>{se(null)}})]})}const D1=280,M1=640,Xs=420;function Kp(e){if(e==null||e==="")return Xs;const t=typeof e=="number"?e:Number(e);return Number.isFinite(t)?Math.min(M1,Math.max(D1,Math.round(t))):Xs}const A1="daluo.dock.width",Fn=()=>{try{return typeof localStorage>"u"?null:localStorage}catch{return null}};function LR(e=Fn()){if(e===null)return Xs;try{return Kp(e.getItem(A1))}catch{return Xs}}function $f(e=Fn(),t){const i=t===void 0?Xs:Kp(t);if(e===null)return i;try{e.setItem(A1,String(i))}catch{}return i}const zR=new Set(["png","jpg","jpeg","gif","webp","svg","bmp","ico","avif","heic"]),HR=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"]),IR=new Set(["txt","log","csv","tsv","env","lock","gitignore","editorconfig","patch","diff","license"]),UR=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 R1(e){const t=e.slice(e.lastIndexOf("/")+1),i=t.lastIndexOf("."),r=(i>0?t.slice(i+1):t).toLowerCase();return zR.has(r)?"image":r==="pdf"?"pdf":r==="md"||r==="markdown"||r==="mdx"?"markdown":HR.has(r)?"code":IR.has(r)||t==="LICENSE"||t==="Makefile"||t==="Dockerfile"?"text":UR.has(r)?"binary":"text"}function PR(e){return e==="code"||e==="markdown"||e==="text"}const qR={docx:"DOCX",doc:"DOC",xlsx:"XLSX",xls:"XLS",pptx:"PPTX",ppt:"PPT"};function FR(e){const t=e.slice(e.lastIndexOf("/")+1),i=t.lastIndexOf(".");return i<=0?null:qR[t.slice(i+1).toLowerCase()]??null}function Yp(e){const t=e.lastIndexOf("/");return t<0?{dir:"",name:e}:{dir:e.slice(0,t),name:e.slice(t+1)}}function $R(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 VR(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 KR=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 YR(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:KR.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 O1(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 WR(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:WR(e,t)}];return e!==""&&i.push({id:"reveal",label:"在 Finder 中显示",hint:Yp(t).name}),i}function XS(e){return e.kind==="running"?"运行中":e.exitCode!==null?`已退出 ${String(e.exitCode)}`:`已退出 ${e.signal??"未知"}`}const Am=360,Rm=280,XR=620,GR=468,B1="daluo.dock.float",L1="daluo.dock.float.rect",z1="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(Am,Math.min(XR,e.width-Fi*2)),i=Math.max(Rm,Math.min(GR,e.height-Fi*2));return{x:Math.round((e.width-t)/2),y:56,width:t,height:i}}function H1(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(Am,t.width-Fi*2),h=Math.max(Rm,t.height-Fi*2),f=Math.min(c,Math.max(Am,a(r.width,i.width))),g=Math.min(h,Math.max(Rm,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 QR(e,t=vo()){if(e===null||e.trim()==="")return co(t);try{return H1(JSON.parse(e),t)}catch{return co(t)}}function ZR(e=Fn(),t=vo()){if(e===null)return co(t);try{return QR(e.getItem(L1),t)}catch{return co(t)}}function br(e=Fn(),t,i=vo()){const r=H1(t,i);if(e!==null)try{e.setItem(L1,JSON.stringify(r))}catch{}return r}function JR(e=Fn()){if(e===null)return!1;try{return e.getItem(B1)==="1"}catch{return!1}}function eu(e=Fn(),t){if(e!==null)try{e.setItem(B1,t?"1":"0")}catch{}return t}function e4(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 Wp(e){return e4(e)}const I1="daluo.term.split.ratio";function t4(e=Fn()){if(e===null)return .5;try{return Wp(e.getItem(I1))}catch{return .5}}function Vf(e=Fn(),t){const i=t===void 0?.5:Wp(t);if(e!==null)try{e.setItem(I1,String(i))}catch{}return i}function n4(e=Fn()){if(e===null)return!1;try{return e.getItem(z1)==="1"}catch{return!1}}function Kf(e=Fn(),t){if(e!==null)try{e.setItem(z1,t?"1":"0")}catch{}return t}const i4=140,s4=240,uo=176,U1="daluo.files.tree";function Xp(e){if(e==null||e==="")return uo;const t=typeof e=="number"?e:Number(e);return Number.isFinite(t)?Math.min(s4,Math.max(i4,Math.round(t))):uo}function r4(e=Fn()){if(e===null)return uo;try{return Xp(e.getItem(U1))}catch{return uo}}function GS(e=Fn(),t){const i=t===void 0?uo:Xp(t);if(e!==null)try{e.setItem(U1,String(i))}catch{}return i}const P1="daluo.dock.float.pinned";function l4(e=Fn()){if(e===null)return!1;try{return e.getItem(P1)==="1"}catch{return!1}}function QS(e=Fn(),t){if(e!==null)try{e.setItem(P1,t?"1":"0")}catch{}return t}function a4({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),[b,w]=C.useState(!1),[E,N]=C.useState(!1);C.useEffect(()=>{g!==null&&A(g)},[i]);const A=C.useCallback(async D=>{m(D),_(""),w(!0);try{const $=await i2(D);_($.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&&A(e.changed[0]?.path??"")},[e,g,A]),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 R=e.changed.filter(D=>h.trim()===""||D.path.toLowerCase().includes(h.trim().toLowerCase())),B=g===null?null:VR(v),q=B?.增??0,z=B?.删??0;return u.jsxs("div",{className:E?"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," 个改动"]}),B===null?null:u.jsxs("span",{className:"stat",title:"当前选中文件的增删",children:[u.jsxs("span",{className:"plus",children:["+",q]}),u.jsxs("span",{className:"minus",children:["−",z]})]}),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:D=>{f(D.target.value)},onKeyDown:D=>{D.key==="Escape"&&f("")}}),h===""?null:u.jsx("button",{className:"clear",title:"清空 (Esc)",onClick:()=>{f("")},children:"✕"})]}),E?null:u.jsxs("div",{className:"changes-list",children:[R.map(D=>{const $=O1(D);return u.jsxs("div",{className:g===D.path?"change sel":"change",title:D.path,onClick:()=>{A(D.path)},children:[u.jsx("span",{className:`st ${$}`,children:$}),u.jsx("span",{className:"p",children:D.path})]},D.path)}),R.length===0?u.jsx("div",{className:"tree-hint",children:"没有匹配的改动"}):null]}),g===null?null:u.jsxs("div",{className:E?"diff expanded":"diff",children:[u.jsxs("div",{className:"diff-head",children:[u.jsx("span",{className:"path",title:g,children:g}),B===null?null:u.jsxs("span",{className:"stat",children:[u.jsxs("span",{className:"plus",children:["+",B.增]}),u.jsxs("span",{className:"minus",children:["−",B.删]})]}),u.jsx("button",{className:"link-btn",onClick:()=>{N(D=>!D)},children:E?"收起":"展开"})]}),S?u.jsx("div",{className:"hunk",children:"(diff 太大,已截断)"}):null,b?u.jsx("div",{className:"hunk",children:"读取 diff…"}):null,!b&&v===""?u.jsx("div",{className:"hunk",children:"(无 diff 内容)"}):null,B?.行.map((D,$)=>u.jsxs("div",{className:`dl ${D.kind==="add"?"a":D.kind==="del"?"d":D.kind==="hunk"?"h":D.kind==="meta"?"m":"x"}`,children:[u.jsx("span",{className:"dn",children:D.oldLine??""}),u.jsx("span",{className:"dn",children:D.newLine??""}),u.jsx("span",{className:"dc",children:D.text})]},$))]})]})}function o4(e){return Oe(`/revert?session=${encodeURIComponent(e)}`)}function c4(e,t){return Oe("/revert",Ye({session:e,to:t,plan:!0}))}function u4(e,t){return Oe("/revert",Ye({session:e,to:t}))}function h4({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),b=C.useCallback(async()=>{if(e===null){r(null);return}try{r(await o4(e)),m(null)}catch(N){m(N instanceof Error?N.message:String(N))}},[e]);C.useEffect(()=>{c(null),f(null),y(null),b()},[b]);const w=async N=>{if(!(e===null||v)){_(!0),m(null),y(null);try{c(N.toSeq),f((await c4(e,N.toSeq)).plan)}catch(A){m(A instanceof Error?A.message:String(A))}finally{_(!1)}}},E=async()=>{if(!(e===null||h===null||v)){_(!0),m(null);try{const N=await u4(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:()=>{E()},children:v?"回退中…":"确认回退(产出新会话)"}),u.jsx("button",{className:"btn",disabled:v,onClick:()=>{f(null),c(null)},children:"取消"})]})]})]})}function d4({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 ax({target:"finder",path:t,reveal:!0}),c(`已在 Finder 中选中 ${Yp(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 Yf=(e,t)=>e===""?t:`${e}/${t}`,f4=e=>e.startsWith(".")||q1.has(e),q1=new Set(["node_modules",".git","dist","build","target","venv",".venv","__pycache__",".next",".cache",".turbo"]);function m4({path:e}){const t=R1(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 p4({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}),b=C.useRef({});b.current=h;const w=C.useCallback(async B=>{try{const q=await z0(B);f(z=>({...z,[B]:q})),_(null)}catch(q){_(q instanceof Error?q.message:String(q))}},[]);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 B=!1;const q=async()=>{y({state:"walking",dirs:0});const D=new Set,$=[""];let ae=0;for(;$.length>0&&ae<300&&!B;){const I=$.shift();if(D.has(I))continue;D.add(I),ae+=1;let G=b.current[I];if(G===void 0){try{G=await z0(I)}catch{continue}if(B)return;f(F=>({...F,[I]:G}))}for(const F of G.entries)F.type==="directory"&&!F.name.startsWith(".")&&!q1.has(F.name)&&$.push(Yf(I,F.name))}B||y({state:$.length>0?"capped":"done",dirs:ae})},z=setTimeout(()=>{q()},180);return()=>{B=!0,clearTimeout(z)}},[r]);const E=B=>{m(q=>{const z=new Set(q);return z.has(B)?z.delete(B):z.add(B),z}),h[B]===void 0&&w(B)},N=B=>r===""||B.toLowerCase().includes(r),A=B=>{if(r==="")return!0;const q=h[B];return q===void 0?!1:q.entries.some(z=>{const D=Yf(B,z.name);return z.type==="directory"?A(D):N(D)})},R=(B,q)=>{const z=h[B];if(z===void 0)return g.has(B)?u.jsx("div",{className:"tree-hint",style:{paddingLeft:`${String(8+q*16)}px`},children:"读取中…"},`loading-${B}`):null;const D=[];for(const $ of z.entries){const ae=Yf(B,$.name),I=8+q*16;if($.type==="directory"){if(f4($.name)||!A(ae))continue;const G=g.has(ae)||r!=="";D.push(u.jsxs("div",{className:"tree-item dir",style:{paddingLeft:`${String(I)}px`},onClick:()=>{E(ae)},title:ae,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})]},ae)),G&&D.push(R(ae,q+1))}else if($.type==="file"&&N(ae)){const G=i.get(ae);D.push(u.jsxs("div",{className:e===ae?"tree-item sel":"tree-item",style:{paddingLeft:`${String(I)}px`},onClick:()=>{t(ae)},onContextMenu:F=>{F.preventDefault(),c?.(ae,F.clientX,F.clientY)},title:ae,children:[u.jsx(m4,{path:ae}),u.jsx("span",{className:"nm",children:$.name}),G===void 0?null:u.jsx("span",{className:`tag ${G}`,children:G})]},ae))}}return u.jsx("div",{children:D},`dir-${B}`)};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:R("",0)})]})}const g4=400,_4=2500;function v4({path:e,narrow:t,onBack:i,onNotice:r,onMenu:a}){const[c,h]=C.useState(null),[f,g]=C.useState(""),[m,v]=C.useState(0),[_,S]=C.useState(0),[y,b]=C.useState(!0),[w,E]=C.useState(null),[N,A]=C.useState(null),[R,B]=C.useState(null),[q,z]=C.useState(null),[D,$]=C.useState(!1),[ae,I]=C.useState(!1),[G,F]=C.useState(!1),[O,U]=C.useState(null),K=C.useRef(null),V=C.useRef(null),se=R1(e),ee=PR(se),ge=C.useCallback(async(ie,pe)=>{$(!0);try{const ve=await t2(e,{offset:ie,limit:g4});h(ve),g(je=>pe?`${je}${je===""?"":`
46
+ `}${ve.text}`:ve.text),v(ve.offset),S(ve.lines),b(ve.eof),E(ve.bytes??null),ve.version!==void 0&&A(ve.version),z(null),B(null),r?.(null)}catch(ve){const je=ve instanceof Error?ve.message:String(ve);z(je),r?.(`读不到 ${e}:${je}`)}finally{$(!1)}},[e,r]);C.useEffect(()=>{h(null),g(""),v(0),b(!0),A(null),B(null),ee&&ge(1,!1)},[e,ee,ge]),C.useEffect(()=>{if(!ee||N===null)return;let ie=!1;const pe=setInterval(()=>{n2(e).then(ve=>{ie||B(ve.version)},()=>{})},_4);return()=>{ie=!0,clearInterval(pe)}},[e,ee,N]),C.useEffect(()=>()=>{K.current!==null&&clearTimeout(K.current),V.current!==null&&clearTimeout(V.current)},[]);const T=async()=>{try{await navigator.clipboard.writeText(e),F(!0),K.current!==null&&clearTimeout(K.current),K.current=setTimeout(()=>{F(!1)},1600)}catch{r?.("剪贴板不可用(浏览器拒了)")}},De=ie=>{U(ie),V.current!==null&&clearTimeout(V.current),V.current=setTimeout(()=>{U(null)},2200)},{dir:me,name:M}=Yp(e),j=_===0?0:m+_-1,Z=R!==null&&N!==null&&R!==N,re=u.jsxs("div",{className:"pv-head",onContextMenu:ie=>{ie.preventDefault(),a?.(e,ie.clientX,ie.clientY)},children:[t?u.jsx("button",{className:"ib",title:"返回文件树","aria-label":"返回文件树",onClick:i,children:"←"}):null,u.jsxs("span",{className:"pv-path",title:e,children:[me===""?null:u.jsxs("span",{className:"dim",children:[me,"/"]}),u.jsx("b",{children:M})]}),u.jsxs("span",{className:"pv-actions",children:[ee?u.jsx("button",{className:ae?"ib on":"ib",title:ae?"不换行":"自动换行",onClick:()=>{I(ie=>!ie)},children:"↵"}):null,u.jsx("button",{className:G?"ib on":"ib",title:G?"已复制":"复制路径",onClick:()=>{T()},children:"⧉"}),ee?u.jsx("button",{className:"ib",title:"从磁盘重载",onClick:()=>{ge(1,!1)},children:"↻"}):null,u.jsx("button",{className:"ib",title:"关闭预览","aria-label":"关闭预览",onClick:i,children:"✕"})]})]});if(!ee){const ie=se==="image",pe=se==="pdf",ve=FR(e),je=M.includes(".")?M.slice(M.lastIndexOf(".")+1).toUpperCase():"BIN",de=async Ae=>{try{await ax(Ae?{target:"finder",path:e,reveal:!0}:{target:"finder",path:e}),De(Ae?"已在 Finder 中显示":"已交给系统默认应用打开")}catch(st){const oe=st instanceof Error?st.message:String(st);r?.(`打开失败:${oe}`),De(`打开失败:${oe}`)}},be=u.jsxs(u.Fragment,{children:[u.jsx("button",{className:"ib",title:"复制路径",onClick:()=>{T()},children:"⧉"}),u.jsx("button",{className:"ib",title:"用系统应用打开",onClick:()=>{de(!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:Ae=>{Ae.preventDefault(),a?.(e,Ae.clientX,Ae.clientY)},children:[t?u.jsx("button",{className:"ib",title:"返回文件树","aria-label":"返回文件树",onClick:i,children:"←"}):null,u.jsxs("span",{className:"pv-path",title:e,children:[me===""?null:u.jsxs("span",{className:"dim",children:[me,"/"]}),u.jsx("b",{children:M})]}),u.jsx("span",{className:"pv-actions",children:be})]}),ie?u.jsx("div",{className:"pv-body image",children:u.jsx("img",{src:`/file/raw?path=${encodeURIComponent(e)}`,alt:M})}):null,pe?u.jsxs(u.Fragment,{children:[u.jsx("div",{className:"pv-body pdf",children:u.jsx("iframe",{className:"pv-pdf",title:M,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,ie||pe?null:u.jsxs("div",{className:"pv-boundary",children:[u.jsx("span",{className:"doc-badge",children:ve??je}),u.jsx("h3",{children:ve===null?"这个文件不做内嵌预览":"Office 文档不内嵌预览"}),u.jsx("p",{children:ve===null?`二进制(${se})不内嵌、也不当文本读——不装作能看,给真动作:`:"要渲染 .docx / .xlsx / .pptx 得引一套文档内核(解析 + 排版),与「UI 复刻、功能自研」的取舍不一致。不装作能看,给真动作:"}),u.jsxs("div",{className:"pv-boundary-actions",children:[u.jsx("button",{className:"btn primary",onClick:()=>{de(!1)},children:"用系统应用打开"}),u.jsx("button",{className:"btn",onClick:()=>{de(!0)},children:"在 Finder 中显示"}),u.jsx("button",{className:"btn",onClick:()=>{T()},children:"复制路径"})]}),u.jsx("p",{className:"dim small",children:"「用系统应用打开」= POST /open-external 的 open <文件>(系统默认应用);「Finder 显示」= reveal 选中。"}),O===null?null:u.jsx("p",{className:"pv-note",children:O})]})]})}return u.jsxs("div",{className:"pv",children:[re,Z?u.jsxs("div",{className:"pv-banner",children:[u.jsx("span",{className:"bi",children:"◈"}),u.jsx("span",{children:"磁盘上的文件已更新(版本对不上)"}),u.jsx("button",{className:"link-btn",onClick:()=>{ge(1,!1)},children:"重载"}),u.jsx("span",{className:"grow"}),u.jsx("button",{className:"ib",title:"先不重载",onClick:()=>{B(null)},children:"✕"})]}):null,q!==null?u.jsxs("div",{className:"pv-empty err",children:["读不到:",q]}):null,q===null&&c===null&&D?u.jsx("div",{className:"pv-empty",children:"读取中…"}):null,q===null&&c!==null?se==="markdown"?u.jsx("div",{className:"pv-body md",children:Vp(f)}):u.jsx("div",{className:ae?"pv-body code wrap":"pv-body code",children:f.split(`
47
+ `).map((ie,pe)=>u.jsxs("div",{className:"cl",children:[u.jsx("span",{className:"ln",children:pe+1}),u.jsx("span",{className:"lc",children:YR(ie).map((ve,je)=>ve.cls===""?ve.text:u.jsx("span",{className:`tok ${ve.cls}`,children:ve.text},je))})]},pe))}):null,c===null?null:u.jsxs("div",{className:"pv-more",children:[u.jsx("span",{children:y?`已加载 ${String(j)} 行 · 到文件末尾`:`已加载 ${String(j)} 行`}),w===null?null:u.jsxs("span",{className:"dim",children:["· ",$R(w)]}),y?null:u.jsx("button",{className:"link-btn",disabled:D,onClick:()=>{ge(m+_,!0)},children:D?"读取中…":"加载更多"})]})]})}const y4=460;function S4({width:e,changed:t,refreshKey:i,root:r,forceSplit:a=!1,onCollapseTree:c}){const[h,f]=C.useState(""),[g,m]=C.useState(null),[v,_]=C.useState(null),[S,y]=C.useState(0),[b,w]=C.useState(null),[E,N]=C.useState(null),A=C.useRef(null),R=a||e>=y4,[B,q]=C.useState(()=>r4()),z=C.useRef(null);C.useEffect(()=>()=>{A.current!==null&&clearTimeout(A.current)},[]);const D=U=>{N(U),A.current!==null&&clearTimeout(A.current),A.current=setTimeout(()=>{N(null)},1800)},$=u.jsxs("div",{className:h===""?"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:h,placeholder:"筛选文件…","aria-label":"筛选文件",onChange:U=>{f(U.target.value)},onKeyDown:U=>{U.key==="Escape"&&f("")}}),h===""?u.jsx("kbd",{children:"⌘P"}):u.jsx("button",{className:"clear",title:"清空 (Esc)",onClick:()=>{f("")},children:"✕"})]}),ae=U=>{U.button===0&&(U.currentTarget.setPointerCapture(U.pointerId),z.current={startX:U.clientX,startW:B})},I=U=>{z.current!==null&&q(Xp(z.current.startW+(U.clientX-z.current.startX)))},G=U=>{if(z.current!==null){z.current=null;try{U.currentTarget.releasePointerCapture(U.pointerId)}catch{}GS(void 0,B)}},F=u.jsxs("div",{className:"tree-pane",style:a?{flex:`0 0 ${String(B)}px`,width:B}: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,$,v===null?null:u.jsx("div",{className:"tree-hint err",children:v}),u.jsx("div",{className:"tree-scroll",children:u.jsx(p4,{selected:g,onSelect:m,changed:t,q:h.trim().toLowerCase(),refreshKey:i+S,onMenu:(U,K,V)=>{w({path:U,x:K,y:V})}})}),u.jsx("div",{className:"tree-foot",children:u.jsx("button",{className:"link-btn",onClick:()=>{y(U=>U+1)},children:"刷新目录"})})]}),O=g===null?null:u.jsx(v4,{path:g,narrow:!R,onBack:()=>{m(null),_(null)},onNotice:_,onMenu:(U,K,V)=>{w({path:U,x:K,y:V})}});return u.jsxs("div",{className:["files-wrap",R?"split":"single",g===null?"no-pv":"has-pv",a?"force-split":""].join(" "),children:[F,a?u.jsx("span",{className:"dock-splitter tree-splitter",title:"拖动调整文件树宽度(双击复位 176)",role:"separator","aria-orientation":"vertical","aria-label":"拖动调整文件树宽度",onPointerDown:ae,onPointerMove:I,onPointerUp:G,onPointerCancel:G,onDoubleClick:()=>{q(GS(void 0,176))}}):null,u.jsx("div",{className:"pv-slot",children:O??(a?u.jsxs("div",{className:"pv-empty",children:[u.jsx("span",{className:"dim",children:"选一个文件看预览"}),u.jsx("span",{className:"smaller",children:"三栏里中间这格是预览;树宽可拖(140–240),栏头 ✕ 收起回双栏"})]}):null)}),b===null?null:u.jsx(d4,{root:r,path:b.path,x:b.x,y:b.y,onClose:()=>{w(null)},onFeedback:D}),E===null?null:u.jsx("div",{className:"dock-toast",children:E})]})}var b4=2,x4=1,w4=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(b4,Math.floor(v/e.css.cell.width)),rows:Math.max(x4,Math.floor(m/e.css.cell.height))}}};var F1=Object.defineProperty,C4=Object.getOwnPropertyDescriptor,k4=(e,t)=>{for(var i in t)F1(e,i,{get:t[i],enumerable:!0})},Ht=(e,t,i,r)=>{for(var a=r>1?void 0:r?C4(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&&F1(t,i,a),a},Me=(e,t)=>(i,r)=>t(i,r,e),ZS="Terminal input",Om={get:()=>ZS,set:e=>ZS=e},JS="Too much output to announce, navigate to rows manually to read",Bm={get:()=>JS,set:e=>JS=e};function N4(e){return e.replace(/\r?\n/g,"\r")}function E4(e,t){return t?"\x1B[200~"+e+"\x1B[201~":e}function j4(e,t){e.clipboardData&&e.clipboardData.setData("text/plain",t.selectionText),e.preventDefault()}function T4(e,t,i,r){if(e.stopPropagation(),e.clipboardData){let a=e.clipboardData.getData("text/plain");$1(a,t,i,r)}}function $1(e,t,i,r){e=N4(e),e=E4(e,i.decPrivateModes.bracketedPasteMode&&r.rawOptions.ignoreBracketedPasteMode!==!0),i.triggerDataEvent(e,!0),t.value=""}function V1(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 eb(e,t,i,r,a){V1(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 Pu(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 D4=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}},M4=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 b=0,w;for(;(w=this.interim[++b]&63)&&b<4;)y<<=6,y|=w;let E=(this.interim[0]&224)===192?2:(this.interim[0]&240)===224?3:4,N=E-b;for(;m<N;){if(m>=i)return 0;if(w=e[m++],(w&192)!==128){m--,S=!0;break}else this.interim[b++]=w,y<<=6,y|=w&63}S||(E===2?y<128?m--:t[r++]=y:E===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}},K1="",Ks=" ",yo=class Y1{constructor(){this.fg=0,this.bg=0,this.extended=new Eu}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 Y1;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}},Eu=class W1{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 W1(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}},gi=class X1 extends yo{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new Eu,this.combinedData=""}static fromCharData(t){let i=new X1;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()]}},tb="di$target",Lm="di$dependencies",Wf=new Map;function A4(e){return e[Lm]||[]}function un(e){if(Wf.has(e))return Wf.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");R4(t,i,a)};return t._id=e,Wf.set(e,t),t}function R4(e,t,i){t[tb]===t?t[Lm].push({id:e,index:i}):(t[Lm]=[{id:e,index:i}],t[tb]=t)}var An=un("BufferService"),G1=un("CoreMouseService"),Lr=un("CoreService"),O4=un("CharsetService"),Gp=un("InstantiationService"),Q1=un("LogService"),Rn=un("OptionsService"),Z1=un("OscLinkService"),B4=un("UnicodeService"),So=un("DecorationService"),zm=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 b=new URL(_);["http:","https:"].includes(b.protocol)||(y=!0)}catch{y=!0}y||r.push({text:_,range:S,activate:(b,w)=>a?a.activate(b,w,S):L4(b,w),hover:(b,w)=>a?.hover?.(b,w,S),leave:(b,w)=>a?.leave?.(b,w,S)})}m=!1,c.hasExtendedAttrs()&&c.extended.urlId?(g=v,f=c.extended.urlId):(g=-1,f=-1)}}t(r)}};zm=Ht([Me(0,An),Me(1,Rn),Me(2,Z1)],zm);function L4(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 qu=un("CharSizeService"),fs=un("CoreBrowserService"),Qp=un("MouseService"),ms=un("RenderService"),z4=un("SelectionService"),J1=un("CharacterJoinerService"),$l=un("ThemeService"),ew=un("LinkProviderService"),H4=class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?nb.isErrorNoTelemetry(e)?new nb(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)}},I4=new H4;function mu(e){U4(e)||I4.onUnexpectedError(e)}var Hm="Canceled";function U4(e){return e instanceof P4?!0:e instanceof Error&&e.name===Hm&&e.message===Hm}var P4=class extends Error{constructor(){super(Hm),this.name=this.message}};function q4(e){return new Error(`Illegal argument: ${e}`)}var nb=class Im extends Error{constructor(t){super(t),this.name="CodeExpectedError"}static fromError(t){if(t instanceof Im)return t;let i=new Im;return i.message=t.message,i.stack=t.stack,i}static isErrorNoTelemetry(t){return t.name==="CodeExpectedError"}},Um=class tw extends Error{constructor(t){super(t||"An unexpected bug occurred."),Object.setPrototypeOf(this,tw.prototype)}};function Zn(e,t=0){return e[e.length-(1+t)]}var F4;(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})(F4||={});function $4(e,t){let i=this,r=!1,a;return function(){return r||(r=!0,t||(a=e.apply(i,arguments))),a}}var nw;(e=>{function t(B){return B&&typeof B=="object"&&typeof B[Symbol.iterator]=="function"}e.is=t;let i=Object.freeze([]);function r(){return i}e.empty=r;function*a(B){yield B}e.single=a;function c(B){return t(B)?B:a(B)}e.wrap=c;function h(B){return B||i}e.from=h;function*f(B){for(let q=B.length-1;q>=0;q--)yield B[q]}e.reverse=f;function g(B){return!B||B[Symbol.iterator]().next().done===!0}e.isEmpty=g;function m(B){return B[Symbol.iterator]().next().value}e.first=m;function v(B,q){let z=0;for(let D of B)if(q(D,z++))return!0;return!1}e.some=v;function _(B,q){for(let z of B)if(q(z))return z}e.find=_;function*S(B,q){for(let z of B)q(z)&&(yield z)}e.filter=S;function*y(B,q){let z=0;for(let D of B)yield q(D,z++)}e.map=y;function*b(B,q){let z=0;for(let D of B)yield*q(D,z++)}e.flatMap=b;function*w(...B){for(let q of B)yield*q}e.concat=w;function E(B,q,z){let D=z;for(let $ of B)D=q(D,$);return D}e.reduce=E;function*N(B,q,z=B.length){for(q<0&&(q+=B.length),z<0?z+=B.length:z>B.length&&(z=B.length);q<z;q++)yield B[q]}e.slice=N;function A(B,q=Number.POSITIVE_INFINITY){let z=[];if(q===0)return[z,B];let D=B[Symbol.iterator]();for(let $=0;$<q;$++){let ae=D.next();if(ae.done)return[z,e.empty()];z.push(ae.value)}return[z,{[Symbol.iterator](){return D}}]}e.consume=A;async function R(B){let q=[];for await(let z of B)q.push(z);return Promise.resolve(q)}e.asyncToArray=R})(nw||={});function Rr(e){if(nw.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 V4(...e){return Dt(()=>Rr(e))}function Dt(e){return{dispose:$4(()=>{e()})}}var iw=class sw{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?sw.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)}};iw.DISABLE_DISPOSED_WARNING=!1;var Ys=iw,Je=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)}};Je.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,Pm=class qm{constructor(t){this.element=t,this.next=qm.Undefined,this.prev=qm.Undefined}};Pm.Undefined=new Pm(void 0);var At=Pm,ib=class{constructor(){this._first=At.Undefined,this._last=At.Undefined,this._size=0}get size(){return this._size}isEmpty(){return this._first===At.Undefined}clear(){let e=this._first;for(;e!==At.Undefined;){let t=e.next;e.prev=At.Undefined,e.next=At.Undefined,e=t}this._first=At.Undefined,this._last=At.Undefined,this._size=0}unshift(e){return this._insert(e,!1)}push(e){return this._insert(e,!0)}_insert(e,t){let i=new At(e);if(this._first===At.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!==At.Undefined){let e=this._first.element;return this._remove(this._first),e}}pop(){if(this._last!==At.Undefined){let e=this._last.element;return this._remove(this._last),e}}_remove(e){if(e.prev!==At.Undefined&&e.next!==At.Undefined){let t=e.prev;t.next=e.next,e.next.prev=t}else e.prev===At.Undefined&&e.next===At.Undefined?(this._first=At.Undefined,this._last=At.Undefined):e.next===At.Undefined?(this._last=this._last.prev,this._last.next=At.Undefined):e.prev===At.Undefined&&(this._first=this._first.next,this._first.prev=At.Undefined);this._size-=1}*[Symbol.iterator](){let e=this._first;for(;e!==At.Undefined;)yield e.element,e=e.next}},K4=globalThis.performance&&typeof globalThis.performance.now=="function",Y4=class rw{static create(t){return new rw(t)}constructor(t){this._now=K4&&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}},Sn;(e=>{e.None=()=>Je.None;function t(F,O){return _(F,()=>{},0,void 0,!0,void 0,O)}e.defer=t;function i(F){return(O,U=null,K)=>{let V=!1,se;return se=F(ee=>{if(!V)return se?se.dispose():V=!0,O.call(U,ee)},null,K),V&&se.dispose(),se}}e.once=i;function r(F,O,U){return m((K,V=null,se)=>F(ee=>K.call(V,O(ee)),null,se),U)}e.map=r;function a(F,O,U){return m((K,V=null,se)=>F(ee=>{O(ee),K.call(V,ee)},null,se),U)}e.forEach=a;function c(F,O,U){return m((K,V=null,se)=>F(ee=>O(ee)&&K.call(V,ee),null,se),U)}e.filter=c;function h(F){return F}e.signal=h;function f(...F){return(O,U=null,K)=>{let V=V4(...F.map(se=>se(ee=>O.call(U,ee))));return v(V,K)}}e.any=f;function g(F,O,U,K){let V=U;return r(F,se=>(V=O(V,se),V),K)}e.reduce=g;function m(F,O){let U,K={onWillAddFirstListener(){U=F(V.fire,V)},onDidRemoveLastListener(){U?.dispose()}},V=new we(K);return O?.add(V),V.event}function v(F,O){return O instanceof Array?O.push(F):O&&O.add(F),F}function _(F,O,U=100,K=!1,V=!1,se,ee){let ge,T,De,me=0,M,j={leakWarningThreshold:se,onWillAddFirstListener(){ge=F(re=>{me++,T=O(T,re),K&&!De&&(Z.fire(T),T=void 0),M=()=>{let ie=T;T=void 0,De=void 0,(!K||me>1)&&Z.fire(ie),me=0},typeof U=="number"?(clearTimeout(De),De=setTimeout(M,U)):De===void 0&&(De=0,queueMicrotask(M))})},onWillRemoveListener(){V&&me>0&&M?.()},onDidRemoveLastListener(){M=void 0,ge.dispose()}},Z=new we(j);return ee?.add(Z),Z.event}e.debounce=_;function S(F,O=0,U){return e.debounce(F,(K,V)=>K?(K.push(V),K):[V],O,void 0,!0,void 0,U)}e.accumulate=S;function y(F,O=(K,V)=>K===V,U){let K=!0,V;return c(F,se=>{let ee=K||!O(se,V);return K=!1,V=se,ee},U)}e.latch=y;function b(F,O,U){return[e.filter(F,O,U),e.filter(F,K=>!O(K),U)]}e.split=b;function w(F,O=!1,U=[],K){let V=U.slice(),se=F(T=>{V?V.push(T):ge.fire(T)});K&&K.add(se);let ee=()=>{V?.forEach(T=>ge.fire(T)),V=null},ge=new we({onWillAddFirstListener(){se||(se=F(T=>ge.fire(T)),K&&K.add(se))},onDidAddFirstListener(){V&&(O?setTimeout(ee):ee())},onDidRemoveLastListener(){se&&se.dispose(),se=null}});return K&&K.add(ge),ge.event}e.buffer=w;function E(F,O){return(U,K,V)=>{let se=O(new A);return F(function(ee){let ge=se.evaluate(ee);ge!==N&&U.call(K,ge)},void 0,V)}}e.chain=E;let N=Symbol("HaltChainable");class A{constructor(){this.steps=[]}map(O){return this.steps.push(O),this}forEach(O){return this.steps.push(U=>(O(U),U)),this}filter(O){return this.steps.push(U=>O(U)?U:N),this}reduce(O,U){let K=U;return this.steps.push(V=>(K=O(K,V),K)),this}latch(O=(U,K)=>U===K){let U=!0,K;return this.steps.push(V=>{let se=U||!O(V,K);return U=!1,K=V,se?V:N}),this}evaluate(O){for(let U of this.steps)if(O=U(O),O===N)break;return O}}function R(F,O,U=K=>K){let K=(...ge)=>ee.fire(U(...ge)),V=()=>F.on(O,K),se=()=>F.removeListener(O,K),ee=new we({onWillAddFirstListener:V,onDidRemoveLastListener:se});return ee.event}e.fromNodeEventEmitter=R;function B(F,O,U=K=>K){let K=(...ge)=>ee.fire(U(...ge)),V=()=>F.addEventListener(O,K),se=()=>F.removeEventListener(O,K),ee=new we({onWillAddFirstListener:V,onDidRemoveLastListener:se});return ee.event}e.fromDOMEventEmitter=B;function q(F){return new Promise(O=>i(F)(O))}e.toPromise=q;function z(F){let O=new we;return F.then(U=>{O.fire(U)},()=>{O.fire(void 0)}).finally(()=>{O.dispose()}),O.event}e.fromPromise=z;function D(F,O){return F(U=>O.fire(U))}e.forward=D;function $(F,O,U){return O(U),F(K=>O(K))}e.runAndSubscribe=$;class ae{constructor(O,U){this._observable=O,this._counter=0,this._hasChanged=!1;let K={onWillAddFirstListener:()=>{O.addObserver(this)},onDidRemoveLastListener:()=>{O.removeObserver(this)}};this.emitter=new we(K),U&&U.add(this.emitter)}beginUpdate(O){this._counter++}handlePossibleChange(O){}handleChange(O,U){this._hasChanged=!0}endUpdate(O){this._counter--,this._counter===0&&(this._observable.reportChanges(),this._hasChanged&&(this._hasChanged=!1,this.emitter.fire(this._observable.get())))}}function I(F,O){return new ae(F,O).emitter.event}e.fromObservable=I;function G(F){return(O,U,K)=>{let V=0,se=!1,ee={beginUpdate(){V++},endUpdate(){V--,V===0&&(F.reportChanges(),se&&(se=!1,O.call(U)))},handlePossibleChange(){},handleChange(){se=!0}};F.addObserver(ee),F.reportChanges();let ge={dispose(){F.removeObserver(ee)}};return K instanceof Ys?K.add(ge):Array.isArray(K)&&K.push(ge),ge}}e.fromObservableLight=G})(Sn||={});var Fm=class $m{constructor(t){this.listenerCount=0,this.invocationCount=0,this.elapsedOverall=0,this.durations=[],this.name=`${t}_${$m._idPool++}`,$m.all.add(this)}start(t){this._stopWatch=new Y4,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}}};Fm.all=new Set,Fm._idPool=0;var W4=Fm,X4=-1,lw=class aw{constructor(t,i,r=(aw._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 Z4(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}};lw._idPool=1;var G4=lw,Q4=class ow{constructor(t){this.value=t}static create(){let t=new Error;return new ow(t.stack??"")}print(){console.warn(this.value.split(`
54
+ `).slice(2).join(`
55
+ `))}},Z4=class extends Error{constructor(e,t){super(e),this.name="ListenerLeakError",this.stack=t}},J4=class extends Error{constructor(e,t){super(e),this.name="ListenerRefusalError",this.stack=t}},e5=0,Xf=class{constructor(e){this.value=e,this.id=e5++}},t5=2,n5,we=class{constructor(e){this._size=0,this._options=e,this._leakageMon=this._options?.leakWarningThreshold?new G4(e?.onListenerError??mu,this._options?.leakWarningThreshold??X4):void 0,this._perfMon=this._options?._profName?new W4(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 J4(`${h}. HINT: Stack shows most frequent listener (${f[1]}-times)`,f[0]);return(this._options?.onListenerError||mu)(g),Je.None}if(this._disposed)return Je.None;t&&(e=e.bind(t));let r=new Xf(e),a;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(r.stack=Q4.create(),a=this._leakageMon.check(r.stack,this._size+1)),this._listeners?this._listeners instanceof Xf?(this._deliveryQueue??=new i5,this._listeners=[this._listeners,r]):this._listeners.push(r):(this._options?.onWillAddFirstListener?.(this),this._listeners=r,this._options?.onDidAddFirstListener?.(this)),this._size++;let c=Dt(()=>{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*t5<=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||mu;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 Xf)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}},i5=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}},Vm=class{constructor(){this.mapWindowIdToZoomLevel=new Map,this._onDidChangeZoomLevel=new we,this.onDidChangeZoomLevel=this._onDidChangeZoomLevel.event,this.mapWindowIdToZoomFactor=new Map,this._onDidChangeFullscreen=new we,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}};Vm.INSTANCE=new Vm;var Zp=Vm;function s5(e,t,i){typeof t=="string"&&(t=e.matchMedia(t)),t.addEventListener("change",i)}Zp.INSTANCE.onDidChangeZoomLevel;function r5(e){return Zp.INSTANCE.getZoomFactor(e)}Zp.INSTANCE.onDidChangeFullscreen;var Vl=typeof navigator=="object"?navigator.userAgent:"",Km=Vl.indexOf("Firefox")>=0,l5=Vl.indexOf("AppleWebKit")>=0,Jp=Vl.indexOf("Chrome")>=0,a5=!Jp&&Vl.indexOf("Safari")>=0;Vl.indexOf("Electron/")>=0;Vl.indexOf("Android")>=0;var Gf=!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)");Gf=e.matches,s5(hs,e,({matches:i})=>{Gf&&t.matches||(Gf=i)})}var zl="en",Ym=!1,Wm=!1,pu=!1,cw=!1,tu,gu=zl,sb=zl,o5,us,Mr=globalThis,ti;typeof Mr.vscode<"u"&&typeof Mr.vscode.process<"u"?ti=Mr.vscode.process:typeof process<"u"&&typeof process?.versions?.node=="string"&&(ti=process);var c5=typeof ti?.versions?.electron=="string",u5=c5&&ti?.type==="renderer";if(typeof ti=="object"){Ym=ti.platform==="win32",Wm=ti.platform==="darwin",pu=ti.platform==="linux",pu&&ti.env.SNAP&&ti.env.SNAP_REVISION,ti.env.CI||ti.env.BUILD_ARTIFACTSTAGINGDIRECTORY,tu=zl,gu=zl;let e=ti.env.VSCODE_NLS_CONFIG;if(e)try{let t=JSON.parse(e);tu=t.userLocale,sb=t.osLocale,gu=t.resolvedLanguage||zl,o5=t.languagePack?.translationsConfigFile}catch{}cw=!0}else typeof navigator=="object"&&!u5?(us=navigator.userAgent,Ym=us.indexOf("Windows")>=0,Wm=us.indexOf("Macintosh")>=0,(us.indexOf("Macintosh")>=0||us.indexOf("iPad")>=0||us.indexOf("iPhone")>=0)&&navigator.maxTouchPoints&&navigator.maxTouchPoints>0,pu=us.indexOf("Linux")>=0,us?.indexOf("Mobi")>=0,gu=globalThis._VSCODE_NLS_LANGUAGE||zl,tu=navigator.language.toLowerCase(),sb=tu):console.error("Unable to resolve platform.");var uw=Ym,Vi=Wm,h5=pu,rb=cw,Ki=us,qs=gu,d5;(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})(d5||={});var f5=typeof Mr.postMessage=="function"&&!Mr.importScripts;(()=>{if(f5){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 m5=!!(Ki&&Ki.indexOf("Chrome")>=0);Ki&&Ki.indexOf("Firefox")>=0;!m5&&Ki&&Ki.indexOf("Safari")>=0;Ki&&Ki.indexOf("Edg/")>=0;Ki&&Ki.indexOf("Android")>=0;var Dl=typeof navigator=="object"?navigator:{};rb||document.queryCommandSupported&&document.queryCommandSupported("copy")||Dl&&Dl.clipboard&&Dl.clipboard.writeText,rb||Dl&&Dl.clipboard&&Dl.clipboard.readText;var eg=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}},Qf=new eg,lb=new eg,ab=new eg,p5=new Array(230),hw;(e=>{function t(f){return Qf.keyCodeToStr(f)}e.toString=t;function i(f){return Qf.strToKeyCode(f)}e.fromString=i;function r(f){return lb.keyCodeToStr(f)}e.toUserSettingsUS=r;function a(f){return ab.keyCodeToStr(f)}e.toUserSettingsGeneral=a;function c(f){return lb.strToKeyCode(f)||ab.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 Qf.keyCodeToStr(f)}e.toElectronAccelerator=h})(hw||={});var g5=class dw{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 dw&&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 _5([this])}isDuplicateModifierCase(){return this.ctrlKey&&this.keyCode===5||this.shiftKey&&this.keyCode===4||this.altKey&&this.keyCode===6||this.metaKey&&this.keyCode===57}},_5=class{constructor(e){if(e.length===0)throw q4("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 v5(e){if(e.charCode){let i=String.fromCharCode(e.charCode).toUpperCase();return hw.fromString(i)}let t=e.keyCode;if(t===3)return 7;if(Km)switch(t){case 59:return 85;case 60:if(h5)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(l5&&(Vi&&t===93||!Vi&&t===92))return 57;return p5[t]||0}var y5=Vi?256:2048,S5=512,b5=1024,x5=Vi?2048:256,ob=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=v5(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|=y5),this.altKey&&(t|=S5),this.shiftKey&&(t|=b5),this.metaKey&&(t|=x5),t|=e,t}_computeKeyCodeChord(){let e=0;return this.keyCode!==5&&this.keyCode!==4&&this.keyCode!==6&&this.keyCode!==57&&(e=this.keyCode),new g5(this.ctrlKey,this.shiftKey,this.altKey,this.metaKey,e)}},cb=new WeakMap;function w5(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 C5=class{static getSameOriginWindowChain(e){let t=cb.get(e);if(!t){t=[],cb.set(e,t);let i=e,r;do r=w5(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=C5.getPositionOfChildWindowRelativeToAncestorWindow(e,t.view);this.posx-=i.left,this.posy-=i.top}preventDefault(){this.browserEvent.preventDefault()}stopPropagation(){this.browserEvent.stopPropagation()}},ub=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(Jp){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?Km&&!Vi?this.deltaY=-e.deltaY/3:this.deltaY=-e.deltaY:this.deltaY=-e.deltaY/40}if(typeof a.wheelDeltaX<"u")a5&&uw?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?Km&&!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()}},fw=Object.freeze(function(e,t){let i=setTimeout(e.bind(t),0);return{dispose(){clearTimeout(i)}}}),k5;(e=>{function t(i){return i===e.None||i===e.Cancelled||i instanceof N5?!0:!i||typeof i!="object"?!1:typeof i.isCancellationRequested=="boolean"&&typeof i.onCancellationRequested=="function"}e.isCancellationToken=t,e.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:Sn.None}),e.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:fw})})(k5||={});var N5=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?fw:(this._emitter||(this._emitter=new we),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=null)}},tg=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 Um("Calling 'cancelAndSet' on a disposed TimeoutTimer");this.cancel(),this._token=setTimeout(()=>{this._token=-1,e()},t)}setIfNotSet(e,t){if(this._isDisposed)throw new Um("Calling 'setIfNotSet' on a disposed TimeoutTimer");this._token===-1&&(this._token=setTimeout(()=>{this._token=-1,e()},t))}},E5=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 Um("Calling 'cancelAndSet' on a disposed IntervalTimer");this.cancel();let r=i.setInterval(()=>{e()},t);this.disposable=Dt(()=>{i.clearInterval(r),this.disposable=void 0})}dispose(){this.cancel(),this.isDisposed=!0}},j5;(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})(j5||={});var hb=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 we,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 Sn.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())}};hb.EMPTY=hb.fromArray([]);var{getWindow:$i,getWindowId:T5,onDidRegisterWindow:D5}=(function(){let e=new Map,t={window:hs,disposables:new Ys};e.set(hs.vscodeWindowId,t);let i=new we,r=new we,a=new we;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 Je.None;let f=new Ys,g={window:h,disposables:f.add(new Ys)};return e.set(h.vscodeWindowId,g),f.add(Dt(()=>{e.delete(h.vscodeWindowId),r.fire(h)})),f.add(qe(h,ln.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}}})(),M5=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 qe(e,t,i,r){return new M5(e,t,i,r)}var db=function(e,t,i,r){return qe(e,t,i,r)},ng,A5=class extends E5{constructor(e){super(),this.defaultTarget=e&&$i(e)}cancelAndSet(e,t,i){return super.cancelAndSet(e,t,i??this.defaultTarget)}},fb=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){mu(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(fb.sort),h.shift().execute();r.set(c,!1)};ng=(c,h,f=0)=>{let g=T5(c),m=new fb(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 R5(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 ln={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"},O5=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=Un(e);this._maxWidth!==t&&(this._maxWidth=t,this.domNode.style.maxWidth=this._maxWidth)}setWidth(e){let t=Un(e);this._width!==t&&(this._width=t,this.domNode.style.width=this._width)}setHeight(e){let t=Un(e);this._height!==t&&(this._height=t,this.domNode.style.height=this._height)}setTop(e){let t=Un(e);this._top!==t&&(this._top=t,this.domNode.style.top=this._top)}setLeft(e){let t=Un(e);this._left!==t&&(this._left=t,this.domNode.style.left=this._left)}setBottom(e){let t=Un(e);this._bottom!==t&&(this._bottom=t,this.domNode.style.bottom=this._bottom)}setRight(e){let t=Un(e);this._right!==t&&(this._right=t,this.domNode.style.right=this._right)}setPaddingTop(e){let t=Un(e);this._paddingTop!==t&&(this._paddingTop=t,this.domNode.style.paddingTop=this._paddingTop)}setPaddingLeft(e){let t=Un(e);this._paddingLeft!==t&&(this._paddingLeft=t,this.domNode.style.paddingLeft=this._paddingLeft)}setPaddingBottom(e){let t=Un(e);this._paddingBottom!==t&&(this._paddingBottom=t,this.domNode.style.paddingBottom=this._paddingBottom)}setPaddingRight(e){let t=Un(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=Un(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=Un(e);this._lineHeight!==t&&(this._lineHeight=t,this.domNode.style.lineHeight=this._lineHeight)}setLetterSpacing(e){let t=Un(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 Un(e){return typeof e=="number"?`${e}px`:e}function lo(e){return new O5(e)}var mw=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(Dt(()=>{try{e.releasePointerCapture(t)}catch{}}))}catch{c=$i(e)}this._hooks.add(qe(c,ln.POINTER_MOVE,h=>{if(h.buttons!==i){this.stopMonitoring(!0);return}h.preventDefault(),this._pointerMoveCallback(h)})),this._hooks.add(qe(c,ln.POINTER_UP,h=>this.stopMonitoring(!0)))}};function B5(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 wn extends Je{constructor(){super(),this.dispatched=!1,this.targets=new ib,this.ignoreTargets=new ib,this.activeTouches={},this.handle=null,this._lastSetTapCountTime=0,this._register(Sn.runAndSubscribe(D5,({window:t,disposables:i})=>{i.add(qe(t.document,"touchstart",r=>this.onTouchStart(r),{passive:!1})),i.add(qe(t.document,"touchend",r=>this.onTouchEnd(t,r))),i.add(qe(t.document,"touchmove",r=>this.onTouchMove(r),{passive:!1}))},{window:hs,disposables:this._store}))}static addTarget(t){if(!wn.isTouchDevice())return Je.None;wn.INSTANCE||(wn.INSTANCE=new wn);let i=wn.INSTANCE.targets.push(t);return Dt(i)}static ignoreTarget(t){if(!wn.isTouchDevice())return Je.None;wn.INSTANCE||(wn.INSTANCE=new wn);let i=wn.INSTANCE.ignoreTargets.push(t);return Dt(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<wn.HOLD_DELAY&&Math.abs(g.initialPageX-Zn(g.rollingPageX))<30&&Math.abs(g.initialPageY-Zn(g.rollingPageY))<30){let v=this.newGestureEvent(Pi.Tap,g.initialTarget);v.pageX=Zn(g.rollingPageX),v.pageY=Zn(g.rollingPageY),this.dispatchEvent(v)}else if(m>=wn.HOLD_DELAY&&Math.abs(g.initialPageX-Zn(g.rollingPageX))<30&&Math.abs(g.initialPageY-Zn(g.rollingPageY))<30){let v=this.newGestureEvent(Pi.Contextmenu,g.initialTarget);v.pageX=Zn(g.rollingPageX),v.pageY=Zn(g.rollingPageY),this.dispatchEvent(v)}else if(a===1){let v=Zn(g.rollingPageX),_=Zn(g.rollingPageY),S=Zn(g.rollingTimestamps)-g.rollingTimestamps[0],y=v-g.rollingPageX[0],b=_-g.rollingPageY[0],w=[...this.targets].filter(E=>g.initialTarget instanceof Node&&E.contains(g.initialTarget));this.inertia(t,w,r,Math.abs(y)/S,y>0?1:-1,v,Math.abs(b)/S,b>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>wn.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=ng(t,()=>{let v=Date.now(),_=v-r,S=0,y=0,b=!0;a+=wn.SCROLL_FRICTION*_,f+=wn.SCROLL_FRICTION*_,a>0&&(b=!1,S=c*a*_),f>0&&(b=!1,y=g*f*_);let w=this.newGestureEvent(Pi.Change);w.translationX=S,w.translationY=y,i.forEach(E=>E.dispatchEvent(w)),b||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-Zn(h.rollingPageX),f.translationY=c.pageY-Zn(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,Ht([B5],Za,"isTouchDevice",1);var L5=Za,ig=class extends Je{onclick(e,t){this._register(qe(e,ln.CLICK,i=>t(new nu($i(e),i))))}onmousedown(e,t){this._register(qe(e,ln.MOUSE_DOWN,i=>t(new nu($i(e),i))))}onmouseover(e,t){this._register(qe(e,ln.MOUSE_OVER,i=>t(new nu($i(e),i))))}onmouseleave(e,t){this._register(qe(e,ln.MOUSE_LEAVE,i=>t(new nu($i(e),i))))}onkeydown(e,t){this._register(qe(e,ln.KEY_DOWN,i=>t(new ob(i))))}onkeyup(e,t){this._register(qe(e,ln.KEY_UP,i=>t(new ob(i))))}oninput(e,t){this._register(qe(e,ln.INPUT,t))}onblur(e,t){this._register(qe(e,ln.BLUR,t))}onfocus(e,t){this._register(qe(e,ln.FOCUS,t))}onchange(e,t){this._register(qe(e,ln.CHANGE,t))}ignoreGesture(e){return L5.ignoreTarget(e)}},mb=11,z5=class extends ig{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=mb+"px",this.domNode.style.height=mb+"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 mw),this._register(db(this.bgDomNode,ln.POINTER_DOWN,t=>this._arrowPointerDown(t))),this._register(db(this.domNode,ln.POINTER_DOWN,t=>this._arrowPointerDown(t))),this._pointerdownRepeatTimer=this._register(new A5),this._pointerdownScheduleRepeatTimer=this._register(new tg)}_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()}},H5=class Xm{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 Xm(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 Xm(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}}},I5=class extends Je{constructor(e){super(),this._scrollableBrand=void 0,this._onScroll=this._register(new we),this.onScroll=this._onScroll.event,this._smoothScrollDuration=e.smoothScrollDuration,this._scheduleAtNextAnimationFrame=e.scheduleAtNextAnimationFrame,this._state=new H5(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 gb(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=gb.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)))}},pb=class{constructor(e,t,i){this.scrollLeft=e,this.scrollTop=t,this.isDone=i}};function Zf(e,t){let i=t-e;return function(r){return e+i*q5(r)}}function U5(e,t,i){return function(r){return r<i?e(r/i):t((r-i)/(1-i))}}var gb=class Gm{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),U5(Zf(t,a),Zf(c,i),.33)}return Zf(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 pb(r,a,!1)}return new pb(this.to.scrollLeft,this.to.scrollTop,!0)}combine(t,i,r){return Gm.start(t,i,r)}static start(t,i,r){r=r+10;let a=Date.now()-10;return new Gm(t,i,a,r)}};function P5(e){return Math.pow(e,3)}function q5(e){return 1-P5(1-e)}var F5=class extends Je{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 tg)}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":"")))}},$5=140,pw=class extends ig{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 F5(e.visibility,"visible scrollbar "+e.extraScrollbarClassName,"invisible scrollbar "+e.extraScrollbarClassName)),this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._pointerMoveMonitor=this._register(new mw),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(qe(this.domNode.domNode,ln.POINTER_DOWN,t=>this._domNodePointerDown(t)))}_createArrow(e){let t=this._register(new z5(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(qe(this.slider.domNode,ln.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=R5(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(uw&&h>$5){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()}},gw=class Qm{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 Qm(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=Qm._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)}},V5=class extends pw{constructor(e,t,i){let r=e.getScrollDimensions(),a=e.getCurrentScrollPosition();if(super({lazyRender:t.lazyRender,host:i,scrollbarState:new gw(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}},K5=class extends pw{constructor(e,t,i){let r=e.getScrollDimensions(),a=e.getCurrentScrollPosition();if(super({lazyRender:t.lazyRender,host:i,scrollbarState:new gw(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}},Y5=500,_b=50,W5=class{constructor(e,t,i){this.timestamp=e,this.deltaX=t,this.deltaY=i,this.score=0}},Zm=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(Jp){let i=$i(t.browserEvent),r=r5(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 W5(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}};Zm.INSTANCE=new Zm;var X5=Zm,G5=class extends ig{constructor(e,t,i){super(),this._onScroll=this._register(new we),this.onScroll=this._onScroll.event,this._onWillScroll=this._register(new we),this.onWillScroll=this._onWillScroll.event,this._options=Z5(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 K5(this._scrollable,this._options,r)),this._horizontalScrollbar=this._register(new V5(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 tg),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 ub(e))}_setListeningToMouseWheel(e){if(this._mouseWheelToDispose.length>0!==e&&(this._mouseWheelToDispose=Rr(this._mouseWheelToDispose),e)){let t=i=>{this._onMouseWheel(new ub(i))};this._mouseWheelToDispose.push(qe(this._listenOnDomNode,ln.MOUSE_WHEEL,t,{passive:!1}))}}_onMouseWheel(e){if(e.browserEvent?.defaultPrevented)return;let t=X5.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=_b*a,v=f.scrollTop-(m<0?Math.floor(m):Math.ceil(m));this._verticalScrollbar.writeScrollPosition(g,v)}if(c){let m=_b*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(),Y5)}},Q5=class extends G5{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 Z5(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 Jm=class extends Je{constructor(e,t,i,r,a,c,h,f){super(),this._bufferService=i,this._optionsService=h,this._renderService=f,this._onRequestScrollLines=this._register(new we),this.onRequestScrollLines=this._onRequestScrollLines.event,this._isSyncing=!1,this._isHandlingScroll=!1,this._suppressOnScrollHandler=!1;let g=this._register(new I5({forceIntegerValues:!1,smoothScrollDuration:this._optionsService.rawOptions.smoothScrollDuration,scheduleAtNextAnimationFrame:m=>ng(r.window,m)}));this._register(this._optionsService.onSpecificOptionChange("smoothScrollDuration",()=>{g.setSmoothScrollDuration(this._optionsService.rawOptions.smoothScrollDuration)})),this._scrollableElement=this._register(new Q5(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(Sn.runAndSubscribe(c.onChangeColors,()=>{this._scrollableElement.getDomNode().style.backgroundColor=c.colors.background.css})),e.appendChild(this._scrollableElement.getDomNode()),this._register(Dt(()=>this._scrollableElement.getDomNode().remove())),this._styleElement=r.mainDocument.createElement("style"),t.appendChild(this._styleElement),this._register(Dt(()=>this._styleElement.remove())),this._register(Sn.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}};Jm=Ht([Me(2,An),Me(3,fs),Me(4,G1),Me(5,$l),Me(6,Rn),Me(7,ms)],Jm);var ep=class extends Je{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(Dt(()=>{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()}};ep=Ht([Me(1,An),Me(2,fs),Me(3,So),Me(4,ms)],ep);var J5=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},ju=class extends Je{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 J5,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(Dt(()=>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}))}};ju=Ht([Me(2,An),Me(3,So),Me(4,ms),Me(5,Rn),Me(6,$l),Me(7,fs)],ju);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 _u;(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="Ÿ"))(_u||={});var _w;(e=>e.ST=`${fe.ESC}\\`)(_w||={});var tp=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)}}};tp=Ht([Me(2,An),Me(3,Rn),Me(4,Lr),Me(5,ms)],tp);var an=0,on=0,cn=0,zt=0,vb={css:"#00000000",rgba:0},Xt;(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})(Xt||={});var Et;(e=>{function t(g,m){if(zt=(m.rgba&255)/255,zt===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,b=g.rgba>>16&255,w=g.rgba>>8&255;an=y+Math.round((v-y)*zt),on=b+Math.round((_-b)*zt),cn=w+Math.round((S-w)*zt);let E=Xt.toCss(an,on,cn),N=Xt.toRgba(an,on,cn);return{css:E,rgba:N}}e.blend=t;function i(g){return(g.rgba&255)===255}e.isOpaque=i;function r(g,m,v){let _=vu.ensureContrastRatio(g.rgba,m.rgba,v);if(_)return Xt.toColor(_>>24&255,_>>16&255,_>>8&255)}e.ensureContrastRatio=r;function a(g){let m=(g.rgba|255)>>>0;return[an,on,cn]=vu.toChannels(m),{css:Xt.toCss(an,on,cn),rgba:m}}e.opaque=a;function c(g,m){return zt=Math.round(m*255),[an,on,cn]=vu.toChannels(g.rgba),{css:Xt.toCss(an,on,cn,zt),rgba:Xt.toRgba(an,on,cn,zt)}}e.opacity=c;function h(g,m){return zt=g.rgba&255,c(g,zt*m/255)}e.multiplyOpacity=h;function f(g){return[g.rgba>>24&255,g.rgba>>16&255,g.rgba>>8&255]}e.toColorRGB=f})(Et||={});var Rt;(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 an=parseInt(a.slice(1,2).repeat(2),16),on=parseInt(a.slice(2,3).repeat(2),16),cn=parseInt(a.slice(3,4).repeat(2),16),Xt.toColor(an,on,cn);case 5:return an=parseInt(a.slice(1,2).repeat(2),16),on=parseInt(a.slice(2,3).repeat(2),16),cn=parseInt(a.slice(3,4).repeat(2),16),zt=parseInt(a.slice(4,5).repeat(2),16),Xt.toColor(an,on,cn,zt);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 an=parseInt(c[1]),on=parseInt(c[2]),cn=parseInt(c[3]),zt=Math.round((c[5]===void 0?1:parseFloat(c[5]))*255),Xt.toColor(an,on,cn,zt);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),[an,on,cn,zt]=t.getImageData(0,0,1,1).data,zt!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:Xt.toRgba(an,on,cn,zt),css:a}}e.toColor=r})(Rt||={});var Mn;(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})(Mn||={});var vu;(e=>{function t(h,f){if(zt=(f&255)/255,zt===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 an=_+Math.round((g-_)*zt),on=S+Math.round((m-S)*zt),cn=y+Math.round((v-y)*zt),Xt.toRgba(an,on,cn)}e.blend=t;function i(h,f,g){let m=Mn.relativeLuminance(h>>8),v=Mn.relativeLuminance(f>>8);if(cs(m,v)<g){if(v<m){let y=r(h,f,g),b=cs(m,Mn.relativeLuminance(y>>8));if(b<g){let w=a(h,f,g),E=cs(m,Mn.relativeLuminance(w>>8));return b>E?y:w}return y}let _=a(h,f,g),S=cs(m,Mn.relativeLuminance(_>>8));if(S<g){let y=r(h,f,g),b=cs(m,Mn.relativeLuminance(y>>8));return S>b?_: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,b=f>>8&255,w=cs(Mn.relativeLuminance2(S,y,b),Mn.relativeLuminance2(m,v,_));for(;w<g&&(S>0||y>0||b>0);)S-=Math.max(0,Math.ceil(S*.1)),y-=Math.max(0,Math.ceil(y*.1)),b-=Math.max(0,Math.ceil(b*.1)),w=cs(Mn.relativeLuminance2(S,y,b),Mn.relativeLuminance2(m,v,_));return(S<<24|y<<16|b<<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,b=f>>8&255,w=cs(Mn.relativeLuminance2(S,y,b),Mn.relativeLuminance2(m,v,_));for(;w<g&&(S<255||y<255||b<255);)S=Math.min(255,S+Math.ceil((255-S)*.1)),y=Math.min(255,y+Math.ceil((255-y)*.1)),b=Math.min(255,b+Math.ceil((255-b)*.1)),w=cs(Mn.relativeLuminance2(S,y,b),Mn.relativeLuminance2(m,v,_));return(S<<24|y<<16|b<<8|255)>>>0}e.increaseLuminance=a;function c(h){return[h>>24&255,h>>16&255,h>>8&255,h&255]}e.toChannels=c})(vu||={});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 eO=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()]}},Tu=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++)Tu._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}};Tu=Ht([Me(0,An)],Tu);function tO(e){return 57508<=e&&e<=57558}function nO(e){return 9472<=e&&e<=9631}function iO(e){return tO(e)||nO(e)}function sO(){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 np=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,b=e.getNoBgTrimmedLength();i&&b<c+1&&(b=c+1);let w,E=0,N="",A=0,R=0,B=0,q=0,z=!1,D=0,$=!1,ae=0,I=0,G=[],F=m!==-1&&v!==-1;for(let O=0;O<b;O++){e.loadCell(O,this._workCell);let U=this._workCell.getWidth();if(U===0)continue;let K=!1,V=O>=I,se=O,ee=this._workCell;if(S.length>0&&O===S[0][0]&&V){let Ae=S.shift(),st=this._isCellInSelection(Ae[0],t);for(A=Ae[0]+1;A<Ae[1];A++)V&&=st===this._isCellInSelection(A,t);V&&=!i||c<Ae[0]||c>=Ae[1],V?(K=!0,ee=new eO(this._workCell,e.translateToString(!0,Ae[0],Ae[1]),Ae[1]-Ae[0]),se=Ae[1]-1,U=ee.getWidth()):I=Ae[1]}let ge=this._isCellInSelection(O,t),T=i&&O===c,De=F&&O>=m&&O<=v,me=!1;this._decorationService.forEachDecorationAtCell(O,t,void 0,Ae=>{me=!0});let M=ee.getChars()||Ks;if(M===" "&&(ee.isUnderline()||ee.isOverline())&&(M=" "),ae=U*f-g.get(M,ee.isBold(),ee.isItalic()),!w)w=this._document.createElement("span");else if(E&&(ge&&$||!ge&&!$&&ee.bg===R)&&(ge&&$&&y.selectionForeground||ee.fg===B)&&ee.extended.ext===q&&De===z&&ae===D&&!T&&!K&&!me&&V){ee.isInvisible()?N+=Ks:N+=M,E++;continue}else E&&(w.textContent=N),w=this._document.createElement("span"),E=0,N="";if(R=ee.bg,B=ee.fg,q=ee.extended.ext,z=De,D=ae,$=ge,K&&c>=O&&c<=se&&(c=O),!this._coreService.isCursorHidden&&T&&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(ee.isBold()&&G.push("xterm-bold"),ee.isItalic()&&G.push("xterm-italic"),ee.isDim()&&G.push("xterm-dim"),ee.isInvisible()?N=Ks:N=ee.getChars()||Ks,ee.isUnderline()&&(G.push(`xterm-underline-${ee.extended.underlineStyle}`),N===" "&&(N=" "),!ee.isUnderlineColorDefault()))if(ee.isUnderlineColorRGB())w.style.textDecorationColor=`rgb(${yo.toColorRGB(ee.getUnderlineColor()).join(",")})`;else{let Ae=ee.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&ee.isBold()&&Ae<8&&(Ae+=8),w.style.textDecorationColor=y.ansi[Ae].css}ee.isOverline()&&(G.push("xterm-overline"),N===" "&&(N=" ")),ee.isStrikethrough()&&G.push("xterm-strikethrough"),De&&(w.style.textDecoration="underline");let j=ee.getFgColor(),Z=ee.getFgColorMode(),re=ee.getBgColor(),ie=ee.getBgColorMode(),pe=!!ee.isInverse();if(pe){let Ae=j;j=re,re=Ae;let st=Z;Z=ie,ie=st}let ve,je,de=!1;this._decorationService.forEachDecorationAtCell(O,t,void 0,Ae=>{Ae.options.layer!=="top"&&de||(Ae.backgroundColorRGB&&(ie=50331648,re=Ae.backgroundColorRGB.rgba>>8&16777215,ve=Ae.backgroundColorRGB),Ae.foregroundColorRGB&&(Z=50331648,j=Ae.foregroundColorRGB.rgba>>8&16777215,je=Ae.foregroundColorRGB),de=Ae.options.layer==="top")}),!de&&ge&&(ve=this._coreBrowserService.isFocused?y.selectionBackgroundOpaque:y.selectionInactiveBackgroundOpaque,re=ve.rgba>>8&16777215,ie=50331648,de=!0,y.selectionForeground&&(Z=50331648,j=y.selectionForeground.rgba>>8&16777215,je=y.selectionForeground)),de&&G.push("xterm-decoration-top");let be;switch(ie){case 16777216:case 33554432:be=y.ansi[re],G.push(`xterm-bg-${re}`);break;case 50331648:be=Xt.toColor(re>>16,re>>8&255,re&255),this._addStyle(w,`background-color:#${yb((re>>>0).toString(16),"0",6)}`);break;default:pe?(be=y.foreground,G.push("xterm-bg-257")):be=y.background}switch(ve||ee.isDim()&&(ve=Et.multiplyOpacity(be,.5)),Z){case 16777216:case 33554432:ee.isBold()&&j<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(j+=8),this._applyMinimumContrast(w,be,y.ansi[j],ee,ve,void 0)||G.push(`xterm-fg-${j}`);break;case 50331648:let Ae=Xt.toColor(j>>16&255,j>>8&255,j&255);this._applyMinimumContrast(w,be,Ae,ee,ve,je)||this._addStyle(w,`color:#${yb(j.toString(16),"0",6)}`);break;default:this._applyMinimumContrast(w,be,y.foreground,ee,ve,je)||pe&&G.push("xterm-fg-257")}G.length&&(w.className=G.join(" "),G.length=0),!T&&!K&&!me&&V?E++:w.textContent=N,ae!==this.defaultSpacing&&(w.style.letterSpacing=`${ae}px`),_.push(w),O=se}return w&&E&&(w.textContent=N),_}_applyMinimumContrast(e,t,i,r,a,c){if(this._optionsService.rawOptions.minimumContrastRatio===1||iO(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=Et.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]}};np=Ht([Me(1,J1),Me(2,Rn),Me(3,fs),Me(4,Lr),Me(5,So),Me(6,$l)],np);function yb(e,t,i){for(;e.length<i;)e=t+e;return e}var rO=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}},lO=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 aO(){return new lO}var Jf="xterm-dom-renderer-owner-",di="xterm-rows",su="xterm-fg-",Sb="xterm-bg-",Va="xterm-focus",ru="xterm-selection",oO=1,ip=class extends Je{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=oO++,this._rowElements=[],this._selectionRenderModel=aO(),this.onRequestRedraw=this._register(new we).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=sO(),this._updateDimensions(),this._register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this._register(this._themeService.onChangeColors(b=>this._injectCss(b))),this._injectCss(this._themeService.colors),this._rowFactory=f.createInstance(np,document),this._element.classList.add(Jf+this._terminalClass),this._screenElement.appendChild(this._rowContainer),this._screenElement.appendChild(this._selectionContainer),this._register(this._linkifier2.onShowLinkUnderline(b=>this._handleLinkHover(b))),this._register(this._linkifier2.onHideLinkUnderline(b=>this._handleLinkLeave(b))),this._register(Dt(()=>{this._element.classList.remove(Jf+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()})),this._widthCache=new rO(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: ${Et.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: ${Et.multiplyOpacity(h,.5).css}; }${this._terminalSelector} .${Sb}${c} { background-color: ${h.css}; }`;t+=`${this._terminalSelector} .${su}257 { color: ${Et.opaque(e.background).css}; }${this._terminalSelector} .${su}257.xterm-dim { color: ${Et.multiplyOpacity(Et.opaque(e.background),.5).css}; }${this._terminalSelector} .${Sb}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`.${Jf}${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 b=y+f.ydisp,w=this._rowElements[y],E=f.lines.get(b);if(!w||!E)break;w.replaceChildren(...this._rowFactory.createRow(E,b,b===g,_,S,m,v,this.dimensions.css.cell.width,this._widthCache,c?y===i?e:0:-1,c?(y===r?t:a)-1:-1))}}};ip=Ht([Me(7,Gp),Me(8,qu),Me(9,Rn),Me(10,An),Me(11,Lr),Me(12,fs),Me(13,$l)],ip);var sp=class extends Je{constructor(e,t,i){super(),this._optionsService=i,this.width=0,this.height=0,this._onCharSizeChange=this._register(new we),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this._register(new uO(this._optionsService))}catch{this._measureStrategy=this._register(new cO(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())}};sp=Ht([Me(2,Rn)],sp);var vw=class extends Je{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)}},cO=class extends vw{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}},uO=class extends vw{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}},hO=class extends Je{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 dO(this._window)),this._onDprChange=this._register(new we),this.onDprChange=this._onDprChange.event,this._onWindowChange=this._register(new we),this.onWindowChange=this._onWindowChange.event,this._register(this.onWindowChange(r=>this._screenDprMonitor.setWindow(r))),this._register(Sn.forward(this._screenDprMonitor.onDprChange,this._onDprChange)),this._register(qe(this._textarea,"focus",()=>this._isFocused=!0)),this._register(qe(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}},dO=class extends Je{constructor(e){super(),this._parentWindow=e,this._windowResizeListener=this._register(new Pl),this._onDprChange=this._register(new we),this.onDprChange=this._onDprChange.event,this._outerListener=()=>this._setDprAndFireIfDiffers(),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._updateDpr(),this._setWindowResizeListener(),this._register(Dt(()=>this.clearListener()))}setWindow(e){this._parentWindow=e,this._setWindowResizeListener(),this._setDprAndFireIfDiffers()}_setWindowResizeListener(){this._windowResizeListener.value=qe(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)}},fO=class extends Je{constructor(){super(),this.linkProviders=[],this._register(Dt(()=>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 sg(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 mO(e,t,i,r,a,c,h,f,g){if(!c)return;let m=sg(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 rp=class{constructor(e,t){this._renderService=e,this._charSizeService=t}getCoords(e,t,i,r,a){return mO(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=sg(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])}}};rp=Ht([Me(0,ms),Me(1,qu)],rp);var pO=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=[]}},yw={};k4(yw,{getSafariVersion:()=>_O,isChromeOS:()=>ww,isFirefox:()=>Sw,isIpad:()=>vO,isIphone:()=>yO,isLegacyEdge:()=>gO,isLinux:()=>rg,isMac:()=>Du,isNode:()=>Fu,isSafari:()=>bw,isWindows:()=>xw});var Fu=typeof process<"u"&&"title"in process,bo=Fu?"node":navigator.userAgent,xo=Fu?"node":navigator.platform,Sw=bo.includes("Firefox"),gO=bo.includes("Edge"),bw=/^((?!chrome|android).)*safari/i.test(bo);function _O(){if(!bw)return 0;let e=bo.match(/Version\/(\d+)/);return e===null||e.length<2?0:parseInt(e[1])}var Du=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(xo),vO=xo==="iPad",yO=xo==="iPhone",xw=["Windows","Win16","Win32","WinCE"].includes(xo),rg=xo.indexOf("Linux")>=0,ww=/\bCrOS\b/.test(bo),Cw=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()}},SO=class extends Cw{_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())}}},bO=class extends Cw{_requestCallback(e){return requestIdleCallback(e)}_cancelCallback(e){cancelIdleCallback(e)}},Mu=!Fu&&"requestIdleCallback"in window?bO:SO,xO=class{constructor(){this._queue=new Mu}set(e){this._queue.clear(),this._queue.enqueue(e)}flush(){this._queue.flush()}},lp=class extends Je{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 xO,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 we),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this._register(new we),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this._register(new we),this.onRender=this._onRender.event,this._onRefreshRequest=this._register(new we),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new pO((m,v)=>this._renderRows(m,v),this._coreBrowserService),this._register(this._renderDebouncer),this._syncOutputHandler=new wO(this._coreBrowserService,this._coreService,()=>this._fullRefresh()),this._register(Dt(()=>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=Dt(()=>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()}};lp=Ht([Me(2,Rn),Me(3,qu),Me(4,Lr),Me(5,So),Me(6,An),Me(7,fs),Me(8,$l)],lp);var wO=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 CO(e,t,i,r){let a=i.buffer.x,c=i.buffer.y;if(!i.buffer.hasScrollback)return EO(a,c,e,t,i,r)+$u(c,t,i,r)+jO(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=NO(c>t?e:a,i)+(f-1)*i.cols+1+kO(c>t?a:e);return fo(g,ho(h,r))}function kO(e,t){return e-1}function NO(e,t){return t.cols-e}function EO(e,t,i,r,a,c){return $u(t,r,a,c).length===0?"":fo(Nw(e,t,e,t-Or(t,a),!1,a).length,ho("D",c))}function $u(e,t,i,r){let a=e-Or(e,i),c=t-Or(t,i),h=Math.abs(a-c)-TO(e,t,i);return fo(h,ho(kw(e,t),r))}function jO(e,t,i,r,a,c){let h;$u(t,r,a,c).length>0?h=r-Or(r,a):h=t;let f=r,g=DO(e,t,i,r,a,c);return fo(Nw(e,h,i,f,g==="C",a).length,ho(g,c))}function TO(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=kw(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 DO(e,t,i,r,a,c){let h;return $u(i,r,a,c).length>0?h=r-Or(r,a):h=t,e<i&&h<=r||e>=i&&h<r?"C":"D"}function kw(e,t){return e>t?"A":"B"}function Nw(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 MO=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 bb(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 em=50,AO=15,RO=50,OO=500,BO=" ",LO=new RegExp(BO,"g"),ap=class extends Je{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 we),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this._register(new we),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this._register(new we),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this._register(new we),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 MO(this._bufferService),this._activeSelectionMode=0,this._register(Dt(()=>{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(LO," ")).join(xw?`\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())),rg&&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=bb(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=sg(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,-em),em),t/=em,t/Math.abs(t)+Math.round(t*(AO-1)))}shouldForceSelection(e){return Du?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(),RO)}_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&&!(Du&&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<OO&&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=CO(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 E=e[0],N=e[0];c.getWidth(E)===0&&(v++,E--),c.getWidth(N)===2&&(_++,N++);let A=c.getString(N).length;for(A>1&&(y+=A-1,g+=A-1);E>0&&f>0&&!this._isCharWordSeparator(c.loadCell(E-1,this._workCell));){c.loadCell(E-1,this._workCell);let R=this._workCell.getChars().length;this._workCell.getWidth()===0?(v++,E--):R>1&&(S+=R-1,f-=R-1),f--,E--}for(;N<c.length&&g+1<h.length&&!this._isCharWordSeparator(c.loadCell(N+1,this._workCell));){c.loadCell(N+1,this._workCell);let R=this._workCell.getChars().length;this._workCell.getWidth()===2?(_++,N++):R>1&&(y+=R-1,g+=R-1),g++,N++}}g++;let b=f+m-v+S,w=Math.min(this._bufferService.cols,g-f+v+_-S-y);if(!(!t&&h.slice(f,g).trim()==="")){if(i&&b===0&&c.getCodePoint(0)!==32){let E=a.lines.get(e[1]-1);if(E&&c.isWrapped&&E.getCodePoint(this._bufferService.cols-1)!==32){let N=this._getWordAt([this._bufferService.cols-1,e[1]-1],!1,!0,!1);if(N){let A=this._bufferService.cols-N.start;b-=A,w+=A}}}if(r&&b+w===this._bufferService.cols&&c.getCodePoint(this._bufferService.cols-1)!==32){let E=a.lines.get(e[1]+1);if(E?.isWrapped&&E.getCodePoint(0)!==32){let N=this._getWordAt([0,e[1]+1],!1,!1,!0);N&&(w+=N.length)}}return{start:b,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=bb(i,this._bufferService.cols)}};ap=Ht([Me(3,An),Me(4,Lr),Me(5,Qp),Me(6,Rn),Me(7,ms),Me(8,fs)],ap);var xb=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={}}},wb=class{constructor(){this._color=new xb,this._css=new xb}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()}},Qt=Object.freeze((()=>{let e=[Rt.toColor("#2e3436"),Rt.toColor("#cc0000"),Rt.toColor("#4e9a06"),Rt.toColor("#c4a000"),Rt.toColor("#3465a4"),Rt.toColor("#75507b"),Rt.toColor("#06989a"),Rt.toColor("#d3d7cf"),Rt.toColor("#555753"),Rt.toColor("#ef2929"),Rt.toColor("#8ae234"),Rt.toColor("#fce94f"),Rt.toColor("#729fcf"),Rt.toColor("#ad7fa8"),Rt.toColor("#34e2e2"),Rt.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:Xt.toCss(r,a,c),rgba:Xt.toRgba(r,a,c)})}for(let i=0;i<24;i++){let r=8+i*10;e.push({css:Xt.toCss(r,r,r),rgba:Xt.toRgba(r,r,r)})}return e})()),kr=Rt.toColor("#ffffff"),Ja=Rt.toColor("#000000"),Cb=Rt.toColor("#ffffff"),kb=Ja,Ka={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117},zO=kr,op=class extends Je{constructor(e){super(),this._optionsService=e,this._contrastCache=new wb,this._halfContrastCache=new wb,this._onChangeColors=this._register(new we),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:kr,background:Ja,cursor:Cb,cursorAccent:kb,selectionForeground:void 0,selectionBackgroundTransparent:Ka,selectionBackgroundOpaque:Et.blend(Ja,Ka),selectionInactiveBackgroundTransparent:Ka,selectionInactiveBackgroundOpaque:Et.blend(Ja,Ka),scrollbarSliderBackground:Et.opacity(kr,.2),scrollbarSliderHoverBackground:Et.opacity(kr,.4),scrollbarSliderActiveBackground:Et.opacity(kr,.5),overviewRulerBorder:kr,ansi:Qt.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=bt(e.foreground,kr),t.background=bt(e.background,Ja),t.cursor=Et.blend(t.background,bt(e.cursor,Cb)),t.cursorAccent=Et.blend(t.background,bt(e.cursorAccent,kb)),t.selectionBackgroundTransparent=bt(e.selectionBackground,Ka),t.selectionBackgroundOpaque=Et.blend(t.background,t.selectionBackgroundTransparent),t.selectionInactiveBackgroundTransparent=bt(e.selectionInactiveBackground,t.selectionBackgroundTransparent),t.selectionInactiveBackgroundOpaque=Et.blend(t.background,t.selectionInactiveBackgroundTransparent),t.selectionForeground=e.selectionForeground?bt(e.selectionForeground,vb):void 0,t.selectionForeground===vb&&(t.selectionForeground=void 0),Et.isOpaque(t.selectionBackgroundTransparent)&&(t.selectionBackgroundTransparent=Et.opacity(t.selectionBackgroundTransparent,.3)),Et.isOpaque(t.selectionInactiveBackgroundTransparent)&&(t.selectionInactiveBackgroundTransparent=Et.opacity(t.selectionInactiveBackgroundTransparent,.3)),t.scrollbarSliderBackground=bt(e.scrollbarSliderBackground,Et.opacity(t.foreground,.2)),t.scrollbarSliderHoverBackground=bt(e.scrollbarSliderHoverBackground,Et.opacity(t.foreground,.4)),t.scrollbarSliderActiveBackground=bt(e.scrollbarSliderActiveBackground,Et.opacity(t.foreground,.5)),t.overviewRulerBorder=bt(e.overviewRulerBorder,zO),t.ansi=Qt.slice(),t.ansi[0]=bt(e.black,Qt[0]),t.ansi[1]=bt(e.red,Qt[1]),t.ansi[2]=bt(e.green,Qt[2]),t.ansi[3]=bt(e.yellow,Qt[3]),t.ansi[4]=bt(e.blue,Qt[4]),t.ansi[5]=bt(e.magenta,Qt[5]),t.ansi[6]=bt(e.cyan,Qt[6]),t.ansi[7]=bt(e.white,Qt[7]),t.ansi[8]=bt(e.brightBlack,Qt[8]),t.ansi[9]=bt(e.brightRed,Qt[9]),t.ansi[10]=bt(e.brightGreen,Qt[10]),t.ansi[11]=bt(e.brightYellow,Qt[11]),t.ansi[12]=bt(e.brightBlue,Qt[12]),t.ansi[13]=bt(e.brightMagenta,Qt[13]),t.ansi[14]=bt(e.brightCyan,Qt[14]),t.ansi[15]=bt(e.brightWhite,Qt[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]=bt(e.extendedAnsi[r],Qt[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()}}};op=Ht([Me(0,Rn)],op);function bt(e,t){if(e!==void 0)try{return Rt.toColor(e)}catch{}return t}var HO=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)}},IO=class{constructor(){this._services=new HO,this._services.set(Gp,this)}setService(e,t){this._services.set(e,t)}getService(e){return this._services.get(e)}createInstance(e,...t){let i=A4(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)}},UO={trace:0,debug:1,info:2,warn:3,error:4,off:5},PO="xterm.js: ",cp=class extends Je{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=UO[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?"":PO)+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)}};cp=Ht([Me(0,Rn)],cp);var Nb=class extends Je{constructor(e){super(),this._maxLength=e,this.onDeleteEmitter=this._register(new we),this.onDelete=this.onDeleteEmitter.event,this.onInsertEmitter=this._register(new we),this.onInsert=this.onInsertEmitter.event,this.onTrimEmitter=this._register(new we),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}},Qe=3,Wt=Object.freeze(new yo),lu=0,tm=2,eo=class Ew{constructor(t,i,r=!1){this.isWrapped=r,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(t*Qe);let a=i||gi.fromCharData([0,K1,1,0]);for(let c=0;c<t;++c)this.setCell(c,a);this.length=t}get(t){let i=this._data[t*Qe+0],r=i&2097151;return[this._data[t*Qe+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*Qe+1]=i[0],i[1].length>1?(this._combined[t]=i[1],this._data[t*Qe+0]=t|2097152|i[2]<<22):this._data[t*Qe+0]=i[1].charCodeAt(0)|i[2]<<22}getWidth(t){return this._data[t*Qe+0]>>22}hasWidth(t){return this._data[t*Qe+0]&12582912}getFg(t){return this._data[t*Qe+1]}getBg(t){return this._data[t*Qe+2]}hasContent(t){return this._data[t*Qe+0]&4194303}getCodePoint(t){let i=this._data[t*Qe+0];return i&2097152?this._combined[t].charCodeAt(this._combined[t].length-1):i&2097151}isCombined(t){return this._data[t*Qe+0]&2097152}getString(t){let i=this._data[t*Qe+0];return i&2097152?this._combined[t]:i&2097151?Vs(i&2097151):""}isProtected(t){return this._data[t*Qe+2]&536870912}loadCell(t,i){return lu=t*Qe,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*Qe+0]=i.content,this._data[t*Qe+1]=i.fg,this._data[t*Qe+2]=i.bg}setCellFromCodepoint(t,i,r,a){a.bg&268435456&&(this._extendedAttrs[t]=a.extended),this._data[t*Qe+0]=i|r<<22,this._data[t*Qe+1]=a.fg,this._data[t*Qe+2]=a.bg}addCodepointToCell(t,i,r){let a=this._data[t*Qe+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*Qe+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*tm<this._data.buffer.byteLength;let r=t*Qe;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*tm<this._data.buffer.byteLength}cleanupMemory(){if(this._data.length*4*tm<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 Ew(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*Qe+0]&4194303)return t+(this._data[t*Qe+0]>>22);return 0}getNoBgTrimmedLength(){for(let t=this.length-1;t>=0;--t)if(this._data[t*Qe+0]&4194303||this._data[t*Qe+2]&50331648)return t+(this._data[t*Qe+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<Qe;m++)this._data[(r+g)*Qe+m]=h[(i+g)*Qe+m];h[(i+g)*Qe+2]&268435456&&(this._extendedAttrs[r+g]=t._extendedAttrs[i+g])}else for(let g=0;g<a;g++){for(let m=0;m<Qe;m++)this._data[(r+g)*Qe+m]=h[(i+g)*Qe+m];h[(i+g)*Qe+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*Qe+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 qO(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,b=0;for(;y<v.length;){let E=mo(v,y,t),N=E-b,A=i-S,R=Math.min(N,A);v[_].copyCellsFrom(v[y],b,S,R,!1),S+=R,S===i&&(_++,S=0),b+=R,b===E&&(y++,b=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 E=v.length-1;E>0&&(E>_||v[E].getTrimmedLength()===0);E--)w++;w>0&&(h.push(f+v.length-w),h.push(w)),f+=v.length-1}return h}function FO(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 $O(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 VO(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 jw=class Tw{constructor(t){this.line=t,this.isDisposed=!1,this._disposables=[],this._id=Tw._nextId++,this._onDispose=this.register(new we),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}};jw._nextId=1;var KO=jw,Jt={},Nr=Jt.B;Jt[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:"≥","{":"π","|":"≠","}":"£","~":"·"};Jt.A={"#":"£"};Jt.B=void 0;Jt[4]={"#":"£","@":"¾","[":"ij","\\":"½","]":"|","{":"¨","|":"f","}":"¼","~":"´"};Jt.C=Jt[5]={"[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"};Jt.R={"#":"£","@":"à","[":"°","\\":"ç","]":"§","{":"é","|":"ù","}":"è","~":"¨"};Jt.Q={"@":"à","[":"â","\\":"ç","]":"ê","^":"î","`":"ô","{":"é","|":"ù","}":"è","~":"û"};Jt.K={"@":"§","[":"Ä","\\":"Ö","]":"Ü","{":"ä","|":"ö","}":"ü","~":"ß"};Jt.Y={"#":"£","@":"§","[":"°","\\":"ç","]":"é","`":"ù","{":"à","|":"ò","}":"è","~":"ì"};Jt.E=Jt[6]={"@":"Ä","[":"Æ","\\":"Ø","]":"Å","^":"Ü","`":"ä","{":"æ","|":"ø","}":"å","~":"ü"};Jt.Z={"#":"£","@":"§","[":"¡","\\":"Ñ","]":"¿","{":"°","|":"ñ","}":"ç"};Jt.H=Jt[7]={"@":"É","[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"};Jt["="]={"#":"ù","@":"à","[":"é","\\":"ç","]":"ê","^":"î",_:"è","`":"ô","{":"ä","|":"ö","}":"ü","~":"û"};var Eb=4294967295,jb=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=Wt.clone(),this.savedCharset=Nr,this.markers=[],this._nullCell=gi.fromCharData([0,K1,1,0]),this._whitespaceCell=gi.fromCharData([0,Ks,1,32]),this._isClearing=!1,this._memoryCleanupQueue=new Mu,this._memoryCleanupPosition=0,this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new Nb(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 Eu),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 Eu),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>Eb?Eb:t}fillViewportRows(e){if(this.lines.length===0){e===void 0&&(e=Wt);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 Nb(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(e,t){let i=this.getNullCell(Wt),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=qO(this.lines,this._cols,e,this.ybase+this.y,this.getNullCell(Wt),i);if(r.length>0){let a=FO(this.lines,r);$O(this.lines,a.layout),this._reflowLargerAdjustViewport(e,t,a.countRemoved)}}_reflowLargerAdjustViewport(e,t,i){let r=this.getNullCell(Wt),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(Wt),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 R=this.ybase+this.y;if(R>=h&&R<h+g.length)continue}let m=g[g.length-1].getTrimmedLength(),v=VO(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 R=0;R<_;R++){let B=this.getBlankLine(Wt,!0);y.push(B)}y.length>0&&(a.push({start:h+g.length+c,newLines:y}),c+=y.length),g.push(...y);let b=v.length-1,w=v[b];w===0&&(b--,w=v[b]);let E=g.length-_-1,N=m;for(;E>=0;){let R=Math.min(N,w);if(g[b]===void 0)break;if(g[b].copyCellsFrom(g[E],N-R,w-R,R,!0),w-=R,w===0&&(b--,w=v[b]),N-=R,N===0){E--;let B=Math.max(E,0);N=mo(g,B,this._cols)}}for(let R=0;R<g.length;R++)v[R]<e&&g[R].setCell(v[R],r);let A=_-S;for(;A-- >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 E=_.newLines.length-1;E>=0;E--)this.lines.set(w--,_.newLines[E]);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 b=Math.max(0,g+c-this.lines.maxLength);b>0&&this.lines.onTrimEmitter.fire(b)}}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 KO(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)}},YO=class extends Je{constructor(e,t){super(),this._optionsService=e,this._bufferService=t,this._onBufferActivate=this._register(new we),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 jb(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new jb(!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)}},Dw=2,Mw=1,up=class extends Je{constructor(e){super(),this.isUserScrolling=!1,this._onResize=this._register(new we),this.onResize=this._onResize.event,this._onScroll=this._register(new we),this.onScroll=this._onScroll.event,this.cols=Math.max(e.rawOptions.cols||0,Dw),this.rows=Math.max(e.rawOptions.rows||0,Mw),this.buffers=this._register(new YO(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))}};up=Ht([Me(0,Rn)],up);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:Du,windowOptions:{},windowsMode:!1,windowsPty:{},wordSeparator:" ()[]{}',\"`",altClickMovesCursor:!0,convertEol:!1,termName:"xterm",cancelEvents:!1,overviewRuler:{}},WO=["normal","bold","100","200","300","400","500","600","700","800","900"],XO=class extends Je{constructor(e){super(),this._onOptionChange=this._register(new we),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(Dt(()=>{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]),!GO(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=WO.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 GO(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 Tb=Object.freeze({insertMode:!1}),Db=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,cursorBlink:void 0,cursorStyle:void 0,origin:!1,reverseWraparound:!1,sendFocus:!1,synchronizedOutput:!1,wraparound:!0}),hp=class extends Je{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 we),this.onData=this._onData.event,this._onUserInput=this._register(new we),this.onUserInput=this._onUserInput.event,this._onBinary=this._register(new we),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this._register(new we),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=to(Tb),this.decPrivateModes=to(Db)}reset(){this.modes=to(Tb),this.decPrivateModes=to(Db)}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))}};hp=Ht([Me(0,An),Me(1,Q1),Me(2,Rn)],hp);var Mb={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 nm(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 im=String.fromCharCode,Ab={DEFAULT:e=>{let t=[nm(e,!1)+32,e.col+32,e.row+32];return t[0]>255||t[1]>255||t[2]>255?"":`\x1B[M${im(t[0])}${im(t[1])}${im(t[2])}`},SGR:e=>{let t=e.action===0&&e.button!==4?"m":"M";return`\x1B[<${nm(e,!0)};${e.col};${e.row}${t}`},SGR_PIXELS:e=>{let t=e.action===0&&e.button!==4?"m":"M";return`\x1B[<${nm(e,!0)};${e.x};${e.y}${t}`}},dp=class extends Je{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 we),this.onProtocolChange=this._onProtocolChange.event;for(let r of Object.keys(Mb))this.addProtocol(r,Mb[r]);for(let r of Object.keys(Ab))this.addEncoding(r,Ab[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)}};dp=Ht([Me(0,An),Me(1,Lr),Me(2,Rn)],dp);var sm=[[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]],QO=[[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]],Zt;function ZO(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 JO=class{constructor(){if(this.version="6",!Zt){Zt=new Uint8Array(65536),Zt.fill(1),Zt[0]=0,Zt.fill(0,1,32),Zt.fill(0,127,160),Zt.fill(2,4352,4448),Zt[9001]=2,Zt[9002]=2,Zt.fill(2,11904,42192),Zt[12351]=1,Zt.fill(2,44032,55204),Zt.fill(2,63744,64256),Zt.fill(2,65040,65050),Zt.fill(2,65072,65136),Zt.fill(2,65280,65377),Zt.fill(2,65504,65511);for(let e=0;e<sm.length;++e)Zt.fill(0,sm[e][0],sm[e][1]+1)}}wcwidth(e){return e<32?0:e<127?1:e<65536?Zt[e]:ZO(e,QO)?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 yu{constructor(){this._providers=Object.create(null),this._active="",this._onChange=new we,this.onChange=this._onChange.event;let t=new JO;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=yu.extractWidth(f);yu.extractShouldJoin(f)&&(g-=yu.extractWidth(r)),i+=g,r=f}return i}charProperties(t,i){return this._activeProvider.charProperties(t,i)}},eB=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 Rb(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,tB=256,Aw=class fp{constructor(t=32,i=32){if(this.maxLength=t,this.maxSubParamsLength=i,i>tB)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 fp;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 fp(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=[],nB=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",Pu(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}}},Jn=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+=Pu(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=[],iB=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",Pu(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 Aw;no.addParam(0);var Ob=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+=Pu(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}},sB=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,rB=(function(){let e=new sB(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})(),lB=class extends Je{constructor(e=rB){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 Aw,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(Dt(()=>{this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null)})),this._oscParser=this._register(new nB),this._dcsParser=this._register(new iB),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}}},aB=/^([\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})$/,oB=/^[\da-f]+$/;function Bb(e){if(!e)return;let t=e.toLowerCase();if(t.indexOf("rgb:")===0){t=t.slice(4);let i=aB.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),oB.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 rm(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 cB(e,t=16){let[i,r,a]=e;return`rgb:${rm(i,t)}/${rm(r,t)}/${rm(a,t)}`}var uB={"(":0,")":1,"*":2,"+":3,"-":1,".":2},$s=131072,Lb=10;function zb(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 Hb=5e3,Ib=0,hB=class extends Je{constructor(e,t,i,r,a,c,h,f,g=new lB){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 D4,this._utf8Decoder=new M4,this._windowTitle="",this._iconName="",this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=Wt.clone(),this._eraseAttrDataInternal=Wt.clone(),this._onRequestBell=this._register(new we),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this._register(new we),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this._register(new we),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this._register(new we),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this._register(new we),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this._register(new we),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this._register(new we),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this._register(new we),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this._register(new we),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this._register(new we),this.onLineFeed=this._onLineFeed.event,this._onScroll=this._register(new we),this.onScroll=this._onScroll.event,this._onTitleChange=this._register(new we),this.onTitleChange=this._onTitleChange.event,this._onColor=this._register(new we),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 mp(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(_u.IND,()=>this.index()),this._parser.setExecuteHandler(_u.NEL,()=>this.nextLine()),this._parser.setExecuteHandler(_u.HTS,()=>this.tabSet()),this._parser.registerOscHandler(0,new Jn(m=>(this.setTitle(m),this.setIconName(m),!0))),this._parser.registerOscHandler(1,new Jn(m=>this.setIconName(m))),this._parser.registerOscHandler(2,new Jn(m=>this.setTitle(m))),this._parser.registerOscHandler(4,new Jn(m=>this.setOrReportIndexedColor(m))),this._parser.registerOscHandler(8,new Jn(m=>this.setHyperlink(m))),this._parser.registerOscHandler(10,new Jn(m=>this.setOrReportFgColor(m))),this._parser.registerOscHandler(11,new Jn(m=>this.setOrReportBgColor(m))),this._parser.registerOscHandler(12,new Jn(m=>this.setOrReportCursorColor(m))),this._parser.registerOscHandler(104,new Jn(m=>this.restoreIndexedColor(m))),this._parser.registerOscHandler(110,new Jn(m=>this.restoreFgColor(m))),this._parser.registerOscHandler(111,new Jn(m=>this.restoreBgColor(m))),this._parser.registerOscHandler(112,new Jn(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 Jt)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 Ob((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"),Hb))]).catch(t=>{if(t!=="#SLOW_TIMEOUT")throw t;console.warn(`async parser handler taking longer than ${Hb} 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 b=this._unicodeService.charProperties(r,S);a=jr.extractWidth(b);let w=jr.extractShouldJoin(b),E=w?jr.extractWidth(S):0;if(S=b,h&&this._onA11yChar.fire(Vs(r)),this._getCurrentLinkId()&&this._oscLinkService.addLineToLink(this._getCurrentLinkId(),this._activeBuffer.ybase+this._activeBuffer.y),this._activeBuffer.x+a-E>f){if(g){let N=_,A=this._activeBuffer.x-E;for(this._activeBuffer.x=E,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),E>0&&_ instanceof eo&&_.copyCellsFrom(N,A,0,E,!1);A<f;)N.setCellFromCodepoint(A++,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 A=a-E;--A>=0;)_.setCellFromCodepoint(this._activeBuffer.x++,0,0,v);continue}if(m&&(_.insertCells(this._activeBuffer.x,a-E,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=>zb(i.params[0],this._optionsService.rawOptions.windowOptions)?t(i):!0):this._parser.registerCsiHandler(e,t)}registerDcsHandler(e,t){return this._parser.registerDcsHandler(e,new Ob(t))}registerEscHandler(e,t){return this._parser.registerEscHandler(e,t)}registerOscHandler(e,t){return this._parser.registerOscHandler(e,new Jn(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(Wt));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,E)=>(h.triggerDataEvent(`${fe.ESC}[${t?"":"?"}${w};${E}$y`),!0),y=w=>w?1:2,b=e.params[0];return t?b===2?S(b,4):b===4?S(b,y(h.modes.insertMode)):b===12?S(b,3):b===20?S(b,y(_.convertEol)):S(b,0):b===1?S(b,y(r.applicationCursorKeys)):b===3?S(b,_.windowOptions.setWinLines?g===80?2:g===132?1:0:0):b===6?S(b,y(r.origin)):b===7?S(b,y(r.wraparound)):b===8?S(b,3):b===9?S(b,y(a==="X10")):b===12?S(b,y(_.cursorBlink)):b===25?S(b,y(!h.isCursorHidden)):b===45?S(b,y(r.reverseWraparound)):b===66?S(b,y(r.applicationKeypad)):b===67?S(b,4):b===1e3?S(b,y(a==="VT200")):b===1002?S(b,y(a==="DRAG")):b===1003?S(b,y(a==="ANY")):b===1004?S(b,y(r.sendFocus)):b===1005?S(b,4):b===1006?S(b,y(c==="SGR")):b===1015?S(b,4):b===1016?S(b,y(c==="SGR_PIXELS")):b===1048?S(b,1):b===47||b===1047||b===1049?S(b,y(m===v)):b===2004?S(b,y(r.bracketedPasteMode)):b===2026?S(b,y(r.synchronizedOutput)):S(b,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=Wt.fg,e.bg=Wt.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|=Wt.fg&16777215):i===49?(r.bg&=-67108864,r.bg|=Wt.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|=Wt.fg&16777215,r.bg&=-67108864,r.bg|=Wt.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=Wt.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(!zb(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>Lb&&this._windowTitleStack.shift()),(t===0||t===1)&&(this._iconNameStack.push(this._iconName),this._iconNameStack.length>Lb&&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(Ub(c))if(a==="?")t.push({type:0,index:c});else{let h=Bb(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=Bb(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]);Ub(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(uB[e[0]],Jt[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=Wt.clone(),this._eraseAttrDataInternal=Wt.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)}},mp=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&&(Ib=e,e=t,t=Ib),e<this.start&&(this.start=e),t>this.end&&(this.end=t)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};mp=Ht([Me(0,An)],mp);function Ub(e){return 0<=e&&e<256}var dB=5e7,Pb=12,fB=50,mB=class extends Je{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 we),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>dB)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>=Pb?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>=Pb)break}this._writeBuffer.length>this._bufferOffset?(this._bufferOffset>fB&&(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()}},pp=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)))}};pp=Ht([Me(0,An)],pp);var qb=!1,pB=class extends Je{constructor(e){super(),this._windowsWrappingHeuristics=this._register(new Pl),this._onBinary=this._register(new we),this.onBinary=this._onBinary.event,this._onData=this._register(new we),this.onData=this._onData.event,this._onLineFeed=this._register(new we),this.onLineFeed=this._onLineFeed.event,this._onResize=this._register(new we),this.onResize=this._onResize.event,this._onWriteParsed=this._register(new we),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this._register(new we),this._instantiationService=new IO,this.optionsService=this._register(new XO(e)),this._instantiationService.setService(Rn,this.optionsService),this._bufferService=this._register(this._instantiationService.createInstance(up)),this._instantiationService.setService(An,this._bufferService),this._logService=this._register(this._instantiationService.createInstance(cp)),this._instantiationService.setService(Q1,this._logService),this.coreService=this._register(this._instantiationService.createInstance(hp)),this._instantiationService.setService(Lr,this.coreService),this.coreMouseService=this._register(this._instantiationService.createInstance(dp)),this._instantiationService.setService(G1,this.coreMouseService),this.unicodeService=this._register(this._instantiationService.createInstance(jr)),this._instantiationService.setService(B4,this.unicodeService),this._charsetService=this._instantiationService.createInstance(eB),this._instantiationService.setService(O4,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(pp),this._instantiationService.setService(Z1,this._oscLinkService),this._inputHandler=this._register(new hB(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService)),this._register(Sn.forward(this._inputHandler.onLineFeed,this._onLineFeed)),this._register(this._inputHandler),this._register(Sn.forward(this._bufferService.onResize,this._onResize)),this._register(Sn.forward(this.coreService.onData,this._onData)),this._register(Sn.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 mB((t,i)=>this._inputHandler.parse(t,i))),this._register(Sn.forward(this._writeBuffer.onWriteParsed,this._onWriteParsed))}get onScroll(){return this._onScrollApi||(this._onScrollApi=this._register(new we),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&&!qb&&(this._logService.warn("writeSync is unreliable and will be removed soon."),qb=!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,Dw),t=Math.max(t,Mw),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(Rb.bind(null,this._bufferService))),e.push(this.registerCsiHandler({final:"H"},()=>(Rb(this._bufferService),!1))),this._windowsWrappingHeuristics.value=Dt(()=>{for(let t of e)t.dispose()})}}},gB={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 _B(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=gB[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 Pt=0,vB=class{constructor(e){this._getKey=e,this._array=[],this._insertedValues=[],this._flushInsertedTask=new Mu,this._isFlushingInserted=!1,this._deletedIndices=[],this._flushDeletedTask=new Mu,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||(Pt=this._search(t),Pt===-1)||this._getKey(this._array[Pt])!==t)return!1;do if(this._array[Pt]===e)return this._deletedIndices.length===0&&this._flushDeletedTask.enqueue(()=>this._flushDeleted()),this._deletedIndices.push(Pt),!0;while(++Pt<this._array.length&&this._getKey(this._array[Pt])===t);return!1}_flushDeleted(){this._isFlushingDeleted=!0;let e=this._deletedIndices.sort((a,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&&(Pt=this._search(e),!(Pt<0||Pt>=this._array.length)&&this._getKey(this._array[Pt])===e))do yield this._array[Pt];while(++Pt<this._array.length&&this._getKey(this._array[Pt])===e)}forEachByKey(e,t){if(this._flushCleanupInserted(),this._flushCleanupDeleted(),this._array.length!==0&&(Pt=this._search(e),!(Pt<0||Pt>=this._array.length)&&this._getKey(this._array[Pt])===e))do t(this._array[Pt]);while(++Pt<this._array.length&&this._getKey(this._array[Pt])===e)}values(){return this._flushCleanupInserted(),this._flushCleanupDeleted(),[...this._array].values()}_search(e){let t=0,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}},lm=0,Fb=0,yB=class extends Je{constructor(){super(),this._decorations=new vB(e=>e?.marker.line),this._onDecorationRegistered=this._register(new we),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this._register(new we),this.onDecorationRemoved=this._onDecorationRemoved.event,this._register(Dt(()=>this.reset()))}get decorations(){return this._decorations.values()}registerDecoration(e){if(e.marker.isDisposed)return;let t=new SB(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=>{lm=a.options.x??0,Fb=lm+(a.options.width??1),e>=lm&&e<Fb&&(!i||(a.options.layer??"bottom")===i)&&r(a)})}},SB=class extends Ys{constructor(e){super(),this.options=e,this.onRenderEmitter=this.add(new we),this.onRender=this.onRenderEmitter.event,this._onDispose=this.add(new we),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=Rt.toColor(this.options.backgroundColor):this._cachedBg=void 0),this._cachedBg}get foregroundColorRGB(){return this._cachedFg===null&&(this.options.foregroundColor?this._cachedFg=Rt.toColor(this.options.foregroundColor):this._cachedFg=void 0),this._cachedFg}dispose(){this._onDispose.fire(),super.dispose()}},bB=1e3,xB=class{constructor(e,t=bB){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)}},$b=20,Au=class extends Je{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 xB(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(qe(a,"selectionchange",()=>this._handleSelectionChange())),this._register(this._coreBrowserService.onDprChange(()=>this._refreshRowsDimensions())),this._refreshRowsDimensions(),this._refreshRows(),this._register(Dt(()=>{this._accessibilityContainer.remove(),this._rowElements.length=0}))}_handleTab(e){for(let t=0;t<e;t++)this._handleChar(" ")}_handleChar(e){this._liveRegionLineCount<$b+1&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==e&&(this._charsToAnnounce+=e):this._charsToAnnounce+=e,e===`
61
+ `&&(this._liveRegionLineCount++,this._liveRegionLineCount===$b+1&&(this._liveRegion.textContent+=Bm.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})`}};Au=Ht([Me(1,Gp),Me(2,fs),Me(3,ms)],Au);var gp=class extends Je{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 we),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this._register(new we),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this._register(Dt(()=>{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(qe(this._element,"mouseleave",()=>{this._isMouseOut=!0,this._clearCurrentLink()})),this._register(qe(this._element,"mousemove",this._handleMouseMove.bind(this))),this._register(qe(this._element,"mousedown",this._handleMouseDown.bind(this))),this._register(qe(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&&wB(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}}};gp=Ht([Me(1,Qp),Me(2,ms),Me(3,An),Me(4,ew)],gp);function wB(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 CB=class extends pB{constructor(e={}){super(e),this._linkifier=this._register(new Pl),this.browser=yw,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this._register(new Pl),this._onCursorMove=this._register(new we),this.onCursorMove=this._onCursorMove.event,this._onKey=this._register(new we),this.onKey=this._onKey.event,this._onRender=this._register(new we),this.onRender=this._onRender.event,this._onSelectionChange=this._register(new we),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this._register(new we),this.onTitleChange=this._onTitleChange.event,this._onBell=this._register(new we),this.onBell=this._onBell.event,this._onFocus=this._register(new we),this._onBlur=this._register(new we),this._onA11yCharEmitter=this._register(new we),this._onA11yTabEmitter=this._register(new we),this._onWillOpen=this._register(new we),this._setup(),this._decorationService=this._instantiationService.createInstance(yB),this._instantiationService.setService(So,this._decorationService),this._linkProviderService=this._instantiationService.createInstance(fO),this._instantiationService.setService(ew,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(zm)),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(Sn.forward(this._inputHandler.onCursorMove,this._onCursorMove)),this._register(Sn.forward(this._inputHandler.onTitleChange,this._onTitleChange)),this._register(Sn.forward(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this._register(Sn.forward(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this._register(this._bufferService.onResize(t=>this._afterResize(t.cols,t.rows))),this._register(Dt(()=>{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=Et.toColorRGB(i==="ansi"?this._themeService.colors.ansi[t.index]:this._themeService.colors[i]);this.coreService.triggerDataEvent(`${fe.ESC}]${r};${cB(a)}${_w.ST}`);break;case 1:if(i==="ansi")this._themeService.modifyColors(c=>c.ansi[t.index]=Xt.toColor(...t.color));else{let c=i;this._themeService.modifyColors(h=>h[c]=Xt.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(Au,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(qe(this.element,"copy",t=>{this.hasSelection()&&j4(t,this._selectionService)}));let e=t=>T4(t,this.textarea,this.coreService,this.optionsService);this._register(qe(this.textarea,"paste",e)),this._register(qe(this.element,"paste",e)),Sw?this._register(qe(this.element,"mousedown",t=>{t.button===2&&eb(t,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})):this._register(qe(this.element,"contextmenu",t=>{eb(t,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})),rg&&this._register(qe(this.element,"auxclick",t=>{t.button===1&&V1(t,this.textarea,this.screenElement)}))}_bindKeys(){this._register(qe(this.textarea,"keyup",e=>this._keyUp(e),!0)),this._register(qe(this.textarea,"keydown",e=>this._keyDown(e),!0)),this._register(qe(this.textarea,"keypress",e=>this._keyPress(e),!0)),this._register(qe(this.textarea,"compositionstart",()=>this._compositionHelper.compositionstart())),this._register(qe(this.textarea,"compositionupdate",e=>this._compositionHelper.compositionupdate(e))),this._register(qe(this.textarea,"compositionend",()=>this._compositionHelper.compositionend())),this._register(qe(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(qe(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",Om.get()),ww||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(hO,this.textarea,e.ownerDocument.defaultView??window,this._document??typeof window<"u"?window.document:null)),this._instantiationService.setService(fs,this._coreBrowserService),this._register(qe(this.textarea,"focus",a=>this._handleTextAreaFocus(a))),this._register(qe(this.textarea,"blur",()=>this._handleTextAreaBlur())),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(sp,this._document,this._helperContainer),this._instantiationService.setService(qu,this._charSizeService),this._themeService=this._instantiationService.createInstance(op),this._instantiationService.setService($l,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(Tu),this._instantiationService.setService(J1,this._characterJoinerService),this._renderService=this._register(this._instantiationService.createInstance(lp,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(tp,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseService=this._instantiationService.createInstance(rp),this._instantiationService.setService(Qp,this._mouseService);let r=this._linkifier.value=this._register(this._instantiationService.createInstance(gp,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(Jm,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(ap,this.element,this.screenElement,r)),this._instantiationService.setService(z4,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(Sn.any(this._onScroll.event,this._inputHandler.onScroll)(()=>{this._selectionService.refresh(),this._viewport?.queueSync()})),this._register(this._instantiationService.createInstance(ep,this.screenElement)),this._register(qe(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(Au,this)),this._register(this.optionsService.onSpecificOptionChange("screenReaderMode",a=>this._handleScreenReaderModeOptionChange(a))),this.options.overviewRuler.width&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(ju,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange("overviewRuler",a=>{!this._overviewRulerRenderer&&a&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(ju,this._viewportElement,this.screenElement)))}),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()}_createRenderer(){return this._instantiationService.createInstance(ip,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(qe(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(qe(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){$1(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=_B(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)&&(kB(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(Wt));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 kB(e){return e.keyCode===16||e.keyCode===17||e.keyCode===18}var NB=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)}},EB=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)}},Vb=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 EB(t)}getNullCell(){return new gi}},jB=class extends Je{constructor(e){super(),this._core=e,this._onBufferChange=this._register(new we),this.onBufferChange=this._onBufferChange.event,this._normal=new Vb(this._core.buffers.normal,"normal"),this._alternate=new Vb(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)}},TB=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)}},DB=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}},MB=["cols","rows"],Ii=0,AB=class extends Je{constructor(e){super(),this._core=this._register(new CB(e)),this._addonManager=this._register(new NB),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(MB.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 TB(this._core)),this._parser}get unicode(){return this._checkProposedApi(),new DB(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 jB(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 Om.get()},set promptLabel(e){Om.set(e)},get tooMuchOutput(){return Bm.get()},set tooMuchOutput(e){Bm.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 RB=12,OB=250,BB={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"},LB={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"},Kb=()=>document.documentElement.dataset.theme==="dark"?LB:BB;function am({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 AB({fontFamily:"ui-monospace, SFMono-Regular, Menlo, monospace",fontSize:12,lineHeight:1.35,cursorBlink:!0,scrollback:5e3,theme:Kb()}),_=new w4;v.loadAddon(_),v.open(m),c.current=v,h.current=_;let S="",y=null,b=null;const w=()=>{if(y=null,S==="")return;const q=S;S="",cx(e,q).catch(z=>{g.current?.(z instanceof Error?z.message:String(z))})},E=v.onData(q=>{S+=q,y===null&&(y=setTimeout(w,RB))}),N=()=>{b!==null&&clearTimeout(b),b=setTimeout(()=>{v.cols<=0||v.rows<=0||H0(e,v.cols,v.rows).catch(()=>{})},OB)},A=new EventSource(a2(e));A.onmessage=q=>{let z;try{z=JSON.parse(q.data)}catch{return}if(z.kind==="snapshot"){v.reset(),v.write(z.text),f.current(z.status),g.current?.(null);return}if(z.kind==="chunk"){v.write(z.text);return}f.current(z.status)},A.onerror=()=>{g.current?.("终端流断开,正在重连…")};const R=new ResizeObserver(()=>{if(!(m.offsetWidth===0||m.offsetHeight===0))try{_.fit(),N()}catch{}});R.observe(m);const B=new MutationObserver(()=>{v.options.theme=Kb()});return B.observe(document.documentElement,{attributes:!0,attributeFilter:["data-theme"]}),_.fit(),N(),()=>{E.dispose(),A.close(),R.disconnect(),B.disconnect(),y!==null&&clearTimeout(y),b!==null&&clearTimeout(b),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(),H0(e,m.cols,m.rows)}catch{}},0);return()=>{clearTimeout(v)}},[t]),u.jsx("div",{className:t?"term-host active":"term-host",ref:a})}function zB({onStats:e,createSignal:t}){const[i,r]=C.useState([]),[a,c]=C.useState(null),[h,f]=C.useState(null),[g,m]=C.useState(()=>n4()),[v,_]=C.useState(()=>t4()),[S,y]=C.useState(null),b=C.useRef(null),w=C.useRef(null),[E,N]=C.useState(!1),A=C.useRef(t),R=C.useCallback(async()=>{try{const O=await s2();r(O.terminals),c(U=>U!==null&&O.terminals.some(K=>K.id===U)?U:O.terminals[0]?.id??null),y(null)}catch(O){y(O instanceof Error?O.message:String(O))}},[]);C.useEffect(()=>{R();const O=setInterval(()=>{R()},5e3);return()=>{clearInterval(O)}},[R]),C.useEffect(()=>{e?.({running:i.filter(O=>O.status.kind==="running").length,total:i.length})},[i,e]),C.useEffect(()=>{g&&f(O=>O!==null&&O!==a&&i.some(K=>K.id===O)?O:(i.find(K=>K.id!==a&&K.status.kind==="running")??i.find(K=>K.id!==a))?.id??null)},[g,a,i]);const B=C.useCallback(async()=>{if(E)return null;N(!0);try{const O=await r2();return await R(),c(O.id),y(null),O.id}catch(O){return y(O instanceof Error?O.message:String(O)),null}finally{N(!1)}},[E,R]);C.useEffect(()=>{t!==A.current&&(A.current=t,B())},[t,B]);const q=async O=>{try{await l2(O),r(U=>U.filter(K=>K.id!==O)),c(U=>U===O?null:U),f(U=>U===O?null:U),await R()}catch(U){y(U instanceof Error?U.message:String(U))}},z=(O,U)=>{r(K=>K.map(V=>V.id===O?{...V,status:U}:V))},D=O=>{cx(O,"\f").catch(U=>{y(U instanceof Error?U.message:String(U))})},$=async O=>{if(!O){m(Kf(void 0,!1));return}let U=i.find(K=>K.id!==a&&K.status.kind==="running")?.id??i.find(K=>K.id!==a)?.id??null;U===null&&(U=await B()),U!==null&&(f(U),m(Kf(void 0,!0)))},ae=O=>{const U=i.find(K=>K.id===O);return U===void 0?null:U.status.kind==="running"?u.jsx("span",{className:"live-dot"}):u.jsx("span",{className:"exited",children:XS(U.status)})},I=O=>{if(O.button!==0)return;const U=b.current?.clientHeight??0;U<=0||(O.currentTarget.setPointerCapture(O.pointerId),w.current={startY:O.clientY,startRatio:v,height:U})},G=O=>{const U=w.current;if(U===null)return;const K=Wp(U.startRatio+(O.clientY-U.startY)/U.height);_(K),Vf(void 0,K)},F=O=>{if(w.current!==null){w.current=null;try{O.currentTarget.releasePointerCapture(O.pointerId)}catch{}Vf(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:E,onClick:()=>{B()},children:E?"启动中…":"新建终端"})}),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(O=>u.jsxs("button",{className:O.id===a?"mini-tab active":"mini-tab",title:O.id,onClick:()=>{c(O.id)},children:[O.id,O.status.kind==="running"?u.jsx("span",{className:"live-dot"}):u.jsx("span",{className:"exited",children:XS(O.status)})]},O.id)),u.jsx("button",{className:"mini-tab add",title:"新建终端","aria-label":"新建终端",onClick:()=>{B()},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:()=>{D(a)},children:"⌫"}),u.jsx("button",{className:"ib",title:"关闭这个终端",onClick:()=>{q(a)},children:"✕"})]})]}),S===null?null:u.jsx("div",{className:"tree-hint err",children:S}),g?u.jsxs("div",{className:"term-split",ref:b,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:ae(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(am,{id:a,active:!0,onStatus:O=>{z(a,O)},onProblem:O=>{y(O)}})})]}),u.jsx("span",{className:"term-splitter",title:"拖动调整上下比例(双击复位 50%)",role:"separator","aria-orientation":"horizontal","aria-label":"拖动调整终端分屏比例",onPointerDown:I,onPointerMove:G,onPointerUp:F,onPointerCancel:F,onDoubleClick:()=>{_(Vf(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:ae(h),u.jsx("span",{className:"grow"}),h!==null?u.jsx("button",{className:"ib",title:"关闭这块分屏(终端本身留着)",onClick:()=>{f(null),m(Kf(void 0,!1))},children:"✕"}):u.jsx("button",{className:"link-btn",disabled:E,onClick:()=>{$(!0)},children:E?"启动中…":"新建分屏"})]}),u.jsx("div",{className:"term-hosts split",children:h===null?u.jsx("div",{className:"dock-empty small",children:"点「新建分屏」再开一个 PTY"}):u.jsx(am,{id:h,active:!0,onStatus:O=>{z(h,O)},onProblem:O=>{y(O)}})})]})]}):u.jsx("div",{className:"term-hosts",children:i.map(O=>u.jsx(am,{id:O.id,active:O.id===a,onStatus:U=>{z(O.id,U)},onProblem:U=>{y(U)}},O.id))}),u.jsx("div",{className:"term-hint",children:"↑↓ 历史 · Ctrl-C 中断 · ⌫ 清屏(Ctrl-L) · 字节直通真 PTY(xterm.js)"})]})}const Er={start:"开始",files:"文件",term:"终端",diff:"变更",rewind:"回退"},om=[{id:"start",type:"start"},{id:"files",type:"files"},{id:"term",type:"term"},{id:"diff",type:"diff"}],Rw="daluo.dock.tabs.v3",Ow="daluo.dock.active.v3";function Yb(){try{const e=JSON.parse(localStorage.getItem(Rw)??"null");if(!Array.isArray(e)||e.length===0)return[...om];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?[...om]:t}catch{return[...om]}}function HB(e){try{localStorage.setItem(Rw,JSON.stringify(e))}catch{}}function IB(){try{return localStorage.getItem(Ow)}catch{return null}}function cm(e){try{localStorage.setItem(Ow,e)}catch{}}function Bw({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 UB({页签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(Bw,{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 PB=`${String(D1)}–${String(M1)} px · 双击复位 ${String(Xs)}`;function wr(){return typeof window>"u"?{width:1440,height:900}:{width:window.innerWidth,height:window.innerHeight}}function qB({去: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 FB({collapsed:e,onToggle:t,changesSignal:i,onOpenTrajectory:r,onOpenPalette:a,session:c=null,onOpenSession:h}){const[f,g]=C.useState(()=>Yb()),[m,v]=C.useState(()=>{const H=IB(),ye=Yb();return H!==null&&ye.some(ke=>ke.id===H)?H:ye[0]?.id??"files"}),[_,S]=C.useState(()=>LR()),[y,b]=C.useState(()=>JR()),[w,E]=C.useState(()=>l4()),[N,A]=C.useState(()=>ZR()),[R,B]=C.useState(null),[q,z]=C.useState(null),[D,$]=C.useState(0),[ae,I]=C.useState({running:0,total:0}),[G,F]=C.useState(0),[O,U]=C.useState(!1),K=C.useRef(null),V=C.useCallback(()=>{U(!1)},[]);Qa({打开:O,关闭:V,容器:K});const se=C.useRef(0),ge=(f.find(H=>H.id===m)??f[0])?.type??"files",T=C.useCallback((H,ye)=>{g(H),ye!==null&&H.some(ke=>ke.id===ye)&&(v(ye),cm(ye)),HB(H)},[]),De=C.useCallback(H=>{const ye=f.find(Xe=>Xe.type===H);if(ye!==void 0){v(ye.id),cm(ye.id);return}se.current+=1;const ke={id:`${H}-${String(Date.now())}-${String(se.current)}`,type:H};T([...f,ke],ke.id)},[f,T]),me=C.useCallback(H=>{se.current+=1;const ye={id:`${H}-${String(Date.now())}-${String(se.current)}`,type:H};T([...f,ye],ye.id),U(!1)},[f,T]),M=C.useCallback(H=>{const ye=f.findIndex(ot=>ot.id===H);if(ye<0)return;const ke=f.filter(ot=>ot.id!==H);if(ke.length===0){jt(),t();return}const Xe=H===m?ke[Math.min(ye,ke.length-1)]?.id??null:m;T(ke,Xe)},[f,m,T,t]);C.useEffect(()=>{(i??0)>0&&De("diff")},[i]);const j=C.useRef(null),Z=C.useRef(null),re=C.useRef(null),ie=C.useRef(_),pe=C.useRef(null),ve=C.useRef(null),je=C.useCallback(async()=>{try{const H=await ox();B(H),z(null)}catch(H){z(H instanceof Error?H.message:String(H))}},[]);C.useEffect(()=>{je();const H=setInterval(()=>{je()},1e4);return()=>{clearInterval(H)}},[je]),C.useEffect(()=>{if(!y)return;const H=()=>{A(ye=>br(void 0,ye,wr()))};return window.addEventListener("resize",H),()=>{window.removeEventListener("resize",H)}},[y]),C.useEffect(()=>()=>{pe.current!==null&&clearTimeout(pe.current),ve.current!==null&&clearTimeout(ve.current)},[]);const de=C.useMemo(()=>{const H=new Map;for(const ye of R?.changed??[])H.set(ye.path,O1(ye));return H},[R]),be=H=>{H.button===0&&(H.currentTarget.setPointerCapture(H.pointerId),j.current={startX:H.clientX,startW:_},document.body.classList.add("dock-resizing"))},Ae=()=>{pe.current!==null&&clearTimeout(pe.current),pe.current=setTimeout(()=>{pe.current=null,$f(void 0,ie.current)},300)},st=H=>{if(j.current===null)return;const ye=Kp(j.current.startW+(j.current.startX-H.clientX));ie.current=ye,S(ye),Ae()},oe=H=>{if(j.current!==null){j.current=null,document.body.classList.remove("dock-resizing");try{H.currentTarget.releasePointerCapture(H.pointerId)}catch{}pe.current!==null&&clearTimeout(pe.current),pe.current=null,$f(void 0,ie.current)}},_e=()=>{ie.current=Xs,S($f(void 0,Xs))},Ce=H=>{A(H),ve.current!==null&&clearTimeout(ve.current),ve.current=setTimeout(()=>{ve.current=null,br(void 0,H,wr())},300)},Ee=H=>{H.button!==0||w||H.target.closest("button")===null&&(H.currentTarget.setPointerCapture(H.pointerId),Z.current={dx:H.clientX-N.x,dy:H.clientY-N.y})},at=H=>{Z.current!==null&&Ce({...N,x:H.clientX-Z.current.dx,y:H.clientY-Z.current.dy})},We=H=>{if(Z.current!==null){Z.current=null;try{H.currentTarget.releasePointerCapture(H.pointerId)}catch{}br(void 0,N,wr())}},ut=H=>{H.button!==0||w||(H.currentTarget.setPointerCapture(H.pointerId),re.current={startX:H.clientX,startY:H.clientY,startW:N.width,startH:N.height})},Te=H=>{re.current!==null&&Ce({...N,width:re.current.startW+(H.clientX-re.current.startX),height:re.current.startH+(H.clientY-re.current.startY)})},ze=H=>{if(re.current!==null){re.current=null;try{H.currentTarget.releasePointerCapture(H.pointerId)}catch{}br(void 0,N,wr())}},mt=H=>{if(H){const ye=br(void 0,N,wr());A(ye),b(eu(void 0,!0))}else b(eu(void 0,!1)),br(void 0,N,wr())},Ot=H=>{E(QS(void 0,H)),H&&b(eu(void 0,!0))},jt=()=>{E(QS(void 0,!1)),eu(void 0,!1),b(!1),br(void 0,N,wr())},le=()=>{jt(),t()},Se=H=>H==="start"?u.jsx("div",{className:"dock-body start",children:u.jsx(qB,{去:ye=>{De(ye)},新建终端:()=>{De("term"),F(ye=>ye+1)},打开浏览器:()=>{window.open(location.href,"_blank","noopener,noreferrer")},...r===void 0?{}:{打开轨迹:r},...a===void 0?{}:{打开命令面板:a}})}):H==="rewind"?u.jsx(h4,{session:c,...h===void 0?{}:{onReverted:h}}):H==="files"?u.jsx("div",{className:"dock-body files",children:u.jsx(S4,{width:_,changed:de,refreshKey:D,root:R?.root??""})}):H==="term"?u.jsx("div",{className:"dock-body term",children:u.jsx(zB,{onStats:I,createSignal:G})}):u.jsx("div",{className:"dock-body diff",children:u.jsx(a4,{facts:R,factsError:q,refreshKey:D,onRefresh:()=>{$(ye=>ye+1),je()}})});return e?u.jsx(UB,{页签s:f,onExpand:H=>{De(H),t()}}):u.jsxs("aside",{className:y?w?"dock dock-float fixed":"dock dock-float":"dock",style:y?w?{right:8,top:8,bottom:8,width:N.width}:{left:N.x,top:N.y,width:N.width,height:N.height}:{width:_,flex:`0 0 ${String(_)}px`},children:[y?u.jsxs("div",{className:"dock-float-bar",title:w?"已固定到右栏(禁拖禁缩;点 ⇥ 取消固定)":"拖动浮层(双击收回右栏)",onPointerDown:Ee,onPointerMove:at,onPointerUp:We,onPointerCancel:We,onDoubleClick:()=>{mt(!1)},children:[u.jsx("span",{className:"grip",children:"⠿"}),u.jsxs("span",{className:"float-title",children:["面板 · ",Er[ge]]}),u.jsx("span",{className:w?"float-tag on":"float-tag",children:w?"已固定":"浮出"}),u.jsx("span",{className:"grow"}),u.jsx("button",{className:"icon-btn",title:"收回右栏","aria-label":"收回右栏",onClick:jt,children:"⤓"}),u.jsx("button",{className:w?"icon-btn on":"icon-btn",title:w?"取消固定(回浮动)":"固定到右栏","aria-label":w?"取消固定":"固定到右栏","aria-pressed":w,onClick:()=>{Ot(!w)},children:"⇥"}),u.jsx("button",{className:"icon-btn",title:"关闭(收起到 rail)","aria-label":"关闭面板",onClick:le,children:"✕"})]}):u.jsx("div",{className:"dock-resize",title:PB,role:"separator","aria-orientation":"vertical","aria-label":"拖动调整右栏宽度",onPointerDown:be,onPointerMove:st,onPointerUp:oe,onPointerCancel:oe,onDoubleClick:_e}),u.jsxs("div",{className:"dock-tabs",children:[f.map(H=>u.jsxs("button",{className:H.id===m?"dock-tab active":"dock-tab",title:`${Er[H.type]}(${H.id})`,onClick:()=>{v(H.id),cm(H.id)},children:[u.jsx("span",{className:"dock-tab-label",children:Er[H.type]}),u.jsx("span",{className:"dock-tab-x",role:"button","aria-label":`关闭${Er[H.type]}页签`,title:"关闭页签",onClick:ye=>{ye.stopPropagation(),M(H.id)},children:"×"})]},H.id)),u.jsxs("span",{className:"dock-add-wrap",ref:K,children:[u.jsx("button",{className:"dock-tab add",title:"新增页签","aria-label":"新增页签","aria-expanded":O,onClick:()=>{U(H=>!H)},children:"+"}),O?u.jsx("span",{className:"dock-add-menu",children:["start","files","term","diff","rewind"].map(H=>u.jsxs("button",{className:"dock-add-item",onClick:()=>{me(H)},children:[u.jsx(Bw,{tab:H}),Er[H]]},H))}):null]}),u.jsx("span",{className:"grow"}),y?null:u.jsxs(u.Fragment,{children:[u.jsx("button",{className:"icon-btn",title:"浮出面板","aria-label":"浮出面板",onClick:()=>{mt(!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:le,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 ${ge}`,children:Se(ge)}),u.jsxs("div",{className:"dock-footer",children:[u.jsxs("button",{className:"status-line",title:R?.root??"工作区",onClick:()=>{De("diff")},children:[u.jsx("span",{className:"dot",style:{background:"var(--green)"}}),R?.branch===void 0?q===null?"工作区已连接":"git 读不到":R.branch,R!==null&&(R.ahead??0)>0?u.jsxs("span",{className:"dim",children:["↑",R.ahead]}):null,R!==null&&(R.behind??0)>0?u.jsxs("span",{className:"dim",children:["↓",R.behind]}):null]}),u.jsx("span",{className:"grow"}),u.jsx("button",{className:"ft-r",title:"打开变更",onClick:()=>{De("diff")},children:R===null?"":`${String(R.changed.length)} 个改动`}),u.jsxs("button",{className:"ft-r",title:"打开终端",onClick:()=>{De("term")},children:[ae.running," 个终端运行中"]}),u.jsx("button",{className:"ft-r",title:"新建终端",onClick:()=>{De("term"),F(H=>H+1)},children:"+"})]}),y&&!w?u.jsx("span",{className:"dock-float-grip",title:"拖动缩放浮层",onPointerDown:ut,onPointerMove:Te,onPointerUp:ze,onPointerCancel:ze}):null]})}function $B(){return Oe("/workspace")}function VB(){return Oe("/workspaces")}function KB(e){return Oe("/workspace",Ye({path:e}))}function YB(){return Oe("/git/branches")}function WB(e){return Oe("/git/branch",Ye({name:e}))}function um(e){return e instanceof Error?e.message:String(e)}function XB({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),[b,w]=C.useState(!1),E=C.useRef(null);C.useEffect(()=>{let D=!0;return Promise.all([$B(),ox()]).then(([$,ae])=>{D&&(r($),c(ae.branch??null))}).catch(()=>{}),()=>{D=!1}},[]),C.useEffect(()=>{if(h===null)return;const D=ae=>{E.current?.contains(ae.target)===!1&&f(null)},$=ae=>{ae.key==="Escape"&&(ae.preventDefault(),ae.stopPropagation(),f(null))};return document.addEventListener("mousedown",D),document.addEventListener("keydown",$,!0),()=>{document.removeEventListener("mousedown",D),document.removeEventListener("keydown",$,!0)}},[h]);const N=async D=>{if(y(null),h===D){f(null);return}f(D);try{D==="dir"&&m(await VB()),D==="branch"&&_(await YB())}catch($){y(um($))}},A=async D=>{w(!0),y(null);try{await KB(D),location.reload()}catch($){y(um($))}finally{w(!1)}},R=async D=>{w(!0),y(null);try{await WB(D),location.reload()}catch($){y(um($))}finally{w(!1)}},B=t==="composer"?{maxWidth:"812px",margin:"10px auto 0",padding:"0 14px"}:void 0,q=i?.name??"…",z=a??"—";return u.jsxs("div",{className:"env-bar",style:B,ref:E,children:[u.jsxs("button",{className:h==="env"?"env-pill on":"env-pill",title:"执行环境","aria-expanded":h==="env",onClick:()=>{N("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:()=>{N("dir")},children:[u.jsx("span",{className:"g",children:"▤"})," ",q,u.jsx("span",{className:"g chev",children:"▾"})]}),u.jsxs("button",{className:h==="branch"?"env-pill on":"env-pill",title:"切换分支","aria-expanded":h==="branch",onClick:()=>{N("branch")},children:[u.jsx("span",{className:"g",children:"⑂"})," ",z,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(D=>u.jsxs("button",{className:D.active?"env-item on":"env-item",role:"menuitem",disabled:b||!D.exists||D.active,title:D.exists?D.root:`${D.root}(目录不在)`,onClick:()=>{A(D.root)},children:[u.jsxs("span",{className:"env-item-main",children:[u.jsx("span",{children:D.name}),u.jsx("span",{className:"path",children:D.root})]}),D.active?u.jsx("span",{className:"check",children:"✓"}):D.exists?null:u.jsx("span",{className:"tag",children:"目录不在"})]},`${D.workspaceId}-${D.root}`)),g!==null&&(g.workspaces??[]).length===0?u.jsx("div",{className:"env-note",children:"还没有登记过其他工作区。"}):null,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(D=>u.jsxs("button",{className:D.current?"env-item on":"env-item",role:"menuitem",disabled:b||D.current,onClick:()=>{R(D.name)},children:[u.jsx("span",{children:D.name}),D.current?u.jsx("span",{className:"check",children:"✓"}):null]},D.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 GB=[{keys:["Enter"],label:"提交"},{keys:["Shift","Enter"],label:"换行"},{keys:["@"],label:"提文件"},{keys:["!"],label:"跑本机命令"},{keys:["/"],label:"技能"}];function QB(){return u.jsx("span",{className:"kbd-row",style:{justifyContent:"center"},children:GB.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 ZB({onToggleTheme:e,onSend:t}){const[i,r]=C.useState(""),[a,c]=C.useState(void 0),h=C.useRef(null),f=vx(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(T1,{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(_x,{ref:h,value:i,onChange:r,contextLabel:"ctx 0%",onSend:g,empty:!0,planMode:a===!0,onTogglePlan:()=>{c(m=>m!==!0)}}),u.jsx(XB,{rightText:"事件流已连接"}),u.jsx("div",{className:"suggestions",children:eE.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(QB,{})})]})})}),f.dragging?u.jsx(yx,{}):null]})}const JB=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 e6({info:e,onBackToSource:t,onClose:i}){const r=JB(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 t6(){return Oe("/plugin-ui")}function n6(e,t){return Oe("/plugin-ui",Ye({id:e,value:t}))}function i6(e){const t=e.indexOf(":");return t<=0?"":e.slice(0,t)}function s6(e,t,i){const r=new Map;for(const c of e){const h=i6(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 Wb=200,Xb=4096;function r6(e){switch(e){case"toggle":return"switch";case"select":return"seg";case"text":return"text";case"secret":return"secret";default:return"unsupported"}}function Gb(e){return e.kind!=="text"?"":typeof e.value=="string"?e.value:e.value===void 0||e.value===null?"":String(e.value)}function l6(e,t){return e.kind==="text"?t.length>Wb?`最多 ${String(Wb)} 字符(当前 ${String(t.length)})`:void 0:e.kind==="secret"?t.length>Xb?`最多 ${String(Xb)} 字符(当前 ${String(t.length)})`:void 0:`${e.kind} 行不走草稿`}function Lw(e){return e===!0?"已设置":"未设置"}function a6(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"?Lw(e.configured):typeof e.value=="string"?e.value:e.value===void 0||e.value===null?"":String(e.value)}function o6({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 n6(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(c6,{row:v,busy:r,onSave:_=>{m(v.id,_)}},v.id))})]})]})}function c6({row:e,busy:t,onSave:i}){const r=r6(e.kind),[a,c]=C.useState(()=>Gb(e)),h=t===`row:${e.id}`;C.useEffect(()=>{e.kind==="text"&&c(Gb(e))},[e]);const f=r==="text"||r==="secret"?l6(e,a):void 0,g=a6(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:Lw(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 u6(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 h6(e){return e==="registry"?"注册表":e==="builtin"?"内置":"用户插件"}function d6(e){return e==="active"?"已装载":e==="failed"?"装载失败":e==="pending"?"未就绪":"已停用"}function f6(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 Qb(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 m6(e,t){return t?`已启用「${e}」:下一条消息起生效(正在跑的回合不拆)`:`已停用「${e}」:下一条消息起生效(正在跑的回合不拆)`}function p6(e){return e.trim()===""?"没有配置用户插件。把插件写进 daluo.plugins.ts(或 DALUO_PLUGINS)后刷新即可,装载失败的原话会出现在上面。":"没有匹配的用户插件——清掉筛选看看。"}function g6(){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 dx()),r(null)}catch(b){r(b instanceof Error?b.message:String(b))}},[]);C.useEffect(()=>{v()},[v]);const _=async b=>{if(b.locked||g!==null)return;const w=b.state==="disabled";m(b.id);try{await y2(b.id,w),c(m6(b.id,w)),r(null),await v()}catch(E){r(E instanceof Error?E.message:String(E))}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(b=>u.jsxs("div",{className:"plug-logline",children:[u.jsx("code",{children:b.id}),u.jsx("span",{className:"plug-src",children:b.source}),u.jsx("span",{className:"plug-bad",children:b.detail??b.state})]},b.id))]})]});const S=Qb(e.builtin??[],h),y=Qb(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:f6(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(b=>u.jsx("code",{children:b},b))]}),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:b=>{f(b.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(b=>u.jsx(Zb,{card:b,busy:g,onToggle:()=>{_(b)}},b.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:p6(h)}):u.jsx("div",{className:"plug-grid",children:y.map(b=>u.jsx(Zb,{card:b,busy:g,onToggle:()=>{_(b)}},b.id))})]})]})}function Zb({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:h6(e.kind)}),u.jsx("span",{className:`plug-state ${e.state}`,children:d6(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 _6({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[F,O]=await Promise.all([t6(),dx()]);v(F.rows);const U=new Map;for(const K of[...O.builtin??[],...O.user??[]])U.set(K.id,K.title);S(U)}catch{}};C.useEffect(()=>{y()},[]);const b=C.useMemo(()=>new Set(h.map(F=>F.forPlugin).filter(F=>typeof F=="string"&&F!=="")),[h]),w=C.useMemo(()=>s6(m,_,b),[m,_,b]),[E,N]=C.useState(null),[A,R]=C.useState(null),[B,q]=C.useState(null),[z,D]=C.useState(null),[$,ae]=C.useState(null),I=async()=>{try{const[F,O,U]=await Promise.all([f2(),p2(),mm(t??void 0)]);N(F),R(O),q(U),D(null)}catch(F){D(F instanceof Error?F.message:String(F))}};C.useEffect(()=>{I()},[]);const G=async F=>{try{N(await m2(F)),D(null)}catch(O){D(O instanceof Error?O.message:String(O))}};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(([F,O,U])=>u.jsxs("button",{className:f===null&&r===U?"on":"",onClick:()=>{g(null),a(U)},children:[u.jsx("span",{className:"g",children:F}),O]},U)),h.length===0?null:u.jsxs(u.Fragment,{children:[u.jsx("div",{className:"gtitle",children:"插件设置"}),h.map(F=>{const O=`custom:${F.pluginId}/${F.id}`;return u.jsxs("button",{className:f===O?"on":"",onClick:()=>{g(O)},children:[u.jsx("span",{className:"g",children:"✧"}),F.title??F.id]},O)}),w.map(F=>u.jsxs("button",{className:f===`generic:${F.id}`?"on":"",onClick:()=>{g(`generic:${F.id}`)},children:[u.jsx("span",{className:"g",children:"✧"}),F.title]},`generic:${F.id}`))]})]}),u.jsxs("div",{className:"set-body",children:[z===null?null:u.jsxs("div",{className:"err-bar",children:[u.jsx("span",{className:"warn",children:"⚠"}),u.jsx("span",{className:"grow",children:z}),u.jsx("button",{className:"btn",onClick:()=>{I()},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:()=>{ae(null)},children:"知道了"})]}),f!==null?(()=>{if(f.startsWith("generic:")){const U=f.slice(8),K=w.find(V=>V.id===U);return K===void 0?null:u.jsx(o6,{title:K.title,rows:K.rows,onChanged:y})}const F=h.find(U=>`custom:${U.pluginId}/${U.id}`===f);if(F===void 0)return null;const O=F.Component;return u.jsx(O,{})})():r==="appearance"?u.jsx(v6,{p:{settings:E,保存设置:G,onTheme:i}}):r==="providers"?u.jsx(y6,{p:{providers:A,models:B,session:t,刷新:I,setError:D,setNotice:ae}}):r==="plugins"?u.jsx(g6,{}):u.jsx(S6,{p:{settings:E,providers:A}})]})]})}function v6({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 hm={name:"",baseUrl:"",apiKey:"",clearApiKey:!1,contextWindowTokens:""};function y6({p:e}){const{providers:t,models:i,session:r,刷新:a,setError:c,setNotice:h}=e,[f,g]=C.useState(hm),[m,v]=C.useState(!1),[_,S]=C.useState({}),[y,b]=C.useState(null),w=C.useRef(null),E=y!==null;C.useEffect(()=>{if(!E)return;w.current?.focus();const D=ae=>{const I=ae.target;I instanceof Element&&I.closest(".picker")===null&&I.closest("[data-picker-trigger]")===null&&b(null)},$=ae=>{ae.key==="Escape"&&b(null)};return document.addEventListener("mousedown",D),document.addEventListener("keydown",$),()=>{document.removeEventListener("mousedown",D),document.removeEventListener("keydown",$)}},[E]);const N=async(D,$)=>{v(!0);try{await D(),await a(),c(null),$!==void 0&&h($)}catch(ae){c(ae instanceof Error?ae.message:String(ae))}finally{v(!1)}},A=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(hm)},R=D=>{g({id:D.id,name:D.name,baseUrl:D.baseUrl,apiKey:"",clearApiKey:!1,contextWindowTokens:D.contextWindowTokens===void 0?"":String(D.contextWindowTokens)})},B=async D=>{S($=>({...$,[D.id]:"拉取模型清单…"}));try{const $=await I0({id:D.id});if($.modelsOk!==!0){S(I=>({...I,[D.id]:`拉取失败:${($.errors??[]).join(";")||"取不到清单"}`}));return}const ae=$.models??[];S(I=>({...I,[D.id]:`接口返回 ${String(ae.length)} 个模型 · 补全${$.completionOk===!0?" ✓":"未测通"}`})),b({providerId:D.id,name:D.name,全部:ae,选中:D.models.map(I=>I.name),过滤:""})}catch($){S(ae=>({...ae,[D.id]:`拉取失败:${$ instanceof Error?$.message:String($)}`}))}},q=async()=>{if(y===null)return;const D=t?.providers.find(G=>G.id===y.providerId),$=new Map((D?.models??[]).map(G=>[G.name,G.contextWindowTokens])),ae=new Set(y.选中),I=y.全部.filter(G=>ae.has(G)).map(G=>{const F=$.get(G);return F===void 0||F===""?{name:G}:{name:G,contextWindowTokens:F}});await N(()=>Ua({op:"update",id:y.providerId,models:I}),`已保存 ${String(I.length)} 个模型`),b(null)},z=async D=>{S($=>({...$,[D.id]:"测试中…"}));try{const $=await I0({id:D.id});S(ae=>({...ae,[D.id]:u6($)}))}catch($){S(ae=>({...ae,[D.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(D=>D.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(D=>u.jsxs("div",{style:{position:"relative"},className:D.id===t.activeProviderId?"model on":"model",children:[u.jsxs("div",{style:{minWidth:0},children:[u.jsxs("div",{children:[u.jsx("span",{className:"nm",children:D.name}),D.id===t.activeProviderId?u.jsx("span",{className:"pill",style:{marginLeft:8},children:"当前"}):null,D.enabled?null:u.jsx("span",{className:"pill",style:{marginLeft:8},children:"已关闭"})]}),u.jsxs("div",{className:"tagm",style:{marginLeft:0},children:[D.baseUrl," · ",D.models.length," 个模型 · 密钥",D.apiKeySet?` 已配置 · …${D.apiKeyHint}`:" 未配置"]}),_[D.id]===void 0?null:u.jsx("div",{className:"hint",children:_[D.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:()=>{z(D)},title:"真打一次提供方:列清单 + 一次最小补全,只报连通/补全状态",children:"测试连通"}),u.jsx("button",{className:"btn","data-picker-trigger":"1",disabled:m,onClick:()=>{B(D)},children:"获取模型"}),u.jsx("button",{className:"btn",disabled:m||D.id===t.activeProviderId||!D.enabled,onClick:()=>{N(()=>Ua({op:"activate",id:D.id}),`已切到 ${D.name}`)},children:"启用"}),u.jsx("button",{className:"btn",disabled:m,onClick:()=>{R(D)},children:"编辑"}),u.jsx("button",{className:"btn",disabled:m,onClick:()=>{N(()=>Ua({op:"update",id:D.id,enabled:!D.enabled}),D.enabled?"已关闭":"已开启")},children:D.enabled?"停用":"开启"}),u.jsx("button",{className:"btn danger",disabled:m||D.id===t.activeProviderId,onClick:()=>{window.confirm(`删除提供方「${D.name}」?`)&&N(()=>Ua({op:"remove",id:D.id}),"已删除")},children:"删除"})]}),y===null||y.providerId!==D.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:()=>{b({...y,选中:y.全部})},children:"全选"}),u.jsx("button",{className:"btn",onClick:()=>{b({...y,选中:[]})},children:"清空"})]})]}),u.jsx("input",{ref:w,className:"picker-search",value:y.过滤,placeholder:"筛选模型名…(Esc 关闭)",onChange:$=>{b({...y,过滤:$.target.value})}}),u.jsxs("div",{className:"picker-list",children:[y.全部.filter($=>y.过滤.trim()===""||$.toLowerCase().includes(y.过滤.trim().toLowerCase())).map($=>{const ae=y.选中.includes($),I=t.providers.find(G=>G.id===y.providerId)?.models.some(G=>G.name===$)===!0;return u.jsxs("label",{className:ae?"pick on":"pick",children:[u.jsx("input",{type:"checkbox",checked:ae,onChange:()=>{b({...y,选中:ae?y.选中.filter(G=>G!==$):[...y.选中,$]})}}),u.jsx("span",{className:"nm",children:$}),I?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:()=>{b(null)},children:"取消"}),u.jsxs("button",{className:"btn primary",disabled:m,onClick:()=>{q()},children:["保存勾选的 ",y.选中.length," 个"]})]})]})]},D.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:D=>{g({...f,name:D.target.value})}})]}),u.jsxs("label",{children:["baseURL",u.jsx("input",{value:f.baseUrl,placeholder:"https://api.deepseek.com/v1",onChange:D=>{g({...f,baseUrl:D.target.value})}})]}),u.jsxs("label",{children:["密钥",u.jsx("input",{type:"password",value:f.apiKey,placeholder:f.id===void 0?"sk-…(可留空,用环境变量)":"留空 = 不改",onChange:D=>{g({...f,apiKey:D.target.value})}})]}),u.jsxs("label",{children:["上下文窗口",u.jsx("input",{value:f.contextWindowTokens,placeholder:"1000000(可留空)",onChange:D=>{g({...f,contextWindowTokens:D.target.value})}})]})]}),f.id===void 0?null:u.jsxs("label",{className:"check",children:[u.jsx("input",{type:"checkbox",checked:f.clearApiKey,onChange:D=>{g({...f,clearApiKey:D.target.checked})}}),"清除已存的密钥"]}),u.jsxs("div",{className:"section-actions",children:[f.id===void 0?null:u.jsx("button",{className:"btn",onClick:()=>{g(hm)},children:"取消编辑"}),u.jsx("button",{className:"btn primary",disabled:m||f.baseUrl.trim()==="",onClick:()=>{A()},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(D=>D.id===t.activeProviderId)?.models??[]).filter(D=>D.enabled!==!1).map(D=>u.jsx("button",{className:i?.current===D.name?"pill on":"pill",disabled:m,onClick:()=>{v(!0),hx(D.name,r??void 0).then(async()=>{await a(),h(`已切到 ${D.name}`)}).catch($=>{c($ instanceof Error?$.message:String($))}).finally(()=>{v(!1)})},children:D.name},D.name))}),(t.providers.find(D=>D.id===t.activeProviderId)?.models??[]).length===0?u.jsx("div",{className:"hint",children:"当前提供方还没有模型:先在它那一行点「获取模型」,勾选要用的模型保存。"}):null]})]})}function S6({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 b6=[{mode:"sequence",名:"序",说明:"每格等宽:看清顺序与谁挨着谁(没时间戳的格也在)"},{mode:"duration",名:"时长",说明:"条宽 = 实测时长,空档压缩:谁占了多少干活时间"},{mode:"time",名:"时间",说明:"归零标记,空档保留:真实时间轴上的位置"},{mode:"actual",名:"实际",说明:"位置 + 宽度:真实时间轴上实际发生在哪、各花多久"}],x6=[{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",名:"事件",图标:"·"}],zw=new Map(x6.map(e=>[e.kind,e]));function lg(e){return zw.get(e)?.名??e}function Hw(e){return zw.get(e)?.图标??"·"}const w6=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 C6(e,t){if(t==="sequence")return e.map(()=>({left:0,width:100}));const i=e.map(f=>w6(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 au=e=>e.toLocaleString("en-US");function ao(e){if(e===void 0)return"未记录用量";const t=[`提示 ${au(e.promptTokens)}`,`输出 ${au(e.completionTokens)}`];return e.cachedTokens!==void 0&&t.push(`缓存 ${au(e.cachedTokens)}`),e.reasoningTokens!==void 0&&t.push(`推理 ${au(e.reasoningTokens)}`),t.join(" · ")}function Iw(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 k6(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,用量:Iw(t)}}function N6(e,t,i){if(i.trim()!=="")return{视图:e,隐藏轮数:0};const r=Math.max(0,e.length-t);return{视图:e.slice(r),隐藏轮数:r}}function E6(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??"",lg(e.kind),e.ref??""].some(a=>a.toLowerCase().includes(i))}const ou=8,Jb=e=>{for(const t of e)if(t.ts!==void 0)return t.ts},_p=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"})},vp=e=>typeof e=="object"&&e!==null?e:null;function j6(e,t){if(t!==void 0)for(const i of e){const r=vp(i);if(!(r?.type!=="message/assistant"||!Array.isArray(r.content)))for(const a of r.content){const c=vp(a);if(c?.toolCallId===t)return c.input}}}function T6(e,t){if(t!==void 0)for(const i of e){const r=vp(i);if(r?.type==="tool/result"&&r.toolCallId===t)return r.output}}const cu=e=>{if(e===void 0)return"";if(typeof e=="string")return e;try{return JSON.stringify(e,null,2)}catch{return String(e)}},ex=e=>e!==void 0&&!(typeof e=="string"&&e==="");function D6({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 R=!0;h(null),g(null),a("概述");const B=Math.max(1,_.toSeq-_.fromSeq+1);return v2(e,_.fromSeq,B).then(q=>{R&&h(q)}).catch(q=>{R&&g(q instanceof Error?q.message:String(q))}),()=>{R=!1}},[e,_.fromSeq,_.toSeq]);const b=c?.events??[],w=y?j6(b,_.ref):void 0,E=y?T6(b,_.ref):void 0,N=["概述",...y?["参数","结果"]:[],"计时","用量","原始 JSON"],A=R=>{navigator.clipboard.writeText(R).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:Hw(_.kind)}),u.jsx("span",{className:"t",children:lg(_.kind)}),u.jsxs("span",{className:"mut",children:["#",_.fromSeq,_.toSeq===_.fromSeq?"":`–${String(_.toSeq)}`]})]}),u.jsx("div",{className:"traj-tabs",role:"tablist",children:N.map(R=>u.jsx("button",{type:"button",role:"tab","aria-selected":r===R,className:r===R?"on":"",onClick:()=>{a(R)},children:R},R))}),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==="参数"?ex(w)?u.jsxs(u.Fragment,{children:[u.jsx("div",{className:"traj-sec",children:"<工具入参>"}),u.jsx("pre",{className:"traj-pre",children:cu(w)}),u.jsx("button",{className:"btn",type:"button",onClick:()=>{A(cu(w))},children:m?"已复制":"复制参数"})]}):u.jsx("div",{className:"traj-ins-empty",children:"这次调用没记到入参"}):null,r==="结果"?c===null?u.jsx("div",{className:"traj-ins-empty",children:"读取中…"}):ex(E)?u.jsxs(u.Fragment,{children:[u.jsx("pre",{className:"traj-pre",children:cu(E)}),u.jsx("button",{className:"btn",type:"button",onClick:()=>{A(cu(E))},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:_p(_.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(b,null,2)}),u.jsx("button",{className:"btn",type:"button",onClick:()=>{A(JSON.stringify(b,null,2))},children:m?"已复制":"复制 JSON"})]}):null]})]})}function M6({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,b]=C.useState(ou),[w,E]=C.useState(new Set),[N,A]=C.useState(new Set),[R,B]=C.useState(null),[q,z]=C.useState(!1),D=C.useCallback(async()=>{if(e===null){a(null),h(!1);return}h(!0);try{const j=await _2(e);a(j),g(null)}catch(j){g(j instanceof Error?j.message:String(j))}finally{h(!1)}},[e]);C.useEffect(()=>{D()},[D]),C.useEffect(()=>{if(e===null)return;let j=!0;const Z=async()=>{try{const ie=await ux(e);if(!j)return;z(ie.running),ie.running&&D()}catch{}};Z();const re=window.setInterval(()=>{Z()},2e3);return()=>{j=!1,window.clearInterval(re)}},[e,D]);const $=r?.turns??[],ae=r?.preamble??[],{视图:I,隐藏轮数:G}=C.useMemo(()=>N6($,ou,_),[$,_]),F=C.useMemo(()=>E6(ae,_),[ae,_]),O=C.useMemo(()=>k6($),[$]),U=C.useMemo(()=>[...ae.length>0?[0]:[],...I.map(j=>j.fromSeq)],[ae.length,I]),K=U.length>0&&U.every(j=>w.has(j)),V=I.flatMap(j=>j.steps).length>0&&I.flatMap(j=>j.steps).every(j=>N.has(j.fromSeq)),se=C.useMemo(()=>{const j=[];let Z=0,re=0;if(F.length>0){const ie=w.has(0);if(j.push({type:"preamble",cells:F,时刻:Jb(F),收起:ie}),!ie)for(const pe of F)j.push({type:"cell",项:{cell:pe,railIndex:re}}),re+=1}for(let ie=0;ie<I.length;ie+=1){const pe=I[ie];if(pe===void 0)continue;const ve=$.indexOf(pe)+1;if(!(!(pe.cells.some(de=>Ll(de,_))||pe.steps.some(de=>de.cells.some(be=>Ll(be,_))))&&_.trim()!=="")&&(j.push({type:"turn",轮号:ve,turn:pe,时刻:Jb([...pe.cells,...pe.steps.flatMap(de=>de.cells)]),步数:pe.steps.length,格数:pe.cells.length+pe.steps.reduce((de,be)=>de+be.cells.length,0)}),!w.has(pe.fromSeq))){for(const de of pe.cells)Ll(de,_)&&(j.push({type:"cell",项:{cell:de,railIndex:re}}),re+=1);for(const de of pe.steps)if(Z+=1,!(de.cells.filter(Ae=>Ll(Ae,_)).length===0&&_.trim()!=="")&&(j.push({type:"step",请求号:Z,step:de,格数:de.cells.length}),!N.has(de.fromSeq)))for(const Ae of de.cells)Ll(Ae,_)&&(j.push({type:"cell",项:{cell:Ae,step:de,railIndex:re}}),re+=1)}}return j},[I,F,$,_,w,N]),ee=[];for(const j of se)j.type==="cell"&&ee.push(j.项.cell);const ge=C6(ee,m),T=(j,Z,re,ie)=>{const pe=new Set(Z);pe.has(re)?pe.delete(re):pe.add(re),j(pe)},De=()=>{E(K?new Set:new Set(U))},me=()=>{const j=I.flatMap(Z=>Z.steps).map(Z=>Z.fromSeq);A(V?new Set:new Set(j))},M=ao(Iw($.flatMap(j=>j.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:[O.轮数," 轮 · ",O.步数," 步 · ",O.格数+ae.length," 格",O.时长Ms===null?"":` · ${Il(O.时长Ms)??""}`,O.用量===void 0?"":` · ${ao(O.用量)}`]}),u.jsx("div",{className:"grow"}),q?u.jsxs("span",{className:"chip live",children:[u.jsx("span",{className:"pulse"}),"运行中"]}):null,u.jsx("div",{className:"seg",role:"group","aria-label":"导轨投影",children:b6.map(j=>u.jsx("button",{type:"button",className:m===j.mode?"on":"",title:j.说明,"aria-pressed":m===j.mode,onClick:()=>{v(j.mode)},children:j.名},j.mode))}),u.jsx("input",{className:"traj-search",type:"search",value:_,placeholder:"搜索轨迹","aria-label":"搜索轨迹",onChange:j=>{S(j.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:V?"traj-fold on":"traj-fold","aria-pressed":V,title:V?"展开所有请求":"收起所有请求",onClick:me,children:[V?"⊞":"⊟"," 请求"]})]}),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:()=>{D()},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"})]}):se.length===0?u.jsxs("div",{className:"traj-empty",children:[u.jsx("div",{className:"eic",children:"◇"}),u.jsx("div",{className:"et",children:$.length===0&&ae.length===0?"这个会话还没有轨迹":"没有匹配的格"}),u.jsx("div",{className:"es",children:$.length===0&&ae.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:()=>{b(j=>j+ou)},children:["载入更早的 ",Math.min(G,ou)," 轮(还剩 ",G," 轮)"]})})}):null,se.map((j,Z)=>{if(j.type==="preamble")return u.jsx("tr",{className:"traj-turn-row",onClick:()=>{T(E,w,0)},children:u.jsxs("td",{colSpan:5,children:[u.jsx("span",{className:"chev",children:j.收起?"▸":"▾"}),u.jsx("span",{className:"th",children:"启动前"}),u.jsxs("span",{className:"mut",children:[j.cells.length," 格 · 首次用户消息之前"]}),u.jsx("span",{className:"time",children:_p(j.时刻)})]})},"preamble");if(j.type==="turn"){const de=w.has(j.turn.fromSeq);return u.jsx("tr",{className:"traj-turn-row",onClick:()=>{T(E,w,j.turn.fromSeq)},children:u.jsxs("td",{colSpan:5,children:[u.jsx("span",{className:"chev",children:de?"▸":"▾"}),u.jsxs("span",{className:"th",children:["第 ",j.轮号," 轮"]}),u.jsxs("span",{className:"mut",children:[j.步数," 步 · ",j.格数," 格"]}),u.jsx("span",{className:"time",children:_p(j.时刻)})]})},`t-${String(j.turn.fromSeq)}`)}if(j.type==="step"){const de=N.has(j.step.fromSeq);return u.jsx("tr",{className:"traj-step-row",onClick:()=>{T(A,N,j.step.fromSeq)},children:u.jsxs("td",{colSpan:5,children:[u.jsx("span",{className:"chev",children:de?"▸":"▾"}),u.jsxs("span",{className:"req",children:["请求 #",j.请求号]}),j.step.model===void 0?null:u.jsx("span",{className:"mut mono",children:j.step.model}),j.step.usage===void 0?null:u.jsx("span",{className:"mut",children:ao(j.step.usage)}),j.step.durationMs===void 0?null:u.jsx("span",{className:"mut",children:Il(j.step.durationMs)}),u.jsxs("span",{className:"mut",children:[j.格数," 格"]})]})},`s-${String(j.step.fromSeq)}`)}const{cell:re,step:ie,railIndex:pe}=j.项,ve=ge[pe]??null,je=R!==null&&R.cell.fromSeq===re.fromSeq&&R.cell.kind===re.kind;return u.jsxs("tr",{className:je?"traj-cell-row sel":"traj-cell-row",tabIndex:0,onClick:()=>{B({cell:re,step:ie,railIndex:pe})},onKeyDown:de=>{de.key==="Enter"&&B({cell:re,step:ie,railIndex:pe})},children:[u.jsxs("td",{className:"k",children:[u.jsx("span",{className:`ic ${re.kind==="tool-call"?"tool":re.kind==="assistant-text"?"as":""}`,"aria-hidden":"true",children:Hw(re.kind)}),lg(re.kind)]}),u.jsx("td",{className:"label",title:re.label??"",children:re.label??"(无摘录)"}),u.jsxs("td",{className:"seq mono",children:["#",re.fromSeq,re.toSeq===re.fromSeq?"":`–${String(re.toSeq)}`]}),u.jsx("td",{className:"dur mono",children:Il(re.durationMs)??"—"}),u.jsx("td",{className:"rail",children:u.jsx("span",{className:"track",children:ve===null?null:u.jsx("i",{className:"bar",style:{left:`${String(ve.left)}%`,width:`${String(ve.width)}%`}})})})]},`c-${String(re.fromSeq)}-${re.kind}-${String(Z)}`)})]})]})}),R===null?null:u.jsx(D6,{session:e,项:R,累计用量:M})]})]})}function A6(e,t=20){return Oe(`/search?all=1&limit=${String(t)}&q=${encodeURIComponent(e)}`)}const Al={grouping:"workspace",sorting:"recent",filter:"all"},Uw="daluo.sidebar.view",R6=["workspace","tree","flat"],O6=["manual","recent"],B6=["active","all","archived"];function L6(e){try{const t=e?.getItem(Uw);if(t==null)return Al;const i=JSON.parse(t);if(typeof i!="object"||i===null)return Al;const r=i;return{grouping:R6.includes(r.grouping)?r.grouping:Al.grouping,sorting:O6.includes(r.sorting)?r.sorting:Al.sorting,filter:B6.includes(r.filter)?r.filter:Al.filter}}catch{return Al}}function z6(e,t){try{t?.setItem(Uw,JSON.stringify(e))}catch{}}const Pw=(e,t)=>t===""||(e.title??e.name).toLowerCase().includes(t),Rl=e=>e.reduce((t,i)=>Math.max(t,i.row.lastActiveMs),0);function Ru(e,t){return t==="manual"?e:[...e].sort((i,r)=>r.row.lastActiveMs-i.row.lastActiveMs)}function H6(e){const t=e.lastIndexOf("/");return t>0?e.slice(0,t):"/"}function I6(e,t,i=""){const r=i.trim().toLowerCase(),a=[];for(const h of e)for(const f of h.sessions)Pw(f,r)&&f.archived&&a.push({row:f,group:h});if(t.filter==="archived"){const h=Ru(a,t.sorting);return{sections:[],archivedRows:h,total:0}}if(t.filter==="active"&&a.length>0)return{sections:dm(e,t,r),archivedRows:[],total:tx(dm(e,t,r))};const c=dm(e,t,r);return{sections:c,archivedRows:t.sorting==="manual"?a:Ru(a,t.sorting),total:tx(c)}}function tx(e){return e.reduce((t,i)=>t+i.rows.length,0)}function dm(e,t,i){const r=c=>Ru(c.sessions.filter(h=>!h.archived&&Pw(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:Ru(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=H6(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 qw(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 U6(e,t=Date.now()){let i=0;for(const r of e)r.lastActiveMs>i&&(i=r.lastActiveMs);return qw(i,t)}function P6(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 q6({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 F6({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 nx=e=>e.labels??{},$6=[["workspace","按工作区"],["tree","按工作区树"],["flat","单列表"]],V6=[["manual","手动排序"],["recent","最近更新"]],K6=[["active","隐藏已归档"],["all","全部对话(显示已归档)"],["archived","仅显示已归档"]];function Y6({groups:e,activeName:t,loading:i,loadError:r,onNewChat:a,onSelect:c,onRename:h,onDelete:f,onPin:g,onArchive:m,onLabels:v,onReload:_,onOpenSettings:S,onOpenSearchHit:y}){const[b,w]=C.useState(""),[E,N]=C.useState([]),[A,R]=C.useState(!1),[B,q]=C.useState(null),[z,D]=C.useState(new Set),[$,ae]=C.useState(null),[I,G]=C.useState(null),[F,O]=C.useState(""),[U,K]=C.useState(null),[V,se]=C.useState(null),[ee,ge]=C.useState(null),[T,De]=C.useState(null),[me,M]=C.useState(null),[j,Z]=C.useState([]),[re,ie]=C.useState(null),[pe,ve]=C.useState(!1),[je,de]=C.useState(!1),[be,Ae]=C.useState(()=>L6(typeof window>"u"?void 0:window.localStorage)),[st,oe]=C.useState(!1),_e=C.useRef(null),Ce=C.useRef(null);C.useEffect(()=>{const ne=b.trim();if(ne===""){N([]),R(!1),q(null);return}let H=!1;R(!0),q(null);const ye=window.setTimeout(()=>{A6(ne).then(ke=>{H||N(ke.hits)}).catch(ke=>{H||(N([]),q(ke instanceof Error?ke.message:String(ke)))}).finally(()=>{H||R(!1)})},250);return()=>{H=!0,window.clearTimeout(ye)}},[b]),C.useEffect(()=>{const ne=H=>{(H.metaKey||H.ctrlKey)&&H.key.toLowerCase()==="k"&&(H.preventDefault(),_e.current?.focus())};return window.addEventListener("keydown",ne),()=>{window.removeEventListener("keydown",ne)}},[]),C.useEffect(()=>{if(!st)return;const ne=ye=>{Ce.current!==null&&!Ce.current.contains(ye.target)&&oe(!1)},H=ye=>{ye.key==="Escape"&&oe(!1)};return document.addEventListener("mousedown",ne),document.addEventListener("keydown",H),()=>{document.removeEventListener("mousedown",ne),document.removeEventListener("keydown",H)}},[st]),C.useEffect(()=>{if(T===null)return;const ne=setTimeout(()=>{De(null)},1500);return()=>{clearTimeout(ne)}},[T]);const Ee=C.useMemo(()=>I6(e,be,b),[e,be,b]),{sections:at,archivedRows:We,total:ut}=Ee;C.useEffect(()=>{z6(be,typeof window>"u"?void 0:window.localStorage),be.filter==="archived"&&de(!0)},[be]);const Te=ne=>{ae(H=>Ui(H,ne)?null:ne),K(null),se(null)},ze=(ne,H)=>{ae(null),G(ne),O(H.title??H.name),ge(null)},mt=async(ne,H)=>{const ye=F.trim();if(ye===""){ge({key:ne,message:"名字不能为空"});return}try{await h(H,ye),G(null)}catch(ke){ge({key:ne,message:ke instanceof Error?ke.message:String(ke)})}},Ot=async ne=>{ae(null);const H=`${location.origin}/?session=${encodeURIComponent(ne.name)}`;try{await navigator.clipboard.writeText(H),De(ne)}catch{ge({key:ne,message:`复制失败,手动复制:${H}`})}},jt=(ne,H)=>{ae(null),M({key:ne,row:H}),Z(aR(H.labels)),ie(null)},le=async()=>{if(!(me===null||pe)){ve(!0),ie(null);try{await v(me.row,oR(j)),M(null)}catch(ne){ie(ne instanceof Error?ne.message:String(ne))}finally{ve(!1)}}},Se=async(ne,H)=>{se(null),ae(null);try{await m(H,!0)}catch(ye){ge({key:ne,message:ye instanceof Error?ye.message:String(ye)})}};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"})]}),u.jsxs("div",{className:"search-line",ref:Ce,children:[u.jsxs("div",{className:b===""?"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:_e,value:b,placeholder:"搜索会话…","aria-label":"搜索会话",onChange:ne=>{w(ne.target.value)},onKeyDown:ne=>{ne.key==="Escape"&&(w(""),ne.currentTarget.blur())}}),b===""?u.jsx("kbd",{children:"⌘K"}):u.jsx("button",{className:"clear",title:"清空 (Esc)",onClick:()=>{w(""),_e.current?.focus()},children:"✕"})]}),u.jsx("button",{className:st?"sb-view-btn on":"sb-view-btn",type:"button",title:"分组 / 排序 / 筛选","aria-label":"分组 / 排序 / 筛选",onClick:()=>{oe(ne=>!ne)},children:"⇅"}),st?u.jsxs("div",{className:"sb-view-menu",children:[u.jsx("div",{className:"sb-menu-head",children:"分组方式"}),$6.map(([ne,H])=>u.jsxs("button",{className:"sb-opt",type:"button",onClick:()=>{Ae(ye=>({...ye,grouping:ne})),oe(!1)},children:[u.jsx("span",{className:"g",children:be.grouping===ne?"✓":" "}),H]},ne)),u.jsx("div",{className:"sb-menu-head",children:"排序方式"}),V6.map(([ne,H])=>u.jsxs("button",{className:"sb-opt",type:"button",onClick:()=>{Ae(ye=>({...ye,sorting:ne})),oe(!1)},children:[u.jsx("span",{className:"g",children:be.sorting===ne?"✓":" "}),H]},ne)),u.jsx("div",{className:"sb-menu-head",children:"筛选会话"}),K6.map(([ne,H])=>u.jsxs("button",{className:"sb-opt",type:"button",onClick:()=>{Ae(ye=>({...ye,filter:ne})),oe(!1)},children:[u.jsx("span",{className:"g",children:be.filter===ne?"✓":" "}),H]},ne))]}):null]}),u.jsxs("div",{className:"sessions",children:[b!==""?u.jsxs("div",{className:"result-meta",children:[ut," 个标题结果 · Esc 清空"]}):null,b===""||y===void 0?null:u.jsxs("div",{className:"content-hits",children:[u.jsxs("div",{className:"content-hits-head",children:["内容命中",A?" · 检索中…":E.length===0?" · 无":` · ${String(E.length)}`]}),B===null?null:u.jsx("div",{className:"content-hit-err",children:B}),E.map(ne=>u.jsxs("button",{className:"search-hit",type:"button",title:`${ne.workspace} · ${ne.file} · seq ${String(ne.seq)}`,onClick:()=>{y(ne)},children:[u.jsxs("div",{className:"search-hit-meta",children:[u.jsx("span",{className:"ws",children:ne.workspace}),u.jsx("span",{className:"role",children:ne.role==="user"?"你":"大罗"}),u.jsxs("span",{className:"seq",children:["#",String(ne.seq)]}),u.jsx("span",{className:"ts",children:new Date(ne.ts).toLocaleTimeString("zh-CN",{hour:"2-digit",minute:"2-digit"})})]}),u.jsx("div",{className:"search-hit-snippet",children:ne.snippet})]},`${ne.root}/${ne.file}/${String(ne.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:()=>{_()},children:"重试"})]}),!i&&r===null&&ut===0&&b!==""?u.jsxs("div",{className:"empty-result",children:[u.jsx("span",{className:"big",children:"◇"}),"没有找到「",b,"」",u.jsx("br",{}),"按 Esc 清空搜索"]}):null,!i&&r===null&&ut===0&&b===""?u.jsxs("div",{className:"empty-result",children:[u.jsx("span",{className:"big",children:"◇"}),We.length===0?be.filter==="archived"?"还没有已归档会话":"还没有会话":be.filter==="archived"?"":"没有活跃会话",u.jsx("br",{}),We.length===0?"点「新会话」开始":be.filter==="archived"?"这里只显示已归档会话":`展开下面的「已归档 ${String(We.length)}」`]}):null,at.map(ne=>u.jsxs("div",{className:`group${ne.depth>0?" tree-child":""}`,"data-open":!z.has(ne.key)||b!=="",children:[u.jsxs("div",{className:"group-label",title:ne.root===""?ne.title:ne.root,style:ne.depth>0?{paddingLeft:"26px"}:void 0,onClick:()=>{D(H=>{const ye=new Set(H);return ye.has(ne.key)?ye.delete(ne.key):ye.add(ne.key),ye})},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:ne.title}),ne.active?u.jsx("span",{className:"here",children:"当前"}):null,u.jsx("span",{className:"recent",children:ne.rows.length===0?"":U6(ne.rows.map(H=>H.row))}),ne.rows.length===0?null:u.jsx("span",{className:"count",children:ne.rows.length})]}),u.jsx("div",{className:"group-items",children:ne.rows.map(({row:H,group:ye})=>{const ke={root:ye.root,name:H.name},Xe=H.title??H.name,ot=Object.keys(nx(H)).length>0;return u.jsxs("div",{className:"row-menu",children:[Ui(I,ke)?u.jsxs("div",{className:"session editing",children:[u.jsx("span",{className:"dot"}),u.jsx("input",{className:"rename-input",ref:et=>{et!==null&&(et.focus({preventScroll:!0}),et.select())},value:F,onChange:et=>{O(et.target.value)},onKeyDown:et=>{et.key==="Enter"?(et.preventDefault(),mt(ke,H)):et.key==="Escape"&&(G(null),ge(null))},onBlur:()=>{G(null)}})]}):u.jsxs("div",{className:`session${H.name===t&&ye.active?" active":""}${Ui($,ke)?" menu-open":""}${ot?" has-labels":""}`,onClick:()=>{c(H,ye)},children:[u.jsx("span",{className:"dot"}),u.jsx("span",{className:"title",children:u.jsx(q6,{text:Xe,query:b})}),H.forkedFrom===void 0?null:u.jsx("span",{className:"fork-badge",title:`从 ${H.forkedFrom.file} 的 seq ${String(H.forkedFrom.seq)} 分叉`,children:"分叉"}),Ui(T,ke)?u.jsx("span",{className:"meta",children:"已复制"}):null,Ui(T,ke)?null:H.waiting===!0?u.jsx("span",{className:"meta waiting",children:"!"}):H.running===!0?u.jsx("span",{className:"meta running",children:"●"}):u.jsx("span",{className:"meta",children:P6(H.lastActiveMs)}),ye.active?u.jsx("button",{className:"more",title:"会话操作","aria-label":"会话操作",onClick:et=>{et.stopPropagation(),Te(ke)},children:"⋯"}):null,ot?u.jsx(F6,{labels:nx(H)}):null]}),Ui($,ke)?u.jsxs("div",{className:"menu row-menu-pop",children:[u.jsx("div",{className:"menu-head",children:"会话操作"}),u.jsxs("button",{className:"menu-item",onClick:()=>{ze(ke,H)},children:[u.jsx("span",{className:"g",children:"✎"})," 重命名",u.jsx("span",{className:"key",children:"F2"})]}),u.jsxs("button",{className:"menu-item",onClick:()=>{ae(null),g(H).catch(et=>{ge({key:ke,message:et instanceof Error?et.message:String(et)})})},children:[u.jsx("span",{className:"g",children:"↧"})," 置顶",u.jsx("span",{className:"key"})]}),u.jsxs("button",{className:"menu-item",onClick:()=>{Ot(ke)},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:()=>{jt(ke,H)},children:[u.jsx("span",{className:"g",children:"⌁"})," 标签…",u.jsx("span",{className:"key"})]}),u.jsxs("button",{className:"menu-item",onClick:()=>{ae(null),se(ke),ge(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:()=>{ae(null),K(ke),ge(null)},children:[u.jsx("span",{className:"g",children:"✕"})," 删除会话",u.jsx("span",{className:"key",children:"⌫"})]})]}):null,Ui(V,ke)?u.jsxs("div",{className:"confirm archived-confirm",children:[u.jsxs("div",{className:"t",children:["归档会话 ",u.jsxs("b",{className:"t-name",children:["「",Xe,"」"]}),"?",u.jsx("br",{}),"从主列表移到「已归档」,日志不动;随时可以恢复。"]}),u.jsxs("div",{className:"a",children:[u.jsx("button",{className:"btn",onClick:()=>{se(null)},children:"取消"}),u.jsx("button",{className:"btn primary",onClick:()=>{Se(ke,H)},children:"归档"})]})]}):null,Ui(U,ke)?u.jsxs("div",{className:"confirm",children:[u.jsxs("div",{className:"t",children:["删除会话 ",u.jsxs("b",{children:["「",Xe,"」"]}),"?",u.jsx("br",{}),"会话日志会一起删除,不可恢复。"]}),u.jsxs("div",{className:"a",children:[u.jsx("button",{className:"btn",onClick:()=>{K(null)},children:"取消"}),u.jsx("button",{className:"btn danger-solid",onClick:()=>{f(H).then(()=>{K(null)},et=>{ge({key:ke,message:et instanceof Error?et.message:String(et)})})},children:"删除"})]})]}):null,ee!==null&&Ui(ee.key,ke)?u.jsx("div",{className:"action-error",children:ee.message}):null]},`${ye.root}/${H.name}`)})})]},ne.key))]}),We.length===0?null:u.jsxs("div",{className:"archived","data-open":be.filter==="archived"?!0:je,children:[u.jsxs("button",{className:"archived-toggle","aria-expanded":je,onClick:()=>{de(ne=>!ne)},children:[u.jsx("span",{className:"chev",children:be.filter==="archived"||je?"▾":"▸"})," 已归档 ",u.jsx("span",{className:"count",children:We.length})]}),je||be.filter==="archived"?u.jsx("div",{className:"archived-items",children:We.map(({group:ne,row:H})=>{const ye={root:ne.root,name:H.name},ke=H.title??H.name;return u.jsxs("div",{className:"row-menu",children:[u.jsxs("div",{className:"session archived-row",title:"点开查看;取消归档会把它放回主列表",onClick:()=>{c(H,ne)},children:[u.jsx("span",{className:"dot"}),u.jsx("span",{className:"title",children:ke}),u.jsx("button",{className:"unarchive",onClick:Xe=>{Xe.stopPropagation(),m(H,!1).catch(ot=>{ge({key:ye,message:ot instanceof Error?ot.message:String(ot)})})},children:"取消归档"})]}),ee!==null&&Ui(ee.key,ye)?u.jsx("div",{className:"action-error",children:ee.message}):null]},`${ne.root}/${H.name}`)})}):null]}),u.jsx("div",{className:"sidebar-foot",children:u.jsxs("button",{className:"foot-item",onClick:S,children:[u.jsx("span",{className:"g",style:{width:"15px",textAlign:"center"},children:"⚙"}),"设置",u.jsx("span",{className:"spacer"}),u.jsx("kbd",{children:"⌘,"})]})}),me===null?null:u.jsx("div",{className:"modal-backdrop label-backdrop",onClick:()=>{pe||M(null)},children:u.jsxs("div",{className:"modal-card",role:"dialog","aria-label":"编辑标签",onClick:ne=>{ne.stopPropagation()},children:[u.jsxs("div",{className:"modal-head",children:["编辑标签 ",u.jsx("span",{className:"mut",children:me.row.title??me.row.name})]}),u.jsxs("div",{className:"modal-body",children:[u.jsx("div",{className:"label-rows",children:j.map((ne,H)=>u.jsxs("div",{className:"label-row",children:[u.jsx("input",{className:"label-key",value:ne.key,placeholder:"键(如 run / pr / ticket)","aria-label":"标签键",onChange:ye=>{const ke=ye.target.value;Z(Xe=>Xe.map((ot,et)=>et===H?{...ot,key:ke}:ot))}}),u.jsx("span",{className:"sep",children:"="}),u.jsx("input",{className:"label-val",value:ne.value,placeholder:"值","aria-label":"标签值",onChange:ye=>{const ke=ye.target.value;Z(Xe=>Xe.map((ot,et)=>et===H?{...ot,value:ke}:ot))}}),u.jsx("button",{className:"label-del",title:"删除",onClick:()=>{Z(ye=>ye.filter((ke,Xe)=>Xe!==H))},children:"✕"})]},H))}),u.jsx("button",{className:"add-label",onClick:()=>{Z(ne=>[...ne,{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)。"]}),re===null?null:u.jsx("div",{className:"dialog-error",children:re})]}),u.jsxs("div",{className:"modal-foot",children:[u.jsx("button",{className:"btn",disabled:pe,onClick:()=>{M(null)},children:"取消"}),u.jsx("button",{className:"btn primary",disabled:pe,onClick:()=>{le()},children:"保存标签"})]})]})})]})}function W6({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 X6(e,t,i=Date.now()){const r=t.trim();return r===""?[...e]:[...e,{role:"user",text:r,at:i}]}function ix(e,t,i=Date.now()){const r=(t??"").trim();return[...e,{role:"assistant",text:r===""?"(模型没有返回正文)":r,at:i}]}function G6(e,t=18){const i=(e??"").trim();return i===""?"旁路对话":i.length>t?`旁路 · ${i.slice(0,t)}…`:`旁路 · ${i}`}function Q6({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 b=f.trim();if(!(b===""||m)){g(""),S(null),a(w=>X6(w,b)),v(!0);try{const w=await hu(b,c);c===void 0&&(h(w.logFile),lx(w.logFile,!0).catch(()=>{})),a(E=>ix(E,w.reply))}catch(w){const E=w instanceof Error?w.message:String(w);S(E),a(N=>ix(N,`发送失败:${E}`))}finally{v(!1)}}};return e?u.jsxs("aside",{className:"sidechat","aria-label":"旁路对话",children:[u.jsxs("div",{className:"sidechat-head",children:[u.jsx("b",{children:G6(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((b,w)=>u.jsxs("div",{className:b.role==="user"?"sidechat-msg user":"sidechat-msg ai",children:[u.jsx("div",{className:"sidechat-role",children:b.role==="user"?"你":"大罗"}),u.jsx("div",{className:"sidechat-text",children:b.text})]},`${String(w)}-${String(b.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:b=>{g(b.target.value)},onKeyDown:b=>{b.key==="Enter"&&!b.shiftKey&&(b.preventDefault(),y())}}),u.jsx("button",{className:"btn",disabled:m||f.trim()==="",onClick:()=>{y()},children:"发送"})]})]}):null}const Ol={text:"",dropped:0};function Z6(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 J6(e){const[t,i]=C.useState(null),[r,a]=C.useState(!1),[c,h]=C.useState(null),[f,g]=C.useState("connecting"),[m,v]=C.useState(Ol),_=C.useRef(!0),S=C.useRef(e);S.current=e;const y=C.useCallback(async()=>{const b=S.current;if(b===null){i(null);return}try{const w=await o2(b);if(!_.current||S.current!==b)return;i(w),h(null),v(Ol)}catch(w){if(!_.current||S.current!==b)return;h(w instanceof Error?w.message:String(w))}},[]);return C.useEffect(()=>(_.current=!0,e===null?(i(null),h(null),v(Ol),a(!1),()=>{_.current=!1}):(a(!0),i(null),h(null),v(Ol),y().finally(()=>{_.current&&a(!1)}),()=>{_.current=!1})),[e,y]),C.useEffect(()=>{if(e===null){g("connecting");return}let b;const w=()=>{b!==void 0&&clearTimeout(b),b=setTimeout(()=>{y()},150)},E=new EventSource(`/events?session=${encodeURIComponent(e)}`);return E.onopen=()=>{g("open"),w()},E.onerror=()=>{g("closed")},E.onmessage=N=>{let A=null;try{A=JSON.parse(N.data)}catch{return}A!==null&&(A.type==="message/assistant"&&v(Ol),w())},()=>{b!==void 0&&clearTimeout(b),E.close(),g("connecting")}},[e,y]),C.useEffect(()=>{if(e===null){v(Ol);return}const b=new EventSource(`/live?session=${encodeURIComponent(e)}`);return b.onmessage=w=>{let E=null;try{E=JSON.parse(w.data)}catch{return}v(N=>Z6(E,N))},()=>{b.close()}},[e]),{view:t,loading:r,error:c,stream:f,liveText:m.text,liveDropped:m.dropped,reload:y}}const Fw="daluo.web.tabs",yp=12;function $w(e){return typeof e=="string"&&e!==""&&e.endsWith(".jsonl")&&!e.includes("/")&&!e.includes("\\")}function eL(e){if(e===null)return[];try{const t=JSON.parse(e.getItem(Fw)??"[]");if(!Array.isArray(t))return[];const i=[];for(const r of t)if(!(!$w(r)||i.includes(r))&&(i.push(r),i.length>=yp))break;return i}catch{return[]}}function tL(e,t){if(e!==null)try{e.setItem(Fw,JSON.stringify(t))}catch{}}function sx(e,t){if(!$w(t))return[...e];if(e.includes(t))return[...e];const i=[...e,t];return i.length>yp?i.slice(i.length-yp):i}function Vw(e,t){return e.filter(i=>i!==t)}function nL(e,t,i){if(i!==t)return i;const r=e.indexOf(t),a=Vw(e,t);return a.length===0?null:a[Math.min(r<0?0:r,a.length-1)]??null}const Ul=new URLSearchParams(location.search),iL=Ul.get("theme")==="dark"?"dark":"light",sL=Ul.get("view")==="settings"?"settings":Ul.get("view")==="trajectory"?"trajectory":Ul.get("view")==="empty"?"empty":"conv",uu=Ul.get("session"),rL=(()=>{const e=Ul.get("seq"),t=e===null?Number.NaN:Number(e);return Number.isInteger(t)&&t>0?t:void 0})();function lL(){const[e,t]=C.useState(iL),[i,r]=C.useState(sL),[a,c]=C.useState([]),[h,f]=C.useState(!0),[g,m]=C.useState(null),[v,_]=C.useState(uu),[S,y]=C.useState(()=>{const _e=eL(typeof localStorage>"u"?null:localStorage);return uu===null?_e:sx(_e,uu)});C.useEffect(()=>{tL(typeof localStorage>"u"?null:localStorage,S)},[S]);const b=C.useMemo(()=>new Map(a.flatMap(oe=>oe.sessions.map(_e=>[_e.name,_e.title??_e.name]))),[a]),[w,E]=C.useState("新会话"),[N,A]=C.useState(!0),[R,B]=C.useState(!1),[q,z]=C.useState(0),[D,$]=C.useState(null),[ae,I]=C.useState(null),[G,F]=C.useState(!1),[O,U]=C.useState(null),[K,V]=C.useState(!1),[se,ee]=C.useState(null),ge=J6(v);C.useEffect(()=>{document.documentElement.dataset.theme=e},[e]),C.useEffect(()=>{const oe=_e=>{if((_e.metaKey||_e.ctrlKey)&&_e.key.toLowerCase()==="k"){_e.preventDefault(),V(Ce=>!Ce);return}if((_e.metaKey||_e.ctrlKey)&&_e.key===","){_e.preventDefault(),r("settings");return}(_e.metaKey||_e.ctrlKey)&&_e.key.toLowerCase()==="t"&&(_e.preventDefault(),r("trajectory"))};return window.addEventListener("keydown",oe),()=>{window.removeEventListener("keydown",oe)}},[]);const T=C.useCallback(async()=>{f(!0);try{const oe=await XN({archived:!0});c(oe.groups),m(null);const _e=new URLSearchParams(location.search).get("session")??uu;if(_e!==null){for(const Ce of oe.groups){const Ee=Ce.sessions.find(at=>at.name===_e);if(Ee!==void 0){_(Ee.name),E(Ee.title??Ee.name);return}}_(_e),E(_e);return}E(Ce=>Ce)}catch(oe){m(oe instanceof Error?oe.message:String(oe))}finally{f(!1)}},[]);C.useEffect(()=>{T()},[T]),C.useEffect(()=>{if(h||i!=="conv"||v!==null||new URLSearchParams(location.search).get("session")!==null)return;const _e=(a.find(Ce=>Ce.active)??a[0])?.sessions.find(Ce=>Ce.archived!==!0);_e!==void 0&&(_(_e.name),E(_e.title??_e.name),history.replaceState(null,"",`/?session=${encodeURIComponent(_e.name)}`))},[h,a,i,v]);const De=()=>{t(oe=>oe==="dark"?"light":"dark")},me=(oe,_e)=>{r("conv"),_(oe),y(Ce=>sx(Ce,oe)),E(_e??oe),history.replaceState(null,"",`/?session=${encodeURIComponent(oe)}`)},M=()=>{r("empty"),_(null),E("新会话"),history.replaceState(null,"","/")},j=oe=>{const _e=nL(S,oe,v);if(y(Ce=>Vw(Ce,oe)),_e===null){M();return}oe===v&&me(_e)},Z=oe=>{me(oe.name,oe.title??oe.name)},re=(oe,_e)=>{if(_e.active){Z(oe);return}$(null),U0(_e.root).then(()=>{location.href=`/?session=${encodeURIComponent(oe.name)}`}).catch(Ce=>{$(Ce instanceof Error?Ce.message:String(Ce))})},ie=Date.now(),pe=[{id:"action:new",group:"动作",label:"新会话",hint:"⌘N",keywords:"new chat",run:M},{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:()=>{T()}},...a.flatMap(oe=>oe.sessions.map(_e=>({id:`session:${_e.name}`,group:"会话",label:_e.title??_e.name,hint:qw(_e.lastActiveMs,ie),keywords:`${_e.name} ${oe.name}`,run:()=>{r("conv"),Z(_e)}}))).slice(0,80)],ve=async oe=>{if(v===null)return;const _e=v,Ce=w,Ee=await L0(_e,oe.at);me(Ee.session),await T(),ee({session:Ee.session,source:_e,sourceTitle:Ce,at:oe.at,round:oe.round,quote:oe.quote.length>160?`${oe.quote.slice(0,160)}…`:oe.quote,ts:oe.ts,kind:oe.kind})},je=oe=>{const _e=`/?session=${encodeURIComponent(oe.file)}&seq=${String(oe.seq)}`;if(a.find(Ee=>Ee.root===oe.root)?.active===!0){location.href=_e;return}$(null),U0(oe.root).then(()=>{location.href=_e}).catch(Ee=>{$(Ee instanceof Error?Ee.message:String(Ee))})},de=async(oe,_e)=>{if(v!==null){$(null);try{await hu(oe,v,ge.view?.sessionId,_e),I(null),U(null)}catch(Ce){$(Ce instanceof Error?Ce.message:String(Ce)),I({text:oe,..._e===void 0?{}:{images:_e}})}finally{await ge.reload(),await T()}}},be=async(oe,_e,Ce)=>{if(bp(oe)!==null){$("还没有会话:先发一句话建会话,再设目标。");return}$(null);try{const Ee=await hu(oe,void 0,void 0,_e,Ce);I(null),me(Ee.logFile,oe.length>24?`${oe.slice(0,24)}…`:oe),await T()}catch(Ee){$(Ee instanceof Error?Ee.message:String(Ee)),I({text:oe,..._e===void 0?{}:{images:_e}})}},Ae=async oe=>{if(v===null)return;const _e=v,Ce=j2(ge.view?.turns??[],oe.seq),Ee=await L0(_e,Ce);me(Ee.session),await T();const at=oe.images?.map(We=>({path:We.path}));$(null),I(null);try{await hu(oe.text,Ee.session,void 0,at),U(`已重答:新会话 ${Ee.session}(源会话 ${_e} 保留)`)}catch(We){$(We instanceof Error?We.message:String(We)),I({text:oe.text,...at===void 0?{}:{images:at}})}finally{await ge.reload(),await T()}},st=async()=>{const oe=ae;if(oe!==null){F(!0),$(null),U(null);try{if(v===null){await be(oe.text,oe.images);return}const _e=ge.view?.turns??[],Ce=[..._e].reverse().find(Ee=>Ee.role==="user"&&Ee.source!=="context"&&Ee.text.trim()!=="");if(E2(_e,oe.text)==="reanswer"&&Ce!==void 0){await Ae({seq:Ce.seq,text:Ce.text,...Ce.images===void 0?{}:{images:Ce.images}});return}await de(oe.text,oe.images)}finally{F(!1)}}};return i==="settings"?u.jsx("div",{className:"app","data-dsh-surface":"root",children:u.jsx(_6,{onClose:()=>{r(v===null?"empty":"conv")},session:v,onTheme:t})}):i==="trajectory"?u.jsx("div",{className:"app","data-dsh-surface":"root",children:u.jsx(M6,{session:v,title:w,onBack:()=>{r(v===null?"empty":"conv")}})}):u.jsxs("div",{className:"app","data-dsh-surface":"root",children:[u.jsx(Y6,{groups:a,activeName:v,loading:h,loadError:g,onNewChat:M,onRename:async(oe,_e)=>{await GN(oe.name,_e),v===oe.name&&E(_e),await T()},onDelete:async oe=>{await QN(oe.name),v===oe.name&&M(),await T()},onPin:async oe=>{const _e=a.flatMap(Ce=>Ce.sessions.map(Ee=>Ee.name));await ZN([oe.name,..._e.filter(Ce=>Ce!==oe.name)]),await T()},onArchive:async(oe,_e)=>{await lx(oe.name,_e),await T()},onLabels:async(oe,_e)=>{await JN(oe.name,_e),await T()},onReload:async()=>{await T()},onOpenSettings:()=>{r("settings")},onSelect:re,onOpenSearchHit:je}),u.jsxs("main",{className:"main","data-dsh-surface":"conversation",children:[u.jsx(W6,{tabs:S,active:v,titles:b,onSelect:oe=>{me(oe)},onClose:j,onNew:M}),D===null&&ae===null&&O===null?null:u.jsxs("div",{className:`conn-banner${D===null?" ok":""}`,style:{margin:"10px auto 0",maxWidth:"812px"},children:[u.jsx("span",{className:D===null?"ok":"warn",children:D===null?"✓":"⚠"}),u.jsx("span",{children:D??O??"上一次发送失败:可以直接重试。"}),ae===null?null:u.jsx("button",{className:"btn",disabled:G,onClick:()=>{st()},children:G?"重试中…":"重试"}),u.jsx("button",{className:"btn",onClick:()=>{$(null),I(null),U(null)},children:"知道了"})]}),i==="conv"?u.jsx(BR,{title:w,session:v,thread:ge,onToggleTheme:De,onSend:de,onStop:()=>{v!==null&&h2(v)},onBack:M,onFork:ve,onReanswer:Ae,focusSeq:rL,onTrajectory:()=>{r("trajectory")},...v===null?{}:{onSideChat:()=>{B(!0)}},onViewChanges:()=>{A(!0),z(oe=>oe+1)}},v??"none"):u.jsx(ZB,{onToggleTheme:De,onSend:(oe,_e,Ce)=>{be(oe,_e,Ce)}})]}),u.jsx(Q6,{open:R&&v!==null,mainTitle:w,onClose:()=>{B(!1)}}),K?u.jsx(D2,{items:pe,onClose:()=>{V(!1)}}):null,u.jsx(FB,{collapsed:!N,changesSignal:q,onToggle:()=>A(oe=>!oe),onOpenTrajectory:()=>{r("trajectory")},onOpenPalette:()=>{V(!0)},session:v,onOpenSession:oe=>{me(oe)}}),se===null?null:u.jsx(e6,{info:se,onClose:()=>{ee(null)},onBackToSource:()=>{me(se.source,se.sourceTitle),ee(null)}})]})}const fm="/plugin-client/manifest";function aL(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 oL(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??fm,{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??fm,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??fm,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=aL(S);if(y!==void 0)throw new Error(y);const b=S,w={slots:{register(E,N){const A=N??E.Component;return r.register(b.id,{slot:E.slot,id:E.id,...E.order===void 0?{}:{order:E.order},...typeof E.title=="string"?{title:E.title}:{},...typeof E.forPlugin=="string"?{forPlugin:E.forPlugin}:{},Component:A})}},React:e.React??PN,logger:{debug:(...E)=>console.debug("[client-plugin]",...E),warn:(...E)=>console.warn("[client-plugin]",...E)}};await b.apply(w),a.已加载.push(m)}catch(_){a.失败.push({id:m,src:v,error:_ instanceof Error?_.message:String(_)})}}return a}const Kw=document.getElementById("root");if(Kw===null)throw new Error("找不到 #root:index.html 与 main.tsx 不同步");WN.createRoot(Kw).render(u.jsx(C.StrictMode,{children:u.jsx(lL,{})}));oL().then(e=>{e.失败.length>0&&console.warn("[client-plugin] 部分客户端插件未加载:",e.失败)}).catch(e=>{console.warn("[client-plugin] 运行时启动失败:",e)});