@ulm0/gonogo 0.1.2 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/client/assets/index-DxUnpGbS.js +52 -0
- package/dist/client/assets/index-tpcmltjw.css +1 -0
- package/dist/client/index.html +2 -2
- package/dist/server/audited.js +26 -3
- package/dist/server/cleanroom.js +7 -51
- package/dist/server/cli.js +87 -19
- package/dist/server/constants.js +15 -2
- package/dist/server/hangar.js +4 -4
- package/dist/server/home.js +17 -1
- package/dist/server/hub.js +102 -9
- package/dist/server/launcher.js +17 -10
- package/dist/server/mcp.js +41 -2
- package/dist/server/migrate.js +2 -1
- package/dist/server/missions.js +310 -0
- package/dist/server/models.js +73 -0
- package/dist/server/phone.js +122 -0
- package/dist/server/phonetag.js +47 -0
- package/dist/server/prices.js +112 -0
- package/dist/server/propellant.js +243 -16
- package/dist/server/providers.js +52 -0
- package/dist/server/relay.js +53 -7
- package/dist/server/relaykinds.js +11 -1
- package/dist/server/relief.js +2 -2
- package/dist/server/remotecontrol.js +15 -0
- package/dist/server/tasks.js +44 -8
- package/dist/server/uplinks.js +7 -0
- package/dist/server/web.js +165 -6
- package/dist/server/worktree.js +137 -0
- package/dist/shared/fuel.js +8 -0
- package/dist/shared/prices.js +75 -0
- package/dist/shared/protocol.js +16 -3
- package/package.json +1 -1
- package/dist/client/assets/index-BqCn1SM7.js +0 -50
- package/dist/client/assets/index-KZtFVMJG.css +0 -1
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
var e=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t,t.exports),e=null),t.exports);(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),t.credentials=e.crossOrigin===`use-credentials`?`include`:e.crossOrigin===`anonymous`?`omit`:`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var t=e((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.portal`),r=Symbol.for(`react.fragment`),i=Symbol.for(`react.strict_mode`),a=Symbol.for(`react.profiler`),o=Symbol.for(`react.consumer`),s=Symbol.for(`react.context`),c=Symbol.for(`react.forward_ref`),l=Symbol.for(`react.suspense`),u=Symbol.for(`react.memo`),d=Symbol.for(`react.lazy`),f=Symbol.for(`react.activity`),p=Symbol.for(`react.view_transition`),m=Symbol.iterator;function h(e){return typeof e!=`object`||!e?null:(e=m&&e[m]||e[`@@iterator`],typeof e==`function`?e:null)}var g={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},_=Object.assign,v={};function y(e,t,n){this.props=e,this.context=t,this.refs=v,this.updater=n||g}y.prototype.isReactComponent={},y.prototype.setState=function(e,t){if(typeof e!=`object`&&typeof e!=`function`&&e!=null)throw Error(`takes an object of state variables to update or a function which returns an object of state variables.`);this.updater.enqueueSetState(this,e,t,`setState`)},y.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,`forceUpdate`)};function b(){}b.prototype=y.prototype;function x(e,t,n){this.props=e,this.context=t,this.refs=v,this.updater=n||g}var S=x.prototype=new b;S.constructor=x,_(S,y.prototype),S.isPureReactComponent=!0;var C=Array.isArray;function ee(){}var w={H:null,A:null,T:null,S:null},T=Object.prototype.hasOwnProperty;function E(e,n,r){var i=r.ref;return{$$typeof:t,type:e,key:n,ref:i===void 0?null:i,props:r}}function te(e,t){return E(e.type,t,e.props)}function D(e){return typeof e==`object`&&!!e&&e.$$typeof===t}function ne(e){var t={"=":`=0`,":":`=2`};return`$`+e.replace(/[=:]/g,function(e){return t[e]})}var O=/\/+/g;function re(e,t){return typeof e==`object`&&e&&e.key!=null?ne(``+e.key):t.toString(36)}function k(e){switch(e.status){case`fulfilled`:return e.value;case`rejected`:throw e.reason;default:switch(typeof e.status==`string`?e.then(ee,ee):(e.status=`pending`,e.then(function(t){e.status===`pending`&&(e.status=`fulfilled`,e.value=t)},function(t){e.status===`pending`&&(e.status=`rejected`,e.reason=t)})),e.status){case`fulfilled`:return e.value;case`rejected`:throw e.reason}}throw e}function ie(e,r,i,a,o){var s=typeof e;(s===`undefined`||s===`boolean`)&&(e=null);var c=!1;if(e===null)c=!0;else switch(s){case`bigint`:case`string`:case`number`:c=!0;break;case`object`:switch(e.$$typeof){case t:case n:c=!0;break;case d:return c=e._init,ie(c(e._payload),r,i,a,o)}}if(c)return o=o(e),c=a===``?`.`+re(e,0):a,C(o)?(i=``,c!=null&&(i=c.replace(O,`$&/`)+`/`),ie(o,r,i,``,function(e){return e})):o!=null&&(D(o)&&(o=te(o,i+(o.key==null||e&&e.key===o.key?``:(``+o.key).replace(O,`$&/`)+`/`)+c)),r.push(o)),1;c=0;var l=a===``?`.`:a+`:`;if(C(e))for(var u=0;u<e.length;u++)a=e[u],s=l+re(a,u),c+=ie(a,r,i,s,o);else if(u=h(e),typeof u==`function`)for(e=u.call(e),u=0;!(a=e.next()).done;)a=a.value,s=l+re(a,u++),c+=ie(a,r,i,s,o);else if(s===`object`){if(typeof e.then==`function`)return ie(k(e),r,i,a,o);throw r=String(e),Error(`Objects are not valid as a React child (found: `+(r===`[object Object]`?`object with keys {`+Object.keys(e).join(`, `)+`}`:r)+`). If you meant to render a collection of children, use an array instead.`)}return c}function ae(e,t,n){if(e==null)return e;var r=[],i=0;return ie(e,r,``,``,function(e){return t.call(n,e,i++)}),r}function oe(e){if(e._status===-1){var t=e._result,n=t();n.then(function(t){(e._status===0||e._status===-1)&&(e._status=1,e._result=t,n.status===void 0&&(n.status=`fulfilled`,n.value=t))},function(t){(e._status===0||e._status===-1)&&(e._status=2,e._result=t,n.status===void 0&&(n.status=`rejected`,n.reason=t))}),e._status===-1&&(e._status=0,e._result=n)}if(e._status===1)return e._result.default;throw e._result}var se=typeof reportError==`function`?reportError:function(e){if(typeof window==`object`&&typeof window.ErrorEvent==`function`){var t=new window.ErrorEvent(`error`,{bubbles:!0,cancelable:!0,message:typeof e==`object`&&e&&typeof e.message==`string`?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if(typeof process==`object`&&typeof process.emit==`function`){process.emit(`uncaughtException`,e);return}console.error(e)};function ce(e){var t=w.T,n={};n.types=t===null?null:t.types,w.T=n;try{var r=e(),i=w.S;i!==null&&i(n,r),typeof r==`object`&&r&&typeof r.then==`function`&&r.then(ee,se)}catch(e){se(e)}finally{t!==null&&n.types!==null&&(t.types=n.types),w.T=t}}function le(e){var t=w.T;if(t!==null){var n=t.types;n===null?t.types=[e]:n.indexOf(e)===-1&&n.push(e)}else ce(le.bind(null,e))}var ue={map:ae,forEach:function(e,t,n){ae(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return ae(e,function(){t++}),t},toArray:function(e){return ae(e,function(e){return e})||[]},only:function(e){if(!D(e))throw Error(`React.Children.only expected to receive a single React element child.`);return e}};e.Activity=f,e.Children=ue,e.Component=y,e.Fragment=r,e.Profiler=a,e.PureComponent=x,e.StrictMode=i,e.Suspense=l,e.ViewTransition=p,e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=w,e.__COMPILER_RUNTIME={__proto__:null,c:function(e){return w.H.useMemoCache(e)}},e.addTransitionType=le,e.cache=function(e){return function(){return e.apply(null,arguments)}},e.cacheSignal=function(){return null},e.cloneElement=function(e,t,n){if(e==null)throw Error(`The argument must be a React element, but you passed `+e+`.`);var r=_({},e.props),i=e.key;if(t!=null)for(a in t.key!==void 0&&(i=``+t.key),t)!T.call(t,a)||a===`key`||a===`__self`||a===`__source`||a===`ref`&&t.ref===void 0||(r[a]=t[a]);var a=arguments.length-2;if(a===1)r.children=n;else if(1<a){for(var o=Array(a),s=0;s<a;s++)o[s]=arguments[s+2];r.children=o}return E(e.type,i,r)},e.createContext=function(e){return e={$$typeof:s,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null},e.Provider=e,e.Consumer={$$typeof:o,_context:e},e},e.createElement=function(e,t,n){var r,i={},a=null;if(t!=null)for(r in t.key!==void 0&&(a=``+t.key),t)T.call(t,r)&&r!==`key`&&r!==`__self`&&r!==`__source`&&(i[r]=t[r]);var o=arguments.length-2;if(o===1)i.children=n;else if(1<o){for(var s=Array(o),c=0;c<o;c++)s[c]=arguments[c+2];i.children=s}if(e&&e.defaultProps)for(r in o=e.defaultProps,o)i[r]===void 0&&(i[r]=o[r]);return E(e,a,i)},e.createRef=function(){return{current:null}},e.forwardRef=function(e){return{$$typeof:c,render:e}},e.isValidElement=D,e.lazy=function(e){return{$$typeof:d,_payload:{_status:-1,_result:e},_init:oe}},e.memo=function(e,t){return{$$typeof:u,type:e,compare:t===void 0?null:t}},e.startTransition=ce,e.unstable_useCacheRefresh=function(){return w.H.useCacheRefresh()},e.use=function(e){return w.H.use(e)},e.useActionState=function(e,t,n){return w.H.useActionState(e,t,n)},e.useCallback=function(e,t){return w.H.useCallback(e,t)},e.useContext=function(e){return w.H.useContext(e)},e.useDebugValue=function(){},e.useDeferredValue=function(e,t){return w.H.useDeferredValue(e,t)},e.useEffect=function(e,t){return w.H.useEffect(e,t)},e.useEffectEvent=function(e){return w.H.useEffectEvent(e)},e.useId=function(){return w.H.useId()},e.useImperativeHandle=function(e,t,n){return w.H.useImperativeHandle(e,t,n)},e.useInsertionEffect=function(e,t){return w.H.useInsertionEffect(e,t)},e.useLayoutEffect=function(e,t){return w.H.useLayoutEffect(e,t)},e.useMemo=function(e,t){return w.H.useMemo(e,t)},e.useOptimistic=function(e,t){return w.H.useOptimistic(e,t)},e.useReducer=function(e,t,n){return w.H.useReducer(e,t,n)},e.useRef=function(e){return w.H.useRef(e)},e.useState=function(e){return w.H.useState(e)},e.useSyncExternalStore=function(e,t,n){return w.H.useSyncExternalStore(e,t,n)},e.useTransition=function(){return w.H.useTransition()},e.version=`19.3.1`})),n=e(((e,n)=>{n.exports=t()})),r=e((e=>{function t(e,t){var n=e.length;e.push(t);a:for(;0<n;){var r=n-1>>>1,a=e[r];if(0<i(a,t))e[r]=t,e[n]=a,n=r;else break a}}function n(e){return e.length===0?null:e[0]}function r(e){if(e.length===0)return null;var t=e[0],n=e.pop();if(n!==t){e[0]=n;a:for(var r=0,a=e.length,o=a>>>1;r<o;){var s=2*(r+1)-1,c=e[s],l=s+1,u=e[l];if(0>i(c,n))l<a&&0>i(u,c)?(e[r]=u,e[l]=n,r=l):(e[r]=c,e[s]=n,r=s);else if(l<a&&0>i(u,n))e[r]=u,e[l]=n,r=l;else break a}}return t}function i(e,t){var n=e.sortIndex-t.sortIndex;return n===0?e.id-t.id:n}if(e.unstable_now=void 0,typeof performance==`object`&&typeof performance.now==`function`){var a=performance;e.unstable_now=function(){return a.now()}}else{var o=Date,s=o.now();e.unstable_now=function(){return o.now()-s}}var c=[],l=[],u=1,d=null,f=3,p=!1,m=!1,h=!1,g=!1,_=typeof setTimeout==`function`?setTimeout:null,v=typeof clearTimeout==`function`?clearTimeout:null,y=typeof setImmediate<`u`?setImmediate:null;function b(e){for(var i=n(l);i!==null;){if(i.callback===null)r(l);else if(i.startTime<=e)r(l),i.sortIndex=i.expirationTime,t(c,i);else break;i=n(l)}}function x(e){if(h=!1,b(e),!m){if(n(c)!==null)m=!0,S||(S=!0,te());else{var t=n(l);t!==null&&O(x,t.startTime-e)}}}var S=!1,C=-1,ee=5,w=-1;function T(){return g?!0:!(e.unstable_now()-w<ee)}function E(){if(g=!1,S){var t=e.unstable_now();w=t;var i=!0;try{a:{m=!1,h&&(h=!1,v(C),C=-1),p=!0;var a=f;try{b:{for(b(t),d=n(c);d!==null&&!(d.expirationTime>t&&T());){var o=d.callback;if(typeof o==`function`){d.callback=null,f=d.priorityLevel;var s=o(d.expirationTime<=t);if(t=e.unstable_now(),typeof s==`function`){d.callback=s,b(t),i=!0;break b}d===n(c)&&r(c),b(t)}else r(c);d=n(c)}if(d!==null)i=!0;else{var u=n(l);u!==null&&O(x,u.startTime-t),i=!1}}break a}finally{d=null,f=a,p=!1}i=void 0}}finally{i?te():S=!1}}}var te;if(typeof y==`function`)te=function(){y(E)};else if(typeof MessageChannel<`u`){var D=new MessageChannel,ne=D.port2;D.port1.onmessage=E,te=function(){ne.postMessage(null)}}else te=function(){_(E,0)};function O(t,n){C=_(function(){t(e.unstable_now())},n)}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(e){e.callback=null},e.unstable_forceFrameRate=function(e){0>e||125<e?console.error(`forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported`):ee=0<e?Math.floor(1e3/e):5},e.unstable_getCurrentPriorityLevel=function(){return f},e.unstable_next=function(e){switch(f){case 1:case 2:case 3:var t=3;break;default:t=f}var n=f;f=t;try{return e()}finally{f=n}},e.unstable_requestPaint=function(){g=!0},e.unstable_runWithPriority=function(e,t){switch(e){case 1:case 2:case 3:case 4:case 5:break;default:e=3}var n=f;f=e;try{return t()}finally{f=n}},e.unstable_scheduleCallback=function(r,i,a){var o=e.unstable_now();switch(typeof a==`object`&&a?(a=a.delay,a=typeof a==`number`&&0<a?o+a:o):a=o,r){case 1:var s=-1;break;case 2:s=250;break;case 5:s=1073741823;break;case 4:s=1e4;break;default:s=5e3}return s=a+s,r={id:u++,callback:i,priorityLevel:r,startTime:a,expirationTime:s,sortIndex:-1},a>o?(r.sortIndex=a,t(l,r),n(c)===null&&r===n(l)&&(h?(v(C),C=-1):h=!0,O(x,a-o))):(r.sortIndex=s,t(c,r),m||p||(m=!0,S||(S=!0,te()))),r},e.unstable_shouldYield=T,e.unstable_wrapCallback=function(e){var t=f;return function(){var n=f;f=t;try{return e.apply(this,arguments)}finally{f=n}}}})),i=e(((e,t)=>{t.exports=r()})),a=e((e=>{var t=n();function r(e){var t=`https://react.dev/errors/`+e;if(1<arguments.length){t+=`?args[]=`+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+=`&args[]=`+encodeURIComponent(arguments[n])}return`Minified React error #`+e+`; visit `+t+` for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`}function i(){}var a={d:{f:i,r:function(){throw Error(r(522))},D:i,C:i,L:i,m:i,X:i,S:i,M:i},p:0,findDOMNode:null},o=Symbol.for(`react.portal`),s=Symbol.for(`react.recoverable`),c=Symbol.for(`react.optimistic_key`);function l(e,t,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:o,key:r==null?null:r===c?c:``+r,children:e,containerInfo:t,implementation:n}}var u=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function d(e,t){if(e===`font`)return``;if(typeof t==`string`)return t===`use-credentials`?t:``}e.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=a,e.browser=function(e){return{$$typeof:s,_reason:e}},e.createPortal=function(e,t){var n=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)throw Error(r(299));return l(e,t,null,n)},e.flushSync=function(e){var t=u.T,n=a.p;try{if(u.T=null,a.p=2,e)return e()}finally{u.T=t,a.p=n,a.d.f()}},e.preconnect=function(e,t){typeof e==`string`&&(t?(t=t.crossOrigin,t=typeof t==`string`?t===`use-credentials`?t:``:void 0):t=null,a.d.C(e,t))},e.prefetchDNS=function(e){typeof e==`string`&&a.d.D(e)},e.preinit=function(e,t){if(typeof e==`string`&&t&&typeof t.as==`string`){var n=t.as,r=d(n,t.crossOrigin),i=typeof t.integrity==`string`?t.integrity:void 0,o=typeof t.fetchPriority==`string`?t.fetchPriority:void 0;n===`style`?a.d.S(e,typeof t.precedence==`string`?t.precedence:void 0,{crossOrigin:r,integrity:i,fetchPriority:o}):n===`script`&&a.d.X(e,{crossOrigin:r,integrity:i,fetchPriority:o,nonce:typeof t.nonce==`string`?t.nonce:void 0})}},e.preinitModule=function(e,t){if(typeof e==`string`){if(typeof t==`object`&&t){if(t.as==null||t.as===`script`){var n=d(t.as,t.crossOrigin);a.d.M(e,{crossOrigin:n,integrity:typeof t.integrity==`string`?t.integrity:void 0,nonce:typeof t.nonce==`string`?t.nonce:void 0,fetchPriority:typeof t.fetchPriority==`string`?t.fetchPriority:void 0})}}else t??a.d.M(e)}},e.preload=function(e,t){if(typeof e==`string`&&typeof t==`object`&&t&&typeof t.as==`string`){var n=t.as,r=d(n,t.crossOrigin);a.d.L(e,n,{crossOrigin:r,integrity:typeof t.integrity==`string`?t.integrity:void 0,nonce:typeof t.nonce==`string`?t.nonce:void 0,type:typeof t.type==`string`?t.type:void 0,fetchPriority:typeof t.fetchPriority==`string`?t.fetchPriority:void 0,referrerPolicy:typeof t.referrerPolicy==`string`?t.referrerPolicy:void 0,imageSrcSet:typeof t.imageSrcSet==`string`?t.imageSrcSet:void 0,imageSizes:typeof t.imageSizes==`string`?t.imageSizes:void 0,media:typeof t.media==`string`?t.media:void 0})}},e.preloadModule=function(e,t){if(typeof e==`string`){if(t){var n=d(t.as,t.crossOrigin);a.d.m(e,{as:typeof t.as==`string`&&t.as!==`script`?t.as:void 0,crossOrigin:n,integrity:typeof t.integrity==`string`?t.integrity:void 0,nonce:typeof t.nonce==`string`?t.nonce:void 0,fetchPriority:typeof t.fetchPriority==`string`?t.fetchPriority:void 0})}else a.d.m(e)}},e.requestFormReset=function(e){a.d.r(e)},e.unstable_batchedUpdates=function(e,t){return e(t)},e.useFormState=function(e,t,n){return u.H.useFormState(e,t,n)},e.useFormStatus=function(){return u.H.useHostTransitionStatus()},e.version=`19.3.1`})),o=e(((e,t)=>{function n(){if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<`u`&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE==`function`)try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}n(),t.exports=a()})),s=e((e=>{var t=i(),r=n(),a=o();function s(e){var t=`https://react.dev/errors/`+e;if(1<arguments.length){t+=`?args[]=`+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+=`&args[]=`+encodeURIComponent(arguments[n])}return`Minified React error #`+e+`; visit `+t+` for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`}function c(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function l(e){for(var t=e,n=t;n&&!n.alternate;)t=n,t.flags&4098&&(e=t.return),n=t.return;for(;t.return;)t=t.return;return t.tag===3?e:null}function u(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function d(e){if(e.tag===31){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function f(e){if(l(e)!==e)throw Error(s(188))}function p(e){var t=e.alternate;if(!t){if(t=l(e),t===null)throw Error(s(188));return t===e?e:null}for(var n=e,r=t;;){var i=n.return;if(i===null)break;var a=i.alternate;if(a===null){if(r=i.return,r!==null){n=r;continue}break}if(i.child===a.child){for(a=i.child;a;){if(a===n)return f(i),e;if(a===r)return f(i),t;a=a.sibling}throw Error(s(188))}if(n.return!==r.return)n=i,r=a;else{for(var o=!1,c=i.child;c;){if(c===n){o=!0,n=i,r=a;break}if(c===r){o=!0,r=i,n=a;break}c=c.sibling}if(!o){for(c=a.child;c;){if(c===n){o=!0,n=a,r=i;break}if(c===r){o=!0,r=a,n=i;break}c=c.sibling}if(!o)throw Error(s(189))}}if(n.alternate!==r)throw Error(s(190))}if(n.tag!==3)throw Error(s(188));return n.stateNode.current===n?e:t}function m(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=m(e),t!==null)return t;e=e.sibling}return null}function h(e,t,n,r,i,a){for(;e!==null;){if((e.tag===5||e.tag===27||e.tag===6)&&n(e,r,i,a)||(e.tag!==22||e.memoizedState===null)&&(t||e.tag!==5&&e.tag!==27)&&h(e.child,t,n,r,i,a))return!0;e=e.sibling}return!1}function g(e){for(e=e.return;e!==null;){if(e.tag===3||e.tag===5||e.tag===27)return e;e=e.return}return null}function _(e){var t=!1;for(e=e.return;e!==null&&(e.tag===4&&(t=!0),e.tag!==3&&e.tag!==5&&e.tag!==27);)e=e.return;return t}function v(e){var t=[null,null],n=g(e);return n===null||y(t,e,n.child,{foundSelf:!1}),t}function y(e,t,n,r){for(;n!==null;){if(n===t)r.foundSelf=!0;else if(n.tag===5||n.tag===27||n.tag===6){if(r.foundSelf)return e[1]=n,!0;e[0]=n}else if((n.tag!==22||n.memoizedState===null)&&y(e,t,n.child,r))return!0;n=n.sibling}return!1}function b(e){switch(e.tag){case 5:case 27:case 6:return e.stateNode;case 3:return e.stateNode.containerInfo;default:throw Error(s(559))}}var x=null,S=null;function C(e,t,n){return e===n||e===t&&(x=e,!0)}function ee(e,t,n){return e===n?(S=e,!1):e===t&&(S!==null&&(x=e),!0)}function w(e){if(e===null)return null;do e=e===null?null:e.return;while(e&&e.tag!==5&&e.tag!==27&&e.tag!==3);return e||null}function T(e,t,n){for(var r=0,i=e;i;i=n(i))r++;i=0;for(var a=t;a;a=n(a))i++;for(;0<r-i;)e=n(e),r--;for(;0<i-r;)t=n(t),i--;for(;r--;){if(e===t||t!==null&&e===t.alternate)return e;e=n(e),t=n(t)}return null}var E=Object.assign,te=Symbol.for(`react.element`),D=Symbol.for(`react.transitional.element`),ne=Symbol.for(`react.portal`),O=Symbol.for(`react.fragment`),re=Symbol.for(`react.strict_mode`),k=Symbol.for(`react.profiler`),ie=Symbol.for(`react.consumer`),ae=Symbol.for(`react.context`),oe=Symbol.for(`react.forward_ref`),se=Symbol.for(`react.suspense`),ce=Symbol.for(`react.suspense_list`),le=Symbol.for(`react.memo`),ue=Symbol.for(`react.lazy`),de=Symbol.for(`react.activity`),fe=Symbol.for(`react.legacy_hidden`),pe=Symbol.for(`react.memo_cache_sentinel`),me=Symbol.for(`react.view_transition`),he=Symbol.for(`react.recoverable`),ge=Symbol.iterator;function _e(e){return typeof e!=`object`||!e?null:(e=ge&&e[ge]||e[`@@iterator`],typeof e==`function`?e:null)}var ve=Symbol.for(`react.client.reference`);function ye(e){if(e==null)return null;if(typeof e==`function`)return e.$$typeof===ve?null:e.displayName||e.name||null;if(typeof e==`string`)return e;switch(e){case O:return`Fragment`;case k:return`Profiler`;case re:return`StrictMode`;case se:return`Suspense`;case ce:return`SuspenseList`;case de:return`Activity`;case me:return`ViewTransition`}if(typeof e==`object`)switch(e.$$typeof){case ne:return`Portal`;case ae:return e.displayName||`Context`;case ie:return(e._context.displayName||`Context`)+`.Consumer`;case oe:var t=e.render;return e=e.displayName,e||=(e=t.displayName||t.name||``,e===``?`ForwardRef`:`ForwardRef(`+e+`)`),e;case le:return t=e.displayName||null,t===null?ye(e.type)||`Memo`:t;case ue:t=e._payload,e=e._init;try{return ye(e(t))}catch{}}return null}var be=Array.isArray,A=r.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,j=a.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,xe={pending:!1,data:null,method:null,action:null},Se=[],Ce=-1;function we(e){return{current:e}}function Te(e){0>Ce||(e.current=Se[Ce],Se[Ce]=null,Ce--)}function Ee(e,t){Ce++,Se[Ce]=e.current,e.current=t}var De=we(null),Oe=we(null),ke=we(null),Ae=we(null);function je(e,t){switch(Ee(ke,t),Ee(Oe,e),Ee(De,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?dp(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=dp(t),e=fp(t,e);else switch(e){case`svg`:e=1;break;case`math`:e=2;break;default:e=0}}Te(De),Ee(De,e)}function Me(){Te(De),Te(Oe),Te(ke)}function Ne(e){var t=e.memoizedState;t!==null&&(sh._currentValue=t.memoizedState,Ee(Ae,e)),t=De.current;var n=fp(t,e.type);t!==n&&(Ee(Oe,e),Ee(De,n))}function Pe(e){Oe.current===e&&(Te(De),Te(Oe)),Ae.current===e&&(Te(Ae),sh._currentValue=xe)}var Fe,Ie;function Le(e){if(Fe===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);Fe=t&&t[1]||``,Ie=-1<e.stack.indexOf(`
|
|
2
|
-
at`)?` (<anonymous>)`:-1<e.stack.indexOf(`@`)?`@unknown:0:0`:``}return`
|
|
3
|
-
`+Fe+e+Ie}var Re=!1;function ze(e,t){if(!e||Re)return``;Re=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var r={DetermineComponentFrameRoot:function(){try{if(t){var n=function(){throw Error()};if(Object.defineProperty(n.prototype,"props",{set:function(){throw Error()}}),typeof Reflect==`object`&&Reflect.construct){try{Reflect.construct(n,[])}catch(e){var r=e}Reflect.construct(e,[],n)}else{try{n.call()}catch(e){r=e}n=!1;try{var i=Object.getOwnPropertyDescriptor(e.prototype,`props`);Object.defineProperty(e.prototype,"props",{configurable:!0,set:function(){throw Error()}}),n=!0,new e}finally{n&&(i===void 0?delete e.prototype.props:Object.defineProperty(e.prototype,"props",i))}}}else{try{throw Error()}catch(e){r=e}(n=e())&&typeof n.catch==`function`&&n.catch(function(){})}}catch(e){if(e&&r&&typeof e.stack==`string`)return[e.stack,r.stack]}return[null,null]}};r.DetermineComponentFrameRoot.displayName=`DetermineComponentFrameRoot`;var i=Object.getOwnPropertyDescriptor(r.DetermineComponentFrameRoot,`name`);i&&i.configurable&&Object.defineProperty(r.DetermineComponentFrameRoot,"name",{value:`DetermineComponentFrameRoot`});var a=r.DetermineComponentFrameRoot(),o=a[0],s=a[1];if(o&&s){var c=o.split(`
|
|
4
|
-
`),l=s.split(`
|
|
5
|
-
`);for(i=r=0;r<c.length&&!c[r].includes(`DetermineComponentFrameRoot`);)r++;for(;i<l.length&&!l[i].includes(`DetermineComponentFrameRoot`);)i++;if(r===c.length||i===l.length)for(r=c.length-1,i=l.length-1;1<=r&&0<=i&&c[r]!==l[i];)i--;for(;1<=r&&0<=i;r--,i--)if(c[r]!==l[i]){if(r!==1||i!==1)do if(r--,i--,0>i||c[r]!==l[i]){var u=`
|
|
6
|
-
`+c[r].replace(` at new `,` at `);return e.displayName&&u.includes(`<anonymous>`)&&(u=u.replace(`<anonymous>`,e.displayName)),u}while(1<=r&&0<=i);break}}}finally{Re=!1,Error.prepareStackTrace=n}return(n=e?e.displayName||e.name:``)?Le(n):``}function Be(e,t){switch(e.tag){case 26:case 27:case 5:return Le(e.type);case 16:return Le(`Lazy`);case 13:return e.child!==t&&t!==null?Le(`Suspense Fallback`):Le(`Suspense`);case 19:return Le(`SuspenseList`);case 0:case 15:return ze(e.type,!1);case 11:return ze(e.type.render,!1);case 1:return ze(e.type,!0);case 31:return Le(`Activity`);case 30:return Le(`ViewTransition`);default:return``}}function Ve(e){try{var t=``,n=null;do t+=Be(e,n),n=e,e=e.return;while(e);return t}catch(e){return`
|
|
7
|
-
Error generating stack: `+e.message+`
|
|
8
|
-
`+e.stack}}var He=Object.prototype.hasOwnProperty,Ue=t.unstable_scheduleCallback,We=t.unstable_cancelCallback,Ge=t.unstable_shouldYield,Ke=t.unstable_requestPaint,qe=t.unstable_now,Je=t.unstable_getCurrentPriorityLevel,Ye=t.unstable_ImmediatePriority,Xe=t.unstable_UserBlockingPriority,Ze=t.unstable_NormalPriority,Qe=t.unstable_LowPriority,$e=t.unstable_IdlePriority,et=t.log,tt=t.unstable_setDisableYieldValue,nt=null,rt=null;function it(e){if(typeof et==`function`&&tt(e),rt&&typeof rt.setStrictMode==`function`)try{rt.setStrictMode(nt,e)}catch{}}var at=Math.clz32?Math.clz32:M,ot=Math.log,st=Math.LN2;function M(e){return e>>>=0,e===0?32:31-(ot(e)/st|0)|0}var ct=256,lt=262144,ut=4194304;function dt(e){var t=e&42;if(t!==0)return t;switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return e&-e;case 262144:case 524288:case 1048576:case 2097152:return e&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return e&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return e}}function ft(e,t,n){var r=e.pendingLanes;if(r===0)return 0;var i=0,a=e.suspendedLanes,o=e.pingedLanes;e=e.warmLanes;var s=r&134217727;return s===0?(s=r&~a,s===0?o===0?n||(n=r&~e,n!==0&&(i=dt(n))):i=dt(o):i=dt(s)):(r=s&~a,r===0?(o&=s,o===0?n||(n=s&~e,n!==0&&(i=dt(n))):i=dt(o)):i=dt(r)),i===0?0:t!==0&&t!==i&&(t&a)===0&&(a=i&-i,n=t&-t,a>=n||a===32&&n&4194048)?t:i}function pt(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function mt(e,t){t&8&&(t|=t&32);var n=e.entangledLanes;if(n!==0)for(e=e.entanglements,n&=t;0<n;){var r=31-at(n),i=1<<r;t|=e[r],n&=~i}return t}function ht(e,t){switch(e){case 1:case 2:case 4:case 8:case 64:return t+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 t+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 gt(){var e=ut;return ut<<=1,!(ut&62914560)&&(ut=4194304),e}function _t(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function vt(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function yt(e,t,n,r,i,a){var o=e.pendingLanes;e.pendingLanes=n,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=n,e.entangledLanes&=n,e.errorRecoveryDisabledLanes&=n,e.shellSuspendCounter=0;var s=e.entanglements,c=e.expirationTimes,l=e.hiddenUpdates;for(n=o&~n;0<n;){var u=31-at(n),d=1<<u;s[u]=0,c[u]=-1;var f=l[u];if(f!==null)for(l[u]=null,u=0;u<f.length;u++){var p=f[u];p!==null&&(p.lane&=-536870913)}n&=~d}r!==0&&bt(e,r,0),a!==0&&i===0&&e.tag!==0&&(e.suspendedLanes|=a&~(o&~t))}function bt(e,t,n){e.pendingLanes|=t,e.suspendedLanes&=~t;var r=31-at(t);e.entangledLanes|=t,e.entanglements[r]=e.entanglements[r]|1073741824|n&261930}function xt(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var r=31-at(n),i=1<<r;i&t|e[r]&t&&(e[r]|=t),n&=~i}}function St(e,t){var n=t&-t;return n=n&42?1:Ct(n),(n&(e.suspendedLanes|t))===0?n:0}function Ct(e){switch(e){case 2:e=1;break;case 8:e=4;break;case 32:e=16;break;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:e=128;break;case 268435456:e=134217728;break;default:e=0}return e}function wt(e){return e&=-e,2<e?8<e?e&134217727?32:268435456:8:2}function Tt(){var e=j.p;return e===0?(e=window.event,e===void 0?32:Ch(e.type)):e}function Et(e,t){var n=j.p;try{return j.p=e,t()}finally{j.p=n}}var Dt=Math.random().toString(36).slice(2),Ot=`__reactFiber$`+Dt,kt=`__reactProps$`+Dt,At=`__reactContainer$`+Dt,jt=`__reactEvents$`+Dt,Mt=`__reactListeners$`+Dt,Nt=`__reactHandles$`+Dt,N=`__reactResources$`+Dt,Pt=`__reactMarker$`+Dt,Ft=`__reactLoad$`+Dt;function It(e){delete e[Ot],delete e[kt],delete e[Mt],delete e[Nt]}function Lt(e){var t;if(t=e[Ot])return t;for(var n=e.parentNode;n;){if(t=n[At]||n[Ot]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=fm(e);e!==null;){if(n=e[Ot])return n;e=fm(e)}return t}e=n,n=e.parentNode}return null}function Rt(e){if(e=e[Ot]||e[At]){var t=e.tag;if(t===5||t===6||t===13||t===31||t===26||t===27||t===3)return e}return null}function zt(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e.stateNode;throw Error(s(33))}function Bt(e){var t=e[N];return t||=e[N]={hoistableStyles:new Map,hoistableScripts:new Map},t}function Vt(e){e[Pt]=!0}function Ht(e){e[Ft]=void 0}var Ut=new Set,Wt={};function Gt(e,t){Kt(e,t),Kt(e+`Capture`,t)}function Kt(e,t){for(Wt[e]=t,e=0;e<t.length;e++)Ut.add(t[e])}var qt=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]*$`),Jt={},Yt={};function Xt(e){return He.call(Yt,e)?!0:He.call(Jt,e)?!1:qt.test(e)?Yt[e]=!0:(Jt[e]=!0,!1)}var P=!1;function Zt(){var e=P;return P=!1,e}function Qt(e,t,n){if(Xt(t)){if(n===null)e.removeAttribute(t);else{switch(typeof n){case`undefined`:case`function`:case`symbol`:e.removeAttribute(t);return;case`boolean`:var r=t.toLowerCase().slice(0,5);if(r!==`data-`&&r!==`aria-`){e.removeAttribute(t);return}}e.setAttribute(t,n)}}}function $t(e,t,n){if(n===null)e.removeAttribute(t);else{switch(typeof n){case`undefined`:case`function`:case`symbol`:case`boolean`:e.removeAttribute(t);return}e.setAttribute(t,n)}}function en(e,t,n,r){if(r===null)e.removeAttribute(n);else{switch(typeof r){case`undefined`:case`function`:case`symbol`:case`boolean`:e.removeAttribute(n);return}e.setAttributeNS(t,n,r)}}function tn(e){switch(typeof e){case`bigint`:case`boolean`:case`number`:case`string`:case`undefined`:return e;case`object`:return e;default:return``}}function F(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()===`input`&&(t===`checkbox`||t===`radio`)}function nn(e,t,n){var r=Object.getOwnPropertyDescriptor(e.constructor.prototype,t);if(!e.hasOwnProperty(t)&&r!==void 0&&typeof r.get==`function`&&typeof r.set==`function`){var i=r.get,a=r.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return i.call(this)},set:function(e){n=``+e,a.call(this,e)}}),Object.defineProperty(e,t,{enumerable:r.enumerable}),{getValue:function(){return n},setValue:function(e){n=``+e},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function rn(e){if(!e._valueTracker){var t=F(e)?`checked`:`value`;e._valueTracker=nn(e,t,``+e[t])}}function an(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r=``;return e&&(r=F(e)?e.checked?`true`:`false`:e.value),e=r,e!==n&&(t.setValue(e),!0)}var I=/[\n"\\]/g;function on(e){return e.replace(I,function(e){return`\\`+e.charCodeAt(0).toString(16)+` `})}function sn(e,t,n,r,i,a,o,s){e.name=``,o!=null&&typeof o!=`function`&&typeof o!=`symbol`&&typeof o!=`boolean`?e.type=o:e.removeAttribute(`type`),t==null?o!==`submit`&&o!==`reset`||e.removeAttribute(`value`):o===`number`?(t===0&&e.value===``||e.value!=t)&&(e.value=``+tn(t)):e.value!==``+tn(t)&&(e.value=``+tn(t)),t==null?n==null?r!=null&&e.removeAttribute(`value`):ln(e,tn(n)):o===`number`&&e.value==t?ln(e,tn(e.value)):ln(e,tn(t)),i==null&&a!=null&&(e.defaultChecked=!!a),i!=null&&(e.checked=i&&typeof i!=`function`&&typeof i!=`symbol`),s!=null&&typeof s!=`function`&&typeof s!=`symbol`&&typeof s!=`boolean`?e.name=``+tn(s):e.removeAttribute(`name`)}function cn(e,t,n,r,i,a,o,s){if(a!=null&&typeof a!=`function`&&typeof a!=`symbol`&&typeof a!=`boolean`&&(e.type=a),t!=null||n!=null){if(!(a!==`submit`&&a!==`reset`||t!=null)){rn(e);return}n=n==null?``:``+tn(n),t=t==null?n:``+tn(t),s||t===e.value||(e.value=t),e.defaultValue=t}r??=i,r=typeof r!=`function`&&typeof r!=`symbol`&&!!r,e.checked=s?e.checked:!!r,e.defaultChecked=!!r,o!=null&&typeof o!=`function`&&typeof o!=`symbol`&&typeof o!=`boolean`&&(e.name=o),rn(e)}function ln(e,t){e.defaultValue!==``+t&&(e.defaultValue=``+t)}function un(e,t,n,r){if(e=e.options,t){t={};for(var i=0;i<n.length;i++)t[`$`+n[i]]=!0;for(n=0;n<e.length;n++)i=t.hasOwnProperty(`$`+e[n].value),e[n].selected!==i&&(e[n].selected=i),i&&r&&(e[n].defaultSelected=!0)}else{for(n=``+tn(n),t=null,i=0;i<e.length;i++){if(e[i].value===n){e[i].selected=!0,r&&(e[i].defaultSelected=!0);return}t!==null||e[i].disabled||(t=e[i])}t!==null&&(t.selected=!0)}}function dn(e,t,n){t!=null&&(t=``+tn(t),t!==e.value&&(e.value=t),n==null)?e.defaultValue!==t&&(e.defaultValue=t):e.defaultValue=n==null?``:``+tn(n)}function fn(e,t,n,r){if(t==null){if(r!=null){if(n!=null)throw Error(s(92));if(be(r)){if(1<r.length)throw Error(s(93));r=r[0]}n=r}n??=``,t=n}n=tn(t),e.defaultValue=n,r=e.textContent,r===n&&r!==``&&r!==null&&(e.value=r),rn(e)}function pn(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var mn=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 hn(e,t,n){var r=t.indexOf(`--`)===0;n==null||typeof n==`boolean`||n===``?r?e.setProperty(t,``):t===`float`?e.cssFloat=``:e[t]=``:r?e.setProperty(t,n):typeof n!=`number`||n===0||mn.has(t)?t===`float`?e.cssFloat=n:e[t]=(``+n).trim():e[t]=n+`px`}function gn(e,t,n){if(t!=null&&typeof t!=`object`)throw Error(s(62));if(e=e.style,n!=null){for(var r in n)!n.hasOwnProperty(r)||t!=null&&t.hasOwnProperty(r)||(r.indexOf(`--`)===0?e.setProperty(r,``):r===`float`?e.cssFloat=``:e[r]=``,P=!0);for(var i in t)r=t[i],t.hasOwnProperty(i)&&n[i]!==r&&(hn(e,i,r),P=!0)}else for(var a in t)t.hasOwnProperty(a)&&hn(e,a,t[a])}function _n(e){if(e.indexOf(`-`)===-1)return!1;switch(e){case`annotation-xml`:case`color-profile`:case`font-face`:case`font-face-src`:case`font-face-uri`:case`font-face-format`:case`font-face-name`:case`missing-glyph`:return!1;default:return!0}}var vn=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`]]),yn=/^[\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 bn(e){return yn.test(``+e)?`javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')`:e}function xn(){}var Sn=null;function Cn(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var wn=null,Tn=null;function En(e){var t=Rt(e);if(t&&(e=t.stateNode)){var n=e[kt]||null;a:switch(e=t.stateNode,t.type){case`input`:if(sn(e,n.value,n.defaultValue,n.defaultValue,n.checked,n.defaultChecked,n.type,n.name),t=n.name,n.type===`radio`&&t!=null){for(n=e;n.parentNode;)n=n.parentNode;for(n=n.querySelectorAll(`input[name="`+on(``+t)+`"][type="radio"]`),t=0;t<n.length;t++){var r=n[t];if(r!==e&&r.form===e.form){var i=r[kt]||null;if(!i)throw Error(s(90));sn(r,i.value,i.defaultValue,i.defaultValue,i.checked,i.defaultChecked,i.type,i.name)}}for(t=0;t<n.length;t++)r=n[t],r.form===e.form&&an(r)}break a;case`textarea`:dn(e,n.value,n.defaultValue);break a;case`select`:t=n.value,t!=null&&un(e,!!n.multiple,t,!1)}}}var Dn=!1;function On(e,t,n){if(Dn)return e(t,n);Dn=!0;try{return e(t)}finally{if(Dn=!1,(wn!==null||Tn!==null)&&(zd(),wn&&(t=wn,e=Tn,Tn=wn=null,En(t),e)))for(t=0;t<e.length;t++)En(e[t])}}function kn(e,t){var n=e.stateNode;if(n===null)return null;var r=n[kt]||null;if(r===null)return null;n=r[t];a:switch(t){case`onClick`:case`onClickCapture`:case`onDoubleClick`:case`onDoubleClickCapture`:case`onMouseDown`:case`onMouseDownCapture`:case`onMouseMove`:case`onMouseMoveCapture`:case`onMouseUp`:case`onMouseUpCapture`:case`onMouseEnter`:(r=!r.disabled)||(e=e.type,r=e!==`button`&&e!==`input`&&e!==`select`&&e!==`textarea`),e=!r;break a;default:e=!1}if(e)return null;if(n&&typeof n!=`function`)throw Error(s(231,t,typeof n));return n}var An=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0,jn=!1;if(An)try{var Mn={};Object.defineProperty(Mn,"passive",{get:function(){jn=!0}}),window.addEventListener(`test`,Mn,Mn),window.removeEventListener(`test`,Mn,Mn)}catch{jn=!1}var Nn=null,Pn=null,Fn=null;function In(){if(Fn)return Fn;var e,t=Pn,n=t.length,r,i=`value`in Nn?Nn.value:Nn.textContent,a=i.length;for(e=0;e<n&&t[e]===i[e];e++);var o=n-e;for(r=1;r<=o&&t[n-r]===i[a-r];r++);return Fn=i.slice(e,1<r?1-r:void 0)}function Ln(e){var t=e.keyCode;return`charCode`in e?(e=e.charCode,e===0&&t===13&&(e=13)):e=t,e===10&&(e=13),32<=e||e===13?e:0}function Rn(){return!0}function zn(){return!1}function Bn(e){function t(t,n,r,i,a){for(var o in this._reactName=t,this._targetInst=r,this.type=n,this.nativeEvent=i,this.target=a,this.currentTarget=null,e)e.hasOwnProperty(o)&&(t=e[o],this[o]=t?t(i):i[o]);return this.isDefaultPrevented=(i.defaultPrevented==null?!1===i.returnValue:i.defaultPrevented)?Rn:zn,this.isPropagationStopped=zn,this}return E(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var e=this.nativeEvent;e&&(e.preventDefault?e.preventDefault():typeof e.returnValue!=`unknown`&&(e.returnValue=!1),this.isDefaultPrevented=Rn)},stopPropagation:function(){var e=this.nativeEvent;e&&(e.stopPropagation?e.stopPropagation():typeof e.cancelBubble!=`unknown`&&(e.cancelBubble=!0),this.isPropagationStopped=Rn)},persist:function(){},isPersistent:Rn}),t}var Vn={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Hn=Bn(Vn),Un=E({},Vn,{view:0,detail:0}),Wn=Bn(Un),Gn,Kn,qn,Jn=E({},Un,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:ar,button:0,buttons:0,relatedTarget:function(e){return e.relatedTarget===void 0?e.fromElement===e.srcElement?e.toElement:e.fromElement:e.relatedTarget},movementX:function(e){return`movementX`in e?e.movementX:(e!==qn&&(qn&&e.type===`mousemove`?(Gn=e.screenX-qn.screenX,Kn=e.screenY-qn.screenY):Kn=Gn=0,qn=e),Gn)},movementY:function(e){return`movementY`in e?e.movementY:Kn}}),Yn=Bn(Jn),Xn=Bn(E({},Jn,{dataTransfer:0})),Zn=Bn(E({},Un,{relatedTarget:0})),Qn=Bn(E({},Vn,{animationName:0,elapsedTime:0,pseudoElement:0})),$n=Bn(E({},Vn,{clipboardData:function(e){return`clipboardData`in e?e.clipboardData:window.clipboardData}})),er=Bn(E({},Vn,{data:0})),tr={Esc:`Escape`,Spacebar:` `,Left:`ArrowLeft`,Up:`ArrowUp`,Right:`ArrowRight`,Down:`ArrowDown`,Del:`Delete`,Win:`OS`,Menu:`ContextMenu`,Apps:`ContextMenu`,Scroll:`ScrollLock`,MozPrintableKey:`Unidentified`},nr={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`},rr={Alt:`altKey`,Control:`ctrlKey`,Meta:`metaKey`,Shift:`shiftKey`};function ir(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=rr[e])?!!t[e]:!1}function ar(){return ir}var or=Bn(E({},Un,{key:function(e){if(e.key){var t=tr[e.key]||e.key;if(t!==`Unidentified`)return t}return e.type===`keypress`?(e=Ln(e),e===13?`Enter`:String.fromCharCode(e)):e.type===`keydown`||e.type===`keyup`?nr[e.keyCode]||`Unidentified`:``},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:ar,charCode:function(e){return e.type===`keypress`?Ln(e):0},keyCode:function(e){return e.type===`keydown`||e.type===`keyup`?e.keyCode:0},which:function(e){return e.type===`keypress`?Ln(e):e.type===`keydown`||e.type===`keyup`?e.keyCode:0}})),sr=Bn(E({},Jn,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0})),cr=Bn(E({},Vn,{submitter:0})),lr=Bn(E({},Un,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:ar})),ur=Bn(E({},Vn,{propertyName:0,elapsedTime:0,pseudoElement:0})),dr=Bn(E({},Jn,{deltaX:function(e){return`deltaX`in e?e.deltaX:`wheelDeltaX`in e?-e.wheelDeltaX:0},deltaY:function(e){return`deltaY`in e?e.deltaY:`wheelDeltaY`in e?-e.wheelDeltaY:`wheelDelta`in e?-e.wheelDelta:0},deltaZ:0,deltaMode:0})),fr=Bn(E({},Vn,{newState:0,oldState:0,source:0})),pr=[9,13,27,32],mr=An&&`CompositionEvent`in window,hr=null;An&&`documentMode`in document&&(hr=document.documentMode);var gr=An&&`TextEvent`in window&&!hr,_r=An&&(!mr||hr&&8<hr&&11>=hr),vr=` `,yr=!1;function br(e,t){switch(e){case`keyup`:return pr.indexOf(t.keyCode)!==-1;case`keydown`:return t.keyCode!==229;case`keypress`:case`mousedown`:case`focusout`:return!0;default:return!1}}function xr(e){return e=e.detail,typeof e==`object`&&`data`in e?e.data:null}var Sr=!1;function Cr(e,t){switch(e){case`compositionend`:return xr(t);case`keypress`:return t.which===32?(yr=!0,vr):null;case`textInput`:return e=t.data,e===vr&&yr?null:e;default:return null}}function wr(e,t){if(Sr)return e===`compositionend`||!mr&&br(e,t)?(e=In(),Fn=Pn=Nn=null,Sr=!1,e):null;switch(e){case`paste`:return null;case`keypress`:if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1<t.char.length)return t.char;if(t.which)return String.fromCharCode(t.which)}return null;case`compositionend`:return _r&&t.locale!==`ko`?null:t.data;default:return null}}var Tr={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 Er(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t===`input`?!!Tr[e.type]:t===`textarea`}function Dr(e,t,n,r){wn?Tn?Tn.push(r):Tn=[r]:wn=r,t=Jf(t,`onChange`),0<t.length&&(n=new Hn(`onChange`,`change`,null,n,r),e.push({event:n,listeners:t}))}var Or=null,kr=null;function Ar(e){Vf(e,0)}function jr(e){if(an(zt(e)))return e}function Mr(e,t){if(e===`change`)return t}var Nr=!1;if(An){var Pr;if(An){var Fr=`oninput`in document;if(!Fr){var Ir=document.createElement(`div`);Ir.setAttribute(`oninput`,`return;`),Fr=typeof Ir.oninput==`function`}Pr=Fr}else Pr=!1;Nr=Pr&&(!document.documentMode||9<document.documentMode)}function Lr(){Or&&(Or.detachEvent(`onpropertychange`,Rr),kr=Or=null)}function Rr(e){if(e.propertyName===`value`&&jr(kr)){var t=[];Dr(t,kr,e,Cn(e)),On(Ar,t)}}function zr(e,t,n){e===`focusin`?(Lr(),Or=t,kr=n,Or.attachEvent(`onpropertychange`,Rr)):e===`focusout`&&Lr()}function Br(e){if(e===`selectionchange`||e===`keyup`||e===`keydown`)return jr(kr)}function Vr(e,t){if(e===`click`)return jr(t)}function Hr(e,t){if(e===`input`||e===`change`)return jr(t)}function Ur(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var Wr=typeof Object.is==`function`?Object.is:Ur;function Gr(e,t){if(Wr(e,t))return!0;if(typeof e!=`object`||!e||typeof t!=`object`||!t)return!1;var n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(r=0;r<n.length;r++){var i=n[r];if(!He.call(t,i)||!Wr(e[i],t[i]))return!1}return!0}function Kr(e){if(e||=typeof document<`u`?document:void 0,e===void 0)return null;try{return e.activeElement||e.body}catch{return e.body}}function qr(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function Jr(e,t){var n=qr(e);e=0;for(var r;n;){if(n.nodeType===3){if(r=e+n.textContent.length,e<=t&&r>=t)return{node:n,offset:t-e};e=r}a:{for(;n;){if(n.nextSibling){n=n.nextSibling;break a}n=n.parentNode}n=void 0}n=qr(n)}}function Yr(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Yr(e,t.parentNode):`contains`in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Xr(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=Kr(e.document);t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href==`string`}catch{n=!1}if(n)e=t.contentWindow;else break;t=Kr(e.document)}return t}function Zr(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t===`input`&&(e.type===`text`||e.type===`search`||e.type===`tel`||e.type===`url`||e.type===`password`)||t===`textarea`||e.contentEditable===`true`)}var Qr=An&&`documentMode`in document&&11>=document.documentMode,$r=null,ei=null,ti=null,ni=!1;function ri(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;ni||$r==null||$r!==Kr(r)||(r=$r,`selectionStart`in r&&Zr(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),ti&&Gr(ti,r)||(ti=r,r=Jf(ei,`onSelect`),0<r.length&&(t=new Hn(`onSelect`,`select`,null,t,n),e.push({event:t,listeners:r}),t.target=$r)))}function ii(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n[`Webkit`+e]=`webkit`+t,n[`Moz`+e]=`moz`+t,n}var ai={animationend:ii(`Animation`,`AnimationEnd`),animationiteration:ii(`Animation`,`AnimationIteration`),animationstart:ii(`Animation`,`AnimationStart`),transitionrun:ii(`Transition`,`TransitionRun`),transitionstart:ii(`Transition`,`TransitionStart`),transitioncancel:ii(`Transition`,`TransitionCancel`),transitionend:ii(`Transition`,`TransitionEnd`)},oi={},si={};An&&(si=document.createElement(`div`).style,`AnimationEvent`in window||(delete ai.animationend.animation,delete ai.animationiteration.animation,delete ai.animationstart.animation),`TransitionEvent`in window||delete ai.transitionend.transition);function ci(e){if(oi[e])return oi[e];if(!ai[e])return e;var t=ai[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in si)return oi[e]=t[n];return e}var li=ci(`animationend`),ui=ci(`animationiteration`),di=ci(`animationstart`),L=ci(`transitionrun`),fi=ci(`transitionstart`),pi=ci(`transitioncancel`),mi=ci(`transitionend`),hi=new Map,gi=`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(` `);gi.push(`scrollEnd`);function _i(e,t){hi.set(e,t),Gt(t,[e])}var vi=0;function yi(e,t){if(e.name!=null&&e.name!==`auto`)return e.name;if(t.autoName!==null)return t.autoName;e=bd.identifierPrefix;var n=vi++;return e=`_`+e+`t_`+n.toString(32)+`_`,t.autoName=e}function bi(e){if(e==null||typeof e==`string`)return e;var t=null,n=Od;if(n!==null)for(var r=0;r<n.length;r++){var i=e[n[r]];if(i!=null){if(i===`none`)return`none`;t=t==null?i:t+(` `+i)}}return t??e.default}function xi(e,t){return e=bi(e),t=bi(t),t==null?e===`auto`?null:e:t===`auto`?null:t}var Si=typeof reportError==`function`?reportError:function(e){if(typeof window==`object`&&typeof window.ErrorEvent==`function`){var t=new window.ErrorEvent(`error`,{bubbles:!0,cancelable:!0,message:typeof e==`object`&&e&&typeof e.message==`string`?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if(typeof process==`object`&&typeof process.emit==`function`){process.emit(`uncaughtException`,e);return}console.error(e)},R=[],Ci=0,wi=0;function Ti(){for(var e=Ci,t=wi=Ci=0;t<e;){var n=R[t];R[t++]=null;var r=R[t];R[t++]=null;var i=R[t];R[t++]=null;var a=R[t];if(R[t++]=null,r!==null&&i!==null){var o=r.pending;o===null?i.next=i:(i.next=o.next,o.next=i),r.pending=i}a!==0&&ki(n,i,a)}}function Ei(e,t,n,r){R[Ci++]=e,R[Ci++]=t,R[Ci++]=n,R[Ci++]=r,wi|=r,e.lanes|=r,e=e.alternate,e!==null&&(e.lanes|=r)}function Di(e,t,n,r){return Ei(e,t,n,r),Ai(e)}function Oi(e,t){return Ei(e,null,null,t),Ai(e)}function ki(e,t,n){e.lanes|=n;var r=e.alternate;r!==null&&(r.lanes|=n);for(var i=!1,a=e.return;a!==null;)a.childLanes|=n,r=a.alternate,r!==null&&(r.childLanes|=n),a.tag===22&&(e=a.stateNode,e===null||e._visibility&1||(i=!0)),e=a,a=a.return;return e.tag===3?(a=e.stateNode,i&&t!==null&&(i=31-at(n),e=a.hiddenUpdates,r=e[i],r===null?e[i]=[t]:r.push(t),t.lane=n|536870912),a):null}function Ai(e){if(50<kd)throw kd=0,Ad=null,Error(s(185));for(var t=e.return;t!==null;)e=t,t=e.return;return e.tag===3?e.stateNode:null}var ji={};function Mi(e,t,n,r){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Ni(e,t,n,r){return new Mi(e,t,n,r)}function Pi(e){return e=e.prototype,!(!e||!e.isReactComponent)}function Fi(e,t){var n=e.alternate;return n===null?(n=Ni(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&1206910976,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n.refCleanup=e.refCleanup,n}function Ii(e,t){e.flags&=1206910978;var n=e.alternate;return n===null?(e.childLanes=0,e.lanes=t,e.child=null,e.subtreeFlags=0,e.memoizedProps=null,e.memoizedState=null,e.updateQueue=null,e.dependencies=null,e.stateNode=null):(e.childLanes=n.childLanes,e.lanes=n.lanes,e.child=n.child,e.subtreeFlags=0,e.deletions=null,e.memoizedProps=n.memoizedProps,e.memoizedState=n.memoizedState,e.updateQueue=n.updateQueue,e.type=n.type,t=n.dependencies,e.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext}),e}function Li(e,t,n,r,i,a){var o=0;if(r=e,typeof r==`function`)Pi(r)&&(o=1);else if(typeof r==`string`)o=qm(e,n,De.current)?26:e===`html`||e===`head`||e===`body`?27:5;else a:switch(r){case de:return e=Ni(31,n,t,i),e.elementType=de,e.lanes=a,e;case O:return Ri(n.children,i,a,t);case re:o=8,i|=24;break;case k:return e=Ni(12,n,t,i|2),e.elementType=k,e.lanes=a,e;case se:return e=Ni(13,n,t,i),e.elementType=se,e.lanes=a,e;case ce:return e=Ni(19,n,t,i),e.elementType=ce,e.lanes=a,e;case fe:case me:return e=i|32,e=Ni(30,n,t,e),e.elementType=me,e.lanes=a,e.stateNode={autoName:null,paired:null,clones:null,ref:null},e;default:if(typeof r==`object`&&r)switch(r.$$typeof){case ae:o=10;break a;case ie:o=9;break a;case oe:o=11;break a;case le:o=14;break a;case ue:o=16,r=null;break a}o=29,n=Error(s(130,e===null?`null`:typeof e,``)),r=null}return t=Ni(o,n,t,i),t.elementType=e,t.type=r,t.lanes=a,t}function Ri(e,t,n,r){return e=Ni(7,e,r,t),e.lanes=n,e}function zi(e,t,n){return e=Ni(6,e,null,t),e.lanes=n,e}function Bi(e){var t=Ni(18,null,null,0);return t.stateNode=e,t}function Vi(e,t,n){return t=Ni(4,e.children===null?[]:e.children,e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}var Hi=new WeakMap;function Ui(e,t){if(typeof e==`object`&&e){var n=Hi.get(e);return n===void 0?(t={value:e,source:t,stack:Ve(t)},Hi.set(e,t),t):n}return{value:e,source:t,stack:Ve(t)}}var Wi=[],Gi=0,Ki=null,qi=0,Ji=[],Yi=0,Xi=null,Zi=1,Qi=``;function $i(e,t){Wi[Gi++]=qi,Wi[Gi++]=Ki,Ki=e,qi=t}function ea(e,t,n){Ji[Yi++]=Zi,Ji[Yi++]=Qi,Ji[Yi++]=Xi,Xi=e;var r=Zi;e=Qi;var i=32-at(r)-1;r&=~(1<<i),n+=1;var a=32-at(t)+i;if(30<a){var o=i-i%5;a=(r&(1<<o)-1).toString(32),r>>=o,i-=o,Zi=1<<32-at(t)+i|n<<i|r,Qi=a+e}else Zi=1<<a|n<<i|r,Qi=e}function ta(e){e.return!==null&&($i(e,1),ea(e,1,0))}function na(e){for(;e===Ki;)Ki=Wi[--Gi],Wi[Gi]=null,qi=Wi[--Gi],Wi[Gi]=null;for(;e===Xi;)Xi=Ji[--Yi],Ji[Yi]=null,Qi=Ji[--Yi],Ji[Yi]=null,Zi=Ji[--Yi],Ji[Yi]=null}function ra(e,t){Ji[Yi++]=Zi,Ji[Yi++]=Qi,Ji[Yi++]=Xi,Zi=t.id,Qi=t.overflow,Xi=e}var ia=null,aa=null,z=!1,oa=null,sa=!1,ca=Error(s(519));function la(e){throw ha(Ui(Error(s(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?`text`:`HTML`,``)),e)),ca}function ua(e){var t=e.stateNode,n=e.type,r=e.memoizedProps;switch(t[Ot]=e,t[kt]=r,n){case`dialog`:Q(`cancel`,t),Q(`close`,t);break;case`iframe`:case`object`:case`embed`:Q(`load`,t);break;case`video`:case`audio`:for(n=0;n<zf.length;n++)Q(zf[n],t);break;case`source`:Q(`error`,t);break;case`img`:case`image`:case`link`:Q(`error`,t),Q(`load`,t);break;case`details`:Q(`toggle`,t);break;case`input`:Q(`invalid`,t),cn(t,r.value,r.defaultValue,r.checked,r.defaultChecked,r.type,r.name,!0);break;case`select`:Q(`invalid`,t);break;case`textarea`:Q(`invalid`,t),fn(t,r.value,r.defaultValue,r.children)}n=r.children,typeof n!=`string`&&typeof n!=`number`&&typeof n!=`bigint`||t.textContent===``+n||!0===r.suppressHydrationWarning||ep(t.textContent,n)?(r.popover!=null&&(Q(`beforetoggle`,t),Q(`toggle`,t)),r.onScroll!=null&&Q(`scroll`,t),r.onScrollEnd!=null&&Q(`scrollend`,t),r.onClick!=null&&(t.onclick=xn),t=!0):t=!1,t||la(e,!0)}function da(e){for(ia=e.return;ia;)switch(ia.tag){case 5:case 31:case 13:sa=!1;return;case 27:case 3:sa=!0;return;default:ia=ia.return}}function fa(e){if(e!==ia)return!1;if(!z)return da(e),z=!0,!1;var t=e.tag,n;if((n=t!==3&&t!==27)&&((n=t===5)&&(n=e.type,n=n===`form`||n===`button`||mp(e.type,e.memoizedProps)),n=!n),n&&aa&&la(e),da(e),t===13){if(e=e.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(s(317));aa=dm(e)}else if(t===31){if(e=e.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(s(317));aa=dm(e)}else t===27?(t=aa,Cp(e.type)?(e=um,um=null,aa=e):aa=t):aa=ia?lm(e.stateNode.nextSibling):null;return!0}function pa(){aa=ia=null,z=!1}function ma(){var e=oa;return e!==null&&(pd===null?pd=e:pd.push.apply(pd,e),oa=null),e}function ha(e){oa===null?oa=[e]:oa.push(e)}var ga=we(null),_a=null,va=null;function ya(e,t,n){Ee(ga,t._currentValue),t._currentValue=n}function ba(e){e._currentValue=ga.current,Te(ga)}function xa(e,t,n){for(;e!==null;){var r=e.alternate;if((e.childLanes&t)===t?r!==null&&(r.childLanes&t)!==t&&(r.childLanes|=t):(e.childLanes|=t,r!==null&&(r.childLanes|=t)),e===n)break;e=e.return}}function Sa(e,t,n,r){var i=e.child;for(i!==null&&(i.return=e);i!==null;){var a=i.dependencies;if(a!==null){var o=i.child;a=a.firstContext;a:for(;a!==null;){var c=a;a=i;for(var l=0;l<t.length;l++)if(c.context===t[l]){a.lanes|=n,c=a.alternate,c!==null&&(c.lanes|=n),xa(a.return,n,e),r||(o=null);break a}a=c.next}}else if(i.tag===18){if(o=i.return,o===null)throw Error(s(341));o.lanes|=n,a=o.alternate,a!==null&&(a.lanes|=n),xa(o,n,e),o=null}else i.tag===13&&i.memoizedState!==null&&i.memoizedState.dehydrated===null?(i.lanes|=n,o=i.alternate,o!==null&&(o.lanes|=n),xa(i.return,n,e),o=i.child,o=o===null?null:o.sibling):o=i.child;if(o!==null)o.return=i;else for(o=i;o!==null;){if(o===e){o=null;break}if(i=o.sibling,i!==null){i.return=o.return,o=i;break}o=o.return}i=o}}function Ca(e,t,n,r){e=null;for(var i=t,a=!1;i!==null;){if(!a){if(i.flags&524288)a=!0;else if(i.flags&262144)break}if(i.tag===10){var o=i.alternate;if(o===null)throw Error(s(387));if(o=o.memoizedProps,o!==null){var c=i.type;Wr(i.pendingProps.value,o.value)||(e===null?e=[c]:e.push(c))}}else if(i===Ae.current){if(o=i.alternate,o===null)throw Error(s(387));o.memoizedState.memoizedState!==i.memoizedState.memoizedState&&(e===null?e=[sh]:e.push(sh))}i=i.return}return e!==null&&Sa(t,e,n,r),t.flags|=262144,e!==null}function wa(e){for(e=e.firstContext;e!==null;){if(!Wr(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function Ta(e){_a=e,va=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function Ea(e){return Oa(_a,e)}function Da(e,t){return _a===null&&Ta(e),Oa(e,t)}function Oa(e,t){var n=t._currentValue;if(t={context:t,memoizedValue:n,next:null},va===null){if(e===null)throw Error(s(308));va=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else va=va.next=t;return n}var ka=typeof AbortController<`u`?AbortController:function(){var e=[],t=this.signal={aborted:!1,addEventListener:function(t,n){e.push(n)}};this.abort=function(){t.aborted=!0,e.forEach(function(e){return e()})}},Aa=t.unstable_scheduleCallback,ja=t.unstable_NormalPriority,Ma={$$typeof:ae,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Na(){return{controller:new ka,data:new Map,refCount:0}}function Pa(e){e.refCount--,e.refCount===0&&Aa(ja,function(){e.controller.abort()})}function Fa(e,t){if(e.pendingLanes&4194048){var n=e.transitionTypes;for(n===null&&(n=e.transitionTypes=[]),e=0;e<t.length;e++){var r=t[e];n.indexOf(r)===-1&&n.push(r)}}}var Ia=null;function La(e){var t=e.transitionTypes;return e.transitionTypes=null,t}var Ra=null,za=0,Ba=0,Va=null;function Ha(e,t){if(Ra===null){var n=Ra=[];za=0,Ba=Pf(),Va={status:`pending`,value:void 0,then:function(e){n.push(e)}}}return za++,t.then(Ua,Ua),t}function Ua(){if(--za===0&&(Ia=null,Ra!==null)){Va!==null&&(Va.status=`fulfilled`);var e=Ra;Ra=null,Ba=0,Va=null;for(var t=0;t<e.length;t++)(0,e[t])()}}function Wa(e,t){var n=[],r={status:`pending`,value:null,reason:null,then:function(e){n.push(e)}};return e.then(function(){r.status=`fulfilled`,r.value=t;for(var e=0;e<n.length;e++)(0,n[e])(t)},function(e){for(r.status=`rejected`,r.reason=e,e=0;e<n.length;e++)(0,n[e])(void 0)}),r}var Ga=A.S;A.S=function(e,t){if(gd=qe(),typeof t==`object`&&t&&typeof t.then==`function`&&Ha(e,t),Ia!==null)for(var n=bf;n!==null;)Fa(n,Ia),n=n.next;if(n=e.types,n!==null){for(var r=bf;r!==null;)Fa(r,n),r=r.next;if(Ba!==0){r=Ia,r===null&&(r=Ia=[]);for(var i=0;i<n.length;i++){var a=n[i];r.indexOf(a)===-1&&r.push(a)}}}Ga!==null&&Ga(e,t)};var Ka=we(null);function qa(){var e=Ka.current;return e===null?ed.pooledCache:e}function Ja(e,t){t===null?Ee(Ka,Ka.current):Ee(Ka,t.pool)}function Ya(){var e=qa();return e===null?null:{parent:Ma._currentValue,pool:e}}var Xa=Error(s(460)),Za=Error(s(474)),Qa=Error(s(542)),$a={then:function(){}};function eo(e){return e=e.status,e===`fulfilled`||e===`rejected`}function to(e,t,n){switch(n=e[n],n===void 0?e.push(t):n!==t&&(t.then(xn,xn),t=n),t.status){case`fulfilled`:return t.value;case`rejected`:throw e=t.reason,ao(e),e===void 0&&!(`reason`in t)?Error(s(600)):e;default:if(typeof t.status==`string`)t.then(xn,xn);else{if(e=ed,e!==null&&100<e.shellSuspendCounter)throw Error(s(482));e=t,e.status=`pending`,e.then(function(e){if(t.status===`pending`){var n=t;n.status=`fulfilled`,n.value=e}},function(e){if(t.status===`pending`){var n=t;n.status=`rejected`,n.reason=e}})}switch(t.status){case`fulfilled`:return t.value;case`rejected`:throw e=t.reason,ao(e),e}throw ro=t,Xa}}function no(e){try{var t=e._init;return t(e._payload)}catch(e){throw typeof e==`object`&&e&&typeof e.then==`function`?(ro=e,Xa):e}}var ro=null;function io(){if(ro===null)throw Error(s(459));var e=ro;return ro=null,e}function ao(e){if(e===Xa||e===Qa)throw Error(s(483))}var oo=null,so=0;function co(e){var t=so;return so+=1,oo===null&&(oo=[]),to(oo,e,t)}function lo(e,t){t=t.props.ref,e.ref=t===void 0?null:t}function uo(e,t){throw t.$$typeof===te?Error(s(525)):(e=Object.prototype.toString.call(t),Error(s(31,e===`[object Object]`?`object with keys {`+Object.keys(t).join(`, `)+`}`:e)))}function fo(e){function t(t,n){if(e){var r=t.deletions;r===null?(t.deletions=[n],t.flags|=16):r.push(n)}}function n(n,r){if(!e)return null;for(;r!==null;)t(n,r),r=r.sibling;return null}function r(e){for(var t=new Map;e!==null;)e.key===null?t.set(e.index,e):t.set(e.key,e),e=e.sibling;return t}function i(e,t){return e=Fi(e,t),e.index=0,e.sibling=null,e}function a(t,n,r){return t.index=r,e?(r=t.alternate,r===null?(t.flags|=134217730,n):(r=r.index,r<n?(t.flags|=2,n):r)):(t.flags|=1048576,n)}function o(t){return e&&t.alternate===null&&(t.flags|=134217730),t}function c(e,t,n,r){return t===null||t.tag!==6?(t=zi(n,e.mode,r),t.return=e,t):(t=i(t,n),t.return=e,t)}function l(e,t,n,r){var a=n.type;return a===O?(e=d(e,t,n.props.children,r,n.key),lo(e,n),e):t!==null&&(t.elementType===a||typeof a==`object`&&a&&a.$$typeof===ue&&no(a)===t.type)?(t=i(t,n.props),lo(t,n),t.return=e,t):(t=Li(n.type,n.key,n.props,null,e.mode,r),lo(t,n),t.return=e,t)}function u(e,t,n,r){return t===null||t.tag!==4||t.stateNode.containerInfo!==n.containerInfo||t.stateNode.implementation!==n.implementation?(t=Vi(n,e.mode,r),t.return=e,t):(t=i(t,n.children||[]),t.return=e,t)}function d(e,t,n,r,a){return t===null||t.tag!==7?(t=Ri(n,e.mode,r,a),t.return=e,t):(t=i(t,n),t.return=e,t)}function f(e,t,n){if(typeof t==`string`&&t!==``||typeof t==`number`||typeof t==`bigint`)return t=zi(``+t,e.mode,n),t.return=e,t;if(typeof t==`object`&&t){switch(t.$$typeof){case D:return n=Li(t.type,t.key,t.props,null,e.mode,n),lo(n,t),n.return=e,n;case ne:return t=Vi(t,e.mode,n),t.return=e,t;case ue:return t=no(t),f(e,t,n)}if(be(t)||_e(t))return t=Ri(t,e.mode,n,null),t.return=e,t;if(typeof t.then==`function`)return f(e,co(t),n);if(t.$$typeof===ae)return f(e,Da(e,t),n);uo(e,t)}return null}function p(e,t,n,r){var i=t===null?null:t.key;if(typeof n==`string`&&n!==``||typeof n==`number`||typeof n==`bigint`)return i===null?c(e,t,``+n,r):null;if(typeof n==`object`&&n){switch(n.$$typeof){case D:return n.key===i?l(e,t,n,r):null;case ne:return n.key===i?u(e,t,n,r):null;case ue:return n=no(n),p(e,t,n,r)}if(be(n)||_e(n))return i===null?d(e,t,n,r,null):null;if(typeof n.then==`function`)return p(e,t,co(n),r);if(n.$$typeof===ae)return p(e,t,Da(e,n),r);uo(e,n)}return null}function m(e,t,n,r,i){if(typeof r==`string`&&r!==``||typeof r==`number`||typeof r==`bigint`)return e=e.get(n)||null,c(t,e,``+r,i);if(typeof r==`object`&&r){switch(r.$$typeof){case D:return e=e.get(r.key===null?n:r.key)||null,l(t,e,r,i);case ne:return e=e.get(r.key===null?n:r.key)||null,u(t,e,r,i);case ue:return r=no(r),m(e,t,n,r,i)}if(be(r)||_e(r))return e=e.get(n)||null,d(t,e,r,i,null);if(typeof r.then==`function`)return m(e,t,n,co(r),i);if(r.$$typeof===ae)return m(e,t,n,Da(t,r),i);uo(t,r)}return null}function h(i,o,s,c){for(var l=null,u=null,d=o,h=o=0,g=null;d!==null&&h<s.length;h++){d.index>h?(g=d,d=null):g=d.sibling;var _=p(i,d,s[h],c);if(_===null){d===null&&(d=g);break}e&&d&&_.alternate===null&&t(i,d),o=a(_,o,h),u===null?l=_:u.sibling=_,u=_,d=g}if(h===s.length)return n(i,d),z&&$i(i,h),l;if(d===null){for(;h<s.length;h++)d=f(i,s[h],c),d!==null&&(o=a(d,o,h),u===null?l=d:u.sibling=d,u=d);return z&&$i(i,h),l}for(d=r(d);h<s.length;h++)g=m(d,i,h,s[h],c),g!==null&&(e&&(_=g.alternate,_!==null&&d.delete(_.key===null?h:_.key)),o=a(g,o,h),u===null?l=g:u.sibling=g,u=g);return e&&d.forEach(function(e){return t(i,e)}),z&&$i(i,h),l}function g(i,o,c,l){if(c==null)throw Error(s(151));for(var u=null,d=null,h=o,g=o=0,_=null,v=c.next();h!==null&&!v.done;g++,v=c.next()){h.index>g?(_=h,h=null):_=h.sibling;var y=p(i,h,v.value,l);if(y===null){h===null&&(h=_);break}e&&h&&y.alternate===null&&t(i,h),o=a(y,o,g),d===null?u=y:d.sibling=y,d=y,h=_}if(v.done)return n(i,h),z&&$i(i,g),u;if(h===null){for(;!v.done;g++,v=c.next())v=f(i,v.value,l),v!==null&&(o=a(v,o,g),d===null?u=v:d.sibling=v,d=v);return z&&$i(i,g),u}for(h=r(h);!v.done;g++,v=c.next())v=m(h,i,g,v.value,l),v!==null&&(e&&(_=v.alternate,_!==null&&h.delete(_.key===null?g:_.key)),o=a(v,o,g),d===null?u=v:d.sibling=v,d=v);return e&&h.forEach(function(e){return t(i,e)}),z&&$i(i,g),u}function _(e,r,a,c){if(typeof a==`object`&&a&&a.type===O&&a.key===null&&a.props.ref===void 0&&(a=a.props.children),typeof a==`object`&&a){switch(a.$$typeof){case D:a:{for(var l=a.key;r!==null;){if(r.key===l){if(l=a.type,l===O){if(r.tag===7){n(e,r.sibling),c=i(r,a.props.children),lo(c,a),c.return=e,e=c;break a}}else if(r.elementType===l||typeof l==`object`&&l&&l.$$typeof===ue&&no(l)===r.type){n(e,r.sibling),c=i(r,a.props),lo(c,a),c.return=e,e=c;break a}n(e,r);break}t(e,r),r=r.sibling}a.type===O?(c=Ri(a.props.children,e.mode,c,a.key),lo(c,a),c.return=e,e=c):(c=Li(a.type,a.key,a.props,null,e.mode,c),lo(c,a),c.return=e,e=c)}return o(e);case ne:a:{for(l=a.key;r!==null;){if(r.key===l){if(r.tag===4&&r.stateNode.containerInfo===a.containerInfo&&r.stateNode.implementation===a.implementation){n(e,r.sibling),c=i(r,a.children||[]),c.return=e,e=c;break a}n(e,r);break}t(e,r),r=r.sibling}c=Vi(a,e.mode,c),c.return=e,e=c}return o(e);case ue:return a=no(a),_(e,r,a,c)}if(be(a))return h(e,r,a,c);if(_e(a)){if(l=_e(a),typeof l!=`function`)throw Error(s(150));return a=l.call(a),g(e,r,a,c)}if(typeof a.then==`function`)return _(e,r,co(a),c);if(a.$$typeof===ae)return _(e,r,Da(e,a),c);uo(e,a)}return typeof a==`string`&&a!==``||typeof a==`number`||typeof a==`bigint`?(a=``+a,r!==null&&r.tag===6?(n(e,r.sibling),c=i(r,a),c.return=e,e=c):(n(e,r),c=zi(a,e.mode,c),c.return=e,e=c),o(e)):n(e,r)}return function(e,t,n,r){try{so=0;var i=_(e,t,n,r);return oo=null,i}catch(t){if(t===Xa||t===Qa)throw t;var a=Ni(29,t,null,e.mode);return a.lanes=r,a.return=e,a}}}var po=fo(!0),mo=fo(!1),ho=!1;function go(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function _o(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,callbacks:null})}function vo(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function yo(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,K&2){var i=r.pending;return i===null?t.next=t:(t.next=i.next,i.next=t),r.pending=t,t=Ai(e),ki(e,null,n),t}return Ei(e,r,t,n),Ai(e)}function bo(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,n&4194048)){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,xt(e,n)}}function xo(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var i=null,a=null;if(n=n.firstBaseUpdate,n!==null){do{var o={lane:n.lane,tag:n.tag,payload:n.payload,callback:null,next:null};a===null?i=a=o:a=a.next=o,n=n.next}while(n!==null);a===null?i=a=t:a=a.next=t}else i=a=t;n={baseState:r.baseState,firstBaseUpdate:i,lastBaseUpdate:a,shared:r.shared,callbacks:r.callbacks},e.updateQueue=n}else e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}var So=!1;function Co(){if(So){var e=Va;if(e!==null)throw e}}function wo(e,t,n,r){So=!1;var i=e.updateQueue;ho=!1;var a=i.firstBaseUpdate,o=i.lastBaseUpdate,s=i.shared.pending;if(s!==null){i.shared.pending=null;var c=s,l=c.next;c.next=null,o===null?a=l:o.next=l,o=c;var u=e.alternate;u!==null&&(u=u.updateQueue,s=u.lastBaseUpdate,s!==o&&(s===null?u.firstBaseUpdate=l:s.next=l,u.lastBaseUpdate=c))}if(a!==null){var d=i.baseState;o=0,u=l=c=null,s=a;do{var f=s.lane&-536870913,p=f!==s.lane;if(p?(J&f)===f:(r&f)===f){f!==0&&f===Ba&&(So=!0),u!==null&&(u=u.next={lane:0,tag:s.tag,payload:s.payload,callback:null,next:null});a:{var m=e,h=s;f=t;var g=n;switch(h.tag){case 1:if(m=h.payload,typeof m==`function`){d=m.call(g,d,f);break a}d=m;break a;case 3:m.flags=m.flags&-65537|128;case 0:if(m=h.payload,f=typeof m==`function`?m.call(g,d,f):m,f==null)break a;d=E({},d,f);break a;case 2:ho=!0}}f=s.callback,f!==null&&(e.flags|=64,p&&(e.flags|=8192),p=i.callbacks,p===null?i.callbacks=[f]:p.push(f))}else p={lane:f,tag:s.tag,payload:s.payload,callback:s.callback,next:null},u===null?(l=u=p,c=d):u=u.next=p,o|=f;if(s=s.next,s===null){if(s=i.shared.pending,s===null)break;p=s,s=p.next,p.next=null,i.lastBaseUpdate=p,i.shared.pending=null}}while(1);u===null&&(c=d),i.baseState=c,i.firstBaseUpdate=l,i.lastBaseUpdate=u,a===null&&(i.shared.lanes=0),cd|=o,e.lanes=o,e.memoizedState=d}}function To(e,t){if(typeof e!=`function`)throw Error(s(191,e));e.call(t)}function Eo(e,t){var n=e.callbacks;if(n!==null)for(e.callbacks=null,e=0;e<n.length;e++)To(n[e],t)}var Do=we(null),Oo=we(0);function ko(e,t){e=od,Ee(Oo,e),Ee(Do,t),od=e|t.baseLanes}function Ao(){Ee(Oo,od),Ee(Do,Do.current)}function jo(){od=Oo.current,Te(Do),Te(Oo)}var Mo=we(null),No=null;function Po(e){var t=e.alternate;Ee(zo,zo.current&1),Ee(Mo,e),No===null&&(t===null||Do.current!==null||t.memoizedState!==null)&&(No=e)}function Fo(e){Ee(zo,zo.current),Ee(Mo,e),No===null&&(No=e)}function Io(e){e.tag===22?(Ee(zo,zo.current),Ee(Mo,e),No===null&&(No=e)):Lo()}function Lo(){Ee(zo,zo.current),Ee(Mo,Mo.current)}function Ro(e){Te(Mo),No===e&&(No=null),Te(zo)}var zo=we(0);function Bo(e,t){Ee(Mo,Mo.current),Ee(zo,t)}function Vo(e){Te(zo),Te(Mo),No===e&&(No=null)}function Ho(e){for(var t=e;t!==null;){if(t.tag===13){var n=t.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||om(n)||sm(n)))return t}else if(t.tag===19&&t.memoizedProps.revealOrder!==`independent`){if(t.flags&128)return t}else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var Uo=0,B=null,Wo=null,Go=null,Ko=!1,qo=!1,Jo=!1,Yo=0,Xo=0,Zo=null,Qo=0;function $o(){throw Error(s(321))}function es(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!Wr(e[n],t[n]))return!1;return!0}function ts(e,t,n,r,i,a){return Uo=a,B=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,A.H=e===null||e.memoizedState===null?_c:vc,Jo=!1,a=n(r,i),Jo=!1,qo&&(a=rs(t,n,r,i)),ns(e),a}function ns(e){A.H=gc;var t=Wo!==null&&Wo.next!==null;if(Uo=0,Go=Wo=B=null,Ko=!1,Xo=0,Zo=null,t)throw Error(s(300));e===null||H||(e=e.dependencies,e!==null&&wa(e)&&(H=!0))}function rs(e,t,n,r){B=e;var i=0;do{if(qo&&(Zo=null),Xo=0,qo=!1,25<=i)throw Error(s(301));if(i+=1,Go=Wo=null,e.updateQueue!=null){var a=e.updateQueue;a.lastEffect=null,a.events=null,a.stores=null,a.memoCache!=null&&(a.memoCache.index=0)}A.H=yc,a=t(n,r)}while(qo);return a}function is(){var e=A.H,t=e.useState()[0];return t=typeof t.then==`function`?ds(t):t,e=e.useState()[0],(Wo===null?null:Wo.memoizedState)!==e&&(B.flags|=1024),t}function as(){var e=Yo!==0;return Yo=0,e}function os(e,t,n){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~n}function ss(e){if(Ko){for(e=e.memoizedState;e!==null;){var t=e.queue;t!==null&&(t.pending=null),e=e.next}Ko=!1}Uo=0,Go=Wo=B=null,qo=!1,Xo=Yo=0,Zo=null}function cs(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Go===null?B.memoizedState=Go=e:Go=Go.next=e,Go}function ls(){if(Wo===null){var e=B.alternate;e=e===null?null:e.memoizedState}else e=Wo.next;var t=Go===null?B.memoizedState:Go.next;if(t!==null)Go=t,Wo=e;else{if(e===null)throw B.alternate===null?Error(s(467)):Error(s(310));Wo=e,e={memoizedState:Wo.memoizedState,baseState:Wo.baseState,baseQueue:Wo.baseQueue,queue:Wo.queue,next:null},Go===null?B.memoizedState=Go=e:Go=Go.next=e}return Go}function us(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function ds(e){var t=Xo;return Xo+=1,Zo===null&&(Zo=[]),e=to(Zo,e,t),t=B,(Go===null?t.memoizedState:Go.next)===null&&(t=t.alternate,A.H=t===null||t.memoizedState===null?_c:vc),e}function fs(e){if(typeof e==`object`&&e){if(typeof e.then==`function`)return ds(e);if(e.$$typeof===he)return;if(e.$$typeof===ae)return Ea(e)}throw Error(s(438,String(e)))}function ps(e){var t=null,n=B.updateQueue;if(n!==null&&(t=n.memoCache),t==null){var r=B.alternate;r!==null&&(r=r.updateQueue,r!==null&&(r=r.memoCache,r!=null&&(t={data:r.data.map(function(e){return e.slice()}),index:0})))}if(t??={data:[],index:0},n===null&&(n=us(),B.updateQueue=n),n.memoCache=t,n=t.data[t.index],n===void 0)for(n=t.data[t.index]=Array(e),r=0;r<e;r++)n[r]=pe;return t.index++,n}function ms(e,t){return typeof t==`function`?t(e):t}function hs(e){return gs(ls(),Wo,e)}function gs(e,t,n){var r=e.queue;if(r===null)throw Error(s(311));r.lastRenderedReducer=n;var i=e.baseQueue,a=r.pending;if(a!==null){if(i!==null){var o=i.next;i.next=a.next,a.next=o}t.baseQueue=i=a,r.pending=null}if(a=e.baseState,i===null)e.memoizedState=a;else{t=i.next;var c=o=null,l=null,u=t,d=!1;do{var f=u.lane&-536870913;if(f===u.lane?(Uo&f)===f:(J&f)===f){var p=u.revertLane;if(p===0)l!==null&&(l=l.next={lane:0,revertLane:0,gesture:null,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null}),f===Ba&&(d=!0);else if((Uo&p)===p){u=u.next,p===Ba&&(d=!0);continue}else f={lane:0,revertLane:u.revertLane,gesture:null,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null},l===null?(c=l=f,o=a):l=l.next=f,B.lanes|=p,cd|=p;f=u.action,Jo&&n(a,f),a=u.hasEagerState?u.eagerState:n(a,f)}else p={lane:f,revertLane:u.revertLane,gesture:u.gesture,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null},l===null?(c=l=p,o=a):l=l.next=p,B.lanes|=f,cd|=f;u=u.next}while(u!==null&&u!==t);if(l===null?o=a:l.next=c,!Wr(a,e.memoizedState)&&(H=!0,d&&(n=Va,n!==null)))throw n;e.memoizedState=a,e.baseState=o,e.baseQueue=l,r.lastRenderedState=a}return i===null&&(r.lanes=0),[e.memoizedState,r.dispatch]}function _s(e){var t=ls(),n=t.queue;if(n===null)throw Error(s(311));n.lastRenderedReducer=e;var r=n.dispatch,i=n.pending,a=t.memoizedState;if(i!==null){n.pending=null;var o=i=i.next;do a=e(a,o.action),o=o.next;while(o!==i);Wr(a,t.memoizedState)||(H=!0),t.memoizedState=a,t.baseQueue===null&&(t.baseState=a),n.lastRenderedState=a}return[a,r]}function vs(e,t,n){var r=B,i=ls(),a=z;if(a){if(n===void 0)throw Error(s(407));n=n()}else n=t();var o=!Wr((Wo||i).memoizedState,n);if(o&&(i.memoizedState=n,H=!0),i=i.queue,Us(xs.bind(null,r,i,e),[e]),e=i.getSnapshot!==t||o||Go!==null&&!!(Go.memoizedState.tag&1),Rs(e?9:8,{destroy:void 0},bs.bind(null,r,i,n,t),null),e){if(r.flags|=2048,ed===null)throw Error(s(349));a||Uo&127||ys(r,t,n)}return n}function ys(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=B.updateQueue,t===null?(t=us(),B.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function bs(e,t,n,r){t.value=n,t.getSnapshot=r,Ss(t)&&Cs(e)}function xs(e,t,n){return n(function(){Ss(t)&&Cs(e)})}function Ss(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!Wr(e,n)}catch{return!0}}function Cs(e){var t=Oi(e,2);t!==null&&Pd(t,e,2)}function ws(e){var t=cs();if(typeof e==`function`){var n=e;if(e=n(),Jo){it(!0);try{n()}finally{it(!1)}}}return t.memoizedState=t.baseState=e,t.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:ms,lastRenderedState:e},t}function Ts(e,t,n,r){return e.baseState=n,gs(e,Wo,typeof r==`function`?r:ms)}function Es(e,t,n,r,i){if(pc(e))throw Error(s(485));if(e=t.action,e!==null){var a={payload:i,action:e,next:null,isTransition:!0,status:`pending`,value:null,reason:null,listeners:[],then:function(e){a.listeners.push(e)}};A.T===null?a.isTransition=!1:n(!0),r(a),n=t.pending,n===null?(a.next=t.pending=a,Ds(t,a)):(a.next=n.next,t.pending=n.next=a)}}function Ds(e,t){var n=t.action,r=t.payload,i=e.state;if(t.isTransition){var a=A.T,o={};o.types=a===null?null:a.types,A.T=o;try{var s=n(i,r),c=A.S;c!==null&&c(o,s),Os(e,t,s)}catch(n){As(e,t,n)}finally{a!==null&&o.types!==null&&(a.types=o.types),A.T=a}}else try{a=n(i,r),Os(e,t,a)}catch(n){As(e,t,n)}}function Os(e,t,n){typeof n==`object`&&n&&typeof n.then==`function`?n.then(function(n){ks(e,t,n)},function(n){return As(e,t,n)}):ks(e,t,n)}function ks(e,t,n){t.status=`fulfilled`,t.value=n,js(t),e.state=n,t=e.pending,t!==null&&(n=t.next,n===t?e.pending=null:(n=n.next,t.next=n,Ds(e,n)))}function As(e,t,n){var r=e.pending;if(e.pending=null,r!==null){r=r.next;do t.status=`rejected`,t.reason=n,js(t),t=t.next;while(t!==r)}e.action=null}function js(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function Ms(e,t){return t}function Ns(e,t){if(z){var n=ed.formState;if(n!==null){a:{var r=B;if(z){if(aa){b:{for(var i=aa,a=sa;i.nodeType!==8;)if(!a||(i=lm(i.nextSibling),i===null)){i=null;break b}a=i.data,i=a===`F!`||a===`F`?i:null}if(i){aa=lm(i.nextSibling),r=i.data===`F!`;break a}}la(r)}r=!1}r&&(t=n[0])}}return n=cs(),n.memoizedState=n.baseState=t,r={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ms,lastRenderedState:t},n.queue=r,n=V.bind(null,B,r),r.dispatch=n,r=ws(!1),a=fc.bind(null,B,!1,r.queue),r=cs(),i={state:t,dispatch:null,action:e,pending:null},r.queue=i,n=Es.bind(null,B,i,a,n),i.dispatch=n,r.memoizedState=e,[t,n,!1]}function Ps(e){return Fs(ls(),Wo,e)}function Fs(e,t,n){if(t=gs(e,t,Ms)[0],e=hs(ms)[0],typeof t==`object`&&t&&typeof t.then==`function`)try{var r=ds(t)}catch(e){throw e===Xa?Qa:e}else r=t;t=ls();var i=t.queue,a=i.dispatch;return n!==t.memoizedState&&(B.flags|=2048,Rs(9,{destroy:void 0},Is.bind(null,i,n),null)),[r,a,e]}function Is(e,t){e.action=t}function Ls(e){var t=ls(),n=Wo;if(n!==null)return Fs(t,n,e);ls(),t=t.memoizedState,n=ls();var r=n.queue.dispatch;return n.memoizedState=e,[t,r,!1]}function Rs(e,t,n,r){return e={tag:e,create:n,deps:r,inst:t,next:null},t=B.updateQueue,t===null&&(t=us(),B.updateQueue=t),n=t.lastEffect,n===null?t.lastEffect=e.next=e:(r=n.next,n.next=e,e.next=r,t.lastEffect=e),e}function zs(){return ls().memoizedState}function Bs(e,t,n,r){var i=cs();B.flags|=e,i.memoizedState=Rs(1|t,{destroy:void 0},n,r===void 0?null:r)}function Vs(e,t,n,r){var i=ls();r=r===void 0?null:r;var a=i.memoizedState.inst;Wo!==null&&r!==null&&es(r,Wo.memoizedState.deps)?i.memoizedState=Rs(t,a,n,r):(B.flags|=e,i.memoizedState=Rs(1|t,a,n,r))}function Hs(e,t){Bs(8390656,8,e,t)}function Us(e,t){Vs(2048,8,e,t)}function Ws(e){B.flags|=4;var t=B.updateQueue;if(t===null)t=us(),B.updateQueue=t,t.events=[e];else{var n=t.events;n===null?t.events=[e]:n.push(e)}}function Gs(e){var t=ls().memoizedState;return Ws({ref:t,nextImpl:e}),function(){if(K&2)throw Error(s(440));return t.impl.apply(void 0,arguments)}}function Ks(e,t){return Vs(4,2,e,t)}function qs(e,t){return Vs(4,4,e,t)}function Js(e,t){if(typeof t==`function`){e=e();var n=t(e);return function(){typeof n==`function`?n():t(null)}}if(t!=null)return e=e(),t.current=e,function(){t.current=null}}function Ys(e,t,n){n=n==null?null:n.concat([e]),Vs(4,4,Js.bind(null,t,e),n)}function Xs(){}function Zs(e,t){var n=ls();t=t===void 0?null:t;var r=n.memoizedState;return t!==null&&es(t,r[1])?r[0]:(n.memoizedState=[e,t],e)}function Qs(e,t){var n=ls();t=t===void 0?null:t;var r=n.memoizedState;if(t!==null&&es(t,r[1]))return r[0];if(r=e(),Jo){it(!0);try{e()}finally{it(!1)}}return n.memoizedState=[r,t],r}function $s(e,t,n){return n===void 0||Uo&1073741824&&!(J&261930)?e.memoizedState=t:(e.memoizedState=n,e=Md(),B.lanes|=e,cd|=e,n)}function ec(e,t,n,r){return Wr(n,t)?n:Do.current===null?!(Uo&106)||Uo&1073741824&&!(J&261930)?(H=!0,e.memoizedState=n):(e=Md(),B.lanes|=e,cd|=e,t):(e=$s(e,n,r),Wr(e,t)||(H=!0),e)}function tc(e,t,n,r,i){var a=j.p;j.p=a!==0&&8>a?a:8;var o=A.T,s={};s.types=o===null?null:o.types,A.T=s,fc(e,!1,t,n);try{var c=i(),l=A.S;l!==null&&l(s,c),typeof c==`object`&&c&&typeof c.then==`function`?dc(e,t,Wa(c,r),jd(e)):dc(e,t,r,jd(e))}catch(n){dc(e,t,{then:function(){},status:`rejected`,reason:n},jd())}finally{j.p=a,o!==null&&s.types!==null&&(o.types=s.types),A.T=o}}function nc(){}function rc(e,t,n,r){if(e.tag!==5)throw Error(s(476));var i=ic(e).queue;tc(e,i,t,xe,n===null?nc:function(){return ac(e),n(r)})}function ic(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:xe,baseState:xe,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:ms,lastRenderedState:xe},next:null};var n={};return t.next={memoizedState:n,baseState:n,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:ms,lastRenderedState:n},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function ac(e){var t=ic(e);t.next===null&&(t=e.alternate.memoizedState),dc(e,t.next.queue,{},jd())}function oc(){return Ea(sh)}function sc(){return ls().memoizedState}function cc(){return ls().memoizedState}function lc(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var n=jd();e=vo(n);var r=yo(t,e,n);r!==null&&(Pd(r,t,n),bo(r,t,n)),t={cache:Na()},e.payload=t;return}t=t.return}}function uc(e,t,n){var r=jd();n={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null},pc(e)?mc(t,n):(n=Di(e,t,n,r),n!==null&&(Pd(n,e,r),hc(n,t,r)))}function V(e,t,n){dc(e,t,n,jd())}function dc(e,t,n,r){var i={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null};if(pc(e))mc(t,i);else{var a=e.alternate;if(e.lanes===0&&(a===null||a.lanes===0)&&(a=t.lastRenderedReducer,a!==null))try{var o=t.lastRenderedState,s=a(o,n);if(i.hasEagerState=!0,i.eagerState=s,Wr(s,o))return Ei(e,t,i,0),ed===null&&Ti(),!1}catch{}if(n=Di(e,t,i,r),n!==null)return Pd(n,e,r),hc(n,t,r),!0}return!1}function fc(e,t,n,r){if(r={lane:2,revertLane:Pf(),gesture:null,action:r,hasEagerState:!1,eagerState:null,next:null},pc(e)){if(t)throw Error(s(479))}else t=Di(e,n,r,2),t!==null&&Pd(t,e,2)}function pc(e){var t=e.alternate;return e===B||t!==null&&t===B}function mc(e,t){qo=Ko=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function hc(e,t,n){if(n&4194048){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,xt(e,n)}}var gc={readContext:Ea,use:fs,useCallback:$o,useContext:$o,useEffect:$o,useImperativeHandle:$o,useLayoutEffect:$o,useInsertionEffect:$o,useMemo:$o,useReducer:$o,useRef:$o,useState:$o,useDebugValue:$o,useDeferredValue:$o,useTransition:$o,useSyncExternalStore:$o,useId:$o,useHostTransitionStatus:$o,useFormState:$o,useActionState:$o,useOptimistic:$o,useMemoCache:$o,useCacheRefresh:$o,useEffectEvent:$o},_c={readContext:Ea,use:fs,useCallback:function(e,t){return cs().memoizedState=[e,t===void 0?null:t],e},useContext:Ea,useEffect:Hs,useImperativeHandle:function(e,t,n){n=n==null?null:n.concat([e]),Bs(4194308,4,Js.bind(null,t,e),n)},useLayoutEffect:function(e,t){return Bs(4194308,4,e,t)},useInsertionEffect:function(e,t){Bs(4,2,e,t)},useMemo:function(e,t){var n=cs();t=t===void 0?null:t;var r=e();if(Jo){it(!0);try{e()}finally{it(!1)}}return n.memoizedState=[r,t],r},useReducer:function(e,t,n){var r=cs();if(n!==void 0){var i=n(t);if(Jo){it(!0);try{n(t)}finally{it(!1)}}}else i=t;return r.memoizedState=r.baseState=i,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:i},r.queue=e,e=e.dispatch=uc.bind(null,B,e),[r.memoizedState,e]},useRef:function(e){var t=cs();return e={current:e},t.memoizedState=e},useState:function(e){e=ws(e);var t=e.queue,n=V.bind(null,B,t);return t.dispatch=n,[e.memoizedState,n]},useDebugValue:Xs,useDeferredValue:function(e,t){return $s(cs(),e,t)},useTransition:function(){var e=ws(!1);return e=tc.bind(null,B,e.queue,!0,!1),cs().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,n){var r=B,i=cs();if(z){if(n===void 0)throw Error(s(407));n=n()}else{if(n=t(),ed===null)throw Error(s(349));J&127||ys(r,t,n)}i.memoizedState=n;var a={value:n,getSnapshot:t};return i.queue=a,Hs(xs.bind(null,r,a,e),[e]),r.flags|=2048,Rs(9,{destroy:void 0},bs.bind(null,r,a,n,t),null),n},useId:function(){var e=cs(),t=ed.identifierPrefix;if(z){var n=Qi,r=Zi;n=(r&~(1<<32-at(r)-1)).toString(32)+n,t=`_`+t+`R_`+n,n=Yo++,0<n&&(t+=`H`+n.toString(32)),t+=`_`}else n=Qo++,t=`_`+t+`r_`+n.toString(32)+`_`;return e.memoizedState=t},useHostTransitionStatus:oc,useFormState:Ns,useActionState:Ns,useOptimistic:function(e){var t=cs();t.memoizedState=t.baseState=e;var n={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return t.queue=n,t=fc.bind(null,B,!0,n),n.dispatch=t,[e,t]},useMemoCache:ps,useCacheRefresh:function(){return cs().memoizedState=lc.bind(null,B)},useEffectEvent:function(e){var t=cs(),n={impl:e};return t.memoizedState=n,function(){if(K&2)throw Error(s(440));return n.impl.apply(void 0,arguments)}}},vc={readContext:Ea,use:fs,useCallback:Zs,useContext:Ea,useEffect:Us,useImperativeHandle:Ys,useInsertionEffect:Ks,useLayoutEffect:qs,useMemo:Qs,useReducer:hs,useRef:zs,useState:function(){return hs(ms)},useDebugValue:Xs,useDeferredValue:function(e,t){return ec(ls(),Wo.memoizedState,e,t)},useTransition:function(){var e=hs(ms)[0],t=ls().memoizedState;return[typeof e==`boolean`?e:ds(e),t]},useSyncExternalStore:vs,useId:sc,useHostTransitionStatus:oc,useFormState:Ps,useActionState:Ps,useOptimistic:function(e,t){return Ts(ls(),Wo,e,t)},useMemoCache:ps,useCacheRefresh:cc,useEffectEvent:Gs},yc={readContext:Ea,use:fs,useCallback:Zs,useContext:Ea,useEffect:Us,useImperativeHandle:Ys,useInsertionEffect:Ks,useLayoutEffect:qs,useMemo:Qs,useReducer:_s,useRef:zs,useState:function(){return _s(ms)},useDebugValue:Xs,useDeferredValue:function(e,t){var n=ls();return Wo===null?$s(n,e,t):ec(n,Wo.memoizedState,e,t)},useTransition:function(){var e=_s(ms)[0],t=ls().memoizedState;return[typeof e==`boolean`?e:ds(e),t]},useSyncExternalStore:vs,useId:sc,useHostTransitionStatus:oc,useFormState:Ls,useActionState:Ls,useOptimistic:function(e,t){var n=ls();return Wo===null?(n.baseState=e,[e,n.queue.dispatch]):Ts(n,Wo,e,t)},useMemoCache:ps,useCacheRefresh:cc,useEffectEvent:Gs};function bc(e,t,n,r){t=e.memoizedState,n=n(r,t),n=n==null?t:E({},t,n),e.memoizedState=n,e.lanes===0&&(e.updateQueue.baseState=n)}var xc={enqueueSetState:function(e,t,n){e=e._reactInternals;var r=jd(),i=vo(r);i.payload=t,n!=null&&(i.callback=n),t=yo(e,i,r),t!==null&&(Pd(t,e,r),bo(t,e,r))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var r=jd(),i=vo(r);i.tag=1,i.payload=t,n!=null&&(i.callback=n),t=yo(e,i,r),t!==null&&(Pd(t,e,r),bo(t,e,r))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=jd(),r=vo(n);r.tag=2,t!=null&&(r.callback=t),t=yo(e,r,n),t!==null&&(Pd(t,e,n),bo(t,e,n))}};function Sc(e,t,n,r,i,a,o){return e=e.stateNode,typeof e.shouldComponentUpdate==`function`?e.shouldComponentUpdate(r,a,o):t.prototype&&t.prototype.isPureReactComponent?!Gr(n,r)||!Gr(i,a):!0}function Cc(e,t,n,r){e=t.state,typeof t.componentWillReceiveProps==`function`&&t.componentWillReceiveProps(n,r),typeof t.UNSAFE_componentWillReceiveProps==`function`&&t.UNSAFE_componentWillReceiveProps(n,r),t.state!==e&&xc.enqueueReplaceState(t,t.state,null)}function wc(e,t){var n=t;if(`ref`in t)for(var r in n={},t)r!==`ref`&&(n[r]=t[r]);if(e=e.defaultProps)for(var i in n===t&&(n=E({},n)),e)n[i]===void 0&&(n[i]=e[i]);return n}function Tc(e){Si(e)}function Ec(e){console.error(e)}function Dc(e){Si(e)}function Oc(e,t){try{var n=e.onUncaughtError;n(t.value,{componentStack:t.stack})}catch(e){setTimeout(function(){throw e})}}function kc(e,t,n){try{var r=e.onCaughtError;r(n.value,{componentStack:n.stack,errorBoundary:t.tag===1?t.stateNode:null})}catch(e){setTimeout(function(){throw e})}}function Ac(e,t,n){return n=vo(n),n.tag=3,n.payload={element:null},n.callback=function(){Oc(e,t)},n}function jc(e){return e=vo(e),e.tag=3,e}function Mc(e,t,n,r){var i=n.type.getDerivedStateFromError;if(typeof i==`function`){var a=r.value;e.payload=function(){return i(a)},e.callback=function(){kc(t,n,r)}}var o=n.stateNode;o!==null&&typeof o.componentDidCatch==`function`&&(e.callback=function(){kc(t,n,r),typeof i!=`function`&&(yd===null?yd=new Set([this]):yd.add(this));var e=r.stack;this.componentDidCatch(r.value,{componentStack:e===null?``:e})})}function Nc(e,t,n,r,i){if(n.flags|=32768,typeof r==`object`&&r&&typeof r.then==`function`){if(t=n.alternate,t!==null&&Ca(t,n,i,!0),n=Mo.current,n!==null){switch(n.tag){case 31:case 13:case 19:return No===null?Kd():n.alternate===null&&sd===0&&(sd=3),n.flags&=-257,n.flags|=65536,n.lanes=i,r===$a?n.flags|=16384:(t=n.updateQueue,t===null?n.updateQueue=new Set([r]):t.add(r),mf(e,r,i)),!1;case 22:return n.flags|=65536,r===$a?n.flags|=16384:(t=n.updateQueue,t===null?(t={transitions:null,markerInstances:null,retryQueue:new Set([r])},n.updateQueue=t):(n=t.retryQueue,n===null?t.retryQueue=new Set([r]):n.add(r)),mf(e,r,i)),!1}throw Error(s(435,n.tag))}return mf(e,r,i),Kd(),!1}if(z)return t=Mo.current,t===null?(r!==ca&&(t=Error(s(423),{cause:r}),ha(Ui(t,n))),e=e.current.alternate,e.flags|=65536,i&=-i,e.lanes|=i,r=Ui(r,n),i=Ac(e.stateNode,r,i),xo(e,i),sd!==4&&(sd=2)):(!(t.flags&65536)&&(t.flags|=256),t.flags|=65536,t.lanes=i,r!==ca&&(e=Error(s(422),{cause:r}),ha(Ui(e,n)))),!1;var a=Error(s(520),{cause:r});if(a=Ui(a,n),fd===null?fd=[a]:fd.push(a),sd!==4&&(sd=2),t===null)return!0;r=Ui(r,n),n=t;do{switch(n.tag){case 3:return n.flags|=65536,e=i&-i,n.lanes|=e,e=Ac(n.stateNode,r,e),xo(n,e),!1;case 1:if(t=n.type,a=n.stateNode,!(n.flags&128)&&(typeof t.getDerivedStateFromError==`function`||a!==null&&typeof a.componentDidCatch==`function`&&(yd===null||!yd.has(a))))return n.flags|=65536,i&=-i,n.lanes|=i,i=jc(i),Mc(i,e,n,r),xo(n,i),!1;break;case 22:if(n.memoizedState!==null)return n.flags|=65536,!1}n=n.return}while(n!==null);return!1}var Pc=Error(s(461)),H=!1;function Fc(e,t,n,r){t.child=e===null?mo(t,null,n,r):po(t,e.child,n,r)}function Ic(e,t,n,r,i){n=n.render;var a=t.ref;if(`ref`in r){var o={};for(var s in r)s!==`ref`&&(o[s]=r[s])}else o=r;return Ta(t),r=ts(e,t,n,o,a,i),s=as(),e!==null&&!H?(os(e,t,i),ul(e,t,i)):(z&&s&&ta(t),t.flags|=1,Fc(e,t,r,i),t.child)}function Lc(e,t,n,r,i){if(e===null){var a=n.type;return typeof a==`function`&&!Pi(a)&&a.defaultProps===void 0&&n.compare===null?(t.tag=15,t.type=a,Rc(e,t,a,r,i)):(e=Li(n.type,null,r,t,t.mode,i),e.ref=t.ref,e.return=t,t.child=e)}if(a=e.child,!dl(e,i)){var o=a.memoizedProps;if(n=n.compare,n=n===null?Gr:n,n(o,r)&&e.ref===t.ref)return ul(e,t,i)}return t.flags|=1,e=Fi(a,r),e.ref=t.ref,e.return=t,t.child=e}function Rc(e,t,n,r,i){if(e!==null){var a=e.memoizedProps;if(Gr(a,r)&&e.ref===t.ref){if(H=!1,t.pendingProps=r=a,dl(e,i))e.flags&131072&&(H=!0);else return t.lanes=e.lanes,ul(e,t,i)}}return Kc(e,t,n,r,i)}function zc(e,t,n,r){var i=r.children,a=e===null?null:e.memoizedState;if(e===null&&t.stateNode===null&&(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),r.mode===`hidden`){if(t.flags&128){if(a=a===null?n:a.baseLanes|n,e!==null){for(r=t.child=e.child,i=0;r!==null;)i=i|r.lanes|r.childLanes,r=r.sibling;r=i&~a}else r=0,t.child=null;return Vc(e,t,a,n,r)}if(n&536870912)t.memoizedState={baseLanes:0,cachePool:null},e!==null&&Ja(t,a===null?null:a.cachePool),a===null?Ao():ko(t,a),Io(t);else return r=t.lanes=536870912,Vc(e,t,a===null?n:a.baseLanes|n,n,r)}else a===null?(e!==null&&Ja(t,null),Ao(),Lo()):(Ja(t,a.cachePool),ko(t,a),Lo(),t.memoizedState=null);return Fc(e,t,i,n),t.child}function Bc(e,t){return e!==null&&e.tag===22||t.stateNode!==null||(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),t.sibling}function Vc(e,t,n,r,i){var a=qa();return a=a===null?null:{parent:Ma._currentValue,pool:a},t.memoizedState={baseLanes:n,cachePool:a},e!==null&&Ja(t,null),Ao(),Io(t),e!==null&&Ca(e,t,r,!0),t.childLanes=i,null}function Hc(e,t){return t=tl({mode:t.mode,children:t.children},e.mode),t.ref=e.ref,e.child=t,t.return=e,t}function Uc(e,t,n){return po(t,e.child,null,n),e=Hc(t,t.pendingProps),e.flags|=2,Ro(t),t.memoizedState=null,e}function Wc(e,t,n){var r=t.pendingProps,i=!!(t.flags&128);if(t.flags&=-129,e===null){if(z){if(r.mode===`hidden`)return e=Hc(t,r),t.lanes=536870912,e.memoizedState={baseLanes:0,cachePool:null},Bc(null,e);if(Fo(t),(e=aa)?(e=am(e,sa),e=e!==null&&e.data===`&`?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:Xi===null?null:{id:Zi,overflow:Qi},retryLane:536870912,hydrationErrors:null},n=Bi(e),n.return=t,t.child=n,ia=t,aa=null)):e=null,e===null)throw la(t);return t.lanes=536870912,null}return Hc(t,r)}var a=e.memoizedState;if(a!==null){var o=a.dehydrated;if(Fo(t),i){if(t.flags&256)t.flags&=-257,t=Uc(e,t,n);else if(t.memoizedState!==null)t.child=e.child,t.flags|=128,t=null;else throw Error(s(558))}else if(H||Ca(e,t,n,!1),i=(n&e.childLanes)!==0,H||i){if(Do.current===null){if(r=ed,r!==null&&(o=St(r,n),o!==0&&o!==a.retryLane))throw a.retryLane=o,Oi(e,o),Pd(r,e,o),Pc;Kd()}t=Uc(e,t,n)}else e=a.treeContext,aa=lm(o.nextSibling),ia=t,z=!0,oa=null,sa=!1,e!==null&&ra(t,e),t=Hc(t,r),t.flags|=134221824;return t}return e=Fi(e.child,{mode:r.mode,children:r.children}),e.ref=t.ref,t.child=e,e.return=t,e}function Gc(e,t){var n=t.ref;if(n===null)e!==null&&e.ref!==null&&(t.flags|=4194816);else{if(typeof n!=`function`&&typeof n!=`object`)throw Error(s(284));(e===null||e.ref!==n)&&(t.flags|=4194816)}}function Kc(e,t,n,r,i){return Ta(t),n=ts(e,t,n,r,void 0,i),r=as(),e!==null&&!H?(os(e,t,i),ul(e,t,i)):(z&&r&&ta(t),t.flags|=1,Fc(e,t,n,i),t.child)}function qc(e,t,n,r,i,a){return Ta(t),t.updateQueue=null,n=rs(t,r,n,i),ns(e),r=as(),e!==null&&!H?(os(e,t,a),ul(e,t,a)):(z&&r&&ta(t),t.flags|=1,Fc(e,t,n,a),t.child)}function Jc(e,t,n,r,i){if(Ta(t),t.stateNode===null){var a=ji,o=n.contextType;typeof o==`object`&&o&&(a=Ea(o)),a=new n(r,a),t.memoizedState=a.state!==null&&a.state!==void 0?a.state:null,a.updater=xc,t.stateNode=a,a._reactInternals=t,a=t.stateNode,a.props=r,a.state=t.memoizedState,a.refs={},go(t),o=n.contextType,a.context=typeof o==`object`&&o?Ea(o):ji,a.state=t.memoizedState,o=n.getDerivedStateFromProps,typeof o==`function`&&(bc(t,n,o,r),a.state=t.memoizedState),typeof n.getDerivedStateFromProps==`function`||typeof a.getSnapshotBeforeUpdate==`function`||typeof a.UNSAFE_componentWillMount!=`function`&&typeof a.componentWillMount!=`function`||(o=a.state,typeof a.componentWillMount==`function`&&a.componentWillMount(),typeof a.UNSAFE_componentWillMount==`function`&&a.UNSAFE_componentWillMount(),o!==a.state&&xc.enqueueReplaceState(a,a.state,null),wo(t,r,a,i),Co(),a.state=t.memoizedState),typeof a.componentDidMount==`function`&&(t.flags|=4194308),r=!0}else if(e===null){a=t.stateNode;var s=t.memoizedProps,c=wc(n,s);a.props=c;var l=a.context,u=n.contextType;o=ji,typeof u==`object`&&u&&(o=Ea(u));var d=n.getDerivedStateFromProps;u=typeof d==`function`||typeof a.getSnapshotBeforeUpdate==`function`,s=t.pendingProps!==s,u||typeof a.UNSAFE_componentWillReceiveProps!=`function`&&typeof a.componentWillReceiveProps!=`function`||(s||l!==o)&&Cc(t,a,r,o),ho=!1;var f=t.memoizedState;a.state=f,wo(t,r,a,i),Co(),l=t.memoizedState,s||f!==l||ho?(typeof d==`function`&&(bc(t,n,d,r),l=t.memoizedState),(c=ho||Sc(t,n,c,r,f,l,o))?(u||typeof a.UNSAFE_componentWillMount!=`function`&&typeof a.componentWillMount!=`function`||(typeof a.componentWillMount==`function`&&a.componentWillMount(),typeof a.UNSAFE_componentWillMount==`function`&&a.UNSAFE_componentWillMount()),typeof a.componentDidMount==`function`&&(t.flags|=4194308)):(typeof a.componentDidMount==`function`&&(t.flags|=4194308),t.memoizedProps=r,t.memoizedState=l),a.props=r,a.state=l,a.context=o,r=c):(typeof a.componentDidMount==`function`&&(t.flags|=4194308),r=!1)}else{a=t.stateNode,_o(e,t),o=t.memoizedProps,u=wc(n,o),a.props=u,d=t.pendingProps,f=a.context,l=n.contextType,c=ji,typeof l==`object`&&l&&(c=Ea(l)),s=n.getDerivedStateFromProps,(l=typeof s==`function`||typeof a.getSnapshotBeforeUpdate==`function`)||typeof a.UNSAFE_componentWillReceiveProps!=`function`&&typeof a.componentWillReceiveProps!=`function`||(o!==d||f!==c)&&Cc(t,a,r,c),ho=!1,f=t.memoizedState,a.state=f,wo(t,r,a,i),Co();var p=t.memoizedState;o!==d||f!==p||ho||e!==null&&e.dependencies!==null&&wa(e.dependencies)?(typeof s==`function`&&(bc(t,n,s,r),p=t.memoizedState),(u=ho||Sc(t,n,u,r,f,p,c)||e!==null&&e.dependencies!==null&&wa(e.dependencies))?(l||typeof a.UNSAFE_componentWillUpdate!=`function`&&typeof a.componentWillUpdate!=`function`||(typeof a.componentWillUpdate==`function`&&a.componentWillUpdate(r,p,c),typeof a.UNSAFE_componentWillUpdate==`function`&&a.UNSAFE_componentWillUpdate(r,p,c)),typeof a.componentDidUpdate==`function`&&(t.flags|=4),typeof a.getSnapshotBeforeUpdate==`function`&&(t.flags|=1024)):(typeof a.componentDidUpdate!=`function`||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),typeof a.getSnapshotBeforeUpdate!=`function`||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),t.memoizedProps=r,t.memoizedState=p),a.props=r,a.state=p,a.context=c,r=u):(typeof a.componentDidUpdate!=`function`||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),typeof a.getSnapshotBeforeUpdate!=`function`||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),r=!1)}return a=r,Gc(e,t),r=!!(t.flags&128),a||r?(a=t.stateNode,n=r&&typeof n.getDerivedStateFromError!=`function`?null:a.render(),t.flags|=1,e!==null&&r?(t.child=po(t,e.child,null,i),t.child=po(t,null,n,i)):Fc(e,t,n,i),t.memoizedState=a.state,e=t.child):e=ul(e,t,i),e}function Yc(e,t,n,r){return pa(),t.flags|=256,Fc(e,t,n,r),t.child}var Xc={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Zc(e){return{baseLanes:e,cachePool:Ya()}}function Qc(e,t,n){return e=e===null?0:e.childLanes&~n,t&&(e|=ud),e}function $c(e,t,n){var r=t.pendingProps,i=!1,a=!!(t.flags&128),o;if((o=a)||(o=e!==null&&e.memoizedState===null?!1:!!(zo.current&2)),o&&(i=!0,t.flags&=-129),o=!!(t.flags&32),t.flags&=-33,e===null){if(z){if(i?Po(t):Lo(),(e=aa)?(e=am(e,sa),e=e!==null&&e.data!==`&`?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:Xi===null?null:{id:Zi,overflow:Qi},retryLane:536870912,hydrationErrors:null},n=Bi(e),n.return=t,t.child=n,ia=t,aa=null)):e=null,e===null)throw la(t);return t.lanes=sm(e)?32:536870912,null}return a=r.children,r=r.fallback,i?(Lo(),i=t.mode,a=tl({mode:`hidden`,children:a},i),r=Ri(r,i,n,null),a.return=t,r.return=t,a.sibling=r,t.child=a,r=t.child,r.memoizedState=Zc(n),r.childLanes=Qc(e,o,n),t.memoizedState=Xc,Bc(null,r)):(Po(t),el(t,a))}var s=e.memoizedState;if(s!==null){var c=s.dehydrated;if(c!==null)return rl(e,t,a,o,r,c,s,n)}return i?(Lo(),i=r.fallback,a=t.mode,s=e.child,c=s.sibling,r=Fi(s,{mode:`hidden`,children:r.children}),r.subtreeFlags=s.subtreeFlags&1206910976,c===null?(i=Ri(i,a,n,null),i.flags|=2):i=Fi(c,i),i.return=t,r.return=t,r.sibling=i,t.child=r,Bc(null,r),r=t.child,i=e.child.memoizedState,i===null?i=Zc(n):(a=i.cachePool,a===null?a=Ya():(s=Ma._currentValue,a=a.parent===s?a:{parent:s,pool:s}),i={baseLanes:i.baseLanes|n,cachePool:a}),r.memoizedState=i,r.childLanes=Qc(e,o,n),t.memoizedState=Xc,Bc(e.child,r)):(Po(t),n=e.child,e=n.sibling,n=Fi(n,{mode:`visible`,children:r.children}),n.return=t,n.sibling=null,e!==null&&(o=t.deletions,o===null?(t.deletions=[e],t.flags|=16):o.push(e)),t.child=n,t.memoizedState=null,n)}function el(e,t){return t=tl({mode:`visible`,children:t},e.mode),t.return=e,e.child=t}function tl(e,t){return e=Ni(22,e,null,t),e.lanes=0,e}function nl(e,t,n){return po(t,e.child,null,n),e=el(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function rl(e,t,n,r,i,a,o,c){if(n)return t.flags&256?(Po(t),t.flags&=-257,nl(e,t,c)):t.memoizedState===null?(Lo(),a=i.fallback,o=t.mode,i=tl({mode:`visible`,children:i.children},o),a=Ri(a,o,c,null),a.flags|=2,i.return=t,a.return=t,i.sibling=a,t.child=i,po(t,e.child,null,c),i=t.child,i.memoizedState=Zc(c),i.childLanes=Qc(e,r,c),t.memoizedState=Xc,Bc(null,i)):(Lo(),t.child=e.child,t.flags|=128,null);if(Po(t),sm(a)){if(r=a.nextSibling&&a.nextSibling.dataset,r)var l=r.dgst;return r=l,r!==``&&(i=Error(s(419)),i.stack=``,i.digest=r,ha({value:i,source:null,stack:null})),nl(e,t,c)}if(H||Ca(e,t,c,!1),r=(c&e.childLanes)!==0,H||r){if(Do.current!==null)return nl(e,t,c);if(r=ed,r!==null&&(i=St(r,c),i!==0&&i!==o.retryLane))throw o.retryLane=i,Oi(e,i),Pd(r,e,i),Pc;return om(a)||Kd(),nl(e,t,c)}return om(a)?(t.flags|=192,t.child=e.child,null):(e=o.treeContext,aa=lm(a.nextSibling),ia=t,z=!0,oa=null,sa=!1,e!==null&&ra(t,e),t=el(t,i.children),t.flags|=134221824,t)}function il(e,t,n){e.lanes|=t;var r=e.alternate;r!==null&&(r.lanes|=t),xa(e.return,t,n)}function al(e){for(var t=null;e!==null;){var n=e.alternate;n!==null&&Ho(n)===null&&(t=e),e=e.sibling}return t}function ol(e,t,n,r,i,a){var o=e.memoizedState;o===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:r,tail:n,tailMode:i,treeForkCount:a}:(o.isBackwards=t,o.rendering=null,o.renderingStartTime=0,o.last=r,o.tail=n,o.tailMode=i,o.treeForkCount=a)}function sl(e){var t=e.child;for(e.child=null;t!==null;){var n=t.sibling;t.sibling=e.child,e.child=t,t=n}}function cl(e,t,n){var r=t.pendingProps,i=r.revealOrder,a=r.tail;r=r.children;var o=zo.current;if(t.flags&128)return Bo(t,o),null;var s=!!(o&2);if(s?(o=o&1|2,t.flags|=128):o&=1,Bo(t,o),i===`backwards`&&e!==null?(sl(e),Fc(e,t,r,n),sl(e)):Fc(e,t,r,n),r=z?qi:0,!s&&e!==null&&e.flags&128)a:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&il(e,n,t);else if(e.tag===19)il(e,n,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break a;for(;e.sibling===null;){if(e.return===null||e.return===t)break a;e=e.return}e.sibling.return=e.return,e=e.sibling}switch(i){case`backwards`:n=al(t.child),n===null?(i=t.child,t.child=null):(i=n.sibling,n.sibling=null,sl(t)),ol(t,!0,i,null,a,r);break;case`unstable_legacy-backwards`:for(n=null,i=t.child,t.child=null;i!==null;){if(e=i.alternate,e!==null&&Ho(e)===null){t.child=i;break}e=i.sibling,i.sibling=n,n=i,i=e}ol(t,!0,n,null,a,r);break;case`together`:ol(t,!1,null,null,void 0,r);break;case`independent`:t.memoizedState=null;break;default:n=al(t.child),n===null?(i=t.child,t.child=null):(i=n.sibling,n.sibling=null),ol(t,!1,i,n,a,r)}return t.child}function ll(e,t,n){var r=t.pendingProps;return ya(t,t.type,r.value),Fc(e,t,r.children,n),t.child}function ul(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),cd|=t.lanes,(n&t.childLanes)===0){if(e!==null){if(Ca(e,t,n,!1),(n&t.childLanes)===0)return null}else return null}if(e!==null&&t.child!==e.child)throw Error(s(153));if(t.child!==null){for(e=t.child,n=Fi(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=Fi(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function dl(e,t){return(e.lanes&t)!==0||(e=e.dependencies,!!(e!==null&&wa(e)))}function fl(e,t,n){switch(t.tag){case 3:je(t,t.stateNode.containerInfo),ya(t,Ma,e.memoizedState.cache),pa();break;case 27:case 5:Ne(t);break;case 4:je(t,t.stateNode.containerInfo);break;case 10:ya(t,t.type,t.memoizedProps.value);break;case 31:if(t.memoizedState!==null)return t.flags|=128,Fo(t),null;break;case 13:var r=t.memoizedState;if(r!==null){if(r.dehydrated!==null)return Po(t),t.flags|=128,null;r=Ca(e,t,n,!1);var i=t.child.childLanes;return r||(n&i)!==0?$c(e,t,n):(Po(t),e=ul(e,t,n),e===null?null:e.sibling)}Po(t);break;case 19:if(t.flags&128)return cl(e,t,n);if(i=!!(e.flags&128),r=(n&t.childLanes)!==0,r||=(Ca(e,t,n,!1),(n&t.childLanes)!==0),i){if(r)return cl(e,t,n);t.flags|=128}if(i=t.memoizedState,i!==null&&(i.rendering=null,i.tail=null,i.lastEffect=null),Bo(t,zo.current),r)break;return null;case 22:return t.lanes=0,zc(e,t,n,t.pendingProps);case 24:ya(t,Ma,e.memoizedState.cache)}return ul(e,t,n)}function pl(e,t,n){if(e!==null){if(e.memoizedProps!==t.pendingProps)H=!0;else{if(!dl(e,n)&&!(t.flags&128))return H=!1,fl(e,t,n);H=!!(e.flags&131072)}}else H=!1,z&&t.flags&1048576&&ea(t,qi,t.index);switch(t.lanes=0,t.tag){case 16:a:{var r=t.pendingProps;if(e=no(t.elementType),t.type=e,typeof e==`function`)Pi(e)?(r=wc(e,r),t.tag=1,t=Jc(null,t,e,r,n)):(t.tag=0,t=Kc(null,t,e,r,n));else{if(e!=null){var i=e.$$typeof;if(i===oe){t.tag=11,t=Ic(null,t,e,r,n);break a}if(i===le){t.tag=14,t=Lc(null,t,e,r,n);break a}if(i===ae){t.tag=10,t.type=e,t=ll(null,t,n);break a}}throw t=ye(e)||e,Error(s(306,t,``))}}return t;case 0:return Kc(e,t,t.type,t.pendingProps,n);case 1:return r=t.type,i=wc(r,t.pendingProps),Jc(e,t,r,i,n);case 3:a:{if(je(t,t.stateNode.containerInfo),e===null)throw Error(s(387));r=t.pendingProps;var a=t.memoizedState;i=a.element,_o(e,t),wo(t,r,null,n);var o=t.memoizedState;if(r=o.cache,ya(t,Ma,r),r!==a.cache&&Sa(t,[Ma],n,!0),Co(),r=o.element,a.isDehydrated){if(a={element:r,isDehydrated:!1,cache:o.cache},t.updateQueue.baseState=a,t.memoizedState=a,t.flags&256){t=Yc(e,t,r,n);break a}if(r!==i){i=Ui(Error(s(424)),t),ha(i),t=Yc(e,t,r,n);break a}switch(e=t.stateNode.containerInfo,e.nodeType){case 9:e=e.body;break;default:e=e.nodeName===`HTML`?e.ownerDocument.body:e}for(aa=lm(e.firstChild),ia=t,z=!0,oa=null,sa=!0,n=mo(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|134221824,n=n.sibling}else{if(pa(),r===i){t=ul(e,t,n);break a}Fc(e,t,r,n)}t=t.child}return t;case 26:return Gc(e,t),e===null?(n=Nm(t.type,null,t.pendingProps,null))?t.memoizedState=n:z||(t.stateNode=pp(t.type,t.pendingProps,ke.current,t)):t.memoizedState=Nm(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return Ne(t),e===null&&z&&(r=t.stateNode=hm(t.type,t.pendingProps,ke.current),ia=t,sa=!0,i=aa,Cp(t.type)?(um=i,aa=lm(r.firstChild)):aa=i),Fc(e,t,t.pendingProps.children,n),Gc(e,t),e===null&&(t.flags|=4194304),t.child;case 5:return e===null&&z&&((i=r=aa)&&(r=rm(r,t.type,t.pendingProps,sa),r===null?i=!1:(t.stateNode=r,ia=t,aa=lm(r.firstChild),sa=!1,i=!0)),i||la(t)),Ne(t),i=t.type,a=t.pendingProps,o=e===null?null:e.memoizedProps,r=a.children,mp(i,a)?r=null:o!==null&&mp(i,o)&&(t.flags|=32),t.memoizedState!==null&&(i=ts(e,t,is,null,null,n),sh._currentValue=i),Gc(e,t),Fc(e,t,r,n),t.child;case 6:return e===null&&z&&((e=n=aa)&&(n=im(n,t.pendingProps,sa),n===null?e=!1:(t.stateNode=n,ia=t,aa=null,e=!0)),e||la(t)),null;case 13:return $c(e,t,n);case 4:return je(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=po(t,null,r,n):Fc(e,t,r,n),t.child;case 11:return Ic(e,t,t.type,t.pendingProps,n);case 7:return r=t.pendingProps,Gc(e,t),Fc(e,t,r,n),t.child;case 8:return Fc(e,t,t.pendingProps.children,n),t.child;case 12:return Fc(e,t,t.pendingProps.children,n),t.child;case 10:return ll(e,t,n);case 9:return i=t.type._context,r=t.pendingProps.children,Ta(t),i=Ea(i),r=r(i),t.flags|=1,Fc(e,t,r,n),t.child;case 14:return Lc(e,t,t.type,t.pendingProps,n);case 15:return Rc(e,t,t.type,t.pendingProps,n);case 19:return cl(e,t,n);case 31:return Wc(e,t,n);case 22:return zc(e,t,n,t.pendingProps);case 24:return Ta(t),r=Ea(Ma),e===null?(i=qa(),i===null&&(i=ed,a=Na(),i.pooledCache=a,a.refCount++,a!==null&&(i.pooledCacheLanes|=n),i=a),t.memoizedState={parent:r,cache:i},go(t),ya(t,Ma,i)):((e.lanes&n)!==0&&(_o(e,t),wo(t,null,null,n),Co()),i=e.memoizedState,a=t.memoizedState,i.parent===r?(r=a.cache,ya(t,Ma,r),r!==i.cache&&Sa(t,[Ma],n,!0)):(i={parent:r,cache:r},t.memoizedState=i,t.lanes===0&&(t.memoizedState=t.updateQueue.baseState=i),ya(t,Ma,r))),Fc(e,t,t.pendingProps.children,n),t.child;case 30:return t.stateNode===null&&(t.stateNode={autoName:null,paired:null,clones:null,ref:null}),r=t.pendingProps,r.name!=null&&r.name!==`auto`?t.flags|=e===null?18882560:18874368:z&&ta(t),e!==null&&e.memoizedProps.name!==r.name?t.flags|=4194816:Gc(e,t),Fc(e,t,r.children,n),t.child;case 29:throw t.pendingProps}throw Error(s(156,t.tag))}function ml(e){e.flags|=4}function hl(e,t,n,r,i){var a;if((a=!!(e.mode&32))&&(a=n===null?Jm(t,r):Jm(t,r)&&(r.src!==n.src||r.srcSet!==n.srcSet)),a){if(e.flags|=16777216,(i&335544128)===i){if(e.stateNode.complete)e.flags|=8192;else if(Ud())e.flags|=8192;else throw ro=$a,Za}}else e.flags&=-16777217}function gl(e,t){if(t.type!==`stylesheet`||t.state.loading&4)e.flags&=-16777217;else if(e.flags|=16777216,!Ym(t)){if(Ud())e.flags|=8192;else throw ro=$a,Za}}function _l(e,t){t!==null&&(e.flags|=4),e.flags&16384&&(t=e.tag===22?536870912:gt(),e.lanes|=t,dd|=t)}function vl(e,t){if(!z)switch(e.tailMode){case`visible`:break;case`collapsed`:for(var n=e.tail,r=null;n!==null;)n.alternate!==null&&(r=n),n=n.sibling;r===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:r.sibling=null;break;default:for(t=e.tail,n=null;t!==null;)t.alternate!==null&&(n=t),t=t.sibling;n===null?e.tail=null:n.sibling=null}}function yl(e){var t=e.alternate!==null&&e.alternate.child===e.child,n=0,r=0;if(t)for(var i=e.child;i!==null;)n|=i.lanes|i.childLanes,r|=i.subtreeFlags&1206910976,r|=i.flags&1206910976,i.return=e,i=i.sibling;else for(i=e.child;i!==null;)n|=i.lanes|i.childLanes,r|=i.subtreeFlags,r|=i.flags,i.return=e,i=i.sibling;return e.subtreeFlags|=r,e.childLanes=n,t}function bl(e,t,n){var r=t.pendingProps;switch(na(t),t.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return yl(t),null;case 1:return yl(t),null;case 3:return n=t.stateNode,r=null,e!==null&&(r=e.memoizedState.cache),t.memoizedState.cache!==r&&(t.flags|=2048),ba(Ma),Me(),n.pendingContext&&(n.context=n.pendingContext,n.pendingContext=null),(e===null||e.child===null)&&(fa(t)?ml(t):e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,ma())),yl(t),null;case 26:var i=t.type,a=t.memoizedState;return e===null?(ml(t),a===null?(yl(t),hl(t,i,null,r,n)):(yl(t),gl(t,a))):a?a===e.memoizedState?(yl(t),t.flags&=-16777217):(ml(t),yl(t),gl(t,a)):(e=e.memoizedProps,e!==r&&ml(t),yl(t),hl(t,i,e,r,n)),null;case 27:if(Pe(t),n=ke.current,i=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==r&&ml(t);else{if(!r){if(t.stateNode===null)throw Error(s(166));return yl(t),t.subtreeFlags&=-33554433,null}e=De.current,fa(t)?ua(t,e):(e=hm(i,r,n),t.stateNode=e,ml(t))}return yl(t),t.subtreeFlags&=-33554433,null;case 5:if(Pe(t),i=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==r&&ml(t);else{if(!r){if(t.stateNode===null)throw Error(s(166));return yl(t),t.subtreeFlags&=-33554433,null}if(a=De.current,fa(t))ua(t,a);else{var o=up(ke.current);switch(a){case 1:a=o.createElementNS(`http://www.w3.org/2000/svg`,i);break;case 2:a=o.createElementNS(`http://www.w3.org/1998/Math/MathML`,i);break;default:switch(i){case`svg`:a=o.createElementNS(`http://www.w3.org/2000/svg`,i);break;case`math`:a=o.createElementNS(`http://www.w3.org/1998/Math/MathML`,i);break;case`script`:a=o.createElement(`div`),a.innerHTML=`<script><\/script>`,a=a.removeChild(a.firstChild);break;case`select`:a=typeof r.is==`string`?o.createElement(`select`,{is:r.is}):o.createElement(`select`),r.multiple?a.multiple=!0:r.size&&(a.size=r.size);break;default:a=typeof r.is==`string`?o.createElement(i,{is:r.is}):o.createElement(i)}}a[Ot]=t,a[kt]=r;a:for(o=t.child;o!==null;){if(o.tag===5||o.tag===6)a.appendChild(o.stateNode);else if(o.tag!==4&&o.tag!==27&&o.child!==null){o.child.return=o,o=o.child;continue}if(o===t)break a;for(;o.sibling===null;){if(o.return===null||o.return===t)break a;o=o.return}o.sibling.return=o.return,o=o.sibling}t.stateNode=a;a:switch(rp(a,i,r),i){case`button`:case`input`:case`select`:case`textarea`:r=!!r.autoFocus;break a;case`img`:r=!0;break a;default:r=!1}r&&ml(t)}}return yl(t),t.subtreeFlags&=-33554433,hl(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,n),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==r&&ml(t);else{if(typeof r!=`string`&&t.stateNode===null)throw Error(s(166));if(e=ke.current,fa(t)){if(e=t.stateNode,n=t.memoizedProps,r=null,i=ia,i!==null)switch(i.tag){case 27:case 5:r=i.memoizedProps}e[Ot]=t,e=!!(e.nodeValue===n||r!==null&&!0===r.suppressHydrationWarning||ep(e.nodeValue,n)),e||la(t,!0)}else e=up(e).createTextNode(r),e[Ot]=t,t.stateNode=e}return yl(t),null;case 31:if(n=t.memoizedState,e===null||e.memoizedState!==null){if(r=fa(t),n!==null){if(e===null){if(!r)throw Error(s(318));if(e=t.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(s(557));e[Ot]=t}else pa(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;yl(t),e=!1}else n=ma(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=n),e=!0;if(!e)return t.flags&256?(Ro(t),t):(Ro(t),null);if(t.flags&128)throw Error(s(558))}return yl(t),null;case 13:if(r=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(i=fa(t),r!==null&&r.dehydrated!==null){if(e===null){if(!i)throw Error(s(318));if(i=t.memoizedState,i=i===null?null:i.dehydrated,!i)throw Error(s(317));i[Ot]=t}else pa(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;yl(t),i=!1}else i=ma(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=i),i=!0;if(!i)return t.flags&256?(Ro(t),t):(Ro(t),null)}return Ro(t),t.flags&128?(t.lanes=n,t):(n=r!==null,e=e!==null&&e.memoizedState!==null,n&&(r=t.child,i=null,r.alternate!==null&&r.alternate.memoizedState!==null&&r.alternate.memoizedState.cachePool!==null&&(i=r.alternate.memoizedState.cachePool.pool),a=null,r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(a=r.memoizedState.cachePool.pool),a!==i&&(r.flags|=2048)),n!==e&&n&&(t.child.flags|=8192),_l(t,t.updateQueue),yl(t),null);case 4:return Me(),e===null&&Wf(t.stateNode.containerInfo),t.flags|=67108864,yl(t),null;case 10:return ba(t.type),yl(t),null;case 19:if(Vo(t),r=t.memoizedState,r===null)return yl(t),null;if(i=!!(t.flags&128),a=r.rendering,a===null){if(i)vl(r,!1);else{if(sd!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(a=Ho(e),a!==null){for(t.flags|=128,vl(r,!1),e=a.updateQueue,t.updateQueue=e,_l(t,e),t.subtreeFlags=0,e=n,n=t.child;n!==null;)Ii(n,e),n=n.sibling;return Bo(t,zo.current&1|2),z&&$i(t,r.treeForkCount),t.child}e=e.sibling}r.tail!==null&&qe()>_d&&(t.flags|=128,i=!0,vl(r,!1),t.lanes=4194304)}}else{if(!i){if(e=Ho(a),e!==null){if(t.flags|=128,i=!0,e=e.updateQueue,t.updateQueue=e,_l(t,e),vl(r,!0),r.tail===null&&r.tailMode!==`collapsed`&&r.tailMode!==`visible`&&!a.alternate&&!z)return yl(t),null}else 2*qe()-r.renderingStartTime>_d&&n!==536870912&&(t.flags|=128,i=!0,vl(r,!1),t.lanes=4194304)}r.isBackwards?(a.sibling=t.child,t.child=a):(e=r.last,e===null?t.child=a:e.sibling=a,r.last=a)}if(r.tail!==null){e=r.tail;a:{for(n=e;n!==null;){if(n.alternate!==null){n=!1;break a}n=n.sibling}n=!0}return r.rendering=e,r.tail=e.sibling,r.renderingStartTime=qe(),e.sibling=null,a=zo.current,a=i?a&1|2:a&1,r.tailMode===`visible`||r.tailMode===`collapsed`||!n||z?Bo(t,a):(n=a,Ee(Mo,t),Ee(zo,n),No===null&&(No=t)),z&&$i(t,r.treeForkCount),e}return yl(t),null;case 22:case 23:return Ro(t),jo(),r=t.memoizedState!==null,e===null?r&&(t.flags|=8192):e.memoizedState!==null!==r&&(t.flags|=8192),r?n&536870912&&!(t.flags&128)&&(yl(t),t.subtreeFlags&6&&(t.flags|=8192)):yl(t),n=t.updateQueue,n!==null&&_l(t,n.retryQueue),n=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(n=e.memoizedState.cachePool.pool),r=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(r=t.memoizedState.cachePool.pool),r!==n&&(t.flags|=2048),e!==null&&Te(Ka),null;case 24:return n=null,e!==null&&(n=e.memoizedState.cache),t.memoizedState.cache!==n&&(t.flags|=2048),ba(Ma),yl(t),null;case 25:return null;case 30:return t.flags|=33554432,yl(t),null}throw Error(s(156,t.tag))}function xl(e,t){switch(na(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return ba(Ma),Me(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return Pe(t),null;case 31:if(t.memoizedState!==null){if(Ro(t),t.alternate===null)throw Error(s(340));pa()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(Ro(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(s(340));pa()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return Vo(t),e=t.flags,e&65536?(t.flags=e&-65537|128,e=t.memoizedState,e!==null&&(e.rendering=null,e.tail=null),t.flags|=4,t):null;case 4:return Me(),null;case 10:return ba(t.type),null;case 22:case 23:return Ro(t),jo(),e!==null&&Te(Ka),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return ba(Ma),null;case 25:return null;default:return null}}function Sl(e,t){switch(na(t),t.tag){case 3:ba(Ma),Me();break;case 26:case 27:case 5:Pe(t);break;case 4:Me();break;case 31:t.memoizedState!==null&&Ro(t);break;case 13:Ro(t);break;case 19:Vo(t);break;case 10:ba(t.type);break;case 22:case 23:Ro(t),jo(),e!==null&&Te(Ka);break;case 24:ba(Ma)}}function Cl(e,t){try{var n=t.updateQueue,r=n===null?null:n.lastEffect;if(r!==null){var i=r.next;n=i;do{if((n.tag&e)===e){r=void 0;var a=n.create,o=n.inst;r=a(),o.destroy=r}n=n.next}while(n!==i)}}catch(e){pf(t,t.return,e)}}function wl(e,t,n){try{var r=t.updateQueue,i=r===null?null:r.lastEffect;if(i!==null){var a=i.next;r=a;do{if((r.tag&e)===e){var o=r.inst,s=o.destroy;if(s!==void 0){o.destroy=void 0,i=t;var c=n,l=s;try{l()}catch(e){pf(i,c,e)}}}r=r.next}while(r!==a)}}catch(e){pf(t,t.return,e)}}function U(e){var t=e.updateQueue;if(t!==null){var n=e.stateNode;try{Eo(t,n)}catch(t){pf(e,e.return,t)}}}function Tl(e,t,n){n.props=wc(e.type,e.memoizedProps),n.state=e.memoizedState;try{n.componentWillUnmount()}catch(n){pf(e,t,n)}}function El(e,t){try{var n=e.ref;if(n!==null){switch(e.tag){case 26:case 27:case 5:var r=e.stateNode;break;case 30:var i=e.stateNode,a=yi(e.memoizedProps,i);(i.ref===null||i.ref.name!==a)&&(i.ref=Fp(a)),r=i.ref;break;case 7:if(e.stateNode===null){var o=new Ip(e);h(e.child,!1,$p,o,void 0,void 0),e.stateNode=o}r=e.stateNode;break;default:r=e.stateNode}typeof n==`function`?e.refCleanup=n(r):n.current=r}}catch(n){pf(e,t,n)}}function Dl(e,t){var n=e.ref,r=e.refCleanup;if(n!==null){if(typeof r==`function`)try{r()}catch(n){pf(e,t,n)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof n==`function`)try{n(null)}catch(n){pf(e,t,n)}else n.current=null}}function Ol(e,t){if((e.tag===5||e.tag===27||e.tag===6)&&e.alternate===null&&t!==null)for(var n=0;n<t.length;n++)tm(e.stateNode,t[n])}function kl(e){for(var t=e.return;t!==null&&(Ml(t)&&tm(e.stateNode,t.stateNode),!jl(t));)t=t.return}function Al(e){for(var t=e.return;t!==null&&(Ml(t)&&nm(e.stateNode,t.stateNode),!jl(t));)t=t.return}function jl(e){return e.tag===5||e.tag===3||e.tag===27}function Ml(e){return e&&e.tag===7&&e.stateNode!==null}function Nl(e){var t=e.type,n=e.memoizedProps,r=e.stateNode;try{a:switch(t){case`button`:case`input`:case`select`:case`textarea`:n.autoFocus&&r.focus();break a;case`img`:n.src?r.src=n.src:n.srcSet&&(r.srcset=n.srcSet)}}catch(t){pf(e,e.return,t)}}function Pl(e,t,n){try{var r=e.stateNode;ap(r,e.type,n,t),r[kt]=t}catch(t){pf(e,e.return,t)}}function Fl(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&Cp(e.type)||e.tag===4}function Il(e){a:for(;;){for(;e.sibling===null;){if(e.return===null||Fl(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.tag===27&&Cp(e.type)||e.flags&2||e.child===null||e.tag===4)continue a;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function Ll(e,t,n,r){var i=e.tag;if(i===5||i===6)i=e.stateNode,t?(n.nodeType===9?n.body:n.nodeName===`HTML`?n.ownerDocument.body:n).insertBefore(i,t):(t=n.nodeType===9?n.body:n.nodeName===`HTML`?n.ownerDocument.body:n,t.appendChild(i),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=xn)),Ol(e,r),P=!0;else if(i!==4&&(i===27&&(Ol(e,r),r=null,Cp(e.type)&&(n=e.stateNode,t=null)),e=e.child,e!==null))for(Ll(e,t,n,r),e=e.sibling;e!==null;)Ll(e,t,n,r),e=e.sibling}function Rl(e,t,n,r){var i=e.tag;if(i===5||i===6)i=e.stateNode,t?n.insertBefore(i,t):n.appendChild(i),Ol(e,r),P=!0;else if(i!==4&&(i===27&&(Ol(e,r),r=null,Cp(e.type)&&(n=e.stateNode)),e=e.child,e!==null))for(Rl(e,t,n,r),e=e.sibling;e!==null;)Rl(e,t,n,r),e=e.sibling}function zl(e){var t=e.stateNode,n=e.memoizedProps;try{for(var r=e.type,i=t.attributes;i.length;)t.removeAttributeNode(i[0]);rp(t,r,n),t[Ot]=e,t[kt]=n}catch(t){pf(e,e.return,t)}}var Bl=!1,Vl=null;function Hl(e){(e.tag===30||e.subtreeFlags&33554432)&&(Bl=!0)}var Ul=null;function W(){var e=Ul;return Ul=null,e}var Wl=0;function Gl(e,t,n,r,i){return Wl=0,Kl(e.child,t,n,r,i)}function Kl(e,t,n,r,i){for(var a=!1;e!==null;){if(e.tag===5){var o=e.stateNode;if(r!==null){var s=kp(o);r.push(s),s.view&&(a=!0)}else a||kp(o).view&&(a=!0);Bl=!0,Ep(o,Wl===0?t:t+`_`+Wl,n),Wl++}else e.tag===22&&e.memoizedState!==null||e.tag===30&&i||Kl(e.child,t,n,r,i)&&(a=!0);e=e.sibling}return a}function ql(e,t){for(;e!==null;)e.tag===5?Dp(e.stateNode,e.memoizedProps):e.tag===22&&e.memoizedState!==null||e.tag===30&&t||ql(e.child,t),e=e.sibling}function Jl(e){if(e.subtreeFlags&18874368)for(e=e.child;e!==null;){if((e.tag!==22||e.memoizedState===null)&&(Jl(e),e.tag===30&&e.flags&18874368&&e.stateNode.paired)){var t=e.memoizedProps;if(t.name==null||t.name===`auto`)throw Error(s(544));var n=t.name;t=xi(t.default,t.share),t!==`none`&&(Gl(e,n,t,null,!1)||ql(e.child,!1))}e=e.sibling}}function Yl(e,t){if(e.tag===30){var n=e.stateNode,r=e.memoizedProps,i=yi(r,n),a=xi(r.default,n.paired?r.share:r.enter);a===`none`?Jl(e):Gl(e,i,a,null,!1)?(Jl(e),n.paired||t||Nd(e,r.onEnter)):ql(e.child,!1)}else if(e.subtreeFlags&33554432)for(e=e.child;e!==null;)Yl(e,t),e=e.sibling;else Jl(e)}function Xl(e){if(Vl!==null&&Vl.size!==0){var t=Vl;if(e.subtreeFlags&18874368)for(e=e.child;e!==null;){if(e.tag!==22||e.memoizedState===null){if(e.tag===30&&e.flags&18874368){var n=e.memoizedProps,r=n.name;if(r!=null&&r!==`auto`){var i=t.get(r);if(i!==void 0){var a=xi(n.default,n.share);if(a!==`none`&&(Gl(e,r,a,null,!1)?(a=e.stateNode,i.paired=a,a.paired=i,Nd(e,n.onShare)):ql(e.child,!1)),t.delete(r),t.size===0)break}}}Xl(e)}e=e.sibling}}}function Zl(e){if(e.tag===30){var t=e.memoizedProps,n=yi(t,e.stateNode),r=Vl===null?void 0:Vl.get(n),i=xi(t.default,r===void 0?t.exit:t.share);i!==`none`&&(Gl(e,n,i,null,!1)?r===void 0?Nd(e,t.onExit):(i=e.stateNode,r.paired=i,i.paired=r,Vl.delete(n),Nd(e,t.onShare)):ql(e.child,!1)),Vl!==null&&Xl(e)}else if(e.subtreeFlags&33554432)for(e=e.child;e!==null;)Zl(e),e=e.sibling;else Vl!==null&&Xl(e)}function Ql(e){for(e=e.child;e!==null;){if(e.tag===30){var t=e.memoizedProps,n=yi(t,e.stateNode);t=xi(t.default,t.update),e.flags&=-5,t!==`none`&&Gl(e,n,t,e.memoizedState=[],!1)}else e.subtreeFlags&33554432&&Ql(e);e=e.sibling}}function $l(e){if(e.subtreeFlags&18874368)for(e=e.child;e!==null;){if(e.tag!==22||e.memoizedState===null){if(e.tag===30&&e.flags&18874368){var t=e.stateNode;t.paired!==null&&(t.paired=null,ql(e.child,!1))}$l(e)}e=e.sibling}}function eu(e){if(e.tag===30)e.stateNode.paired=null,ql(e.child,!1),$l(e);else if(e.subtreeFlags&33554432)for(e=e.child;e!==null;)eu(e),e=e.sibling;else $l(e)}function tu(e){for(e=e.child;e!==null;)e.tag===30?ql(e.child,!1):e.subtreeFlags&33554432&&tu(e),e=e.sibling}function nu(e,t,n,r,i,a,o){for(var s=!1;t!==null;){if(t.tag===5){var c=t.stateNode;if(a!==null&&Wl<a.length){var l=a[Wl],u=kp(c);(l.view||u.view)&&(s=!0);var d;if(d=!(e.flags&4)){if(u.clip)d=!0;else{d=l.rect;var f=u.rect;d=d.y!==f.y||d.x!==f.x||d.height!==f.height||d.width!==f.width}}d&&(e.flags|=4),u.abs?u=!l.abs:(l=l.rect,u=u.rect,u=l.height!==u.height||l.width!==u.width),u&&(e.flags|=32)}else e.flags|=32;e.flags&4&&Ep(c,Wl===0?n:n+`_`+Wl,i),s&&e.flags&4||(Ul===null&&(Ul=[]),Ul.push(c,Wl===0?r:r+`_`+Wl,t.memoizedProps)),Wl++}else(t.tag!==22||t.memoizedState===null)&&(t.tag===30&&o?e.flags|=t.flags&32:nu(e,t.child,n,r,i,a,o)&&(s=!0));t=t.sibling}return s}function ru(e,t){for(e=e.child;e!==null;){if(e.tag===30){var n=e.memoizedProps,r=e.stateNode,i=yi(n,r),a=xi(n.default,n.update);if(t){r=r.clones;var o=r===null?null:r.map(Ap)}else o=e.memoizedState,e.memoizedState=null;r=e;var s=e.child;Wl=0,i=nu(r,s,i,i,a,o,!1),e.flags&4&&i&&(t||Nd(e,n.onUpdate))}else e.subtreeFlags&33554432&&ru(e,t);e=e.sibling}}var iu=!1,G=!1,au=!1,ou=!1,su=typeof WeakSet==`function`?WeakSet:Set,cu=null,lu=!1,uu=!1,du=!1,fu=!1;function pu(e,t,n){if(e=e.containerInfo,cp=gh,e=Xr(e),Zr(e)){if(`selectionStart`in e)var r={start:e.selectionStart,end:e.selectionEnd};else a:{r=(r=e.ownerDocument)&&r.defaultView||window;var i=r.getSelection&&r.getSelection();if(i&&i.rangeCount!==0){r=i.anchorNode;var a=i.anchorOffset,o=i.focusNode;i=i.focusOffset;try{r.nodeType,o.nodeType}catch{r=null;break a}var s=0,c=-1,l=-1,u=0,d=0,f=e,p=null;b:for(;;){for(var m;f!==r||a!==0&&f.nodeType!==3||(c=s+a),f!==o||i!==0&&f.nodeType!==3||(l=s+i),f.nodeType===3&&(s+=f.nodeValue.length),(m=f.firstChild)!==null;)p=f,f=m;for(;;){if(f===e)break b;if(p===r&&++u===a&&(c=s),p===o&&++d===i&&(l=s),(m=f.nextSibling)!==null)break;f=p,p=f.parentNode}f=m}r=c===-1||l===-1?null:{start:c,end:l}}else r=null}r||={start:0,end:0}}else r=null;for(lp={focusedElem:e,selectionRange:r},gh=!1,n=(n&335544064)===n,cu=t,t=n?9270:1024;cu!==null;){if(e=cu,n&&(r=e.deletions,r!==null))for(a=0;a<r.length;a++)n&&Zl(r[a]);if(e.alternate===null&&e.flags&2)n&&Hl(e),mu(n);else{if(e.tag===22){if(r=e.alternate,e.memoizedState!==null){r!==null&&r.memoizedState===null&&n&&Zl(r),mu(n);continue}if(r!==null&&r.memoizedState!==null){n&&Hl(e),mu(n);continue}}r=e.child,(e.subtreeFlags&t)!==0&&r!==null?(r.return=e,cu=r):(n&&Ql(e),mu(n))}}Vl=null}function mu(e){for(;cu!==null;){var t=cu,n=e,r=t.alternate,i=t.flags;switch(t.tag){case 0:case 11:case 15:break;case 1:if(i&1024&&r!==null){n=void 0,i=r.memoizedProps,r=r.memoizedState;var a=t.stateNode;try{var o=wc(t.type,i);n=a.getSnapshotBeforeUpdate(o,r),a.__reactInternalSnapshotBeforeUpdate=n}catch(e){pf(t,t.return,e)}}break;case 3:if(i&1024){if(r=t.stateNode.containerInfo,n=r.nodeType,n===9)$(r);else if(n===1)switch(r.nodeName){case`HEAD`:case`HTML`:case`BODY`:$(r);break;default:r.textContent=``}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;case 30:n&&r!==null&&(n=yi(r.memoizedProps,r.stateNode),i=t.memoizedProps,i=xi(i.default,i.update),i!==`none`&&Gl(r,n,i,r.memoizedState=[],!0));break;default:if(i&1024)throw Error(s(163))}if(r=t.sibling,r!==null){r.return=t.return,cu=r;break}cu=t.return}}function hu(e,t,n){var r=n.flags;switch(n.tag){case 0:case 11:case 15:Fu(e,n),r&4&&Cl(5,n);break;case 1:if(Fu(e,n),r&4){if(e=n.stateNode,t===null)try{e.componentDidMount()}catch(e){pf(n,n.return,e)}else{var i=wc(n.type,t.memoizedProps);t=t.memoizedState;try{e.componentDidUpdate(i,t,e.__reactInternalSnapshotBeforeUpdate)}catch(e){pf(n,n.return,e)}}}r&64&&U(n),r&512&&El(n,n.return);break;case 3:if(Fu(e,n),r&64&&(e=n.updateQueue,e!==null)){if(t=null,n.child!==null)switch(n.child.tag){case 27:case 5:t=n.child.stateNode;break;case 1:t=n.child.stateNode}try{Eo(e,t)}catch(e){pf(n,n.return,e)}}break;case 27:t===null&&r&4&&zl(n);case 26:case 5:Fu(e,n),t===null&&r&4&&Nl(n),r&512&&El(n,n.return);break;case 12:Fu(e,n);break;case 31:Fu(e,n),r&4&&wu(e,n);break;case 13:Fu(e,n),r&4&&Tu(e,n),r&64&&(e=n.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(n=_f.bind(null,n),cm(e,n))));break;case 22:if(r=n.memoizedState!==null||iu,!r){var a=t!==null&&t.memoizedState!==null||G;t=iu,i=G,iu=r,(G=a)&&!i?(r=2,n.subtreeFlags&8772&&(r|=1),Lu(e,n,r)):Fu(e,n),iu=t,G=i}break;case 30:Fu(e,n),r&512&&El(n,n.return);break;case 7:r&512&&El(n,n.return);default:Fu(e,n)}}function gu(e,t){for(e=e.child;e!==null;)_u(e,t),e=e.sibling}function _u(e,t){switch(e.tag){case 5:case 26:try{var n=e.stateNode;if(t){var r=n.style;typeof r.setProperty==`function`?r.setProperty(`display`,`none`,`important`):r.display=`none`}else{var i=e.stateNode,a=e.memoizedProps.style,o=a!=null&&a.hasOwnProperty(`display`)?a.display:null;i.style.display=o==null||typeof o==`boolean`?``:(``+o).trim()}}catch(t){pf(e,e.return,t)}vu(e,t);break;case 6:try{e.stateNode.nodeValue=t?``:e.memoizedProps,P=!0}catch(t){pf(e,e.return,t)}break;case 18:try{var s=e.stateNode;t?Tp(s,!0):Tp(e.stateNode,!1)}catch(t){pf(e,e.return,t)}break;case 22:case 23:e.memoizedState===null&&gu(e,t);break;default:gu(e,t)}}function vu(e,t){if(e.subtreeFlags&67108864)for(e=e.child;e!==null;){a:{var n=e,r=t;switch(n.tag){case 4:_u(n,r);break a;case 22:n.memoizedState===null&&vu(n,r);break a;default:vu(n,r)}}e=e.sibling}}function yu(e){var t=e.alternate;t!==null&&(e.alternate=null,yu(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&It(t)),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}var bu=null,xu=!1;function Su(e,t,n){for(n=n.child;n!==null;)Cu(e,t,n),n=n.sibling}function Cu(e,t,n){if(rt&&typeof rt.onCommitFiberUnmount==`function`)try{rt.onCommitFiberUnmount(nt,n)}catch{}switch(n.tag){case 26:G||Dl(n,t),Su(e,t,n),n.memoizedState?n.memoizedState.count--:n.stateNode&&!G&&(n=n.stateNode,n.parentNode.removeChild(n));break;case 27:G||Dl(n,t),Al(n);var r=bu,i=xu;Cp(n.type)&&(bu=n.stateNode,xu=!1),Su(e,t,n),gm(n.stateNode,n.type,n.memoizedProps),bu=r,xu=i;break;case 5:G||Dl(n,t),Al(n);case 6:if(n.tag===6&&Al(n),r=bu,i=xu,bu=null,Su(e,t,n),bu=r,xu=i,bu!==null){if(xu)try{(bu.nodeType===9?bu.body:bu.nodeName===`HTML`?bu.ownerDocument.body:bu).removeChild(n.stateNode),P=!0}catch(e){pf(n,t,e)}else try{bu.removeChild(n.stateNode),P=!0}catch(e){pf(n,t,e)}}break;case 18:bu!==null&&(xu?(e=bu,wp(e.nodeType===9?e.body:e.nodeName===`HTML`?e.ownerDocument.body:e,n.stateNode),Hh(e)):wp(bu,n.stateNode));break;case 4:r=bu,i=xu,bu=n.stateNode.containerInfo,xu=!0,Su(e,t,n),bu=r,xu=i;break;case 0:case 11:case 14:case 15:wl(2,n,t),G||wl(4,n,t),Su(e,t,n);break;case 1:G||(Dl(n,t),r=n.stateNode,typeof r.componentWillUnmount==`function`&&Tl(n,t,r)),Su(e,t,n);break;case 21:Su(e,t,n);break;case 22:G=(r=G)||n.memoizedState!==null,Su(e,t,n),G=r;break;case 30:Dl(n,t),Su(e,t,n);break;case 7:G||Dl(n,t),Su(e,t,n);break;default:Su(e,t,n)}}function wu(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{Hh(e)}catch(e){pf(t,t.return,e)}}}function Tu(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{Hh(e)}catch(e){pf(t,t.return,e)}}function Eu(e){switch(e.tag){case 31:case 13:case 19:var t=e.stateNode;return t===null&&(t=e.stateNode=new su),t;case 22:return e=e.stateNode,t=e._retryCache,t===null&&(t=e._retryCache=new su),t;default:throw Error(s(435,e.tag))}}function Du(e,t){var n=Eu(e);t.forEach(function(t){if(!n.has(t)){n.add(t);var r=vf.bind(null,e,t);t.then(r,r)}})}function Ou(e,t,n){var r=t.deletions;if(r!==null)for(var i=0;i<r.length;i++){var a=r[i],o=e,c=t,l=c;a:for(;l!==null;){switch(l.tag){case 27:if(Cp(l.type)){bu=l.stateNode,xu=!1;break a}break;case 5:bu=l.stateNode,xu=!1;break a;case 3:case 4:bu=l.stateNode.containerInfo,xu=!0;break a}l=l.return}if(bu===null)throw Error(s(160));Cu(o,c,a),bu=null,xu=!1,o=a.alternate,o!==null&&(o.return=null),a.return=null}if(t.subtreeFlags&13886)for(t=t.child;t!==null;)Au(t,e,n),t=t.sibling}var ku=null;function Au(e,t,n){var r=e.alternate,i=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:if(i&4&&(r=e.updateQueue,r=r===null?null:r.events,r!==null))for(var a=0;a<r.length;a++){var o=r[a];o.ref.impl=o.nextImpl}Ou(t,e,n),ju(e),i&4&&(wl(3,e,e.return),Cl(3,e),wl(5,e,e.return));break;case 1:Ou(t,e,n),ju(e),i&512&&(G||r===null||Dl(r,r.return)),i&64&&iu&&(e=e.updateQueue,e!==null&&(t=e.callbacks,t!==null&&(n=e.shared.hiddenCallbacks,e.shared.hiddenCallbacks=n===null?t:n.concat(t))));break;case 26:if(a=ku,Ou(t,e,n),ju(e),i&512&&(G||r===null||Dl(r,r.return)),i&4){if(i=r===null?null:r.memoizedState,n=e.memoizedState,r===null){if(n===null){if(e.stateNode===null){if(iu)e.stateNode=pp(e.type,e.memoizedProps,t.containerInfo,e);else{a:{t=e.type,n=e.memoizedProps,i=a.ownerDocument||a;b:switch(t){case`title`:r=i.getElementsByTagName(`title`)[0],(!r||r[Pt]||r[Ot]||r.namespaceURI===`http://www.w3.org/2000/svg`||r.hasAttribute(`itemprop`))&&(r=i.createElement(t),i.head.insertBefore(r,i.querySelector(`head > title`))),rp(r,t,n),r[Ot]=e,Vt(r),t=r;break a;case`link`:if(a=Gm(`link`,`href`,i).get(t+(n.href||``))){for(o=0;o<a.length;o++)if(r=a[o],r.getAttribute(`href`)===(n.href==null||n.href===``?null:n.href)&&r.getAttribute(`rel`)===(n.rel==null?null:n.rel)&&r.getAttribute(`title`)===(n.title==null?null:n.title)&&r.getAttribute(`crossorigin`)===(n.crossOrigin==null?null:n.crossOrigin)){a.splice(o,1);break b}}r=i.createElement(t),rp(r,t,n),i.head.appendChild(r);break;case`meta`:if(a=Gm(`meta`,`content`,i).get(t+(n.content||``))){for(o=0;o<a.length;o++)if(r=a[o],r.getAttribute(`content`)===(n.content==null?null:``+n.content)&&r.getAttribute(`name`)===(n.name==null?null:n.name)&&r.getAttribute(`property`)===(n.property==null?null:n.property)&&r.getAttribute(`http-equiv`)===(n.httpEquiv==null?null:n.httpEquiv)&&r.getAttribute(`charset`)===(n.charSet==null?null:n.charSet)){a.splice(o,1);break b}}r=i.createElement(t),rp(r,t,n),i.head.appendChild(r);break;default:throw Error(s(468,t))}r[Ot]=e,Vt(r),t=r}e.stateNode=t}}else iu||Km(a,e.type,e.stateNode)}else e.stateNode=Bm(a,n,e.memoizedProps)}else i===n?n===null&&e.stateNode!==null&&Pl(e,e.memoizedProps,r.memoizedProps):(i===null?(t=r.stateNode,t===null||G||t.parentNode.removeChild(t)):i.count--,n===null?iu||Km(a,e.type,e.stateNode):Bm(a,n,e.memoizedProps))}break;case 27:Ou(t,e,n),ju(e),i&512&&(G||r===null||Dl(r,r.return)),r!==null&&i&4&&Pl(e,e.memoizedProps,r.memoizedProps);break;case 5:if(a=au,au=!1,Ou(t,e,n),au=a,ju(e),i&512&&(G||r===null||Dl(r,r.return)),e.flags&32){t=e.stateNode;try{pn(t,``),P=!0}catch(t){pf(e,e.return,t)}}i&4&&e.stateNode!=null&&(t=e.memoizedProps,Pl(e,t,r===null?t:r.memoizedProps)),i&1024&&(ou=!0);break;case 6:if(Ou(t,e,n),ju(e),i&4){if(e.stateNode===null)throw Error(s(162));t=e.memoizedProps,n=e.stateNode;try{n.nodeValue=t,P=!0}catch(t){pf(e,e.return,t)}}break;case 3:if(P=!1,Wm=null,a=ku,ku=bm(t.containerInfo),Ou(t,e,n),ku=a,ju(e),i&4&&r!==null&&r.memoizedState.isDehydrated)try{Hh(t.containerInfo)}catch(t){pf(e,e.return,t)}ou&&(ou=!1,Mu(e)),P=!1;break;case 4:i=au,au=iu,r=Zt(),a=ku,ku=bm(e.stateNode.containerInfo),Ou(t,e,n),ju(e),ku=a,P&&uu&&(du=!0),P=r,au=i;break;case 12:Ou(t,e,n),ju(e);break;case 31:Ou(t,e,n),ju(e),i&4&&(t=e.updateQueue,t!==null&&(e.updateQueue=null,Du(e,t)));break;case 13:Ou(t,e,n),ju(e),e.child.flags&8192&&e.memoizedState!==null!=(r!==null&&r.memoizedState!==null)&&(hd=qe()),i&4&&(t=e.updateQueue,t!==null&&(e.updateQueue=null,Du(e,t)));break;case 22:a=e.memoizedState!==null,o=r!==null&&r.memoizedState!==null;var c=iu,l=G,u=au;iu=c||a,au=u||a,G=l||o,Ou(t,e,n),G=l,au=u,iu=c,ju(e),i&8192&&(t=e.stateNode,t._visibility=a?t._visibility&-2:t._visibility|1,!a||r===null||o||iu||G||(t=o||G,n=iu,r=G,iu=a||iu,G=t,Iu(e,2),iu=n,G=r),!a&&au||gu(e,a)),i&4&&(t=e.updateQueue,t!==null&&(n=t.retryQueue,n!==null&&(t.retryQueue=null,Du(e,n))));break;case 19:Ou(t,e,n),ju(e),i&4&&(t=e.updateQueue,t!==null&&(e.updateQueue=null,Du(e,t)));break;case 30:i&512&&(G||r===null||Dl(r,r.return)),i=Zt(),a=uu,o=(n&335544064)===n,c=e.memoizedProps,uu=o&&xi(c.default,c.update)!==`none`,Ou(t,e,n),ju(e),o&&r!==null&&P&&(e.flags|=4),uu=a,P=i;break;case 21:break;case 7:i&512&&(G||r===null||Dl(r,r.return)),r&&r.stateNode!==null&&(r.stateNode._fragmentFiber=e);default:Ou(t,e,n),ju(e)}}function ju(e){var t=e.flags;if(t&2){try{for(var n,r=e.return;r!==null;){if(Fl(r)){n=r;break}r=r.return}r=null;for(var i=e.return;i!==null;){if(Ml(i)){var a=i.stateNode;r===null?r=[a]:r.push(a)}if(jl(i))break;i=i.return}var o=r;if(n==null)throw Error(s(160));switch(n.tag){case 27:var c=n.stateNode;Rl(e,Il(e),c,o);break;case 5:var l=n.stateNode;n.flags&32&&(pn(l,``),n.flags&=-33),Rl(e,Il(e),l,o);break;case 3:case 4:var u=n.stateNode.containerInfo;Ll(e,Il(e),u,o);break;default:throw Error(s(161))}}catch(t){pf(e,e.return,t)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function Mu(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var t=e;Mu(t),t.tag===5&&t.flags&1024&&(t=t.stateNode,gh=!0,t.reset(),gh=!1),e=e.sibling}}function Nu(e,t){if(t.subtreeFlags&9270)for(t=t.child;t!==null;)Pu(t,e),t=t.sibling;else ru(t,!1)}function Pu(e,t){var n=e.alternate;if(n===null)Yl(e,!1);else switch(e.tag){case 3:if(fu=lu=!1,W(),Nu(t,e),!lu&&!du){if(e=Ul,e!==null)for(var r=0;r<e.length;r+=3){n=e[r];var i=e[r+1];Dp(n,e[r+2]),n=n.ownerDocument.documentElement,n!==null&&n.animate({opacity:[0,0],pointerEvents:[`none`,`none`]},{duration:0,fill:`forwards`,pseudoElement:`::view-transition-group(`+i+`)`})}e=t.containerInfo,e=e.nodeType===9?e.documentElement:e.ownerDocument.documentElement,e!==null&&e.style.viewTransitionName===``&&(e.style.viewTransitionName=`none`,e.animate({opacity:[0,0],pointerEvents:[`none`,`none`]},{duration:0,fill:`forwards`,pseudoElement:`::view-transition-group(root)`}),e.animate({width:[0,0],height:[0,0]},{duration:0,fill:`forwards`,pseudoElement:`::view-transition`})),fu=!0}Ul=null;break;case 5:Nu(t,e);break;case 4:r=lu,lu=!1,Nu(t,e),lu&&(du=!0),lu=r;break;case 22:e.memoizedState===null&&(n.memoizedState===null?Nu(t,e):Yl(e,!1));break;case 30:r=lu,i=W(),lu=!1,Nu(t,e),lu&&(e.flags|=4);var a=e.memoizedProps,o=e.stateNode;t=yi(a,o),o=yi(n.memoizedProps,o);var s=xi(a.default,a.update);s===`none`?t=!1:(a=n.memoizedState,n.memoizedState=null,n=e.child,Wl=0,t=nu(e,n,t,o,s,a,!0),Wl!==(a===null?0:a.length)&&(e.flags|=32)),e.flags&4&&t?(Nd(e,e.memoizedProps.onUpdate),Ul=i):i!==null&&(i.push.apply(i,Ul),Ul=i),lu=e.flags&32?!0:r;break;default:Nu(t,e)}}function Fu(e,t){if(t.subtreeFlags&8772)for(t=t.child;t!==null;)hu(e,t.alternate,t),t=t.sibling}function Iu(e,t){for(e=e.child;e!==null;){var n=e,r=t;switch(n.tag){case 0:case 11:case 14:case 15:wl(4,n,n.return),Iu(n,r);break;case 1:Dl(n,n.return);var i=n.stateNode;typeof i.componentWillUnmount==`function`&&Tl(n,n.return,i),Iu(n,r);break;case 27:r&2&&gm(n.stateNode,n.type,n.memoizedProps);case 5:Dl(n,n.return),n.tag!==5&&n.tag!==27||Al(n),Iu(n,r);break;case 6:Al(n);break;case 26:Dl(n,n.return),i=n.stateNode,n.memoizedState!==null||i===null||G||i.parentNode.removeChild(i),Iu(n,r);break;case 22:n.memoizedState===null&&Iu(n,r);break;case 30:Dl(n,n.return),Iu(n,r);break;case 7:Dl(n,n.return);default:Iu(n,r)}e=e.sibling}}function Lu(e,t,n){for(n=t.subtreeFlags&8772?n:n&-2,t=t.child;t!==null;){var r=t.alternate,i=e,a=t,o=a.flags,s=!!(n&1);switch(a.tag){case 0:case 11:case 15:Lu(i,a,n),Cl(4,a);break;case 1:if(Lu(i,a,n),r=a,i=r.stateNode,typeof i.componentDidMount==`function`)try{i.componentDidMount()}catch(e){pf(r,r.return,e)}if(r=a,i=r.updateQueue,i!==null){var c=r.stateNode;try{var l=i.shared.hiddenCallbacks;if(l!==null)for(i.shared.hiddenCallbacks=null,i=0;i<l.length;i++)To(l[i],c)}catch(e){pf(r,r.return,e)}}s&&o&64&&U(a),El(a,a.return);break;case 27:n&2&&zl(a);case 5:a.tag!==5&&a.tag!==27||kl(a),Lu(i,a,n),s&&r===null&&o&4&&Nl(a),El(a,a.return);break;case 6:kl(a);break;case 26:c=a.stateNode,a.memoizedState!==null||c===null||iu||Km(bm(c.ownerDocument),a.type,c),Lu(i,a,n),s&&r===null&&o&4&&Nl(a),El(a,a.return);break;case 12:Lu(i,a,n);break;case 31:Lu(i,a,n),s&&o&4&&wu(i,a);break;case 13:Lu(i,a,n),s&&o&4&&Tu(i,a);break;case 22:a.memoizedState===null&&Lu(i,a,n),El(a,a.return);break;case 30:Lu(i,a,n),El(a,a.return);break;case 7:El(a,a.return);default:Lu(i,a,n)}t=t.sibling}}function Ru(e,t){var n=null;e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(n=e.memoizedState.cachePool.pool),e=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(e=t.memoizedState.cachePool.pool),e!==n&&(e!=null&&e.refCount++,n!=null&&Pa(n))}function zu(e,t){e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&Pa(e))}function Bu(e,t,n,r){var i=(n&335544064)===n;if(t.subtreeFlags&(i?10262:10256))for(t=t.child;t!==null;)Vu(e,t,n,r),t=t.sibling;else i&&tu(t)}function Vu(e,t,n,r){var i=(n&335544064)===n;i&&t.alternate===null&&t.return!==null&&t.return.alternate!==null&&eu(t);var a=t.flags;switch(t.tag){case 0:case 11:case 15:Bu(e,t,n,r),a&2048&&Cl(9,t);break;case 1:Bu(e,t,n,r);break;case 3:Bu(e,t,n,r),i&&fu&&(e=e.containerInfo,e=e.nodeType===9?e.body:e.nodeName===`HTML`?e.ownerDocument.body:e,e.style.viewTransitionName===`root`&&(e.style.viewTransitionName=``),e=e.ownerDocument.documentElement,e!==null&&e.style.viewTransitionName===`none`&&(e.style.viewTransitionName=``)),a&2048&&(a=null,t.alternate!==null&&(a=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==a&&(t.refCount++,a!=null&&Pa(a)));break;case 12:if(a&2048){Bu(e,t,n,r),a=t.stateNode;try{var o=t.memoizedProps,s=o.id,c=o.onPostCommit;typeof c==`function`&&c(s,t.alternate===null?`mount`:`update`,a.passiveEffectDuration,-0)}catch(e){pf(t,t.return,e)}}else Bu(e,t,n,r);break;case 31:Bu(e,t,n,r);break;case 13:Bu(e,t,n,r);break;case 23:break;case 22:o=t.stateNode,s=t.alternate,t.memoizedState===null?(i&&s!==null&&s.memoizedState!==null&&eu(t),o._visibility&2?Bu(e,t,n,r):(o._visibility|=2,Hu(e,t,n,r,!!(t.subtreeFlags&10256)||!1))):(i&&s!==null&&s.memoizedState===null&&eu(s),o._visibility&2?Bu(e,t,n,r):Uu(e,t)),a&2048&&Ru(s,t);break;case 24:Bu(e,t,n,r),a&2048&&zu(t.alternate,t);break;case 30:i&&(a=t.alternate,a!==null&&(ql(a.child,!0),ql(t.child,!0))),Bu(e,t,n,r);break;default:Bu(e,t,n,r)}}function Hu(e,t,n,r,i){for(i&&=!!(t.subtreeFlags&10256)||!1,t=t.child;t!==null;){var a=e,o=t,s=n,c=r,l=o.flags;switch(o.tag){case 0:case 11:case 15:Hu(a,o,s,c,i),Cl(8,o);break;case 23:break;case 22:var u=o.stateNode;o.memoizedState===null?(u._visibility|=2,Hu(a,o,s,c,i)):u._visibility&2?Hu(a,o,s,c,i):Uu(a,o),i&&l&2048&&Ru(o.alternate,o);break;case 24:Hu(a,o,s,c,i),i&&l&2048&&zu(o.alternate,o);break;default:Hu(a,o,s,c,i)}t=t.sibling}}function Uu(e,t){if(t.subtreeFlags&10256)for(t=t.child;t!==null;){var n=e,r=t,i=r.flags;switch(r.tag){case 22:Uu(n,r),i&2048&&Ru(r.alternate,r);break;case 24:Uu(n,r),i&2048&&zu(r.alternate,r);break;default:Uu(n,r)}t=t.sibling}}var Wu=8192;function Gu(e,t,n){if(e.subtreeFlags&Wu)for(e=e.child;e!==null;)Ku(e,t,n),e=e.sibling}function Ku(e,t,n){switch(e.tag){case 26:Gu(e,t,n),e.flags&Wu&&(e.memoizedState===null?(e=e.stateNode,(t&335544128)===t&&Zm(n,e)):Qm(n,ku,e.memoizedState,e.memoizedProps));break;case 5:Gu(e,t,n),e.flags&Wu&&(e=e.stateNode,(t&335544128)===t&&Zm(n,e));break;case 3:case 4:var r=ku;ku=bm(e.stateNode.containerInfo),Gu(e,t,n),ku=r;break;case 22:e.memoizedState===null&&(r=e.alternate,r!==null&&r.memoizedState!==null?(r=Wu,Wu=16777216,Gu(e,t,n),Wu=r):Gu(e,t,n));break;case 30:if((e.flags&Wu)!==0&&(r=e.memoizedProps.name,r!=null&&r!==`auto`)){var i=e.stateNode;i.paired=null,Vl===null&&(Vl=new Map),Vl.set(r,i)}Gu(e,t,n);break;default:Gu(e,t,n)}}function qu(e){var t=e.alternate;if(t!==null&&(e=t.child,e!==null)){t.child=null;do t=e.sibling,e.sibling=null,e=t;while(e!==null)}}function Ju(e){var t=e.deletions;if(e.flags&16){if(t!==null)for(var n=0;n<t.length;n++){var r=t[n];cu=r,Zu(r,e)}qu(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)Yu(e),e=e.sibling}function Yu(e){switch(e.tag){case 0:case 11:case 15:Ju(e),e.flags&2048&&wl(9,e,e.return);break;case 3:Ju(e);break;case 12:Ju(e);break;case 22:var t=e.stateNode;e.memoizedState!==null&&t._visibility&2&&(e.return===null||e.return.tag!==13)?(t._visibility&=-3,Xu(e)):Ju(e);break;default:Ju(e)}}function Xu(e){var t=e.deletions;if(e.flags&16){if(t!==null)for(var n=0;n<t.length;n++){var r=t[n];cu=r,Zu(r,e)}qu(e)}for(e=e.child;e!==null;){switch(t=e,t.tag){case 0:case 11:case 15:wl(8,t,t.return),Xu(t);break;case 22:n=t.stateNode,n._visibility&2&&(n._visibility&=-3,Xu(t));break;default:Xu(t)}e=e.sibling}}function Zu(e,t){for(;cu!==null;){var n=cu;switch(n.tag){case 0:case 11:case 15:wl(8,n,t);break;case 23:case 22:if(n.memoizedState!==null&&n.memoizedState.cachePool!==null){var r=n.memoizedState.cachePool.pool;r!=null&&r.refCount++}break;case 24:Pa(n.memoizedState.cache)}if(r=n.child,r!==null)r.return=n,cu=r;else a:for(n=e;cu!==null;){r=cu;var i=r.sibling,a=r.return;if(yu(r),r===n){cu=null;break a}if(i!==null){i.return=a,cu=i;break a}cu=a}}}var Qu={getCacheForType:function(e){var t=Ea(Ma),n=t.data.get(e);return n===void 0&&(n=e(),t.data.set(e,n)),n},cacheSignal:function(){return Ea(Ma).controller.signal}},$u=typeof WeakMap==`function`?WeakMap:Map,K=0,ed=null,q=null,J=0,td=0,nd=null,rd=!1,id=!1,ad=!1,od=0,sd=0,cd=0,ld=0,Y=0,ud=0,dd=0,fd=null,pd=null,md=!1,hd=0,gd=0,_d=1/0,vd=null,yd=null,X=0,bd=null,xd=null,Sd=0,Cd=0,wd=null,Td=null,Ed=null,Dd=null,Od=null,kd=0,Ad=null;function jd(){return K&2&&J!==0?J&-J:A.T===null?Tt():Pf()}function Md(){if(ud===0){if(!(J&536870912)||z){var e=lt;lt<<=1,!(lt&3932160)&&(lt=262144),ud=e}else ud=536870912}return e=Mo.current,e!==null&&(e.flags|=32),ud}function Nd(e,t){if(t!=null){var n=e.stateNode,r=n.ref;r===null&&(r=n.ref=Fp(yi(e.memoizedProps,n))),Dd===null&&(Dd=[]),Dd.push(t.bind(null,r))}}function Pd(e,t,n){(e===ed&&(td===2||td===9)||e.cancelPendingCommit!==null)&&(Vd(e,0),Rd(e,J,ud,!1)),vt(e,n),K&2&&e===ed||(e===ed&&(!(K&2)&&(ld|=n),sd===4&&Rd(e,J,ud,!1)),Ef(e))}function Fd(e,t,n){if(K&6)throw Error(s(327));var r=!n&&!(t&127)&&(t&e.expiredLanes)===0||pt(e,t),i=r?Yd(e,t):qd(e,t,!0),a=r;do{if(i===0){id&&!r&&Rd(e,t,0,!1);break}if(n=e.current.alternate,a&&!Ld(n))i=qd(e,t,!1),a=!1;else{if(i===2){if(a=t,e.errorRecoveryDisabledLanes&a)var o=0;else o=e.pendingLanes&-536870913,o=o===0?o&536870912?536870912:0:o;if(o!==0){t=o;a:{var c=e;i=fd;var l=c.current.memoizedState.isDehydrated;if(l&&(Vd(c,o).flags|=256),o=qd(c,o,!1),o!==2&&o!==6){if(ad&&!l){c.errorRecoveryDisabledLanes|=a,ld|=a,i=4;break a}a=pd,pd=i,a!==null&&(pd===null?pd=a:pd.push.apply(pd,a))}i=o}if(a=!1,i!==2)continue}}if(i===1){Vd(e,0),Rd(e,t,0,!0);break}a:{switch(r=e,a=i,a){case 0:case 1:throw Error(s(345));case 4:if((t&4194048)!==t&&(t&62914560)!==t)break;case 6:Rd(r,t,ud,!rd);break a;case 2:pd=null;break;case 3:case 5:break;default:throw Error(s(329))}if((t&62914560)===t&&(i=hd+300-qe(),10<i)){if(Rd(r,t,ud,!rd),ft(r,0,!0)!==0)break a;Sd=t,r.timeoutHandle=_p(Id.bind(null,r,n,pd,vd,md,t,ud,ld,dd,rd,a,`Throttled`,-0,0),i);break a}Id(r,n,pd,vd,md,t,ud,ld,dd,rd,a,null,-0,0)}break}}while(1);Ef(e)}function Id(e,t,n,r,i,a,o,s,c,l,u,d,f,p){e.timeoutHandle=-1;var m=t.subtreeFlags,h=(a&335544064)===a;d=null,(h||m&8192||(m&16785408)==16785408)&&(d={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:xn},Vl=null,Ku(t,a,d),h&&(m=d,h=e.containerInfo,h=(h.nodeType===9?h:h.ownerDocument).__reactViewTransition,h!=null&&(m.count++,m.waitingForViewTransition=!0,m=nh.bind(m),h.finished.then(m,m))),m=(a&62914560)===a?hd-qe():(a&4194048)===a?gd-qe():0,m=eh(d,m),m!==null)?(Sd=a,e.cancelPendingCommit=m(nf.bind(null,e,t,a,n,r,i,o,s,c,l,u,d,null,f,p)),Rd(e,a,o,!l)):nf(e,t,a,n,r,i,o,s,c,l,u,d)}function Ld(e){for(var t=e;;){var n=t.tag;if((n===0||n===11||n===15)&&t.flags&16384&&(n=t.updateQueue,n!==null&&(n=n.stores,n!==null)))for(var r=0;r<n.length;r++){var i=n[r],a=i.getSnapshot;i=i.value;try{if(!Wr(a(),i))return!1}catch{return!1}}if(n=t.child,t.subtreeFlags&16384&&n!==null)n.return=t,t=n;else{if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return!0;t=t.return}t.sibling.return=t.return,t=t.sibling}}return!0}function Rd(e,t,n,r){t=mt(e,t),t&=~Y,t&=~ld,e.suspendedLanes|=t,e.pingedLanes&=~t,r&&(e.warmLanes|=t),r=e.expirationTimes;for(var i=t;0<i;){var a=31-at(i),o=1<<a;r[a]=-1,i&=~o}n!==0&&bt(e,n,t)}function zd(){return K&6?!0:(Df(0,!1),!1)}function Bd(){if(q!==null){if(td===0)var e=q.return;else e=q,va=_a=null,ss(e),oo=null,so=0,e=q;for(;e!==null;)Sl(e.alternate,e),e=e.return;q=null}}function Vd(e,t){var n=e.timeoutHandle;return n!==-1&&(e.timeoutHandle=-1,vp(n)),n=e.cancelPendingCommit,n!==null&&(e.cancelPendingCommit=null,n()),Sd=0,Bd(),ed=e,q=n=Fi(e.current,null),J=t,td=0,nd=null,rd=!1,id=pt(e,t),ad=!1,dd=ud=Y=ld=cd=sd=0,pd=fd=null,md=!1,od=mt(e,t),Ti(),n}function Hd(e,t){B=null,A.H=gc,t===Xa||t===Qa?(t=io(),td=3):t===Za?(t=io(),td=4):td=t===Pc?8:typeof t==`object`&&t&&typeof t.then==`function`?6:1,nd=t,q===null&&(sd=1,Oc(e,Ui(t,e.current)))}function Ud(){var e=Mo.current;return e===null?!0:(J&4194048)===J?No===null:(J&62914560)===J||J&536870912?e===No:!1}function Wd(){var e=A.H;return A.H=gc,e===null?gc:e}function Gd(){var e=A.A;return A.A=Qu,e}function Kd(){sd=4,rd||(J&4194048)!==J&&Mo.current!==null||(id=!0),!(cd&134217727)&&!(ld&134217727)||ed===null||Rd(ed,J,ud,!1)}function qd(e,t,n){var r=K;K|=2;var i=Wd(),a=Gd();(ed!==e||J!==t)&&(vd=null,Vd(e,t)),t=!1;var o=sd;a:do try{if(td!==0&&q!==null){var s=q,c=nd;switch(td){case 8:Bd(),o=6;break a;case 3:case 2:case 9:case 6:Mo.current===null&&(t=!0);var l=td;if(td=0,nd=null,$d(e,s,c,l),n&&id){o=0;break a}break;default:l=td,td=0,nd=null,$d(e,s,c,l)}}Jd(),o=sd;break}catch(t){Hd(e,t)}while(1);return t&&e.shellSuspendCounter++,va=_a=null,K=r,A.H=i,A.A=a,q===null&&(ed=null,J=0,Ti()),o}function Jd(){for(;q!==null;)Zd(q)}function Yd(e,t){var n=K;K|=2;var r=Wd(),i=Gd();ed!==e||J!==t?(vd=null,_d=qe()+500,Vd(e,t)):id=pt(e,t);a:do try{if(td!==0&&q!==null){t=q;var a=nd;b:switch(td){case 1:td=0,nd=null,$d(e,t,a,1);break;case 2:case 9:if(eo(a)){td=0,nd=null,Qd(t);break}t=function(){td!==2&&td!==9||ed!==e||(td=7),Ef(e)},a.then(t,t);break a;case 3:td=7;break a;case 4:td=5;break a;case 7:eo(a)?(td=0,nd=null,Qd(t)):(td=0,nd=null,$d(e,t,a,7));break;case 5:var o=null;switch(q.tag){case 26:o=q.memoizedState;case 5:case 27:var c=q;if(o?Ym(o):c.stateNode.complete){td=0,nd=null;var l=c.sibling;if(l!==null)q=l;else{var u=c.return;u===null?q=null:(q=u,ef(u))}break b}}td=0,nd=null,$d(e,t,a,5);break;case 6:td=0,nd=null,$d(e,t,a,6);break;case 8:Bd(),sd=6;break a;default:throw Error(s(462))}}Xd();break}catch(t){Hd(e,t)}while(1);return va=_a=null,A.H=r,A.A=i,K=n,q===null?(ed=null,J=0,Ti(),sd):0}function Xd(){for(;q!==null&&!Ge();)Zd(q)}function Zd(e){var t=pl(e.alternate,e,od);e.memoizedProps=e.pendingProps,t===null?ef(e):q=t}function Qd(e){var t=e,n=t.alternate;switch(t.tag){case 15:case 0:t=qc(n,t,t.pendingProps,t.type,void 0,J);break;case 11:t=qc(n,t,t.pendingProps,t.type.render,t.ref,J);break;case 5:ss(t);var r=t;r===ia&&(z?(da(r),r.tag===5&&r.stateNode!=null&&(aa=r.stateNode)):(da(r),z=!0));default:Sl(n,t),t=q=Ii(t,od),t=pl(n,t,od)}e.memoizedProps=e.pendingProps,t===null?ef(e):q=t}function $d(e,t,n,r){va=_a=null,ss(t),oo=null,so=0;var i=t.return;try{if(Nc(e,i,t,n,J)){sd=1,Oc(e,Ui(n,e.current)),q=null;return}}catch(t){if(i!==null)throw q=i,t;sd=1,Oc(e,Ui(n,e.current)),q=null;return}t.flags&32768?(z||r===1?e=!0:id||J&536870912?e=!1:(rd=e=!0,(r===2||r===9||r===3||r===6)&&(r=Mo.current,r!==null&&r.tag===13&&(r.flags|=16384))),tf(t,e)):ef(t)}function ef(e){var t=e;do{if(t.flags&32768){tf(t,rd);return}e=t.return;var n=bl(t.alternate,t,od);if(n!==null){q=n;return}if(t=t.sibling,t!==null){q=t;return}q=t=e}while(t!==null);sd===0&&(sd=5)}function tf(e,t){do{var n=xl(e.alternate,e);if(n!==null){n.flags&=32767,q=n;return}if(n=e.return,n!==null&&(n.flags|=32768,n.subtreeFlags=0,n.deletions=null),!t&&(e=e.sibling,e!==null)){q=e;return}q=e=n}while(e!==null);sd=6,q=null}function nf(e,t,n,r,i,a,o,c,l,u,d,f){e.cancelPendingCommit=null;do uf();while(X!==0);if(K&6)throw Error(s(327));if(t!==null){if(t===e.current)throw Error(s(177));e===ed&&(q=ed=null,J=0),xd=t,bd=e,Sd=n,wd=i,Td=r,rf(e,t,n,o,c,l,f)}}function rf(e,t,n,r,i,a,o){var s=t.lanes|t.childLanes;if(Cd=s,s|=wi,yt(e,n,s,r,i,a),Dd=null,(n&335544064)===n?(Od=La(e),r=10262):(Od=null,r=10256),(t.subtreeFlags&r)!==0||(t.flags&r)!==0?(e.callbackNode=null,e.callbackPriority=0,yf(Ze,function(){return df(),null})):(e.callbackNode=null,e.callbackPriority=0),Bl=!1,r=!!(t.flags&13878),t.subtreeFlags&13878||r){r=A.T,A.T=null,i=j.p,j.p=2,a=K,K|=4;try{pu(e,t,n)}finally{K=a,j.p=i,A.T=r}}X=1,Bl?Ed=Np(o,e.containerInfo,Od,of,sf,Z,cf,df,af,null,null):(of(),sf(),cf())}function af(e){if(X!==0){var t=bd.onRecoverableError;t(e,{componentStack:null})}}function Z(){X===3&&(X=0,Pu(xd,bd),X=4)}function of(){if(X===1){X=0;var e=bd,t=xd,n=Sd,r=!!(t.flags&13878);if(t.subtreeFlags&13878||r){r=A.T,A.T=null;var i=j.p;j.p=2;var a=K;K|=4;try{uu=du=!1,Au(t,e,n),n=lp;var o=Xr(e.containerInfo),s=n.focusedElem,c=n.selectionRange;if(o!==s&&s&&s.ownerDocument&&Yr(s.ownerDocument.documentElement,s)){if(c!==null&&Zr(s)){var l=c.start,u=c.end;if(u===void 0&&(u=l),`selectionStart`in s)s.selectionStart=l,s.selectionEnd=Math.min(u,s.value.length);else{var d=s.ownerDocument||document,f=d&&d.defaultView||window;if(f.getSelection){var p=f.getSelection(),m=s.textContent.length,h=Math.min(c.start,m),g=c.end===void 0?h:Math.min(c.end,m);!p.extend&&h>g&&(o=g,g=h,h=o);var _=Jr(s,h),v=Jr(s,g);if(_&&v&&(p.rangeCount!==1||p.anchorNode!==_.node||p.anchorOffset!==_.offset||p.focusNode!==v.node||p.focusOffset!==v.offset)){var y=d.createRange();y.setStart(_.node,_.offset),p.removeAllRanges(),h>g?(p.addRange(y),p.extend(v.node,v.offset)):(y.setEnd(v.node,v.offset),p.addRange(y))}}}}for(d=[],p=s;p=p.parentNode;)p.nodeType===1&&d.push({element:p,left:p.scrollLeft,top:p.scrollTop});for(typeof s.focus==`function`&&s.focus(),s=0;s<d.length;s++){var b=d[s];b.element.scrollLeft=b.left,b.element.scrollTop=b.top}}gh=!!cp,lp=cp=null}finally{K=a,j.p=i,A.T=r}}e.current=t,X=2}}function sf(){if(X===2){X=0;var e=bd,t=xd,n=!!(t.flags&8772);if(t.subtreeFlags&8772||n){n=A.T,A.T=null;var r=j.p;j.p=2;var i=K;K|=4;try{hu(e,t.alternate,t)}finally{K=i,j.p=r,A.T=n}}X=3}}function cf(){if(X===4||X===3){X=0;var e=Ed;Ed=null,Ke();var t=bd,n=xd,r=Sd,i=Td,a=(r&335544064)===r?10262:10256;if((n.subtreeFlags&a)!==0||(n.flags&a)!==0?X=5:(X=0,xd=bd=null,lf(t,t.pendingLanes)),a=t.pendingLanes,a===0&&(yd=null),wt(r),n=n.stateNode,rt&&typeof rt.onCommitFiberRoot==`function`)try{rt.onCommitFiberRoot(nt,n,void 0,(n.current.flags&128)==128)}catch{}if(i!==null){n=A.T,a=j.p,j.p=2,A.T=null;try{for(var o=t.onRecoverableError,s=0;s<i.length;s++){var c=i[s];o(c.value,{componentStack:c.stack})}}finally{A.T=n,j.p=a}}if(i=Dd,o=Od,Od=null,i!==null&&(Dd=null,o===null&&(o=[]),e!==null))for(c=0;c<i.length;c++)n=(0,i[c])(o),n!==void 0&&e.finished.finally(n);Sd&3&&uf(),Ef(t),a=t.pendingLanes,r&261930&&a&42?t===Ad?kd++:(kd=0,Ad=t):(kd=0,Ad=null),Df(0,!1)}}function lf(e,t){(e.pooledCacheLanes&=t)===0&&(t=e.pooledCache,t!=null&&(e.pooledCache=null,Pa(t)))}function uf(){return Ed!==null&&(Ed.skipTransition(),Ed=null),of(),sf(),cf(),df()}function df(){if(X!==5)return!1;var e=bd,t=Cd;Cd=0;var n=wt(Sd),r=A.T,i=j.p;try{j.p=32>n?32:n,A.T=null,n=wd,wd=null;var a=bd,o=Sd;if(X=0,xd=bd=null,Sd=0,K&6)throw Error(s(331));var c=K;if(K|=4,Yu(a.current),Vu(a,a.current,o,n),K=c,Df(0,!1),rt&&typeof rt.onPostCommitFiberRoot==`function`)try{rt.onPostCommitFiberRoot(nt,a)}catch{}return!0}finally{j.p=i,A.T=r,lf(e,t)}}function ff(e,t,n){t=Ui(n,t),t=Ac(e.stateNode,t,2),e=yo(e,t,2),e!==null&&(vt(e,2),Ef(e))}function pf(e,t,n){if(e.tag===3)ff(e,e,n);else for(;t!==null;){if(t.tag===3){ff(t,e,n);break}if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError==`function`||typeof r.componentDidCatch==`function`&&(yd===null||!yd.has(r))){e=Ui(n,e),n=jc(2),r=yo(t,n,2),r!==null&&(Mc(n,r,t,e),vt(r,2),Ef(r));break}}t=t.return}}function mf(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new $u;var i=new Set;r.set(t,i)}else i=r.get(t),i===void 0&&(i=new Set,r.set(t,i));i.has(n)||(ad=!0,i.add(n),e=hf.bind(null,e,t,n),t.then(e,e))}function hf(e,t,n){var r=e.pingCache;r!==null&&r.delete(t),e.pingedLanes|=e.suspendedLanes&n,e.warmLanes&=~n,ed===e&&(J&n)===n&&(sd===4||sd===3&&(J&62914560)===J&&300>qe()-hd?K&2?Y|=n:Vd(e,0):Y|=n,dd===J&&(dd=0)),Ef(e)}function gf(e,t){t===0&&(t=gt()),e=Oi(e,t),e!==null&&(vt(e,t),Ef(e))}function _f(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),gf(e,n)}function vf(e,t){var n=0;switch(e.tag){case 31:case 13:var r=e.stateNode,i=e.memoizedState;i!==null&&(n=i.retryLane);break;case 19:r=e.stateNode;break;case 22:r=e.stateNode._retryCache;break;default:throw Error(s(314))}r!==null&&r.delete(t),gf(e,n)}function yf(e,t){return Ue(e,t)}var bf=null,xf=null,Sf=!1,Cf=!1,wf=!1,Tf=0;function Ef(e){e!==xf&&e.next===null&&(xf===null?bf=xf=e:xf=xf.next=e),Cf=!0,Sf||(Sf=!0,Nf())}function Df(e,t){if(!wf&&Cf){wf=!0;do for(var n=!1,r=bf;r!==null;){if(!t){if(e!==0){var i=r.pendingLanes;if(i===0)var a=0;else{var o=r.suspendedLanes,s=r.pingedLanes;a=(1<<31-at(42|e)+1)-1,a&=i&~(o&~s),a=a&201326741?a&201326741|1:a?a|2:0}a!==0&&(n=!0,Mf(r,a))}else a=J,a=ft(r,r===ed?a:0,r.cancelPendingCommit!==null||r.timeoutHandle!==-1),!(a&3)||pt(r,a)||(n=!0,Mf(r,a))}r=r.next}while(n);wf=!1}}function Of(){kf()}function kf(){Cf=Sf=!1;var e=0;Tf!==0&&gp()&&(e=Tf);for(var t=qe(),n=null,r=bf;r!==null;){var i=r.next,a=Af(r,t);a===0?(r.next=null,n===null?bf=i:n.next=i,i===null&&(xf=n)):(n=r,(e!==0||a&3)&&(Cf=!0)),r=i}X!==0&&X!==5||Df(e,!1),Tf!==0&&(Tf=0)}function Af(e,t){for(var n=e.suspendedLanes,r=e.pingedLanes,i=e.expirationTimes,a=e.pendingLanes&-62914561;0<a;){var o=31-at(a),s=1<<o,c=i[o];c===-1?((s&n)===0||(s&r)!==0)&&(i[o]=ht(s,t)):c<=t&&(e.expiredLanes|=s),a&=~s}if(t=ed,n=J,n=ft(e,e===t?n:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),r=e.callbackNode,n===0||e===t&&(td===2||td===9)||e.cancelPendingCommit!==null)return r!==null&&r!==null&&We(r),e.callbackNode=null,e.callbackPriority=0;if(!(n&3)||pt(e,n)){if(t=n&-n,t===e.callbackPriority)return t;switch(r!==null&&We(r),wt(n)){case 2:case 8:n=Xe;break;case 32:n=Ze;break;case 268435456:n=$e;break;default:n=Ze}return r=jf.bind(null,e),n=Ue(n,r),e.callbackPriority=t,e.callbackNode=n,t}return r!==null&&r!==null&&We(r),e.callbackPriority=2,e.callbackNode=null,2}function jf(e,t){if(X!==0&&X!==5)return e.callbackNode=null,e.callbackPriority=0,null;var n=e.callbackNode;if(uf()&&e.callbackNode!==n)return null;var r=J;return r=ft(e,e===ed?r:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),r===0?null:(Fd(e,r,t),Af(e,qe()),e.callbackNode!=null&&e.callbackNode===n?jf.bind(null,e):null)}function Mf(e,t){if(uf())return null;Fd(e,t,!0)}function Nf(){xp(function(){K&6?Ue(Ye,Of):kf()})}function Pf(){if(Tf===0){var e=Ba;e===0&&(e=ct,ct<<=1,!(ct&261888)&&(ct=256)),Tf=e}return Tf}function Ff(e){return e==null||typeof e==`symbol`||typeof e==`boolean`?null:typeof e==`function`?e:bn(e)}function If(e,t,n,r,i){if(t===`submit`&&n&&n.stateNode===i){var a=Ff((i[kt]||null).action),o=r.submitter;o&&(t=(t=o[kt]||null)?Ff(t.formAction):o.getAttribute(`formAction`),t!==null&&(a=t,o=null));var s=new Hn(`action`,`action`,null,r,i);e.push({event:s,listeners:[{instance:null,listener:function(){if(r.defaultPrevented){if(Tf!==0){var e=new FormData(i,o);rc(n,{pending:!0,data:e,method:i.method,action:a},null,e)}}else typeof a==`function`&&(s.preventDefault(),e=new FormData(i,o),rc(n,{pending:!0,data:e,method:i.method,action:a},a,e))},currentTarget:i}]})}}for(var Lf=0;Lf<gi.length;Lf++){var Rf=gi[Lf];_i(Rf.toLowerCase(),`on`+(Rf[0].toUpperCase()+Rf.slice(1)))}_i(li,`onAnimationEnd`),_i(ui,`onAnimationIteration`),_i(di,`onAnimationStart`),_i(`dblclick`,`onDoubleClick`),_i(`focusin`,`onFocus`),_i(`focusout`,`onBlur`),_i(L,`onTransitionRun`),_i(fi,`onTransitionStart`),_i(pi,`onTransitionCancel`),_i(mi,`onTransitionEnd`),Kt(`onMouseEnter`,[`mouseout`,`mouseover`]),Kt(`onMouseLeave`,[`mouseout`,`mouseover`]),Kt(`onPointerEnter`,[`pointerout`,`pointerover`]),Kt(`onPointerLeave`,[`pointerout`,`pointerover`]),Gt(`onChange`,`change click focusin focusout input keydown keyup selectionchange`.split(` `)),Gt(`onSelect`,`focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange`.split(` `)),Gt(`onBeforeInput`,[`compositionend`,`keypress`,`textInput`,`paste`]),Gt(`onCompositionEnd`,`compositionend focusout keydown keypress keyup mousedown`.split(` `)),Gt(`onCompositionStart`,`compositionstart focusout keydown keypress keyup mousedown`.split(` `)),Gt(`onCompositionUpdate`,`compositionupdate focusout keydown keypress keyup mousedown`.split(` `));var zf=`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(` `),Bf=new Set(`beforetoggle cancel close invalid load scroll scrollend toggle`.split(` `).concat(zf));function Vf(e,t){t=!!(t&4);for(var n=0;n<e.length;n++){var r=e[n],i=r.event;r=r.listeners;a:{var a=void 0;if(t)for(var o=r.length-1;0<=o;o--){var s=r[o],c=s.instance,l=s.currentTarget;if(s=s.listener,c!==a&&i.isPropagationStopped())break a;a=s,i.currentTarget=l;try{a(i)}catch(e){Si(e)}i.currentTarget=null,a=c}else for(o=0;o<r.length;o++){if(s=r[o],c=s.instance,l=s.currentTarget,s=s.listener,c!==a&&i.isPropagationStopped())break a;a=s,i.currentTarget=l;try{a(i)}catch(e){Si(e)}i.currentTarget=null,a=c}}}}function Q(e,t){var n=t[jt];n===void 0&&(n=t[jt]=new Set);var r=e+`__bubble`;n.has(r)||(Gf(t,e,2,!1),n.add(r))}function Hf(e,t,n){var r=0;t&&(r|=4),Gf(n,e,r,t)}var Uf=`_reactListening`+Math.random().toString(36).slice(2);function Wf(e){if(!e[Uf]){e[Uf]=!0,Ut.forEach(function(t){t!==`selectionchange`&&(Bf.has(t)||Hf(t,!1,e),Hf(t,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[Uf]||(t[Uf]=!0,Hf(`selectionchange`,!1,t))}}function Gf(e,t,n,r){switch(Ch(t)){case 2:var i=_h;break;case 8:i=vh;break;default:i=yh}n=i.bind(null,t,n,e),i=void 0,!jn||t!==`touchstart`&&t!==`touchmove`&&t!==`wheel`||(i=!0),r?i===void 0?e.addEventListener(t,n,!0):e.addEventListener(t,n,{capture:!0,passive:i}):i===void 0?e.addEventListener(t,n,!1):e.addEventListener(t,n,{passive:i})}function Kf(e,t,n,r,i){var a=r;if(!(t&1)&&!(t&2)&&r!==null)a:for(;;){if(r===null)return;var o=r.tag;if(o===3||o===4){var s=r.stateNode.containerInfo;if(s===i)break;if(o===4)for(o=r.return;o!==null;){var c=o.tag;if((c===3||c===4)&&o.stateNode.containerInfo===i)return;o=o.return}for(;s!==null;){if(o=Lt(s),o===null)return;if(c=o.tag,c===5||c===6||c===26||c===27){r=a=o;continue a}s=s.parentNode}}r=r.return}On(function(){var r=a,i=Cn(n),o=[];a:{var s=hi.get(e);if(s!==void 0){var c=Hn,u=e;switch(e){case`keypress`:if(Ln(n)===0)break a;case`keydown`:case`keyup`:c=or;break;case`focusin`:u=`focus`,c=Zn;break;case`focusout`:u=`blur`,c=Zn;break;case`beforeblur`:case`afterblur`:c=Zn;break;case`click`:if(n.button===2)break a;case`auxclick`:case`dblclick`:case`mousedown`:case`mousemove`:case`mouseup`:case`mouseout`:case`mouseover`:case`contextmenu`:c=Yn;break;case`drag`:case`dragend`:case`dragenter`:case`dragexit`:case`dragleave`:case`dragover`:case`dragstart`:case`drop`:c=Xn;break;case`touchcancel`:case`touchend`:case`touchmove`:case`touchstart`:c=lr;break;case li:case ui:case di:c=Qn;break;case mi:c=ur;break;case`scroll`:case`scrollend`:c=Wn;break;case`wheel`:c=dr;break;case`copy`:case`cut`:case`paste`:c=$n;break;case`gotpointercapture`:case`lostpointercapture`:case`pointercancel`:case`pointerdown`:case`pointermove`:case`pointerout`:case`pointerover`:case`pointerup`:c=sr;break;case`submit`:c=cr;break;case`toggle`:case`beforetoggle`:c=fr}var d=!!(t&4),f=!d&&(e===`scroll`||e===`scrollend`),p=d?s===null?null:s+`Capture`:s;d=[];for(var m=r,h;m!==null;){var g=m;if(h=g.stateNode,g=g.tag,g!==5&&g!==26&&g!==27||h===null||p===null||(g=kn(m,p),g!=null&&d.push(qf(m,g,h))),f)break;m=m.return}0<d.length&&(s=new c(s,u,null,n,i),o.push({event:s,listeners:d}))}}if(!(t&7)){a:{if(c=e===`mouseover`||e===`pointerover`,s=e===`mouseout`||e===`pointerout`,c&&n!==Sn&&(u=n.relatedTarget||n.fromElement)&&(Lt(u)||u[At]))break a;(s||c)&&(u=i.window===i?i:(c=i.ownerDocument)?c.defaultView||c.parentWindow:window,s?(c=n.relatedTarget||n.toElement,s=r,c=c?Lt(c):null,c!==null&&(f=l(c),d=c.tag,c!==f||d!==5&&d!==27&&d!==6)&&(c=null)):(s=null,c=r),s!==c&&(d=Yn,g=`onMouseLeave`,p=`onMouseEnter`,m=`mouse`,(e===`pointerout`||e===`pointerover`)&&(d=sr,g=`onPointerLeave`,p=`onPointerEnter`,m=`pointer`),f=s==null?u:zt(s),h=c==null?u:zt(c),u=new d(g,m+`leave`,s,n,i),u.target=f,u.relatedTarget=h,g=null,Lt(i)===r&&(d=new d(p,m+`enter`,c,n,i),d.target=h,d.relatedTarget=f,g=d),f=g,d=s&&c?T(s,c,Yf):null,s!==null&&Xf(o,u,s,d,!1),c!==null&&f!==null&&Xf(o,f,c,d,!0)))}a:{if(s=r?zt(r):window,c=s.nodeName&&s.nodeName.toLowerCase(),c===`select`||c===`input`&&s.type===`file`)var _=Mr;else if(Er(s)){if(Nr)_=Hr;else{_=Br;var v=zr}}else c=s.nodeName,!c||c.toLowerCase()!==`input`||s.type!==`checkbox`&&s.type!==`radio`?r&&_n(r.elementType)&&(_=Mr):_=Vr;if(_&&=_(e,r)){Dr(o,_,n,i);break a}v&&v(e,s,r)}switch(v=r?zt(r):window,e){case`focusin`:(Er(v)||v.contentEditable===`true`)&&($r=v,ei=r,ti=null);break;case`focusout`:ti=ei=$r=null;break;case`mousedown`:ni=!0;break;case`contextmenu`:case`mouseup`:case`dragend`:ni=!1,ri(o,n,i);break;case`selectionchange`:if(Qr)break;case`keydown`:case`keyup`:ri(o,n,i)}var y;if(mr)b:{switch(e){case`compositionstart`:var b=`onCompositionStart`;break b;case`compositionend`:b=`onCompositionEnd`;break b;case`compositionupdate`:b=`onCompositionUpdate`;break b}b=void 0}else Sr?br(e,n)&&(b=`onCompositionEnd`):e===`keydown`&&n.keyCode===229&&(b=`onCompositionStart`);b&&(_r&&n.locale!==`ko`&&(Sr||b!==`onCompositionStart`?b===`onCompositionEnd`&&Sr&&(y=In()):(Nn=i,Pn=`value`in Nn?Nn.value:Nn.textContent,Sr=!0)),v=Jf(r,b),0<v.length&&(b=new er(b,e,null,n,i),o.push({event:b,listeners:v}),y?b.data=y:(y=xr(n),y!==null&&(b.data=y)))),(y=gr?Cr(e,n):wr(e,n))&&(b=Jf(r,`onBeforeInput`),0<b.length&&(v=new er(`onBeforeInput`,`beforeinput`,null,n,i),o.push({event:v,listeners:b}),v.data=y)),If(o,e,r,n,i)}Vf(o,t)})}function qf(e,t,n){return{instance:e,listener:t,currentTarget:n}}function Jf(e,t){for(var n=t+`Capture`,r=[];e!==null;){var i=e,a=i.stateNode;if(i=i.tag,i!==5&&i!==26&&i!==27||a===null||(i=kn(e,n),i!=null&&r.unshift(qf(e,i,a)),i=kn(e,t),i!=null&&r.push(qf(e,i,a))),e.tag===3)return r;e=e.return}return[]}function Yf(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function Xf(e,t,n,r,i){for(var a=t._reactName,o=[];n!==null&&n!==r;){var s=n,c=s.alternate,l=s.stateNode;if(s=s.tag,c!==null&&c===r)break;s!==5&&s!==26&&s!==27||l===null||(c=l,i?(l=kn(n,a),l!=null&&o.unshift(qf(n,l,c))):i||(l=kn(n,a),l!=null&&o.push(qf(n,l,c)))),n=n.return}o.length!==0&&e.push({event:t,listeners:o})}var Zf=/\r\n?/g,Qf=/\u0000|\uFFFD/g;function $f(e){return(typeof e==`string`?e:``+e).replace(Zf,`
|
|
9
|
-
`).replace(Qf,``)}function ep(e,t){return t=$f(t),$f(e)===t}function tp(e,t,n,r,i,a){switch(n){case`children`:if(typeof r==`string`)t===`body`||t===`textarea`&&r===``||pn(e,r);else if(typeof r==`number`||typeof r==`bigint`)t!==`body`&&pn(e,``+r);else return;break;case`className`:$t(e,`class`,r);break;case`tabIndex`:$t(e,`tabindex`,r);break;case`dir`:case`role`:case`viewBox`:case`width`:case`height`:$t(e,n,r);break;case`style`:gn(e,r,a);return;case`data`:if(t!==`object`){$t(e,`data`,r);break}case`src`:case`href`:if(r===``&&(t!==`a`||n!==`href`)||r==null||typeof r==`function`||typeof r==`symbol`||typeof r==`boolean`){e.removeAttribute(n);break}r=bn(r),e.setAttribute(n,r);break;case`action`:case`formAction`:if(typeof r==`function`){e.setAttribute(n,`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}if(typeof a==`function`&&(n===`formAction`?(t!==`input`&&tp(e,t,`name`,i.name,i,null),tp(e,t,`formEncType`,i.formEncType,i,null),tp(e,t,`formMethod`,i.formMethod,i,null),tp(e,t,`formTarget`,i.formTarget,i,null)):(tp(e,t,`encType`,i.encType,i,null),tp(e,t,`method`,i.method,i,null),tp(e,t,`target`,i.target,i,null))),r==null||typeof r==`symbol`||typeof r==`boolean`){e.removeAttribute(n);break}r=bn(r),e.setAttribute(n,r);break;case`onClick`:r!=null&&(e.onclick=xn);return;case`onScroll`:r!=null&&Q(`scroll`,e);return;case`onScrollEnd`:r!=null&&Q(`scrollend`,e);return;case`dangerouslySetInnerHTML`:if(r!=null){if(typeof r!=`object`||!(`__html`in r))throw Error(s(61));if(n=r.__html,n!=null){if(i.children!=null)throw Error(s(60));a?.__html!==n&&(e.innerHTML=n)}}break;case`multiple`:e.multiple=r&&typeof r!=`function`&&typeof r!=`symbol`;break;case`muted`:e.muted=r&&typeof r!=`function`&&typeof r!=`symbol`;break;case`suppressContentEditableWarning`:case`suppressHydrationWarning`:case`defaultValue`:case`defaultChecked`:case`innerHTML`:case`ref`:break;case`autoFocus`:break;case`xlinkHref`:if(r==null||typeof r==`function`||typeof r==`boolean`||typeof r==`symbol`){e.removeAttribute(`xlink:href`);break}n=bn(r),e.setAttributeNS(`http://www.w3.org/1999/xlink`,`xlink:href`,n);break;case`contentEditable`:case`spellCheck`:case`draggable`:case`value`:case`autoReverse`:case`externalResourcesRequired`:case`focusable`:case`preserveAlpha`:r!=null&&typeof r!=`function`&&typeof r!=`symbol`?e.setAttribute(n,r):e.removeAttribute(n);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`:r&&typeof r!=`function`&&typeof r!=`symbol`?e.setAttribute(n,``):e.removeAttribute(n);break;case`capture`:case`download`:!0===r?e.setAttribute(n,``):!1!==r&&r!=null&&typeof r!=`function`&&typeof r!=`symbol`?e.setAttribute(n,r):e.removeAttribute(n);break;case`cols`:case`rows`:case`size`:case`span`:r!=null&&typeof r!=`function`&&typeof r!=`symbol`&&!isNaN(r)&&1<=r?e.setAttribute(n,r):e.removeAttribute(n);break;case`rowSpan`:case`start`:r==null||typeof r==`function`||typeof r==`symbol`||isNaN(r)?e.removeAttribute(n):e.setAttribute(n,r);break;case`popover`:Q(`beforetoggle`,e),Q(`toggle`,e),Qt(e,`popover`,r);break;case`xlinkActuate`:en(e,`http://www.w3.org/1999/xlink`,`xlink:actuate`,r);break;case`xlinkArcrole`:en(e,`http://www.w3.org/1999/xlink`,`xlink:arcrole`,r);break;case`xlinkRole`:en(e,`http://www.w3.org/1999/xlink`,`xlink:role`,r);break;case`xlinkShow`:en(e,`http://www.w3.org/1999/xlink`,`xlink:show`,r);break;case`xlinkTitle`:en(e,`http://www.w3.org/1999/xlink`,`xlink:title`,r);break;case`xlinkType`:en(e,`http://www.w3.org/1999/xlink`,`xlink:type`,r);break;case`xmlBase`:en(e,`http://www.w3.org/XML/1998/namespace`,`xml:base`,r);break;case`xmlLang`:en(e,`http://www.w3.org/XML/1998/namespace`,`xml:lang`,r);break;case`xmlSpace`:en(e,`http://www.w3.org/XML/1998/namespace`,`xml:space`,r);break;case`is`:Qt(e,`is`,r);break;case`innerText`:case`textContent`:return;default:if(!(2<n.length)||n[0]!==`o`&&n[0]!==`O`||n[1]!==`n`&&n[1]!==`N`)n=vn.get(n)||n,Qt(e,n,r);else return}P=!0}function np(e,t,n,r,i,a){switch(n){case`style`:gn(e,r,a);return;case`dangerouslySetInnerHTML`:if(r!=null){if(typeof r!=`object`||!(`__html`in r))throw Error(s(61));if(n=r.__html,n!=null){if(i.children!=null)throw Error(s(60));a?.__html!==n&&(e.innerHTML=n)}}break;case`children`:if(typeof r==`string`)pn(e,r);else if(typeof r==`number`||typeof r==`bigint`)pn(e,``+r);else return;break;case`onScroll`:r!=null&&Q(`scroll`,e);return;case`onScrollEnd`:r!=null&&Q(`scrollend`,e);return;case`onClick`:r!=null&&(e.onclick=xn);return;case`suppressContentEditableWarning`:case`suppressHydrationWarning`:case`innerHTML`:case`ref`:return;case`innerText`:case`textContent`:return;default:if(!Wt.hasOwnProperty(n))a:{if(n[0]===`o`&&n[1]===`n`&&(i=n.endsWith(`Capture`),a=n.slice(2,i?n.length-7:void 0),t=e[kt]||null,t=t==null?null:t[n],typeof t==`function`&&e.removeEventListener(a,t,i),typeof r==`function`)){typeof t!=`function`&&t!==null&&(n in e?e[n]=null:e.hasAttribute(n)&&e.removeAttribute(n)),e.addEventListener(a,r,i);break a}P=!0,n in e?e[n]=r:!0===r?e.setAttribute(n,``):Qt(e,n,r)}return}P=!0}function rp(e,t,n){switch(t){case`div`:case`span`:case`svg`:case`path`:case`a`:case`g`:case`p`:case`li`:break;case`img`:Q(`error`,e),Q(`load`,e);var r=!1,i=!1,a;for(a in n)if(n.hasOwnProperty(a)){var o=n[a];if(o!=null)switch(a){case`src`:r=!0;break;case`srcSet`:i=!0;break;case`children`:case`dangerouslySetInnerHTML`:throw Error(s(137,t));default:tp(e,t,a,o,n,null)}}i&&tp(e,t,`srcSet`,n.srcSet,n,null),r&&tp(e,t,`src`,n.src,n,null);return;case`input`:Q(`invalid`,e);var c=a=o=i=null,l=null,u=null;for(r in n)if(n.hasOwnProperty(r)){var d=n[r];if(d!=null)switch(r){case`name`:i=d;break;case`type`:o=d;break;case`checked`:l=d;break;case`defaultChecked`:u=d;break;case`value`:a=d;break;case`defaultValue`:c=d;break;case`children`:case`dangerouslySetInnerHTML`:if(d!=null)throw Error(s(137,t));break;default:tp(e,t,r,d,n,null)}}cn(e,a,c,l,u,o,i,!1);return;case`select`:for(i in Q(`invalid`,e),r=o=a=null,n)if(n.hasOwnProperty(i)&&(c=n[i],c!=null))switch(i){case`value`:a=c;break;case`defaultValue`:o=c;break;case`multiple`:r=c;default:tp(e,t,i,c,n,null)}t=a,n=o,e.multiple=!!r,t==null?n!=null&&un(e,!!r,n,!0):un(e,!!r,t,!1);return;case`textarea`:for(o in Q(`invalid`,e),a=i=r=null,n)if(n.hasOwnProperty(o)&&(c=n[o],c!=null))switch(o){case`value`:r=c;break;case`defaultValue`:i=c;break;case`children`:a=c;break;case`dangerouslySetInnerHTML`:if(c!=null)throw Error(s(91));break;default:tp(e,t,o,c,n,null)}fn(e,r,i,a);return;case`option`:for(l in n)if(n.hasOwnProperty(l)&&(r=n[l],r!=null))switch(l){case`selected`:e.selected=r&&typeof r!=`function`&&typeof r!=`symbol`;break;default:tp(e,t,l,r,n,null)}return;case`dialog`:Q(`beforetoggle`,e),Q(`toggle`,e),Q(`cancel`,e),Q(`close`,e);break;case`iframe`:case`object`:Q(`load`,e);break;case`video`:case`audio`:for(r=0;r<zf.length;r++)Q(zf[r],e);break;case`image`:Q(`error`,e),Q(`load`,e);break;case`details`:Q(`toggle`,e);break;case`embed`:case`source`:case`link`:Q(`error`,e),Q(`load`,e);case`area`:case`base`:case`br`:case`col`:case`hr`:case`keygen`:case`meta`:case`param`:case`track`:case`wbr`:case`menuitem`:for(u in n)if(n.hasOwnProperty(u)&&(r=n[u],r!=null))switch(u){case`children`:case`dangerouslySetInnerHTML`:throw Error(s(137,t));default:tp(e,t,u,r,n,null)}return;default:if(_n(t)){for(d in n)n.hasOwnProperty(d)&&(r=n[d],r!==void 0&&np(e,t,d,r,n,void 0));return}}for(c in n)n.hasOwnProperty(c)&&(r=n[c],r!=null&&tp(e,t,c,r,n,null))}var ip={};function ap(e,t,n,r){switch(t){case`div`:case`span`:case`svg`:case`path`:case`a`:case`g`:case`p`:case`li`:break;case`input`:var i=null,a=null,o=null,c=null,l=null,u=null,d=null;for(m in n){var f=n[m];if(n.hasOwnProperty(m)&&f!=null)switch(m){case`checked`:break;case`value`:break;case`defaultValue`:l=f;default:r.hasOwnProperty(m)||tp(e,t,m,null,r,f)}}for(var p in r){var m=r[p];if(f=n[p],r.hasOwnProperty(p)&&(m!=null||f!=null))switch(p){case`type`:m!==f&&(P=!0),a=m;break;case`name`:m!==f&&(P=!0),i=m;break;case`checked`:m!==f&&(P=!0),u=m;break;case`defaultChecked`:m!==f&&(P=!0),d=m;break;case`value`:m!==f&&(P=!0),o=m;break;case`defaultValue`:m!==f&&(P=!0),c=m;break;case`children`:case`dangerouslySetInnerHTML`:if(m!=null)throw Error(s(137,t));break;default:m!==f&&tp(e,t,p,m,r,f)}}sn(e,o,c,l,u,d,a,i);return;case`select`:for(a in m=o=c=p=null,n)if(l=n[a],n.hasOwnProperty(a)&&l!=null)switch(a){case`value`:break;case`multiple`:m=l;default:r.hasOwnProperty(a)||tp(e,t,a,null,r,l)}for(i in r)if(a=r[i],l=n[i],r.hasOwnProperty(i)&&(a!=null||l!=null))switch(i){case`value`:a!==l&&(P=!0),p=a;break;case`defaultValue`:a!==l&&(P=!0),c=a;break;case`multiple`:a!==l&&(P=!0),o=a;default:a!==l&&tp(e,t,i,a,r,l)}t=c,n=o,r=m,p==null?!!r!=!!n&&(t==null?un(e,!!n,n?[]:``,!1):un(e,!!n,t,!0)):un(e,!!n,p,!1);return;case`textarea`:for(c in m=p=null,n)if(i=n[c],n.hasOwnProperty(c)&&i!=null&&!r.hasOwnProperty(c))switch(c){case`value`:break;case`children`:break;default:tp(e,t,c,null,r,i)}for(o in r)if(i=r[o],a=n[o],r.hasOwnProperty(o)&&(i!=null||a!=null))switch(o){case`value`:i!==a&&(P=!0),p=i;break;case`defaultValue`:i!==a&&(P=!0),m=i;break;case`children`:break;case`dangerouslySetInnerHTML`:if(i!=null)throw Error(s(91));break;default:i!==a&&tp(e,t,o,i,r,a)}dn(e,p,m);return;case`option`:for(var h in n)if(p=n[h],n.hasOwnProperty(h)&&p!=null&&!r.hasOwnProperty(h))switch(h){case`selected`:e.selected=!1;break;default:tp(e,t,h,null,r,p)}for(l in r)if(p=r[l],m=n[l],r.hasOwnProperty(l)&&p!==m&&(p!=null||m!=null))switch(l){case`selected`:p!==m&&(P=!0),e.selected=p&&typeof p!=`function`&&typeof p!=`symbol`;break;default:tp(e,t,l,p,r,m)}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 g in n)p=n[g],n.hasOwnProperty(g)&&p!=null&&!r.hasOwnProperty(g)&&tp(e,t,g,null,r,p);for(u in r)if(p=r[u],m=n[u],r.hasOwnProperty(u)&&p!==m&&(p!=null||m!=null))switch(u){case`children`:case`dangerouslySetInnerHTML`:if(p!=null)throw Error(s(137,t));break;default:tp(e,t,u,p,r,m)}return;default:if(_n(t)){for(var _ in n)p=n[_],n.hasOwnProperty(_)&&p!==void 0&&!r.hasOwnProperty(_)&&np(e,t,_,void 0,r,p);for(d in r)p=r[d],m=n[d],!r.hasOwnProperty(d)||p===m||p===void 0&&m===void 0||np(e,t,d,p,r,m);return}}for(var v in n)p=n[v],n.hasOwnProperty(v)&&p!=null&&!r.hasOwnProperty(v)&&tp(e,t,v,null,r,p);for(f in r)p=r[f],m=n[f],!r.hasOwnProperty(f)||p===m||p==null&&m==null||tp(e,t,f,p,r,m)}function op(e){switch(e){case`css`:case`script`:case`font`:case`img`:case`image`:case`input`:case`link`:return!0;default:return!1}}function sp(){if(typeof performance.getEntriesByType==`function`){for(var e=0,t=0,n=performance.getEntriesByType(`resource`),r=0;r<n.length;r++){var i=n[r],a=i.transferSize,o=i.initiatorType,s=i.duration;if(a&&s&&op(o)){for(o=0,s=i.responseEnd,r+=1;r<n.length;r++){var c=n[r],l=c.startTime;if(l>s)break;var u=c.transferSize,d=c.initiatorType;u&&op(d)&&(c=c.responseEnd,o+=u*(c<s?1:(s-l)/(c-l)))}if(--r,t+=8*(a+o)/(i.duration/1e3),e++,10<e)break}}if(0<e)return t/e/1e6}return navigator.connection&&(e=navigator.connection.downlink,typeof e==`number`)?e:5}var cp=null,lp=null;function up(e){return e.nodeType===9?e:e.ownerDocument}function dp(e){switch(e){case`http://www.w3.org/2000/svg`:return 1;case`http://www.w3.org/1998/Math/MathML`:return 2;default:return 0}}function fp(e,t){if(e===0)switch(t){case`svg`:return 1;case`math`:return 2;default:return 0}return e===1&&t===`foreignObject`?0:e}function pp(e,t,n,r){return n=up(n).createElement(e),n[Ot]=r,n[kt]=t,rp(n,e,t),Vt(n),n}function mp(e,t){return e===`textarea`||e===`noscript`||typeof t.children==`string`||typeof t.children==`number`||typeof t.children==`bigint`||typeof t.dangerouslySetInnerHTML==`object`&&t.dangerouslySetInnerHTML!==null&&t.dangerouslySetInnerHTML.__html!=null}var hp=null;function gp(){var e=window.event;return e&&e.type===`popstate`?e!==hp&&(hp=e,!0):(hp=null,!1)}var _p=typeof setTimeout==`function`?setTimeout:void 0,vp=typeof clearTimeout==`function`?clearTimeout:void 0,yp=typeof Promise==`function`?Promise:void 0,bp=typeof requestAnimationFrame==`function`?requestAnimationFrame:_p,xp=typeof queueMicrotask==`function`?queueMicrotask:yp===void 0?_p:function(e){return yp.resolve(null).then(e).catch(Sp)};function Sp(e){setTimeout(function(){throw e})}function Cp(e){return e===`head`}function wp(e,t){var n=t,r=0;do{var i=n.nextSibling;if(e.removeChild(n),i&&i.nodeType===8){if(n=i.data,n===`/$`||n===`/&`){if(r===0){e.removeChild(i),Hh(t);return}r--}else if(n===`$`||n===`$?`||n===`$~`||n===`$!`||n===`&`)r++;else if(n===`html`)_m(e.ownerDocument.documentElement);else if(n===`head`){n=e.ownerDocument.head,_m(n);for(var a=n.firstChild;a;){var o=a.nextSibling,s=a.nodeName;a[Pt]||s===`SCRIPT`||s===`STYLE`||s===`LINK`&&a.rel.toLowerCase()===`stylesheet`||n.removeChild(a),a=o}}else n===`body`&&_m(e.ownerDocument.body)}n=i}while(n);Hh(t)}function Tp(e,t){var n=e;e=0;do{var r=n.nextSibling;if(n.nodeType===1?t?(n._stashedDisplay=n.style.display,n.style.display=`none`):(n.style.display=n._stashedDisplay||``,n.getAttribute(`style`)===``&&n.removeAttribute(`style`)):n.nodeType===3&&(t?(n._stashedText=n.nodeValue,n.nodeValue=``):n.nodeValue=n._stashedText||``),r&&r.nodeType===8){if(n=r.data,n===`/$`){if(e===0)break;e--}else n!==`$`&&n!==`$?`&&n!==`$~`&&n!==`$!`||e++}n=r}while(n)}function Ep(e,t,n){if(t=CSS.escape(t)===t?t:`r-`+btoa(t).replace(/=/g,``),e.style.viewTransitionName=t,n!=null&&(e.style.viewTransitionClass=n),n=getComputedStyle(e),n.display===`inline`){if(t=e.getClientRects(),t.length===1)var r=1;else for(var i=r=0;i<t.length;i++){var a=t[i];0<a.width&&0<a.height&&r++}r===1&&(e=e.style,e.display=t.length===1?`inline-block`:`block`,e.marginTop=`-`+n.paddingTop,e.marginBottom=`-`+n.paddingBottom)}}function Dp(e,t){e=e.style,t=t.style;var n=t==null?null:t.hasOwnProperty(`viewTransitionName`)?t.viewTransitionName:t.hasOwnProperty(`view-transition-name`)?t[`view-transition-name`]:null;e.viewTransitionName=n==null||typeof n==`boolean`?``:(``+n).trim(),n=t==null?null:t.hasOwnProperty(`viewTransitionClass`)?t.viewTransitionClass:t.hasOwnProperty(`view-transition-class`)?t[`view-transition-class`]:null,e.viewTransitionClass=n==null||typeof n==`boolean`?``:(``+n).trim(),e.display===`inline-block`&&(t==null?e.display=e.margin=``:(n=t.display,e.display=n==null||typeof n==`boolean`?``:n,n=t.margin,n==null?(n=t.hasOwnProperty(`marginTop`)?t.marginTop:t[`margin-top`],e.marginTop=n==null||typeof n==`boolean`?``:n,t=t.hasOwnProperty(`marginBottom`)?t.marginBottom:t[`margin-bottom`],e.marginBottom=t==null||typeof t==`boolean`?``:t):e.margin=n))}function Op(e,t,n){return n=n.ownerDocument.defaultView,{rect:e,abs:t.position===`absolute`||t.position===`fixed`,clip:t.clipPath!==`none`||t.overflow!==`visible`||t.filter!==`none`||t.mask!==`none`||t.mask!==`none`||t.borderRadius!==`0px`,view:0<=e.bottom&&0<=e.right&&e.top<=n.innerHeight&&e.left<=n.innerWidth}}function kp(e){return Op(e.getBoundingClientRect(),getComputedStyle(e),e)}function Ap(e){var t=e.getBoundingClientRect();t=new DOMRect(t.x+2e4,t.y+2e4,t.width,t.height);var n=getComputedStyle(e);return Op(t,n,e)}function jp(e){return e.documentElement.clientHeight}function Mp(e){this.addEventListener(`load`,e),this.addEventListener(`error`,e)}function Np(e,t,n,r,i,a,o,s,c){var l=t.nodeType===9?t:t.ownerDocument;try{var u=l.startViewTransition({update:function(){var t=l.defaultView,n=t.navigation&&t.navigation.transition,o=l.fonts.status;r();var s=[];if(o===`loaded`&&(jp(l),l.fonts.status===`loading`&&s.push(l.fonts.ready)),o=s.length,e!==null)for(var c=e.suspenseyImages,u=0,d=0;d<c.length;d++){var f=c[d];if(!f.complete){var p=f.getBoundingClientRect();if(0<p.bottom&&0<p.right&&p.top<t.innerHeight&&p.left<t.innerWidth){if(u+=Xm(f),u>$m){s.length=o;break}f=new Promise(Mp.bind(f)),s.push(f)}}}if(0<s.length)return t=Promise.race([Promise.all(s),new Promise(function(e){return setTimeout(e,500)})]).then(i,i),(n?Promise.allSettled([n.finished,t]):t).then(a,a);if(i(),n)return n.finished.then(a,a);a()},types:n});l.__reactViewTransition=u;var d=[];return u.ready.then(function(){for(var e=l.documentElement.getAnimations({subtree:!0}),t=0;t<e.length;t++){var n=e[t],r=n.effect,i=r.pseudoElement;if(i!=null&&i.startsWith(`::view-transition`)){d.push(n),n=r.getKeyframes();for(var a=i=void 0,s=!0,c=0;c<n.length;c++){var u=n[c],f=u.width;if(i===void 0)i=f;else if(i!==f){s=!1;break}if(f=u.height,a===void 0)a=f;else if(a!==f){s=!1;break}delete u.width,delete u.height,u.transform===`none`&&delete u.transform}s&&i!==void 0&&a!==void 0&&(r.setKeyframes(n),s=getComputedStyle(r.target,r.pseudoElement),s.width!==i||s.height!==a)&&(s=n[0],s.width=i,s.height=a,s=n[n.length-1],s.width=i,s.height=a,r.setKeyframes(n))}}o()},function(e){l.__reactViewTransition===u&&(l.__reactViewTransition=null);try{if(typeof e==`object`&&e)switch(e.name){case`InvalidStateError`:(e.message===`View transition was skipped because document visibility state is hidden.`||e.message===`Skipping view transition because document visibility state has become hidden.`||e.message===`Skipping view transition because viewport size changed.`||e.message===`Transition was aborted because of invalid state`)&&(e=null)}e!==null&&c(e)}finally{r(),i(),o()}}),u.finished.finally(function(){for(var e=0;e<d.length;e++)d[e].cancel();l.__reactViewTransition===u&&(l.__reactViewTransition=null),s()}),u}catch{return r(),i(),o(),null}}function Pp(e,t){this._scope=document.documentElement,this._selector=`::view-transition-`+e+`(`+t+`)`}Pp.prototype.animate=function(e,t){return t=typeof t==`number`?{duration:t}:E({},t),t.pseudoElement=this._selector,this._scope.animate(e,t)},Pp.prototype.getAnimations=function(){for(var e=this._scope,t=this._selector,n=e.getAnimations({subtree:!0}),r=[],i=0;i<n.length;i++){var a=n[i].effect;a!==null&&a.target===e&&a.pseudoElement===t&&r.push(n[i])}return r},Pp.prototype.getComputedStyle=function(){return getComputedStyle(this._scope,this._selector)};function Fp(e){return{name:e,group:new Pp(`group`,e),imagePair:new Pp(`image-pair`,e),old:new Pp(`old`,e),new:new Pp(`new`,e)}}function Ip(e){this._fragmentFiber=e,this._observers=this._eventListeners=null}Ip.prototype.addEventListener=function(e,t,n){var r=null,i=null;if(!(n!=null&&typeof n!=`boolean`&&(r=n.signal||null,r!==null&&r.aborted))){this._eventListeners===null&&(this._eventListeners=[]);var a=this._eventListeners;if(Vp(a,e,t,n)===-1){var o=this,s=t;n!=null&&typeof n!=`boolean`&&!0===n.once&&(s=function(r){o.removeEventListener(e,t,n),typeof t==`function`?t.call(this,r):t.handleEvent(r)}),r!==null&&(i=o.removeEventListener.bind(o,e,t,n),r.addEventListener(`abort`,i,{once:!0}),i=r.removeEventListener.bind(r,`abort`,i)),r=zp(n),a.push({type:e,listener:t,optionsOrUseCapture:n,attachedListener:s,cleanup:i}),h(this._fragmentFiber.child,!1,Lp,e,s,r)}this._eventListeners=a}};function Lp(e,t,n,r){return b(e).addEventListener(t,n,r),!1}Ip.prototype.removeEventListener=function(e,t,n){var r=this._eventListeners;if(r!==null&&(t=Vp(r,e,t,n),t!==-1)){var i=r[t];n=i.attachedListener;var a=i.cleanup;i=zp(i.optionsOrUseCapture),h(this._fragmentFiber.child,!1,Rp,e,n,i),r.splice(t,1),a!==null&&a()}};function Rp(e,t,n,r){return b(e).removeEventListener(t,n,r),!1}function zp(e){return e!=null&&typeof e!=`boolean`&&(!0===e.once||e.signal instanceof AbortSignal)?{capture:e.capture,passive:e.passive}:e}function Bp(e){return e==null?`c=0`:typeof e==`boolean`?`c=`+(e?`1`:`0`):`c=`+(e.capture?`1`:`0`)}function Vp(e,t,n,r){if(e.length===0)return-1;r=Bp(r);for(var i=0;i<e.length;i++){var a=e[i];if(a.type===t&&a.listener===n&&Bp(a.optionsOrUseCapture)===r)return i}return-1}Ip.prototype.dispatchEvent=function(e){var t=g(this._fragmentFiber);if(t===null)return!0;t=b(t);var n=this._eventListeners;if(n!==null&&0<n.length||!e.bubbles){var r=t.nodeType===9?t.createComment(``):document.createTextNode(``);if(n)for(var i=0;i<n.length;i++){var a=n[i];r.addEventListener(a.type,a.attachedListener,zp(a.optionsOrUseCapture))}if(t.appendChild(r),e=r.dispatchEvent(e),n)for(i=0;i<n.length;i++)a=n[i],r.removeEventListener(a.type,a.attachedListener,zp(a.optionsOrUseCapture));return t.removeChild(r),e}return t.dispatchEvent(e)},Ip.prototype.focus=function(e){h(this._fragmentFiber.child,!0,Hp,e,void 0,void 0)};function Hp(e,t){return e.tag!==6&&(e=b(e),pm(e,t))}Ip.prototype.focusLast=function(e){var t=[];h(this._fragmentFiber.child,!0,Up,t,void 0,void 0);for(var n=t.length-1;0<=n&&!Hp(t[n],e);n--);};function Up(e,t){return t.push(e),!1}Ip.prototype.blur=function(){var e=g(this._fragmentFiber);e!==null&&(e=b(e),e=up(e).activeElement,e!==null&&h(this._fragmentFiber.child,!1,Wp,e,void 0,void 0))};function Wp(e,t){return e.tag!==6&&(e=b(e),e===t||e.contains(t)?(t.blur(),!0):!1)}Ip.prototype.observeUsing=function(e){this._observers===null&&(this._observers=new Set),this._observers.add(e),h(this._fragmentFiber.child,!1,Gp,e,void 0,void 0)};function Gp(e,t){return e.tag===6||(e=b(e),t.observe(e)),!1}Ip.prototype.unobserveUsing=function(e){var t=this._observers;if(t!==null&&t.has(e)){t.delete(e),h(this._fragmentFiber.child,!1,Kp,e,void 0,void 0);for(var n=t=0;n<qp.length;n++){var r=qp[n];r.fragmentInstance===this&&r.observer===e?e.unobserve(r.instance):qp[t++]=r}qp.length=t}};function Kp(e,t){return e.tag===6||(e=b(e),t.unobserve(e)),!1}var qp=[],Jp=!1;function Yp(e,t,n){qp.push({fragmentInstance:e,observer:t,instance:n}),Jp||(Jp=!0,mm(function(){Jp=!1;var e=qp;qp=[];for(var t=0;t<e.length;t++){var n=e[t];n.observer.unobserve(n.instance)}}))}Ip.prototype.getClientRects=function(){var e=[];return h(this._fragmentFiber.child,!1,Xp,e,void 0,void 0),e};function Xp(e,t){if(e.tag===6){e=e.stateNode;var n=e.ownerDocument.createRange();n.selectNodeContents(e),t.push.apply(t,n.getClientRects())}else e=b(e),t.push.apply(t,e.getClientRects());return!1}Ip.prototype.getRootNode=function(e){var t=g(this._fragmentFiber);return t===null?this:b(t).getRootNode(e)},Ip.prototype.compareDocumentPosition=function(e){var t=g(this._fragmentFiber);if(t===null)return Node.DOCUMENT_POSITION_DISCONNECTED;var n=[];h(this._fragmentFiber.child,!1,Up,n,void 0,void 0);var r=b(t);if(n.length===0){if(n=r,_(this._fragmentFiber)){a:{for(t=this._fragmentFiber.return;t!==null;){if(t.tag===4){t=t.stateNode.containerInfo;break a}if(t.tag===3||t.tag===5||t.tag===27)break;t=t.return}t=null}t!=null&&(n=t)}t=this._fragmentFiber;var i=r=n.compareDocumentPosition(e);return n===e?i=Node.DOCUMENT_POSITION_CONTAINS:r&Node.DOCUMENT_POSITION_CONTAINED_BY&&(n=v(t)[1],n===null?i=Node.DOCUMENT_POSITION_PRECEDING:(e=b(n).compareDocumentPosition(e),i=e===0||e&Node.DOCUMENT_POSITION_FOLLOWING?Node.DOCUMENT_POSITION_FOLLOWING:Node.DOCUMENT_POSITION_PRECEDING)),i|=Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC}t=b(n[0]),i=b(n[n.length-1]);var a=_(this._fragmentFiber)?t.parentElement:r;if(a==null)return Node.DOCUMENT_POSITION_DISCONNECTED;r=a.compareDocumentPosition(t)&Node.DOCUMENT_POSITION_CONTAINED_BY,a=a.compareDocumentPosition(i)&Node.DOCUMENT_POSITION_CONTAINED_BY;var o=t.compareDocumentPosition(e),s=i.compareDocumentPosition(e),c=o&Node.DOCUMENT_POSITION_CONTAINED_BY||s&Node.DOCUMENT_POSITION_CONTAINED_BY;return s=r&&a&&o&Node.DOCUMENT_POSITION_FOLLOWING&&s&Node.DOCUMENT_POSITION_PRECEDING,t=r&&t===e||a&&i===e||c||s?Node.DOCUMENT_POSITION_CONTAINED_BY:!r&&t===e||!a&&i===e?Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC:o,t&Node.DOCUMENT_POSITION_DISCONNECTED||t&Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC||Zp(t,this._fragmentFiber,n[0],n[n.length-1],e)?t:Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC};function Zp(e,t,n,r,i){var a=Lt(i);if(e&Node.DOCUMENT_POSITION_CONTAINED_BY){if(n=!!a)a:{for(;a!==null;){if(a.tag===7&&(a===t||a.alternate===t)){n=!0;break a}a=a.return}n=!1}return n}if(e&Node.DOCUMENT_POSITION_CONTAINS){if(a===null)return a=i.ownerDocument,i===a||i===a.documentElement||i===a.body;a:{for(a=t,t=g(t);a!==null;){if(!(a.tag!==5&&a.tag!==3&&a.tag!==27||a!==t&&a.alternate!==t)){a=!0;break a}a=a.return}a=!1}return a}return e&Node.DOCUMENT_POSITION_PRECEDING?((t=!!a)&&!(t=a===n)&&(t=T(n,a,w),t===null?t=!1:(h(t,!0,C,a,n),a=x,x=null,t=a!==null)),t):e&Node.DOCUMENT_POSITION_FOLLOWING?((t=!!a)&&!(t=a===r)&&(t=T(r,a,w),t===null?t=!1:(h(t,!0,ee,a,r),a=x,S=x=null,t=a!==null)),t):!1}function Qp(e,t){var n=e.ownerDocument.createRange();n.selectNodeContents(e),e=n.getBoundingClientRect(),window.scrollTo(window.scrollX+e.left,t?window.scrollY+e.top:window.scrollY+e.bottom-window.innerHeight)}Ip.prototype.scrollIntoView=function(e){if(typeof e==`object`)throw Error(s(566));var t=[];h(this._fragmentFiber.child,!1,Up,t,void 0,void 0);var n=!1!==e;if(t.length===0){var r=v(this._fragmentFiber);if(r=n?r[1]||r[0]||g(this._fragmentFiber):r[0]||r[1],r===null)return;if(r.tag===6){e=b(r),Qp(e,n);return}if(r=b(r),r.nodeType!==9){if(r.nodeType===11){n=`host`in r?r.host:null,n!==null&&n.scrollIntoView(e);return}r.scrollIntoView(e)}}for(r=n?t.length-1:0;r!==(n?-1:t.length);){var i=t[r];i.tag===6?(i=b(i),Qp(i,n)):b(i).scrollIntoView(e),r+=n?-1:1}};function $p(e,t){return e=b(e),em(e,t),!1}function em(e,t){e.reactFragments??=new Set,e.reactFragments.add(t)}function tm(e,t){var n=t._eventListeners;if(n!==null)for(var r=0;r<n.length;r++){var i=n[r];e.addEventListener(i.type,i.attachedListener,zp(i.optionsOrUseCapture))}e.nodeType!==3&&(n=t._observers,n!==null&&n.forEach(function(n){for(var r=0,i=0;i<qp.length;i++){var a=qp[i];(a.fragmentInstance!==t||a.observer!==n||a.instance!==e)&&(qp[r++]=a)}qp.length=r,n.observe(e)}),em(e,t))}function nm(e,t){var n=t._eventListeners;if(n!==null)for(var r=0;r<n.length;r++){var i=n[r];e.removeEventListener(i.type,i.attachedListener,zp(i.optionsOrUseCapture))}e.nodeType!==3&&(n=t._observers,n!==null&&n.forEach(function(n){typeof n.rootMargin==`string`?Yp(t,n,e):n.unobserve(e)}),e.reactFragments!=null&&e.reactFragments.delete(t))}function $(e){var t=e.firstChild;for(t&&t.nodeType===10&&(t=t.nextSibling);t;){var n=t;switch(t=t.nextSibling,n.nodeName){case`HTML`:case`HEAD`:case`BODY`:$(n),It(n);continue;case`SCRIPT`:case`STYLE`:continue;case`LINK`:if(n.rel.toLowerCase()===`stylesheet`)continue}e.removeChild(n)}}function rm(e,t,n,r){for(;e.nodeType===1;){var i=n;if(e.nodeName.toLowerCase()!==t.toLowerCase()){if(!r&&(e.nodeName!==`INPUT`||e.type!==`hidden`))break}else if(!r){if(t===`input`&&e.type===`hidden`){var a=i.name==null?null:``+i.name;if(i.type===`hidden`&&e.getAttribute(`name`)===a)return e}else return e}else if(!e[Pt])switch(t){case`meta`:if(!e.hasAttribute(`itemprop`))break;return e;case`link`:if(a=e.getAttribute(`rel`),a===`stylesheet`&&e.hasAttribute(`data-precedence`)||a!==i.rel||e.getAttribute(`href`)!==(i.href==null||i.href===``?null:i.href)||e.getAttribute(`crossorigin`)!==(i.crossOrigin==null?null:i.crossOrigin)||e.getAttribute(`title`)!==(i.title==null?null:i.title))break;return e;case`style`:if(e.hasAttribute(`data-precedence`))break;return e;case`script`:if(a=e.getAttribute(`src`),(a!==(i.src==null?null:i.src)||e.getAttribute(`type`)!==(i.type==null?null:i.type)||e.getAttribute(`crossorigin`)!==(i.crossOrigin==null?null:i.crossOrigin))&&a&&e.hasAttribute(`async`)&&!e.hasAttribute(`itemprop`))break;return e;default:return e}if(e=lm(e.nextSibling),e===null)break}return null}function im(e,t,n){if(t===``)return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!==`INPUT`||e.type!==`hidden`)&&!n||(e=lm(e.nextSibling),e===null))return null;return e}function am(e,t){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!==`INPUT`||e.type!==`hidden`)&&!t||(e=lm(e.nextSibling),e===null))return null;return e}function om(e){return e.data===`$?`||e.data===`$~`}function sm(e){return e.data===`$!`||e.data===`$?`&&e.ownerDocument.readyState!==`loading`}function cm(e,t){var n=e.ownerDocument;if(e.data===`$~`)e._reactRetry=t;else if(e.data!==`$?`||n.readyState!==`loading`)t();else{var r=function(){t(),n.removeEventListener(`DOMContentLoaded`,r)};n.addEventListener(`DOMContentLoaded`,r),e._reactRetry=r}}function lm(e){for(;e!=null;e=e.nextSibling){var t=e.nodeType;if(t===1||t===3)break;if(t===8){if(t=e.data,t===`$`||t===`$!`||t===`$?`||t===`$~`||t===`&`||t===`F!`||t===`F`)break;if(t===`/$`||t===`/&`)return null}}return e}var um=null;function dm(e){e=e.nextSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n===`/$`||n===`/&`){if(t===0)return lm(e.nextSibling);t--}else n!==`$`&&n!==`$!`&&n!==`$?`&&n!==`$~`&&n!==`&`||t++}e=e.nextSibling}return null}function fm(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n===`$`||n===`$!`||n===`$?`||n===`$~`||n===`&`){if(t===0)return e;t--}else n!==`/$`&&n!==`/&`||t++}e=e.previousSibling}return null}function pm(e,t){function n(){r=!0}if(e.ownerDocument.activeElement===e)return!0;var r=!1;try{e.ownerDocument.addEventListener(`focus`,n,!0),(e.focus||HTMLElement.prototype.focus).call(e,t)}finally{e.ownerDocument.removeEventListener(`focus`,n,!0)}return r}function mm(e){bp(function(){bp(function(t){return e(t)})})}function hm(e,t,n){switch(t=up(n),e){case`html`:if(e=t.documentElement,!e)throw Error(s(452));return e;case`head`:if(e=t.head,!e)throw Error(s(453));return e;case`body`:if(e=t.body,!e)throw Error(s(454));return e;default:throw Error(s(451))}}function gm(e,t,n){for(var r in n){var i=n[r];n.hasOwnProperty(r)&&i!=null&&tp(e,t,r,null,ip,i)}n.dangerouslySetInnerHTML!=null&&(e.textContent=``),e.onclick===xn&&(e.onclick=null),It(e)}function _m(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);It(e)}var vm=new Map,ym=new Set;function bm(e){if(typeof e.getRootNode==`function`){var t=e.getRootNode();if(t.nodeType===9||t.nodeType===11)return t}return e.nodeType===9?e:e.ownerDocument}var xm=j.d;j.d={f:Sm,r:Cm,D:Em,C:Dm,L:Om,m:km,X:jm,S:Am,M:Mm};function Sm(){var e=xm.f(),t=zd();return e||t}function Cm(e){var t=Rt(e);t!==null&&t.tag===5&&t.type===`form`?ac(t):xm.r(e)}var wm=typeof document>`u`?null:document;function Tm(e,t,n){var r=wm;if(r&&typeof t==`string`&&t){var i=on(t);i=`link[rel="`+e+`"][href="`+i+`"]`,typeof n==`string`&&(i+=`[crossorigin="`+n+`"]`),ym.has(i)||(ym.add(i),e={rel:e,crossOrigin:n,href:t},r.querySelector(i)===null&&(t=r.createElement(`link`),rp(t,`link`,e),Vt(t),r.head.appendChild(t)))}}function Em(e){xm.D(e),Tm(`dns-prefetch`,e,null)}function Dm(e,t){xm.C(e,t),Tm(`preconnect`,e,t)}function Om(e,t,n){xm.L(e,t,n);var r=wm;if(r&&e&&t){var i=`link[rel="preload"][as="`+on(t)+`"]`;t===`image`&&n&&n.imageSrcSet?(i+=`[imagesrcset="`+on(n.imageSrcSet)+`"]`,typeof n.imageSizes==`string`&&(i+=`[imagesizes="`+on(n.imageSizes)+`"]`)):i+=`[href="`+on(e)+`"]`;var a=i;switch(t){case`style`:a=Pm(e);break;case`script`:a=Rm(e)}if(!(vm.has(a)||(e=E({rel:`preload`,href:t===`image`&&n&&n.imageSrcSet?void 0:e,as:t},n),vm.set(a,e),r.querySelector(i)!==null||t===`style`&&r.querySelector(Fm(a))||t===`script`&&r.querySelector(zm(a))))){var o=r.createElement(`link`);rp(o,`link`,e),t===`style`&&(o[Ft]=!0,o.onload=o.onerror=function(){Ht(o)}),Vt(o),r.head.appendChild(o)}}}function km(e,t){xm.m(e,t);var n=wm;if(n&&e){var r=t&&typeof t.as==`string`?t.as:`script`,i=`link[rel="modulepreload"][as="`+on(r)+`"][href="`+on(e)+`"]`,a=i;switch(r){case`audioworklet`:case`paintworklet`:case`serviceworker`:case`sharedworker`:case`worker`:case`script`:a=Rm(e)}if(!vm.has(a)&&(e=E({rel:`modulepreload`,href:e},t),vm.set(a,e),n.querySelector(i)===null)){switch(r){case`audioworklet`:case`paintworklet`:case`serviceworker`:case`sharedworker`:case`worker`:case`script`:if(n.querySelector(zm(a)))return}r=n.createElement(`link`),rp(r,`link`,e),Vt(r),n.head.appendChild(r)}}}function Am(e,t,n){xm.S(e,t,n);var r=wm;if(r&&e){var i=Bt(r).hoistableStyles,a=Pm(e);t||=`default`;var o=i.get(a);if(!o){var s={loading:0,preload:null};if(o=r.querySelector(Fm(a)))s.loading=5;else{e=E({rel:`stylesheet`,href:e,"data-precedence":t},n),(n=vm.get(a))&&Hm(e,n);var c=o=r.createElement(`link`);Vt(c),rp(c,`link`,e),c._p=new Promise(function(e,t){c.onload=e,c.onerror=t}),c.addEventListener(`load`,function(){s.loading|=1}),c.addEventListener(`error`,function(){s.loading|=2}),s.loading|=4,Vm(o,t,r)}o={type:`stylesheet`,instance:o,count:1,state:s},i.set(a,o)}}}function jm(e,t){xm.X(e,t);var n=wm;if(n&&e){var r=Bt(n).hoistableScripts,i=Rm(e),a=r.get(i);a||(a=n.querySelector(zm(i)),a||(e=E({src:e,async:!0},t),(t=vm.get(i))&&Um(e,t),a=n.createElement(`script`),Vt(a),rp(a,`link`,e),n.head.appendChild(a)),a={type:`script`,instance:a,count:1,state:null},r.set(i,a))}}function Mm(e,t){xm.M(e,t);var n=wm;if(n&&e){var r=Bt(n).hoistableScripts,i=Rm(e),a=r.get(i);a||(a=n.querySelector(zm(i)),a||(e=E({src:e,async:!0,type:`module`},t),(t=vm.get(i))&&Um(e,t),a=n.createElement(`script`),Vt(a),rp(a,`link`,e),n.head.appendChild(a)),a={type:`script`,instance:a,count:1,state:null},r.set(i,a))}}function Nm(e,t,n,r){var i=(i=ke.current)?bm(i):null;if(!i)throw Error(s(446));switch(e){case`meta`:case`title`:return null;case`style`:return typeof n.precedence==`string`&&typeof n.href==`string`?(n=Pm(n.href),t=Bt(i).hoistableStyles,r=t.get(n),r||(r={type:`style`,instance:null,count:0,state:null},t.set(n,r)),r):{type:`void`,instance:null,count:0,state:null};case`link`:if(n.rel===`stylesheet`&&typeof n.href==`string`&&typeof n.precedence==`string`){e=Pm(n.href);var a=Bt(i).hoistableStyles,o=a.get(e);if(o||(i=i.ownerDocument||i,o={type:`stylesheet`,instance:null,count:0,state:{loading:0,preload:null}},a.set(e,o),(a=i.querySelector(Fm(e)))?a._p||(o.instance=a,o.state.loading=5):(a=vm.get(e),a||(a={rel:`preload`,as:`style`,href:n.href,crossOrigin:n.crossOrigin,integrity:n.integrity,media:n.media,hrefLang:n.hrefLang,referrerPolicy:n.referrerPolicy},vm.set(e,a)),Lm(i,e,a,o.state))),t&&r===null)throw Error(s(528,``));return o}if(t&&r!==null)throw Error(s(529,``));return null;case`script`:return t=n.async,n=n.src,typeof n==`string`&&t&&typeof t!=`function`&&typeof t!=`symbol`?(n=Rm(n),t=Bt(i).hoistableScripts,r=t.get(n),r||(r={type:`script`,instance:null,count:0,state:null},t.set(n,r)),r):{type:`void`,instance:null,count:0,state:null};default:throw Error(s(444,e))}}function Pm(e){return`href="`+on(e)+`"`}function Fm(e){return`link[rel="stylesheet"][`+e+`]`}function Im(e){return E({},e,{"data-precedence":e.precedence,precedence:null})}function Lm(e,t,n,r){if(t=e.querySelector(`link[rel="preload"][as="style"][`+t+`]`)){if(!0!==t[Ft]){r.loading=1;return}}else t=e.createElement(`link`),t[Ft]=!0,t.onload=t.onerror=Ht.bind(null,t),rp(t,`link`,n),Vt(t),e.head.appendChild(t);r.preload=t,t.addEventListener(`load`,function(){return r.loading|=1}),t.addEventListener(`error`,function(){return r.loading|=2})}function Rm(e){return`[src="`+on(e)+`"]`}function zm(e){return`script[async]`+e}function Bm(e,t,n){if(t.count++,t.instance===null)switch(t.type){case`style`:var r=e.querySelector(`style[data-href~="`+on(n.href)+`"]`);if(r)return t.instance=r,Vt(r),r;var i=E({},n,{"data-href":n.href,"data-precedence":n.precedence,href:null,precedence:null});return r=(e.ownerDocument||e).createElement(`style`),Vt(r),rp(r,`style`,i),Vm(r,n.precedence,e),t.instance=r;case`stylesheet`:i=Pm(n.href);var a=e.querySelector(Fm(i));if(a)return t.state.loading|=4,t.instance=a,Vt(a),a;r=Im(n),(i=vm.get(i))&&Hm(r,i),a=(e.ownerDocument||e).createElement(`link`),Vt(a);var o=a;return o._p=new Promise(function(e,t){o.onload=e,o.onerror=t}),rp(a,`link`,r),t.state.loading|=4,Vm(a,n.precedence,e),t.instance=a;case`script`:return a=Rm(n.src),(i=e.querySelector(zm(a)))?(t.instance=i,Vt(i),i):(r=n,(i=vm.get(a))&&(r=E({},n),Um(r,i)),e=e.ownerDocument||e,i=e.createElement(`script`),Vt(i),rp(i,`link`,r),e.head.appendChild(i),t.instance=i);case`void`:return null;default:throw Error(s(443,t.type))}else t.type===`stylesheet`&&!(t.state.loading&4)&&(r=t.instance,t.state.loading|=4,Vm(r,n.precedence,e));return t.instance}function Vm(e,t,n){for(var r=n.querySelectorAll(`link[rel="stylesheet"][data-precedence],style[data-precedence]`),i=r.length?r[r.length-1]:null,a=i,o=0;o<r.length;o++){var s=r[o];if(s.dataset.precedence===t)a=s;else if(a!==i)break}a?a.parentNode.insertBefore(e,a.nextSibling):(t=n.nodeType===9?n.head:n,t.insertBefore(e,t.firstChild))}function Hm(e,t){e.crossOrigin??=t.crossOrigin,e.referrerPolicy??=t.referrerPolicy,e.title??=t.title}function Um(e,t){e.crossOrigin??=t.crossOrigin,e.referrerPolicy??=t.referrerPolicy,e.integrity??=t.integrity}var Wm=null;function Gm(e,t,n){if(Wm===null){var r=new Map,i=Wm=new Map;i.set(n,r)}else i=Wm,r=i.get(n),r||(r=new Map,i.set(n,r));if(r.has(e))return r;for(r.set(e,null),n=n.getElementsByTagName(e),i=0;i<n.length;i++){var a=n[i];if(!(a[Pt]||a[Ot]||e===`link`&&a.getAttribute(`rel`)===`stylesheet`)&&a.namespaceURI!==`http://www.w3.org/2000/svg`){var o=a.getAttribute(t)||``;o=e+o;var s=r.get(o);s?s.push(a):r.set(o,[a])}}return r}function Km(e,t,n){e=e.ownerDocument||e,e.head.insertBefore(n,t===`title`?e.querySelector(`head > title`):null)}function qm(e,t,n){if(n===1||t.itemProp!=null)return!1;switch(e){case`meta`:case`title`:return!0;case`style`:if(typeof t.precedence!=`string`||typeof t.href!=`string`||t.href===``)break;return!0;case`link`:if(typeof t.rel!=`string`||typeof t.href!=`string`||t.href===``||t.onLoad||t.onError)break;switch(t.rel){case`stylesheet`:return e=t.disabled,typeof t.precedence==`string`&&e==null;default:return!0}case`script`:if(t.async&&typeof t.async!=`function`&&typeof t.async!=`symbol`&&!t.onLoad&&!t.onError&&t.src&&typeof t.src==`string`)return!0}return!1}function Jm(e,t){return e===`img`&&t.src!=null&&t.src!==``&&t.onLoad==null&&t.loading!==`lazy`}function Ym(e){return!(e.type===`stylesheet`&&!(e.state.loading&3))}function Xm(e){return(e.width||100)*(e.height||100)*(typeof devicePixelRatio==`number`?devicePixelRatio:1)*.25}function Zm(e,t){typeof t.decode==`function`&&(e.imgCount++,t.complete||(e.imgBytes+=Xm(t),e.suspenseyImages.push(t)),e=rh.bind(e),t.decode().then(e,e))}function Qm(e,t,n,r){if(n.type===`stylesheet`&&(typeof r.media!=`string`||!1!==matchMedia(r.media).matches)&&!(n.state.loading&4)){if(n.instance===null){var i=Pm(r.href),a=t.querySelector(Fm(i));if(a){t=a._p,typeof t==`object`&&t&&typeof t.then==`function`&&(e.count++,e=nh.bind(e),t.then(e,e)),n.state.loading|=4,n.instance=a,Vt(a);return}a=t.ownerDocument||t,r=Im(r),(i=vm.get(i))&&Hm(r,i),a=a.createElement(`link`),Vt(a);var o=a;o._p=new Promise(function(e,t){o.onload=e,o.onerror=t}),rp(a,`link`,r),n.instance=a}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(n,t),(t=n.state.preload)&&!(n.state.loading&3)&&(e.count++,n=nh.bind(e),t.addEventListener(`load`,n),t.addEventListener(`error`,n))}}var $m=0;function eh(e,t){return e.stylesheets&&e.count===0&&ah(e,e.stylesheets),0<e.count||0<e.imgCount?function(n){var r=setTimeout(function(){if(e.stylesheets&&ah(e,e.stylesheets),e.unsuspend){var t=e.unsuspend;e.unsuspend=null,t()}},6e4+t);0<e.imgBytes&&$m===0&&($m=62500*sp());var i=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&ah(e,e.stylesheets),e.unsuspend)){var t=e.unsuspend;e.unsuspend=null,t()}},(e.imgBytes>$m?50:800)+t);return e.unsuspend=n,function(){e.unsuspend=null,clearTimeout(r),clearTimeout(i)}}:null}function th(e){if(e.count===0&&(e.imgCount===0||!e.waitingForImages)){if(e.stylesheets)ah(e,e.stylesheets);else if(e.unsuspend){var t=e.unsuspend;e.unsuspend=null,t()}}}function nh(){this.count--,th(this)}function rh(){this.imgCount--,th(this)}var ih=null;function ah(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,ih=new Map,t.forEach(oh,e),ih=null,nh.call(e))}function oh(e,t){if(!(t.state.loading&4)){var n=ih.get(e);if(n)var r=n.get(null);else{n=new Map,ih.set(e,n);for(var i=e.querySelectorAll(`link[data-precedence],style[data-precedence]`),a=0;a<i.length;a++){var o=i[a];(o.nodeName===`LINK`||o.getAttribute(`media`)!==`not all`)&&(n.set(o.dataset.precedence,o),r=o)}r&&n.set(null,r)}i=t.instance,o=i.getAttribute(`data-precedence`),a=n.get(o)||r,a===r&&n.set(null,i),n.set(o,i),this.count++,r=nh.bind(this),i.addEventListener(`load`,r),i.addEventListener(`error`,r),a?a.parentNode.insertBefore(i,a.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(i,e.firstChild)),t.state.loading|=4}}var sh={$$typeof:ae,Provider:null,Consumer:null,_currentValue:xe,_currentValue2:xe,_threadCount:0};function ch(e,t,n,r,i,a,o,s,c){this.tag=1,this.containerInfo=e,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=_t(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=_t(0),this.hiddenUpdates=_t(null),this.identifierPrefix=r,this.onUncaughtError=i,this.onCaughtError=a,this.onRecoverableError=o,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=c,this.transitionTypes=null,this.incompleteTransitions=new Map}function lh(e,t,n,r,i,a,o,s,c,l,u,d){return e=new ch(e,t,n,o,c,l,u,d,s),t=1,!0===a&&(t|=24),a=Ni(3,null,null,t),e.current=a,a.stateNode=e,t=Na(),t.refCount++,e.pooledCache=t,t.refCount++,a.memoizedState={element:r,isDehydrated:n,cache:t},go(a),e}function uh(e){return e?(e=ji,e):ji}function dh(e,t,n,r,i,a){i=uh(i),r.context===null?r.context=i:r.pendingContext=i,r=vo(t),r.payload={element:n},a=a===void 0?null:a,a!==null&&(r.callback=a),n=yo(e,r,t),n!==null&&(Pd(n,e,t),bo(n,e,t))}function fh(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function ph(e,t){fh(e,t),(e=e.alternate)&&fh(e,t)}function mh(e){if(e.tag===13||e.tag===31){var t=Oi(e,67108864);t!==null&&Pd(t,e,67108864),ph(e,67108864)}}function hh(e){if(e.tag===13||e.tag===31){var t=jd();t=Ct(t);var n=Oi(e,t);n!==null&&Pd(n,e,t),ph(e,t)}}var gh=!0;function _h(e,t,n,r){var i=A.T;A.T=null;var a=j.p;try{j.p=2,yh(e,t,n,r)}finally{j.p=a,A.T=i}}function vh(e,t,n,r){var i=A.T;A.T=null;var a=j.p;try{j.p=8,yh(e,t,n,r)}finally{j.p=a,A.T=i}}function yh(e,t,n,r){if(gh){var i=bh(r);if(i===null)Kf(e,t,r,xh,n),Mh(e,r);else if(Ph(i,e,t,n,r))r.stopPropagation();else if(Mh(e,r),t&4&&-1<jh.indexOf(e)){for(;i!==null;){var a=Rt(i);if(a!==null)switch(a.tag){case 3:if(a=a.stateNode,a.current.memoizedState.isDehydrated){var o=dt(a.pendingLanes);if(o!==0){var s=a;for(s.pendingLanes|=2,s.entangledLanes|=2;o;){var c=1<<31-at(o);s.entanglements[1]|=c,o&=~c}Ef(a),!(K&6)&&(_d=qe()+500,Df(0,!1))}}break;case 31:case 13:s=Oi(a,2),s!==null&&Pd(s,a,2),zd(),ph(a,2)}if(a=bh(r),a===null&&Kf(e,t,r,xh,n),a===i)break;i=a}i!==null&&r.stopPropagation()}else Kf(e,t,r,null,n)}}function bh(e){return e=Cn(e),Sh(e)}var xh=null;function Sh(e){if(xh=null,e=Lt(e),e!==null){var t=l(e);if(t===null)e=null;else{var n=t.tag;if(n===13){if(e=u(t),e!==null)return e;e=null}else if(n===31){if(e=d(t),e!==null)return e;e=null}else if(n===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null)}}return xh=e,null}function Ch(e){switch(e){case`beforetoggle`:case`cancel`:case`click`:case`close`:case`contextmenu`:case`copy`:case`cut`:case`auxclick`:case`dblclick`:case`dragend`:case`dragstart`:case`drop`:case`focusin`:case`focusout`:case`input`:case`invalid`:case`keydown`:case`keypress`:case`keyup`:case`mousedown`:case`mouseup`:case`paste`:case`pause`:case`play`:case`pointercancel`:case`pointerdown`:case`pointerup`:case`ratechange`:case`reset`:case`seeked`:case`submit`:case`toggle`:case`touchcancel`:case`touchend`:case`touchstart`:case`volumechange`:case`change`:case`selectionchange`:case`textInput`:case`compositionstart`:case`compositionend`:case`compositionupdate`:case`beforeblur`:case`afterblur`:case`beforeinput`:case`blur`:case`fullscreenchange`:case`fullscreenerror`:case`focus`:case`hashchange`:case`popstate`:case`select`:case`selectstart`:return 2;case`drag`:case`dragenter`:case`dragexit`:case`dragleave`:case`dragover`:case`mousemove`:case`mouseout`:case`mouseover`:case`pointermove`:case`pointerout`:case`pointerover`:case`resize`:case`scroll`:case`touchmove`:case`wheel`:case`mouseenter`:case`mouseleave`:case`pointerenter`:case`pointerleave`:return 8;case`message`:switch(Je()){case Ye:return 2;case Xe:return 8;case Ze:case Qe:return 32;case $e:return 268435456;default:return 32}default:return 32}}var wh=!1,Th=null,Eh=null,Dh=null,Oh=new Map,kh=new Map,Ah=[],jh=`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 Mh(e,t){switch(e){case`focusin`:case`focusout`:Th=null;break;case`dragenter`:case`dragleave`:Eh=null;break;case`mouseover`:case`mouseout`:Dh=null;break;case`pointerover`:case`pointerout`:Oh.delete(t.pointerId);break;case`gotpointercapture`:case`lostpointercapture`:kh.delete(t.pointerId)}}function Nh(e,t,n,r,i,a){return e===null||e.nativeEvent!==a?(e={blockedOn:t,domEventName:n,eventSystemFlags:r,nativeEvent:a,targetContainers:[i]},t!==null&&(t=Rt(t),t!==null&&mh(t)),e):(e.eventSystemFlags|=r,t=e.targetContainers,i!==null&&t.indexOf(i)===-1&&t.push(i),e)}function Ph(e,t,n,r,i){switch(t){case`focusin`:return Th=Nh(Th,e,t,n,r,i),!0;case`dragenter`:return Eh=Nh(Eh,e,t,n,r,i),!0;case`mouseover`:return Dh=Nh(Dh,e,t,n,r,i),!0;case`pointerover`:var a=i.pointerId;return Oh.set(a,Nh(Oh.get(a)||null,e,t,n,r,i)),!0;case`gotpointercapture`:return a=i.pointerId,kh.set(a,Nh(kh.get(a)||null,e,t,n,r,i)),!0}return!1}function Fh(e){var t=Lt(e.target);if(t!==null){var n=l(t);if(n!==null){if(t=n.tag,t===13){if(t=u(n),t!==null){e.blockedOn=t,Et(e.priority,function(){hh(n)});return}}else if(t===31){if(t=d(n),t!==null){e.blockedOn=t,Et(e.priority,function(){hh(n)});return}}else if(t===3&&n.stateNode.current.memoizedState.isDehydrated){e.blockedOn=n.tag===3?n.stateNode.containerInfo:null;return}}}e.blockedOn=null}function Ih(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=bh(e.nativeEvent);if(n===null){n=e.nativeEvent;var r=new n.constructor(n.type,n);Sn=r,n.target.dispatchEvent(r),Sn=null}else return t=Rt(n),t!==null&&mh(t),e.blockedOn=n,!1;t.shift()}return!0}function Lh(e,t,n){Ih(e)&&n.delete(t)}function Rh(){wh=!1,Th!==null&&Ih(Th)&&(Th=null),Eh!==null&&Ih(Eh)&&(Eh=null),Dh!==null&&Ih(Dh)&&(Dh=null),Oh.forEach(Lh),kh.forEach(Lh)}function zh(e,n){e.blockedOn===n&&(e.blockedOn=null,wh||(wh=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,Rh)))}var Bh=null;function Vh(e){Bh!==e&&(Bh=e,t.unstable_scheduleCallback(t.unstable_NormalPriority,function(){Bh===e&&(Bh=null);for(var t=0;t<e.length;t+=3){var n=e[t],r=e[t+1],i=e[t+2];if(typeof r!=`function`){if(Sh(r||n)===null)continue;break}var a=Rt(n);a!==null&&(e.splice(t,3),t-=3,rc(a,{pending:!0,data:i,method:n.method,action:r},r,i))}}))}function Hh(e){function t(t){return zh(t,e)}Th!==null&&zh(Th,e),Eh!==null&&zh(Eh,e),Dh!==null&&zh(Dh,e),Oh.forEach(t),kh.forEach(t);for(var n=0;n<Ah.length;n++){var r=Ah[n];r.blockedOn===e&&(r.blockedOn=null)}for(;0<Ah.length&&(n=Ah[0],n.blockedOn===null);)Fh(n),n.blockedOn===null&&Ah.shift();if(n=(e.ownerDocument||e).$$reactFormReplay,n!=null)for(r=0;r<n.length;r+=3){var i=n[r],a=n[r+1],o=i[kt]||null;if(typeof a==`function`)o||Vh(n);else if(o){var s=null;if(a&&a.hasAttribute(`formAction`)){if(i=a,o=a[kt]||null)s=o.formAction;else if(Sh(i)!==null)continue}else s=o.action;typeof s==`function`?n[r+1]=s:(n.splice(r,3),r-=3),Vh(n)}}}function Uh(){function e(e){e.canIntercept&&e.info===`react-transition`&&e.intercept({handler:function(){return new Promise(function(e){return i=e})},focusReset:`manual`,scroll:`manual`})}function t(){i!==null&&(i(),i=null),r||setTimeout(n,20)}function n(){if(!r&&!navigation.transition){var e=navigation.currentEntry;e&&e.url!=null&&navigation.navigate(e.url,{state:e.getState(),info:`react-transition`,history:`replace`})}}if(typeof navigation==`object`){var r=!1,i=null;return navigation.addEventListener(`navigate`,e),navigation.addEventListener(`navigatesuccess`,t),navigation.addEventListener(`navigateerror`,t),setTimeout(n,100),function(){r=!0,navigation.removeEventListener(`navigate`,e),navigation.removeEventListener(`navigatesuccess`,t),navigation.removeEventListener(`navigateerror`,t),i!==null&&(i(),i=null)}}}function Wh(e){this._internalRoot=e}Gh.prototype.render=Wh.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(s(409));var n=t.current;dh(n,jd(),e,t,null,null)},Gh.prototype.unmount=Wh.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;dh(e.current,2,null,e,null,null),zd(),t[At]=null}};function Gh(e){this._internalRoot=e}Gh.prototype.unstable_scheduleHydration=function(e){if(e){var t=Tt();e={blockedOn:null,target:e,priority:t};for(var n=0;n<Ah.length&&t!==0&&t<Ah[n].priority;n++);Ah.splice(n,0,e),n===0&&Fh(e)}};var Kh=r.version;if(Kh!==`19.3.1`)throw Error(s(527,Kh,`19.3.1`));j.findDOMNode=function(e){var t=e._reactInternals;if(t===void 0)throw typeof e.render==`function`?Error(s(188)):(e=Object.keys(e).join(`,`),Error(s(268,e)));return e=p(t),e=e===null?null:m(e),e=e===null?null:e.stateNode,e};var qh={bundleType:0,version:`19.3.1`,rendererPackageName:`react-dom`,currentDispatcherRef:A,reconcilerVersion:`19.3.1`};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<`u`){var Jh=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Jh.isDisabled&&Jh.supportsFiber)try{nt=Jh.inject(qh),rt=Jh}catch{}}e.createRoot=function(e,t){if(!c(e))throw Error(s(299));var n=!1,r=``,i=Tc,a=Ec,o=Dc;return t!=null&&(!0===t.unstable_strictMode&&(n=!0),t.identifierPrefix!==void 0&&(r=t.identifierPrefix),t.onUncaughtError!==void 0&&(i=t.onUncaughtError),t.onCaughtError!==void 0&&(a=t.onCaughtError),t.onRecoverableError!==void 0&&(o=t.onRecoverableError)),t=lh(e,1,!1,null,null,n,r,null,i,a,o,Uh),e[At]=t.current,Wf(e),new Wh(t)}})),c=e(((e,t)=>{function n(){if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<`u`&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE==`function`)try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}n(),t.exports=s()})),l=n(),u=c(),d=[`claude`,`gemini`,`codex`,`opencode`,`qwen`,`grok`,`kimi`,`crush`,`pi`,`copilot`,`cursor`,`custom`],f={claude:{label:`Claude Code`,bin:`claude`,hooks:!0,mcp:!0,modes:!0,payload:`all`,check:`run`,model:[`sonnet`,`opus`,`haiku`],install:`npm install -g @anthropic-ai/claude-code@latest`,docs:`https://code.claude.com/docs/en/setup`},gemini:{label:`Gemini CLI`,bin:`gemini`,hooks:!0,mcp:!0,modes:!0,payload:`servers`,check:`local`,model:[`auto`,`pro`,`flash`,`flash-lite`],install:`npm install -g @google/gemini-cli`,docs:`https://github.com/google-gemini/gemini-cli`},codex:{label:`Codex`,bin:`codex`,hooks:!1,mcp:!0,modes:!0,payload:null,check:`docs`,model:[],install:`npm install -g @openai/codex`,docs:`https://github.com/openai/codex`},opencode:{label:`opencode`,bin:`opencode`,hooks:!1,mcp:!0,modes:!1,payload:null,check:`docs`,model:null,install:`curl -fsSL https://opencode.ai/v2/install | bash`,docs:`https://opencode.ai/docs/`},qwen:{label:`Qwen Code`,bin:`qwen`,hooks:!1,mcp:!1,modes:!1,payload:null,check:`docs`,model:null,install:`curl -fsSL https://qwen-code-assets.oss-cn-hangzhou.aliyuncs.com/installation/install-qwen-standalone.sh | bash`,docs:`https://github.com/QwenLM/qwen-code`},grok:{label:`Grok CLI`,bin:`grok`,hooks:!1,mcp:!1,modes:!1,payload:null,check:`docs`,model:null,install:`curl -fsSL https://raw.githubusercontent.com/superagent-ai/grok-cli/main/install.sh | bash`,docs:`https://github.com/superagent-ai/grok-cli`},kimi:{label:`Kimi CLI`,bin:`kimi`,hooks:!1,mcp:!0,modes:!1,payload:`servers`,check:`docs`,model:[],install:null,docs:`https://moonshotai.github.io/kimi-cli/`},crush:{label:`Crush`,bin:`crush`,hooks:!1,mcp:!1,modes:!1,payload:null,check:`docs`,model:null,install:`brew install charmbracelet/tap/crush`,docs:`https://github.com/charmbracelet/crush`},pi:{label:`pi`,bin:`pi`,hooks:!1,mcp:!1,modes:!1,payload:null,check:`local`,model:[`sonnet`,`haiku`],install:`curl -fsSL https://pi.dev/install.sh | sh`,docs:`https://pi.dev/`},copilot:{label:`Copilot CLI`,bin:`copilot`,hooks:!1,mcp:!0,modes:!1,payload:null,check:`docs`,model:null,install:`curl -fsSL https://gh.io/copilot-install | bash`,docs:`https://github.com/github/copilot-cli`},cursor:{label:`Cursor Agent`,bin:`cursor-agent`,hooks:!1,mcp:!1,modes:!1,payload:null,check:`docs`,model:[],install:`curl https://cursor.com/install -fsS | bash`,docs:`https://cursor.com/docs/cli/overview`},custom:{label:`Custom command`,bin:``,hooks:!1,mcp:!1,modes:!1,payload:null,check:`run`,model:null,install:null,docs:``}},p=`^[A-Za-z0-9][A-Za-z0-9._:/@+-]{0,99}$`,m=`^[A-Z][A-Z0-9_]{0,63}$`,h=`^[\\x21-\\x7e]{1,4096}$`,g=[`ANTHROPIC_API_KEY`,`OPENAI_API_KEY`,`GEMINI_API_KEY`,`XAI_API_KEY`,`OPENROUTER_API_KEY`,`GROQ_API_KEY`],_=e=>f[e??`claude`],v=`cleanroom`,y=e=>`gonogo/${e}`,b=[`user`,`boss`],x=`^[a-z0-9][a-z0-9-]{0,31}$`,S=4e3,C=1024,ee=2e4,w=(e,t)=>`Launch Window: ${e}${t===``?``:`: ${t}`}`,T=4e3,E=2e4,te=1e4,D=[`linear`,`slack`],ne=[`message`,`redline`,`tminus`,`flight-plan`],O=e=>`Uplink: ${e}`,re=`/api`,k=`gonogo.v1`,ie=`token.`,ae=32768,oe=`gonogo.token`,se=[500,1e3,2e3,4e3,8e3,1e4],ce=2e3,le=6e5,ue={starting:`starting`,idle:`idle`,working:`working`,needs_you:`needs you`,stopped:`stopped`},de=[`5h`,`day`,`week`,`month`],fe=[`simsup`,`retro`],pe=1048576,me=1e4,he=[{name:`--body`,role:`the page and the body of the device`},{name:`--panel`,role:`a module, one step lighter or darker than the body`},{name:`--key`,role:`a key, a console, an input: the most raised surface`},{name:`--well`,role:`a sunk surface: a stopped console, a read-only field`},{name:`--edge`,role:`the thin line around a module or a key`},{name:`--edge-2`,role:`a dashed line: an open seat`},{name:`--text`,role:`the main text, and the fill of the primary key`},{name:`--text-2`,role:`second text, on a surface and on a tint`},{name:`--muted`,role:`small quiet text, on the body, a module or a key`},{name:`--lcd`,role:`the dark screen of the terminal, the clock and the numbers`},{name:`--lcd-text`,role:`text on the screen`},{name:`--lcd-dim`,role:`quiet text on the screen`},{name:`--lcd-warm`,role:`text on the screen of a console that needs the Director`},{name:`--work`,role:`the working signal: a light and a chip outline`},{name:`--you`,role:`the signal that needs the Director`},{name:`--you-tint`,role:`the fill of what needs the Director`},{name:`--you-edge`,role:`the line around that fill`},{name:`--you-ink`,role:`text on that fill`},{name:`--you-key`,role:`the line of a key that sits on that fill`},{name:`--go`,role:`the go signal`},{name:`--go-tint`,role:`the fill of a go`},{name:`--go-ink`,role:`text on that fill`},{name:`--go-lit`,role:`the go light on a dark key`},{name:`--nogo`,role:`the no-go signal and the line of a danger`},{name:`--nogo-text`,role:`danger text, on the page and on its tint`},{name:`--nogo-tint`,role:`the fill of a no-go or an error`},{name:`--track`,role:`an empty ring, a vote that has not come`},{name:`--seq-base`,role:`the empty line of a sequence track`}].map(e=>e.name),ge=`instrument`,_e=4.5,ve=.2,ye=[[`--text`,[`--body`,`--panel`,`--key`,`--well`,`--you-tint`,`--go-tint`,`--nogo-tint`]],[`--text-2`,[`--body`,`--panel`,`--key`,`--well`,`--you-tint`,`--go-tint`,`--nogo-tint`]],[`--muted`,[`--body`,`--panel`,`--key`,`--well`]],[`--work`,[`--panel`,`--key`]],[`--nogo-text`,[`--body`,`--panel`,`--key`,`--nogo-tint`]],[`--you-ink`,[`--you-tint`]],[`--go-ink`,[`--go-tint`]],[`--panel`,[`--text`]],[`--lcd-text`,[`--lcd`]],[`--lcd-dim`,[`--lcd`]],[`--lcd-warm`,[`--lcd`]]],be=`[+-]?(?:\\d+\\.?\\d*|\\.\\d+)`,A=RegExp(`^${be}$`),j=RegExp(`^${be}%$`),xe=RegExp(`^${be}(?:deg)?$`),Se=/^#(?:[0-9a-f]{3}|[0-9a-f]{6})$/i,Ce=/^(rgb|hsl|oklch)\(\s*([^()]*?)\s*\)$/i,we=(e,t=0,n=1)=>Math.min(n,Math.max(t,e)),Te=e=>e<=.04045?e/12.92:((e+.055)/1.055)**2.4,Ee=e=>e<=.0031308?e*12.92:1.055*e**(1/2.4)-.055;function De(e){let t=e.includes(`,`)?e.split(/\s*,\s*/):e.split(/\s+/);return t.length===3&&t.every(e=>e!==``)?t:null}function Oe(e,t,n){let r=t*Math.min(n,1-n),i=t=>{let i=(t+e/30)%12;return n-r*Math.max(-1,Math.min(i-3,9-i,1))};return[i(0),i(8),i(4)]}function ke(e,t,n){let r=t*Math.cos(n*Math.PI/180),i=t*Math.sin(n*Math.PI/180),a=(e+.3963377774*r+.2158037573*i)**3,o=(e-.1055613458*r-.0638541728*i)**3,s=(e-.0894841775*r-1.291485548*i)**3;return[we(4.0767416621*a-3.3077115913*o+.2309699292*s),we(-1.2684380046*a+2.6097574011*o-.3413193965*s),we(-.0041960863*a-.7034186147*o+1.707614701*s)]}function Ae(e){let t=e.trim();if(Se.test(t)){let e=t.length===4?[...t.slice(1)].map(e=>e+e).join(``):t.slice(1);return[0,2,4].map(t=>Te(parseInt(e.slice(t,t+2),16)/255))}let n=Ce.exec(t),r=n?De(n[2]??``):null;if(!n||!r)return null;let[i=``,a=``,o=``]=r;switch((n[1]??``).toLowerCase()){case`rgb`:{let e=j.test(i);if(!r.every(t=>e?j.test(t):A.test(t)))return null;let t=r.map(t=>parseFloat(t)/(e?100:255));return t.every(e=>e>=0&&e<=1)?t.map(Te):null}case`hsl`:{if(!xe.test(i)||!j.test(a)||!j.test(o))return null;let e=parseFloat(a)/100,t=parseFloat(o)/100;return e<0||e>1||t<0||t>1?null:Oe((parseFloat(i)%360+360)%360,e,t).map(Te)}default:{let e=j.test(i)?parseFloat(i)/100:A.test(i)?parseFloat(i):NaN;return!(e>=0&&e<=1)||!A.test(a)||parseFloat(a)<0||!xe.test(o)?null:ke(e,parseFloat(a),parseFloat(o))}}}var je=e=>typeof e==`string`&&e.length<=64&&Ae(e)!==null;function Me(e){let t=Ae(e);return t===null?null:`#${t.map(e=>Math.round(we(Ee(e))*255).toString(16).padStart(2,`0`)).join(``)}`}function Ne(e){let t=Ae(e);return t===null?null:.2126*t[0]+.7152*t[1]+.0722*t[2]}function Pe(e,t){let n=Ne(e),r=Ne(t);return n===null||r===null?null:(Math.max(n,r)+.05)/(Math.min(n,r)+.05)}var Fe=e=>(Ne(e[`--body`]??``)??1)<.18?`dark`:`light`;function Ie(e){if(typeof e!=`object`||!e||Array.isArray(e))return[`tokens must be an object of token names and colours`];let t=e,n=[];for(let e of Object.keys(t))he.includes(e)||n.push(`${e} is not a token of a livery`);let r=he.filter(e=>!Object.hasOwn(t,e));r.length>0&&n.push(`missing: ${r.join(`, `)}`);for(let e of he)Object.hasOwn(t,e)&&!je(t[e])&&n.push(`${e} must be a colour written as #rgb, #rrggbb, rgb(), hsl() or oklch() with no alpha`);if(n.length>0)return n;let i=t;for(let[e,t]of ye)for(let r of t){let t=Pe(i[e]??``,i[r]??``)??0;t<4.5&&n.push(`${e} on ${r} is ${t.toFixed(2)}:1, it needs ${_e}:1`)}return(Ne(i[`--lcd`]??``)??1)>=.2&&n.push(`--lcd must be a dark screen (relative luminance under ${ve})`),n}function Le(e){return[...he.flatMap(t=>je(e[t])?[[t,e[t].trim()]]:[]),[`color-scheme`,Fe(e)]]}var Re=[{slug:`instrument`,name:`Instrument`,description:`The default: a warm grey device with a small green screen.`,tokens:{"--body":`#e4e2dc`,"--panel":`#f1f0ec`,"--key":`#faf9f6`,"--well":`#e9e7e1`,"--edge":`#c9c6be`,"--edge-2":`#b1aea6`,"--text":`#26272b`,"--text-2":`#44463f`,"--muted":`#61605b`,"--lcd":`#2b2f2a`,"--lcd-text":`#cfe6c9`,"--lcd-dim":`#9fb79b`,"--lcd-warm":`#f1d79a`,"--work":`#4a5bd4`,"--you":`#e0a93a`,"--you-tint":`#f4e3b7`,"--you-edge":`#d9b45a`,"--you-ink":`#5c4a1c`,"--you-key":`#b8933f`,"--go":`#5e9e73`,"--go-tint":`#d7e8da`,"--go-ink":`#2c5a3a`,"--go-lit":`#7cc493`,"--nogo":`#c2414b`,"--nogo-text":`#a8323c`,"--nogo-tint":`#f5d9da`,"--track":`#d6d3cb`,"--seq-base":`#e2dfd7`}},{slug:`night-shift`,name:`Night Shift`,description:`A dark graphite device with a mint screen, for working at night.`,tokens:{"--body":`#16181d`,"--panel":`#1e2127`,"--key":`#272b33`,"--well":`#121418`,"--edge":`#353a44`,"--edge-2":`#4a5160`,"--text":`#e8e9ec`,"--text-2":`#c5c8cf`,"--muted":`#9ba1ac`,"--lcd":`#0b0e0d`,"--lcd-text":`#a9ecd4`,"--lcd-dim":`#6fb8a0`,"--lcd-warm":`#f4cf80`,"--work":`#93a0ff`,"--you":`#e5b04c`,"--you-tint":`#3a2f15`,"--you-edge":`#8d6f27`,"--you-ink":`#f6d890`,"--you-key":`#b8933f`,"--go":`#5cbf86`,"--go-tint":`#17352a`,"--go-ink":`#a3e6bf`,"--go-lit":`#7bd9a0`,"--nogo":`#e5606b`,"--nogo-text":`#ff9ea6`,"--nogo-tint":`#43191f`,"--track":`#353a44`,"--seq-base":`#2a2e36`}},{slug:`low-ink`,name:`Low Ink`,description:`Near-white paper with thin grey lines and pale tints: little toner when printed.`,tokens:{"--body":`#f7f6f2`,"--panel":`#fbfaf7`,"--key":`#ffffff`,"--well":`#efede7`,"--edge":`#bdb9af`,"--edge-2":`#8c887d`,"--text":`#141414`,"--text-2":`#333330`,"--muted":`#55524b`,"--lcd":`#2a2a2a`,"--lcd-text":`#f0f0ea`,"--lcd-dim":`#b8b8b0`,"--lcd-warm":`#f2d98e`,"--work":`#2f3fa8`,"--you":`#b77a05`,"--you-tint":`#fcf4dc`,"--you-edge":`#d2b25a`,"--you-ink":`#4f3b08`,"--you-key":`#a07a1a`,"--go":`#2f7d52`,"--go-tint":`#e8f3ec`,"--go-ink":`#1f4d33`,"--go-lit":`#7cc493`,"--nogo":`#b3261e`,"--nogo-text":`#96211a`,"--nogo-tint":`#fbe9e7`,"--track":`#cfcbc1`,"--seq-base":`#e6e3db`}},{slug:`high-contrast`,name:`High Contrast`,description:`Black on white with black lines and strong signals: every text is 7:1 or better.`,tokens:{"--body":`#ffffff`,"--panel":`#ffffff`,"--key":`#ffffff`,"--well":`#ebebeb`,"--edge":`#1a1a1a`,"--edge-2":`#555555`,"--text":`#000000`,"--text-2":`#111111`,"--muted":`#2e2e2e`,"--lcd":`#000000`,"--lcd-text":`#ffffff`,"--lcd-dim":`#cfcfcf`,"--lcd-warm":`#ffe27a`,"--work":`#0b1bb3`,"--you":`#8a5a00`,"--you-tint":`#ffeeb0`,"--you-edge":`#5c3d00`,"--you-ink":`#2e1d00`,"--you-key":`#5c3d00`,"--go":`#00692f`,"--go-tint":`#cdf2da`,"--go-ink":`#00290f`,"--go-lit":`#5be08c`,"--nogo":`#b00020`,"--nogo-text":`#7d0017`,"--nogo-tint":`#ffd6dc`,"--track":`#6b6b6b`,"--seq-base":`#c4c4c4`}}],ze=Re[0],Be=()=>Re.map(e=>({...e,tokens:{...e.tokens},builtin:!0,author:null})),Ve=()=>({current:ge,liveries:Be()}),He={rev:0,changed:[],removed:[]},Ue=[`title`,`tags`,`body`],We=()=>({title:``,tags:``,body:``}),Ge=e=>({title:e.title,tags:e.tags.join(` `),body:e.body}),Ke=e=>[...new Set(e.toLowerCase().split(/[\s,]+/).filter(Boolean))];function qe(e){let t={},n=e.title.trim();n===``?t.title=`Give it a title.`:n.length>200?t.title=`At most 200 characters.`:n.includes(`
|
|
10
|
-
`)&&(t.title=`One line.`);let r=Ke(e.tags);r.length>8?t.tags=`At most 8 tags.`:r.every(e=>RegExp(`^[a-z0-9][a-z0-9._-]{0,29}$`).test(e))||(t.tags=`A tag is 1 to 30 letters, digits, dots, dashes or underscores.`);let i=e.body.trim();return i===``?t.body=`Write the entry.`:i.length>2e4&&(t.body=`At most ${E} characters.`),t}var Je=e=>({title:e.title.trim(),body:e.body.trim(),tags:Ke(e.tags)});function Ye(e,t){let n=`${t.total} ${t.total===1?`entry`:`entries`}`;return e.trim()===``?t.total===0?`No entries yet.`:t.hits.length<t.total?`${t.hits.length} newest of ${n}.`:`${n}.`:`${t.hits.length===0?`Nothing`:`${t.hits.length} found`} in ${n}.`}function Xe(e){return[e.changed.length>0?`Written or changed: ${e.changed.map(e=>e.title).join(`, `)}`:``,e.removed.length>0?`Removed: ${e.removed.join(`, `)}`:``].filter(Boolean).join(`. `)}var Ze=e=>`log-row-${e}`,Qe=`gonogo.selected`;function $e(){try{let e=Reflect.get(globalThis,`localStorage`);return typeof e==`object`&&e?e:null}catch{return null}}function et(e){try{return $e()?.getItem(e)??null}catch{return null}}function tt(e,t){try{let n=$e();if(n===null)return;t===null?n.removeItem(e):n.setItem(e,t)}catch{}}function nt(e){let t=e,n=new Set;return{getState:()=>t,setState(e){let r=typeof e==`function`?e(t):e;if(!Object.is(r,t)){t=r;for(let e of[...n])e()}},subscribe(e){return n.add(e),()=>{n.delete(e)}}}}var rt={limit:null,working:0,holding:0},it={room:{used:{"5h":0,day:0,week:0,month:0},limits:{}},agents:{}},at={unread:0,items:[]},ot={station:``,docks:[]};function st(){return{connection:`connecting`,failedAttempts:0,info:null,agents:Object.create(null),order:[],activity:[],selected:null,form:null,view:`room`,consoleOpen:!1,envelopes:[],poll:null,governor:rt,propellant:it,schedules:[],uplinks:[],tasks:[],downlink:at,log:He,livery:Ve(),docking:ot,relief:[],rollout:null}}var M=nt({...st(),selected:et(Qe)}),ct={selected:M.getState().selected};M.subscribe(()=>{let{selected:e}=M.getState();e!==ct.selected&&(ct.selected=e,tt(Qe,e))});var lt=e=>M.setState(t=>({...t,selected:e,consoleOpen:!0,view:`room`})),ut=()=>M.setState(e=>e.consoleOpen?{...e,consoleOpen:!1}:e),dt=()=>M.setState(e=>({...e,view:`room`,consoleOpen:!1})),ft=()=>M.setState(e=>({...e,view:`loop`,consoleOpen:!1})),pt=()=>M.setState(e=>({...e,view:`window`,consoleOpen:!1})),mt=()=>M.setState(e=>({...e,view:`plan`,consoleOpen:!1})),ht=()=>M.setState(e=>({...e,view:`downlink`,consoleOpen:!1})),gt=()=>M.setState(e=>({...e,view:`log`,consoleOpen:!1})),_t=()=>M.setState(e=>({...e,view:`livery`,consoleOpen:!1})),vt=()=>M.setState(e=>({...e,view:`rules`,consoleOpen:!1})),yt=()=>M.setState(e=>({...e,view:`party`,consoleOpen:!1})),bt=()=>M.setState(e=>({...e,view:`board`,consoleOpen:!1})),xt=()=>M.setState(e=>({...e,view:`blackbox`,consoleOpen:!1})),St=()=>M.setState(e=>({...e,view:`hangar`,consoleOpen:!1})),Ct=()=>M.setState(e=>({...e,view:`recorder`,consoleOpen:!1})),wt=e=>M.setState(t=>({...t,selected:e,view:`hangar`,consoleOpen:!1})),Tt=e=>M.setState(t=>({...t,selected:e,view:`recorder`,consoleOpen:!1})),Et=e=>M.setState(t=>t.selected===e?t:{...t,selected:e}),Dt=(e=null)=>M.setState(t=>({...t,form:{mode:`hire`,position:e}})),Ot=e=>M.setState(t=>({...t,form:{mode:`edit`,name:e}})),kt=Date.now(),At,jt=new Set;function Mt(e){return jt.add(e),At===void 0&&(kt=Date.now(),At=setInterval(()=>{kt=Date.now();for(let e of[...jt])e()},1e3)),()=>{jt.delete(e),jt.size===0&&(clearInterval(At),At=void 0)}}function Nt(){return(0,l.useSyncExternalStore)(Mt,()=>kt,()=>kt)}function N(e){let t=()=>e(M.getState());return(0,l.useSyncExternalStore)(M.subscribe,t,t)}function Pt(e){return Object.keys(e).sort((t,n)=>{let r=(e[t]?.desk??0)-(e[n]?.desk??0);return r===0?t<n?-1:+(t>n):r})}function Ft(e){let t=Object.create(null);for(let n of e)t[n.name]=n;return t}function It(e,t){let n=Ft(Object.values(e));return n[t.name]=t,n}function Lt(e,t){return e.length===t.length&&e.every((e,n)=>e===t[n])}function Rt(e,t){return t.find(t=>e[t]?.boss===!0)??t[0]??null}function zt(e){let t=new Set,n=[];for(let r of[...e].sort((e,t)=>t.at-e.at))if(!t.has(r.id)&&(t.add(r.id),n.push(r),n.length===200))break;return n}function Bt(e,t){let n=e.filter(e=>t-e.startedAt<ce);return n.length===e.length?e:n}function Vt(e,t){let n=Bt(e.envelopes,t);return n===e.envelopes?e:{...e,envelopes:n}}function Ht(e,t,n){let r=Ft(t.agents),i=Pt(r),a=Lt(e.order,i)?e.order:i,o=e.selected!==null&&Object.hasOwn(r,e.selected)?e.selected:Rt(r,a);return{...e,info:t.info,agents:r,order:a,activity:zt(t.activity),selected:o,envelopes:Bt(e.envelopes,n),poll:t.poll,governor:t.governor,propellant:t.propellant??it,schedules:t.schedules??[],uplinks:t.uplinks??[],tasks:t.tasks??[],downlink:t.downlink??at,livery:t.livery??Ve(),docking:t.docking??ot,relief:t.relief?.requests??[],rollout:t.rollout??null,log:{rev:e.log.rev+1,changed:[],removed:[]}}}function Ut(e,t,n){let r=Object.hasOwn(e.agents,t.name)?e.agents[t.name]:void 0,i=It(e.agents,t),a=r===void 0||r.desk!==t.desk?Pt(i):e.order;return{...e,agents:i,order:Lt(e.order,a)?e.order:a,selected:e.selected??Rt(i,a),envelopes:Bt(e.envelopes,n)}}function Wt(e,t,n){if(!Object.hasOwn(e.agents,t))return Vt(e,n);let r=Ft(Object.values(e.agents).filter(e=>e.name!==t)),i=e.order.filter(e=>e!==t);return{...e,agents:r,order:i,selected:e.selected===t?Rt(r,i):e.selected,envelopes:Bt(e.envelopes,n)}}function Gt(e,t){let n=t=>t===`user`||Object.hasOwn(e,t);return t.status!==`undelivered`&&t.from!==t.to&&n(t.from)&&n(t.to)}function Kt(e,t,n){let r=e.activity.findIndex(e=>e.id===t.id),i=Bt(e.envelopes,n);if(r>=0&&e.activity[r]?.at===t.at){let n=e.activity.slice();return n[r]=t,{...e,activity:n,envelopes:i}}let a=r>=0?e.activity.filter((e,t)=>t!==r):e.activity,o=a.findIndex(e=>e.at<=t.at),s=o<0?a.length:o,c=[...a.slice(0,s),t,...a.slice(s)].slice(0,200),l=r<0&&s<200;return{...e,activity:c,envelopes:l&&Gt(e.agents,t)?[...i,{id:t.id,from:t.from,to:t.to,startedAt:n}]:i}}function qt(e,t,n){switch(t.t){case`state`:return Ht(e,t.state,n);case`agent`:return Ut(e,t.agent,n);case`agent-removed`:return Wt(e,t.name,n);case`activity`:return Kt(e,t.item,n);case`poll`:return{...e,poll:t.poll};case`governor`:return{...e,governor:t.governor};case`propellant`:return{...e,propellant:t.propellant};case`schedules`:return{...e,schedules:t.schedules};case`uplinks`:return{...e,uplinks:t.uplinks};case`tasks`:return{...e,tasks:t.tasks};case`downlink`:return{...e,downlink:t.downlink};case`livery`:return{...e,livery:t.livery};case`docking`:return{...e,docking:t.docking};case`relief`:return{...e,relief:t.relief.requests};case`rollout`:return{...e,rollout:t.rollout};case`log`:return{...e,log:{rev:e.log.rev+1,changed:t.changed,removed:t.removed}};default:return e}}var Jt=/^[0-9a-f]{64}$/i,Yt=null,Xt=null,P=!1,Zt=!1,Qt,$t=0,en=0,tn=null;function F(e){return typeof e==`object`&&e&&!Array.isArray(e)?e:null}function nn(e){let t=F(e);return t!==null&&Array.isArray(t.agents)&&Array.isArray(t.activity)&&F(t.info)!==null&&F(t.governor)!==null&&(t.poll===null||F(t.poll)!==null)}function rn(){let e=location.hash.startsWith(`#`)?new URLSearchParams(location.hash.slice(1)):null;if(e?.has(`token`)){let t=e.get(`token`)??``;try{history.replaceState(null,``,location.pathname+location.search)}catch{}if(Jt.test(t))return tt(oe,t),t}let t=et(oe);return t!==null&&Jt.test(t)?t:null}function an(e,t,n){return Object.assign(Error(e),{status:t,field:n})}async function I(e,t,n){let r={Authorization:`Bearer ${Yt??``}`};n!==void 0&&(r[`Content-Type`]=`application/json`);let i;try{i=await fetch(re+t,{method:e,headers:r,body:n===void 0?void 0:JSON.stringify(n),cache:`no-store`})}catch{throw an(`Could not reach the gonogo server.`)}let a=null;try{let e=await i.text();e!==``&&(a=JSON.parse(e))}catch{}if(!i.ok){let e=F(a);throw an(typeof e?.error==`string`?e.error:`The server answered ${i.status}.`,i.status,typeof e?.field==`string`?e.field:void 0)}return a}function on(e){let t=F(e);if(t===null||typeof t.name!=`string`||typeof t.state!=`string`)throw an(`The server sent an answer gonogo does not understand.`);return e}function sn(e){let t=F(e);if(t===null||typeof t.status!=`string`||!Array.isArray(t.entries))throw an(`The server sent an answer gonogo does not understand.`);return e}function cn(e){let t=F(e);if(t===null||typeof t.working!=`number`||typeof t.holding!=`number`)throw an(`The server sent an answer gonogo does not understand.`);return e}function ln(e){let t=F(e);if(t===null||F(t.room)===null||F(t.agents)===null)throw an(`The server sent an answer gonogo does not understand.`);return e}function un(e){let t=F(e);if(t===null||typeof t.id!=`string`||typeof t.rule!=`string`)throw an(`The server sent an answer gonogo does not understand.`);return e}function dn(e){let t=F(e);if(t===null||typeof t.unread!=`number`||!Array.isArray(t.items))throw an(`The server sent an answer gonogo does not understand.`);return e}function fn(e){let t=F(e);return t!==null&&[`id`,`by`,`name`,`role`,`dir`,`provider`,`mode`].every(e=>typeof t[e]==`string`)&&typeof t.at==`number`&&typeof t.expiresAt==`number`&&(t.position===null||typeof t.position==`string`)&&(t.cleanRoom===null||F(t.cleanRoom)!==null)}var pn=e=>{let t=F(e)?.requests;return Array.isArray(t)&&t.every(fn)};function mn(e){if(!pn(e))throw an(`The server sent an answer gonogo does not understand.`);return e}function hn(e){let t=F(e);if(t===null||typeof t.current!=`string`||!Array.isArray(t.liveries)||!t.liveries.every(e=>typeof F(e)?.slug==`string`&&F(F(e)?.tokens)!==null))throw an(`The server sent an answer gonogo does not understand.`);return e}function gn(e){let t=F(e);if(t===null||typeof t.total!=`number`||!Array.isArray(t.hits))throw an(`The server sent an answer gonogo does not understand.`);return e}function _n(e){let t=F(e);if(t===null||typeof t.id!=`string`||typeof t.body!=`string`||!Array.isArray(t.tags))throw an(`The server sent an answer gonogo does not understand.`);return e}function vn(e){let t=F(e);if(t===null||typeof t.text!=`string`||typeof t.revision!=`number`)throw an(`The server sent an answer gonogo does not understand.`);return e}function yn(e){let t=F(e);if(t===null||typeof t.git!=`string`||typeof t.command!=`string`||!Array.isArray(t.events))throw an(`The server sent an answer gonogo does not understand.`);return e}function bn(e){let t=F(e);if(t===null||typeof t.total!=`number`||!Array.isArray(t.nodes)||!Array.isArray(t.edges))throw an(`The server sent an answer gonogo does not understand.`);return e}function xn(e){let t=F(e);if(t===null||typeof t.bytes!=`number`||typeof t.over!=`boolean`)throw an(`The server sent an answer gonogo does not understand.`);return e}function Sn(e){let t=F(e);if(t===null||F(t.send)===null)throw an(`The server sent an answer gonogo does not understand.`);return xn(t.memory),e}function Cn(e){let t=F(e);if(t===null||typeof t.id!=`string`||typeof t.status!=`string`||!Array.isArray(t.notes))throw an(`The server sent an answer gonogo does not understand.`);return e}function wn(e){let t=F(e);if(t===null||!Array.isArray(t.forward)||!(`slack`in t)||!(`telegram`in t))throw an(`The server sent an answer gonogo does not understand.`);return e}function Tn(e){let t=F(e);if(t===null||typeof t.id!=`string`||!Array.isArray(t.deliveries))throw an(`The server sent an answer gonogo does not understand.`);return e}function En(e){let t=Tn(e);if(typeof t.secret!=`string`)throw an(`The server sent an answer gonogo does not understand.`);return t}function Dn(e){let t=F(e);if(t===null||typeof t.ok!=`boolean`||typeof t.status!=`string`)throw an(`The server sent an answer gonogo does not understand.`);return e}var On=e=>`/agents/${encodeURIComponent(e)}`;async function kn(e){return on(await I(`POST`,`/agents`,e))}async function An(e,t){return on(await I(`PATCH`,On(e),t))}async function jn(){let e=await I(`GET`,`/engines`);if(!Array.isArray(e)||!e.every(e=>typeof F(e)?.provider==`string`))throw an(`The server sent an answer gonogo does not understand.`);return e}async function Mn(e){return on(await I(`POST`,`${On(e)}/restart`))}async function Nn(e){return on(await I(`POST`,`${On(e)}/stop`))}async function Pn(e){await I(`DELETE`,On(e))}async function Fn(e){return Dn(await I(`POST`,`/messages`,e))}async function In(e={}){return sn(await I(`POST`,`/poll`,e))}async function Ln(){return sn(await I(`POST`,`/poll/hold`))}async function Rn(){return sn(await I(`POST`,`/poll/abort`))}async function zn(){await I(`DELETE`,`/poll`)}async function Bn(e,t){let n={go:t};return on(await I(`POST`,`${On(e)}/answer`,n))}async function Vn(e,t){return mn(await I(`POST`,`/relief/${encodeURIComponent(e)}/${t?`go`:`no-go`}`))}async function Hn(e){return cn(await I(`PUT`,`/governor`,e))}async function Un(e){return ln(await I(`PUT`,`/propellant`,e))}async function Wn(e){return on(await I(`POST`,`${On(e)}/resume`))}async function Gn(e){return on(await I(`POST`,`${On(e)}/hold`))}async function Kn(e){let t=F(await I(`GET`,`${On(e)}/telemetry`));if(t===null||!Array.isArray(t.calls))throw an(`The server sent an answer gonogo does not understand.`);return t.calls}async function qn(e){return un(await I(`POST`,`/schedules`,e))}async function Jn(e,t){return un(await I(`PATCH`,`/schedules/${encodeURIComponent(e)}`,t))}async function Yn(e){await I(`DELETE`,`/schedules/${encodeURIComponent(e)}`)}async function Xn(e){return un(await I(`POST`,`/schedules/${encodeURIComponent(e)}/run`))}async function Zn(e){return Cn(await I(`POST`,`/tasks`,e))}async function Qn(e,t){return Cn(await I(`PATCH`,`/tasks/${encodeURIComponent(e)}`,t))}async function $n(e){await I(`DELETE`,`/tasks/${encodeURIComponent(e)}`)}async function er(e){let t=F(await I(`POST`,`/docking/code`,{url:e}));if(typeof t?.code!=`string`||typeof t.expiresAt!=`number`)throw an(`The server sent an answer gonogo does not understand.`);return t}async function tr(e,t){let n=F(await I(`POST`,`/docking/pair`,{code:e,url:t}));if(typeof n?.id!=`string`||typeof n.name!=`string`)throw an(`The server sent an answer gonogo does not understand.`);return n}async function nr(e){return F(await I(`DELETE`,`/docking/${encodeURIComponent(e)}`))?.told===!0}async function rr(e,t){return Cn(await I(`POST`,`/docking/${encodeURIComponent(e)}/handoff`,t))}async function ir(e){return or(hn(await I(`PUT`,`/livery`,{slug:e})))}async function ar(e){return or(hn(await I(`DELETE`,`/liveries/${encodeURIComponent(e)}`)))}function or(e){return M.setState(t=>({...t,livery:e})),e}async function sr(e){return Dn(await I(`POST`,`/liveries/design`,e))}async function cr(e){return gn(await I(`GET`,`/log?q=${encodeURIComponent(e)}`))}async function lr(e){return _n(await I(`GET`,`/log/${encodeURIComponent(e)}`))}async function ur(e){return _n(await I(`POST`,`/log`,e))}async function dr(e,t){return _n(await I(`PUT`,`/log/${encodeURIComponent(e)}`,t))}async function fr(e){await I(`DELETE`,`/log/${encodeURIComponent(e)}`)}var pr=(e,t)=>{if(!e)throw an(`The server sent an answer gonogo does not understand.`);return t};async function mr(e,t){let n=await I(`GET`,`${On(e)}/files?path=${encodeURIComponent(t)}`);return pr(Array.isArray(F(n)?.entries),n)}async function hr(e,t){let n=await I(`GET`,`${On(e)}/file?path=${encodeURIComponent(t)}`);return pr(typeof F(n)?.text==`string`&&typeof F(n)?.etag==`string`,n)}async function gr(e,t){let n=await I(`PUT`,`${On(e)}/file`,t);return pr(typeof F(n)?.etag==`string`,n)}async function _r(e,t){let n=await I(`POST`,`${On(e)}/file`,t);return pr(typeof F(n)?.etag==`string`,n)}async function vr(e){let t=await I(`GET`,`${On(e)}/git`);return pr(typeof F(t)?.repo==`boolean`,t)}async function yr(e,t,n){let r=await I(`GET`,`${On(e)}/git/diff?path=${encodeURIComponent(t)}&staged=${+!!n}`);return pr(typeof F(r)?.diff==`string`,r)}async function br(e){let t=await I(`GET`,`${On(e)}/git/log`);return pr(Array.isArray(t),t)}async function xr(e,t){let n=F(await I(`POST`,`${On(e)}/git/commit`,t));return pr(F(n?.commit)!==null,n?.commit)}async function Sr(){return vn(await I(`GET`,`/board`))}async function Cr(e,t){return vn(await I(`PUT`,`/board`,{text:e,revision:t}))}async function wr(){return yn(await I(`GET`,`/black-box`))}async function Tr(){return bn(await I(`GET`,`/log/chart`))}async function Er(e){return xn(await I(`GET`,`${On(e)}/memory`))}async function Dr(e){return Sn(await I(`POST`,`${On(e)}/reflect`))}async function Or(e){return dn(await I(`POST`,`/downlink/read`,{ids:e}))}async function kr(e){return dn(await I(`POST`,`/downlink/archive`,{ids:e}))}async function Ar(){return dn(await I(`POST`,`/downlink/read-all`))}async function jr(e){return En(await I(`POST`,`/uplinks`,e))}async function Mr(e,t){return Tn(await I(`PATCH`,`/uplinks/${encodeURIComponent(e)}`,t))}async function Nr(e){await I(`DELETE`,`/uplinks/${encodeURIComponent(e)}`)}async function Pr(e){return En(await I(`POST`,`/uplinks/${encodeURIComponent(e)}/rotate`))}async function Fr(e){return Tn(await I(`POST`,`/uplinks/${encodeURIComponent(e)}/test`))}async function Ir(){return wn(await I(`GET`,`/relay`))}async function Lr(e,t){return wn(await I(`PUT`,`/relay/${e}`,t))}async function Rr(e){return wn(await I(`DELETE`,`/relay/${e}`))}async function zr(e){return wn(await I(`POST`,`/relay/${e}/test`))}async function Br(e){return wn(await I(`PUT`,`/relay/forward`,e))}var Vr=new Map([[`agent-removed`,[[`name`,`string`]]],[`snapshot`,[[`seq`,`number`],[`agent`,`string`],[`generation`,`number`],[`cols`,`number`],[`rows`,`number`],[`running`,`boolean`],[`data`,`string`]]],[`size`,[[`agent`,`string`],[`cols`,`number`],[`rows`,`number`]]],[`error`,[[`message`,`string`]]]]);function Hr(e){let t;try{t=JSON.parse(e)}catch{return null}let n=F(t);if(n===null||typeof n.t!=`string`)return null;let r=!1;if(n.t===`state`)r=nn(n.state);else if(n.t===`agent`)r=typeof F(n.agent)?.name==`string`;else if(n.t===`poll`)r=n.poll===null||F(n.poll)!==null;else if(n.t===`governor`)r=F(n.governor)!==null;else if(n.t===`propellant`)r=F(F(n.propellant)?.room)!==null;else if(n.t===`schedules`)r=Array.isArray(n.schedules);else if(n.t===`uplinks`)r=Array.isArray(n.uplinks);else if(n.t===`tasks`)r=Array.isArray(n.tasks);else if(n.t===`livery`)r=F(n.livery)!==null&&Array.isArray(F(n.livery)?.liveries)&&typeof F(n.livery)?.current==`string`;else if(n.t===`relief`)r=pn(n.relief);else if(n.t===`docking`)r=typeof F(n.docking)?.station==`string`&&Array.isArray(F(n.docking)?.docks);else if(n.t===`rollout`)r=typeof F(n.rollout)?.current==`string`;else if(n.t===`log`)r=Array.isArray(n.changed)&&Array.isArray(n.removed);else if(n.t===`downlink`)r=Array.isArray(F(n.downlink)?.items)&&typeof F(n.downlink)?.unread==`number`;else if(n.t===`activity`){let e=F(n.item);r=typeof e?.id==`string`&&typeof e.at==`number`}else r=Vr.get(n.t)?.every(([e,t])=>typeof n[e]===t)??!1;return r?t:null}function Ur(e){M.setState(t=>qt(t,e,Date.now())),e.t===`snapshot`?e.seq===en&&tn?.snapshot(e):e.t===`size`?tn?.size(e):e.t===`error`&&tn?.error(e)}function Wr(e){if(e.byteLength<5)return;let t=new DataView(e);t.getUint8(0)===1&&t.getUint32(1)===en&&tn?.output(new Uint8Array(e,5))}function Gr(e){return Xt===null||Xt.readyState!==WebSocket.OPEN?!1:(Xt.send(JSON.stringify(e)),!0)}function Kr(){clearTimeout(Qt);let e=se[Math.min(M.getState().failedAttempts,se.length-1)];Qt=setTimeout(()=>void Yr(),e)}function qr(e){Zt=!1,M.setState(t=>({...t,connection:`reconnecting`,failedAttempts:e?0:t.failedAttempts+1})),Kr()}function Jr(){let e=location.protocol===`https:`?`wss:`:`ws:`,t=new WebSocket(`${e}//${location.host}/ws`,[k,ie+(Yt??``)]);t.binaryType=`arraybuffer`,Xt=t;let n=!1;t.onopen=()=>{Xt===t&&(n=!0,Zt=!1,M.setState(e=>({...e,connection:`open`,failedAttempts:0})))},t.onmessage=e=>{if(Xt!==t)return;let n=e.data;if(typeof n==`string`){let e=Hr(n);e!==null&&Ur(e)}else n instanceof ArrayBuffer&&Wr(n)},t.onclose=()=>{Xt===t&&(Xt=null,en=0,qr(n))}}async function Yr(){if(!(Zt||Yt===null)){Zt=!0,clearTimeout(Qt);try{let e=await fetch(`${re}/state`,{headers:{Authorization:`Bearer ${Yt}`},cache:`no-store`});if(e.status===401){Zt=!1,Yt=null,tt(oe,null),M.setState(e=>({...e,connection:`unauthorized`}));return}let t=e.ok?await e.json():null;if(!nn(t)){qr(!1);return}M.setState(e=>qt(e,{t:`state`,state:t},Date.now())),Jr()}catch{qr(!1)}}}function Xr(){P||(P=!0,window.addEventListener(`hashchange`,()=>{new URLSearchParams(location.hash.slice(1)).has(`token`)&&location.reload()}),Yt=rn(),Yt===null?M.setState(e=>({...e,connection:`unauthorized`})):(document.addEventListener(`visibilitychange`,()=>{document.visibilityState===`visible`&&M.getState().connection===`reconnecting`&&Yr()}),setInterval(()=>M.setState(e=>Vt(e,Date.now())),1e3),Yr()))}function Zr(){Yr()}function Qr(e){return tn=e,()=>{tn===e&&(tn=null)}}var $r=e=>Number.isInteger(e.cols)&&Number.isInteger(e.rows)&&e.cols>0&&e.rows>0;function ei(e,t){let n=$t+1;return Gr(t!==void 0&&$r(t)?{t:`attach`,seq:n,agent:e,cols:t.cols,rows:t.rows}:{t:`attach`,seq:n,agent:e})?($t=n,en=n,!0):!1}function ti(){en=0,Gr({t:`detach`})}function ni(e,t){let n=[],r=0;for(;r<e.length;){let i=Math.min(r+t,e.length),a=e.charCodeAt(i-1);i<e.length&&i-r>1&&a>=55296&&a<=56319&&--i,n.push(e.slice(r,i)),r=i}return n}function ri(e,t,n=!1){for(let r of ni(t,ae))Gr(n?{t:`input`,agent:e,data:r,binary:!0}:{t:`input`,agent:e,data:r})}function ii(e,t,n){Gr({t:`resize`,agent:e,cols:t,rows:n})}var ai=`The gonogo server is not reachable. Is it still running? Retrying every 10 s.`;function oi(e,t,n=t){return e===null?`Sent.`:`Sent. ${si(e,t,n)}`}function si(e,t,n){switch(e){case`waiting: ${t} is starting`:return`${n} is starting and will see it when ready.`;case`waiting: ${t} is working`:return`${n} is working and will see it when its turn ends.`;case`waiting: ${t} needs you`:return`${n} needs you first and will see it after you answer.`;case`waiting: about to type the pointer`:case`waiting: confirming the pointer`:return`${n} will see it in a moment.`;case`waiting: ${t} is not ready for input`:return`${n} is not ready for input and will see it soon.`;case`waiting: ${t} is restarting`:return`${n} is restarting and will see it afterwards.`;case`waiting: ${t} has not read it yet`:return`${n} has not read it yet; gonogo will remind it.`;case`held: text in ${t}'s input`:return`It waits until the text typed in ${n}'s terminal is sent or cleared.`;case`held: pointer not confirmed within 2 s`:return`On hold: ${n} did not pick it up. Check its terminal.`;case`held: no hook has reached gonogo from ${t}; is its folder trusted?`:return`On hold: gonogo is not hearing from ${n}. Is its folder trusted?`;default:return`${n} will see it as soon as it can.`}}function ci(e){return e===null||e.text===``||e.text===ue.stopped?null:e.text}var li=/^waiting: load limit \((\d+) of (\d+) agents working\)$/;function ui(e){let t=li.exec(e);return t===null?e:`waiting for Max Q: ${t[1]} of ${t[2]} agents working`}var di=e((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.fragment`);function r(e,n,r){var i=null;if(r!==void 0&&(i=``+r),n.key!==void 0&&(i=``+n.key),`key`in n)for(var a in r={},n)a!==`key`&&(r[a]=n[a]);else r=n;return n=r.ref,{$$typeof:t,type:e,key:i,ref:n===void 0?null:n,props:r}}e.Fragment=n,e.jsx=r,e.jsxs=r})),L=e(((e,t)=>{t.exports=di()}))(),fi=`(max-width: 699px)`,pi=()=>typeof matchMedia==`function`&&matchMedia(fi).matches;function mi(e){if(typeof matchMedia!=`function`)return()=>void 0;let t=matchMedia(fi);return t.addEventListener(`change`,e),()=>t.removeEventListener(`change`,e)}function hi({boss:e}){let t=(0,l.useId)(),n=(0,l.useSyncExternalStore)(mi,pi,()=>!1),[r,i]=(0,l.useState)(``),[a,o]=(0,l.useState)(!1),[s,c]=(0,l.useState)(null),u=e!==null&&e.state===`stopped`,d=r.trim(),f=e===null||u||a;async function p(){if(!(f||d===``)){o(!0),c(null);try{let t=await Fn({to:`boss`,subject:`Brief`,body:d});!t.ok||t.status===`undelivered`?c({text:t.note??`The message could not be delivered.`,tone:`danger`}):(i(``),c({text:oi(t.note,e.name,`FLIGHT`),tone:`ok`}))}catch(e){c({text:e instanceof Error?e.message:String(e),tone:`danger`})}finally{o(!1)}}}let m=e=>{e.preventDefault(),p()},h=e=>{e.key===`Enter`&&!e.shiftKey&&!e.nativeEvent.isComposing&&(e.preventDefault(),p())},g=u?{text:`FLIGHT is stopped. Start it to brief.`,tone:`ok`}:s;return(0,L.jsxs)(`form`,{className:`brief`,onSubmit:m,children:[(0,L.jsx)(`label`,{className:`brief-label`,htmlFor:`${t}-text`,children:`Brief FLIGHT`}),(0,L.jsx)(`textarea`,{id:`${t}-text`,className:`textarea brief-input`,rows:1,value:r,maxLength:ee,placeholder:n?`Brief FLIGHT`:`What do you want done?`,disabled:e===null||u,"aria-describedby":`${t}-note`,onChange:e=>i(e.target.value),onKeyDown:h}),(0,L.jsx)(`button`,{type:`submit`,className:`btn brief-send`,"data-kind":`primary`,"aria-disabled":f||d===``,children:a?`Sending…`:`Send`}),(0,L.jsx)(`p`,{id:`${t}-note`,className:g?.tone===`danger`?`error brief-note`:`hint brief-note`,role:`status`,children:g?.text})]})}var gi=[{id:`flight`,callSign:`FLIGHT`,title:`Flight director`,summary:`The boss: takes the brief, hands out work`,color:`#f5c451`,role:`You are FLIGHT, the flight director of this team. The Director (the human, the recipient "user") briefs you with goals. Split each goal into tasks, find the right position with list_roster, and send each task with send_message: a clear subject and a self-contained body (paths, what done looks like). Before a large or risky step, ask the Director for a go or no-go. When a position reports back, check the result and tell the Director the outcome in a few lines. If no position fits, ask the Director for one with hire_agent (a name, a position or a role, a folder, a mode up to acceptEdits): it only makes a request, he sees every field and decides, and you get his answer as a message. You cannot hire or remove agents yourself. Send anything risky (spending money, deleting data, changing scope) to "user" and wait for the answer.`},{id:`fao`,callSign:`FAO`,title:`Flight activities officer`,summary:`Planner: breaks the brief into tasks`,color:`#5fd4e6`,role:`You are FAO, the flight activities officer. You keep the plan. When FLIGHT or the Director gives you a goal, break it into small tasks with a clear order, an owner position for each and what done looks like, and keep the list current as work finishes. Do not write the code yourself: hand tasks out through send_message and report the plan to FLIGHT.`},{id:`fido`,callSign:`FIDO`,title:`Flight dynamics officer`,summary:`Architect: picks the approach and the interfaces`,color:`#7ea6ff`,role:`You are FIDO, the flight dynamics officer. You choose the approach. For each task decide the design: modules, interfaces, data flow and the order of changes. When the choice matters, weigh two options and say why you pick one. Write the decision in a few lines for the position that will build it. Prefer the smallest design that works.`},{id:`guido`,callSign:`GUIDO`,title:`Guidance officer`,summary:`Backend and core logic`,color:`#4fd1b8`,role:`You are GUIDO, the guidance officer. You own the core logic and the backend: server code, algorithms and the data flow behind them. Make small, correct changes, keep the tests green and run the checks before you report. Report what changed and anything you could not verify.`},{id:`control`,callSign:`CONTROL`,title:`Lunar module controller`,summary:`Frontend: the controls people touch`,color:`#b69cff`,role:`You are CONTROL, who owns the controls people touch. You build the user interface: components, layout, interaction, accessibility and the look. Check your work in a running browser when you can, and report what you saw, not what you expect.`},{id:`dps`,callSign:`DPS`,title:`Data processing systems`,summary:`Data: schemas, queries, migrations`,color:`#62b8ff`,role:`You are DPS, who owns the data systems: schemas, queries, migrations and data integrity. Never run a destructive statement without a backup and a go from the Director. Report the exact statements you ran and what they changed.`},{id:`inco`,callSign:`INCO`,title:`Instrumentation and communications`,summary:`Integrations, APIs, logging`,color:`#ff9bd2`,role:`You are INCO, the integration and communications officer. You own APIs, integrations with outside services, logging and the glue between systems. Check what a remote service really returns before you rely on it, and never put credentials in code, logs or messages.`},{id:`eecom`,callSign:`EECOM`,title:`Electrical, environmental and consumables`,summary:`Infrastructure: CI, environments, dependencies, budget`,color:`#c3d86b`,role:`You are EECOM, who keeps the systems alive. You own infrastructure: environments, CI, dependencies, containers, and the token and time budget of this team. Keep changes reversible, prefer pinned versions, and report what a change costs.`},{id:`booster`,callSign:`BOOSTER`,title:`Booster systems`,summary:`Build and release`,color:`#ff8f6b`,role:`You are BOOSTER, who owns build and release. You make the build reproducible, run the full build and test pipeline, package the result and prepare the release notes. Never publish or push anything without a go from the Director.`},{id:`surgeon`,callSign:`SURGEON`,title:`Flight surgeon`,summary:`Tests and debugging`,color:`#7de0c0`,role:`You are SURGEON, who owns the health of the code. You write and run tests, reproduce bugs, find the root cause and make the smallest fix. Show a failing test before the fix and a passing one after it.`},{id:`simsup`,callSign:`SIMSUP`,title:`Simulation supervisor`,summary:`Adversarial tester: breaks things on purpose`,color:`#d48cff`,role:`You are SIMSUP, the simulation supervisor. You try to break what the others built: hostile input, empty and huge values, bad timing, a crash halfway through. Report each failure with the exact steps to reproduce it. Do not fix other positions' code.`},{id:`retro`,callSign:`RETRO`,title:`Retrofire officer`,summary:`Code reviewer, plans the rollback`,color:`#9fb0c8`,role:`You are RETRO, who plans the way back. You review changes before they ship: correctness, risk and what can go wrong, and you write the rollback for each risky change. Report findings as a short ranked list with file and line.`},{id:`rso`,callSign:`RSO`,title:`Range safety officer`,summary:`Security reviewer, can call an abort`,color:`#ff7a90`,role:`You are RSO, the range safety officer. You review for security and safety: injection, secrets, permissions, dangerous commands and data loss. You may call an abort: when something must not ship, tell FLIGHT and the Director at once, with the evidence.`},{id:`pao`,callSign:`PAO`,title:`Public affairs officer`,summary:`Docs, README, changelog`,color:`#ffd9a0`,role:`You are PAO, who owns public affairs: the README, usage notes, the changelog and comments that explain why. Keep it short and accurate, check it against the code, and run the commands you document.`},{id:`capcom`,callSign:`CAPCOM`,title:`Capsule communicator`,summary:`Reporter: one clear update for the Director`,color:`#8ce0ff`,role:`You are CAPCOM, the one voice to the Director. You collect status from the other positions with list_roster and read_messages, and send the Director a single clear update: what is done, what is blocked, what you need from them. Keep updates short and do not repeat yourself.`}];gi.map(e=>e.id);function _i(e){return gi.find(t=>t.id===e)??null}var vi=[{id:`all`,label:`ALL`},{id:`you`,label:`TO YOU`},{id:`held`,label:`HELD`},{id:`lost`,label:`UNDELIVERED`}],yi={all:()=>!0,you:e=>e.to===`user`,held:e=>e.status===`held`,lost:e=>e.status===`undelivered`},bi=(e,t)=>e.filter(yi[t]);function xi(e){let t={all:0,you:0,held:0,lost:0};for(let n of e)for(let{id:e}of vi)yi[e](n)&&(t[e]+=1);return t}function Si(e){switch(e.status){case`to_user`:return{text:`TO YOU`,tone:`lit`};case`held`:return{text:`HELD`,tone:`amber`};case`undelivered`:return{text:`UNDELIVERED`,tone:`nogo`};default:return{text:e.status.toUpperCase(),tone:`quiet`}}}function R(e,t){if(e===`user`)return`DIRECTOR`;let n=Object.hasOwn(t,e)?t[e]:void 0;return n?.boss===!0?`FLIGHT`:(_i(n?.position)?.callSign??e).toUpperCase()}var Ci=(e,t)=>`${R(e.from,t)} › ${R(e.to,t)}`;function wi(e){return e.subject.trim()===``?e.body.trim().split(`
|
|
11
|
-
`)[0]??``:e.subject}var Ti=e=>e.note===null?``:ui(e.note);function Ei(e,t){let n=e.subject.trim()===``?``:`Re: ${e.subject}`.slice(0,200);return{to:e.from,subject:n,body:t,inReplyTo:e.id}}var Di=(e,t,n=3)=>e.filter(e=>e.from===t||e.to===t).slice(0,n),Oi=100,ki=new Intl.DateTimeFormat(void 0,{hour:`2-digit`,minute:`2-digit`,hourCycle:`h23`});function Ai(e){try{return ki.format(e)}catch{return`--:--`}}function ji({item:e,agents:t,onSent:n}){let r=(0,l.useId)(),[i,a]=(0,l.useState)(``),[o,s]=(0,l.useState)(!1),[c,u]=(0,l.useState)(null),d=R(e.from,t);async function f(t){t.preventDefault();let r=i.trim();if(!(o||r===``)){s(!0),u(null);try{let t=await Fn(Ei(e,r));!t.ok||t.status===`undelivered`?u({text:t.note??`The message could not be delivered.`,failed:!0}):(a(``),u({text:oi(t.note,t.to,d),failed:!1}),n?.())}catch(e){u({text:e instanceof Error?e.message:String(e),failed:!0})}finally{s(!1)}}}return(0,L.jsxs)(`form`,{className:`loop-reply`,onSubmit:e=>void f(e),children:[(0,L.jsxs)(`label`,{className:`legend`,htmlFor:`${r}-reply`,children:[`Reply to `,d]}),(0,L.jsx)(`input`,{id:`${r}-reply`,className:`input loop-reply-input`,type:`text`,value:i,autoComplete:`off`,"aria-describedby":`${r}-result`,onChange:e=>a(e.target.value)}),(0,L.jsx)(`button`,{type:`submit`,className:`btn`,"data-kind":`primary`,"aria-disabled":o||i.trim()===``,children:o?`Sending…`:`Send`}),(0,L.jsx)(`p`,{id:`${r}-result`,className:c?.failed===!0?`error loop-result`:`hint loop-result`,role:`status`,children:c?.text})]})}function Mi({item:e,agents:t,open:n,onToggle:r,onSelect:i}){let a=Si(e),o=Ti(e),s=e.to===`user`,c=e.from!==`user`&&Object.hasOwn(t,e.from)?e.from:null;return(0,L.jsxs)(`li`,{className:`loop-row`,"data-to-you":s?``:void 0,"data-status":e.status,children:[(0,L.jsxs)(`button`,{type:`button`,className:`loop-row-btn`,"aria-expanded":n,onClick:r,children:[(0,L.jsx)(`span`,{className:`loop-time`,children:Ai(e.at)}),(0,L.jsx)(`span`,{className:`loop-route`,children:Ci(e,t)}),(0,L.jsxs)(`span`,{className:`loop-text`,children:[(0,L.jsx)(`span`,{className:`loop-subject`,children:wi(e)}),o!==``&&(0,L.jsx)(`span`,{className:`loop-note`,children:o})]}),(0,L.jsx)(`span`,{className:`chip loop-chip`,"data-tone":a.tone,children:a.text})]}),n&&(0,L.jsxs)(`div`,{className:`loop-open`,children:[(0,L.jsxs)(`p`,{className:`loop-body`,children:[e.body,e.truncated?` …(cut)`:``]}),s&&(0,L.jsx)(ji,{item:e,agents:t}),c!==null&&(0,L.jsxs)(`button`,{type:`button`,className:`btn loop-console`,"data-kind":`quiet`,onClick:()=>i(c),children:[`Open `,R(c,t)]})]})]})}function Ni({items:e,agents:t,boss:n,onSelect:r,onClose:i}){let[a,o]=(0,l.useState)(`all`),[s,c]=(0,l.useState)(null),u=(0,l.useMemo)(()=>xi(e),[e]),d=(0,l.useMemo)(()=>bi(e,a).slice(0,Oi),[e,a]);return(0,L.jsxs)(`section`,{className:`loop`,"aria-labelledby":`loop-title`,children:[(0,L.jsxs)(`header`,{className:`loop-head`,children:[(0,L.jsx)(`h1`,{id:`loop-title`,className:`disp loop-title`,children:`COMM LOOP`}),(0,L.jsx)(`div`,{className:`loop-filters`,role:`group`,"aria-label":`Filter`,children:vi.map(({id:e,label:t})=>(0,L.jsxs)(`button`,{type:`button`,className:`btn loop-filter`,"data-kind":a===e?`primary`:`quiet`,"aria-pressed":a===e,onClick:()=>o(e),children:[t,` `,(0,L.jsx)(`span`,{className:`loop-count`,children:u[e]})]},e))}),(0,L.jsx)(`button`,{type:`button`,className:`btn loop-room`,"data-kind":`quiet`,onClick:i,children:`Room`})]}),(0,L.jsx)(`div`,{className:`loop-scroll module`,children:d.length===0?(0,L.jsx)(`p`,{className:`loop-empty`,children:e.length===0?`No messages yet.`:`Nothing in this filter.`}):(0,L.jsx)(`ol`,{className:`loop-list`,children:d.map(e=>(0,L.jsx)(Mi,{item:e,agents:t,open:s===e.id,onToggle:()=>c(s===e.id?null:e.id),onSelect:e=>{r(e),i()}},e.id))})}),(0,L.jsx)(`div`,{className:`loop-foot module`,children:(0,L.jsx)(hi,{boss:n})})]})}function Pi({items:e,name:t,onOpenLoop:n}){let r=N(e=>e.agents),i=Di(e,t),a=R(t,r);return(0,L.jsxs)(`section`,{className:`loop-traffic`,"aria-label":`Comm loop of ${a}`,children:[(0,L.jsxs)(`div`,{className:`loop-traffic-head`,children:[(0,L.jsxs)(`h2`,{className:`label`,children:[`Comm loop · `,a]}),(0,L.jsx)(`button`,{type:`button`,className:`btn loop-link`,"data-kind":`quiet`,onClick:n,children:`All traffic`})]}),i.length===0?(0,L.jsx)(`p`,{className:`loop-traffic-empty`,children:`No traffic yet.`}):(0,L.jsx)(`ol`,{className:`loop-traffic-list`,children:i.map(e=>{let t=Si(e);return(0,L.jsxs)(`li`,{className:`loop-traffic-row`,children:[(0,L.jsx)(`span`,{className:`loop-time`,children:Ai(e.at)}),(0,L.jsx)(`span`,{className:`loop-route`,children:Ci(e,r)}),(0,L.jsx)(`span`,{className:`loop-traffic-subject`,children:wi(e)}),(0,L.jsx)(`span`,{className:`chip loop-chip`,"data-tone":t.tone,children:t.text})]},e.id)})})]})}var Fi={crew:{text:`CREW`,tone:`quiet`},redline:{text:`REDLINE`,tone:`nogo`},poll:{text:`T-MINUS`,tone:`amber`},answer:{text:`ANSWER`,tone:`amber`},plan:{text:`PLAN`,tone:`quiet`},uplink:{text:`UPLINK`,tone:`amber`},config:{text:`CONFIG`,tone:`quiet`},audit:{text:`BLACK BOX`,tone:`quiet`}};function Ii(e){return{ok:`Events are committed to a git repository, in batches.`,missing:`${e.note}. Events are written to the folder and not committed. Install git and restart gonogo.`,error:`git failed: ${e.note}. Events are written to the folder; the next batch commits them again.`}[e.git]}var Li=e=>String(e).padStart(2,`0`);function Ri(e){let t=new Date(e);return Number.isNaN(t.getTime())?`--`:`${t.getFullYear()}-${Li(t.getMonth()+1)}-${Li(t.getDate())} ${Li(t.getHours())}:${Li(t.getMinutes())}:${Li(t.getSeconds())}`}var zi=e=>e===0?`Nothing recorded yet.`:`${e} newest event${e===1?``:`s`}. Older ones are in the repository.`;async function Bi(e){try{return await navigator.clipboard.writeText(e),!0}catch{return!1}}var Vi=5e3;function Hi(e){let t=(0,l.useRef)(e);t.current=e,(0,l.useEffect)(()=>{let e=()=>{document.visibilityState!==`hidden`&&t.current()};e();let n=setInterval(e,Vi);return document.addEventListener(`visibilitychange`,e),()=>{clearInterval(n),document.removeEventListener(`visibilitychange`,e)}},[])}function Ui(){let e=(0,l.useId)(),[t,n]=(0,l.useState)(null),[r,i]=(0,l.useState)(null),[a,o]=(0,l.useState)(``),s=(0,l.useRef)(null);(0,l.useEffect)(()=>s.current?.focus(),[]),Hi(()=>{wr().then(e=>{n(e),i(null)},e=>i(e instanceof Error?e.message:String(e)))});let c=async()=>{t!==null&&o(await Bi(t.command)?`Copied.`:`The browser would not copy it: select the command and copy it by hand.`)};return(0,L.jsxs)(`section`,{className:`rec`,"aria-labelledby":e,children:[(0,L.jsxs)(`header`,{className:`loop-head`,children:[(0,L.jsx)(`h1`,{id:e,ref:s,tabIndex:-1,className:`disp loop-title rec-heading`,children:`BLACK BOX`}),(0,L.jsx)(`button`,{type:`button`,className:`btn loop-room`,"data-kind":`quiet`,onClick:dt,children:`Room`})]}),(0,L.jsx)(`p`,{className:`rec-lead`,children:`What happened in the room: hires, stops, polls, Redline trips, plan changes, uplink deliveries and configuration changes. Names and ids only, never a message or a secret. Only the server writes it.`}),r!==null&&(0,L.jsx)(`p`,{className:`error`,role:`alert`,children:r}),t!==null&&(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(`p`,{className:`flood rec-git`,"data-tone":t.git===`ok`?`lit`:`amber`,children:Ii(t)}),(0,L.jsxs)(`div`,{className:`module rec-form`,children:[(0,L.jsxs)(`div`,{className:`field`,children:[(0,L.jsx)(`label`,{htmlFor:`${e}-cmd`,children:`Read it with git`}),(0,L.jsx)(`input`,{id:`${e}-cmd`,className:`lcd rec-command`,readOnly:!0,value:t.command,spellCheck:!1,onFocus:e=>e.currentTarget.select()})]}),(0,L.jsx)(`div`,{className:`rec-actions`,children:(0,L.jsx)(`button`,{type:`button`,className:`btn`,onClick:()=>void c(),children:`Copy`})}),a!==``&&(0,L.jsx)(`p`,{className:`hint`,"aria-hidden":`true`,children:a})]}),(0,L.jsx)(`p`,{className:`hint`,children:zi(t.events.length)}),t.events.length>0&&(0,L.jsx)(`ol`,{className:`rec-events module`,children:t.events.map((e,t)=>(0,L.jsxs)(`li`,{className:`rec-event`,children:[(0,L.jsx)(`time`,{className:`rec-when`,dateTime:new Date(e.at).toISOString(),children:Ri(e.at)}),(0,L.jsx)(`span`,{className:`chip rec-kind`,"data-tone":Fi[e.kind].tone,children:Fi[e.kind].text}),(0,L.jsx)(`span`,{className:`rec-text-line`,children:e.text})]},`${e.at}-${t}`))})]}),(0,L.jsx)(`p`,{className:`sr-only`,role:`status`,children:a})]})}var Wi=[{id:`all`,label:`ALL`},{id:`messages`,label:`MESSAGES`},{id:`events`,label:`EVENTS`},{id:`archived`,label:`ARCHIVED`}],Gi={all:e=>!e.archived,messages:e=>e.type===`message`&&!e.archived,events:e=>e.type===`event`&&!e.archived,archived:e=>e.archived};function Ki(e,t,n=new Set){let r=e.filter(Gi[t]),i=e=>!e.read||n.has(e.id);return[...r.filter(i),...r.filter(e=>!i(e))]}function qi(e){let t={all:0,messages:0,events:0,archived:0};for(let n of e)for(let{id:e}of Wi)Gi[e](n)&&(t[e]+=1);return t}var Ji={redline:{text:`REDLINE`,tone:`nogo`},tminus:{text:`T-MINUS`,tone:`amber`},"launch-window":{text:`LAUNCH WINDOW`,tone:`amber`},uplink:{text:`UPLINK`,tone:`amber`},"flight-plan":{text:`FLIGHT PLAN`,tone:`quiet`},livery:{text:`LIVERY`,tone:`quiet`},relief:{text:`RELIEF`,tone:`amber`}},Yi=e=>`${e} unread`,Xi=e=>`dl-${e}`;function Zi(e,t,n){if(e.length===0)return null;let r=t===null?-1:e.indexOf(t);return r<0?(n===1?e[0]:e[e.length-1])??null:e[Math.min(e.length-1,Math.max(0,r+n))]??null}function Qi(e,t){let n=e.indexOf(t);return n<0?null:e[n+1]??e[n-1]??null}var $i={j:`next`,k:`previous`,e:`archive`,r:`reply`};function ea(e,t,n){return t||n||!Object.hasOwn($i,e)?null:$i[e]??null}var ta=new Intl.DateTimeFormat(void 0,{month:`short`,day:`numeric`}),na=new Intl.DateTimeFormat(void 0,{hour:`2-digit`,minute:`2-digit`,hourCycle:`h23`});function ra(e,t){try{let n=na.format(e);return new Date(e).toDateString()===new Date(t).toDateString()?n:`${ta.format(e)} ${n}`}catch{return`--:--`}}var ia={default:`ASK: asks you for a go before a tool runs`,acceptEdits:`ACCEPT EDITS: edits files without asking`,auto:`AUTO`,bypassPermissions:`BYPASS`},aa=(e,t)=>`${t} ASKS TO HIRE ${e.name}`,z=e=>`Role text (${e.role.length} ${e.role.length===1?`character`:`characters`})`,oa=(e,t,n)=>`${t?`GO`:`NO-GO`} on ${e} failed: ${n instanceof Error?n.message:String(n)}`;function sa(e,t){let n=e.expiresAt-t;if(n<=0)return`expiring now`;if(n<6e4)return`under a minute left`;let r=Math.ceil(n/6e4);return`${r} ${r===1?`minute`:`minutes`} left`}function ca(e,t){let n=_i(e.position),r=[{label:`Name`,value:e.name},{label:`Position`,value:n===null?`none: a role of its own`:`${n.callSign} · ${n.title}`},{label:`Engine`,value:_(e.provider).label},{label:`Mode`,value:_(e.provider).modes?ia[e.mode]:`none: this engine has no permission modes in gonogo, its own rules apply`},{label:`Folder`,value:e.dir}];return e.cleanRoom!==null&&r.push({label:`Clean Room`,value:e.cleanRoom.image===void 0?`yes: its own container and branch`:`yes: its own container and branch, image ${e.cleanRoom.image}`}),r.push({label:`Waits`,value:sa(e,t)}),r}var la=e=>`${e} hire ${e===1?`request waits`:`requests wait`} for your go`,ua=(e,t)=>Object.hasOwn(e,t)?e[t]:t.toUpperCase(),da=e=>e.split(`
|
|
12
|
-
`).find(e=>e.trim()!==``)?.trim()??``;function fa(e,t){if(t===null)return null;let n=e.find(e=>e.from===`user`&&e.to===t&&!e.subject.startsWith(`T-minus:`)&&!e.subject.startsWith(`Relief:`));if(n===void 0)return null;let r=n.subject.trim(),i=da(n.body);return{text:(r===``||r.toLowerCase()===`brief`)&&i||r,at:n.at}}function pa(e){let t=Math.max(0,Math.floor(e/1e3)),n=e=>String(e).padStart(2,`0`);return`${n(Math.floor(t/3600))}:${n(Math.floor(t%3600/60))}:${n(t%60)}`}function ma(e){let t=new Date(e);return`${String(t.getHours()).padStart(2,`0`)}:${String(t.getMinutes()).padStart(2,`0`)}`}var ha=e=>Math.round(e*100)/100;function ga(e,t,n=le){let r=t-n,i=[];return e.history.forEach((a,o)=>{let s=a.state===`working`?e.provider===`custom`?`custom`:`work`:a.state===`needs_you`?`needs`:null;if(s===null)return;let c=Math.max(a.at,r),l=Math.min(o+1<e.history.length?e.history[o+1].at:t,t);l>c&&i.push({kind:s,from:ha((c-r)/n*100),to:ha((l-r)/n*100)})}),i}var _a=e=>{let t=Math.max(0,Math.floor(e/1e3));return t<60?`${t} s`:t<3600?`${Math.floor(t/60)} m`:`${Math.floor(t/3600)} h`},va=e=>e.length<=2?e.join(` and `):`${e.slice(0,-1).join(`, `)} and ${e[e.length-1]}`;function ya(e,t,n){let r=e.filter(e=>e.state===`working`).map(e=>ua(t,e.name)),i=e.filter(e=>e.state===`needs_you`),a=[];r.length>0&&a.push(`${va(r)} ${r.length===1?`is`:`are`} working now`);for(let e of i)a.push(`${ua(t,e.name)} has needed you for ${_a(n-e.stateSince)}`);return a.length>0?a.join(`; `):`Nobody is working and nobody needs you`}function ba(e){if(e===null)return{word:`STANDBY`,count:null,tone:`none`,ghost:!0};switch(e.status){case`open`:return{word:`POLLING`,count:`${e.entries.filter(e=>e.vote!==null).length}/${e.entries.length}`,tone:`none`,ghost:!1};case`go`:return{word:`GO`,count:null,tone:`go`,ghost:!1};case`hold`:return e.entries.some(e=>e.vote===`no-go`)?{word:`NO-GO`,count:null,tone:`nogo`,ghost:!1}:{word:`HOLD`,count:null,tone:`lit`,ghost:!1};case`aborted`:return{word:`ABORTED`,count:null,tone:`nogo`,ghost:!1}}}function xa(e){return e.filter(e=>e.state!==`stopped`&&e.transition===null&&_(e.provider).mcp&&!e.boss)}function Sa(e){return xa(e).filter(e=>fe.includes(e.position??``))}var Ca=e=>e?.subject===void 0?`T-MINUS`:`STATIC FIRE`;function wa(e,t,n){return e===null?t.map(e=>({agent:e.name,verdict:`READY`,text:`${ua(n,e.name)} READY`})):e.entries.map(e=>{let t=e.vote===`go`?`GO`:e.vote===`no-go`?`NO-GO`:`WAIT`;return{agent:e.agent,verdict:t,text:`${ua(n,e.agent)} ${t}`}})}function Ta(e,t,n){if(e===null)return t.length===0?`No poll. Nobody to ask: no running Claude agent besides FLIGHT.`:`No poll. ${t.length} ${t.length===1?`console`:`consoles`} can be asked.`;let r=e.entries.flatMap(e=>e.vote!==null&&e.reason!==``?[`${ua(n,e.agent)}: ${e.reason}`]:[]);return[e.subject??``,e.note,...r].filter(e=>e!==``).join(` · `)}function Ea(e){if(e===null)return[`poll`];switch(e.status){case`open`:return[`hold`,`abort`];case`hold`:return[`abort`,`clear`];case`go`:case`aborted`:return[`clear`]}}function Da(e){let t=e.limit??0;return{total:t,filled:Math.min(e.working,t),full:t>0&&e.working>=t,over:t>0&&e.working>t}}function Oa(e,t){let{limit:n}=e;return t===`minus`?n!==null&&n>1?n-1:null:n===null?Math.min(24,Math.max(1,e.working)):n<24?n+1:null}var ka=.8;function Aa(e,t){let n=e.limits[t];if(n===void 0)return`none`;let r=e.used[t];return r>=n?`over`:r>=n*ka?`warn`:`ok`}function ja(e,t,n){let r={...e};return n===null?delete r[t]:r[t]=n,r}function Ma(e){let t=[...e].sort((e,t)=>e.desk-t.desk||(e.name<t.name?-1:+(e.name>t.name))),n=new Map;for(let e of t)e.position!==null&&_i(e.position)!==null&&!n.has(e.position)&&n.set(e.position,e);let r=gi.map((e,t)=>{let r=n.get(e.id);return r===void 0?{type:`open`,n:t+1,position:e}:{type:`agent`,n:t+1,agent:r,position:e,seated:!0}}),i=new Set(n.values());for(let e of t)i.has(e)||r.push({type:`agent`,n:r.length+1,agent:e,position:_i(e.position),seated:!1});return e.length<24&&r.push({type:`spare`,n:r.length+1}),r}function Na(e){let t=Object.create(null);for(let n of e)n.type===`agent`&&(t[n.agent.name]=n.seated&&n.position!==null?n.position.callSign:n.agent.name.toUpperCase());return t}function Pa(e){switch(e.state){case`working`:return`working`;case`needs_you`:return`needs`;case`starting`:return`starting`;case`stopped`:return`stopped`;default:return`idle`}}function Fa(e){let t=e===`working`||e===`needs`;return{on:t,blink:t||e===`starting`}}var Ia=e=>String(e).padStart(2,`0`),La={stopping:`STOPPING`,restarting:`RESTARTING`,removing:`REMOVING`};function Ra(e,t,n=!0){if(e.transition!==null)return La[e.transition];if(e.provider===`custom`&&e.state===`working`)return`PRINTING`;let r=ue[e.state].toUpperCase();return n?`${r} ${_a(t-e.stateSince).toUpperCase()}`:r}var za=`permission request: `;function Ba(e){let t=e.needsReason;return t===null?null:t.startsWith(za)?t.slice(20):t}var Va=e=>`${e} waiting`;function Ha(e,t){return e.state===`needs_you`&&Ba(e)!==null?Ba(e)??``:e.held===null?e.exit!==null&&e.exit.text!==``?e.exit.text:e.queued>0?Va(e.queued):e.provider===`custom`?e.command??``:t?.summary??e.role.split(`
|
|
13
|
-
`)[0]??``:e.held.text}function Ua(e){return e.replace(/^mcp__gonogo__/,``).replace(/^mcp__([^_:\s]+(?:_[^_:\s]+)*)__/,`$1: `)}function Wa(e,t){let n=Ha(e,t),r=e.provider===`custom`||e.state===`stopped`?null:e.doing;if(r===null||r===``)return[n,``];let i=Ua(r);return i===n||r===n?[i,``]:[i,n]}function Ga(e,t){if(e===null||e.status===`aborted`)return null;let n=e.entries.find(e=>e.agent===t);return n===void 0?null:n.vote===`go`?`GO`:n.vote===`no-go`?`NO-GO`:`WAIT`}function Ka(e,t){if(e.type===`open`)return`Staff a console: ${e.position.callSign}, ${e.position.title}`;if(e.type===`spare`)return`Staff a console with no position`;let{agent:n,position:r}=e,i=n.transition??(n.provider===`custom`&&n.state===`working`?`printing`:ue[n.state]),a=n.provider===`claude`?``:`, ${_(n.provider).label.toLowerCase()}`,o=`${n.name}${n.boss?` (boss)`:``}${r===null?``:`, ${r.title}`}${a}, ${i}`,s=Ba(n);return s!==null&&(o+=`: ${s}`),n.cleanRoom&&(o+=`, clean room`),n.queued>0&&(o+=`, ${n.queued} ${n.queued===1?`message`:`messages`} waiting`),n.held!==null&&(o+=`, ${n.held.text}`),t!==null&&(o+=`, vote ${t.toLowerCase()}`),o}var qa=e=>e.filter(e=>e.state===`needs_you`),Ja=e=>e.state===`needs_you`&&e.needsKind===`permission`&&e.transition===null,Ya=e=>e.state===`needs_you`&&e.needsKind===`redline`&&e.transition===null,Xa=e=>Ya(e)&&e.needsReason===`on hold`,Za=e=>_(e.provider).hooks&&e.transition===null&&(e.state===`idle`||e.state===`working`),Qa=(e,t)=>Ja(e)?`${t} ASKS FOR A GO`:Xa(e)?`${t} IS ON HOLD`:Ya(e)?`${t} HIT THE REDLINE`:`${t} NEEDS YOU`;function $a(e,t){let n=[Ba(e)??`Answer it in the terminal`,`waiting ${_a(t-e.stateSince)}`];return e.queued>0&&n.push(`${e.queued} ${e.queued===1?`message`:`messages`} waiting`),n.join(` · `)}function eo(e){if(e===null)return{tool:null,detail:``};let t=e.indexOf(`: `);return t>0&&t<=24?{tool:e.slice(0,t),detail:e.slice(t+2)}:{tool:null,detail:e}}function to(e){return e.state===`stopped`?`stopped`:e.provider===`custom`?`custom`:Ja(e)?`ask`:e.state===`needs_you`?`needs`:e.state===`starting`?`starting`:`running`}function no(e,t){return t?`ink`:e===`working`?`lit`:e===`needs_you`?`amber`:`quiet`}var ro={startup_dialog:`STARTUP DIALOG`,permission:`PERMISSION`,dialog:`DIALOG`,input:`INPUT`,redline:`REDLINE`};function io(e,t){let n=Ra(e,t);return e.state===`needs_you`&&e.needsKind!==null?`${n} · ${Xa(e)?`HOLD`:ro[e.needsKind]}`:e.provider===`claude`?n:`${n} · ${_(e.provider).label.toUpperCase()}`}function ao(e){let t=[];return e.held===null?e.queued>0&&t.push(`${e.queued} ${e.queued===1?`message`:`messages`} waiting`):t.push(e.held.text),e.dirty&&t.push(`Restart to apply the changes you saved.`),t}function oo(e,t){return e.cleanRoom?{branch:y(e.name),worktree:`${t.replace(/\/+$/,``)}/${v}/${e.name}`}:null}function so(e,t){return[e.name,t?.title??null,e.dir].filter(e=>e!==null&&e!==``).join(` · `)}var co=e=>`${e} staffed · ${Math.max(0,24-e)} open`,lo=e=>e===null?`none`:`${e.id}:${e.status}`;function uo(e){if(e===null)return null;let t=e.subject===void 0?`T-minus`:`Static fire`;switch(e.status){case`open`:return e.subject===void 0?`T-minus: poll started`:`Static fire started: ${e.subject}`;case`go`:return`${t}: GO`;case`hold`:return e.entries.some(e=>e.vote===`no-go`)?`${t}: NO-GO. ${e.note}`:`${t}: HOLD`;case`aborted`:return e.subject===void 0?`T-minus: poll aborted`:`Static fire: aborted`}}function fo(e,t=500){let n=null,r=[],i=-1/0,a;function o(){a===void 0&&r.length!==0&&(a=setTimeout(()=>{a=void 0;let t=r.splice(0).join(`. `);t!==``&&(i=Date.now(),e(t))},Math.max(0,i+t-Date.now())))}return{update(e,t){let i=new Map;for(let t of e.agents)i.set(t.name,t.state);let a={states:i,unread:e.unread,poll:lo(e.poll),limit:e.limit,relief:e.relief??0};if(n===null)e.agents.length>0&&(n=a);else{for(let i of e.agents){let e=n.states.get(i.name);if(e===i.state)continue;let a=t[i.name]??i.name.toUpperCase();i.state===`needs_you`?r.push(`${a} ${Ja(i)?`asks for a go`:`needs you`}${Ba(i)===null?``:`: ${Ba(i)}`}`):i.state===`stopped`&&e!==void 0&&r.push(`${a} stopped`)}if(e.unread>n.unread&&r.push(`${e.unread} unread in the Downlink`),a.relief>n.relief&&r.push(la(a.relief)),a.poll!==n.poll){let t=uo(e.poll);t!==null&&r.push(t)}a.limit!==n.limit&&r.push(a.limit===null?`Max Q off`:`Max Q limit ${a.limit}`),n=a,o()}},stop(){clearTimeout(a),a=void 0},resume:o}}function po(e){return e<1e3?String(Math.round(e)):e<1e6?`${+(e/1e3).toFixed(1)}k`:`${+(e/1e6).toFixed(1)}M`}function mo(e){let t=/^(\d+(?:\.\d+)?)([kKmM]?)$/.exec(e.replace(/[\s,_]/g,``));if(!t)return null;let n=t[2]?.toLowerCase(),r=Math.round(Number(t[1])*(n===`k`?1e3:n===`m`?1e6:1));return Number.isSafeInteger(r)&&r>=1?r:null}var ho={"5h":`5 H`,day:`DAY`,week:`WEEK`,month:`MONTH`};function go(e){let t=`5h`,n=-1;for(let r of de){let i=e.limits[r];i!==void 0&&e.used[r]/i>n&&(n=e.used[r]/i,t=r)}return t}var _o={none:void 0,ok:`var(--go)`,warn:`var(--you)`,over:`var(--nogo)`};function vo({gauge:e,who:t,save:n}){let[r,i]=(0,l.useState)(()=>go(e)),[a,o]=(0,l.useState)(``),[s,c]=(0,l.useState)(!1),{busy:u,error:d,run:f}=To(),p=e.used[r],m=e.limits[r],h=Aa(e,r),g=m===void 0?0:Math.min(1,p/m);return(0,L.jsxs)(`div`,{className:`fuel`,"data-level":h,children:[(0,L.jsx)(`div`,{className:`fuel-windows`,role:`group`,"aria-label":`Window for ${t}`,children:de.map(e=>(0,L.jsx)(`button`,{type:`button`,className:`btn fuel-window`,"data-kind":`quiet`,"aria-pressed":e===r,onClick:()=>i(e),children:ho[e]},e))}),(0,L.jsxs)(`div`,{className:`fuel-lcd lcd`,children:[(0,L.jsx)(`span`,{className:`led`,style:{"--led":_o[h]},"data-on":h!==`none`,"data-blink":h===`over`,"aria-hidden":`true`}),(0,L.jsx)(`span`,{className:`lcd-num fuel-used`,children:po(p)}),(0,L.jsx)(`span`,{className:`fuel-limit`,children:m===void 0?`NO LIMIT`:`/ ${po(m)}`})]}),(0,L.jsx)(`div`,{className:`fuel-bar`,role:`meter`,"aria-label":`${t}: tokens in ${ho[r].toLowerCase()}`,"aria-valuemin":0,"aria-valuemax":m??Math.max(p,1),"aria-valuenow":p,"aria-valuetext":m===void 0?`${po(p)} tokens, no limit`:`${po(p)} of ${po(m)} tokens`,children:(0,L.jsx)(`span`,{style:{width:`${g*100}%`}})}),d!==null&&(0,L.jsx)(`p`,{className:`error`,role:`alert`,children:d}),(0,L.jsxs)(`form`,{className:`fuel-form`,onSubmit:t=>{t.preventDefault();let i=mo(a);c(i===null),i!==null&&f(async()=>{await n(ja(e.limits,r,i)),o(``)})},children:[(0,L.jsx)(`label`,{className:`sr-only`,htmlFor:`fuel-${t}`,children:`Token limit for ${t} in ${ho[r].toLowerCase()}`}),(0,L.jsx)(`input`,{id:`fuel-${t}`,className:`input fuel-input`,inputMode:`decimal`,autoComplete:`off`,placeholder:m===void 0?`e.g. 2M`:po(m),value:a,"aria-invalid":s||void 0,onChange:e=>{o(e.target.value),c(!1)}}),(0,L.jsx)(`button`,{type:`submit`,className:`btn`,"aria-disabled":u||void 0,children:`SET`}),(0,L.jsx)(`button`,{type:`button`,className:`btn`,"data-kind":`quiet`,disabled:m===void 0,"aria-disabled":u||void 0,onClick:()=>f(()=>n(ja(e.limits,r,null))),children:`OFF`})]})]})}function yo(){let e=N(e=>e.propellant.room);return(0,L.jsx)(vo,{gauge:e,who:`the room`,save:e=>Un({room:e})})}var bo={used:{"5h":0,day:0,week:0,month:0},limits:{}};function xo({name:e}){let t=N(t=>t.propellant.agents[e])??bo;return(0,L.jsx)(vo,{gauge:t,who:e,save:t=>Un({agents:{[e]:t}})})}var So={poll:`Poll the room`,hold:`Hold`,abort:`Abort`,clear:`Clear`},Co={poll:`Ask every running Claude agent except FLIGHT for go or no-go`,hold:`Hold the poll`,abort:`Abort the poll and tell the agents to stand by`,clear:`Remove the poll from the wall`};function wo(e){let t=(0,l.useRef)(!1);return(0,l.useLayoutEffect)(()=>{!t.current||document.activeElement!==document.body&&document.activeElement!==null||e.current?.querySelector(`button:not(:disabled)`)?.focus()}),{onFocus:()=>{t.current=!0},onBlur:e=>{let n=e.target;n.isConnected&&!n.disabled&&(t.current=!1)}}}function To(){let[e,t]=(0,l.useState)(!1),[n,r]=(0,l.useState)(null);return{busy:e,error:n,run:n=>{e||(t(!0),r(null),n().catch(e=>r(e instanceof Error?e.message:String(e))).finally(()=>t(!1)))}}}function Eo({letter:e,children:t}){return(0,L.jsxs)(`h2`,{className:`label`,children:[(0,L.jsxs)(`span`,{className:`label-letter`,"aria-hidden":`true`,children:[e,` ·`,` `]}),t]})}function Do(){let e=N(e=>e.activity),t=N(e=>e.agents),n=N(e=>e.order),r=Nt(),i=n.find(e=>Object.hasOwn(t,e)&&t[e].boss)??null,a=(0,l.useMemo)(()=>fa(e,i),[e,i]);return(0,L.jsxs)(`div`,{className:`wall-block wall-mission module`,children:[(0,L.jsx)(Eo,{letter:`A`,children:`MISSION`}),(0,L.jsxs)(`div`,{className:`wall-lcd lcd`,children:[(0,L.jsx)(`p`,{className:`wall-mission-text`,children:a===null?`Brief FLIGHT to start the clock.`:a.text}),(0,L.jsx)(`span`,{className:`lcd-num wall-clock`,"data-ghost":a===null,role:`timer`,"aria-label":`Mission elapsed`,children:pa(a===null?0:r-a.at)})]}),(0,L.jsx)(`span`,{className:`label wall-clock-label`,children:a===null?`NO MISSION YET`:`ELAPSED SINCE THE BRIEF · ${ma(a.at)}`})]})}function Oo(){let e=N(e=>e.order),t=N(e=>e.agents),n=Nt(),r=(0,l.useMemo)(()=>Ma(e.flatMap(e=>Object.hasOwn(t,e)?[t[e]]:[])),[e,t]),i=(0,l.useMemo)(()=>Na(r),[r]),a=r.flatMap(e=>e.type===`agent`?[e.agent]:[]);return(0,L.jsxs)(`div`,{className:`wall-block wall-sequence module`,children:[(0,L.jsxs)(`div`,{className:`wall-head`,children:[(0,L.jsx)(Eo,{letter:`B`,children:`SEQUENCE`}),(0,L.jsxs)(`span`,{className:`seq-key`,children:[(0,L.jsx)(`span`,{className:`seq-swatch`,"data-kind":`work`,"aria-hidden":`true`}),`working`]}),(0,L.jsxs)(`span`,{className:`seq-key`,children:[(0,L.jsx)(`span`,{className:`seq-swatch`,"data-kind":`needs`,"aria-hidden":`true`}),`needs you`]})]}),(0,L.jsx)(`div`,{className:`seq-tracks`,role:`img`,"aria-label":ya(a,i,n),"data-dense":a.length>10,children:a.map(e=>(0,L.jsxs)(`div`,{className:`seq-row`,children:[(0,L.jsx)(`span`,{className:`seq-call`,children:i[e.name]}),(0,L.jsx)(`span`,{className:`seq-track`,children:ga(e,n).map((e,t)=>(0,L.jsx)(`span`,{className:`seq-span`,"data-kind":e.kind,style:{left:`${e.from}%`,width:`${e.to-e.from}%`}},t))})]},e.name))}),(0,L.jsxs)(`div`,{className:`seq-axis`,"aria-hidden":`true`,children:[(0,L.jsx)(`span`,{children:`−10 m`}),(0,L.jsx)(`span`,{children:`−5 m`}),(0,L.jsx)(`span`,{children:`now`})]})]})}function ko(){let e=N(e=>e.poll),t=N(e=>e.order),n=N(e=>e.agents),r=(0,l.useMemo)(()=>t.flatMap(e=>Object.hasOwn(n,e)?[n[e]]:[]),[t,n]),i=(0,l.useMemo)(()=>Na(Ma(r)),[r]),a=(0,l.useMemo)(()=>xa(r),[r]),o=(0,l.useMemo)(()=>Sa(r),[r]),[s,c]=(0,l.useState)(``),{busy:u,error:d,run:f}=To(),p=(0,l.useRef)(null),m=wo(p),h=ba(e),g=e=>ua(i,e),_=wa(e,a,i),v=Ta(e,a,i),y=e===null&&a.length===0,b={poll:()=>f(()=>In({})),hold:()=>f(()=>Ln()),abort:()=>f(()=>Rn()),clear:()=>f(()=>zn())};return(0,L.jsxs)(`div`,{className:h.tone===`none`?`wall-block wall-tminus module`:`wall-block wall-tminus module flood`,"data-tone":h.tone===`none`?void 0:h.tone,children:[(0,L.jsx)(Eo,{letter:`C`,children:Ca(e)}),(0,L.jsxs)(`p`,{className:`wall-word`,children:[(0,L.jsx)(`span`,{className:`disp`,"data-ghost":h.ghost,children:h.word}),h.count!==null&&(0,L.jsx)(`span`,{className:`lcd-num wall-count`,children:h.count})]}),(0,L.jsx)(`p`,{className:`wall-note`,title:v,children:v}),_.length>0&&(0,L.jsx)(`ul`,{className:e===null?`vote-chips sr-only`:`vote-chips`,"aria-label":`Votes`,children:_.map(e=>(0,L.jsxs)(`li`,{className:`vote-chip`,"data-verdict":e.verdict,children:[(0,L.jsx)(`span`,{className:`led`,"data-on":e.verdict===`GO`||e.verdict===`NO-GO`,"data-blink":e.verdict===`WAIT`,"aria-hidden":`true`}),(0,L.jsx)(`span`,{className:`vote-call`,children:g(e.agent)}),` `,(0,L.jsx)(`span`,{className:`vote-verdict`,children:e.verdict})]},e.agent))}),d!==null&&(0,L.jsx)(`p`,{className:`error`,role:`alert`,children:d}),(0,L.jsx)(`div`,{className:`wall-actions`,ref:p,...m,children:Ea(e).map(e=>(0,L.jsx)(`button`,{type:`button`,className:`btn`,"data-kind":e===`poll`||e===`clear`?`primary`:e===`abort`?`danger`:void 0,disabled:e===`poll`&&y,"aria-disabled":u||void 0,title:e===`poll`&&y?`There is nobody to poll: no running Claude agent besides FLIGHT`:Co[e],onClick:b[e],children:So[e]},e))}),e===null&&(0,L.jsxs)(`form`,{className:`wall-fire`,onSubmit:e=>{e.preventDefault(),o.length>0&&s.trim()!==``&&f(()=>In({subject:s}).then(()=>c(``)))},children:[(0,L.jsx)(`input`,{className:`input`,type:`text`,value:s,maxLength:187,autoComplete:`off`,"aria-label":`What to static fire`,"aria-describedby":o.length===0?`wall-fire-why`:void 0,placeholder:`What to test`,onChange:e=>c(e.target.value)}),(0,L.jsx)(`button`,{type:`submit`,className:`btn`,disabled:o.length===0,"aria-disabled":u||s.trim()===``||void 0,title:o.length===0?void 0:`Ask ${o.map(e=>g(e.name)).join(` and `)} to break it and plan the rollback`,children:`Static fire`}),o.length===0&&(0,L.jsx)(`p`,{id:`wall-fire-why`,className:`hint`,children:`Static fire needs a running SIMSUP or RETRO.`})]})]})}function Ao(){let e=N(e=>e.governor),{busy:t,error:n,run:r}=To(),i=Da(e),a=Oa(e,`minus`),o=Oa(e,`plus`),s=(0,l.useRef)(null),c=wo(s),u=e=>r(()=>Hn({limit:e}));return(0,L.jsxs)(`div`,{className:`wall-block wall-maxq module`,children:[(0,L.jsx)(Eo,{letter:`D`,children:`MAX Q`}),(0,L.jsx)(`div`,{className:`knob`,role:i.total>0?`img`:void 0,"aria-label":i.total>0?`${e.working} of ${e.limit} Claude agents working${i.over?`, over the limit`:``}`:void 0,"data-full":i.full,style:{"--fill":`${i.total>0?i.filled/i.total*270:0}deg`},children:(0,L.jsx)(`p`,{className:`lcd-num wall-limit`,children:e.limit===null?`OFF`:(0,L.jsxs)(L.Fragment,{children:[e.working,(0,L.jsxs)(`span`,{children:[`/`,e.limit]})]})})}),(0,L.jsxs)(`p`,{className:`wall-note wall-maxq-note`,children:[e.limit===null?`No limit. ${e.working} working.`:`Claude agents working`,e.holding>0&&` · holding ${e.holding}`]}),n!==null&&(0,L.jsx)(`p`,{className:`error`,role:`alert`,children:n}),(0,L.jsxs)(`div`,{className:`stepper`,role:`group`,"aria-label":`Working limit`,ref:s,...c,children:[(0,L.jsx)(`button`,{type:`button`,className:`btn`,"data-shape":`round`,disabled:a===null,"aria-disabled":t||void 0,"aria-label":`Lower the limit`,onClick:()=>a!==null&&u(a),children:`−`}),(0,L.jsx)(`button`,{type:`button`,className:`btn`,"data-shape":`round`,disabled:o===null,"aria-disabled":t||void 0,"aria-label":e.limit===null?`Set a limit`:`Raise the limit`,title:o===null?`At most 24`:void 0,onClick:()=>o!==null&&u(o),children:`+`}),(0,L.jsx)(`button`,{type:`button`,className:`btn stepper-off`,"data-kind":`quiet`,disabled:e.limit===null,"aria-disabled":t||void 0,onClick:()=>u(null),children:`Off`})]})]})}function jo(){return(0,L.jsxs)(`div`,{className:`wall-block wall-fuel module`,children:[(0,L.jsx)(Eo,{letter:`F`,children:`PROPELLANT`}),(0,L.jsx)(yo,{})]})}function Mo(){return(0,L.jsxs)(`section`,{className:`wall`,"aria-label":`The wall`,children:[(0,L.jsx)(Do,{}),(0,L.jsx)(Oo,{}),(0,L.jsx)(ko,{}),(0,L.jsx)(Ao,{}),(0,L.jsx)(jo,{})]})}var No=100;function Po({item:e,agents:t,now:n,open:r,stop:i,onToggle:a,onFocus:o,onRead:s,onArchive:c,onReplied:l}){let u=!e.read,d=e.type===`message`?wi(e):e.text,f=`${u?`Unread. `:``}${e.type===`message`?`From ${R(e.from,t)}`:Ji[e.kind].text}: ${d}`,p=(0,L.jsx)(`span`,{className:`led`,"data-on":u,"aria-hidden":`true`});return(0,L.jsx)(`li`,{className:`dl-row`,children:(0,L.jsxs)(`article`,{id:Xi(e.id),className:`dl-item`,"data-item":e.id,"data-unread":u?``:void 0,tabIndex:i?0:-1,"aria-label":f,onFocus:o,children:[e.type===`message`?(0,L.jsxs)(`button`,{type:`button`,className:`dl-head`,"aria-expanded":r,onClick:a,children:[p,(0,L.jsx)(`span`,{className:`dl-when`,children:ra(e.at,n)}),(0,L.jsx)(`span`,{className:`dl-who`,children:R(e.from,t)}),(0,L.jsx)(`span`,{className:`dl-text`,children:d})]}):(0,L.jsxs)(`div`,{className:`dl-head`,children:[p,(0,L.jsx)(`span`,{className:`dl-when`,children:ra(e.at,n)}),(0,L.jsx)(`span`,{className:`chip dl-who`,"data-tone":Ji[e.kind].tone,children:Ji[e.kind].text}),(0,L.jsx)(`span`,{className:`dl-text`,children:d})]}),r&&e.type===`message`&&(0,L.jsxs)(`div`,{className:`dl-open`,children:[(0,L.jsxs)(`p`,{className:`loop-body`,children:[e.body,e.truncated?` …(cut)`:``]}),(0,L.jsx)(ji,{item:e,agents:t,onSent:l})]}),(0,L.jsxs)(`div`,{className:`dl-actions`,children:[u&&(0,L.jsx)(`button`,{type:`button`,className:`btn`,"aria-label":`Mark read: ${d}`,onClick:s,children:`Mark read`}),!e.archived&&(0,L.jsx)(`button`,{type:`button`,className:`btn`,"aria-label":`Archive: ${d}`,onClick:c,children:`Archive`})]})]})})}function Fo(){let e=(0,l.useId)(),t=N(e=>e.downlink),n=N(e=>e.agents),[r,i]=(0,l.useState)(`all`),[a,o]=(0,l.useState)(null),[s,c]=(0,l.useState)(null),[u,d]=(0,l.useState)(``),[f,p]=(0,l.useState)(()=>new Set),m=e=>p(t=>t.has(e)?t:new Set(t).add(e)),{busy:h,error:g,run:_}=To(),v=(0,l.useRef)(null),y=(0,l.useRef)(null),b=(0,l.useMemo)(()=>qi(t.items),[t.items]),x=(0,l.useMemo)(()=>Ki(t.items,r,f),[t.items,r,f]),S=(0,l.useMemo)(()=>x.slice(0,No),[x]),C=(0,l.useMemo)(()=>S.map(e=>e.id),[S]);(0,l.useEffect)(()=>v.current?.focus(),[]),(0,l.useEffect)(()=>{let e=y.current,t=e===null?null:document.getElementById(Xi(e))?.querySelector(`.loop-reply-input`);t&&(y.current=null,t.focus())});let ee=(0,l.useMemo)(()=>Date.now(),[t.items]),w=s!==null&&C.includes(s)?s:C[0]??null,T=e=>{c(e),e===null?v.current?.focus():document.getElementById(Xi(e))?.focus()},E=e=>{m(e),_(async()=>{await Or([e]),d(`Marked read`)})},te=e=>{h||(T(Qi(C,e)),_(async()=>{await kr([e]),d(`Archived`)}))},D=e=>{let t=a!==e.id;o(t?e.id:null),t&&!e.read&&(m(e.id),Or([e.id]).catch(()=>void 0))},ne=e=>{if(e.type!==`message`)return;let t=document.getElementById(Xi(e.id))?.querySelector(`.loop-reply-input`);t?t.focus():(y.current=e.id,D(e))};return(0,L.jsxs)(`section`,{className:`dl`,"aria-labelledby":e,onKeyDown:e=>{let t=e.target,n=t.isContentEditable||[`INPUT`,`TEXTAREA`,`SELECT`].includes(t.tagName),r=ea(e.key,e.ctrlKey||e.metaKey||e.altKey||e.nativeEvent.isComposing,n);if(r===null)return;let i=t.closest(`[data-item]`)?.dataset.item??null,a=S.find(e=>e.id===i);if(r===`next`||r===`previous`)T(Zi(C,i??s,r===`next`?1:-1));else if(a===void 0)return;else if(r===`archive`){if(a.archived)return;te(a.id)}else ne(a);e.preventDefault()},children:[(0,L.jsxs)(`header`,{className:`loop-head`,children:[(0,L.jsx)(`h1`,{id:e,ref:v,tabIndex:-1,className:`disp loop-title dl-heading`,children:`DOWNLINK`}),(0,L.jsx)(`span`,{className:`chip`,"data-tone":t.unread>0?`amber`:`quiet`,children:Yi(t.unread)}),(0,L.jsx)(`div`,{className:`loop-filters`,role:`group`,"aria-label":`Filter`,children:Wi.map(({id:e,label:t})=>(0,L.jsxs)(`button`,{type:`button`,className:`btn loop-filter`,"data-kind":r===e?`primary`:`quiet`,"aria-pressed":r===e,onClick:()=>i(e),children:[t,` `,(0,L.jsx)(`span`,{className:`loop-count`,children:b[e]})]},e))}),(0,L.jsx)(`button`,{type:`button`,className:`btn loop-filter`,"aria-disabled":t.unread===0||void 0,onClick:()=>{t.unread!==0&&_(async()=>{await Ar(),d(`All marked read`)})},children:`Mark all read`}),(0,L.jsx)(`button`,{type:`button`,className:`btn loop-room`,"data-kind":`quiet`,onClick:dt,children:`Room`})]}),(0,L.jsx)(`p`,{className:`hint dl-keys`,children:`Keys: j and k move, e archives, r replies.`}),g!==null&&(0,L.jsx)(`p`,{className:`error`,role:`alert`,children:g}),(0,L.jsxs)(`div`,{className:`dl-scroll module`,children:[S.length===0?(0,L.jsx)(`p`,{className:`loop-empty`,children:t.items.length===0?`Nothing yet. What the agents send you, and what needs your eye (a Redline trip, a T-minus result, a schedule that failed, an Uplink refused, a task blocked or in review), lands here.`:`Nothing in this filter.`}):(0,L.jsx)(`ol`,{className:`dl-list`,children:S.map(e=>(0,L.jsx)(Po,{item:e,agents:n,now:ee,open:a===e.id,stop:w===e.id,onToggle:()=>D(e),onFocus:()=>c(e.id),onRead:()=>{T(e.id),E(e.id)},onArchive:()=>te(e.id),onReplied:()=>E(e.id)},e.id))}),x.length>S.length&&(0,L.jsxs)(`p`,{className:`hint dl-more`,children:[`The newest `,No,` of `,x.length,` are shown. Archive or mark read to reach the older ones.`]})]}),(0,L.jsx)(`p`,{className:`sr-only`,role:`status`,children:u})]})}var Io=[{name:`minute`,min:0,max:59},{name:`hour`,min:0,max:23},{name:`day of month`,min:1,max:31},{name:`month`,min:1,max:12,names:[`jan`,`feb`,`mar`,`apr`,`may`,`jun`,`jul`,`aug`,`sep`,`oct`,`nov`,`dec`]},{name:`day of week`,min:0,max:7,names:[`sun`,`mon`,`tue`,`wed`,`thu`,`fri`,`sat`]}],Lo=[0,31,29,31,30,31,30,31,31,30,31,30,31],Ro=2846016e5,zo=2e5;function Bo(e,t){let n=NaN;if(/^\d{1,3}$/.test(e))n=Number(e);else if(t.names){let r=t.names.indexOf(e.toLowerCase());r>=0&&(n=r+ +(t.name===`month`))}return Number.isNaN(n)?`${t.name}: "${e}" is not a number${t.names?` or a name`:``}`:n<t.min||n>t.max?`${t.name}: ${n} is not from ${t.min} to ${t.max}`:n}function Vo(e,t){let n=new Set;for(let r of e.split(`,`)){let[e=``,i,a]=r.split(`/`);if(r===``||a!==void 0)return`${t.name}: "${r}" is not a value, a range or a step`;let o,s;if(e===`*`)o=t.min,s=t.name===`day of week`?6:t.max;else if(e.includes(`-`)){let[n=``,r=``,i]=e.split(`-`);if(i!==void 0)return`${t.name}: "${e}" is not a range`;o=Bo(n,t),s=Bo(r,t)}else if(o=Bo(e,t),s=o,i!==void 0)return`${t.name}: a step needs * or a range, as in */5 or 1-30/5`;if(typeof o==`string`)return o;if(typeof s==`string`)return s;if(o>s)return`${t.name}: the range ${e} ends before it starts`;let c=1;if(i!==void 0){if(!/^\d{1,3}$/.test(i)||Number(i)<1)return`${t.name}: the step "${i}" is not a positive number`;c=Number(i)}for(let e=o;e<=s;e+=c)n.add(t.name===`day of week`&&e===7?0:e)}return n}function Ho(e){let t=e.trim().split(/\s+/);if(t.length!==5)return`a rule has 5 fields: minute hour day-of-month month day-of-week`;let n=[];for(let[e,r]of Io.entries()){let i=Vo(t[e]??``,r);if(typeof i==`string`)return i;n.push(i)}let[r,i,a,o,s]=n,c={minutes:r,hours:i,days:a,months:o,weekdays:s,daysStar:t[2]?.startsWith(`*`)===!0,weekdaysStar:t[4]?.startsWith(`*`)===!0};return!c.daysStar&&c.weekdaysStar&&![...o].some(e=>[...a].some(t=>t<=(Lo[e]??0)))?`day of month: that day never comes in the months given`:c}function Uo(e,t){let n=e.days.has(t.getDate()),r=e.weekdays.has(t.getDay());return e.daysStar||e.weekdaysStar?n&&r:n||r}function B(e,t){let n=new Date(t);n.setSeconds(0,0),n.setMinutes(n.getMinutes()+1);let r=t+Ro;for(let t=0;t<zo&&n.getTime()<=r;t+=1)if(!e.months.has(n.getMonth()+1))n.setMonth(n.getMonth()+1,1),n.setHours(0,0,0,0);else if(!Uo(e,n))n.setDate(n.getDate()+1),n.setHours(0,0,0,0);else if(!e.hours.has(n.getHours()))n.setHours(n.getHours()+1,0,0,0);else if(!e.minutes.has(n.getMinutes()))n.setMinutes(n.getMinutes()+1,0,0);else return n.getTime();return null}function Wo(e,t,n){let r=[],i=t;for(;r.length<n;){let t=B(e,i);if(t===null)break;r.push(t),i=t}return r}var Go=[`Sun`,`Mon`,`Tue`,`Wed`,`Thu`,`Fri`,`Sat`],Ko=[`Jan`,`Feb`,`Mar`,`Apr`,`May`,`Jun`,`Jul`,`Aug`,`Sep`,`Oct`,`Nov`,`Dec`],qo=e=>String(e).padStart(2,`0`);function Jo(e,t){let n=Math.ceil((e-t)/6e4),r=Math.round(n/60),i=n<1?`now`:n<60?`in ${n} min`:r<48?`in ${r} h`:`in ${Math.round(r/24)} d`,a=new Date(e),o=e-t>=5184e5?` ${a.getDate()} ${Ko[a.getMonth()]}`:``;return`${i}, ${qo(a.getHours())}:${qo(a.getMinutes())} ${Go[a.getDay()]}${o}`}function Yo(e,t){return e.enabled?e.nextAt===null?`never`:Jo(e.nextAt,t):`off`}function Xo(e){if(e.lastRunAt===null)return`Not run yet`;let t=new Date(e.lastRunAt);return`Ran ${qo(t.getHours())}:${qo(t.getMinutes())} ${Go[t.getDay()]}${e.lastResult===null?``:`: ${e.lastResult}`}`}function Zo(e,t){if(e.trim()===``)return{times:[],problem:null};let n=Ho(e);return typeof n==`string`?{times:[],problem:n}:{times:Wo(n,t,3).map(e=>Jo(e,t)),problem:null}}function Qo(e,t){return e===t?null:`This page shows times in ${t}; the rules run in ${e}.`}var $o=[`name`,`to`,`subject`,`body`,`rule`],es=e=>({name:``,to:e,subject:``,body:``,rule:``,enabled:!0}),ts=e=>({name:e.name,to:e.to,subject:e.subject,body:e.body,rule:e.rule,enabled:e.enabled});function ns(e){let t={},n=e.name.trim();if(n===``?t.name=`Give it a name.`:n.length>60&&(t.name=`At most 60 characters.`),e.to===``&&(t.to=`Pick who gets it.`),w(n,e.subject.trim()).length>200&&(t.subject=`The name and the subject together are too long (at most 183).`),e.body.trim()===``?t.body=`Write the message.`:e.body.length>2e4&&(t.body=`At most ${ee} characters.`),e.rule.trim()===``)t.rule=`Give the rule.`;else if(e.rule.length>100)t.rule=`At most 100 characters.`;else{let n=Ho(e.rule);typeof n==`string`&&(t.rule=n)}return t}var rs=e=>({name:e.name.trim(),to:e.to,subject:e.subject.trim(),body:e.body,rule:e.rule.trim(),enabled:e.enabled});function is(e,t,n){let r=[{value:`boss`,label:`FLIGHT (the boss)`}];for(let n of e)!n.boss&&_(n.provider).mcp&&r.push({value:n.name,label:R(n.name,t)});return n!==null&&!r.some(e=>e.value===n)&&r.push({value:n,label:`${n} (${Object.hasOwn(t,n)?`cannot read mail`:`not in the room`})`}),r}var as=(e,t)=>e===`boss`?`FLIGHT`:Object.hasOwn(t,e)?R(e,t):e.toUpperCase(),os=(e,t)=>`${e}/uplink/${t}`;function ss(e,t){let n=new Date(e),r=`${qo(n.getHours())}:${qo(n.getMinutes())}`;return new Date(t).toDateString()===n.toDateString()?r:`${n.getDate()} ${Ko[n.getMonth()]} ${r}`}function cs(e,t){let n=e.deliveries[0];return n===void 0?`No deliveries yet`:`Last delivery ${ss(n.at,t)}: ${n.note}`}function ls(e){return e===`queued`||e===`delivered`||e===`read`?`go`:e===`held`?`amber`:e===`undelivered`||e===`refused`?`nogo`:`quiet`}var us=[`name`,`to`,`secret`],ds=e=>D.includes(e),fs=(e,t)=>e===``?t?void 0:`Paste the signing secret.`:/^[\x21-\x7e]{16,256}$/.test(e)?void 0:`A signing secret has 16 to 256 characters and no spaces.`,ps=e=>({name:``,to:e,enabled:!0}),ms=e=>({name:e.name,to:e.to,enabled:e.enabled});function hs(e){let t={},n=e.name.trim();return n===``?t.name=`Give it a name.`:n.length>60&&(t.name=`At most 60 characters.`),e.to===``&&(t.to=`Pick who gets it.`),t}var gs=e=>({name:e.name.trim(),to:e.to,enabled:e.enabled});async function _s(e){try{return await navigator.clipboard.writeText(e),!0}catch{return!1}}var vs=`gonogo-dock:`;function ys(e){let t=`Type a web address with no path, such as https://gonogo.example.com.`,n;try{n=new URL(e.trim())}catch{return t}return(n.protocol===`http:`||n.protocol===`https:`)&&n.username===``&&n.password===``&&n.search===``&&n.hash===``&&n.pathname===`/`?void 0:t}var bs=e=>e.trim().startsWith(`gonogo-dock:`)?void 0:`Paste the whole code from the other station. It starts with ${vs}`;function xs(e){let t;try{t=new URL(e).hostname}catch{return null}return t===`localhost`||t===`[::1]`||t.startsWith(`127.`)||t===`0.0.0.0`?`This address works only on this computer. The other station needs one it can reach, such as a public name or a VPN address.`:null}var Ss=e=>e.status===`ok`?`go`:e.status===`down`?`nogo`:`quiet`,Cs=e=>e.status===`ok`?`DOCKED`:e.status===`down`?`NO ANSWER`:`WAITING`;function ws(e,t){return e.status===`new`?`Waiting for the first answer.`:e.status===`ok`?`Answered at ${ss(e.seenAt??t,t)}.`:`Not answering${e.seenAt===null?``:`, last seen ${ss(e.seenAt,t)}`}: ${e.error??`no reason given`}`}var Ts=(e,t)=>`It works once, until ${ss(e,t)}.`,Es=(e,t)=>t?`Undocked from ${e}.`:`Undocked from ${e}. It could not be reached, so it still lists this station until it is undocked there too.`,Ds=e=>[{value:``,label:`Nobody yet`},...e.agents.map(e=>({value:e.name,label:e.boss?`${e.name} (boss)`:e.name}))],Os=(e,t)=>t.length>0&&e.status!==`done`&&e.handedOff===void 0,ks=(e,t)=>({task:e.id,assignee:t===``?null:t}),As=e=>e instanceof Error?e.message:String(e),js=e=>e.currentTarget.select();function Ms({mode:e,onDone:t,onMade:n,onNotice:r}){let i=(0,l.useId)(),[a,o]=(0,l.useState)(location.origin),[s,c]=(0,l.useState)(``),[u,d]=(0,l.useState)({}),[f,p]=(0,l.useState)(null),[m,h]=(0,l.useState)(!1),g=(0,l.useRef)(null);(0,l.useEffect)(()=>g.current?.focus(),[]);let _=xs(a.trim());async function v(o){if(o.preventDefault(),m)return;let c={address:ys(a),...e===`pair`?{code:bs(s)}:{}};d(c),p(null);let l=e===`pair`&&c.code!==void 0?`code`:c.address===void 0?null:`address`;if(l!==null)document.getElementById(`${i}-${l}`)?.focus();else{h(!0);try{e===`code`?n(await er(a.trim())):r(`Docked with ${(await tr(s.trim(),a.trim())).name}.`),t()}catch(e){let t=e.field;if(t===`url`||t===`code`){let n=t===`url`?`address`:`code`;d({[n]:As(e)}),document.getElementById(`${i}-${n}`)?.focus()}else p(As(e));h(!1)}}}let y=e=>{e.key===`Escape`&&!e.nativeEvent.isComposing&&t()},b=(0,L.jsxs)(`div`,{className:`field`,"data-invalid":u.address===void 0?void 0:``,children:[(0,L.jsx)(`label`,{htmlFor:`${i}-address`,children:`Address of this station`}),(0,L.jsx)(`input`,{id:`${i}-address`,ref:e===`code`?g:void 0,className:`input`,value:a,inputMode:`url`,autoComplete:`off`,spellCheck:!1,"aria-invalid":u.address!==void 0,"aria-describedby":[`${i}-address-hint`,u.address===void 0?``:`${i}-address-error`].filter(Boolean).join(` `),onChange:e=>{o(e.target.value),d(e=>({...e,address:void 0}))}}),u.address!==void 0&&(0,L.jsx)(`p`,{className:`error`,id:`${i}-address-error`,children:u.address}),(0,L.jsxs)(`p`,{className:`hint`,id:`${i}-address-hint`,children:[`How the other station reaches this one. Its name has to be allowed here (--allow-host).`,_===null?``:` ${_}`]})]});return(0,L.jsxs)(`form`,{className:`win-form module`,"aria-label":e===`code`?`Make a docking code`:`Pair with a docking code`,noValidate:!0,onSubmit:e=>void v(e),onKeyDown:y,children:[(0,L.jsx)(`h3`,{className:`label`,children:e===`code`?`Make a code`:`Pair`}),(0,L.jsxs)(`fieldset`,{className:`win-fields`,disabled:m,children:[e===`pair`&&(0,L.jsxs)(`div`,{className:`field`,"data-invalid":u.code===void 0?void 0:``,children:[(0,L.jsx)(`label`,{htmlFor:`${i}-code`,children:`Code from the other station`}),(0,L.jsx)(`input`,{id:`${i}-code`,ref:g,className:`input`,value:s,autoComplete:`off`,spellCheck:!1,"aria-invalid":u.code!==void 0,"aria-describedby":u.code===void 0?void 0:`${i}-code-error`,onChange:e=>{c(e.target.value),d(e=>({...e,code:void 0}))}}),u.code!==void 0&&(0,L.jsx)(`p`,{className:`error`,id:`${i}-code-error`,children:u.code})]}),b]}),f!==null&&(0,L.jsx)(`p`,{className:`error`,role:`alert`,children:f}),(0,L.jsxs)(`div`,{className:`win-actions`,children:[(0,L.jsx)(`button`,{type:`submit`,className:`btn`,"data-kind":`primary`,"data-size":`big`,"aria-disabled":m||void 0,children:m?`Working…`:e===`code`?`Make code`:`Pair`}),(0,L.jsx)(`button`,{type:`button`,className:`btn`,"data-size":`big`,"data-kind":`quiet`,onClick:t,children:`Cancel`})]})]})}function Ns({made:e,now:t,onDone:n,onNotice:r}){let i=(0,l.useRef)(null);return(0,l.useEffect)(()=>{i.current?.focus(),i.current?.select()},[]),(0,L.jsxs)(`div`,{className:`dk-code flood`,"data-tone":`amber`,role:`group`,"aria-label":`Docking code`,children:[(0,L.jsxs)(`p`,{children:[(0,L.jsx)(`strong`,{children:`Docking code.`}),` `,Ts(e.expiresAt,t),` Give it to the Director of the other station: they paste it under Pair, with the address of their own station. gonogo will not show it again.`]}),(0,L.jsx)(`input`,{ref:i,readOnly:!0,className:`input up-value`,"aria-label":`Docking code`,value:e.code,spellCheck:!1,onFocus:js}),(0,L.jsxs)(`div`,{className:`up-keys`,children:[(0,L.jsx)(`button`,{type:`button`,className:`btn`,onClick:()=>void _s(e.code).then(e=>r(e?`Code copied.`:`Could not copy. Select the code and copy it.`)),children:`Copy code`}),(0,L.jsx)(`button`,{type:`button`,className:`btn`,"data-kind":`primary`,onClick:n,children:`I have it`})]})]})}function Ps({dock:e,now:t,onNotice:n}){let{busy:r,error:i,run:a}=To(),[o,s]=(0,l.useState)(!1),c=(0,l.useRef)(null),u=(0,l.useRef)(null),d=(0,l.useRef)(!1);return(0,l.useEffect)(()=>{o?c.current?.focus():d.current&&u.current?.focus(),d.current=o},[o]),(0,L.jsxs)(`li`,{className:`up-row`,"data-off":e.status===`down`?``:void 0,children:[(0,L.jsxs)(`div`,{className:`win-main`,children:[(0,L.jsxs)(`h3`,{className:`win-name`,children:[e.name,` `,(0,L.jsx)(`span`,{className:`chip`,"data-tone":Ss(e),children:Cs(e)})]}),(0,L.jsx)(`p`,{className:`win-to`,children:e.url})]}),(0,L.jsx)(`p`,{className:`win-last`,children:ws(e,t)}),(0,L.jsxs)(`details`,{className:`up-log`,children:[(0,L.jsxs)(`summary`,{children:[`Agents (`,e.agents.length,`)`]}),e.agents.length===0?(0,L.jsxs)(`p`,{className:`hint`,children:[`None yet. Agents write to them as name@`,e.name,`.`]}):(0,L.jsx)(`ul`,{className:`dk-agents`,children:e.agents.map(t=>(0,L.jsxs)(`li`,{children:[(0,L.jsxs)(`span`,{className:`dk-name`,children:[t.name,`@`,e.name]}),(0,L.jsx)(`span`,{className:`chip`,"data-tone":t.state===`working`?`go`:t.state===`needs_you`?`amber`:`quiet`,children:t.state.replace(`_`,` `)}),t.boss&&(0,L.jsx)(`span`,{className:`chip`,"data-tone":`quiet`,children:`boss`}),(0,L.jsx)(`span`,{className:`dk-role`,children:t.role})]},t.name))})]}),(0,L.jsx)(`div`,{className:`win-buttons`,children:(0,L.jsx)(`button`,{type:`button`,ref:u,className:`btn`,"data-kind":`danger`,"aria-label":`Undock ${e.name}`,"aria-disabled":r||void 0,onClick:()=>s(!0),children:`Undock`})}),o&&(0,L.jsxs)(`div`,{className:`win-confirm flood`,"data-tone":`nogo`,role:`group`,"aria-label":`Undock ${e.name}?`,children:[(0,L.jsxs)(`p`,{children:[(0,L.jsxs)(`strong`,{children:[`Undock `,e.name,`?`]}),` Its agents can no longer write to yours and yours cannot write to theirs. Dock again with a new code.`]}),(0,L.jsx)(`button`,{type:`button`,className:`btn`,ref:c,onClick:()=>s(!1),children:`Keep`}),(0,L.jsx)(`button`,{type:`button`,className:`btn`,"data-kind":`primary`,"aria-disabled":r||void 0,onClick:()=>{s(!1),a(async()=>n(Es(e.name,await nr(e.id))))},children:`Undock`})]}),i!==null&&(0,L.jsx)(`p`,{className:`error win-error`,role:`alert`,children:i})]})}function Fs(){let e=(0,l.useId)(),t=N(e=>e.docking),n=Nt(),[r,i]=(0,l.useState)(null),[a,o]=(0,l.useState)(null),[s,c]=(0,l.useState)(``),u=(0,l.useRef)(null),d=t.docks.length>=8,f=e=>{e(),u.current?.focus()};return(0,L.jsxs)(`section`,{className:`dk`,"aria-labelledby":e,children:[(0,L.jsxs)(`header`,{className:`loop-head`,children:[(0,L.jsx)(`h2`,{id:e,className:`disp loop-title up-title`,children:`DOCKING`}),(0,L.jsx)(`button`,{type:`button`,ref:u,className:`btn`,"data-kind":`primary`,"aria-disabled":d||void 0,onClick:()=>!d&&i(`code`),children:`Make a code`}),(0,L.jsx)(`button`,{type:`button`,className:`btn`,"aria-disabled":d||void 0,onClick:()=>!d&&i(`pair`),children:`Pair`})]}),t.station!==``&&(0,L.jsxs)(`p`,{className:`dk-station`,children:[`This station is `,(0,L.jsx)(`strong`,{children:t.station}),`. Its agents are written to as name@`,t.station,`. Dock only with people you trust: their agents can reach yours.`]}),r!==null&&(0,L.jsx)(Ms,{mode:r,onDone:()=>f(()=>i(null)),onMade:o,onNotice:c},r),a!==null&&(0,L.jsx)(Ns,{made:a,now:n,onDone:()=>f(()=>o(null)),onNotice:c}),(0,L.jsx)(`div`,{className:`win-list module`,children:t.docks.length===0?(0,L.jsx)(`p`,{className:`loop-empty`,children:`No station is docked. Docking connects this station to another gonogo so that their agents can message each other and hand off tasks. One side makes a code and the other pairs with it.`}):(0,L.jsx)(`ul`,{className:`win-rows`,children:t.docks.map(e=>(0,L.jsx)(Ps,{dock:e,now:n,onNotice:c},e.id))})}),(0,L.jsx)(`p`,{className:`hint up-notice`,role:`status`,children:s})]})}function Is({task:e,willMove:t,onNotice:n,onClose:r}){let i=(0,l.useId)(),a=N(e=>e.docking.docks),[o,s]=(0,l.useState)(a[0]?.id??``),[c,u]=(0,l.useState)(``),{busy:d,error:f,run:p}=To(),m=(0,l.useRef)(null);(0,l.useEffect)(()=>m.current?.focus(),[]);let h=a.find(e=>e.id===o)??a[0];return h===void 0?(0,L.jsxs)(`p`,{className:`hint`,role:`status`,children:[`No station is docked any more.`,` `,(0,L.jsx)(`button`,{type:`button`,className:`btn`,"data-kind":`quiet`,onClick:r,children:`Close`})]}):(0,L.jsxs)(`form`,{className:`dk-handoff`,"aria-label":`Hand off ${e.id}`,onSubmit:r=>{r.preventDefault(),p(async()=>{t({id:e.id,status:`done`});try{await rr(h.id,ks(e,c)),n(`${e.id} handed off to ${c===``?``:`${c}@`}${h.name}`)}catch(e){throw t(null),e}})},onKeyDown:e=>{e.key===`Escape`&&!e.nativeEvent.isComposing&&r()},children:[a.length>1&&(0,L.jsxs)(`div`,{className:`field`,children:[(0,L.jsx)(`label`,{htmlFor:`${i}-station`,children:`Station`}),(0,L.jsx)(`select`,{id:`${i}-station`,ref:m,className:`input`,value:h.id,onChange:e=>{s(e.target.value),u(``)},children:a.map(e=>(0,L.jsx)(`option`,{value:e.id,children:e.name},e.id))})]}),(0,L.jsxs)(`div`,{className:`field`,children:[(0,L.jsx)(`label`,{htmlFor:`${i}-agent`,children:`Hand off to ${h.name}`}),(0,L.jsx)(`select`,{id:`${i}-agent`,ref:a.length>1?void 0:m,className:`input`,value:c,onChange:e=>u(e.target.value),children:Ds(h).map(e=>(0,L.jsx)(`option`,{value:e.value,children:e.label},e.value))})]}),(0,L.jsx)(`button`,{type:`submit`,className:`btn`,"data-kind":`primary`,"aria-disabled":d||void 0,children:d?`Handing off…`:`Hand off`}),(0,L.jsx)(`button`,{type:`button`,className:`btn`,"data-kind":`quiet`,onClick:r,children:`Cancel`}),(0,L.jsx)(`p`,{className:`hint dk-hint`,children:`Copies the task to that station’s board and marks it done here.`}),f!==null&&(0,L.jsx)(`p`,{className:`error`,role:`alert`,children:f})]})}var Ls=[{status:`todo`,label:`TODO`},{status:`doing`,label:`DOING`},{status:`review`,label:`REVIEW`},{status:`blocked`,label:`BLOCKED`},{status:`done`,label:`DONE`}],Rs=e=>Ls.find(t=>t.status===e)?.label??e.toUpperCase();function zs(e){let t={todo:[],doing:[],review:[],blocked:[],done:[]};for(let n of e)t[n.status].push(n);return t.done.sort((e,t)=>t.updatedAt-e.updatedAt),t}function Bs(e){let t=0,n=0;for(let r of e)r.status===`doing`?t+=1:r.status===`blocked`&&(n+=1);return{doing:t,blocked:n}}function Vs({doing:e,blocked:t}){return[e>0?`${e} doing`:``,t>0?`${t} blocked`:``].filter(Boolean).join(`, `)}var Hs=(e,t)=>e.assignee===null?`UNASSIGNED`:R(e.assignee,t);function Us(e,t){if(e.assignee===null)return{kind:void 0,on:!1,blink:!1};let n=Object.hasOwn(t,e.assignee)?t[e.assignee]:void 0,r=n===void 0?`stopped`:Pa(n);return{kind:r,...Fa(r)}}function Ws(e,t,n){let r=[{value:``,label:`Nobody`}];for(let n of e)_(n.provider).mcp&&r.push({value:n.name,label:R(n.name,t)});return n!==null&&!r.some(e=>e.value===n)&&r.push({value:n,label:`${n} (${Object.hasOwn(t,n)?`cannot read mail`:`not in the room`})`}),r}var Gs=[`title`,`detail`,`assignee`],Ks=()=>({title:``,detail:``,assignee:``});function qs(e){let t={},n=e.title.trim();return n===``?t.title=`Give it a title.`:n.length>200?t.title=`At most 200 characters.`:n.includes(`
|
|
14
|
-
`)&&(t.title=`One line.`),e.detail.length>4e3&&(t.detail=`At most ${T} characters.`),t}var Js=e=>({title:e.title.trim(),detail:e.detail.trim(),assignee:e.assignee===``?null:e.assignee}),Ys=e=>`plan-card-${e}`,Xs=e=>_(e.provider).mcp,Zs=e=>e.state!==`stopped`&&e.transition===null;function Qs(e){return e<1024?`${e} B`:e<1048576?`${(e/1024).toFixed(1)} KB`:`${(e/1024/1024).toFixed(1)} MB`}function $s(e){return e.exists?[e.lines===null?null:`${e.lines} ${e.lines===1?`line`:`lines`}`,Qs(e.bytes)].filter(Boolean).join(` · `):`not made yet`}function ec(e){return e.over?`Over the soft limit of ${e.softLines} lines or ${Qs(e.softBytes)}`:null}function tc(e,t){let n=e.backup;if(n===null)return null;let r=ra(n.at,t);return e.changedAt===null||e.changedAt<=n.at?`Asked at ${r}. The notes have not changed since.`:`Asked at ${r}. The notes changed since: ${Qs(n.bytes)} then, ${Qs(e.bytes)} now.`}function nc(e,t){return t.send.ok?`Asked ${e} to condense its notes. It reads the request when it is idle. ${t.memory.backup===null?`No copy was kept: memory.md.bak could not be written.`:`The old file is kept as memory.md.bak.`}`:`Not sent: ${t.send.note??`the hub did not deliver it`}.`}function rc({agent:e}){let t=Nt(),{busy:n,error:r,run:i}=To(),[a,o]=(0,l.useState)(null),[s,c]=(0,l.useState)(null),[u,d]=(0,l.useState)(``),f=Xs(e),p=Zs(e);if((0,l.useEffect)(()=>{if(!f)return;let t=!0;return Er(e.name).then(e=>{t&&(o(e),c(null))},e=>t&&c(e instanceof Error?e.message:String(e))),()=>{t=!1}},[f,e.name,e.generation,e.stateSince]),!f)return null;let m=a===null?null:ec(a),h=a===null?null:tc(a,t);return(0,L.jsxs)(`section`,{className:`mass`,"aria-label":`Memory file of this console`,children:[(0,L.jsxs)(`div`,{className:`mass-row`,children:[(0,L.jsx)(`h3`,{className:`label`,children:`MASS BUDGET`}),(0,L.jsxs)(`p`,{className:`mass-size`,children:[(0,L.jsx)(`code`,{children:`memory.md`}),` `,a===null?s===null?`reading…`:`unknown`:$s(a)]}),(0,L.jsx)(`button`,{type:`button`,className:`btn`,"data-kind":`quiet`,"aria-disabled":n||!p||a===null||!a.exists||void 0,onClick:()=>{!n&&p&&a!==null&&a.exists&&(d(``),i(async()=>{let t=await Dr(e.name);o(t.memory),d(nc(e.name,t))}))},children:`Reflect`})]}),m!==null&&(0,L.jsxs)(`p`,{className:`mass-over`,children:[m,`. Reflect asks `,e.name,` to condense it.`]}),h!==null&&(0,L.jsx)(`p`,{className:`hint`,children:h}),!p&&(0,L.jsx)(`p`,{className:`hint`,children:`Start the console to ask it.`}),(0,L.jsx)(`p`,{className:`hint mass-notice`,role:`status`,children:u}),(r??s)!==null&&(0,L.jsx)(`p`,{className:`error`,role:`alert`,children:r??s})]})}var ic=2,ac=1,oc=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,n=window.getComputedStyle(this._terminal.element.parentElement),r=parseInt(n.getPropertyValue(`height`)),i=Math.max(0,parseInt(n.getPropertyValue(`width`))),a=window.getComputedStyle(this._terminal.element),o={top:parseInt(a.getPropertyValue(`padding-top`)),bottom:parseInt(a.getPropertyValue(`padding-bottom`)),right:parseInt(a.getPropertyValue(`padding-right`)),left:parseInt(a.getPropertyValue(`padding-left`))},s=o.top+o.bottom,c=o.right+o.left,l=r-s,u=i-c-t;return{cols:Math.max(ic,Math.floor(u/e.css.cell.width)),rows:Math.max(ac,Math.floor(l/e.css.cell.height))}}},sc=Object.defineProperty,cc=Object.getOwnPropertyDescriptor,lc=(e,t)=>{for(var n in t)sc(e,n,{get:t[n],enumerable:!0})},uc=(e,t,n,r)=>{for(var i=r>1?void 0:r?cc(t,n):t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=(r?o(t,n,i):o(i))||i);return r&&i&&sc(t,n,i),i},V=(e,t)=>(n,r)=>t(n,r,e),dc=`Terminal input`,fc={get:()=>dc,set:e=>dc=e},pc=`Too much output to announce, navigate to rows manually to read`,mc={get:()=>pc,set:e=>pc=e};function hc(e){return e.replace(/\r?\n/g,`\r`)}function gc(e,t){return t?`\x1B[200~`+e+`\x1B[201~`:e}function _c(e,t){e.clipboardData&&e.clipboardData.setData(`text/plain`,t.selectionText),e.preventDefault()}function vc(e,t,n,r){e.stopPropagation(),e.clipboardData&&yc(e.clipboardData.getData(`text/plain`),t,n,r)}function yc(e,t,n,r){e=hc(e),e=gc(e,n.decPrivateModes.bracketedPasteMode&&r.rawOptions.ignoreBracketedPasteMode!==!0),n.triggerDataEvent(e,!0),t.value=``}function bc(e,t,n){let r=n.getBoundingClientRect(),i=e.clientX-r.left-10,a=e.clientY-r.top-10;t.style.width=`20px`,t.style.height=`20px`,t.style.left=`${i}px`,t.style.top=`${a}px`,t.style.zIndex=`1000`,t.focus()}function xc(e,t,n,r,i){bc(e,t,n),i&&r.rightClickSelect(e),t.value=r.selectionText,t.select()}function Sc(e){return e>65535?(e-=65536,String.fromCharCode((e>>10)+55296)+String.fromCharCode(e%1024+56320)):String.fromCharCode(e)}function Cc(e,t=0,n=e.length){let r=``;for(let i=t;i<n;++i){let t=e[i];t>65535?(t-=65536,r+=String.fromCharCode((t>>10)+55296)+String.fromCharCode(t%1024+56320)):r+=String.fromCharCode(t)}return r}var wc=class{constructor(){this._interim=0}clear(){this._interim=0}decode(e,t){let n=e.length;if(!n)return 0;let r=0,i=0;if(this._interim){let n=e.charCodeAt(i++);56320<=n&&n<=57343?t[r++]=(this._interim-55296)*1024+n-56320+65536:(t[r++]=this._interim,t[r++]=n),this._interim=0}for(let a=i;a<n;++a){let i=e.charCodeAt(a);if(55296<=i&&i<=56319){if(++a>=n)return this._interim=i,r;let o=e.charCodeAt(a);56320<=o&&o<=57343?t[r++]=(i-55296)*1024+o-56320+65536:(t[r++]=i,t[r++]=o)}else i!==65279&&(t[r++]=i)}return r}},Tc=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(e,t){let n=e.length;if(!n)return 0;let r=0,i,a,o,s,c=0,l=0;if(this.interim[0]){let i=!1,a=this.interim[0];a&=(a&224)==192?31:(a&240)==224?15:7;let o=0,s;for(;(s=this.interim[++o]&63)&&o<4;)a<<=6,a|=s;let c=(this.interim[0]&224)==192?2:(this.interim[0]&240)==224?3:4,u=c-o;for(;l<u;){if(l>=n)return 0;if(s=e[l++],(s&192)!=128){l--,i=!0;break}this.interim[o++]=s,a<<=6,a|=s&63}i||(c===2?a<128?l--:t[r++]=a:c===3?a<2048||a>=55296&&a<=57343||a===65279||(t[r++]=a):a<65536||a>1114111||(t[r++]=a)),this.interim.fill(0)}let u=n-4,d=l;for(;d<n;){for(;d<u&&!((i=e[d])&128)&&!((a=e[d+1])&128)&&!((o=e[d+2])&128)&&!((s=e[d+3])&128);)t[r++]=i,t[r++]=a,t[r++]=o,t[r++]=s,d+=4;if(i=e[d++],i<128)t[r++]=i;else if((i&224)==192){if(d>=n)return this.interim[0]=i,r;if(a=e[d++],(a&192)!=128||(c=(i&31)<<6|a&63,c<128)){d--;continue}t[r++]=c}else if((i&240)==224){if(d>=n)return this.interim[0]=i,r;if(a=e[d++],(a&192)!=128){d--;continue}if(d>=n)return this.interim[0]=i,this.interim[1]=a,r;if(o=e[d++],(o&192)!=128){d--;continue}if(c=(i&15)<<12|(a&63)<<6|o&63,c<2048||c>=55296&&c<=57343||c===65279)continue;t[r++]=c}else if((i&248)==240){if(d>=n)return this.interim[0]=i,r;if(a=e[d++],(a&192)!=128){d--;continue}if(d>=n)return this.interim[0]=i,this.interim[1]=a,r;if(o=e[d++],(o&192)!=128){d--;continue}if(d>=n)return this.interim[0]=i,this.interim[1]=a,this.interim[2]=o,r;if(s=e[d++],(s&192)!=128){d--;continue}if(c=(i&7)<<18|(a&63)<<12|(o&63)<<6|s&63,c<65536||c>1114111)continue;t[r++]=c}}return r}},Ec=``,Dc=` `,Oc=class e{constructor(){this.fg=0,this.bg=0,this.extended=new kc}static toColorRGB(e){return[e>>>16&255,e>>>8&255,e&255]}static fromColorRGB(e){return(e[0]&255)<<16|(e[1]&255)<<8|e[2]&255}clone(){let t=new e;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)}isBgDefault(){return!(this.bg&50331648)}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):this.isFgDefault()}getUnderlineStyle(){return this.fg&268435456?this.bg&268435456?this.extended.underlineStyle:1:0}getUnderlineVariantOffset(){return this.extended.underlineVariantOffset}},kc=class e{constructor(e=0,t=0){this._ext=0,this._urlId=0,this._ext=e,this._urlId=t}get ext(){return this._urlId?this._ext&-469762049|this.underlineStyle<<26:this._ext}set ext(e){this._ext=e}get underlineStyle(){return this._urlId?5:(this._ext&469762048)>>26}set underlineStyle(e){this._ext&=-469762049,this._ext|=e<<26&469762048}get underlineColor(){return this._ext&67108863}set underlineColor(e){this._ext&=-67108864,this._ext|=e&67108863}get urlId(){return this._urlId}set urlId(e){this._urlId=e}get underlineVariantOffset(){let e=(this._ext&3758096384)>>29;return e<0?e^4294967288:e}set underlineVariantOffset(e){this._ext&=536870911,this._ext|=e<<29&3758096384}clone(){return new e(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}},Ac=class e extends Oc{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new kc,this.combinedData=``}static fromCharData(t){let n=new e;return n.setFromCharData(t),n}isCombined(){return this.content&2097152}getWidth(){return this.content>>22}getChars(){return this.content&2097152?this.combinedData:this.content&2097151?Sc(this.content&2097151):``}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):this.content&2097151}setFromCharData(e){this.fg=e[0],this.bg=0;let t=!1;if(e[1].length>2)t=!0;else if(e[1].length===2){let n=e[1].charCodeAt(0);if(55296<=n&&n<=56319){let r=e[1].charCodeAt(1);56320<=r&&r<=57343?this.content=(n-55296)*1024+r-56320+65536|e[2]<<22:t=!0}else t=!0}else this.content=e[1].charCodeAt(0)|e[2]<<22;t&&(this.combinedData=e[1],this.content=2097152|e[2]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},jc=`di$target`,Mc=`di$dependencies`,Nc=new Map;function Pc(e){return e[Mc]||[]}function H(e){if(Nc.has(e))return Nc.get(e);let t=function(e,n,r){if(arguments.length!==3)throw Error(`@IServiceName-decorator can only be used to decorate a parameter`);Fc(t,e,r)};return t._id=e,Nc.set(e,t),t}function Fc(e,t,n){t[jc]===t?t[Mc].push({id:e,index:n}):(t[Mc]=[{id:e,index:n}],t[jc]=t)}var Ic=H(`BufferService`),Lc=H(`CoreMouseService`),Rc=H(`CoreService`),zc=H(`CharsetService`),Bc=H(`InstantiationService`),Vc=H(`LogService`),Hc=H(`OptionsService`),Uc=H(`OscLinkService`),Wc=H(`UnicodeService`),Gc=H(`DecorationService`),Kc=class{constructor(e,t,n){this._bufferService=e,this._optionsService=t,this._oscLinkService=n}provideLinks(e,t){let n=this._bufferService.buffer.lines.get(e-1);if(!n){t(void 0);return}let r=[],i=this._optionsService.rawOptions.linkHandler,a=new Ac,o=n.getTrimmedLength(),s=-1,c=-1,l=!1;for(let t=0;t<o;t++)if(c!==-1||n.hasContent(t)){if(n.loadCell(t,a),a.hasExtendedAttrs()&&a.extended.urlId){if(c===-1){c=t,s=a.extended.urlId;continue}l=a.extended.urlId!==s}else c!==-1&&(l=!0);if(l||c!==-1&&t===o-1){let n=this._oscLinkService.getLinkData(s)?.uri;if(n){let a={start:{x:c+1,y:e},end:{x:t+ +(!l&&t===o-1),y:e}},s=!1;if(!i?.allowNonHttpProtocols)try{let e=new URL(n);[`http:`,`https:`].includes(e.protocol)||(s=!0)}catch{s=!0}s||r.push({text:n,range:a,activate:(e,t)=>i?i.activate(e,t,a):qc(e,t),hover:(e,t)=>i?.hover?.(e,t,a),leave:(e,t)=>i?.leave?.(e,t,a)})}l=!1,a.hasExtendedAttrs()&&a.extended.urlId?(c=t,s=a.extended.urlId):(c=-1,s=-1)}}t(r)}};Kc=uc([V(0,Ic),V(1,Hc),V(2,Uc)],Kc);function qc(e,t){if(confirm(`Do you want to navigate to ${t}?
|
|
15
|
-
|
|
16
|
-
WARNING: This link could potentially be dangerous`)){let e=window.open();if(e){try{e.opener=null}catch{}e.location.href=t}else console.warn(`Opening link blocked as opener could not be cleared`)}}var Jc=H(`CharSizeService`),Yc=H(`CoreBrowserService`),Xc=H(`MouseService`),Zc=H(`RenderService`),Qc=H(`SelectionService`),$c=H(`CharacterJoinerService`),el=H(`ThemeService`),tl=H(`LinkProviderService`),nl=new class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?cl.isErrorNoTelemetry(e)?new cl(e.message+`
|
|
17
|
-
|
|
18
|
-
`+e.stack):Error(e.message+`
|
|
19
|
-
|
|
20
|
-
`+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)}};function rl(e){al(e)||nl.onUnexpectedError(e)}var il=`Canceled`;function al(e){return e instanceof ol||e instanceof Error&&e.name===il&&e.message===il}var ol=class extends Error{constructor(){super(il),this.name=this.message}};function sl(e){return Error(e?`Illegal argument: ${e}`:`Illegal argument`)}var cl=class e extends Error{constructor(e){super(e),this.name=`CodeExpectedError`}static fromError(t){if(t instanceof e)return t;let n=new e;return n.message=t.message,n.stack=t.stack,n}static isErrorNoTelemetry(e){return e.name===`CodeExpectedError`}},ll=class e extends Error{constructor(t){super(t||`An unexpected bug occurred.`),Object.setPrototypeOf(this,e.prototype)}};function ul(e,t=0){return e[e.length-(1+t)]}var dl;(e=>{function t(e){return e<0}e.isLessThan=t;function n(e){return e<=0}e.isLessThanOrEqual=n;function r(e){return e>0}e.isGreaterThan=r;function i(e){return e===0}e.isNeitherLessOrGreaterThan=i,e.greaterThan=1,e.lessThan=-1,e.neitherLessOrGreaterThan=0})(dl||={});var fl=class e{constructor(e){this.iterate=e}forEach(e){this.iterate(t=>(e(t),!0))}toArray(){let e=[];return this.iterate(t=>(e.push(t),!0)),e}filter(t){return new e(e=>this.iterate(n=>!t(n)||e(n)))}map(t){return new e(e=>this.iterate(n=>e(t(n))))}some(e){let t=!1;return this.iterate(n=>(t=e(n),!t)),t}findFirst(e){let t;return this.iterate(n=>!e(n)||(t=n,!1)),t}findLast(e){let t;return this.iterate(n=>(e(n)&&(t=n),!0)),t}findLastMaxBy(e){let t,n=!0;return this.iterate(r=>((n||dl.isGreaterThan(e(r,t)))&&(n=!1,t=r),!0)),t}};fl.empty=new fl(e=>{});function pl(e,t){let n=this,r=!1,i;return function(){if(r)return i;if(r=!0,t)try{i=e.apply(n,arguments)}finally{t()}else i=e.apply(n,arguments);return i}}var ml;(e=>{function t(e){return e&&typeof e==`object`&&typeof e[Symbol.iterator]==`function`}e.is=t;let n=Object.freeze([]);function r(){return n}e.empty=r;function*i(e){yield e}e.single=i;function a(e){return t(e)?e:i(e)}e.wrap=a;function o(e){return e||n}e.from=o;function*s(e){for(let t=e.length-1;t>=0;t--)yield e[t]}e.reverse=s;function c(e){return!e||e[Symbol.iterator]().next().done===!0}e.isEmpty=c;function l(e){return e[Symbol.iterator]().next().value}e.first=l;function u(e,t){let n=0;for(let r of e)if(t(r,n++))return!0;return!1}e.some=u;function d(e,t){for(let n of e)if(t(n))return n}e.find=d;function*f(e,t){for(let n of e)t(n)&&(yield n)}e.filter=f;function*p(e,t){let n=0;for(let r of e)yield t(r,n++)}e.map=p;function*m(e,t){let n=0;for(let r of e)yield*t(r,n++)}e.flatMap=m;function*h(...e){for(let t of e)yield*t}e.concat=h;function g(e,t,n){let r=n;for(let n of e)r=t(r,n);return r}e.reduce=g;function*_(e,t,n=e.length){for(t<0&&(t+=e.length),n<0?n+=e.length:n>e.length&&(n=e.length);t<n;t++)yield e[t]}e.slice=_;function v(t,n=1/0){let r=[];if(n===0)return[r,t];let i=t[Symbol.iterator]();for(let t=0;t<n;t++){let t=i.next();if(t.done)return[r,e.empty()];r.push(t.value)}return[r,{[Symbol.iterator](){return i}}]}e.consume=v;async function y(e){let t=[];for await(let n of e)t.push(n);return Promise.resolve(t)}e.asyncToArray=y})(ml||={});var hl=null;function gl(e){return hl?.trackDisposable(e),e}function _l(e){hl?.markAsDisposed(e)}function vl(e,t){hl?.setParent(e,t)}function yl(e){return hl?.markAsSingleton(e),e}function bl(e){if(ml.is(e)){let t=[];for(let n of e)if(n)try{n.dispose()}catch(e){t.push(e)}if(t.length===1)throw t[0];if(t.length>1)throw AggregateError(t,`Encountered errors while disposing of store`);return Array.isArray(e)?[]:e}if(e)return e.dispose(),e}function xl(...e){return Sl(()=>bl(e))}function Sl(e){let t=gl({dispose:pl(()=>{_l(t),e()})});return t}var Cl=class e{constructor(){this._toDispose=new Set,this._isDisposed=!1,gl(this)}dispose(){this._isDisposed||(_l(this),this._isDisposed=!0,this.clear())}get isDisposed(){return this._isDisposed}clear(){if(this._toDispose.size!==0)try{bl(this._toDispose)}finally{this._toDispose.clear()}}add(t){if(!t)return t;if(t===this)throw Error(`Cannot register a disposable on itself!`);return vl(t,this),this._isDisposed?e.DISABLE_DISPOSED_WARNING||console.warn(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(e){if(e){if(e===this)throw Error(`Cannot dispose a disposable on itself!`);this._toDispose.delete(e),e.dispose()}}deleteAndLeak(e){e&&this._toDispose.has(e)&&(this._toDispose.delete(e),vl(e,null))}};Cl.DISABLE_DISPOSED_WARNING=!1;var wl=Cl,U=class{constructor(){this._store=new wl,gl(this),vl(this._store,this)}dispose(){_l(this),this._store.dispose()}_register(e){if(e===this)throw Error(`Cannot register a disposable on itself!`);return this._store.add(e)}};U.None=Object.freeze({dispose(){}});var Tl=class{constructor(){this._isDisposed=!1,gl(this)}get value(){return this._isDisposed?void 0:this._value}set value(e){this._isDisposed||e===this._value||(this._value?.dispose(),e&&vl(e,this),this._value=e)}clear(){this.value=void 0}dispose(){this._isDisposed=!0,_l(this),this._value?.dispose(),this._value=void 0}clearAndLeak(){let e=this._value;return this._value=void 0,e&&vl(e,null),e}},El=typeof window==`object`?window:globalThis,Dl=class e{constructor(t){this.element=t,this.next=e.Undefined,this.prev=e.Undefined}};Dl.Undefined=new Dl(void 0);var Ol=Dl,kl=class{constructor(){this._first=Ol.Undefined,this._last=Ol.Undefined,this._size=0}get size(){return this._size}isEmpty(){return this._first===Ol.Undefined}clear(){let e=this._first;for(;e!==Ol.Undefined;){let t=e.next;e.prev=Ol.Undefined,e.next=Ol.Undefined,e=t}this._first=Ol.Undefined,this._last=Ol.Undefined,this._size=0}unshift(e){return this._insert(e,!1)}push(e){return this._insert(e,!0)}_insert(e,t){let n=new Ol(e);if(this._first===Ol.Undefined)this._first=n,this._last=n;else if(t){let e=this._last;this._last=n,n.prev=e,e.next=n}else{let e=this._first;this._first=n,n.next=e,e.prev=n}this._size+=1;let r=!1;return()=>{r||(r=!0,this._remove(n))}}shift(){if(this._first!==Ol.Undefined){let e=this._first.element;return this._remove(this._first),e}}pop(){if(this._last!==Ol.Undefined){let e=this._last.element;return this._remove(this._last),e}}_remove(e){if(e.prev!==Ol.Undefined&&e.next!==Ol.Undefined){let t=e.prev;t.next=e.next,e.next.prev=t}else e.prev===Ol.Undefined&&e.next===Ol.Undefined?(this._first=Ol.Undefined,this._last=Ol.Undefined):e.next===Ol.Undefined?(this._last=this._last.prev,this._last.next=Ol.Undefined):e.prev===Ol.Undefined&&(this._first=this._first.next,this._first.prev=Ol.Undefined);--this._size}*[Symbol.iterator](){let e=this._first;for(;e!==Ol.Undefined;)yield e.element,e=e.next}},Al=globalThis.performance&&typeof globalThis.performance.now==`function`,jl=class e{static create(t){return new e(t)}constructor(e){this._now=Al&&e===!1?Date.now:globalThis.performance.now.bind(globalThis.performance),this._startTime=this._now(),this._stopTime=-1}stop(){this._stopTime=this._now()}reset(){this._startTime=this._now(),this._stopTime=-1}elapsed(){return this._stopTime===-1?this._now()-this._startTime:this._stopTime-this._startTime}},Ml;(e=>{e.None=()=>U.None;function t(e,t){return d(e,()=>{},0,void 0,!0,void 0,t)}e.defer=t;function n(e){return(t,n=null,r)=>{let i=!1,a;return a=e(e=>{if(!i)return a?a.dispose():i=!0,t.call(n,e)},null,r),i&&a.dispose(),a}}e.once=n;function r(e,t,n){return l((n,r=null,i)=>e(e=>n.call(r,t(e)),null,i),n)}e.map=r;function i(e,t,n){return l((n,r=null,i)=>e(e=>{t(e),n.call(r,e)},null,i),n)}e.forEach=i;function a(e,t,n){return l((n,r=null,i)=>e(e=>t(e)&&n.call(r,e),null,i),n)}e.filter=a;function o(e){return e}e.signal=o;function s(...e){return(t,n=null,r)=>u(xl(...e.map(e=>e(e=>t.call(n,e)))),r)}e.any=s;function c(e,t,n,i){let a=n;return r(e,e=>(a=t(a,e),a),i)}e.reduce=c;function l(e,t){let n,r=new W({onWillAddFirstListener(){n=e(r.fire,r)},onDidRemoveLastListener(){n?.dispose()}});return t?.add(r),r.event}function u(e,t){return t instanceof Array?t.push(e):t&&t.add(e),e}function d(e,t,n=100,r=!1,i=!1,a,o){let s,c,l,u=0,d,f=new W({leakWarningThreshold:a,onWillAddFirstListener(){s=e(e=>{u++,c=t(c,e),r&&!l&&(f.fire(c),c=void 0),d=()=>{let e=c;c=void 0,l=void 0,(!r||u>1)&&f.fire(e),u=0},typeof n==`number`?(clearTimeout(l),l=setTimeout(d,n)):l===void 0&&(l=0,queueMicrotask(d))})},onWillRemoveListener(){i&&u>0&&d?.()},onDidRemoveLastListener(){d=void 0,s.dispose()}});return o?.add(f),f.event}e.debounce=d;function f(t,n=0,r){return e.debounce(t,(e,t)=>e?(e.push(t),e):[t],n,void 0,!0,void 0,r)}e.accumulate=f;function p(e,t=(e,t)=>e===t,n){let r=!0,i;return a(e,e=>{let n=r||!t(e,i);return r=!1,i=e,n},n)}e.latch=p;function m(t,n,r){return[e.filter(t,n,r),e.filter(t,e=>!n(e),r)]}e.split=m;function h(e,t=!1,n=[],r){let i=n.slice(),a=e(e=>{i?i.push(e):s.fire(e)});r&&r.add(a);let o=()=>{i?.forEach(e=>s.fire(e)),i=null},s=new W({onWillAddFirstListener(){a||(a=e(e=>s.fire(e)),r&&r.add(a))},onDidAddFirstListener(){i&&(t?setTimeout(o):o())},onDidRemoveLastListener(){a&&a.dispose(),a=null}});return r&&r.add(s),s.event}e.buffer=h;function g(e,t){return(n,r,i)=>{let a=t(new v);return e(function(e){let t=a.evaluate(e);t!==_&&n.call(r,t)},void 0,i)}}e.chain=g;let _=Symbol(`HaltChainable`);class v{constructor(){this.steps=[]}map(e){return this.steps.push(e),this}forEach(e){return this.steps.push(t=>(e(t),t)),this}filter(e){return this.steps.push(t=>e(t)?t:_),this}reduce(e,t){let n=t;return this.steps.push(t=>(n=e(n,t),n)),this}latch(e=(e,t)=>e===t){let t=!0,n;return this.steps.push(r=>{let i=t||!e(r,n);return t=!1,n=r,i?r:_}),this}evaluate(e){for(let t of this.steps)if(e=t(e),e===_)break;return e}}function y(e,t,n=e=>e){let r=(...e)=>i.fire(n(...e)),i=new W({onWillAddFirstListener:()=>e.on(t,r),onDidRemoveLastListener:()=>e.removeListener(t,r)});return i.event}e.fromNodeEventEmitter=y;function b(e,t,n=e=>e){let r=(...e)=>i.fire(n(...e)),i=new W({onWillAddFirstListener:()=>e.addEventListener(t,r),onDidRemoveLastListener:()=>e.removeEventListener(t,r)});return i.event}e.fromDOMEventEmitter=b;function x(e){return new Promise(t=>n(e)(t))}e.toPromise=x;function S(e){let t=new W;return e.then(e=>{t.fire(e)},()=>{t.fire(void 0)}).finally(()=>{t.dispose()}),t.event}e.fromPromise=S;function C(e,t){return e(e=>t.fire(e))}e.forward=C;function ee(e,t,n){return t(n),e(e=>t(e))}e.runAndSubscribe=ee;class w{constructor(e,t){this._observable=e,this._counter=0,this._hasChanged=!1;let n={onWillAddFirstListener:()=>{e.addObserver(this)},onDidRemoveLastListener:()=>{e.removeObserver(this)}};this.emitter=new W(n),t&&t.add(this.emitter)}beginUpdate(e){this._counter++}handlePossibleChange(e){}handleChange(e,t){this._hasChanged=!0}endUpdate(e){this._counter--,this._counter===0&&(this._observable.reportChanges(),this._hasChanged&&(this._hasChanged=!1,this.emitter.fire(this._observable.get())))}}function T(e,t){return new w(e,t).emitter.event}e.fromObservable=T;function E(e){return(t,n,r)=>{let i=0,a=!1,o={beginUpdate(){i++},endUpdate(){i--,i===0&&(e.reportChanges(),a&&(a=!1,t.call(n)))},handlePossibleChange(){},handleChange(){a=!0}};e.addObserver(o),e.reportChanges();let s={dispose(){e.removeObserver(o)}};return r instanceof wl?r.add(s):Array.isArray(r)&&r.push(s),s}}e.fromObservableLight=E})(Ml||={});var Nl=class e{constructor(t){this.listenerCount=0,this.invocationCount=0,this.elapsedOverall=0,this.durations=[],this.name=`${t}_${e._idPool++}`,e.all.add(this)}start(e){this._stopWatch=new jl,this.listenerCount=e}stop(){if(this._stopWatch){let e=this._stopWatch.elapsed();this.durations.push(e),this.elapsedOverall+=e,this.invocationCount+=1,this._stopWatch=void 0}}};Nl.all=new Set,Nl._idPool=0;var Pl=Nl,Fl=-1,Il=class e{constructor(t,n,r=(e._idPool++).toString(16).padStart(3,`0`)){this._errorHandler=t,this.threshold=n,this.name=r,this._warnCountdown=0}dispose(){this._stacks?.clear()}check(e,t){let n=this.threshold;if(n<=0||t<n)return;this._stacks||=new Map;let r=this._stacks.get(e.value)||0;if(this._stacks.set(e.value,r+1),--this._warnCountdown,this._warnCountdown<=0){this._warnCountdown=n*.5;let[e,r]=this.getMostFrequentStack(),i=`[${this.name}] potential listener LEAK detected, having ${t} listeners already. MOST frequent listener (${r}):`;console.warn(i),console.warn(e);let a=new zl(i,e);this._errorHandler(a)}return()=>{let t=this._stacks.get(e.value)||0;this._stacks.set(e.value,t-1)}}getMostFrequentStack(){if(!this._stacks)return;let e,t=0;for(let[n,r]of this._stacks)(!e||t<r)&&(e=[n,r],t=r);return e}};Il._idPool=1;var Ll=Il,Rl=class e{constructor(e){this.value=e}static create(){return new e(Error().stack??``)}print(){console.warn(this.value.split(`
|
|
21
|
-
`).slice(2).join(`
|
|
22
|
-
`))}},zl=class extends Error{constructor(e,t){super(e),this.name=`ListenerLeakError`,this.stack=t}},Bl=class extends Error{constructor(e,t){super(e),this.name=`ListenerRefusalError`,this.stack=t}},Vl=0,Hl=class{constructor(e){this.value=e,this.id=Vl++}},Ul=2,W=class{constructor(e){this._size=0,this._options=e,this._leakageMon=Fl>0||this._options?.leakWarningThreshold?new Ll(e?.onListenerError??rl,this._options?.leakWarningThreshold??Fl):void 0,this._perfMon=this._options?._profName?new Pl(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,n)=>{if(this._leakageMon&&this._size>this._leakageMon.threshold**2){let e=`[${this._leakageMon.name}] REFUSES to accept new listeners because it exceeded its threshold by far (${this._size} vs ${this._leakageMon.threshold})`;console.warn(e);let t=this._leakageMon.getMostFrequentStack()??[`UNKNOWN stack`,-1],n=new Bl(`${e}. HINT: Stack shows most frequent listener (${t[1]}-times)`,t[0]);return(this._options?.onListenerError||rl)(n),U.None}if(this._disposed)return U.None;t&&(e=e.bind(t));let r=new Hl(e),i;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(r.stack=Rl.create(),i=this._leakageMon.check(r.stack,this._size+1)),this._listeners?this._listeners instanceof Hl?(this._deliveryQueue??=new Wl,this._listeners=[this._listeners,r]):this._listeners.push(r):(this._options?.onWillAddFirstListener?.(this),this._listeners=r,this._options?.onDidAddFirstListener?.(this)),this._size++;let a=Sl(()=>{i?.(),this._removeListener(r)});return n instanceof wl?n.add(a):Array.isArray(n)&&n.push(a),a},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,n=t.indexOf(e);if(n===-1)throw console.log(`disposed?`,this._disposed),console.log(`size?`,this._size),console.log(`arr?`,JSON.stringify(this._listeners)),Error(`Attempted to dispose unknown listener`);this._size--,t[n]=void 0;let r=this._deliveryQueue.current===this;if(this._size*Ul<=t.length){let e=0;for(let n=0;n<t.length;n++)t[n]?t[e++]=t[n]:r&&(this._deliveryQueue.end--,e<this._deliveryQueue.i&&this._deliveryQueue.i--);t.length=e}}_deliver(e,t){if(!e)return;let n=this._options?.onListenerError||rl;if(!n)e.value(t);else try{e.value(t)}catch(e){n(e)}}_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 Hl)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}},Wl=class{constructor(){this.i=-1,this.end=0}enqueue(e,t,n){this.i=0,this.end=n,this.current=e,this.value=t}reset(){this.i=this.end,this.current=void 0,this.value=void 0}},Gl=class{constructor(){this.mapWindowIdToZoomLevel=new Map,this._onDidChangeZoomLevel=new W,this.onDidChangeZoomLevel=this._onDidChangeZoomLevel.event,this.mapWindowIdToZoomFactor=new Map,this._onDidChangeFullscreen=new W,this.onDidChangeFullscreen=this._onDidChangeFullscreen.event,this.mapWindowIdToFullScreen=new Map}getZoomLevel(e){return this.mapWindowIdToZoomLevel.get(this.getWindowId(e))??0}setZoomLevel(e,t){if(this.getZoomLevel(t)===e)return;let n=this.getWindowId(t);this.mapWindowIdToZoomLevel.set(n,e),this._onDidChangeZoomLevel.fire(n)}getZoomFactor(e){return this.mapWindowIdToZoomFactor.get(this.getWindowId(e))??1}setZoomFactor(e,t){this.mapWindowIdToZoomFactor.set(this.getWindowId(t),e)}setFullscreen(e,t){if(this.isFullscreen(t)===e)return;let n=this.getWindowId(t);this.mapWindowIdToFullScreen.set(n,e),this._onDidChangeFullscreen.fire(n)}isFullscreen(e){return!!this.mapWindowIdToFullScreen.get(this.getWindowId(e))}getWindowId(e){return e.vscodeWindowId}};Gl.INSTANCE=new Gl;var Kl=Gl;function ql(e,t,n){typeof t==`string`&&(t=e.matchMedia(t)),t.addEventListener(`change`,n)}Kl.INSTANCE.onDidChangeZoomLevel;function Jl(e){return Kl.INSTANCE.getZoomFactor(e)}Kl.INSTANCE.onDidChangeFullscreen;var Yl=typeof navigator==`object`?navigator.userAgent:``,Xl=Yl.indexOf(`Firefox`)>=0,Zl=Yl.indexOf(`AppleWebKit`)>=0,Ql=Yl.indexOf(`Chrome`)>=0,$l=!Ql&&Yl.indexOf(`Safari`)>=0;Yl.indexOf(`Electron/`),Yl.indexOf(`Android`);var eu=!1;if(typeof El.matchMedia==`function`){let e=El.matchMedia(`(display-mode: standalone) or (display-mode: window-controls-overlay)`),t=El.matchMedia(`(display-mode: fullscreen)`);eu=e.matches,ql(El,e,({matches:e})=>{eu&&t.matches||(eu=e)})}function tu(){return eu}var nu=`en`,ru=!1,iu=!1,G=!1,au=!1,ou=!1,su=nu,cu,lu=globalThis,uu;typeof lu.vscode<`u`&&typeof lu.vscode.process<`u`?uu=lu.vscode.process:typeof process<`u`&&typeof process?.versions?.node==`string`&&(uu=process);var du=typeof uu?.versions?.electron==`string`&&uu?.type===`renderer`;if(typeof uu==`object`){ru=uu.platform===`win32`,iu=uu.platform===`darwin`,G=uu.platform===`linux`,G&&uu.env.SNAP&&uu.env.SNAP_REVISION,uu.env.CI||uu.env.BUILD_ARTIFACTSTAGINGDIRECTORY,su=nu;let e=uu.env.VSCODE_NLS_CONFIG;if(e)try{let t=JSON.parse(e);t.userLocale,t.osLocale,su=t.resolvedLanguage||nu,t.languagePack?.translationsConfigFile}catch{}au=!0}else typeof navigator==`object`&&!du?(cu=navigator.userAgent,ru=cu.indexOf(`Windows`)>=0,iu=cu.indexOf(`Macintosh`)>=0,(cu.indexOf(`Macintosh`)>=0||cu.indexOf(`iPad`)>=0||cu.indexOf(`iPhone`)>=0)&&navigator.maxTouchPoints&&navigator.maxTouchPoints,G=cu.indexOf(`Linux`)>=0,cu?.indexOf(`Mobi`),ou=!0,su=globalThis._VSCODE_NLS_LANGUAGE||nu,navigator.language.toLowerCase()):console.error(`Unable to resolve platform.`);var fu=ru,pu=iu,mu=G,hu=au;ou&&typeof lu.importScripts==`function`&&lu.origin;var gu=cu,_u=su,vu;(e=>{function t(){return _u}e.value=t;function n(){return _u.length===2?_u===`en`:_u.length>=3&&_u[0]===`e`&&_u[1]===`n`&&_u[2]===`-`}e.isDefaultVariant=n;function r(){return _u===`en`}e.isDefault=r})(vu||={});var yu=typeof lu.postMessage==`function`&&!lu.importScripts;(()=>{if(yu){let e=[];lu.addEventListener(`message`,t=>{if(t.data&&t.data.vscodeScheduleAsyncWork)for(let n=0,r=e.length;n<r;n++){let r=e[n];if(r.id===t.data.vscodeScheduleAsyncWork){e.splice(n,1),r.callback();return}}});let t=0;return n=>{let r=++t;e.push({id:r,callback:n}),lu.postMessage({vscodeScheduleAsyncWork:r},`*`)}}return e=>setTimeout(e)})();var bu=!!(gu&&gu.indexOf(`Chrome`)>=0);gu&&gu.indexOf(`Firefox`),!bu&&gu&&gu.indexOf(`Safari`),gu&&gu.indexOf(`Edg/`),gu&&gu.indexOf(`Android`);var xu=typeof navigator==`object`?navigator:{};hu||document.queryCommandSupported&&document.queryCommandSupported(`copy`)||xu&&xu.clipboard&&xu.clipboard.writeText,hu||xu&&xu.clipboard&&xu.clipboard.readText,hu||tu()||xu.keyboard,`ontouchstart`in El||xu.maxTouchPoints,El.PointerEvent&&(`ontouchstart`in El||navigator.maxTouchPoints);var Su=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}},Cu=new Su,wu=new Su,Tu=new Su,Eu=Array(230),Du;(e=>{function t(e){return Cu.keyCodeToStr(e)}e.toString=t;function n(e){return Cu.strToKeyCode(e)}e.fromString=n;function r(e){return wu.keyCodeToStr(e)}e.toUserSettingsUS=r;function i(e){return Tu.keyCodeToStr(e)}e.toUserSettingsGeneral=i;function a(e){return wu.strToKeyCode(e)||Tu.strToKeyCode(e)}e.fromUserSettings=a;function o(e){if(e>=98&&e<=113)return null;switch(e){case 16:return`Up`;case 18:return`Down`;case 15:return`Left`;case 17:return`Right`}return Cu.keyCodeToStr(e)}e.toElectronAccelerator=o})(Du||={});var Ou=class e{constructor(e,t,n,r,i){this.ctrlKey=e,this.shiftKey=t,this.altKey=n,this.metaKey=r,this.keyCode=i}equals(t){return t instanceof e&&this.ctrlKey===t.ctrlKey&&this.shiftKey===t.shiftKey&&this.altKey===t.altKey&&this.metaKey===t.metaKey&&this.keyCode===t.keyCode}getHashCode(){return`K${this.ctrlKey?`1`:`0`}${this.shiftKey?`1`:`0`}${this.altKey?`1`:`0`}${this.metaKey?`1`:`0`}${this.keyCode}`}isModifierKey(){return this.keyCode===0||this.keyCode===5||this.keyCode===57||this.keyCode===6||this.keyCode===4}toKeybinding(){return new ku([this])}isDuplicateModifierCase(){return this.ctrlKey&&this.keyCode===5||this.shiftKey&&this.keyCode===4||this.altKey&&this.keyCode===6||this.metaKey&&this.keyCode===57}},ku=class{constructor(e){if(e.length===0)throw sl(`chords`);this.chords=e}getHashCode(){let e=``;for(let t=0,n=this.chords.length;t<n;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 Au(e){if(e.charCode){let t=String.fromCharCode(e.charCode).toUpperCase();return Du.fromString(t)}let t=e.keyCode;if(t===3)return 7;if(Xl)switch(t){case 59:return 85;case 60:if(mu)return 97;break;case 61:return 86;case 107:return 109;case 109:return 111;case 173:return 88;case 224:if(pu)return 57}else if(Zl&&(pu&&t===93||!pu&&t===92))return 57;return Eu[t]||0}var ju=pu?256:2048,Mu=512,Nu=1024,Pu=pu?2048:256,Fu=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=Au(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|=ju),this.altKey&&(t|=Mu),this.shiftKey&&(t|=Nu),this.metaKey&&(t|=Pu),t|=e,t}_computeKeyCodeChord(){let e=0;return this.keyCode!==5&&this.keyCode!==4&&this.keyCode!==6&&this.keyCode!==57&&(e=this.keyCode),new Ou(this.ctrlKey,this.shiftKey,this.altKey,this.metaKey,e)}},Iu=new WeakMap;function Lu(e){if(!e.parent||e.parent===e)return null;try{let t=e.location,n=e.parent.location;if(t.origin!==`null`&&n.origin!==`null`&&t.origin!==n.origin)return null}catch{return null}return e.parent}var Ru=class{static getSameOriginWindowChain(e){let t=Iu.get(e);if(!t){t=[],Iu.set(e,t);let n=e,r;do r=Lu(n),r?t.push({window:new WeakRef(n),iframeElement:n.frameElement||null}):t.push({window:new WeakRef(n),iframeElement:null}),n=r;while(n)}return t.slice(0)}static getPositionOfChildWindowRelativeToAncestorWindow(e,t){if(!t||e===t)return{top:0,left:0};let n=0,r=0,i=this.getSameOriginWindowChain(e);for(let e of i){let i=e.window.deref();if(n+=i?.scrollY??0,r+=i?.scrollX??0,i===t||!e.iframeElement)break;let a=e.iframeElement.getBoundingClientRect();n+=a.top,r+=a.left}return{top:n,left:r}}},zu=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 n=Ru.getPositionOfChildWindowRelativeToAncestorWindow(e,t.view);this.posx-=n.left,this.posy-=n.top}preventDefault(){this.browserEvent.preventDefault()}stopPropagation(){this.browserEvent.stopPropagation()}},Bu=class{constructor(e,t=0,n=0){this.browserEvent=e||null,this.target=e?e.target||e.targetNode||e.srcElement:null,this.deltaY=n,this.deltaX=t;let r=!1;if(Ql){let e=navigator.userAgent.match(/Chrome\/(\d+)/);r=(e?parseInt(e[1]):123)<=122}if(e){let t=e,n=e,i=e.view?.devicePixelRatio||1;if(typeof t.wheelDeltaY<`u`)this.deltaY=r?t.wheelDeltaY/(120*i):t.wheelDeltaY/120;else if(typeof n.VERTICAL_AXIS<`u`&&n.axis===n.VERTICAL_AXIS)this.deltaY=-n.detail/3;else if(e.type===`wheel`){let t=e;this.deltaY=t.deltaMode===t.DOM_DELTA_LINE?Xl&&!pu?-e.deltaY/3:-e.deltaY:-e.deltaY/40}if(typeof t.wheelDeltaX<`u`)this.deltaX=$l&&fu?-(t.wheelDeltaX/120):r?t.wheelDeltaX/(120*i):t.wheelDeltaX/120;else if(typeof n.HORIZONTAL_AXIS<`u`&&n.axis===n.HORIZONTAL_AXIS)this.deltaX=-e.detail/3;else if(e.type===`wheel`){let t=e;this.deltaX=t.deltaMode===t.DOM_DELTA_LINE?Xl&&!pu?-e.deltaX/3:-e.deltaX:-e.deltaX/40}this.deltaY===0&&this.deltaX===0&&e.wheelDelta&&(this.deltaY=r?e.wheelDelta/(120*i):e.wheelDelta/120)}}preventDefault(){this.browserEvent?.preventDefault()}stopPropagation(){this.browserEvent?.stopPropagation()}},Vu=Object.freeze(function(e,t){let n=setTimeout(e.bind(t),0);return{dispose(){clearTimeout(n)}}}),Hu;(e=>{function t(t){return t===e.None||t===e.Cancelled||t instanceof Uu?!0:!t||typeof t!=`object`?!1:typeof t.isCancellationRequested==`boolean`&&typeof t.onCancellationRequested==`function`}e.isCancellationToken=t,e.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:Ml.None}),e.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:Vu})})(Hu||={});var Uu=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?Vu:(this._emitter||=new W,this._emitter.event)}dispose(){this._emitter&&=(this._emitter.dispose(),null)}},Wu=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 ll(`Calling 'cancelAndSet' on a disposed TimeoutTimer`);this.cancel(),this._token=setTimeout(()=>{this._token=-1,e()},t)}setIfNotSet(e,t){if(this._isDisposed)throw new ll(`Calling 'setIfNotSet' on a disposed TimeoutTimer`);this._token===-1&&(this._token=setTimeout(()=>{this._token=-1,e()},t))}},Gu=class{constructor(){this.disposable=void 0,this.isDisposed=!1}cancel(){this.disposable?.dispose(),this.disposable=void 0}cancelAndSet(e,t,n=globalThis){if(this.isDisposed)throw new ll(`Calling 'cancelAndSet' on a disposed IntervalTimer`);this.cancel();let r=n.setInterval(()=>{e()},t);this.disposable=Sl(()=>{n.clearInterval(r),this.disposable=void 0})}dispose(){this.cancel(),this.isDisposed=!0}};(function(){typeof globalThis.requestIdleCallback!=`function`||globalThis.cancelIdleCallback})();var Ku;(e=>{async function t(e){let t,n=await Promise.all(e.map(e=>e.then(e=>e,e=>{t||=e})));if(typeof t<`u`)throw t;return n}e.settled=t;function n(e){return new Promise(async(t,n)=>{try{await e(t,n)}catch(e){n(e)}})}e.withAsyncBody=n})(Ku||={});var qu=class e{static fromArray(t){return new e(e=>{e.emitMany(t)})}static fromPromise(t){return new e(async e=>{e.emitMany(await t)})}static fromPromises(t){return new e(async e=>{await Promise.all(t.map(async t=>e.emitOne(await t)))})}static merge(t){return new e(async e=>{await Promise.all(t.map(async t=>{for await(let n of t)e.emitOne(n)}))})}constructor(e,t){this._state=0,this._results=[],this._error=null,this._onReturn=t,this._onStateChanged=new W,queueMicrotask(async()=>{let t={emitOne:e=>this.emitOne(e),emitMany:e=>this.emitMany(e),reject:e=>this.reject(e)};try{await Promise.resolve(e(t)),this.resolve()}catch(e){this.reject(e)}finally{t.emitOne=void 0,t.emitMany=void 0,t.reject=void 0}})}[Symbol.asyncIterator](){let e=0;return{next:async()=>{do{if(this._state===2)throw this._error;if(e<this._results.length)return{done:!1,value:this._results[e++]};if(this._state===1)return{done:!0,value:void 0};await Ml.toPromise(this._onStateChanged.event)}while(1)},return:async()=>(this._onReturn?.(),{done:!0,value:void 0})}}static map(t,n){return new e(async e=>{for await(let r of t)e.emitOne(n(r))})}map(t){return e.map(this,t)}static filter(t,n){return new e(async e=>{for await(let r of t)n(r)&&e.emitOne(r)})}filter(t){return e.filter(this,t)}static coalesce(t){return e.filter(t,e=>!!e)}coalesce(){return e.coalesce(this)}static async toPromise(e){let t=[];for await(let n of e)t.push(n);return t}toPromise(){return e.toPromise(this)}emitOne(e){this._state===0&&(this._results.push(e),this._onStateChanged.fire())}emitMany(e){this._state===0&&(this._results=this._results.concat(e),this._onStateChanged.fire())}resolve(){this._state===0&&(this._state=1,this._onStateChanged.fire())}reject(e){this._state===0&&(this._state=2,this._error=e,this._onStateChanged.fire())}};qu.EMPTY=qu.fromArray([]);function Ju(e){return Yu(e,0)}function Yu(e,t){switch(typeof e){case`object`:return e===null?Xu(349,t):Array.isArray(e)?$u(e,t):K(e,t);case`string`:return Qu(e,t);case`boolean`:return Zu(e,t);case`number`:return Xu(e,t);case`undefined`:return Xu(937,t);default:return Xu(617,t)}}function Xu(e,t){return(t<<5)-t+e|0}function Zu(e,t){return Xu(e?433:863,t)}function Qu(e,t){t=Xu(149417,t);for(let n=0,r=e.length;n<r;n++)t=Xu(e.charCodeAt(n),t);return t}function $u(e,t){return t=Xu(104579,t),e.reduce((e,t)=>Yu(t,e),t)}function K(e,t){return t=Xu(181387,t),Object.keys(e).sort().reduce((t,n)=>(t=Qu(n,t),Yu(e[n],t)),t)}var{registerWindow:ed,getWindow:q,getDocument:J,getWindows:td,getWindowsCount:nd,getWindowId:rd,getWindowById:id,hasWindow:ad,onDidRegisterWindow:od,onWillUnregisterWindow:sd,onDidUnregisterWindow:cd}=function(){let e=new Map,t={window:El,disposables:new wl};e.set(El.vscodeWindowId,t);let n=new W,r=new W,i=new W;function a(n,r){return(typeof n==`number`?e.get(n):void 0)??(r?t:void 0)}return{onDidRegisterWindow:n.event,onWillUnregisterWindow:i.event,onDidUnregisterWindow:r.event,registerWindow(t){if(e.has(t.vscodeWindowId))return U.None;let a=new wl,o={window:t,disposables:a.add(new wl)};return e.set(t.vscodeWindowId,o),a.add(Sl(()=>{e.delete(t.vscodeWindowId),r.fire(t)})),a.add(Y(t,vd.BEFORE_UNLOAD,()=>{i.fire(t)})),n.fire(o),a},getWindows(){return e.values()},getWindowsCount(){return e.size},getWindowId(e){return e.vscodeWindowId},hasWindow(t){return e.has(t)},getWindowById:a,getWindow(e){let t=e;if(t?.ownerDocument?.defaultView)return t.ownerDocument.defaultView.window;let n=e;return n?.view?n.view.window:El},getDocument(e){return q(e).document}}}(),ld=class{constructor(e,t,n,r){this._node=e,this._type=t,this._handler=n,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,null)}};function Y(e,t,n,r){return new ld(e,t,n,r)}function ud(e,t){return function(n){return t(new zu(e,n))}}function dd(e){return function(t){return e(new Fu(t))}}var fd=function(e,t,n,r){let i=n;return t===`click`||t===`mousedown`||t===`contextmenu`?i=ud(q(e),n):(t===`keydown`||t===`keypress`||t===`keyup`)&&(i=dd(n)),Y(e,t,i,r)},pd,md=class extends Gu{constructor(e){super(),this.defaultTarget=e&&q(e)}cancelAndSet(e,t,n){return super.cancelAndSet(e,t,n??this.defaultTarget)}},hd=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){rl(e)}}static sort(e,t){return t.priority-e.priority}};(function(){let e=new Map,t=new Map,n=new Map,r=new Map,i=i=>{n.set(i,!1);let a=e.get(i)??[];for(t.set(i,a),e.set(i,[]),r.set(i,!0);a.length>0;)a.sort(hd.sort),a.shift().execute();r.set(i,!1)};pd=(t,r,a=0)=>{let o=rd(t),s=new hd(r,a),c=e.get(o);return c||(c=[],e.set(o,c)),c.push(s),n.get(o)||(n.set(o,!0),t.requestAnimationFrame(()=>i(o))),s}})();var gd=class e{constructor(e,t){this.width=e,this.height=t}with(t=this.width,n=this.height){return t!==this.width||n!==this.height?new e(t,n):this}static is(e){return typeof e==`object`&&typeof e.height==`number`&&typeof e.width==`number`}static lift(t){return t instanceof e?t:new e(t.width,t.height)}static equals(e,t){return e===t?!0:!e||!t?!1:e.width===t.width&&e.height===t.height}};gd.None=new gd(0,0);function _d(e){let t=e.getBoundingClientRect(),n=q(e);return{left:t.left+n.scrollX,top:t.top+n.scrollY,width:t.width,height:t.height}}new class{constructor(){this.mutationObservers=new Map}observe(e,t,n){let r=this.mutationObservers.get(e);r||(r=new Map,this.mutationObservers.set(e,r));let i=Ju(n),a=r.get(i);if(a)a.users+=1;else{let o=new W,s=new MutationObserver(e=>o.fire(e));s.observe(e,n);let c=a={users:1,observer:s,onDidMutate:o.event};t.add(Sl(()=>{--c.users,c.users===0&&(o.dispose(),s.disconnect(),r?.delete(i),r?.size===0&&this.mutationObservers.delete(e))})),r.set(i,a)}return a.onDidMutate}};var vd={CLICK:`click`,AUXCLICK:`auxclick`,DBLCLICK:`dblclick`,MOUSE_UP:`mouseup`,MOUSE_DOWN:`mousedown`,MOUSE_OVER:`mouseover`,MOUSE_MOVE:`mousemove`,MOUSE_OUT:`mouseout`,MOUSE_ENTER:`mouseenter`,MOUSE_LEAVE:`mouseleave`,MOUSE_WHEEL:`wheel`,POINTER_UP:`pointerup`,POINTER_DOWN:`pointerdown`,POINTER_MOVE:`pointermove`,POINTER_LEAVE:`pointerleave`,CONTEXT_MENU:`contextmenu`,WHEEL:`wheel`,KEY_DOWN:`keydown`,KEY_PRESS:`keypress`,KEY_UP:`keyup`,LOAD:`load`,BEFORE_UNLOAD:`beforeunload`,UNLOAD:`unload`,PAGE_SHOW:`pageshow`,PAGE_HIDE:`pagehide`,PASTE:`paste`,ABORT:`abort`,ERROR:`error`,RESIZE:`resize`,SCROLL:`scroll`,FULLSCREEN_CHANGE:`fullscreenchange`,WK_FULLSCREEN_CHANGE:`webkitfullscreenchange`,SELECT:`select`,CHANGE:`change`,SUBMIT:`submit`,RESET:`reset`,FOCUS:`focus`,FOCUS_IN:`focusin`,FOCUS_OUT:`focusout`,BLUR:`blur`,INPUT:`input`,STORAGE:`storage`,DRAG_START:`dragstart`,DRAG:`drag`,DRAG_ENTER:`dragenter`,DRAG_LEAVE:`dragleave`,DRAG_OVER:`dragover`,DROP:`drop`,DRAG_END:`dragend`,ANIMATION_START:Zl?`webkitAnimationStart`:`animationstart`,ANIMATION_END:Zl?`webkitAnimationEnd`:`animationend`,ANIMATION_ITERATION:Zl?`webkitAnimationIteration`:`animationiteration`},yd=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=X(e);this._maxWidth!==t&&(this._maxWidth=t,this.domNode.style.maxWidth=this._maxWidth)}setWidth(e){let t=X(e);this._width!==t&&(this._width=t,this.domNode.style.width=this._width)}setHeight(e){let t=X(e);this._height!==t&&(this._height=t,this.domNode.style.height=this._height)}setTop(e){let t=X(e);this._top!==t&&(this._top=t,this.domNode.style.top=this._top)}setLeft(e){let t=X(e);this._left!==t&&(this._left=t,this.domNode.style.left=this._left)}setBottom(e){let t=X(e);this._bottom!==t&&(this._bottom=t,this.domNode.style.bottom=this._bottom)}setRight(e){let t=X(e);this._right!==t&&(this._right=t,this.domNode.style.right=this._right)}setPaddingTop(e){let t=X(e);this._paddingTop!==t&&(this._paddingTop=t,this.domNode.style.paddingTop=this._paddingTop)}setPaddingLeft(e){let t=X(e);this._paddingLeft!==t&&(this._paddingLeft=t,this.domNode.style.paddingLeft=this._paddingLeft)}setPaddingBottom(e){let t=X(e);this._paddingBottom!==t&&(this._paddingBottom=t,this.domNode.style.paddingBottom=this._paddingBottom)}setPaddingRight(e){let t=X(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=X(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=X(e);this._lineHeight!==t&&(this._lineHeight=t,this.domNode.style.lineHeight=this._lineHeight)}setLetterSpacing(e){let t=X(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 X(e){return typeof e==`number`?`${e}px`:e}function bd(e){return new yd(e)}var xd=class{constructor(){this._hooks=new wl,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 n=this._onStopCallback;this._onStopCallback=null,e&&n&&n(t)}isMonitoring(){return!!this._pointerMoveCallback}startMonitoring(e,t,n,r,i){this.isMonitoring()&&this.stopMonitoring(!1),this._pointerMoveCallback=r,this._onStopCallback=i;let a=e;try{e.setPointerCapture(t),this._hooks.add(Sl(()=>{try{e.releasePointerCapture(t)}catch{}}))}catch{a=q(e)}this._hooks.add(Y(a,vd.POINTER_MOVE,e=>{e.buttons===n?(e.preventDefault(),this._pointerMoveCallback(e)):this.stopMonitoring(!0)})),this._hooks.add(Y(a,vd.POINTER_UP,e=>this.stopMonitoring(!0)))}};function Sd(e,t,n){let r=null,i=null;if(typeof n.value==`function`?(r=`value`,i=n.value,i.length!==0&&console.warn(`Memoize should only be used in functions with zero parameters`)):typeof n.get==`function`&&(r=`get`,i=n.get),!i)throw Error(`not supported`);let a=`$memoize$${t}`;n[r]=function(...e){return this.hasOwnProperty(a)||Object.defineProperty(this,a,{configurable:!1,enumerable:!1,writable:!1,value:i.apply(this,e)}),this[a]}}var Cd;(e=>(e.Tap=`-xterm-gesturetap`,e.Change=`-xterm-gesturechange`,e.Start=`-xterm-gesturestart`,e.End=`-xterm-gesturesend`,e.Contextmenu=`-xterm-gesturecontextmenu`))(Cd||={});var wd=class e extends U{constructor(){super(),this.dispatched=!1,this.targets=new kl,this.ignoreTargets=new kl,this.activeTouches={},this.handle=null,this._lastSetTapCountTime=0,this._register(Ml.runAndSubscribe(od,({window:e,disposables:t})=>{t.add(Y(e.document,`touchstart`,e=>this.onTouchStart(e),{passive:!1})),t.add(Y(e.document,`touchend`,t=>this.onTouchEnd(e,t))),t.add(Y(e.document,`touchmove`,e=>this.onTouchMove(e),{passive:!1}))},{window:El,disposables:this._store}))}static addTarget(t){return e.isTouchDevice()?(e.INSTANCE||=yl(new e),Sl(e.INSTANCE.targets.push(t))):U.None}static ignoreTarget(t){return e.isTouchDevice()?(e.INSTANCE||=yl(new e),Sl(e.INSTANCE.ignoreTargets.push(t))):U.None}static isTouchDevice(){return`ontouchstart`in El||navigator.maxTouchPoints>0}dispose(){this.handle&&=(this.handle.dispose(),null),super.dispose()}onTouchStart(e){let t=Date.now();this.handle&&=(this.handle.dispose(),null);for(let n=0,r=e.targetTouches.length;n<r;n++){let r=e.targetTouches.item(n);this.activeTouches[r.identifier]={id:r.identifier,initialTarget:r.target,initialTimeStamp:t,initialPageX:r.pageX,initialPageY:r.pageY,rollingTimestamps:[t],rollingPageX:[r.pageX],rollingPageY:[r.pageY]};let i=this.newGestureEvent(Cd.Start,r.target);i.pageX=r.pageX,i.pageY=r.pageY,this.dispatchEvent(i)}this.dispatched&&=(e.preventDefault(),e.stopPropagation(),!1)}onTouchEnd(t,n){let r=Date.now(),i=Object.keys(this.activeTouches).length;for(let a=0,o=n.changedTouches.length;a<o;a++){let o=n.changedTouches.item(a);if(!this.activeTouches.hasOwnProperty(String(o.identifier))){console.warn(`move of an UNKNOWN touch`,o);continue}let s=this.activeTouches[o.identifier],c=Date.now()-s.initialTimeStamp;if(c<e.HOLD_DELAY&&Math.abs(s.initialPageX-ul(s.rollingPageX))<30&&Math.abs(s.initialPageY-ul(s.rollingPageY))<30){let e=this.newGestureEvent(Cd.Tap,s.initialTarget);e.pageX=ul(s.rollingPageX),e.pageY=ul(s.rollingPageY),this.dispatchEvent(e)}else if(c>=e.HOLD_DELAY&&Math.abs(s.initialPageX-ul(s.rollingPageX))<30&&Math.abs(s.initialPageY-ul(s.rollingPageY))<30){let e=this.newGestureEvent(Cd.Contextmenu,s.initialTarget);e.pageX=ul(s.rollingPageX),e.pageY=ul(s.rollingPageY),this.dispatchEvent(e)}else if(i===1){let e=ul(s.rollingPageX),n=ul(s.rollingPageY),i=ul(s.rollingTimestamps)-s.rollingTimestamps[0],a=e-s.rollingPageX[0],o=n-s.rollingPageY[0],c=[...this.targets].filter(e=>s.initialTarget instanceof Node&&e.contains(s.initialTarget));this.inertia(t,c,r,Math.abs(a)/i,a>0?1:-1,e,Math.abs(o)/i,o>0?1:-1,n)}this.dispatchEvent(this.newGestureEvent(Cd.End,s.initialTarget)),delete this.activeTouches[o.identifier]}this.dispatched&&=(n.preventDefault(),n.stopPropagation(),!1)}newGestureEvent(e,t){let n=document.createEvent(`CustomEvent`);return n.initEvent(e,!1,!0),n.initialTarget=t,n.tapCount=0,n}dispatchEvent(t){if(t.type===Cd.Tap){let n=new Date().getTime(),r=0;r=n-this._lastSetTapCountTime>e.CLEAR_TAP_COUNT_TIME?1:2,this._lastSetTapCountTime=n,t.tapCount=r}else(t.type===Cd.Change||t.type===Cd.Contextmenu)&&(this._lastSetTapCountTime=0);if(t.initialTarget instanceof Node){for(let e of this.ignoreTargets)if(e.contains(t.initialTarget))return;let e=[];for(let n of this.targets)if(n.contains(t.initialTarget)){let r=0,i=t.initialTarget;for(;i&&i!==n;)r++,i=i.parentElement;e.push([r,n])}e.sort((e,t)=>e[0]-t[0]);for(let[n,r]of e)r.dispatchEvent(t),this.dispatched=!0}}inertia(t,n,r,i,a,o,s,c,l){this.handle=pd(t,()=>{let u=Date.now(),d=u-r,f=0,p=0,m=!0;i+=e.SCROLL_FRICTION*d,s+=e.SCROLL_FRICTION*d,i>0&&(m=!1,f=a*i*d),s>0&&(m=!1,p=c*s*d);let h=this.newGestureEvent(Cd.Change);h.translationX=f,h.translationY=p,n.forEach(e=>e.dispatchEvent(h)),m||this.inertia(t,n,u,i,a,o+f,s,c,l+p)})}onTouchMove(e){let t=Date.now();for(let n=0,r=e.changedTouches.length;n<r;n++){let r=e.changedTouches.item(n);if(!this.activeTouches.hasOwnProperty(String(r.identifier))){console.warn(`end of an UNKNOWN touch`,r);continue}let i=this.activeTouches[r.identifier],a=this.newGestureEvent(Cd.Change,i.initialTarget);a.translationX=r.pageX-ul(i.rollingPageX),a.translationY=r.pageY-ul(i.rollingPageY),a.pageX=r.pageX,a.pageY=r.pageY,this.dispatchEvent(a),i.rollingPageX.length>3&&(i.rollingPageX.shift(),i.rollingPageY.shift(),i.rollingTimestamps.shift()),i.rollingPageX.push(r.pageX),i.rollingPageY.push(r.pageY),i.rollingTimestamps.push(t)}this.dispatched&&=(e.preventDefault(),e.stopPropagation(),!1)}};wd.SCROLL_FRICTION=-.005,wd.HOLD_DELAY=700,wd.CLEAR_TAP_COUNT_TIME=400,uc([Sd],wd,`isTouchDevice`,1);var Td=wd,Ed=class extends U{onclick(e,t){this._register(Y(e,vd.CLICK,n=>t(new zu(q(e),n))))}onmousedown(e,t){this._register(Y(e,vd.MOUSE_DOWN,n=>t(new zu(q(e),n))))}onmouseover(e,t){this._register(Y(e,vd.MOUSE_OVER,n=>t(new zu(q(e),n))))}onmouseleave(e,t){this._register(Y(e,vd.MOUSE_LEAVE,n=>t(new zu(q(e),n))))}onkeydown(e,t){this._register(Y(e,vd.KEY_DOWN,e=>t(new Fu(e))))}onkeyup(e,t){this._register(Y(e,vd.KEY_UP,e=>t(new Fu(e))))}oninput(e,t){this._register(Y(e,vd.INPUT,t))}onblur(e,t){this._register(Y(e,vd.BLUR,t))}onfocus(e,t){this._register(Y(e,vd.FOCUS,t))}onchange(e,t){this._register(Y(e,vd.CHANGE,t))}ignoreGesture(e){return Td.ignoreTarget(e)}},Dd=11,Od=class extends Ed{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=Dd+`px`,this.domNode.style.height=Dd+`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 xd),this._register(fd(this.bgDomNode,vd.POINTER_DOWN,e=>this._arrowPointerDown(e))),this._register(fd(this.domNode,vd.POINTER_DOWN,e=>this._arrowPointerDown(e))),this._pointerdownRepeatTimer=this._register(new md),this._pointerdownScheduleRepeatTimer=this._register(new Wu)}_arrowPointerDown(e){e.target&&e.target instanceof Element&&(this._onActivate(),this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancelAndSet(()=>{this._pointerdownRepeatTimer.cancelAndSet(()=>this._onActivate(),1e3/24,q(e))},200),this._pointerMoveMonitor.startMonitoring(e.target,e.pointerId,e.buttons,e=>{},()=>{this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancel()}),e.preventDefault())}},kd=class e{constructor(e,t,n,r,i,a,o){this._forceIntegerValues=e,this._scrollStateBrand=void 0,this._forceIntegerValues&&(t|=0,n|=0,r|=0,i|=0,a|=0,o|=0),this.rawScrollLeft=r,this.rawScrollTop=o,t<0&&(t=0),r+t>n&&(r=n-t),r<0&&(r=0),i<0&&(i=0),o+i>a&&(o=a-i),o<0&&(o=0),this.width=t,this.scrollWidth=n,this.scrollLeft=r,this.height=i,this.scrollHeight=a,this.scrollTop=o}equals(e){return this.rawScrollLeft===e.rawScrollLeft&&this.rawScrollTop===e.rawScrollTop&&this.width===e.width&&this.scrollWidth===e.scrollWidth&&this.scrollLeft===e.scrollLeft&&this.height===e.height&&this.scrollHeight===e.scrollHeight&&this.scrollTop===e.scrollTop}withScrollDimensions(t,n){return new e(this._forceIntegerValues,typeof t.width<`u`?t.width:this.width,typeof t.scrollWidth<`u`?t.scrollWidth:this.scrollWidth,n?this.rawScrollLeft:this.scrollLeft,typeof t.height<`u`?t.height:this.height,typeof t.scrollHeight<`u`?t.scrollHeight:this.scrollHeight,n?this.rawScrollTop:this.scrollTop)}withScrollPosition(t){return new e(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(e,t){let n=this.width!==e.width,r=this.scrollWidth!==e.scrollWidth,i=this.scrollLeft!==e.scrollLeft,a=this.height!==e.height,o=this.scrollHeight!==e.scrollHeight,s=this.scrollTop!==e.scrollTop;return{inSmoothScrolling:t,oldWidth:e.width,oldScrollWidth:e.scrollWidth,oldScrollLeft:e.scrollLeft,width:this.width,scrollWidth:this.scrollWidth,scrollLeft:this.scrollLeft,oldHeight:e.height,oldScrollHeight:e.scrollHeight,oldScrollTop:e.scrollTop,height:this.height,scrollHeight:this.scrollHeight,scrollTop:this.scrollTop,widthChanged:n,scrollWidthChanged:r,scrollLeftChanged:i,heightChanged:a,scrollHeightChanged:o,scrollTopChanged:s}}},Ad=class extends U{constructor(e){super(),this._scrollableBrand=void 0,this._onScroll=this._register(new W),this.onScroll=this._onScroll.event,this._smoothScrollDuration=e.smoothScrollDuration,this._scheduleAtNextAnimationFrame=e.scheduleAtNextAnimationFrame,this._state=new kd(e.forceIntegerValues,0,0,0,0,0,0),this._smoothScrolling=null}dispose(){this._smoothScrolling&&=(this._smoothScrolling.dispose(),null),super.dispose()}setSmoothScrollDuration(e){this._smoothScrollDuration=e}validateScrollPosition(e){return this._state.withScrollPosition(e)}getScrollDimensions(){return this._state}setScrollDimensions(e,t){let n=this._state.withScrollDimensions(e,t);this._setState(n,!!this._smoothScrolling),this._smoothScrolling?.acceptScrollDimensions(this._state)}getFutureScrollPosition(){return this._smoothScrolling?this._smoothScrolling.to:this._state}getCurrentScrollPosition(){return this._state}setScrollPositionNow(e){let t=this._state.withScrollPosition(e);this._smoothScrolling&&=(this._smoothScrolling.dispose(),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 n=this._state.withScrollPosition(e);if(this._smoothScrolling.to.scrollLeft===n.scrollLeft&&this._smoothScrolling.to.scrollTop===n.scrollTop)return;let r;r=t?new Pd(this._smoothScrolling.from,n,this._smoothScrolling.startTime,this._smoothScrolling.duration):this._smoothScrolling.combine(this._state,n,this._smoothScrollDuration),this._smoothScrolling.dispose(),this._smoothScrolling=r}else{let t=this._state.withScrollPosition(e);this._smoothScrolling=Pd.start(this._state,t,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 n=this._state;n.equals(e)||(this._state=e,this._onScroll.fire(this._state.createScrollEvent(n,t)))}},jd=class{constructor(e,t,n){this.scrollLeft=e,this.scrollTop=t,this.isDone=n}};function Md(e,t){let n=t-e;return function(t){return e+n*Id(t)}}function Nd(e,t,n){return function(r){return r<n?e(r/n):t((r-n)/(1-n))}}var Pd=class e{constructor(e,t,n,r){this.from=e,this.to=t,this.duration=r,this.startTime=n,this.animationFrameDisposable=null,this._initAnimations()}_initAnimations(){this.scrollLeft=this._initAnimation(this.from.scrollLeft,this.to.scrollLeft,this.to.width),this.scrollTop=this._initAnimation(this.from.scrollTop,this.to.scrollTop,this.to.height)}_initAnimation(e,t,n){if(Math.abs(e-t)>2.5*n){let r,i;return e<t?(r=e+.75*n,i=t-.75*n):(r=e-.75*n,i=t+.75*n),Nd(Md(e,r),Md(i,t),.33)}return Md(e,t)}dispose(){this.animationFrameDisposable!==null&&(this.animationFrameDisposable.dispose(),this.animationFrameDisposable=null)}acceptScrollDimensions(e){this.to=e.withScrollPosition(this.to),this._initAnimations()}tick(){return this._tick(Date.now())}_tick(e){let t=(e-this.startTime)/this.duration;return t<1?new jd(this.scrollLeft(t),this.scrollTop(t),!1):new jd(this.to.scrollLeft,this.to.scrollTop,!0)}combine(t,n,r){return e.start(t,n,r)}static start(t,n,r){r+=10;let i=Date.now()-10;return new e(t,n,i,r)}};function Fd(e){return e**3}function Id(e){return 1-Fd(1-e)}var Ld=class extends U{constructor(e,t,n){super(),this._visibility=e,this._visibleClassName=t,this._invisibleClassName=n,this._domNode=null,this._isVisible=!1,this._isNeeded=!1,this._rawShouldBeVisible=!1,this._shouldBeVisible=!1,this._revealTimer=this._register(new Wu)}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||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(){this._isNeeded?this._shouldBeVisible?this._reveal():this._hide(!0):this._hide(!1)}_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`:``)))}},Rd=140,zd=class extends Ed{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 Ld(e.visibility,`visible scrollbar `+e.extraScrollbarClassName,`invisible scrollbar `+e.extraScrollbarClassName)),this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._pointerMoveMonitor=this._register(new xd),this._shouldRender=!0,this.domNode=bd(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(Y(this.domNode.domNode,vd.POINTER_DOWN,e=>this._domNodePointerDown(e)))}_createArrow(e){let t=this._register(new Od(e));this.domNode.domNode.appendChild(t.bgDomNode),this.domNode.domNode.appendChild(t.domNode)}_createSlider(e,t,n,r){this.slider=bd(document.createElement(`div`)),this.slider.setClassName(`slider`),this.slider.setPosition(`absolute`),this.slider.setTop(e),this.slider.setLeft(t),typeof n==`number`&&this.slider.setWidth(n),typeof r==`number`&&this.slider.setHeight(r),this.slider.setLayerHinting(!0),this.slider.setContain(`strict`),this.domNode.domNode.appendChild(this.slider.domNode),this._register(Y(this.slider.domNode,vd.POINTER_DOWN,e=>{e.button===0&&(e.preventDefault(),this._sliderPointerDown(e))})),this.onclick(this.slider.domNode,e=>{e.leftButton&&e.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,n=t+this._scrollbarState.getSliderPosition(),r=t+this._scrollbarState.getSliderPosition()+this._scrollbarState.getSliderSize(),i=this._sliderPointerPosition(e);n<=i&&i<=r?e.button===0&&(e.preventDefault(),this._sliderPointerDown(e)):this._onPointerDown(e)}_onPointerDown(e){let t,n;if(e.target===this.domNode.domNode&&typeof e.offsetX==`number`&&typeof e.offsetY==`number`)t=e.offsetX,n=e.offsetY;else{let r=_d(this.domNode.domNode);t=e.pageX-r.left,n=e.pageY-r.top}let r=this._pointerDownRelativePosition(t,n);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),n=this._sliderOrthogonalPointerPosition(e),r=this._scrollbarState.clone();this.slider.toggleClassName(`active`,!0),this._pointerMoveMonitor.startMonitoring(e.target,e.pointerId,e.buttons,e=>{let i=this._sliderOrthogonalPointerPosition(e),a=Math.abs(i-n);if(fu&&a>Rd){this._setDesiredScrollPositionNow(r.getScrollPosition());return}let o=this._sliderPointerPosition(e)-t;this._setDesiredScrollPositionNow(r.getDesiredScrollPositionFromDelta(o))},()=>{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()}},Bd=class e{constructor(e,t,n,r,i,a){this._scrollbarSize=Math.round(t),this._oppositeScrollbarSize=Math.round(n),this._arrowSize=Math.round(e),this._visibleSize=r,this._scrollSize=i,this._scrollPosition=a,this._computedAvailableSize=0,this._computedIsNeeded=!1,this._computedSliderSize=0,this._computedSliderRatio=0,this._computedSliderPosition=0,this._refreshComputedValues()}clone(){return new e(this._arrowSize,this._scrollbarSize,this._oppositeScrollbarSize,this._visibleSize,this._scrollSize,this._scrollPosition)}setVisibleSize(e){let t=Math.round(e);return this._visibleSize!==t&&(this._visibleSize=t,this._refreshComputedValues(),!0)}setScrollSize(e){let t=Math.round(e);return this._scrollSize!==t&&(this._scrollSize=t,this._refreshComputedValues(),!0)}setScrollPosition(e){let t=Math.round(e);return this._scrollPosition!==t&&(this._scrollPosition=t,this._refreshComputedValues(),!0)}setScrollbarSize(e){this._scrollbarSize=Math.round(e)}setOppositeScrollbarSize(e){this._oppositeScrollbarSize=Math.round(e)}static _computeValues(e,t,n,r,i){let a=Math.max(0,n-e),o=Math.max(0,a-2*t),s=r>0&&r>n;if(!s)return{computedAvailableSize:Math.round(a),computedIsNeeded:s,computedSliderSize:Math.round(o),computedSliderRatio:0,computedSliderPosition:0};let c=Math.round(Math.max(20,Math.floor(n*o/r))),l=(o-c)/(r-n),u=i*l;return{computedAvailableSize:Math.round(a),computedIsNeeded:s,computedSliderSize:Math.round(c),computedSliderRatio:l,computedSliderPosition:Math.round(u)}}_refreshComputedValues(){let t=e._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(e){if(!this._computedIsNeeded)return 0;let t=e-this._arrowSize-this._computedSliderSize/2;return Math.round(t/this._computedSliderRatio)}getDesiredScrollPositionFromOffsetPaged(e){if(!this._computedIsNeeded)return 0;let t=e-this._arrowSize,n=this._scrollPosition;return t<this._computedSliderPosition?n-=this._visibleSize:n+=this._visibleSize,n}getDesiredScrollPositionFromDelta(e){if(!this._computedIsNeeded)return 0;let t=this._computedSliderPosition+e;return Math.round(t/this._computedSliderRatio)}},Vd=class extends zd{constructor(e,t,n){let r=e.getScrollDimensions(),i=e.getCurrentScrollPosition();if(super({lazyRender:t.lazyRender,host:n,scrollbarState:new Bd(t.horizontalHasArrows?t.arrowSize:0,t.horizontal===2?0:t.horizontalScrollbarSize,t.vertical===2?0:t.verticalScrollbarSize,r.width,r.scrollWidth,i.scrollLeft),visibility:t.horizontal,extraScrollbarClassName:`horizontal`,scrollable:e,scrollByPage:t.scrollByPage}),t.horizontalHasArrows)throw 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}},Hd=class extends zd{constructor(e,t,n){let r=e.getScrollDimensions(),i=e.getCurrentScrollPosition();if(super({lazyRender:t.lazyRender,host:n,scrollbarState:new Bd(t.verticalHasArrows?t.arrowSize:0,t.vertical===2?0:t.verticalScrollbarSize,0,r.height,r.scrollHeight,i.scrollTop),visibility:t.vertical,extraScrollbarClassName:`vertical`,scrollable:e,scrollByPage:t.scrollByPage}),t.verticalHasArrows)throw 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}},Ud=500,Wd=50,Gd=!0,Kd=class{constructor(e,t,n){this.timestamp=e,this.deltaX=t,this.deltaY=n,this.score=0}},qd=class{constructor(){this._capacity=5,this._memory=[],this._front=-1,this._rear=-1}isPhysicalMouseWheel(){if(this._front===-1&&this._rear===-1)return!1;let e=1,t=0,n=1,r=this._rear;do{let i=r===this._front?e:2**-n;if(e-=i,t+=this._memory[r].score*i,r===this._front)break;r=(this._capacity+r-1)%this._capacity,n++}while(1);return t<=.5}acceptStandardWheelEvent(e){if(Ql){let t=Jl(q(e.browserEvent));this.accept(Date.now(),e.deltaX*t,e.deltaY*t)}else this.accept(Date.now(),e.deltaX,e.deltaY)}accept(e,t,n){let r=null,i=new Kd(e,t,n);this._front===-1&&this._rear===-1?(this._memory[0]=i,this._front=0,this._rear=0):(r=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]=i),i.score=this._computeScore(i,r)}_computeScore(e,t){if(Math.abs(e.deltaX)>0&&Math.abs(e.deltaY)>0)return 1;let n=.5;if(this._isAlmostInt(e.deltaX)&&this._isAlmostInt(e.deltaY)||(n+=.25),t){let r=Math.abs(e.deltaX),i=Math.abs(e.deltaY),a=Math.abs(t.deltaX),o=Math.abs(t.deltaY),s=Math.max(Math.min(r,a),1),c=Math.max(Math.min(i,o),1),l=Math.max(r,a),u=Math.max(i,o);l%s===0&&u%c===0&&(n-=.5)}return Math.min(Math.max(n,0),1)}_isAlmostInt(e){return Math.abs(Math.round(e)-e)<.01}};qd.INSTANCE=new qd;var Jd=qd,Yd=class extends Ed{constructor(e,t,n){super(),this._onScroll=this._register(new W),this.onScroll=this._onScroll.event,this._onWillScroll=this._register(new W),this.onWillScroll=this._onWillScroll.event,this._options=Zd(t),this._scrollable=n,this._register(this._scrollable.onScroll(e=>{this._onWillScroll.fire(e),this._onDidScroll(e),this._onScroll.fire(e)}));let r={onMouseWheel:e=>this._onMouseWheel(e),onDragStart:()=>this._onDragStart(),onDragEnd:()=>this._onDragEnd()};this._verticalScrollbar=this._register(new Hd(this._scrollable,this._options,r)),this._horizontalScrollbar=this._register(new Vd(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=bd(document.createElement(`div`)),this._leftShadowDomNode.setClassName(`shadow`),this._domNode.appendChild(this._leftShadowDomNode.domNode),this._topShadowDomNode=bd(document.createElement(`div`)),this._topShadowDomNode.setClassName(`shadow`),this._domNode.appendChild(this._topShadowDomNode.domNode),this._topLeftShadowDomNode=bd(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,e=>this._onMouseOver(e)),this.onmouseleave(this._listenOnDomNode,e=>this._onMouseLeave(e)),this._hideTimeout=this._register(new Wu),this._isDragging=!1,this._mouseIsOver=!1,this._shouldRender=!0,this._revealOnScroll=!0}get options(){return this._options}dispose(){this._mouseWheelToDispose=bl(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,pu&&(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 Bu(e))}_setListeningToMouseWheel(e){this._mouseWheelToDispose.length>0!==e&&(this._mouseWheelToDispose=bl(this._mouseWheelToDispose),e)&&this._mouseWheelToDispose.push(Y(this._listenOnDomNode,vd.MOUSE_WHEEL,e=>{this._onMouseWheel(new Bu(e))},{passive:!1}))}_onMouseWheel(e){if(e.browserEvent?.defaultPrevented)return;let t=Jd.INSTANCE;Gd&&t.acceptStandardWheelEvent(e);let n=!1;if(e.deltaY||e.deltaX){let r=e.deltaY*this._options.mouseWheelScrollSensitivity,i=e.deltaX*this._options.mouseWheelScrollSensitivity;this._options.scrollPredominantAxis&&(this._options.scrollYToX&&i+r===0?i=r=0:Math.abs(r)>=Math.abs(i)?i=0:r=0),this._options.flipAxes&&([r,i]=[i,r]);let a=!pu&&e.browserEvent&&e.browserEvent.shiftKey;(this._options.scrollYToX||a)&&!i&&(i=r,r=0),e.browserEvent&&e.browserEvent.altKey&&(i*=this._options.fastScrollSensitivity,r*=this._options.fastScrollSensitivity);let o=this._scrollable.getFutureScrollPosition(),s={};if(r){let e=Wd*r,t=o.scrollTop-(e<0?Math.floor(e):Math.ceil(e));this._verticalScrollbar.writeScrollPosition(s,t)}if(i){let e=Wd*i,t=o.scrollLeft-(e<0?Math.floor(e):Math.ceil(e));this._horizontalScrollbar.writeScrollPosition(s,t)}s=this._scrollable.validateScrollPosition(s),(o.scrollLeft!==s.scrollLeft||o.scrollTop!==s.scrollTop)&&(Gd&&this._options.mouseWheelSmoothScroll&&t.isPhysicalMouseWheel()?this._scrollable.setScrollPositionSmooth(s):this._scrollable.setScrollPositionNow(s),n=!0)}let r=n;!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 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,n=e.scrollLeft>0,r=n?` left`:``,i=t?` top`:``,a=n||t?` top-left-corner`:``;this._leftShadowDomNode.setClassName(`shadow${r}`),this._topShadowDomNode.setClassName(`shadow${i}`),this._topLeftShadowDomNode.setClassName(`shadow${a}${i}${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(),Ud)}},Xd=class extends Yd{constructor(e,t,n){super(e,t,n)}setScrollPosition(e){e.reuseAnimation?this._scrollable.setScrollPositionSmooth(e,e.reuseAnimation):this._scrollable.setScrollPositionNow(e)}getScrollPosition(){return this._scrollable.getCurrentScrollPosition()}};function Zd(e){let t={lazyRender:typeof e.lazyRender<`u`&&e.lazyRender,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,consumeMouseWheelIfScrollbarIsNeeded:typeof e.consumeMouseWheelIfScrollbarIsNeeded<`u`&&e.consumeMouseWheelIfScrollbarIsNeeded,alwaysConsumeMouseWheel:typeof e.alwaysConsumeMouseWheel<`u`&&e.alwaysConsumeMouseWheel,scrollYToX:typeof e.scrollYToX<`u`&&e.scrollYToX,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,vertical:typeof e.vertical<`u`?e.vertical:1,verticalScrollbarSize:typeof e.verticalScrollbarSize<`u`?e.verticalScrollbarSize:10,verticalHasArrows:typeof e.verticalHasArrows<`u`&&e.verticalHasArrows,verticalSliderSize:typeof e.verticalSliderSize<`u`?e.verticalSliderSize:0,scrollByPage:typeof e.scrollByPage<`u`&&e.scrollByPage};return t.horizontalSliderSize=typeof e.horizontalSliderSize<`u`?e.horizontalSliderSize:t.horizontalScrollbarSize,t.verticalSliderSize=typeof e.verticalSliderSize<`u`?e.verticalSliderSize:t.verticalScrollbarSize,pu&&(t.className+=` mac`),t}var Qd=class extends U{constructor(e,t,n,r,i,a,o,s){super(),this._bufferService=n,this._optionsService=o,this._renderService=s,this._onRequestScrollLines=this._register(new W),this.onRequestScrollLines=this._onRequestScrollLines.event,this._isSyncing=!1,this._isHandlingScroll=!1,this._suppressOnScrollHandler=!1;let c=this._register(new Ad({forceIntegerValues:!1,smoothScrollDuration:this._optionsService.rawOptions.smoothScrollDuration,scheduleAtNextAnimationFrame:e=>pd(r.window,e)}));this._register(this._optionsService.onSpecificOptionChange(`smoothScrollDuration`,()=>{c.setSmoothScrollDuration(this._optionsService.rawOptions.smoothScrollDuration)})),this._scrollableElement=this._register(new Xd(t,{vertical:1,horizontal:2,useShadows:!1,mouseWheelSmoothScroll:!0,...this._getChangeOptions()},c)),this._register(this._optionsService.onMultipleOptionChange([`scrollSensitivity`,`fastScrollSensitivity`,`overviewRuler`],()=>this._scrollableElement.updateOptions(this._getChangeOptions()))),this._register(i.onProtocolChange(e=>{this._scrollableElement.updateOptions({handleMouseWheel:!(e&16)})})),this._scrollableElement.setScrollDimensions({height:0,scrollHeight:0}),this._register(Ml.runAndSubscribe(a.onChangeColors,()=>{this._scrollableElement.getDomNode().style.backgroundColor=a.colors.background.css})),e.appendChild(this._scrollableElement.getDomNode()),this._register(Sl(()=>this._scrollableElement.getDomNode().remove())),this._styleElement=r.mainDocument.createElement(`style`),t.appendChild(this._styleElement),this._register(Sl(()=>this._styleElement.remove())),this._register(Ml.runAndSubscribe(a.onChangeColors,()=>{this._styleElement.textContent=[`.xterm .xterm-scrollable-element > .scrollbar > .slider {`,` background: ${a.colors.scrollbarSliderBackground.css};`,`}`,`.xterm .xterm-scrollable-element > .scrollbar > .slider:hover {`,` background: ${a.colors.scrollbarSliderHoverBackground.css};`,`}`,`.xterm .xterm-scrollable-element > .scrollbar > .slider.active {`,` background: ${a.colors.scrollbarSliderActiveBackground.css};`,`}`].join(`
|
|
23
|
-
`)})),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(e=>this._handleScroll(e)))}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),n=t-this._bufferService.buffer.ydisp;n!==0&&(this._latestYDisp=t,this._onRequestScrollLines.fire(n)),this._isHandlingScroll=!1}};Qd=uc([V(2,Ic),V(3,Yc),V(4,Lc),V(5,el),V(6,Hc),V(7,Zc)],Qd);var $d=class extends U{constructor(e,t,n,r,i){super(),this._screenElement=e,this._bufferService=t,this._coreBrowserService=n,this._decorationService=r,this._renderService=i,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(e=>this._removeDecoration(e))),this._register(Sl(()=>{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 n=e.options.x??0;return n&&n>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 n=this._decorationElements.get(e);n||(n=this._createElement(e),e.element=n,this._decorationElements.set(e,n),this._container.appendChild(n),e.onDispose(()=>{this._decorationElements.delete(e),n.remove()})),n.style.display=this._altBufferIsActive?`none`:`block`,this._altBufferIsActive||(n.style.width=`${Math.round((e.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,n.style.height=`${(e.options.height||1)*this._renderService.dimensions.css.cell.height}px`,n.style.top=`${t*this._renderService.dimensions.css.cell.height}px`,n.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`),e.onRenderEmitter.fire(n)}}_refreshXPosition(e,t=e.element){if(!t)return;let n=e.options.x??0;(e.options.anchor||`left`)===`right`?t.style.right=n?`${n*this._renderService.dimensions.css.cell.width}px`:``:t.style.left=n?`${n*this._renderService.dimensions.css.cell.width}px`:``}_removeDecoration(e){this._decorationElements.get(e)?.remove(),this._decorationElements.delete(e),e.dispose()}};$d=uc([V(1,Ic),V(2,Yc),V(3,Gc),V(4,Zc)],$d);var ef=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,n){return t>=e.startBufferLine-this._linePadding[n||`full`]&&t<=e.endBufferLine+this._linePadding[n||`full`]}_addLineToZone(e,t){e.startBufferLine=Math.min(e.startBufferLine,t),e.endBufferLine=Math.max(e.endBufferLine,t)}},tf={full:0,left:0,center:0,right:0},nf={full:0,left:0,center:0,right:0},rf={full:0,left:0,center:0,right:0},af=class extends U{constructor(e,t,n,r,i,a,o,s){super(),this._viewportElement=e,this._screenElement=t,this._bufferService=n,this._decorationService=r,this._renderService=i,this._optionsService=a,this._themeService=o,this._coreBrowserService=s,this._colorZoneStore=new ef,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(Sl(()=>this._canvas?.remove()));let c=this._canvas.getContext(`2d`);if(c)this._ctx=c;else throw 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);nf.full=this._canvas.width,nf.left=e,nf.center=t,nf.right=e,this._refreshDrawHeightConstants(),rf.full=1,rf.left=1,rf.center=1+nf.left,rf.right=1+nf.left+nf.center}_refreshDrawHeightConstants(){tf.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);tf.left=t,tf.center=t,tf.right=t}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*tf.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*tf.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*tf.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*tf.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 e of this._decorationService.decorations)this._colorZoneStore.addDecoration(e);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(rf[e.position||`full`],Math.round((this._canvas.height-1)*(e.startBufferLine/this._bufferService.buffers.active.lines.length)-tf[e.position||`full`]/2),nf[e.position||`full`],Math.round((this._canvas.height-1)*((e.endBufferLine-e.startBufferLine)/this._bufferService.buffers.active.lines.length)+tf[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}))}};af=uc([V(2,Ic),V(3,Gc),V(4,Zc),V(5,Hc),V(6,el),V(7,Yc)],af);var Z;(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=`
|
|
24
|
-
`,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=``))(Z||={});var of;(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=``))(of||={});var sf;(e=>e.ST=`${Z.ESC}\\`)(sf||={});var cf=class{constructor(e,t,n,r,i,a){this._textarea=e,this._compositionView=t,this._bufferService=n,this._optionsService=r,this._coreService=i,this._renderService=a,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)}_finalizeComposition(e){if(this._compositionView.classList.remove(`active`),this._isComposing=!1,e){let e={start:this._compositionPosition.start,end:this._compositionPosition.end};this._isSendingComposition=!0,setTimeout(()=>{if(this._isSendingComposition){this._isSendingComposition=!1;let t;e.start+=this._dataAlreadySent.length,t=this._isComposing?this._textarea.value.substring(e.start,this._compositionPosition.start):this._textarea.value.substring(e.start),t.length>0&&this._coreService.triggerDataEvent(t,!0)}},0)}else{this._isSendingComposition=!1;let e=this._textarea.value.substring(this._compositionPosition.start,this._compositionPosition.end);this._coreService.triggerDataEvent(e,!0)}}_handleAnyTextareaChanges(){let e=this._textarea.value;setTimeout(()=>{if(!this._isComposing){let t=this._textarea.value,n=t.replace(e,``);this._dataAlreadySent=n,t.length>e.length?this._coreService.triggerDataEvent(n,!0):t.length<e.length?this._coreService.triggerDataEvent(`${Z.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 e=Math.min(this._bufferService.buffer.x,this._bufferService.cols-1),t=this._renderService.dimensions.css.cell.height,n=this._bufferService.buffer.y*this._renderService.dimensions.css.cell.height,r=e*this._renderService.dimensions.css.cell.width;this._compositionView.style.left=r+`px`,this._compositionView.style.top=n+`px`,this._compositionView.style.height=t+`px`,this._compositionView.style.lineHeight=t+`px`,this._compositionView.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._compositionView.style.fontSize=this._optionsService.rawOptions.fontSize+`px`;let i=this._compositionView.getBoundingClientRect();this._textarea.style.left=r+`px`,this._textarea.style.top=n+`px`,this._textarea.style.width=Math.max(i.width,1)+`px`,this._textarea.style.height=Math.max(i.height,1)+`px`,this._textarea.style.lineHeight=i.height+`px`}e||setTimeout(()=>this.updateCompositionElements(!0),0)}}};cf=uc([V(2,Ic),V(3,Hc),V(4,Rc),V(5,Zc)],cf);var lf=0,uf=0,df=0,ff=0,pf={css:`#00000000`,rgba:0},mf;(e=>{function t(e,t,n,r){return r===void 0?`#${yf(e)}${yf(t)}${yf(n)}`:`#${yf(e)}${yf(t)}${yf(n)}${yf(r)}`}e.toCss=t;function n(e,t,n,r=255){return(e<<24|t<<16|n<<8|r)>>>0}e.toRgba=n;function r(t,n,r,i){return{css:e.toCss(t,n,r,i),rgba:e.toRgba(t,n,r,i)}}e.toColor=r})(mf||={});var hf;(e=>{function t(e,t){if(ff=(t.rgba&255)/255,ff===1)return{css:t.css,rgba:t.rgba};let n=t.rgba>>24&255,r=t.rgba>>16&255,i=t.rgba>>8&255,a=e.rgba>>24&255,o=e.rgba>>16&255,s=e.rgba>>8&255;return lf=a+Math.round((n-a)*ff),uf=o+Math.round((r-o)*ff),df=s+Math.round((i-s)*ff),{css:mf.toCss(lf,uf,df),rgba:mf.toRgba(lf,uf,df)}}e.blend=t;function n(e){return(e.rgba&255)==255}e.isOpaque=n;function r(e,t,n){let r=vf.ensureContrastRatio(e.rgba,t.rgba,n);if(r)return mf.toColor(r>>24&255,r>>16&255,r>>8&255)}e.ensureContrastRatio=r;function i(e){let t=(e.rgba|255)>>>0;return[lf,uf,df]=vf.toChannels(t),{css:mf.toCss(lf,uf,df),rgba:t}}e.opaque=i;function a(e,t){return ff=Math.round(t*255),[lf,uf,df]=vf.toChannels(e.rgba),{css:mf.toCss(lf,uf,df,ff),rgba:mf.toRgba(lf,uf,df,ff)}}e.opacity=a;function o(e,t){return ff=e.rgba&255,a(e,ff*t/255)}e.multiplyOpacity=o;function s(e){return[e.rgba>>24&255,e.rgba>>16&255,e.rgba>>8&255]}e.toColorRGB=s})(hf||={});var gf;(e=>{let t,n;try{let e=document.createElement(`canvas`);e.width=1,e.height=1;let r=e.getContext(`2d`,{willReadFrequently:!0});r&&(t=r,t.globalCompositeOperation=`copy`,n=t.createLinearGradient(0,0,1,1))}catch{}function r(e){if(e.match(/#[\da-f]{3,8}/i))switch(e.length){case 4:return lf=parseInt(e.slice(1,2).repeat(2),16),uf=parseInt(e.slice(2,3).repeat(2),16),df=parseInt(e.slice(3,4).repeat(2),16),mf.toColor(lf,uf,df);case 5:return lf=parseInt(e.slice(1,2).repeat(2),16),uf=parseInt(e.slice(2,3).repeat(2),16),df=parseInt(e.slice(3,4).repeat(2),16),ff=parseInt(e.slice(4,5).repeat(2),16),mf.toColor(lf,uf,df,ff);case 7:return{css:e,rgba:(parseInt(e.slice(1),16)<<8|255)>>>0};case 9:return{css:e,rgba:parseInt(e.slice(1),16)>>>0}}let r=e.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(r)return lf=parseInt(r[1]),uf=parseInt(r[2]),df=parseInt(r[3]),ff=Math.round((r[5]===void 0?1:parseFloat(r[5]))*255),mf.toColor(lf,uf,df,ff);if(!t||!n||(t.fillStyle=n,t.fillStyle=e,typeof t.fillStyle!=`string`)||(t.fillRect(0,0,1,1),[lf,uf,df,ff]=t.getImageData(0,0,1,1).data,ff!==255))throw Error(`css.toColor: Unsupported css format`);return{rgba:mf.toRgba(lf,uf,df,ff),css:e}}e.toColor=r})(gf||={});var _f;(e=>{function t(e){return n(e>>16&255,e>>8&255,e&255)}e.relativeLuminance=t;function n(e,t,n){let r=e/255,i=t/255,a=n/255,o=r<=.03928?r/12.92:((r+.055)/1.055)**2.4,s=i<=.03928?i/12.92:((i+.055)/1.055)**2.4,c=a<=.03928?a/12.92:((a+.055)/1.055)**2.4;return o*.2126+s*.7152+c*.0722}e.relativeLuminance2=n})(_f||={});var vf;(e=>{function t(e,t){if(ff=(t&255)/255,ff===1)return t;let n=t>>24&255,r=t>>16&255,i=t>>8&255,a=e>>24&255,o=e>>16&255,s=e>>8&255;return lf=a+Math.round((n-a)*ff),uf=o+Math.round((r-o)*ff),df=s+Math.round((i-s)*ff),mf.toRgba(lf,uf,df)}e.blend=t;function n(e,t,n){let a=_f.relativeLuminance(e>>8),o=_f.relativeLuminance(t>>8);if(bf(a,o)<n){if(o<a){let o=r(e,t,n),s=bf(a,_f.relativeLuminance(o>>8));if(s<n){let r=i(e,t,n);return s>bf(a,_f.relativeLuminance(r>>8))?o:r}return o}let s=i(e,t,n),c=bf(a,_f.relativeLuminance(s>>8));if(c<n){let i=r(e,t,n);return c>bf(a,_f.relativeLuminance(i>>8))?s:i}return s}}e.ensureContrastRatio=n;function r(e,t,n){let r=e>>24&255,i=e>>16&255,a=e>>8&255,o=t>>24&255,s=t>>16&255,c=t>>8&255,l=bf(_f.relativeLuminance2(o,s,c),_f.relativeLuminance2(r,i,a));for(;l<n&&(o>0||s>0||c>0);)o-=Math.max(0,Math.ceil(o*.1)),s-=Math.max(0,Math.ceil(s*.1)),c-=Math.max(0,Math.ceil(c*.1)),l=bf(_f.relativeLuminance2(o,s,c),_f.relativeLuminance2(r,i,a));return(o<<24|s<<16|c<<8|255)>>>0}e.reduceLuminance=r;function i(e,t,n){let r=e>>24&255,i=e>>16&255,a=e>>8&255,o=t>>24&255,s=t>>16&255,c=t>>8&255,l=bf(_f.relativeLuminance2(o,s,c),_f.relativeLuminance2(r,i,a));for(;l<n&&(o<255||s<255||c<255);)o=Math.min(255,o+Math.ceil((255-o)*.1)),s=Math.min(255,s+Math.ceil((255-s)*.1)),c=Math.min(255,c+Math.ceil((255-c)*.1)),l=bf(_f.relativeLuminance2(o,s,c),_f.relativeLuminance2(r,i,a));return(o<<24|s<<16|c<<8|255)>>>0}e.increaseLuminance=i;function a(e){return[e>>24&255,e>>16&255,e>>8&255,e&255]}e.toChannels=a})(vf||={});function yf(e){let t=e.toString(16);return t.length<2?`0`+t:t}function bf(e,t){return e<t?(t+.05)/(e+.05):(e+.05)/(t+.05)}var xf=class extends Oc{constructor(e,t,n){super(),this.content=0,this.combinedData=``,this.fg=e.fg,this.bg=e.bg,this.combinedData=t,this._width=n}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(e){throw Error(`not implemented`)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},Sf=class{constructor(e){this._bufferService=e,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new Ac}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 n=[],r=t.translateToString(!0),i=0,a=0,o=0,s=t.getFg(0),c=t.getBg(0);for(let e=0;e<t.getTrimmedLength();e++)if(t.loadCell(e,this._workCell),this._workCell.getWidth()!==0){if(this._workCell.fg!==s||this._workCell.bg!==c){if(e-i>1){let e=this._getJoinedRanges(r,o,a,t,i);for(let t=0;t<e.length;t++)n.push(e[t])}i=e,o=a,s=this._workCell.fg,c=this._workCell.bg}a+=this._workCell.getChars().length||Dc.length}if(this._bufferService.cols-i>1){let e=this._getJoinedRanges(r,o,a,t,i);for(let t=0;t<e.length;t++)n.push(e[t])}return n}_getJoinedRanges(e,t,n,r,i){let a=e.substring(t,n),o=[];try{o=this._characterJoiners[0].handler(a)}catch(e){console.error(e)}for(let e=1;e<this._characterJoiners.length;e++)try{let t=this._characterJoiners[e].handler(a);for(let e=0;e<t.length;e++)Sf._mergeRanges(o,t[e])}catch(e){console.error(e)}return this._stringRangesToCellRanges(o,r,i),o}_stringRangesToCellRanges(e,t,n){let r=0,i=!1,a=0,o=e[r];if(o){for(let s=n;s<this._bufferService.cols;s++){let n=t.getWidth(s),c=t.getString(s).length||Dc.length;if(n!==0){if(!i&&o[0]<=a&&(o[0]=s,i=!0),o[1]<=a){if(o[1]=s,o=e[++r],!o)break;o[0]<=a?(o[0]=s,i=!0):i=!1}a+=c}}o&&(o[1]=this._bufferService.cols)}}static _mergeRanges(e,t){let n=!1;for(let r=0;r<e.length;r++){let i=e[r];if(n){if(t[1]<=i[0])return e[r-1][1]=t[1],e;if(t[1]<=i[1])return e[r-1][1]=Math.max(t[1],i[1]),e.splice(r,1),e;e.splice(r,1),r--}else{if(t[1]<=i[0])return e.splice(r,0,t),e;if(t[1]<=i[1])return i[0]=Math.min(t[0],i[0]),e;t[0]<i[1]&&(i[0]=Math.min(t[0],i[0]),n=!0);continue}}return n?e[e.length-1][1]=t[1]:e.push(t),e}};Sf=uc([V(0,Ic)],Sf);function Cf(e){return 57508<=e&&e<=57558}function wf(e){return 9472<=e&&e<=9631}function Tf(e){return Cf(e)||wf(e)}function Ef(){return{css:{canvas:Df(),cell:Df()},device:{canvas:Df(),cell:Df(),char:{width:0,height:0,left:0,top:0}}}}function Df(){return{width:0,height:0}}var Of=class{constructor(e,t,n,r,i,a,o){this._document=e,this._characterJoinerService=t,this._optionsService=n,this._coreBrowserService=r,this._coreService=i,this._decorationService=a,this._themeService=o,this._workCell=new Ac,this._columnSelectMode=!1,this.defaultSpacing=0}handleSelectionChanged(e,t,n){this._selectionStart=e,this._selectionEnd=t,this._columnSelectMode=n}createRow(e,t,n,r,i,a,o,s,c,l,u){let d=[],f=this._characterJoinerService.getJoinedCharacters(t),p=this._themeService.colors,m=e.getNoBgTrimmedLength();n&&m<a+1&&(m=a+1);let h,g=0,_=``,v=0,y=0,b=0,x=0,S=!1,C=0,ee=!1,w=0,T=0,E=[],te=l!==-1&&u!==-1;for(let D=0;D<m;D++){e.loadCell(D,this._workCell);let m=this._workCell.getWidth();if(m===0)continue;let ne=!1,O=D>=T,re=D,k=this._workCell;if(f.length>0&&D===f[0][0]&&O){let r=f.shift(),i=this._isCellInSelection(r[0],t);for(v=r[0]+1;v<r[1];v++)O&&=i===this._isCellInSelection(v,t);O&&=!n||a<r[0]||a>=r[1],O?(ne=!0,k=new xf(this._workCell,e.translateToString(!0,r[0],r[1]),r[1]-r[0]),re=r[1]-1,m=k.getWidth()):T=r[1]}let ie=this._isCellInSelection(D,t),ae=n&&D===a,oe=te&&D>=l&&D<=u,se=!1;this._decorationService.forEachDecorationAtCell(D,t,void 0,e=>{se=!0});let ce=k.getChars()||Dc;if(ce===` `&&(k.isUnderline()||k.isOverline())&&(ce=`\xA0`),w=m*s-c.get(ce,k.isBold(),k.isItalic()),!h)h=this._document.createElement(`span`);else if(g&&(ie&&ee||!ie&&!ee&&k.bg===y)&&(ie&&ee&&p.selectionForeground||k.fg===b)&&k.extended.ext===x&&oe===S&&w===C&&!ae&&!ne&&!se&&O){k.isInvisible()?_+=Dc:_+=ce,g++;continue}else g&&(h.textContent=_),h=this._document.createElement(`span`),g=0,_=``;if(y=k.bg,b=k.fg,x=k.extended.ext,S=oe,C=w,ee=ie,ne&&a>=D&&a<=re&&(a=D),!this._coreService.isCursorHidden&&ae&&this._coreService.isCursorInitialized){if(E.push(`xterm-cursor`),this._coreBrowserService.isFocused)o&&E.push(`xterm-cursor-blink`),E.push(r===`bar`?`xterm-cursor-bar`:r===`underline`?`xterm-cursor-underline`:`xterm-cursor-block`);else if(i)switch(i){case`outline`:E.push(`xterm-cursor-outline`);break;case`block`:E.push(`xterm-cursor-block`);break;case`bar`:E.push(`xterm-cursor-bar`);break;case`underline`:E.push(`xterm-cursor-underline`)}}if(k.isBold()&&E.push(`xterm-bold`),k.isItalic()&&E.push(`xterm-italic`),k.isDim()&&E.push(`xterm-dim`),_=k.isInvisible()?Dc:k.getChars()||Dc,k.isUnderline()&&(E.push(`xterm-underline-${k.extended.underlineStyle}`),_===` `&&(_=`\xA0`),!k.isUnderlineColorDefault())){if(k.isUnderlineColorRGB())h.style.textDecorationColor=`rgb(${Oc.toColorRGB(k.getUnderlineColor()).join(`,`)})`;else{let e=k.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&k.isBold()&&e<8&&(e+=8),h.style.textDecorationColor=p.ansi[e].css}}k.isOverline()&&(E.push(`xterm-overline`),_===` `&&(_=`\xA0`)),k.isStrikethrough()&&E.push(`xterm-strikethrough`),oe&&(h.style.textDecoration=`underline`);let le=k.getFgColor(),ue=k.getFgColorMode(),de=k.getBgColor(),fe=k.getBgColorMode(),pe=!!k.isInverse();if(pe){let e=le;le=de,de=e;let t=ue;ue=fe,fe=t}let me,he,ge=!1;this._decorationService.forEachDecorationAtCell(D,t,void 0,e=>{e.options.layer!==`top`&&ge||(e.backgroundColorRGB&&(fe=50331648,de=e.backgroundColorRGB.rgba>>8&16777215,me=e.backgroundColorRGB),e.foregroundColorRGB&&(ue=50331648,le=e.foregroundColorRGB.rgba>>8&16777215,he=e.foregroundColorRGB),ge=e.options.layer===`top`)}),!ge&&ie&&(me=this._coreBrowserService.isFocused?p.selectionBackgroundOpaque:p.selectionInactiveBackgroundOpaque,de=me.rgba>>8&16777215,fe=50331648,ge=!0,p.selectionForeground&&(ue=50331648,le=p.selectionForeground.rgba>>8&16777215,he=p.selectionForeground)),ge&&E.push(`xterm-decoration-top`);let _e;switch(fe){case 16777216:case 33554432:_e=p.ansi[de],E.push(`xterm-bg-${de}`);break;case 50331648:_e=mf.toColor(de>>16,de>>8&255,de&255),this._addStyle(h,`background-color:#${kf((de>>>0).toString(16),`0`,6)}`);break;default:pe?(_e=p.foreground,E.push(`xterm-bg-257`)):_e=p.background}switch(me||k.isDim()&&(me=hf.multiplyOpacity(_e,.5)),ue){case 16777216:case 33554432:k.isBold()&&le<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(le+=8),this._applyMinimumContrast(h,_e,p.ansi[le],k,me,void 0)||E.push(`xterm-fg-${le}`);break;case 50331648:let e=mf.toColor(le>>16&255,le>>8&255,le&255);this._applyMinimumContrast(h,_e,e,k,me,he)||this._addStyle(h,`color:#${kf(le.toString(16),`0`,6)}`);break;default:this._applyMinimumContrast(h,_e,p.foreground,k,me,he)||pe&&E.push(`xterm-fg-257`)}E.length&&=(h.className=E.join(` `),0),!ae&&!ne&&!se&&O?g++:h.textContent=_,w!==this.defaultSpacing&&(h.style.letterSpacing=`${w}px`),d.push(h),D=re}return h&&g&&(h.textContent=_),d}_applyMinimumContrast(e,t,n,r,i,a){if(this._optionsService.rawOptions.minimumContrastRatio===1||Tf(r.getCode()))return!1;let o=this._getContrastCache(r),s;if(!i&&!a&&(s=o.getColor(t.rgba,n.rgba)),s===void 0){let e=this._optionsService.rawOptions.minimumContrastRatio/(r.isDim()?2:1);s=hf.ensureContrastRatio(i||t,a||n,e),o.setColor((i||t).rgba,(a||n).rgba,s??null)}return s?(this._addStyle(e,`color:${s.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 n=this._selectionStart,r=this._selectionEnd;return!n||!r?!1:this._columnSelectMode?n[0]<=r[0]?e>=n[0]&&t>=n[1]&&e<r[0]&&t<=r[1]:e<n[0]&&t>=n[1]&&e>=r[0]&&t<=r[1]:t>n[1]&&t<r[1]||n[1]===r[1]&&t===n[1]&&e>=n[0]&&e<r[0]||n[1]<r[1]&&t===r[1]&&e<r[0]||n[1]<r[1]&&t===n[1]&&e>=n[0]}};Of=uc([V(1,$c),V(2,Hc),V(3,Yc),V(4,Rc),V(5,Gc),V(6,el)],Of);function kf(e,t,n){for(;e.length<n;)e=t+e;return e}var Af=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 n=e.createElement(`span`);n.classList.add(`xterm-char-measure-element`);let r=e.createElement(`span`);r.classList.add(`xterm-char-measure-element`),r.style.fontWeight=`bold`;let i=e.createElement(`span`);i.classList.add(`xterm-char-measure-element`),i.style.fontStyle=`italic`;let a=e.createElement(`span`);a.classList.add(`xterm-char-measure-element`),a.style.fontWeight=`bold`,a.style.fontStyle=`italic`,this._measureElements=[n,r,i,a],this._container.appendChild(n),this._container.appendChild(r),this._container.appendChild(i),this._container.appendChild(a),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,n,r){e===this._font&&t===this._fontSize&&n===this._weight&&r===this._weightBold||(this._font=e,this._fontSize=t,this._weight=n,this._weightBold=r,this._container.style.fontFamily=this._font,this._container.style.fontSize=`${this._fontSize}px`,this._measureElements[0].style.fontWeight=`${n}`,this._measureElements[1].style.fontWeight=`${r}`,this._measureElements[2].style.fontWeight=`${n}`,this._measureElements[3].style.fontWeight=`${r}`,this.clear())}get(e,t,n){let r=0;if(!t&&!n&&e.length===1&&(r=e.charCodeAt(0))<256){if(this._flat[r]!==-9999)return this._flat[r];let t=this._measure(e,0);return t>0&&(this._flat[r]=t),t}let i=e;t&&(i+=`B`),n&&(i+=`I`);let a=this._holey.get(i);if(a===void 0){let r=0;t&&(r|=1),n&&(r|=2),a=this._measure(e,r),a>0&&this._holey.set(i,a)}return a}_measure(e,t){let n=this._measureElements[t];return n.textContent=e.repeat(32),n.offsetWidth/32}},jf=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,n,r=!1){if(this.selectionStart=t,this.selectionEnd=n,!t||!n||t[0]===n[0]&&t[1]===n[1]){this.clear();return}let i=e.buffers.active.ydisp,a=t[1]-i,o=n[1]-i,s=Math.max(a,0),c=Math.min(o,e.rows-1);s>=e.rows||c<0?this.clear():(this.hasSelection=!0,this.columnSelectMode=r,this.viewportStartRow=a,this.viewportEndRow=o,this.viewportCappedStartRow=s,this.viewportCappedEndRow=c,this.startCol=t[0],this.endCol=n[0])}isCellSelected(e,t,n){return this.hasSelection?(n-=e.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?t>=this.startCol&&n>=this.viewportCappedStartRow&&t<this.endCol&&n<=this.viewportCappedEndRow:t<this.startCol&&n>=this.viewportCappedStartRow&&t>=this.endCol&&n<=this.viewportCappedEndRow:n>this.viewportStartRow&&n<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&n===this.viewportStartRow&&t>=this.startCol&&t<this.endCol||this.viewportStartRow<this.viewportEndRow&&n===this.viewportEndRow&&t<this.endCol||this.viewportStartRow<this.viewportEndRow&&n===this.viewportStartRow&&t>=this.startCol):!1}};function Mf(){return new jf}var Nf=`xterm-dom-renderer-owner-`,Pf=`xterm-rows`,Ff=`xterm-fg-`,If=`xterm-bg-`,Lf=`xterm-focus`,Rf=`xterm-selection`,zf=1,Bf=class extends U{constructor(e,t,n,r,i,a,o,s,c,l,u,d,f,p){super(),this._terminal=e,this._document=t,this._element=n,this._screenElement=r,this._viewportElement=i,this._helperContainer=a,this._linkifier2=o,this._charSizeService=c,this._optionsService=l,this._bufferService=u,this._coreService=d,this._coreBrowserService=f,this._themeService=p,this._terminalClass=zf++,this._rowElements=[],this._selectionRenderModel=Mf(),this.onRequestRedraw=this._register(new W).event,this._rowContainer=this._document.createElement(`div`),this._rowContainer.classList.add(Pf),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(Rf),this._selectionContainer.setAttribute(`aria-hidden`,`true`),this.dimensions=Ef(),this._updateDimensions(),this._register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this._register(this._themeService.onChangeColors(e=>this._injectCss(e))),this._injectCss(this._themeService.colors),this._rowFactory=s.createInstance(Of,document),this._element.classList.add(Nf+this._terminalClass),this._screenElement.appendChild(this._rowContainer),this._screenElement.appendChild(this._selectionContainer),this._register(this._linkifier2.onShowLinkUnderline(e=>this._handleLinkHover(e))),this._register(this._linkifier2.onHideLinkUnderline(e=>this._handleLinkLeave(e))),this._register(Sl(()=>{this._element.classList.remove(Nf+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()})),this._widthCache=new Af(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 e of this._rowElements)e.style.width=`${this.dimensions.css.canvas.width}px`,e.style.height=`${this.dimensions.css.cell.height}px`,e.style.lineHeight=`${this.dimensions.css.cell.height}px`,e.style.overflow=`hidden`;this._dimensionsStyleElement||(this._dimensionsStyleElement=this._document.createElement(`style`),this._screenElement.appendChild(this._dimensionsStyleElement));let t=`${this._terminalSelector} .${Pf} 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} .${Pf} { 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} .${Pf} .xterm-dim { color: ${hf.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 n=`blink_underline_${this._terminalClass}`,r=`blink_bar_${this._terminalClass}`,i=`blink_block_${this._terminalClass}`;t+=`@keyframes ${n} { 50% { border-bottom-style: hidden; }}`,t+=`@keyframes ${r} { 50% { box-shadow: none; }}`,t+=`@keyframes ${i} { 0% { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css}; } 50% { background-color: inherit; color: ${e.cursor.css}; }}`,t+=`${this._terminalSelector} .${Pf}.${Lf} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${n} 1s step-end infinite;}${this._terminalSelector} .${Pf}.${Lf} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${r} 1s step-end infinite;}${this._terminalSelector} .${Pf}.${Lf} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${i} 1s step-end infinite;}${this._terminalSelector} .${Pf} .xterm-cursor.xterm-cursor-block { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css};}${this._terminalSelector} .${Pf} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${e.cursor.css} !important; color: ${e.cursorAccent.css} !important;}${this._terminalSelector} .${Pf} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${e.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${Pf} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${e.cursor.css} inset;}${this._terminalSelector} .${Pf} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${e.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,t+=`${this._terminalSelector} .${Rf} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${Rf} div { position: absolute; background-color: ${e.selectionBackgroundOpaque.css};}${this._terminalSelector} .${Rf} div { position: absolute; background-color: ${e.selectionInactiveBackgroundOpaque.css};}`;for(let[n,r]of e.ansi.entries())t+=`${this._terminalSelector} .${Ff}${n} { color: ${r.css}; }${this._terminalSelector} .${Ff}${n}.xterm-dim { color: ${hf.multiplyOpacity(r,.5).css}; }${this._terminalSelector} .${If}${n} { background-color: ${r.css}; }`;t+=`${this._terminalSelector} .${Ff}257 { color: ${hf.opaque(e.background).css}; }${this._terminalSelector} .${Ff}257.xterm-dim { color: ${hf.multiplyOpacity(hf.opaque(e.background),.5).css}; }${this._terminalSelector} .${If}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 e=this._rowElements.length;e<=t;e++){let e=this._document.createElement(`div`);this._rowContainer.appendChild(e),this._rowElements.push(e)}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(Lf),this.renderRows(0,this._bufferService.rows-1)}handleFocus(){this._rowContainer.classList.add(Lf),this.renderRows(this._bufferService.buffer.y,this._bufferService.buffer.y)}handleSelectionChanged(e,t,n){if(this._selectionContainer.replaceChildren(),this._rowFactory.handleSelectionChanged(e,t,n),this.renderRows(0,this._bufferService.rows-1),!e||!t||(this._selectionRenderModel.update(this._terminal,e,t,n),!this._selectionRenderModel.hasSelection))return;let r=this._selectionRenderModel.viewportStartRow,i=this._selectionRenderModel.viewportEndRow,a=this._selectionRenderModel.viewportCappedStartRow,o=this._selectionRenderModel.viewportCappedEndRow,s=this._document.createDocumentFragment();if(n){let n=e[0]>t[0];s.appendChild(this._createSelectionElement(a,n?t[0]:e[0],n?e[0]:t[0],o-a+1))}else{let n=r===a?e[0]:0,c=a===i?t[0]:this._bufferService.cols;s.appendChild(this._createSelectionElement(a,n,c));let l=o-a-1;if(s.appendChild(this._createSelectionElement(a+1,0,this._bufferService.cols,l)),a!==o){let e=i===o?t[0]:this._bufferService.cols;s.appendChild(this._createSelectionElement(o,0,e))}}this._selectionContainer.appendChild(s)}_createSelectionElement(e,t,n,r=1){let i=this._document.createElement(`div`),a=t*this.dimensions.css.cell.width,o=this.dimensions.css.cell.width*(n-t);return a+o>this.dimensions.css.canvas.width&&(o=this.dimensions.css.canvas.width-a),i.style.height=`${r*this.dimensions.css.cell.height}px`,i.style.top=`${e*this.dimensions.css.cell.height}px`,i.style.left=`${a}px`,i.style.width=`${o}px`,i}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 n=this._bufferService.buffer,r=n.ybase+n.y,i=Math.min(n.x,this._bufferService.cols-1),a=this._coreService.decPrivateModes.cursorBlink??this._optionsService.rawOptions.cursorBlink,o=this._coreService.decPrivateModes.cursorStyle??this._optionsService.rawOptions.cursorStyle,s=this._optionsService.rawOptions.cursorInactiveStyle;for(let c=e;c<=t;c++){let e=c+n.ydisp,t=this._rowElements[c],l=n.lines.get(e);if(!t||!l)break;t.replaceChildren(...this._rowFactory.createRow(l,e,e===r,o,s,i,a,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${Nf}${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,n,r,i,a){n<0&&(e=0),r<0&&(t=0);let o=this._bufferService.rows-1;n=Math.max(Math.min(n,o),0),r=Math.max(Math.min(r,o),0),i=Math.min(i,this._bufferService.cols);let s=this._bufferService.buffer,c=s.ybase+s.y,l=Math.min(s.x,i-1),u=this._optionsService.rawOptions.cursorBlink,d=this._optionsService.rawOptions.cursorStyle,f=this._optionsService.rawOptions.cursorInactiveStyle;for(let o=n;o<=r;++o){let p=o+s.ydisp,m=this._rowElements[o],h=s.lines.get(p);if(!m||!h)break;m.replaceChildren(...this._rowFactory.createRow(h,p,p===c,d,f,l,u,this.dimensions.css.cell.width,this._widthCache,a?o===n?e:0:-1,a?(o===r?t:i)-1:-1))}}};Bf=uc([V(7,Bc),V(8,Jc),V(9,Hc),V(10,Ic),V(11,Rc),V(12,Yc),V(13,el)],Bf);var Vf=class extends U{constructor(e,t,n){super(),this._optionsService=n,this.width=0,this.height=0,this._onCharSizeChange=this._register(new W),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this._register(new Uf(this._optionsService))}catch{this._measureStrategy=this._register(new Hf(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())}};Vf=uc([V(2,Hc)],Vf);var Q=class extends U{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)}},Hf=class extends Q{constructor(e,t,n){super(),this._document=e,this._parentElement=t,this._optionsService=n,this._measureElement=this._document.createElement(`span`),this._measureElement.classList.add(`xterm-char-measure-element`),this._measureElement.textContent=`W`.repeat(32),this._measureElement.setAttribute(`aria-hidden`,`true`),this._measureElement.style.whiteSpace=`pre`,this._measureElement.style.fontKerning=`none`,this._parentElement.appendChild(this._measureElement)}measure(){return this._measureElement.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._measureElement.style.fontSize=`${this._optionsService.rawOptions.fontSize}px`,this._validateAndSet(Number(this._measureElement.offsetWidth)/32,Number(this._measureElement.offsetHeight)),this._result}},Uf=class extends Q{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 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}},Wf=class extends U{constructor(e,t,n){super(),this._textarea=e,this._window=t,this.mainDocument=n,this._isFocused=!1,this._cachedIsFocused=void 0,this._screenDprMonitor=this._register(new Gf(this._window)),this._onDprChange=this._register(new W),this.onDprChange=this._onDprChange.event,this._onWindowChange=this._register(new W),this.onWindowChange=this._onWindowChange.event,this._register(this.onWindowChange(e=>this._screenDprMonitor.setWindow(e))),this._register(Ml.forward(this._screenDprMonitor.onDprChange,this._onDprChange)),this._register(Y(this._textarea,`focus`,()=>this._isFocused=!0)),this._register(Y(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}},Gf=class extends U{constructor(e){super(),this._parentWindow=e,this._windowResizeListener=this._register(new Tl),this._onDprChange=this._register(new W),this.onDprChange=this._onDprChange.event,this._outerListener=()=>this._setDprAndFireIfDiffers(),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._updateDpr(),this._setWindowResizeListener(),this._register(Sl(()=>this.clearListener()))}setWindow(e){this._parentWindow=e,this._setWindowResizeListener(),this._setDprAndFireIfDiffers()}_setWindowResizeListener(){this._windowResizeListener.value=Y(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)}},Kf=class extends U{constructor(){super(),this.linkProviders=[],this._register(Sl(()=>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 qf(e,t,n){let r=n.getBoundingClientRect(),i=e.getComputedStyle(n),a=parseInt(i.getPropertyValue(`padding-left`)),o=parseInt(i.getPropertyValue(`padding-top`));return[t.clientX-r.left-a,t.clientY-r.top-o]}function Jf(e,t,n,r,i,a,o,s,c){if(!a)return;let l=qf(e,t,n);if(l)return l[0]=Math.ceil((l[0]+(c?o/2:0))/o),l[1]=Math.ceil(l[1]/s),l[0]=Math.min(Math.max(l[0],1),r+ +!!c),l[1]=Math.min(Math.max(l[1],1),i),l}var Yf=class{constructor(e,t){this._renderService=e,this._charSizeService=t}getCoords(e,t,n,r,i){return Jf(window,e,t,n,r,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,i)}getMouseReportCoords(e,t){let n=qf(window,e,t);if(this._charSizeService.hasValidSize)return n[0]=Math.min(Math.max(n[0],0),this._renderService.dimensions.css.canvas.width-1),n[1]=Math.min(Math.max(n[1],0),this._renderService.dimensions.css.canvas.height-1),{col:Math.floor(n[0]/this._renderService.dimensions.css.cell.width),row:Math.floor(n[1]/this._renderService.dimensions.css.cell.height),x:Math.floor(n[0]),y:Math.floor(n[1])}}};Yf=uc([V(0,Zc),V(1,Jc)],Yf);var Xf=class{constructor(e,t){this._renderCallback=e,this._coreBrowserService=t,this._refreshCallbacks=[]}dispose(){this._animationFrame&&=(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),void 0)}addRefreshCallback(e){return this._refreshCallbacks.push(e),this._animationFrame||=this._coreBrowserService.window.requestAnimationFrame(()=>this._innerRefresh()),this._animationFrame}refresh(e,t,n){this._rowCount=n,e=e===void 0?0:e,t=t===void 0?this._rowCount-1:t,this._rowStart=this._rowStart===void 0?e:Math.min(this._rowStart,e),this._rowEnd=this._rowEnd===void 0?t:Math.max(this._rowEnd,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=[]}},Zf={};lc(Zf,{getSafariVersion:()=>ip,isChromeOS:()=>up,isFirefox:()=>tp,isIpad:()=>op,isIphone:()=>sp,isLegacyEdge:()=>np,isLinux:()=>lp,isMac:()=>ap,isNode:()=>Qf,isSafari:()=>rp,isWindows:()=>cp});var Qf=typeof process<`u`&&`title`in process,$f=Qf?`node`:navigator.userAgent,ep=Qf?`node`:navigator.platform,tp=$f.includes(`Firefox`),np=$f.includes(`Edge`),rp=/^((?!chrome|android).)*safari/i.test($f);function ip(){if(!rp)return 0;let e=$f.match(/Version\/(\d+)/);return e===null||e.length<2?0:parseInt(e[1])}var ap=[`Macintosh`,`MacIntel`,`MacPPC`,`Mac68K`].includes(ep),op=ep===`iPad`,sp=ep===`iPhone`,cp=[`Windows`,`Win16`,`Win32`,`WinCE`].includes(ep),lp=ep.indexOf(`Linux`)>=0,up=/\bCrOS\b/.test($f),dp=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),void 0),this._i=0,this._tasks.length=0}_start(){this._idleCallback||=this._requestCallback(this._process.bind(this))}_process(e){this._idleCallback=void 0;let t=0,n=0,r=e.timeRemaining(),i=0;for(;this._i<this._tasks.length;){if(t=performance.now(),this._tasks[this._i]()||this._i++,t=Math.max(1,performance.now()-t),n=Math.max(t,n),i=e.timeRemaining(),n*1.5>i){r-t<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(r-t))}ms`),this._start();return}r=i}this.clear()}},fp=class extends dp{_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())}}},pp=class extends dp{_requestCallback(e){return requestIdleCallback(e)}_cancelCallback(e){cancelIdleCallback(e)}},mp=!Qf&&`requestIdleCallback`in window?pp:fp,hp=class{constructor(){this._queue=new mp}set(e){this._queue.clear(),this._queue.enqueue(e)}flush(){this._queue.flush()}},gp=class extends U{constructor(e,t,n,r,i,a,o,s,c){super(),this._rowCount=e,this._optionsService=n,this._charSizeService=r,this._coreService=i,this._coreBrowserService=s,this._renderer=this._register(new Tl),this._pausedResizeTask=new hp,this._observerDisposable=this._register(new Tl),this._isPaused=!1,this._needsFullRefresh=!1,this._isNextRenderRedrawOnly=!0,this._needsSelectionRefresh=!1,this._canvasWidth=0,this._canvasHeight=0,this._selectionState={start:void 0,end:void 0,columnSelectMode:!1},this._onDimensionsChange=this._register(new W),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this._register(new W),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this._register(new W),this.onRender=this._onRender.event,this._onRefreshRequest=this._register(new W),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new Xf((e,t)=>this._renderRows(e,t),this._coreBrowserService),this._register(this._renderDebouncer),this._syncOutputHandler=new _p(this._coreBrowserService,this._coreService,()=>this._fullRefresh()),this._register(Sl(()=>this._syncOutputHandler.dispose())),this._register(this._coreBrowserService.onDprChange(()=>this.handleDevicePixelRatioChange())),this._register(o.onResize(()=>this._fullRefresh())),this._register(o.buffers.onBufferActivate(()=>this._renderer.value?.clear())),this._register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this._register(this._charSizeService.onCharSizeChange(()=>this.handleCharSizeChanged())),this._register(a.onDecorationRegistered(()=>this._fullRefresh())),this._register(a.onDecorationRemoved(()=>this._fullRefresh())),this._register(this._optionsService.onMultipleOptionChange([`customGlyphs`,`drawBoldTextInBrightColors`,`letterSpacing`,`lineHeight`,`fontFamily`,`fontSize`,`fontWeight`,`fontWeightBold`,`minimumContrastRatio`,`rescaleOverlappingGlyphs`],()=>{this.clear(),this.handleResize(o.cols,o.rows),this._fullRefresh()})),this._register(this._optionsService.onMultipleOptionChange([`cursorBlink`,`cursorStyle`],()=>this.refreshRows(o.buffer.y,o.buffer.y,!0))),this._register(c.onChangeColors(()=>this._fullRefresh())),this._registerIntersectionObserver(this._coreBrowserService.window,t),this._register(this._coreBrowserService.onWindowChange(e=>this._registerIntersectionObserver(e,t)))}get dimensions(){return this._renderer.value.dimensions}_registerIntersectionObserver(e,t){if(`IntersectionObserver`in e){let n=new e.IntersectionObserver(e=>this._handleIntersectionChange(e[e.length-1]),{threshold:0});n.observe(t),this._observerDisposable.value=Sl(()=>n.disconnect())}}_handleIntersectionChange(e){this._isPaused=e.isIntersecting===void 0?e.intersectionRatio===0:!e.isIntersecting,!this._isPaused&&!this._charSizeService.hasValidSize&&this._charSizeService.measure(),!this._isPaused&&this._needsFullRefresh&&(this._pausedResizeTask.flush(),this.refreshRows(0,this._rowCount-1),this._needsFullRefresh=!1)}refreshRows(e,t,n=!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)),n||(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),!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(e=>this.refreshRows(e.start,e.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,n){this._selectionState.start=e,this._selectionState.end=t,this._selectionState.columnSelectMode=n,this._renderer.value?.handleSelectionChanged(e,t,n)}handleCursorMove(){this._renderer.value?.handleCursorMove()}clear(){this._renderer.value?.clear()}};gp=uc([V(2,Hc),V(3,Jc),V(4,Rc),V(5,Gc),V(6,Ic),V(7,Yc),V(8,el)],gp);var _p=class{constructor(e,t,n){this._coreBrowserService=e,this._coreService=t,this._onTimeout=n,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 vp(e,t,n,r){let i=n.buffer.x,a=n.buffer.y;if(!n.buffer.hasScrollback)return xp(i,a,e,t,n,r)+Sp(a,t,n,r)+Cp(i,a,e,t,n,r);let o;if(a===t)return o=i>e?`D`:`C`,Ap(Math.abs(i-e),kp(o,r));o=a>t?`D`:`C`;let s=Math.abs(a-t);return Ap(bp(a>t?e:i,n)+(s-1)*n.cols+1+yp(a>t?i:e,n),kp(o,r))}function yp(e,t){return e-1}function bp(e,t){return t.cols-e}function xp(e,t,n,r,i,a){return Sp(t,r,i,a).length===0?``:Ap(Op(e,t,e,t-Tp(t,i),!1,i).length,kp(`D`,a))}function Sp(e,t,n,r){let i=e-Tp(e,n),a=t-Tp(t,n);return Ap(Math.abs(i-a)-wp(e,t,n),kp(Dp(e,t),r))}function Cp(e,t,n,r,i,a){let o;o=Sp(t,r,i,a).length>0?r-Tp(r,i):t;let s=r,c=Ep(e,t,n,r,i,a);return Ap(Op(e,o,n,s,c===`C`,i).length,kp(c,a))}function wp(e,t,n){let r=0,i=e-Tp(e,n),a=t-Tp(t,n);for(let o=0;o<Math.abs(i-a);o++){let a=Dp(e,t)===`A`?-1:1;n.buffer.lines.get(i+a*o)?.isWrapped&&r++}return r}function Tp(e,t){let n=0,r=t.buffer.lines.get(e),i=r?.isWrapped;for(;i&&e>=0&&e<t.rows;)n++,r=t.buffer.lines.get(--e),i=r?.isWrapped;return n}function Ep(e,t,n,r,i,a){let o;return o=Sp(n,r,i,a).length>0?r-Tp(r,i):t,e<n&&o<=r||e>=n&&o<r?`C`:`D`}function Dp(e,t){return e>t?`A`:`B`}function Op(e,t,n,r,i,a){let o=e,s=t,c=``;for(;(o!==n||s!==r)&&s>=0&&s<a.buffer.lines.length;)o+=i?1:-1,i&&o>a.cols-1?(c+=a.buffer.translateBufferLineToString(s,!1,e,o),o=0,e=0,s++):!i&&o<0&&(c+=a.buffer.translateBufferLineToString(s,!1,0,e+1),o=a.cols-1,e=o,s--);return c+a.buffer.translateBufferLineToString(s,!1,e,o)}function kp(e,t){let n=t?`O`:`[`;return Z.ESC+n+e}function Ap(e,t){e=Math.floor(e);let n=``;for(let r=0;r<e;r++)n+=t;return n}var jp=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 Mp(e,t){if(e.start.y>e.end.y)throw 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 Np=50,Pp=15,Fp=50,Ip=500,Lp=RegExp(`\xA0`,`g`),Rp=class extends U{constructor(e,t,n,r,i,a,o,s,c){super(),this._element=e,this._screenElement=t,this._linkifier=n,this._bufferService=r,this._coreService=i,this._mouseService=a,this._optionsService=o,this._renderService=s,this._coreBrowserService=c,this._dragScrollAmount=0,this._enabled=!0,this._workCell=new Ac,this._mouseDownTimeStamp=0,this._oldHasSelection=!1,this._oldSelectionStart=void 0,this._oldSelectionEnd=void 0,this._onLinuxMouseSelection=this._register(new W),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this._register(new W),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this._register(new W),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this._register(new W),this.onRequestScrollLines=this._onRequestScrollLines.event,this._mouseMoveListener=e=>this._handleMouseMove(e),this._mouseUpListener=e=>this._handleMouseUp(e),this._coreService.onUserInput(()=>{this.hasSelection&&this.clearSelection()}),this._trimListener=this._bufferService.buffer.lines.onTrim(e=>this._handleTrim(e)),this._register(this._bufferService.buffers.onBufferActivate(e=>this._handleBufferActivate(e))),this.enable(),this._model=new jp(this._bufferService),this._activeSelectionMode=0,this._register(Sl(()=>{this._removeMouseDownListeners()})),this._register(this._bufferService.onResize(e=>{e.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 n=this._bufferService.buffer,r=[];if(this._activeSelectionMode===3){if(e[0]===t[0])return``;let i=e[0]<t[0]?e[0]:t[0],a=e[0]<t[0]?t[0]:e[0];for(let o=e[1];o<=t[1];o++){let e=n.translateBufferLineToString(o,!0,i,a);r.push(e)}}else{let i=e[1]===t[1]?t[0]:void 0;r.push(n.translateBufferLineToString(e[1],!0,e[0],i));for(let i=e[1]+1;i<=t[1]-1;i++){let e=n.lines.get(i),t=n.translateBufferLineToString(i,!0);e?.isWrapped?r[r.length-1]+=t:r.push(t)}if(e[1]!==t[1]){let e=n.lines.get(t[1]),i=n.translateBufferLineToString(t[1],!0,0,t[0]);e&&e.isWrapped?r[r.length-1]+=i:r.push(i)}}return r.map(e=>e.replace(Lp,` `)).join(cp?`\r
|
|
25
|
-
`:`
|
|
26
|
-
`)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(e){this._refreshAnimationFrame||=this._coreBrowserService.window.requestAnimationFrame(()=>this._refresh()),lp&&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),n=this._model.finalSelectionStart,r=this._model.finalSelectionEnd;return!n||!r||!t?!1:this._areCoordsInSelection(t,n,r)}isCellInSelection(e,t){let n=this._model.finalSelectionStart,r=this._model.finalSelectionEnd;return!n||!r?!1:this._areCoordsInSelection([e,t],n,r)}_areCoordsInSelection(e,t,n){return e[1]>t[1]&&e[1]<n[1]||t[1]===n[1]&&e[1]===t[1]&&e[0]>=t[0]&&e[0]<n[0]||t[1]<n[1]&&e[1]===n[1]&&e[0]<n[0]||t[1]<n[1]&&e[1]===t[1]&&e[0]>=t[0]}_selectWordAtCursor(e,t){let n=this._linkifier.currentLink?.link?.range;if(n)return this._model.selectionStart=[n.start.x-1,n.start.y-1],this._model.selectionStartLength=Mp(n,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=qf(this._coreBrowserService.window,e,this._screenElement)[1],n=this._renderService.dimensions.css.canvas.height;return t>=0&&t<=n?0:(t>n&&(t-=n),t=Math.min(Math.max(t,-Np),Np),t/=Np,t/Math.abs(t)+Math.round(t*(Pp-1)))}shouldForceSelection(e){return ap?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(),Fp)}_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&&!(ap&&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 n=this._bufferService.buffer;if(this._model.selectionEnd[1]<n.lines.length){let e=n.lines.get(this._model.selectionEnd[1]);e&&e.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<Ip&&e.altKey&&this._optionsService.rawOptions.altClickMovesCursor){if(this._bufferService.buffer.ybase===this._bufferService.buffer.ydisp){let t=this._mouseService.getCoords(e,this._element,this._bufferService.cols,this._bufferService.rows,!1);if(t&&t[0]!==void 0&&t[1]!==void 0){let e=vp(t[0]-1,t[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(e,!0)}}}else this._fireEventIfSelectionChanged()}_fireEventIfSelectionChanged(){let e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd,n=!!e&&!!t&&(e[0]!==t[0]||e[1]!==t[1]);n?!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,n):this._oldHasSelection&&this._fireOnSelectionChange(e,t,n)}_fireOnSelectionChange(e,t,n){this._oldSelectionStart=e,this._oldSelectionEnd=t,this._oldHasSelection=n,this._onSelectionChange.fire()}_handleBufferActivate(e){this.clearSelection(),this._trimListener.dispose(),this._trimListener=e.activeBuffer.lines.onTrim(e=>this._handleTrim(e))}_convertViewportColToCharacterIndex(e,t){let n=t;for(let r=0;t>=r;r++){let i=e.loadCell(r,this._workCell).getChars().length;this._workCell.getWidth()===0?n--:i>1&&t!==r&&(n+=i-1)}return n}setSelection(e,t,n){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[e,t],this._model.selectionStartLength=n,this.refresh(),this._fireEventIfSelectionChanged()}rightClickSelect(e){this._isClickInSelection(e)||(this._selectWordAtCursor(e,!1)&&this.refresh(!0),this._fireEventIfSelectionChanged())}_getWordAt(e,t,n=!0,r=!0){if(e[0]>=this._bufferService.cols)return;let i=this._bufferService.buffer,a=i.lines.get(e[1]);if(!a)return;let o=i.translateBufferLineToString(e[1],!1),s=this._convertViewportColToCharacterIndex(a,e[0]),c=s,l=e[0]-s,u=0,d=0,f=0,p=0;if(o.charAt(s)===` `){for(;s>0&&o.charAt(s-1)===` `;)s--;for(;c<o.length&&o.charAt(c+1)===` `;)c++}else{let t=e[0],n=e[0];a.getWidth(t)===0&&(u++,t--),a.getWidth(n)===2&&(d++,n++);let r=a.getString(n).length;for(r>1&&(p+=r-1,c+=r-1);t>0&&s>0&&!this._isCharWordSeparator(a.loadCell(t-1,this._workCell));){a.loadCell(t-1,this._workCell);let e=this._workCell.getChars().length;this._workCell.getWidth()===0?(u++,t--):e>1&&(f+=e-1,s-=e-1),s--,t--}for(;n<a.length&&c+1<o.length&&!this._isCharWordSeparator(a.loadCell(n+1,this._workCell));){a.loadCell(n+1,this._workCell);let e=this._workCell.getChars().length;this._workCell.getWidth()===2?(d++,n++):e>1&&(p+=e-1,c+=e-1),c++,n++}}c++;let m=s+l-u+f,h=Math.min(this._bufferService.cols,c-s+u+d-f-p);if(t||o.slice(s,c).trim()!==``){if(n&&m===0&&a.getCodePoint(0)!==32){let t=i.lines.get(e[1]-1);if(t&&a.isWrapped&&t.getCodePoint(this._bufferService.cols-1)!==32){let t=this._getWordAt([this._bufferService.cols-1,e[1]-1],!1,!0,!1);if(t){let e=this._bufferService.cols-t.start;m-=e,h+=e}}}if(r&&m+h===this._bufferService.cols&&a.getCodePoint(this._bufferService.cols-1)!==32){let t=i.lines.get(e[1]+1);if(t?.isWrapped&&t.getCodePoint(0)!==32){let t=this._getWordAt([0,e[1]+1],!1,!1,!0);t&&(h+=t.length)}}return{start:m,length:h}}}_selectWordAt(e,t){let n=this._getWordAt(e,t);if(n){for(;n.start<0;)n.start+=this._bufferService.cols,e[1]--;this._model.selectionStart=[n.start,e[1]],this._model.selectionStartLength=n.length}}_selectToWordAt(e){let t=this._getWordAt(e,!0);if(t){let n=e[1];for(;t.start<0;)t.start+=this._bufferService.cols,n--;if(!this._model.areSelectionValuesReversed())for(;t.start+t.length>this._bufferService.cols;)t.length-=this._bufferService.cols,n++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?t.start:t.start+t.length,n]}}_isCharWordSeparator(e){return e.getWidth()!==0&&this._optionsService.rawOptions.wordSeparator.indexOf(e.getChars())>=0}_selectLineAt(e){let t=this._bufferService.buffer.getWrappedRangeForLine(e),n={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=Mp(n,this._bufferService.cols)}};Rp=uc([V(3,Ic),V(4,Rc),V(5,Xc),V(6,Hc),V(7,Zc),V(8,Yc)],Rp);var zp=class{constructor(){this._data={}}set(e,t,n){this._data[e]||(this._data[e]={}),this._data[e][t]=n}get(e,t){return this._data[e]?this._data[e][t]:void 0}clear(){this._data={}}},Bp=class{constructor(){this._color=new zp,this._css=new zp}setCss(e,t,n){this._css.set(e,t,n)}getCss(e,t){return this._css.get(e,t)}setColor(e,t,n){this._color.set(e,t,n)}getColor(e,t){return this._color.get(e,t)}clear(){this._color.clear(),this._css.clear()}},Vp=Object.freeze((()=>{let e=[gf.toColor(`#2e3436`),gf.toColor(`#cc0000`),gf.toColor(`#4e9a06`),gf.toColor(`#c4a000`),gf.toColor(`#3465a4`),gf.toColor(`#75507b`),gf.toColor(`#06989a`),gf.toColor(`#d3d7cf`),gf.toColor(`#555753`),gf.toColor(`#ef2929`),gf.toColor(`#8ae234`),gf.toColor(`#fce94f`),gf.toColor(`#729fcf`),gf.toColor(`#ad7fa8`),gf.toColor(`#34e2e2`),gf.toColor(`#eeeeec`)],t=[0,95,135,175,215,255];for(let n=0;n<216;n++){let r=t[n/36%6|0],i=t[n/6%6|0],a=t[n%6];e.push({css:mf.toCss(r,i,a),rgba:mf.toRgba(r,i,a)})}for(let t=0;t<24;t++){let n=8+t*10;e.push({css:mf.toCss(n,n,n),rgba:mf.toRgba(n,n,n)})}return e})()),Hp=gf.toColor(`#ffffff`),Up=gf.toColor(`#000000`),Wp=gf.toColor(`#ffffff`),Gp=Up,Kp={css:`rgba(255, 255, 255, 0.3)`,rgba:4294967117},qp=Hp,Jp=class extends U{constructor(e){super(),this._optionsService=e,this._contrastCache=new Bp,this._halfContrastCache=new Bp,this._onChangeColors=this._register(new W),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:Hp,background:Up,cursor:Wp,cursorAccent:Gp,selectionForeground:void 0,selectionBackgroundTransparent:Kp,selectionBackgroundOpaque:hf.blend(Up,Kp),selectionInactiveBackgroundTransparent:Kp,selectionInactiveBackgroundOpaque:hf.blend(Up,Kp),scrollbarSliderBackground:hf.opacity(Hp,.2),scrollbarSliderHoverBackground:hf.opacity(Hp,.4),scrollbarSliderActiveBackground:hf.opacity(Hp,.5),overviewRulerBorder:Hp,ansi:Vp.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=Yp(e.foreground,Hp),t.background=Yp(e.background,Up),t.cursor=hf.blend(t.background,Yp(e.cursor,Wp)),t.cursorAccent=hf.blend(t.background,Yp(e.cursorAccent,Gp)),t.selectionBackgroundTransparent=Yp(e.selectionBackground,Kp),t.selectionBackgroundOpaque=hf.blend(t.background,t.selectionBackgroundTransparent),t.selectionInactiveBackgroundTransparent=Yp(e.selectionInactiveBackground,t.selectionBackgroundTransparent),t.selectionInactiveBackgroundOpaque=hf.blend(t.background,t.selectionInactiveBackgroundTransparent),t.selectionForeground=e.selectionForeground?Yp(e.selectionForeground,pf):void 0,t.selectionForeground===pf&&(t.selectionForeground=void 0),hf.isOpaque(t.selectionBackgroundTransparent)&&(t.selectionBackgroundTransparent=hf.opacity(t.selectionBackgroundTransparent,.3)),hf.isOpaque(t.selectionInactiveBackgroundTransparent)&&(t.selectionInactiveBackgroundTransparent=hf.opacity(t.selectionInactiveBackgroundTransparent,.3)),t.scrollbarSliderBackground=Yp(e.scrollbarSliderBackground,hf.opacity(t.foreground,.2)),t.scrollbarSliderHoverBackground=Yp(e.scrollbarSliderHoverBackground,hf.opacity(t.foreground,.4)),t.scrollbarSliderActiveBackground=Yp(e.scrollbarSliderActiveBackground,hf.opacity(t.foreground,.5)),t.overviewRulerBorder=Yp(e.overviewRulerBorder,qp),t.ansi=Vp.slice(),t.ansi[0]=Yp(e.black,Vp[0]),t.ansi[1]=Yp(e.red,Vp[1]),t.ansi[2]=Yp(e.green,Vp[2]),t.ansi[3]=Yp(e.yellow,Vp[3]),t.ansi[4]=Yp(e.blue,Vp[4]),t.ansi[5]=Yp(e.magenta,Vp[5]),t.ansi[6]=Yp(e.cyan,Vp[6]),t.ansi[7]=Yp(e.white,Vp[7]),t.ansi[8]=Yp(e.brightBlack,Vp[8]),t.ansi[9]=Yp(e.brightRed,Vp[9]),t.ansi[10]=Yp(e.brightGreen,Vp[10]),t.ansi[11]=Yp(e.brightYellow,Vp[11]),t.ansi[12]=Yp(e.brightBlue,Vp[12]),t.ansi[13]=Yp(e.brightMagenta,Vp[13]),t.ansi[14]=Yp(e.brightCyan,Vp[14]),t.ansi[15]=Yp(e.brightWhite,Vp[15]),e.extendedAnsi){let n=Math.min(t.ansi.length-16,e.extendedAnsi.length);for(let r=0;r<n;r++)t.ansi[r+16]=Yp(e.extendedAnsi[r],Vp[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 e=0;e<this._restoreColors.ansi.length;++e)this._colors.ansi[e]=this._restoreColors.ansi[e];else 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()}}};Jp=uc([V(0,Hc)],Jp);function Yp(e,t){if(e!==void 0)try{return gf.toColor(e)}catch{}return t}var Xp=class{constructor(...e){this._entries=new Map;for(let[t,n]of e)this.set(t,n)}set(e,t){let n=this._entries.get(e);return this._entries.set(e,t),n}forEach(e){for(let[t,n]of this._entries.entries())e(t,n)}has(e){return this._entries.has(e)}get(e){return this._entries.get(e)}},Zp=class{constructor(){this._services=new Xp,this._services.set(Bc,this)}setService(e,t){this._services.set(e,t)}getService(e){return this._services.get(e)}createInstance(e,...t){let n=Pc(e).sort((e,t)=>e.index-t.index),r=[];for(let t of n){let n=this._services.get(t.id);if(!n)throw Error(`[createInstance] ${e.name} depends on UNKNOWN service ${t.id._id}.`);r.push(n)}let i=n.length>0?n[0].index:t.length;if(t.length!==i)throw Error(`[createInstance] First service dependency of ${e.name} at position ${i+1} conflicts with ${t.length} static arguments`);return new e(...t,...r)}},Qp={trace:0,debug:1,info:2,warn:3,error:4,off:5},$p=`xterm.js: `,em=class extends U{constructor(e){super(),this._optionsService=e,this._logLevel=5,this._updateLogLevel(),this._register(this._optionsService.onSpecificOptionChange(`logLevel`,()=>this._updateLogLevel())),tm=this}get logLevel(){return this._logLevel}_updateLogLevel(){this._logLevel=Qp[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,n){this._evalLazyOptionalParams(n),e.call(console,(this._optionsService.options.logger?``:$p)+t,...n)}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)}};em=uc([V(0,Hc)],em);var tm,nm=class extends U{constructor(e){super(),this._maxLength=e,this.onDeleteEmitter=this._register(new W),this.onDelete=this.onDeleteEmitter.event,this.onInsertEmitter=this._register(new W),this.onInsert=this.onInsertEmitter.event,this.onTrimEmitter=this._register(new W),this.onTrim=this.onTrimEmitter.event,this._array=Array(this._maxLength),this._startIndex=0,this._length=0}get maxLength(){return this._maxLength}set maxLength(e){if(this._maxLength===e)return;let t=Array(e);for(let n=0;n<Math.min(e,this.length);n++)t[n]=this._array[this._getCyclicIndex(n)];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 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,...n){if(t){for(let n=e;n<this._length-t;n++)this._array[this._getCyclicIndex(n)]=this._array[this._getCyclicIndex(n+t)];this._length-=t,this.onDeleteEmitter.fire({index:e,amount:t})}for(let t=this._length-1;t>=e;t--)this._array[this._getCyclicIndex(t+n.length)]=this._array[this._getCyclicIndex(t)];for(let t=0;t<n.length;t++)this._array[this._getCyclicIndex(e+t)]=n[t];if(n.length&&this.onInsertEmitter.fire({index:e,amount:n.length}),this._length+n.length>this._maxLength){let e=this._length+n.length-this._maxLength;this._startIndex+=e,this._length=this._maxLength,this.onTrimEmitter.fire(e)}else this._length+=n.length}trimStart(e){e>this._length&&(e=this._length),this._startIndex+=e,this._length-=e,this.onTrimEmitter.fire(e)}shiftElements(e,t,n){if(!(t<=0)){if(e<0||e>=this._length)throw Error(`start argument out of range`);if(e+n<0)throw Error(`Cannot shift elements in list beyond index 0`);if(n>0){for(let r=t-1;r>=0;r--)this.set(e+r+n,this.get(e+r));let r=e+t+n-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+n,this.get(e+r))}}_getCyclicIndex(e){return(this._startIndex+e)%this._maxLength}},$=3,rm=Object.freeze(new Oc),im=0,am=2,om=class e{constructor(e,t,n=!1){this.isWrapped=n,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(e*$);let r=t||Ac.fromCharData([0,Ec,1,0]);for(let t=0;t<e;++t)this.setCell(t,r);this.length=e}get(e){let t=this._data[e*$+0],n=t&2097151;return[this._data[e*$+1],t&2097152?this._combined[e]:n?Sc(n):``,t>>22,t&2097152?this._combined[e].charCodeAt(this._combined[e].length-1):n]}set(e,t){this._data[e*$+1]=t[0],t[1].length>1?(this._combined[e]=t[1],this._data[e*$+0]=e|2097152|t[2]<<22):this._data[e*$+0]=t[1].charCodeAt(0)|t[2]<<22}getWidth(e){return this._data[e*$+0]>>22}hasWidth(e){return this._data[e*$+0]&12582912}getFg(e){return this._data[e*$+1]}getBg(e){return this._data[e*$+2]}hasContent(e){return this._data[e*$+0]&4194303}getCodePoint(e){let t=this._data[e*$+0];return t&2097152?this._combined[e].charCodeAt(this._combined[e].length-1):t&2097151}isCombined(e){return this._data[e*$+0]&2097152}getString(e){let t=this._data[e*$+0];return t&2097152?this._combined[e]:t&2097151?Sc(t&2097151):``}isProtected(e){return this._data[e*$+2]&536870912}loadCell(e,t){return im=e*$,t.content=this._data[im+0],t.fg=this._data[im+1],t.bg=this._data[im+2],t.content&2097152&&(t.combinedData=this._combined[e]),t.bg&268435456&&(t.extended=this._extendedAttrs[e]),t}setCell(e,t){t.content&2097152&&(this._combined[e]=t.combinedData),t.bg&268435456&&(this._extendedAttrs[e]=t.extended),this._data[e*$+0]=t.content,this._data[e*$+1]=t.fg,this._data[e*$+2]=t.bg}setCellFromCodepoint(e,t,n,r){r.bg&268435456&&(this._extendedAttrs[e]=r.extended),this._data[e*$+0]=t|n<<22,this._data[e*$+1]=r.fg,this._data[e*$+2]=r.bg}addCodepointToCell(e,t,n){let r=this._data[e*$+0];r&2097152?this._combined[e]+=Sc(t):r&2097151?(this._combined[e]=Sc(r&2097151)+Sc(t),r&=-2097152,r|=2097152):r=t|1<<22,n&&(r&=-12582913,r|=n<<22),this._data[e*$+0]=r}insertCells(e,t,n){if(e%=this.length,e&&this.getWidth(e-1)===2&&this.setCellFromCodepoint(e-1,0,1,n),t<this.length-e){let r=new Ac;for(let n=this.length-e-t-1;n>=0;--n)this.setCell(e+t+n,this.loadCell(e+n,r));for(let r=0;r<t;++r)this.setCell(e+r,n)}else for(let t=e;t<this.length;++t)this.setCell(t,n);this.getWidth(this.length-1)===2&&this.setCellFromCodepoint(this.length-1,0,1,n)}deleteCells(e,t,n){if(e%=this.length,t<this.length-e){let r=new Ac;for(let n=0;n<this.length-e-t;++n)this.setCell(e+n,this.loadCell(e+t+n,r));for(let e=this.length-t;e<this.length;++e)this.setCell(e,n)}else for(let t=e;t<this.length;++t)this.setCell(t,n);e&&this.getWidth(e-1)===2&&this.setCellFromCodepoint(e-1,0,1,n),this.getWidth(e)===0&&!this.hasContent(e)&&this.setCellFromCodepoint(e,0,1,n)}replaceCells(e,t,n,r=!1){if(r)for(e&&this.getWidth(e-1)===2&&!this.isProtected(e-1)&&this.setCellFromCodepoint(e-1,0,1,n),t<this.length&&this.getWidth(t-1)===2&&!this.isProtected(t)&&this.setCellFromCodepoint(t,0,1,n);e<t&&e<this.length;)this.isProtected(e)||this.setCell(e,n),e++;else for(e&&this.getWidth(e-1)===2&&this.setCellFromCodepoint(e-1,0,1,n),t<this.length&&this.getWidth(t-1)===2&&this.setCellFromCodepoint(t,0,1,n);e<t&&e<this.length;)this.setCell(e++,n)}resize(e,t){if(e===this.length)return this._data.length*4*am<this._data.buffer.byteLength;let n=e*$;if(e>this.length){if(this._data.buffer.byteLength>=n*4)this._data=new Uint32Array(this._data.buffer,0,n);else{let e=new Uint32Array(n);e.set(this._data),this._data=e}for(let n=this.length;n<e;++n)this.setCell(n,t)}else{this._data=this._data.subarray(0,n);let t=Object.keys(this._combined);for(let n=0;n<t.length;n++){let r=parseInt(t[n],10);r>=e&&delete this._combined[r]}let r=Object.keys(this._extendedAttrs);for(let t=0;t<r.length;t++){let n=parseInt(r[t],10);n>=e&&delete this._extendedAttrs[n]}}return this.length=e,n*4*am<this._data.buffer.byteLength}cleanupMemory(){if(this._data.length*4*am<this._data.buffer.byteLength){let e=new Uint32Array(this._data.length);return e.set(this._data),this._data=e,1}return 0}fill(e,t=!1){if(t)for(let t=0;t<this.length;++t)this.isProtected(t)||this.setCell(t,e);else{this._combined={},this._extendedAttrs={};for(let t=0;t<this.length;++t)this.setCell(t,e)}}copyFrom(e){this.length===e.length?this._data.set(e._data):this._data=new Uint32Array(e._data),this.length=e.length,this._combined={};for(let t in e._combined)this._combined[t]=e._combined[t];this._extendedAttrs={};for(let t in e._extendedAttrs)this._extendedAttrs[t]=e._extendedAttrs[t];this.isWrapped=e.isWrapped}clone(){let t=new e(0);t._data=new Uint32Array(this._data),t.length=this.length;for(let e in this._combined)t._combined[e]=this._combined[e];for(let e in this._extendedAttrs)t._extendedAttrs[e]=this._extendedAttrs[e];return t.isWrapped=this.isWrapped,t}getTrimmedLength(){for(let e=this.length-1;e>=0;--e)if(this._data[e*$+0]&4194303)return e+(this._data[e*$+0]>>22);return 0}getNoBgTrimmedLength(){for(let e=this.length-1;e>=0;--e)if(this._data[e*$+0]&4194303||this._data[e*$+2]&50331648)return e+(this._data[e*$+0]>>22);return 0}copyCellsFrom(e,t,n,r,i){let a=e._data;if(i)for(let i=r-1;i>=0;i--){for(let e=0;e<$;e++)this._data[(n+i)*$+e]=a[(t+i)*$+e];a[(t+i)*$+2]&268435456&&(this._extendedAttrs[n+i]=e._extendedAttrs[t+i])}else for(let i=0;i<r;i++){for(let e=0;e<$;e++)this._data[(n+i)*$+e]=a[(t+i)*$+e];a[(t+i)*$+2]&268435456&&(this._extendedAttrs[n+i]=e._extendedAttrs[t+i])}let o=Object.keys(e._combined);for(let r=0;r<o.length;r++){let i=parseInt(o[r],10);i>=t&&(this._combined[i-t+n]=e._combined[i])}}translateToString(e,t,n,r){t??=0,n??=this.length,e&&(n=Math.min(n,this.getTrimmedLength())),r&&(r.length=0);let i=``;for(;t<n;){let e=this._data[t*$+0],n=e&2097151,a=e&2097152?this._combined[t]:n?Sc(n):Dc;if(i+=a,r)for(let e=0;e<a.length;++e)r.push(t);t+=e>>22||1}return r&&r.push(t),i}};function sm(e,t,n,r,i,a){let o=[];for(let s=0;s<e.length-1;s++){let c=s,l=e.get(++c);if(!l.isWrapped)continue;let u=[e.get(s)];for(;c<e.length&&l.isWrapped;)u.push(l),l=e.get(++c);if(!a&&r>=s&&r<c){s+=u.length-1;continue}let d=0,f=dm(u,d,t),p=1,m=0;for(;p<u.length;){let e=dm(u,p,t),r=e-m,a=n-f,o=Math.min(r,a);u[d].copyCellsFrom(u[p],m,f,o,!1),f+=o,f===n&&(d++,f=0),m+=o,m===e&&(p++,m=0),f===0&&d!==0&&u[d-1].getWidth(n-1)===2&&(u[d].copyCellsFrom(u[d-1],n-1,f++,1,!1),u[d-1].setCell(n-1,i))}u[d].replaceCells(f,n,i);let h=0;for(let e=u.length-1;e>0&&(e>d||u[e].getTrimmedLength()===0);e--)h++;h>0&&(o.push(s+u.length-h),o.push(h)),s+=u.length-1}return o}function cm(e,t){let n=[],r=0,i=t[r],a=0;for(let o=0;o<e.length;o++)if(i===o){let n=t[++r];e.onDeleteEmitter.fire({index:o-a,amount:n}),o+=n-1,a+=n,i=t[++r]}else n.push(o);return{layout:n,countRemoved:a}}function lm(e,t){let n=[];for(let r=0;r<t.length;r++)n.push(e.get(t[r]));for(let t=0;t<n.length;t++)e.set(t,n[t]);e.length=t.length}function um(e,t,n){let r=[],i=e.map((n,r)=>dm(e,r,t)).reduce((e,t)=>e+t),a=0,o=0,s=0;for(;s<i;){if(i-s<n){r.push(i-s);break}a+=n;let c=dm(e,o,t);a>c&&(a-=c,o++);let l=e[o].getWidth(a-1)===2;l&&a--;let u=l?n-1:n;r.push(u),s+=u}return r}function dm(e,t,n){if(t===e.length-1)return e[t].getTrimmedLength();let r=!e[t].hasContent(n-1)&&e[t].getWidth(n-1)===1,i=e[t+1].getWidth(0)===2;return r&&i?n-1:n}var fm=class e{constructor(t){this.line=t,this.isDisposed=!1,this._disposables=[],this._id=e._nextId++,this._onDispose=this.register(new W),this.onDispose=this._onDispose.event}get id(){return this._id}dispose(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire(),bl(this._disposables),this._disposables.length=0)}register(e){return this._disposables.push(e),e}};fm._nextId=1;var pm=fm,mm={},hm=mm.B;mm[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:`≥`,"{":`π`,"|":`≠`,"}":`£`,"~":`·`},mm.A={"#":`£`},mm.B=void 0,mm[4]={"#":`£`,"@":`¾`,"[":`ij`,"\\":`½`,"]":`|`,"{":`¨`,"|":`f`,"}":`¼`,"~":`´`},mm.C=mm[5]={"[":`Ä`,"\\":`Ö`,"]":`Å`,"^":`Ü`,"`":`é`,"{":`ä`,"|":`ö`,"}":`å`,"~":`ü`},mm.R={"#":`£`,"@":`à`,"[":`°`,"\\":`ç`,"]":`§`,"{":`é`,"|":`ù`,"}":`è`,"~":`¨`},mm.Q={"@":`à`,"[":`â`,"\\":`ç`,"]":`ê`,"^":`î`,"`":`ô`,"{":`é`,"|":`ù`,"}":`è`,"~":`û`},mm.K={"@":`§`,"[":`Ä`,"\\":`Ö`,"]":`Ü`,"{":`ä`,"|":`ö`,"}":`ü`,"~":`ß`},mm.Y={"#":`£`,"@":`§`,"[":`°`,"\\":`ç`,"]":`é`,"`":`ù`,"{":`à`,"|":`ò`,"}":`è`,"~":`ì`},mm.E=mm[6]={"@":`Ä`,"[":`Æ`,"\\":`Ø`,"]":`Å`,"^":`Ü`,"`":`ä`,"{":`æ`,"|":`ø`,"}":`å`,"~":`ü`},mm.Z={"#":`£`,"@":`§`,"[":`¡`,"\\":`Ñ`,"]":`¿`,"{":`°`,"|":`ñ`,"}":`ç`},mm.H=mm[7]={"@":`É`,"[":`Ä`,"\\":`Ö`,"]":`Å`,"^":`Ü`,"`":`é`,"{":`ä`,"|":`ö`,"}":`å`,"~":`ü`},mm[`=`]={"#":`ù`,"@":`à`,"[":`é`,"\\":`ç`,"]":`ê`,"^":`î`,_:`è`,"`":`ô`,"{":`ä`,"|":`ö`,"}":`ü`,"~":`û`};var gm=4294967295,_m=class{constructor(e,t,n){this._hasScrollback=e,this._optionsService=t,this._bufferService=n,this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.tabs={},this.savedY=0,this.savedX=0,this.savedCurAttrData=rm.clone(),this.savedCharset=hm,this.markers=[],this._nullCell=Ac.fromCharData([0,Ec,1,0]),this._whitespaceCell=Ac.fromCharData([0,Dc,1,32]),this._isClearing=!1,this._memoryCleanupQueue=new mp,this._memoryCleanupPosition=0,this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new nm(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 kc),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 kc),this._whitespaceCell}getBlankLine(e,t){return new om(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>gm?gm:t}fillViewportRows(e){if(this.lines.length===0){e===void 0&&(e=rm);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 nm(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(e,t){let n=this.getNullCell(rm),r=0,i=this._getCorrectBufferLength(t);if(i>this.lines.maxLength&&(this.lines.maxLength=i),this.lines.length>0){if(this._cols<e)for(let t=0;t<this.lines.length;t++)r+=+this.lines.get(t).resize(e,n);let a=0;if(this._rows<t)for(let r=this._rows;r<t;r++)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 om(e,n)):this.ybase>0&&this.lines.length<=this.ybase+this.y+a+1?(this.ybase--,a++,this.ydisp>0&&this.ydisp--):this.lines.push(new om(e,n)));else for(let e=this._rows;e>t;e--)this.lines.length>t+this.ybase&&(this.lines.length>this.ybase+this.y+1?this.lines.pop():(this.ybase++,this.ydisp++));if(i<this.lines.maxLength){let e=this.lines.length-i;e>0&&(this.lines.trimStart(e),this.ybase=Math.max(this.ybase-e,0),this.ydisp=Math.max(this.ydisp-e,0),this.savedY=Math.max(this.savedY-e,0)),this.lines.maxLength=i}this.x=Math.min(this.x,e-1),this.y=Math.min(this.y,t-1),a&&(this.y+=a),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 t=0;t<this.lines.length;t++)r+=+this.lines.get(t).resize(e,n);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 n=this._optionsService.rawOptions.reflowCursorLine,r=sm(this.lines,this._cols,e,this.ybase+this.y,this.getNullCell(rm),n);if(r.length>0){let n=cm(this.lines,r);lm(this.lines,n.layout),this._reflowLargerAdjustViewport(e,t,n.countRemoved)}}_reflowLargerAdjustViewport(e,t,n){let r=this.getNullCell(rm),i=n;for(;i-->0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length<t&&this.lines.push(new om(e,r))):(this.ydisp===this.ybase&&this.ydisp--,this.ybase--);this.savedY=Math.max(this.savedY-n,0)}_reflowSmaller(e,t){let n=this._optionsService.rawOptions.reflowCursorLine,r=this.getNullCell(rm),i=[],a=0;for(let o=this.lines.length-1;o>=0;o--){let s=this.lines.get(o);if(!s||!s.isWrapped&&s.getTrimmedLength()<=e)continue;let c=[s];for(;s.isWrapped&&o>0;)s=this.lines.get(--o),c.unshift(s);if(!n){let e=this.ybase+this.y;if(e>=o&&e<o+c.length)continue}let l=c[c.length-1].getTrimmedLength(),u=um(c,this._cols,e),d=u.length-c.length,f;f=this.ybase===0&&this.y!==this.lines.length-1?Math.max(0,this.y-this.lines.maxLength+d):Math.max(0,this.lines.length-this.lines.maxLength+d);let p=[];for(let e=0;e<d;e++){let e=this.getBlankLine(rm,!0);p.push(e)}p.length>0&&(i.push({start:o+c.length+a,newLines:p}),a+=p.length),c.push(...p);let m=u.length-1,h=u[m];h===0&&(m--,h=u[m]);let g=c.length-d-1,_=l;for(;g>=0;){let e=Math.min(_,h);if(c[m]===void 0)break;c[m].copyCellsFrom(c[g],_-e,h-e,e,!0),h-=e,h===0&&(m--,h=u[m]),_-=e,_===0&&(g--,_=dm(c,Math.max(g,0),this._cols))}for(let t=0;t<c.length;t++)u[t]<e&&c[t].setCell(u[t],r);let v=d-f;for(;v-->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+a)-t&&(this.ybase===this.ydisp&&this.ydisp++,this.ybase++);this.savedY=Math.min(this.savedY+d,this.ybase+t-1)}if(i.length>0){let e=[],t=[];for(let e=0;e<this.lines.length;e++)t.push(this.lines.get(e));let n=this.lines.length,r=n-1,o=0,s=i[o];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+a);let c=0;for(let l=Math.min(this.lines.maxLength-1,n+a-1);l>=0;l--)if(s&&s.start>r+c){for(let e=s.newLines.length-1;e>=0;e--)this.lines.set(l--,s.newLines[e]);l++,e.push({index:r+1,amount:s.newLines.length}),c+=s.newLines.length,s=i[++o]}else this.lines.set(l,t[r--]);let l=0;for(let t=e.length-1;t>=0;t--)e[t].index+=l,this.lines.onInsertEmitter.fire(e[t]),l+=e[t].amount;let u=Math.max(0,n+a-this.lines.maxLength);u>0&&this.lines.onTrimEmitter.fire(u)}}translateBufferLineToString(e,t,n=0,r){let i=this.lines.get(e);return i?i.translateToString(t,n,r):``}getWrappedRangeForLine(e){let t=e,n=e;for(;t>0&&this.lines.get(t).isWrapped;)t--;for(;n+1<this.lines.length&&this.lines.get(n+1).isWrapped;)n++;return{first:t,last:n}}setupTabStops(e){for(e==null?(this.tabs={},e=0):this.tabs[e]||(e=this.prevStop(e));e<this._cols;e+=this._optionsService.rawOptions.tabStopWidth)this.tabs[e]=!0}prevStop(e){for(e??=this.x;!this.tabs[--e]&&e>0;);return e>=this._cols?this._cols-1:e<0?0:e}nextStop(e){for(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 pm(e);return this.markers.push(t),t.register(this.lines.onTrim(e=>{t.line-=e,t.line<0&&t.dispose()})),t.register(this.lines.onInsert(e=>{t.line>=e.index&&(t.line+=e.amount)})),t.register(this.lines.onDelete(e=>{t.line>=e.index&&t.line<e.index+e.amount&&t.dispose(),t.line>e.index&&(t.line-=e.amount)})),t.register(t.onDispose(()=>this._removeMarker(t))),t}_removeMarker(e){this._isClearing||this.markers.splice(this.markers.indexOf(e),1)}},vm=class extends U{constructor(e,t){super(),this._optionsService=e,this._bufferService=t,this._onBufferActivate=this._register(new W),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 _m(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new _m(!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)}},ym=2,bm=1,xm=class extends U{constructor(e){super(),this.isUserScrolling=!1,this._onResize=this._register(new W),this.onResize=this._onResize.event,this._onScroll=this._register(new W),this.onScroll=this._onScroll.event,this.cols=Math.max(e.rawOptions.cols||0,ym),this.rows=Math.max(e.rawOptions.rows||0,bm),this.buffers=this._register(new vm(e,this)),this._register(this.buffers.onBufferActivate(e=>{this._onScroll.fire(e.activeBuffer.ydisp)}))}get buffer(){return this.buffers.active}resize(e,t){let n=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:n,rowsChanged:r})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(e,t=!1){let n=this.buffer,r;r=this._cachedBlankLine,r&&r.length===this.cols&&r.getFg(0)===e.fg&&r.getBg(0)===e.bg||(r=n.getBlankLine(e,t),this._cachedBlankLine=r),r.isWrapped=t;let i=n.ybase+n.scrollTop,a=n.ybase+n.scrollBottom;if(n.scrollTop===0){let e=n.lines.isFull;a===n.lines.length-1?e?n.lines.recycle().copyFrom(r):n.lines.push(r.clone()):n.lines.splice(a+1,0,r.clone()),e?this.isUserScrolling&&(n.ydisp=Math.max(n.ydisp-1,0)):(n.ybase++,this.isUserScrolling||n.ydisp++)}else{let e=a-i+1;n.lines.shiftElements(i+1,e-1,-1),n.lines.set(a,r.clone())}this.isUserScrolling||(n.ydisp=n.ybase),this._onScroll.fire(n.ydisp)}scrollLines(e,t){let n=this.buffer;if(e<0){if(n.ydisp===0)return;this.isUserScrolling=!0}else e+n.ydisp>=n.ybase&&(this.isUserScrolling=!1);let r=n.ydisp;n.ydisp=Math.max(Math.min(n.ydisp+e,n.ybase),0),r!==n.ydisp&&(t||this._onScroll.fire(n.ydisp))}};xm=uc([V(0,Hc)],xm);var Sm={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:ap,windowOptions:{},windowsMode:!1,windowsPty:{},wordSeparator:` ()[]{}',"\``,altClickMovesCursor:!0,convertEol:!1,termName:`xterm`,cancelEvents:!1,overviewRuler:{}},Cm=[`normal`,`bold`,`100`,`200`,`300`,`400`,`500`,`600`,`700`,`800`,`900`],wm=class extends U{constructor(e){super(),this._onOptionChange=this._register(new W),this.onOptionChange=this._onOptionChange.event;let t={...Sm};for(let n in e)if(n in t)try{let r=e[n];t[n]=this._sanitizeAndValidateOption(n,r)}catch(e){console.error(e)}this.rawOptions=t,this.options={...t},this._setupOptions(),this._register(Sl(()=>{this.rawOptions.linkHandler=null,this.rawOptions.documentOverride=null}))}onSpecificOptionChange(e,t){return this.onOptionChange(n=>{n===e&&t(this.rawOptions[e])})}onMultipleOptionChange(e,t){return this.onOptionChange(n=>{e.indexOf(n)!==-1&&t()})}_setupOptions(){let e=e=>{if(!(e in Sm))throw Error(`No option with key "${e}"`);return this.rawOptions[e]},t=(e,t)=>{if(!(e in Sm))throw Error(`No option with key "${e}"`);t=this._sanitizeAndValidateOption(e,t),this.rawOptions[e]!==t&&(this.rawOptions[e]=t,this._onOptionChange.fire(e))};for(let n in this.rawOptions){let r={get:e.bind(this,n),set:t.bind(this,n)};Object.defineProperty(this.options,n,r)}}_sanitizeAndValidateOption(e,t){switch(e){case`cursorStyle`:if(t||=Sm[e],!Tm(t))throw Error(`"${t}" is not a valid value for ${e}`);break;case`wordSeparator`:t||=Sm[e];break;case`fontWeight`:case`fontWeightBold`:if(typeof t==`number`&&1<=t&&t<=1e3)break;t=Cm.includes(t)?t:Sm[e];break;case`cursorWidth`:t=Math.floor(t);case`lineHeight`:case`tabStopWidth`:if(t<1)throw 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 Error(`${e} cannot be less than 0, value: ${t}`);break;case`fastScrollSensitivity`:case`scrollSensitivity`:if(t<=0)throw Error(`${e} cannot be less than or equal to 0, value: ${t}`);break;case`rows`:case`cols`:if(!t&&t!==0)throw Error(`${e} must be numeric, value: ${t}`);break;case`windowsPty`:t??={}}return t}};function Tm(e){return e===`block`||e===`underline`||e===`bar`}function Em(e,t=5){if(typeof e!=`object`)return e;let n=Array.isArray(e)?[]:{};for(let r in e)n[r]=t<=1?e[r]:e[r]&&Em(e[r],t-1);return n}var Dm=Object.freeze({insertMode:!1}),Om=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,cursorBlink:void 0,cursorStyle:void 0,origin:!1,reverseWraparound:!1,sendFocus:!1,synchronizedOutput:!1,wraparound:!0}),km=class extends U{constructor(e,t,n){super(),this._bufferService=e,this._logService=t,this._optionsService=n,this.isCursorInitialized=!1,this.isCursorHidden=!1,this._onData=this._register(new W),this.onData=this._onData.event,this._onUserInput=this._register(new W),this.onUserInput=this._onUserInput.event,this._onBinary=this._register(new W),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this._register(new W),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=Em(Dm),this.decPrivateModes=Em(Om)}reset(){this.modes=Em(Dm),this.decPrivateModes=Em(Om)}triggerDataEvent(e,t=!1){if(this._optionsService.rawOptions.disableStdin)return;let n=this._bufferService.buffer;t&&this._optionsService.rawOptions.scrollOnUserInput&&n.ybase!==n.ydisp&&this._onRequestScrollToBottom.fire(),t&&this._onUserInput.fire(),this._logService.debug(`sending data "${e}"`),this._logService.trace(`sending data (codes)`,()=>e.split(``).map(e=>e.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(e=>e.charCodeAt(0))),this._onBinary.fire(e))}};km=uc([V(0,Ic),V(1,Vc),V(2,Hc)],km);var Am={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 jm(e,t){let n=(e.ctrl?16:0)|(e.shift?4:0)|(e.alt?8:0);return e.button===4?(n|=64,n|=e.action):(n|=e.button&3,e.button&4&&(n|=64),e.button&8&&(n|=128),e.action===32?n|=32:e.action===0&&!t&&(n|=3)),n}var Mm=String.fromCharCode,Nm={DEFAULT:e=>{let t=[jm(e,!1)+32,e.col+32,e.row+32];return t[0]>255||t[1]>255||t[2]>255?``:`\x1B[M${Mm(t[0])}${Mm(t[1])}${Mm(t[2])}`},SGR:e=>{let t=e.action===0&&e.button!==4?`m`:`M`;return`\x1B[<${jm(e,!0)};${e.col};${e.row}${t}`},SGR_PIXELS:e=>{let t=e.action===0&&e.button!==4?`m`:`M`;return`\x1B[<${jm(e,!0)};${e.x};${e.y}${t}`}},Pm=class extends U{constructor(e,t,n){super(),this._bufferService=e,this._coreService=t,this._optionsService=n,this._protocols={},this._encodings={},this._activeProtocol=``,this._activeEncoding=``,this._lastEvent=null,this._wheelPartialScroll=0,this._onProtocolChange=this._register(new W),this.onProtocolChange=this._onProtocolChange.event;for(let e of Object.keys(Am))this.addProtocol(e,Am[e]);for(let e of Object.keys(Nm))this.addEncoding(e,Nm[e]);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 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 Error(`unknown encoding "${e}"`);this._activeEncoding=e}reset(){this.activeProtocol=`NONE`,this.activeEncoding=`DEFAULT`,this._lastEvent=null,this._wheelPartialScroll=0}consumeWheelEvent(e,t,n){if(e.deltaY===0||e.shiftKey||t===void 0||n===void 0)return 0;let r=t/n,i=this._applyScrollModifier(e.deltaY,e);return e.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(i/=r+0,Math.abs(e.deltaY)<50&&(i*=.3),this._wheelPartialScroll+=i,i=Math.floor(Math.abs(this._wheelPartialScroll))*(this._wheelPartialScroll>0?1:-1),this._wheelPartialScroll%=1):e.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(i*=this._bufferService.rows),i}_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,n){if(n){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}};Pm=uc([V(0,Ic),V(1,Rc),V(2,Hc)],Pm);var Fm=[[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]],Im=[[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]],Lm;function Rm(e,t){let n=0,r=t.length-1,i;if(e<t[0][0]||e>t[r][1])return!1;for(;r>=n;)if(i=n+r>>1,e>t[i][1])n=i+1;else if(e<t[i][0])r=i-1;else return!0;return!1}var zm=class{constructor(){if(this.version=`6`,!Lm){Lm=new Uint8Array(65536),Lm.fill(1),Lm[0]=0,Lm.fill(0,1,32),Lm.fill(0,127,160),Lm.fill(2,4352,4448),Lm[9001]=2,Lm[9002]=2,Lm.fill(2,11904,42192),Lm[12351]=1,Lm.fill(2,44032,55204),Lm.fill(2,63744,64256),Lm.fill(2,65040,65050),Lm.fill(2,65072,65136),Lm.fill(2,65280,65377),Lm.fill(2,65504,65511);for(let e=0;e<Fm.length;++e)Lm.fill(0,Fm[e][0],Fm[e][1]+1)}}wcwidth(e){return e<32?0:e<127?1:e<65536?Lm[e]:Rm(e,Im)?0:e>=131072&&e<=196605||e>=196608&&e<=262141?2:1}charProperties(e,t){let n=this.wcwidth(e),r=n===0&&t!==0;if(r){let e=Bm.extractWidth(t);e===0?r=!1:e>n&&(n=e)}return Bm.createPropertyValue(0,n,r)}},Bm=class e{constructor(){this._providers=Object.create(null),this._active=``,this._onChange=new W,this.onChange=this._onChange.event;let e=new zm;this.register(e),this._active=e.version,this._activeProvider=e}static extractShouldJoin(e){return!!(e&1)}static extractWidth(e){return e>>1&3}static extractCharKind(e){return e>>3}static createPropertyValue(e,t,n=!1){return(e&16777215)<<3|(t&3)<<1|!!n}dispose(){this._onChange.dispose()}get versions(){return Object.keys(this._providers)}get activeVersion(){return this._active}set activeVersion(e){if(!this._providers[e])throw Error(`unknown Unicode version "${e}"`);this._active=e,this._activeProvider=this._providers[e],this._onChange.fire(e)}register(e){this._providers[e.version]=e}wcwidth(e){return this._activeProvider.wcwidth(e)}getStringCellWidth(t){let n=0,r=0,i=t.length;for(let a=0;a<i;++a){let o=t.charCodeAt(a);if(55296<=o&&o<=56319){if(++a>=i)return n+this.wcwidth(o);let e=t.charCodeAt(a);56320<=e&&e<=57343?o=(o-55296)*1024+e-56320+65536:n+=this.wcwidth(e)}let s=this.charProperties(o,r),c=e.extractWidth(s);e.extractShouldJoin(s)&&(c-=e.extractWidth(r)),n+=c,r=s}return n}charProperties(e,t){return this._activeProvider.charProperties(e,t)}},Vm=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 Hm(e){let t=e.buffer.lines.get(e.buffer.ybase+e.buffer.y-1)?.get(e.cols-1),n=e.buffer.lines.get(e.buffer.ybase+e.buffer.y);n&&t&&(n.isWrapped=t[3]!==0&&t[3]!==32)}var Um=2147483647,Wm=256,Gm=class e{constructor(e=32,t=32){if(this.maxLength=e,this.maxSubParamsLength=t,t>Wm)throw Error(`maxSubParamsLength must not be greater than 256`);this.params=new Int32Array(e),this.length=0,this._subParams=new Int32Array(t),this._subParamsLength=0,this._subParamsIdx=new Uint16Array(e),this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}static fromArray(t){let n=new e;if(!t.length)return n;for(let e=+!!Array.isArray(t[0]);e<t.length;++e){let r=t[e];if(Array.isArray(r))for(let e=0;e<r.length;++e)n.addSubParam(r[e]);else n.addParam(r)}return n}clone(){let t=new e(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 e=[];for(let t=0;t<this.length;++t){e.push(this.params[t]);let n=this._subParamsIdx[t]>>8,r=this._subParamsIdx[t]&255;r-n>0&&e.push(Array.prototype.slice.call(this._subParams,n,r))}return e}reset(){this.length=0,this._subParamsLength=0,this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}addParam(e){if(this._digitIsSub=!1,this.length>=this.maxLength)this._rejectDigits=!0;else{if(e<-1)throw Error(`values lesser than -1 are not allowed`);this._subParamsIdx[this.length]=this._subParamsLength<<8|this._subParamsLength,this.params[this.length++]=e>Um?Um:e}}addSubParam(e){if(this._digitIsSub=!0,this.length){if(this._rejectDigits||this._subParamsLength>=this.maxSubParamsLength){this._rejectSubDigits=!0;return}if(e<-1)throw Error(`values lesser than -1 are not allowed`);this._subParams[this._subParamsLength++]=e>Um?Um:e,this._subParamsIdx[this.length-1]++}}hasSubParams(e){return(this._subParamsIdx[e]&255)-(this._subParamsIdx[e]>>8)>0}getSubParams(e){let t=this._subParamsIdx[e]>>8,n=this._subParamsIdx[e]&255;return n-t>0?this._subParams.subarray(t,n):null}getSubParamsAll(){let e={};for(let t=0;t<this.length;++t){let n=this._subParamsIdx[t]>>8,r=this._subParamsIdx[t]&255;r-n>0&&(e[t]=this._subParams.slice(n,r))}return e}addDigit(e){let t;if(this._rejectDigits||!(t=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;let n=this._digitIsSub?this._subParams:this.params,r=n[t-1];n[t-1]=~r?Math.min(r*10+e,Um):e}},Km=[],qm=class{constructor(){this._state=0,this._active=Km,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 n=this._handlers[e];return n.push(t),{dispose:()=>{let e=n.indexOf(t);e!==-1&&n.splice(e,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=Km}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=Km,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||Km,!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,n){if(!this._active.length)this._handlerFb(this._id,`PUT`,Cc(e,t,n));else for(let r=this._active.length-1;r>=0;r--)this._active[r].put(e,t,n)}start(){this.reset(),this._state=1}put(e,t,n){if(this._state!==3){if(this._state===1)for(;t<n;){let n=e[t++];if(n===59){this._state=2,this._start();break}if(n<48||57<n){this._state=3;return}this._id===-1&&(this._id=0),this._id=this._id*10+n-48}this._state===2&&n-t>0&&this._put(e,t,n)}}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 n=!1,r=this._active.length-1,i=!1;if(this._stack.paused&&(r=this._stack.loopPosition-1,n=t,i=this._stack.fallThrough,this._stack.paused=!1),!i&&n===!1){for(;r>=0&&(n=this._active[r].end(e),n!==!0);r--)if(n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!1,n;r--}for(;r>=0;r--)if(n=this._active[r].end(!1),n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!0,n}}this._active=Km,this._id=-1,this._state=0}}},Jm=class{constructor(e){this._handler=e,this._data=``,this._hitLimit=!1}start(){this._data=``,this._hitLimit=!1}put(e,t,n){this._hitLimit||(this._data+=Cc(e,t,n),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(e=>(this._data=``,this._hitLimit=!1,e));return this._data=``,this._hitLimit=!1,t}},Ym=[],Xm=class{constructor(){this._handlers=Object.create(null),this._active=Ym,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=Ym}registerHandler(e,t){this._handlers[e]===void 0&&(this._handlers[e]=[]);let n=this._handlers[e];return n.push(t),{dispose:()=>{let e=n.indexOf(t);e!==-1&&n.splice(e,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=Ym,this._ident=0}hook(e,t){if(this.reset(),this._ident=e,this._active=this._handlers[e]||Ym,!this._active.length)this._handlerFb(this._ident,`HOOK`,t);else for(let e=this._active.length-1;e>=0;e--)this._active[e].hook(t)}put(e,t,n){if(!this._active.length)this._handlerFb(this._ident,`PUT`,Cc(e,t,n));else for(let r=this._active.length-1;r>=0;r--)this._active[r].put(e,t,n)}unhook(e,t=!0){if(!this._active.length)this._handlerFb(this._ident,`UNHOOK`,e);else{let n=!1,r=this._active.length-1,i=!1;if(this._stack.paused&&(r=this._stack.loopPosition-1,n=t,i=this._stack.fallThrough,this._stack.paused=!1),!i&&n===!1){for(;r>=0&&(n=this._active[r].unhook(e),n!==!0);r--)if(n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!1,n;r--}for(;r>=0;r--)if(n=this._active[r].unhook(!1),n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!0,n}this._active=Ym,this._ident=0}},Zm=new Gm;Zm.addParam(0);var Qm=class{constructor(e){this._handler=e,this._data=``,this._params=Zm,this._hitLimit=!1}hook(e){this._params=e.length>1||e.params[0]?e.clone():Zm,this._data=``,this._hitLimit=!1}put(e,t,n){this._hitLimit||(this._data+=Cc(e,t,n),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(e=>(this._params=Zm,this._data=``,this._hitLimit=!1,e));return this._params=Zm,this._data=``,this._hitLimit=!1,t}},$m=class{constructor(e){this.table=new Uint8Array(e)}setDefault(e,t){this.table.fill(e<<4|t)}add(e,t,n,r){this.table[t<<8|e]=n<<4|r}addMany(e,t,n,r){for(let i=0;i<e.length;i++)this.table[t<<8|e[i]]=n<<4|r}},eh=160,th=function(){let e=new $m(4095),t=Array.apply(null,Array(256)).map((e,t)=>t),n=(e,n)=>t.slice(e,n),r=n(32,127),i=n(0,24);i.push(25),i.push.apply(i,n(28,32));let a=n(0,14),o;for(o in e.setDefault(1,0),e.addMany(r,0,2,0),a)e.addMany([24,26,153,154],o,3,0),e.addMany(n(128,144),o,3,0),e.addMany(n(144,152),o,3,0),e.add(156,o,0,0),e.add(27,o,11,1),e.add(157,o,4,8),e.addMany([152,158,159],o,0,7),e.add(155,o,11,3),e.add(144,o,11,9);return e.addMany(i,0,3,0),e.addMany(i,1,3,1),e.add(127,1,0,1),e.addMany(i,8,0,8),e.addMany(i,3,3,3),e.add(127,3,0,3),e.addMany(i,4,3,4),e.add(127,4,0,4),e.addMany(i,6,3,6),e.addMany(i,5,3,5),e.add(127,5,0,5),e.addMany(i,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(n(28,32),8,0,8),e.addMany([88,94,95],1,0,7),e.addMany(r,7,0,7),e.addMany(i,7,0,7),e.add(156,7,0,0),e.add(127,7,0,7),e.add(91,1,11,3),e.addMany(n(64,127),3,7,0),e.addMany(n(48,60),3,8,4),e.addMany([60,61,62,63],3,9,4),e.addMany(n(48,60),4,8,4),e.addMany(n(64,127),4,7,0),e.addMany([60,61,62,63],4,0,6),e.addMany(n(32,64),6,0,6),e.add(127,6,0,6),e.addMany(n(64,127),6,0,0),e.addMany(n(32,48),3,9,5),e.addMany(n(32,48),5,9,5),e.addMany(n(48,64),5,0,6),e.addMany(n(64,127),5,7,0),e.addMany(n(32,48),4,9,5),e.addMany(n(32,48),1,9,2),e.addMany(n(32,48),2,9,2),e.addMany(n(48,127),2,10,0),e.addMany(n(48,80),1,10,0),e.addMany(n(81,88),1,10,0),e.addMany([89,90,92],1,10,0),e.addMany(n(96,127),1,10,0),e.add(80,1,11,9),e.addMany(i,9,0,9),e.add(127,9,0,9),e.addMany(n(28,32),9,0,9),e.addMany(n(32,48),9,9,12),e.addMany(n(48,60),9,8,10),e.addMany([60,61,62,63],9,9,10),e.addMany(i,11,0,11),e.addMany(n(32,128),11,0,11),e.addMany(n(28,32),11,0,11),e.addMany(i,10,0,10),e.add(127,10,0,10),e.addMany(n(28,32),10,0,10),e.addMany(n(48,60),10,8,10),e.addMany([60,61,62,63],10,0,11),e.addMany(n(32,48),10,9,12),e.addMany(i,12,0,12),e.add(127,12,0,12),e.addMany(n(28,32),12,0,12),e.addMany(n(32,48),12,9,12),e.addMany(n(48,64),12,0,11),e.addMany(n(64,127),12,12,13),e.addMany(n(64,127),10,12,13),e.addMany(n(64,127),9,12,13),e.addMany(i,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(eh,0,2,0),e.add(eh,8,5,8),e.add(eh,6,0,6),e.add(eh,11,0,11),e.add(eh,13,13,13),e}(),nh=class extends U{constructor(e=th){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 Gm,this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._printHandlerFb=(e,t,n)=>{},this._executeHandlerFb=e=>{},this._csiHandlerFb=(e,t)=>{},this._escHandlerFb=e=>{},this._errorHandlerFb=e=>e,this._printHandler=this._printHandlerFb,this._executeHandlers=Object.create(null),this._csiHandlers=Object.create(null),this._escHandlers=Object.create(null),this._register(Sl(()=>{this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null)})),this._oscParser=this._register(new qm),this._dcsParser=this._register(new Xm),this._errorHandler=this._errorHandlerFb,this.registerEscHandler({final:`\\`},()=>!0)}_identifier(e,t=[64,126]){let n=0;if(e.prefix){if(e.prefix.length>1)throw Error(`only one byte as prefix supported`);if(n=e.prefix.charCodeAt(0),n&&60>n||n>63)throw Error(`prefix must be in range 0x3c .. 0x3f`)}if(e.intermediates){if(e.intermediates.length>2)throw Error(`only two bytes as intermediates are supported`);for(let t=0;t<e.intermediates.length;++t){let r=e.intermediates.charCodeAt(t);if(32>r||r>47)throw Error(`intermediate must be in range 0x20 .. 0x2f`);n<<=8,n|=r}}if(e.final.length!==1)throw Error(`final must be a single byte`);let r=e.final.charCodeAt(0);if(t[0]>r||r>t[1])throw Error(`final must be in range ${t[0]} .. ${t[1]}`);return n<<=8,n|=r,n}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 n=this._identifier(e,[48,126]);this._escHandlers[n]===void 0&&(this._escHandlers[n]=[]);let r=this._escHandlers[n];return r.push(t),{dispose:()=>{let e=r.indexOf(t);e!==-1&&r.splice(e,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 n=this._identifier(e);this._csiHandlers[n]===void 0&&(this._csiHandlers[n]=[]);let r=this._csiHandlers[n];return r.push(t),{dispose:()=>{let e=r.indexOf(t);e!==-1&&r.splice(e,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,n,r,i){this._parseStack.state=e,this._parseStack.handlers=t,this._parseStack.handlerPos=n,this._parseStack.transition=r,this._parseStack.chunkPos=i}parse(e,t,n){let r=0,i=0,a=0,o;if(this._parseStack.state){if(this._parseStack.state===2)this._parseStack.state=0,a=this._parseStack.chunkPos+1;else{if(n===void 0||this._parseStack.state===1)throw this._parseStack.state=1,Error(`improper continuation due to previous async handler, giving up parsing`);let t=this._parseStack.handlers,i=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(n===!1&&i>-1){for(;i>=0&&(o=t[i](this._params),o!==!0);i--)if(o instanceof Promise)return this._parseStack.handlerPos=i,o}this._parseStack.handlers=[];break;case 4:if(n===!1&&i>-1){for(;i>=0&&(o=t[i](),o!==!0);i--)if(o instanceof Promise)return this._parseStack.handlerPos=i,o}this._parseStack.handlers=[];break;case 6:if(r=e[this._parseStack.chunkPos],o=this._dcsParser.unhook(r!==24&&r!==26,n),o)return o;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],o=this._oscParser.end(r!==24&&r!==26,n),o)return o;r===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0}this._parseStack.state=0,a=this._parseStack.chunkPos+1,this.precedingJoinState=0,this.currentState=this._parseStack.transition&15}}for(let n=a;n<t;++n){switch(r=e[n],i=this._transitions.table[this.currentState<<8|(r<160?r:eh)],i>>4){case 2:for(let i=n+1;;++i)if(i>=t||(r=e[i])<32||r>126&&r<eh||++i>=t||(r=e[i])<32||r>126&&r<eh||++i>=t||(r=e[i])<32||r>126&&r<eh||++i>=t||(r=e[i])<32||r>126&&r<eh){this._printHandler(e,n,i),n=i-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:n,code:r,currentState:this.currentState,collect:this._collect,params:this._params,abort:!1}).abort)return;break;case 7:let a=this._csiHandlers[this._collect<<8|r],s=a?a.length-1:-1;for(;s>=0&&(o=a[s](this._params),o!==!0);s--)if(o instanceof Promise)return this._preserveStack(3,a,s,i,n),o;s<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(++n<t&&(r=e[n])>47&&r<60);n--;break;case 9:this._collect<<=8,this._collect|=r;break;case 10:let c=this._escHandlers[this._collect<<8|r],l=c?c.length-1:-1;for(;l>=0&&(o=c[l](),o!==!0);l--)if(o instanceof Promise)return this._preserveStack(4,c,l,i,n),o;l<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 i=n+1;;++i)if(i>=t||(r=e[i])===24||r===26||r===27||r>127&&r<eh){this._dcsParser.put(e,n,i),n=i-1;break}break;case 14:if(o=this._dcsParser.unhook(r!==24&&r!==26),o)return this._preserveStack(6,[],0,i,n),o;r===27&&(i|=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 i=n+1;;i++)if(i>=t||(r=e[i])<32||r>127&&r<eh){this._oscParser.put(e,n,i),n=i-1;break}break;case 6:if(o=this._oscParser.end(r!==24&&r!==26),o)return this._preserveStack(5,[],0,i,n),o;r===27&&(i|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0}this.currentState=i&15}}},rh=/^([\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})$/,ih=/^[\da-f]+$/;function ah(e){if(!e)return;let t=e.toLowerCase();if(t.indexOf(`rgb:`)===0){t=t.slice(4);let e=rh.exec(t);if(e){let t=e[1]?15:e[4]?255:e[7]?4095:65535;return[Math.round(parseInt(e[1]||e[4]||e[7]||e[10],16)/t*255),Math.round(parseInt(e[2]||e[5]||e[8]||e[11],16)/t*255),Math.round(parseInt(e[3]||e[6]||e[9]||e[12],16)/t*255)]}}else if(t.indexOf(`#`)===0&&(t=t.slice(1),ih.exec(t)&&[3,6,9,12].includes(t.length))){let e=t.length/3,n=[0,0,0];for(let r=0;r<3;++r){let i=parseInt(t.slice(e*r,e*r+e),16);n[r]=e===1?i<<4:e===2?i:e===3?i>>4:i>>8}return n}}function oh(e,t){let n=e.toString(16),r=n.length<2?`0`+n:n;switch(t){case 4:return n[0];case 8:return r;case 12:return(r+r).slice(0,3);default:return r+r}}function sh(e,t=16){let[n,r,i]=e;return`rgb:${oh(n,t)}/${oh(r,t)}/${oh(i,t)}`}var ch={"(":0,")":1,"*":2,"+":3,"-":1,".":2},lh=131072,uh=10;function dh(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 fh=5e3,ph=0,mh=class extends U{constructor(e,t,n,r,i,a,o,s,c=new nh){super(),this._bufferService=e,this._charsetService=t,this._coreService=n,this._logService=r,this._optionsService=i,this._oscLinkService=a,this._coreMouseService=o,this._unicodeService=s,this._parser=c,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new wc,this._utf8Decoder=new Tc,this._windowTitle=``,this._iconName=``,this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=rm.clone(),this._eraseAttrDataInternal=rm.clone(),this._onRequestBell=this._register(new W),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this._register(new W),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this._register(new W),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this._register(new W),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this._register(new W),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this._register(new W),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this._register(new W),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this._register(new W),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this._register(new W),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this._register(new W),this.onLineFeed=this._onLineFeed.event,this._onScroll=this._register(new W),this.onScroll=this._onScroll.event,this._onTitleChange=this._register(new W),this.onTitleChange=this._onTitleChange.event,this._onColor=this._register(new W),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 hh(this._bufferService),this._activeBuffer=this._bufferService.buffer,this._register(this._bufferService.buffers.onBufferActivate(e=>this._activeBuffer=e.activeBuffer)),this._parser.setCsiHandlerFallback((e,t)=>{this._logService.debug(`Unknown CSI code: `,{identifier:this._parser.identToString(e),params:t.toArray()})}),this._parser.setEscHandlerFallback(e=>{this._logService.debug(`Unknown ESC code: `,{identifier:this._parser.identToString(e)})}),this._parser.setExecuteHandlerFallback(e=>{this._logService.debug(`Unknown EXECUTE code: `,{code:e})}),this._parser.setOscHandlerFallback((e,t,n)=>{this._logService.debug(`Unknown OSC code: `,{identifier:e,action:t,data:n})}),this._parser.setDcsHandlerFallback((e,t,n)=>{t===`HOOK`&&(n=n.toArray()),this._logService.debug(`Unknown DCS code: `,{identifier:this._parser.identToString(e),action:t,payload:n})}),this._parser.setPrintHandler((e,t,n)=>this.print(e,t,n)),this._parser.registerCsiHandler({final:`@`},e=>this.insertChars(e)),this._parser.registerCsiHandler({intermediates:` `,final:`@`},e=>this.scrollLeft(e)),this._parser.registerCsiHandler({final:`A`},e=>this.cursorUp(e)),this._parser.registerCsiHandler({intermediates:` `,final:`A`},e=>this.scrollRight(e)),this._parser.registerCsiHandler({final:`B`},e=>this.cursorDown(e)),this._parser.registerCsiHandler({final:`C`},e=>this.cursorForward(e)),this._parser.registerCsiHandler({final:`D`},e=>this.cursorBackward(e)),this._parser.registerCsiHandler({final:`E`},e=>this.cursorNextLine(e)),this._parser.registerCsiHandler({final:`F`},e=>this.cursorPrecedingLine(e)),this._parser.registerCsiHandler({final:`G`},e=>this.cursorCharAbsolute(e)),this._parser.registerCsiHandler({final:`H`},e=>this.cursorPosition(e)),this._parser.registerCsiHandler({final:`I`},e=>this.cursorForwardTab(e)),this._parser.registerCsiHandler({final:`J`},e=>this.eraseInDisplay(e,!1)),this._parser.registerCsiHandler({prefix:`?`,final:`J`},e=>this.eraseInDisplay(e,!0)),this._parser.registerCsiHandler({final:`K`},e=>this.eraseInLine(e,!1)),this._parser.registerCsiHandler({prefix:`?`,final:`K`},e=>this.eraseInLine(e,!0)),this._parser.registerCsiHandler({final:`L`},e=>this.insertLines(e)),this._parser.registerCsiHandler({final:`M`},e=>this.deleteLines(e)),this._parser.registerCsiHandler({final:`P`},e=>this.deleteChars(e)),this._parser.registerCsiHandler({final:`S`},e=>this.scrollUp(e)),this._parser.registerCsiHandler({final:`T`},e=>this.scrollDown(e)),this._parser.registerCsiHandler({final:`X`},e=>this.eraseChars(e)),this._parser.registerCsiHandler({final:`Z`},e=>this.cursorBackwardTab(e)),this._parser.registerCsiHandler({final:"`"},e=>this.charPosAbsolute(e)),this._parser.registerCsiHandler({final:`a`},e=>this.hPositionRelative(e)),this._parser.registerCsiHandler({final:`b`},e=>this.repeatPrecedingCharacter(e)),this._parser.registerCsiHandler({final:`c`},e=>this.sendDeviceAttributesPrimary(e)),this._parser.registerCsiHandler({prefix:`>`,final:`c`},e=>this.sendDeviceAttributesSecondary(e)),this._parser.registerCsiHandler({final:`d`},e=>this.linePosAbsolute(e)),this._parser.registerCsiHandler({final:`e`},e=>this.vPositionRelative(e)),this._parser.registerCsiHandler({final:`f`},e=>this.hVPosition(e)),this._parser.registerCsiHandler({final:`g`},e=>this.tabClear(e)),this._parser.registerCsiHandler({final:`h`},e=>this.setMode(e)),this._parser.registerCsiHandler({prefix:`?`,final:`h`},e=>this.setModePrivate(e)),this._parser.registerCsiHandler({final:`l`},e=>this.resetMode(e)),this._parser.registerCsiHandler({prefix:`?`,final:`l`},e=>this.resetModePrivate(e)),this._parser.registerCsiHandler({final:`m`},e=>this.charAttributes(e)),this._parser.registerCsiHandler({final:`n`},e=>this.deviceStatus(e)),this._parser.registerCsiHandler({prefix:`?`,final:`n`},e=>this.deviceStatusPrivate(e)),this._parser.registerCsiHandler({intermediates:`!`,final:`p`},e=>this.softReset(e)),this._parser.registerCsiHandler({intermediates:` `,final:`q`},e=>this.setCursorStyle(e)),this._parser.registerCsiHandler({final:`r`},e=>this.setScrollRegion(e)),this._parser.registerCsiHandler({final:`s`},e=>this.saveCursor(e)),this._parser.registerCsiHandler({final:`t`},e=>this.windowOptions(e)),this._parser.registerCsiHandler({final:`u`},e=>this.restoreCursor(e)),this._parser.registerCsiHandler({intermediates:`'`,final:`}`},e=>this.insertColumns(e)),this._parser.registerCsiHandler({intermediates:`'`,final:`~`},e=>this.deleteColumns(e)),this._parser.registerCsiHandler({intermediates:`"`,final:`q`},e=>this.selectProtected(e)),this._parser.registerCsiHandler({intermediates:`$`,final:`p`},e=>this.requestMode(e,!0)),this._parser.registerCsiHandler({prefix:`?`,intermediates:`$`,final:`p`},e=>this.requestMode(e,!1)),this._parser.setExecuteHandler(Z.BEL,()=>this.bell()),this._parser.setExecuteHandler(Z.LF,()=>this.lineFeed()),this._parser.setExecuteHandler(Z.VT,()=>this.lineFeed()),this._parser.setExecuteHandler(Z.FF,()=>this.lineFeed()),this._parser.setExecuteHandler(Z.CR,()=>this.carriageReturn()),this._parser.setExecuteHandler(Z.BS,()=>this.backspace()),this._parser.setExecuteHandler(Z.HT,()=>this.tab()),this._parser.setExecuteHandler(Z.SO,()=>this.shiftOut()),this._parser.setExecuteHandler(Z.SI,()=>this.shiftIn()),this._parser.setExecuteHandler(of.IND,()=>this.index()),this._parser.setExecuteHandler(of.NEL,()=>this.nextLine()),this._parser.setExecuteHandler(of.HTS,()=>this.tabSet()),this._parser.registerOscHandler(0,new Jm(e=>(this.setTitle(e),this.setIconName(e),!0))),this._parser.registerOscHandler(1,new Jm(e=>this.setIconName(e))),this._parser.registerOscHandler(2,new Jm(e=>this.setTitle(e))),this._parser.registerOscHandler(4,new Jm(e=>this.setOrReportIndexedColor(e))),this._parser.registerOscHandler(8,new Jm(e=>this.setHyperlink(e))),this._parser.registerOscHandler(10,new Jm(e=>this.setOrReportFgColor(e))),this._parser.registerOscHandler(11,new Jm(e=>this.setOrReportBgColor(e))),this._parser.registerOscHandler(12,new Jm(e=>this.setOrReportCursorColor(e))),this._parser.registerOscHandler(104,new Jm(e=>this.restoreIndexedColor(e))),this._parser.registerOscHandler(110,new Jm(e=>this.restoreFgColor(e))),this._parser.registerOscHandler(111,new Jm(e=>this.restoreBgColor(e))),this._parser.registerOscHandler(112,new Jm(e=>this.restoreCursorColor(e))),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 e in mm)this._parser.registerEscHandler({intermediates:`(`,final:e},()=>this.selectCharset(`(`+e)),this._parser.registerEscHandler({intermediates:`)`,final:e},()=>this.selectCharset(`)`+e)),this._parser.registerEscHandler({intermediates:`*`,final:e},()=>this.selectCharset(`*`+e)),this._parser.registerEscHandler({intermediates:`+`,final:e},()=>this.selectCharset(`+`+e)),this._parser.registerEscHandler({intermediates:`-`,final:e},()=>this.selectCharset(`-`+e)),this._parser.registerEscHandler({intermediates:`.`,final:e},()=>this.selectCharset(`.`+e)),this._parser.registerEscHandler({intermediates:`/`,final:e},()=>this.selectCharset(`/`+e));this._parser.registerEscHandler({intermediates:`#`,final:`8`},()=>this.screenAlignmentPattern()),this._parser.setErrorHandler(e=>(this._logService.error(`Parsing error: `,e),e)),this._parser.registerDcsHandler({intermediates:`$`,final:`q`},new Qm((e,t)=>this.requestStatusString(e,t)))}getAttrData(){return this._curAttrData}_preserveStack(e,t,n,r){this._parseStack.paused=!0,this._parseStack.cursorStartX=e,this._parseStack.cursorStartY=t,this._parseStack.decodedLength=n,this._parseStack.position=r}_logSlowResolvingAsync(e){this._logService.logLevel<=3&&Promise.race([e,new Promise((e,t)=>setTimeout(()=>t(`#SLOW_TIMEOUT`),fh))]).catch(e=>{if(e!==`#SLOW_TIMEOUT`)throw e;console.warn(`async parser handler taking longer than ${fh} ms`)})}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(e,t){let n,r=this._activeBuffer.x,i=this._activeBuffer.y,a=0,o=this._parseStack.paused;if(o){if(n=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,t))return this._logSlowResolvingAsync(n),n;r=this._parseStack.cursorStartX,i=this._parseStack.cursorStartY,this._parseStack.paused=!1,e.length>lh&&(a=this._parseStack.position+lh)}if(this._logService.logLevel<=1&&this._logService.debug(`parsing data ${typeof e==`string`?` "${e}"`:` "${Array.prototype.map.call(e,e=>String.fromCharCode(e)).join(``)}"`}`),this._logService.logLevel===0&&this._logService.trace(`parsing data (codes)`,typeof e==`string`?e.split(``).map(e=>e.charCodeAt(0)):e),this._parseBuffer.length<e.length&&this._parseBuffer.length<lh&&(this._parseBuffer=new Uint32Array(Math.min(e.length,lh))),o||this._dirtyRowTracker.clearRange(),e.length>lh)for(let t=a;t<e.length;t+=lh){let a=t+lh<e.length?t+lh:e.length,o=typeof e==`string`?this._stringDecoder.decode(e.substring(t,a),this._parseBuffer):this._utf8Decoder.decode(e.subarray(t,a),this._parseBuffer);if(n=this._parser.parse(this._parseBuffer,o))return this._preserveStack(r,i,o,t),this._logSlowResolvingAsync(n),n}else if(!o){let t=typeof e==`string`?this._stringDecoder.decode(e,this._parseBuffer):this._utf8Decoder.decode(e,this._parseBuffer);if(n=this._parser.parse(this._parseBuffer,t))return this._preserveStack(r,i,t,0),this._logSlowResolvingAsync(n),n}(this._activeBuffer.x!==r||this._activeBuffer.y!==i)&&this._onCursorMove.fire();let s=this._dirtyRowTracker.end+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp),c=this._dirtyRowTracker.start+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp);c<this._bufferService.rows&&this._onRequestRefreshRows.fire({start:Math.min(c,this._bufferService.rows-1),end:Math.min(s,this._bufferService.rows-1)})}print(e,t,n){let r,i,a=this._charsetService.charset,o=this._optionsService.rawOptions.screenReaderMode,s=this._bufferService.cols,c=this._coreService.decPrivateModes.wraparound,l=this._coreService.modes.insertMode,u=this._curAttrData,d=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._activeBuffer.x&&n-t>0&&d.getWidth(this._activeBuffer.x-1)===2&&d.setCellFromCodepoint(this._activeBuffer.x-1,0,1,u);let f=this._parser.precedingJoinState;for(let p=t;p<n;++p){if(r=e[p],r<127&&a){let e=a[String.fromCharCode(r)];e&&(r=e.charCodeAt(0))}let t=this._unicodeService.charProperties(r,f);i=Bm.extractWidth(t);let n=Bm.extractShouldJoin(t),m=n?Bm.extractWidth(f):0;if(f=t,o&&this._onA11yChar.fire(Sc(r)),this._getCurrentLinkId()&&this._oscLinkService.addLineToLink(this._getCurrentLinkId(),this._activeBuffer.ybase+this._activeBuffer.y),this._activeBuffer.x+i-m>s){if(c){let e=d,t=this._activeBuffer.x-m;for(this._activeBuffer.x=m,this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData(),!0)):(this._activeBuffer.y>=this._bufferService.rows&&(this._activeBuffer.y=this._bufferService.rows-1),this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!0),d=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y),m>0&&d instanceof om&&d.copyCellsFrom(e,t,0,m,!1);t<s;)e.setCellFromCodepoint(t++,0,1,u)}else if(this._activeBuffer.x=s-1,i===2)continue}if(n&&this._activeBuffer.x){let e=d.getWidth(this._activeBuffer.x-1)?1:2;d.addCodepointToCell(this._activeBuffer.x-e,r,i);for(let e=i-m;--e>=0;)d.setCellFromCodepoint(this._activeBuffer.x++,0,0,u)}else if(l&&(d.insertCells(this._activeBuffer.x,i-m,this._activeBuffer.getNullCell(u)),d.getWidth(s-1)===2&&d.setCellFromCodepoint(s-1,0,1,u)),d.setCellFromCodepoint(this._activeBuffer.x++,r,i,u),i>0)for(;--i;)d.setCellFromCodepoint(this._activeBuffer.x++,0,0,u)}this._parser.precedingJoinState=f,this._activeBuffer.x<s&&n-t>0&&d.getWidth(this._activeBuffer.x)===0&&!d.hasContent(this._activeBuffer.x)&&d.setCellFromCodepoint(this._activeBuffer.x,0,1,u),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(e,t){return e.final===`t`&&!e.prefix&&!e.intermediates?this._parser.registerCsiHandler(e,e=>!dh(e.params[0],this._optionsService.rawOptions.windowOptions)||t(e)):this._parser.registerCsiHandler(e,t)}registerDcsHandler(e,t){return this._parser.registerDcsHandler(e,new Qm(t))}registerEscHandler(e,t){return this._parser.registerEscHandler(e,t)}registerOscHandler(e,t){return this._parser.registerOscHandler(e,new Jm(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,n,r=!1,i=!1){let a=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);a.replaceCells(t,n,this._activeBuffer.getNullCell(this._eraseAttrData()),i),r&&(a.isWrapped=!1)}_resetBufferLine(e,t=!1){let n=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);n&&(n.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),t),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+e),n.isWrapped=!1)}eraseInDisplay(e,t=!1){this._restrictCursor(this._bufferService.cols);let n;switch(e.params[0]){case 0:for(n=this._activeBuffer.y,this._dirtyRowTracker.markDirty(n),this._eraseInBufferLine(n++,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,t);n<this._bufferService.rows;n++)this._resetBufferLine(n,t);this._dirtyRowTracker.markDirty(n);break;case 1:for(n=this._activeBuffer.y,this._dirtyRowTracker.markDirty(n),this._eraseInBufferLine(n,0,this._activeBuffer.x+1,!0,t),this._activeBuffer.x+1>=this._bufferService.cols&&(this._activeBuffer.lines.get(n+1).isWrapped=!1);n--;)this._resetBufferLine(n,t);this._dirtyRowTracker.markDirty(0);break;case 2:if(this._optionsService.rawOptions.scrollOnEraseInDisplay){for(n=this._bufferService.rows,this._dirtyRowTracker.markRangeDirty(0,n-1);n--&&!this._activeBuffer.lines.get(this._activeBuffer.ybase+n)?.getTrimmedLength(););for(;n>=0;n--)this._bufferService.scroll(this._eraseAttrData())}else{for(n=this._bufferService.rows,this._dirtyRowTracker.markDirty(n-1);n--;)this._resetBufferLine(n,t);this._dirtyRowTracker.markDirty(0)}break;case 3:let e=this._activeBuffer.lines.length-this._bufferService.rows;e>0&&(this._activeBuffer.lines.trimStart(e),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-e,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-e,0),this._onScroll.fire(0))}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)}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 n=this._activeBuffer.ybase+this._activeBuffer.y,r=this._bufferService.rows-1-this._activeBuffer.scrollBottom,i=this._bufferService.rows-1+this._activeBuffer.ybase-r+1;for(;t--;)this._activeBuffer.lines.splice(i-1,1),this._activeBuffer.lines.splice(n,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}deleteLines(e){this._restrictCursor();let t=e.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let n=this._activeBuffer.ybase+this._activeBuffer.y,r;for(r=this._bufferService.rows-1-this._activeBuffer.scrollBottom,r=this._bufferService.rows-1+this._activeBuffer.ybase-r;t--;)this._activeBuffer.lines.splice(n,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(rm));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 e=this._activeBuffer.scrollTop;e<=this._activeBuffer.scrollBottom;++e){let n=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);n.deleteCells(0,t,this._activeBuffer.getNullCell(this._eraseAttrData())),n.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 e=this._activeBuffer.scrollTop;e<=this._activeBuffer.scrollBottom;++e){let n=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);n.insertCells(0,t,this._activeBuffer.getNullCell(this._eraseAttrData())),n.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 e=this._activeBuffer.scrollTop;e<=this._activeBuffer.scrollBottom;++e){let n=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);n.insertCells(this._activeBuffer.x,t,this._activeBuffer.getNullCell(this._eraseAttrData())),n.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 e=this._activeBuffer.scrollTop;e<=this._activeBuffer.scrollBottom;++e){let n=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);n.deleteCells(this._activeBuffer.x,t,this._activeBuffer.getNullCell(this._eraseAttrData())),n.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 n=e.params[0]||1,r=Bm.extractWidth(t),i=this._activeBuffer.x-r,a=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).getString(i),o=new Uint32Array(a.length*n),s=0;for(let e=0;e<a.length;){let t=a.codePointAt(e)||0;o[s++]=t,e+=t>65535?2:1}let c=s;for(let e=1;e<n;++e)o.copyWithin(c,0,s),c+=s;return this.print(o,0,c),!0}sendDeviceAttributesPrimary(e){return e.params[0]>0||(this._is(`xterm`)||this._is(`rxvt-unicode`)||this._is(`screen`)?this._coreService.triggerDataEvent(Z.ESC+`[?1;2c`):this._is(`linux`)&&this._coreService.triggerDataEvent(Z.ESC+`[?6c`)),!0}sendDeviceAttributesSecondary(e){return e.params[0]>0||(this._is(`xterm`)?this._coreService.triggerDataEvent(Z.ESC+`[>0;276;0c`):this._is(`rxvt-unicode`)?this._coreService.triggerDataEvent(Z.ESC+`[>85;95;0c`):this._is(`linux`)?this._coreService.triggerDataEvent(e.params[0]+`c`):this._is(`screen`)&&this._coreService.triggerDataEvent(Z.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}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,hm),this._charsetService.setgCharset(1,hm),this._charsetService.setgCharset(2,hm),this._charsetService.setgCharset(3,hm);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}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}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)}return!0}requestMode(e,t){let n;(e=>(e[e.NOT_RECOGNIZED=0]=`NOT_RECOGNIZED`,e[e.SET=1]=`SET`,e[e.RESET=2]=`RESET`,e[e.PERMANENTLY_SET=3]=`PERMANENTLY_SET`,e[e.PERMANENTLY_RESET=4]=`PERMANENTLY_RESET`))(n||={});let r=this._coreService.decPrivateModes,{activeProtocol:i,activeEncoding:a}=this._coreMouseService,o=this._coreService,{buffers:s,cols:c}=this._bufferService,{active:l,alt:u}=s,d=this._optionsService.rawOptions,f=(e,n)=>(o.triggerDataEvent(`${Z.ESC}[${t?``:`?`}${e};${n}$y`),!0),p=e=>e?1:2,m=e.params[0];return t?m===2?f(m,4):m===4?f(m,p(o.modes.insertMode)):m===12?f(m,3):m===20?f(m,p(d.convertEol)):f(m,0):m===1?f(m,p(r.applicationCursorKeys)):m===3?f(m,d.windowOptions.setWinLines?c===80?2:+(c===132):0):m===6?f(m,p(r.origin)):m===7?f(m,p(r.wraparound)):m===8?f(m,3):m===9?f(m,p(i===`X10`)):m===12?f(m,p(d.cursorBlink)):m===25?f(m,p(!o.isCursorHidden)):m===45?f(m,p(r.reverseWraparound)):m===66?f(m,p(r.applicationKeypad)):m===67?f(m,4):m===1e3?f(m,p(i===`VT200`)):m===1002?f(m,p(i===`DRAG`)):m===1003?f(m,p(i===`ANY`)):m===1004?f(m,p(r.sendFocus)):m===1005?f(m,4):m===1006?f(m,p(a===`SGR`)):m===1015?f(m,4):m===1016?f(m,p(a===`SGR_PIXELS`)):m===1048?f(m,1):m===47||m===1047||m===1049?f(m,p(l===u)):m===2004?f(m,p(r.bracketedPasteMode)):m===2026?f(m,p(r.synchronizedOutput)):f(m,0)}_updateAttrColor(e,t,n,r,i){return t===2?(e|=50331648,e&=-16777216,e|=Oc.fromColorRGB([n,r,i])):t===5&&(e&=-50331904,e|=33554432|n&255),e}_extractColor(e,t,n){let r=[0,0,-1,0,0,0],i=0,a=0;do{if(r[a+i]=e.params[t+a],e.hasSubParams(t+a)){let n=e.getSubParams(t+a),o=0;do r[1]===5&&(i=1),r[a+o+1+i]=n[o];while(++o<n.length&&o+a+1+i<r.length);break}if(r[1]===5&&a+i>=2||r[1]===2&&a+i>=5)break;r[1]&&(i=1)}while(++a+t<e.length&&a+i<r.length);for(let e=2;e<r.length;++e)r[e]===-1&&(r[e]=0);switch(r[0]){case 38:n.fg=this._updateAttrColor(n.fg,r[1],r[3],r[4],r[5]);break;case 48:n.bg=this._updateAttrColor(n.bg,r[1],r[3],r[4],r[5]);break;case 58:n.extended=n.extended.clone(),n.extended.underlineColor=this._updateAttrColor(n.extended.underlineColor,r[1],r[3],r[4],r[5])}return a}_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=rm.fg,e.bg=rm.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,n,r=this._curAttrData;for(let i=0;i<t;i++)n=e.params[i],n>=30&&n<=37?(r.fg&=-50331904,r.fg|=16777216|n-30):n>=40&&n<=47?(r.bg&=-50331904,r.bg|=16777216|n-40):n>=90&&n<=97?(r.fg&=-50331904,r.fg|=n-90|16777224):n>=100&&n<=107?(r.bg&=-50331904,r.bg|=n-100|16777224):n===0?this._processSGR0(r):n===1?r.fg|=134217728:n===3?r.bg|=67108864:n===4?(r.fg|=268435456,this._processUnderline(e.hasSubParams(i)?e.getSubParams(i)[0]:1,r)):n===5?r.fg|=536870912:n===7?r.fg|=67108864:n===8?r.fg|=1073741824:n===9?r.fg|=2147483648:n===2?r.bg|=134217728:n===21?this._processUnderline(2,r):n===22?(r.fg&=-134217729,r.bg&=-134217729):n===23?r.bg&=-67108865:n===24?(r.fg&=-268435457,this._processUnderline(0,r)):n===25?r.fg&=-536870913:n===27?r.fg&=-67108865:n===28?r.fg&=-1073741825:n===29?r.fg&=2147483647:n===39?(r.fg&=-67108864,r.fg|=rm.fg&16777215):n===49?(r.bg&=-67108864,r.bg|=rm.bg&16777215):n===38||n===48||n===58?i+=this._extractColor(e,i,r):n===53?r.bg|=1073741824:n===55?r.bg&=-1073741825:n===59?(r.extended=r.extended.clone(),r.extended.underlineColor=-1,r.updateExtended()):n===100?(r.fg&=-67108864,r.fg|=rm.fg&16777215,r.bg&=-67108864,r.bg|=rm.bg&16777215):this._logService.debug(`Unknown SGR attribute: %d.`,n);return!0}deviceStatus(e){switch(e.params[0]){case 5:this._coreService.triggerDataEvent(`${Z.ESC}[0n`);break;case 6:let e=this._activeBuffer.y+1,t=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${Z.ESC}[${e};${t}R`)}return!0}deviceStatusPrivate(e){if(e.params[0]===6){let e=this._activeBuffer.y+1,t=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${Z.ESC}[?${e};${t}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=rm.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`}let e=t%2==1;this._coreService.decPrivateModes.cursorBlink=e}return!0}setScrollRegion(e){let t=e.params[0]||1,n;return(e.length<2||(n=e.params[1])>this._bufferService.rows||n===0)&&(n=this._bufferService.rows),n>t&&(this._activeBuffer.scrollTop=t-1,this._activeBuffer.scrollBottom=n-1,this._setCursor(0,0)),!0}windowOptions(e){if(!dh(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(`${Z.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);break;case 22:(t===0||t===2)&&(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>uh&&this._windowTitleStack.shift()),(t===0||t===1)&&(this._iconNameStack.push(this._iconName),this._iconNameStack.length>uh&&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())}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=[],n=e.split(`;`);for(;n.length>1;){let e=n.shift(),r=n.shift();if(/^\d+$/.exec(e)){let n=parseInt(e);if(gh(n)){if(r===`?`)t.push({type:0,index:n});else{let e=ah(r);e&&t.push({type:1,index:n,color:e})}}}}return t.length&&this._onColor.fire(t),!0}setHyperlink(e){let t=e.indexOf(`;`);if(t===-1)return!0;let n=e.slice(0,t).trim(),r=e.slice(t+1);return r?this._createHyperlink(n,r):!n.trim()&&this._finishHyperlink()}_createHyperlink(e,t){this._getCurrentLinkId()&&this._finishHyperlink();let n=e.split(`:`),r,i=n.findIndex(e=>e.startsWith(`id=`));return i!==-1&&(r=n[i].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 n=e.split(`;`);for(let e=0;e<n.length&&!(t>=this._specialColors.length);++e,++t)if(n[e]===`?`)this._onColor.fire([{type:0,index:this._specialColors[t]}]);else{let r=ah(n[e]);r&&this._onColor.fire([{type:1,index:this._specialColors[t],color:r}])}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=[],n=e.split(`;`);for(let e=0;e<n.length;++e)if(/^\d+$/.exec(n[e])){let r=parseInt(n[e]);gh(r)&&t.push({type:2,index:r})}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,hm),!0}selectCharset(e){return e.length===2?(e[0]===`/`||this._charsetService.setgCharset(ch[e[0]],mm[e[1]]||hm),!0):(this.selectDefaultCharset(),!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=rm.clone(),this._eraseAttrDataInternal=rm.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 Ac;e.content=4194373,e.fg=this._curAttrData.fg,e.bg=this._curAttrData.bg,this._setCursor(0,0);for(let t=0;t<this._bufferService.rows;++t){let n=this._activeBuffer.ybase+this._activeBuffer.y+t,r=this._activeBuffer.lines.get(n);r&&(r.fill(e),r.isWrapped=!1)}return this._dirtyRowTracker.markAllDirty(),this._setCursor(0,0),!0}requestStatusString(e,t){let n=e=>(this._coreService.triggerDataEvent(`${Z.ESC}${e}${Z.ESC}\\`),!0),r=this._bufferService.buffer,i=this._optionsService.rawOptions;return n(e===`"q`?`P1$r${+!!this._curAttrData.isProtected()}"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}[i.cursorStyle]-+!!i.cursorBlink} q`:`P0$r`)}markRangeDirty(e,t){this._dirtyRowTracker.markRangeDirty(e,t)}},hh=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&&(ph=e,e=t,t=ph),e<this.start&&(this.start=e),t>this.end&&(this.end=t)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};hh=uc([V(0,Ic)],hh);function gh(e){return 0<=e&&e<256}var _h=5e7,vh=12,yh=50,bh=class extends U{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 W),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 n;for(;n=this._writeBuffer.shift();){this._action(n);let e=this._callbacks.shift();e&&e()}this._pendingData=0,this._bufferOffset=2147483647,this._isSyncWriting=!1,this._syncCalls=0}write(e,t){if(this._pendingData>_h)throw 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 n=e||performance.now();for(;this._writeBuffer.length>this._bufferOffset;){let e=this._writeBuffer[this._bufferOffset],r=this._action(e,t);if(r){r.catch(e=>(queueMicrotask(()=>{throw e}),Promise.resolve(!1))).then(e=>performance.now()-n>=vh?setTimeout(()=>this._innerWrite(0,e)):this._innerWrite(n,e));return}let i=this._callbacks[this._bufferOffset];if(i&&i(),this._bufferOffset++,this._pendingData-=e.length,performance.now()-n>=vh)break}this._writeBuffer.length>this._bufferOffset?(this._bufferOffset>yh&&(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()}},xh=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 n=t.addMarker(t.ybase+t.y),r={data:e,id:this._nextId++,lines:[n]};return n.onDispose(()=>this._removeMarkerFromLink(r,n)),this._dataByLinkId.set(r.id,r),r.id}let n=e,r=this._getEntryIdKey(n),i=this._entriesWithId.get(r);if(i)return this.addLineToLink(i.id,t.ybase+t.y),i.id;let a=t.addMarker(t.ybase+t.y),o={id:this._nextId++,key:this._getEntryIdKey(n),data:n,lines:[a]};return a.onDispose(()=>this._removeMarkerFromLink(o,a)),this._entriesWithId.set(o.key,o),this._dataByLinkId.set(o.id,o),o.id}addLineToLink(e,t){let n=this._dataByLinkId.get(e);if(n&&n.lines.every(e=>e.line!==t)){let e=this._bufferService.buffer.addMarker(t);n.lines.push(e),e.onDispose(()=>this._removeMarkerFromLink(n,e))}}getLinkData(e){return this._dataByLinkId.get(e)?.data}_getEntryIdKey(e){return`${e.id};;${e.uri}`}_removeMarkerFromLink(e,t){let n=e.lines.indexOf(t);n!==-1&&(e.lines.splice(n,1),e.lines.length===0&&(e.data.id!==void 0&&this._entriesWithId.delete(e.key),this._dataByLinkId.delete(e.id)))}};xh=uc([V(0,Ic)],xh);var Sh=!1,Ch=class extends U{constructor(e){super(),this._windowsWrappingHeuristics=this._register(new Tl),this._onBinary=this._register(new W),this.onBinary=this._onBinary.event,this._onData=this._register(new W),this.onData=this._onData.event,this._onLineFeed=this._register(new W),this.onLineFeed=this._onLineFeed.event,this._onResize=this._register(new W),this.onResize=this._onResize.event,this._onWriteParsed=this._register(new W),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this._register(new W),this._instantiationService=new Zp,this.optionsService=this._register(new wm(e)),this._instantiationService.setService(Hc,this.optionsService),this._bufferService=this._register(this._instantiationService.createInstance(xm)),this._instantiationService.setService(Ic,this._bufferService),this._logService=this._register(this._instantiationService.createInstance(em)),this._instantiationService.setService(Vc,this._logService),this.coreService=this._register(this._instantiationService.createInstance(km)),this._instantiationService.setService(Rc,this.coreService),this.coreMouseService=this._register(this._instantiationService.createInstance(Pm)),this._instantiationService.setService(Lc,this.coreMouseService),this.unicodeService=this._register(this._instantiationService.createInstance(Bm)),this._instantiationService.setService(Wc,this.unicodeService),this._charsetService=this._instantiationService.createInstance(Vm),this._instantiationService.setService(zc,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(xh),this._instantiationService.setService(Uc,this._oscLinkService),this._inputHandler=this._register(new mh(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService)),this._register(Ml.forward(this._inputHandler.onLineFeed,this._onLineFeed)),this._register(this._inputHandler),this._register(Ml.forward(this._bufferService.onResize,this._onResize)),this._register(Ml.forward(this.coreService.onData,this._onData)),this._register(Ml.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 bh((e,t)=>this._inputHandler.parse(e,t))),this._register(Ml.forward(this._writeBuffer.onWriteParsed,this._onWriteParsed))}get onScroll(){return this._onScrollApi||(this._onScrollApi=this._register(new W),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&&!Sh&&(this._logService.warn(`writeSync is unreliable and will be removed soon.`),Sh=!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,ym),t=Math.max(t,bm),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(Hm.bind(null,this._bufferService))),e.push(this.registerCsiHandler({final:`H`},()=>(Hm(this._bufferService),!1))),this._windowsWrappingHeuristics.value=Sl(()=>{for(let t of e)t.dispose()})}}},wh={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 Th(e,t,n,r){let i={type:0,cancel:!1,key:void 0},a=+!!e.shiftKey|(e.altKey?2:0)|(e.ctrlKey?4:0)|(e.metaKey?8:0);switch(e.keyCode){case 0:e.key===`UIKeyInputUpArrow`?i.key=t?Z.ESC+`OA`:Z.ESC+`[A`:e.key===`UIKeyInputLeftArrow`?i.key=t?Z.ESC+`OD`:Z.ESC+`[D`:e.key===`UIKeyInputRightArrow`?i.key=t?Z.ESC+`OC`:Z.ESC+`[C`:e.key===`UIKeyInputDownArrow`&&(i.key=t?Z.ESC+`OB`:Z.ESC+`[B`);break;case 8:i.key=e.ctrlKey?`\b`:Z.DEL,e.altKey&&(i.key=Z.ESC+i.key);break;case 9:if(e.shiftKey){i.key=Z.ESC+`[Z`;break}i.key=Z.HT,i.cancel=!0;break;case 13:i.key=e.altKey?Z.ESC+Z.CR:Z.CR,i.cancel=!0;break;case 27:i.key=Z.ESC,e.altKey&&(i.key=Z.ESC+Z.ESC),i.cancel=!0;break;case 37:if(e.metaKey)break;i.key=a?Z.ESC+`[1;`+(a+1)+`D`:t?Z.ESC+`OD`:Z.ESC+`[D`;break;case 39:if(e.metaKey)break;i.key=a?Z.ESC+`[1;`+(a+1)+`C`:t?Z.ESC+`OC`:Z.ESC+`[C`;break;case 38:if(e.metaKey)break;i.key=a?Z.ESC+`[1;`+(a+1)+`A`:t?Z.ESC+`OA`:Z.ESC+`[A`;break;case 40:if(e.metaKey)break;i.key=a?Z.ESC+`[1;`+(a+1)+`B`:t?Z.ESC+`OB`:Z.ESC+`[B`;break;case 45:!e.shiftKey&&!e.ctrlKey&&(i.key=Z.ESC+`[2~`);break;case 46:i.key=a?Z.ESC+`[3;`+(a+1)+`~`:Z.ESC+`[3~`;break;case 36:i.key=a?Z.ESC+`[1;`+(a+1)+`H`:t?Z.ESC+`OH`:Z.ESC+`[H`;break;case 35:i.key=a?Z.ESC+`[1;`+(a+1)+`F`:t?Z.ESC+`OF`:Z.ESC+`[F`;break;case 33:e.shiftKey?i.type=2:i.key=e.ctrlKey?Z.ESC+`[5;`+(a+1)+`~`:Z.ESC+`[5~`;break;case 34:e.shiftKey?i.type=3:i.key=e.ctrlKey?Z.ESC+`[6;`+(a+1)+`~`:Z.ESC+`[6~`;break;case 112:i.key=a?Z.ESC+`[1;`+(a+1)+`P`:Z.ESC+`OP`;break;case 113:i.key=a?Z.ESC+`[1;`+(a+1)+`Q`:Z.ESC+`OQ`;break;case 114:i.key=a?Z.ESC+`[1;`+(a+1)+`R`:Z.ESC+`OR`;break;case 115:i.key=a?Z.ESC+`[1;`+(a+1)+`S`:Z.ESC+`OS`;break;case 116:i.key=a?Z.ESC+`[15;`+(a+1)+`~`:Z.ESC+`[15~`;break;case 117:i.key=a?Z.ESC+`[17;`+(a+1)+`~`:Z.ESC+`[17~`;break;case 118:i.key=a?Z.ESC+`[18;`+(a+1)+`~`:Z.ESC+`[18~`;break;case 119:i.key=a?Z.ESC+`[19;`+(a+1)+`~`:Z.ESC+`[19~`;break;case 120:i.key=a?Z.ESC+`[20;`+(a+1)+`~`:Z.ESC+`[20~`;break;case 121:i.key=a?Z.ESC+`[21;`+(a+1)+`~`:Z.ESC+`[21~`;break;case 122:i.key=a?Z.ESC+`[23;`+(a+1)+`~`:Z.ESC+`[23~`;break;case 123:i.key=a?Z.ESC+`[24;`+(a+1)+`~`:Z.ESC+`[24~`;break;default:if(e.ctrlKey&&!e.shiftKey&&!e.altKey&&!e.metaKey)e.keyCode>=65&&e.keyCode<=90?i.key=String.fromCharCode(e.keyCode-64):e.keyCode===32?i.key=Z.NUL:e.keyCode>=51&&e.keyCode<=55?i.key=String.fromCharCode(e.keyCode-51+27):e.keyCode===56?i.key=Z.DEL:e.keyCode===219?i.key=Z.ESC:e.keyCode===220?i.key=Z.FS:e.keyCode===221&&(i.key=Z.GS);else if((!n||r)&&e.altKey&&!e.metaKey){let t=wh[e.keyCode]?.[+!!e.shiftKey];if(t)i.key=Z.ESC+t;else if(e.keyCode>=65&&e.keyCode<=90){let t=e.ctrlKey?e.keyCode-64:e.keyCode+32,n=String.fromCharCode(t);e.shiftKey&&(n=n.toUpperCase()),i.key=Z.ESC+n}else if(e.keyCode===32)i.key=Z.ESC+(e.ctrlKey?Z.NUL:` `);else if(e.key===`Dead`&&e.code.startsWith(`Key`)){let t=e.code.slice(3,4);e.shiftKey||(t=t.toLowerCase()),i.key=Z.ESC+t,i.cancel=!0}}else n&&!e.altKey&&!e.ctrlKey&&!e.shiftKey&&e.metaKey?e.keyCode===65&&(i.type=1):e.key&&!e.ctrlKey&&!e.altKey&&!e.metaKey&&e.keyCode>=48&&e.key.length===1?i.key=e.key:e.key&&e.ctrlKey&&(e.key===`_`&&(i.key=Z.US),e.key===`@`&&(i.key=Z.NUL))}return i}var Eh=0,Dh=class{constructor(e){this._getKey=e,this._array=[],this._insertedValues=[],this._flushInsertedTask=new mp,this._isFlushingInserted=!1,this._deletedIndices=[],this._flushDeletedTask=new mp,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((e,t)=>this._getKey(e)-this._getKey(t)),t=0,n=0,r=Array(this._array.length+this._insertedValues.length);for(let i=0;i<r.length;i++)n>=this._array.length||this._getKey(e[t])<=this._getKey(this._array[n])?(r[i]=e[t],t++):r[i]=this._array[n++];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||(Eh=this._search(t),Eh===-1)||this._getKey(this._array[Eh])!==t)return!1;do if(this._array[Eh]===e)return this._deletedIndices.length===0&&this._flushDeletedTask.enqueue(()=>this._flushDeleted()),this._deletedIndices.push(Eh),!0;while(++Eh<this._array.length&&this._getKey(this._array[Eh])===t);return!1}_flushDeleted(){this._isFlushingDeleted=!0;let e=this._deletedIndices.sort((e,t)=>e-t),t=0,n=Array(this._array.length-e.length),r=0;for(let i=0;i<this._array.length;i++)e[t]===i?t++:n[r++]=this._array[i];this._array=n,this._deletedIndices.length=0,this._isFlushingDeleted=!1}_flushCleanupDeleted(){!this._isFlushingDeleted&&this._deletedIndices.length>0&&this._flushDeletedTask.flush()}*getKeyIterator(e){if(this._flushCleanupInserted(),this._flushCleanupDeleted(),this._array.length!==0&&(Eh=this._search(e),!(Eh<0||Eh>=this._array.length)&&this._getKey(this._array[Eh])===e))do yield this._array[Eh];while(++Eh<this._array.length&&this._getKey(this._array[Eh])===e)}forEachByKey(e,t){if(this._flushCleanupInserted(),this._flushCleanupDeleted(),this._array.length!==0&&(Eh=this._search(e),!(Eh<0||Eh>=this._array.length)&&this._getKey(this._array[Eh])===e))do t(this._array[Eh]);while(++Eh<this._array.length&&this._getKey(this._array[Eh])===e)}values(){return this._flushCleanupInserted(),this._flushCleanupDeleted(),[...this._array].values()}_search(e){let t=0,n=this._array.length-1;for(;n>=t;){let r=t+n>>1,i=this._getKey(this._array[r]);if(i>e)n=r-1;else if(i<e)t=r+1;else{for(;r>0&&this._getKey(this._array[r-1])===e;)r--;return r}}return t}},Oh=0,kh=0,Ah=class extends U{constructor(){super(),this._decorations=new Dh(e=>e?.marker.line),this._onDecorationRegistered=this._register(new W),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this._register(new W),this.onDecorationRemoved=this._onDecorationRemoved.event,this._register(Sl(()=>this.reset()))}get decorations(){return this._decorations.values()}registerDecoration(e){if(e.marker.isDisposed)return;let t=new jh(e);if(t){let e=t.marker.onDispose(()=>t.dispose()),n=t.onDispose(()=>{n.dispose(),t&&(this._decorations.delete(t)&&this._onDecorationRemoved.fire(t),e.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,n){let r=0,i=0;for(let a of this._decorations.getKeyIterator(t))r=a.options.x??0,i=r+(a.options.width??1),e>=r&&e<i&&(!n||(a.options.layer??`bottom`)===n)&&(yield a)}forEachDecorationAtCell(e,t,n,r){this._decorations.forEachByKey(t,t=>{Oh=t.options.x??0,kh=Oh+(t.options.width??1),e>=Oh&&e<kh&&(!n||(t.options.layer??`bottom`)===n)&&r(t)})}},jh=class extends wl{constructor(e){super(),this.options=e,this.onRenderEmitter=this.add(new W),this.onRender=this.onRenderEmitter.event,this._onDispose=this.add(new W),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._cachedBg=this.options.backgroundColor?gf.toColor(this.options.backgroundColor):void 0),this._cachedBg}get foregroundColorRGB(){return this._cachedFg===null&&(this._cachedFg=this.options.foregroundColor?gf.toColor(this.options.foregroundColor):void 0),this._cachedFg}dispose(){this._onDispose.fire(),super.dispose()}},Mh=1e3,Nh=class{constructor(e,t=Mh){this._renderCallback=e,this._debounceThresholdMS=t,this._lastRefreshMs=0,this._additionalRefreshRequested=!1}dispose(){this._refreshTimeoutID&&clearTimeout(this._refreshTimeoutID)}refresh(e,t,n){this._rowCount=n,e=e===void 0?0:e,t=t===void 0?this._rowCount-1:t,this._rowStart=this._rowStart===void 0?e:Math.min(this._rowStart,e),this._rowEnd=this._rowEnd===void 0?t:Math.max(this._rowEnd,t);let r=performance.now();if(r-this._lastRefreshMs>=this._debounceThresholdMS)this._lastRefreshMs=r,this._innerRefresh();else if(!this._additionalRefreshRequested){let e=r-this._lastRefreshMs,t=this._debounceThresholdMS-e;this._additionalRefreshRequested=!0,this._refreshTimeoutID=window.setTimeout(()=>{this._lastRefreshMs=performance.now(),this._innerRefresh(),this._additionalRefreshRequested=!1,this._refreshTimeoutID=void 0},t)}}_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)}},Ph=20,Fh=class extends U{constructor(e,t,n,r){super(),this._terminal=e,this._coreBrowserService=n,this._renderService=r,this._rowColumns=new WeakMap,this._liveRegionLineCount=0,this._charsToConsume=[],this._charsToAnnounce=``;let i=this._coreBrowserService.mainDocument;this._accessibilityContainer=i.createElement(`div`),this._accessibilityContainer.classList.add(`xterm-accessibility`),this._rowContainer=i.createElement(`div`),this._rowContainer.setAttribute(`role`,`list`),this._rowContainer.classList.add(`xterm-accessibility-tree`),this._rowElements=[];for(let e=0;e<this._terminal.rows;e++)this._rowElements[e]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[e]);if(this._topBoundaryFocusListener=e=>this._handleBoundaryFocus(e,0),this._bottomBoundaryFocusListener=e=>this._handleBoundaryFocus(e,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=i.createElement(`div`),this._liveRegion.classList.add(`live-region`),this._liveRegion.setAttribute(`aria-live`,`assertive`),this._accessibilityContainer.appendChild(this._liveRegion),this._liveRegionDebouncer=this._register(new Nh(this._renderRows.bind(this))),!this._terminal.element)throw Error(`Cannot enable accessibility before Terminal.open`);this._terminal.element.insertAdjacentElement(`afterbegin`,this._accessibilityContainer),this._register(this._terminal.onResize(e=>this._handleResize(e.rows))),this._register(this._terminal.onRender(e=>this._refreshRows(e.start,e.end))),this._register(this._terminal.onScroll(()=>this._refreshRows())),this._register(this._terminal.onA11yChar(e=>this._handleChar(e))),this._register(this._terminal.onLineFeed(()=>this._handleChar(`
|
|
27
|
-
`))),this._register(this._terminal.onA11yTab(e=>this._handleTab(e))),this._register(this._terminal.onKey(e=>this._handleKey(e.key))),this._register(this._terminal.onBlur(()=>this._clearLiveRegion())),this._register(this._renderService.onDimensionsChange(()=>this._refreshRowsDimensions())),this._register(Y(i,`selectionchange`,()=>this._handleSelectionChange())),this._register(this._coreBrowserService.onDprChange(()=>this._refreshRowsDimensions())),this._refreshRowsDimensions(),this._refreshRows(),this._register(Sl(()=>{this._accessibilityContainer.remove(),this._rowElements.length=0}))}_handleTab(e){for(let t=0;t<e;t++)this._handleChar(` `)}_handleChar(e){this._liveRegionLineCount<Ph+1&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==e&&(this._charsToAnnounce+=e):this._charsToAnnounce+=e,e===`
|
|
28
|
-
`&&(this._liveRegionLineCount++,this._liveRegionLineCount===Ph+1&&(this._liveRegion.textContent+=mc.get())))}_clearLiveRegion(){this._liveRegion.textContent=``,this._liveRegionLineCount=0}_handleKey(e){this._clearLiveRegion(),/\p{Control}/u.test(e)||this._charsToConsume.push(e)}_refreshRows(e,t){this._liveRegionDebouncer.refresh(e,t,this._terminal.rows)}_renderRows(e,t){let n=this._terminal.buffer,r=n.lines.length.toString();for(let i=e;i<=t;i++){let e=n.lines.get(n.ydisp+i),t=[],a=e?.translateToString(!0,void 0,void 0,t)||``,o=(n.ydisp+i+1).toString(),s=this._rowElements[i];s&&(a.length===0?(s.textContent=`\xA0`,this._rowColumns.set(s,[0,1])):(s.textContent=a,this._rowColumns.set(s,t)),s.setAttribute(`aria-posinset`,o),s.setAttribute(`aria-setsize`,r),this._alignRowWidth(s))}this._announceCharacters()}_announceCharacters(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce=``)}_handleBoundaryFocus(e,t){let n=e.target,r=this._rowElements[t===0?1:this._rowElements.length-2];if(n.getAttribute(`aria-posinset`)===(t===0?`1`:`${this._terminal.buffer.lines.length}`)||e.relatedTarget!==r)return;let i,a;if(t===0?(i=n,a=this._rowElements.pop(),this._rowContainer.removeChild(a)):(i=this._rowElements.shift(),a=n,this._rowContainer.removeChild(i)),i.removeEventListener(`focus`,this._topBoundaryFocusListener),a.removeEventListener(`focus`,this._bottomBoundaryFocusListener),t===0){let e=this._createAccessibilityTreeNode();this._rowElements.unshift(e),this._rowContainer.insertAdjacentElement(`afterbegin`,e)}else{let e=this._createAccessibilityTreeNode();this._rowElements.push(e),this._rowContainer.appendChild(e)}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},n={node:e.focusNode,offset:e.focusOffset};if((t.node.compareDocumentPosition(n.node)&Node.DOCUMENT_POSITION_PRECEDING||t.node===n.node&&t.offset>n.offset)&&([t,n]=[n,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(n.node.compareDocumentPosition(r)&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_PRECEDING)&&(n={node:r,offset:r.textContent?.length??0}),!this._rowContainer.contains(n.node))return;let i=({node:e,offset:t})=>{let n=e instanceof Text?e.parentNode:e,r=parseInt(n?.getAttribute(`aria-posinset`),10)-1;if(isNaN(r))return console.warn(`row is invalid. Race condition?`),null;let i=this._rowColumns.get(n);if(!i)return console.warn(`columns is null. Race condition?`),null;let a=t<i.length?i[t]:i.slice(-1)[0]+1;return a>=this._terminal.cols&&(++r,a=0),{row:r,column:a}},a=i(t),o=i(n);if(a&&o){if(a.row>o.row||a.row===o.row&&a.column>=o.column)throw Error(`invalid range`);this._terminal.select(a.column,a.row,(o.row-a.row)*this._terminal.cols-a.column+o.column)}}_handleResize(e){this._rowElements[this._rowElements.length-1].removeEventListener(`focus`,this._bottomBoundaryFocusListener);for(let e=this._rowContainer.children.length;e<this._terminal.rows;e++)this._rowElements[e]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[e]);for(;this._rowElements.length>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,n=this._rowColumns.get(e)?.slice(-1)?.[0];if(!n)return;let r=n*this._renderService.dimensions.css.cell.width;e.style.transform=`scaleX(${r/t})`}};Fh=uc([V(1,Bc),V(2,Yc),V(3,Zc)],Fh);var Ih=class extends U{constructor(e,t,n,r,i){super(),this._element=e,this._mouseService=t,this._renderService=n,this._bufferService=r,this._linkProviderService=i,this._linkCacheDisposables=[],this._isMouseOut=!0,this._wasResized=!1,this._activeLine=-1,this._onShowLinkUnderline=this._register(new W),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this._register(new W),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this._register(Sl(()=>{bl(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(Y(this._element,`mouseleave`,()=>{this._isMouseOut=!0,this._clearCurrentLink()})),this._register(Y(this._element,`mousemove`,this._handleMouseMove.bind(this))),this._register(Y(this._element,`mousedown`,this._handleMouseDown.bind(this))),this._register(Y(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 n=e.composedPath();for(let e=0;e<n.length;e++){let t=n[e];if(t.classList.contains(`xterm`))break;if(t.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){this._activeLine!==e.y||this._wasResized?(this._clearCurrentLink(),this._askForLink(e,!1),this._wasResized=!1):this._currentLink&&this._linkAtPosition(this._currentLink.link,e)||(this._clearCurrentLink(),this._askForLink(e,!0))}_askForLink(e,t){this._activeProviderReplies&&t||(this._activeProviderReplies?.forEach(e=>{e?.forEach(e=>{e.link.dispose&&e.link.dispose()})}),this._activeProviderReplies=new Map,this._activeLine=e.y);let n=!1;for(let[r,i]of this._linkProviderService.linkProviders.entries())t?this._activeProviderReplies?.get(r)&&(n=this._checkLinkProviderResult(r,e,n)):i.provideLinks(e.y,t=>{if(this._isMouseOut)return;let i=t?.map(e=>({link:e}));this._activeProviderReplies?.set(r,i),n=this._checkLinkProviderResult(r,e,n),this._activeProviderReplies?.size===this._linkProviderService.linkProviders.length&&this._removeIntersectingLinks(e.y,this._activeProviderReplies)})}_removeIntersectingLinks(e,t){let n=new Set;for(let r=0;r<t.size;r++){let i=t.get(r);if(i)for(let t=0;t<i.length;t++){let r=i[t],a=r.link.range.start.y<e?0:r.link.range.start.x,o=r.link.range.end.y>e?this._bufferService.cols:r.link.range.end.x;for(let e=a;e<=o;e++){if(n.has(e)){i.splice(t--,1);break}n.add(e)}}}}_checkLinkProviderResult(e,t,n){if(!this._activeProviderReplies)return n;let r=this._activeProviderReplies.get(e),i=!1;for(let t=0;t<e;t++)(!this._activeProviderReplies.has(t)||this._activeProviderReplies.get(t))&&(i=!0);if(!i&&r){let e=r.find(e=>this._linkAtPosition(e.link,t));e&&(n=!0,this._handleNewLink(e))}if(this._activeProviderReplies.size===this._linkProviderService.linkProviders.length&&!n)for(let e=0;e<this._activeProviderReplies.size;e++){let r=this._activeProviderReplies.get(e)?.find(e=>this._linkAtPosition(e.link,t));if(r){n=!0,this._handleNewLink(r);break}}return n}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(e){if(!this._currentLink)return;let t=this._positionFromMouseEvent(e,this._element,this._mouseService);t&&this._mouseDownLink&&Lh(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,bl(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||e.link.decorations.underline,pointerCursor:e.link.decorations===void 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:e=>{this._currentLink?.state&&this._currentLink.state.decorations.pointerCursor!==e&&(this._currentLink.state.decorations.pointerCursor=e,this._currentLink.state.isHovered&&this._element.classList.toggle(`xterm-cursor-pointer`,e))}},underline:{get:()=>this._currentLink?.state?.decorations.underline,set:t=>{this._currentLink?.state&&this._currentLink?.state?.decorations.underline!==t&&(this._currentLink.state.decorations.underline=t,this._currentLink.state.isHovered&&this._fireUnderlineEvent(e.link,t))}}}),this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange(e=>{if(!this._currentLink)return;let t=e.start===0?0:e.start+1+this._bufferService.buffer.ydisp,n=this._bufferService.buffer.ydisp+1+e.end;if(this._currentLink.link.range.start.y>=t&&this._currentLink.link.range.end.y<=n&&(this._clearCurrentLink(t,n),this._lastMouseEvent)){let e=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);e&&this._askForLink(e,!1)}})))}_linkHover(e,t,n){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(n,t.text)}_fireUnderlineEvent(e,t){let n=e.range,r=this._bufferService.buffer.ydisp,i=this._createLinkUnderlineEvent(n.start.x-1,n.start.y-r-1,n.end.x,n.end.y-r-1,void 0);(t?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(i)}_linkLeave(e,t,n){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(n,t.text)}_linkAtPosition(e,t){let n=e.range.start.y*this._bufferService.cols+e.range.start.x,r=e.range.end.y*this._bufferService.cols+e.range.end.x,i=t.y*this._bufferService.cols+t.x;return n<=i&&i<=r}_positionFromMouseEvent(e,t,n){let r=n.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,n,r,i){return{x1:e,y1:t,x2:n,y2:r,cols:this._bufferService.cols,fg:i}}};Ih=uc([V(1,Xc),V(2,Zc),V(3,Ic),V(4,tl)],Ih);function Lh(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 Rh=class extends Ch{constructor(e={}){super(e),this._linkifier=this._register(new Tl),this.browser=Zf,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this._register(new Tl),this._onCursorMove=this._register(new W),this.onCursorMove=this._onCursorMove.event,this._onKey=this._register(new W),this.onKey=this._onKey.event,this._onRender=this._register(new W),this.onRender=this._onRender.event,this._onSelectionChange=this._register(new W),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this._register(new W),this.onTitleChange=this._onTitleChange.event,this._onBell=this._register(new W),this.onBell=this._onBell.event,this._onFocus=this._register(new W),this._onBlur=this._register(new W),this._onA11yCharEmitter=this._register(new W),this._onA11yTabEmitter=this._register(new W),this._onWillOpen=this._register(new W),this._setup(),this._decorationService=this._instantiationService.createInstance(Ah),this._instantiationService.setService(Gc,this._decorationService),this._linkProviderService=this._instantiationService.createInstance(Kf),this._instantiationService.setService(tl,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(Kc)),this._register(this._inputHandler.onRequestBell(()=>this._onBell.fire())),this._register(this._inputHandler.onRequestRefreshRows(e=>this.refresh(e?.start??0,e?.end??this.rows-1))),this._register(this._inputHandler.onRequestSendFocus(()=>this._reportFocus())),this._register(this._inputHandler.onRequestReset(()=>this.reset())),this._register(this._inputHandler.onRequestWindowsOptionsReport(e=>this._reportWindowsOptions(e))),this._register(this._inputHandler.onColor(e=>this._handleColorEvent(e))),this._register(Ml.forward(this._inputHandler.onCursorMove,this._onCursorMove)),this._register(Ml.forward(this._inputHandler.onTitleChange,this._onTitleChange)),this._register(Ml.forward(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this._register(Ml.forward(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this._register(this._bufferService.onResize(e=>this._afterResize(e.cols,e.rows))),this._register(Sl(()=>{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 e,n=``;switch(t.index){case 256:e=`foreground`,n=`10`;break;case 257:e=`background`,n=`11`;break;case 258:e=`cursor`,n=`12`;break;default:e=`ansi`,n=`4;`+t.index}switch(t.type){case 0:let r=hf.toColorRGB(e===`ansi`?this._themeService.colors.ansi[t.index]:this._themeService.colors[e]);this.coreService.triggerDataEvent(`${Z.ESC}]${n};${sh(r)}${sf.ST}`);break;case 1:if(e===`ansi`)this._themeService.modifyColors(e=>e.ansi[t.index]=mf.toColor(...t.color));else{let n=e;this._themeService.modifyColors(e=>e[n]=mf.toColor(...t.color))}break;case 2:this._themeService.restoreColor(t.index)}}}_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(Fh,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(e){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(Z.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(Z.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 n=Math.min(this.buffer.x,this.cols-1),r=this._renderService.dimensions.css.cell.height,i=t.getWidth(n),a=this._renderService.dimensions.css.cell.width*i,o=this.buffer.y*this._renderService.dimensions.css.cell.height,s=n*this._renderService.dimensions.css.cell.width;this.textarea.style.left=s+`px`,this.textarea.style.top=o+`px`,this.textarea.style.width=a+`px`,this.textarea.style.height=r+`px`,this.textarea.style.lineHeight=r+`px`,this.textarea.style.zIndex=`-5`}_initGlobal(){this._bindKeys(),this._register(Y(this.element,`copy`,e=>{this.hasSelection()&&_c(e,this._selectionService)}));let e=e=>vc(e,this.textarea,this.coreService,this.optionsService);this._register(Y(this.textarea,`paste`,e)),this._register(Y(this.element,`paste`,e)),tp?this._register(Y(this.element,`mousedown`,e=>{e.button===2&&xc(e,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})):this._register(Y(this.element,`contextmenu`,e=>{xc(e,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})),lp&&this._register(Y(this.element,`auxclick`,e=>{e.button===1&&bc(e,this.textarea,this.screenElement)}))}_bindKeys(){this._register(Y(this.textarea,`keyup`,e=>this._keyUp(e),!0)),this._register(Y(this.textarea,`keydown`,e=>this._keyDown(e),!0)),this._register(Y(this.textarea,`keypress`,e=>this._keyPress(e),!0)),this._register(Y(this.textarea,`compositionstart`,()=>this._compositionHelper.compositionstart())),this._register(Y(this.textarea,`compositionupdate`,e=>this._compositionHelper.compositionupdate(e))),this._register(Y(this.textarea,`compositionend`,()=>this._compositionHelper.compositionend())),this._register(Y(this.textarea,`input`,e=>this._inputEvent(e),!0)),this._register(this.onRender(()=>this._compositionHelper.updateCompositionElements()))}open(e){if(!e)throw 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(Y(this.screenElement,`mousemove`,e=>this.updateCursorStyle(e))),this._helperContainer=this._document.createElement(`div`),this._helperContainer.classList.add(`xterm-helpers`),this.screenElement.appendChild(this._helperContainer),t.appendChild(this.screenElement);let n=this.textarea=this._document.createElement(`textarea`);this.textarea.classList.add(`xterm-helper-textarea`),this.textarea.setAttribute(`aria-label`,fc.get()),up||this.textarea.setAttribute(`aria-multiline`,`false`),this.textarea.setAttribute(`autocorrect`,`off`),this.textarea.setAttribute(`autocapitalize`,`off`),this.textarea.setAttribute(`spellcheck`,`false`),this.textarea.tabIndex=0,this._register(this.optionsService.onSpecificOptionChange(`disableStdin`,()=>n.readOnly=this.optionsService.rawOptions.disableStdin)),this.textarea.readOnly=this.optionsService.rawOptions.disableStdin,this._coreBrowserService=this._register(this._instantiationService.createInstance(Wf,this.textarea,e.ownerDocument.defaultView??window,this._document??typeof window<`u`?window.document:null)),this._instantiationService.setService(Yc,this._coreBrowserService),this._register(Y(this.textarea,`focus`,e=>this._handleTextAreaFocus(e))),this._register(Y(this.textarea,`blur`,()=>this._handleTextAreaBlur())),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(Vf,this._document,this._helperContainer),this._instantiationService.setService(Jc,this._charSizeService),this._themeService=this._instantiationService.createInstance(Jp),this._instantiationService.setService(el,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(Sf),this._instantiationService.setService($c,this._characterJoinerService),this._renderService=this._register(this._instantiationService.createInstance(gp,this.rows,this.screenElement)),this._instantiationService.setService(Zc,this._renderService),this._register(this._renderService.onRenderedViewportChange(e=>this._onRender.fire(e))),this.onResize(e=>this._renderService.resize(e.cols,e.rows)),this._compositionView=this._document.createElement(`div`),this._compositionView.classList.add(`composition-view`),this._compositionHelper=this._instantiationService.createInstance(cf,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseService=this._instantiationService.createInstance(Yf),this._instantiationService.setService(Xc,this._mouseService);let r=this._linkifier.value=this._register(this._instantiationService.createInstance(Ih,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(Qd,this.element,this.screenElement)),this._register(this._viewport.onRequestScrollLines(e=>{super.scrollLines(e,!1),this.refresh(0,this.rows-1)})),this._selectionService=this._register(this._instantiationService.createInstance(Rp,this.element,this.screenElement,r)),this._instantiationService.setService(Qc,this._selectionService),this._register(this._selectionService.onRequestScrollLines(e=>this.scrollLines(e.amount,e.suppressScrollEvent))),this._register(this._selectionService.onSelectionChange(()=>this._onSelectionChange.fire())),this._register(this._selectionService.onRequestRedraw(e=>this._renderService.handleSelectionChanged(e.start,e.end,e.columnSelectMode))),this._register(this._selectionService.onLinuxMouseSelection(e=>{this.textarea.value=e,this.textarea.focus(),this.textarea.select()})),this._register(Ml.any(this._onScroll.event,this._inputHandler.onScroll)(()=>{this._selectionService.refresh(),this._viewport?.queueSync()})),this._register(this._instantiationService.createInstance($d,this.screenElement)),this._register(Y(this.element,`mousedown`,e=>this._selectionService.handleMouseDown(e))),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(Fh,this)),this._register(this.optionsService.onSpecificOptionChange(`screenReaderMode`,e=>this._handleScreenReaderModeOptionChange(e))),this.options.overviewRuler.width&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(af,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange(`overviewRuler`,e=>{!this._overviewRulerRenderer&&e&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(af,this._viewportElement,this.screenElement)))}),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()}_createRenderer(){return this._instantiationService.createInstance(Bf,this,this._document,this.element,this.screenElement,this._viewportElement,this._helperContainer,this.linkifier)}bindMouse(){let e=this,t=this.element;function n(t){let n=e._mouseService.getMouseReportCoords(t,e.screenElement);if(!n)return!1;let r,i;switch(t.overrideType||t.type){case`mousemove`:i=32,t.buttons===void 0?(r=3,t.button!==void 0&&(r=t.button<3?t.button:3)):r=t.buttons&1?0:t.buttons&4?1:t.buttons&2?2:3;break;case`mouseup`:i=0,r=t.button<3?t.button:3;break;case`mousedown`:i=1,r=t.button<3?t.button:3;break;case`wheel`:if(e._customWheelEventHandler&&e._customWheelEventHandler(t)===!1)return!1;let n=t.deltaY;if(n===0||e.coreMouseService.consumeWheelEvent(t,e._renderService?.dimensions?.device?.cell?.height,e._coreBrowserService?.dpr)===0)return!1;i=n<0?0:1,r=4;break;default:return!1}return i===void 0||r===void 0||r>4?!1:e.coreMouseService.triggerMouseEvent({col:n.col,row:n.row,x:n.x,y:n.y,button:r,action:i,ctrl:t.ctrlKey,alt:t.altKey,shift:t.shiftKey})}let r={mouseup:null,wheel:null,mousedrag:null,mousemove:null},i={mouseup:e=>(n(e),e.buttons||(this._document.removeEventListener(`mouseup`,r.mouseup),r.mousedrag&&this._document.removeEventListener(`mousemove`,r.mousedrag)),this.cancel(e)),wheel:e=>(n(e),this.cancel(e,!0)),mousedrag:e=>{e.buttons&&n(e)},mousemove:e=>{e.buttons||n(e)}};this._register(this.coreMouseService.onProtocolChange(e=>{e?(this.optionsService.rawOptions.logLevel===`debug`&&this._logService.debug(`Binding to mouse events:`,this.coreMouseService.explainEvents(e)),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()),e&8?r.mousemove||=(t.addEventListener(`mousemove`,i.mousemove),i.mousemove):(t.removeEventListener(`mousemove`,r.mousemove),r.mousemove=null),e&16?r.wheel||=(t.addEventListener(`wheel`,i.wheel,{passive:!1}),i.wheel):(t.removeEventListener(`wheel`,r.wheel),r.wheel=null),e&2?r.mouseup||=i.mouseup:(this._document.removeEventListener(`mouseup`,r.mouseup),r.mouseup=null),e&4?r.mousedrag||=i.mousedrag:(this._document.removeEventListener(`mousemove`,r.mousedrag),r.mousedrag=null)})),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this._register(Y(t,`mousedown`,e=>{if(e.preventDefault(),this.focus(),this.coreMouseService.areMouseEventsActive&&!this._selectionService.shouldForceSelection(e))return n(e),r.mouseup&&this._document.addEventListener(`mouseup`,r.mouseup),r.mousedrag&&this._document.addEventListener(`mousemove`,r.mousedrag),this.cancel(e)})),this._register(Y(t,`wheel`,t=>{if(!r.wheel){if(this._customWheelEventHandler&&this._customWheelEventHandler(t)===!1)return!1;if(!this.buffer.hasScrollback){if(t.deltaY===0)return!1;if(e.coreMouseService.consumeWheelEvent(t,e._renderService?.dimensions?.device?.cell?.height,e._coreBrowserService?.dpr)===0)return this.cancel(t,!0);let n=Z.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?`O`:`[`)+(t.deltaY<0?`A`:`B`);return this.coreService.triggerDataEvent(n,!0),this.cancel(t,!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){yc(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 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 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,n){this._selectionService.setSelection(e,t,n)}getSelection(){return this._selectionService?this._selectionService.selectionText:``}getSelectionPosition(){if(this._selectionService&&this._selectionService.hasSelection)return{start:{x:this._selectionService.selectionStart[0],y:this._selectionService.selectionStart[1]},end:{x:this._selectionService.selectionEnd[0],y:this._selectionService.selectionEnd[1]}}}clearSelection(){this._selectionService?.clearSelection()}selectAll(){this._selectionService?.selectAll()}selectLines(e,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 n=Th(e,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(e),n.type===3||n.type===2){let t=this.rows-1;return this.scrollLines(n.type===2?-t:t),this.cancel(e,!0)}if(n.type===1&&this.selectAll(),this._isThirdLevelShift(this.browser,e)||(n.cancel&&this.cancel(e,!0),!n.key)||e.key&&!e.ctrlKey&&!e.altKey&&!e.metaKey&&e.key.length===1&&e.key.charCodeAt(0)>=65&&e.key.charCodeAt(0)<=90)return!0;if(this._unprocessedDeadKey)return this._unprocessedDeadKey=!1,!0;if((n.key===Z.ETX||n.key===Z.CR)&&(this.textarea.value=``),this._onKey.fire({key:n.key,domEvent:e}),this._showCursor(),this.coreService.triggerDataEvent(n.key,!0),!this.optionsService.rawOptions.screenReaderMode||e.altKey||e.ctrlKey)return this.cancel(e,!0);this._keyDownHandled=!0}_isThirdLevelShift(e,t){let n=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`?n:n&&(!t.keyCode||t.keyCode>47)}_keyUp(e){this._keyDownSeen=!1,!(this._customKeyEventHandler&&this._customKeyEventHandler(e)===!1)&&(zh(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){e===this.cols&&t===this.rows?this._charSizeService&&!this._charSizeService.hasValidSize&&this._charSizeService.measure():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(rm));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(Z.ESC+`[I`):this.coreService.triggerDataEvent(Z.ESC+`[O`)}_reportWindowsOptions(e){if(this._renderService)switch(e){case 0:let e=this._renderService.dimensions.css.canvas.width.toFixed(0),t=this._renderService.dimensions.css.canvas.height.toFixed(0);this.coreService.triggerDataEvent(`${Z.ESC}[4;${t};${e}t`);break;case 1:let n=this._renderService.dimensions.css.cell.width.toFixed(0),r=this._renderService.dimensions.css.cell.height.toFixed(0);this.coreService.triggerDataEvent(`${Z.ESC}[6;${r};${n}t`)}}cancel(e,t){if(this.options.cancelEvents||t)return e.preventDefault(),e.stopPropagation(),!1}};function zh(e){return e.keyCode===16||e.keyCode===17||e.keyCode===18}var Bh=class{constructor(){this._addons=[]}dispose(){for(let e=this._addons.length-1;e>=0;e--)this._addons[e].instance.dispose()}loadAddon(e,t){let n={instance:t,dispose:t.dispose,isDisposed:!1};this._addons.push(n),t.dispose=()=>this._wrappedAddonDispose(n),t.activate(e)}_wrappedAddonDispose(e){if(e.isDisposed)return;let t=-1;for(let n=0;n<this._addons.length;n++)if(this._addons[n]===e){t=n;break}if(t===-1)throw Error(`Could not dispose an addon that has not been loaded`);e.isDisposed=!0,e.dispose.apply(e.instance),this._addons.splice(t,1)}},Vh=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 Ac)}translateToString(e,t,n){return this._line.translateToString(e,t,n)}},Hh=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 Vh(t)}getNullCell(){return new Ac}},Uh=class extends U{constructor(e){super(),this._core=e,this._onBufferChange=this._register(new W),this.onBufferChange=this._onBufferChange.event,this._normal=new Hh(this._core.buffers.normal,`normal`),this._alternate=new Hh(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 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)}},Wh=class{constructor(e){this._core=e}registerCsiHandler(e,t){return this._core.registerCsiHandler(e,e=>t(e.toArray()))}addCsiHandler(e,t){return this.registerCsiHandler(e,t)}registerDcsHandler(e,t){return this._core.registerDcsHandler(e,(e,n)=>t(e,n.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)}},Gh=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}},Kh=[`cols`,`rows`],qh=0,Jh=class extends U{constructor(e){super(),this._core=this._register(new Rh(e)),this._addonManager=this._register(new Bh),this._publicOptions={...this._core.options};let t=e=>this._core.options[e],n=(e,t)=>{this._checkReadonlyOptions(e),this._core.options[e]=t};for(let e in this._core.options){let r={get:t.bind(this,e),set:n.bind(this,e)};Object.defineProperty(this._publicOptions,e,r)}}_checkReadonlyOptions(e){if(Kh.includes(e))throw Error(`Option "${e}" can only be set in the constructor`)}_checkProposedApi(){if(!this._core.optionsService.rawOptions.allowProposedApi)throw 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||=new Wh(this._core),this._parser}get unicode(){return this._checkProposedApi(),new Gh(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._register(new Uh(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`}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,n){this._verifyIntegers(e,t,n),this._core.select(e,t,n)}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
|
|
29
|
-
`,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 fc.get()},set promptLabel(e){fc.set(e)},get tooMuchOutput(){return mc.get()},set tooMuchOutput(e){mc.set(e)}}}_verifyIntegers(...e){for(qh of e)if(qh===1/0||isNaN(qh)||qh%1!=0)throw Error(`This API only accepts integers`)}_verifyPositiveIntegers(...e){for(qh of e)if(qh&&(qh===1/0||isNaN(qh)||qh%1!=0||qh<0))throw Error(`This API only accepts positive integers`)}},Yh=`gonogo.livery`;function Xh(e){return e.liveries.find(t=>t.slug===e.current)??Be().find(e=>e.slug===`instrument`)}var Zh=[`--body`,`--panel`,`--text`,`--lcd`,`--work`,`--you`,`--go`,`--nogo`],Qh=(e,t)=>e.builtin?`Ships with gonogo`:e.author===null?`Custom`:`Designed by ${t(e.author)}`;function $h(e){let t=e.trim();return t===``?`Say what you want it to look like.`:t.length>500?`At most 500 characters.`:``}var eg=(e,t,n)=>t?`Asked ${e}. The livery appears in the list when it submits one.`:`Not sent: ${n??`the message was not delivered`}`,tg=(e,t)=>parseInt(e.slice(t,t+2),16),ng=(e,t,n)=>`#${[1,3,5].map(r=>Math.round(tg(e,r)*(1-n)+tg(t,r)*n).toString(16).padStart(2,`0`)).join(``)}`;function rg(e){let t=t=>Me(e[t]??``)??Me(ze.tokens[t]),n=t(`--lcd`),r=t(`--lcd-text`);return{background:n,foreground:r,cursor:r,cursorAccent:n,selectionBackground:ng(n,r,.3)}}function ig(e){try{let{slug:t,tokens:n}=(e===null?null:JSON.parse(e))??{};return typeof t==`string`&&RegExp(`^[a-z0-9][a-z0-9-]{0,39}$`).test(t)&&Ie(n).length===0?{slug:t,tokens:n}:null}catch{return null}}function ag(e){let t=document.documentElement,n=e.slug===`instrument`?[]:Le(e.tokens);for(let e of[...he,`color-scheme`])t.style.removeProperty(e);for(let[e,r]of n)t.style.setProperty(e,r);n.length===0?(t.removeAttribute(`data-livery`),t.removeAttribute(`data-scheme`)):(t.setAttribute(`data-livery`,e.slug),t.setAttribute(`data-scheme`,Fe(e.tokens))),document.querySelector(`meta[name="theme-color"]`)?.setAttribute(`content`,Me(e.tokens[`--body`]??``)??ze.tokens[`--body`]),document.querySelector(`meta[name="color-scheme"]`)?.setAttribute(`content`,Fe(e.tokens))}function og(){let e=ig(et(Yh));e!==null&&ag(e);let t=e===null?``:JSON.stringify(e),n=M.getState().livery;M.subscribe(()=>{let{livery:e}=M.getState();if(e===n)return;n=e;let{slug:r,tokens:i}=Xh(e),a=JSON.stringify({slug:r,tokens:i});a!==t&&(t=a,ag({slug:r,tokens:i}),tt(Yh,a))})}var sg=`"Geist Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace`,cg=10,lg=50,ug=1e3,dg=(e,t)=>Number.isInteger(e)&&Number.isInteger(t)&&e>=1&&t>=1&&e<=ug&&t<=ug;function fg(){document.querySelector(`.room-tile[data-selected="true"]`)?.focus()}var pg=()=>rg(Xh(M.getState().livery).tokens);function mg(e,t){let n=new Jh({cursorBlink:!0,fontFamily:sg,fontSize:13,scrollback:2e3,macOptionIsMeta:!0,theme:pg()}),r=M.getState().livery,i=M.subscribe(()=>{let e=M.getState().livery;e!==r&&(r=e,n.options.theme=pg())}),a=new oc;n.loadAddon(a),n.open(e),n.textarea?.setAttribute(`name`,`terminal-input`),document.fonts.load(`13px "Geist Mono"`).then(()=>{m||(n.options.fontFamily=`monospace`,n.options.fontFamily=sg,y(),x())});let o={agent:null,connection:`connecting`},s=null,c=null,l=null,u=null,d=0,f,p,m=!1,h=()=>document.visibilityState===`visible`&&e.clientWidth>0&&e.clientHeight>0,g=()=>s!==null&&s.running&&o.connection===`open`&&o.agent!==null&&o.agent.name===s.name&&o.agent.state!==`stopped`;function _(){if(!g()){t(!1);return}let e=a.proposeDimensions();t(e!==void 0&&(e.cols!==n.cols||e.rows!==n.rows))}function v(){s!==null&&g()&&h()&&(l===null||l.cols!==n.cols||l.rows!==n.rows)&&(l={cols:n.cols,rows:n.rows},ii(s.name,n.cols,n.rows))}function y(){h()&&(g()&&(a.fit(),v()),_())}function b(e){let r=a.proposeDimensions();r===void 0&&d<cg?(d+=1,clearTimeout(f),f=setTimeout(x,lg)):(d=0,ei(e.name,r)&&(c={name:e.name,generation:e.generation},u!==e.name&&(u=e.name,n.reset(),t(!1))))}function x(){if(m)return;let e=o.agent;if(e===null){u!==null&&(u=null,n.reset()),(s!==null||c!==null)&&(s=null,c=null,ti()),t(!1);return}if(o.connection!==`open`||!h())return;let r=s===null||s.name!==e.name||s.generation!==e.generation||!s.running&&e.state!==`stopped`,i=c!==null&&c.name===e.name&&c.generation===e.generation;r&&!i&&b(e)}function S(){let e=document.activeElement;(e===null||e===document.body)&&n.focus()}function C(e){c=null,!m&&dg(e.cols,e.rows)&&(s={name:e.agent,generation:e.generation,running:e.running},l={cols:e.cols,rows:e.rows},n.reset(),n.resize(e.cols,e.rows),n.write(e.data,()=>{m||(_(),S())}),_())}function ee(e){s!==null&&e.agent===s.name&&dg(e.cols,e.rows)&&((e.cols!==n.cols||e.rows!==n.rows)&&(l={cols:e.cols,rows:e.rows},n.resize(e.cols,e.rows)),_())}function w(e,t){s!==null&&g()&&ri(s.name,e,t)}n.attachCustomKeyEventHandler(e=>e.isComposing?!0:e.altKey&&e.shiftKey&&e.code===`KeyT`?(e.type===`keydown`&&(e.preventDefault(),fg()),!1):e.key===`Enter`&&e.shiftKey&&!e.altKey&&!e.ctrlKey&&!e.metaKey?(e.type===`keydown`&&(e.preventDefault(),w(`\x1B\r`,!1)),!1):!0);let T=[n.onData(e=>w(e,!1)),n.onBinary(e=>w(e,!0)),n.onResize(()=>{v(),_()})],E=Qr({snapshot:C,output:e=>n.write(e),size:ee,error:e=>{e.ref===`attach`&&(c=null)}}),te=new ResizeObserver(()=>{clearTimeout(p),p=setTimeout(()=>{y(),x()},120)});te.observe(e.parentElement??e);let D=()=>{document.visibilityState===`visible`&&(y(),x())};return document.addEventListener(`visibilitychange`,D),{update(e){o=e,e.connection!==`open`&&(c=null,s=null,t(!1)),x()},claimSize(){g()&&h()&&(a.fit(),v(),_(),n.focus())},dispose(){m=!0,clearTimeout(f),clearTimeout(p),te.disconnect(),document.removeEventListener(`visibilitychange`,D),E(),i();for(let e of T)e.dispose();ti(),a.dispose(),n.dispose()}}}function hg({agent:e}){let t=N(e=>e.connection),n=N(e=>e.failedAttempts),r=(0,l.useRef)(null),i=(0,l.useRef)(null),[a,o]=(0,l.useState)(!1);(0,l.useEffect)(()=>{let e=r.current;if(e===null)return;let t=mg(e,o);return i.current=t,()=>{t.dispose(),i.current=null}},[]),(0,l.useEffect)(()=>{i.current?.update({agent:e,connection:t})},[e,t]);let s=t!==`open`,c=e!==null&&e.state===`stopped`,u=null;return t===`reconnecting`?u=n>=3?ai:`Reconnecting...`:t===`connecting`&&(u=`Connecting...`),(0,L.jsxs)(`div`,{className:`pane`,children:[(u!==null||a)&&(0,L.jsxs)(`div`,{className:`pane-status`,children:[(0,L.jsx)(`div`,{className:`pane-notice`,role:`status`,title:u??void 0,children:u}),a&&(0,L.jsx)(`button`,{type:`button`,className:`btn`,"data-kind":`quiet`,onClick:()=>i.current?.claimSize(),children:`Size set by another window. Click to use this window's size.`})]}),(0,L.jsxs)(`div`,{className:`term-wrap`,children:[(0,L.jsx)(`div`,{ref:r,id:`terminal-panel`,className:`term-host`,role:`region`,"aria-label":e===null?`Terminal`:`Terminal of ${e.name}`,"data-dim":s||c,"data-scroll":a||c}),e===null&&t!==`connecting`&&(0,L.jsx)(`p`,{className:`pane-empty`,children:`Pick a console in the room`})]}),e!==null&&(0,L.jsx)(`p`,{className:`pane-hint`,children:`Alt+Shift+T returns to the room`})]})}var gg=5e3;function _g(e){if(e===null)return`running`;if(e<1e3)return`${Math.round(e)} ms`;if(e<6e4)return`${(e/1e3).toFixed(1)} s`;let t=Math.round(e/1e3);return`${Math.floor(t/60)} m ${String(t%60).padStart(2,`0`)} s`}function vg(e){let t=new Date(e);return[t.getHours(),t.getMinutes(),t.getSeconds()].map(e=>String(e).padStart(2,`0`)).join(`:`)}function yg(e){let t=Math.max(1,...e.map(e=>e.ms??0));return e.map((e,n)=>{let{tool:r,detail:i}=eo(e.summary);return{key:`${e.at}:${n}`,time:vg(e.at),duration:_g(e.ms),tool:Ua(e.tool),detail:r===null&&e.summary===e.tool?``:i,failed:e.failed,bar:e.ms===null?0:Math.max(2,Math.round(e.ms/t*100))}})}function bg({name:e}){let[t,n]=(0,l.useState)(null),[r,i]=(0,l.useState)(null);return(0,l.useEffect)(()=>{let t=!0,r=()=>{Kn(e).then(e=>{t&&(n(e),i(null))},e=>{t&&i(e instanceof Error?e.message:String(e))})};r();let a=setInterval(r,gg);return()=>{t=!1,clearInterval(a)}},[e]),r===null?t===null?(0,L.jsx)(`p`,{className:`hint`,children:`Loading…`}):t.length===0?(0,L.jsx)(`p`,{className:`hint`,children:`No tool calls yet. They come from the agent's hooks (Claude Code, Gemini CLI).`}):(0,L.jsx)(`ol`,{className:`telemetry lcd`,"aria-label":`Tool calls of ${e}, newest first`,children:yg(t).map(e=>(0,L.jsxs)(`li`,{className:`telemetry-row`,children:[(0,L.jsx)(`span`,{className:`telemetry-time`,children:e.time}),(0,L.jsx)(`span`,{className:`telemetry-tool`,children:e.tool}),(0,L.jsx)(`span`,{className:`telemetry-ms`,"data-failed":e.failed||void 0,children:e.failed?`${e.duration} · failed`:e.duration}),(0,L.jsx)(`span`,{className:`telemetry-bar`,"aria-hidden":`true`,children:(0,L.jsx)(`span`,{style:{width:`${e.bar}%`}})}),e.detail!==``&&(0,L.jsx)(`span`,{className:`telemetry-detail`,children:e.detail})]},e.key))}):(0,L.jsx)(`p`,{className:`error`,role:`alert`,children:r})}function xg({name:e}){let[t,n]=(0,l.useState)(!1);return(0,L.jsxs)(`details`,{className:`panel-fuel`,onToggle:e=>n(e.currentTarget.open),children:[(0,L.jsx)(`summary`,{className:`label`,children:`TELEMETRY`}),t&&(0,L.jsx)(bg,{name:e})]})}var Sg=`(max-width: 699px)`;function Cg(e){let t=typeof matchMedia==`function`?matchMedia(Sg):null;return t?.addEventListener(`change`,e),()=>t?.removeEventListener(`change`,e)}function wg(){return(0,l.useSyncExternalStore)(Cg,()=>typeof matchMedia==`function`&&matchMedia(Sg).matches,()=>!1)}function Tg(){let e=N(e=>e.order),t=N(e=>e.agents);return(0,l.useMemo)(()=>e.flatMap(e=>Object.hasOwn(t,e)?[t[e]]:[]),[e,t])}function Eg(){let e=Tg(),t=(0,l.useMemo)(()=>Ma(e),[e]);return{cells:t,legends:(0,l.useMemo)(()=>Na(t),[t])}}function Dg(e,t){lt(e),t||document.querySelector(`.term-host textarea`)?.focus()}function Og({kind:e}){let{on:t,blink:n}=Fa(e);return(0,L.jsx)(`span`,{className:`led`,"data-kind":e,"data-on":t,"data-blink":n,"aria-hidden":`true`})}function kg({cell:e,selected:t,phone:n}){let r=Nt(),i=N(e=>e.poll);if(e.type!==`agent`){let t=e.type===`open`;return(0,L.jsxs)(`button`,{type:`button`,className:`tile room-tile`,"data-kind":`open`,"aria-label":Ka(e,null),onClick:()=>Dt(t?e.position.id:null),children:[(0,L.jsxs)(`span`,{className:`tile-head`,children:[(0,L.jsx)(Og,{kind:`open`}),(0,L.jsx)(`span`,{className:`tile-legend`,children:t?e.position.callSign:`SPARE`}),(0,L.jsx)(`span`,{className:`tile-num`,"aria-hidden":`true`,children:Ia(e.n)})]}),(0,L.jsx)(`span`,{className:`tile-lcd`,children:(0,L.jsx)(`span`,{className:`tile-sub`,children:t?e.position.summary:`Any agent or command`})}),(0,L.jsx)(`span`,{className:`tile-foot`,children:(0,L.jsx)(`span`,{className:`tile-state`,children:`OPEN`})})]})}let{agent:a,position:o}=e,s=Ga(i,a.name),[c,l]=Wa(a,o),u=s??(a.provider===`custom`?`CUSTOM`:a.held===null?Xa(a)?`ON HOLD`:``:`${a.queued} HELD`);return(0,L.jsxs)(`button`,{type:`button`,className:`tile room-tile`,"data-kind":Pa(a),"data-selected":t||void 0,"aria-current":t?`true`:void 0,"aria-label":Ka(e,s),onClick:()=>Dg(a.name,n),children:[(0,L.jsxs)(`span`,{className:`tile-head`,children:[(0,L.jsx)(Og,{kind:Pa(a)}),(0,L.jsx)(`span`,{className:`tile-legend`,children:e.seated&&o!==null?o.callSign:a.name.toUpperCase()}),(0,L.jsx)(`span`,{className:`tile-num`,"aria-hidden":`true`,children:Ia(e.n)})]}),(0,L.jsxs)(`span`,{className:`tile-lcd`,"aria-hidden":`true`,children:[(0,L.jsx)(`span`,{className:`tile-sub`,children:c}),(0,L.jsx)(`span`,{className:`tile-sub`,children:l})]}),(0,L.jsxs)(`span`,{className:`tile-foot`,"aria-hidden":`true`,children:[(0,L.jsx)(`span`,{className:`tile-state`,children:Ra(a,r,!(n&&s!==null))}),s!==null&&(0,L.jsxs)(`span`,{className:`tile-state tile-state-vote`,children:[`· `,s]}),u===``&&a.cleanRoom?(0,L.jsx)(`span`,{className:`chip tile-right tile-chip`,"data-tone":`quiet`,children:`CLEAN ROOM`}):(0,L.jsx)(`span`,{className:`tile-state tile-right`,children:u})]})]})}function Ag({phone:e}){let{cells:t}=Eg(),n=N(e=>e.selected),r=t.filter(e=>e.type===`agent`).length;return(0,L.jsxs)(`section`,{className:`operations module`,"aria-label":`Operations`,children:[(0,L.jsxs)(`div`,{className:`operations-head`,children:[(0,L.jsxs)(`h2`,{className:`label`,children:[(0,L.jsxs)(`span`,{className:`label-letter`,"aria-hidden":`true`,children:[`E ·`,` `]}),`OPERATIONS`]}),(0,L.jsx)(`span`,{className:`hint`,children:co(r)})]}),(0,L.jsx)(`div`,{className:`matrix`,children:t.map(t=>(0,L.jsx)(kg,{cell:t,selected:t.type===`agent`&&t.agent.name===n,phone:e},t.type===`agent`?`a:${t.agent.name}`:t.type===`open`?`p:${t.position.id}`:`spare`))})]})}function jg({agent:e,size:t}){let{busy:n,error:r,run:i}=To();return(0,L.jsxs)(L.Fragment,{children:[r!==null&&(0,L.jsx)(`p`,{className:`error need-error`,role:`alert`,children:r}),(0,L.jsxs)(`div`,{className:`go-buttons`,"data-size":t,children:[(0,L.jsx)(`button`,{type:`button`,className:`btn`,"data-kind":`danger`,"data-size":`big`,"aria-disabled":n||void 0,onClick:()=>i(()=>Bn(e.name,!1)),children:`NO-GO`}),(0,L.jsx)(`button`,{type:`button`,className:`btn`,"data-kind":`primary`,"data-size":`big`,"aria-disabled":n||void 0,onClick:()=>i(()=>Bn(e.name,!0)),children:`GO`})]})]})}function Mg({agent:e,size:t}){let{busy:n,error:r,run:i}=To();return(0,L.jsxs)(L.Fragment,{children:[r!==null&&(0,L.jsx)(`p`,{className:`error need-error`,role:`alert`,children:r}),(0,L.jsxs)(`div`,{className:`go-buttons`,"data-size":t,children:[(0,L.jsx)(`button`,{type:`button`,className:`btn`,"data-kind":`danger`,"data-size":t===`row`?`big`:void 0,"aria-disabled":n||void 0,onClick:()=>i(()=>Nn(e.name)),children:`STOP`}),(0,L.jsx)(`button`,{type:`button`,className:`btn`,"data-kind":`primary`,"data-size":t===`row`?`big`:void 0,"aria-disabled":n||void 0,onClick:()=>i(()=>Wn(e.name)),children:`RESUME`})]})]})}function Ng({agent:e,legend:t,phone:n}){let r=Nt(),i=Ja(e);return(0,L.jsxs)(`section`,{className:`flood need`,"data-tone":`amber`,"aria-label":Qa(e,t),children:[(0,L.jsx)(`span`,{className:`led need-led`,"data-on":`true`,"data-blink":`true`,"aria-hidden":`true`}),(0,L.jsxs)(`div`,{className:`need-text`,children:[(0,L.jsx)(`h3`,{className:`disp need-title`,children:Qa(e,t)}),(0,L.jsx)(`p`,{className:`need-detail`,children:$a(e,r)})]}),Ya(e)?(0,L.jsx)(Mg,{agent:e,size:n?`phone`:`row`}):i&&!n?(0,L.jsx)(jg,{agent:e,size:`row`}):(0,L.jsx)(`button`,{type:`button`,className:`btn`,"data-kind":`primary`,"data-size":n?void 0:`big`,onClick:()=>Dg(e.name,n),children:n?i?`Answer`:`Open`:`Open the terminal`})]})}function Pg({request:e,legend:t,onFail:n}){let r=Nt(),{busy:i,run:a}=To(),o=aa(e,t),s=t=>a(()=>Vn(e.id,t).catch(r=>n(oa(e.name,t,r))));return(0,L.jsxs)(`section`,{className:`flood need relief-need`,"data-tone":`amber`,"aria-label":o,children:[(0,L.jsx)(`span`,{className:`led need-led`,"data-on":`true`,"data-blink":`true`,"aria-hidden":`true`}),(0,L.jsxs)(`div`,{className:`need-text`,children:[(0,L.jsx)(`h3`,{className:`disp need-title`,children:o}),(0,L.jsx)(`dl`,{className:`relief-rows`,children:ca(e,r).map(e=>(0,L.jsxs)(`div`,{className:`relief-row`,children:[(0,L.jsx)(`dt`,{children:e.label}),(0,L.jsx)(`dd`,{children:e.value})]},e.label))}),(0,L.jsx)(`p`,{className:`relief-role-label`,id:`relief-role-${e.id}`,children:z(e)}),(0,L.jsx)(`p`,{className:`relief-role`,role:`group`,tabIndex:0,"aria-labelledby":`relief-role-${e.id}`,children:e.role})]}),(0,L.jsxs)(`div`,{className:`go-buttons`,children:[(0,L.jsx)(`button`,{type:`button`,className:`btn`,"data-kind":`danger`,"data-size":`big`,"aria-disabled":i||void 0,"aria-label":`NO-GO: do not hire ${e.name}`,onClick:()=>s(!1),children:`NO-GO`}),(0,L.jsx)(`button`,{type:`button`,className:`btn`,"data-kind":`primary`,"data-size":`big`,"aria-disabled":i||void 0,"aria-label":`GO: hire ${e.name}`,onClick:()=>s(!0),children:`GO`})]})]})}function Fg({phone:e}){let t=Tg(),{legends:n}=Eg(),r=N(e=>e.relief),[i,a]=(0,l.useState)(null),o=qa(t);return o.length===0&&r.length===0&&i===null?null:(0,L.jsxs)(`div`,{className:e?`needs`:`needs needs-dock`,children:[i!==null&&(0,L.jsxs)(`section`,{className:`flood need`,"data-tone":`nogo`,role:`alert`,children:[(0,L.jsx)(`p`,{className:`need-text relief-failed`,children:i}),(0,L.jsx)(`button`,{type:`button`,className:`btn`,"data-size":`big`,onClick:()=>a(null),children:`DISMISS`})]}),o.map(t=>(0,L.jsx)(Ng,{agent:t,legend:ua(n,t.name),phone:e},t.name)),r.map(e=>(0,L.jsx)(Pg,{request:e,legend:ua(n,e.by),onFail:a},e.id))]})}function Ig(){let e=Tg().find(e=>e.boss)??null;return(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(Fg,{phone:!1}),(0,L.jsx)(`section`,{className:`your-console`,"aria-label":`Your console`,children:(0,L.jsx)(hi,{boss:e})})]})}function Lg({agent:e,onRemove:t,removeRef:n,locked:r,run:i}){let a=to(e);return(0,L.jsxs)(`div`,{className:`panel-actions`,children:[Za(e)&&(0,L.jsx)(`button`,{type:`button`,className:`btn`,"data-kind":`quiet`,"aria-disabled":r||void 0,onClick:()=>!r&&i(()=>Gn(e.name)),children:`Hold`}),a!==`stopped`&&(0,L.jsx)(`button`,{type:`button`,className:`btn`,"data-kind":`quiet`,"aria-disabled":r||void 0,onClick:()=>!r&&i(()=>Mn(e.name)),children:`Restart`}),a!==`stopped`&&a!==`starting`&&(0,L.jsx)(`button`,{type:`button`,className:`btn`,"data-kind":`quiet`,"aria-disabled":r||void 0,onClick:()=>!r&&i(()=>Nn(e.name)),children:`Stop`}),(0,L.jsx)(`button`,{type:`button`,className:`btn`,"data-kind":`quiet`,"aria-disabled":r||void 0,onClick:()=>!r&&Ot(e.name),children:`Edit`}),(0,L.jsx)(`button`,{type:`button`,className:`btn`,"data-kind":`quiet`,onClick:()=>wt(e.name),children:`Open files`}),(0,L.jsx)(`button`,{type:`button`,className:`btn`,"data-kind":`quiet`,onClick:()=>Tt(e.name),children:`Open git`}),!e.boss&&(0,L.jsx)(`button`,{type:`button`,className:`btn`,"data-kind":`danger`,ref:n,"aria-disabled":r||void 0,onClick:()=>!r&&t(),children:`Remove`})]})}function Rg({agent:e,run:t,locked:n}){let r=Nt(),i=to(e);if(i===`ask`){let{tool:t,detail:n}=eo(Ba(e));return(0,L.jsxs)(`div`,{className:`flood foot-ask`,"data-tone":`amber`,children:[(0,L.jsxs)(`h3`,{className:`disp`,children:[(0,L.jsx)(`span`,{className:`led`,"data-on":`true`,"data-blink":`true`,"aria-hidden":`true`}),`ASKS FOR A GO`]}),(0,L.jsx)(`p`,{className:`need-detail`,children:t===null?n:`${t} · ${n}`}),(0,L.jsx)(jg,{agent:e,size:`row`})]})}if(i===`needs`)return(0,L.jsxs)(`div`,{className:`flood foot-ask`,"data-tone":`amber`,children:[(0,L.jsxs)(`h3`,{className:`disp`,children:[(0,L.jsx)(`span`,{className:`led`,"data-on":`true`,"data-blink":`true`,"aria-hidden":`true`}),Xa(e)?`ON HOLD`:Ya(e)?`HIT THE REDLINE`:`NEEDS YOU`]}),(0,L.jsx)(`p`,{className:`need-detail`,children:$a(e,r)}),Ya(e)?(0,L.jsx)(Mg,{agent:e,size:`row`}):(0,L.jsx)(`p`,{className:`need-detail`,children:`Answer it in the terminal above.`})]});if(i===`stopped`){let r=ci(e.exit);return(0,L.jsxs)(`div`,{className:`foot`,children:[r!==null&&(0,L.jsx)(`p`,{className:`foot-exit`,children:r}),(0,L.jsx)(`p`,{className:`hint`,children:e.provider===`custom`?`Start runs the command again.`:`Mail to a stopped console comes back to you undelivered. Start ${e.provider===`claude`?`picks up its last session`:`opens a new session`}.`}),(0,L.jsx)(`button`,{type:`button`,className:`btn`,"data-kind":`primary`,"data-size":`big`,"aria-disabled":n||void 0,onClick:()=>!n&&t(()=>Mn(e.name)),children:`Start`})]})}return i===`starting`?(0,L.jsxs)(`div`,{className:`foot`,children:[(0,L.jsxs)(`p`,{className:`hint`,children:[`Mail waits until `,e.name,` is idle. If Claude Code asks to trust the folder, it shows here as a go or no-go.`]}),(0,L.jsx)(`button`,{type:`button`,className:`btn`,"data-kind":`quiet`,"aria-disabled":n||void 0,onClick:()=>!n&&t(()=>Nn(e.name)),children:`Stop`})]}):i===`custom`?(0,L.jsxs)(`div`,{className:`foot`,children:[(0,L.jsx)(`code`,{className:`foot-command`,children:e.command??``}),(0,L.jsx)(`p`,{className:`hint`,children:`No hooks and no mail. Lit means it is printing. It takes no Max Q slot and is never polled.`})]}):null}function zg({agent:e,legend:t,onKeep:n,onRemove:r,busy:i}){return(0,L.jsxs)(`section`,{className:`flood remove`,"data-tone":`nogo`,role:`alertdialog`,"aria-label":`Remove ${t}`,"aria-describedby":`remove-${e.name}`,children:[(0,L.jsxs)(`h3`,{className:`disp`,children:[`REMOVE `,t,`?`]}),(0,L.jsx)(`p`,{id:`remove-${e.name}`,children:`The console and its session go. Its notes stay on disk until you delete them.`}),(0,L.jsxs)(`div`,{className:`remove-buttons`,children:[(0,L.jsxs)(`button`,{type:`button`,className:`btn`,"data-size":`big`,autoFocus:!0,onClick:n,children:[`KEEP `,t]}),(0,L.jsx)(`button`,{type:`button`,className:`btn`,"data-kind":`primary`,"data-size":`big`,"aria-disabled":i||void 0,onClick:r,children:`REMOVE`})]})]})}function Bg({agent:e}){let t=oo(e,N(e=>e.info?.home??``));return t===null?null:(0,L.jsxs)(`p`,{className:`panel-clean`,children:[(0,L.jsx)(`span`,{className:`chip`,"data-tone":`quiet`,children:`CLEAN ROOM`}),` `,`Branch `,(0,L.jsx)(`code`,{children:t.branch}),`, worktree `,(0,L.jsx)(`code`,{children:t.worktree}),`. Commit in the worktree, then merge the branch.`]})}function Vg({agent:e,legend:t,position:n}){let r=Nt(),i=N(e=>e.activity),{busy:a,error:o,run:s}=To(),[c,u]=(0,l.useState)(!1),d=(0,l.useRef)(null),f=to(e),p=f===`ask`||f===`needs`,m=a||e.transition!==null,h=ao(e);return(0,L.jsxs)(`aside`,{className:`panel module`,"aria-label":`Selected console`,"data-mode":f,children:[(0,L.jsxs)(`header`,{className:`panel-head`,children:[(0,L.jsxs)(`div`,{className:`panel-id`,children:[(0,L.jsxs)(`div`,{className:`panel-title`,children:[(0,L.jsx)(Og,{kind:Pa(e)}),(0,L.jsx)(`h2`,{className:`panel-legend`,children:t}),(0,L.jsx)(`span`,{className:`chip`,"data-tone":no(e.state,p),children:io(e,r)})]}),(0,L.jsx)(`span`,{className:`panel-sub`,children:so(e,n)})]}),(0,L.jsx)(Lg,{agent:e,onRemove:()=>u(!0),removeRef:d,locked:m,run:s})]}),o!==null&&(0,L.jsx)(`p`,{className:`error panel-error`,role:`alert`,children:o}),h.length>0&&(0,L.jsx)(`p`,{className:`panel-details`,children:h.join(` · `)}),(0,L.jsx)(Bg,{agent:e}),(0,L.jsx)(rc,{agent:e}),c&&(0,L.jsx)(zg,{agent:e,legend:t,busy:a,onKeep:()=>{u(!1),d.current?.focus()},onRemove:()=>{s(()=>Pn(e.name)),u(!1)}}),(0,L.jsx)(hg,{agent:e}),(0,L.jsx)(Rg,{agent:e,run:s,locked:m}),e.provider===`claude`&&(0,L.jsxs)(`details`,{className:`panel-fuel`,children:[(0,L.jsx)(`summary`,{className:`label`,children:`PROPELLANT`}),(0,L.jsx)(xo,{name:e.name})]}),(0,L.jsx)(xg,{name:e.name}),(0,L.jsx)(Pi,{items:i,name:e.name,onOpenLoop:ft})]})}function Hg(){let e=N(e=>e.selected),{cells:t,legends:n}=Eg(),r=t.find(t=>t.type===`agent`&&t.agent.name===e);return r===void 0||r.type!==`agent`?(0,L.jsxs)(`aside`,{className:`panel module panel-empty`,"aria-label":`Selected console`,children:[(0,L.jsx)(hg,{agent:null}),(0,L.jsxs)(`p`,{className:`hint`,children:[`Pick a console in the room`,t.length-1<24?` or staff a new one`:``,`.`]})]}):(0,L.jsx)(Vg,{agent:r.agent,legend:ua(n,r.agent.name),position:r.position},r.agent.name)}var Ug=[{label:`esc`,name:null,data:`\x1B`},{label:`tab`,name:null,data:` `},{label:`↑`,name:`Up`,data:`\x1B[A`},{label:`↓`,name:`Down`,data:`\x1B[B`},{label:`^C`,name:`Control C`,data:``,look:`danger`},{label:`⏎`,name:`Enter`,data:`\r`,look:`primary`}];function Wg({agent:e,legend:t,n,onTerminal:r}){let i=Nt(),{tool:a,detail:o}=eo(Ba(e)),{busy:s,error:c,run:l}=To();return(0,L.jsxs)(`div`,{className:`phone-go`,children:[(0,L.jsxs)(`header`,{className:`phone-go-head`,children:[(0,L.jsx)(`button`,{type:`button`,className:`btn phone-back`,"data-kind":`quiet`,onClick:ut,children:`‹ Room`}),(0,L.jsx)(`span`,{className:`label`,children:`WAITING ${_a(i-e.stateSince)}`})]}),(0,L.jsxs)(`section`,{className:`phone-go-card module`,"aria-label":`${t} asks for a go`,children:[(0,L.jsxs)(`p`,{className:`phone-go-call`,children:[(0,L.jsx)(`span`,{className:`led`,"data-on":`true`,"data-blink":`true`,"aria-hidden":`true`}),(0,L.jsx)(`span`,{className:`legend`,children:`${Ia(n)} · ${t}`})]}),(0,L.jsx)(`h1`,{className:`disp phone-go-title`,children:`Asks for a go`}),(0,L.jsxs)(`div`,{className:`phone-go-what lcd`,children:[a!==null&&(0,L.jsx)(`span`,{className:`phone-go-tool`,children:a}),(0,L.jsx)(`span`,{className:`phone-go-detail`,children:o}),(0,L.jsxs)(`span`,{className:`phone-go-dir`,children:[`in `,e.dir]})]}),e.queued>0&&(0,L.jsxs)(`p`,{className:`phone-go-held`,children:[e.queued,` `,e.queued===1?`message`:`messages`,` for `,t,` `,e.queued===1?`is`:`are`,` held until you answer.`]}),c!==null&&(0,L.jsx)(`p`,{className:`error`,role:`alert`,children:c})]}),(0,L.jsxs)(`div`,{className:`phone-go-buttons`,children:[(0,L.jsxs)(`button`,{type:`button`,className:`btn phone-go-no`,"data-kind":`danger`,"data-size":`big`,"aria-disabled":s||void 0,onClick:()=>l(()=>Bn(e.name,!1)),children:[(0,L.jsx)(`span`,{className:`led`,"aria-hidden":`true`}),`NO-GO`]}),(0,L.jsxs)(`button`,{type:`button`,className:`btn phone-go-yes`,"data-kind":`primary`,"data-size":`big`,"aria-disabled":s||void 0,onClick:()=>l(()=>Bn(e.name,!0)),children:[(0,L.jsx)(`span`,{className:`led`,"aria-hidden":`true`}),`GO`]})]}),(0,L.jsx)(`button`,{type:`button`,className:`link phone-go-link`,onClick:r,children:`Open the terminal`})]})}function Gg({agent:e,legend:t,position:n,n:r}){let i=Nt(),a=N(e=>e.activity),{busy:o,error:s,run:c}=To(),[u,d]=(0,l.useState)(null),[f,p]=(0,l.useState)(!1),[m,h]=(0,l.useState)(!1),[g,_]=(0,l.useState)(``),v=(0,l.useRef)(null),y=`${e.name}:${e.stateSince}`,b=e.state!==`stopped`,x=o||e.transition!==null;return Ja(e)&&u!==y?(0,L.jsx)(Wg,{agent:e,legend:t,n:r,onTerminal:()=>d(y)}):(0,L.jsxs)(`div`,{className:`phone-console`,"data-mode":to(e),children:[(0,L.jsxs)(`header`,{className:`phone-head`,children:[(0,L.jsx)(`button`,{type:`button`,className:`btn phone-back`,"data-kind":`quiet`,onClick:ut,children:`‹ Room`}),(0,L.jsx)(Og,{kind:Pa(e)}),(0,L.jsx)(`h1`,{className:`phone-legend`,children:t}),(0,L.jsx)(`span`,{className:`chip`,"data-tone":no(e.state,!1),children:io(e,i)})]}),(0,L.jsx)(Bg,{agent:e}),(0,L.jsxs)(`div`,{className:`phone-sub`,children:[(0,L.jsx)(`span`,{className:`panel-sub`,children:so(e,n)}),(0,L.jsx)(`button`,{type:`button`,className:`btn`,"data-kind":`quiet`,"aria-expanded":f,onClick:()=>p(!f),children:f?`Less`:`More`})]}),f&&(0,L.jsx)(Lg,{agent:e,onRemove:()=>h(!0),removeRef:v,locked:x,run:c}),f&&(0,L.jsx)(rc,{agent:e}),s!==null&&(0,L.jsx)(`p`,{className:`error`,role:`alert`,children:s}),m&&(0,L.jsx)(zg,{agent:e,legend:t,busy:o,onKeep:()=>{h(!1),v.current?.focus()},onRemove:()=>{c(()=>Pn(e.name).then(ut)),h(!1)}}),(0,L.jsx)(hg,{agent:e}),(0,L.jsx)(Rg,{agent:e,run:c,locked:x}),(0,L.jsxs)(`div`,{className:`phone-traffic`,children:[(0,L.jsx)(xg,{name:e.name}),(0,L.jsx)(Pi,{items:a,name:e.name,onOpenLoop:ft})]}),(0,L.jsx)(`div`,{className:`phone-keys`,role:`group`,"aria-label":`Terminal keys`,children:Ug.map(t=>(0,L.jsx)(`button`,{type:`button`,className:`btn phone-key`,"data-kind":t.look,"aria-label":t.name??void 0,disabled:!b,onClick:()=>ri(e.name,t.data),children:t.label},t.label))}),(0,L.jsxs)(`form`,{className:`phone-type`,onSubmit:t=>{t.preventDefault(),g!==``&&b&&(ri(e.name,g),_(``))},children:[(0,L.jsxs)(`label`,{className:`sr-only`,htmlFor:`phone-type`,children:[`Type into the terminal of `,t]}),(0,L.jsx)(`input`,{id:`phone-type`,className:`input`,type:`text`,value:g,placeholder:`Type into ${t}'s terminal`,disabled:!b,autoComplete:`off`,autoCapitalize:`off`,onChange:e=>_(e.target.value)}),(0,L.jsx)(`button`,{type:`submit`,className:`btn`,"data-kind":`quiet`,disabled:!b,children:`Type`})]})]})}function Kg(){let e=N(e=>e.selected),{cells:t,legends:n}=Eg(),r=t.find(t=>t.type===`agent`&&t.agent.name===e);return(0,l.useEffect)(()=>{r===void 0&&ut()},[r]),r===void 0||r.type!==`agent`?null:(0,L.jsx)(Gg,{agent:r.agent,legend:ua(n,r.agent.name),position:r.position,n:r.n},r.agent.name)}var qg=e=>e instanceof Error?e.message:String(e),Jg=e=>typeof e==`string`&&Gs.includes(e);function Yg({onDone:e}){let t=(0,l.useId)(),n=Tg(),r=N(e=>e.agents),[i,a]=(0,l.useState)(Ks),[o,s]=(0,l.useState)({}),[c,u]=(0,l.useState)(null),[d,f]=(0,l.useState)(!1),p=(0,l.useRef)(null);(0,l.useEffect)(()=>p.current?.focus(),[]);let m=(0,l.useMemo)(()=>Ws(n,r,null),[n,r]),h=(e,t)=>{a(t=>({...t,...e})),s(e=>({...e,[t]:void 0}))},g=e=>o[e]===void 0?void 0:`${t}-${e}-error`,_=e=>{let n=o[e];return n===void 0?null:(0,L.jsx)(`p`,{className:`error`,id:`${t}-${e}-error`,children:n})};async function v(n){if(n.preventDefault(),d)return;let r=qs(i);s(r),u(null);let a=Gs.find(e=>r[e]!==void 0);if(a!==void 0)document.getElementById(`${t}-${a}`)?.focus();else{f(!0);try{await Zn(Js(i)),e()}catch(e){let n=e.field;Jg(n)?(s({[n]:qg(e)}),document.getElementById(`${t}-${n}`)?.focus()):u(qg(e)),f(!1)}}}return(0,L.jsxs)(`form`,{className:`plan-form module`,"aria-label":`New task`,noValidate:!0,onSubmit:e=>void v(e),onKeyDown:t=>{t.key===`Escape`&&!t.nativeEvent.isComposing&&e()},children:[(0,L.jsx)(`h2`,{className:`label`,children:`New task`}),(0,L.jsxs)(`fieldset`,{className:`plan-fields`,disabled:d,children:[(0,L.jsxs)(`div`,{className:`field`,"data-invalid":o.title===void 0?void 0:``,children:[(0,L.jsx)(`label`,{htmlFor:`${t}-title`,children:`Title`}),(0,L.jsx)(`input`,{id:`${t}-title`,ref:p,className:`input`,value:i.title,maxLength:200,autoComplete:`off`,"aria-invalid":o.title!==void 0,"aria-describedby":g(`title`),onChange:e=>h({title:e.target.value},`title`)}),_(`title`)]}),(0,L.jsxs)(`div`,{className:`field`,children:[(0,L.jsx)(`label`,{htmlFor:`${t}-detail`,children:`Detail`}),(0,L.jsx)(`textarea`,{id:`${t}-detail`,className:`textarea plan-detail-input`,rows:4,value:i.detail,maxLength:T,"aria-invalid":o.detail!==void 0,"aria-describedby":[`${t}-detail-hint`,g(`detail`)].filter(Boolean).join(` `),onChange:e=>h({detail:e.target.value},`detail`)}),_(`detail`),(0,L.jsx)(`p`,{className:`hint`,id:`${t}-detail-hint`,children:`What done means. The agent it is given to gets this text in a message.`})]}),(0,L.jsxs)(`div`,{className:`field`,children:[(0,L.jsx)(`label`,{htmlFor:`${t}-assignee`,children:`Give it to`}),(0,L.jsx)(`select`,{id:`${t}-assignee`,className:`input`,value:i.assignee,"aria-describedby":g(`assignee`),onChange:e=>h({assignee:e.target.value},`assignee`),children:m.map(e=>(0,L.jsx)(`option`,{value:e.value,children:e.label},e.value))}),_(`assignee`)]})]}),c!==null&&(0,L.jsx)(`p`,{className:`error`,role:`alert`,children:c}),(0,L.jsxs)(`div`,{className:`plan-actions`,children:[(0,L.jsx)(`button`,{type:`submit`,className:`btn`,"data-kind":`primary`,"data-size":`big`,"aria-disabled":d||void 0,children:d?`Adding…`:`Add task`}),(0,L.jsx)(`button`,{type:`button`,className:`btn`,"data-size":`big`,"data-kind":`quiet`,onClick:e,children:`Cancel`})]})]})}function Xg({task:e,willMove:t,onNotice:n}){let r=(0,l.useId)(),i=Tg(),a=N(e=>e.agents),{busy:o,error:s,run:c}=To(),u=N(e=>e.docking.docks),[d,f]=(0,l.useState)(!1),[p,m]=(0,l.useState)(!1),h=(0,l.useRef)(null),g=(0,l.useRef)(null),_=(0,l.useRef)(null),v=(0,l.useRef)(!1),y=(0,l.useRef)(!1);(0,l.useEffect)(()=>{d?h.current?.focus():v.current&&g.current?.focus(),v.current=d},[d]),(0,l.useEffect)(()=>{!p&&y.current&&_.current?.focus(),y.current=p},[p]);let b=(0,l.useMemo)(()=>Ws(i,a,e.assignee),[i,a,e.assignee]),x=Us(e,a),S=Hs(e,a),C=r=>c(async()=>{t({id:e.id,status:r});try{await Qn(e.id,{status:r}),n(`${e.id} moved to ${Rs(r)}`)}catch(e){throw t(null),e}});return(0,L.jsx)(`li`,{children:(0,L.jsxs)(`article`,{className:`plan-card`,id:Ys(e.id),tabIndex:-1,"aria-labelledby":`${r}-title`,children:[(0,L.jsxs)(`div`,{className:`plan-top`,children:[(0,L.jsx)(`span`,{className:`plan-id`,children:e.id}),(0,L.jsxs)(`span`,{className:`plan-who`,children:[(0,L.jsx)(`span`,{className:`led`,"data-kind":x.kind,"data-on":x.on,"data-blink":x.blink,"aria-hidden":`true`}),(0,L.jsx)(`span`,{className:`legend`,children:S})]})]}),(0,L.jsx)(`h3`,{className:`plan-title`,id:`${r}-title`,children:e.title}),e.handedOff!==void 0&&(0,L.jsxs)(`span`,{className:`chip dk-handed`,"data-tone":`quiet`,children:[`HANDED OFF · `,e.handedOff]}),(0,L.jsxs)(`details`,{className:`plan-more`,children:[(0,L.jsxs)(`summary`,{children:[`Detail and history `,(0,L.jsx)(`span`,{className:`plan-count`,children:e.notes.length})]}),e.detail!==``&&(0,L.jsx)(`p`,{className:`plan-detail`,children:e.detail}),(0,L.jsxs)(`p`,{className:`hint`,children:[`Made by `,e.createdBy===`user`?`the Director`:e.createdBy,`.`]}),(0,L.jsx)(`ol`,{className:`plan-notes`,children:e.notes.map((e,t)=>(0,L.jsx)(`li`,{children:e},t))})]}),(0,L.jsx)(`div`,{className:`plan-moves`,role:`group`,"aria-label":`Move ${e.id}`,children:Ls.filter(t=>t.status!==e.status).map(t=>(0,L.jsx)(`button`,{type:`button`,className:`btn`,"aria-label":`Move ${e.id} to ${t.label.toLowerCase()}`,"aria-disabled":o||void 0,onClick:()=>C(t.status),children:t.label},t.status))}),(0,L.jsxs)(`div`,{className:`field plan-assign`,children:[(0,L.jsx)(`label`,{htmlFor:`${r}-assign`,children:`Give it to`}),(0,L.jsx)(`select`,{id:`${r}-assign`,className:`input`,"aria-label":`Give it to (${e.id})`,value:e.assignee??``,"aria-disabled":o||void 0,onChange:t=>{let r=t.target.value===``?null:t.target.value;c(async()=>{await Qn(e.id,{assignee:r}),n(`${e.id} ${r===null?`is not given to anyone`:`given to ${r}`}`)})},children:b.map(e=>(0,L.jsx)(`option`,{value:e.value,children:e.label},e.value))})]}),Os(e,u)&&(p?(0,L.jsx)(Is,{task:e,willMove:t,onNotice:n,onClose:()=>m(!1)}):(0,L.jsx)(`button`,{type:`button`,ref:_,className:`btn`,"aria-label":`Hand off ${e.id} to another station`,"aria-disabled":o||void 0,onClick:()=>m(!0),children:`Hand off`})),d?(0,L.jsxs)(`div`,{className:`plan-confirm flood`,"data-tone":`nogo`,role:`group`,"aria-label":`Remove ${e.id}?`,children:[(0,L.jsxs)(`p`,{children:[(0,L.jsxs)(`strong`,{children:[`Remove `,e.id,`?`]}),` Its history goes with it.`]}),(0,L.jsx)(`button`,{type:`button`,className:`btn`,ref:h,onClick:()=>f(!1),children:`Keep`}),(0,L.jsx)(`button`,{type:`button`,className:`btn`,"data-kind":`primary`,"aria-disabled":o||void 0,onClick:()=>{f(!1),c(()=>$n(e.id))},children:`Remove`})]}):(0,L.jsx)(`button`,{type:`button`,ref:g,className:`btn plan-remove`,"data-kind":`danger`,"aria-label":`Remove ${e.id}`,"aria-disabled":o||void 0,onClick:()=>f(!0),children:`Remove`}),s!==null&&(0,L.jsx)(`p`,{className:`error`,role:`alert`,children:s})]})})}function Zg(){let e=(0,l.useId)(),t=N(e=>e.tasks),n=(0,l.useMemo)(()=>zs(t),[t]),[r,i]=(0,l.useState)(!1),[a,o]=(0,l.useState)(``),s=(0,l.useRef)(null),c=(0,l.useRef)(null);(0,l.useEffect)(()=>s.current?.focus(),[]),(0,l.useEffect)(()=>{let e=c.current;e!==null&&t.find(t=>t.id===e.id)?.status===e.status&&(c.current=null,document.getElementById(Ys(e.id))?.focus())});let u=t.filter(e=>e.status!==`done`).length>=500;return(0,L.jsxs)(`section`,{className:`plan`,"aria-labelledby":e,children:[(0,L.jsxs)(`header`,{className:`loop-head`,children:[(0,L.jsx)(`h1`,{id:e,ref:s,tabIndex:-1,className:`disp loop-title plan-heading`,children:`FLIGHT PLAN`}),(0,L.jsx)(`button`,{type:`button`,className:`btn`,"data-kind":`primary`,"aria-disabled":u||void 0,onClick:()=>!u&&i(!0),children:`New task`}),(0,L.jsx)(`button`,{type:`button`,className:`btn loop-room`,"data-kind":`quiet`,onClick:dt,children:`Room`})]}),u&&(0,L.jsxs)(`p`,{className:`hint`,children:[`The board holds `,500,` open tasks. Finish or remove one to add another.`]}),r&&(0,L.jsx)(Yg,{onDone:()=>{i(!1),s.current?.focus()}}),t.length===0&&!r&&(0,L.jsx)(`p`,{className:`loop-empty`,children:`No tasks yet. Add one, give it to an agent, and the agent moves it along: todo, doing, review, done.`}),(0,L.jsx)(`div`,{className:`plan-board`,children:Ls.map(({status:t,label:r})=>{let i=n[t];return(0,L.jsxs)(`section`,{className:`plan-col module`,"aria-labelledby":`${e}-${t}`,children:[(0,L.jsxs)(`h2`,{className:`label plan-col-head`,id:`${e}-${t}`,children:[r,` `,(0,L.jsx)(`span`,{className:`plan-n`,children:i.length})]}),i.length===0?(0,L.jsx)(`p`,{className:`hint plan-none`,children:`Nothing here.`}):(0,L.jsx)(`ul`,{className:`plan-cards`,children:i.map(e=>(0,L.jsx)(Xg,{task:e,willMove:e=>{c.current=e},onNotice:o},e.id))})]},t)})}),(0,L.jsx)(`p`,{className:`sr-only`,role:`status`,children:a})]})}function Qg(e){let t=e.match(/\r\n/g)?.length??0,n=(e.match(/\n/g)?.length??0)-t;return(e.match(/\r/g)?.length??0)-t>0||t>0&&n>0?null:t>0?{text:e.replace(/\r\n/g,`
|
|
30
|
-
`),eol:`\r
|
|
31
|
-
`}:{text:e,eol:`
|
|
32
|
-
`}}var $g=(e,t)=>t===`
|
|
33
|
-
`?e:e.replace(/\n/g,`\r
|
|
34
|
-
`);function e_(e){if(/^\t/m.test(e))return` `;let t=/^( +)\S/m.exec(e)?.[1].length??0;return t>0&&t%4==0?` `:` `}function t_(e,t,n,r,i){if(!r&&!e.slice(t,n).includes(`
|
|
35
|
-
`))return{from:t,to:n,insert:i,start:t+i.length,end:t+i.length};let a=t===0?0:e.lastIndexOf(`
|
|
36
|
-
`,t-1)+1,o=n>t&&e[n-1]===`
|
|
37
|
-
`?n-1:n,s=e.indexOf(`
|
|
38
|
-
`,o),c=s===-1?e.length:s,l=e.slice(a,c).split(`
|
|
39
|
-
`),u=[],d=l.map(e=>{let t=r?e.slice(e.startsWith(` `)?1:Math.min(i===` `?4:i.length,/^ */.exec(e)?.[0].length??0)):e===``?e:i+e;return u.push(t.length-e.length),t}),f=u.reduce((e,t)=>e+t,0);return{from:a,to:c,insert:d.join(`
|
|
40
|
-
`),start:Math.max(a,t+(u[0]??0)),end:Math.max(a,n+f)}}var n_=e=>Array.from({length:e},(e,t)=>String(t+1)).join(`
|
|
41
|
-
`),r_=e=>e.split(`
|
|
42
|
-
`).length,i_=e=>e<1024?`${e} B`:e<1048576?`${(e/1024).toFixed(1)} KB`:`${(e/1024/1024).toFixed(1)} MB`,a_=(e,t)=>e===``?t:`${e}/${t}`,o_=e=>e.slice(0,Math.max(0,e.lastIndexOf(`/`)));function s_(e){let t=e.split(`/`).filter(e=>e!==``&&e!==`.`);return e.trim()===``||e.endsWith(`/`)||t.length===0?`Give the file a name.`:e.startsWith(`/`)?`Use a path inside the agent's folder, not an absolute one.`:t.includes(`..`)?`A path cannot go up with ..`:t.some(e=>e.toLowerCase()===`.git`)?`.git is not reachable.`:e.includes(`\0`)?`The path has a NUL character.`:null}var c_=new Map,l_=e=>e instanceof Error?e.message:String(e);function u_({title:e,current:t,id:n,heading:r}){let i=N(e=>e.order),a=N(e=>e.selected);return(0,L.jsxs)(`header`,{className:`loop-head hg-head`,children:[(0,L.jsx)(`h1`,{id:n,ref:r,tabIndex:-1,className:`disp loop-title hg-title`,children:e}),(0,L.jsxs)(`div`,{className:`field hg-agent`,children:[(0,L.jsx)(`label`,{htmlFor:`${n}-agent`,children:`Agent`}),(0,L.jsxs)(`select`,{id:`${n}-agent`,className:`input`,value:a!==null&&i.includes(a)?a:``,onChange:e=>Et(e.target.value),children:[(a===null||!i.includes(a))&&(0,L.jsx)(`option`,{value:``,children:`Pick an agent`}),i.map(e=>(0,L.jsx)(`option`,{value:e,children:e},e))]})]}),(0,L.jsxs)(`nav`,{className:`hg-tabs`,"aria-label":`Files and git`,children:[(0,L.jsx)(`button`,{type:`button`,className:`btn`,"data-kind":t===`hangar`?`primary`:`quiet`,"aria-current":t===`hangar`?`page`:void 0,onClick:St,children:`Files`}),(0,L.jsx)(`button`,{type:`button`,className:`btn`,"data-kind":t===`recorder`?`primary`:`quiet`,"aria-current":t===`recorder`?`page`:void 0,onClick:Ct,children:`Git`})]}),(0,L.jsx)(`button`,{type:`button`,className:`btn loop-room`,"data-kind":`quiet`,onClick:dt,children:`Room`})]})}function d_(){let e=N(e=>e.selected);return N(t=>e!==null&&t.agents[e]!==void 0)?e:null}function f_({path:e,depth:t,dirs:n,expanded:r,current:i,onToggle:a,onOpen:o}){let s=n[e],c={paddingLeft:10+t*16};return s===void 0?(0,L.jsx)(`li`,{className:`hint hg-note`,style:c,children:`Loading…`}):typeof s==`string`?(0,L.jsx)(`li`,{className:`error hg-note`,role:`alert`,children:s}):(0,L.jsxs)(L.Fragment,{children:[s.entries.map(s=>{let l=a_(e,s.name);if(s.kind===`link`)return(0,L.jsx)(`li`,{children:(0,L.jsxs)(`span`,{className:`hg-item hg-link`,style:c,children:[s.name,(0,L.jsx)(`span`,{className:`chip`,"data-tone":`quiet`,children:`link`})]})},s.name);if(s.kind===`dir`){let e=r.has(l);return(0,L.jsxs)(`li`,{children:[(0,L.jsxs)(`button`,{type:`button`,className:`hg-item`,style:c,"aria-expanded":e,onClick:()=>a(l),children:[(0,L.jsx)(`span`,{className:`hg-mark`,"aria-hidden":`true`,children:e?`▾`:`▸`}),s.name]}),e&&(0,L.jsx)(`ul`,{className:`hg-list`,children:(0,L.jsx)(f_,{path:l,depth:t+1,dirs:n,expanded:r,current:i,onToggle:a,onOpen:o})})]},s.name)}return(0,L.jsx)(`li`,{children:(0,L.jsxs)(`button`,{type:`button`,className:`hg-item`,style:c,"aria-current":i===l?`true`:void 0,onClick:()=>o(l),children:[(0,L.jsx)(`span`,{className:`hg-name`,children:s.name}),(0,L.jsx)(`span`,{className:`hg-size`,children:i_(s.size)})]})},s.name)}),s.entries.length===0&&(0,L.jsx)(`li`,{className:`hint hg-note`,style:c,children:`Empty.`}),s.truncated&&(0,L.jsx)(`li`,{className:`hint hg-note`,style:c,children:`More entries than are shown.`})]})}function p_(e,t){e.focus(),e.setSelectionRange(t.from,t.to),(t.insert===``?document.execCommand(`delete`):document.execCommand(`insertText`,!1,t.insert))||(e.setRangeText(t.insert,t.from,t.to,`end`),e.dispatchEvent(new Event(`input`,{bubbles:!0}))),e.setSelectionRange(t.start,t.end)}function m_(e,t,n,r){let i=Qg(t);return i===null?{path:e,base:t,etag:n,eol:`
|
|
43
|
-
`,size:r,locked:`This file mixes line endings, or has a lone carriage return, and the editor would change them. It is read-only here.`}:{path:e,base:i.text,etag:n,eol:i.eol,size:r,locked:null}}function h_({agent:e}){let t=(0,l.useId)(),n=(0,l.useMemo)(()=>c_.get(e)??null,[e]),[r,i]=(0,l.useState)({}),[a,o]=(0,l.useState)(()=>new Set([``,...n===null?[]:g_(n.path)])),[s,c]=(0,l.useState)(()=>n===null?null:{path:n.path,base:n.base,etag:n.etag,eol:n.eol,size:0,locked:null}),[u,d]=(0,l.useState)(n?.value??``),[f,p]=(0,l.useState)(null),[m,h]=(0,l.useState)(null),[g,_]=(0,l.useState)(null),[v,y]=(0,l.useState)(null),[b,x]=(0,l.useState)(!1),[S,C]=(0,l.useState)(!1),ee=(0,l.useRef)(!1),w=(0,l.useRef)(!0),T=(0,l.useRef)(null),E=(0,l.useRef)(null),te=(0,l.useRef)(!1),D=(0,l.useRef)({file:s,value:u});D.current={file:s,value:u};let ne=s!==null&&s.locked===null&&u!==s.base,O=(0,l.useMemo)(()=>e_(s?.base??``),[s?.base]),re=(0,l.useMemo)(()=>r_(u),[u]),k=(0,l.useMemo)(()=>n_(re),[re]),ie=async(e,t=!1)=>{if(!ee.current){ee.current=!0,x(!0),y(null);try{await e()}catch(e){w.current&&y({text:l_(e),conflict:t&&e.status===409})}finally{ee.current=!1,w.current&&x(!1)}}},ae=t=>mr(e,t).then(e=>void(w.current&&i(n=>({...n,[t]:e}))),e=>void(w.current&&i(n=>({...n,[t]:l_(e)}))));(0,l.useEffect)(()=>{w.current=!0;for(let e of a)ae(e);return()=>{w.current=!1;let{file:t,value:n}=D.current;t!==null&&t.locked===null&&n!==t.base?c_.set(e,{path:t.path,value:n,base:t.base,etag:t.etag,eol:t.eol}):c_.delete(e)}},[]),(0,l.useEffect)(()=>{if(!ne)return;let e=e=>e.preventDefault();return window.addEventListener(`beforeunload`,e),()=>window.removeEventListener(`beforeunload`,e)},[ne]);let oe=e=>{let t=!a.has(e);o(n=>{let r=new Set(n);return t?r.add(e):r.delete(e),r}),t&&r[e]===void 0&&ae(e)},se=t=>ie(async()=>{let n=await hr(e,t);if(!w.current)return;let r=m_(t,n.text,n.etag,n.size);c(r),d(r.base),C(!1),p(null),window.matchMedia(`(max-width: 899px)`).matches&&requestAnimationFrame(()=>E.current?.scrollIntoView({block:`start`}))}),ce=e=>{e!==s?.path&&(ne?p(e):se(e))},le=()=>ie(async()=>{if(s===null||s.locked!==null||u===s.base)return;let t=$g(u,s.eol),n=await gr(e,{path:s.path,text:t,etag:s.etag});w.current&&(c({...s,base:u,etag:n.etag,size:n.size}),C(!0),ae(o_(s.path)))},!0),ue=()=>ie(async()=>{let t=(m??``).trim(),n=s_(t);if(_(n),n!==null)return;let r=t.split(`/`).filter(e=>e!==``&&e!==`.`),i=await _r(e,{path:r.join(`/`)});if(!w.current)return;let a=g_(r.join(`/`));o(e=>new Set([...e,...a])),await Promise.all([``,...a].map(ae)),h(null);let s=m_(i.path,``,i.etag,i.size);c(s),d(``),C(!1)}),de=e=>{if(e.nativeEvent.isComposing)return;if((e.ctrlKey||e.metaKey)&&e.key.toLowerCase()===`s`){e.preventDefault(),le();return}if(e.key===`Escape`){te.current=!0;return}if(e.key===`Shift`)return;if(e.key!==`Tab`||e.ctrlKey||e.altKey||e.metaKey||s?.locked!=null||te.current){te.current=!1;return}e.preventDefault();let t=e.currentTarget;p_(t,t_(t.value,t.selectionStart,t.selectionEnd,e.shiftKey,O))},fe=String(re).length,me=s===null?``:o_(s.path);return(0,L.jsxs)(`div`,{className:`hg-cols`,children:[(0,L.jsxs)(`div`,{className:`hg-side module`,children:[(0,L.jsxs)(`div`,{className:`hg-tools`,children:[(0,L.jsx)(`button`,{type:`button`,className:`btn`,"data-kind":`quiet`,"aria-expanded":m!==null,onClick:()=>{h(m===null?me===``?``:`${me}/`:null),_(null)},children:`New file`}),(0,L.jsx)(`button`,{type:`button`,className:`btn`,"data-kind":`quiet`,onClick:()=>a.forEach(e=>void ae(e)),children:`Refresh`})]}),m!==null&&(0,L.jsxs)(`form`,{className:`hg-new`,onSubmit:e=>{e.preventDefault(),ue()},children:[(0,L.jsxs)(`div`,{className:`field`,"data-invalid":g===null?void 0:``,children:[(0,L.jsx)(`label`,{htmlFor:`${t}-new`,children:`Path of the new file`}),(0,L.jsx)(`input`,{id:`${t}-new`,className:`input`,value:m,autoFocus:!0,autoComplete:`off`,autoCapitalize:`none`,spellCheck:!1,"aria-invalid":g!==null,"aria-describedby":g===null?`${t}-new-hint`:`${t}-new-error`,onChange:e=>{h(e.target.value),_(null)},onKeyDown:e=>e.key===`Escape`&&h(null)}),g===null?(0,L.jsx)(`span`,{className:`hint`,id:`${t}-new-hint`,children:`Inside the agent's folder, in a folder that exists.`}):(0,L.jsx)(`p`,{className:`error`,id:`${t}-new-error`,children:g})]}),(0,L.jsx)(`button`,{type:`submit`,className:`btn`,"data-kind":`primary`,"aria-disabled":b||void 0,children:`Create`})]}),(0,L.jsx)(`ul`,{className:`hg-list hg-root`,children:(0,L.jsx)(f_,{path:``,depth:0,dirs:r,expanded:a,current:s?.path??null,onToggle:oe,onOpen:ce})})]}),(0,L.jsxs)(`section`,{className:`hg-editor module`,"aria-label":`Editor`,ref:E,children:[f!==null&&(0,L.jsxs)(`div`,{className:`flood hg-ask`,"data-tone":`amber`,role:`alert`,children:[(0,L.jsx)(`p`,{children:`${s?.path??`This file`} has changes that are not saved.`}),(0,L.jsxs)(`div`,{className:`hg-row`,children:[(0,L.jsxs)(`button`,{type:`button`,className:`btn`,"data-kind":`danger`,onClick:()=>void se(f),children:[`Discard and open `,f]}),(0,L.jsx)(`button`,{type:`button`,className:`btn`,"data-kind":`quiet`,onClick:()=>p(null),children:`Keep editing`})]})]}),v!==null&&(0,L.jsxs)(`div`,{className:`error hg-problem`,role:`alert`,children:[(0,L.jsx)(`p`,{children:v.text}),v.conflict&&s!==null&&(0,L.jsx)(`button`,{type:`button`,className:`btn`,onClick:()=>void se(s.path),children:`Discard my changes and reload`})]}),s===null?(0,L.jsx)(`p`,{className:`hint hg-empty`,children:`Pick a file in the tree, or make a new one. The editor opens text files of up to ${i_(pe)}.`}):(0,L.jsxs)(L.Fragment,{children:[(0,L.jsxs)(`div`,{className:`hg-bar`,children:[(0,L.jsx)(`h2`,{className:`hg-path`,children:s.path}),(0,L.jsx)(`span`,{className:`chip`,"data-tone":ne?`amber`:`quiet`,role:`status`,children:ne?`Unsaved changes`:S?`Saved`:s.locked===null?`No changes`:`Read-only`}),(0,L.jsx)(`span`,{className:`hg-size`,children:`${re} ${re===1?`line`:`lines`}`}),(0,L.jsx)(`button`,{type:`button`,className:`btn`,"data-kind":`primary`,"aria-disabled":!ne||b||void 0,onClick:()=>ne&&void le(),children:`Save`}),(0,L.jsx)(`button`,{type:`button`,className:`btn`,"data-kind":`quiet`,"aria-disabled":b||void 0,onClick:()=>void se(s.path),children:ne?`Discard changes`:`Reload`})]}),s.locked!==null&&(0,L.jsx)(`p`,{className:`hint`,children:s.locked}),(0,L.jsxs)(`div`,{className:`hg-ed`,style:{"--digits":fe},children:[(0,L.jsx)(`pre`,{className:`hg-gutter`,ref:T,"aria-hidden":`true`,children:k}),(0,L.jsx)(`textarea`,{className:`hg-text`,value:u,readOnly:s.locked!==null,wrap:`off`,spellCheck:!1,autoCapitalize:`off`,autoCorrect:`off`,autoComplete:`off`,"aria-label":`Contents of ${s.path}`,"aria-describedby":`${t}-keys`,onChange:e=>{d(e.target.value),C(!1)},onKeyDown:de,onBlur:()=>void(te.current=!1),onScroll:e=>{T.current!==null&&(T.current.scrollTop=e.currentTarget.scrollTop)}})]}),(0,L.jsx)(`p`,{className:`hint`,id:`${t}-keys`,children:`Tab indents and Shift+Tab takes the indent back. To leave the box with the keyboard, press Escape, then Tab. Ctrl or Cmd+S saves.`})]})]})]})}function g_(e){let t=e.split(`/`).slice(0,-1);return t.map((e,n)=>t.slice(0,n+1).join(`/`))}function __(){let e=(0,l.useId)(),t=d_(),n=(0,l.useRef)(null);return(0,l.useEffect)(()=>n.current?.focus(),[]),(0,L.jsxs)(`section`,{className:`hg`,"aria-labelledby":e,children:[(0,L.jsx)(u_,{title:`HANGAR`,current:`hangar`,id:e,heading:n}),t===null?(0,L.jsx)(`p`,{className:`hint hg-empty`,children:`Pick a console in the room, or an agent above.`}):(0,L.jsx)(h_,{agent:t},t)]})}var v_=1e3,y_=[`name`,`role`,`dir`,`mode`,`confirmBypass`,`position`,`command`,`cleanRoom`,`payload.mcpServers`,`payload.skills`,`model`,`keys`],b_=new RegExp(x);function x_(e,t){if(!Object.hasOwn(t,e))return e;for(let n=2;;n+=1){let r=`${e}-${n}`;if(!Object.hasOwn(t,r))return r}}var S_=`Custom command`,C_=`flight`;function w_(e,t){let n=_i(e.position);return{role:e.role.trim()===``||e.role===`Custom command`||n!==null&&e.role===n.role,name:e.name===``||n!==null&&e.name===x_(n.id,t)}}function T_(e,t,n,r){let i=_i(t),a=w_(e,n),o=e.provider===`custom`?`claude`:e.provider;return i===null?{...e,provider:o,position:``,role:a.role?``:e.role,name:r&&a.name?``:e.name}:{...e,provider:o,position:i.id,role:a.role?i.role:e.role,name:r&&a.name?x_(i.id,n):e.name}}function E_(e,t){return{...e,provider:`custom`,position:``,role:S_,cleanRoom:!1,model:``,name:w_(e,t).name?``:e.name}}function D_(e,t){return{...e,provider:t,model:``,mode:_(t).modes?e.mode:`default`,confirm:!1,cleanRoom:t===`claude`&&e.cleanRoom}}function O_(e,t,n){let{label:r,bin:i,install:a,docs:o}=_(e),s=t.includes(e)||(n?.path??null)!==null,c=n?.path==null?``:` at ${n.path}`,l=n?.version==null?``:`, ${n.version}`;return{found:s,text:s?`${r} found${c}${l}.`:`${i} is not on the PATH of the machine gonogo runs on.`,install:s?null:a,docs:o}}function k_(e){let t=d.filter(e=>e!==`custom`);return[...t.filter(t=>e.includes(t)),...t.filter(t=>!e.includes(t))].map(t=>{let n=_(t),r=[e.includes(t)?``:`not installed`,n.check===`docs`?`unverified`:``,n.mcp?``:`no mail`];return{provider:t,text:[n.label,...r.filter(e=>e!==``)].join(` · `)}})}var A_={run:``,local:`Checked against the installed program, not run with a model.`,docs:`Written from its docs, not tried here.`};function j_(e){let t=_(e);return[t.hooks?`Its hooks report working, idle and needs you.`:`Lit while it prints; no Max Q slot.`,t.mcp?`Gets mail through the gonogo tools.`:`No mail and no votes.`,A_[t.check]].filter(e=>e!==``).join(` `)}function M_(e,t,n,r){let i={provider:t?.provider??`claude`,position:t?.position??``,command:t?.command??``,servers:t?.payload?.mcpServers===void 0?``:JSON.stringify(t.payload.mcpServers,null,2),skills:(t?.payload?.skills??[]).join(`
|
|
44
|
-
`),cleanRoom:!!t?.cleanRoom,model:t?.model??``,keys:[],keysRemoved:[],name:t?.name??``,role:t?.role??``,dir:t?.dir??r,mode:t?.mode??`default`,confirm:!1};if(e.mode===`edit`)return i;if(e.custom===!0)return E_(i,n);let a=e.position??``;return a!==``&&a!==`flight`?T_(i,a,n,!0):i}var N_=e=>e.split(/[:,]/)[0]?.trim()??e;function P_(e,t,n){return e.id===`flight`?`THE BOSS HOLDS IT`:t?`PICKED`:n?`STAFFED · ADD ANOTHER`:`OPEN`}function F_(e){return _i(e.position)?.callSign??(e.name.trim().toUpperCase()||`A CONSOLE`)}var I_=(e,t)=>_(e.provider).modes&&e.mode===`bypassPermissions`&&t?.mode!==`bypassPermissions`,L_=[[`name`,`NAME`],[`command`,`COMMAND`],[`role`,`ROLE`],[`dir`,`DIRECTORY`],[`position`,`POSITION`],[`mode`,`PERMISSIONS`],[`payload.mcpServers`,`PAYLOAD`],[`payload.skills`,`PAYLOAD`],[`model`,`MODEL`],[`keys`,`KEYS`]];function R_(e,t,n){let r=L_.find(([t])=>e[t]!==void 0);return r===void 0?e.confirmBypass===void 0?n?`STAFF ${t} UNGUARDED`:`STAFF ${t}`:`TICK THE BOX TO STAFF ${t}`:`FIX THE ${r[1]} TO STAFF ${t}`}function z_(e){try{let t=JSON.parse(e);return Array.isArray(t)&&t.length>0&&t.every(e=>typeof e==`string`&&e!==``)}catch{return!1}}function B_(e){if(e.trim()===``)return null;try{let t=JSON.parse(e);return typeof t==`object`&&t&&!Array.isArray(t)?t:void 0}catch{return}}var V_=e=>e.split(`
|
|
45
|
-
`).map(e=>e.trim()).filter(e=>e!==``);function H_(e){let t=_(e.provider).payload;if(t===null)return null;let n={},r=B_(e.servers);r&&Object.keys(r).length>0&&(n.mcpServers=r);let i=t===`all`?V_(e.skills):[];return i.length>0&&(n.skills=i),Object.keys(n).length===0?null:n}function U_(e,t){return e.provider!==`claude`||!e.cleanRoom?null:t?.cleanRoom??{}}var W_=new RegExp(p),G_=new RegExp(m),K_=new RegExp(h),q_=e=>e.keys.map(e=>({name:e.name.trim(),value:e.value.trim()})).filter(e=>e.name!==``||e.value!==``),J_=e=>_(e.provider).model===null?``:e.model.trim();function Y_(e,t){let n=q_(e),r=new Set;for(let[e,t]of n.entries()){let{name:n}=t;if(!G_.test(n))return`Key ${e+1}: use a name of capital letters, digits and _, starting with a letter, such as OPENAI_API_KEY.`;if(!K_.test(t.value))return`Key ${e+1}: the value must be 1 to 4096 printable characters without a space.`;if(r.has(n))return`Key ${e+1}: the name is used twice.`;r.add(n)}return t.filter(t=>!e.keysRemoved.includes(t)&&!r.has(t)).length+r.size>16?`At most 16 keys.`:null}function X_(e,t){let n={};for(let r of e.keysRemoved)t.includes(r)&&(n[r]=null);for(let t of q_(e))n[t.name]=t.value;return Object.keys(n).length===0?void 0:n}function Z_(e,t,n,r){let i={};r||(e.name===``?i.name=`A name is required.`:b_.test(e.name)?b.includes(e.name)?i.name=`"${e.name}" is reserved.`:e.name!==n?.name&&Object.hasOwn(t,e.name)&&(i.name=`An agent called "${e.name}" already exists.`):i.name=`Use lowercase letters, digits and hyphens, starting with a letter or digit (at most 32 characters).`);let a=e.role.trim();a===``?i.role=`A role is required.`:a.length>4e3&&(i.role=`At most ${S} characters.`);let o=e.dir.trim();if(o===``?i.dir=`A working directory is required.`:o.length>1024?i.dir=`At most ${C} characters.`:o.startsWith(`/`)||(i.dir=`Use an absolute path: it starts with /.`),e.provider===`custom`){let t=e.command.trim();t===``?i.command=`A command is required.`:t.length>1e3?i.command=`At most ${v_} characters.`:t.includes(`\0`)?i.command=`The command cannot contain a NUL character.`:t.startsWith(`[`)&&!z_(t)&&(i.command=`Not a valid JSON array of strings.`)}else I_(e,n)&&!e.confirm&&(i.confirmBypass=`Tick the box to confirm.`);let s=_(e.provider).payload;s!==null&&B_(e.servers)===void 0&&(i[`payload.mcpServers`]=`Not a JSON object of servers.`),s===`all`&&V_(e.skills).some(e=>!e.startsWith(`/`))&&(i[`payload.skills`]=`Use absolute paths: each starts with /.`);let c=J_(e);c!==``&&!W_.test(c)&&(i.model=`Use letters, digits and . _ : / @ + -, starting with a letter or digit (at most 100 characters).`);let l=Y_(e,Object.keys(n?.keys??{}));return l!==null&&(i.keys=l),i}function Q_(e){let t={name:e.name,role:e.role.trim(),dir:e.dir.trim()},n=X_(e,[]);if(e.provider===`custom`)return{...t,mode:`default`,provider:`custom`,command:e.command.trim(),...n&&{keys:n}};let r=_(e.provider).modes,i={...t,mode:r?e.mode:`default`,provider:e.provider};J_(e)!==``&&(i.model=J_(e)),n&&(i.keys=n),r&&e.mode===`bypassPermissions`&&e.confirm&&(i.confirmBypass=!0),e.position!==``&&(i.position=e.position);let a=H_(e);a!==null&&(i.payload=a);let o=U_(e,null);return o!==null&&(i.cleanRoom=o),i}function $_(e,t,n){let r={},i=e.role.trim(),a=e.dir.trim();if(!n&&e.name!==t.name&&(r.name=e.name),i!==t.role&&(r.role=i),a!==t.dir&&(r.dir=a),t.provider===`custom`){let n=e.command.trim();n!==(t.command??``)&&(r.command=n)}else{_(t.provider).modes&&e.mode!==t.mode&&(r.mode=e.mode),e.position!==(t.position??``)&&(r.position=e.position===``?null:e.position);let n=H_(e);JSON.stringify(n)!==JSON.stringify(t.payload??null)&&(r.payload=n);let i=U_(e,t);JSON.stringify(i)!==JSON.stringify(t.cleanRoom??null)&&(r.cleanRoom=i);let a=J_(e);a!==(t.model??``)&&(r.model=a===``?null:a)}let o=X_(e,Object.keys(t.keys??{}));return o&&(r.keys=o),Object.keys(r).length===0?null:(I_(e,t)&&e.confirm&&t.provider!==`custom`&&(r.confirmBypass=!0),r)}var ev=[{value:`default`,label:`ASK`,hint:`Asks you for a go before a tool runs`},{value:`acceptEdits`,label:`ACCEPT EDITS`,hint:`Edits files without asking`},{value:`auto`,label:`AUTO`,hint:`Claude decides which tool calls are safe to run without asking and asks about the rest`},{value:`bypassPermissions`,label:`BYPASS`,hint:`Runs every tool without asking`}],tv=`Folders added here are trusted automatically: repository hooks and settings run with your credential. Add only repositories you trust.`,nv={name:!0,role:!0,dir:!0,mode:!0,confirmBypass:!0,command:!0,"payload.mcpServers":!0,"payload.skills":!0,model:!0,keys:!0},rv=`{"files": {"command": "npx", "args": ["-y", "@modelcontextprotocol/server-filesystem", "/path"]}}`;function iv(){M.setState(e=>e.form===null?e:{...e,form:null})}var av=e=>e instanceof Error?e.message:String(e),ov=(e,t,n)=>[t?`${e}-hint`:``,n?`${e}-error`:``].filter(Boolean).join(` `)||void 0;function sv({id:e,label:t,hint:n,error:r,children:i}){return(0,L.jsxs)(`div`,{className:`field`,"data-invalid":r===void 0?void 0:``,children:[(0,L.jsx)(`label`,{htmlFor:e,children:t}),i,r!==void 0&&(0,L.jsx)(`p`,{className:`error`,id:`${e}-error`,children:r}),n!==void 0&&(0,L.jsx)(`p`,{className:`hint`,id:`${e}-hint`,children:n})]})}function cv({position:e,picked:t,seated:n,n:r,onPick:i}){let a=e.id===C_,o=P_(e,t,n);return(0,L.jsxs)(`button`,{type:`button`,className:`tile staff-pos`,"data-kind":a?`stopped`:t?`working`:n?void 0:`open`,"aria-pressed":a?void 0:t,"aria-label":`${e.callSign}, ${e.title}, ${o.toLowerCase()}`,disabled:a,onClick:()=>i(e.id),children:[(0,L.jsxs)(`span`,{className:`staff-tile-head`,children:[(0,L.jsx)(`span`,{className:`led`,"data-on":t?`true`:void 0,"aria-hidden":`true`}),(0,L.jsx)(`span`,{className:`tile-legend`,children:e.callSign}),(0,L.jsx)(`span`,{className:`staff-tile-num`,"aria-hidden":`true`,children:String(r).padStart(2,`0`)})]}),(0,L.jsx)(`span`,{className:`tile-sub staff-pos-short`,children:N_(e.summary)}),(0,L.jsx)(`span`,{className:`tile-state staff-pos-tag`,children:o})]})}function lv({note:e,id:t}){let[n,r]=(0,l.useState)(null),i=(0,l.useRef)(null),a=e.install;return(0,L.jsxs)(`div`,{className:`staff-engine-note`,children:[(0,L.jsxs)(`p`,{className:`staff-engine-state`,id:t,role:`status`,children:[(0,L.jsx)(`span`,{className:`led`,"data-on":e.found?`true`:void 0,"aria-hidden":`true`}),e.text]}),a!==null&&(0,L.jsxs)(`div`,{className:`staff-install`,children:[(0,L.jsx)(`label`,{htmlFor:`${t}-cmd`,className:`label`,children:`Install command`}),(0,L.jsx)(`input`,{ref:i,id:`${t}-cmd`,className:`input`,type:`text`,readOnly:!0,value:a,spellCheck:!1,onFocus:e=>e.currentTarget.select()}),(0,L.jsx)(`button`,{type:`button`,className:`btn`,onClick:()=>{a!==null&&_s(a).then(e=>{r(e),e||i.current?.select()})},children:n===null?`Copy`:n?`Copied`:`Not copied`})]}),!e.found&&(0,L.jsxs)(`p`,{className:`hint`,children:[a===null?`No install command was checked for it. `:`The vendor documents it here: `,(0,L.jsx)(`a`,{href:e.docs,target:`_blank`,rel:`noreferrer`,children:`install page`}),`. gonogo never runs an installer.`]})]})}function uv(){return(0,L.jsxs)(`section`,{className:`staff-full module`,"aria-labelledby":`staff-full-title`,children:[(0,L.jsxs)(`h2`,{id:`staff-full-title`,className:`disp`,children:[(0,L.jsx)(`span`,{className:`led`,"data-on":`true`,"aria-hidden":`true`}),`ROOM FULL`]}),(0,L.jsxs)(`p`,{children:[`All `,24,` consoles are staffed. Remove one to staff another.`]})]})}function dv({title:e,count:t,children:n}){let r=(0,l.useId)(),i=(0,l.useRef)(null);return(0,l.useEffect)(()=>i.current?.focus(),[]),(0,L.jsxs)(`main`,{className:`staff`,"aria-labelledby":r,onKeyDown:e=>{e.key===`Escape`&&!e.nativeEvent.isComposing&&iv()},children:[(0,L.jsxs)(`header`,{className:`staff-head`,children:[(0,L.jsx)(`h1`,{id:r,ref:i,tabIndex:-1,className:`disp staff-title`,children:e}),t!==null&&(0,L.jsxs)(`p`,{className:`staff-count`,children:[(0,L.jsx)(`span`,{className:`lcd staff-lcd`,children:(0,L.jsx)(`span`,{className:`lcd-num`,children:t})}),` `,`of `,24,` consoles staffed`]}),(0,L.jsx)(`button`,{type:`button`,className:`btn`,"data-kind":`quiet`,onClick:iv,children:`Cancel`})]}),n]})}function fv({form:e}){let t=(0,l.useId)(),n=N(e=>e.agents),r=N(e=>e.info),i=e.mode===`edit`,a=e.mode===`edit`&&Object.hasOwn(n,e.name)?n[e.name]:null,o=(0,l.useRef)(null);a!==null&&(o.current=a);let[s,c]=(0,l.useState)(()=>M_(e,a,n,r?.cwd??``)),[u,d]=(0,l.useState)({}),[f,p]=(0,l.useState)(!1),[m,h]=(0,l.useState)(null),[v,y]=(0,l.useState)({}),[b,x]=(0,l.useState)(0),[S,C]=(0,l.useState)(()=>s.servers!==``||s.skills!==``),[ee,w]=(0,l.useState)(!1),[T,E]=(0,l.useState)([]),te=(0,l.useRef)(null),D=(0,l.useRef)(null),ne=(0,l.useRef)(null),O=a??(f?o.current:null),re=O!==null&&O.state!==`stopped`,k=Z_(s,n,O,re),ie=Object.keys(k).length===0,ae=I_(s,O);if((0,l.useEffect)(()=>{if(f||m===null)return;let e=te.current;(e?.querySelector(`[aria-invalid="true"]`)??e?.querySelector(`.staff-alert`))?.focus()},[f,m]),(0,l.useEffect)(()=>{b>0&&te.current?.querySelector(`[aria-invalid="true"]`)?.focus()},[b]),(0,l.useEffect)(()=>{if(i)return;let e=!0;return jn().then(t=>e&&E(t),()=>void 0),()=>{e=!1}},[i]),(0,l.useEffect)(()=>{ae&&ne.current?.focus()},[ae]),i&&O===null)return(0,L.jsx)(dv,{title:`NO SUCH CONSOLE`,count:null,children:(0,L.jsx)(`section`,{className:`staff-full module`,role:`alert`,children:(0,L.jsxs)(`p`,{children:[e.mode===`edit`?e.name:``,` no longer exists.`]})})});let oe=Object.keys(n).length;if(!i&&oe>=24)return(0,L.jsx)(dv,{title:`STAFF A CONSOLE`,count:oe,children:(0,L.jsx)(uv,{})});let se=e=>v[e]??(u[e]===!0?k[e]:void 0),ce=(e,t)=>{c(t=>({...t,...e})),y(e=>({...e,[t]:void 0}))},le=e=>()=>d(t=>({...t,[e]:!0})),ue=s.provider===`custom`,de=_i(s.position),fe=!ue&&de===null,pe=F_(s),me=new Set;for(let e of Object.values(n))e.position!==null&&me.add(e.position);let he=e=>{c(e),y(e=>({...e,position:void 0,name:void 0,role:void 0,command:void 0}))},ge=()=>{let e=O?.mode??`default`;ce({mode:e===`bypassPermissions`?`default`:e,confirm:!1},`mode`),D.current?.focus()};async function _e(e){if(!f){if(!ie)d(nv),x(e=>e+1),(k[`payload.mcpServers`]!==void 0||k[`payload.skills`]!==void 0)&&C(!0),k.keys!==void 0&&w(!0);else{p(!0),h(null),y({});try{let t;if(O===null)t=await kn(Q_(s));else{let n=$_(s,O,re);if(n===null){if(!e){iv();return}t=O}else t=await An(O.name,n)}if(e)try{await Mn(t.name)}catch(e){throw Error(`Saved, but it did not restart: ${av(e)}`)}M.setState(e=>({...e,form:null,selected:t.name}))}catch(e){let t=e instanceof Error&&`field`in e?e.field:void 0;h(av(e)),t!==void 0&&y_.includes(t)&&y({[t]:av(e)}),t?.startsWith(`payload`)&&C(!0),t===`keys`&&w(!0),p(!1)}}}}let ve=e=>{e.preventDefault(),_e(!1)},ye=se(`name`),be=se(`role`),A=se(`dir`),j=se(`command`),xe=se(`confirmBypass`),Se=se(`payload.mcpServers`),Ce=se(`payload.skills`),we=se(`cleanRoom`),Te=se(`model`),Ee=se(`keys`),De=_(s.provider).model,Oe=Object.keys(O?.keys??{}).sort(),ke=e=>ce({keys:e},`keys`),Ae=e=>ce({keysRemoved:s.keysRemoved.includes(e)?s.keysRemoved.filter(t=>t!==e):[...s.keysRemoved,e]},`keys`),je=_(s.provider).payload,Me=s.role.trim().length,Ne=i?`EDIT ${R(O?.name??``,n)}`:`STAFF A CONSOLE`,Pe=(0,L.jsx)(sv,{id:`${t}-name`,label:`Name`,hint:re?`Stop the console to rename it.`:`Lowercase letters, digits and hyphens. Other agents address it by this name.`,error:ye,children:(0,L.jsx)(`input`,{id:`${t}-name`,className:`input`,type:`text`,value:s.name,readOnly:re,autoComplete:`off`,autoCapitalize:`none`,spellCheck:!1,"aria-invalid":ye!==void 0,"aria-describedby":ov(`${t}-name`,!0,ye!==void 0),onChange:e=>ce({name:e.target.value},`name`),onBlur:le(`name`)})}),Fe=(0,L.jsx)(sv,{id:`${t}-dir`,label:`Working directory`,hint:ue?`The command is saved in plain text. Keep secrets out of it: set them as keys below.`:(0,L.jsxs)(L.Fragment,{children:[`A path on the machine where gonogo runs.`,r?.seed===!0&&(0,L.jsx)(`span`,{className:`staff-block`,children:tv})]}),error:A,children:(0,L.jsx)(`input`,{id:`${t}-dir`,className:`input`,type:`text`,value:s.dir,autoComplete:`off`,autoCapitalize:`none`,spellCheck:!1,"aria-invalid":A!==void 0,"aria-describedby":ov(`${t}-dir`,!0,A!==void 0),onChange:e=>ce({dir:e.target.value},`dir`),onBlur:le(`dir`)})}),Ie=ue&&(0,L.jsx)(sv,{id:`${t}-command`,label:`Command`,hint:`Words split on spaces, or a JSON array when an argument has spaces. No shell: pipes and quotes need the array form, for example ["sh","-c","make watch"].`,error:j,children:(0,L.jsx)(`input`,{id:`${t}-command`,className:`input`,type:`text`,value:s.command,placeholder:`htop or ["node","server.js"]`,autoComplete:`off`,autoCapitalize:`none`,spellCheck:!1,"aria-invalid":j!==void 0,"aria-describedby":ov(`${t}-command`,!0,j!==void 0),onChange:e=>ce({command:e.target.value},`command`),onBlur:le(`command`)})}),Le=!ue&&!i&&(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(sv,{id:`${t}-engine`,label:`Engine`,hint:j_(s.provider),children:(0,L.jsx)(`select`,{id:`${t}-engine`,className:`input staff-engine`,value:s.provider,"aria-describedby":`${t}-engine-hint ${t}-engine-note`,onChange:e=>he(t=>D_(t,e.target.value)),children:k_(r?.installed??[]).map(e=>(0,L.jsx)(`option`,{value:e.provider,children:e.text},e.provider))})}),(0,L.jsx)(lv,{id:`${t}-engine-note`,note:O_(s.provider,r?.installed??[],T.find(e=>e.provider===s.provider))},s.provider)]}),Re=De!==null&&(0,L.jsxs)(sv,{id:`${t}-model`,label:`Model`,hint:`Passed to ${_(s.provider).label} as --model. Empty uses its own default.${De.length>0?` Names it knows: ${De.join(`, `)}.`:``} Any name it accepts works.`,error:Te,children:[(0,L.jsx)(`input`,{id:`${t}-model`,className:`input`,type:`text`,list:`${t}-models`,value:s.model,placeholder:`its default`,autoComplete:`off`,autoCapitalize:`none`,spellCheck:!1,"aria-invalid":Te!==void 0,"aria-describedby":ov(`${t}-model`,!0,Te!==void 0),onChange:e=>ce({model:e.target.value},`model`),onBlur:le(`model`)}),(0,L.jsx)(`datalist`,{id:`${t}-models`,children:De.map(e=>(0,L.jsx)(`option`,{value:e},e))})]}),ze=!ue&&(0,L.jsx)(sv,{id:`${t}-role`,label:`Role`,hint:`${de!==null&&!i?`The default for ${de.callSign}. Yours to rewrite. `:``}${Me} / 4000`,error:be,children:(0,L.jsx)(`textarea`,{id:`${t}-role`,className:`textarea staff-role`,value:s.role,"aria-invalid":be!==void 0,"aria-describedby":ov(`${t}-role`,!0,be!==void 0),onChange:e=>ce({role:e.target.value},`role`),onBlur:le(`role`)})}),Be=_(s.provider).modes&&(0,L.jsxs)(`fieldset`,{className:`staff-modes`,children:[(0,L.jsx)(`legend`,{className:`label`,children:i?`Permissions`:`C · Permissions`}),(0,L.jsx)(`div`,{className:`staff-mode-tiles`,children:ev.map(e=>{let t=s.mode===e.value,n=e.value===`bypassPermissions`;return(0,L.jsxs)(`button`,{ref:n?D:void 0,type:`button`,className:`tile staff-mode`,"data-kind":t&&!n?`working`:void 0,"data-danger":n?``:void 0,"aria-pressed":t,onClick:()=>ce({mode:e.value,confirm:!1},`mode`),children:[(0,L.jsxs)(`span`,{className:`staff-tile-head`,children:[(0,L.jsx)(`span`,{className:`led`,"data-on":t?`true`:void 0,"aria-hidden":`true`}),(0,L.jsx)(`span`,{className:`tile-legend`,children:e.label})]}),(0,L.jsx)(`span`,{className:`tile-sub staff-mode-hint`,children:e.hint})]},e.value)})})]}),Ve=ae&&(0,L.jsxs)(`section`,{className:`staff-confirm flood`,"data-tone":`nogo`,role:`alertdialog`,"aria-labelledby":`${t}-bypass`,"aria-describedby":`${t}-bypass-text`,children:[(0,L.jsxs)(`h2`,{id:`${t}-bypass`,className:`disp`,children:[(0,L.jsx)(`span`,{className:`led`,"data-on":`true`,"aria-hidden":`true`}),`BYPASS PERMISSIONS?`]}),(0,L.jsxs)(`p`,{id:`${t}-bypass-text`,children:[pe===`A CONSOLE`?`This console`:pe,` will run every tool without asking: shell commands, file edits, the network. It runs as you, with your `,_(s.provider).label,` login.`]}),(0,L.jsxs)(`div`,{className:`staff-check`,children:[(0,L.jsx)(`input`,{id:`${t}-ok`,ref:ne,type:`checkbox`,checked:s.confirm,"aria-invalid":xe!==void 0,"aria-describedby":xe===void 0?void 0:`${t}-ok-error`,onChange:e=>ce({confirm:e.target.checked},`confirmBypass`),onBlur:le(`confirmBypass`)}),(0,L.jsx)(`label`,{htmlFor:`${t}-ok`,children:`I understand. Let it run without asking.`})]}),xe!==void 0&&(0,L.jsx)(`p`,{className:`error`,id:`${t}-ok-error`,children:xe}),(0,L.jsx)(`button`,{type:`button`,className:`btn`,"data-kind":`quiet`,onClick:ge,children:`Back`})]}),He=s.provider===`claude`&&(0,L.jsxs)(`div`,{className:`staff-clean`,"data-invalid":we===void 0?void 0:``,children:[(0,L.jsxs)(`div`,{className:`staff-check`,children:[(0,L.jsx)(`input`,{id:`${t}-clean`,type:`checkbox`,checked:s.cleanRoom,"aria-invalid":we!==void 0,"aria-describedby":ov(`${t}-clean`,!0,we!==void 0),onChange:e=>ce({cleanRoom:e.target.checked},`cleanRoom`)}),(0,L.jsx)(`label`,{htmlFor:`${t}-clean`,children:`Clean Room`})]}),we!==void 0&&(0,L.jsx)(`p`,{className:`error`,id:`${t}-clean-error`,children:we}),(0,L.jsxs)(`p`,{className:`hint`,id:`${t}-clean-hint`,children:[`Runs in a Docker container that holds only a copy of the project (a git worktree on the branch gonogo/`,s.name===``?`name`:s.name,`) and this console's own files. Docker must be running and the folder must be inside a git repository. To take the work back, commit in the worktree and merge the branch.`]})]}),Ue=je!==null&&(0,L.jsxs)(`details`,{className:`staff-fold`,open:S,onToggle:e=>C(e.currentTarget.open),children:[(0,L.jsx)(`summary`,{className:`label`,children:`PAYLOAD`}),(0,L.jsxs)(`div`,{className:`staff-fold-body`,children:[(0,L.jsx)(sv,{id:`${t}-servers`,label:`MCP servers`,hint:`One JSON object: a server name, then its command, args and env, or type http or sse with url and headers. The values are saved in plain text, keys and tokens included. Their tools are not allowed in advance: the permission mode decides.`,error:Se,children:(0,L.jsx)(`textarea`,{id:`${t}-servers`,className:`textarea staff-servers`,value:s.servers,placeholder:rv,autoComplete:`off`,autoCapitalize:`none`,spellCheck:!1,"aria-invalid":Se!==void 0,"aria-describedby":ov(`${t}-servers`,!0,Se!==void 0),onChange:e=>ce({servers:e.target.value},`payload.mcpServers`),onBlur:le(`payload.mcpServers`)})}),je===`all`&&(0,L.jsx)(sv,{id:`${t}-skills`,label:`Skill folders`,hint:`One absolute folder per line, each with a SKILL.md. Claude Code loads them for this console only.`,error:Ce,children:(0,L.jsx)(`textarea`,{id:`${t}-skills`,className:`textarea staff-skills`,value:s.skills,placeholder:`/Users/you/skills/my-skill`,autoComplete:`off`,autoCapitalize:`none`,spellCheck:!1,"aria-invalid":Ce!==void 0,"aria-describedby":ov(`${t}-skills`,!0,Ce!==void 0),onChange:e=>ce({skills:e.target.value},`payload.skills`),onBlur:le(`payload.skills`)})})]})]}),We=(0,L.jsxs)(`details`,{className:`staff-fold`,open:ee,onToggle:e=>w(e.currentTarget.open),children:[(0,L.jsxs)(`summary`,{className:`label`,children:[`CLEARANCE · KEYS`,Oe.length>0?` · ${Oe.length} SET`:``]}),(0,L.jsxs)(`div`,{className:`staff-fold-body`,children:[(0,L.jsxs)(`p`,{className:`hint`,id:`${t}-keys-hint`,children:[`Environment variables for this console only, such as an API key. They are saved on the gonogo machine (keys.json, mode 0600), given only to this console's process and never shown again: a saved key says SET. A name typed again replaces its value; the console picks changes up at its next start. At most `,16,`.`]}),Oe.length>0&&(0,L.jsx)(`ul`,{className:`staff-keys`,"aria-label":`Keys that are set`,children:Oe.map(e=>{let t=s.keysRemoved.includes(e);return(0,L.jsxs)(`li`,{children:[(0,L.jsx)(`code`,{children:e}),(0,L.jsx)(`span`,{className:`chip`,"data-tone":t?`amber`:`go`,children:t?`REMOVED ON SAVE`:`SET`}),(0,L.jsx)(`button`,{type:`button`,className:`btn`,"data-kind":`quiet`,"aria-pressed":t,"aria-label":`${t?`Keep`:`Remove`} ${e}`,onClick:()=>Ae(e),children:t?`Keep`:`Remove`})]},e)})}),s.keys.map((e,n)=>(0,L.jsxs)(`div`,{className:`staff-key-row`,children:[(0,L.jsxs)(`div`,{className:`field`,children:[(0,L.jsx)(`label`,{htmlFor:`${t}-key-name-${n}`,children:`Key name`}),(0,L.jsx)(`input`,{id:`${t}-key-name-${n}`,className:`input`,type:`text`,list:`${t}-key-names`,value:e.name,placeholder:`OPENAI_API_KEY`,autoComplete:`off`,autoCapitalize:`characters`,spellCheck:!1,"aria-invalid":Ee!==void 0,"aria-describedby":`${t}-keys-hint`,onChange:e=>ke(s.keys.map((t,r)=>r===n?{...t,name:e.target.value}:t)),onBlur:le(`keys`)})]}),(0,L.jsxs)(`div`,{className:`field`,children:[(0,L.jsx)(`label`,{htmlFor:`${t}-key-value-${n}`,children:`Value`}),(0,L.jsx)(`input`,{id:`${t}-key-value-${n}`,className:`input`,type:`password`,value:e.value,autoComplete:`new-password`,spellCheck:!1,"aria-invalid":Ee!==void 0,"aria-describedby":`${t}-keys-hint`,onChange:e=>ke(s.keys.map((t,r)=>r===n?{...t,value:e.target.value}:t)),onBlur:le(`keys`)})]}),(0,L.jsx)(`button`,{type:`button`,className:`btn`,"data-kind":`quiet`,"aria-label":`Drop key row ${n+1}`,onClick:()=>ke(s.keys.filter((e,t)=>t!==n)),children:`Drop`})]},n)),(0,L.jsx)(`datalist`,{id:`${t}-key-names`,children:g.map(e=>(0,L.jsx)(`option`,{value:e},e))}),Ee!==void 0&&(0,L.jsx)(`p`,{className:`error`,id:`${t}-keys-error`,role:`alert`,children:Ee}),(0,L.jsx)(`div`,{children:(0,L.jsx)(`button`,{type:`button`,className:`btn`,onClick:()=>ke([...s.keys,{name:``,value:``}]),children:`Add a key`})})]})]}),Ge=m!==null&&(0,L.jsx)(`p`,{className:`error staff-alert`,role:`alert`,tabIndex:-1,children:m});if(i&&O!==null){let e=O.state!==`stopped`;return(0,L.jsx)(dv,{title:Ne,count:null,children:(0,L.jsx)(`div`,{className:`staff-body`,children:(0,L.jsxs)(`form`,{className:`staff-form module`,"data-edit":``,"aria-label":`Edit a console`,noValidate:!0,ref:te,onSubmit:ve,children:[(0,L.jsx)(`h2`,{className:`label`,children:`A · Console`}),e&&(0,L.jsxs)(`p`,{className:`staff-notice`,"data-lit":``,children:[(0,L.jsx)(`span`,{className:`led`,"data-on":`true`,"data-blink":`true`,"aria-hidden":`true`}),(0,L.jsxs)(`span`,{children:[R(O.name,n),` is running. Changes apply at its next start.`]})]}),(0,L.jsxs)(`fieldset`,{className:`staff-fields`,disabled:f,children:[Pe,Ie,ze,Re,Fe,He,Be,Ve,Ue,We]}),Ge,(0,L.jsx)(`div`,{className:`staff-foot`,children:(0,L.jsxs)(`div`,{className:`staff-actions`,children:[(0,L.jsx)(`button`,{type:`submit`,className:`btn`,"data-size":`big`,"data-kind":e?void 0:`primary`,"aria-disabled":!ie||f,children:f?`SAVING…`:`SAVE`}),e&&(0,L.jsx)(`button`,{type:`button`,className:`btn`,"data-size":`big`,"data-kind":`primary`,"aria-disabled":!ie||f,onClick:()=>void _e(!0),children:`SAVE AND RESTART`})]})})]})})})}return(0,L.jsx)(dv,{title:Ne,count:oe,children:(0,L.jsxs)(`div`,{className:`staff-body`,children:[(0,L.jsxs)(`section`,{className:`staff-pick module`,"aria-label":`Position`,children:[(0,L.jsx)(`h2`,{className:`label`,children:`A · Position`}),(0,L.jsx)(`div`,{className:`staff-matrix-scroll`,children:(0,L.jsx)(`div`,{className:`staff-matrix`,children:gi.map((e,t)=>(0,L.jsx)(cv,{position:e,n:t+1,picked:!ue&&s.position===e.id,seated:me.has(e.id),onPick:e=>he(t=>T_(t,e,n,!0))},e.id))})}),(0,L.jsxs)(`div`,{className:`staff-wide-row`,children:[(0,L.jsxs)(`button`,{type:`button`,className:`tile staff-wide`,"data-kind":fe?`working`:void 0,"aria-pressed":fe,onClick:()=>he(e=>T_(e,``,n,!0)),children:[(0,L.jsxs)(`span`,{className:`staff-tile-head`,children:[(0,L.jsx)(`span`,{className:`led`,"data-on":fe?`true`:void 0,"aria-hidden":`true`}),(0,L.jsx)(`span`,{className:`tile-legend`,children:`NO POSITION`})]}),(0,L.jsx)(`span`,{className:`tile-sub`,children:`An agent with your own name and role`})]}),(0,L.jsxs)(`button`,{type:`button`,className:`tile staff-wide`,"data-kind":ue?`working`:void 0,"aria-pressed":ue,onClick:()=>he(e=>E_(e,n)),children:[(0,L.jsxs)(`span`,{className:`staff-tile-head`,children:[(0,L.jsx)(`span`,{className:`led`,"data-on":ue?`true`:void 0,"aria-hidden":`true`}),(0,L.jsx)(`span`,{className:`tile-legend`,children:`CUSTOM COMMAND`})]}),(0,L.jsx)(`span`,{className:`tile-sub`,children:`Any program in a terminal. No hooks, no mail.`})]})]}),ue?(0,L.jsx)(`p`,{className:`staff-notice`,children:`Any program in a terminal. No position, no permissions, no hooks and no mail.`}):de!==null&&(0,L.jsxs)(`section`,{className:`staff-picked ink flood`,"data-tone":`lit`,"aria-label":`Picked position`,children:[(0,L.jsx)(`span`,{className:`led`,"data-on":`true`,"aria-hidden":`true`}),(0,L.jsx)(`span`,{className:`disp staff-picked-name`,children:de.callSign}),(0,L.jsx)(`span`,{className:`staff-picked-title`,children:de.title}),(0,L.jsxs)(`span`,{className:`staff-picked-text`,children:[de.summary,`.`]})]})]}),(0,L.jsxs)(`form`,{className:`staff-form module`,"aria-label":`Console`,noValidate:!0,ref:te,onSubmit:ve,children:[(0,L.jsx)(`h2`,{className:`label`,children:`B · Console`}),(0,L.jsxs)(`fieldset`,{className:`staff-fields`,disabled:f,children:[Le,Pe,Ie,ze,Re,Fe,He,Be,Ve,Ue,We]}),Ge,(0,L.jsx)(`div`,{className:`staff-foot`,children:(0,L.jsx)(`button`,{type:`submit`,className:`btn staff-go`,"data-size":`big`,"data-kind":`primary`,"data-tone":ae&&ie?`nogo`:void 0,"aria-disabled":!ie||f,children:f?`STAFFING…`:R_(k,pe,ae)})})]})]})})}function pv(){let e=N(e=>e.form);if(e===null)return null;let t=e.mode===`edit`?`edit:${e.name}`:`hire:${e.position??``}:${e.custom===!0}`;return(0,L.jsx)(fv,{form:e},t)}var mv=`the address of the uplink (it is listed under the steps)`,hv=[{kind:`github`,label:`GitHub`,target:null,steps:[`Make the uplink below. Copy its secret now: it is shown once.`,`In the repository (or the organization) open Settings, Webhooks, Add webhook.`,`Payload URL: ${mv}. Content type: \`application/json\`. Secret: the secret you copied.`,`Choose "Let me select individual events" and tick Pushes, Pull requests, Issues, Issue comments and Workflow runs. Keep Active ticked and press Add webhook.`,`GitHub sends a ping at once. Under Recent Deliveries a green tick means gonogo answered, and the uplink lists a delivery "answered".`]},{kind:`linear`,label:`Linear`,target:null,steps:[`In Linear open Settings, API, Webhooks, New webhook.`,"Label: gonogo. URL: `https://example.com` for now. Under Data change events tick Issues and Comments. Create the webhook.",`Copy the Signing secret that Linear shows.`,`Make the uplink below and paste the signing secret into it.`,`In Linear edit the webhook and put ${mv} in URL. Save.`,`Linear sends no ping: change an issue, and the uplink lists the delivery.`]},{kind:`slack`,label:`Slack`,target:`slack`,steps:[`Open api.slack.com/apps, Create New App, From scratch. Pick a name and the workspace.`,"OAuth & Permissions, Bot Token Scopes: add `chat:write`, `app_mentions:read`, `im:history` and `channels:history` (and `groups:history` for private channels).",`App Home: turn on the Messages Tab and tick "Allow users to send Slash commands and messages from the messages tab".`,"Install App, Install to Workspace. Copy the Bot User OAuth Token, which starts with `xoxb-`.","In Slack invite the bot to the channel (`/invite @name`) and copy the channel id (channel details, at the bottom of About). Save the token and the channel id as the target above and press Test.",`Basic Information, App Credentials: copy the Signing Secret. Make the uplink below and paste it into it.`,`Event Subscriptions: switch it on and paste ${mv} as the Request URL. Slack checks it at once and shows Verified.`,"Under Subscribe to bot events add `app_mention`, `message.im` and `message.channels` (and `message.groups` for private channels). Save Changes, and reinstall the app if Slack asks.",`Mention the bot or write to it, and the agent gets the message. Reply in the thread of a message gonogo posted to answer the agent that wrote it.`]},{kind:`telegram`,label:`Telegram`,target:`telegram`,steps:["In Telegram write to @BotFather: `/newbot`, and pick a name. Copy the bot token, which looks like `123456789:AAF…`.",'Write any message to your new bot. Open `https://api.telegram.org/bot<BOT TOKEN>/getUpdates` in a browser and copy the number that follows `"chat":{"id":`. It is the chat id.',`Save the bot token and the chat id as the target above and press Test. Only this chat can talk to your agents: a message from any other chat is dropped.`,`Make the uplink below. Copy its secret now: it is shown once.`,'Tell Telegram where to send what you write. In a terminal: `curl "https://api.telegram.org/bot<BOT TOKEN>/setWebhook" --data-urlencode "url=<ADDRESS>" --data-urlencode "secret_token=<SECRET>"`. The address of the uplink must be HTTPS on port 443, 80, 88 or 8443. The answer says `"ok":true`.',`Write to the bot, and the agent gets the message. Reply to a message the bot sent to answer the agent that wrote it.`]}],gv={message:`Messages to you`,redline:`Redline trips`,tminus:`T-minus results`,"flight-plan":`Tasks blocked or in review`},_v=(e,t,n)=>ne.filter(r=>r===t?n:e.includes(r)),vv=(e,t)=>e===null?`Nothing sent yet`:`Last send ${ss(e.at,t)}: ${e.note}`,yv={slack:{to:`Channel id`,hint:`The id of the channel, such as C0123456789. The bot must be in it.`},telegram:{to:`Chat id`,hint:`The number of your chat with the bot. A group has a negative number.`}};function bv(e,t){let n={};return e.token.trim()===``&&!t&&(n.token=`Paste the bot token.`),e.to.trim()===``&&(n.to=`Say where to post.`),n}function xv(e){return e.split("`").map((e,t)=>({code:t%2==1,text:e})).filter(e=>e.text!==``)}var Sv=e=>e instanceof Error?e.message:String(e),Cv=e=>typeof e==`string`&&us.includes(e),wv=e=>e.currentTarget.select();function Tv({uplink:e,kind:t=`generic`,name:n=``,hint:r,onDone:i,onSecret:a}){let o=(0,l.useId)(),s=e?.kind??t,[c,u]=(0,l.useState)(``),d=Tg(),f=N(e=>e.agents),[p,m]=(0,l.useState)(()=>e===null?{...ps(`boss`),name:n}:ms(e)),[h,g]=(0,l.useState)({}),[_,v]=(0,l.useState)(null),[y,b]=(0,l.useState)(!1),x=(0,l.useRef)(null);(0,l.useEffect)(()=>x.current?.focus(),[]);let S=(0,l.useMemo)(()=>is(d,f,e?.to??null),[d,f,e]),C=(e,t)=>{m(t=>({...t,...e})),t!==void 0&&g(e=>({...e,[t]:void 0}))},ee=(e,t)=>[t,h[e]===void 0?``:`${o}-${e}-error`].filter(Boolean).join(` `)||void 0;async function w(t){if(t.preventDefault(),y)return;let n=hs(p),r=ds(s)?fs(c.trim(),e!==null):void 0;r!==void 0&&(n.secret=r),g(n),v(null);let l=us.find(e=>n[e]!==void 0);if(l!==void 0)document.getElementById(`${o}-${l}`)?.focus();else{b(!0);try{if(e===null){let e=await jr({...gs(p),kind:s,...ds(s)?{secret:c.trim()}:{}});ds(s)||a({name:e.name,secret:e.secret})}else await Mr(e.id,{name:p.name.trim(),to:p.to,enabled:p.enabled,...c.trim()===``?{}:{secret:c.trim()}});i()}catch(e){let t=e.field;Cv(t)?(g({[t]:Sv(e)}),document.getElementById(`${o}-${t}`)?.focus()):v(Sv(e)),b(!1)}}}let T=e=>{let t=h[e];return t===void 0?null:(0,L.jsx)(`p`,{className:`error`,id:`${o}-${e}-error`,children:t})};return(0,L.jsxs)(`form`,{className:`win-form module`,"aria-label":e===null?`New ${s} uplink`:`Edit ${e.name}`,noValidate:!0,onSubmit:e=>void w(e),onKeyDown:e=>{e.key===`Escape`&&!e.nativeEvent.isComposing&&i()},children:[(0,L.jsx)(`h3`,{className:`label`,children:e===null?s===`generic`?`New uplink`:`New ${s} uplink`:`Edit uplink`}),(0,L.jsxs)(`fieldset`,{className:`win-fields`,disabled:y,children:[(0,L.jsxs)(`div`,{className:`field`,"data-invalid":h.name===void 0?void 0:``,children:[(0,L.jsx)(`label`,{htmlFor:`${o}-name`,children:`Name`}),(0,L.jsx)(`input`,{id:`${o}-name`,ref:x,className:`input`,value:p.name,maxLength:60,autoComplete:`off`,"aria-invalid":h.name!==void 0,"aria-describedby":ee(`name`,`${o}-name-hint`),onChange:e=>C({name:e.target.value},`name`)}),T(`name`),(0,L.jsxs)(`p`,{className:`hint`,id:`${o}-name-hint`,children:[`Every delivery arrives as “`,O(p.name.trim()===``?`name`:p.name.trim()),`”.`]})]}),(0,L.jsxs)(`div`,{className:`field`,children:[(0,L.jsx)(`label`,{htmlFor:`${o}-to`,children:`Send to`}),(0,L.jsx)(`select`,{id:`${o}-to`,className:`input`,value:p.to,"aria-describedby":ee(`to`),onChange:e=>C({to:e.target.value},`to`),children:S.map(e=>(0,L.jsx)(`option`,{value:e.value,children:e.label},e.value))}),T(`to`)]}),ds(s)&&(0,L.jsxs)(`div`,{className:`field`,"data-invalid":h.secret===void 0?void 0:``,children:[(0,L.jsx)(`label`,{htmlFor:`${o}-secret`,children:`Signing secret`}),(0,L.jsx)(`input`,{id:`${o}-secret`,type:`password`,className:`input`,value:c,autoComplete:`off`,spellCheck:!1,"aria-invalid":h.secret!==void 0,"aria-describedby":ee(`secret`,`${o}-secret-hint`),onChange:e=>{u(e.target.value),g(e=>({...e,secret:void 0}))}}),T(`secret`),(0,L.jsxs)(`p`,{className:`hint`,id:`${o}-secret-hint`,children:[e===null?``:`Leave it empty to keep the saved secret. `,r??`The secret of the service: gonogo checks every delivery against it.`]})]}),(0,L.jsxs)(`div`,{className:`win-check`,children:[(0,L.jsx)(`input`,{id:`${o}-enabled`,type:`checkbox`,checked:p.enabled,onChange:e=>C({enabled:e.target.checked})}),(0,L.jsx)(`label`,{htmlFor:`${o}-enabled`,children:`On: take deliveries`})]})]}),_!==null&&(0,L.jsx)(`p`,{className:`error`,role:`alert`,children:_}),(0,L.jsxs)(`div`,{className:`win-actions`,children:[(0,L.jsx)(`button`,{type:`submit`,className:`btn`,"data-kind":`primary`,"data-size":`big`,"aria-disabled":y||void 0,children:y?`Saving…`:`Save`}),(0,L.jsx)(`button`,{type:`button`,className:`btn`,"data-size":`big`,"data-kind":`quiet`,onClick:i,children:`Cancel`})]})]})}function Ev({shown:e,onDone:t,onNotice:n}){let r=(0,l.useRef)(null);return(0,l.useEffect)(()=>{r.current?.focus(),r.current?.select()},[]),(0,L.jsxs)(`div`,{className:`up-secret flood`,"data-tone":`amber`,role:`group`,"aria-label":`Secret of ${e.name}`,children:[(0,L.jsxs)(`p`,{children:[(0,L.jsxs)(`strong`,{children:[`Secret of `,e.name,`.`]}),` It is shown once and gonogo will not show it again. Copy it into the sender now; if it is lost, rotate it.`]}),(0,L.jsx)(`input`,{ref:r,readOnly:!0,className:`input up-value`,"aria-label":`Secret of ${e.name}`,value:e.secret,spellCheck:!1,onFocus:wv}),(0,L.jsxs)(`div`,{className:`up-keys`,children:[(0,L.jsx)(`button`,{type:`button`,className:`btn`,onClick:()=>void _s(e.secret).then(e=>n(e?`Secret copied.`:`Could not copy. Select the secret and copy it.`)),children:`Copy secret`}),(0,L.jsx)(`button`,{type:`button`,className:`btn`,"data-kind":`primary`,onClick:t,children:`I have it`})]})]})}function Dv({uplink:e,now:t,onEdit:n,onNotice:r,onSecret:i}){let a=N(e=>e.agents),{busy:o,error:s,run:c}=To(),[u,d]=(0,l.useState)(null),f=(0,l.useRef)(null),p=(0,l.useRef)(null),m=(0,l.useRef)(null),h=(0,l.useRef)(null);(0,l.useEffect)(()=>{u===null?h.current!==null&&((h.current===`rotate`?p:m).current?.focus(),h.current=null):(h.current=u,f.current?.focus())},[u]);let{name:g}=e,_=!e.enabled,v=os(location.origin,e.id);return(0,L.jsxs)(`li`,{className:`up-row`,"data-off":_?``:void 0,children:[(0,L.jsxs)(`div`,{className:`win-main`,children:[(0,L.jsx)(`h3`,{className:`win-name`,children:g}),(0,L.jsxs)(`p`,{className:`win-to`,children:[`to `,as(e.to,a)]}),(0,L.jsx)(`p`,{className:`win-to`,children:e.kind})]}),(0,L.jsxs)(`div`,{className:`up-url`,children:[(0,L.jsx)(`input`,{readOnly:!0,className:`input up-value`,"aria-label":`Address of ${g}`,value:v,spellCheck:!1,onFocus:wv}),(0,L.jsx)(`button`,{type:`button`,className:`btn`,"aria-label":`Copy address of ${g}`,onClick:()=>void _s(v).then(e=>r(e?`Address of ${g} copied.`:`Could not copy. Select the address and copy it.`)),children:`Copy`})]}),(0,L.jsx)(`p`,{className:`win-last`,children:cs(e,t)}),e.deliveries.length>0&&(0,L.jsxs)(`details`,{className:`up-log`,children:[(0,L.jsxs)(`summary`,{children:[`Deliveries (`,e.deliveries.length,`)`]}),(0,L.jsx)(`ul`,{className:`up-deliveries`,children:e.deliveries.map((e,n)=>(0,L.jsxs)(`li`,{children:[(0,L.jsx)(`span`,{className:`up-at`,children:ss(e.at,t)}),(0,L.jsx)(`span`,{className:`chip`,"data-tone":ls(e.status),children:e.status}),(0,L.jsx)(`span`,{className:`up-note`,children:e.note})]},`${e.at}-${n}`))})]}),(0,L.jsxs)(`div`,{className:`win-buttons`,children:[(0,L.jsxs)(`label`,{className:`win-switch`,children:[(0,L.jsx)(`input`,{type:`checkbox`,role:`switch`,checked:e.enabled,"aria-label":`${g} enabled`,"aria-disabled":o||void 0,onChange:()=>c(()=>Mr(e.id,{enabled:!e.enabled}))}),(0,L.jsx)(`span`,{children:`Enabled`})]}),(0,L.jsx)(`button`,{type:`button`,className:`btn`,"aria-label":`Test: ${g}`,"aria-disabled":o||void 0,onClick:()=>c(async()=>r(`${g}: ${(await Fr(e.id)).deliveries[0]?.note??`sent`}`)),children:`Test`}),!ds(e.kind)&&(0,L.jsx)(`button`,{type:`button`,ref:p,className:`btn`,"aria-label":`Rotate secret: ${g}`,"aria-disabled":o||void 0,onClick:()=>d(`rotate`),children:`Rotate secret`}),(0,L.jsx)(`button`,{type:`button`,className:`btn`,"data-kind":`quiet`,"aria-label":`Edit ${g}`,onClick:n,children:`Edit`}),(0,L.jsx)(`button`,{type:`button`,ref:m,className:`btn`,"data-kind":`danger`,"aria-label":`Delete ${g}`,"aria-disabled":o||void 0,onClick:()=>d(`delete`),children:`Delete`})]}),u!==null&&(0,L.jsxs)(`div`,{className:`win-confirm flood`,"data-tone":`nogo`,role:`group`,"aria-label":u===`rotate`?`Rotate the secret of ${g}?`:`Delete ${g}?`,children:[(0,L.jsx)(`p`,{children:u===`rotate`?(0,L.jsxs)(L.Fragment,{children:[(0,L.jsxs)(`strong`,{children:[`Rotate the secret of `,g,`?`]}),` The old secret stops working now. You get the new one once.`]}):(0,L.jsxs)(L.Fragment,{children:[(0,L.jsxs)(`strong`,{children:[`Delete `,g,`?`]}),` Its address stops answering and its secret is gone.`]})}),(0,L.jsx)(`button`,{type:`button`,className:`btn`,ref:f,onClick:()=>d(null),children:`Keep`}),(0,L.jsx)(`button`,{type:`button`,className:`btn`,"data-kind":`primary`,"aria-disabled":o||void 0,onClick:()=>{let t=u;d(null),c(t===`rotate`?async()=>i({name:g,secret:(await Pr(e.id)).secret}):()=>Nr(e.id))},children:u===`rotate`?`Rotate`:`Delete`})]}),s!==null&&(0,L.jsx)(`p`,{className:`error win-error`,role:`alert`,children:s})]})}function Ov(){let e=(0,l.useId)(),t=N(e=>e.uplinks),n=Nt(),[r,i]=(0,l.useState)(null),[a,o]=(0,l.useState)(null),[s,c]=(0,l.useState)(``),u=(0,l.useRef)(null),d=r===null||r===`new`?null:t.find(e=>e.id===r)??null,f=r===`new`||d!==null,p=e=>{e(null),u.current?.focus()};return(0,L.jsxs)(`section`,{className:`up`,"aria-labelledby":e,children:[(0,L.jsxs)(`header`,{className:`loop-head`,children:[(0,L.jsx)(`h2`,{id:e,className:`disp loop-title up-title`,children:`UPLINK`}),(0,L.jsx)(`button`,{type:`button`,ref:u,className:`btn`,"data-kind":`primary`,"aria-disabled":t.length>=20||void 0,onClick:()=>t.length<20&&i(`new`),children:`New uplink`})]}),f&&(0,L.jsx)(Tv,{uplink:d,onDone:()=>p(i),onSecret:o},r),a!==null&&(0,L.jsx)(Ev,{shown:a,onDone:()=>p(o),onNotice:c}),(0,L.jsx)(`div`,{className:`win-list module`,children:t.length===0?(0,L.jsx)(`p`,{className:`loop-empty`,children:`No uplinks yet. An uplink is an address that a service or a script posts JSON to; each post reaches an agent as a message.`}):(0,L.jsx)(`ul`,{className:`win-rows`,children:t.map(e=>(0,L.jsx)(Dv,{uplink:e,now:n,onEdit:()=>i(e.id),onNotice:c,onSecret:o},e.id))})}),(0,L.jsx)(`p`,{className:`hint up-notice`,role:`status`,children:s})]})}var kv=e=>e instanceof Error?e.message:String(e),Av=e=>e.currentTarget.select();function jv({view:e,setView:t,onNotice:n}){let r=(0,l.useId)(),{busy:i,error:a,run:o}=To();return(0,L.jsxs)(`fieldset`,{className:`rl-forward module`,disabled:e===null,children:[(0,L.jsx)(`legend`,{className:`label`,children:`Forwarded to the targets`}),ne.map(a=>(0,L.jsxs)(`div`,{className:`win-check`,children:[(0,L.jsx)(`input`,{id:`${r}-${a}`,type:`checkbox`,checked:e?.forward.includes(a)??!1,"aria-disabled":i||void 0,onChange:r=>{let i=r.target.checked;e!==null&&o(async()=>{t(await Br({kinds:_v(e.forward,a,i)})),n(`${gv[a]}: ${i?`forwarded`:`not forwarded`}.`)})}}),(0,L.jsx)(`label`,{htmlFor:`${r}-${a}`,children:gv[a]})]},a)),(0,L.jsx)(`p`,{className:`hint`,children:`A kind that is ticked goes to every target that is saved below, as soon as it happens.`}),a!==null&&(0,L.jsx)(`p`,{className:`error`,role:`alert`,children:a})]})}function Mv({service:e,label:t,saved:n,setView:r,now:i,onNotice:a}){let o=(0,l.useId)(),[s,c]=(0,l.useState)(``),[u,d]=(0,l.useState)(n?.to??``),[f,p]=(0,l.useState)({}),[m,h]=(0,l.useState)(!1),{busy:g,error:_,run:v}=To(),y=yv[e];(0,l.useEffect)(()=>d(n?.to??``),[n?.to]);async function b(i){if(i.preventDefault(),m)return;let l=bv({token:s,to:u},n!==null);p(l);let d=l.token===void 0?l.to===void 0?null:`to`:`token`;if(d!==null)document.getElementById(`${o}-${d}`)?.focus();else{h(!0);try{r(await Lr(e,s.trim()===``?{to:u.trim()}:{token:s.trim(),to:u.trim()})),c(``),a(`${t} target saved.`)}catch(e){let t=e.field;t===`token`||t===`to`?(p({[t]:kv(e)}),document.getElementById(`${o}-${t}`)?.focus()):p({to:kv(e)})}h(!1)}}let x=e=>f[e]===void 0?null:(0,L.jsx)(`p`,{className:`error`,id:`${o}-${e}-error`,children:f[e]}),S=n?.last??null;return(0,L.jsxs)(`form`,{className:`rl-target`,"aria-label":`${t} target`,noValidate:!0,onSubmit:e=>void b(e),children:[(0,L.jsxs)(`div`,{className:`field`,"data-invalid":f.token===void 0?void 0:``,children:[(0,L.jsx)(`label`,{htmlFor:`${o}-token`,children:`Bot token`}),(0,L.jsx)(`input`,{id:`${o}-token`,type:`password`,className:`input`,value:s,placeholder:n===null?``:`Saved. Leave empty to keep it.`,autoComplete:`off`,spellCheck:!1,"aria-invalid":f.token!==void 0,"aria-describedby":f.token===void 0?void 0:`${o}-token-error`,onChange:e=>{c(e.target.value),p(e=>({...e,token:void 0}))}}),x(`token`)]}),(0,L.jsxs)(`div`,{className:`field`,"data-invalid":f.to===void 0?void 0:``,children:[(0,L.jsx)(`label`,{htmlFor:`${o}-to`,children:y.to}),(0,L.jsx)(`input`,{id:`${o}-to`,className:`input`,value:u,autoComplete:`off`,spellCheck:!1,"aria-invalid":f.to!==void 0,"aria-describedby":[`${o}-to-hint`,f.to===void 0?``:`${o}-to-error`].filter(Boolean).join(` `),onChange:e=>{d(e.target.value),p(e=>({...e,to:void 0}))}}),x(`to`),(0,L.jsx)(`p`,{className:`hint`,id:`${o}-to-hint`,children:y.hint})]}),(0,L.jsxs)(`div`,{className:`rl-keys`,children:[(0,L.jsx)(`button`,{type:`submit`,className:`btn`,"data-kind":`primary`,"aria-disabled":m||void 0,children:m?`Saving…`:`Save target`}),(0,L.jsx)(`button`,{type:`button`,className:`btn`,"aria-label":`Test the ${t} target`,"aria-disabled":n===null||g||void 0,onClick:()=>n!==null&&v(async()=>{let n=await zr(e);r(n),a(`${t}: ${n[e]?.last?.note??`sent`}`)}),children:`Test`}),n!==null&&(0,L.jsx)(`button`,{type:`button`,className:`btn`,"data-kind":`danger`,"aria-label":`Remove the ${t} target`,"aria-disabled":g||void 0,onClick:()=>v(async()=>{r(await Rr(e)),c(``),a(`${t} target removed.`)}),children:`Remove`})]}),(0,L.jsxs)(`p`,{className:`win-last`,children:[n===null?`No target yet: nothing is sent to `+t+`.`:vv(S,i),S!==null&&(0,L.jsxs)(L.Fragment,{children:[` `,(0,L.jsx)(`span`,{className:`chip`,"data-tone":S.ok?`go`:`nogo`,children:S.ok?`sent`:`failed`})]})]}),_!==null&&(0,L.jsx)(`p`,{className:`error`,role:`alert`,children:_})]})}function Nv({info:e,...t}){let n=(0,l.useId)(),r=N(e=>e.uplinks).filter(t=>t.kind===e.kind),[i,a]=(0,l.useState)(!1),[o,s]=(0,l.useState)(null),c=(0,l.useRef)(null),{onNotice:u,now:d}=t,f=e=>{e(),c.current?.focus()};return(0,L.jsxs)(`article`,{className:`rl-card module`,"aria-labelledby":n,children:[(0,L.jsx)(`h3`,{id:n,className:`label`,children:e.label}),e.target!==null&&(0,L.jsx)(Mv,{...t,service:e.target,label:e.label,saved:t.view?.[e.target]??null}),(0,L.jsxs)(`details`,{className:`up-log rl-steps`,children:[(0,L.jsx)(`summary`,{children:`Setup steps`}),(0,L.jsx)(`ol`,{children:e.steps.map(e=>(0,L.jsx)(`li`,{children:xv(e).map((e,t)=>e.code?(0,L.jsx)(`code`,{children:e.text},t):e.text)},e))})]}),r.length>0&&(0,L.jsx)(`ul`,{className:`rl-uplinks`,"aria-label":`${e.label} uplinks`,children:r.map(e=>{let t=os(location.origin,e.id);return(0,L.jsxs)(`li`,{children:[(0,L.jsx)(`h4`,{className:`win-name`,children:e.name}),(0,L.jsxs)(`div`,{className:`up-url`,children:[(0,L.jsx)(`input`,{readOnly:!0,className:`input up-value`,"aria-label":`Address of ${e.name}`,value:t,spellCheck:!1,onFocus:Av}),(0,L.jsx)(`button`,{type:`button`,className:`btn`,"aria-label":`Copy address of ${e.name}`,onClick:()=>void _s(t).then(t=>u(t?`Address of ${e.name} copied.`:`Could not copy. Select the address and copy it.`)),children:`Copy`})]}),(0,L.jsx)(`p`,{className:`win-last`,children:cs(e,d)})]},e.id)})}),i&&(0,L.jsx)(Tv,{uplink:null,kind:e.kind,name:e.label,hint:e.kind===`slack`?`Slack, Basic Information, App Credentials, Signing Secret.`:e.kind===`linear`?`The Signing secret that Linear shows for the webhook.`:void 0,onDone:()=>f(()=>a(!1)),onSecret:s}),o!==null&&(0,L.jsx)(Ev,{shown:o,onDone:()=>f(()=>s(null)),onNotice:u}),(0,L.jsx)(`button`,{type:`button`,ref:c,className:`btn rl-make`,"aria-label":`Make a ${e.label} uplink`,onClick:()=>a(!0),children:`Make uplink`})]})}function Pv(){let e=(0,l.useId)(),t=Nt(),[n,r]=(0,l.useState)(null),[i,a]=(0,l.useState)(null),[o,s]=(0,l.useState)(``);(0,l.useEffect)(()=>{let e=!0;return Ir().then(t=>e&&r(t),t=>e&&a(kv(t))),()=>{e=!1}},[]);let c={view:n,setView:r,now:t,onNotice:s};return(0,L.jsxs)(`section`,{className:`rl`,"aria-labelledby":e,children:[(0,L.jsx)(`header`,{className:`loop-head`,children:(0,L.jsx)(`h2`,{id:e,className:`disp loop-title up-title`,children:`RELAY`})}),(0,L.jsx)(`p`,{className:`hint`,children:`Slack, GitHub, Linear and Telegram. They reach gonogo from the internet, so the address of an uplink needs a public HTTPS name that is on the allow-list; see Reverse proxy in the reference.`}),i!==null&&(0,L.jsx)(`p`,{className:`error`,role:`alert`,children:i}),(0,L.jsx)(jv,{...c}),(0,L.jsx)(`div`,{className:`rl-cards`,children:hv.map(e=>(0,L.jsx)(Nv,{info:e,...c},e.kind))}),(0,L.jsx)(`p`,{className:`hint up-notice`,role:`status`,children:o})]})}var Fv=e=>e instanceof Error?e.message:String(e);function Iv(e){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch{return e}}var Lv=e=>typeof e==`string`&&$o.includes(e);function Rv({schedule:e,onDone:t}){let n=(0,l.useId)(),r=Tg(),i=N(e=>e.agents),a=N(e=>e.info?.timeZone??``),o=Nt(),[s,c]=(0,l.useState)(()=>e===null?es(`boss`):ts(e)),[u,d]=(0,l.useState)({}),[f,p]=(0,l.useState)(null),[m,h]=(0,l.useState)(!1),g=(0,l.useRef)(null);(0,l.useEffect)(()=>g.current?.focus(),[]);let _=(0,l.useMemo)(()=>is(r,i,e?.to??null),[r,i,e]),v=Math.floor(o/6e4),y=(0,l.useMemo)(()=>Zo(s.rule,v*6e4),[s.rule,v]),b=Qo(a,Iv(a)),x=(e,t)=>{c(t=>({...t,...e})),t!==void 0&&d(e=>({...e,[t]:void 0}))},S=e=>u[e],C=(e,t)=>[t,S(e)===void 0?``:`${n}-${e}-error`].filter(Boolean).join(` `)||void 0;async function w(r){if(r.preventDefault(),m)return;let i=ns(s);d(i),p(null);let a=$o.find(e=>i[e]!==void 0);if(a!==void 0)document.getElementById(`${n}-${a}`)?.focus();else{h(!0);try{e===null?await qn(rs(s)):await Jn(e.id,rs(s)),t()}catch(e){let t=e.field;Lv(t)?(d({[t]:Fv(e)}),document.getElementById(`${n}-${t}`)?.focus()):p(Fv(e)),h(!1)}}}let T=e=>{let t=S(e);return t===void 0?null:(0,L.jsx)(`p`,{className:`error`,id:`${n}-${e}-error`,children:t})};return(0,L.jsxs)(`form`,{className:`win-form module`,"aria-label":e===null?`New schedule`:`Edit ${e.name}`,noValidate:!0,onSubmit:e=>void w(e),onKeyDown:e=>{e.key===`Escape`&&!e.nativeEvent.isComposing&&t()},children:[(0,L.jsx)(`h2`,{className:`label`,children:e===null?`New schedule`:`Edit schedule`}),(0,L.jsxs)(`fieldset`,{className:`win-fields`,disabled:m,children:[(0,L.jsxs)(`div`,{className:`field`,"data-invalid":S(`name`)===void 0?void 0:``,children:[(0,L.jsx)(`label`,{htmlFor:`${n}-name`,children:`Name`}),(0,L.jsx)(`input`,{id:`${n}-name`,ref:g,className:`input`,value:s.name,maxLength:60,autoComplete:`off`,"aria-invalid":S(`name`)!==void 0,"aria-describedby":C(`name`),onChange:e=>x({name:e.target.value},`name`)}),T(`name`)]}),(0,L.jsxs)(`div`,{className:`field`,children:[(0,L.jsx)(`label`,{htmlFor:`${n}-to`,children:`Send to`}),(0,L.jsx)(`select`,{id:`${n}-to`,className:`input`,value:s.to,"aria-describedby":C(`to`),onChange:e=>x({to:e.target.value},`to`),children:_.map(e=>(0,L.jsx)(`option`,{value:e.value,children:e.label},e.value))}),T(`to`)]}),(0,L.jsxs)(`div`,{className:`field`,children:[(0,L.jsx)(`label`,{htmlFor:`${n}-subject`,children:`Subject`}),(0,L.jsx)(`input`,{id:`${n}-subject`,className:`input`,value:s.subject,autoComplete:`off`,"aria-invalid":S(`subject`)!==void 0,"aria-describedby":C(`subject`,`${n}-subject-hint`),onChange:e=>x({subject:e.target.value},`subject`)}),T(`subject`),(0,L.jsxs)(`p`,{className:`hint`,id:`${n}-subject-hint`,children:[`The message arrives as “Launch Window: `,s.name.trim()===``?`name`:s.name.trim(),s.subject.trim()===``?``:`: ${s.subject.trim()}`,`”.`]})]}),(0,L.jsxs)(`div`,{className:`field`,children:[(0,L.jsx)(`label`,{htmlFor:`${n}-body`,children:`Message`}),(0,L.jsx)(`textarea`,{id:`${n}-body`,className:`textarea win-body`,rows:4,value:s.body,maxLength:ee,"aria-invalid":S(`body`)!==void 0,"aria-describedby":C(`body`),onChange:e=>x({body:e.target.value},`body`)}),T(`body`)]}),(0,L.jsxs)(`div`,{className:`field`,children:[(0,L.jsx)(`label`,{htmlFor:`${n}-rule`,children:`Rule`}),(0,L.jsx)(`input`,{id:`${n}-rule`,className:`input win-rule-input`,value:s.rule,maxLength:100,placeholder:`0 9 * * mon-fri`,autoComplete:`off`,autoCapitalize:`none`,spellCheck:!1,"aria-invalid":S(`rule`)!==void 0,"aria-describedby":C(`rule`,`${n}-rule-hint ${n}-rule-preview`),onChange:e=>x({rule:e.target.value},`rule`)}),T(`rule`),(0,L.jsxs)(`p`,{className:`hint`,id:`${n}-rule-hint`,children:[`Five fields: minute, hour, day of month, month, day of week. Lists, ranges and steps work (*/15, 9-17, mon,wed); a day of week is 0 to 7 or a name. Both day fields set: either one fires.`,` `,b===null?`Times are in the server’s time zone${a===``?``:` (${a})`}.`:`${b} A preview can be off by the difference.`]}),(0,L.jsxs)(`div`,{id:`${n}-rule-preview`,children:[y.problem!==null&&S(`rule`)===void 0&&(0,L.jsx)(`p`,{className:`hint win-problem`,children:y.problem}),y.times.length>0&&(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(`p`,{className:`label`,children:`Next three`}),(0,L.jsx)(`ol`,{className:`win-times`,children:y.times.map(e=>(0,L.jsx)(`li`,{className:`lcd win-time`,children:e},e))})]})]})]}),(0,L.jsxs)(`div`,{className:`win-check`,children:[(0,L.jsx)(`input`,{id:`${n}-enabled`,type:`checkbox`,checked:s.enabled,onChange:e=>x({enabled:e.target.checked})}),(0,L.jsx)(`label`,{htmlFor:`${n}-enabled`,children:`On: send it by itself`})]})]}),f!==null&&(0,L.jsx)(`p`,{className:`error`,role:`alert`,children:f}),(0,L.jsxs)(`div`,{className:`win-actions`,children:[(0,L.jsx)(`button`,{type:`submit`,className:`btn`,"data-kind":`primary`,"data-size":`big`,"aria-disabled":m||void 0,children:m?`Saving…`:`Save`}),(0,L.jsx)(`button`,{type:`button`,className:`btn`,"data-size":`big`,"data-kind":`quiet`,onClick:t,children:`Cancel`})]})]})}function zv({schedule:e,now:t,onEdit:n,onNotice:r}){let i=N(e=>e.agents),{busy:a,error:o,run:s}=To(),[c,u]=(0,l.useState)(!1),d=(0,l.useRef)(null),f=(0,l.useRef)(null),p=(0,l.useRef)(!1);(0,l.useEffect)(()=>{c?d.current?.focus():p.current&&f.current?.focus(),p.current=c},[c]);let{name:m}=e,h=!e.enabled;return(0,L.jsxs)(`li`,{className:`win-row`,"data-off":h?``:void 0,children:[(0,L.jsxs)(`div`,{className:`win-main`,children:[(0,L.jsx)(`h3`,{className:`win-name`,children:m}),(0,L.jsxs)(`p`,{className:`win-to`,children:[`to `,as(e.to,i)]}),(0,L.jsx)(`p`,{className:`win-rule`,children:e.rule})]}),(0,L.jsxs)(`p`,{className:`lcd win-next`,"data-off":h?``:void 0,children:[(0,L.jsx)(`span`,{className:`sr-only`,children:`Next: `}),Yo(e,t)]}),(0,L.jsx)(`p`,{className:`win-last`,children:Xo(e)}),(0,L.jsxs)(`div`,{className:`win-buttons`,children:[(0,L.jsxs)(`label`,{className:`win-switch`,children:[(0,L.jsx)(`input`,{type:`checkbox`,role:`switch`,checked:e.enabled,"aria-label":`${m} enabled`,"aria-disabled":a||void 0,onChange:()=>s(()=>Jn(e.id,{enabled:!e.enabled}))}),(0,L.jsx)(`span`,{children:`Enabled`})]}),(0,L.jsx)(`button`,{type:`button`,className:`btn`,"aria-label":`Run now: ${m}`,"aria-disabled":a||void 0,onClick:()=>s(async()=>r(`${m}: ${(await Xn(e.id)).lastResult??`sent`}`)),children:`Run now`}),(0,L.jsx)(`button`,{type:`button`,className:`btn`,"data-kind":`quiet`,"aria-label":`Edit ${m}`,onClick:n,children:`Edit`}),(0,L.jsx)(`button`,{type:`button`,ref:f,className:`btn`,"data-kind":`danger`,"aria-label":`Delete ${m}`,"aria-disabled":a||void 0,onClick:()=>u(!0),children:`Delete`})]}),c&&(0,L.jsxs)(`div`,{className:`win-confirm flood`,"data-tone":`nogo`,role:`group`,"aria-label":`Delete ${m}?`,children:[(0,L.jsxs)(`p`,{children:[(0,L.jsxs)(`strong`,{children:[`Delete `,m,`?`]}),` It will not send again.`]}),(0,L.jsx)(`button`,{type:`button`,className:`btn`,ref:d,onClick:()=>u(!1),children:`Keep`}),(0,L.jsx)(`button`,{type:`button`,className:`btn`,"data-kind":`primary`,"aria-disabled":a||void 0,onClick:()=>{u(!1),s(()=>Yn(e.id))},children:`Delete`})]}),o!==null&&(0,L.jsx)(`p`,{className:`error win-error`,role:`alert`,children:o})]})}function Bv(){let e=(0,l.useId)(),t=N(e=>e.schedules),n=N(e=>e.info?.timeZone??``),r=Nt(),i=Qo(n,Iv(n)),[a,o]=(0,l.useState)(null),[s,c]=(0,l.useState)(``),u=(0,l.useRef)(null);(0,l.useEffect)(()=>u.current?.focus(),[]);let d=a===null||a===`new`?null:t.find(e=>e.id===a)??null,f=a===`new`||d!==null;return(0,L.jsxs)(`section`,{className:`win`,"aria-labelledby":e,children:[(0,L.jsxs)(`header`,{className:`loop-head`,children:[(0,L.jsx)(`h1`,{id:e,ref:u,tabIndex:-1,className:`disp loop-title win-title`,children:`LAUNCH WINDOW`}),(0,L.jsx)(`button`,{type:`button`,className:`btn`,"data-kind":`primary`,"aria-disabled":t.length>=50||void 0,onClick:()=>t.length<50&&o(`new`),children:`New schedule`}),(0,L.jsx)(`button`,{type:`button`,className:`btn loop-room`,"data-kind":`quiet`,onClick:dt,children:`Room`})]}),n!==``&&(0,L.jsx)(`p`,{className:`hint win-zone`,children:i??`Rules run in the server’s time zone: ${n}.`}),f&&(0,L.jsx)(Rv,{schedule:d,onDone:()=>{o(null),u.current?.focus()}},a),(0,L.jsx)(`div`,{className:`win-list module`,children:t.length===0?(0,L.jsx)(`p`,{className:`loop-empty`,children:`No schedules yet. A schedule sends a message by itself on a rule, for example every weekday at 09:00.`}):(0,L.jsx)(`ul`,{className:`win-rows`,children:t.map(e=>(0,L.jsx)(zv,{schedule:e,now:r,onEdit:()=>o(e.id),onNotice:c},e.id))})}),(0,L.jsx)(Ov,{}),(0,L.jsx)(Pv,{}),(0,L.jsx)(Fs,{}),(0,L.jsx)(`p`,{className:`sr-only`,role:`status`,children:s})]})}function Vv({entry:e,current:t,onNotice:n,onGone:r}){let i=N(e=>e.agents),{busy:a,error:o,run:s}=To(),[c,u]=(0,l.useState)(!1),d=(0,l.useRef)(null),f=(0,l.useRef)(null),p=(0,l.useRef)(!1);return(0,l.useEffect)(()=>{c?f.current?.focus():p.current&&d.current?.focus(),p.current=c},[c]),(0,L.jsxs)(`li`,{className:`liv-row module`,"data-current":t?`true`:void 0,children:[(0,L.jsx)(`span`,{className:`liv-swatch`,"aria-hidden":`true`,children:Zh.map(t=>(0,L.jsx)(`span`,{style:{background:e.tokens[t]}},t))}),(0,L.jsxs)(`div`,{className:`liv-text`,children:[(0,L.jsxs)(`h3`,{className:`liv-name`,children:[e.name,t&&(0,L.jsxs)(L.Fragment,{children:[` `,(0,L.jsx)(`span`,{className:`chip`,"data-tone":`go`,children:`In use`})]})]}),e.description!==``&&(0,L.jsx)(`p`,{className:`liv-desc`,children:e.description}),(0,L.jsx)(`p`,{className:`hint`,children:Qh(e,e=>R(e,i))}),o!==null&&(0,L.jsx)(`p`,{className:`error`,role:`alert`,children:o})]}),(0,L.jsxs)(`div`,{className:`liv-actions`,children:[(0,L.jsx)(`button`,{type:`button`,className:`btn`,"data-kind":t?void 0:`primary`,"aria-label":`Apply ${e.name}`,"aria-disabled":a||t||void 0,onClick:()=>{t||s(async()=>{await ir(e.slug),n(`${e.name} applied.`)})},children:`Apply`}),!e.builtin&&(c?(0,L.jsxs)(`div`,{className:`liv-confirm flood`,"data-tone":`nogo`,role:`group`,"aria-label":`Delete ${e.name}?`,children:[(0,L.jsxs)(`p`,{children:[(0,L.jsxs)(`strong`,{children:[`Delete `,e.name,`?`]}),` The file goes with it.`]}),(0,L.jsx)(`button`,{type:`button`,className:`btn`,ref:f,onClick:()=>u(!1),children:`Keep`}),(0,L.jsx)(`button`,{type:`button`,className:`btn`,"data-kind":`primary`,"aria-disabled":a||void 0,onClick:()=>{u(!1),s(async()=>{await ar(e.slug),n(`${e.name} deleted.`),r()})},children:`Delete`})]}):(0,L.jsx)(`button`,{type:`button`,ref:d,className:`btn`,"data-kind":`danger`,"aria-label":`Delete ${e.name}`,"aria-disabled":a||void 0,onClick:()=>u(!0),children:`Delete`}))]})]})}function Hv({onNotice:e}){let t=(0,l.useId)(),n=Tg(),r=N(e=>e.agents),i=(0,l.useMemo)(()=>is(n,r,null),[n,r]),[a,o]=(0,l.useState)(``),[s,c]=(0,l.useState)(`boss`),[u,d]=(0,l.useState)(``),{busy:f,error:p,run:m}=To(),h=(0,l.useRef)(null);return(0,L.jsxs)(`form`,{className:`liv-design module`,"aria-labelledby":`${t}-title`,noValidate:!0,onSubmit:t=>{if(t.preventDefault(),f)return;let n=$h(a);d(n),n===``?m(async()=>{let t=await sr({to:s,brief:a.trim()});e(eg(R(t.to,r),t.ok,t.note)),t.ok&&o(``)}):h.current?.focus()},children:[(0,L.jsx)(`h2`,{id:`${t}-title`,className:`label`,children:`Design one`}),(0,L.jsxs)(`div`,{className:`field`,children:[(0,L.jsx)(`label`,{htmlFor:`${t}-brief`,children:`What should it look like?`}),(0,L.jsx)(`textarea`,{id:`${t}-brief`,ref:h,className:`textarea`,rows:3,value:a,maxLength:500,"aria-invalid":u!==``,"aria-describedby":`${t}-hint${u===``?``:` ${t}-problem`}`,onChange:e=>{o(e.target.value),d(``)}}),u!==``&&(0,L.jsx)(`p`,{className:`error`,id:`${t}-problem`,children:u}),(0,L.jsx)(`p`,{className:`hint`,id:`${t}-hint`,children:`For example: a dark blue look for night, with amber signals. The agent gets your line, the list of tokens and the contrast rule, and its livery is checked before it is saved.`})]}),(0,L.jsxs)(`div`,{className:`field`,children:[(0,L.jsx)(`label`,{htmlFor:`${t}-to`,children:`Ask`}),(0,L.jsx)(`select`,{id:`${t}-to`,className:`input`,value:s,onChange:e=>c(e.target.value),children:i.map(e=>(0,L.jsx)(`option`,{value:e.value,children:e.label},e.value))})]}),(0,L.jsx)(`div`,{className:`liv-actions`,children:(0,L.jsx)(`button`,{type:`submit`,className:`btn`,"data-kind":`primary`,"aria-disabled":f||void 0,children:`Ask for a livery`})}),p!==null&&(0,L.jsx)(`p`,{className:`error`,role:`alert`,children:p})]})}function Uv(){let e=(0,l.useId)(),t=N(e=>e.livery),[n,r]=(0,l.useState)(``),i=(0,l.useRef)(null);return(0,l.useEffect)(()=>i.current?.focus(),[]),(0,L.jsxs)(`section`,{className:`liv`,"aria-labelledby":e,children:[(0,L.jsxs)(`header`,{className:`loop-head`,children:[(0,L.jsx)(`h1`,{id:e,ref:i,tabIndex:-1,className:`disp loop-title liv-title`,children:`LIVERY`}),(0,L.jsx)(`button`,{type:`button`,className:`btn loop-room`,"data-kind":`quiet`,onClick:dt,children:`Room`})]}),(0,L.jsx)(`p`,{className:`hint`,children:`The look of gonogo. It is kept on the server, so every device that opens this room shows the one you apply.`}),(0,L.jsx)(`ul`,{className:`liv-list`,"aria-label":`Liveries`,children:t.liveries.map(e=>(0,L.jsx)(Vv,{entry:e,current:e.slug===t.current,onNotice:r,onGone:()=>i.current?.focus()},e.slug))}),(0,L.jsx)(Hv,{onNotice:r}),(0,L.jsx)(`p`,{className:`hint liv-notice`,role:`status`,children:n})]})}var Wv=30,Gv=150,Kv=2,qv=2.399963229728653,Jv={tag:1,author:1,mention:1,cooccur:.4};function Yv(e,t=760,n=520){let r=e.nodes,i=r.length,a=new Map;if(i===0)return a;let o={w:t-60,h:n-60},s=new Float64Array(i),c=new Float64Array(i);for(let e=0;e<i;e+=1){let r=Math.sqrt((e+.5)/i);s[e]=t/2+Math.cos(e*qv)*r*o.w*.45,c[e]=n/2+Math.sin(e*qv)*r*o.h*.45}let l=new Map(r.map((e,t)=>[e.id,t])),u=[];for(let t of e.edges){let e=l.get(t.from),n=l.get(t.to);e!==void 0&&n!==void 0&&e!==n&&u.push([e,n,Jv[t.kind]])}let d=Math.sqrt(o.w*o.h/i)*.8,f=new Float64Array(i),p=new Float64Array(i);for(let e=0;e<Gv;e+=1){f.fill(0),p.fill(0);for(let e=0;e<i;e+=1)for(let t=e+1;t<i;t+=1){let n=(s[e]??0)-(s[t]??0)||(e-t)*.01,r=(c[e]??0)-(c[t]??0)||(t-e)*.01,i=n*n+r*r+.01,a=d*d/i;f[e]=(f[e]??0)+n*a,p[e]=(p[e]??0)+r*a,f[t]=(f[t]??0)-n*a,p[t]=(p[t]??0)-r*a}for(let[e,t,n]of u){let r=(s[e]??0)-(s[t]??0),i=(c[e]??0)-(c[t]??0),a=Math.sqrt(r*r+i*i+.01)/d*n;f[e]=(f[e]??0)-r*a,p[e]=(p[e]??0)-i*a,f[t]=(f[t]??0)+r*a,p[t]=(p[t]??0)+i*a}let r=t/8*(1-e/Gv)+.5;for(let e=0;e<i;e+=1){let i=(f[e]??0)+(t/2-(s[e]??0))*.08,a=(p[e]??0)+(n/2-(c[e]??0))*.08,o=Math.sqrt(i*i+a*a)||1,l=Math.min(o,r)/o;s[e]=Math.min(t-Wv,Math.max(Wv,(s[e]??0)+i*l)),c[e]=Math.min(n-Wv,Math.max(Wv,(c[e]??0)+a*l))}}let m=(e,t)=>{let n=1/0,r=-1/0;for(let t of e)n=Math.min(n,t),r=Math.max(r,t);if(r-n<1)return;let a=Math.min(Kv,(t-60)/(r-n));for(let o=0;o<i;o+=1)e[o]=t/2+((e[o]??0)-(n+r)/2)*a};return m(s,t),m(c,n),r.forEach((e,t)=>a.set(e.id,{x:Math.round((s[t]??0)*10)/10,y:Math.round((c[t]??0)*10)/10})),a}var Xv=6.6,Zv=(e,t)=>e+14+t.length*Xv>760;function Qv(e,t){let n=new Set([t]);for(let r of e.edges)r.from===t&&n.add(r.to),r.to===t&&n.add(r.from);return n}function $v(e){if(e.total===0)return`The log is empty: there is nothing to draw.`;let t=(t,n)=>{let r=e.nodes.filter(e=>e.kind===t).length;return`${r} ${r===1?n:`${n}s`}`},n=`${t(`tag`,`tag`)} and ${t(`author`,`author`)}`;return e.shown<e.total?`The newest ${e.shown} of ${e.total} entries, with ${n}.`:`${e.total===1?`1 entry`:`All ${e.total} entries`}, ${n}.`}function ey(e,t){if(e.kind===`entry`)return`${e.ref}: ${e.label}`;let n=`${e.weight} ${e.weight===1?`entry`:`entries`}`;return`${e.kind===`author`?t:e.label}: ${n}`}function ty(e){let t=e=>e.slice(e.indexOf(`:`)+1),n=new Map(e.nodes.filter(e=>e.kind===`entry`).map(e=>[e.ref,{node:e,author:``,tags:[],mentions:[],mentionedBy:[]}])),r=new Map(e.nodes.filter(e=>e.kind!==`entry`).map(e=>[e.id,{node:e,entries:[],with:[]}]));for(let i of e.edges){let e=i.from.startsWith(`entry:`)?n.get(t(i.from)):void 0;i.kind===`mention`?(e?.mentions.push(t(i.to)),n.get(t(i.to))?.mentionedBy.push(t(i.from))):i.kind===`cooccur`?(r.get(i.from)?.with.push({tag:t(i.to),weight:i.weight}),r.get(i.to)?.with.push({tag:t(i.from),weight:i.weight})):e&&(i.kind===`author`?e.author=t(i.to):e.tags.push(t(i.to)),r.get(i.to)?.entries.push(t(i.from)))}let i=[...r.values()];return{entries:[...n.values()],tags:i.filter(e=>e.node.kind===`tag`),authors:i.filter(e=>e.node.kind===`author`)}}var ny=40,ry=e=>5+Math.min(e.weight-1,4),iy=(e,t)=>e.kind===`author`?R(e.ref,t):e.label;function ay({node:e}){return e.kind===`entry`?(0,L.jsx)(`circle`,{className:`chart-shape`,r:ry(e)}):e.kind===`tag`?(0,L.jsx)(`rect`,{className:`chart-shape`,x:-6.5,y:-6.5,width:13,height:13,transform:`rotate(45)`}):(0,L.jsx)(`rect`,{className:`chart-shape`,x:-8,y:-8,width:16,height:16,rx:3})}function oy({chart:e,openId:t,onOpen:n}){let r=N(e=>e.agents),i=(0,l.useMemo)(()=>Yv(e),[e]),[a,o]=(0,l.useState)(null),[s,c]=(0,l.useState)(null),u=(0,l.useRef)(new Map),d=e.nodes.map(e=>e.id),f=a!==null&&i.has(a)?a:null,p=(0,l.useMemo)(()=>f===null?null:Qv(e,f),[e,f]),m=s!==null&&i.has(s)?s:d[0]??null,h=e=>iy(e,r),g=f===null?void 0:e.nodes.find(e=>e.id===f),_=e=>{e.kind===`entry`?n(e.ref):o(f===e.id?null:e.id)};return(0,L.jsxs)(`div`,{className:`chart module`,children:[(0,L.jsxs)(`svg`,{className:`chart-svg`,viewBox:`0 0 760 520`,role:`group`,"aria-label":`Star chart of the Mission Log: entries, tags and authors`,onKeyDown:e=>{let t=Math.max(d.indexOf(m??``),0),n=e.key===`Home`?0:e.key===`End`?d.length-1:e.key===`ArrowRight`||e.key===`ArrowDown`?t+1:e.key===`ArrowLeft`||e.key===`ArrowUp`?t-1:null;n!==null&&d.length!==0&&(e.preventDefault(),u.current.get(d[Math.min(d.length-1,Math.max(0,n))]??``)?.focus())},children:[(0,L.jsx)(`defs`,{children:(0,L.jsx)(`marker`,{id:`chart-arrow`,viewBox:`0 0 8 8`,refX:`7`,refY:`4`,markerWidth:`7`,markerHeight:`7`,orient:`auto-start-reverse`,children:(0,L.jsx)(`path`,{className:`chart-arrow`,d:`M0 0 L8 4 L0 8 z`})})}),(0,L.jsx)(`g`,{"aria-hidden":`true`,children:e.edges.map(e=>{let t=i.get(e.from),n=i.get(e.to);if(!t||!n)return null;let r=f===null||e.from===f||e.to===f;return(0,L.jsx)(`line`,{className:`chart-edge`,"data-kind":e.kind,"data-dim":r?void 0:``,x1:t.x,y1:t.y,x2:n.x,y2:n.y,markerEnd:e.kind===`mention`?`url(#chart-arrow)`:void 0},`${e.kind}:${e.from}:${e.to}`)})}),e.nodes.map(n=>{let r=i.get(n.id);if(!r)return null;let a=n.kind===`entry`&&n.ref===t,o=n.kind===`entry`?n.ref:h(n),s=Zv(r.x,o);return(0,L.jsxs)(`g`,{id:n.kind===`entry`?Ze(n.ref):void 0,ref:e=>{e?u.current.set(n.id,e):u.current.delete(n.id)},className:`chart-node`,"data-kind":n.kind,"data-dim":p===null||p.has(n.id)?void 0:``,transform:`translate(${r.x} ${r.y})`,role:`button`,tabIndex:n.id===m?0:-1,"aria-pressed":n.kind===`entry`?a:f===n.id,"aria-label":n.kind===`entry`?`Entry ${n.ref}: ${n.label}`:`${n.kind===`tag`?`Tag`:`Author`} ${ey(n,h(n))}`,onFocus:()=>c(n.id),onClick:()=>_(n),onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),_(n))},children:[(0,L.jsx)(`title`,{children:ey(n,h(n))}),(0,L.jsx)(`circle`,{className:`chart-hit`,r:15}),(0,L.jsx)(ay,{node:n}),(0,L.jsx)(`text`,{className:`chart-label`,"data-show":n.kind!==`entry`||e.nodes.length<=ny?``:void 0,textAnchor:s?`end`:`start`,x:(n.kind===`entry`?11:12)*(s?-1:1),y:4,children:o})]},n.id)})]}),(0,L.jsx)(`p`,{className:`hint chart-status`,role:`status`,children:g===void 0?$v(e):`${ey(g,h(g))}. The nodes joined to it are lit; choose it again to clear.`}),(0,L.jsx)(`p`,{className:`hint chart-key`,children:`Circle: entry. Diamond: tag. Square: author. Arrow: the entry names the other. Dashed: two tags that share entries. Arrow keys walk the nodes, Enter opens an entry. Links lists the same chart.`})]})}function sy({chart:e,openId:t,onOpen:n}){let r=(0,l.useId)(),i=N(e=>e.agents),a=(0,l.useMemo)(()=>ty(e),[e]),o=new Map(a.entries.map(e=>[e.node.ref,e.node.label])),s=e=>(0,L.jsx)(`button`,{type:`button`,className:`btn chart-ref`,"data-kind":`quiet`,"aria-label":`Open ${e}: ${o.get(e)??``}`,"aria-current":e===t?`true`:void 0,onClick:()=>n(e),children:e},e);return(0,L.jsxs)(`div`,{className:`chart-links`,children:[(0,L.jsx)(`p`,{className:`hint`,children:$v(e)}),(0,L.jsxs)(`section`,{"aria-labelledby":`${r}-entries`,children:[(0,L.jsx)(`h2`,{className:`label`,id:`${r}-entries`,children:`ENTRIES`}),(0,L.jsx)(`ul`,{className:`chart-list`,children:a.entries.map(e=>(0,L.jsxs)(`li`,{children:[(0,L.jsxs)(`button`,{type:`button`,id:Ze(e.node.ref),className:`log-row`,"aria-current":e.node.ref===t?`true`:void 0,onClick:()=>n(e.node.ref),children:[(0,L.jsxs)(`span`,{className:`log-row-top`,children:[(0,L.jsx)(`span`,{className:`log-id`,children:e.node.ref}),(0,L.jsx)(`span`,{className:`log-who`,children:R(e.author,i)})]}),(0,L.jsx)(`span`,{className:`log-row-title`,children:e.node.label}),e.tags.length>0&&(0,L.jsx)(`span`,{className:`chart-rel`,children:`Tags: ${e.tags.join(`, `)}`})]}),e.mentions.length+e.mentionedBy.length>0&&(0,L.jsxs)(`p`,{className:`chart-rel`,children:[e.mentions.length>0&&(0,L.jsxs)(L.Fragment,{children:[`Names `,e.mentions.map(s)]}),e.mentionedBy.length>0&&(0,L.jsxs)(L.Fragment,{children:[`Named by `,e.mentionedBy.map(s)]})]})]},e.node.ref))})]}),[{key:`tags`,title:`TAGS`,rows:a.tags},{key:`authors`,title:`AUTHORS`,rows:a.authors}].map(({key:e,title:t,rows:n})=>(0,L.jsxs)(`section`,{"aria-labelledby":`${r}-${e}`,children:[(0,L.jsx)(`h2`,{className:`label`,id:`${r}-${e}`,children:t}),(0,L.jsx)(`ul`,{className:`chart-list`,children:n.map(e=>(0,L.jsxs)(`li`,{className:`chart-group`,children:[(0,L.jsx)(`p`,{className:`chart-name`,children:ey(e.node,iy(e.node,i))}),e.with.length>0&&(0,L.jsx)(`p`,{className:`chart-rel`,children:`Shares entries with ${e.with.map(e=>`${e.tag} (${e.weight})`).join(`, `)}`}),(0,L.jsx)(`p`,{className:`chart-ids`,children:e.entries.map(s)})]},e.node.id))})]},e))]})}var cy=[{lens:`entries`,label:`Entries`},{lens:`chart`,label:`Chart`},{lens:`links`,label:`Links`}],ly=e=>e instanceof Error?e.message:String(e),uy=e=>typeof e==`string`&&Ue.includes(e);function dy({tags:e}){return e.length===0?null:(0,L.jsx)(`span`,{className:`log-tags`,children:e.map(e=>(0,L.jsx)(`span`,{className:`chip`,"data-tone":`quiet`,children:e},e))})}function fy({entry:e,onDone:t}){let n=(0,l.useId)(),[r,i]=(0,l.useState)(()=>e===null?We():Ge(e)),[a,o]=(0,l.useState)({}),[s,c]=(0,l.useState)(null),[u,d]=(0,l.useState)(!1),f=(0,l.useRef)(null);(0,l.useEffect)(()=>f.current?.focus(),[]);let p=(e,t)=>{i(t=>({...t,...e})),o(e=>({...e,[t]:void 0}))},m=(e,t)=>[t,a[e]===void 0?void 0:`${n}-${e}-error`].filter(Boolean).join(` `)||void 0,h=e=>{let t=a[e];return t===void 0?null:(0,L.jsx)(`p`,{className:`error`,id:`${n}-${e}-error`,children:t})};async function g(i){if(i.preventDefault(),u)return;let a=qe(r);o(a),c(null);let s=Ue.find(e=>a[e]!==void 0);if(s!==void 0)document.getElementById(`${n}-${s}`)?.focus();else{d(!0);try{t(e===null?await ur(Je(r)):await dr(e.id,Je(r)))}catch(e){let t=e.field;uy(t)?(o({[t]:ly(e)}),document.getElementById(`${n}-${t}`)?.focus()):c(ly(e)),d(!1)}}}return(0,L.jsxs)(`form`,{className:`log-form module`,"aria-label":e===null?`New entry`:`Edit ${e.id}`,noValidate:!0,onSubmit:e=>void g(e),onKeyDown:e=>{e.key===`Escape`&&!e.nativeEvent.isComposing&&t(null)},children:[(0,L.jsx)(`h2`,{className:`label`,children:e===null?`New entry`:`Edit ${e.id}`}),(0,L.jsxs)(`fieldset`,{className:`log-fields`,disabled:u,children:[(0,L.jsxs)(`div`,{className:`field`,"data-invalid":a.title===void 0?void 0:``,children:[(0,L.jsx)(`label`,{htmlFor:`${n}-title`,children:`Title`}),(0,L.jsx)(`input`,{id:`${n}-title`,ref:f,className:`input`,value:r.title,maxLength:200,autoComplete:`off`,"aria-invalid":a.title!==void 0,"aria-describedby":m(`title`),onChange:e=>p({title:e.target.value},`title`)}),h(`title`)]}),(0,L.jsxs)(`div`,{className:`field`,children:[(0,L.jsx)(`label`,{htmlFor:`${n}-tags`,children:`Tags`}),(0,L.jsx)(`input`,{id:`${n}-tags`,className:`input`,value:r.tags,autoComplete:`off`,autoCapitalize:`none`,"aria-invalid":a.tags!==void 0,"aria-describedby":m(`tags`,`${n}-tags-hint`),onChange:e=>p({tags:e.target.value},`tags`)}),h(`tags`),(0,L.jsx)(`p`,{className:`hint`,id:`${n}-tags-hint`,children:`Words that name the topic, separated by spaces. Search finds them like words of the title.`})]}),(0,L.jsxs)(`div`,{className:`field`,children:[(0,L.jsx)(`label`,{htmlFor:`${n}-body`,children:`Entry`}),(0,L.jsx)(`textarea`,{id:`${n}-body`,className:`textarea log-body-input`,rows:10,value:r.body,maxLength:E,"aria-invalid":a.body!==void 0,"aria-describedby":m(`body`,`${n}-body-hint`),onChange:e=>p({body:e.target.value},`body`)}),h(`body`),(0,L.jsx)(`p`,{className:`hint`,id:`${n}-body-hint`,children:`Plain text or markdown, shown as it is typed. One finding to an entry.`})]})]}),s!==null&&(0,L.jsx)(`p`,{className:`error`,role:`alert`,children:s}),(0,L.jsxs)(`div`,{className:`log-actions`,children:[(0,L.jsx)(`button`,{type:`submit`,className:`btn`,"data-kind":`primary`,"data-size":`big`,"aria-disabled":u||void 0,children:u?`Saving…`:`Save`}),(0,L.jsx)(`button`,{type:`button`,className:`btn`,"data-size":`big`,"data-kind":`quiet`,onClick:()=>t(null),children:`Cancel`})]})]})}function py({entry:e,onEdit:t,onClose:n,onRemoved:r}){let i=(0,l.useId)(),a=N(e=>e.agents),{busy:o,error:s,run:c}=To(),[u,d]=(0,l.useState)(!1),f=(0,l.useRef)(null),p=(0,l.useRef)(null),m=(0,l.useRef)(null),h=(0,l.useRef)(!1);return(0,l.useEffect)(()=>f.current?.focus(),[e.id]),(0,l.useEffect)(()=>{u?p.current?.focus():h.current&&m.current?.focus(),h.current=u},[u]),(0,L.jsxs)(`article`,{className:`log-entry module`,"aria-labelledby":i,children:[(0,L.jsx)(`h2`,{className:`log-entry-title`,id:i,ref:f,tabIndex:-1,children:e.title}),(0,L.jsxs)(`p`,{className:`log-meta`,children:[(0,L.jsx)(`span`,{className:`log-id`,children:e.id}),(0,L.jsx)(`span`,{children:R(e.author,a)}),(0,L.jsx)(`span`,{children:`updated ${ra(e.updatedAt,Date.now())}`}),(0,L.jsx)(dy,{tags:e.tags})]}),(0,L.jsx)(`pre`,{className:`log-body`,children:e.body}),(0,L.jsxs)(`div`,{className:`log-actions`,children:[(0,L.jsx)(`button`,{type:`button`,className:`btn`,onClick:t,children:`Edit`}),u?(0,L.jsxs)(`div`,{className:`log-confirm flood`,"data-tone":`nogo`,role:`group`,"aria-label":`Delete ${e.id}?`,children:[(0,L.jsxs)(`p`,{children:[(0,L.jsxs)(`strong`,{children:[`Delete `,e.id,`?`]}),` The file goes with it.`]}),(0,L.jsx)(`button`,{type:`button`,className:`btn`,ref:p,onClick:()=>d(!1),children:`Keep`}),(0,L.jsx)(`button`,{type:`button`,className:`btn`,"data-kind":`primary`,"aria-disabled":o||void 0,onClick:()=>{d(!1),c(async()=>{await fr(e.id),r()})},children:`Delete`})]}):(0,L.jsx)(`button`,{type:`button`,ref:m,className:`btn`,"data-kind":`danger`,"aria-label":`Delete ${e.id}`,"aria-disabled":o||void 0,onClick:()=>d(!0),children:`Delete`}),(0,L.jsx)(`button`,{type:`button`,className:`btn`,"data-kind":`quiet`,onClick:n,children:`Close`})]}),s!==null&&(0,L.jsx)(`p`,{className:`error`,role:`alert`,children:s})]})}function my({hit:e,open:t,onOpen:n}){let r=N(e=>e.agents);return(0,L.jsx)(`li`,{children:(0,L.jsxs)(`button`,{type:`button`,id:Ze(e.id),className:`log-row`,"aria-current":t?`true`:void 0,onClick:n,children:[(0,L.jsxs)(`span`,{className:`log-row-top`,children:[(0,L.jsx)(`span`,{className:`log-id`,children:e.id}),(0,L.jsx)(`span`,{className:`log-who`,children:R(e.author,r)}),(0,L.jsx)(`span`,{className:`log-when`,children:ra(e.updatedAt,Date.now())})]}),(0,L.jsx)(`span`,{className:`log-row-title`,children:e.title}),(0,L.jsx)(dy,{tags:e.tags}),(0,L.jsx)(`span`,{className:`log-snippet`,children:e.snippet})]})})}function hy(){let e=(0,l.useId)(),t=N(e=>e.log),[n,r]=(0,l.useState)(``),[i,a]=(0,l.useState)(null),[o,s]=(0,l.useState)(null),[c,u]=(0,l.useState)(null),[d,f]=(0,l.useState)(null),[p,m]=(0,l.useState)(`read`),[h,g]=(0,l.useState)(`entries`),[_,v]=(0,l.useState)(null),[y,b]=(0,l.useState)(null),[x,S]=(0,l.useState)(``),C=(0,l.useRef)(null),ee=(0,l.useRef)(0);(0,l.useEffect)(()=>C.current?.focus(),[]),(0,l.useEffect)(()=>{let e=++ee.current,t=setTimeout(()=>{cr(n).then(t=>{e===ee.current&&(a(t),s(null))},t=>e===ee.current&&s(ly(t)))},200);return()=>clearTimeout(t)},[n,t.rev]),(0,l.useEffect)(()=>{if(h===`entries`)return;let e=!0;return Tr().then(t=>{e&&(v(t),b(null))},t=>e&&b(ly(t))),()=>{e=!1}},[h,t.rev]),(0,l.useEffect)(()=>{if(c===null){f(null);return}let e=!0;return lr(c).then(t=>e&&f(t),t=>{e&&(t.status===404?(S(`${c} was removed.`),u(null),m(`read`)):s(ly(t)))}),()=>{e=!1}},[c,t.rev]);let w=(0,l.useRef)(t.rev);(0,l.useEffect)(()=>{if(t.rev===w.current)return;w.current=t.rev;let e=Xe(t);e!==``&&S(e)},[t]);let T=e=>{u(e),m(`read`)},E=()=>{let e=c;u(null),m(`read`),requestAnimationFrame(()=>((e===null?null:document.getElementById(Ze(e)))??C.current)?.focus())},te=()=>{u(null),C.current?.focus()},D=e=>{e===null?(m(`read`),c===null&&requestAnimationFrame(()=>C.current?.focus())):(f(e),u(e.id),m(`read`),S(`${e.id} saved.`))},ne=p!==`read`||c!==null;return(0,L.jsxs)(`section`,{className:`log`,"aria-labelledby":e,"data-open":ne?``:void 0,children:[(0,L.jsxs)(`header`,{className:`loop-head`,children:[(0,L.jsx)(`h1`,{id:e,ref:C,tabIndex:-1,className:`disp loop-title log-heading`,children:`MISSION LOG`}),(0,L.jsx)(`div`,{className:`chart-lens`,role:`group`,"aria-label":`Show the log as`,children:cy.map(e=>(0,L.jsx)(`button`,{type:`button`,className:`btn`,"data-kind":`quiet`,"aria-pressed":h===e.lens,onClick:()=>g(e.lens),children:e.label},e.lens))}),(0,L.jsx)(`button`,{type:`button`,className:`btn`,"data-kind":`primary`,onClick:()=>m(`new`),children:`New entry`}),(0,L.jsx)(`button`,{type:`button`,className:`btn loop-room`,"data-kind":`quiet`,onClick:dt,children:`Room`})]}),(0,L.jsxs)(`div`,{className:`log-cols`,"data-lens":h,children:[(0,L.jsxs)(`div`,{className:`log-list`,children:[h===`chart`&&_!==null&&(0,L.jsx)(oy,{chart:_,openId:c,onOpen:T}),h===`links`&&_!==null&&(0,L.jsx)(sy,{chart:_,openId:c,onOpen:T}),h!==`entries`&&_===null&&y===null&&(0,L.jsx)(`p`,{className:`hint`,children:`Loading…`}),h!==`entries`&&y!==null&&(0,L.jsx)(`p`,{className:`error`,role:`alert`,children:y}),o!==null&&(0,L.jsx)(`p`,{className:`error`,role:`alert`,children:o}),h===`entries`&&(0,L.jsxs)(L.Fragment,{children:[(0,L.jsxs)(`form`,{className:`log-search module`,role:`search`,onSubmit:e=>e.preventDefault(),children:[(0,L.jsxs)(`div`,{className:`field`,children:[(0,L.jsx)(`label`,{htmlFor:`${e}-q`,children:`Search the log`}),(0,L.jsx)(`input`,{id:`${e}-q`,className:`input`,type:`search`,value:n,maxLength:200,autoComplete:`off`,autoCapitalize:`none`,"aria-describedby":`${e}-count`,onChange:e=>r(e.target.value)})]}),(0,L.jsx)(`p`,{className:`hint`,id:`${e}-count`,children:i===null?`Loading…`:Ye(n,i)})]}),i!==null&&i.hits.length===0&&i.total===0&&(0,L.jsx)(`p`,{className:`loop-empty`,children:`The log is empty. Agents write to it with log_write, and you can add an entry here.`}),i!==null&&i.hits.length>0&&(0,L.jsx)(`ul`,{className:`log-rows`,children:i.hits.map(e=>(0,L.jsx)(my,{hit:e,open:e.id===c,onOpen:()=>T(e.id)},e.id))})]})]}),(0,L.jsxs)(`div`,{className:`log-side`,children:[p===`new`&&(0,L.jsx)(fy,{entry:null,onDone:D}),p===`edit`&&d!==null&&(0,L.jsx)(fy,{entry:d,onDone:D},d.id),p===`read`&&d!==null&&c===d.id&&(0,L.jsx)(py,{entry:d,onEdit:()=>m(`edit`),onClose:E,onRemoved:te}),!ne&&(0,L.jsx)(`p`,{className:`hint log-pick`,children:`Pick an entry to read it.`})]})]}),(0,L.jsx)(`p`,{className:`sr-only`,role:`status`,children:x})]})}var gy={M:`modified`,A:`added`,D:`deleted`,R:`renamed`,C:`copied`,T:`type changed`,U:`unmerged`},_y=[`DD`,`AU`,`UD`,`UA`,`DU`,`AA`,`UU`];function vy(e){if(e.index===`?`&&e.tree===`?`)return[{text:`untracked`,staged:!1}];if(_y.includes(e.index+e.tree))return[{text:`conflict`,staged:!1}];let t=[],n=gy[e.index],r=gy[e.tree];return n!==void 0&&t.push({text:`staged: ${n}${e.from===void 0?``:` from ${e.from}`}`,staged:!0}),r!==void 0&&t.push({text:`not staged: ${r}`,staged:!1}),t}var yy=e=>e.filter(e=>vy(e).some(e=>e.staged)).length,by=e=>e.slice(0,7);function xy(e){if(e===``)return[];let t=e.endsWith(`
|
|
46
|
-
`)?e.slice(0,-1).split(`
|
|
47
|
-
`):e.split(`
|
|
48
|
-
`),n=!1;return t.map(e=>(e.startsWith(`diff --git `)&&(n=!1),e.startsWith(`@@`)?(n=!0,{kind:`hunk`,text:e}):n?{kind:e.startsWith(`+`)?`add`:e.startsWith(`-`)?`del`:`ctx`,text:e}:{kind:`meta`,text:e}))}function Sy(e,t,n,r){return r?e.trim()===``?`Write a message for the commit.`:e.length>1e4?`At most ${me} characters.`:n.length===0?`Nothing has changed.`:t===`staged`&&yy(n)===0?`Nothing is staged.`:null:`git has no author: set user.name and user.email first.`}var Cy=e=>e instanceof Error?e.message:String(e);function wy({agent:e}){let t=(0,l.useId)(),[n,r]=(0,l.useState)(null),[i,a]=(0,l.useState)([]),[o,s]=(0,l.useState)(``),[c,u]=(0,l.useState)(!1),[d,f]=(0,l.useState)(null),[p,m]=(0,l.useState)(``),[h,g]=(0,l.useState)(`all`),[_,v]=(0,l.useState)(null),[y,b]=(0,l.useState)(null),[x,S]=(0,l.useState)(!1),C=(0,l.useRef)(!0),ee=(0,l.useRef)(0),w=(t,n)=>{let r=ee.current+=1;yr(e,t,n).then(e=>void(C.current&&r===ee.current&&(f(e),v(null))),e=>void(C.current&&r===ee.current&&v(Cy(e))))},T=(t=o,n=c)=>{vr(e).then(i=>{C.current&&(r(i),i.repo&&(br(e).then(e=>C.current&&a(e),e=>C.current&&v(Cy(e))),w(t,n)))},e=>void(C.current&&v(Cy(e))))};(0,l.useEffect)(()=>(C.current=!0,T(),()=>{C.current=!1}),[]);let E=n?.repo?n.files:[],te=n?.repo?n.author:null,D=Sy(p,h,E,te!==null),ne=(0,l.useMemo)(()=>xy(d?.diff??``),[d]),O=(0,l.useMemo)(()=>Date.now(),[i]),re=(e,t)=>{s(e),u(t),w(e,t)};async function k(t){if(t.preventDefault(),!(x||D!==null)){S(!0),v(null),b(null);try{let t=await xr(e,{message:p,scope:h});if(!C.current)return;m(``),b(`Committed ${by(t.hash)}: ${t.subject}`),s(``),u(!1),T(``,!1)}catch(e){C.current&&v(Cy(e))}finally{C.current&&S(!1)}}}return n===null?_===null?(0,L.jsx)(`p`,{className:`hint hg-empty`,role:`status`,children:`Reading git…`}):(0,L.jsxs)(`div`,{className:`rc-box rc-retry`,children:[(0,L.jsx)(`p`,{className:`error`,role:`alert`,children:_}),(0,L.jsx)(`button`,{type:`button`,className:`btn`,"data-kind":`quiet`,onClick:()=>{v(null),T()},children:`Try again`})]}):n.repo?(0,L.jsxs)(`div`,{className:`hg-cols rc-cols`,children:[(0,L.jsxs)(`div`,{className:`rc-side`,children:[(0,L.jsxs)(`section`,{className:`module rc-box`,"aria-label":`Changes`,children:[(0,L.jsxs)(`div`,{className:`rc-head`,children:[(0,L.jsx)(`h2`,{className:`label`,children:`Changes`}),(0,L.jsx)(`span`,{className:`chip`,"data-tone":`quiet`,children:n.branch}),(0,L.jsx)(`button`,{type:`button`,className:`btn`,"data-kind":`quiet`,onClick:()=>T(),children:`Refresh`})]}),(0,L.jsx)(`p`,{className:`rc-author`,children:te===null?(0,L.jsx)(`span`,{className:`chip`,"data-tone":`amber`,children:`No git author. Set user.name and user.email.`}):`Author: ${te.name} <${te.email}>`}),(0,L.jsxs)(`ul`,{className:`rc-files`,children:[(0,L.jsx)(`li`,{children:(0,L.jsx)(`button`,{type:`button`,className:`rc-file`,"aria-pressed":o===``,onClick:()=>re(``,c),children:`All changes`})}),E.map(e=>(0,L.jsx)(`li`,{children:(0,L.jsxs)(`button`,{type:`button`,className:`rc-file`,"aria-pressed":o===e.path,onClick:()=>re(e.path,e.tree===` `&&e.index!==`?`),children:[(0,L.jsx)(`span`,{className:`rc-path`,children:e.path}),(0,L.jsx)(`span`,{className:`rc-labels`,children:vy(e).map(e=>(0,L.jsx)(`span`,{className:`chip`,"data-tone":e.staged?`go`:`quiet`,children:e.text},e.text))})]})},e.path)),E.length===0&&(0,L.jsx)(`li`,{className:`hint`,children:`Nothing has changed.`}),n.more>0&&(0,L.jsx)(`li`,{className:`hint`,children:`${n.more} more files than are shown.`})]})]}),(0,L.jsxs)(`form`,{className:`module rc-box rc-commit`,"aria-label":`Commit`,noValidate:!0,onSubmit:e=>void k(e),children:[(0,L.jsx)(`h2`,{className:`label`,children:`Commit`}),(0,L.jsxs)(`div`,{className:`field`,children:[(0,L.jsx)(`label`,{htmlFor:`${t}-message`,children:`Message`}),(0,L.jsx)(`textarea`,{id:`${t}-message`,className:`textarea`,rows:3,value:p,maxLength:me,autoComplete:`off`,onChange:e=>m(e.target.value)})]}),(0,L.jsxs)(`fieldset`,{className:`field rc-scope`,children:[(0,L.jsx)(`legend`,{children:`What to commit`}),(0,L.jsxs)(`label`,{className:`rc-radio`,children:[(0,L.jsx)(`input`,{type:`radio`,name:`${t}-scope`,checked:h===`all`,onChange:()=>g(`all`)}),`All changes (${E.length}): git adds them first`]}),(0,L.jsxs)(`label`,{className:`rc-radio`,children:[(0,L.jsx)(`input`,{type:`radio`,name:`${t}-scope`,checked:h===`staged`,onChange:()=>g(`staged`)}),`Only what is staged (${yy(E)})`]})]}),(0,L.jsx)(`button`,{type:`submit`,className:`btn`,"data-kind":`primary`,"aria-disabled":x||D!==null||void 0,"aria-describedby":D===null?void 0:`${t}-why`,children:`Commit`}),(0,L.jsx)(`p`,{className:`hint`,children:`No git hook runs for a commit made here. The author is the one in your git config.`}),D!==null&&(0,L.jsx)(`p`,{className:`hint`,id:`${t}-why`,children:D}),y!==null&&(0,L.jsx)(`p`,{className:`chip rc-made`,"data-tone":`go`,role:`status`,children:y})]}),_!==null&&(0,L.jsx)(`p`,{className:`error`,role:`alert`,children:_})]}),(0,L.jsxs)(`div`,{className:`rc-main`,children:[(0,L.jsxs)(`section`,{className:`module rc-box`,"aria-label":`Diff`,children:[(0,L.jsxs)(`div`,{className:`rc-head`,children:[(0,L.jsx)(`h2`,{className:`label`,children:`Diff: ${o===``?`all changes`:o}`}),(0,L.jsx)(`button`,{type:`button`,className:`btn`,"data-kind":c?`quiet`:`primary`,"aria-pressed":!c,onClick:()=>re(o,!1),children:`Not staged`}),(0,L.jsx)(`button`,{type:`button`,className:`btn`,"data-kind":c?`primary`:`quiet`,"aria-pressed":c,onClick:()=>re(o,!0),children:`Staged`})]}),(0,L.jsx)(`pre`,{className:`lcd rc-diff`,tabIndex:0,role:`region`,"aria-label":`Diff text`,children:ne.length===0?(0,L.jsx)(`span`,{"data-kind":`ctx`,children:`Nothing ${c?`is staged`:`differs from the index`} here. A new file has no diff until it is staged.`}):ne.map((e,t)=>(0,L.jsxs)(`span`,{"data-kind":e.kind,children:[e.text,`
|
|
49
|
-
`]},t))}),d?.truncated===!0&&(0,L.jsx)(`p`,{className:`hint`,children:`The diff is longer than what is shown here.`})]}),(0,L.jsxs)(`section`,{className:`module rc-box`,"aria-label":`Log`,children:[(0,L.jsx)(`h2`,{className:`label`,children:`Log: last 50`}),i.length===0?(0,L.jsx)(`p`,{className:`hint`,children:`No commits yet.`}):(0,L.jsx)(`ol`,{className:`rc-log`,children:i.map(e=>(0,L.jsxs)(`li`,{children:[(0,L.jsx)(`code`,{className:`rc-hash`,children:by(e.hash)}),(0,L.jsx)(`span`,{className:`rc-subject`,children:e.subject}),(0,L.jsx)(`span`,{className:`rc-by`,children:`${e.author}, ${ra(e.at,O)}`})]},e.hash))})]})]})]}):(0,L.jsx)(`p`,{className:`hint hg-empty`,role:`status`,children:n.reason})}function Ty(){let e=(0,l.useId)(),t=d_(),n=(0,l.useRef)(null);return(0,l.useEffect)(()=>n.current?.focus(),[]),(0,L.jsxs)(`section`,{className:`hg`,"aria-labelledby":e,children:[(0,L.jsx)(u_,{title:`RECORDER`,current:`recorder`,id:e,heading:n}),t===null?(0,L.jsx)(`p`,{className:`hint hg-empty`,children:`Pick a console in the room, or an agent above.`}):(0,L.jsx)(wy,{agent:t},t)]})}function Ey(e,t,n){return e===n.text?`clean`:n.revision===t?`edited`:`stale`}function Dy(e,t,n){return e.updatedAt===null?`Nobody has written the Plot Board yet.`:e.author===null?`Written by hand ${ra(e.updatedAt,n)}.`:`Written by ${R(e.author,t)} ${ra(e.updatedAt,n)}, revision ${e.revision}.`}var Oy=e=>`${e.length} of ${te} characters`,ky=e=>e.replace(/\r\n?/g,`
|
|
50
|
-
`).trimEnd(),Ay=(e,t)=>`${e.author===null?`Someone`:R(e.author,t)} wrote revision ${e.revision} while you were typing. Your text is still in the box: copy it, then load the latest.`,jy=e=>e instanceof Error?e.message:String(e);function My(){let e=(0,l.useId)(),t=N(e=>e.agents),[n,r]=(0,l.useState)(null),[i,a]=(0,l.useState)(``),[o,s]=(0,l.useState)(0),[c,u]=(0,l.useState)(null),[d,f]=(0,l.useState)(``),[p,m]=(0,l.useState)(!1),h=(0,l.useRef)(null),g=(0,l.useRef)(``),_=(0,l.useRef)(null);(0,l.useEffect)(()=>h.current?.focus(),[]);let v=e=>{r(e),a(e.text),s(e.revision),g.current=e.text,_.current=e.text};Hi(()=>{Sr().then(e=>{r(e),u(null),(_.current===null||g.current===_.current)&&v(e)},e=>u(jy(e)))});let y=n===null?`clean`:Ey(ky(i),o,n),b=async()=>{if(!(p||n===null||y!==`edited`)){m(!0),u(null);try{let e=await Cr(i,o);v(e),f(`Saved.`)}catch(e){if(e.status===409){let n=await Sr().catch(()=>null);n!==null&&r(n),u(n===null?jy(e):Ay(n,t))}else u(jy(e))}finally{m(!1)}}};return(0,L.jsxs)(`section`,{className:`rec`,"aria-labelledby":e,children:[(0,L.jsxs)(`header`,{className:`loop-head`,children:[(0,L.jsx)(`h1`,{id:e,ref:h,tabIndex:-1,className:`disp loop-title rec-heading`,children:`PLOT BOARD`}),(0,L.jsx)(`button`,{type:`button`,className:`btn loop-room`,"data-kind":`quiet`,onClick:dt,children:`Room`})]}),(0,L.jsx)(`p`,{className:`rec-lead`,children:`The one current plan of the room. Every agent can read it; only FLIGHT, the boss, and you can write it. It is not the Flight Plan (tasks) or the Mission Log (what agents learned).`}),(0,L.jsxs)(`form`,{className:`module rec-form`,onSubmit:e=>{e.preventDefault(),b()},children:[(0,L.jsxs)(`div`,{className:`field`,children:[(0,L.jsx)(`label`,{htmlFor:`${e}-text`,children:`Plan`}),(0,L.jsx)(`textarea`,{id:`${e}-text`,className:`textarea rec-text`,rows:18,value:i,maxLength:te,spellCheck:!1,"aria-describedby":`${e}-meta`,disabled:n===null,onChange:e=>{g.current=e.target.value,a(e.target.value),f(``)}})]}),(0,L.jsx)(`p`,{className:`hint`,id:`${e}-meta`,children:n===null?`Loading…`:`${Dy(n,t,Date.now())} ${Oy(i)}.`}),y===`stale`&&n!==null&&(0,L.jsx)(`p`,{className:`flood rec-stale`,"data-tone":`amber`,role:`status`,children:Ay(n,t)}),c!==null&&y!==`stale`&&(0,L.jsx)(`p`,{className:`error`,role:`alert`,children:c}),(0,L.jsxs)(`div`,{className:`rec-actions`,children:[(0,L.jsx)(`button`,{type:`submit`,className:`btn`,"data-kind":`primary`,"data-size":`big`,"aria-disabled":p||y!==`edited`||void 0,children:p?`Saving…`:`Save`}),(0,L.jsx)(`button`,{type:`button`,className:`btn`,"data-size":`big`,"data-kind":`quiet`,"aria-disabled":n===null||y===`clean`||void 0,onClick:()=>{n!==null&&y!==`clean`&&(v(n),u(null),f(y===`stale`?`Loaded the latest.`:`Typing discarded.`))},children:y===`stale`?`Load the latest`:`Discard typing`})]})]}),(0,L.jsx)(`p`,{className:`sr-only`,role:`status`,children:d})]})}var Ny={room:`Room`,loop:`Loop`,party:`Party Line`,board:`Plot Board`,blackbox:`Black Box`,hangar:`Hangar`,recorder:`Recorder`,downlink:`Downlink`,window:`Launch Window`,plan:`Flight Plan`,log:`Mission Log`,livery:`Livery`,rules:`Flight Rules`};function Py({agents:e,legends:t,poll:n,unread:r,livery:i}){let a=[];for(let n of e){let e=Object.hasOwn(t,n.name)?t[n.name]:n.name.toUpperCase();a.push({id:`console:${n.name}`,label:`Open ${e}`,group:`Console`,also:`${n.name} console terminal`,act:{kind:`console`,name:n.name}})}for(let e of Object.keys(Ny))a.push({id:`view:${e}`,label:Ny[e],group:`View`,also:e===`rules`?`settings`:``,act:{kind:`view`,view:e}});a.push({id:`hire`,label:`Staff a console`,group:`Action`,also:`hire new agent`,act:{kind:`hire`}}),e.some(e=>e.boss)&&a.push({id:`brief`,label:`Brief FLIGHT`,group:`Action`,also:`mission message`,act:{kind:`brief`}}),Ea(n).includes(`poll`)&&xa(e).length>0&&a.push({id:`poll`,label:`Start a T-minus poll`,group:`Action`,also:`go no-go`,act:{kind:`poll`}}),r>0&&a.push({id:`read`,label:`Mark the Downlink read`,group:`Action`,also:`inbox all`,act:{kind:`read`}});for(let e of i.liveries)e.slug!==i.current&&a.push({id:`livery:${e.slug}`,label:`Apply livery ${e.name}`,group:`Action`,also:`theme look`,act:{kind:`livery`,slug:e.slug}});return a}function Fy(e,t){let n=e.toLowerCase().replace(/\s+/g,``),r=t.toLowerCase(),i=0,a=-1;for(let e of n){let t=r.indexOf(e,a+1);if(t<0)return null;t!==a+1&&(i+=t===0||/[^a-z0-9]/.test(r[t-1])?1:t-a+1),a=t}return i}function Iy(e,t){if(t.trim()===``)return[...e];let n=[];return e.forEach((e,r)=>{let i=[Fy(t,e.label),e.also===``?null:Fy(t,e.also)].map((e,t)=>e===null?1/0:e+t*3),a=Math.min(...i);a!==1/0&&n.push({c:e,cost:a,i:r})}),n.sort((e,t)=>e.cost-t.cost||e.i-t.i).map(e=>e.c)}var Ly=e=>e.key.toLowerCase()===`k`&&(e.metaKey||e.ctrlKey)&&!e.altKey&&!e.shiftKey;function Ry(e,t,n){return t===0?-1:n===`Home`?0:n===`End`?t-1:((e+(n===`ArrowDown`?1:n===`ArrowUp`?-1:0))%t+t)%t}var zy=`gonogo.commissioning`,By=[`away`,`note`,`livery`];function Vy(e){try{let t=e===null?[]:JSON.parse(e);return new Set(Array.isArray(t)?By.filter(e=>t.includes(e)):[])}catch{return new Set}}var Hy=()=>Vy(et(zy)),Uy=e=>tt(zy,e.size===0?null:JSON.stringify([...e])),Wy=(e,t)=>!t.has(`away`)&&e.every(e=>e.boss);function Gy(e,t,n,r){let i=e.find(e=>e.boss);return[{id:`flight`,done:i!==void 0&&(i.state===`idle`||i.state===`working`)},{id:`propellant`,done:Object.keys(t.room.limits).length>0},{id:`livery`,done:n.current!==`instrument`||r.has(`livery`)},{id:`note`,done:r.has(`note`)}]}var Ky={room:dt,loop:ft,party:yt,board:bt,blackbox:xt,hangar:St,recorder:Ct,downlink:ht,window:pt,plan:mt,log:gt,livery:_t,rules:vt};function qy(e,t){switch(e.kind){case`console`:return lt(e.name),null;case`view`:return Ky[e.view](),null;case`hire`:return Dt(),null;case`brief`:return(t?ft:dt)(),requestAnimationFrame(()=>document.querySelector(`.brief-input`)?.focus()),null;case`poll`:return In({});case`read`:return Ar();case`livery`:return ir(e.slug)}}function Jy({open:e,phone:t,onClose:n}){let r=(0,l.useId)(),i=(0,l.useRef)(null),a=(0,l.useRef)(null),o=(0,l.useRef)(!1),s=(0,l.useRef)(null),c=Tg(),{legends:u}=Eg(),d=N(e=>e.poll),f=N(e=>e.downlink.unread),p=N(e=>e.livery),[m,h]=(0,l.useState)(``),[g,_]=(0,l.useState)(0),{busy:v,error:y,run:b}=To(),x=(0,l.useMemo)(()=>Py({agents:c,legends:u,poll:d,unread:f,livery:p}),[c,u,d,f,p]),S=(0,l.useMemo)(()=>Iy(x,m),[x,m]),C=Math.min(g,S.length-1);(0,l.useEffect)(()=>{let t=i.current;t!==null&&(e&&!t.open?(a.current=document.activeElement instanceof HTMLElement?document.activeElement:null,o.current=!1,h(``),_(0),t.showModal(),s.current?.focus()):!e&&t.open&&t.close())},[e]),(0,l.useEffect)(()=>{document.getElementById(`${r}-${C}`)?.scrollIntoView({block:`nearest`})},[r,C]);let ee=()=>{o.current=!0,i.current?.close(),a.current?.focus()},w=e=>{let n=S[e];if(!(n===void 0||v)){if(n.act.kind===`poll`||n.act.kind===`read`||n.act.kind===`livery`){let e=n.act;b(async()=>{await qy(e,t),ee()})}else ee(),qy(n.act,t)}};return(0,L.jsxs)(`dialog`,{ref:i,className:`patch module`,"aria-labelledby":`${r}-title`,onClose:()=>{n(),o.current||a.current?.focus()},onClick:e=>e.target===i.current&&n(),children:[(0,L.jsxs)(`div`,{className:`patch-head`,children:[(0,L.jsx)(`h2`,{className:`label patch-title`,id:`${r}-title`,children:`PATCH PANEL`}),(0,L.jsx)(`button`,{type:`button`,className:`btn`,"data-kind":`quiet`,onClick:()=>i.current?.close(),children:`Close`})]}),(0,L.jsx)(`input`,{ref:s,className:`input patch-input`,type:`text`,role:`combobox`,"aria-label":`Console, view or action`,"aria-expanded":`true`,"aria-controls":`${r}-list`,"aria-activedescendant":C>=0?`${r}-${C}`:void 0,"aria-autocomplete":`list`,autoComplete:`off`,spellCheck:!1,placeholder:`Type a console, a view or an action`,value:m,onChange:e=>{h(e.target.value),_(0)},onKeyDown:e=>{e.key===`ArrowDown`||e.key===`ArrowUp`||(e.key===`Home`||e.key===`End`)&&e.ctrlKey?(e.preventDefault(),_(Ry(C,S.length,e.key))):e.key===`Enter`&&(e.preventDefault(),w(C))}}),(0,L.jsx)(`ul`,{className:`patch-list`,id:`${r}-list`,role:`listbox`,"aria-label":`Matches`,children:S.map((e,t)=>(0,L.jsxs)(`li`,{id:`${r}-${t}`,role:`option`,"aria-selected":t===C,className:`patch-option`,onClick:()=>w(t),onMouseMove:()=>t!==C&&_(t),children:[(0,L.jsx)(`span`,{className:`patch-label`,children:e.label}),(0,L.jsx)(`span`,{className:`patch-group`,"aria-hidden":`true`,children:e.group})]},e.id))}),(0,L.jsx)(`p`,{className:`hint patch-foot`,role:`status`,children:y===null?S.length===0?`Nothing matches.`:v?`Working…`:`${S.length} ${S.length===1?`match`:`matches`}. Arrows choose, Enter runs, Esc closes.`:``}),y!==null&&(0,L.jsx)(`p`,{className:`error`,role:`alert`,children:y})]})}var Yy=Hy(),Xy=new Set;function Zy(e){Yy=e,Uy(Yy);for(let e of[...Xy])e()}function Qy(){let[,e]=(0,l.useState)(0);return(0,l.useEffect)(()=>{let t=()=>e(e=>e+1);return Xy.add(t),()=>{Xy.delete(t)}},[]),Yy}var $y=e=>Zy(new Set([...Yy,e]));function eb(){let e=(0,l.useId)(),t=Tg(),{legends:n}=Eg(),r=N(e=>e.livery),i=(0,l.useRef)(null),a=Qy();return(0,l.useEffect)(()=>i.current?.focus(),[]),(0,L.jsxs)(`section`,{className:`rules`,"aria-labelledby":e,children:[(0,L.jsxs)(`header`,{className:`loop-head`,children:[(0,L.jsx)(`h1`,{id:e,ref:i,tabIndex:-1,className:`disp loop-title rules-title`,children:`FLIGHT RULES`}),(0,L.jsx)(`button`,{type:`button`,className:`btn loop-room`,"data-kind":`quiet`,onClick:dt,children:`Room`})]}),(0,L.jsx)(`p`,{className:`hint`,children:`Every setting of the room. All of them are kept on the server, so every device shows the same; each one also has its place in the room.`}),(0,L.jsxs)(`div`,{className:`rules-grid`,children:[(0,L.jsx)(Ao,{}),(0,L.jsx)(jo,{}),(0,L.jsxs)(`section`,{className:`module rules-block`,"aria-labelledby":`${e}-look`,children:[(0,L.jsx)(`h2`,{className:`label`,id:`${e}-look`,children:`LIVERY`}),(0,L.jsx)(`p`,{className:`rules-value`,children:Xh(r).name}),(0,L.jsx)(`p`,{className:`hint`,children:`The look of every device.`}),(0,L.jsx)(`button`,{type:`button`,className:`btn`,onClick:_t,children:`Choose a livery`})]}),(0,L.jsxs)(`section`,{className:`module rules-block`,"aria-labelledby":`${e}-window`,children:[(0,L.jsx)(`h2`,{className:`label`,id:`${e}-window`,children:`LAUNCH WINDOW`}),(0,L.jsx)(`p`,{className:`hint`,children:`Schedules, Uplink webhooks, Relay chat bridges and Docking with other stations.`}),(0,L.jsx)(`button`,{type:`button`,className:`btn`,onClick:pt,children:`Open Launch Window`})]})]}),(0,L.jsxs)(`section`,{className:`module rules-block`,"aria-labelledby":`${e}-consoles`,children:[(0,L.jsx)(`h2`,{className:`label`,id:`${e}-consoles`,children:`CONSOLES`}),(0,L.jsx)(`p`,{className:`hint`,children:`Each console's directory, role, engine, permission mode and payload are in its Edit form; its own Propellant limit is in its panel.`}),(0,L.jsx)(`ul`,{className:`rules-consoles`,children:t.map(e=>(0,L.jsxs)(`li`,{children:[(0,L.jsx)(`span`,{className:`rules-call`,children:ua(n,e.name)}),(0,L.jsx)(`span`,{className:`hint rules-name`,children:e.name}),(0,L.jsx)(`button`,{type:`button`,className:`btn`,"data-kind":`quiet`,"aria-label":`Edit ${ua(n,e.name)}`,onClick:()=>Ot(e.name),children:`Edit`})]},e.name))})]}),(0,L.jsxs)(`section`,{className:`module rules-block`,"aria-labelledby":`${e}-browser`,children:[(0,L.jsx)(`h2`,{className:`label`,id:`${e}-browser`,children:`THIS BROWSER`}),(0,L.jsx)(`p`,{className:`hint`,children:`The Commissioning checklist shows on an empty room until you put it away. Only this browser remembers that.`}),(0,L.jsx)(`button`,{type:`button`,className:`btn`,"aria-disabled":a.size===0||void 0,onClick:()=>a.size>0&&Zy(new Set),children:`Show Commissioning again`})]})]})}var tb={flight:{title:`Staff FLIGHT`,detail:`FLIGHT is created at the first start. It is staffed once it is up: answer a startup question in its terminal if it asks one.`},propellant:{title:`Set a Propellant limit`,detail:`A token budget for the room. Over it, Redline stops the agents.`},livery:{title:`Pick a livery`,detail:`The look every device shows.`},note:{title:`Read the security note`,detail:``}};function nb(){let e=(0,l.useId)(),t=Tg(),n=N(e=>e.propellant),r=N(e=>e.livery),i=Qy();if(!Wy(t,i))return null;let a=t.find(e=>e.boss),o=Gy(t,n,r,i),s={flight:a===void 0?null:(0,L.jsx)(`button`,{type:`button`,className:`btn`,onClick:()=>lt(a.name),children:`Open FLIGHT`}),propellant:(0,L.jsx)(`button`,{type:`button`,className:`btn`,onClick:vt,children:`Flight Rules`}),livery:(0,L.jsx)(`button`,{type:`button`,className:`btn`,onClick:()=>{$y(`livery`),_t()},children:`Livery`}),note:null};return(0,L.jsxs)(`section`,{className:`module commission`,"aria-labelledby":`${e}-title`,children:[(0,L.jsxs)(`div`,{className:`commission-head`,children:[(0,L.jsx)(`h2`,{className:`label`,id:`${e}-title`,children:`COMMISSIONING`}),(0,L.jsx)(`span`,{className:`hint`,children:`${o.filter(e=>e.done).length} of ${o.length} done`}),(0,L.jsx)(`button`,{type:`button`,className:`btn`,"data-kind":`quiet`,onClick:()=>{$y(`away`),document.querySelector(`.matrix button`)?.focus()},children:`Put away`})]}),(0,L.jsx)(`ol`,{className:`commission-steps`,children:o.map(e=>(0,L.jsxs)(`li`,{"data-done":e.done||void 0,children:[(0,L.jsx)(`span`,{className:`led`,"data-on":e.done,style:e.done?{"--led":`var(--go)`}:void 0,"aria-hidden":`true`}),(0,L.jsxs)(`div`,{className:`commission-text`,children:[(0,L.jsxs)(`h3`,{className:`commission-title`,children:[tb[e.id].title,(0,L.jsx)(`span`,{className:`sr-only`,children:e.done?`, done`:`, to do`})]}),e.id===`note`?(0,L.jsxs)(`details`,{className:`commission-note`,onToggle:e=>e.currentTarget.open&&$y(`note`),children:[(0,L.jsx)(`summary`,{children:`Show the note`}),(0,L.jsx)(`p`,{children:`The address with #token= is the password of this room, and the server runs shells as you. Keep gonogo on 127.0.0.1; to reach it from elsewhere use HTTPS or a private network.`}),(0,L.jsx)(`p`,{children:`An agent in bypassPermissions mode runs as your user and can read every file you can, the secrets gonogo keeps among them. Dock only with people you trust: their agents can write to yours.`})]}):(0,L.jsx)(`p`,{className:`hint`,children:tb[e.id].detail})]}),s[e.id]]},e.id))})]})}var rb=/^(?:\s*(?:re|fwd?)\s*:)*/i,ib=e=>e.replace(rb,``).trim(),ab=e=>JSON.stringify([e.from,e.to].sort().concat(ib(e.subject).replace(/\s+/g,` `).toLowerCase()));function ob(e){let t=new Map,n=new Map,r=new Map,i=new Set;for(let a of[...e].reverse()){let e=ab(a),o=a.inReplyTo===null?void 0:n.get(a.inReplyTo),s=(o!==void 0&&(a.from===`user`||a.from===o.from||a.from===o.to)?t.get(o.id):void 0)??r.get(e);if(s===void 0){let e=ib(a.subject);s={id:a.id,subject:e,title:e===``?wi(a):e,who:[],items:[],last:a}}s.items.push(a),s.last=a;for(let e of[a.from,a.to])s.who.includes(e)||s.who.push(e);t.set(a.id,s),n.set(a.id,a),r.has(e)||r.set(e,s),i.delete(s),i.add(s)}return[...i].reverse()}var sb=e=>e!==`user`&&!e.includes(`@`);function cb(e){let t=e.who.filter(sb),n=e.last.to;for(let t=e.items.length-1;t>=0;--t){let r=e.items[t];if(r!==void 0&&r.from!==`user`){n=r.from;break}}return t.includes(n)?[n,...t.filter(e=>e!==n)]:t}var lb=(e,t)=>({id:e.last.id,from:t,subject:e.subject}),ub=100,db=e=>`${e} ${e===1?`message`:`messages`}`;function fb({item:e,agents:t,now:n}){let r=Si(e),i=Ti(e);return(0,L.jsxs)(`li`,{className:`pl-msg`,"data-from-you":e.from===`user`?``:void 0,children:[(0,L.jsxs)(`p`,{className:`pl-msg-head`,children:[(0,L.jsx)(`span`,{className:`loop-route`,children:Ci(e,t)}),(0,L.jsx)(`span`,{className:`loop-time`,children:ra(e.at,n)}),r.tone!==`quiet`&&(0,L.jsx)(`span`,{className:`chip`,"data-tone":r.tone,children:r.text})]}),i!==``&&r.tone!==`quiet`&&(0,L.jsx)(`p`,{className:`loop-note`,children:i}),(0,L.jsxs)(`p`,{className:`loop-body`,children:[e.body,e.truncated?` …(cut)`:``]})]})}function pb({thread:e,agents:t,now:n}){let r=(0,l.useId)(),i=(0,l.useMemo)(()=>cb(e),[e]),[a,o]=(0,l.useState)(null),s=a!==null&&i.includes(a)?a:i[0]??null;return(0,L.jsxs)(`div`,{className:`pl-open`,children:[(0,L.jsx)(`ol`,{className:`pl-msgs`,children:e.items.map(e=>(0,L.jsx)(fb,{item:e,agents:t,now:n},e.id))}),s===null?(0,L.jsx)(`p`,{className:`hint`,children:`This thread is with another station. You cannot write to it from here.`}):(0,L.jsxs)(`div`,{className:`pl-answer`,children:[i.length>1&&(0,L.jsxs)(`div`,{className:`pl-to`,children:[(0,L.jsx)(`label`,{className:`legend`,htmlFor:`${r}-to`,children:`Send to`}),(0,L.jsx)(`select`,{id:`${r}-to`,className:`input`,value:s,onChange:e=>o(e.target.value),children:i.map(e=>(0,L.jsx)(`option`,{value:e,children:R(e,t)},e))})]}),(0,L.jsx)(ji,{item:lb(e,s),agents:t},s)]})]})}function mb(){let e=(0,l.useId)(),t=N(e=>e.activity),n=N(e=>e.agents),[r,i]=(0,l.useState)(null),a=(0,l.useRef)(null),o=(0,l.useMemo)(()=>ob(t),[t]),s=o.slice(0,ub),c=(0,l.useMemo)(()=>Date.now(),[t]);return(0,l.useEffect)(()=>a.current?.focus(),[]),(0,L.jsxs)(`section`,{className:`pl`,"aria-labelledby":e,children:[(0,L.jsxs)(`header`,{className:`loop-head`,children:[(0,L.jsx)(`h1`,{id:e,ref:a,tabIndex:-1,className:`disp loop-title pl-heading`,children:`PARTY LINE`}),(0,L.jsxs)(`span`,{className:`chip`,"data-tone":`quiet`,children:[o.length,` `,o.length===1?`thread`:`threads`]}),(0,L.jsx)(`button`,{type:`button`,className:`btn loop-room`,"data-kind":`quiet`,onClick:dt,children:`Room`})]}),(0,L.jsxs)(`div`,{className:`pl-scroll module`,children:[s.length===0?(0,L.jsx)(`p`,{className:`loop-empty`,children:`No messages yet. Conversations between agents, and with you, appear here.`}):(0,L.jsx)(`ol`,{className:`pl-list`,children:s.map(e=>{let t=r===e.id,a=Si(e.last);return(0,L.jsxs)(`li`,{className:`pl-row`,children:[(0,L.jsxs)(`button`,{type:`button`,className:`pl-head`,"aria-expanded":t,onClick:()=>i(t?null:e.id),children:[(0,L.jsx)(`span`,{className:`loop-time`,children:ra(e.last.at,c)}),(0,L.jsx)(`span`,{className:`loop-route`,children:e.who.map(e=>R(e,n)).join(` · `)}),(0,L.jsxs)(`span`,{className:`pl-text`,children:[(0,L.jsx)(`span`,{className:`loop-subject`,children:e.title}),(0,L.jsx)(`span`,{className:`loop-note`,children:db(e.items.length)})]}),a.tone!==`quiet`&&(0,L.jsx)(`span`,{className:`chip pl-chip`,"data-tone":a.tone,children:a.text})]}),t&&(0,L.jsx)(pb,{thread:e,agents:n,now:c})]},e.id)})}),o.length>s.length&&(0,L.jsxs)(`p`,{className:`hint pl-more`,children:[`The `,ub,` threads with the newest messages are shown, of `,o.length,`.`]})]})]})}var hb=`data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%20360.5%2062'%20role='img'%20aria-label='gonogo'%3e%3ctitle%3egonogo%3c/title%3e%3cg%20transform='translate(-2.75%20-22)%20scale(1.38)'%3e%3crect%20x='2'%20y='20'%20width='28'%20height='28'%20rx='7'%20fill='%23141517'%20class='goke'/%3e%3crect%20x='4'%20y='22'%20width='24'%20height='24'%20rx='5'%20fill='%2326272b'%20class='gok'/%3e%3ccircle%20cx='16'%20cy='34'%20r='6'%20fill='%237cc493'/%3e%3crect%20x='34'%20y='16'%20width='28'%20height='32'%20rx='7'%20fill='%23b1aea6'/%3e%3crect%20x='36'%20y='18'%20width='24'%20height='24'%20rx='5'%20fill='%23faf9f6'/%3e%3ccircle%20cx='48'%20cy='30'%20r='6'%20fill='%23c2414b'/%3e%3c/g%3e%3cg%20fill='%2326272b'%3e%3ccircle%20cx='113.5'%20cy='4'%20r='4'/%3e%3ccircle%20cx='122.5'%20cy='4'%20r='4'/%3e%3ccircle%20cx='131.5'%20cy='4'%20r='4'/%3e%3ccircle%20cx='104.5'%20cy='13'%20r='4'/%3e%3ccircle%20cx='131.5'%20cy='13'%20r='4'/%3e%3ccircle%20cx='104.5'%20cy='22'%20r='4'/%3e%3ccircle%20cx='131.5'%20cy='22'%20r='4'/%3e%3ccircle%20cx='104.5'%20cy='31'%20r='4'/%3e%3ccircle%20cx='131.5'%20cy='31'%20r='4'/%3e%3ccircle%20cx='113.5'%20cy='40'%20r='4'/%3e%3ccircle%20cx='122.5'%20cy='40'%20r='4'/%3e%3ccircle%20cx='131.5'%20cy='40'%20r='4'/%3e%3ccircle%20cx='131.5'%20cy='49'%20r='4'/%3e%3ccircle%20cx='104.5'%20cy='58'%20r='4'/%3e%3ccircle%20cx='113.5'%20cy='58'%20r='4'/%3e%3ccircle%20cx='122.5'%20cy='58'%20r='4'/%3e%3ccircle%20cx='158.5'%20cy='4'%20r='4'/%3e%3ccircle%20cx='167.5'%20cy='4'%20r='4'/%3e%3ccircle%20cx='149.5'%20cy='13'%20r='4'/%3e%3ccircle%20cx='176.5'%20cy='13'%20r='4'/%3e%3ccircle%20cx='149.5'%20cy='22'%20r='4'/%3e%3ccircle%20cx='176.5'%20cy='22'%20r='4'/%3e%3ccircle%20cx='149.5'%20cy='31'%20r='4'/%3e%3ccircle%20cx='176.5'%20cy='31'%20r='4'/%3e%3ccircle%20cx='158.5'%20cy='40'%20r='4'/%3e%3ccircle%20cx='167.5'%20cy='40'%20r='4'/%3e%3ccircle%20cx='194.5'%20cy='4'%20r='4'/%3e%3ccircle%20cx='203.5'%20cy='4'%20r='4'/%3e%3ccircle%20cx='212.5'%20cy='4'%20r='4'/%3e%3ccircle%20cx='194.5'%20cy='13'%20r='4'/%3e%3ccircle%20cx='221.5'%20cy='13'%20r='4'/%3e%3ccircle%20cx='194.5'%20cy='22'%20r='4'/%3e%3ccircle%20cx='221.5'%20cy='22'%20r='4'/%3e%3ccircle%20cx='194.5'%20cy='31'%20r='4'/%3e%3ccircle%20cx='221.5'%20cy='31'%20r='4'/%3e%3ccircle%20cx='194.5'%20cy='40'%20r='4'/%3e%3ccircle%20cx='221.5'%20cy='40'%20r='4'/%3e%3ccircle%20cx='248.5'%20cy='4'%20r='4'/%3e%3ccircle%20cx='257.5'%20cy='4'%20r='4'/%3e%3ccircle%20cx='239.5'%20cy='13'%20r='4'/%3e%3ccircle%20cx='266.5'%20cy='13'%20r='4'/%3e%3ccircle%20cx='239.5'%20cy='22'%20r='4'/%3e%3ccircle%20cx='266.5'%20cy='22'%20r='4'/%3e%3ccircle%20cx='239.5'%20cy='31'%20r='4'/%3e%3ccircle%20cx='266.5'%20cy='31'%20r='4'/%3e%3ccircle%20cx='248.5'%20cy='40'%20r='4'/%3e%3ccircle%20cx='257.5'%20cy='40'%20r='4'/%3e%3ccircle%20cx='293.5'%20cy='4'%20r='4'/%3e%3ccircle%20cx='302.5'%20cy='4'%20r='4'/%3e%3ccircle%20cx='311.5'%20cy='4'%20r='4'/%3e%3ccircle%20cx='284.5'%20cy='13'%20r='4'/%3e%3ccircle%20cx='311.5'%20cy='13'%20r='4'/%3e%3ccircle%20cx='284.5'%20cy='22'%20r='4'/%3e%3ccircle%20cx='311.5'%20cy='22'%20r='4'/%3e%3ccircle%20cx='284.5'%20cy='31'%20r='4'/%3e%3ccircle%20cx='311.5'%20cy='31'%20r='4'/%3e%3ccircle%20cx='293.5'%20cy='40'%20r='4'/%3e%3ccircle%20cx='302.5'%20cy='40'%20r='4'/%3e%3ccircle%20cx='311.5'%20cy='40'%20r='4'/%3e%3ccircle%20cx='311.5'%20cy='49'%20r='4'/%3e%3ccircle%20cx='284.5'%20cy='58'%20r='4'/%3e%3ccircle%20cx='293.5'%20cy='58'%20r='4'/%3e%3ccircle%20cx='302.5'%20cy='58'%20r='4'/%3e%3ccircle%20cx='338.5'%20cy='4'%20r='4'/%3e%3ccircle%20cx='347.5'%20cy='4'%20r='4'/%3e%3ccircle%20cx='329.5'%20cy='13'%20r='4'/%3e%3ccircle%20cx='356.5'%20cy='13'%20r='4'/%3e%3ccircle%20cx='329.5'%20cy='22'%20r='4'/%3e%3ccircle%20cx='356.5'%20cy='22'%20r='4'/%3e%3ccircle%20cx='329.5'%20cy='31'%20r='4'/%3e%3ccircle%20cx='356.5'%20cy='31'%20r='4'/%3e%3ccircle%20cx='338.5'%20cy='40'%20r='4'/%3e%3ccircle%20cx='347.5'%20cy='40'%20r='4'/%3e%3c/g%3e%3c/svg%3e`;function gb(){let e=N(e=>e.connection);return(0,L.jsxs)(`span`,{className:`lamp`,role:`status`,"data-link":e===`open`?`up`:e===`connecting`?`wait`:`down`,children:[(0,L.jsx)(`span`,{className:`led`,"data-on":e===`open`,"data-blink":e===`connecting`,"aria-hidden":`true`}),e===`open`?`LINK UP`:e===`connecting`?`CONNECTING`:`LINK DOWN`]})}function _b(){let e=Bs(N(e=>e.tasks));return e.doing+e.blocked===0?null:(0,L.jsx)(`span`,{className:`chip`,"data-tone":e.blocked>0?`amber`:`quiet`,"aria-label":Vs(e),children:e.doing+e.blocked})}function vb(){let e=N(e=>e.downlink.unread);return e===0?null:(0,L.jsx)(`span`,{className:`chip`,"data-tone":`amber`,"aria-hidden":`true`,children:e})}var yb=e=>e===0?`Downlink`:`Downlink, ${Yi(e)}`;function bb({phone:e,onPanel:t}){let n=Tg().find(e=>e.boss)?.dir??null,r=N(e=>e.downlink.unread),i=N(e=>e.view);return(0,L.jsxs)(`header`,{className:`topbar`,children:[(0,L.jsxs)(`h1`,{className:`mark`,"aria-label":`gonogo`,children:[(0,L.jsx)(`img`,{className:`mark-name`,src:hb,alt:``,"aria-hidden":`true`}),(0,L.jsxs)(`span`,{className:`label mark-unit`,"aria-hidden":`true`,children:[`GN-1`,(0,L.jsx)(`span`,{className:`mark-unit-long`,children:` · OPERATIONS UNIT`})]})]}),!e&&n!==null&&(0,L.jsx)(`span`,{className:`topbar-dir`,title:n,children:n}),(0,L.jsx)(`span`,{className:`topbar-grow`}),(0,L.jsx)(gb,{}),!e&&(0,L.jsx)(`button`,{type:`button`,className:`btn`,"data-kind":`quiet`,"aria-current":i===`loop`?`page`:void 0,onClick:ft,children:`Loop`}),!e&&(0,L.jsxs)(`button`,{type:`button`,className:`btn`,"data-kind":`quiet`,"aria-label":yb(r),"aria-current":i===`downlink`?`page`:void 0,onClick:ht,children:[`Downlink`,(0,L.jsx)(vb,{})]}),!e&&(0,L.jsx)(`button`,{type:`button`,className:`btn`,"data-kind":`quiet`,"aria-current":i===`window`?`page`:void 0,onClick:pt,children:`Launch Window`}),!e&&(0,L.jsxs)(`button`,{type:`button`,className:`btn`,"data-kind":`quiet`,"aria-current":i===`plan`?`page`:void 0,onClick:mt,children:[`Flight Plan`,(0,L.jsx)(_b,{})]}),!e&&(0,L.jsx)(`button`,{type:`button`,className:`btn`,"data-kind":`quiet`,"aria-current":i===`log`?`page`:void 0,onClick:gt,children:`Mission Log`}),!e&&(0,L.jsx)(`button`,{type:`button`,className:`btn topbar-plus`,"data-kind":`quiet`,"aria-label":`Patch Panel`,"aria-keyshortcuts":`Meta+K Control+K`,title:`Patch Panel (Cmd+K or Ctrl+K)`,onClick:t,children:(0,L.jsx)(`span`,{className:`patch-mark`,"aria-hidden":`true`})}),!e&&(0,L.jsx)(`button`,{type:`button`,className:`btn topbar-plus`,"data-kind":`quiet`,"aria-label":`Flight Rules`,title:`Flight Rules`,"aria-current":i===`rules`?`page`:void 0,onClick:vt,children:(0,L.jsx)(`span`,{className:`rules-mark`,"aria-hidden":`true`})}),(0,L.jsx)(`button`,{type:`button`,className:`btn topbar-plus`,"data-kind":`quiet`,"aria-label":`Livery`,title:`Livery`,"aria-current":i===`livery`?`page`:void 0,onClick:_t,children:(0,L.jsx)(`span`,{className:`livery-mark`,"aria-hidden":`true`})}),e?(0,L.jsx)(`button`,{type:`button`,className:`btn topbar-plus`,"data-kind":`primary`,"aria-label":`Staff a console`,onClick:()=>Dt(),children:`+`}):(0,L.jsx)(`button`,{type:`button`,className:`btn`,"data-kind":`primary`,onClick:()=>Dt(),children:`+ Staff a console`})]})}function xb({onPanel:e}){let t=N(e=>e.view),n=N(e=>e.downlink.unread),r=Vs(Bs(N(e=>e.tasks)));return(0,L.jsxs)(`nav`,{className:`phone-bar`,"aria-label":`Sections`,children:[(0,L.jsx)(`button`,{type:`button`,className:`btn`,"data-kind":t===`room`?`primary`:void 0,"aria-current":t===`room`?`page`:void 0,onClick:dt,children:`Room`}),(0,L.jsx)(`button`,{type:`button`,className:`btn`,"data-kind":t===`loop`?`primary`:void 0,"aria-current":t===`loop`?`page`:void 0,onClick:ft,children:`Loop`}),(0,L.jsx)(`button`,{type:`button`,className:`btn`,onClick:()=>{ft(),requestAnimationFrame(()=>document.querySelector(`.brief-input`)?.focus())},children:`Brief`}),(0,L.jsxs)(`button`,{type:`button`,className:`btn`,"data-kind":t===`downlink`?`primary`:void 0,"aria-label":yb(n),"aria-current":t===`downlink`?`page`:void 0,onClick:ht,children:[`Down`,(0,L.jsx)(vb,{})]}),(0,L.jsx)(`button`,{type:`button`,className:`btn`,"data-kind":t===`window`?`primary`:void 0,"aria-label":`Launch Window`,"aria-current":t===`window`?`page`:void 0,onClick:pt,children:`Launch`}),(0,L.jsxs)(`button`,{type:`button`,className:`btn`,"data-kind":t===`plan`?`primary`:void 0,"aria-label":r===``?`Flight Plan`:`Flight Plan, ${r}`,"aria-current":t===`plan`?`page`:void 0,onClick:mt,children:[`Plan`,(0,L.jsx)(_b,{})]}),(0,L.jsx)(`button`,{type:`button`,className:`btn`,"data-kind":t===`log`?`primary`:void 0,"aria-label":`Mission Log`,"aria-current":t===`log`?`page`:void 0,onClick:gt,children:`Log`}),(0,L.jsx)(`button`,{type:`button`,className:`btn`,"aria-label":`Patch Panel`,onClick:e,children:`Patch`})]})}function Sb(){return(0,L.jsx)(`main`,{className:`system`,"data-system":`nogo`,children:(0,L.jsxs)(`section`,{className:`system-slab module flood`,"data-tone":`nogo`,"aria-label":`Not signed in`,children:[(0,L.jsxs)(`p`,{className:`label system-label`,children:[(0,L.jsx)(`span`,{className:`led`,"data-on":`true`,"aria-hidden":`true`}),`NOT SIGNED IN`]}),(0,L.jsx)(`h1`,{className:`disp system-word`,children:`NO-GO`}),(0,L.jsx)(`p`,{className:`system-lead`,children:`This tab has no key.`}),(0,L.jsx)(`p`,{className:`system-text`,children:`Open the address gonogo printed when it started. The part after # is your key.`}),(0,L.jsx)(`p`,{className:`lcd system-address`,children:`${location.origin}/#token=[YOUR TOKEN]`})]})})}function Cb(){return(0,L.jsx)(`main`,{className:`system`,children:(0,L.jsxs)(`section`,{className:`system-slab module`,"aria-label":`Loading`,children:[(0,L.jsx)(`p`,{className:`label system-label`,children:`LOADING`}),(0,L.jsx)(`h1`,{className:`disp system-word`,"data-ghost":`true`,children:`STANDBY`}),(0,L.jsxs)(`div`,{className:`system-steps`,"aria-hidden":`true`,children:[(0,L.jsx)(`span`,{}),(0,L.jsx)(`span`,{}),(0,L.jsx)(`span`,{})]}),(0,L.jsx)(`p`,{className:`system-lead`,role:`status`,children:`Bringing up the room.`}),(0,L.jsx)(`p`,{className:`system-text muted`,children:`No consoles are drawn until the server says who is staffed.`})]})})}var wb=e=>`Trying again in ${se[Math.min(e,se.length-1)]/1e3} s, attempt ${e}.`;function Tb(){let e=N(e=>e.failedAttempts);return(0,L.jsx)(`main`,{className:`system`,children:(0,L.jsxs)(`section`,{className:`system-slab module flood`,"data-tone":`amber`,"aria-label":`Server gone`,children:[(0,L.jsxs)(`p`,{className:`label system-label`,children:[(0,L.jsx)(`span`,{className:`led`,"data-on":`true`,"data-blink":`true`,"aria-hidden":`true`}),`LOSS OF SIGNAL`]}),(0,L.jsx)(`h1`,{className:`disp system-word`,children:`LOS`}),(0,L.jsx)(`p`,{className:`system-lead`,role:`status`,children:`The server stopped answering.`}),(0,L.jsx)(`p`,{className:`system-text`,children:`Is gonogo still running? ${wb(e)}`}),(0,L.jsx)(`div`,{children:(0,L.jsx)(`button`,{type:`button`,className:`btn`,"data-kind":`primary`,"data-size":`big`,onClick:Zr,children:`Retry now`})})]})})}function Eb(){return N(e=>e.connection===`reconnecting`&&e.failedAttempts>=3)?(0,L.jsxs)(`p`,{className:`gone-strip flood`,"data-tone":`amber`,role:`status`,children:[(0,L.jsx)(`span`,{className:`led`,"data-on":`true`,"data-blink":`true`,"aria-hidden":`true`}),ai,` `,(0,L.jsx)(`button`,{type:`button`,className:`btn`,"data-kind":`quiet`,onClick:Zr,children:`Retry now`})]}):null}var Db=`gonogo.rollout.dismissed`;function Ob(){let e=N(e=>e.rollout),[t,n]=(0,l.useState)(()=>et(Db)),[r,i]=(0,l.useState)(null),a=(0,l.useRef)(null);if(e===null||!e.newer||e.latest===null||t===e.latest)return null;let{latest:o,command:s}=e;return(0,L.jsxs)(`aside`,{className:`rollout-strip`,"aria-label":`Update`,children:[(0,L.jsxs)(`span`,{children:[`gonogo `,o,` is out (this is `,e.current,`). To update, run:`]}),(0,L.jsx)(`code`,{ref:a,children:s}),(0,L.jsx)(`button`,{type:`button`,className:`btn`,"data-kind":`quiet`,onClick:()=>void _s(s).then(e=>{i(e),!e&&a.current!==null&&window.getSelection()?.selectAllChildren(a.current)}),children:r===null?`Copy`:r?`Copied`:`Not copied`}),(0,L.jsx)(`button`,{type:`button`,className:`btn`,"data-kind":`quiet`,onClick:()=>{tt(Db,o),n(o)},children:`Dismiss`})]})}function kb(){let e=Tg(),{legends:t}=Eg(),n=N(e=>e.downlink.unread),r=N(e=>e.poll),i=N(e=>e.governor.limit),a=N(e=>e.relief.length),[o,s]=(0,l.useState)({n:0,text:``}),[c]=(0,l.useState)(()=>fo(e=>s(t=>({n:t.n+1,text:e}))));return(0,l.useEffect)(()=>c.update({agents:e,unread:n,poll:r,limit:i,relief:a},t),[c,e,n,r,i,a,t]),(0,l.useEffect)(()=>(c.resume(),()=>c.stop()),[c]),(0,L.jsx)(`p`,{className:`sr-only`,role:`status`,"aria-live":`polite`,children:(0,L.jsx)(`span`,{children:o.text},o.n)})}function Ab({phone:e}){let t=N(e=>e.form),n=N(e=>e.view),r=N(e=>e.activity),i=N(e=>e.agents),a=Tg();return t===null?n===`loop`?(0,L.jsx)(Ni,{items:r,agents:i,boss:a.find(e=>e.boss)??null,onSelect:lt,onClose:dt}):n===`window`?(0,L.jsx)(Bv,{}):n===`plan`?(0,L.jsx)(Zg,{}):n===`downlink`?(0,L.jsx)(Fo,{}):n===`log`?(0,L.jsx)(hy,{}):n===`livery`?(0,L.jsx)(Uv,{}):n===`hangar`?(0,L.jsx)(__,{}):n===`recorder`?(0,L.jsx)(Ty,{}):n===`board`?(0,L.jsx)(My,{}):n===`blackbox`?(0,L.jsx)(Ui,{}):n===`rules`?(0,L.jsx)(eb,{}):n===`party`?(0,L.jsx)(mb,{}):e?(0,L.jsxs)(`main`,{className:`room room-phone`,children:[(0,L.jsx)(Mo,{}),(0,L.jsx)(Fg,{phone:!0}),(0,L.jsx)(nb,{}),(0,L.jsx)(Ag,{phone:!0})]}):(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(Mo,{}),(0,L.jsxs)(`main`,{className:`room`,children:[(0,L.jsxs)(`div`,{className:`room-main`,children:[(0,L.jsx)(nb,{}),(0,L.jsx)(Ag,{phone:!1}),(0,L.jsx)(Ig,{})]}),(0,L.jsx)(Hg,{})]})]}):(0,L.jsx)(pv,{})}function jb(){let e=wg(),t=N(e=>e.form),n=N(e=>e.consoleOpen),r=N(e=>e.view),[i,a]=(0,l.useState)(!1);(0,l.useEffect)(()=>{let e=e=>{Ly(e)&&(e.preventDefault(),a(!0))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[]);let o=(0,L.jsx)(Jy,{open:i,phone:e,onClose:()=>a(!1)});return e&&n&&t===null&&r===`room`?(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(Kg,{}),(0,L.jsx)(kb,{}),o]}):(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(bb,{phone:e,onPanel:()=>a(!0)}),(0,L.jsx)(Eb,{}),(0,L.jsx)(Ob,{}),(0,L.jsx)(Ab,{phone:e}),e&&t===null&&(0,L.jsx)(xb,{onPanel:()=>a(!0)}),(0,L.jsx)(kb,{}),o]})}function Mb(){let e=N(e=>e.connection),t=N(e=>e.info===null),n=N(e=>e.failedAttempts>=3);return(0,L.jsx)(`div`,{className:`app`,children:e===`unauthorized`?(0,L.jsx)(Sb,{}):t?n?(0,L.jsx)(Tb,{}):(0,L.jsx)(Cb,{}):(0,L.jsx)(jb,{})})}Xr(),og();var Nb=document.getElementById(`root`);if(Nb===null)throw Error(`index.html has no #root element`);(0,u.createRoot)(Nb).render((0,L.jsx)(l.StrictMode,{children:(0,L.jsx)(Mb,{})}));
|