@gbasin/agentboard-darwin-x64 0.17.0 → 0.17.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,t)=>()=>(e&&(t=e(e=0)),t),s=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),c=(e,n)=>{let r={};for(var i in e)t(r,i,{get:e[i],enumerable:!0});return n||t(r,Symbol.toStringTag,{value:`Module`}),r},l=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},u=(n,r,a)=>(a=n==null?{}:e(i(n)),l(r||!n||!n.__esModule?t(a,`default`,{value:n,enumerable:!0}):a,n)),d=e=>a.call(e,`module.exports`)?e[`module.exports`]:l(t({},`__esModule`,{value:!0}),e);(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),e.crossOrigin===`use-credentials`?t.credentials=`include`:e.crossOrigin===`anonymous`?t.credentials=`omit`:t.credentials=`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var f=s((e=>{var t=Symbol.for(`react.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.provider`),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.iterator;function p(e){return typeof e!=`object`||!e?null:(e=f&&e[f]||e[`@@iterator`],typeof e==`function`?e:null)}var m={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},h=Object.assign,g={};function _(e,t,n){this.props=e,this.context=t,this.refs=g,this.updater=n||m}_.prototype.isReactComponent={},_.prototype.setState=function(e,t){if(typeof e!=`object`&&typeof e!=`function`&&e!=null)throw Error(`setState(...): 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`)},_.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,`forceUpdate`)};function v(){}v.prototype=_.prototype;function y(e,t,n){this.props=e,this.context=t,this.refs=g,this.updater=n||m}var b=y.prototype=new v;b.constructor=y,h(b,_.prototype),b.isPureReactComponent=!0;var x=Array.isArray,S=Object.prototype.hasOwnProperty,C={current:null},w={key:!0,ref:!0,__self:!0,__source:!0};function T(e,n,r){var i,a={},o=null,s=null;if(n!=null)for(i in n.ref!==void 0&&(s=n.ref),n.key!==void 0&&(o=``+n.key),n)S.call(n,i)&&!w.hasOwnProperty(i)&&(a[i]=n[i]);var c=arguments.length-2;if(c===1)a.children=r;else if(1<c){for(var l=Array(c),u=0;u<c;u++)l[u]=arguments[u+2];a.children=l}if(e&&e.defaultProps)for(i in c=e.defaultProps,c)a[i]===void 0&&(a[i]=c[i]);return{$$typeof:t,type:e,key:o,ref:s,props:a,_owner:C.current}}function E(e,n){return{$$typeof:t,type:e.type,key:n,ref:e.ref,props:e.props,_owner:e._owner}}function D(e){return typeof e==`object`&&!!e&&e.$$typeof===t}function O(e){var t={"=":`=0`,":":`=2`};return`$`+e.replace(/[=:]/g,function(e){return t[e]})}var k=/\/+/g;function A(e,t){return typeof e==`object`&&e&&e.key!=null?O(``+e.key):t.toString(36)}function j(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`string`:case`number`:c=!0;break;case`object`:switch(e.$$typeof){case t:case n:c=!0}}if(c)return c=e,o=o(c),e=a===``?`.`+A(c,0):a,x(o)?(i=``,e!=null&&(i=e.replace(k,`$&/`)+`/`),j(o,r,i,``,function(e){return e})):o!=null&&(D(o)&&(o=E(o,i+(!o.key||c&&c.key===o.key?``:(``+o.key).replace(k,`$&/`)+`/`)+e)),r.push(o)),1;if(c=0,a=a===``?`.`:a+`:`,x(e))for(var l=0;l<e.length;l++){s=e[l];var u=a+A(s,l);c+=j(s,r,i,u,o)}else if(u=p(e),typeof u==`function`)for(e=u.call(e),l=0;!(s=e.next()).done;)s=s.value,u=a+A(s,l++),c+=j(s,r,i,u,o);else if(s===`object`)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 M(e,t,n){if(e==null)return e;var r=[],i=0;return j(e,r,``,``,function(e){return t.call(n,e,i++)}),r}function N(e){if(e._status===-1){var t=e._result;t=t(),t.then(function(t){(e._status===0||e._status===-1)&&(e._status=1,e._result=t)},function(t){(e._status===0||e._status===-1)&&(e._status=2,e._result=t)}),e._status===-1&&(e._status=0,e._result=t)}if(e._status===1)return e._result.default;throw e._result}var P={current:null},F={transition:null},I={ReactCurrentDispatcher:P,ReactCurrentBatchConfig:F,ReactCurrentOwner:C};function L(){throw Error(`act(...) is not supported in production builds of React.`)}e.Children={map:M,forEach:function(e,t,n){M(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return M(e,function(){t++}),t},toArray:function(e){return M(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.Component=_,e.Fragment=r,e.Profiler=a,e.PureComponent=y,e.StrictMode=i,e.Suspense=l,e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=I,e.act=L,e.cloneElement=function(e,n,r){if(e==null)throw Error(`React.cloneElement(...): The argument must be a React element, but you passed `+e+`.`);var i=h({},e.props),a=e.key,o=e.ref,s=e._owner;if(n!=null){if(n.ref!==void 0&&(o=n.ref,s=C.current),n.key!==void 0&&(a=``+n.key),e.type&&e.type.defaultProps)var c=e.type.defaultProps;for(l in n)S.call(n,l)&&!w.hasOwnProperty(l)&&(i[l]=n[l]===void 0&&c!==void 0?c[l]:n[l])}var l=arguments.length-2;if(l===1)i.children=r;else if(1<l){c=Array(l);for(var u=0;u<l;u++)c[u]=arguments[u+2];i.children=c}return{$$typeof:t,type:e.type,key:a,ref:o,props:i,_owner:s}},e.createContext=function(e){return e={$$typeof:s,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},e.Provider={$$typeof:o,_context:e},e.Consumer=e},e.createElement=T,e.createFactory=function(e){var t=T.bind(null,e);return t.type=e,t},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:N}},e.memo=function(e,t){return{$$typeof:u,type:e,compare:t===void 0?null:t}},e.startTransition=function(e){var t=F.transition;F.transition={};try{e()}finally{F.transition=t}},e.unstable_act=L,e.useCallback=function(e,t){return P.current.useCallback(e,t)},e.useContext=function(e){return P.current.useContext(e)},e.useDebugValue=function(){},e.useDeferredValue=function(e){return P.current.useDeferredValue(e)},e.useEffect=function(e,t){return P.current.useEffect(e,t)},e.useId=function(){return P.current.useId()},e.useImperativeHandle=function(e,t,n){return P.current.useImperativeHandle(e,t,n)},e.useInsertionEffect=function(e,t){return P.current.useInsertionEffect(e,t)},e.useLayoutEffect=function(e,t){return P.current.useLayoutEffect(e,t)},e.useMemo=function(e,t){return P.current.useMemo(e,t)},e.useReducer=function(e,t,n){return P.current.useReducer(e,t,n)},e.useRef=function(e){return P.current.useRef(e)},e.useState=function(e){return P.current.useState(e)},e.useSyncExternalStore=function(e,t,n){return P.current.useSyncExternalStore(e,t,n)},e.useTransition=function(){return P.current.useTransition()},e.version=`18.3.1`})),p=s(((e,t)=>{t.exports=f()})),m=s((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(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=typeof setTimeout==`function`?setTimeout:null,_=typeof clearTimeout==`function`?clearTimeout:null,v=typeof setImmediate<`u`?setImmediate:null;typeof navigator<`u`&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function y(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 b(e){if(h=!1,y(e),!m)if(n(c)!==null)m=!0,M(x);else{var t=n(l);t!==null&&N(b,t.startTime-e)}}function x(t,i){m=!1,h&&(h=!1,_(w),w=-1),p=!0;var a=f;try{for(y(i),d=n(c);d!==null&&(!(d.expirationTime>i)||t&&!D());){var o=d.callback;if(typeof o==`function`){d.callback=null,f=d.priorityLevel;var s=o(d.expirationTime<=i);i=e.unstable_now(),typeof s==`function`?d.callback=s:d===n(c)&&r(c),y(i)}else r(c);d=n(c)}if(d!==null)var u=!0;else{var g=n(l);g!==null&&N(b,g.startTime-i),u=!1}return u}finally{d=null,f=a,p=!1}}var S=!1,C=null,w=-1,T=5,E=-1;function D(){return!(e.unstable_now()-E<T)}function O(){if(C!==null){var t=e.unstable_now();E=t;var n=!0;try{n=C(!0,t)}finally{n?k():(S=!1,C=null)}}else S=!1}var k;if(typeof v==`function`)k=function(){v(O)};else if(typeof MessageChannel<`u`){var A=new MessageChannel,j=A.port2;A.port1.onmessage=O,k=function(){j.postMessage(null)}}else k=function(){g(O,0)};function M(e){C=e,S||(S=!0,k())}function N(t,n){w=g(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_continueExecution=function(){m||p||(m=!0,M(x))},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`):T=0<e?Math.floor(1e3/e):5},e.unstable_getCurrentPriorityLevel=function(){return f},e.unstable_getFirstCallbackNode=function(){return n(c)},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_pauseExecution=function(){},e.unstable_requestPaint=function(){},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?(_(w),w=-1):h=!0,N(b,a-o))):(r.sortIndex=s,t(c,r),m||p||(m=!0,M(x))),r},e.unstable_shouldYield=D,e.unstable_wrapCallback=function(e){var t=f;return function(){var n=f;f=t;try{return e.apply(this,arguments)}finally{f=n}}}})),h=s(((e,t)=>{t.exports=m()})),g=s((e=>{var t=p(),n=h();function r(e){for(var t=`https://reactjs.org/docs/error-decoder.html?invariant=`+e,n=1;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.`}var i=new Set,a={};function o(e,t){s(e,t),s(e+`Capture`,t)}function s(e,t){for(a[e]=t,e=0;e<t.length;e++)i.add(t[e])}var c=!(typeof window>`u`||window.document===void 0||window.document.createElement===void 0),l=Object.prototype.hasOwnProperty,u=/^[: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]*$/,d={},f={};function m(e){return l.call(f,e)?!0:l.call(d,e)?!1:u.test(e)?f[e]=!0:(d[e]=!0,!1)}function g(e,t,n,r){if(n!==null&&n.type===0)return!1;switch(typeof t){case`function`:case`symbol`:return!0;case`boolean`:return r?!1:n===null?(e=e.toLowerCase().slice(0,5),e!==`data-`&&e!==`aria-`):!n.acceptsBooleans;default:return!1}}function _(e,t,n,r){if(t==null||g(e,t,n,r))return!0;if(r)return!1;if(n!==null)switch(n.type){case 3:return!t;case 4:return!1===t;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}function v(e,t,n,r,i,a,o){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=r,this.attributeNamespace=i,this.mustUseProperty=n,this.propertyName=e,this.type=t,this.sanitizeURL=a,this.removeEmptyString=o}var y={};`children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style`.split(` `).forEach(function(e){y[e]=new v(e,0,!1,e,null,!1,!1)}),[[`acceptCharset`,`accept-charset`],[`className`,`class`],[`htmlFor`,`for`],[`httpEquiv`,`http-equiv`]].forEach(function(e){var t=e[0];y[t]=new v(t,1,!1,e[1],null,!1,!1)}),[`contentEditable`,`draggable`,`spellCheck`,`value`].forEach(function(e){y[e]=new v(e,2,!1,e.toLowerCase(),null,!1,!1)}),[`autoReverse`,`externalResourcesRequired`,`focusable`,`preserveAlpha`].forEach(function(e){y[e]=new v(e,2,!1,e,null,!1,!1)}),`allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope`.split(` `).forEach(function(e){y[e]=new v(e,3,!1,e.toLowerCase(),null,!1,!1)}),[`checked`,`multiple`,`muted`,`selected`].forEach(function(e){y[e]=new v(e,3,!0,e,null,!1,!1)}),[`capture`,`download`].forEach(function(e){y[e]=new v(e,4,!1,e,null,!1,!1)}),[`cols`,`rows`,`size`,`span`].forEach(function(e){y[e]=new v(e,6,!1,e,null,!1,!1)}),[`rowSpan`,`start`].forEach(function(e){y[e]=new v(e,5,!1,e.toLowerCase(),null,!1,!1)});var b=/[\-:]([a-z])/g;function x(e){return e[1].toUpperCase()}`accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height`.split(` `).forEach(function(e){var t=e.replace(b,x);y[t]=new v(t,1,!1,e,null,!1,!1)}),`xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type`.split(` `).forEach(function(e){var t=e.replace(b,x);y[t]=new v(t,1,!1,e,`http://www.w3.org/1999/xlink`,!1,!1)}),[`xml:base`,`xml:lang`,`xml:space`].forEach(function(e){var t=e.replace(b,x);y[t]=new v(t,1,!1,e,`http://www.w3.org/XML/1998/namespace`,!1,!1)}),[`tabIndex`,`crossOrigin`].forEach(function(e){y[e]=new v(e,1,!1,e.toLowerCase(),null,!1,!1)}),y.xlinkHref=new v(`xlinkHref`,1,!1,`xlink:href`,`http://www.w3.org/1999/xlink`,!0,!1),[`src`,`href`,`action`,`formAction`].forEach(function(e){y[e]=new v(e,1,!1,e.toLowerCase(),null,!0,!0)});function S(e,t,n,r){var i=y.hasOwnProperty(t)?y[t]:null;(i===null?r||!(2<t.length)||t[0]!==`o`&&t[0]!==`O`||t[1]!==`n`&&t[1]!==`N`:i.type!==0)&&(_(t,n,i,r)&&(n=null),r||i===null?m(t)&&(n===null?e.removeAttribute(t):e.setAttribute(t,``+n)):i.mustUseProperty?e[i.propertyName]=n===null?i.type===3?!1:``:n:(t=i.attributeName,r=i.attributeNamespace,n===null?e.removeAttribute(t):(i=i.type,n=i===3||i===4&&!0===n?``:``+n,r?e.setAttributeNS(r,t,n):e.setAttribute(t,n))))}var C=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,w=Symbol.for(`react.element`),T=Symbol.for(`react.portal`),E=Symbol.for(`react.fragment`),D=Symbol.for(`react.strict_mode`),O=Symbol.for(`react.profiler`),k=Symbol.for(`react.provider`),A=Symbol.for(`react.context`),j=Symbol.for(`react.forward_ref`),M=Symbol.for(`react.suspense`),N=Symbol.for(`react.suspense_list`),P=Symbol.for(`react.memo`),F=Symbol.for(`react.lazy`),I=Symbol.for(`react.offscreen`),L=Symbol.iterator;function ee(e){return typeof e!=`object`||!e?null:(e=L&&e[L]||e[`@@iterator`],typeof e==`function`?e:null)}var R=Object.assign,z;function B(e){if(z===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);z=t&&t[1]||``}return`
|
|
2
|
-
`+
|
|
1
|
+
var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,t)=>()=>(e&&(t=e(e=0)),t),s=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),c=(e,n)=>{let r={};for(var i in e)t(r,i,{get:e[i],enumerable:!0});return n||t(r,Symbol.toStringTag,{value:`Module`}),r},l=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},u=(n,r,a)=>(a=n==null?{}:e(i(n)),l(r||!n||!n.__esModule?t(a,`default`,{value:n,enumerable:!0}):a,n)),d=e=>a.call(e,`module.exports`)?e[`module.exports`]:l(t({},`__esModule`,{value:!0}),e);(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),e.crossOrigin===`use-credentials`?t.credentials=`include`:e.crossOrigin===`anonymous`?t.credentials=`omit`:t.credentials=`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var f=s((e=>{var t=Symbol.for(`react.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.provider`),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.iterator;function p(e){return typeof e!=`object`||!e?null:(e=f&&e[f]||e[`@@iterator`],typeof e==`function`?e:null)}var m={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},h=Object.assign,g={};function _(e,t,n){this.props=e,this.context=t,this.refs=g,this.updater=n||m}_.prototype.isReactComponent={},_.prototype.setState=function(e,t){if(typeof e!=`object`&&typeof e!=`function`&&e!=null)throw Error(`setState(...): 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`)},_.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,`forceUpdate`)};function v(){}v.prototype=_.prototype;function y(e,t,n){this.props=e,this.context=t,this.refs=g,this.updater=n||m}var b=y.prototype=new v;b.constructor=y,h(b,_.prototype),b.isPureReactComponent=!0;var x=Array.isArray,S=Object.prototype.hasOwnProperty,C={current:null},w={key:!0,ref:!0,__self:!0,__source:!0};function T(e,n,r){var i,a={},o=null,s=null;if(n!=null)for(i in n.ref!==void 0&&(s=n.ref),n.key!==void 0&&(o=``+n.key),n)S.call(n,i)&&!w.hasOwnProperty(i)&&(a[i]=n[i]);var c=arguments.length-2;if(c===1)a.children=r;else if(1<c){for(var l=Array(c),u=0;u<c;u++)l[u]=arguments[u+2];a.children=l}if(e&&e.defaultProps)for(i in c=e.defaultProps,c)a[i]===void 0&&(a[i]=c[i]);return{$$typeof:t,type:e,key:o,ref:s,props:a,_owner:C.current}}function E(e,n){return{$$typeof:t,type:e.type,key:n,ref:e.ref,props:e.props,_owner:e._owner}}function D(e){return typeof e==`object`&&!!e&&e.$$typeof===t}function O(e){var t={"=":`=0`,":":`=2`};return`$`+e.replace(/[=:]/g,function(e){return t[e]})}var k=/\/+/g;function A(e,t){return typeof e==`object`&&e&&e.key!=null?O(``+e.key):t.toString(36)}function j(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`string`:case`number`:c=!0;break;case`object`:switch(e.$$typeof){case t:case n:c=!0}}if(c)return c=e,o=o(c),e=a===``?`.`+A(c,0):a,x(o)?(i=``,e!=null&&(i=e.replace(k,`$&/`)+`/`),j(o,r,i,``,function(e){return e})):o!=null&&(D(o)&&(o=E(o,i+(!o.key||c&&c.key===o.key?``:(``+o.key).replace(k,`$&/`)+`/`)+e)),r.push(o)),1;if(c=0,a=a===``?`.`:a+`:`,x(e))for(var l=0;l<e.length;l++){s=e[l];var u=a+A(s,l);c+=j(s,r,i,u,o)}else if(u=p(e),typeof u==`function`)for(e=u.call(e),l=0;!(s=e.next()).done;)s=s.value,u=a+A(s,l++),c+=j(s,r,i,u,o);else if(s===`object`)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 M(e,t,n){if(e==null)return e;var r=[],i=0;return j(e,r,``,``,function(e){return t.call(n,e,i++)}),r}function N(e){if(e._status===-1){var t=e._result;t=t(),t.then(function(t){(e._status===0||e._status===-1)&&(e._status=1,e._result=t)},function(t){(e._status===0||e._status===-1)&&(e._status=2,e._result=t)}),e._status===-1&&(e._status=0,e._result=t)}if(e._status===1)return e._result.default;throw e._result}var P={current:null},F={transition:null},I={ReactCurrentDispatcher:P,ReactCurrentBatchConfig:F,ReactCurrentOwner:C};function L(){throw Error(`act(...) is not supported in production builds of React.`)}e.Children={map:M,forEach:function(e,t,n){M(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return M(e,function(){t++}),t},toArray:function(e){return M(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.Component=_,e.Fragment=r,e.Profiler=a,e.PureComponent=y,e.StrictMode=i,e.Suspense=l,e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=I,e.act=L,e.cloneElement=function(e,n,r){if(e==null)throw Error(`React.cloneElement(...): The argument must be a React element, but you passed `+e+`.`);var i=h({},e.props),a=e.key,o=e.ref,s=e._owner;if(n!=null){if(n.ref!==void 0&&(o=n.ref,s=C.current),n.key!==void 0&&(a=``+n.key),e.type&&e.type.defaultProps)var c=e.type.defaultProps;for(l in n)S.call(n,l)&&!w.hasOwnProperty(l)&&(i[l]=n[l]===void 0&&c!==void 0?c[l]:n[l])}var l=arguments.length-2;if(l===1)i.children=r;else if(1<l){c=Array(l);for(var u=0;u<l;u++)c[u]=arguments[u+2];i.children=c}return{$$typeof:t,type:e.type,key:a,ref:o,props:i,_owner:s}},e.createContext=function(e){return e={$$typeof:s,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},e.Provider={$$typeof:o,_context:e},e.Consumer=e},e.createElement=T,e.createFactory=function(e){var t=T.bind(null,e);return t.type=e,t},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:N}},e.memo=function(e,t){return{$$typeof:u,type:e,compare:t===void 0?null:t}},e.startTransition=function(e){var t=F.transition;F.transition={};try{e()}finally{F.transition=t}},e.unstable_act=L,e.useCallback=function(e,t){return P.current.useCallback(e,t)},e.useContext=function(e){return P.current.useContext(e)},e.useDebugValue=function(){},e.useDeferredValue=function(e){return P.current.useDeferredValue(e)},e.useEffect=function(e,t){return P.current.useEffect(e,t)},e.useId=function(){return P.current.useId()},e.useImperativeHandle=function(e,t,n){return P.current.useImperativeHandle(e,t,n)},e.useInsertionEffect=function(e,t){return P.current.useInsertionEffect(e,t)},e.useLayoutEffect=function(e,t){return P.current.useLayoutEffect(e,t)},e.useMemo=function(e,t){return P.current.useMemo(e,t)},e.useReducer=function(e,t,n){return P.current.useReducer(e,t,n)},e.useRef=function(e){return P.current.useRef(e)},e.useState=function(e){return P.current.useState(e)},e.useSyncExternalStore=function(e,t,n){return P.current.useSyncExternalStore(e,t,n)},e.useTransition=function(){return P.current.useTransition()},e.version=`18.3.1`})),p=s(((e,t)=>{t.exports=f()})),m=s((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(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=typeof setTimeout==`function`?setTimeout:null,_=typeof clearTimeout==`function`?clearTimeout:null,v=typeof setImmediate<`u`?setImmediate:null;typeof navigator<`u`&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function y(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 b(e){if(h=!1,y(e),!m)if(n(c)!==null)m=!0,M(x);else{var t=n(l);t!==null&&N(b,t.startTime-e)}}function x(t,i){m=!1,h&&(h=!1,_(w),w=-1),p=!0;var a=f;try{for(y(i),d=n(c);d!==null&&(!(d.expirationTime>i)||t&&!D());){var o=d.callback;if(typeof o==`function`){d.callback=null,f=d.priorityLevel;var s=o(d.expirationTime<=i);i=e.unstable_now(),typeof s==`function`?d.callback=s:d===n(c)&&r(c),y(i)}else r(c);d=n(c)}if(d!==null)var u=!0;else{var g=n(l);g!==null&&N(b,g.startTime-i),u=!1}return u}finally{d=null,f=a,p=!1}}var S=!1,C=null,w=-1,T=5,E=-1;function D(){return!(e.unstable_now()-E<T)}function O(){if(C!==null){var t=e.unstable_now();E=t;var n=!0;try{n=C(!0,t)}finally{n?k():(S=!1,C=null)}}else S=!1}var k;if(typeof v==`function`)k=function(){v(O)};else if(typeof MessageChannel<`u`){var A=new MessageChannel,j=A.port2;A.port1.onmessage=O,k=function(){j.postMessage(null)}}else k=function(){g(O,0)};function M(e){C=e,S||(S=!0,k())}function N(t,n){w=g(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_continueExecution=function(){m||p||(m=!0,M(x))},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`):T=0<e?Math.floor(1e3/e):5},e.unstable_getCurrentPriorityLevel=function(){return f},e.unstable_getFirstCallbackNode=function(){return n(c)},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_pauseExecution=function(){},e.unstable_requestPaint=function(){},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?(_(w),w=-1):h=!0,N(b,a-o))):(r.sortIndex=s,t(c,r),m||p||(m=!0,M(x))),r},e.unstable_shouldYield=D,e.unstable_wrapCallback=function(e){var t=f;return function(){var n=f;f=t;try{return e.apply(this,arguments)}finally{f=n}}}})),h=s(((e,t)=>{t.exports=m()})),g=s((e=>{var t=p(),n=h();function r(e){for(var t=`https://reactjs.org/docs/error-decoder.html?invariant=`+e,n=1;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.`}var i=new Set,a={};function o(e,t){s(e,t),s(e+`Capture`,t)}function s(e,t){for(a[e]=t,e=0;e<t.length;e++)i.add(t[e])}var c=!(typeof window>`u`||window.document===void 0||window.document.createElement===void 0),l=Object.prototype.hasOwnProperty,u=/^[: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]*$/,d={},f={};function m(e){return l.call(f,e)?!0:l.call(d,e)?!1:u.test(e)?f[e]=!0:(d[e]=!0,!1)}function g(e,t,n,r){if(n!==null&&n.type===0)return!1;switch(typeof t){case`function`:case`symbol`:return!0;case`boolean`:return r?!1:n===null?(e=e.toLowerCase().slice(0,5),e!==`data-`&&e!==`aria-`):!n.acceptsBooleans;default:return!1}}function _(e,t,n,r){if(t==null||g(e,t,n,r))return!0;if(r)return!1;if(n!==null)switch(n.type){case 3:return!t;case 4:return!1===t;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}function v(e,t,n,r,i,a,o){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=r,this.attributeNamespace=i,this.mustUseProperty=n,this.propertyName=e,this.type=t,this.sanitizeURL=a,this.removeEmptyString=o}var y={};`children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style`.split(` `).forEach(function(e){y[e]=new v(e,0,!1,e,null,!1,!1)}),[[`acceptCharset`,`accept-charset`],[`className`,`class`],[`htmlFor`,`for`],[`httpEquiv`,`http-equiv`]].forEach(function(e){var t=e[0];y[t]=new v(t,1,!1,e[1],null,!1,!1)}),[`contentEditable`,`draggable`,`spellCheck`,`value`].forEach(function(e){y[e]=new v(e,2,!1,e.toLowerCase(),null,!1,!1)}),[`autoReverse`,`externalResourcesRequired`,`focusable`,`preserveAlpha`].forEach(function(e){y[e]=new v(e,2,!1,e,null,!1,!1)}),`allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope`.split(` `).forEach(function(e){y[e]=new v(e,3,!1,e.toLowerCase(),null,!1,!1)}),[`checked`,`multiple`,`muted`,`selected`].forEach(function(e){y[e]=new v(e,3,!0,e,null,!1,!1)}),[`capture`,`download`].forEach(function(e){y[e]=new v(e,4,!1,e,null,!1,!1)}),[`cols`,`rows`,`size`,`span`].forEach(function(e){y[e]=new v(e,6,!1,e,null,!1,!1)}),[`rowSpan`,`start`].forEach(function(e){y[e]=new v(e,5,!1,e.toLowerCase(),null,!1,!1)});var b=/[\-:]([a-z])/g;function x(e){return e[1].toUpperCase()}`accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height`.split(` `).forEach(function(e){var t=e.replace(b,x);y[t]=new v(t,1,!1,e,null,!1,!1)}),`xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type`.split(` `).forEach(function(e){var t=e.replace(b,x);y[t]=new v(t,1,!1,e,`http://www.w3.org/1999/xlink`,!1,!1)}),[`xml:base`,`xml:lang`,`xml:space`].forEach(function(e){var t=e.replace(b,x);y[t]=new v(t,1,!1,e,`http://www.w3.org/XML/1998/namespace`,!1,!1)}),[`tabIndex`,`crossOrigin`].forEach(function(e){y[e]=new v(e,1,!1,e.toLowerCase(),null,!1,!1)}),y.xlinkHref=new v(`xlinkHref`,1,!1,`xlink:href`,`http://www.w3.org/1999/xlink`,!0,!1),[`src`,`href`,`action`,`formAction`].forEach(function(e){y[e]=new v(e,1,!1,e.toLowerCase(),null,!0,!0)});function S(e,t,n,r){var i=y.hasOwnProperty(t)?y[t]:null;(i===null?r||!(2<t.length)||t[0]!==`o`&&t[0]!==`O`||t[1]!==`n`&&t[1]!==`N`:i.type!==0)&&(_(t,n,i,r)&&(n=null),r||i===null?m(t)&&(n===null?e.removeAttribute(t):e.setAttribute(t,``+n)):i.mustUseProperty?e[i.propertyName]=n===null?i.type===3?!1:``:n:(t=i.attributeName,r=i.attributeNamespace,n===null?e.removeAttribute(t):(i=i.type,n=i===3||i===4&&!0===n?``:``+n,r?e.setAttributeNS(r,t,n):e.setAttribute(t,n))))}var C=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,w=Symbol.for(`react.element`),T=Symbol.for(`react.portal`),E=Symbol.for(`react.fragment`),D=Symbol.for(`react.strict_mode`),O=Symbol.for(`react.profiler`),k=Symbol.for(`react.provider`),A=Symbol.for(`react.context`),j=Symbol.for(`react.forward_ref`),M=Symbol.for(`react.suspense`),N=Symbol.for(`react.suspense_list`),P=Symbol.for(`react.memo`),F=Symbol.for(`react.lazy`),I=Symbol.for(`react.offscreen`),L=Symbol.iterator;function R(e){return typeof e!=`object`||!e?null:(e=L&&e[L]||e[`@@iterator`],typeof e==`function`?e:null)}var z=Object.assign,B;function V(e){if(B===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);B=t&&t[1]||``}return`
|
|
2
|
+
`+B+e}var ee=!1;function H(e,t){if(!e||ee)return``;ee=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(t)if(t=function(){throw Error()},Object.defineProperty(t.prototype,`props`,{set:function(){throw Error()}}),typeof Reflect==`object`&&Reflect.construct){try{Reflect.construct(t,[])}catch(e){var r=e}Reflect.construct(e,[],t)}else{try{t.call()}catch(e){r=e}e.call(t.prototype)}else{try{throw Error()}catch(e){r=e}e()}}catch(t){if(t&&r&&typeof t.stack==`string`){for(var i=t.stack.split(`
|
|
3
3
|
`),a=r.stack.split(`
|
|
4
4
|
`),o=i.length-1,s=a.length-1;1<=o&&0<=s&&i[o]!==a[s];)s--;for(;1<=o&&0<=s;o--,s--)if(i[o]!==a[s]){if(o!==1||s!==1)do if(o--,s--,0>s||i[o]!==a[s]){var c=`
|
|
5
|
-
`+i[o].replace(` at new `,` at `);return e.displayName&&c.includes(`<anonymous>`)&&(c=c.replace(`<anonymous>`,e.displayName)),c}while(1<=o&&0<=s);break}}}finally{te=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:``)?B(e):``}function ne(e){switch(e.tag){case 5:return B(e.type);case 16:return B(`Lazy`);case 13:return B(`Suspense`);case 19:return B(`SuspenseList`);case 0:case 2:case 15:return e=V(e.type,!1),e;case 11:return e=V(e.type.render,!1),e;case 1:return e=V(e.type,!0),e;default:return``}}function H(e){if(e==null)return null;if(typeof e==`function`)return e.displayName||e.name||null;if(typeof e==`string`)return e;switch(e){case E:return`Fragment`;case T:return`Portal`;case O:return`Profiler`;case D:return`StrictMode`;case M:return`Suspense`;case N:return`SuspenseList`}if(typeof e==`object`)switch(e.$$typeof){case A:return(e.displayName||`Context`)+`.Consumer`;case k:return(e._context.displayName||`Context`)+`.Provider`;case j:var t=e.render;return e=e.displayName,e||=(e=t.displayName||t.name||``,e===``?`ForwardRef`:`ForwardRef(`+e+`)`),e;case P:return t=e.displayName||null,t===null?H(e.type)||`Memo`:t;case F:t=e._payload,e=e._init;try{return H(e(t))}catch{}}return null}function re(e){var t=e.type;switch(e.tag){case 24:return`Cache`;case 9:return(t.displayName||`Context`)+`.Consumer`;case 10:return(t._context.displayName||`Context`)+`.Provider`;case 18:return`DehydratedFragment`;case 11:return e=t.render,e=e.displayName||e.name||``,t.displayName||(e===``?`ForwardRef`:`ForwardRef(`+e+`)`);case 7:return`Fragment`;case 5:return t;case 4:return`Portal`;case 3:return`Root`;case 6:return`Text`;case 16:return H(t);case 8:return t===D?`StrictMode`:`Mode`;case 22:return`Offscreen`;case 12:return`Profiler`;case 21:return`Scope`;case 13:return`Suspense`;case 19:return`SuspenseList`;case 25:return`TracingMarker`;case 1:case 0:case 17:case 2:case 14:case 15:if(typeof t==`function`)return t.displayName||t.name||null;if(typeof t==`string`)return t}return null}function U(e){switch(typeof e){case`boolean`:case`number`:case`string`:case`undefined`:return e;case`object`:return e;default:return``}}function ie(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()===`input`&&(t===`checkbox`||t===`radio`)}function W(e){var t=ie(e)?`checked`:`value`,n=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),r=``+e[t];if(!e.hasOwnProperty(t)&&n!==void 0&&typeof n.get==`function`&&typeof n.set==`function`){var i=n.get,a=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return i.call(this)},set:function(e){r=``+e,a.call(this,e)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(e){r=``+e},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function ae(e){e._valueTracker||=W(e)}function oe(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r=``;return e&&(r=ie(e)?e.checked?`true`:`false`:e.value),e=r,e===n?!1:(t.setValue(e),!0)}function se(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 ce(e,t){var n=t.checked;return R({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function le(e,t){var n=t.defaultValue==null?``:t.defaultValue,r=t.checked==null?t.defaultChecked:t.checked;n=U(t.value==null?n:t.value),e._wrapperState={initialChecked:r,initialValue:n,controlled:t.type===`checkbox`||t.type===`radio`?t.checked!=null:t.value!=null}}function ue(e,t){t=t.checked,t!=null&&S(e,`checked`,t,!1)}function de(e,t){ue(e,t);var n=U(t.value),r=t.type;if(n!=null)r===`number`?(n===0&&e.value===``||e.value!=n)&&(e.value=``+n):e.value!==``+n&&(e.value=``+n);else if(r===`submit`||r===`reset`){e.removeAttribute(`value`);return}t.hasOwnProperty(`value`)?pe(e,t.type,n):t.hasOwnProperty(`defaultValue`)&&pe(e,t.type,U(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function fe(e,t,n){if(t.hasOwnProperty(`value`)||t.hasOwnProperty(`defaultValue`)){var r=t.type;if(!(r!==`submit`&&r!==`reset`||t.value!==void 0&&t.value!==null))return;t=``+e._wrapperState.initialValue,n||t===e.value||(e.value=t),e.defaultValue=t}n=e.name,n!==``&&(e.name=``),e.defaultChecked=!!e._wrapperState.initialChecked,n!==``&&(e.name=n)}function pe(e,t,n){(t!==`number`||se(e.ownerDocument)!==e)&&(n==null?e.defaultValue=``+e._wrapperState.initialValue:e.defaultValue!==``+n&&(e.defaultValue=``+n))}var me=Array.isArray;function he(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=``+U(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 ge(e,t){if(t.dangerouslySetInnerHTML!=null)throw Error(r(91));return R({},t,{value:void 0,defaultValue:void 0,children:``+e._wrapperState.initialValue})}function _e(e,t){var n=t.value;if(n==null){if(n=t.children,t=t.defaultValue,n!=null){if(t!=null)throw Error(r(92));if(me(n)){if(1<n.length)throw Error(r(93));n=n[0]}t=n}t??=``,n=t}e._wrapperState={initialValue:U(n)}}function ve(e,t){var n=U(t.value),r=U(t.defaultValue);n!=null&&(n=``+n,n!==e.value&&(e.value=n),t.defaultValue==null&&e.defaultValue!==n&&(e.defaultValue=n)),r!=null&&(e.defaultValue=``+r)}function ye(e){var t=e.textContent;t===e._wrapperState.initialValue&&t!==``&&t!==null&&(e.value=t)}function be(e){switch(e){case`svg`:return`http://www.w3.org/2000/svg`;case`math`:return`http://www.w3.org/1998/Math/MathML`;default:return`http://www.w3.org/1999/xhtml`}}function xe(e,t){return e==null||e===`http://www.w3.org/1999/xhtml`?be(t):e===`http://www.w3.org/2000/svg`&&t===`foreignObject`?`http://www.w3.org/1999/xhtml`:e}var Se,Ce=function(e){return typeof MSApp<`u`&&MSApp.execUnsafeLocalFunction?function(t,n,r,i){MSApp.execUnsafeLocalFunction(function(){return e(t,n,r,i)})}:e}(function(e,t){if(e.namespaceURI!==`http://www.w3.org/2000/svg`||`innerHTML`in e)e.innerHTML=t;else{for(Se||=document.createElement(`div`),Se.innerHTML=`<svg>`+t.valueOf().toString()+`</svg>`,t=Se.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function we(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var Te={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},Ee=[`Webkit`,`ms`,`Moz`,`O`];Object.keys(Te).forEach(function(e){Ee.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),Te[t]=Te[e]})});function De(e,t,n){return t==null||typeof t==`boolean`||t===``?``:n||typeof t!=`number`||t===0||Te.hasOwnProperty(e)&&Te[e]?(``+t).trim():t+`px`}function Oe(e,t){for(var n in e=e.style,t)if(t.hasOwnProperty(n)){var r=n.indexOf(`--`)===0,i=De(n,t[n],r);n===`float`&&(n=`cssFloat`),r?e.setProperty(n,i):e[n]=i}}var ke=R({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function Ae(e,t){if(t){if(ke[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(r(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(r(60));if(typeof t.dangerouslySetInnerHTML!=`object`||!(`__html`in t.dangerouslySetInnerHTML))throw Error(r(61))}if(t.style!=null&&typeof t.style!=`object`)throw Error(r(62))}}function je(e,t){if(e.indexOf(`-`)===-1)return typeof t.is==`string`;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 Me=null;function Ne(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Pe=null,Fe=null,Ie=null;function Le(e){if(e=Ii(e)){if(typeof Pe!=`function`)throw Error(r(280));var t=e.stateNode;t&&(t=Ri(t),Pe(e.stateNode,e.type,t))}}function Re(e){Fe?Ie?Ie.push(e):Ie=[e]:Fe=e}function ze(){if(Fe){var e=Fe,t=Ie;if(Ie=Fe=null,Le(e),t)for(e=0;e<t.length;e++)Le(t[e])}}function Be(e,t){return e(t)}function Ve(){}var He=!1;function Ue(e,t,n){if(He)return e(t,n);He=!0;try{return Be(e,t,n)}finally{He=!1,(Fe!==null||Ie!==null)&&(Ve(),ze())}}function We(e,t){var n=e.stateNode;if(n===null)return null;var i=Ri(n);if(i===null)return null;n=i[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`:(i=!i.disabled)||(e=e.type,i=!(e===`button`||e===`input`||e===`select`||e===`textarea`)),e=!i;break a;default:e=!1}if(e)return null;if(n&&typeof n!=`function`)throw Error(r(231,t,typeof n));return n}var Ge=!1;if(c)try{var Ke={};Object.defineProperty(Ke,`passive`,{get:function(){Ge=!0}}),window.addEventListener(`test`,Ke,Ke),window.removeEventListener(`test`,Ke,Ke)}catch{Ge=!1}function qe(e,t,n,r,i,a,o,s,c){var l=Array.prototype.slice.call(arguments,3);try{t.apply(n,l)}catch(e){this.onError(e)}}var Je=!1,Ye=null,Xe=!1,Ze=null,Qe={onError:function(e){Je=!0,Ye=e}};function G(e,t,n,r,i,a,o,s,c){Je=!1,Ye=null,qe.apply(Qe,arguments)}function $e(e,t,n,i,a,o,s,c,l){if(G.apply(this,arguments),Je){if(Je){var u=Ye;Je=!1,Ye=null}else throw Error(r(198));Xe||(Xe=!0,Ze=u)}}function et(e){var t=e,n=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,t.flags&4098&&(n=t.return),e=t.return;while(e)}return t.tag===3?n:null}function tt(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 nt(e){if(et(e)!==e)throw Error(r(188))}function rt(e){var t=e.alternate;if(!t){if(t=et(e),t===null)throw Error(r(188));return t===e?e:null}for(var n=e,i=t;;){var a=n.return;if(a===null)break;var o=a.alternate;if(o===null){if(i=a.return,i!==null){n=i;continue}break}if(a.child===o.child){for(o=a.child;o;){if(o===n)return nt(a),e;if(o===i)return nt(a),t;o=o.sibling}throw Error(r(188))}if(n.return!==i.return)n=a,i=o;else{for(var s=!1,c=a.child;c;){if(c===n){s=!0,n=a,i=o;break}if(c===i){s=!0,i=a,n=o;break}c=c.sibling}if(!s){for(c=o.child;c;){if(c===n){s=!0,n=o,i=a;break}if(c===i){s=!0,i=o,n=a;break}c=c.sibling}if(!s)throw Error(r(189))}}if(n.alternate!==i)throw Error(r(190))}if(n.tag!==3)throw Error(r(188));return n.stateNode.current===n?e:t}function it(e){return e=rt(e),e===null?null:at(e)}function at(e){if(e.tag===5||e.tag===6)return e;for(e=e.child;e!==null;){var t=at(e);if(t!==null)return t;e=e.sibling}return null}var ot=n.unstable_scheduleCallback,st=n.unstable_cancelCallback,ct=n.unstable_shouldYield,lt=n.unstable_requestPaint,ut=n.unstable_now,dt=n.unstable_getCurrentPriorityLevel,ft=n.unstable_ImmediatePriority,pt=n.unstable_UserBlockingPriority,mt=n.unstable_NormalPriority,ht=n.unstable_LowPriority,gt=n.unstable_IdlePriority,_t=null,vt=null;function yt(e){if(vt&&typeof vt.onCommitFiberRoot==`function`)try{vt.onCommitFiberRoot(_t,e,void 0,(e.current.flags&128)==128)}catch{}}var bt=Math.clz32?Math.clz32:Ct,xt=Math.log,St=Math.LN2;function Ct(e){return e>>>=0,e===0?32:31-(xt(e)/St|0)|0}var wt=64,Tt=4194304;function Et(e){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: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 e&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return e&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function Dt(e,t){var n=e.pendingLanes;if(n===0)return 0;var r=0,i=e.suspendedLanes,a=e.pingedLanes,o=n&268435455;if(o!==0){var s=o&~i;s===0?(a&=o,a!==0&&(r=Et(a))):r=Et(s)}else o=n&~i,o===0?a!==0&&(r=Et(a)):r=Et(o);if(r===0)return 0;if(t!==0&&t!==r&&(t&i)===0&&(i=r&-r,a=t&-t,i>=a||i===16&&a&4194240))return t;if(r&4&&(r|=n&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=r;0<t;)n=31-bt(t),i=1<<n,r|=e[n],t&=~i;return r}function Ot(e,t){switch(e){case 1:case 2:case 4:return t+250;case 8:case 16:case 32:case 64: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:case 67108864:return-1;case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function kt(e,t){for(var n=e.suspendedLanes,r=e.pingedLanes,i=e.expirationTimes,a=e.pendingLanes;0<a;){var o=31-bt(a),s=1<<o,c=i[o];c===-1?((s&n)===0||(s&r)!==0)&&(i[o]=Ot(s,t)):c<=t&&(e.expiredLanes|=s),a&=~s}}function At(e){return e=e.pendingLanes&-1073741825,e===0?e&1073741824?1073741824:0:e}function jt(){var e=wt;return wt<<=1,!(wt&4194240)&&(wt=64),e}function Mt(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function Nt(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-bt(t),e[t]=n}function Pt(e,t){var n=e.pendingLanes&~t;e.pendingLanes=t,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=t,e.mutableReadLanes&=t,e.entangledLanes&=t,t=e.entanglements;var r=e.eventTimes;for(e=e.expirationTimes;0<n;){var i=31-bt(n),a=1<<i;t[i]=0,r[i]=-1,e[i]=-1,n&=~a}}function Ft(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var r=31-bt(n),i=1<<r;i&t|e[r]&t&&(e[r]|=t),n&=~i}}var It=0;function Lt(e){return e&=-e,1<e?4<e?e&268435455?16:536870912:4:1}var Rt,zt,Bt,Vt,Ht,Ut=!1,Wt=[],Gt=null,Kt=null,qt=null,Jt=new Map,Yt=new Map,Xt=[],Zt=`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 submit`.split(` `);function Qt(e,t){switch(e){case`focusin`:case`focusout`:Gt=null;break;case`dragenter`:case`dragleave`:Kt=null;break;case`mouseover`:case`mouseout`:qt=null;break;case`pointerover`:case`pointerout`:Jt.delete(t.pointerId);break;case`gotpointercapture`:case`lostpointercapture`:Yt.delete(t.pointerId)}}function $t(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=Ii(t),t!==null&&zt(t)),e):(e.eventSystemFlags|=r,t=e.targetContainers,i!==null&&t.indexOf(i)===-1&&t.push(i),e)}function en(e,t,n,r,i){switch(t){case`focusin`:return Gt=$t(Gt,e,t,n,r,i),!0;case`dragenter`:return Kt=$t(Kt,e,t,n,r,i),!0;case`mouseover`:return qt=$t(qt,e,t,n,r,i),!0;case`pointerover`:var a=i.pointerId;return Jt.set(a,$t(Jt.get(a)||null,e,t,n,r,i)),!0;case`gotpointercapture`:return a=i.pointerId,Yt.set(a,$t(Yt.get(a)||null,e,t,n,r,i)),!0}return!1}function tn(e){var t=Fi(e.target);if(t!==null){var n=et(t);if(n!==null){if(t=n.tag,t===13){if(t=tt(n),t!==null){e.blockedOn=t,Ht(e.priority,function(){Bt(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 nn(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=mn(e.domEventName,e.eventSystemFlags,t[0],e.nativeEvent);if(n===null){n=e.nativeEvent;var r=new n.constructor(n.type,n);Me=r,n.target.dispatchEvent(r),Me=null}else return t=Ii(n),t!==null&&zt(t),e.blockedOn=n,!1;t.shift()}return!0}function rn(e,t,n){nn(e)&&n.delete(t)}function an(){Ut=!1,Gt!==null&&nn(Gt)&&(Gt=null),Kt!==null&&nn(Kt)&&(Kt=null),qt!==null&&nn(qt)&&(qt=null),Jt.forEach(rn),Yt.forEach(rn)}function on(e,t){e.blockedOn===t&&(e.blockedOn=null,Ut||(Ut=!0,n.unstable_scheduleCallback(n.unstable_NormalPriority,an)))}function sn(e){function t(t){return on(t,e)}if(0<Wt.length){on(Wt[0],e);for(var n=1;n<Wt.length;n++){var r=Wt[n];r.blockedOn===e&&(r.blockedOn=null)}}for(Gt!==null&&on(Gt,e),Kt!==null&&on(Kt,e),qt!==null&&on(qt,e),Jt.forEach(t),Yt.forEach(t),n=0;n<Xt.length;n++)r=Xt[n],r.blockedOn===e&&(r.blockedOn=null);for(;0<Xt.length&&(n=Xt[0],n.blockedOn===null);)tn(n),n.blockedOn===null&&Xt.shift()}var cn=C.ReactCurrentBatchConfig,ln=!0;function un(e,t,n,r){var i=It,a=cn.transition;cn.transition=null;try{It=1,fn(e,t,n,r)}finally{It=i,cn.transition=a}}function dn(e,t,n,r){var i=It,a=cn.transition;cn.transition=null;try{It=4,fn(e,t,n,r)}finally{It=i,cn.transition=a}}function fn(e,t,n,r){if(ln){var i=mn(e,t,n,r);if(i===null)si(e,t,r,pn,n),Qt(e,r);else if(en(i,e,t,n,r))r.stopPropagation();else if(Qt(e,r),t&4&&-1<Zt.indexOf(e)){for(;i!==null;){var a=Ii(i);if(a!==null&&Rt(a),a=mn(e,t,n,r),a===null&&si(e,t,r,pn,n),a===i)break;i=a}i!==null&&r.stopPropagation()}else si(e,t,r,null,n)}}var pn=null;function mn(e,t,n,r){if(pn=null,e=Ne(r),e=Fi(e),e!==null)if(t=et(e),t===null)e=null;else if(n=t.tag,n===13){if(e=tt(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 pn=e,null}function hn(e){switch(e){case`cancel`:case`click`:case`close`:case`contextmenu`:case`copy`:case`cut`:case`auxclick`:case`dblclick`:case`dragend`:case`dragstart`:case`drop`:case`focusin`:case`focusout`:case`input`:case`invalid`:case`keydown`:case`keypress`:case`keyup`:case`mousedown`:case`mouseup`:case`paste`:case`pause`:case`play`:case`pointercancel`:case`pointerdown`:case`pointerup`:case`ratechange`:case`reset`:case`resize`:case`seeked`:case`submit`:case`touchcancel`:case`touchend`:case`touchstart`:case`volumechange`:case`change`:case`selectionchange`:case`textInput`:case`compositionstart`:case`compositionend`:case`compositionupdate`:case`beforeblur`:case`afterblur`:case`beforeinput`:case`blur`:case`fullscreenchange`:case`focus`:case`hashchange`:case`popstate`:case`select`:case`selectstart`:return 1;case`drag`:case`dragenter`:case`dragexit`:case`dragleave`:case`dragover`:case`mousemove`:case`mouseout`:case`mouseover`:case`pointermove`:case`pointerout`:case`pointerover`:case`scroll`:case`toggle`:case`touchmove`:case`wheel`:case`mouseenter`:case`mouseleave`:case`pointerenter`:case`pointerleave`:return 4;case`message`:switch(dt()){case ft:return 1;case pt:return 4;case mt:case ht:return 16;case gt:return 536870912;default:return 16}default:return 16}}var gn=null,_n=null,vn=null;function yn(){if(vn)return vn;var e,t=_n,n=t.length,r,i=`value`in gn?gn.value:gn.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 vn=i.slice(e,1<r?1-r:void 0)}function bn(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 xn(){return!0}function Sn(){return!1}function Cn(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)?xn:Sn,this.isPropagationStopped=Sn,this}return R(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=xn)},stopPropagation:function(){var e=this.nativeEvent;e&&(e.stopPropagation?e.stopPropagation():typeof e.cancelBubble!=`unknown`&&(e.cancelBubble=!0),this.isPropagationStopped=xn)},persist:function(){},isPersistent:xn}),t}var wn={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Tn=Cn(wn),En=R({},wn,{view:0,detail:0}),K=Cn(En),Dn,On,kn,An=R({},En,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Vn,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!==kn&&(kn&&e.type===`mousemove`?(Dn=e.screenX-kn.screenX,On=e.screenY-kn.screenY):On=Dn=0,kn=e),Dn)},movementY:function(e){return`movementY`in e?e.movementY:On}}),jn=Cn(An),Mn=Cn(R({},An,{dataTransfer:0})),Nn=Cn(R({},En,{relatedTarget:0})),Pn=Cn(R({},wn,{animationName:0,elapsedTime:0,pseudoElement:0})),Fn=Cn(R({},wn,{clipboardData:function(e){return`clipboardData`in e?e.clipboardData:window.clipboardData}})),In=Cn(R({},wn,{data:0})),Ln={Esc:`Escape`,Spacebar:` `,Left:`ArrowLeft`,Up:`ArrowUp`,Right:`ArrowRight`,Down:`ArrowDown`,Del:`Delete`,Win:`OS`,Menu:`ContextMenu`,Apps:`ContextMenu`,Scroll:`ScrollLock`,MozPrintableKey:`Unidentified`},Rn={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`},zn={Alt:`altKey`,Control:`ctrlKey`,Meta:`metaKey`,Shift:`shiftKey`};function Bn(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=zn[e])?!!t[e]:!1}function Vn(){return Bn}var Hn=Cn(R({},En,{key:function(e){if(e.key){var t=Ln[e.key]||e.key;if(t!==`Unidentified`)return t}return e.type===`keypress`?(e=bn(e),e===13?`Enter`:String.fromCharCode(e)):e.type===`keydown`||e.type===`keyup`?Rn[e.keyCode]||`Unidentified`:``},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Vn,charCode:function(e){return e.type===`keypress`?bn(e):0},keyCode:function(e){return e.type===`keydown`||e.type===`keyup`?e.keyCode:0},which:function(e){return e.type===`keypress`?bn(e):e.type===`keydown`||e.type===`keyup`?e.keyCode:0}})),Un=Cn(R({},An,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0})),Wn=Cn(R({},En,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Vn})),Gn=Cn(R({},wn,{propertyName:0,elapsedTime:0,pseudoElement:0})),Kn=Cn(R({},An,{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})),qn=[9,13,27,32],Jn=c&&`CompositionEvent`in window,Yn=null;c&&`documentMode`in document&&(Yn=document.documentMode);var Xn=c&&`TextEvent`in window&&!Yn,Zn=c&&(!Jn||Yn&&8<Yn&&11>=Yn),Qn=` `,$n=!1;function er(e,t){switch(e){case`keyup`:return qn.indexOf(t.keyCode)!==-1;case`keydown`:return t.keyCode!==229;case`keypress`:case`mousedown`:case`focusout`:return!0;default:return!1}}function tr(e){return e=e.detail,typeof e==`object`&&`data`in e?e.data:null}var nr=!1;function rr(e,t){switch(e){case`compositionend`:return tr(t);case`keypress`:return t.which===32?($n=!0,Qn):null;case`textInput`:return e=t.data,e===Qn&&$n?null:e;default:return null}}function ir(e,t){if(nr)return e===`compositionend`||!Jn&&er(e,t)?(e=yn(),vn=_n=gn=null,nr=!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 Zn&&t.locale!==`ko`?null:t.data;default:return null}}var ar={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function or(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t===`input`?!!ar[e.type]:t===`textarea`}function sr(e,t,n,r){Re(r),t=li(t,`onChange`),0<t.length&&(n=new Tn(`onChange`,`change`,null,n,r),e.push({event:n,listeners:t}))}var cr=null,lr=null;function ur(e){ti(e,0)}function dr(e){if(oe(Li(e)))return e}function fr(e,t){if(e===`change`)return t}var pr=!1;if(c){var mr;if(c){var hr=`oninput`in document;if(!hr){var gr=document.createElement(`div`);gr.setAttribute(`oninput`,`return;`),hr=typeof gr.oninput==`function`}mr=hr}else mr=!1;pr=mr&&(!document.documentMode||9<document.documentMode)}function _r(){cr&&(cr.detachEvent(`onpropertychange`,vr),lr=cr=null)}function vr(e){if(e.propertyName===`value`&&dr(lr)){var t=[];sr(t,lr,e,Ne(e)),Ue(ur,t)}}function yr(e,t,n){e===`focusin`?(_r(),cr=t,lr=n,cr.attachEvent(`onpropertychange`,vr)):e===`focusout`&&_r()}function br(e){if(e===`selectionchange`||e===`keyup`||e===`keydown`)return dr(lr)}function xr(e,t){if(e===`click`)return dr(t)}function Sr(e,t){if(e===`input`||e===`change`)return dr(t)}function Cr(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var wr=typeof Object.is==`function`?Object.is:Cr;function Tr(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(!l.call(t,i)||!wr(e[i],t[i]))return!1}return!0}function Er(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function Dr(e,t){var n=Er(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=Er(n)}}function Or(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Or(e,t.parentNode):`contains`in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function kr(){for(var e=window,t=se();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href==`string`}catch{n=!1}if(n)e=t.contentWindow;else break;t=se(e.document)}return t}function Ar(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`)}function jr(e){var t=kr(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&Or(n.ownerDocument.documentElement,n)){if(r!==null&&Ar(n)){if(t=r.start,e=r.end,e===void 0&&(e=t),`selectionStart`in n)n.selectionStart=t,n.selectionEnd=Math.min(e,n.value.length);else if(e=(t=n.ownerDocument||document)&&t.defaultView||window,e.getSelection){e=e.getSelection();var i=n.textContent.length,a=Math.min(r.start,i);r=r.end===void 0?a:Math.min(r.end,i),!e.extend&&a>r&&(i=r,r=a,a=i),i=Dr(n,a);var o=Dr(n,r);i&&o&&(e.rangeCount!==1||e.anchorNode!==i.node||e.anchorOffset!==i.offset||e.focusNode!==o.node||e.focusOffset!==o.offset)&&(t=t.createRange(),t.setStart(i.node,i.offset),e.removeAllRanges(),a>r?(e.addRange(t),e.extend(o.node,o.offset)):(t.setEnd(o.node,o.offset),e.addRange(t)))}}for(t=[],e=n;e=e.parentNode;)e.nodeType===1&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof n.focus==`function`&&n.focus(),n=0;n<t.length;n++)e=t[n],e.element.scrollLeft=e.left,e.element.scrollTop=e.top}}var Mr=c&&`documentMode`in document&&11>=document.documentMode,Nr=null,Pr=null,Fr=null,Ir=!1;function Lr(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Ir||Nr==null||Nr!==se(r)||(r=Nr,`selectionStart`in r&&Ar(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}),Fr&&Tr(Fr,r)||(Fr=r,r=li(Pr,`onSelect`),0<r.length&&(t=new Tn(`onSelect`,`select`,null,t,n),e.push({event:t,listeners:r}),t.target=Nr)))}function Rr(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n[`Webkit`+e]=`webkit`+t,n[`Moz`+e]=`moz`+t,n}var zr={animationend:Rr(`Animation`,`AnimationEnd`),animationiteration:Rr(`Animation`,`AnimationIteration`),animationstart:Rr(`Animation`,`AnimationStart`),transitionend:Rr(`Transition`,`TransitionEnd`)},Br={},Vr={};c&&(Vr=document.createElement(`div`).style,`AnimationEvent`in window||(delete zr.animationend.animation,delete zr.animationiteration.animation,delete zr.animationstart.animation),`TransitionEvent`in window||delete zr.transitionend.transition);function Hr(e){if(Br[e])return Br[e];if(!zr[e])return e;var t=zr[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in Vr)return Br[e]=t[n];return e}var Ur=Hr(`animationend`),Wr=Hr(`animationiteration`),Gr=Hr(`animationstart`),Kr=Hr(`transitionend`),qr=new Map,Jr=`abort auxClick cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel`.split(` `);function Yr(e,t){qr.set(e,t),o(t,[e])}for(var Xr=0;Xr<Jr.length;Xr++){var Zr=Jr[Xr];Yr(Zr.toLowerCase(),`on`+(Zr[0].toUpperCase()+Zr.slice(1)))}Yr(Ur,`onAnimationEnd`),Yr(Wr,`onAnimationIteration`),Yr(Gr,`onAnimationStart`),Yr(`dblclick`,`onDoubleClick`),Yr(`focusin`,`onFocus`),Yr(`focusout`,`onBlur`),Yr(Kr,`onTransitionEnd`),s(`onMouseEnter`,[`mouseout`,`mouseover`]),s(`onMouseLeave`,[`mouseout`,`mouseover`]),s(`onPointerEnter`,[`pointerout`,`pointerover`]),s(`onPointerLeave`,[`pointerout`,`pointerover`]),o(`onChange`,`change click focusin focusout input keydown keyup selectionchange`.split(` `)),o(`onSelect`,`focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange`.split(` `)),o(`onBeforeInput`,[`compositionend`,`keypress`,`textInput`,`paste`]),o(`onCompositionEnd`,`compositionend focusout keydown keypress keyup mousedown`.split(` `)),o(`onCompositionStart`,`compositionstart focusout keydown keypress keyup mousedown`.split(` `)),o(`onCompositionUpdate`,`compositionupdate focusout keydown keypress keyup mousedown`.split(` `));var Qr=`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(` `),$r=new Set(`cancel close invalid load scroll toggle`.split(` `).concat(Qr));function ei(e,t,n){var r=e.type||`unknown-event`;e.currentTarget=n,$e(r,t,void 0,e),e.currentTarget=null}function ti(e,t){t=(t&4)!=0;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;ei(i,s,l),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;ei(i,s,l),a=c}}}if(Xe)throw e=Ze,Xe=!1,Ze=null,e}function ni(e,t){var n=t[Mi];n===void 0&&(n=t[Mi]=new Set);var r=e+`__bubble`;n.has(r)||(oi(t,e,2,!1),n.add(r))}function ri(e,t,n){var r=0;t&&(r|=4),oi(n,e,r,t)}var ii=`_reactListening`+Math.random().toString(36).slice(2);function ai(e){if(!e[ii]){e[ii]=!0,i.forEach(function(t){t!==`selectionchange`&&($r.has(t)||ri(t,!1,e),ri(t,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[ii]||(t[ii]=!0,ri(`selectionchange`,!1,t))}}function oi(e,t,n,r){switch(hn(t)){case 1:var i=un;break;case 4:i=dn;break;default:i=fn}n=i.bind(null,t,n,e),i=void 0,!Ge||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 si(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||s.nodeType===8&&s.parentNode===i)break;if(o===4)for(o=r.return;o!==null;){var c=o.tag;if((c===3||c===4)&&(c=o.stateNode.containerInfo,c===i||c.nodeType===8&&c.parentNode===i))return;o=o.return}for(;s!==null;){if(o=Fi(s),o===null)return;if(c=o.tag,c===5||c===6){r=a=o;continue a}s=s.parentNode}}r=r.return}Ue(function(){var r=a,i=Ne(n),o=[];a:{var s=qr.get(e);if(s!==void 0){var c=Tn,l=e;switch(e){case`keypress`:if(bn(n)===0)break a;case`keydown`:case`keyup`:c=Hn;break;case`focusin`:l=`focus`,c=Nn;break;case`focusout`:l=`blur`,c=Nn;break;case`beforeblur`:case`afterblur`:c=Nn;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=jn;break;case`drag`:case`dragend`:case`dragenter`:case`dragexit`:case`dragleave`:case`dragover`:case`dragstart`:case`drop`:c=Mn;break;case`touchcancel`:case`touchend`:case`touchmove`:case`touchstart`:c=Wn;break;case Ur:case Wr:case Gr:c=Pn;break;case Kr:c=Gn;break;case`scroll`:c=K;break;case`wheel`:c=Kn;break;case`copy`:case`cut`:case`paste`:c=Fn;break;case`gotpointercapture`:case`lostpointercapture`:case`pointercancel`:case`pointerdown`:case`pointermove`:case`pointerout`:case`pointerover`:case`pointerup`:c=Un}var u=(t&4)!=0,d=!u&&e===`scroll`,f=u?s===null?null:s+`Capture`:s;u=[];for(var p=r,m;p!==null;){m=p;var h=m.stateNode;if(m.tag===5&&h!==null&&(m=h,f!==null&&(h=We(p,f),h!=null&&u.push(ci(p,h,m)))),d)break;p=p.return}0<u.length&&(s=new c(s,l,null,n,i),o.push({event:s,listeners:u}))}}if(!(t&7)){a:{if(s=e===`mouseover`||e===`pointerover`,c=e===`mouseout`||e===`pointerout`,s&&n!==Me&&(l=n.relatedTarget||n.fromElement)&&(Fi(l)||l[ji]))break a;if((c||s)&&(s=i.window===i?i:(s=i.ownerDocument)?s.defaultView||s.parentWindow:window,c?(l=n.relatedTarget||n.toElement,c=r,l=l?Fi(l):null,l!==null&&(d=et(l),l!==d||l.tag!==5&&l.tag!==6)&&(l=null)):(c=null,l=r),c!==l)){if(u=jn,h=`onMouseLeave`,f=`onMouseEnter`,p=`mouse`,(e===`pointerout`||e===`pointerover`)&&(u=Un,h=`onPointerLeave`,f=`onPointerEnter`,p=`pointer`),d=c==null?s:Li(c),m=l==null?s:Li(l),s=new u(h,p+`leave`,c,n,i),s.target=d,s.relatedTarget=m,h=null,Fi(i)===r&&(u=new u(f,p+`enter`,l,n,i),u.target=m,u.relatedTarget=d,h=u),d=h,c&&l)b:{for(u=c,f=l,p=0,m=u;m;m=ui(m))p++;for(m=0,h=f;h;h=ui(h))m++;for(;0<p-m;)u=ui(u),p--;for(;0<m-p;)f=ui(f),m--;for(;p--;){if(u===f||f!==null&&u===f.alternate)break b;u=ui(u),f=ui(f)}u=null}else u=null;c!==null&&di(o,s,c,u,!1),l!==null&&d!==null&&di(o,d,l,u,!0)}}a:{if(s=r?Li(r):window,c=s.nodeName&&s.nodeName.toLowerCase(),c===`select`||c===`input`&&s.type===`file`)var g=fr;else if(or(s))if(pr)g=Sr;else{g=br;var _=yr}else (c=s.nodeName)&&c.toLowerCase()===`input`&&(s.type===`checkbox`||s.type===`radio`)&&(g=xr);if(g&&=g(e,r)){sr(o,g,n,i);break a}_&&_(e,s,r),e===`focusout`&&(_=s._wrapperState)&&_.controlled&&s.type===`number`&&pe(s,`number`,s.value)}switch(_=r?Li(r):window,e){case`focusin`:(or(_)||_.contentEditable===`true`)&&(Nr=_,Pr=r,Fr=null);break;case`focusout`:Fr=Pr=Nr=null;break;case`mousedown`:Ir=!0;break;case`contextmenu`:case`mouseup`:case`dragend`:Ir=!1,Lr(o,n,i);break;case`selectionchange`:if(Mr)break;case`keydown`:case`keyup`:Lr(o,n,i)}var v;if(Jn)b:{switch(e){case`compositionstart`:var y=`onCompositionStart`;break b;case`compositionend`:y=`onCompositionEnd`;break b;case`compositionupdate`:y=`onCompositionUpdate`;break b}y=void 0}else nr?er(e,n)&&(y=`onCompositionEnd`):e===`keydown`&&n.keyCode===229&&(y=`onCompositionStart`);y&&(Zn&&n.locale!==`ko`&&(nr||y!==`onCompositionStart`?y===`onCompositionEnd`&&nr&&(v=yn()):(gn=i,_n=`value`in gn?gn.value:gn.textContent,nr=!0)),_=li(r,y),0<_.length&&(y=new In(y,e,null,n,i),o.push({event:y,listeners:_}),v?y.data=v:(v=tr(n),v!==null&&(y.data=v)))),(v=Xn?rr(e,n):ir(e,n))&&(r=li(r,`onBeforeInput`),0<r.length&&(i=new In(`onBeforeInput`,`beforeinput`,null,n,i),o.push({event:i,listeners:r}),i.data=v))}ti(o,t)})}function ci(e,t,n){return{instance:e,listener:t,currentTarget:n}}function li(e,t){for(var n=t+`Capture`,r=[];e!==null;){var i=e,a=i.stateNode;i.tag===5&&a!==null&&(i=a,a=We(e,n),a!=null&&r.unshift(ci(e,a,i)),a=We(e,t),a!=null&&r.push(ci(e,a,i))),e=e.return}return r}function ui(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5);return e||null}function di(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(c!==null&&c===r)break;s.tag===5&&l!==null&&(s=l,i?(c=We(n,a),c!=null&&o.unshift(ci(n,c,s))):i||(c=We(n,a),c!=null&&o.push(ci(n,c,s)))),n=n.return}o.length!==0&&e.push({event:t,listeners:o})}var fi=/\r\n?/g,pi=/\u0000|\uFFFD/g;function mi(e){return(typeof e==`string`?e:``+e).replace(fi,`
|
|
6
|
-
`).replace(pi,``)}function hi(e,t,n){if(t=mi(t),mi(e)!==t&&n)throw Error(r(425))}function gi(){}var _i=null,vi=null;function yi(e,t){return e===`textarea`||e===`noscript`||typeof t.children==`string`||typeof t.children==`number`||typeof t.dangerouslySetInnerHTML==`object`&&t.dangerouslySetInnerHTML!==null&&t.dangerouslySetInnerHTML.__html!=null}var bi=typeof setTimeout==`function`?setTimeout:void 0,xi=typeof clearTimeout==`function`?clearTimeout:void 0,Si=typeof Promise==`function`?Promise:void 0,Ci=typeof queueMicrotask==`function`?queueMicrotask:Si===void 0?bi:function(e){return Si.resolve(null).then(e).catch(wi)};function wi(e){setTimeout(function(){throw e})}function Ti(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===`/$`){if(r===0){e.removeChild(i),sn(t);return}r--}else n!==`$`&&n!==`$?`&&n!==`$!`||r++;n=i}while(n);sn(t)}function Ei(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===`$?`)break;if(t===`/$`)return null}}return e}function Di(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n===`$`||n===`$!`||n===`$?`){if(t===0)return e;t--}else n===`/$`&&t++}e=e.previousSibling}return null}var Oi=Math.random().toString(36).slice(2),ki=`__reactFiber$`+Oi,Ai=`__reactProps$`+Oi,ji=`__reactContainer$`+Oi,Mi=`__reactEvents$`+Oi,Ni=`__reactListeners$`+Oi,Pi=`__reactHandles$`+Oi;function Fi(e){var t=e[ki];if(t)return t;for(var n=e.parentNode;n;){if(t=n[ji]||n[ki]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=Di(e);e!==null;){if(n=e[ki])return n;e=Di(e)}return t}e=n,n=e.parentNode}return null}function Ii(e){return e=e[ki]||e[ji],!e||e.tag!==5&&e.tag!==6&&e.tag!==13&&e.tag!==3?null:e}function Li(e){if(e.tag===5||e.tag===6)return e.stateNode;throw Error(r(33))}function Ri(e){return e[Ai]||null}var zi=[],Bi=-1;function Vi(e){return{current:e}}function Hi(e){0>Bi||(e.current=zi[Bi],zi[Bi]=null,Bi--)}function Ui(e,t){Bi++,zi[Bi]=e.current,e.current=t}var Wi={},Gi=Vi(Wi),Ki=Vi(!1),qi=Wi;function Ji(e,t){var n=e.type.contextTypes;if(!n)return Wi;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===t)return r.__reactInternalMemoizedMaskedChildContext;var i={},a;for(a in n)i[a]=t[a];return r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=i),i}function Yi(e){return e=e.childContextTypes,e!=null}function Xi(){Hi(Ki),Hi(Gi)}function Zi(e,t,n){if(Gi.current!==Wi)throw Error(r(168));Ui(Gi,t),Ui(Ki,n)}function Qi(e,t,n){var i=e.stateNode;if(t=t.childContextTypes,typeof i.getChildContext!=`function`)return n;for(var a in i=i.getChildContext(),i)if(!(a in t))throw Error(r(108,re(e)||`Unknown`,a));return R({},n,i)}function $i(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||Wi,qi=Gi.current,Ui(Gi,e),Ui(Ki,Ki.current),!0}function ea(e,t,n){var i=e.stateNode;if(!i)throw Error(r(169));n?(e=Qi(e,t,qi),i.__reactInternalMemoizedMergedChildContext=e,Hi(Ki),Hi(Gi),Ui(Gi,e)):Hi(Ki),Ui(Ki,n)}var ta=null,na=!1,ra=!1;function ia(e){ta===null?ta=[e]:ta.push(e)}function aa(e){na=!0,ia(e)}function oa(){if(!ra&&ta!==null){ra=!0;var e=0,t=It;try{var n=ta;for(It=1;e<n.length;e++){var r=n[e];do r=r(!0);while(r!==null)}ta=null,na=!1}catch(t){throw ta!==null&&(ta=ta.slice(e+1)),ot(ft,oa),t}finally{It=t,ra=!1}}return null}var sa=[],ca=0,la=null,ua=0,da=[],fa=0,pa=null,ma=1,ha=``;function ga(e,t){sa[ca++]=ua,sa[ca++]=la,la=e,ua=t}function _a(e,t,n){da[fa++]=ma,da[fa++]=ha,da[fa++]=pa,pa=e;var r=ma;e=ha;var i=32-bt(r)-1;r&=~(1<<i),n+=1;var a=32-bt(t)+i;if(30<a){var o=i-i%5;a=(r&(1<<o)-1).toString(32),r>>=o,i-=o,ma=1<<32-bt(t)+i|n<<i|r,ha=a+e}else ma=1<<a|n<<i|r,ha=e}function va(e){e.return!==null&&(ga(e,1),_a(e,1,0))}function ya(e){for(;e===la;)la=sa[--ca],sa[ca]=null,ua=sa[--ca],sa[ca]=null;for(;e===pa;)pa=da[--fa],da[fa]=null,ha=da[--fa],da[fa]=null,ma=da[--fa],da[fa]=null}var ba=null,xa=null,Sa=!1,Ca=null;function wa(e,t){var n=Ql(5,null,null,0);n.elementType=`DELETED`,n.stateNode=t,n.return=e,t=e.deletions,t===null?(e.deletions=[n],e.flags|=16):t.push(n)}function Ta(e,t){switch(e.tag){case 5:var n=e.type;return t=t.nodeType!==1||n.toLowerCase()!==t.nodeName.toLowerCase()?null:t,t===null?!1:(e.stateNode=t,ba=e,xa=Ei(t.firstChild),!0);case 6:return t=e.pendingProps===``||t.nodeType!==3?null:t,t===null?!1:(e.stateNode=t,ba=e,xa=null,!0);case 13:return t=t.nodeType===8?t:null,t===null?!1:(n=pa===null?null:{id:ma,overflow:ha},e.memoizedState={dehydrated:t,treeContext:n,retryLane:1073741824},n=Ql(18,null,null,0),n.stateNode=t,n.return=e,e.child=n,ba=e,xa=null,!0);default:return!1}}function Ea(e){return(e.mode&1)!=0&&(e.flags&128)==0}function Da(e){if(Sa){var t=xa;if(t){var n=t;if(!Ta(e,t)){if(Ea(e))throw Error(r(418));t=Ei(n.nextSibling);var i=ba;t&&Ta(e,t)?wa(i,n):(e.flags=e.flags&-4097|2,Sa=!1,ba=e)}}else{if(Ea(e))throw Error(r(418));e.flags=e.flags&-4097|2,Sa=!1,ba=e}}}function Oa(e){for(e=e.return;e!==null&&e.tag!==5&&e.tag!==3&&e.tag!==13;)e=e.return;ba=e}function ka(e){if(e!==ba)return!1;if(!Sa)return Oa(e),Sa=!0,!1;var t;if((t=e.tag!==3)&&!(t=e.tag!==5)&&(t=e.type,t=t!==`head`&&t!==`body`&&!yi(e.type,e.memoizedProps)),t&&=xa){if(Ea(e))throw Aa(),Error(r(418));for(;t;)wa(e,t),t=Ei(t.nextSibling)}if(Oa(e),e.tag===13){if(e=e.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(r(317));a:{for(e=e.nextSibling,t=0;e;){if(e.nodeType===8){var n=e.data;if(n===`/$`){if(t===0){xa=Ei(e.nextSibling);break a}t--}else n!==`$`&&n!==`$!`&&n!==`$?`||t++}e=e.nextSibling}xa=null}}else xa=ba?Ei(e.stateNode.nextSibling):null;return!0}function Aa(){for(var e=xa;e;)e=Ei(e.nextSibling)}function ja(){xa=ba=null,Sa=!1}function Ma(e){Ca===null?Ca=[e]:Ca.push(e)}var Na=C.ReactCurrentBatchConfig;function Pa(e,t,n){if(e=n.ref,e!==null&&typeof e!=`function`&&typeof e!=`object`){if(n._owner){if(n=n._owner,n){if(n.tag!==1)throw Error(r(309));var i=n.stateNode}if(!i)throw Error(r(147,e));var a=i,o=``+e;return t!==null&&t.ref!==null&&typeof t.ref==`function`&&t.ref._stringRef===o?t.ref:(t=function(e){var t=a.refs;e===null?delete t[o]:t[o]=e},t._stringRef=o,t)}if(typeof e!=`string`)throw Error(r(284));if(!n._owner)throw Error(r(290,e))}return e}function Fa(e,t){throw e=Object.prototype.toString.call(t),Error(r(31,e===`[object Object]`?`object with keys {`+Object.keys(t).join(`, `)+`}`:e))}function Ia(e){var t=e._init;return t(e._payload)}function La(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 i(e,t){for(e=new Map;t!==null;)t.key===null?e.set(t.index,t):e.set(t.key,t),t=t.sibling;return e}function a(e,t){return e=tu(e,t),e.index=0,e.sibling=null,e}function o(t,n,r){return t.index=r,e?(r=t.alternate,r===null?(t.flags|=2,n):(r=r.index,r<n?(t.flags|=2,n):r)):(t.flags|=1048576,n)}function s(t){return e&&t.alternate===null&&(t.flags|=2),t}function c(e,t,n,r){return t===null||t.tag!==6?(t=au(n,e.mode,r),t.return=e,t):(t=a(t,n),t.return=e,t)}function l(e,t,n,r){var i=n.type;return i===E?d(e,t,n.props.children,r,n.key):t!==null&&(t.elementType===i||typeof i==`object`&&i&&i.$$typeof===F&&Ia(i)===t.type)?(r=a(t,n.props),r.ref=Pa(e,t,n),r.return=e,r):(r=nu(n.type,n.key,n.props,null,e.mode,r),r.ref=Pa(e,t,n),r.return=e,r)}function u(e,t,n,r){return t===null||t.tag!==4||t.stateNode.containerInfo!==n.containerInfo||t.stateNode.implementation!==n.implementation?(t=ou(n,e.mode,r),t.return=e,t):(t=a(t,n.children||[]),t.return=e,t)}function d(e,t,n,r,i){return t===null||t.tag!==7?(t=ru(n,e.mode,r,i),t.return=e,t):(t=a(t,n),t.return=e,t)}function f(e,t,n){if(typeof t==`string`&&t!==``||typeof t==`number`)return t=au(``+t,e.mode,n),t.return=e,t;if(typeof t==`object`&&t){switch(t.$$typeof){case w:return n=nu(t.type,t.key,t.props,null,e.mode,n),n.ref=Pa(e,null,t),n.return=e,n;case T:return t=ou(t,e.mode,n),t.return=e,t;case F:var r=t._init;return f(e,r(t._payload),n)}if(me(t)||ee(t))return t=ru(t,e.mode,n,null),t.return=e,t;Fa(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`)return i===null?c(e,t,``+n,r):null;if(typeof n==`object`&&n){switch(n.$$typeof){case w:return n.key===i?l(e,t,n,r):null;case T:return n.key===i?u(e,t,n,r):null;case F:return i=n._init,p(e,t,i(n._payload),r)}if(me(n)||ee(n))return i===null?d(e,t,n,r,null):null;Fa(e,n)}return null}function m(e,t,n,r,i){if(typeof r==`string`&&r!==``||typeof r==`number`)return e=e.get(n)||null,c(t,e,``+r,i);if(typeof r==`object`&&r){switch(r.$$typeof){case w:return e=e.get(r.key===null?n:r.key)||null,l(t,e,r,i);case T:return e=e.get(r.key===null?n:r.key)||null,u(t,e,r,i);case F:var a=r._init;return m(e,t,n,a(r._payload),i)}if(me(r)||ee(r))return e=e.get(n)||null,d(t,e,r,i,null);Fa(t,r)}return null}function h(r,a,s,c){for(var l=null,u=null,d=a,h=a=0,g=null;d!==null&&h<s.length;h++){d.index>h?(g=d,d=null):g=d.sibling;var _=p(r,d,s[h],c);if(_===null){d===null&&(d=g);break}e&&d&&_.alternate===null&&t(r,d),a=o(_,a,h),u===null?l=_:u.sibling=_,u=_,d=g}if(h===s.length)return n(r,d),Sa&&ga(r,h),l;if(d===null){for(;h<s.length;h++)d=f(r,s[h],c),d!==null&&(a=o(d,a,h),u===null?l=d:u.sibling=d,u=d);return Sa&&ga(r,h),l}for(d=i(r,d);h<s.length;h++)g=m(d,r,h,s[h],c),g!==null&&(e&&g.alternate!==null&&d.delete(g.key===null?h:g.key),a=o(g,a,h),u===null?l=g:u.sibling=g,u=g);return e&&d.forEach(function(e){return t(r,e)}),Sa&&ga(r,h),l}function g(a,s,c,l){var u=ee(c);if(typeof u!=`function`)throw Error(r(150));if(c=u.call(c),c==null)throw Error(r(151));for(var d=u=null,h=s,g=s=0,_=null,v=c.next();h!==null&&!v.done;g++,v=c.next()){h.index>g?(_=h,h=null):_=h.sibling;var y=p(a,h,v.value,l);if(y===null){h===null&&(h=_);break}e&&h&&y.alternate===null&&t(a,h),s=o(y,s,g),d===null?u=y:d.sibling=y,d=y,h=_}if(v.done)return n(a,h),Sa&&ga(a,g),u;if(h===null){for(;!v.done;g++,v=c.next())v=f(a,v.value,l),v!==null&&(s=o(v,s,g),d===null?u=v:d.sibling=v,d=v);return Sa&&ga(a,g),u}for(h=i(a,h);!v.done;g++,v=c.next())v=m(h,a,g,v.value,l),v!==null&&(e&&v.alternate!==null&&h.delete(v.key===null?g:v.key),s=o(v,s,g),d===null?u=v:d.sibling=v,d=v);return e&&h.forEach(function(e){return t(a,e)}),Sa&&ga(a,g),u}function _(e,r,i,o){if(typeof i==`object`&&i&&i.type===E&&i.key===null&&(i=i.props.children),typeof i==`object`&&i){switch(i.$$typeof){case w:a:{for(var c=i.key,l=r;l!==null;){if(l.key===c){if(c=i.type,c===E){if(l.tag===7){n(e,l.sibling),r=a(l,i.props.children),r.return=e,e=r;break a}}else if(l.elementType===c||typeof c==`object`&&c&&c.$$typeof===F&&Ia(c)===l.type){n(e,l.sibling),r=a(l,i.props),r.ref=Pa(e,l,i),r.return=e,e=r;break a}n(e,l);break}else t(e,l);l=l.sibling}i.type===E?(r=ru(i.props.children,e.mode,o,i.key),r.return=e,e=r):(o=nu(i.type,i.key,i.props,null,e.mode,o),o.ref=Pa(e,r,i),o.return=e,e=o)}return s(e);case T:a:{for(l=i.key;r!==null;){if(r.key===l)if(r.tag===4&&r.stateNode.containerInfo===i.containerInfo&&r.stateNode.implementation===i.implementation){n(e,r.sibling),r=a(r,i.children||[]),r.return=e,e=r;break a}else{n(e,r);break}else t(e,r);r=r.sibling}r=ou(i,e.mode,o),r.return=e,e=r}return s(e);case F:return l=i._init,_(e,r,l(i._payload),o)}if(me(i))return h(e,r,i,o);if(ee(i))return g(e,r,i,o);Fa(e,i)}return typeof i==`string`&&i!==``||typeof i==`number`?(i=``+i,r!==null&&r.tag===6?(n(e,r.sibling),r=a(r,i),r.return=e,e=r):(n(e,r),r=au(i,e.mode,o),r.return=e,e=r),s(e)):n(e,r)}return _}var Ra=La(!0),za=La(!1),Ba=Vi(null),Va=null,Ha=null,Ua=null;function Wa(){Ua=Ha=Va=null}function Ga(e){var t=Ba.current;Hi(Ba),e._currentValue=t}function Ka(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 qa(e,t){Va=e,Ua=Ha=null,e=e.dependencies,e!==null&&e.firstContext!==null&&((e.lanes&t)!==0&&(Ls=!0),e.firstContext=null)}function Ja(e){var t=e._currentValue;if(Ua!==e)if(e={context:e,memoizedValue:t,next:null},Ha===null){if(Va===null)throw Error(r(308));Ha=e,Va.dependencies={lanes:0,firstContext:e}}else Ha=Ha.next=e;return t}var Ya=null;function Xa(e){Ya===null?Ya=[e]:Ya.push(e)}function Za(e,t,n,r){var i=t.interleaved;return i===null?(n.next=n,Xa(t)):(n.next=i.next,i.next=n),t.interleaved=n,Qa(e,r)}function Qa(e,t){e.lanes|=t;var n=e.alternate;for(n!==null&&(n.lanes|=t),n=e,e=e.return;e!==null;)e.childLanes|=t,n=e.alternate,n!==null&&(n.childLanes|=t),n=e,e=e.return;return n.tag===3?n.stateNode:null}var $a=!1;function eo(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function to(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,effects:e.effects})}function no(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function ro(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,Kc&2){var i=r.pending;return i===null?t.next=t:(t.next=i.next,i.next=t),r.pending=t,Qa(e,n)}return i=r.interleaved,i===null?(t.next=t,Xa(r)):(t.next=i.next,i.next=t),r.interleaved=t,Qa(e,n)}function io(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,n&4194240)){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Ft(e,n)}}function ao(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={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,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,effects:r.effects},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}function oo(e,t,n,r){var i=e.updateQueue;$a=!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,p=s.eventTime;if((r&f)===f){u!==null&&(u=u.next={eventTime:p,lane:0,tag:s.tag,payload:s.payload,callback:s.callback,next:null});a:{var m=e,h=s;switch(f=t,p=n,h.tag){case 1:if(m=h.payload,typeof m==`function`){d=m.call(p,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(p,d,f):m,f==null)break a;d=R({},d,f);break a;case 2:$a=!0}}s.callback!==null&&s.lane!==0&&(e.flags|=64,f=i.effects,f===null?i.effects=[s]:f.push(s))}else p={eventTime: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;f=s,s=f.next,f.next=null,i.lastBaseUpdate=f,i.shared.pending=null}}while(1);if(u===null&&(c=d),i.baseState=c,i.firstBaseUpdate=l,i.lastBaseUpdate=u,t=i.shared.interleaved,t!==null){i=t;do o|=i.lane,i=i.next;while(i!==t)}else a===null&&(i.shared.lanes=0);el|=o,e.lanes=o,e.memoizedState=d}}function so(e,t,n){if(e=t.effects,t.effects=null,e!==null)for(t=0;t<e.length;t++){var i=e[t],a=i.callback;if(a!==null){if(i.callback=null,i=n,typeof a!=`function`)throw Error(r(191,a));a.call(i)}}}var co={},lo=Vi(co),uo=Vi(co),fo=Vi(co);function po(e){if(e===co)throw Error(r(174));return e}function mo(e,t){switch(Ui(fo,t),Ui(uo,e),Ui(lo,co),e=t.nodeType,e){case 9:case 11:t=(t=t.documentElement)?t.namespaceURI:xe(null,``);break;default:e=e===8?t.parentNode:t,t=e.namespaceURI||null,e=e.tagName,t=xe(t,e)}Hi(lo),Ui(lo,t)}function ho(){Hi(lo),Hi(uo),Hi(fo)}function go(e){po(fo.current);var t=po(lo.current),n=xe(t,e.type);t!==n&&(Ui(uo,e),Ui(lo,n))}function _o(e){uo.current===e&&(Hi(lo),Hi(uo))}var vo=Vi(0);function yo(e){for(var t=e;t!==null;){if(t.tag===13){var n=t.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||n.data===`$?`||n.data===`$!`))return t}else if(t.tag===19&&t.memoizedProps.revealOrder!==void 0){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 bo=[];function xo(){for(var e=0;e<bo.length;e++)bo[e]._workInProgressVersionPrimary=null;bo.length=0}var So=C.ReactCurrentDispatcher,Co=C.ReactCurrentBatchConfig,wo=0,To=null,Eo=null,Do=null,Oo=!1,ko=!1,Ao=0,jo=0;function Mo(){throw Error(r(321))}function No(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 Po(e,t,n,i,a,o){if(wo=o,To=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,So.current=e===null||e.memoizedState===null?_s:vs,e=n(i,a),ko){o=0;do{if(ko=!1,Ao=0,25<=o)throw Error(r(301));o+=1,Do=Eo=null,t.updateQueue=null,So.current=ys,e=n(i,a)}while(ko)}if(So.current=gs,t=Eo!==null&&Eo.next!==null,wo=0,Do=Eo=To=null,Oo=!1,t)throw Error(r(300));return e}function Fo(){var e=Ao!==0;return Ao=0,e}function Io(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Do===null?To.memoizedState=Do=e:Do=Do.next=e,Do}function Lo(){if(Eo===null){var e=To.alternate;e=e===null?null:e.memoizedState}else e=Eo.next;var t=Do===null?To.memoizedState:Do.next;if(t!==null)Do=t,Eo=e;else{if(e===null)throw Error(r(310));Eo=e,e={memoizedState:Eo.memoizedState,baseState:Eo.baseState,baseQueue:Eo.baseQueue,queue:Eo.queue,next:null},Do===null?To.memoizedState=Do=e:Do=Do.next=e}return Do}function Ro(e,t){return typeof t==`function`?t(e):t}function zo(e){var t=Lo(),n=t.queue;if(n===null)throw Error(r(311));n.lastRenderedReducer=e;var i=Eo,a=i.baseQueue,o=n.pending;if(o!==null){if(a!==null){var s=a.next;a.next=o.next,o.next=s}i.baseQueue=a=o,n.pending=null}if(a!==null){o=a.next,i=i.baseState;var c=s=null,l=null,u=o;do{var d=u.lane;if((wo&d)===d)l!==null&&(l=l.next={lane:0,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null}),i=u.hasEagerState?u.eagerState:e(i,u.action);else{var f={lane:d,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null};l===null?(c=l=f,s=i):l=l.next=f,To.lanes|=d,el|=d}u=u.next}while(u!==null&&u!==o);l===null?s=i:l.next=c,wr(i,t.memoizedState)||(Ls=!0),t.memoizedState=i,t.baseState=s,t.baseQueue=l,n.lastRenderedState=i}if(e=n.interleaved,e!==null){a=e;do o=a.lane,To.lanes|=o,el|=o,a=a.next;while(a!==e)}else a===null&&(n.lanes=0);return[t.memoizedState,n.dispatch]}function Bo(e){var t=Lo(),n=t.queue;if(n===null)throw Error(r(311));n.lastRenderedReducer=e;var i=n.dispatch,a=n.pending,o=t.memoizedState;if(a!==null){n.pending=null;var s=a=a.next;do o=e(o,s.action),s=s.next;while(s!==a);wr(o,t.memoizedState)||(Ls=!0),t.memoizedState=o,t.baseQueue===null&&(t.baseState=o),n.lastRenderedState=o}return[o,i]}function Vo(){}function Ho(e,t){var n=To,i=Lo(),a=t(),o=!wr(i.memoizedState,a);if(o&&(i.memoizedState=a,Ls=!0),i=i.queue,es(Go.bind(null,n,i,e),[e]),i.getSnapshot!==t||o||Do!==null&&Do.memoizedState.tag&1){if(n.flags|=2048,Yo(9,Wo.bind(null,n,i,a,t),void 0,null),qc===null)throw Error(r(349));wo&30||Uo(n,t,a)}return a}function Uo(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=To.updateQueue,t===null?(t={lastEffect:null,stores:null},To.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function Wo(e,t,n,r){t.value=n,t.getSnapshot=r,Ko(t)&&qo(e)}function Go(e,t,n){return n(function(){Ko(t)&&qo(e)})}function Ko(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!wr(e,n)}catch{return!0}}function qo(e){var t=Qa(e,1);t!==null&&bl(t,e,1,-1)}function Jo(e){var t=Io();return typeof e==`function`&&(e=e()),t.memoizedState=t.baseState=e,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:Ro,lastRenderedState:e},t.queue=e,e=e.dispatch=fs.bind(null,To,e),[t.memoizedState,e]}function Yo(e,t,n,r){return e={tag:e,create:t,destroy:n,deps:r,next:null},t=To.updateQueue,t===null?(t={lastEffect:null,stores:null},To.updateQueue=t,t.lastEffect=e.next=e):(n=t.lastEffect,n===null?t.lastEffect=e.next=e:(r=n.next,n.next=e,e.next=r,t.lastEffect=e)),e}function Xo(){return Lo().memoizedState}function Zo(e,t,n,r){var i=Io();To.flags|=e,i.memoizedState=Yo(1|t,n,void 0,r===void 0?null:r)}function Qo(e,t,n,r){var i=Lo();r=r===void 0?null:r;var a=void 0;if(Eo!==null){var o=Eo.memoizedState;if(a=o.destroy,r!==null&&No(r,o.deps)){i.memoizedState=Yo(t,n,a,r);return}}To.flags|=e,i.memoizedState=Yo(1|t,n,a,r)}function $o(e,t){return Zo(8390656,8,e,t)}function es(e,t){return Qo(2048,8,e,t)}function ts(e,t){return Qo(4,2,e,t)}function ns(e,t){return Qo(4,4,e,t)}function rs(e,t){if(typeof t==`function`)return e=e(),t(e),function(){t(null)};if(t!=null)return e=e(),t.current=e,function(){t.current=null}}function is(e,t,n){return n=n==null?null:n.concat([e]),Qo(4,4,rs.bind(null,t,e),n)}function as(){}function os(e,t){var n=Lo();t=t===void 0?null:t;var r=n.memoizedState;return r!==null&&t!==null&&No(t,r[1])?r[0]:(n.memoizedState=[e,t],e)}function ss(e,t){var n=Lo();t=t===void 0?null:t;var r=n.memoizedState;return r!==null&&t!==null&&No(t,r[1])?r[0]:(e=e(),n.memoizedState=[e,t],e)}function cs(e,t,n){return wo&21?(wr(n,t)||(n=jt(),To.lanes|=n,el|=n,e.baseState=!0),t):(e.baseState&&(e.baseState=!1,Ls=!0),e.memoizedState=n)}function ls(e,t){var n=It;It=n!==0&&4>n?n:4,e(!0);var r=Co.transition;Co.transition={};try{e(!1),t()}finally{It=n,Co.transition=r}}function us(){return Lo().memoizedState}function ds(e,t,n){var r=yl(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},ps(e))ms(t,n);else if(n=Za(e,t,n,r),n!==null){var i=vl();bl(n,e,r,i),hs(n,t,r)}}function fs(e,t,n){var r=yl(e),i={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(ps(e))ms(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)){var c=t.interleaved;c===null?(i.next=i,Xa(t)):(i.next=c.next,c.next=i),t.interleaved=i;return}}catch{}n=Za(e,t,i,r),n!==null&&(i=vl(),bl(n,e,r,i),hs(n,t,r))}}function ps(e){var t=e.alternate;return e===To||t!==null&&t===To}function ms(e,t){ko=Oo=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function hs(e,t,n){if(n&4194240){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Ft(e,n)}}var gs={readContext:Ja,useCallback:Mo,useContext:Mo,useEffect:Mo,useImperativeHandle:Mo,useInsertionEffect:Mo,useLayoutEffect:Mo,useMemo:Mo,useReducer:Mo,useRef:Mo,useState:Mo,useDebugValue:Mo,useDeferredValue:Mo,useTransition:Mo,useMutableSource:Mo,useSyncExternalStore:Mo,useId:Mo,unstable_isNewReconciler:!1},_s={readContext:Ja,useCallback:function(e,t){return Io().memoizedState=[e,t===void 0?null:t],e},useContext:Ja,useEffect:$o,useImperativeHandle:function(e,t,n){return n=n==null?null:n.concat([e]),Zo(4194308,4,rs.bind(null,t,e),n)},useLayoutEffect:function(e,t){return Zo(4194308,4,e,t)},useInsertionEffect:function(e,t){return Zo(4,2,e,t)},useMemo:function(e,t){var n=Io();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=Io();return t=n===void 0?t:n(t),r.memoizedState=r.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},r.queue=e,e=e.dispatch=ds.bind(null,To,e),[r.memoizedState,e]},useRef:function(e){var t=Io();return e={current:e},t.memoizedState=e},useState:Jo,useDebugValue:as,useDeferredValue:function(e){return Io().memoizedState=e},useTransition:function(){var e=Jo(!1),t=e[0];return e=ls.bind(null,e[1]),Io().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var i=To,a=Io();if(Sa){if(n===void 0)throw Error(r(407));n=n()}else{if(n=t(),qc===null)throw Error(r(349));wo&30||Uo(i,t,n)}a.memoizedState=n;var o={value:n,getSnapshot:t};return a.queue=o,$o(Go.bind(null,i,o,e),[e]),i.flags|=2048,Yo(9,Wo.bind(null,i,o,n,t),void 0,null),n},useId:function(){var e=Io(),t=qc.identifierPrefix;if(Sa){var n=ha,r=ma;n=(r&~(1<<32-bt(r)-1)).toString(32)+n,t=`:`+t+`R`+n,n=Ao++,0<n&&(t+=`H`+n.toString(32)),t+=`:`}else n=jo++,t=`:`+t+`r`+n.toString(32)+`:`;return e.memoizedState=t},unstable_isNewReconciler:!1},vs={readContext:Ja,useCallback:os,useContext:Ja,useEffect:es,useImperativeHandle:is,useInsertionEffect:ts,useLayoutEffect:ns,useMemo:ss,useReducer:zo,useRef:Xo,useState:function(){return zo(Ro)},useDebugValue:as,useDeferredValue:function(e){return cs(Lo(),Eo.memoizedState,e)},useTransition:function(){return[zo(Ro)[0],Lo().memoizedState]},useMutableSource:Vo,useSyncExternalStore:Ho,useId:us,unstable_isNewReconciler:!1},ys={readContext:Ja,useCallback:os,useContext:Ja,useEffect:es,useImperativeHandle:is,useInsertionEffect:ts,useLayoutEffect:ns,useMemo:ss,useReducer:Bo,useRef:Xo,useState:function(){return Bo(Ro)},useDebugValue:as,useDeferredValue:function(e){var t=Lo();return Eo===null?t.memoizedState=e:cs(t,Eo.memoizedState,e)},useTransition:function(){return[Bo(Ro)[0],Lo().memoizedState]},useMutableSource:Vo,useSyncExternalStore:Ho,useId:us,unstable_isNewReconciler:!1};function bs(e,t){if(e&&e.defaultProps){for(var n in t=R({},t),e=e.defaultProps,e)t[n]===void 0&&(t[n]=e[n]);return t}return t}function xs(e,t,n,r){t=e.memoizedState,n=n(r,t),n=n==null?t:R({},t,n),e.memoizedState=n,e.lanes===0&&(e.updateQueue.baseState=n)}var Ss={isMounted:function(e){return(e=e._reactInternals)?et(e)===e:!1},enqueueSetState:function(e,t,n){e=e._reactInternals;var r=vl(),i=yl(e),a=no(r,i);a.payload=t,n!=null&&(a.callback=n),t=ro(e,a,i),t!==null&&(bl(t,e,i,r),io(t,e,i))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var r=vl(),i=yl(e),a=no(r,i);a.tag=1,a.payload=t,n!=null&&(a.callback=n),t=ro(e,a,i),t!==null&&(bl(t,e,i,r),io(t,e,i))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=vl(),r=yl(e),i=no(n,r);i.tag=2,t!=null&&(i.callback=t),t=ro(e,i,r),t!==null&&(bl(t,e,r,n),io(t,e,r))}};function Cs(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?!Tr(n,r)||!Tr(i,a):!0}function ws(e,t,n){var r=!1,i=Wi,a=t.contextType;return typeof a==`object`&&a?a=Ja(a):(i=Yi(t)?qi:Gi.current,r=t.contextTypes,a=(r=r!=null)?Ji(e,i):Wi),t=new t(n,a),e.memoizedState=t.state!==null&&t.state!==void 0?t.state:null,t.updater=Ss,e.stateNode=t,t._reactInternals=e,r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=i,e.__reactInternalMemoizedMaskedChildContext=a),t}function Ts(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&&Ss.enqueueReplaceState(t,t.state,null)}function Es(e,t,n,r){var i=e.stateNode;i.props=n,i.state=e.memoizedState,i.refs={},eo(e);var a=t.contextType;typeof a==`object`&&a?i.context=Ja(a):(a=Yi(t)?qi:Gi.current,i.context=Ji(e,a)),i.state=e.memoizedState,a=t.getDerivedStateFromProps,typeof a==`function`&&(xs(e,t,a,n),i.state=e.memoizedState),typeof t.getDerivedStateFromProps==`function`||typeof i.getSnapshotBeforeUpdate==`function`||typeof i.UNSAFE_componentWillMount!=`function`&&typeof i.componentWillMount!=`function`||(t=i.state,typeof i.componentWillMount==`function`&&i.componentWillMount(),typeof i.UNSAFE_componentWillMount==`function`&&i.UNSAFE_componentWillMount(),t!==i.state&&Ss.enqueueReplaceState(i,i.state,null),oo(e,n,i,r),i.state=e.memoizedState),typeof i.componentDidMount==`function`&&(e.flags|=4194308)}function Ds(e,t){try{var n=``,r=t;do n+=ne(r),r=r.return;while(r);var i=n}catch(e){i=`
|
|
5
|
+
`+i[o].replace(` at new `,` at `);return e.displayName&&c.includes(`<anonymous>`)&&(c=c.replace(`<anonymous>`,e.displayName)),c}while(1<=o&&0<=s);break}}}finally{ee=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:``)?V(e):``}function te(e){switch(e.tag){case 5:return V(e.type);case 16:return V(`Lazy`);case 13:return V(`Suspense`);case 19:return V(`SuspenseList`);case 0:case 2:case 15:return e=H(e.type,!1),e;case 11:return e=H(e.type.render,!1),e;case 1:return e=H(e.type,!0),e;default:return``}}function U(e){if(e==null)return null;if(typeof e==`function`)return e.displayName||e.name||null;if(typeof e==`string`)return e;switch(e){case E:return`Fragment`;case T:return`Portal`;case O:return`Profiler`;case D:return`StrictMode`;case M:return`Suspense`;case N:return`SuspenseList`}if(typeof e==`object`)switch(e.$$typeof){case A:return(e.displayName||`Context`)+`.Consumer`;case k:return(e._context.displayName||`Context`)+`.Provider`;case j:var t=e.render;return e=e.displayName,e||=(e=t.displayName||t.name||``,e===``?`ForwardRef`:`ForwardRef(`+e+`)`),e;case P:return t=e.displayName||null,t===null?U(e.type)||`Memo`:t;case F:t=e._payload,e=e._init;try{return U(e(t))}catch{}}return null}function ne(e){var t=e.type;switch(e.tag){case 24:return`Cache`;case 9:return(t.displayName||`Context`)+`.Consumer`;case 10:return(t._context.displayName||`Context`)+`.Provider`;case 18:return`DehydratedFragment`;case 11:return e=t.render,e=e.displayName||e.name||``,t.displayName||(e===``?`ForwardRef`:`ForwardRef(`+e+`)`);case 7:return`Fragment`;case 5:return t;case 4:return`Portal`;case 3:return`Root`;case 6:return`Text`;case 16:return U(t);case 8:return t===D?`StrictMode`:`Mode`;case 22:return`Offscreen`;case 12:return`Profiler`;case 21:return`Scope`;case 13:return`Suspense`;case 19:return`SuspenseList`;case 25:return`TracingMarker`;case 1:case 0:case 17:case 2:case 14:case 15:if(typeof t==`function`)return t.displayName||t.name||null;if(typeof t==`string`)return t}return null}function re(e){switch(typeof e){case`boolean`:case`number`:case`string`:case`undefined`:return e;case`object`:return e;default:return``}}function ie(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()===`input`&&(t===`checkbox`||t===`radio`)}function ae(e){var t=ie(e)?`checked`:`value`,n=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),r=``+e[t];if(!e.hasOwnProperty(t)&&n!==void 0&&typeof n.get==`function`&&typeof n.set==`function`){var i=n.get,a=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return i.call(this)},set:function(e){r=``+e,a.call(this,e)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(e){r=``+e},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function W(e){e._valueTracker||=ae(e)}function oe(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r=``;return e&&(r=ie(e)?e.checked?`true`:`false`:e.value),e=r,e===n?!1:(t.setValue(e),!0)}function se(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 ce(e,t){var n=t.checked;return z({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function le(e,t){var n=t.defaultValue==null?``:t.defaultValue,r=t.checked==null?t.defaultChecked:t.checked;n=re(t.value==null?n:t.value),e._wrapperState={initialChecked:r,initialValue:n,controlled:t.type===`checkbox`||t.type===`radio`?t.checked!=null:t.value!=null}}function ue(e,t){t=t.checked,t!=null&&S(e,`checked`,t,!1)}function de(e,t){ue(e,t);var n=re(t.value),r=t.type;if(n!=null)r===`number`?(n===0&&e.value===``||e.value!=n)&&(e.value=``+n):e.value!==``+n&&(e.value=``+n);else if(r===`submit`||r===`reset`){e.removeAttribute(`value`);return}t.hasOwnProperty(`value`)?pe(e,t.type,n):t.hasOwnProperty(`defaultValue`)&&pe(e,t.type,re(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function fe(e,t,n){if(t.hasOwnProperty(`value`)||t.hasOwnProperty(`defaultValue`)){var r=t.type;if(!(r!==`submit`&&r!==`reset`||t.value!==void 0&&t.value!==null))return;t=``+e._wrapperState.initialValue,n||t===e.value||(e.value=t),e.defaultValue=t}n=e.name,n!==``&&(e.name=``),e.defaultChecked=!!e._wrapperState.initialChecked,n!==``&&(e.name=n)}function pe(e,t,n){(t!==`number`||se(e.ownerDocument)!==e)&&(n==null?e.defaultValue=``+e._wrapperState.initialValue:e.defaultValue!==``+n&&(e.defaultValue=``+n))}var me=Array.isArray;function he(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=``+re(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 ge(e,t){if(t.dangerouslySetInnerHTML!=null)throw Error(r(91));return z({},t,{value:void 0,defaultValue:void 0,children:``+e._wrapperState.initialValue})}function _e(e,t){var n=t.value;if(n==null){if(n=t.children,t=t.defaultValue,n!=null){if(t!=null)throw Error(r(92));if(me(n)){if(1<n.length)throw Error(r(93));n=n[0]}t=n}t??=``,n=t}e._wrapperState={initialValue:re(n)}}function ve(e,t){var n=re(t.value),r=re(t.defaultValue);n!=null&&(n=``+n,n!==e.value&&(e.value=n),t.defaultValue==null&&e.defaultValue!==n&&(e.defaultValue=n)),r!=null&&(e.defaultValue=``+r)}function ye(e){var t=e.textContent;t===e._wrapperState.initialValue&&t!==``&&t!==null&&(e.value=t)}function be(e){switch(e){case`svg`:return`http://www.w3.org/2000/svg`;case`math`:return`http://www.w3.org/1998/Math/MathML`;default:return`http://www.w3.org/1999/xhtml`}}function xe(e,t){return e==null||e===`http://www.w3.org/1999/xhtml`?be(t):e===`http://www.w3.org/2000/svg`&&t===`foreignObject`?`http://www.w3.org/1999/xhtml`:e}var Se,Ce=function(e){return typeof MSApp<`u`&&MSApp.execUnsafeLocalFunction?function(t,n,r,i){MSApp.execUnsafeLocalFunction(function(){return e(t,n,r,i)})}:e}(function(e,t){if(e.namespaceURI!==`http://www.w3.org/2000/svg`||`innerHTML`in e)e.innerHTML=t;else{for(Se||=document.createElement(`div`),Se.innerHTML=`<svg>`+t.valueOf().toString()+`</svg>`,t=Se.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function we(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var Te={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},Ee=[`Webkit`,`ms`,`Moz`,`O`];Object.keys(Te).forEach(function(e){Ee.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),Te[t]=Te[e]})});function De(e,t,n){return t==null||typeof t==`boolean`||t===``?``:n||typeof t!=`number`||t===0||Te.hasOwnProperty(e)&&Te[e]?(``+t).trim():t+`px`}function Oe(e,t){for(var n in e=e.style,t)if(t.hasOwnProperty(n)){var r=n.indexOf(`--`)===0,i=De(n,t[n],r);n===`float`&&(n=`cssFloat`),r?e.setProperty(n,i):e[n]=i}}var ke=z({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function Ae(e,t){if(t){if(ke[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(r(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(r(60));if(typeof t.dangerouslySetInnerHTML!=`object`||!(`__html`in t.dangerouslySetInnerHTML))throw Error(r(61))}if(t.style!=null&&typeof t.style!=`object`)throw Error(r(62))}}function je(e,t){if(e.indexOf(`-`)===-1)return typeof t.is==`string`;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 Me=null;function Ne(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Pe=null,Fe=null,Ie=null;function Le(e){if(e=Ii(e)){if(typeof Pe!=`function`)throw Error(r(280));var t=e.stateNode;t&&(t=Ri(t),Pe(e.stateNode,e.type,t))}}function Re(e){Fe?Ie?Ie.push(e):Ie=[e]:Fe=e}function ze(){if(Fe){var e=Fe,t=Ie;if(Ie=Fe=null,Le(e),t)for(e=0;e<t.length;e++)Le(t[e])}}function Be(e,t){return e(t)}function Ve(){}var He=!1;function Ue(e,t,n){if(He)return e(t,n);He=!0;try{return Be(e,t,n)}finally{He=!1,(Fe!==null||Ie!==null)&&(Ve(),ze())}}function We(e,t){var n=e.stateNode;if(n===null)return null;var i=Ri(n);if(i===null)return null;n=i[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`:(i=!i.disabled)||(e=e.type,i=!(e===`button`||e===`input`||e===`select`||e===`textarea`)),e=!i;break a;default:e=!1}if(e)return null;if(n&&typeof n!=`function`)throw Error(r(231,t,typeof n));return n}var Ge=!1;if(c)try{var Ke={};Object.defineProperty(Ke,`passive`,{get:function(){Ge=!0}}),window.addEventListener(`test`,Ke,Ke),window.removeEventListener(`test`,Ke,Ke)}catch{Ge=!1}function qe(e,t,n,r,i,a,o,s,c){var l=Array.prototype.slice.call(arguments,3);try{t.apply(n,l)}catch(e){this.onError(e)}}var Je=!1,Ye=null,Xe=!1,Ze=null,Qe={onError:function(e){Je=!0,Ye=e}};function G(e,t,n,r,i,a,o,s,c){Je=!1,Ye=null,qe.apply(Qe,arguments)}function $e(e,t,n,i,a,o,s,c,l){if(G.apply(this,arguments),Je){if(Je){var u=Ye;Je=!1,Ye=null}else throw Error(r(198));Xe||(Xe=!0,Ze=u)}}function et(e){var t=e,n=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,t.flags&4098&&(n=t.return),e=t.return;while(e)}return t.tag===3?n:null}function tt(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 nt(e){if(et(e)!==e)throw Error(r(188))}function rt(e){var t=e.alternate;if(!t){if(t=et(e),t===null)throw Error(r(188));return t===e?e:null}for(var n=e,i=t;;){var a=n.return;if(a===null)break;var o=a.alternate;if(o===null){if(i=a.return,i!==null){n=i;continue}break}if(a.child===o.child){for(o=a.child;o;){if(o===n)return nt(a),e;if(o===i)return nt(a),t;o=o.sibling}throw Error(r(188))}if(n.return!==i.return)n=a,i=o;else{for(var s=!1,c=a.child;c;){if(c===n){s=!0,n=a,i=o;break}if(c===i){s=!0,i=a,n=o;break}c=c.sibling}if(!s){for(c=o.child;c;){if(c===n){s=!0,n=o,i=a;break}if(c===i){s=!0,i=o,n=a;break}c=c.sibling}if(!s)throw Error(r(189))}}if(n.alternate!==i)throw Error(r(190))}if(n.tag!==3)throw Error(r(188));return n.stateNode.current===n?e:t}function it(e){return e=rt(e),e===null?null:at(e)}function at(e){if(e.tag===5||e.tag===6)return e;for(e=e.child;e!==null;){var t=at(e);if(t!==null)return t;e=e.sibling}return null}var ot=n.unstable_scheduleCallback,st=n.unstable_cancelCallback,ct=n.unstable_shouldYield,lt=n.unstable_requestPaint,ut=n.unstable_now,dt=n.unstable_getCurrentPriorityLevel,ft=n.unstable_ImmediatePriority,pt=n.unstable_UserBlockingPriority,mt=n.unstable_NormalPriority,ht=n.unstable_LowPriority,gt=n.unstable_IdlePriority,_t=null,vt=null;function yt(e){if(vt&&typeof vt.onCommitFiberRoot==`function`)try{vt.onCommitFiberRoot(_t,e,void 0,(e.current.flags&128)==128)}catch{}}var bt=Math.clz32?Math.clz32:Ct,xt=Math.log,St=Math.LN2;function Ct(e){return e>>>=0,e===0?32:31-(xt(e)/St|0)|0}var wt=64,Tt=4194304;function Et(e){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: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 e&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return e&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function Dt(e,t){var n=e.pendingLanes;if(n===0)return 0;var r=0,i=e.suspendedLanes,a=e.pingedLanes,o=n&268435455;if(o!==0){var s=o&~i;s===0?(a&=o,a!==0&&(r=Et(a))):r=Et(s)}else o=n&~i,o===0?a!==0&&(r=Et(a)):r=Et(o);if(r===0)return 0;if(t!==0&&t!==r&&(t&i)===0&&(i=r&-r,a=t&-t,i>=a||i===16&&a&4194240))return t;if(r&4&&(r|=n&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=r;0<t;)n=31-bt(t),i=1<<n,r|=e[n],t&=~i;return r}function Ot(e,t){switch(e){case 1:case 2:case 4:return t+250;case 8:case 16:case 32:case 64: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:case 67108864:return-1;case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function kt(e,t){for(var n=e.suspendedLanes,r=e.pingedLanes,i=e.expirationTimes,a=e.pendingLanes;0<a;){var o=31-bt(a),s=1<<o,c=i[o];c===-1?((s&n)===0||(s&r)!==0)&&(i[o]=Ot(s,t)):c<=t&&(e.expiredLanes|=s),a&=~s}}function At(e){return e=e.pendingLanes&-1073741825,e===0?e&1073741824?1073741824:0:e}function jt(){var e=wt;return wt<<=1,!(wt&4194240)&&(wt=64),e}function Mt(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function Nt(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-bt(t),e[t]=n}function Pt(e,t){var n=e.pendingLanes&~t;e.pendingLanes=t,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=t,e.mutableReadLanes&=t,e.entangledLanes&=t,t=e.entanglements;var r=e.eventTimes;for(e=e.expirationTimes;0<n;){var i=31-bt(n),a=1<<i;t[i]=0,r[i]=-1,e[i]=-1,n&=~a}}function Ft(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var r=31-bt(n),i=1<<r;i&t|e[r]&t&&(e[r]|=t),n&=~i}}var It=0;function Lt(e){return e&=-e,1<e?4<e?e&268435455?16:536870912:4:1}var Rt,zt,Bt,Vt,Ht,Ut=!1,Wt=[],Gt=null,Kt=null,qt=null,Jt=new Map,Yt=new Map,Xt=[],Zt=`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 submit`.split(` `);function Qt(e,t){switch(e){case`focusin`:case`focusout`:Gt=null;break;case`dragenter`:case`dragleave`:Kt=null;break;case`mouseover`:case`mouseout`:qt=null;break;case`pointerover`:case`pointerout`:Jt.delete(t.pointerId);break;case`gotpointercapture`:case`lostpointercapture`:Yt.delete(t.pointerId)}}function $t(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=Ii(t),t!==null&&zt(t)),e):(e.eventSystemFlags|=r,t=e.targetContainers,i!==null&&t.indexOf(i)===-1&&t.push(i),e)}function en(e,t,n,r,i){switch(t){case`focusin`:return Gt=$t(Gt,e,t,n,r,i),!0;case`dragenter`:return Kt=$t(Kt,e,t,n,r,i),!0;case`mouseover`:return qt=$t(qt,e,t,n,r,i),!0;case`pointerover`:var a=i.pointerId;return Jt.set(a,$t(Jt.get(a)||null,e,t,n,r,i)),!0;case`gotpointercapture`:return a=i.pointerId,Yt.set(a,$t(Yt.get(a)||null,e,t,n,r,i)),!0}return!1}function tn(e){var t=Fi(e.target);if(t!==null){var n=et(t);if(n!==null){if(t=n.tag,t===13){if(t=tt(n),t!==null){e.blockedOn=t,Ht(e.priority,function(){Bt(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 nn(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=mn(e.domEventName,e.eventSystemFlags,t[0],e.nativeEvent);if(n===null){n=e.nativeEvent;var r=new n.constructor(n.type,n);Me=r,n.target.dispatchEvent(r),Me=null}else return t=Ii(n),t!==null&&zt(t),e.blockedOn=n,!1;t.shift()}return!0}function rn(e,t,n){nn(e)&&n.delete(t)}function an(){Ut=!1,Gt!==null&&nn(Gt)&&(Gt=null),Kt!==null&&nn(Kt)&&(Kt=null),qt!==null&&nn(qt)&&(qt=null),Jt.forEach(rn),Yt.forEach(rn)}function on(e,t){e.blockedOn===t&&(e.blockedOn=null,Ut||(Ut=!0,n.unstable_scheduleCallback(n.unstable_NormalPriority,an)))}function sn(e){function t(t){return on(t,e)}if(0<Wt.length){on(Wt[0],e);for(var n=1;n<Wt.length;n++){var r=Wt[n];r.blockedOn===e&&(r.blockedOn=null)}}for(Gt!==null&&on(Gt,e),Kt!==null&&on(Kt,e),qt!==null&&on(qt,e),Jt.forEach(t),Yt.forEach(t),n=0;n<Xt.length;n++)r=Xt[n],r.blockedOn===e&&(r.blockedOn=null);for(;0<Xt.length&&(n=Xt[0],n.blockedOn===null);)tn(n),n.blockedOn===null&&Xt.shift()}var cn=C.ReactCurrentBatchConfig,ln=!0;function un(e,t,n,r){var i=It,a=cn.transition;cn.transition=null;try{It=1,fn(e,t,n,r)}finally{It=i,cn.transition=a}}function dn(e,t,n,r){var i=It,a=cn.transition;cn.transition=null;try{It=4,fn(e,t,n,r)}finally{It=i,cn.transition=a}}function fn(e,t,n,r){if(ln){var i=mn(e,t,n,r);if(i===null)si(e,t,r,pn,n),Qt(e,r);else if(en(i,e,t,n,r))r.stopPropagation();else if(Qt(e,r),t&4&&-1<Zt.indexOf(e)){for(;i!==null;){var a=Ii(i);if(a!==null&&Rt(a),a=mn(e,t,n,r),a===null&&si(e,t,r,pn,n),a===i)break;i=a}i!==null&&r.stopPropagation()}else si(e,t,r,null,n)}}var pn=null;function mn(e,t,n,r){if(pn=null,e=Ne(r),e=Fi(e),e!==null)if(t=et(e),t===null)e=null;else if(n=t.tag,n===13){if(e=tt(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 pn=e,null}function hn(e){switch(e){case`cancel`:case`click`:case`close`:case`contextmenu`:case`copy`:case`cut`:case`auxclick`:case`dblclick`:case`dragend`:case`dragstart`:case`drop`:case`focusin`:case`focusout`:case`input`:case`invalid`:case`keydown`:case`keypress`:case`keyup`:case`mousedown`:case`mouseup`:case`paste`:case`pause`:case`play`:case`pointercancel`:case`pointerdown`:case`pointerup`:case`ratechange`:case`reset`:case`resize`:case`seeked`:case`submit`:case`touchcancel`:case`touchend`:case`touchstart`:case`volumechange`:case`change`:case`selectionchange`:case`textInput`:case`compositionstart`:case`compositionend`:case`compositionupdate`:case`beforeblur`:case`afterblur`:case`beforeinput`:case`blur`:case`fullscreenchange`:case`focus`:case`hashchange`:case`popstate`:case`select`:case`selectstart`:return 1;case`drag`:case`dragenter`:case`dragexit`:case`dragleave`:case`dragover`:case`mousemove`:case`mouseout`:case`mouseover`:case`pointermove`:case`pointerout`:case`pointerover`:case`scroll`:case`toggle`:case`touchmove`:case`wheel`:case`mouseenter`:case`mouseleave`:case`pointerenter`:case`pointerleave`:return 4;case`message`:switch(dt()){case ft:return 1;case pt:return 4;case mt:case ht:return 16;case gt:return 536870912;default:return 16}default:return 16}}var gn=null,_n=null,vn=null;function yn(){if(vn)return vn;var e,t=_n,n=t.length,r,i=`value`in gn?gn.value:gn.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 vn=i.slice(e,1<r?1-r:void 0)}function bn(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 xn(){return!0}function Sn(){return!1}function Cn(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)?xn:Sn,this.isPropagationStopped=Sn,this}return z(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=xn)},stopPropagation:function(){var e=this.nativeEvent;e&&(e.stopPropagation?e.stopPropagation():typeof e.cancelBubble!=`unknown`&&(e.cancelBubble=!0),this.isPropagationStopped=xn)},persist:function(){},isPersistent:xn}),t}var wn={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Tn=Cn(wn),En=z({},wn,{view:0,detail:0}),K=Cn(En),Dn,On,kn,An=z({},En,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Vn,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!==kn&&(kn&&e.type===`mousemove`?(Dn=e.screenX-kn.screenX,On=e.screenY-kn.screenY):On=Dn=0,kn=e),Dn)},movementY:function(e){return`movementY`in e?e.movementY:On}}),jn=Cn(An),Mn=Cn(z({},An,{dataTransfer:0})),Nn=Cn(z({},En,{relatedTarget:0})),Pn=Cn(z({},wn,{animationName:0,elapsedTime:0,pseudoElement:0})),Fn=Cn(z({},wn,{clipboardData:function(e){return`clipboardData`in e?e.clipboardData:window.clipboardData}})),In=Cn(z({},wn,{data:0})),Ln={Esc:`Escape`,Spacebar:` `,Left:`ArrowLeft`,Up:`ArrowUp`,Right:`ArrowRight`,Down:`ArrowDown`,Del:`Delete`,Win:`OS`,Menu:`ContextMenu`,Apps:`ContextMenu`,Scroll:`ScrollLock`,MozPrintableKey:`Unidentified`},Rn={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`},zn={Alt:`altKey`,Control:`ctrlKey`,Meta:`metaKey`,Shift:`shiftKey`};function Bn(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=zn[e])?!!t[e]:!1}function Vn(){return Bn}var Hn=Cn(z({},En,{key:function(e){if(e.key){var t=Ln[e.key]||e.key;if(t!==`Unidentified`)return t}return e.type===`keypress`?(e=bn(e),e===13?`Enter`:String.fromCharCode(e)):e.type===`keydown`||e.type===`keyup`?Rn[e.keyCode]||`Unidentified`:``},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Vn,charCode:function(e){return e.type===`keypress`?bn(e):0},keyCode:function(e){return e.type===`keydown`||e.type===`keyup`?e.keyCode:0},which:function(e){return e.type===`keypress`?bn(e):e.type===`keydown`||e.type===`keyup`?e.keyCode:0}})),Un=Cn(z({},An,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0})),Wn=Cn(z({},En,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Vn})),Gn=Cn(z({},wn,{propertyName:0,elapsedTime:0,pseudoElement:0})),Kn=Cn(z({},An,{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})),qn=[9,13,27,32],Jn=c&&`CompositionEvent`in window,Yn=null;c&&`documentMode`in document&&(Yn=document.documentMode);var Xn=c&&`TextEvent`in window&&!Yn,Zn=c&&(!Jn||Yn&&8<Yn&&11>=Yn),Qn=` `,$n=!1;function er(e,t){switch(e){case`keyup`:return qn.indexOf(t.keyCode)!==-1;case`keydown`:return t.keyCode!==229;case`keypress`:case`mousedown`:case`focusout`:return!0;default:return!1}}function tr(e){return e=e.detail,typeof e==`object`&&`data`in e?e.data:null}var nr=!1;function rr(e,t){switch(e){case`compositionend`:return tr(t);case`keypress`:return t.which===32?($n=!0,Qn):null;case`textInput`:return e=t.data,e===Qn&&$n?null:e;default:return null}}function ir(e,t){if(nr)return e===`compositionend`||!Jn&&er(e,t)?(e=yn(),vn=_n=gn=null,nr=!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 Zn&&t.locale!==`ko`?null:t.data;default:return null}}var ar={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function or(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t===`input`?!!ar[e.type]:t===`textarea`}function sr(e,t,n,r){Re(r),t=li(t,`onChange`),0<t.length&&(n=new Tn(`onChange`,`change`,null,n,r),e.push({event:n,listeners:t}))}var cr=null,lr=null;function ur(e){ti(e,0)}function dr(e){if(oe(Li(e)))return e}function fr(e,t){if(e===`change`)return t}var pr=!1;if(c){var mr;if(c){var hr=`oninput`in document;if(!hr){var gr=document.createElement(`div`);gr.setAttribute(`oninput`,`return;`),hr=typeof gr.oninput==`function`}mr=hr}else mr=!1;pr=mr&&(!document.documentMode||9<document.documentMode)}function _r(){cr&&(cr.detachEvent(`onpropertychange`,vr),lr=cr=null)}function vr(e){if(e.propertyName===`value`&&dr(lr)){var t=[];sr(t,lr,e,Ne(e)),Ue(ur,t)}}function yr(e,t,n){e===`focusin`?(_r(),cr=t,lr=n,cr.attachEvent(`onpropertychange`,vr)):e===`focusout`&&_r()}function br(e){if(e===`selectionchange`||e===`keyup`||e===`keydown`)return dr(lr)}function xr(e,t){if(e===`click`)return dr(t)}function Sr(e,t){if(e===`input`||e===`change`)return dr(t)}function Cr(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var wr=typeof Object.is==`function`?Object.is:Cr;function Tr(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(!l.call(t,i)||!wr(e[i],t[i]))return!1}return!0}function Er(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function Dr(e,t){var n=Er(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=Er(n)}}function Or(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Or(e,t.parentNode):`contains`in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function kr(){for(var e=window,t=se();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href==`string`}catch{n=!1}if(n)e=t.contentWindow;else break;t=se(e.document)}return t}function Ar(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`)}function jr(e){var t=kr(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&Or(n.ownerDocument.documentElement,n)){if(r!==null&&Ar(n)){if(t=r.start,e=r.end,e===void 0&&(e=t),`selectionStart`in n)n.selectionStart=t,n.selectionEnd=Math.min(e,n.value.length);else if(e=(t=n.ownerDocument||document)&&t.defaultView||window,e.getSelection){e=e.getSelection();var i=n.textContent.length,a=Math.min(r.start,i);r=r.end===void 0?a:Math.min(r.end,i),!e.extend&&a>r&&(i=r,r=a,a=i),i=Dr(n,a);var o=Dr(n,r);i&&o&&(e.rangeCount!==1||e.anchorNode!==i.node||e.anchorOffset!==i.offset||e.focusNode!==o.node||e.focusOffset!==o.offset)&&(t=t.createRange(),t.setStart(i.node,i.offset),e.removeAllRanges(),a>r?(e.addRange(t),e.extend(o.node,o.offset)):(t.setEnd(o.node,o.offset),e.addRange(t)))}}for(t=[],e=n;e=e.parentNode;)e.nodeType===1&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof n.focus==`function`&&n.focus(),n=0;n<t.length;n++)e=t[n],e.element.scrollLeft=e.left,e.element.scrollTop=e.top}}var Mr=c&&`documentMode`in document&&11>=document.documentMode,Nr=null,Pr=null,Fr=null,Ir=!1;function Lr(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Ir||Nr==null||Nr!==se(r)||(r=Nr,`selectionStart`in r&&Ar(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}),Fr&&Tr(Fr,r)||(Fr=r,r=li(Pr,`onSelect`),0<r.length&&(t=new Tn(`onSelect`,`select`,null,t,n),e.push({event:t,listeners:r}),t.target=Nr)))}function Rr(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n[`Webkit`+e]=`webkit`+t,n[`Moz`+e]=`moz`+t,n}var zr={animationend:Rr(`Animation`,`AnimationEnd`),animationiteration:Rr(`Animation`,`AnimationIteration`),animationstart:Rr(`Animation`,`AnimationStart`),transitionend:Rr(`Transition`,`TransitionEnd`)},Br={},Vr={};c&&(Vr=document.createElement(`div`).style,`AnimationEvent`in window||(delete zr.animationend.animation,delete zr.animationiteration.animation,delete zr.animationstart.animation),`TransitionEvent`in window||delete zr.transitionend.transition);function Hr(e){if(Br[e])return Br[e];if(!zr[e])return e;var t=zr[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in Vr)return Br[e]=t[n];return e}var Ur=Hr(`animationend`),Wr=Hr(`animationiteration`),Gr=Hr(`animationstart`),Kr=Hr(`transitionend`),qr=new Map,Jr=`abort auxClick cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel`.split(` `);function Yr(e,t){qr.set(e,t),o(t,[e])}for(var Xr=0;Xr<Jr.length;Xr++){var Zr=Jr[Xr];Yr(Zr.toLowerCase(),`on`+(Zr[0].toUpperCase()+Zr.slice(1)))}Yr(Ur,`onAnimationEnd`),Yr(Wr,`onAnimationIteration`),Yr(Gr,`onAnimationStart`),Yr(`dblclick`,`onDoubleClick`),Yr(`focusin`,`onFocus`),Yr(`focusout`,`onBlur`),Yr(Kr,`onTransitionEnd`),s(`onMouseEnter`,[`mouseout`,`mouseover`]),s(`onMouseLeave`,[`mouseout`,`mouseover`]),s(`onPointerEnter`,[`pointerout`,`pointerover`]),s(`onPointerLeave`,[`pointerout`,`pointerover`]),o(`onChange`,`change click focusin focusout input keydown keyup selectionchange`.split(` `)),o(`onSelect`,`focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange`.split(` `)),o(`onBeforeInput`,[`compositionend`,`keypress`,`textInput`,`paste`]),o(`onCompositionEnd`,`compositionend focusout keydown keypress keyup mousedown`.split(` `)),o(`onCompositionStart`,`compositionstart focusout keydown keypress keyup mousedown`.split(` `)),o(`onCompositionUpdate`,`compositionupdate focusout keydown keypress keyup mousedown`.split(` `));var Qr=`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(` `),$r=new Set(`cancel close invalid load scroll toggle`.split(` `).concat(Qr));function ei(e,t,n){var r=e.type||`unknown-event`;e.currentTarget=n,$e(r,t,void 0,e),e.currentTarget=null}function ti(e,t){t=(t&4)!=0;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;ei(i,s,l),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;ei(i,s,l),a=c}}}if(Xe)throw e=Ze,Xe=!1,Ze=null,e}function ni(e,t){var n=t[Mi];n===void 0&&(n=t[Mi]=new Set);var r=e+`__bubble`;n.has(r)||(oi(t,e,2,!1),n.add(r))}function ri(e,t,n){var r=0;t&&(r|=4),oi(n,e,r,t)}var ii=`_reactListening`+Math.random().toString(36).slice(2);function ai(e){if(!e[ii]){e[ii]=!0,i.forEach(function(t){t!==`selectionchange`&&($r.has(t)||ri(t,!1,e),ri(t,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[ii]||(t[ii]=!0,ri(`selectionchange`,!1,t))}}function oi(e,t,n,r){switch(hn(t)){case 1:var i=un;break;case 4:i=dn;break;default:i=fn}n=i.bind(null,t,n,e),i=void 0,!Ge||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 si(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||s.nodeType===8&&s.parentNode===i)break;if(o===4)for(o=r.return;o!==null;){var c=o.tag;if((c===3||c===4)&&(c=o.stateNode.containerInfo,c===i||c.nodeType===8&&c.parentNode===i))return;o=o.return}for(;s!==null;){if(o=Fi(s),o===null)return;if(c=o.tag,c===5||c===6){r=a=o;continue a}s=s.parentNode}}r=r.return}Ue(function(){var r=a,i=Ne(n),o=[];a:{var s=qr.get(e);if(s!==void 0){var c=Tn,l=e;switch(e){case`keypress`:if(bn(n)===0)break a;case`keydown`:case`keyup`:c=Hn;break;case`focusin`:l=`focus`,c=Nn;break;case`focusout`:l=`blur`,c=Nn;break;case`beforeblur`:case`afterblur`:c=Nn;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=jn;break;case`drag`:case`dragend`:case`dragenter`:case`dragexit`:case`dragleave`:case`dragover`:case`dragstart`:case`drop`:c=Mn;break;case`touchcancel`:case`touchend`:case`touchmove`:case`touchstart`:c=Wn;break;case Ur:case Wr:case Gr:c=Pn;break;case Kr:c=Gn;break;case`scroll`:c=K;break;case`wheel`:c=Kn;break;case`copy`:case`cut`:case`paste`:c=Fn;break;case`gotpointercapture`:case`lostpointercapture`:case`pointercancel`:case`pointerdown`:case`pointermove`:case`pointerout`:case`pointerover`:case`pointerup`:c=Un}var u=(t&4)!=0,d=!u&&e===`scroll`,f=u?s===null?null:s+`Capture`:s;u=[];for(var p=r,m;p!==null;){m=p;var h=m.stateNode;if(m.tag===5&&h!==null&&(m=h,f!==null&&(h=We(p,f),h!=null&&u.push(ci(p,h,m)))),d)break;p=p.return}0<u.length&&(s=new c(s,l,null,n,i),o.push({event:s,listeners:u}))}}if(!(t&7)){a:{if(s=e===`mouseover`||e===`pointerover`,c=e===`mouseout`||e===`pointerout`,s&&n!==Me&&(l=n.relatedTarget||n.fromElement)&&(Fi(l)||l[ji]))break a;if((c||s)&&(s=i.window===i?i:(s=i.ownerDocument)?s.defaultView||s.parentWindow:window,c?(l=n.relatedTarget||n.toElement,c=r,l=l?Fi(l):null,l!==null&&(d=et(l),l!==d||l.tag!==5&&l.tag!==6)&&(l=null)):(c=null,l=r),c!==l)){if(u=jn,h=`onMouseLeave`,f=`onMouseEnter`,p=`mouse`,(e===`pointerout`||e===`pointerover`)&&(u=Un,h=`onPointerLeave`,f=`onPointerEnter`,p=`pointer`),d=c==null?s:Li(c),m=l==null?s:Li(l),s=new u(h,p+`leave`,c,n,i),s.target=d,s.relatedTarget=m,h=null,Fi(i)===r&&(u=new u(f,p+`enter`,l,n,i),u.target=m,u.relatedTarget=d,h=u),d=h,c&&l)b:{for(u=c,f=l,p=0,m=u;m;m=ui(m))p++;for(m=0,h=f;h;h=ui(h))m++;for(;0<p-m;)u=ui(u),p--;for(;0<m-p;)f=ui(f),m--;for(;p--;){if(u===f||f!==null&&u===f.alternate)break b;u=ui(u),f=ui(f)}u=null}else u=null;c!==null&&di(o,s,c,u,!1),l!==null&&d!==null&&di(o,d,l,u,!0)}}a:{if(s=r?Li(r):window,c=s.nodeName&&s.nodeName.toLowerCase(),c===`select`||c===`input`&&s.type===`file`)var g=fr;else if(or(s))if(pr)g=Sr;else{g=br;var _=yr}else (c=s.nodeName)&&c.toLowerCase()===`input`&&(s.type===`checkbox`||s.type===`radio`)&&(g=xr);if(g&&=g(e,r)){sr(o,g,n,i);break a}_&&_(e,s,r),e===`focusout`&&(_=s._wrapperState)&&_.controlled&&s.type===`number`&&pe(s,`number`,s.value)}switch(_=r?Li(r):window,e){case`focusin`:(or(_)||_.contentEditable===`true`)&&(Nr=_,Pr=r,Fr=null);break;case`focusout`:Fr=Pr=Nr=null;break;case`mousedown`:Ir=!0;break;case`contextmenu`:case`mouseup`:case`dragend`:Ir=!1,Lr(o,n,i);break;case`selectionchange`:if(Mr)break;case`keydown`:case`keyup`:Lr(o,n,i)}var v;if(Jn)b:{switch(e){case`compositionstart`:var y=`onCompositionStart`;break b;case`compositionend`:y=`onCompositionEnd`;break b;case`compositionupdate`:y=`onCompositionUpdate`;break b}y=void 0}else nr?er(e,n)&&(y=`onCompositionEnd`):e===`keydown`&&n.keyCode===229&&(y=`onCompositionStart`);y&&(Zn&&n.locale!==`ko`&&(nr||y!==`onCompositionStart`?y===`onCompositionEnd`&&nr&&(v=yn()):(gn=i,_n=`value`in gn?gn.value:gn.textContent,nr=!0)),_=li(r,y),0<_.length&&(y=new In(y,e,null,n,i),o.push({event:y,listeners:_}),v?y.data=v:(v=tr(n),v!==null&&(y.data=v)))),(v=Xn?rr(e,n):ir(e,n))&&(r=li(r,`onBeforeInput`),0<r.length&&(i=new In(`onBeforeInput`,`beforeinput`,null,n,i),o.push({event:i,listeners:r}),i.data=v))}ti(o,t)})}function ci(e,t,n){return{instance:e,listener:t,currentTarget:n}}function li(e,t){for(var n=t+`Capture`,r=[];e!==null;){var i=e,a=i.stateNode;i.tag===5&&a!==null&&(i=a,a=We(e,n),a!=null&&r.unshift(ci(e,a,i)),a=We(e,t),a!=null&&r.push(ci(e,a,i))),e=e.return}return r}function ui(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5);return e||null}function di(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(c!==null&&c===r)break;s.tag===5&&l!==null&&(s=l,i?(c=We(n,a),c!=null&&o.unshift(ci(n,c,s))):i||(c=We(n,a),c!=null&&o.push(ci(n,c,s)))),n=n.return}o.length!==0&&e.push({event:t,listeners:o})}var fi=/\r\n?/g,pi=/\u0000|\uFFFD/g;function mi(e){return(typeof e==`string`?e:``+e).replace(fi,`
|
|
6
|
+
`).replace(pi,``)}function hi(e,t,n){if(t=mi(t),mi(e)!==t&&n)throw Error(r(425))}function gi(){}var _i=null,vi=null;function yi(e,t){return e===`textarea`||e===`noscript`||typeof t.children==`string`||typeof t.children==`number`||typeof t.dangerouslySetInnerHTML==`object`&&t.dangerouslySetInnerHTML!==null&&t.dangerouslySetInnerHTML.__html!=null}var bi=typeof setTimeout==`function`?setTimeout:void 0,xi=typeof clearTimeout==`function`?clearTimeout:void 0,Si=typeof Promise==`function`?Promise:void 0,Ci=typeof queueMicrotask==`function`?queueMicrotask:Si===void 0?bi:function(e){return Si.resolve(null).then(e).catch(wi)};function wi(e){setTimeout(function(){throw e})}function Ti(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===`/$`){if(r===0){e.removeChild(i),sn(t);return}r--}else n!==`$`&&n!==`$?`&&n!==`$!`||r++;n=i}while(n);sn(t)}function Ei(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===`$?`)break;if(t===`/$`)return null}}return e}function Di(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n===`$`||n===`$!`||n===`$?`){if(t===0)return e;t--}else n===`/$`&&t++}e=e.previousSibling}return null}var Oi=Math.random().toString(36).slice(2),ki=`__reactFiber$`+Oi,Ai=`__reactProps$`+Oi,ji=`__reactContainer$`+Oi,Mi=`__reactEvents$`+Oi,Ni=`__reactListeners$`+Oi,Pi=`__reactHandles$`+Oi;function Fi(e){var t=e[ki];if(t)return t;for(var n=e.parentNode;n;){if(t=n[ji]||n[ki]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=Di(e);e!==null;){if(n=e[ki])return n;e=Di(e)}return t}e=n,n=e.parentNode}return null}function Ii(e){return e=e[ki]||e[ji],!e||e.tag!==5&&e.tag!==6&&e.tag!==13&&e.tag!==3?null:e}function Li(e){if(e.tag===5||e.tag===6)return e.stateNode;throw Error(r(33))}function Ri(e){return e[Ai]||null}var zi=[],Bi=-1;function Vi(e){return{current:e}}function Hi(e){0>Bi||(e.current=zi[Bi],zi[Bi]=null,Bi--)}function Ui(e,t){Bi++,zi[Bi]=e.current,e.current=t}var Wi={},Gi=Vi(Wi),Ki=Vi(!1),qi=Wi;function Ji(e,t){var n=e.type.contextTypes;if(!n)return Wi;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===t)return r.__reactInternalMemoizedMaskedChildContext;var i={},a;for(a in n)i[a]=t[a];return r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=i),i}function Yi(e){return e=e.childContextTypes,e!=null}function Xi(){Hi(Ki),Hi(Gi)}function Zi(e,t,n){if(Gi.current!==Wi)throw Error(r(168));Ui(Gi,t),Ui(Ki,n)}function Qi(e,t,n){var i=e.stateNode;if(t=t.childContextTypes,typeof i.getChildContext!=`function`)return n;for(var a in i=i.getChildContext(),i)if(!(a in t))throw Error(r(108,ne(e)||`Unknown`,a));return z({},n,i)}function $i(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||Wi,qi=Gi.current,Ui(Gi,e),Ui(Ki,Ki.current),!0}function ea(e,t,n){var i=e.stateNode;if(!i)throw Error(r(169));n?(e=Qi(e,t,qi),i.__reactInternalMemoizedMergedChildContext=e,Hi(Ki),Hi(Gi),Ui(Gi,e)):Hi(Ki),Ui(Ki,n)}var ta=null,na=!1,ra=!1;function ia(e){ta===null?ta=[e]:ta.push(e)}function aa(e){na=!0,ia(e)}function oa(){if(!ra&&ta!==null){ra=!0;var e=0,t=It;try{var n=ta;for(It=1;e<n.length;e++){var r=n[e];do r=r(!0);while(r!==null)}ta=null,na=!1}catch(t){throw ta!==null&&(ta=ta.slice(e+1)),ot(ft,oa),t}finally{It=t,ra=!1}}return null}var sa=[],ca=0,la=null,ua=0,da=[],fa=0,pa=null,ma=1,ha=``;function ga(e,t){sa[ca++]=ua,sa[ca++]=la,la=e,ua=t}function _a(e,t,n){da[fa++]=ma,da[fa++]=ha,da[fa++]=pa,pa=e;var r=ma;e=ha;var i=32-bt(r)-1;r&=~(1<<i),n+=1;var a=32-bt(t)+i;if(30<a){var o=i-i%5;a=(r&(1<<o)-1).toString(32),r>>=o,i-=o,ma=1<<32-bt(t)+i|n<<i|r,ha=a+e}else ma=1<<a|n<<i|r,ha=e}function va(e){e.return!==null&&(ga(e,1),_a(e,1,0))}function ya(e){for(;e===la;)la=sa[--ca],sa[ca]=null,ua=sa[--ca],sa[ca]=null;for(;e===pa;)pa=da[--fa],da[fa]=null,ha=da[--fa],da[fa]=null,ma=da[--fa],da[fa]=null}var ba=null,xa=null,Sa=!1,Ca=null;function wa(e,t){var n=Ql(5,null,null,0);n.elementType=`DELETED`,n.stateNode=t,n.return=e,t=e.deletions,t===null?(e.deletions=[n],e.flags|=16):t.push(n)}function Ta(e,t){switch(e.tag){case 5:var n=e.type;return t=t.nodeType!==1||n.toLowerCase()!==t.nodeName.toLowerCase()?null:t,t===null?!1:(e.stateNode=t,ba=e,xa=Ei(t.firstChild),!0);case 6:return t=e.pendingProps===``||t.nodeType!==3?null:t,t===null?!1:(e.stateNode=t,ba=e,xa=null,!0);case 13:return t=t.nodeType===8?t:null,t===null?!1:(n=pa===null?null:{id:ma,overflow:ha},e.memoizedState={dehydrated:t,treeContext:n,retryLane:1073741824},n=Ql(18,null,null,0),n.stateNode=t,n.return=e,e.child=n,ba=e,xa=null,!0);default:return!1}}function Ea(e){return(e.mode&1)!=0&&(e.flags&128)==0}function Da(e){if(Sa){var t=xa;if(t){var n=t;if(!Ta(e,t)){if(Ea(e))throw Error(r(418));t=Ei(n.nextSibling);var i=ba;t&&Ta(e,t)?wa(i,n):(e.flags=e.flags&-4097|2,Sa=!1,ba=e)}}else{if(Ea(e))throw Error(r(418));e.flags=e.flags&-4097|2,Sa=!1,ba=e}}}function Oa(e){for(e=e.return;e!==null&&e.tag!==5&&e.tag!==3&&e.tag!==13;)e=e.return;ba=e}function ka(e){if(e!==ba)return!1;if(!Sa)return Oa(e),Sa=!0,!1;var t;if((t=e.tag!==3)&&!(t=e.tag!==5)&&(t=e.type,t=t!==`head`&&t!==`body`&&!yi(e.type,e.memoizedProps)),t&&=xa){if(Ea(e))throw Aa(),Error(r(418));for(;t;)wa(e,t),t=Ei(t.nextSibling)}if(Oa(e),e.tag===13){if(e=e.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(r(317));a:{for(e=e.nextSibling,t=0;e;){if(e.nodeType===8){var n=e.data;if(n===`/$`){if(t===0){xa=Ei(e.nextSibling);break a}t--}else n!==`$`&&n!==`$!`&&n!==`$?`||t++}e=e.nextSibling}xa=null}}else xa=ba?Ei(e.stateNode.nextSibling):null;return!0}function Aa(){for(var e=xa;e;)e=Ei(e.nextSibling)}function ja(){xa=ba=null,Sa=!1}function Ma(e){Ca===null?Ca=[e]:Ca.push(e)}var Na=C.ReactCurrentBatchConfig;function Pa(e,t,n){if(e=n.ref,e!==null&&typeof e!=`function`&&typeof e!=`object`){if(n._owner){if(n=n._owner,n){if(n.tag!==1)throw Error(r(309));var i=n.stateNode}if(!i)throw Error(r(147,e));var a=i,o=``+e;return t!==null&&t.ref!==null&&typeof t.ref==`function`&&t.ref._stringRef===o?t.ref:(t=function(e){var t=a.refs;e===null?delete t[o]:t[o]=e},t._stringRef=o,t)}if(typeof e!=`string`)throw Error(r(284));if(!n._owner)throw Error(r(290,e))}return e}function Fa(e,t){throw e=Object.prototype.toString.call(t),Error(r(31,e===`[object Object]`?`object with keys {`+Object.keys(t).join(`, `)+`}`:e))}function Ia(e){var t=e._init;return t(e._payload)}function La(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 i(e,t){for(e=new Map;t!==null;)t.key===null?e.set(t.index,t):e.set(t.key,t),t=t.sibling;return e}function a(e,t){return e=tu(e,t),e.index=0,e.sibling=null,e}function o(t,n,r){return t.index=r,e?(r=t.alternate,r===null?(t.flags|=2,n):(r=r.index,r<n?(t.flags|=2,n):r)):(t.flags|=1048576,n)}function s(t){return e&&t.alternate===null&&(t.flags|=2),t}function c(e,t,n,r){return t===null||t.tag!==6?(t=au(n,e.mode,r),t.return=e,t):(t=a(t,n),t.return=e,t)}function l(e,t,n,r){var i=n.type;return i===E?d(e,t,n.props.children,r,n.key):t!==null&&(t.elementType===i||typeof i==`object`&&i&&i.$$typeof===F&&Ia(i)===t.type)?(r=a(t,n.props),r.ref=Pa(e,t,n),r.return=e,r):(r=nu(n.type,n.key,n.props,null,e.mode,r),r.ref=Pa(e,t,n),r.return=e,r)}function u(e,t,n,r){return t===null||t.tag!==4||t.stateNode.containerInfo!==n.containerInfo||t.stateNode.implementation!==n.implementation?(t=ou(n,e.mode,r),t.return=e,t):(t=a(t,n.children||[]),t.return=e,t)}function d(e,t,n,r,i){return t===null||t.tag!==7?(t=ru(n,e.mode,r,i),t.return=e,t):(t=a(t,n),t.return=e,t)}function f(e,t,n){if(typeof t==`string`&&t!==``||typeof t==`number`)return t=au(``+t,e.mode,n),t.return=e,t;if(typeof t==`object`&&t){switch(t.$$typeof){case w:return n=nu(t.type,t.key,t.props,null,e.mode,n),n.ref=Pa(e,null,t),n.return=e,n;case T:return t=ou(t,e.mode,n),t.return=e,t;case F:var r=t._init;return f(e,r(t._payload),n)}if(me(t)||R(t))return t=ru(t,e.mode,n,null),t.return=e,t;Fa(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`)return i===null?c(e,t,``+n,r):null;if(typeof n==`object`&&n){switch(n.$$typeof){case w:return n.key===i?l(e,t,n,r):null;case T:return n.key===i?u(e,t,n,r):null;case F:return i=n._init,p(e,t,i(n._payload),r)}if(me(n)||R(n))return i===null?d(e,t,n,r,null):null;Fa(e,n)}return null}function m(e,t,n,r,i){if(typeof r==`string`&&r!==``||typeof r==`number`)return e=e.get(n)||null,c(t,e,``+r,i);if(typeof r==`object`&&r){switch(r.$$typeof){case w:return e=e.get(r.key===null?n:r.key)||null,l(t,e,r,i);case T:return e=e.get(r.key===null?n:r.key)||null,u(t,e,r,i);case F:var a=r._init;return m(e,t,n,a(r._payload),i)}if(me(r)||R(r))return e=e.get(n)||null,d(t,e,r,i,null);Fa(t,r)}return null}function h(r,a,s,c){for(var l=null,u=null,d=a,h=a=0,g=null;d!==null&&h<s.length;h++){d.index>h?(g=d,d=null):g=d.sibling;var _=p(r,d,s[h],c);if(_===null){d===null&&(d=g);break}e&&d&&_.alternate===null&&t(r,d),a=o(_,a,h),u===null?l=_:u.sibling=_,u=_,d=g}if(h===s.length)return n(r,d),Sa&&ga(r,h),l;if(d===null){for(;h<s.length;h++)d=f(r,s[h],c),d!==null&&(a=o(d,a,h),u===null?l=d:u.sibling=d,u=d);return Sa&&ga(r,h),l}for(d=i(r,d);h<s.length;h++)g=m(d,r,h,s[h],c),g!==null&&(e&&g.alternate!==null&&d.delete(g.key===null?h:g.key),a=o(g,a,h),u===null?l=g:u.sibling=g,u=g);return e&&d.forEach(function(e){return t(r,e)}),Sa&&ga(r,h),l}function g(a,s,c,l){var u=R(c);if(typeof u!=`function`)throw Error(r(150));if(c=u.call(c),c==null)throw Error(r(151));for(var d=u=null,h=s,g=s=0,_=null,v=c.next();h!==null&&!v.done;g++,v=c.next()){h.index>g?(_=h,h=null):_=h.sibling;var y=p(a,h,v.value,l);if(y===null){h===null&&(h=_);break}e&&h&&y.alternate===null&&t(a,h),s=o(y,s,g),d===null?u=y:d.sibling=y,d=y,h=_}if(v.done)return n(a,h),Sa&&ga(a,g),u;if(h===null){for(;!v.done;g++,v=c.next())v=f(a,v.value,l),v!==null&&(s=o(v,s,g),d===null?u=v:d.sibling=v,d=v);return Sa&&ga(a,g),u}for(h=i(a,h);!v.done;g++,v=c.next())v=m(h,a,g,v.value,l),v!==null&&(e&&v.alternate!==null&&h.delete(v.key===null?g:v.key),s=o(v,s,g),d===null?u=v:d.sibling=v,d=v);return e&&h.forEach(function(e){return t(a,e)}),Sa&&ga(a,g),u}function _(e,r,i,o){if(typeof i==`object`&&i&&i.type===E&&i.key===null&&(i=i.props.children),typeof i==`object`&&i){switch(i.$$typeof){case w:a:{for(var c=i.key,l=r;l!==null;){if(l.key===c){if(c=i.type,c===E){if(l.tag===7){n(e,l.sibling),r=a(l,i.props.children),r.return=e,e=r;break a}}else if(l.elementType===c||typeof c==`object`&&c&&c.$$typeof===F&&Ia(c)===l.type){n(e,l.sibling),r=a(l,i.props),r.ref=Pa(e,l,i),r.return=e,e=r;break a}n(e,l);break}else t(e,l);l=l.sibling}i.type===E?(r=ru(i.props.children,e.mode,o,i.key),r.return=e,e=r):(o=nu(i.type,i.key,i.props,null,e.mode,o),o.ref=Pa(e,r,i),o.return=e,e=o)}return s(e);case T:a:{for(l=i.key;r!==null;){if(r.key===l)if(r.tag===4&&r.stateNode.containerInfo===i.containerInfo&&r.stateNode.implementation===i.implementation){n(e,r.sibling),r=a(r,i.children||[]),r.return=e,e=r;break a}else{n(e,r);break}else t(e,r);r=r.sibling}r=ou(i,e.mode,o),r.return=e,e=r}return s(e);case F:return l=i._init,_(e,r,l(i._payload),o)}if(me(i))return h(e,r,i,o);if(R(i))return g(e,r,i,o);Fa(e,i)}return typeof i==`string`&&i!==``||typeof i==`number`?(i=``+i,r!==null&&r.tag===6?(n(e,r.sibling),r=a(r,i),r.return=e,e=r):(n(e,r),r=au(i,e.mode,o),r.return=e,e=r),s(e)):n(e,r)}return _}var Ra=La(!0),za=La(!1),Ba=Vi(null),Va=null,Ha=null,Ua=null;function Wa(){Ua=Ha=Va=null}function Ga(e){var t=Ba.current;Hi(Ba),e._currentValue=t}function Ka(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 qa(e,t){Va=e,Ua=Ha=null,e=e.dependencies,e!==null&&e.firstContext!==null&&((e.lanes&t)!==0&&(Ls=!0),e.firstContext=null)}function Ja(e){var t=e._currentValue;if(Ua!==e)if(e={context:e,memoizedValue:t,next:null},Ha===null){if(Va===null)throw Error(r(308));Ha=e,Va.dependencies={lanes:0,firstContext:e}}else Ha=Ha.next=e;return t}var Ya=null;function Xa(e){Ya===null?Ya=[e]:Ya.push(e)}function Za(e,t,n,r){var i=t.interleaved;return i===null?(n.next=n,Xa(t)):(n.next=i.next,i.next=n),t.interleaved=n,Qa(e,r)}function Qa(e,t){e.lanes|=t;var n=e.alternate;for(n!==null&&(n.lanes|=t),n=e,e=e.return;e!==null;)e.childLanes|=t,n=e.alternate,n!==null&&(n.childLanes|=t),n=e,e=e.return;return n.tag===3?n.stateNode:null}var $a=!1;function eo(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function to(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,effects:e.effects})}function no(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function ro(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,Kc&2){var i=r.pending;return i===null?t.next=t:(t.next=i.next,i.next=t),r.pending=t,Qa(e,n)}return i=r.interleaved,i===null?(t.next=t,Xa(r)):(t.next=i.next,i.next=t),r.interleaved=t,Qa(e,n)}function io(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,n&4194240)){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Ft(e,n)}}function ao(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={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,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,effects:r.effects},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}function oo(e,t,n,r){var i=e.updateQueue;$a=!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,p=s.eventTime;if((r&f)===f){u!==null&&(u=u.next={eventTime:p,lane:0,tag:s.tag,payload:s.payload,callback:s.callback,next:null});a:{var m=e,h=s;switch(f=t,p=n,h.tag){case 1:if(m=h.payload,typeof m==`function`){d=m.call(p,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(p,d,f):m,f==null)break a;d=z({},d,f);break a;case 2:$a=!0}}s.callback!==null&&s.lane!==0&&(e.flags|=64,f=i.effects,f===null?i.effects=[s]:f.push(s))}else p={eventTime: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;f=s,s=f.next,f.next=null,i.lastBaseUpdate=f,i.shared.pending=null}}while(1);if(u===null&&(c=d),i.baseState=c,i.firstBaseUpdate=l,i.lastBaseUpdate=u,t=i.shared.interleaved,t!==null){i=t;do o|=i.lane,i=i.next;while(i!==t)}else a===null&&(i.shared.lanes=0);el|=o,e.lanes=o,e.memoizedState=d}}function so(e,t,n){if(e=t.effects,t.effects=null,e!==null)for(t=0;t<e.length;t++){var i=e[t],a=i.callback;if(a!==null){if(i.callback=null,i=n,typeof a!=`function`)throw Error(r(191,a));a.call(i)}}}var co={},lo=Vi(co),uo=Vi(co),fo=Vi(co);function po(e){if(e===co)throw Error(r(174));return e}function mo(e,t){switch(Ui(fo,t),Ui(uo,e),Ui(lo,co),e=t.nodeType,e){case 9:case 11:t=(t=t.documentElement)?t.namespaceURI:xe(null,``);break;default:e=e===8?t.parentNode:t,t=e.namespaceURI||null,e=e.tagName,t=xe(t,e)}Hi(lo),Ui(lo,t)}function ho(){Hi(lo),Hi(uo),Hi(fo)}function go(e){po(fo.current);var t=po(lo.current),n=xe(t,e.type);t!==n&&(Ui(uo,e),Ui(lo,n))}function _o(e){uo.current===e&&(Hi(lo),Hi(uo))}var vo=Vi(0);function yo(e){for(var t=e;t!==null;){if(t.tag===13){var n=t.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||n.data===`$?`||n.data===`$!`))return t}else if(t.tag===19&&t.memoizedProps.revealOrder!==void 0){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 bo=[];function xo(){for(var e=0;e<bo.length;e++)bo[e]._workInProgressVersionPrimary=null;bo.length=0}var So=C.ReactCurrentDispatcher,Co=C.ReactCurrentBatchConfig,wo=0,To=null,Eo=null,Do=null,Oo=!1,ko=!1,Ao=0,jo=0;function Mo(){throw Error(r(321))}function No(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 Po(e,t,n,i,a,o){if(wo=o,To=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,So.current=e===null||e.memoizedState===null?_s:vs,e=n(i,a),ko){o=0;do{if(ko=!1,Ao=0,25<=o)throw Error(r(301));o+=1,Do=Eo=null,t.updateQueue=null,So.current=ys,e=n(i,a)}while(ko)}if(So.current=gs,t=Eo!==null&&Eo.next!==null,wo=0,Do=Eo=To=null,Oo=!1,t)throw Error(r(300));return e}function Fo(){var e=Ao!==0;return Ao=0,e}function Io(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Do===null?To.memoizedState=Do=e:Do=Do.next=e,Do}function Lo(){if(Eo===null){var e=To.alternate;e=e===null?null:e.memoizedState}else e=Eo.next;var t=Do===null?To.memoizedState:Do.next;if(t!==null)Do=t,Eo=e;else{if(e===null)throw Error(r(310));Eo=e,e={memoizedState:Eo.memoizedState,baseState:Eo.baseState,baseQueue:Eo.baseQueue,queue:Eo.queue,next:null},Do===null?To.memoizedState=Do=e:Do=Do.next=e}return Do}function Ro(e,t){return typeof t==`function`?t(e):t}function zo(e){var t=Lo(),n=t.queue;if(n===null)throw Error(r(311));n.lastRenderedReducer=e;var i=Eo,a=i.baseQueue,o=n.pending;if(o!==null){if(a!==null){var s=a.next;a.next=o.next,o.next=s}i.baseQueue=a=o,n.pending=null}if(a!==null){o=a.next,i=i.baseState;var c=s=null,l=null,u=o;do{var d=u.lane;if((wo&d)===d)l!==null&&(l=l.next={lane:0,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null}),i=u.hasEagerState?u.eagerState:e(i,u.action);else{var f={lane:d,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null};l===null?(c=l=f,s=i):l=l.next=f,To.lanes|=d,el|=d}u=u.next}while(u!==null&&u!==o);l===null?s=i:l.next=c,wr(i,t.memoizedState)||(Ls=!0),t.memoizedState=i,t.baseState=s,t.baseQueue=l,n.lastRenderedState=i}if(e=n.interleaved,e!==null){a=e;do o=a.lane,To.lanes|=o,el|=o,a=a.next;while(a!==e)}else a===null&&(n.lanes=0);return[t.memoizedState,n.dispatch]}function Bo(e){var t=Lo(),n=t.queue;if(n===null)throw Error(r(311));n.lastRenderedReducer=e;var i=n.dispatch,a=n.pending,o=t.memoizedState;if(a!==null){n.pending=null;var s=a=a.next;do o=e(o,s.action),s=s.next;while(s!==a);wr(o,t.memoizedState)||(Ls=!0),t.memoizedState=o,t.baseQueue===null&&(t.baseState=o),n.lastRenderedState=o}return[o,i]}function Vo(){}function Ho(e,t){var n=To,i=Lo(),a=t(),o=!wr(i.memoizedState,a);if(o&&(i.memoizedState=a,Ls=!0),i=i.queue,es(Go.bind(null,n,i,e),[e]),i.getSnapshot!==t||o||Do!==null&&Do.memoizedState.tag&1){if(n.flags|=2048,Yo(9,Wo.bind(null,n,i,a,t),void 0,null),qc===null)throw Error(r(349));wo&30||Uo(n,t,a)}return a}function Uo(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=To.updateQueue,t===null?(t={lastEffect:null,stores:null},To.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function Wo(e,t,n,r){t.value=n,t.getSnapshot=r,Ko(t)&&qo(e)}function Go(e,t,n){return n(function(){Ko(t)&&qo(e)})}function Ko(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!wr(e,n)}catch{return!0}}function qo(e){var t=Qa(e,1);t!==null&&bl(t,e,1,-1)}function Jo(e){var t=Io();return typeof e==`function`&&(e=e()),t.memoizedState=t.baseState=e,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:Ro,lastRenderedState:e},t.queue=e,e=e.dispatch=fs.bind(null,To,e),[t.memoizedState,e]}function Yo(e,t,n,r){return e={tag:e,create:t,destroy:n,deps:r,next:null},t=To.updateQueue,t===null?(t={lastEffect:null,stores:null},To.updateQueue=t,t.lastEffect=e.next=e):(n=t.lastEffect,n===null?t.lastEffect=e.next=e:(r=n.next,n.next=e,e.next=r,t.lastEffect=e)),e}function Xo(){return Lo().memoizedState}function Zo(e,t,n,r){var i=Io();To.flags|=e,i.memoizedState=Yo(1|t,n,void 0,r===void 0?null:r)}function Qo(e,t,n,r){var i=Lo();r=r===void 0?null:r;var a=void 0;if(Eo!==null){var o=Eo.memoizedState;if(a=o.destroy,r!==null&&No(r,o.deps)){i.memoizedState=Yo(t,n,a,r);return}}To.flags|=e,i.memoizedState=Yo(1|t,n,a,r)}function $o(e,t){return Zo(8390656,8,e,t)}function es(e,t){return Qo(2048,8,e,t)}function ts(e,t){return Qo(4,2,e,t)}function ns(e,t){return Qo(4,4,e,t)}function rs(e,t){if(typeof t==`function`)return e=e(),t(e),function(){t(null)};if(t!=null)return e=e(),t.current=e,function(){t.current=null}}function is(e,t,n){return n=n==null?null:n.concat([e]),Qo(4,4,rs.bind(null,t,e),n)}function as(){}function os(e,t){var n=Lo();t=t===void 0?null:t;var r=n.memoizedState;return r!==null&&t!==null&&No(t,r[1])?r[0]:(n.memoizedState=[e,t],e)}function ss(e,t){var n=Lo();t=t===void 0?null:t;var r=n.memoizedState;return r!==null&&t!==null&&No(t,r[1])?r[0]:(e=e(),n.memoizedState=[e,t],e)}function cs(e,t,n){return wo&21?(wr(n,t)||(n=jt(),To.lanes|=n,el|=n,e.baseState=!0),t):(e.baseState&&(e.baseState=!1,Ls=!0),e.memoizedState=n)}function ls(e,t){var n=It;It=n!==0&&4>n?n:4,e(!0);var r=Co.transition;Co.transition={};try{e(!1),t()}finally{It=n,Co.transition=r}}function us(){return Lo().memoizedState}function ds(e,t,n){var r=yl(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},ps(e))ms(t,n);else if(n=Za(e,t,n,r),n!==null){var i=vl();bl(n,e,r,i),hs(n,t,r)}}function fs(e,t,n){var r=yl(e),i={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(ps(e))ms(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)){var c=t.interleaved;c===null?(i.next=i,Xa(t)):(i.next=c.next,c.next=i),t.interleaved=i;return}}catch{}n=Za(e,t,i,r),n!==null&&(i=vl(),bl(n,e,r,i),hs(n,t,r))}}function ps(e){var t=e.alternate;return e===To||t!==null&&t===To}function ms(e,t){ko=Oo=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function hs(e,t,n){if(n&4194240){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Ft(e,n)}}var gs={readContext:Ja,useCallback:Mo,useContext:Mo,useEffect:Mo,useImperativeHandle:Mo,useInsertionEffect:Mo,useLayoutEffect:Mo,useMemo:Mo,useReducer:Mo,useRef:Mo,useState:Mo,useDebugValue:Mo,useDeferredValue:Mo,useTransition:Mo,useMutableSource:Mo,useSyncExternalStore:Mo,useId:Mo,unstable_isNewReconciler:!1},_s={readContext:Ja,useCallback:function(e,t){return Io().memoizedState=[e,t===void 0?null:t],e},useContext:Ja,useEffect:$o,useImperativeHandle:function(e,t,n){return n=n==null?null:n.concat([e]),Zo(4194308,4,rs.bind(null,t,e),n)},useLayoutEffect:function(e,t){return Zo(4194308,4,e,t)},useInsertionEffect:function(e,t){return Zo(4,2,e,t)},useMemo:function(e,t){var n=Io();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=Io();return t=n===void 0?t:n(t),r.memoizedState=r.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},r.queue=e,e=e.dispatch=ds.bind(null,To,e),[r.memoizedState,e]},useRef:function(e){var t=Io();return e={current:e},t.memoizedState=e},useState:Jo,useDebugValue:as,useDeferredValue:function(e){return Io().memoizedState=e},useTransition:function(){var e=Jo(!1),t=e[0];return e=ls.bind(null,e[1]),Io().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var i=To,a=Io();if(Sa){if(n===void 0)throw Error(r(407));n=n()}else{if(n=t(),qc===null)throw Error(r(349));wo&30||Uo(i,t,n)}a.memoizedState=n;var o={value:n,getSnapshot:t};return a.queue=o,$o(Go.bind(null,i,o,e),[e]),i.flags|=2048,Yo(9,Wo.bind(null,i,o,n,t),void 0,null),n},useId:function(){var e=Io(),t=qc.identifierPrefix;if(Sa){var n=ha,r=ma;n=(r&~(1<<32-bt(r)-1)).toString(32)+n,t=`:`+t+`R`+n,n=Ao++,0<n&&(t+=`H`+n.toString(32)),t+=`:`}else n=jo++,t=`:`+t+`r`+n.toString(32)+`:`;return e.memoizedState=t},unstable_isNewReconciler:!1},vs={readContext:Ja,useCallback:os,useContext:Ja,useEffect:es,useImperativeHandle:is,useInsertionEffect:ts,useLayoutEffect:ns,useMemo:ss,useReducer:zo,useRef:Xo,useState:function(){return zo(Ro)},useDebugValue:as,useDeferredValue:function(e){return cs(Lo(),Eo.memoizedState,e)},useTransition:function(){return[zo(Ro)[0],Lo().memoizedState]},useMutableSource:Vo,useSyncExternalStore:Ho,useId:us,unstable_isNewReconciler:!1},ys={readContext:Ja,useCallback:os,useContext:Ja,useEffect:es,useImperativeHandle:is,useInsertionEffect:ts,useLayoutEffect:ns,useMemo:ss,useReducer:Bo,useRef:Xo,useState:function(){return Bo(Ro)},useDebugValue:as,useDeferredValue:function(e){var t=Lo();return Eo===null?t.memoizedState=e:cs(t,Eo.memoizedState,e)},useTransition:function(){return[Bo(Ro)[0],Lo().memoizedState]},useMutableSource:Vo,useSyncExternalStore:Ho,useId:us,unstable_isNewReconciler:!1};function bs(e,t){if(e&&e.defaultProps){for(var n in t=z({},t),e=e.defaultProps,e)t[n]===void 0&&(t[n]=e[n]);return t}return t}function xs(e,t,n,r){t=e.memoizedState,n=n(r,t),n=n==null?t:z({},t,n),e.memoizedState=n,e.lanes===0&&(e.updateQueue.baseState=n)}var Ss={isMounted:function(e){return(e=e._reactInternals)?et(e)===e:!1},enqueueSetState:function(e,t,n){e=e._reactInternals;var r=vl(),i=yl(e),a=no(r,i);a.payload=t,n!=null&&(a.callback=n),t=ro(e,a,i),t!==null&&(bl(t,e,i,r),io(t,e,i))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var r=vl(),i=yl(e),a=no(r,i);a.tag=1,a.payload=t,n!=null&&(a.callback=n),t=ro(e,a,i),t!==null&&(bl(t,e,i,r),io(t,e,i))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=vl(),r=yl(e),i=no(n,r);i.tag=2,t!=null&&(i.callback=t),t=ro(e,i,r),t!==null&&(bl(t,e,r,n),io(t,e,r))}};function Cs(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?!Tr(n,r)||!Tr(i,a):!0}function ws(e,t,n){var r=!1,i=Wi,a=t.contextType;return typeof a==`object`&&a?a=Ja(a):(i=Yi(t)?qi:Gi.current,r=t.contextTypes,a=(r=r!=null)?Ji(e,i):Wi),t=new t(n,a),e.memoizedState=t.state!==null&&t.state!==void 0?t.state:null,t.updater=Ss,e.stateNode=t,t._reactInternals=e,r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=i,e.__reactInternalMemoizedMaskedChildContext=a),t}function Ts(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&&Ss.enqueueReplaceState(t,t.state,null)}function Es(e,t,n,r){var i=e.stateNode;i.props=n,i.state=e.memoizedState,i.refs={},eo(e);var a=t.contextType;typeof a==`object`&&a?i.context=Ja(a):(a=Yi(t)?qi:Gi.current,i.context=Ji(e,a)),i.state=e.memoizedState,a=t.getDerivedStateFromProps,typeof a==`function`&&(xs(e,t,a,n),i.state=e.memoizedState),typeof t.getDerivedStateFromProps==`function`||typeof i.getSnapshotBeforeUpdate==`function`||typeof i.UNSAFE_componentWillMount!=`function`&&typeof i.componentWillMount!=`function`||(t=i.state,typeof i.componentWillMount==`function`&&i.componentWillMount(),typeof i.UNSAFE_componentWillMount==`function`&&i.UNSAFE_componentWillMount(),t!==i.state&&Ss.enqueueReplaceState(i,i.state,null),oo(e,n,i,r),i.state=e.memoizedState),typeof i.componentDidMount==`function`&&(e.flags|=4194308)}function Ds(e,t){try{var n=``,r=t;do n+=te(r),r=r.return;while(r);var i=n}catch(e){i=`
|
|
7
7
|
Error generating stack: `+e.message+`
|
|
8
|
-
`+e.stack}return{value:e,source:t,stack:i,digest:null}}function Os(e,t,n){return{value:e,source:null,stack:n??null,digest:t??null}}function ks(e,t){try{console.error(t.value)}catch(e){setTimeout(function(){throw e})}}var As=typeof WeakMap==`function`?WeakMap:Map;function js(e,t,n){n=no(-1,n),n.tag=3,n.payload={element:null};var r=t.value;return n.callback=function(){cl||(cl=!0,ll=r),ks(e,t)},n}function Ms(e,t,n){n=no(-1,n),n.tag=3;var r=e.type.getDerivedStateFromError;if(typeof r==`function`){var i=t.value;n.payload=function(){return r(i)},n.callback=function(){ks(e,t)}}var a=e.stateNode;return a!==null&&typeof a.componentDidCatch==`function`&&(n.callback=function(){ks(e,t),typeof r!=`function`&&(ul===null?ul=new Set([this]):ul.add(this));var n=t.stack;this.componentDidCatch(t.value,{componentStack:n===null?``:n})}),n}function Ns(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new As;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)||(i.add(n),e=Gl.bind(null,e,t,n),t.then(e,e))}function Ps(e){do{var t;if((t=e.tag===13)&&(t=e.memoizedState,t=t===null?!0:t.dehydrated!==null),t)return e;e=e.return}while(e!==null);return null}function Fs(e,t,n,r,i){return e.mode&1?(e.flags|=65536,e.lanes=i,e):(e===t?e.flags|=65536:(e.flags|=128,n.flags|=131072,n.flags&=-52805,n.tag===1&&(n.alternate===null?n.tag=17:(t=no(-1,1),t.tag=2,ro(n,t,1))),n.lanes|=1),e)}var Is=C.ReactCurrentOwner,Ls=!1;function Rs(e,t,n,r){t.child=e===null?za(t,null,n,r):Ra(t,e.child,n,r)}function zs(e,t,n,r,i){n=n.render;var a=t.ref;return qa(t,i),r=Po(e,t,n,r,a,i),n=Fo(),e!==null&&!Ls?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~i,ac(e,t,i)):(Sa&&n&&va(t),t.flags|=1,Rs(e,t,r,i),t.child)}function Bs(e,t,n,r,i){if(e===null){var a=n.type;return typeof a==`function`&&!$l(a)&&a.defaultProps===void 0&&n.compare===null&&n.defaultProps===void 0?(t.tag=15,t.type=a,Vs(e,t,a,r,i)):(e=nu(n.type,null,r,t,t.mode,i),e.ref=t.ref,e.return=t,t.child=e)}if(a=e.child,(e.lanes&i)===0){var o=a.memoizedProps;if(n=n.compare,n=n===null?Tr:n,n(o,r)&&e.ref===t.ref)return ac(e,t,i)}return t.flags|=1,e=tu(a,r),e.ref=t.ref,e.return=t,t.child=e}function Vs(e,t,n,r,i){if(e!==null){var a=e.memoizedProps;if(Tr(a,r)&&e.ref===t.ref)if(Ls=!1,t.pendingProps=r=a,(e.lanes&i)!==0)e.flags&131072&&(Ls=!0);else return t.lanes=e.lanes,ac(e,t,i)}return Ws(e,t,n,r,i)}function Hs(e,t,n){var r=t.pendingProps,i=r.children,a=e===null?null:e.memoizedState;if(r.mode===`hidden`)if(!(t.mode&1))t.memoizedState={baseLanes:0,cachePool:null,transitions:null},Ui(Zc,Xc),Xc|=n;else{if(!(n&1073741824))return e=a===null?n:a.baseLanes|n,t.lanes=t.childLanes=1073741824,t.memoizedState={baseLanes:e,cachePool:null,transitions:null},t.updateQueue=null,Ui(Zc,Xc),Xc|=e,null;t.memoizedState={baseLanes:0,cachePool:null,transitions:null},r=a===null?n:a.baseLanes,Ui(Zc,Xc),Xc|=r}else a===null?r=n:(r=a.baseLanes|n,t.memoizedState=null),Ui(Zc,Xc),Xc|=r;return Rs(e,t,i,n),t.child}function Us(e,t){var n=t.ref;(e===null&&n!==null||e!==null&&e.ref!==n)&&(t.flags|=512,t.flags|=2097152)}function Ws(e,t,n,r,i){var a=Yi(n)?qi:Gi.current;return a=Ji(t,a),qa(t,i),n=Po(e,t,n,r,a,i),r=Fo(),e!==null&&!Ls?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~i,ac(e,t,i)):(Sa&&r&&va(t),t.flags|=1,Rs(e,t,n,i),t.child)}function Gs(e,t,n,r,i){if(Yi(n)){var a=!0;$i(t)}else a=!1;if(qa(t,i),t.stateNode===null)ic(e,t),ws(t,n,r),Es(t,n,r,i),r=!0;else if(e===null){var o=t.stateNode,s=t.memoizedProps;o.props=s;var c=o.context,l=n.contextType;typeof l==`object`&&l?l=Ja(l):(l=Yi(n)?qi:Gi.current,l=Ji(t,l));var u=n.getDerivedStateFromProps,d=typeof u==`function`||typeof o.getSnapshotBeforeUpdate==`function`;d||typeof o.UNSAFE_componentWillReceiveProps!=`function`&&typeof o.componentWillReceiveProps!=`function`||(s!==r||c!==l)&&Ts(t,o,r,l),$a=!1;var f=t.memoizedState;o.state=f,oo(t,r,o,i),c=t.memoizedState,s!==r||f!==c||Ki.current||$a?(typeof u==`function`&&(xs(t,n,u,r),c=t.memoizedState),(s=$a||Cs(t,n,s,r,f,c,l))?(d||typeof o.UNSAFE_componentWillMount!=`function`&&typeof o.componentWillMount!=`function`||(typeof o.componentWillMount==`function`&&o.componentWillMount(),typeof o.UNSAFE_componentWillMount==`function`&&o.UNSAFE_componentWillMount()),typeof o.componentDidMount==`function`&&(t.flags|=4194308)):(typeof o.componentDidMount==`function`&&(t.flags|=4194308),t.memoizedProps=r,t.memoizedState=c),o.props=r,o.state=c,o.context=l,r=s):(typeof o.componentDidMount==`function`&&(t.flags|=4194308),r=!1)}else{o=t.stateNode,to(e,t),s=t.memoizedProps,l=t.type===t.elementType?s:bs(t.type,s),o.props=l,d=t.pendingProps,f=o.context,c=n.contextType,typeof c==`object`&&c?c=Ja(c):(c=Yi(n)?qi:Gi.current,c=Ji(t,c));var p=n.getDerivedStateFromProps;(u=typeof p==`function`||typeof o.getSnapshotBeforeUpdate==`function`)||typeof o.UNSAFE_componentWillReceiveProps!=`function`&&typeof o.componentWillReceiveProps!=`function`||(s!==d||f!==c)&&Ts(t,o,r,c),$a=!1,f=t.memoizedState,o.state=f,oo(t,r,o,i);var m=t.memoizedState;s!==d||f!==m||Ki.current||$a?(typeof p==`function`&&(xs(t,n,p,r),m=t.memoizedState),(l=$a||Cs(t,n,l,r,f,m,c)||!1)?(u||typeof o.UNSAFE_componentWillUpdate!=`function`&&typeof o.componentWillUpdate!=`function`||(typeof o.componentWillUpdate==`function`&&o.componentWillUpdate(r,m,c),typeof o.UNSAFE_componentWillUpdate==`function`&&o.UNSAFE_componentWillUpdate(r,m,c)),typeof o.componentDidUpdate==`function`&&(t.flags|=4),typeof o.getSnapshotBeforeUpdate==`function`&&(t.flags|=1024)):(typeof o.componentDidUpdate!=`function`||s===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),typeof o.getSnapshotBeforeUpdate!=`function`||s===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),t.memoizedProps=r,t.memoizedState=m),o.props=r,o.state=m,o.context=c,r=l):(typeof o.componentDidUpdate!=`function`||s===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),typeof o.getSnapshotBeforeUpdate!=`function`||s===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),r=!1)}return Ks(e,t,n,r,a,i)}function Ks(e,t,n,r,i,a){Us(e,t);var o=(t.flags&128)!=0;if(!r&&!o)return i&&ea(t,n,!1),ac(e,t,a);r=t.stateNode,Is.current=t;var s=o&&typeof n.getDerivedStateFromError!=`function`?null:r.render();return t.flags|=1,e!==null&&o?(t.child=Ra(t,e.child,null,a),t.child=Ra(t,null,s,a)):Rs(e,t,s,a),t.memoizedState=r.state,i&&ea(t,n,!0),t.child}function qs(e){var t=e.stateNode;t.pendingContext?Zi(e,t.pendingContext,t.pendingContext!==t.context):t.context&&Zi(e,t.context,!1),mo(e,t.containerInfo)}function Js(e,t,n,r,i){return ja(),Ma(i),t.flags|=256,Rs(e,t,n,r),t.child}var Ys={dehydrated:null,treeContext:null,retryLane:0};function Xs(e){return{baseLanes:e,cachePool:null,transitions:null}}function Zs(e,t,n){var r=t.pendingProps,i=vo.current,a=!1,o=(t.flags&128)!=0,s;if((s=o)||(s=e!==null&&e.memoizedState===null?!1:(i&2)!=0),s?(a=!0,t.flags&=-129):(e===null||e.memoizedState!==null)&&(i|=1),Ui(vo,i&1),e===null)return Da(t),e=t.memoizedState,e!==null&&(e=e.dehydrated,e!==null)?(t.mode&1?e.data===`$!`?t.lanes=8:t.lanes=1073741824:t.lanes=1,null):(o=r.children,e=r.fallback,a?(r=t.mode,a=t.child,o={mode:`hidden`,children:o},!(r&1)&&a!==null?(a.childLanes=0,a.pendingProps=o):a=iu(o,r,0,null),e=ru(e,r,n,null),a.return=t,e.return=t,a.sibling=e,t.child=a,t.child.memoizedState=Xs(n),t.memoizedState=Ys,e):Qs(t,o));if(i=e.memoizedState,i!==null&&(s=i.dehydrated,s!==null))return ec(e,t,o,r,s,i,n);if(a){a=r.fallback,o=t.mode,i=e.child,s=i.sibling;var c={mode:`hidden`,children:r.children};return!(o&1)&&t.child!==i?(r=t.child,r.childLanes=0,r.pendingProps=c,t.deletions=null):(r=tu(i,c),r.subtreeFlags=i.subtreeFlags&14680064),s===null?(a=ru(a,o,n,null),a.flags|=2):a=tu(s,a),a.return=t,r.return=t,r.sibling=a,t.child=r,r=a,a=t.child,o=e.child.memoizedState,o=o===null?Xs(n):{baseLanes:o.baseLanes|n,cachePool:null,transitions:o.transitions},a.memoizedState=o,a.childLanes=e.childLanes&~n,t.memoizedState=Ys,r}return a=e.child,e=a.sibling,r=tu(a,{mode:`visible`,children:r.children}),!(t.mode&1)&&(r.lanes=n),r.return=t,r.sibling=null,e!==null&&(n=t.deletions,n===null?(t.deletions=[e],t.flags|=16):n.push(e)),t.child=r,t.memoizedState=null,r}function Qs(e,t){return t=iu({mode:`visible`,children:t},e.mode,0,null),t.return=e,e.child=t}function $s(e,t,n,r){return r!==null&&Ma(r),Ra(t,e.child,null,n),e=Qs(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function ec(e,t,n,i,a,o,s){if(n)return t.flags&256?(t.flags&=-257,i=Os(Error(r(422))),$s(e,t,s,i)):t.memoizedState===null?(o=i.fallback,a=t.mode,i=iu({mode:`visible`,children:i.children},a,0,null),o=ru(o,a,s,null),o.flags|=2,i.return=t,o.return=t,i.sibling=o,t.child=i,t.mode&1&&Ra(t,e.child,null,s),t.child.memoizedState=Xs(s),t.memoizedState=Ys,o):(t.child=e.child,t.flags|=128,null);if(!(t.mode&1))return $s(e,t,s,null);if(a.data===`$!`){if(i=a.nextSibling&&a.nextSibling.dataset,i)var c=i.dgst;return i=c,o=Error(r(419)),i=Os(o,i,void 0),$s(e,t,s,i)}if(c=(s&e.childLanes)!==0,Ls||c){if(i=qc,i!==null){switch(s&-s){case 4:a=2;break;case 16:a=8;break;case 64: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:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:a=32;break;case 536870912:a=268435456;break;default:a=0}a=(a&(i.suspendedLanes|s))===0?a:0,a!==0&&a!==o.retryLane&&(o.retryLane=a,Qa(e,a),bl(i,e,a,-1))}return Pl(),i=Os(Error(r(421))),$s(e,t,s,i)}return a.data===`$?`?(t.flags|=128,t.child=e.child,t=ql.bind(null,e),a._reactRetry=t,null):(e=o.treeContext,xa=Ei(a.nextSibling),ba=t,Sa=!0,Ca=null,e!==null&&(da[fa++]=ma,da[fa++]=ha,da[fa++]=pa,ma=e.id,ha=e.overflow,pa=t),t=Qs(t,i.children),t.flags|=4096,t)}function tc(e,t,n){e.lanes|=t;var r=e.alternate;r!==null&&(r.lanes|=t),Ka(e.return,t,n)}function nc(e,t,n,r,i){var a=e.memoizedState;a===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:r,tail:n,tailMode:i}:(a.isBackwards=t,a.rendering=null,a.renderingStartTime=0,a.last=r,a.tail=n,a.tailMode=i)}function rc(e,t,n){var r=t.pendingProps,i=r.revealOrder,a=r.tail;if(Rs(e,t,r.children,n),r=vo.current,r&2)r=r&1|2,t.flags|=128;else{if(e!==null&&e.flags&128)a:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&tc(e,n,t);else if(e.tag===19)tc(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}r&=1}if(Ui(vo,r),!(t.mode&1))t.memoizedState=null;else switch(i){case`forwards`:for(n=t.child,i=null;n!==null;)e=n.alternate,e!==null&&yo(e)===null&&(i=n),n=n.sibling;n=i,n===null?(i=t.child,t.child=null):(i=n.sibling,n.sibling=null),nc(t,!1,i,n,a);break;case`backwards`:for(n=null,i=t.child,t.child=null;i!==null;){if(e=i.alternate,e!==null&&yo(e)===null){t.child=i;break}e=i.sibling,i.sibling=n,n=i,i=e}nc(t,!0,n,null,a);break;case`together`:nc(t,!1,null,null,void 0);break;default:t.memoizedState=null}return t.child}function ic(e,t){!(t.mode&1)&&e!==null&&(e.alternate=null,t.alternate=null,t.flags|=2)}function ac(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),el|=t.lanes,(n&t.childLanes)===0)return null;if(e!==null&&t.child!==e.child)throw Error(r(153));if(t.child!==null){for(e=t.child,n=tu(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=tu(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function oc(e,t,n){switch(t.tag){case 3:qs(t),ja();break;case 5:go(t);break;case 1:Yi(t.type)&&$i(t);break;case 4:mo(t,t.stateNode.containerInfo);break;case 10:var r=t.type._context,i=t.memoizedProps.value;Ui(Ba,r._currentValue),r._currentValue=i;break;case 13:if(r=t.memoizedState,r!==null)return r.dehydrated===null?(n&t.child.childLanes)===0?(Ui(vo,vo.current&1),e=ac(e,t,n),e===null?null:e.sibling):Zs(e,t,n):(Ui(vo,vo.current&1),t.flags|=128,null);Ui(vo,vo.current&1);break;case 19:if(r=(n&t.childLanes)!==0,e.flags&128){if(r)return rc(e,t,n);t.flags|=128}if(i=t.memoizedState,i!==null&&(i.rendering=null,i.tail=null,i.lastEffect=null),Ui(vo,vo.current),r)break;return null;case 22:case 23:return t.lanes=0,Hs(e,t,n)}return ac(e,t,n)}var sc=function(e,t){for(var n=t.child;n!==null;){if(n.tag===5||n.tag===6)e.appendChild(n.stateNode);else if(n.tag!==4&&n.child!==null){n.child.return=n,n=n.child;continue}if(n===t)break;for(;n.sibling===null;){if(n.return===null||n.return===t)return;n=n.return}n.sibling.return=n.return,n=n.sibling}},cc=function(e,t,n,r){var i=e.memoizedProps;if(i!==r){e=t.stateNode,po(lo.current);var o=null;switch(n){case`input`:i=ce(e,i),r=ce(e,r),o=[];break;case`select`:i=R({},i,{value:void 0}),r=R({},r,{value:void 0}),o=[];break;case`textarea`:i=ge(e,i),r=ge(e,r),o=[];break;default:typeof i.onClick!=`function`&&typeof r.onClick==`function`&&(e.onclick=gi)}Ae(n,r);var s;for(u in n=null,i)if(!r.hasOwnProperty(u)&&i.hasOwnProperty(u)&&i[u]!=null)if(u===`style`){var c=i[u];for(s in c)c.hasOwnProperty(s)&&(n||={},n[s]=``)}else u!==`dangerouslySetInnerHTML`&&u!==`children`&&u!==`suppressContentEditableWarning`&&u!==`suppressHydrationWarning`&&u!==`autoFocus`&&(a.hasOwnProperty(u)?o||=[]:(o||=[]).push(u,null));for(u in r){var l=r[u];if(c=i?.[u],r.hasOwnProperty(u)&&l!==c&&(l!=null||c!=null))if(u===`style`)if(c){for(s in c)!c.hasOwnProperty(s)||l&&l.hasOwnProperty(s)||(n||={},n[s]=``);for(s in l)l.hasOwnProperty(s)&&c[s]!==l[s]&&(n||={},n[s]=l[s])}else n||(o||=[],o.push(u,n)),n=l;else u===`dangerouslySetInnerHTML`?(l=l?l.__html:void 0,c=c?c.__html:void 0,l!=null&&c!==l&&(o||=[]).push(u,l)):u===`children`?typeof l!=`string`&&typeof l!=`number`||(o||=[]).push(u,``+l):u!==`suppressContentEditableWarning`&&u!==`suppressHydrationWarning`&&(a.hasOwnProperty(u)?(l!=null&&u===`onScroll`&&ni(`scroll`,e),o||c===l||(o=[])):(o||=[]).push(u,l))}n&&(o||=[]).push(`style`,n);var u=o;(t.updateQueue=u)&&(t.flags|=4)}},lc=function(e,t,n,r){n!==r&&(t.flags|=4)};function uc(e,t){if(!Sa)switch(e.tailMode){case`hidden`:t=e.tail;for(var n=null;t!==null;)t.alternate!==null&&(n=t),t=t.sibling;n===null?e.tail=null:n.sibling=null;break;case`collapsed`:n=e.tail;for(var 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}}function dc(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&14680064,r|=i.flags&14680064,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 fc(e,t,n){var i=t.pendingProps;switch(ya(t),t.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return dc(t),null;case 1:return Yi(t.type)&&Xi(),dc(t),null;case 3:return i=t.stateNode,ho(),Hi(Ki),Hi(Gi),xo(),i.pendingContext&&(i.context=i.pendingContext,i.pendingContext=null),(e===null||e.child===null)&&(ka(t)?t.flags|=4:e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,Ca!==null&&(wl(Ca),Ca=null))),dc(t),null;case 5:_o(t);var o=po(fo.current);if(n=t.type,e!==null&&t.stateNode!=null)cc(e,t,n,i,o),e.ref!==t.ref&&(t.flags|=512,t.flags|=2097152);else{if(!i){if(t.stateNode===null)throw Error(r(166));return dc(t),null}if(e=po(lo.current),ka(t)){i=t.stateNode,n=t.type;var s=t.memoizedProps;switch(i[ki]=t,i[Ai]=s,e=(t.mode&1)!=0,n){case`dialog`:ni(`cancel`,i),ni(`close`,i);break;case`iframe`:case`object`:case`embed`:ni(`load`,i);break;case`video`:case`audio`:for(o=0;o<Qr.length;o++)ni(Qr[o],i);break;case`source`:ni(`error`,i);break;case`img`:case`image`:case`link`:ni(`error`,i),ni(`load`,i);break;case`details`:ni(`toggle`,i);break;case`input`:le(i,s),ni(`invalid`,i);break;case`select`:i._wrapperState={wasMultiple:!!s.multiple},ni(`invalid`,i);break;case`textarea`:_e(i,s),ni(`invalid`,i)}for(var c in Ae(n,s),o=null,s)if(s.hasOwnProperty(c)){var l=s[c];c===`children`?typeof l==`string`?i.textContent!==l&&(!0!==s.suppressHydrationWarning&&hi(i.textContent,l,e),o=[`children`,l]):typeof l==`number`&&i.textContent!==``+l&&(!0!==s.suppressHydrationWarning&&hi(i.textContent,l,e),o=[`children`,``+l]):a.hasOwnProperty(c)&&l!=null&&c===`onScroll`&&ni(`scroll`,i)}switch(n){case`input`:ae(i),fe(i,s,!0);break;case`textarea`:ae(i),ye(i);break;case`select`:case`option`:break;default:typeof s.onClick==`function`&&(i.onclick=gi)}i=o,t.updateQueue=i,i!==null&&(t.flags|=4)}else{c=o.nodeType===9?o:o.ownerDocument,e===`http://www.w3.org/1999/xhtml`&&(e=be(n)),e===`http://www.w3.org/1999/xhtml`?n===`script`?(e=c.createElement(`div`),e.innerHTML=`<script><\/script>`,e=e.removeChild(e.firstChild)):typeof i.is==`string`?e=c.createElement(n,{is:i.is}):(e=c.createElement(n),n===`select`&&(c=e,i.multiple?c.multiple=!0:i.size&&(c.size=i.size))):e=c.createElementNS(e,n),e[ki]=t,e[Ai]=i,sc(e,t,!1,!1),t.stateNode=e;a:{switch(c=je(n,i),n){case`dialog`:ni(`cancel`,e),ni(`close`,e),o=i;break;case`iframe`:case`object`:case`embed`:ni(`load`,e),o=i;break;case`video`:case`audio`:for(o=0;o<Qr.length;o++)ni(Qr[o],e);o=i;break;case`source`:ni(`error`,e),o=i;break;case`img`:case`image`:case`link`:ni(`error`,e),ni(`load`,e),o=i;break;case`details`:ni(`toggle`,e),o=i;break;case`input`:le(e,i),o=ce(e,i),ni(`invalid`,e);break;case`option`:o=i;break;case`select`:e._wrapperState={wasMultiple:!!i.multiple},o=R({},i,{value:void 0}),ni(`invalid`,e);break;case`textarea`:_e(e,i),o=ge(e,i),ni(`invalid`,e);break;default:o=i}for(s in Ae(n,o),l=o,l)if(l.hasOwnProperty(s)){var u=l[s];s===`style`?Oe(e,u):s===`dangerouslySetInnerHTML`?(u=u?u.__html:void 0,u!=null&&Ce(e,u)):s===`children`?typeof u==`string`?(n!==`textarea`||u!==``)&&we(e,u):typeof u==`number`&&we(e,``+u):s!==`suppressContentEditableWarning`&&s!==`suppressHydrationWarning`&&s!==`autoFocus`&&(a.hasOwnProperty(s)?u!=null&&s===`onScroll`&&ni(`scroll`,e):u!=null&&S(e,s,u,c))}switch(n){case`input`:ae(e),fe(e,i,!1);break;case`textarea`:ae(e),ye(e);break;case`option`:i.value!=null&&e.setAttribute(`value`,``+U(i.value));break;case`select`:e.multiple=!!i.multiple,s=i.value,s==null?i.defaultValue!=null&&he(e,!!i.multiple,i.defaultValue,!0):he(e,!!i.multiple,s,!1);break;default:typeof o.onClick==`function`&&(e.onclick=gi)}switch(n){case`button`:case`input`:case`select`:case`textarea`:i=!!i.autoFocus;break a;case`img`:i=!0;break a;default:i=!1}}i&&(t.flags|=4)}t.ref!==null&&(t.flags|=512,t.flags|=2097152)}return dc(t),null;case 6:if(e&&t.stateNode!=null)lc(e,t,e.memoizedProps,i);else{if(typeof i!=`string`&&t.stateNode===null)throw Error(r(166));if(n=po(fo.current),po(lo.current),ka(t)){if(i=t.stateNode,n=t.memoizedProps,i[ki]=t,(s=i.nodeValue!==n)&&(e=ba,e!==null))switch(e.tag){case 3:hi(i.nodeValue,n,(e.mode&1)!=0);break;case 5:!0!==e.memoizedProps.suppressHydrationWarning&&hi(i.nodeValue,n,(e.mode&1)!=0)}s&&(t.flags|=4)}else i=(n.nodeType===9?n:n.ownerDocument).createTextNode(i),i[ki]=t,t.stateNode=i}return dc(t),null;case 13:if(Hi(vo),i=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(Sa&&xa!==null&&t.mode&1&&!(t.flags&128))Aa(),ja(),t.flags|=98560,s=!1;else if(s=ka(t),i!==null&&i.dehydrated!==null){if(e===null){if(!s)throw Error(r(318));if(s=t.memoizedState,s=s===null?null:s.dehydrated,!s)throw Error(r(317));s[ki]=t}else ja(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;dc(t),s=!1}else Ca!==null&&(wl(Ca),Ca=null),s=!0;if(!s)return t.flags&65536?t:null}return t.flags&128?(t.lanes=n,t):(i=i!==null,i!==(e!==null&&e.memoizedState!==null)&&i&&(t.child.flags|=8192,t.mode&1&&(e===null||vo.current&1?Qc===0&&(Qc=3):Pl())),t.updateQueue!==null&&(t.flags|=4),dc(t),null);case 4:return ho(),e===null&&ai(t.stateNode.containerInfo),dc(t),null;case 10:return Ga(t.type._context),dc(t),null;case 17:return Yi(t.type)&&Xi(),dc(t),null;case 19:if(Hi(vo),s=t.memoizedState,s===null)return dc(t),null;if(i=(t.flags&128)!=0,c=s.rendering,c===null)if(i)uc(s,!1);else{if(Qc!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(c=yo(e),c!==null){for(t.flags|=128,uc(s,!1),i=c.updateQueue,i!==null&&(t.updateQueue=i,t.flags|=4),t.subtreeFlags=0,i=n,n=t.child;n!==null;)s=n,e=i,s.flags&=14680066,c=s.alternate,c===null?(s.childLanes=0,s.lanes=e,s.child=null,s.subtreeFlags=0,s.memoizedProps=null,s.memoizedState=null,s.updateQueue=null,s.dependencies=null,s.stateNode=null):(s.childLanes=c.childLanes,s.lanes=c.lanes,s.child=c.child,s.subtreeFlags=0,s.deletions=null,s.memoizedProps=c.memoizedProps,s.memoizedState=c.memoizedState,s.updateQueue=c.updateQueue,s.type=c.type,e=c.dependencies,s.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext}),n=n.sibling;return Ui(vo,vo.current&1|2),t.child}e=e.sibling}s.tail!==null&&ut()>ol&&(t.flags|=128,i=!0,uc(s,!1),t.lanes=4194304)}else{if(!i)if(e=yo(c),e!==null){if(t.flags|=128,i=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),uc(s,!0),s.tail===null&&s.tailMode===`hidden`&&!c.alternate&&!Sa)return dc(t),null}else 2*ut()-s.renderingStartTime>ol&&n!==1073741824&&(t.flags|=128,i=!0,uc(s,!1),t.lanes=4194304);s.isBackwards?(c.sibling=t.child,t.child=c):(n=s.last,n===null?t.child=c:n.sibling=c,s.last=c)}return s.tail===null?(dc(t),null):(t=s.tail,s.rendering=t,s.tail=t.sibling,s.renderingStartTime=ut(),t.sibling=null,n=vo.current,Ui(vo,i?n&1|2:n&1),t);case 22:case 23:return Al(),i=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==i&&(t.flags|=8192),i&&t.mode&1?Xc&1073741824&&(dc(t),t.subtreeFlags&6&&(t.flags|=8192)):dc(t),null;case 24:return null;case 25:return null}throw Error(r(156,t.tag))}function pc(e,t){switch(ya(t),t.tag){case 1:return Yi(t.type)&&Xi(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return ho(),Hi(Ki),Hi(Gi),xo(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return _o(t),null;case 13:if(Hi(vo),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(r(340));ja()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return Hi(vo),null;case 4:return ho(),null;case 10:return Ga(t.type._context),null;case 22:case 23:return Al(),null;case 24:return null;default:return null}}var mc=!1,hc=!1,gc=typeof WeakSet==`function`?WeakSet:Set,q=null;function _c(e,t){var n=e.ref;if(n!==null)if(typeof n==`function`)try{n(null)}catch(n){Wl(e,t,n)}else n.current=null}function vc(e,t,n){try{n()}catch(n){Wl(e,t,n)}}var yc=!1;function bc(e,t){if(_i=ln,e=kr(),Ar(e)){if(`selectionStart`in e)var n={start:e.selectionStart,end:e.selectionEnd};else a:{n=(n=e.ownerDocument)&&n.defaultView||window;var i=n.getSelection&&n.getSelection();if(i&&i.rangeCount!==0){n=i.anchorNode;var a=i.anchorOffset,o=i.focusNode;i=i.focusOffset;try{n.nodeType,o.nodeType}catch{n=null;break a}var s=0,c=-1,l=-1,u=0,d=0,f=e,p=null;b:for(;;){for(var m;f!==n||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===n&&++u===a&&(c=s),p===o&&++d===i&&(l=s),(m=f.nextSibling)!==null)break;f=p,p=f.parentNode}f=m}n=c===-1||l===-1?null:{start:c,end:l}}else n=null}n||={start:0,end:0}}else n=null;for(vi={focusedElem:e,selectionRange:n},ln=!1,q=t;q!==null;)if(t=q,e=t.child,t.subtreeFlags&1028&&e!==null)e.return=t,q=e;else for(;q!==null;){t=q;try{var h=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(h!==null){var g=h.memoizedProps,_=h.memoizedState,v=t.stateNode;v.__reactInternalSnapshotBeforeUpdate=v.getSnapshotBeforeUpdate(t.elementType===t.type?g:bs(t.type,g),_)}break;case 3:var y=t.stateNode.containerInfo;y.nodeType===1?y.textContent=``:y.nodeType===9&&y.documentElement&&y.removeChild(y.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(r(163))}}catch(e){Wl(t,t.return,e)}if(e=t.sibling,e!==null){e.return=t.return,q=e;break}q=t.return}return h=yc,yc=!1,h}function xc(e,t,n){var r=t.updateQueue;if(r=r===null?null:r.lastEffect,r!==null){var i=r=r.next;do{if((i.tag&e)===e){var a=i.destroy;i.destroy=void 0,a!==void 0&&vc(t,n,a)}i=i.next}while(i!==r)}}function Sc(e,t){if(t=t.updateQueue,t=t===null?null:t.lastEffect,t!==null){var n=t=t.next;do{if((n.tag&e)===e){var r=n.create;n.destroy=r()}n=n.next}while(n!==t)}}function Cc(e){var t=e.ref;if(t!==null){var n=e.stateNode;switch(e.tag){case 5:e=n;break;default:e=n}typeof t==`function`?t(e):t.current=e}}function wc(e){var t=e.alternate;t!==null&&(e.alternate=null,wc(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[ki],delete t[Ai],delete t[Mi],delete t[Ni],delete t[Pi])),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function Tc(e){return e.tag===5||e.tag===3||e.tag===4}function Ec(e){a:for(;;){for(;e.sibling===null;){if(e.return===null||Tc(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.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 Dc(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.nodeType===8?n.parentNode.insertBefore(e,t):n.insertBefore(e,t):(n.nodeType===8?(t=n.parentNode,t.insertBefore(e,n)):(t=n,t.appendChild(e)),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=gi));else if(r!==4&&(e=e.child,e!==null))for(Dc(e,t,n),e=e.sibling;e!==null;)Dc(e,t,n),e=e.sibling}function Oc(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(r!==4&&(e=e.child,e!==null))for(Oc(e,t,n),e=e.sibling;e!==null;)Oc(e,t,n),e=e.sibling}var kc=null,Ac=!1;function jc(e,t,n){for(n=n.child;n!==null;)Mc(e,t,n),n=n.sibling}function Mc(e,t,n){if(vt&&typeof vt.onCommitFiberUnmount==`function`)try{vt.onCommitFiberUnmount(_t,n)}catch{}switch(n.tag){case 5:hc||_c(n,t);case 6:var r=kc,i=Ac;kc=null,jc(e,t,n),kc=r,Ac=i,kc!==null&&(Ac?(e=kc,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):kc.removeChild(n.stateNode));break;case 18:kc!==null&&(Ac?(e=kc,n=n.stateNode,e.nodeType===8?Ti(e.parentNode,n):e.nodeType===1&&Ti(e,n),sn(e)):Ti(kc,n.stateNode));break;case 4:r=kc,i=Ac,kc=n.stateNode.containerInfo,Ac=!0,jc(e,t,n),kc=r,Ac=i;break;case 0:case 11:case 14:case 15:if(!hc&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){i=r=r.next;do{var a=i,o=a.destroy;a=a.tag,o!==void 0&&(a&2||a&4)&&vc(n,t,o),i=i.next}while(i!==r)}jc(e,t,n);break;case 1:if(!hc&&(_c(n,t),r=n.stateNode,typeof r.componentWillUnmount==`function`))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(e){Wl(n,t,e)}jc(e,t,n);break;case 21:jc(e,t,n);break;case 22:n.mode&1?(hc=(r=hc)||n.memoizedState!==null,jc(e,t,n),hc=r):jc(e,t,n);break;default:jc(e,t,n)}}function Nc(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new gc),t.forEach(function(t){var r=Jl.bind(null,e,t);n.has(t)||(n.add(t),t.then(r,r))})}}function Pc(e,t){var n=t.deletions;if(n!==null)for(var i=0;i<n.length;i++){var a=n[i];try{var o=e,s=t,c=s;a:for(;c!==null;){switch(c.tag){case 5:kc=c.stateNode,Ac=!1;break a;case 3:kc=c.stateNode.containerInfo,Ac=!0;break a;case 4:kc=c.stateNode.containerInfo,Ac=!0;break a}c=c.return}if(kc===null)throw Error(r(160));Mc(o,s,a),kc=null,Ac=!1;var l=a.alternate;l!==null&&(l.return=null),a.return=null}catch(e){Wl(a,t,e)}}if(t.subtreeFlags&12854)for(t=t.child;t!==null;)Fc(t,e),t=t.sibling}function Fc(e,t){var n=e.alternate,i=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:if(Pc(t,e),Ic(e),i&4){try{xc(3,e,e.return),Sc(3,e)}catch(t){Wl(e,e.return,t)}try{xc(5,e,e.return)}catch(t){Wl(e,e.return,t)}}break;case 1:Pc(t,e),Ic(e),i&512&&n!==null&&_c(n,n.return);break;case 5:if(Pc(t,e),Ic(e),i&512&&n!==null&&_c(n,n.return),e.flags&32){var a=e.stateNode;try{we(a,``)}catch(t){Wl(e,e.return,t)}}if(i&4&&(a=e.stateNode,a!=null)){var o=e.memoizedProps,s=n===null?o:n.memoizedProps,c=e.type,l=e.updateQueue;if(e.updateQueue=null,l!==null)try{c===`input`&&o.type===`radio`&&o.name!=null&&ue(a,o),je(c,s);var u=je(c,o);for(s=0;s<l.length;s+=2){var d=l[s],f=l[s+1];d===`style`?Oe(a,f):d===`dangerouslySetInnerHTML`?Ce(a,f):d===`children`?we(a,f):S(a,d,f,u)}switch(c){case`input`:de(a,o);break;case`textarea`:ve(a,o);break;case`select`:var p=a._wrapperState.wasMultiple;a._wrapperState.wasMultiple=!!o.multiple;var m=o.value;m==null?p!==!!o.multiple&&(o.defaultValue==null?he(a,!!o.multiple,o.multiple?[]:``,!1):he(a,!!o.multiple,o.defaultValue,!0)):he(a,!!o.multiple,m,!1)}a[Ai]=o}catch(t){Wl(e,e.return,t)}}break;case 6:if(Pc(t,e),Ic(e),i&4){if(e.stateNode===null)throw Error(r(162));a=e.stateNode,o=e.memoizedProps;try{a.nodeValue=o}catch(t){Wl(e,e.return,t)}}break;case 3:if(Pc(t,e),Ic(e),i&4&&n!==null&&n.memoizedState.isDehydrated)try{sn(t.containerInfo)}catch(t){Wl(e,e.return,t)}break;case 4:Pc(t,e),Ic(e);break;case 13:Pc(t,e),Ic(e),a=e.child,a.flags&8192&&(o=a.memoizedState!==null,a.stateNode.isHidden=o,!o||a.alternate!==null&&a.alternate.memoizedState!==null||(al=ut())),i&4&&Nc(e);break;case 22:if(d=n!==null&&n.memoizedState!==null,e.mode&1?(hc=(u=hc)||d,Pc(t,e),hc=u):Pc(t,e),Ic(e),i&8192){if(u=e.memoizedState!==null,(e.stateNode.isHidden=u)&&!d&&e.mode&1)for(q=e,d=e.child;d!==null;){for(f=q=d;q!==null;){switch(p=q,m=p.child,p.tag){case 0:case 11:case 14:case 15:xc(4,p,p.return);break;case 1:_c(p,p.return);var h=p.stateNode;if(typeof h.componentWillUnmount==`function`){i=p,n=p.return;try{t=i,h.props=t.memoizedProps,h.state=t.memoizedState,h.componentWillUnmount()}catch(e){Wl(i,n,e)}}break;case 5:_c(p,p.return);break;case 22:if(p.memoizedState!==null){Bc(f);continue}}m===null?Bc(f):(m.return=p,q=m)}d=d.sibling}a:for(d=null,f=e;;){if(f.tag===5){if(d===null){d=f;try{a=f.stateNode,u?(o=a.style,typeof o.setProperty==`function`?o.setProperty(`display`,`none`,`important`):o.display=`none`):(c=f.stateNode,l=f.memoizedProps.style,s=l!=null&&l.hasOwnProperty(`display`)?l.display:null,c.style.display=De(`display`,s))}catch(t){Wl(e,e.return,t)}}}else if(f.tag===6){if(d===null)try{f.stateNode.nodeValue=u?``:f.memoizedProps}catch(t){Wl(e,e.return,t)}}else if((f.tag!==22&&f.tag!==23||f.memoizedState===null||f===e)&&f.child!==null){f.child.return=f,f=f.child;continue}if(f===e)break a;for(;f.sibling===null;){if(f.return===null||f.return===e)break a;d===f&&(d=null),f=f.return}d===f&&(d=null),f.sibling.return=f.return,f=f.sibling}}break;case 19:Pc(t,e),Ic(e),i&4&&Nc(e);break;case 21:break;default:Pc(t,e),Ic(e)}}function Ic(e){var t=e.flags;if(t&2){try{a:{for(var n=e.return;n!==null;){if(Tc(n)){var i=n;break a}n=n.return}throw Error(r(160))}switch(i.tag){case 5:var a=i.stateNode;i.flags&32&&(we(a,``),i.flags&=-33),Oc(e,Ec(e),a);break;case 3:case 4:var o=i.stateNode.containerInfo;Dc(e,Ec(e),o);break;default:throw Error(r(161))}}catch(t){Wl(e,e.return,t)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function Lc(e,t,n){q=e,Rc(e,t,n)}function Rc(e,t,n){for(var r=(e.mode&1)!=0;q!==null;){var i=q,a=i.child;if(i.tag===22&&r){var o=i.memoizedState!==null||mc;if(!o){var s=i.alternate,c=s!==null&&s.memoizedState!==null||hc;s=mc;var l=hc;if(mc=o,(hc=c)&&!l)for(q=i;q!==null;)o=q,c=o.child,o.tag===22&&o.memoizedState!==null||c===null?Vc(i):(c.return=o,q=c);for(;a!==null;)q=a,Rc(a,t,n),a=a.sibling;q=i,mc=s,hc=l}zc(e,t,n)}else i.subtreeFlags&8772&&a!==null?(a.return=i,q=a):zc(e,t,n)}}function zc(e){for(;q!==null;){var t=q;if(t.flags&8772){var n=t.alternate;try{if(t.flags&8772)switch(t.tag){case 0:case 11:case 15:hc||Sc(5,t);break;case 1:var i=t.stateNode;if(t.flags&4&&!hc)if(n===null)i.componentDidMount();else{var a=t.elementType===t.type?n.memoizedProps:bs(t.type,n.memoizedProps);i.componentDidUpdate(a,n.memoizedState,i.__reactInternalSnapshotBeforeUpdate)}var o=t.updateQueue;o!==null&&so(t,o,i);break;case 3:var s=t.updateQueue;if(s!==null){if(n=null,t.child!==null)switch(t.child.tag){case 5:n=t.child.stateNode;break;case 1:n=t.child.stateNode}so(t,s,n)}break;case 5:var c=t.stateNode;if(n===null&&t.flags&4){n=c;var l=t.memoizedProps;switch(t.type){case`button`:case`input`:case`select`:case`textarea`:l.autoFocus&&n.focus();break;case`img`:l.src&&(n.src=l.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(t.memoizedState===null){var u=t.alternate;if(u!==null){var d=u.memoizedState;if(d!==null){var f=d.dehydrated;f!==null&&sn(f)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(r(163))}hc||t.flags&512&&Cc(t)}catch(e){Wl(t,t.return,e)}}if(t===e){q=null;break}if(n=t.sibling,n!==null){n.return=t.return,q=n;break}q=t.return}}function Bc(e){for(;q!==null;){var t=q;if(t===e){q=null;break}var n=t.sibling;if(n!==null){n.return=t.return,q=n;break}q=t.return}}function Vc(e){for(;q!==null;){var t=q;try{switch(t.tag){case 0:case 11:case 15:var n=t.return;try{Sc(4,t)}catch(e){Wl(t,n,e)}break;case 1:var r=t.stateNode;if(typeof r.componentDidMount==`function`){var i=t.return;try{r.componentDidMount()}catch(e){Wl(t,i,e)}}var a=t.return;try{Cc(t)}catch(e){Wl(t,a,e)}break;case 5:var o=t.return;try{Cc(t)}catch(e){Wl(t,o,e)}}}catch(e){Wl(t,t.return,e)}if(t===e){q=null;break}var s=t.sibling;if(s!==null){s.return=t.return,q=s;break}q=t.return}}var Hc=Math.ceil,Uc=C.ReactCurrentDispatcher,Wc=C.ReactCurrentOwner,Gc=C.ReactCurrentBatchConfig,Kc=0,qc=null,Jc=null,Yc=0,Xc=0,Zc=Vi(0),Qc=0,$c=null,el=0,tl=0,nl=0,rl=null,il=null,al=0,ol=1/0,sl=null,cl=!1,ll=null,ul=null,dl=!1,fl=null,pl=0,ml=0,hl=null,gl=-1,_l=0;function vl(){return Kc&6?ut():gl===-1?gl=ut():gl}function yl(e){return e.mode&1?Kc&2&&Yc!==0?Yc&-Yc:Na.transition===null?(e=It,e===0?(e=window.event,e=e===void 0?16:hn(e.type),e):e):(_l===0&&(_l=jt()),_l):1}function bl(e,t,n,i){if(50<ml)throw ml=0,hl=null,Error(r(185));Nt(e,n,i),(!(Kc&2)||e!==qc)&&(e===qc&&(!(Kc&2)&&(tl|=n),Qc===4&&El(e,Yc)),xl(e,i),n===1&&Kc===0&&!(t.mode&1)&&(ol=ut()+500,na&&oa()))}function xl(e,t){var n=e.callbackNode;kt(e,t);var r=Dt(e,e===qc?Yc:0);if(r===0)n!==null&&st(n),e.callbackNode=null,e.callbackPriority=0;else if(t=r&-r,e.callbackPriority!==t){if(n!=null&&st(n),t===1)e.tag===0?aa(Dl.bind(null,e)):ia(Dl.bind(null,e)),Ci(function(){!(Kc&6)&&oa()}),n=null;else{switch(Lt(r)){case 1:n=ft;break;case 4:n=pt;break;case 16:n=mt;break;case 536870912:n=gt;break;default:n=mt}n=Xl(n,Sl.bind(null,e))}e.callbackPriority=t,e.callbackNode=n}}function Sl(e,t){if(gl=-1,_l=0,Kc&6)throw Error(r(327));var n=e.callbackNode;if(Hl()&&e.callbackNode!==n)return null;var i=Dt(e,e===qc?Yc:0);if(i===0)return null;if(i&30||(i&e.expiredLanes)!==0||t)t=Fl(e,i);else{t=i;var a=Kc;Kc|=2;var o=Nl();(qc!==e||Yc!==t)&&(sl=null,ol=ut()+500,jl(e,t));do try{Ll();break}catch(t){Ml(e,t)}while(1);Wa(),Uc.current=o,Kc=a,Jc===null?(qc=null,Yc=0,t=Qc):t=0}if(t!==0){if(t===2&&(a=At(e),a!==0&&(i=a,t=Cl(e,a))),t===1)throw n=$c,jl(e,0),El(e,i),xl(e,ut()),n;if(t===6)El(e,i);else{if(a=e.current.alternate,!(i&30)&&!Tl(a)&&(t=Fl(e,i),t===2&&(o=At(e),o!==0&&(i=o,t=Cl(e,o))),t===1))throw n=$c,jl(e,0),El(e,i),xl(e,ut()),n;switch(e.finishedWork=a,e.finishedLanes=i,t){case 0:case 1:throw Error(r(345));case 2:Bl(e,il,sl);break;case 3:if(El(e,i),(i&130023424)===i&&(t=al+500-ut(),10<t)){if(Dt(e,0)!==0)break;if(a=e.suspendedLanes,(a&i)!==i){vl(),e.pingedLanes|=e.suspendedLanes&a;break}e.timeoutHandle=bi(Bl.bind(null,e,il,sl),t);break}Bl(e,il,sl);break;case 4:if(El(e,i),(i&4194240)===i)break;for(t=e.eventTimes,a=-1;0<i;){var s=31-bt(i);o=1<<s,s=t[s],s>a&&(a=s),i&=~o}if(i=a,i=ut()-i,i=(120>i?120:480>i?480:1080>i?1080:1920>i?1920:3e3>i?3e3:4320>i?4320:1960*Hc(i/1960))-i,10<i){e.timeoutHandle=bi(Bl.bind(null,e,il,sl),i);break}Bl(e,il,sl);break;case 5:Bl(e,il,sl);break;default:throw Error(r(329))}}}return xl(e,ut()),e.callbackNode===n?Sl.bind(null,e):null}function Cl(e,t){var n=rl;return e.current.memoizedState.isDehydrated&&(jl(e,t).flags|=256),e=Fl(e,t),e!==2&&(t=il,il=n,t!==null&&wl(t)),e}function wl(e){il===null?il=e:il.push.apply(il,e)}function Tl(e){for(var t=e;;){if(t.flags&16384){var n=t.updateQueue;if(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 El(e,t){for(t&=~nl,t&=~tl,e.suspendedLanes|=t,e.pingedLanes&=~t,e=e.expirationTimes;0<t;){var n=31-bt(t),r=1<<n;e[n]=-1,t&=~r}}function Dl(e){if(Kc&6)throw Error(r(327));Hl();var t=Dt(e,0);if(!(t&1))return xl(e,ut()),null;var n=Fl(e,t);if(e.tag!==0&&n===2){var i=At(e);i!==0&&(t=i,n=Cl(e,i))}if(n===1)throw n=$c,jl(e,0),El(e,t),xl(e,ut()),n;if(n===6)throw Error(r(345));return e.finishedWork=e.current.alternate,e.finishedLanes=t,Bl(e,il,sl),xl(e,ut()),null}function Ol(e,t){var n=Kc;Kc|=1;try{return e(t)}finally{Kc=n,Kc===0&&(ol=ut()+500,na&&oa())}}function kl(e){fl!==null&&fl.tag===0&&!(Kc&6)&&Hl();var t=Kc;Kc|=1;var n=Gc.transition,r=It;try{if(Gc.transition=null,It=1,e)return e()}finally{It=r,Gc.transition=n,Kc=t,!(Kc&6)&&oa()}}function Al(){Xc=Zc.current,Hi(Zc)}function jl(e,t){e.finishedWork=null,e.finishedLanes=0;var n=e.timeoutHandle;if(n!==-1&&(e.timeoutHandle=-1,xi(n)),Jc!==null)for(n=Jc.return;n!==null;){var r=n;switch(ya(r),r.tag){case 1:r=r.type.childContextTypes,r!=null&&Xi();break;case 3:ho(),Hi(Ki),Hi(Gi),xo();break;case 5:_o(r);break;case 4:ho();break;case 13:Hi(vo);break;case 19:Hi(vo);break;case 10:Ga(r.type._context);break;case 22:case 23:Al()}n=n.return}if(qc=e,Jc=e=tu(e.current,null),Yc=Xc=t,Qc=0,$c=null,nl=tl=el=0,il=rl=null,Ya!==null){for(t=0;t<Ya.length;t++)if(n=Ya[t],r=n.interleaved,r!==null){n.interleaved=null;var i=r.next,a=n.pending;if(a!==null){var o=a.next;a.next=i,r.next=o}n.pending=r}Ya=null}return e}function Ml(e,t){do{var n=Jc;try{if(Wa(),So.current=gs,Oo){for(var i=To.memoizedState;i!==null;){var a=i.queue;a!==null&&(a.pending=null),i=i.next}Oo=!1}if(wo=0,Do=Eo=To=null,ko=!1,Ao=0,Wc.current=null,n===null||n.return===null){Qc=1,$c=t,Jc=null;break}a:{var o=e,s=n.return,c=n,l=t;if(t=Yc,c.flags|=32768,typeof l==`object`&&l&&typeof l.then==`function`){var u=l,d=c,f=d.tag;if(!(d.mode&1)&&(f===0||f===11||f===15)){var p=d.alternate;p?(d.updateQueue=p.updateQueue,d.memoizedState=p.memoizedState,d.lanes=p.lanes):(d.updateQueue=null,d.memoizedState=null)}var m=Ps(s);if(m!==null){m.flags&=-257,Fs(m,s,c,o,t),m.mode&1&&Ns(o,u,t),t=m,l=u;var h=t.updateQueue;if(h===null){var g=new Set;g.add(l),t.updateQueue=g}else h.add(l);break a}else{if(!(t&1)){Ns(o,u,t),Pl();break a}l=Error(r(426))}}else if(Sa&&c.mode&1){var _=Ps(s);if(_!==null){!(_.flags&65536)&&(_.flags|=256),Fs(_,s,c,o,t),Ma(Ds(l,c));break a}}o=l=Ds(l,c),Qc!==4&&(Qc=2),rl===null?rl=[o]:rl.push(o),o=s;do{switch(o.tag){case 3:o.flags|=65536,t&=-t,o.lanes|=t;var v=js(o,l,t);ao(o,v);break a;case 1:c=l;var y=o.type,b=o.stateNode;if(!(o.flags&128)&&(typeof y.getDerivedStateFromError==`function`||b!==null&&typeof b.componentDidCatch==`function`&&(ul===null||!ul.has(b)))){o.flags|=65536,t&=-t,o.lanes|=t;var x=Ms(o,c,t);ao(o,x);break a}}o=o.return}while(o!==null)}zl(n)}catch(e){t=e,Jc===n&&n!==null&&(Jc=n=n.return);continue}break}while(1)}function Nl(){var e=Uc.current;return Uc.current=gs,e===null?gs:e}function Pl(){(Qc===0||Qc===3||Qc===2)&&(Qc=4),qc===null||!(el&268435455)&&!(tl&268435455)||El(qc,Yc)}function Fl(e,t){var n=Kc;Kc|=2;var i=Nl();(qc!==e||Yc!==t)&&(sl=null,jl(e,t));do try{Il();break}catch(t){Ml(e,t)}while(1);if(Wa(),Kc=n,Uc.current=i,Jc!==null)throw Error(r(261));return qc=null,Yc=0,Qc}function Il(){for(;Jc!==null;)Rl(Jc)}function Ll(){for(;Jc!==null&&!ct();)Rl(Jc)}function Rl(e){var t=Yl(e.alternate,e,Xc);e.memoizedProps=e.pendingProps,t===null?zl(e):Jc=t,Wc.current=null}function zl(e){var t=e;do{var n=t.alternate;if(e=t.return,t.flags&32768){if(n=pc(n,t),n!==null){n.flags&=32767,Jc=n;return}if(e!==null)e.flags|=32768,e.subtreeFlags=0,e.deletions=null;else{Qc=6,Jc=null;return}}else if(n=fc(n,t,Xc),n!==null){Jc=n;return}if(t=t.sibling,t!==null){Jc=t;return}Jc=t=e}while(t!==null);Qc===0&&(Qc=5)}function Bl(e,t,n){var r=It,i=Gc.transition;try{Gc.transition=null,It=1,Vl(e,t,n,r)}finally{Gc.transition=i,It=r}return null}function Vl(e,t,n,i){do Hl();while(fl!==null);if(Kc&6)throw Error(r(327));n=e.finishedWork;var a=e.finishedLanes;if(n===null)return null;if(e.finishedWork=null,e.finishedLanes=0,n===e.current)throw Error(r(177));e.callbackNode=null,e.callbackPriority=0;var o=n.lanes|n.childLanes;if(Pt(e,o),e===qc&&(Jc=qc=null,Yc=0),!(n.subtreeFlags&2064)&&!(n.flags&2064)||dl||(dl=!0,Xl(mt,function(){return Hl(),null})),o=(n.flags&15990)!=0,n.subtreeFlags&15990||o){o=Gc.transition,Gc.transition=null;var s=It;It=1;var c=Kc;Kc|=4,Wc.current=null,bc(e,n),Fc(n,e),jr(vi),ln=!!_i,vi=_i=null,e.current=n,Lc(n,e,a),lt(),Kc=c,It=s,Gc.transition=o}else e.current=n;if(dl&&(dl=!1,fl=e,pl=a),o=e.pendingLanes,o===0&&(ul=null),yt(n.stateNode,i),xl(e,ut()),t!==null)for(i=e.onRecoverableError,n=0;n<t.length;n++)a=t[n],i(a.value,{componentStack:a.stack,digest:a.digest});if(cl)throw cl=!1,e=ll,ll=null,e;return pl&1&&e.tag!==0&&Hl(),o=e.pendingLanes,o&1?e===hl?ml++:(ml=0,hl=e):ml=0,oa(),null}function Hl(){if(fl!==null){var e=Lt(pl),t=Gc.transition,n=It;try{if(Gc.transition=null,It=16>e?16:e,fl===null)var i=!1;else{if(e=fl,fl=null,pl=0,Kc&6)throw Error(r(331));var a=Kc;for(Kc|=4,q=e.current;q!==null;){var o=q,s=o.child;if(q.flags&16){var c=o.deletions;if(c!==null){for(var l=0;l<c.length;l++){var u=c[l];for(q=u;q!==null;){var d=q;switch(d.tag){case 0:case 11:case 15:xc(8,d,o)}var f=d.child;if(f!==null)f.return=d,q=f;else for(;q!==null;){d=q;var p=d.sibling,m=d.return;if(wc(d),d===u){q=null;break}if(p!==null){p.return=m,q=p;break}q=m}}}var h=o.alternate;if(h!==null){var g=h.child;if(g!==null){h.child=null;do{var _=g.sibling;g.sibling=null,g=_}while(g!==null)}}q=o}}if(o.subtreeFlags&2064&&s!==null)s.return=o,q=s;else b:for(;q!==null;){if(o=q,o.flags&2048)switch(o.tag){case 0:case 11:case 15:xc(9,o,o.return)}var v=o.sibling;if(v!==null){v.return=o.return,q=v;break b}q=o.return}}var y=e.current;for(q=y;q!==null;){s=q;var b=s.child;if(s.subtreeFlags&2064&&b!==null)b.return=s,q=b;else b:for(s=y;q!==null;){if(c=q,c.flags&2048)try{switch(c.tag){case 0:case 11:case 15:Sc(9,c)}}catch(e){Wl(c,c.return,e)}if(c===s){q=null;break b}var x=c.sibling;if(x!==null){x.return=c.return,q=x;break b}q=c.return}}if(Kc=a,oa(),vt&&typeof vt.onPostCommitFiberRoot==`function`)try{vt.onPostCommitFiberRoot(_t,e)}catch{}i=!0}return i}finally{It=n,Gc.transition=t}}return!1}function Ul(e,t,n){t=Ds(n,t),t=js(e,t,1),e=ro(e,t,1),t=vl(),e!==null&&(Nt(e,1,t),xl(e,t))}function Wl(e,t,n){if(e.tag===3)Ul(e,e,n);else for(;t!==null;){if(t.tag===3){Ul(t,e,n);break}else if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError==`function`||typeof r.componentDidCatch==`function`&&(ul===null||!ul.has(r))){e=Ds(n,e),e=Ms(t,e,1),t=ro(t,e,1),e=vl(),t!==null&&(Nt(t,1,e),xl(t,e));break}}t=t.return}}function Gl(e,t,n){var r=e.pingCache;r!==null&&r.delete(t),t=vl(),e.pingedLanes|=e.suspendedLanes&n,qc===e&&(Yc&n)===n&&(Qc===4||Qc===3&&(Yc&130023424)===Yc&&500>ut()-al?jl(e,0):nl|=n),xl(e,t)}function Kl(e,t){t===0&&(e.mode&1?(t=Tt,Tt<<=1,!(Tt&130023424)&&(Tt=4194304)):t=1);var n=vl();e=Qa(e,t),e!==null&&(Nt(e,t,n),xl(e,n))}function ql(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),Kl(e,n)}function Jl(e,t){var n=0;switch(e.tag){case 13:var i=e.stateNode,a=e.memoizedState;a!==null&&(n=a.retryLane);break;case 19:i=e.stateNode;break;default:throw Error(r(314))}i!==null&&i.delete(t),Kl(e,n)}var Yl=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||Ki.current)Ls=!0;else{if((e.lanes&n)===0&&!(t.flags&128))return Ls=!1,oc(e,t,n);Ls=!!(e.flags&131072)}else Ls=!1,Sa&&t.flags&1048576&&_a(t,ua,t.index);switch(t.lanes=0,t.tag){case 2:var i=t.type;ic(e,t),e=t.pendingProps;var a=Ji(t,Gi.current);qa(t,n),a=Po(null,t,i,e,a,n);var o=Fo();return t.flags|=1,typeof a==`object`&&a&&typeof a.render==`function`&&a.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,Yi(i)?(o=!0,$i(t)):o=!1,t.memoizedState=a.state!==null&&a.state!==void 0?a.state:null,eo(t),a.updater=Ss,t.stateNode=a,a._reactInternals=t,Es(t,i,e,n),t=Ks(null,t,i,!0,o,n)):(t.tag=0,Sa&&o&&va(t),Rs(null,t,a,n),t=t.child),t;case 16:i=t.elementType;a:{switch(ic(e,t),e=t.pendingProps,a=i._init,i=a(i._payload),t.type=i,a=t.tag=eu(i),e=bs(i,e),a){case 0:t=Ws(null,t,i,e,n);break a;case 1:t=Gs(null,t,i,e,n);break a;case 11:t=zs(null,t,i,e,n);break a;case 14:t=Bs(null,t,i,bs(i.type,e),n);break a}throw Error(r(306,i,``))}return t;case 0:return i=t.type,a=t.pendingProps,a=t.elementType===i?a:bs(i,a),Ws(e,t,i,a,n);case 1:return i=t.type,a=t.pendingProps,a=t.elementType===i?a:bs(i,a),Gs(e,t,i,a,n);case 3:a:{if(qs(t),e===null)throw Error(r(387));i=t.pendingProps,o=t.memoizedState,a=o.element,to(e,t),oo(t,i,null,n);var s=t.memoizedState;if(i=s.element,o.isDehydrated)if(o={element:i,isDehydrated:!1,cache:s.cache,pendingSuspenseBoundaries:s.pendingSuspenseBoundaries,transitions:s.transitions},t.updateQueue.baseState=o,t.memoizedState=o,t.flags&256){a=Ds(Error(r(423)),t),t=Js(e,t,i,n,a);break a}else if(i!==a){a=Ds(Error(r(424)),t),t=Js(e,t,i,n,a);break a}else for(xa=Ei(t.stateNode.containerInfo.firstChild),ba=t,Sa=!0,Ca=null,n=za(t,null,i,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(ja(),i===a){t=ac(e,t,n);break a}Rs(e,t,i,n)}t=t.child}return t;case 5:return go(t),e===null&&Da(t),i=t.type,a=t.pendingProps,o=e===null?null:e.memoizedProps,s=a.children,yi(i,a)?s=null:o!==null&&yi(i,o)&&(t.flags|=32),Us(e,t),Rs(e,t,s,n),t.child;case 6:return e===null&&Da(t),null;case 13:return Zs(e,t,n);case 4:return mo(t,t.stateNode.containerInfo),i=t.pendingProps,e===null?t.child=Ra(t,null,i,n):Rs(e,t,i,n),t.child;case 11:return i=t.type,a=t.pendingProps,a=t.elementType===i?a:bs(i,a),zs(e,t,i,a,n);case 7:return Rs(e,t,t.pendingProps,n),t.child;case 8:return Rs(e,t,t.pendingProps.children,n),t.child;case 12:return Rs(e,t,t.pendingProps.children,n),t.child;case 10:a:{if(i=t.type._context,a=t.pendingProps,o=t.memoizedProps,s=a.value,Ui(Ba,i._currentValue),i._currentValue=s,o!==null)if(wr(o.value,s)){if(o.children===a.children&&!Ki.current){t=ac(e,t,n);break a}}else for(o=t.child,o!==null&&(o.return=t);o!==null;){var c=o.dependencies;if(c!==null){s=o.child;for(var l=c.firstContext;l!==null;){if(l.context===i){if(o.tag===1){l=no(-1,n&-n),l.tag=2;var u=o.updateQueue;if(u!==null){u=u.shared;var d=u.pending;d===null?l.next=l:(l.next=d.next,d.next=l),u.pending=l}}o.lanes|=n,l=o.alternate,l!==null&&(l.lanes|=n),Ka(o.return,n,t),c.lanes|=n;break}l=l.next}}else if(o.tag===10)s=o.type===t.type?null:o.child;else if(o.tag===18){if(s=o.return,s===null)throw Error(r(341));s.lanes|=n,c=s.alternate,c!==null&&(c.lanes|=n),Ka(s,n,t),s=o.sibling}else s=o.child;if(s!==null)s.return=o;else for(s=o;s!==null;){if(s===t){s=null;break}if(o=s.sibling,o!==null){o.return=s.return,s=o;break}s=s.return}o=s}Rs(e,t,a.children,n),t=t.child}return t;case 9:return a=t.type,i=t.pendingProps.children,qa(t,n),a=Ja(a),i=i(a),t.flags|=1,Rs(e,t,i,n),t.child;case 14:return i=t.type,a=bs(i,t.pendingProps),a=bs(i.type,a),Bs(e,t,i,a,n);case 15:return Vs(e,t,t.type,t.pendingProps,n);case 17:return i=t.type,a=t.pendingProps,a=t.elementType===i?a:bs(i,a),ic(e,t),t.tag=1,Yi(i)?(e=!0,$i(t)):e=!1,qa(t,n),ws(t,i,a),Es(t,i,a,n),Ks(null,t,i,!0,e,n);case 19:return rc(e,t,n);case 22:return Hs(e,t,n)}throw Error(r(156,t.tag))};function Xl(e,t){return ot(e,t)}function Zl(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.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 Ql(e,t,n,r){return new Zl(e,t,n,r)}function $l(e){return e=e.prototype,!(!e||!e.isReactComponent)}function eu(e){if(typeof e==`function`)return+!!$l(e);if(e!=null){if(e=e.$$typeof,e===j)return 11;if(e===P)return 14}return 2}function tu(e,t){var n=e.alternate;return n===null?(n=Ql(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&14680064,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}function nu(e,t,n,i,a,o){var s=2;if(i=e,typeof e==`function`)$l(e)&&(s=1);else if(typeof e==`string`)s=5;else a:switch(e){case E:return ru(n.children,a,o,t);case D:s=8,a|=8;break;case O:return e=Ql(12,n,t,a|2),e.elementType=O,e.lanes=o,e;case M:return e=Ql(13,n,t,a),e.elementType=M,e.lanes=o,e;case N:return e=Ql(19,n,t,a),e.elementType=N,e.lanes=o,e;case I:return iu(n,a,o,t);default:if(typeof e==`object`&&e)switch(e.$$typeof){case k:s=10;break a;case A:s=9;break a;case j:s=11;break a;case P:s=14;break a;case F:s=16,i=null;break a}throw Error(r(130,e==null?e:typeof e,``))}return t=Ql(s,n,t,a),t.elementType=e,t.type=i,t.lanes=o,t}function ru(e,t,n,r){return e=Ql(7,e,r,t),e.lanes=n,e}function iu(e,t,n,r){return e=Ql(22,e,r,t),e.elementType=I,e.lanes=n,e.stateNode={isHidden:!1},e}function au(e,t,n){return e=Ql(6,e,null,t),e.lanes=n,e}function ou(e,t,n){return t=Ql(4,e.children===null?[]:e.children,e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function su(e,t,n,r,i){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Mt(0),this.expirationTimes=Mt(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Mt(0),this.identifierPrefix=r,this.onRecoverableError=i,this.mutableSourceEagerHydrationData=null}function cu(e,t,n,r,i,a,o,s,c){return e=new su(e,t,n,s,c),t===1?(t=1,!0===a&&(t|=8)):t=0,a=Ql(3,null,null,t),e.current=a,a.stateNode=e,a.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},eo(a),e}function lu(e,t,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:T,key:r==null?null:``+r,children:e,containerInfo:t,implementation:n}}function uu(e){if(!e)return Wi;e=e._reactInternals;a:{if(et(e)!==e||e.tag!==1)throw Error(r(170));var t=e;do{switch(t.tag){case 3:t=t.stateNode.context;break a;case 1:if(Yi(t.type)){t=t.stateNode.__reactInternalMemoizedMergedChildContext;break a}}t=t.return}while(t!==null);throw Error(r(171))}if(e.tag===1){var n=e.type;if(Yi(n))return Qi(e,n,t)}return t}function du(e,t,n,r,i,a,o,s,c){return e=cu(n,r,!0,e,i,a,o,s,c),e.context=uu(null),n=e.current,r=vl(),i=yl(n),a=no(r,i),a.callback=t??null,ro(n,a,i),e.current.lanes=i,Nt(e,i,r),xl(e,r),e}function fu(e,t,n,r){var i=t.current,a=vl(),o=yl(i);return n=uu(n),t.context===null?t.context=n:t.pendingContext=n,t=no(a,o),t.payload={element:e},r=r===void 0?null:r,r!==null&&(t.callback=r),e=ro(i,t,o),e!==null&&(bl(e,i,o,a),io(e,i,o)),o}function pu(e){if(e=e.current,!e.child)return null;switch(e.child.tag){case 5:return e.child.stateNode;default:return e.child.stateNode}}function mu(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function hu(e,t){mu(e,t),(e=e.alternate)&&mu(e,t)}function gu(){return null}var _u=typeof reportError==`function`?reportError:function(e){console.error(e)};function vu(e){this._internalRoot=e}yu.prototype.render=vu.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(r(409));fu(e,t,null,null)},yu.prototype.unmount=vu.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;kl(function(){fu(null,e,null,null)}),t[ji]=null}};function yu(e){this._internalRoot=e}yu.prototype.unstable_scheduleHydration=function(e){if(e){var t=Vt();e={blockedOn:null,target:e,priority:t};for(var n=0;n<Xt.length&&t!==0&&t<Xt[n].priority;n++);Xt.splice(n,0,e),n===0&&tn(e)}};function bu(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function xu(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11&&(e.nodeType!==8||e.nodeValue!==` react-mount-point-unstable `))}function Su(){}function Cu(e,t,n,r,i){if(i){if(typeof r==`function`){var a=r;r=function(){var e=pu(o);a.call(e)}}var o=du(t,r,e,0,null,!1,!1,``,Su);return e._reactRootContainer=o,e[ji]=o.current,ai(e.nodeType===8?e.parentNode:e),kl(),o}for(;i=e.lastChild;)e.removeChild(i);if(typeof r==`function`){var s=r;r=function(){var e=pu(c);s.call(e)}}var c=cu(e,0,!1,null,null,!1,!1,``,Su);return e._reactRootContainer=c,e[ji]=c.current,ai(e.nodeType===8?e.parentNode:e),kl(function(){fu(t,c,n,r)}),c}function wu(e,t,n,r,i){var a=n._reactRootContainer;if(a){var o=a;if(typeof i==`function`){var s=i;i=function(){var e=pu(o);s.call(e)}}fu(t,o,e,i)}else o=Cu(n,t,e,i,r);return pu(o)}Rt=function(e){switch(e.tag){case 3:var t=e.stateNode;if(t.current.memoizedState.isDehydrated){var n=Et(t.pendingLanes);n!==0&&(Ft(t,n|1),xl(t,ut()),!(Kc&6)&&(ol=ut()+500,oa()))}break;case 13:kl(function(){var t=Qa(e,1);t!==null&&bl(t,e,1,vl())}),hu(e,1)}},zt=function(e){if(e.tag===13){var t=Qa(e,134217728);t!==null&&bl(t,e,134217728,vl()),hu(e,134217728)}},Bt=function(e){if(e.tag===13){var t=yl(e),n=Qa(e,t);n!==null&&bl(n,e,t,vl()),hu(e,t)}},Vt=function(){return It},Ht=function(e,t){var n=It;try{return It=e,t()}finally{It=n}},Pe=function(e,t,n){switch(t){case`input`:if(de(e,n),t=n.name,n.type===`radio`&&t!=null){for(n=e;n.parentNode;)n=n.parentNode;for(n=n.querySelectorAll(`input[name=`+JSON.stringify(``+t)+`][type="radio"]`),t=0;t<n.length;t++){var i=n[t];if(i!==e&&i.form===e.form){var a=Ri(i);if(!a)throw Error(r(90));oe(i),de(i,a)}}}break;case`textarea`:ve(e,n);break;case`select`:t=n.value,t!=null&&he(e,!!n.multiple,t,!1)}},Be=Ol,Ve=kl;var Tu={usingClientEntryPoint:!1,Events:[Ii,Li,Ri,Re,ze,Ol]},Eu={findFiberByHostInstance:Fi,bundleType:0,version:`18.3.1`,rendererPackageName:`react-dom`},Du={bundleType:Eu.bundleType,version:Eu.version,rendererPackageName:Eu.rendererPackageName,rendererConfig:Eu.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:C.ReactCurrentDispatcher,findHostInstanceByFiber:function(e){return e=it(e),e===null?null:e.stateNode},findFiberByHostInstance:Eu.findFiberByHostInstance||gu,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:`18.3.1-next-f1338f8080-20240426`};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<`u`){var Ou=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Ou.isDisabled&&Ou.supportsFiber)try{_t=Ou.inject(Du),vt=Ou}catch{}}e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=Tu,e.createPortal=function(e,t){var n=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!bu(t))throw Error(r(200));return lu(e,t,null,n)},e.createRoot=function(e,t){if(!bu(e))throw Error(r(299));var n=!1,i=``,a=_u;return t!=null&&(!0===t.unstable_strictMode&&(n=!0),t.identifierPrefix!==void 0&&(i=t.identifierPrefix),t.onRecoverableError!==void 0&&(a=t.onRecoverableError)),t=cu(e,1,!1,null,null,n,!1,i,a),e[ji]=t.current,ai(e.nodeType===8?e.parentNode:e),new vu(t)},e.findDOMNode=function(e){if(e==null)return null;if(e.nodeType===1)return e;var t=e._reactInternals;if(t===void 0)throw typeof e.render==`function`?Error(r(188)):(e=Object.keys(e).join(`,`),Error(r(268,e)));return e=it(t),e=e===null?null:e.stateNode,e},e.flushSync=function(e){return kl(e)},e.hydrate=function(e,t,n){if(!xu(t))throw Error(r(200));return wu(null,e,t,!0,n)},e.hydrateRoot=function(e,t,n){if(!bu(e))throw Error(r(405));var i=n!=null&&n.hydratedSources||null,a=!1,o=``,s=_u;if(n!=null&&(!0===n.unstable_strictMode&&(a=!0),n.identifierPrefix!==void 0&&(o=n.identifierPrefix),n.onRecoverableError!==void 0&&(s=n.onRecoverableError)),t=du(t,null,e,1,n??null,a,!1,o,s),e[ji]=t.current,ai(e),i)for(e=0;e<i.length;e++)n=i[e],a=n._getVersion,a=a(n._source),t.mutableSourceEagerHydrationData==null?t.mutableSourceEagerHydrationData=[n,a]:t.mutableSourceEagerHydrationData.push(n,a);return new yu(t)},e.render=function(e,t,n){if(!xu(t))throw Error(r(200));return wu(null,e,t,!1,n)},e.unmountComponentAtNode=function(e){if(!xu(e))throw Error(r(40));return e._reactRootContainer?(kl(function(){wu(null,null,e,!1,function(){e._reactRootContainer=null,e[ji]=null})}),!0):!1},e.unstable_batchedUpdates=Ol,e.unstable_renderSubtreeIntoContainer=function(e,t,n,i){if(!xu(n))throw Error(r(200));if(e==null||e._reactInternals===void 0)throw Error(r(38));return wu(e,t,n,!1,i)},e.version=`18.3.1-next-f1338f8080-20240426`})),_=s(((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=g()})),v=s((e=>{var t=_();e.createRoot=t.createRoot,e.hydrateRoot=t.hydrateRoot})),y=e=>{let t,n=new Set,r=(e,r)=>{let i=typeof e==`function`?e(t):e;if(!Object.is(i,t)){let e=t;t=r??(typeof i!=`object`||!i)?i:Object.assign({},t,i),n.forEach(n=>n(t,e))}},i=()=>t,a={setState:r,getState:i,getInitialState:()=>o,subscribe:e=>(n.add(e),()=>n.delete(e))},o=t=e(r,i,a);return a},b=(e=>e?y(e):y),x=u(p(),1),S=e=>e;function C(e,t=S){let n=x.useSyncExternalStore(e.subscribe,x.useCallback(()=>t(e.getState()),[e,t]),x.useCallback(()=>t(e.getInitialState()),[e,t]));return x.useDebugValue(n),n}var w=e=>{let t=b(e),n=e=>C(t,e);return Object.assign(n,t),n},T=(e=>e?w(e):w),E=v();function D(e,t){let n;try{n=e()}catch{return}return{getItem:e=>{let r=e=>e===null?null:JSON.parse(e,t?.reviver),i=n.getItem(e)??null;return i instanceof Promise?i.then(r):r(i)},setItem:(e,r)=>n.setItem(e,JSON.stringify(r,t?.replacer)),removeItem:e=>n.removeItem(e)}}var O=e=>t=>{try{let n=e(t);return n instanceof Promise?n:{then(e){return O(e)(n)},catch(e){return this}}}catch(e){return{then(e){return this},catch(t){return O(t)(e)}}}},k=(e,t)=>(n,r,i)=>{let a={storage:D(()=>localStorage),partialize:e=>e,version:0,merge:(e,t)=>({...t,...e}),...t},o=!1,s=new Set,c=new Set,l=a.storage;if(!l)return e((...e)=>{console.warn(`[zustand persist middleware] Unable to update item '${a.name}', the given storage is currently unavailable.`),n(...e)},r,i);let u=()=>{let e=a.partialize({...r()});return l.setItem(a.name,{state:e,version:a.version})},d=i.setState;i.setState=(e,t)=>(d(e,t),u());let f=e((...e)=>(n(...e),u()),r,i);i.getInitialState=()=>f;let p,m=()=>{if(!l)return;o=!1,s.forEach(e=>e(r()??f));let e=a.onRehydrateStorage?.call(a,r()??f)||void 0;return O(l.getItem.bind(l))(a.name).then(e=>{if(e)if(typeof e.version==`number`&&e.version!==a.version){if(a.migrate){let t=a.migrate(e.state,e.version);return t instanceof Promise?t.then(e=>[!0,e]):[!0,t]}console.error(`State loaded from storage couldn't be migrated since no migrate function was provided`)}else return[!1,e.state];return[!1,void 0]}).then(e=>{let[t,i]=e;if(p=a.merge(i,r()??f),n(p,!0),t)return u()}).then(()=>{e?.(p,void 0),p=r(),o=!0,c.forEach(e=>e(p))}).catch(t=>{e?.(void 0,t)})};return i.persist={setOptions:e=>{a={...a,...e},e.storage&&(l=e.storage)},clearStorage:()=>{l?.removeItem(a.name)},getOptions:()=>a,rehydrate:()=>m(),hasHydrated:()=>o,onHydrate:e=>(s.add(e),()=>{s.delete(e)}),onFinishHydration:e=>(c.add(e),()=>{c.delete(e)})},a.skipHydration||m(),p||f};function A(){let e=new Map;return{getItem:t=>e.get(t)??null,setItem:(t,n)=>{e.set(t,n)},removeItem:t=>{e.delete(t)}}}var j=A(),M={getItem:e=>{if(typeof localStorage>`u`)return j.getItem(e);try{return localStorage.getItem(e)}catch{return j.getItem(e)}},setItem:(e,t)=>{if(typeof localStorage>`u`){j.setItem(e,t);return}try{localStorage.setItem(e,t)}catch{j.setItem(e,t)}},removeItem:e=>{if(typeof localStorage>`u`){j.removeItem(e);return}try{localStorage.removeItem(e)}catch{j.removeItem(e)}}};function N(e){let t=new Map,n=!1,r=t=>{let n={BASE_URL:`/`,DEV:!1,MODE:`production`,PROD:!0,SSR:!1},r=globalThis.Bun?.main??``,i=/\.test\.[cm]?[jt]sx?$/.test(r);if((typeof n?.DEV==`boolean`?n.DEV:i)&&t!==e)throw Error(`createTabStorage("${e}") received unexpected key "${t}". Create a dedicated tab storage instance per persist key.`)};return{getItem(e){if(r(e),n)return t.get(e)??null;n=!0;let i=M.getItem(e);return i!==null&&t.set(e,i),i},setItem(e,n){r(e),t.set(e,n),M.setItem(e,n)},removeItem(e){r(e),t.delete(e),M.removeItem(e)}}}var P=`~/Documents/GitHub`,F=`claude`,I=!(typeof navigator<`u`&&/^((?!chrome|android).)*safari/i.test(navigator.userAgent)&&!/iPhone|iPad|iPod/.test(navigator.userAgent)&&(typeof devicePixelRatio<`u`?devicePixelRatio:1)>1),L=[{id:`jetbrains-mono`,label:`JetBrains Mono`,family:`"JetBrains Mono Variable", "JetBrains Mono", "SF Mono", "Fira Code", ui-monospace, monospace`},{id:`system`,label:`System Default`,family:`ui-monospace, "SF Mono", Menlo, Monaco, "Cascadia Code", "Consolas", monospace`},{id:`custom`,label:`Custom`,family:``}];function ee(e,t){return e===`custom`&&t.trim()?t.trim():L.find(t=>t.id===e)?.family||L[0].family}var R=[{id:`claude`,label:`Claude`,command:`claude`,isBuiltIn:!0,agentType:`claude`},{id:`codex`,label:`Codex`,command:`codex`,isBuiltIn:!0,agentType:`codex`},{id:`pi`,label:`Pi`,command:`pi`,isBuiltIn:!0,agentType:`pi`},{id:`grok`,label:`Grok`,command:`grok`,isBuiltIn:!0,agentType:`grok`},{id:`devin`,label:`Devin`,command:`devin`,isBuiltIn:!0,agentType:`devin`},{id:`omp`,label:`OMP`,command:`omp`,isBuiltIn:!0,agentType:`omp`}];function z(e){if(typeof e!=`object`||!e)return!1;let t=e;return typeof t.id==`string`&&t.id.length>=1&&t.id.length<=128&&typeof t.label==`string`&&t.label.trim().length>=1&&t.label.length<=64&&typeof t.command==`string`&&t.command.trim().length>=1&&t.command.length<=1024&&typeof t.isBuiltIn==`boolean`&&(t.agentType===void 0||t.agentType===`claude`||t.agentType===`codex`||t.agentType===`pi`||t.agentType===`devin`||t.agentType===`grok`||t.agentType===`omp`||t.agentType===`claude-rp`)}function B(e){return{...e,label:e.label.trim().slice(0,64),command:e.command.trim().slice(0,1024)}}function te(e){return e.command.trim()}function V(e){for(let t=0;t<100;t++){let t=`custom-${Date.now()}-${Math.random().toString(36).slice(2,6)}`;if(!e.has(t))return t}return`custom-${Date.now()}-${Math.random().toString(36).slice(2)}`}function ne(e,t){return e.some(e=>e.id===t)?t:e[0]?.id||`claude`}var H=T()(k((e,t)=>({defaultProjectDir:P,setDefaultProjectDir:t=>e({defaultProjectDir:t}),defaultCommand:F,setDefaultCommand:t=>e({defaultCommand:t}),lastProjectPath:null,setLastProjectPath:t=>e({lastProjectPath:t}),recentPaths:[],addRecentPath:t=>e(e=>({recentPaths:[t,...e.recentPaths.filter(e=>e!==t)].slice(0,5)})),sessionSortMode:`created`,setSessionSortMode:t=>e({sessionSortMode:t}),sessionSortDirection:`desc`,setSessionSortDirection:t=>e({sessionSortDirection:t}),manualSessionOrder:[],setManualSessionOrder:t=>e({manualSessionOrder:t}),useWebGL:I,setUseWebGL:t=>e({useWebGL:t}),fontSize:13,setFontSize:t=>e({fontSize:Math.max(6,Math.min(24,t))}),lineHeight:1,setLineHeight:t=>e({lineHeight:Math.max(1,Math.min(2,t))}),letterSpacing:0,setLetterSpacing:t=>e({letterSpacing:Math.max(-3,Math.min(3,t))}),fontOption:`jetbrains-mono`,setFontOption:t=>e({fontOption:t}),customFontFamily:``,setCustomFontFamily:t=>e({customFontFamily:t.slice(0,256)}),shortcutModifier:`auto`,setShortcutModifier:t=>e({shortcutModifier:t}),showProjectName:!0,setShowProjectName:t=>e({showProjectName:t}),showLastUserMessage:!0,setShowLastUserMessage:t=>e({showLastUserMessage:t}),showSessionIdPrefix:!1,setShowSessionIdPrefix:t=>e({showSessionIdPrefix:t}),historySessionsExpanded:!1,setHistorySessionsExpanded:t=>e({historySessionsExpanded:t}),hibernatingSessionsExpanded:!0,setHibernatingSessionsExpanded:t=>e({hibernatingSessionsExpanded:t}),sidebarWidth:240,setSidebarWidth:t=>e({sidebarWidth:Math.max(180,Math.min(400,t))}),projectFilters:[],setProjectFilters:t=>e({projectFilters:t}),hostFilters:[],setHostFilters:t=>e({hostFilters:t}),soundOnPermission:!1,setSoundOnPermission:t=>e({soundOnPermission:t}),soundOnIdle:!1,setSoundOnIdle:t=>e({soundOnIdle:t}),yoloMode:!1,setYoloMode:t=>e({yoloMode:t}),commandPresets:R,setCommandPresets:t=>e({commandPresets:t}),defaultPresetId:`claude`,setDefaultPresetId:t=>e({defaultPresetId:t}),updatePresetCommand:(n,r)=>{let{commandPresets:i}=t();e({commandPresets:i.map(e=>e.id===n?{...e,command:r.trim().slice(0,1024)}:e)})},addPreset:n=>{let{commandPresets:r}=t();if(r.length>=50){console.warn(`[agentboard:settings] Max presets reached`);return}let i=new Set(r.map(e=>e.id)),a={...B({...n,id:``,isBuiltIn:!1}),id:V(i),isBuiltIn:!1};e({commandPresets:[...r,a]})},removePreset:n=>{let{commandPresets:r,defaultPresetId:i}=t(),a=r.find(e=>e.id===n);if(!a||a.isBuiltIn)return;let o=r.filter(e=>e.id!==n);e({commandPresets:o,defaultPresetId:n===i?ne(o,i):i})}}),{name:`agentboard-settings`,storage:D(()=>M),version:8,migrate:(e,t)=>{let n=e;typeof n.historySessionsExpanded!=`boolean`&&typeof n.inactiveSessionsExpanded==`boolean`&&(n.historySessionsExpanded=n.inactiveSessionsExpanded),typeof n.hibernatingSessionsExpanded!=`boolean`&&typeof n.snoozedSessionsExpanded==`boolean`&&(n.hibernatingSessionsExpanded=n.snoozedSessionsExpanded);let r=e=>{if(typeof e.command==`string`)return e;let t=typeof e.baseCommand==`string`?e.baseCommand.trim():``,n=typeof e.modifiers==`string`?e.modifiers.trim():``,r=n?`${t} ${n}`:t;return{id:e.id,label:e.label,command:r||`claude`,isBuiltIn:e.isBuiltIn,agentType:e.agentType}};if(t===0||!Array.isArray(n.commandPresets)){let e=typeof n.defaultCommand==`string`?n.defaultCommand:`claude`,t=[...R],r=`claude`;if(e===`codex`)r=`codex`;else if(e!==`claude`){let n={id:V(new Set(t.map(e=>e.id))),label:`Migrated`,command:e,isBuiltIn:!1};t.push(n),r=n.id}return console.info(`[agentboard:settings] Migrated from v0 to v2`),{...n,commandPresets:t,defaultPresetId:r,defaultCommand:e,recentPaths:[]}}let i=n.commandPresets.map(r).filter(z);if(!(i.some(e=>e.id===`claude`)&&i.some(e=>e.id===`codex`))||i.length===0)return console.warn(`[agentboard:settings] Invalid presets, resetting to defaults`),{...n,commandPresets:R,defaultPresetId:`claude`};let a=new Set(i.map(e=>e.id)),o=R.filter(e=>e.isBuiltIn&&!a.has(e.id)),s=[...i,...o];return t<8&&console.info(`[agentboard:settings] Migrated from v${t} to v8`),{...n,commandPresets:s.map(B),defaultPresetId:ne(s,n.defaultPresetId)}}}));function re(){let[e,t]=(0,x.useState)(H.persist.hasHydrated());return(0,x.useEffect)(()=>{let e=H.persist.onFinishHydration(()=>t(!0));return H.persist.hasHydrated()&&t(!0),e},[]),e}var U=u(_());function ie({title:e,titleId:t,...n},r){return x.createElement(`svg`,Object.assign({xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,strokeWidth:1.5,stroke:`currentColor`,"aria-hidden":`true`,ref:r,"aria-labelledby":t},n),e?x.createElement(`title`,{id:t},e):null,x.createElement(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M12 9v4m0 4h.01M10.615 3.892L2.39 18.098c-.456.788-.684 1.182-.65 1.506a1 1 0 00.406.705c.263.191.718.191 1.629.191h16.45c.91 0 1.365 0 1.628-.191a1 1 0 00.407-.705c.034-.324-.195-.718-.65-1.506L13.383 3.892c-.454-.785-.681-1.178-.978-1.31a1 1 0 00-.813 0c-.296.132-.523.525-.978 1.31z`}))}var W=x.forwardRef(ie);function ae({title:e,titleId:t,...n},r){return x.createElement(`svg`,Object.assign({xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,strokeWidth:1.5,stroke:`currentColor`,"aria-hidden":`true`,ref:r,"aria-labelledby":t},n),e?x.createElement(`title`,{id:t},e):null,x.createElement(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M6 9l6 6 6-6`}))}var oe=x.forwardRef(ae);function se({title:e,titleId:t,...n},r){return x.createElement(`svg`,Object.assign({xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,strokeWidth:1.5,stroke:`currentColor`,"aria-hidden":`true`,ref:r,"aria-labelledby":t},n),e?x.createElement(`title`,{id:t},e):null,x.createElement(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M9 18l6-6-6-6`}))}var ce=x.forwardRef(se);function le({title:e,titleId:t,...n},r){return x.createElement(`svg`,Object.assign({xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,strokeWidth:1.5,stroke:`currentColor`,"aria-hidden":`true`,ref:r,"aria-labelledby":t},n),e?x.createElement(`title`,{id:t},e):null,x.createElement(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M5 15c-.932 0-1.398 0-1.765-.152a2 2 0 01-1.083-1.083C2 13.398 2 12.932 2 12V5.2c0-1.12 0-1.68.218-2.108a2 2 0 01.874-.874C3.52 2 4.08 2 5.2 2H12c.932 0 1.398 0 1.765.152a2 2 0 011.083 1.083C15 3.602 15 4.068 15 5m-2.8 17h6.6c1.12 0 1.68 0 2.108-.218a2 2 0 00.874-.874C22 20.48 22 19.92 22 18.8v-6.6c0-1.12 0-1.68-.218-2.108a2 2 0 00-.874-.874C20.48 9 19.92 9 18.8 9h-6.6c-1.12 0-1.68 0-2.108.218a2 2 0 00-.874.874C9 10.52 9 11.08 9 12.2v6.6c0 1.12 0 1.68.218 2.108a2 2 0 00.874.874C10.52 22 11.08 22 12.2 22z`}))}var ue=x.forwardRef(le);function de({title:e,titleId:t,...n},r){return x.createElement(`svg`,Object.assign({xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,strokeWidth:1.5,stroke:`currentColor`,"aria-hidden":`true`,ref:r,"aria-labelledby":t},n),e?x.createElement(`title`,{id:t},e):null,x.createElement(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M20 4v1.4c0 3.36 0 5.04-.654 6.324a6 6 0 01-2.622 2.622C15.44 15 13.76 15 10.4 15H4m0 0l5-5m-5 5l5 5`}))}var fe=x.forwardRef(de);function pe({title:e,titleId:t,...n},r){return x.createElement(`svg`,Object.assign({xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,strokeWidth:1.5,stroke:`currentColor`,"aria-hidden":`true`,ref:r,"aria-labelledby":t},n),e?x.createElement(`title`,{id:t},e):null,x.createElement(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M12 13a1 1 0 100-2 1 1 0 000 2zM12 6a1 1 0 100-2 1 1 0 000 2zM12 20a1 1 0 100-2 1 1 0 000 2z`}))}var me=x.forwardRef(pe);function he({title:e,titleId:t,...n},r){return x.createElement(`svg`,Object.assign({xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,strokeWidth:1.5,stroke:`currentColor`,"aria-hidden":`true`,ref:r,"aria-labelledby":t},n),e?x.createElement(`title`,{id:t},e):null,x.createElement(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M11 4H6.8c-1.68 0-2.52 0-3.162.327a3 3 0 00-1.311 1.311C2 6.28 2 7.12 2 8.8v8.4c0 1.68 0 2.52.327 3.162a3 3 0 001.311 1.311C4.28 22 5.12 22 6.8 22h8.4c1.68 0 2.52 0 3.162-.327a3 3 0 001.311-1.311C20 19.72 20 18.88 20 17.2V13M8 16h1.675c.489 0 .733 0 .963-.055.204-.05.4-.13.579-.24.201-.123.374-.296.72-.642L21.5 5.5a2.121 2.121 0 00-3-3l-9.563 9.563c-.346.346-.519.519-.642.72a2 2 0 00-.24.579c-.055.23-.055.474-.055.963V16z`}))}var ge=x.forwardRef(he);function _e({title:e,titleId:t,...n},r){return x.createElement(`svg`,Object.assign({xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,strokeWidth:1.5,stroke:`currentColor`,"aria-hidden":`true`,ref:r,"aria-labelledby":t},n),e?x.createElement(`title`,{id:t},e):null,x.createElement(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M14 2.27V6.4c0 .56 0 .84.109 1.054a1 1 0 00.437.437c.214.11.494.11 1.054.11h4.13M16 13H8m8 4H8m2-8H8m6-7H8.8c-1.68 0-2.52 0-3.162.327a3 3 0 00-1.311 1.311C4 4.28 4 5.12 4 6.8v10.4c0 1.68 0 2.52.327 3.162a3 3 0 001.311 1.311C6.28 22 7.12 22 8.8 22h6.4c1.68 0 2.52 0 3.162-.327a3 3 0 001.311-1.311C20 19.72 20 18.88 20 17.2V8l-6-6z`}))}var ve=x.forwardRef(_e);function ye({title:e,titleId:t,...n},r){return x.createElement(`svg`,Object.assign({xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,strokeWidth:1.5,stroke:`currentColor`,"aria-hidden":`true`,ref:r,"aria-labelledby":t},n),e?x.createElement(`title`,{id:t},e):null,x.createElement(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M13 7l-1.116-2.231c-.32-.642-.481-.963-.72-1.198a2 2 0 00-.748-.462C10.1 3 9.74 3 9.022 3H5.2c-1.12 0-1.68 0-2.108.218a2 2 0 00-.874.874C2 4.52 2 5.08 2 6.2V7m0 0h15.2c1.68 0 2.52 0 3.162.327a3 3 0 011.311 1.311C22 9.28 22 10.12 22 11.8v4.4c0 1.68 0 2.52-.327 3.162a3 3 0 01-1.311 1.311C19.72 21 18.88 21 17.2 21H6.8c-1.68 0-2.52 0-3.162-.327a3 3 0 01-1.311-1.311C2 18.72 2 17.88 2 16.2V7z`}))}var be=x.forwardRef(ye);function xe({title:e,titleId:t,...n},r){return x.createElement(`svg`,Object.assign({xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,strokeWidth:1.5,stroke:`currentColor`,"aria-hidden":`true`,ref:r,"aria-labelledby":t},n),e?x.createElement(`title`,{id:t},e):null,x.createElement(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M6.9 11.444v2.778m0-2.778V4.778c0-.92.761-1.667 1.7-1.667s1.7.746 1.7 1.667m-3.4 6.666c0-.92-.761-1.666-1.7-1.666s-1.7.746-1.7 1.666v2.223C3.5 18.269 7.306 22 12 22s8.5-3.731 8.5-8.333V8.11c0-.92-.761-1.667-1.7-1.667s-1.7.747-1.7 1.667m-6.8-3.333v6.11m0-6.11V3.667C10.3 2.747 11.061 2 12 2s1.7.746 1.7 1.667v1.11m0 0v6.112m0-6.111c0-.92.761-1.667 1.7-1.667s1.7.746 1.7 1.667V8.11m0 0v2.778`}))}var Se=x.forwardRef(xe);function Ce({title:e,titleId:t,...n},r){return x.createElement(`svg`,Object.assign({xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,strokeWidth:1.5,stroke:`currentColor`,"aria-hidden":`true`,ref:r,"aria-labelledby":t},n),e?x.createElement(`title`,{id:t},e):null,x.createElement(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M4 8h16M4 16h16M8 3v18m8-18v18`}))}var we=x.forwardRef(Ce);function Te({title:e,titleId:t,...n},r){return x.createElement(`svg`,Object.assign({xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,strokeWidth:1.5,stroke:`currentColor`,"aria-hidden":`true`,ref:r,"aria-labelledby":t},n),e?x.createElement(`title`,{id:t},e):null,x.createElement(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M3 12h18M3 6h18M3 18h18`}))}var Ee=x.forwardRef(Te);function De({title:e,titleId:t,...n},r){return x.createElement(`svg`,Object.assign({xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,strokeWidth:1.5,stroke:`currentColor`,"aria-hidden":`true`,ref:r,"aria-labelledby":t},n),e?x.createElement(`title`,{id:t},e):null,x.createElement(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M22 15.844a10.424 10.424 0 01-4.306.925c-5.779 0-10.463-4.684-10.463-10.462 0-1.536.33-2.994.925-4.307A10.464 10.464 0 002 11.538C2 17.316 6.684 22 12.462 22c4.243 0 7.896-2.526 9.538-6.156z`}))}var Oe=x.forwardRef(De);function ke({title:e,titleId:t,...n},r){return x.createElement(`svg`,Object.assign({xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,strokeWidth:1.5,stroke:`currentColor`,"aria-hidden":`true`,ref:r,"aria-labelledby":t},n),e?x.createElement(`title`,{id:t},e):null,x.createElement(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M5 9l-3 3m0 0l3 3m-3-3h20M9 5l3-3m0 0l3 3m-3-3v20m3-3l-3 3m0 0l-3-3M19 9l3 3m0 0l-3 3`}))}var Ae=x.forwardRef(ke);function je({title:e,titleId:t,...n},r){return x.createElement(`svg`,Object.assign({xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,strokeWidth:1.5,stroke:`currentColor`,"aria-hidden":`true`,ref:r,"aria-labelledby":t},n),e?x.createElement(`title`,{id:t},e):null,x.createElement(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M5 4.99c0-.972 0-1.457.202-1.725a1 1 0 01.738-.395c.335-.02.74.25 1.548.788l10.515 7.01c.668.446 1.002.668 1.118.949a1 1 0 010 .766c-.116.28-.45.503-1.118.948l-10.515 7.01c-.809.54-1.213.809-1.548.789a1 1 0 01-.738-.395C5 20.467 5 19.98 5 19.01V4.99z`}))}var Me=x.forwardRef(je);function Ne({title:e,titleId:t,...n},r){return x.createElement(`svg`,Object.assign({xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,strokeWidth:1.5,stroke:`currentColor`,"aria-hidden":`true`,ref:r,"aria-labelledby":t},n),e?x.createElement(`title`,{id:t},e):null,x.createElement(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M12 5v14m-7-7h14`}))}var Pe=x.forwardRef(Ne);function Fe({title:e,titleId:t,...n},r){return x.createElement(`svg`,Object.assign({xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,strokeWidth:1.5,stroke:`currentColor`,"aria-hidden":`true`,ref:r,"aria-labelledby":t},n),e?x.createElement(`title`,{id:t},e):null,x.createElement(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M6 6h.01M6 18h.01m-.81-8h13.6c1.12 0 1.68 0 2.108-.218a2 2 0 00.874-.874C22 8.48 22 7.92 22 6.8V5.2c0-1.12 0-1.68-.218-2.108a2 2 0 00-.874-.874C20.48 2 19.92 2 18.8 2H5.2c-1.12 0-1.68 0-2.108.218a2 2 0 00-.874.874C2 3.52 2 4.08 2 5.2v1.6c0 1.12 0 1.68.218 2.108a2 2 0 00.874.874C3.52 10 4.08 10 5.2 10zm0 12h13.6c1.12 0 1.68 0 2.108-.218a2 2 0 00.874-.874C22 20.48 22 19.92 22 18.8v-1.6c0-1.12 0-1.68-.218-2.108a2 2 0 00-.874-.874C20.48 14 19.92 14 18.8 14H5.2c-1.12 0-1.68 0-2.108.218a2 2 0 00-.874.874C2 15.52 2 16.08 2 17.2v1.6c0 1.12 0 1.68.218 2.108a2 2 0 00.874.874C3.52 22 4.08 22 5.2 22z`}))}var Ie=x.forwardRef(Fe);function Le({title:e,titleId:t,...n},r){return x.createElement(`svg`,Object.assign({xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,strokeWidth:1.5,stroke:`currentColor`,"aria-hidden":`true`,ref:r,"aria-labelledby":t},n),e?x.createElement(`title`,{id:t},e):null,x.createElement(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M12 15a3 3 0 100-6 3 3 0 000 6z`}),x.createElement(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M18.727 14.727a1.5 1.5 0 00.3 1.655l.055.054a1.816 1.816 0 010 2.573 1.818 1.818 0 01-2.573 0l-.055-.055a1.5 1.5 0 00-1.654-.3 1.5 1.5 0 00-.91 1.373v.155a1.818 1.818 0 11-3.636 0V20.1a1.5 1.5 0 00-.981-1.373 1.5 1.5 0 00-1.655.3l-.054.055a1.818 1.818 0 01-3.106-1.287 1.818 1.818 0 01.533-1.286l.054-.055a1.5 1.5 0 00.3-1.654 1.5 1.5 0 00-1.372-.91h-.155a1.818 1.818 0 110-3.636H3.9a1.5 1.5 0 001.373-.981 1.5 1.5 0 00-.3-1.655l-.055-.054A1.818 1.818 0 117.491 4.99l.054.054a1.5 1.5 0 001.655.3h.073a1.5 1.5 0 00.909-1.372v-.155a1.818 1.818 0 013.636 0V3.9a1.499 1.499 0 00.91 1.373 1.5 1.5 0 001.654-.3l.054-.055a1.817 1.817 0 012.573 0 1.819 1.819 0 010 2.573l-.055.054a1.5 1.5 0 00-.3 1.655v.073a1.5 1.5 0 001.373.909h.155a1.818 1.818 0 010 3.636H20.1a1.499 1.499 0 00-1.373.91z`}))}var Re=x.forwardRef(Le);function ze({title:e,titleId:t,...n},r){return x.createElement(`svg`,Object.assign({xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,strokeWidth:1.5,stroke:`currentColor`,"aria-hidden":`true`,ref:r,"aria-labelledby":t},n),e?x.createElement(`title`,{id:t},e):null,x.createElement(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M12 15a3 3 0 100-6 3 3 0 000 6z`}),x.createElement(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M9.29 19.371l.584 1.315a2.213 2.213 0 004.044 0l.585-1.315a2.426 2.426 0 012.47-1.423l1.43.152a2.212 2.212 0 002.022-3.502l-.847-1.164a2.428 2.428 0 01-.46-1.434c0-.513.163-1.014.465-1.429l.847-1.163a2.212 2.212 0 00-2.023-3.502l-1.43.152a2.433 2.433 0 01-1.47-.312 2.425 2.425 0 01-1-1.117l-.588-1.315a2.212 2.212 0 00-4.045 0L9.29 4.63c-.207.468-.558.86-1 1.117-.445.256-.96.365-1.47.312l-1.435-.152a2.212 2.212 0 00-2.022 3.502l.847 1.163a2.43 2.43 0 010 2.858l-.847 1.163a2.21 2.21 0 00.786 3.273c.381.195.81.274 1.236.23l1.43-.153a2.434 2.434 0 012.475 1.43z`}))}var Be=x.forwardRef(ze);function Ve({title:e,titleId:t,...n},r){return x.createElement(`svg`,Object.assign({xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,strokeWidth:1.5,stroke:`currentColor`,"aria-hidden":`true`,ref:r,"aria-labelledby":t},n),e?x.createElement(`title`,{id:t},e):null,x.createElement(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M4 17l6-6-6-6m8 14h8`}))}var He=x.forwardRef(Ve);function Ue({title:e,titleId:t,...n},r){return x.createElement(`svg`,Object.assign({xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,strokeWidth:1.5,stroke:`currentColor`,"aria-hidden":`true`,ref:r,"aria-labelledby":t},n),e?x.createElement(`title`,{id:t},e):null,x.createElement(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M18 6L6 18M6 6l12 12`}))}var We=x.forwardRef(Ue);function Ge(){if(typeof navigator>`u`)return!1;let e=navigator.userAgent,t=/iPad|iPhone|iPod/.test(e),n=navigator.platform===`MacIntel`&&navigator.maxTouchPoints>1;return t||n}function Ke(){return typeof navigator>`u`?!1:Ge()&&navigator.standalone===!0}function qe(){return typeof navigator>`u`?!1:navigator.platform.toUpperCase().indexOf(`MAC`)>=0}function Je(e){return e===`auto`?qe()?`ctrl-option`:`ctrl-shift`:e}var Ye={"ctrl-option":`⌃⌥`,"ctrl-shift":`⌃⇧`,"cmd-option":`⌘⌥`,"cmd-shift":`⌘⇧`};function Xe(e){return Ye[e]}function Ze(e,t){switch(t){case`ctrl-option`:return e.ctrlKey&&e.altKey&&!e.metaKey&&!e.shiftKey;case`ctrl-shift`:return e.ctrlKey&&e.shiftKey&&!e.metaKey&&!e.altKey;case`cmd-option`:return e.metaKey&&e.altKey&&!e.ctrlKey&&!e.shiftKey;case`cmd-shift`:return e.metaKey&&e.shiftKey&&!e.ctrlKey&&!e.altKey}}var Qe=s((e=>{var t=p(),n=Symbol.for(`react.element`),r=Symbol.for(`react.fragment`),i=Object.prototype.hasOwnProperty,a=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,o={key:!0,ref:!0,__self:!0,__source:!0};function s(e,t,r){var s,c={},l=null,u=null;for(s in r!==void 0&&(l=``+r),t.key!==void 0&&(l=``+t.key),t.ref!==void 0&&(u=t.ref),t)i.call(t,s)&&!o.hasOwnProperty(s)&&(c[s]=t[s]);if(e&&e.defaultProps)for(s in t=e.defaultProps,t)c[s]===void 0&&(c[s]=t[s]);return{$$typeof:n,type:e,key:l,ref:u,props:c,_owner:a.current}}e.Fragment=r,e.jsx=s,e.jsxs=s})),G=s(((e,t)=>{t.exports=Qe()}))(),$e={connected:`bg-working`,connecting:`bg-approval`,reconnecting:`bg-approval`,disconnected:`bg-danger`};function et({connectionStatus:e,onNewSession:t,onOpenSettings:n,tailscaleIp:r}){let[i,a]=(0,x.useState)(!1),o=Xe(Je(H(e=>e.shortcutModifier)));return(0,G.jsxs)(`header`,{className:`flex h-10 shrink-0 items-center justify-between border-b border-border bg-elevated px-3`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(`h1`,{className:`text-sm font-semibold tracking-tight text-primary text-balance`,children:`AGENTBOARD`}),(0,G.jsxs)(`div`,{className:`flex items-center gap-1.5 text-xs text-muted`,children:[(0,G.jsx)(`span`,{className:`h-2 w-2 rounded-full ${$e[e]}`}),r&&(0,G.jsxs)(`button`,{onClick:()=>{if(!r)return;let e=`http://${r}:${window.location.port||`4040`}`;navigator.clipboard.writeText(e),a(!0),setTimeout(()=>a(!1),1500)},className:`ml-3 inline-flex items-center gap-1 text-muted/70 hover:text-muted transition-colors cursor-pointer`,title:`Tailscale IP - click to copy remote access URL`,children:[(0,G.jsx)(`span`,{className:`leading-none translate-y-[1px]`,children:i?`Copied!`:r}),!i&&(0,G.jsx)(ue,{width:12,height:12,className:`shrink-0`})]})]})]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,G.jsx)(`button`,{onClick:t,className:`flex h-7 w-7 items-center justify-center rounded bg-accent text-white hover:bg-accent/90 active:scale-95 transition-all`,title:`New session (${o}N)`,"aria-label":`New session`,children:(0,G.jsx)(Pe,{width:16,height:16})}),(0,G.jsx)(`button`,{onClick:n,className:`flex h-7 w-7 items-center justify-center rounded border border-border text-secondary hover:bg-hover hover:text-primary active:scale-95 transition-all`,title:`Settings`,"aria-label":`Settings`,children:(0,G.jsx)(Be,{width:14,height:14})})]})]})}var tt=(0,x.createContext)({});function nt(e){let t=(0,x.useRef)(null);return t.current===null&&(t.current=e()),t.current}var rt=typeof window<`u`,it=rt?x.useLayoutEffect:x.useEffect,at=(0,x.createContext)(null);function ot(e,t){e.indexOf(t)===-1&&e.push(t)}function st(e,t){let n=e.indexOf(t);n>-1&&e.splice(n,1)}var ct=(e,t,n)=>n>t?t:n<e?e:n,lt={},ut=e=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(e);function dt(e){return typeof e==`object`&&!!e}var ft=e=>/^0[^.\s]+$/u.test(e);function pt(e){let t;return()=>(t===void 0&&(t=e()),t)}var mt=e=>e,ht=(e,t)=>n=>t(e(n)),gt=(...e)=>e.reduce(ht),_t=(e,t,n)=>{let r=t-e;return r===0?1:(n-e)/r},vt=class{constructor(){this.subscriptions=[]}add(e){return ot(this.subscriptions,e),()=>st(this.subscriptions,e)}notify(e,t,n){let r=this.subscriptions.length;if(r)if(r===1)this.subscriptions[0](e,t,n);else for(let i=0;i<r;i++){let r=this.subscriptions[i];r&&r(e,t,n)}}getSize(){return this.subscriptions.length}clear(){this.subscriptions.length=0}},yt=e=>e*1e3,bt=e=>e/1e3;function xt(e,t){return t?1e3/t*e:0}var St=(e,t,n)=>(((1-3*n+3*t)*e+(3*n-6*t))*e+3*t)*e,Ct=1e-7,wt=12;function Tt(e,t,n,r,i){let a,o,s=0;do o=t+(n-t)/2,a=St(o,r,i)-e,a>0?n=o:t=o;while(Math.abs(a)>Ct&&++s<wt);return o}function Et(e,t,n,r){if(e===t&&n===r)return mt;let i=t=>Tt(t,0,1,e,n);return e=>e===0||e===1?e:St(i(e),t,r)}var Dt=e=>t=>t<=.5?e(2*t)/2:(2-e(2*(1-t)))/2,Ot=e=>t=>1-e(1-t),kt=Et(.33,1.53,.69,.99),At=Ot(kt),jt=Dt(At),Mt=e=>(e*=2)<1?.5*At(e):.5*(2-2**(-10*(e-1))),Nt=e=>1-Math.sin(Math.acos(e)),Pt=Ot(Nt),Ft=Dt(Nt),It=Et(.42,0,1,1),Lt=Et(0,0,.58,1),Rt=Et(.42,0,.58,1),zt=e=>Array.isArray(e)&&typeof e[0]!=`number`,Bt=e=>Array.isArray(e)&&typeof e[0]==`number`,Vt={linear:mt,easeIn:It,easeInOut:Rt,easeOut:Lt,circIn:Nt,circInOut:Ft,circOut:Pt,backIn:At,backInOut:jt,backOut:kt,anticipate:Mt},Ht=e=>typeof e==`string`,Ut=e=>{if(Bt(e)){e.length;let[t,n,r,i]=e;return Et(t,n,r,i)}else if(Ht(e))return Vt[e],`${e}`,Vt[e];return e},Wt=[`setup`,`read`,`resolveKeyframes`,`preUpdate`,`update`,`preRender`,`render`,`postRender`],Gt={value:null,addProjectionMetrics:null};function Kt(e,t){let n=new Set,r=new Set,i=!1,a=!1,o=new WeakSet,s={delta:0,timestamp:0,isProcessing:!1},c=0;function l(t){o.has(t)&&(u.schedule(t),e()),c++,t(s)}let u={schedule:(e,t=!1,a=!1)=>{let s=a&&i?n:r;return t&&o.add(e),s.has(e)||s.add(e),e},cancel:e=>{r.delete(e),o.delete(e)},process:e=>{if(s=e,i){a=!0;return}i=!0,[n,r]=[r,n],n.forEach(l),t&&Gt.value&&Gt.value.frameloop[t].push(c),c=0,n.clear(),i=!1,a&&(a=!1,u.process(e))}};return u}var qt=40;function Jt(e,t){let n=!1,r=!0,i={delta:0,timestamp:0,isProcessing:!1},a=()=>n=!0,o=Wt.reduce((e,n)=>(e[n]=Kt(a,t?n:void 0),e),{}),{setup:s,read:c,resolveKeyframes:l,preUpdate:u,update:d,preRender:f,render:p,postRender:m}=o,h=()=>{let a=lt.useManualTiming?i.timestamp:performance.now();n=!1,lt.useManualTiming||(i.delta=r?1e3/60:Math.max(Math.min(a-i.timestamp,qt),1)),i.timestamp=a,i.isProcessing=!0,s.process(i),c.process(i),l.process(i),u.process(i),d.process(i),f.process(i),p.process(i),m.process(i),i.isProcessing=!1,n&&t&&(r=!1,e(h))},g=()=>{n=!0,r=!0,i.isProcessing||e(h)};return{schedule:Wt.reduce((e,t)=>{let r=o[t];return e[t]=(e,t=!1,i=!1)=>(n||g(),r.schedule(e,t,i)),e},{}),cancel:e=>{for(let t=0;t<Wt.length;t++)o[Wt[t]].cancel(e)},state:i,steps:o}}var{schedule:Yt,cancel:Xt,state:Zt,steps:Qt}=Jt(typeof requestAnimationFrame<`u`?requestAnimationFrame:mt,!0),$t;function en(){$t=void 0}var tn={now:()=>($t===void 0&&tn.set(Zt.isProcessing||lt.useManualTiming?Zt.timestamp:performance.now()),$t),set:e=>{$t=e,queueMicrotask(en)}},nn={layout:0,mainThread:0,waapi:0},rn=e=>t=>typeof t==`string`&&t.startsWith(e),an=rn(`--`),on=rn(`var(--`),sn=e=>on(e)?cn.test(e.split(`/*`)[0].trim()):!1,cn=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu;function ln(e){return typeof e==`string`?e.split(`/*`)[0].includes(`var(--`):!1}var un={test:e=>typeof e==`number`,parse:parseFloat,transform:e=>e},dn={...un,transform:e=>ct(0,1,e)},fn={...un,default:1},pn=e=>Math.round(e*1e5)/1e5,mn=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function hn(e){return e==null}var gn=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,_n=(e,t)=>n=>!!(typeof n==`string`&&gn.test(n)&&n.startsWith(e)||t&&!hn(n)&&Object.prototype.hasOwnProperty.call(n,t)),vn=(e,t,n)=>r=>{if(typeof r!=`string`)return r;let[i,a,o,s]=r.match(mn);return{[e]:parseFloat(i),[t]:parseFloat(a),[n]:parseFloat(o),alpha:s===void 0?1:parseFloat(s)}},yn=e=>ct(0,255,e),bn={...un,transform:e=>Math.round(yn(e))},xn={test:_n(`rgb`,`red`),parse:vn(`red`,`green`,`blue`),transform:({red:e,green:t,blue:n,alpha:r=1})=>`rgba(`+bn.transform(e)+`, `+bn.transform(t)+`, `+bn.transform(n)+`, `+pn(dn.transform(r))+`)`};function Sn(e){let t=``,n=``,r=``,i=``;return e.length>5?(t=e.substring(1,3),n=e.substring(3,5),r=e.substring(5,7),i=e.substring(7,9)):(t=e.substring(1,2),n=e.substring(2,3),r=e.substring(3,4),i=e.substring(4,5),t+=t,n+=n,r+=r,i+=i),{red:parseInt(t,16),green:parseInt(n,16),blue:parseInt(r,16),alpha:i?parseInt(i,16)/255:1}}var Cn={test:_n(`#`),parse:Sn,transform:xn.transform},wn=e=>({test:t=>typeof t==`string`&&t.endsWith(e)&&t.split(` `).length===1,parse:parseFloat,transform:t=>`${t}${e}`}),Tn=wn(`deg`),En=wn(`%`),K=wn(`px`),Dn=wn(`vh`),On=wn(`vw`),kn={...En,parse:e=>En.parse(e)/100,transform:e=>En.transform(e*100)},An={test:_n(`hsl`,`hue`),parse:vn(`hue`,`saturation`,`lightness`),transform:({hue:e,saturation:t,lightness:n,alpha:r=1})=>`hsla(`+Math.round(e)+`, `+En.transform(pn(t))+`, `+En.transform(pn(n))+`, `+pn(dn.transform(r))+`)`},jn={test:e=>xn.test(e)||Cn.test(e)||An.test(e),parse:e=>xn.test(e)?xn.parse(e):An.test(e)?An.parse(e):Cn.parse(e),transform:e=>typeof e==`string`?e:e.hasOwnProperty(`red`)?xn.transform(e):An.transform(e),getAnimatableNone:e=>{let t=jn.parse(e);return t.alpha=0,jn.transform(t)}},Mn=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;function Nn(e){return isNaN(e)&&typeof e==`string`&&(e.match(mn)?.length||0)+(e.match(Mn)?.length||0)>0}var Pn=`number`,Fn=`color`,In=`var`,Ln=`var(`,Rn="${}",zn=/var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu;function Bn(e){let t=e.toString(),n=[],r={color:[],number:[],var:[]},i=[],a=0;return{values:n,split:t.replace(zn,e=>(jn.test(e)?(r.color.push(a),i.push(Fn),n.push(jn.parse(e))):e.startsWith(Ln)?(r.var.push(a),i.push(In),n.push(e)):(r.number.push(a),i.push(Pn),n.push(parseFloat(e))),++a,Rn)).split(Rn),indexes:r,types:i}}function Vn(e){return Bn(e).values}function Hn(e){let{split:t,types:n}=Bn(e),r=t.length;return e=>{let i=``;for(let a=0;a<r;a++)if(i+=t[a],e[a]!==void 0){let t=n[a];t===Pn?i+=pn(e[a]):t===Fn?i+=jn.transform(e[a]):i+=e[a]}return i}}var Un=e=>typeof e==`number`?0:jn.test(e)?jn.getAnimatableNone(e):e;function Wn(e){let t=Vn(e);return Hn(e)(t.map(Un))}var Gn={test:Nn,parse:Vn,createTransformer:Hn,getAnimatableNone:Wn};function Kn(e,t,n){return n<0&&(n+=1),n>1&&--n,n<1/6?e+(t-e)*6*n:n<1/2?t:n<2/3?e+(t-e)*(2/3-n)*6:e}function qn({hue:e,saturation:t,lightness:n,alpha:r}){e/=360,t/=100,n/=100;let i=0,a=0,o=0;if(!t)i=a=o=n;else{let r=n<.5?n*(1+t):n+t-n*t,s=2*n-r;i=Kn(s,r,e+1/3),a=Kn(s,r,e),o=Kn(s,r,e-1/3)}return{red:Math.round(i*255),green:Math.round(a*255),blue:Math.round(o*255),alpha:r}}function Jn(e,t){return n=>n>0?t:e}var Yn=(e,t,n)=>e+(t-e)*n,Xn=(e,t,n)=>{let r=e*e,i=n*(t*t-r)+r;return i<0?0:Math.sqrt(i)},Zn=[Cn,xn,An],Qn=e=>Zn.find(t=>t.test(e));function $n(e){let t=Qn(e);if(`${e}`,!t)return!1;let n=t.parse(e);return t===An&&(n=qn(n)),n}var er=(e,t)=>{let n=$n(e),r=$n(t);if(!n||!r)return Jn(e,t);let i={...n};return e=>(i.red=Xn(n.red,r.red,e),i.green=Xn(n.green,r.green,e),i.blue=Xn(n.blue,r.blue,e),i.alpha=Yn(n.alpha,r.alpha,e),xn.transform(i))},tr=new Set([`none`,`hidden`]);function nr(e,t){return tr.has(e)?n=>n<=0?e:t:n=>n>=1?t:e}function rr(e,t){return n=>Yn(e,t,n)}function ir(e){return typeof e==`number`?rr:typeof e==`string`?sn(e)?Jn:jn.test(e)?er:cr:Array.isArray(e)?ar:typeof e==`object`?jn.test(e)?er:or:Jn}function ar(e,t){let n=[...e],r=n.length,i=e.map((e,n)=>ir(e)(e,t[n]));return e=>{for(let t=0;t<r;t++)n[t]=i[t](e);return n}}function or(e,t){let n={...e,...t},r={};for(let i in n)e[i]!==void 0&&t[i]!==void 0&&(r[i]=ir(e[i])(e[i],t[i]));return e=>{for(let t in r)n[t]=r[t](e);return n}}function sr(e,t){let n=[],r={color:0,var:0,number:0};for(let i=0;i<t.values.length;i++){let a=t.types[i],o=e.indexes[a][r[a]];n[i]=e.values[o]??0,r[a]++}return n}var cr=(e,t)=>{let n=Gn.createTransformer(t),r=Bn(e),i=Bn(t);return r.indexes.var.length===i.indexes.var.length&&r.indexes.color.length===i.indexes.color.length&&r.indexes.number.length>=i.indexes.number.length?tr.has(e)&&!i.values.length||tr.has(t)&&!r.values.length?nr(e,t):gt(ar(sr(r,i),i.values),n):(`${e}${t}`,Jn(e,t))};function lr(e,t,n){return typeof e==`number`&&typeof t==`number`&&typeof n==`number`?Yn(e,t,n):ir(e)(e,t)}var ur=e=>{let t=({timestamp:t})=>e(t);return{start:(e=!0)=>Yt.update(t,e),stop:()=>Xt(t),now:()=>Zt.isProcessing?Zt.timestamp:tn.now()}},dr=(e,t,n=10)=>{let r=``,i=Math.max(Math.round(t/n),2);for(let t=0;t<i;t++)r+=Math.round(e(t/(i-1))*1e4)/1e4+`, `;return`linear(${r.substring(0,r.length-2)})`},fr=2e4;function pr(e){let t=0,n=e.next(t);for(;!n.done&&t<2e4;)t+=50,n=e.next(t);return t>=2e4?1/0:t}function mr(e,t=100,n){let r=n({...e,keyframes:[0,t]}),i=Math.min(pr(r),fr);return{type:`keyframes`,ease:e=>r.next(i*e).value/t,duration:bt(i)}}var hr=5;function gr(e,t,n){let r=Math.max(t-hr,0);return xt(n-e(r),t-r)}var _r={stiffness:100,damping:10,mass:1,velocity:0,duration:800,bounce:.3,visualDuration:.3,restSpeed:{granular:.01,default:2},restDelta:{granular:.005,default:.5},minDuration:.01,maxDuration:10,minDamping:.05,maxDamping:1},vr=.001;function yr({duration:e=_r.duration,bounce:t=_r.bounce,velocity:n=_r.velocity,mass:r=_r.mass}){let i,a;_r.maxDuration;let o=1-t;o=ct(_r.minDamping,_r.maxDamping,o),e=ct(_r.minDuration,_r.maxDuration,bt(e)),o<1?(i=t=>{let r=t*o,i=r*e,a=r-n,s=Sr(t,o),c=Math.exp(-i);return vr-a/s*c},a=t=>{let r=t*o*e,a=r*n+n,s=o**2*t**2*e,c=Math.exp(-r),l=Sr(t**2,o);return(-i(t)+vr>0?-1:1)*((a-s)*c)/l}):(i=t=>{let r=Math.exp(-t*e),i=(t-n)*e+1;return-vr+r*i},a=t=>Math.exp(-t*e)*((n-t)*(e*e)));let s=5/e,c=xr(i,a,s);if(e=yt(e),isNaN(c))return{stiffness:_r.stiffness,damping:_r.damping,duration:e};{let t=c**2*r;return{stiffness:t,damping:o*2*Math.sqrt(r*t),duration:e}}}var br=12;function xr(e,t,n){let r=n;for(let n=1;n<br;n++)r-=e(r)/t(r);return r}function Sr(e,t){return e*Math.sqrt(1-t*t)}var Cr=[`duration`,`bounce`],wr=[`stiffness`,`damping`,`mass`];function Tr(e,t){return t.some(t=>e[t]!==void 0)}function Er(e){let t={velocity:_r.velocity,stiffness:_r.stiffness,damping:_r.damping,mass:_r.mass,isResolvedFromDuration:!1,...e};if(!Tr(e,wr)&&Tr(e,Cr))if(e.visualDuration){let n=e.visualDuration,r=2*Math.PI/(n*1.2),i=r*r,a=2*ct(.05,1,1-(e.bounce||0))*Math.sqrt(i);t={...t,mass:_r.mass,stiffness:i,damping:a}}else{let n=yr(e);t={...t,...n,mass:_r.mass},t.isResolvedFromDuration=!0}return t}function Dr(e=_r.visualDuration,t=_r.bounce){let n=typeof e==`object`?e:{visualDuration:e,keyframes:[0,1],bounce:t},{restSpeed:r,restDelta:i}=n,a=n.keyframes[0],o=n.keyframes[n.keyframes.length-1],s={done:!1,value:a},{stiffness:c,damping:l,mass:u,duration:d,velocity:f,isResolvedFromDuration:p}=Er({...n,velocity:-bt(n.velocity||0)}),m=f||0,h=l/(2*Math.sqrt(c*u)),g=o-a,_=bt(Math.sqrt(c/u)),v=Math.abs(g)<5;r||=v?_r.restSpeed.granular:_r.restSpeed.default,i||=v?_r.restDelta.granular:_r.restDelta.default;let y;if(h<1){let e=Sr(_,h);y=t=>o-Math.exp(-h*_*t)*((m+h*_*g)/e*Math.sin(e*t)+g*Math.cos(e*t))}else if(h===1)y=e=>o-Math.exp(-_*e)*(g+(m+_*g)*e);else{let e=_*Math.sqrt(h*h-1);y=t=>{let n=Math.exp(-h*_*t),r=Math.min(e*t,300);return o-n*((m+h*_*g)*Math.sinh(r)+e*g*Math.cosh(r))/e}}let b={calculatedDuration:p&&d||null,next:e=>{let t=y(e);if(p)s.done=e>=d;else{let n=e===0?m:0;h<1&&(n=e===0?yt(m):gr(y,e,t));let a=Math.abs(n)<=r,c=Math.abs(o-t)<=i;s.done=a&&c}return s.value=s.done?o:t,s},toString:()=>{let e=Math.min(pr(b),fr),t=dr(t=>b.next(e*t).value,e,30);return e+`ms `+t},toTransition:()=>{}};return b}Dr.applyToOptions=e=>{let t=mr(e,100,Dr);return e.ease=t.ease,e.duration=yt(t.duration),e.type=`keyframes`,e};function Or({keyframes:e,velocity:t=0,power:n=.8,timeConstant:r=325,bounceDamping:i=10,bounceStiffness:a=500,modifyTarget:o,min:s,max:c,restDelta:l=.5,restSpeed:u}){let d=e[0],f={done:!1,value:d},p=e=>s!==void 0&&e<s||c!==void 0&&e>c,m=e=>s===void 0?c:c===void 0||Math.abs(s-e)<Math.abs(c-e)?s:c,h=n*t,g=d+h,_=o===void 0?g:o(g);_!==g&&(h=_-d);let v=e=>-h*Math.exp(-e/r),y=e=>_+v(e),b=e=>{let t=v(e),n=y(e);f.done=Math.abs(t)<=l,f.value=f.done?_:n},x,S,C=e=>{p(f.value)&&(x=e,S=Dr({keyframes:[f.value,m(f.value)],velocity:gr(y,e,f.value),damping:i,stiffness:a,restDelta:l,restSpeed:u}))};return C(0),{calculatedDuration:null,next:e=>{let t=!1;return!S&&x===void 0&&(t=!0,b(e),C(e)),x!==void 0&&e>=x?S.next(e-x):(!t&&b(e),f)}}}function kr(e,t,n){let r=[],i=n||lt.mix||lr,a=e.length-1;for(let n=0;n<a;n++){let a=i(e[n],e[n+1]);t&&(a=gt(Array.isArray(t)?t[n]||mt:t,a)),r.push(a)}return r}function Ar(e,t,{clamp:n=!0,ease:r,mixer:i}={}){let a=e.length;if(t.length,a===1)return()=>t[0];if(a===2&&t[0]===t[1])return()=>t[1];let o=e[0]===e[1];e[0]>e[a-1]&&(e=[...e].reverse(),t=[...t].reverse());let s=kr(t,r,i),c=s.length,l=n=>{if(o&&n<e[0])return t[0];let r=0;if(c>1)for(;r<e.length-2&&!(n<e[r+1]);r++);let i=_t(e[r],e[r+1],n);return s[r](i)};return n?t=>l(ct(e[0],e[a-1],t)):l}function jr(e,t){let n=e[e.length-1];for(let r=1;r<=t;r++){let i=_t(0,t,r);e.push(Yn(n,1,i))}}function Mr(e){let t=[0];return jr(t,e.length-1),t}function Nr(e,t){return e.map(e=>e*t)}function Pr(e,t){return e.map(()=>t||Rt).splice(0,e.length-1)}function Fr({duration:e=300,keyframes:t,times:n,ease:r=`easeInOut`}){let i=zt(r)?r.map(Ut):Ut(r),a={done:!1,value:t[0]},o=Ar(Nr(n&&n.length===t.length?n:Mr(t),e),t,{ease:Array.isArray(i)?i:Pr(t,i)});return{calculatedDuration:e,next:t=>(a.value=o(t),a.done=t>=e,a)}}var Ir=e=>e!==null;function Lr(e,{repeat:t,repeatType:n=`loop`},r,i=1){let a=e.filter(Ir),o=i<0||t&&n!==`loop`&&t%2==1?0:a.length-1;return!o||r===void 0?a[o]:r}var Rr={decay:Or,inertia:Or,tween:Fr,keyframes:Fr,spring:Dr};function zr(e){typeof e.type==`string`&&(e.type=Rr[e.type])}var Br=class{constructor(){this.updateFinished()}get finished(){return this._finished}updateFinished(){this._finished=new Promise(e=>{this.resolve=e})}notifyFinished(){this.resolve()}then(e,t){return this.finished.then(e,t)}},Vr=e=>e/100,Hr=class extends Br{constructor(e){super(),this.state=`idle`,this.startTime=null,this.isStopped=!1,this.currentTime=0,this.holdTime=null,this.playbackSpeed=1,this.stop=()=>{let{motionValue:e}=this.options;e&&e.updatedAt!==tn.now()&&this.tick(tn.now()),this.isStopped=!0,this.state!==`idle`&&(this.teardown(),this.options.onStop?.())},nn.mainThread++,this.options=e,this.initAnimation(),this.play(),e.autoplay===!1&&this.pause()}initAnimation(){let{options:e}=this;zr(e);let{type:t=Fr,repeat:n=0,repeatDelay:r=0,repeatType:i,velocity:a=0}=e,{keyframes:o}=e,s=t||Fr;s!==Fr&&typeof o[0]!=`number`&&(this.mixKeyframes=gt(Vr,lr(o[0],o[1])),o=[0,100]);let c=s({...e,keyframes:o});i===`mirror`&&(this.mirroredGenerator=s({...e,keyframes:[...o].reverse(),velocity:-a})),c.calculatedDuration===null&&(c.calculatedDuration=pr(c));let{calculatedDuration:l}=c;this.calculatedDuration=l,this.resolvedDuration=l+r,this.totalDuration=this.resolvedDuration*(n+1)-r,this.generator=c}updateTime(e){let t=Math.round(e-this.startTime)*this.playbackSpeed;this.holdTime===null?this.currentTime=t:this.currentTime=this.holdTime}tick(e,t=!1){let{generator:n,totalDuration:r,mixKeyframes:i,mirroredGenerator:a,resolvedDuration:o,calculatedDuration:s}=this;if(this.startTime===null)return n.next(0);let{delay:c=0,keyframes:l,repeat:u,repeatType:d,repeatDelay:f,type:p,onUpdate:m,finalKeyframe:h}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,e):this.speed<0&&(this.startTime=Math.min(e-r/this.speed,this.startTime)),t?this.currentTime=e:this.updateTime(e);let g=this.currentTime-c*(this.playbackSpeed>=0?1:-1),_=this.playbackSpeed>=0?g<0:g>r;this.currentTime=Math.max(g,0),this.state===`finished`&&this.holdTime===null&&(this.currentTime=r);let v=this.currentTime,y=n;if(u){let e=Math.min(this.currentTime,r)/o,t=Math.floor(e),n=e%1;!n&&e>=1&&(n=1),n===1&&t--,t=Math.min(t,u+1),t%2&&(d===`reverse`?(n=1-n,f&&(n-=f/o)):d===`mirror`&&(y=a)),v=ct(0,1,n)*o}let b=_?{done:!1,value:l[0]}:y.next(v);i&&(b.value=i(b.value));let{done:x}=b;!_&&s!==null&&(x=this.playbackSpeed>=0?this.currentTime>=r:this.currentTime<=0);let S=this.holdTime===null&&(this.state===`finished`||this.state===`running`&&x);return S&&p!==Or&&(b.value=Lr(l,this.options,h,this.speed)),m&&m(b.value),S&&this.finish(),b}then(e,t){return this.finished.then(e,t)}get duration(){return bt(this.calculatedDuration)}get iterationDuration(){let{delay:e=0}=this.options||{};return this.duration+bt(e)}get time(){return bt(this.currentTime)}set time(e){e=yt(e),this.currentTime=e,this.startTime===null||this.holdTime!==null||this.playbackSpeed===0?this.holdTime=e:this.driver&&(this.startTime=this.driver.now()-e/this.playbackSpeed),this.driver?.start(!1)}get speed(){return this.playbackSpeed}set speed(e){this.updateTime(tn.now());let t=this.playbackSpeed!==e;this.playbackSpeed=e,t&&(this.time=bt(this.currentTime))}play(){if(this.isStopped)return;let{driver:e=ur,startTime:t}=this.options;this.driver||=e(e=>this.tick(e)),this.options.onPlay?.();let n=this.driver.now();this.state===`finished`?(this.updateFinished(),this.startTime=n):this.holdTime===null?this.startTime||=t??n:this.startTime=n-this.holdTime,this.state===`finished`&&this.speed<0&&(this.startTime+=this.calculatedDuration),this.holdTime=null,this.state=`running`,this.driver.start()}pause(){this.state=`paused`,this.updateTime(tn.now()),this.holdTime=this.currentTime}complete(){this.state!==`running`&&this.play(),this.state=`finished`,this.holdTime=null}finish(){this.notifyFinished(),this.teardown(),this.state=`finished`,this.options.onComplete?.()}cancel(){this.holdTime=null,this.startTime=0,this.tick(0),this.teardown(),this.options.onCancel?.()}teardown(){this.state=`idle`,this.stopDriver(),this.startTime=this.holdTime=null,nn.mainThread--}stopDriver(){this.driver&&=(this.driver.stop(),void 0)}sample(e){return this.startTime=0,this.tick(e,!0)}attachTimeline(e){return this.options.allowFlatten&&(this.options.type=`keyframes`,this.options.ease=`linear`,this.initAnimation()),this.driver?.stop(),e.observe(this)}};function Ur(e){for(let t=1;t<e.length;t++)e[t]??(e[t]=e[t-1])}var Wr=e=>e*180/Math.PI,Gr=e=>qr(Wr(Math.atan2(e[1],e[0]))),Kr={x:4,y:5,translateX:4,translateY:5,scaleX:0,scaleY:3,scale:e=>(Math.abs(e[0])+Math.abs(e[3]))/2,rotate:Gr,rotateZ:Gr,skewX:e=>Wr(Math.atan(e[1])),skewY:e=>Wr(Math.atan(e[2])),skew:e=>(Math.abs(e[1])+Math.abs(e[2]))/2},qr=e=>(e%=360,e<0&&(e+=360),e),Jr=Gr,Yr=e=>Math.sqrt(e[0]*e[0]+e[1]*e[1]),Xr=e=>Math.sqrt(e[4]*e[4]+e[5]*e[5]),Zr={x:12,y:13,z:14,translateX:12,translateY:13,translateZ:14,scaleX:Yr,scaleY:Xr,scale:e=>(Yr(e)+Xr(e))/2,rotateX:e=>qr(Wr(Math.atan2(e[6],e[5]))),rotateY:e=>qr(Wr(Math.atan2(-e[2],e[0]))),rotateZ:Jr,rotate:Jr,skewX:e=>Wr(Math.atan(e[4])),skewY:e=>Wr(Math.atan(e[1])),skew:e=>(Math.abs(e[1])+Math.abs(e[4]))/2};function Qr(e){return+!!e.includes(`scale`)}function $r(e,t){if(!e||e===`none`)return Qr(t);let n=e.match(/^matrix3d\(([-\d.e\s,]+)\)$/u),r,i;if(n)r=Zr,i=n;else{let t=e.match(/^matrix\(([-\d.e\s,]+)\)$/u);r=Kr,i=t}if(!i)return Qr(t);let a=r[t],o=i[1].split(`,`).map(ti);return typeof a==`function`?a(o):o[a]}var ei=(e,t)=>{let{transform:n=`none`}=getComputedStyle(e);return $r(n,t)};function ti(e){return parseFloat(e.trim())}var ni=[`transformPerspective`,`x`,`y`,`z`,`translateX`,`translateY`,`translateZ`,`scale`,`scaleX`,`scaleY`,`rotate`,`rotateX`,`rotateY`,`rotateZ`,`skew`,`skewX`,`skewY`],ri=new Set(ni),ii=e=>e===un||e===K,ai=new Set([`x`,`y`,`z`]),oi=ni.filter(e=>!ai.has(e));function si(e){let t=[];return oi.forEach(n=>{let r=e.getValue(n);r!==void 0&&(t.push([n,r.get()]),r.set(+!!n.startsWith(`scale`)))}),t}var ci={width:({x:e},{paddingLeft:t=`0`,paddingRight:n=`0`})=>e.max-e.min-parseFloat(t)-parseFloat(n),height:({y:e},{paddingTop:t=`0`,paddingBottom:n=`0`})=>e.max-e.min-parseFloat(t)-parseFloat(n),top:(e,{top:t})=>parseFloat(t),left:(e,{left:t})=>parseFloat(t),bottom:({y:e},{top:t})=>parseFloat(t)+(e.max-e.min),right:({x:e},{left:t})=>parseFloat(t)+(e.max-e.min),x:(e,{transform:t})=>$r(t,`x`),y:(e,{transform:t})=>$r(t,`y`)};ci.translateX=ci.x,ci.translateY=ci.y;var li=new Set,ui=!1,di=!1,fi=!1;function pi(){if(di){let e=Array.from(li).filter(e=>e.needsMeasurement),t=new Set(e.map(e=>e.element)),n=new Map;t.forEach(e=>{let t=si(e);t.length&&(n.set(e,t),e.render())}),e.forEach(e=>e.measureInitialState()),t.forEach(e=>{e.render();let t=n.get(e);t&&t.forEach(([t,n])=>{e.getValue(t)?.set(n)})}),e.forEach(e=>e.measureEndState()),e.forEach(e=>{e.suspendedScrollY!==void 0&&window.scrollTo(0,e.suspendedScrollY)})}di=!1,ui=!1,li.forEach(e=>e.complete(fi)),li.clear()}function mi(){li.forEach(e=>{e.readKeyframes(),e.needsMeasurement&&(di=!0)})}function hi(){fi=!0,mi(),pi(),fi=!1}var gi=class{constructor(e,t,n,r,i,a=!1){this.state=`pending`,this.isAsync=!1,this.needsMeasurement=!1,this.unresolvedKeyframes=[...e],this.onComplete=t,this.name=n,this.motionValue=r,this.element=i,this.isAsync=a}scheduleResolve(){this.state=`scheduled`,this.isAsync?(li.add(this),ui||(ui=!0,Yt.read(mi),Yt.resolveKeyframes(pi))):(this.readKeyframes(),this.complete())}readKeyframes(){let{unresolvedKeyframes:e,name:t,element:n,motionValue:r}=this;if(e[0]===null){let i=r?.get(),a=e[e.length-1];if(i!==void 0)e[0]=i;else if(n&&t){let r=n.readValue(t,a);r!=null&&(e[0]=r)}e[0]===void 0&&(e[0]=a),r&&i===void 0&&r.set(e[0])}Ur(e)}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(e=!1){this.state=`complete`,this.onComplete(this.unresolvedKeyframes,this.finalKeyframe,e),li.delete(this)}cancel(){this.state===`scheduled`&&(li.delete(this),this.state=`pending`)}resume(){this.state===`pending`&&this.scheduleResolve()}},_i=e=>e.startsWith(`--`);function vi(e,t,n){_i(t)?e.style.setProperty(t,n):e.style[t]=n}var yi=pt(()=>window.ScrollTimeline!==void 0),bi={};function xi(e,t){let n=pt(e);return()=>bi[t]??n()}var Si=xi(()=>{try{document.createElement(`div`).animate({opacity:0},{easing:`linear(0, 1)`})}catch{return!1}return!0},`linearEasing`),Ci=([e,t,n,r])=>`cubic-bezier(${e}, ${t}, ${n}, ${r})`,wi={linear:`linear`,ease:`ease`,easeIn:`ease-in`,easeOut:`ease-out`,easeInOut:`ease-in-out`,circIn:Ci([0,.65,.55,1]),circOut:Ci([.55,0,1,.45]),backIn:Ci([.31,.01,.66,-.59]),backOut:Ci([.33,1.53,.69,.99])};function Ti(e,t){if(e)return typeof e==`function`?Si()?dr(e,t):`ease-out`:Bt(e)?Ci(e):Array.isArray(e)?e.map(e=>Ti(e,t)||wi.easeOut):wi[e]}function Ei(e,t,n,{delay:r=0,duration:i=300,repeat:a=0,repeatType:o=`loop`,ease:s=`easeOut`,times:c}={},l=void 0){let u={[t]:n};c&&(u.offset=c);let d=Ti(s,i);Array.isArray(d)&&(u.easing=d),Gt.value&&nn.waapi++;let f={delay:r,duration:i,easing:Array.isArray(d)?`linear`:d,fill:`both`,iterations:a+1,direction:o===`reverse`?`alternate`:`normal`};l&&(f.pseudoElement=l);let p=e.animate(u,f);return Gt.value&&p.finished.finally(()=>{nn.waapi--}),p}function Di(e){return typeof e==`function`&&`applyToOptions`in e}function Oi({type:e,...t}){return Di(e)&&Si()?e.applyToOptions(t):(t.duration??=300,t.ease??=`easeOut`,t)}var ki=class extends Br{constructor(e){if(super(),this.finishedTime=null,this.isStopped=!1,this.manualStartTime=null,!e)return;let{element:t,name:n,keyframes:r,pseudoElement:i,allowFlatten:a=!1,finalKeyframe:o,onComplete:s}=e;this.isPseudoElement=!!i,this.allowFlatten=a,this.options=e,e.type;let c=Oi(e);this.animation=Ei(t,n,r,c,i),c.autoplay===!1&&this.animation.pause(),this.animation.onfinish=()=>{if(this.finishedTime=this.time,!i){let e=Lr(r,this.options,o,this.speed);this.updateMotionValue?this.updateMotionValue(e):vi(t,n,e),this.animation.cancel()}s?.(),this.notifyFinished()}}play(){this.isStopped||(this.manualStartTime=null,this.animation.play(),this.state===`finished`&&this.updateFinished())}pause(){this.animation.pause()}complete(){this.animation.finish?.()}cancel(){try{this.animation.cancel()}catch{}}stop(){if(this.isStopped)return;this.isStopped=!0;let{state:e}=this;e===`idle`||e===`finished`||(this.updateMotionValue?this.updateMotionValue():this.commitStyles(),this.isPseudoElement||this.cancel())}commitStyles(){this.isPseudoElement||this.animation.commitStyles?.()}get duration(){let e=this.animation.effect?.getComputedTiming?.().duration||0;return bt(Number(e))}get iterationDuration(){let{delay:e=0}=this.options||{};return this.duration+bt(e)}get time(){return bt(Number(this.animation.currentTime)||0)}set time(e){this.manualStartTime=null,this.finishedTime=null,this.animation.currentTime=yt(e)}get speed(){return this.animation.playbackRate}set speed(e){e<0&&(this.finishedTime=null),this.animation.playbackRate=e}get state(){return this.finishedTime===null?this.animation.playState:`finished`}get startTime(){return this.manualStartTime??Number(this.animation.startTime)}set startTime(e){this.manualStartTime=this.animation.startTime=e}attachTimeline({timeline:e,observe:t}){return this.allowFlatten&&this.animation.effect?.updateTiming({easing:`linear`}),this.animation.onfinish=null,e&&yi()?(this.animation.timeline=e,mt):t(this)}},Ai={anticipate:Mt,backInOut:jt,circInOut:Ft};function ji(e){return e in Ai}function Mi(e){typeof e.ease==`string`&&ji(e.ease)&&(e.ease=Ai[e.ease])}var Ni=10,Pi=class extends ki{constructor(e){Mi(e),zr(e),super(e),e.startTime!==void 0&&(this.startTime=e.startTime),this.options=e}updateMotionValue(e){let{motionValue:t,onUpdate:n,onComplete:r,element:i,...a}=this.options;if(!t)return;if(e!==void 0){t.set(e);return}let o=new Hr({...a,autoplay:!1}),s=Math.max(Ni,tn.now()-this.startTime),c=ct(0,Ni,s-Ni);t.setWithVelocity(o.sample(Math.max(0,s-c)).value,o.sample(s).value,c),o.stop()}},Fi=(e,t)=>t===`zIndex`?!1:!!(typeof e==`number`||Array.isArray(e)||typeof e==`string`&&(Gn.test(e)||e===`0`)&&!e.startsWith(`url(`));function Ii(e){let t=e[0];if(e.length===1)return!0;for(let n=0;n<e.length;n++)if(e[n]!==t)return!0}function Li(e,t,n,r){let i=e[0];if(i===null)return!1;if(t===`display`||t===`visibility`)return!0;let a=e[e.length-1],o=Fi(i,t),s=Fi(a,t);return`${t}${i}${a}${o?a:i}`,!o||!s?!1:Ii(e)||(n===`spring`||Di(n))&&r}function Ri(e){e.duration=0,e.type=`keyframes`}var zi=new Set([`opacity`,`clipPath`,`filter`,`transform`]),Bi=pt(()=>Object.hasOwnProperty.call(Element.prototype,`animate`));function Vi(e){let{motionValue:t,name:n,repeatDelay:r,repeatType:i,damping:a,type:o}=e;if(!(t?.owner?.current instanceof HTMLElement))return!1;let{onUpdate:s,transformTemplate:c}=t.owner.getProps();return Bi()&&n&&zi.has(n)&&(n!==`transform`||!c)&&!s&&!r&&i!==`mirror`&&a!==0&&o!==`inertia`}var Hi=40,Ui=class extends Br{constructor({autoplay:e=!0,delay:t=0,type:n=`keyframes`,repeat:r=0,repeatDelay:i=0,repeatType:a=`loop`,keyframes:o,name:s,motionValue:c,element:l,...u}){super(),this.stop=()=>{this._animation&&(this._animation.stop(),this.stopTimeline?.()),this.keyframeResolver?.cancel()},this.createdAt=tn.now();let d={autoplay:e,delay:t,type:n,repeat:r,repeatDelay:i,repeatType:a,name:s,motionValue:c,element:l,...u};this.keyframeResolver=new(l?.KeyframeResolver||gi)(o,(e,t,n)=>this.onKeyframesResolved(e,t,d,!n),s,c,l),this.keyframeResolver?.scheduleResolve()}onKeyframesResolved(e,t,n,r){this.keyframeResolver=void 0;let{name:i,type:a,velocity:o,delay:s,isHandoff:c,onUpdate:l}=n;this.resolvedAt=tn.now(),Li(e,i,a,o)||((lt.instantAnimations||!s)&&l?.(Lr(e,n,t)),e[0]=e[e.length-1],Ri(n),n.repeat=0);let u={startTime:r?this.resolvedAt&&this.resolvedAt-this.createdAt>Hi?this.resolvedAt:this.createdAt:void 0,finalKeyframe:t,...n,keyframes:e},d=!c&&Vi(u)?new Pi({...u,element:u.motionValue.owner.current}):new Hr(u);d.finished.then(()=>this.notifyFinished()).catch(mt),this.pendingTimeline&&=(this.stopTimeline=d.attachTimeline(this.pendingTimeline),void 0),this._animation=d}get finished(){return this._animation?this.animation.finished:this._finished}then(e,t){return this.finished.finally(e).then(()=>{})}get animation(){return this._animation||(this.keyframeResolver?.resume(),hi()),this._animation}get duration(){return this.animation.duration}get iterationDuration(){return this.animation.iterationDuration}get time(){return this.animation.time}set time(e){this.animation.time=e}get speed(){return this.animation.speed}get state(){return this.animation.state}set speed(e){this.animation.speed=e}get startTime(){return this.animation.startTime}attachTimeline(e){return this._animation?this.stopTimeline=this.animation.attachTimeline(e):this.pendingTimeline=e,()=>this.stop()}play(){this.animation.play()}pause(){this.animation.pause()}complete(){this.animation.complete()}cancel(){this._animation&&this.animation.cancel(),this.keyframeResolver?.cancel()}},Wi=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function Gi(e){let t=Wi.exec(e);if(!t)return[,];let[,n,r,i]=t;return[`--${n??r}`,i]}function Ki(e,t,n=1){`${e}`;let[r,i]=Gi(e);if(!r)return;let a=window.getComputedStyle(t).getPropertyValue(r);if(a){let e=a.trim();return ut(e)?parseFloat(e):e}return sn(i)?Ki(i,t,n+1):i}function qi(e,t){return e?.[t]??e?.default??e}var Ji=new Set([`width`,`height`,`top`,`left`,`right`,`bottom`,...ni]),Yi={test:e=>e===`auto`,parse:e=>e},Xi=e=>t=>t.test(e),Zi=[un,K,En,Tn,On,Dn,Yi],Qi=e=>Zi.find(Xi(e));function $i(e){return typeof e==`number`?e===0:e===null?!0:e===`none`||e===`0`||ft(e)}var ea=new Set([`brightness`,`contrast`,`saturate`,`opacity`]);function ta(e){let[t,n]=e.slice(0,-1).split(`(`);if(t===`drop-shadow`)return e;let[r]=n.match(mn)||[];if(!r)return e;let i=n.replace(r,``),a=+!!ea.has(t);return r!==n&&(a*=100),t+`(`+a+i+`)`}var na=/\b([a-z-]*)\(.*?\)/gu,ra={...Gn,getAnimatableNone:e=>{let t=e.match(na);return t?t.map(ta).join(` `):e}},ia={...un,transform:Math.round},aa={borderWidth:K,borderTopWidth:K,borderRightWidth:K,borderBottomWidth:K,borderLeftWidth:K,borderRadius:K,radius:K,borderTopLeftRadius:K,borderTopRightRadius:K,borderBottomRightRadius:K,borderBottomLeftRadius:K,width:K,maxWidth:K,height:K,maxHeight:K,top:K,right:K,bottom:K,left:K,inset:K,insetBlock:K,insetBlockStart:K,insetBlockEnd:K,insetInline:K,insetInlineStart:K,insetInlineEnd:K,padding:K,paddingTop:K,paddingRight:K,paddingBottom:K,paddingLeft:K,paddingBlock:K,paddingBlockStart:K,paddingBlockEnd:K,paddingInline:K,paddingInlineStart:K,paddingInlineEnd:K,margin:K,marginTop:K,marginRight:K,marginBottom:K,marginLeft:K,marginBlock:K,marginBlockStart:K,marginBlockEnd:K,marginInline:K,marginInlineStart:K,marginInlineEnd:K,backgroundPositionX:K,backgroundPositionY:K,rotate:Tn,rotateX:Tn,rotateY:Tn,rotateZ:Tn,scale:fn,scaleX:fn,scaleY:fn,scaleZ:fn,skew:Tn,skewX:Tn,skewY:Tn,distance:K,translateX:K,translateY:K,translateZ:K,x:K,y:K,z:K,perspective:K,transformPerspective:K,opacity:dn,originX:kn,originY:kn,originZ:K,zIndex:ia,fillOpacity:dn,strokeOpacity:dn,numOctaves:ia},oa={...aa,color:jn,backgroundColor:jn,outlineColor:jn,fill:jn,stroke:jn,borderColor:jn,borderTopColor:jn,borderRightColor:jn,borderBottomColor:jn,borderLeftColor:jn,filter:ra,WebkitFilter:ra},sa=e=>oa[e];function ca(e,t){let n=sa(e);return n!==ra&&(n=Gn),n.getAnimatableNone?n.getAnimatableNone(t):void 0}var la=new Set([`auto`,`none`,`0`]);function ua(e,t,n){let r=0,i;for(;r<e.length&&!i;){let t=e[r];typeof t==`string`&&!la.has(t)&&Bn(t).values.length&&(i=e[r]),r++}if(i&&n)for(let r of t)e[r]=ca(n,i)}var da=class extends gi{constructor(e,t,n,r,i){super(e,t,n,r,i,!0)}readKeyframes(){let{unresolvedKeyframes:e,element:t,name:n}=this;if(!t||!t.current)return;super.readKeyframes();for(let n=0;n<e.length;n++){let r=e[n];if(typeof r==`string`&&(r=r.trim(),sn(r))){let i=Ki(r,t.current);i!==void 0&&(e[n]=i),n===e.length-1&&(this.finalKeyframe=r)}}if(this.resolveNoneKeyframes(),!Ji.has(n)||e.length!==2)return;let[r,i]=e,a=Qi(r),o=Qi(i);if(ln(r)!==ln(i)&&ci[n]){this.needsMeasurement=!0;return}if(a!==o)if(ii(a)&&ii(o))for(let t=0;t<e.length;t++){let n=e[t];typeof n==`string`&&(e[t]=parseFloat(n))}else ci[n]&&(this.needsMeasurement=!0)}resolveNoneKeyframes(){let{unresolvedKeyframes:e,name:t}=this,n=[];for(let t=0;t<e.length;t++)(e[t]===null||$i(e[t]))&&n.push(t);n.length&&ua(e,n,t)}measureInitialState(){let{element:e,unresolvedKeyframes:t,name:n}=this;if(!e||!e.current)return;n===`height`&&(this.suspendedScrollY=window.pageYOffset),this.measuredOrigin=ci[n](e.measureViewportBox(),window.getComputedStyle(e.current)),t[0]=this.measuredOrigin;let r=t[t.length-1];r!==void 0&&e.getValue(n,r).jump(r,!1)}measureEndState(){let{element:e,name:t,unresolvedKeyframes:n}=this;if(!e||!e.current)return;let r=e.getValue(t);r&&r.jump(this.measuredOrigin,!1);let i=n.length-1,a=n[i];n[i]=ci[t](e.measureViewportBox(),window.getComputedStyle(e.current)),a!==null&&this.finalKeyframe===void 0&&(this.finalKeyframe=a),this.removedTransforms?.length&&this.removedTransforms.forEach(([t,n])=>{e.getValue(t).set(n)}),this.resolveNoneKeyframes()}};function fa(e,t,n){if(e instanceof EventTarget)return[e];if(typeof e==`string`){let r=document;t&&(r=t.current);let i=n?.[e]??r.querySelectorAll(e);return i?Array.from(i):[]}return Array.from(e)}var pa=(e,t)=>t&&typeof e==`number`?t.transform(e):e;function ma(e){return dt(e)&&`offsetHeight`in e}var ha=30,ga=e=>!isNaN(parseFloat(e)),_a={current:void 0},va=class{constructor(e,t={}){this.canTrackVelocity=null,this.events={},this.updateAndNotify=e=>{let t=tn.now();if(this.updatedAt!==t&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(e),this.current!==this.prev&&(this.events.change?.notify(this.current),this.dependents))for(let e of this.dependents)e.dirty()},this.hasAnimated=!1,this.setCurrent(e),this.owner=t.owner}setCurrent(e){this.current=e,this.updatedAt=tn.now(),this.canTrackVelocity===null&&e!==void 0&&(this.canTrackVelocity=ga(this.current))}setPrevFrameValue(e=this.current){this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt}onChange(e){return this.on(`change`,e)}on(e,t){this.events[e]||(this.events[e]=new vt);let n=this.events[e].add(t);return e===`change`?()=>{n(),Yt.read(()=>{this.events.change.getSize()||this.stop()})}:n}clearListeners(){for(let e in this.events)this.events[e].clear()}attach(e,t){this.passiveEffect=e,this.stopPassiveEffect=t}set(e){this.passiveEffect?this.passiveEffect(e,this.updateAndNotify):this.updateAndNotify(e)}setWithVelocity(e,t,n){this.set(t),this.prev=void 0,this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt-n}jump(e,t=!0){this.updateAndNotify(e),this.prev=e,this.prevUpdatedAt=this.prevFrameValue=void 0,t&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}dirty(){this.events.change?.notify(this.current)}addDependent(e){this.dependents||=new Set,this.dependents.add(e)}removeDependent(e){this.dependents&&this.dependents.delete(e)}get(){return _a.current&&_a.current.push(this),this.current}getPrevious(){return this.prev}getVelocity(){let e=tn.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||e-this.updatedAt>ha)return 0;let t=Math.min(this.updatedAt-this.prevUpdatedAt,ha);return xt(parseFloat(this.current)-parseFloat(this.prevFrameValue),t)}start(e){return this.stop(),new Promise(t=>{this.hasAnimated=!0,this.animation=e(t),this.events.animationStart&&this.events.animationStart.notify()}).then(()=>{this.events.animationComplete&&this.events.animationComplete.notify(),this.clearAnimation()})}stop(){this.animation&&(this.animation.stop(),this.events.animationCancel&&this.events.animationCancel.notify()),this.clearAnimation()}isAnimating(){return!!this.animation}clearAnimation(){delete this.animation}destroy(){this.dependents?.clear(),this.events.destroy?.notify(),this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}};function ya(e,t){return new va(e,t)}var{schedule:ba,cancel:xa}=Jt(queueMicrotask,!1),Sa={x:!1,y:!1};function Ca(){return Sa.x||Sa.y}function wa(e){return e===`x`||e===`y`?Sa[e]?null:(Sa[e]=!0,()=>{Sa[e]=!1}):Sa.x||Sa.y?null:(Sa.x=Sa.y=!0,()=>{Sa.x=Sa.y=!1})}function Ta(e,t){let n=fa(e),r=new AbortController;return[n,{passive:!0,...t,signal:r.signal},()=>r.abort()]}function Ea(e){return!(e.pointerType===`touch`||Ca())}function Da(e,t,n={}){let[r,i,a]=Ta(e,n),o=e=>{if(!Ea(e))return;let{target:n}=e,r=t(n,e);if(typeof r!=`function`||!n)return;let a=e=>{Ea(e)&&(r(e),n.removeEventListener(`pointerleave`,a))};n.addEventListener(`pointerleave`,a,i)};return r.forEach(e=>{e.addEventListener(`pointerenter`,o,i)}),a}var Oa=(e,t)=>t?e===t?!0:Oa(e,t.parentElement):!1,ka=e=>e.pointerType===`mouse`?typeof e.button!=`number`||e.button<=0:e.isPrimary!==!1,Aa=new Set([`BUTTON`,`INPUT`,`SELECT`,`TEXTAREA`,`A`]);function ja(e){return Aa.has(e.tagName)||e.isContentEditable===!0}var Ma=new WeakSet;function Na(e){return t=>{t.key===`Enter`&&e(t)}}function Pa(e,t){e.dispatchEvent(new PointerEvent(`pointer`+t,{isPrimary:!0,bubbles:!0}))}var Fa=(e,t)=>{let n=e.currentTarget;if(!n)return;let r=Na(()=>{if(Ma.has(n))return;Pa(n,`down`);let e=Na(()=>{Pa(n,`up`)});n.addEventListener(`keyup`,e,t),n.addEventListener(`blur`,()=>Pa(n,`cancel`),t)});n.addEventListener(`keydown`,r,t),n.addEventListener(`blur`,()=>n.removeEventListener(`keydown`,r),t)};function Ia(e){return ka(e)&&!Ca()}function La(e,t,n={}){let[r,i,a]=Ta(e,n),o=e=>{let r=e.currentTarget;if(!Ia(e))return;Ma.add(r);let a=t(r,e),o=(e,t)=>{window.removeEventListener(`pointerup`,s),window.removeEventListener(`pointercancel`,c),Ma.has(r)&&Ma.delete(r),Ia(e)&&typeof a==`function`&&a(e,{success:t})},s=e=>{o(e,r===window||r===document||n.useGlobalTarget||Oa(r,e.target))},c=e=>{o(e,!1)};window.addEventListener(`pointerup`,s,i),window.addEventListener(`pointercancel`,c,i)};return r.forEach(e=>{(n.useGlobalTarget?window:e).addEventListener(`pointerdown`,o,i),ma(e)&&(e.addEventListener(`focus`,e=>Fa(e,i)),!ja(e)&&!e.hasAttribute(`tabindex`)&&(e.tabIndex=0))}),a}function Ra(e){return dt(e)&&`ownerSVGElement`in e}function za(e){return Ra(e)&&e.tagName===`svg`}var Ba=e=>!!(e&&e.getVelocity),Va=[...Zi,jn,Gn],Ha=e=>Va.find(Xi(e)),Ua=(0,x.createContext)({transformPagePoint:e=>e,isStatic:!1,reducedMotion:`never`});function Wa(e,t){if(typeof e==`function`)return e(t);e!=null&&(e.current=t)}function Ga(...e){return t=>{let n=!1,r=e.map(e=>{let r=Wa(e,t);return!n&&typeof r==`function`&&(n=!0),r});if(n)return()=>{for(let t=0;t<r.length;t++){let n=r[t];typeof n==`function`?n():Wa(e[t],null)}}}}function Ka(...e){return x.useCallback(Ga(...e),e)}var qa=class extends x.Component{getSnapshotBeforeUpdate(e){let t=this.props.childRef.current;if(t&&e.isPresent&&!this.props.isPresent){let e=t.offsetParent,n=ma(e)&&e.offsetWidth||0,r=this.props.sizeRef.current;r.height=t.offsetHeight||0,r.width=t.offsetWidth||0,r.top=t.offsetTop,r.left=t.offsetLeft,r.right=n-r.width-r.left}return null}componentDidUpdate(){}render(){return this.props.children}};function Ja({children:e,isPresent:t,anchorX:n,root:r}){let i=(0,x.useId)(),a=(0,x.useRef)(null),o=(0,x.useRef)({width:0,height:0,top:0,left:0,right:0}),{nonce:s}=(0,x.useContext)(Ua),c=Ka(a,e.props?.ref??e?.ref);return(0,x.useInsertionEffect)(()=>{let{width:e,height:c,top:l,left:u,right:d}=o.current;if(t||!a.current||!e||!c)return;let f=n===`left`?`left: ${u}`:`right: ${d}`;a.current.dataset.motionPopId=i;let p=document.createElement(`style`);s&&(p.nonce=s);let m=r??document.head;return m.appendChild(p),p.sheet&&p.sheet.insertRule(`
|
|
8
|
+
`+e.stack}return{value:e,source:t,stack:i,digest:null}}function Os(e,t,n){return{value:e,source:null,stack:n??null,digest:t??null}}function ks(e,t){try{console.error(t.value)}catch(e){setTimeout(function(){throw e})}}var As=typeof WeakMap==`function`?WeakMap:Map;function js(e,t,n){n=no(-1,n),n.tag=3,n.payload={element:null};var r=t.value;return n.callback=function(){cl||(cl=!0,ll=r),ks(e,t)},n}function Ms(e,t,n){n=no(-1,n),n.tag=3;var r=e.type.getDerivedStateFromError;if(typeof r==`function`){var i=t.value;n.payload=function(){return r(i)},n.callback=function(){ks(e,t)}}var a=e.stateNode;return a!==null&&typeof a.componentDidCatch==`function`&&(n.callback=function(){ks(e,t),typeof r!=`function`&&(ul===null?ul=new Set([this]):ul.add(this));var n=t.stack;this.componentDidCatch(t.value,{componentStack:n===null?``:n})}),n}function Ns(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new As;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)||(i.add(n),e=Gl.bind(null,e,t,n),t.then(e,e))}function Ps(e){do{var t;if((t=e.tag===13)&&(t=e.memoizedState,t=t===null?!0:t.dehydrated!==null),t)return e;e=e.return}while(e!==null);return null}function Fs(e,t,n,r,i){return e.mode&1?(e.flags|=65536,e.lanes=i,e):(e===t?e.flags|=65536:(e.flags|=128,n.flags|=131072,n.flags&=-52805,n.tag===1&&(n.alternate===null?n.tag=17:(t=no(-1,1),t.tag=2,ro(n,t,1))),n.lanes|=1),e)}var Is=C.ReactCurrentOwner,Ls=!1;function Rs(e,t,n,r){t.child=e===null?za(t,null,n,r):Ra(t,e.child,n,r)}function zs(e,t,n,r,i){n=n.render;var a=t.ref;return qa(t,i),r=Po(e,t,n,r,a,i),n=Fo(),e!==null&&!Ls?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~i,ac(e,t,i)):(Sa&&n&&va(t),t.flags|=1,Rs(e,t,r,i),t.child)}function Bs(e,t,n,r,i){if(e===null){var a=n.type;return typeof a==`function`&&!$l(a)&&a.defaultProps===void 0&&n.compare===null&&n.defaultProps===void 0?(t.tag=15,t.type=a,Vs(e,t,a,r,i)):(e=nu(n.type,null,r,t,t.mode,i),e.ref=t.ref,e.return=t,t.child=e)}if(a=e.child,(e.lanes&i)===0){var o=a.memoizedProps;if(n=n.compare,n=n===null?Tr:n,n(o,r)&&e.ref===t.ref)return ac(e,t,i)}return t.flags|=1,e=tu(a,r),e.ref=t.ref,e.return=t,t.child=e}function Vs(e,t,n,r,i){if(e!==null){var a=e.memoizedProps;if(Tr(a,r)&&e.ref===t.ref)if(Ls=!1,t.pendingProps=r=a,(e.lanes&i)!==0)e.flags&131072&&(Ls=!0);else return t.lanes=e.lanes,ac(e,t,i)}return Ws(e,t,n,r,i)}function Hs(e,t,n){var r=t.pendingProps,i=r.children,a=e===null?null:e.memoizedState;if(r.mode===`hidden`)if(!(t.mode&1))t.memoizedState={baseLanes:0,cachePool:null,transitions:null},Ui(Zc,Xc),Xc|=n;else{if(!(n&1073741824))return e=a===null?n:a.baseLanes|n,t.lanes=t.childLanes=1073741824,t.memoizedState={baseLanes:e,cachePool:null,transitions:null},t.updateQueue=null,Ui(Zc,Xc),Xc|=e,null;t.memoizedState={baseLanes:0,cachePool:null,transitions:null},r=a===null?n:a.baseLanes,Ui(Zc,Xc),Xc|=r}else a===null?r=n:(r=a.baseLanes|n,t.memoizedState=null),Ui(Zc,Xc),Xc|=r;return Rs(e,t,i,n),t.child}function Us(e,t){var n=t.ref;(e===null&&n!==null||e!==null&&e.ref!==n)&&(t.flags|=512,t.flags|=2097152)}function Ws(e,t,n,r,i){var a=Yi(n)?qi:Gi.current;return a=Ji(t,a),qa(t,i),n=Po(e,t,n,r,a,i),r=Fo(),e!==null&&!Ls?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~i,ac(e,t,i)):(Sa&&r&&va(t),t.flags|=1,Rs(e,t,n,i),t.child)}function Gs(e,t,n,r,i){if(Yi(n)){var a=!0;$i(t)}else a=!1;if(qa(t,i),t.stateNode===null)ic(e,t),ws(t,n,r),Es(t,n,r,i),r=!0;else if(e===null){var o=t.stateNode,s=t.memoizedProps;o.props=s;var c=o.context,l=n.contextType;typeof l==`object`&&l?l=Ja(l):(l=Yi(n)?qi:Gi.current,l=Ji(t,l));var u=n.getDerivedStateFromProps,d=typeof u==`function`||typeof o.getSnapshotBeforeUpdate==`function`;d||typeof o.UNSAFE_componentWillReceiveProps!=`function`&&typeof o.componentWillReceiveProps!=`function`||(s!==r||c!==l)&&Ts(t,o,r,l),$a=!1;var f=t.memoizedState;o.state=f,oo(t,r,o,i),c=t.memoizedState,s!==r||f!==c||Ki.current||$a?(typeof u==`function`&&(xs(t,n,u,r),c=t.memoizedState),(s=$a||Cs(t,n,s,r,f,c,l))?(d||typeof o.UNSAFE_componentWillMount!=`function`&&typeof o.componentWillMount!=`function`||(typeof o.componentWillMount==`function`&&o.componentWillMount(),typeof o.UNSAFE_componentWillMount==`function`&&o.UNSAFE_componentWillMount()),typeof o.componentDidMount==`function`&&(t.flags|=4194308)):(typeof o.componentDidMount==`function`&&(t.flags|=4194308),t.memoizedProps=r,t.memoizedState=c),o.props=r,o.state=c,o.context=l,r=s):(typeof o.componentDidMount==`function`&&(t.flags|=4194308),r=!1)}else{o=t.stateNode,to(e,t),s=t.memoizedProps,l=t.type===t.elementType?s:bs(t.type,s),o.props=l,d=t.pendingProps,f=o.context,c=n.contextType,typeof c==`object`&&c?c=Ja(c):(c=Yi(n)?qi:Gi.current,c=Ji(t,c));var p=n.getDerivedStateFromProps;(u=typeof p==`function`||typeof o.getSnapshotBeforeUpdate==`function`)||typeof o.UNSAFE_componentWillReceiveProps!=`function`&&typeof o.componentWillReceiveProps!=`function`||(s!==d||f!==c)&&Ts(t,o,r,c),$a=!1,f=t.memoizedState,o.state=f,oo(t,r,o,i);var m=t.memoizedState;s!==d||f!==m||Ki.current||$a?(typeof p==`function`&&(xs(t,n,p,r),m=t.memoizedState),(l=$a||Cs(t,n,l,r,f,m,c)||!1)?(u||typeof o.UNSAFE_componentWillUpdate!=`function`&&typeof o.componentWillUpdate!=`function`||(typeof o.componentWillUpdate==`function`&&o.componentWillUpdate(r,m,c),typeof o.UNSAFE_componentWillUpdate==`function`&&o.UNSAFE_componentWillUpdate(r,m,c)),typeof o.componentDidUpdate==`function`&&(t.flags|=4),typeof o.getSnapshotBeforeUpdate==`function`&&(t.flags|=1024)):(typeof o.componentDidUpdate!=`function`||s===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),typeof o.getSnapshotBeforeUpdate!=`function`||s===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),t.memoizedProps=r,t.memoizedState=m),o.props=r,o.state=m,o.context=c,r=l):(typeof o.componentDidUpdate!=`function`||s===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),typeof o.getSnapshotBeforeUpdate!=`function`||s===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),r=!1)}return Ks(e,t,n,r,a,i)}function Ks(e,t,n,r,i,a){Us(e,t);var o=(t.flags&128)!=0;if(!r&&!o)return i&&ea(t,n,!1),ac(e,t,a);r=t.stateNode,Is.current=t;var s=o&&typeof n.getDerivedStateFromError!=`function`?null:r.render();return t.flags|=1,e!==null&&o?(t.child=Ra(t,e.child,null,a),t.child=Ra(t,null,s,a)):Rs(e,t,s,a),t.memoizedState=r.state,i&&ea(t,n,!0),t.child}function qs(e){var t=e.stateNode;t.pendingContext?Zi(e,t.pendingContext,t.pendingContext!==t.context):t.context&&Zi(e,t.context,!1),mo(e,t.containerInfo)}function Js(e,t,n,r,i){return ja(),Ma(i),t.flags|=256,Rs(e,t,n,r),t.child}var Ys={dehydrated:null,treeContext:null,retryLane:0};function Xs(e){return{baseLanes:e,cachePool:null,transitions:null}}function Zs(e,t,n){var r=t.pendingProps,i=vo.current,a=!1,o=(t.flags&128)!=0,s;if((s=o)||(s=e!==null&&e.memoizedState===null?!1:(i&2)!=0),s?(a=!0,t.flags&=-129):(e===null||e.memoizedState!==null)&&(i|=1),Ui(vo,i&1),e===null)return Da(t),e=t.memoizedState,e!==null&&(e=e.dehydrated,e!==null)?(t.mode&1?e.data===`$!`?t.lanes=8:t.lanes=1073741824:t.lanes=1,null):(o=r.children,e=r.fallback,a?(r=t.mode,a=t.child,o={mode:`hidden`,children:o},!(r&1)&&a!==null?(a.childLanes=0,a.pendingProps=o):a=iu(o,r,0,null),e=ru(e,r,n,null),a.return=t,e.return=t,a.sibling=e,t.child=a,t.child.memoizedState=Xs(n),t.memoizedState=Ys,e):Qs(t,o));if(i=e.memoizedState,i!==null&&(s=i.dehydrated,s!==null))return ec(e,t,o,r,s,i,n);if(a){a=r.fallback,o=t.mode,i=e.child,s=i.sibling;var c={mode:`hidden`,children:r.children};return!(o&1)&&t.child!==i?(r=t.child,r.childLanes=0,r.pendingProps=c,t.deletions=null):(r=tu(i,c),r.subtreeFlags=i.subtreeFlags&14680064),s===null?(a=ru(a,o,n,null),a.flags|=2):a=tu(s,a),a.return=t,r.return=t,r.sibling=a,t.child=r,r=a,a=t.child,o=e.child.memoizedState,o=o===null?Xs(n):{baseLanes:o.baseLanes|n,cachePool:null,transitions:o.transitions},a.memoizedState=o,a.childLanes=e.childLanes&~n,t.memoizedState=Ys,r}return a=e.child,e=a.sibling,r=tu(a,{mode:`visible`,children:r.children}),!(t.mode&1)&&(r.lanes=n),r.return=t,r.sibling=null,e!==null&&(n=t.deletions,n===null?(t.deletions=[e],t.flags|=16):n.push(e)),t.child=r,t.memoizedState=null,r}function Qs(e,t){return t=iu({mode:`visible`,children:t},e.mode,0,null),t.return=e,e.child=t}function $s(e,t,n,r){return r!==null&&Ma(r),Ra(t,e.child,null,n),e=Qs(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function ec(e,t,n,i,a,o,s){if(n)return t.flags&256?(t.flags&=-257,i=Os(Error(r(422))),$s(e,t,s,i)):t.memoizedState===null?(o=i.fallback,a=t.mode,i=iu({mode:`visible`,children:i.children},a,0,null),o=ru(o,a,s,null),o.flags|=2,i.return=t,o.return=t,i.sibling=o,t.child=i,t.mode&1&&Ra(t,e.child,null,s),t.child.memoizedState=Xs(s),t.memoizedState=Ys,o):(t.child=e.child,t.flags|=128,null);if(!(t.mode&1))return $s(e,t,s,null);if(a.data===`$!`){if(i=a.nextSibling&&a.nextSibling.dataset,i)var c=i.dgst;return i=c,o=Error(r(419)),i=Os(o,i,void 0),$s(e,t,s,i)}if(c=(s&e.childLanes)!==0,Ls||c){if(i=qc,i!==null){switch(s&-s){case 4:a=2;break;case 16:a=8;break;case 64: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:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:a=32;break;case 536870912:a=268435456;break;default:a=0}a=(a&(i.suspendedLanes|s))===0?a:0,a!==0&&a!==o.retryLane&&(o.retryLane=a,Qa(e,a),bl(i,e,a,-1))}return Pl(),i=Os(Error(r(421))),$s(e,t,s,i)}return a.data===`$?`?(t.flags|=128,t.child=e.child,t=ql.bind(null,e),a._reactRetry=t,null):(e=o.treeContext,xa=Ei(a.nextSibling),ba=t,Sa=!0,Ca=null,e!==null&&(da[fa++]=ma,da[fa++]=ha,da[fa++]=pa,ma=e.id,ha=e.overflow,pa=t),t=Qs(t,i.children),t.flags|=4096,t)}function tc(e,t,n){e.lanes|=t;var r=e.alternate;r!==null&&(r.lanes|=t),Ka(e.return,t,n)}function nc(e,t,n,r,i){var a=e.memoizedState;a===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:r,tail:n,tailMode:i}:(a.isBackwards=t,a.rendering=null,a.renderingStartTime=0,a.last=r,a.tail=n,a.tailMode=i)}function rc(e,t,n){var r=t.pendingProps,i=r.revealOrder,a=r.tail;if(Rs(e,t,r.children,n),r=vo.current,r&2)r=r&1|2,t.flags|=128;else{if(e!==null&&e.flags&128)a:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&tc(e,n,t);else if(e.tag===19)tc(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}r&=1}if(Ui(vo,r),!(t.mode&1))t.memoizedState=null;else switch(i){case`forwards`:for(n=t.child,i=null;n!==null;)e=n.alternate,e!==null&&yo(e)===null&&(i=n),n=n.sibling;n=i,n===null?(i=t.child,t.child=null):(i=n.sibling,n.sibling=null),nc(t,!1,i,n,a);break;case`backwards`:for(n=null,i=t.child,t.child=null;i!==null;){if(e=i.alternate,e!==null&&yo(e)===null){t.child=i;break}e=i.sibling,i.sibling=n,n=i,i=e}nc(t,!0,n,null,a);break;case`together`:nc(t,!1,null,null,void 0);break;default:t.memoizedState=null}return t.child}function ic(e,t){!(t.mode&1)&&e!==null&&(e.alternate=null,t.alternate=null,t.flags|=2)}function ac(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),el|=t.lanes,(n&t.childLanes)===0)return null;if(e!==null&&t.child!==e.child)throw Error(r(153));if(t.child!==null){for(e=t.child,n=tu(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=tu(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function oc(e,t,n){switch(t.tag){case 3:qs(t),ja();break;case 5:go(t);break;case 1:Yi(t.type)&&$i(t);break;case 4:mo(t,t.stateNode.containerInfo);break;case 10:var r=t.type._context,i=t.memoizedProps.value;Ui(Ba,r._currentValue),r._currentValue=i;break;case 13:if(r=t.memoizedState,r!==null)return r.dehydrated===null?(n&t.child.childLanes)===0?(Ui(vo,vo.current&1),e=ac(e,t,n),e===null?null:e.sibling):Zs(e,t,n):(Ui(vo,vo.current&1),t.flags|=128,null);Ui(vo,vo.current&1);break;case 19:if(r=(n&t.childLanes)!==0,e.flags&128){if(r)return rc(e,t,n);t.flags|=128}if(i=t.memoizedState,i!==null&&(i.rendering=null,i.tail=null,i.lastEffect=null),Ui(vo,vo.current),r)break;return null;case 22:case 23:return t.lanes=0,Hs(e,t,n)}return ac(e,t,n)}var sc=function(e,t){for(var n=t.child;n!==null;){if(n.tag===5||n.tag===6)e.appendChild(n.stateNode);else if(n.tag!==4&&n.child!==null){n.child.return=n,n=n.child;continue}if(n===t)break;for(;n.sibling===null;){if(n.return===null||n.return===t)return;n=n.return}n.sibling.return=n.return,n=n.sibling}},cc=function(e,t,n,r){var i=e.memoizedProps;if(i!==r){e=t.stateNode,po(lo.current);var o=null;switch(n){case`input`:i=ce(e,i),r=ce(e,r),o=[];break;case`select`:i=z({},i,{value:void 0}),r=z({},r,{value:void 0}),o=[];break;case`textarea`:i=ge(e,i),r=ge(e,r),o=[];break;default:typeof i.onClick!=`function`&&typeof r.onClick==`function`&&(e.onclick=gi)}Ae(n,r);var s;for(u in n=null,i)if(!r.hasOwnProperty(u)&&i.hasOwnProperty(u)&&i[u]!=null)if(u===`style`){var c=i[u];for(s in c)c.hasOwnProperty(s)&&(n||={},n[s]=``)}else u!==`dangerouslySetInnerHTML`&&u!==`children`&&u!==`suppressContentEditableWarning`&&u!==`suppressHydrationWarning`&&u!==`autoFocus`&&(a.hasOwnProperty(u)?o||=[]:(o||=[]).push(u,null));for(u in r){var l=r[u];if(c=i?.[u],r.hasOwnProperty(u)&&l!==c&&(l!=null||c!=null))if(u===`style`)if(c){for(s in c)!c.hasOwnProperty(s)||l&&l.hasOwnProperty(s)||(n||={},n[s]=``);for(s in l)l.hasOwnProperty(s)&&c[s]!==l[s]&&(n||={},n[s]=l[s])}else n||(o||=[],o.push(u,n)),n=l;else u===`dangerouslySetInnerHTML`?(l=l?l.__html:void 0,c=c?c.__html:void 0,l!=null&&c!==l&&(o||=[]).push(u,l)):u===`children`?typeof l!=`string`&&typeof l!=`number`||(o||=[]).push(u,``+l):u!==`suppressContentEditableWarning`&&u!==`suppressHydrationWarning`&&(a.hasOwnProperty(u)?(l!=null&&u===`onScroll`&&ni(`scroll`,e),o||c===l||(o=[])):(o||=[]).push(u,l))}n&&(o||=[]).push(`style`,n);var u=o;(t.updateQueue=u)&&(t.flags|=4)}},lc=function(e,t,n,r){n!==r&&(t.flags|=4)};function uc(e,t){if(!Sa)switch(e.tailMode){case`hidden`:t=e.tail;for(var n=null;t!==null;)t.alternate!==null&&(n=t),t=t.sibling;n===null?e.tail=null:n.sibling=null;break;case`collapsed`:n=e.tail;for(var 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}}function dc(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&14680064,r|=i.flags&14680064,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 fc(e,t,n){var i=t.pendingProps;switch(ya(t),t.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return dc(t),null;case 1:return Yi(t.type)&&Xi(),dc(t),null;case 3:return i=t.stateNode,ho(),Hi(Ki),Hi(Gi),xo(),i.pendingContext&&(i.context=i.pendingContext,i.pendingContext=null),(e===null||e.child===null)&&(ka(t)?t.flags|=4:e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,Ca!==null&&(wl(Ca),Ca=null))),dc(t),null;case 5:_o(t);var o=po(fo.current);if(n=t.type,e!==null&&t.stateNode!=null)cc(e,t,n,i,o),e.ref!==t.ref&&(t.flags|=512,t.flags|=2097152);else{if(!i){if(t.stateNode===null)throw Error(r(166));return dc(t),null}if(e=po(lo.current),ka(t)){i=t.stateNode,n=t.type;var s=t.memoizedProps;switch(i[ki]=t,i[Ai]=s,e=(t.mode&1)!=0,n){case`dialog`:ni(`cancel`,i),ni(`close`,i);break;case`iframe`:case`object`:case`embed`:ni(`load`,i);break;case`video`:case`audio`:for(o=0;o<Qr.length;o++)ni(Qr[o],i);break;case`source`:ni(`error`,i);break;case`img`:case`image`:case`link`:ni(`error`,i),ni(`load`,i);break;case`details`:ni(`toggle`,i);break;case`input`:le(i,s),ni(`invalid`,i);break;case`select`:i._wrapperState={wasMultiple:!!s.multiple},ni(`invalid`,i);break;case`textarea`:_e(i,s),ni(`invalid`,i)}for(var c in Ae(n,s),o=null,s)if(s.hasOwnProperty(c)){var l=s[c];c===`children`?typeof l==`string`?i.textContent!==l&&(!0!==s.suppressHydrationWarning&&hi(i.textContent,l,e),o=[`children`,l]):typeof l==`number`&&i.textContent!==``+l&&(!0!==s.suppressHydrationWarning&&hi(i.textContent,l,e),o=[`children`,``+l]):a.hasOwnProperty(c)&&l!=null&&c===`onScroll`&&ni(`scroll`,i)}switch(n){case`input`:W(i),fe(i,s,!0);break;case`textarea`:W(i),ye(i);break;case`select`:case`option`:break;default:typeof s.onClick==`function`&&(i.onclick=gi)}i=o,t.updateQueue=i,i!==null&&(t.flags|=4)}else{c=o.nodeType===9?o:o.ownerDocument,e===`http://www.w3.org/1999/xhtml`&&(e=be(n)),e===`http://www.w3.org/1999/xhtml`?n===`script`?(e=c.createElement(`div`),e.innerHTML=`<script><\/script>`,e=e.removeChild(e.firstChild)):typeof i.is==`string`?e=c.createElement(n,{is:i.is}):(e=c.createElement(n),n===`select`&&(c=e,i.multiple?c.multiple=!0:i.size&&(c.size=i.size))):e=c.createElementNS(e,n),e[ki]=t,e[Ai]=i,sc(e,t,!1,!1),t.stateNode=e;a:{switch(c=je(n,i),n){case`dialog`:ni(`cancel`,e),ni(`close`,e),o=i;break;case`iframe`:case`object`:case`embed`:ni(`load`,e),o=i;break;case`video`:case`audio`:for(o=0;o<Qr.length;o++)ni(Qr[o],e);o=i;break;case`source`:ni(`error`,e),o=i;break;case`img`:case`image`:case`link`:ni(`error`,e),ni(`load`,e),o=i;break;case`details`:ni(`toggle`,e),o=i;break;case`input`:le(e,i),o=ce(e,i),ni(`invalid`,e);break;case`option`:o=i;break;case`select`:e._wrapperState={wasMultiple:!!i.multiple},o=z({},i,{value:void 0}),ni(`invalid`,e);break;case`textarea`:_e(e,i),o=ge(e,i),ni(`invalid`,e);break;default:o=i}for(s in Ae(n,o),l=o,l)if(l.hasOwnProperty(s)){var u=l[s];s===`style`?Oe(e,u):s===`dangerouslySetInnerHTML`?(u=u?u.__html:void 0,u!=null&&Ce(e,u)):s===`children`?typeof u==`string`?(n!==`textarea`||u!==``)&&we(e,u):typeof u==`number`&&we(e,``+u):s!==`suppressContentEditableWarning`&&s!==`suppressHydrationWarning`&&s!==`autoFocus`&&(a.hasOwnProperty(s)?u!=null&&s===`onScroll`&&ni(`scroll`,e):u!=null&&S(e,s,u,c))}switch(n){case`input`:W(e),fe(e,i,!1);break;case`textarea`:W(e),ye(e);break;case`option`:i.value!=null&&e.setAttribute(`value`,``+re(i.value));break;case`select`:e.multiple=!!i.multiple,s=i.value,s==null?i.defaultValue!=null&&he(e,!!i.multiple,i.defaultValue,!0):he(e,!!i.multiple,s,!1);break;default:typeof o.onClick==`function`&&(e.onclick=gi)}switch(n){case`button`:case`input`:case`select`:case`textarea`:i=!!i.autoFocus;break a;case`img`:i=!0;break a;default:i=!1}}i&&(t.flags|=4)}t.ref!==null&&(t.flags|=512,t.flags|=2097152)}return dc(t),null;case 6:if(e&&t.stateNode!=null)lc(e,t,e.memoizedProps,i);else{if(typeof i!=`string`&&t.stateNode===null)throw Error(r(166));if(n=po(fo.current),po(lo.current),ka(t)){if(i=t.stateNode,n=t.memoizedProps,i[ki]=t,(s=i.nodeValue!==n)&&(e=ba,e!==null))switch(e.tag){case 3:hi(i.nodeValue,n,(e.mode&1)!=0);break;case 5:!0!==e.memoizedProps.suppressHydrationWarning&&hi(i.nodeValue,n,(e.mode&1)!=0)}s&&(t.flags|=4)}else i=(n.nodeType===9?n:n.ownerDocument).createTextNode(i),i[ki]=t,t.stateNode=i}return dc(t),null;case 13:if(Hi(vo),i=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(Sa&&xa!==null&&t.mode&1&&!(t.flags&128))Aa(),ja(),t.flags|=98560,s=!1;else if(s=ka(t),i!==null&&i.dehydrated!==null){if(e===null){if(!s)throw Error(r(318));if(s=t.memoizedState,s=s===null?null:s.dehydrated,!s)throw Error(r(317));s[ki]=t}else ja(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;dc(t),s=!1}else Ca!==null&&(wl(Ca),Ca=null),s=!0;if(!s)return t.flags&65536?t:null}return t.flags&128?(t.lanes=n,t):(i=i!==null,i!==(e!==null&&e.memoizedState!==null)&&i&&(t.child.flags|=8192,t.mode&1&&(e===null||vo.current&1?Qc===0&&(Qc=3):Pl())),t.updateQueue!==null&&(t.flags|=4),dc(t),null);case 4:return ho(),e===null&&ai(t.stateNode.containerInfo),dc(t),null;case 10:return Ga(t.type._context),dc(t),null;case 17:return Yi(t.type)&&Xi(),dc(t),null;case 19:if(Hi(vo),s=t.memoizedState,s===null)return dc(t),null;if(i=(t.flags&128)!=0,c=s.rendering,c===null)if(i)uc(s,!1);else{if(Qc!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(c=yo(e),c!==null){for(t.flags|=128,uc(s,!1),i=c.updateQueue,i!==null&&(t.updateQueue=i,t.flags|=4),t.subtreeFlags=0,i=n,n=t.child;n!==null;)s=n,e=i,s.flags&=14680066,c=s.alternate,c===null?(s.childLanes=0,s.lanes=e,s.child=null,s.subtreeFlags=0,s.memoizedProps=null,s.memoizedState=null,s.updateQueue=null,s.dependencies=null,s.stateNode=null):(s.childLanes=c.childLanes,s.lanes=c.lanes,s.child=c.child,s.subtreeFlags=0,s.deletions=null,s.memoizedProps=c.memoizedProps,s.memoizedState=c.memoizedState,s.updateQueue=c.updateQueue,s.type=c.type,e=c.dependencies,s.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext}),n=n.sibling;return Ui(vo,vo.current&1|2),t.child}e=e.sibling}s.tail!==null&&ut()>ol&&(t.flags|=128,i=!0,uc(s,!1),t.lanes=4194304)}else{if(!i)if(e=yo(c),e!==null){if(t.flags|=128,i=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),uc(s,!0),s.tail===null&&s.tailMode===`hidden`&&!c.alternate&&!Sa)return dc(t),null}else 2*ut()-s.renderingStartTime>ol&&n!==1073741824&&(t.flags|=128,i=!0,uc(s,!1),t.lanes=4194304);s.isBackwards?(c.sibling=t.child,t.child=c):(n=s.last,n===null?t.child=c:n.sibling=c,s.last=c)}return s.tail===null?(dc(t),null):(t=s.tail,s.rendering=t,s.tail=t.sibling,s.renderingStartTime=ut(),t.sibling=null,n=vo.current,Ui(vo,i?n&1|2:n&1),t);case 22:case 23:return Al(),i=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==i&&(t.flags|=8192),i&&t.mode&1?Xc&1073741824&&(dc(t),t.subtreeFlags&6&&(t.flags|=8192)):dc(t),null;case 24:return null;case 25:return null}throw Error(r(156,t.tag))}function pc(e,t){switch(ya(t),t.tag){case 1:return Yi(t.type)&&Xi(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return ho(),Hi(Ki),Hi(Gi),xo(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return _o(t),null;case 13:if(Hi(vo),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(r(340));ja()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return Hi(vo),null;case 4:return ho(),null;case 10:return Ga(t.type._context),null;case 22:case 23:return Al(),null;case 24:return null;default:return null}}var mc=!1,hc=!1,gc=typeof WeakSet==`function`?WeakSet:Set,q=null;function _c(e,t){var n=e.ref;if(n!==null)if(typeof n==`function`)try{n(null)}catch(n){Wl(e,t,n)}else n.current=null}function vc(e,t,n){try{n()}catch(n){Wl(e,t,n)}}var yc=!1;function bc(e,t){if(_i=ln,e=kr(),Ar(e)){if(`selectionStart`in e)var n={start:e.selectionStart,end:e.selectionEnd};else a:{n=(n=e.ownerDocument)&&n.defaultView||window;var i=n.getSelection&&n.getSelection();if(i&&i.rangeCount!==0){n=i.anchorNode;var a=i.anchorOffset,o=i.focusNode;i=i.focusOffset;try{n.nodeType,o.nodeType}catch{n=null;break a}var s=0,c=-1,l=-1,u=0,d=0,f=e,p=null;b:for(;;){for(var m;f!==n||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===n&&++u===a&&(c=s),p===o&&++d===i&&(l=s),(m=f.nextSibling)!==null)break;f=p,p=f.parentNode}f=m}n=c===-1||l===-1?null:{start:c,end:l}}else n=null}n||={start:0,end:0}}else n=null;for(vi={focusedElem:e,selectionRange:n},ln=!1,q=t;q!==null;)if(t=q,e=t.child,t.subtreeFlags&1028&&e!==null)e.return=t,q=e;else for(;q!==null;){t=q;try{var h=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(h!==null){var g=h.memoizedProps,_=h.memoizedState,v=t.stateNode;v.__reactInternalSnapshotBeforeUpdate=v.getSnapshotBeforeUpdate(t.elementType===t.type?g:bs(t.type,g),_)}break;case 3:var y=t.stateNode.containerInfo;y.nodeType===1?y.textContent=``:y.nodeType===9&&y.documentElement&&y.removeChild(y.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(r(163))}}catch(e){Wl(t,t.return,e)}if(e=t.sibling,e!==null){e.return=t.return,q=e;break}q=t.return}return h=yc,yc=!1,h}function xc(e,t,n){var r=t.updateQueue;if(r=r===null?null:r.lastEffect,r!==null){var i=r=r.next;do{if((i.tag&e)===e){var a=i.destroy;i.destroy=void 0,a!==void 0&&vc(t,n,a)}i=i.next}while(i!==r)}}function Sc(e,t){if(t=t.updateQueue,t=t===null?null:t.lastEffect,t!==null){var n=t=t.next;do{if((n.tag&e)===e){var r=n.create;n.destroy=r()}n=n.next}while(n!==t)}}function Cc(e){var t=e.ref;if(t!==null){var n=e.stateNode;switch(e.tag){case 5:e=n;break;default:e=n}typeof t==`function`?t(e):t.current=e}}function wc(e){var t=e.alternate;t!==null&&(e.alternate=null,wc(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[ki],delete t[Ai],delete t[Mi],delete t[Ni],delete t[Pi])),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function Tc(e){return e.tag===5||e.tag===3||e.tag===4}function Ec(e){a:for(;;){for(;e.sibling===null;){if(e.return===null||Tc(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.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 Dc(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.nodeType===8?n.parentNode.insertBefore(e,t):n.insertBefore(e,t):(n.nodeType===8?(t=n.parentNode,t.insertBefore(e,n)):(t=n,t.appendChild(e)),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=gi));else if(r!==4&&(e=e.child,e!==null))for(Dc(e,t,n),e=e.sibling;e!==null;)Dc(e,t,n),e=e.sibling}function Oc(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(r!==4&&(e=e.child,e!==null))for(Oc(e,t,n),e=e.sibling;e!==null;)Oc(e,t,n),e=e.sibling}var kc=null,Ac=!1;function jc(e,t,n){for(n=n.child;n!==null;)Mc(e,t,n),n=n.sibling}function Mc(e,t,n){if(vt&&typeof vt.onCommitFiberUnmount==`function`)try{vt.onCommitFiberUnmount(_t,n)}catch{}switch(n.tag){case 5:hc||_c(n,t);case 6:var r=kc,i=Ac;kc=null,jc(e,t,n),kc=r,Ac=i,kc!==null&&(Ac?(e=kc,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):kc.removeChild(n.stateNode));break;case 18:kc!==null&&(Ac?(e=kc,n=n.stateNode,e.nodeType===8?Ti(e.parentNode,n):e.nodeType===1&&Ti(e,n),sn(e)):Ti(kc,n.stateNode));break;case 4:r=kc,i=Ac,kc=n.stateNode.containerInfo,Ac=!0,jc(e,t,n),kc=r,Ac=i;break;case 0:case 11:case 14:case 15:if(!hc&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){i=r=r.next;do{var a=i,o=a.destroy;a=a.tag,o!==void 0&&(a&2||a&4)&&vc(n,t,o),i=i.next}while(i!==r)}jc(e,t,n);break;case 1:if(!hc&&(_c(n,t),r=n.stateNode,typeof r.componentWillUnmount==`function`))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(e){Wl(n,t,e)}jc(e,t,n);break;case 21:jc(e,t,n);break;case 22:n.mode&1?(hc=(r=hc)||n.memoizedState!==null,jc(e,t,n),hc=r):jc(e,t,n);break;default:jc(e,t,n)}}function Nc(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new gc),t.forEach(function(t){var r=Jl.bind(null,e,t);n.has(t)||(n.add(t),t.then(r,r))})}}function Pc(e,t){var n=t.deletions;if(n!==null)for(var i=0;i<n.length;i++){var a=n[i];try{var o=e,s=t,c=s;a:for(;c!==null;){switch(c.tag){case 5:kc=c.stateNode,Ac=!1;break a;case 3:kc=c.stateNode.containerInfo,Ac=!0;break a;case 4:kc=c.stateNode.containerInfo,Ac=!0;break a}c=c.return}if(kc===null)throw Error(r(160));Mc(o,s,a),kc=null,Ac=!1;var l=a.alternate;l!==null&&(l.return=null),a.return=null}catch(e){Wl(a,t,e)}}if(t.subtreeFlags&12854)for(t=t.child;t!==null;)Fc(t,e),t=t.sibling}function Fc(e,t){var n=e.alternate,i=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:if(Pc(t,e),Ic(e),i&4){try{xc(3,e,e.return),Sc(3,e)}catch(t){Wl(e,e.return,t)}try{xc(5,e,e.return)}catch(t){Wl(e,e.return,t)}}break;case 1:Pc(t,e),Ic(e),i&512&&n!==null&&_c(n,n.return);break;case 5:if(Pc(t,e),Ic(e),i&512&&n!==null&&_c(n,n.return),e.flags&32){var a=e.stateNode;try{we(a,``)}catch(t){Wl(e,e.return,t)}}if(i&4&&(a=e.stateNode,a!=null)){var o=e.memoizedProps,s=n===null?o:n.memoizedProps,c=e.type,l=e.updateQueue;if(e.updateQueue=null,l!==null)try{c===`input`&&o.type===`radio`&&o.name!=null&&ue(a,o),je(c,s);var u=je(c,o);for(s=0;s<l.length;s+=2){var d=l[s],f=l[s+1];d===`style`?Oe(a,f):d===`dangerouslySetInnerHTML`?Ce(a,f):d===`children`?we(a,f):S(a,d,f,u)}switch(c){case`input`:de(a,o);break;case`textarea`:ve(a,o);break;case`select`:var p=a._wrapperState.wasMultiple;a._wrapperState.wasMultiple=!!o.multiple;var m=o.value;m==null?p!==!!o.multiple&&(o.defaultValue==null?he(a,!!o.multiple,o.multiple?[]:``,!1):he(a,!!o.multiple,o.defaultValue,!0)):he(a,!!o.multiple,m,!1)}a[Ai]=o}catch(t){Wl(e,e.return,t)}}break;case 6:if(Pc(t,e),Ic(e),i&4){if(e.stateNode===null)throw Error(r(162));a=e.stateNode,o=e.memoizedProps;try{a.nodeValue=o}catch(t){Wl(e,e.return,t)}}break;case 3:if(Pc(t,e),Ic(e),i&4&&n!==null&&n.memoizedState.isDehydrated)try{sn(t.containerInfo)}catch(t){Wl(e,e.return,t)}break;case 4:Pc(t,e),Ic(e);break;case 13:Pc(t,e),Ic(e),a=e.child,a.flags&8192&&(o=a.memoizedState!==null,a.stateNode.isHidden=o,!o||a.alternate!==null&&a.alternate.memoizedState!==null||(al=ut())),i&4&&Nc(e);break;case 22:if(d=n!==null&&n.memoizedState!==null,e.mode&1?(hc=(u=hc)||d,Pc(t,e),hc=u):Pc(t,e),Ic(e),i&8192){if(u=e.memoizedState!==null,(e.stateNode.isHidden=u)&&!d&&e.mode&1)for(q=e,d=e.child;d!==null;){for(f=q=d;q!==null;){switch(p=q,m=p.child,p.tag){case 0:case 11:case 14:case 15:xc(4,p,p.return);break;case 1:_c(p,p.return);var h=p.stateNode;if(typeof h.componentWillUnmount==`function`){i=p,n=p.return;try{t=i,h.props=t.memoizedProps,h.state=t.memoizedState,h.componentWillUnmount()}catch(e){Wl(i,n,e)}}break;case 5:_c(p,p.return);break;case 22:if(p.memoizedState!==null){Bc(f);continue}}m===null?Bc(f):(m.return=p,q=m)}d=d.sibling}a:for(d=null,f=e;;){if(f.tag===5){if(d===null){d=f;try{a=f.stateNode,u?(o=a.style,typeof o.setProperty==`function`?o.setProperty(`display`,`none`,`important`):o.display=`none`):(c=f.stateNode,l=f.memoizedProps.style,s=l!=null&&l.hasOwnProperty(`display`)?l.display:null,c.style.display=De(`display`,s))}catch(t){Wl(e,e.return,t)}}}else if(f.tag===6){if(d===null)try{f.stateNode.nodeValue=u?``:f.memoizedProps}catch(t){Wl(e,e.return,t)}}else if((f.tag!==22&&f.tag!==23||f.memoizedState===null||f===e)&&f.child!==null){f.child.return=f,f=f.child;continue}if(f===e)break a;for(;f.sibling===null;){if(f.return===null||f.return===e)break a;d===f&&(d=null),f=f.return}d===f&&(d=null),f.sibling.return=f.return,f=f.sibling}}break;case 19:Pc(t,e),Ic(e),i&4&&Nc(e);break;case 21:break;default:Pc(t,e),Ic(e)}}function Ic(e){var t=e.flags;if(t&2){try{a:{for(var n=e.return;n!==null;){if(Tc(n)){var i=n;break a}n=n.return}throw Error(r(160))}switch(i.tag){case 5:var a=i.stateNode;i.flags&32&&(we(a,``),i.flags&=-33),Oc(e,Ec(e),a);break;case 3:case 4:var o=i.stateNode.containerInfo;Dc(e,Ec(e),o);break;default:throw Error(r(161))}}catch(t){Wl(e,e.return,t)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function Lc(e,t,n){q=e,Rc(e,t,n)}function Rc(e,t,n){for(var r=(e.mode&1)!=0;q!==null;){var i=q,a=i.child;if(i.tag===22&&r){var o=i.memoizedState!==null||mc;if(!o){var s=i.alternate,c=s!==null&&s.memoizedState!==null||hc;s=mc;var l=hc;if(mc=o,(hc=c)&&!l)for(q=i;q!==null;)o=q,c=o.child,o.tag===22&&o.memoizedState!==null||c===null?Vc(i):(c.return=o,q=c);for(;a!==null;)q=a,Rc(a,t,n),a=a.sibling;q=i,mc=s,hc=l}zc(e,t,n)}else i.subtreeFlags&8772&&a!==null?(a.return=i,q=a):zc(e,t,n)}}function zc(e){for(;q!==null;){var t=q;if(t.flags&8772){var n=t.alternate;try{if(t.flags&8772)switch(t.tag){case 0:case 11:case 15:hc||Sc(5,t);break;case 1:var i=t.stateNode;if(t.flags&4&&!hc)if(n===null)i.componentDidMount();else{var a=t.elementType===t.type?n.memoizedProps:bs(t.type,n.memoizedProps);i.componentDidUpdate(a,n.memoizedState,i.__reactInternalSnapshotBeforeUpdate)}var o=t.updateQueue;o!==null&&so(t,o,i);break;case 3:var s=t.updateQueue;if(s!==null){if(n=null,t.child!==null)switch(t.child.tag){case 5:n=t.child.stateNode;break;case 1:n=t.child.stateNode}so(t,s,n)}break;case 5:var c=t.stateNode;if(n===null&&t.flags&4){n=c;var l=t.memoizedProps;switch(t.type){case`button`:case`input`:case`select`:case`textarea`:l.autoFocus&&n.focus();break;case`img`:l.src&&(n.src=l.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(t.memoizedState===null){var u=t.alternate;if(u!==null){var d=u.memoizedState;if(d!==null){var f=d.dehydrated;f!==null&&sn(f)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(r(163))}hc||t.flags&512&&Cc(t)}catch(e){Wl(t,t.return,e)}}if(t===e){q=null;break}if(n=t.sibling,n!==null){n.return=t.return,q=n;break}q=t.return}}function Bc(e){for(;q!==null;){var t=q;if(t===e){q=null;break}var n=t.sibling;if(n!==null){n.return=t.return,q=n;break}q=t.return}}function Vc(e){for(;q!==null;){var t=q;try{switch(t.tag){case 0:case 11:case 15:var n=t.return;try{Sc(4,t)}catch(e){Wl(t,n,e)}break;case 1:var r=t.stateNode;if(typeof r.componentDidMount==`function`){var i=t.return;try{r.componentDidMount()}catch(e){Wl(t,i,e)}}var a=t.return;try{Cc(t)}catch(e){Wl(t,a,e)}break;case 5:var o=t.return;try{Cc(t)}catch(e){Wl(t,o,e)}}}catch(e){Wl(t,t.return,e)}if(t===e){q=null;break}var s=t.sibling;if(s!==null){s.return=t.return,q=s;break}q=t.return}}var Hc=Math.ceil,Uc=C.ReactCurrentDispatcher,Wc=C.ReactCurrentOwner,Gc=C.ReactCurrentBatchConfig,Kc=0,qc=null,Jc=null,Yc=0,Xc=0,Zc=Vi(0),Qc=0,$c=null,el=0,tl=0,nl=0,rl=null,il=null,al=0,ol=1/0,sl=null,cl=!1,ll=null,ul=null,dl=!1,fl=null,pl=0,ml=0,hl=null,gl=-1,_l=0;function vl(){return Kc&6?ut():gl===-1?gl=ut():gl}function yl(e){return e.mode&1?Kc&2&&Yc!==0?Yc&-Yc:Na.transition===null?(e=It,e===0?(e=window.event,e=e===void 0?16:hn(e.type),e):e):(_l===0&&(_l=jt()),_l):1}function bl(e,t,n,i){if(50<ml)throw ml=0,hl=null,Error(r(185));Nt(e,n,i),(!(Kc&2)||e!==qc)&&(e===qc&&(!(Kc&2)&&(tl|=n),Qc===4&&El(e,Yc)),xl(e,i),n===1&&Kc===0&&!(t.mode&1)&&(ol=ut()+500,na&&oa()))}function xl(e,t){var n=e.callbackNode;kt(e,t);var r=Dt(e,e===qc?Yc:0);if(r===0)n!==null&&st(n),e.callbackNode=null,e.callbackPriority=0;else if(t=r&-r,e.callbackPriority!==t){if(n!=null&&st(n),t===1)e.tag===0?aa(Dl.bind(null,e)):ia(Dl.bind(null,e)),Ci(function(){!(Kc&6)&&oa()}),n=null;else{switch(Lt(r)){case 1:n=ft;break;case 4:n=pt;break;case 16:n=mt;break;case 536870912:n=gt;break;default:n=mt}n=Xl(n,Sl.bind(null,e))}e.callbackPriority=t,e.callbackNode=n}}function Sl(e,t){if(gl=-1,_l=0,Kc&6)throw Error(r(327));var n=e.callbackNode;if(Hl()&&e.callbackNode!==n)return null;var i=Dt(e,e===qc?Yc:0);if(i===0)return null;if(i&30||(i&e.expiredLanes)!==0||t)t=Fl(e,i);else{t=i;var a=Kc;Kc|=2;var o=Nl();(qc!==e||Yc!==t)&&(sl=null,ol=ut()+500,jl(e,t));do try{Ll();break}catch(t){Ml(e,t)}while(1);Wa(),Uc.current=o,Kc=a,Jc===null?(qc=null,Yc=0,t=Qc):t=0}if(t!==0){if(t===2&&(a=At(e),a!==0&&(i=a,t=Cl(e,a))),t===1)throw n=$c,jl(e,0),El(e,i),xl(e,ut()),n;if(t===6)El(e,i);else{if(a=e.current.alternate,!(i&30)&&!Tl(a)&&(t=Fl(e,i),t===2&&(o=At(e),o!==0&&(i=o,t=Cl(e,o))),t===1))throw n=$c,jl(e,0),El(e,i),xl(e,ut()),n;switch(e.finishedWork=a,e.finishedLanes=i,t){case 0:case 1:throw Error(r(345));case 2:Bl(e,il,sl);break;case 3:if(El(e,i),(i&130023424)===i&&(t=al+500-ut(),10<t)){if(Dt(e,0)!==0)break;if(a=e.suspendedLanes,(a&i)!==i){vl(),e.pingedLanes|=e.suspendedLanes&a;break}e.timeoutHandle=bi(Bl.bind(null,e,il,sl),t);break}Bl(e,il,sl);break;case 4:if(El(e,i),(i&4194240)===i)break;for(t=e.eventTimes,a=-1;0<i;){var s=31-bt(i);o=1<<s,s=t[s],s>a&&(a=s),i&=~o}if(i=a,i=ut()-i,i=(120>i?120:480>i?480:1080>i?1080:1920>i?1920:3e3>i?3e3:4320>i?4320:1960*Hc(i/1960))-i,10<i){e.timeoutHandle=bi(Bl.bind(null,e,il,sl),i);break}Bl(e,il,sl);break;case 5:Bl(e,il,sl);break;default:throw Error(r(329))}}}return xl(e,ut()),e.callbackNode===n?Sl.bind(null,e):null}function Cl(e,t){var n=rl;return e.current.memoizedState.isDehydrated&&(jl(e,t).flags|=256),e=Fl(e,t),e!==2&&(t=il,il=n,t!==null&&wl(t)),e}function wl(e){il===null?il=e:il.push.apply(il,e)}function Tl(e){for(var t=e;;){if(t.flags&16384){var n=t.updateQueue;if(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 El(e,t){for(t&=~nl,t&=~tl,e.suspendedLanes|=t,e.pingedLanes&=~t,e=e.expirationTimes;0<t;){var n=31-bt(t),r=1<<n;e[n]=-1,t&=~r}}function Dl(e){if(Kc&6)throw Error(r(327));Hl();var t=Dt(e,0);if(!(t&1))return xl(e,ut()),null;var n=Fl(e,t);if(e.tag!==0&&n===2){var i=At(e);i!==0&&(t=i,n=Cl(e,i))}if(n===1)throw n=$c,jl(e,0),El(e,t),xl(e,ut()),n;if(n===6)throw Error(r(345));return e.finishedWork=e.current.alternate,e.finishedLanes=t,Bl(e,il,sl),xl(e,ut()),null}function Ol(e,t){var n=Kc;Kc|=1;try{return e(t)}finally{Kc=n,Kc===0&&(ol=ut()+500,na&&oa())}}function kl(e){fl!==null&&fl.tag===0&&!(Kc&6)&&Hl();var t=Kc;Kc|=1;var n=Gc.transition,r=It;try{if(Gc.transition=null,It=1,e)return e()}finally{It=r,Gc.transition=n,Kc=t,!(Kc&6)&&oa()}}function Al(){Xc=Zc.current,Hi(Zc)}function jl(e,t){e.finishedWork=null,e.finishedLanes=0;var n=e.timeoutHandle;if(n!==-1&&(e.timeoutHandle=-1,xi(n)),Jc!==null)for(n=Jc.return;n!==null;){var r=n;switch(ya(r),r.tag){case 1:r=r.type.childContextTypes,r!=null&&Xi();break;case 3:ho(),Hi(Ki),Hi(Gi),xo();break;case 5:_o(r);break;case 4:ho();break;case 13:Hi(vo);break;case 19:Hi(vo);break;case 10:Ga(r.type._context);break;case 22:case 23:Al()}n=n.return}if(qc=e,Jc=e=tu(e.current,null),Yc=Xc=t,Qc=0,$c=null,nl=tl=el=0,il=rl=null,Ya!==null){for(t=0;t<Ya.length;t++)if(n=Ya[t],r=n.interleaved,r!==null){n.interleaved=null;var i=r.next,a=n.pending;if(a!==null){var o=a.next;a.next=i,r.next=o}n.pending=r}Ya=null}return e}function Ml(e,t){do{var n=Jc;try{if(Wa(),So.current=gs,Oo){for(var i=To.memoizedState;i!==null;){var a=i.queue;a!==null&&(a.pending=null),i=i.next}Oo=!1}if(wo=0,Do=Eo=To=null,ko=!1,Ao=0,Wc.current=null,n===null||n.return===null){Qc=1,$c=t,Jc=null;break}a:{var o=e,s=n.return,c=n,l=t;if(t=Yc,c.flags|=32768,typeof l==`object`&&l&&typeof l.then==`function`){var u=l,d=c,f=d.tag;if(!(d.mode&1)&&(f===0||f===11||f===15)){var p=d.alternate;p?(d.updateQueue=p.updateQueue,d.memoizedState=p.memoizedState,d.lanes=p.lanes):(d.updateQueue=null,d.memoizedState=null)}var m=Ps(s);if(m!==null){m.flags&=-257,Fs(m,s,c,o,t),m.mode&1&&Ns(o,u,t),t=m,l=u;var h=t.updateQueue;if(h===null){var g=new Set;g.add(l),t.updateQueue=g}else h.add(l);break a}else{if(!(t&1)){Ns(o,u,t),Pl();break a}l=Error(r(426))}}else if(Sa&&c.mode&1){var _=Ps(s);if(_!==null){!(_.flags&65536)&&(_.flags|=256),Fs(_,s,c,o,t),Ma(Ds(l,c));break a}}o=l=Ds(l,c),Qc!==4&&(Qc=2),rl===null?rl=[o]:rl.push(o),o=s;do{switch(o.tag){case 3:o.flags|=65536,t&=-t,o.lanes|=t;var v=js(o,l,t);ao(o,v);break a;case 1:c=l;var y=o.type,b=o.stateNode;if(!(o.flags&128)&&(typeof y.getDerivedStateFromError==`function`||b!==null&&typeof b.componentDidCatch==`function`&&(ul===null||!ul.has(b)))){o.flags|=65536,t&=-t,o.lanes|=t;var x=Ms(o,c,t);ao(o,x);break a}}o=o.return}while(o!==null)}zl(n)}catch(e){t=e,Jc===n&&n!==null&&(Jc=n=n.return);continue}break}while(1)}function Nl(){var e=Uc.current;return Uc.current=gs,e===null?gs:e}function Pl(){(Qc===0||Qc===3||Qc===2)&&(Qc=4),qc===null||!(el&268435455)&&!(tl&268435455)||El(qc,Yc)}function Fl(e,t){var n=Kc;Kc|=2;var i=Nl();(qc!==e||Yc!==t)&&(sl=null,jl(e,t));do try{Il();break}catch(t){Ml(e,t)}while(1);if(Wa(),Kc=n,Uc.current=i,Jc!==null)throw Error(r(261));return qc=null,Yc=0,Qc}function Il(){for(;Jc!==null;)Rl(Jc)}function Ll(){for(;Jc!==null&&!ct();)Rl(Jc)}function Rl(e){var t=Yl(e.alternate,e,Xc);e.memoizedProps=e.pendingProps,t===null?zl(e):Jc=t,Wc.current=null}function zl(e){var t=e;do{var n=t.alternate;if(e=t.return,t.flags&32768){if(n=pc(n,t),n!==null){n.flags&=32767,Jc=n;return}if(e!==null)e.flags|=32768,e.subtreeFlags=0,e.deletions=null;else{Qc=6,Jc=null;return}}else if(n=fc(n,t,Xc),n!==null){Jc=n;return}if(t=t.sibling,t!==null){Jc=t;return}Jc=t=e}while(t!==null);Qc===0&&(Qc=5)}function Bl(e,t,n){var r=It,i=Gc.transition;try{Gc.transition=null,It=1,Vl(e,t,n,r)}finally{Gc.transition=i,It=r}return null}function Vl(e,t,n,i){do Hl();while(fl!==null);if(Kc&6)throw Error(r(327));n=e.finishedWork;var a=e.finishedLanes;if(n===null)return null;if(e.finishedWork=null,e.finishedLanes=0,n===e.current)throw Error(r(177));e.callbackNode=null,e.callbackPriority=0;var o=n.lanes|n.childLanes;if(Pt(e,o),e===qc&&(Jc=qc=null,Yc=0),!(n.subtreeFlags&2064)&&!(n.flags&2064)||dl||(dl=!0,Xl(mt,function(){return Hl(),null})),o=(n.flags&15990)!=0,n.subtreeFlags&15990||o){o=Gc.transition,Gc.transition=null;var s=It;It=1;var c=Kc;Kc|=4,Wc.current=null,bc(e,n),Fc(n,e),jr(vi),ln=!!_i,vi=_i=null,e.current=n,Lc(n,e,a),lt(),Kc=c,It=s,Gc.transition=o}else e.current=n;if(dl&&(dl=!1,fl=e,pl=a),o=e.pendingLanes,o===0&&(ul=null),yt(n.stateNode,i),xl(e,ut()),t!==null)for(i=e.onRecoverableError,n=0;n<t.length;n++)a=t[n],i(a.value,{componentStack:a.stack,digest:a.digest});if(cl)throw cl=!1,e=ll,ll=null,e;return pl&1&&e.tag!==0&&Hl(),o=e.pendingLanes,o&1?e===hl?ml++:(ml=0,hl=e):ml=0,oa(),null}function Hl(){if(fl!==null){var e=Lt(pl),t=Gc.transition,n=It;try{if(Gc.transition=null,It=16>e?16:e,fl===null)var i=!1;else{if(e=fl,fl=null,pl=0,Kc&6)throw Error(r(331));var a=Kc;for(Kc|=4,q=e.current;q!==null;){var o=q,s=o.child;if(q.flags&16){var c=o.deletions;if(c!==null){for(var l=0;l<c.length;l++){var u=c[l];for(q=u;q!==null;){var d=q;switch(d.tag){case 0:case 11:case 15:xc(8,d,o)}var f=d.child;if(f!==null)f.return=d,q=f;else for(;q!==null;){d=q;var p=d.sibling,m=d.return;if(wc(d),d===u){q=null;break}if(p!==null){p.return=m,q=p;break}q=m}}}var h=o.alternate;if(h!==null){var g=h.child;if(g!==null){h.child=null;do{var _=g.sibling;g.sibling=null,g=_}while(g!==null)}}q=o}}if(o.subtreeFlags&2064&&s!==null)s.return=o,q=s;else b:for(;q!==null;){if(o=q,o.flags&2048)switch(o.tag){case 0:case 11:case 15:xc(9,o,o.return)}var v=o.sibling;if(v!==null){v.return=o.return,q=v;break b}q=o.return}}var y=e.current;for(q=y;q!==null;){s=q;var b=s.child;if(s.subtreeFlags&2064&&b!==null)b.return=s,q=b;else b:for(s=y;q!==null;){if(c=q,c.flags&2048)try{switch(c.tag){case 0:case 11:case 15:Sc(9,c)}}catch(e){Wl(c,c.return,e)}if(c===s){q=null;break b}var x=c.sibling;if(x!==null){x.return=c.return,q=x;break b}q=c.return}}if(Kc=a,oa(),vt&&typeof vt.onPostCommitFiberRoot==`function`)try{vt.onPostCommitFiberRoot(_t,e)}catch{}i=!0}return i}finally{It=n,Gc.transition=t}}return!1}function Ul(e,t,n){t=Ds(n,t),t=js(e,t,1),e=ro(e,t,1),t=vl(),e!==null&&(Nt(e,1,t),xl(e,t))}function Wl(e,t,n){if(e.tag===3)Ul(e,e,n);else for(;t!==null;){if(t.tag===3){Ul(t,e,n);break}else if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError==`function`||typeof r.componentDidCatch==`function`&&(ul===null||!ul.has(r))){e=Ds(n,e),e=Ms(t,e,1),t=ro(t,e,1),e=vl(),t!==null&&(Nt(t,1,e),xl(t,e));break}}t=t.return}}function Gl(e,t,n){var r=e.pingCache;r!==null&&r.delete(t),t=vl(),e.pingedLanes|=e.suspendedLanes&n,qc===e&&(Yc&n)===n&&(Qc===4||Qc===3&&(Yc&130023424)===Yc&&500>ut()-al?jl(e,0):nl|=n),xl(e,t)}function Kl(e,t){t===0&&(e.mode&1?(t=Tt,Tt<<=1,!(Tt&130023424)&&(Tt=4194304)):t=1);var n=vl();e=Qa(e,t),e!==null&&(Nt(e,t,n),xl(e,n))}function ql(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),Kl(e,n)}function Jl(e,t){var n=0;switch(e.tag){case 13:var i=e.stateNode,a=e.memoizedState;a!==null&&(n=a.retryLane);break;case 19:i=e.stateNode;break;default:throw Error(r(314))}i!==null&&i.delete(t),Kl(e,n)}var Yl=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||Ki.current)Ls=!0;else{if((e.lanes&n)===0&&!(t.flags&128))return Ls=!1,oc(e,t,n);Ls=!!(e.flags&131072)}else Ls=!1,Sa&&t.flags&1048576&&_a(t,ua,t.index);switch(t.lanes=0,t.tag){case 2:var i=t.type;ic(e,t),e=t.pendingProps;var a=Ji(t,Gi.current);qa(t,n),a=Po(null,t,i,e,a,n);var o=Fo();return t.flags|=1,typeof a==`object`&&a&&typeof a.render==`function`&&a.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,Yi(i)?(o=!0,$i(t)):o=!1,t.memoizedState=a.state!==null&&a.state!==void 0?a.state:null,eo(t),a.updater=Ss,t.stateNode=a,a._reactInternals=t,Es(t,i,e,n),t=Ks(null,t,i,!0,o,n)):(t.tag=0,Sa&&o&&va(t),Rs(null,t,a,n),t=t.child),t;case 16:i=t.elementType;a:{switch(ic(e,t),e=t.pendingProps,a=i._init,i=a(i._payload),t.type=i,a=t.tag=eu(i),e=bs(i,e),a){case 0:t=Ws(null,t,i,e,n);break a;case 1:t=Gs(null,t,i,e,n);break a;case 11:t=zs(null,t,i,e,n);break a;case 14:t=Bs(null,t,i,bs(i.type,e),n);break a}throw Error(r(306,i,``))}return t;case 0:return i=t.type,a=t.pendingProps,a=t.elementType===i?a:bs(i,a),Ws(e,t,i,a,n);case 1:return i=t.type,a=t.pendingProps,a=t.elementType===i?a:bs(i,a),Gs(e,t,i,a,n);case 3:a:{if(qs(t),e===null)throw Error(r(387));i=t.pendingProps,o=t.memoizedState,a=o.element,to(e,t),oo(t,i,null,n);var s=t.memoizedState;if(i=s.element,o.isDehydrated)if(o={element:i,isDehydrated:!1,cache:s.cache,pendingSuspenseBoundaries:s.pendingSuspenseBoundaries,transitions:s.transitions},t.updateQueue.baseState=o,t.memoizedState=o,t.flags&256){a=Ds(Error(r(423)),t),t=Js(e,t,i,n,a);break a}else if(i!==a){a=Ds(Error(r(424)),t),t=Js(e,t,i,n,a);break a}else for(xa=Ei(t.stateNode.containerInfo.firstChild),ba=t,Sa=!0,Ca=null,n=za(t,null,i,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(ja(),i===a){t=ac(e,t,n);break a}Rs(e,t,i,n)}t=t.child}return t;case 5:return go(t),e===null&&Da(t),i=t.type,a=t.pendingProps,o=e===null?null:e.memoizedProps,s=a.children,yi(i,a)?s=null:o!==null&&yi(i,o)&&(t.flags|=32),Us(e,t),Rs(e,t,s,n),t.child;case 6:return e===null&&Da(t),null;case 13:return Zs(e,t,n);case 4:return mo(t,t.stateNode.containerInfo),i=t.pendingProps,e===null?t.child=Ra(t,null,i,n):Rs(e,t,i,n),t.child;case 11:return i=t.type,a=t.pendingProps,a=t.elementType===i?a:bs(i,a),zs(e,t,i,a,n);case 7:return Rs(e,t,t.pendingProps,n),t.child;case 8:return Rs(e,t,t.pendingProps.children,n),t.child;case 12:return Rs(e,t,t.pendingProps.children,n),t.child;case 10:a:{if(i=t.type._context,a=t.pendingProps,o=t.memoizedProps,s=a.value,Ui(Ba,i._currentValue),i._currentValue=s,o!==null)if(wr(o.value,s)){if(o.children===a.children&&!Ki.current){t=ac(e,t,n);break a}}else for(o=t.child,o!==null&&(o.return=t);o!==null;){var c=o.dependencies;if(c!==null){s=o.child;for(var l=c.firstContext;l!==null;){if(l.context===i){if(o.tag===1){l=no(-1,n&-n),l.tag=2;var u=o.updateQueue;if(u!==null){u=u.shared;var d=u.pending;d===null?l.next=l:(l.next=d.next,d.next=l),u.pending=l}}o.lanes|=n,l=o.alternate,l!==null&&(l.lanes|=n),Ka(o.return,n,t),c.lanes|=n;break}l=l.next}}else if(o.tag===10)s=o.type===t.type?null:o.child;else if(o.tag===18){if(s=o.return,s===null)throw Error(r(341));s.lanes|=n,c=s.alternate,c!==null&&(c.lanes|=n),Ka(s,n,t),s=o.sibling}else s=o.child;if(s!==null)s.return=o;else for(s=o;s!==null;){if(s===t){s=null;break}if(o=s.sibling,o!==null){o.return=s.return,s=o;break}s=s.return}o=s}Rs(e,t,a.children,n),t=t.child}return t;case 9:return a=t.type,i=t.pendingProps.children,qa(t,n),a=Ja(a),i=i(a),t.flags|=1,Rs(e,t,i,n),t.child;case 14:return i=t.type,a=bs(i,t.pendingProps),a=bs(i.type,a),Bs(e,t,i,a,n);case 15:return Vs(e,t,t.type,t.pendingProps,n);case 17:return i=t.type,a=t.pendingProps,a=t.elementType===i?a:bs(i,a),ic(e,t),t.tag=1,Yi(i)?(e=!0,$i(t)):e=!1,qa(t,n),ws(t,i,a),Es(t,i,a,n),Ks(null,t,i,!0,e,n);case 19:return rc(e,t,n);case 22:return Hs(e,t,n)}throw Error(r(156,t.tag))};function Xl(e,t){return ot(e,t)}function Zl(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.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 Ql(e,t,n,r){return new Zl(e,t,n,r)}function $l(e){return e=e.prototype,!(!e||!e.isReactComponent)}function eu(e){if(typeof e==`function`)return+!!$l(e);if(e!=null){if(e=e.$$typeof,e===j)return 11;if(e===P)return 14}return 2}function tu(e,t){var n=e.alternate;return n===null?(n=Ql(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&14680064,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}function nu(e,t,n,i,a,o){var s=2;if(i=e,typeof e==`function`)$l(e)&&(s=1);else if(typeof e==`string`)s=5;else a:switch(e){case E:return ru(n.children,a,o,t);case D:s=8,a|=8;break;case O:return e=Ql(12,n,t,a|2),e.elementType=O,e.lanes=o,e;case M:return e=Ql(13,n,t,a),e.elementType=M,e.lanes=o,e;case N:return e=Ql(19,n,t,a),e.elementType=N,e.lanes=o,e;case I:return iu(n,a,o,t);default:if(typeof e==`object`&&e)switch(e.$$typeof){case k:s=10;break a;case A:s=9;break a;case j:s=11;break a;case P:s=14;break a;case F:s=16,i=null;break a}throw Error(r(130,e==null?e:typeof e,``))}return t=Ql(s,n,t,a),t.elementType=e,t.type=i,t.lanes=o,t}function ru(e,t,n,r){return e=Ql(7,e,r,t),e.lanes=n,e}function iu(e,t,n,r){return e=Ql(22,e,r,t),e.elementType=I,e.lanes=n,e.stateNode={isHidden:!1},e}function au(e,t,n){return e=Ql(6,e,null,t),e.lanes=n,e}function ou(e,t,n){return t=Ql(4,e.children===null?[]:e.children,e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function su(e,t,n,r,i){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Mt(0),this.expirationTimes=Mt(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Mt(0),this.identifierPrefix=r,this.onRecoverableError=i,this.mutableSourceEagerHydrationData=null}function cu(e,t,n,r,i,a,o,s,c){return e=new su(e,t,n,s,c),t===1?(t=1,!0===a&&(t|=8)):t=0,a=Ql(3,null,null,t),e.current=a,a.stateNode=e,a.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},eo(a),e}function lu(e,t,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:T,key:r==null?null:``+r,children:e,containerInfo:t,implementation:n}}function uu(e){if(!e)return Wi;e=e._reactInternals;a:{if(et(e)!==e||e.tag!==1)throw Error(r(170));var t=e;do{switch(t.tag){case 3:t=t.stateNode.context;break a;case 1:if(Yi(t.type)){t=t.stateNode.__reactInternalMemoizedMergedChildContext;break a}}t=t.return}while(t!==null);throw Error(r(171))}if(e.tag===1){var n=e.type;if(Yi(n))return Qi(e,n,t)}return t}function du(e,t,n,r,i,a,o,s,c){return e=cu(n,r,!0,e,i,a,o,s,c),e.context=uu(null),n=e.current,r=vl(),i=yl(n),a=no(r,i),a.callback=t??null,ro(n,a,i),e.current.lanes=i,Nt(e,i,r),xl(e,r),e}function fu(e,t,n,r){var i=t.current,a=vl(),o=yl(i);return n=uu(n),t.context===null?t.context=n:t.pendingContext=n,t=no(a,o),t.payload={element:e},r=r===void 0?null:r,r!==null&&(t.callback=r),e=ro(i,t,o),e!==null&&(bl(e,i,o,a),io(e,i,o)),o}function pu(e){if(e=e.current,!e.child)return null;switch(e.child.tag){case 5:return e.child.stateNode;default:return e.child.stateNode}}function mu(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function hu(e,t){mu(e,t),(e=e.alternate)&&mu(e,t)}function gu(){return null}var _u=typeof reportError==`function`?reportError:function(e){console.error(e)};function vu(e){this._internalRoot=e}yu.prototype.render=vu.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(r(409));fu(e,t,null,null)},yu.prototype.unmount=vu.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;kl(function(){fu(null,e,null,null)}),t[ji]=null}};function yu(e){this._internalRoot=e}yu.prototype.unstable_scheduleHydration=function(e){if(e){var t=Vt();e={blockedOn:null,target:e,priority:t};for(var n=0;n<Xt.length&&t!==0&&t<Xt[n].priority;n++);Xt.splice(n,0,e),n===0&&tn(e)}};function bu(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function xu(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11&&(e.nodeType!==8||e.nodeValue!==` react-mount-point-unstable `))}function Su(){}function Cu(e,t,n,r,i){if(i){if(typeof r==`function`){var a=r;r=function(){var e=pu(o);a.call(e)}}var o=du(t,r,e,0,null,!1,!1,``,Su);return e._reactRootContainer=o,e[ji]=o.current,ai(e.nodeType===8?e.parentNode:e),kl(),o}for(;i=e.lastChild;)e.removeChild(i);if(typeof r==`function`){var s=r;r=function(){var e=pu(c);s.call(e)}}var c=cu(e,0,!1,null,null,!1,!1,``,Su);return e._reactRootContainer=c,e[ji]=c.current,ai(e.nodeType===8?e.parentNode:e),kl(function(){fu(t,c,n,r)}),c}function wu(e,t,n,r,i){var a=n._reactRootContainer;if(a){var o=a;if(typeof i==`function`){var s=i;i=function(){var e=pu(o);s.call(e)}}fu(t,o,e,i)}else o=Cu(n,t,e,i,r);return pu(o)}Rt=function(e){switch(e.tag){case 3:var t=e.stateNode;if(t.current.memoizedState.isDehydrated){var n=Et(t.pendingLanes);n!==0&&(Ft(t,n|1),xl(t,ut()),!(Kc&6)&&(ol=ut()+500,oa()))}break;case 13:kl(function(){var t=Qa(e,1);t!==null&&bl(t,e,1,vl())}),hu(e,1)}},zt=function(e){if(e.tag===13){var t=Qa(e,134217728);t!==null&&bl(t,e,134217728,vl()),hu(e,134217728)}},Bt=function(e){if(e.tag===13){var t=yl(e),n=Qa(e,t);n!==null&&bl(n,e,t,vl()),hu(e,t)}},Vt=function(){return It},Ht=function(e,t){var n=It;try{return It=e,t()}finally{It=n}},Pe=function(e,t,n){switch(t){case`input`:if(de(e,n),t=n.name,n.type===`radio`&&t!=null){for(n=e;n.parentNode;)n=n.parentNode;for(n=n.querySelectorAll(`input[name=`+JSON.stringify(``+t)+`][type="radio"]`),t=0;t<n.length;t++){var i=n[t];if(i!==e&&i.form===e.form){var a=Ri(i);if(!a)throw Error(r(90));oe(i),de(i,a)}}}break;case`textarea`:ve(e,n);break;case`select`:t=n.value,t!=null&&he(e,!!n.multiple,t,!1)}},Be=Ol,Ve=kl;var Tu={usingClientEntryPoint:!1,Events:[Ii,Li,Ri,Re,ze,Ol]},Eu={findFiberByHostInstance:Fi,bundleType:0,version:`18.3.1`,rendererPackageName:`react-dom`},Du={bundleType:Eu.bundleType,version:Eu.version,rendererPackageName:Eu.rendererPackageName,rendererConfig:Eu.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:C.ReactCurrentDispatcher,findHostInstanceByFiber:function(e){return e=it(e),e===null?null:e.stateNode},findFiberByHostInstance:Eu.findFiberByHostInstance||gu,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:`18.3.1-next-f1338f8080-20240426`};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<`u`){var Ou=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Ou.isDisabled&&Ou.supportsFiber)try{_t=Ou.inject(Du),vt=Ou}catch{}}e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=Tu,e.createPortal=function(e,t){var n=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!bu(t))throw Error(r(200));return lu(e,t,null,n)},e.createRoot=function(e,t){if(!bu(e))throw Error(r(299));var n=!1,i=``,a=_u;return t!=null&&(!0===t.unstable_strictMode&&(n=!0),t.identifierPrefix!==void 0&&(i=t.identifierPrefix),t.onRecoverableError!==void 0&&(a=t.onRecoverableError)),t=cu(e,1,!1,null,null,n,!1,i,a),e[ji]=t.current,ai(e.nodeType===8?e.parentNode:e),new vu(t)},e.findDOMNode=function(e){if(e==null)return null;if(e.nodeType===1)return e;var t=e._reactInternals;if(t===void 0)throw typeof e.render==`function`?Error(r(188)):(e=Object.keys(e).join(`,`),Error(r(268,e)));return e=it(t),e=e===null?null:e.stateNode,e},e.flushSync=function(e){return kl(e)},e.hydrate=function(e,t,n){if(!xu(t))throw Error(r(200));return wu(null,e,t,!0,n)},e.hydrateRoot=function(e,t,n){if(!bu(e))throw Error(r(405));var i=n!=null&&n.hydratedSources||null,a=!1,o=``,s=_u;if(n!=null&&(!0===n.unstable_strictMode&&(a=!0),n.identifierPrefix!==void 0&&(o=n.identifierPrefix),n.onRecoverableError!==void 0&&(s=n.onRecoverableError)),t=du(t,null,e,1,n??null,a,!1,o,s),e[ji]=t.current,ai(e),i)for(e=0;e<i.length;e++)n=i[e],a=n._getVersion,a=a(n._source),t.mutableSourceEagerHydrationData==null?t.mutableSourceEagerHydrationData=[n,a]:t.mutableSourceEagerHydrationData.push(n,a);return new yu(t)},e.render=function(e,t,n){if(!xu(t))throw Error(r(200));return wu(null,e,t,!1,n)},e.unmountComponentAtNode=function(e){if(!xu(e))throw Error(r(40));return e._reactRootContainer?(kl(function(){wu(null,null,e,!1,function(){e._reactRootContainer=null,e[ji]=null})}),!0):!1},e.unstable_batchedUpdates=Ol,e.unstable_renderSubtreeIntoContainer=function(e,t,n,i){if(!xu(n))throw Error(r(200));if(e==null||e._reactInternals===void 0)throw Error(r(38));return wu(e,t,n,!1,i)},e.version=`18.3.1-next-f1338f8080-20240426`})),_=s(((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=g()})),v=s((e=>{var t=_();e.createRoot=t.createRoot,e.hydrateRoot=t.hydrateRoot})),y=e=>{let t,n=new Set,r=(e,r)=>{let i=typeof e==`function`?e(t):e;if(!Object.is(i,t)){let e=t;t=r??(typeof i!=`object`||!i)?i:Object.assign({},t,i),n.forEach(n=>n(t,e))}},i=()=>t,a={setState:r,getState:i,getInitialState:()=>o,subscribe:e=>(n.add(e),()=>n.delete(e))},o=t=e(r,i,a);return a},b=(e=>e?y(e):y),x=u(p(),1),S=e=>e;function C(e,t=S){let n=x.useSyncExternalStore(e.subscribe,x.useCallback(()=>t(e.getState()),[e,t]),x.useCallback(()=>t(e.getInitialState()),[e,t]));return x.useDebugValue(n),n}var w=e=>{let t=b(e),n=e=>C(t,e);return Object.assign(n,t),n},T=(e=>e?w(e):w),E=v();function D(e,t){let n;try{n=e()}catch{return}return{getItem:e=>{let r=e=>e===null?null:JSON.parse(e,t?.reviver),i=n.getItem(e)??null;return i instanceof Promise?i.then(r):r(i)},setItem:(e,r)=>n.setItem(e,JSON.stringify(r,t?.replacer)),removeItem:e=>n.removeItem(e)}}var O=e=>t=>{try{let n=e(t);return n instanceof Promise?n:{then(e){return O(e)(n)},catch(e){return this}}}catch(e){return{then(e){return this},catch(t){return O(t)(e)}}}},k=(e,t)=>(n,r,i)=>{let a={storage:D(()=>localStorage),partialize:e=>e,version:0,merge:(e,t)=>({...t,...e}),...t},o=!1,s=new Set,c=new Set,l=a.storage;if(!l)return e((...e)=>{console.warn(`[zustand persist middleware] Unable to update item '${a.name}', the given storage is currently unavailable.`),n(...e)},r,i);let u=()=>{let e=a.partialize({...r()});return l.setItem(a.name,{state:e,version:a.version})},d=i.setState;i.setState=(e,t)=>(d(e,t),u());let f=e((...e)=>(n(...e),u()),r,i);i.getInitialState=()=>f;let p,m=()=>{if(!l)return;o=!1,s.forEach(e=>e(r()??f));let e=a.onRehydrateStorage?.call(a,r()??f)||void 0;return O(l.getItem.bind(l))(a.name).then(e=>{if(e)if(typeof e.version==`number`&&e.version!==a.version){if(a.migrate){let t=a.migrate(e.state,e.version);return t instanceof Promise?t.then(e=>[!0,e]):[!0,t]}console.error(`State loaded from storage couldn't be migrated since no migrate function was provided`)}else return[!1,e.state];return[!1,void 0]}).then(e=>{let[t,i]=e;if(p=a.merge(i,r()??f),n(p,!0),t)return u()}).then(()=>{e?.(p,void 0),p=r(),o=!0,c.forEach(e=>e(p))}).catch(t=>{e?.(void 0,t)})};return i.persist={setOptions:e=>{a={...a,...e},e.storage&&(l=e.storage)},clearStorage:()=>{l?.removeItem(a.name)},getOptions:()=>a,rehydrate:()=>m(),hasHydrated:()=>o,onHydrate:e=>(s.add(e),()=>{s.delete(e)}),onFinishHydration:e=>(c.add(e),()=>{c.delete(e)})},a.skipHydration||m(),p||f};function A(){let e=new Map;return{getItem:t=>e.get(t)??null,setItem:(t,n)=>{e.set(t,n)},removeItem:t=>{e.delete(t)}}}var j=A(),M={getItem:e=>{if(typeof localStorage>`u`)return j.getItem(e);try{return localStorage.getItem(e)}catch{return j.getItem(e)}},setItem:(e,t)=>{if(typeof localStorage>`u`){j.setItem(e,t);return}try{localStorage.setItem(e,t)}catch{j.setItem(e,t)}},removeItem:e=>{if(typeof localStorage>`u`){j.removeItem(e);return}try{localStorage.removeItem(e)}catch{j.removeItem(e)}}};function N(e){let t=new Map,n=!1,r=t=>{let n={BASE_URL:`/`,DEV:!1,MODE:`production`,PROD:!0,SSR:!1},r=globalThis.Bun?.main??``,i=/\.test\.[cm]?[jt]sx?$/.test(r);if((typeof n?.DEV==`boolean`?n.DEV:i)&&t!==e)throw Error(`createTabStorage("${e}") received unexpected key "${t}". Create a dedicated tab storage instance per persist key.`)};return{getItem(e){if(r(e),n)return t.get(e)??null;n=!0;let i=M.getItem(e);return i!==null&&t.set(e,i),i},setItem(e,n){r(e),t.set(e,n),M.setItem(e,n)},removeItem(e){r(e),t.delete(e),M.removeItem(e)}}}var P=`~/Documents/GitHub`,F=`claude`,I=!(typeof navigator<`u`&&/^((?!chrome|android).)*safari/i.test(navigator.userAgent)&&!/iPhone|iPad|iPod/.test(navigator.userAgent)&&(typeof devicePixelRatio<`u`?devicePixelRatio:1)>1),L=[{id:`jetbrains-mono`,label:`JetBrains Mono`,family:`"JetBrains Mono Variable", "JetBrains Mono", "SF Mono", "Fira Code", ui-monospace, monospace`},{id:`system`,label:`System Default`,family:`ui-monospace, "SF Mono", Menlo, Monaco, "Cascadia Code", "Consolas", monospace`},{id:`custom`,label:`Custom`,family:``}];function R(e,t){return e===`custom`&&t.trim()?t.trim():L.find(t=>t.id===e)?.family||L[0].family}var z=[{id:`claude`,label:`Claude`,command:`claude`,isBuiltIn:!0,agentType:`claude`},{id:`codex`,label:`Codex`,command:`codex`,isBuiltIn:!0,agentType:`codex`},{id:`pi`,label:`Pi`,command:`pi`,isBuiltIn:!0,agentType:`pi`},{id:`grok`,label:`Grok`,command:`grok`,isBuiltIn:!0,agentType:`grok`},{id:`devin`,label:`Devin`,command:`devin`,isBuiltIn:!0,agentType:`devin`},{id:`omp`,label:`OMP`,command:`omp`,isBuiltIn:!0,agentType:`omp`}];function B(e){if(typeof e!=`object`||!e)return!1;let t=e;return typeof t.id==`string`&&t.id.length>=1&&t.id.length<=128&&typeof t.label==`string`&&t.label.trim().length>=1&&t.label.length<=64&&typeof t.command==`string`&&t.command.trim().length>=1&&t.command.length<=1024&&typeof t.isBuiltIn==`boolean`&&(t.agentType===void 0||t.agentType===`claude`||t.agentType===`codex`||t.agentType===`pi`||t.agentType===`devin`||t.agentType===`grok`||t.agentType===`omp`||t.agentType===`claude-rp`)}function V(e){return{...e,label:e.label.trim().slice(0,64),command:e.command.trim().slice(0,1024)}}function ee(e){return e.command.trim()}function H(e){for(let t=0;t<100;t++){let t=`custom-${Date.now()}-${Math.random().toString(36).slice(2,6)}`;if(!e.has(t))return t}return`custom-${Date.now()}-${Math.random().toString(36).slice(2)}`}function te(e,t){return e.some(e=>e.id===t)?t:e[0]?.id||`claude`}var U=T()(k((e,t)=>({defaultProjectDir:P,setDefaultProjectDir:t=>e({defaultProjectDir:t}),defaultCommand:F,setDefaultCommand:t=>e({defaultCommand:t}),lastProjectPath:null,setLastProjectPath:t=>e({lastProjectPath:t}),recentPaths:[],addRecentPath:t=>e(e=>({recentPaths:[t,...e.recentPaths.filter(e=>e!==t)].slice(0,5)})),sessionSortMode:`created`,setSessionSortMode:t=>e({sessionSortMode:t}),sessionSortDirection:`desc`,setSessionSortDirection:t=>e({sessionSortDirection:t}),manualSessionOrder:[],setManualSessionOrder:t=>e({manualSessionOrder:t}),useWebGL:I,setUseWebGL:t=>e({useWebGL:t}),fontSize:13,setFontSize:t=>e({fontSize:Math.max(6,Math.min(24,t))}),lineHeight:1,setLineHeight:t=>e({lineHeight:Math.max(1,Math.min(2,t))}),letterSpacing:0,setLetterSpacing:t=>e({letterSpacing:Math.max(-3,Math.min(3,t))}),fontOption:`jetbrains-mono`,setFontOption:t=>e({fontOption:t}),customFontFamily:``,setCustomFontFamily:t=>e({customFontFamily:t.slice(0,256)}),shortcutModifier:`auto`,setShortcutModifier:t=>e({shortcutModifier:t}),showProjectName:!0,setShowProjectName:t=>e({showProjectName:t}),showLastUserMessage:!0,setShowLastUserMessage:t=>e({showLastUserMessage:t}),showSessionIdPrefix:!1,setShowSessionIdPrefix:t=>e({showSessionIdPrefix:t}),historySessionsExpanded:!1,setHistorySessionsExpanded:t=>e({historySessionsExpanded:t}),hibernatingSessionsExpanded:!0,setHibernatingSessionsExpanded:t=>e({hibernatingSessionsExpanded:t}),sidebarWidth:240,setSidebarWidth:t=>e({sidebarWidth:Math.max(180,Math.min(400,t))}),projectFilters:[],setProjectFilters:t=>e({projectFilters:t}),hostFilters:[],setHostFilters:t=>e({hostFilters:t}),soundOnPermission:!1,setSoundOnPermission:t=>e({soundOnPermission:t}),soundOnIdle:!1,setSoundOnIdle:t=>e({soundOnIdle:t}),yoloMode:!1,setYoloMode:t=>e({yoloMode:t}),commandPresets:z,setCommandPresets:t=>e({commandPresets:t}),defaultPresetId:`claude`,setDefaultPresetId:t=>e({defaultPresetId:t}),updatePresetCommand:(n,r)=>{let{commandPresets:i}=t();e({commandPresets:i.map(e=>e.id===n?{...e,command:r.trim().slice(0,1024)}:e)})},addPreset:n=>{let{commandPresets:r}=t();if(r.length>=50){console.warn(`[agentboard:settings] Max presets reached`);return}let i=new Set(r.map(e=>e.id)),a={...V({...n,id:``,isBuiltIn:!1}),id:H(i),isBuiltIn:!1};e({commandPresets:[...r,a]})},removePreset:n=>{let{commandPresets:r,defaultPresetId:i}=t(),a=r.find(e=>e.id===n);if(!a||a.isBuiltIn)return;let o=r.filter(e=>e.id!==n);e({commandPresets:o,defaultPresetId:n===i?te(o,i):i})}}),{name:`agentboard-settings`,storage:D(()=>M),version:8,migrate:(e,t)=>{let n=e;typeof n.historySessionsExpanded!=`boolean`&&typeof n.inactiveSessionsExpanded==`boolean`&&(n.historySessionsExpanded=n.inactiveSessionsExpanded),typeof n.hibernatingSessionsExpanded!=`boolean`&&typeof n.snoozedSessionsExpanded==`boolean`&&(n.hibernatingSessionsExpanded=n.snoozedSessionsExpanded);let r=e=>{if(typeof e.command==`string`)return e;let t=typeof e.baseCommand==`string`?e.baseCommand.trim():``,n=typeof e.modifiers==`string`?e.modifiers.trim():``,r=n?`${t} ${n}`:t;return{id:e.id,label:e.label,command:r||`claude`,isBuiltIn:e.isBuiltIn,agentType:e.agentType}};if(t===0||!Array.isArray(n.commandPresets)){let e=typeof n.defaultCommand==`string`?n.defaultCommand:`claude`,t=[...z],r=`claude`;if(e===`codex`)r=`codex`;else if(e!==`claude`){let n={id:H(new Set(t.map(e=>e.id))),label:`Migrated`,command:e,isBuiltIn:!1};t.push(n),r=n.id}return console.info(`[agentboard:settings] Migrated from v0 to v2`),{...n,commandPresets:t,defaultPresetId:r,defaultCommand:e,recentPaths:[]}}let i=n.commandPresets.map(r).filter(B);if(!(i.some(e=>e.id===`claude`)&&i.some(e=>e.id===`codex`))||i.length===0)return console.warn(`[agentboard:settings] Invalid presets, resetting to defaults`),{...n,commandPresets:z,defaultPresetId:`claude`};let a=new Set(i.map(e=>e.id)),o=z.filter(e=>e.isBuiltIn&&!a.has(e.id)),s=[...i,...o];return t<8&&console.info(`[agentboard:settings] Migrated from v${t} to v8`),{...n,commandPresets:s.map(V),defaultPresetId:te(s,n.defaultPresetId)}}}));function ne(){let[e,t]=(0,x.useState)(U.persist.hasHydrated());return(0,x.useEffect)(()=>{let e=U.persist.onFinishHydration(()=>t(!0));return U.persist.hasHydrated()&&t(!0),e},[]),e}var re=u(_());function ie({title:e,titleId:t,...n},r){return x.createElement(`svg`,Object.assign({xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,strokeWidth:1.5,stroke:`currentColor`,"aria-hidden":`true`,ref:r,"aria-labelledby":t},n),e?x.createElement(`title`,{id:t},e):null,x.createElement(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M12 9v4m0 4h.01M10.615 3.892L2.39 18.098c-.456.788-.684 1.182-.65 1.506a1 1 0 00.406.705c.263.191.718.191 1.629.191h16.45c.91 0 1.365 0 1.628-.191a1 1 0 00.407-.705c.034-.324-.195-.718-.65-1.506L13.383 3.892c-.454-.785-.681-1.178-.978-1.31a1 1 0 00-.813 0c-.296.132-.523.525-.978 1.31z`}))}var ae=x.forwardRef(ie);function W({title:e,titleId:t,...n},r){return x.createElement(`svg`,Object.assign({xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,strokeWidth:1.5,stroke:`currentColor`,"aria-hidden":`true`,ref:r,"aria-labelledby":t},n),e?x.createElement(`title`,{id:t},e):null,x.createElement(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M6 9l6 6 6-6`}))}var oe=x.forwardRef(W);function se({title:e,titleId:t,...n},r){return x.createElement(`svg`,Object.assign({xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,strokeWidth:1.5,stroke:`currentColor`,"aria-hidden":`true`,ref:r,"aria-labelledby":t},n),e?x.createElement(`title`,{id:t},e):null,x.createElement(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M9 18l6-6-6-6`}))}var ce=x.forwardRef(se);function le({title:e,titleId:t,...n},r){return x.createElement(`svg`,Object.assign({xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,strokeWidth:1.5,stroke:`currentColor`,"aria-hidden":`true`,ref:r,"aria-labelledby":t},n),e?x.createElement(`title`,{id:t},e):null,x.createElement(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M5 15c-.932 0-1.398 0-1.765-.152a2 2 0 01-1.083-1.083C2 13.398 2 12.932 2 12V5.2c0-1.12 0-1.68.218-2.108a2 2 0 01.874-.874C3.52 2 4.08 2 5.2 2H12c.932 0 1.398 0 1.765.152a2 2 0 011.083 1.083C15 3.602 15 4.068 15 5m-2.8 17h6.6c1.12 0 1.68 0 2.108-.218a2 2 0 00.874-.874C22 20.48 22 19.92 22 18.8v-6.6c0-1.12 0-1.68-.218-2.108a2 2 0 00-.874-.874C20.48 9 19.92 9 18.8 9h-6.6c-1.12 0-1.68 0-2.108.218a2 2 0 00-.874.874C9 10.52 9 11.08 9 12.2v6.6c0 1.12 0 1.68.218 2.108a2 2 0 00.874.874C10.52 22 11.08 22 12.2 22z`}))}var ue=x.forwardRef(le);function de({title:e,titleId:t,...n},r){return x.createElement(`svg`,Object.assign({xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,strokeWidth:1.5,stroke:`currentColor`,"aria-hidden":`true`,ref:r,"aria-labelledby":t},n),e?x.createElement(`title`,{id:t},e):null,x.createElement(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M20 4v1.4c0 3.36 0 5.04-.654 6.324a6 6 0 01-2.622 2.622C15.44 15 13.76 15 10.4 15H4m0 0l5-5m-5 5l5 5`}))}var fe=x.forwardRef(de);function pe({title:e,titleId:t,...n},r){return x.createElement(`svg`,Object.assign({xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,strokeWidth:1.5,stroke:`currentColor`,"aria-hidden":`true`,ref:r,"aria-labelledby":t},n),e?x.createElement(`title`,{id:t},e):null,x.createElement(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M12 13a1 1 0 100-2 1 1 0 000 2zM12 6a1 1 0 100-2 1 1 0 000 2zM12 20a1 1 0 100-2 1 1 0 000 2z`}))}var me=x.forwardRef(pe);function he({title:e,titleId:t,...n},r){return x.createElement(`svg`,Object.assign({xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,strokeWidth:1.5,stroke:`currentColor`,"aria-hidden":`true`,ref:r,"aria-labelledby":t},n),e?x.createElement(`title`,{id:t},e):null,x.createElement(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M11 4H6.8c-1.68 0-2.52 0-3.162.327a3 3 0 00-1.311 1.311C2 6.28 2 7.12 2 8.8v8.4c0 1.68 0 2.52.327 3.162a3 3 0 001.311 1.311C4.28 22 5.12 22 6.8 22h8.4c1.68 0 2.52 0 3.162-.327a3 3 0 001.311-1.311C20 19.72 20 18.88 20 17.2V13M8 16h1.675c.489 0 .733 0 .963-.055.204-.05.4-.13.579-.24.201-.123.374-.296.72-.642L21.5 5.5a2.121 2.121 0 00-3-3l-9.563 9.563c-.346.346-.519.519-.642.72a2 2 0 00-.24.579c-.055.23-.055.474-.055.963V16z`}))}var ge=x.forwardRef(he);function _e({title:e,titleId:t,...n},r){return x.createElement(`svg`,Object.assign({xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,strokeWidth:1.5,stroke:`currentColor`,"aria-hidden":`true`,ref:r,"aria-labelledby":t},n),e?x.createElement(`title`,{id:t},e):null,x.createElement(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M14 2.27V6.4c0 .56 0 .84.109 1.054a1 1 0 00.437.437c.214.11.494.11 1.054.11h4.13M16 13H8m8 4H8m2-8H8m6-7H8.8c-1.68 0-2.52 0-3.162.327a3 3 0 00-1.311 1.311C4 4.28 4 5.12 4 6.8v10.4c0 1.68 0 2.52.327 3.162a3 3 0 001.311 1.311C6.28 22 7.12 22 8.8 22h6.4c1.68 0 2.52 0 3.162-.327a3 3 0 001.311-1.311C20 19.72 20 18.88 20 17.2V8l-6-6z`}))}var ve=x.forwardRef(_e);function ye({title:e,titleId:t,...n},r){return x.createElement(`svg`,Object.assign({xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,strokeWidth:1.5,stroke:`currentColor`,"aria-hidden":`true`,ref:r,"aria-labelledby":t},n),e?x.createElement(`title`,{id:t},e):null,x.createElement(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M13 7l-1.116-2.231c-.32-.642-.481-.963-.72-1.198a2 2 0 00-.748-.462C10.1 3 9.74 3 9.022 3H5.2c-1.12 0-1.68 0-2.108.218a2 2 0 00-.874.874C2 4.52 2 5.08 2 6.2V7m0 0h15.2c1.68 0 2.52 0 3.162.327a3 3 0 011.311 1.311C22 9.28 22 10.12 22 11.8v4.4c0 1.68 0 2.52-.327 3.162a3 3 0 01-1.311 1.311C19.72 21 18.88 21 17.2 21H6.8c-1.68 0-2.52 0-3.162-.327a3 3 0 01-1.311-1.311C2 18.72 2 17.88 2 16.2V7z`}))}var be=x.forwardRef(ye);function xe({title:e,titleId:t,...n},r){return x.createElement(`svg`,Object.assign({xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,strokeWidth:1.5,stroke:`currentColor`,"aria-hidden":`true`,ref:r,"aria-labelledby":t},n),e?x.createElement(`title`,{id:t},e):null,x.createElement(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M6.9 11.444v2.778m0-2.778V4.778c0-.92.761-1.667 1.7-1.667s1.7.746 1.7 1.667m-3.4 6.666c0-.92-.761-1.666-1.7-1.666s-1.7.746-1.7 1.666v2.223C3.5 18.269 7.306 22 12 22s8.5-3.731 8.5-8.333V8.11c0-.92-.761-1.667-1.7-1.667s-1.7.747-1.7 1.667m-6.8-3.333v6.11m0-6.11V3.667C10.3 2.747 11.061 2 12 2s1.7.746 1.7 1.667v1.11m0 0v6.112m0-6.111c0-.92.761-1.667 1.7-1.667s1.7.746 1.7 1.667V8.11m0 0v2.778`}))}var Se=x.forwardRef(xe);function Ce({title:e,titleId:t,...n},r){return x.createElement(`svg`,Object.assign({xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,strokeWidth:1.5,stroke:`currentColor`,"aria-hidden":`true`,ref:r,"aria-labelledby":t},n),e?x.createElement(`title`,{id:t},e):null,x.createElement(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M4 8h16M4 16h16M8 3v18m8-18v18`}))}var we=x.forwardRef(Ce);function Te({title:e,titleId:t,...n},r){return x.createElement(`svg`,Object.assign({xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,strokeWidth:1.5,stroke:`currentColor`,"aria-hidden":`true`,ref:r,"aria-labelledby":t},n),e?x.createElement(`title`,{id:t},e):null,x.createElement(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M3 12h18M3 6h18M3 18h18`}))}var Ee=x.forwardRef(Te);function De({title:e,titleId:t,...n},r){return x.createElement(`svg`,Object.assign({xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,strokeWidth:1.5,stroke:`currentColor`,"aria-hidden":`true`,ref:r,"aria-labelledby":t},n),e?x.createElement(`title`,{id:t},e):null,x.createElement(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M22 15.844a10.424 10.424 0 01-4.306.925c-5.779 0-10.463-4.684-10.463-10.462 0-1.536.33-2.994.925-4.307A10.464 10.464 0 002 11.538C2 17.316 6.684 22 12.462 22c4.243 0 7.896-2.526 9.538-6.156z`}))}var Oe=x.forwardRef(De);function ke({title:e,titleId:t,...n},r){return x.createElement(`svg`,Object.assign({xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,strokeWidth:1.5,stroke:`currentColor`,"aria-hidden":`true`,ref:r,"aria-labelledby":t},n),e?x.createElement(`title`,{id:t},e):null,x.createElement(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M5 9l-3 3m0 0l3 3m-3-3h20M9 5l3-3m0 0l3 3m-3-3v20m3-3l-3 3m0 0l-3-3M19 9l3 3m0 0l-3 3`}))}var Ae=x.forwardRef(ke);function je({title:e,titleId:t,...n},r){return x.createElement(`svg`,Object.assign({xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,strokeWidth:1.5,stroke:`currentColor`,"aria-hidden":`true`,ref:r,"aria-labelledby":t},n),e?x.createElement(`title`,{id:t},e):null,x.createElement(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M5 4.99c0-.972 0-1.457.202-1.725a1 1 0 01.738-.395c.335-.02.74.25 1.548.788l10.515 7.01c.668.446 1.002.668 1.118.949a1 1 0 010 .766c-.116.28-.45.503-1.118.948l-10.515 7.01c-.809.54-1.213.809-1.548.789a1 1 0 01-.738-.395C5 20.467 5 19.98 5 19.01V4.99z`}))}var Me=x.forwardRef(je);function Ne({title:e,titleId:t,...n},r){return x.createElement(`svg`,Object.assign({xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,strokeWidth:1.5,stroke:`currentColor`,"aria-hidden":`true`,ref:r,"aria-labelledby":t},n),e?x.createElement(`title`,{id:t},e):null,x.createElement(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M12 5v14m-7-7h14`}))}var Pe=x.forwardRef(Ne);function Fe({title:e,titleId:t,...n},r){return x.createElement(`svg`,Object.assign({xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,strokeWidth:1.5,stroke:`currentColor`,"aria-hidden":`true`,ref:r,"aria-labelledby":t},n),e?x.createElement(`title`,{id:t},e):null,x.createElement(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M6 6h.01M6 18h.01m-.81-8h13.6c1.12 0 1.68 0 2.108-.218a2 2 0 00.874-.874C22 8.48 22 7.92 22 6.8V5.2c0-1.12 0-1.68-.218-2.108a2 2 0 00-.874-.874C20.48 2 19.92 2 18.8 2H5.2c-1.12 0-1.68 0-2.108.218a2 2 0 00-.874.874C2 3.52 2 4.08 2 5.2v1.6c0 1.12 0 1.68.218 2.108a2 2 0 00.874.874C3.52 10 4.08 10 5.2 10zm0 12h13.6c1.12 0 1.68 0 2.108-.218a2 2 0 00.874-.874C22 20.48 22 19.92 22 18.8v-1.6c0-1.12 0-1.68-.218-2.108a2 2 0 00-.874-.874C20.48 14 19.92 14 18.8 14H5.2c-1.12 0-1.68 0-2.108.218a2 2 0 00-.874.874C2 15.52 2 16.08 2 17.2v1.6c0 1.12 0 1.68.218 2.108a2 2 0 00.874.874C3.52 22 4.08 22 5.2 22z`}))}var Ie=x.forwardRef(Fe);function Le({title:e,titleId:t,...n},r){return x.createElement(`svg`,Object.assign({xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,strokeWidth:1.5,stroke:`currentColor`,"aria-hidden":`true`,ref:r,"aria-labelledby":t},n),e?x.createElement(`title`,{id:t},e):null,x.createElement(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M12 15a3 3 0 100-6 3 3 0 000 6z`}),x.createElement(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M18.727 14.727a1.5 1.5 0 00.3 1.655l.055.054a1.816 1.816 0 010 2.573 1.818 1.818 0 01-2.573 0l-.055-.055a1.5 1.5 0 00-1.654-.3 1.5 1.5 0 00-.91 1.373v.155a1.818 1.818 0 11-3.636 0V20.1a1.5 1.5 0 00-.981-1.373 1.5 1.5 0 00-1.655.3l-.054.055a1.818 1.818 0 01-3.106-1.287 1.818 1.818 0 01.533-1.286l.054-.055a1.5 1.5 0 00.3-1.654 1.5 1.5 0 00-1.372-.91h-.155a1.818 1.818 0 110-3.636H3.9a1.5 1.5 0 001.373-.981 1.5 1.5 0 00-.3-1.655l-.055-.054A1.818 1.818 0 117.491 4.99l.054.054a1.5 1.5 0 001.655.3h.073a1.5 1.5 0 00.909-1.372v-.155a1.818 1.818 0 013.636 0V3.9a1.499 1.499 0 00.91 1.373 1.5 1.5 0 001.654-.3l.054-.055a1.817 1.817 0 012.573 0 1.819 1.819 0 010 2.573l-.055.054a1.5 1.5 0 00-.3 1.655v.073a1.5 1.5 0 001.373.909h.155a1.818 1.818 0 010 3.636H20.1a1.499 1.499 0 00-1.373.91z`}))}var Re=x.forwardRef(Le);function ze({title:e,titleId:t,...n},r){return x.createElement(`svg`,Object.assign({xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,strokeWidth:1.5,stroke:`currentColor`,"aria-hidden":`true`,ref:r,"aria-labelledby":t},n),e?x.createElement(`title`,{id:t},e):null,x.createElement(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M12 15a3 3 0 100-6 3 3 0 000 6z`}),x.createElement(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M9.29 19.371l.584 1.315a2.213 2.213 0 004.044 0l.585-1.315a2.426 2.426 0 012.47-1.423l1.43.152a2.212 2.212 0 002.022-3.502l-.847-1.164a2.428 2.428 0 01-.46-1.434c0-.513.163-1.014.465-1.429l.847-1.163a2.212 2.212 0 00-2.023-3.502l-1.43.152a2.433 2.433 0 01-1.47-.312 2.425 2.425 0 01-1-1.117l-.588-1.315a2.212 2.212 0 00-4.045 0L9.29 4.63c-.207.468-.558.86-1 1.117-.445.256-.96.365-1.47.312l-1.435-.152a2.212 2.212 0 00-2.022 3.502l.847 1.163a2.43 2.43 0 010 2.858l-.847 1.163a2.21 2.21 0 00.786 3.273c.381.195.81.274 1.236.23l1.43-.153a2.434 2.434 0 012.475 1.43z`}))}var Be=x.forwardRef(ze);function Ve({title:e,titleId:t,...n},r){return x.createElement(`svg`,Object.assign({xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,strokeWidth:1.5,stroke:`currentColor`,"aria-hidden":`true`,ref:r,"aria-labelledby":t},n),e?x.createElement(`title`,{id:t},e):null,x.createElement(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M4 17l6-6-6-6m8 14h8`}))}var He=x.forwardRef(Ve);function Ue({title:e,titleId:t,...n},r){return x.createElement(`svg`,Object.assign({xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,strokeWidth:1.5,stroke:`currentColor`,"aria-hidden":`true`,ref:r,"aria-labelledby":t},n),e?x.createElement(`title`,{id:t},e):null,x.createElement(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M18 6L6 18M6 6l12 12`}))}var We=x.forwardRef(Ue);function Ge(){if(typeof navigator>`u`)return!1;let e=navigator.userAgent,t=/iPad|iPhone|iPod/.test(e),n=navigator.platform===`MacIntel`&&navigator.maxTouchPoints>1;return t||n}function Ke(){return typeof navigator>`u`?!1:Ge()&&navigator.standalone===!0}function qe(){return typeof navigator>`u`?!1:navigator.platform.toUpperCase().indexOf(`MAC`)>=0}function Je(e){return e===`auto`?qe()?`ctrl-option`:`ctrl-shift`:e}var Ye={"ctrl-option":`⌃⌥`,"ctrl-shift":`⌃⇧`,"cmd-option":`⌘⌥`,"cmd-shift":`⌘⇧`};function Xe(e){return Ye[e]}function Ze(e,t){switch(t){case`ctrl-option`:return e.ctrlKey&&e.altKey&&!e.metaKey&&!e.shiftKey;case`ctrl-shift`:return e.ctrlKey&&e.shiftKey&&!e.metaKey&&!e.altKey;case`cmd-option`:return e.metaKey&&e.altKey&&!e.ctrlKey&&!e.shiftKey;case`cmd-shift`:return e.metaKey&&e.shiftKey&&!e.ctrlKey&&!e.altKey}}var Qe=s((e=>{var t=p(),n=Symbol.for(`react.element`),r=Symbol.for(`react.fragment`),i=Object.prototype.hasOwnProperty,a=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,o={key:!0,ref:!0,__self:!0,__source:!0};function s(e,t,r){var s,c={},l=null,u=null;for(s in r!==void 0&&(l=``+r),t.key!==void 0&&(l=``+t.key),t.ref!==void 0&&(u=t.ref),t)i.call(t,s)&&!o.hasOwnProperty(s)&&(c[s]=t[s]);if(e&&e.defaultProps)for(s in t=e.defaultProps,t)c[s]===void 0&&(c[s]=t[s]);return{$$typeof:n,type:e,key:l,ref:u,props:c,_owner:a.current}}e.Fragment=r,e.jsx=s,e.jsxs=s})),G=s(((e,t)=>{t.exports=Qe()}))(),$e={connected:`bg-working`,connecting:`bg-approval`,reconnecting:`bg-approval`,disconnected:`bg-danger`};function et({connectionStatus:e,onNewSession:t,onOpenSettings:n,tailscaleIp:r}){let[i,a]=(0,x.useState)(!1),o=Xe(Je(U(e=>e.shortcutModifier)));return(0,G.jsxs)(`header`,{className:`flex h-10 shrink-0 items-center justify-between border-b border-border bg-elevated px-3`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(`h1`,{className:`text-sm font-semibold tracking-tight text-primary text-balance`,children:`AGENTBOARD`}),(0,G.jsxs)(`div`,{className:`flex items-center gap-1.5 text-xs text-muted`,children:[(0,G.jsx)(`span`,{className:`h-2 w-2 rounded-full ${$e[e]}`}),r&&(0,G.jsxs)(`button`,{onClick:()=>{if(!r)return;let e=`http://${r}:${window.location.port||`4040`}`;navigator.clipboard.writeText(e),a(!0),setTimeout(()=>a(!1),1500)},className:`ml-3 inline-flex items-center gap-1 text-muted/70 hover:text-muted transition-colors cursor-pointer`,title:`Tailscale IP - click to copy remote access URL`,children:[(0,G.jsx)(`span`,{className:`leading-none translate-y-[1px]`,children:i?`Copied!`:r}),!i&&(0,G.jsx)(ue,{width:12,height:12,className:`shrink-0`})]})]})]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,G.jsx)(`button`,{onClick:t,className:`flex h-7 w-7 items-center justify-center rounded bg-accent text-white hover:bg-accent/90 active:scale-95 transition-all`,title:`New session (${o}N)`,"aria-label":`New session`,children:(0,G.jsx)(Pe,{width:16,height:16})}),(0,G.jsx)(`button`,{onClick:n,className:`flex h-7 w-7 items-center justify-center rounded border border-border text-secondary hover:bg-hover hover:text-primary active:scale-95 transition-all`,title:`Settings`,"aria-label":`Settings`,children:(0,G.jsx)(Be,{width:14,height:14})})]})]})}var tt=(0,x.createContext)({});function nt(e){let t=(0,x.useRef)(null);return t.current===null&&(t.current=e()),t.current}var rt=typeof window<`u`,it=rt?x.useLayoutEffect:x.useEffect,at=(0,x.createContext)(null);function ot(e,t){e.indexOf(t)===-1&&e.push(t)}function st(e,t){let n=e.indexOf(t);n>-1&&e.splice(n,1)}var ct=(e,t,n)=>n>t?t:n<e?e:n,lt={},ut=e=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(e);function dt(e){return typeof e==`object`&&!!e}var ft=e=>/^0[^.\s]+$/u.test(e);function pt(e){let t;return()=>(t===void 0&&(t=e()),t)}var mt=e=>e,ht=(e,t)=>n=>t(e(n)),gt=(...e)=>e.reduce(ht),_t=(e,t,n)=>{let r=t-e;return r===0?1:(n-e)/r},vt=class{constructor(){this.subscriptions=[]}add(e){return ot(this.subscriptions,e),()=>st(this.subscriptions,e)}notify(e,t,n){let r=this.subscriptions.length;if(r)if(r===1)this.subscriptions[0](e,t,n);else for(let i=0;i<r;i++){let r=this.subscriptions[i];r&&r(e,t,n)}}getSize(){return this.subscriptions.length}clear(){this.subscriptions.length=0}},yt=e=>e*1e3,bt=e=>e/1e3;function xt(e,t){return t?1e3/t*e:0}var St=(e,t,n)=>(((1-3*n+3*t)*e+(3*n-6*t))*e+3*t)*e,Ct=1e-7,wt=12;function Tt(e,t,n,r,i){let a,o,s=0;do o=t+(n-t)/2,a=St(o,r,i)-e,a>0?n=o:t=o;while(Math.abs(a)>Ct&&++s<wt);return o}function Et(e,t,n,r){if(e===t&&n===r)return mt;let i=t=>Tt(t,0,1,e,n);return e=>e===0||e===1?e:St(i(e),t,r)}var Dt=e=>t=>t<=.5?e(2*t)/2:(2-e(2*(1-t)))/2,Ot=e=>t=>1-e(1-t),kt=Et(.33,1.53,.69,.99),At=Ot(kt),jt=Dt(At),Mt=e=>(e*=2)<1?.5*At(e):.5*(2-2**(-10*(e-1))),Nt=e=>1-Math.sin(Math.acos(e)),Pt=Ot(Nt),Ft=Dt(Nt),It=Et(.42,0,1,1),Lt=Et(0,0,.58,1),Rt=Et(.42,0,.58,1),zt=e=>Array.isArray(e)&&typeof e[0]!=`number`,Bt=e=>Array.isArray(e)&&typeof e[0]==`number`,Vt={linear:mt,easeIn:It,easeInOut:Rt,easeOut:Lt,circIn:Nt,circInOut:Ft,circOut:Pt,backIn:At,backInOut:jt,backOut:kt,anticipate:Mt},Ht=e=>typeof e==`string`,Ut=e=>{if(Bt(e)){e.length;let[t,n,r,i]=e;return Et(t,n,r,i)}else if(Ht(e))return Vt[e],`${e}`,Vt[e];return e},Wt=[`setup`,`read`,`resolveKeyframes`,`preUpdate`,`update`,`preRender`,`render`,`postRender`],Gt={value:null,addProjectionMetrics:null};function Kt(e,t){let n=new Set,r=new Set,i=!1,a=!1,o=new WeakSet,s={delta:0,timestamp:0,isProcessing:!1},c=0;function l(t){o.has(t)&&(u.schedule(t),e()),c++,t(s)}let u={schedule:(e,t=!1,a=!1)=>{let s=a&&i?n:r;return t&&o.add(e),s.has(e)||s.add(e),e},cancel:e=>{r.delete(e),o.delete(e)},process:e=>{if(s=e,i){a=!0;return}i=!0,[n,r]=[r,n],n.forEach(l),t&&Gt.value&&Gt.value.frameloop[t].push(c),c=0,n.clear(),i=!1,a&&(a=!1,u.process(e))}};return u}var qt=40;function Jt(e,t){let n=!1,r=!0,i={delta:0,timestamp:0,isProcessing:!1},a=()=>n=!0,o=Wt.reduce((e,n)=>(e[n]=Kt(a,t?n:void 0),e),{}),{setup:s,read:c,resolveKeyframes:l,preUpdate:u,update:d,preRender:f,render:p,postRender:m}=o,h=()=>{let a=lt.useManualTiming?i.timestamp:performance.now();n=!1,lt.useManualTiming||(i.delta=r?1e3/60:Math.max(Math.min(a-i.timestamp,qt),1)),i.timestamp=a,i.isProcessing=!0,s.process(i),c.process(i),l.process(i),u.process(i),d.process(i),f.process(i),p.process(i),m.process(i),i.isProcessing=!1,n&&t&&(r=!1,e(h))},g=()=>{n=!0,r=!0,i.isProcessing||e(h)};return{schedule:Wt.reduce((e,t)=>{let r=o[t];return e[t]=(e,t=!1,i=!1)=>(n||g(),r.schedule(e,t,i)),e},{}),cancel:e=>{for(let t=0;t<Wt.length;t++)o[Wt[t]].cancel(e)},state:i,steps:o}}var{schedule:Yt,cancel:Xt,state:Zt,steps:Qt}=Jt(typeof requestAnimationFrame<`u`?requestAnimationFrame:mt,!0),$t;function en(){$t=void 0}var tn={now:()=>($t===void 0&&tn.set(Zt.isProcessing||lt.useManualTiming?Zt.timestamp:performance.now()),$t),set:e=>{$t=e,queueMicrotask(en)}},nn={layout:0,mainThread:0,waapi:0},rn=e=>t=>typeof t==`string`&&t.startsWith(e),an=rn(`--`),on=rn(`var(--`),sn=e=>on(e)?cn.test(e.split(`/*`)[0].trim()):!1,cn=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu;function ln(e){return typeof e==`string`?e.split(`/*`)[0].includes(`var(--`):!1}var un={test:e=>typeof e==`number`,parse:parseFloat,transform:e=>e},dn={...un,transform:e=>ct(0,1,e)},fn={...un,default:1},pn=e=>Math.round(e*1e5)/1e5,mn=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function hn(e){return e==null}var gn=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,_n=(e,t)=>n=>!!(typeof n==`string`&&gn.test(n)&&n.startsWith(e)||t&&!hn(n)&&Object.prototype.hasOwnProperty.call(n,t)),vn=(e,t,n)=>r=>{if(typeof r!=`string`)return r;let[i,a,o,s]=r.match(mn);return{[e]:parseFloat(i),[t]:parseFloat(a),[n]:parseFloat(o),alpha:s===void 0?1:parseFloat(s)}},yn=e=>ct(0,255,e),bn={...un,transform:e=>Math.round(yn(e))},xn={test:_n(`rgb`,`red`),parse:vn(`red`,`green`,`blue`),transform:({red:e,green:t,blue:n,alpha:r=1})=>`rgba(`+bn.transform(e)+`, `+bn.transform(t)+`, `+bn.transform(n)+`, `+pn(dn.transform(r))+`)`};function Sn(e){let t=``,n=``,r=``,i=``;return e.length>5?(t=e.substring(1,3),n=e.substring(3,5),r=e.substring(5,7),i=e.substring(7,9)):(t=e.substring(1,2),n=e.substring(2,3),r=e.substring(3,4),i=e.substring(4,5),t+=t,n+=n,r+=r,i+=i),{red:parseInt(t,16),green:parseInt(n,16),blue:parseInt(r,16),alpha:i?parseInt(i,16)/255:1}}var Cn={test:_n(`#`),parse:Sn,transform:xn.transform},wn=e=>({test:t=>typeof t==`string`&&t.endsWith(e)&&t.split(` `).length===1,parse:parseFloat,transform:t=>`${t}${e}`}),Tn=wn(`deg`),En=wn(`%`),K=wn(`px`),Dn=wn(`vh`),On=wn(`vw`),kn={...En,parse:e=>En.parse(e)/100,transform:e=>En.transform(e*100)},An={test:_n(`hsl`,`hue`),parse:vn(`hue`,`saturation`,`lightness`),transform:({hue:e,saturation:t,lightness:n,alpha:r=1})=>`hsla(`+Math.round(e)+`, `+En.transform(pn(t))+`, `+En.transform(pn(n))+`, `+pn(dn.transform(r))+`)`},jn={test:e=>xn.test(e)||Cn.test(e)||An.test(e),parse:e=>xn.test(e)?xn.parse(e):An.test(e)?An.parse(e):Cn.parse(e),transform:e=>typeof e==`string`?e:e.hasOwnProperty(`red`)?xn.transform(e):An.transform(e),getAnimatableNone:e=>{let t=jn.parse(e);return t.alpha=0,jn.transform(t)}},Mn=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;function Nn(e){return isNaN(e)&&typeof e==`string`&&(e.match(mn)?.length||0)+(e.match(Mn)?.length||0)>0}var Pn=`number`,Fn=`color`,In=`var`,Ln=`var(`,Rn="${}",zn=/var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu;function Bn(e){let t=e.toString(),n=[],r={color:[],number:[],var:[]},i=[],a=0;return{values:n,split:t.replace(zn,e=>(jn.test(e)?(r.color.push(a),i.push(Fn),n.push(jn.parse(e))):e.startsWith(Ln)?(r.var.push(a),i.push(In),n.push(e)):(r.number.push(a),i.push(Pn),n.push(parseFloat(e))),++a,Rn)).split(Rn),indexes:r,types:i}}function Vn(e){return Bn(e).values}function Hn(e){let{split:t,types:n}=Bn(e),r=t.length;return e=>{let i=``;for(let a=0;a<r;a++)if(i+=t[a],e[a]!==void 0){let t=n[a];t===Pn?i+=pn(e[a]):t===Fn?i+=jn.transform(e[a]):i+=e[a]}return i}}var Un=e=>typeof e==`number`?0:jn.test(e)?jn.getAnimatableNone(e):e;function Wn(e){let t=Vn(e);return Hn(e)(t.map(Un))}var Gn={test:Nn,parse:Vn,createTransformer:Hn,getAnimatableNone:Wn};function Kn(e,t,n){return n<0&&(n+=1),n>1&&--n,n<1/6?e+(t-e)*6*n:n<1/2?t:n<2/3?e+(t-e)*(2/3-n)*6:e}function qn({hue:e,saturation:t,lightness:n,alpha:r}){e/=360,t/=100,n/=100;let i=0,a=0,o=0;if(!t)i=a=o=n;else{let r=n<.5?n*(1+t):n+t-n*t,s=2*n-r;i=Kn(s,r,e+1/3),a=Kn(s,r,e),o=Kn(s,r,e-1/3)}return{red:Math.round(i*255),green:Math.round(a*255),blue:Math.round(o*255),alpha:r}}function Jn(e,t){return n=>n>0?t:e}var Yn=(e,t,n)=>e+(t-e)*n,Xn=(e,t,n)=>{let r=e*e,i=n*(t*t-r)+r;return i<0?0:Math.sqrt(i)},Zn=[Cn,xn,An],Qn=e=>Zn.find(t=>t.test(e));function $n(e){let t=Qn(e);if(`${e}`,!t)return!1;let n=t.parse(e);return t===An&&(n=qn(n)),n}var er=(e,t)=>{let n=$n(e),r=$n(t);if(!n||!r)return Jn(e,t);let i={...n};return e=>(i.red=Xn(n.red,r.red,e),i.green=Xn(n.green,r.green,e),i.blue=Xn(n.blue,r.blue,e),i.alpha=Yn(n.alpha,r.alpha,e),xn.transform(i))},tr=new Set([`none`,`hidden`]);function nr(e,t){return tr.has(e)?n=>n<=0?e:t:n=>n>=1?t:e}function rr(e,t){return n=>Yn(e,t,n)}function ir(e){return typeof e==`number`?rr:typeof e==`string`?sn(e)?Jn:jn.test(e)?er:cr:Array.isArray(e)?ar:typeof e==`object`?jn.test(e)?er:or:Jn}function ar(e,t){let n=[...e],r=n.length,i=e.map((e,n)=>ir(e)(e,t[n]));return e=>{for(let t=0;t<r;t++)n[t]=i[t](e);return n}}function or(e,t){let n={...e,...t},r={};for(let i in n)e[i]!==void 0&&t[i]!==void 0&&(r[i]=ir(e[i])(e[i],t[i]));return e=>{for(let t in r)n[t]=r[t](e);return n}}function sr(e,t){let n=[],r={color:0,var:0,number:0};for(let i=0;i<t.values.length;i++){let a=t.types[i],o=e.indexes[a][r[a]];n[i]=e.values[o]??0,r[a]++}return n}var cr=(e,t)=>{let n=Gn.createTransformer(t),r=Bn(e),i=Bn(t);return r.indexes.var.length===i.indexes.var.length&&r.indexes.color.length===i.indexes.color.length&&r.indexes.number.length>=i.indexes.number.length?tr.has(e)&&!i.values.length||tr.has(t)&&!r.values.length?nr(e,t):gt(ar(sr(r,i),i.values),n):(`${e}${t}`,Jn(e,t))};function lr(e,t,n){return typeof e==`number`&&typeof t==`number`&&typeof n==`number`?Yn(e,t,n):ir(e)(e,t)}var ur=e=>{let t=({timestamp:t})=>e(t);return{start:(e=!0)=>Yt.update(t,e),stop:()=>Xt(t),now:()=>Zt.isProcessing?Zt.timestamp:tn.now()}},dr=(e,t,n=10)=>{let r=``,i=Math.max(Math.round(t/n),2);for(let t=0;t<i;t++)r+=Math.round(e(t/(i-1))*1e4)/1e4+`, `;return`linear(${r.substring(0,r.length-2)})`},fr=2e4;function pr(e){let t=0,n=e.next(t);for(;!n.done&&t<2e4;)t+=50,n=e.next(t);return t>=2e4?1/0:t}function mr(e,t=100,n){let r=n({...e,keyframes:[0,t]}),i=Math.min(pr(r),fr);return{type:`keyframes`,ease:e=>r.next(i*e).value/t,duration:bt(i)}}var hr=5;function gr(e,t,n){let r=Math.max(t-hr,0);return xt(n-e(r),t-r)}var _r={stiffness:100,damping:10,mass:1,velocity:0,duration:800,bounce:.3,visualDuration:.3,restSpeed:{granular:.01,default:2},restDelta:{granular:.005,default:.5},minDuration:.01,maxDuration:10,minDamping:.05,maxDamping:1},vr=.001;function yr({duration:e=_r.duration,bounce:t=_r.bounce,velocity:n=_r.velocity,mass:r=_r.mass}){let i,a;_r.maxDuration;let o=1-t;o=ct(_r.minDamping,_r.maxDamping,o),e=ct(_r.minDuration,_r.maxDuration,bt(e)),o<1?(i=t=>{let r=t*o,i=r*e,a=r-n,s=Sr(t,o),c=Math.exp(-i);return vr-a/s*c},a=t=>{let r=t*o*e,a=r*n+n,s=o**2*t**2*e,c=Math.exp(-r),l=Sr(t**2,o);return(-i(t)+vr>0?-1:1)*((a-s)*c)/l}):(i=t=>{let r=Math.exp(-t*e),i=(t-n)*e+1;return-vr+r*i},a=t=>Math.exp(-t*e)*((n-t)*(e*e)));let s=5/e,c=xr(i,a,s);if(e=yt(e),isNaN(c))return{stiffness:_r.stiffness,damping:_r.damping,duration:e};{let t=c**2*r;return{stiffness:t,damping:o*2*Math.sqrt(r*t),duration:e}}}var br=12;function xr(e,t,n){let r=n;for(let n=1;n<br;n++)r-=e(r)/t(r);return r}function Sr(e,t){return e*Math.sqrt(1-t*t)}var Cr=[`duration`,`bounce`],wr=[`stiffness`,`damping`,`mass`];function Tr(e,t){return t.some(t=>e[t]!==void 0)}function Er(e){let t={velocity:_r.velocity,stiffness:_r.stiffness,damping:_r.damping,mass:_r.mass,isResolvedFromDuration:!1,...e};if(!Tr(e,wr)&&Tr(e,Cr))if(e.visualDuration){let n=e.visualDuration,r=2*Math.PI/(n*1.2),i=r*r,a=2*ct(.05,1,1-(e.bounce||0))*Math.sqrt(i);t={...t,mass:_r.mass,stiffness:i,damping:a}}else{let n=yr(e);t={...t,...n,mass:_r.mass},t.isResolvedFromDuration=!0}return t}function Dr(e=_r.visualDuration,t=_r.bounce){let n=typeof e==`object`?e:{visualDuration:e,keyframes:[0,1],bounce:t},{restSpeed:r,restDelta:i}=n,a=n.keyframes[0],o=n.keyframes[n.keyframes.length-1],s={done:!1,value:a},{stiffness:c,damping:l,mass:u,duration:d,velocity:f,isResolvedFromDuration:p}=Er({...n,velocity:-bt(n.velocity||0)}),m=f||0,h=l/(2*Math.sqrt(c*u)),g=o-a,_=bt(Math.sqrt(c/u)),v=Math.abs(g)<5;r||=v?_r.restSpeed.granular:_r.restSpeed.default,i||=v?_r.restDelta.granular:_r.restDelta.default;let y;if(h<1){let e=Sr(_,h);y=t=>o-Math.exp(-h*_*t)*((m+h*_*g)/e*Math.sin(e*t)+g*Math.cos(e*t))}else if(h===1)y=e=>o-Math.exp(-_*e)*(g+(m+_*g)*e);else{let e=_*Math.sqrt(h*h-1);y=t=>{let n=Math.exp(-h*_*t),r=Math.min(e*t,300);return o-n*((m+h*_*g)*Math.sinh(r)+e*g*Math.cosh(r))/e}}let b={calculatedDuration:p&&d||null,next:e=>{let t=y(e);if(p)s.done=e>=d;else{let n=e===0?m:0;h<1&&(n=e===0?yt(m):gr(y,e,t));let a=Math.abs(n)<=r,c=Math.abs(o-t)<=i;s.done=a&&c}return s.value=s.done?o:t,s},toString:()=>{let e=Math.min(pr(b),fr),t=dr(t=>b.next(e*t).value,e,30);return e+`ms `+t},toTransition:()=>{}};return b}Dr.applyToOptions=e=>{let t=mr(e,100,Dr);return e.ease=t.ease,e.duration=yt(t.duration),e.type=`keyframes`,e};function Or({keyframes:e,velocity:t=0,power:n=.8,timeConstant:r=325,bounceDamping:i=10,bounceStiffness:a=500,modifyTarget:o,min:s,max:c,restDelta:l=.5,restSpeed:u}){let d=e[0],f={done:!1,value:d},p=e=>s!==void 0&&e<s||c!==void 0&&e>c,m=e=>s===void 0?c:c===void 0||Math.abs(s-e)<Math.abs(c-e)?s:c,h=n*t,g=d+h,_=o===void 0?g:o(g);_!==g&&(h=_-d);let v=e=>-h*Math.exp(-e/r),y=e=>_+v(e),b=e=>{let t=v(e),n=y(e);f.done=Math.abs(t)<=l,f.value=f.done?_:n},x,S,C=e=>{p(f.value)&&(x=e,S=Dr({keyframes:[f.value,m(f.value)],velocity:gr(y,e,f.value),damping:i,stiffness:a,restDelta:l,restSpeed:u}))};return C(0),{calculatedDuration:null,next:e=>{let t=!1;return!S&&x===void 0&&(t=!0,b(e),C(e)),x!==void 0&&e>=x?S.next(e-x):(!t&&b(e),f)}}}function kr(e,t,n){let r=[],i=n||lt.mix||lr,a=e.length-1;for(let n=0;n<a;n++){let a=i(e[n],e[n+1]);t&&(a=gt(Array.isArray(t)?t[n]||mt:t,a)),r.push(a)}return r}function Ar(e,t,{clamp:n=!0,ease:r,mixer:i}={}){let a=e.length;if(t.length,a===1)return()=>t[0];if(a===2&&t[0]===t[1])return()=>t[1];let o=e[0]===e[1];e[0]>e[a-1]&&(e=[...e].reverse(),t=[...t].reverse());let s=kr(t,r,i),c=s.length,l=n=>{if(o&&n<e[0])return t[0];let r=0;if(c>1)for(;r<e.length-2&&!(n<e[r+1]);r++);let i=_t(e[r],e[r+1],n);return s[r](i)};return n?t=>l(ct(e[0],e[a-1],t)):l}function jr(e,t){let n=e[e.length-1];for(let r=1;r<=t;r++){let i=_t(0,t,r);e.push(Yn(n,1,i))}}function Mr(e){let t=[0];return jr(t,e.length-1),t}function Nr(e,t){return e.map(e=>e*t)}function Pr(e,t){return e.map(()=>t||Rt).splice(0,e.length-1)}function Fr({duration:e=300,keyframes:t,times:n,ease:r=`easeInOut`}){let i=zt(r)?r.map(Ut):Ut(r),a={done:!1,value:t[0]},o=Ar(Nr(n&&n.length===t.length?n:Mr(t),e),t,{ease:Array.isArray(i)?i:Pr(t,i)});return{calculatedDuration:e,next:t=>(a.value=o(t),a.done=t>=e,a)}}var Ir=e=>e!==null;function Lr(e,{repeat:t,repeatType:n=`loop`},r,i=1){let a=e.filter(Ir),o=i<0||t&&n!==`loop`&&t%2==1?0:a.length-1;return!o||r===void 0?a[o]:r}var Rr={decay:Or,inertia:Or,tween:Fr,keyframes:Fr,spring:Dr};function zr(e){typeof e.type==`string`&&(e.type=Rr[e.type])}var Br=class{constructor(){this.updateFinished()}get finished(){return this._finished}updateFinished(){this._finished=new Promise(e=>{this.resolve=e})}notifyFinished(){this.resolve()}then(e,t){return this.finished.then(e,t)}},Vr=e=>e/100,Hr=class extends Br{constructor(e){super(),this.state=`idle`,this.startTime=null,this.isStopped=!1,this.currentTime=0,this.holdTime=null,this.playbackSpeed=1,this.stop=()=>{let{motionValue:e}=this.options;e&&e.updatedAt!==tn.now()&&this.tick(tn.now()),this.isStopped=!0,this.state!==`idle`&&(this.teardown(),this.options.onStop?.())},nn.mainThread++,this.options=e,this.initAnimation(),this.play(),e.autoplay===!1&&this.pause()}initAnimation(){let{options:e}=this;zr(e);let{type:t=Fr,repeat:n=0,repeatDelay:r=0,repeatType:i,velocity:a=0}=e,{keyframes:o}=e,s=t||Fr;s!==Fr&&typeof o[0]!=`number`&&(this.mixKeyframes=gt(Vr,lr(o[0],o[1])),o=[0,100]);let c=s({...e,keyframes:o});i===`mirror`&&(this.mirroredGenerator=s({...e,keyframes:[...o].reverse(),velocity:-a})),c.calculatedDuration===null&&(c.calculatedDuration=pr(c));let{calculatedDuration:l}=c;this.calculatedDuration=l,this.resolvedDuration=l+r,this.totalDuration=this.resolvedDuration*(n+1)-r,this.generator=c}updateTime(e){let t=Math.round(e-this.startTime)*this.playbackSpeed;this.holdTime===null?this.currentTime=t:this.currentTime=this.holdTime}tick(e,t=!1){let{generator:n,totalDuration:r,mixKeyframes:i,mirroredGenerator:a,resolvedDuration:o,calculatedDuration:s}=this;if(this.startTime===null)return n.next(0);let{delay:c=0,keyframes:l,repeat:u,repeatType:d,repeatDelay:f,type:p,onUpdate:m,finalKeyframe:h}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,e):this.speed<0&&(this.startTime=Math.min(e-r/this.speed,this.startTime)),t?this.currentTime=e:this.updateTime(e);let g=this.currentTime-c*(this.playbackSpeed>=0?1:-1),_=this.playbackSpeed>=0?g<0:g>r;this.currentTime=Math.max(g,0),this.state===`finished`&&this.holdTime===null&&(this.currentTime=r);let v=this.currentTime,y=n;if(u){let e=Math.min(this.currentTime,r)/o,t=Math.floor(e),n=e%1;!n&&e>=1&&(n=1),n===1&&t--,t=Math.min(t,u+1),t%2&&(d===`reverse`?(n=1-n,f&&(n-=f/o)):d===`mirror`&&(y=a)),v=ct(0,1,n)*o}let b=_?{done:!1,value:l[0]}:y.next(v);i&&(b.value=i(b.value));let{done:x}=b;!_&&s!==null&&(x=this.playbackSpeed>=0?this.currentTime>=r:this.currentTime<=0);let S=this.holdTime===null&&(this.state===`finished`||this.state===`running`&&x);return S&&p!==Or&&(b.value=Lr(l,this.options,h,this.speed)),m&&m(b.value),S&&this.finish(),b}then(e,t){return this.finished.then(e,t)}get duration(){return bt(this.calculatedDuration)}get iterationDuration(){let{delay:e=0}=this.options||{};return this.duration+bt(e)}get time(){return bt(this.currentTime)}set time(e){e=yt(e),this.currentTime=e,this.startTime===null||this.holdTime!==null||this.playbackSpeed===0?this.holdTime=e:this.driver&&(this.startTime=this.driver.now()-e/this.playbackSpeed),this.driver?.start(!1)}get speed(){return this.playbackSpeed}set speed(e){this.updateTime(tn.now());let t=this.playbackSpeed!==e;this.playbackSpeed=e,t&&(this.time=bt(this.currentTime))}play(){if(this.isStopped)return;let{driver:e=ur,startTime:t}=this.options;this.driver||=e(e=>this.tick(e)),this.options.onPlay?.();let n=this.driver.now();this.state===`finished`?(this.updateFinished(),this.startTime=n):this.holdTime===null?this.startTime||=t??n:this.startTime=n-this.holdTime,this.state===`finished`&&this.speed<0&&(this.startTime+=this.calculatedDuration),this.holdTime=null,this.state=`running`,this.driver.start()}pause(){this.state=`paused`,this.updateTime(tn.now()),this.holdTime=this.currentTime}complete(){this.state!==`running`&&this.play(),this.state=`finished`,this.holdTime=null}finish(){this.notifyFinished(),this.teardown(),this.state=`finished`,this.options.onComplete?.()}cancel(){this.holdTime=null,this.startTime=0,this.tick(0),this.teardown(),this.options.onCancel?.()}teardown(){this.state=`idle`,this.stopDriver(),this.startTime=this.holdTime=null,nn.mainThread--}stopDriver(){this.driver&&=(this.driver.stop(),void 0)}sample(e){return this.startTime=0,this.tick(e,!0)}attachTimeline(e){return this.options.allowFlatten&&(this.options.type=`keyframes`,this.options.ease=`linear`,this.initAnimation()),this.driver?.stop(),e.observe(this)}};function Ur(e){for(let t=1;t<e.length;t++)e[t]??(e[t]=e[t-1])}var Wr=e=>e*180/Math.PI,Gr=e=>qr(Wr(Math.atan2(e[1],e[0]))),Kr={x:4,y:5,translateX:4,translateY:5,scaleX:0,scaleY:3,scale:e=>(Math.abs(e[0])+Math.abs(e[3]))/2,rotate:Gr,rotateZ:Gr,skewX:e=>Wr(Math.atan(e[1])),skewY:e=>Wr(Math.atan(e[2])),skew:e=>(Math.abs(e[1])+Math.abs(e[2]))/2},qr=e=>(e%=360,e<0&&(e+=360),e),Jr=Gr,Yr=e=>Math.sqrt(e[0]*e[0]+e[1]*e[1]),Xr=e=>Math.sqrt(e[4]*e[4]+e[5]*e[5]),Zr={x:12,y:13,z:14,translateX:12,translateY:13,translateZ:14,scaleX:Yr,scaleY:Xr,scale:e=>(Yr(e)+Xr(e))/2,rotateX:e=>qr(Wr(Math.atan2(e[6],e[5]))),rotateY:e=>qr(Wr(Math.atan2(-e[2],e[0]))),rotateZ:Jr,rotate:Jr,skewX:e=>Wr(Math.atan(e[4])),skewY:e=>Wr(Math.atan(e[1])),skew:e=>(Math.abs(e[1])+Math.abs(e[4]))/2};function Qr(e){return+!!e.includes(`scale`)}function $r(e,t){if(!e||e===`none`)return Qr(t);let n=e.match(/^matrix3d\(([-\d.e\s,]+)\)$/u),r,i;if(n)r=Zr,i=n;else{let t=e.match(/^matrix\(([-\d.e\s,]+)\)$/u);r=Kr,i=t}if(!i)return Qr(t);let a=r[t],o=i[1].split(`,`).map(ti);return typeof a==`function`?a(o):o[a]}var ei=(e,t)=>{let{transform:n=`none`}=getComputedStyle(e);return $r(n,t)};function ti(e){return parseFloat(e.trim())}var ni=[`transformPerspective`,`x`,`y`,`z`,`translateX`,`translateY`,`translateZ`,`scale`,`scaleX`,`scaleY`,`rotate`,`rotateX`,`rotateY`,`rotateZ`,`skew`,`skewX`,`skewY`],ri=new Set(ni),ii=e=>e===un||e===K,ai=new Set([`x`,`y`,`z`]),oi=ni.filter(e=>!ai.has(e));function si(e){let t=[];return oi.forEach(n=>{let r=e.getValue(n);r!==void 0&&(t.push([n,r.get()]),r.set(+!!n.startsWith(`scale`)))}),t}var ci={width:({x:e},{paddingLeft:t=`0`,paddingRight:n=`0`})=>e.max-e.min-parseFloat(t)-parseFloat(n),height:({y:e},{paddingTop:t=`0`,paddingBottom:n=`0`})=>e.max-e.min-parseFloat(t)-parseFloat(n),top:(e,{top:t})=>parseFloat(t),left:(e,{left:t})=>parseFloat(t),bottom:({y:e},{top:t})=>parseFloat(t)+(e.max-e.min),right:({x:e},{left:t})=>parseFloat(t)+(e.max-e.min),x:(e,{transform:t})=>$r(t,`x`),y:(e,{transform:t})=>$r(t,`y`)};ci.translateX=ci.x,ci.translateY=ci.y;var li=new Set,ui=!1,di=!1,fi=!1;function pi(){if(di){let e=Array.from(li).filter(e=>e.needsMeasurement),t=new Set(e.map(e=>e.element)),n=new Map;t.forEach(e=>{let t=si(e);t.length&&(n.set(e,t),e.render())}),e.forEach(e=>e.measureInitialState()),t.forEach(e=>{e.render();let t=n.get(e);t&&t.forEach(([t,n])=>{e.getValue(t)?.set(n)})}),e.forEach(e=>e.measureEndState()),e.forEach(e=>{e.suspendedScrollY!==void 0&&window.scrollTo(0,e.suspendedScrollY)})}di=!1,ui=!1,li.forEach(e=>e.complete(fi)),li.clear()}function mi(){li.forEach(e=>{e.readKeyframes(),e.needsMeasurement&&(di=!0)})}function hi(){fi=!0,mi(),pi(),fi=!1}var gi=class{constructor(e,t,n,r,i,a=!1){this.state=`pending`,this.isAsync=!1,this.needsMeasurement=!1,this.unresolvedKeyframes=[...e],this.onComplete=t,this.name=n,this.motionValue=r,this.element=i,this.isAsync=a}scheduleResolve(){this.state=`scheduled`,this.isAsync?(li.add(this),ui||(ui=!0,Yt.read(mi),Yt.resolveKeyframes(pi))):(this.readKeyframes(),this.complete())}readKeyframes(){let{unresolvedKeyframes:e,name:t,element:n,motionValue:r}=this;if(e[0]===null){let i=r?.get(),a=e[e.length-1];if(i!==void 0)e[0]=i;else if(n&&t){let r=n.readValue(t,a);r!=null&&(e[0]=r)}e[0]===void 0&&(e[0]=a),r&&i===void 0&&r.set(e[0])}Ur(e)}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(e=!1){this.state=`complete`,this.onComplete(this.unresolvedKeyframes,this.finalKeyframe,e),li.delete(this)}cancel(){this.state===`scheduled`&&(li.delete(this),this.state=`pending`)}resume(){this.state===`pending`&&this.scheduleResolve()}},_i=e=>e.startsWith(`--`);function vi(e,t,n){_i(t)?e.style.setProperty(t,n):e.style[t]=n}var yi=pt(()=>window.ScrollTimeline!==void 0),bi={};function xi(e,t){let n=pt(e);return()=>bi[t]??n()}var Si=xi(()=>{try{document.createElement(`div`).animate({opacity:0},{easing:`linear(0, 1)`})}catch{return!1}return!0},`linearEasing`),Ci=([e,t,n,r])=>`cubic-bezier(${e}, ${t}, ${n}, ${r})`,wi={linear:`linear`,ease:`ease`,easeIn:`ease-in`,easeOut:`ease-out`,easeInOut:`ease-in-out`,circIn:Ci([0,.65,.55,1]),circOut:Ci([.55,0,1,.45]),backIn:Ci([.31,.01,.66,-.59]),backOut:Ci([.33,1.53,.69,.99])};function Ti(e,t){if(e)return typeof e==`function`?Si()?dr(e,t):`ease-out`:Bt(e)?Ci(e):Array.isArray(e)?e.map(e=>Ti(e,t)||wi.easeOut):wi[e]}function Ei(e,t,n,{delay:r=0,duration:i=300,repeat:a=0,repeatType:o=`loop`,ease:s=`easeOut`,times:c}={},l=void 0){let u={[t]:n};c&&(u.offset=c);let d=Ti(s,i);Array.isArray(d)&&(u.easing=d),Gt.value&&nn.waapi++;let f={delay:r,duration:i,easing:Array.isArray(d)?`linear`:d,fill:`both`,iterations:a+1,direction:o===`reverse`?`alternate`:`normal`};l&&(f.pseudoElement=l);let p=e.animate(u,f);return Gt.value&&p.finished.finally(()=>{nn.waapi--}),p}function Di(e){return typeof e==`function`&&`applyToOptions`in e}function Oi({type:e,...t}){return Di(e)&&Si()?e.applyToOptions(t):(t.duration??=300,t.ease??=`easeOut`,t)}var ki=class extends Br{constructor(e){if(super(),this.finishedTime=null,this.isStopped=!1,this.manualStartTime=null,!e)return;let{element:t,name:n,keyframes:r,pseudoElement:i,allowFlatten:a=!1,finalKeyframe:o,onComplete:s}=e;this.isPseudoElement=!!i,this.allowFlatten=a,this.options=e,e.type;let c=Oi(e);this.animation=Ei(t,n,r,c,i),c.autoplay===!1&&this.animation.pause(),this.animation.onfinish=()=>{if(this.finishedTime=this.time,!i){let e=Lr(r,this.options,o,this.speed);this.updateMotionValue?this.updateMotionValue(e):vi(t,n,e),this.animation.cancel()}s?.(),this.notifyFinished()}}play(){this.isStopped||(this.manualStartTime=null,this.animation.play(),this.state===`finished`&&this.updateFinished())}pause(){this.animation.pause()}complete(){this.animation.finish?.()}cancel(){try{this.animation.cancel()}catch{}}stop(){if(this.isStopped)return;this.isStopped=!0;let{state:e}=this;e===`idle`||e===`finished`||(this.updateMotionValue?this.updateMotionValue():this.commitStyles(),this.isPseudoElement||this.cancel())}commitStyles(){this.isPseudoElement||this.animation.commitStyles?.()}get duration(){let e=this.animation.effect?.getComputedTiming?.().duration||0;return bt(Number(e))}get iterationDuration(){let{delay:e=0}=this.options||{};return this.duration+bt(e)}get time(){return bt(Number(this.animation.currentTime)||0)}set time(e){this.manualStartTime=null,this.finishedTime=null,this.animation.currentTime=yt(e)}get speed(){return this.animation.playbackRate}set speed(e){e<0&&(this.finishedTime=null),this.animation.playbackRate=e}get state(){return this.finishedTime===null?this.animation.playState:`finished`}get startTime(){return this.manualStartTime??Number(this.animation.startTime)}set startTime(e){this.manualStartTime=this.animation.startTime=e}attachTimeline({timeline:e,observe:t}){return this.allowFlatten&&this.animation.effect?.updateTiming({easing:`linear`}),this.animation.onfinish=null,e&&yi()?(this.animation.timeline=e,mt):t(this)}},Ai={anticipate:Mt,backInOut:jt,circInOut:Ft};function ji(e){return e in Ai}function Mi(e){typeof e.ease==`string`&&ji(e.ease)&&(e.ease=Ai[e.ease])}var Ni=10,Pi=class extends ki{constructor(e){Mi(e),zr(e),super(e),e.startTime!==void 0&&(this.startTime=e.startTime),this.options=e}updateMotionValue(e){let{motionValue:t,onUpdate:n,onComplete:r,element:i,...a}=this.options;if(!t)return;if(e!==void 0){t.set(e);return}let o=new Hr({...a,autoplay:!1}),s=Math.max(Ni,tn.now()-this.startTime),c=ct(0,Ni,s-Ni);t.setWithVelocity(o.sample(Math.max(0,s-c)).value,o.sample(s).value,c),o.stop()}},Fi=(e,t)=>t===`zIndex`?!1:!!(typeof e==`number`||Array.isArray(e)||typeof e==`string`&&(Gn.test(e)||e===`0`)&&!e.startsWith(`url(`));function Ii(e){let t=e[0];if(e.length===1)return!0;for(let n=0;n<e.length;n++)if(e[n]!==t)return!0}function Li(e,t,n,r){let i=e[0];if(i===null)return!1;if(t===`display`||t===`visibility`)return!0;let a=e[e.length-1],o=Fi(i,t),s=Fi(a,t);return`${t}${i}${a}${o?a:i}`,!o||!s?!1:Ii(e)||(n===`spring`||Di(n))&&r}function Ri(e){e.duration=0,e.type=`keyframes`}var zi=new Set([`opacity`,`clipPath`,`filter`,`transform`]),Bi=pt(()=>Object.hasOwnProperty.call(Element.prototype,`animate`));function Vi(e){let{motionValue:t,name:n,repeatDelay:r,repeatType:i,damping:a,type:o}=e;if(!(t?.owner?.current instanceof HTMLElement))return!1;let{onUpdate:s,transformTemplate:c}=t.owner.getProps();return Bi()&&n&&zi.has(n)&&(n!==`transform`||!c)&&!s&&!r&&i!==`mirror`&&a!==0&&o!==`inertia`}var Hi=40,Ui=class extends Br{constructor({autoplay:e=!0,delay:t=0,type:n=`keyframes`,repeat:r=0,repeatDelay:i=0,repeatType:a=`loop`,keyframes:o,name:s,motionValue:c,element:l,...u}){super(),this.stop=()=>{this._animation&&(this._animation.stop(),this.stopTimeline?.()),this.keyframeResolver?.cancel()},this.createdAt=tn.now();let d={autoplay:e,delay:t,type:n,repeat:r,repeatDelay:i,repeatType:a,name:s,motionValue:c,element:l,...u};this.keyframeResolver=new(l?.KeyframeResolver||gi)(o,(e,t,n)=>this.onKeyframesResolved(e,t,d,!n),s,c,l),this.keyframeResolver?.scheduleResolve()}onKeyframesResolved(e,t,n,r){this.keyframeResolver=void 0;let{name:i,type:a,velocity:o,delay:s,isHandoff:c,onUpdate:l}=n;this.resolvedAt=tn.now(),Li(e,i,a,o)||((lt.instantAnimations||!s)&&l?.(Lr(e,n,t)),e[0]=e[e.length-1],Ri(n),n.repeat=0);let u={startTime:r?this.resolvedAt&&this.resolvedAt-this.createdAt>Hi?this.resolvedAt:this.createdAt:void 0,finalKeyframe:t,...n,keyframes:e},d=!c&&Vi(u)?new Pi({...u,element:u.motionValue.owner.current}):new Hr(u);d.finished.then(()=>this.notifyFinished()).catch(mt),this.pendingTimeline&&=(this.stopTimeline=d.attachTimeline(this.pendingTimeline),void 0),this._animation=d}get finished(){return this._animation?this.animation.finished:this._finished}then(e,t){return this.finished.finally(e).then(()=>{})}get animation(){return this._animation||(this.keyframeResolver?.resume(),hi()),this._animation}get duration(){return this.animation.duration}get iterationDuration(){return this.animation.iterationDuration}get time(){return this.animation.time}set time(e){this.animation.time=e}get speed(){return this.animation.speed}get state(){return this.animation.state}set speed(e){this.animation.speed=e}get startTime(){return this.animation.startTime}attachTimeline(e){return this._animation?this.stopTimeline=this.animation.attachTimeline(e):this.pendingTimeline=e,()=>this.stop()}play(){this.animation.play()}pause(){this.animation.pause()}complete(){this.animation.complete()}cancel(){this._animation&&this.animation.cancel(),this.keyframeResolver?.cancel()}},Wi=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function Gi(e){let t=Wi.exec(e);if(!t)return[,];let[,n,r,i]=t;return[`--${n??r}`,i]}function Ki(e,t,n=1){`${e}`;let[r,i]=Gi(e);if(!r)return;let a=window.getComputedStyle(t).getPropertyValue(r);if(a){let e=a.trim();return ut(e)?parseFloat(e):e}return sn(i)?Ki(i,t,n+1):i}function qi(e,t){return e?.[t]??e?.default??e}var Ji=new Set([`width`,`height`,`top`,`left`,`right`,`bottom`,...ni]),Yi={test:e=>e===`auto`,parse:e=>e},Xi=e=>t=>t.test(e),Zi=[un,K,En,Tn,On,Dn,Yi],Qi=e=>Zi.find(Xi(e));function $i(e){return typeof e==`number`?e===0:e===null?!0:e===`none`||e===`0`||ft(e)}var ea=new Set([`brightness`,`contrast`,`saturate`,`opacity`]);function ta(e){let[t,n]=e.slice(0,-1).split(`(`);if(t===`drop-shadow`)return e;let[r]=n.match(mn)||[];if(!r)return e;let i=n.replace(r,``),a=+!!ea.has(t);return r!==n&&(a*=100),t+`(`+a+i+`)`}var na=/\b([a-z-]*)\(.*?\)/gu,ra={...Gn,getAnimatableNone:e=>{let t=e.match(na);return t?t.map(ta).join(` `):e}},ia={...un,transform:Math.round},aa={borderWidth:K,borderTopWidth:K,borderRightWidth:K,borderBottomWidth:K,borderLeftWidth:K,borderRadius:K,radius:K,borderTopLeftRadius:K,borderTopRightRadius:K,borderBottomRightRadius:K,borderBottomLeftRadius:K,width:K,maxWidth:K,height:K,maxHeight:K,top:K,right:K,bottom:K,left:K,inset:K,insetBlock:K,insetBlockStart:K,insetBlockEnd:K,insetInline:K,insetInlineStart:K,insetInlineEnd:K,padding:K,paddingTop:K,paddingRight:K,paddingBottom:K,paddingLeft:K,paddingBlock:K,paddingBlockStart:K,paddingBlockEnd:K,paddingInline:K,paddingInlineStart:K,paddingInlineEnd:K,margin:K,marginTop:K,marginRight:K,marginBottom:K,marginLeft:K,marginBlock:K,marginBlockStart:K,marginBlockEnd:K,marginInline:K,marginInlineStart:K,marginInlineEnd:K,backgroundPositionX:K,backgroundPositionY:K,rotate:Tn,rotateX:Tn,rotateY:Tn,rotateZ:Tn,scale:fn,scaleX:fn,scaleY:fn,scaleZ:fn,skew:Tn,skewX:Tn,skewY:Tn,distance:K,translateX:K,translateY:K,translateZ:K,x:K,y:K,z:K,perspective:K,transformPerspective:K,opacity:dn,originX:kn,originY:kn,originZ:K,zIndex:ia,fillOpacity:dn,strokeOpacity:dn,numOctaves:ia},oa={...aa,color:jn,backgroundColor:jn,outlineColor:jn,fill:jn,stroke:jn,borderColor:jn,borderTopColor:jn,borderRightColor:jn,borderBottomColor:jn,borderLeftColor:jn,filter:ra,WebkitFilter:ra},sa=e=>oa[e];function ca(e,t){let n=sa(e);return n!==ra&&(n=Gn),n.getAnimatableNone?n.getAnimatableNone(t):void 0}var la=new Set([`auto`,`none`,`0`]);function ua(e,t,n){let r=0,i;for(;r<e.length&&!i;){let t=e[r];typeof t==`string`&&!la.has(t)&&Bn(t).values.length&&(i=e[r]),r++}if(i&&n)for(let r of t)e[r]=ca(n,i)}var da=class extends gi{constructor(e,t,n,r,i){super(e,t,n,r,i,!0)}readKeyframes(){let{unresolvedKeyframes:e,element:t,name:n}=this;if(!t||!t.current)return;super.readKeyframes();for(let n=0;n<e.length;n++){let r=e[n];if(typeof r==`string`&&(r=r.trim(),sn(r))){let i=Ki(r,t.current);i!==void 0&&(e[n]=i),n===e.length-1&&(this.finalKeyframe=r)}}if(this.resolveNoneKeyframes(),!Ji.has(n)||e.length!==2)return;let[r,i]=e,a=Qi(r),o=Qi(i);if(ln(r)!==ln(i)&&ci[n]){this.needsMeasurement=!0;return}if(a!==o)if(ii(a)&&ii(o))for(let t=0;t<e.length;t++){let n=e[t];typeof n==`string`&&(e[t]=parseFloat(n))}else ci[n]&&(this.needsMeasurement=!0)}resolveNoneKeyframes(){let{unresolvedKeyframes:e,name:t}=this,n=[];for(let t=0;t<e.length;t++)(e[t]===null||$i(e[t]))&&n.push(t);n.length&&ua(e,n,t)}measureInitialState(){let{element:e,unresolvedKeyframes:t,name:n}=this;if(!e||!e.current)return;n===`height`&&(this.suspendedScrollY=window.pageYOffset),this.measuredOrigin=ci[n](e.measureViewportBox(),window.getComputedStyle(e.current)),t[0]=this.measuredOrigin;let r=t[t.length-1];r!==void 0&&e.getValue(n,r).jump(r,!1)}measureEndState(){let{element:e,name:t,unresolvedKeyframes:n}=this;if(!e||!e.current)return;let r=e.getValue(t);r&&r.jump(this.measuredOrigin,!1);let i=n.length-1,a=n[i];n[i]=ci[t](e.measureViewportBox(),window.getComputedStyle(e.current)),a!==null&&this.finalKeyframe===void 0&&(this.finalKeyframe=a),this.removedTransforms?.length&&this.removedTransforms.forEach(([t,n])=>{e.getValue(t).set(n)}),this.resolveNoneKeyframes()}};function fa(e,t,n){if(e instanceof EventTarget)return[e];if(typeof e==`string`){let r=document;t&&(r=t.current);let i=n?.[e]??r.querySelectorAll(e);return i?Array.from(i):[]}return Array.from(e)}var pa=(e,t)=>t&&typeof e==`number`?t.transform(e):e;function ma(e){return dt(e)&&`offsetHeight`in e}var ha=30,ga=e=>!isNaN(parseFloat(e)),_a={current:void 0},va=class{constructor(e,t={}){this.canTrackVelocity=null,this.events={},this.updateAndNotify=e=>{let t=tn.now();if(this.updatedAt!==t&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(e),this.current!==this.prev&&(this.events.change?.notify(this.current),this.dependents))for(let e of this.dependents)e.dirty()},this.hasAnimated=!1,this.setCurrent(e),this.owner=t.owner}setCurrent(e){this.current=e,this.updatedAt=tn.now(),this.canTrackVelocity===null&&e!==void 0&&(this.canTrackVelocity=ga(this.current))}setPrevFrameValue(e=this.current){this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt}onChange(e){return this.on(`change`,e)}on(e,t){this.events[e]||(this.events[e]=new vt);let n=this.events[e].add(t);return e===`change`?()=>{n(),Yt.read(()=>{this.events.change.getSize()||this.stop()})}:n}clearListeners(){for(let e in this.events)this.events[e].clear()}attach(e,t){this.passiveEffect=e,this.stopPassiveEffect=t}set(e){this.passiveEffect?this.passiveEffect(e,this.updateAndNotify):this.updateAndNotify(e)}setWithVelocity(e,t,n){this.set(t),this.prev=void 0,this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt-n}jump(e,t=!0){this.updateAndNotify(e),this.prev=e,this.prevUpdatedAt=this.prevFrameValue=void 0,t&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}dirty(){this.events.change?.notify(this.current)}addDependent(e){this.dependents||=new Set,this.dependents.add(e)}removeDependent(e){this.dependents&&this.dependents.delete(e)}get(){return _a.current&&_a.current.push(this),this.current}getPrevious(){return this.prev}getVelocity(){let e=tn.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||e-this.updatedAt>ha)return 0;let t=Math.min(this.updatedAt-this.prevUpdatedAt,ha);return xt(parseFloat(this.current)-parseFloat(this.prevFrameValue),t)}start(e){return this.stop(),new Promise(t=>{this.hasAnimated=!0,this.animation=e(t),this.events.animationStart&&this.events.animationStart.notify()}).then(()=>{this.events.animationComplete&&this.events.animationComplete.notify(),this.clearAnimation()})}stop(){this.animation&&(this.animation.stop(),this.events.animationCancel&&this.events.animationCancel.notify()),this.clearAnimation()}isAnimating(){return!!this.animation}clearAnimation(){delete this.animation}destroy(){this.dependents?.clear(),this.events.destroy?.notify(),this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}};function ya(e,t){return new va(e,t)}var{schedule:ba,cancel:xa}=Jt(queueMicrotask,!1),Sa={x:!1,y:!1};function Ca(){return Sa.x||Sa.y}function wa(e){return e===`x`||e===`y`?Sa[e]?null:(Sa[e]=!0,()=>{Sa[e]=!1}):Sa.x||Sa.y?null:(Sa.x=Sa.y=!0,()=>{Sa.x=Sa.y=!1})}function Ta(e,t){let n=fa(e),r=new AbortController;return[n,{passive:!0,...t,signal:r.signal},()=>r.abort()]}function Ea(e){return!(e.pointerType===`touch`||Ca())}function Da(e,t,n={}){let[r,i,a]=Ta(e,n),o=e=>{if(!Ea(e))return;let{target:n}=e,r=t(n,e);if(typeof r!=`function`||!n)return;let a=e=>{Ea(e)&&(r(e),n.removeEventListener(`pointerleave`,a))};n.addEventListener(`pointerleave`,a,i)};return r.forEach(e=>{e.addEventListener(`pointerenter`,o,i)}),a}var Oa=(e,t)=>t?e===t?!0:Oa(e,t.parentElement):!1,ka=e=>e.pointerType===`mouse`?typeof e.button!=`number`||e.button<=0:e.isPrimary!==!1,Aa=new Set([`BUTTON`,`INPUT`,`SELECT`,`TEXTAREA`,`A`]);function ja(e){return Aa.has(e.tagName)||e.isContentEditable===!0}var Ma=new WeakSet;function Na(e){return t=>{t.key===`Enter`&&e(t)}}function Pa(e,t){e.dispatchEvent(new PointerEvent(`pointer`+t,{isPrimary:!0,bubbles:!0}))}var Fa=(e,t)=>{let n=e.currentTarget;if(!n)return;let r=Na(()=>{if(Ma.has(n))return;Pa(n,`down`);let e=Na(()=>{Pa(n,`up`)});n.addEventListener(`keyup`,e,t),n.addEventListener(`blur`,()=>Pa(n,`cancel`),t)});n.addEventListener(`keydown`,r,t),n.addEventListener(`blur`,()=>n.removeEventListener(`keydown`,r),t)};function Ia(e){return ka(e)&&!Ca()}function La(e,t,n={}){let[r,i,a]=Ta(e,n),o=e=>{let r=e.currentTarget;if(!Ia(e))return;Ma.add(r);let a=t(r,e),o=(e,t)=>{window.removeEventListener(`pointerup`,s),window.removeEventListener(`pointercancel`,c),Ma.has(r)&&Ma.delete(r),Ia(e)&&typeof a==`function`&&a(e,{success:t})},s=e=>{o(e,r===window||r===document||n.useGlobalTarget||Oa(r,e.target))},c=e=>{o(e,!1)};window.addEventListener(`pointerup`,s,i),window.addEventListener(`pointercancel`,c,i)};return r.forEach(e=>{(n.useGlobalTarget?window:e).addEventListener(`pointerdown`,o,i),ma(e)&&(e.addEventListener(`focus`,e=>Fa(e,i)),!ja(e)&&!e.hasAttribute(`tabindex`)&&(e.tabIndex=0))}),a}function Ra(e){return dt(e)&&`ownerSVGElement`in e}function za(e){return Ra(e)&&e.tagName===`svg`}var Ba=e=>!!(e&&e.getVelocity),Va=[...Zi,jn,Gn],Ha=e=>Va.find(Xi(e)),Ua=(0,x.createContext)({transformPagePoint:e=>e,isStatic:!1,reducedMotion:`never`});function Wa(e,t){if(typeof e==`function`)return e(t);e!=null&&(e.current=t)}function Ga(...e){return t=>{let n=!1,r=e.map(e=>{let r=Wa(e,t);return!n&&typeof r==`function`&&(n=!0),r});if(n)return()=>{for(let t=0;t<r.length;t++){let n=r[t];typeof n==`function`?n():Wa(e[t],null)}}}}function Ka(...e){return x.useCallback(Ga(...e),e)}var qa=class extends x.Component{getSnapshotBeforeUpdate(e){let t=this.props.childRef.current;if(t&&e.isPresent&&!this.props.isPresent){let e=t.offsetParent,n=ma(e)&&e.offsetWidth||0,r=this.props.sizeRef.current;r.height=t.offsetHeight||0,r.width=t.offsetWidth||0,r.top=t.offsetTop,r.left=t.offsetLeft,r.right=n-r.width-r.left}return null}componentDidUpdate(){}render(){return this.props.children}};function Ja({children:e,isPresent:t,anchorX:n,root:r}){let i=(0,x.useId)(),a=(0,x.useRef)(null),o=(0,x.useRef)({width:0,height:0,top:0,left:0,right:0}),{nonce:s}=(0,x.useContext)(Ua),c=Ka(a,e.props?.ref??e?.ref);return(0,x.useInsertionEffect)(()=>{let{width:e,height:c,top:l,left:u,right:d}=o.current;if(t||!a.current||!e||!c)return;let f=n===`left`?`left: ${u}`:`right: ${d}`;a.current.dataset.motionPopId=i;let p=document.createElement(`style`);s&&(p.nonce=s);let m=r??document.head;return m.appendChild(p),p.sheet&&p.sheet.insertRule(`
|
|
9
9
|
[data-motion-pop-id="${i}"] {
|
|
10
10
|
position: absolute !important;
|
|
11
11
|
width: ${e}px !important;
|
|
@@ -17,10 +17,10 @@ Error generating stack: `+e.message+`
|
|
|
17
17
|
To pick up a draggable item, press the space bar.
|
|
18
18
|
While dragging, use the arrow keys to move the item.
|
|
19
19
|
Press space again to drop the item in its new position, or press escape to cancel.
|
|
20
|
-
`},Zd={onDragStart(e){let{active:t}=e;return`Picked up draggable item `+t.id+`.`},onDragOver(e){let{active:t,over:n}=e;return n?`Draggable item `+t.id+` was moved over droppable area `+n.id+`.`:`Draggable item `+t.id+` is no longer over a droppable area.`},onDragEnd(e){let{active:t,over:n}=e;return n?`Draggable item `+t.id+` was dropped over droppable area `+n.id:`Draggable item `+t.id+` was dropped.`},onDragCancel(e){let{active:t}=e;return`Dragging was cancelled. Draggable item `+t.id+` was dropped.`}};function Qd(e){let{announcements:t=Zd,container:n,hiddenTextDescribedById:r,screenReaderInstructions:i=Xd}=e,{announce:a,announcement:o}=Kd(),s=Md(`DndLiveRegion`),[c,l]=(0,x.useState)(!1);if((0,x.useEffect)(()=>{l(!0)},[]),Jd((0,x.useMemo)(()=>({onDragStart(e){let{active:n}=e;a(t.onDragStart({active:n}))},onDragMove(e){let{active:n,over:r}=e;t.onDragMove&&a(t.onDragMove({active:n,over:r}))},onDragOver(e){let{active:n,over:r}=e;a(t.onDragOver({active:n,over:r}))},onDragEnd(e){let{active:n,over:r}=e;a(t.onDragEnd({active:n,over:r}))},onDragCancel(e){let{active:n,over:r}=e;a(t.onDragCancel({active:n,over:r}))}}),[a,t])),!c)return null;let u=x.createElement(x.Fragment,null,x.createElement(Wd,{id:r,value:i.draggable}),x.createElement(Gd,{id:s,announcement:o}));return n?(0,U.createPortal)(u,n):u}var $d;(function(e){e.DragStart=`dragStart`,e.DragMove=`dragMove`,e.DragEnd=`dragEnd`,e.DragCancel=`dragCancel`,e.DragOver=`dragOver`,e.RegisterDroppable=`registerDroppable`,e.SetDroppableDisabled=`setDroppableDisabled`,e.UnregisterDroppable=`unregisterDroppable`})($d||={});function ef(){}function tf(e,t){return(0,x.useMemo)(()=>({sensor:e,options:t??{}}),[e,t])}function nf(){var e=[...arguments];return(0,x.useMemo)(()=>[...e].filter(e=>e!=null),[...e])}var rf=Object.freeze({x:0,y:0});function af(e,t){return Math.sqrt((e.x-t.x)**2+(e.y-t.y)**2)}function of(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return n-r}function sf(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return r-n}function cf(e,t){if(!e||e.length===0)return null;let[n]=e;return t?n[t]:n}function lf(e,t,n){return t===void 0&&(t=e.left),n===void 0&&(n=e.top),{x:t+e.width*.5,y:n+e.height*.5}}var uf=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e,i=lf(t,t.left,t.top),a=[];for(let e of r){let{id:t}=e,r=n.get(t);if(r){let n=af(lf(r),i);a.push({id:t,data:{droppableContainer:e,value:n}})}}return a.sort(of)};function df(e,t){let n=Math.max(t.top,e.top),r=Math.max(t.left,e.left),i=Math.min(t.left+t.width,e.left+e.width),a=Math.min(t.top+t.height,e.top+e.height),o=i-r,s=a-n;if(r<i&&n<a){let n=t.width*t.height,r=e.width*e.height,i=o*s,a=i/(n+r-i);return Number(a.toFixed(4))}return 0}var ff=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e,i=[];for(let e of r){let{id:r}=e,a=n.get(r);if(a){let n=df(a,t);n>0&&i.push({id:r,data:{droppableContainer:e,value:n}})}}return i.sort(sf)};function pf(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}function mf(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:rf}function hf(e){return function(t){return[...arguments].slice(1).reduce((t,n)=>({...t,top:t.top+e*n.y,bottom:t.bottom+e*n.y,left:t.left+e*n.x,right:t.right+e*n.x}),{...t})}}var gf=hf(1);function _f(e){if(e.startsWith(`matrix3d(`)){let t=e.slice(9,-1).split(/, /);return{x:+t[12],y:+t[13],scaleX:+t[0],scaleY:+t[5]}}else if(e.startsWith(`matrix(`)){let t=e.slice(7,-1).split(/, /);return{x:+t[4],y:+t[5],scaleX:+t[0],scaleY:+t[3]}}return null}function vf(e,t,n){let r=_f(t);if(!r)return e;let{scaleX:i,scaleY:a,x:o,y:s}=r,c=e.left-o-(1-i)*parseFloat(n),l=e.top-s-(1-a)*parseFloat(n.slice(n.indexOf(` `)+1)),u=i?e.width/i:e.width,d=a?e.height/a:e.height;return{width:u,height:d,top:l,right:c+u,bottom:l+d,left:c}}var yf={ignoreTransform:!1};function bf(e,t){t===void 0&&(t=yf);let n=e.getBoundingClientRect();if(t.ignoreTransform){let{transform:t,transformOrigin:r}=yd(e).getComputedStyle(e);t&&(n=vf(n,t,r))}let{top:r,left:i,width:a,height:o,bottom:s,right:c}=n;return{top:r,left:i,width:a,height:o,bottom:s,right:c}}function xf(e){return bf(e,{ignoreTransform:!0})}function Sf(e){let t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}function Cf(e,t){return t===void 0&&(t=yd(e).getComputedStyle(e)),t.position===`fixed`}function wf(e,t){t===void 0&&(t=yd(e).getComputedStyle(e));let n=/(auto|scroll|overlay)/;return[`overflow`,`overflowX`,`overflowY`].some(e=>{let r=t[e];return typeof r==`string`?n.test(r):!1})}function Tf(e,t){let n=[];function r(i){if(t!=null&&n.length>=t||!i)return n;if(bd(i)&&i.scrollingElement!=null&&!n.includes(i.scrollingElement))return n.push(i.scrollingElement),n;if(!xd(i)||Sd(i)||n.includes(i))return n;let a=yd(e).getComputedStyle(i);return i!==e&&wf(i,a)&&n.push(i),Cf(i,a)?n:r(i.parentNode)}return e?r(e):n}function Ef(e){let[t]=Tf(e,1);return t??null}function Df(e){return!gd||!e?null:_d(e)?e:vd(e)?bd(e)||e===Cd(e).scrollingElement?window:xd(e)?e:null:null}function Of(e){return _d(e)?e.scrollX:e.scrollLeft}function kf(e){return _d(e)?e.scrollY:e.scrollTop}function Af(e){return{x:Of(e),y:kf(e)}}var jf;(function(e){e[e.Forward=1]=`Forward`,e[e.Backward=-1]=`Backward`})(jf||={});function Mf(e){return!gd||!e?!1:e===document.scrollingElement}function Nf(e){let t={x:0,y:0},n=Mf(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},r={x:e.scrollWidth-n.width,y:e.scrollHeight-n.height};return{isTop:e.scrollTop<=t.y,isLeft:e.scrollLeft<=t.x,isBottom:e.scrollTop>=r.y,isRight:e.scrollLeft>=r.x,maxScroll:r,minScroll:t}}var Pf={x:.2,y:.2};function Ff(e,t,n,r,i){let{top:a,left:o,right:s,bottom:c}=n;r===void 0&&(r=10),i===void 0&&(i=Pf);let{isTop:l,isBottom:u,isLeft:d,isRight:f}=Nf(e),p={x:0,y:0},m={x:0,y:0},h={height:t.height*i.y,width:t.width*i.x};return!l&&a<=t.top+h.height?(p.y=jf.Backward,m.y=r*Math.abs((t.top+h.height-a)/h.height)):!u&&c>=t.bottom-h.height&&(p.y=jf.Forward,m.y=r*Math.abs((t.bottom-h.height-c)/h.height)),!f&&s>=t.right-h.width?(p.x=jf.Forward,m.x=r*Math.abs((t.right-h.width-s)/h.width)):!d&&o<=t.left+h.width&&(p.x=jf.Backward,m.x=r*Math.abs((t.left+h.width-o)/h.width)),{direction:p,speed:m}}function If(e){if(e===document.scrollingElement){let{innerWidth:e,innerHeight:t}=window;return{top:0,left:0,right:e,bottom:t,width:e,height:t}}let{top:t,left:n,right:r,bottom:i}=e.getBoundingClientRect();return{top:t,left:n,right:r,bottom:i,width:e.clientWidth,height:e.clientHeight}}function Lf(e){return e.reduce((e,t)=>Pd(e,Af(t)),rf)}function Rf(e){return e.reduce((e,t)=>e+Of(t),0)}function zf(e){return e.reduce((e,t)=>e+kf(t),0)}function Bf(e,t){if(t===void 0&&(t=bf),!e)return;let{top:n,left:r,bottom:i,right:a}=t(e);Ef(e)&&(i<=0||a<=0||n>=window.innerHeight||r>=window.innerWidth)&&e.scrollIntoView({block:`center`,inline:`center`})}var Vf=[[`x`,[`left`,`right`],Rf],[`y`,[`top`,`bottom`],zf]],Hf=class{constructor(e,t){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;let n=Tf(t),r=Lf(n);this.rect={...e},this.width=e.width,this.height=e.height;for(let[e,t,i]of Vf)for(let a of t)Object.defineProperty(this,a,{get:()=>{let t=i(n),o=r[e]-t;return this.rect[a]+o},enumerable:!0});Object.defineProperty(this,`rect`,{enumerable:!1})}},Uf=class{constructor(e){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(e=>this.target?.removeEventListener(...e))},this.target=e}add(e,t,n){var r;(r=this.target)==null||r.addEventListener(e,t,n),this.listeners.push([e,t,n])}};function Wf(e){let{EventTarget:t}=yd(e);return e instanceof t?e:Cd(e)}function Gf(e,t){let n=Math.abs(e.x),r=Math.abs(e.y);return typeof t==`number`?Math.sqrt(n**2+r**2)>t:`x`in t&&`y`in t?n>t.x&&r>t.y:`x`in t?n>t.x:`y`in t?r>t.y:!1}var Kf;(function(e){e.Click=`click`,e.DragStart=`dragstart`,e.Keydown=`keydown`,e.ContextMenu=`contextmenu`,e.Resize=`resize`,e.SelectionChange=`selectionchange`,e.VisibilityChange=`visibilitychange`})(Kf||={});function qf(e){e.preventDefault()}function Jf(e){e.stopPropagation()}var Yf;(function(e){e.Space=`Space`,e.Down=`ArrowDown`,e.Right=`ArrowRight`,e.Left=`ArrowLeft`,e.Up=`ArrowUp`,e.Esc=`Escape`,e.Enter=`Enter`,e.Tab=`Tab`})(Yf||={});var Xf={start:[Yf.Space,Yf.Enter],cancel:[Yf.Esc],end:[Yf.Space,Yf.Enter,Yf.Tab]},Zf=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case Yf.Right:return{...n,x:n.x+25};case Yf.Left:return{...n,x:n.x-25};case Yf.Down:return{...n,y:n.y+25};case Yf.Up:return{...n,y:n.y-25}}},Qf=class{constructor(e){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=e;let{event:{target:t}}=e;this.props=e,this.listeners=new Uf(Cd(t)),this.windowListeners=new Uf(yd(t)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(Kf.Resize,this.handleCancel),this.windowListeners.add(Kf.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(Kf.Keydown,this.handleKeyDown))}handleStart(){let{activeNode:e,onStart:t}=this.props,n=e.node.current;n&&Bf(n),t(rf)}handleKeyDown(e){if(Ld(e)){let{active:t,context:n,options:r}=this.props,{keyboardCodes:i=Xf,coordinateGetter:a=Zf,scrollBehavior:o=`smooth`}=r,{code:s}=e;if(i.end.includes(s)){this.handleEnd(e);return}if(i.cancel.includes(s)){this.handleCancel(e);return}let{collisionRect:c}=n.current,l=c?{x:c.left,y:c.top}:rf;this.referenceCoordinates||=l;let u=a(e,{active:t,context:n.current,currentCoordinates:l});if(u){let t=Fd(u,l),r={x:0,y:0},{scrollableAncestors:i}=n.current;for(let n of i){let i=e.code,{isTop:a,isRight:s,isLeft:c,isBottom:l,maxScroll:d,minScroll:f}=Nf(n),p=If(n),m={x:Math.min(i===Yf.Right?p.right-p.width/2:p.right,Math.max(i===Yf.Right?p.left:p.left+p.width/2,u.x)),y:Math.min(i===Yf.Down?p.bottom-p.height/2:p.bottom,Math.max(i===Yf.Down?p.top:p.top+p.height/2,u.y))},h=i===Yf.Right&&!s||i===Yf.Left&&!c,g=i===Yf.Down&&!l||i===Yf.Up&&!a;if(h&&m.x!==u.x){let e=n.scrollLeft+t.x,a=i===Yf.Right&&e<=d.x||i===Yf.Left&&e>=f.x;if(a&&!t.y){n.scrollTo({left:e,behavior:o});return}a?r.x=n.scrollLeft-e:r.x=i===Yf.Right?n.scrollLeft-d.x:n.scrollLeft-f.x,r.x&&n.scrollBy({left:-r.x,behavior:o});break}else if(g&&m.y!==u.y){let e=n.scrollTop+t.y,a=i===Yf.Down&&e<=d.y||i===Yf.Up&&e>=f.y;if(a&&!t.x){n.scrollTo({top:e,behavior:o});return}a?r.y=n.scrollTop-e:r.y=i===Yf.Down?n.scrollTop-d.y:n.scrollTop-f.y,r.y&&n.scrollBy({top:-r.y,behavior:o});break}}this.handleMove(e,Pd(Fd(u,this.referenceCoordinates),r))}}}handleMove(e,t){let{onMove:n}=this.props;e.preventDefault(),n(t)}handleEnd(e){let{onEnd:t}=this.props;e.preventDefault(),this.detach(),t()}handleCancel(e){let{onCancel:t}=this.props;e.preventDefault(),this.detach(),t()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}};Qf.activators=[{eventName:`onKeyDown`,handler:(e,t,n)=>{let{keyboardCodes:r=Xf,onActivation:i}=t,{active:a}=n,{code:o}=e.nativeEvent;if(r.start.includes(o)){let t=a.activatorNode.current;return t&&e.target!==t?!1:(e.preventDefault(),i?.({event:e.nativeEvent}),!0)}return!1}}];function $f(e){return!!(e&&`distance`in e)}function ep(e){return!!(e&&`delay`in e)}var tp=class{constructor(e,t,n){n===void 0&&(n=Wf(e.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=e,this.events=t;let{event:r}=e,{target:i}=r;this.props=e,this.events=t,this.document=Cd(i),this.documentListeners=new Uf(this.document),this.listeners=new Uf(n),this.windowListeners=new Uf(yd(i)),this.initialCoordinates=zd(r)??rf,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){let{events:e,props:{options:{activationConstraint:t,bypassActivationConstraint:n}}}=this;if(this.listeners.add(e.move.name,this.handleMove,{passive:!1}),this.listeners.add(e.end.name,this.handleEnd),e.cancel&&this.listeners.add(e.cancel.name,this.handleCancel),this.windowListeners.add(Kf.Resize,this.handleCancel),this.windowListeners.add(Kf.DragStart,qf),this.windowListeners.add(Kf.VisibilityChange,this.handleCancel),this.windowListeners.add(Kf.ContextMenu,qf),this.documentListeners.add(Kf.Keydown,this.handleKeydown),t){if(n!=null&&n({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(ep(t)){this.timeoutId=setTimeout(this.handleStart,t.delay),this.handlePending(t);return}if($f(t)){this.handlePending(t);return}}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handlePending(e,t){let{active:n,onPending:r}=this.props;r(n,e,this.initialCoordinates,t)}handleStart(){let{initialCoordinates:e}=this,{onStart:t}=this.props;e&&(this.activated=!0,this.documentListeners.add(Kf.Click,Jf,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(Kf.SelectionChange,this.removeTextSelection),t(e))}handleMove(e){let{activated:t,initialCoordinates:n,props:r}=this,{onMove:i,options:{activationConstraint:a}}=r;if(!n)return;let o=zd(e)??rf,s=Fd(n,o);if(!t&&a){if($f(a)){if(a.tolerance!=null&&Gf(s,a.tolerance))return this.handleCancel();if(Gf(s,a.distance))return this.handleStart()}if(ep(a)&&Gf(s,a.tolerance))return this.handleCancel();this.handlePending(a,s);return}e.cancelable&&e.preventDefault(),i(o)}handleEnd(){let{onAbort:e,onEnd:t}=this.props;this.detach(),this.activated||e(this.props.active),t()}handleCancel(){let{onAbort:e,onCancel:t}=this.props;this.detach(),this.activated||e(this.props.active),t()}handleKeydown(e){e.code===Yf.Esc&&this.handleCancel()}removeTextSelection(){var e;(e=this.document.getSelection())==null||e.removeAllRanges()}},np={cancel:{name:`pointercancel`},move:{name:`pointermove`},end:{name:`pointerup`}},rp=class extends tp{constructor(e){let{event:t}=e,n=Cd(t.target);super(e,np,n)}};rp.activators=[{eventName:`onPointerDown`,handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return!n.isPrimary||n.button!==0?!1:(r?.({event:n}),!0)}}];var ip={move:{name:`mousemove`},end:{name:`mouseup`}},ap;(function(e){e[e.RightClick=2]=`RightClick`})(ap||={});var op=class extends tp{constructor(e){super(e,ip,Cd(e.event.target))}};op.activators=[{eventName:`onMouseDown`,handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return n.button===ap.RightClick?!1:(r?.({event:n}),!0)}}];var sp={cancel:{name:`touchcancel`},move:{name:`touchmove`},end:{name:`touchend`}},cp=class extends tp{constructor(e){super(e,sp)}static setup(){return window.addEventListener(sp.move.name,e,{capture:!1,passive:!1}),function(){window.removeEventListener(sp.move.name,e)};function e(){}}};cp.activators=[{eventName:`onTouchStart`,handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t,{touches:i}=n;return i.length>1?!1:(r?.({event:n}),!0)}}];var lp;(function(e){e[e.Pointer=0]=`Pointer`,e[e.DraggableRect=1]=`DraggableRect`})(lp||={});var up;(function(e){e[e.TreeOrder=0]=`TreeOrder`,e[e.ReversedTreeOrder=1]=`ReversedTreeOrder`})(up||={});function dp(e){let{acceleration:t,activator:n=lp.Pointer,canScroll:r,draggingRect:i,enabled:a,interval:o=5,order:s=up.TreeOrder,pointerCoordinates:c,scrollableAncestors:l,scrollableAncestorRects:u,delta:d,threshold:f}=e,p=pp({delta:d,disabled:!a}),[m,h]=Ed(),g=(0,x.useRef)({x:0,y:0}),_=(0,x.useRef)({x:0,y:0}),v=(0,x.useMemo)(()=>{switch(n){case lp.Pointer:return c?{top:c.y,bottom:c.y,left:c.x,right:c.x}:null;case lp.DraggableRect:return i}},[n,i,c]),y=(0,x.useRef)(null),b=(0,x.useCallback)(()=>{let e=y.current;if(!e)return;let t=g.current.x*_.current.x,n=g.current.y*_.current.y;e.scrollBy(t,n)},[]),S=(0,x.useMemo)(()=>s===up.TreeOrder?[...l].reverse():l,[s,l]);(0,x.useEffect)(()=>{if(!a||!l.length||!v){h();return}for(let e of S){if(r?.(e)===!1)continue;let n=u[l.indexOf(e)];if(!n)continue;let{direction:i,speed:a}=Ff(e,n,v,t,f);for(let e of[`x`,`y`])p[e][i[e]]||(a[e]=0,i[e]=0);if(a.x>0||a.y>0){h(),y.current=e,m(b,o),g.current=a,_.current=i;return}}g.current={x:0,y:0},_.current={x:0,y:0},h()},[t,b,r,h,a,o,JSON.stringify(v),JSON.stringify(p),m,l,S,u,JSON.stringify(f)])}var fp={x:{[jf.Backward]:!1,[jf.Forward]:!1},y:{[jf.Backward]:!1,[jf.Forward]:!1}};function pp(e){let{delta:t,disabled:n}=e,r=Ad(t);return Od(e=>{if(n||!r||!e)return fp;let i={x:Math.sign(t.x-r.x),y:Math.sign(t.y-r.y)};return{x:{[jf.Backward]:e.x[jf.Backward]||i.x===-1,[jf.Forward]:e.x[jf.Forward]||i.x===1},y:{[jf.Backward]:e.y[jf.Backward]||i.y===-1,[jf.Forward]:e.y[jf.Forward]||i.y===1}}},[n,t,r])}function mp(e,t){let n=t==null?void 0:e.get(t),r=n?n.node.current:null;return Od(e=>t==null?null:r??e??null,[r,t])}function hp(e,t){return(0,x.useMemo)(()=>e.reduce((e,n)=>{let{sensor:r}=n,i=r.activators.map(e=>({eventName:e.eventName,handler:t(e.handler,n)}));return[...e,...i]},[]),[e,t])}var gp;(function(e){e[e.Always=0]=`Always`,e[e.BeforeDragging=1]=`BeforeDragging`,e[e.WhileDragging=2]=`WhileDragging`})(gp||={});var _p;(function(e){e.Optimized=`optimized`})(_p||={});var vp=new Map;function yp(e,t){let{dragging:n,dependencies:r,config:i}=t,[a,o]=(0,x.useState)(null),{frequency:s,measure:c,strategy:l}=i,u=(0,x.useRef)(e),d=g(),f=Dd(d),p=(0,x.useCallback)(function(e){e===void 0&&(e=[]),!f.current&&o(t=>t===null?e:t.concat(e.filter(e=>!t.includes(e))))},[f]),m=(0,x.useRef)(null),h=Od(t=>{if(d&&!n)return vp;if(!t||t===vp||u.current!==e||a!=null){let t=new Map;for(let n of e){if(!n)continue;if(a&&a.length>0&&!a.includes(n.id)&&n.rect.current){t.set(n.id,n.rect.current);continue}let e=n.node.current,r=e?new Hf(c(e),e):null;n.rect.current=r,r&&t.set(n.id,r)}return t}return t},[e,a,n,d,c]);return(0,x.useEffect)(()=>{u.current=e},[e]),(0,x.useEffect)(()=>{d||p()},[n,d]),(0,x.useEffect)(()=>{a&&a.length>0&&o(null)},[JSON.stringify(a)]),(0,x.useEffect)(()=>{d||typeof s!=`number`||m.current!==null||(m.current=setTimeout(()=>{p(),m.current=null},s))},[s,d,p,...r]),{droppableRects:h,measureDroppableContainers:p,measuringScheduled:a!=null};function g(){switch(l){case gp.Always:return!1;case gp.BeforeDragging:return n;default:return!n}}}function bp(e,t){return Od(n=>e?n||(typeof t==`function`?t(e):e):null,[t,e])}function xp(e,t){return bp(e,t)}function Sp(e){let{callback:t,disabled:n}=e,r=Td(t),i=(0,x.useMemo)(()=>{if(n||typeof window>`u`||window.MutationObserver===void 0)return;let{MutationObserver:e}=window;return new e(r)},[r,n]);return(0,x.useEffect)(()=>()=>i?.disconnect(),[i]),i}function Cp(e){let{callback:t,disabled:n}=e,r=Td(t),i=(0,x.useMemo)(()=>{if(n||typeof window>`u`||window.ResizeObserver===void 0)return;let{ResizeObserver:e}=window;return new e(r)},[n]);return(0,x.useEffect)(()=>()=>i?.disconnect(),[i]),i}function wp(e){return new Hf(bf(e),e)}function Tp(e,t,n){t===void 0&&(t=wp);let[r,i]=(0,x.useState)(null);function a(){i(r=>{if(!e)return null;if(e.isConnected===!1)return r??n??null;let i=t(e);return JSON.stringify(r)===JSON.stringify(i)?r:i})}let o=Sp({callback(t){if(e)for(let n of t){let{type:t,target:r}=n;if(t===`childList`&&r instanceof HTMLElement&&r.contains(e)){a();break}}}}),s=Cp({callback:a});return wd(()=>{a(),e?(s?.observe(e),o?.observe(document.body,{childList:!0,subtree:!0})):(s?.disconnect(),o?.disconnect())},[e]),r}function Ep(e){return mf(e,bp(e))}var Dp=[];function Op(e){let t=(0,x.useRef)(e),n=Od(n=>e?n&&n!==Dp&&e&&t.current&&e.parentNode===t.current.parentNode?n:Tf(e):Dp,[e]);return(0,x.useEffect)(()=>{t.current=e},[e]),n}function kp(e){let[t,n]=(0,x.useState)(null),r=(0,x.useRef)(e),i=(0,x.useCallback)(e=>{let t=Df(e.target);t&&n(e=>e?(e.set(t,Af(t)),new Map(e)):null)},[]);return(0,x.useEffect)(()=>{let t=r.current;if(e!==t){a(t);let o=e.map(e=>{let t=Df(e);return t?(t.addEventListener(`scroll`,i,{passive:!0}),[t,Af(t)]):null}).filter(e=>e!=null);n(o.length?new Map(o):null),r.current=e}return()=>{a(e),a(t)};function a(e){e.forEach(e=>{Df(e)?.removeEventListener(`scroll`,i)})}},[i,e]),(0,x.useMemo)(()=>e.length?t?Array.from(t.values()).reduce((e,t)=>Pd(e,t),rf):Lf(e):rf,[e,t])}function Ap(e,t){t===void 0&&(t=[]);let n=(0,x.useRef)(null);return(0,x.useEffect)(()=>{n.current=null},t),(0,x.useEffect)(()=>{let t=e!==rf;t&&!n.current&&(n.current=e),!t&&n.current&&(n.current=null)},[e]),n.current?Fd(e,n.current):rf}function jp(e){(0,x.useEffect)(()=>{if(!gd)return;let t=e.map(e=>{let{sensor:t}=e;return t.setup==null?void 0:t.setup()});return()=>{for(let e of t)e?.()}},e.map(e=>{let{sensor:t}=e;return t}))}function Mp(e,t){return(0,x.useMemo)(()=>e.reduce((e,n)=>{let{eventName:r,handler:i}=n;return e[r]=e=>{i(e,t)},e},{}),[e,t])}function Np(e){return(0,x.useMemo)(()=>e?Sf(e):null,[e])}var Pp=[];function Fp(e,t){t===void 0&&(t=bf);let[n]=e,r=Np(n?yd(n):null),[i,a]=(0,x.useState)(Pp);function o(){a(()=>e.length?e.map(e=>Mf(e)?r:new Hf(t(e),e)):Pp)}let s=Cp({callback:o});return wd(()=>{s?.disconnect(),o(),e.forEach(e=>s?.observe(e))},[e]),i}function Ip(e){if(!e)return null;if(e.children.length>1)return e;let t=e.children[0];return xd(t)?t:e}function Lp(e){let{measure:t}=e,[n,r]=(0,x.useState)(null),i=Cp({callback:(0,x.useCallback)(e=>{for(let{target:n}of e)if(xd(n)){r(e=>{let r=t(n);return e?{...e,width:r.width,height:r.height}:r});break}},[t])}),[a,o]=kd((0,x.useCallback)(e=>{let n=Ip(e);i?.disconnect(),n&&i?.observe(n),r(n?t(n):null)},[t,i]));return(0,x.useMemo)(()=>({nodeRef:a,rect:n,setRef:o}),[n,a,o])}var Rp=[{sensor:rp,options:{}},{sensor:Qf,options:{}}],zp={current:{}},Bp={draggable:{measure:xf},droppable:{measure:xf,strategy:gp.WhileDragging,frequency:_p.Optimized},dragOverlay:{measure:bf}},Vp=class extends Map{get(e){return e==null?void 0:super.get(e)??void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(e=>{let{disabled:t}=e;return!t})}getNodeFor(e){return this.get(e)?.node.current??void 0}},Hp={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new Vp,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:ef},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:Bp,measureDroppableContainers:ef,windowRect:null,measuringScheduled:!1},Up={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:``},dispatch:ef,draggableNodes:new Map,over:null,measureDroppableContainers:ef},Wp=(0,x.createContext)(Up),Gp=(0,x.createContext)(Hp);function Kp(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new Vp}}}function qp(e,t){switch(t.type){case $d.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case $d.DragMove:return e.draggable.active==null?e:{...e,draggable:{...e.draggable,translate:{x:t.coordinates.x-e.draggable.initialCoordinates.x,y:t.coordinates.y-e.draggable.initialCoordinates.y}}};case $d.DragEnd:case $d.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case $d.RegisterDroppable:{let{element:n}=t,{id:r}=n,i=new Vp(e.droppable.containers);return i.set(r,n),{...e,droppable:{...e.droppable,containers:i}}}case $d.SetDroppableDisabled:{let{id:n,key:r,disabled:i}=t,a=e.droppable.containers.get(n);if(!a||r!==a.key)return e;let o=new Vp(e.droppable.containers);return o.set(n,{...a,disabled:i}),{...e,droppable:{...e.droppable,containers:o}}}case $d.UnregisterDroppable:{let{id:n,key:r}=t,i=e.droppable.containers.get(n);if(!i||r!==i.key)return e;let a=new Vp(e.droppable.containers);return a.delete(n),{...e,droppable:{...e.droppable,containers:a}}}default:return e}}function Jp(e){let{disabled:t}=e,{active:n,activatorEvent:r,draggableNodes:i}=(0,x.useContext)(Wp),a=Ad(r),o=Ad(n?.id);return(0,x.useEffect)(()=>{if(!t&&!r&&a&&o!=null){if(!Ld(a)||document.activeElement===a.target)return;let e=i.get(o);if(!e)return;let{activatorNode:t,node:n}=e;if(!t.current&&!n.current)return;requestAnimationFrame(()=>{for(let e of[t.current,n.current]){if(!e)continue;let t=Hd(e);if(t){t.focus();break}}})}},[r,t,i,o,a]),null}function Yp(e,t){let{transform:n,...r}=t;return e!=null&&e.length?e.reduce((e,t)=>t({transform:e,...r}),n):n}function Xp(e){return(0,x.useMemo)(()=>({draggable:{...Bp.draggable,...e?.draggable},droppable:{...Bp.droppable,...e?.droppable},dragOverlay:{...Bp.dragOverlay,...e?.dragOverlay}}),[e?.draggable,e?.droppable,e?.dragOverlay])}function Zp(e){let{activeNode:t,measure:n,initialRect:r,config:i=!0}=e,a=(0,x.useRef)(!1),{x:o,y:s}=typeof i==`boolean`?{x:i,y:i}:i;wd(()=>{if(!o&&!s||!t){a.current=!1;return}if(a.current||!r)return;let e=t?.node.current;if(!e||e.isConnected===!1)return;let i=mf(n(e),r);if(o||(i.x=0),s||(i.y=0),a.current=!0,Math.abs(i.x)>0||Math.abs(i.y)>0){let t=Ef(e);t&&t.scrollBy({top:i.y,left:i.x})}},[t,o,s,r,n])}var Qp=(0,x.createContext)({...rf,scaleX:1,scaleY:1}),$p;(function(e){e[e.Uninitialized=0]=`Uninitialized`,e[e.Initializing=1]=`Initializing`,e[e.Initialized=2]=`Initialized`})($p||={});var em=(0,x.memo)(function(e){let{id:t,accessibility:n,autoScroll:r=!0,children:i,sensors:a=Rp,collisionDetection:o=ff,measuring:s,modifiers:c,...l}=e,[u,d]=(0,x.useReducer)(qp,void 0,Kp),[f,p]=Yd(),[m,h]=(0,x.useState)($p.Uninitialized),g=m===$p.Initialized,{draggable:{active:_,nodes:v,translate:y},droppable:{containers:b}}=u,S=_==null?null:v.get(_),C=(0,x.useRef)({initial:null,translated:null}),w=(0,x.useMemo)(()=>_==null?null:{id:_,data:S?.data??zp,rect:C},[_,S]),T=(0,x.useRef)(null),[E,D]=(0,x.useState)(null),[O,k]=(0,x.useState)(null),A=Dd(l,Object.values(l)),j=Md(`DndDescribedBy`,t),M=(0,x.useMemo)(()=>b.getEnabled(),[b]),N=Xp(s),{droppableRects:P,measureDroppableContainers:F,measuringScheduled:I}=yp(M,{dragging:g,dependencies:[y.x,y.y],config:N.droppable}),L=mp(v,_),ee=(0,x.useMemo)(()=>O?zd(O):null,[O]),R=Ee(),z=xp(L,N.draggable.measure);Zp({activeNode:_==null?null:v.get(_),config:R.layoutShiftCompensation,initialRect:z,measure:N.draggable.measure});let B=Tp(L,N.draggable.measure,z),te=Tp(L?L.parentElement:null),V=(0,x.useRef)({activatorEvent:null,active:null,activeNode:L,collisionRect:null,collisions:null,droppableRects:P,draggableNodes:v,draggingNode:null,draggingNodeRect:null,droppableContainers:b,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),ne=b.getNodeFor(V.current.over?.id),H=Lp({measure:N.dragOverlay.measure}),re=H.nodeRef.current??L,ie=g?H.rect??B:null,W=!!(H.nodeRef.current&&H.rect),ae=Ep(W?null:B),oe=Np(re?yd(re):null),se=Op(g?ne??L:null),ce=Fp(se),le=Yp(c,{transform:{x:y.x-ae.x,y:y.y-ae.y,scaleX:1,scaleY:1},activatorEvent:O,active:w,activeNodeRect:B,containerNodeRect:te,draggingNodeRect:ie,over:V.current.over,overlayNodeRect:H.rect,scrollableAncestors:se,scrollableAncestorRects:ce,windowRect:oe}),ue=ee?Pd(ee,y):null,de=kp(se),fe=Ap(de),pe=Ap(de,[B]),me=Pd(le,fe),he=ie?gf(ie,le):null,ge=w&&he?o({active:w,collisionRect:he,droppableRects:P,droppableContainers:M,pointerCoordinates:ue}):null,_e=cf(ge,`id`),[ve,ye]=(0,x.useState)(null),be=pf(W?le:Pd(le,pe),ve?.rect??null,B),xe=(0,x.useRef)(null),Se=(0,x.useCallback)((e,t)=>{let{sensor:n,options:r}=t;if(T.current==null)return;let i=v.get(T.current);if(!i)return;let a=e.nativeEvent;xe.current=new n({active:T.current,activeNode:i,event:a,options:r,context:V,onAbort(e){if(!v.get(e))return;let{onDragAbort:t}=A.current,n={id:e};t?.(n),f({type:`onDragAbort`,event:n})},onPending(e,t,n,r){if(!v.get(e))return;let{onDragPending:i}=A.current,a={id:e,constraint:t,initialCoordinates:n,offset:r};i?.(a),f({type:`onDragPending`,event:a})},onStart(e){let t=T.current;if(t==null)return;let n=v.get(t);if(!n)return;let{onDragStart:r}=A.current,i={activatorEvent:a,active:{id:t,data:n.data,rect:C}};(0,U.unstable_batchedUpdates)(()=>{r?.(i),h($p.Initializing),d({type:$d.DragStart,initialCoordinates:e,active:t}),f({type:`onDragStart`,event:i}),D(xe.current),k(a)})},onMove(e){d({type:$d.DragMove,coordinates:e})},onEnd:o($d.DragEnd),onCancel:o($d.DragCancel)});function o(e){return async function(){let{active:t,collisions:n,over:r,scrollAdjustedTranslate:i}=V.current,o=null;if(t&&i){let{cancelDrop:s}=A.current;o={activatorEvent:a,active:t,collisions:n,delta:i,over:r},e===$d.DragEnd&&typeof s==`function`&&await Promise.resolve(s(o))&&(e=$d.DragCancel)}T.current=null,(0,U.unstable_batchedUpdates)(()=>{d({type:e}),h($p.Uninitialized),ye(null),D(null),k(null),xe.current=null;let t=e===$d.DragEnd?`onDragEnd`:`onDragCancel`;if(o){let e=A.current[t];e?.(o),f({type:t,event:o})}})}}},[v]),Ce=hp(a,(0,x.useCallback)((e,t)=>(n,r)=>{let i=n.nativeEvent,a=v.get(r);if(T.current!==null||!a||i.dndKit||i.defaultPrevented)return;let o={active:a};e(n,t.options,o)===!0&&(i.dndKit={capturedBy:t.sensor},T.current=r,Se(n,t))},[v,Se]));jp(a),wd(()=>{B&&m===$p.Initializing&&h($p.Initialized)},[B,m]),(0,x.useEffect)(()=>{let{onDragMove:e}=A.current,{active:t,activatorEvent:n,collisions:r,over:i}=V.current;if(!t||!n)return;let a={active:t,activatorEvent:n,collisions:r,delta:{x:me.x,y:me.y},over:i};(0,U.unstable_batchedUpdates)(()=>{e?.(a),f({type:`onDragMove`,event:a})})},[me.x,me.y]),(0,x.useEffect)(()=>{let{active:e,activatorEvent:t,collisions:n,droppableContainers:r,scrollAdjustedTranslate:i}=V.current;if(!e||T.current==null||!t||!i)return;let{onDragOver:a}=A.current,o=r.get(_e),s=o&&o.rect.current?{id:o.id,rect:o.rect.current,data:o.data,disabled:o.disabled}:null,c={active:e,activatorEvent:t,collisions:n,delta:{x:i.x,y:i.y},over:s};(0,U.unstable_batchedUpdates)(()=>{ye(s),a?.(c),f({type:`onDragOver`,event:c})})},[_e]),wd(()=>{V.current={activatorEvent:O,active:w,activeNode:L,collisionRect:he,collisions:ge,droppableRects:P,draggableNodes:v,draggingNode:re,draggingNodeRect:ie,droppableContainers:b,over:ve,scrollableAncestors:se,scrollAdjustedTranslate:me},C.current={initial:ie,translated:he}},[w,L,ge,he,v,re,ie,P,b,ve,se,me]),dp({...R,delta:y,draggingRect:he,pointerCoordinates:ue,scrollableAncestors:se,scrollableAncestorRects:ce});let we=(0,x.useMemo)(()=>({active:w,activeNode:L,activeNodeRect:B,activatorEvent:O,collisions:ge,containerNodeRect:te,dragOverlay:H,draggableNodes:v,droppableContainers:b,droppableRects:P,over:ve,measureDroppableContainers:F,scrollableAncestors:se,scrollableAncestorRects:ce,measuringConfiguration:N,measuringScheduled:I,windowRect:oe}),[w,L,B,O,ge,te,H,v,b,P,ve,F,se,ce,N,I,oe]),Te=(0,x.useMemo)(()=>({activatorEvent:O,activators:Ce,active:w,activeNodeRect:B,ariaDescribedById:{draggable:j},dispatch:d,draggableNodes:v,over:ve,measureDroppableContainers:F}),[O,Ce,w,B,d,j,v,ve,F]);return x.createElement(qd.Provider,{value:p},x.createElement(Wp.Provider,{value:Te},x.createElement(Gp.Provider,{value:we},x.createElement(Qp.Provider,{value:be},i)),x.createElement(Jp,{disabled:n?.restoreFocus===!1})),x.createElement(Qd,{...n,hiddenTextDescribedById:j}));function Ee(){let e=E?.autoScrollEnabled===!1,t=typeof r==`object`?r.enabled===!1:r===!1,n=g&&!e&&!t;return typeof r==`object`?{...r,enabled:n}:{enabled:n}}}),tm=(0,x.createContext)(null),nm=`button`,rm=`Draggable`;function im(e){let{id:t,data:n,disabled:r=!1,attributes:i}=e,a=Md(rm),{activators:o,activatorEvent:s,active:c,activeNodeRect:l,ariaDescribedById:u,draggableNodes:d,over:f}=(0,x.useContext)(Wp),{role:p=nm,roleDescription:m=`draggable`,tabIndex:h=0}=i??{},g=c?.id===t,_=(0,x.useContext)(g?Qp:tm),[v,y]=kd(),[b,S]=kd(),C=Mp(o,t),w=Dd(n);return wd(()=>(d.set(t,{id:t,key:a,node:v,activatorNode:b,data:w}),()=>{let e=d.get(t);e&&e.key===a&&d.delete(t)}),[d,t]),{active:c,activatorEvent:s,activeNodeRect:l,attributes:(0,x.useMemo)(()=>({role:p,tabIndex:h,"aria-disabled":r,"aria-pressed":g&&p===nm?!0:void 0,"aria-roledescription":m,"aria-describedby":u.draggable}),[r,p,h,g,m,u.draggable]),isDragging:g,listeners:r?void 0:C,node:v,over:f,setNodeRef:y,setActivatorNodeRef:S,transform:_}}function am(){return(0,x.useContext)(Gp)}var om=`Droppable`,sm={timeout:25};function cm(e){let{data:t,disabled:n=!1,id:r,resizeObserverConfig:i}=e,a=Md(om),{active:o,dispatch:s,over:c,measureDroppableContainers:l}=(0,x.useContext)(Wp),u=(0,x.useRef)({disabled:n}),d=(0,x.useRef)(!1),f=(0,x.useRef)(null),p=(0,x.useRef)(null),{disabled:m,updateMeasurementsFor:h,timeout:g}={...sm,...i},_=Dd(h??r),v=Cp({callback:(0,x.useCallback)(()=>{if(!d.current){d.current=!0;return}p.current!=null&&clearTimeout(p.current),p.current=setTimeout(()=>{l(Array.isArray(_.current)?_.current:[_.current]),p.current=null},g)},[g]),disabled:m||!o}),[y,b]=kd((0,x.useCallback)((e,t)=>{v&&(t&&(v.unobserve(t),d.current=!1),e&&v.observe(e))},[v])),S=Dd(t);return(0,x.useEffect)(()=>{!v||!y.current||(v.disconnect(),d.current=!1,v.observe(y.current))},[y,v]),(0,x.useEffect)(()=>(s({type:$d.RegisterDroppable,element:{id:r,key:a,disabled:n,node:y,rect:f,data:S}}),()=>s({type:$d.UnregisterDroppable,key:a,id:r})),[r]),(0,x.useEffect)(()=>{n!==u.current.disabled&&(s({type:$d.SetDroppableDisabled,id:r,key:a,disabled:n}),u.current.disabled=n)},[r,a,n,s]),{active:o,rect:f,isOver:c?.id===r,node:y,over:c,setNodeRef:b}}function lm(e,t,n){let r=e.slice();return r.splice(n<0?r.length+n:n,0,r.splice(t,1)[0]),r}function um(e,t){return e.reduce((e,n,r)=>{let i=t.get(n);return i&&(e[r]=i),e},Array(e.length))}function dm(e){return e!==null&&e>=0}function fm(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function pm(e){return typeof e==`boolean`?{draggable:e,droppable:e}:e}var mm=e=>{let{rects:t,activeIndex:n,overIndex:r,index:i}=e,a=lm(t,r,n),o=t[i],s=a[i];return!s||!o?null:{x:s.left-o.left,y:s.top-o.top,scaleX:s.width/o.width,scaleY:s.height/o.height}},hm={scaleX:1,scaleY:1},gm=e=>{let{activeIndex:t,activeNodeRect:n,index:r,rects:i,overIndex:a}=e,o=i[t]??n;if(!o)return null;if(r===t){let e=i[a];return e?{x:0,y:t<a?e.top+e.height-(o.top+o.height):e.top-o.top,...hm}:null}let s=_m(i,r,t);return r>t&&r<=a?{x:0,y:-o.height-s,...hm}:r<t&&r>=a?{x:0,y:o.height+s,...hm}:{x:0,y:0,...hm}};function _m(e,t,n){let r=e[t],i=e[t-1],a=e[t+1];return r?n<t?i?r.top-(i.top+i.height):a?a.top-(r.top+r.height):0:a?a.top-(r.top+r.height):i?r.top-(i.top+i.height):0:0}var vm=`Sortable`,ym=x.createContext({activeIndex:-1,containerId:vm,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:mm,disabled:{draggable:!1,droppable:!1}});function bm(e){let{children:t,id:n,items:r,strategy:i=mm,disabled:a=!1}=e,{active:o,dragOverlay:s,droppableRects:c,over:l,measureDroppableContainers:u}=am(),d=Md(vm,n),f=s.rect!==null,p=(0,x.useMemo)(()=>r.map(e=>typeof e==`object`&&`id`in e?e.id:e),[r]),m=o!=null,h=o?p.indexOf(o.id):-1,g=l?p.indexOf(l.id):-1,_=(0,x.useRef)(p),v=!fm(p,_.current),y=g!==-1&&h===-1||v,b=pm(a);wd(()=>{v&&m&&u(p)},[v,p,m,u]),(0,x.useEffect)(()=>{_.current=p},[p]);let S=(0,x.useMemo)(()=>({activeIndex:h,containerId:d,disabled:b,disableTransforms:y,items:p,overIndex:g,useDragOverlay:f,sortedRects:um(p,c),strategy:i}),[h,d,b.draggable,b.droppable,y,p,g,c,f,i]);return x.createElement(ym.Provider,{value:S},t)}var xm=e=>{let{id:t,items:n,activeIndex:r,overIndex:i}=e;return lm(n,r,i).indexOf(t)},Sm=e=>{let{containerId:t,isSorting:n,wasDragging:r,index:i,items:a,newIndex:o,previousItems:s,previousContainerId:c,transition:l}=e;return!l||!r||s!==a&&i===o?!1:n?!0:o!==i&&t===c},Cm={duration:200,easing:`ease`},wm=`transform`,Tm=Bd.Transition.toString({property:wm,duration:0,easing:`linear`}),Em={roleDescription:`sortable`};function Dm(e){let{disabled:t,index:n,node:r,rect:i}=e,[a,o]=(0,x.useState)(null),s=(0,x.useRef)(n);return wd(()=>{if(!t&&n!==s.current&&r.current){let e=i.current;if(e){let t=bf(r.current,{ignoreTransform:!0}),n={x:e.left-t.left,y:e.top-t.top,scaleX:e.width/t.width,scaleY:e.height/t.height};(n.x||n.y)&&o(n)}}n!==s.current&&(s.current=n)},[t,n,r,i]),(0,x.useEffect)(()=>{a&&o(null)},[a]),a}function Om(e){let{animateLayoutChanges:t=Sm,attributes:n,disabled:r,data:i,getNewIndex:a=xm,id:o,strategy:s,resizeObserverConfig:c,transition:l=Cm}=e,{items:u,containerId:d,activeIndex:f,disabled:p,disableTransforms:m,sortedRects:h,overIndex:g,useDragOverlay:_,strategy:v}=(0,x.useContext)(ym),y=km(r,p),b=u.indexOf(o),S=(0,x.useMemo)(()=>({sortable:{containerId:d,index:b,items:u},...i}),[d,i,b,u]),C=(0,x.useMemo)(()=>u.slice(u.indexOf(o)),[u,o]),{rect:w,node:T,isOver:E,setNodeRef:D}=cm({id:o,data:S,disabled:y.droppable,resizeObserverConfig:{updateMeasurementsFor:C,...c}}),{active:O,activatorEvent:k,activeNodeRect:A,attributes:j,setNodeRef:M,listeners:N,isDragging:P,over:F,setActivatorNodeRef:I,transform:L}=im({id:o,data:S,attributes:{...Em,...n},disabled:y.draggable}),ee=hd(D,M),R=!!O,z=R&&!m&&dm(f)&&dm(g),B=!_&&P,te=z?(B&&z?L:null)??(s??v)({rects:h,activeNodeRect:A,activeIndex:f,overIndex:g,index:b}):null,V=dm(f)&&dm(g)?a({id:o,items:u,activeIndex:f,overIndex:g}):b,ne=O?.id,H=(0,x.useRef)({activeId:ne,items:u,newIndex:V,containerId:d}),re=u!==H.current.items,U=t({active:O,containerId:d,isDragging:P,isSorting:R,id:o,index:b,items:u,newIndex:H.current.newIndex,previousItems:H.current.items,previousContainerId:H.current.containerId,transition:l,wasDragging:H.current.activeId!=null}),ie=Dm({disabled:!U,index:b,node:T,rect:w});return(0,x.useEffect)(()=>{R&&H.current.newIndex!==V&&(H.current.newIndex=V),d!==H.current.containerId&&(H.current.containerId=d),u!==H.current.items&&(H.current.items=u)},[R,V,d,u]),(0,x.useEffect)(()=>{if(ne===H.current.activeId)return;if(ne!=null&&H.current.activeId==null){H.current.activeId=ne;return}let e=setTimeout(()=>{H.current.activeId=ne},50);return()=>clearTimeout(e)},[ne]),{active:O,activeIndex:f,attributes:j,data:S,rect:w,index:b,newIndex:V,items:u,isOver:E,isSorting:R,isDragging:P,listeners:N,node:T,overIndex:g,over:F,setNodeRef:ee,setActivatorNodeRef:I,setDroppableNodeRef:D,setDraggableNodeRef:M,transform:ie??te,transition:W()};function W(){if(ie||re&&H.current.newIndex===b)return Tm;if(!(B&&!Ld(k)||!l)&&(R||U))return Bd.Transition.toString({...l,property:wm})}}function km(e,t){return typeof e==`boolean`?{draggable:e,droppable:!1}:{draggable:e?.draggable??t.draggable,droppable:e?.droppable??t.droppable}}Yf.Down,Yf.Right,Yf.Up,Yf.Left;var Am={permission:0,waiting:1,working:2,unknown:3};function jm(e){let t=e.agentSessionId?.trim();return t&&t.length>0?t:e.id}var Mm={mode:`created`,direction:`desc`};function Nm(e,t=Mm){let{mode:n,direction:r,manualOrder:i}=t;if(n===`manual`&&i&&i.length>0){let t=new Map(i.map((e,t)=>[e,t]));return e.toSorted((e,n)=>{let r=jm(e),i=jm(n),a=t.get(r)??t.get(e.id)??1/0,o=t.get(i)??t.get(n.id)??1/0;return a===1/0&&o===1/0?Date.parse(n.createdAt)-Date.parse(e.createdAt):a-o})}return e.toSorted((e,t)=>{if(n===`status`){let n=Am[e.status]??Am.unknown,r=Am[t.status]??Am.unknown;return n===r?Date.parse(t.lastActivity)-Date.parse(e.lastActivity):n-r}let i=Date.parse(e.createdAt),a=Date.parse(t.createdAt);return r===`desc`?a-i:i-a})}function Pm(e,t){let n=new Map;for(let t of e){let e=t.projectPath?.trim();if(e){let r=Date.parse(t.lastActivity)||0;r>(n.get(e)||0)&&n.set(e,r)}}for(let e of t){let t=e.projectPath?.trim();if(t){let r=Date.parse(e.lastActivityAt)||0;r>(n.get(t)||0)&&n.set(t,r)}}return Array.from(n.keys()).toSorted((e,t)=>{let r=n.get(e)||0;return(n.get(t)||0)-r})}function Fm(e,t){let n=new Map;for(let t of e){let e=t.host?.trim();if(e){let r=Date.parse(t.lastActivity)||0;r>(n.get(e)||0)&&n.set(e,r)}}for(let e of t){let t=e.host?.trim();if(t){let r=Date.parse(e.lastActivityAt)||0;r>(n.get(t)||0)&&n.set(t,r)}}return Array.from(n.keys()).toSorted((e,t)=>{let r=n.get(e)||0;return(n.get(t)||0)-r})}function Im(e){let t=Date.parse(e);if(Number.isNaN(t))return``;let n=Date.now()-t,r=Math.floor(n/6e4);if(r<1)return`now`;if(r<60)return`${r}m`;let i=Math.floor(r/60);return i<24?`${i}h`:`${Math.floor(i/24)}d`}function Lm(e){let t=e.trim();if(!t)return null;let n=t.replace(/[\\/]+$/,``);if(!n)return null;let r=n.split(/[\\/]/);return r[r.length-1]||null}function Rm(e){let t=e.map(e=>{let t=e.trim(),n=t.replace(/[\\/]+$/,``);return{path:e,parts:n.split(/[\\/]/).filter(Boolean),fallback:n||t||e}}),n=new Map;for(let e of t)n.set(e.path,1);let r=!0;for(;r;){r=!1;let e=new Map;for(let r of t){if(r.parts.length===0)continue;let t=n.get(r.path)??1,i=r.parts.slice(-t).join(`/`);e.set(i,(e.get(i)??0)+1)}for(let i of t){if(i.parts.length===0)continue;let t=n.get(i.path)??1,a=i.parts.slice(-t).join(`/`);(e.get(a)??0)>1&&t<i.parts.length&&(n.set(i.path,t+1),r=!0)}}let i=new Map,a=new Map;for(let e of t){let t=e.fallback;if(e.parts.length>0){let r=n.get(e.path)??1;t=e.parts.slice(-r).join(`/`)}i.set(e.path,t),a.set(t,(a.get(t)??0)+1)}let o=new Map;for(let e of t){let t=i.get(e.path)??e.fallback;(a.get(t)??0)>1&&(t=e.fallback),o.set(e.path,t)}return o}function zm(e){let t=e.trim();return!t||t.length<=6?t:`${t.slice(0,3)}…${t.slice(-3)}`}function Bm(e){let t=document.createElement(`textarea`);t.value=e,t.style.position=`fixed`,t.style.left=`-9999px`,document.body.appendChild(t),t.focus(),t.select();try{if(!document.execCommand(`copy`))throw 0}catch{navigator.clipboard?.writeText(e).catch(()=>{})}document.body.removeChild(t)}function Vm({useSafariLayoutFallback:e,isDragging:t,dndTransform:n,generatedTransform:r}){return e&&!t&&!n||!n?r:!r||r===`none`?n:`${n} ${r}`}var Hm=`agentboard-session`,Um=N(Hm);function Wm(e,t){return e.id===t.id&&e.name===t.name&&e.tmuxWindow===t.tmuxWindow&&e.projectPath===t.projectPath&&e.status===t.status&&e.lastActivity===t.lastActivity&&e.createdAt===t.createdAt&&e.source===t.source&&e.host===t.host&&e.remote===t.remote&&e.command===t.command&&e.agentType===t.agentType&&e.agentSessionId===t.agentSessionId&&e.agentSessionName===t.agentSessionName&&e.logFilePath===t.logFilePath&&e.isHibernating===t.isHibernating&&e.lastUserMessage===t.lastUserMessage}function Gm(e,t){if(e.length!==t.length)return!1;let n=new Map(e.map(e=>[e.id,e]));for(let e of t){let t=n.get(e.id);if(!t||!Wm(t,e))return!1}return!0}function Km(e){return typeof e==`string`&&e.length>0?e:null}function qm(e){return Array.isArray(e)?e:[]}var Jm=T()(k((e,t)=>({sessions:[],agentSessions:{active:[],hibernating:[],history:[]},agentSessionsEpoch:-1,hostStatuses:[],exitingSessions:new Map,selectedSessionId:null,selectedHibernatingSessionId:null,hasLoaded:!1,connectionStatus:`connecting`,connectionError:null,connectionEpoch:0,remoteAllowControl:!1,remoteAllowAttach:!1,hostLabel:null,preferWindowName:!1,setSessions:n=>{let r=t(),i=r.selectedSessionId,a=r.selectedHibernatingSessionId,o=r.sessions,s=r.exitingSessions;if(r.hasLoaded&&Gm(o,n))return;let c=new Set(n.map(e=>e.id)),l=o.filter(e=>!c.has(e.id)&&!s.has(e.id)),u=i;if(i!==null&&!n.some(e=>e.id===i))if(a===null){let{sessionSortMode:e,sessionSortDirection:t}=H.getState();u=Nm(n,{mode:e,direction:t})[0]?.id??null}else u=null;if(l.length>0){let t=new Map(s);for(let e of l)t.set(e.id,e);e({sessions:n,hasLoaded:!0,selectedSessionId:u,exitingSessions:t})}else e({sessions:n,hasLoaded:!0,selectedSessionId:u})},setAgentSessions:(t,n,r)=>e(e=>{let i={active:qm(t),hibernating:qm(n),history:qm(r)};return{agentSessions:i,agentSessionsEpoch:e.connectionEpoch,selectedHibernatingSessionId:e.selectedHibernatingSessionId&&!i.hibernating.some(t=>t.sessionId===e.selectedHibernatingSessionId)?null:e.selectedHibernatingSessionId}}),setActiveAgentSessions:t=>e(e=>({agentSessions:{active:qm(t),hibernating:e.agentSessions.hibernating,history:e.agentSessions.history}})),setHostStatuses:t=>e({hostStatuses:t}),updateSession:t=>e(e=>({sessions:e.sessions.map(e=>e.id===t.id?t:e)})),setSelectedSessionId:t=>e({selectedSessionId:t,...t===null?{}:{selectedHibernatingSessionId:null}}),setSelectedHibernatingSessionId:t=>e({selectedHibernatingSessionId:t,...t===null?{}:{selectedSessionId:null}}),setConnectionStatus:t=>e({connectionStatus:t}),setConnectionError:t=>e({connectionError:t}),setConnectionState:(t,n,r)=>e({connectionStatus:t,connectionError:n,connectionEpoch:r}),setRemoteAllowControl:t=>e({remoteAllowControl:t}),setRemoteAllowAttach:t=>e({remoteAllowAttach:t}),setHostLabel:t=>e({hostLabel:t}),setPreferWindowName:t=>e({preferWindowName:t}),markSessionExiting:n=>{let r=t().sessions.find(e=>e.id===n);if(r){let i=new Map(t().exitingSessions);i.set(n,r),e({exitingSessions:i})}},clearExitingSession:n=>{let r=new Map(t().exitingSessions);r.delete(n),e({exitingSessions:r})}}),{name:Hm,storage:D(()=>Um),partialize:e=>({selectedSessionId:e.selectedSessionId,selectedHibernatingSessionId:e.selectedHibernatingSessionId}),merge:(e,t)=>{let n=e,r=n?.selectedHibernatingSessionId??n?.selectedSleepingSessionId;return{...t,selectedSessionId:Km(n?.selectedSessionId),selectedHibernatingSessionId:Km(r)}}}));function Ym(e,t,n=!1){let[r,i]=(0,x.useState)(!1),a=(0,x.useRef)(e),o=(0,x.useRef)(!1);return(0,x.useEffect)(()=>{let r=a.current;if(n?e>r:e!==r){o.current=!0;let n=setTimeout(()=>{o.current&&=(i(!0),!1)},t);return a.current=e,()=>clearTimeout(n)}a.current=e},[e,t,n]),[r,()=>i(!1)]}function Xm(e,t,n,r){let i=(0,x.useRef)(new Map);(0,x.useEffect)(()=>{let a=new Set(e.map(e=>e.id));for(let e of t.keys())if(a.has(e)){let t=i.current.get(e);t&&(clearTimeout(t),i.current.delete(e)),n(e)}else if(!i.current.has(e)){let t=setTimeout(()=>{i.current.delete(e),n(e)},r+100);i.current.set(e,t)}},[e,t,n,r]),(0,x.useEffect)(()=>()=>{for(let e of i.current.values())clearTimeout(e);i.current.clear()},[])}function Zm(e){return typeof CSS<`u`?CSS.escape(e):e.replace(/["\\]/g,`\\$&`)}function Qm(e,t,n){let r=(0,x.useRef)(t);(0,x.useEffect)(()=>{r.current=t},[t]),(0,x.useEffect)(()=>{let t=r.current;if(!t)return;if(n&&!n(t)){r.current=null;return}let i=e.current?.querySelector(`[data-session-id="${Zm(t)}"]`);i&&(i.scrollIntoView({block:`nearest`,inline:`nearest`,behavior:`instant`}),r.current=null)})}function $m({className:e}){return(0,G.jsx)(`svg`,{viewBox:`0 0 92.2 92.2`,fill:`currentColor`,className:e,"aria-hidden":`true`,children:(0,G.jsx)(`path`,{d:`M66.5,0H52.4l25.7,65h14.1L66.5,0z M25.7,0L0,65h14.4l5.3-13.6h26.9L51.8,65h14.4L40.5,0C40.5,0,25.7,0,25.7,0z M24.3,39.3l8.8-22.8l8.8,22.8H24.3z`,transform:`translate(0, 13.6)`})})}function eh({className:e}){return(0,G.jsx)(`svg`,{viewBox:`-1 -1 26 26`,fill:`currentColor`,className:e,"aria-hidden":`true`,children:(0,G.jsx)(`path`,{d:`M22.2819 9.8211a5.9847 5.9847 0 0 0-.5157-4.9108 6.0462 6.0462 0 0 0-6.5098-2.9A6.0651 6.0651 0 0 0 4.9807 4.1818a5.9847 5.9847 0 0 0-3.9977 2.9 6.0462 6.0462 0 0 0 .7427 7.0966 5.98 5.98 0 0 0 .511 4.9107 6.051 6.051 0 0 0 6.5146 2.9001A5.9847 5.9847 0 0 0 13.2599 24a6.0557 6.0557 0 0 0 5.7718-4.2058 5.9894 5.9894 0 0 0 3.9977-2.9001 6.0557 6.0557 0 0 0-.7475-7.0729zm-9.022 12.6081a4.4755 4.4755 0 0 1-2.8764-1.0408l.1419-.0804 4.7783-2.7582a.7948.7948 0 0 0 .3927-.6813v-6.7369l2.02 1.1686a.071.071 0 0 1 .038.052v5.5826a4.504 4.504 0 0 1-4.4945 4.4944zm-9.6607-4.1254a4.4708 4.4708 0 0 1-.5346-3.0137l.142.0852 4.783 2.7582a.7712.7712 0 0 0 .7806 0l5.8428-3.3685v2.3324a.0804.0804 0 0 1-.0332.0615L9.74 19.9502a4.4992 4.4992 0 0 1-6.1408-1.6464zM2.3408 7.8956a4.485 4.485 0 0 1 2.3655-1.9728V11.6a.7664.7664 0 0 0 .3879.6765l5.8144 3.3543-2.0201 1.1685a.0757.0757 0 0 1-.071 0l-4.8303-2.7865A4.504 4.504 0 0 1 2.3408 7.872zm16.5963 3.8558L13.1038 8.364 15.1192 7.2a.0757.0757 0 0 1 .071 0l4.8303 2.7913a4.4944 4.4944 0 0 1-.6765 8.1042v-5.6772a.79.79 0 0 0-.407-.667zm2.0107-3.0231l-.142-.0852-4.7735-2.7818a.7759.7759 0 0 0-.7854 0L9.409 9.2297V6.8974a.0662.0662 0 0 1 .0284-.0615l4.8303-2.7866a4.4992 4.4992 0 0 1 6.6802 4.66zM8.3065 12.863l-2.02-1.1638a.0804.0804 0 0 1-.038-.0567V6.0742a4.4992 4.4992 0 0 1 7.3757-3.4537l-.142.0805L8.704 5.459a.7948.7948 0 0 0-.3927.6813zm1.0976-2.3654l2.602-1.4998 2.6069 1.4998v2.9994l-2.5974 1.4997-2.6067-1.4997Z`})})}function th({className:e}){return(0,G.jsx)(`svg`,{viewBox:`0 0 588.42 568.88`,fill:`currentColor`,className:e,"aria-hidden":`true`,children:(0,G.jsx)(`path`,{d:`M 10.499686,177.03840 L 31.174931,178.56990 C 52.615925,154.32116 61.039171,82.595924 187.38789,96.634671 C 182.79339,403.95560 48.021426,436.37234 56.444675,499.41907 C 59.507674,535.15406 87.840417,557.10556 118.47041,558.38181 C 215.21014,555.06356 210.87089,424.63084 240.99038,95.868921 L 365.80760,95.868921 C 359.17110,211.75239 341.04836,327.63586 339.00636,441.22208 C 340.53786,516.77606 386.48285,557.10556 446.97708,557.61606 C 546.52456,560.93431 577.92030,444.79558 577.92030,395.27709 L 556.47931,395.27710 C 554.43731,436.11709 534.78306,465.47083 492.92207,467.25758 C 378.82535,468.78908 441.61683,266.63113 442.38258,97.400421 L 577.92030,98.166171 L 577.15455,11.636437 C 13.807491,8.9075799 85.312284,-2.1366151 10.499686,177.03840 z`})})}function nh({className:e}){return(0,G.jsx)(`svg`,{viewBox:`41 41 343 343`,fill:`currentColor`,className:e,"aria-hidden":`true`,children:(0,G.jsx)(`path`,{d:`M70 159.333V91.3471C70 88.3592 71.594 85.5983 74.1816 84.1044L133.043 50.1205C135.631 48.6265 138.819 48.6265 141.407 50.1205L200.269 84.1044C202.856 85.5983 204.45 88.3592 204.45 91.3471V126.068C204.708 137.606 210.806 148.734 221.531 154.926C232.256 161.117 244.942 160.834 255.063 155.289L285.132 137.929C287.719 136.435 290.907 136.435 293.495 137.929L352.357 171.913C354.944 173.406 356.538 176.167 356.538 179.155V247.123C356.538 250.111 354.944 252.872 352.357 254.366L293.495 288.35C290.907 289.844 287.719 289.844 285.132 288.35L255.306 271.13C245.146 265.456 232.344 265.117 221.534 271.358C210.809 277.55 204.711 288.678 204.453 300.215V334.926C204.453 337.914 202.859 340.675 200.271 342.169L141.41 376.153C138.822 377.647 135.634 377.647 133.046 376.153L74.1845 342.169C71.5969 340.675 70.0028 337.914 70.0028 334.926V266.959C70.0029 263.971 71.5969 261.21 74.1845 259.716L133.046 225.732C135.634 224.238 138.822 224.238 141.41 225.732L171.547 243.132C181.656 248.638 194.306 248.906 205.005 242.729C215.815 236.488 221.922 225.231 222.088 213.595C221.83 202.057 215.732 189.737 205.008 183.545C194.283 177.353 181.597 177.636 171.476 183.181L141.269 200.72C138.67 202.229 135.461 202.228 132.864 200.716L74.1576 166.562C71.5835 165.065 70 162.311 70 159.333Z`})})}function rh({className:e}){return(0,G.jsxs)(`svg`,{viewBox:`0 0 512 512`,fill:`currentColor`,className:e,"aria-hidden":`true`,children:[(0,G.jsx)(`path`,{d:`M210.484 312.759L343.465 210.383C349.984 205.364 359.302 207.322 362.408 215.117C378.758 256.231 371.454 305.64 338.925 339.563C306.397 373.487 261.137 380.927 219.768 363.983L174.577 385.803C239.394 432.008 318.104 420.581 367.289 369.251C406.303 328.564 418.386 273.104 407.088 223.091L407.19 223.198C390.807 149.726 411.218 120.359 453.03 60.3072C454.02 58.8833 455.01 57.4595 456 56L400.978 113.382V113.204L210.45 312.794`}),(0,G.jsx)(`path`,{d:`M183.042 337.641C136.519 291.294 144.54 219.567 184.236 178.203C213.59 147.59 261.683 135.096 303.666 153.464L348.755 131.75C340.632 125.627 330.221 119.042 318.275 114.414C264.277 91.2407 199.63 102.774 155.735 148.516C113.513 192.549 100.236 260.254 123.036 318.027C140.069 361.206 112.148 391.748 84.0229 422.575C74.0561 433.503 64.0553 444.431 56 456L183.007 337.677`})]})}function ih({className:e}){return(0,G.jsxs)(`svg`,{viewBox:`0 -15 120 120`,fill:`currentColor`,className:e,"aria-hidden":`true`,children:[(0,G.jsx)(`rect`,{x:`10`,y:`8`,width:`100`,height:`12`,rx:`2`}),(0,G.jsx)(`rect`,{x:`25`,y:`20`,width:`12`,height:`62`,rx:`2`}),(0,G.jsx)(`rect`,{x:`75`,y:`20`,width:`12`,height:`45`,rx:`2`}),(0,G.jsx)(`rect`,{x:`71`,y:`55`,width:`20`,height:`16`,rx:`3`,fill:`#f97316`}),(0,G.jsx)(`rect`,{x:`76`,y:`59`,width:`3`,height:`8`,rx:`1`,fill:`#0d0d0d`}),(0,G.jsx)(`rect`,{x:`82`,y:`59`,width:`3`,height:`8`,rx:`1`,fill:`#0d0d0d`}),(0,G.jsx)(`circle`,{cx:`18`,cy:`14`,r:`2`,fill:`#f97316`,opacity:`0.8`}),(0,G.jsx)(`circle`,{cx:`102`,cy:`14`,r:`2`,fill:`#f97316`,opacity:`0.8`})]})}var ah=[[`claude`,$m],[`codex`,eh],[`omp`,ih],[`pi`,th],[`devin`,nh],[`grok`,rh]];function oh({agentType:e,command:t,className:n=``}){let r=(e||t?.split(` `)[0]||``).toLowerCase();for(let[e,t]of ah)if(r.startsWith(e))return(0,G.jsx)(t,{className:n});return(0,G.jsx)(He,{className:n})}function sh(e){var t,n,r=``;if(typeof e==`string`||typeof e==`number`)r+=e;else if(typeof e==`object`)if(Array.isArray(e)){var i=e.length;for(t=0;t<i;t++)e[t]&&(n=sh(e[t]))&&(r&&(r+=` `),r+=n)}else for(n in e)e[n]&&(r&&(r+=` `),r+=n);return r}function ch(){for(var e,t,n=0,r=``,i=arguments.length;n<i;n++)(e=arguments[n])&&(t=sh(e))&&(r&&(r+=` `),r+=t);return r}var lh=(e,t)=>{let n=Array(e.length+t.length);for(let t=0;t<e.length;t++)n[t]=e[t];for(let r=0;r<t.length;r++)n[e.length+r]=t[r];return n},uh=(e,t)=>({classGroupId:e,validator:t}),dh=(e=new Map,t=null,n)=>({nextPart:e,validators:t,classGroupId:n}),fh=`-`,ph=[],mh=`arbitrary..`,hh=e=>{let t=vh(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:e=>{if(e.startsWith(`[`)&&e.endsWith(`]`))return _h(e);let n=e.split(fh);return gh(n,+(n[0]===``&&n.length>1),t)},getConflictingClassGroupIds:(e,t)=>{if(t){let t=r[e],i=n[e];return t?i?lh(i,t):t:i||ph}return n[e]||ph}}},gh=(e,t,n)=>{if(e.length-t===0)return n.classGroupId;let r=e[t],i=n.nextPart.get(r);if(i){let n=gh(e,t+1,i);if(n)return n}let a=n.validators;if(a===null)return;let o=t===0?e.join(fh):e.slice(t).join(fh),s=a.length;for(let e=0;e<s;e++){let t=a[e];if(t.validator(o))return t.classGroupId}},_h=e=>e.slice(1,-1).indexOf(`:`)===-1?void 0:(()=>{let t=e.slice(1,-1),n=t.indexOf(`:`),r=t.slice(0,n);return r?mh+r:void 0})(),vh=e=>{let{theme:t,classGroups:n}=e;return yh(n,t)},yh=(e,t)=>{let n=dh();for(let r in e){let i=e[r];bh(i,n,r,t)}return n},bh=(e,t,n,r)=>{let i=e.length;for(let a=0;a<i;a++){let i=e[a];xh(i,t,n,r)}},xh=(e,t,n,r)=>{if(typeof e==`string`){Sh(e,t,n);return}if(typeof e==`function`){Ch(e,t,n,r);return}wh(e,t,n,r)},Sh=(e,t,n)=>{let r=e===``?t:Th(t,e);r.classGroupId=n},Ch=(e,t,n,r)=>{if(Eh(e)){bh(e(r),t,n,r);return}t.validators===null&&(t.validators=[]),t.validators.push(uh(n,e))},wh=(e,t,n,r)=>{let i=Object.entries(e),a=i.length;for(let e=0;e<a;e++){let[a,o]=i[e];bh(o,Th(t,a),n,r)}},Th=(e,t)=>{let n=e,r=t.split(fh),i=r.length;for(let e=0;e<i;e++){let t=r[e],i=n.nextPart.get(t);i||(i=dh(),n.nextPart.set(t,i)),n=i}return n},Eh=e=>`isThemeGetter`in e&&e.isThemeGetter===!0,Dh=e=>{if(e<1)return{get:()=>void 0,set:()=>{}};let t=0,n=Object.create(null),r=Object.create(null),i=(i,a)=>{n[i]=a,t++,t>e&&(t=0,r=n,n=Object.create(null))};return{get(e){let t=n[e];if(t!==void 0)return t;if((t=r[e])!==void 0)return i(e,t),t},set(e,t){e in n?n[e]=t:i(e,t)}}},Oh=`!`,kh=`:`,Ah=[],jh=(e,t,n,r,i)=>({modifiers:e,hasImportantModifier:t,baseClassName:n,maybePostfixModifierPosition:r,isExternal:i}),Mh=e=>{let{prefix:t,experimentalParseClassName:n}=e,r=e=>{let t=[],n=0,r=0,i=0,a,o=e.length;for(let s=0;s<o;s++){let o=e[s];if(n===0&&r===0){if(o===kh){t.push(e.slice(i,s)),i=s+1;continue}if(o===`/`){a=s;continue}}o===`[`?n++:o===`]`?n--:o===`(`?r++:o===`)`&&r--}let s=t.length===0?e:e.slice(i),c=s,l=!1;s.endsWith(Oh)?(c=s.slice(0,-1),l=!0):s.startsWith(Oh)&&(c=s.slice(1),l=!0);let u=a&&a>i?a-i:void 0;return jh(t,l,c,u)};if(t){let e=t+kh,n=r;r=t=>t.startsWith(e)?n(t.slice(e.length)):jh(Ah,!1,t,void 0,!0)}if(n){let e=r;r=t=>n({className:t,parseClassName:e})}return r},Nh=e=>{let t=new Map;return e.orderSensitiveModifiers.forEach((e,n)=>{t.set(e,1e6+n)}),e=>{let n=[],r=[];for(let i=0;i<e.length;i++){let a=e[i],o=a[0]===`[`,s=t.has(a);o||s?(r.length>0&&(r.sort(),n.push(...r),r=[]),n.push(a)):r.push(a)}return r.length>0&&(r.sort(),n.push(...r)),n}},Ph=e=>({cache:Dh(e.cacheSize),parseClassName:Mh(e),sortModifiers:Nh(e),...hh(e)}),Fh=/\s+/,Ih=(e,t)=>{let{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:i,sortModifiers:a}=t,o=[],s=e.trim().split(Fh),c=``;for(let e=s.length-1;e>=0;--e){let t=s[e],{isExternal:l,modifiers:u,hasImportantModifier:d,baseClassName:f,maybePostfixModifierPosition:p}=n(t);if(l){c=t+(c.length>0?` `+c:c);continue}let m=!!p,h=r(m?f.substring(0,p):f);if(!h){if(!m){c=t+(c.length>0?` `+c:c);continue}if(h=r(f),!h){c=t+(c.length>0?` `+c:c);continue}m=!1}let g=u.length===0?``:u.length===1?u[0]:a(u).join(`:`),_=d?g+Oh:g,v=_+h;if(o.indexOf(v)>-1)continue;o.push(v);let y=i(h,m);for(let e=0;e<y.length;++e){let t=y[e];o.push(_+t)}c=t+(c.length>0?` `+c:c)}return c},Lh=(...e)=>{let t=0,n,r,i=``;for(;t<e.length;)(n=e[t++])&&(r=Rh(n))&&(i&&(i+=` `),i+=r);return i},Rh=e=>{if(typeof e==`string`)return e;let t,n=``;for(let r=0;r<e.length;r++)e[r]&&(t=Rh(e[r]))&&(n&&(n+=` `),n+=t);return n},zh=(e,...t)=>{let n,r,i,a,o=o=>(n=Ph(t.reduce((e,t)=>t(e),e())),r=n.cache.get,i=n.cache.set,a=s,s(o)),s=e=>{let t=r(e);if(t)return t;let a=Ih(e,n);return i(e,a),a};return a=o,(...e)=>a(Lh(...e))},Bh=[],Vh=e=>{let t=t=>t[e]||Bh;return t.isThemeGetter=!0,t},Hh=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,Uh=/^\((?:(\w[\w-]*):)?(.+)\)$/i,Wh=/^\d+\/\d+$/,Gh=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,Kh=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,qh=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,Jh=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,Yh=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Xh=e=>Wh.test(e),Zh=e=>!!e&&!Number.isNaN(Number(e)),Qh=e=>!!e&&Number.isInteger(Number(e)),$h=e=>e.endsWith(`%`)&&Zh(e.slice(0,-1)),eg=e=>Gh.test(e),tg=()=>!0,ng=e=>Kh.test(e)&&!qh.test(e),rg=()=>!1,ig=e=>Jh.test(e),ag=e=>Yh.test(e),og=e=>!J(e)&&!Y(e),sg=e=>yg(e,Cg,rg),J=e=>Hh.test(e),cg=e=>yg(e,wg,ng),lg=e=>yg(e,Tg,Zh),ug=e=>yg(e,xg,rg),dg=e=>yg(e,Sg,ag),fg=e=>yg(e,Dg,ig),Y=e=>Uh.test(e),pg=e=>bg(e,wg),mg=e=>bg(e,Eg),hg=e=>bg(e,xg),gg=e=>bg(e,Cg),_g=e=>bg(e,Sg),vg=e=>bg(e,Dg,!0),yg=(e,t,n)=>{let r=Hh.exec(e);return r?r[1]?t(r[1]):n(r[2]):!1},bg=(e,t,n=!1)=>{let r=Uh.exec(e);return r?r[1]?t(r[1]):n:!1},xg=e=>e===`position`||e===`percentage`,Sg=e=>e===`image`||e===`url`,Cg=e=>e===`length`||e===`size`||e===`bg-size`,wg=e=>e===`length`,Tg=e=>e===`number`,Eg=e=>e===`family-name`,Dg=e=>e===`shadow`,Og=zh(()=>{let e=Vh(`color`),t=Vh(`font`),n=Vh(`text`),r=Vh(`font-weight`),i=Vh(`tracking`),a=Vh(`leading`),o=Vh(`breakpoint`),s=Vh(`container`),c=Vh(`spacing`),l=Vh(`radius`),u=Vh(`shadow`),d=Vh(`inset-shadow`),f=Vh(`text-shadow`),p=Vh(`drop-shadow`),m=Vh(`blur`),h=Vh(`perspective`),g=Vh(`aspect`),_=Vh(`ease`),v=Vh(`animate`),y=()=>[`auto`,`avoid`,`all`,`avoid-page`,`page`,`left`,`right`,`column`],b=()=>[`center`,`top`,`bottom`,`left`,`right`,`top-left`,`left-top`,`top-right`,`right-top`,`bottom-right`,`right-bottom`,`bottom-left`,`left-bottom`],x=()=>[...b(),Y,J],S=()=>[`auto`,`hidden`,`clip`,`visible`,`scroll`],C=()=>[`auto`,`contain`,`none`],w=()=>[Y,J,c],T=()=>[Xh,`full`,`auto`,...w()],E=()=>[Qh,`none`,`subgrid`,Y,J],D=()=>[`auto`,{span:[`full`,Qh,Y,J]},Qh,Y,J],O=()=>[Qh,`auto`,Y,J],k=()=>[`auto`,`min`,`max`,`fr`,Y,J],A=()=>[`start`,`end`,`center`,`between`,`around`,`evenly`,`stretch`,`baseline`,`center-safe`,`end-safe`],j=()=>[`start`,`end`,`center`,`stretch`,`center-safe`,`end-safe`],M=()=>[`auto`,...w()],N=()=>[Xh,`auto`,`full`,`dvw`,`dvh`,`lvw`,`lvh`,`svw`,`svh`,`min`,`max`,`fit`,...w()],P=()=>[e,Y,J],F=()=>[...b(),hg,ug,{position:[Y,J]}],I=()=>[`no-repeat`,{repeat:[``,`x`,`y`,`space`,`round`]}],L=()=>[`auto`,`cover`,`contain`,gg,sg,{size:[Y,J]}],ee=()=>[$h,pg,cg],R=()=>[``,`none`,`full`,l,Y,J],z=()=>[``,Zh,pg,cg],B=()=>[`solid`,`dashed`,`dotted`,`double`],te=()=>[`normal`,`multiply`,`screen`,`overlay`,`darken`,`lighten`,`color-dodge`,`color-burn`,`hard-light`,`soft-light`,`difference`,`exclusion`,`hue`,`saturation`,`color`,`luminosity`],V=()=>[Zh,$h,hg,ug],ne=()=>[``,`none`,m,Y,J],H=()=>[`none`,Zh,Y,J],re=()=>[`none`,Zh,Y,J],U=()=>[Zh,Y,J],ie=()=>[Xh,`full`,...w()];return{cacheSize:500,theme:{animate:[`spin`,`ping`,`pulse`,`bounce`],aspect:[`video`],blur:[eg],breakpoint:[eg],color:[tg],container:[eg],"drop-shadow":[eg],ease:[`in`,`out`,`in-out`],font:[og],"font-weight":[`thin`,`extralight`,`light`,`normal`,`medium`,`semibold`,`bold`,`extrabold`,`black`],"inset-shadow":[eg],leading:[`none`,`tight`,`snug`,`normal`,`relaxed`,`loose`],perspective:[`dramatic`,`near`,`normal`,`midrange`,`distant`,`none`],radius:[eg],shadow:[eg],spacing:[`px`,Zh],text:[eg],"text-shadow":[eg],tracking:[`tighter`,`tight`,`normal`,`wide`,`wider`,`widest`]},classGroups:{aspect:[{aspect:[`auto`,`square`,Xh,J,Y,g]}],container:[`container`],columns:[{columns:[Zh,J,Y,s]}],"break-after":[{"break-after":y()}],"break-before":[{"break-before":y()}],"break-inside":[{"break-inside":[`auto`,`avoid`,`avoid-page`,`avoid-column`]}],"box-decoration":[{"box-decoration":[`slice`,`clone`]}],box:[{box:[`border`,`content`]}],display:[`block`,`inline-block`,`inline`,`flex`,`inline-flex`,`table`,`inline-table`,`table-caption`,`table-cell`,`table-column`,`table-column-group`,`table-footer-group`,`table-header-group`,`table-row-group`,`table-row`,`flow-root`,`grid`,`inline-grid`,`contents`,`list-item`,`hidden`],sr:[`sr-only`,`not-sr-only`],float:[{float:[`right`,`left`,`none`,`start`,`end`]}],clear:[{clear:[`left`,`right`,`both`,`none`,`start`,`end`]}],isolation:[`isolate`,`isolation-auto`],"object-fit":[{object:[`contain`,`cover`,`fill`,`none`,`scale-down`]}],"object-position":[{object:x()}],overflow:[{overflow:S()}],"overflow-x":[{"overflow-x":S()}],"overflow-y":[{"overflow-y":S()}],overscroll:[{overscroll:C()}],"overscroll-x":[{"overscroll-x":C()}],"overscroll-y":[{"overscroll-y":C()}],position:[`static`,`fixed`,`absolute`,`relative`,`sticky`],inset:[{inset:T()}],"inset-x":[{"inset-x":T()}],"inset-y":[{"inset-y":T()}],start:[{start:T()}],end:[{end:T()}],top:[{top:T()}],right:[{right:T()}],bottom:[{bottom:T()}],left:[{left:T()}],visibility:[`visible`,`invisible`,`collapse`],z:[{z:[Qh,`auto`,Y,J]}],basis:[{basis:[Xh,`full`,`auto`,s,...w()]}],"flex-direction":[{flex:[`row`,`row-reverse`,`col`,`col-reverse`]}],"flex-wrap":[{flex:[`nowrap`,`wrap`,`wrap-reverse`]}],flex:[{flex:[Zh,Xh,`auto`,`initial`,`none`,J]}],grow:[{grow:[``,Zh,Y,J]}],shrink:[{shrink:[``,Zh,Y,J]}],order:[{order:[Qh,`first`,`last`,`none`,Y,J]}],"grid-cols":[{"grid-cols":E()}],"col-start-end":[{col:D()}],"col-start":[{"col-start":O()}],"col-end":[{"col-end":O()}],"grid-rows":[{"grid-rows":E()}],"row-start-end":[{row:D()}],"row-start":[{"row-start":O()}],"row-end":[{"row-end":O()}],"grid-flow":[{"grid-flow":[`row`,`col`,`dense`,`row-dense`,`col-dense`]}],"auto-cols":[{"auto-cols":k()}],"auto-rows":[{"auto-rows":k()}],gap:[{gap:w()}],"gap-x":[{"gap-x":w()}],"gap-y":[{"gap-y":w()}],"justify-content":[{justify:[...A(),`normal`]}],"justify-items":[{"justify-items":[...j(),`normal`]}],"justify-self":[{"justify-self":[`auto`,...j()]}],"align-content":[{content:[`normal`,...A()]}],"align-items":[{items:[...j(),{baseline:[``,`last`]}]}],"align-self":[{self:[`auto`,...j(),{baseline:[``,`last`]}]}],"place-content":[{"place-content":A()}],"place-items":[{"place-items":[...j(),`baseline`]}],"place-self":[{"place-self":[`auto`,...j()]}],p:[{p:w()}],px:[{px:w()}],py:[{py:w()}],ps:[{ps:w()}],pe:[{pe:w()}],pt:[{pt:w()}],pr:[{pr:w()}],pb:[{pb:w()}],pl:[{pl:w()}],m:[{m:M()}],mx:[{mx:M()}],my:[{my:M()}],ms:[{ms:M()}],me:[{me:M()}],mt:[{mt:M()}],mr:[{mr:M()}],mb:[{mb:M()}],ml:[{ml:M()}],"space-x":[{"space-x":w()}],"space-x-reverse":[`space-x-reverse`],"space-y":[{"space-y":w()}],"space-y-reverse":[`space-y-reverse`],size:[{size:N()}],w:[{w:[s,`screen`,...N()]}],"min-w":[{"min-w":[s,`screen`,`none`,...N()]}],"max-w":[{"max-w":[s,`screen`,`none`,`prose`,{screen:[o]},...N()]}],h:[{h:[`screen`,`lh`,...N()]}],"min-h":[{"min-h":[`screen`,`lh`,`none`,...N()]}],"max-h":[{"max-h":[`screen`,`lh`,...N()]}],"font-size":[{text:[`base`,n,pg,cg]}],"font-smoothing":[`antialiased`,`subpixel-antialiased`],"font-style":[`italic`,`not-italic`],"font-weight":[{font:[r,Y,lg]}],"font-stretch":[{"font-stretch":[`ultra-condensed`,`extra-condensed`,`condensed`,`semi-condensed`,`normal`,`semi-expanded`,`expanded`,`extra-expanded`,`ultra-expanded`,$h,J]}],"font-family":[{font:[mg,J,t]}],"fvn-normal":[`normal-nums`],"fvn-ordinal":[`ordinal`],"fvn-slashed-zero":[`slashed-zero`],"fvn-figure":[`lining-nums`,`oldstyle-nums`],"fvn-spacing":[`proportional-nums`,`tabular-nums`],"fvn-fraction":[`diagonal-fractions`,`stacked-fractions`],tracking:[{tracking:[i,Y,J]}],"line-clamp":[{"line-clamp":[Zh,`none`,Y,lg]}],leading:[{leading:[a,...w()]}],"list-image":[{"list-image":[`none`,Y,J]}],"list-style-position":[{list:[`inside`,`outside`]}],"list-style-type":[{list:[`disc`,`decimal`,`none`,Y,J]}],"text-alignment":[{text:[`left`,`center`,`right`,`justify`,`start`,`end`]}],"placeholder-color":[{placeholder:P()}],"text-color":[{text:P()}],"text-decoration":[`underline`,`overline`,`line-through`,`no-underline`],"text-decoration-style":[{decoration:[...B(),`wavy`]}],"text-decoration-thickness":[{decoration:[Zh,`from-font`,`auto`,Y,cg]}],"text-decoration-color":[{decoration:P()}],"underline-offset":[{"underline-offset":[Zh,`auto`,Y,J]}],"text-transform":[`uppercase`,`lowercase`,`capitalize`,`normal-case`],"text-overflow":[`truncate`,`text-ellipsis`,`text-clip`],"text-wrap":[{text:[`wrap`,`nowrap`,`balance`,`pretty`]}],indent:[{indent:w()}],"vertical-align":[{align:[`baseline`,`top`,`middle`,`bottom`,`text-top`,`text-bottom`,`sub`,`super`,Y,J]}],whitespace:[{whitespace:[`normal`,`nowrap`,`pre`,`pre-line`,`pre-wrap`,`break-spaces`]}],break:[{break:[`normal`,`words`,`all`,`keep`]}],wrap:[{wrap:[`break-word`,`anywhere`,`normal`]}],hyphens:[{hyphens:[`none`,`manual`,`auto`]}],content:[{content:[`none`,Y,J]}],"bg-attachment":[{bg:[`fixed`,`local`,`scroll`]}],"bg-clip":[{"bg-clip":[`border`,`padding`,`content`,`text`]}],"bg-origin":[{"bg-origin":[`border`,`padding`,`content`]}],"bg-position":[{bg:F()}],"bg-repeat":[{bg:I()}],"bg-size":[{bg:L()}],"bg-image":[{bg:[`none`,{linear:[{to:[`t`,`tr`,`r`,`br`,`b`,`bl`,`l`,`tl`]},Qh,Y,J],radial:[``,Y,J],conic:[Qh,Y,J]},_g,dg]}],"bg-color":[{bg:P()}],"gradient-from-pos":[{from:ee()}],"gradient-via-pos":[{via:ee()}],"gradient-to-pos":[{to:ee()}],"gradient-from":[{from:P()}],"gradient-via":[{via:P()}],"gradient-to":[{to:P()}],rounded:[{rounded:R()}],"rounded-s":[{"rounded-s":R()}],"rounded-e":[{"rounded-e":R()}],"rounded-t":[{"rounded-t":R()}],"rounded-r":[{"rounded-r":R()}],"rounded-b":[{"rounded-b":R()}],"rounded-l":[{"rounded-l":R()}],"rounded-ss":[{"rounded-ss":R()}],"rounded-se":[{"rounded-se":R()}],"rounded-ee":[{"rounded-ee":R()}],"rounded-es":[{"rounded-es":R()}],"rounded-tl":[{"rounded-tl":R()}],"rounded-tr":[{"rounded-tr":R()}],"rounded-br":[{"rounded-br":R()}],"rounded-bl":[{"rounded-bl":R()}],"border-w":[{border:z()}],"border-w-x":[{"border-x":z()}],"border-w-y":[{"border-y":z()}],"border-w-s":[{"border-s":z()}],"border-w-e":[{"border-e":z()}],"border-w-t":[{"border-t":z()}],"border-w-r":[{"border-r":z()}],"border-w-b":[{"border-b":z()}],"border-w-l":[{"border-l":z()}],"divide-x":[{"divide-x":z()}],"divide-x-reverse":[`divide-x-reverse`],"divide-y":[{"divide-y":z()}],"divide-y-reverse":[`divide-y-reverse`],"border-style":[{border:[...B(),`hidden`,`none`]}],"divide-style":[{divide:[...B(),`hidden`,`none`]}],"border-color":[{border:P()}],"border-color-x":[{"border-x":P()}],"border-color-y":[{"border-y":P()}],"border-color-s":[{"border-s":P()}],"border-color-e":[{"border-e":P()}],"border-color-t":[{"border-t":P()}],"border-color-r":[{"border-r":P()}],"border-color-b":[{"border-b":P()}],"border-color-l":[{"border-l":P()}],"divide-color":[{divide:P()}],"outline-style":[{outline:[...B(),`none`,`hidden`]}],"outline-offset":[{"outline-offset":[Zh,Y,J]}],"outline-w":[{outline:[``,Zh,pg,cg]}],"outline-color":[{outline:P()}],shadow:[{shadow:[``,`none`,u,vg,fg]}],"shadow-color":[{shadow:P()}],"inset-shadow":[{"inset-shadow":[`none`,d,vg,fg]}],"inset-shadow-color":[{"inset-shadow":P()}],"ring-w":[{ring:z()}],"ring-w-inset":[`ring-inset`],"ring-color":[{ring:P()}],"ring-offset-w":[{"ring-offset":[Zh,cg]}],"ring-offset-color":[{"ring-offset":P()}],"inset-ring-w":[{"inset-ring":z()}],"inset-ring-color":[{"inset-ring":P()}],"text-shadow":[{"text-shadow":[`none`,f,vg,fg]}],"text-shadow-color":[{"text-shadow":P()}],opacity:[{opacity:[Zh,Y,J]}],"mix-blend":[{"mix-blend":[...te(),`plus-darker`,`plus-lighter`]}],"bg-blend":[{"bg-blend":te()}],"mask-clip":[{"mask-clip":[`border`,`padding`,`content`,`fill`,`stroke`,`view`]},`mask-no-clip`],"mask-composite":[{mask:[`add`,`subtract`,`intersect`,`exclude`]}],"mask-image-linear-pos":[{"mask-linear":[Zh]}],"mask-image-linear-from-pos":[{"mask-linear-from":V()}],"mask-image-linear-to-pos":[{"mask-linear-to":V()}],"mask-image-linear-from-color":[{"mask-linear-from":P()}],"mask-image-linear-to-color":[{"mask-linear-to":P()}],"mask-image-t-from-pos":[{"mask-t-from":V()}],"mask-image-t-to-pos":[{"mask-t-to":V()}],"mask-image-t-from-color":[{"mask-t-from":P()}],"mask-image-t-to-color":[{"mask-t-to":P()}],"mask-image-r-from-pos":[{"mask-r-from":V()}],"mask-image-r-to-pos":[{"mask-r-to":V()}],"mask-image-r-from-color":[{"mask-r-from":P()}],"mask-image-r-to-color":[{"mask-r-to":P()}],"mask-image-b-from-pos":[{"mask-b-from":V()}],"mask-image-b-to-pos":[{"mask-b-to":V()}],"mask-image-b-from-color":[{"mask-b-from":P()}],"mask-image-b-to-color":[{"mask-b-to":P()}],"mask-image-l-from-pos":[{"mask-l-from":V()}],"mask-image-l-to-pos":[{"mask-l-to":V()}],"mask-image-l-from-color":[{"mask-l-from":P()}],"mask-image-l-to-color":[{"mask-l-to":P()}],"mask-image-x-from-pos":[{"mask-x-from":V()}],"mask-image-x-to-pos":[{"mask-x-to":V()}],"mask-image-x-from-color":[{"mask-x-from":P()}],"mask-image-x-to-color":[{"mask-x-to":P()}],"mask-image-y-from-pos":[{"mask-y-from":V()}],"mask-image-y-to-pos":[{"mask-y-to":V()}],"mask-image-y-from-color":[{"mask-y-from":P()}],"mask-image-y-to-color":[{"mask-y-to":P()}],"mask-image-radial":[{"mask-radial":[Y,J]}],"mask-image-radial-from-pos":[{"mask-radial-from":V()}],"mask-image-radial-to-pos":[{"mask-radial-to":V()}],"mask-image-radial-from-color":[{"mask-radial-from":P()}],"mask-image-radial-to-color":[{"mask-radial-to":P()}],"mask-image-radial-shape":[{"mask-radial":[`circle`,`ellipse`]}],"mask-image-radial-size":[{"mask-radial":[{closest:[`side`,`corner`],farthest:[`side`,`corner`]}]}],"mask-image-radial-pos":[{"mask-radial-at":b()}],"mask-image-conic-pos":[{"mask-conic":[Zh]}],"mask-image-conic-from-pos":[{"mask-conic-from":V()}],"mask-image-conic-to-pos":[{"mask-conic-to":V()}],"mask-image-conic-from-color":[{"mask-conic-from":P()}],"mask-image-conic-to-color":[{"mask-conic-to":P()}],"mask-mode":[{mask:[`alpha`,`luminance`,`match`]}],"mask-origin":[{"mask-origin":[`border`,`padding`,`content`,`fill`,`stroke`,`view`]}],"mask-position":[{mask:F()}],"mask-repeat":[{mask:I()}],"mask-size":[{mask:L()}],"mask-type":[{"mask-type":[`alpha`,`luminance`]}],"mask-image":[{mask:[`none`,Y,J]}],filter:[{filter:[``,`none`,Y,J]}],blur:[{blur:ne()}],brightness:[{brightness:[Zh,Y,J]}],contrast:[{contrast:[Zh,Y,J]}],"drop-shadow":[{"drop-shadow":[``,`none`,p,vg,fg]}],"drop-shadow-color":[{"drop-shadow":P()}],grayscale:[{grayscale:[``,Zh,Y,J]}],"hue-rotate":[{"hue-rotate":[Zh,Y,J]}],invert:[{invert:[``,Zh,Y,J]}],saturate:[{saturate:[Zh,Y,J]}],sepia:[{sepia:[``,Zh,Y,J]}],"backdrop-filter":[{"backdrop-filter":[``,`none`,Y,J]}],"backdrop-blur":[{"backdrop-blur":ne()}],"backdrop-brightness":[{"backdrop-brightness":[Zh,Y,J]}],"backdrop-contrast":[{"backdrop-contrast":[Zh,Y,J]}],"backdrop-grayscale":[{"backdrop-grayscale":[``,Zh,Y,J]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[Zh,Y,J]}],"backdrop-invert":[{"backdrop-invert":[``,Zh,Y,J]}],"backdrop-opacity":[{"backdrop-opacity":[Zh,Y,J]}],"backdrop-saturate":[{"backdrop-saturate":[Zh,Y,J]}],"backdrop-sepia":[{"backdrop-sepia":[``,Zh,Y,J]}],"border-collapse":[{border:[`collapse`,`separate`]}],"border-spacing":[{"border-spacing":w()}],"border-spacing-x":[{"border-spacing-x":w()}],"border-spacing-y":[{"border-spacing-y":w()}],"table-layout":[{table:[`auto`,`fixed`]}],caption:[{caption:[`top`,`bottom`]}],transition:[{transition:[``,`all`,`colors`,`opacity`,`shadow`,`transform`,`none`,Y,J]}],"transition-behavior":[{transition:[`normal`,`discrete`]}],duration:[{duration:[Zh,`initial`,Y,J]}],ease:[{ease:[`linear`,`initial`,_,Y,J]}],delay:[{delay:[Zh,Y,J]}],animate:[{animate:[`none`,v,Y,J]}],backface:[{backface:[`hidden`,`visible`]}],perspective:[{perspective:[h,Y,J]}],"perspective-origin":[{"perspective-origin":x()}],rotate:[{rotate:H()}],"rotate-x":[{"rotate-x":H()}],"rotate-y":[{"rotate-y":H()}],"rotate-z":[{"rotate-z":H()}],scale:[{scale:re()}],"scale-x":[{"scale-x":re()}],"scale-y":[{"scale-y":re()}],"scale-z":[{"scale-z":re()}],"scale-3d":[`scale-3d`],skew:[{skew:U()}],"skew-x":[{"skew-x":U()}],"skew-y":[{"skew-y":U()}],transform:[{transform:[Y,J,``,`none`,`gpu`,`cpu`]}],"transform-origin":[{origin:x()}],"transform-style":[{transform:[`3d`,`flat`]}],translate:[{translate:ie()}],"translate-x":[{"translate-x":ie()}],"translate-y":[{"translate-y":ie()}],"translate-z":[{"translate-z":ie()}],"translate-none":[`translate-none`],accent:[{accent:P()}],appearance:[{appearance:[`none`,`auto`]}],"caret-color":[{caret:P()}],"color-scheme":[{scheme:[`normal`,`dark`,`light`,`light-dark`,`only-dark`,`only-light`]}],cursor:[{cursor:[`auto`,`default`,`pointer`,`wait`,`text`,`move`,`help`,`not-allowed`,`none`,`context-menu`,`progress`,`cell`,`crosshair`,`vertical-text`,`alias`,`copy`,`no-drop`,`grab`,`grabbing`,`all-scroll`,`col-resize`,`row-resize`,`n-resize`,`e-resize`,`s-resize`,`w-resize`,`ne-resize`,`nw-resize`,`se-resize`,`sw-resize`,`ew-resize`,`ns-resize`,`nesw-resize`,`nwse-resize`,`zoom-in`,`zoom-out`,Y,J]}],"field-sizing":[{"field-sizing":[`fixed`,`content`]}],"pointer-events":[{"pointer-events":[`auto`,`none`]}],resize:[{resize:[`none`,``,`y`,`x`]}],"scroll-behavior":[{scroll:[`auto`,`smooth`]}],"scroll-m":[{"scroll-m":w()}],"scroll-mx":[{"scroll-mx":w()}],"scroll-my":[{"scroll-my":w()}],"scroll-ms":[{"scroll-ms":w()}],"scroll-me":[{"scroll-me":w()}],"scroll-mt":[{"scroll-mt":w()}],"scroll-mr":[{"scroll-mr":w()}],"scroll-mb":[{"scroll-mb":w()}],"scroll-ml":[{"scroll-ml":w()}],"scroll-p":[{"scroll-p":w()}],"scroll-px":[{"scroll-px":w()}],"scroll-py":[{"scroll-py":w()}],"scroll-ps":[{"scroll-ps":w()}],"scroll-pe":[{"scroll-pe":w()}],"scroll-pt":[{"scroll-pt":w()}],"scroll-pr":[{"scroll-pr":w()}],"scroll-pb":[{"scroll-pb":w()}],"scroll-pl":[{"scroll-pl":w()}],"snap-align":[{snap:[`start`,`end`,`center`,`align-none`]}],"snap-stop":[{snap:[`normal`,`always`]}],"snap-type":[{snap:[`none`,`x`,`y`,`both`]}],"snap-strictness":[{snap:[`mandatory`,`proximity`]}],touch:[{touch:[`auto`,`none`,`manipulation`]}],"touch-x":[{"touch-pan":[`x`,`left`,`right`]}],"touch-y":[{"touch-pan":[`y`,`up`,`down`]}],"touch-pz":[`touch-pinch-zoom`],select:[{select:[`none`,`text`,`all`,`auto`]}],"will-change":[{"will-change":[`auto`,`scroll`,`contents`,`transform`,Y,J]}],fill:[{fill:[`none`,...P()]}],"stroke-w":[{stroke:[Zh,pg,cg,lg]}],stroke:[{stroke:[`none`,...P()]}],"forced-color-adjust":[{"forced-color-adjust":[`auto`,`none`]}]},conflictingClassGroups:{overflow:[`overflow-x`,`overflow-y`],overscroll:[`overscroll-x`,`overscroll-y`],inset:[`inset-x`,`inset-y`,`start`,`end`,`top`,`right`,`bottom`,`left`],"inset-x":[`right`,`left`],"inset-y":[`top`,`bottom`],flex:[`basis`,`grow`,`shrink`],gap:[`gap-x`,`gap-y`],p:[`px`,`py`,`ps`,`pe`,`pt`,`pr`,`pb`,`pl`],px:[`pr`,`pl`],py:[`pt`,`pb`],m:[`mx`,`my`,`ms`,`me`,`mt`,`mr`,`mb`,`ml`],mx:[`mr`,`ml`],my:[`mt`,`mb`],size:[`w`,`h`],"font-size":[`leading`],"fvn-normal":[`fvn-ordinal`,`fvn-slashed-zero`,`fvn-figure`,`fvn-spacing`,`fvn-fraction`],"fvn-ordinal":[`fvn-normal`],"fvn-slashed-zero":[`fvn-normal`],"fvn-figure":[`fvn-normal`],"fvn-spacing":[`fvn-normal`],"fvn-fraction":[`fvn-normal`],"line-clamp":[`display`,`overflow`],rounded:[`rounded-s`,`rounded-e`,`rounded-t`,`rounded-r`,`rounded-b`,`rounded-l`,`rounded-ss`,`rounded-se`,`rounded-ee`,`rounded-es`,`rounded-tl`,`rounded-tr`,`rounded-br`,`rounded-bl`],"rounded-s":[`rounded-ss`,`rounded-es`],"rounded-e":[`rounded-se`,`rounded-ee`],"rounded-t":[`rounded-tl`,`rounded-tr`],"rounded-r":[`rounded-tr`,`rounded-br`],"rounded-b":[`rounded-br`,`rounded-bl`],"rounded-l":[`rounded-tl`,`rounded-bl`],"border-spacing":[`border-spacing-x`,`border-spacing-y`],"border-w":[`border-w-x`,`border-w-y`,`border-w-s`,`border-w-e`,`border-w-t`,`border-w-r`,`border-w-b`,`border-w-l`],"border-w-x":[`border-w-r`,`border-w-l`],"border-w-y":[`border-w-t`,`border-w-b`],"border-color":[`border-color-x`,`border-color-y`,`border-color-s`,`border-color-e`,`border-color-t`,`border-color-r`,`border-color-b`,`border-color-l`],"border-color-x":[`border-color-r`,`border-color-l`],"border-color-y":[`border-color-t`,`border-color-b`],translate:[`translate-x`,`translate-y`,`translate-none`],"translate-none":[`translate`,`translate-x`,`translate-y`,`translate-z`],"scroll-m":[`scroll-mx`,`scroll-my`,`scroll-ms`,`scroll-me`,`scroll-mt`,`scroll-mr`,`scroll-mb`,`scroll-ml`],"scroll-mx":[`scroll-mr`,`scroll-ml`],"scroll-my":[`scroll-mt`,`scroll-mb`],"scroll-p":[`scroll-px`,`scroll-py`,`scroll-ps`,`scroll-pe`,`scroll-pt`,`scroll-pr`,`scroll-pb`,`scroll-pl`],"scroll-px":[`scroll-pr`,`scroll-pl`],"scroll-py":[`scroll-pt`,`scroll-pb`],touch:[`touch-x`,`touch-y`,`touch-pz`],"touch-x":[`touch`],"touch-y":[`touch`],"touch-pz":[`touch`]},conflictingClassGroupModifiers:{"font-size":[`leading`]},orderSensitiveModifiers:[`*`,`**`,`after`,`backdrop`,`before`,`details-content`,`file`,`first-letter`,`first-line`,`marker`,`placeholder`,`selection`]}});function kg(...e){return Og(ch(e))}var Ag=360;function jg(e){let t=0;for(let n=0;n<e.length;n++){let r=e.charCodeAt(n);t=(t<<5)-t+r,t&=t}return Math.abs(t)}function Mg(e){return{"--badge-hue":`${jg(e)%Ag}`}}function Ng({name:e,fullPath:t,className:n=``}){let r=Mg(e);return(0,G.jsx)(`span`,{className:kg(`project-badge inline-flex items-center rounded-full px-1.5 py-0.5 text-[10px] font-medium leading-none`,n),style:r,title:t,children:e})}var Pg=6e4,Fg=new Map,Ig=new Map,Lg=new Map,Rg=new Set;function zg(e){let t=Fg.get(e);return t&&Date.now()-t.at<Pg?t.info:void 0}var Bg=`inline-flex items-center gap-1 rounded-full px-1.5 py-0.5 text-[11px] tabular-nums`,Vg=`inline-block h-1.5 w-1.5 rounded-full`;function Hg(e){if(!e||e.error||!e.state||e.isDraft)return`bg-muted`;switch(e.state){case`OPEN`:return`bg-green-500`;case`MERGED`:return`bg-purple-500`;case`CLOSED`:return`bg-red-500`;default:return`bg-muted`}}function Ug(e){return!e||!e.state?``:e.isDraft&&e.state===`OPEN`?`Draft`:e.state.charAt(0)+e.state.slice(1).toLowerCase()}var Wg=new Set([`SKIPPED`,`NEUTRAL`,`STALE`]);function Gg(e){return e.status===`COMPLETED`?e.conclusion===`SUCCESS`?{glyph:`✓`,cls:`text-green-500`}:e.conclusion&&Wg.has(e.conclusion)?{glyph:`–`,cls:`text-muted`}:{glyph:`✗`,cls:`text-red-500`}:{glyph:`…`,cls:`text-yellow-500`}}async function Kg(e){let t=e.filter(e=>!zg(e)&&!Lg.has(e));if(t.length>0){let e=fetch(`/api/pr-info`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({urls:t})}).then(e=>e.json()).then(e=>{for(let t of e)t.error||Fg.set(t.url,{at:Date.now(),info:t})}).catch(()=>{}).finally(()=>{t.forEach(e=>Lg.delete(e))});t.forEach(t=>Lg.set(t,e))}return await Promise.all(e.map(e=>Lg.get(e))),e.map(e=>zg(e)).filter(Boolean)}var qg=250,Jg=200,Yg=3,Xg=8;function Zg(e,t){let[n,r]=(0,x.useState)(!1),[i,a]=(0,x.useState)(null),o=(0,x.useRef)(void 0),s=(0,x.useRef)(void 0),c=(0,x.useRef)(null),l=(0,x.useCallback)(()=>{window.clearTimeout(o.current),o.current=void 0},[]),u=(0,x.useCallback)(()=>{window.clearTimeout(s.current),s.current=void 0},[]),d=(0,x.useCallback)(()=>{l(),u(),s.current=window.setTimeout(()=>r(!1),Jg)},[l,u]),f=(0,x.useCallback)(()=>{l(),u();let n=e.current?.getBoundingClientRect();if(n){let e=n.top-Xg,r=window.innerHeight-n.bottom-Xg,i=Math.max(Xg,Math.min(n.left,window.innerWidth-t-Xg)),o=e=>Math.max(60,e-Yg);a(e>=r?{left:i,bottom:window.innerHeight-n.top+Yg,maxHeight:o(e)}:{left:i,top:n.bottom+Yg,maxHeight:o(r)})}r(!0)},[e,l,u,t]),p=(0,x.useCallback)(()=>{u(),!n&&(l(),o.current=window.setTimeout(f,qg))},[u,l,n,f]);return(0,x.useEffect)(()=>{if(!n)return;let e=e=>{c.current?.contains(e.target)||r(!1)},t=()=>r(!1);return window.addEventListener(`scroll`,e,!0),window.addEventListener(`resize`,t),()=>{window.removeEventListener(`scroll`,e,!0),window.removeEventListener(`resize`,t)}},[n]),(0,x.useEffect)(()=>()=>{l(),u()},[l,u]),{open:n,pos:i,scheduleOpen:p,scheduleClose:d,cancelClose:u,cardRef:c}}function Qg({pr:e,refreshKey:t,pillClass:n=Bg}){let[r,i]=(0,x.useState)(zg(e.url)),[a,o]=(0,x.useState)(Ig.get(e.url)),s=(0,x.useRef)(null),{open:c,pos:l,scheduleOpen:u,scheduleClose:d,cancelClose:f,cardRef:p}=Zg(s,256),m=(0,x.useRef)(!0);(0,x.useEffect)(()=>(m.current=!0,()=>{m.current=!1}),[]),(0,x.useEffect)(()=>{let t=zg(e.url);if(t){i(e=>e??t);return}Kg([e.url]).then(t=>{let n=t.find(t=>t.url===e.url);m.current&&n&&i(n)})},[e.url,t]),(0,x.useEffect)(()=>{!c||Ig.has(e.url)||Rg.has(e.url)||(Rg.add(e.url),fetch(`/api/pr-checks?url=${encodeURIComponent(e.url)}`).then(e=>e.ok?e.json():null).then(t=>{t&&Ig.set(e.url,t),m.current&&t&&o(t)}).catch(()=>{}).finally(()=>Rg.delete(e.url)))},[c,e.url]);let h=a??r;return(0,G.jsxs)(`span`,{ref:s,className:`relative inline-flex shrink-0`,onMouseEnter:u,onMouseLeave:d,children:[(0,G.jsxs)(`a`,{href:e.url,target:`_blank`,rel:`noreferrer`,onClick:e=>e.stopPropagation(),className:`${n} bg-elevated text-muted hover:text-accent`,"aria-label":`${e.repo}#${e.number}`,children:[(0,G.jsx)(`span`,{className:`${Vg} ${Hg(h)}`}),`#`,e.number]}),c&&l&&(0,U.createPortal)((0,G.jsxs)(`div`,{ref:p,className:`fixed z-[100] flex w-64 flex-col rounded-md border border-border bg-elevated p-2 text-left shadow-lg`,style:{left:l.left,top:l.top,bottom:l.bottom,maxHeight:l.maxHeight},onMouseEnter:f,onMouseLeave:d,onClick:e=>e.stopPropagation(),children:[(0,G.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1.5 text-[11px]`,children:[(0,G.jsx)(`span`,{className:Hg(h)+` inline-block h-1.5 w-1.5 shrink-0 rounded-full`}),(0,G.jsx)(`span`,{className:`text-muted`,children:Ug(h)||`PR`}),(0,G.jsx)(`span`,{className:`text-muted`,children:`·`}),(0,G.jsxs)(`a`,{href:e.url,target:`_blank`,rel:`noreferrer`,className:`truncate text-muted hover:text-accent`,children:[e.repo,`#`,e.number]})]}),h?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noreferrer`,className:`mt-1 block shrink-0 text-xs text-primary hover:text-accent`,children:h.title??`(title unavailable)`}),(0,G.jsx)(`div`,{className:`mt-0.5 shrink-0 text-[11px] text-muted`,children:h.author?`by ${h.author}`:``}),a?.checks&&a.checks.length>0&&(0,G.jsx)(`div`,{className:`mt-1.5 max-h-32 min-h-0 space-y-0.5 overflow-y-auto border-t border-border pt-1.5`,children:a.checks.map((e,t)=>{let n=Gg(e),r=(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`span`,{className:n.cls,children:n.glyph}),(0,G.jsx)(`span`,{className:`truncate text-muted group-hover:text-accent`,children:e.name})]});return e.link?(0,G.jsx)(`a`,{href:e.link,target:`_blank`,rel:`noreferrer`,className:`group flex items-center gap-1.5 text-[11px]`,children:r},t):(0,G.jsx)(`div`,{className:`group flex items-center gap-1.5 text-[11px]`,children:r},t)})})]}):(0,G.jsxs)(`div`,{className:`mt-1 shrink-0 space-y-1`,children:[(0,G.jsx)(`div`,{className:`h-3 w-3/4 animate-pulse rounded bg-border`}),(0,G.jsx)(`div`,{className:`h-3 w-1/2 animate-pulse rounded bg-border`})]})]}),document.body)]})}function $g({prs:e,pillClass:t=Bg}){let[n,r]=(0,x.useState)(null),i=(0,x.useRef)(null),{open:a,pos:o,scheduleOpen:s,scheduleClose:c,cancelClose:l,cardRef:u}=Zg(i,224);return(0,x.useEffect)(()=>{!a||n&&e.every(e=>n.has(e.url))||Kg(e.map(e=>e.url)).then(e=>{r(t=>{let n=new Map(t??[]);for(let t of e)n.set(t.url,t);return n})})},[a,n,e]),(0,G.jsxs)(`span`,{ref:i,className:`relative inline-flex shrink-0`,onMouseEnter:s,onMouseLeave:c,children:[(0,G.jsxs)(`span`,{className:`${t} cursor-default text-muted`,"aria-label":`${e.length} more PR${e.length===1?``:`s`}`,children:[`+`,e.length]}),a&&o&&(0,U.createPortal)((0,G.jsxs)(`div`,{ref:u,className:`fixed z-[100] flex w-56 flex-col rounded-md border border-border bg-elevated p-2 text-left shadow-lg`,style:{left:o.left,top:o.top,bottom:o.bottom,maxHeight:o.maxHeight},onMouseEnter:l,onMouseLeave:c,onClick:e=>e.stopPropagation(),children:[(0,G.jsxs)(`div`,{className:`shrink-0 text-[11px] text-muted`,children:[e.length,` more PR`,e.length===1?``:`s`]}),(0,G.jsx)(`div`,{className:`mt-1 max-h-48 min-h-0 space-y-0.5 overflow-y-auto border-t border-border pt-1.5`,children:e.map(e=>(0,G.jsxs)(`a`,{href:e.url,target:`_blank`,rel:`noreferrer`,className:`flex items-center gap-1.5 text-[11px] text-secondary hover:text-accent`,children:[(0,G.jsx)(`span`,{className:`inline-block h-1.5 w-1.5 shrink-0 rounded-full ${Hg(n?.get(e.url))}`}),(0,G.jsxs)(`span`,{className:`tabular-nums`,children:[`#`,e.number]}),(0,G.jsx)(`span`,{className:`truncate text-muted`,children:e.repo})]},e.url))})]}),document.body)]})}function e_({prs:e,className:t=`pl-[1.375rem]`,pillClass:n=Bg}){let r=(0,x.useRef)(null),i=(0,x.useRef)([]),a=(0,x.useRef)(null),o=(0,x.useRef)(null),s=(0,x.useMemo)(()=>[...e].reverse(),[e]),[c,l]=(0,x.useState)(s.length),[u,d]=(0,x.useState)(0);(0,x.useEffect)(()=>{let e=()=>{document.visibilityState===`visible`&&d(e=>e+1)};return document.addEventListener?.(`visibilitychange`,e),()=>document.removeEventListener?.(`visibilitychange`,e)},[]);let f=(0,x.useCallback)(()=>{let e=s.length,t=r.current;if(!t||typeof t.clientWidth!=`number`||t.clientWidth===0){l(e);return}let n=getComputedStyle(t),c=t.clientWidth-(parseFloat(n.paddingLeft)||0)-(parseFloat(n.paddingRight)||0),u=parseFloat(n.columnGap)||0,d=a.current?.offsetWidth??0,f=Math.max(0,(o.current?.offsetWidth??d)-d),p=e=>d+String(e).length*f,m=0,h=0;for(let t=0;t<e;t++){let n=i.current[t]?.offsetWidth??0,r=e-t-1,a=r>0?u+p(r):0,o=(h>0?u:0)+n+a;if(m+o>c)break;m+=o-a,h++}l(h)},[s]);if((0,x.useLayoutEffect)(()=>{f()},[f]),(0,x.useEffect)(()=>{let e=r.current;if(!e||typeof ResizeObserver>`u`)return window.addEventListener(`resize`,f),()=>window.removeEventListener(`resize`,f);let t=new ResizeObserver(f);return t.observe(e),()=>t.disconnect()},[f]),(0,x.useEffect)(()=>{document.fonts?.ready.then(f).catch(()=>{})},[f]),s.length===0)return null;let p=s.slice(0,c),m=s.slice(c);return(0,G.jsxs)(`div`,{ref:r,className:`relative flex flex-nowrap items-center gap-1 overflow-hidden ${t}`,children:[p.map(e=>(0,G.jsx)(Qg,{pr:e,refreshKey:u,pillClass:n},e.url)),m.length>0&&(0,G.jsx)($g,{prs:m,pillClass:n}),(0,G.jsxs)(`span`,{"aria-hidden":!0,className:`invisible absolute left-0 top-0 flex flex-nowrap`,children:[s.map((e,t)=>(0,G.jsxs)(`span`,{ref:e=>{i.current[t]=e},className:n,children:[(0,G.jsx)(`span`,{className:Vg}),`#`,e.number]},e.url)),(0,G.jsx)(`span`,{ref:a,className:n,children:`+`}),(0,G.jsx)(`span`,{ref:o,className:n,children:`+0`})]})]})}var t_=(0,x.memo)(function({session:e,showSessionIdPrefix:t,showProjectName:n,showLastUserMessage:r,onResume:i,onPreview:a}){let o=Im(e.lastActivityAt),s=Lm(e.projectPath),c=e.displayName||s||e.sessionId.slice(0,8),l=n&&!!s,u=r&&!!e.lastUserMessage,d=t?zm(e.sessionId):``,f=(0,x.useRef)(null),[p,m]=(0,x.useState)(null);return(0,x.useEffect)(()=>{if(!p)return;let e=e=>{f.current&&!f.current.contains(e.target)&&m(null)},t=e=>{e.key===`Escape`&&m(null)};return document.addEventListener(`mousedown`,e),document.addEventListener(`touchstart`,e),document.addEventListener(`keydown`,t),()=>{document.removeEventListener(`mousedown`,e),document.removeEventListener(`touchstart`,e),document.removeEventListener(`keydown`,t)}},[p]),(0,G.jsxs)(`div`,{className:`group relative cursor-pointer px-3 py-2 hover:bg-hover`,role:`button`,tabIndex:0,title:`Click to preview`,onClick:()=>a(e),onKeyDown:t=>{(t.key===`Enter`||t.key===` `)&&(t.preventDefault(),a(e))},onContextMenu:e=>{e.preventDefault(),e.stopPropagation(),m({x:e.clientX,y:e.clientY})},children:[(0,G.jsx)(`button`,{type:`button`,className:`absolute right-3 top-1/2 -translate-y-1/2 text-xs text-muted opacity-0 hover:text-primary group-hover:opacity-100`,title:`Wake directly`,onClick:t=>{t.stopPropagation(),i(e.sessionId)},children:`▶`}),(0,G.jsxs)(`div`,{className:`flex flex-col gap-0.5 pl-2.5 group-hover:pr-4`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(oh,{agentType:e.agentType,className:`h-3.5 w-3.5 shrink-0 text-muted`}),(0,G.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-sm font-medium text-primary`,children:c}),e.lastResumeError&&(0,G.jsx)(W,{className:`h-3 w-3 shrink-0 text-amber-500`,"aria-label":`Wake failed`,title:`Last wake failed: ${e.lastResumeError}`}),d&&(0,G.jsx)(`span`,{className:`shrink-0 text-[11px] font-mono text-muted`,title:e.sessionId,children:d}),(0,G.jsx)(`span`,{className:`ml-1 w-8 shrink-0 text-right text-xs tabular-nums text-muted`,children:o})]}),(l||u)&&(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1 pl-[1.375rem]`,children:[l&&(0,G.jsx)(Ng,{name:s,fullPath:e.projectPath}),u&&(0,G.jsxs)(`span`,{className:`truncate text-xs italic text-muted`,children:[`"`,e.lastUserMessage.length>200?e.lastUserMessage.slice(0,200)+`…`:e.lastUserMessage,`"`]})]}),e.prs&&e.prs.length>0&&(0,G.jsx)(e_,{prs:e.prs})]}),p&&(0,G.jsx)(`div`,{ref:f,className:`fixed z-50 min-w-[160px] rounded-md border border-border bg-elevated shadow-lg py-1`,style:{left:p.x,top:p.y},role:`menu`,children:e.logFilePath&&(0,G.jsxs)(`button`,{onClick:t=>{t.stopPropagation(),m(null),e.logFilePath&&Bm(e.logFilePath)},className:`w-full px-3 py-2 text-left text-sm text-secondary hover:bg-hover hover:text-primary flex items-center gap-2`,role:`menuitem`,title:e.logFilePath,children:[(0,G.jsx)(ve,{width:14,height:14}),`Copy Log Path`]})})]})});function n_({name:e,className:t=``}){let n=Mg(`host:${e}`);return(0,G.jsx)(`span`,{className:kg(`inline-flex items-center rounded-full px-1.5 py-0.5 text-[10px] font-medium uppercase leading-none tracking-wide`,t),style:n,title:e,children:e})}function r_({hosts:e,selectedHosts:t,onSelect:n,statuses:r=[]}){let[i,a]=(0,x.useState)(!1),o=(0,x.useId)(),s=(0,x.useRef)(null),c=(0,x.useMemo)(()=>new Set(t),[t]),l=(0,x.useMemo)(()=>new Map(r.map(e=>[e.host,e])),[r]),u=(0,x.useMemo)(()=>t.length===0?`All Hosts`:t.join(`, `),[t]),d=(0,x.useMemo)(()=>t.length===0?`All Hosts`:t.length===1?t[0]:`${t.length} hosts`,[t]);(0,x.useEffect)(()=>{if(!i||typeof document>`u`||!document.addEventListener||!document.removeEventListener)return;let e=e=>{let t=e.target;t&&s.current?.contains(t)||a(!1)},t=e=>{e.key===`Escape`&&a(!1)};return document.addEventListener(`mousedown`,e),document.addEventListener(`touchstart`,e,{passive:!0}),document.addEventListener(`keydown`,t),()=>{document.removeEventListener(`mousedown`,e),document.removeEventListener(`touchstart`,e),document.removeEventListener(`keydown`,t)}},[i]);let f=t=>{let r=new Set(c);r.has(t)?r.delete(t):r.add(t),n(e.filter(e=>r.has(e)))};return(0,G.jsxs)(`div`,{ref:s,className:`relative`,children:[(0,G.jsxs)(`button`,{type:`button`,"aria-haspopup":`menu`,"aria-expanded":i,"aria-controls":o,"aria-label":`Filter by host`,onClick:()=>a(e=>!e),className:`flex h-6 max-w-[9rem] items-center gap-1.5 rounded border border-border bg-base px-2 text-[11px] text-primary hover:bg-hover focus:border-accent focus:outline-none`,title:u,children:[(0,G.jsx)(Ie,{className:`h-3.5 w-3.5 shrink-0`}),(0,G.jsx)(`span`,{className:`truncate leading-none`,children:d}),(0,G.jsx)(oe,{className:`h-3 w-3 shrink-0 text-muted`})]}),i&&(0,G.jsxs)(`div`,{id:o,role:`menu`,className:`absolute left-0 z-20 mt-1 w-48 max-w-[calc(100vw-1.5rem)] rounded border border-border bg-surface p-2 text-xs shadow-lg`,children:[(0,G.jsxs)(`label`,{role:`menuitemcheckbox`,"aria-checked":t.length===0,className:`flex cursor-pointer items-center gap-2 rounded px-2 py-1.5 text-primary hover:bg-hover`,children:[(0,G.jsx)(`input`,{type:`checkbox`,checked:t.length===0,onChange:()=>n([]),className:`h-3.5 w-3.5 accent-approval`}),(0,G.jsx)(`span`,{children:`All Hosts`})]}),(0,G.jsx)(`div`,{className:`my-2 h-px bg-border`}),e.length===0?(0,G.jsx)(`div`,{className:`px-2 py-1 text-muted`,children:`No hosts`}):(0,G.jsx)(`div`,{className:`max-h-48 overflow-y-auto pr-1`,children:e.map(e=>{let t=l.get(e),n=t?!t.ok:!1;return(0,G.jsxs)(`label`,{role:`menuitemcheckbox`,"aria-checked":c.has(e),className:`flex cursor-pointer items-center gap-2 rounded px-2 py-1.5 text-primary hover:bg-hover`,title:t?.error?`${e}: ${t.error}`:e,children:[(0,G.jsx)(`input`,{type:`checkbox`,checked:c.has(e),onChange:()=>f(e),className:`h-3.5 w-3.5 accent-approval`}),(0,G.jsx)(`span`,{className:`truncate`,children:e}),n&&(0,G.jsx)(`span`,{className:`ml-auto text-[10px] uppercase text-danger`,children:`offline`})]},e)})})]})]})}function i_({projects:e,selectedProjects:t,onSelect:n,hasHiddenPermissions:r}){let[i,a]=(0,x.useState)(!1),o=(0,x.useId)(),s=(0,x.useRef)(null),c=(0,x.useMemo)(()=>Rm(e),[e]),l=(0,x.useMemo)(()=>new Set(t),[t]),u=r&&t.length>0,d=(0,x.useMemo)(()=>t.length===0?`All Projects`:t.map(e=>c.get(e)??Lm(e)??e).join(`, `),[c,t]),f=(0,x.useMemo)(()=>{if(t.length===0)return`All Projects`;if(t.length===1){let e=t[0];return c.get(e)??Lm(e)??e}return`${t.length} projects`},[c,t]);(0,x.useEffect)(()=>{if(!i||typeof document>`u`||!document.addEventListener||!document.removeEventListener)return;let e=e=>{let t=e.target;t&&s.current?.contains(t)||a(!1)},t=e=>{e.key===`Escape`&&a(!1)};return document.addEventListener(`mousedown`,e),document.addEventListener(`touchstart`,e,{passive:!0}),document.addEventListener(`keydown`,t),()=>{document.removeEventListener(`mousedown`,e),document.removeEventListener(`touchstart`,e),document.removeEventListener(`keydown`,t)}},[i]);let p=t=>{let r=new Set(l);r.has(t)?r.delete(t):r.add(t),n(e.filter(e=>r.has(e)))};return(0,G.jsxs)(`div`,{ref:s,className:`relative`,children:[(0,G.jsxs)(`button`,{type:`button`,"aria-haspopup":`menu`,"aria-expanded":i,"aria-controls":o,"aria-label":`Filter by project`,onClick:()=>a(e=>!e),className:`flex h-6 max-w-[11rem] items-center gap-1.5 rounded border border-border bg-base px-2 text-[11px] text-primary hover:bg-hover focus:border-accent focus:outline-none`,title:d,children:[(0,G.jsx)(be,{className:`h-3.5 w-3.5 shrink-0`}),(0,G.jsx)(`span`,{className:`truncate leading-none`,children:f}),(0,G.jsx)(oe,{className:`h-3 w-3 shrink-0 text-muted`})]}),i&&(0,G.jsxs)(`div`,{id:o,role:`menu`,className:`absolute left-0 z-20 mt-1 w-60 max-w-[calc(100vw-1.5rem)] rounded border border-border bg-surface p-2 text-xs shadow-lg`,children:[(0,G.jsxs)(`label`,{className:`flex cursor-pointer items-center gap-2 rounded px-2 py-1.5 text-primary hover:bg-hover`,children:[(0,G.jsx)(`input`,{type:`checkbox`,checked:t.length===0,onChange:()=>n([]),className:`h-3.5 w-3.5 accent-approval`}),(0,G.jsx)(`span`,{children:`All Projects`})]}),(0,G.jsx)(`div`,{className:`my-2 h-px bg-border`}),e.length===0?(0,G.jsx)(`div`,{className:`px-2 py-1 text-muted`,children:`No projects`}):(0,G.jsx)(`div`,{className:`max-h-48 overflow-y-auto pr-1`,children:e.map(e=>{let t=c.get(e)??Lm(e)??e;return(0,G.jsxs)(`label`,{className:`flex cursor-pointer items-center gap-2 rounded px-2 py-1.5 text-primary hover:bg-hover`,title:e,children:[(0,G.jsx)(`input`,{type:`checkbox`,checked:l.has(e),onChange:()=>p(e),className:`h-3.5 w-3.5 accent-approval`}),(0,G.jsx)(`span`,{className:`truncate`,children:t})]},e)})})]}),u&&(0,G.jsx)(`button`,{type:`button`,className:`absolute -right-1 -top-1 h-2 w-2 rounded-full bg-approval pulse-approval ring-2 ring-elevated`,title:`Hidden sessions need attention`,"aria-label":`Clear project filters`,onClick:e=>{e.stopPropagation(),n([])},children:(0,G.jsx)(`span`,{className:`sr-only`,children:`Clear project filters`})})]})}function a_(e){return!e||typeof e!=`object`||Array.isArray(e)?null:e}function o_(e){return typeof e==`string`?e:null}var s_=new Set([`tool_result`,`custom_tool_call_output`]),c_=new Set([`text`,`input_text`,`output_text`]);function l_(e){return e===`user`?`user`:e===`assistant`?`assistant`:e===`system`||e===`developer`?`system`:e===`tool`?`tool`:`other`}function u_(e){let t=o_(e.type)??``,n=a_(e.payload),r=o_(n?.type)??``,i=o_(e.source)??o_(n?.source)??``,a=o_(e.agent)??``;return i.toLowerCase()===`pi`||a.toLowerCase()===`pi`?`pi`:i.toLowerCase()===`devin`||a.toLowerCase()===`devin`?`devin`:i.toLowerCase()===`grok`||a.toLowerCase()===`grok`||e.synthetic_reason!==void 0||e.prompt_index!==void 0||e.model_fingerprint!==void 0||e.encrypted_content!==void 0?`grok`:t===`response_item`||t===`event_msg`?`codex`:t===`tool_use`||t===`result`||t===`user`||t===`assistant`||t===`system`?`claude`:r===`user_message`||r===`assistant_message`?`codex`:`unknown`}function d_(e){let t=o_(a_(e.payload)?.type);return{family:u_(e),rawType:o_(e.type)??`unknown`,...t?{payloadType:t}:{}}}function f_(e){if(!e)return[];if(typeof e==`string`)return e.trim()?[e]:[];if(Array.isArray(e)){let t=[];for(let n of e){if(typeof n==`string`){n.trim()&&t.push(n);continue}let e=a_(n);if(!e)continue;let r=o_(e.type);if(r&&s_.has(r)||r&&!c_.has(r))continue;let i=o_(e.text);i&&i.trim()&&t.push(i)}return t}let t=a_(e);if(t){let e=o_(t.type);if(e&&s_.has(e))return[];let n=o_(t.text);return n&&n.trim()?[n]:[...f_(t.content),...f_(t.message)]}return[]}function p_(e,t){if(e.type!==`response_item`)return[];let n=a_(e.payload);if(!n||n.type!==`message`)return[];let r=l_(n.role);return f_(n.content).map(e=>({kind:`message`,role:r,text:e,source:t}))}function m_(e,t){if(e.type!==`event_msg`)return[];let n=a_(e.payload);if(!n)return[];let r=o_(n.type),i=null;if(r===`user_message`?i=`user`:r===`assistant_message`||r===`agent_message`?i=`assistant`:r===`system_message`?i=`system`:r===`message`&&(i=l_(n.role)),!i||![`user`,`assistant`,`system`].includes(i))return[];let a=Array.from(new Set([...f_(n.message),...f_(n.content),...f_(n.text)]));return a.length===0?[]:a.map(e=>({kind:`message`,role:i,text:e,source:t}))}function h_(e,t){let n=l_(e.type),r=a_(e.message);if(r){let n=l_(r.role??e.type);return[...f_(r.content),...f_(r.text),...f_(r.message)].map(e=>({kind:`message`,role:n,text:e,source:t}))}return[`user`,`assistant`,`system`].includes(n)?[...f_(e.content),...f_(e.text)].map(e=>({kind:`message`,role:n,text:e,source:t})):[]}function g_(e,t){let n=l_(e.role);return[`user`,`assistant`,`system`].includes(n)?[...f_(e.content),...f_(e.message),...f_(e.text)].map(e=>({kind:`message`,role:n,text:e,source:t})):[]}function __(e,t){let n=o_(e.type),r=o_(e.event);return n!==`tool_use`&&r!==`tool_use`?[]:[{kind:`tool_call`,role:`assistant`,text:`[Tool: ${o_(e.name)??`tool`}]`,source:t}]}function v_(e,t){if(e.type!==`result`)return[];let n=o_(e.result);return!n||!n.trim()?[]:[{kind:`result`,role:`system`,text:n,source:t}]}function y_(e,t){let n=a_(e.payload),r=[...f_(e.message),...f_(e.content),...f_(e.text),...f_(n?.message),...f_(n?.content)];return r.length===0?[]:r.map(e=>({kind:`unknown`,role:`other`,text:e,source:t}))}function b_(e,t){let n=o_(e.type),r=o_(a_(e.payload)?.type);return n&&s_.has(n)||r&&s_.has(r)?[{kind:`tool_result`,role:`tool`,text:``,source:t}]:[]}function x_(e,t){let n=e.tool_calls;return t.family!==`grok`||!Array.isArray(n)?[]:n.map(e=>a_(e)).filter(e=>e!==null).map(e=>({kind:`tool_call`,role:`assistant`,text:`[Tool: ${o_(e.name)??`tool`}]`,source:t}))}function S_(e){let t=a_(e);if(!t||t.isMeta===!0||t.synthetic_reason!==void 0)return[];let n=d_(t),r=[...p_(t,n),...m_(t,n),...h_(t,n),...__(t,n),...v_(t,n),...b_(t,n),...x_(t,n)];if(r.length>0)return r;let i=g_(t,n);return i.length>0?i:y_(t,n)}function C_(e){let t=e.trim();if(!t)return null;try{let e=JSON.parse(t);return{parsed:!0,events:S_(e),raw:e}}catch{return{parsed:!1,events:[{kind:`unknown`,role:`other`,text:t,source:{family:`unknown`,rawType:`raw_text`}}],raw:e}}}function w_(e,t){let n=t||{};return(e[e.length-1]===``?[...e,``]:e).join((n.padRight?` `:``)+`,`+(n.padLeft===!1?``:` `)).trim()}var T_=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,E_=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,D_={};function O_(e,t){return((t||D_).jsx?E_:T_).test(e)}var k_=/[ \t\n\f\r]/g;function A_(e){return typeof e==`object`?e.type===`text`?j_(e.value):!1:j_(e)}function j_(e){return e.replace(k_,``)===``}var M_=class{constructor(e,t,n){this.normal=t,this.property=e,n&&(this.space=n)}};M_.prototype.normal={},M_.prototype.property={},M_.prototype.space=void 0;function N_(e,t){let n={},r={};for(let t of e)Object.assign(n,t.property),Object.assign(r,t.normal);return new M_(n,r,t)}function P_(e){return e.toLowerCase()}var F_=class{constructor(e,t){this.attribute=t,this.property=e}};F_.prototype.attribute=``,F_.prototype.booleanish=!1,F_.prototype.boolean=!1,F_.prototype.commaOrSpaceSeparated=!1,F_.prototype.commaSeparated=!1,F_.prototype.defined=!1,F_.prototype.mustUseProperty=!1,F_.prototype.number=!1,F_.prototype.overloadedBoolean=!1,F_.prototype.property=``,F_.prototype.spaceSeparated=!1,F_.prototype.space=void 0;var I_=c({boolean:()=>R_,booleanish:()=>z_,commaOrSpaceSeparated:()=>U_,commaSeparated:()=>H_,number:()=>X,overloadedBoolean:()=>B_,spaceSeparated:()=>V_}),L_=0,R_=W_(),z_=W_(),B_=W_(),X=W_(),V_=W_(),H_=W_(),U_=W_();function W_(){return 2**++L_}var G_=Object.keys(I_),K_=class extends F_{constructor(e,t,n,r){let i=-1;if(super(e,t),q_(this,`space`,r),typeof n==`number`)for(;++i<G_.length;){let e=G_[i];q_(this,G_[i],(n&I_[e])===I_[e])}}};K_.prototype.defined=!0;function q_(e,t,n){n&&(e[t]=n)}function J_(e){let t={},n={};for(let[r,i]of Object.entries(e.properties)){let a=new K_(r,e.transform(e.attributes||{},r),i,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(a.mustUseProperty=!0),t[r]=a,n[P_(r)]=r,n[P_(a.attribute)]=r}return new M_(t,n,e.space)}var Y_=J_({properties:{ariaActiveDescendant:null,ariaAtomic:z_,ariaAutoComplete:null,ariaBusy:z_,ariaChecked:z_,ariaColCount:X,ariaColIndex:X,ariaColSpan:X,ariaControls:V_,ariaCurrent:null,ariaDescribedBy:V_,ariaDetails:null,ariaDisabled:z_,ariaDropEffect:V_,ariaErrorMessage:null,ariaExpanded:z_,ariaFlowTo:V_,ariaGrabbed:z_,ariaHasPopup:null,ariaHidden:z_,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:V_,ariaLevel:X,ariaLive:null,ariaModal:z_,ariaMultiLine:z_,ariaMultiSelectable:z_,ariaOrientation:null,ariaOwns:V_,ariaPlaceholder:null,ariaPosInSet:X,ariaPressed:z_,ariaReadOnly:z_,ariaRelevant:null,ariaRequired:z_,ariaRoleDescription:V_,ariaRowCount:X,ariaRowIndex:X,ariaRowSpan:X,ariaSelected:z_,ariaSetSize:X,ariaSort:null,ariaValueMax:X,ariaValueMin:X,ariaValueNow:X,ariaValueText:null,role:null},transform(e,t){return t===`role`?t:`aria-`+t.slice(4).toLowerCase()}});function X_(e,t){return t in e?e[t]:t}function Z_(e,t){return X_(e,t.toLowerCase())}var Q_=J_({attributes:{acceptcharset:`accept-charset`,classname:`class`,htmlfor:`for`,httpequiv:`http-equiv`},mustUseProperty:[`checked`,`multiple`,`muted`,`selected`],properties:{abbr:null,accept:H_,acceptCharset:V_,accessKey:V_,action:null,allow:null,allowFullScreen:R_,allowPaymentRequest:R_,allowUserMedia:R_,alpha:R_,alt:null,as:null,async:R_,autoCapitalize:null,autoComplete:V_,autoFocus:R_,autoPlay:R_,blocking:V_,capture:null,charSet:null,checked:R_,cite:null,className:V_,closedBy:null,colorSpace:null,cols:X,colSpan:X,command:null,commandFor:null,content:null,contentEditable:z_,controls:R_,controlsList:V_,coords:X|H_,crossOrigin:null,data:null,dateTime:null,decoding:null,default:R_,defer:R_,dir:null,dirName:null,disabled:R_,download:B_,draggable:z_,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:R_,formTarget:null,headers:V_,height:X,hidden:B_,high:X,href:null,hrefLang:null,htmlFor:V_,httpEquiv:V_,id:null,imageSizes:null,imageSrcSet:null,inert:R_,inputMode:null,integrity:null,is:null,isMap:R_,itemId:null,itemProp:V_,itemRef:V_,itemScope:R_,itemType:V_,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:R_,low:X,manifest:null,max:null,maxLength:X,media:null,method:null,min:null,minLength:X,multiple:R_,muted:R_,name:null,nonce:null,noModule:R_,noValidate:R_,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:R_,optimum:X,pattern:null,ping:V_,placeholder:null,playsInline:R_,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:R_,referrerPolicy:null,rel:V_,required:R_,reversed:R_,rows:X,rowSpan:X,sandbox:V_,scope:null,scoped:R_,seamless:R_,selected:R_,shadowRootClonable:R_,shadowRootCustomElementRegistry:R_,shadowRootDelegatesFocus:R_,shadowRootMode:null,shadowRootSerializable:R_,shape:null,size:X,sizes:null,slot:null,span:X,spellCheck:z_,src:null,srcDoc:null,srcLang:null,srcSet:null,start:X,step:null,style:null,tabIndex:X,target:null,title:null,translate:null,type:null,typeMustMatch:R_,useMap:null,value:z_,width:X,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:V_,axis:null,background:null,bgColor:null,border:X,borderColor:null,bottomMargin:X,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:R_,declare:R_,event:null,face:null,frame:null,frameBorder:null,hSpace:X,leftMargin:X,link:null,longDesc:null,lowSrc:null,marginHeight:X,marginWidth:X,noResize:R_,noHref:R_,noShade:R_,noWrap:R_,object:null,profile:null,prompt:null,rev:null,rightMargin:X,rules:null,scheme:null,scrolling:z_,standby:null,summary:null,text:null,topMargin:X,valueType:null,version:null,vAlign:null,vLink:null,vSpace:X,allowTransparency:null,autoCorrect:null,autoSave:null,credentialless:R_,disablePictureInPicture:R_,disableRemotePlayback:R_,exportParts:H_,part:V_,prefix:null,property:null,results:X,security:null,unselectable:null},space:`html`,transform:Z_}),$_=J_({attributes:{accentHeight:`accent-height`,alignmentBaseline:`alignment-baseline`,arabicForm:`arabic-form`,baselineShift:`baseline-shift`,capHeight:`cap-height`,className:`class`,clipPath:`clip-path`,clipRule:`clip-rule`,colorInterpolation:`color-interpolation`,colorInterpolationFilters:`color-interpolation-filters`,colorProfile:`color-profile`,colorRendering:`color-rendering`,crossOrigin:`crossorigin`,dataType:`datatype`,dominantBaseline:`dominant-baseline`,enableBackground:`enable-background`,fillOpacity:`fill-opacity`,fillRule:`fill-rule`,floodColor:`flood-color`,floodOpacity:`flood-opacity`,fontFamily:`font-family`,fontSize:`font-size`,fontSizeAdjust:`font-size-adjust`,fontStretch:`font-stretch`,fontStyle:`font-style`,fontVariant:`font-variant`,fontWeight:`font-weight`,glyphName:`glyph-name`,glyphOrientationHorizontal:`glyph-orientation-horizontal`,glyphOrientationVertical:`glyph-orientation-vertical`,hrefLang:`hreflang`,horizAdvX:`horiz-adv-x`,horizOriginX:`horiz-origin-x`,horizOriginY:`horiz-origin-y`,imageRendering:`image-rendering`,letterSpacing:`letter-spacing`,lightingColor:`lighting-color`,markerEnd:`marker-end`,markerMid:`marker-mid`,markerStart:`marker-start`,maskType:`mask-type`,navDown:`nav-down`,navDownLeft:`nav-down-left`,navDownRight:`nav-down-right`,navLeft:`nav-left`,navNext:`nav-next`,navPrev:`nav-prev`,navRight:`nav-right`,navUp:`nav-up`,navUpLeft:`nav-up-left`,navUpRight:`nav-up-right`,onAbort:`onabort`,onActivate:`onactivate`,onAfterPrint:`onafterprint`,onBeforePrint:`onbeforeprint`,onBegin:`onbegin`,onCancel:`oncancel`,onCanPlay:`oncanplay`,onCanPlayThrough:`oncanplaythrough`,onChange:`onchange`,onClick:`onclick`,onClose:`onclose`,onCopy:`oncopy`,onCueChange:`oncuechange`,onCut:`oncut`,onDblClick:`ondblclick`,onDrag:`ondrag`,onDragEnd:`ondragend`,onDragEnter:`ondragenter`,onDragExit:`ondragexit`,onDragLeave:`ondragleave`,onDragOver:`ondragover`,onDragStart:`ondragstart`,onDrop:`ondrop`,onDurationChange:`ondurationchange`,onEmptied:`onemptied`,onEnd:`onend`,onEnded:`onended`,onError:`onerror`,onFocus:`onfocus`,onFocusIn:`onfocusin`,onFocusOut:`onfocusout`,onHashChange:`onhashchange`,onInput:`oninput`,onInvalid:`oninvalid`,onKeyDown:`onkeydown`,onKeyPress:`onkeypress`,onKeyUp:`onkeyup`,onLoad:`onload`,onLoadedData:`onloadeddata`,onLoadedMetadata:`onloadedmetadata`,onLoadStart:`onloadstart`,onMessage:`onmessage`,onMouseDown:`onmousedown`,onMouseEnter:`onmouseenter`,onMouseLeave:`onmouseleave`,onMouseMove:`onmousemove`,onMouseOut:`onmouseout`,onMouseOver:`onmouseover`,onMouseUp:`onmouseup`,onMouseWheel:`onmousewheel`,onOffline:`onoffline`,onOnline:`ononline`,onPageHide:`onpagehide`,onPageShow:`onpageshow`,onPaste:`onpaste`,onPause:`onpause`,onPlay:`onplay`,onPlaying:`onplaying`,onPopState:`onpopstate`,onProgress:`onprogress`,onRateChange:`onratechange`,onRepeat:`onrepeat`,onReset:`onreset`,onResize:`onresize`,onScroll:`onscroll`,onSeeked:`onseeked`,onSeeking:`onseeking`,onSelect:`onselect`,onShow:`onshow`,onStalled:`onstalled`,onStorage:`onstorage`,onSubmit:`onsubmit`,onSuspend:`onsuspend`,onTimeUpdate:`ontimeupdate`,onToggle:`ontoggle`,onUnload:`onunload`,onVolumeChange:`onvolumechange`,onWaiting:`onwaiting`,onZoom:`onzoom`,overlinePosition:`overline-position`,overlineThickness:`overline-thickness`,paintOrder:`paint-order`,panose1:`panose-1`,pointerEvents:`pointer-events`,referrerPolicy:`referrerpolicy`,renderingIntent:`rendering-intent`,shapeRendering:`shape-rendering`,stopColor:`stop-color`,stopOpacity:`stop-opacity`,strikethroughPosition:`strikethrough-position`,strikethroughThickness:`strikethrough-thickness`,strokeDashArray:`stroke-dasharray`,strokeDashOffset:`stroke-dashoffset`,strokeLineCap:`stroke-linecap`,strokeLineJoin:`stroke-linejoin`,strokeMiterLimit:`stroke-miterlimit`,strokeOpacity:`stroke-opacity`,strokeWidth:`stroke-width`,tabIndex:`tabindex`,textAnchor:`text-anchor`,textDecoration:`text-decoration`,textRendering:`text-rendering`,transformOrigin:`transform-origin`,typeOf:`typeof`,underlinePosition:`underline-position`,underlineThickness:`underline-thickness`,unicodeBidi:`unicode-bidi`,unicodeRange:`unicode-range`,unitsPerEm:`units-per-em`,vAlphabetic:`v-alphabetic`,vHanging:`v-hanging`,vIdeographic:`v-ideographic`,vMathematical:`v-mathematical`,vectorEffect:`vector-effect`,vertAdvY:`vert-adv-y`,vertOriginX:`vert-origin-x`,vertOriginY:`vert-origin-y`,wordSpacing:`word-spacing`,writingMode:`writing-mode`,xHeight:`x-height`,playbackOrder:`playbackorder`,timelineBegin:`timelinebegin`},properties:{about:U_,accentHeight:X,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:X,amplitude:X,arabicForm:null,ascent:X,attributeName:null,attributeType:null,azimuth:X,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:X,by:null,calcMode:null,capHeight:X,className:V_,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:X,diffuseConstant:X,direction:null,display:null,dur:null,divisor:X,dominantBaseline:null,download:R_,dx:null,dy:null,edgeMode:null,editable:null,elevation:X,enableBackground:null,end:null,event:null,exponent:X,externalResourcesRequired:null,fill:null,fillOpacity:X,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:H_,g2:H_,glyphName:H_,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:X,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:X,horizOriginX:X,horizOriginY:X,id:null,ideographic:X,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:X,k:X,k1:X,k2:X,k3:X,k4:X,kernelMatrix:U_,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:X,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskType:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:X,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:X,overlineThickness:X,paintOrder:null,panose1:null,path:null,pathLength:X,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:V_,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:X,pointsAtY:X,pointsAtZ:X,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:U_,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:U_,rev:U_,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:U_,requiredFeatures:U_,requiredFonts:U_,requiredFormats:U_,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:X,specularExponent:X,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:X,strikethroughThickness:X,string:null,stroke:null,strokeDashArray:U_,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:X,strokeOpacity:X,strokeWidth:null,style:null,surfaceScale:X,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:U_,tabIndex:X,tableValues:null,target:null,targetX:X,targetY:X,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:U_,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:X,underlineThickness:X,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:X,values:null,vAlphabetic:X,vMathematical:X,vectorEffect:null,vHanging:X,vIdeographic:X,version:null,vertAdvY:X,vertOriginX:X,vertOriginY:X,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:X,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:`svg`,transform:X_}),ev=J_({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:`xlink`,transform(e,t){return`xlink:`+t.slice(5).toLowerCase()}}),tv=J_({attributes:{xmlnsxlink:`xmlns:xlink`},properties:{xmlnsXLink:null,xmlns:null},space:`xmlns`,transform:Z_}),nv=J_({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:`xml`,transform(e,t){return`xml:`+t.slice(3).toLowerCase()}}),rv={classId:`classID`,dataType:`datatype`,itemId:`itemID`,strokeDashArray:`strokeDasharray`,strokeDashOffset:`strokeDashoffset`,strokeLineCap:`strokeLinecap`,strokeLineJoin:`strokeLinejoin`,strokeMiterLimit:`strokeMiterlimit`,typeOf:`typeof`,xLinkActuate:`xlinkActuate`,xLinkArcRole:`xlinkArcrole`,xLinkHref:`xlinkHref`,xLinkRole:`xlinkRole`,xLinkShow:`xlinkShow`,xLinkTitle:`xlinkTitle`,xLinkType:`xlinkType`,xmlnsXLink:`xmlnsXlink`},iv=/[A-Z]/g,av=/-[a-z]/g,ov=/^data[-\w.:]+$/i;function sv(e,t){let n=P_(t),r=t,i=F_;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)===`data`&&ov.test(t)){if(t.charAt(4)===`-`){let e=t.slice(5).replace(av,lv);r=`data`+e.charAt(0).toUpperCase()+e.slice(1)}else{let e=t.slice(4);if(!av.test(e)){let n=e.replace(iv,cv);n.charAt(0)!==`-`&&(n=`-`+n),t=`data`+n}}i=K_}return new i(r,t)}function cv(e){return`-`+e.toLowerCase()}function lv(e){return e.charAt(1).toUpperCase()}var uv=N_([Y_,Q_,ev,tv,nv],`html`),dv=N_([Y_,$_,ev,tv,nv],`svg`);function fv(e){return e.join(` `).trim()}var pv=s(((e,t)=>{var n=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,r=/\n/g,i=/^\s*/,a=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,o=/^:\s*/,s=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,c=/^[;\s]*/,l=/^\s+|\s+$/g,u=`
|
|
21
|
-
`,d=`/`,f=`*`,p=``,m=`comment`,h=`declaration`;function g(e,t){if(typeof e!=`string`)throw TypeError(`First argument must be a string`);if(!e)return[];t||={};var l=1,g=1;function v(e){var t=e.match(r);t&&(l+=t.length);var n=e.lastIndexOf(u);g=~n?e.length-n:g+e.length}function y(){var e={line:l,column:g};return function(t){return t.position=new b(e),C(),t}}function b(e){this.start=e,this.end={line:l,column:g},this.source=t.source}b.prototype.content=e;function x(n){var r=Error(t.source+`:`+l+`:`+g+`: `+n);if(r.reason=n,r.filename=t.source,r.line=l,r.column=g,r.source=e,!t.silent)throw r}function S(t){var n=t.exec(e);if(n){var r=n[0];return v(r),e=e.slice(r.length),n}}function C(){S(i)}function w(e){var t;for(e||=[];t=T();)t!==!1&&e.push(t);return e}function T(){var t=y();if(!(d!=e.charAt(0)||f!=e.charAt(1))){for(var n=2;p!=e.charAt(n)&&(f!=e.charAt(n)||d!=e.charAt(n+1));)++n;if(n+=2,p===e.charAt(n-1))return x(`End of comment missing`);var r=e.slice(2,n-2);return g+=2,v(r),e=e.slice(n),g+=2,t({type:m,comment:r})}}function E(){var e=y(),t=S(a);if(t){if(T(),!S(o))return x(`property missing ':'`);var r=S(s),i=e({type:h,property:_(t[0].replace(n,p)),value:r?_(r[0].replace(n,p)):p});return S(c),i}}function D(){var e=[];w(e);for(var t;t=E();)t!==!1&&(e.push(t),w(e));return e}return C(),D()}function _(e){return e?e.replace(l,p):p}t.exports=g})),mv=s((e=>{var t=e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(e,`__esModule`,{value:!0}),e.default=r;var n=t(pv());function r(e,t){let r=null;if(!e||typeof e!=`string`)return r;let i=(0,n.default)(e),a=typeof t==`function`;return i.forEach(e=>{if(e.type!==`declaration`)return;let{property:n,value:i}=e;a?t(n,i,e):i&&(r||={},r[n]=i)}),r}})),hv=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.camelCase=void 0;var t=/^--[a-zA-Z0-9_-]+$/,n=/-([a-z])/g,r=/^[^-]+$/,i=/^-(webkit|moz|ms|o|khtml)-/,a=/^-(ms)-/,o=function(e){return!e||r.test(e)||t.test(e)},s=function(e,t){return t.toUpperCase()},c=function(e,t){return`${t}-`};e.camelCase=function(e,t){return t===void 0&&(t={}),o(e)?e:(e=e.toLowerCase(),e=t.reactCompat?e.replace(a,c):e.replace(i,c),e.replace(n,s))}})),gv=s(((e,t)=>{var n=(e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}})(mv()),r=hv();function i(e,t){var i={};return!e||typeof e!=`string`||(0,n.default)(e,function(e,n){e&&n&&(i[(0,r.camelCase)(e,t)]=n)}),i}i.default=i,t.exports=i})),_v=yv(`end`),vv=yv(`start`);function yv(e){return t;function t(t){let n=t&&t.position&&t.position[e]||{};if(typeof n.line==`number`&&n.line>0&&typeof n.column==`number`&&n.column>0)return{line:n.line,column:n.column,offset:typeof n.offset==`number`&&n.offset>-1?n.offset:void 0}}}function bv(e){let t=vv(e),n=_v(e);if(t&&n)return{start:t,end:n}}function xv(e){return!e||typeof e!=`object`?``:`position`in e||`type`in e?Cv(e.position):`start`in e||`end`in e?Cv(e):`line`in e||`column`in e?Sv(e):``}function Sv(e){return wv(e&&e.line)+`:`+wv(e&&e.column)}function Cv(e){return Sv(e&&e.start)+`-`+Sv(e&&e.end)}function wv(e){return e&&typeof e==`number`?e:1}var Tv=class extends Error{constructor(e,t,n){super(),typeof t==`string`&&(n=t,t=void 0);let r=``,i={},a=!1;if(t&&(i=`line`in t&&`column`in t||`start`in t&&`end`in t?{place:t}:`type`in t?{ancestors:[t],place:t.position}:{...t}),typeof e==`string`?r=e:!i.cause&&e&&(a=!0,r=e.message,i.cause=e),!i.ruleId&&!i.source&&typeof n==`string`){let e=n.indexOf(`:`);e===-1?i.ruleId=n:(i.source=n.slice(0,e),i.ruleId=n.slice(e+1))}if(!i.place&&i.ancestors&&i.ancestors){let e=i.ancestors[i.ancestors.length-1];e&&(i.place=e.position)}let o=i.place&&`start`in i.place?i.place.start:i.place;this.ancestors=i.ancestors||void 0,this.cause=i.cause||void 0,this.column=o?o.column:void 0,this.fatal=void 0,this.file=``,this.message=r,this.line=o?o.line:void 0,this.name=xv(i.place)||`1:1`,this.place=i.place||void 0,this.reason=this.message,this.ruleId=i.ruleId||void 0,this.source=i.source||void 0,this.stack=a&&i.cause&&typeof i.cause.stack==`string`?i.cause.stack:``,this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}};Tv.prototype.file=``,Tv.prototype.name=``,Tv.prototype.reason=``,Tv.prototype.message=``,Tv.prototype.stack=``,Tv.prototype.column=void 0,Tv.prototype.line=void 0,Tv.prototype.ancestors=void 0,Tv.prototype.cause=void 0,Tv.prototype.fatal=void 0,Tv.prototype.place=void 0,Tv.prototype.ruleId=void 0,Tv.prototype.source=void 0;var Ev=u(gv(),1),Dv={}.hasOwnProperty,Ov=new Map,kv=/[A-Z]/g,Av=new Set([`table`,`tbody`,`thead`,`tfoot`,`tr`]),jv=new Set([`td`,`th`]),Mv=`https://github.com/syntax-tree/hast-util-to-jsx-runtime`;function Nv(e,t){if(!t||t.Fragment===void 0)throw TypeError("Expected `Fragment` in options");let n=t.filePath||void 0,r;if(t.development){if(typeof t.jsxDEV!=`function`)throw TypeError("Expected `jsxDEV` in options when `development: true`");r=Wv(n,t.jsxDEV)}else{if(typeof t.jsx!=`function`)throw TypeError("Expected `jsx` in production options");if(typeof t.jsxs!=`function`)throw TypeError("Expected `jsxs` in production options");r=Uv(n,t.jsx,t.jsxs)}let i={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:r,elementAttributeNameCase:t.elementAttributeNameCase||`react`,evaluater:t.createEvaluater?t.createEvaluater():void 0,filePath:n,ignoreInvalidStyle:t.ignoreInvalidStyle||!1,passKeys:t.passKeys!==!1,passNode:t.passNode||!1,schema:t.space===`svg`?dv:uv,stylePropertyNameCase:t.stylePropertyNameCase||`dom`,tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},a=Pv(i,e,void 0);return a&&typeof a!=`string`?a:i.create(e,i.Fragment,{children:a||void 0},void 0)}function Pv(e,t,n){if(t.type===`element`)return Fv(e,t,n);if(t.type===`mdxFlowExpression`||t.type===`mdxTextExpression`)return Iv(e,t);if(t.type===`mdxJsxFlowElement`||t.type===`mdxJsxTextElement`)return Rv(e,t,n);if(t.type===`mdxjsEsm`)return Lv(e,t);if(t.type===`root`)return zv(e,t,n);if(t.type===`text`)return Bv(e,t)}function Fv(e,t,n){let r=e.schema,i=r;t.tagName.toLowerCase()===`svg`&&r.space===`html`&&(i=dv,e.schema=i),e.ancestors.push(t);let a=Xv(e,t.tagName,!1),o=Gv(e,t),s=qv(e,t);return Av.has(t.tagName)&&(s=s.filter(function(e){return typeof e==`string`?!A_(e):!0})),Vv(e,o,a,t),Hv(o,s),e.ancestors.pop(),e.schema=r,e.create(t,a,o,n)}function Iv(e,t){if(t.data&&t.data.estree&&e.evaluater){let n=t.data.estree.body[0];return n.type,e.evaluater.evaluateExpression(n.expression)}Zv(e,t.position)}function Lv(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);Zv(e,t.position)}function Rv(e,t,n){let r=e.schema,i=r;t.name===`svg`&&r.space===`html`&&(i=dv,e.schema=i),e.ancestors.push(t);let a=t.name===null?e.Fragment:Xv(e,t.name,!0),o=Kv(e,t),s=qv(e,t);return Vv(e,o,a,t),Hv(o,s),e.ancestors.pop(),e.schema=r,e.create(t,a,o,n)}function zv(e,t,n){let r={};return Hv(r,qv(e,t)),e.create(t,e.Fragment,r,n)}function Bv(e,t){return t.value}function Vv(e,t,n,r){typeof n!=`string`&&n!==e.Fragment&&e.passNode&&(t.node=r)}function Hv(e,t){if(t.length>0){let n=t.length>1?t:t[0];n&&(e.children=n)}}function Uv(e,t,n){return r;function r(e,r,i,a){let o=Array.isArray(i.children)?n:t;return a?o(r,i,a):o(r,i)}}function Wv(e,t){return n;function n(n,r,i,a){let o=Array.isArray(i.children),s=vv(n);return t(r,i,a,o,{columnNumber:s?s.column-1:void 0,fileName:e,lineNumber:s?s.line:void 0},void 0)}}function Gv(e,t){let n={},r,i;for(i in t.properties)if(i!==`children`&&Dv.call(t.properties,i)){let a=Jv(e,i,t.properties[i]);if(a){let[i,o]=a;e.tableCellAlignToStyle&&i===`align`&&typeof o==`string`&&jv.has(t.tagName)?r=o:n[i]=o}}if(r){let t=n.style||={};t[e.stylePropertyNameCase===`css`?`text-align`:`textAlign`]=r}return n}function Kv(e,t){let n={};for(let r of t.attributes)if(r.type===`mdxJsxExpressionAttribute`)if(r.data&&r.data.estree&&e.evaluater){let t=r.data.estree.body[0];t.type;let i=t.expression;i.type;let a=i.properties[0];a.type,Object.assign(n,e.evaluater.evaluateExpression(a.argument))}else Zv(e,t.position);else{let i=r.name,a;if(r.value&&typeof r.value==`object`)if(r.value.data&&r.value.data.estree&&e.evaluater){let t=r.value.data.estree.body[0];t.type,a=e.evaluater.evaluateExpression(t.expression)}else Zv(e,t.position);else a=r.value===null?!0:r.value;n[i]=a}return n}function qv(e,t){let n=[],r=-1,i=e.passKeys?new Map:Ov;for(;++r<t.children.length;){let a=t.children[r],o;if(e.passKeys){let e=a.type===`element`?a.tagName:a.type===`mdxJsxFlowElement`||a.type===`mdxJsxTextElement`?a.name:void 0;if(e){let t=i.get(e)||0;o=e+`-`+t,i.set(e,t+1)}}let s=Pv(e,a,o);s!==void 0&&n.push(s)}return n}function Jv(e,t,n){let r=sv(e.schema,t);if(!(n==null||typeof n==`number`&&Number.isNaN(n))){if(Array.isArray(n)&&(n=r.commaSeparated?w_(n):fv(n)),r.property===`style`){let t=typeof n==`object`?n:Yv(e,String(n));return e.stylePropertyNameCase===`css`&&(t=Qv(t)),[`style`,t]}return[e.elementAttributeNameCase===`react`&&r.space?rv[r.property]||r.property:r.attribute,n]}}function Yv(e,t){try{return(0,Ev.default)(t,{reactCompat:!0})}catch(t){if(e.ignoreInvalidStyle)return{};let n=t,r=new Tv("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:n,ruleId:`style`,source:`hast-util-to-jsx-runtime`});throw r.file=e.filePath||void 0,r.url=Mv+`#cannot-parse-style-attribute`,r}}function Xv(e,t,n){let r;if(!n)r={type:`Literal`,value:t};else if(t.includes(`.`)){let e=t.split(`.`),n=-1,i;for(;++n<e.length;){let t=O_(e[n])?{type:`Identifier`,name:e[n]}:{type:`Literal`,value:e[n]};i=i?{type:`MemberExpression`,object:i,property:t,computed:!!(n&&t.type===`Literal`),optional:!1}:t}r=i}else r=O_(t)&&!/^[a-z]/.test(t)?{type:`Identifier`,name:t}:{type:`Literal`,value:t};if(r.type===`Literal`){let t=r.value;return Dv.call(e.components,t)?e.components[t]:t}if(e.evaluater)return e.evaluater.evaluateExpression(r);Zv(e)}function Zv(e,t){let n=new Tv("Cannot handle MDX estrees without `createEvaluater`",{ancestors:e.ancestors,place:t,ruleId:`mdx-estree`,source:`hast-util-to-jsx-runtime`});throw n.file=e.filePath||void 0,n.url=Mv+`#cannot-handle-mdx-estrees-without-createevaluater`,n}function Qv(e){let t={},n;for(n in e)Dv.call(e,n)&&(t[$v(n)]=e[n]);return t}function $v(e){let t=e.replace(kv,ey);return t.slice(0,3)===`ms-`&&(t=`-`+t),t}function ey(e){return`-`+e.toLowerCase()}var ty={action:[`form`],cite:[`blockquote`,`del`,`ins`,`q`],data:[`object`],formAction:[`button`,`input`],href:[`a`,`area`,`base`,`link`],icon:[`menuitem`],itemId:null,manifest:[`html`],ping:[`a`,`area`],poster:[`video`],src:[`audio`,`embed`,`iframe`,`img`,`input`,`script`,`source`,`track`,`video`]},ny={};function ry(e,t){let n=t||ny;return iy(e,typeof n.includeImageAlt==`boolean`?n.includeImageAlt:!0,typeof n.includeHtml==`boolean`?n.includeHtml:!0)}function iy(e,t,n){if(oy(e)){if(`value`in e)return e.type===`html`&&!n?``:e.value;if(t&&`alt`in e&&e.alt)return e.alt;if(`children`in e)return ay(e.children,t,n)}return Array.isArray(e)?ay(e,t,n):``}function ay(e,t,n){let r=[],i=-1;for(;++i<e.length;)r[i]=iy(e[i],t,n);return r.join(``)}function oy(e){return!!(e&&typeof e==`object`)}var sy=document.createElement(`i`);function cy(e){let t=`&`+e+`;`;sy.innerHTML=t;let n=sy.textContent;return n.charCodeAt(n.length-1)===59&&e!==`semi`||n===t?!1:n}function ly(e,t,n,r){let i=e.length,a=0,o;if(t=t<0?-t>i?0:i+t:t>i?i:t,n=n>0?n:0,r.length<1e4)o=Array.from(r),o.unshift(t,n),e.splice(...o);else for(n&&e.splice(t,n);a<r.length;)o=r.slice(a,a+1e4),o.unshift(t,0),e.splice(...o),a+=1e4,t+=1e4}function uy(e,t){return e.length>0?(ly(e,e.length,0,t),e):t}var dy={}.hasOwnProperty;function fy(e){let t={},n=-1;for(;++n<e.length;)py(t,e[n]);return t}function py(e,t){let n;for(n in t){let r=(dy.call(e,n)?e[n]:void 0)||(e[n]={}),i=t[n],a;if(i)for(a in i){dy.call(r,a)||(r[a]=[]);let e=i[a];my(r[a],Array.isArray(e)?e:e?[e]:[])}}}function my(e,t){let n=-1,r=[];for(;++n<t.length;)(t[n].add===`after`?e:r).push(t[n]);ly(e,0,0,r)}function hy(e,t){let n=Number.parseInt(e,t);return n<9||n===11||n>13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(n&65535)==65535||(n&65535)==65534||n>1114111?`�`:String.fromCodePoint(n)}function gy(e){return e.replace(/[\t\n\r ]+/g,` `).replace(/^ | $/g,``).toLowerCase().toUpperCase()}var _y=ky(/[A-Za-z]/),vy=ky(/[\dA-Za-z]/),yy=ky(/[#-'*+\--9=?A-Z^-~]/);function by(e){return e!==null&&(e<32||e===127)}var xy=ky(/\d/),Sy=ky(/[\dA-Fa-f]/),Cy=ky(/[!-/:-@[-`{-~]/);function wy(e){return e!==null&&e<-2}function Ty(e){return e!==null&&(e<0||e===32)}function Ey(e){return e===-2||e===-1||e===32}var Dy=ky(/\p{P}|\p{S}/u),Oy=ky(/\s/);function ky(e){return t;function t(t){return t!==null&&t>-1&&e.test(String.fromCharCode(t))}}function Ay(e){let t=[],n=-1,r=0,i=0;for(;++n<e.length;){let a=e.charCodeAt(n),o=``;if(a===37&&vy(e.charCodeAt(n+1))&&vy(e.charCodeAt(n+2)))i=2;else if(a<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(a))||(o=String.fromCharCode(a));else if(a>55295&&a<57344){let t=e.charCodeAt(n+1);a<56320&&t>56319&&t<57344?(o=String.fromCharCode(a,t),i=1):o=`�`}else o=String.fromCharCode(a);o&&=(t.push(e.slice(r,n),encodeURIComponent(o)),r=n+i+1,``),i&&=(n+=i,0)}return t.join(``)+e.slice(r)}function jy(e,t,n,r){let i=r?r-1:1/0,a=0;return o;function o(r){return Ey(r)?(e.enter(n),s(r)):t(r)}function s(r){return Ey(r)&&a++<i?(e.consume(r),s):(e.exit(n),t(r))}}var My={tokenize:Ny};function Ny(e){let t=e.attempt(this.parser.constructs.contentInitial,r,i),n;return t;function r(n){if(n===null){e.consume(n);return}return e.enter(`lineEnding`),e.consume(n),e.exit(`lineEnding`),jy(e,t,`linePrefix`)}function i(t){return e.enter(`paragraph`),a(t)}function a(t){let r=e.enter(`chunkText`,{contentType:`text`,previous:n});return n&&(n.next=r),n=r,o(t)}function o(t){if(t===null){e.exit(`chunkText`),e.exit(`paragraph`),e.consume(t);return}return wy(t)?(e.consume(t),e.exit(`chunkText`),a):(e.consume(t),o)}}var Py={tokenize:Iy},Fy={tokenize:Ly};function Iy(e){let t=this,n=[],r=0,i,a,o;return s;function s(i){if(r<n.length){let a=n[r];return t.containerState=a[1],e.attempt(a[0].continuation,c,l)(i)}return l(i)}function c(e){if(r++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,i&&v();let n=t.events.length,a=n,o;for(;a--;)if(t.events[a][0]===`exit`&&t.events[a][1].type===`chunkFlow`){o=t.events[a][1].end;break}_(r);let s=n;for(;s<t.events.length;)t.events[s][1].end={...o},s++;return ly(t.events,a+1,0,t.events.slice(n)),t.events.length=s,l(e)}return s(e)}function l(a){if(r===n.length){if(!i)return f(a);if(i.currentConstruct&&i.currentConstruct.concrete)return m(a);t.interrupt=!!(i.currentConstruct&&!i._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(Fy,u,d)(a)}function u(e){return i&&v(),_(r),f(e)}function d(e){return t.parser.lazy[t.now().line]=r!==n.length,o=t.now().offset,m(e)}function f(n){return t.containerState={},e.attempt(Fy,p,m)(n)}function p(e){return r++,n.push([t.currentConstruct,t.containerState]),f(e)}function m(n){if(n===null){i&&v(),_(0),e.consume(n);return}return i||=t.parser.flow(t.now()),e.enter(`chunkFlow`,{_tokenizer:i,contentType:`flow`,previous:a}),h(n)}function h(n){if(n===null){g(e.exit(`chunkFlow`),!0),_(0),e.consume(n);return}return wy(n)?(e.consume(n),g(e.exit(`chunkFlow`)),r=0,t.interrupt=void 0,s):(e.consume(n),h)}function g(e,n){let s=t.sliceStream(e);if(n&&s.push(null),e.previous=a,a&&(a.next=e),a=e,i.defineSkip(e.start),i.write(s),t.parser.lazy[e.start.line]){let e=i.events.length;for(;e--;)if(i.events[e][1].start.offset<o&&(!i.events[e][1].end||i.events[e][1].end.offset>o))return;let n=t.events.length,a=n,s,c;for(;a--;)if(t.events[a][0]===`exit`&&t.events[a][1].type===`chunkFlow`){if(s){c=t.events[a][1].end;break}s=!0}for(_(r),e=n;e<t.events.length;)t.events[e][1].end={...c},e++;ly(t.events,a+1,0,t.events.slice(n)),t.events.length=e}}function _(r){let i=n.length;for(;i-- >r;){let r=n[i];t.containerState=r[1],r[0].exit.call(t,e)}n.length=r}function v(){i.write([null]),a=void 0,i=void 0,t.containerState._closeFlow=void 0}}function Ly(e,t,n){return jy(e,e.attempt(this.parser.constructs.document,t,n),`linePrefix`,this.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)}function Ry(e){if(e===null||Ty(e)||Oy(e))return 1;if(Dy(e))return 2}function zy(e,t,n){let r=[],i=-1;for(;++i<e.length;){let a=e[i].resolveAll;a&&!r.includes(a)&&(t=a(t,n),r.push(a))}return t}var By={name:`attention`,resolveAll:Vy,tokenize:Hy};function Vy(e,t){let n=-1,r,i,a,o,s,c,l,u;for(;++n<e.length;)if(e[n][0]===`enter`&&e[n][1].type===`attentionSequence`&&e[n][1]._close){for(r=n;r--;)if(e[r][0]===`exit`&&e[r][1].type===`attentionSequence`&&e[r][1]._open&&t.sliceSerialize(e[r][1]).charCodeAt(0)===t.sliceSerialize(e[n][1]).charCodeAt(0)){if((e[r][1]._close||e[n][1]._open)&&(e[n][1].end.offset-e[n][1].start.offset)%3&&!((e[r][1].end.offset-e[r][1].start.offset+e[n][1].end.offset-e[n][1].start.offset)%3))continue;c=e[r][1].end.offset-e[r][1].start.offset>1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;let d={...e[r][1].end},f={...e[n][1].start};Uy(d,-c),Uy(f,c),o={type:c>1?`strongSequence`:`emphasisSequence`,start:d,end:{...e[r][1].end}},s={type:c>1?`strongSequence`:`emphasisSequence`,start:{...e[n][1].start},end:f},a={type:c>1?`strongText`:`emphasisText`,start:{...e[r][1].end},end:{...e[n][1].start}},i={type:c>1?`strong`:`emphasis`,start:{...o.start},end:{...s.end}},e[r][1].end={...o.start},e[n][1].start={...s.end},l=[],e[r][1].end.offset-e[r][1].start.offset&&(l=uy(l,[[`enter`,e[r][1],t],[`exit`,e[r][1],t]])),l=uy(l,[[`enter`,i,t],[`enter`,o,t],[`exit`,o,t],[`enter`,a,t]]),l=uy(l,zy(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),l=uy(l,[[`exit`,a,t],[`enter`,s,t],[`exit`,s,t],[`exit`,i,t]]),e[n][1].end.offset-e[n][1].start.offset?(u=2,l=uy(l,[[`enter`,e[n][1],t],[`exit`,e[n][1],t]])):u=0,ly(e,r-1,n-r+3,l),n=r+l.length-u-2;break}}for(n=-1;++n<e.length;)e[n][1].type===`attentionSequence`&&(e[n][1].type=`data`);return e}function Hy(e,t){let n=this.parser.constructs.attentionMarkers.null,r=this.previous,i=Ry(r),a;return o;function o(t){return a=t,e.enter(`attentionSequence`),s(t)}function s(o){if(o===a)return e.consume(o),s;let c=e.exit(`attentionSequence`),l=Ry(o),u=!l||l===2&&i||n.includes(o),d=!i||i===2&&l||n.includes(r);return c._open=!!(a===42?u:u&&(i||!d)),c._close=!!(a===42?d:d&&(l||!u)),t(o)}}function Uy(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}var Wy={name:`autolink`,tokenize:Gy};function Gy(e,t,n){let r=0;return i;function i(t){return e.enter(`autolink`),e.enter(`autolinkMarker`),e.consume(t),e.exit(`autolinkMarker`),e.enter(`autolinkProtocol`),a}function a(t){return _y(t)?(e.consume(t),o):t===64?n(t):l(t)}function o(e){return e===43||e===45||e===46||vy(e)?(r=1,s(e)):l(e)}function s(t){return t===58?(e.consume(t),r=0,c):(t===43||t===45||t===46||vy(t))&&r++<32?(e.consume(t),s):(r=0,l(t))}function c(r){return r===62?(e.exit(`autolinkProtocol`),e.enter(`autolinkMarker`),e.consume(r),e.exit(`autolinkMarker`),e.exit(`autolink`),t):r===null||r===32||r===60||by(r)?n(r):(e.consume(r),c)}function l(t){return t===64?(e.consume(t),u):yy(t)?(e.consume(t),l):n(t)}function u(e){return vy(e)?d(e):n(e)}function d(n){return n===46?(e.consume(n),r=0,u):n===62?(e.exit(`autolinkProtocol`).type=`autolinkEmail`,e.enter(`autolinkMarker`),e.consume(n),e.exit(`autolinkMarker`),e.exit(`autolink`),t):f(n)}function f(t){if((t===45||vy(t))&&r++<63){let n=t===45?f:d;return e.consume(t),n}return n(t)}}var Ky={partial:!0,tokenize:qy};function qy(e,t,n){return r;function r(t){return Ey(t)?jy(e,i,`linePrefix`)(t):i(t)}function i(e){return e===null||wy(e)?t(e):n(e)}}var Jy={continuation:{tokenize:Xy},exit:Zy,name:`blockQuote`,tokenize:Yy};function Yy(e,t,n){let r=this;return i;function i(t){if(t===62){let n=r.containerState;return n.open||=(e.enter(`blockQuote`,{_container:!0}),!0),e.enter(`blockQuotePrefix`),e.enter(`blockQuoteMarker`),e.consume(t),e.exit(`blockQuoteMarker`),a}return n(t)}function a(n){return Ey(n)?(e.enter(`blockQuotePrefixWhitespace`),e.consume(n),e.exit(`blockQuotePrefixWhitespace`),e.exit(`blockQuotePrefix`),t):(e.exit(`blockQuotePrefix`),t(n))}}function Xy(e,t,n){let r=this;return i;function i(t){return Ey(t)?jy(e,a,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):a(t)}function a(r){return e.attempt(Jy,t,n)(r)}}function Zy(e){e.exit(`blockQuote`)}var Qy={name:`characterEscape`,tokenize:$y};function $y(e,t,n){return r;function r(t){return e.enter(`characterEscape`),e.enter(`escapeMarker`),e.consume(t),e.exit(`escapeMarker`),i}function i(r){return Cy(r)?(e.enter(`characterEscapeValue`),e.consume(r),e.exit(`characterEscapeValue`),e.exit(`characterEscape`),t):n(r)}}var eb={name:`characterReference`,tokenize:tb};function tb(e,t,n){let r=this,i=0,a,o;return s;function s(t){return e.enter(`characterReference`),e.enter(`characterReferenceMarker`),e.consume(t),e.exit(`characterReferenceMarker`),c}function c(t){return t===35?(e.enter(`characterReferenceMarkerNumeric`),e.consume(t),e.exit(`characterReferenceMarkerNumeric`),l):(e.enter(`characterReferenceValue`),a=31,o=vy,u(t))}function l(t){return t===88||t===120?(e.enter(`characterReferenceMarkerHexadecimal`),e.consume(t),e.exit(`characterReferenceMarkerHexadecimal`),e.enter(`characterReferenceValue`),a=6,o=Sy,u):(e.enter(`characterReferenceValue`),a=7,o=xy,u(t))}function u(s){if(s===59&&i){let i=e.exit(`characterReferenceValue`);return o===vy&&!cy(r.sliceSerialize(i))?n(s):(e.enter(`characterReferenceMarker`),e.consume(s),e.exit(`characterReferenceMarker`),e.exit(`characterReference`),t)}return o(s)&&i++<a?(e.consume(s),u):n(s)}}var nb={partial:!0,tokenize:ab},rb={concrete:!0,name:`codeFenced`,tokenize:ib};function ib(e,t,n){let r=this,i={partial:!0,tokenize:x},a=0,o=0,s;return c;function c(e){return l(e)}function l(t){let n=r.events[r.events.length-1];return a=n&&n[1].type===`linePrefix`?n[2].sliceSerialize(n[1],!0).length:0,s=t,e.enter(`codeFenced`),e.enter(`codeFencedFence`),e.enter(`codeFencedFenceSequence`),u(t)}function u(t){return t===s?(o++,e.consume(t),u):o<3?n(t):(e.exit(`codeFencedFenceSequence`),Ey(t)?jy(e,d,`whitespace`)(t):d(t))}function d(n){return n===null||wy(n)?(e.exit(`codeFencedFence`),r.interrupt?t(n):e.check(nb,h,b)(n)):(e.enter(`codeFencedFenceInfo`),e.enter(`chunkString`,{contentType:`string`}),f(n))}function f(t){return t===null||wy(t)?(e.exit(`chunkString`),e.exit(`codeFencedFenceInfo`),d(t)):Ey(t)?(e.exit(`chunkString`),e.exit(`codeFencedFenceInfo`),jy(e,p,`whitespace`)(t)):t===96&&t===s?n(t):(e.consume(t),f)}function p(t){return t===null||wy(t)?d(t):(e.enter(`codeFencedFenceMeta`),e.enter(`chunkString`,{contentType:`string`}),m(t))}function m(t){return t===null||wy(t)?(e.exit(`chunkString`),e.exit(`codeFencedFenceMeta`),d(t)):t===96&&t===s?n(t):(e.consume(t),m)}function h(t){return e.attempt(i,b,g)(t)}function g(t){return e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),_}function _(t){return a>0&&Ey(t)?jy(e,v,`linePrefix`,a+1)(t):v(t)}function v(t){return t===null||wy(t)?e.check(nb,h,b)(t):(e.enter(`codeFlowValue`),y(t))}function y(t){return t===null||wy(t)?(e.exit(`codeFlowValue`),v(t)):(e.consume(t),y)}function b(n){return e.exit(`codeFenced`),t(n)}function x(e,t,n){let i=0;return a;function a(t){return e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),c}function c(t){return e.enter(`codeFencedFence`),Ey(t)?jy(e,l,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):l(t)}function l(t){return t===s?(e.enter(`codeFencedFenceSequence`),u(t)):n(t)}function u(t){return t===s?(i++,e.consume(t),u):i>=o?(e.exit(`codeFencedFenceSequence`),Ey(t)?jy(e,d,`whitespace`)(t):d(t)):n(t)}function d(r){return r===null||wy(r)?(e.exit(`codeFencedFence`),t(r)):n(r)}}}function ab(e,t,n){let r=this;return i;function i(t){return t===null?n(t):(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),a)}function a(e){return r.parser.lazy[r.now().line]?n(e):t(e)}}var ob={name:`codeIndented`,tokenize:cb},sb={partial:!0,tokenize:lb};function cb(e,t,n){let r=this;return i;function i(t){return e.enter(`codeIndented`),jy(e,a,`linePrefix`,5)(t)}function a(e){let t=r.events[r.events.length-1];return t&&t[1].type===`linePrefix`&&t[2].sliceSerialize(t[1],!0).length>=4?o(e):n(e)}function o(t){return t===null?c(t):wy(t)?e.attempt(sb,o,c)(t):(e.enter(`codeFlowValue`),s(t))}function s(t){return t===null||wy(t)?(e.exit(`codeFlowValue`),o(t)):(e.consume(t),s)}function c(n){return e.exit(`codeIndented`),t(n)}}function lb(e,t,n){let r=this;return i;function i(t){return r.parser.lazy[r.now().line]?n(t):wy(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),i):jy(e,a,`linePrefix`,5)(t)}function a(e){let a=r.events[r.events.length-1];return a&&a[1].type===`linePrefix`&&a[2].sliceSerialize(a[1],!0).length>=4?t(e):wy(e)?i(e):n(e)}}var ub={name:`codeText`,previous:fb,resolve:db,tokenize:pb};function db(e){let t=e.length-4,n=3,r,i;if((e[n][1].type===`lineEnding`||e[n][1].type===`space`)&&(e[t][1].type===`lineEnding`||e[t][1].type===`space`)){for(r=n;++r<t;)if(e[r][1].type===`codeTextData`){e[n][1].type=`codeTextPadding`,e[t][1].type=`codeTextPadding`,n+=2,t-=2;break}}for(r=n-1,t++;++r<=t;)i===void 0?r!==t&&e[r][1].type!==`lineEnding`&&(i=r):(r===t||e[r][1].type===`lineEnding`)&&(e[i][1].type=`codeTextData`,r!==i+2&&(e[i][1].end=e[r-1][1].end,e.splice(i+2,r-i-2),t-=r-i-2,r=i+2),i=void 0);return e}function fb(e){return e!==96||this.events[this.events.length-1][1].type===`characterEscape`}function pb(e,t,n){let r=0,i,a;return o;function o(t){return e.enter(`codeText`),e.enter(`codeTextSequence`),s(t)}function s(t){return t===96?(e.consume(t),r++,s):(e.exit(`codeTextSequence`),c(t))}function c(t){return t===null?n(t):t===32?(e.enter(`space`),e.consume(t),e.exit(`space`),c):t===96?(a=e.enter(`codeTextSequence`),i=0,u(t)):wy(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),c):(e.enter(`codeTextData`),l(t))}function l(t){return t===null||t===32||t===96||wy(t)?(e.exit(`codeTextData`),c(t)):(e.consume(t),l)}function u(n){return n===96?(e.consume(n),i++,u):i===r?(e.exit(`codeTextSequence`),e.exit(`codeText`),t(n)):(a.type=`codeTextData`,l(n))}}var mb=class{constructor(e){this.left=e?[...e]:[],this.right=[]}get(e){if(e<0||e>=this.left.length+this.right.length)throw RangeError("Cannot access index `"+e+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return e<this.left.length?this.left[e]:this.right[this.right.length-e+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(e,t){let n=t??1/0;return n<this.left.length?this.left.slice(e,n):e>this.left.length?this.right.slice(this.right.length-n+this.left.length,this.right.length-e+this.left.length).reverse():this.left.slice(e).concat(this.right.slice(this.right.length-n+this.left.length).reverse())}splice(e,t,n){let r=t||0;this.setCursor(Math.trunc(e));let i=this.right.splice(this.right.length-r,1/0);return n&&hb(this.left,n),i.reverse()}pop(){return this.setCursor(1/0),this.left.pop()}push(e){this.setCursor(1/0),this.left.push(e)}pushMany(e){this.setCursor(1/0),hb(this.left,e)}unshift(e){this.setCursor(0),this.right.push(e)}unshiftMany(e){this.setCursor(0),hb(this.right,e.reverse())}setCursor(e){if(!(e===this.left.length||e>this.left.length&&this.right.length===0||e<0&&this.left.length===0))if(e<this.left.length){let t=this.left.splice(e,1/0);hb(this.right,t.reverse())}else{let t=this.right.splice(this.left.length+this.right.length-e,1/0);hb(this.left,t.reverse())}}};function hb(e,t){let n=0;if(t.length<1e4)e.push(...t);else for(;n<t.length;)e.push(...t.slice(n,n+1e4)),n+=1e4}function gb(e){let t={},n=-1,r,i,a,o,s,c,l,u=new mb(e);for(;++n<u.length;){for(;n in t;)n=t[n];if(r=u.get(n),n&&r[1].type===`chunkFlow`&&u.get(n-1)[1].type===`listItemPrefix`&&(c=r[1]._tokenizer.events,a=0,a<c.length&&c[a][1].type===`lineEndingBlank`&&(a+=2),a<c.length&&c[a][1].type===`content`))for(;++a<c.length&&c[a][1].type!==`content`;)c[a][1].type===`chunkText`&&(c[a][1]._isInFirstContentOfListItem=!0,a++);if(r[0]===`enter`)r[1].contentType&&(Object.assign(t,_b(u,n)),n=t[n],l=!0);else if(r[1]._container){for(a=n,i=void 0;a--;)if(o=u.get(a),o[1].type===`lineEnding`||o[1].type===`lineEndingBlank`)o[0]===`enter`&&(i&&(u.get(i)[1].type=`lineEndingBlank`),o[1].type=`lineEnding`,i=a);else if(!(o[1].type===`linePrefix`||o[1].type===`listItemIndent`))break;i&&(r[1].end={...u.get(i)[1].start},s=u.slice(i,n),s.unshift(r),u.splice(i,n-i+1,s))}}return ly(e,0,1/0,u.slice(0)),!l}function _b(e,t){let n=e.get(t)[1],r=e.get(t)[2],i=t-1,a=[],o=n._tokenizer;o||(o=r.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(o._contentTypeTextTrailing=!0));let s=o.events,c=[],l={},u,d,f=-1,p=n,m=0,h=0,g=[h];for(;p;){for(;e.get(++i)[1]!==p;);a.push(i),p._tokenizer||(u=r.sliceStream(p),p.next||u.push(null),d&&o.defineSkip(p.start),p._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=!0),o.write(u),p._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=void 0)),d=p,p=p.next}for(p=n;++f<s.length;)s[f][0]===`exit`&&s[f-1][0]===`enter`&&s[f][1].type===s[f-1][1].type&&s[f][1].start.line!==s[f][1].end.line&&(h=f+1,g.push(h),p._tokenizer=void 0,p.previous=void 0,p=p.next);for(o.events=[],p?(p._tokenizer=void 0,p.previous=void 0):g.pop(),f=g.length;f--;){let t=s.slice(g[f],g[f+1]),n=a.pop();c.push([n,n+t.length-1]),e.splice(n,2,t)}for(c.reverse(),f=-1;++f<c.length;)l[m+c[f][0]]=m+c[f][1],m+=c[f][1]-c[f][0]-1;return l}var vb={resolve:bb,tokenize:xb},yb={partial:!0,tokenize:Sb};function bb(e){return gb(e),e}function xb(e,t){let n;return r;function r(t){return e.enter(`content`),n=e.enter(`chunkContent`,{contentType:`content`}),i(t)}function i(t){return t===null?a(t):wy(t)?e.check(yb,o,a)(t):(e.consume(t),i)}function a(n){return e.exit(`chunkContent`),e.exit(`content`),t(n)}function o(t){return e.consume(t),e.exit(`chunkContent`),n.next=e.enter(`chunkContent`,{contentType:`content`,previous:n}),n=n.next,i}}function Sb(e,t,n){let r=this;return i;function i(t){return e.exit(`chunkContent`),e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),jy(e,a,`linePrefix`)}function a(i){if(i===null||wy(i))return n(i);let a=r.events[r.events.length-1];return!r.parser.constructs.disable.null.includes(`codeIndented`)&&a&&a[1].type===`linePrefix`&&a[2].sliceSerialize(a[1],!0).length>=4?t(i):e.interrupt(r.parser.constructs.flow,n,t)(i)}}function Cb(e,t,n,r,i,a,o,s,c){let l=c||1/0,u=0;return d;function d(t){return t===60?(e.enter(r),e.enter(i),e.enter(a),e.consume(t),e.exit(a),f):t===null||t===32||t===41||by(t)?n(t):(e.enter(r),e.enter(o),e.enter(s),e.enter(`chunkString`,{contentType:`string`}),h(t))}function f(n){return n===62?(e.enter(a),e.consume(n),e.exit(a),e.exit(i),e.exit(r),t):(e.enter(s),e.enter(`chunkString`,{contentType:`string`}),p(n))}function p(t){return t===62?(e.exit(`chunkString`),e.exit(s),f(t)):t===null||t===60||wy(t)?n(t):(e.consume(t),t===92?m:p)}function m(t){return t===60||t===62||t===92?(e.consume(t),p):p(t)}function h(i){return!u&&(i===null||i===41||Ty(i))?(e.exit(`chunkString`),e.exit(s),e.exit(o),e.exit(r),t(i)):u<l&&i===40?(e.consume(i),u++,h):i===41?(e.consume(i),u--,h):i===null||i===32||i===40||by(i)?n(i):(e.consume(i),i===92?g:h)}function g(t){return t===40||t===41||t===92?(e.consume(t),h):h(t)}}function wb(e,t,n,r,i,a){let o=this,s=0,c;return l;function l(t){return e.enter(r),e.enter(i),e.consume(t),e.exit(i),e.enter(a),u}function u(l){return s>999||l===null||l===91||l===93&&!c||l===94&&!s&&`_hiddenFootnoteSupport`in o.parser.constructs?n(l):l===93?(e.exit(a),e.enter(i),e.consume(l),e.exit(i),e.exit(r),t):wy(l)?(e.enter(`lineEnding`),e.consume(l),e.exit(`lineEnding`),u):(e.enter(`chunkString`,{contentType:`string`}),d(l))}function d(t){return t===null||t===91||t===93||wy(t)||s++>999?(e.exit(`chunkString`),u(t)):(e.consume(t),c||=!Ey(t),t===92?f:d)}function f(t){return t===91||t===92||t===93?(e.consume(t),s++,d):d(t)}}function Tb(e,t,n,r,i,a){let o;return s;function s(t){return t===34||t===39||t===40?(e.enter(r),e.enter(i),e.consume(t),e.exit(i),o=t===40?41:t,c):n(t)}function c(n){return n===o?(e.enter(i),e.consume(n),e.exit(i),e.exit(r),t):(e.enter(a),l(n))}function l(t){return t===o?(e.exit(a),c(o)):t===null?n(t):wy(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),jy(e,l,`linePrefix`)):(e.enter(`chunkString`,{contentType:`string`}),u(t))}function u(t){return t===o||t===null||wy(t)?(e.exit(`chunkString`),l(t)):(e.consume(t),t===92?d:u)}function d(t){return t===o||t===92?(e.consume(t),u):u(t)}}function Eb(e,t){let n;return r;function r(i){return wy(i)?(e.enter(`lineEnding`),e.consume(i),e.exit(`lineEnding`),n=!0,r):Ey(i)?jy(e,r,n?`linePrefix`:`lineSuffix`)(i):t(i)}}var Db={name:`definition`,tokenize:kb},Ob={partial:!0,tokenize:Ab};function kb(e,t,n){let r=this,i;return a;function a(t){return e.enter(`definition`),o(t)}function o(t){return wb.call(r,e,s,n,`definitionLabel`,`definitionLabelMarker`,`definitionLabelString`)(t)}function s(t){return i=gy(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),t===58?(e.enter(`definitionMarker`),e.consume(t),e.exit(`definitionMarker`),c):n(t)}function c(t){return Ty(t)?Eb(e,l)(t):l(t)}function l(t){return Cb(e,u,n,`definitionDestination`,`definitionDestinationLiteral`,`definitionDestinationLiteralMarker`,`definitionDestinationRaw`,`definitionDestinationString`)(t)}function u(t){return e.attempt(Ob,d,d)(t)}function d(t){return Ey(t)?jy(e,f,`whitespace`)(t):f(t)}function f(a){return a===null||wy(a)?(e.exit(`definition`),r.parser.defined.push(i),t(a)):n(a)}}function Ab(e,t,n){return r;function r(t){return Ty(t)?Eb(e,i)(t):n(t)}function i(t){return Tb(e,a,n,`definitionTitle`,`definitionTitleMarker`,`definitionTitleString`)(t)}function a(t){return Ey(t)?jy(e,o,`whitespace`)(t):o(t)}function o(e){return e===null||wy(e)?t(e):n(e)}}var jb={name:`hardBreakEscape`,tokenize:Mb};function Mb(e,t,n){return r;function r(t){return e.enter(`hardBreakEscape`),e.consume(t),i}function i(r){return wy(r)?(e.exit(`hardBreakEscape`),t(r)):n(r)}}var Nb={name:`headingAtx`,resolve:Pb,tokenize:Fb};function Pb(e,t){let n=e.length-2,r=3,i,a;return e[r][1].type===`whitespace`&&(r+=2),n-2>r&&e[n][1].type===`whitespace`&&(n-=2),e[n][1].type===`atxHeadingSequence`&&(r===n-1||n-4>r&&e[n-2][1].type===`whitespace`)&&(n-=r+1===n?2:4),n>r&&(i={type:`atxHeadingText`,start:e[r][1].start,end:e[n][1].end},a={type:`chunkText`,start:e[r][1].start,end:e[n][1].end,contentType:`text`},ly(e,r,n-r+1,[[`enter`,i,t],[`enter`,a,t],[`exit`,a,t],[`exit`,i,t]])),e}function Fb(e,t,n){let r=0;return i;function i(t){return e.enter(`atxHeading`),a(t)}function a(t){return e.enter(`atxHeadingSequence`),o(t)}function o(t){return t===35&&r++<6?(e.consume(t),o):t===null||Ty(t)?(e.exit(`atxHeadingSequence`),s(t)):n(t)}function s(n){return n===35?(e.enter(`atxHeadingSequence`),c(n)):n===null||wy(n)?(e.exit(`atxHeading`),t(n)):Ey(n)?jy(e,s,`whitespace`)(n):(e.enter(`atxHeadingText`),l(n))}function c(t){return t===35?(e.consume(t),c):(e.exit(`atxHeadingSequence`),s(t))}function l(t){return t===null||t===35||Ty(t)?(e.exit(`atxHeadingText`),s(t)):(e.consume(t),l)}}var Ib=`address.article.aside.base.basefont.blockquote.body.caption.center.col.colgroup.dd.details.dialog.dir.div.dl.dt.fieldset.figcaption.figure.footer.form.frame.frameset.h1.h2.h3.h4.h5.h6.head.header.hr.html.iframe.legend.li.link.main.menu.menuitem.nav.noframes.ol.optgroup.option.p.param.search.section.summary.table.tbody.td.tfoot.th.thead.title.tr.track.ul`.split(`.`),Lb=[`pre`,`script`,`style`,`textarea`],Rb={concrete:!0,name:`htmlFlow`,resolveTo:Vb,tokenize:Hb},zb={partial:!0,tokenize:Wb},Bb={partial:!0,tokenize:Ub};function Vb(e){let t=e.length;for(;t--&&!(e[t][0]===`enter`&&e[t][1].type===`htmlFlow`););return t>1&&e[t-2][1].type===`linePrefix`&&(e[t][1].start=e[t-2][1].start,e[t+1][1].start=e[t-2][1].start,e.splice(t-2,2)),e}function Hb(e,t,n){let r=this,i,a,o,s,c;return l;function l(e){return u(e)}function u(t){return e.enter(`htmlFlow`),e.enter(`htmlFlowData`),e.consume(t),d}function d(s){return s===33?(e.consume(s),f):s===47?(e.consume(s),a=!0,h):s===63?(e.consume(s),i=3,r.interrupt?t:I):_y(s)?(e.consume(s),o=String.fromCharCode(s),g):n(s)}function f(a){return a===45?(e.consume(a),i=2,p):a===91?(e.consume(a),i=5,s=0,m):_y(a)?(e.consume(a),i=4,r.interrupt?t:I):n(a)}function p(i){return i===45?(e.consume(i),r.interrupt?t:I):n(i)}function m(i){return i===`CDATA[`.charCodeAt(s++)?(e.consume(i),s===6?r.interrupt?t:O:m):n(i)}function h(t){return _y(t)?(e.consume(t),o=String.fromCharCode(t),g):n(t)}function g(s){if(s===null||s===47||s===62||Ty(s)){let c=s===47,l=o.toLowerCase();return!c&&!a&&Lb.includes(l)?(i=1,r.interrupt?t(s):O(s)):Ib.includes(o.toLowerCase())?(i=6,c?(e.consume(s),_):r.interrupt?t(s):O(s)):(i=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(s):a?v(s):y(s))}return s===45||vy(s)?(e.consume(s),o+=String.fromCharCode(s),g):n(s)}function _(i){return i===62?(e.consume(i),r.interrupt?t:O):n(i)}function v(t){return Ey(t)?(e.consume(t),v):E(t)}function y(t){return t===47?(e.consume(t),E):t===58||t===95||_y(t)?(e.consume(t),b):Ey(t)?(e.consume(t),y):E(t)}function b(t){return t===45||t===46||t===58||t===95||vy(t)?(e.consume(t),b):x(t)}function x(t){return t===61?(e.consume(t),S):Ey(t)?(e.consume(t),x):y(t)}function S(t){return t===null||t===60||t===61||t===62||t===96?n(t):t===34||t===39?(e.consume(t),c=t,C):Ey(t)?(e.consume(t),S):w(t)}function C(t){return t===c?(e.consume(t),c=null,T):t===null||wy(t)?n(t):(e.consume(t),C)}function w(t){return t===null||t===34||t===39||t===47||t===60||t===61||t===62||t===96||Ty(t)?x(t):(e.consume(t),w)}function T(e){return e===47||e===62||Ey(e)?y(e):n(e)}function E(t){return t===62?(e.consume(t),D):n(t)}function D(t){return t===null||wy(t)?O(t):Ey(t)?(e.consume(t),D):n(t)}function O(t){return t===45&&i===2?(e.consume(t),M):t===60&&i===1?(e.consume(t),N):t===62&&i===4?(e.consume(t),L):t===63&&i===3?(e.consume(t),I):t===93&&i===5?(e.consume(t),F):wy(t)&&(i===6||i===7)?(e.exit(`htmlFlowData`),e.check(zb,ee,k)(t)):t===null||wy(t)?(e.exit(`htmlFlowData`),k(t)):(e.consume(t),O)}function k(t){return e.check(Bb,A,ee)(t)}function A(t){return e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),j}function j(t){return t===null||wy(t)?k(t):(e.enter(`htmlFlowData`),O(t))}function M(t){return t===45?(e.consume(t),I):O(t)}function N(t){return t===47?(e.consume(t),o=``,P):O(t)}function P(t){if(t===62){let n=o.toLowerCase();return Lb.includes(n)?(e.consume(t),L):O(t)}return _y(t)&&o.length<8?(e.consume(t),o+=String.fromCharCode(t),P):O(t)}function F(t){return t===93?(e.consume(t),I):O(t)}function I(t){return t===62?(e.consume(t),L):t===45&&i===2?(e.consume(t),I):O(t)}function L(t){return t===null||wy(t)?(e.exit(`htmlFlowData`),ee(t)):(e.consume(t),L)}function ee(n){return e.exit(`htmlFlow`),t(n)}}function Ub(e,t,n){let r=this;return i;function i(t){return wy(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),a):n(t)}function a(e){return r.parser.lazy[r.now().line]?n(e):t(e)}}function Wb(e,t,n){return r;function r(r){return e.enter(`lineEnding`),e.consume(r),e.exit(`lineEnding`),e.attempt(Ky,t,n)}}var Gb={name:`htmlText`,tokenize:Kb};function Kb(e,t,n){let r=this,i,a,o;return s;function s(t){return e.enter(`htmlText`),e.enter(`htmlTextData`),e.consume(t),c}function c(t){return t===33?(e.consume(t),l):t===47?(e.consume(t),x):t===63?(e.consume(t),y):_y(t)?(e.consume(t),w):n(t)}function l(t){return t===45?(e.consume(t),u):t===91?(e.consume(t),a=0,m):_y(t)?(e.consume(t),v):n(t)}function u(t){return t===45?(e.consume(t),p):n(t)}function d(t){return t===null?n(t):t===45?(e.consume(t),f):wy(t)?(o=d,N(t)):(e.consume(t),d)}function f(t){return t===45?(e.consume(t),p):d(t)}function p(e){return e===62?M(e):e===45?f(e):d(e)}function m(t){return t===`CDATA[`.charCodeAt(a++)?(e.consume(t),a===6?h:m):n(t)}function h(t){return t===null?n(t):t===93?(e.consume(t),g):wy(t)?(o=h,N(t)):(e.consume(t),h)}function g(t){return t===93?(e.consume(t),_):h(t)}function _(t){return t===62?M(t):t===93?(e.consume(t),_):h(t)}function v(t){return t===null||t===62?M(t):wy(t)?(o=v,N(t)):(e.consume(t),v)}function y(t){return t===null?n(t):t===63?(e.consume(t),b):wy(t)?(o=y,N(t)):(e.consume(t),y)}function b(e){return e===62?M(e):y(e)}function x(t){return _y(t)?(e.consume(t),S):n(t)}function S(t){return t===45||vy(t)?(e.consume(t),S):C(t)}function C(t){return wy(t)?(o=C,N(t)):Ey(t)?(e.consume(t),C):M(t)}function w(t){return t===45||vy(t)?(e.consume(t),w):t===47||t===62||Ty(t)?T(t):n(t)}function T(t){return t===47?(e.consume(t),M):t===58||t===95||_y(t)?(e.consume(t),E):wy(t)?(o=T,N(t)):Ey(t)?(e.consume(t),T):M(t)}function E(t){return t===45||t===46||t===58||t===95||vy(t)?(e.consume(t),E):D(t)}function D(t){return t===61?(e.consume(t),O):wy(t)?(o=D,N(t)):Ey(t)?(e.consume(t),D):T(t)}function O(t){return t===null||t===60||t===61||t===62||t===96?n(t):t===34||t===39?(e.consume(t),i=t,k):wy(t)?(o=O,N(t)):Ey(t)?(e.consume(t),O):(e.consume(t),A)}function k(t){return t===i?(e.consume(t),i=void 0,j):t===null?n(t):wy(t)?(o=k,N(t)):(e.consume(t),k)}function A(t){return t===null||t===34||t===39||t===60||t===61||t===96?n(t):t===47||t===62||Ty(t)?T(t):(e.consume(t),A)}function j(e){return e===47||e===62||Ty(e)?T(e):n(e)}function M(r){return r===62?(e.consume(r),e.exit(`htmlTextData`),e.exit(`htmlText`),t):n(r)}function N(t){return e.exit(`htmlTextData`),e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),P}function P(t){return Ey(t)?jy(e,F,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):F(t)}function F(t){return e.enter(`htmlTextData`),o(t)}}var qb={name:`labelEnd`,resolveAll:Zb,resolveTo:Qb,tokenize:$b},Jb={tokenize:ex},Yb={tokenize:tx},Xb={tokenize:nx};function Zb(e){let t=-1,n=[];for(;++t<e.length;){let r=e[t][1];if(n.push(e[t]),r.type===`labelImage`||r.type===`labelLink`||r.type===`labelEnd`){let e=r.type===`labelImage`?4:2;r.type=`data`,t+=e}}return e.length!==n.length&&ly(e,0,e.length,n),e}function Qb(e,t){let n=e.length,r=0,i,a,o,s;for(;n--;)if(i=e[n][1],a){if(i.type===`link`||i.type===`labelLink`&&i._inactive)break;e[n][0]===`enter`&&i.type===`labelLink`&&(i._inactive=!0)}else if(o){if(e[n][0]===`enter`&&(i.type===`labelImage`||i.type===`labelLink`)&&!i._balanced&&(a=n,i.type!==`labelLink`)){r=2;break}}else i.type===`labelEnd`&&(o=n);let c={type:e[a][1].type===`labelLink`?`link`:`image`,start:{...e[a][1].start},end:{...e[e.length-1][1].end}},l={type:`label`,start:{...e[a][1].start},end:{...e[o][1].end}},u={type:`labelText`,start:{...e[a+r+2][1].end},end:{...e[o-2][1].start}};return s=[[`enter`,c,t],[`enter`,l,t]],s=uy(s,e.slice(a+1,a+r+3)),s=uy(s,[[`enter`,u,t]]),s=uy(s,zy(t.parser.constructs.insideSpan.null,e.slice(a+r+4,o-3),t)),s=uy(s,[[`exit`,u,t],e[o-2],e[o-1],[`exit`,l,t]]),s=uy(s,e.slice(o+1)),s=uy(s,[[`exit`,c,t]]),ly(e,a,e.length,s),e}function $b(e,t,n){let r=this,i=r.events.length,a,o;for(;i--;)if((r.events[i][1].type===`labelImage`||r.events[i][1].type===`labelLink`)&&!r.events[i][1]._balanced){a=r.events[i][1];break}return s;function s(t){return a?a._inactive?d(t):(o=r.parser.defined.includes(gy(r.sliceSerialize({start:a.end,end:r.now()}))),e.enter(`labelEnd`),e.enter(`labelMarker`),e.consume(t),e.exit(`labelMarker`),e.exit(`labelEnd`),c):n(t)}function c(t){return t===40?e.attempt(Jb,u,o?u:d)(t):t===91?e.attempt(Yb,u,o?l:d)(t):o?u(t):d(t)}function l(t){return e.attempt(Xb,u,d)(t)}function u(e){return t(e)}function d(e){return a._balanced=!0,n(e)}}function ex(e,t,n){return r;function r(t){return e.enter(`resource`),e.enter(`resourceMarker`),e.consume(t),e.exit(`resourceMarker`),i}function i(t){return Ty(t)?Eb(e,a)(t):a(t)}function a(t){return t===41?u(t):Cb(e,o,s,`resourceDestination`,`resourceDestinationLiteral`,`resourceDestinationLiteralMarker`,`resourceDestinationRaw`,`resourceDestinationString`,32)(t)}function o(t){return Ty(t)?Eb(e,c)(t):u(t)}function s(e){return n(e)}function c(t){return t===34||t===39||t===40?Tb(e,l,n,`resourceTitle`,`resourceTitleMarker`,`resourceTitleString`)(t):u(t)}function l(t){return Ty(t)?Eb(e,u)(t):u(t)}function u(r){return r===41?(e.enter(`resourceMarker`),e.consume(r),e.exit(`resourceMarker`),e.exit(`resource`),t):n(r)}}function tx(e,t,n){let r=this;return i;function i(t){return wb.call(r,e,a,o,`reference`,`referenceMarker`,`referenceString`)(t)}function a(e){return r.parser.defined.includes(gy(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(e):n(e)}function o(e){return n(e)}}function nx(e,t,n){return r;function r(t){return e.enter(`reference`),e.enter(`referenceMarker`),e.consume(t),e.exit(`referenceMarker`),i}function i(r){return r===93?(e.enter(`referenceMarker`),e.consume(r),e.exit(`referenceMarker`),e.exit(`reference`),t):n(r)}}var rx={name:`labelStartImage`,resolveAll:qb.resolveAll,tokenize:ix};function ix(e,t,n){let r=this;return i;function i(t){return e.enter(`labelImage`),e.enter(`labelImageMarker`),e.consume(t),e.exit(`labelImageMarker`),a}function a(t){return t===91?(e.enter(`labelMarker`),e.consume(t),e.exit(`labelMarker`),e.exit(`labelImage`),o):n(t)}function o(e){return e===94&&`_hiddenFootnoteSupport`in r.parser.constructs?n(e):t(e)}}var ax={name:`labelStartLink`,resolveAll:qb.resolveAll,tokenize:ox};function ox(e,t,n){let r=this;return i;function i(t){return e.enter(`labelLink`),e.enter(`labelMarker`),e.consume(t),e.exit(`labelMarker`),e.exit(`labelLink`),a}function a(e){return e===94&&`_hiddenFootnoteSupport`in r.parser.constructs?n(e):t(e)}}var sx={name:`lineEnding`,tokenize:cx};function cx(e,t){return n;function n(n){return e.enter(`lineEnding`),e.consume(n),e.exit(`lineEnding`),jy(e,t,`linePrefix`)}}var lx={name:`thematicBreak`,tokenize:ux};function ux(e,t,n){let r=0,i;return a;function a(t){return e.enter(`thematicBreak`),o(t)}function o(e){return i=e,s(e)}function s(a){return a===i?(e.enter(`thematicBreakSequence`),c(a)):r>=3&&(a===null||wy(a))?(e.exit(`thematicBreak`),t(a)):n(a)}function c(t){return t===i?(e.consume(t),r++,c):(e.exit(`thematicBreakSequence`),Ey(t)?jy(e,s,`whitespace`)(t):s(t))}}var dx={continuation:{tokenize:hx},exit:_x,name:`list`,tokenize:mx},fx={partial:!0,tokenize:vx},px={partial:!0,tokenize:gx};function mx(e,t,n){let r=this,i=r.events[r.events.length-1],a=i&&i[1].type===`linePrefix`?i[2].sliceSerialize(i[1],!0).length:0,o=0;return s;function s(t){let i=r.containerState.type||(t===42||t===43||t===45?`listUnordered`:`listOrdered`);if(i===`listUnordered`?!r.containerState.marker||t===r.containerState.marker:xy(t)){if(r.containerState.type||(r.containerState.type=i,e.enter(i,{_container:!0})),i===`listUnordered`)return e.enter(`listItemPrefix`),t===42||t===45?e.check(lx,n,l)(t):l(t);if(!r.interrupt||t===49)return e.enter(`listItemPrefix`),e.enter(`listItemValue`),c(t)}return n(t)}function c(t){return xy(t)&&++o<10?(e.consume(t),c):(!r.interrupt||o<2)&&(r.containerState.marker?t===r.containerState.marker:t===41||t===46)?(e.exit(`listItemValue`),l(t)):n(t)}function l(t){return e.enter(`listItemMarker`),e.consume(t),e.exit(`listItemMarker`),r.containerState.marker=r.containerState.marker||t,e.check(Ky,r.interrupt?n:u,e.attempt(fx,f,d))}function u(e){return r.containerState.initialBlankLine=!0,a++,f(e)}function d(t){return Ey(t)?(e.enter(`listItemPrefixWhitespace`),e.consume(t),e.exit(`listItemPrefixWhitespace`),f):n(t)}function f(n){return r.containerState.size=a+r.sliceSerialize(e.exit(`listItemPrefix`),!0).length,t(n)}}function hx(e,t,n){let r=this;return r.containerState._closeFlow=void 0,e.check(Ky,i,a);function i(n){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,jy(e,t,`listItemIndent`,r.containerState.size+1)(n)}function a(n){return r.containerState.furtherBlankLines||!Ey(n)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,o(n)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(px,t,o)(n))}function o(i){return r.containerState._closeFlow=!0,r.interrupt=void 0,jy(e,e.attempt(dx,t,n),`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(i)}}function gx(e,t,n){let r=this;return jy(e,i,`listItemIndent`,r.containerState.size+1);function i(e){let i=r.events[r.events.length-1];return i&&i[1].type===`listItemIndent`&&i[2].sliceSerialize(i[1],!0).length===r.containerState.size?t(e):n(e)}}function _x(e){e.exit(this.containerState.type)}function vx(e,t,n){let r=this;return jy(e,i,`listItemPrefixWhitespace`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:5);function i(e){let i=r.events[r.events.length-1];return!Ey(e)&&i&&i[1].type===`listItemPrefixWhitespace`?t(e):n(e)}}var yx={name:`setextUnderline`,resolveTo:bx,tokenize:xx};function bx(e,t){let n=e.length,r,i,a;for(;n--;)if(e[n][0]===`enter`){if(e[n][1].type===`content`){r=n;break}e[n][1].type===`paragraph`&&(i=n)}else e[n][1].type===`content`&&e.splice(n,1),!a&&e[n][1].type===`definition`&&(a=n);let o={type:`setextHeading`,start:{...e[r][1].start},end:{...e[e.length-1][1].end}};return e[i][1].type=`setextHeadingText`,a?(e.splice(i,0,[`enter`,o,t]),e.splice(a+1,0,[`exit`,e[r][1],t]),e[r][1].end={...e[a][1].end}):e[r][1]=o,e.push([`exit`,o,t]),e}function xx(e,t,n){let r=this,i;return a;function a(t){let a=r.events.length,s;for(;a--;)if(r.events[a][1].type!==`lineEnding`&&r.events[a][1].type!==`linePrefix`&&r.events[a][1].type!==`content`){s=r.events[a][1].type===`paragraph`;break}return!r.parser.lazy[r.now().line]&&(r.interrupt||s)?(e.enter(`setextHeadingLine`),i=t,o(t)):n(t)}function o(t){return e.enter(`setextHeadingLineSequence`),s(t)}function s(t){return t===i?(e.consume(t),s):(e.exit(`setextHeadingLineSequence`),Ey(t)?jy(e,c,`lineSuffix`)(t):c(t))}function c(r){return r===null||wy(r)?(e.exit(`setextHeadingLine`),t(r)):n(r)}}var Sx={tokenize:Cx};function Cx(e){let t=this,n=e.attempt(Ky,r,e.attempt(this.parser.constructs.flowInitial,i,jy(e,e.attempt(this.parser.constructs.flow,i,e.attempt(vb,i)),`linePrefix`)));return n;function r(r){if(r===null){e.consume(r);return}return e.enter(`lineEndingBlank`),e.consume(r),e.exit(`lineEndingBlank`),t.currentConstruct=void 0,n}function i(r){if(r===null){e.consume(r);return}return e.enter(`lineEnding`),e.consume(r),e.exit(`lineEnding`),t.currentConstruct=void 0,n}}var wx={resolveAll:Ox()},Tx=Dx(`string`),Ex=Dx(`text`);function Dx(e){return{resolveAll:Ox(e===`text`?kx:void 0),tokenize:t};function t(t){let n=this,r=this.parser.constructs[e],i=t.attempt(r,a,o);return a;function a(e){return c(e)?i(e):o(e)}function o(e){if(e===null){t.consume(e);return}return t.enter(`data`),t.consume(e),s}function s(e){return c(e)?(t.exit(`data`),i(e)):(t.consume(e),s)}function c(e){if(e===null)return!0;let t=r[e],i=-1;if(t)for(;++i<t.length;){let e=t[i];if(!e.previous||e.previous.call(n,n.previous))return!0}return!1}}}function Ox(e){return t;function t(t,n){let r=-1,i;for(;++r<=t.length;)i===void 0?t[r]&&t[r][1].type===`data`&&(i=r,r++):(!t[r]||t[r][1].type!==`data`)&&(r!==i+2&&(t[i][1].end=t[r-1][1].end,t.splice(i+2,r-i-2),r=i+2),i=void 0);return e?e(t,n):t}}function kx(e,t){let n=0;for(;++n<=e.length;)if((n===e.length||e[n][1].type===`lineEnding`)&&e[n-1][1].type===`data`){let r=e[n-1][1],i=t.sliceStream(r),a=i.length,o=-1,s=0,c;for(;a--;){let e=i[a];if(typeof e==`string`){for(o=e.length;e.charCodeAt(o-1)===32;)s++,o--;if(o)break;o=-1}else if(e===-2)c=!0,s++;else if(e!==-1){a++;break}}if(t._contentTypeTextTrailing&&n===e.length&&(s=0),s){let i={type:n===e.length||c||s<2?`lineSuffix`:`hardBreakTrailing`,start:{_bufferIndex:a?o:r.start._bufferIndex+o,_index:r.start._index+a,line:r.end.line,column:r.end.column-s,offset:r.end.offset-s},end:{...r.end}};r.end={...i.start},r.start.offset===r.end.offset?Object.assign(r,i):(e.splice(n,0,[`enter`,i,t],[`exit`,i,t]),n+=2)}n++}return e}var Ax=c({attentionMarkers:()=>Rx,contentInitial:()=>Mx,disable:()=>zx,document:()=>jx,flow:()=>Px,flowInitial:()=>Nx,insideSpan:()=>Lx,string:()=>Fx,text:()=>Ix}),jx={42:dx,43:dx,45:dx,48:dx,49:dx,50:dx,51:dx,52:dx,53:dx,54:dx,55:dx,56:dx,57:dx,62:Jy},Mx={91:Db},Nx={[-2]:ob,[-1]:ob,32:ob},Px={35:Nb,42:lx,45:[yx,lx],60:Rb,61:yx,95:lx,96:rb,126:rb},Fx={38:eb,92:Qy},Ix={[-5]:sx,[-4]:sx,[-3]:sx,33:rx,38:eb,42:By,60:[Wy,Gb],91:ax,92:[jb,Qy],93:qb,95:By,96:ub},Lx={null:[By,wx]},Rx={null:[42,95]},zx={null:[]};function Bx(e,t,n){let r={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0},i={},a=[],o=[],s=[],c={attempt:C(x),check:C(S),consume:v,enter:y,exit:b,interrupt:C(S,{interrupt:!0})},l={code:null,containerState:{},defineSkip:h,events:[],now:m,parser:e,previous:null,sliceSerialize:f,sliceStream:p,write:d},u=t.tokenize.call(l,c);return t.resolveAll&&a.push(t),l;function d(e){return o=uy(o,e),g(),o[o.length-1]===null?(w(t,0),l.events=zy(a,l.events,l),l.events):[]}function f(e,t){return Hx(p(e),t)}function p(e){return Vx(o,e)}function m(){let{_bufferIndex:e,_index:t,line:n,column:i,offset:a}=r;return{_bufferIndex:e,_index:t,line:n,column:i,offset:a}}function h(e){i[e.line]=e.column,E()}function g(){let e;for(;r._index<o.length;){let t=o[r._index];if(typeof t==`string`)for(e=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===e&&r._bufferIndex<t.length;)_(t.charCodeAt(r._bufferIndex));else _(t)}}function _(e){u=u(e)}function v(e){wy(e)?(r.line++,r.column=1,r.offset+=e===-3?2:1,E()):e!==-1&&(r.column++,r.offset++),r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===o[r._index].length&&(r._bufferIndex=-1,r._index++)),l.previous=e}function y(e,t){let n=t||{};return n.type=e,n.start=m(),l.events.push([`enter`,n,l]),s.push(n),n}function b(e){let t=s.pop();return t.end=m(),l.events.push([`exit`,t,l]),t}function x(e,t){w(e,t.from)}function S(e,t){t.restore()}function C(e,t){return n;function n(n,r,i){let a,o,s,u;return Array.isArray(n)?f(n):`tokenize`in n?f([n]):d(n);function d(e){return t;function t(t){let n=t!==null&&e[t],r=t!==null&&e.null;return f([...Array.isArray(n)?n:n?[n]:[],...Array.isArray(r)?r:r?[r]:[]])(t)}}function f(e){return a=e,o=0,e.length===0?i:p(e[o])}function p(e){return n;function n(n){return u=T(),s=e,e.partial||(l.currentConstruct=e),e.name&&l.parser.constructs.disable.null.includes(e.name)?h(n):e.tokenize.call(t?Object.assign(Object.create(l),t):l,c,m,h)(n)}}function m(t){return e(s,u),r}function h(e){return u.restore(),++o<a.length?p(a[o]):i}}}function w(e,t){e.resolveAll&&!a.includes(e)&&a.push(e),e.resolve&&ly(l.events,t,l.events.length-t,e.resolve(l.events.slice(t),l)),e.resolveTo&&(l.events=e.resolveTo(l.events,l))}function T(){let e=m(),t=l.previous,n=l.currentConstruct,i=l.events.length,a=Array.from(s);return{from:i,restore:o};function o(){r=e,l.previous=t,l.currentConstruct=n,l.events.length=i,s=a,E()}}function E(){r.line in i&&r.column<2&&(r.column=i[r.line],r.offset+=i[r.line]-1)}}function Vx(e,t){let n=t.start._index,r=t.start._bufferIndex,i=t.end._index,a=t.end._bufferIndex,o;if(n===i)o=[e[n].slice(r,a)];else{if(o=e.slice(n,i),r>-1){let e=o[0];typeof e==`string`?o[0]=e.slice(r):o.shift()}a>0&&o.push(e[i].slice(0,a))}return o}function Hx(e,t){let n=-1,r=[],i;for(;++n<e.length;){let a=e[n],o;if(typeof a==`string`)o=a;else switch(a){case-5:o=`\r`;break;case-4:o=`
|
|
20
|
+
`},Zd={onDragStart(e){let{active:t}=e;return`Picked up draggable item `+t.id+`.`},onDragOver(e){let{active:t,over:n}=e;return n?`Draggable item `+t.id+` was moved over droppable area `+n.id+`.`:`Draggable item `+t.id+` is no longer over a droppable area.`},onDragEnd(e){let{active:t,over:n}=e;return n?`Draggable item `+t.id+` was dropped over droppable area `+n.id:`Draggable item `+t.id+` was dropped.`},onDragCancel(e){let{active:t}=e;return`Dragging was cancelled. Draggable item `+t.id+` was dropped.`}};function Qd(e){let{announcements:t=Zd,container:n,hiddenTextDescribedById:r,screenReaderInstructions:i=Xd}=e,{announce:a,announcement:o}=Kd(),s=Md(`DndLiveRegion`),[c,l]=(0,x.useState)(!1);if((0,x.useEffect)(()=>{l(!0)},[]),Jd((0,x.useMemo)(()=>({onDragStart(e){let{active:n}=e;a(t.onDragStart({active:n}))},onDragMove(e){let{active:n,over:r}=e;t.onDragMove&&a(t.onDragMove({active:n,over:r}))},onDragOver(e){let{active:n,over:r}=e;a(t.onDragOver({active:n,over:r}))},onDragEnd(e){let{active:n,over:r}=e;a(t.onDragEnd({active:n,over:r}))},onDragCancel(e){let{active:n,over:r}=e;a(t.onDragCancel({active:n,over:r}))}}),[a,t])),!c)return null;let u=x.createElement(x.Fragment,null,x.createElement(Wd,{id:r,value:i.draggable}),x.createElement(Gd,{id:s,announcement:o}));return n?(0,re.createPortal)(u,n):u}var $d;(function(e){e.DragStart=`dragStart`,e.DragMove=`dragMove`,e.DragEnd=`dragEnd`,e.DragCancel=`dragCancel`,e.DragOver=`dragOver`,e.RegisterDroppable=`registerDroppable`,e.SetDroppableDisabled=`setDroppableDisabled`,e.UnregisterDroppable=`unregisterDroppable`})($d||={});function ef(){}function tf(e,t){return(0,x.useMemo)(()=>({sensor:e,options:t??{}}),[e,t])}function nf(){var e=[...arguments];return(0,x.useMemo)(()=>[...e].filter(e=>e!=null),[...e])}var rf=Object.freeze({x:0,y:0});function af(e,t){return Math.sqrt((e.x-t.x)**2+(e.y-t.y)**2)}function of(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return n-r}function sf(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return r-n}function cf(e,t){if(!e||e.length===0)return null;let[n]=e;return t?n[t]:n}function lf(e,t,n){return t===void 0&&(t=e.left),n===void 0&&(n=e.top),{x:t+e.width*.5,y:n+e.height*.5}}var uf=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e,i=lf(t,t.left,t.top),a=[];for(let e of r){let{id:t}=e,r=n.get(t);if(r){let n=af(lf(r),i);a.push({id:t,data:{droppableContainer:e,value:n}})}}return a.sort(of)};function df(e,t){let n=Math.max(t.top,e.top),r=Math.max(t.left,e.left),i=Math.min(t.left+t.width,e.left+e.width),a=Math.min(t.top+t.height,e.top+e.height),o=i-r,s=a-n;if(r<i&&n<a){let n=t.width*t.height,r=e.width*e.height,i=o*s,a=i/(n+r-i);return Number(a.toFixed(4))}return 0}var ff=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e,i=[];for(let e of r){let{id:r}=e,a=n.get(r);if(a){let n=df(a,t);n>0&&i.push({id:r,data:{droppableContainer:e,value:n}})}}return i.sort(sf)};function pf(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}function mf(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:rf}function hf(e){return function(t){return[...arguments].slice(1).reduce((t,n)=>({...t,top:t.top+e*n.y,bottom:t.bottom+e*n.y,left:t.left+e*n.x,right:t.right+e*n.x}),{...t})}}var gf=hf(1);function _f(e){if(e.startsWith(`matrix3d(`)){let t=e.slice(9,-1).split(/, /);return{x:+t[12],y:+t[13],scaleX:+t[0],scaleY:+t[5]}}else if(e.startsWith(`matrix(`)){let t=e.slice(7,-1).split(/, /);return{x:+t[4],y:+t[5],scaleX:+t[0],scaleY:+t[3]}}return null}function vf(e,t,n){let r=_f(t);if(!r)return e;let{scaleX:i,scaleY:a,x:o,y:s}=r,c=e.left-o-(1-i)*parseFloat(n),l=e.top-s-(1-a)*parseFloat(n.slice(n.indexOf(` `)+1)),u=i?e.width/i:e.width,d=a?e.height/a:e.height;return{width:u,height:d,top:l,right:c+u,bottom:l+d,left:c}}var yf={ignoreTransform:!1};function bf(e,t){t===void 0&&(t=yf);let n=e.getBoundingClientRect();if(t.ignoreTransform){let{transform:t,transformOrigin:r}=yd(e).getComputedStyle(e);t&&(n=vf(n,t,r))}let{top:r,left:i,width:a,height:o,bottom:s,right:c}=n;return{top:r,left:i,width:a,height:o,bottom:s,right:c}}function xf(e){return bf(e,{ignoreTransform:!0})}function Sf(e){let t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}function Cf(e,t){return t===void 0&&(t=yd(e).getComputedStyle(e)),t.position===`fixed`}function wf(e,t){t===void 0&&(t=yd(e).getComputedStyle(e));let n=/(auto|scroll|overlay)/;return[`overflow`,`overflowX`,`overflowY`].some(e=>{let r=t[e];return typeof r==`string`?n.test(r):!1})}function Tf(e,t){let n=[];function r(i){if(t!=null&&n.length>=t||!i)return n;if(bd(i)&&i.scrollingElement!=null&&!n.includes(i.scrollingElement))return n.push(i.scrollingElement),n;if(!xd(i)||Sd(i)||n.includes(i))return n;let a=yd(e).getComputedStyle(i);return i!==e&&wf(i,a)&&n.push(i),Cf(i,a)?n:r(i.parentNode)}return e?r(e):n}function Ef(e){let[t]=Tf(e,1);return t??null}function Df(e){return!gd||!e?null:_d(e)?e:vd(e)?bd(e)||e===Cd(e).scrollingElement?window:xd(e)?e:null:null}function Of(e){return _d(e)?e.scrollX:e.scrollLeft}function kf(e){return _d(e)?e.scrollY:e.scrollTop}function Af(e){return{x:Of(e),y:kf(e)}}var jf;(function(e){e[e.Forward=1]=`Forward`,e[e.Backward=-1]=`Backward`})(jf||={});function Mf(e){return!gd||!e?!1:e===document.scrollingElement}function Nf(e){let t={x:0,y:0},n=Mf(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},r={x:e.scrollWidth-n.width,y:e.scrollHeight-n.height};return{isTop:e.scrollTop<=t.y,isLeft:e.scrollLeft<=t.x,isBottom:e.scrollTop>=r.y,isRight:e.scrollLeft>=r.x,maxScroll:r,minScroll:t}}var Pf={x:.2,y:.2};function Ff(e,t,n,r,i){let{top:a,left:o,right:s,bottom:c}=n;r===void 0&&(r=10),i===void 0&&(i=Pf);let{isTop:l,isBottom:u,isLeft:d,isRight:f}=Nf(e),p={x:0,y:0},m={x:0,y:0},h={height:t.height*i.y,width:t.width*i.x};return!l&&a<=t.top+h.height?(p.y=jf.Backward,m.y=r*Math.abs((t.top+h.height-a)/h.height)):!u&&c>=t.bottom-h.height&&(p.y=jf.Forward,m.y=r*Math.abs((t.bottom-h.height-c)/h.height)),!f&&s>=t.right-h.width?(p.x=jf.Forward,m.x=r*Math.abs((t.right-h.width-s)/h.width)):!d&&o<=t.left+h.width&&(p.x=jf.Backward,m.x=r*Math.abs((t.left+h.width-o)/h.width)),{direction:p,speed:m}}function If(e){if(e===document.scrollingElement){let{innerWidth:e,innerHeight:t}=window;return{top:0,left:0,right:e,bottom:t,width:e,height:t}}let{top:t,left:n,right:r,bottom:i}=e.getBoundingClientRect();return{top:t,left:n,right:r,bottom:i,width:e.clientWidth,height:e.clientHeight}}function Lf(e){return e.reduce((e,t)=>Pd(e,Af(t)),rf)}function Rf(e){return e.reduce((e,t)=>e+Of(t),0)}function zf(e){return e.reduce((e,t)=>e+kf(t),0)}function Bf(e,t){if(t===void 0&&(t=bf),!e)return;let{top:n,left:r,bottom:i,right:a}=t(e);Ef(e)&&(i<=0||a<=0||n>=window.innerHeight||r>=window.innerWidth)&&e.scrollIntoView({block:`center`,inline:`center`})}var Vf=[[`x`,[`left`,`right`],Rf],[`y`,[`top`,`bottom`],zf]],Hf=class{constructor(e,t){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;let n=Tf(t),r=Lf(n);this.rect={...e},this.width=e.width,this.height=e.height;for(let[e,t,i]of Vf)for(let a of t)Object.defineProperty(this,a,{get:()=>{let t=i(n),o=r[e]-t;return this.rect[a]+o},enumerable:!0});Object.defineProperty(this,`rect`,{enumerable:!1})}},Uf=class{constructor(e){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(e=>this.target?.removeEventListener(...e))},this.target=e}add(e,t,n){var r;(r=this.target)==null||r.addEventListener(e,t,n),this.listeners.push([e,t,n])}};function Wf(e){let{EventTarget:t}=yd(e);return e instanceof t?e:Cd(e)}function Gf(e,t){let n=Math.abs(e.x),r=Math.abs(e.y);return typeof t==`number`?Math.sqrt(n**2+r**2)>t:`x`in t&&`y`in t?n>t.x&&r>t.y:`x`in t?n>t.x:`y`in t?r>t.y:!1}var Kf;(function(e){e.Click=`click`,e.DragStart=`dragstart`,e.Keydown=`keydown`,e.ContextMenu=`contextmenu`,e.Resize=`resize`,e.SelectionChange=`selectionchange`,e.VisibilityChange=`visibilitychange`})(Kf||={});function qf(e){e.preventDefault()}function Jf(e){e.stopPropagation()}var Yf;(function(e){e.Space=`Space`,e.Down=`ArrowDown`,e.Right=`ArrowRight`,e.Left=`ArrowLeft`,e.Up=`ArrowUp`,e.Esc=`Escape`,e.Enter=`Enter`,e.Tab=`Tab`})(Yf||={});var Xf={start:[Yf.Space,Yf.Enter],cancel:[Yf.Esc],end:[Yf.Space,Yf.Enter,Yf.Tab]},Zf=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case Yf.Right:return{...n,x:n.x+25};case Yf.Left:return{...n,x:n.x-25};case Yf.Down:return{...n,y:n.y+25};case Yf.Up:return{...n,y:n.y-25}}},Qf=class{constructor(e){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=e;let{event:{target:t}}=e;this.props=e,this.listeners=new Uf(Cd(t)),this.windowListeners=new Uf(yd(t)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(Kf.Resize,this.handleCancel),this.windowListeners.add(Kf.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(Kf.Keydown,this.handleKeyDown))}handleStart(){let{activeNode:e,onStart:t}=this.props,n=e.node.current;n&&Bf(n),t(rf)}handleKeyDown(e){if(Ld(e)){let{active:t,context:n,options:r}=this.props,{keyboardCodes:i=Xf,coordinateGetter:a=Zf,scrollBehavior:o=`smooth`}=r,{code:s}=e;if(i.end.includes(s)){this.handleEnd(e);return}if(i.cancel.includes(s)){this.handleCancel(e);return}let{collisionRect:c}=n.current,l=c?{x:c.left,y:c.top}:rf;this.referenceCoordinates||=l;let u=a(e,{active:t,context:n.current,currentCoordinates:l});if(u){let t=Fd(u,l),r={x:0,y:0},{scrollableAncestors:i}=n.current;for(let n of i){let i=e.code,{isTop:a,isRight:s,isLeft:c,isBottom:l,maxScroll:d,minScroll:f}=Nf(n),p=If(n),m={x:Math.min(i===Yf.Right?p.right-p.width/2:p.right,Math.max(i===Yf.Right?p.left:p.left+p.width/2,u.x)),y:Math.min(i===Yf.Down?p.bottom-p.height/2:p.bottom,Math.max(i===Yf.Down?p.top:p.top+p.height/2,u.y))},h=i===Yf.Right&&!s||i===Yf.Left&&!c,g=i===Yf.Down&&!l||i===Yf.Up&&!a;if(h&&m.x!==u.x){let e=n.scrollLeft+t.x,a=i===Yf.Right&&e<=d.x||i===Yf.Left&&e>=f.x;if(a&&!t.y){n.scrollTo({left:e,behavior:o});return}a?r.x=n.scrollLeft-e:r.x=i===Yf.Right?n.scrollLeft-d.x:n.scrollLeft-f.x,r.x&&n.scrollBy({left:-r.x,behavior:o});break}else if(g&&m.y!==u.y){let e=n.scrollTop+t.y,a=i===Yf.Down&&e<=d.y||i===Yf.Up&&e>=f.y;if(a&&!t.x){n.scrollTo({top:e,behavior:o});return}a?r.y=n.scrollTop-e:r.y=i===Yf.Down?n.scrollTop-d.y:n.scrollTop-f.y,r.y&&n.scrollBy({top:-r.y,behavior:o});break}}this.handleMove(e,Pd(Fd(u,this.referenceCoordinates),r))}}}handleMove(e,t){let{onMove:n}=this.props;e.preventDefault(),n(t)}handleEnd(e){let{onEnd:t}=this.props;e.preventDefault(),this.detach(),t()}handleCancel(e){let{onCancel:t}=this.props;e.preventDefault(),this.detach(),t()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}};Qf.activators=[{eventName:`onKeyDown`,handler:(e,t,n)=>{let{keyboardCodes:r=Xf,onActivation:i}=t,{active:a}=n,{code:o}=e.nativeEvent;if(r.start.includes(o)){let t=a.activatorNode.current;return t&&e.target!==t?!1:(e.preventDefault(),i?.({event:e.nativeEvent}),!0)}return!1}}];function $f(e){return!!(e&&`distance`in e)}function ep(e){return!!(e&&`delay`in e)}var tp=class{constructor(e,t,n){n===void 0&&(n=Wf(e.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=e,this.events=t;let{event:r}=e,{target:i}=r;this.props=e,this.events=t,this.document=Cd(i),this.documentListeners=new Uf(this.document),this.listeners=new Uf(n),this.windowListeners=new Uf(yd(i)),this.initialCoordinates=zd(r)??rf,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){let{events:e,props:{options:{activationConstraint:t,bypassActivationConstraint:n}}}=this;if(this.listeners.add(e.move.name,this.handleMove,{passive:!1}),this.listeners.add(e.end.name,this.handleEnd),e.cancel&&this.listeners.add(e.cancel.name,this.handleCancel),this.windowListeners.add(Kf.Resize,this.handleCancel),this.windowListeners.add(Kf.DragStart,qf),this.windowListeners.add(Kf.VisibilityChange,this.handleCancel),this.windowListeners.add(Kf.ContextMenu,qf),this.documentListeners.add(Kf.Keydown,this.handleKeydown),t){if(n!=null&&n({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(ep(t)){this.timeoutId=setTimeout(this.handleStart,t.delay),this.handlePending(t);return}if($f(t)){this.handlePending(t);return}}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handlePending(e,t){let{active:n,onPending:r}=this.props;r(n,e,this.initialCoordinates,t)}handleStart(){let{initialCoordinates:e}=this,{onStart:t}=this.props;e&&(this.activated=!0,this.documentListeners.add(Kf.Click,Jf,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(Kf.SelectionChange,this.removeTextSelection),t(e))}handleMove(e){let{activated:t,initialCoordinates:n,props:r}=this,{onMove:i,options:{activationConstraint:a}}=r;if(!n)return;let o=zd(e)??rf,s=Fd(n,o);if(!t&&a){if($f(a)){if(a.tolerance!=null&&Gf(s,a.tolerance))return this.handleCancel();if(Gf(s,a.distance))return this.handleStart()}if(ep(a)&&Gf(s,a.tolerance))return this.handleCancel();this.handlePending(a,s);return}e.cancelable&&e.preventDefault(),i(o)}handleEnd(){let{onAbort:e,onEnd:t}=this.props;this.detach(),this.activated||e(this.props.active),t()}handleCancel(){let{onAbort:e,onCancel:t}=this.props;this.detach(),this.activated||e(this.props.active),t()}handleKeydown(e){e.code===Yf.Esc&&this.handleCancel()}removeTextSelection(){var e;(e=this.document.getSelection())==null||e.removeAllRanges()}},np={cancel:{name:`pointercancel`},move:{name:`pointermove`},end:{name:`pointerup`}},rp=class extends tp{constructor(e){let{event:t}=e,n=Cd(t.target);super(e,np,n)}};rp.activators=[{eventName:`onPointerDown`,handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return!n.isPrimary||n.button!==0?!1:(r?.({event:n}),!0)}}];var ip={move:{name:`mousemove`},end:{name:`mouseup`}},ap;(function(e){e[e.RightClick=2]=`RightClick`})(ap||={});var op=class extends tp{constructor(e){super(e,ip,Cd(e.event.target))}};op.activators=[{eventName:`onMouseDown`,handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return n.button===ap.RightClick?!1:(r?.({event:n}),!0)}}];var sp={cancel:{name:`touchcancel`},move:{name:`touchmove`},end:{name:`touchend`}},cp=class extends tp{constructor(e){super(e,sp)}static setup(){return window.addEventListener(sp.move.name,e,{capture:!1,passive:!1}),function(){window.removeEventListener(sp.move.name,e)};function e(){}}};cp.activators=[{eventName:`onTouchStart`,handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t,{touches:i}=n;return i.length>1?!1:(r?.({event:n}),!0)}}];var lp;(function(e){e[e.Pointer=0]=`Pointer`,e[e.DraggableRect=1]=`DraggableRect`})(lp||={});var up;(function(e){e[e.TreeOrder=0]=`TreeOrder`,e[e.ReversedTreeOrder=1]=`ReversedTreeOrder`})(up||={});function dp(e){let{acceleration:t,activator:n=lp.Pointer,canScroll:r,draggingRect:i,enabled:a,interval:o=5,order:s=up.TreeOrder,pointerCoordinates:c,scrollableAncestors:l,scrollableAncestorRects:u,delta:d,threshold:f}=e,p=pp({delta:d,disabled:!a}),[m,h]=Ed(),g=(0,x.useRef)({x:0,y:0}),_=(0,x.useRef)({x:0,y:0}),v=(0,x.useMemo)(()=>{switch(n){case lp.Pointer:return c?{top:c.y,bottom:c.y,left:c.x,right:c.x}:null;case lp.DraggableRect:return i}},[n,i,c]),y=(0,x.useRef)(null),b=(0,x.useCallback)(()=>{let e=y.current;if(!e)return;let t=g.current.x*_.current.x,n=g.current.y*_.current.y;e.scrollBy(t,n)},[]),S=(0,x.useMemo)(()=>s===up.TreeOrder?[...l].reverse():l,[s,l]);(0,x.useEffect)(()=>{if(!a||!l.length||!v){h();return}for(let e of S){if(r?.(e)===!1)continue;let n=u[l.indexOf(e)];if(!n)continue;let{direction:i,speed:a}=Ff(e,n,v,t,f);for(let e of[`x`,`y`])p[e][i[e]]||(a[e]=0,i[e]=0);if(a.x>0||a.y>0){h(),y.current=e,m(b,o),g.current=a,_.current=i;return}}g.current={x:0,y:0},_.current={x:0,y:0},h()},[t,b,r,h,a,o,JSON.stringify(v),JSON.stringify(p),m,l,S,u,JSON.stringify(f)])}var fp={x:{[jf.Backward]:!1,[jf.Forward]:!1},y:{[jf.Backward]:!1,[jf.Forward]:!1}};function pp(e){let{delta:t,disabled:n}=e,r=Ad(t);return Od(e=>{if(n||!r||!e)return fp;let i={x:Math.sign(t.x-r.x),y:Math.sign(t.y-r.y)};return{x:{[jf.Backward]:e.x[jf.Backward]||i.x===-1,[jf.Forward]:e.x[jf.Forward]||i.x===1},y:{[jf.Backward]:e.y[jf.Backward]||i.y===-1,[jf.Forward]:e.y[jf.Forward]||i.y===1}}},[n,t,r])}function mp(e,t){let n=t==null?void 0:e.get(t),r=n?n.node.current:null;return Od(e=>t==null?null:r??e??null,[r,t])}function hp(e,t){return(0,x.useMemo)(()=>e.reduce((e,n)=>{let{sensor:r}=n,i=r.activators.map(e=>({eventName:e.eventName,handler:t(e.handler,n)}));return[...e,...i]},[]),[e,t])}var gp;(function(e){e[e.Always=0]=`Always`,e[e.BeforeDragging=1]=`BeforeDragging`,e[e.WhileDragging=2]=`WhileDragging`})(gp||={});var _p;(function(e){e.Optimized=`optimized`})(_p||={});var vp=new Map;function yp(e,t){let{dragging:n,dependencies:r,config:i}=t,[a,o]=(0,x.useState)(null),{frequency:s,measure:c,strategy:l}=i,u=(0,x.useRef)(e),d=g(),f=Dd(d),p=(0,x.useCallback)(function(e){e===void 0&&(e=[]),!f.current&&o(t=>t===null?e:t.concat(e.filter(e=>!t.includes(e))))},[f]),m=(0,x.useRef)(null),h=Od(t=>{if(d&&!n)return vp;if(!t||t===vp||u.current!==e||a!=null){let t=new Map;for(let n of e){if(!n)continue;if(a&&a.length>0&&!a.includes(n.id)&&n.rect.current){t.set(n.id,n.rect.current);continue}let e=n.node.current,r=e?new Hf(c(e),e):null;n.rect.current=r,r&&t.set(n.id,r)}return t}return t},[e,a,n,d,c]);return(0,x.useEffect)(()=>{u.current=e},[e]),(0,x.useEffect)(()=>{d||p()},[n,d]),(0,x.useEffect)(()=>{a&&a.length>0&&o(null)},[JSON.stringify(a)]),(0,x.useEffect)(()=>{d||typeof s!=`number`||m.current!==null||(m.current=setTimeout(()=>{p(),m.current=null},s))},[s,d,p,...r]),{droppableRects:h,measureDroppableContainers:p,measuringScheduled:a!=null};function g(){switch(l){case gp.Always:return!1;case gp.BeforeDragging:return n;default:return!n}}}function bp(e,t){return Od(n=>e?n||(typeof t==`function`?t(e):e):null,[t,e])}function xp(e,t){return bp(e,t)}function Sp(e){let{callback:t,disabled:n}=e,r=Td(t),i=(0,x.useMemo)(()=>{if(n||typeof window>`u`||window.MutationObserver===void 0)return;let{MutationObserver:e}=window;return new e(r)},[r,n]);return(0,x.useEffect)(()=>()=>i?.disconnect(),[i]),i}function Cp(e){let{callback:t,disabled:n}=e,r=Td(t),i=(0,x.useMemo)(()=>{if(n||typeof window>`u`||window.ResizeObserver===void 0)return;let{ResizeObserver:e}=window;return new e(r)},[n]);return(0,x.useEffect)(()=>()=>i?.disconnect(),[i]),i}function wp(e){return new Hf(bf(e),e)}function Tp(e,t,n){t===void 0&&(t=wp);let[r,i]=(0,x.useState)(null);function a(){i(r=>{if(!e)return null;if(e.isConnected===!1)return r??n??null;let i=t(e);return JSON.stringify(r)===JSON.stringify(i)?r:i})}let o=Sp({callback(t){if(e)for(let n of t){let{type:t,target:r}=n;if(t===`childList`&&r instanceof HTMLElement&&r.contains(e)){a();break}}}}),s=Cp({callback:a});return wd(()=>{a(),e?(s?.observe(e),o?.observe(document.body,{childList:!0,subtree:!0})):(s?.disconnect(),o?.disconnect())},[e]),r}function Ep(e){return mf(e,bp(e))}var Dp=[];function Op(e){let t=(0,x.useRef)(e),n=Od(n=>e?n&&n!==Dp&&e&&t.current&&e.parentNode===t.current.parentNode?n:Tf(e):Dp,[e]);return(0,x.useEffect)(()=>{t.current=e},[e]),n}function kp(e){let[t,n]=(0,x.useState)(null),r=(0,x.useRef)(e),i=(0,x.useCallback)(e=>{let t=Df(e.target);t&&n(e=>e?(e.set(t,Af(t)),new Map(e)):null)},[]);return(0,x.useEffect)(()=>{let t=r.current;if(e!==t){a(t);let o=e.map(e=>{let t=Df(e);return t?(t.addEventListener(`scroll`,i,{passive:!0}),[t,Af(t)]):null}).filter(e=>e!=null);n(o.length?new Map(o):null),r.current=e}return()=>{a(e),a(t)};function a(e){e.forEach(e=>{Df(e)?.removeEventListener(`scroll`,i)})}},[i,e]),(0,x.useMemo)(()=>e.length?t?Array.from(t.values()).reduce((e,t)=>Pd(e,t),rf):Lf(e):rf,[e,t])}function Ap(e,t){t===void 0&&(t=[]);let n=(0,x.useRef)(null);return(0,x.useEffect)(()=>{n.current=null},t),(0,x.useEffect)(()=>{let t=e!==rf;t&&!n.current&&(n.current=e),!t&&n.current&&(n.current=null)},[e]),n.current?Fd(e,n.current):rf}function jp(e){(0,x.useEffect)(()=>{if(!gd)return;let t=e.map(e=>{let{sensor:t}=e;return t.setup==null?void 0:t.setup()});return()=>{for(let e of t)e?.()}},e.map(e=>{let{sensor:t}=e;return t}))}function Mp(e,t){return(0,x.useMemo)(()=>e.reduce((e,n)=>{let{eventName:r,handler:i}=n;return e[r]=e=>{i(e,t)},e},{}),[e,t])}function Np(e){return(0,x.useMemo)(()=>e?Sf(e):null,[e])}var Pp=[];function Fp(e,t){t===void 0&&(t=bf);let[n]=e,r=Np(n?yd(n):null),[i,a]=(0,x.useState)(Pp);function o(){a(()=>e.length?e.map(e=>Mf(e)?r:new Hf(t(e),e)):Pp)}let s=Cp({callback:o});return wd(()=>{s?.disconnect(),o(),e.forEach(e=>s?.observe(e))},[e]),i}function Ip(e){if(!e)return null;if(e.children.length>1)return e;let t=e.children[0];return xd(t)?t:e}function Lp(e){let{measure:t}=e,[n,r]=(0,x.useState)(null),i=Cp({callback:(0,x.useCallback)(e=>{for(let{target:n}of e)if(xd(n)){r(e=>{let r=t(n);return e?{...e,width:r.width,height:r.height}:r});break}},[t])}),[a,o]=kd((0,x.useCallback)(e=>{let n=Ip(e);i?.disconnect(),n&&i?.observe(n),r(n?t(n):null)},[t,i]));return(0,x.useMemo)(()=>({nodeRef:a,rect:n,setRef:o}),[n,a,o])}var Rp=[{sensor:rp,options:{}},{sensor:Qf,options:{}}],zp={current:{}},Bp={draggable:{measure:xf},droppable:{measure:xf,strategy:gp.WhileDragging,frequency:_p.Optimized},dragOverlay:{measure:bf}},Vp=class extends Map{get(e){return e==null?void 0:super.get(e)??void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(e=>{let{disabled:t}=e;return!t})}getNodeFor(e){return this.get(e)?.node.current??void 0}},Hp={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new Vp,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:ef},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:Bp,measureDroppableContainers:ef,windowRect:null,measuringScheduled:!1},Up={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:``},dispatch:ef,draggableNodes:new Map,over:null,measureDroppableContainers:ef},Wp=(0,x.createContext)(Up),Gp=(0,x.createContext)(Hp);function Kp(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new Vp}}}function qp(e,t){switch(t.type){case $d.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case $d.DragMove:return e.draggable.active==null?e:{...e,draggable:{...e.draggable,translate:{x:t.coordinates.x-e.draggable.initialCoordinates.x,y:t.coordinates.y-e.draggable.initialCoordinates.y}}};case $d.DragEnd:case $d.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case $d.RegisterDroppable:{let{element:n}=t,{id:r}=n,i=new Vp(e.droppable.containers);return i.set(r,n),{...e,droppable:{...e.droppable,containers:i}}}case $d.SetDroppableDisabled:{let{id:n,key:r,disabled:i}=t,a=e.droppable.containers.get(n);if(!a||r!==a.key)return e;let o=new Vp(e.droppable.containers);return o.set(n,{...a,disabled:i}),{...e,droppable:{...e.droppable,containers:o}}}case $d.UnregisterDroppable:{let{id:n,key:r}=t,i=e.droppable.containers.get(n);if(!i||r!==i.key)return e;let a=new Vp(e.droppable.containers);return a.delete(n),{...e,droppable:{...e.droppable,containers:a}}}default:return e}}function Jp(e){let{disabled:t}=e,{active:n,activatorEvent:r,draggableNodes:i}=(0,x.useContext)(Wp),a=Ad(r),o=Ad(n?.id);return(0,x.useEffect)(()=>{if(!t&&!r&&a&&o!=null){if(!Ld(a)||document.activeElement===a.target)return;let e=i.get(o);if(!e)return;let{activatorNode:t,node:n}=e;if(!t.current&&!n.current)return;requestAnimationFrame(()=>{for(let e of[t.current,n.current]){if(!e)continue;let t=Hd(e);if(t){t.focus();break}}})}},[r,t,i,o,a]),null}function Yp(e,t){let{transform:n,...r}=t;return e!=null&&e.length?e.reduce((e,t)=>t({transform:e,...r}),n):n}function Xp(e){return(0,x.useMemo)(()=>({draggable:{...Bp.draggable,...e?.draggable},droppable:{...Bp.droppable,...e?.droppable},dragOverlay:{...Bp.dragOverlay,...e?.dragOverlay}}),[e?.draggable,e?.droppable,e?.dragOverlay])}function Zp(e){let{activeNode:t,measure:n,initialRect:r,config:i=!0}=e,a=(0,x.useRef)(!1),{x:o,y:s}=typeof i==`boolean`?{x:i,y:i}:i;wd(()=>{if(!o&&!s||!t){a.current=!1;return}if(a.current||!r)return;let e=t?.node.current;if(!e||e.isConnected===!1)return;let i=mf(n(e),r);if(o||(i.x=0),s||(i.y=0),a.current=!0,Math.abs(i.x)>0||Math.abs(i.y)>0){let t=Ef(e);t&&t.scrollBy({top:i.y,left:i.x})}},[t,o,s,r,n])}var Qp=(0,x.createContext)({...rf,scaleX:1,scaleY:1}),$p;(function(e){e[e.Uninitialized=0]=`Uninitialized`,e[e.Initializing=1]=`Initializing`,e[e.Initialized=2]=`Initialized`})($p||={});var em=(0,x.memo)(function(e){let{id:t,accessibility:n,autoScroll:r=!0,children:i,sensors:a=Rp,collisionDetection:o=ff,measuring:s,modifiers:c,...l}=e,[u,d]=(0,x.useReducer)(qp,void 0,Kp),[f,p]=Yd(),[m,h]=(0,x.useState)($p.Uninitialized),g=m===$p.Initialized,{draggable:{active:_,nodes:v,translate:y},droppable:{containers:b}}=u,S=_==null?null:v.get(_),C=(0,x.useRef)({initial:null,translated:null}),w=(0,x.useMemo)(()=>_==null?null:{id:_,data:S?.data??zp,rect:C},[_,S]),T=(0,x.useRef)(null),[E,D]=(0,x.useState)(null),[O,k]=(0,x.useState)(null),A=Dd(l,Object.values(l)),j=Md(`DndDescribedBy`,t),M=(0,x.useMemo)(()=>b.getEnabled(),[b]),N=Xp(s),{droppableRects:P,measureDroppableContainers:F,measuringScheduled:I}=yp(M,{dragging:g,dependencies:[y.x,y.y],config:N.droppable}),L=mp(v,_),R=(0,x.useMemo)(()=>O?zd(O):null,[O]),z=Ee(),B=xp(L,N.draggable.measure);Zp({activeNode:_==null?null:v.get(_),config:z.layoutShiftCompensation,initialRect:B,measure:N.draggable.measure});let V=Tp(L,N.draggable.measure,B),ee=Tp(L?L.parentElement:null),H=(0,x.useRef)({activatorEvent:null,active:null,activeNode:L,collisionRect:null,collisions:null,droppableRects:P,draggableNodes:v,draggingNode:null,draggingNodeRect:null,droppableContainers:b,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),te=b.getNodeFor(H.current.over?.id),U=Lp({measure:N.dragOverlay.measure}),ne=U.nodeRef.current??L,ie=g?U.rect??V:null,ae=!!(U.nodeRef.current&&U.rect),W=Ep(ae?null:V),oe=Np(ne?yd(ne):null),se=Op(g?te??L:null),ce=Fp(se),le=Yp(c,{transform:{x:y.x-W.x,y:y.y-W.y,scaleX:1,scaleY:1},activatorEvent:O,active:w,activeNodeRect:V,containerNodeRect:ee,draggingNodeRect:ie,over:H.current.over,overlayNodeRect:U.rect,scrollableAncestors:se,scrollableAncestorRects:ce,windowRect:oe}),ue=R?Pd(R,y):null,de=kp(se),fe=Ap(de),pe=Ap(de,[V]),me=Pd(le,fe),he=ie?gf(ie,le):null,ge=w&&he?o({active:w,collisionRect:he,droppableRects:P,droppableContainers:M,pointerCoordinates:ue}):null,_e=cf(ge,`id`),[ve,ye]=(0,x.useState)(null),be=pf(ae?le:Pd(le,pe),ve?.rect??null,V),xe=(0,x.useRef)(null),Se=(0,x.useCallback)((e,t)=>{let{sensor:n,options:r}=t;if(T.current==null)return;let i=v.get(T.current);if(!i)return;let a=e.nativeEvent;xe.current=new n({active:T.current,activeNode:i,event:a,options:r,context:H,onAbort(e){if(!v.get(e))return;let{onDragAbort:t}=A.current,n={id:e};t?.(n),f({type:`onDragAbort`,event:n})},onPending(e,t,n,r){if(!v.get(e))return;let{onDragPending:i}=A.current,a={id:e,constraint:t,initialCoordinates:n,offset:r};i?.(a),f({type:`onDragPending`,event:a})},onStart(e){let t=T.current;if(t==null)return;let n=v.get(t);if(!n)return;let{onDragStart:r}=A.current,i={activatorEvent:a,active:{id:t,data:n.data,rect:C}};(0,re.unstable_batchedUpdates)(()=>{r?.(i),h($p.Initializing),d({type:$d.DragStart,initialCoordinates:e,active:t}),f({type:`onDragStart`,event:i}),D(xe.current),k(a)})},onMove(e){d({type:$d.DragMove,coordinates:e})},onEnd:o($d.DragEnd),onCancel:o($d.DragCancel)});function o(e){return async function(){let{active:t,collisions:n,over:r,scrollAdjustedTranslate:i}=H.current,o=null;if(t&&i){let{cancelDrop:s}=A.current;o={activatorEvent:a,active:t,collisions:n,delta:i,over:r},e===$d.DragEnd&&typeof s==`function`&&await Promise.resolve(s(o))&&(e=$d.DragCancel)}T.current=null,(0,re.unstable_batchedUpdates)(()=>{d({type:e}),h($p.Uninitialized),ye(null),D(null),k(null),xe.current=null;let t=e===$d.DragEnd?`onDragEnd`:`onDragCancel`;if(o){let e=A.current[t];e?.(o),f({type:t,event:o})}})}}},[v]),Ce=hp(a,(0,x.useCallback)((e,t)=>(n,r)=>{let i=n.nativeEvent,a=v.get(r);if(T.current!==null||!a||i.dndKit||i.defaultPrevented)return;let o={active:a};e(n,t.options,o)===!0&&(i.dndKit={capturedBy:t.sensor},T.current=r,Se(n,t))},[v,Se]));jp(a),wd(()=>{V&&m===$p.Initializing&&h($p.Initialized)},[V,m]),(0,x.useEffect)(()=>{let{onDragMove:e}=A.current,{active:t,activatorEvent:n,collisions:r,over:i}=H.current;if(!t||!n)return;let a={active:t,activatorEvent:n,collisions:r,delta:{x:me.x,y:me.y},over:i};(0,re.unstable_batchedUpdates)(()=>{e?.(a),f({type:`onDragMove`,event:a})})},[me.x,me.y]),(0,x.useEffect)(()=>{let{active:e,activatorEvent:t,collisions:n,droppableContainers:r,scrollAdjustedTranslate:i}=H.current;if(!e||T.current==null||!t||!i)return;let{onDragOver:a}=A.current,o=r.get(_e),s=o&&o.rect.current?{id:o.id,rect:o.rect.current,data:o.data,disabled:o.disabled}:null,c={active:e,activatorEvent:t,collisions:n,delta:{x:i.x,y:i.y},over:s};(0,re.unstable_batchedUpdates)(()=>{ye(s),a?.(c),f({type:`onDragOver`,event:c})})},[_e]),wd(()=>{H.current={activatorEvent:O,active:w,activeNode:L,collisionRect:he,collisions:ge,droppableRects:P,draggableNodes:v,draggingNode:ne,draggingNodeRect:ie,droppableContainers:b,over:ve,scrollableAncestors:se,scrollAdjustedTranslate:me},C.current={initial:ie,translated:he}},[w,L,ge,he,v,ne,ie,P,b,ve,se,me]),dp({...z,delta:y,draggingRect:he,pointerCoordinates:ue,scrollableAncestors:se,scrollableAncestorRects:ce});let we=(0,x.useMemo)(()=>({active:w,activeNode:L,activeNodeRect:V,activatorEvent:O,collisions:ge,containerNodeRect:ee,dragOverlay:U,draggableNodes:v,droppableContainers:b,droppableRects:P,over:ve,measureDroppableContainers:F,scrollableAncestors:se,scrollableAncestorRects:ce,measuringConfiguration:N,measuringScheduled:I,windowRect:oe}),[w,L,V,O,ge,ee,U,v,b,P,ve,F,se,ce,N,I,oe]),Te=(0,x.useMemo)(()=>({activatorEvent:O,activators:Ce,active:w,activeNodeRect:V,ariaDescribedById:{draggable:j},dispatch:d,draggableNodes:v,over:ve,measureDroppableContainers:F}),[O,Ce,w,V,d,j,v,ve,F]);return x.createElement(qd.Provider,{value:p},x.createElement(Wp.Provider,{value:Te},x.createElement(Gp.Provider,{value:we},x.createElement(Qp.Provider,{value:be},i)),x.createElement(Jp,{disabled:n?.restoreFocus===!1})),x.createElement(Qd,{...n,hiddenTextDescribedById:j}));function Ee(){let e=E?.autoScrollEnabled===!1,t=typeof r==`object`?r.enabled===!1:r===!1,n=g&&!e&&!t;return typeof r==`object`?{...r,enabled:n}:{enabled:n}}}),tm=(0,x.createContext)(null),nm=`button`,rm=`Draggable`;function im(e){let{id:t,data:n,disabled:r=!1,attributes:i}=e,a=Md(rm),{activators:o,activatorEvent:s,active:c,activeNodeRect:l,ariaDescribedById:u,draggableNodes:d,over:f}=(0,x.useContext)(Wp),{role:p=nm,roleDescription:m=`draggable`,tabIndex:h=0}=i??{},g=c?.id===t,_=(0,x.useContext)(g?Qp:tm),[v,y]=kd(),[b,S]=kd(),C=Mp(o,t),w=Dd(n);return wd(()=>(d.set(t,{id:t,key:a,node:v,activatorNode:b,data:w}),()=>{let e=d.get(t);e&&e.key===a&&d.delete(t)}),[d,t]),{active:c,activatorEvent:s,activeNodeRect:l,attributes:(0,x.useMemo)(()=>({role:p,tabIndex:h,"aria-disabled":r,"aria-pressed":g&&p===nm?!0:void 0,"aria-roledescription":m,"aria-describedby":u.draggable}),[r,p,h,g,m,u.draggable]),isDragging:g,listeners:r?void 0:C,node:v,over:f,setNodeRef:y,setActivatorNodeRef:S,transform:_}}function am(){return(0,x.useContext)(Gp)}var om=`Droppable`,sm={timeout:25};function cm(e){let{data:t,disabled:n=!1,id:r,resizeObserverConfig:i}=e,a=Md(om),{active:o,dispatch:s,over:c,measureDroppableContainers:l}=(0,x.useContext)(Wp),u=(0,x.useRef)({disabled:n}),d=(0,x.useRef)(!1),f=(0,x.useRef)(null),p=(0,x.useRef)(null),{disabled:m,updateMeasurementsFor:h,timeout:g}={...sm,...i},_=Dd(h??r),v=Cp({callback:(0,x.useCallback)(()=>{if(!d.current){d.current=!0;return}p.current!=null&&clearTimeout(p.current),p.current=setTimeout(()=>{l(Array.isArray(_.current)?_.current:[_.current]),p.current=null},g)},[g]),disabled:m||!o}),[y,b]=kd((0,x.useCallback)((e,t)=>{v&&(t&&(v.unobserve(t),d.current=!1),e&&v.observe(e))},[v])),S=Dd(t);return(0,x.useEffect)(()=>{!v||!y.current||(v.disconnect(),d.current=!1,v.observe(y.current))},[y,v]),(0,x.useEffect)(()=>(s({type:$d.RegisterDroppable,element:{id:r,key:a,disabled:n,node:y,rect:f,data:S}}),()=>s({type:$d.UnregisterDroppable,key:a,id:r})),[r]),(0,x.useEffect)(()=>{n!==u.current.disabled&&(s({type:$d.SetDroppableDisabled,id:r,key:a,disabled:n}),u.current.disabled=n)},[r,a,n,s]),{active:o,rect:f,isOver:c?.id===r,node:y,over:c,setNodeRef:b}}function lm(e,t,n){let r=e.slice();return r.splice(n<0?r.length+n:n,0,r.splice(t,1)[0]),r}function um(e,t){return e.reduce((e,n,r)=>{let i=t.get(n);return i&&(e[r]=i),e},Array(e.length))}function dm(e){return e!==null&&e>=0}function fm(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function pm(e){return typeof e==`boolean`?{draggable:e,droppable:e}:e}var mm=e=>{let{rects:t,activeIndex:n,overIndex:r,index:i}=e,a=lm(t,r,n),o=t[i],s=a[i];return!s||!o?null:{x:s.left-o.left,y:s.top-o.top,scaleX:s.width/o.width,scaleY:s.height/o.height}},hm={scaleX:1,scaleY:1},gm=e=>{let{activeIndex:t,activeNodeRect:n,index:r,rects:i,overIndex:a}=e,o=i[t]??n;if(!o)return null;if(r===t){let e=i[a];return e?{x:0,y:t<a?e.top+e.height-(o.top+o.height):e.top-o.top,...hm}:null}let s=_m(i,r,t);return r>t&&r<=a?{x:0,y:-o.height-s,...hm}:r<t&&r>=a?{x:0,y:o.height+s,...hm}:{x:0,y:0,...hm}};function _m(e,t,n){let r=e[t],i=e[t-1],a=e[t+1];return r?n<t?i?r.top-(i.top+i.height):a?a.top-(r.top+r.height):0:a?a.top-(r.top+r.height):i?r.top-(i.top+i.height):0:0}var vm=`Sortable`,ym=x.createContext({activeIndex:-1,containerId:vm,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:mm,disabled:{draggable:!1,droppable:!1}});function bm(e){let{children:t,id:n,items:r,strategy:i=mm,disabled:a=!1}=e,{active:o,dragOverlay:s,droppableRects:c,over:l,measureDroppableContainers:u}=am(),d=Md(vm,n),f=s.rect!==null,p=(0,x.useMemo)(()=>r.map(e=>typeof e==`object`&&`id`in e?e.id:e),[r]),m=o!=null,h=o?p.indexOf(o.id):-1,g=l?p.indexOf(l.id):-1,_=(0,x.useRef)(p),v=!fm(p,_.current),y=g!==-1&&h===-1||v,b=pm(a);wd(()=>{v&&m&&u(p)},[v,p,m,u]),(0,x.useEffect)(()=>{_.current=p},[p]);let S=(0,x.useMemo)(()=>({activeIndex:h,containerId:d,disabled:b,disableTransforms:y,items:p,overIndex:g,useDragOverlay:f,sortedRects:um(p,c),strategy:i}),[h,d,b.draggable,b.droppable,y,p,g,c,f,i]);return x.createElement(ym.Provider,{value:S},t)}var xm=e=>{let{id:t,items:n,activeIndex:r,overIndex:i}=e;return lm(n,r,i).indexOf(t)},Sm=e=>{let{containerId:t,isSorting:n,wasDragging:r,index:i,items:a,newIndex:o,previousItems:s,previousContainerId:c,transition:l}=e;return!l||!r||s!==a&&i===o?!1:n?!0:o!==i&&t===c},Cm={duration:200,easing:`ease`},wm=`transform`,Tm=Bd.Transition.toString({property:wm,duration:0,easing:`linear`}),Em={roleDescription:`sortable`};function Dm(e){let{disabled:t,index:n,node:r,rect:i}=e,[a,o]=(0,x.useState)(null),s=(0,x.useRef)(n);return wd(()=>{if(!t&&n!==s.current&&r.current){let e=i.current;if(e){let t=bf(r.current,{ignoreTransform:!0}),n={x:e.left-t.left,y:e.top-t.top,scaleX:e.width/t.width,scaleY:e.height/t.height};(n.x||n.y)&&o(n)}}n!==s.current&&(s.current=n)},[t,n,r,i]),(0,x.useEffect)(()=>{a&&o(null)},[a]),a}function Om(e){let{animateLayoutChanges:t=Sm,attributes:n,disabled:r,data:i,getNewIndex:a=xm,id:o,strategy:s,resizeObserverConfig:c,transition:l=Cm}=e,{items:u,containerId:d,activeIndex:f,disabled:p,disableTransforms:m,sortedRects:h,overIndex:g,useDragOverlay:_,strategy:v}=(0,x.useContext)(ym),y=km(r,p),b=u.indexOf(o),S=(0,x.useMemo)(()=>({sortable:{containerId:d,index:b,items:u},...i}),[d,i,b,u]),C=(0,x.useMemo)(()=>u.slice(u.indexOf(o)),[u,o]),{rect:w,node:T,isOver:E,setNodeRef:D}=cm({id:o,data:S,disabled:y.droppable,resizeObserverConfig:{updateMeasurementsFor:C,...c}}),{active:O,activatorEvent:k,activeNodeRect:A,attributes:j,setNodeRef:M,listeners:N,isDragging:P,over:F,setActivatorNodeRef:I,transform:L}=im({id:o,data:S,attributes:{...Em,...n},disabled:y.draggable}),R=hd(D,M),z=!!O,B=z&&!m&&dm(f)&&dm(g),V=!_&&P,ee=B?(V&&B?L:null)??(s??v)({rects:h,activeNodeRect:A,activeIndex:f,overIndex:g,index:b}):null,H=dm(f)&&dm(g)?a({id:o,items:u,activeIndex:f,overIndex:g}):b,te=O?.id,U=(0,x.useRef)({activeId:te,items:u,newIndex:H,containerId:d}),ne=u!==U.current.items,re=t({active:O,containerId:d,isDragging:P,isSorting:z,id:o,index:b,items:u,newIndex:U.current.newIndex,previousItems:U.current.items,previousContainerId:U.current.containerId,transition:l,wasDragging:U.current.activeId!=null}),ie=Dm({disabled:!re,index:b,node:T,rect:w});return(0,x.useEffect)(()=>{z&&U.current.newIndex!==H&&(U.current.newIndex=H),d!==U.current.containerId&&(U.current.containerId=d),u!==U.current.items&&(U.current.items=u)},[z,H,d,u]),(0,x.useEffect)(()=>{if(te===U.current.activeId)return;if(te!=null&&U.current.activeId==null){U.current.activeId=te;return}let e=setTimeout(()=>{U.current.activeId=te},50);return()=>clearTimeout(e)},[te]),{active:O,activeIndex:f,attributes:j,data:S,rect:w,index:b,newIndex:H,items:u,isOver:E,isSorting:z,isDragging:P,listeners:N,node:T,overIndex:g,over:F,setNodeRef:R,setActivatorNodeRef:I,setDroppableNodeRef:D,setDraggableNodeRef:M,transform:ie??ee,transition:ae()};function ae(){if(ie||ne&&U.current.newIndex===b)return Tm;if(!(V&&!Ld(k)||!l)&&(z||re))return Bd.Transition.toString({...l,property:wm})}}function km(e,t){return typeof e==`boolean`?{draggable:e,droppable:!1}:{draggable:e?.draggable??t.draggable,droppable:e?.droppable??t.droppable}}Yf.Down,Yf.Right,Yf.Up,Yf.Left;var Am={permission:0,waiting:1,working:2,unknown:3};function jm(e){let t=e.agentSessionId?.trim();return t&&t.length>0?t:e.id}var Mm={mode:`created`,direction:`desc`};function Nm(e,t=Mm){let{mode:n,direction:r,manualOrder:i}=t;if(n===`manual`&&i&&i.length>0){let t=new Map(i.map((e,t)=>[e,t]));return e.toSorted((e,n)=>{let r=jm(e),i=jm(n),a=t.get(r)??t.get(e.id)??1/0,o=t.get(i)??t.get(n.id)??1/0;return a===1/0&&o===1/0?Date.parse(n.createdAt)-Date.parse(e.createdAt):a-o})}return e.toSorted((e,t)=>{if(n===`status`){let n=Am[e.status]??Am.unknown,r=Am[t.status]??Am.unknown;return n===r?Date.parse(t.lastActivity)-Date.parse(e.lastActivity):n-r}let i=Date.parse(e.createdAt),a=Date.parse(t.createdAt);return r===`desc`?a-i:i-a})}function Pm(e,t){let n=new Map;for(let t of e){let e=t.projectPath?.trim();if(e){let r=Date.parse(t.lastActivity)||0;r>(n.get(e)||0)&&n.set(e,r)}}for(let e of t){let t=e.projectPath?.trim();if(t){let r=Date.parse(e.lastActivityAt)||0;r>(n.get(t)||0)&&n.set(t,r)}}return Array.from(n.keys()).toSorted((e,t)=>{let r=n.get(e)||0;return(n.get(t)||0)-r})}function Fm(e,t){let n=new Map;for(let t of e){let e=t.host?.trim();if(e){let r=Date.parse(t.lastActivity)||0;r>(n.get(e)||0)&&n.set(e,r)}}for(let e of t){let t=e.host?.trim();if(t){let r=Date.parse(e.lastActivityAt)||0;r>(n.get(t)||0)&&n.set(t,r)}}return Array.from(n.keys()).toSorted((e,t)=>{let r=n.get(e)||0;return(n.get(t)||0)-r})}function Im(e){let t=Date.parse(e);if(Number.isNaN(t))return``;let n=Date.now()-t,r=Math.floor(n/6e4);if(r<1)return`now`;if(r<60)return`${r}m`;let i=Math.floor(r/60);return i<24?`${i}h`:`${Math.floor(i/24)}d`}function Lm(e){let t=e.trim();if(!t)return null;let n=t.replace(/[\\/]+$/,``);if(!n)return null;let r=n.split(/[\\/]/);return r[r.length-1]||null}function Rm(e){let t=e.map(e=>{let t=e.trim(),n=t.replace(/[\\/]+$/,``);return{path:e,parts:n.split(/[\\/]/).filter(Boolean),fallback:n||t||e}}),n=new Map;for(let e of t)n.set(e.path,1);let r=!0;for(;r;){r=!1;let e=new Map;for(let r of t){if(r.parts.length===0)continue;let t=n.get(r.path)??1,i=r.parts.slice(-t).join(`/`);e.set(i,(e.get(i)??0)+1)}for(let i of t){if(i.parts.length===0)continue;let t=n.get(i.path)??1,a=i.parts.slice(-t).join(`/`);(e.get(a)??0)>1&&t<i.parts.length&&(n.set(i.path,t+1),r=!0)}}let i=new Map,a=new Map;for(let e of t){let t=e.fallback;if(e.parts.length>0){let r=n.get(e.path)??1;t=e.parts.slice(-r).join(`/`)}i.set(e.path,t),a.set(t,(a.get(t)??0)+1)}let o=new Map;for(let e of t){let t=i.get(e.path)??e.fallback;(a.get(t)??0)>1&&(t=e.fallback),o.set(e.path,t)}return o}function zm(e){let t=e.trim();return!t||t.length<=6?t:`${t.slice(0,3)}…${t.slice(-3)}`}function Bm(e){let t=document.createElement(`textarea`);t.value=e,t.style.position=`fixed`,t.style.left=`-9999px`,document.body.appendChild(t),t.focus(),t.select();try{if(!document.execCommand(`copy`))throw 0}catch{navigator.clipboard?.writeText(e).catch(()=>{})}document.body.removeChild(t)}function Vm({useSafariLayoutFallback:e,isDragging:t,dndTransform:n,generatedTransform:r}){return e&&!t&&!n||!n?r:!r||r===`none`?n:`${n} ${r}`}var Hm=`agentboard-session`,Um=N(Hm);function Wm(e,t){return e.id===t.id&&e.name===t.name&&e.tmuxWindow===t.tmuxWindow&&e.projectPath===t.projectPath&&e.status===t.status&&e.lastActivity===t.lastActivity&&e.createdAt===t.createdAt&&e.source===t.source&&e.host===t.host&&e.remote===t.remote&&e.command===t.command&&e.agentType===t.agentType&&e.agentSessionId===t.agentSessionId&&e.agentSessionName===t.agentSessionName&&e.logFilePath===t.logFilePath&&e.isHibernating===t.isHibernating&&e.lastUserMessage===t.lastUserMessage}function Gm(e,t){if(e.length!==t.length)return!1;let n=new Map(e.map(e=>[e.id,e]));for(let e of t){let t=n.get(e.id);if(!t||!Wm(t,e))return!1}return!0}function Km(e){return typeof e==`string`&&e.length>0?e:null}function qm(e){return Array.isArray(e)?e:[]}var Jm=T()(k((e,t)=>({sessions:[],agentSessions:{active:[],hibernating:[],history:[]},agentSessionsEpoch:-1,hostStatuses:[],exitingSessions:new Map,selectedSessionId:null,selectedHibernatingSessionId:null,hasLoaded:!1,connectionStatus:`connecting`,connectionError:null,connectionEpoch:0,remoteAllowControl:!1,remoteAllowAttach:!1,hostLabel:null,preferWindowName:!1,setSessions:n=>{let r=t(),i=r.selectedSessionId,a=r.selectedHibernatingSessionId,o=r.sessions,s=r.exitingSessions;if(r.hasLoaded&&Gm(o,n))return;let c=new Set(n.map(e=>e.id)),l=o.filter(e=>!c.has(e.id)&&!s.has(e.id)),u=i;if(i!==null&&!n.some(e=>e.id===i))if(a===null){let{sessionSortMode:e,sessionSortDirection:t}=U.getState();u=Nm(n,{mode:e,direction:t})[0]?.id??null}else u=null;if(l.length>0){let t=new Map(s);for(let e of l)t.set(e.id,e);e({sessions:n,hasLoaded:!0,selectedSessionId:u,exitingSessions:t})}else e({sessions:n,hasLoaded:!0,selectedSessionId:u})},setAgentSessions:(t,n,r)=>e(e=>{let i={active:qm(t),hibernating:qm(n),history:qm(r)};return{agentSessions:i,agentSessionsEpoch:e.connectionEpoch,selectedHibernatingSessionId:e.selectedHibernatingSessionId&&!i.hibernating.some(t=>t.sessionId===e.selectedHibernatingSessionId)?null:e.selectedHibernatingSessionId}}),setActiveAgentSessions:t=>e(e=>({agentSessions:{active:qm(t),hibernating:e.agentSessions.hibernating,history:e.agentSessions.history}})),setHostStatuses:t=>e({hostStatuses:t}),updateSession:t=>e(e=>({sessions:e.sessions.map(e=>e.id===t.id?t:e)})),setSelectedSessionId:t=>e({selectedSessionId:t,...t===null?{}:{selectedHibernatingSessionId:null}}),setSelectedHibernatingSessionId:t=>e({selectedHibernatingSessionId:t,...t===null?{}:{selectedSessionId:null}}),setConnectionStatus:t=>e({connectionStatus:t}),setConnectionError:t=>e({connectionError:t}),setConnectionState:(t,n,r)=>e({connectionStatus:t,connectionError:n,connectionEpoch:r}),setRemoteAllowControl:t=>e({remoteAllowControl:t}),setRemoteAllowAttach:t=>e({remoteAllowAttach:t}),setHostLabel:t=>e({hostLabel:t}),setPreferWindowName:t=>e({preferWindowName:t}),markSessionExiting:n=>{let r=t().sessions.find(e=>e.id===n);if(r){let i=new Map(t().exitingSessions);i.set(n,r),e({exitingSessions:i})}},clearExitingSession:n=>{let r=new Map(t().exitingSessions);r.delete(n),e({exitingSessions:r})}}),{name:Hm,storage:D(()=>Um),partialize:e=>({selectedSessionId:e.selectedSessionId,selectedHibernatingSessionId:e.selectedHibernatingSessionId}),merge:(e,t)=>{let n=e,r=n?.selectedHibernatingSessionId??n?.selectedSleepingSessionId;return{...t,selectedSessionId:Km(n?.selectedSessionId),selectedHibernatingSessionId:Km(r)}}}));function Ym(e,t,n=!1){let[r,i]=(0,x.useState)(!1),a=(0,x.useRef)(e),o=(0,x.useRef)(!1);return(0,x.useEffect)(()=>{let r=a.current;if(n?e>r:e!==r){o.current=!0;let n=setTimeout(()=>{o.current&&=(i(!0),!1)},t);return a.current=e,()=>clearTimeout(n)}a.current=e},[e,t,n]),[r,()=>i(!1)]}function Xm(e,t,n,r){let i=(0,x.useRef)(new Map);(0,x.useEffect)(()=>{let a=new Set(e.map(e=>e.id));for(let e of t.keys())if(a.has(e)){let t=i.current.get(e);t&&(clearTimeout(t),i.current.delete(e)),n(e)}else if(!i.current.has(e)){let t=setTimeout(()=>{i.current.delete(e),n(e)},r+100);i.current.set(e,t)}},[e,t,n,r]),(0,x.useEffect)(()=>()=>{for(let e of i.current.values())clearTimeout(e);i.current.clear()},[])}function Zm(e){return typeof CSS<`u`?CSS.escape(e):e.replace(/["\\]/g,`\\$&`)}function Qm(e,t,n,r=!0){let i=(0,x.useRef)(t);(0,x.useEffect)(()=>{i.current=t},[t,r]),(0,x.useEffect)(()=>{if(!r)return;let t=i.current;if(!t)return;if(n&&!n(t)){i.current=null;return}let a=e.current?.querySelector(`[data-session-id="${Zm(t)}"]`);a&&(a.scrollIntoView({block:`nearest`,inline:`nearest`,behavior:`instant`}),i.current=null)})}function $m({className:e}){return(0,G.jsx)(`svg`,{viewBox:`0 0 92.2 92.2`,fill:`currentColor`,className:e,"aria-hidden":`true`,children:(0,G.jsx)(`path`,{d:`M66.5,0H52.4l25.7,65h14.1L66.5,0z M25.7,0L0,65h14.4l5.3-13.6h26.9L51.8,65h14.4L40.5,0C40.5,0,25.7,0,25.7,0z M24.3,39.3l8.8-22.8l8.8,22.8H24.3z`,transform:`translate(0, 13.6)`})})}function eh({className:e}){return(0,G.jsx)(`svg`,{viewBox:`-1 -1 26 26`,fill:`currentColor`,className:e,"aria-hidden":`true`,children:(0,G.jsx)(`path`,{d:`M22.2819 9.8211a5.9847 5.9847 0 0 0-.5157-4.9108 6.0462 6.0462 0 0 0-6.5098-2.9A6.0651 6.0651 0 0 0 4.9807 4.1818a5.9847 5.9847 0 0 0-3.9977 2.9 6.0462 6.0462 0 0 0 .7427 7.0966 5.98 5.98 0 0 0 .511 4.9107 6.051 6.051 0 0 0 6.5146 2.9001A5.9847 5.9847 0 0 0 13.2599 24a6.0557 6.0557 0 0 0 5.7718-4.2058 5.9894 5.9894 0 0 0 3.9977-2.9001 6.0557 6.0557 0 0 0-.7475-7.0729zm-9.022 12.6081a4.4755 4.4755 0 0 1-2.8764-1.0408l.1419-.0804 4.7783-2.7582a.7948.7948 0 0 0 .3927-.6813v-6.7369l2.02 1.1686a.071.071 0 0 1 .038.052v5.5826a4.504 4.504 0 0 1-4.4945 4.4944zm-9.6607-4.1254a4.4708 4.4708 0 0 1-.5346-3.0137l.142.0852 4.783 2.7582a.7712.7712 0 0 0 .7806 0l5.8428-3.3685v2.3324a.0804.0804 0 0 1-.0332.0615L9.74 19.9502a4.4992 4.4992 0 0 1-6.1408-1.6464zM2.3408 7.8956a4.485 4.485 0 0 1 2.3655-1.9728V11.6a.7664.7664 0 0 0 .3879.6765l5.8144 3.3543-2.0201 1.1685a.0757.0757 0 0 1-.071 0l-4.8303-2.7865A4.504 4.504 0 0 1 2.3408 7.872zm16.5963 3.8558L13.1038 8.364 15.1192 7.2a.0757.0757 0 0 1 .071 0l4.8303 2.7913a4.4944 4.4944 0 0 1-.6765 8.1042v-5.6772a.79.79 0 0 0-.407-.667zm2.0107-3.0231l-.142-.0852-4.7735-2.7818a.7759.7759 0 0 0-.7854 0L9.409 9.2297V6.8974a.0662.0662 0 0 1 .0284-.0615l4.8303-2.7866a4.4992 4.4992 0 0 1 6.6802 4.66zM8.3065 12.863l-2.02-1.1638a.0804.0804 0 0 1-.038-.0567V6.0742a4.4992 4.4992 0 0 1 7.3757-3.4537l-.142.0805L8.704 5.459a.7948.7948 0 0 0-.3927.6813zm1.0976-2.3654l2.602-1.4998 2.6069 1.4998v2.9994l-2.5974 1.4997-2.6067-1.4997Z`})})}function th({className:e}){return(0,G.jsx)(`svg`,{viewBox:`0 0 588.42 568.88`,fill:`currentColor`,className:e,"aria-hidden":`true`,children:(0,G.jsx)(`path`,{d:`M 10.499686,177.03840 L 31.174931,178.56990 C 52.615925,154.32116 61.039171,82.595924 187.38789,96.634671 C 182.79339,403.95560 48.021426,436.37234 56.444675,499.41907 C 59.507674,535.15406 87.840417,557.10556 118.47041,558.38181 C 215.21014,555.06356 210.87089,424.63084 240.99038,95.868921 L 365.80760,95.868921 C 359.17110,211.75239 341.04836,327.63586 339.00636,441.22208 C 340.53786,516.77606 386.48285,557.10556 446.97708,557.61606 C 546.52456,560.93431 577.92030,444.79558 577.92030,395.27709 L 556.47931,395.27710 C 554.43731,436.11709 534.78306,465.47083 492.92207,467.25758 C 378.82535,468.78908 441.61683,266.63113 442.38258,97.400421 L 577.92030,98.166171 L 577.15455,11.636437 C 13.807491,8.9075799 85.312284,-2.1366151 10.499686,177.03840 z`})})}function nh({className:e}){return(0,G.jsx)(`svg`,{viewBox:`41 41 343 343`,fill:`currentColor`,className:e,"aria-hidden":`true`,children:(0,G.jsx)(`path`,{d:`M70 159.333V91.3471C70 88.3592 71.594 85.5983 74.1816 84.1044L133.043 50.1205C135.631 48.6265 138.819 48.6265 141.407 50.1205L200.269 84.1044C202.856 85.5983 204.45 88.3592 204.45 91.3471V126.068C204.708 137.606 210.806 148.734 221.531 154.926C232.256 161.117 244.942 160.834 255.063 155.289L285.132 137.929C287.719 136.435 290.907 136.435 293.495 137.929L352.357 171.913C354.944 173.406 356.538 176.167 356.538 179.155V247.123C356.538 250.111 354.944 252.872 352.357 254.366L293.495 288.35C290.907 289.844 287.719 289.844 285.132 288.35L255.306 271.13C245.146 265.456 232.344 265.117 221.534 271.358C210.809 277.55 204.711 288.678 204.453 300.215V334.926C204.453 337.914 202.859 340.675 200.271 342.169L141.41 376.153C138.822 377.647 135.634 377.647 133.046 376.153L74.1845 342.169C71.5969 340.675 70.0028 337.914 70.0028 334.926V266.959C70.0029 263.971 71.5969 261.21 74.1845 259.716L133.046 225.732C135.634 224.238 138.822 224.238 141.41 225.732L171.547 243.132C181.656 248.638 194.306 248.906 205.005 242.729C215.815 236.488 221.922 225.231 222.088 213.595C221.83 202.057 215.732 189.737 205.008 183.545C194.283 177.353 181.597 177.636 171.476 183.181L141.269 200.72C138.67 202.229 135.461 202.228 132.864 200.716L74.1576 166.562C71.5835 165.065 70 162.311 70 159.333Z`})})}function rh({className:e}){return(0,G.jsxs)(`svg`,{viewBox:`0 0 512 512`,fill:`currentColor`,className:e,"aria-hidden":`true`,children:[(0,G.jsx)(`path`,{d:`M210.484 312.759L343.465 210.383C349.984 205.364 359.302 207.322 362.408 215.117C378.758 256.231 371.454 305.64 338.925 339.563C306.397 373.487 261.137 380.927 219.768 363.983L174.577 385.803C239.394 432.008 318.104 420.581 367.289 369.251C406.303 328.564 418.386 273.104 407.088 223.091L407.19 223.198C390.807 149.726 411.218 120.359 453.03 60.3072C454.02 58.8833 455.01 57.4595 456 56L400.978 113.382V113.204L210.45 312.794`}),(0,G.jsx)(`path`,{d:`M183.042 337.641C136.519 291.294 144.54 219.567 184.236 178.203C213.59 147.59 261.683 135.096 303.666 153.464L348.755 131.75C340.632 125.627 330.221 119.042 318.275 114.414C264.277 91.2407 199.63 102.774 155.735 148.516C113.513 192.549 100.236 260.254 123.036 318.027C140.069 361.206 112.148 391.748 84.0229 422.575C74.0561 433.503 64.0553 444.431 56 456L183.007 337.677`})]})}function ih({className:e}){return(0,G.jsxs)(`svg`,{viewBox:`0 -15 120 120`,fill:`currentColor`,className:e,"aria-hidden":`true`,children:[(0,G.jsx)(`rect`,{x:`10`,y:`8`,width:`100`,height:`12`,rx:`2`}),(0,G.jsx)(`rect`,{x:`25`,y:`20`,width:`12`,height:`62`,rx:`2`}),(0,G.jsx)(`rect`,{x:`75`,y:`20`,width:`12`,height:`45`,rx:`2`}),(0,G.jsx)(`rect`,{x:`71`,y:`55`,width:`20`,height:`16`,rx:`3`,fill:`#f97316`}),(0,G.jsx)(`rect`,{x:`76`,y:`59`,width:`3`,height:`8`,rx:`1`,fill:`#0d0d0d`}),(0,G.jsx)(`rect`,{x:`82`,y:`59`,width:`3`,height:`8`,rx:`1`,fill:`#0d0d0d`}),(0,G.jsx)(`circle`,{cx:`18`,cy:`14`,r:`2`,fill:`#f97316`,opacity:`0.8`}),(0,G.jsx)(`circle`,{cx:`102`,cy:`14`,r:`2`,fill:`#f97316`,opacity:`0.8`})]})}var ah=[[`claude`,$m],[`codex`,eh],[`omp`,ih],[`pi`,th],[`devin`,nh],[`grok`,rh]];function oh({agentType:e,command:t,className:n=``}){let r=(e||t?.split(` `)[0]||``).toLowerCase();for(let[e,t]of ah)if(r.startsWith(e))return(0,G.jsx)(t,{className:n});return(0,G.jsx)(He,{className:n})}function sh(e){var t,n,r=``;if(typeof e==`string`||typeof e==`number`)r+=e;else if(typeof e==`object`)if(Array.isArray(e)){var i=e.length;for(t=0;t<i;t++)e[t]&&(n=sh(e[t]))&&(r&&(r+=` `),r+=n)}else for(n in e)e[n]&&(r&&(r+=` `),r+=n);return r}function ch(){for(var e,t,n=0,r=``,i=arguments.length;n<i;n++)(e=arguments[n])&&(t=sh(e))&&(r&&(r+=` `),r+=t);return r}var lh=(e,t)=>{let n=Array(e.length+t.length);for(let t=0;t<e.length;t++)n[t]=e[t];for(let r=0;r<t.length;r++)n[e.length+r]=t[r];return n},uh=(e,t)=>({classGroupId:e,validator:t}),dh=(e=new Map,t=null,n)=>({nextPart:e,validators:t,classGroupId:n}),fh=`-`,ph=[],mh=`arbitrary..`,hh=e=>{let t=vh(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:e=>{if(e.startsWith(`[`)&&e.endsWith(`]`))return _h(e);let n=e.split(fh);return gh(n,+(n[0]===``&&n.length>1),t)},getConflictingClassGroupIds:(e,t)=>{if(t){let t=r[e],i=n[e];return t?i?lh(i,t):t:i||ph}return n[e]||ph}}},gh=(e,t,n)=>{if(e.length-t===0)return n.classGroupId;let r=e[t],i=n.nextPart.get(r);if(i){let n=gh(e,t+1,i);if(n)return n}let a=n.validators;if(a===null)return;let o=t===0?e.join(fh):e.slice(t).join(fh),s=a.length;for(let e=0;e<s;e++){let t=a[e];if(t.validator(o))return t.classGroupId}},_h=e=>e.slice(1,-1).indexOf(`:`)===-1?void 0:(()=>{let t=e.slice(1,-1),n=t.indexOf(`:`),r=t.slice(0,n);return r?mh+r:void 0})(),vh=e=>{let{theme:t,classGroups:n}=e;return yh(n,t)},yh=(e,t)=>{let n=dh();for(let r in e){let i=e[r];bh(i,n,r,t)}return n},bh=(e,t,n,r)=>{let i=e.length;for(let a=0;a<i;a++){let i=e[a];xh(i,t,n,r)}},xh=(e,t,n,r)=>{if(typeof e==`string`){Sh(e,t,n);return}if(typeof e==`function`){Ch(e,t,n,r);return}wh(e,t,n,r)},Sh=(e,t,n)=>{let r=e===``?t:Th(t,e);r.classGroupId=n},Ch=(e,t,n,r)=>{if(Eh(e)){bh(e(r),t,n,r);return}t.validators===null&&(t.validators=[]),t.validators.push(uh(n,e))},wh=(e,t,n,r)=>{let i=Object.entries(e),a=i.length;for(let e=0;e<a;e++){let[a,o]=i[e];bh(o,Th(t,a),n,r)}},Th=(e,t)=>{let n=e,r=t.split(fh),i=r.length;for(let e=0;e<i;e++){let t=r[e],i=n.nextPart.get(t);i||(i=dh(),n.nextPart.set(t,i)),n=i}return n},Eh=e=>`isThemeGetter`in e&&e.isThemeGetter===!0,Dh=e=>{if(e<1)return{get:()=>void 0,set:()=>{}};let t=0,n=Object.create(null),r=Object.create(null),i=(i,a)=>{n[i]=a,t++,t>e&&(t=0,r=n,n=Object.create(null))};return{get(e){let t=n[e];if(t!==void 0)return t;if((t=r[e])!==void 0)return i(e,t),t},set(e,t){e in n?n[e]=t:i(e,t)}}},Oh=`!`,kh=`:`,Ah=[],jh=(e,t,n,r,i)=>({modifiers:e,hasImportantModifier:t,baseClassName:n,maybePostfixModifierPosition:r,isExternal:i}),Mh=e=>{let{prefix:t,experimentalParseClassName:n}=e,r=e=>{let t=[],n=0,r=0,i=0,a,o=e.length;for(let s=0;s<o;s++){let o=e[s];if(n===0&&r===0){if(o===kh){t.push(e.slice(i,s)),i=s+1;continue}if(o===`/`){a=s;continue}}o===`[`?n++:o===`]`?n--:o===`(`?r++:o===`)`&&r--}let s=t.length===0?e:e.slice(i),c=s,l=!1;s.endsWith(Oh)?(c=s.slice(0,-1),l=!0):s.startsWith(Oh)&&(c=s.slice(1),l=!0);let u=a&&a>i?a-i:void 0;return jh(t,l,c,u)};if(t){let e=t+kh,n=r;r=t=>t.startsWith(e)?n(t.slice(e.length)):jh(Ah,!1,t,void 0,!0)}if(n){let e=r;r=t=>n({className:t,parseClassName:e})}return r},Nh=e=>{let t=new Map;return e.orderSensitiveModifiers.forEach((e,n)=>{t.set(e,1e6+n)}),e=>{let n=[],r=[];for(let i=0;i<e.length;i++){let a=e[i],o=a[0]===`[`,s=t.has(a);o||s?(r.length>0&&(r.sort(),n.push(...r),r=[]),n.push(a)):r.push(a)}return r.length>0&&(r.sort(),n.push(...r)),n}},Ph=e=>({cache:Dh(e.cacheSize),parseClassName:Mh(e),sortModifiers:Nh(e),...hh(e)}),Fh=/\s+/,Ih=(e,t)=>{let{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:i,sortModifiers:a}=t,o=[],s=e.trim().split(Fh),c=``;for(let e=s.length-1;e>=0;--e){let t=s[e],{isExternal:l,modifiers:u,hasImportantModifier:d,baseClassName:f,maybePostfixModifierPosition:p}=n(t);if(l){c=t+(c.length>0?` `+c:c);continue}let m=!!p,h=r(m?f.substring(0,p):f);if(!h){if(!m){c=t+(c.length>0?` `+c:c);continue}if(h=r(f),!h){c=t+(c.length>0?` `+c:c);continue}m=!1}let g=u.length===0?``:u.length===1?u[0]:a(u).join(`:`),_=d?g+Oh:g,v=_+h;if(o.indexOf(v)>-1)continue;o.push(v);let y=i(h,m);for(let e=0;e<y.length;++e){let t=y[e];o.push(_+t)}c=t+(c.length>0?` `+c:c)}return c},Lh=(...e)=>{let t=0,n,r,i=``;for(;t<e.length;)(n=e[t++])&&(r=Rh(n))&&(i&&(i+=` `),i+=r);return i},Rh=e=>{if(typeof e==`string`)return e;let t,n=``;for(let r=0;r<e.length;r++)e[r]&&(t=Rh(e[r]))&&(n&&(n+=` `),n+=t);return n},zh=(e,...t)=>{let n,r,i,a,o=o=>(n=Ph(t.reduce((e,t)=>t(e),e())),r=n.cache.get,i=n.cache.set,a=s,s(o)),s=e=>{let t=r(e);if(t)return t;let a=Ih(e,n);return i(e,a),a};return a=o,(...e)=>a(Lh(...e))},Bh=[],Vh=e=>{let t=t=>t[e]||Bh;return t.isThemeGetter=!0,t},Hh=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,Uh=/^\((?:(\w[\w-]*):)?(.+)\)$/i,Wh=/^\d+\/\d+$/,Gh=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,Kh=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,qh=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,Jh=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,Yh=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Xh=e=>Wh.test(e),Zh=e=>!!e&&!Number.isNaN(Number(e)),Qh=e=>!!e&&Number.isInteger(Number(e)),$h=e=>e.endsWith(`%`)&&Zh(e.slice(0,-1)),eg=e=>Gh.test(e),tg=()=>!0,ng=e=>Kh.test(e)&&!qh.test(e),rg=()=>!1,ig=e=>Jh.test(e),ag=e=>Yh.test(e),og=e=>!J(e)&&!Y(e),sg=e=>yg(e,Cg,rg),J=e=>Hh.test(e),cg=e=>yg(e,wg,ng),lg=e=>yg(e,Tg,Zh),ug=e=>yg(e,xg,rg),dg=e=>yg(e,Sg,ag),fg=e=>yg(e,Dg,ig),Y=e=>Uh.test(e),pg=e=>bg(e,wg),mg=e=>bg(e,Eg),hg=e=>bg(e,xg),gg=e=>bg(e,Cg),_g=e=>bg(e,Sg),vg=e=>bg(e,Dg,!0),yg=(e,t,n)=>{let r=Hh.exec(e);return r?r[1]?t(r[1]):n(r[2]):!1},bg=(e,t,n=!1)=>{let r=Uh.exec(e);return r?r[1]?t(r[1]):n:!1},xg=e=>e===`position`||e===`percentage`,Sg=e=>e===`image`||e===`url`,Cg=e=>e===`length`||e===`size`||e===`bg-size`,wg=e=>e===`length`,Tg=e=>e===`number`,Eg=e=>e===`family-name`,Dg=e=>e===`shadow`,Og=zh(()=>{let e=Vh(`color`),t=Vh(`font`),n=Vh(`text`),r=Vh(`font-weight`),i=Vh(`tracking`),a=Vh(`leading`),o=Vh(`breakpoint`),s=Vh(`container`),c=Vh(`spacing`),l=Vh(`radius`),u=Vh(`shadow`),d=Vh(`inset-shadow`),f=Vh(`text-shadow`),p=Vh(`drop-shadow`),m=Vh(`blur`),h=Vh(`perspective`),g=Vh(`aspect`),_=Vh(`ease`),v=Vh(`animate`),y=()=>[`auto`,`avoid`,`all`,`avoid-page`,`page`,`left`,`right`,`column`],b=()=>[`center`,`top`,`bottom`,`left`,`right`,`top-left`,`left-top`,`top-right`,`right-top`,`bottom-right`,`right-bottom`,`bottom-left`,`left-bottom`],x=()=>[...b(),Y,J],S=()=>[`auto`,`hidden`,`clip`,`visible`,`scroll`],C=()=>[`auto`,`contain`,`none`],w=()=>[Y,J,c],T=()=>[Xh,`full`,`auto`,...w()],E=()=>[Qh,`none`,`subgrid`,Y,J],D=()=>[`auto`,{span:[`full`,Qh,Y,J]},Qh,Y,J],O=()=>[Qh,`auto`,Y,J],k=()=>[`auto`,`min`,`max`,`fr`,Y,J],A=()=>[`start`,`end`,`center`,`between`,`around`,`evenly`,`stretch`,`baseline`,`center-safe`,`end-safe`],j=()=>[`start`,`end`,`center`,`stretch`,`center-safe`,`end-safe`],M=()=>[`auto`,...w()],N=()=>[Xh,`auto`,`full`,`dvw`,`dvh`,`lvw`,`lvh`,`svw`,`svh`,`min`,`max`,`fit`,...w()],P=()=>[e,Y,J],F=()=>[...b(),hg,ug,{position:[Y,J]}],I=()=>[`no-repeat`,{repeat:[``,`x`,`y`,`space`,`round`]}],L=()=>[`auto`,`cover`,`contain`,gg,sg,{size:[Y,J]}],R=()=>[$h,pg,cg],z=()=>[``,`none`,`full`,l,Y,J],B=()=>[``,Zh,pg,cg],V=()=>[`solid`,`dashed`,`dotted`,`double`],ee=()=>[`normal`,`multiply`,`screen`,`overlay`,`darken`,`lighten`,`color-dodge`,`color-burn`,`hard-light`,`soft-light`,`difference`,`exclusion`,`hue`,`saturation`,`color`,`luminosity`],H=()=>[Zh,$h,hg,ug],te=()=>[``,`none`,m,Y,J],U=()=>[`none`,Zh,Y,J],ne=()=>[`none`,Zh,Y,J],re=()=>[Zh,Y,J],ie=()=>[Xh,`full`,...w()];return{cacheSize:500,theme:{animate:[`spin`,`ping`,`pulse`,`bounce`],aspect:[`video`],blur:[eg],breakpoint:[eg],color:[tg],container:[eg],"drop-shadow":[eg],ease:[`in`,`out`,`in-out`],font:[og],"font-weight":[`thin`,`extralight`,`light`,`normal`,`medium`,`semibold`,`bold`,`extrabold`,`black`],"inset-shadow":[eg],leading:[`none`,`tight`,`snug`,`normal`,`relaxed`,`loose`],perspective:[`dramatic`,`near`,`normal`,`midrange`,`distant`,`none`],radius:[eg],shadow:[eg],spacing:[`px`,Zh],text:[eg],"text-shadow":[eg],tracking:[`tighter`,`tight`,`normal`,`wide`,`wider`,`widest`]},classGroups:{aspect:[{aspect:[`auto`,`square`,Xh,J,Y,g]}],container:[`container`],columns:[{columns:[Zh,J,Y,s]}],"break-after":[{"break-after":y()}],"break-before":[{"break-before":y()}],"break-inside":[{"break-inside":[`auto`,`avoid`,`avoid-page`,`avoid-column`]}],"box-decoration":[{"box-decoration":[`slice`,`clone`]}],box:[{box:[`border`,`content`]}],display:[`block`,`inline-block`,`inline`,`flex`,`inline-flex`,`table`,`inline-table`,`table-caption`,`table-cell`,`table-column`,`table-column-group`,`table-footer-group`,`table-header-group`,`table-row-group`,`table-row`,`flow-root`,`grid`,`inline-grid`,`contents`,`list-item`,`hidden`],sr:[`sr-only`,`not-sr-only`],float:[{float:[`right`,`left`,`none`,`start`,`end`]}],clear:[{clear:[`left`,`right`,`both`,`none`,`start`,`end`]}],isolation:[`isolate`,`isolation-auto`],"object-fit":[{object:[`contain`,`cover`,`fill`,`none`,`scale-down`]}],"object-position":[{object:x()}],overflow:[{overflow:S()}],"overflow-x":[{"overflow-x":S()}],"overflow-y":[{"overflow-y":S()}],overscroll:[{overscroll:C()}],"overscroll-x":[{"overscroll-x":C()}],"overscroll-y":[{"overscroll-y":C()}],position:[`static`,`fixed`,`absolute`,`relative`,`sticky`],inset:[{inset:T()}],"inset-x":[{"inset-x":T()}],"inset-y":[{"inset-y":T()}],start:[{start:T()}],end:[{end:T()}],top:[{top:T()}],right:[{right:T()}],bottom:[{bottom:T()}],left:[{left:T()}],visibility:[`visible`,`invisible`,`collapse`],z:[{z:[Qh,`auto`,Y,J]}],basis:[{basis:[Xh,`full`,`auto`,s,...w()]}],"flex-direction":[{flex:[`row`,`row-reverse`,`col`,`col-reverse`]}],"flex-wrap":[{flex:[`nowrap`,`wrap`,`wrap-reverse`]}],flex:[{flex:[Zh,Xh,`auto`,`initial`,`none`,J]}],grow:[{grow:[``,Zh,Y,J]}],shrink:[{shrink:[``,Zh,Y,J]}],order:[{order:[Qh,`first`,`last`,`none`,Y,J]}],"grid-cols":[{"grid-cols":E()}],"col-start-end":[{col:D()}],"col-start":[{"col-start":O()}],"col-end":[{"col-end":O()}],"grid-rows":[{"grid-rows":E()}],"row-start-end":[{row:D()}],"row-start":[{"row-start":O()}],"row-end":[{"row-end":O()}],"grid-flow":[{"grid-flow":[`row`,`col`,`dense`,`row-dense`,`col-dense`]}],"auto-cols":[{"auto-cols":k()}],"auto-rows":[{"auto-rows":k()}],gap:[{gap:w()}],"gap-x":[{"gap-x":w()}],"gap-y":[{"gap-y":w()}],"justify-content":[{justify:[...A(),`normal`]}],"justify-items":[{"justify-items":[...j(),`normal`]}],"justify-self":[{"justify-self":[`auto`,...j()]}],"align-content":[{content:[`normal`,...A()]}],"align-items":[{items:[...j(),{baseline:[``,`last`]}]}],"align-self":[{self:[`auto`,...j(),{baseline:[``,`last`]}]}],"place-content":[{"place-content":A()}],"place-items":[{"place-items":[...j(),`baseline`]}],"place-self":[{"place-self":[`auto`,...j()]}],p:[{p:w()}],px:[{px:w()}],py:[{py:w()}],ps:[{ps:w()}],pe:[{pe:w()}],pt:[{pt:w()}],pr:[{pr:w()}],pb:[{pb:w()}],pl:[{pl:w()}],m:[{m:M()}],mx:[{mx:M()}],my:[{my:M()}],ms:[{ms:M()}],me:[{me:M()}],mt:[{mt:M()}],mr:[{mr:M()}],mb:[{mb:M()}],ml:[{ml:M()}],"space-x":[{"space-x":w()}],"space-x-reverse":[`space-x-reverse`],"space-y":[{"space-y":w()}],"space-y-reverse":[`space-y-reverse`],size:[{size:N()}],w:[{w:[s,`screen`,...N()]}],"min-w":[{"min-w":[s,`screen`,`none`,...N()]}],"max-w":[{"max-w":[s,`screen`,`none`,`prose`,{screen:[o]},...N()]}],h:[{h:[`screen`,`lh`,...N()]}],"min-h":[{"min-h":[`screen`,`lh`,`none`,...N()]}],"max-h":[{"max-h":[`screen`,`lh`,...N()]}],"font-size":[{text:[`base`,n,pg,cg]}],"font-smoothing":[`antialiased`,`subpixel-antialiased`],"font-style":[`italic`,`not-italic`],"font-weight":[{font:[r,Y,lg]}],"font-stretch":[{"font-stretch":[`ultra-condensed`,`extra-condensed`,`condensed`,`semi-condensed`,`normal`,`semi-expanded`,`expanded`,`extra-expanded`,`ultra-expanded`,$h,J]}],"font-family":[{font:[mg,J,t]}],"fvn-normal":[`normal-nums`],"fvn-ordinal":[`ordinal`],"fvn-slashed-zero":[`slashed-zero`],"fvn-figure":[`lining-nums`,`oldstyle-nums`],"fvn-spacing":[`proportional-nums`,`tabular-nums`],"fvn-fraction":[`diagonal-fractions`,`stacked-fractions`],tracking:[{tracking:[i,Y,J]}],"line-clamp":[{"line-clamp":[Zh,`none`,Y,lg]}],leading:[{leading:[a,...w()]}],"list-image":[{"list-image":[`none`,Y,J]}],"list-style-position":[{list:[`inside`,`outside`]}],"list-style-type":[{list:[`disc`,`decimal`,`none`,Y,J]}],"text-alignment":[{text:[`left`,`center`,`right`,`justify`,`start`,`end`]}],"placeholder-color":[{placeholder:P()}],"text-color":[{text:P()}],"text-decoration":[`underline`,`overline`,`line-through`,`no-underline`],"text-decoration-style":[{decoration:[...V(),`wavy`]}],"text-decoration-thickness":[{decoration:[Zh,`from-font`,`auto`,Y,cg]}],"text-decoration-color":[{decoration:P()}],"underline-offset":[{"underline-offset":[Zh,`auto`,Y,J]}],"text-transform":[`uppercase`,`lowercase`,`capitalize`,`normal-case`],"text-overflow":[`truncate`,`text-ellipsis`,`text-clip`],"text-wrap":[{text:[`wrap`,`nowrap`,`balance`,`pretty`]}],indent:[{indent:w()}],"vertical-align":[{align:[`baseline`,`top`,`middle`,`bottom`,`text-top`,`text-bottom`,`sub`,`super`,Y,J]}],whitespace:[{whitespace:[`normal`,`nowrap`,`pre`,`pre-line`,`pre-wrap`,`break-spaces`]}],break:[{break:[`normal`,`words`,`all`,`keep`]}],wrap:[{wrap:[`break-word`,`anywhere`,`normal`]}],hyphens:[{hyphens:[`none`,`manual`,`auto`]}],content:[{content:[`none`,Y,J]}],"bg-attachment":[{bg:[`fixed`,`local`,`scroll`]}],"bg-clip":[{"bg-clip":[`border`,`padding`,`content`,`text`]}],"bg-origin":[{"bg-origin":[`border`,`padding`,`content`]}],"bg-position":[{bg:F()}],"bg-repeat":[{bg:I()}],"bg-size":[{bg:L()}],"bg-image":[{bg:[`none`,{linear:[{to:[`t`,`tr`,`r`,`br`,`b`,`bl`,`l`,`tl`]},Qh,Y,J],radial:[``,Y,J],conic:[Qh,Y,J]},_g,dg]}],"bg-color":[{bg:P()}],"gradient-from-pos":[{from:R()}],"gradient-via-pos":[{via:R()}],"gradient-to-pos":[{to:R()}],"gradient-from":[{from:P()}],"gradient-via":[{via:P()}],"gradient-to":[{to:P()}],rounded:[{rounded:z()}],"rounded-s":[{"rounded-s":z()}],"rounded-e":[{"rounded-e":z()}],"rounded-t":[{"rounded-t":z()}],"rounded-r":[{"rounded-r":z()}],"rounded-b":[{"rounded-b":z()}],"rounded-l":[{"rounded-l":z()}],"rounded-ss":[{"rounded-ss":z()}],"rounded-se":[{"rounded-se":z()}],"rounded-ee":[{"rounded-ee":z()}],"rounded-es":[{"rounded-es":z()}],"rounded-tl":[{"rounded-tl":z()}],"rounded-tr":[{"rounded-tr":z()}],"rounded-br":[{"rounded-br":z()}],"rounded-bl":[{"rounded-bl":z()}],"border-w":[{border:B()}],"border-w-x":[{"border-x":B()}],"border-w-y":[{"border-y":B()}],"border-w-s":[{"border-s":B()}],"border-w-e":[{"border-e":B()}],"border-w-t":[{"border-t":B()}],"border-w-r":[{"border-r":B()}],"border-w-b":[{"border-b":B()}],"border-w-l":[{"border-l":B()}],"divide-x":[{"divide-x":B()}],"divide-x-reverse":[`divide-x-reverse`],"divide-y":[{"divide-y":B()}],"divide-y-reverse":[`divide-y-reverse`],"border-style":[{border:[...V(),`hidden`,`none`]}],"divide-style":[{divide:[...V(),`hidden`,`none`]}],"border-color":[{border:P()}],"border-color-x":[{"border-x":P()}],"border-color-y":[{"border-y":P()}],"border-color-s":[{"border-s":P()}],"border-color-e":[{"border-e":P()}],"border-color-t":[{"border-t":P()}],"border-color-r":[{"border-r":P()}],"border-color-b":[{"border-b":P()}],"border-color-l":[{"border-l":P()}],"divide-color":[{divide:P()}],"outline-style":[{outline:[...V(),`none`,`hidden`]}],"outline-offset":[{"outline-offset":[Zh,Y,J]}],"outline-w":[{outline:[``,Zh,pg,cg]}],"outline-color":[{outline:P()}],shadow:[{shadow:[``,`none`,u,vg,fg]}],"shadow-color":[{shadow:P()}],"inset-shadow":[{"inset-shadow":[`none`,d,vg,fg]}],"inset-shadow-color":[{"inset-shadow":P()}],"ring-w":[{ring:B()}],"ring-w-inset":[`ring-inset`],"ring-color":[{ring:P()}],"ring-offset-w":[{"ring-offset":[Zh,cg]}],"ring-offset-color":[{"ring-offset":P()}],"inset-ring-w":[{"inset-ring":B()}],"inset-ring-color":[{"inset-ring":P()}],"text-shadow":[{"text-shadow":[`none`,f,vg,fg]}],"text-shadow-color":[{"text-shadow":P()}],opacity:[{opacity:[Zh,Y,J]}],"mix-blend":[{"mix-blend":[...ee(),`plus-darker`,`plus-lighter`]}],"bg-blend":[{"bg-blend":ee()}],"mask-clip":[{"mask-clip":[`border`,`padding`,`content`,`fill`,`stroke`,`view`]},`mask-no-clip`],"mask-composite":[{mask:[`add`,`subtract`,`intersect`,`exclude`]}],"mask-image-linear-pos":[{"mask-linear":[Zh]}],"mask-image-linear-from-pos":[{"mask-linear-from":H()}],"mask-image-linear-to-pos":[{"mask-linear-to":H()}],"mask-image-linear-from-color":[{"mask-linear-from":P()}],"mask-image-linear-to-color":[{"mask-linear-to":P()}],"mask-image-t-from-pos":[{"mask-t-from":H()}],"mask-image-t-to-pos":[{"mask-t-to":H()}],"mask-image-t-from-color":[{"mask-t-from":P()}],"mask-image-t-to-color":[{"mask-t-to":P()}],"mask-image-r-from-pos":[{"mask-r-from":H()}],"mask-image-r-to-pos":[{"mask-r-to":H()}],"mask-image-r-from-color":[{"mask-r-from":P()}],"mask-image-r-to-color":[{"mask-r-to":P()}],"mask-image-b-from-pos":[{"mask-b-from":H()}],"mask-image-b-to-pos":[{"mask-b-to":H()}],"mask-image-b-from-color":[{"mask-b-from":P()}],"mask-image-b-to-color":[{"mask-b-to":P()}],"mask-image-l-from-pos":[{"mask-l-from":H()}],"mask-image-l-to-pos":[{"mask-l-to":H()}],"mask-image-l-from-color":[{"mask-l-from":P()}],"mask-image-l-to-color":[{"mask-l-to":P()}],"mask-image-x-from-pos":[{"mask-x-from":H()}],"mask-image-x-to-pos":[{"mask-x-to":H()}],"mask-image-x-from-color":[{"mask-x-from":P()}],"mask-image-x-to-color":[{"mask-x-to":P()}],"mask-image-y-from-pos":[{"mask-y-from":H()}],"mask-image-y-to-pos":[{"mask-y-to":H()}],"mask-image-y-from-color":[{"mask-y-from":P()}],"mask-image-y-to-color":[{"mask-y-to":P()}],"mask-image-radial":[{"mask-radial":[Y,J]}],"mask-image-radial-from-pos":[{"mask-radial-from":H()}],"mask-image-radial-to-pos":[{"mask-radial-to":H()}],"mask-image-radial-from-color":[{"mask-radial-from":P()}],"mask-image-radial-to-color":[{"mask-radial-to":P()}],"mask-image-radial-shape":[{"mask-radial":[`circle`,`ellipse`]}],"mask-image-radial-size":[{"mask-radial":[{closest:[`side`,`corner`],farthest:[`side`,`corner`]}]}],"mask-image-radial-pos":[{"mask-radial-at":b()}],"mask-image-conic-pos":[{"mask-conic":[Zh]}],"mask-image-conic-from-pos":[{"mask-conic-from":H()}],"mask-image-conic-to-pos":[{"mask-conic-to":H()}],"mask-image-conic-from-color":[{"mask-conic-from":P()}],"mask-image-conic-to-color":[{"mask-conic-to":P()}],"mask-mode":[{mask:[`alpha`,`luminance`,`match`]}],"mask-origin":[{"mask-origin":[`border`,`padding`,`content`,`fill`,`stroke`,`view`]}],"mask-position":[{mask:F()}],"mask-repeat":[{mask:I()}],"mask-size":[{mask:L()}],"mask-type":[{"mask-type":[`alpha`,`luminance`]}],"mask-image":[{mask:[`none`,Y,J]}],filter:[{filter:[``,`none`,Y,J]}],blur:[{blur:te()}],brightness:[{brightness:[Zh,Y,J]}],contrast:[{contrast:[Zh,Y,J]}],"drop-shadow":[{"drop-shadow":[``,`none`,p,vg,fg]}],"drop-shadow-color":[{"drop-shadow":P()}],grayscale:[{grayscale:[``,Zh,Y,J]}],"hue-rotate":[{"hue-rotate":[Zh,Y,J]}],invert:[{invert:[``,Zh,Y,J]}],saturate:[{saturate:[Zh,Y,J]}],sepia:[{sepia:[``,Zh,Y,J]}],"backdrop-filter":[{"backdrop-filter":[``,`none`,Y,J]}],"backdrop-blur":[{"backdrop-blur":te()}],"backdrop-brightness":[{"backdrop-brightness":[Zh,Y,J]}],"backdrop-contrast":[{"backdrop-contrast":[Zh,Y,J]}],"backdrop-grayscale":[{"backdrop-grayscale":[``,Zh,Y,J]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[Zh,Y,J]}],"backdrop-invert":[{"backdrop-invert":[``,Zh,Y,J]}],"backdrop-opacity":[{"backdrop-opacity":[Zh,Y,J]}],"backdrop-saturate":[{"backdrop-saturate":[Zh,Y,J]}],"backdrop-sepia":[{"backdrop-sepia":[``,Zh,Y,J]}],"border-collapse":[{border:[`collapse`,`separate`]}],"border-spacing":[{"border-spacing":w()}],"border-spacing-x":[{"border-spacing-x":w()}],"border-spacing-y":[{"border-spacing-y":w()}],"table-layout":[{table:[`auto`,`fixed`]}],caption:[{caption:[`top`,`bottom`]}],transition:[{transition:[``,`all`,`colors`,`opacity`,`shadow`,`transform`,`none`,Y,J]}],"transition-behavior":[{transition:[`normal`,`discrete`]}],duration:[{duration:[Zh,`initial`,Y,J]}],ease:[{ease:[`linear`,`initial`,_,Y,J]}],delay:[{delay:[Zh,Y,J]}],animate:[{animate:[`none`,v,Y,J]}],backface:[{backface:[`hidden`,`visible`]}],perspective:[{perspective:[h,Y,J]}],"perspective-origin":[{"perspective-origin":x()}],rotate:[{rotate:U()}],"rotate-x":[{"rotate-x":U()}],"rotate-y":[{"rotate-y":U()}],"rotate-z":[{"rotate-z":U()}],scale:[{scale:ne()}],"scale-x":[{"scale-x":ne()}],"scale-y":[{"scale-y":ne()}],"scale-z":[{"scale-z":ne()}],"scale-3d":[`scale-3d`],skew:[{skew:re()}],"skew-x":[{"skew-x":re()}],"skew-y":[{"skew-y":re()}],transform:[{transform:[Y,J,``,`none`,`gpu`,`cpu`]}],"transform-origin":[{origin:x()}],"transform-style":[{transform:[`3d`,`flat`]}],translate:[{translate:ie()}],"translate-x":[{"translate-x":ie()}],"translate-y":[{"translate-y":ie()}],"translate-z":[{"translate-z":ie()}],"translate-none":[`translate-none`],accent:[{accent:P()}],appearance:[{appearance:[`none`,`auto`]}],"caret-color":[{caret:P()}],"color-scheme":[{scheme:[`normal`,`dark`,`light`,`light-dark`,`only-dark`,`only-light`]}],cursor:[{cursor:[`auto`,`default`,`pointer`,`wait`,`text`,`move`,`help`,`not-allowed`,`none`,`context-menu`,`progress`,`cell`,`crosshair`,`vertical-text`,`alias`,`copy`,`no-drop`,`grab`,`grabbing`,`all-scroll`,`col-resize`,`row-resize`,`n-resize`,`e-resize`,`s-resize`,`w-resize`,`ne-resize`,`nw-resize`,`se-resize`,`sw-resize`,`ew-resize`,`ns-resize`,`nesw-resize`,`nwse-resize`,`zoom-in`,`zoom-out`,Y,J]}],"field-sizing":[{"field-sizing":[`fixed`,`content`]}],"pointer-events":[{"pointer-events":[`auto`,`none`]}],resize:[{resize:[`none`,``,`y`,`x`]}],"scroll-behavior":[{scroll:[`auto`,`smooth`]}],"scroll-m":[{"scroll-m":w()}],"scroll-mx":[{"scroll-mx":w()}],"scroll-my":[{"scroll-my":w()}],"scroll-ms":[{"scroll-ms":w()}],"scroll-me":[{"scroll-me":w()}],"scroll-mt":[{"scroll-mt":w()}],"scroll-mr":[{"scroll-mr":w()}],"scroll-mb":[{"scroll-mb":w()}],"scroll-ml":[{"scroll-ml":w()}],"scroll-p":[{"scroll-p":w()}],"scroll-px":[{"scroll-px":w()}],"scroll-py":[{"scroll-py":w()}],"scroll-ps":[{"scroll-ps":w()}],"scroll-pe":[{"scroll-pe":w()}],"scroll-pt":[{"scroll-pt":w()}],"scroll-pr":[{"scroll-pr":w()}],"scroll-pb":[{"scroll-pb":w()}],"scroll-pl":[{"scroll-pl":w()}],"snap-align":[{snap:[`start`,`end`,`center`,`align-none`]}],"snap-stop":[{snap:[`normal`,`always`]}],"snap-type":[{snap:[`none`,`x`,`y`,`both`]}],"snap-strictness":[{snap:[`mandatory`,`proximity`]}],touch:[{touch:[`auto`,`none`,`manipulation`]}],"touch-x":[{"touch-pan":[`x`,`left`,`right`]}],"touch-y":[{"touch-pan":[`y`,`up`,`down`]}],"touch-pz":[`touch-pinch-zoom`],select:[{select:[`none`,`text`,`all`,`auto`]}],"will-change":[{"will-change":[`auto`,`scroll`,`contents`,`transform`,Y,J]}],fill:[{fill:[`none`,...P()]}],"stroke-w":[{stroke:[Zh,pg,cg,lg]}],stroke:[{stroke:[`none`,...P()]}],"forced-color-adjust":[{"forced-color-adjust":[`auto`,`none`]}]},conflictingClassGroups:{overflow:[`overflow-x`,`overflow-y`],overscroll:[`overscroll-x`,`overscroll-y`],inset:[`inset-x`,`inset-y`,`start`,`end`,`top`,`right`,`bottom`,`left`],"inset-x":[`right`,`left`],"inset-y":[`top`,`bottom`],flex:[`basis`,`grow`,`shrink`],gap:[`gap-x`,`gap-y`],p:[`px`,`py`,`ps`,`pe`,`pt`,`pr`,`pb`,`pl`],px:[`pr`,`pl`],py:[`pt`,`pb`],m:[`mx`,`my`,`ms`,`me`,`mt`,`mr`,`mb`,`ml`],mx:[`mr`,`ml`],my:[`mt`,`mb`],size:[`w`,`h`],"font-size":[`leading`],"fvn-normal":[`fvn-ordinal`,`fvn-slashed-zero`,`fvn-figure`,`fvn-spacing`,`fvn-fraction`],"fvn-ordinal":[`fvn-normal`],"fvn-slashed-zero":[`fvn-normal`],"fvn-figure":[`fvn-normal`],"fvn-spacing":[`fvn-normal`],"fvn-fraction":[`fvn-normal`],"line-clamp":[`display`,`overflow`],rounded:[`rounded-s`,`rounded-e`,`rounded-t`,`rounded-r`,`rounded-b`,`rounded-l`,`rounded-ss`,`rounded-se`,`rounded-ee`,`rounded-es`,`rounded-tl`,`rounded-tr`,`rounded-br`,`rounded-bl`],"rounded-s":[`rounded-ss`,`rounded-es`],"rounded-e":[`rounded-se`,`rounded-ee`],"rounded-t":[`rounded-tl`,`rounded-tr`],"rounded-r":[`rounded-tr`,`rounded-br`],"rounded-b":[`rounded-br`,`rounded-bl`],"rounded-l":[`rounded-tl`,`rounded-bl`],"border-spacing":[`border-spacing-x`,`border-spacing-y`],"border-w":[`border-w-x`,`border-w-y`,`border-w-s`,`border-w-e`,`border-w-t`,`border-w-r`,`border-w-b`,`border-w-l`],"border-w-x":[`border-w-r`,`border-w-l`],"border-w-y":[`border-w-t`,`border-w-b`],"border-color":[`border-color-x`,`border-color-y`,`border-color-s`,`border-color-e`,`border-color-t`,`border-color-r`,`border-color-b`,`border-color-l`],"border-color-x":[`border-color-r`,`border-color-l`],"border-color-y":[`border-color-t`,`border-color-b`],translate:[`translate-x`,`translate-y`,`translate-none`],"translate-none":[`translate`,`translate-x`,`translate-y`,`translate-z`],"scroll-m":[`scroll-mx`,`scroll-my`,`scroll-ms`,`scroll-me`,`scroll-mt`,`scroll-mr`,`scroll-mb`,`scroll-ml`],"scroll-mx":[`scroll-mr`,`scroll-ml`],"scroll-my":[`scroll-mt`,`scroll-mb`],"scroll-p":[`scroll-px`,`scroll-py`,`scroll-ps`,`scroll-pe`,`scroll-pt`,`scroll-pr`,`scroll-pb`,`scroll-pl`],"scroll-px":[`scroll-pr`,`scroll-pl`],"scroll-py":[`scroll-pt`,`scroll-pb`],touch:[`touch-x`,`touch-y`,`touch-pz`],"touch-x":[`touch`],"touch-y":[`touch`],"touch-pz":[`touch`]},conflictingClassGroupModifiers:{"font-size":[`leading`]},orderSensitiveModifiers:[`*`,`**`,`after`,`backdrop`,`before`,`details-content`,`file`,`first-letter`,`first-line`,`marker`,`placeholder`,`selection`]}});function kg(...e){return Og(ch(e))}var Ag=360;function jg(e){let t=0;for(let n=0;n<e.length;n++){let r=e.charCodeAt(n);t=(t<<5)-t+r,t&=t}return Math.abs(t)}function Mg(e){return{"--badge-hue":`${jg(e)%Ag}`}}function Ng({name:e,fullPath:t,className:n=``}){let r=Mg(e);return(0,G.jsx)(`span`,{className:kg(`project-badge inline-flex items-center rounded-full px-1.5 py-0.5 text-[10px] font-medium leading-none`,n),style:r,title:t,children:e})}var Pg=6e4,Fg=new Map,Ig=new Map,Lg=new Map,Rg=new Set;function zg(e){let t=Fg.get(e);return t&&Date.now()-t.at<Pg?t.info:void 0}var Bg=`inline-flex items-center gap-1 rounded-full px-1.5 py-0.5 text-[11px] tabular-nums`,Vg=`inline-block h-1.5 w-1.5 rounded-full`;function Hg(e){if(!e||e.error||!e.state||e.isDraft)return`bg-muted`;switch(e.state){case`OPEN`:return`bg-green-500`;case`MERGED`:return`bg-purple-500`;case`CLOSED`:return`bg-red-500`;default:return`bg-muted`}}function Ug(e){return!e||!e.state?``:e.isDraft&&e.state===`OPEN`?`Draft`:e.state.charAt(0)+e.state.slice(1).toLowerCase()}var Wg=new Set([`SKIPPED`,`NEUTRAL`,`STALE`]);function Gg(e){return e.status===`COMPLETED`?e.conclusion===`SUCCESS`?{glyph:`✓`,cls:`text-green-500`}:e.conclusion&&Wg.has(e.conclusion)?{glyph:`–`,cls:`text-muted`}:{glyph:`✗`,cls:`text-red-500`}:{glyph:`…`,cls:`text-yellow-500`}}async function Kg(e){let t=e.filter(e=>!zg(e)&&!Lg.has(e));if(t.length>0){let e=fetch(`/api/pr-info`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({urls:t})}).then(e=>e.json()).then(e=>{for(let t of e)t.error||Fg.set(t.url,{at:Date.now(),info:t})}).catch(()=>{}).finally(()=>{t.forEach(e=>Lg.delete(e))});t.forEach(t=>Lg.set(t,e))}return await Promise.all(e.map(e=>Lg.get(e))),e.map(e=>zg(e)).filter(Boolean)}var qg=250,Jg=200,Yg=3,Xg=8;function Zg(e,t){let[n,r]=(0,x.useState)(!1),[i,a]=(0,x.useState)(null),o=(0,x.useRef)(void 0),s=(0,x.useRef)(void 0),c=(0,x.useRef)(null),l=(0,x.useCallback)(()=>{window.clearTimeout(o.current),o.current=void 0},[]),u=(0,x.useCallback)(()=>{window.clearTimeout(s.current),s.current=void 0},[]),d=(0,x.useCallback)(()=>{l(),u(),s.current=window.setTimeout(()=>r(!1),Jg)},[l,u]),f=(0,x.useCallback)(()=>{l(),u();let n=e.current?.getBoundingClientRect();if(n){let e=n.top-Xg,r=window.innerHeight-n.bottom-Xg,i=Math.max(Xg,Math.min(n.left,window.innerWidth-t-Xg)),o=e=>Math.max(60,e-Yg);a(e>=r?{left:i,bottom:window.innerHeight-n.top+Yg,maxHeight:o(e)}:{left:i,top:n.bottom+Yg,maxHeight:o(r)})}r(!0)},[e,l,u,t]),p=(0,x.useCallback)(()=>{u(),!n&&(l(),o.current=window.setTimeout(f,qg))},[u,l,n,f]);return(0,x.useEffect)(()=>{if(!n)return;let e=e=>{c.current?.contains(e.target)||r(!1)},t=()=>r(!1);return window.addEventListener(`scroll`,e,!0),window.addEventListener(`resize`,t),()=>{window.removeEventListener(`scroll`,e,!0),window.removeEventListener(`resize`,t)}},[n]),(0,x.useEffect)(()=>()=>{l(),u()},[l,u]),{open:n,pos:i,scheduleOpen:p,scheduleClose:d,cancelClose:u,cardRef:c}}function Qg({pr:e,refreshKey:t,pillClass:n=Bg}){let[r,i]=(0,x.useState)(zg(e.url)),[a,o]=(0,x.useState)(Ig.get(e.url)),s=(0,x.useRef)(null),{open:c,pos:l,scheduleOpen:u,scheduleClose:d,cancelClose:f,cardRef:p}=Zg(s,256),m=(0,x.useRef)(!0);(0,x.useEffect)(()=>(m.current=!0,()=>{m.current=!1}),[]),(0,x.useEffect)(()=>{let t=zg(e.url);if(t){i(e=>e??t);return}Kg([e.url]).then(t=>{let n=t.find(t=>t.url===e.url);m.current&&n&&i(n)})},[e.url,t]),(0,x.useEffect)(()=>{!c||Ig.has(e.url)||Rg.has(e.url)||(Rg.add(e.url),fetch(`/api/pr-checks?url=${encodeURIComponent(e.url)}`).then(e=>e.ok?e.json():null).then(t=>{t&&Ig.set(e.url,t),m.current&&t&&o(t)}).catch(()=>{}).finally(()=>Rg.delete(e.url)))},[c,e.url]);let h=a??r;return(0,G.jsxs)(`span`,{ref:s,className:`relative inline-flex shrink-0`,onMouseEnter:u,onMouseLeave:d,children:[(0,G.jsxs)(`a`,{href:e.url,target:`_blank`,rel:`noreferrer`,onClick:e=>e.stopPropagation(),className:`${n} bg-elevated text-muted hover:text-accent`,"aria-label":`${e.repo}#${e.number}`,children:[(0,G.jsx)(`span`,{className:`${Vg} ${Hg(h)}`}),`#`,e.number]}),c&&l&&(0,re.createPortal)((0,G.jsxs)(`div`,{ref:p,className:`fixed z-[100] flex w-64 flex-col rounded-md border border-border bg-elevated p-2 text-left shadow-lg`,style:{left:l.left,top:l.top,bottom:l.bottom,maxHeight:l.maxHeight},onMouseEnter:f,onMouseLeave:d,onClick:e=>e.stopPropagation(),children:[(0,G.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1.5 text-[11px]`,children:[(0,G.jsx)(`span`,{className:Hg(h)+` inline-block h-1.5 w-1.5 shrink-0 rounded-full`}),(0,G.jsx)(`span`,{className:`text-muted`,children:Ug(h)||`PR`}),(0,G.jsx)(`span`,{className:`text-muted`,children:`·`}),(0,G.jsxs)(`a`,{href:e.url,target:`_blank`,rel:`noreferrer`,className:`truncate text-muted hover:text-accent`,children:[e.repo,`#`,e.number]})]}),h?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noreferrer`,className:`mt-1 block shrink-0 text-xs text-primary hover:text-accent`,children:h.title??`(title unavailable)`}),(0,G.jsx)(`div`,{className:`mt-0.5 shrink-0 text-[11px] text-muted`,children:h.author?`by ${h.author}`:``}),a?.checks&&a.checks.length>0&&(0,G.jsx)(`div`,{className:`mt-1.5 max-h-32 min-h-0 space-y-0.5 overflow-y-auto border-t border-border pt-1.5`,children:a.checks.map((e,t)=>{let n=Gg(e),r=(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`span`,{className:n.cls,children:n.glyph}),(0,G.jsx)(`span`,{className:`truncate text-muted group-hover:text-accent`,children:e.name})]});return e.link?(0,G.jsx)(`a`,{href:e.link,target:`_blank`,rel:`noreferrer`,className:`group flex items-center gap-1.5 text-[11px]`,children:r},t):(0,G.jsx)(`div`,{className:`group flex items-center gap-1.5 text-[11px]`,children:r},t)})})]}):(0,G.jsxs)(`div`,{className:`mt-1 shrink-0 space-y-1`,children:[(0,G.jsx)(`div`,{className:`h-3 w-3/4 animate-pulse rounded bg-border`}),(0,G.jsx)(`div`,{className:`h-3 w-1/2 animate-pulse rounded bg-border`})]})]}),document.body)]})}function $g({prs:e,pillClass:t=Bg}){let[n,r]=(0,x.useState)(null),i=(0,x.useRef)(null),{open:a,pos:o,scheduleOpen:s,scheduleClose:c,cancelClose:l,cardRef:u}=Zg(i,224);return(0,x.useEffect)(()=>{!a||n&&e.every(e=>n.has(e.url))||Kg(e.map(e=>e.url)).then(e=>{r(t=>{let n=new Map(t??[]);for(let t of e)n.set(t.url,t);return n})})},[a,n,e]),(0,G.jsxs)(`span`,{ref:i,className:`relative inline-flex shrink-0`,onMouseEnter:s,onMouseLeave:c,children:[(0,G.jsxs)(`span`,{className:`${t} cursor-default text-muted`,"aria-label":`${e.length} more PR${e.length===1?``:`s`}`,children:[`+`,e.length]}),a&&o&&(0,re.createPortal)((0,G.jsxs)(`div`,{ref:u,className:`fixed z-[100] flex w-56 flex-col rounded-md border border-border bg-elevated p-2 text-left shadow-lg`,style:{left:o.left,top:o.top,bottom:o.bottom,maxHeight:o.maxHeight},onMouseEnter:l,onMouseLeave:c,onClick:e=>e.stopPropagation(),children:[(0,G.jsxs)(`div`,{className:`shrink-0 text-[11px] text-muted`,children:[e.length,` more PR`,e.length===1?``:`s`]}),(0,G.jsx)(`div`,{className:`mt-1 max-h-48 min-h-0 space-y-0.5 overflow-y-auto border-t border-border pt-1.5`,children:e.map(e=>(0,G.jsxs)(`a`,{href:e.url,target:`_blank`,rel:`noreferrer`,className:`flex items-center gap-1.5 text-[11px] text-secondary hover:text-accent`,children:[(0,G.jsx)(`span`,{className:`inline-block h-1.5 w-1.5 shrink-0 rounded-full ${Hg(n?.get(e.url))}`}),(0,G.jsxs)(`span`,{className:`tabular-nums`,children:[`#`,e.number]}),(0,G.jsx)(`span`,{className:`truncate text-muted`,children:e.repo})]},e.url))})]}),document.body)]})}function e_({prs:e,className:t=`pl-[1.375rem]`,pillClass:n=Bg}){let r=(0,x.useRef)(null),i=(0,x.useRef)([]),a=(0,x.useRef)(null),o=(0,x.useRef)(null),s=(0,x.useMemo)(()=>[...e].reverse(),[e]),[c,l]=(0,x.useState)(s.length),[u,d]=(0,x.useState)(0);(0,x.useEffect)(()=>{let e=()=>{document.visibilityState===`visible`&&d(e=>e+1)};return document.addEventListener?.(`visibilitychange`,e),()=>document.removeEventListener?.(`visibilitychange`,e)},[]);let f=(0,x.useCallback)(()=>{let e=s.length,t=r.current;if(!t||typeof t.clientWidth!=`number`||t.clientWidth===0){l(e);return}let n=getComputedStyle(t),c=t.clientWidth-(parseFloat(n.paddingLeft)||0)-(parseFloat(n.paddingRight)||0),u=parseFloat(n.columnGap)||0,d=a.current?.offsetWidth??0,f=Math.max(0,(o.current?.offsetWidth??d)-d),p=e=>d+String(e).length*f,m=0,h=0;for(let t=0;t<e;t++){let n=i.current[t]?.offsetWidth??0,r=e-t-1,a=r>0?u+p(r):0,o=(h>0?u:0)+n+a;if(m+o>c)break;m+=o-a,h++}l(h)},[s]);if((0,x.useLayoutEffect)(()=>{f()},[f]),(0,x.useEffect)(()=>{let e=r.current;if(!e||typeof ResizeObserver>`u`)return window.addEventListener(`resize`,f),()=>window.removeEventListener(`resize`,f);let t=new ResizeObserver(f);return t.observe(e),()=>t.disconnect()},[f]),(0,x.useEffect)(()=>{document.fonts?.ready.then(f).catch(()=>{})},[f]),s.length===0)return null;let p=s.slice(0,c),m=s.slice(c);return(0,G.jsxs)(`div`,{ref:r,className:`relative flex flex-nowrap items-center gap-1 overflow-hidden ${t}`,children:[p.map(e=>(0,G.jsx)(Qg,{pr:e,refreshKey:u,pillClass:n},e.url)),m.length>0&&(0,G.jsx)($g,{prs:m,pillClass:n}),(0,G.jsxs)(`span`,{"aria-hidden":!0,className:`invisible absolute left-0 top-0 flex flex-nowrap`,children:[s.map((e,t)=>(0,G.jsxs)(`span`,{ref:e=>{i.current[t]=e},className:n,children:[(0,G.jsx)(`span`,{className:Vg}),`#`,e.number]},e.url)),(0,G.jsx)(`span`,{ref:a,className:n,children:`+`}),(0,G.jsx)(`span`,{ref:o,className:n,children:`+0`})]})]})}var t_=(0,x.memo)(function({session:e,showSessionIdPrefix:t,showProjectName:n,showLastUserMessage:r,onResume:i,onPreview:a}){let o=Im(e.lastActivityAt),s=Lm(e.projectPath),c=e.displayName||s||e.sessionId.slice(0,8),l=n&&!!s,u=r&&!!e.lastUserMessage,d=t?zm(e.sessionId):``,f=(0,x.useRef)(null),[p,m]=(0,x.useState)(null);return(0,x.useEffect)(()=>{if(!p)return;let e=e=>{f.current&&!f.current.contains(e.target)&&m(null)},t=e=>{e.key===`Escape`&&m(null)};return document.addEventListener(`mousedown`,e),document.addEventListener(`touchstart`,e),document.addEventListener(`keydown`,t),()=>{document.removeEventListener(`mousedown`,e),document.removeEventListener(`touchstart`,e),document.removeEventListener(`keydown`,t)}},[p]),(0,G.jsxs)(`div`,{className:`group relative cursor-pointer px-3 py-2 hover:bg-hover`,role:`button`,tabIndex:0,title:`Click to preview`,onClick:()=>a(e),onKeyDown:t=>{(t.key===`Enter`||t.key===` `)&&(t.preventDefault(),a(e))},onContextMenu:e=>{e.preventDefault(),e.stopPropagation(),m({x:e.clientX,y:e.clientY})},children:[(0,G.jsx)(`button`,{type:`button`,className:`absolute right-3 top-1/2 -translate-y-1/2 text-xs text-muted opacity-0 hover:text-primary group-hover:opacity-100`,title:`Wake directly`,onClick:t=>{t.stopPropagation(),i(e.sessionId)},children:`▶`}),(0,G.jsxs)(`div`,{className:`flex flex-col gap-0.5 pl-2.5 group-hover:pr-4`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(oh,{agentType:e.agentType,className:`h-3.5 w-3.5 shrink-0 text-muted`}),(0,G.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-sm font-medium text-primary`,children:c}),e.lastResumeError&&(0,G.jsx)(ae,{className:`h-3 w-3 shrink-0 text-amber-500`,"aria-label":`Wake failed`,title:`Last wake failed: ${e.lastResumeError}`}),d&&(0,G.jsx)(`span`,{className:`shrink-0 text-[11px] font-mono text-muted`,title:e.sessionId,children:d}),(0,G.jsx)(`span`,{className:`ml-1 w-8 shrink-0 text-right text-xs tabular-nums text-muted`,children:o})]}),(l||u)&&(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1 pl-[1.375rem]`,children:[l&&(0,G.jsx)(Ng,{name:s,fullPath:e.projectPath}),u&&(0,G.jsxs)(`span`,{className:`truncate text-xs italic text-muted`,children:[`"`,e.lastUserMessage.length>200?e.lastUserMessage.slice(0,200)+`…`:e.lastUserMessage,`"`]})]}),e.prs&&e.prs.length>0&&(0,G.jsx)(e_,{prs:e.prs})]}),p&&(0,G.jsx)(`div`,{ref:f,className:`fixed z-50 min-w-[160px] rounded-md border border-border bg-elevated shadow-lg py-1`,style:{left:p.x,top:p.y},role:`menu`,children:e.logFilePath&&(0,G.jsxs)(`button`,{onClick:t=>{t.stopPropagation(),m(null),e.logFilePath&&Bm(e.logFilePath)},className:`w-full px-3 py-2 text-left text-sm text-secondary hover:bg-hover hover:text-primary flex items-center gap-2`,role:`menuitem`,title:e.logFilePath,children:[(0,G.jsx)(ve,{width:14,height:14}),`Copy Log Path`]})})]})});function n_({name:e,className:t=``}){let n=Mg(`host:${e}`);return(0,G.jsx)(`span`,{className:kg(`inline-flex items-center rounded-full px-1.5 py-0.5 text-[10px] font-medium uppercase leading-none tracking-wide`,t),style:n,title:e,children:e})}function r_({hosts:e,selectedHosts:t,onSelect:n,statuses:r=[]}){let[i,a]=(0,x.useState)(!1),o=(0,x.useId)(),s=(0,x.useRef)(null),c=(0,x.useMemo)(()=>new Set(t),[t]),l=(0,x.useMemo)(()=>new Map(r.map(e=>[e.host,e])),[r]),u=(0,x.useMemo)(()=>t.length===0?`All Hosts`:t.join(`, `),[t]),d=(0,x.useMemo)(()=>t.length===0?`All Hosts`:t.length===1?t[0]:`${t.length} hosts`,[t]);(0,x.useEffect)(()=>{if(!i||typeof document>`u`||!document.addEventListener||!document.removeEventListener)return;let e=e=>{let t=e.target;t&&s.current?.contains(t)||a(!1)},t=e=>{e.key===`Escape`&&a(!1)};return document.addEventListener(`mousedown`,e),document.addEventListener(`touchstart`,e,{passive:!0}),document.addEventListener(`keydown`,t),()=>{document.removeEventListener(`mousedown`,e),document.removeEventListener(`touchstart`,e),document.removeEventListener(`keydown`,t)}},[i]);let f=t=>{let r=new Set(c);r.has(t)?r.delete(t):r.add(t),n(e.filter(e=>r.has(e)))};return(0,G.jsxs)(`div`,{ref:s,className:`relative`,children:[(0,G.jsxs)(`button`,{type:`button`,"aria-haspopup":`menu`,"aria-expanded":i,"aria-controls":o,"aria-label":`Filter by host`,onClick:()=>a(e=>!e),className:`flex h-6 max-w-[9rem] items-center gap-1.5 rounded border border-border bg-base px-2 text-[11px] text-primary hover:bg-hover focus:border-accent focus:outline-none`,title:u,children:[(0,G.jsx)(Ie,{className:`h-3.5 w-3.5 shrink-0`}),(0,G.jsx)(`span`,{className:`truncate leading-none`,children:d}),(0,G.jsx)(oe,{className:`h-3 w-3 shrink-0 text-muted`})]}),i&&(0,G.jsxs)(`div`,{id:o,role:`menu`,className:`absolute left-0 z-20 mt-1 w-48 max-w-[calc(100vw-1.5rem)] rounded border border-border bg-surface p-2 text-xs shadow-lg`,children:[(0,G.jsxs)(`label`,{role:`menuitemcheckbox`,"aria-checked":t.length===0,className:`flex cursor-pointer items-center gap-2 rounded px-2 py-1.5 text-primary hover:bg-hover`,children:[(0,G.jsx)(`input`,{type:`checkbox`,checked:t.length===0,onChange:()=>n([]),className:`h-3.5 w-3.5 accent-approval`}),(0,G.jsx)(`span`,{children:`All Hosts`})]}),(0,G.jsx)(`div`,{className:`my-2 h-px bg-border`}),e.length===0?(0,G.jsx)(`div`,{className:`px-2 py-1 text-muted`,children:`No hosts`}):(0,G.jsx)(`div`,{className:`max-h-48 overflow-y-auto pr-1`,children:e.map(e=>{let t=l.get(e),n=t?!t.ok:!1;return(0,G.jsxs)(`label`,{role:`menuitemcheckbox`,"aria-checked":c.has(e),className:`flex cursor-pointer items-center gap-2 rounded px-2 py-1.5 text-primary hover:bg-hover`,title:t?.error?`${e}: ${t.error}`:e,children:[(0,G.jsx)(`input`,{type:`checkbox`,checked:c.has(e),onChange:()=>f(e),className:`h-3.5 w-3.5 accent-approval`}),(0,G.jsx)(`span`,{className:`truncate`,children:e}),n&&(0,G.jsx)(`span`,{className:`ml-auto text-[10px] uppercase text-danger`,children:`offline`})]},e)})})]})]})}function i_({projects:e,selectedProjects:t,onSelect:n,hasHiddenPermissions:r}){let[i,a]=(0,x.useState)(!1),o=(0,x.useId)(),s=(0,x.useRef)(null),c=(0,x.useMemo)(()=>Rm(e),[e]),l=(0,x.useMemo)(()=>new Set(t),[t]),u=r&&t.length>0,d=(0,x.useMemo)(()=>t.length===0?`All Projects`:t.map(e=>c.get(e)??Lm(e)??e).join(`, `),[c,t]),f=(0,x.useMemo)(()=>{if(t.length===0)return`All Projects`;if(t.length===1){let e=t[0];return c.get(e)??Lm(e)??e}return`${t.length} projects`},[c,t]);(0,x.useEffect)(()=>{if(!i||typeof document>`u`||!document.addEventListener||!document.removeEventListener)return;let e=e=>{let t=e.target;t&&s.current?.contains(t)||a(!1)},t=e=>{e.key===`Escape`&&a(!1)};return document.addEventListener(`mousedown`,e),document.addEventListener(`touchstart`,e,{passive:!0}),document.addEventListener(`keydown`,t),()=>{document.removeEventListener(`mousedown`,e),document.removeEventListener(`touchstart`,e),document.removeEventListener(`keydown`,t)}},[i]);let p=t=>{let r=new Set(l);r.has(t)?r.delete(t):r.add(t),n(e.filter(e=>r.has(e)))};return(0,G.jsxs)(`div`,{ref:s,className:`relative`,children:[(0,G.jsxs)(`button`,{type:`button`,"aria-haspopup":`menu`,"aria-expanded":i,"aria-controls":o,"aria-label":`Filter by project`,onClick:()=>a(e=>!e),className:`flex h-6 max-w-[11rem] items-center gap-1.5 rounded border border-border bg-base px-2 text-[11px] text-primary hover:bg-hover focus:border-accent focus:outline-none`,title:d,children:[(0,G.jsx)(be,{className:`h-3.5 w-3.5 shrink-0`}),(0,G.jsx)(`span`,{className:`truncate leading-none`,children:f}),(0,G.jsx)(oe,{className:`h-3 w-3 shrink-0 text-muted`})]}),i&&(0,G.jsxs)(`div`,{id:o,role:`menu`,className:`absolute left-0 z-20 mt-1 w-60 max-w-[calc(100vw-1.5rem)] rounded border border-border bg-surface p-2 text-xs shadow-lg`,children:[(0,G.jsxs)(`label`,{className:`flex cursor-pointer items-center gap-2 rounded px-2 py-1.5 text-primary hover:bg-hover`,children:[(0,G.jsx)(`input`,{type:`checkbox`,checked:t.length===0,onChange:()=>n([]),className:`h-3.5 w-3.5 accent-approval`}),(0,G.jsx)(`span`,{children:`All Projects`})]}),(0,G.jsx)(`div`,{className:`my-2 h-px bg-border`}),e.length===0?(0,G.jsx)(`div`,{className:`px-2 py-1 text-muted`,children:`No projects`}):(0,G.jsx)(`div`,{className:`max-h-48 overflow-y-auto pr-1`,children:e.map(e=>{let t=c.get(e)??Lm(e)??e;return(0,G.jsxs)(`label`,{className:`flex cursor-pointer items-center gap-2 rounded px-2 py-1.5 text-primary hover:bg-hover`,title:e,children:[(0,G.jsx)(`input`,{type:`checkbox`,checked:l.has(e),onChange:()=>p(e),className:`h-3.5 w-3.5 accent-approval`}),(0,G.jsx)(`span`,{className:`truncate`,children:t})]},e)})})]}),u&&(0,G.jsx)(`button`,{type:`button`,className:`absolute -right-1 -top-1 h-2 w-2 rounded-full bg-approval pulse-approval ring-2 ring-elevated`,title:`Hidden sessions need attention`,"aria-label":`Clear project filters`,onClick:e=>{e.stopPropagation(),n([])},children:(0,G.jsx)(`span`,{className:`sr-only`,children:`Clear project filters`})})]})}function a_(e){return!e||typeof e!=`object`||Array.isArray(e)?null:e}function o_(e){return typeof e==`string`?e:null}var s_=new Set([`tool_result`,`custom_tool_call_output`]),c_=new Set([`text`,`input_text`,`output_text`]);function l_(e){return e===`user`?`user`:e===`assistant`?`assistant`:e===`system`||e===`developer`?`system`:e===`tool`?`tool`:`other`}function u_(e){let t=o_(e.type)??``,n=a_(e.payload),r=o_(n?.type)??``,i=o_(e.source)??o_(n?.source)??``,a=o_(e.agent)??``;return i.toLowerCase()===`pi`||a.toLowerCase()===`pi`?`pi`:i.toLowerCase()===`devin`||a.toLowerCase()===`devin`?`devin`:i.toLowerCase()===`grok`||a.toLowerCase()===`grok`||e.synthetic_reason!==void 0||e.prompt_index!==void 0||e.model_fingerprint!==void 0||e.encrypted_content!==void 0?`grok`:t===`response_item`||t===`event_msg`?`codex`:t===`tool_use`||t===`result`||t===`user`||t===`assistant`||t===`system`?`claude`:r===`user_message`||r===`assistant_message`?`codex`:`unknown`}function d_(e){let t=o_(a_(e.payload)?.type);return{family:u_(e),rawType:o_(e.type)??`unknown`,...t?{payloadType:t}:{}}}function f_(e){if(!e)return[];if(typeof e==`string`)return e.trim()?[e]:[];if(Array.isArray(e)){let t=[];for(let n of e){if(typeof n==`string`){n.trim()&&t.push(n);continue}let e=a_(n);if(!e)continue;let r=o_(e.type);if(r&&s_.has(r)||r&&!c_.has(r))continue;let i=o_(e.text);i&&i.trim()&&t.push(i)}return t}let t=a_(e);if(t){let e=o_(t.type);if(e&&s_.has(e))return[];let n=o_(t.text);return n&&n.trim()?[n]:[...f_(t.content),...f_(t.message)]}return[]}function p_(e,t){if(e.type!==`response_item`)return[];let n=a_(e.payload);if(!n||n.type!==`message`)return[];let r=l_(n.role);return f_(n.content).map(e=>({kind:`message`,role:r,text:e,source:t}))}function m_(e,t){if(e.type!==`event_msg`)return[];let n=a_(e.payload);if(!n)return[];let r=o_(n.type),i=null;if(r===`user_message`?i=`user`:r===`assistant_message`||r===`agent_message`?i=`assistant`:r===`system_message`?i=`system`:r===`message`&&(i=l_(n.role)),!i||![`user`,`assistant`,`system`].includes(i))return[];let a=Array.from(new Set([...f_(n.message),...f_(n.content),...f_(n.text)]));return a.length===0?[]:a.map(e=>({kind:`message`,role:i,text:e,source:t}))}function h_(e,t){let n=l_(e.type),r=a_(e.message);if(r){let n=l_(r.role??e.type);return[...f_(r.content),...f_(r.text),...f_(r.message)].map(e=>({kind:`message`,role:n,text:e,source:t}))}return[`user`,`assistant`,`system`].includes(n)?[...f_(e.content),...f_(e.text)].map(e=>({kind:`message`,role:n,text:e,source:t})):[]}function g_(e,t){let n=l_(e.role);return[`user`,`assistant`,`system`].includes(n)?[...f_(e.content),...f_(e.message),...f_(e.text)].map(e=>({kind:`message`,role:n,text:e,source:t})):[]}function __(e,t){let n=o_(e.type),r=o_(e.event);return n!==`tool_use`&&r!==`tool_use`?[]:[{kind:`tool_call`,role:`assistant`,text:`[Tool: ${o_(e.name)??`tool`}]`,source:t}]}function v_(e,t){if(e.type!==`result`)return[];let n=o_(e.result);return!n||!n.trim()?[]:[{kind:`result`,role:`system`,text:n,source:t}]}function y_(e,t){let n=a_(e.payload),r=[...f_(e.message),...f_(e.content),...f_(e.text),...f_(n?.message),...f_(n?.content)];return r.length===0?[]:r.map(e=>({kind:`unknown`,role:`other`,text:e,source:t}))}function b_(e,t){let n=o_(e.type),r=o_(a_(e.payload)?.type);return n&&s_.has(n)||r&&s_.has(r)?[{kind:`tool_result`,role:`tool`,text:``,source:t}]:[]}function x_(e,t){let n=e.tool_calls;return t.family!==`grok`||!Array.isArray(n)?[]:n.map(e=>a_(e)).filter(e=>e!==null).map(e=>({kind:`tool_call`,role:`assistant`,text:`[Tool: ${o_(e.name)??`tool`}]`,source:t}))}function S_(e){let t=a_(e);if(!t||t.isMeta===!0||t.synthetic_reason!==void 0)return[];let n=d_(t),r=[...p_(t,n),...m_(t,n),...h_(t,n),...__(t,n),...v_(t,n),...b_(t,n),...x_(t,n)];if(r.length>0)return r;let i=g_(t,n);return i.length>0?i:y_(t,n)}function C_(e){let t=e.trim();if(!t)return null;try{let e=JSON.parse(t);return{parsed:!0,events:S_(e),raw:e}}catch{return{parsed:!1,events:[{kind:`unknown`,role:`other`,text:t,source:{family:`unknown`,rawType:`raw_text`}}],raw:e}}}function w_(e,t){let n=t||{};return(e[e.length-1]===``?[...e,``]:e).join((n.padRight?` `:``)+`,`+(n.padLeft===!1?``:` `)).trim()}var T_=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,E_=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,D_={};function O_(e,t){return((t||D_).jsx?E_:T_).test(e)}var k_=/[ \t\n\f\r]/g;function A_(e){return typeof e==`object`?e.type===`text`?j_(e.value):!1:j_(e)}function j_(e){return e.replace(k_,``)===``}var M_=class{constructor(e,t,n){this.normal=t,this.property=e,n&&(this.space=n)}};M_.prototype.normal={},M_.prototype.property={},M_.prototype.space=void 0;function N_(e,t){let n={},r={};for(let t of e)Object.assign(n,t.property),Object.assign(r,t.normal);return new M_(n,r,t)}function P_(e){return e.toLowerCase()}var F_=class{constructor(e,t){this.attribute=t,this.property=e}};F_.prototype.attribute=``,F_.prototype.booleanish=!1,F_.prototype.boolean=!1,F_.prototype.commaOrSpaceSeparated=!1,F_.prototype.commaSeparated=!1,F_.prototype.defined=!1,F_.prototype.mustUseProperty=!1,F_.prototype.number=!1,F_.prototype.overloadedBoolean=!1,F_.prototype.property=``,F_.prototype.spaceSeparated=!1,F_.prototype.space=void 0;var I_=c({boolean:()=>R_,booleanish:()=>z_,commaOrSpaceSeparated:()=>U_,commaSeparated:()=>H_,number:()=>X,overloadedBoolean:()=>B_,spaceSeparated:()=>V_}),L_=0,R_=W_(),z_=W_(),B_=W_(),X=W_(),V_=W_(),H_=W_(),U_=W_();function W_(){return 2**++L_}var G_=Object.keys(I_),K_=class extends F_{constructor(e,t,n,r){let i=-1;if(super(e,t),q_(this,`space`,r),typeof n==`number`)for(;++i<G_.length;){let e=G_[i];q_(this,G_[i],(n&I_[e])===I_[e])}}};K_.prototype.defined=!0;function q_(e,t,n){n&&(e[t]=n)}function J_(e){let t={},n={};for(let[r,i]of Object.entries(e.properties)){let a=new K_(r,e.transform(e.attributes||{},r),i,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(a.mustUseProperty=!0),t[r]=a,n[P_(r)]=r,n[P_(a.attribute)]=r}return new M_(t,n,e.space)}var Y_=J_({properties:{ariaActiveDescendant:null,ariaAtomic:z_,ariaAutoComplete:null,ariaBusy:z_,ariaChecked:z_,ariaColCount:X,ariaColIndex:X,ariaColSpan:X,ariaControls:V_,ariaCurrent:null,ariaDescribedBy:V_,ariaDetails:null,ariaDisabled:z_,ariaDropEffect:V_,ariaErrorMessage:null,ariaExpanded:z_,ariaFlowTo:V_,ariaGrabbed:z_,ariaHasPopup:null,ariaHidden:z_,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:V_,ariaLevel:X,ariaLive:null,ariaModal:z_,ariaMultiLine:z_,ariaMultiSelectable:z_,ariaOrientation:null,ariaOwns:V_,ariaPlaceholder:null,ariaPosInSet:X,ariaPressed:z_,ariaReadOnly:z_,ariaRelevant:null,ariaRequired:z_,ariaRoleDescription:V_,ariaRowCount:X,ariaRowIndex:X,ariaRowSpan:X,ariaSelected:z_,ariaSetSize:X,ariaSort:null,ariaValueMax:X,ariaValueMin:X,ariaValueNow:X,ariaValueText:null,role:null},transform(e,t){return t===`role`?t:`aria-`+t.slice(4).toLowerCase()}});function X_(e,t){return t in e?e[t]:t}function Z_(e,t){return X_(e,t.toLowerCase())}var Q_=J_({attributes:{acceptcharset:`accept-charset`,classname:`class`,htmlfor:`for`,httpequiv:`http-equiv`},mustUseProperty:[`checked`,`multiple`,`muted`,`selected`],properties:{abbr:null,accept:H_,acceptCharset:V_,accessKey:V_,action:null,allow:null,allowFullScreen:R_,allowPaymentRequest:R_,allowUserMedia:R_,alpha:R_,alt:null,as:null,async:R_,autoCapitalize:null,autoComplete:V_,autoFocus:R_,autoPlay:R_,blocking:V_,capture:null,charSet:null,checked:R_,cite:null,className:V_,closedBy:null,colorSpace:null,cols:X,colSpan:X,command:null,commandFor:null,content:null,contentEditable:z_,controls:R_,controlsList:V_,coords:X|H_,crossOrigin:null,data:null,dateTime:null,decoding:null,default:R_,defer:R_,dir:null,dirName:null,disabled:R_,download:B_,draggable:z_,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:R_,formTarget:null,headers:V_,height:X,hidden:B_,high:X,href:null,hrefLang:null,htmlFor:V_,httpEquiv:V_,id:null,imageSizes:null,imageSrcSet:null,inert:R_,inputMode:null,integrity:null,is:null,isMap:R_,itemId:null,itemProp:V_,itemRef:V_,itemScope:R_,itemType:V_,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:R_,low:X,manifest:null,max:null,maxLength:X,media:null,method:null,min:null,minLength:X,multiple:R_,muted:R_,name:null,nonce:null,noModule:R_,noValidate:R_,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:R_,optimum:X,pattern:null,ping:V_,placeholder:null,playsInline:R_,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:R_,referrerPolicy:null,rel:V_,required:R_,reversed:R_,rows:X,rowSpan:X,sandbox:V_,scope:null,scoped:R_,seamless:R_,selected:R_,shadowRootClonable:R_,shadowRootCustomElementRegistry:R_,shadowRootDelegatesFocus:R_,shadowRootMode:null,shadowRootSerializable:R_,shape:null,size:X,sizes:null,slot:null,span:X,spellCheck:z_,src:null,srcDoc:null,srcLang:null,srcSet:null,start:X,step:null,style:null,tabIndex:X,target:null,title:null,translate:null,type:null,typeMustMatch:R_,useMap:null,value:z_,width:X,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:V_,axis:null,background:null,bgColor:null,border:X,borderColor:null,bottomMargin:X,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:R_,declare:R_,event:null,face:null,frame:null,frameBorder:null,hSpace:X,leftMargin:X,link:null,longDesc:null,lowSrc:null,marginHeight:X,marginWidth:X,noResize:R_,noHref:R_,noShade:R_,noWrap:R_,object:null,profile:null,prompt:null,rev:null,rightMargin:X,rules:null,scheme:null,scrolling:z_,standby:null,summary:null,text:null,topMargin:X,valueType:null,version:null,vAlign:null,vLink:null,vSpace:X,allowTransparency:null,autoCorrect:null,autoSave:null,credentialless:R_,disablePictureInPicture:R_,disableRemotePlayback:R_,exportParts:H_,part:V_,prefix:null,property:null,results:X,security:null,unselectable:null},space:`html`,transform:Z_}),$_=J_({attributes:{accentHeight:`accent-height`,alignmentBaseline:`alignment-baseline`,arabicForm:`arabic-form`,baselineShift:`baseline-shift`,capHeight:`cap-height`,className:`class`,clipPath:`clip-path`,clipRule:`clip-rule`,colorInterpolation:`color-interpolation`,colorInterpolationFilters:`color-interpolation-filters`,colorProfile:`color-profile`,colorRendering:`color-rendering`,crossOrigin:`crossorigin`,dataType:`datatype`,dominantBaseline:`dominant-baseline`,enableBackground:`enable-background`,fillOpacity:`fill-opacity`,fillRule:`fill-rule`,floodColor:`flood-color`,floodOpacity:`flood-opacity`,fontFamily:`font-family`,fontSize:`font-size`,fontSizeAdjust:`font-size-adjust`,fontStretch:`font-stretch`,fontStyle:`font-style`,fontVariant:`font-variant`,fontWeight:`font-weight`,glyphName:`glyph-name`,glyphOrientationHorizontal:`glyph-orientation-horizontal`,glyphOrientationVertical:`glyph-orientation-vertical`,hrefLang:`hreflang`,horizAdvX:`horiz-adv-x`,horizOriginX:`horiz-origin-x`,horizOriginY:`horiz-origin-y`,imageRendering:`image-rendering`,letterSpacing:`letter-spacing`,lightingColor:`lighting-color`,markerEnd:`marker-end`,markerMid:`marker-mid`,markerStart:`marker-start`,maskType:`mask-type`,navDown:`nav-down`,navDownLeft:`nav-down-left`,navDownRight:`nav-down-right`,navLeft:`nav-left`,navNext:`nav-next`,navPrev:`nav-prev`,navRight:`nav-right`,navUp:`nav-up`,navUpLeft:`nav-up-left`,navUpRight:`nav-up-right`,onAbort:`onabort`,onActivate:`onactivate`,onAfterPrint:`onafterprint`,onBeforePrint:`onbeforeprint`,onBegin:`onbegin`,onCancel:`oncancel`,onCanPlay:`oncanplay`,onCanPlayThrough:`oncanplaythrough`,onChange:`onchange`,onClick:`onclick`,onClose:`onclose`,onCopy:`oncopy`,onCueChange:`oncuechange`,onCut:`oncut`,onDblClick:`ondblclick`,onDrag:`ondrag`,onDragEnd:`ondragend`,onDragEnter:`ondragenter`,onDragExit:`ondragexit`,onDragLeave:`ondragleave`,onDragOver:`ondragover`,onDragStart:`ondragstart`,onDrop:`ondrop`,onDurationChange:`ondurationchange`,onEmptied:`onemptied`,onEnd:`onend`,onEnded:`onended`,onError:`onerror`,onFocus:`onfocus`,onFocusIn:`onfocusin`,onFocusOut:`onfocusout`,onHashChange:`onhashchange`,onInput:`oninput`,onInvalid:`oninvalid`,onKeyDown:`onkeydown`,onKeyPress:`onkeypress`,onKeyUp:`onkeyup`,onLoad:`onload`,onLoadedData:`onloadeddata`,onLoadedMetadata:`onloadedmetadata`,onLoadStart:`onloadstart`,onMessage:`onmessage`,onMouseDown:`onmousedown`,onMouseEnter:`onmouseenter`,onMouseLeave:`onmouseleave`,onMouseMove:`onmousemove`,onMouseOut:`onmouseout`,onMouseOver:`onmouseover`,onMouseUp:`onmouseup`,onMouseWheel:`onmousewheel`,onOffline:`onoffline`,onOnline:`ononline`,onPageHide:`onpagehide`,onPageShow:`onpageshow`,onPaste:`onpaste`,onPause:`onpause`,onPlay:`onplay`,onPlaying:`onplaying`,onPopState:`onpopstate`,onProgress:`onprogress`,onRateChange:`onratechange`,onRepeat:`onrepeat`,onReset:`onreset`,onResize:`onresize`,onScroll:`onscroll`,onSeeked:`onseeked`,onSeeking:`onseeking`,onSelect:`onselect`,onShow:`onshow`,onStalled:`onstalled`,onStorage:`onstorage`,onSubmit:`onsubmit`,onSuspend:`onsuspend`,onTimeUpdate:`ontimeupdate`,onToggle:`ontoggle`,onUnload:`onunload`,onVolumeChange:`onvolumechange`,onWaiting:`onwaiting`,onZoom:`onzoom`,overlinePosition:`overline-position`,overlineThickness:`overline-thickness`,paintOrder:`paint-order`,panose1:`panose-1`,pointerEvents:`pointer-events`,referrerPolicy:`referrerpolicy`,renderingIntent:`rendering-intent`,shapeRendering:`shape-rendering`,stopColor:`stop-color`,stopOpacity:`stop-opacity`,strikethroughPosition:`strikethrough-position`,strikethroughThickness:`strikethrough-thickness`,strokeDashArray:`stroke-dasharray`,strokeDashOffset:`stroke-dashoffset`,strokeLineCap:`stroke-linecap`,strokeLineJoin:`stroke-linejoin`,strokeMiterLimit:`stroke-miterlimit`,strokeOpacity:`stroke-opacity`,strokeWidth:`stroke-width`,tabIndex:`tabindex`,textAnchor:`text-anchor`,textDecoration:`text-decoration`,textRendering:`text-rendering`,transformOrigin:`transform-origin`,typeOf:`typeof`,underlinePosition:`underline-position`,underlineThickness:`underline-thickness`,unicodeBidi:`unicode-bidi`,unicodeRange:`unicode-range`,unitsPerEm:`units-per-em`,vAlphabetic:`v-alphabetic`,vHanging:`v-hanging`,vIdeographic:`v-ideographic`,vMathematical:`v-mathematical`,vectorEffect:`vector-effect`,vertAdvY:`vert-adv-y`,vertOriginX:`vert-origin-x`,vertOriginY:`vert-origin-y`,wordSpacing:`word-spacing`,writingMode:`writing-mode`,xHeight:`x-height`,playbackOrder:`playbackorder`,timelineBegin:`timelinebegin`},properties:{about:U_,accentHeight:X,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:X,amplitude:X,arabicForm:null,ascent:X,attributeName:null,attributeType:null,azimuth:X,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:X,by:null,calcMode:null,capHeight:X,className:V_,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:X,diffuseConstant:X,direction:null,display:null,dur:null,divisor:X,dominantBaseline:null,download:R_,dx:null,dy:null,edgeMode:null,editable:null,elevation:X,enableBackground:null,end:null,event:null,exponent:X,externalResourcesRequired:null,fill:null,fillOpacity:X,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:H_,g2:H_,glyphName:H_,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:X,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:X,horizOriginX:X,horizOriginY:X,id:null,ideographic:X,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:X,k:X,k1:X,k2:X,k3:X,k4:X,kernelMatrix:U_,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:X,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskType:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:X,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:X,overlineThickness:X,paintOrder:null,panose1:null,path:null,pathLength:X,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:V_,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:X,pointsAtY:X,pointsAtZ:X,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:U_,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:U_,rev:U_,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:U_,requiredFeatures:U_,requiredFonts:U_,requiredFormats:U_,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:X,specularExponent:X,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:X,strikethroughThickness:X,string:null,stroke:null,strokeDashArray:U_,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:X,strokeOpacity:X,strokeWidth:null,style:null,surfaceScale:X,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:U_,tabIndex:X,tableValues:null,target:null,targetX:X,targetY:X,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:U_,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:X,underlineThickness:X,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:X,values:null,vAlphabetic:X,vMathematical:X,vectorEffect:null,vHanging:X,vIdeographic:X,version:null,vertAdvY:X,vertOriginX:X,vertOriginY:X,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:X,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:`svg`,transform:X_}),ev=J_({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:`xlink`,transform(e,t){return`xlink:`+t.slice(5).toLowerCase()}}),tv=J_({attributes:{xmlnsxlink:`xmlns:xlink`},properties:{xmlnsXLink:null,xmlns:null},space:`xmlns`,transform:Z_}),nv=J_({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:`xml`,transform(e,t){return`xml:`+t.slice(3).toLowerCase()}}),rv={classId:`classID`,dataType:`datatype`,itemId:`itemID`,strokeDashArray:`strokeDasharray`,strokeDashOffset:`strokeDashoffset`,strokeLineCap:`strokeLinecap`,strokeLineJoin:`strokeLinejoin`,strokeMiterLimit:`strokeMiterlimit`,typeOf:`typeof`,xLinkActuate:`xlinkActuate`,xLinkArcRole:`xlinkArcrole`,xLinkHref:`xlinkHref`,xLinkRole:`xlinkRole`,xLinkShow:`xlinkShow`,xLinkTitle:`xlinkTitle`,xLinkType:`xlinkType`,xmlnsXLink:`xmlnsXlink`},iv=/[A-Z]/g,av=/-[a-z]/g,ov=/^data[-\w.:]+$/i;function sv(e,t){let n=P_(t),r=t,i=F_;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)===`data`&&ov.test(t)){if(t.charAt(4)===`-`){let e=t.slice(5).replace(av,lv);r=`data`+e.charAt(0).toUpperCase()+e.slice(1)}else{let e=t.slice(4);if(!av.test(e)){let n=e.replace(iv,cv);n.charAt(0)!==`-`&&(n=`-`+n),t=`data`+n}}i=K_}return new i(r,t)}function cv(e){return`-`+e.toLowerCase()}function lv(e){return e.charAt(1).toUpperCase()}var uv=N_([Y_,Q_,ev,tv,nv],`html`),dv=N_([Y_,$_,ev,tv,nv],`svg`);function fv(e){return e.join(` `).trim()}var pv=s(((e,t)=>{var n=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,r=/\n/g,i=/^\s*/,a=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,o=/^:\s*/,s=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,c=/^[;\s]*/,l=/^\s+|\s+$/g,u=`
|
|
21
|
+
`,d=`/`,f=`*`,p=``,m=`comment`,h=`declaration`;function g(e,t){if(typeof e!=`string`)throw TypeError(`First argument must be a string`);if(!e)return[];t||={};var l=1,g=1;function v(e){var t=e.match(r);t&&(l+=t.length);var n=e.lastIndexOf(u);g=~n?e.length-n:g+e.length}function y(){var e={line:l,column:g};return function(t){return t.position=new b(e),C(),t}}function b(e){this.start=e,this.end={line:l,column:g},this.source=t.source}b.prototype.content=e;function x(n){var r=Error(t.source+`:`+l+`:`+g+`: `+n);if(r.reason=n,r.filename=t.source,r.line=l,r.column=g,r.source=e,!t.silent)throw r}function S(t){var n=t.exec(e);if(n){var r=n[0];return v(r),e=e.slice(r.length),n}}function C(){S(i)}function w(e){var t;for(e||=[];t=T();)t!==!1&&e.push(t);return e}function T(){var t=y();if(!(d!=e.charAt(0)||f!=e.charAt(1))){for(var n=2;p!=e.charAt(n)&&(f!=e.charAt(n)||d!=e.charAt(n+1));)++n;if(n+=2,p===e.charAt(n-1))return x(`End of comment missing`);var r=e.slice(2,n-2);return g+=2,v(r),e=e.slice(n),g+=2,t({type:m,comment:r})}}function E(){var e=y(),t=S(a);if(t){if(T(),!S(o))return x(`property missing ':'`);var r=S(s),i=e({type:h,property:_(t[0].replace(n,p)),value:r?_(r[0].replace(n,p)):p});return S(c),i}}function D(){var e=[];w(e);for(var t;t=E();)t!==!1&&(e.push(t),w(e));return e}return C(),D()}function _(e){return e?e.replace(l,p):p}t.exports=g})),mv=s((e=>{var t=e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(e,`__esModule`,{value:!0}),e.default=r;var n=t(pv());function r(e,t){let r=null;if(!e||typeof e!=`string`)return r;let i=(0,n.default)(e),a=typeof t==`function`;return i.forEach(e=>{if(e.type!==`declaration`)return;let{property:n,value:i}=e;a?t(n,i,e):i&&(r||={},r[n]=i)}),r}})),hv=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.camelCase=void 0;var t=/^--[a-zA-Z0-9_-]+$/,n=/-([a-z])/g,r=/^[^-]+$/,i=/^-(webkit|moz|ms|o|khtml)-/,a=/^-(ms)-/,o=function(e){return!e||r.test(e)||t.test(e)},s=function(e,t){return t.toUpperCase()},c=function(e,t){return`${t}-`};e.camelCase=function(e,t){return t===void 0&&(t={}),o(e)?e:(e=e.toLowerCase(),e=t.reactCompat?e.replace(a,c):e.replace(i,c),e.replace(n,s))}})),gv=s(((e,t)=>{var n=(e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}})(mv()),r=hv();function i(e,t){var i={};return!e||typeof e!=`string`||(0,n.default)(e,function(e,n){e&&n&&(i[(0,r.camelCase)(e,t)]=n)}),i}i.default=i,t.exports=i})),_v=yv(`end`),vv=yv(`start`);function yv(e){return t;function t(t){let n=t&&t.position&&t.position[e]||{};if(typeof n.line==`number`&&n.line>0&&typeof n.column==`number`&&n.column>0)return{line:n.line,column:n.column,offset:typeof n.offset==`number`&&n.offset>-1?n.offset:void 0}}}function bv(e){let t=vv(e),n=_v(e);if(t&&n)return{start:t,end:n}}function xv(e){return!e||typeof e!=`object`?``:`position`in e||`type`in e?Cv(e.position):`start`in e||`end`in e?Cv(e):`line`in e||`column`in e?Sv(e):``}function Sv(e){return wv(e&&e.line)+`:`+wv(e&&e.column)}function Cv(e){return Sv(e&&e.start)+`-`+Sv(e&&e.end)}function wv(e){return e&&typeof e==`number`?e:1}var Tv=class extends Error{constructor(e,t,n){super(),typeof t==`string`&&(n=t,t=void 0);let r=``,i={},a=!1;if(t&&(i=`line`in t&&`column`in t||`start`in t&&`end`in t?{place:t}:`type`in t?{ancestors:[t],place:t.position}:{...t}),typeof e==`string`?r=e:!i.cause&&e&&(a=!0,r=e.message,i.cause=e),!i.ruleId&&!i.source&&typeof n==`string`){let e=n.indexOf(`:`);e===-1?i.ruleId=n:(i.source=n.slice(0,e),i.ruleId=n.slice(e+1))}if(!i.place&&i.ancestors&&i.ancestors){let e=i.ancestors[i.ancestors.length-1];e&&(i.place=e.position)}let o=i.place&&`start`in i.place?i.place.start:i.place;this.ancestors=i.ancestors||void 0,this.cause=i.cause||void 0,this.column=o?o.column:void 0,this.fatal=void 0,this.file=``,this.message=r,this.line=o?o.line:void 0,this.name=xv(i.place)||`1:1`,this.place=i.place||void 0,this.reason=this.message,this.ruleId=i.ruleId||void 0,this.source=i.source||void 0,this.stack=a&&i.cause&&typeof i.cause.stack==`string`?i.cause.stack:``,this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}};Tv.prototype.file=``,Tv.prototype.name=``,Tv.prototype.reason=``,Tv.prototype.message=``,Tv.prototype.stack=``,Tv.prototype.column=void 0,Tv.prototype.line=void 0,Tv.prototype.ancestors=void 0,Tv.prototype.cause=void 0,Tv.prototype.fatal=void 0,Tv.prototype.place=void 0,Tv.prototype.ruleId=void 0,Tv.prototype.source=void 0;var Ev=u(gv(),1),Dv={}.hasOwnProperty,Ov=new Map,kv=/[A-Z]/g,Av=new Set([`table`,`tbody`,`thead`,`tfoot`,`tr`]),jv=new Set([`td`,`th`]),Mv=`https://github.com/syntax-tree/hast-util-to-jsx-runtime`;function Nv(e,t){if(!t||t.Fragment===void 0)throw TypeError("Expected `Fragment` in options");let n=t.filePath||void 0,r;if(t.development){if(typeof t.jsxDEV!=`function`)throw TypeError("Expected `jsxDEV` in options when `development: true`");r=Wv(n,t.jsxDEV)}else{if(typeof t.jsx!=`function`)throw TypeError("Expected `jsx` in production options");if(typeof t.jsxs!=`function`)throw TypeError("Expected `jsxs` in production options");r=Uv(n,t.jsx,t.jsxs)}let i={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:r,elementAttributeNameCase:t.elementAttributeNameCase||`react`,evaluater:t.createEvaluater?t.createEvaluater():void 0,filePath:n,ignoreInvalidStyle:t.ignoreInvalidStyle||!1,passKeys:t.passKeys!==!1,passNode:t.passNode||!1,schema:t.space===`svg`?dv:uv,stylePropertyNameCase:t.stylePropertyNameCase||`dom`,tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},a=Pv(i,e,void 0);return a&&typeof a!=`string`?a:i.create(e,i.Fragment,{children:a||void 0},void 0)}function Pv(e,t,n){if(t.type===`element`)return Fv(e,t,n);if(t.type===`mdxFlowExpression`||t.type===`mdxTextExpression`)return Iv(e,t);if(t.type===`mdxJsxFlowElement`||t.type===`mdxJsxTextElement`)return Rv(e,t,n);if(t.type===`mdxjsEsm`)return Lv(e,t);if(t.type===`root`)return zv(e,t,n);if(t.type===`text`)return Bv(e,t)}function Fv(e,t,n){let r=e.schema,i=r;t.tagName.toLowerCase()===`svg`&&r.space===`html`&&(i=dv,e.schema=i),e.ancestors.push(t);let a=Xv(e,t.tagName,!1),o=Gv(e,t),s=qv(e,t);return Av.has(t.tagName)&&(s=s.filter(function(e){return typeof e==`string`?!A_(e):!0})),Vv(e,o,a,t),Hv(o,s),e.ancestors.pop(),e.schema=r,e.create(t,a,o,n)}function Iv(e,t){if(t.data&&t.data.estree&&e.evaluater){let n=t.data.estree.body[0];return n.type,e.evaluater.evaluateExpression(n.expression)}Zv(e,t.position)}function Lv(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);Zv(e,t.position)}function Rv(e,t,n){let r=e.schema,i=r;t.name===`svg`&&r.space===`html`&&(i=dv,e.schema=i),e.ancestors.push(t);let a=t.name===null?e.Fragment:Xv(e,t.name,!0),o=Kv(e,t),s=qv(e,t);return Vv(e,o,a,t),Hv(o,s),e.ancestors.pop(),e.schema=r,e.create(t,a,o,n)}function zv(e,t,n){let r={};return Hv(r,qv(e,t)),e.create(t,e.Fragment,r,n)}function Bv(e,t){return t.value}function Vv(e,t,n,r){typeof n!=`string`&&n!==e.Fragment&&e.passNode&&(t.node=r)}function Hv(e,t){if(t.length>0){let n=t.length>1?t:t[0];n&&(e.children=n)}}function Uv(e,t,n){return r;function r(e,r,i,a){let o=Array.isArray(i.children)?n:t;return a?o(r,i,a):o(r,i)}}function Wv(e,t){return n;function n(n,r,i,a){let o=Array.isArray(i.children),s=vv(n);return t(r,i,a,o,{columnNumber:s?s.column-1:void 0,fileName:e,lineNumber:s?s.line:void 0},void 0)}}function Gv(e,t){let n={},r,i;for(i in t.properties)if(i!==`children`&&Dv.call(t.properties,i)){let a=Jv(e,i,t.properties[i]);if(a){let[i,o]=a;e.tableCellAlignToStyle&&i===`align`&&typeof o==`string`&&jv.has(t.tagName)?r=o:n[i]=o}}if(r){let t=n.style||={};t[e.stylePropertyNameCase===`css`?`text-align`:`textAlign`]=r}return n}function Kv(e,t){let n={};for(let r of t.attributes)if(r.type===`mdxJsxExpressionAttribute`)if(r.data&&r.data.estree&&e.evaluater){let t=r.data.estree.body[0];t.type;let i=t.expression;i.type;let a=i.properties[0];a.type,Object.assign(n,e.evaluater.evaluateExpression(a.argument))}else Zv(e,t.position);else{let i=r.name,a;if(r.value&&typeof r.value==`object`)if(r.value.data&&r.value.data.estree&&e.evaluater){let t=r.value.data.estree.body[0];t.type,a=e.evaluater.evaluateExpression(t.expression)}else Zv(e,t.position);else a=r.value===null?!0:r.value;n[i]=a}return n}function qv(e,t){let n=[],r=-1,i=e.passKeys?new Map:Ov;for(;++r<t.children.length;){let a=t.children[r],o;if(e.passKeys){let e=a.type===`element`?a.tagName:a.type===`mdxJsxFlowElement`||a.type===`mdxJsxTextElement`?a.name:void 0;if(e){let t=i.get(e)||0;o=e+`-`+t,i.set(e,t+1)}}let s=Pv(e,a,o);s!==void 0&&n.push(s)}return n}function Jv(e,t,n){let r=sv(e.schema,t);if(!(n==null||typeof n==`number`&&Number.isNaN(n))){if(Array.isArray(n)&&(n=r.commaSeparated?w_(n):fv(n)),r.property===`style`){let t=typeof n==`object`?n:Yv(e,String(n));return e.stylePropertyNameCase===`css`&&(t=Qv(t)),[`style`,t]}return[e.elementAttributeNameCase===`react`&&r.space?rv[r.property]||r.property:r.attribute,n]}}function Yv(e,t){try{return(0,Ev.default)(t,{reactCompat:!0})}catch(t){if(e.ignoreInvalidStyle)return{};let n=t,r=new Tv("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:n,ruleId:`style`,source:`hast-util-to-jsx-runtime`});throw r.file=e.filePath||void 0,r.url=Mv+`#cannot-parse-style-attribute`,r}}function Xv(e,t,n){let r;if(!n)r={type:`Literal`,value:t};else if(t.includes(`.`)){let e=t.split(`.`),n=-1,i;for(;++n<e.length;){let t=O_(e[n])?{type:`Identifier`,name:e[n]}:{type:`Literal`,value:e[n]};i=i?{type:`MemberExpression`,object:i,property:t,computed:!!(n&&t.type===`Literal`),optional:!1}:t}r=i}else r=O_(t)&&!/^[a-z]/.test(t)?{type:`Identifier`,name:t}:{type:`Literal`,value:t};if(r.type===`Literal`){let t=r.value;return Dv.call(e.components,t)?e.components[t]:t}if(e.evaluater)return e.evaluater.evaluateExpression(r);Zv(e)}function Zv(e,t){let n=new Tv("Cannot handle MDX estrees without `createEvaluater`",{ancestors:e.ancestors,place:t,ruleId:`mdx-estree`,source:`hast-util-to-jsx-runtime`});throw n.file=e.filePath||void 0,n.url=Mv+`#cannot-handle-mdx-estrees-without-createevaluater`,n}function Qv(e){let t={},n;for(n in e)Dv.call(e,n)&&(t[$v(n)]=e[n]);return t}function $v(e){let t=e.replace(kv,ey);return t.slice(0,3)===`ms-`&&(t=`-`+t),t}function ey(e){return`-`+e.toLowerCase()}var ty={action:[`form`],cite:[`blockquote`,`del`,`ins`,`q`],data:[`object`],formAction:[`button`,`input`],href:[`a`,`area`,`base`,`link`],icon:[`menuitem`],itemId:null,manifest:[`html`],ping:[`a`,`area`],poster:[`video`],src:[`audio`,`embed`,`iframe`,`img`,`input`,`script`,`source`,`track`,`video`]},ny={};function ry(e,t){let n=t||ny;return iy(e,typeof n.includeImageAlt==`boolean`?n.includeImageAlt:!0,typeof n.includeHtml==`boolean`?n.includeHtml:!0)}function iy(e,t,n){if(oy(e)){if(`value`in e)return e.type===`html`&&!n?``:e.value;if(t&&`alt`in e&&e.alt)return e.alt;if(`children`in e)return ay(e.children,t,n)}return Array.isArray(e)?ay(e,t,n):``}function ay(e,t,n){let r=[],i=-1;for(;++i<e.length;)r[i]=iy(e[i],t,n);return r.join(``)}function oy(e){return!!(e&&typeof e==`object`)}var sy=document.createElement(`i`);function cy(e){let t=`&`+e+`;`;sy.innerHTML=t;let n=sy.textContent;return n.charCodeAt(n.length-1)===59&&e!==`semi`||n===t?!1:n}function ly(e,t,n,r){let i=e.length,a=0,o;if(t=t<0?-t>i?0:i+t:t>i?i:t,n=n>0?n:0,r.length<1e4)o=Array.from(r),o.unshift(t,n),e.splice(...o);else for(n&&e.splice(t,n);a<r.length;)o=r.slice(a,a+1e4),o.unshift(t,0),e.splice(...o),a+=1e4,t+=1e4}function uy(e,t){return e.length>0?(ly(e,e.length,0,t),e):t}var dy={}.hasOwnProperty;function fy(e){let t={},n=-1;for(;++n<e.length;)py(t,e[n]);return t}function py(e,t){let n;for(n in t){let r=(dy.call(e,n)?e[n]:void 0)||(e[n]={}),i=t[n],a;if(i)for(a in i){dy.call(r,a)||(r[a]=[]);let e=i[a];my(r[a],Array.isArray(e)?e:e?[e]:[])}}}function my(e,t){let n=-1,r=[];for(;++n<t.length;)(t[n].add===`after`?e:r).push(t[n]);ly(e,0,0,r)}function hy(e,t){let n=Number.parseInt(e,t);return n<9||n===11||n>13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(n&65535)==65535||(n&65535)==65534||n>1114111?`�`:String.fromCodePoint(n)}function gy(e){return e.replace(/[\t\n\r ]+/g,` `).replace(/^ | $/g,``).toLowerCase().toUpperCase()}var _y=ky(/[A-Za-z]/),vy=ky(/[\dA-Za-z]/),yy=ky(/[#-'*+\--9=?A-Z^-~]/);function by(e){return e!==null&&(e<32||e===127)}var xy=ky(/\d/),Sy=ky(/[\dA-Fa-f]/),Cy=ky(/[!-/:-@[-`{-~]/);function wy(e){return e!==null&&e<-2}function Ty(e){return e!==null&&(e<0||e===32)}function Ey(e){return e===-2||e===-1||e===32}var Dy=ky(/\p{P}|\p{S}/u),Oy=ky(/\s/);function ky(e){return t;function t(t){return t!==null&&t>-1&&e.test(String.fromCharCode(t))}}function Ay(e){let t=[],n=-1,r=0,i=0;for(;++n<e.length;){let a=e.charCodeAt(n),o=``;if(a===37&&vy(e.charCodeAt(n+1))&&vy(e.charCodeAt(n+2)))i=2;else if(a<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(a))||(o=String.fromCharCode(a));else if(a>55295&&a<57344){let t=e.charCodeAt(n+1);a<56320&&t>56319&&t<57344?(o=String.fromCharCode(a,t),i=1):o=`�`}else o=String.fromCharCode(a);o&&=(t.push(e.slice(r,n),encodeURIComponent(o)),r=n+i+1,``),i&&=(n+=i,0)}return t.join(``)+e.slice(r)}function jy(e,t,n,r){let i=r?r-1:1/0,a=0;return o;function o(r){return Ey(r)?(e.enter(n),s(r)):t(r)}function s(r){return Ey(r)&&a++<i?(e.consume(r),s):(e.exit(n),t(r))}}var My={tokenize:Ny};function Ny(e){let t=e.attempt(this.parser.constructs.contentInitial,r,i),n;return t;function r(n){if(n===null){e.consume(n);return}return e.enter(`lineEnding`),e.consume(n),e.exit(`lineEnding`),jy(e,t,`linePrefix`)}function i(t){return e.enter(`paragraph`),a(t)}function a(t){let r=e.enter(`chunkText`,{contentType:`text`,previous:n});return n&&(n.next=r),n=r,o(t)}function o(t){if(t===null){e.exit(`chunkText`),e.exit(`paragraph`),e.consume(t);return}return wy(t)?(e.consume(t),e.exit(`chunkText`),a):(e.consume(t),o)}}var Py={tokenize:Iy},Fy={tokenize:Ly};function Iy(e){let t=this,n=[],r=0,i,a,o;return s;function s(i){if(r<n.length){let a=n[r];return t.containerState=a[1],e.attempt(a[0].continuation,c,l)(i)}return l(i)}function c(e){if(r++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,i&&v();let n=t.events.length,a=n,o;for(;a--;)if(t.events[a][0]===`exit`&&t.events[a][1].type===`chunkFlow`){o=t.events[a][1].end;break}_(r);let s=n;for(;s<t.events.length;)t.events[s][1].end={...o},s++;return ly(t.events,a+1,0,t.events.slice(n)),t.events.length=s,l(e)}return s(e)}function l(a){if(r===n.length){if(!i)return f(a);if(i.currentConstruct&&i.currentConstruct.concrete)return m(a);t.interrupt=!!(i.currentConstruct&&!i._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(Fy,u,d)(a)}function u(e){return i&&v(),_(r),f(e)}function d(e){return t.parser.lazy[t.now().line]=r!==n.length,o=t.now().offset,m(e)}function f(n){return t.containerState={},e.attempt(Fy,p,m)(n)}function p(e){return r++,n.push([t.currentConstruct,t.containerState]),f(e)}function m(n){if(n===null){i&&v(),_(0),e.consume(n);return}return i||=t.parser.flow(t.now()),e.enter(`chunkFlow`,{_tokenizer:i,contentType:`flow`,previous:a}),h(n)}function h(n){if(n===null){g(e.exit(`chunkFlow`),!0),_(0),e.consume(n);return}return wy(n)?(e.consume(n),g(e.exit(`chunkFlow`)),r=0,t.interrupt=void 0,s):(e.consume(n),h)}function g(e,n){let s=t.sliceStream(e);if(n&&s.push(null),e.previous=a,a&&(a.next=e),a=e,i.defineSkip(e.start),i.write(s),t.parser.lazy[e.start.line]){let e=i.events.length;for(;e--;)if(i.events[e][1].start.offset<o&&(!i.events[e][1].end||i.events[e][1].end.offset>o))return;let n=t.events.length,a=n,s,c;for(;a--;)if(t.events[a][0]===`exit`&&t.events[a][1].type===`chunkFlow`){if(s){c=t.events[a][1].end;break}s=!0}for(_(r),e=n;e<t.events.length;)t.events[e][1].end={...c},e++;ly(t.events,a+1,0,t.events.slice(n)),t.events.length=e}}function _(r){let i=n.length;for(;i-- >r;){let r=n[i];t.containerState=r[1],r[0].exit.call(t,e)}n.length=r}function v(){i.write([null]),a=void 0,i=void 0,t.containerState._closeFlow=void 0}}function Ly(e,t,n){return jy(e,e.attempt(this.parser.constructs.document,t,n),`linePrefix`,this.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)}function Ry(e){if(e===null||Ty(e)||Oy(e))return 1;if(Dy(e))return 2}function zy(e,t,n){let r=[],i=-1;for(;++i<e.length;){let a=e[i].resolveAll;a&&!r.includes(a)&&(t=a(t,n),r.push(a))}return t}var By={name:`attention`,resolveAll:Vy,tokenize:Hy};function Vy(e,t){let n=-1,r,i,a,o,s,c,l,u;for(;++n<e.length;)if(e[n][0]===`enter`&&e[n][1].type===`attentionSequence`&&e[n][1]._close){for(r=n;r--;)if(e[r][0]===`exit`&&e[r][1].type===`attentionSequence`&&e[r][1]._open&&t.sliceSerialize(e[r][1]).charCodeAt(0)===t.sliceSerialize(e[n][1]).charCodeAt(0)){if((e[r][1]._close||e[n][1]._open)&&(e[n][1].end.offset-e[n][1].start.offset)%3&&!((e[r][1].end.offset-e[r][1].start.offset+e[n][1].end.offset-e[n][1].start.offset)%3))continue;c=e[r][1].end.offset-e[r][1].start.offset>1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;let d={...e[r][1].end},f={...e[n][1].start};Uy(d,-c),Uy(f,c),o={type:c>1?`strongSequence`:`emphasisSequence`,start:d,end:{...e[r][1].end}},s={type:c>1?`strongSequence`:`emphasisSequence`,start:{...e[n][1].start},end:f},a={type:c>1?`strongText`:`emphasisText`,start:{...e[r][1].end},end:{...e[n][1].start}},i={type:c>1?`strong`:`emphasis`,start:{...o.start},end:{...s.end}},e[r][1].end={...o.start},e[n][1].start={...s.end},l=[],e[r][1].end.offset-e[r][1].start.offset&&(l=uy(l,[[`enter`,e[r][1],t],[`exit`,e[r][1],t]])),l=uy(l,[[`enter`,i,t],[`enter`,o,t],[`exit`,o,t],[`enter`,a,t]]),l=uy(l,zy(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),l=uy(l,[[`exit`,a,t],[`enter`,s,t],[`exit`,s,t],[`exit`,i,t]]),e[n][1].end.offset-e[n][1].start.offset?(u=2,l=uy(l,[[`enter`,e[n][1],t],[`exit`,e[n][1],t]])):u=0,ly(e,r-1,n-r+3,l),n=r+l.length-u-2;break}}for(n=-1;++n<e.length;)e[n][1].type===`attentionSequence`&&(e[n][1].type=`data`);return e}function Hy(e,t){let n=this.parser.constructs.attentionMarkers.null,r=this.previous,i=Ry(r),a;return o;function o(t){return a=t,e.enter(`attentionSequence`),s(t)}function s(o){if(o===a)return e.consume(o),s;let c=e.exit(`attentionSequence`),l=Ry(o),u=!l||l===2&&i||n.includes(o),d=!i||i===2&&l||n.includes(r);return c._open=!!(a===42?u:u&&(i||!d)),c._close=!!(a===42?d:d&&(l||!u)),t(o)}}function Uy(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}var Wy={name:`autolink`,tokenize:Gy};function Gy(e,t,n){let r=0;return i;function i(t){return e.enter(`autolink`),e.enter(`autolinkMarker`),e.consume(t),e.exit(`autolinkMarker`),e.enter(`autolinkProtocol`),a}function a(t){return _y(t)?(e.consume(t),o):t===64?n(t):l(t)}function o(e){return e===43||e===45||e===46||vy(e)?(r=1,s(e)):l(e)}function s(t){return t===58?(e.consume(t),r=0,c):(t===43||t===45||t===46||vy(t))&&r++<32?(e.consume(t),s):(r=0,l(t))}function c(r){return r===62?(e.exit(`autolinkProtocol`),e.enter(`autolinkMarker`),e.consume(r),e.exit(`autolinkMarker`),e.exit(`autolink`),t):r===null||r===32||r===60||by(r)?n(r):(e.consume(r),c)}function l(t){return t===64?(e.consume(t),u):yy(t)?(e.consume(t),l):n(t)}function u(e){return vy(e)?d(e):n(e)}function d(n){return n===46?(e.consume(n),r=0,u):n===62?(e.exit(`autolinkProtocol`).type=`autolinkEmail`,e.enter(`autolinkMarker`),e.consume(n),e.exit(`autolinkMarker`),e.exit(`autolink`),t):f(n)}function f(t){if((t===45||vy(t))&&r++<63){let n=t===45?f:d;return e.consume(t),n}return n(t)}}var Ky={partial:!0,tokenize:qy};function qy(e,t,n){return r;function r(t){return Ey(t)?jy(e,i,`linePrefix`)(t):i(t)}function i(e){return e===null||wy(e)?t(e):n(e)}}var Jy={continuation:{tokenize:Xy},exit:Zy,name:`blockQuote`,tokenize:Yy};function Yy(e,t,n){let r=this;return i;function i(t){if(t===62){let n=r.containerState;return n.open||=(e.enter(`blockQuote`,{_container:!0}),!0),e.enter(`blockQuotePrefix`),e.enter(`blockQuoteMarker`),e.consume(t),e.exit(`blockQuoteMarker`),a}return n(t)}function a(n){return Ey(n)?(e.enter(`blockQuotePrefixWhitespace`),e.consume(n),e.exit(`blockQuotePrefixWhitespace`),e.exit(`blockQuotePrefix`),t):(e.exit(`blockQuotePrefix`),t(n))}}function Xy(e,t,n){let r=this;return i;function i(t){return Ey(t)?jy(e,a,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):a(t)}function a(r){return e.attempt(Jy,t,n)(r)}}function Zy(e){e.exit(`blockQuote`)}var Qy={name:`characterEscape`,tokenize:$y};function $y(e,t,n){return r;function r(t){return e.enter(`characterEscape`),e.enter(`escapeMarker`),e.consume(t),e.exit(`escapeMarker`),i}function i(r){return Cy(r)?(e.enter(`characterEscapeValue`),e.consume(r),e.exit(`characterEscapeValue`),e.exit(`characterEscape`),t):n(r)}}var eb={name:`characterReference`,tokenize:tb};function tb(e,t,n){let r=this,i=0,a,o;return s;function s(t){return e.enter(`characterReference`),e.enter(`characterReferenceMarker`),e.consume(t),e.exit(`characterReferenceMarker`),c}function c(t){return t===35?(e.enter(`characterReferenceMarkerNumeric`),e.consume(t),e.exit(`characterReferenceMarkerNumeric`),l):(e.enter(`characterReferenceValue`),a=31,o=vy,u(t))}function l(t){return t===88||t===120?(e.enter(`characterReferenceMarkerHexadecimal`),e.consume(t),e.exit(`characterReferenceMarkerHexadecimal`),e.enter(`characterReferenceValue`),a=6,o=Sy,u):(e.enter(`characterReferenceValue`),a=7,o=xy,u(t))}function u(s){if(s===59&&i){let i=e.exit(`characterReferenceValue`);return o===vy&&!cy(r.sliceSerialize(i))?n(s):(e.enter(`characterReferenceMarker`),e.consume(s),e.exit(`characterReferenceMarker`),e.exit(`characterReference`),t)}return o(s)&&i++<a?(e.consume(s),u):n(s)}}var nb={partial:!0,tokenize:ab},rb={concrete:!0,name:`codeFenced`,tokenize:ib};function ib(e,t,n){let r=this,i={partial:!0,tokenize:x},a=0,o=0,s;return c;function c(e){return l(e)}function l(t){let n=r.events[r.events.length-1];return a=n&&n[1].type===`linePrefix`?n[2].sliceSerialize(n[1],!0).length:0,s=t,e.enter(`codeFenced`),e.enter(`codeFencedFence`),e.enter(`codeFencedFenceSequence`),u(t)}function u(t){return t===s?(o++,e.consume(t),u):o<3?n(t):(e.exit(`codeFencedFenceSequence`),Ey(t)?jy(e,d,`whitespace`)(t):d(t))}function d(n){return n===null||wy(n)?(e.exit(`codeFencedFence`),r.interrupt?t(n):e.check(nb,h,b)(n)):(e.enter(`codeFencedFenceInfo`),e.enter(`chunkString`,{contentType:`string`}),f(n))}function f(t){return t===null||wy(t)?(e.exit(`chunkString`),e.exit(`codeFencedFenceInfo`),d(t)):Ey(t)?(e.exit(`chunkString`),e.exit(`codeFencedFenceInfo`),jy(e,p,`whitespace`)(t)):t===96&&t===s?n(t):(e.consume(t),f)}function p(t){return t===null||wy(t)?d(t):(e.enter(`codeFencedFenceMeta`),e.enter(`chunkString`,{contentType:`string`}),m(t))}function m(t){return t===null||wy(t)?(e.exit(`chunkString`),e.exit(`codeFencedFenceMeta`),d(t)):t===96&&t===s?n(t):(e.consume(t),m)}function h(t){return e.attempt(i,b,g)(t)}function g(t){return e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),_}function _(t){return a>0&&Ey(t)?jy(e,v,`linePrefix`,a+1)(t):v(t)}function v(t){return t===null||wy(t)?e.check(nb,h,b)(t):(e.enter(`codeFlowValue`),y(t))}function y(t){return t===null||wy(t)?(e.exit(`codeFlowValue`),v(t)):(e.consume(t),y)}function b(n){return e.exit(`codeFenced`),t(n)}function x(e,t,n){let i=0;return a;function a(t){return e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),c}function c(t){return e.enter(`codeFencedFence`),Ey(t)?jy(e,l,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):l(t)}function l(t){return t===s?(e.enter(`codeFencedFenceSequence`),u(t)):n(t)}function u(t){return t===s?(i++,e.consume(t),u):i>=o?(e.exit(`codeFencedFenceSequence`),Ey(t)?jy(e,d,`whitespace`)(t):d(t)):n(t)}function d(r){return r===null||wy(r)?(e.exit(`codeFencedFence`),t(r)):n(r)}}}function ab(e,t,n){let r=this;return i;function i(t){return t===null?n(t):(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),a)}function a(e){return r.parser.lazy[r.now().line]?n(e):t(e)}}var ob={name:`codeIndented`,tokenize:cb},sb={partial:!0,tokenize:lb};function cb(e,t,n){let r=this;return i;function i(t){return e.enter(`codeIndented`),jy(e,a,`linePrefix`,5)(t)}function a(e){let t=r.events[r.events.length-1];return t&&t[1].type===`linePrefix`&&t[2].sliceSerialize(t[1],!0).length>=4?o(e):n(e)}function o(t){return t===null?c(t):wy(t)?e.attempt(sb,o,c)(t):(e.enter(`codeFlowValue`),s(t))}function s(t){return t===null||wy(t)?(e.exit(`codeFlowValue`),o(t)):(e.consume(t),s)}function c(n){return e.exit(`codeIndented`),t(n)}}function lb(e,t,n){let r=this;return i;function i(t){return r.parser.lazy[r.now().line]?n(t):wy(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),i):jy(e,a,`linePrefix`,5)(t)}function a(e){let a=r.events[r.events.length-1];return a&&a[1].type===`linePrefix`&&a[2].sliceSerialize(a[1],!0).length>=4?t(e):wy(e)?i(e):n(e)}}var ub={name:`codeText`,previous:fb,resolve:db,tokenize:pb};function db(e){let t=e.length-4,n=3,r,i;if((e[n][1].type===`lineEnding`||e[n][1].type===`space`)&&(e[t][1].type===`lineEnding`||e[t][1].type===`space`)){for(r=n;++r<t;)if(e[r][1].type===`codeTextData`){e[n][1].type=`codeTextPadding`,e[t][1].type=`codeTextPadding`,n+=2,t-=2;break}}for(r=n-1,t++;++r<=t;)i===void 0?r!==t&&e[r][1].type!==`lineEnding`&&(i=r):(r===t||e[r][1].type===`lineEnding`)&&(e[i][1].type=`codeTextData`,r!==i+2&&(e[i][1].end=e[r-1][1].end,e.splice(i+2,r-i-2),t-=r-i-2,r=i+2),i=void 0);return e}function fb(e){return e!==96||this.events[this.events.length-1][1].type===`characterEscape`}function pb(e,t,n){let r=0,i,a;return o;function o(t){return e.enter(`codeText`),e.enter(`codeTextSequence`),s(t)}function s(t){return t===96?(e.consume(t),r++,s):(e.exit(`codeTextSequence`),c(t))}function c(t){return t===null?n(t):t===32?(e.enter(`space`),e.consume(t),e.exit(`space`),c):t===96?(a=e.enter(`codeTextSequence`),i=0,u(t)):wy(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),c):(e.enter(`codeTextData`),l(t))}function l(t){return t===null||t===32||t===96||wy(t)?(e.exit(`codeTextData`),c(t)):(e.consume(t),l)}function u(n){return n===96?(e.consume(n),i++,u):i===r?(e.exit(`codeTextSequence`),e.exit(`codeText`),t(n)):(a.type=`codeTextData`,l(n))}}var mb=class{constructor(e){this.left=e?[...e]:[],this.right=[]}get(e){if(e<0||e>=this.left.length+this.right.length)throw RangeError("Cannot access index `"+e+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return e<this.left.length?this.left[e]:this.right[this.right.length-e+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(e,t){let n=t??1/0;return n<this.left.length?this.left.slice(e,n):e>this.left.length?this.right.slice(this.right.length-n+this.left.length,this.right.length-e+this.left.length).reverse():this.left.slice(e).concat(this.right.slice(this.right.length-n+this.left.length).reverse())}splice(e,t,n){let r=t||0;this.setCursor(Math.trunc(e));let i=this.right.splice(this.right.length-r,1/0);return n&&hb(this.left,n),i.reverse()}pop(){return this.setCursor(1/0),this.left.pop()}push(e){this.setCursor(1/0),this.left.push(e)}pushMany(e){this.setCursor(1/0),hb(this.left,e)}unshift(e){this.setCursor(0),this.right.push(e)}unshiftMany(e){this.setCursor(0),hb(this.right,e.reverse())}setCursor(e){if(!(e===this.left.length||e>this.left.length&&this.right.length===0||e<0&&this.left.length===0))if(e<this.left.length){let t=this.left.splice(e,1/0);hb(this.right,t.reverse())}else{let t=this.right.splice(this.left.length+this.right.length-e,1/0);hb(this.left,t.reverse())}}};function hb(e,t){let n=0;if(t.length<1e4)e.push(...t);else for(;n<t.length;)e.push(...t.slice(n,n+1e4)),n+=1e4}function gb(e){let t={},n=-1,r,i,a,o,s,c,l,u=new mb(e);for(;++n<u.length;){for(;n in t;)n=t[n];if(r=u.get(n),n&&r[1].type===`chunkFlow`&&u.get(n-1)[1].type===`listItemPrefix`&&(c=r[1]._tokenizer.events,a=0,a<c.length&&c[a][1].type===`lineEndingBlank`&&(a+=2),a<c.length&&c[a][1].type===`content`))for(;++a<c.length&&c[a][1].type!==`content`;)c[a][1].type===`chunkText`&&(c[a][1]._isInFirstContentOfListItem=!0,a++);if(r[0]===`enter`)r[1].contentType&&(Object.assign(t,_b(u,n)),n=t[n],l=!0);else if(r[1]._container){for(a=n,i=void 0;a--;)if(o=u.get(a),o[1].type===`lineEnding`||o[1].type===`lineEndingBlank`)o[0]===`enter`&&(i&&(u.get(i)[1].type=`lineEndingBlank`),o[1].type=`lineEnding`,i=a);else if(!(o[1].type===`linePrefix`||o[1].type===`listItemIndent`))break;i&&(r[1].end={...u.get(i)[1].start},s=u.slice(i,n),s.unshift(r),u.splice(i,n-i+1,s))}}return ly(e,0,1/0,u.slice(0)),!l}function _b(e,t){let n=e.get(t)[1],r=e.get(t)[2],i=t-1,a=[],o=n._tokenizer;o||(o=r.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(o._contentTypeTextTrailing=!0));let s=o.events,c=[],l={},u,d,f=-1,p=n,m=0,h=0,g=[h];for(;p;){for(;e.get(++i)[1]!==p;);a.push(i),p._tokenizer||(u=r.sliceStream(p),p.next||u.push(null),d&&o.defineSkip(p.start),p._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=!0),o.write(u),p._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=void 0)),d=p,p=p.next}for(p=n;++f<s.length;)s[f][0]===`exit`&&s[f-1][0]===`enter`&&s[f][1].type===s[f-1][1].type&&s[f][1].start.line!==s[f][1].end.line&&(h=f+1,g.push(h),p._tokenizer=void 0,p.previous=void 0,p=p.next);for(o.events=[],p?(p._tokenizer=void 0,p.previous=void 0):g.pop(),f=g.length;f--;){let t=s.slice(g[f],g[f+1]),n=a.pop();c.push([n,n+t.length-1]),e.splice(n,2,t)}for(c.reverse(),f=-1;++f<c.length;)l[m+c[f][0]]=m+c[f][1],m+=c[f][1]-c[f][0]-1;return l}var vb={resolve:bb,tokenize:xb},yb={partial:!0,tokenize:Sb};function bb(e){return gb(e),e}function xb(e,t){let n;return r;function r(t){return e.enter(`content`),n=e.enter(`chunkContent`,{contentType:`content`}),i(t)}function i(t){return t===null?a(t):wy(t)?e.check(yb,o,a)(t):(e.consume(t),i)}function a(n){return e.exit(`chunkContent`),e.exit(`content`),t(n)}function o(t){return e.consume(t),e.exit(`chunkContent`),n.next=e.enter(`chunkContent`,{contentType:`content`,previous:n}),n=n.next,i}}function Sb(e,t,n){let r=this;return i;function i(t){return e.exit(`chunkContent`),e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),jy(e,a,`linePrefix`)}function a(i){if(i===null||wy(i))return n(i);let a=r.events[r.events.length-1];return!r.parser.constructs.disable.null.includes(`codeIndented`)&&a&&a[1].type===`linePrefix`&&a[2].sliceSerialize(a[1],!0).length>=4?t(i):e.interrupt(r.parser.constructs.flow,n,t)(i)}}function Cb(e,t,n,r,i,a,o,s,c){let l=c||1/0,u=0;return d;function d(t){return t===60?(e.enter(r),e.enter(i),e.enter(a),e.consume(t),e.exit(a),f):t===null||t===32||t===41||by(t)?n(t):(e.enter(r),e.enter(o),e.enter(s),e.enter(`chunkString`,{contentType:`string`}),h(t))}function f(n){return n===62?(e.enter(a),e.consume(n),e.exit(a),e.exit(i),e.exit(r),t):(e.enter(s),e.enter(`chunkString`,{contentType:`string`}),p(n))}function p(t){return t===62?(e.exit(`chunkString`),e.exit(s),f(t)):t===null||t===60||wy(t)?n(t):(e.consume(t),t===92?m:p)}function m(t){return t===60||t===62||t===92?(e.consume(t),p):p(t)}function h(i){return!u&&(i===null||i===41||Ty(i))?(e.exit(`chunkString`),e.exit(s),e.exit(o),e.exit(r),t(i)):u<l&&i===40?(e.consume(i),u++,h):i===41?(e.consume(i),u--,h):i===null||i===32||i===40||by(i)?n(i):(e.consume(i),i===92?g:h)}function g(t){return t===40||t===41||t===92?(e.consume(t),h):h(t)}}function wb(e,t,n,r,i,a){let o=this,s=0,c;return l;function l(t){return e.enter(r),e.enter(i),e.consume(t),e.exit(i),e.enter(a),u}function u(l){return s>999||l===null||l===91||l===93&&!c||l===94&&!s&&`_hiddenFootnoteSupport`in o.parser.constructs?n(l):l===93?(e.exit(a),e.enter(i),e.consume(l),e.exit(i),e.exit(r),t):wy(l)?(e.enter(`lineEnding`),e.consume(l),e.exit(`lineEnding`),u):(e.enter(`chunkString`,{contentType:`string`}),d(l))}function d(t){return t===null||t===91||t===93||wy(t)||s++>999?(e.exit(`chunkString`),u(t)):(e.consume(t),c||=!Ey(t),t===92?f:d)}function f(t){return t===91||t===92||t===93?(e.consume(t),s++,d):d(t)}}function Tb(e,t,n,r,i,a){let o;return s;function s(t){return t===34||t===39||t===40?(e.enter(r),e.enter(i),e.consume(t),e.exit(i),o=t===40?41:t,c):n(t)}function c(n){return n===o?(e.enter(i),e.consume(n),e.exit(i),e.exit(r),t):(e.enter(a),l(n))}function l(t){return t===o?(e.exit(a),c(o)):t===null?n(t):wy(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),jy(e,l,`linePrefix`)):(e.enter(`chunkString`,{contentType:`string`}),u(t))}function u(t){return t===o||t===null||wy(t)?(e.exit(`chunkString`),l(t)):(e.consume(t),t===92?d:u)}function d(t){return t===o||t===92?(e.consume(t),u):u(t)}}function Eb(e,t){let n;return r;function r(i){return wy(i)?(e.enter(`lineEnding`),e.consume(i),e.exit(`lineEnding`),n=!0,r):Ey(i)?jy(e,r,n?`linePrefix`:`lineSuffix`)(i):t(i)}}var Db={name:`definition`,tokenize:kb},Ob={partial:!0,tokenize:Ab};function kb(e,t,n){let r=this,i;return a;function a(t){return e.enter(`definition`),o(t)}function o(t){return wb.call(r,e,s,n,`definitionLabel`,`definitionLabelMarker`,`definitionLabelString`)(t)}function s(t){return i=gy(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),t===58?(e.enter(`definitionMarker`),e.consume(t),e.exit(`definitionMarker`),c):n(t)}function c(t){return Ty(t)?Eb(e,l)(t):l(t)}function l(t){return Cb(e,u,n,`definitionDestination`,`definitionDestinationLiteral`,`definitionDestinationLiteralMarker`,`definitionDestinationRaw`,`definitionDestinationString`)(t)}function u(t){return e.attempt(Ob,d,d)(t)}function d(t){return Ey(t)?jy(e,f,`whitespace`)(t):f(t)}function f(a){return a===null||wy(a)?(e.exit(`definition`),r.parser.defined.push(i),t(a)):n(a)}}function Ab(e,t,n){return r;function r(t){return Ty(t)?Eb(e,i)(t):n(t)}function i(t){return Tb(e,a,n,`definitionTitle`,`definitionTitleMarker`,`definitionTitleString`)(t)}function a(t){return Ey(t)?jy(e,o,`whitespace`)(t):o(t)}function o(e){return e===null||wy(e)?t(e):n(e)}}var jb={name:`hardBreakEscape`,tokenize:Mb};function Mb(e,t,n){return r;function r(t){return e.enter(`hardBreakEscape`),e.consume(t),i}function i(r){return wy(r)?(e.exit(`hardBreakEscape`),t(r)):n(r)}}var Nb={name:`headingAtx`,resolve:Pb,tokenize:Fb};function Pb(e,t){let n=e.length-2,r=3,i,a;return e[r][1].type===`whitespace`&&(r+=2),n-2>r&&e[n][1].type===`whitespace`&&(n-=2),e[n][1].type===`atxHeadingSequence`&&(r===n-1||n-4>r&&e[n-2][1].type===`whitespace`)&&(n-=r+1===n?2:4),n>r&&(i={type:`atxHeadingText`,start:e[r][1].start,end:e[n][1].end},a={type:`chunkText`,start:e[r][1].start,end:e[n][1].end,contentType:`text`},ly(e,r,n-r+1,[[`enter`,i,t],[`enter`,a,t],[`exit`,a,t],[`exit`,i,t]])),e}function Fb(e,t,n){let r=0;return i;function i(t){return e.enter(`atxHeading`),a(t)}function a(t){return e.enter(`atxHeadingSequence`),o(t)}function o(t){return t===35&&r++<6?(e.consume(t),o):t===null||Ty(t)?(e.exit(`atxHeadingSequence`),s(t)):n(t)}function s(n){return n===35?(e.enter(`atxHeadingSequence`),c(n)):n===null||wy(n)?(e.exit(`atxHeading`),t(n)):Ey(n)?jy(e,s,`whitespace`)(n):(e.enter(`atxHeadingText`),l(n))}function c(t){return t===35?(e.consume(t),c):(e.exit(`atxHeadingSequence`),s(t))}function l(t){return t===null||t===35||Ty(t)?(e.exit(`atxHeadingText`),s(t)):(e.consume(t),l)}}var Ib=`address.article.aside.base.basefont.blockquote.body.caption.center.col.colgroup.dd.details.dialog.dir.div.dl.dt.fieldset.figcaption.figure.footer.form.frame.frameset.h1.h2.h3.h4.h5.h6.head.header.hr.html.iframe.legend.li.link.main.menu.menuitem.nav.noframes.ol.optgroup.option.p.param.search.section.summary.table.tbody.td.tfoot.th.thead.title.tr.track.ul`.split(`.`),Lb=[`pre`,`script`,`style`,`textarea`],Rb={concrete:!0,name:`htmlFlow`,resolveTo:Vb,tokenize:Hb},zb={partial:!0,tokenize:Wb},Bb={partial:!0,tokenize:Ub};function Vb(e){let t=e.length;for(;t--&&!(e[t][0]===`enter`&&e[t][1].type===`htmlFlow`););return t>1&&e[t-2][1].type===`linePrefix`&&(e[t][1].start=e[t-2][1].start,e[t+1][1].start=e[t-2][1].start,e.splice(t-2,2)),e}function Hb(e,t,n){let r=this,i,a,o,s,c;return l;function l(e){return u(e)}function u(t){return e.enter(`htmlFlow`),e.enter(`htmlFlowData`),e.consume(t),d}function d(s){return s===33?(e.consume(s),f):s===47?(e.consume(s),a=!0,h):s===63?(e.consume(s),i=3,r.interrupt?t:I):_y(s)?(e.consume(s),o=String.fromCharCode(s),g):n(s)}function f(a){return a===45?(e.consume(a),i=2,p):a===91?(e.consume(a),i=5,s=0,m):_y(a)?(e.consume(a),i=4,r.interrupt?t:I):n(a)}function p(i){return i===45?(e.consume(i),r.interrupt?t:I):n(i)}function m(i){return i===`CDATA[`.charCodeAt(s++)?(e.consume(i),s===6?r.interrupt?t:O:m):n(i)}function h(t){return _y(t)?(e.consume(t),o=String.fromCharCode(t),g):n(t)}function g(s){if(s===null||s===47||s===62||Ty(s)){let c=s===47,l=o.toLowerCase();return!c&&!a&&Lb.includes(l)?(i=1,r.interrupt?t(s):O(s)):Ib.includes(o.toLowerCase())?(i=6,c?(e.consume(s),_):r.interrupt?t(s):O(s)):(i=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(s):a?v(s):y(s))}return s===45||vy(s)?(e.consume(s),o+=String.fromCharCode(s),g):n(s)}function _(i){return i===62?(e.consume(i),r.interrupt?t:O):n(i)}function v(t){return Ey(t)?(e.consume(t),v):E(t)}function y(t){return t===47?(e.consume(t),E):t===58||t===95||_y(t)?(e.consume(t),b):Ey(t)?(e.consume(t),y):E(t)}function b(t){return t===45||t===46||t===58||t===95||vy(t)?(e.consume(t),b):x(t)}function x(t){return t===61?(e.consume(t),S):Ey(t)?(e.consume(t),x):y(t)}function S(t){return t===null||t===60||t===61||t===62||t===96?n(t):t===34||t===39?(e.consume(t),c=t,C):Ey(t)?(e.consume(t),S):w(t)}function C(t){return t===c?(e.consume(t),c=null,T):t===null||wy(t)?n(t):(e.consume(t),C)}function w(t){return t===null||t===34||t===39||t===47||t===60||t===61||t===62||t===96||Ty(t)?x(t):(e.consume(t),w)}function T(e){return e===47||e===62||Ey(e)?y(e):n(e)}function E(t){return t===62?(e.consume(t),D):n(t)}function D(t){return t===null||wy(t)?O(t):Ey(t)?(e.consume(t),D):n(t)}function O(t){return t===45&&i===2?(e.consume(t),M):t===60&&i===1?(e.consume(t),N):t===62&&i===4?(e.consume(t),L):t===63&&i===3?(e.consume(t),I):t===93&&i===5?(e.consume(t),F):wy(t)&&(i===6||i===7)?(e.exit(`htmlFlowData`),e.check(zb,R,k)(t)):t===null||wy(t)?(e.exit(`htmlFlowData`),k(t)):(e.consume(t),O)}function k(t){return e.check(Bb,A,R)(t)}function A(t){return e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),j}function j(t){return t===null||wy(t)?k(t):(e.enter(`htmlFlowData`),O(t))}function M(t){return t===45?(e.consume(t),I):O(t)}function N(t){return t===47?(e.consume(t),o=``,P):O(t)}function P(t){if(t===62){let n=o.toLowerCase();return Lb.includes(n)?(e.consume(t),L):O(t)}return _y(t)&&o.length<8?(e.consume(t),o+=String.fromCharCode(t),P):O(t)}function F(t){return t===93?(e.consume(t),I):O(t)}function I(t){return t===62?(e.consume(t),L):t===45&&i===2?(e.consume(t),I):O(t)}function L(t){return t===null||wy(t)?(e.exit(`htmlFlowData`),R(t)):(e.consume(t),L)}function R(n){return e.exit(`htmlFlow`),t(n)}}function Ub(e,t,n){let r=this;return i;function i(t){return wy(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),a):n(t)}function a(e){return r.parser.lazy[r.now().line]?n(e):t(e)}}function Wb(e,t,n){return r;function r(r){return e.enter(`lineEnding`),e.consume(r),e.exit(`lineEnding`),e.attempt(Ky,t,n)}}var Gb={name:`htmlText`,tokenize:Kb};function Kb(e,t,n){let r=this,i,a,o;return s;function s(t){return e.enter(`htmlText`),e.enter(`htmlTextData`),e.consume(t),c}function c(t){return t===33?(e.consume(t),l):t===47?(e.consume(t),x):t===63?(e.consume(t),y):_y(t)?(e.consume(t),w):n(t)}function l(t){return t===45?(e.consume(t),u):t===91?(e.consume(t),a=0,m):_y(t)?(e.consume(t),v):n(t)}function u(t){return t===45?(e.consume(t),p):n(t)}function d(t){return t===null?n(t):t===45?(e.consume(t),f):wy(t)?(o=d,N(t)):(e.consume(t),d)}function f(t){return t===45?(e.consume(t),p):d(t)}function p(e){return e===62?M(e):e===45?f(e):d(e)}function m(t){return t===`CDATA[`.charCodeAt(a++)?(e.consume(t),a===6?h:m):n(t)}function h(t){return t===null?n(t):t===93?(e.consume(t),g):wy(t)?(o=h,N(t)):(e.consume(t),h)}function g(t){return t===93?(e.consume(t),_):h(t)}function _(t){return t===62?M(t):t===93?(e.consume(t),_):h(t)}function v(t){return t===null||t===62?M(t):wy(t)?(o=v,N(t)):(e.consume(t),v)}function y(t){return t===null?n(t):t===63?(e.consume(t),b):wy(t)?(o=y,N(t)):(e.consume(t),y)}function b(e){return e===62?M(e):y(e)}function x(t){return _y(t)?(e.consume(t),S):n(t)}function S(t){return t===45||vy(t)?(e.consume(t),S):C(t)}function C(t){return wy(t)?(o=C,N(t)):Ey(t)?(e.consume(t),C):M(t)}function w(t){return t===45||vy(t)?(e.consume(t),w):t===47||t===62||Ty(t)?T(t):n(t)}function T(t){return t===47?(e.consume(t),M):t===58||t===95||_y(t)?(e.consume(t),E):wy(t)?(o=T,N(t)):Ey(t)?(e.consume(t),T):M(t)}function E(t){return t===45||t===46||t===58||t===95||vy(t)?(e.consume(t),E):D(t)}function D(t){return t===61?(e.consume(t),O):wy(t)?(o=D,N(t)):Ey(t)?(e.consume(t),D):T(t)}function O(t){return t===null||t===60||t===61||t===62||t===96?n(t):t===34||t===39?(e.consume(t),i=t,k):wy(t)?(o=O,N(t)):Ey(t)?(e.consume(t),O):(e.consume(t),A)}function k(t){return t===i?(e.consume(t),i=void 0,j):t===null?n(t):wy(t)?(o=k,N(t)):(e.consume(t),k)}function A(t){return t===null||t===34||t===39||t===60||t===61||t===96?n(t):t===47||t===62||Ty(t)?T(t):(e.consume(t),A)}function j(e){return e===47||e===62||Ty(e)?T(e):n(e)}function M(r){return r===62?(e.consume(r),e.exit(`htmlTextData`),e.exit(`htmlText`),t):n(r)}function N(t){return e.exit(`htmlTextData`),e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),P}function P(t){return Ey(t)?jy(e,F,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):F(t)}function F(t){return e.enter(`htmlTextData`),o(t)}}var qb={name:`labelEnd`,resolveAll:Zb,resolveTo:Qb,tokenize:$b},Jb={tokenize:ex},Yb={tokenize:tx},Xb={tokenize:nx};function Zb(e){let t=-1,n=[];for(;++t<e.length;){let r=e[t][1];if(n.push(e[t]),r.type===`labelImage`||r.type===`labelLink`||r.type===`labelEnd`){let e=r.type===`labelImage`?4:2;r.type=`data`,t+=e}}return e.length!==n.length&&ly(e,0,e.length,n),e}function Qb(e,t){let n=e.length,r=0,i,a,o,s;for(;n--;)if(i=e[n][1],a){if(i.type===`link`||i.type===`labelLink`&&i._inactive)break;e[n][0]===`enter`&&i.type===`labelLink`&&(i._inactive=!0)}else if(o){if(e[n][0]===`enter`&&(i.type===`labelImage`||i.type===`labelLink`)&&!i._balanced&&(a=n,i.type!==`labelLink`)){r=2;break}}else i.type===`labelEnd`&&(o=n);let c={type:e[a][1].type===`labelLink`?`link`:`image`,start:{...e[a][1].start},end:{...e[e.length-1][1].end}},l={type:`label`,start:{...e[a][1].start},end:{...e[o][1].end}},u={type:`labelText`,start:{...e[a+r+2][1].end},end:{...e[o-2][1].start}};return s=[[`enter`,c,t],[`enter`,l,t]],s=uy(s,e.slice(a+1,a+r+3)),s=uy(s,[[`enter`,u,t]]),s=uy(s,zy(t.parser.constructs.insideSpan.null,e.slice(a+r+4,o-3),t)),s=uy(s,[[`exit`,u,t],e[o-2],e[o-1],[`exit`,l,t]]),s=uy(s,e.slice(o+1)),s=uy(s,[[`exit`,c,t]]),ly(e,a,e.length,s),e}function $b(e,t,n){let r=this,i=r.events.length,a,o;for(;i--;)if((r.events[i][1].type===`labelImage`||r.events[i][1].type===`labelLink`)&&!r.events[i][1]._balanced){a=r.events[i][1];break}return s;function s(t){return a?a._inactive?d(t):(o=r.parser.defined.includes(gy(r.sliceSerialize({start:a.end,end:r.now()}))),e.enter(`labelEnd`),e.enter(`labelMarker`),e.consume(t),e.exit(`labelMarker`),e.exit(`labelEnd`),c):n(t)}function c(t){return t===40?e.attempt(Jb,u,o?u:d)(t):t===91?e.attempt(Yb,u,o?l:d)(t):o?u(t):d(t)}function l(t){return e.attempt(Xb,u,d)(t)}function u(e){return t(e)}function d(e){return a._balanced=!0,n(e)}}function ex(e,t,n){return r;function r(t){return e.enter(`resource`),e.enter(`resourceMarker`),e.consume(t),e.exit(`resourceMarker`),i}function i(t){return Ty(t)?Eb(e,a)(t):a(t)}function a(t){return t===41?u(t):Cb(e,o,s,`resourceDestination`,`resourceDestinationLiteral`,`resourceDestinationLiteralMarker`,`resourceDestinationRaw`,`resourceDestinationString`,32)(t)}function o(t){return Ty(t)?Eb(e,c)(t):u(t)}function s(e){return n(e)}function c(t){return t===34||t===39||t===40?Tb(e,l,n,`resourceTitle`,`resourceTitleMarker`,`resourceTitleString`)(t):u(t)}function l(t){return Ty(t)?Eb(e,u)(t):u(t)}function u(r){return r===41?(e.enter(`resourceMarker`),e.consume(r),e.exit(`resourceMarker`),e.exit(`resource`),t):n(r)}}function tx(e,t,n){let r=this;return i;function i(t){return wb.call(r,e,a,o,`reference`,`referenceMarker`,`referenceString`)(t)}function a(e){return r.parser.defined.includes(gy(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(e):n(e)}function o(e){return n(e)}}function nx(e,t,n){return r;function r(t){return e.enter(`reference`),e.enter(`referenceMarker`),e.consume(t),e.exit(`referenceMarker`),i}function i(r){return r===93?(e.enter(`referenceMarker`),e.consume(r),e.exit(`referenceMarker`),e.exit(`reference`),t):n(r)}}var rx={name:`labelStartImage`,resolveAll:qb.resolveAll,tokenize:ix};function ix(e,t,n){let r=this;return i;function i(t){return e.enter(`labelImage`),e.enter(`labelImageMarker`),e.consume(t),e.exit(`labelImageMarker`),a}function a(t){return t===91?(e.enter(`labelMarker`),e.consume(t),e.exit(`labelMarker`),e.exit(`labelImage`),o):n(t)}function o(e){return e===94&&`_hiddenFootnoteSupport`in r.parser.constructs?n(e):t(e)}}var ax={name:`labelStartLink`,resolveAll:qb.resolveAll,tokenize:ox};function ox(e,t,n){let r=this;return i;function i(t){return e.enter(`labelLink`),e.enter(`labelMarker`),e.consume(t),e.exit(`labelMarker`),e.exit(`labelLink`),a}function a(e){return e===94&&`_hiddenFootnoteSupport`in r.parser.constructs?n(e):t(e)}}var sx={name:`lineEnding`,tokenize:cx};function cx(e,t){return n;function n(n){return e.enter(`lineEnding`),e.consume(n),e.exit(`lineEnding`),jy(e,t,`linePrefix`)}}var lx={name:`thematicBreak`,tokenize:ux};function ux(e,t,n){let r=0,i;return a;function a(t){return e.enter(`thematicBreak`),o(t)}function o(e){return i=e,s(e)}function s(a){return a===i?(e.enter(`thematicBreakSequence`),c(a)):r>=3&&(a===null||wy(a))?(e.exit(`thematicBreak`),t(a)):n(a)}function c(t){return t===i?(e.consume(t),r++,c):(e.exit(`thematicBreakSequence`),Ey(t)?jy(e,s,`whitespace`)(t):s(t))}}var dx={continuation:{tokenize:hx},exit:_x,name:`list`,tokenize:mx},fx={partial:!0,tokenize:vx},px={partial:!0,tokenize:gx};function mx(e,t,n){let r=this,i=r.events[r.events.length-1],a=i&&i[1].type===`linePrefix`?i[2].sliceSerialize(i[1],!0).length:0,o=0;return s;function s(t){let i=r.containerState.type||(t===42||t===43||t===45?`listUnordered`:`listOrdered`);if(i===`listUnordered`?!r.containerState.marker||t===r.containerState.marker:xy(t)){if(r.containerState.type||(r.containerState.type=i,e.enter(i,{_container:!0})),i===`listUnordered`)return e.enter(`listItemPrefix`),t===42||t===45?e.check(lx,n,l)(t):l(t);if(!r.interrupt||t===49)return e.enter(`listItemPrefix`),e.enter(`listItemValue`),c(t)}return n(t)}function c(t){return xy(t)&&++o<10?(e.consume(t),c):(!r.interrupt||o<2)&&(r.containerState.marker?t===r.containerState.marker:t===41||t===46)?(e.exit(`listItemValue`),l(t)):n(t)}function l(t){return e.enter(`listItemMarker`),e.consume(t),e.exit(`listItemMarker`),r.containerState.marker=r.containerState.marker||t,e.check(Ky,r.interrupt?n:u,e.attempt(fx,f,d))}function u(e){return r.containerState.initialBlankLine=!0,a++,f(e)}function d(t){return Ey(t)?(e.enter(`listItemPrefixWhitespace`),e.consume(t),e.exit(`listItemPrefixWhitespace`),f):n(t)}function f(n){return r.containerState.size=a+r.sliceSerialize(e.exit(`listItemPrefix`),!0).length,t(n)}}function hx(e,t,n){let r=this;return r.containerState._closeFlow=void 0,e.check(Ky,i,a);function i(n){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,jy(e,t,`listItemIndent`,r.containerState.size+1)(n)}function a(n){return r.containerState.furtherBlankLines||!Ey(n)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,o(n)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(px,t,o)(n))}function o(i){return r.containerState._closeFlow=!0,r.interrupt=void 0,jy(e,e.attempt(dx,t,n),`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(i)}}function gx(e,t,n){let r=this;return jy(e,i,`listItemIndent`,r.containerState.size+1);function i(e){let i=r.events[r.events.length-1];return i&&i[1].type===`listItemIndent`&&i[2].sliceSerialize(i[1],!0).length===r.containerState.size?t(e):n(e)}}function _x(e){e.exit(this.containerState.type)}function vx(e,t,n){let r=this;return jy(e,i,`listItemPrefixWhitespace`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:5);function i(e){let i=r.events[r.events.length-1];return!Ey(e)&&i&&i[1].type===`listItemPrefixWhitespace`?t(e):n(e)}}var yx={name:`setextUnderline`,resolveTo:bx,tokenize:xx};function bx(e,t){let n=e.length,r,i,a;for(;n--;)if(e[n][0]===`enter`){if(e[n][1].type===`content`){r=n;break}e[n][1].type===`paragraph`&&(i=n)}else e[n][1].type===`content`&&e.splice(n,1),!a&&e[n][1].type===`definition`&&(a=n);let o={type:`setextHeading`,start:{...e[r][1].start},end:{...e[e.length-1][1].end}};return e[i][1].type=`setextHeadingText`,a?(e.splice(i,0,[`enter`,o,t]),e.splice(a+1,0,[`exit`,e[r][1],t]),e[r][1].end={...e[a][1].end}):e[r][1]=o,e.push([`exit`,o,t]),e}function xx(e,t,n){let r=this,i;return a;function a(t){let a=r.events.length,s;for(;a--;)if(r.events[a][1].type!==`lineEnding`&&r.events[a][1].type!==`linePrefix`&&r.events[a][1].type!==`content`){s=r.events[a][1].type===`paragraph`;break}return!r.parser.lazy[r.now().line]&&(r.interrupt||s)?(e.enter(`setextHeadingLine`),i=t,o(t)):n(t)}function o(t){return e.enter(`setextHeadingLineSequence`),s(t)}function s(t){return t===i?(e.consume(t),s):(e.exit(`setextHeadingLineSequence`),Ey(t)?jy(e,c,`lineSuffix`)(t):c(t))}function c(r){return r===null||wy(r)?(e.exit(`setextHeadingLine`),t(r)):n(r)}}var Sx={tokenize:Cx};function Cx(e){let t=this,n=e.attempt(Ky,r,e.attempt(this.parser.constructs.flowInitial,i,jy(e,e.attempt(this.parser.constructs.flow,i,e.attempt(vb,i)),`linePrefix`)));return n;function r(r){if(r===null){e.consume(r);return}return e.enter(`lineEndingBlank`),e.consume(r),e.exit(`lineEndingBlank`),t.currentConstruct=void 0,n}function i(r){if(r===null){e.consume(r);return}return e.enter(`lineEnding`),e.consume(r),e.exit(`lineEnding`),t.currentConstruct=void 0,n}}var wx={resolveAll:Ox()},Tx=Dx(`string`),Ex=Dx(`text`);function Dx(e){return{resolveAll:Ox(e===`text`?kx:void 0),tokenize:t};function t(t){let n=this,r=this.parser.constructs[e],i=t.attempt(r,a,o);return a;function a(e){return c(e)?i(e):o(e)}function o(e){if(e===null){t.consume(e);return}return t.enter(`data`),t.consume(e),s}function s(e){return c(e)?(t.exit(`data`),i(e)):(t.consume(e),s)}function c(e){if(e===null)return!0;let t=r[e],i=-1;if(t)for(;++i<t.length;){let e=t[i];if(!e.previous||e.previous.call(n,n.previous))return!0}return!1}}}function Ox(e){return t;function t(t,n){let r=-1,i;for(;++r<=t.length;)i===void 0?t[r]&&t[r][1].type===`data`&&(i=r,r++):(!t[r]||t[r][1].type!==`data`)&&(r!==i+2&&(t[i][1].end=t[r-1][1].end,t.splice(i+2,r-i-2),r=i+2),i=void 0);return e?e(t,n):t}}function kx(e,t){let n=0;for(;++n<=e.length;)if((n===e.length||e[n][1].type===`lineEnding`)&&e[n-1][1].type===`data`){let r=e[n-1][1],i=t.sliceStream(r),a=i.length,o=-1,s=0,c;for(;a--;){let e=i[a];if(typeof e==`string`){for(o=e.length;e.charCodeAt(o-1)===32;)s++,o--;if(o)break;o=-1}else if(e===-2)c=!0,s++;else if(e!==-1){a++;break}}if(t._contentTypeTextTrailing&&n===e.length&&(s=0),s){let i={type:n===e.length||c||s<2?`lineSuffix`:`hardBreakTrailing`,start:{_bufferIndex:a?o:r.start._bufferIndex+o,_index:r.start._index+a,line:r.end.line,column:r.end.column-s,offset:r.end.offset-s},end:{...r.end}};r.end={...i.start},r.start.offset===r.end.offset?Object.assign(r,i):(e.splice(n,0,[`enter`,i,t],[`exit`,i,t]),n+=2)}n++}return e}var Ax=c({attentionMarkers:()=>Rx,contentInitial:()=>Mx,disable:()=>zx,document:()=>jx,flow:()=>Px,flowInitial:()=>Nx,insideSpan:()=>Lx,string:()=>Fx,text:()=>Ix}),jx={42:dx,43:dx,45:dx,48:dx,49:dx,50:dx,51:dx,52:dx,53:dx,54:dx,55:dx,56:dx,57:dx,62:Jy},Mx={91:Db},Nx={[-2]:ob,[-1]:ob,32:ob},Px={35:Nb,42:lx,45:[yx,lx],60:Rb,61:yx,95:lx,96:rb,126:rb},Fx={38:eb,92:Qy},Ix={[-5]:sx,[-4]:sx,[-3]:sx,33:rx,38:eb,42:By,60:[Wy,Gb],91:ax,92:[jb,Qy],93:qb,95:By,96:ub},Lx={null:[By,wx]},Rx={null:[42,95]},zx={null:[]};function Bx(e,t,n){let r={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0},i={},a=[],o=[],s=[],c={attempt:C(x),check:C(S),consume:v,enter:y,exit:b,interrupt:C(S,{interrupt:!0})},l={code:null,containerState:{},defineSkip:h,events:[],now:m,parser:e,previous:null,sliceSerialize:f,sliceStream:p,write:d},u=t.tokenize.call(l,c);return t.resolveAll&&a.push(t),l;function d(e){return o=uy(o,e),g(),o[o.length-1]===null?(w(t,0),l.events=zy(a,l.events,l),l.events):[]}function f(e,t){return Hx(p(e),t)}function p(e){return Vx(o,e)}function m(){let{_bufferIndex:e,_index:t,line:n,column:i,offset:a}=r;return{_bufferIndex:e,_index:t,line:n,column:i,offset:a}}function h(e){i[e.line]=e.column,E()}function g(){let e;for(;r._index<o.length;){let t=o[r._index];if(typeof t==`string`)for(e=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===e&&r._bufferIndex<t.length;)_(t.charCodeAt(r._bufferIndex));else _(t)}}function _(e){u=u(e)}function v(e){wy(e)?(r.line++,r.column=1,r.offset+=e===-3?2:1,E()):e!==-1&&(r.column++,r.offset++),r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===o[r._index].length&&(r._bufferIndex=-1,r._index++)),l.previous=e}function y(e,t){let n=t||{};return n.type=e,n.start=m(),l.events.push([`enter`,n,l]),s.push(n),n}function b(e){let t=s.pop();return t.end=m(),l.events.push([`exit`,t,l]),t}function x(e,t){w(e,t.from)}function S(e,t){t.restore()}function C(e,t){return n;function n(n,r,i){let a,o,s,u;return Array.isArray(n)?f(n):`tokenize`in n?f([n]):d(n);function d(e){return t;function t(t){let n=t!==null&&e[t],r=t!==null&&e.null;return f([...Array.isArray(n)?n:n?[n]:[],...Array.isArray(r)?r:r?[r]:[]])(t)}}function f(e){return a=e,o=0,e.length===0?i:p(e[o])}function p(e){return n;function n(n){return u=T(),s=e,e.partial||(l.currentConstruct=e),e.name&&l.parser.constructs.disable.null.includes(e.name)?h(n):e.tokenize.call(t?Object.assign(Object.create(l),t):l,c,m,h)(n)}}function m(t){return e(s,u),r}function h(e){return u.restore(),++o<a.length?p(a[o]):i}}}function w(e,t){e.resolveAll&&!a.includes(e)&&a.push(e),e.resolve&&ly(l.events,t,l.events.length-t,e.resolve(l.events.slice(t),l)),e.resolveTo&&(l.events=e.resolveTo(l.events,l))}function T(){let e=m(),t=l.previous,n=l.currentConstruct,i=l.events.length,a=Array.from(s);return{from:i,restore:o};function o(){r=e,l.previous=t,l.currentConstruct=n,l.events.length=i,s=a,E()}}function E(){r.line in i&&r.column<2&&(r.column=i[r.line],r.offset+=i[r.line]-1)}}function Vx(e,t){let n=t.start._index,r=t.start._bufferIndex,i=t.end._index,a=t.end._bufferIndex,o;if(n===i)o=[e[n].slice(r,a)];else{if(o=e.slice(n,i),r>-1){let e=o[0];typeof e==`string`?o[0]=e.slice(r):o.shift()}a>0&&o.push(e[i].slice(0,a))}return o}function Hx(e,t){let n=-1,r=[],i;for(;++n<e.length;){let a=e[n],o;if(typeof a==`string`)o=a;else switch(a){case-5:o=`\r`;break;case-4:o=`
|
|
22
22
|
`;break;case-3:o=`\r
|
|
23
|
-
`;break;case-2:o=t?` `:` `;break;case-1:if(!t&&i)continue;o=` `;break;default:o=String.fromCharCode(a)}i=a===-2,r.push(o)}return r.join(``)}function Ux(e){let t={constructs:fy([Ax,...(e||{}).extensions||[]]),content:n(My),defined:[],document:n(Py),flow:n(Sx),lazy:{},string:n(Tx),text:n(Ex)};return t;function n(e){return n;function n(n){return Bx(t,e,n)}}}function Wx(e){for(;!gb(e););return e}var Gx=/[\0\t\n\r]/g;function Kx(){let e=1,t=``,n=!0,r;return i;function i(i,a,o){let s=[],c,l,u,d,f;for(i=t+(typeof i==`string`?i.toString():new TextDecoder(a||void 0).decode(i)),u=0,t=``,n&&=(i.charCodeAt(0)===65279&&u++,void 0);u<i.length;){if(Gx.lastIndex=u,c=Gx.exec(i),d=c&&c.index!==void 0?c.index:i.length,f=i.charCodeAt(d),!c){t=i.slice(u);break}if(f===10&&u===d&&r)s.push(-3),r=void 0;else switch(r&&=(s.push(-5),void 0),u<d&&(s.push(i.slice(u,d)),e+=d-u),f){case 0:s.push(65533),e++;break;case 9:for(l=Math.ceil(e/4)*4,s.push(-2);e++<l;)s.push(-1);break;case 10:s.push(-4),e=1;break;default:r=!0,e=1}u=d+1}return o&&(r&&s.push(-5),t&&s.push(t),s.push(null)),s}}var qx=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function Jx(e){return e.replace(qx,Yx)}function Yx(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){let e=n.charCodeAt(1),t=e===120||e===88;return hy(n.slice(t?2:1),t?16:10)}return cy(n)||e}var Xx={}.hasOwnProperty;function Zx(e,t,n){return t&&typeof t==`object`&&(n=t,t=void 0),Qx(n)(Wx(Ux(n).document().write(Kx()(e,t,!0))))}function Qx(e){let t={transforms:[],canContainEols:[`emphasis`,`fragment`,`heading`,`paragraph`,`strong`],enter:{autolink:a(ue),autolinkProtocol:T,autolinkEmail:T,atxHeading:a(oe),blockQuote:a(re),characterEscape:T,characterReference:T,codeFenced:a(U),codeFencedFenceInfo:o,codeFencedFenceMeta:o,codeIndented:a(U,o),codeText:a(ie,o),codeTextData:T,data:T,codeFlowValue:T,definition:a(W),definitionDestinationString:o,definitionLabelString:o,definitionTitleString:o,emphasis:a(ae),hardBreakEscape:a(se),hardBreakTrailing:a(se),htmlFlow:a(ce,o),htmlFlowData:T,htmlText:a(ce,o),htmlTextData:T,image:a(le),label:o,link:a(ue),listItem:a(fe),listItemValue:f,listOrdered:a(de,d),listUnordered:a(de),paragraph:a(pe),reference:R,referenceString:o,resourceDestinationString:o,resourceTitleString:o,setextHeading:a(oe),strong:a(me),thematicBreak:a(ge)},exit:{atxHeading:c(),atxHeadingSequence:x,autolink:c(),autolinkEmail:H,autolinkProtocol:ne,blockQuote:c(),characterEscapeValue:E,characterReferenceMarkerHexadecimal:B,characterReferenceMarkerNumeric:B,characterReferenceValue:te,characterReference:V,codeFenced:c(g),codeFencedFence:h,codeFencedFenceInfo:p,codeFencedFenceMeta:m,codeFlowValue:E,codeIndented:c(_),codeText:c(j),codeTextData:E,data:E,definition:c(),definitionDestinationString:b,definitionLabelString:v,definitionTitleString:y,emphasis:c(),hardBreakEscape:c(O),hardBreakTrailing:c(O),htmlFlow:c(k),htmlFlowData:E,htmlText:c(A),htmlTextData:E,image:c(N),label:F,labelText:P,lineEnding:D,link:c(M),listItem:c(),listOrdered:c(),listUnordered:c(),paragraph:c(),referenceString:z,resourceDestinationString:I,resourceTitleString:L,resource:ee,setextHeading:c(w),setextHeadingLineSequence:C,setextHeadingText:S,strong:c(),thematicBreak:c()}};eS(t,(e||{}).mdastExtensions||[]);let n={};return r;function r(e){let r={type:`root`,children:[]},a={stack:[r],tokenStack:[],config:t,enter:s,exit:l,buffer:o,resume:u,data:n},c=[],d=-1;for(;++d<e.length;)(e[d][1].type===`listOrdered`||e[d][1].type===`listUnordered`)&&(e[d][0]===`enter`?c.push(d):d=i(e,c.pop(),d));for(d=-1;++d<e.length;){let n=t[e[d][0]];Xx.call(n,e[d][1].type)&&n[e[d][1].type].call(Object.assign({sliceSerialize:e[d][2].sliceSerialize},a),e[d][1])}if(a.tokenStack.length>0){let e=a.tokenStack[a.tokenStack.length-1];(e[1]||nS).call(a,void 0,e[0])}for(r.position={start:$x(e.length>0?e[0][1].start:{line:1,column:1,offset:0}),end:$x(e.length>0?e[e.length-2][1].end:{line:1,column:1,offset:0})},d=-1;++d<t.transforms.length;)r=t.transforms[d](r)||r;return r}function i(e,t,n){let r=t-1,i=-1,a=!1,o,s,c,l;for(;++r<=n;){let t=e[r];switch(t[1].type){case`listUnordered`:case`listOrdered`:case`blockQuote`:t[0]===`enter`?i++:i--,l=void 0;break;case`lineEndingBlank`:t[0]===`enter`&&(o&&!l&&!i&&!c&&(c=r),l=void 0);break;case`linePrefix`:case`listItemValue`:case`listItemMarker`:case`listItemPrefix`:case`listItemPrefixWhitespace`:break;default:l=void 0}if(!i&&t[0]===`enter`&&t[1].type===`listItemPrefix`||i===-1&&t[0]===`exit`&&(t[1].type===`listUnordered`||t[1].type===`listOrdered`)){if(o){let i=r;for(s=void 0;i--;){let t=e[i];if(t[1].type===`lineEnding`||t[1].type===`lineEndingBlank`){if(t[0]===`exit`)continue;s&&(e[s][1].type=`lineEndingBlank`,a=!0),t[1].type=`lineEnding`,s=i}else if(!(t[1].type===`linePrefix`||t[1].type===`blockQuotePrefix`||t[1].type===`blockQuotePrefixWhitespace`||t[1].type===`blockQuoteMarker`||t[1].type===`listItemIndent`))break}c&&(!s||c<s)&&(o._spread=!0),o.end=Object.assign({},s?e[s][1].start:t[1].end),e.splice(s||r,0,[`exit`,o,t[2]]),r++,n++}if(t[1].type===`listItemPrefix`){let i={type:`listItem`,_spread:!1,start:Object.assign({},t[1].start),end:void 0};o=i,e.splice(r,0,[`enter`,i,t[2]]),r++,n++,c=void 0,l=!0}}}return e[t][1]._spread=a,n}function a(e,t){return n;function n(n){s.call(this,e(n),n),t&&t.call(this,n)}}function o(){this.stack.push({type:`fragment`,children:[]})}function s(e,t,n){this.stack[this.stack.length-1].children.push(e),this.stack.push(e),this.tokenStack.push([t,n||void 0]),e.position={start:$x(t.start),end:void 0}}function c(e){return t;function t(t){e&&e.call(this,t),l.call(this,t)}}function l(e,t){let n=this.stack.pop(),r=this.tokenStack.pop();if(r)r[0].type!==e.type&&(t?t.call(this,e,r[0]):(r[1]||nS).call(this,e,r[0]));else throw Error("Cannot close `"+e.type+"` ("+xv({start:e.start,end:e.end})+`): it’s not open`);n.position.end=$x(e.end)}function u(){return ry(this.stack.pop())}function d(){this.data.expectingFirstListItemValue=!0}function f(e){if(this.data.expectingFirstListItemValue){let t=this.stack[this.stack.length-2];t.start=Number.parseInt(this.sliceSerialize(e),10),this.data.expectingFirstListItemValue=void 0}}function p(){let e=this.resume(),t=this.stack[this.stack.length-1];t.lang=e}function m(){let e=this.resume(),t=this.stack[this.stack.length-1];t.meta=e}function h(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function g(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,``),this.data.flowCodeInside=void 0}function _(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e.replace(/(\r?\n|\r)$/g,``)}function v(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.label=t,n.identifier=gy(this.sliceSerialize(e)).toLowerCase()}function y(){let e=this.resume(),t=this.stack[this.stack.length-1];t.title=e}function b(){let e=this.resume(),t=this.stack[this.stack.length-1];t.url=e}function x(e){let t=this.stack[this.stack.length-1];t.depth||=this.sliceSerialize(e).length}function S(){this.data.setextHeadingSlurpLineEnding=!0}function C(e){let t=this.stack[this.stack.length-1];t.depth=this.sliceSerialize(e).codePointAt(0)===61?1:2}function w(){this.data.setextHeadingSlurpLineEnding=void 0}function T(e){let t=this.stack[this.stack.length-1].children,n=t[t.length-1];(!n||n.type!==`text`)&&(n=he(),n.position={start:$x(e.start),end:void 0},t.push(n)),this.stack.push(n)}function E(e){let t=this.stack.pop();t.value+=this.sliceSerialize(e),t.position.end=$x(e.end)}function D(e){let n=this.stack[this.stack.length-1];if(this.data.atHardBreak){let t=n.children[n.children.length-1];t.position.end=$x(e.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(n.type)&&(T.call(this,e),E.call(this,e))}function O(){this.data.atHardBreak=!0}function k(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e}function A(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e}function j(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e}function M(){let e=this.stack[this.stack.length-1];if(this.data.inReference){let t=this.data.referenceType||`shortcut`;e.type+=`Reference`,e.referenceType=t,delete e.url,delete e.title}else delete e.identifier,delete e.label;this.data.referenceType=void 0}function N(){let e=this.stack[this.stack.length-1];if(this.data.inReference){let t=this.data.referenceType||`shortcut`;e.type+=`Reference`,e.referenceType=t,delete e.url,delete e.title}else delete e.identifier,delete e.label;this.data.referenceType=void 0}function P(e){let t=this.sliceSerialize(e),n=this.stack[this.stack.length-2];n.label=Jx(t),n.identifier=gy(t).toLowerCase()}function F(){let e=this.stack[this.stack.length-1],t=this.resume(),n=this.stack[this.stack.length-1];this.data.inReference=!0,n.type===`link`?n.children=e.children:n.alt=t}function I(){let e=this.resume(),t=this.stack[this.stack.length-1];t.url=e}function L(){let e=this.resume(),t=this.stack[this.stack.length-1];t.title=e}function ee(){this.data.inReference=void 0}function R(){this.data.referenceType=`collapsed`}function z(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.label=t,n.identifier=gy(this.sliceSerialize(e)).toLowerCase(),this.data.referenceType=`full`}function B(e){this.data.characterReferenceType=e.type}function te(e){let t=this.sliceSerialize(e),n=this.data.characterReferenceType,r;n?(r=hy(t,n===`characterReferenceMarkerNumeric`?10:16),this.data.characterReferenceType=void 0):r=cy(t);let i=this.stack[this.stack.length-1];i.value+=r}function V(e){let t=this.stack.pop();t.position.end=$x(e.end)}function ne(e){E.call(this,e);let t=this.stack[this.stack.length-1];t.url=this.sliceSerialize(e)}function H(e){E.call(this,e);let t=this.stack[this.stack.length-1];t.url=`mailto:`+this.sliceSerialize(e)}function re(){return{type:`blockquote`,children:[]}}function U(){return{type:`code`,lang:null,meta:null,value:``}}function ie(){return{type:`inlineCode`,value:``}}function W(){return{type:`definition`,identifier:``,label:null,title:null,url:``}}function ae(){return{type:`emphasis`,children:[]}}function oe(){return{type:`heading`,depth:0,children:[]}}function se(){return{type:`break`}}function ce(){return{type:`html`,value:``}}function le(){return{type:`image`,title:null,url:``,alt:null}}function ue(){return{type:`link`,title:null,url:``,children:[]}}function de(e){return{type:`list`,ordered:e.type===`listOrdered`,start:null,spread:e._spread,children:[]}}function fe(e){return{type:`listItem`,spread:e._spread,checked:null,children:[]}}function pe(){return{type:`paragraph`,children:[]}}function me(){return{type:`strong`,children:[]}}function he(){return{type:`text`,value:``}}function ge(){return{type:`thematicBreak`}}}function $x(e){return{line:e.line,column:e.column,offset:e.offset}}function eS(e,t){let n=-1;for(;++n<t.length;){let r=t[n];Array.isArray(r)?eS(e,r):tS(e,r)}}function tS(e,t){let n;for(n in t)if(Xx.call(t,n))switch(n){case`canContainEols`:{let r=t[n];r&&e[n].push(...r);break}case`transforms`:{let r=t[n];r&&e[n].push(...r);break}case`enter`:case`exit`:{let r=t[n];r&&Object.assign(e[n],r);break}}}function nS(e,t){throw Error(e?"Cannot close `"+e.type+"` ("+xv({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+xv({start:t.start,end:t.end})+`) is open`:"Cannot close document, a token (`"+t.type+"`, "+xv({start:t.start,end:t.end})+`) is still open`)}function rS(e){let t=this;t.parser=n;function n(n){return Zx(n,{...t.data(`settings`),...e,extensions:t.data(`micromarkExtensions`)||[],mdastExtensions:t.data(`fromMarkdownExtensions`)||[]})}}function iS(e,t){let n={type:`element`,tagName:`blockquote`,properties:{},children:e.wrap(e.all(t),!0)};return e.patch(t,n),e.applyData(t,n)}function aS(e,t){let n={type:`element`,tagName:`br`,properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:`text`,value:`
|
|
23
|
+
`;break;case-2:o=t?` `:` `;break;case-1:if(!t&&i)continue;o=` `;break;default:o=String.fromCharCode(a)}i=a===-2,r.push(o)}return r.join(``)}function Ux(e){let t={constructs:fy([Ax,...(e||{}).extensions||[]]),content:n(My),defined:[],document:n(Py),flow:n(Sx),lazy:{},string:n(Tx),text:n(Ex)};return t;function n(e){return n;function n(n){return Bx(t,e,n)}}}function Wx(e){for(;!gb(e););return e}var Gx=/[\0\t\n\r]/g;function Kx(){let e=1,t=``,n=!0,r;return i;function i(i,a,o){let s=[],c,l,u,d,f;for(i=t+(typeof i==`string`?i.toString():new TextDecoder(a||void 0).decode(i)),u=0,t=``,n&&=(i.charCodeAt(0)===65279&&u++,void 0);u<i.length;){if(Gx.lastIndex=u,c=Gx.exec(i),d=c&&c.index!==void 0?c.index:i.length,f=i.charCodeAt(d),!c){t=i.slice(u);break}if(f===10&&u===d&&r)s.push(-3),r=void 0;else switch(r&&=(s.push(-5),void 0),u<d&&(s.push(i.slice(u,d)),e+=d-u),f){case 0:s.push(65533),e++;break;case 9:for(l=Math.ceil(e/4)*4,s.push(-2);e++<l;)s.push(-1);break;case 10:s.push(-4),e=1;break;default:r=!0,e=1}u=d+1}return o&&(r&&s.push(-5),t&&s.push(t),s.push(null)),s}}var qx=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function Jx(e){return e.replace(qx,Yx)}function Yx(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){let e=n.charCodeAt(1),t=e===120||e===88;return hy(n.slice(t?2:1),t?16:10)}return cy(n)||e}var Xx={}.hasOwnProperty;function Zx(e,t,n){return t&&typeof t==`object`&&(n=t,t=void 0),Qx(n)(Wx(Ux(n).document().write(Kx()(e,t,!0))))}function Qx(e){let t={transforms:[],canContainEols:[`emphasis`,`fragment`,`heading`,`paragraph`,`strong`],enter:{autolink:a(ue),autolinkProtocol:T,autolinkEmail:T,atxHeading:a(oe),blockQuote:a(ne),characterEscape:T,characterReference:T,codeFenced:a(re),codeFencedFenceInfo:o,codeFencedFenceMeta:o,codeIndented:a(re,o),codeText:a(ie,o),codeTextData:T,data:T,codeFlowValue:T,definition:a(ae),definitionDestinationString:o,definitionLabelString:o,definitionTitleString:o,emphasis:a(W),hardBreakEscape:a(se),hardBreakTrailing:a(se),htmlFlow:a(ce,o),htmlFlowData:T,htmlText:a(ce,o),htmlTextData:T,image:a(le),label:o,link:a(ue),listItem:a(fe),listItemValue:f,listOrdered:a(de,d),listUnordered:a(de),paragraph:a(pe),reference:z,referenceString:o,resourceDestinationString:o,resourceTitleString:o,setextHeading:a(oe),strong:a(me),thematicBreak:a(ge)},exit:{atxHeading:c(),atxHeadingSequence:x,autolink:c(),autolinkEmail:U,autolinkProtocol:te,blockQuote:c(),characterEscapeValue:E,characterReferenceMarkerHexadecimal:V,characterReferenceMarkerNumeric:V,characterReferenceValue:ee,characterReference:H,codeFenced:c(g),codeFencedFence:h,codeFencedFenceInfo:p,codeFencedFenceMeta:m,codeFlowValue:E,codeIndented:c(_),codeText:c(j),codeTextData:E,data:E,definition:c(),definitionDestinationString:b,definitionLabelString:v,definitionTitleString:y,emphasis:c(),hardBreakEscape:c(O),hardBreakTrailing:c(O),htmlFlow:c(k),htmlFlowData:E,htmlText:c(A),htmlTextData:E,image:c(N),label:F,labelText:P,lineEnding:D,link:c(M),listItem:c(),listOrdered:c(),listUnordered:c(),paragraph:c(),referenceString:B,resourceDestinationString:I,resourceTitleString:L,resource:R,setextHeading:c(w),setextHeadingLineSequence:C,setextHeadingText:S,strong:c(),thematicBreak:c()}};eS(t,(e||{}).mdastExtensions||[]);let n={};return r;function r(e){let r={type:`root`,children:[]},a={stack:[r],tokenStack:[],config:t,enter:s,exit:l,buffer:o,resume:u,data:n},c=[],d=-1;for(;++d<e.length;)(e[d][1].type===`listOrdered`||e[d][1].type===`listUnordered`)&&(e[d][0]===`enter`?c.push(d):d=i(e,c.pop(),d));for(d=-1;++d<e.length;){let n=t[e[d][0]];Xx.call(n,e[d][1].type)&&n[e[d][1].type].call(Object.assign({sliceSerialize:e[d][2].sliceSerialize},a),e[d][1])}if(a.tokenStack.length>0){let e=a.tokenStack[a.tokenStack.length-1];(e[1]||nS).call(a,void 0,e[0])}for(r.position={start:$x(e.length>0?e[0][1].start:{line:1,column:1,offset:0}),end:$x(e.length>0?e[e.length-2][1].end:{line:1,column:1,offset:0})},d=-1;++d<t.transforms.length;)r=t.transforms[d](r)||r;return r}function i(e,t,n){let r=t-1,i=-1,a=!1,o,s,c,l;for(;++r<=n;){let t=e[r];switch(t[1].type){case`listUnordered`:case`listOrdered`:case`blockQuote`:t[0]===`enter`?i++:i--,l=void 0;break;case`lineEndingBlank`:t[0]===`enter`&&(o&&!l&&!i&&!c&&(c=r),l=void 0);break;case`linePrefix`:case`listItemValue`:case`listItemMarker`:case`listItemPrefix`:case`listItemPrefixWhitespace`:break;default:l=void 0}if(!i&&t[0]===`enter`&&t[1].type===`listItemPrefix`||i===-1&&t[0]===`exit`&&(t[1].type===`listUnordered`||t[1].type===`listOrdered`)){if(o){let i=r;for(s=void 0;i--;){let t=e[i];if(t[1].type===`lineEnding`||t[1].type===`lineEndingBlank`){if(t[0]===`exit`)continue;s&&(e[s][1].type=`lineEndingBlank`,a=!0),t[1].type=`lineEnding`,s=i}else if(!(t[1].type===`linePrefix`||t[1].type===`blockQuotePrefix`||t[1].type===`blockQuotePrefixWhitespace`||t[1].type===`blockQuoteMarker`||t[1].type===`listItemIndent`))break}c&&(!s||c<s)&&(o._spread=!0),o.end=Object.assign({},s?e[s][1].start:t[1].end),e.splice(s||r,0,[`exit`,o,t[2]]),r++,n++}if(t[1].type===`listItemPrefix`){let i={type:`listItem`,_spread:!1,start:Object.assign({},t[1].start),end:void 0};o=i,e.splice(r,0,[`enter`,i,t[2]]),r++,n++,c=void 0,l=!0}}}return e[t][1]._spread=a,n}function a(e,t){return n;function n(n){s.call(this,e(n),n),t&&t.call(this,n)}}function o(){this.stack.push({type:`fragment`,children:[]})}function s(e,t,n){this.stack[this.stack.length-1].children.push(e),this.stack.push(e),this.tokenStack.push([t,n||void 0]),e.position={start:$x(t.start),end:void 0}}function c(e){return t;function t(t){e&&e.call(this,t),l.call(this,t)}}function l(e,t){let n=this.stack.pop(),r=this.tokenStack.pop();if(r)r[0].type!==e.type&&(t?t.call(this,e,r[0]):(r[1]||nS).call(this,e,r[0]));else throw Error("Cannot close `"+e.type+"` ("+xv({start:e.start,end:e.end})+`): it’s not open`);n.position.end=$x(e.end)}function u(){return ry(this.stack.pop())}function d(){this.data.expectingFirstListItemValue=!0}function f(e){if(this.data.expectingFirstListItemValue){let t=this.stack[this.stack.length-2];t.start=Number.parseInt(this.sliceSerialize(e),10),this.data.expectingFirstListItemValue=void 0}}function p(){let e=this.resume(),t=this.stack[this.stack.length-1];t.lang=e}function m(){let e=this.resume(),t=this.stack[this.stack.length-1];t.meta=e}function h(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function g(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,``),this.data.flowCodeInside=void 0}function _(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e.replace(/(\r?\n|\r)$/g,``)}function v(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.label=t,n.identifier=gy(this.sliceSerialize(e)).toLowerCase()}function y(){let e=this.resume(),t=this.stack[this.stack.length-1];t.title=e}function b(){let e=this.resume(),t=this.stack[this.stack.length-1];t.url=e}function x(e){let t=this.stack[this.stack.length-1];t.depth||=this.sliceSerialize(e).length}function S(){this.data.setextHeadingSlurpLineEnding=!0}function C(e){let t=this.stack[this.stack.length-1];t.depth=this.sliceSerialize(e).codePointAt(0)===61?1:2}function w(){this.data.setextHeadingSlurpLineEnding=void 0}function T(e){let t=this.stack[this.stack.length-1].children,n=t[t.length-1];(!n||n.type!==`text`)&&(n=he(),n.position={start:$x(e.start),end:void 0},t.push(n)),this.stack.push(n)}function E(e){let t=this.stack.pop();t.value+=this.sliceSerialize(e),t.position.end=$x(e.end)}function D(e){let n=this.stack[this.stack.length-1];if(this.data.atHardBreak){let t=n.children[n.children.length-1];t.position.end=$x(e.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(n.type)&&(T.call(this,e),E.call(this,e))}function O(){this.data.atHardBreak=!0}function k(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e}function A(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e}function j(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e}function M(){let e=this.stack[this.stack.length-1];if(this.data.inReference){let t=this.data.referenceType||`shortcut`;e.type+=`Reference`,e.referenceType=t,delete e.url,delete e.title}else delete e.identifier,delete e.label;this.data.referenceType=void 0}function N(){let e=this.stack[this.stack.length-1];if(this.data.inReference){let t=this.data.referenceType||`shortcut`;e.type+=`Reference`,e.referenceType=t,delete e.url,delete e.title}else delete e.identifier,delete e.label;this.data.referenceType=void 0}function P(e){let t=this.sliceSerialize(e),n=this.stack[this.stack.length-2];n.label=Jx(t),n.identifier=gy(t).toLowerCase()}function F(){let e=this.stack[this.stack.length-1],t=this.resume(),n=this.stack[this.stack.length-1];this.data.inReference=!0,n.type===`link`?n.children=e.children:n.alt=t}function I(){let e=this.resume(),t=this.stack[this.stack.length-1];t.url=e}function L(){let e=this.resume(),t=this.stack[this.stack.length-1];t.title=e}function R(){this.data.inReference=void 0}function z(){this.data.referenceType=`collapsed`}function B(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.label=t,n.identifier=gy(this.sliceSerialize(e)).toLowerCase(),this.data.referenceType=`full`}function V(e){this.data.characterReferenceType=e.type}function ee(e){let t=this.sliceSerialize(e),n=this.data.characterReferenceType,r;n?(r=hy(t,n===`characterReferenceMarkerNumeric`?10:16),this.data.characterReferenceType=void 0):r=cy(t);let i=this.stack[this.stack.length-1];i.value+=r}function H(e){let t=this.stack.pop();t.position.end=$x(e.end)}function te(e){E.call(this,e);let t=this.stack[this.stack.length-1];t.url=this.sliceSerialize(e)}function U(e){E.call(this,e);let t=this.stack[this.stack.length-1];t.url=`mailto:`+this.sliceSerialize(e)}function ne(){return{type:`blockquote`,children:[]}}function re(){return{type:`code`,lang:null,meta:null,value:``}}function ie(){return{type:`inlineCode`,value:``}}function ae(){return{type:`definition`,identifier:``,label:null,title:null,url:``}}function W(){return{type:`emphasis`,children:[]}}function oe(){return{type:`heading`,depth:0,children:[]}}function se(){return{type:`break`}}function ce(){return{type:`html`,value:``}}function le(){return{type:`image`,title:null,url:``,alt:null}}function ue(){return{type:`link`,title:null,url:``,children:[]}}function de(e){return{type:`list`,ordered:e.type===`listOrdered`,start:null,spread:e._spread,children:[]}}function fe(e){return{type:`listItem`,spread:e._spread,checked:null,children:[]}}function pe(){return{type:`paragraph`,children:[]}}function me(){return{type:`strong`,children:[]}}function he(){return{type:`text`,value:``}}function ge(){return{type:`thematicBreak`}}}function $x(e){return{line:e.line,column:e.column,offset:e.offset}}function eS(e,t){let n=-1;for(;++n<t.length;){let r=t[n];Array.isArray(r)?eS(e,r):tS(e,r)}}function tS(e,t){let n;for(n in t)if(Xx.call(t,n))switch(n){case`canContainEols`:{let r=t[n];r&&e[n].push(...r);break}case`transforms`:{let r=t[n];r&&e[n].push(...r);break}case`enter`:case`exit`:{let r=t[n];r&&Object.assign(e[n],r);break}}}function nS(e,t){throw Error(e?"Cannot close `"+e.type+"` ("+xv({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+xv({start:t.start,end:t.end})+`) is open`:"Cannot close document, a token (`"+t.type+"`, "+xv({start:t.start,end:t.end})+`) is still open`)}function rS(e){let t=this;t.parser=n;function n(n){return Zx(n,{...t.data(`settings`),...e,extensions:t.data(`micromarkExtensions`)||[],mdastExtensions:t.data(`fromMarkdownExtensions`)||[]})}}function iS(e,t){let n={type:`element`,tagName:`blockquote`,properties:{},children:e.wrap(e.all(t),!0)};return e.patch(t,n),e.applyData(t,n)}function aS(e,t){let n={type:`element`,tagName:`br`,properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:`text`,value:`
|
|
24
24
|
`}]}function oS(e,t){let n=t.value?t.value+`
|
|
25
25
|
`:``,r={},i=t.lang?t.lang.split(/\s+/):[];i.length>0&&(r.className=[`language-`+i[0]]);let a={type:`element`,tagName:`code`,properties:r,children:[{type:`text`,value:n}]};return t.meta&&(a.data={meta:t.meta}),e.patch(t,a),a=e.applyData(t,a),a={type:`element`,tagName:`pre`,properties:{},children:[a]},e.patch(t,a),a}function sS(e,t){let n={type:`element`,tagName:`del`,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function cS(e,t){let n={type:`element`,tagName:`em`,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function lS(e,t){let n=typeof e.options.clobberPrefix==`string`?e.options.clobberPrefix:`user-content-`,r=String(t.identifier).toUpperCase(),i=Ay(r.toLowerCase()),a=e.footnoteOrder.indexOf(r),o,s=e.footnoteCounts.get(r);s===void 0?(s=0,e.footnoteOrder.push(r),o=e.footnoteOrder.length):o=a+1,s+=1,e.footnoteCounts.set(r,s);let c={type:`element`,tagName:`a`,properties:{href:`#`+n+`fn-`+i,id:n+`fnref-`+i+(s>1?`-`+s:``),dataFootnoteRef:!0,ariaDescribedBy:[`footnote-label`]},children:[{type:`text`,value:String(o)}]};e.patch(t,c);let l={type:`element`,tagName:`sup`,properties:{},children:[c]};return e.patch(t,l),e.applyData(t,l)}function uS(e,t){let n={type:`element`,tagName:`h`+t.depth,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function dS(e,t){if(e.options.allowDangerousHtml){let n={type:`raw`,value:t.value};return e.patch(t,n),e.applyData(t,n)}}function fS(e,t){let n=t.referenceType,r=`]`;if(n===`collapsed`?r+=`[]`:n===`full`&&(r+=`[`+(t.label||t.identifier)+`]`),t.type===`imageReference`)return[{type:`text`,value:`![`+t.alt+r}];let i=e.all(t),a=i[0];a&&a.type===`text`?a.value=`[`+a.value:i.unshift({type:`text`,value:`[`});let o=i[i.length-1];return o&&o.type===`text`?o.value+=r:i.push({type:`text`,value:r}),i}function pS(e,t){let n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return fS(e,t);let i={src:Ay(r.url||``),alt:t.alt};r.title!==null&&r.title!==void 0&&(i.title=r.title);let a={type:`element`,tagName:`img`,properties:i,children:[]};return e.patch(t,a),e.applyData(t,a)}function mS(e,t){let n={src:Ay(t.url)};t.alt!==null&&t.alt!==void 0&&(n.alt=t.alt),t.title!==null&&t.title!==void 0&&(n.title=t.title);let r={type:`element`,tagName:`img`,properties:n,children:[]};return e.patch(t,r),e.applyData(t,r)}function hS(e,t){let n={type:`text`,value:t.value.replace(/\r?\n|\r/g,` `)};e.patch(t,n);let r={type:`element`,tagName:`code`,properties:{},children:[n]};return e.patch(t,r),e.applyData(t,r)}function gS(e,t){let n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return fS(e,t);let i={href:Ay(r.url||``)};r.title!==null&&r.title!==void 0&&(i.title=r.title);let a={type:`element`,tagName:`a`,properties:i,children:e.all(t)};return e.patch(t,a),e.applyData(t,a)}function _S(e,t){let n={href:Ay(t.url)};t.title!==null&&t.title!==void 0&&(n.title=t.title);let r={type:`element`,tagName:`a`,properties:n,children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function vS(e,t,n){let r=e.all(t),i=n?yS(n):bS(t),a={},o=[];if(typeof t.checked==`boolean`){let e=r[0],n;e&&e.type===`element`&&e.tagName===`p`?n=e:(n={type:`element`,tagName:`p`,properties:{},children:[]},r.unshift(n)),n.children.length>0&&n.children.unshift({type:`text`,value:` `}),n.children.unshift({type:`element`,tagName:`input`,properties:{type:`checkbox`,checked:t.checked,disabled:!0},children:[]}),a.className=[`task-list-item`]}let s=-1;for(;++s<r.length;){let e=r[s];(i||s!==0||e.type!==`element`||e.tagName!==`p`)&&o.push({type:`text`,value:`
|
|
26
26
|
`}),e.type===`element`&&e.tagName===`p`&&!i?o.push(...e.children):o.push(e)}let c=r[r.length-1];c&&(i||c.type!==`element`||c.tagName!==`p`)&&o.push({type:`text`,value:`
|
|
@@ -48,7 +48,7 @@ Error generating stack: `+e.message+`
|
|
|
48
48
|
`))}function c(e,t,n,r){let i=n.enter(`tableCell`),o=n.enter(`phrasing`),s=n.containerPhrasing(e,{...r,before:a,after:a});return o(),i(),s}function l(e,t){return tT(e,{align:t,alignDelimiters:r,padding:n,stringLength:i})}function u(e,t,n){let r=e.children,i=-1,a=[],o=t.enter(`table`);for(;++i<r.length;)a[i]=d(r[i],t,n);return o(),a}function d(e,t,n){let r=e.children,i=-1,a=[],o=t.enter(`tableRow`);for(;++i<r.length;)a[i]=c(r[i],e,t,n);return o(),a}function f(e,t,n){let r=QT.inlineCode(e,t,n);return n.stack.includes(`tableCell`)&&(r=r.replace(/\|/g,`\\$&`)),r}}function cE(){return{exit:{taskListCheckValueChecked:uE,taskListCheckValueUnchecked:uE,paragraph:dE}}}function lE(){return{unsafe:[{atBreak:!0,character:`-`,after:`[:|-]`}],handlers:{listItem:fE}}}function uE(e){let t=this.stack[this.stack.length-2];t.type,t.checked=e.type===`taskListCheckValueChecked`}function dE(e){let t=this.stack[this.stack.length-2];if(t&&t.type===`listItem`&&typeof t.checked==`boolean`){let e=this.stack[this.stack.length-1];e.type;let n=e.children[0];if(n&&n.type===`text`){let r=t.children,i=-1,a;for(;++i<r.length;){let e=r[i];if(e.type===`paragraph`){a=e;break}}a===e&&(n.value=n.value.slice(1),n.value.length===0?e.children.shift():e.position&&n.position&&typeof n.position.start.offset==`number`&&(n.position.start.column++,n.position.start.offset++,e.position.start=Object.assign({},n.position.start)))}}this.exit(e)}function fE(e,t,n,r){let i=e.children[0],a=typeof e.checked==`boolean`&&i&&i.type===`paragraph`,o=`[`+(e.checked?`x`:` `)+`] `,s=n.createTracker(r);a&&s.move(o);let c=QT.listItem(e,t,n,{...r,...s.current()});return a&&(c=c.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,l)),c;function l(e){return e+o}}function pE(){return[yw(),Uw(),Jw(),$T(),cE()]}function mE(e){return{extensions:[bw(),Ww(e),Yw(),sE(e),lE()]}}var hE={tokenize:kE,partial:!0},gE={tokenize:AE,partial:!0},_E={tokenize:jE,partial:!0},vE={tokenize:ME,partial:!0},yE={tokenize:NE,partial:!0},bE={name:`wwwAutolink`,tokenize:DE,previous:PE},xE={name:`protocolAutolink`,tokenize:OE,previous:FE},SE={name:`emailAutolink`,tokenize:EE,previous:IE},CE={};function wE(){return{text:CE}}for(var TE=48;TE<123;)CE[TE]=SE,TE++,TE===58?TE=65:TE===91&&(TE=97);CE[43]=SE,CE[45]=SE,CE[46]=SE,CE[95]=SE,CE[72]=[SE,xE],CE[104]=[SE,xE],CE[87]=[SE,bE],CE[119]=[SE,bE];function EE(e,t,n){let r=this,i,a;return o;function o(t){return!LE(t)||!IE.call(r,r.previous)||RE(r.events)?n(t):(e.enter(`literalAutolink`),e.enter(`literalAutolinkEmail`),s(t))}function s(t){return LE(t)?(e.consume(t),s):t===64?(e.consume(t),c):n(t)}function c(t){return t===46?e.check(yE,u,l)(t):t===45||t===95||vy(t)?(a=!0,e.consume(t),c):u(t)}function l(t){return e.consume(t),i=!0,c}function u(o){return a&&i&&_y(r.previous)?(e.exit(`literalAutolinkEmail`),e.exit(`literalAutolink`),t(o)):n(o)}}function DE(e,t,n){let r=this;return i;function i(t){return t!==87&&t!==119||!PE.call(r,r.previous)||RE(r.events)?n(t):(e.enter(`literalAutolink`),e.enter(`literalAutolinkWww`),e.check(hE,e.attempt(gE,e.attempt(_E,a),n),n)(t))}function a(n){return e.exit(`literalAutolinkWww`),e.exit(`literalAutolink`),t(n)}}function OE(e,t,n){let r=this,i=``,a=!1;return o;function o(t){return(t===72||t===104)&&FE.call(r,r.previous)&&!RE(r.events)?(e.enter(`literalAutolink`),e.enter(`literalAutolinkHttp`),i+=String.fromCodePoint(t),e.consume(t),s):n(t)}function s(t){if(_y(t)&&i.length<5)return i+=String.fromCodePoint(t),e.consume(t),s;if(t===58){let n=i.toLowerCase();if(n===`http`||n===`https`)return e.consume(t),c}return n(t)}function c(t){return t===47?(e.consume(t),a?l:(a=!0,c)):n(t)}function l(t){return t===null||by(t)||Ty(t)||Oy(t)||Dy(t)?n(t):e.attempt(gE,e.attempt(_E,u),n)(t)}function u(n){return e.exit(`literalAutolinkHttp`),e.exit(`literalAutolink`),t(n)}}function kE(e,t,n){let r=0;return i;function i(t){return(t===87||t===119)&&r<3?(r++,e.consume(t),i):t===46&&r===3?(e.consume(t),a):n(t)}function a(e){return e===null?n(e):t(e)}}function AE(e,t,n){let r,i,a;return o;function o(t){return t===46||t===95?e.check(vE,c,s)(t):t===null||Ty(t)||Oy(t)||t!==45&&Dy(t)?c(t):(a=!0,e.consume(t),o)}function s(t){return t===95?r=!0:(i=r,r=void 0),e.consume(t),o}function c(e){return i||r||!a?n(e):t(e)}}function jE(e,t){let n=0,r=0;return i;function i(o){return o===40?(n++,e.consume(o),i):o===41&&r<n?a(o):o===33||o===34||o===38||o===39||o===41||o===42||o===44||o===46||o===58||o===59||o===60||o===63||o===93||o===95||o===126?e.check(vE,t,a)(o):o===null||Ty(o)||Oy(o)?t(o):(e.consume(o),i)}function a(t){return t===41&&r++,e.consume(t),i}}function ME(e,t,n){return r;function r(o){return o===33||o===34||o===39||o===41||o===42||o===44||o===46||o===58||o===59||o===63||o===95||o===126?(e.consume(o),r):o===38?(e.consume(o),a):o===93?(e.consume(o),i):o===60||o===null||Ty(o)||Oy(o)?t(o):n(o)}function i(e){return e===null||e===40||e===91||Ty(e)||Oy(e)?t(e):r(e)}function a(e){return _y(e)?o(e):n(e)}function o(t){return t===59?(e.consume(t),r):_y(t)?(e.consume(t),o):n(t)}}function NE(e,t,n){return r;function r(t){return e.consume(t),i}function i(e){return vy(e)?n(e):t(e)}}function PE(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||Ty(e)}function FE(e){return!_y(e)}function IE(e){return!(e===47||LE(e))}function LE(e){return e===43||e===45||e===46||e===95||vy(e)}function RE(e){let t=e.length,n=!1;for(;t--;){let r=e[t][1];if((r.type===`labelLink`||r.type===`labelImage`)&&!r._balanced){n=!0;break}if(r._gfmAutolinkLiteralWalkedInto){n=!1;break}}return e.length>0&&!n&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),n}var zE={tokenize:qE,partial:!0};function BE(){return{document:{91:{name:`gfmFootnoteDefinition`,tokenize:WE,continuation:{tokenize:GE},exit:KE}},text:{91:{name:`gfmFootnoteCall`,tokenize:UE},93:{name:`gfmPotentialFootnoteCall`,add:`after`,tokenize:VE,resolveTo:HE}}}}function VE(e,t,n){let r=this,i=r.events.length,a=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]),o;for(;i--;){let e=r.events[i][1];if(e.type===`labelImage`){o=e;break}if(e.type===`gfmFootnoteCall`||e.type===`labelLink`||e.type===`label`||e.type===`image`||e.type===`link`)break}return s;function s(i){if(!o||!o._balanced)return n(i);let s=gy(r.sliceSerialize({start:o.end,end:r.now()}));return s.codePointAt(0)!==94||!a.includes(s.slice(1))?n(i):(e.enter(`gfmFootnoteCallLabelMarker`),e.consume(i),e.exit(`gfmFootnoteCallLabelMarker`),t(i))}}function HE(e,t){let n=e.length;for(;n--;)if(e[n][1].type===`labelImage`&&e[n][0]===`enter`){e[n][1];break}e[n+1][1].type=`data`,e[n+3][1].type=`gfmFootnoteCallLabelMarker`;let r={type:`gfmFootnoteCall`,start:Object.assign({},e[n+3][1].start),end:Object.assign({},e[e.length-1][1].end)},i={type:`gfmFootnoteCallMarker`,start:Object.assign({},e[n+3][1].end),end:Object.assign({},e[n+3][1].end)};i.end.column++,i.end.offset++,i.end._bufferIndex++;let a={type:`gfmFootnoteCallString`,start:Object.assign({},i.end),end:Object.assign({},e[e.length-1][1].start)},o={type:`chunkString`,contentType:`string`,start:Object.assign({},a.start),end:Object.assign({},a.end)},s=[e[n+1],e[n+2],[`enter`,r,t],e[n+3],e[n+4],[`enter`,i,t],[`exit`,i,t],[`enter`,a,t],[`enter`,o,t],[`exit`,o,t],[`exit`,a,t],e[e.length-2],e[e.length-1],[`exit`,r,t]];return e.splice(n,e.length-n+1,...s),e}function UE(e,t,n){let r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]),a=0,o;return s;function s(t){return e.enter(`gfmFootnoteCall`),e.enter(`gfmFootnoteCallLabelMarker`),e.consume(t),e.exit(`gfmFootnoteCallLabelMarker`),c}function c(t){return t===94?(e.enter(`gfmFootnoteCallMarker`),e.consume(t),e.exit(`gfmFootnoteCallMarker`),e.enter(`gfmFootnoteCallString`),e.enter(`chunkString`).contentType=`string`,l):n(t)}function l(s){if(a>999||s===93&&!o||s===null||s===91||Ty(s))return n(s);if(s===93){e.exit(`chunkString`);let a=e.exit(`gfmFootnoteCallString`);return i.includes(gy(r.sliceSerialize(a)))?(e.enter(`gfmFootnoteCallLabelMarker`),e.consume(s),e.exit(`gfmFootnoteCallLabelMarker`),e.exit(`gfmFootnoteCall`),t):n(s)}return Ty(s)||(o=!0),a++,e.consume(s),s===92?u:l}function u(t){return t===91||t===92||t===93?(e.consume(t),a++,l):l(t)}}function WE(e,t,n){let r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]),a,o=0,s;return c;function c(t){return e.enter(`gfmFootnoteDefinition`)._container=!0,e.enter(`gfmFootnoteDefinitionLabel`),e.enter(`gfmFootnoteDefinitionLabelMarker`),e.consume(t),e.exit(`gfmFootnoteDefinitionLabelMarker`),l}function l(t){return t===94?(e.enter(`gfmFootnoteDefinitionMarker`),e.consume(t),e.exit(`gfmFootnoteDefinitionMarker`),e.enter(`gfmFootnoteDefinitionLabelString`),e.enter(`chunkString`).contentType=`string`,u):n(t)}function u(t){if(o>999||t===93&&!s||t===null||t===91||Ty(t))return n(t);if(t===93){e.exit(`chunkString`);let n=e.exit(`gfmFootnoteDefinitionLabelString`);return a=gy(r.sliceSerialize(n)),e.enter(`gfmFootnoteDefinitionLabelMarker`),e.consume(t),e.exit(`gfmFootnoteDefinitionLabelMarker`),e.exit(`gfmFootnoteDefinitionLabel`),f}return Ty(t)||(s=!0),o++,e.consume(t),t===92?d:u}function d(t){return t===91||t===92||t===93?(e.consume(t),o++,u):u(t)}function f(t){return t===58?(e.enter(`definitionMarker`),e.consume(t),e.exit(`definitionMarker`),i.includes(a)||i.push(a),jy(e,p,`gfmFootnoteDefinitionWhitespace`)):n(t)}function p(e){return t(e)}}function GE(e,t,n){return e.check(Ky,t,e.attempt(zE,t,n))}function KE(e){e.exit(`gfmFootnoteDefinition`)}function qE(e,t,n){let r=this;return jy(e,i,`gfmFootnoteDefinitionIndent`,5);function i(e){let i=r.events[r.events.length-1];return i&&i[1].type===`gfmFootnoteDefinitionIndent`&&i[2].sliceSerialize(i[1],!0).length===4?t(e):n(e)}}function JE(e){let t=(e||{}).singleTilde,n={name:`strikethrough`,tokenize:i,resolveAll:r};return t??=!0,{text:{126:n},insideSpan:{null:[n]},attentionMarkers:{null:[126]}};function r(e,t){let n=-1;for(;++n<e.length;)if(e[n][0]===`enter`&&e[n][1].type===`strikethroughSequenceTemporary`&&e[n][1]._close){let r=n;for(;r--;)if(e[r][0]===`exit`&&e[r][1].type===`strikethroughSequenceTemporary`&&e[r][1]._open&&e[n][1].end.offset-e[n][1].start.offset===e[r][1].end.offset-e[r][1].start.offset){e[n][1].type=`strikethroughSequence`,e[r][1].type=`strikethroughSequence`;let i={type:`strikethrough`,start:Object.assign({},e[r][1].start),end:Object.assign({},e[n][1].end)},a={type:`strikethroughText`,start:Object.assign({},e[r][1].end),end:Object.assign({},e[n][1].start)},o=[[`enter`,i,t],[`enter`,e[r][1],t],[`exit`,e[r][1],t],[`enter`,a,t]],s=t.parser.constructs.insideSpan.null;s&&ly(o,o.length,0,zy(s,e.slice(r+1,n),t)),ly(o,o.length,0,[[`exit`,a,t],[`enter`,e[n][1],t],[`exit`,e[n][1],t],[`exit`,i,t]]),ly(e,r-1,n-r+3,o),n=r+o.length-2;break}}for(n=-1;++n<e.length;)e[n][1].type===`strikethroughSequenceTemporary`&&(e[n][1].type=`data`);return e}function i(e,n,r){let i=this.previous,a=this.events,o=0;return s;function s(t){return i===126&&a[a.length-1][1].type!==`characterEscape`?r(t):(e.enter(`strikethroughSequenceTemporary`),c(t))}function c(a){let s=Ry(i);if(a===126)return o>1?r(a):(e.consume(a),o++,c);if(o<2&&!t)return r(a);let l=e.exit(`strikethroughSequenceTemporary`),u=Ry(a);return l._open=!u||u===2&&!!s,l._close=!s||s===2&&!!u,n(a)}}}var YE=class{constructor(){this.map=[]}add(e,t,n){XE(this,e,t,n)}consume(e){if(this.map.sort(function(e,t){return e[0]-t[0]}),this.map.length===0)return;let t=this.map.length,n=[];for(;t>0;)--t,n.push(e.slice(this.map[t][0]+this.map[t][1]),this.map[t][2]),e.length=this.map[t][0];n.push(e.slice()),e.length=0;let r=n.pop();for(;r;){for(let t of r)e.push(t);r=n.pop()}this.map.length=0}};function XE(e,t,n,r){let i=0;if(!(n===0&&r.length===0)){for(;i<e.map.length;){if(e.map[i][0]===t){e.map[i][1]+=n,e.map[i][2].push(...r);return}i+=1}e.map.push([t,n,r])}}function ZE(e,t){let n=!1,r=[];for(;t<e.length;){let i=e[t];if(n){if(i[0]===`enter`)i[1].type===`tableContent`&&r.push(e[t+1][1].type===`tableDelimiterMarker`?`left`:`none`);else if(i[1].type===`tableContent`){if(e[t-1][1].type===`tableDelimiterMarker`){let e=r.length-1;r[e]=r[e]===`left`?`center`:`right`}}else if(i[1].type===`tableDelimiterRow`)break}else i[0]===`enter`&&i[1].type===`tableDelimiterRow`&&(n=!0);t+=1}return r}function QE(){return{flow:{null:{name:`table`,tokenize:$E,resolveAll:eD}}}}function $E(e,t,n){let r=this,i=0,a=0,o;return s;function s(e){let t=r.events.length-1;for(;t>-1;){let e=r.events[t][1].type;if(e===`lineEnding`||e===`linePrefix`)t--;else break}let i=t>-1?r.events[t][1].type:null,a=i===`tableHead`||i===`tableRow`?S:c;return a===S&&r.parser.lazy[r.now().line]?n(e):a(e)}function c(t){return e.enter(`tableHead`),e.enter(`tableRow`),l(t)}function l(e){return e===124?u(e):(o=!0,a+=1,u(e))}function u(t){return t===null?n(t):wy(t)?a>1?(a=0,r.interrupt=!0,e.exit(`tableRow`),e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),p):n(t):Ey(t)?jy(e,u,`whitespace`)(t):(a+=1,o&&(o=!1,i+=1),t===124?(e.enter(`tableCellDivider`),e.consume(t),e.exit(`tableCellDivider`),o=!0,u):(e.enter(`data`),d(t)))}function d(t){return t===null||t===124||Ty(t)?(e.exit(`data`),u(t)):(e.consume(t),t===92?f:d)}function f(t){return t===92||t===124?(e.consume(t),d):d(t)}function p(t){return r.interrupt=!1,r.parser.lazy[r.now().line]?n(t):(e.enter(`tableDelimiterRow`),o=!1,Ey(t)?jy(e,m,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):m(t))}function m(t){return t===45||t===58?g(t):t===124?(o=!0,e.enter(`tableCellDivider`),e.consume(t),e.exit(`tableCellDivider`),h):x(t)}function h(t){return Ey(t)?jy(e,g,`whitespace`)(t):g(t)}function g(t){return t===58?(a+=1,o=!0,e.enter(`tableDelimiterMarker`),e.consume(t),e.exit(`tableDelimiterMarker`),_):t===45?(a+=1,_(t)):t===null||wy(t)?b(t):x(t)}function _(t){return t===45?(e.enter(`tableDelimiterFiller`),v(t)):x(t)}function v(t){return t===45?(e.consume(t),v):t===58?(o=!0,e.exit(`tableDelimiterFiller`),e.enter(`tableDelimiterMarker`),e.consume(t),e.exit(`tableDelimiterMarker`),y):(e.exit(`tableDelimiterFiller`),y(t))}function y(t){return Ey(t)?jy(e,b,`whitespace`)(t):b(t)}function b(n){return n===124?m(n):n===null||wy(n)?!o||i!==a?x(n):(e.exit(`tableDelimiterRow`),e.exit(`tableHead`),t(n)):x(n)}function x(e){return n(e)}function S(t){return e.enter(`tableRow`),C(t)}function C(n){return n===124?(e.enter(`tableCellDivider`),e.consume(n),e.exit(`tableCellDivider`),C):n===null||wy(n)?(e.exit(`tableRow`),t(n)):Ey(n)?jy(e,C,`whitespace`)(n):(e.enter(`data`),w(n))}function w(t){return t===null||t===124||Ty(t)?(e.exit(`data`),C(t)):(e.consume(t),t===92?T:w)}function T(t){return t===92||t===124?(e.consume(t),w):w(t)}}function eD(e,t){let n=-1,r=!0,i=0,a=[0,0,0,0],o=[0,0,0,0],s=!1,c=0,l,u,d,f=new YE;for(;++n<e.length;){let p=e[n],m=p[1];p[0]===`enter`?m.type===`tableHead`?(s=!1,c!==0&&(nD(f,t,c,l,u),u=void 0,c=0),l={type:`table`,start:Object.assign({},m.start),end:Object.assign({},m.end)},f.add(n,0,[[`enter`,l,t]])):m.type===`tableRow`||m.type===`tableDelimiterRow`?(r=!0,d=void 0,a=[0,0,0,0],o=[0,n+1,0,0],s&&(s=!1,u={type:`tableBody`,start:Object.assign({},m.start),end:Object.assign({},m.end)},f.add(n,0,[[`enter`,u,t]])),i=m.type===`tableDelimiterRow`?2:u?3:1):i&&(m.type===`data`||m.type===`tableDelimiterMarker`||m.type===`tableDelimiterFiller`)?(r=!1,o[2]===0&&(a[1]!==0&&(o[0]=o[1],d=tD(f,t,a,i,void 0,d),a=[0,0,0,0]),o[2]=n)):m.type===`tableCellDivider`&&(r?r=!1:(a[1]!==0&&(o[0]=o[1],d=tD(f,t,a,i,void 0,d)),a=o,o=[a[1],n,0,0])):m.type===`tableHead`?(s=!0,c=n):m.type===`tableRow`||m.type===`tableDelimiterRow`?(c=n,a[1]===0?o[1]!==0&&(d=tD(f,t,o,i,n,d)):(o[0]=o[1],d=tD(f,t,a,i,n,d)),i=0):i&&(m.type===`data`||m.type===`tableDelimiterMarker`||m.type===`tableDelimiterFiller`)&&(o[3]=n)}for(c!==0&&nD(f,t,c,l,u),f.consume(t.events),n=-1;++n<t.events.length;){let e=t.events[n];e[0]===`enter`&&e[1].type===`table`&&(e[1]._align=ZE(t.events,n))}return e}function tD(e,t,n,r,i,a){let o=r===1?`tableHeader`:r===2?`tableDelimiter`:`tableData`;n[0]!==0&&(a.end=Object.assign({},rD(t.events,n[0])),e.add(n[0],0,[[`exit`,a,t]]));let s=rD(t.events,n[1]);if(a={type:o,start:Object.assign({},s),end:Object.assign({},s)},e.add(n[1],0,[[`enter`,a,t]]),n[2]!==0){let i=rD(t.events,n[2]),a=rD(t.events,n[3]),o={type:`tableContent`,start:Object.assign({},i),end:Object.assign({},a)};if(e.add(n[2],0,[[`enter`,o,t]]),r!==2){let r=t.events[n[2]],i=t.events[n[3]];if(r[1].end=Object.assign({},i[1].end),r[1].type=`chunkText`,r[1].contentType=`text`,n[3]>n[2]+1){let t=n[2]+1,r=n[3]-n[2]-1;e.add(t,r,[])}}e.add(n[3]+1,0,[[`exit`,o,t]])}return i!==void 0&&(a.end=Object.assign({},rD(t.events,i)),e.add(i,0,[[`exit`,a,t]]),a=void 0),a}function nD(e,t,n,r,i){let a=[],o=rD(t.events,n);i&&(i.end=Object.assign({},o),a.push([`exit`,i,t])),r.end=Object.assign({},o),a.push([`exit`,r,t]),e.add(n+1,0,a)}function rD(e,t){let n=e[t],r=n[0]===`enter`?`start`:`end`;return n[1][r]}var iD={name:`tasklistCheck`,tokenize:oD};function aD(){return{text:{91:iD}}}function oD(e,t,n){let r=this;return i;function i(t){return r.previous!==null||!r._gfmTasklistFirstContentOfListItem?n(t):(e.enter(`taskListCheck`),e.enter(`taskListCheckMarker`),e.consume(t),e.exit(`taskListCheckMarker`),a)}function a(t){return Ty(t)?(e.enter(`taskListCheckValueUnchecked`),e.consume(t),e.exit(`taskListCheckValueUnchecked`),o):t===88||t===120?(e.enter(`taskListCheckValueChecked`),e.consume(t),e.exit(`taskListCheckValueChecked`),o):n(t)}function o(t){return t===93?(e.enter(`taskListCheckMarker`),e.consume(t),e.exit(`taskListCheckMarker`),e.exit(`taskListCheck`),s):n(t)}function s(r){return wy(r)?t(r):Ey(r)?e.check({tokenize:sD},t,n)(r):n(r)}}function sD(e,t,n){return jy(e,r,`whitespace`);function r(e){return e===null?n(e):t(e)}}function cD(e){return fy([wE(),BE(),JE(e),QE(),aD()])}var lD={};function uD(e){let t=this,n=e||lD,r=t.data(),i=r.micromarkExtensions||=[],a=r.fromMarkdownExtensions||=[],o=r.toMarkdownExtensions||=[];i.push(cD(n)),a.push(pE()),o.push(mE(n))}function dD(e){pw(e,[/\r?\n|\r/g,fD])}function fD(){return{type:`break`}}function pD(){return function(e){dD(e)}}var mD=1e4,hD=200;function gD(e){let t=a_(e.payload),n=a_(e.message),r=o_(e.timestamp)??o_(t?.timestamp)??o_(n?.timestamp)??o_(e.created_at)??o_(t?.created_at)??o_(e.createdAt)??o_(t?.createdAt);return r&&!Number.isNaN(Date.parse(r))?r:null}function _D(e){if(!e)return null;let t=new Date(e);if(Number.isNaN(t.getTime()))return null;let n=new Date,r=t.toDateString()===n.toDateString(),i=t.getFullYear()===n.getFullYear(),a=r?{hour:`numeric`,minute:`2-digit`}:i?{month:`short`,day:`numeric`,hour:`numeric`,minute:`2-digit`}:{month:`short`,day:`numeric`,year:`numeric`,hour:`numeric`,minute:`2-digit`};return new Intl.DateTimeFormat(void 0,a).format(t)}function vD(e){if(e==null)return``;if(typeof e==`string`)return e;try{return JSON.stringify(e,null,2)}catch{return String(e)}}function yD(e){if(typeof e==`string`)return e;if(Array.isArray(e))return e.map(e=>{if(typeof e==`string`)return e;let t=a_(e);if(!t)return``;let n=o_(t.type);return n===`thinking`?``:n===`tool_use`?`[Tool: ${o_(t.name)??`tool`}]`:(o_(t.text)??o_(t.content)??o_(t.output))||``}).filter(Boolean).join(`
|
|
49
49
|
|
|
50
50
|
`);let t=a_(e);if(!t)return vD(e);let n=o_(t.type);return n===`thinking`?``:n===`tool_use`?`[Tool: ${o_(t.name)??`tool`}]`:yD(t.content)||yD(t.message)||(o_(t.text)??o_(t.output)??``)}function bD(e,t){let n=u_(e);if(n===`pi`)return`pi`;if(n===`grok`)return`grok`;let r=o_(e.type)??``,i=o_(a_(e.payload)?.type)??``;return r===`event_msg`||r===`response_item`||i?`codex`:n===`claude`||r===`tool_result`?`claude`:t===`pi`||t===`omp`?t:`log`}function xD(e,t,n,r,i){try{let a=JSON.parse(e),o=a_(a);if(!o)return{lineNumber:n,sourceKey:t,exactLineNumber:r,parsed:!0,raw:e,source:`json`,type:Array.isArray(a)?`array`:typeof a,prominence:`plain`,title:Array.isArray(a)?`JSON array`:`JSON value`,body:vD(a),details:[]};let s=a_(o.payload),c=a_(o.message),l=o_(o.type)??`unknown`,u=o_(s?.type),d=o_(o.role)??o_(c?.role)??o_(s?.role),f=gD(o),p=bD(o,i),m=SD(l,u??void 0,d??void 0),h=[u?`${l} / ${u}`:l,d].filter(Boolean),g=yD(c?.content)||yD(c?.message)||yD(s?.message)||yD(s?.content)||yD(s?.text)||o_(o.result)||o_(o.name)||yD(o.content)||yD(o.text);l===`tool_use`&&o_(o.name)&&(g=`[Tool: ${o_(o.name)}]`);let _=[{label:`uuid`,value:o_(o.uuid)??``},{label:`parent`,value:o_(o.parentUuid)??``},{label:`session`,value:o_(o.sessionId)??o_(s?.session_id)??``},{label:`cwd`,value:o_(o.cwd)??``},{label:`metadata`,value:vD(o.metadata??s?.metadata)},{label:`payload`,value:s?vD(s):``}].filter(e=>e.value);return{lineNumber:n,sourceKey:t,exactLineNumber:r,parsed:!0,raw:e,source:p,type:u?`${l}:${u}`:l,prominence:m,...d?{role:d}:{},...f?{timestamp:f}:{},title:h.join(` · `),...g?{body:g}:{},details:_}}catch{return{lineNumber:n,sourceKey:t,exactLineNumber:r,parsed:!1,raw:e,source:`text`,type:`plain`,prominence:`plain`,title:`Plain text`,body:e,details:[]}}}function SD(e,t,n){return n===`user`||n===`assistant`||e===`user`||e===`assistant`||t===`user_message`||t===`assistant_message`||t===`agent_message`||t===`message`?`message`:e===`tool_use`||e===`tool_result`||e===`result`||e.includes(`tool`)||t?.includes(`tool`)||t===`function_call`||t===`function_call_output`||t===`custom_tool_call_output`?`tool`:e===`plain`?`plain`:`system`}function CD(e){return e===`user`?`user`:e===`assistant`?`assistant`:e===`system`?`system`:e===`tool`?`tool`:`other`}function wD(e,t,n,r){let i=C_(e);if(!i)return[];let a=i.parsed?a_(i.raw):null,o=a?gD(a):null,s=i.events.map((i,a)=>({type:CD(i.role),kind:i.kind,content:i.text.trim(),raw:e,sourceKey:t,lineNumber:n,seq:a,exactLineNumber:r,...o?{timestamp:o}:{}})).filter(e=>e.content.length>0);return s.length>0?s:!i.parsed&&e.trim()?[{type:`other`,kind:`unknown`,content:e.trim(),raw:e,sourceKey:t,lineNumber:n,seq:0,exactLineNumber:r}]:[]}function TD(e){let t=[];for(let n of e){let e=t[t.length-1];e&&n.kind===`message`&&e.kind===`message`&&n.type===e.type&&n.content===e.content||t.push(n)}return t}function ED(e){return e.kind===`tool_call`||e.kind===`result`}function DD(e){let t=[],n=null;for(let r of e)(t.length===0||!ED(r)&&r.type!==n)&&(t.push([]),ED(r)||(n=r.type)),t[t.length-1].push(r);let r=[];for(let e=t.length-1;e>=0;e--){let n=!1;for(let i of t[e]){let e=!ED(i)&&!n;e&&(n=!0),r.push({entry:i,showRole:e})}}return r}function OD(e){return`${e.sourceKey}:${e.seq}`}function kD(e,t,n){return n?t?`Line ${e+1} · ${t}`:void 0:t}function AD(e,t,n){return _D(t)||(n?`Line ${e+1}`:`Entry`)}function jD(e){return e.type===`user`?`User`:e.type===`assistant`?`Assistant`:e.type===`system`?`System`:e.type===`tool`?`Tool`:`Log`}function MD(e){return e.type===`user`?`text-blue-400`:e.type===`assistant`?`text-emerald-400`:e.type===`system`?`text-yellow-400`:`text-muted`}function ND({entry:e}){let[t,n]=(0,x.useState)(!1),r=AD(e.lineNumber,e.timestamp,e.exactLineNumber),i=e.kind===`tool_call`?e.content:`Result`;return(0,G.jsxs)(`div`,{className:`rounded-md border border-border bg-surface/40`,children:[(0,G.jsxs)(`button`,{type:`button`,className:`flex w-full items-center justify-between gap-3 px-3 py-2 text-left text-xs text-muted hover:text-primary`,onClick:()=>n(e=>!e),"aria-expanded":t,children:[(0,G.jsxs)(`span`,{className:`min-w-0 truncate`,children:[(0,G.jsx)(`span`,{className:`mr-2 text-[10px] uppercase tracking-wide text-muted`,title:kD(e.lineNumber,e.timestamp,e.exactLineNumber),children:r}),i]}),(0,G.jsx)(`span`,{className:`shrink-0 text-[11px]`,children:t?`Hide`:`Show`})]}),t&&(0,G.jsx)(`pre`,{className:`max-h-80 overflow-auto border-t border-border px-3 py-2 whitespace-pre-wrap break-words text-xs leading-relaxed text-secondary`,children:e.content})]})}var PD={p:({children:e})=>(0,G.jsx)(`p`,{className:`my-2 first:mt-0 last:mb-0`,children:e}),a:({children:e,href:t})=>(0,G.jsx)(`a`,{href:t,target:`_blank`,rel:`noreferrer noopener`,className:`text-accent underline underline-offset-2 hover:text-primary`,children:e}),ul:({children:e})=>(0,G.jsx)(`ul`,{className:`my-2 list-disc space-y-1 pl-5`,children:e}),ol:({children:e})=>(0,G.jsx)(`ol`,{className:`my-2 list-decimal space-y-1 pl-5`,children:e}),li:({children:e})=>(0,G.jsx)(`li`,{className:`leading-6`,children:e}),h1:({children:e})=>(0,G.jsx)(`h1`,{className:`mb-1 mt-3 text-base font-semibold first:mt-0`,children:e}),h2:({children:e})=>(0,G.jsx)(`h2`,{className:`mb-1 mt-3 text-sm font-semibold first:mt-0`,children:e}),h3:({children:e})=>(0,G.jsx)(`h3`,{className:`mb-1 mt-3 text-sm font-semibold first:mt-0`,children:e}),strong:({children:e})=>(0,G.jsx)(`strong`,{className:`font-semibold text-primary`,children:e}),em:({children:e})=>(0,G.jsx)(`em`,{className:`italic`,children:e}),blockquote:({children:e})=>(0,G.jsx)(`blockquote`,{className:`my-2 border-l-2 border-border pl-3 text-secondary`,children:e}),hr:()=>(0,G.jsx)(`hr`,{className:`my-3 border-border`}),pre:({children:e})=>(0,G.jsx)(`pre`,{className:`my-2 overflow-x-auto rounded bg-base p-3 text-xs leading-relaxed text-secondary`,children:e}),code:({className:e,children:t})=>{let n=String(t??``);return(e?.includes(`language-`)??!1)||n.includes(`
|
|
51
|
-
`)?(0,G.jsx)(`code`,{className:e,children:t}):(0,G.jsx)(`code`,{className:`rounded bg-surface px-1 py-0.5 text-[0.9em] text-primary`,children:t})},table:({children:e})=>(0,G.jsx)(`div`,{className:`my-2 overflow-x-auto`,children:(0,G.jsx)(`table`,{className:`w-full border-collapse text-xs`,children:e})}),th:({children:e})=>(0,G.jsx)(`th`,{className:`border border-border px-2 py-1 text-left font-semibold`,children:e}),td:({children:e})=>(0,G.jsx)(`td`,{className:`border border-border px-2 py-1 align-top`,children:e})};function FD({content:e}){return(0,G.jsx)(`div`,{className:`min-w-0 break-words text-sm leading-6 text-primary [overflow-wrap:anywhere]`,children:(0,G.jsx)(ow,{remarkPlugins:[uD,pD],components:PD,children:e})})}function ID({entry:e,showRole:t=!0}){if(ED(e))return(0,G.jsx)(ND,{entry:e});let n=AD(e.lineNumber,e.timestamp,e.exactLineNumber);return(0,G.jsxs)(`article`,{className:`grid grid-cols-[5.75rem_minmax(0,1fr)] gap-3 pb-2 sm:grid-cols-[6.75rem_minmax(0,1fr)] ${t?`mt-4 border-t border-border/60 pt-4 first:mt-0 first:border-t-0 first:pt-0`:`pt-1`}`,children:[(0,G.jsxs)(`div`,{className:`select-none pt-0.5 text-right`,children:[t&&(0,G.jsx)(`div`,{className:`text-[11px] font-semibold uppercase tracking-wide ${MD(e)}`,children:jD(e)}),(0,G.jsx)(`div`,{className:`text-[10px] tabular-nums text-muted ${t?`mt-1`:``}`,title:kD(e.lineNumber,e.timestamp,e.exactLineNumber),children:n})]}),(0,G.jsx)(FD,{content:e.content})]})}function LD({entry:e}){let[t,n]=(0,x.useState)(!1),r=e.prominence===`system`||e.prominence===`plain`,i=e.prominence===`tool`&&!!(e.body&&e.body.length>160),a=_D(e.timestamp),o=r?`border-border/70 bg-surface/20 opacity-80`:e.prominence===`tool`?`border-border bg-surface/35`:`border-border bg-surface/50`,s=e.prominence===`message`?`bg-accent/15 text-accent`:`bg-surface text-muted`;return(0,G.jsx)(`article`,{className:`rounded-md border ${o}`,children:(0,G.jsxs)(`div`,{className:`grid grid-cols-[5.75rem_minmax(0,1fr)] gap-3 px-3 py-2 sm:grid-cols-[6.75rem_minmax(0,1fr)]`,children:[(0,G.jsx)(`div`,{className:`select-none text-right text-[11px] tabular-nums text-muted`,title:kD(e.lineNumber,e.timestamp,e.exactLineNumber),children:a??(e.exactLineNumber?`Line ${e.lineNumber+1}`:`Entry`)}),(0,G.jsxs)(`div`,{className:`min-w-0 space-y-2`,children:[(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,G.jsx)(`span`,{className:`rounded px-1.5 py-0.5 text-[10px] font-semibold uppercase tracking-wide ${s}`,children:e.source}),(0,G.jsx)(`span`,{className:`min-w-0 break-words text-xs font-semibold text-primary`,children:e.title})]}),e.body&&!i&&(0,G.jsx)(`pre`,{className:`whitespace-pre-wrap break-words rounded bg-base px-3 py-2 text-xs leading-relaxed text-secondary`,children:e.body}),e.body&&i&&(0,G.jsxs)(`div`,{className:`rounded bg-base px-3 py-2`,children:[(0,G.jsx)(`button`,{type:`button`,className:`select-none text-[11px] text-muted hover:text-primary`,"aria-expanded":t,onClick:()=>n(e=>!e),children:`Output`}),t&&(0,G.jsx)(`pre`,{className:`mt-2 max-h-80 overflow-auto whitespace-pre-wrap break-words text-xs leading-relaxed text-secondary`,children:e.body})]}),e.details.length>0&&(0,G.jsxs)(`details`,{className:`group`,children:[(0,G.jsx)(`summary`,{className:`cursor-pointer select-none text-[11px] text-muted hover:text-primary`,children:`Details`}),(0,G.jsx)(`div`,{className:`mt-2 space-y-2`,children:e.details.map(e=>(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`div`,{className:`mb-1 text-[10px] font-semibold uppercase tracking-wide text-muted`,children:e.label}),(0,G.jsx)(`pre`,{className:`max-h-72 overflow-auto whitespace-pre-wrap break-words rounded bg-base px-3 py-2 text-[11px] leading-relaxed text-muted`,children:e.value})]},e.label))})]})]})]})})}async function RD(e,t){let n=await fetch(e,{signal:t});if(!n.ok){let e=`Failed to load preview (HTTP ${n.status})`;try{let t=await n.json();t?.error&&(e=t.error)}catch{}throw Error(e)}return await n.json()}function zD({session:e,className:t=``,onStateChange:n}){let[r,i]=(0,x.useState)(!0),[a,o]=(0,x.useState)(!1),[s,c]=(0,x.useState)(null),[l,u]=(0,x.useState)(null),[d,f]=(0,x.useState)(`messages`),p=(0,x.useRef)(null),m=(0,x.useRef)(!1),h=(0,x.useRef)(!1);(0,x.useEffect)(()=>{let t=!1,n=new AbortController,r=setTimeout(()=>n.abort(),mD);return(async()=>{i(!0),c(null),u(null);try{let r=await RD(`/api/session-preview/${e.sessionId}?limit=${hD}`,n.signal);t||u(r)}catch(e){if(t)return;n.signal.aborted?c(`Preview timed out`):c(e instanceof Error?e.message:`Failed to load preview`)}finally{t||i(!1)}})(),()=>{t=!0,clearTimeout(r),n.abort()}},[e.sessionId]);let g=async()=>{if(!l||h.current||!l.hasMoreBefore)return;h.current=!0,m.current=!0;let t=new AbortController,n=setTimeout(()=>t.abort(),mD);o(!0),c(null);try{let n=new URLSearchParams({limit:String(hD)});typeof l.startByte==`number`?n.set(`beforeByte`,String(l.startByte)):n.set(`beforeLine`,String(l.startLine));let r=await RD(`/api/session-preview/${e.sessionId}?${n.toString()}`,t.signal);u(e=>e?{...e,totalLines:r.totalLines??e.totalLines,startLine:r.startLine,endLine:e.endLine,hasMoreBefore:r.hasMoreBefore,startByte:r.startByte,endByte:e.endByte,lines:[...r.lines,...e.lines],lineKeys:[...r.lineKeys??r.lines.map((e,t)=>String(r.startLine+t)),...e.lineKeys??e.lines.map((t,n)=>String(e.startLine+n))]}:r)}catch(e){m.current=!1,t.signal.aborted?c(`Preview timed out`):c(e instanceof Error?e.message:`Failed to load preview`)}finally{clearTimeout(n),h.current=!1,o(!1)}};(0,x.useEffect)(()=>{n?.({loading:r,error:s})},[s,r,n]),(0,x.useLayoutEffect)(()=>{if(!(!p.current||!l)){if(m.current){m.current=!1;return}p.current.scrollTop=0}},[l,d]);let _=(0,x.useMemo)(()=>l?.lines.flatMap((e,t)=>{let n=l.totalLines!==null,r=n?l.startLine+t:(l.startByte??0)+t;return wD(e,l.lineKeys?.[t]??String(r),r,n)})??[],[l]),v=(0,x.useMemo)(()=>l?.lines.map((e,t)=>{let n=l.totalLines!==null,r=n?l.startLine+t:(l.startByte??0)+t;return xD(e,l.lineKeys?.[t]??String(r),r,n,l.agentType)})??[],[l]),y=(0,x.useMemo)(()=>TD(_),[_]),b=(0,x.useMemo)(()=>DD(y),[y]),S=(0,x.useMemo)(()=>v.slice().reverse(),[v]),C=l?l.totalLines===0?`No transcript entries`:l.totalLines===null?`Showing ${l.lines.length} recent log entries`:`Showing ${l.lines.length} of ${l.totalLines} log entries`:`Derived from the saved session log.`;return(0,G.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-hidden rounded-xl border border-border bg-elevated ${t}`.trim(),children:[(0,G.jsxs)(`div`,{className:`flex flex-col gap-3 border-b border-border px-4 py-3 sm:flex-row sm:items-center sm:justify-between`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`h3`,{className:`text-sm font-semibold text-primary`,children:`Transcript`}),(0,G.jsx)(`p`,{className:`text-xs text-muted`,children:C})]}),(0,G.jsxs)(`div`,{className:`inline-flex w-fit rounded-md border border-border bg-base p-0.5`,children:[(0,G.jsx)(`button`,{type:`button`,onClick:()=>f(`messages`),className:`rounded px-2.5 py-1 text-xs transition-colors ${d===`messages`?`bg-accent text-white`:`text-muted hover:text-primary`}`,"aria-pressed":d===`messages`,children:`Messages`}),(0,G.jsx)(`button`,{type:`button`,onClick:()=>f(`events`),className:`rounded px-2.5 py-1 text-xs transition-colors ${d===`events`?`bg-accent text-white`:`text-muted hover:text-primary`}`,"aria-pressed":d===`events`,children:`Events`})]})]}),(0,G.jsxs)(`div`,{ref:p,className:`flex-1 overflow-y-auto p-4 font-mono text-xs`,children:[r&&(0,G.jsx)(`div`,{className:`flex items-center justify-center py-8 text-muted`,children:`Loading preview...`}),s&&(0,G.jsx)(`div`,{className:`flex items-center justify-center py-8 text-danger`,children:s}),l&&d===`messages`&&(0,G.jsxs)(`div`,{className:`mx-auto flex w-full max-w-4xl flex-col`,children:[b.length===0?(0,G.jsx)(`div`,{className:`py-8 text-center text-muted`,children:`No readable messages found. Try Events.`}):b.map(({entry:e,showRole:t})=>(0,G.jsx)(ID,{entry:e,showRole:t},OD(e))),l.hasMoreBefore&&(0,G.jsx)(`button`,{type:`button`,className:`btn mx-auto mt-3`,onClick:g,disabled:a,children:a?`Loading...`:`Load earlier`})]}),l&&d===`events`&&(0,G.jsxs)(`div`,{className:`mx-auto flex w-full max-w-5xl flex-col gap-2`,children:[(0,G.jsx)(`div`,{className:`space-y-2`,children:S.map(e=>(0,G.jsx)(LD,{entry:e},`${e.lineNumber}:${e.type}:${e.raw.slice(0,24)}`))}),l.hasMoreBefore&&(0,G.jsx)(`button`,{type:`button`,className:`btn mx-auto`,onClick:g,disabled:a,children:a?`Loading...`:`Load earlier`})]})]})]})}function BD({session:e,onClose:t,onResume:n}){let r=(0,x.useRef)(null),[i,a]=(0,x.useState)({loading:!0,error:null}),o=(0,x.useCallback)(()=>{i.loading||n(e.sessionId)},[i.loading,n,e.sessionId]);(0,x.useEffect)(()=>{let e=e=>{e.key===`Escape`?(e.stopPropagation(),t()):e.key===`Enter`&&(e.preventDefault(),o())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[o,t]),(0,x.useEffect)(()=>{r.current?.focus()},[]);let s=e.displayName||Lm(e.projectPath)||e.sessionId.slice(0,8),c=Im(e.lastActivityAt);return(0,G.jsx)(`div`,{role:`dialog`,"aria-modal":`true`,"aria-labelledby":`preview-title`,className:`fixed inset-0 z-50 flex items-center justify-center bg-black/60 p-4`,onClick:e=>{e.target===e.currentTarget&&t()},children:(0,G.jsxs)(`div`,{ref:r,tabIndex:-1,className:`flex max-h-[80vh] w-full max-w-2xl flex-col border border-border bg-elevated`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-3 border-b border-border px-4 py-3`,children:[(0,G.jsx)(oh,{agentType:e.agentType,className:`h-5 w-5 shrink-0 text-muted`}),(0,G.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,G.jsx)(`h2`,{id:`preview-title`,className:`truncate text-sm font-semibold text-primary`,children:s}),(0,G.jsxs)(`p`,{className:`truncate text-xs text-muted`,title:e.projectPath,children:[Lm(e.projectPath),` · `,c]})]})]}),(0,G.jsx)(zD,{session:e,className:`m-4 mt-0 flex-1 border-0 bg-transparent`,onStateChange:a}),(0,G.jsxs)(`div`,{className:`flex items-center justify-end gap-2 border-t border-border px-4 py-3`,children:[(0,G.jsx)(`button`,{type:`button`,onClick:t,className:`btn`,children:`Cancel`}),(0,G.jsx)(`button`,{type:`button`,onClick:o,className:`btn btn-primary`,disabled:i.loading,children:`Wake`})]})]})})}function VD({session:e,isSelected:t,showSessionIdPrefix:n,showProjectName:r,showLastUserMessage:i,onSelect:a,onWake:o,onRename:s,onMoveToHistory:c}){let l=Im(e.lastActivityAt),u=Lm(e.projectPath),d=e.displayName||u||e.sessionId.slice(0,8),f=r&&!!u,p=i&&!!e.lastUserMessage,m=n?zm(e.sessionId):``,h=(0,x.useRef)(null),g=(0,x.useRef)(null),[_,v]=(0,x.useState)(null),[y,b]=(0,x.useState)(!1),[S,C]=(0,x.useState)(d);(0,x.useEffect)(()=>{C(d)},[d]),(0,x.useEffect)(()=>{y&&g.current&&(g.current.focus(),g.current.select())},[y]);let w=()=>{let t=S.trim();t&&t!==d&&s?.(e.sessionId,t),b(!1)};return(0,x.useEffect)(()=>{if(!_)return;let e=e=>{h.current&&!h.current.contains(e.target)&&v(null)},t=e=>{e.key===`Escape`&&v(null)};return document.addEventListener(`mousedown`,e),document.addEventListener(`touchstart`,e),document.addEventListener(`keydown`,t),()=>{document.removeEventListener(`mousedown`,e),document.removeEventListener(`touchstart`,e),document.removeEventListener(`keydown`,t)}},[_]),(0,G.jsxs)(`div`,{className:`group relative cursor-pointer px-3 py-2 hover:bg-hover ${t?`bg-hover`:``}`,role:`button`,tabIndex:0,"data-testid":`hibernating-session-card`,"data-session-id":e.sessionId,onClick:()=>a(e.sessionId),onContextMenu:e=>{e.preventDefault(),e.stopPropagation(),v({x:e.clientX,y:e.clientY})},onKeyDown:t=>{(t.key===`Enter`||t.key===` `)&&(t.preventDefault(),a(e.sessionId))},children:[(0,G.jsxs)(`div`,{className:`flex flex-col gap-0.5 pl-2.5`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(oh,{agentType:e.agentType,className:`h-3.5 w-3.5 shrink-0 text-muted`}),y?(0,G.jsx)(`input`,{ref:g,type:`text`,value:S,onChange:e=>C(e.target.value),onBlur:w,onKeyDown:e=>{e.key===`Enter`?(e.preventDefault(),w()):e.key===`Escape`&&(e.preventDefault(),C(d),b(!1))},onClick:e=>e.stopPropagation(),className:`min-w-0 flex-1 rounded border border-border bg-surface px-1.5 py-0.5 text-sm font-medium text-primary outline-none focus:border-accent`}):(0,G.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-sm font-medium text-primary`,children:d}),(0,G.jsx)(Oe,{className:`h-3 w-3 shrink-0 text-muted`,"aria-label":`Hibernating`,title:`Hibernating`}),e.lastResumeError&&(0,G.jsx)(W,{className:`h-3 w-3 shrink-0 text-amber-500`,"aria-label":`Wake failed`,title:`Last wake failed: ${e.lastResumeError}`}),m&&(0,G.jsx)(`span`,{className:`shrink-0 text-[11px] font-mono text-muted`,title:e.sessionId,children:m}),(0,G.jsx)(`span`,{className:`ml-1 w-8 shrink-0 text-right text-xs tabular-nums text-muted`,children:l})]}),(f||p)&&(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1 pl-[1.375rem]`,children:[f&&(0,G.jsx)(Ng,{name:u,fullPath:e.projectPath}),p&&(0,G.jsxs)(`span`,{className:`line-clamp-2 text-xs italic text-muted`,children:[`"`,e.lastUserMessage.length>200?e.lastUserMessage.slice(0,200)+`...`:e.lastUserMessage,`"`]})]})]}),_&&(0,G.jsxs)(`div`,{ref:h,className:`fixed z-50 min-w-[160px] rounded-md border border-border bg-elevated shadow-lg py-1`,style:{left:_.x,top:_.y},role:`menu`,children:[o&&(0,G.jsxs)(`button`,{onClick:t=>{t.stopPropagation(),v(null),o(e.sessionId)},className:`w-full px-3 py-2 text-left text-sm text-secondary hover:bg-hover hover:text-primary flex items-center gap-2`,role:`menuitem`,children:[(0,G.jsx)(Me,{width:14,height:14}),`Wake`]}),s&&(0,G.jsxs)(`button`,{onClick:e=>{e.stopPropagation(),v(null),b(!0)},className:`w-full px-3 py-2 text-left text-sm text-secondary hover:bg-hover hover:text-primary flex items-center gap-2`,role:`menuitem`,children:[(0,G.jsx)(ge,{width:14,height:14}),`Rename`]}),e.logFilePath&&(0,G.jsxs)(`button`,{onClick:t=>{t.stopPropagation(),v(null),Bm(e.logFilePath)},className:`w-full px-3 py-2 text-left text-sm text-secondary hover:bg-hover hover:text-primary flex items-center gap-2`,role:`menuitem`,title:e.logFilePath,children:[(0,G.jsx)(ve,{width:14,height:14}),`Copy Log Path`]}),c&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`div`,{className:`my-1 border-t border-border`}),(0,G.jsxs)(`button`,{onClick:t=>{t.stopPropagation(),v(null),c(e.sessionId)},className:`w-full px-3 py-2 text-left text-sm text-danger hover:bg-danger/10 flex items-center gap-2`,role:`menuitem`,children:[(0,G.jsx)(We,{width:14,height:14}),`Move to History`]})]})]})]})}var HD={working:`bg-green-500/20 text-green-600`,waiting:`bg-zinc-500/20 text-zinc-400`,permission:`bg-amber-500/20 text-amber-600`,unknown:`bg-zinc-500/20 text-zinc-400`};function UD(){let[,e]=(0,x.useState)(0);(0,x.useEffect)(()=>{let t=setInterval(()=>e(e=>e+1),3e4);return()=>clearInterval(t)},[])}function WD({sessions:e,hibernatingSessions:t=[],historySessions:n=[],selectedSessionId:r,selectedHibernatingSessionId:i=null,loading:a,error:o,onSelect:s,onSelectHibernating:c,onRename:l,onResume:u,onHibernate:d,onKill:f,onDuplicate:p,onMoveToHistory:m,onNewSession:h}){UD();let g=(0,x.useMemo)(()=>typeof navigator>`u`?!1:/^((?!chrome|android).)*safari/i.test(navigator.userAgent),[]),[_,v]=(0,x.useState)(null),y=H(e=>e.historySessionsExpanded),b=H(e=>e.setHistorySessionsExpanded),S=H(e=>e.hibernatingSessionsExpanded),C=H(e=>e.setHibernatingSessionsExpanded),[w,T]=(0,x.useState)(null),[E,D]=(0,x.useState)(20),O=md(),k=g&&!O,A=(0,x.useMemo)(()=>[...t,...n],[t,n]);(0,x.useEffect)(()=>{y||D(20)},[y]);let[j,M]=Ym(e.length,200),[N,P]=Ym(n.length,200,!0),F=(0,x.useRef)(new Set(e.map(e=>e.id))),I=(0,x.useRef)(new Set([...t,...n].map(e=>e.sessionId))),[L,ee]=(0,x.useState)(new Set);(0,x.useEffect)(()=>{let r=new Set(e.map(e=>e.id)),i=new Set([...t,...n].map(e=>e.sessionId)),a=new Set;for(let e of r)F.current.has(e)||a.add(e);for(let t of e){let e=t.agentSessionId?.trim();e&&I.current.has(e)&&!i.has(e)&&a.add(t.id)}F.current=r,I.current=i,a.size>0&&ee(a)},[e,t,n]),(0,x.useEffect)(()=>{if(L.size===0)return;let e=setTimeout(()=>ee(new Set),500);return()=>clearTimeout(e)},[L]);let R=Xe(Je(H(e=>e.shortcutModifier))),z=H(e=>e.sessionSortMode),B=H(e=>e.setSessionSortMode),te=H(e=>e.sessionSortDirection),V=H(e=>e.manualSessionOrder),ne=H(e=>e.setManualSessionOrder),re=H(e=>e.showProjectName),U=H(e=>e.showLastUserMessage),ie=H(e=>e.showSessionIdPrefix),W=H(e=>e.projectFilters),ae=H(e=>e.setProjectFilters),se=H(e=>e.hostFilters),le=H(e=>e.setHostFilters),ue=Jm(e=>e.exitingSessions),de=Jm(e=>e.clearExitingSession),fe=Jm(e=>e.hostStatuses),pe=Jm(e=>e.remoteAllowControl);Xm(e,ue,de,200);let me=(0,x.useRef)(null);Qm(me,r??i,e=>e!==i||S),(0,x.useEffect)(()=>{if(V.length===0)return;let t=new Set;for(let n of e)t.add(jm(n)),t.add(n.id);for(let e of A)t.add(e.sessionId);let n=V.filter(e=>t.has(e));n.length!==V.length&&ne(n)},[e,A,V,ne]);let he=(0,x.useMemo)(()=>Nm(e,{mode:z,direction:te,manualOrder:V}),[e,z,te,V]),ge=(0,x.useMemo)(()=>Pm(e,A),[e,A]),_e=(0,x.useMemo)(()=>{let t=Fm(e,A),n=fe.map(e=>e.host),r=new Set,i=[];for(let e of n)!e||r.has(e)||(r.add(e),i.push(e));for(let e of t)!e||r.has(e)||(r.add(e),i.push(e));return i},[e,A,fe]),ve=(0,x.useMemo)(()=>_e.length>1,[_e]),ye=(0,x.useMemo)(()=>{let e=he;return W.length>0&&(e=e.filter(e=>W.includes(e.projectPath))),se.length>0&&(e=e.filter(e=>se.includes(e.host??``))),e},[he,W,se]),be=(0,x.useMemo)(()=>`${W.length===0?`all-projects`:W.join(`|`)}::${se.length===0?`all-hosts`:se.join(`|`)}`,[W,se]),xe=(0,x.useRef)(new Set(ye.map(e=>e.id))),[Se,Ce]=(0,x.useState)(new Set);(0,x.useEffect)(()=>{let e=new Set(ye.map(e=>e.id)),t=new Set;for(let n of e)xe.current.has(n)||L.has(n)||t.add(n);xe.current=e,t.size>0&&Ce(t)},[ye,L]),(0,x.useEffect)(()=>{if(Se.size===0)return;let e=setTimeout(()=>Ce(new Set),500);return()=>clearTimeout(e)},[Se]);let we=(0,x.useMemo)(()=>{let e=t;return W.length>0&&(e=e.filter(e=>W.includes(e.projectPath))),se.length>0&&(e=e.filter(e=>se.includes(e.host??``))),e},[t,W,se]),Te=(0,x.useMemo)(()=>{let e=n;return W.length>0&&(e=e.filter(e=>W.includes(e.projectPath))),se.length>0&&(e=e.filter(e=>se.includes(e.host??``))),e},[n,W,se]),Ee=(0,x.useMemo)(()=>{if(W.length===0)return 0;let t=new Set(W);return e.filter(e=>!t.has(e.projectPath)&&e.status===`permission`).length},[e,W]);(0,x.useEffect)(()=>{if(W.length===0||ge.length===0)return;let e=new Set(ge),t=W.filter(t=>e.has(t));t.length!==W.length&&ae(t)},[W,ge,ae]),(0,x.useEffect)(()=>{if(se.length===0||_e.length===0)return;let e=new Set(_e),t=se.filter(t=>e.has(t));t.length!==se.length&&le(t)},[se,_e,le]);let De=nf(tf(rp,{activationConstraint:{distance:8}})),[Oe,ke]=(0,x.useState)(null),[Ae,je]=(0,x.useState)(null),Me=(0,x.useCallback)(e=>{ke(e.active.id)},[]),Ne=(0,x.useCallback)(e=>{je(e.over?.id)},[]),Fe=(0,x.useCallback)(e=>{let{active:t,over:n}=e;if(ke(null),je(null),!n||t.id===n.id)return;let r=ye.findIndex(e=>e.id===t.id),i=ye.findIndex(e=>e.id===n.id);if(r===-1||i===-1)return;let a=ye.map(e=>jm(e)),[o]=a.splice(r,1);a.splice(i,0,o);let s=he.map(e=>jm(e)),c=new Set(a),l=0,u=s.map(e=>{if(!c.has(e))return e;let t=a[l];return l+=1,t});z!==`manual`&&B(`manual`),ne(u)},[ye,he,z,B,ne]),Ie=(0,x.useCallback)(()=>{ke(null),je(null)},[]);(0,x.useEffect)(()=>{if(!Oe&&!Ae)return;let e=new Set(ye.map(e=>e.id));Oe&&!e.has(Oe)&&ke(null),Ae&&!e.has(Ae)&&je(null)},[ye,Oe,Ae]);let Le=(e,t)=>{l(e,t),v(null)};return(0,G.jsxs)(`aside`,{className:`flex min-h-0 flex-1 flex-col border-r border-border bg-elevated`,children:[o&&(0,G.jsx)(`div`,{className:`shrink-0 border-b border-danger/30 bg-danger/10 px-3 py-2 text-xs text-danger`,children:o}),(0,G.jsxs)(`div`,{ref:me,className:`min-h-0 flex-1 overflow-y-auto scroll-pt-10`,children:[(0,G.jsxs)(`div`,{className:`sticky top-0 z-10 flex h-10 items-center justify-start gap-2 border-b border-border bg-elevated px-3`,children:[ve&&(0,G.jsx)(r_,{hosts:_e,selectedHosts:se,onSelect:le,statuses:fe}),(0,G.jsx)(i_,{projects:ge,selectedProjects:W,onSelect:ae,hasHiddenPermissions:Ee>0})]}),a?(0,G.jsx)(`div`,{className:`space-y-1 p-2`,children:[0,1,2].map(e=>(0,G.jsx)(`div`,{className:`h-14 animate-pulse rounded bg-surface`},e))}):(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between px-3 py-2 text-xs font-medium uppercase tracking-wider text-muted`,children:[(0,G.jsx)(`span`,{children:`Active`}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[ye.length===0&&h&&(0,G.jsxs)(`button`,{type:`button`,onClick:h,className:`flex items-center gap-1 rounded px-1.5 py-0.5 text-[11px] font-medium normal-case tracking-normal text-accent hover:bg-hover`,title:`Start a new session`,children:[(0,G.jsx)(Pe,{className:`h-3.5 w-3.5`}),`New session`]}),(0,G.jsx)(pd.span,{className:`w-8 text-right text-xs`,animate:j&&!O?{scale:[1,1.3,1]}:{},transition:{duration:.3},onAnimationComplete:M,children:ye.length})]})]}),ye.length>0&&(0,G.jsx)(em,{sensors:De,collisionDetection:uf,onDragStart:Me,onDragOver:Ne,onDragEnd:Fe,onDragCancel:Ie,children:(0,G.jsx)(bm,{items:ye.map(e=>e.id),strategy:gm,children:(0,G.jsx)(`div`,{children:(0,G.jsx)(eo,{initial:!1,mode:`sync`,children:ye.map((e,t)=>{let n=L.has(e.id),i=Se.has(e.id),a=e.remote===!0,o=e.source===`managed`,c=!a||pe&&o,l=!!(d&&!a&&o&&e.agentSessionId?.trim()),u=Oe?ye.findIndex(e=>e.id===Oe):-1,m=Ae===e.id&&Oe!==e.id?u>t?`above`:`below`:null;return(0,G.jsx)(GD,{session:e,isNew:n||i,exitDuration:200,prefersReducedMotion:O,useSafariLayoutFallback:k,isSelected:e.id===r,isEditing:e.id===_,showSessionIdPrefix:ie,showProjectName:re,showLastUserMessage:U,showHostInfo:ve,dropIndicator:m,onSelect:()=>s(e.id),onStartEdit:c?()=>v(e.id):void 0,onCancelEdit:()=>v(null),onRename:t=>Le(e.id,t),onHibernate:l?()=>d?.(e.agentSessionId.trim()):void 0,onKill:f&&c?()=>f(e.id,`session_list_context_menu`):void 0,onDuplicate:p&&c?()=>p(e.id):void 0},e.id)})})},be)})}),we.length>0&&(0,G.jsxs)(`div`,{className:`border-t border-border`,children:[(0,G.jsxs)(`button`,{type:`button`,onClick:()=>C(!S),className:`flex w-full items-center justify-between px-3 py-2 text-left text-xs font-medium uppercase tracking-wider text-muted hover:text-primary`,children:[(0,G.jsxs)(`span`,{className:`flex items-center gap-2`,children:[S?(0,G.jsx)(oe,{className:`h-4 w-4`}):(0,G.jsx)(ce,{className:`h-4 w-4`}),`Hibernating`]}),(0,G.jsx)(`span`,{className:`w-8 text-right text-xs text-muted`,children:we.length})]}),S&&(0,G.jsx)(`div`,{className:`py-1`,children:we.map(e=>(0,G.jsx)(VD,{session:e,isSelected:i===e.sessionId,showSessionIdPrefix:ie,showProjectName:re,showLastUserMessage:U,onSelect:e=>c?.(e),onWake:e=>u?.(e),onRename:(e,t)=>Le(e,t),onMoveToHistory:m},e.sessionId))})]})]}),Te.length>0&&(0,G.jsxs)(`div`,{className:`border-t border-border`,children:[(0,G.jsxs)(`button`,{type:`button`,onClick:()=>b(!y),className:`flex w-full items-center justify-between px-3 py-2 text-left text-xs font-medium uppercase tracking-wider text-muted hover:text-primary`,children:[(0,G.jsxs)(`span`,{className:`flex items-center gap-2`,children:[y?(0,G.jsx)(oe,{className:`h-4 w-4`}):(0,G.jsx)(ce,{className:`h-4 w-4`}),`History`]}),(0,G.jsx)(pd.span,{className:`w-8 text-right text-xs`,animate:N&&!O?{scale:[1,1.3,1]}:{},transition:{duration:.3},onAnimationComplete:P,children:Te.length})]}),y&&(0,G.jsxs)(`div`,{className:`py-1`,children:[Te.slice(0,E).map(e=>(0,G.jsx)(t_,{session:e,showSessionIdPrefix:ie,showProjectName:re,showLastUserMessage:U,onResume:e=>u?.(e),onPreview:T},e.sessionId)),Te.length>E&&(0,G.jsxs)(`button`,{type:`button`,onClick:()=>D(e=>e+20),className:`w-full px-3 py-2 text-center text-xs text-muted hover:text-primary hover:bg-hover`,children:[`Show more (`,Te.length-E,` remaining)`]})]})]})]}),(0,G.jsx)(`div`,{className:`hidden h-10 shrink-0 items-center border-t border-border px-4 md:flex`,children:(0,G.jsxs)(`div`,{className:`flex flex-wrap gap-x-3 gap-y-0.5 text-xs text-muted`,children:[(0,G.jsxs)(`span`,{children:[R,`[ ] nav`]}),(0,G.jsxs)(`span`,{children:[R,`N new`]}),(0,G.jsxs)(`span`,{children:[R,`X kill`]})]})}),w&&(0,G.jsx)(BD,{session:w,onClose:()=>T(null),onResume:e=>{T(null),u?.(e)}})]})}var GD=(0,x.forwardRef)(function({session:e,isNew:t,exitDuration:n,prefersReducedMotion:r,useSafariLayoutFallback:i,isSelected:a,isEditing:o,showSessionIdPrefix:s,showProjectName:c,showLastUserMessage:l,showHostInfo:u,dropIndicator:d,onSelect:f,onStartEdit:p,onCancelEdit:m,onRename:h,onHibernate:g,onKill:_,onDuplicate:v},y){let{attributes:b,listeners:S,setNodeRef:C,transform:w,transition:T,isDragging:E}=Om({id:e.id,animateLayoutChanges:({isSorting:e,wasDragging:t})=>e||t}),D=Bd.Transform.toString(w),O={...r&&D?{transform:D,transition:T}:{},zIndex:E?10:void 0,opacity:E?.9:void 0},k=(0,x.useCallback)(e=>{C(e),typeof y==`function`?y(e):y&&(y.current=e)},[C,y]);return(0,G.jsxs)(pd.div,{ref:k,"data-session-id":e.id,style:{...O,overflow:`hidden`},className:`relative`,transformTemplate:(e,t)=>Vm({useSafariLayoutFallback:i,isDragging:E,dndTransform:D,generatedTransform:t}),initial:r||!t?!1:i?{opacity:0}:{opacity:0,scale:.97},animate:r?{opacity:1}:t?i?{opacity:1}:{opacity:1,scale:[1.02,.99,1]}:{opacity:1,scale:1},exit:r?{opacity:0}:i?{opacity:0,height:0}:{opacity:0,height:0,scale:.97},transition:r?{duration:0}:i?{opacity:{duration:n/1e3},height:{duration:n/1e3,ease:`easeOut`}}:{opacity:{duration:n/1e3},scale:{duration:n/1e3,ease:[.34,1.56,.64,1]},height:{duration:n/1e3,ease:`easeOut`}},...b,...S,children:[d===`above`&&(0,G.jsx)(`div`,{className:`absolute -top-px left-3 right-3 h-0.5 border-t-2 border-dashed border-accent`}),(0,G.jsx)(KD,{session:e,isSelected:a,isEditing:o,showSessionIdPrefix:s,showProjectName:c,showLastUserMessage:l,showHostInfo:u,isDragging:E,onSelect:f,onStartEdit:p,onCancelEdit:m,onRename:h,onHibernate:g,onKill:_,onDuplicate:v}),d===`below`&&(0,G.jsx)(`div`,{className:`absolute -bottom-px left-3 right-3 h-0.5 border-t-2 border-dashed border-accent`})]})});GD.displayName=`SortableSessionItem`;function KD({session:e,isSelected:t,isEditing:n,showSessionIdPrefix:r,showProjectName:i,showLastUserMessage:a,showHostInfo:o,isDragging:s=!1,onSelect:c,onStartEdit:l,onCancelEdit:u,onRename:d,onHibernate:f,onKill:p,onDuplicate:m}){let h=Im(e.lastActivity),g=(0,x.useRef)(null),_=(0,x.useRef)(null),v=e.agentSessionName?.trim()||e.name?.trim()||e.id,[y,b]=(0,x.useState)(v),S=(0,x.useRef)(null),[C,w]=(0,x.useState)(null),T=Lm(e.projectPath),E=e.host?.trim(),D=e.status===`permission`,O=e.agentSessionId?.trim(),k=r&&O?zm(O):``,A=i&&!!T,j=o&&!!E,M=a&&!!e.lastUserMessage,N=(0,x.useRef)(e.status),[P,F]=(0,x.useState)(!1);(0,x.useEffect)(()=>{let t=N.current,n=e.status;t===`working`&&n===`waiting`?F(!0):N.current=n},[e.status]);let I=()=>{F(!1),N.current=e.status};(0,x.useEffect)(()=>{n&&g.current&&(g.current.focus(),g.current.select())},[n]),(0,x.useEffect)(()=>{b(v)},[v]);let L=()=>{let e=y.trim();e&&e!==v?d(e):u()},ee=e=>{e.key===`Enter`?(e.preventDefault(),L()):e.key===`Escape`&&(e.preventDefault(),b(v),u())},R=(0,x.useRef)(null),z=e=>{if(s)return;let t=e.touches[0];R.current={x:t.clientX,y:t.clientY},S.current=setTimeout(()=>{R.current&&w(R.current)},500)},B=()=>{S.current&&=(clearTimeout(S.current),null)};return(0,x.useEffect)(()=>{if(!C)return;let e=e=>{_.current&&!_.current.contains(e.target)&&w(null)},t=e=>{e.key===`Escape`&&w(null)};return document.addEventListener(`mousedown`,e),document.addEventListener(`touchstart`,e),document.addEventListener(`keydown`,t),()=>{document.removeEventListener(`mousedown`,e),document.removeEventListener(`touchstart`,e),document.removeEventListener(`keydown`,t)}},[C]),(0,G.jsxs)(`div`,{className:`session-row group cursor-pointer select-none px-3 py-2 ${t?`selected`:``} ${s?`cursor-grabbing shadow-lg ring-1 ring-accent/30 bg-elevated`:`cursor-grab`}`,role:`button`,tabIndex:0,"data-testid":`session-card`,"data-session-id":e.id,onClick:s?void 0:c,onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&c()},onContextMenu:e=>{e.preventDefault(),e.stopPropagation(),w({x:e.clientX,y:e.clientY})},onTouchStart:z,onTouchEnd:B,onTouchCancel:B,children:[(0,G.jsxs)(`div`,{className:`flex flex-col gap-0.5 pl-0.5`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(oh,{agentType:e.agentType,command:e.command,className:`h-3.5 w-3.5 shrink-0 text-muted`}),n?(0,G.jsx)(`input`,{ref:g,type:`text`,value:y,onChange:e=>b(e.target.value),onBlur:L,onKeyDown:ee,onClick:e=>e.stopPropagation(),className:`min-w-0 flex-1 rounded border border-border bg-surface px-1.5 py-0.5 text-sm font-medium text-primary outline-none focus:border-accent`}):(0,G.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-sm font-medium text-primary`,children:v}),k&&(0,G.jsx)(`span`,{className:`shrink-0 text-[11px] font-mono text-muted`,title:O,children:k}),D?(0,G.jsx)(`span`,{className:`ml-1 flex shrink-0 items-center justify-center rounded-full px-1.5 py-0.5 ${HD[e.status]} pulse-approval`,onAnimationEnd:I,children:(0,G.jsx)(Se,{className:`h-3 w-3`,"aria-label":`Needs input`})}):(0,G.jsx)(`span`,{className:`ml-1 shrink-0 rounded-full px-1.5 py-0.5 text-right text-xs tabular-nums ${HD[e.status]}${P?` pulse-complete`:``}`,onAnimationEnd:I,children:h})]}),(A||j||M)&&(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1 pl-[1.375rem]`,children:[j&&(0,G.jsx)(n_,{name:E}),A&&(0,G.jsx)(Ng,{name:T,fullPath:e.projectPath}),M&&(0,G.jsxs)(`span`,{className:`line-clamp-2 text-xs italic text-muted`,children:[`"`,e.lastUserMessage.length>200?e.lastUserMessage.slice(0,200)+`…`:e.lastUserMessage,`"`]})]}),e.prs&&e.prs.length>0&&(0,G.jsx)(e_,{prs:e.prs})]}),C&&(0,G.jsxs)(`div`,{ref:_,className:`fixed z-50 min-w-[160px] rounded-md border border-border bg-elevated shadow-lg py-1`,style:{left:C.x,top:C.y},role:`menu`,children:[l&&(0,G.jsxs)(`button`,{onClick:e=>{e.stopPropagation(),w(null),l()},className:`w-full px-3 py-2 text-left text-sm text-secondary hover:bg-hover hover:text-primary flex items-center gap-2`,role:`menuitem`,children:[(0,G.jsx)(ge,{width:14,height:14}),`Rename`]}),m&&(0,G.jsxs)(`button`,{onClick:e=>{e.stopPropagation(),w(null),m()},className:`w-full px-3 py-2 text-left text-sm text-secondary hover:bg-hover hover:text-primary flex items-center gap-2`,role:`menuitem`,title:`Create a copy in a new tmux window`,children:[(0,G.jsx)(ue,{width:14,height:14}),`Duplicate`]}),f&&(0,G.jsxs)(`button`,{onClick:e=>{e.stopPropagation(),w(null),f()},className:`w-full px-3 py-2 text-left text-sm text-secondary hover:bg-hover hover:text-primary flex items-center gap-2`,role:`menuitem`,title:`Close the live window and keep this session ready to wake`,children:[(0,G.jsx)(Oe,{width:14,height:14}),`Hibernate`]}),e.logFilePath&&(0,G.jsxs)(`button`,{onClick:t=>{t.stopPropagation(),w(null),e.logFilePath&&Bm(e.logFilePath)},className:`w-full px-3 py-2 text-left text-sm text-secondary hover:bg-hover hover:text-primary flex items-center gap-2`,role:`menuitem`,title:e.logFilePath,children:[(0,G.jsx)(ve,{width:14,height:14}),`Copy Log Path`]}),p&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`div`,{className:`my-1 border-t border-border`}),(0,G.jsxs)(`button`,{onClick:e=>{e.stopPropagation(),w(null),p()},className:`w-full px-3 py-2 text-left text-sm text-danger hover:bg-danger/10 flex items-center gap-2`,role:`menuitem`,children:[(0,G.jsx)(We,{width:14,height:14}),`Kill Session`]})]})]})]})}var qD={debug:0,info:1,warn:2,error:3},JD=`info`;function YD(e){let t=e.toLowerCase();t in qD&&(JD=t)}function XD(e,t,n=`debug`){if(!(qD[n]<qD[JD]))try{fetch(`/api/client-log`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({event:e,data:t,level:n})}).catch(()=>{})}catch{}}var ZD=Object.defineProperty,QD=Object.getOwnPropertyDescriptor,$D=(e,t)=>{for(var n in t)ZD(e,n,{get:t[n],enumerable:!0})},eO=(e,t,n,r)=>{for(var i=r>1?void 0:r?QD(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&&ZD(t,n,i),i},Z=(e,t)=>(n,r)=>t(n,r,e),tO=`Terminal input`,nO={get:()=>tO,set:e=>tO=e},rO=`Too much output to announce, navigate to rows manually to read`,iO={get:()=>rO,set:e=>rO=e};function aO(e){return e.replace(/\r?\n/g,`\r`)}function oO(e,t){return t?`\x1B[200~`+e+`\x1B[201~`:e}function sO(e,t){e.clipboardData&&e.clipboardData.setData(`text/plain`,t.selectionText),e.preventDefault()}function cO(e,t,n,r){e.stopPropagation(),e.clipboardData&&lO(e.clipboardData.getData(`text/plain`),t,n,r)}function lO(e,t,n,r){e=aO(e),e=oO(e,n.decPrivateModes.bracketedPasteMode&&r.rawOptions.ignoreBracketedPasteMode!==!0),n.triggerDataEvent(e,!0),t.value=``}function uO(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 dO(e,t,n,r,i){uO(e,t,n),i&&r.rightClickSelect(e),t.value=r.selectionText,t.select()}function fO(e){return e>65535?(e-=65536,String.fromCharCode((e>>10)+55296)+String.fromCharCode(e%1024+56320)):String.fromCharCode(e)}function pO(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 mO=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);continue}i!==65279&&(t[r++]=i)}return r}},hO=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}else 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){d--;continue}if(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}},gO=``,_O=` `,vO=class e{constructor(){this.fg=0,this.bg=0,this.extended=new yO}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)==0}isBgDefault(){return(this.bg&50331648)==0}isAttributeDefault(){return this.fg===0&&this.bg===0}getFgColor(){switch(this.fg&50331648){case 16777216:case 33554432:return this.fg&255;case 50331648:return this.fg&16777215;default:return-1}}getBgColor(){switch(this.bg&50331648){case 16777216:case 33554432:return this.bg&255;case 50331648:return this.bg&16777215;default:return-1}}hasExtendedAttrs(){return this.bg&268435456}updateExtended(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456}getUnderlineColor(){if(this.bg&268435456&&~this.extended.underlineColor)switch(this.extended.underlineColor&50331648){case 16777216:case 33554432:return this.extended.underlineColor&255;case 50331648:return this.extended.underlineColor&16777215;default:return this.getFgColor()}return this.getFgColor()}getUnderlineColorMode(){return this.bg&268435456&&~this.extended.underlineColor?this.extended.underlineColor&50331648:this.getFgColorMode()}isUnderlineColorRGB(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)==50331648:this.isFgRGB()}isUnderlineColorPalette(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)==16777216||(this.extended.underlineColor&50331648)==33554432:this.isFgPalette()}isUnderlineColorDefault(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)==0:this.isFgDefault()}getUnderlineStyle(){return this.fg&268435456?this.bg&268435456?this.extended.underlineStyle:1:0}getUnderlineVariantOffset(){return this.extended.underlineVariantOffset}},yO=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}},bO=class e extends vO{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new yO,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?fO(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()]}},xO=`di$target`,SO=`di$dependencies`,CO=new Map;function wO(e){return e[SO]||[]}function TO(e){if(CO.has(e))return CO.get(e);let t=function(e,n,r){if(arguments.length!==3)throw Error(`@IServiceName-decorator can only be used to decorate a parameter`);EO(t,e,r)};return t._id=e,CO.set(e,t),t}function EO(e,t,n){t[xO]===t?t[SO].push({id:e,index:n}):(t[SO]=[{id:e,index:n}],t[xO]=t)}var DO=TO(`BufferService`),OO=TO(`CoreMouseService`),kO=TO(`CoreService`),AO=TO(`CharsetService`),jO=TO(`InstantiationService`),MO=TO(`LogService`),NO=TO(`OptionsService`),PO=TO(`OscLinkService`),FO=TO(`UnicodeService`),IO=TO(`DecorationService`),LO=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 bO,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}else 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):RO(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)}};LO=eO([Z(0,DO),Z(1,NO),Z(2,PO)],LO);function RO(e,t){if(confirm(`Do you want to navigate to ${t}?
|
|
51
|
+
`)?(0,G.jsx)(`code`,{className:e,children:t}):(0,G.jsx)(`code`,{className:`rounded bg-surface px-1 py-0.5 text-[0.9em] text-primary`,children:t})},table:({children:e})=>(0,G.jsx)(`div`,{className:`my-2 overflow-x-auto`,children:(0,G.jsx)(`table`,{className:`w-full border-collapse text-xs`,children:e})}),th:({children:e})=>(0,G.jsx)(`th`,{className:`border border-border px-2 py-1 text-left font-semibold`,children:e}),td:({children:e})=>(0,G.jsx)(`td`,{className:`border border-border px-2 py-1 align-top`,children:e})};function FD({content:e}){return(0,G.jsx)(`div`,{className:`min-w-0 break-words text-sm leading-6 text-primary [overflow-wrap:anywhere]`,children:(0,G.jsx)(ow,{remarkPlugins:[uD,pD],components:PD,children:e})})}function ID({entry:e,showRole:t=!0}){if(ED(e))return(0,G.jsx)(ND,{entry:e});let n=AD(e.lineNumber,e.timestamp,e.exactLineNumber);return(0,G.jsxs)(`article`,{className:`grid grid-cols-[5.75rem_minmax(0,1fr)] gap-3 pb-2 sm:grid-cols-[6.75rem_minmax(0,1fr)] ${t?`mt-4 border-t border-border/60 pt-4 first:mt-0 first:border-t-0 first:pt-0`:`pt-1`}`,children:[(0,G.jsxs)(`div`,{className:`select-none pt-0.5 text-right`,children:[t&&(0,G.jsx)(`div`,{className:`text-[11px] font-semibold uppercase tracking-wide ${MD(e)}`,children:jD(e)}),(0,G.jsx)(`div`,{className:`text-[10px] tabular-nums text-muted ${t?`mt-1`:``}`,title:kD(e.lineNumber,e.timestamp,e.exactLineNumber),children:n})]}),(0,G.jsx)(FD,{content:e.content})]})}function LD({entry:e}){let[t,n]=(0,x.useState)(!1),r=e.prominence===`system`||e.prominence===`plain`,i=e.prominence===`tool`&&!!(e.body&&e.body.length>160),a=_D(e.timestamp),o=r?`border-border/70 bg-surface/20 opacity-80`:e.prominence===`tool`?`border-border bg-surface/35`:`border-border bg-surface/50`,s=e.prominence===`message`?`bg-accent/15 text-accent`:`bg-surface text-muted`;return(0,G.jsx)(`article`,{className:`rounded-md border ${o}`,children:(0,G.jsxs)(`div`,{className:`grid grid-cols-[5.75rem_minmax(0,1fr)] gap-3 px-3 py-2 sm:grid-cols-[6.75rem_minmax(0,1fr)]`,children:[(0,G.jsx)(`div`,{className:`select-none text-right text-[11px] tabular-nums text-muted`,title:kD(e.lineNumber,e.timestamp,e.exactLineNumber),children:a??(e.exactLineNumber?`Line ${e.lineNumber+1}`:`Entry`)}),(0,G.jsxs)(`div`,{className:`min-w-0 space-y-2`,children:[(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,G.jsx)(`span`,{className:`rounded px-1.5 py-0.5 text-[10px] font-semibold uppercase tracking-wide ${s}`,children:e.source}),(0,G.jsx)(`span`,{className:`min-w-0 break-words text-xs font-semibold text-primary`,children:e.title})]}),e.body&&!i&&(0,G.jsx)(`pre`,{className:`whitespace-pre-wrap break-words rounded bg-base px-3 py-2 text-xs leading-relaxed text-secondary`,children:e.body}),e.body&&i&&(0,G.jsxs)(`div`,{className:`rounded bg-base px-3 py-2`,children:[(0,G.jsx)(`button`,{type:`button`,className:`select-none text-[11px] text-muted hover:text-primary`,"aria-expanded":t,onClick:()=>n(e=>!e),children:`Output`}),t&&(0,G.jsx)(`pre`,{className:`mt-2 max-h-80 overflow-auto whitespace-pre-wrap break-words text-xs leading-relaxed text-secondary`,children:e.body})]}),e.details.length>0&&(0,G.jsxs)(`details`,{className:`group`,children:[(0,G.jsx)(`summary`,{className:`cursor-pointer select-none text-[11px] text-muted hover:text-primary`,children:`Details`}),(0,G.jsx)(`div`,{className:`mt-2 space-y-2`,children:e.details.map(e=>(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`div`,{className:`mb-1 text-[10px] font-semibold uppercase tracking-wide text-muted`,children:e.label}),(0,G.jsx)(`pre`,{className:`max-h-72 overflow-auto whitespace-pre-wrap break-words rounded bg-base px-3 py-2 text-[11px] leading-relaxed text-muted`,children:e.value})]},e.label))})]})]})]})})}async function RD(e,t){let n=await fetch(e,{signal:t});if(!n.ok){let e=`Failed to load preview (HTTP ${n.status})`;try{let t=await n.json();t?.error&&(e=t.error)}catch{}throw Error(e)}return await n.json()}function zD({session:e,className:t=``,onStateChange:n}){let[r,i]=(0,x.useState)(!0),[a,o]=(0,x.useState)(!1),[s,c]=(0,x.useState)(null),[l,u]=(0,x.useState)(null),[d,f]=(0,x.useState)(`messages`),p=(0,x.useRef)(null),m=(0,x.useRef)(!1),h=(0,x.useRef)(!1);(0,x.useEffect)(()=>{let t=!1,n=new AbortController,r=setTimeout(()=>n.abort(),mD);return(async()=>{i(!0),c(null),u(null);try{let r=await RD(`/api/session-preview/${e.sessionId}?limit=${hD}`,n.signal);t||u(r)}catch(e){if(t)return;n.signal.aborted?c(`Preview timed out`):c(e instanceof Error?e.message:`Failed to load preview`)}finally{t||i(!1)}})(),()=>{t=!0,clearTimeout(r),n.abort()}},[e.sessionId]);let g=async()=>{if(!l||h.current||!l.hasMoreBefore)return;h.current=!0,m.current=!0;let t=new AbortController,n=setTimeout(()=>t.abort(),mD);o(!0),c(null);try{let n=new URLSearchParams({limit:String(hD)});typeof l.startByte==`number`?n.set(`beforeByte`,String(l.startByte)):n.set(`beforeLine`,String(l.startLine));let r=await RD(`/api/session-preview/${e.sessionId}?${n.toString()}`,t.signal);u(e=>e?{...e,totalLines:r.totalLines??e.totalLines,startLine:r.startLine,endLine:e.endLine,hasMoreBefore:r.hasMoreBefore,startByte:r.startByte,endByte:e.endByte,lines:[...r.lines,...e.lines],lineKeys:[...r.lineKeys??r.lines.map((e,t)=>String(r.startLine+t)),...e.lineKeys??e.lines.map((t,n)=>String(e.startLine+n))]}:r)}catch(e){m.current=!1,t.signal.aborted?c(`Preview timed out`):c(e instanceof Error?e.message:`Failed to load preview`)}finally{clearTimeout(n),h.current=!1,o(!1)}};(0,x.useEffect)(()=>{n?.({loading:r,error:s})},[s,r,n]),(0,x.useLayoutEffect)(()=>{if(!(!p.current||!l)){if(m.current){m.current=!1;return}p.current.scrollTop=0}},[l,d]);let _=(0,x.useMemo)(()=>l?.lines.flatMap((e,t)=>{let n=l.totalLines!==null,r=n?l.startLine+t:(l.startByte??0)+t;return wD(e,l.lineKeys?.[t]??String(r),r,n)})??[],[l]),v=(0,x.useMemo)(()=>l?.lines.map((e,t)=>{let n=l.totalLines!==null,r=n?l.startLine+t:(l.startByte??0)+t;return xD(e,l.lineKeys?.[t]??String(r),r,n,l.agentType)})??[],[l]),y=(0,x.useMemo)(()=>TD(_),[_]),b=(0,x.useMemo)(()=>DD(y),[y]),S=(0,x.useMemo)(()=>v.slice().reverse(),[v]),C=l?l.totalLines===0?`No transcript entries`:l.totalLines===null?`Showing ${l.lines.length} recent log entries`:`Showing ${l.lines.length} of ${l.totalLines} log entries`:`Derived from the saved session log.`;return(0,G.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-hidden rounded-xl border border-border bg-elevated ${t}`.trim(),children:[(0,G.jsxs)(`div`,{className:`flex flex-col gap-3 border-b border-border px-4 py-3 sm:flex-row sm:items-center sm:justify-between`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`h3`,{className:`text-sm font-semibold text-primary`,children:`Transcript`}),(0,G.jsx)(`p`,{className:`text-xs text-muted`,children:C})]}),(0,G.jsxs)(`div`,{className:`inline-flex w-fit rounded-md border border-border bg-base p-0.5`,children:[(0,G.jsx)(`button`,{type:`button`,onClick:()=>f(`messages`),className:`rounded px-2.5 py-1 text-xs transition-colors ${d===`messages`?`bg-accent text-white`:`text-muted hover:text-primary`}`,"aria-pressed":d===`messages`,children:`Messages`}),(0,G.jsx)(`button`,{type:`button`,onClick:()=>f(`events`),className:`rounded px-2.5 py-1 text-xs transition-colors ${d===`events`?`bg-accent text-white`:`text-muted hover:text-primary`}`,"aria-pressed":d===`events`,children:`Events`})]})]}),(0,G.jsxs)(`div`,{ref:p,className:`flex-1 overflow-y-auto p-4 font-mono text-xs`,children:[r&&(0,G.jsx)(`div`,{className:`flex items-center justify-center py-8 text-muted`,children:`Loading preview...`}),s&&(0,G.jsx)(`div`,{className:`flex items-center justify-center py-8 text-danger`,children:s}),l&&d===`messages`&&(0,G.jsxs)(`div`,{className:`mx-auto flex w-full max-w-4xl flex-col`,children:[b.length===0?(0,G.jsx)(`div`,{className:`py-8 text-center text-muted`,children:`No readable messages found. Try Events.`}):b.map(({entry:e,showRole:t})=>(0,G.jsx)(ID,{entry:e,showRole:t},OD(e))),l.hasMoreBefore&&(0,G.jsx)(`button`,{type:`button`,className:`btn mx-auto mt-3`,onClick:g,disabled:a,children:a?`Loading...`:`Load earlier`})]}),l&&d===`events`&&(0,G.jsxs)(`div`,{className:`mx-auto flex w-full max-w-5xl flex-col gap-2`,children:[(0,G.jsx)(`div`,{className:`space-y-2`,children:S.map(e=>(0,G.jsx)(LD,{entry:e},`${e.lineNumber}:${e.type}:${e.raw.slice(0,24)}`))}),l.hasMoreBefore&&(0,G.jsx)(`button`,{type:`button`,className:`btn mx-auto`,onClick:g,disabled:a,children:a?`Loading...`:`Load earlier`})]})]})]})}function BD({session:e,onClose:t,onResume:n}){let r=(0,x.useRef)(null),[i,a]=(0,x.useState)({loading:!0,error:null}),o=(0,x.useCallback)(()=>{i.loading||n(e.sessionId)},[i.loading,n,e.sessionId]);(0,x.useEffect)(()=>{let e=e=>{e.key===`Escape`?(e.stopPropagation(),t()):e.key===`Enter`&&(e.preventDefault(),o())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[o,t]),(0,x.useEffect)(()=>{r.current?.focus()},[]);let s=e.displayName||Lm(e.projectPath)||e.sessionId.slice(0,8),c=Im(e.lastActivityAt);return(0,G.jsx)(`div`,{role:`dialog`,"aria-modal":`true`,"aria-labelledby":`preview-title`,className:`fixed inset-0 z-50 flex items-center justify-center bg-black/60 p-4`,onClick:e=>{e.target===e.currentTarget&&t()},children:(0,G.jsxs)(`div`,{ref:r,tabIndex:-1,className:`flex max-h-[80vh] w-full max-w-2xl flex-col border border-border bg-elevated`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-3 border-b border-border px-4 py-3`,children:[(0,G.jsx)(oh,{agentType:e.agentType,className:`h-5 w-5 shrink-0 text-muted`}),(0,G.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,G.jsx)(`h2`,{id:`preview-title`,className:`truncate text-sm font-semibold text-primary`,children:s}),(0,G.jsxs)(`p`,{className:`truncate text-xs text-muted`,title:e.projectPath,children:[Lm(e.projectPath),` · `,c]})]})]}),(0,G.jsx)(zD,{session:e,className:`m-4 mt-0 flex-1 border-0 bg-transparent`,onStateChange:a}),(0,G.jsxs)(`div`,{className:`flex items-center justify-end gap-2 border-t border-border px-4 py-3`,children:[(0,G.jsx)(`button`,{type:`button`,onClick:t,className:`btn`,children:`Cancel`}),(0,G.jsx)(`button`,{type:`button`,onClick:o,className:`btn btn-primary`,disabled:i.loading,children:`Wake`})]})]})})}function VD({session:e,isSelected:t,showSessionIdPrefix:n,showProjectName:r,showLastUserMessage:i,onSelect:a,onWake:o,onRename:s,onMoveToHistory:c}){let l=Im(e.lastActivityAt),u=Lm(e.projectPath),d=e.displayName||u||e.sessionId.slice(0,8),f=r&&!!u,p=i&&!!e.lastUserMessage,m=n?zm(e.sessionId):``,h=(0,x.useRef)(null),g=(0,x.useRef)(null),[_,v]=(0,x.useState)(null),[y,b]=(0,x.useState)(!1),[S,C]=(0,x.useState)(d);(0,x.useEffect)(()=>{C(d)},[d]),(0,x.useEffect)(()=>{y&&g.current&&(g.current.focus(),g.current.select())},[y]);let w=()=>{let t=S.trim();t&&t!==d&&s?.(e.sessionId,t),b(!1)};return(0,x.useEffect)(()=>{if(!_)return;let e=e=>{h.current&&!h.current.contains(e.target)&&v(null)},t=e=>{e.key===`Escape`&&v(null)};return document.addEventListener(`mousedown`,e),document.addEventListener(`touchstart`,e),document.addEventListener(`keydown`,t),()=>{document.removeEventListener(`mousedown`,e),document.removeEventListener(`touchstart`,e),document.removeEventListener(`keydown`,t)}},[_]),(0,G.jsxs)(`div`,{className:`group relative cursor-pointer px-3 py-2 hover:bg-hover ${t?`bg-hover`:``}`,role:`button`,tabIndex:0,"data-testid":`hibernating-session-card`,"data-session-id":e.sessionId,onClick:()=>a(e.sessionId),onContextMenu:e=>{e.preventDefault(),e.stopPropagation(),v({x:e.clientX,y:e.clientY})},onKeyDown:t=>{(t.key===`Enter`||t.key===` `)&&(t.preventDefault(),a(e.sessionId))},children:[(0,G.jsxs)(`div`,{className:`flex flex-col gap-0.5 pl-2.5`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(oh,{agentType:e.agentType,className:`h-3.5 w-3.5 shrink-0 text-muted`}),y?(0,G.jsx)(`input`,{ref:g,type:`text`,value:S,onChange:e=>C(e.target.value),onBlur:w,onKeyDown:e=>{e.key===`Enter`?(e.preventDefault(),w()):e.key===`Escape`&&(e.preventDefault(),C(d),b(!1))},onClick:e=>e.stopPropagation(),className:`min-w-0 flex-1 rounded border border-border bg-surface px-1.5 py-0.5 text-sm font-medium text-primary outline-none focus:border-accent`}):(0,G.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-sm font-medium text-primary`,children:d}),(0,G.jsx)(Oe,{className:`h-3 w-3 shrink-0 text-muted`,"aria-label":`Hibernating`,title:`Hibernating`}),e.lastResumeError&&(0,G.jsx)(ae,{className:`h-3 w-3 shrink-0 text-amber-500`,"aria-label":`Wake failed`,title:`Last wake failed: ${e.lastResumeError}`}),m&&(0,G.jsx)(`span`,{className:`shrink-0 text-[11px] font-mono text-muted`,title:e.sessionId,children:m}),(0,G.jsx)(`span`,{className:`ml-1 w-8 shrink-0 text-right text-xs tabular-nums text-muted`,children:l})]}),(f||p)&&(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1 pl-[1.375rem]`,children:[f&&(0,G.jsx)(Ng,{name:u,fullPath:e.projectPath}),p&&(0,G.jsxs)(`span`,{className:`line-clamp-2 text-xs italic text-muted`,children:[`"`,e.lastUserMessage.length>200?e.lastUserMessage.slice(0,200)+`...`:e.lastUserMessage,`"`]})]})]}),_&&(0,G.jsxs)(`div`,{ref:h,className:`fixed z-50 min-w-[160px] rounded-md border border-border bg-elevated shadow-lg py-1`,style:{left:_.x,top:_.y},role:`menu`,children:[o&&(0,G.jsxs)(`button`,{onClick:t=>{t.stopPropagation(),v(null),o(e.sessionId)},className:`w-full px-3 py-2 text-left text-sm text-secondary hover:bg-hover hover:text-primary flex items-center gap-2`,role:`menuitem`,children:[(0,G.jsx)(Me,{width:14,height:14}),`Wake`]}),s&&(0,G.jsxs)(`button`,{onClick:e=>{e.stopPropagation(),v(null),b(!0)},className:`w-full px-3 py-2 text-left text-sm text-secondary hover:bg-hover hover:text-primary flex items-center gap-2`,role:`menuitem`,children:[(0,G.jsx)(ge,{width:14,height:14}),`Rename`]}),e.logFilePath&&(0,G.jsxs)(`button`,{onClick:t=>{t.stopPropagation(),v(null),Bm(e.logFilePath)},className:`w-full px-3 py-2 text-left text-sm text-secondary hover:bg-hover hover:text-primary flex items-center gap-2`,role:`menuitem`,title:e.logFilePath,children:[(0,G.jsx)(ve,{width:14,height:14}),`Copy Log Path`]}),c&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`div`,{className:`my-1 border-t border-border`}),(0,G.jsxs)(`button`,{onClick:t=>{t.stopPropagation(),v(null),c(e.sessionId)},className:`w-full px-3 py-2 text-left text-sm text-danger hover:bg-danger/10 flex items-center gap-2`,role:`menuitem`,children:[(0,G.jsx)(We,{width:14,height:14}),`Move to History`]})]})]})]})}var HD={working:`bg-green-500/20 text-green-600`,waiting:`bg-zinc-500/20 text-zinc-400`,permission:`bg-amber-500/20 text-amber-600`,unknown:`bg-zinc-500/20 text-zinc-400`};function UD(){let[,e]=(0,x.useState)(0);(0,x.useEffect)(()=>{let t=setInterval(()=>e(e=>e+1),3e4);return()=>clearInterval(t)},[])}function WD({sessions:e,hibernatingSessions:t=[],historySessions:n=[],selectedSessionId:r,selectedHibernatingSessionId:i=null,loading:a,error:o,onSelect:s,onSelectHibernating:c,onRename:l,onResume:u,onHibernate:d,onKill:f,onDuplicate:p,onMoveToHistory:m,onNewSession:h,scrollSelectionActive:g=!0}){UD();let _=(0,x.useMemo)(()=>typeof navigator>`u`?!1:/^((?!chrome|android).)*safari/i.test(navigator.userAgent),[]),[v,y]=(0,x.useState)(null),b=U(e=>e.historySessionsExpanded),S=U(e=>e.setHistorySessionsExpanded),C=U(e=>e.hibernatingSessionsExpanded),w=U(e=>e.setHibernatingSessionsExpanded),[T,E]=(0,x.useState)(null),[D,O]=(0,x.useState)(20),k=md(),A=_&&!k,j=(0,x.useMemo)(()=>[...t,...n],[t,n]);(0,x.useEffect)(()=>{b||O(20)},[b]);let[M,N]=Ym(e.length,200),[P,F]=Ym(n.length,200,!0),I=(0,x.useRef)(new Set(e.map(e=>e.id))),L=(0,x.useRef)(new Set([...t,...n].map(e=>e.sessionId))),[R,z]=(0,x.useState)(new Set);(0,x.useEffect)(()=>{let r=new Set(e.map(e=>e.id)),i=new Set([...t,...n].map(e=>e.sessionId)),a=new Set;for(let e of r)I.current.has(e)||a.add(e);for(let t of e){let e=t.agentSessionId?.trim();e&&L.current.has(e)&&!i.has(e)&&a.add(t.id)}I.current=r,L.current=i,a.size>0&&z(a)},[e,t,n]),(0,x.useEffect)(()=>{if(R.size===0)return;let e=setTimeout(()=>z(new Set),500);return()=>clearTimeout(e)},[R]);let B=Xe(Je(U(e=>e.shortcutModifier))),V=U(e=>e.sessionSortMode),ee=U(e=>e.setSessionSortMode),H=U(e=>e.sessionSortDirection),te=U(e=>e.manualSessionOrder),ne=U(e=>e.setManualSessionOrder),re=U(e=>e.showProjectName),ie=U(e=>e.showLastUserMessage),ae=U(e=>e.showSessionIdPrefix),W=U(e=>e.projectFilters),se=U(e=>e.setProjectFilters),le=U(e=>e.hostFilters),ue=U(e=>e.setHostFilters),de=Jm(e=>e.exitingSessions),fe=Jm(e=>e.clearExitingSession),pe=Jm(e=>e.hostStatuses),me=Jm(e=>e.remoteAllowControl);Xm(e,de,fe,200);let he=(0,x.useRef)(null);Qm(he,r??i,e=>e!==i||C,g),(0,x.useEffect)(()=>{if(te.length===0)return;let t=new Set;for(let n of e)t.add(jm(n)),t.add(n.id);for(let e of j)t.add(e.sessionId);let n=te.filter(e=>t.has(e));n.length!==te.length&&ne(n)},[e,j,te,ne]);let ge=(0,x.useMemo)(()=>Nm(e,{mode:V,direction:H,manualOrder:te}),[e,V,H,te]),_e=(0,x.useMemo)(()=>Pm(e,j),[e,j]),ve=(0,x.useMemo)(()=>{let t=Fm(e,j),n=pe.map(e=>e.host),r=new Set,i=[];for(let e of n)!e||r.has(e)||(r.add(e),i.push(e));for(let e of t)!e||r.has(e)||(r.add(e),i.push(e));return i},[e,j,pe]),ye=(0,x.useMemo)(()=>ve.length>1,[ve]),be=(0,x.useMemo)(()=>{let e=ge;return W.length>0&&(e=e.filter(e=>W.includes(e.projectPath))),le.length>0&&(e=e.filter(e=>le.includes(e.host??``))),e},[ge,W,le]),xe=(0,x.useMemo)(()=>`${W.length===0?`all-projects`:W.join(`|`)}::${le.length===0?`all-hosts`:le.join(`|`)}`,[W,le]),Se=(0,x.useRef)(new Set(be.map(e=>e.id))),[Ce,we]=(0,x.useState)(new Set);(0,x.useEffect)(()=>{let e=new Set(be.map(e=>e.id)),t=new Set;for(let n of e)Se.current.has(n)||R.has(n)||t.add(n);Se.current=e,t.size>0&&we(t)},[be,R]),(0,x.useEffect)(()=>{if(Ce.size===0)return;let e=setTimeout(()=>we(new Set),500);return()=>clearTimeout(e)},[Ce]);let Te=(0,x.useMemo)(()=>{let e=t;return W.length>0&&(e=e.filter(e=>W.includes(e.projectPath))),le.length>0&&(e=e.filter(e=>le.includes(e.host??``))),e},[t,W,le]),Ee=(0,x.useMemo)(()=>{let e=n;return W.length>0&&(e=e.filter(e=>W.includes(e.projectPath))),le.length>0&&(e=e.filter(e=>le.includes(e.host??``))),e},[n,W,le]),De=(0,x.useMemo)(()=>{if(W.length===0)return 0;let t=new Set(W);return e.filter(e=>!t.has(e.projectPath)&&e.status===`permission`).length},[e,W]);(0,x.useEffect)(()=>{if(W.length===0||_e.length===0)return;let e=new Set(_e),t=W.filter(t=>e.has(t));t.length!==W.length&&se(t)},[W,_e,se]),(0,x.useEffect)(()=>{if(le.length===0||ve.length===0)return;let e=new Set(ve),t=le.filter(t=>e.has(t));t.length!==le.length&&ue(t)},[le,ve,ue]);let Oe=nf(tf(rp,{activationConstraint:{distance:8}})),[ke,Ae]=(0,x.useState)(null),[je,Me]=(0,x.useState)(null),Ne=(0,x.useCallback)(e=>{Ae(e.active.id)},[]),Fe=(0,x.useCallback)(e=>{Me(e.over?.id)},[]),Ie=(0,x.useCallback)(e=>{let{active:t,over:n}=e;if(Ae(null),Me(null),!n||t.id===n.id)return;let r=be.findIndex(e=>e.id===t.id),i=be.findIndex(e=>e.id===n.id);if(r===-1||i===-1)return;let a=be.map(e=>jm(e)),[o]=a.splice(r,1);a.splice(i,0,o);let s=ge.map(e=>jm(e)),c=new Set(a),l=0,u=s.map(e=>{if(!c.has(e))return e;let t=a[l];return l+=1,t});V!==`manual`&&ee(`manual`),ne(u)},[be,ge,V,ee,ne]),Le=(0,x.useCallback)(()=>{Ae(null),Me(null)},[]);(0,x.useEffect)(()=>{if(!ke&&!je)return;let e=new Set(be.map(e=>e.id));ke&&!e.has(ke)&&Ae(null),je&&!e.has(je)&&Me(null)},[be,ke,je]);let Re=(e,t)=>{l(e,t),y(null)};return(0,G.jsxs)(`aside`,{className:`flex min-h-0 flex-1 flex-col border-r border-border bg-elevated`,children:[o&&(0,G.jsx)(`div`,{className:`shrink-0 border-b border-danger/30 bg-danger/10 px-3 py-2 text-xs text-danger`,children:o}),(0,G.jsxs)(`div`,{ref:he,className:`min-h-0 flex-1 overflow-y-auto scroll-pt-10`,children:[(0,G.jsxs)(`div`,{className:`sticky top-0 z-10 flex h-10 items-center justify-start gap-2 border-b border-border bg-elevated px-3`,children:[ye&&(0,G.jsx)(r_,{hosts:ve,selectedHosts:le,onSelect:ue,statuses:pe}),(0,G.jsx)(i_,{projects:_e,selectedProjects:W,onSelect:se,hasHiddenPermissions:De>0})]}),a?(0,G.jsx)(`div`,{className:`space-y-1 p-2`,children:[0,1,2].map(e=>(0,G.jsx)(`div`,{className:`h-14 animate-pulse rounded bg-surface`},e))}):(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between px-3 py-2 text-xs font-medium uppercase tracking-wider text-muted`,children:[(0,G.jsx)(`span`,{children:`Active`}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[be.length===0&&h&&(0,G.jsxs)(`button`,{type:`button`,onClick:h,className:`flex items-center gap-1 rounded px-1.5 py-0.5 text-[11px] font-medium normal-case tracking-normal text-accent hover:bg-hover`,title:`Start a new session`,children:[(0,G.jsx)(Pe,{className:`h-3.5 w-3.5`}),`New session`]}),(0,G.jsx)(pd.span,{className:`w-8 text-right text-xs`,animate:M&&!k?{scale:[1,1.3,1]}:{},transition:{duration:.3},onAnimationComplete:N,children:be.length})]})]}),be.length>0&&(0,G.jsx)(em,{sensors:Oe,collisionDetection:uf,onDragStart:Ne,onDragOver:Fe,onDragEnd:Ie,onDragCancel:Le,children:(0,G.jsx)(bm,{items:be.map(e=>e.id),strategy:gm,children:(0,G.jsx)(`div`,{children:(0,G.jsx)(eo,{initial:!1,mode:`sync`,children:be.map((e,t)=>{let n=R.has(e.id),i=Ce.has(e.id),a=e.remote===!0,o=e.source===`managed`,c=!a||me&&o,l=!!(d&&!a&&o&&e.agentSessionId?.trim()),u=ke?be.findIndex(e=>e.id===ke):-1,m=je===e.id&&ke!==e.id?u>t?`above`:`below`:null;return(0,G.jsx)(GD,{session:e,isNew:n||i,exitDuration:200,prefersReducedMotion:k,useSafariLayoutFallback:A,isSelected:e.id===r,isEditing:e.id===v,showSessionIdPrefix:ae,showProjectName:re,showLastUserMessage:ie,showHostInfo:ye,dropIndicator:m,onSelect:()=>s(e.id),onStartEdit:c?()=>y(e.id):void 0,onCancelEdit:()=>y(null),onRename:t=>Re(e.id,t),onHibernate:l?()=>d?.(e.agentSessionId.trim()):void 0,onKill:f&&c?()=>f(e.id,`session_list_context_menu`):void 0,onDuplicate:p&&c?()=>p(e.id):void 0},e.id)})})},xe)})}),Te.length>0&&(0,G.jsxs)(`div`,{className:`border-t border-border`,children:[(0,G.jsxs)(`button`,{type:`button`,onClick:()=>w(!C),className:`flex w-full items-center justify-between px-3 py-2 text-left text-xs font-medium uppercase tracking-wider text-muted hover:text-primary`,children:[(0,G.jsxs)(`span`,{className:`flex items-center gap-2`,children:[C?(0,G.jsx)(oe,{className:`h-4 w-4`}):(0,G.jsx)(ce,{className:`h-4 w-4`}),`Hibernating`]}),(0,G.jsx)(`span`,{className:`w-8 text-right text-xs text-muted`,children:Te.length})]}),C&&(0,G.jsx)(`div`,{className:`py-1`,children:Te.map(e=>(0,G.jsx)(VD,{session:e,isSelected:i===e.sessionId,showSessionIdPrefix:ae,showProjectName:re,showLastUserMessage:ie,onSelect:e=>c?.(e),onWake:e=>u?.(e),onRename:(e,t)=>Re(e,t),onMoveToHistory:m},e.sessionId))})]})]}),Ee.length>0&&(0,G.jsxs)(`div`,{className:`border-t border-border`,children:[(0,G.jsxs)(`button`,{type:`button`,onClick:()=>S(!b),className:`flex w-full items-center justify-between px-3 py-2 text-left text-xs font-medium uppercase tracking-wider text-muted hover:text-primary`,children:[(0,G.jsxs)(`span`,{className:`flex items-center gap-2`,children:[b?(0,G.jsx)(oe,{className:`h-4 w-4`}):(0,G.jsx)(ce,{className:`h-4 w-4`}),`History`]}),(0,G.jsx)(pd.span,{className:`w-8 text-right text-xs`,animate:P&&!k?{scale:[1,1.3,1]}:{},transition:{duration:.3},onAnimationComplete:F,children:Ee.length})]}),b&&(0,G.jsxs)(`div`,{className:`py-1`,children:[Ee.slice(0,D).map(e=>(0,G.jsx)(t_,{session:e,showSessionIdPrefix:ae,showProjectName:re,showLastUserMessage:ie,onResume:e=>u?.(e),onPreview:E},e.sessionId)),Ee.length>D&&(0,G.jsxs)(`button`,{type:`button`,onClick:()=>O(e=>e+20),className:`w-full px-3 py-2 text-center text-xs text-muted hover:text-primary hover:bg-hover`,children:[`Show more (`,Ee.length-D,` remaining)`]})]})]})]}),(0,G.jsx)(`div`,{className:`hidden h-10 shrink-0 items-center border-t border-border px-4 md:flex`,children:(0,G.jsxs)(`div`,{className:`flex flex-wrap gap-x-3 gap-y-0.5 text-xs text-muted`,children:[(0,G.jsxs)(`span`,{children:[B,`[ ] nav`]}),(0,G.jsxs)(`span`,{children:[B,`N new`]}),(0,G.jsxs)(`span`,{children:[B,`X kill`]})]})}),T&&(0,G.jsx)(BD,{session:T,onClose:()=>E(null),onResume:e=>{E(null),u?.(e)}})]})}var GD=(0,x.forwardRef)(function({session:e,isNew:t,exitDuration:n,prefersReducedMotion:r,useSafariLayoutFallback:i,isSelected:a,isEditing:o,showSessionIdPrefix:s,showProjectName:c,showLastUserMessage:l,showHostInfo:u,dropIndicator:d,onSelect:f,onStartEdit:p,onCancelEdit:m,onRename:h,onHibernate:g,onKill:_,onDuplicate:v},y){let{attributes:b,listeners:S,setNodeRef:C,transform:w,transition:T,isDragging:E}=Om({id:e.id,animateLayoutChanges:({isSorting:e,wasDragging:t})=>e||t}),D=Bd.Transform.toString(w),O={...r&&D?{transform:D,transition:T}:{},zIndex:E?10:void 0,opacity:E?.9:void 0},k=(0,x.useCallback)(e=>{C(e),typeof y==`function`?y(e):y&&(y.current=e)},[C,y]);return(0,G.jsxs)(pd.div,{ref:k,"data-session-id":e.id,style:{...O,overflow:`hidden`},className:`relative`,transformTemplate:(e,t)=>Vm({useSafariLayoutFallback:i,isDragging:E,dndTransform:D,generatedTransform:t}),initial:r||!t?!1:i?{opacity:0}:{opacity:0,scale:.97},animate:r?{opacity:1}:t?i?{opacity:1}:{opacity:1,scale:[1.02,.99,1]}:{opacity:1,scale:1},exit:r?{opacity:0}:i?{opacity:0,height:0}:{opacity:0,height:0,scale:.97},transition:r?{duration:0}:i?{opacity:{duration:n/1e3},height:{duration:n/1e3,ease:`easeOut`}}:{opacity:{duration:n/1e3},scale:{duration:n/1e3,ease:[.34,1.56,.64,1]},height:{duration:n/1e3,ease:`easeOut`}},...b,...S,children:[d===`above`&&(0,G.jsx)(`div`,{className:`absolute -top-px left-3 right-3 h-0.5 border-t-2 border-dashed border-accent`}),(0,G.jsx)(KD,{session:e,isSelected:a,isEditing:o,showSessionIdPrefix:s,showProjectName:c,showLastUserMessage:l,showHostInfo:u,isDragging:E,onSelect:f,onStartEdit:p,onCancelEdit:m,onRename:h,onHibernate:g,onKill:_,onDuplicate:v}),d===`below`&&(0,G.jsx)(`div`,{className:`absolute -bottom-px left-3 right-3 h-0.5 border-t-2 border-dashed border-accent`})]})});GD.displayName=`SortableSessionItem`;function KD({session:e,isSelected:t,isEditing:n,showSessionIdPrefix:r,showProjectName:i,showLastUserMessage:a,showHostInfo:o,isDragging:s=!1,onSelect:c,onStartEdit:l,onCancelEdit:u,onRename:d,onHibernate:f,onKill:p,onDuplicate:m}){let h=Im(e.lastActivity),g=(0,x.useRef)(null),_=(0,x.useRef)(null),v=e.agentSessionName?.trim()||e.name?.trim()||e.id,[y,b]=(0,x.useState)(v),S=(0,x.useRef)(null),[C,w]=(0,x.useState)(null),T=Lm(e.projectPath),E=e.host?.trim(),D=e.status===`permission`,O=e.agentSessionId?.trim(),k=r&&O?zm(O):``,A=i&&!!T,j=o&&!!E,M=a&&!!e.lastUserMessage,N=(0,x.useRef)(e.status),[P,F]=(0,x.useState)(!1);(0,x.useEffect)(()=>{let t=N.current,n=e.status;t===`working`&&n===`waiting`?F(!0):N.current=n},[e.status]);let I=()=>{F(!1),N.current=e.status};(0,x.useEffect)(()=>{n&&g.current&&(g.current.focus(),g.current.select())},[n]),(0,x.useEffect)(()=>{b(v)},[v]);let L=()=>{let e=y.trim();e&&e!==v?d(e):u()},R=e=>{e.key===`Enter`?(e.preventDefault(),L()):e.key===`Escape`&&(e.preventDefault(),b(v),u())},z=(0,x.useRef)(null),B=e=>{if(s)return;let t=e.touches[0];z.current={x:t.clientX,y:t.clientY},S.current=setTimeout(()=>{z.current&&w(z.current)},500)},V=()=>{S.current&&=(clearTimeout(S.current),null)};return(0,x.useEffect)(()=>{if(!C)return;let e=e=>{_.current&&!_.current.contains(e.target)&&w(null)},t=e=>{e.key===`Escape`&&w(null)};return document.addEventListener(`mousedown`,e),document.addEventListener(`touchstart`,e),document.addEventListener(`keydown`,t),()=>{document.removeEventListener(`mousedown`,e),document.removeEventListener(`touchstart`,e),document.removeEventListener(`keydown`,t)}},[C]),(0,G.jsxs)(`div`,{className:`session-row group cursor-pointer select-none px-3 py-2 ${t?`selected`:``} ${s?`cursor-grabbing shadow-lg ring-1 ring-accent/30 bg-elevated`:`cursor-grab`}`,role:`button`,tabIndex:0,"data-testid":`session-card`,"data-session-id":e.id,onClick:s?void 0:c,onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&c()},onContextMenu:e=>{e.preventDefault(),e.stopPropagation(),w({x:e.clientX,y:e.clientY})},onTouchStart:B,onTouchEnd:V,onTouchCancel:V,children:[(0,G.jsxs)(`div`,{className:`flex flex-col gap-0.5 pl-0.5`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(oh,{agentType:e.agentType,command:e.command,className:`h-3.5 w-3.5 shrink-0 text-muted`}),n?(0,G.jsx)(`input`,{ref:g,type:`text`,value:y,onChange:e=>b(e.target.value),onBlur:L,onKeyDown:R,onClick:e=>e.stopPropagation(),className:`min-w-0 flex-1 rounded border border-border bg-surface px-1.5 py-0.5 text-sm font-medium text-primary outline-none focus:border-accent`}):(0,G.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-sm font-medium text-primary`,children:v}),k&&(0,G.jsx)(`span`,{className:`shrink-0 text-[11px] font-mono text-muted`,title:O,children:k}),D?(0,G.jsx)(`span`,{className:`ml-1 flex shrink-0 items-center justify-center rounded-full px-1.5 py-0.5 ${HD[e.status]} pulse-approval`,onAnimationEnd:I,children:(0,G.jsx)(Se,{className:`h-3 w-3`,"aria-label":`Needs input`})}):(0,G.jsx)(`span`,{className:`ml-1 shrink-0 rounded-full px-1.5 py-0.5 text-right text-xs tabular-nums ${HD[e.status]}${P?` pulse-complete`:``}`,onAnimationEnd:I,children:h})]}),(A||j||M)&&(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1 pl-[1.375rem]`,children:[j&&(0,G.jsx)(n_,{name:E}),A&&(0,G.jsx)(Ng,{name:T,fullPath:e.projectPath}),M&&(0,G.jsxs)(`span`,{className:`line-clamp-2 text-xs italic text-muted`,children:[`"`,e.lastUserMessage.length>200?e.lastUserMessage.slice(0,200)+`…`:e.lastUserMessage,`"`]})]}),e.prs&&e.prs.length>0&&(0,G.jsx)(e_,{prs:e.prs})]}),C&&(0,G.jsxs)(`div`,{ref:_,className:`fixed z-50 min-w-[160px] rounded-md border border-border bg-elevated shadow-lg py-1`,style:{left:C.x,top:C.y},role:`menu`,children:[l&&(0,G.jsxs)(`button`,{onClick:e=>{e.stopPropagation(),w(null),l()},className:`w-full px-3 py-2 text-left text-sm text-secondary hover:bg-hover hover:text-primary flex items-center gap-2`,role:`menuitem`,children:[(0,G.jsx)(ge,{width:14,height:14}),`Rename`]}),m&&(0,G.jsxs)(`button`,{onClick:e=>{e.stopPropagation(),w(null),m()},className:`w-full px-3 py-2 text-left text-sm text-secondary hover:bg-hover hover:text-primary flex items-center gap-2`,role:`menuitem`,title:`Create a copy in a new tmux window`,children:[(0,G.jsx)(ue,{width:14,height:14}),`Duplicate`]}),f&&(0,G.jsxs)(`button`,{onClick:e=>{e.stopPropagation(),w(null),f()},className:`w-full px-3 py-2 text-left text-sm text-secondary hover:bg-hover hover:text-primary flex items-center gap-2`,role:`menuitem`,title:`Close the live window and keep this session ready to wake`,children:[(0,G.jsx)(Oe,{width:14,height:14}),`Hibernate`]}),e.logFilePath&&(0,G.jsxs)(`button`,{onClick:t=>{t.stopPropagation(),w(null),e.logFilePath&&Bm(e.logFilePath)},className:`w-full px-3 py-2 text-left text-sm text-secondary hover:bg-hover hover:text-primary flex items-center gap-2`,role:`menuitem`,title:e.logFilePath,children:[(0,G.jsx)(ve,{width:14,height:14}),`Copy Log Path`]}),p&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`div`,{className:`my-1 border-t border-border`}),(0,G.jsxs)(`button`,{onClick:e=>{e.stopPropagation(),w(null),p()},className:`w-full px-3 py-2 text-left text-sm text-danger hover:bg-danger/10 flex items-center gap-2`,role:`menuitem`,children:[(0,G.jsx)(We,{width:14,height:14}),`Kill Session`]})]})]})]})}var qD={debug:0,info:1,warn:2,error:3},JD=`info`;function YD(e){let t=e.toLowerCase();t in qD&&(JD=t)}function XD(e,t,n=`debug`){if(!(qD[n]<qD[JD]))try{fetch(`/api/client-log`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({event:e,data:t,level:n})}).catch(()=>{})}catch{}}var ZD=Object.defineProperty,QD=Object.getOwnPropertyDescriptor,$D=(e,t)=>{for(var n in t)ZD(e,n,{get:t[n],enumerable:!0})},eO=(e,t,n,r)=>{for(var i=r>1?void 0:r?QD(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&&ZD(t,n,i),i},Z=(e,t)=>(n,r)=>t(n,r,e),tO=`Terminal input`,nO={get:()=>tO,set:e=>tO=e},rO=`Too much output to announce, navigate to rows manually to read`,iO={get:()=>rO,set:e=>rO=e};function aO(e){return e.replace(/\r?\n/g,`\r`)}function oO(e,t){return t?`\x1B[200~`+e+`\x1B[201~`:e}function sO(e,t){e.clipboardData&&e.clipboardData.setData(`text/plain`,t.selectionText),e.preventDefault()}function cO(e,t,n,r){e.stopPropagation(),e.clipboardData&&lO(e.clipboardData.getData(`text/plain`),t,n,r)}function lO(e,t,n,r){e=aO(e),e=oO(e,n.decPrivateModes.bracketedPasteMode&&r.rawOptions.ignoreBracketedPasteMode!==!0),n.triggerDataEvent(e,!0),t.value=``}function uO(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 dO(e,t,n,r,i){uO(e,t,n),i&&r.rightClickSelect(e),t.value=r.selectionText,t.select()}function fO(e){return e>65535?(e-=65536,String.fromCharCode((e>>10)+55296)+String.fromCharCode(e%1024+56320)):String.fromCharCode(e)}function pO(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 mO=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);continue}i!==65279&&(t[r++]=i)}return r}},hO=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}else 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){d--;continue}if(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}},gO=``,_O=` `,vO=class e{constructor(){this.fg=0,this.bg=0,this.extended=new yO}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)==0}isBgDefault(){return(this.bg&50331648)==0}isAttributeDefault(){return this.fg===0&&this.bg===0}getFgColor(){switch(this.fg&50331648){case 16777216:case 33554432:return this.fg&255;case 50331648:return this.fg&16777215;default:return-1}}getBgColor(){switch(this.bg&50331648){case 16777216:case 33554432:return this.bg&255;case 50331648:return this.bg&16777215;default:return-1}}hasExtendedAttrs(){return this.bg&268435456}updateExtended(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456}getUnderlineColor(){if(this.bg&268435456&&~this.extended.underlineColor)switch(this.extended.underlineColor&50331648){case 16777216:case 33554432:return this.extended.underlineColor&255;case 50331648:return this.extended.underlineColor&16777215;default:return this.getFgColor()}return this.getFgColor()}getUnderlineColorMode(){return this.bg&268435456&&~this.extended.underlineColor?this.extended.underlineColor&50331648:this.getFgColorMode()}isUnderlineColorRGB(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)==50331648:this.isFgRGB()}isUnderlineColorPalette(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)==16777216||(this.extended.underlineColor&50331648)==33554432:this.isFgPalette()}isUnderlineColorDefault(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)==0:this.isFgDefault()}getUnderlineStyle(){return this.fg&268435456?this.bg&268435456?this.extended.underlineStyle:1:0}getUnderlineVariantOffset(){return this.extended.underlineVariantOffset}},yO=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}},bO=class e extends vO{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new yO,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?fO(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()]}},xO=`di$target`,SO=`di$dependencies`,CO=new Map;function wO(e){return e[SO]||[]}function TO(e){if(CO.has(e))return CO.get(e);let t=function(e,n,r){if(arguments.length!==3)throw Error(`@IServiceName-decorator can only be used to decorate a parameter`);EO(t,e,r)};return t._id=e,CO.set(e,t),t}function EO(e,t,n){t[xO]===t?t[SO].push({id:e,index:n}):(t[SO]=[{id:e,index:n}],t[xO]=t)}var DO=TO(`BufferService`),OO=TO(`CoreMouseService`),kO=TO(`CoreService`),AO=TO(`CharsetService`),jO=TO(`InstantiationService`),MO=TO(`LogService`),NO=TO(`OptionsService`),PO=TO(`OscLinkService`),FO=TO(`UnicodeService`),IO=TO(`DecorationService`),LO=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 bO,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}else 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):RO(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)}};LO=eO([Z(0,DO),Z(1,NO),Z(2,PO)],LO);function RO(e,t){if(confirm(`Do you want to navigate to ${t}?
|
|
52
52
|
|
|
53
53
|
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 zO=TO(`CharSizeService`),BO=TO(`CoreBrowserService`),VO=TO(`MouseService`),HO=TO(`RenderService`),UO=TO(`SelectionService`),WO=TO(`CharacterJoinerService`),GO=TO(`ThemeService`),KO=TO(`LinkProviderService`),qO=new class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?$O.isErrorNoTelemetry(e)?new $O(e.message+`
|
|
54
54
|
|
|
@@ -78,7 +78,7 @@ ${s.join(`
|
|
|
78
78
|
`).slice(2,3).join(`
|
|
79
79
|
`).trim(),t=/(file:|vscode-file:\/\/vscode-app)?(\/[^:]*:\d+:\d+)/.exec(e);Xk.register(a,t?.[2]??e,a)}return 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*Jk<=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||JO;if(!n){e.value(t);return}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 qk)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}},Zk=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}},Qk=class{constructor(){this.mapWindowIdToZoomLevel=new Map,this._onDidChangeZoomLevel=new Q,this.onDidChangeZoomLevel=this._onDidChangeZoomLevel.event,this.mapWindowIdToZoomFactor=new Map,this._onDidChangeFullscreen=new Q,this.onDidChangeFullscreen=this._onDidChangeFullscreen.event,this.mapWindowIdToFullScreen=new Map}getZoomLevel(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}};Qk.INSTANCE=new Qk;var $k=Qk;function eA(e,t,n){typeof t==`string`&&(t=e.matchMedia(t)),t.addEventListener(`change`,n)}$k.INSTANCE.onDidChangeZoomLevel;function tA(e){return $k.INSTANCE.getZoomFactor(e)}$k.INSTANCE.onDidChangeFullscreen;var nA=typeof navigator==`object`?navigator.userAgent:``,rA=nA.indexOf(`Firefox`)>=0,iA=nA.indexOf(`AppleWebKit`)>=0,aA=nA.indexOf(`Chrome`)>=0,oA=!aA&&nA.indexOf(`Safari`)>=0;nA.indexOf(`Electron/`),nA.indexOf(`Android`);var sA=!1;if(typeof Ok.matchMedia==`function`){let e=Ok.matchMedia(`(display-mode: standalone) or (display-mode: window-controls-overlay)`),t=Ok.matchMedia(`(display-mode: fullscreen)`);sA=e.matches,eA(Ok,e,({matches:e})=>{sA&&t.matches||(sA=e)})}function cA(){return sA}var lA=`en`,uA=!1,dA=!1,fA=!1,pA=!1,mA=!1,hA=lA,gA,_A=globalThis,vA;typeof _A.vscode<`u`&&typeof _A.vscode.process<`u`?vA=_A.vscode.process:typeof process<`u`&&typeof process?.versions?.node==`string`&&(vA=process);var yA=typeof vA?.versions?.electron==`string`&&vA?.type===`renderer`;if(typeof vA==`object`){uA=vA.platform===`win32`,dA=vA.platform===`darwin`,fA=vA.platform===`linux`,fA&&vA.env.SNAP&&vA.env.SNAP_REVISION,vA.env.CI||vA.env.BUILD_ARTIFACTSTAGINGDIRECTORY,hA=lA;let e=vA.env.VSCODE_NLS_CONFIG;if(e)try{let t=JSON.parse(e);t.userLocale,t.osLocale,hA=t.resolvedLanguage||lA,t.languagePack?.translationsConfigFile}catch{}pA=!0}else typeof navigator==`object`&&!yA?(gA=navigator.userAgent,uA=gA.indexOf(`Windows`)>=0,dA=gA.indexOf(`Macintosh`)>=0,(gA.indexOf(`Macintosh`)>=0||gA.indexOf(`iPad`)>=0||gA.indexOf(`iPhone`)>=0)&&navigator.maxTouchPoints&&navigator.maxTouchPoints,fA=gA.indexOf(`Linux`)>=0,gA?.indexOf(`Mobi`),mA=!0,hA=globalThis._VSCODE_NLS_LANGUAGE||lA,navigator.language.toLowerCase()):console.error(`Unable to resolve platform.`);var bA=uA,xA=dA,SA=fA,CA=pA;mA&&typeof _A.importScripts==`function`&&_A.origin;var wA=gA,TA=hA,EA;(e=>{function t(){return TA}e.value=t;function n(){return TA.length===2?TA===`en`:TA.length>=3?TA[0]===`e`&&TA[1]===`n`&&TA[2]===`-`:!1}e.isDefaultVariant=n;function r(){return TA===`en`}e.isDefault=r})(EA||={});var DA=typeof _A.postMessage==`function`&&!_A.importScripts;(()=>{if(DA){let e=[];_A.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}),_A.postMessage({vscodeScheduleAsyncWork:r},`*`)}}return e=>setTimeout(e)})();var OA=!!(wA&&wA.indexOf(`Chrome`)>=0);wA&&wA.indexOf(`Firefox`),!OA&&wA&&wA.indexOf(`Safari`),wA&&wA.indexOf(`Edg/`),wA&&wA.indexOf(`Android`);var kA=typeof navigator==`object`?navigator:{};CA||document.queryCommandSupported&&document.queryCommandSupported(`copy`)||kA&&kA.clipboard&&kA.clipboard.writeText,CA||kA&&kA.clipboard&&kA.clipboard.readText,CA||cA()||kA.keyboard,`ontouchstart`in Ok||kA.maxTouchPoints,Ok.PointerEvent&&(`ontouchstart`in Ok||navigator.maxTouchPoints);var AA=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}},jA=new AA,MA=new AA,NA=new AA,PA=Array(230),FA;(e=>{function t(e){return jA.keyCodeToStr(e)}e.toString=t;function n(e){return jA.strToKeyCode(e)}e.fromString=n;function r(e){return MA.keyCodeToStr(e)}e.toUserSettingsUS=r;function i(e){return NA.keyCodeToStr(e)}e.toUserSettingsGeneral=i;function a(e){return MA.strToKeyCode(e)||NA.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 jA.keyCodeToStr(e)}e.toElectronAccelerator=o})(FA||={});var IA=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 LA([this])}isDuplicateModifierCase(){return this.ctrlKey&&this.keyCode===5||this.shiftKey&&this.keyCode===4||this.altKey&&this.keyCode===6||this.metaKey&&this.keyCode===57}},LA=class{constructor(e){if(e.length===0)throw QO(`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 RA(e){if(e.charCode){let t=String.fromCharCode(e.charCode).toUpperCase();return FA.fromString(t)}let t=e.keyCode;if(t===3)return 7;if(rA)switch(t){case 59:return 85;case 60:if(SA)return 97;break;case 61:return 86;case 107:return 109;case 109:return 111;case 173:return 88;case 224:if(xA)return 57;break}else if(iA&&(xA&&t===93||!xA&&t===92))return 57;return PA[t]||0}var zA=xA?256:2048,BA=512,VA=1024,HA=xA?2048:256,UA=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=RA(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|=zA),this.altKey&&(t|=BA),this.shiftKey&&(t|=VA),this.metaKey&&(t|=HA),t|=e,t}_computeKeyCodeChord(){let e=0;return this.keyCode!==5&&this.keyCode!==4&&this.keyCode!==6&&this.keyCode!==57&&(e=this.keyCode),new IA(this.ctrlKey,this.shiftKey,this.altKey,this.metaKey,e)}},WA=new WeakMap;function GA(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 KA=class{static getSameOriginWindowChain(e){let t=WA.get(e);if(!t){t=[],WA.set(e,t);let n=e,r;do r=GA(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}}},qA=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=KA.getPositionOfChildWindowRelativeToAncestorWindow(e,t.view);this.posx-=n.left,this.posy-=n.top}preventDefault(){this.browserEvent.preventDefault()}stopPropagation(){this.browserEvent.stopPropagation()}},JA=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(aA){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`)r?this.deltaY=t.wheelDeltaY/(120*i):this.deltaY=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;t.deltaMode===t.DOM_DELTA_LINE?rA&&!xA?this.deltaY=-e.deltaY/3:this.deltaY=-e.deltaY:this.deltaY=-e.deltaY/40}if(typeof t.wheelDeltaX<`u`)oA&&bA?this.deltaX=-(t.wheelDeltaX/120):r?this.deltaX=t.wheelDeltaX/(120*i):this.deltaX=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;t.deltaMode===t.DOM_DELTA_LINE?rA&&!xA?this.deltaX=-e.deltaX/3:this.deltaX=-e.deltaX:this.deltaX=-e.deltaX/40}this.deltaY===0&&this.deltaX===0&&e.wheelDelta&&(r?this.deltaY=e.wheelDelta/(120*i):this.deltaY=e.wheelDelta/120)}}preventDefault(){this.browserEvent?.preventDefault()}stopPropagation(){this.browserEvent?.stopPropagation()}},YA=Object.freeze(function(e,t){let n=setTimeout(e.bind(t),0);return{dispose(){clearTimeout(n)}}}),XA;(e=>{function t(t){return t===e.None||t===e.Cancelled||t instanceof ZA?!0:!t||typeof t!=`object`?!1:typeof t.isCancellationRequested==`boolean`&&typeof t.onCancellationRequested==`function`}e.isCancellationToken=t,e.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:Lk.None}),e.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:YA})})(XA||={});var ZA=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?YA:(this._emitter||=new Q,this._emitter.event)}dispose(){this._emitter&&=(this._emitter.dispose(),null)}},QA=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 ek(`Calling 'cancelAndSet' on a disposed TimeoutTimer`);this.cancel(),this._token=setTimeout(()=>{this._token=-1,e()},t)}setIfNotSet(e,t){if(this._isDisposed)throw new ek(`Calling 'setIfNotSet' on a disposed TimeoutTimer`);this._token===-1&&(this._token=setTimeout(()=>{this._token=-1,e()},t))}},$A=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 ek(`Calling 'cancelAndSet' on a disposed IntervalTimer`);this.cancel();let r=n.setInterval(()=>{e()},t);this.disposable=Ck(()=>{n.clearInterval(r),this.disposable=void 0})}dispose(){this.cancel(),this.isDisposed=!0}};(function(){typeof globalThis.requestIdleCallback!=`function`||globalThis.cancelIdleCallback})();var ej;(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})(ej||={});var tj=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 Q,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 Lk.toPromise(this._onStateChanged.event)}while(!0)},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())}};tj.EMPTY=tj.fromArray([]);function nj(e){return 55296<=e&&e<=56319}function rj(e){return 56320<=e&&e<=57343}function ij(e,t){return(e-55296<<10)+(t-56320)+65536}function aj(e){return oj(e,0)}function oj(e,t){switch(typeof e){case`object`:return e===null?sj(349,t):Array.isArray(e)?uj(e,t):dj(e,t);case`string`:return lj(e,t);case`boolean`:return cj(e,t);case`number`:return sj(e,t);case`undefined`:return sj(937,t);default:return sj(617,t)}}function sj(e,t){return(t<<5)-t+e|0}function cj(e,t){return sj(e?433:863,t)}function lj(e,t){t=sj(149417,t);for(let n=0,r=e.length;n<r;n++)t=sj(e.charCodeAt(n),t);return t}function uj(e,t){return t=sj(104579,t),e.reduce((e,t)=>oj(t,e),t)}function dj(e,t){return t=sj(181387,t),Object.keys(e).sort().reduce((t,n)=>(t=lj(n,t),oj(e[n],t)),t)}function fj(e,t,n=32){let r=n-t,i=~((1<<r)-1);return(e<<t|(i&e)>>>r)>>>0}function pj(e,t=0,n=e.byteLength,r=0){for(let i=0;i<n;i++)e[t+i]=r}function mj(e,t,n=`0`){for(;e.length<t;)e=n+e;return e}function hj(e,t=32){return e instanceof ArrayBuffer?Array.from(new Uint8Array(e)).map(e=>e.toString(16).padStart(2,`0`)).join(``):mj((e>>>0).toString(16),t/4)}var gj=class e{constructor(){this._h0=1732584193,this._h1=4023233417,this._h2=2562383102,this._h3=271733878,this._h4=3285377520,this._buff=new Uint8Array(67),this._buffDV=new DataView(this._buff.buffer),this._buffLen=0,this._totalLen=0,this._leftoverHighSurrogate=0,this._finished=!1}update(e){let t=e.length;if(t===0)return;let n=this._buff,r=this._buffLen,i=this._leftoverHighSurrogate,a,o;for(i===0?(a=e.charCodeAt(0),o=0):(a=i,o=-1,i=0);;){let s=a;if(nj(a))if(o+1<t){let t=e.charCodeAt(o+1);rj(t)?(o++,s=ij(a,t)):s=65533}else{i=a;break}else rj(a)&&(s=65533);if(r=this._push(n,r,s),o++,o<t)a=e.charCodeAt(o);else break}this._buffLen=r,this._leftoverHighSurrogate=i}_push(e,t,n){return n<128?e[t++]=n:n<2048?(e[t++]=192|(n&1984)>>>6,e[t++]=128|(n&63)>>>0):n<65536?(e[t++]=224|(n&61440)>>>12,e[t++]=128|(n&4032)>>>6,e[t++]=128|(n&63)>>>0):(e[t++]=240|(n&1835008)>>>18,e[t++]=128|(n&258048)>>>12,e[t++]=128|(n&4032)>>>6,e[t++]=128|(n&63)>>>0),t>=64&&(this._step(),t-=64,this._totalLen+=64,e[0]=e[64],e[1]=e[65],e[2]=e[66]),t}digest(){return this._finished||(this._finished=!0,this._leftoverHighSurrogate&&(this._leftoverHighSurrogate=0,this._buffLen=this._push(this._buff,this._buffLen,65533)),this._totalLen+=this._buffLen,this._wrapUp()),hj(this._h0)+hj(this._h1)+hj(this._h2)+hj(this._h3)+hj(this._h4)}_wrapUp(){this._buff[this._buffLen++]=128,pj(this._buff,this._buffLen),this._buffLen>56&&(this._step(),pj(this._buff));let e=8*this._totalLen;this._buffDV.setUint32(56,Math.floor(e/4294967296),!1),this._buffDV.setUint32(60,e%4294967296,!1),this._step()}_step(){let t=e._bigBlock32,n=this._buffDV;for(let e=0;e<64;e+=4)t.setUint32(e,n.getUint32(e,!1),!1);for(let e=64;e<320;e+=4)t.setUint32(e,fj(t.getUint32(e-12,!1)^t.getUint32(e-32,!1)^t.getUint32(e-56,!1)^t.getUint32(e-64,!1),1),!1);let r=this._h0,i=this._h1,a=this._h2,o=this._h3,s=this._h4,c,l,u;for(let e=0;e<80;e++)e<20?(c=i&a|~i&o,l=1518500249):e<40?(c=i^a^o,l=1859775393):e<60?(c=i&a|i&o|a&o,l=2400959708):(c=i^a^o,l=3395469782),u=fj(r,5)+c+s+l+t.getUint32(e*4,!1)&4294967295,s=o,o=a,a=fj(i,30),i=r,r=u;this._h0=this._h0+r&4294967295,this._h1=this._h1+i&4294967295,this._h2=this._h2+a&4294967295,this._h3=this._h3+o&4294967295,this._h4=this._h4+s&4294967295}};gj._bigBlock32=new DataView(new ArrayBuffer(320));var{registerWindow:_j,getWindow:vj,getDocument:yj,getWindows:bj,getWindowsCount:xj,getWindowId:Sj,getWindowById:Cj,hasWindow:wj,onDidRegisterWindow:Tj,onWillUnregisterWindow:Ej,onDidUnregisterWindow:Dj}=function(){let e=new Map,t={window:Ok,disposables:new Tk};e.set(Ok.vscodeWindowId,t);let n=new Q,r=new Q,i=new Q;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 Ek.None;let a=new Tk,o={window:t,disposables:a.add(new Tk)};return e.set(t.vscodeWindowId,o),a.add(Ck(()=>{e.delete(t.vscodeWindowId),r.fire(t)})),a.add(kj(t,Rj.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:Ok},getDocument(e){return vj(e).document}}}(),Oj=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 kj(e,t,n,r){return new Oj(e,t,n,r)}function Aj(e,t){return function(n){return t(new qA(e,n))}}function jj(e){return function(t){return e(new UA(t))}}var Mj=function(e,t,n,r){let i=n;return t===`click`||t===`mousedown`||t===`contextmenu`?i=Aj(vj(e),n):(t===`keydown`||t===`keypress`||t===`keyup`)&&(i=jj(n)),kj(e,t,i,r)},Nj,Pj=class extends $A{constructor(e){super(),this.defaultTarget=e&&vj(e)}cancelAndSet(e,t,n){return super.cancelAndSet(e,t,n??this.defaultTarget)}},Fj=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){JO(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(Fj.sort),a.shift().execute();r.set(i,!1)};Nj=(t,r,a=0)=>{let o=Sj(t),s=new Fj(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 Ij=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}};Ij.None=new Ij(0,0);function Lj(e){let t=e.getBoundingClientRect(),n=vj(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=aj(n),a=r.get(i);if(a)a.users+=1;else{let o=new Q,s=new MutationObserver(e=>o.fire(e));s.observe(e,n);let c=a={users:1,observer:s,onDidMutate:o.event};t.add(Ck(()=>{--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 Rj={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:iA?`webkitAnimationStart`:`animationstart`,ANIMATION_END:iA?`webkitAnimationEnd`:`animationend`,ANIMATION_ITERATION:iA?`webkitAnimationIteration`:`animationiteration`},zj=/([\w\-]+)?(#([\w\-]+))?((\.([\w\-]+))*)/;function Bj(e,t,n,...r){let i=zj.exec(t);if(!i)throw Error(`Bad use of emmet`);let a=i[1]||`div`,o;return o=e===`http://www.w3.org/1999/xhtml`?document.createElement(a):document.createElementNS(e,a),i[3]&&(o.id=i[3]),i[4]&&(o.className=i[4].replace(/\./g,` `).trim()),n&&Object.entries(n).forEach(([e,t])=>{typeof t>`u`||(/^on\w+$/.test(e)?o[e]=t:e===`selected`?t&&o.setAttribute(e,`true`):o.setAttribute(e,t))}),o.append(...r),o}function Vj(e,t,...n){return Bj(`http://www.w3.org/1999/xhtml`,e,t,...n)}Vj.SVG=function(e,t,...n){return Bj(`http://www.w3.org/2000/svg`,e,t,...n)};var Hj=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=Uj(e);this._maxWidth!==t&&(this._maxWidth=t,this.domNode.style.maxWidth=this._maxWidth)}setWidth(e){let t=Uj(e);this._width!==t&&(this._width=t,this.domNode.style.width=this._width)}setHeight(e){let t=Uj(e);this._height!==t&&(this._height=t,this.domNode.style.height=this._height)}setTop(e){let t=Uj(e);this._top!==t&&(this._top=t,this.domNode.style.top=this._top)}setLeft(e){let t=Uj(e);this._left!==t&&(this._left=t,this.domNode.style.left=this._left)}setBottom(e){let t=Uj(e);this._bottom!==t&&(this._bottom=t,this.domNode.style.bottom=this._bottom)}setRight(e){let t=Uj(e);this._right!==t&&(this._right=t,this.domNode.style.right=this._right)}setPaddingTop(e){let t=Uj(e);this._paddingTop!==t&&(this._paddingTop=t,this.domNode.style.paddingTop=this._paddingTop)}setPaddingLeft(e){let t=Uj(e);this._paddingLeft!==t&&(this._paddingLeft=t,this.domNode.style.paddingLeft=this._paddingLeft)}setPaddingBottom(e){let t=Uj(e);this._paddingBottom!==t&&(this._paddingBottom=t,this.domNode.style.paddingBottom=this._paddingBottom)}setPaddingRight(e){let t=Uj(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=Uj(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=Uj(e);this._lineHeight!==t&&(this._lineHeight=t,this.domNode.style.lineHeight=this._lineHeight)}setLetterSpacing(e){let t=Uj(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 Uj(e){return typeof e==`number`?`${e}px`:e}function Wj(e){return new Hj(e)}var Gj=class{constructor(){this._hooks=new Tk,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(Ck(()=>{try{e.releasePointerCapture(t)}catch{}}))}catch{a=vj(e)}this._hooks.add(kj(a,Rj.POINTER_MOVE,e=>{if(e.buttons!==n){this.stopMonitoring(!0);return}e.preventDefault(),this._pointerMoveCallback(e)})),this._hooks.add(kj(a,Rj.POINTER_UP,e=>this.stopMonitoring(!0)))}};function Kj(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 qj;(e=>(e.Tap=`-xterm-gesturetap`,e.Change=`-xterm-gesturechange`,e.Start=`-xterm-gesturestart`,e.End=`-xterm-gesturesend`,e.Contextmenu=`-xterm-gesturecontextmenu`))(qj||={});var Jj=class e extends Ek{constructor(){super(),this.dispatched=!1,this.targets=new jk,this.ignoreTargets=new jk,this.activeTouches={},this.handle=null,this._lastSetTapCountTime=0,this._register(Lk.runAndSubscribe(Tj,({window:e,disposables:t})=>{t.add(kj(e.document,`touchstart`,e=>this.onTouchStart(e),{passive:!1})),t.add(kj(e.document,`touchend`,t=>this.onTouchEnd(e,t))),t.add(kj(e.document,`touchmove`,e=>this.onTouchMove(e),{passive:!1}))},{window:Ok,disposables:this._store}))}static addTarget(t){return e.isTouchDevice()?(e.INSTANCE||=bk(new e),Ck(e.INSTANCE.targets.push(t))):Ek.None}static ignoreTarget(t){return e.isTouchDevice()?(e.INSTANCE||=bk(new e),Ck(e.INSTANCE.ignoreTargets.push(t))):Ek.None}static isTouchDevice(){return`ontouchstart`in Ok||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(qj.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-rk(s.rollingPageX))<30&&Math.abs(s.initialPageY-rk(s.rollingPageY))<30){let e=this.newGestureEvent(qj.Tap,s.initialTarget);e.pageX=rk(s.rollingPageX),e.pageY=rk(s.rollingPageY),this.dispatchEvent(e)}else if(c>=e.HOLD_DELAY&&Math.abs(s.initialPageX-rk(s.rollingPageX))<30&&Math.abs(s.initialPageY-rk(s.rollingPageY))<30){let e=this.newGestureEvent(qj.Contextmenu,s.initialTarget);e.pageX=rk(s.rollingPageX),e.pageY=rk(s.rollingPageY),this.dispatchEvent(e)}else if(i===1){let e=rk(s.rollingPageX),n=rk(s.rollingPageY),i=rk(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(qj.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===qj.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===qj.Change||t.type===qj.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=Nj(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(qj.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(qj.Change,i.initialTarget);a.translationX=r.pageX-rk(i.rollingPageX),a.translationY=r.pageY-rk(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)}};Jj.SCROLL_FRICTION=-.005,Jj.HOLD_DELAY=700,Jj.CLEAR_TAP_COUNT_TIME=400,eO([Kj],Jj,`isTouchDevice`,1);var Yj=Jj,Xj=class extends Ek{onclick(e,t){this._register(kj(e,Rj.CLICK,n=>t(new qA(vj(e),n))))}onmousedown(e,t){this._register(kj(e,Rj.MOUSE_DOWN,n=>t(new qA(vj(e),n))))}onmouseover(e,t){this._register(kj(e,Rj.MOUSE_OVER,n=>t(new qA(vj(e),n))))}onmouseleave(e,t){this._register(kj(e,Rj.MOUSE_LEAVE,n=>t(new qA(vj(e),n))))}onkeydown(e,t){this._register(kj(e,Rj.KEY_DOWN,e=>t(new UA(e))))}onkeyup(e,t){this._register(kj(e,Rj.KEY_UP,e=>t(new UA(e))))}oninput(e,t){this._register(kj(e,Rj.INPUT,t))}onblur(e,t){this._register(kj(e,Rj.BLUR,t))}onfocus(e,t){this._register(kj(e,Rj.FOCUS,t))}onchange(e,t){this._register(kj(e,Rj.CHANGE,t))}ignoreGesture(e){return Yj.ignoreTarget(e)}},Zj=11,Qj=class extends Xj{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=Zj+`px`,this.domNode.style.height=Zj+`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 Gj),this._register(Mj(this.bgDomNode,Rj.POINTER_DOWN,e=>this._arrowPointerDown(e))),this._register(Mj(this.domNode,Rj.POINTER_DOWN,e=>this._arrowPointerDown(e))),this._pointerdownRepeatTimer=this._register(new Pj),this._pointerdownScheduleRepeatTimer=this._register(new QA)}_arrowPointerDown(e){!e.target||!(e.target instanceof Element)||(this._onActivate(),this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancelAndSet(()=>{this._pointerdownRepeatTimer.cancelAndSet(()=>this._onActivate(),1e3/24,vj(e))},200),this._pointerMoveMonitor.startMonitoring(e.target,e.pointerId,e.buttons,e=>{},()=>{this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancel()}),e.preventDefault())}},$j=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}}},eM=class extends Ek{constructor(e){super(),this._scrollableBrand=void 0,this._onScroll=this._register(new Q),this.onScroll=this._onScroll.event,this._smoothScrollDuration=e.smoothScrollDuration,this._scheduleAtNextAnimationFrame=e.scheduleAtNextAnimationFrame,this._state=new $j(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 iM(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=iM.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)))}},tM=class{constructor(e,t,n){this.scrollLeft=e,this.scrollTop=t,this.isDone=n}};function nM(e,t){let n=t-e;return function(t){return e+n*oM(t)}}function rM(e,t,n){return function(r){return r<n?e(r/n):t((r-n)/(1-n))}}var iM=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),rM(nM(e,r),nM(i,t),.33)}return nM(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 tM(this.scrollLeft(t),this.scrollTop(t),!1):new tM(this.to.scrollLeft,this.to.scrollTop,!0)}combine(t,n,r){return e.start(t,n,r)}static start(t,n,r){return r+=10,new e(t,n,Date.now()-10,r)}};function aM(e){return e**3}function oM(e){return 1-aM(1-e)}var sM=class extends Ek{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 QA)}setVisibility(e){this._visibility!==e&&(this._visibility=e,this._updateShouldBeVisible())}setShouldBeVisible(e){this._rawShouldBeVisible=e,this._updateShouldBeVisible()}_applyVisibilitySetting(){return this._visibility===2?!1:this._visibility===3?!0:this._rawShouldBeVisible}_updateShouldBeVisible(){let e=this._applyVisibilitySetting();this._shouldBeVisible!==e&&(this._shouldBeVisible=e,this.ensureVisibility())}setIsNeeded(e){this._isNeeded!==e&&(this._isNeeded=e,this.ensureVisibility())}setDomNode(e){this._domNode=e,this._domNode.setClassName(this._invisibleClassName),this.setShouldBeVisible(!1)}ensureVisibility(){if(!this._isNeeded){this._hide(!1);return}this._shouldBeVisible?this._reveal():this._hide(!0)}_reveal(){this._isVisible||(this._isVisible=!0,this._revealTimer.setIfNotSet(()=>{this._domNode?.setClassName(this._visibleClassName)},0))}_hide(e){this._revealTimer.cancel(),this._isVisible&&(this._isVisible=!1,this._domNode?.setClassName(this._invisibleClassName+(e?` fade`:``)))}},cM=140,lM=class extends Xj{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 sM(e.visibility,`visible scrollbar `+e.extraScrollbarClassName,`invisible scrollbar `+e.extraScrollbarClassName)),this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._pointerMoveMonitor=this._register(new Gj),this._shouldRender=!0,this.domNode=Wj(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(kj(this.domNode.domNode,Rj.POINTER_DOWN,e=>this._domNodePointerDown(e)))}_createArrow(e){let t=this._register(new Qj(e));this.domNode.domNode.appendChild(t.bgDomNode),this.domNode.domNode.appendChild(t.domNode)}_createSlider(e,t,n,r){this.slider=Wj(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(kj(this.slider.domNode,Rj.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=Lj(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(bA&&a>cM){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()}},uM=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?!1:(this._visibleSize=t,this._refreshComputedValues(),!0)}setScrollSize(e){let t=Math.round(e);return this._scrollSize===t?!1:(this._scrollSize=t,this._refreshComputedValues(),!0)}setScrollPosition(e){let t=Math.round(e);return this._scrollPosition===t?!1:(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)}},dM=class extends lM{constructor(e,t,n){let r=e.getScrollDimensions(),i=e.getCurrentScrollPosition();if(super({lazyRender:t.lazyRender,host:n,scrollbarState:new uM(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}},fM=class extends lM{constructor(e,t,n){let r=e.getScrollDimensions(),i=e.getCurrentScrollPosition();if(super({lazyRender:t.lazyRender,host:n,scrollbarState:new uM(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}},pM=500,mM=50,hM=!0,gM=class{constructor(e,t,n){this.timestamp=e,this.deltaX=t,this.deltaY=n,this.score=0}},_M=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(!0);return t<=.5}acceptStandardWheelEvent(e){if(aA){let t=tA(vj(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 gM(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}};_M.INSTANCE=new _M;var vM=_M,yM=class extends Xj{constructor(e,t,n){super(),this._onScroll=this._register(new Q),this.onScroll=this._onScroll.event,this._onWillScroll=this._register(new Q),this.onWillScroll=this._onWillScroll.event,this._options=xM(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 fM(this._scrollable,this._options,r)),this._horizontalScrollbar=this._register(new dM(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=Wj(document.createElement(`div`)),this._leftShadowDomNode.setClassName(`shadow`),this._domNode.appendChild(this._leftShadowDomNode.domNode),this._topShadowDomNode=Wj(document.createElement(`div`)),this._topShadowDomNode.setClassName(`shadow`),this._domNode.appendChild(this._topShadowDomNode.domNode),this._topLeftShadowDomNode=Wj(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 QA),this._isDragging=!1,this._mouseIsOver=!1,this._shouldRender=!0,this._revealOnScroll=!0}get options(){return this._options}dispose(){this._mouseWheelToDispose=xk(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,xA&&(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 JA(e))}_setListeningToMouseWheel(e){this._mouseWheelToDispose.length>0!==e&&(this._mouseWheelToDispose=xk(this._mouseWheelToDispose),e)&&this._mouseWheelToDispose.push(kj(this._listenOnDomNode,Rj.MOUSE_WHEEL,e=>{this._onMouseWheel(new JA(e))},{passive:!1}))}_onMouseWheel(e){if(e.browserEvent?.defaultPrevented)return;let t=vM.INSTANCE;hM&&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=!xA&&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=mM*r,t=o.scrollTop-(e<0?Math.floor(e):Math.ceil(e));this._verticalScrollbar.writeScrollPosition(s,t)}if(i){let e=mM*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)&&(hM&&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(),pM)}},bM=class extends yM{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 xM(e){let t={lazyRender:typeof e.lazyRender<`u`?e.lazyRender:!1,className:typeof e.className<`u`?e.className:``,useShadows:typeof e.useShadows<`u`?e.useShadows:!0,handleMouseWheel:typeof e.handleMouseWheel<`u`?e.handleMouseWheel:!0,flipAxes:typeof e.flipAxes<`u`?e.flipAxes:!1,consumeMouseWheelIfScrollbarIsNeeded:typeof e.consumeMouseWheelIfScrollbarIsNeeded<`u`?e.consumeMouseWheelIfScrollbarIsNeeded:!1,alwaysConsumeMouseWheel:typeof e.alwaysConsumeMouseWheel<`u`?e.alwaysConsumeMouseWheel:!1,scrollYToX:typeof e.scrollYToX<`u`?e.scrollYToX:!1,mouseWheelScrollSensitivity:typeof e.mouseWheelScrollSensitivity<`u`?e.mouseWheelScrollSensitivity:1,fastScrollSensitivity:typeof e.fastScrollSensitivity<`u`?e.fastScrollSensitivity:5,scrollPredominantAxis:typeof e.scrollPredominantAxis<`u`?e.scrollPredominantAxis:!0,mouseWheelSmoothScroll:typeof e.mouseWheelSmoothScroll<`u`?e.mouseWheelSmoothScroll:!0,arrowSize:typeof e.arrowSize<`u`?e.arrowSize:11,listenOnDomNode:typeof e.listenOnDomNode<`u`?e.listenOnDomNode:null,horizontal:typeof e.horizontal<`u`?e.horizontal:1,horizontalScrollbarSize:typeof e.horizontalScrollbarSize<`u`?e.horizontalScrollbarSize:10,horizontalSliderSize:typeof e.horizontalSliderSize<`u`?e.horizontalSliderSize:0,horizontalHasArrows:typeof e.horizontalHasArrows<`u`?e.horizontalHasArrows:!1,vertical:typeof e.vertical<`u`?e.vertical:1,verticalScrollbarSize:typeof e.verticalScrollbarSize<`u`?e.verticalScrollbarSize:10,verticalHasArrows:typeof e.verticalHasArrows<`u`?e.verticalHasArrows:!1,verticalSliderSize:typeof e.verticalSliderSize<`u`?e.verticalSliderSize:0,scrollByPage:typeof e.scrollByPage<`u`?e.scrollByPage:!1};return t.horizontalSliderSize=typeof e.horizontalSliderSize<`u`?e.horizontalSliderSize:t.horizontalScrollbarSize,t.verticalSliderSize=typeof e.verticalSliderSize<`u`?e.verticalSliderSize:t.verticalScrollbarSize,xA&&(t.className+=` mac`),t}var SM=class extends Ek{constructor(e,t,n,r,i,a,o,s){super(),this._bufferService=n,this._optionsService=o,this._renderService=s,this._onRequestScrollLines=this._register(new Q),this.onRequestScrollLines=this._onRequestScrollLines.event,this._isSyncing=!1,this._isHandlingScroll=!1,this._suppressOnScrollHandler=!1;let c=this._register(new eM({forceIntegerValues:!1,smoothScrollDuration:this._optionsService.rawOptions.smoothScrollDuration,scheduleAtNextAnimationFrame:e=>Nj(r.window,e)}));this._register(this._optionsService.onSpecificOptionChange(`smoothScrollDuration`,()=>{c.setSmoothScrollDuration(this._optionsService.rawOptions.smoothScrollDuration)})),this._scrollableElement=this._register(new bM(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(Lk.runAndSubscribe(a.onChangeColors,()=>{this._scrollableElement.getDomNode().style.backgroundColor=a.colors.background.css})),e.appendChild(this._scrollableElement.getDomNode()),this._register(Ck(()=>this._scrollableElement.getDomNode().remove())),this._styleElement=r.mainDocument.createElement(`style`),t.appendChild(this._styleElement),this._register(Ck(()=>this._styleElement.remove())),this._register(Lk.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(`
|
|
80
80
|
`)})),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}};SM=eO([Z(2,DO),Z(3,BO),Z(4,OO),Z(5,GO),Z(6,NO),Z(7,HO)],SM);var CM=class extends Ek{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(Ck(()=>{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()}};CM=eO([Z(1,DO),Z(2,BO),Z(3,IO),Z(4,HO)],CM);var wM=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)}},TM={full:0,left:0,center:0,right:0},EM={full:0,left:0,center:0,right:0},DM={full:0,left:0,center:0,right:0},OM=class extends Ek{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 wM,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(Ck(()=>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);EM.full=this._canvas.width,EM.left=e,EM.center=t,EM.right=e,this._refreshDrawHeightConstants(),DM.full=1,DM.left=1,DM.center=1+EM.left,DM.right=1+EM.left+EM.center}_refreshDrawHeightConstants(){TM.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);TM.left=t,TM.center=t,TM.right=t}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*TM.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*TM.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*TM.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*TM.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(DM[e.position||`full`],Math.round((this._canvas.height-1)*(e.startBufferLine/this._bufferService.buffers.active.lines.length)-TM[e.position||`full`]/2),EM[e.position||`full`],Math.round((this._canvas.height-1)*((e.endBufferLine-e.startBufferLine)/this._bufferService.buffers.active.lines.length)+TM[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}))}};OM=eO([Z(2,DO),Z(3,IO),Z(4,HO),Z(5,NO),Z(6,GO),Z(7,BO)],OM);var $;(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=`
|
|
81
|
-
`,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=``))($||={});var kM;(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=``))(kM||={});var AM;(e=>e.ST=`${$.ESC}\\`)(AM||={});var jM=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):!0}_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(`${$.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)}}};jM=eO([Z(2,DO),Z(3,NO),Z(4,kO),Z(5,HO)],jM);var MM=0,NM=0,PM=0,FM=0,IM={css:`#00000000`,rgba:0},LM;(e=>{function t(e,t,n,r){return r===void 0?`#${HM(e)}${HM(t)}${HM(n)}`:`#${HM(e)}${HM(t)}${HM(n)}${HM(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})(LM||={});var RM;(e=>{function t(e,t){if(FM=(t.rgba&255)/255,FM===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 MM=a+Math.round((n-a)*FM),NM=o+Math.round((r-o)*FM),PM=s+Math.round((i-s)*FM),{css:LM.toCss(MM,NM,PM),rgba:LM.toRgba(MM,NM,PM)}}e.blend=t;function n(e){return(e.rgba&255)==255}e.isOpaque=n;function r(e,t,n){let r=VM.ensureContrastRatio(e.rgba,t.rgba,n);if(r)return LM.toColor(r>>24&255,r>>16&255,r>>8&255)}e.ensureContrastRatio=r;function i(e){let t=(e.rgba|255)>>>0;return[MM,NM,PM]=VM.toChannels(t),{css:LM.toCss(MM,NM,PM),rgba:t}}e.opaque=i;function a(e,t){return FM=Math.round(t*255),[MM,NM,PM]=VM.toChannels(e.rgba),{css:LM.toCss(MM,NM,PM,FM),rgba:LM.toRgba(MM,NM,PM,FM)}}e.opacity=a;function o(e,t){return FM=e.rgba&255,a(e,FM*t/255)}e.multiplyOpacity=o;function s(e){return[e.rgba>>24&255,e.rgba>>16&255,e.rgba>>8&255]}e.toColorRGB=s})(RM||={});var zM;(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 MM=parseInt(e.slice(1,2).repeat(2),16),NM=parseInt(e.slice(2,3).repeat(2),16),PM=parseInt(e.slice(3,4).repeat(2),16),LM.toColor(MM,NM,PM);case 5:return MM=parseInt(e.slice(1,2).repeat(2),16),NM=parseInt(e.slice(2,3).repeat(2),16),PM=parseInt(e.slice(3,4).repeat(2),16),FM=parseInt(e.slice(4,5).repeat(2),16),LM.toColor(MM,NM,PM,FM);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 MM=parseInt(r[1]),NM=parseInt(r[2]),PM=parseInt(r[3]),FM=Math.round((r[5]===void 0?1:parseFloat(r[5]))*255),LM.toColor(MM,NM,PM,FM);if(!t||!n||(t.fillStyle=n,t.fillStyle=e,typeof t.fillStyle!=`string`)||(t.fillRect(0,0,1,1),[MM,NM,PM,FM]=t.getImageData(0,0,1,1).data,FM!==255))throw Error(`css.toColor: Unsupported css format`);return{rgba:LM.toRgba(MM,NM,PM,FM),css:e}}e.toColor=r})(zM||={});var BM;(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})(BM||={});var VM;(e=>{function t(e,t){if(FM=(t&255)/255,FM===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 MM=a+Math.round((n-a)*FM),NM=o+Math.round((r-o)*FM),PM=s+Math.round((i-s)*FM),LM.toRgba(MM,NM,PM)}e.blend=t;function n(e,t,n){let a=BM.relativeLuminance(e>>8),o=BM.relativeLuminance(t>>8);if(UM(a,o)<n){if(o<a){let o=r(e,t,n),s=UM(a,BM.relativeLuminance(o>>8));if(s<n){let r=i(e,t,n);return s>UM(a,BM.relativeLuminance(r>>8))?o:r}return o}let s=i(e,t,n),c=UM(a,BM.relativeLuminance(s>>8));if(c<n){let i=r(e,t,n);return c>UM(a,BM.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=UM(BM.relativeLuminance2(o,s,c),BM.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=UM(BM.relativeLuminance2(o,s,c),BM.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=UM(BM.relativeLuminance2(o,s,c),BM.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=UM(BM.relativeLuminance2(o,s,c),BM.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})(VM||={});function HM(e){let t=e.toString(16);return t.length<2?`0`+t:t}function UM(e,t){return e<t?(t+.05)/(e+.05):(e+.05)/(t+.05)}var WM=class extends vO{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()]}},GM=class{constructor(e){this._bufferService=e,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new bO}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||_O.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++)GM._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||_O.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}};GM=eO([Z(0,DO)],GM);function KM(e){return 57508<=e&&e<=57558}function qM(e){return 9472<=e&&e<=9631}function JM(e){return KM(e)||qM(e)}function YM(){return{css:{canvas:XM(),cell:XM()},device:{canvas:XM(),cell:XM(),char:{width:0,height:0,left:0,top:0}}}}function XM(){return{width:0,height:0}}var ZM=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 bO,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,w=!1,T=0,E=0,D=[],O=l!==-1&&u!==-1;for(let k=0;k<m;k++){e.loadCell(k,this._workCell);let m=this._workCell.getWidth();if(m===0)continue;let A=!1,j=k>=E,M=k,N=this._workCell;if(f.length>0&&k===f[0][0]&&j){let r=f.shift(),i=this._isCellInSelection(r[0],t);for(v=r[0]+1;v<r[1];v++)j&&=i===this._isCellInSelection(v,t);j&&=!n||a<r[0]||a>=r[1],j?(A=!0,N=new WM(this._workCell,e.translateToString(!0,r[0],r[1]),r[1]-r[0]),M=r[1]-1,m=N.getWidth()):E=r[1]}let P=this._isCellInSelection(k,t),F=n&&k===a,I=O&&k>=l&&k<=u,L=!1;this._decorationService.forEachDecorationAtCell(k,t,void 0,e=>{L=!0});let ee=N.getChars()||_O;if(ee===` `&&(N.isUnderline()||N.isOverline())&&(ee=`\xA0`),T=m*s-c.get(ee,N.isBold(),N.isItalic()),!h)h=this._document.createElement(`span`);else if(g&&(P&&w||!P&&!w&&N.bg===y)&&(P&&w&&p.selectionForeground||N.fg===b)&&N.extended.ext===x&&I===S&&T===C&&!F&&!A&&!L&&j){N.isInvisible()?_+=_O:_+=ee,g++;continue}else g&&(h.textContent=_),h=this._document.createElement(`span`),g=0,_=``;if(y=N.bg,b=N.fg,x=N.extended.ext,S=I,C=T,w=P,A&&a>=k&&a<=M&&(a=k),!this._coreService.isCursorHidden&&F&&this._coreService.isCursorInitialized){if(D.push(`xterm-cursor`),this._coreBrowserService.isFocused)o&&D.push(`xterm-cursor-blink`),D.push(r===`bar`?`xterm-cursor-bar`:r===`underline`?`xterm-cursor-underline`:`xterm-cursor-block`);else if(i)switch(i){case`outline`:D.push(`xterm-cursor-outline`);break;case`block`:D.push(`xterm-cursor-block`);break;case`bar`:D.push(`xterm-cursor-bar`);break;case`underline`:D.push(`xterm-cursor-underline`);break;default:break}}if(N.isBold()&&D.push(`xterm-bold`),N.isItalic()&&D.push(`xterm-italic`),N.isDim()&&D.push(`xterm-dim`),_=N.isInvisible()?_O:N.getChars()||_O,N.isUnderline()&&(D.push(`xterm-underline-${N.extended.underlineStyle}`),_===` `&&(_=`\xA0`),!N.isUnderlineColorDefault()))if(N.isUnderlineColorRGB())h.style.textDecorationColor=`rgb(${vO.toColorRGB(N.getUnderlineColor()).join(`,`)})`;else{let e=N.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&N.isBold()&&e<8&&(e+=8),h.style.textDecorationColor=p.ansi[e].css}N.isOverline()&&(D.push(`xterm-overline`),_===` `&&(_=`\xA0`)),N.isStrikethrough()&&D.push(`xterm-strikethrough`),I&&(h.style.textDecoration=`underline`);let R=N.getFgColor(),z=N.getFgColorMode(),B=N.getBgColor(),te=N.getBgColorMode(),V=!!N.isInverse();if(V){let e=R;R=B,B=e;let t=z;z=te,te=t}let ne,H,re=!1;this._decorationService.forEachDecorationAtCell(k,t,void 0,e=>{e.options.layer!==`top`&&re||(e.backgroundColorRGB&&(te=50331648,B=e.backgroundColorRGB.rgba>>8&16777215,ne=e.backgroundColorRGB),e.foregroundColorRGB&&(z=50331648,R=e.foregroundColorRGB.rgba>>8&16777215,H=e.foregroundColorRGB),re=e.options.layer===`top`)}),!re&&P&&(ne=this._coreBrowserService.isFocused?p.selectionBackgroundOpaque:p.selectionInactiveBackgroundOpaque,B=ne.rgba>>8&16777215,te=50331648,re=!0,p.selectionForeground&&(z=50331648,R=p.selectionForeground.rgba>>8&16777215,H=p.selectionForeground)),re&&D.push(`xterm-decoration-top`);let U;switch(te){case 16777216:case 33554432:U=p.ansi[B],D.push(`xterm-bg-${B}`);break;case 50331648:U=LM.toColor(B>>16,B>>8&255,B&255),this._addStyle(h,`background-color:#${QM((B>>>0).toString(16),`0`,6)}`);break;default:V?(U=p.foreground,D.push(`xterm-bg-257`)):U=p.background}switch(ne||N.isDim()&&(ne=RM.multiplyOpacity(U,.5)),z){case 16777216:case 33554432:N.isBold()&&R<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(R+=8),this._applyMinimumContrast(h,U,p.ansi[R],N,ne,void 0)||D.push(`xterm-fg-${R}`);break;case 50331648:let e=LM.toColor(R>>16&255,R>>8&255,R&255);this._applyMinimumContrast(h,U,e,N,ne,H)||this._addStyle(h,`color:#${QM(R.toString(16),`0`,6)}`);break;default:this._applyMinimumContrast(h,U,p.foreground,N,ne,H)||V&&D.push(`xterm-fg-257`)}D.length&&=(h.className=D.join(` `),0),!F&&!A&&!L&&j?g++:h.textContent=_,T!==this.defaultSpacing&&(h.style.letterSpacing=`${T}px`),d.push(h),k=M}return h&&g&&(h.textContent=_),d}_applyMinimumContrast(e,t,n,r,i,a){if(this._optionsService.rawOptions.minimumContrastRatio===1||JM(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=RM.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]}};ZM=eO([Z(1,WO),Z(2,NO),Z(3,BO),Z(4,kO),Z(5,IO),Z(6,GO)],ZM);function QM(e,t,n){for(;e.length<n;)e=t+e;return e}var $M=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}},eN=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);if(s>=e.rows||c<0){this.clear();return}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 tN(){return new eN}var nN=`xterm-dom-renderer-owner-`,rN=`xterm-rows`,iN=`xterm-fg-`,aN=`xterm-bg-`,oN=`xterm-focus`,sN=`xterm-selection`,cN=1,lN=class extends Ek{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=cN++,this._rowElements=[],this._selectionRenderModel=tN(),this.onRequestRedraw=this._register(new Q).event,this._rowContainer=this._document.createElement(`div`),this._rowContainer.classList.add(rN),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(sN),this._selectionContainer.setAttribute(`aria-hidden`,`true`),this.dimensions=YM(),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(ZM,document),this._element.classList.add(nN+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(Ck(()=>{this._element.classList.remove(nN+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()})),this._widthCache=new $M(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} .${rN} 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} .${rN} { 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} .${rN} .xterm-dim { color: ${RM.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} .${rN}.${oN} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${n} 1s step-end infinite;}${this._terminalSelector} .${rN}.${oN} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${r} 1s step-end infinite;}${this._terminalSelector} .${rN}.${oN} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${i} 1s step-end infinite;}${this._terminalSelector} .${rN} .xterm-cursor.xterm-cursor-block { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css};}${this._terminalSelector} .${rN} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${e.cursor.css} !important; color: ${e.cursorAccent.css} !important;}${this._terminalSelector} .${rN} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${e.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${rN} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${e.cursor.css} inset;}${this._terminalSelector} .${rN} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${e.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,t+=`${this._terminalSelector} .${sN} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${sN} div { position: absolute; background-color: ${e.selectionBackgroundOpaque.css};}${this._terminalSelector} .${sN} div { position: absolute; background-color: ${e.selectionInactiveBackgroundOpaque.css};}`;for(let[n,r]of e.ansi.entries())t+=`${this._terminalSelector} .${iN}${n} { color: ${r.css}; }${this._terminalSelector} .${iN}${n}.xterm-dim { color: ${RM.multiplyOpacity(r,.5).css}; }${this._terminalSelector} .${aN}${n} { background-color: ${r.css}; }`;t+=`${this._terminalSelector} .${iN}257 { color: ${RM.opaque(e.background).css}; }${this._terminalSelector} .${iN}257.xterm-dim { color: ${RM.multiplyOpacity(RM.opaque(e.background),.5).css}; }${this._terminalSelector} .${aN}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(oN),this.renderRows(0,this._bufferService.rows-1)}handleFocus(){this._rowContainer.classList.add(oN),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`.${nN}${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))}}};lN=eO([Z(7,jO),Z(8,zO),Z(9,NO),Z(10,DO),Z(11,kO),Z(12,BO),Z(13,GO)],lN);var uN=class extends Ek{constructor(e,t,n){super(),this._optionsService=n,this.width=0,this.height=0,this._onCharSizeChange=this._register(new Q),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this._register(new pN(this._optionsService))}catch{this._measureStrategy=this._register(new fN(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())}};uN=eO([Z(2,NO)],uN);var dN=class extends Ek{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)}},fN=class extends dN{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}},pN=class extends dN{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}},mN=class extends Ek{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 hN(this._window)),this._onDprChange=this._register(new Q),this.onDprChange=this._onDprChange.event,this._onWindowChange=this._register(new Q),this.onWindowChange=this._onWindowChange.event,this._register(this.onWindowChange(e=>this._screenDprMonitor.setWindow(e))),this._register(Lk.forward(this._screenDprMonitor.onDprChange,this._onDprChange)),this._register(kj(this._textarea,`focus`,()=>this._isFocused=!0)),this._register(kj(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}},hN=class extends Ek{constructor(e){super(),this._parentWindow=e,this._windowResizeListener=this._register(new Dk),this._onDprChange=this._register(new Q),this.onDprChange=this._onDprChange.event,this._outerListener=()=>this._setDprAndFireIfDiffers(),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._updateDpr(),this._setWindowResizeListener(),this._register(Ck(()=>this.clearListener()))}setWindow(e){this._parentWindow=e,this._setWindowResizeListener(),this._setDprAndFireIfDiffers()}_setWindowResizeListener(){this._windowResizeListener.value=kj(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)}},gN=class extends Ek{constructor(){super(),this.linkProviders=[],this._register(Ck(()=>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 _N(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 vN(e,t,n,r,i,a,o,s,c){if(!a)return;let l=_N(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 yN=class{constructor(e,t){this._renderService=e,this._charSizeService=t}getCoords(e,t,n,r,i){return vN(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=_N(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])}}};yN=eO([Z(0,HO),Z(1,zO)],yN);var bN=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=[]}},xN={};$D(xN,{getSafariVersion:()=>ON,isChromeOS:()=>PN,isFirefox:()=>TN,isIpad:()=>AN,isIphone:()=>jN,isLegacyEdge:()=>EN,isLinux:()=>NN,isMac:()=>kN,isNode:()=>SN,isSafari:()=>DN,isWindows:()=>MN});var SN=typeof process<`u`&&`title`in process,CN=SN?`node`:navigator.userAgent,wN=SN?`node`:navigator.platform,TN=CN.includes(`Firefox`),EN=CN.includes(`Edge`),DN=/^((?!chrome|android).)*safari/i.test(CN);function ON(){if(!DN)return 0;let e=CN.match(/Version\/(\d+)/);return e===null||e.length<2?0:parseInt(e[1])}var kN=[`Macintosh`,`MacIntel`,`MacPPC`,`Mac68K`].includes(wN),AN=wN===`iPad`,jN=wN===`iPhone`,MN=[`Windows`,`Win16`,`Win32`,`WinCE`].includes(wN),NN=wN.indexOf(`Linux`)>=0,PN=/\bCrOS\b/.test(CN),FN=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()}},IN=class extends FN{_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())}}},LN=class extends FN{_requestCallback(e){return requestIdleCallback(e)}_cancelCallback(e){cancelIdleCallback(e)}},RN=!SN&&`requestIdleCallback`in window?LN:IN,zN=class{constructor(){this._queue=new RN}set(e){this._queue.clear(),this._queue.enqueue(e)}flush(){this._queue.flush()}},BN=class extends Ek{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 Dk),this._pausedResizeTask=new zN,this._observerDisposable=this._register(new Dk),this._isPaused=!1,this._needsFullRefresh=!1,this._isNextRenderRedrawOnly=!0,this._needsSelectionRefresh=!1,this._canvasWidth=0,this._canvasHeight=0,this._selectionState={start:void 0,end:void 0,columnSelectMode:!1},this._onDimensionsChange=this._register(new Q),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this._register(new Q),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this._register(new Q),this.onRender=this._onRender.event,this._onRefreshRequest=this._register(new Q),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new bN((e,t)=>this._renderRows(e,t),this._coreBrowserService),this._register(this._renderDebouncer),this._syncOutputHandler=new VN(this._coreBrowserService,this._coreService,()=>this._fullRefresh()),this._register(Ck(()=>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=Ck(()=>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()}};BN=eO([Z(2,NO),Z(3,zO),Z(4,kO),Z(5,IO),Z(6,DO),Z(7,BO),Z(8,GO)],BN);var VN=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 HN(e,t,n,r){let i=n.buffer.x,a=n.buffer.y;if(!n.buffer.hasScrollback)return GN(i,a,e,t,n,r)+KN(a,t,n,r)+qN(i,a,e,t,n,r);let o;if(a===t)return o=i>e?`D`:`C`,eP(Math.abs(i-e),$N(o,r));o=a>t?`D`:`C`;let s=Math.abs(a-t);return eP(WN(a>t?e:i,n)+(s-1)*n.cols+1+UN(a>t?i:e,n),$N(o,r))}function UN(e,t){return e-1}function WN(e,t){return t.cols-e}function GN(e,t,n,r,i,a){return KN(t,r,i,a).length===0?``:eP(QN(e,t,e,t-YN(t,i),!1,i).length,$N(`D`,a))}function KN(e,t,n,r){let i=e-YN(e,n),a=t-YN(t,n);return eP(Math.abs(i-a)-JN(e,t,n),$N(ZN(e,t),r))}function qN(e,t,n,r,i,a){let o;o=KN(t,r,i,a).length>0?r-YN(r,i):t;let s=r,c=XN(e,t,n,r,i,a);return eP(QN(e,o,n,s,c===`C`,i).length,$N(c,a))}function JN(e,t,n){let r=0,i=e-YN(e,n),a=t-YN(t,n);for(let o=0;o<Math.abs(i-a);o++){let a=ZN(e,t)===`A`?-1:1;n.buffer.lines.get(i+a*o)?.isWrapped&&r++}return r}function YN(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 XN(e,t,n,r,i,a){let o;return o=KN(n,r,i,a).length>0?r-YN(r,i):t,e<n&&o<=r||e>=n&&o<r?`C`:`D`}function ZN(e,t){return e>t?`A`:`B`}function QN(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 $N(e,t){let n=t?`O`:`[`;return $.ESC+n+e}function eP(e,t){e=Math.floor(e);let n=``;for(let r=0;r<e;r++)n+=t;return n}var tP=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 nP(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 rP=50,iP=15,aP=50,oP=500,sP=RegExp(`\xA0`,`g`),cP=class extends Ek{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 bO,this._mouseDownTimeStamp=0,this._oldHasSelection=!1,this._oldSelectionStart=void 0,this._oldSelectionEnd=void 0,this._onLinuxMouseSelection=this._register(new Q),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this._register(new Q),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this._register(new Q),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this._register(new Q),this.onRequestScrollLines=this._onRequestScrollLines.event,this._mouseMoveListener=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 tP(this._bufferService),this._activeSelectionMode=0,this._register(Ck(()=>{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(sP,` `)).join(MN?`\r
|
|
81
|
+
`,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=``))($||={});var kM;(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=``))(kM||={});var AM;(e=>e.ST=`${$.ESC}\\`)(AM||={});var jM=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):!0}_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(`${$.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)}}};jM=eO([Z(2,DO),Z(3,NO),Z(4,kO),Z(5,HO)],jM);var MM=0,NM=0,PM=0,FM=0,IM={css:`#00000000`,rgba:0},LM;(e=>{function t(e,t,n,r){return r===void 0?`#${HM(e)}${HM(t)}${HM(n)}`:`#${HM(e)}${HM(t)}${HM(n)}${HM(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})(LM||={});var RM;(e=>{function t(e,t){if(FM=(t.rgba&255)/255,FM===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 MM=a+Math.round((n-a)*FM),NM=o+Math.round((r-o)*FM),PM=s+Math.round((i-s)*FM),{css:LM.toCss(MM,NM,PM),rgba:LM.toRgba(MM,NM,PM)}}e.blend=t;function n(e){return(e.rgba&255)==255}e.isOpaque=n;function r(e,t,n){let r=VM.ensureContrastRatio(e.rgba,t.rgba,n);if(r)return LM.toColor(r>>24&255,r>>16&255,r>>8&255)}e.ensureContrastRatio=r;function i(e){let t=(e.rgba|255)>>>0;return[MM,NM,PM]=VM.toChannels(t),{css:LM.toCss(MM,NM,PM),rgba:t}}e.opaque=i;function a(e,t){return FM=Math.round(t*255),[MM,NM,PM]=VM.toChannels(e.rgba),{css:LM.toCss(MM,NM,PM,FM),rgba:LM.toRgba(MM,NM,PM,FM)}}e.opacity=a;function o(e,t){return FM=e.rgba&255,a(e,FM*t/255)}e.multiplyOpacity=o;function s(e){return[e.rgba>>24&255,e.rgba>>16&255,e.rgba>>8&255]}e.toColorRGB=s})(RM||={});var zM;(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 MM=parseInt(e.slice(1,2).repeat(2),16),NM=parseInt(e.slice(2,3).repeat(2),16),PM=parseInt(e.slice(3,4).repeat(2),16),LM.toColor(MM,NM,PM);case 5:return MM=parseInt(e.slice(1,2).repeat(2),16),NM=parseInt(e.slice(2,3).repeat(2),16),PM=parseInt(e.slice(3,4).repeat(2),16),FM=parseInt(e.slice(4,5).repeat(2),16),LM.toColor(MM,NM,PM,FM);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 MM=parseInt(r[1]),NM=parseInt(r[2]),PM=parseInt(r[3]),FM=Math.round((r[5]===void 0?1:parseFloat(r[5]))*255),LM.toColor(MM,NM,PM,FM);if(!t||!n||(t.fillStyle=n,t.fillStyle=e,typeof t.fillStyle!=`string`)||(t.fillRect(0,0,1,1),[MM,NM,PM,FM]=t.getImageData(0,0,1,1).data,FM!==255))throw Error(`css.toColor: Unsupported css format`);return{rgba:LM.toRgba(MM,NM,PM,FM),css:e}}e.toColor=r})(zM||={});var BM;(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})(BM||={});var VM;(e=>{function t(e,t){if(FM=(t&255)/255,FM===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 MM=a+Math.round((n-a)*FM),NM=o+Math.round((r-o)*FM),PM=s+Math.round((i-s)*FM),LM.toRgba(MM,NM,PM)}e.blend=t;function n(e,t,n){let a=BM.relativeLuminance(e>>8),o=BM.relativeLuminance(t>>8);if(UM(a,o)<n){if(o<a){let o=r(e,t,n),s=UM(a,BM.relativeLuminance(o>>8));if(s<n){let r=i(e,t,n);return s>UM(a,BM.relativeLuminance(r>>8))?o:r}return o}let s=i(e,t,n),c=UM(a,BM.relativeLuminance(s>>8));if(c<n){let i=r(e,t,n);return c>UM(a,BM.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=UM(BM.relativeLuminance2(o,s,c),BM.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=UM(BM.relativeLuminance2(o,s,c),BM.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=UM(BM.relativeLuminance2(o,s,c),BM.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=UM(BM.relativeLuminance2(o,s,c),BM.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})(VM||={});function HM(e){let t=e.toString(16);return t.length<2?`0`+t:t}function UM(e,t){return e<t?(t+.05)/(e+.05):(e+.05)/(t+.05)}var WM=class extends vO{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()]}},GM=class{constructor(e){this._bufferService=e,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new bO}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||_O.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++)GM._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||_O.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}};GM=eO([Z(0,DO)],GM);function KM(e){return 57508<=e&&e<=57558}function qM(e){return 9472<=e&&e<=9631}function JM(e){return KM(e)||qM(e)}function YM(){return{css:{canvas:XM(),cell:XM()},device:{canvas:XM(),cell:XM(),char:{width:0,height:0,left:0,top:0}}}}function XM(){return{width:0,height:0}}var ZM=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 bO,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,w=!1,T=0,E=0,D=[],O=l!==-1&&u!==-1;for(let k=0;k<m;k++){e.loadCell(k,this._workCell);let m=this._workCell.getWidth();if(m===0)continue;let A=!1,j=k>=E,M=k,N=this._workCell;if(f.length>0&&k===f[0][0]&&j){let r=f.shift(),i=this._isCellInSelection(r[0],t);for(v=r[0]+1;v<r[1];v++)j&&=i===this._isCellInSelection(v,t);j&&=!n||a<r[0]||a>=r[1],j?(A=!0,N=new WM(this._workCell,e.translateToString(!0,r[0],r[1]),r[1]-r[0]),M=r[1]-1,m=N.getWidth()):E=r[1]}let P=this._isCellInSelection(k,t),F=n&&k===a,I=O&&k>=l&&k<=u,L=!1;this._decorationService.forEachDecorationAtCell(k,t,void 0,e=>{L=!0});let R=N.getChars()||_O;if(R===` `&&(N.isUnderline()||N.isOverline())&&(R=`\xA0`),T=m*s-c.get(R,N.isBold(),N.isItalic()),!h)h=this._document.createElement(`span`);else if(g&&(P&&w||!P&&!w&&N.bg===y)&&(P&&w&&p.selectionForeground||N.fg===b)&&N.extended.ext===x&&I===S&&T===C&&!F&&!A&&!L&&j){N.isInvisible()?_+=_O:_+=R,g++;continue}else g&&(h.textContent=_),h=this._document.createElement(`span`),g=0,_=``;if(y=N.bg,b=N.fg,x=N.extended.ext,S=I,C=T,w=P,A&&a>=k&&a<=M&&(a=k),!this._coreService.isCursorHidden&&F&&this._coreService.isCursorInitialized){if(D.push(`xterm-cursor`),this._coreBrowserService.isFocused)o&&D.push(`xterm-cursor-blink`),D.push(r===`bar`?`xterm-cursor-bar`:r===`underline`?`xterm-cursor-underline`:`xterm-cursor-block`);else if(i)switch(i){case`outline`:D.push(`xterm-cursor-outline`);break;case`block`:D.push(`xterm-cursor-block`);break;case`bar`:D.push(`xterm-cursor-bar`);break;case`underline`:D.push(`xterm-cursor-underline`);break;default:break}}if(N.isBold()&&D.push(`xterm-bold`),N.isItalic()&&D.push(`xterm-italic`),N.isDim()&&D.push(`xterm-dim`),_=N.isInvisible()?_O:N.getChars()||_O,N.isUnderline()&&(D.push(`xterm-underline-${N.extended.underlineStyle}`),_===` `&&(_=`\xA0`),!N.isUnderlineColorDefault()))if(N.isUnderlineColorRGB())h.style.textDecorationColor=`rgb(${vO.toColorRGB(N.getUnderlineColor()).join(`,`)})`;else{let e=N.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&N.isBold()&&e<8&&(e+=8),h.style.textDecorationColor=p.ansi[e].css}N.isOverline()&&(D.push(`xterm-overline`),_===` `&&(_=`\xA0`)),N.isStrikethrough()&&D.push(`xterm-strikethrough`),I&&(h.style.textDecoration=`underline`);let z=N.getFgColor(),B=N.getFgColorMode(),V=N.getBgColor(),ee=N.getBgColorMode(),H=!!N.isInverse();if(H){let e=z;z=V,V=e;let t=B;B=ee,ee=t}let te,U,ne=!1;this._decorationService.forEachDecorationAtCell(k,t,void 0,e=>{e.options.layer!==`top`&&ne||(e.backgroundColorRGB&&(ee=50331648,V=e.backgroundColorRGB.rgba>>8&16777215,te=e.backgroundColorRGB),e.foregroundColorRGB&&(B=50331648,z=e.foregroundColorRGB.rgba>>8&16777215,U=e.foregroundColorRGB),ne=e.options.layer===`top`)}),!ne&&P&&(te=this._coreBrowserService.isFocused?p.selectionBackgroundOpaque:p.selectionInactiveBackgroundOpaque,V=te.rgba>>8&16777215,ee=50331648,ne=!0,p.selectionForeground&&(B=50331648,z=p.selectionForeground.rgba>>8&16777215,U=p.selectionForeground)),ne&&D.push(`xterm-decoration-top`);let re;switch(ee){case 16777216:case 33554432:re=p.ansi[V],D.push(`xterm-bg-${V}`);break;case 50331648:re=LM.toColor(V>>16,V>>8&255,V&255),this._addStyle(h,`background-color:#${QM((V>>>0).toString(16),`0`,6)}`);break;default:H?(re=p.foreground,D.push(`xterm-bg-257`)):re=p.background}switch(te||N.isDim()&&(te=RM.multiplyOpacity(re,.5)),B){case 16777216:case 33554432:N.isBold()&&z<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(z+=8),this._applyMinimumContrast(h,re,p.ansi[z],N,te,void 0)||D.push(`xterm-fg-${z}`);break;case 50331648:let e=LM.toColor(z>>16&255,z>>8&255,z&255);this._applyMinimumContrast(h,re,e,N,te,U)||this._addStyle(h,`color:#${QM(z.toString(16),`0`,6)}`);break;default:this._applyMinimumContrast(h,re,p.foreground,N,te,U)||H&&D.push(`xterm-fg-257`)}D.length&&=(h.className=D.join(` `),0),!F&&!A&&!L&&j?g++:h.textContent=_,T!==this.defaultSpacing&&(h.style.letterSpacing=`${T}px`),d.push(h),k=M}return h&&g&&(h.textContent=_),d}_applyMinimumContrast(e,t,n,r,i,a){if(this._optionsService.rawOptions.minimumContrastRatio===1||JM(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=RM.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]}};ZM=eO([Z(1,WO),Z(2,NO),Z(3,BO),Z(4,kO),Z(5,IO),Z(6,GO)],ZM);function QM(e,t,n){for(;e.length<n;)e=t+e;return e}var $M=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}},eN=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);if(s>=e.rows||c<0){this.clear();return}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 tN(){return new eN}var nN=`xterm-dom-renderer-owner-`,rN=`xterm-rows`,iN=`xterm-fg-`,aN=`xterm-bg-`,oN=`xterm-focus`,sN=`xterm-selection`,cN=1,lN=class extends Ek{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=cN++,this._rowElements=[],this._selectionRenderModel=tN(),this.onRequestRedraw=this._register(new Q).event,this._rowContainer=this._document.createElement(`div`),this._rowContainer.classList.add(rN),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(sN),this._selectionContainer.setAttribute(`aria-hidden`,`true`),this.dimensions=YM(),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(ZM,document),this._element.classList.add(nN+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(Ck(()=>{this._element.classList.remove(nN+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()})),this._widthCache=new $M(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} .${rN} 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} .${rN} { 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} .${rN} .xterm-dim { color: ${RM.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} .${rN}.${oN} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${n} 1s step-end infinite;}${this._terminalSelector} .${rN}.${oN} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${r} 1s step-end infinite;}${this._terminalSelector} .${rN}.${oN} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${i} 1s step-end infinite;}${this._terminalSelector} .${rN} .xterm-cursor.xterm-cursor-block { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css};}${this._terminalSelector} .${rN} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${e.cursor.css} !important; color: ${e.cursorAccent.css} !important;}${this._terminalSelector} .${rN} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${e.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${rN} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${e.cursor.css} inset;}${this._terminalSelector} .${rN} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${e.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,t+=`${this._terminalSelector} .${sN} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${sN} div { position: absolute; background-color: ${e.selectionBackgroundOpaque.css};}${this._terminalSelector} .${sN} div { position: absolute; background-color: ${e.selectionInactiveBackgroundOpaque.css};}`;for(let[n,r]of e.ansi.entries())t+=`${this._terminalSelector} .${iN}${n} { color: ${r.css}; }${this._terminalSelector} .${iN}${n}.xterm-dim { color: ${RM.multiplyOpacity(r,.5).css}; }${this._terminalSelector} .${aN}${n} { background-color: ${r.css}; }`;t+=`${this._terminalSelector} .${iN}257 { color: ${RM.opaque(e.background).css}; }${this._terminalSelector} .${iN}257.xterm-dim { color: ${RM.multiplyOpacity(RM.opaque(e.background),.5).css}; }${this._terminalSelector} .${aN}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(oN),this.renderRows(0,this._bufferService.rows-1)}handleFocus(){this._rowContainer.classList.add(oN),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`.${nN}${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))}}};lN=eO([Z(7,jO),Z(8,zO),Z(9,NO),Z(10,DO),Z(11,kO),Z(12,BO),Z(13,GO)],lN);var uN=class extends Ek{constructor(e,t,n){super(),this._optionsService=n,this.width=0,this.height=0,this._onCharSizeChange=this._register(new Q),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this._register(new pN(this._optionsService))}catch{this._measureStrategy=this._register(new fN(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())}};uN=eO([Z(2,NO)],uN);var dN=class extends Ek{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)}},fN=class extends dN{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}},pN=class extends dN{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}},mN=class extends Ek{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 hN(this._window)),this._onDprChange=this._register(new Q),this.onDprChange=this._onDprChange.event,this._onWindowChange=this._register(new Q),this.onWindowChange=this._onWindowChange.event,this._register(this.onWindowChange(e=>this._screenDprMonitor.setWindow(e))),this._register(Lk.forward(this._screenDprMonitor.onDprChange,this._onDprChange)),this._register(kj(this._textarea,`focus`,()=>this._isFocused=!0)),this._register(kj(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}},hN=class extends Ek{constructor(e){super(),this._parentWindow=e,this._windowResizeListener=this._register(new Dk),this._onDprChange=this._register(new Q),this.onDprChange=this._onDprChange.event,this._outerListener=()=>this._setDprAndFireIfDiffers(),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._updateDpr(),this._setWindowResizeListener(),this._register(Ck(()=>this.clearListener()))}setWindow(e){this._parentWindow=e,this._setWindowResizeListener(),this._setDprAndFireIfDiffers()}_setWindowResizeListener(){this._windowResizeListener.value=kj(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)}},gN=class extends Ek{constructor(){super(),this.linkProviders=[],this._register(Ck(()=>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 _N(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 vN(e,t,n,r,i,a,o,s,c){if(!a)return;let l=_N(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 yN=class{constructor(e,t){this._renderService=e,this._charSizeService=t}getCoords(e,t,n,r,i){return vN(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=_N(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])}}};yN=eO([Z(0,HO),Z(1,zO)],yN);var bN=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=[]}},xN={};$D(xN,{getSafariVersion:()=>ON,isChromeOS:()=>PN,isFirefox:()=>TN,isIpad:()=>AN,isIphone:()=>jN,isLegacyEdge:()=>EN,isLinux:()=>NN,isMac:()=>kN,isNode:()=>SN,isSafari:()=>DN,isWindows:()=>MN});var SN=typeof process<`u`&&`title`in process,CN=SN?`node`:navigator.userAgent,wN=SN?`node`:navigator.platform,TN=CN.includes(`Firefox`),EN=CN.includes(`Edge`),DN=/^((?!chrome|android).)*safari/i.test(CN);function ON(){if(!DN)return 0;let e=CN.match(/Version\/(\d+)/);return e===null||e.length<2?0:parseInt(e[1])}var kN=[`Macintosh`,`MacIntel`,`MacPPC`,`Mac68K`].includes(wN),AN=wN===`iPad`,jN=wN===`iPhone`,MN=[`Windows`,`Win16`,`Win32`,`WinCE`].includes(wN),NN=wN.indexOf(`Linux`)>=0,PN=/\bCrOS\b/.test(CN),FN=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()}},IN=class extends FN{_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())}}},LN=class extends FN{_requestCallback(e){return requestIdleCallback(e)}_cancelCallback(e){cancelIdleCallback(e)}},RN=!SN&&`requestIdleCallback`in window?LN:IN,zN=class{constructor(){this._queue=new RN}set(e){this._queue.clear(),this._queue.enqueue(e)}flush(){this._queue.flush()}},BN=class extends Ek{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 Dk),this._pausedResizeTask=new zN,this._observerDisposable=this._register(new Dk),this._isPaused=!1,this._needsFullRefresh=!1,this._isNextRenderRedrawOnly=!0,this._needsSelectionRefresh=!1,this._canvasWidth=0,this._canvasHeight=0,this._selectionState={start:void 0,end:void 0,columnSelectMode:!1},this._onDimensionsChange=this._register(new Q),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this._register(new Q),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this._register(new Q),this.onRender=this._onRender.event,this._onRefreshRequest=this._register(new Q),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new bN((e,t)=>this._renderRows(e,t),this._coreBrowserService),this._register(this._renderDebouncer),this._syncOutputHandler=new VN(this._coreBrowserService,this._coreService,()=>this._fullRefresh()),this._register(Ck(()=>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=Ck(()=>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()}};BN=eO([Z(2,NO),Z(3,zO),Z(4,kO),Z(5,IO),Z(6,DO),Z(7,BO),Z(8,GO)],BN);var VN=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 HN(e,t,n,r){let i=n.buffer.x,a=n.buffer.y;if(!n.buffer.hasScrollback)return GN(i,a,e,t,n,r)+KN(a,t,n,r)+qN(i,a,e,t,n,r);let o;if(a===t)return o=i>e?`D`:`C`,eP(Math.abs(i-e),$N(o,r));o=a>t?`D`:`C`;let s=Math.abs(a-t);return eP(WN(a>t?e:i,n)+(s-1)*n.cols+1+UN(a>t?i:e,n),$N(o,r))}function UN(e,t){return e-1}function WN(e,t){return t.cols-e}function GN(e,t,n,r,i,a){return KN(t,r,i,a).length===0?``:eP(QN(e,t,e,t-YN(t,i),!1,i).length,$N(`D`,a))}function KN(e,t,n,r){let i=e-YN(e,n),a=t-YN(t,n);return eP(Math.abs(i-a)-JN(e,t,n),$N(ZN(e,t),r))}function qN(e,t,n,r,i,a){let o;o=KN(t,r,i,a).length>0?r-YN(r,i):t;let s=r,c=XN(e,t,n,r,i,a);return eP(QN(e,o,n,s,c===`C`,i).length,$N(c,a))}function JN(e,t,n){let r=0,i=e-YN(e,n),a=t-YN(t,n);for(let o=0;o<Math.abs(i-a);o++){let a=ZN(e,t)===`A`?-1:1;n.buffer.lines.get(i+a*o)?.isWrapped&&r++}return r}function YN(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 XN(e,t,n,r,i,a){let o;return o=KN(n,r,i,a).length>0?r-YN(r,i):t,e<n&&o<=r||e>=n&&o<r?`C`:`D`}function ZN(e,t){return e>t?`A`:`B`}function QN(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 $N(e,t){let n=t?`O`:`[`;return $.ESC+n+e}function eP(e,t){e=Math.floor(e);let n=``;for(let r=0;r<e;r++)n+=t;return n}var tP=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 nP(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 rP=50,iP=15,aP=50,oP=500,sP=RegExp(`\xA0`,`g`),cP=class extends Ek{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 bO,this._mouseDownTimeStamp=0,this._oldHasSelection=!1,this._oldSelectionStart=void 0,this._oldSelectionEnd=void 0,this._onLinuxMouseSelection=this._register(new Q),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this._register(new Q),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this._register(new Q),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this._register(new Q),this.onRequestScrollLines=this._onRequestScrollLines.event,this._mouseMoveListener=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 tP(this._bufferService),this._activeSelectionMode=0,this._register(Ck(()=>{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(sP,` `)).join(MN?`\r
|
|
82
82
|
`:`
|
|
83
83
|
`)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(e){this._refreshAnimationFrame||=this._coreBrowserService.window.requestAnimationFrame(()=>this._refresh()),NN&&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=nP(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=_N(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,-rP),rP),t/=rP,t/Math.abs(t)+Math.round(t*(iP-1)))}shouldForceSelection(e){return kN?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(),aP)}_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&&!(kN&&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<oP&&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=HN(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]);if(!n){this._oldHasSelection&&this._fireOnSelectionChange(e,t,n);return}!e||!t||(!this._oldSelectionStart||!this._oldSelectionEnd||e[0]!==this._oldSelectionStart[0]||e[1]!==this._oldSelectionStart[1]||t[0]!==this._oldSelectionEnd[0]||t[1]!==this._oldSelectionEnd[1])&&this._fireOnSelectionChange(e,t,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?!1: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=nP(n,this._bufferService.cols)}};cP=eO([Z(3,DO),Z(4,kO),Z(5,VO),Z(6,NO),Z(7,HO),Z(8,BO)],cP);var lP=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={}}},uP=class{constructor(){this._color=new lP,this._css=new lP}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()}},dP=Object.freeze((()=>{let e=[zM.toColor(`#2e3436`),zM.toColor(`#cc0000`),zM.toColor(`#4e9a06`),zM.toColor(`#c4a000`),zM.toColor(`#3465a4`),zM.toColor(`#75507b`),zM.toColor(`#06989a`),zM.toColor(`#d3d7cf`),zM.toColor(`#555753`),zM.toColor(`#ef2929`),zM.toColor(`#8ae234`),zM.toColor(`#fce94f`),zM.toColor(`#729fcf`),zM.toColor(`#ad7fa8`),zM.toColor(`#34e2e2`),zM.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:LM.toCss(r,i,a),rgba:LM.toRgba(r,i,a)})}for(let t=0;t<24;t++){let n=8+t*10;e.push({css:LM.toCss(n,n,n),rgba:LM.toRgba(n,n,n)})}return e})()),fP=zM.toColor(`#ffffff`),pP=zM.toColor(`#000000`),mP=zM.toColor(`#ffffff`),hP=pP,gP={css:`rgba(255, 255, 255, 0.3)`,rgba:4294967117},_P=fP,vP=class extends Ek{constructor(e){super(),this._optionsService=e,this._contrastCache=new uP,this._halfContrastCache=new uP,this._onChangeColors=this._register(new Q),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:fP,background:pP,cursor:mP,cursorAccent:hP,selectionForeground:void 0,selectionBackgroundTransparent:gP,selectionBackgroundOpaque:RM.blend(pP,gP),selectionInactiveBackgroundTransparent:gP,selectionInactiveBackgroundOpaque:RM.blend(pP,gP),scrollbarSliderBackground:RM.opacity(fP,.2),scrollbarSliderHoverBackground:RM.opacity(fP,.4),scrollbarSliderActiveBackground:RM.opacity(fP,.5),overviewRulerBorder:fP,ansi:dP.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,fP),t.background=yP(e.background,pP),t.cursor=RM.blend(t.background,yP(e.cursor,mP)),t.cursorAccent=RM.blend(t.background,yP(e.cursorAccent,hP)),t.selectionBackgroundTransparent=yP(e.selectionBackground,gP),t.selectionBackgroundOpaque=RM.blend(t.background,t.selectionBackgroundTransparent),t.selectionInactiveBackgroundTransparent=yP(e.selectionInactiveBackground,t.selectionBackgroundTransparent),t.selectionInactiveBackgroundOpaque=RM.blend(t.background,t.selectionInactiveBackgroundTransparent),t.selectionForeground=e.selectionForeground?yP(e.selectionForeground,IM):void 0,t.selectionForeground===IM&&(t.selectionForeground=void 0),RM.isOpaque(t.selectionBackgroundTransparent)&&(t.selectionBackgroundTransparent=RM.opacity(t.selectionBackgroundTransparent,.3)),RM.isOpaque(t.selectionInactiveBackgroundTransparent)&&(t.selectionInactiveBackgroundTransparent=RM.opacity(t.selectionInactiveBackgroundTransparent,.3)),t.scrollbarSliderBackground=yP(e.scrollbarSliderBackground,RM.opacity(t.foreground,.2)),t.scrollbarSliderHoverBackground=yP(e.scrollbarSliderHoverBackground,RM.opacity(t.foreground,.4)),t.scrollbarSliderActiveBackground=yP(e.scrollbarSliderActiveBackground,RM.opacity(t.foreground,.5)),t.overviewRulerBorder=yP(e.overviewRulerBorder,_P),t.ansi=dP.slice(),t.ansi[0]=yP(e.black,dP[0]),t.ansi[1]=yP(e.red,dP[1]),t.ansi[2]=yP(e.green,dP[2]),t.ansi[3]=yP(e.yellow,dP[3]),t.ansi[4]=yP(e.blue,dP[4]),t.ansi[5]=yP(e.magenta,dP[5]),t.ansi[6]=yP(e.cyan,dP[6]),t.ansi[7]=yP(e.white,dP[7]),t.ansi[8]=yP(e.brightBlack,dP[8]),t.ansi[9]=yP(e.brightRed,dP[9]),t.ansi[10]=yP(e.brightGreen,dP[10]),t.ansi[11]=yP(e.brightYellow,dP[11]),t.ansi[12]=yP(e.brightBlue,dP[12]),t.ansi[13]=yP(e.brightMagenta,dP[13]),t.ansi[14]=yP(e.brightCyan,dP[14]),t.ansi[15]=yP(e.brightWhite,dP[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],dP[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];return}switch(e){case 256:this._colors.foreground=this._restoreColors.foreground;break;case 257:this._colors.background=this._restoreColors.background;break;case 258:this._colors.cursor=this._restoreColors.cursor;break;default:this._colors.ansi[e]=this._restoreColors.ansi[e]}}modifyColors(e){e(this._colors),this._onChangeColors.fire(this.colors)}_updateRestoreColors(){this._restoreColors={foreground:this._colors.foreground,background:this._colors.background,cursor:this._colors.cursor,ansi:this._colors.ansi.slice()}}};vP=eO([Z(0,NO)],vP);function yP(e,t){if(e!==void 0)try{return zM.toColor(e)}catch{}return t}var bP=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)}},xP=class{constructor(){this._services=new bP,this._services.set(jO,this)}setService(e,t){this._services.set(e,t)}getService(e){return this._services.get(e)}createInstance(e,...t){let n=wO(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)}},SP={trace:0,debug:1,info:2,warn:3,error:4,off:5},CP=`xterm.js: `,wP=class extends Ek{constructor(e){super(),this._optionsService=e,this._logLevel=5,this._updateLogLevel(),this._register(this._optionsService.onSpecificOptionChange(`logLevel`,()=>this._updateLogLevel())),TP=this}get logLevel(){return this._logLevel}_updateLogLevel(){this._logLevel=SP[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?``:CP)+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)}};wP=eO([Z(0,NO)],wP);var TP,EP=class extends Ek{constructor(e){super(),this._maxLength=e,this.onDeleteEmitter=this._register(new Q),this.onDelete=this.onDeleteEmitter.event,this.onInsertEmitter=this._register(new Q),this.onInsert=this.onInsertEmitter.event,this.onTrimEmitter=this._register(new Q),this.onTrim=this.onTrimEmitter.event,this._array=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}},DP=3,OP=Object.freeze(new vO),kP=0,AP=2,jP=class e{constructor(e,t,n=!1){this.isWrapped=n,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(e*DP);let r=t||bO.fromCharData([0,gO,1,0]);for(let t=0;t<e;++t)this.setCell(t,r);this.length=e}get(e){let t=this._data[e*DP+0],n=t&2097151;return[this._data[e*DP+1],t&2097152?this._combined[e]:n?fO(n):``,t>>22,t&2097152?this._combined[e].charCodeAt(this._combined[e].length-1):n]}set(e,t){this._data[e*DP+1]=t[0],t[1].length>1?(this._combined[e]=t[1],this._data[e*DP+0]=e|2097152|t[2]<<22):this._data[e*DP+0]=t[1].charCodeAt(0)|t[2]<<22}getWidth(e){return this._data[e*DP+0]>>22}hasWidth(e){return this._data[e*DP+0]&12582912}getFg(e){return this._data[e*DP+1]}getBg(e){return this._data[e*DP+2]}hasContent(e){return this._data[e*DP+0]&4194303}getCodePoint(e){let t=this._data[e*DP+0];return t&2097152?this._combined[e].charCodeAt(this._combined[e].length-1):t&2097151}isCombined(e){return this._data[e*DP+0]&2097152}getString(e){let t=this._data[e*DP+0];return t&2097152?this._combined[e]:t&2097151?fO(t&2097151):``}isProtected(e){return this._data[e*DP+2]&536870912}loadCell(e,t){return kP=e*DP,t.content=this._data[kP+0],t.fg=this._data[kP+1],t.bg=this._data[kP+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*DP+0]=t.content,this._data[e*DP+1]=t.fg,this._data[e*DP+2]=t.bg}setCellFromCodepoint(e,t,n,r){r.bg&268435456&&(this._extendedAttrs[e]=r.extended),this._data[e*DP+0]=t|n<<22,this._data[e*DP+1]=r.fg,this._data[e*DP+2]=r.bg}addCodepointToCell(e,t,n){let r=this._data[e*DP+0];r&2097152?this._combined[e]+=fO(t):r&2097151?(this._combined[e]=fO(r&2097151)+fO(t),r&=-2097152,r|=2097152):r=t|1<<22,n&&(r&=-12582913,r|=n<<22),this._data[e*DP+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 bO;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 bO;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++;return}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*AP<this._data.buffer.byteLength;let n=e*DP;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*AP<this._data.buffer.byteLength}cleanupMemory(){if(this._data.length*4*AP<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);return}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*DP+0]&4194303)return e+(this._data[e*DP+0]>>22);return 0}getNoBgTrimmedLength(){for(let e=this.length-1;e>=0;--e)if(this._data[e*DP+0]&4194303||this._data[e*DP+2]&50331648)return e+(this._data[e*DP+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<DP;e++)this._data[(n+i)*DP+e]=a[(t+i)*DP+e];a[(t+i)*DP+2]&268435456&&(this._extendedAttrs[n+i]=e._extendedAttrs[t+i])}else for(let i=0;i<r;i++){for(let e=0;e<DP;e++)this._data[(n+i)*DP+e]=a[(t+i)*DP+e];a[(t+i)*DP+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*DP+0],n=e&2097151,a=e&2097152?this._combined[t]:n?fO(n):_O;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 MP(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=IP(u,d,t),p=1,m=0;for(;p<u.length;){let e=IP(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 NP(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 PP(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 FP(e,t,n){let r=[],i=e.map((n,r)=>IP(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=IP(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 IP(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 LP=class e{constructor(t){this.line=t,this.isDisposed=!1,this._disposables=[],this._id=e._nextId++,this._onDispose=this.register(new Q),this.onDispose=this._onDispose.event}get id(){return this._id}dispose(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire(),xk(this._disposables),this._disposables.length=0)}register(e){return this._disposables.push(e),e}};LP._nextId=1;var RP=LP,zP={},BP=zP.B;zP[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:`≥`,"{":`π`,"|":`≠`,"}":`£`,"~":`·`},zP.A={"#":`£`},zP.B=void 0,zP[4]={"#":`£`,"@":`¾`,"[":`ij`,"\\":`½`,"]":`|`,"{":`¨`,"|":`f`,"}":`¼`,"~":`´`},zP.C=zP[5]={"[":`Ä`,"\\":`Ö`,"]":`Å`,"^":`Ü`,"`":`é`,"{":`ä`,"|":`ö`,"}":`å`,"~":`ü`},zP.R={"#":`£`,"@":`à`,"[":`°`,"\\":`ç`,"]":`§`,"{":`é`,"|":`ù`,"}":`è`,"~":`¨`},zP.Q={"@":`à`,"[":`â`,"\\":`ç`,"]":`ê`,"^":`î`,"`":`ô`,"{":`é`,"|":`ù`,"}":`è`,"~":`û`},zP.K={"@":`§`,"[":`Ä`,"\\":`Ö`,"]":`Ü`,"{":`ä`,"|":`ö`,"}":`ü`,"~":`ß`},zP.Y={"#":`£`,"@":`§`,"[":`°`,"\\":`ç`,"]":`é`,"`":`ù`,"{":`à`,"|":`ò`,"}":`è`,"~":`ì`},zP.E=zP[6]={"@":`Ä`,"[":`Æ`,"\\":`Ø`,"]":`Å`,"^":`Ü`,"`":`ä`,"{":`æ`,"|":`ø`,"}":`å`,"~":`ü`},zP.Z={"#":`£`,"@":`§`,"[":`¡`,"\\":`Ñ`,"]":`¿`,"{":`°`,"|":`ñ`,"}":`ç`},zP.H=zP[7]={"@":`É`,"[":`Ä`,"\\":`Ö`,"]":`Å`,"^":`Ü`,"`":`é`,"{":`ä`,"|":`ö`,"}":`å`,"~":`ü`},zP[`=`]={"#":`ù`,"@":`à`,"[":`é`,"\\":`ç`,"]":`ê`,"^":`î`,_:`è`,"`":`ô`,"{":`ä`,"|":`ö`,"}":`ü`,"~":`û`};var VP=4294967295,HP=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=OP.clone(),this.savedCharset=BP,this.markers=[],this._nullCell=bO.fromCharData([0,gO,1,0]),this._whitespaceCell=bO.fromCharData([0,_O,1,32]),this._isClearing=!1,this._memoryCleanupQueue=new RN,this._memoryCleanupPosition=0,this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new EP(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 yO),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 yO),this._whitespaceCell}getBlankLine(e,t){return new jP(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>VP?VP:t}fillViewportRows(e){if(this.lines.length===0){e===void 0&&(e=OP);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 EP(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(e,t){let n=this.getNullCell(OP),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 jP(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 jP(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=MP(this.lines,this._cols,e,this.ybase+this.y,this.getNullCell(OP),n);if(r.length>0){let n=NP(this.lines,r);PP(this.lines,n.layout),this._reflowLargerAdjustViewport(e,t,n.countRemoved)}}_reflowLargerAdjustViewport(e,t,n){let r=this.getNullCell(OP),i=n;for(;i-- >0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length<t&&this.lines.push(new jP(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(OP),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=FP(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(OP,!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--,_=IP(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 RP(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)}},UP=class extends Ek{constructor(e,t){super(),this._optionsService=e,this._bufferService=t,this._onBufferActivate=this._register(new Q),this.onBufferActivate=this._onBufferActivate.event,this.reset(),this._register(this._optionsService.onSpecificOptionChange(`scrollback`,()=>this.resize(this._bufferService.cols,this._bufferService.rows))),this._register(this._optionsService.onSpecificOptionChange(`tabStopWidth`,()=>this.setupTabStops()))}reset(){this._normal=new HP(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new HP(!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)}},WP=2,GP=1,KP=class extends Ek{constructor(e){super(),this.isUserScrolling=!1,this._onResize=this._register(new Q),this.onResize=this._onResize.event,this._onScroll=this._register(new Q),this.onScroll=this._onScroll.event,this.cols=Math.max(e.rawOptions.cols||0,WP),this.rows=Math.max(e.rawOptions.rows||0,GP),this.buffers=this._register(new UP(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))}};KP=eO([Z(0,NO)],KP);var qP={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:kN,windowOptions:{},windowsMode:!1,windowsPty:{},wordSeparator:` ()[]{}',"\``,altClickMovesCursor:!0,convertEol:!1,termName:`xterm`,cancelEvents:!1,overviewRuler:{}},JP=[`normal`,`bold`,`100`,`200`,`300`,`400`,`500`,`600`,`700`,`800`,`900`],YP=class extends Ek{constructor(e){super(),this._onOptionChange=this._register(new Q),this.onOptionChange=this._onOptionChange.event;let t={...qP};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(Ck(()=>{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 qP))throw Error(`No option with key "${e}"`);return this.rawOptions[e]},t=(e,t)=>{if(!(e in qP))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||=qP[e],!XP(t))throw Error(`"${t}" is not a valid value for ${e}`);break;case`wordSeparator`:t||=qP[e];break;case`fontWeight`:case`fontWeightBold`:if(typeof t==`number`&&1<=t&&t<=1e3)break;t=JP.includes(t)?t:qP[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??={};break}return t}};function XP(e){return e===`block`||e===`underline`||e===`bar`}function ZP(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]&&ZP(e[r],t-1);return n}var QP=Object.freeze({insertMode:!1}),$P=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,cursorBlink:void 0,cursorStyle:void 0,origin:!1,reverseWraparound:!1,sendFocus:!1,synchronizedOutput:!1,wraparound:!0}),eF=class extends Ek{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 Q),this.onData=this._onData.event,this._onUserInput=this._register(new Q),this.onUserInput=this._onUserInput.event,this._onBinary=this._register(new Q),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this._register(new Q),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=ZP(QP),this.decPrivateModes=ZP($P)}reset(){this.modes=ZP(QP),this.decPrivateModes=ZP($P)}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))}};eF=eO([Z(0,DO),Z(1,MO),Z(2,NO)],eF);var tF={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 nF(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 rF=String.fromCharCode,iF={DEFAULT:e=>{let t=[nF(e,!1)+32,e.col+32,e.row+32];return t[0]>255||t[1]>255||t[2]>255?``:`\x1B[M${rF(t[0])}${rF(t[1])}${rF(t[2])}`},SGR:e=>{let t=e.action===0&&e.button!==4?`m`:`M`;return`\x1B[<${nF(e,!0)};${e.col};${e.row}${t}`},SGR_PIXELS:e=>{let t=e.action===0&&e.button!==4?`m`:`M`;return`\x1B[<${nF(e,!0)};${e.x};${e.y}${t}`}},aF=class extends Ek{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 Q),this.onProtocolChange=this._onProtocolChange.event;for(let e of Object.keys(tF))this.addProtocol(e,tF[e]);for(let e of Object.keys(iF))this.addEncoding(e,iF[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)}};aF=eO([Z(0,DO),Z(1,kO),Z(2,NO)],aF);var oF=[[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]],sF=[[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]],cF;function lF(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 uF=class{constructor(){if(this.version=`6`,!cF){cF=new Uint8Array(65536),cF.fill(1),cF[0]=0,cF.fill(0,1,32),cF.fill(0,127,160),cF.fill(2,4352,4448),cF[9001]=2,cF[9002]=2,cF.fill(2,11904,42192),cF[12351]=1,cF.fill(2,44032,55204),cF.fill(2,63744,64256),cF.fill(2,65040,65050),cF.fill(2,65072,65136),cF.fill(2,65280,65377),cF.fill(2,65504,65511);for(let e=0;e<oF.length;++e)cF.fill(0,oF[e][0],oF[e][1]+1)}}wcwidth(e){return e<32?0:e<127?1:e<65536?cF[e]:lF(e,sF)?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=dF.extractWidth(t);e===0?r=!1:e>n&&(n=e)}return dF.createPropertyValue(0,n,r)}},dF=class e{constructor(){this._providers=Object.create(null),this._active=``,this._onChange=new Q,this.onChange=this._onChange.event;let e=new uF;this.register(e),this._active=e.version,this._activeProvider=e}static extractShouldJoin(e){return(e&1)!=0}static extractWidth(e){return e>>1&3}static extractCharKind(e){return e>>3}static createPropertyValue(e,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)}},fF=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 pF(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 mF=2147483647,hF=256,gF=class e{constructor(e=32,t=32){if(this.maxLength=e,this.maxSubParamsLength=t,t>hF)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;return}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>mF?mF: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>mF?mF: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,mF):e}},_F=[],vF=class{constructor(){this._state=0,this._active=_F,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=_F}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=_F,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||_F,!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`,pO(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=_F,this._id=-1,this._state=0}}},yF=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+=pO(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}},bF=[],xF=class{constructor(){this._handlers=Object.create(null),this._active=bF,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=bF}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=bF,this._ident=0}hook(e,t){if(this.reset(),this._ident=e,this._active=this._handlers[e]||bF,!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`,pO(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=bF,this._ident=0}},SF=new gF;SF.addParam(0);var CF=class{constructor(e){this._handler=e,this._data=``,this._params=SF,this._hitLimit=!1}hook(e){this._params=e.length>1||e.params[0]?e.clone():SF,this._data=``,this._hitLimit=!1}put(e,t,n){this._hitLimit||(this._data+=pO(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=SF,this._data=``,this._hitLimit=!1,e));return this._params=SF,this._data=``,this._hitLimit=!1,t}},wF=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}},TF=160,EF=function(){let e=new wF(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(TF,0,2,0),e.add(TF,8,5,8),e.add(TF,6,0,6),e.add(TF,11,0,11),e.add(TF,13,13,13),e}(),DF=class extends Ek{constructor(e=EF){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 gF,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(Ck(()=>{this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null)})),this._oscParser=this._register(new vF),this._dcsParser=this._register(new xF),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;break}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:TF)],i>>4){case 2:for(let i=n+1;;++i){if(i>=t||(r=e[i])<32||r>126&&r<TF){this._printHandler(e,n,i),n=i-1;break}if(++i>=t||(r=e[i])<32||r>126&&r<TF){this._printHandler(e,n,i),n=i-1;break}if(++i>=t||(r=e[i])<32||r>126&&r<TF){this._printHandler(e,n,i),n=i-1;break}if(++i>=t||(r=e[i])<32||r>126&&r<TF){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<TF){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<TF){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;break}this.currentState=i&15}}},OF=/^([\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})$/,kF=/^[\da-f]+$/;function AF(e){if(!e)return;let t=e.toLowerCase();if(t.indexOf(`rgb:`)===0){t=t.slice(4);let e=OF.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),kF.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 jF(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 MF(e,t=16){let[n,r,i]=e;return`rgb:${jF(n,t)}/${jF(r,t)}/${jF(i,t)}`}var NF={"(":0,")":1,"*":2,"+":3,"-":1,".":2},PF=131072,FF=10;function IF(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 LF=5e3,RF=0,zF=class extends Ek{constructor(e,t,n,r,i,a,o,s,c=new DF){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 mO,this._utf8Decoder=new hO,this._windowTitle=``,this._iconName=``,this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=OP.clone(),this._eraseAttrDataInternal=OP.clone(),this._onRequestBell=this._register(new Q),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this._register(new Q),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this._register(new Q),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this._register(new Q),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this._register(new Q),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this._register(new Q),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this._register(new Q),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this._register(new Q),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this._register(new Q),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this._register(new Q),this.onLineFeed=this._onLineFeed.event,this._onScroll=this._register(new Q),this.onScroll=this._onScroll.event,this._onTitleChange=this._register(new Q),this.onTitleChange=this._onTitleChange.event,this._onColor=this._register(new Q),this.onColor=this._onColor.event,this._parseStack={paused:!1,cursorStartX:0,cursorStartY:0,decodedLength:0,position:0},this._specialColors=[256,257,258],this._register(this._parser),this._dirtyRowTracker=new BF(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($.BEL,()=>this.bell()),this._parser.setExecuteHandler($.LF,()=>this.lineFeed()),this._parser.setExecuteHandler($.VT,()=>this.lineFeed()),this._parser.setExecuteHandler($.FF,()=>this.lineFeed()),this._parser.setExecuteHandler($.CR,()=>this.carriageReturn()),this._parser.setExecuteHandler($.BS,()=>this.backspace()),this._parser.setExecuteHandler($.HT,()=>this.tab()),this._parser.setExecuteHandler($.SO,()=>this.shiftOut()),this._parser.setExecuteHandler($.SI,()=>this.shiftIn()),this._parser.setExecuteHandler(kM.IND,()=>this.index()),this._parser.setExecuteHandler(kM.NEL,()=>this.nextLine()),this._parser.setExecuteHandler(kM.HTS,()=>this.tabSet()),this._parser.registerOscHandler(0,new yF(e=>(this.setTitle(e),this.setIconName(e),!0))),this._parser.registerOscHandler(1,new yF(e=>this.setIconName(e))),this._parser.registerOscHandler(2,new yF(e=>this.setTitle(e))),this._parser.registerOscHandler(4,new yF(e=>this.setOrReportIndexedColor(e))),this._parser.registerOscHandler(8,new yF(e=>this.setHyperlink(e))),this._parser.registerOscHandler(10,new yF(e=>this.setOrReportFgColor(e))),this._parser.registerOscHandler(11,new yF(e=>this.setOrReportBgColor(e))),this._parser.registerOscHandler(12,new yF(e=>this.setOrReportCursorColor(e))),this._parser.registerOscHandler(104,new yF(e=>this.restoreIndexedColor(e))),this._parser.registerOscHandler(110,new yF(e=>this.restoreFgColor(e))),this._parser.registerOscHandler(111,new yF(e=>this.restoreBgColor(e))),this._parser.registerOscHandler(112,new yF(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 zP)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 CF((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`),LF))]).catch(e=>{if(e!==`#SLOW_TIMEOUT`)throw e;console.warn(`async parser handler taking longer than ${LF} 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>PF&&(a=this._parseStack.position+PF)}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<PF&&(this._parseBuffer=new Uint32Array(Math.min(e.length,PF))),o||this._dirtyRowTracker.clearRange(),e.length>PF)for(let t=a;t<e.length;t+=PF){let a=t+PF<e.length?t+PF: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=dF.extractWidth(t);let n=dF.extractShouldJoin(t),m=n?dF.extractWidth(f):0;if(f=t,o&&this._onA11yChar.fire(fO(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 jP&&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);continue}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=>IF(e.params[0],this._optionsService.rawOptions.windowOptions)?t(e):!0):this._parser.registerCsiHandler(e,t)}registerDcsHandler(e,t){return this._parser.registerDcsHandler(e,new CF(t))}registerEscHandler(e,t){return this._parser.registerEscHandler(e,t)}registerOscHandler(e,t){return this._parser.registerOscHandler(e,new yF(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));break}return!0}eraseInLine(e,t=!1){switch(this._restrictCursor(this._bufferService.cols),e.params[0]){case 0:this._eraseInBufferLine(this._activeBuffer.y,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,t);break;case 1:this._eraseInBufferLine(this._activeBuffer.y,0,this._activeBuffer.x+1,!1,t);break;case 2:this._eraseInBufferLine(this._activeBuffer.y,0,this._bufferService.cols,!0,t);break}return this._dirtyRowTracker.markDirty(this._activeBuffer.y),!0}insertLines(e){this._restrictCursor();let t=e.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let 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(OP));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=dF.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($.ESC+`[?1;2c`):this._is(`linux`)&&this._coreService.triggerDataEvent($.ESC+`[?6c`)),!0}sendDeviceAttributesSecondary(e){return e.params[0]>0||(this._is(`xterm`)?this._coreService.triggerDataEvent($.ESC+`[>0;276;0c`):this._is(`rxvt-unicode`)?this._coreService.triggerDataEvent($.ESC+`[>85;95;0c`):this._is(`linux`)?this._coreService.triggerDataEvent(e.params[0]+`c`):this._is(`screen`)&&this._coreService.triggerDataEvent($.ESC+`[>83;40003;0c`)),!0}_is(e){return(this._optionsService.rawOptions.termName+``).indexOf(e)===0}setMode(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 4:this._coreService.modes.insertMode=!0;break;case 20:this._optionsService.options.convertEol=!0;break}return!0}setModePrivate(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!0;break;case 2:this._charsetService.setgCharset(0,BP),this._charsetService.setgCharset(1,BP),this._charsetService.setgCharset(2,BP),this._charsetService.setgCharset(3,BP);break;case 3:this._optionsService.rawOptions.windowOptions.setWinLines&&(this._bufferService.resize(132,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!0,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!0;break;case 12:this._optionsService.options.cursorBlink=!0;break;case 45:this._coreService.decPrivateModes.reverseWraparound=!0;break;case 66:this._logService.debug(`Serial port requested application keypad.`),this._coreService.decPrivateModes.applicationKeypad=!0,this._onRequestSyncScrollBar.fire();break;case 9:this._coreMouseService.activeProtocol=`X10`;break;case 1e3:this._coreMouseService.activeProtocol=`VT200`;break;case 1002:this._coreMouseService.activeProtocol=`DRAG`;break;case 1003:this._coreMouseService.activeProtocol=`ANY`;break;case 1004:this._coreService.decPrivateModes.sendFocus=!0,this._onRequestSendFocus.fire();break;case 1005:this._logService.debug(`DECSET 1005 not supported (see #2507)`);break;case 1006:this._coreMouseService.activeEncoding=`SGR`;break;case 1015:this._logService.debug(`DECSET 1015 not supported (see #2507)`);break;case 1016:this._coreMouseService.activeEncoding=`SGR_PIXELS`;break;case 25:this._coreService.isCursorHidden=!1;break;case 1048:this.saveCursor();break;case 1049:this.saveCursor();case 47:case 1047:this._bufferService.buffers.activateAltBuffer(this._eraseAttrData()),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(void 0),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!0;break;case 2026:this._coreService.decPrivateModes.synchronizedOutput=!0;break}return!0}resetMode(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 4:this._coreService.modes.insertMode=!1;break;case 20:this._optionsService.options.convertEol=!1;break}return!0}resetModePrivate(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!1;break;case 3:this._optionsService.rawOptions.windowOptions.setWinLines&&(this._bufferService.resize(80,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!1,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!1;break;case 12:this._optionsService.options.cursorBlink=!1;break;case 45:this._coreService.decPrivateModes.reverseWraparound=!1;break;case 66:this._logService.debug(`Switching back to normal keypad.`),this._coreService.decPrivateModes.applicationKeypad=!1,this._onRequestSyncScrollBar.fire();break;case 9:case 1e3:case 1002:case 1003:this._coreMouseService.activeProtocol=`NONE`;break;case 1004:this._coreService.decPrivateModes.sendFocus=!1;break;case 1005:this._logService.debug(`DECRST 1005 not supported (see #2507)`);break;case 1006:this._coreMouseService.activeEncoding=`DEFAULT`;break;case 1015:this._logService.debug(`DECRST 1015 not supported (see #2507)`);break;case 1016:this._coreMouseService.activeEncoding=`DEFAULT`;break;case 25:this._coreService.isCursorHidden=!0;break;case 1048:this.restoreCursor();break;case 1049:case 47:case 1047:this._bufferService.buffers.activateNormalBuffer(),e.params[t]===1049&&this.restoreCursor(),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(void 0),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!1;break;case 2026:this._coreService.decPrivateModes.synchronizedOutput=!1,this._onRequestRefreshRows.fire(void 0);break}return!0}requestMode(e,t){let 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(`${$.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|=vO.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=OP.fg,e.bg=OP.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|=OP.fg&16777215):n===49?(r.bg&=-67108864,r.bg|=OP.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|=OP.fg&16777215,r.bg&=-67108864,r.bg|=OP.bg&16777215):this._logService.debug(`Unknown SGR attribute: %d.`,n);return!0}deviceStatus(e){switch(e.params[0]){case 5:this._coreService.triggerDataEvent(`${$.ESC}[0n`);break;case 6:let e=this._activeBuffer.y+1,t=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${$.ESC}[${e};${t}R`);break}return!0}deviceStatusPrivate(e){switch(e.params[0]){case 6:let e=this._activeBuffer.y+1,t=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${$.ESC}[?${e};${t}R`);break;case 15:break;case 25:break;case 26:break;case 53:break}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=OP.clone(),this._coreService.reset(),this._charsetService.reset(),this._activeBuffer.savedX=0,this._activeBuffer.savedY=this._activeBuffer.ybase,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,this._coreService.decPrivateModes.origin=!1,!0}setCursorStyle(e){let t=e.length===0?1:e.params[0];if(t===0)this._coreService.decPrivateModes.cursorStyle=void 0,this._coreService.decPrivateModes.cursorBlink=void 0;else{switch(t){case 1:case 2:this._coreService.decPrivateModes.cursorStyle=`block`;break;case 3:case 4:this._coreService.decPrivateModes.cursorStyle=`underline`;break;case 5:case 6:this._coreService.decPrivateModes.cursorStyle=`bar`;break}let 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(!IF(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(`${$.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);break;case 22:(t===0||t===2)&&(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>FF&&this._windowTitleStack.shift()),(t===0||t===1)&&(this._iconNameStack.push(this._iconName),this._iconNameStack.length>FF&&this._iconNameStack.shift());break;case 23:(t===0||t===2)&&this._windowTitleStack.length&&this.setTitle(this._windowTitleStack.pop()),(t===0||t===1)&&this._iconNameStack.length&&this.setIconName(this._iconNameStack.pop());break}return!0}saveCursor(e){return this._activeBuffer.savedX=this._activeBuffer.x,this._activeBuffer.savedY=this._activeBuffer.ybase+this._activeBuffer.y,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,!0}restoreCursor(e){return this._activeBuffer.x=this._activeBuffer.savedX||0,this._activeBuffer.y=Math.max(this._activeBuffer.savedY-this._activeBuffer.ybase,0),this._curAttrData.fg=this._activeBuffer.savedCurAttrData.fg,this._curAttrData.bg=this._activeBuffer.savedCurAttrData.bg,this._charsetService.charset=this._savedCharset,this._activeBuffer.savedCharset&&(this._charsetService.charset=this._activeBuffer.savedCharset),this._restrictCursor(),!0}setTitle(e){return this._windowTitle=e,this._onTitleChange.fire(e),!0}setIconName(e){return this._iconName=e,!0}setOrReportIndexedColor(e){let t=[],n=e.split(`;`);for(;n.length>1;){let e=n.shift(),r=n.shift();if(/^\d+$/.exec(e)){let n=parseInt(e);if(VF(n))if(r===`?`)t.push({type:0,index:n});else{let e=AF(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()?!1: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=AF(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]);VF(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,BP),!0}selectCharset(e){return e.length===2?(e[0]===`/`||this._charsetService.setgCharset(NF[e[0]],zP[e[1]]||BP),!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=OP.clone(),this._eraseAttrDataInternal=OP.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 bO;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(`${$.ESC}${e}${$.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)}},BF=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&&(RF=e,e=t,t=RF),e<this.start&&(this.start=e),t>this.end&&(this.end=t)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};BF=eO([Z(0,DO)],BF);function VF(e){return 0<=e&&e<256}var HF=5e7,UF=12,WF=50,GF=class extends Ek{constructor(e){super(),this._action=e,this._writeBuffer=[],this._callbacks=[],this._pendingData=0,this._bufferOffset=0,this._isSyncWriting=!1,this._syncCalls=0,this._didUserInput=!1,this._onWriteParsed=this._register(new Q),this.onWriteParsed=this._onWriteParsed.event}handleUserInput(){this._didUserInput=!0}writeSync(e,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>HF)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>=UF?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>=UF)break}this._writeBuffer.length>this._bufferOffset?(this._bufferOffset>WF&&(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()}},KF=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)))}};KF=eO([Z(0,DO)],KF);var qF=!1,JF=class extends Ek{constructor(e){super(),this._windowsWrappingHeuristics=this._register(new Dk),this._onBinary=this._register(new Q),this.onBinary=this._onBinary.event,this._onData=this._register(new Q),this.onData=this._onData.event,this._onLineFeed=this._register(new Q),this.onLineFeed=this._onLineFeed.event,this._onResize=this._register(new Q),this.onResize=this._onResize.event,this._onWriteParsed=this._register(new Q),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this._register(new Q),this._instantiationService=new xP,this.optionsService=this._register(new YP(e)),this._instantiationService.setService(NO,this.optionsService),this._bufferService=this._register(this._instantiationService.createInstance(KP)),this._instantiationService.setService(DO,this._bufferService),this._logService=this._register(this._instantiationService.createInstance(wP)),this._instantiationService.setService(MO,this._logService),this.coreService=this._register(this._instantiationService.createInstance(eF)),this._instantiationService.setService(kO,this.coreService),this.coreMouseService=this._register(this._instantiationService.createInstance(aF)),this._instantiationService.setService(OO,this.coreMouseService),this.unicodeService=this._register(this._instantiationService.createInstance(dF)),this._instantiationService.setService(FO,this.unicodeService),this._charsetService=this._instantiationService.createInstance(fF),this._instantiationService.setService(AO,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(KF),this._instantiationService.setService(PO,this._oscLinkService),this._inputHandler=this._register(new zF(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService)),this._register(Lk.forward(this._inputHandler.onLineFeed,this._onLineFeed)),this._register(this._inputHandler),this._register(Lk.forward(this._bufferService.onResize,this._onResize)),this._register(Lk.forward(this.coreService.onData,this._onData)),this._register(Lk.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 GF((e,t)=>this._inputHandler.parse(e,t))),this._register(Lk.forward(this._writeBuffer.onWriteParsed,this._onWriteParsed))}get onScroll(){return this._onScrollApi||(this._onScrollApi=this._register(new Q),this._onScroll.event(e=>{this._onScrollApi?.fire(e.position)})),this._onScrollApi.event}get cols(){return this._bufferService.cols}get rows(){return this._bufferService.rows}get buffers(){return this._bufferService.buffers}get options(){return this.optionsService.options}set options(e){for(let t in e)this.optionsService.options[t]=e[t]}write(e,t){this._writeBuffer.write(e,t)}writeSync(e,t){this._logService.logLevel<=3&&!qF&&(this._logService.warn(`writeSync is unreliable and will be removed soon.`),qF=!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,WP),t=Math.max(t,GP),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(pF.bind(null,this._bufferService))),e.push(this.registerCsiHandler({final:`H`},()=>(pF(this._bufferService),!1))),this._windowsWrappingHeuristics.value=Ck(()=>{for(let t of e)t.dispose()})}}},YF={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 XF(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`?t?i.key=$.ESC+`OA`:i.key=$.ESC+`[A`:e.key===`UIKeyInputLeftArrow`?t?i.key=$.ESC+`OD`:i.key=$.ESC+`[D`:e.key===`UIKeyInputRightArrow`?t?i.key=$.ESC+`OC`:i.key=$.ESC+`[C`:e.key===`UIKeyInputDownArrow`&&(t?i.key=$.ESC+`OB`:i.key=$.ESC+`[B`);break;case 8:i.key=e.ctrlKey?`\b`:$.DEL,e.altKey&&(i.key=$.ESC+i.key);break;case 9:if(e.shiftKey){i.key=$.ESC+`[Z`;break}i.key=$.HT,i.cancel=!0;break;case 13:i.key=e.altKey?$.ESC+$.CR:$.CR,i.cancel=!0;break;case 27:i.key=$.ESC,e.altKey&&(i.key=$.ESC+$.ESC),i.cancel=!0;break;case 37:if(e.metaKey)break;a?i.key=$.ESC+`[1;`+(a+1)+`D`:t?i.key=$.ESC+`OD`:i.key=$.ESC+`[D`;break;case 39:if(e.metaKey)break;a?i.key=$.ESC+`[1;`+(a+1)+`C`:t?i.key=$.ESC+`OC`:i.key=$.ESC+`[C`;break;case 38:if(e.metaKey)break;a?i.key=$.ESC+`[1;`+(a+1)+`A`:t?i.key=$.ESC+`OA`:i.key=$.ESC+`[A`;break;case 40:if(e.metaKey)break;a?i.key=$.ESC+`[1;`+(a+1)+`B`:t?i.key=$.ESC+`OB`:i.key=$.ESC+`[B`;break;case 45:!e.shiftKey&&!e.ctrlKey&&(i.key=$.ESC+`[2~`);break;case 46:a?i.key=$.ESC+`[3;`+(a+1)+`~`:i.key=$.ESC+`[3~`;break;case 36:a?i.key=$.ESC+`[1;`+(a+1)+`H`:t?i.key=$.ESC+`OH`:i.key=$.ESC+`[H`;break;case 35:a?i.key=$.ESC+`[1;`+(a+1)+`F`:t?i.key=$.ESC+`OF`:i.key=$.ESC+`[F`;break;case 33:e.shiftKey?i.type=2:e.ctrlKey?i.key=$.ESC+`[5;`+(a+1)+`~`:i.key=$.ESC+`[5~`;break;case 34:e.shiftKey?i.type=3:e.ctrlKey?i.key=$.ESC+`[6;`+(a+1)+`~`:i.key=$.ESC+`[6~`;break;case 112:a?i.key=$.ESC+`[1;`+(a+1)+`P`:i.key=$.ESC+`OP`;break;case 113:a?i.key=$.ESC+`[1;`+(a+1)+`Q`:i.key=$.ESC+`OQ`;break;case 114:a?i.key=$.ESC+`[1;`+(a+1)+`R`:i.key=$.ESC+`OR`;break;case 115:a?i.key=$.ESC+`[1;`+(a+1)+`S`:i.key=$.ESC+`OS`;break;case 116:a?i.key=$.ESC+`[15;`+(a+1)+`~`:i.key=$.ESC+`[15~`;break;case 117:a?i.key=$.ESC+`[17;`+(a+1)+`~`:i.key=$.ESC+`[17~`;break;case 118:a?i.key=$.ESC+`[18;`+(a+1)+`~`:i.key=$.ESC+`[18~`;break;case 119:a?i.key=$.ESC+`[19;`+(a+1)+`~`:i.key=$.ESC+`[19~`;break;case 120:a?i.key=$.ESC+`[20;`+(a+1)+`~`:i.key=$.ESC+`[20~`;break;case 121:a?i.key=$.ESC+`[21;`+(a+1)+`~`:i.key=$.ESC+`[21~`;break;case 122:a?i.key=$.ESC+`[23;`+(a+1)+`~`:i.key=$.ESC+`[23~`;break;case 123:a?i.key=$.ESC+`[24;`+(a+1)+`~`:i.key=$.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=$.NUL:e.keyCode>=51&&e.keyCode<=55?i.key=String.fromCharCode(e.keyCode-51+27):e.keyCode===56?i.key=$.DEL:e.keyCode===219?i.key=$.ESC:e.keyCode===220?i.key=$.FS:e.keyCode===221&&(i.key=$.GS);else if((!n||r)&&e.altKey&&!e.metaKey){let t=YF[e.keyCode]?.[+!!e.shiftKey];if(t)i.key=$.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=$.ESC+n}else if(e.keyCode===32)i.key=$.ESC+(e.ctrlKey?$.NUL:` `);else if(e.key===`Dead`&&e.code.startsWith(`Key`)){let t=e.code.slice(3,4);e.shiftKey||(t=t.toLowerCase()),i.key=$.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=$.US),e.key===`@`&&(i.key=$.NUL));break}return i}var ZF=0,QF=class{constructor(e){this._getKey=e,this._array=[],this._insertedValues=[],this._flushInsertedTask=new RN,this._isFlushingInserted=!1,this._deletedIndices=[],this._flushDeletedTask=new RN,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||(ZF=this._search(t),ZF===-1)||this._getKey(this._array[ZF])!==t)return!1;do if(this._array[ZF]===e)return this._deletedIndices.length===0&&this._flushDeletedTask.enqueue(()=>this._flushDeleted()),this._deletedIndices.push(ZF),!0;while(++ZF<this._array.length&&this._getKey(this._array[ZF])===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&&(ZF=this._search(e),!(ZF<0||ZF>=this._array.length)&&this._getKey(this._array[ZF])===e))do yield this._array[ZF];while(++ZF<this._array.length&&this._getKey(this._array[ZF])===e)}forEachByKey(e,t){if(this._flushCleanupInserted(),this._flushCleanupDeleted(),this._array.length!==0&&(ZF=this._search(e),!(ZF<0||ZF>=this._array.length)&&this._getKey(this._array[ZF])===e))do t(this._array[ZF]);while(++ZF<this._array.length&&this._getKey(this._array[ZF])===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}},$F=0,eI=0,tI=class extends Ek{constructor(){super(),this._decorations=new QF(e=>e?.marker.line),this._onDecorationRegistered=this._register(new Q),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this._register(new Q),this.onDecorationRemoved=this._onDecorationRemoved.event,this._register(Ck(()=>this.reset()))}get decorations(){return this._decorations.values()}registerDecoration(e){if(e.marker.isDisposed)return;let t=new nI(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=>{$F=t.options.x??0,eI=$F+(t.options.width??1),e>=$F&&e<eI&&(!n||(t.options.layer??`bottom`)===n)&&r(t)})}},nI=class extends Tk{constructor(e){super(),this.options=e,this.onRenderEmitter=this.add(new Q),this.onRender=this.onRenderEmitter.event,this._onDispose=this.add(new Q),this.onDispose=this._onDispose.event,this._cachedBg=null,this._cachedFg=null,this.marker=e.marker,this.options.overviewRulerOptions&&!this.options.overviewRulerOptions.position&&(this.options.overviewRulerOptions.position=`full`)}get backgroundColorRGB(){return this._cachedBg===null&&(this.options.backgroundColor?this._cachedBg=zM.toColor(this.options.backgroundColor):this._cachedBg=void 0),this._cachedBg}get foregroundColorRGB(){return this._cachedFg===null&&(this.options.foregroundColor?this._cachedFg=zM.toColor(this.options.foregroundColor):this._cachedFg=void 0),this._cachedFg}dispose(){this._onDispose.fire(),super.dispose()}},rI=1e3,iI=class{constructor(e,t=rI){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)}},aI=20,oI=!1,sI=class extends Ek{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 iI(this._renderRows.bind(this))),!this._terminal.element)throw Error(`Cannot enable accessibility before Terminal.open`);oI?(this._accessibilityContainer.classList.add(`debug`),this._rowContainer.classList.add(`debug`),this._debugRootContainer=i.createElement(`div`),this._debugRootContainer.classList.add(`xterm`),this._debugRootContainer.appendChild(i.createTextNode(`------start a11y------`)),this._debugRootContainer.appendChild(this._accessibilityContainer),this._debugRootContainer.appendChild(i.createTextNode(`------end a11y------`)),this._terminal.element.insertAdjacentElement(`afterend`,this._debugRootContainer)):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(`
|
|
84
84
|
`))),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(kj(i,`selectionchange`,()=>this._handleSelectionChange())),this._register(this._coreBrowserService.onDprChange(()=>this._refreshRowsDimensions())),this._refreshRowsDimensions(),this._refreshRows(),this._register(Ck(()=>{oI?this._debugRootContainer.remove():this._accessibilityContainer.remove(),this._rowElements.length=0}))}_handleTab(e){for(let t=0;t<e;t++)this._handleChar(` `)}_handleChar(e){this._liveRegionLineCount<aI+1&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==e&&(this._charsToAnnounce+=e):this._charsToAnnounce+=e,e===`
|
|
@@ -193,7 +193,7 @@ ${s.join(`
|
|
|
193
193
|
`)),e.length=0)},3e3),eU=new FinalizationRegistry(t=>{typeof t==`string`&&e.push(t)})}var tU=class{constructor(e){this._size=0,this._options=e,this._leakageMon=WH>0||this._options?.leakWarningThreshold?new KH(e?.onListenerError??aH,this._options?.leakWarningThreshold??WH):void 0,this._perfMon=this._options?._profName?new UH(this._options._profName):void 0,this._deliveryQueue=this._options?.deliveryQueue}dispose(){if(!this._disposed){if(this._disposed=!0,this._deliveryQueue?.current===this&&this._deliveryQueue.reset(),this._listeners){if(zH){let e=this._listeners;queueMicrotask(()=>{$H(e,e=>e.stack?.print())})}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 YH(`${e}. HINT: Stack shows most frequent listener (${t[1]}-times)`,t[0]);return(this._options?.onListenerError||aH)(n),NH.None}if(this._disposed)return NH.None;t&&(e=e.bind(t));let r=new ZH(e),i;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(r.stack=qH.create(),i=this._leakageMon.check(r.stack,this._size+1)),zH&&(r.stack=qH.create()),this._listeners?this._listeners instanceof ZH?(this._deliveryQueue??=new nU,this._listeners=[this._listeners,r]):this._listeners.push(r):(this._options?.onWillAddFirstListener?.(this),this._listeners=r,this._options?.onDidAddFirstListener?.(this)),this._size++;let a=AH(()=>{eU?.unregister(a),i?.(),this._removeListener(r)});if(n instanceof MH?n.add(a):Array.isArray(n)&&n.push(a),eU){let e=Error().stack.split(`
|
|
194
194
|
`).slice(2,3).join(`
|
|
195
195
|
`).trim(),t=/(file:|vscode-file:\/\/vscode-app)?(\/[^:]*:\d+:\d+)/.exec(e);eU.register(a,t?.[2]??e,a)}return 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*QH<=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||aH;if(!n){e.value(t);return}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 ZH)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}},nU=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}},rU=Object.freeze(function(e,t){let n=setTimeout(e.bind(t),0);return{dispose(){clearTimeout(n)}}}),iU;(e=>{function t(t){return t===e.None||t===e.Cancelled||t instanceof aU?!0:!t||typeof t!=`object`?!1:typeof t.isCancellationRequested==`boolean`&&typeof t.onCancellationRequested==`function`}e.isCancellationToken=t,e.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:VH.None}),e.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:rU})})(iU||={});var aU=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?rU:(this._emitter||=new tU,this._emitter.event)}dispose(){this._emitter&&=(this._emitter.dispose(),null)}},oU=`en`,sU=!1,cU=!1,lU=oU,uU,dU=globalThis,fU;typeof dU.vscode<`u`&&typeof dU.vscode.process<`u`?fU=dU.vscode.process:typeof process<`u`&&typeof process?.versions?.node==`string`&&(fU=process);var pU=typeof fU?.versions?.electron==`string`&&fU?.type===`renderer`;if(typeof fU==`object`){fU.platform,fU.platform,sU=fU.platform===`linux`,sU&&fU.env.SNAP&&fU.env.SNAP_REVISION,fU.env.CI||fU.env.BUILD_ARTIFACTSTAGINGDIRECTORY,lU=oU;let e=fU.env.VSCODE_NLS_CONFIG;if(e)try{let t=JSON.parse(e);t.userLocale,t.osLocale,lU=t.resolvedLanguage||oU,t.languagePack?.translationsConfigFile}catch{}}else typeof navigator==`object`&&!pU?(uU=navigator.userAgent,uU.indexOf(`Windows`),uU.indexOf(`Macintosh`),(uU.indexOf(`Macintosh`)>=0||uU.indexOf(`iPad`)>=0||uU.indexOf(`iPhone`)>=0)&&navigator.maxTouchPoints&&navigator.maxTouchPoints,sU=uU.indexOf(`Linux`)>=0,uU?.indexOf(`Mobi`),cU=!0,lU=globalThis._VSCODE_NLS_LANGUAGE||oU,navigator.language.toLowerCase()):console.error(`Unable to resolve platform.`);cU&&typeof dU.importScripts==`function`&&dU.origin;var mU=uU,hU=lU,gU;(e=>{function t(){return hU}e.value=t;function n(){return hU.length===2?hU===`en`:hU.length>=3?hU[0]===`e`&&hU[1]===`n`&&hU[2]===`-`:!1}e.isDefaultVariant=n;function r(){return hU===`en`}e.isDefault=r})(gU||={});var _U=typeof dU.postMessage==`function`&&!dU.importScripts;(()=>{if(_U){let e=[];dU.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}),dU.postMessage({vscodeScheduleAsyncWork:r},`*`)}}return e=>setTimeout(e)})();var vU=!!(mU&&mU.indexOf(`Chrome`)>=0);mU&&mU.indexOf(`Firefox`),!vU&&mU&&mU.indexOf(`Safari`),mU&&mU.indexOf(`Edg/`),mU&&mU.indexOf(`Android`);function yU(e,t=0,n){let r=setTimeout(()=>{e(),n&&i.dispose()},t),i=AH(()=>{clearTimeout(r),n?.deleteAndLeak(i)});return n?.add(i),i}(function(){typeof globalThis.requestIdleCallback!=`function`||globalThis.cancelIdleCallback})();var bU;(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})(bU||={});var xU=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 tU,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 VH.toPromise(this._onStateChanged.event)}while(!0)},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())}};xU.EMPTY=xU.fromArray([]);var SU=class extends NH{constructor(e){super(),this._terminal=e,this._linesCacheTimeout=this._register(new PH),this._linesCacheDisposables=this._register(new PH),this._register(AH(()=>this._destroyLinesCache()))}initLinesCache(){this._linesCache||(this._linesCache=Array(this._terminal.buffer.active.length),this._linesCacheDisposables.value=kH(this._terminal.onLineFeed(()=>this._destroyLinesCache()),this._terminal.onCursorMove(()=>this._destroyLinesCache()),this._terminal.onResize(()=>this._destroyLinesCache()))),this._linesCacheTimeout.value=yU(()=>this._destroyLinesCache(),15e3)}_destroyLinesCache(){this._linesCache=void 0,this._linesCacheDisposables.clear(),this._linesCacheTimeout.clear()}getLineFromCache(e){return this._linesCache?.[e]}setLineInCache(e,t){this._linesCache&&(this._linesCache[e]=t)}translateBufferLineToStringWithWrap(e,t){let n=[],r=[0],i=this._terminal.buffer.active.getLine(e);for(;i;){let a=this._terminal.buffer.active.getLine(e+1),o=a?a.isWrapped:!1,s=i.translateToString(!o&&t);if(o&&a){let e=i.getCell(i.length-1);e&&e.getCode()===0&&e.getWidth()===1&&a.getCell(0)?.getWidth()===2&&(s=s.slice(0,-1))}if(n.push(s),o)r.push(r[r.length-1]+s.length);else break;e++,i=a}return[n.join(``),r]}},CU=class{get cachedSearchTerm(){return this._cachedSearchTerm}set cachedSearchTerm(e){this._cachedSearchTerm=e}get lastSearchOptions(){return this._lastSearchOptions}set lastSearchOptions(e){this._lastSearchOptions=e}isValidSearchTerm(e){return!!(e&&e.length>0)}didOptionsChange(e){return this._lastSearchOptions?e?this._lastSearchOptions.caseSensitive!==e.caseSensitive||this._lastSearchOptions.regex!==e.regex||this._lastSearchOptions.wholeWord!==e.wholeWord:!1:!0}shouldUpdateHighlighting(e,t){return t?.decorations?this._cachedSearchTerm===void 0||e!==this._cachedSearchTerm||this.didOptionsChange(t):!1}clearCachedTerm(){this._cachedSearchTerm=void 0}reset(){this._cachedSearchTerm=void 0,this._lastSearchOptions=void 0}},wU=class{constructor(e,t){this._terminal=e,this._lineCache=t}find(e,t,n,r){if(!e||e.length===0){this._terminal.clearSelection();return}if(n>this._terminal.cols)throw Error(`Invalid col: ${n} to search in terminal of ${this._terminal.cols} cols`);this._lineCache.initLinesCache();let i={startRow:t,startCol:n},a=this._findInLine(e,i,r);if(!a)for(let n=t+1;n<this._terminal.buffer.active.baseY+this._terminal.rows&&(i.startRow=n,i.startCol=0,a=this._findInLine(e,i,r),!a);n++);return a}findNextWithSelection(e,t,n){if(!e||e.length===0){this._terminal.clearSelection();return}let r=this._terminal.getSelectionPosition();this._terminal.clearSelection();let i=0,a=0;r&&(n===e?(i=r.end.x,a=r.end.y):(i=r.start.x,a=r.start.y)),this._lineCache.initLinesCache();let o={startRow:a,startCol:i},s=this._findInLine(e,o,t);if(!s)for(let n=a+1;n<this._terminal.buffer.active.baseY+this._terminal.rows&&(o.startRow=n,o.startCol=0,s=this._findInLine(e,o,t),!s);n++);if(!s&&a!==0)for(let n=0;n<a&&(o.startRow=n,o.startCol=0,s=this._findInLine(e,o,t),!s);n++);return!s&&r&&(o.startRow=r.start.y,o.startCol=0,s=this._findInLine(e,o,t)),s}findPreviousWithSelection(e,t,n){if(!e||e.length===0){this._terminal.clearSelection();return}let r=this._terminal.getSelectionPosition();this._terminal.clearSelection();let i=this._terminal.buffer.active.baseY+this._terminal.rows-1,a=this._terminal.cols;this._lineCache.initLinesCache();let o={startRow:i,startCol:a},s;if(r&&(o.startRow=i=r.start.y,o.startCol=a=r.start.x,n!==e&&(s=this._findInLine(e,o,t,!1),s||(o.startRow=i=r.end.y,o.startCol=a=r.end.x))),s||=this._findInLine(e,o,t,!0),!s){o.startCol=Math.max(o.startCol,this._terminal.cols);for(let n=i-1;n>=0&&(o.startRow=n,s=this._findInLine(e,o,t,!0),!s);n--);}if(!s&&i!==this._terminal.buffer.active.baseY+this._terminal.rows-1)for(let n=this._terminal.buffer.active.baseY+this._terminal.rows-1;n>=i&&(o.startRow=n,s=this._findInLine(e,o,t,!0),!s);n--);return s}_isWholeWord(e,t,n){return(e===0||` ~!@#$%^&*()+\`-=[]{}|\\;:"',./<>?`.includes(t[e-1]))&&(e+n.length===t.length||` ~!@#$%^&*()+\`-=[]{}|\\;:"',./<>?`.includes(t[e+n.length]))}_findInLine(e,t,n={},r=!1){let i=t.startRow,a=t.startCol;if(this._terminal.buffer.active.getLine(i)?.isWrapped){if(r){t.startCol+=this._terminal.cols;return}return t.startRow--,t.startCol+=this._terminal.cols,this._findInLine(e,t,n)}let o=this._lineCache.getLineFromCache(i);o||(o=this._lineCache.translateBufferLineToStringWithWrap(i,!0),this._lineCache.setLineInCache(i,o));let[s,c]=o,l=this._bufferColsToStringOffset(i,a),u=e,d=s;n.regex||(u=n.caseSensitive?e:e.toLowerCase(),d=n.caseSensitive?s:s.toLowerCase());let f=-1;if(n.regex){let t=RegExp(u,n.caseSensitive?`g`:`gi`),i;if(r)for(;i=t.exec(d.slice(0,l));)f=t.lastIndex-i[0].length,e=i[0],t.lastIndex-=e.length-1;else i=t.exec(d.slice(l)),i&&i[0].length>0&&(f=l+(t.lastIndex-i[0].length),e=i[0])}else r?l-u.length>=0&&(f=d.lastIndexOf(u,l-u.length)):f=d.indexOf(u,l);if(f>=0){if(n.wholeWord&&!this._isWholeWord(f,d,e))return;let t=0;for(;t<c.length-1&&f>=c[t+1];)t++;let r=t;for(;r<c.length-1&&f+e.length>=c[r+1];)r++;let a=f-c[t],o=f+e.length-c[r],s=this._stringLengthToBufferSize(i+t,a),l=this._stringLengthToBufferSize(i+r,o)-s+this._terminal.cols*(r-t);return{term:e,col:s,row:i+t,size:l}}}_stringLengthToBufferSize(e,t){let n=this._terminal.buffer.active.getLine(e);if(!n)return 0;for(let e=0;e<t;e++){let r=n.getCell(e);if(!r)break;let i=r.getChars();i.length>1&&(t-=i.length-1);let a=n.getCell(e+1);a&&a.getWidth()===0&&t++}return t}_bufferColsToStringOffset(e,t){let n=e,r=0,i=this._terminal.buffer.active.getLine(n);for(;t>0&&i;){for(let e=0;e<t&&e<this._terminal.cols;e++){let t=i.getCell(e);if(!t)break;t.getWidth()&&(r+=t.getCode()===0?1:t.getChars().length)}if(n++,i=this._terminal.buffer.active.getLine(n),i&&!i.isWrapped)break;t-=this._terminal.cols}return r}},TU=class extends NH{constructor(e){super(),this._terminal=e,this._highlightDecorations=[],this._highlightedLines=new Set,this._register(AH(()=>this.clearHighlightDecorations()))}createHighlightDecorations(e,t){this.clearHighlightDecorations();for(let n of e){let e=this._createResultDecorations(n,t,!1);if(e)for(let t of e)this._storeDecoration(t,n)}}createActiveDecoration(e,t){let n=this._createResultDecorations(e,t,!0);if(n)return{decorations:n,match:e,dispose(){OH(n)}}}clearHighlightDecorations(){OH(this._highlightDecorations),this._highlightDecorations=[],this._highlightedLines.clear()}_storeDecoration(e,t){this._highlightedLines.add(e.marker.line),this._highlightDecorations.push({decoration:e,match:t,dispose(){e.dispose()}})}_applyStyles(e,t,n){e.classList.contains(`xterm-find-result-decoration`)||(e.classList.add(`xterm-find-result-decoration`),t&&(e.style.outline=`1px solid ${t}`)),n&&e.classList.add(`xterm-find-active-result-decoration`)}_createResultDecorations(e,t,n){let r=[],i=e.col,a=e.size,o=-this._terminal.buffer.active.baseY-this._terminal.buffer.active.cursorY+e.row;for(;a>0;){let e=Math.min(this._terminal.cols-i,a);r.push([o,i,e]),i=0,a-=e,o++}let s=[];for(let e of r){let r=this._terminal.registerMarker(e[0]),i=this._terminal.registerDecoration({marker:r,x:e[1],width:e[2],backgroundColor:n?t.activeMatchBackground:t.matchBackground,overviewRulerOptions:this._highlightedLines.has(r.line)?void 0:{color:n?t.activeMatchColorOverviewRuler:t.matchOverviewRuler,position:`center`}});if(i){let e=[];e.push(r),e.push(i.onRender(e=>this._applyStyles(e,n?t.activeMatchBorder:t.matchBorder,!1))),e.push(i.onDispose(()=>OH(e))),s.push(i)}}return s.length===0?void 0:s}},EU=class extends NH{constructor(){super(...arguments),this._searchResults=[],this._onDidChangeResults=this._register(new tU)}get onDidChangeResults(){return this._onDidChangeResults.event}get searchResults(){return this._searchResults}get selectedDecoration(){return this._selectedDecoration}set selectedDecoration(e){this._selectedDecoration=e}updateResults(e,t){this._searchResults=e.slice(0,t)}clearResults(){this._searchResults=[]}clearSelectedDecoration(){this._selectedDecoration&&=(this._selectedDecoration.dispose(),void 0)}findResultIndex(e){for(let t=0;t<this._searchResults.length;t++){let n=this._searchResults[t];if(n.row===e.row&&n.col===e.col&&n.size===e.size)return t}return-1}fireResultsChanged(e){if(!e)return;let t=-1;this._selectedDecoration&&(t=this.findResultIndex(this._selectedDecoration.match)),this._onDidChangeResults.fire({resultIndex:t,resultCount:this._searchResults.length})}reset(){this.clearSelectedDecoration(),this.clearResults()}},DU=class extends NH{constructor(e){super(),this._highlightTimeout=this._register(new PH),this._lineCache=this._register(new PH),this._state=new CU,this._resultTracker=this._register(new EU),this._highlightLimit=e?.highlightLimit??1e3}get onDidChangeResults(){return this._resultTracker.onDidChangeResults}activate(e){this._terminal=e,this._lineCache.value=new SU(e),this._engine=new wU(e,this._lineCache.value),this._decorationManager=new TU(e),this._register(this._terminal.onWriteParsed(()=>this._updateMatches())),this._register(this._terminal.onResize(()=>this._updateMatches())),this._register(AH(()=>this.clearDecorations()))}_updateMatches(){this._highlightTimeout.clear(),this._state.cachedSearchTerm&&this._state.lastSearchOptions?.decorations&&(this._highlightTimeout.value=yU(()=>{let e=this._state.cachedSearchTerm;this._state.clearCachedTerm(),this.findPrevious(e,{...this._state.lastSearchOptions,incremental:!0},{noScroll:!0})},200))}clearDecorations(e){this._resultTracker.clearSelectedDecoration(),this._decorationManager?.clearHighlightDecorations(),this._resultTracker.clearResults(),e||this._state.clearCachedTerm()}clearActiveDecoration(){this._resultTracker.clearSelectedDecoration()}findNext(e,t,n){if(!this._terminal||!this._engine)throw Error(`Cannot use addon until it has been loaded`);this._state.lastSearchOptions=t,this._state.shouldUpdateHighlighting(e,t)&&this._highlightAllMatches(e,t);let r=this._findNextAndSelect(e,t,n);return this._fireResults(t),this._state.cachedSearchTerm=e,r}_highlightAllMatches(e,t){if(!this._terminal||!this._engine||!this._decorationManager)throw Error(`Cannot use addon until it has been loaded`);if(!this._state.isValidSearchTerm(e)){this.clearDecorations();return}this.clearDecorations(!0);let n=[],r,i=this._engine.find(e,0,0,t);for(;i&&(r?.row!==i.row||r?.col!==i.col)&&!(n.length>=this._highlightLimit);)r=i,n.push(r),i=this._engine.find(e,r.col+r.term.length>=this._terminal.cols?r.row+1:r.row,r.col+r.term.length>=this._terminal.cols?0:r.col+1,t);this._resultTracker.updateResults(n,this._highlightLimit),t.decorations&&this._decorationManager.createHighlightDecorations(n,t.decorations)}_findNextAndSelect(e,t,n){if(!this._terminal||!this._engine)return!1;if(!this._state.isValidSearchTerm(e))return this._terminal.clearSelection(),this.clearDecorations(),!1;let r=this._engine.findNextWithSelection(e,t,this._state.cachedSearchTerm);return this._selectResult(r,t?.decorations,n?.noScroll)}findPrevious(e,t,n){if(!this._terminal||!this._engine)throw Error(`Cannot use addon until it has been loaded`);this._state.lastSearchOptions=t,this._state.shouldUpdateHighlighting(e,t)&&this._highlightAllMatches(e,t);let r=this._findPreviousAndSelect(e,t,n);return this._fireResults(t),this._state.cachedSearchTerm=e,r}_fireResults(e){this._resultTracker.fireResultsChanged(!!e?.decorations)}_findPreviousAndSelect(e,t,n){if(!this._terminal||!this._engine)return!1;if(!this._state.isValidSearchTerm(e))return this._terminal.clearSelection(),this.clearDecorations(),!1;let r=this._engine.findPreviousWithSelection(e,t,this._state.cachedSearchTerm);return this._selectResult(r,t?.decorations,n?.noScroll)}_selectResult(e,t,n){if(!this._terminal||!this._decorationManager)return!1;if(this._resultTracker.clearSelectedDecoration(),!e)return this._terminal.clearSelection(),!1;if(this._terminal.select(e.col,e.row,e.size),t){let n=this._decorationManager.createActiveDecoration(e,t);n&&(this._resultTracker.selectedDecoration=n)}if(!n&&(e.row>=this._terminal.buffer.active.viewportY+this._terminal.rows||e.row<this._terminal.buffer.active.viewportY)){let t=e.row-this._terminal.buffer.active.viewportY;t-=Math.floor(this._terminal.rows/2),this._terminal.scrollLines(t)}return!0}},OU=0,kU=0,AU=0,jU=0,MU;(e=>{function t(e,t,n,r){return r===void 0?`#${LU(e)}${LU(t)}${LU(n)}`:`#${LU(e)}${LU(t)}${LU(n)}${LU(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})(MU||={});var NU;(e=>{function t(e,t){if(jU=(t.rgba&255)/255,jU===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 OU=a+Math.round((n-a)*jU),kU=o+Math.round((r-o)*jU),AU=s+Math.round((i-s)*jU),{css:MU.toCss(OU,kU,AU),rgba:MU.toRgba(OU,kU,AU)}}e.blend=t;function n(e){return(e.rgba&255)==255}e.isOpaque=n;function r(e,t,n){let r=IU.ensureContrastRatio(e.rgba,t.rgba,n);if(r)return MU.toColor(r>>24&255,r>>16&255,r>>8&255)}e.ensureContrastRatio=r;function i(e){let t=(e.rgba|255)>>>0;return[OU,kU,AU]=IU.toChannels(t),{css:MU.toCss(OU,kU,AU),rgba:t}}e.opaque=i;function a(e,t){return jU=Math.round(t*255),[OU,kU,AU]=IU.toChannels(e.rgba),{css:MU.toCss(OU,kU,AU,jU),rgba:MU.toRgba(OU,kU,AU,jU)}}e.opacity=a;function o(e,t){return jU=e.rgba&255,a(e,jU*t/255)}e.multiplyOpacity=o;function s(e){return[e.rgba>>24&255,e.rgba>>16&255,e.rgba>>8&255]}e.toColorRGB=s})(NU||={});var PU;(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 OU=parseInt(e.slice(1,2).repeat(2),16),kU=parseInt(e.slice(2,3).repeat(2),16),AU=parseInt(e.slice(3,4).repeat(2),16),MU.toColor(OU,kU,AU);case 5:return OU=parseInt(e.slice(1,2).repeat(2),16),kU=parseInt(e.slice(2,3).repeat(2),16),AU=parseInt(e.slice(3,4).repeat(2),16),jU=parseInt(e.slice(4,5).repeat(2),16),MU.toColor(OU,kU,AU,jU);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 OU=parseInt(r[1]),kU=parseInt(r[2]),AU=parseInt(r[3]),jU=Math.round((r[5]===void 0?1:parseFloat(r[5]))*255),MU.toColor(OU,kU,AU,jU);if(!t||!n||(t.fillStyle=n,t.fillStyle=e,typeof t.fillStyle!=`string`)||(t.fillRect(0,0,1,1),[OU,kU,AU,jU]=t.getImageData(0,0,1,1).data,jU!==255))throw Error(`css.toColor: Unsupported css format`);return{rgba:MU.toRgba(OU,kU,AU,jU),css:e}}e.toColor=r})(PU||={});var FU;(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})(FU||={});var IU;(e=>{function t(e,t){if(jU=(t&255)/255,jU===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 OU=a+Math.round((n-a)*jU),kU=o+Math.round((r-o)*jU),AU=s+Math.round((i-s)*jU),MU.toRgba(OU,kU,AU)}e.blend=t;function n(e,t,n){let a=FU.relativeLuminance(e>>8),o=FU.relativeLuminance(t>>8);if(RU(a,o)<n){if(o<a){let o=r(e,t,n),s=RU(a,FU.relativeLuminance(o>>8));if(s<n){let r=i(e,t,n);return s>RU(a,FU.relativeLuminance(r>>8))?o:r}return o}let s=i(e,t,n),c=RU(a,FU.relativeLuminance(s>>8));if(c<n){let i=r(e,t,n);return c>RU(a,FU.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=RU(FU.relativeLuminance2(o,s,c),FU.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=RU(FU.relativeLuminance2(o,s,c),FU.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=RU(FU.relativeLuminance2(o,s,c),FU.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=RU(FU.relativeLuminance2(o,s,c),FU.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})(IU||={});function LU(e){let t=e.toString(16);return t.length<2?`0`+t:t}function RU(e,t){return e<t?(t+.05)/(e+.05):(e+.05)/(t+.05)}var zU=Object.freeze((()=>{let e=[PU.toColor(`#2e3436`),PU.toColor(`#cc0000`),PU.toColor(`#4e9a06`),PU.toColor(`#c4a000`),PU.toColor(`#3465a4`),PU.toColor(`#75507b`),PU.toColor(`#06989a`),PU.toColor(`#d3d7cf`),PU.toColor(`#555753`),PU.toColor(`#ef2929`),PU.toColor(`#8ae234`),PU.toColor(`#fce94f`),PU.toColor(`#729fcf`),PU.toColor(`#ad7fa8`),PU.toColor(`#34e2e2`),PU.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:MU.toCss(r,i,a),rgba:MU.toRgba(r,i,a)})}for(let t=0;t<24;t++){let n=8+t*10;e.push({css:MU.toCss(n,n,n),rgba:MU.toRgba(n,n,n)})}return e})());function BU(e,t,n){return Math.max(t,Math.min(e,n))}function VU(e){switch(e){case`&`:return`&`;case`<`:return`<`}return e}var HU=class{constructor(e){this._buffer=e}serialize(e,t){let n=this._buffer.getNullCell(),r=this._buffer.getNullCell(),i=n,a=e.start.y,o=e.end.y,s=e.start.x,c=e.end.x;this._beforeSerialize(o-a,a,o);for(let t=a;t<=o;t++){let a=this._buffer.getLine(t);if(a){let o=t===e.start.y?s:0,l=t===e.end.y?c:a.length;for(let e=o;e<l;e++){let o=a.getCell(e,i===n?r:n);if(!o){console.warn(`Can't get cell at row=${t}, col=${e}`);continue}this._nextCell(o,i,t,e),i=o}}this._rowEnd(t,t===o)}return this._afterSerialize(),this._serializeString(t)}_nextCell(e,t,n,r){}_rowEnd(e,t){}_beforeSerialize(e,t,n){}_afterSerialize(){}_serializeString(e){return``}};function UU(e,t){return e.getFgColorMode()===t.getFgColorMode()&&e.getFgColor()===t.getFgColor()}function WU(e,t){return e.getBgColorMode()===t.getBgColorMode()&&e.getBgColor()===t.getBgColor()}function GU(e,t){return e.isInverse()===t.isInverse()&&e.isBold()===t.isBold()&&e.isUnderline()===t.isUnderline()&&e.isOverline()===t.isOverline()&&e.isBlink()===t.isBlink()&&e.isInvisible()===t.isInvisible()&&e.isItalic()===t.isItalic()&&e.isDim()===t.isDim()&&e.isStrikethrough()===t.isStrikethrough()}var KU=class extends HU{constructor(e,t){super(e),this._terminal=t,this._rowIndex=0,this._allRows=[],this._allRowSeparators=[],this._currentRow=``,this._nullCellCount=0,this._cursorStyle=this._buffer.getNullCell(),this._cursorStyleRow=0,this._cursorStyleCol=0,this._backgroundCell=this._buffer.getNullCell(),this._firstRow=0,this._lastCursorRow=0,this._lastCursorCol=0,this._lastContentCursorRow=0,this._lastContentCursorCol=0,this._thisRowLastChar=this._buffer.getNullCell(),this._thisRowLastSecondChar=this._buffer.getNullCell(),this._nextRowFirstChar=this._buffer.getNullCell()}_beforeSerialize(e,t,n){this._allRows=Array(e),this._lastContentCursorRow=t,this._lastCursorRow=t,this._firstRow=t}_rowEnd(e,t){this._nullCellCount>0&&!WU(this._cursorStyle,this._backgroundCell)&&(this._currentRow+=`\x1B[${this._nullCellCount}X`);let n=``;if(!t){e-this._firstRow>=this._terminal.rows&&this._buffer.getLine(this._cursorStyleRow)?.getCell(this._cursorStyleCol,this._backgroundCell);let t=this._buffer.getLine(e),r=this._buffer.getLine(e+1);if(!r.isWrapped)n=`\r
|
|
196
|
-
`,this._lastCursorRow=e+1,this._lastCursorCol=0;else{n=``;let i=t.getCell(t.length-1,this._thisRowLastChar),a=t.getCell(t.length-2,this._thisRowLastSecondChar),o=r.getCell(0,this._nextRowFirstChar),s=o.getWidth()>1,c=!1;(o.getChars()&&s?this._nullCellCount<=1:this._nullCellCount<=0)&&((i.getChars()||i.getWidth()===0)&&WU(i,o)&&(c=!0),s&&(a.getChars()||a.getWidth()===0)&&WU(i,o)&&WU(a,o)&&(c=!0)),c||(n=`-`.repeat(this._nullCellCount+1),n+=`\x1B[1D\x1B[1X`,this._nullCellCount>0&&(n+=`\x1B[A`,n+=`\x1B[${t.length-this._nullCellCount}C`,n+=`\x1B[${this._nullCellCount}X`,n+=`\x1B[${t.length-this._nullCellCount}D`,n+=`\x1B[B`),this._lastContentCursorRow=e+1,this._lastContentCursorCol=0,this._lastCursorRow=e+1,this._lastCursorCol=0)}}this._allRows[this._rowIndex]=this._currentRow,this._allRowSeparators[this._rowIndex++]=n,this._currentRow=``,this._nullCellCount=0}_diffStyle(e,t){let n=[],r=!UU(e,t),i=!WU(e,t),a=!GU(e,t);if(r||i||a)if(e.isAttributeDefault())t.isAttributeDefault()||n.push(0);else{if(r){let t=e.getFgColor();e.isFgRGB()?n.push(38,2,t>>>16&255,t>>>8&255,t&255):e.isFgPalette()?t>=16?n.push(38,5,t):n.push(t&8?90+(t&7):30+(t&7)):n.push(39)}if(i){let t=e.getBgColor();e.isBgRGB()?n.push(48,2,t>>>16&255,t>>>8&255,t&255):e.isBgPalette()?t>=16?n.push(48,5,t):n.push(t&8?100+(t&7):40+(t&7)):n.push(49)}a&&(e.isInverse()!==t.isInverse()&&n.push(e.isInverse()?7:27),e.isBold()!==t.isBold()&&n.push(e.isBold()?1:22),e.isUnderline()!==t.isUnderline()&&n.push(e.isUnderline()?4:24),e.isOverline()!==t.isOverline()&&n.push(e.isOverline()?53:55),e.isBlink()!==t.isBlink()&&n.push(e.isBlink()?5:25),e.isInvisible()!==t.isInvisible()&&n.push(e.isInvisible()?8:28),e.isItalic()!==t.isItalic()&&n.push(e.isItalic()?3:23),e.isDim()!==t.isDim()&&n.push(e.isDim()?2:22),e.isStrikethrough()!==t.isStrikethrough()&&n.push(e.isStrikethrough()?9:29))}return n}_nextCell(e,t,n,r){if(e.getWidth()===0)return;let i=e.getChars()===``,a=this._diffStyle(e,this._cursorStyle);if(i?!WU(this._cursorStyle,e):a.length>0){this._nullCellCount>0&&(WU(this._cursorStyle,this._backgroundCell)||(this._currentRow+=`\x1B[${this._nullCellCount}X`),this._currentRow+=`\x1B[${this._nullCellCount}C`,this._nullCellCount=0),this._lastContentCursorRow=this._lastCursorRow=n,this._lastContentCursorCol=this._lastCursorCol=r,this._currentRow+=`\x1B[${a.join(`;`)}m`;let e=this._buffer.getLine(n);e!==void 0&&(e.getCell(r,this._cursorStyle),this._cursorStyleRow=n,this._cursorStyleCol=r)}i?this._nullCellCount+=e.getWidth():(this._nullCellCount>0&&(WU(this._cursorStyle,this._backgroundCell)||(this._currentRow+=`\x1B[${this._nullCellCount}X`),this._currentRow+=`\x1B[${this._nullCellCount}C`,this._nullCellCount=0),this._currentRow+=e.getChars(),this._lastContentCursorRow=this._lastCursorRow=n,this._lastContentCursorCol=this._lastCursorCol=r+e.getWidth())}_serializeString(e){let t=this._allRows.length;this._buffer.length-this._firstRow<=this._terminal.rows&&(t=this._lastContentCursorRow+1-this._firstRow,this._lastCursorCol=this._lastContentCursorCol,this._lastCursorRow=this._lastContentCursorRow);let n=``;for(let e=0;e<t;e++)n+=this._allRows[e],e+1<t&&(n+=this._allRowSeparators[e]);if(!e){let e=this._buffer.baseY+this._buffer.cursorY,t=this._buffer.cursorX;(e!==this._lastCursorRow||t!==this._lastCursorCol)&&((e=>{e>0?n+=`\x1B[${e}B`:e<0&&(n+=`\x1B[${-e}A`)})(e-this._lastCursorRow),(e=>{e>0?n+=`\x1B[${e}C`:e<0&&(n+=`\x1B[${-e}D`)})(t-this._lastCursorCol))}let r=this._terminal._core._inputHandler._curAttrData,i=this._diffStyle(r,this._cursorStyle);return i.length>0&&(n+=`\x1B[${i.join(`;`)}m`),n}},qU=class{activate(e){this._terminal=e}_serializeBufferByScrollback(e,t,n){let r=t.length,i=n===void 0?r:BU(n+e.rows,0,r);return this._serializeBufferByRange(e,t,{start:r-i,end:r-1},!1)}_serializeBufferByRange(e,t,n,r){return new KU(t,e).serialize({start:{x:0,y:typeof n.start==`number`?n.start:n.start.line},end:{x:e.cols,y:typeof n.end==`number`?n.end:n.end.line}},r)}_serializeBufferAsHTML(e,t){let n=e.buffer.active,r=new JU(n,e,t),i=t.onlySelection??!1,a=t.range;if(a)return r.serialize({start:{x:a.startCol,y:(a.startLine,a.startLine)},end:{x:e.cols,y:(a.endLine,a.endLine)}});if(!i){let i=n.length,a=t.scrollback,o=a===void 0?i:BU(a+e.rows,0,i);return r.serialize({start:{x:0,y:i-o},end:{x:e.cols,y:i-1}})}let o=this._terminal?.getSelectionPosition();return o===void 0?``:r.serialize({start:{x:o.start.x,y:o.start.y},end:{x:o.end.x,y:o.end.y}})}_serializeModes(e){let t=``,n=e.modes;if(n.applicationCursorKeysMode&&(t+=`\x1B[?1h`),n.applicationKeypadMode&&(t+=`\x1B[?66h`),n.bracketedPasteMode&&(t+=`\x1B[?2004h`),n.insertMode&&(t+=`\x1B[4h`),n.originMode&&(t+=`\x1B[?6h`),n.reverseWraparoundMode&&(t+=`\x1B[?45h`),n.sendFocusMode&&(t+=`\x1B[?1004h`),n.wraparoundMode===!1&&(t+=`\x1B[?7l`),n.mouseTrackingMode!==`none`)switch(n.mouseTrackingMode){case`x10`:t+=`\x1B[?9h`;break;case`vt200`:t+=`\x1B[?1000h`;break;case`drag`:t+=`\x1B[?1002h`;break;case`any`:t+=`\x1B[?1003h`;break}return t}serialize(e){if(!this._terminal)throw Error(`Cannot use addon until it has been loaded`);let t=e?.range?this._serializeBufferByRange(this._terminal,this._terminal.buffer.normal,e.range,!0):this._serializeBufferByScrollback(this._terminal,this._terminal.buffer.normal,e?.scrollback);if(!e?.excludeAltBuffer&&this._terminal.buffer.active.type===`alternate`){let e=this._serializeBufferByScrollback(this._terminal,this._terminal.buffer.alternate,void 0);t+=`\x1B[?1049h\x1B[H${e}`}return e?.excludeModes||(t+=this._serializeModes(this._terminal)),t}serializeAsHTML(e){if(!this._terminal)throw Error(`Cannot use addon until it has been loaded`);return this._serializeBufferAsHTML(this._terminal,e||{})}dispose(){}},JU=class extends HU{constructor(e,t,n){super(e),this._terminal=t,this._options=n,this._currentRow=``,this._htmlContent=``,t._core._themeService?this._ansiColors=t._core._themeService.colors.ansi:this._ansiColors=zU}_padStart(e,t,n){return t>>=0,n??=` `,e.length>t?e:(t-=e.length,t>n.length&&(n+=n.repeat(t/n.length)),n.slice(0,t)+e)}_beforeSerialize(e,t,n){this._htmlContent+=`<html><body><!--StartFragment--><pre>`;let r=`#000000`,i=`#ffffff`;(this._options.includeGlobalBackground??!1)&&(r=this._terminal.options.theme?.foreground??`#ffffff`,i=this._terminal.options.theme?.background??`#000000`);let a=[];a.push(`color: `+r+`;`),a.push(`background-color: `+i+`;`),a.push(`font-family: `+this._terminal.options.fontFamily+`;`),a.push(`font-size: `+this._terminal.options.fontSize+`px;`),this._htmlContent+=`<div style='`+a.join(` `)+`'>`}_afterSerialize(){this._htmlContent+=`</div>`,this._htmlContent+=`</pre><!--EndFragment--></body></html>`}_rowEnd(e,t){this._htmlContent+=`<div><span>`+this._currentRow+`</span></div>`,this._currentRow=``}_getHexColor(e,t){let n=t?e.getFgColor():e.getBgColor();if(t?e.isFgRGB():e.isBgRGB())return`#`+[n>>16&255,n>>8&255,n&255].map(e=>this._padStart(e.toString(16),2,`0`)).join(``);if(t?e.isFgPalette():e.isBgPalette())return this._ansiColors[n].css}_diffStyle(e,t){let n=[],r=!UU(e,t),i=!WU(e,t),a=!GU(e,t);if(r||i||a){let t=this._getHexColor(e,!0);t&&n.push(`color: `+t+`;`);let r=this._getHexColor(e,!1);return r&&n.push(`background-color: `+r+`;`),e.isInverse()&&n.push(`color: #000000; background-color: #BFBFBF;`),e.isBold()&&n.push(`font-weight: bold;`),e.isUnderline()&&e.isOverline()?n.push(`text-decoration: overline underline;`):e.isUnderline()?n.push(`text-decoration: underline;`):e.isOverline()&&n.push(`text-decoration: overline;`),e.isBlink()&&n.push(`text-decoration: blink;`),e.isInvisible()&&n.push(`visibility: hidden;`),e.isItalic()&&n.push(`font-style: italic;`),e.isDim()&&n.push(`opacity: 0.5;`),e.isStrikethrough()&&n.push(`text-decoration: line-through;`),n}}_nextCell(e,t,n,r){if(e.getWidth()===0)return;let i=e.getChars()===``,a=this._diffStyle(e,t);a&&(this._currentRow+=a.length===0?`</span><span>`:`</span><span style='`+a.join(` `)+`'>`),i?this._currentRow+=` `:this._currentRow+=VU(e.getChars())}_serializeString(){return this._htmlContent}};function YU(e){let t=0;for(let n=0;n<e.length;++n){let r=e.charCodeAt(n);if(r<48||57<r)return-1;t=t*10+r-48}return t}var XU=class{constructor(){this._st=0,this._pr=0}dispose(){this._seqHandler?.dispose(),this._onChange?.dispose()}activate(e){this._seqHandler=e.parser.registerOscHandler(9,e=>{if(!e.startsWith(`4;`))return!1;let t=e.split(`;`);if(t.length>3)return!0;t.length===2&&t.push(``);let n=YU(t[1]),r=YU(t[2]);switch(n){case 0:this.progress={state:n,value:0};break;case 1:if(r<0)return!0;this.progress={state:n,value:r};break;case 2:case 4:if(r<0)return!0;this.progress={state:n,value:r||this._pr};break;case 3:this.progress={state:n,value:this._pr};break}return!0}),this._onChange=new e._core._onData.constructor,this.onChange=this._onChange.event}get progress(){return{state:this._st,value:this._pr}}set progress(e){if(e.state<0||e.state>4){console.warn(`progress state out of bounds, not applied`);return}this._st=e.state,this._pr=Math.min(Math.max(e.value,0),100),this._onChange?.fire({state:this._st,value:this._pr})}};function ZU(e){return`\x1b[200~${e}\x1b[201~`}function QU(e){return e.replace(/[\x00-\x1f\x7f]/g,``)}function $U(e,t){let n=QU(e);return t===`codex`?n:ZU(n)}var eW=40*1024*1024,tW=`40 MB`;function nW(e){if(!e)return[];let t=Array.from(e.files??[]).filter(e=>e instanceof File);return t.length?t:Array.from(e.items??[]).filter(e=>e.kind===`file`).map(e=>e.getAsFile?.()).filter(e=>e instanceof File)}function rW(e){let t=e.find(e=>e.type.startsWith(`image/`)&&e.size===0);if(t)return`${t.name} contains no image data. Choose the file to upload it.`;let n=e.find(e=>e.size>eW);return n?`${n.name} exceeds the ${tW} limit`:null}async function iW(e,t){let n=rW([e]);if(n)throw Error(n);let r=new FormData,i=/^image\/(png|jpeg|gif|webp)$/.test(e.type);r.append(i?`image`:`file`,e,e.name);let a;try{a=await fetch(i?`/api/paste-image`:`/api/paste-file`,{method:`POST`,body:r,signal:t})}catch(n){throw t?.aborted?n:Error(`Could not upload ${e.name}. Check your connection and try again.`)}let o=await a.json().catch(()=>null);if(!a.ok||typeof o?.path!=`string`||!o.path.startsWith(`/`))throw Error(typeof o?.error==`string`?o.error:`Could not upload ${e.name}. Try again.`);return o.path}function aW(e){return`'${e.replace(/[\x00-\x1f\x7f]/g,``).replace(/'/g,`'\\''`)}'`}async function oW(){try{let e=await navigator.clipboard.read(),t=[],n=``;for(let r of e){let e=r.types.find(e=>e.startsWith(`image/`));e?t.push(new File([await r.getType(e)],`clipboard.${e.split(`/`)[1]||`png`}`,{type:e})):r.types.includes(`text/plain`)&&(n+=await(await r.getType(`text/plain`)).text())}return{text:n,files:t}}catch{return{text:await navigator.clipboard.readText(),files:[]}}}var sW=new Map,cW=20;function lW(e){sW.delete(e)}function uW(){sW.clear()}var dW=/https?:\/\/[^\s"'<>]+|\b(?:localhost|\d{1,3}(?:\.\d{1,3}){3}):\d{1,5}(?:\/[^\s"'<>]*)?\b/,fW=/[.,;:!?]+$/,pW=[[`(`,`)`],[`[`,`]`],[`{`,`}`]],mW=(e,t)=>e.split(t).length-1;function hW(e){let t=e.trim();if(!t)return t;let n=()=>{t=t.replace(fW,``)};n();let r=!0;for(;r;){r=!1;for(let[e,n]of pW){if(!t.endsWith(n))continue;let i=mW(t,e);mW(t,n)>i&&(t=t.slice(0,-1),r=!0)}}return n(),t}var gW=()=>typeof navigator<`u`&&/Mac|iPhone|iPad|iPod/.test(navigator.platform),_W=`\x1B[200~\x1B[201~`,vW=``,yW=`\x1B[?1000h\x1B[?1002h\x1B[?1006h`,bW=`\x1B[?1000l\x1B[?1002l\x1B[?1003l\x1B[?1006l`;async function xW(e){try{let t=(e.type.split(`/`)[1]||`png`).toLowerCase(),n=new FormData;n.append(`image`,e,`paste.${t}`);let r=await fetch(`/api/paste-image`,{method:`POST`,body:n});if(!r.ok)return null;let i=await r.json();return typeof i.path==`string`?i.path:null}catch{return null}}async function SW(){try{let e=await fetch(`/api/clipboard-file-path`);if(!e.ok)return null;let t=await e.json();return t.isImage===!0&&typeof t.path==`string`?t.path:null}catch{return null}}async function CW(e,t){if(e===`codex`)return vW;let n=t.path??null;return!n&&t.blob&&(n=await xW(t.blob)),n||=await SW(),n?ZU(QU(n)):_W}var wW=/\/Users\/[^/\n]+\/Library\/Group Containers\/group\.com\.apple\.coreservices\.useractivityd\/shared-pasteboard\/items\//;function TW(e){return wW.test(e)}function EW(e){if(!e)return!1;for(let t of Array.from(e.files??[]))if(t?.type?.startsWith(`image/`))return!0;for(let t of Array.from(e.items??[]))if(t?.type?.startsWith(`image/`))return!0;return!1}function DW(e){if(!e)return null;for(let t of Array.from(e.files??[]))if(t?.type?.startsWith(`image/`))return t;for(let t of Array.from(e.items??[]))if(t?.kind===`file`&&t.type?.startsWith(`image/`)){let e=t.getAsFile?.();if(e)return e}return null}var OW=class{constructor(e={}){this.callbacks=e}async readText(e){if(e!==`c`)return``;try{return await navigator.clipboard.readText()}catch{return``}}async writeText(e,t){if(e!==`c`||!t?.trim())return;let n=performance.now();try{if(!navigator.clipboard?.writeText)throw Error(`navigator.clipboard.writeText unavailable`);await navigator.clipboard.writeText(t),XD(`clipboard_write_success`,{source:`osc52`,chars:t.length,durationMs:Math.round(performance.now()-n)})}catch(e){XD(`clipboard_write_failed`,{source:`osc52`,chars:t.length,error:e instanceof Error?e.message:String(e)},`warn`),this.callbacks.onWriteFailed?.(t,`osc52`)}}},kW=`︎`,AW=[`⏺`],jW=new RegExp(AW.map(e=>e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)).join(`|`),`g`);function MW(e){for(let t of AW)if(e.indexOf(t)!==-1)return e.replace(jW,`$&${kW}`);return e}function NW({sessionId:e,tmuxTarget:t,agentType:n,allowAttach:r=!0,connectionStatus:i=`connected`,connectionEpoch:a=0,sendMessage:o,subscribe:s,theme:c,fontSize:l,lineHeight:u,letterSpacing:d,fontFamily:f,useWebGL:p,onScrollChange:m,onPasteFiles:h,onPasteError:g}){let _=(0,x.useRef)(h);_.current=h;let v=(0,x.useRef)(g);v.current=g;let y=()=>!_.current||typeof location<`u`&&[`localhost`,`127.0.0.1`,`[::1]`].includes(location.hostname),b=Ge(),S=(0,x.useRef)(null),C=(0,x.useRef)(null),w=(0,x.useRef)(!1),T=(0,x.useRef)(null),E=(0,x.useRef)(null),D=(0,x.useRef)(null),O=(0,x.useRef)(null),k=(0,x.useRef)(null),A=(0,x.useRef)(null),j=(0,x.useRef)(null),M=(0,x.useRef)(null),N=(0,x.useRef)(null),P=(0,x.useRef)(null),F=(0,x.useRef)(0),I=(0,x.useRef)(!1),[L,ee]=(0,x.useState)(!1),R=(0,x.useRef)(!1),z=(0,x.useRef)(!1),B=(0,x.useRef)(null),te=(0,x.useRef)(0),[V,ne]=(0,x.useState)(null),re=(0,x.useCallback)((e,t)=>{e?.trim()&&(te.current+=1,ne({id:te.current,text:e,source:t}))},[]),U=(0,x.useCallback)(()=>{V&&(Bm(V.text),XD(`clipboard_manual_copy`,{source:V.source,chars:V.text.length},`info`),ne(null))},[V]),ie=(0,x.useCallback)(()=>{ne(null)},[]),W=(0,x.useRef)(null),ae=(0,x.useRef)(null),oe=(0,x.useRef)(e&&r&&i===`connected`?e:null),se=(0,x.useRef)(null),ce=(0,x.useRef)(-1),le=(0,x.useRef)(null),ue=(0,x.useRef)(null),de=(0,x.useRef)(o),fe=(0,x.useRef)(n),pe=(0,x.useRef)(m),me=(0,x.useRef)(p),he=(0,x.useRef)([]),ge=(0,x.useRef)(null),_e=(0,x.useRef)(null),ve=(0,x.useRef)({count:0,bytes:0,lastEmit:0,timer:null,lastMessageSessionId:null}),ye=(0,x.useRef)(!1),[be,xe]=(0,x.useState)(!1),Se=(0,x.useRef)(null),Ce=(0,x.useRef)(null),we=(0,x.useRef)(null),Te=()=>{if(Se.current!==null&&(window.clearTimeout(Se.current),Se.current=null),Ce.current!==null&&(cancelAnimationFrame(Ce.current),Ce.current=null),we.current!==null){let e=S.current;e&&(e.style.display=we.current),we.current=null}},Ee=(e,t)=>{let n=S.current;n&&(Te(),XD(`ios_repaint_schedule`,{delayMs:e,trigger:t,sessionId:ae.current}),Se.current=window.setTimeout(()=>{Se.current=null;let e=C.current;e&&e.refresh(0,e.rows-1),XD(`ios_repaint_exec`,{trigger:t,hasContent:e?e.buffer.active.length>0:!1,bufferLines:e?.buffer.active.length??0,sessionId:ae.current}),we.current=n.style.display,n.style.display=`none`,Ce.current=requestAnimationFrame(()=>{Ce.current=requestAnimationFrame(()=>{Ce.current=null,n.style.display=we.current??``,we.current=null})})},e))};(0,x.useEffect)(()=>{de.current=o},[o]),(0,x.useEffect)(()=>{fe.current=n},[n]),(0,x.useEffect)(()=>{pe.current=m},[m]);let De=(0,x.useCallback)(()=>{let e=C.current;if(!e||!pe.current)return;let t=e.buffer.active,n=!I.current&&t.viewportY>=t.baseY;pe.current(n)},[]),Oe=(0,x.useCallback)(e=>{if(I.current===e)return;I.current=e,ee(e);let t=C.current;t&&e&&t.write(bW),De()},[De]),ke=(0,x.useCallback)(()=>{let e=oe.current;e&&(B.current!==null&&window.clearTimeout(B.current),B.current=window.setTimeout(()=>{B.current=null,de.current({type:`tmux-check-copy-mode`,sessionId:e})},150))},[]),Ae=(0,x.useCallback)(()=>{let e=C.current,t=T.current;if(!e||!t)return;t.fit();let n=ae.current;n&&de.current({type:`terminal-resize`,sessionId:n,cols:e.cols,rows:e.rows})},[]);return(0,x.useEffect)(()=>{let t=S.current;if(!t||C.current)return;let n=!1;t.innerHTML=``;let r=new bI({fontFamily:f,fontSize:l,lineHeight:((e,t)=>Math.round(e*t)/e)(l,u),letterSpacing:d,scrollback:0,cursorBlink:!1,cursorStyle:`underline`,convertEol:!1,theme:c,screenReaderMode:b,minimumContrastRatio:4.5}),i=new CI;r.loadAddon(i),r.loadAddon(new tH(void 0,new OW({onWriteFailed:re})));let a=new DU;r.loadAddon(a),k.current=a;let o=new qU;r.loadAddon(o),A.current=o;let s=new XU;r.loadAddon(s),j.current=s;let p=()=>{if(!n){if(me.current)try{let t=new dV;t.onContextLoss(()=>{XD(`webgl_context_loss`,{sessionId:e},`info`);try{t.dispose()}catch{}E.current=null}),r.loadAddon(t),E.current=t}catch{}r.open(t),i.fit(),w.current||(w.current=!0,XD(`terminal_init`,{isiOS:b,useWebGL:me.current,hasWebGL:!!E.current,userAgent:navigator.userAgent.slice(0,120),platform:navigator.platform,maxTouchPoints:navigator.maxTouchPoints},`info`)),m&&r.element&&r.element.appendChild(m)}};document.fonts?.ready?document.fonts.ready.then(p).catch(p):p();let m=null,h=null,g=null;typeof document<`u`&&document.createElement&&(m=document.createElement(`div`),m.className=`xterm-hover`,m.style.cssText=`
|
|
196
|
+
`,this._lastCursorRow=e+1,this._lastCursorCol=0;else{n=``;let i=t.getCell(t.length-1,this._thisRowLastChar),a=t.getCell(t.length-2,this._thisRowLastSecondChar),o=r.getCell(0,this._nextRowFirstChar),s=o.getWidth()>1,c=!1;(o.getChars()&&s?this._nullCellCount<=1:this._nullCellCount<=0)&&((i.getChars()||i.getWidth()===0)&&WU(i,o)&&(c=!0),s&&(a.getChars()||a.getWidth()===0)&&WU(i,o)&&WU(a,o)&&(c=!0)),c||(n=`-`.repeat(this._nullCellCount+1),n+=`\x1B[1D\x1B[1X`,this._nullCellCount>0&&(n+=`\x1B[A`,n+=`\x1B[${t.length-this._nullCellCount}C`,n+=`\x1B[${this._nullCellCount}X`,n+=`\x1B[${t.length-this._nullCellCount}D`,n+=`\x1B[B`),this._lastContentCursorRow=e+1,this._lastContentCursorCol=0,this._lastCursorRow=e+1,this._lastCursorCol=0)}}this._allRows[this._rowIndex]=this._currentRow,this._allRowSeparators[this._rowIndex++]=n,this._currentRow=``,this._nullCellCount=0}_diffStyle(e,t){let n=[],r=!UU(e,t),i=!WU(e,t),a=!GU(e,t);if(r||i||a)if(e.isAttributeDefault())t.isAttributeDefault()||n.push(0);else{if(r){let t=e.getFgColor();e.isFgRGB()?n.push(38,2,t>>>16&255,t>>>8&255,t&255):e.isFgPalette()?t>=16?n.push(38,5,t):n.push(t&8?90+(t&7):30+(t&7)):n.push(39)}if(i){let t=e.getBgColor();e.isBgRGB()?n.push(48,2,t>>>16&255,t>>>8&255,t&255):e.isBgPalette()?t>=16?n.push(48,5,t):n.push(t&8?100+(t&7):40+(t&7)):n.push(49)}a&&(e.isInverse()!==t.isInverse()&&n.push(e.isInverse()?7:27),e.isBold()!==t.isBold()&&n.push(e.isBold()?1:22),e.isUnderline()!==t.isUnderline()&&n.push(e.isUnderline()?4:24),e.isOverline()!==t.isOverline()&&n.push(e.isOverline()?53:55),e.isBlink()!==t.isBlink()&&n.push(e.isBlink()?5:25),e.isInvisible()!==t.isInvisible()&&n.push(e.isInvisible()?8:28),e.isItalic()!==t.isItalic()&&n.push(e.isItalic()?3:23),e.isDim()!==t.isDim()&&n.push(e.isDim()?2:22),e.isStrikethrough()!==t.isStrikethrough()&&n.push(e.isStrikethrough()?9:29))}return n}_nextCell(e,t,n,r){if(e.getWidth()===0)return;let i=e.getChars()===``,a=this._diffStyle(e,this._cursorStyle);if(i?!WU(this._cursorStyle,e):a.length>0){this._nullCellCount>0&&(WU(this._cursorStyle,this._backgroundCell)||(this._currentRow+=`\x1B[${this._nullCellCount}X`),this._currentRow+=`\x1B[${this._nullCellCount}C`,this._nullCellCount=0),this._lastContentCursorRow=this._lastCursorRow=n,this._lastContentCursorCol=this._lastCursorCol=r,this._currentRow+=`\x1B[${a.join(`;`)}m`;let e=this._buffer.getLine(n);e!==void 0&&(e.getCell(r,this._cursorStyle),this._cursorStyleRow=n,this._cursorStyleCol=r)}i?this._nullCellCount+=e.getWidth():(this._nullCellCount>0&&(WU(this._cursorStyle,this._backgroundCell)||(this._currentRow+=`\x1B[${this._nullCellCount}X`),this._currentRow+=`\x1B[${this._nullCellCount}C`,this._nullCellCount=0),this._currentRow+=e.getChars(),this._lastContentCursorRow=this._lastCursorRow=n,this._lastContentCursorCol=this._lastCursorCol=r+e.getWidth())}_serializeString(e){let t=this._allRows.length;this._buffer.length-this._firstRow<=this._terminal.rows&&(t=this._lastContentCursorRow+1-this._firstRow,this._lastCursorCol=this._lastContentCursorCol,this._lastCursorRow=this._lastContentCursorRow);let n=``;for(let e=0;e<t;e++)n+=this._allRows[e],e+1<t&&(n+=this._allRowSeparators[e]);if(!e){let e=this._buffer.baseY+this._buffer.cursorY,t=this._buffer.cursorX;(e!==this._lastCursorRow||t!==this._lastCursorCol)&&((e=>{e>0?n+=`\x1B[${e}B`:e<0&&(n+=`\x1B[${-e}A`)})(e-this._lastCursorRow),(e=>{e>0?n+=`\x1B[${e}C`:e<0&&(n+=`\x1B[${-e}D`)})(t-this._lastCursorCol))}let r=this._terminal._core._inputHandler._curAttrData,i=this._diffStyle(r,this._cursorStyle);return i.length>0&&(n+=`\x1B[${i.join(`;`)}m`),n}},qU=class{activate(e){this._terminal=e}_serializeBufferByScrollback(e,t,n){let r=t.length,i=n===void 0?r:BU(n+e.rows,0,r);return this._serializeBufferByRange(e,t,{start:r-i,end:r-1},!1)}_serializeBufferByRange(e,t,n,r){return new KU(t,e).serialize({start:{x:0,y:typeof n.start==`number`?n.start:n.start.line},end:{x:e.cols,y:typeof n.end==`number`?n.end:n.end.line}},r)}_serializeBufferAsHTML(e,t){let n=e.buffer.active,r=new JU(n,e,t),i=t.onlySelection??!1,a=t.range;if(a)return r.serialize({start:{x:a.startCol,y:(a.startLine,a.startLine)},end:{x:e.cols,y:(a.endLine,a.endLine)}});if(!i){let i=n.length,a=t.scrollback,o=a===void 0?i:BU(a+e.rows,0,i);return r.serialize({start:{x:0,y:i-o},end:{x:e.cols,y:i-1}})}let o=this._terminal?.getSelectionPosition();return o===void 0?``:r.serialize({start:{x:o.start.x,y:o.start.y},end:{x:o.end.x,y:o.end.y}})}_serializeModes(e){let t=``,n=e.modes;if(n.applicationCursorKeysMode&&(t+=`\x1B[?1h`),n.applicationKeypadMode&&(t+=`\x1B[?66h`),n.bracketedPasteMode&&(t+=`\x1B[?2004h`),n.insertMode&&(t+=`\x1B[4h`),n.originMode&&(t+=`\x1B[?6h`),n.reverseWraparoundMode&&(t+=`\x1B[?45h`),n.sendFocusMode&&(t+=`\x1B[?1004h`),n.wraparoundMode===!1&&(t+=`\x1B[?7l`),n.mouseTrackingMode!==`none`)switch(n.mouseTrackingMode){case`x10`:t+=`\x1B[?9h`;break;case`vt200`:t+=`\x1B[?1000h`;break;case`drag`:t+=`\x1B[?1002h`;break;case`any`:t+=`\x1B[?1003h`;break}return t}serialize(e){if(!this._terminal)throw Error(`Cannot use addon until it has been loaded`);let t=e?.range?this._serializeBufferByRange(this._terminal,this._terminal.buffer.normal,e.range,!0):this._serializeBufferByScrollback(this._terminal,this._terminal.buffer.normal,e?.scrollback);if(!e?.excludeAltBuffer&&this._terminal.buffer.active.type===`alternate`){let e=this._serializeBufferByScrollback(this._terminal,this._terminal.buffer.alternate,void 0);t+=`\x1B[?1049h\x1B[H${e}`}return e?.excludeModes||(t+=this._serializeModes(this._terminal)),t}serializeAsHTML(e){if(!this._terminal)throw Error(`Cannot use addon until it has been loaded`);return this._serializeBufferAsHTML(this._terminal,e||{})}dispose(){}},JU=class extends HU{constructor(e,t,n){super(e),this._terminal=t,this._options=n,this._currentRow=``,this._htmlContent=``,t._core._themeService?this._ansiColors=t._core._themeService.colors.ansi:this._ansiColors=zU}_padStart(e,t,n){return t>>=0,n??=` `,e.length>t?e:(t-=e.length,t>n.length&&(n+=n.repeat(t/n.length)),n.slice(0,t)+e)}_beforeSerialize(e,t,n){this._htmlContent+=`<html><body><!--StartFragment--><pre>`;let r=`#000000`,i=`#ffffff`;(this._options.includeGlobalBackground??!1)&&(r=this._terminal.options.theme?.foreground??`#ffffff`,i=this._terminal.options.theme?.background??`#000000`);let a=[];a.push(`color: `+r+`;`),a.push(`background-color: `+i+`;`),a.push(`font-family: `+this._terminal.options.fontFamily+`;`),a.push(`font-size: `+this._terminal.options.fontSize+`px;`),this._htmlContent+=`<div style='`+a.join(` `)+`'>`}_afterSerialize(){this._htmlContent+=`</div>`,this._htmlContent+=`</pre><!--EndFragment--></body></html>`}_rowEnd(e,t){this._htmlContent+=`<div><span>`+this._currentRow+`</span></div>`,this._currentRow=``}_getHexColor(e,t){let n=t?e.getFgColor():e.getBgColor();if(t?e.isFgRGB():e.isBgRGB())return`#`+[n>>16&255,n>>8&255,n&255].map(e=>this._padStart(e.toString(16),2,`0`)).join(``);if(t?e.isFgPalette():e.isBgPalette())return this._ansiColors[n].css}_diffStyle(e,t){let n=[],r=!UU(e,t),i=!WU(e,t),a=!GU(e,t);if(r||i||a){let t=this._getHexColor(e,!0);t&&n.push(`color: `+t+`;`);let r=this._getHexColor(e,!1);return r&&n.push(`background-color: `+r+`;`),e.isInverse()&&n.push(`color: #000000; background-color: #BFBFBF;`),e.isBold()&&n.push(`font-weight: bold;`),e.isUnderline()&&e.isOverline()?n.push(`text-decoration: overline underline;`):e.isUnderline()?n.push(`text-decoration: underline;`):e.isOverline()&&n.push(`text-decoration: overline;`),e.isBlink()&&n.push(`text-decoration: blink;`),e.isInvisible()&&n.push(`visibility: hidden;`),e.isItalic()&&n.push(`font-style: italic;`),e.isDim()&&n.push(`opacity: 0.5;`),e.isStrikethrough()&&n.push(`text-decoration: line-through;`),n}}_nextCell(e,t,n,r){if(e.getWidth()===0)return;let i=e.getChars()===``,a=this._diffStyle(e,t);a&&(this._currentRow+=a.length===0?`</span><span>`:`</span><span style='`+a.join(` `)+`'>`),i?this._currentRow+=` `:this._currentRow+=VU(e.getChars())}_serializeString(){return this._htmlContent}};function YU(e){let t=0;for(let n=0;n<e.length;++n){let r=e.charCodeAt(n);if(r<48||57<r)return-1;t=t*10+r-48}return t}var XU=class{constructor(){this._st=0,this._pr=0}dispose(){this._seqHandler?.dispose(),this._onChange?.dispose()}activate(e){this._seqHandler=e.parser.registerOscHandler(9,e=>{if(!e.startsWith(`4;`))return!1;let t=e.split(`;`);if(t.length>3)return!0;t.length===2&&t.push(``);let n=YU(t[1]),r=YU(t[2]);switch(n){case 0:this.progress={state:n,value:0};break;case 1:if(r<0)return!0;this.progress={state:n,value:r};break;case 2:case 4:if(r<0)return!0;this.progress={state:n,value:r||this._pr};break;case 3:this.progress={state:n,value:this._pr};break}return!0}),this._onChange=new e._core._onData.constructor,this.onChange=this._onChange.event}get progress(){return{state:this._st,value:this._pr}}set progress(e){if(e.state<0||e.state>4){console.warn(`progress state out of bounds, not applied`);return}this._st=e.state,this._pr=Math.min(Math.max(e.value,0),100),this._onChange?.fire({state:this._st,value:this._pr})}};function ZU(e){return`\x1b[200~${e}\x1b[201~`}function QU(e){return e.replace(/[\x00-\x1f\x7f]/g,``)}function $U(e,t){let n=QU(e);return t===`codex`?n:ZU(n)}var eW=40*1024*1024,tW=`40 MB`;function nW(e){if(!e)return[];let t=Array.from(e.files??[]).filter(e=>e instanceof File);return t.length?t:Array.from(e.items??[]).filter(e=>e.kind===`file`).map(e=>e.getAsFile?.()).filter(e=>e instanceof File)}function rW(e){let t=e.find(e=>e.type.startsWith(`image/`)&&e.size===0);if(t)return`${t.name} contains no image data. Choose the file to upload it.`;let n=e.find(e=>e.size>eW);return n?`${n.name} exceeds the ${tW} limit`:null}async function iW(e,t){let n=rW([e]);if(n)throw Error(n);let r=new FormData,i=/^image\/(png|jpeg|gif|webp)$/.test(e.type);r.append(i?`image`:`file`,e,e.name);let a;try{a=await fetch(i?`/api/paste-image`:`/api/paste-file`,{method:`POST`,body:r,signal:t})}catch(n){throw t?.aborted?n:Error(`Could not upload ${e.name}. Check your connection and try again.`)}let o=await a.json().catch(()=>null);if(!a.ok||typeof o?.path!=`string`||!o.path.startsWith(`/`))throw Error(typeof o?.error==`string`?o.error:`Could not upload ${e.name}. Try again.`);return o.path}function aW(e){return`'${e.replace(/[\x00-\x1f\x7f]/g,``).replace(/'/g,`'\\''`)}'`}async function oW(){try{let e=await navigator.clipboard.read(),t=[],n=``;for(let r of e){let e=r.types.find(e=>e.startsWith(`image/`));e?t.push(new File([await r.getType(e)],`clipboard.${e.split(`/`)[1]||`png`}`,{type:e})):r.types.includes(`text/plain`)&&(n+=await(await r.getType(`text/plain`)).text())}return{text:n,files:t}}catch{return{text:await navigator.clipboard.readText(),files:[]}}}var sW=new Map,cW=20;function lW(e){sW.delete(e)}function uW(){sW.clear()}var dW=/https?:\/\/[^\s"'<>]+|\b(?:localhost|\d{1,3}(?:\.\d{1,3}){3}):\d{1,5}(?:\/[^\s"'<>]*)?\b/,fW=/[.,;:!?]+$/,pW=[[`(`,`)`],[`[`,`]`],[`{`,`}`]],mW=(e,t)=>e.split(t).length-1;function hW(e){let t=e.trim();if(!t)return t;let n=()=>{t=t.replace(fW,``)};n();let r=!0;for(;r;){r=!1;for(let[e,n]of pW){if(!t.endsWith(n))continue;let i=mW(t,e);mW(t,n)>i&&(t=t.slice(0,-1),r=!0)}}return n(),t}var gW=()=>typeof navigator<`u`&&/Mac|iPhone|iPad|iPod/.test(navigator.platform),_W=`\x1B[200~\x1B[201~`,vW=``,yW=`\x1B[?1000h\x1B[?1002h\x1B[?1006h`,bW=`\x1B[?1000l\x1B[?1002l\x1B[?1003l\x1B[?1006l`;async function xW(e){try{let t=(e.type.split(`/`)[1]||`png`).toLowerCase(),n=new FormData;n.append(`image`,e,`paste.${t}`);let r=await fetch(`/api/paste-image`,{method:`POST`,body:n});if(!r.ok)return null;let i=await r.json();return typeof i.path==`string`?i.path:null}catch{return null}}async function SW(){try{let e=await fetch(`/api/clipboard-file-path`);if(!e.ok)return null;let t=await e.json();return t.isImage===!0&&typeof t.path==`string`?t.path:null}catch{return null}}async function CW(e,t){if(e===`codex`)return vW;let n=t.path??null;return!n&&t.blob&&(n=await xW(t.blob)),n||=await SW(),n?ZU(QU(n)):_W}var wW=/\/Users\/[^/\n]+\/Library\/Group Containers\/group\.com\.apple\.coreservices\.useractivityd\/shared-pasteboard\/items\//;function TW(e){return wW.test(e)}function EW(e){if(!e)return!1;for(let t of Array.from(e.files??[]))if(t?.type?.startsWith(`image/`))return!0;for(let t of Array.from(e.items??[]))if(t?.type?.startsWith(`image/`))return!0;return!1}function DW(e){if(!e)return null;for(let t of Array.from(e.files??[]))if(t?.type?.startsWith(`image/`))return t;for(let t of Array.from(e.items??[]))if(t?.kind===`file`&&t.type?.startsWith(`image/`)){let e=t.getAsFile?.();if(e)return e}return null}var OW=class{constructor(e={}){this.callbacks=e}async readText(e){if(e!==`c`)return``;try{return await navigator.clipboard.readText()}catch{return``}}async writeText(e,t){if(e!==`c`||!t?.trim())return;let n=performance.now();try{if(!navigator.clipboard?.writeText)throw Error(`navigator.clipboard.writeText unavailable`);await navigator.clipboard.writeText(t),XD(`clipboard_write_success`,{source:`osc52`,chars:t.length,durationMs:Math.round(performance.now()-n)})}catch(e){XD(`clipboard_write_failed`,{source:`osc52`,chars:t.length,error:e instanceof Error?e.message:String(e)},`warn`),this.callbacks.onWriteFailed?.(t,`osc52`)}}},kW=`︎`,AW=[`⏺`],jW=new RegExp(AW.map(e=>e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)).join(`|`),`g`);function MW(e){for(let t of AW)if(e.indexOf(t)!==-1)return e.replace(jW,`$&${kW}`);return e}function NW({sessionId:e,tmuxTarget:t,agentType:n,allowAttach:r=!0,connectionStatus:i=`connected`,connectionEpoch:a=0,sendMessage:o,subscribe:s,theme:c,fontSize:l,lineHeight:u,letterSpacing:d,fontFamily:f,useWebGL:p,onScrollChange:m,onPasteFiles:h,onPasteError:g}){let _=(0,x.useRef)(h);_.current=h;let v=(0,x.useRef)(g);v.current=g;let y=()=>!_.current||typeof location<`u`&&[`localhost`,`127.0.0.1`,`[::1]`].includes(location.hostname),b=Ge(),S=(0,x.useRef)(null),C=(0,x.useRef)(null),w=(0,x.useRef)(!1),T=(0,x.useRef)(null),E=(0,x.useRef)(null),D=(0,x.useRef)(null),O=(0,x.useRef)(null),k=(0,x.useRef)(null),A=(0,x.useRef)(null),j=(0,x.useRef)(null),M=(0,x.useRef)(null),N=(0,x.useRef)(null),P=(0,x.useRef)(null),F=(0,x.useRef)(0),I=(0,x.useRef)(!1),[L,R]=(0,x.useState)(!1),z=(0,x.useRef)(!1),B=(0,x.useRef)(!1),V=(0,x.useRef)(null),ee=(0,x.useRef)(0),[H,te]=(0,x.useState)(null),ne=(0,x.useCallback)((e,t)=>{e?.trim()&&(ee.current+=1,te({id:ee.current,text:e,source:t}))},[]),re=(0,x.useCallback)(()=>{H&&(Bm(H.text),XD(`clipboard_manual_copy`,{source:H.source,chars:H.text.length},`info`),te(null))},[H]),ie=(0,x.useCallback)(()=>{te(null)},[]),ae=(0,x.useRef)(null),W=(0,x.useRef)(null),oe=(0,x.useRef)(e&&r&&i===`connected`?e:null),se=(0,x.useRef)(null),ce=(0,x.useRef)(-1),le=(0,x.useRef)(null),ue=(0,x.useRef)(null),de=(0,x.useRef)(o),fe=(0,x.useRef)(n),pe=(0,x.useRef)(m),me=(0,x.useRef)(p),he=(0,x.useRef)([]),ge=(0,x.useRef)(null),_e=(0,x.useRef)(null),ve=(0,x.useRef)({count:0,bytes:0,lastEmit:0,timer:null,lastMessageSessionId:null}),ye=(0,x.useRef)(!1),[be,xe]=(0,x.useState)(!1),Se=(0,x.useRef)(null),Ce=(0,x.useRef)(null),we=(0,x.useRef)(null),Te=()=>{if(Se.current!==null&&(window.clearTimeout(Se.current),Se.current=null),Ce.current!==null&&(cancelAnimationFrame(Ce.current),Ce.current=null),we.current!==null){let e=S.current;e&&(e.style.display=we.current),we.current=null}},Ee=(e,t)=>{let n=S.current;n&&(Te(),XD(`ios_repaint_schedule`,{delayMs:e,trigger:t,sessionId:W.current}),Se.current=window.setTimeout(()=>{Se.current=null;let e=C.current;e&&e.refresh(0,e.rows-1),XD(`ios_repaint_exec`,{trigger:t,hasContent:e?e.buffer.active.length>0:!1,bufferLines:e?.buffer.active.length??0,sessionId:W.current}),we.current=n.style.display,n.style.display=`none`,Ce.current=requestAnimationFrame(()=>{Ce.current=requestAnimationFrame(()=>{Ce.current=null,n.style.display=we.current??``,we.current=null})})},e))};(0,x.useEffect)(()=>{de.current=o},[o]),(0,x.useEffect)(()=>{fe.current=n},[n]),(0,x.useEffect)(()=>{pe.current=m},[m]);let De=(0,x.useCallback)(()=>{let e=C.current;if(!e||!pe.current)return;let t=e.buffer.active,n=!I.current&&t.viewportY>=t.baseY;pe.current(n)},[]),Oe=(0,x.useCallback)(e=>{if(I.current===e)return;I.current=e,R(e);let t=C.current;t&&e&&t.write(bW),De()},[De]),ke=(0,x.useCallback)(()=>{let e=oe.current;e&&(V.current!==null&&window.clearTimeout(V.current),V.current=window.setTimeout(()=>{V.current=null,de.current({type:`tmux-check-copy-mode`,sessionId:e})},150))},[]),Ae=(0,x.useCallback)(()=>{let e=C.current,t=T.current;if(!e||!t)return;t.fit();let n=W.current;n&&de.current({type:`terminal-resize`,sessionId:n,cols:e.cols,rows:e.rows})},[]);return(0,x.useEffect)(()=>{let t=S.current;if(!t||C.current)return;let n=!1;t.innerHTML=``;let r=new bI({fontFamily:f,fontSize:l,lineHeight:((e,t)=>Math.round(e*t)/e)(l,u),letterSpacing:d,scrollback:0,cursorBlink:!1,cursorStyle:`underline`,convertEol:!1,theme:c,screenReaderMode:b,minimumContrastRatio:4.5}),i=new CI;r.loadAddon(i),r.loadAddon(new tH(void 0,new OW({onWriteFailed:ne})));let a=new DU;r.loadAddon(a),k.current=a;let o=new qU;r.loadAddon(o),A.current=o;let s=new XU;r.loadAddon(s),j.current=s;let p=()=>{if(!n){if(me.current)try{let t=new dV;t.onContextLoss(()=>{XD(`webgl_context_loss`,{sessionId:e},`info`);try{t.dispose()}catch{}E.current=null}),r.loadAddon(t),E.current=t}catch{}r.open(t),i.fit(),w.current||(w.current=!0,XD(`terminal_init`,{isiOS:b,useWebGL:me.current,hasWebGL:!!E.current,userAgent:navigator.userAgent.slice(0,120),platform:navigator.platform,maxTouchPoints:navigator.maxTouchPoints},`info`)),m&&r.element&&r.element.appendChild(m)}};document.fonts?.ready?document.fonts.ready.then(p).catch(p):p();let m=null,h=null,g=null;typeof document<`u`&&document.createElement&&(m=document.createElement(`div`),m.className=`xterm-hover`,m.style.cssText=`
|
|
197
197
|
position: absolute;
|
|
198
198
|
display: none;
|
|
199
199
|
z-index: 20;
|
|
@@ -207,9 +207,9 @@ ${s.join(`
|
|
|
207
207
|
pointer-events: none;
|
|
208
208
|
max-width: 400px;
|
|
209
209
|
word-break: break-all;
|
|
210
|
-
`,h=document.createElement(`div`),m.appendChild(h),g=document.createElement(`div`),g.style.color=`var(--text-muted)`,g.style.marginTop=`2px`,g.style.fontSize=`11px`,m.appendChild(g),O.current=m);let x=(e,t)=>{if(!r.element||!m||!h||!g)return;let n=hW(t);if(!n)return;let i=r.element.getBoundingClientRect(),a=n.length>60?n.slice(0,57)+`...`:n;h.textContent=a,g.textContent=`${gW()?`⌘`:`Ctrl`}+click to open`,m.style.left=`${e.clientX-i.left+10}px`,m.style.top=`${e.clientY-i.top+10}px`,m.style.display=`block`},M=()=>{m&&(m.style.display=`none`)},P=null,L=!1,
|
|
211
|
-
`);_.current({files:n.files,text:r.trim()===e?``:r})}return}if(n?.hasImage&&gW()&&!b){if(!y()){if(n.imageBlob){let e=n.imageBlob;_.current?.({text:``,files:[new File([e],`clipboard.${e.type.split(`/`)[1]||`png`}`,{type:e.type})]})}else v.current?.(`The browser did not provide image data. Choose the file to upload it.`);return}
|
|
212
|
-
`);_.current({text:t.length&&n.trim()===e?``:n,files:t})}return}e.preventDefault(),e.stopPropagation();let t=e.clipboardData?.getData(`text/plain`)??``,n=DW(e.clipboardData),r=n!==null||EW(e.clipboardData),i=ne;ne=null,i({text:t,hasImage:r,hasFiles:(e.clipboardData?.files?.length??0)>0||Array.from(e.clipboardData?.items??[]).some(e=>e.kind===`file`)||Array.from(e.clipboardData?.types??[]).includes(`Files`),imageBlob:n,files:nW(e.clipboardData)})};return t.addEventListener(`paste`,se,{capture:!0}),r.onData(e=>{let t=oe.current;if(t){let n=/^\x1b\[(<[\d;]+[Mm]|[\d;]+M|M[\x20-\xff]{3})$/.test(e);if(I.current&&n)return;I.current&&(de.current({type:`tmux-cancel-copy-mode`,sessionId:t}),Oe(!1)),de.current({type:`terminal-input`,sessionId:t,data:e})}}),r.attachCustomWheelEventHandler(e=>{let t=oe.current;if(!t||e.target?.closest(`input, textarea, [contenteditable="true"], .xterm-hover`)||r.hasSelection()||e.shiftKey)return!0;F.current+=e.deltaY;let n=r.cols,i=r.rows,a=Math.floor(n/2),o=Math.floor(i/2),s=!1,c=!1;for(;Math.abs(F.current)>=30;){c=!0;let e=F.current>0;F.current+=e?-30:30;let n=e?65:64;e||(s=!0),de.current({type:`terminal-input`,sessionId:t,data:`\x1b[<${n};${a};${o}M`})}return s&&!R.current&&Oe(!0),c&&!R.current&&ke(),!1}),C.current=r,T.current=i,()=>{if(n=!0,ee&&clearTimeout(ee),P=null,t.removeEventListener(`mousedown`,te,!0),t.removeEventListener(`paste`,se,!0),U!==null&&(clearTimeout(U),U=null),ne=null,O.current&&=(O.current.remove(),null),D.current){try{D.current.dispose()}catch{}D.current=null}if(E.current){try{E.current.dispose()}catch{}E.current=null}try{r.dispose()}catch{}t&&(t.innerHTML=``),C.current=null,T.current=null,k.current=null,A.current=null,j.current=null,N.current&&window.clearTimeout(N.current),B.current!==null&&window.clearTimeout(B.current)}},[Ae]),(0,x.useEffect)(()=>{C.current&&(C.current.options.theme=c)},[c]),(0,x.useEffect)(()=>{let e=C.current,t=T.current;if(e&&t){e.options.fontFamily=f,e.options.fontSize=l,e.options.lineHeight=Math.round(l*u)/l,e.options.letterSpacing=d,t.fit();let n=ae.current;n&&de.current({type:`terminal-resize`,sessionId:n,cols:e.cols,rows:e.rows})}},[l,u,d,f]),(0,x.useEffect)(()=>{let e=C.current;if(!e)return;let t=me.current;if(me.current=p,t!==p){if(p){if(!E.current)try{let t=new dV;t.onContextLoss(()=>{try{t.dispose()}catch{}E.current=null}),e.loadAddon(t),E.current=t}catch{}}else if(E.current){try{E.current.dispose()}catch{}E.current=null}}},[p]),(0,x.useLayoutEffect)(()=>{(oe.current!==e||!r||i!==`connected`||ce.current>=0&&ce.current!==a)&&(oe.current=null,e&&r&&i===`connected`&&xe(!0))},[e,r,i,a]),(0,x.useEffect)(()=>{let n=C.current;if(!n)return;let o=ae.current,s=se.current;if(!r){oe.current=null,P.current!==null&&(window.clearTimeout(P.current),P.current=null),o&&(de.current({type:`terminal-detach`,sessionId:o}),ae.current=null,se.current=null,ce.current=-1,le.current=null,Oe(!1)),n.reset(),ye.current=!1,xe(!1);return}if(i!==`connected`){oe.current=null,P.current!==null&&(window.clearTimeout(P.current),P.current=null),o&&(XD(`terminal_detach_on_disconnect`,{connectionStatus:i,prevAttached:o}),ae.current=null,se.current=null,ce.current=-1,le.current=null,Oe(!1)),uW(),ye.current=!1,xe(!1);return}if(o&&o!==e){oe.current=null;try{let e=A.current?.serialize();if(e&&(sW.set(o,e),sW.size>cW)){let e=sW.keys().next().value;e&&sW.delete(e)}}catch{}de.current({type:`terminal-detach`,sessionId:o}),ae.current=null,se.current=null,ce.current=-1,le.current=null,Oe(!1)}let c=ce.current,l=a!==c;if(e&&(e!==o||t!==s||l)){XD(`terminal_attach`,{sessionId:e,tmuxTarget:t,prevAttached:o,prevTarget:s,connectionStatus:i,connectionEpoch:a,attachedEpoch:c});let r=performance.now();he.current=[],ge.current!==null&&(window.clearTimeout(ge.current),ge.current=null),_e.current!==null&&(window.clearTimeout(_e.current),_e.current=null),ye.current=!0,xe(!0),o!==null&&(oe.current=null);let l=sW.get(e);l&&(n.reset(),n.write(l));let u=T.current;u&&u.fit();let d=performance.now();ae.current=e,se.current=t??null,ce.current=a,le.current=e,ue.current=r,P.current!==null&&(window.clearTimeout(P.current),P.current=null);let f={type:`terminal-attach`,sessionId:e,tmuxTarget:t??void 0,cols:n.cols,rows:n.rows},p=o!==null&&o!==e;if(p){let t=e;queueMicrotask(()=>{ae.current===t&&(de.current(f),de.current({type:`tmux-check-copy-mode`,sessionId:e}))})}else P.current=window.setTimeout(()=>{P.current=null,de.current(f),de.current({type:`tmux-check-copy-mode`,sessionId:e})},50);XD(`switch_attach_sent`,{sessionId:e,fitMs:Math.round(d-r),totalMs:Math.round(performance.now()-r),from:o??null,immediate:p})}return e&&e===o&&t===s&&!l&&XD(`terminal_attach_skip`,{sessionId:e,prevAttached:o,connectionStatus:i,connectionEpoch:a,attachedEpoch:c}),!e&&o&&(P.current!==null&&(window.clearTimeout(P.current),P.current=null),ae.current=null,se.current=null,ce.current=-1,le.current=null,oe.current=null),()=>{P.current!==null&&(XD(`attach_debounce_cancelled`,{sessionId:e,attachedSession:ae.current},`info`),window.clearTimeout(P.current),P.current=null)}},[e,t,r,i,a,De,Oe]),(0,x.useEffect)(()=>{if(W.current!==null&&(globalThis.clearInterval(W.current),W.current=null),!(!e||!r||i!==`connected`))return W.current=globalThis.setInterval(()=>{ae.current===e&&de.current({type:`tmux-check-copy-mode`,sessionId:e})},750),()=>{W.current!==null&&(globalThis.clearInterval(W.current),W.current=null)}},[e,r,i]),(0,x.useEffect)(()=>{let e=()=>{ge.current!==null&&(window.clearTimeout(ge.current),ge.current=null),_e.current!==null&&(window.clearTimeout(_e.current),_e.current=null);let e=C.current,t=he.current;if(!e||t.length===0)return;he.current=[];let n=t.join(``);ye.current&&=(e.reset(),!1);let r=performance.now(),i=n.length;e.write(n,()=>{let e=Math.round(performance.now()-r);e>50&&XD(`switch_write_slow`,{sessionId:ae.current,writeMs:e,bytes:i}),b&&e>50&&XD(`ios_write_slow`,{sessionId:ae.current,writeMs:e,bytes:i}),De()})},t=()=>{ge.current!==null&&window.clearTimeout(ge.current),ge.current=window.setTimeout(e,2),_e.current===null&&(_e.current=window.setTimeout(e,16))},n=()=>{let e=ve.current;e.timer=null,e.count!==0&&(XD(`terminal_output_dropped`,{messageSessionId:e.lastMessageSessionId,attachedSession:ae.current,drops:e.count,bytes:e.bytes,hasSwitchStart:ue.current!==null},`info`),e.count=0,e.bytes=0,e.lastEmit=performance.now())},r=s(r=>{let i=ae.current;if(r.type===`terminal-output`&&(!i||r.sessionId!==i)){let e=ve.current;e.count+=1,e.bytes+=r.data.length,e.lastMessageSessionId=r.sessionId;let t=performance.now();t-e.lastEmit>=1e3?n():e.timer===null&&(e.timer=window.setTimeout(n,1e3-(t-e.lastEmit)))}if(r.type===`terminal-output`&&i&&r.sessionId===i){let e=ue.current;e&&(XD(`switch_first_output`,{sessionId:r.sessionId,serverRoundtripMs:Math.round(performance.now()-e),bytes:r.data.length,parseMs:r._parseMs??-1,rawLength:r._rawLength??-1}),ue.current=null),he.current.push(b?MW(r.data):r.data),t()}if(r.type===`terminal-ready`&&i&&r.sessionId===i){oe.current=r.sessionId,ye.current&&he.current.length>0?e():ye.current&&=(C.current?.reset(),!1),xe(!1);let t=ue.current;t&&(XD(`switch_ready`,{sessionId:r.sessionId,totalMs:Math.round(performance.now()-t)}),ue.current=null),le.current===r.sessionId&&(C.current?.focus(),le.current=null),b&&(e(),Ee(50,`terminal-ready`))}if(r.type===`terminal-error`&&i&&(!r.sessionId||r.sessionId===i)&&(oe.current=null,ye.current=!1,xe(!1)),r.type===`clipboard-offer`&&i&&r.sessionId===i){let e=r.text;if(!e?.trim())return;if(!b&&navigator.clipboard?.writeText){let t=performance.now();navigator.clipboard.writeText(e).then(()=>{XD(`clipboard_write_success`,{source:r.source,chars:e.length,durationMs:Math.round(performance.now()-t)})}).catch(t=>{XD(`clipboard_write_failed`,{source:r.source,chars:e.length,error:t instanceof Error?t.message:String(t)},`warn`),re(e,r.source)})}else re(e,r.source)}if(r.type===`tmux-copy-mode-status`&&i&&r.sessionId===i){let e=r.appMouse===!0&&!r.inCopyMode,t=R.current;R.current=e,z.current=r.altScreen===!0,!t&&e&&C.current?.write(yW),Oe(r.inCopyMode)}});return()=>{r(),e(),Te(),ve.current.timer!==null&&window.clearTimeout(ve.current.timer),n()}},[s,De,Oe,re]),(0,x.useEffect)(()=>{let e=S.current,t=C.current,n=T.current;if(!e||!t||!n)return;let r=()=>{M.current&&window.clearTimeout(M.current),M.current=window.setTimeout(()=>{Ae()},150)},i=new ResizeObserver(r);return i.observe(e),r(),()=>{i.disconnect(),M.current&&window.clearTimeout(M.current)}},[]),(0,x.useEffect)(()=>{if(typeof document>`u`||typeof document.addEventListener!=`function`)return;let e=()=>{document.visibilityState!==`hidden`&&XD(`terminal_visibility_resume`,{isiOS:b,hasWebGL:!!E.current,useWebGL:me.current,hasTerminal:!!C.current,bufferLines:C.current?.buffer.active.length??0,sessionId:ae.current},`info`)};if(document.addEventListener(`visibilitychange`,e),!b)return()=>{document.removeEventListener(`visibilitychange`,e)};let t=e=>{let t=C.current;if(t&&E.current&&me.current){try{E.current.dispose()}catch{}E.current=null;try{let n=new dV;n.onContextLoss(()=>{XD(`webgl_context_loss`,{sessionId:ae.current},`info`);try{n.dispose()}catch{}E.current=null}),t.loadAddon(n),E.current=n,XD(`ios_webgl_recreated`,{trigger:e},`info`)}catch{XD(`ios_webgl_recreate_failed`,{trigger:e},`info`)}}},n=()=>{document.visibilityState!==`hidden`&&(t(`visibilitychange`),Ee(200,`visibilitychange`))},r=e=>{e.persisted&&(t(`pageshow`),Ee(200,`pageshow`))},i=()=>{t(`focus`),Ee(200,`focus`)};return document.addEventListener(`visibilitychange`,n),window.addEventListener(`pageshow`,r),window.addEventListener(`focus`,i),()=>{document.removeEventListener(`visibilitychange`,e),document.removeEventListener(`visibilitychange`,n),window.removeEventListener(`pageshow`,r),window.removeEventListener(`focus`,i),Te()}},[]),{containerRef:S,terminalRef:C,searchAddonRef:k,serializeAddonRef:A,progressAddonRef:j,inTmuxCopyModeRef:I,isTmuxCopyMode:L,appMouseRef:R,setTmuxCopyMode:Oe,isSwitching:be,isInputReady:!!e&&r&&i===`connected`&&oe.current===e,pendingClipboardOffer:V,copyPendingClipboardOffer:U,dismissPendingClipboardOffer:ie}}function PW(e=`(max-width: 767px)`){let[t,n]=(0,x.useState)(()=>typeof window>`u`||!window.matchMedia?!1:window.matchMedia(e).matches);return(0,x.useEffect)(()=>{if(typeof window>`u`||!window.matchMedia)return;let t=window.matchMedia(e),r=()=>n(t.matches);return r(),typeof t.addEventListener==`function`?(t.addEventListener(`change`,r),()=>t.removeEventListener(`change`,r)):(t.addListener(r),()=>t.removeListener(r))},[e]),t}function FW(e,t,n){(0,x.useEffect)(()=>{if(!t)return;let r=t=>{e.current&&!e.current.contains(t.target)&&n()};return document.addEventListener(`mousedown`,r),document.addEventListener(`touchstart`,r),()=>{document.removeEventListener(`mousedown`,r),document.removeEventListener(`touchstart`,r)}},[e,t,n])}function IW(e,t){(0,x.useEffect)(()=>{if(!e)return;let n=e=>{e.key===`Escape`&&(e.preventDefault(),t())};return document.addEventListener(`keydown`,n),()=>document.removeEventListener(`keydown`,n)},[e,t])}function LW({enabled:e,isOpen:t,onOpen:n,edgeThresholdPx:r=30,swipeDistancePx:i=50,swipeRatio:a=1.5}){let o=(0,x.useRef)(!1);return(0,x.useEffect)(()=>{if(!e)return;let s=0,c=0,l=!1,u=e=>{if(t)return;let n=e.touches[0];n.clientX<=r?(s=n.clientX,c=n.clientY,l=!0,o.current=!0):l=!1},d=e=>{if(o.current=!1,!l||t)return;let r=e.changedTouches[0],u=r.clientX-s,d=Math.abs(r.clientY-c);u>=i&&u>d*a&&n(),l=!1};return document.addEventListener(`touchstart`,u,{passive:!0}),document.addEventListener(`touchend`,d,{passive:!0}),()=>{o.current=!1,document.removeEventListener(`touchstart`,u),document.removeEventListener(`touchend`,d)}},[e,t,n,r,i,a]),o}var RW=T()(k(e=>({theme:`dark`,setTheme:t=>e({theme:t}),toggleTheme:()=>e(e=>({theme:e.theme===`dark`?`light`:`dark`}))}),{name:`agentboard-theme`,storage:D(()=>M)})),zW={dark:{background:`#2d2d2d`,foreground:`#d4d4d4`,cursor:`#3b82f6`,cursorAccent:`#2d2d2d`,selectionBackground:`rgba(59, 130, 246, 0.35)`,selectionForeground:`#ffffff`,black:`#808080`,red:`#f87171`,green:`#4ade80`,yellow:`#fbbf24`,blue:`#60a5fa`,magenta:`#c084fc`,cyan:`#22d3ee`,white:`#d4d4d4`,brightBlack:`#a0a0a0`,brightRed:`#fca5a5`,brightGreen:`#86efac`,brightYellow:`#fde047`,brightBlue:`#93c5fd`,brightMagenta:`#d8b4fe`,brightCyan:`#67e8f9`,brightWhite:`#ffffff`},light:{background:`#fafafa`,foreground:`#171717`,cursor:`#2563eb`,cursorAccent:`#fafafa`,selectionBackground:`rgba(37, 99, 235, 0.2)`,selectionForeground:`#000000`,black:`#171717`,red:`#dc2626`,green:`#16a34a`,yellow:`#ca8a04`,blue:`#2563eb`,magenta:`#9333ea`,cyan:`#0891b2`,white:`#f5f5f5`,brightBlack:`#737373`,brightRed:`#ef4444`,brightGreen:`#22c55e`,brightYellow:`#eab308`,brightBlue:`#3b82f6`,brightMagenta:`#a855f7`,brightCyan:`#06b6d4`,brightWhite:`#ffffff`}},BW=new WeakSet;function VW(e,t){let n=Object.getOwnPropertyDescriptor(e,t);return!n?.get||!n.set?null:{get:n.get,set:n.set,enumerable:n.enumerable??!0,configurable:n.configurable??!0}}var HW=!1,UW=null,WW=null;function GW(){HW||(HW=!0,!(typeof Node>`u`||typeof HTMLElement>`u`)&&(UW=VW(Node.prototype,`textContent`),WW=VW(HTMLElement.prototype,`innerText`)))}function KW(e){if(BW.has(e))return;BW.add(e);let t=UW?.get;if(t)for(let[n,r]of[[`textContent`,UW],[`innerText`,WW]])r&&Object.defineProperty(e,n,{configurable:r.configurable,enumerable:r.enumerable,get(){return r.get.call(this)},set(e){t.call(this)!==e&&r.set.call(this,e)}})}function qW(e){GW();let t=()=>{for(let t of Array.from(e.children))t instanceof HTMLElement&&KW(t)};t();let n=new MutationObserver(t);return n.observe(e,{childList:!0}),()=>n.disconnect()}var JW={working:`Working`,waiting:`Waiting`,permission:`Needs Input`,unknown:`Unknown`},YW={working:`text-working`,waiting:`text-waiting`,permission:`text-approval`,unknown:`text-muted`};function XW({anchor:e,items:t,anchorFromBottom:n=!1,onClose:r}){let i=(0,x.useRef)(null);return(0,x.useEffect)(()=>{let e=e=>{i.current&&!i.current.contains(e.target)&&r()},t=e=>{e.key===`Escape`&&r()};return document.addEventListener(`mousedown`,e),document.addEventListener(`touchstart`,e),document.addEventListener(`keydown`,t),()=>{document.removeEventListener(`mousedown`,e),document.removeEventListener(`touchstart`,e),document.removeEventListener(`keydown`,t)}},[r]),(0,G.jsx)(`div`,{ref:i,className:`fixed z-50 min-w-[180px] rounded-md border border-border bg-elevated py-1 shadow-lg`,style:{left:typeof window>`u`?e.x:Math.min(e.x,Math.max(8,window.innerWidth-190)),top:e.y,transform:n?`translateY(calc(-100% - 6px))`:void 0},role:`menu`,children:t.map((e,t)=>e===`divider`?(0,G.jsx)(`div`,{className:`my-1 border-t border-border`},`divider-${t}`):(0,G.jsxs)(`button`,{type:`button`,onClick:t=>{t.stopPropagation(),r(),e.onSelect()},className:`flex w-full items-center gap-2 px-3 py-2 text-left text-sm ${e.danger?`text-danger hover:bg-danger/10`:`text-secondary hover:bg-hover hover:text-primary`}`,role:`menuitem`,title:e.title,children:[e.icon,e.label]},e.key))})}var ZW=`flex h-7 shrink-0 items-center gap-2 rounded-md px-2.5 text-xs font-medium transition-colors active:scale-95`,QW=`flex h-7 shrink-0 items-center gap-2 rounded-md border border-border bg-surface px-2.5 text-xs text-secondary transition-colors hover:bg-hover hover:text-primary`,$W=`flex h-7 w-7 shrink-0 items-center justify-center rounded-md transition-all active:scale-95 disabled:cursor-not-allowed disabled:opacity-40`,eG=`text-[11px]`,tG=`inline-flex shrink-0 items-center rounded-full bg-hover px-1.5 py-0.5 text-[11px] leading-none text-secondary`,nG=()=>(0,G.jsx)(`span`,{"aria-hidden":!0,className:`mx-2 h-5 w-px shrink-0 bg-border`}),rG=`inline-block w-[11ch] shrink-0 whitespace-nowrap text-left text-xs`;function iG(){let[e,t]=(0,x.useState)(!1),n=(0,x.useRef)(null);return(0,x.useEffect)(()=>()=>{n.current&&clearTimeout(n.current)},[]),[e,(0,x.useCallback)(()=>{t(!0),n.current&&clearTimeout(n.current),n.current=setTimeout(()=>t(!1),1500)},[])]}function aG({session:e,hibernatingSession:t,hibernatingDisplayName:n,showHostBadge:r,sessionCount:i,connectionStatus:a,isSwitching:o,canControl:s,canHibernate:c,modDisplay:l,onKill:u,onHibernate:d,onWake:f,onRename:p,onDuplicate:m,onMoveToHistory:h,isTmuxCopyMode:g,showJumpToBottom:_,onJumpToBottom:v,selectionReady:y,onCopySelection:b,onDismissSelection:S}){let C=H(e=>e.showProjectName),w=H(e=>e.showSessionIdPrefix),[T,E]=(0,x.useState)(null),[D,O]=(0,x.useState)(!1),[k,A]=(0,x.useState)(``),j=(0,x.useRef)(null),[M,N]=iG(),[P,F]=iG(),I=e?e.agentSessionName||e.name:``,L=e?I:n,ee=e?.projectPath&&Lm(e.projectPath)!==I?Lm(e.projectPath):``,R=t?.projectPath&&Lm(t.projectPath)!==n?Lm(t.projectPath):``,z=e?.agentSessionId?.trim(),B=w&&z?zm(z):null,te=!!B||r&&!!e?.host?.trim()||C&&!!ee,V=r&&!!t?.host?.trim()||C&&!!R,ne=y&&!!e||g&&!!e||_&&!!e;(0,x.useEffect)(()=>{D&&j.current&&(j.current.focus(),j.current.select())},[D]),(0,x.useEffect)(()=>{O(!1)},[e?.id??t?.sessionId??null]);let re=(0,x.useCallback)(()=>{A(L),O(!0)},[L]),U=(0,x.useCallback)(()=>{let e=k.trim();e&&e!==L&&p(e),O(!1)},[k,L,p]),ie=e=>{e.preventDefault(),e.stopPropagation(),E({x:e.clientX,y:e.clientY})},W=[];e?(W.push({key:`rename`,label:`Rename`,icon:(0,G.jsx)(ge,{width:14,height:14}),onSelect:re},...m?[{key:`duplicate`,label:`Duplicate`,icon:(0,G.jsx)(ue,{width:14,height:14}),title:`Create a copy in a new tmux window`,onSelect:m}]:[],...c?[{key:`hibernate`,label:`Hibernate`,icon:(0,G.jsx)(Oe,{width:14,height:14}),title:`Close the live window and keep this session ready to wake`,onSelect:d}]:[],...z?[{key:`copy-id`,label:`Copy Session ID`,icon:(0,G.jsx)(we,{width:14,height:14}),title:z,onSelect:()=>Bm(z)}]:[],...e.logFilePath?[{key:`copy-log`,label:`Copy Log Path`,icon:(0,G.jsx)(ve,{width:14,height:14}),title:e.logFilePath,onSelect:()=>Bm(e.logFilePath)}]:[]),s&&W.push(`divider`,{key:`kill`,label:`Kill Session`,icon:(0,G.jsx)(We,{width:14,height:14}),danger:!0,onSelect:u})):t&&(W.push({key:`wake`,label:`Wake`,icon:(0,G.jsx)(Me,{width:14,height:14}),onSelect:f},{key:`rename`,label:`Rename`,icon:(0,G.jsx)(ge,{width:14,height:14}),onSelect:re},{key:`copy-id`,label:`Copy Session ID`,icon:(0,G.jsx)(we,{width:14,height:14}),title:t.sessionId,onSelect:()=>Bm(t.sessionId)},...t.logFilePath?[{key:`copy-log`,label:`Copy Log Path`,icon:(0,G.jsx)(ve,{width:14,height:14}),title:t.logFilePath,onSelect:()=>Bm(t.logFilePath)}]:[]),h&&W.push(`divider`,{key:`move-to-history`,label:`Move to History`,icon:(0,G.jsx)(We,{width:14,height:14}),onSelect:h}));let ae=(0,G.jsx)(`input`,{ref:j,type:`text`,value:k,onChange:e=>A(e.target.value),onBlur:U,onKeyDown:e=>{e.key===`Enter`?(e.preventDefault(),U()):e.key===`Escape`&&O(!1)},onClick:e=>e.stopPropagation(),onContextMenu:e=>e.stopPropagation(),className:`w-40 max-w-48 select-text rounded border border-border bg-surface px-1.5 py-0.5 text-sm font-medium text-primary outline-none focus:border-accent`,"aria-label":`Rename session`}),oe=(e,t)=>P?(0,G.jsx)(`span`,{className:tG,children:`Copied!`}):(0,G.jsx)(`button`,{type:`button`,onClick:()=>{Bm(t),F()},className:`shrink-0 cursor-pointer`,title:t,"aria-label":`Copy project path ${t}`,children:(0,G.jsx)(Ng,{name:e,fullPath:t,className:eG})});return(0,G.jsxs)(`footer`,{className:`hidden h-10 shrink-0 select-none items-center justify-between gap-3 border-t border-border bg-elevated px-4 md:flex`,children:[(0,G.jsx)(`div`,{className:`flex min-w-0 flex-1 items-center`,children:e?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(`div`,{className:`flex min-w-0 items-center`,onContextMenu:ie,children:[D?ae:(0,G.jsx)(`span`,{className:`max-w-48 truncate text-sm font-medium text-primary`,children:I}),(0,G.jsx)(nG,{}),(0,G.jsx)(`span`,{className:`${rG} ${YW[e.status]}`,children:JW[e.status]}),te&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(nG,{}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2.5`,children:[B&&(0,G.jsx)(`button`,{type:`button`,onClick:()=>{Bm(z),N()},className:`shrink-0 cursor-pointer text-xs text-muted transition-colors hover:text-primary`,title:`${z} — click to copy`,"aria-label":`Copy session ID`,children:M?`Copied!`:B}),r&&e.host?.trim()&&(0,G.jsx)(n_,{name:e.host.trim(),className:eG}),C&&ee&&oe(ee,e.projectPath)]})]})]}),e.prs&&e.prs.length>0&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(nG,{}),(0,G.jsx)(e_,{prs:e.prs,className:`min-w-0 flex-1`})]})]}):t?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(`div`,{className:`flex min-w-0 items-center`,onContextMenu:ie,children:[D?ae:(0,G.jsx)(`span`,{className:`max-w-48 truncate text-sm font-medium text-primary`,children:n}),(0,G.jsx)(nG,{}),(0,G.jsx)(`span`,{className:`shrink-0 rounded-full bg-blue-500/15 px-1.5 py-0.5 text-[10px] font-semibold uppercase tracking-wide text-blue-400`,children:`Hibernating`}),V&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(nG,{}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2.5`,children:[r&&t.host?.trim()&&(0,G.jsx)(n_,{name:t.host.trim(),className:eG}),C&&R&&oe(R,t.projectPath)]})]})]}),t.prs&&t.prs.length>0&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(nG,{}),(0,G.jsx)(e_,{prs:t.prs,className:`min-w-0 flex-1`})]})]}):(0,G.jsxs)(`span`,{className:`text-xs text-muted`,children:[i,` `,i===1?`session`:`sessions`]})}),(0,G.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2.5`,children:[y&&e&&(0,G.jsxs)(`span`,{className:`${QW} cursor-default`,children:[(0,G.jsx)(`span`,{"aria-hidden":!0,className:`h-1.5 w-1.5 rounded-full bg-accent`}),`Selection ready`,(0,G.jsxs)(`button`,{type:`button`,onClick:b,className:`flex h-5 items-center gap-1 rounded px-1 font-medium text-accent hover:text-primary`,"aria-label":`Copy selection`,children:[(0,G.jsx)(ue,{width:12,height:12}),`Copy`]}),(0,G.jsx)(`button`,{type:`button`,onClick:S,className:`flex h-5 w-5 items-center justify-center rounded text-muted hover:text-primary`,title:`Dismiss`,"aria-label":`Dismiss`,children:(0,G.jsx)(We,{width:12,height:12})})]}),g&&e?(0,G.jsxs)(`button`,{type:`button`,onClick:v,className:QW,title:`Exit tmux copy mode and return to live output`,"aria-label":`Exit copy mode`,children:[(0,G.jsx)(`span`,{"aria-hidden":!0,className:`h-1.5 w-1.5 rounded-full bg-amber-400`}),`Copy mode`,(0,G.jsx)(`span`,{"aria-hidden":!0,className:`text-muted`,children:`·`}),(0,G.jsx)(`span`,{className:`font-medium text-amber-400`,children:`Exit`})]}):_&&e?(0,G.jsxs)(`button`,{type:`button`,onClick:v,className:QW,title:`Scroll to bottom`,"aria-label":`Scroll to bottom`,children:[(0,G.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:`14`,height:`14`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2.5`,strokeLinecap:`round`,strokeLinejoin:`round`,children:(0,G.jsx)(`path`,{d:`M12 5v14M5 12l7 7 7-7`})}),`Jump to bottom`]}):null,ne&&(0,G.jsx)(nG,{}),a!==`connected`&&(0,G.jsx)(`span`,{className:`text-xs text-approval`,children:a}),t&&(0,G.jsx)(`button`,{type:`button`,onClick:f,className:`${ZW} border border-border bg-surface text-secondary hover:bg-hover hover:text-primary`,children:`Wake`}),e&&c&&(0,G.jsx)(`button`,{onClick:d,className:`${$W} border border-border text-secondary hover:bg-hover hover:text-primary`,title:`Hibernate session`,"aria-label":`Hibernate session`,children:(0,G.jsx)(Oe,{width:16,height:16})}),e&&s&&(0,G.jsx)(`button`,{disabled:o,onClick:u,className:`${$W} border border-danger/30 bg-danger/10 text-danger hover:bg-danger/20`,title:`Kill session (${l}X)`,"aria-label":`Kill session`,children:(0,G.jsx)(We,{width:16,height:16})})]}),T&&W.length>0&&(0,G.jsx)(XW,{anchor:T,items:W,anchorFromBottom:!0,onClose:()=>E(null)})]})}function oG(e,t){let n=(0,x.useRef)(!1);return(0,x.useEffect)(()=>{if(n.current=!1,t||typeof document>`u`)return;let e=document,r=window,i=e=>{e.key===`Shift`&&(n.current=!0)},a=e=>{e.key===`Shift`&&(n.current=!1)},o=()=>{n.current=!1},s=()=>{e.visibilityState===`hidden`&&o()};return e.addEventListener(`keydown`,i,!0),e.addEventListener(`keyup`,a,!0),e.addEventListener(`focusout`,o,!0),e.addEventListener(`visibilitychange`,s),r.addEventListener(`blur`,o),()=>{o(),e.removeEventListener(`keydown`,i,!0),e.removeEventListener(`keyup`,a,!0),e.removeEventListener(`focusout`,o,!0),e.removeEventListener(`visibilitychange`,s),r.removeEventListener(`blur`,o)}},[e,t]),n}var sG={up:`\x1B[A`,down:`\x1B[B`,left:`\x1B[D`,right:`\x1B[C`},cG={up:`\x1B[1;2A`,down:`\x1B[1;2B`,left:`\x1B[1;2D`,right:`\x1B[1;2C`},lG=44,uG=6,dG=8,fG=10,pG=8,mG=700;3*lG+2*uG+2*dG,2*lG+uG+2*dG;var hG={up:`↑`,down:`↓`,left:`←`,right:`→`},gG={up:`1 / 2 / 2 / 3`,left:`2 / 1 / 3 / 2`,down:`2 / 2 / 3 / 3`,right:`2 / 3 / 3 / 4`};function _G(e=10){typeof navigator<`u`&&`vibrate`in navigator&&navigator.vibrate(e)}function vG(e,t){let n=e.left-t.left+e.width/2,r=pG+160/2,i=t.width-pG-160/2;return r>i?t.width/2:Math.max(r,Math.min(i,n))}function yG({onSendKey:e,disabled:t=!1,onRefocus:n,isKeyboardVisible:r,sessionKey:i=null}){let[a,o]=(0,x.useState)(!1),[s,c]=(0,x.useState)(0),[l,u]=(0,x.useState)(null),d=(0,x.useId)(),f=oG(i,t),p=(0,x.useRef)(null),m=(0,x.useRef)(!1),h=(0,x.useRef)(null),g=(0,x.useRef)(null),_=(0,x.useRef)(null),v=(0,x.useRef)(null),y=(0,x.useRef)(0),b=(0,x.useRef)(e),S=(0,x.useRef)(t);b.current=e,S.current=t;let C=(0,x.useCallback)(()=>{h.current&&=(clearTimeout(h.current),null),g.current&&=(clearInterval(g.current),null),_.current=null,v.current=null},[]),w=(0,x.useCallback)(()=>{C(),u(null)},[C]),T=(0,x.useCallback)(()=>{w(),o(!1),m.current&&n?.()},[w,n]),E=(0,x.useCallback)(()=>{let e=p.current,t=e?.getBoundingClientRect?.(),n=e?.closest?.(`.terminal-controls`)?.getBoundingClientRect?.();if(!t||!n){c(160/2+pG);return}c(vG(t,n))},[]),D=(0,x.useCallback)(()=>{m.current=r?.()??!1,E(),o(!0)},[r,E]),O=(0,x.useCallback)(()=>{t||(_G(),a?T():D())},[t,a,T,D]),k=(0,x.useCallback)(e=>{e.preventDefault(),y.current=Date.now(),O()},[O]),A=(0,x.useCallback)(()=>Date.now()-y.current<mG,[]),j=(0,x.useCallback)(e=>{A()||O()},[A,O]),M=(0,x.useCallback)(e=>{if(S.current)return;let t=f.current?cG:sG;b.current(t[e])},[f]),N=(0,x.useCallback)(e=>{C(),_.current=e,u(e),_G(8),M(e),h.current=setTimeout(()=>{g.current=setInterval(()=>{_.current===e&&(_G(5),M(e))},100)},400)},[C,M]),P=(0,x.useCallback)(e=>n=>{t||(n.preventDefault(),v.current===null&&(n.currentTarget.setPointerCapture?.(n.pointerId),y.current=Date.now(),N(e),v.current=n.pointerId))},[t,N]),F=(0,x.useCallback)(e=>{e.preventDefault(),!(v.current!==null&&e.pointerId!==v.current)&&w()},[w]),I=(0,x.useCallback)(e=>n=>{t||A()||(_G(8),M(e))},[t,A,M]),L=(0,x.useCallback)(e=>{e.preventDefault(),T()},[T]);(0,x.useEffect)(()=>{t&&a&&T()},[t,a,T]);let ee=(0,x.useRef)(i);return(0,x.useEffect)(()=>{ee.current!==i&&(ee.current=i,w())},[i,w]),(0,x.useEffect)(()=>{if(!a)return;let e=p.current?.parentElement;if(e?.addEventListener)return e.addEventListener(`scroll`,E,{passive:!0}),()=>e.removeEventListener(`scroll`,E)},[a,E]),(0,x.useEffect)(()=>C,[C]),(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`button`,{ref:p,type:`button`,"aria-label":`Arrow keys`,"aria-haspopup":`true`,"aria-expanded":a,"aria-controls":a?d:void 0,className:`
|
|
210
|
+
`,h=document.createElement(`div`),m.appendChild(h),g=document.createElement(`div`),g.style.color=`var(--text-muted)`,g.style.marginTop=`2px`,g.style.fontSize=`11px`,m.appendChild(g),O.current=m);let x=(e,t)=>{if(!r.element||!m||!h||!g)return;let n=hW(t);if(!n)return;let i=r.element.getBoundingClientRect(),a=n.length>60?n.slice(0,57)+`...`:n;h.textContent=a,g.textContent=`${gW()?`⌘`:`Ctrl`}+click to open`,m.style.left=`${e.clientX-i.left+10}px`,m.style.top=`${e.clientY-i.top+10}px`,m.style.display=`block`},M=()=>{m&&(m.style.display=`none`)},P=null,L=!1,R=null,B={activate:(e,t)=>{if(!L&&(e.metaKey||e.ctrlKey)){let e=hW(t);if(!e)return;window.open(e,`_blank`,`noopener`)}},hover:(e,t)=>{P=hW(t)||null,x(e,t)},leave:()=>{P=null,M()}},ee=e=>{P&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),e.stopPropagation(),L=!0,window.open(P,`_blank`,`noopener`),R&&clearTimeout(R),R=setTimeout(()=>{L=!1},100))};t.addEventListener(`mousedown`,ee,!0),r.options.linkHandler=B;let H=new _V((e,t)=>B.activate(e,t),{urlRegex:dW,hover:(e,t)=>B.hover(e,t),leave:()=>B.leave()});r.loadAddon(H),D.current=H;let te=null,re=null,ie=gW()?`metaKey`:`ctrlKey`,ae=(e,t)=>{t&&W.current===e&&oe.current===e&&(I.current&&(de.current({type:`tmux-cancel-copy-mode`,sessionId:e}),Oe(!1)),de.current({type:`terminal-input`,sessionId:e,data:t}))};r.attachCustomKeyEventHandler(e=>{if(e.type===`keydown`&&/^Digit[1-9]$/.test(e.code)&&Ze(e,Je(U.getState().shortcutModifier)))return!1;if((e.ctrlKey||e.metaKey)&&e.key.toLowerCase()===`c`&&r.hasSelection()){let e=r.getSelection();return e?.trim()&&navigator.clipboard&&navigator.clipboard.writeText(e),!1}if(gW()&&!b&&e.ctrlKey&&!e.metaKey&&e.key.toLowerCase()===`v`&&e.type===`keydown`){let e=oe.current;if(e){if(!y())return v.current?.(`Use browser paste or choose a file from this device.`),!1;I.current&&(de.current({type:`tmux-cancel-copy-mode`,sessionId:e}),Oe(!1)),(async()=>{ae(e,await CW(fe.current,{}))})()}return!e}if(e[ie]&&e.key.toLowerCase()===`v`&&e.type===`keydown`){re!==null&&(clearTimeout(re),re=null),te=null;let e=new Promise(e=>{re=setTimeout(()=>{re=null,te=null,e(null)},100),te=t=>{re!==null&&(clearTimeout(re),re=null),e(t)}});return(async()=>{try{let t=oe.current;if(!t)return;let n=await e;if(!n&&_.current)return;let r=n?.text??null;if(r===null)try{r=await navigator.clipboard.readText()}catch{r=``}if(n?.files.length&&_.current){if(W.current===t&&oe.current===t){let e=n.files.map(e=>e.name).join(`
|
|
211
|
+
`);_.current({files:n.files,text:r.trim()===e?``:r})}return}if(n?.hasImage&&gW()&&!b){if(!y()){if(n.imageBlob){let e=n.imageBlob;_.current?.({text:``,files:[new File([e],`clipboard.${e.type.split(`/`)[1]||`png`}`,{type:e.type})]})}else v.current?.(`The browser did not provide image data. Choose the file to upload it.`);return}ae(t,await CW(fe.current,{blob:n.imageBlob}));return}if(n?.hasFiles&&!y()){v.current?.(`The browser did not provide file data. Drop the file onto the terminal or choose it to upload.`);return}if((!r||n?.hasFiles)&&gW()&&!b&&y())try{let e=await fetch(`/api/clipboard-file-path`);if(e.ok){let{path:n,isImage:r}=await e.json();if(n){if(r){ae(t,await CW(fe.current,{path:n}));return}ae(t,QU(n)+` `);return}}}catch{}if(r&&!TW(r)){W.current===t&&oe.current===t&&(I.current&&(de.current({type:`tmux-cancel-copy-mode`,sessionId:t}),Oe(!1)),de.current({type:`terminal-paste`,sessionId:t,data:r}));return}gW()&&!b&&y()&&ae(t,await CW(fe.current,{}))}finally{te=null}})(),!!_.current&&ie===`metaKey`}if(e.ctrlKey&&e.key===`Backspace`&&e.type===`keydown`){let e=oe.current;return e&&de.current({type:`terminal-input`,sessionId:e,data:``}),!1}return!0});let se=e=>{if(!te){let t=nW(e.clipboardData),n=e.clipboardData?.getData(`text/plain`)??``;if(!t.length&&!n||!_.current)return;if(e.preventDefault(),e.stopPropagation(),oe.current&&oe.current===W.current){let e=t.map(e=>e.name).join(`
|
|
212
|
+
`);_.current({text:t.length&&n.trim()===e?``:n,files:t})}return}e.preventDefault(),e.stopPropagation();let t=e.clipboardData?.getData(`text/plain`)??``,n=DW(e.clipboardData),r=n!==null||EW(e.clipboardData),i=te;te=null,i({text:t,hasImage:r,hasFiles:(e.clipboardData?.files?.length??0)>0||Array.from(e.clipboardData?.items??[]).some(e=>e.kind===`file`)||Array.from(e.clipboardData?.types??[]).includes(`Files`),imageBlob:n,files:nW(e.clipboardData)})};return t.addEventListener(`paste`,se,{capture:!0}),r.onData(e=>{let t=oe.current;if(t){let n=/^\x1b\[(<[\d;]+[Mm]|[\d;]+M|M[\x20-\xff]{3})$/.test(e);if(I.current&&n)return;I.current&&(de.current({type:`tmux-cancel-copy-mode`,sessionId:t}),Oe(!1)),de.current({type:`terminal-input`,sessionId:t,data:e})}}),r.attachCustomWheelEventHandler(e=>{let t=oe.current;if(!t||e.target?.closest(`input, textarea, [contenteditable="true"], .xterm-hover`)||r.hasSelection()||e.shiftKey)return!0;F.current+=e.deltaY;let n=r.cols,i=r.rows,a=Math.floor(n/2),o=Math.floor(i/2),s=!1,c=!1;for(;Math.abs(F.current)>=30;){c=!0;let e=F.current>0;F.current+=e?-30:30;let n=e?65:64;e||(s=!0),de.current({type:`terminal-input`,sessionId:t,data:`\x1b[<${n};${a};${o}M`})}return s&&!z.current&&Oe(!0),c&&!z.current&&ke(),!1}),C.current=r,T.current=i,()=>{if(n=!0,R&&clearTimeout(R),P=null,t.removeEventListener(`mousedown`,ee,!0),t.removeEventListener(`paste`,se,!0),re!==null&&(clearTimeout(re),re=null),te=null,O.current&&=(O.current.remove(),null),D.current){try{D.current.dispose()}catch{}D.current=null}if(E.current){try{E.current.dispose()}catch{}E.current=null}try{r.dispose()}catch{}t&&(t.innerHTML=``),C.current=null,T.current=null,k.current=null,A.current=null,j.current=null,N.current&&window.clearTimeout(N.current),V.current!==null&&window.clearTimeout(V.current)}},[Ae]),(0,x.useEffect)(()=>{C.current&&(C.current.options.theme=c)},[c]),(0,x.useEffect)(()=>{let e=C.current,t=T.current;if(e&&t){e.options.fontFamily=f,e.options.fontSize=l,e.options.lineHeight=Math.round(l*u)/l,e.options.letterSpacing=d,t.fit();let n=W.current;n&&de.current({type:`terminal-resize`,sessionId:n,cols:e.cols,rows:e.rows})}},[l,u,d,f]),(0,x.useEffect)(()=>{let e=C.current;if(!e)return;let t=me.current;if(me.current=p,t!==p){if(p){if(!E.current)try{let t=new dV;t.onContextLoss(()=>{try{t.dispose()}catch{}E.current=null}),e.loadAddon(t),E.current=t}catch{}}else if(E.current){try{E.current.dispose()}catch{}E.current=null}}},[p]),(0,x.useLayoutEffect)(()=>{(oe.current!==e||!r||i!==`connected`||ce.current>=0&&ce.current!==a)&&(oe.current=null,e&&r&&i===`connected`&&xe(!0))},[e,r,i,a]),(0,x.useEffect)(()=>{let n=C.current;if(!n)return;let o=W.current,s=se.current;if(!r){oe.current=null,P.current!==null&&(window.clearTimeout(P.current),P.current=null),o&&(de.current({type:`terminal-detach`,sessionId:o}),W.current=null,se.current=null,ce.current=-1,le.current=null,Oe(!1)),n.reset(),ye.current=!1,xe(!1);return}if(i!==`connected`){oe.current=null,P.current!==null&&(window.clearTimeout(P.current),P.current=null),o&&(XD(`terminal_detach_on_disconnect`,{connectionStatus:i,prevAttached:o}),W.current=null,se.current=null,ce.current=-1,le.current=null,Oe(!1)),uW(),ye.current=!1,xe(!1);return}if(o&&o!==e){oe.current=null;try{let e=A.current?.serialize();if(e&&(sW.set(o,e),sW.size>cW)){let e=sW.keys().next().value;e&&sW.delete(e)}}catch{}de.current({type:`terminal-detach`,sessionId:o}),W.current=null,se.current=null,ce.current=-1,le.current=null,Oe(!1)}let c=ce.current,l=a!==c;if(e&&(e!==o||t!==s||l)){XD(`terminal_attach`,{sessionId:e,tmuxTarget:t,prevAttached:o,prevTarget:s,connectionStatus:i,connectionEpoch:a,attachedEpoch:c});let r=performance.now();he.current=[],ge.current!==null&&(window.clearTimeout(ge.current),ge.current=null),_e.current!==null&&(window.clearTimeout(_e.current),_e.current=null),ye.current=!0,xe(!0),o!==null&&(oe.current=null);let l=sW.get(e);l&&(n.reset(),n.write(l));let u=T.current;u&&u.fit();let d=performance.now();W.current=e,se.current=t??null,ce.current=a,le.current=e,ue.current=r,P.current!==null&&(window.clearTimeout(P.current),P.current=null);let f={type:`terminal-attach`,sessionId:e,tmuxTarget:t??void 0,cols:n.cols,rows:n.rows},p=o!==null&&o!==e;if(p){let t=e;queueMicrotask(()=>{W.current===t&&(de.current(f),de.current({type:`tmux-check-copy-mode`,sessionId:e}))})}else P.current=window.setTimeout(()=>{P.current=null,de.current(f),de.current({type:`tmux-check-copy-mode`,sessionId:e})},50);XD(`switch_attach_sent`,{sessionId:e,fitMs:Math.round(d-r),totalMs:Math.round(performance.now()-r),from:o??null,immediate:p})}return e&&e===o&&t===s&&!l&&XD(`terminal_attach_skip`,{sessionId:e,prevAttached:o,connectionStatus:i,connectionEpoch:a,attachedEpoch:c}),!e&&o&&(P.current!==null&&(window.clearTimeout(P.current),P.current=null),W.current=null,se.current=null,ce.current=-1,le.current=null,oe.current=null),()=>{P.current!==null&&(XD(`attach_debounce_cancelled`,{sessionId:e,attachedSession:W.current},`info`),window.clearTimeout(P.current),P.current=null)}},[e,t,r,i,a,De,Oe]),(0,x.useEffect)(()=>{if(ae.current!==null&&(globalThis.clearInterval(ae.current),ae.current=null),!(!e||!r||i!==`connected`))return ae.current=globalThis.setInterval(()=>{W.current===e&&de.current({type:`tmux-check-copy-mode`,sessionId:e})},750),()=>{ae.current!==null&&(globalThis.clearInterval(ae.current),ae.current=null)}},[e,r,i]),(0,x.useEffect)(()=>{let e=()=>{ge.current!==null&&(window.clearTimeout(ge.current),ge.current=null),_e.current!==null&&(window.clearTimeout(_e.current),_e.current=null);let e=C.current,t=he.current;if(!e||t.length===0)return;he.current=[];let n=t.join(``);ye.current&&=(e.reset(),!1);let r=performance.now(),i=n.length;e.write(n,()=>{let e=Math.round(performance.now()-r);e>50&&XD(`switch_write_slow`,{sessionId:W.current,writeMs:e,bytes:i}),b&&e>50&&XD(`ios_write_slow`,{sessionId:W.current,writeMs:e,bytes:i}),De()})},t=()=>{ge.current!==null&&window.clearTimeout(ge.current),ge.current=window.setTimeout(e,2),_e.current===null&&(_e.current=window.setTimeout(e,16))},n=()=>{let e=ve.current;e.timer=null,e.count!==0&&(XD(`terminal_output_dropped`,{messageSessionId:e.lastMessageSessionId,attachedSession:W.current,drops:e.count,bytes:e.bytes,hasSwitchStart:ue.current!==null},`info`),e.count=0,e.bytes=0,e.lastEmit=performance.now())},r=s(r=>{let i=W.current;if(r.type===`terminal-output`&&(!i||r.sessionId!==i)){let e=ve.current;e.count+=1,e.bytes+=r.data.length,e.lastMessageSessionId=r.sessionId;let t=performance.now();t-e.lastEmit>=1e3?n():e.timer===null&&(e.timer=window.setTimeout(n,1e3-(t-e.lastEmit)))}if(r.type===`terminal-output`&&i&&r.sessionId===i){let e=ue.current;e&&(XD(`switch_first_output`,{sessionId:r.sessionId,serverRoundtripMs:Math.round(performance.now()-e),bytes:r.data.length,parseMs:r._parseMs??-1,rawLength:r._rawLength??-1}),ue.current=null),he.current.push(b?MW(r.data):r.data),t()}if(r.type===`terminal-ready`&&i&&r.sessionId===i){oe.current=r.sessionId,ye.current&&he.current.length>0?e():ye.current&&=(C.current?.reset(),!1),xe(!1);let t=ue.current;t&&(XD(`switch_ready`,{sessionId:r.sessionId,totalMs:Math.round(performance.now()-t)}),ue.current=null),le.current===r.sessionId&&(C.current?.focus(),le.current=null),b&&(e(),Ee(50,`terminal-ready`))}if(r.type===`terminal-error`&&i&&(!r.sessionId||r.sessionId===i)&&(oe.current=null,ye.current=!1,xe(!1)),r.type===`clipboard-offer`&&i&&r.sessionId===i){let e=r.text;if(!e?.trim())return;if(!b&&navigator.clipboard?.writeText){let t=performance.now();navigator.clipboard.writeText(e).then(()=>{XD(`clipboard_write_success`,{source:r.source,chars:e.length,durationMs:Math.round(performance.now()-t)})}).catch(t=>{XD(`clipboard_write_failed`,{source:r.source,chars:e.length,error:t instanceof Error?t.message:String(t)},`warn`),ne(e,r.source)})}else ne(e,r.source)}if(r.type===`tmux-copy-mode-status`&&i&&r.sessionId===i){let e=r.appMouse===!0&&!r.inCopyMode,t=z.current;z.current=e,B.current=r.altScreen===!0,!t&&e&&C.current?.write(yW),Oe(r.inCopyMode)}});return()=>{r(),e(),Te(),ve.current.timer!==null&&window.clearTimeout(ve.current.timer),n()}},[s,De,Oe,ne]),(0,x.useEffect)(()=>{let e=S.current,t=C.current,n=T.current;if(!e||!t||!n)return;let r=()=>{M.current&&window.clearTimeout(M.current),M.current=window.setTimeout(()=>{Ae()},150)},i=new ResizeObserver(r);return i.observe(e),r(),()=>{i.disconnect(),M.current&&window.clearTimeout(M.current)}},[]),(0,x.useEffect)(()=>{if(typeof document>`u`||typeof document.addEventListener!=`function`)return;let e=()=>{document.visibilityState!==`hidden`&&XD(`terminal_visibility_resume`,{isiOS:b,hasWebGL:!!E.current,useWebGL:me.current,hasTerminal:!!C.current,bufferLines:C.current?.buffer.active.length??0,sessionId:W.current},`info`)};if(document.addEventListener(`visibilitychange`,e),!b)return()=>{document.removeEventListener(`visibilitychange`,e)};let t=e=>{let t=C.current;if(t&&E.current&&me.current){try{E.current.dispose()}catch{}E.current=null;try{let n=new dV;n.onContextLoss(()=>{XD(`webgl_context_loss`,{sessionId:W.current},`info`);try{n.dispose()}catch{}E.current=null}),t.loadAddon(n),E.current=n,XD(`ios_webgl_recreated`,{trigger:e},`info`)}catch{XD(`ios_webgl_recreate_failed`,{trigger:e},`info`)}}},n=()=>{document.visibilityState!==`hidden`&&(t(`visibilitychange`),Ee(200,`visibilitychange`))},r=e=>{e.persisted&&(t(`pageshow`),Ee(200,`pageshow`))},i=()=>{t(`focus`),Ee(200,`focus`)};return document.addEventListener(`visibilitychange`,n),window.addEventListener(`pageshow`,r),window.addEventListener(`focus`,i),()=>{document.removeEventListener(`visibilitychange`,e),document.removeEventListener(`visibilitychange`,n),window.removeEventListener(`pageshow`,r),window.removeEventListener(`focus`,i),Te()}},[]),{containerRef:S,terminalRef:C,searchAddonRef:k,serializeAddonRef:A,progressAddonRef:j,inTmuxCopyModeRef:I,isTmuxCopyMode:L,appMouseRef:z,setTmuxCopyMode:Oe,isSwitching:be,isInputReady:!!e&&r&&i===`connected`&&oe.current===e,pendingClipboardOffer:H,copyPendingClipboardOffer:re,dismissPendingClipboardOffer:ie}}function PW(e=`(max-width: 767px)`){let[t,n]=(0,x.useState)(()=>typeof window>`u`||!window.matchMedia?!1:window.matchMedia(e).matches);return(0,x.useEffect)(()=>{if(typeof window>`u`||!window.matchMedia)return;let t=window.matchMedia(e),r=()=>n(t.matches);return r(),typeof t.addEventListener==`function`?(t.addEventListener(`change`,r),()=>t.removeEventListener(`change`,r)):(t.addListener(r),()=>t.removeListener(r))},[e]),t}function FW(e,t,n){(0,x.useEffect)(()=>{if(!t)return;let r=t=>{e.current&&!e.current.contains(t.target)&&n()};return document.addEventListener(`mousedown`,r),document.addEventListener(`touchstart`,r),()=>{document.removeEventListener(`mousedown`,r),document.removeEventListener(`touchstart`,r)}},[e,t,n])}function IW(e,t){(0,x.useEffect)(()=>{if(!e)return;let n=e=>{e.key===`Escape`&&(e.preventDefault(),t())};return document.addEventListener(`keydown`,n),()=>document.removeEventListener(`keydown`,n)},[e,t])}function LW({enabled:e,isOpen:t,onOpen:n,edgeThresholdPx:r=30,swipeDistancePx:i=50,swipeRatio:a=1.5}){let o=(0,x.useRef)(!1);return(0,x.useEffect)(()=>{if(!e)return;let s=0,c=0,l=!1,u=e=>{if(t)return;let n=e.touches[0];n.clientX<=r?(s=n.clientX,c=n.clientY,l=!0,o.current=!0):l=!1},d=e=>{if(o.current=!1,!l||t)return;let r=e.changedTouches[0],u=r.clientX-s,d=Math.abs(r.clientY-c);u>=i&&u>d*a&&n(),l=!1};return document.addEventListener(`touchstart`,u,{passive:!0}),document.addEventListener(`touchend`,d,{passive:!0}),()=>{o.current=!1,document.removeEventListener(`touchstart`,u),document.removeEventListener(`touchend`,d)}},[e,t,n,r,i,a]),o}var RW=T()(k(e=>({theme:`dark`,setTheme:t=>e({theme:t}),toggleTheme:()=>e(e=>({theme:e.theme===`dark`?`light`:`dark`}))}),{name:`agentboard-theme`,storage:D(()=>M)})),zW={dark:{background:`#2d2d2d`,foreground:`#d4d4d4`,cursor:`#3b82f6`,cursorAccent:`#2d2d2d`,selectionBackground:`rgba(59, 130, 246, 0.35)`,selectionForeground:`#ffffff`,black:`#808080`,red:`#f87171`,green:`#4ade80`,yellow:`#fbbf24`,blue:`#60a5fa`,magenta:`#c084fc`,cyan:`#22d3ee`,white:`#d4d4d4`,brightBlack:`#a0a0a0`,brightRed:`#fca5a5`,brightGreen:`#86efac`,brightYellow:`#fde047`,brightBlue:`#93c5fd`,brightMagenta:`#d8b4fe`,brightCyan:`#67e8f9`,brightWhite:`#ffffff`},light:{background:`#fafafa`,foreground:`#171717`,cursor:`#2563eb`,cursorAccent:`#fafafa`,selectionBackground:`rgba(37, 99, 235, 0.2)`,selectionForeground:`#000000`,black:`#171717`,red:`#dc2626`,green:`#16a34a`,yellow:`#ca8a04`,blue:`#2563eb`,magenta:`#9333ea`,cyan:`#0891b2`,white:`#f5f5f5`,brightBlack:`#737373`,brightRed:`#ef4444`,brightGreen:`#22c55e`,brightYellow:`#eab308`,brightBlue:`#3b82f6`,brightMagenta:`#a855f7`,brightCyan:`#06b6d4`,brightWhite:`#ffffff`}},BW=new WeakSet;function VW(e,t){let n=Object.getOwnPropertyDescriptor(e,t);return!n?.get||!n.set?null:{get:n.get,set:n.set,enumerable:n.enumerable??!0,configurable:n.configurable??!0}}var HW=!1,UW=null,WW=null;function GW(){HW||(HW=!0,!(typeof Node>`u`||typeof HTMLElement>`u`)&&(UW=VW(Node.prototype,`textContent`),WW=VW(HTMLElement.prototype,`innerText`)))}function KW(e){if(BW.has(e))return;BW.add(e);let t=UW?.get;if(t)for(let[n,r]of[[`textContent`,UW],[`innerText`,WW]])r&&Object.defineProperty(e,n,{configurable:r.configurable,enumerable:r.enumerable,get(){return r.get.call(this)},set(e){t.call(this)!==e&&r.set.call(this,e)}})}function qW(e){GW();let t=()=>{for(let t of Array.from(e.children))t instanceof HTMLElement&&KW(t)};t();let n=new MutationObserver(t);return n.observe(e,{childList:!0}),()=>n.disconnect()}var JW={working:`Working`,waiting:`Waiting`,permission:`Needs Input`,unknown:`Unknown`},YW={working:`text-working`,waiting:`text-waiting`,permission:`text-approval`,unknown:`text-muted`};function XW({anchor:e,items:t,anchorFromBottom:n=!1,onClose:r}){let i=(0,x.useRef)(null);return(0,x.useEffect)(()=>{let e=e=>{i.current&&!i.current.contains(e.target)&&r()},t=e=>{e.key===`Escape`&&r()};return document.addEventListener(`mousedown`,e),document.addEventListener(`touchstart`,e),document.addEventListener(`keydown`,t),()=>{document.removeEventListener(`mousedown`,e),document.removeEventListener(`touchstart`,e),document.removeEventListener(`keydown`,t)}},[r]),(0,G.jsx)(`div`,{ref:i,className:`fixed z-50 min-w-[180px] rounded-md border border-border bg-elevated py-1 shadow-lg`,style:{left:typeof window>`u`?e.x:Math.min(e.x,Math.max(8,window.innerWidth-190)),top:e.y,transform:n?`translateY(calc(-100% - 6px))`:void 0},role:`menu`,children:t.map((e,t)=>e===`divider`?(0,G.jsx)(`div`,{className:`my-1 border-t border-border`},`divider-${t}`):(0,G.jsxs)(`button`,{type:`button`,onClick:t=>{t.stopPropagation(),r(),e.onSelect()},className:`flex w-full items-center gap-2 px-3 py-2 text-left text-sm ${e.danger?`text-danger hover:bg-danger/10`:`text-secondary hover:bg-hover hover:text-primary`}`,role:`menuitem`,title:e.title,children:[e.icon,e.label]},e.key))})}var ZW=`flex h-7 shrink-0 items-center gap-2 rounded-md px-2.5 text-xs font-medium transition-colors active:scale-95`,QW=`flex h-7 shrink-0 items-center gap-2 rounded-md border border-border bg-surface px-2.5 text-xs text-secondary transition-colors hover:bg-hover hover:text-primary`,$W=`flex h-7 w-7 shrink-0 items-center justify-center rounded-md transition-all active:scale-95 disabled:cursor-not-allowed disabled:opacity-40`,eG=`text-[11px]`,tG=`inline-flex shrink-0 items-center rounded-full bg-hover px-1.5 py-0.5 text-[11px] leading-none text-secondary`,nG=()=>(0,G.jsx)(`span`,{"aria-hidden":!0,className:`mx-2 h-5 w-px shrink-0 bg-border`}),rG=`inline-block w-[11ch] shrink-0 whitespace-nowrap text-left text-xs`;function iG(){let[e,t]=(0,x.useState)(!1),n=(0,x.useRef)(null);return(0,x.useEffect)(()=>()=>{n.current&&clearTimeout(n.current)},[]),[e,(0,x.useCallback)(()=>{t(!0),n.current&&clearTimeout(n.current),n.current=setTimeout(()=>t(!1),1500)},[])]}function aG({session:e,hibernatingSession:t,hibernatingDisplayName:n,showHostBadge:r,sessionCount:i,connectionStatus:a,isSwitching:o,canControl:s,canHibernate:c,modDisplay:l,onKill:u,onHibernate:d,onWake:f,onRename:p,onDuplicate:m,onMoveToHistory:h,isTmuxCopyMode:g,showJumpToBottom:_,onJumpToBottom:v,selectionReady:y,onCopySelection:b,onDismissSelection:S}){let C=U(e=>e.showProjectName),w=U(e=>e.showSessionIdPrefix),[T,E]=(0,x.useState)(null),[D,O]=(0,x.useState)(!1),[k,A]=(0,x.useState)(``),j=(0,x.useRef)(null),[M,N]=iG(),[P,F]=iG(),I=e?e.agentSessionName||e.name:``,L=e?I:n,R=e?.projectPath&&Lm(e.projectPath)!==I?Lm(e.projectPath):``,z=t?.projectPath&&Lm(t.projectPath)!==n?Lm(t.projectPath):``,B=e?.agentSessionId?.trim(),V=w&&B?zm(B):null,ee=!!V||r&&!!e?.host?.trim()||C&&!!R,H=r&&!!t?.host?.trim()||C&&!!z,te=y&&!!e||g&&!!e||_&&!!e;(0,x.useEffect)(()=>{D&&j.current&&(j.current.focus(),j.current.select())},[D]),(0,x.useEffect)(()=>{O(!1)},[e?.id??t?.sessionId??null]);let ne=(0,x.useCallback)(()=>{A(L),O(!0)},[L]),re=(0,x.useCallback)(()=>{let e=k.trim();e&&e!==L&&p(e),O(!1)},[k,L,p]),ie=e=>{e.preventDefault(),e.stopPropagation(),E({x:e.clientX,y:e.clientY})},ae=[];e?(ae.push({key:`rename`,label:`Rename`,icon:(0,G.jsx)(ge,{width:14,height:14}),onSelect:ne},...m?[{key:`duplicate`,label:`Duplicate`,icon:(0,G.jsx)(ue,{width:14,height:14}),title:`Create a copy in a new tmux window`,onSelect:m}]:[],...c?[{key:`hibernate`,label:`Hibernate`,icon:(0,G.jsx)(Oe,{width:14,height:14}),title:`Close the live window and keep this session ready to wake`,onSelect:d}]:[],...B?[{key:`copy-id`,label:`Copy Session ID`,icon:(0,G.jsx)(we,{width:14,height:14}),title:B,onSelect:()=>Bm(B)}]:[],...e.logFilePath?[{key:`copy-log`,label:`Copy Log Path`,icon:(0,G.jsx)(ve,{width:14,height:14}),title:e.logFilePath,onSelect:()=>Bm(e.logFilePath)}]:[]),s&&ae.push(`divider`,{key:`kill`,label:`Kill Session`,icon:(0,G.jsx)(We,{width:14,height:14}),danger:!0,onSelect:u})):t&&(ae.push({key:`wake`,label:`Wake`,icon:(0,G.jsx)(Me,{width:14,height:14}),onSelect:f},{key:`rename`,label:`Rename`,icon:(0,G.jsx)(ge,{width:14,height:14}),onSelect:ne},{key:`copy-id`,label:`Copy Session ID`,icon:(0,G.jsx)(we,{width:14,height:14}),title:t.sessionId,onSelect:()=>Bm(t.sessionId)},...t.logFilePath?[{key:`copy-log`,label:`Copy Log Path`,icon:(0,G.jsx)(ve,{width:14,height:14}),title:t.logFilePath,onSelect:()=>Bm(t.logFilePath)}]:[]),h&&ae.push(`divider`,{key:`move-to-history`,label:`Move to History`,icon:(0,G.jsx)(We,{width:14,height:14}),onSelect:h}));let W=(0,G.jsx)(`input`,{ref:j,type:`text`,value:k,onChange:e=>A(e.target.value),onBlur:re,onKeyDown:e=>{e.key===`Enter`?(e.preventDefault(),re()):e.key===`Escape`&&O(!1)},onClick:e=>e.stopPropagation(),onContextMenu:e=>e.stopPropagation(),className:`w-40 max-w-48 select-text rounded border border-border bg-surface px-1.5 py-0.5 text-sm font-medium text-primary outline-none focus:border-accent`,"aria-label":`Rename session`}),oe=(e,t)=>P?(0,G.jsx)(`span`,{className:tG,children:`Copied!`}):(0,G.jsx)(`button`,{type:`button`,onClick:()=>{Bm(t),F()},className:`shrink-0 cursor-pointer`,title:t,"aria-label":`Copy project path ${t}`,children:(0,G.jsx)(Ng,{name:e,fullPath:t,className:eG})});return(0,G.jsxs)(`footer`,{className:`hidden h-10 shrink-0 select-none items-center justify-between gap-3 border-t border-border bg-elevated px-4 md:flex`,children:[(0,G.jsx)(`div`,{className:`flex min-w-0 flex-1 items-center`,children:e?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(`div`,{className:`flex min-w-0 items-center`,onContextMenu:ie,children:[D?W:(0,G.jsx)(`span`,{className:`max-w-48 truncate text-sm font-medium text-primary`,children:I}),(0,G.jsx)(nG,{}),(0,G.jsx)(`span`,{className:`${rG} ${YW[e.status]}`,children:JW[e.status]}),ee&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(nG,{}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2.5`,children:[V&&(0,G.jsx)(`button`,{type:`button`,onClick:()=>{Bm(B),N()},className:`shrink-0 cursor-pointer text-xs text-muted transition-colors hover:text-primary`,title:`${B} — click to copy`,"aria-label":`Copy session ID`,children:M?`Copied!`:V}),r&&e.host?.trim()&&(0,G.jsx)(n_,{name:e.host.trim(),className:eG}),C&&R&&oe(R,e.projectPath)]})]})]}),e.prs&&e.prs.length>0&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(nG,{}),(0,G.jsx)(e_,{prs:e.prs,className:`min-w-0 flex-1`})]})]}):t?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(`div`,{className:`flex min-w-0 items-center`,onContextMenu:ie,children:[D?W:(0,G.jsx)(`span`,{className:`max-w-48 truncate text-sm font-medium text-primary`,children:n}),(0,G.jsx)(nG,{}),(0,G.jsx)(`span`,{className:`shrink-0 rounded-full bg-blue-500/15 px-1.5 py-0.5 text-[10px] font-semibold uppercase tracking-wide text-blue-400`,children:`Hibernating`}),H&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(nG,{}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2.5`,children:[r&&t.host?.trim()&&(0,G.jsx)(n_,{name:t.host.trim(),className:eG}),C&&z&&oe(z,t.projectPath)]})]})]}),t.prs&&t.prs.length>0&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(nG,{}),(0,G.jsx)(e_,{prs:t.prs,className:`min-w-0 flex-1`})]})]}):(0,G.jsxs)(`span`,{className:`text-xs text-muted`,children:[i,` `,i===1?`session`:`sessions`]})}),(0,G.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2.5`,children:[y&&e&&(0,G.jsxs)(`span`,{className:`${QW} cursor-default`,children:[(0,G.jsx)(`span`,{"aria-hidden":!0,className:`h-1.5 w-1.5 rounded-full bg-accent`}),`Selection ready`,(0,G.jsxs)(`button`,{type:`button`,onClick:b,className:`flex h-5 items-center gap-1 rounded px-1 font-medium text-accent hover:text-primary`,"aria-label":`Copy selection`,children:[(0,G.jsx)(ue,{width:12,height:12}),`Copy`]}),(0,G.jsx)(`button`,{type:`button`,onClick:S,className:`flex h-5 w-5 items-center justify-center rounded text-muted hover:text-primary`,title:`Dismiss`,"aria-label":`Dismiss`,children:(0,G.jsx)(We,{width:12,height:12})})]}),g&&e?(0,G.jsxs)(`button`,{type:`button`,onClick:v,className:QW,title:`Exit tmux copy mode and return to live output`,"aria-label":`Exit copy mode`,children:[(0,G.jsx)(`span`,{"aria-hidden":!0,className:`h-1.5 w-1.5 rounded-full bg-amber-400`}),`Copy mode`,(0,G.jsx)(`span`,{"aria-hidden":!0,className:`text-muted`,children:`·`}),(0,G.jsx)(`span`,{className:`font-medium text-amber-400`,children:`Exit`})]}):_&&e?(0,G.jsxs)(`button`,{type:`button`,onClick:v,className:QW,title:`Scroll to bottom`,"aria-label":`Scroll to bottom`,children:[(0,G.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:`14`,height:`14`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2.5`,strokeLinecap:`round`,strokeLinejoin:`round`,children:(0,G.jsx)(`path`,{d:`M12 5v14M5 12l7 7 7-7`})}),`Jump to bottom`]}):null,te&&(0,G.jsx)(nG,{}),a!==`connected`&&(0,G.jsx)(`span`,{className:`text-xs text-approval`,children:a}),t&&(0,G.jsx)(`button`,{type:`button`,onClick:f,className:`${ZW} border border-border bg-surface text-secondary hover:bg-hover hover:text-primary`,children:`Wake`}),e&&c&&(0,G.jsx)(`button`,{onClick:d,className:`${$W} border border-border text-secondary hover:bg-hover hover:text-primary`,title:`Hibernate session`,"aria-label":`Hibernate session`,children:(0,G.jsx)(Oe,{width:16,height:16})}),e&&s&&(0,G.jsx)(`button`,{disabled:o,onClick:u,className:`${$W} border border-danger/30 bg-danger/10 text-danger hover:bg-danger/20`,title:`Kill session (${l}X)`,"aria-label":`Kill session`,children:(0,G.jsx)(We,{width:16,height:16})})]}),T&&ae.length>0&&(0,G.jsx)(XW,{anchor:T,items:ae,anchorFromBottom:!0,onClose:()=>E(null)})]})}function oG(e,t){let n=(0,x.useRef)(!1);return(0,x.useEffect)(()=>{if(n.current=!1,t||typeof document>`u`)return;let e=document,r=window,i=e=>{e.key===`Shift`&&(n.current=!0)},a=e=>{e.key===`Shift`&&(n.current=!1)},o=()=>{n.current=!1},s=()=>{e.visibilityState===`hidden`&&o()};return e.addEventListener(`keydown`,i,!0),e.addEventListener(`keyup`,a,!0),e.addEventListener(`focusout`,o,!0),e.addEventListener(`visibilitychange`,s),r.addEventListener(`blur`,o),()=>{o(),e.removeEventListener(`keydown`,i,!0),e.removeEventListener(`keyup`,a,!0),e.removeEventListener(`focusout`,o,!0),e.removeEventListener(`visibilitychange`,s),r.removeEventListener(`blur`,o)}},[e,t]),n}var sG={up:`\x1B[A`,down:`\x1B[B`,left:`\x1B[D`,right:`\x1B[C`},cG={up:`\x1B[1;2A`,down:`\x1B[1;2B`,left:`\x1B[1;2D`,right:`\x1B[1;2C`},lG=44,uG=6,dG=8,fG=10,pG=8,mG=700;3*lG+2*uG+2*dG,2*lG+uG+2*dG;var hG={up:`↑`,down:`↓`,left:`←`,right:`→`},gG={up:`1 / 2 / 2 / 3`,left:`2 / 1 / 3 / 2`,down:`2 / 2 / 3 / 3`,right:`2 / 3 / 3 / 4`};function _G(e=10){typeof navigator<`u`&&`vibrate`in navigator&&navigator.vibrate(e)}function vG(e,t){let n=e.left-t.left+e.width/2,r=pG+160/2,i=t.width-pG-160/2;return r>i?t.width/2:Math.max(r,Math.min(i,n))}function yG({onSendKey:e,disabled:t=!1,onRefocus:n,isKeyboardVisible:r,sessionKey:i=null}){let[a,o]=(0,x.useState)(!1),[s,c]=(0,x.useState)(0),[l,u]=(0,x.useState)(null),d=(0,x.useId)(),f=oG(i,t),p=(0,x.useRef)(null),m=(0,x.useRef)(!1),h=(0,x.useRef)(null),g=(0,x.useRef)(null),_=(0,x.useRef)(null),v=(0,x.useRef)(null),y=(0,x.useRef)(0),b=(0,x.useRef)(e),S=(0,x.useRef)(t);b.current=e,S.current=t;let C=(0,x.useCallback)(()=>{h.current&&=(clearTimeout(h.current),null),g.current&&=(clearInterval(g.current),null),_.current=null,v.current=null},[]),w=(0,x.useCallback)(()=>{C(),u(null)},[C]),T=(0,x.useCallback)(()=>{w(),o(!1),m.current&&n?.()},[w,n]),E=(0,x.useCallback)(()=>{let e=p.current,t=e?.getBoundingClientRect?.(),n=e?.closest?.(`.terminal-controls`)?.getBoundingClientRect?.();if(!t||!n){c(160/2+pG);return}c(vG(t,n))},[]),D=(0,x.useCallback)(()=>{m.current=r?.()??!1,E(),o(!0)},[r,E]),O=(0,x.useCallback)(()=>{t||(_G(),a?T():D())},[t,a,T,D]),k=(0,x.useCallback)(e=>{e.preventDefault(),y.current=Date.now(),O()},[O]),A=(0,x.useCallback)(()=>Date.now()-y.current<mG,[]),j=(0,x.useCallback)(e=>{A()||O()},[A,O]),M=(0,x.useCallback)(e=>{if(S.current)return;let t=f.current?cG:sG;b.current(t[e])},[f]),N=(0,x.useCallback)(e=>{C(),_.current=e,u(e),_G(8),M(e),h.current=setTimeout(()=>{g.current=setInterval(()=>{_.current===e&&(_G(5),M(e))},100)},400)},[C,M]),P=(0,x.useCallback)(e=>n=>{t||(n.preventDefault(),v.current===null&&(n.currentTarget.setPointerCapture?.(n.pointerId),y.current=Date.now(),N(e),v.current=n.pointerId))},[t,N]),F=(0,x.useCallback)(e=>{e.preventDefault(),!(v.current!==null&&e.pointerId!==v.current)&&w()},[w]),I=(0,x.useCallback)(e=>n=>{t||A()||(_G(8),M(e))},[t,A,M]),L=(0,x.useCallback)(e=>{e.preventDefault(),T()},[T]);(0,x.useEffect)(()=>{t&&a&&T()},[t,a,T]);let R=(0,x.useRef)(i);return(0,x.useEffect)(()=>{R.current!==i&&(R.current=i,w())},[i,w]),(0,x.useEffect)(()=>{if(!a)return;let e=p.current?.parentElement;if(e?.addEventListener)return e.addEventListener(`scroll`,E,{passive:!0}),()=>e.removeEventListener(`scroll`,E)},[a,E]),(0,x.useEffect)(()=>C,[C]),(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`button`,{ref:p,type:`button`,"aria-label":`Arrow keys`,"aria-haspopup":`true`,"aria-expanded":a,"aria-controls":a?d:void 0,className:`
|
|
213
213
|
terminal-key
|
|
214
214
|
flex items-center justify-center
|
|
215
215
|
size-[44px] p-0
|
|
@@ -244,7 +244,7 @@ ${s.join(`
|
|
|
244
244
|
transition-all duration-75
|
|
245
245
|
${o===e?`bg-accent text-white scale-110`:`bg-white/90 text-gray-800`}
|
|
246
246
|
`,style:{width:xG,height:SG,WebkitUserSelect:`none`,userSelect:`none`},children:e},t):(0,G.jsx)(`div`,{style:{width:xG,height:SG}},t))}),(0,G.jsx)(`div`,{className:`text-center text-white text-sm font-medium select-none`,style:{marginTop:CG+2,height:20},children:o?`Release to send "${o}"`:`\xA0`})]})})]})]})}function PG({state:e,cancel:t,retry:n,paste:r,allowFiles:i}){return e.status===`idle`?null:e.status===`awaiting-paste`?(0,G.jsx)(FG,{cancel:t,paste:r,allowFiles:i}):(0,G.jsxs)(`div`,{className:`flex items-center gap-3 border-t border-border bg-elevated px-3 py-2 text-sm text-primary`,children:[(0,G.jsx)(`span`,{role:e.status===`error`?`alert`:`status`,children:e.status===`error`?e.message:e.status===`reading`?`Reading clipboard…`:`Uploading files…`}),e.status===`error`&&(0,G.jsx)(`button`,{type:`button`,className:`min-h-[44px] px-2`,onClick:n,children:`Retry`}),(0,G.jsx)(`button`,{type:`button`,className:`min-h-[44px] px-2 text-secondary`,onClick:t,children:e.status===`error`?`Dismiss`:`Cancel`})]})}function FG({cancel:e,paste:t,allowFiles:n}){let r=(0,x.useRef)(null),[i,a]=(0,x.useState)(``),[o,s]=(0,x.useState)([]);(0,x.useLayoutEffect)(()=>{r.current?.showModal()},[]);let c=(0,G.jsx)(`dialog`,{ref:r,"aria-label":`Paste from this device`,onCancel:e,style:{top:`calc(var(--viewport-offset-top, 0px) + 1rem)`,bottom:`auto`,maxHeight:`calc(var(--visual-viewport-height, 100dvh) - 2rem)`},className:`mx-auto my-0 w-[calc(100%_-_2rem)] max-w-sm overflow-y-auto rounded-lg border border-border bg-elevated p-4 text-primary backdrop:bg-black/50`,children:(0,G.jsxs)(`form`,{onSubmit:n=>{n.preventDefault(),(i||o.length)&&(e(),t({text:i,files:o}))},children:[(0,G.jsx)(`p`,{className:`mb-3 text-sm text-primary`,children:`Type or paste text, then submit it to your terminal.`}),(0,G.jsx)(`textarea`,{autoFocus:!0,"aria-label":`Paste here`,placeholder:`Type or paste here`,rows:4,value:i,onChange:e=>a(e.target.value),className:`w-full rounded border border-border bg-surface p-3 text-base text-primary`,onPaste:e=>{let t=nW(e.clipboardData);if(!t.length)return;e.preventDefault(),s(e=>[...e,...t]);let n=e.clipboardData.getData(`text/plain`);n&&n.trim()!==t.map(e=>e.name).join(`
|
|
247
|
-
`)&&a(e=>e+n)}}),n&&(0,G.jsxs)(`label`,{className:`mt-3 block text-sm`,children:[`Attach files`,(0,G.jsx)(`input`,{type:`file`,multiple:!0,"aria-label":`Choose files`,className:`mt-2 block w-full text-sm`,onChange:e=>{let t=Array.from(e.target.files??[]);s(e=>[...e,...t]),e.target.value=``}})]}),o.length>0&&(0,G.jsx)(`ul`,{className:`mt-2 text-sm`,children:o.map((e,t)=>(0,G.jsxs)(`li`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e.name}),(0,G.jsx)(`button`,{type:`button`,className:`min-h-[44px] px-2`,"aria-label":`Remove ${e.name}`,onClick:()=>s(e=>e.filter((e,n)=>n!==t)),children:`Remove`})]},t))}),(0,G.jsxs)(`div`,{className:`mt-3 flex justify-end gap-2`,children:[(0,G.jsx)(`button`,{type:`button`,className:`min-h-[44px] px-3 text-secondary`,onClick:e,children:`Cancel`}),(0,G.jsx)(`button`,{type:`submit`,disabled:!i&&o.length===0,className:`min-h-[44px] rounded bg-accent px-3 text-white disabled:opacity-50`,children:`Submit`})]})]})});return typeof document>`u`?c:(0,
|
|
247
|
+
`)&&a(e=>e+n)}}),n&&(0,G.jsxs)(`label`,{className:`mt-3 block text-sm`,children:[`Attach files`,(0,G.jsx)(`input`,{type:`file`,multiple:!0,"aria-label":`Choose files`,className:`mt-2 block w-full text-sm`,onChange:e=>{let t=Array.from(e.target.files??[]);s(e=>[...e,...t]),e.target.value=``}})]}),o.length>0&&(0,G.jsx)(`ul`,{className:`mt-2 text-sm`,children:o.map((e,t)=>(0,G.jsxs)(`li`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e.name}),(0,G.jsx)(`button`,{type:`button`,className:`min-h-[44px] px-2`,"aria-label":`Remove ${e.name}`,onClick:()=>s(e=>e.filter((e,n)=>n!==t)),children:`Remove`})]},t))}),(0,G.jsxs)(`div`,{className:`mt-3 flex justify-end gap-2`,children:[(0,G.jsx)(`button`,{type:`button`,className:`min-h-[44px] px-3 text-secondary`,onClick:e,children:`Cancel`}),(0,G.jsx)(`button`,{type:`submit`,disabled:!i&&o.length===0,className:`min-h-[44px] rounded bg-accent px-3 text-white disabled:opacity-50`,children:`Submit`})]})]})});return typeof document>`u`?c:(0,re.createPortal)(c,document.body)}function IG(e){let[t,n]=(0,x.useState)({status:`idle`}),r=(0,x.useRef)(e);r.current=e;let i=(0,x.useRef)(0),a=(0,x.useRef)(Promise.resolve()),o=(0,x.useRef)(null),s=(0,x.useRef)(null),c=(0,x.useCallback)(()=>{i.current++,o.current?.abort(),o.current=null,a.current=Promise.resolve(),s.current=null,n({status:`idle`})},[]);(0,x.useLayoutEffect)(()=>(c(),()=>{i.current++,o.current?.abort()}),[e.sessionId,e.disabled,c]);let l=(0,x.useCallback)((e,t=!1)=>{let c=Promise.resolve(e).then(e=>({value:e}),e=>({error:e})),l=i.current,u=()=>l===i.current&&!r.current.disabled;return u()?(t&&n({status:`reading`}),a.current=a.current.then(async()=>{if(!u())return;let e=await c;if(!u())return;if(`error`in e){n({status:`awaiting-paste`});return}let t=e.value;s.current=t;let i=new AbortController;o.current=i;try{let e=rW(t.files);if(e)throw Error(e);if(t.files.length&&r.current.fileUploadsAllowed===!1)throw Error(`File uploads are unavailable for SSH sessions.`);t.files.length&&n({status:`uploading`});let a=[];for(let e of t.files){if(!u())return;a.push({file:e,path:await iW(e,i.signal)})}if(!u()||i.signal.aborted)return;let o=a.filter(({file:e})=>!/^image\/(png|jpeg|gif|webp)$/.test(e.type)),c=a.filter(({file:e})=>/^image\/(png|jpeg|gif|webp)$/.test(e.type)),l=[t.text,...o.map(({path:e})=>aW(e))].filter(Boolean).join(`
|
|
248
248
|
`);l&&r.current.onPasteText(l+(a.length?` `:``));for(let{path:e}of c)r.current.onPasteImage($U(e,r.current.agentType)+` `);s.current=null,n({status:`idle`}),r.current.onRefocus?.()}catch(e){u()&&!i.signal.aborted&&n({status:`error`,message:e instanceof Error?e.message:`Upload failed. Try again.`})}finally{o.current===i&&(o.current=null)}}),a.current):Promise.resolve()},[]);return{state:t,paste:l,pasteClipboard:()=>l(oW(),!0),openDialog:()=>{r.current.disabled||(c(),n({status:`awaiting-paste`}))},retry:()=>s.current?l(s.current):Promise.resolve(),cancel:c,fail:e=>{c(),n({status:`error`,message:e})}}}var LG=(0,G.jsx)(`svg`,{width:`18`,height:`18`,viewBox:`0 0 24 24`,fill:`currentColor`,children:(0,G.jsx)(`path`,{d:`M22 3H7c-.69 0-1.23.35-1.59.88L0 12l5.41 8.11c.36.53.9.89 1.59.89h15c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm0 16H7.07L2.4 12l4.66-7H22v14zm-11.59-2L14 13.41 17.59 17 19 15.59 15.41 12 19 8.41 17.59 7 14 10.59 10.41 7 9 8.41 12.59 12 9 15.59z`})}),RG=(0,G.jsxs)(`svg`,{width:`16`,height:`16`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,G.jsx)(`path`,{d:`M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2`}),(0,G.jsx)(`rect`,{x:`8`,y:`2`,width:`8`,height:`4`,rx:`1`,ry:`1`})]}),zG=(0,G.jsxs)(`svg`,{width:`18`,height:`18`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,G.jsx)(`rect`,{x:`2`,y:`4`,width:`20`,height:`16`,rx:`2`,ry:`2`}),(0,G.jsx)(`line`,{x1:`6`,y1:`8`,x2:`6`,y2:`8`}),(0,G.jsx)(`line`,{x1:`10`,y1:`8`,x2:`10`,y2:`8`}),(0,G.jsx)(`line`,{x1:`14`,y1:`8`,x2:`14`,y2:`8`}),(0,G.jsx)(`line`,{x1:`18`,y1:`8`,x2:`18`,y2:`8`}),(0,G.jsx)(`line`,{x1:`6`,y1:`12`,x2:`6`,y2:`12`}),(0,G.jsx)(`line`,{x1:`10`,y1:`12`,x2:`10`,y2:`12`}),(0,G.jsx)(`line`,{x1:`14`,y1:`12`,x2:`14`,y2:`12`}),(0,G.jsx)(`line`,{x1:`18`,y1:`12`,x2:`18`,y2:`12`}),(0,G.jsx)(`line`,{x1:`7`,y1:`16`,x2:`17`,y2:`16`})]}),BG={label:(0,G.jsx)(fe,{width:18,height:18}),key:`\r`,className:`bg-accent/20 text-accent border-accent/40`,ariaLabel:`Enter`},VG={label:`esc`,key:`\x1B`},HG={label:LG,key:``,ariaLabel:`Delete word`},UG={label:`tab`,key:` `},WG={[UG.key]:`\x1B[Z`,[BG.key]:`
|
|
249
249
|
`};function GG(){`vibrate`in navigator&&navigator.vibrate(10)}function KG(e,t){if(!t||e.length!==1)return{output:e,consumeCtrl:!1};let n=e.toUpperCase().charCodeAt(0);return n>=65&&n<=90?{output:String.fromCharCode(n-64),consumeCtrl:!0}:{output:e,consumeCtrl:!0}}var qG={working:`bg-working`,waiting:`bg-waiting`,permission:`bg-approval`,unknown:`bg-muted`};function JG({onSendKey:e,onPasteText:t,onPasteImage:n,disabled:r=!1,sessions:i,currentSessionId:a,agentType:o,fileUploadsAllowed:s=!0,onSelectSession:c,hideSessionSwitcher:l=!1,onRefocus:u,isKeyboardVisible:d,onEnterTextMode:f}){let p=IG({sessionId:a,disabled:r,fileUploadsAllowed:s,agentType:o,onPasteText:t??e,onPasteImage:n??e,onRefocus:u}),[m,h]=(0,x.useState)(!1),g=oG(a,r),_=(0,x.useRef)(0),v=(0,x.useRef)(null);(0,x.useEffect)(()=>{if(!m||r||p.state.status===`awaiting-paste`||typeof document>`u`)return;let t=t=>{let{output:n,consumeCtrl:r}=KG(t.key,!0);r&&(t.preventDefault(),t.stopPropagation(),GG(),e(n),h(!1))};return document.addEventListener(`keydown`,t,{capture:!0}),()=>{document.removeEventListener(`keydown`,t,{capture:!0})}},[m,r,p.state.status,e]);let y=t=>{if(r)return;let n=d?.()??!1;GG();let{output:i,consumeCtrl:a}=KG(g.current?WG[t]??t:t,m);a&&h(!1),e(i),n&&u?.()},b=()=>{r||(GG(),h(!m))},S=t=>{let{output:n,consumeCtrl:r}=KG(t,m);r&&h(!1),e(n)},C=()=>{if(!r)return GG(),p.openDialog()},w=e=>{GG(),c(e)},T=()=>{r||(GG(),d?.()?document.activeElement instanceof HTMLElement&&document.activeElement.blur():f?.())},E=i.length>1&&!l,D=e=>t=>{if(r)return;let n=v.current,i=t.changedTouches[0];!n||!i||Math.hypot(i.clientX-n.x,i.clientY-n.y)>10||(t.preventDefault(),t.stopPropagation(),_.current=Date.now(),e())},O=e=>()=>{r||Date.now()-_.current<700||e()},k=e=>(0,G.jsx)(`button`,{type:`button`,"aria-label":e.ariaLabel,className:`
|
|
250
250
|
terminal-key
|
|
@@ -296,11 +296,11 @@ ${s.join(`
|
|
|
296
296
|
select-none touch-manipulation
|
|
297
297
|
text-secondary
|
|
298
298
|
${r?`opacity-50`:``}
|
|
299
|
-
`,onMouseDown:e=>e.preventDefault(),onTouchEnd:D(T),onClick:O(T),disabled:r,children:zG})]}),(0,G.jsx)(PG,{...p,allowFiles:s})]})}function YG({isOpen:e,onClose:t,sessions:n,hibernatingSessions:r=[],historySessions:i=[],selectedSessionId:a,selectedHibernatingSessionId:o=null,onSelect:s,onSelectHibernating:c,onRename:l,onResume:u,onHibernate:d,onMoveToHistory:f,onNewSession:p,loading:m,error:h}){let g=md(),_=(0,x.useRef)(null),v=(0,x.useRef)(null);(0,x.useEffect)(()=>{if(!e)return;let n=e=>{e.key===`Escape`&&(e.preventDefault(),t())};return document.addEventListener(`keydown`,n),()=>document.removeEventListener(`keydown`,n)},[e,t]),(0,x.useEffect)(()=>{e?(v.current=document.activeElement,_.current?.focus()):v.current&&=(v.current.focus(),null)},[e]),(0,x.useEffect)(()=>{if(!e)return;let n=_.current;if(!n)return;let r=0,i=0,a=e=>{let t=e.touches[0];r=t.clientX,i=t.clientY},o=e=>{let n=e.changedTouches[0],a=r-n.clientX,o=Math.abs(n.clientY-i);a>=50&&a>o*1.5&&(`vibrate`in navigator&&navigator.vibrate(10),t())};return n.addEventListener(`touchstart`,a,{passive:!0}),n.addEventListener(`touchend`,o,{passive:!0}),()=>{n.removeEventListener(`touchstart`,a),n.removeEventListener(`touchend`,o)}},[e,t]);let y=e=>{s(e),t()},b=e=>{c?.(e),t()},S=g?{transition:`none`}:void 0;return(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`div`,{className:`session-drawer-backdrop ${e?`open`:``}`,style:S,onClick:t,"aria-hidden":`true`}),(0,G.jsxs)(`div`,{ref:_,className:`session-drawer ${e?`open`:``}`,style:S,role:`dialog`,"aria-modal":`true`,"aria-label":`Session list`,tabIndex:-1,children:[(0,G.jsx)(WD,{sessions:n,hibernatingSessions:r,historySessions:i,selectedSessionId:a,selectedHibernatingSessionId:o,onSelect:y,onSelectHibernating:b,onRename:l,onResume:u,onHibernate:d,onMoveToHistory:f,onNewSession:()=>{p()!==!1&&t()},loading:m,error:h}),(0,G.jsx)(`div`,{className:`shrink-0 border-t border-border px-2 pt-2`,style:{paddingBottom:`max(0.5rem, env(safe-area-inset-bottom, 0.5rem))`},children:(0,G.jsx)(`button`,{onClick:()=>{p()!==!1&&t()},className:`btn btn-primary w-full py-2 text-sm`,children:`New Session`})})]})]})}var XG={working:`bg-green-500/35 text-white`,waiting:`bg-blue-500/35 text-white`,permission:`bg-amber-500/35 text-white`,unknown:`bg-gray-500/35 text-white`},ZG={working:`bg-working text-white`,waiting:`bg-waiting text-white`,permission:`bg-approval text-white`,unknown:`bg-muted text-white`};function QG(){`vibrate`in navigator&&navigator.vibrate(10)}function $G({session:e,sessions:t,hibernatingSession:n=null,hibernatingSessions:r=[],historySessions:i=[],connectionStatus:a,connectionEpoch:o=0,sendMessage:s,subscribe:c,onClose:l,onSelectSession:u,onSelectHibernatingSession:d,onNewSession:f,onKillSession:p,onRenameSession:m,onDuplicateSession:h,onResumeSession:g,onHibernateSession:_,onMoveToHistory:v,onOpenSettings:y,loading:b=!1,error:S=null}){let C=zW[RW(e=>e.theme)],w=H(e=>e.useWebGL),T=H(e=>e.fontSize),E=H(e=>e.lineHeight),D=H(e=>e.letterSpacing),O=ee(H(e=>e.fontOption),H(e=>e.customFontFamily)),k=Xe(Je(H(e=>e.shortcutModifier))),A=Ge(),j=PW(),[M,N]=(0,x.useState)(!1),[P,F]=(0,x.useState)(!1),[I,L]=(0,x.useState)(!1),[R,z]=(0,x.useState)(!1),[B,te]=(0,x.useState)(!1),[V,ne]=(0,x.useState)(!1),[re,U]=(0,x.useState)(``),ie=(0,x.useRef)(!1),ae=(0,x.useRef)(null),oe=(0,x.useRef)(null),se=(0,x.useRef)(null);Qm(se,e?.id??null);let ce=(0,x.useRef)(null),le=(0,x.useRef)(null),de=(0,x.useRef)(()=>{}),fe=(0,x.useRef)(()=>{}),pe=e?.remote===!0,he=Jm(e=>e.remoteAllowControl),_e=Jm(e=>e.remoteAllowAttach),ve=Jm(e=>e.preferWindowName),ye=pe&&!_e,be=!pe||he&&e?.source===`managed`,xe=n?n.displayName||Lm(n.projectPath)||n.sessionId.slice(0,8):``,Se=n?Lm(n.projectPath):``,Ce=n?Im(n.lastActivityAt):``,we=!!e&&!!_&&e.source===`managed`&&!e.remote&&!!e.agentSessionId?.trim(),Te=(0,x.useMemo)(()=>{let e=new Set;for(let n of t)n.host?.trim()&&e.add(n.host.trim());for(let t of r)t.host?.trim()&&e.add(t.host.trim());return e.size>1},[t,r]),{containerRef:De,terminalRef:ke,inTmuxCopyModeRef:Ae,isTmuxCopyMode:je,appMouseRef:Me,setTmuxCopyMode:Ne,isSwitching:Fe,isInputReady:Ie,pendingClipboardOffer:Le,copyPendingClipboardOffer:ze,dismissPendingClipboardOffer:Be}=NW({sessionId:e?.id??null,tmuxTarget:e?.tmuxWindow??null,agentType:e?.agentType,onPasteFiles:e=>de.current(e),onPasteError:e=>fe.current(e),allowAttach:!ye,connectionStatus:a,connectionEpoch:o,sendMessage:s,subscribe:c,theme:C,fontSize:T,lineHeight:E,letterSpacing:D,fontFamily:O,useWebGL:w,onScrollChange:e=>{N(!e)}}),Ve=(0,x.useCallback)(()=>{!e||ye||(s({type:`tmux-cancel-copy-mode`,sessionId:e.id}),Ne(!1),ke.current?.scrollToBottom())},[e,ye,s,Ne,ke]),He=(0,x.useCallback)(()=>{te(!0),QG()},[]),Ue=LW({enabled:j||A,isOpen:B,onOpen:He});(0,x.useEffect)(()=>{!j&&!A&&B&&te(!1)},[B,j,A]),FW(oe,R,(0,x.useCallback)(()=>z(!1),[])),(0,x.useEffect)(()=>{V&&ce.current&&(ce.current.focus(),ce.current.select())},[V]),(0,x.useEffect)(()=>{I&&le.current&&le.current.focus()},[I]),IW(I,(0,x.useCallback)(()=>L(!1),[]));let Ke=()=>{e&&(p(e.id,`terminal_confirm_modal`),L(!1))},qe=()=>{!e||!we||(_?.(e.agentSessionId.trim()),z(!1))},Ye=()=>{e&&(U(e.agentSessionName||e.name),ne(!0),z(!1))},Ze=()=>{if(!e)return;let t=re.trim(),n=e.agentSessionName||e.name;t&&t!==n&&m(e.id,t),ne(!1)},Qe=e=>{e.key===`Enter`?(e.preventDefault(),Ze()):e.key===`Escape`&&(e.preventDefault(),ne(!1))};(0,x.useEffect)(()=>{if(!A||!e){F(!1);return}let t=De.current;if(!t)return;let n=e=>{let n=t.querySelector(`.xterm-accessibility-tree`);if(!n)return!1;let r=e.anchorNode,i=e.focusNode;return!!r&&n.contains(r)||!!i&&n.contains(i)},r=()=>{let e=t.querySelector(`.xterm-accessibility`),n=t.querySelector(`.xterm-accessibility-tree`);!e||!n||(e.style.setProperty(`opacity`,`0`),n.style.setProperty(`opacity`,`0`),e.style.setProperty(`-webkit-user-select`,`none`),e.style.setProperty(`user-select`,`none`),n.style.setProperty(`-webkit-user-select`,`none`),n.style.setProperty(`user-select`,`none`),e.offsetHeight,requestAnimationFrame(()=>{e.style.removeProperty(`opacity`),n.style.removeProperty(`opacity`),e.style.removeProperty(`-webkit-user-select`),e.style.removeProperty(`user-select`),n.style.removeProperty(`-webkit-user-select`),n.style.removeProperty(`user-select`)}))},i=()=>{ie.current=!1;let e=window.getSelection();try{e?.removeAllRanges()}catch{}ke.current?.clearSelection(),r(),F(!1)};ae.current=i;let a=()=>{let e=window.getSelection();if(!e||e.rangeCount===0||e.isCollapsed){ie.current?i():F(e=>e&&!1);return}let t=n(e);if(!t&&ie.current){i();return}ie.current=t;let r=t;F(e=>e===r?e:r)},o=()=>{let e=window.getSelection();!e||e.isCollapsed||n(e)&&setTimeout(i,0)},s=null,c=!1,l=e=>{if(e.touches.length===1){let t=e.touches[0];s={x:t.clientX,y:t.clientY},c=!1}},u=e=>{if(c||!s||e.touches.length!==1)return;let t=e.touches[0],n=Math.abs(t.clientX-s.x),r=Math.abs(t.clientY-s.y);(n>10||r>10)&&(c=!0)},d=e=>{let r=c;s=null,c=!1;let a=window.getSelection();if(!a||a.rangeCount===0||a.isCollapsed){F(!1);return}let o=t.querySelector(`.xterm-accessibility-tree`);if(!o)return;if(!n(a)){F(!1);return}if(r)return;let l=e.target,u=l?o.contains(l):!1,d=!1;if(u&&l)try{d=a.containsNode(l,!0)}catch{d=!1}(!u||!d)&&setTimeout(i,0)};return document.addEventListener(`selectionchange`,a),document.addEventListener(`copy`,o),document.addEventListener(`touchstart`,l,{passive:!0}),document.addEventListener(`touchmove`,u,{passive:!0}),document.addEventListener(`touchend`,d,{passive:!0}),()=>{document.removeEventListener(`selectionchange`,a),document.removeEventListener(`copy`,o),document.removeEventListener(`touchstart`,l),document.removeEventListener(`touchmove`,u),document.removeEventListener(`touchend`,d),ae.current=null,ie.current=!1}},[De,A,e?.id]),(0,x.useEffect)(()=>{if(!A)return;let t=De.current;if(!t)return;let n=null,r=()=>{let e=ke.current,r=t.querySelector(`.xterm`);if(!e||!r)return;let i=r.querySelector(`.xterm-screen`),a=r.querySelector(`.xterm-accessibility`),o=r.querySelector(`.xterm-accessibility-tree`);if(!i||!a||!o)return;n||=qW(o);let s=r.getBoundingClientRect(),c=i.getBoundingClientRect(),l=c.left-s.left,u=c.top-s.top;Object.assign(a.style,{left:`${l}px`,top:`${u}px`,right:`auto`,bottom:`auto`,width:`${c.width}px`,height:`${c.height}px`});let d=c.width/e.cols,f=c.height/e.rows,p=document.createElement(`span`);p.textContent=`0`.repeat(200),p.style.cssText=`position:absolute;visibility:hidden;white-space:pre;pointer-events:none;letter-spacing:0px`,o.appendChild(p);let m=p.getBoundingClientRect().width/200;p.remove();let h=Math.max(-2,Math.min(2,d-m));t.style.setProperty(`--xterm-font-size`,`${e.options.fontSize}px`),t.style.setProperty(`--xterm-cell-height`,`${f}px`),t.style.setProperty(`--xterm-a11y-letter-spacing`,`${h}px`)},i=performance.now();r();let a=Math.round(performance.now()-i);a>10&&XD(`switch_a11y_overlay`,{sessionId:e?.id,a11yMs:a});let o=window.requestAnimationFrame(r),s=window.setTimeout(r,100),c=()=>window.requestAnimationFrame(r);return window.visualViewport?.addEventListener(`resize`,c),window.addEventListener(`orientationchange`,c),()=>{window.cancelAnimationFrame(o),window.clearTimeout(s),window.visualViewport?.removeEventListener(`resize`,c),window.removeEventListener(`orientationchange`,c),n?.()}},[De,T,A,e?.id,ke]);let $e=(0,x.useRef)(P);(0,x.useEffect)(()=>{$e.current=P},[P]);let et=(0,x.useRef)(e?.id);(0,x.useEffect)(()=>{et.current=e?.id},[e?.id]);let tt=(0,x.useRef)(s);(0,x.useEffect)(()=>{tt.current=s},[s]);let nt=(0,x.useRef)(!1),rt=(0,x.useRef)(`idle`);(0,x.useEffect)(()=>{if(!A)return;let e=De.current;if(!e)return;let t=null,n=()=>e.querySelector(`.xterm-helper-textarea`),r=e=>{e.target===n()&&(rt.current=`focused`)},i=e=>{e.target===n()&&(t!==null&&window.clearTimeout(t),t=window.setTimeout(()=>{t=null;let e=n(),r=typeof document.hasFocus!=`function`||document.hasFocus();document.activeElement!==e&&document.visibilityState!==`hidden`&&r&&(rt.current=`idle`)},0))},a=()=>{let e=n();(document.activeElement===e||rt.current===`focused`)&&(rt.current=`interrupted`)},o=()=>{rt.current===`interrupted`&&(rt.current=`armed`)},s=()=>{document.visibilityState===`hidden`?a():o()},c=e=>{e.persisted&&o()};return document.addEventListener(`focusin`,r),document.addEventListener(`focusout`,i),document.addEventListener(`visibilitychange`,s),window.addEventListener(`blur`,a),window.addEventListener(`focus`,o),window.addEventListener(`pageshow`,c),()=>{document.removeEventListener(`focusin`,r),document.removeEventListener(`focusout`,i),document.removeEventListener(`visibilitychange`,s),window.removeEventListener(`blur`,a),window.removeEventListener(`focus`,o),window.removeEventListener(`pageshow`,c),t!==null&&window.clearTimeout(t),rt.current=`idle`}},[De,A,e?.id]),(0,x.useEffect)(()=>{let t=De.current;if(!t||!e?.id||!j&&!A)return;let n={x:0,y:0},r=0,i=!1,a=null,o=0,s=0,c=0,l=Math.round(T*E),u=null,d=null,f=!1,p=null,m=()=>{let e=window.getComputedStyle(t).getPropertyValue(`--xterm-cell-height`).trim(),n=Number.parseFloat(e);return!Number.isNaN(n)&&n>0?n:Math.round(T*E)},h=()=>t.querySelector(`.xterm-helper-textarea`),g=e=>{let n=ke.current;if(!n)return null;let r=(t.querySelector(`.xterm`)?.querySelector(`.xterm-screen`))?.getBoundingClientRect();if(!r||r.width<=0||r.height<=0)return null;let i=r.width/n.cols,a=r.height/n.rows;return i<=0||a<=0?null:{col:Math.min(n.cols,Math.max(1,Math.floor((e.clientX-r.left)/i)+1)),row:Math.min(n.rows,Math.max(1,Math.floor((e.clientY-r.top)/a)+1))}},_=()=>{let e=h();e&&document.activeElement!==e&&(e.disabled=!0)},v=()=>{let e=h();e&&(e.disabled=!1)};_();let y=()=>{if(Ae.current)return;let e=h();e&&(e.disabled=!1,e.focus())},b=()=>{u!==null&&(cancelAnimationFrame(u),u=null),s=0},x=()=>{d!==null&&(clearTimeout(d),d=null)},S=(e,t,n)=>{let r=et.current;return r?(tt.current({type:`terminal-input`,sessionId:r,data:`\x1b[<${e};${t.col};${t.row}${n}`}),!0):!1},C=e=>{let t=et.current;if(!t||e===0)return!1;let n=ke.current,r=n?.cols??80,i=n?.rows??24,a=Math.floor(r/2),o=Math.floor(i/2),s=e>0?65:64,c=Math.abs(e),l=e<0;for(let e=0;e<c;e++)tt.current({type:`terminal-input`,sessionId:t,data:`\x1b[<${s};${a};${o}M`});return l&&!Me.current&&Ne(!0),l},w=e=>{let t=et.current,n=g(e);return!t||!n?!1:(tt.current({type:`terminal-input`,sessionId:t,data:`\x1b[<0;${n.col};${n.row}M\x1b[<0;${n.col};${n.row}m`}),!0)},D=e=>{if(!A||!Me.current)return!1;let t=g(e);return t?(f=!0,p=t,_(),QG(),S(0,t,`M`)):!1},O=e=>{let t=g(e);return t?p&&p.col===t.col&&p.row===t.row?!0:(p=t,S(32,t,`M`)):!1},k=e=>{let t=e?g(e):p;return f=!1,p=null,t?S(0,t,`m`):!1},M=()=>{x(),f=!1,p=null,a=null,s=0,c=0},N=()=>{if(!A)return!1;let e=window.getSelection();if(!e||e.isCollapsed)return!1;let n=t.querySelector(`.xterm-accessibility-tree`);if(!n)return!1;let r=e.anchorNode,i=e.focusNode;return!!r&&n.contains(r)||!!i&&n.contains(i)},P=()=>{!A||!ie.current||N()||ae.current?.()},F=e=>{if(b(),P(),Ue.current||B){M();return}if($e.current){M();return}if(rt.current===`armed`&&!Ae.current&&(rt.current=`idle`,y()),e.touches.length===1){let t=e.touches[0];if(n={x:t.clientX,y:t.clientY},r=performance.now(),i=!1,a=t.clientY,o=r,s=0,c=0,l=m(),v(),A&&Me.current){let e={clientX:t.clientX,clientY:t.clientY};d=setTimeout(()=>{d=null,!(i||Ue.current||B)&&($e.current||N()||D(e))},350)}}},I=e=>{if(e.touches.length!==1||a===null)return;if(P(),Ue.current||B){M();return}let t=performance.now(),r=e.touches[0],u=r.clientX,d=r.clientY;if(f){e.preventDefault(),e.stopPropagation(),O(r),a=d,o=t;return}if($e.current||N()){M();return}e.preventDefault(),e.stopPropagation();let p=Math.abs(u-n.x),m=Math.abs(d-n.y);!i&&(p>6||m>6)&&(i=!0,x(),_());let h=a-d,g=t-o;if(a=d,o=t,g>0){let e=h/g;s=s*.7+e*.3}c+=h;let v=Math.max(6,l*.6),y=Math.trunc(c/v);y!==0&&(C(y),c-=y*v)},L=e=>{let t=s,n=performance.now()-r;if(x(),f){k(e.changedTouches[0]),M(),e.preventDefault(),e.stopPropagation();return}if(M(),Ue.current||B)return;let a=N();if($e.current&&!a&&ae.current?.(),$e.current||a){Ae.current&&(nt.current=!0);return}if(!i){if(A&&n>=350)return;if(Me.current){let t=e.changedTouches[0];if(t&&w(t)){y(),e.preventDefault(),e.stopPropagation();return}}if(Ae.current){e.preventDefault(),e.stopPropagation(),nt.current=!0;return}y();return}if(Math.abs(t)>.12){let e=t,n=performance.now(),r=()=>{let t=performance.now(),i=t-n;n=t;let a=e*i;c+=a;let o=Math.max(6,l*.6),s=Math.trunc(c/o);s!==0&&(C(s),c-=s*o),e*=.95**(i/16.67),u=Math.abs(e)>.02?requestAnimationFrame(r):null};u=requestAnimationFrame(r)}},ee=e=>{nt.current&&=(e.preventDefault(),e.stopPropagation(),!1)},R={passive:!0,capture:!0},z={passive:!1,capture:!0},te={passive:!1,capture:!0},V={capture:!0};return t.addEventListener(`touchstart`,F,R),t.addEventListener(`touchmove`,I,z),t.addEventListener(`touchend`,L,te),t.addEventListener(`mousedown`,ee,V),()=>{t.removeEventListener(`touchstart`,F,R),t.removeEventListener(`touchmove`,I,z),t.removeEventListener(`touchend`,L,te),t.removeEventListener(`mousedown`,ee,V),x();let e=h();e&&(e.disabled=!1)}},[e?.id,De,ke,A,j,B,T,E]);let it=(0,x.useCallback)(t=>{!e||ye||!Ie||s({type:`terminal-input`,sessionId:e.id,data:t})},[e,ye,Ie,s]),at=(0,x.useCallback)(t=>{!e||ye||!Ie||(Ae.current&&(s({type:`tmux-cancel-copy-mode`,sessionId:e.id}),Ne(!1)),s({type:`terminal-paste`,sessionId:e.id,data:t}))},[e,ye,Ie,s,Ae,Ne]),ot=(0,x.useCallback)(t=>{!e||ye||!Ie||(Ae.current&&(s({type:`tmux-cancel-copy-mode`,sessionId:e.id}),Ne(!1)),it(t))},[e,ye,Ie,s,Ae,Ne,it]),st=(0,x.useCallback)(()=>{let e=De.current;if(!e)return;let t=e.querySelector(`.xterm-helper-textarea`);t&&(t.removeAttribute(`disabled`),t.focus())},[De]),ct=IG({sessionId:e?.id??null,disabled:a!==`connected`||ye||!Ie,fileUploadsAllowed:!pe,agentType:e?.agentType,onPasteText:at,onPasteImage:ot,onRefocus:st});de.current=ct.paste,fe.current=ct.fail;let lt=(0,x.useCallback)(()=>{if(!e||ye||!Ie)return;Ae.current&&(s({type:`tmux-cancel-copy-mode`,sessionId:e.id}),Ne(!1));let t=De.current;if(!t)return;let n=t.querySelector(`.xterm-helper-textarea`);n&&(n.removeAttribute(`disabled`),n.focus())},[e,ye,Ie,s,De,Ae,Ne]),ut=(0,x.useCallback)(()=>{if(typeof document>`u`)return!1;let e=De.current;if(!e)return!1;let t=e.querySelector(`.xterm-helper-textarea`);if(t&&document.activeElement===t)return!0;let n=document.activeElement,r=typeof HTMLInputElement<`u`&&n instanceof HTMLInputElement,i=typeof HTMLTextAreaElement<`u`&&n instanceof HTMLTextAreaElement;return r||i||n&&n.isContentEditable?!1:!!document.documentElement?.classList?.contains(`keyboard-visible`)},[De]);(0,x.useEffect)(()=>{if(!A)return;let e=De.current;if(!e)return;let t=e.querySelector(`.xterm-accessibility`),n=e.querySelector(`.xterm-accessibility-tree`);if(!t||!n)return;let r=()=>{let r=e.querySelector(`.xterm-helper-textarea`);r&&document.activeElement===r&&!$e.current?(t.style.pointerEvents=`none`,n.style.pointerEvents=`none`):(t.style.removeProperty(`pointer-events`),n.style.removeProperty(`pointer-events`))};return r(),document.addEventListener(`focusin`,r),document.addEventListener(`focusout`,r),()=>{document.removeEventListener(`focusin`,r),document.removeEventListener(`focusout`,r)}},[De,A,P]),(0,x.useEffect)(()=>{let e=De.current;e&&(e.inert=!!n)},[De,n]);let dt=(0,x.useMemo)(()=>{if(!ve||t.length===0)return!1;let e=t.map(e=>e.name.trim()).filter(Boolean);return e.length===t.length&&new Set(e).size===t.length},[ve,t]);return(0,G.jsxs)(`section`,{className:`flex flex-1 flex-col bg-base terminal-mobile-overlay md:relative md:inset-auto ${A?`ios-native-term-selection`:``}`,"data-testid":`terminal-panel`,onDragOver:t=>{Array.from(t.dataTransfer.types).includes(`Files`)&&(t.preventDefault(),t.dataTransfer.dropEffect=e&&!ye&&Ie&&!pe&&a===`connected`?`copy`:`none`)},onDrop:t=>{if(!Array.from(t.dataTransfer.types).includes(`Files`)||(t.preventDefault(),t.stopPropagation(),!e||ye||!Ie||pe||a!==`connected`))return;let n=nW(t.dataTransfer);n.length&&ct.paste({text:``,files:n})},children:[(0,G.jsxs)(`div`,{className:`flex min-h-[52px] shrink-0 items-center justify-between border-b border-border bg-elevated px-[6px] md:hidden`,children:[(0,G.jsxs)(`div`,{className:`flex min-w-0 items-center gap-[7px]`,children:[(0,G.jsx)(`button`,{onClick:()=>te(!0),className:`flex size-[44px] shrink-0 items-center justify-center rounded border border-border bg-surface text-secondary transition-all hover:bg-hover hover:text-primary active:scale-95`,"aria-label":`Open session menu`,children:(0,G.jsx)(Ee,{width:16,height:16})}),e?(0,G.jsxs)(`div`,{className:`flex min-w-[72px] flex-col items-start gap-px leading-none`,children:[V?(0,G.jsx)(`input`,{ref:ce,type:`text`,value:re,onChange:e=>U(e.target.value),onBlur:Ze,onKeyDown:Qe,className:`w-full max-w-[112px] rounded border border-border bg-surface px-2 py-0.5 text-sm font-medium text-primary outline-none focus:border-accent`}):(0,G.jsx)(`span`,{className:`max-w-[112px] truncate text-sm font-medium text-primary`,children:e.agentSessionName||e.name}),(0,G.jsx)(`span`,{className:`shrink-0 text-[10px] ${a===`connected`?YW[e.status]:`text-approval`}`,children:a===`connected`?JW[e.status]:a})]}):n?(0,G.jsxs)(`div`,{className:`flex min-w-0 flex-col items-start gap-px leading-none`,children:[(0,G.jsx)(`span`,{className:`max-w-[112px] truncate text-sm font-medium text-primary`,children:xe}),(0,G.jsx)(`span`,{className:`text-[10px] font-medium text-blue-400`,children:`Hibernating`})]}):(0,G.jsx)(`span`,{className:`text-sm font-medium text-primary`,children:`Sessions`})]}),(0,G.jsxs)(`div`,{className:`flex shrink-0 items-center gap-[4px]`,children:[(0,G.jsx)(`button`,{onClick:f,className:`flex size-[44px] items-center justify-center rounded bg-accent text-white transition-all hover:bg-accent/90 active:scale-95`,title:`New session (${k}N)`,"aria-label":`New session`,children:(0,G.jsx)(Pe,{width:16,height:16})}),e&&be&&(0,G.jsx)(`button`,{disabled:Fe,onClick:()=>L(!0),className:`flex size-[44px] items-center justify-center rounded border border-danger/30 bg-danger/10 text-danger transition-all hover:bg-danger/20 active:scale-95 disabled:cursor-not-allowed disabled:opacity-40`,title:`Kill session (${k}X)`,"aria-label":`Kill session`,children:(0,G.jsx)(We,{width:16,height:16})}),we&&(0,G.jsx)(`button`,{onClick:qe,className:`hidden size-[44px] items-center justify-center rounded border border-border text-secondary transition-all hover:bg-hover hover:text-primary active:scale-95 min-[360px]:flex`,title:`Hibernate session`,"aria-label":`Hibernate session`,children:(0,G.jsx)(Oe,{width:16,height:16})}),n&&(0,G.jsx)(`button`,{onClick:()=>g(n.sessionId),className:`btn btn-primary h-[44px] px-3 text-xs`,children:`Wake`}),e&&(0,G.jsxs)(`div`,{className:`relative`,ref:oe,children:[(0,G.jsx)(`button`,{onClick:()=>z(!R),className:`flex size-[44px] items-center justify-center rounded border border-border bg-surface text-secondary transition-all hover:bg-hover hover:text-primary active:scale-95`,title:`More options`,"aria-label":`More options`,children:(0,G.jsx)(me,{width:16,height:16})}),R&&(0,G.jsxs)(`div`,{className:`absolute right-0 top-full mt-1 z-20 min-w-[140px] rounded-md border border-border bg-elevated shadow-lg py-1`,children:[be&&(0,G.jsxs)(`button`,{onClick:Ye,className:`flex min-h-[44px] w-full items-center gap-2 px-3 py-2 text-left text-sm text-secondary hover:bg-hover hover:text-primary`,children:[(0,G.jsx)(ge,{width:14,height:14}),`Rename`]}),we&&(0,G.jsxs)(`button`,{onClick:qe,className:`flex min-h-[44px] w-full items-center gap-2 px-3 py-2 text-left text-sm text-secondary hover:bg-hover hover:text-primary`,children:[(0,G.jsx)(Oe,{width:14,height:14}),`Hibernate`]}),(0,G.jsxs)(`button`,{onClick:()=>{y(),z(!1)},className:`flex min-h-[44px] w-full items-center gap-2 px-3 py-2 text-left text-sm text-secondary hover:bg-hover hover:text-primary`,children:[(0,G.jsx)(Re,{width:14,height:14}),`Settings`]})]})]})]})]}),e&&t.length>1&&(0,G.jsxs)(`div`,{className:`relative overflow-hidden bg-elevated border-b border-border md:hidden`,children:[(0,G.jsx)(`div`,{className:`absolute right-0 top-0 bottom-0 w-4 bg-gradient-to-l from-elevated to-transparent z-10 pointer-events-none`}),(0,G.jsx)(`div`,{ref:se,className:`flex items-center gap-[6px] overflow-x-auto scroll-pe-4 px-[8px] py-[5px] scrollbar-none snap-x snap-mandatory`,style:{WebkitOverflowScrolling:`touch`},children:t.map((t,n)=>{let r=t.id===e.id,i=dt?t.name.trim():n+1;return(0,G.jsx)(`button`,{type:`button`,"data-session-id":t.id,className:`
|
|
299
|
+
`,onMouseDown:e=>e.preventDefault(),onTouchEnd:D(T),onClick:O(T),disabled:r,children:zG})]}),(0,G.jsx)(PG,{...p,allowFiles:s})]})}function YG({isOpen:e,onClose:t,sessions:n,hibernatingSessions:r=[],historySessions:i=[],selectedSessionId:a,selectedHibernatingSessionId:o=null,onSelect:s,onSelectHibernating:c,onRename:l,onResume:u,onHibernate:d,onMoveToHistory:f,onNewSession:p,loading:m,error:h}){let g=md(),_=(0,x.useRef)(null),v=(0,x.useRef)(null),[y,b]=(0,x.useState)(!1);(0,x.useEffect)(()=>{if(!e){b(!1);return}if(g){b(!0);return}let t=setTimeout(()=>b(!0),250);return()=>clearTimeout(t)},[e,g]),(0,x.useEffect)(()=>{if(!e)return;let n=e=>{e.key===`Escape`&&(e.preventDefault(),t())};return document.addEventListener(`keydown`,n),()=>document.removeEventListener(`keydown`,n)},[e,t]),(0,x.useEffect)(()=>{e?(v.current=document.activeElement,_.current?.focus()):v.current&&=(v.current.focus(),null)},[e]),(0,x.useEffect)(()=>{if(!e)return;let n=_.current;if(!n)return;let r=0,i=0,a=e=>{let t=e.touches[0];r=t.clientX,i=t.clientY},o=e=>{let n=e.changedTouches[0],a=r-n.clientX,o=Math.abs(n.clientY-i);a>=50&&a>o*1.5&&(`vibrate`in navigator&&navigator.vibrate(10),t())};return n.addEventListener(`touchstart`,a,{passive:!0}),n.addEventListener(`touchend`,o,{passive:!0}),()=>{n.removeEventListener(`touchstart`,a),n.removeEventListener(`touchend`,o)}},[e,t]);let S=e=>{s(e),t()},C=e=>{c?.(e),t()},w=g?{transition:`none`}:void 0;return(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`div`,{className:`session-drawer-backdrop ${e?`open`:``}`,style:w,onClick:t,"aria-hidden":`true`}),(0,G.jsxs)(`div`,{ref:_,className:`session-drawer ${e?`open`:``}`,style:w,role:`dialog`,"aria-modal":`true`,"aria-label":`Session list`,tabIndex:-1,children:[(0,G.jsx)(WD,{sessions:n,hibernatingSessions:r,historySessions:i,selectedSessionId:a,selectedHibernatingSessionId:o,onSelect:S,onSelectHibernating:C,onRename:l,onResume:u,onHibernate:d,onMoveToHistory:f,scrollSelectionActive:y,onNewSession:()=>{p()!==!1&&t()},loading:m,error:h}),(0,G.jsx)(`div`,{className:`shrink-0 border-t border-border px-2 pt-2`,style:{paddingBottom:`max(0.5rem, env(safe-area-inset-bottom, 0.5rem))`},children:(0,G.jsx)(`button`,{onClick:()=>{p()!==!1&&t()},className:`btn btn-primary w-full py-2 text-sm`,children:`New Session`})})]})]})}var XG={working:`bg-green-500/35 text-white`,waiting:`bg-blue-500/35 text-white`,permission:`bg-amber-500/35 text-white`,unknown:`bg-gray-500/35 text-white`},ZG={working:`bg-working text-white`,waiting:`bg-waiting text-white`,permission:`bg-approval text-white`,unknown:`bg-muted text-white`};function QG(){`vibrate`in navigator&&navigator.vibrate(10)}function $G({session:e,sessions:t,hibernatingSession:n=null,hibernatingSessions:r=[],historySessions:i=[],connectionStatus:a,connectionEpoch:o=0,sendMessage:s,subscribe:c,onClose:l,onSelectSession:u,onSelectHibernatingSession:d,onNewSession:f,onKillSession:p,onRenameSession:m,onDuplicateSession:h,onResumeSession:g,onHibernateSession:_,onMoveToHistory:v,onOpenSettings:y,loading:b=!1,error:S=null}){let C=zW[RW(e=>e.theme)],w=U(e=>e.useWebGL),T=U(e=>e.fontSize),E=U(e=>e.lineHeight),D=U(e=>e.letterSpacing),O=R(U(e=>e.fontOption),U(e=>e.customFontFamily)),k=Xe(Je(U(e=>e.shortcutModifier))),A=Ge(),j=PW(),[M,N]=(0,x.useState)(!1),[P,F]=(0,x.useState)(!1),[I,L]=(0,x.useState)(!1),[z,B]=(0,x.useState)(!1),[V,ee]=(0,x.useState)(!1),[H,te]=(0,x.useState)(!1),[ne,re]=(0,x.useState)(``),ie=(0,x.useRef)(!1),W=(0,x.useRef)(null),oe=(0,x.useRef)(null),se=(0,x.useRef)(null);Qm(se,e?.id??null);let ce=(0,x.useRef)(null),le=(0,x.useRef)(null),de=(0,x.useRef)(()=>{}),fe=(0,x.useRef)(()=>{}),pe=e?.remote===!0,he=Jm(e=>e.remoteAllowControl),_e=Jm(e=>e.remoteAllowAttach),ve=Jm(e=>e.preferWindowName),ye=pe&&!_e,be=!pe||he&&e?.source===`managed`,xe=n?n.displayName||Lm(n.projectPath)||n.sessionId.slice(0,8):``,Se=n?Lm(n.projectPath):``,Ce=n?Im(n.lastActivityAt):``,we=!!e&&!!_&&e.source===`managed`&&!e.remote&&!!e.agentSessionId?.trim(),Te=(0,x.useMemo)(()=>{let e=new Set;for(let n of t)n.host?.trim()&&e.add(n.host.trim());for(let t of r)t.host?.trim()&&e.add(t.host.trim());return e.size>1},[t,r]),{containerRef:De,terminalRef:ke,inTmuxCopyModeRef:Ae,isTmuxCopyMode:je,appMouseRef:Me,setTmuxCopyMode:Ne,isSwitching:Fe,isInputReady:Ie,pendingClipboardOffer:Le,copyPendingClipboardOffer:ze,dismissPendingClipboardOffer:Be}=NW({sessionId:e?.id??null,tmuxTarget:e?.tmuxWindow??null,agentType:e?.agentType,onPasteFiles:e=>de.current(e),onPasteError:e=>fe.current(e),allowAttach:!ye,connectionStatus:a,connectionEpoch:o,sendMessage:s,subscribe:c,theme:C,fontSize:T,lineHeight:E,letterSpacing:D,fontFamily:O,useWebGL:w,onScrollChange:e=>{N(!e)}}),Ve=(0,x.useCallback)(()=>{!e||ye||(s({type:`tmux-cancel-copy-mode`,sessionId:e.id}),Ne(!1),ke.current?.scrollToBottom())},[e,ye,s,Ne,ke]),He=(0,x.useCallback)(()=>{ee(!0),QG()},[]),Ue=LW({enabled:j||A,isOpen:V,onOpen:He});(0,x.useEffect)(()=>{!j&&!A&&V&&ee(!1)},[V,j,A]),FW(oe,z,(0,x.useCallback)(()=>B(!1),[])),(0,x.useEffect)(()=>{H&&ce.current&&(ce.current.focus(),ce.current.select())},[H]),(0,x.useEffect)(()=>{I&&le.current&&le.current.focus()},[I]),IW(I,(0,x.useCallback)(()=>L(!1),[]));let Ke=()=>{e&&(p(e.id,`terminal_confirm_modal`),L(!1))},qe=()=>{!e||!we||(_?.(e.agentSessionId.trim()),B(!1))},Ye=()=>{e&&(re(e.agentSessionName||e.name),te(!0),B(!1))},Ze=()=>{if(!e)return;let t=ne.trim(),n=e.agentSessionName||e.name;t&&t!==n&&m(e.id,t),te(!1)},Qe=e=>{e.key===`Enter`?(e.preventDefault(),Ze()):e.key===`Escape`&&(e.preventDefault(),te(!1))};(0,x.useEffect)(()=>{if(!A||!e){F(!1);return}let t=De.current;if(!t)return;let n=e=>{let n=t.querySelector(`.xterm-accessibility-tree`);if(!n)return!1;let r=e.anchorNode,i=e.focusNode;return!!r&&n.contains(r)||!!i&&n.contains(i)},r=()=>{let e=t.querySelector(`.xterm-accessibility`),n=t.querySelector(`.xterm-accessibility-tree`);!e||!n||(e.style.setProperty(`opacity`,`0`),n.style.setProperty(`opacity`,`0`),e.style.setProperty(`-webkit-user-select`,`none`),e.style.setProperty(`user-select`,`none`),n.style.setProperty(`-webkit-user-select`,`none`),n.style.setProperty(`user-select`,`none`),e.offsetHeight,requestAnimationFrame(()=>{e.style.removeProperty(`opacity`),n.style.removeProperty(`opacity`),e.style.removeProperty(`-webkit-user-select`),e.style.removeProperty(`user-select`),n.style.removeProperty(`-webkit-user-select`),n.style.removeProperty(`user-select`)}))},i=()=>{ie.current=!1;let e=window.getSelection();try{e?.removeAllRanges()}catch{}ke.current?.clearSelection(),r(),F(!1)};W.current=i;let a=()=>{let e=window.getSelection();if(!e||e.rangeCount===0||e.isCollapsed){ie.current?i():F(e=>e&&!1);return}let t=n(e);if(!t&&ie.current){i();return}ie.current=t;let r=t;F(e=>e===r?e:r)},o=()=>{let e=window.getSelection();!e||e.isCollapsed||n(e)&&setTimeout(i,0)},s=null,c=!1,l=e=>{if(e.touches.length===1){let t=e.touches[0];s={x:t.clientX,y:t.clientY},c=!1}},u=e=>{if(c||!s||e.touches.length!==1)return;let t=e.touches[0],n=Math.abs(t.clientX-s.x),r=Math.abs(t.clientY-s.y);(n>10||r>10)&&(c=!0)},d=e=>{let r=c;s=null,c=!1;let a=window.getSelection();if(!a||a.rangeCount===0||a.isCollapsed){F(!1);return}let o=t.querySelector(`.xterm-accessibility-tree`);if(!o)return;if(!n(a)){F(!1);return}if(r)return;let l=e.target,u=l?o.contains(l):!1,d=!1;if(u&&l)try{d=a.containsNode(l,!0)}catch{d=!1}(!u||!d)&&setTimeout(i,0)};return document.addEventListener(`selectionchange`,a),document.addEventListener(`copy`,o),document.addEventListener(`touchstart`,l,{passive:!0}),document.addEventListener(`touchmove`,u,{passive:!0}),document.addEventListener(`touchend`,d,{passive:!0}),()=>{document.removeEventListener(`selectionchange`,a),document.removeEventListener(`copy`,o),document.removeEventListener(`touchstart`,l),document.removeEventListener(`touchmove`,u),document.removeEventListener(`touchend`,d),W.current=null,ie.current=!1}},[De,A,e?.id]),(0,x.useEffect)(()=>{if(!A)return;let t=De.current;if(!t)return;let n=null,r=()=>{let e=ke.current,r=t.querySelector(`.xterm`);if(!e||!r)return;let i=r.querySelector(`.xterm-screen`),a=r.querySelector(`.xterm-accessibility`),o=r.querySelector(`.xterm-accessibility-tree`);if(!i||!a||!o)return;n||=qW(o);let s=r.getBoundingClientRect(),c=i.getBoundingClientRect(),l=c.left-s.left,u=c.top-s.top;Object.assign(a.style,{left:`${l}px`,top:`${u}px`,right:`auto`,bottom:`auto`,width:`${c.width}px`,height:`${c.height}px`});let d=c.width/e.cols,f=c.height/e.rows,p=document.createElement(`span`);p.textContent=`0`.repeat(200),p.style.cssText=`position:absolute;visibility:hidden;white-space:pre;pointer-events:none;letter-spacing:0px`,o.appendChild(p);let m=p.getBoundingClientRect().width/200;p.remove();let h=Math.max(-2,Math.min(2,d-m));t.style.setProperty(`--xterm-font-size`,`${e.options.fontSize}px`),t.style.setProperty(`--xterm-cell-height`,`${f}px`),t.style.setProperty(`--xterm-a11y-letter-spacing`,`${h}px`)},i=performance.now();r();let a=Math.round(performance.now()-i);a>10&&XD(`switch_a11y_overlay`,{sessionId:e?.id,a11yMs:a});let o=window.requestAnimationFrame(r),s=window.setTimeout(r,100),c=()=>window.requestAnimationFrame(r);return window.visualViewport?.addEventListener(`resize`,c),window.addEventListener(`orientationchange`,c),()=>{window.cancelAnimationFrame(o),window.clearTimeout(s),window.visualViewport?.removeEventListener(`resize`,c),window.removeEventListener(`orientationchange`,c),n?.()}},[De,T,A,e?.id,ke]);let $e=(0,x.useRef)(P);(0,x.useEffect)(()=>{$e.current=P},[P]);let et=(0,x.useRef)(e?.id);(0,x.useEffect)(()=>{et.current=e?.id},[e?.id]);let tt=(0,x.useRef)(s);(0,x.useEffect)(()=>{tt.current=s},[s]);let nt=(0,x.useRef)(!1),rt=(0,x.useRef)(`idle`);(0,x.useEffect)(()=>{if(!A)return;let e=De.current;if(!e)return;let t=null,n=()=>e.querySelector(`.xterm-helper-textarea`),r=e=>{e.target===n()&&(rt.current=`focused`)},i=e=>{e.target===n()&&(t!==null&&window.clearTimeout(t),t=window.setTimeout(()=>{t=null;let e=n(),r=typeof document.hasFocus!=`function`||document.hasFocus();document.activeElement!==e&&document.visibilityState!==`hidden`&&r&&(rt.current=`idle`)},0))},a=()=>{let e=n();(document.activeElement===e||rt.current===`focused`)&&(rt.current=`interrupted`)},o=()=>{rt.current===`interrupted`&&(rt.current=`armed`)},s=()=>{document.visibilityState===`hidden`?a():o()},c=e=>{e.persisted&&o()};return document.addEventListener(`focusin`,r),document.addEventListener(`focusout`,i),document.addEventListener(`visibilitychange`,s),window.addEventListener(`blur`,a),window.addEventListener(`focus`,o),window.addEventListener(`pageshow`,c),()=>{document.removeEventListener(`focusin`,r),document.removeEventListener(`focusout`,i),document.removeEventListener(`visibilitychange`,s),window.removeEventListener(`blur`,a),window.removeEventListener(`focus`,o),window.removeEventListener(`pageshow`,c),t!==null&&window.clearTimeout(t),rt.current=`idle`}},[De,A,e?.id]),(0,x.useEffect)(()=>{let t=De.current;if(!t||!e?.id||!j&&!A)return;let n={x:0,y:0},r=0,i=!1,a=null,o=0,s=0,c=0,l=Math.round(T*E),u=null,d=null,f=!1,p=null,m=()=>{let e=window.getComputedStyle(t).getPropertyValue(`--xterm-cell-height`).trim(),n=Number.parseFloat(e);return!Number.isNaN(n)&&n>0?n:Math.round(T*E)},h=()=>t.querySelector(`.xterm-helper-textarea`),g=e=>{let n=ke.current;if(!n)return null;let r=(t.querySelector(`.xterm`)?.querySelector(`.xterm-screen`))?.getBoundingClientRect();if(!r||r.width<=0||r.height<=0)return null;let i=r.width/n.cols,a=r.height/n.rows;return i<=0||a<=0?null:{col:Math.min(n.cols,Math.max(1,Math.floor((e.clientX-r.left)/i)+1)),row:Math.min(n.rows,Math.max(1,Math.floor((e.clientY-r.top)/a)+1))}},_=()=>{let e=h();e&&document.activeElement!==e&&(e.disabled=!0)},v=()=>{let e=h();e&&(e.disabled=!1)};_();let y=()=>{if(Ae.current)return;let e=h();e&&(e.disabled=!1,e.focus())},b=()=>{u!==null&&(cancelAnimationFrame(u),u=null),s=0},x=()=>{d!==null&&(clearTimeout(d),d=null)},S=(e,t,n)=>{let r=et.current;return r?(tt.current({type:`terminal-input`,sessionId:r,data:`\x1b[<${e};${t.col};${t.row}${n}`}),!0):!1},C=e=>{let t=et.current;if(!t||e===0)return!1;let n=ke.current,r=n?.cols??80,i=n?.rows??24,a=Math.floor(r/2),o=Math.floor(i/2),s=e>0?65:64,c=Math.abs(e),l=e<0;for(let e=0;e<c;e++)tt.current({type:`terminal-input`,sessionId:t,data:`\x1b[<${s};${a};${o}M`});return l&&!Me.current&&Ne(!0),l},w=e=>{let t=et.current,n=g(e);return!t||!n?!1:(tt.current({type:`terminal-input`,sessionId:t,data:`\x1b[<0;${n.col};${n.row}M\x1b[<0;${n.col};${n.row}m`}),!0)},D=e=>{if(!A||!Me.current)return!1;let t=g(e);return t?(f=!0,p=t,_(),QG(),S(0,t,`M`)):!1},O=e=>{let t=g(e);return t?p&&p.col===t.col&&p.row===t.row?!0:(p=t,S(32,t,`M`)):!1},k=e=>{let t=e?g(e):p;return f=!1,p=null,t?S(0,t,`m`):!1},M=()=>{x(),f=!1,p=null,a=null,s=0,c=0},N=()=>{if(!A)return!1;let e=window.getSelection();if(!e||e.isCollapsed)return!1;let n=t.querySelector(`.xterm-accessibility-tree`);if(!n)return!1;let r=e.anchorNode,i=e.focusNode;return!!r&&n.contains(r)||!!i&&n.contains(i)},P=()=>{!A||!ie.current||N()||W.current?.()},F=e=>{if(b(),P(),Ue.current||V){M();return}if($e.current){M();return}if(rt.current===`armed`&&!Ae.current&&(rt.current=`idle`,y()),e.touches.length===1){let t=e.touches[0];if(n={x:t.clientX,y:t.clientY},r=performance.now(),i=!1,a=t.clientY,o=r,s=0,c=0,l=m(),v(),A&&Me.current){let e={clientX:t.clientX,clientY:t.clientY};d=setTimeout(()=>{d=null,!(i||Ue.current||V)&&($e.current||N()||D(e))},350)}}},I=e=>{if(e.touches.length!==1||a===null)return;if(P(),Ue.current||V){M();return}let t=performance.now(),r=e.touches[0],u=r.clientX,d=r.clientY;if(f){e.preventDefault(),e.stopPropagation(),O(r),a=d,o=t;return}if($e.current||N()){M();return}e.preventDefault(),e.stopPropagation();let p=Math.abs(u-n.x),m=Math.abs(d-n.y);!i&&(p>6||m>6)&&(i=!0,x(),_());let h=a-d,g=t-o;if(a=d,o=t,g>0){let e=h/g;s=s*.7+e*.3}c+=h;let v=Math.max(6,l*.6),y=Math.trunc(c/v);y!==0&&(C(y),c-=y*v)},L=e=>{let t=s,n=performance.now()-r;if(x(),f){k(e.changedTouches[0]),M(),e.preventDefault(),e.stopPropagation();return}if(M(),Ue.current||V)return;let a=N();if($e.current&&!a&&W.current?.(),$e.current||a){Ae.current&&(nt.current=!0);return}if(!i){if(A&&n>=350)return;if(Me.current){let t=e.changedTouches[0];if(t&&w(t)){y(),e.preventDefault(),e.stopPropagation();return}}if(Ae.current){e.preventDefault(),e.stopPropagation(),nt.current=!0;return}y();return}if(Math.abs(t)>.12){let e=t,n=performance.now(),r=()=>{let t=performance.now(),i=t-n;n=t;let a=e*i;c+=a;let o=Math.max(6,l*.6),s=Math.trunc(c/o);s!==0&&(C(s),c-=s*o),e*=.95**(i/16.67),u=Math.abs(e)>.02?requestAnimationFrame(r):null};u=requestAnimationFrame(r)}},R=e=>{nt.current&&=(e.preventDefault(),e.stopPropagation(),!1)},z={passive:!0,capture:!0},B={passive:!1,capture:!0},ee={passive:!1,capture:!0},H={capture:!0};return t.addEventListener(`touchstart`,F,z),t.addEventListener(`touchmove`,I,B),t.addEventListener(`touchend`,L,ee),t.addEventListener(`mousedown`,R,H),()=>{t.removeEventListener(`touchstart`,F,z),t.removeEventListener(`touchmove`,I,B),t.removeEventListener(`touchend`,L,ee),t.removeEventListener(`mousedown`,R,H),x();let e=h();e&&(e.disabled=!1)}},[e?.id,De,ke,A,j,V,T,E]);let it=(0,x.useCallback)(t=>{!e||ye||!Ie||s({type:`terminal-input`,sessionId:e.id,data:t})},[e,ye,Ie,s]),at=(0,x.useCallback)(t=>{!e||ye||!Ie||(Ae.current&&(s({type:`tmux-cancel-copy-mode`,sessionId:e.id}),Ne(!1)),s({type:`terminal-paste`,sessionId:e.id,data:t}))},[e,ye,Ie,s,Ae,Ne]),ot=(0,x.useCallback)(t=>{!e||ye||!Ie||(Ae.current&&(s({type:`tmux-cancel-copy-mode`,sessionId:e.id}),Ne(!1)),it(t))},[e,ye,Ie,s,Ae,Ne,it]),st=(0,x.useCallback)(()=>{let e=De.current;if(!e)return;let t=e.querySelector(`.xterm-helper-textarea`);t&&(t.removeAttribute(`disabled`),t.focus())},[De]),ct=IG({sessionId:e?.id??null,disabled:a!==`connected`||ye||!Ie,fileUploadsAllowed:!pe,agentType:e?.agentType,onPasteText:at,onPasteImage:ot,onRefocus:st});de.current=ct.paste,fe.current=ct.fail;let lt=(0,x.useCallback)(()=>{if(!e||ye||!Ie)return;Ae.current&&(s({type:`tmux-cancel-copy-mode`,sessionId:e.id}),Ne(!1));let t=De.current;if(!t)return;let n=t.querySelector(`.xterm-helper-textarea`);n&&(n.removeAttribute(`disabled`),n.focus())},[e,ye,Ie,s,De,Ae,Ne]),ut=(0,x.useCallback)(()=>{if(typeof document>`u`)return!1;let e=De.current;if(!e)return!1;let t=e.querySelector(`.xterm-helper-textarea`);if(t&&document.activeElement===t)return!0;let n=document.activeElement,r=typeof HTMLInputElement<`u`&&n instanceof HTMLInputElement,i=typeof HTMLTextAreaElement<`u`&&n instanceof HTMLTextAreaElement;return r||i||n&&n.isContentEditable?!1:!!document.documentElement?.classList?.contains(`keyboard-visible`)},[De]);(0,x.useEffect)(()=>{if(!A)return;let e=De.current;if(!e)return;let t=e.querySelector(`.xterm-accessibility`),n=e.querySelector(`.xterm-accessibility-tree`);if(!t||!n)return;let r=()=>{let r=e.querySelector(`.xterm-helper-textarea`);r&&document.activeElement===r&&!$e.current?(t.style.pointerEvents=`none`,n.style.pointerEvents=`none`):(t.style.removeProperty(`pointer-events`),n.style.removeProperty(`pointer-events`))};return r(),document.addEventListener(`focusin`,r),document.addEventListener(`focusout`,r),()=>{document.removeEventListener(`focusin`,r),document.removeEventListener(`focusout`,r)}},[De,A,P]),(0,x.useEffect)(()=>{let e=De.current;e&&(e.inert=!!n)},[De,n]);let dt=(0,x.useMemo)(()=>{if(!ve||t.length===0)return!1;let e=t.map(e=>e.name.trim()).filter(Boolean);return e.length===t.length&&new Set(e).size===t.length},[ve,t]);return(0,G.jsxs)(`section`,{className:`flex flex-1 flex-col bg-base terminal-mobile-overlay md:relative md:inset-auto ${A?`ios-native-term-selection`:``}`,"data-testid":`terminal-panel`,onDragOver:t=>{Array.from(t.dataTransfer.types).includes(`Files`)&&(t.preventDefault(),t.dataTransfer.dropEffect=e&&!ye&&Ie&&!pe&&a===`connected`?`copy`:`none`)},onDrop:t=>{if(!Array.from(t.dataTransfer.types).includes(`Files`)||(t.preventDefault(),t.stopPropagation(),!e||ye||!Ie||pe||a!==`connected`))return;let n=nW(t.dataTransfer);n.length&&ct.paste({text:``,files:n})},children:[(0,G.jsxs)(`div`,{className:`flex min-h-[52px] shrink-0 items-center justify-between border-b border-border bg-elevated px-[6px] md:hidden`,children:[(0,G.jsxs)(`div`,{className:`flex min-w-0 items-center gap-[7px]`,children:[(0,G.jsx)(`button`,{onClick:()=>ee(!0),className:`flex size-[44px] shrink-0 items-center justify-center rounded border border-border bg-surface text-secondary transition-all hover:bg-hover hover:text-primary active:scale-95`,"aria-label":`Open session menu`,children:(0,G.jsx)(Ee,{width:16,height:16})}),e?(0,G.jsxs)(`div`,{className:`flex min-w-[72px] flex-col items-start gap-px leading-none`,children:[H?(0,G.jsx)(`input`,{ref:ce,type:`text`,value:ne,onChange:e=>re(e.target.value),onBlur:Ze,onKeyDown:Qe,className:`w-full max-w-[112px] rounded border border-border bg-surface px-2 py-0.5 text-sm font-medium text-primary outline-none focus:border-accent`}):(0,G.jsx)(`span`,{className:`max-w-[112px] truncate text-sm font-medium text-primary`,children:e.agentSessionName||e.name}),(0,G.jsx)(`span`,{className:`shrink-0 text-[10px] ${a===`connected`?YW[e.status]:`text-approval`}`,children:a===`connected`?JW[e.status]:a})]}):n?(0,G.jsxs)(`div`,{className:`flex min-w-0 flex-col items-start gap-px leading-none`,children:[(0,G.jsx)(`span`,{className:`max-w-[112px] truncate text-sm font-medium text-primary`,children:xe}),(0,G.jsx)(`span`,{className:`text-[10px] font-medium text-blue-400`,children:`Hibernating`})]}):(0,G.jsx)(`span`,{className:`text-sm font-medium text-primary`,children:`Sessions`})]}),(0,G.jsxs)(`div`,{className:`flex shrink-0 items-center gap-[4px]`,children:[(0,G.jsx)(`button`,{onClick:f,className:`flex size-[44px] items-center justify-center rounded bg-accent text-white transition-all hover:bg-accent/90 active:scale-95`,title:`New session (${k}N)`,"aria-label":`New session`,children:(0,G.jsx)(Pe,{width:16,height:16})}),e&&be&&(0,G.jsx)(`button`,{disabled:Fe,onClick:()=>L(!0),className:`flex size-[44px] items-center justify-center rounded border border-danger/30 bg-danger/10 text-danger transition-all hover:bg-danger/20 active:scale-95 disabled:cursor-not-allowed disabled:opacity-40`,title:`Kill session (${k}X)`,"aria-label":`Kill session`,children:(0,G.jsx)(We,{width:16,height:16})}),we&&(0,G.jsx)(`button`,{onClick:qe,className:`hidden size-[44px] items-center justify-center rounded border border-border text-secondary transition-all hover:bg-hover hover:text-primary active:scale-95 min-[360px]:flex`,title:`Hibernate session`,"aria-label":`Hibernate session`,children:(0,G.jsx)(Oe,{width:16,height:16})}),n&&(0,G.jsx)(`button`,{onClick:()=>g(n.sessionId),className:`btn btn-primary h-[44px] px-3 text-xs`,children:`Wake`}),e&&(0,G.jsxs)(`div`,{className:`relative`,ref:oe,children:[(0,G.jsx)(`button`,{onClick:()=>B(!z),className:`flex size-[44px] items-center justify-center rounded border border-border bg-surface text-secondary transition-all hover:bg-hover hover:text-primary active:scale-95`,title:`More options`,"aria-label":`More options`,children:(0,G.jsx)(me,{width:16,height:16})}),z&&(0,G.jsxs)(`div`,{className:`absolute right-0 top-full mt-1 z-20 min-w-[140px] rounded-md border border-border bg-elevated shadow-lg py-1`,children:[be&&(0,G.jsxs)(`button`,{onClick:Ye,className:`flex min-h-[44px] w-full items-center gap-2 px-3 py-2 text-left text-sm text-secondary hover:bg-hover hover:text-primary`,children:[(0,G.jsx)(ge,{width:14,height:14}),`Rename`]}),we&&(0,G.jsxs)(`button`,{onClick:qe,className:`flex min-h-[44px] w-full items-center gap-2 px-3 py-2 text-left text-sm text-secondary hover:bg-hover hover:text-primary`,children:[(0,G.jsx)(Oe,{width:14,height:14}),`Hibernate`]}),(0,G.jsxs)(`button`,{onClick:()=>{y(),B(!1)},className:`flex min-h-[44px] w-full items-center gap-2 px-3 py-2 text-left text-sm text-secondary hover:bg-hover hover:text-primary`,children:[(0,G.jsx)(Re,{width:14,height:14}),`Settings`]})]})]})]})]}),e&&t.length>1&&(0,G.jsxs)(`div`,{className:`relative overflow-hidden bg-elevated border-b border-border md:hidden`,children:[(0,G.jsx)(`div`,{className:`absolute right-0 top-0 bottom-0 w-4 bg-gradient-to-l from-elevated to-transparent z-10 pointer-events-none`}),(0,G.jsx)(`div`,{ref:se,className:`flex items-center gap-[6px] overflow-x-auto scroll-pe-4 px-[8px] py-[5px] scrollbar-none snap-x snap-mandatory`,style:{WebkitOverflowScrolling:`touch`},children:t.map((t,n)=>{let r=t.id===e.id,i=dt?t.name.trim():n+1;return(0,G.jsx)(`button`,{type:`button`,"data-session-id":t.id,className:`
|
|
300
300
|
flex items-center justify-center shrink-0 snap-start
|
|
301
301
|
h-[44px] ${dt?`min-w-[44px] px-2.5 max-w-[8rem] truncate`:`w-[44px]`}
|
|
302
302
|
text-sm font-extrabold rounded-lg
|
|
303
303
|
active:scale-95 transition-all duration-75
|
|
304
304
|
select-none touch-manipulation
|
|
305
305
|
${r?ZG[t.status]:XG[t.status]}
|
|
306
|
-
`,onClick:()=>{QG(),u(t.id)},title:dt?t.name:void 0,children:i},t.id)})})]}),(0,G.jsxs)(`div`,{className:`relative flex-1`,children:[(0,G.jsx)(`div`,{ref:De,className:`absolute inset-0`,style:{backgroundColor:C.background}}),Fe&&e&&(0,G.jsxs)(`div`,{role:`status`,"aria-live":`polite`,className:`absolute top-2 left-2 z-50 flex items-center gap-1.5 rounded-lg bg-black/60 px-2.5 py-1.5 text-xs text-white/90 shadow-lg backdrop-blur-md`,children:[(0,G.jsxs)(`svg`,{className:`h-3 w-3 animate-spin`,viewBox:`0 0 24 24`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,children:[(0,G.jsx)(`circle`,{className:`opacity-25`,cx:`12`,cy:`12`,r:`10`,stroke:`currentColor`,strokeWidth:`4`}),(0,G.jsx)(`path`,{className:`opacity-75`,fill:`currentColor`,d:`M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z`})]}),`Loading`]}),Le&&e&&(0,G.jsxs)(`div`,{className:`absolute ${M&&!P?`bottom-20`:`bottom-8`} left-1/2 z-30 flex max-w-[calc(100%-2rem)] -translate-x-1/2 items-center gap-2 rounded-lg border border-border bg-elevated/95 px-2 py-2 shadow-lg backdrop-blur-sm md:hidden`,children:[(0,G.jsx)(`span`,{className:`max-w-[12rem] truncate text-xs text-secondary md:max-w-[18rem]`,children:`Selection ready`}),(0,G.jsxs)(`button`,{type:`button`,onClick:ze,className:`flex h-8 shrink-0 items-center justify-center gap-1.5 rounded bg-accent px-2.5 text-xs font-medium text-white hover:bg-accent/90 active:scale-95 transition-all`,title:`Copy selection`,"aria-label":`Copy selection`,children:[(0,G.jsx)(ue,{width:14,height:14}),`Copy`]}),(0,G.jsx)(`button`,{type:`button`,onClick:Be,className:`flex h-8 w-8 shrink-0 items-center justify-center rounded border border-border text-secondary hover:bg-hover hover:text-primary active:scale-95 transition-all`,title:`Dismiss`,"aria-label":`Dismiss`,children:(0,G.jsx)(We,{width:14,height:14})})]}),!e&&(0,G.jsx)(`div`,{className:`absolute inset-0 flex items-center justify-center text-sm text-muted`,children:n?null:`Select a session to view terminal`}),e&&ye&&(0,G.jsx)(`div`,{className:`absolute inset-0 flex items-center justify-center text-center text-sm text-muted`,children:`Remote session (read-only). Use SSH to attach on the host.`}),n&&(0,G.jsx)(`div`,{className:`absolute inset-0 z-10 overflow-y-auto bg-base`,children:(0,G.jsxs)(`div`,{className:`mx-auto flex min-h-full w-full max-w-5xl flex-col gap-4 p-4 md:p-6`,children:[(0,G.jsx)(`div`,{className:`border-b border-border pb-4`,children:(0,G.jsxs)(`div`,{className:`flex flex-col gap-3 md:flex-row md:items-start md:justify-between`,children:[(0,G.jsxs)(`div`,{className:`min-w-0 space-y-2`,children:[(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-2 gap-y-1 text-sm`,children:[(0,G.jsx)(`h2`,{className:`min-w-0 truncate text-lg font-semibold text-primary`,children:xe}),(0,G.jsx)(`span`,{className:`rounded-full bg-blue-500/15 px-2 py-0.5 text-[10px] font-semibold uppercase tracking-wide text-blue-400`,children:`Hibernating`}),Se&&(0,G.jsx)(`span`,{className:`text-muted`,children:Se}),(0,G.jsxs)(`span`,{className:`text-muted`,children:[`Last active `,Ce]})]}),n.lastResumeError&&(0,G.jsxs)(`div`,{className:`inline-flex items-center gap-1 rounded bg-amber-500/15 px-2 py-1 text-xs text-amber-400`,title:`Last wake failed: ${n.lastResumeError}`,children:[(0,G.jsx)(W,{width:12,height:12}),`Last wake failed`]}),n.lastUserMessage&&(0,G.jsx)(`p`,{className:`max-h-28 max-w-3xl overflow-y-auto whitespace-pre-wrap break-words pr-2 text-sm leading-6 text-secondary`,children:n.lastUserMessage})]}),(0,G.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2`,children:[(0,G.jsx)(`button`,{type:`button`,onClick:()=>g(n.sessionId),className:`btn btn-primary hidden md:inline-flex`,children:`Wake`}),v&&(0,G.jsx)(`button`,{type:`button`,onClick:()=>v(n.sessionId),className:`btn btn-secondary`,children:`Move to History`})]})]})}),(0,G.jsx)(zD,{session:n})]})}),je&&e&&!P?(0,G.jsxs)(`button`,{type:`button`,onClick:Ve,className:`absolute bottom-14 left-1/2 z-20 flex h-10 items-center justify-center overflow-hidden rounded-full border border-amber-400/35 bg-amber-500/20 text-amber-100 shadow-lg backdrop-blur-sm transition-all hover:bg-amber-500/30 active:scale-95 md:hidden`,style:{transform:`translateX(-50%)`},title:`Exit tmux copy mode and return to live output`,"aria-label":`Exit copy mode`,children:[(0,G.jsx)(`span`,{className:`px-3 text-[11px] font-semibold uppercase tracking-wide`,children:`Copy mode`}),(0,G.jsx)(`span`,{className:`self-stretch border-l border-amber-400/25`,"aria-hidden":`true`}),(0,G.jsx)(`span`,{className:`px-3 text-sm font-medium`,children:`Exit`})]}):M&&e&&!P?(0,G.jsxs)(`button`,{type:`button`,onClick:Ve,className:`absolute bottom-8 left-1/2 z-20 flex h-10 px-4 items-center justify-center gap-1.5 rounded-full bg-blue-600/90 text-white shadow-lg hover:bg-blue-600 active:scale-95 transition-all md:hidden`,style:{transform:`translateX(-50%)`},title:`Scroll to bottom`,"aria-label":`Scroll to bottom`,children:[(0,G.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:`18`,height:`18`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2.5`,strokeLinecap:`round`,strokeLinejoin:`round`,children:(0,G.jsx)(`path`,{d:`M12 5v14M5 12l7 7 7-7`})}),(0,G.jsx)(`span`,{className:`text-sm font-medium`,children:`Jump to bottom`})]}):null]}),(0,G.jsx)(PG,{...ct}),(0,G.jsx)(aG,{session:e,hibernatingSession:n,hibernatingDisplayName:xe,showHostBadge:Te,sessionCount:t.length,connectionStatus:a,isSwitching:Fe,canControl:be,canHibernate:we,modDisplay:k,onKill:()=>L(!0),onHibernate:qe,onWake:()=>n&&g(n.sessionId),onRename:t=>{let r=e?.id??n?.sessionId;r&&m(r,t)},onDuplicate:e&&h?()=>h(e.id):void 0,onMoveToHistory:n&&v?()=>v(n.sessionId):void 0,isTmuxCopyMode:je,showJumpToBottom:M&&!P,onJumpToBottom:Ve,selectionReady:!!Le,onCopySelection:ze,onDismissSelection:Be}),e&&(0,G.jsx)(JG,{onSendKey:it,onPasteText:at,onPasteImage:ot,disabled:a!==`connected`||ye||!Ie,sessions:t.map(e=>({id:e.id,name:e.name,status:e.status})),currentSessionId:e.id,agentType:e.agentType,fileUploadsAllowed:!pe,onSelectSession:u,hideSessionSwitcher:!0,onRefocus:st,isKeyboardVisible:ut,onEnterTextMode:lt}),(j||A)&&(0,G.jsx)(YG,{isOpen:B,onClose:()=>te(!1),sessions:t,hibernatingSessions:r,historySessions:i,selectedSessionId:e?.id??null,selectedHibernatingSessionId:n?.sessionId??null,onSelect:u,onSelectHibernating:d,onRename:m,onResume:g,onHibernate:_,onMoveToHistory:v,onNewSession:f,loading:b,error:S}),I&&e&&(0,G.jsx)(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center bg-black/50`,children:(0,G.jsxs)(`div`,{className:`mx-4 w-full max-w-sm rounded-lg border border-border bg-elevated p-4 shadow-xl`,children:[(0,G.jsx)(`h3`,{className:`text-base font-medium text-primary mb-2 text-balance`,children:`Kill Session`}),(0,G.jsxs)(`p`,{className:`text-sm text-secondary mb-4 text-pretty`,children:[`Kill "`,e.agentSessionName||e.name,`"? The process will be terminated. Conversation history is preserved in logs.`]}),(0,G.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,G.jsx)(`button`,{onClick:()=>L(!1),className:`btn py-1.5 px-3 text-sm`,children:`Cancel`}),(0,G.jsx)(`button`,{ref:le,onClick:Ke,className:`btn btn-danger py-1.5 px-3 text-sm`,children:`Kill Session`})]})]})})]})}function eK({onSelect:e,onCancel:t,initialPath:n}){let[r,i]=(0,x.useState)(n||`~`),[a,o]=(0,x.useState)(null),[s,c]=(0,x.useState)(null),[l,u]=(0,x.useState)(!0),[d,f]=(0,x.useState)(-1),p=(0,x.useRef)(null),m=H(e=>e.recentPaths),h=(0,x.useCallback)(async e=>{p.current?.abort();let t=new AbortController;p.current=t;let{signal:n}=t;u(!0),c(null),o(null),f(-1),i(e);try{let r=await fetch(`/api/directories?path=${encodeURIComponent(e)}`,{signal:n});if(!r.ok){let e=await r.json();throw Error(e.message||`Failed to load directory`)}let a=await r.json();if(p.current!==t)return;o(a),i(a.path)}catch(e){if(p.current!==t)return;let n=e;n?.name!==`AbortError`&&c(n?.message||`Failed to load directory`)}finally{p.current===t&&u(!1)}},[]);(0,x.useEffect)(()=>(h(n||`~`),()=>{p.current?.abort()}),[h,n]);let g=a?.directories??[],_=a?.path||r,v=a?.parent;return(0,x.useEffect)(()=>{let n=n=>{if(n.key===`Escape`){n.preventDefault(),t();return}if(!l){if(n.key===`ArrowDown`){n.preventDefault(),f(e=>g.length===0?-1:e<0?0:Math.min(e+1,g.length-1));return}if(n.key===`ArrowUp`){n.preventDefault(),f(e=>g.length===0?-1:e<0?g.length-1:Math.max(e-1,0));return}if(n.key===`Enter`){n.preventDefault();let t=g[d];t?h(t.path):_&&e(_);return}n.key===`Backspace`&&v&&(n.preventDefault(),h(v))}};return window.addEventListener(`keydown`,n),()=>window.removeEventListener(`keydown`,n)},[g,_,h,d,l,t,e,v]),(0,G.jsx)(`div`,{role:`dialog`,"aria-modal":`true`,"aria-label":`Directory browser`,className:`fixed inset-0 z-[60] flex items-center justify-center bg-black/60 p-4`,onClick:e=>{e.target===e.currentTarget&&t()},"data-testid":`directory-browser`,children:(0,G.jsxs)(`div`,{className:`w-full max-w-lg border border-border bg-elevated p-4`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-3 border-b border-border pb-2`,children:[(0,G.jsx)(`button`,{type:`button`,className:`btn`,onClick:()=>{v&&h(v)},disabled:!v||l,children:`Up`}),(0,G.jsx)(`div`,{className:`min-w-0 flex-1 truncate text-xs font-mono text-secondary`,title:_,"data-testid":`directory-current-path`,children:_})]}),(0,G.jsx)(`div`,{className:`mt-3 max-h-60 overflow-y-auto border border-border bg-surface`,children:l?(0,G.jsx)(`div`,{className:`px-3 py-4 text-xs text-muted`,"data-testid":`directory-loading`,children:`Loading directories...`}):s?(0,G.jsxs)(`div`,{className:`px-3 py-4 text-xs`,"data-testid":`directory-error`,children:[(0,G.jsx)(`p`,{className:`text-danger`,children:s}),(0,G.jsx)(`button`,{type:`button`,className:`btn mt-3`,onClick:()=>h(r),children:`Retry`})]}):g.length===0?(0,G.jsx)(`div`,{className:`px-3 py-4 text-xs text-muted`,"data-testid":`directory-empty`,children:`No subdirectories`}):(0,G.jsx)(`div`,{className:`py-1`,children:g.map((e,t)=>(0,G.jsxs)(`button`,{type:`button`,onClick:()=>h(e.path),onMouseEnter:()=>f(t),className:`flex w-full items-center gap-2 px-3 py-2 text-left text-xs ${t===d?`bg-hover text-primary`:`text-secondary`}`,"data-testid":`directory-entry`,"data-entry-name":e.name,"data-entry-path":e.path,children:[(0,G.jsx)(be,{width:14,height:14,className:`shrink-0 text-muted`,"aria-hidden":`true`}),(0,G.jsx)(`span`,{className:`truncate`,children:e.name})]},e.path))})}),a?.truncated?(0,G.jsx)(`p`,{className:`mt-2 text-[10px] text-muted`,children:`Showing first 200 directories.`}):null,(0,G.jsxs)(`div`,{className:`mt-4 border-t border-border pt-3`,children:[(0,G.jsx)(`div`,{className:`text-[10px] uppercase tracking-wider text-secondary`,children:`Recent`}),m.length===0?(0,G.jsx)(`p`,{className:`mt-2 text-xs text-muted`,children:`No recent paths yet.`}):(0,G.jsx)(`div`,{className:`mt-2 space-y-1`,children:m.map(e=>(0,G.jsx)(`button`,{type:`button`,className:`block w-full truncate text-left text-xs text-secondary hover:text-primary`,onClick:()=>h(e),title:e,"data-testid":`directory-recent`,"data-recent-path":e,children:e},e))})]}),(0,G.jsxs)(`div`,{className:`mt-4 flex justify-end gap-2`,children:[(0,G.jsx)(`button`,{type:`button`,onClick:t,className:`btn`,children:`Cancel`}),(0,G.jsx)(`button`,{type:`button`,onClick:()=>{_&&e(_)},className:`btn btn-primary`,disabled:l||!_,children:`Select`})]})]})})}function tK(e){let t=e.trim();if(t.length>=2){let e=t[0],n=t[t.length-1];if(e===`'`&&n===`'`)return t.slice(1,-1).replace(/'\\''/g,`'`);if(e===`"`&&n===`"`)return t.slice(1,-1).replace(/\\"/g,`"`).replace(/\\\\/g,`\\`)}return t}function nK(e){let t=e.trim(),n=t.search(/\s/);if(n===-1||t.slice(0,n).split(`/`).pop()!==`bash`)return null;let r=n;for(;r<t.length&&/\s/.test(t[r]);)r++;let i=!1,a=!1;for(;r<t.length;){let e=r;for(;r<t.length&&!/\s/.test(t[r]);)r++;let n=t.slice(e,r);for(;r<t.length&&/\s/.test(t[r]);)r++;if(!n.startsWith(`-`)||n===`-`)return null;if(n===`--`)break;if(n.startsWith(`--`)||!/^-[a-zA-Z]+$/.test(n))continue;let o=n.slice(1);if(o.includes(`l`)&&(i=!0),o.includes(`c`)){a=!0;break}}if(!i||!a)return null;let o=t.slice(r).trim();return o?tK(o):null}function rK(e){return e?e===`claude-rp`?`claude`:e:null}function iK(e){let t=e.trim();if(!t)return``;let n=tK(t);return nK(n)??n}function aK(e){if(e===`claude`)return`claude`;if(e===`codex`)return`codex`;if(e===`pi`)return`pi`;if(e===`devin`||e===`devin-cli`)return`devin`;if(e===`grok`||e.startsWith(`grok-`))return`grok`;if(e===`omp`)return`omp`}function oK(e){let t=/\S+/g,n;for(;n=t.exec(e);){let e=n[0].toLowerCase().replace(/^["']+|["']+$/g,``);if([`npx`,`bunx`,`pnpm`,`yarn`,`env`].includes(e)||e.includes(`=`)||e.startsWith(`-`))continue;let t=e.includes(`@oh-my-pi/`)?`omp`:aK(e.split(`/`).pop()||e);return t?{agentType:t,end:n.index+n[0].length}:void 0}}function sK(e){let t=iK(e);if(t)return oK(t.toLowerCase().trim().replace(/^["']|["']$/g,``))?.agentType}var cK={claude:`--dangerously-skip-permissions`,codex:`--yolo`,grok:`--always-approve`,devin:`--permission-mode dangerous`,pi:null,omp:`--auto-approve`},lK={claude:[`--dangerously-skip-permissions`,`--permission-mode bypassPermissions`,`--permission-mode=bypassPermissions`],codex:[`--yolo`,`--dangerously-bypass-approvals-and-sandbox`],grok:[`--always-approve`,`--yolo`,`--dangerously-skip-permissions`,`--permission-mode bypassPermissions`,`--permission-mode=bypassPermissions`],devin:[`--permission-mode dangerous`,`--permission-mode=dangerous`],pi:[],omp:[`--auto-approve`,`--approval-mode yolo`,`--approval-mode=yolo`]};function uK(e){let t=rK(e);return t?cK[t]:null}function dK(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function fK(e){return RegExp(`(^|\\s)${dK(e)}(?=\\s|$)`,`g`)}function pK(e,t){return(t?[rK(t)].filter(e=>e!==null):Object.keys(lK)).some(t=>lK[t].some(t=>fK(t).test(e)))}function mK(e,t){let n=oK(e);return n?`${e.slice(0,n.end)} ${t}${e.slice(n.end)}`:null}function hK(e,t){let n=uK(t);if(!n)return e;let r=e.trim();if(!r||pK(r,t))return r;let i=mK(r,n);if(i)return i;let a=iK(r);if(a&&a!==r){let e=mK(a,n);if(e)return`bash -lc '${e.replace(/'/g,`'\\''`)}'`}return`${r} ${n}`}function gK(e,t){let n=rK(t);if(!n||pK(e,t))return null;if(n===`codex`){let t=/(^|\s)(--full-auto|--ask-for-approval|-a)(?=\s|=|$)/.exec(e);if(t)return`conflicts with ${t[2]}`}if(n===`omp`){let t=/(^|\s)--approval-mode(?:\s+|=)(always-ask|write)/.exec(e);if(t)return`conflicts with --approval-mode ${t[2]}`}let r=/(^|\s)--permission-mode(?:\s+|=)(\S+)/.exec(e);return r&&n!==`codex`?`conflicts with --permission-mode ${r[2]}`:null}function _K(e,t){let n=rK(t);if(!n)return e;let r=e;for(let e of lK[n])r=r.replace(fK(e),` `);return r.replace(/\s+/g,` `).trim()}function vK({isOpen:e,onClose:t,onCreate:n,defaultProjectDir:r,commandPresets:i,defaultPresetId:a,lastProjectPath:o,activeProjectPath:s,remoteHosts:c=[],remoteAllowControl:l=!1,initialHost:u,initialPath:d,initialCommand:f}){let[p,m]=(0,x.useState)(``),[h,g]=(0,x.useState)(``),[_,v]=(0,x.useState)(null),[y,b]=(0,x.useState)(``),[S,C]=(0,x.useState)(!1),[w,T]=(0,x.useState)(``),E=H(e=>e.yoloMode),D=H(e=>e.setYoloMode),O=(0,x.useRef)(null),k=(0,x.useRef)(null),A=(0,x.useRef)(null),j=(0,x.useRef)(!1),M=l&&c.length>0,N=e=>{if(!E)return e;let t=sK(e);return t&&!gK(e,t)?hK(e,t):e},P=e=>{let t=i.find(t=>t.id===e);t&&(v(e),b(N(te(t))))},F=()=>{v(null),b(``)};if((0,x.useEffect)(()=>{let t=j.current;if(j.current=e,!e){m(``),g(``),v(null),b(``),C(!1),T(u??``),t&&setTimeout(()=>{if(typeof document>`u`||typeof document.querySelector!=`function`)return;let e=document.querySelector(`.xterm-helper-textarea`);e&&(e.removeAttribute(`disabled`),e.focus())},300);return}if(typeof document<`u`&&typeof document.querySelector==`function`){let e=document.querySelector(`.xterm-helper-textarea`);e&&typeof e.setAttribute==`function`&&(typeof e.blur==`function`&&e.blur(),e.setAttribute(`disabled`,`true`))}m(d?.trim()||s?.trim()||o||r||``),g(``),T(u??``);let n=f?.trim();if(n){let e=i.find(e=>te(e)===n);e?(v(e.id),b(te(e))):(v(null),b(n))}else{let e=i.find(e=>e.id===a);e?(v(a),b(N(te(e)))):i.length>0?(v(i[0].id),b(N(te(i[0])))):(v(null),b(``))}setTimeout(()=>{if(A.current?.focus(),k.current){let e=k.current;e.scrollLeft=e.scrollWidth}},50)},[s,i,a,r,e,o,u,d,f]),(0,x.useEffect)(()=>{if(!e||typeof window>`u`||typeof window.addEventListener!=`function`)return;let n=()=>O.current?Array.from(O.current.querySelectorAll(`input:not([disabled]), select:not([disabled]), button:not([disabled]):not([tabindex="-1"]), [tabindex="0"]`)):[],r=e=>{if(!S){if(e.key===`Escape`){typeof e.stopPropagation==`function`&&e.stopPropagation(),t();return}if(e.key===`Enter`){let t=document.activeElement;if(!t||t.tagName===`INPUT`||t.closest(`[data-testid="host-select"]`)||!t.closest(`[data-testid="command-select"]`))return;e.preventDefault(),typeof e.stopPropagation==`function`&&e.stopPropagation(),O.current?.requestSubmit();return}if(/^[0-9]$/.test(e.key)&&!e.metaKey&&!e.ctrlKey&&!e.altKey){let t=document.activeElement;if(t&&(t.tagName===`INPUT`||t.tagName===`TEXTAREA`||t.tagName===`SELECT`||t.isContentEditable))return;let n;if(e.key===`0`)n=i.length;else if(n=Number(e.key)-1,n>=i.length)return;e.preventDefault(),typeof e.stopPropagation==`function`&&e.stopPropagation(),n===i.length?F():P(i[n].id),(O.current?.querySelectorAll?.(`[data-testid="command-select"] [role="radio"]`))?.[n]?.focus();return}if(e.key===`Tab`){e.preventDefault(),typeof e.stopPropagation==`function`&&e.stopPropagation();let t=n();if(t.length===0)return;let r=document.activeElement,i=t.indexOf(r),a;a=i===-1?e.shiftKey?t.length-1:0:e.shiftKey?i<=0?t.length-1:i-1:i>=t.length-1?0:i+1,t[a]?.focus()}}};return window.addEventListener(`keydown`,r),()=>window.removeEventListener(`keydown`,r)},[e,t,S,i,E]),!e)return null;let I=_===null,L=w!==``,ee=sK(y),R=uK(ee)!==null,z=ee?pK(y,ee):!1,B=ee&&!z?gK(y,ee):null,V=!R||B!==null,ne=ee?ee===`pi`?`Pi has no permission prompts — nothing to enable`:B??`Append ${uK(ee)}`:`Enter a supported agent command (claude, codex, grok, devin)`,re=e=>{D(e),ee&&b(e?hK(y,ee):_K(y,ee))},U=e=>{e.preventDefault();let r=p.trim();if(!r)return;let i=y.trim();n(r,h.trim()||void 0,i||void 0,L?w:void 0),t()},ie=[...i.map(e=>({id:e.id,label:e.label,isCustom:!1,agentType:e.agentType,command:e.command})),{id:`custom`,label:`Custom`,isCustom:!0,agentType:void 0,command:void 0}],W=[{id:``,label:`Local`,ok:!0,error:void 0},...c.map(e=>({id:e.host,label:e.host,ok:e.ok,error:e.error}))],ae=p.trim()||`~`;return(0,G.jsxs)(`div`,{role:`dialog`,"aria-modal":`true`,"aria-labelledby":`new-session-title`,className:`fixed inset-0 z-50 flex items-center justify-center bg-black/60 p-4`,onClick:e=>{e.target===e.currentTarget&&t()},children:[(0,G.jsxs)(`form`,{ref:O,onSubmit:U,className:`w-full max-w-md border border-border bg-elevated p-6`,children:[(0,G.jsx)(`h2`,{id:`new-session-title`,className:`text-sm font-semibold uppercase tracking-wider text-primary text-balance`,children:`New Session`}),(0,G.jsxs)(`div`,{className:`mt-4 space-y-4`,children:[M&&(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`label`,{className:`mb-1.5 block text-xs text-secondary`,children:`Host`}),(0,G.jsx)(`div`,{className:`flex flex-wrap gap-2`,role:`radiogroup`,"aria-label":`Host`,"data-testid":`host-select`,children:W.map((e,t)=>{let n=w===e.id,r=!e.ok&&!n;return(0,G.jsx)(`button`,{type:`button`,role:`radio`,"aria-checked":n,"aria-label":e.label,title:e.ok?void 0:e.error||`Unreachable`,tabIndex:n?0:-1,onClick:()=>T(e.id),onKeyDown:e=>{let n=t;if(e.key===`ArrowRight`||e.key===`ArrowDown`)e.preventDefault(),n=(t+1)%W.length;else if(e.key===`ArrowLeft`||e.key===`ArrowUp`)e.preventDefault(),n=(t-1+W.length)%W.length;else return;let r=W[n];T(r.id),(e.currentTarget.parentElement?.querySelectorAll(`[role="radio"]`))?.[n]?.focus()},className:`btn text-xs focus:outline-none focus:ring-2 focus:ring-primary ${n?`btn-primary`:``} ${r?`opacity-60`:``}`,children:e.label},e.id||`local`)})})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`label`,{className:`mb-1.5 block text-xs text-secondary`,children:`Command`}),(0,G.jsx)(`div`,{className:`flex flex-wrap gap-2`,role:`radiogroup`,"aria-label":`Command preset`,"data-testid":`command-select`,children:ie.map((e,t)=>{let n=e.isCustom?I:_===e.id,r=e.isCustom?`0`:t<9?String(t+1):null;return(0,G.jsxs)(`button`,{ref:n?A:void 0,type:`button`,role:`radio`,"aria-checked":n,"aria-keyshortcuts":r??void 0,tabIndex:n?0:-1,onClick:()=>{e.isCustom?F():P(e.id)},onKeyDown:e=>{let n=t;if(e.key===`ArrowRight`||e.key===`ArrowDown`)e.preventDefault(),n=(t+1)%ie.length;else if(e.key===`ArrowLeft`||e.key===`ArrowUp`)e.preventDefault(),n=(t-1+ie.length)%ie.length;else return;let r=ie[n];r.isCustom?F():P(r.id),(e.currentTarget.parentElement?.querySelectorAll(`[role="radio"]`))?.[n]?.focus()},className:`btn text-xs focus:outline-none focus:ring-2 focus:ring-primary ${n?`btn-primary`:``}`,children:[r&&(0,G.jsx)(`kbd`,{"aria-hidden":`true`,className:`shortcut-badge`,children:r}),(0,G.jsx)(oh,{agentType:e.agentType,command:e.command,className:`inline-block h-3.5 w-3.5 shrink-0`}),e.label]},e.id)})}),(0,G.jsx)(`input`,{value:y,onChange:e=>b(e.target.value),placeholder:`Enter command...`,className:`input mt-2 font-mono text-xs`}),(0,G.jsxs)(`label`,{className:`mt-2 flex items-center gap-2 text-xs ${V?`text-muted opacity-60`:`text-secondary`}`,title:ne,children:[(0,G.jsx)(`input`,{type:`checkbox`,checked:z,disabled:V,onChange:e=>re(e.target.checked)}),`yolo mode — skip permission prompts`]})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`label`,{className:`mb-1.5 block text-xs text-secondary`,children:`Project Path`}),(0,G.jsxs)(`div`,{className:`flex gap-2`,children:[(0,G.jsx)(`input`,{ref:k,value:p,onChange:e=>m(e.target.value),placeholder:L?`/home/user/project`:s||o||r||`/Users/you/code/my-project`,className:`input flex-1 text-sm`}),!L&&(0,G.jsx)(`button`,{type:`button`,className:`btn`,onClick:()=>C(!0),children:`Browse`})]})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`label`,{className:`mb-1.5 block text-xs text-secondary`,children:`Display Name`}),(0,G.jsx)(`input`,{value:h,onChange:e=>g(e.target.value),placeholder:`auto-generated`,className:`input text-sm placeholder:italic`})]})]}),(0,G.jsxs)(`div`,{className:`mt-6 flex justify-end gap-2`,children:[(0,G.jsx)(`button`,{type:`button`,onClick:t,className:`btn`,children:`Cancel`}),(0,G.jsx)(`button`,{type:`submit`,className:`btn btn-primary`,children:`Create`})]})]}),S&&!L&&(0,G.jsx)(eK,{initialPath:ae,onSelect:e=>{m(e),C(!1)},onCancel:()=>C(!1)})]})}function yK({controlled:e,default:t,name:n,state:r=`value`}){let{current:i}=x.useRef(e!==void 0),[a,o]=x.useState(t);return[i?e:a,x.useCallback(e=>{i||o(e)},[])]}var bK={};function xK(e,t){let n=x.useRef(bK);return n.current===bK&&(n.current=e(t)),n}var SK=x[`useInsertionEffect${Math.random().toFixed(1)}`.slice(0,-3)],CK=SK&&SK!==x.useLayoutEffect?SK:e=>e();function wK(e){let t=xK(TK).current;return t.next=e,CK(t.effect),t.trampoline}function TK(){let e={next:void 0,callback:EK,trampoline:(...t)=>e.callback?.(...t),effect:()=>{e.callback=e.next}};return e}function EK(){}function DK(e,t,n,r){let i=xK(kK).current;return AK(i,e,t,n,r)&&MK(i,[e,t,n,r]),i.callback}function OK(e){let t=xK(kK).current;return jK(t,e)&&MK(t,e),t.callback}function kK(){return{callback:null,cleanup:null,refs:[]}}function AK(e,t,n,r,i){return e.refs[0]!==t||e.refs[1]!==n||e.refs[2]!==r||e.refs[3]!==i}function jK(e,t){return e.refs.length!==t.length||e.refs.some((e,n)=>e!==t[n])}function MK(e,t){if(e.refs=t,t.every(e=>e==null)){e.callback=null;return}e.callback=n=>{if(e.cleanup&&=(e.cleanup(),null),n!=null){let r=Array(t.length).fill(null);for(let e=0;e<t.length;e+=1){let i=t[e];if(i!=null)switch(typeof i){case`function`:{let t=i(n);typeof t==`function`&&(r[e]=t);break}case`object`:i.current=n;break;default:}}e.cleanup=()=>{for(let e=0;e<t.length;e+=1){let n=t[e];if(n!=null)switch(typeof n){case`function`:{let t=r[e];typeof t==`function`?t():n(null);break}case`object`:n.current=null;break;default:}}}}}}var NK=typeof document<`u`?x.useLayoutEffect:()=>{},PK={clipPath:`inset(50%)`,overflow:`hidden`,whiteSpace:`nowrap`,border:0,padding:0,width:1,height:1,margin:-1},FK={...PK,position:`fixed`,top:0,left:0},IK={...PK,position:`absolute`};function LK(){}Object.freeze([]);var RK=Object.freeze({});function zK(e,...t){let n=new URL(`https://base-ui.com/production-error`);return n.searchParams.set(`code`,e.toString()),t.forEach(e=>n.searchParams.append(`args[]`,e)),`Base UI error #${e}; visit ${n} for the full message.`}var BK=18;function VK(e){return BK>=e}function HK(e){if(!x.isValidElement(e))return null;let t=e,n=t.props;return(VK(19)?n?.ref:t.ref)??null}function UK(e,t){if(e&&!t)return e;if(!e&&t)return t;if(e||t)return{...e,...t}}function WK(e,t){let n={};for(let r in e){let i=e[r];if(t?.hasOwnProperty(r)){let e=t[r](i);e!=null&&Object.assign(n,e);continue}i===!0?n[`data-${r.toLowerCase()}`]=``:i&&(n[`data-${r.toLowerCase()}`]=i.toString())}return n}function GK(e,t){return typeof e==`function`?e(t):e}function KK(e,t){return typeof e==`function`?e(t):e}var qK={};function JK(e,t,n,r,i){let a={...eq(e,qK)};return t&&(a=XK(a,t)),n&&(a=XK(a,n)),r&&(a=XK(a,r)),i&&(a=XK(a,i)),a}function YK(e){if(e.length===0)return qK;if(e.length===1)return eq(e[0],qK);let t={...eq(e[0],qK)};for(let n=1;n<e.length;n+=1)t=XK(t,e[n]);return t}function XK(e,t){return $K(t)?t(e):ZK(e,t)}function ZK(e,t){if(!t)return e;for(let n in t){let r=t[n];switch(n){case`style`:e[n]=UK(e.style,r);break;case`className`:e[n]=rq(e.className,r);break;default:QK(n,r)?e[n]=tq(e[n],r):e[n]=r}}return e}function QK(e,t){let n=e.charCodeAt(0),r=e.charCodeAt(1),i=e.charCodeAt(2);return n===111&&r===110&&i>=65&&i<=90&&(typeof t==`function`||t===void 0)}function $K(e){return typeof e==`function`}function eq(e,t){return $K(e)?e(t):e??qK}function tq(e,t){return t?e?n=>{if(iq(n)){let r=n;nq(r);let i=t(r);return r.baseUIHandlerPrevented||e?.(r),i}let r=t(n);return e?.(n),r}:t:e}function nq(e){return e.preventBaseUIHandler=()=>{e.baseUIHandlerPrevented=!0},e}function rq(e,t){return t?e?t+` `+e:t:e}function iq(e){return typeof e==`object`&&!!e&&`nativeEvent`in e}function aq(e,t,n={}){let r=t.render,i=oq(t,n);return n.enabled===!1?null:cq(e,r,i,n.state??RK)}function oq(e,t={}){let{className:n,style:r,render:i}=e,{state:a=RK,ref:o,props:s,stateAttributesMapping:c,enabled:l=!0}=t,u=l?GK(n,a):void 0,d=l?KK(r,a):void 0,f=l?WK(a,c):RK,p=l?UK(f,Array.isArray(s)?YK(s):s)??RK:RK;return typeof document<`u`&&(l?Array.isArray(o)?p.ref=OK([p.ref,HK(i),...o]):p.ref=DK(p.ref,HK(i),o):DK(null,null)),l?(u!==void 0&&(p.className=rq(p.className,u)),d!==void 0&&(p.style=UK(p.style,d)),p):RK}var sq=Symbol.for(`react.lazy`);function cq(e,t,n,r){if(t){if(typeof t==`function`)return t(n,r);let e=JK(n,t.props);e.ref=n.ref;let i=t;return i?.$$typeof===sq&&(i=x.Children.toArray(t)[0]),x.cloneElement(i,e)}if(e&&typeof e==`string`)return lq(e,n);throw Error(zK(8))}function lq(e,t){return e===`button`?(0,x.createElement)(`button`,{type:`button`,...t,key:t.key}):e===`img`?(0,x.createElement)(`img`,{alt:``,...t,key:t.key}):x.createElement(e,t)}var uq={...x},dq=0;function fq(e,t=`mui`){let[n,r]=x.useState(e),i=e||n;return x.useEffect(()=>{n??(dq+=1,r(`${t}-${dq}`))},[n,t]),i}var pq=uq.useId;function mq(e,t){if(pq!==void 0){let n=pq();return e??(t?`${t}-${n}`:n)}return fq(e,t)}function hq(e){return mq(e,`base-ui`)}function gq(){return typeof window<`u`}function _q(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function vq(e){return gq()?e instanceof Element||e instanceof _q(e).Element:!1}function yq(e){return gq()?e instanceof HTMLElement||e instanceof _q(e).HTMLElement:!1}function bq(e){return!gq()||typeof ShadowRoot>`u`?!1:e instanceof ShadowRoot||e instanceof _q(e).ShadowRoot}var xq=x.createContext(void 0);function Sq(e=!1){let t=x.useContext(xq);if(t===void 0&&!e)throw Error(zK(16));return t}function Cq(e){let{focusableWhenDisabled:t,disabled:n,composite:r=!1,tabIndex:i=0,isNativeButton:a}=e,o=r&&t!==!1,s=r&&t===!1;return{props:x.useMemo(()=>{let e={onKeyDown(e){n&&t&&e.key!==`Tab`&&e.preventDefault()}};return r||(e.tabIndex=i,!a&&n&&(e.tabIndex=t?i:-1)),(a&&(t||o)||!a&&n)&&(e[`aria-disabled`]=n),a&&(!t||s)&&(e.disabled=n),e},[r,n,t,o,s,a,i])}}function wq(e={}){let{disabled:t=!1,focusableWhenDisabled:n,tabIndex:r=0,native:i=!0}=e,a=x.useRef(null),o=Sq(!0)!==void 0,s=wK(()=>{let e=a.current;return!!(e?.tagName===`A`&&e?.href)}),{props:c}=Cq({focusableWhenDisabled:n,disabled:t,composite:o,tabIndex:r,isNativeButton:i}),l=x.useCallback(()=>{let e=a.current;Tq(e)&&o&&t&&c.disabled===void 0&&e.disabled&&(e.disabled=!1)},[t,c.disabled,o]);return NK(l,[l]),{getButtonProps:x.useCallback((e={})=>{let{onClick:n,onMouseDown:r,onKeyUp:a,onKeyDown:o,onPointerDown:l,...u}=e;return JK({type:i?`button`:void 0,onClick(e){if(t){e.preventDefault();return}n?.(e)},onMouseDown(e){t||r?.(e)},onKeyDown(e){if(t||(nq(e),o?.(e)),e.baseUIHandlerPrevented)return;let r=e.target===e.currentTarget&&!i&&!s()&&!t,a=e.key===`Enter`,c=e.key===` `;r&&((c||a)&&e.preventDefault(),a&&n?.(e))},onKeyUp(e){t||(nq(e),a?.(e)),!e.baseUIHandlerPrevented&&e.target===e.currentTarget&&!i&&!t&&e.key===` `&&n?.(e)},onPointerDown(e){if(t){e.preventDefault();return}l?.(e)}},i?void 0:{role:`button`},c,u)},[t,c,i,s]),buttonRef:wK(e=>{a.current=e,l()})}}function Tq(e){return yq(e)&&e.tagName===`BUTTON`}var Eq=x.createContext(void 0);function Dq(){let e=x.useContext(Eq);if(e===void 0)throw Error(zK(63));return e}var Oq=function(e){return e.disabled=`data-disabled`,e.valid=`data-valid`,e.invalid=`data-invalid`,e.touched=`data-touched`,e.dirty=`data-dirty`,e.filled=`data-filled`,e.focused=`data-focused`,e}({}),kq={badInput:!1,customError:!1,patternMismatch:!1,rangeOverflow:!1,rangeUnderflow:!1,stepMismatch:!1,tooLong:!1,tooShort:!1,typeMismatch:!1,valid:null,valueMissing:!1},Aq={valid(e){return e===null?null:e?{[Oq.valid]:``}:{[Oq.invalid]:``}}},jq=function(e){return e.checked=`data-checked`,e.unchecked=`data-unchecked`,e.disabled=`data-disabled`,e.readonly=`data-readonly`,e.required=`data-required`,e.valid=`data-valid`,e.invalid=`data-invalid`,e.touched=`data-touched`,e.dirty=`data-dirty`,e.filled=`data-filled`,e.focused=`data-focused`,e}({}),Mq={...Aq,checked(e){return e?{[jq.checked]:``}:{[jq.unchecked]:``}}};function Nq(e,t){return{...e,state:{...e.state,valid:!t&&e.state.valid}}}var Pq=x.createContext({formRef:{current:{fields:new Map}},errors:{},clearErrors:LK,validationMode:`onSubmit`,submitAttemptedRef:{current:!1}});function Fq(){return x.useContext(Pq)}var Iq=x.createContext({invalid:void 0,name:void 0,validityData:{state:kq,errors:[],error:``,value:``,initialValue:null},setValidityData:LK,disabled:void 0,touched:!1,setTouched:LK,dirty:!1,setDirty:LK,filled:!1,setFilled:LK,focused:!1,setFocused:LK,validate:()=>null,validationMode:`onSubmit`,validationDebounceTime:0,shouldValidateOnChange:()=>!1,state:{disabled:!1,valid:null,touched:!1,dirty:!1,filled:!1,focused:!1},markedDirtyRef:{current:!1},validation:{getValidationProps:(e=RK)=>e,getInputValidationProps:(e=RK)=>e,inputRef:{current:null},commit:async()=>{}}});function Lq(e=!0){let t=x.useContext(Iq);if(t.setValidityData===LK&&!e)throw Error(zK(28));return t}function Rq(e){let{enabled:t=!0,value:n,id:r,name:i,controlRef:a,commit:o}=e,{formRef:s}=Fq(),{invalid:c,markedDirtyRef:l,validityData:u,setValidityData:d}=Lq(),f=wK(e.getValue);NK(()=>{if(!t)return;let e=n;e===void 0&&(e=f()),u.initialValue===null&&e!==null&&d(t=>({...t,initialValue:e}))},[t,d,n,u.initialValue,f]),NK(()=>{!t||!r||s.current.fields.set(r,{getValue:f,name:i,controlRef:a,validityData:Nq(u,c),validate(e=!0){let t=n;t===void 0&&(t=f()),l.current=!0,e?U.flushSync(()=>o(t)):o(t)}})},[o,a,t,s,f,r,c,l,i,u,n]),NK(()=>{let e=s.current.fields;return()=>{r&&e.delete(r)}},[s,r])}var zq=x.createContext({controlId:void 0,registerControlId:LK,labelId:void 0,setLabelId:LK,messageIds:[],setMessageIds:LK,getDescriptionProps:e=>e});function Bq(){return x.useContext(zq)}function Vq(e={}){let{id:t,implicit:n=!1,controlRef:r}=e,{controlId:i,registerControlId:a}=Bq(),o=hq(t),s=n?i:void 0,c=xK(()=>Symbol(`labelable-control`)),l=x.useRef(!1),u=x.useRef(t!=null),d=wK(()=>{!l.current||a===LK||(l.current=!1,a(c.current,void 0))});return NK(()=>{if(a===LK)return;let e;if(n){let n=r?.current;e=vq(n)&&n.closest(`label`)!=null?t??null:s??o}else if(t!=null)u.current=!0,e=t;else if(u.current)e=o;else{d();return}if(e===void 0){d();return}l.current=!0,a(c.current,e)},[t,r,s,a,n,o,c,d]),x.useEffect(()=>d,[d]),i??o}var Hq=`none`;function Uq(e,t,n,r){let i=!1,a=!1,o=r??RK;return{reason:e,event:t??new Event(`base-ui`),cancel(){i=!0},allowPropagation(){a=!0},get isCanceled(){return i},get isPropagationAllowed(){return a},trigger:n,...o}}function Wq(e,t){let n=x.useRef(e),r=wK(t);NK(()=>{n.current!==e&&r(n.current)},[e,r]),NK(()=>{n.current=e},[e])}var Gq=x.forwardRef(function(e,t){let{checked:n,className:r,defaultChecked:i,id:a,inputRef:o,name:s,nativeButton:c=!1,onCheckedChange:l,readOnly:u=!1,required:d=!1,disabled:f=!1,render:p,uncheckedValue:m,value:h,...g}=e,{clearErrors:_}=Fq(),{state:v,setTouched:y,setDirty:b,validityData:S,setFilled:C,setFocused:w,shouldValidateOnChange:T,validationMode:E,disabled:D,name:O,validation:k}=Lq(),{labelId:A}=Bq(),j=D||f,M=O??s,N=wK(l),P=x.useRef(null),F=DK(P,o,k.inputRef),I=x.useRef(null),L=hq(),ee=Vq({id:a,implicit:!1,controlRef:I}),R=c?void 0:ee,[z,B]=yK({controlled:n,default:!!i,name:`Switch`,state:`checked`});Rq({id:L,commit:k.commit,value:z,controlRef:I,name:M,getValue:()=>z}),NK(()=>{P.current&&C(P.current.checked)},[P,C]),Wq(z,()=>{_(M),b(z!==S.initialValue),C(z),T()?k.commit(z):k.commit(z,!0)});let{getButtonProps:te,buttonRef:V}=wq({disabled:j,native:c}),ne={id:c?ee:L,role:`switch`,"aria-checked":z,"aria-readonly":u||void 0,"aria-required":d||void 0,"aria-labelledby":A,onFocus(){j||w(!0)},onBlur(){let e=P.current;!e||j||(y(!0),w(!1),E===`onBlur`&&k.commit(e.checked))},onClick(e){u||j||(e.preventDefault(),P.current?.dispatchEvent(new PointerEvent(`click`,{bubbles:!0,shiftKey:e.shiftKey,ctrlKey:e.ctrlKey,altKey:e.altKey,metaKey:e.metaKey})))}},H=x.useMemo(()=>JK({checked:z,disabled:j,id:R,name:M,required:d,style:M?IK:FK,tabIndex:-1,type:`checkbox`,"aria-hidden":!0,ref:F,onChange(e){if(e.nativeEvent.defaultPrevented)return;let t=e.target.checked,n=Uq(Hq,e.nativeEvent);N?.(t,n),!n.isCanceled&&B(t)},onFocus(){I.current?.focus()}},k.getInputValidationProps,h===void 0?RK:{value:h}),[z,j,F,R,M,N,d,B,k,h]),re=x.useMemo(()=>({...v,checked:z,disabled:j,readOnly:u,required:d}),[v,z,j,u,d]),U=aq(`span`,e,{state:re,ref:[t,I,V],props:[ne,k.getValidationProps,g,te],stateAttributesMapping:Mq});return(0,G.jsxs)(Eq.Provider,{value:re,children:[U,!z&&M&&m!==void 0&&(0,G.jsx)(`input`,{type:`hidden`,name:M,value:m}),(0,G.jsx)(`input`,{...H})]})}),Kq=x.forwardRef(function(e,t){let{render:n,className:r,...i}=e,{state:a}=Lq(),o=Dq();return aq(`span`,e,{state:{...a,...o},ref:t,stateAttributesMapping:Mq,props:i})});function qq({checked:e,onCheckedChange:t,disabled:n,className:r,ariaLabel:i}){return(0,G.jsx)(Gq,{checked:e,onCheckedChange:t,disabled:n,"aria-label":i,className:kg(`group relative inline-flex h-6 w-10 shrink-0 cursor-pointer items-center rounded-full transition-colors`,`bg-border data-[checked]:bg-accent`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-bg-base`,`disabled:cursor-not-allowed disabled:opacity-50`,r),children:(0,G.jsx)(Kq,{className:kg(`pointer-events-none block size-4 rounded-full bg-white shadow-sm transition-transform`,`translate-x-1 group-data-[checked]:translate-x-5`)})})}var Jq=null,Yq=!1,Xq={},Zq=500;function Qq(){if(typeof window>`u`)return null;if(Jq?.state===`closed`&&(Jq=null),!Jq){let e=window.AudioContext??window.webkitAudioContext;if(!e)return null;Jq=new e}return Jq}function $q(){Jq&&=(Jq.close().catch(()=>{}),null),Qq()}function eJ(){return Yq}function tJ(){Jq&&($q(),Yq=!0)}if(typeof window<`u`){window.addEventListener(`pageshow`,e=>{e.persisted&&tJ()}),document.addEventListener(`visibilitychange`,()=>{document.visibilityState===`visible`&&tJ()});let e=Date.now();setInterval(()=>{let t=Date.now();t-e>15e3&&tJ(),e=t},5e3)}async function nJ(){let e=Qq();e&&e.state===`suspended`&&await e.resume().catch(()=>{}),Yq=!1}async function rJ(e){e.state===`suspended`&&await e.resume().catch(()=>{})}async function iJ(e){let t=Qq();if(!t||(await rJ(t),t.state!==`running`))return;let{frequencies:n,durationMs:r,attackMs:i,peakGain:a,type:o=`sine`}=e,s=t.currentTime,c=r/1e3,l=i/1e3,u=t.createGain();u.connect(t.destination);let d=s+c*.7;u.gain.setValueAtTime(0,s),u.gain.linearRampToValueAtTime(a,s+l),u.gain.setValueAtTime(a,d),u.gain.linearRampToValueAtTime(0,s+c);let f=n.map(e=>{let n=t.createOscillator();return n.type=o,n.frequency.setValueAtTime(e,s),n.connect(u),n});for(let e of f)e.start(s),e.stop(s+c);let p=f[f.length-1];p.onended=()=>{for(let e of f)e.disconnect();u.disconnect()}}async function aJ(){let e=Date.now();if(!(e-(Xq.permission||0)<Zq)){Xq.permission=e;try{await iJ({frequencies:[880],durationMs:150,attackMs:5,peakGain:.15,type:`sine`})}catch{}}}async function oJ(){let e=Date.now();if(!(e-(Xq.idle||0)<Zq)){Xq.idle=e;try{await iJ({frequencies:[440,550],durationMs:300,attackMs:10,peakGain:.08,type:`sine`})}catch{}}}function sJ({isOpen:e,onClose:t}){let n=H(e=>e.defaultProjectDir),r=H(e=>e.setDefaultProjectDir),i=H(e=>e.commandPresets),a=H(e=>e.setCommandPresets),o=H(e=>e.defaultPresetId),s=H(e=>e.setDefaultPresetId),c=H(e=>e.sessionSortMode),l=H(e=>e.setSessionSortMode),u=H(e=>e.sessionSortDirection),d=H(e=>e.setSessionSortDirection),f=H(e=>e.useWebGL),p=H(e=>e.setUseWebGL),m=H(e=>e.fontSize),h=H(e=>e.setFontSize),g=H(e=>e.lineHeight),_=H(e=>e.setLineHeight),v=H(e=>e.letterSpacing),y=H(e=>e.setLetterSpacing),b=H(e=>e.fontOption),S=H(e=>e.setFontOption),C=H(e=>e.customFontFamily),w=H(e=>e.setCustomFontFamily),T=H(e=>e.shortcutModifier),E=H(e=>e.setShortcutModifier),D=H(e=>e.showProjectName),O=H(e=>e.setShowProjectName),k=H(e=>e.showLastUserMessage),A=H(e=>e.setShowLastUserMessage),j=H(e=>e.showSessionIdPrefix),M=H(e=>e.setShowSessionIdPrefix),N=RW(e=>e.theme),F=RW(e=>e.setTheme),I=H(e=>e.soundOnPermission),ee=H(e=>e.setSoundOnPermission),R=H(e=>e.soundOnIdle),z=H(e=>e.setSoundOnIdle),[B,te]=(0,x.useState)(n),[V,ne]=(0,x.useState)(i),[re,U]=(0,x.useState)(o),[ie,W]=(0,x.useState)(c),[ae,oe]=(0,x.useState)(u),[se,ce]=(0,x.useState)(f),[le,ue]=(0,x.useState)(m),[de,fe]=(0,x.useState)(g),[pe,me]=(0,x.useState)(v),[he,ge]=(0,x.useState)(b),[_e,ve]=(0,x.useState)(C),[ye,be]=(0,x.useState)(T),[xe,Se]=(0,x.useState)(D),[Ce,we]=(0,x.useState)(k),[Te,Ee]=(0,x.useState)(j),[De,Oe]=(0,x.useState)(N),[ke,Ae]=(0,x.useState)(I),[je,Me]=(0,x.useState)(R),[Ne,Pe]=(0,x.useState)(!0),[Fe,Ie]=(0,x.useState)(!1),[Le,Re]=(0,x.useState)(!0),[ze,Be]=(0,x.useState)(!0),[Ve,He]=(0,x.useState)(!1),[Ue,We]=(0,x.useState)(!1),[Ge,Ke]=(0,x.useState)(24),[qe,Ye]=(0,x.useState)(!1),[Ze,Qe]=(0,x.useState)(!1),[$e,et]=(0,x.useState)(``),[tt,nt]=(0,x.useState)(``),[rt,it]=(0,x.useState)(``),at=(0,x.useRef)(null),ot=(0,x.useRef)(0),st=(0,x.useRef)(!1);if((0,x.useEffect)(()=>{let t=++ot.current,r=st.current;if(st.current=e,at.current&&=(clearTimeout(at.current),null),e){if(te(n),ne(i),U(o),W(c),oe(u),ce(f),ue(m),fe(g),me(v),ge(b),ve(C),be(T),Se(D),we(k),Ee(j),Oe(N),Ae(I),Me(R),Qe(!1),et(``),nt(``),it(``),fetch(`/api/settings/tmux-mouse-mode`).then(e=>e.json()).then(e=>Pe(e.enabled)).catch(()=>{}),Be(!0),fetch(`/api/settings/terminal-colors`).then(e=>{if(!e.ok)throw Error(`HTTP ${e.status}`);return e.json()}).then(e=>{ot.current===t&&Re(e.enabled)}).catch(()=>{}).finally(()=>{ot.current===t&&Be(!1)}),fetch(`/api/settings/history-max-age-hours`).then(e=>e.json()).then(e=>Ke(e.hours)).catch(()=>{}),fetch(`/api/settings/prefer-window-name`).then(e=>e.json()).then(e=>He(e.enabled)).catch(()=>{}),typeof document<`u`){let e=document.querySelector(`.xterm-helper-textarea`);e&&typeof e.setAttribute==`function`&&(typeof e.blur==`function`&&e.blur(),e.setAttribute(`disabled`,`true`))}}else r&&typeof document<`u`&&(at.current=setTimeout(()=>{if(typeof document>`u`)return;let e=document.querySelector(`.xterm-helper-textarea`);e&&(e.removeAttribute(`disabled`),e.focus())},300));return()=>{at.current&&=(clearTimeout(at.current),null)}},[i,o,n,c,u,f,m,g,v,b,C,T,D,k,j,N,I,R,e]),(0,x.useEffect)(()=>{if(!e||typeof window>`u`||typeof window.addEventListener!=`function`)return;let n=e=>{e.key===`Escape`&&(typeof e.stopPropagation==`function`&&e.stopPropagation(),t())};return window.addEventListener(`keydown`,n),()=>window.removeEventListener(`keydown`,n)},[e,t]),!e)return null;let ct=e=>{e.preventDefault();let n=B.trim(),i=se!==f;r(n||`~/Documents/GitHub`),a(V),s(re),l(ie),d(ae),p(se),h(le),_(de),y(pe),S(he),w(_e),E(ye),O(xe),A(Ce),M(Te),F(De),ee(ke),z(je),t({webglChanged:i})},lt=(e,t)=>{ne(n=>n.map(n=>n.id===e?{...n,...t}:n))},ut=e=>{let t=V.find(t=>t.id===e);if(!t||t.isBuiltIn)return;let n=V.filter(t=>t.id!==e);ne(n),e===re&&U(n[0]?.id||`claude`)},dt=()=>{if(!$e.trim()||!tt.trim()||V.length>=50)return;let e={id:`custom-${Date.now()}-${Math.random().toString(36).slice(2,6)}`,label:$e.trim(),command:tt.trim(),isBuiltIn:!1,agentType:rt||void 0};ne([...V,e]),Qe(!1),et(``),nt(``),it(``)},ft=V.length<50,pt=e=>{Ie(!0),Pe(e),fetch(`/api/settings/tmux-mouse-mode`,{method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify({enabled:e})}).then(e=>{if(!e.ok)throw Error(`HTTP ${e.status}`)}).catch(()=>Pe(!e)).finally(()=>Ie(!1))},mt=e=>{We(!0),He(e),fetch(`/api/settings/prefer-window-name`,{method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify({enabled:e})}).then(e=>{if(!e.ok)throw Error(`HTTP ${e.status}`)}).catch(()=>He(!e)).finally(()=>We(!1))},ht=e=>{Be(!0),Re(e),fetch(`/api/settings/terminal-colors`,{method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify({enabled:e})}).then(e=>{if(!e.ok)throw Error(`HTTP ${e.status}`)}).catch(()=>Re(!e)).finally(()=>Be(!1))},gt=e=>{let t=Ge;Ye(!0),Ke(e),fetch(`/api/settings/history-max-age-hours`,{method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify({hours:e})}).then(e=>{if(!e.ok)throw Error(`HTTP ${e.status}`)}).catch(()=>Ke(t)).finally(()=>Ye(!1))};return(0,G.jsx)(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center bg-black/60 p-4`,onClick:e=>{e.target===e.currentTarget&&t()},children:(0,G.jsxs)(`form`,{onSubmit:ct,className:`w-full max-w-lg max-h-[90vh] flex flex-col border border-border bg-elevated`,children:[(0,G.jsxs)(`div`,{className:`p-6 pb-0`,children:[(0,G.jsx)(`h2`,{className:`text-sm font-semibold uppercase tracking-wider text-primary text-balance`,children:`Settings`}),(0,G.jsx)(`p`,{className:`mt-2 text-xs text-muted text-pretty`,children:`Configure default directory, command presets, and display options.`})]}),(0,G.jsx)(`div`,{className:`flex-1 overflow-y-auto px-6 pb-4`,children:(0,G.jsxs)(`div`,{className:`mt-5 space-y-4`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`label`,{className:`mb-1.5 block text-xs text-secondary`,children:`Default Project Directory`}),(0,G.jsx)(`input`,{value:B,onChange:e=>te(e.target.value),placeholder:P,className:`input`,autoFocus:!0})]}),(0,G.jsxs)(`div`,{className:`border-t border-border pt-4`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between mb-2`,children:[(0,G.jsx)(`label`,{className:`text-xs text-secondary`,children:`Command Presets`}),(0,G.jsx)(`select`,{value:re,onChange:e=>U(e.target.value),className:`input text-xs py-1 px-2 w-auto`,children:V.map(e=>(0,G.jsx)(`option`,{value:e.id,children:e.label},e.id))})]}),(0,G.jsx)(`p`,{className:`text-[10px] text-muted mb-3`,children:`Default preset is pre-selected when creating new sessions.`}),(0,G.jsx)(`div`,{className:`space-y-3`,children:V.map(e=>(0,G.jsxs)(`div`,{className:`border border-border p-3 space-y-2`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,G.jsx)(`div`,{className:`flex items-center gap-2`,children:(0,G.jsx)(`input`,{value:e.label,onChange:t=>lt(e.id,{label:t.target.value}),className:`input text-sm py-1 px-2 w-32`,placeholder:`Label`})}),!e.isBuiltIn&&(0,G.jsx)(`button`,{type:`button`,onClick:()=>ut(e.id),className:`btn text-xs px-2 py-1 text-error hover:bg-error/10`,children:`Delete`})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`label`,{className:`text-[10px] text-muted block mb-1`,children:`Command`}),(0,G.jsx)(`input`,{value:e.command,onChange:t=>lt(e.id,{command:t.target.value}),className:`input text-xs py-1 px-2 font-mono w-full`,placeholder:`command --flags`})]}),!e.isBuiltIn&&(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`label`,{className:`text-[10px] text-muted block mb-1`,children:`Icon`}),(0,G.jsxs)(`select`,{value:e.agentType||``,onChange:t=>lt(e.id,{agentType:t.target.value||void 0}),className:`input text-xs py-1 px-2 w-auto`,children:[(0,G.jsx)(`option`,{value:``,children:`Terminal`}),(0,G.jsx)(`option`,{value:`claude`,children:`Claude`}),(0,G.jsx)(`option`,{value:`codex`,children:`Codex`}),(0,G.jsx)(`option`,{value:`pi`,children:`Pi`}),(0,G.jsx)(`option`,{value:`devin`,children:`Devin`}),(0,G.jsx)(`option`,{value:`grok`,children:`Grok`}),(0,G.jsx)(`option`,{value:`omp`,children:`OMP`})]})]})]},e.id))}),Ze?(0,G.jsxs)(`div`,{className:`mt-3 border border-border p-3 space-y-2`,children:[(0,G.jsx)(`div`,{className:`text-xs text-secondary mb-2`,children:`New Preset`}),(0,G.jsx)(`input`,{value:$e,onChange:e=>et(e.target.value),className:`input text-xs py-1 px-2 w-full`,placeholder:`Label`}),(0,G.jsx)(`input`,{value:tt,onChange:e=>nt(e.target.value),className:`input text-xs py-1 px-2 font-mono w-full`,placeholder:`command --flags`}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsxs)(`select`,{value:rt,onChange:e=>it(e.target.value),className:`input text-xs py-1 px-2 w-auto`,children:[(0,G.jsx)(`option`,{value:``,children:`Terminal Icon`}),(0,G.jsx)(`option`,{value:`claude`,children:`Claude Icon`}),(0,G.jsx)(`option`,{value:`codex`,children:`Codex Icon`}),(0,G.jsx)(`option`,{value:`pi`,children:`Pi Icon`}),(0,G.jsx)(`option`,{value:`devin`,children:`Devin Icon`}),(0,G.jsx)(`option`,{value:`grok`,children:`Grok Icon`}),(0,G.jsx)(`option`,{value:`omp`,children:`OMP Icon`})]}),(0,G.jsx)(`div`,{className:`flex-1`}),(0,G.jsx)(`button`,{type:`button`,onClick:()=>Qe(!1),className:`btn text-xs px-2 py-1`,children:`Cancel`}),(0,G.jsx)(`button`,{type:`button`,onClick:dt,disabled:!$e.trim()||!tt.trim(),className:`btn btn-primary text-xs px-2 py-1`,children:`Add`})]})]}):(0,G.jsx)(`button`,{type:`button`,onClick:()=>Qe(!0),disabled:!ft,className:`btn text-xs mt-3 w-full`,children:ft?`+ Add Preset`:`Max 50 presets`})]}),(0,G.jsxs)(`div`,{className:`border-t border-border pt-4`,children:[(0,G.jsx)(`label`,{className:`mb-2 block text-xs text-secondary`,children:`Session List Order`}),(0,G.jsxs)(`div`,{className:`flex gap-2`,children:[(0,G.jsx)(`button`,{type:`button`,className:`btn flex-1 ${ie===`created`?`btn-primary`:``}`,onClick:()=>W(`created`),children:`Created`}),(0,G.jsx)(`button`,{type:`button`,className:`btn flex-1 ${ie===`status`?`btn-primary`:``}`,onClick:()=>W(`status`),children:`Status`}),(0,G.jsx)(`button`,{type:`button`,className:`btn flex-1 ${ie===`manual`?`btn-primary`:``}`,onClick:()=>W(`manual`),children:`Manual`})]}),(0,G.jsx)(`p`,{className:`mt-1.5 text-[10px] text-muted`,children:ie===`status`?`Sessions auto-resort by status (waiting, working, unknown)`:ie===`manual`?`Drag sessions to reorder manually`:`Sessions stay in creation order`})]}),ie===`created`&&(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`label`,{className:`mb-2 block text-xs text-secondary`,children:`Sort Direction`}),(0,G.jsxs)(`div`,{className:`flex gap-2`,children:[(0,G.jsx)(`button`,{type:`button`,className:`btn flex-1 ${ae===`desc`?`btn-primary`:``}`,onClick:()=>oe(`desc`),children:`Newest First`}),(0,G.jsx)(`button`,{type:`button`,className:`btn flex-1 ${ae===`asc`?`btn-primary`:``}`,onClick:()=>oe(`asc`),children:`Oldest First`})]})]}),(0,G.jsxs)(`div`,{className:`border-t border-border pt-4 space-y-3`,children:[(0,G.jsx)(`label`,{className:`mb-1 block text-xs text-secondary`,children:`Session List Details`}),(0,G.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`div`,{className:`text-sm text-primary`,children:`Project Name`}),(0,G.jsx)(`div`,{className:`text-[10px] text-muted`,children:`Show the project folder name under each session.`})]}),(0,G.jsx)(qq,{checked:xe,onCheckedChange:Se})]}),(0,G.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`div`,{className:`text-sm text-primary`,children:`Last User Message`}),(0,G.jsx)(`div`,{className:`text-[10px] text-muted`,children:`Show the most recent user input next to the project name.`})]}),(0,G.jsx)(qq,{checked:Ce,onCheckedChange:we})]}),(0,G.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`div`,{className:`text-sm text-primary`,children:`Session ID Prefix`}),(0,G.jsx)(`div`,{className:`text-[10px] text-muted`,children:`Show first 5 characters of agent session IDs in the list.`})]}),(0,G.jsx)(qq,{checked:Te,onCheckedChange:Ee})]}),(0,G.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`div`,{className:`text-sm text-primary`,children:`History Sessions Lookback`}),(0,G.jsxs)(`div`,{className:`text-[10px] text-muted`,children:[`Show history sessions from the last N hours (`,1,`-`,168,`).`]})]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(`input`,{type:`number`,min:1,max:168,value:Ge,onChange:e=>{let t=parseInt(e.target.value,10);t>=1&&t<=168&>(t)},disabled:qe,className:`input text-xs py-1 px-2 w-16 text-center`}),(0,G.jsx)(`span`,{className:`text-xs text-muted`,children:`hrs`})]})]})]}),(0,G.jsxs)(`div`,{className:`border-t border-border pt-4 space-y-3`,children:[(0,G.jsx)(`label`,{className:`mb-1 block text-xs text-secondary`,children:`Notifications`}),(0,G.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,G.jsxs)(`div`,{className:`flex-1`,children:[(0,G.jsx)(`div`,{className:`text-sm text-primary`,children:`Permission Sound`}),(0,G.jsx)(`div`,{className:`text-[10px] text-muted`,children:`Play a ping when any session needs permission.`})]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(`button`,{type:`button`,onClick:()=>void aJ(),className:`btn text-xs px-2 py-1`,children:`Test`}),(0,G.jsx)(qq,{checked:ke,onCheckedChange:e=>{Ae(e),e&&nJ()}})]})]}),(0,G.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,G.jsxs)(`div`,{className:`flex-1`,children:[(0,G.jsx)(`div`,{className:`text-sm text-primary`,children:`Idle Sound`}),(0,G.jsx)(`div`,{className:`text-[10px] text-muted`,children:`Play a chime when a session finishes working.`})]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(`button`,{type:`button`,onClick:()=>void oJ(),className:`btn text-xs px-2 py-1`,children:`Test`}),(0,G.jsx)(qq,{checked:je,onCheckedChange:e=>{Me(e),e&&nJ()}})]})]})]}),(0,G.jsxs)(`div`,{className:`border-t border-border pt-4`,children:[(0,G.jsx)(`label`,{className:`mb-2 block text-xs text-secondary`,children:`Terminal Rendering`}),(0,G.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`div`,{className:`text-sm text-primary`,children:`WebGL Acceleration`}),(0,G.jsx)(`div`,{className:`text-[10px] text-muted`,children:`GPU rendering for better performance. Turn off if text looks fuzzy or flickering.`})]}),(0,G.jsx)(qq,{checked:se,onCheckedChange:ce})]}),se!==f&&(0,G.jsx)(`p`,{className:`mt-2 text-[10px] text-approval`,children:`Terminal will reload when saved`}),(0,G.jsxs)(`div`,{className:`mt-4 flex items-center justify-between`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`div`,{className:`text-sm text-primary`,children:`Mouse Mode`}),(0,G.jsx)(`div`,{className:`text-[10px] text-muted`,children:`Enable tmux mouse mode for trackpad/scroll wheel support.`})]}),(0,G.jsx)(qq,{checked:Ne,onCheckedChange:pt,disabled:Fe})]}),(0,G.jsxs)(`div`,{className:`mt-4 flex items-center justify-between gap-4`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`div`,{className:`text-sm text-primary`,children:`Terminal Colors`}),(0,G.jsx)(`div`,{className:`text-[10px] text-muted`,children:`Preserve ANSI colors for terminal output. Hibernate then Wake running agents after changing this setting.`})]}),(0,G.jsx)(qq,{checked:Le,onCheckedChange:ht,disabled:ze,ariaLabel:`Enable terminal colors`})]}),(0,G.jsxs)(`div`,{className:`mt-4 flex items-center justify-between`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`div`,{className:`text-sm text-primary`,children:`Prefer Window Names`}),(0,G.jsx)(`div`,{className:`text-[10px] text-muted`,children:`Label discovered sessions with their tmux window name instead of the session name. Applies immediately.`})]}),(0,G.jsx)(qq,{checked:Ve,onCheckedChange:mt,disabled:Ue})]}),(0,G.jsxs)(`div`,{className:`mt-4 flex items-center justify-between`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`div`,{className:`text-sm text-primary`,children:`Font Size`}),(0,G.jsx)(`div`,{className:`text-[10px] text-muted`,children:`Terminal text size in pixels (6-24)`})]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(`button`,{type:`button`,onClick:()=>ue(Math.max(6,le-1)),className:`flex h-7 w-7 items-center justify-center rounded bg-surface border border-border text-secondary hover:bg-hover`,children:(0,G.jsx)(`span`,{className:`text-sm font-bold`,children:`−`})}),(0,G.jsx)(`span`,{className:`text-sm text-secondary w-6 text-center`,children:le}),(0,G.jsx)(`button`,{type:`button`,onClick:()=>ue(Math.min(24,le+1)),className:`flex h-7 w-7 items-center justify-center rounded bg-surface border border-border text-secondary hover:bg-hover`,children:(0,G.jsx)(`span`,{className:`text-sm font-bold`,children:`+`})})]})]}),(0,G.jsxs)(`div`,{className:`mt-4 flex items-center justify-between`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`div`,{className:`text-sm text-primary`,children:`Line Height`}),(0,G.jsx)(`div`,{className:`text-[10px] text-muted`,children:`Vertical spacing (1.0 = compact, 2.0 = spacious)`})]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(`input`,{type:`range`,min:`1.0`,max:`2.0`,step:`0.1`,value:de,onChange:e=>fe(parseFloat(e.target.value)),className:`w-20 h-1 bg-border rounded-lg appearance-none cursor-pointer accent-accent`}),(0,G.jsx)(`span`,{className:`text-xs text-secondary w-8 text-right`,children:de.toFixed(1)})]})]}),(0,G.jsxs)(`div`,{className:`mt-4 flex items-center justify-between`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`div`,{className:`text-sm text-primary`,children:`Letter Spacing`}),(0,G.jsx)(`div`,{className:`text-[10px] text-muted`,children:`Horizontal spacing between characters in pixels`})]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(`input`,{type:`range`,min:`-3`,max:`3`,step:`1`,value:pe,onChange:e=>me(parseInt(e.target.value,10)),className:`w-20 h-1 bg-border rounded-lg appearance-none cursor-pointer accent-accent`}),(0,G.jsxs)(`span`,{className:`text-xs text-secondary w-8 text-right`,children:[pe,`px`]})]})]}),(0,G.jsxs)(`div`,{className:`mt-4`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`div`,{className:`text-sm text-primary`,children:`Font Family`}),(0,G.jsx)(`div`,{className:`text-[10px] text-muted`,children:`Terminal typeface`})]}),(0,G.jsx)(`select`,{value:he,onChange:e=>ge(e.target.value),className:`input text-xs py-1 px-2 w-auto`,children:L.map(e=>(0,G.jsx)(`option`,{value:e.id,children:e.label},e.id))})]}),he===`custom`&&(0,G.jsx)(`input`,{value:_e,onChange:e=>ve(e.target.value),placeholder:`"Fira Code", monospace`,className:`input text-xs mt-2 font-mono`})]}),(0,G.jsxs)(`div`,{className:`mt-4 flex items-center justify-between`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`div`,{className:`text-sm text-primary`,children:`Dark Mode`}),(0,G.jsx)(`div`,{className:`text-[10px] text-muted`,children:`Switch between dark and light themes.`})]}),(0,G.jsx)(qq,{checked:De===`dark`,onCheckedChange:e=>Oe(e?`dark`:`light`)})]})]}),(0,G.jsxs)(`div`,{className:`border-t border-border pt-4`,children:[(0,G.jsx)(`label`,{className:`mb-2 block text-xs text-secondary`,children:`Keyboard Shortcut Modifier`}),(0,G.jsx)(`div`,{className:`grid grid-cols-5 gap-1`,children:[`auto`,`ctrl-option`,`ctrl-shift`,`cmd-option`,`cmd-shift`].map(e=>(0,G.jsx)(`button`,{type:`button`,className:`btn text-xs px-2 ${ye===e?`btn-primary`:``}`,onClick:()=>be(e),children:e===`auto`?`Auto`:Xe(e)},e))}),(0,G.jsx)(`p`,{className:`mt-1.5 text-[10px] text-muted`,children:ye===`auto`?`Shortcuts: ${Xe(Je(`auto`))}+[1-9/N/X/[/]]`:`Shortcuts: ${Xe(ye)}+[1-9/N/X/[/]]`})]})]})}),(0,G.jsxs)(`div`,{className:`flex justify-end gap-2 p-6 pt-4 border-t border-border bg-elevated`,children:[(0,G.jsx)(`button`,{type:`button`,onClick:()=>t(),className:`btn`,children:`Cancel`}),(0,G.jsx)(`button`,{type:`submit`,className:`btn btn-primary`,children:`Save`})]})]})})}var cJ=[];function lJ(e){x.useEffect(e,cJ)}var uJ=x.createContext(void 0);function dJ(){let e=x.useContext(uJ);if(!e)throw Error(zK(73));return e}var fJ=Symbol(`NOT_FOUND`);function pJ(e,t=`expected a function, instead received ${typeof e}`){if(typeof e!=`function`)throw TypeError(t)}function mJ(e,t=`expected an object, instead received ${typeof e}`){if(typeof e!=`object`)throw TypeError(t)}function hJ(e,t=`expected all items to be functions, instead received the following types: `){if(!e.every(e=>typeof e==`function`)){let n=e.map(e=>typeof e==`function`?`function ${e.name||`unnamed`}()`:typeof e).join(`, `);throw TypeError(`${t}[${n}]`)}}var gJ=e=>Array.isArray(e)?e:[e];function _J(e){let t=Array.isArray(e[0])?e[0]:e;return hJ(t,`createSelector expects all input-selectors to be functions, but received the following types: `),t}function vJ(e,t){let n=[],{length:r}=e;for(let i=0;i<r;i++)n.push(e[i].apply(null,t));return n}function yJ(e){let t;return{get(n){return t&&e(t.key,n)?t.value:fJ},put(e,n){t={key:e,value:n}},getEntries(){return t?[t]:[]},clear(){t=void 0}}}function bJ(e,t){let n=[];function r(e){let r=n.findIndex(n=>t(e,n.key));if(r>-1){let e=n[r];return r>0&&(n.splice(r,1),n.unshift(e)),e.value}return fJ}function i(t,i){r(t)===fJ&&(n.unshift({key:t,value:i}),n.length>e&&n.pop())}function a(){return n}function o(){n=[]}return{get:r,put:i,getEntries:a,clear:o}}var xJ=(e,t)=>e===t;function SJ(e){return function(t,n){if(t===null||n===null||t.length!==n.length)return!1;let{length:r}=t;for(let i=0;i<r;i++)if(!e(t[i],n[i]))return!1;return!0}}function CJ(e,t){let{equalityCheck:n=xJ,maxSize:r=1,resultEqualityCheck:i}=typeof t==`object`?t:{equalityCheck:t},a=SJ(n),o=0,s=r<=1?yJ(a):bJ(r,a);function c(){let t=s.get(arguments);if(t===fJ){if(t=e.apply(null,arguments),o++,i){let e=s.getEntries().find(e=>i(e.value,t));e&&(t=e.value,o!==0&&o--)}s.put(arguments,t)}return t}return c.clearCache=()=>{s.clear(),c.resetResultsCount()},c.resultsCount=()=>o,c.resetResultsCount=()=>{o=0},c}var wJ=class{constructor(e){this.value=e}deref(){return this.value}},TJ=typeof WeakRef<`u`?WeakRef:wJ,EJ=0,DJ=1;function OJ(){return{s:EJ,v:void 0,o:null,p:null}}function kJ(e,t={}){let n=OJ(),{resultEqualityCheck:r}=t,i,a=0;function o(){let t=n,{length:o}=arguments;for(let e=0,n=o;e<n;e++){let n=arguments[e];if(typeof n==`function`||typeof n==`object`&&n){let e=t.o;e===null&&(t.o=e=new WeakMap);let r=e.get(n);r===void 0?(t=OJ(),e.set(n,t)):t=r}else{let e=t.p;e===null&&(t.p=e=new Map);let r=e.get(n);r===void 0?(t=OJ(),e.set(n,t)):t=r}}let s=t,c;if(t.s===DJ)c=t.v;else if(c=e.apply(null,arguments),a++,r){let e=i?.deref?.()??i;e!=null&&r(e,c)&&(c=e,a!==0&&a--),i=typeof c==`object`&&c||typeof c==`function`?new TJ(c):c}return s.s=DJ,s.v=c,c}return o.clearCache=()=>{n=OJ(),o.resetResultsCount()},o.resultsCount=()=>a,o.resetResultsCount=()=>{a=0},o}function AJ(e,...t){let n=typeof e==`function`?{memoize:e,memoizeOptions:t}:e,r=(...e)=>{let t=0,r=0,i,a={},o=e.pop();typeof o==`object`&&(a=o,o=e.pop()),pJ(o,`createSelector expects an output function after the inputs, but received: [${typeof o}]`);let{memoize:s,memoizeOptions:c=[],argsMemoize:l=kJ,argsMemoizeOptions:u=[],devModeChecks:d={}}={...n,...a},f=gJ(c),p=gJ(u),m=_J(e),h=s(function(){return t++,o.apply(null,arguments)},...f),g=l(function(){r++;let e=vJ(m,arguments);return i=h.apply(null,e),i},...p);return Object.assign(g,{resultFunc:o,memoizedResultFunc:h,dependencies:m,dependencyRecomputations:()=>r,resetDependencyRecomputations:()=>{r=0},lastResult:()=>i,recomputations:()=>t,resetRecomputations:()=>{t=0},memoize:s,argsMemoize:l})};return Object.assign(r,{withTypes:()=>r}),r}var jJ=AJ(kJ),MJ=Object.assign((e,t=jJ)=>{mJ(e,`createStructuredSelector expects first argument to be an object where each property is a selector, instead received a ${typeof e}`);let n=Object.keys(e);return t(n.map(t=>e[t]),(...e)=>e.reduce((e,t,r)=>(e[n[r]]=t,e),{}))},{withTypes:()=>MJ}),NJ=AJ({memoize:CJ,memoizeOptions:{maxSize:1,equalityCheck:Object.is}}),PJ=(e,t,n,r,i,a,...o)=>{if(o.length>0)throw Error(zK(1));let s;if(e&&t&&n&&r&&i&&a)s=(o,s,c,l)=>a(e(o,s,c,l),t(o,s,c,l),n(o,s,c,l),r(o,s,c,l),i(o,s,c,l),s,c,l);else if(e&&t&&n&&r&&i)s=(a,o,s,c)=>i(e(a,o,s,c),t(a,o,s,c),n(a,o,s,c),r(a,o,s,c),o,s,c);else if(e&&t&&n&&r)s=(i,a,o,s)=>r(e(i,a,o,s),t(i,a,o,s),n(i,a,o,s),a,o,s);else if(e&&t&&n)s=(r,i,a,o)=>n(e(r,i,a,o),t(r,i,a,o),i,a,o);else if(e&&t)s=(n,r,i,a)=>t(e(n,r,i,a),r,i,a);else if(e)s=e;else throw Error(`Missing arguments`);return s},FJ=(...e)=>{let t=new WeakMap,n=1,r=e[e.length-1],i=e.length-1||1,a=r.length-i;if(a>3)throw Error(zK(2));return(i,o,s,c)=>{let l=i.__cacheKey__;l||(l={id:n},i.__cacheKey__=l,n+=1);let u=t.get(l);if(!u){let n=e,i=[void 0,void 0,void 0];switch(a){case 0:break;case 1:n=[...e.slice(0,-1),()=>i[0],r];break;case 2:n=[...e.slice(0,-1),()=>i[0],()=>i[1],r];break;case 3:n=[...e.slice(0,-1),()=>i[0],()=>i[1],()=>i[2],r];break;default:throw Error(zK(2))}u=NJ(...n),u.selectorArgs=i,t.set(l,u)}switch(u.selectorArgs[0]=o,u.selectorArgs[1]=s,u.selectorArgs[2]=c,a){case 0:return u(i);case 1:return u(i,o);case 2:return u(i,o,s);case 3:return u(i,o,s,c);default:throw Error(`unreachable`)}}},IJ=s((e=>{var t=p();function n(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var r=typeof Object.is==`function`?Object.is:n,i=t.useState,a=t.useEffect,o=t.useLayoutEffect,s=t.useDebugValue;function c(e,t){var n=t(),r=i({inst:{value:n,getSnapshot:t}}),c=r[0].inst,u=r[1];return o(function(){c.value=n,c.getSnapshot=t,l(c)&&u({inst:c})},[e,n,t]),a(function(){return l(c)&&u({inst:c}),e(function(){l(c)&&u({inst:c})})},[e]),s(n),n}function l(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!r(e,n)}catch{return!0}}function u(e,t){return t()}var d=typeof window>`u`||window.document===void 0||window.document.createElement===void 0?u:c;e.useSyncExternalStore=t.useSyncExternalStore===void 0?d:t.useSyncExternalStore})),LJ=s(((e,t)=>{t.exports=IJ()})),RJ=s((e=>{var t=p(),n=LJ();function r(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var i=typeof Object.is==`function`?Object.is:r,a=n.useSyncExternalStore,o=t.useRef,s=t.useEffect,c=t.useMemo,l=t.useDebugValue;e.useSyncExternalStoreWithSelector=function(e,t,n,r,u){var d=o(null);if(d.current===null){var f={hasValue:!1,value:null};d.current=f}else f=d.current;d=c(function(){function e(e){if(!a){if(a=!0,o=e,e=r(e),u!==void 0&&f.hasValue){var t=f.value;if(u(t,e))return s=t}return s=e}if(t=s,i(o,e))return t;var n=r(e);return u!==void 0&&u(t,n)?(o=e,t):(o=e,s=n)}var a=!1,o,s,c=n===void 0?null:n;return[function(){return e(t())},c===null?void 0:function(){return e(c())}]},[t,n,r,u]);var p=a(e,d[0],d[1]);return s(function(){f.hasValue=!0,f.value=p},[p]),l(p),p}})),zJ=s(((e,t)=>{t.exports=RJ()})),BJ=[],VJ=void 0;function HJ(){return VJ}function UJ(e){BJ.push(e)}var WJ=LJ(),GJ=zJ(),KJ=VK(19)?YJ:XJ;function qJ(e,t,n,r,i){return KJ(e,t,n,r,i)}function JJ(e,t,n,r,i){let a=x.useCallback(()=>t(e.getSnapshot(),n,r,i),[e,t,n,r,i]);return(0,WJ.useSyncExternalStore)(e.subscribe,a,a)}UJ({before(e){e.syncIndex=0,e.didInitialize||(e.syncTick=1,e.syncHooks=[],e.didChangeStore=!0,e.getSnapshot=()=>{let t=!1;for(let n=0;n<e.syncHooks.length;n+=1){let r=e.syncHooks[n],i=r.selector(r.store.state,r.a1,r.a2,r.a3);(r.didChange||!Object.is(r.value,i))&&(t=!0,r.value=i,r.didChange=!1)}return t&&(e.syncTick+=1),e.syncTick})},after(e){e.syncHooks.length>0&&(e.didChangeStore&&(e.didChangeStore=!1,e.subscribe=t=>{let n=new Set;for(let t of e.syncHooks)n.add(t.store);let r=[];for(let e of n)r.push(e.subscribe(t));return()=>{for(let e of r)e()}}),(0,WJ.useSyncExternalStore)(e.subscribe,e.getSnapshot,e.getSnapshot))}});function YJ(e,t,n,r,i){let a=HJ();if(!a)return JJ(e,t,n,r,i);let o=a.syncIndex;a.syncIndex+=1;let s;return a.didInitialize?(s=a.syncHooks[o],(s.store!==e||s.selector!==t||!Object.is(s.a1,n)||!Object.is(s.a2,r)||!Object.is(s.a3,i))&&(s.store!==e&&(a.didChangeStore=!0),s.store=e,s.selector=t,s.a1=n,s.a2=r,s.a3=i,s.didChange=!0)):(s={store:e,selector:t,a1:n,a2:r,a3:i,value:t(e.getSnapshot(),n,r,i),didChange:!1},a.syncHooks.push(s)),s.value}function XJ(e,t,n,r,i){return(0,GJ.useSyncExternalStoreWithSelector)(e.subscribe,e.getSnapshot,e.getSnapshot,e=>t(e,n,r,i))}var ZJ=class{constructor(e){this.state=e,this.listeners=new Set,this.updateTick=0}subscribe=e=>(this.listeners.add(e),()=>{this.listeners.delete(e)});getSnapshot=()=>this.state;setState(e){if(this.state===e)return;this.state=e,this.updateTick+=1;let t=this.updateTick;for(let n of this.listeners){if(t!==this.updateTick)return;n(e)}}update(e){for(let t in e)if(!Object.is(this.state[t],e[t])){this.setState({...this.state,...e});return}}set(e,t){Object.is(this.state[e],t)||this.setState({...this.state,[e]:t})}notifyAll(){let e={...this.state};this.setState(e)}use(e,t,n,r){return qJ(this,e,t,n,r)}},QJ=class extends ZJ{constructor(e,t={},n){super(e),this.context=t,this.selectors=n}useSyncedValue(e,t){x.useDebugValue(e),NK(()=>{this.state[e]!==t&&this.set(e,t)},[e,t])}useSyncedValueWithCleanup(e,t){let n=this;NK(()=>(n.state[e]!==t&&n.set(e,t),()=>{n.set(e,void 0)}),[n,e,t])}useSyncedValues(e){let t=this;NK(()=>{t.update(e)},[t,...Object.values(e)])}useControlledProp(e,t){x.useDebugValue(e);let n=t!==void 0;NK(()=>{n&&!Object.is(this.state[e],t)&&super.setState({...this.state,[e]:t})},[e,t,n])}select(e,t,n,r){let i=this.selectors[e];return i(this.state,t,n,r)}useState(e,t,n,r){return x.useDebugValue(e),qJ(this,this.selectors[e],t,n,r)}useContextCallback(e,t){x.useDebugValue(e);let n=wK(t??LK);this.context[e]=n}useStateSetter(e){let t=x.useRef(void 0);return t.current===void 0&&(t.current=t=>{this.set(e,t)}),t.current}observe(e,t){let n;n=typeof e==`function`?e:this.selectors[e];let r=n(this.state);return t(r,r,this),this.subscribe(e=>{let i=n(e);if(!Object.is(r,i)){let e=r;r=i,t(i,e,this)}})}},$J=null;globalThis.requestAnimationFrame;var eY=new class{callbacks=[];callbacksCount=0;nextId=1;startId=1;isScheduled=!1;tick=e=>{this.isScheduled=!1;let t=this.callbacks,n=this.callbacksCount;if(this.callbacks=[],this.callbacksCount=0,this.startId=this.nextId,n>0)for(let n=0;n<t.length;n+=1)t[n]?.(e)};request(e){let t=this.nextId;return this.nextId+=1,this.callbacks.push(e),this.callbacksCount+=1,this.isScheduled||=(requestAnimationFrame(this.tick),!0),t}cancel(e){let t=e-this.startId;t<0||t>=this.callbacks.length||(this.callbacks[t]=null,--this.callbacksCount)}},tY=class e{static create(){return new e}static request(e){return eY.request(e)}static cancel(e){return eY.cancel(e)}currentId=$J;request(e){this.cancel(),this.currentId=eY.request(()=>{this.currentId=$J,e()})}cancel=()=>{this.currentId!==$J&&(eY.cancel(this.currentId),this.currentId=$J)};disposeEffect=()=>this.cancel};function nY(){let e=xK(tY.create).current;return lJ(e.disposeEffect),e}var rY=0,iY=class e{static create(){return new e}currentId=rY;start(e,t){this.clear(),this.currentId=setTimeout(()=>{this.currentId=rY,t()},e)}isStarted(){return this.currentId!==rY}clear=()=>{this.currentId!==rY&&(clearTimeout(this.currentId),this.currentId=rY)};disposeEffect=()=>this.clear};function aY(){let e=xK(iY.create).current;return lJ(e.disposeEffect),e}var oY=0;function sY(e){return oY+=1,`${e}-${Math.random().toString(36).slice(2,6)}-${oY}`}function cY(e){return e?.ownerDocument||document}function lY(e,t){if(typeof e==`string`)return{description:e};if(typeof e==`function`){let n=e(t);return typeof n==`string`?{description:n}:n}return e}var uY=typeof navigator<`u`,dY=gY(),fY=vY(),pY=_Y();typeof CSS>`u`||!CSS.supports||CSS.supports(`-webkit-backdrop-filter:none`),dY.platform===`MacIntel`&&dY.maxTouchPoints>1||/iP(hone|ad|od)|iOS/.test(dY.platform),uY&&/firefox/i.test(pY);var mY=uY&&/apple/i.test(navigator.vendor);uY&&/Edg/i.test(pY),uY&&/android/i.test(fY)||/android/i.test(pY),uY&&fY.toLowerCase().startsWith(`mac`)&&navigator.maxTouchPoints;var hY=pY.includes(`jsdom/`);function gY(){if(!uY)return{platform:``,maxTouchPoints:-1};let e=navigator.userAgentData;return e?.platform?{platform:e.platform,maxTouchPoints:navigator.maxTouchPoints}:{platform:navigator.platform??``,maxTouchPoints:navigator.maxTouchPoints??-1}}function _Y(){if(!uY)return``;let e=navigator.userAgentData;return e&&Array.isArray(e.brands)?e.brands.map(({brand:e,version:t})=>`${e}/${t}`).join(` `):navigator.userAgent}function vY(){if(!uY)return``;let e=navigator.userAgentData;return e?.platform?e.platform:navigator.platform??``}function yY(e){let t=e.activeElement;for(;t?.shadowRoot?.activeElement!=null;)t=t.shadowRoot.activeElement;return t}function bY(e,t){if(!e||!t)return!1;let n=t.getRootNode?.();if(e.contains(t))return!0;if(n&&bq(n)){let n=t;for(;n;){if(e===n)return!0;n=n.parentNode||n.host}}return!1}function xY(e){return`composedPath`in e?e.composedPath()[0]:e.target}function SY(e){if(!e||hY)return!0;try{return e.matches(`:focus-visible`)}catch{return!0}}var CY=FJ(e=>e.toasts,e=>{let t=new Map,n=0,r=0;return e.forEach((e,i)=>{let a=e.transitionStatus===`ending`;t.set(e.id,{value:e,domIndex:i,visibleIndex:a?-1:n,offsetY:r}),r+=e.height||0,a||(n+=1)}),t}),wY={toasts:PJ(e=>e.toasts),isEmpty:PJ(e=>e.toasts.length===0),toast:PJ(CY,(e,t)=>e.get(t)?.value),toastIndex:PJ(CY,(e,t)=>e.get(t)?.domIndex??-1),toastOffsetY:PJ(CY,(e,t)=>e.get(t)?.offsetY??0),toastVisibleIndex:PJ(CY,(e,t)=>e.get(t)?.visibleIndex??-1),hovering:PJ(e=>e.hovering),focused:PJ(e=>e.focused),expanded:PJ(e=>e.hovering||e.focused),expandedOrOutOfFocus:PJ(e=>e.hovering||e.focused||!e.isWindowFocused),prevFocusElement:PJ(e=>e.prevFocusElement)},TY=class extends QJ{timers=new Map;areTimersPaused=!1;constructor(e){super(e,{},wY)}setFocused(e){this.set(`focused`,e)}setHovering(e){this.set(`hovering`,e)}setIsWindowFocused(e){this.set(`isWindowFocused`,e)}setPrevFocusElement(e){this.set(`prevFocusElement`,e)}setViewport=e=>{this.set(`viewport`,e)};disposeEffect=()=>()=>{this.timers.forEach(e=>{e.timeout?.clear()}),this.timers.clear()};removeToast(e){let t=wY.toastIndex(this.state,e);if(t===-1)return;this.state.toasts[t]?.onRemove?.();let n=[...this.state.toasts];n.splice(t,1),this.setToasts(n)}addToast=e=>{let{toasts:t,timeout:n,limit:r}=this.state,i=e.id||sY(`toast`),a={...e,id:i,transitionStatus:`starting`},o=[a,...t],s=o.filter(e=>e.transitionStatus!==`ending`);if(s.length>r){let e=s.length-r,t=s.slice(-e),n=new Set(t.map(e=>e.id));this.setToasts(o.map(e=>{let t=n.has(e.id);return e.limited===t?e:{...e,limited:t}}))}else this.setToasts(o.map(e=>e.limited?{...e,limited:!1}:e));let c=a.timeout??n;return a.type!==`loading`&&c>0&&this.scheduleTimer(i,c,()=>this.closeToast(i)),wY.expandedOrOutOfFocus(this.state)&&this.pauseTimers(),i};updateToast=(e,t)=>{this.updateToastInternal(e,t)};updateToastInternal=(e,t)=>{let{timeout:n,toasts:r}=this.state,i=wY.toast(this.state,e)??null;if(!i||i.transitionStatus===`ending`)return;let a={...i,...t};this.setToasts(r.map(n=>n.id===e?{...n,...t}:n));let o=a.timeout??n,s=i?.timeout??n,c=Object.hasOwn(t,`timeout`),l=a.transitionStatus!==`ending`&&a.type!==`loading`&&o>0,u=this.timers.has(e),d=s!==o,f=i?.type===`loading`;if(!l&&u){this.timers.get(e)?.timeout?.clear(),this.timers.delete(e);return}if(l&&(!u||d||c||f)){let t=this.timers.get(e);t&&(t.timeout?.clear(),this.timers.delete(e)),this.scheduleTimer(e,o,()=>this.closeToast(e)),wY.expandedOrOutOfFocus(this.state)&&this.pauseTimers()}};closeToast=e=>{wY.toast(this.state,e)?.onClose?.();let{limit:t,toasts:n}=this.state,r=0,i=n.map(n=>{if(n.id===e)return{...n,transitionStatus:`ending`,height:0};if(n.transitionStatus===`ending`)return n;let i=r>=t;return r+=1,n.limited===i?n:{...n,limited:i}}),a=this.timers.get(e);a&&a.timeout&&(a.timeout.clear(),this.timers.delete(e)),this.handleFocusManagement(e),this.setToasts(i)};promiseToast=(e,t)=>{let n=lY(t.loading),r=this.addToast({...n,type:`loading`}),i=e.then(e=>{let n=lY(t.success,e);return this.updateToast(r,{...n,type:`success`,timeout:n.timeout}),e}).catch(e=>{let n=lY(t.error,e);return this.updateToast(r,{...n,type:`error`,timeout:n.timeout}),Promise.reject(e)});return{}.hasOwnProperty.call(t,`setPromise`)&&t.setPromise(i),i};pauseTimers(){this.areTimersPaused||(this.areTimersPaused=!0,this.timers.forEach(e=>{if(e.timeout){e.timeout.clear();let t=Date.now()-e.start,n=e.delay-t;e.remaining=n>0?n:0}}))}resumeTimers(){this.areTimersPaused&&(this.areTimersPaused=!1,this.timers.forEach((e,t)=>{e.remaining=e.remaining>0?e.remaining:e.delay,e.timeout??=iY.create(),e.timeout.start(e.remaining,()=>{this.timers.delete(t),e.callback()}),e.start=Date.now()}))}restoreFocusToPrevElement(){this.state.prevFocusElement?.focus({preventScroll:!0})}handleDocumentPointerDown=e=>{if(e.pointerType!==`touch`)return;let t=xY(e);bY(this.state.viewport,t)||(this.resumeTimers(),this.update({hovering:!1,focused:!1}))};scheduleTimer(e,t,n){let r=Date.now(),i=!wY.expandedOrOutOfFocus(this.state),a=i?iY.create():void 0;a?.start(t,()=>{this.timers.delete(e),n()}),this.timers.set(e,{timeout:a,start:i?r:0,delay:t,remaining:t,callback:n})}setToasts(e){let t={toasts:e};e.length===0&&(t.hovering=!1,t.focused=!1),this.update(t)}handleFocusManagement(e){let t=yY(cY(this.state.viewport));if(!this.state.viewport||!bY(this.state.viewport,t)||!SY(t))return;let n=wY.toasts(this.state),r=wY.toastIndex(this.state,e),i=null,a=r+1;for(;a<n.length;){if(n[a].transitionStatus!==`ending`){i=n[a];break}a+=1}if(!i)for(a=r-1;a>=0;){if(n[a].transitionStatus!==`ending`){i=n[a];break}--a}i?i.ref?.current?.focus():this.restoreFocusToPrevElement()}},EY=function(e){let{children:t,timeout:n=5e3,limit:r=3,toastManager:i}=e,a=xK(()=>new TY({timeout:n,limit:r,viewport:null,toasts:[],hovering:!1,focused:!1,isWindowFocused:!0,prevFocusElement:null})).current;return lJ(a.disposeEffect),x.useEffect(function(){if(i)return i[` subscribe`](({action:e,options:t})=>{let n=t.id;e===`promise`&&t.promise?a.promiseToast(t.promise,t):e===`update`&&n?a.updateToast(n,t):e===`close`&&n?a.closeToast(n):a.addToast(t)})},[a,n,i]),a.useSyncedValues({timeout:n,limit:r}),(0,G.jsx)(uJ.Provider,{value:a,children:t})},DY=x.forwardRef(function(e,t){let[n,r]=x.useState();NK(()=>{mY&&r(`button`)},[]);let i={tabIndex:0,role:n};return(0,G.jsx)(`span`,{...e,ref:t,style:FK,"aria-hidden":n?void 0:!0,...i,"data-base-ui-focus-guard":``})}),OY=function(e){return e.frontmostHeight=`--toast-frontmost-height`,e}({}),kY=x.forwardRef(function(e,t){let{render:n,className:r,children:i,...a}=e,o=dJ(),s=aY(),c=x.useRef(!1),l=x.useRef(!1),u=o.useState(`isEmpty`),d=o.useState(`toasts`),f=o.useState(`focused`),p=o.useState(`expanded`),m=o.useState(`prevFocusElement`),h=d[0]?.height??0,g=x.useMemo(()=>d.some(e=>e.transitionStatus===`ending`),[d]);x.useEffect(()=>{let e=o.state.viewport;if(!e)return;function t(t){u||t.key===`F6`&&t.target!==e&&(t.preventDefault(),o.setPrevFocusElement(yY(cY(e))),e?.focus({preventScroll:!0}),o.pauseTimers(),o.setFocused(!0))}let n=_q(e);return n.addEventListener(`keydown`,t),()=>{n.removeEventListener(`keydown`,t)}},[o,u]),x.useEffect(()=>{let e=o.state.viewport;if(!e||u)return;let t=_q(e);function n(e){e.target===t&&(o.setIsWindowFocused(!1),o.pauseTimers())}function r(n){if(n.relatedTarget||n.target===t)return;let r=xY(n),i=yY(cY(e));(!bY(e,r)||!SY(i))&&o.resumeTimers(),s.start(0,()=>o.setIsWindowFocused(!0))}return t.addEventListener(`blur`,n,!0),t.addEventListener(`focus`,r,!0),()=>{t.removeEventListener(`blur`,n,!0),t.removeEventListener(`focus`,r,!0)}},[o,s,u]),x.useEffect(()=>{let e=o.state.viewport;if(!e||u)return;let t=cY(e);return t.addEventListener(`pointerdown`,o.handleDocumentPointerDown,!0),()=>{t.removeEventListener(`pointerdown`,o.handleDocumentPointerDown,!0)}},[u,o]);function _(e){let t=o.state.viewport;t&&(c.current=!0,e.relatedTarget===t?d[0]?.ref?.current?.focus():o.restoreFocusToPrevElement())}function v(e){e.key===`Tab`&&e.shiftKey&&e.target===o.state.viewport&&(e.preventDefault(),o.restoreFocusToPrevElement(),o.resumeTimers())}x.useEffect(()=>{!o.state.isWindowFocused||g||!l.current||(o.resumeTimers(),o.setHovering(!1),l.current=!1)},[g,o]);function y(){o.pauseTimers(),o.setHovering(!0),l.current=!1}function b(){g?l.current=!0:(o.resumeTimers(),o.setHovering(!1))}function S(){if(c.current){c.current=!1;return}f||SY(cY(o.state.viewport).activeElement)&&(o.setFocused(!0),o.pauseTimers())}function C(e){!f||bY(o.state.viewport,e.relatedTarget)||(o.setFocused(!1),o.resumeTimers())}let w={tabIndex:-1,role:`region`,"aria-live":`polite`,"aria-atomic":!1,"aria-relevant":`additions text`,"aria-label":`Notifications`,onMouseEnter:y,onMouseMove:y,onMouseLeave:b,onFocus:S,onBlur:C,onKeyDown:v,onClick:S},T={expanded:p},E=aq(`div`,e,{ref:[t,o.setViewport],state:T,props:[w,{style:{[OY.frontmostHeight]:h?`${h}px`:void 0}},a,{children:(0,G.jsxs)(x.Fragment,{children:[!u&&m&&(0,G.jsx)(DY,{onFocus:_}),i,!u&&m&&(0,G.jsx)(DY,{onFocus:_})]})}]}),D=x.useMemo(()=>d.filter(e=>e.priority===`high`),[d]);return(0,G.jsxs)(x.Fragment,{children:[!u&&m&&(0,G.jsx)(DY,{onFocus:_}),E,!f&&D.length>0&&(0,G.jsx)(`div`,{style:FK,children:D.map(e=>(0,G.jsxs)(`div`,{role:`alert`,"aria-atomic":!0,children:[(0,G.jsx)(`div`,{children:e.title}),(0,G.jsx)(`div`,{children:e.description})]},e.id))})]})});function AY(e){return VK(19)?e:e?`true`:void 0}var jY=x.createContext(void 0);function MY(){let e=x.useContext(jY);if(!e)throw Error(zK(66));return e}var NY=function(e){return e.startingStyle=`data-starting-style`,e.endingStyle=`data-ending-style`,e}({}),PY={[NY.startingStyle]:``},FY={[NY.endingStyle]:``},IY={transitionStatus(e){return e===`starting`?PY:e===`ending`?FY:null}};function LY(e){return e==null?e:`current`in e?e.current:e}function RY(e,t=!1,n=!0){let r=nY();return wK((i,a=null)=>{r.cancel();function o(){U.flushSync(i)}let s=LY(e);if(s==null)return;let c=s;if(typeof c.getAnimations!=`function`||globalThis.BASE_UI_ANIMATIONS_DISABLED)i();else{function e(){let e=NY.startingStyle;if(!c.hasAttribute(e)){r.request(i);return}let t=new MutationObserver(()=>{c.hasAttribute(e)||(t.disconnect(),i())});t.observe(c,{attributes:!0,attributeFilter:[e]}),a?.addEventListener(`abort`,()=>t.disconnect(),{once:!0})}function i(){Promise.all(c.getAnimations().map(e=>e.finished)).then(()=>{a?.aborted||o()}).catch(()=>{let e=c.getAnimations();if(n){if(a?.aborted)return;o()}else e.length>0&&e.some(e=>e.pending||e.playState!==`finished`)&&i()})}if(t){e();return}r.request(i)}})}function zY(e){let{enabled:t=!0,open:n,ref:r,onComplete:i}=e,a=wK(i),o=RY(r,n,!1);x.useEffect(()=>{if(!t)return;let e=new AbortController;return o(a,e.signal),()=>{e.abort()}},[t,n,a,o])}var BY=function(e){return e.index=`--toast-index`,e.offsetY=`--toast-offset-y`,e.height=`--toast-height`,e.swipeMovementX=`--toast-swipe-movement-x`,e.swipeMovementY=`--toast-swipe-movement-y`,e}({}),VY={...IY,swipeDirection(e){return e?{"data-swipe-direction":e}:null}},HY=40,UY=10,WY=.5,GY=1;function KY(e,t,n){switch(e){case`up`:return-n;case`down`:return n;case`left`:return-t;case`right`:return t;default:return 0}}function qY(e){let t=window.getComputedStyle(e).transform,n=0,r=0,i=1;if(t&&t!==`none`){let e=t.match(/matrix(?:3d)?\(([^)]+)\)/);if(e){let t=e[1].split(`, `).map(parseFloat);t.length===6?(n=t[4],r=t[5],i=Math.sqrt(t[0]*t[0]+t[1]*t[1])):t.length===16&&(n=t[12],r=t[13],i=t[0])}}return{x:n,y:r,scale:i}}var JY=x.forwardRef(function(e,t){let{toast:n,render:r,className:i,swipeDirection:a=[`down`,`right`],...o}=e,s=n.positionerProps?.anchor!==void 0,c=[];s||(c=Array.isArray(a)?a:[a]);let l=c.length>0,u=dJ(),[d,f]=x.useState(void 0),[p,m]=x.useState(!1),[h,g]=x.useState(!1),[_,v]=x.useState(!1),[y,b]=x.useState({x:0,y:0}),[S,C]=x.useState({x:0,y:0,scale:1}),[w,T]=x.useState(),[E,D]=x.useState(),[O,k]=x.useState(null),A=x.useRef(null),j=x.useRef({x:0,y:0}),M=x.useRef({x:0,y:0,scale:1}),N=x.useRef(void 0),P=x.useRef(0),F=x.useRef(!1),I=x.useRef({x:0,y:0}),L=x.useRef(!1),ee=u.useState(`toastIndex`,n.id),R=u.useState(`toastVisibleIndex`,n.id),z=u.useState(`toastOffsetY`,n.id),B=u.useState(`focused`),te=u.useState(`expanded`);zY({open:n.transitionStatus!==`ending`,ref:A,onComplete(){n.transitionStatus===`ending`&&u.removeToast(n.id)}});let V=wK((e=!1)=>{let t=A.current;if(!t)return;let r=t.style.height;t.style.height=`auto`;let i=t.offsetHeight;t.style.height=r;function a(){u.updateToastInternal(n.id,{ref:A,height:i,...n.transitionStatus===`starting`?{transitionStatus:void 0}:{}})}e?U.flushSync(a):a()});NK(V,[V]);function ne(e,t){let n=e,r=t;return!c.includes(`left`)&&!c.includes(`right`)?n=e>0?e**WY:-(Math.abs(e)**WY):(!c.includes(`right`)&&e>0&&(n=e**WY),!c.includes(`left`)&&e<0&&(n=-(Math.abs(e)**WY))),!c.includes(`up`)&&!c.includes(`down`)?r=t>0?t**WY:-(Math.abs(t)**WY):(!c.includes(`down`)&&t>0&&(r=t**WY),!c.includes(`up`)&&t<0&&(r=-(Math.abs(t)**WY))),{x:n,y:r}}function H(e){if(e.button!==0)return;e.pointerType===`touch`&&u.pauseTimers();let t=xY(e.nativeEvent);if(!(t&&t.closest(`button,a,input,textarea,[role="button"],[data-swipe-ignore]`))){if(F.current=!1,N.current=void 0,P.current=0,j.current={x:e.clientX,y:e.clientY},I.current=j.current,A.current){let e=qY(A.current);M.current=e,C(e),b({x:e.x,y:e.y})}u.setHovering(!0),m(!0),g(!1),k(null),L.current=!0,A.current?.setPointerCapture(e.pointerId)}}function re(e){if(!p)return;e.preventDefault(),L.current&&=(j.current={x:e.clientX,y:e.clientY},!1);let{clientY:t,clientX:n,movementX:r,movementY:i}=e;(i<0&&t>I.current.y||i>0&&t<I.current.y)&&(I.current={x:I.current.x,y:t}),(r<0&&n>I.current.x||r>0&&n<I.current.x)&&(I.current={x:n,y:I.current.y});let a=n-j.current.x,o=t-j.current.y,s=t-I.current.y,l=n-I.current.x;if(!h&&Math.sqrt(a*a+o*o)>=GY&&(g(!0),O===null)){let e=c.includes(`left`)||c.includes(`right`),t=c.includes(`up`)||c.includes(`down`);e&&t&&k(Math.abs(a)>Math.abs(o)?`horizontal`:`vertical`)}let u;if(!N.current)O===`vertical`?o>0?u=`down`:o<0&&(u=`up`):O===`horizontal`?a>0?u=`right`:a<0&&(u=`left`):u=Math.abs(a)>=Math.abs(o)?a>0?`right`:`left`:o>0?`down`:`up`,u&&c.includes(u)&&(N.current=u,P.current=KY(u,a,o),f(u));else{let e=N.current,t=KY(e,l,s);t>HY?(F.current=!1,f(e)):!(c.includes(`left`)&&c.includes(`right`))&&!(c.includes(`up`)&&c.includes(`down`))&&P.current-t>=UY&&(F.current=!0)}let d=ne(a,o),m=M.current.x,_=M.current.y;O===`horizontal`?(c.includes(`left`)||c.includes(`right`))&&(m+=d.x):(O===`vertical`||(c.includes(`left`)||c.includes(`right`))&&(m+=d.x),(c.includes(`up`)||c.includes(`down`))&&(_+=d.y)),b({x:m,y:_})}function ie(e){if(!p)return;if(m(!1),g(!1),k(null),A.current?.releasePointerCapture(e.pointerId),F.current){b({x:S.x,y:S.y}),f(void 0);return}let t=!1,r=y.x-S.x,i=y.y-S.y,a;for(let e of c){switch(e){case`right`:r>HY&&(t=!0,a=`right`);break;case`left`:r<-HY&&(t=!0,a=`left`);break;case`down`:i>HY&&(t=!0,a=`down`);break;case`up`:i<-HY&&(t=!0,a=`up`);break;default:break}if(t)break}t?(f(a),v(!0),u.closeToast(n.id)):(b({x:S.x,y:S.y}),f(void 0))}function W(e){if(e.key===`Escape`){if(!A.current||!bY(A.current,yY(cY(A.current))))return;u.closeToast(n.id)}}x.useEffect(()=>{if(!l)return;let e=A.current;if(!e)return;function t(t){bY(e,t.target)&&t.preventDefault()}return e.addEventListener(`touchmove`,t,{passive:!1}),()=>{e.removeEventListener(`touchmove`,t)}},[l]);function ae(){if(!p&&y.x===S.x&&y.y===S.y&&!_)return{[BY.swipeMovementX]:`0px`,[BY.swipeMovementY]:`0px`};let e=y.x-S.x,t=y.y-S.y;return{transition:p?`none`:void 0,transform:p?`translateX(${y.x}px) translateY(${y.y}px) scale(${S.scale})`:void 0,[BY.swipeMovementX]:`${e}px`,[BY.swipeMovementY]:`${t}px`}}let oe=n.priority===`high`,se={role:oe?`alertdialog`:`dialog`,tabIndex:0,"aria-modal":!1,"aria-labelledby":w,"aria-describedby":E,"aria-hidden":oe&&!B?!0:void 0,onPointerDown:l?H:void 0,onPointerMove:l?re:void 0,onPointerUp:l?ie:void 0,onKeyDown:W,inert:AY(n.limited),style:{...ae(),[BY.index]:n.transitionStatus===`ending`?ee:R,[BY.offsetY]:`${z}px`,[BY.height]:n.height?`${n.height}px`:void 0}},ce=x.useMemo(()=>({rootRef:A,toast:n,titleId:w,setTitleId:T,descriptionId:E,setDescriptionId:D,swiping:p,swipeDirection:d,recalculateHeight:V,index:ee,visibleIndex:R,expanded:te}),[n,w,E,p,d,V,ee,R,te]),le={transitionStatus:n.transitionStatus,expanded:te,limited:n.limited||!1,type:n.type,swiping:ce.swiping,swipeDirection:ce.swipeDirection},ue=aq(`div`,e,{ref:[t,ce.rootRef],state:le,stateAttributesMapping:VY,props:[se,o]});return(0,G.jsx)(jY.Provider,{value:ce,children:ue})}),YY=x.forwardRef(function(e,t){let{render:n,className:r,id:i,children:a,...o}=e,{toast:s,setDescriptionId:c}=MY(),l=a??s.description,u=!!l,d=mq(i);NK(()=>{if(u)return c(d),()=>{c(void 0)}},[u,d,c]);let f=aq(`p`,e,{ref:t,state:{type:s.type},props:{...o,id:d,children:l}});return u?f:null}),XY=x.forwardRef(function(e,t){let{render:n,className:r,id:i,children:a,...o}=e,{toast:s,setTitleId:c}=MY(),l=a??s.title,u=!!l,d=mq(i);NK(()=>{if(u)return c(d),()=>{c(void 0)}},[u,d,c]);let f=aq(`h2`,e,{ref:t,state:{type:s.type},props:{...o,id:d,children:l}});return u?f:null}),ZY=x.forwardRef(function(e,t){let{render:n,className:r,disabled:i,nativeButton:a=!0,...o}=e,s=dJ(),{toast:c}=MY(),l=s.useState(`expanded`),[u,d]=x.useState(!1),{getButtonProps:f,buttonRef:p}=wq({disabled:i,native:a}),m={type:c.type};return aq(`button`,e,{ref:[t,p],state:m,props:[{"aria-hidden":!l&&!u,onClick(){s.closeToast(c.id)},onFocus(){d(!0)},onBlur(){d(!1)}},o,f]})});function QY(){let e=x.useContext(uJ);if(!e)throw Error(zK(73));let t=e.useState(`toasts`);return x.useMemo(()=>({toasts:t,add:e.addToast,close:e.closeToast,update:e.updateToast,promise:e.promiseToast}),[t,e])}function $Y(){let e=new Set;function t(t){e.forEach(e=>e(t))}return{" subscribe":function(t){return e.add(t),()=>{e.delete(t)}},add(e){let n=e.id||sY(`toast`);return t({action:`add`,options:{...e,id:n,transitionStatus:`starting`}}),n},close(e){t({action:`close`,options:{id:e}})},update(e,n){t({action:`update`,options:{...n,id:e}})},promise(e,n){let r=e;return t({action:`promise`,options:{...n,promise:e,setPromise(e){r=e}}}),r}}}var eX=5e3,tX=$Y();function nX({toast:e}){return(0,G.jsxs)(JY,{toast:e,className:kg(`relative flex w-80 items-start gap-3 border bg-elevated p-4 shadow-lg`,`data-[swipe=move]:translate-x-[var(--toast-swipe-move-x)]`,`data-[ending-style]:translate-x-[var(--toast-swipe-end-x)]`,`data-[ending-style]:opacity-0`,`data-[starting-style]:translate-y-2 data-[starting-style]:opacity-0`,`transition-all duration-200`,e.type===`error`&&`border-error/50`,e.type===`success`&&`border-approval/50`,(!e.type||e.type===`info`)&&`border-border`),children:[(0,G.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,G.jsx)(XY,{className:kg(`text-sm font-medium`,e.type===`error`&&`text-error`,e.type===`success`&&`text-approval`,(!e.type||e.type===`info`)&&`text-primary`),children:e.title}),e.description&&(0,G.jsx)(YY,{className:`mt-1 text-xs text-muted line-clamp-2`,children:e.description})]}),(0,G.jsx)(ZY,{className:`shrink-0 text-muted hover:text-primary transition-colors`,"aria-label":`Close`,children:(0,G.jsxs)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:`16`,height:`16`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,G.jsx)(`line`,{x1:`18`,y1:`6`,x2:`6`,y2:`18`}),(0,G.jsx)(`line`,{x1:`6`,y1:`6`,x2:`18`,y2:`18`})]})})]})}function rX(){let{toasts:e}=QY();return(0,G.jsx)(G.Fragment,{children:e.map(e=>(0,G.jsx)(nX,{toast:e},e.id))})}function iX(){return(0,G.jsxs)(EY,{timeout:eX,toastManager:tX,children:[(0,G.jsx)(rX,{}),(0,G.jsx)(kY,{className:`fixed bottom-4 right-4 z-[100] flex flex-col gap-2`})]})}var aX=[`CONNECTING`,`OPEN`,`CLOSING`,`CLOSED`],oX=3e3,sX=8e3,cX=15e3,lX=5e3,uX=2e4,dX=1e4,fX=1500,pX=5e3,mX=750,hX=4,gX=5e3,_X=new class{constructor(){this.ws=null,this.listeners=new Set,this.statusListeners=new Set,this.status=`connecting`,this.error=null,this.reconnectAttempts=0,this.reconnectTimer=null,this.connectTimer=null,this.manualClose=!1,this.lastTick=Date.now(),this.wakeCheckInterval=null,this.lifecycleStarted=!1,this.heartbeatTimer=null,this.pongTimer=null,this.lastForceReconnectTs=0,this.lastConnectTs=0,this.pingSeq=0,this.connectionEpoch=0,this.consecutiveFailures=0,this.stallCount=0,this.isResumeAttempt=!1,this.leakedSockets=new Set,this.verifyTimer=null,this.onVisibilityChange=()=>{if(XD(`ws_visibility`,{state:document.visibilityState,...this.wsSnap()},`info`),document.visibilityState===`visible`){let e=Date.now(),t=e-this.lastTick;this.lastTick=e,XD(`ws_resume`,{gapMs:t,...this.wsSnap()},`info`),this.ws?.readyState===WebSocket.OPEN?this.verifyConnection():this.forceReconnect(`visibilitychange`,!0)}else this.stopHeartbeat(),this.cancelVerify(),this.reconnectTimer&&=(window.clearTimeout(this.reconnectTimer),null)},this.onPageShow=e=>{XD(`ws_pageshow`,{persisted:e.persisted,...this.wsSnap()},`info`),e.persisted&&(this.lastTick=Date.now(),this.forceReconnect(`pageshow`,!0))}}wsSnap(){return{status:this.status,ws:this.ws?aX[this.ws.readyState]:null,attempt:this.reconnectAttempts,failures:this.consecutiveFailures,stalls:this.stallCount,leaked:this.leakedSockets.size,online:typeof navigator<`u`?navigator.onLine:void 0,verifying:this.verifyTimer!==null,buffered:this.ws?this.ws.bufferedAmount:void 0}}connect(){if(this.ws){let e=this.ws.readyState===WebSocket.OPEN;if(e&&this.status===`connected`){XD(`ws_connect_skip`,{reason:`already_open`,...this.wsSnap()});return}let t=Date.now();if(this.ws.readyState===WebSocket.CONNECTING&&t-this.lastConnectTs<200){XD(`ws_connect_skip`,{reason:`already_connecting`,...this.wsSnap()});return}XD(`ws_connect_destroy_zombie`,{reason:e?`open_desynced`:`not_open`,...this.wsSnap()}),this.destroySocket()}this.manualClose=!1,this.clearConnectTimer(),this.setStatus(`connecting`);let e=`${window.location.protocol===`https:`?`wss`:`ws`}://${window.location.host}/ws`;XD(`ws_connect`,{url:e,resume:this.isResumeAttempt,...this.wsSnap()},`info`);let t=new WebSocket(e);this.ws=t,this.lastConnectTs=Date.now(),this.leakedSockets.add(t);let n=this.isResumeAttempt?sX:oX;this.isResumeAttempt=!1,this.connectTimer=window.setTimeout(()=>{this.ws===t&&(this.connectTimer=null,t.readyState===WebSocket.OPEN&&this.status===`connected`||(XD(`ws_connect_timeout`,{wsState:aX[t.readyState],managerStatus:this.status,timeoutMs:n,...this.wsSnap()},`info`),this.consecutiveFailures+=1,this.destroySocket(),this.scheduleReconnect()))},n),t.onopen=()=>{if(this.ws!==t){XD(`ws_onopen_stale`,this.wsSnap(),`info`);return}XD(`ws_onopen`,this.wsSnap(),`info`),this.clearConnectTimer(),this.reconnectAttempts=0,this.consecutiveFailures=0,this.stallCount=0,this.connectionEpoch+=1,this.leakedSockets.delete(t),this.setStatus(`connected`),this.startHeartbeat()},t.onmessage=e=>{try{let t=e.data,n=performance.now(),r=JSON.parse(t),i=performance.now()-n,a=r;if(a._parseMs=Math.round(i),a._rawLength=t.length,r.type===`pong`){r.seq===this.pingSeq&&(this.clearPongTimer(),this.verifyTimer!==null&&(this.cancelVerify(),XD(`ws_verify_ok`,this.wsSnap(),`info`),this.startHeartbeat(pX)));return}this.listeners.forEach(e=>e(r))}catch{}},t.onerror=()=>{this.ws===t&&(XD(`ws_onerror`,this.wsSnap(),`info`),this.clearConnectTimer())},t.onclose=e=>{if(this.ws!==t){XD(`ws_onclose_stale`,{code:e.code,...this.wsSnap()},`info`);return}XD(`ws_onclose`,{code:e.code,reason:e.reason,clean:e.wasClean,...this.wsSnap()},`info`),this.clearConnectTimer(),this.cancelVerify(),this.consecutiveFailures+=1,this.ws=null,this.manualClose?this.setStatus(`disconnected`):this.scheduleReconnect()}}disconnect(){this.manualClose=!0,this.clearConnectTimer(),this.cancelVerify(),this.reconnectTimer&&=(window.clearTimeout(this.reconnectTimer),null),this.destroySocket(),this.setStatus(`disconnected`)}startLifecycleListeners(){this.lifecycleStarted||typeof document>`u`||typeof window>`u`||(this.lifecycleStarted=!0,document.addEventListener(`visibilitychange`,this.onVisibilityChange),window.addEventListener(`pageshow`,this.onPageShow),this.lastTick=Date.now(),this.wakeCheckInterval=window.setInterval(()=>{let e=Date.now(),t=e-this.lastTick;this.isHidden()||(t>cX&&(XD(`ws_time_jump`,{gapMs:t,...this.wsSnap()},`info`),this.forceReconnect(`time_jump`,!0)),this.lastTick=e)},lX))}stopLifecycleListeners(){this.lifecycleStarted&&(this.lifecycleStarted=!1,document.removeEventListener(`visibilitychange`,this.onVisibilityChange),window.removeEventListener(`pageshow`,this.onPageShow),this.wakeCheckInterval!==null&&(window.clearInterval(this.wakeCheckInterval),this.wakeCheckInterval=null))}send(e){if(this.ws?.readyState!==WebSocket.OPEN)return!1;try{return this.ws.send(JSON.stringify(e)),!0}catch(t){return XD(`ws_send_error`,{messageType:e.type,error:t instanceof Error?t.message:String(t),...this.wsSnap()},`info`),this.destroySocket(),this.scheduleReconnect(),!1}}subscribe(e){return this.listeners.add(e),()=>this.listeners.delete(e)}subscribeStatus(e){return this.statusListeners.add(e),e(this.status,this.error,this.connectionEpoch),()=>this.statusListeners.delete(e)}getStatus(){return this.status}getConnectionEpoch(){return this.connectionEpoch}verifyConnection(){this.cancelVerify(),this.stopHeartbeat(),this.pingSeq+=1;let e=this.pingSeq,t=this.ws;if(XD(`ws_verify`,{seq:e,...this.wsSnap()},`info`),!this.send({type:`ping`,seq:e})){XD(`ws_verify_send_fail`,this.wsSnap(),`info`),this.forceReconnect(`verify_send_fail`,!0);return}this.verifyTimer=window.setTimeout(()=>{this.verifyTimer=null,this.ws===t&&(XD(`ws_verify_timeout`,this.wsSnap(),`info`),this.forceReconnect(`verify_timeout`,!0))},fX)}cancelVerify(){this.verifyTimer!==null&&(window.clearTimeout(this.verifyTimer),this.verifyTimer=null)}forceReconnect(e=`unknown`,t=!1){if(this.manualClose){XD(`ws_force_skip`,{trigger:e,reason:`manual_close`});return}let n=Date.now(),r=t?200:500;if(n-this.lastForceReconnectTs<r){XD(`ws_force_skip`,{trigger:e,reason:`debounce`,force:t});return}if(!t&&this.ws?.readyState===WebSocket.OPEN&&this.status===`connected`){XD(`ws_force_skip`,{trigger:e,reason:`already_connected`});return}this.lastForceReconnectTs=n,XD(`ws_force_reconnect`,{trigger:e,force:t,...this.wsSnap()},`info`),this.reconnectAttempts=0,this.consecutiveFailures=0,this.stallCount=0,this.reconnectTimer&&=(window.clearTimeout(this.reconnectTimer),null),this.destroySocket(),t?(this.purgeLeakedSockets(),this.isResumeAttempt=!0,this.setStatus(`reconnecting`),this.reconnectTimer=window.setTimeout(()=>{this.reconnectTimer=null,this.connect()},mX)):this.connect()}startHeartbeat(e){this.stopHeartbeat();let t=()=>{this.ws?.readyState===WebSocket.OPEN&&(this.pingSeq+=1,this.send({type:`ping`,seq:this.pingSeq})&&(this.clearPongTimer(),this.pongTimer=window.setTimeout(()=>{this.pongTimer=null,XD(`ws_pong_timeout`,this.wsSnap(),`info`),this.destroySocket(),this.scheduleReconnect()},dX)))};e!==void 0&&e<uX?this.heartbeatTimer=window.setTimeout(()=>{t(),this.heartbeatTimer=window.setInterval(t,uX)},e):this.heartbeatTimer=window.setInterval(t,uX)}stopHeartbeat(){this.heartbeatTimer!==null&&(window.clearTimeout(this.heartbeatTimer),this.heartbeatTimer=null),this.clearPongTimer()}clearPongTimer(){this.pongTimer!==null&&(window.clearTimeout(this.pongTimer),this.pongTimer=null)}setStatus(e,t=null){this.status=e,this.error=t,this.statusListeners.forEach(n=>n(e,t,this.connectionEpoch))}scheduleReconnect(){if(this.stopHeartbeat(),this.isHidden()){XD(`ws_schedule_skip`,{reason:`hidden`,...this.wsSnap()}),this.setStatus(`reconnecting`);return}if(this.consecutiveFailures>=hX){XD(`ws_stall_detected`,this.wsSnap(),`info`),this.purgeLeakedSockets();let e=Math.min(gX*2**this.stallCount,3e4);this.stallCount+=1,this.consecutiveFailures=0,this.reconnectAttempts=0,this.isResumeAttempt=!0,this.setStatus(`reconnecting`),this.reconnectTimer=window.setTimeout(()=>{this.reconnectTimer=null,this.connect()},e);return}this.reconnectAttempts+=1;let e=Math.min(1e3*2**(this.reconnectAttempts-1),3e4);XD(`ws_schedule_reconnect`,{delay:e,...this.wsSnap()}),this.setStatus(`reconnecting`),this.reconnectTimer&&window.clearTimeout(this.reconnectTimer),this.reconnectTimer=window.setTimeout(()=>{this.reconnectTimer=null,this.connect()},e)}isHidden(){return typeof document<`u`&&document.visibilityState===`hidden`}clearConnectTimer(){this.connectTimer&&=(window.clearTimeout(this.connectTimer),null)}destroySocket(){if(this.clearConnectTimer(),this.stopHeartbeat(),this.cancelVerify(),!this.ws)return;let e=this.ws;this.ws=null,this.leakedSockets.add(e),e.onopen=null,e.onmessage=null,e.onerror=null,e.onclose=null;try{e.close()}catch{}}purgeLeakedSockets(){if(this.leakedSockets.size!==0){XD(`ws_purge_leaked`,{count:this.leakedSockets.size},`info`);for(let e of this.leakedSockets)try{e.onopen=null,e.onmessage=null,e.onerror=null,e.onclose=null,e.close()}catch{}this.leakedSockets.clear()}}};function vX(){let e=Jm(e=>e.setConnectionState);return(0,x.useEffect)(()=>{_X.connect(),_X.startLifecycleListeners();let t=_X.subscribeStatus((t,n,r)=>{e(t,n,r)});return()=>{t(),_X.stopLifecycleListeners()}},[e]),{sendMessage:(0,x.useMemo)(()=>e=>{_X.send(e)},[]),subscribe:(0,x.useMemo)(()=>_X.subscribe.bind(_X),[]),getConnectionEpoch:(0,x.useMemo)(()=>()=>_X.getConnectionEpoch(),[])}}var yX=100;function bX({viewport:e,win:t,doc:n}){if(!e)return!1;let r=Math.max(0,e.offsetTop||0),i=Math.max(0,e.offsetLeft||0),a=t.innerHeight-(e.height+r),o=Math.max(0,a),s=Math.max(0,e.height||0),c=Math.max(0,e.width||0);return n.documentElement.style.setProperty(`--keyboard-inset`,`${o}px`),n.documentElement.style.setProperty(`--viewport-offset-top`,`${r}px`),n.documentElement.style.setProperty(`--viewport-offset-left`,`${i}px`),n.documentElement.style.setProperty(`--visual-viewport-height`,`${s}px`),n.documentElement.style.setProperty(`--visual-viewport-width`,`${c}px`),o>yX?n.documentElement.classList.add(`keyboard-visible`):n.documentElement.classList.remove(`keyboard-visible`),!0}function xX(e){e.documentElement.style.removeProperty(`--keyboard-inset`),e.documentElement.style.removeProperty(`--viewport-offset-top`),e.documentElement.style.removeProperty(`--viewport-offset-left`),e.documentElement.style.removeProperty(`--visual-viewport-height`),e.documentElement.style.removeProperty(`--visual-viewport-width`),e.documentElement.classList.remove(`keyboard-visible`)}function SX(){(0,x.useEffect)(()=>{let e=window.visualViewport;if(!e)return;let t=null,n=null,r=()=>{let e=document.activeElement;if(!e)return!1;let t=e.tagName?.toLowerCase();return t===`input`||t===`textarea`?!0:!!e.isContentEditable},i=()=>{bX({viewport:e,win:window,doc:document})},a=()=>{if(typeof window.requestAnimationFrame!=`function`){i();return}t!==null&&window.cancelAnimationFrame(t);let e=performance.now(),n=()=>{i(),t=performance.now()-e<1500?window.requestAnimationFrame(n):null};t=window.requestAnimationFrame(n)},o=()=>{if(!r()){c();return}i()},s=()=>{n!==null||typeof window.setInterval!=`function`||(n=window.setInterval(o,250),o())},c=()=>{n===null||typeof window.clearInterval!=`function`||(window.clearInterval(n),n=null)},l=()=>{r()?(a(),s(),i()):c()},u=()=>{l()},d=()=>{l()},f=()=>{a()};return i(),l(),e.addEventListener(`resize`,i),e.addEventListener(`scroll`,i),typeof window.addEventListener==`function`&&(window.addEventListener(`resize`,i),window.addEventListener(`orientationchange`,f)),typeof document.addEventListener==`function`&&(document.addEventListener(`focusin`,u),document.addEventListener(`focusout`,d),document.addEventListener(`focus`,u,!0),document.addEventListener(`blur`,d,!0)),()=>{e.removeEventListener(`resize`,i),e.removeEventListener(`scroll`,i),typeof window.removeEventListener==`function`&&(window.removeEventListener(`resize`,i),window.removeEventListener(`orientationchange`,f)),typeof document.removeEventListener==`function`&&(document.removeEventListener(`focusin`,u),document.removeEventListener(`focusout`,d),document.removeEventListener(`focus`,u,!0),document.removeEventListener(`blur`,d,!0)),t!==null&&typeof window.cancelAnimationFrame==`function`&&window.cancelAnimationFrame(t),c(),xX(document)}},[])}var CX=[`theme`,`commandPresets`,`defaultPresetId`,`defaultProjectDir`,`lastProjectPath`,`recentPaths`,`sessionSortMode`,`sessionSortDirection`,`manualSessionOrder`,`projectFilters`,`hostFilters`],wX=[`claude`,`claude-rp`,`codex`,`pi`,`devin`,`grok`,`omp`];function TX(e,t){return Array.isArray(e)&&e.length<=t&&e.every(e=>typeof e==`string`)}function EX(e){if(typeof e!=`object`||!e)return!1;let t=e;return typeof t.id==`string`&&t.id.length>=1&&t.id.length<=128&&typeof t.label==`string`&&t.label.trim().length>=1&&t.label.length<=64&&typeof t.command==`string`&&t.command.trim().length>=1&&t.command.length<=1024&&typeof t.isBuiltIn==`boolean`&&(t.agentType===void 0||wX.includes(t.agentType))}var DX={theme:e=>e===`dark`||e===`light`,commandPresets:e=>Array.isArray(e)&&e.length<=50&&e.every(EX),defaultPresetId:e=>typeof e==`string`&&e.length<=128,defaultProjectDir:e=>typeof e==`string`&&e.length<=4096,lastProjectPath:e=>e===null||typeof e==`string`&&e.length<=4096,recentPaths:e=>TX(e,50),sessionSortMode:e=>e===`status`||e===`created`||e===`manual`,sessionSortDirection:e=>e===`asc`||e===`desc`,manualSessionOrder:e=>TX(e,1e3),projectFilters:e=>TX(e,500),hostFilters:e=>TX(e,500)};function OX(e){return CX.includes(e)}function kX(e,t){return DX[e](t)}var AX=`agentboard-theme`,jX=`agentboard-settings`,MX=200,NX=new Map,PX=new Set,FX=null,IX=!1;function LX(e){return e===`theme`?RW.getState().theme:H.getState()[e]}function RX(e){let t=e===`theme`?AX:jX;return M.getItem(t)!==null}function zX(){if(FX=null,PX.size===0)return;let e={};for(let t of PX){let n=LX(t);e[t]=n,NX.set(t,JSON.stringify(n))}PX.clear();try{fetch(`/api/settings/synced`,{method:`PUT`,headers:{"content-type":`application/json`},body:JSON.stringify({settings:e})}).then(e=>{e.ok||XD(`synced_settings_push_rejected`,{status:e.status},`warn`)}).catch(e=>{XD(`synced_settings_push_failed`,{message:e instanceof Error?e.message:String(e)},`warn`)})}catch(e){XD(`synced_settings_push_failed`,{message:e instanceof Error?e.message:String(e)},`warn`)}}function BX(e){PX.add(e),!FX&&(FX=setTimeout(zX,MX))}function VX(e){let t=new Map;for(let e of CX)t.set(e,RX(e));let n={},r;for(let[t,i]of Object.entries(e))!OX(t)||!kX(t,i)||(NX.set(t,JSON.stringify(i)),t===`theme`?r=i:n[t]=i);r!==void 0&&RW.setState({theme:r}),Object.keys(n).length>0&&H.setState(n);for(let n of CX){if(n in e||!t.get(n))continue;let r=LX(n);kX(n,r)&&NX.get(n)!==JSON.stringify(r)&&BX(n)}}function HX(){if(IX)return()=>{};IX=!0;let e=H.subscribe((e,t)=>{let n=e,r=t;for(let e of CX)e!==`theme`&&n[e]!==r[e]&&NX.get(e)!==JSON.stringify(n[e])&&BX(e)}),t=RW.subscribe((e,t)=>{e.theme!==t.theme&&NX.get(`theme`)!==JSON.stringify(e.theme)&&BX(`theme`)});return()=>{e(),t(),IX=!1,FX&&=(clearTimeout(FX),null),PX.clear(),NX.clear()}}function UX(e,t,n){let r=e;return t.length>0&&(r=r.filter(e=>t.includes(e.projectPath))),n.length>0&&(r=r.filter(e=>n.includes(e.host??``))),r}function WX(){let[e,t]=(0,x.useState)(!1),[n,r]=(0,x.useState)(void 0),[i,a]=(0,x.useState)(void 0),[o,s]=(0,x.useState)(void 0),[c,l]=(0,x.useState)(!1),[u,d]=(0,x.useState)(null),[f,p]=(0,x.useState)(null),[m,h]=(0,x.useState)(null),g=Jm(e=>e.sessions),_=Jm(e=>e.agentSessions),v=Jm(e=>e.agentSessionsEpoch),y=Jm(e=>e.selectedSessionId),b=Jm(e=>e.selectedHibernatingSessionId),S=Jm(e=>e.setSessions),C=Jm(e=>e.setAgentSessions),w=Jm(e=>e.setActiveAgentSessions),T=Jm(e=>e.setHostStatuses),E=Jm(e=>e.updateSession),D=Jm(e=>e.setSelectedSessionId),O=Jm(e=>e.setSelectedHibernatingSessionId),k=Jm(e=>e.hasLoaded),A=Jm(e=>e.connectionStatus),j=Jm(e=>e.connectionError),M=Jm(e=>e.clearExitingSession),N=Jm(e=>e.markSessionExiting),P=Jm(e=>e.setRemoteAllowControl),F=Jm(e=>e.setRemoteAllowAttach),I=Jm(e=>e.setHostLabel),L=Jm(e=>e.setPreferWindowName),ee=Jm(e=>e.hostStatuses),R=Jm(e=>e.remoteAllowControl),z=Jm(e=>e.hostLabel),B=RW(e=>e.theme),te=re(),V=H(e=>e.defaultProjectDir),ne=H(e=>e.commandPresets),ie=H(e=>e.defaultPresetId),W=H(e=>e.lastProjectPath),ae=H(e=>e.setLastProjectPath),oe=H(e=>e.addRecentPath),se=H(e=>e.shortcutModifier),ce=H(e=>e.sidebarWidth),le=H(e=>e.setSidebarWidth),ue=H(e=>e.projectFilters),de=H(e=>e.hostFilters),fe=H(e=>e.soundOnPermission),pe=H(e=>e.soundOnIdle),me=Jm(e=>e.connectionEpoch),{sendMessage:he,subscribe:ge,getConnectionEpoch:_e}=vX();(0,x.useEffect)(()=>HX(),[]),SX(),(0,x.useEffect)(()=>{if(typeof document>`u`||!fe&&!pe)return;let e=!1,t=()=>{e&&!eJ()||(e=!0,nJ())};return document.addEventListener(`click`,t,{passive:!0}),document.addEventListener(`keydown`,t,{passive:!0}),document.addEventListener(`touchstart`,t,{passive:!0}),()=>{document.removeEventListener(`click`,t),document.removeEventListener(`keydown`,t),document.removeEventListener(`touchstart`,t)}},[fe,pe]);let ve=(0,x.useRef)(!1),ye=(0,x.useCallback)(e=>{e.preventDefault(),ve.current=!0,document.body.style.cursor=`col-resize`,document.body.style.userSelect=`none`},[]);(0,x.useEffect)(()=>{if(typeof document>`u`||typeof document.addEventListener!=`function`)return;let e=e=>{if(!ve.current)return;let t=e.clientX;le(Math.max(180,Math.min(400,t)))},t=()=>{ve.current&&(ve.current=!1,document.body.style.cursor=``,document.body.style.userSelect=``)};return document.addEventListener(`mousemove`,e),document.addEventListener(`mouseup`,t),()=>{document.removeEventListener(`mousemove`,e),document.removeEventListener(`mouseup`,t)}},[le]),(0,x.useEffect)(()=>{let e=ge(e=>{if(e.type!==`terminal-output`){if(e.type===`sessions`){let t=Jm.getState().sessions,{soundOnPermission:n,soundOnIdle:r}=H.getState();if(n||r)for(let i of e.sessions){let e=t.find(e=>e.id===i.id);e&&e.status!==i.status&&(e.status!==`permission`&&i.status===`permission`&&n&&aJ(),e.status===`working`&&i.status===`waiting`&&r&&oJ())}if(Fe.current.size>0){let e=_e();for(let[t,n]of Fe.current)n.epoch!==e&&Fe.current.delete(t)}let i=Fe.current.size>0?e.sessions.filter(e=>!Fe.current.has(e.id)):e.sessions,{selectedSessionId:a,selectedHibernatingSessionId:o}=Jm.getState(),s=a!==null&&o===null&&!i.some(e=>e.id===a)?t.find(e=>e.id===a)?.agentSessionId?.trim()??null:null;s&&(je.current=s),S(i);let c=Me.current,{selectedSessionId:l,selectedHibernatingSessionId:u}=Jm.getState(),{projectFilters:d,hostFilters:f}=H.getState();if(c&&l===null&&u===null){let e=i.find(e=>!(e.agentSessionId?.trim()!==c||d.length>0&&!d.includes(e.projectPath)||f.length>0&&!f.includes(e.host??``)));e&&(Me.current=null,D(e.id))}}if(e.type===`host-status`&&T(e.hosts),e.type===`server-config`&&(P(e.remoteAllowControl),F(e.remoteAllowAttach),I(e.hostLabel),L(e.preferWindowName),e.clientLogLevel&&YD(e.clientLogLevel)),e.type===`synced-settings`&&VX(e.settings),e.type===`session-update`){let t=Jm.getState().sessions.find(t=>t.id===e.session.id)?.status,n=e.session.status;if(E(e.session),t){let{soundOnPermission:e,soundOnIdle:r}=H.getState();t!==`permission`&&n===`permission`&&e&&aJ(),t===`working`&&n===`waiting`&&r&&oJ()}}if(e.type===`session-created`){let t=Jm.getState().sessions;t.some(t=>t.id===e.session.id)||S([e.session,...t]),D(e.session.id),oe(e.session.projectPath);let{projectFilters:n,setProjectFilters:r}=H.getState();n.length>0&&!n.includes(e.session.projectPath)&&r([...n,e.session.projectPath])}if(e.type===`session-removed`){lW(e.sessionId);let t=Jm.getState().sessions,n=t.filter(t=>t.id!==e.sessionId);n.length!==t.length&&S(n)}if(e.type===`agent-sessions`){let t=Array.isArray(e.active)?e.active:[],n=Array.isArray(e.hibernating)?e.hibernating:[],r=Array.isArray(e.history)?e.history:[],{selectedHibernatingSessionId:i}=Jm.getState(),a=je.current;i&&!n.some(e=>e.sessionId===i)&&(Me.current=i),C(t,n,r),h(e=>e&&n.some(t=>t.sessionId===e.sessionId)?null:e),a&&n.some(e=>e.sessionId===a)?(je.current=null,O(a)):a&&(je.current=null)}if(e.type===`agent-sessions-active`&&w(Array.isArray(e.active)?e.active:[]),e.type===`session-orphaned`&&!e.supersededBy){let t=Jm.getState().sessions,n=t.filter(t=>t.agentSessionId?.trim()!==e.session.sessionId);n.length!==t.length&&S(n)}if(e.type===`session-activated`){let t=Jm.getState().sessions.find(t=>t.tmuxWindow===e.window);t&&E({...t,agentSessionId:e.session.sessionId,agentSessionName:e.session.displayName,logFilePath:e.session.logFilePath,isHibernating:e.session.isHibernating,lastUserMessage:e.session.lastUserMessage??t.lastUserMessage})}if(e.type===`session-wake-result`)if(e.ok&&e.session){h(t=>t?.sessionId===e.sessionId?null:t);let t=Jm.getState().sessions;t.some(t=>t.id===e.session.id)||S([e.session,...t]),D(e.session.id)}else e.ok||(d(`${e.error?.code}: ${e.error?.message}`),window.setTimeout(()=>d(null),6e3));if(e.type===`session-hibernate-result`&&(e.ok?(e.session&&h(e.session),O(e.sessionId)):(d(e.error??`Failed to hibernate session`),window.setTimeout(()=>d(null),6e3))),e.type===`terminal-error`&&(!e.sessionId||e.sessionId===y)&&(d(`${e.code}: ${e.message}`),window.setTimeout(()=>d(null),6e3)),e.type===`terminal-ready`&&e.sessionId===y&&d(null),e.type===`error`&&(d(e.message),window.setTimeout(()=>d(null),6e3)),e.type===`kill-failed`){let t=Fe.current.get(e.sessionId);if(t){let n=Jm.getState().sessions;n.some(t=>t.id===e.sessionId)||S([t.session,...n]),t.wasSelected&&D(e.sessionId),Fe.current.delete(e.sessionId)}M(e.sessionId),d(e.message),window.setTimeout(()=>d(null),6e3)}e.type===`session-move-to-history-result`&&!e.ok&&e.error&&(d(e.error),window.setTimeout(()=>d(null),6e3))}});return()=>{e()}},[y,b,oe,M,he,D,O,h,S,C,w,T,P,F,I,L,ge,E]);let be=(0,x.useMemo)(()=>g.find(e=>e.id===y)||null,[y,g]),xe=_.hibernating??[],Se=_.history??[],Ce=(0,x.useMemo)(()=>UX(xe,ue,de),[xe,ue,de]),we=(0,x.useMemo)(()=>Ce.find(e=>e.sessionId===b)||(m?.sessionId===b?m:null),[Ce,m,b]);(0,x.useEffect)(()=>{be?.projectPath&&!be.remote&&ae(be.projectPath)},[be?.projectPath,be?.remote,ae]);let Te=H(e=>e.sessionSortMode),Ee=H(e=>e.sessionSortDirection),De=H(e=>e.manualSessionOrder),Oe=(0,x.useMemo)(()=>Nm(g,{mode:Te,direction:Ee,manualOrder:De}),[g,Te,Ee,De]),ke=(0,x.useMemo)(()=>{let e=Oe;return ue.length>0&&(e=e.filter(e=>ue.includes(e.projectPath))),de.length>0&&(e=e.filter(e=>de.includes(e.host??``))),e},[Oe,ue,de]),Ae=(0,x.useRef)(b),je=(0,x.useRef)(null),Me=(0,x.useRef)(null),Ne=(0,x.useRef)(me),Pe=(0,x.useCallback)(()=>ke.length>0?(D(ke[0].id),!0):Ce.length>0?(O(Ce[0].sessionId),!0):!1,[ke,Ce,D,O]);(0,x.useEffect)(()=>{let e=Ae.current;e&&b===null&&!xe.some(t=>t.sessionId===e)?Me.current=e:b!==null&&(Me.current=null),Ae.current=b},[xe,b]),(0,x.useEffect)(()=>{m&&b!==m.sessionId&&h(null)},[m,b]),(0,x.useEffect)(()=>{Ne.current!==me&&(Ne.current=me,je.current=null,Me.current=null,h(null))},[me]),(0,x.useEffect)(()=>{k&&(b||y&&(ke.some(e=>e.id===y)||Pe()||D(null)))},[k,y,b,Pe,D]),(0,x.useEffect)(()=>{if(!b||m?.sessionId===b||v!==me||Ce.some(e=>e.sessionId===b))return;let e=ke.find(e=>e.agentSessionId?.trim()===b);if(e){D(e.id);return}Pe()||O(null)},[Ce,ke,v,m,b,Pe,D,O,me]),(0,x.useEffect)(()=>{let e=Me.current;if(!e)return;if(b!==null){Me.current=null;return}let t=ke.find(t=>t.agentSessionId?.trim()===e);if(t){Me.current=null,D(t.id);return}if(y!==null){Me.current=null;return}Pe()&&(Me.current=null)},[ke,y,b,Pe,D]),(0,x.useEffect)(()=>{window.matchMedia(`(max-width: 767px)`).matches&&k&&y===null&&b===null&&(ke.length>0||Ce.length>0)&&Pe()},[Ce.length,ke.length,k,Pe,y,b]);let Fe=(0,x.useRef)(new Map),Ie=(0,x.useCallback)((e,t=`unknown`)=>{lW(e);let{sessions:n,selectedSessionId:r}=Jm.getState(),i=n.find(t=>t.id===e);i&&Fe.current.set(e,{session:i,wasSelected:r===e,epoch:_e()}),(0,U.flushSync)(()=>{N(e),S(n.filter(t=>t.id!==e))}),he({type:`session-kill`,sessionId:e,source:t})},[N,S,he]);(0,x.useEffect)(()=>{let n=Je(se),r=r=>{if(r.defaultPrevented)return;let i=r.code,a=Ze(r,n);if(a&&(i===`BracketLeft`||i===`BracketRight`)){r.preventDefault();let e=i===`BracketLeft`?-1:1,t=ke;if(t.length===0){let t=Ce;if(t.length===0)return;let n=t.findIndex(e=>e.sessionId===b);if(n===-1){O(t[0].sessionId);return}O(t[(n+e+t.length)%t.length].sessionId);return}let n=t.findIndex(e=>e.id===y);if(n===-1){D(t[0].id);return}D(t[(n+e+t.length)%t.length].id);return}if(a&&/^Digit[1-9]$/.test(i)){let e=Number(i.slice(5))-1;if(ke.length>0){let t=ke[e];if(!t)return;r.preventDefault(),D(t.id);return}let t=Ce[e];if(!t)return;r.preventDefault(),O(t.sessionId);return}if(a&&i===`KeyN`){r.preventDefault(),!e&&te&&t(!0);return}if(a&&i===`KeyX`){r.preventDefault(),y&&!e&&Ie(y,`keyboard_shortcut`);return}};return window.addEventListener(`keydown`,r),()=>window.removeEventListener(`keydown`,r)},[e,y,b,D,O,ke,Ce,Ie,se,te]);let Le=()=>te?(r(void 0),a(void 0),s(void 0),t(!0),!0):!1,Re=()=>l(!0),ze=(e,t,n,r)=>{he({type:`session-create`,projectPath:e,name:t,command:n,host:r}),r||ae(e)},Be=e=>{he({type:`session-wake`,sessionId:e})},Ve=(0,x.useCallback)(e=>{he({type:`session-hibernate`,sessionId:e})},[he]),He=(e,t)=>{he({type:`session-rename`,sessionId:e,newName:t})},Ue=(0,x.useCallback)(e=>{let t=g.find(t=>t.id===e);t&&he({type:`session-create`,projectPath:t.projectPath,command:t.command||void 0,host:t.remote&&t.host?t.host:void 0})},[g,he]),We=(0,x.useCallback)(e=>{he({type:`session-move-to-history`,sessionId:e})},[he]);(0,x.useEffect)(()=>{document.documentElement.setAttribute(`data-theme`,B)},[B]),(0,x.useEffect)(()=>{fetch(`/api/server-info`).then(e=>e.json()).then(e=>p(e)).catch(()=>{})},[]);let Ge=(0,x.useMemo)(()=>z?ee.filter(e=>e.host!==z):ee,[ee,z]);return(0,G.jsxs)(`div`,{className:`flex h-full overflow-hidden`,children:[(0,G.jsxs)(`div`,{className:`hidden h-full flex-col md:flex md:shrink-0`,style:{width:ce},children:[(0,G.jsx)(et,{connectionStatus:A,onNewSession:Le,onOpenSettings:Re,tailscaleIp:f?.tailscaleIp??null}),(0,G.jsx)(WD,{sessions:g,hibernatingSessions:xe,historySessions:Se,selectedSessionId:y,selectedHibernatingSessionId:b,onSelect:D,onSelectHibernating:O,onRename:He,onResume:Be,onHibernate:Ve,onKill:Ie,onDuplicate:Ue,onMoveToHistory:We,onNewSession:Le,loading:!k,error:j||u})]}),(0,G.jsx)(`div`,{className:`hidden md:block w-1 shrink-0 cursor-col-resize bg-transparent transition-colors hover:bg-white/10 active:bg-white/20`,onMouseDown:ye}),(0,G.jsx)($G,{session:be,sessions:ke,hibernatingSession:we,hibernatingSessions:xe,connectionStatus:A,connectionEpoch:me,sendMessage:he,subscribe:ge,onClose:()=>D(null),onSelectSession:D,onSelectHibernatingSession:O,onNewSession:Le,onKillSession:Ie,onRenameSession:He,onDuplicateSession:Ue,onOpenSettings:Re,onResumeSession:Be,onHibernateSession:Ve,onMoveToHistory:We,historySessions:Se,loading:!k,error:j||u}),(0,G.jsx)(vK,{isOpen:e,onClose:()=>t(!1),onCreate:ze,defaultProjectDir:V,commandPresets:ne,defaultPresetId:ie,lastProjectPath:W,activeProjectPath:be&&!be.remote?be.projectPath:void 0,remoteHosts:Ge,remoteAllowControl:R,initialHost:n,initialPath:i,initialCommand:o}),(0,G.jsx)(sJ,{isOpen:c,onClose:()=>l(!1)}),(0,G.jsx)(iX,{})]})}var GX=`modulepreload`,KX=function(e){return`/`+e},qX={},JX=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){let e=document.getElementsByTagName(`link`),i=document.querySelector(`meta[property=csp-nonce]`),a=i?.nonce||i?.getAttribute(`nonce`);function o(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}r=o(t.map(t=>{if(t=KX(t,n),t in qX)return;qX[t]=!0;let r=t.endsWith(`.css`),i=r?`[rel="stylesheet"]`:``;if(n)for(let n=e.length-1;n>=0;n--){let i=e[n];if(i.href===t&&(!r||i.rel===`stylesheet`))return}else if(document.querySelector(`link[href="${t}"]${i}`))return;let o=document.createElement(`link`);if(o.rel=r?`stylesheet`:GX,r||(o.as=`script`),o.crossOrigin=``,o.href=t,a&&o.setAttribute(`nonce`,a),document.head.appendChild(o),r)return new Promise((e,n)=>{o.addEventListener(`load`,e),o.addEventListener(`error`,()=>n(Error(`Unable to preload CSS for ${t}`)))})}))}function i(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return r.then(t=>{for(let e of t||[])e.status===`rejected`&&i(e.reason);return e().catch(i)})},YX=`true`,XX=`false`,ZX=YX===`true`,QX=XX===`true`;function $X(e={}){let{immediate:t=!1,onNeedRefresh:n,onOfflineReady:r,onRegistered:i,onRegisteredSW:a,onRegisterError:o}=e,s,c,l,u=async(e=!0)=>{await c,ZX||l?.()};async function d(){if(`serviceWorker`in navigator){if(s=await JX(async()=>{let{Workbox:e}=await import(`./workbox-window.prod.es5-Bq4GJJid.js`);return{Workbox:e}},[]).then(({Workbox:e})=>new e(`/sw.js`,{scope:`/`,type:`classic`})).catch(e=>{o?.(e)}),!s)return;if(l=()=>{s?.messageSkipWaiting()},!QX)if(ZX)s.addEventListener(`activated`,e=>{(e.isUpdate||e.isExternal)&&window.location.reload()}),s.addEventListener(`installed`,e=>{e.isUpdate||r?.()});else{let e=!1,t=()=>{e=!0,s?.addEventListener(`controlling`,e=>{e.isUpdate&&window.location.reload()}),n?.()};s.addEventListener(`installed`,n=>{n.isUpdate===void 0?n.isExternal===void 0?!e&&r?.():n.isExternal?t():!e&&r?.():n.isUpdate||r?.()}),s.addEventListener(`waiting`,t)}s.register({immediate:t}).then(e=>{a?a(`/sw.js`,e):i?.(e)}).catch(e=>{o?.(e)})}}return c=d(),u}Ge()&&document.documentElement.classList.add(`ios`),Ke()&&document.documentElement.classList.add(`ios-pwa`),$X({immediate:!0,onRegisteredSW(e,t){t&&(setInterval(()=>{t.update()},300*1e3),document.addEventListener(`visibilitychange`,()=>{document.visibilityState===`visible`&&t.update()}))}});var eZ=document.getElementById(`root`);if(!eZ)throw Error(`Root element not found`);(0,E.createRoot)(eZ).render((0,G.jsx)(x.StrictMode,{children:(0,G.jsx)(WX,{})}));
|
|
306
|
+
`,onClick:()=>{QG(),u(t.id)},title:dt?t.name:void 0,children:i},t.id)})})]}),(0,G.jsxs)(`div`,{className:`relative flex-1`,children:[(0,G.jsx)(`div`,{ref:De,className:`absolute inset-0`,style:{backgroundColor:C.background}}),Fe&&e&&(0,G.jsxs)(`div`,{role:`status`,"aria-live":`polite`,className:`absolute top-2 left-2 z-50 flex items-center gap-1.5 rounded-lg bg-black/60 px-2.5 py-1.5 text-xs text-white/90 shadow-lg backdrop-blur-md`,children:[(0,G.jsxs)(`svg`,{className:`h-3 w-3 animate-spin`,viewBox:`0 0 24 24`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,children:[(0,G.jsx)(`circle`,{className:`opacity-25`,cx:`12`,cy:`12`,r:`10`,stroke:`currentColor`,strokeWidth:`4`}),(0,G.jsx)(`path`,{className:`opacity-75`,fill:`currentColor`,d:`M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z`})]}),`Loading`]}),Le&&e&&(0,G.jsxs)(`div`,{className:`absolute ${M&&!P?`bottom-20`:`bottom-8`} left-1/2 z-30 flex max-w-[calc(100%-2rem)] -translate-x-1/2 items-center gap-2 rounded-lg border border-border bg-elevated/95 px-2 py-2 shadow-lg backdrop-blur-sm md:hidden`,children:[(0,G.jsx)(`span`,{className:`max-w-[12rem] truncate text-xs text-secondary md:max-w-[18rem]`,children:`Selection ready`}),(0,G.jsxs)(`button`,{type:`button`,onClick:ze,className:`flex h-8 shrink-0 items-center justify-center gap-1.5 rounded bg-accent px-2.5 text-xs font-medium text-white hover:bg-accent/90 active:scale-95 transition-all`,title:`Copy selection`,"aria-label":`Copy selection`,children:[(0,G.jsx)(ue,{width:14,height:14}),`Copy`]}),(0,G.jsx)(`button`,{type:`button`,onClick:Be,className:`flex h-8 w-8 shrink-0 items-center justify-center rounded border border-border text-secondary hover:bg-hover hover:text-primary active:scale-95 transition-all`,title:`Dismiss`,"aria-label":`Dismiss`,children:(0,G.jsx)(We,{width:14,height:14})})]}),!e&&(0,G.jsx)(`div`,{className:`absolute inset-0 flex items-center justify-center text-sm text-muted`,children:n?null:`Select a session to view terminal`}),e&&ye&&(0,G.jsx)(`div`,{className:`absolute inset-0 flex items-center justify-center text-center text-sm text-muted`,children:`Remote session (read-only). Use SSH to attach on the host.`}),n&&(0,G.jsx)(`div`,{className:`absolute inset-0 z-10 overflow-y-auto bg-base`,children:(0,G.jsxs)(`div`,{className:`mx-auto flex min-h-full w-full max-w-5xl flex-col gap-4 p-4 md:p-6`,children:[(0,G.jsx)(`div`,{className:`border-b border-border pb-4`,children:(0,G.jsxs)(`div`,{className:`flex flex-col gap-3 md:flex-row md:items-start md:justify-between`,children:[(0,G.jsxs)(`div`,{className:`min-w-0 space-y-2`,children:[(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-2 gap-y-1 text-sm`,children:[(0,G.jsx)(`h2`,{className:`min-w-0 truncate text-lg font-semibold text-primary`,children:xe}),(0,G.jsx)(`span`,{className:`rounded-full bg-blue-500/15 px-2 py-0.5 text-[10px] font-semibold uppercase tracking-wide text-blue-400`,children:`Hibernating`}),Se&&(0,G.jsx)(`span`,{className:`text-muted`,children:Se}),(0,G.jsxs)(`span`,{className:`text-muted`,children:[`Last active `,Ce]})]}),n.lastResumeError&&(0,G.jsxs)(`div`,{className:`inline-flex items-center gap-1 rounded bg-amber-500/15 px-2 py-1 text-xs text-amber-400`,title:`Last wake failed: ${n.lastResumeError}`,children:[(0,G.jsx)(ae,{width:12,height:12}),`Last wake failed`]}),n.lastUserMessage&&(0,G.jsx)(`p`,{className:`max-h-28 max-w-3xl overflow-y-auto whitespace-pre-wrap break-words pr-2 text-sm leading-6 text-secondary`,children:n.lastUserMessage})]}),(0,G.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2`,children:[(0,G.jsx)(`button`,{type:`button`,onClick:()=>g(n.sessionId),className:`btn btn-primary hidden md:inline-flex`,children:`Wake`}),v&&(0,G.jsx)(`button`,{type:`button`,onClick:()=>v(n.sessionId),className:`btn btn-secondary`,children:`Move to History`})]})]})}),(0,G.jsx)(zD,{session:n})]})}),je&&e&&!P?(0,G.jsxs)(`button`,{type:`button`,onClick:Ve,className:`absolute bottom-14 left-1/2 z-20 flex h-10 items-center justify-center overflow-hidden rounded-full border border-amber-400/35 bg-amber-500/20 text-amber-100 shadow-lg backdrop-blur-sm transition-all hover:bg-amber-500/30 active:scale-95 md:hidden`,style:{transform:`translateX(-50%)`},title:`Exit tmux copy mode and return to live output`,"aria-label":`Exit copy mode`,children:[(0,G.jsx)(`span`,{className:`px-3 text-[11px] font-semibold uppercase tracking-wide`,children:`Copy mode`}),(0,G.jsx)(`span`,{className:`self-stretch border-l border-amber-400/25`,"aria-hidden":`true`}),(0,G.jsx)(`span`,{className:`px-3 text-sm font-medium`,children:`Exit`})]}):M&&e&&!P?(0,G.jsxs)(`button`,{type:`button`,onClick:Ve,className:`absolute bottom-8 left-1/2 z-20 flex h-10 px-4 items-center justify-center gap-1.5 rounded-full bg-blue-600/90 text-white shadow-lg hover:bg-blue-600 active:scale-95 transition-all md:hidden`,style:{transform:`translateX(-50%)`},title:`Scroll to bottom`,"aria-label":`Scroll to bottom`,children:[(0,G.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:`18`,height:`18`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2.5`,strokeLinecap:`round`,strokeLinejoin:`round`,children:(0,G.jsx)(`path`,{d:`M12 5v14M5 12l7 7 7-7`})}),(0,G.jsx)(`span`,{className:`text-sm font-medium`,children:`Jump to bottom`})]}):null]}),(0,G.jsx)(PG,{...ct}),(0,G.jsx)(aG,{session:e,hibernatingSession:n,hibernatingDisplayName:xe,showHostBadge:Te,sessionCount:t.length,connectionStatus:a,isSwitching:Fe,canControl:be,canHibernate:we,modDisplay:k,onKill:()=>L(!0),onHibernate:qe,onWake:()=>n&&g(n.sessionId),onRename:t=>{let r=e?.id??n?.sessionId;r&&m(r,t)},onDuplicate:e&&h?()=>h(e.id):void 0,onMoveToHistory:n&&v?()=>v(n.sessionId):void 0,isTmuxCopyMode:je,showJumpToBottom:M&&!P,onJumpToBottom:Ve,selectionReady:!!Le,onCopySelection:ze,onDismissSelection:Be}),e&&(0,G.jsx)(JG,{onSendKey:it,onPasteText:at,onPasteImage:ot,disabled:a!==`connected`||ye||!Ie,sessions:t.map(e=>({id:e.id,name:e.name,status:e.status})),currentSessionId:e.id,agentType:e.agentType,fileUploadsAllowed:!pe,onSelectSession:u,hideSessionSwitcher:!0,onRefocus:st,isKeyboardVisible:ut,onEnterTextMode:lt}),(j||A)&&(0,G.jsx)(YG,{isOpen:V,onClose:()=>ee(!1),sessions:t,hibernatingSessions:r,historySessions:i,selectedSessionId:e?.id??null,selectedHibernatingSessionId:n?.sessionId??null,onSelect:u,onSelectHibernating:d,onRename:m,onResume:g,onHibernate:_,onMoveToHistory:v,onNewSession:f,loading:b,error:S}),I&&e&&(0,G.jsx)(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center bg-black/50`,children:(0,G.jsxs)(`div`,{className:`mx-4 w-full max-w-sm rounded-lg border border-border bg-elevated p-4 shadow-xl`,children:[(0,G.jsx)(`h3`,{className:`text-base font-medium text-primary mb-2 text-balance`,children:`Kill Session`}),(0,G.jsxs)(`p`,{className:`text-sm text-secondary mb-4 text-pretty`,children:[`Kill "`,e.agentSessionName||e.name,`"? The process will be terminated. Conversation history is preserved in logs.`]}),(0,G.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,G.jsx)(`button`,{onClick:()=>L(!1),className:`btn py-1.5 px-3 text-sm`,children:`Cancel`}),(0,G.jsx)(`button`,{ref:le,onClick:Ke,className:`btn btn-danger py-1.5 px-3 text-sm`,children:`Kill Session`})]})]})})]})}function eK({onSelect:e,onCancel:t,initialPath:n}){let[r,i]=(0,x.useState)(n||`~`),[a,o]=(0,x.useState)(null),[s,c]=(0,x.useState)(null),[l,u]=(0,x.useState)(!0),[d,f]=(0,x.useState)(-1),p=(0,x.useRef)(null),m=U(e=>e.recentPaths),h=(0,x.useCallback)(async e=>{p.current?.abort();let t=new AbortController;p.current=t;let{signal:n}=t;u(!0),c(null),o(null),f(-1),i(e);try{let r=await fetch(`/api/directories?path=${encodeURIComponent(e)}`,{signal:n});if(!r.ok){let e=await r.json();throw Error(e.message||`Failed to load directory`)}let a=await r.json();if(p.current!==t)return;o(a),i(a.path)}catch(e){if(p.current!==t)return;let n=e;n?.name!==`AbortError`&&c(n?.message||`Failed to load directory`)}finally{p.current===t&&u(!1)}},[]);(0,x.useEffect)(()=>(h(n||`~`),()=>{p.current?.abort()}),[h,n]);let g=a?.directories??[],_=a?.path||r,v=a?.parent;return(0,x.useEffect)(()=>{let n=n=>{if(n.key===`Escape`){n.preventDefault(),t();return}if(!l){if(n.key===`ArrowDown`){n.preventDefault(),f(e=>g.length===0?-1:e<0?0:Math.min(e+1,g.length-1));return}if(n.key===`ArrowUp`){n.preventDefault(),f(e=>g.length===0?-1:e<0?g.length-1:Math.max(e-1,0));return}if(n.key===`Enter`){n.preventDefault();let t=g[d];t?h(t.path):_&&e(_);return}n.key===`Backspace`&&v&&(n.preventDefault(),h(v))}};return window.addEventListener(`keydown`,n),()=>window.removeEventListener(`keydown`,n)},[g,_,h,d,l,t,e,v]),(0,G.jsx)(`div`,{role:`dialog`,"aria-modal":`true`,"aria-label":`Directory browser`,className:`fixed inset-0 z-[60] flex items-center justify-center bg-black/60 p-4`,onClick:e=>{e.target===e.currentTarget&&t()},"data-testid":`directory-browser`,children:(0,G.jsxs)(`div`,{className:`w-full max-w-lg border border-border bg-elevated p-4`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-3 border-b border-border pb-2`,children:[(0,G.jsx)(`button`,{type:`button`,className:`btn`,onClick:()=>{v&&h(v)},disabled:!v||l,children:`Up`}),(0,G.jsx)(`div`,{className:`min-w-0 flex-1 truncate text-xs font-mono text-secondary`,title:_,"data-testid":`directory-current-path`,children:_})]}),(0,G.jsx)(`div`,{className:`mt-3 max-h-60 overflow-y-auto border border-border bg-surface`,children:l?(0,G.jsx)(`div`,{className:`px-3 py-4 text-xs text-muted`,"data-testid":`directory-loading`,children:`Loading directories...`}):s?(0,G.jsxs)(`div`,{className:`px-3 py-4 text-xs`,"data-testid":`directory-error`,children:[(0,G.jsx)(`p`,{className:`text-danger`,children:s}),(0,G.jsx)(`button`,{type:`button`,className:`btn mt-3`,onClick:()=>h(r),children:`Retry`})]}):g.length===0?(0,G.jsx)(`div`,{className:`px-3 py-4 text-xs text-muted`,"data-testid":`directory-empty`,children:`No subdirectories`}):(0,G.jsx)(`div`,{className:`py-1`,children:g.map((e,t)=>(0,G.jsxs)(`button`,{type:`button`,onClick:()=>h(e.path),onMouseEnter:()=>f(t),className:`flex w-full items-center gap-2 px-3 py-2 text-left text-xs ${t===d?`bg-hover text-primary`:`text-secondary`}`,"data-testid":`directory-entry`,"data-entry-name":e.name,"data-entry-path":e.path,children:[(0,G.jsx)(be,{width:14,height:14,className:`shrink-0 text-muted`,"aria-hidden":`true`}),(0,G.jsx)(`span`,{className:`truncate`,children:e.name})]},e.path))})}),a?.truncated?(0,G.jsx)(`p`,{className:`mt-2 text-[10px] text-muted`,children:`Showing first 200 directories.`}):null,(0,G.jsxs)(`div`,{className:`mt-4 border-t border-border pt-3`,children:[(0,G.jsx)(`div`,{className:`text-[10px] uppercase tracking-wider text-secondary`,children:`Recent`}),m.length===0?(0,G.jsx)(`p`,{className:`mt-2 text-xs text-muted`,children:`No recent paths yet.`}):(0,G.jsx)(`div`,{className:`mt-2 space-y-1`,children:m.map(e=>(0,G.jsx)(`button`,{type:`button`,className:`block w-full truncate text-left text-xs text-secondary hover:text-primary`,onClick:()=>h(e),title:e,"data-testid":`directory-recent`,"data-recent-path":e,children:e},e))})]}),(0,G.jsxs)(`div`,{className:`mt-4 flex justify-end gap-2`,children:[(0,G.jsx)(`button`,{type:`button`,onClick:t,className:`btn`,children:`Cancel`}),(0,G.jsx)(`button`,{type:`button`,onClick:()=>{_&&e(_)},className:`btn btn-primary`,disabled:l||!_,children:`Select`})]})]})})}function tK(e){let t=e.trim();if(t.length>=2){let e=t[0],n=t[t.length-1];if(e===`'`&&n===`'`)return t.slice(1,-1).replace(/'\\''/g,`'`);if(e===`"`&&n===`"`)return t.slice(1,-1).replace(/\\"/g,`"`).replace(/\\\\/g,`\\`)}return t}function nK(e){let t=e.trim(),n=t.search(/\s/);if(n===-1||t.slice(0,n).split(`/`).pop()!==`bash`)return null;let r=n;for(;r<t.length&&/\s/.test(t[r]);)r++;let i=!1,a=!1;for(;r<t.length;){let e=r;for(;r<t.length&&!/\s/.test(t[r]);)r++;let n=t.slice(e,r);for(;r<t.length&&/\s/.test(t[r]);)r++;if(!n.startsWith(`-`)||n===`-`)return null;if(n===`--`)break;if(n.startsWith(`--`)||!/^-[a-zA-Z]+$/.test(n))continue;let o=n.slice(1);if(o.includes(`l`)&&(i=!0),o.includes(`c`)){a=!0;break}}if(!i||!a)return null;let o=t.slice(r).trim();return o?tK(o):null}function rK(e){return e?e===`claude-rp`?`claude`:e:null}function iK(e){let t=e.trim();if(!t)return``;let n=tK(t);return nK(n)??n}function aK(e){if(e===`claude`)return`claude`;if(e===`codex`)return`codex`;if(e===`pi`)return`pi`;if(e===`devin`||e===`devin-cli`)return`devin`;if(e===`grok`||e.startsWith(`grok-`))return`grok`;if(e===`omp`)return`omp`}function oK(e){let t=/\S+/g,n;for(;n=t.exec(e);){let e=n[0].toLowerCase().replace(/^["']+|["']+$/g,``);if([`npx`,`bunx`,`pnpm`,`yarn`,`env`].includes(e)||e.includes(`=`)||e.startsWith(`-`))continue;let t=e.includes(`@oh-my-pi/`)?`omp`:aK(e.split(`/`).pop()||e);return t?{agentType:t,end:n.index+n[0].length}:void 0}}function sK(e){let t=iK(e);if(t)return oK(t.toLowerCase().trim().replace(/^["']|["']$/g,``))?.agentType}var cK={claude:`--dangerously-skip-permissions`,codex:`--yolo`,grok:`--always-approve`,devin:`--permission-mode dangerous`,pi:null,omp:`--auto-approve`},lK={claude:[`--dangerously-skip-permissions`,`--permission-mode bypassPermissions`,`--permission-mode=bypassPermissions`],codex:[`--yolo`,`--dangerously-bypass-approvals-and-sandbox`],grok:[`--always-approve`,`--yolo`,`--dangerously-skip-permissions`,`--permission-mode bypassPermissions`,`--permission-mode=bypassPermissions`],devin:[`--permission-mode dangerous`,`--permission-mode=dangerous`],pi:[],omp:[`--auto-approve`,`--approval-mode yolo`,`--approval-mode=yolo`]};function uK(e){let t=rK(e);return t?cK[t]:null}function dK(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function fK(e){return RegExp(`(^|\\s)${dK(e)}(?=\\s|$)`,`g`)}function pK(e,t){return(t?[rK(t)].filter(e=>e!==null):Object.keys(lK)).some(t=>lK[t].some(t=>fK(t).test(e)))}function mK(e,t){let n=oK(e);return n?`${e.slice(0,n.end)} ${t}${e.slice(n.end)}`:null}function hK(e,t){let n=uK(t);if(!n)return e;let r=e.trim();if(!r||pK(r,t))return r;let i=mK(r,n);if(i)return i;let a=iK(r);if(a&&a!==r){let e=mK(a,n);if(e)return`bash -lc '${e.replace(/'/g,`'\\''`)}'`}return`${r} ${n}`}function gK(e,t){let n=rK(t);if(!n||pK(e,t))return null;if(n===`codex`){let t=/(^|\s)(--full-auto|--ask-for-approval|-a)(?=\s|=|$)/.exec(e);if(t)return`conflicts with ${t[2]}`}if(n===`omp`){let t=/(^|\s)--approval-mode(?:\s+|=)(always-ask|write)/.exec(e);if(t)return`conflicts with --approval-mode ${t[2]}`}let r=/(^|\s)--permission-mode(?:\s+|=)(\S+)/.exec(e);return r&&n!==`codex`?`conflicts with --permission-mode ${r[2]}`:null}function _K(e,t){let n=rK(t);if(!n)return e;let r=e;for(let e of lK[n])r=r.replace(fK(e),` `);return r.replace(/\s+/g,` `).trim()}function vK({isOpen:e,onClose:t,onCreate:n,defaultProjectDir:r,commandPresets:i,defaultPresetId:a,lastProjectPath:o,activeProjectPath:s,remoteHosts:c=[],remoteAllowControl:l=!1,initialHost:u,initialPath:d,initialCommand:f}){let[p,m]=(0,x.useState)(``),[h,g]=(0,x.useState)(``),[_,v]=(0,x.useState)(null),[y,b]=(0,x.useState)(``),[S,C]=(0,x.useState)(!1),[w,T]=(0,x.useState)(``),E=U(e=>e.yoloMode),D=U(e=>e.setYoloMode),O=(0,x.useRef)(null),k=(0,x.useRef)(null),A=(0,x.useRef)(null),j=(0,x.useRef)(!1),M=l&&c.length>0,N=e=>{if(!E)return e;let t=sK(e);return t&&!gK(e,t)?hK(e,t):e},P=e=>{let t=i.find(t=>t.id===e);t&&(v(e),b(N(ee(t))))},F=()=>{v(null),b(``)};if((0,x.useEffect)(()=>{let t=j.current;if(j.current=e,!e){m(``),g(``),v(null),b(``),C(!1),T(u??``),t&&setTimeout(()=>{if(typeof document>`u`||typeof document.querySelector!=`function`)return;let e=document.querySelector(`.xterm-helper-textarea`);e&&(e.removeAttribute(`disabled`),e.focus())},300);return}if(typeof document<`u`&&typeof document.querySelector==`function`){let e=document.querySelector(`.xterm-helper-textarea`);e&&typeof e.setAttribute==`function`&&(typeof e.blur==`function`&&e.blur(),e.setAttribute(`disabled`,`true`))}m(d?.trim()||s?.trim()||o||r||``),g(``),T(u??``);let n=f?.trim();if(n){let e=i.find(e=>ee(e)===n);e?(v(e.id),b(ee(e))):(v(null),b(n))}else{let e=i.find(e=>e.id===a);e?(v(a),b(N(ee(e)))):i.length>0?(v(i[0].id),b(N(ee(i[0])))):(v(null),b(``))}setTimeout(()=>{if(A.current?.focus(),k.current){let e=k.current;e.scrollLeft=e.scrollWidth}},50)},[s,i,a,r,e,o,u,d,f]),(0,x.useEffect)(()=>{if(!e||typeof window>`u`||typeof window.addEventListener!=`function`)return;let n=()=>O.current?Array.from(O.current.querySelectorAll(`input:not([disabled]), select:not([disabled]), button:not([disabled]):not([tabindex="-1"]), [tabindex="0"]`)):[],r=e=>{if(!S){if(e.key===`Escape`){typeof e.stopPropagation==`function`&&e.stopPropagation(),t();return}if(e.key===`Enter`){let t=document.activeElement;if(!t||t.tagName===`INPUT`||t.closest(`[data-testid="host-select"]`)||!t.closest(`[data-testid="command-select"]`))return;e.preventDefault(),typeof e.stopPropagation==`function`&&e.stopPropagation(),O.current?.requestSubmit();return}if(/^[0-9]$/.test(e.key)&&!e.metaKey&&!e.ctrlKey&&!e.altKey){let t=document.activeElement;if(t&&(t.tagName===`INPUT`||t.tagName===`TEXTAREA`||t.tagName===`SELECT`||t.isContentEditable))return;let n;if(e.key===`0`)n=i.length;else if(n=Number(e.key)-1,n>=i.length)return;e.preventDefault(),typeof e.stopPropagation==`function`&&e.stopPropagation(),n===i.length?F():P(i[n].id),(O.current?.querySelectorAll?.(`[data-testid="command-select"] [role="radio"]`))?.[n]?.focus();return}if(e.key===`Tab`){e.preventDefault(),typeof e.stopPropagation==`function`&&e.stopPropagation();let t=n();if(t.length===0)return;let r=document.activeElement,i=t.indexOf(r),a;a=i===-1?e.shiftKey?t.length-1:0:e.shiftKey?i<=0?t.length-1:i-1:i>=t.length-1?0:i+1,t[a]?.focus()}}};return window.addEventListener(`keydown`,r),()=>window.removeEventListener(`keydown`,r)},[e,t,S,i,E]),!e)return null;let I=_===null,L=w!==``,R=sK(y),z=uK(R)!==null,B=R?pK(y,R):!1,V=R&&!B?gK(y,R):null,H=!z||V!==null,te=R?R===`pi`?`Pi has no permission prompts — nothing to enable`:V??`Append ${uK(R)}`:`Enter a supported agent command (claude, codex, grok, devin)`,ne=e=>{D(e),R&&b(e?hK(y,R):_K(y,R))},re=e=>{e.preventDefault();let r=p.trim();if(!r)return;let i=y.trim();n(r,h.trim()||void 0,i||void 0,L?w:void 0),t()},ie=[...i.map(e=>({id:e.id,label:e.label,isCustom:!1,agentType:e.agentType,command:e.command})),{id:`custom`,label:`Custom`,isCustom:!0,agentType:void 0,command:void 0}],ae=[{id:``,label:`Local`,ok:!0,error:void 0},...c.map(e=>({id:e.host,label:e.host,ok:e.ok,error:e.error}))],W=p.trim()||`~`;return(0,G.jsxs)(`div`,{role:`dialog`,"aria-modal":`true`,"aria-labelledby":`new-session-title`,className:`fixed inset-0 z-50 flex items-center justify-center bg-black/60 p-4`,onClick:e=>{e.target===e.currentTarget&&t()},children:[(0,G.jsxs)(`form`,{ref:O,onSubmit:re,className:`w-full max-w-md border border-border bg-elevated p-6`,children:[(0,G.jsx)(`h2`,{id:`new-session-title`,className:`text-sm font-semibold uppercase tracking-wider text-primary text-balance`,children:`New Session`}),(0,G.jsxs)(`div`,{className:`mt-4 space-y-4`,children:[M&&(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`label`,{className:`mb-1.5 block text-xs text-secondary`,children:`Host`}),(0,G.jsx)(`div`,{className:`flex flex-wrap gap-2`,role:`radiogroup`,"aria-label":`Host`,"data-testid":`host-select`,children:ae.map((e,t)=>{let n=w===e.id,r=!e.ok&&!n;return(0,G.jsx)(`button`,{type:`button`,role:`radio`,"aria-checked":n,"aria-label":e.label,title:e.ok?void 0:e.error||`Unreachable`,tabIndex:n?0:-1,onClick:()=>T(e.id),onKeyDown:e=>{let n=t;if(e.key===`ArrowRight`||e.key===`ArrowDown`)e.preventDefault(),n=(t+1)%ae.length;else if(e.key===`ArrowLeft`||e.key===`ArrowUp`)e.preventDefault(),n=(t-1+ae.length)%ae.length;else return;let r=ae[n];T(r.id),(e.currentTarget.parentElement?.querySelectorAll(`[role="radio"]`))?.[n]?.focus()},className:`btn text-xs focus:outline-none focus:ring-2 focus:ring-primary ${n?`btn-primary`:``} ${r?`opacity-60`:``}`,children:e.label},e.id||`local`)})})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`label`,{className:`mb-1.5 block text-xs text-secondary`,children:`Command`}),(0,G.jsx)(`div`,{className:`flex flex-wrap gap-2`,role:`radiogroup`,"aria-label":`Command preset`,"data-testid":`command-select`,children:ie.map((e,t)=>{let n=e.isCustom?I:_===e.id,r=e.isCustom?`0`:t<9?String(t+1):null;return(0,G.jsxs)(`button`,{ref:n?A:void 0,type:`button`,role:`radio`,"aria-checked":n,"aria-keyshortcuts":r??void 0,tabIndex:n?0:-1,onClick:()=>{e.isCustom?F():P(e.id)},onKeyDown:e=>{let n=t;if(e.key===`ArrowRight`||e.key===`ArrowDown`)e.preventDefault(),n=(t+1)%ie.length;else if(e.key===`ArrowLeft`||e.key===`ArrowUp`)e.preventDefault(),n=(t-1+ie.length)%ie.length;else return;let r=ie[n];r.isCustom?F():P(r.id),(e.currentTarget.parentElement?.querySelectorAll(`[role="radio"]`))?.[n]?.focus()},className:`btn text-xs focus:outline-none focus:ring-2 focus:ring-primary ${n?`btn-primary`:``}`,children:[r&&(0,G.jsx)(`kbd`,{"aria-hidden":`true`,className:`shortcut-badge`,children:r}),(0,G.jsx)(oh,{agentType:e.agentType,command:e.command,className:`inline-block h-3.5 w-3.5 shrink-0`}),e.label]},e.id)})}),(0,G.jsx)(`input`,{value:y,onChange:e=>b(e.target.value),placeholder:`Enter command...`,className:`input mt-2 font-mono text-xs`}),(0,G.jsxs)(`label`,{className:`mt-2 flex items-center gap-2 text-xs ${H?`text-muted opacity-60`:`text-secondary`}`,title:te,children:[(0,G.jsx)(`input`,{type:`checkbox`,checked:B,disabled:H,onChange:e=>ne(e.target.checked)}),`yolo mode — skip permission prompts`]})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`label`,{className:`mb-1.5 block text-xs text-secondary`,children:`Project Path`}),(0,G.jsxs)(`div`,{className:`flex gap-2`,children:[(0,G.jsx)(`input`,{ref:k,value:p,onChange:e=>m(e.target.value),placeholder:L?`/home/user/project`:s||o||r||`/Users/you/code/my-project`,className:`input flex-1 text-sm`}),!L&&(0,G.jsx)(`button`,{type:`button`,className:`btn`,onClick:()=>C(!0),children:`Browse`})]})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`label`,{className:`mb-1.5 block text-xs text-secondary`,children:`Display Name`}),(0,G.jsx)(`input`,{value:h,onChange:e=>g(e.target.value),placeholder:`auto-generated`,className:`input text-sm placeholder:italic`})]})]}),(0,G.jsxs)(`div`,{className:`mt-6 flex justify-end gap-2`,children:[(0,G.jsx)(`button`,{type:`button`,onClick:t,className:`btn`,children:`Cancel`}),(0,G.jsx)(`button`,{type:`submit`,className:`btn btn-primary`,children:`Create`})]})]}),S&&!L&&(0,G.jsx)(eK,{initialPath:W,onSelect:e=>{m(e),C(!1)},onCancel:()=>C(!1)})]})}function yK({controlled:e,default:t,name:n,state:r=`value`}){let{current:i}=x.useRef(e!==void 0),[a,o]=x.useState(t);return[i?e:a,x.useCallback(e=>{i||o(e)},[])]}var bK={};function xK(e,t){let n=x.useRef(bK);return n.current===bK&&(n.current=e(t)),n}var SK=x[`useInsertionEffect${Math.random().toFixed(1)}`.slice(0,-3)],CK=SK&&SK!==x.useLayoutEffect?SK:e=>e();function wK(e){let t=xK(TK).current;return t.next=e,CK(t.effect),t.trampoline}function TK(){let e={next:void 0,callback:EK,trampoline:(...t)=>e.callback?.(...t),effect:()=>{e.callback=e.next}};return e}function EK(){}function DK(e,t,n,r){let i=xK(kK).current;return AK(i,e,t,n,r)&&MK(i,[e,t,n,r]),i.callback}function OK(e){let t=xK(kK).current;return jK(t,e)&&MK(t,e),t.callback}function kK(){return{callback:null,cleanup:null,refs:[]}}function AK(e,t,n,r,i){return e.refs[0]!==t||e.refs[1]!==n||e.refs[2]!==r||e.refs[3]!==i}function jK(e,t){return e.refs.length!==t.length||e.refs.some((e,n)=>e!==t[n])}function MK(e,t){if(e.refs=t,t.every(e=>e==null)){e.callback=null;return}e.callback=n=>{if(e.cleanup&&=(e.cleanup(),null),n!=null){let r=Array(t.length).fill(null);for(let e=0;e<t.length;e+=1){let i=t[e];if(i!=null)switch(typeof i){case`function`:{let t=i(n);typeof t==`function`&&(r[e]=t);break}case`object`:i.current=n;break;default:}}e.cleanup=()=>{for(let e=0;e<t.length;e+=1){let n=t[e];if(n!=null)switch(typeof n){case`function`:{let t=r[e];typeof t==`function`?t():n(null);break}case`object`:n.current=null;break;default:}}}}}}var NK=typeof document<`u`?x.useLayoutEffect:()=>{},PK={clipPath:`inset(50%)`,overflow:`hidden`,whiteSpace:`nowrap`,border:0,padding:0,width:1,height:1,margin:-1},FK={...PK,position:`fixed`,top:0,left:0},IK={...PK,position:`absolute`};function LK(){}Object.freeze([]);var RK=Object.freeze({});function zK(e,...t){let n=new URL(`https://base-ui.com/production-error`);return n.searchParams.set(`code`,e.toString()),t.forEach(e=>n.searchParams.append(`args[]`,e)),`Base UI error #${e}; visit ${n} for the full message.`}var BK=18;function VK(e){return BK>=e}function HK(e){if(!x.isValidElement(e))return null;let t=e,n=t.props;return(VK(19)?n?.ref:t.ref)??null}function UK(e,t){if(e&&!t)return e;if(!e&&t)return t;if(e||t)return{...e,...t}}function WK(e,t){let n={};for(let r in e){let i=e[r];if(t?.hasOwnProperty(r)){let e=t[r](i);e!=null&&Object.assign(n,e);continue}i===!0?n[`data-${r.toLowerCase()}`]=``:i&&(n[`data-${r.toLowerCase()}`]=i.toString())}return n}function GK(e,t){return typeof e==`function`?e(t):e}function KK(e,t){return typeof e==`function`?e(t):e}var qK={};function JK(e,t,n,r,i){let a={...eq(e,qK)};return t&&(a=XK(a,t)),n&&(a=XK(a,n)),r&&(a=XK(a,r)),i&&(a=XK(a,i)),a}function YK(e){if(e.length===0)return qK;if(e.length===1)return eq(e[0],qK);let t={...eq(e[0],qK)};for(let n=1;n<e.length;n+=1)t=XK(t,e[n]);return t}function XK(e,t){return $K(t)?t(e):ZK(e,t)}function ZK(e,t){if(!t)return e;for(let n in t){let r=t[n];switch(n){case`style`:e[n]=UK(e.style,r);break;case`className`:e[n]=rq(e.className,r);break;default:QK(n,r)?e[n]=tq(e[n],r):e[n]=r}}return e}function QK(e,t){let n=e.charCodeAt(0),r=e.charCodeAt(1),i=e.charCodeAt(2);return n===111&&r===110&&i>=65&&i<=90&&(typeof t==`function`||t===void 0)}function $K(e){return typeof e==`function`}function eq(e,t){return $K(e)?e(t):e??qK}function tq(e,t){return t?e?n=>{if(iq(n)){let r=n;nq(r);let i=t(r);return r.baseUIHandlerPrevented||e?.(r),i}let r=t(n);return e?.(n),r}:t:e}function nq(e){return e.preventBaseUIHandler=()=>{e.baseUIHandlerPrevented=!0},e}function rq(e,t){return t?e?t+` `+e:t:e}function iq(e){return typeof e==`object`&&!!e&&`nativeEvent`in e}function aq(e,t,n={}){let r=t.render,i=oq(t,n);return n.enabled===!1?null:cq(e,r,i,n.state??RK)}function oq(e,t={}){let{className:n,style:r,render:i}=e,{state:a=RK,ref:o,props:s,stateAttributesMapping:c,enabled:l=!0}=t,u=l?GK(n,a):void 0,d=l?KK(r,a):void 0,f=l?WK(a,c):RK,p=l?UK(f,Array.isArray(s)?YK(s):s)??RK:RK;return typeof document<`u`&&(l?Array.isArray(o)?p.ref=OK([p.ref,HK(i),...o]):p.ref=DK(p.ref,HK(i),o):DK(null,null)),l?(u!==void 0&&(p.className=rq(p.className,u)),d!==void 0&&(p.style=UK(p.style,d)),p):RK}var sq=Symbol.for(`react.lazy`);function cq(e,t,n,r){if(t){if(typeof t==`function`)return t(n,r);let e=JK(n,t.props);e.ref=n.ref;let i=t;return i?.$$typeof===sq&&(i=x.Children.toArray(t)[0]),x.cloneElement(i,e)}if(e&&typeof e==`string`)return lq(e,n);throw Error(zK(8))}function lq(e,t){return e===`button`?(0,x.createElement)(`button`,{type:`button`,...t,key:t.key}):e===`img`?(0,x.createElement)(`img`,{alt:``,...t,key:t.key}):x.createElement(e,t)}var uq={...x},dq=0;function fq(e,t=`mui`){let[n,r]=x.useState(e),i=e||n;return x.useEffect(()=>{n??(dq+=1,r(`${t}-${dq}`))},[n,t]),i}var pq=uq.useId;function mq(e,t){if(pq!==void 0){let n=pq();return e??(t?`${t}-${n}`:n)}return fq(e,t)}function hq(e){return mq(e,`base-ui`)}function gq(){return typeof window<`u`}function _q(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function vq(e){return gq()?e instanceof Element||e instanceof _q(e).Element:!1}function yq(e){return gq()?e instanceof HTMLElement||e instanceof _q(e).HTMLElement:!1}function bq(e){return!gq()||typeof ShadowRoot>`u`?!1:e instanceof ShadowRoot||e instanceof _q(e).ShadowRoot}var xq=x.createContext(void 0);function Sq(e=!1){let t=x.useContext(xq);if(t===void 0&&!e)throw Error(zK(16));return t}function Cq(e){let{focusableWhenDisabled:t,disabled:n,composite:r=!1,tabIndex:i=0,isNativeButton:a}=e,o=r&&t!==!1,s=r&&t===!1;return{props:x.useMemo(()=>{let e={onKeyDown(e){n&&t&&e.key!==`Tab`&&e.preventDefault()}};return r||(e.tabIndex=i,!a&&n&&(e.tabIndex=t?i:-1)),(a&&(t||o)||!a&&n)&&(e[`aria-disabled`]=n),a&&(!t||s)&&(e.disabled=n),e},[r,n,t,o,s,a,i])}}function wq(e={}){let{disabled:t=!1,focusableWhenDisabled:n,tabIndex:r=0,native:i=!0}=e,a=x.useRef(null),o=Sq(!0)!==void 0,s=wK(()=>{let e=a.current;return!!(e?.tagName===`A`&&e?.href)}),{props:c}=Cq({focusableWhenDisabled:n,disabled:t,composite:o,tabIndex:r,isNativeButton:i}),l=x.useCallback(()=>{let e=a.current;Tq(e)&&o&&t&&c.disabled===void 0&&e.disabled&&(e.disabled=!1)},[t,c.disabled,o]);return NK(l,[l]),{getButtonProps:x.useCallback((e={})=>{let{onClick:n,onMouseDown:r,onKeyUp:a,onKeyDown:o,onPointerDown:l,...u}=e;return JK({type:i?`button`:void 0,onClick(e){if(t){e.preventDefault();return}n?.(e)},onMouseDown(e){t||r?.(e)},onKeyDown(e){if(t||(nq(e),o?.(e)),e.baseUIHandlerPrevented)return;let r=e.target===e.currentTarget&&!i&&!s()&&!t,a=e.key===`Enter`,c=e.key===` `;r&&((c||a)&&e.preventDefault(),a&&n?.(e))},onKeyUp(e){t||(nq(e),a?.(e)),!e.baseUIHandlerPrevented&&e.target===e.currentTarget&&!i&&!t&&e.key===` `&&n?.(e)},onPointerDown(e){if(t){e.preventDefault();return}l?.(e)}},i?void 0:{role:`button`},c,u)},[t,c,i,s]),buttonRef:wK(e=>{a.current=e,l()})}}function Tq(e){return yq(e)&&e.tagName===`BUTTON`}var Eq=x.createContext(void 0);function Dq(){let e=x.useContext(Eq);if(e===void 0)throw Error(zK(63));return e}var Oq=function(e){return e.disabled=`data-disabled`,e.valid=`data-valid`,e.invalid=`data-invalid`,e.touched=`data-touched`,e.dirty=`data-dirty`,e.filled=`data-filled`,e.focused=`data-focused`,e}({}),kq={badInput:!1,customError:!1,patternMismatch:!1,rangeOverflow:!1,rangeUnderflow:!1,stepMismatch:!1,tooLong:!1,tooShort:!1,typeMismatch:!1,valid:null,valueMissing:!1},Aq={valid(e){return e===null?null:e?{[Oq.valid]:``}:{[Oq.invalid]:``}}},jq=function(e){return e.checked=`data-checked`,e.unchecked=`data-unchecked`,e.disabled=`data-disabled`,e.readonly=`data-readonly`,e.required=`data-required`,e.valid=`data-valid`,e.invalid=`data-invalid`,e.touched=`data-touched`,e.dirty=`data-dirty`,e.filled=`data-filled`,e.focused=`data-focused`,e}({}),Mq={...Aq,checked(e){return e?{[jq.checked]:``}:{[jq.unchecked]:``}}};function Nq(e,t){return{...e,state:{...e.state,valid:!t&&e.state.valid}}}var Pq=x.createContext({formRef:{current:{fields:new Map}},errors:{},clearErrors:LK,validationMode:`onSubmit`,submitAttemptedRef:{current:!1}});function Fq(){return x.useContext(Pq)}var Iq=x.createContext({invalid:void 0,name:void 0,validityData:{state:kq,errors:[],error:``,value:``,initialValue:null},setValidityData:LK,disabled:void 0,touched:!1,setTouched:LK,dirty:!1,setDirty:LK,filled:!1,setFilled:LK,focused:!1,setFocused:LK,validate:()=>null,validationMode:`onSubmit`,validationDebounceTime:0,shouldValidateOnChange:()=>!1,state:{disabled:!1,valid:null,touched:!1,dirty:!1,filled:!1,focused:!1},markedDirtyRef:{current:!1},validation:{getValidationProps:(e=RK)=>e,getInputValidationProps:(e=RK)=>e,inputRef:{current:null},commit:async()=>{}}});function Lq(e=!0){let t=x.useContext(Iq);if(t.setValidityData===LK&&!e)throw Error(zK(28));return t}function Rq(e){let{enabled:t=!0,value:n,id:r,name:i,controlRef:a,commit:o}=e,{formRef:s}=Fq(),{invalid:c,markedDirtyRef:l,validityData:u,setValidityData:d}=Lq(),f=wK(e.getValue);NK(()=>{if(!t)return;let e=n;e===void 0&&(e=f()),u.initialValue===null&&e!==null&&d(t=>({...t,initialValue:e}))},[t,d,n,u.initialValue,f]),NK(()=>{!t||!r||s.current.fields.set(r,{getValue:f,name:i,controlRef:a,validityData:Nq(u,c),validate(e=!0){let t=n;t===void 0&&(t=f()),l.current=!0,e?re.flushSync(()=>o(t)):o(t)}})},[o,a,t,s,f,r,c,l,i,u,n]),NK(()=>{let e=s.current.fields;return()=>{r&&e.delete(r)}},[s,r])}var zq=x.createContext({controlId:void 0,registerControlId:LK,labelId:void 0,setLabelId:LK,messageIds:[],setMessageIds:LK,getDescriptionProps:e=>e});function Bq(){return x.useContext(zq)}function Vq(e={}){let{id:t,implicit:n=!1,controlRef:r}=e,{controlId:i,registerControlId:a}=Bq(),o=hq(t),s=n?i:void 0,c=xK(()=>Symbol(`labelable-control`)),l=x.useRef(!1),u=x.useRef(t!=null),d=wK(()=>{!l.current||a===LK||(l.current=!1,a(c.current,void 0))});return NK(()=>{if(a===LK)return;let e;if(n){let n=r?.current;e=vq(n)&&n.closest(`label`)!=null?t??null:s??o}else if(t!=null)u.current=!0,e=t;else if(u.current)e=o;else{d();return}if(e===void 0){d();return}l.current=!0,a(c.current,e)},[t,r,s,a,n,o,c,d]),x.useEffect(()=>d,[d]),i??o}var Hq=`none`;function Uq(e,t,n,r){let i=!1,a=!1,o=r??RK;return{reason:e,event:t??new Event(`base-ui`),cancel(){i=!0},allowPropagation(){a=!0},get isCanceled(){return i},get isPropagationAllowed(){return a},trigger:n,...o}}function Wq(e,t){let n=x.useRef(e),r=wK(t);NK(()=>{n.current!==e&&r(n.current)},[e,r]),NK(()=>{n.current=e},[e])}var Gq=x.forwardRef(function(e,t){let{checked:n,className:r,defaultChecked:i,id:a,inputRef:o,name:s,nativeButton:c=!1,onCheckedChange:l,readOnly:u=!1,required:d=!1,disabled:f=!1,render:p,uncheckedValue:m,value:h,...g}=e,{clearErrors:_}=Fq(),{state:v,setTouched:y,setDirty:b,validityData:S,setFilled:C,setFocused:w,shouldValidateOnChange:T,validationMode:E,disabled:D,name:O,validation:k}=Lq(),{labelId:A}=Bq(),j=D||f,M=O??s,N=wK(l),P=x.useRef(null),F=DK(P,o,k.inputRef),I=x.useRef(null),L=hq(),R=Vq({id:a,implicit:!1,controlRef:I}),z=c?void 0:R,[B,V]=yK({controlled:n,default:!!i,name:`Switch`,state:`checked`});Rq({id:L,commit:k.commit,value:B,controlRef:I,name:M,getValue:()=>B}),NK(()=>{P.current&&C(P.current.checked)},[P,C]),Wq(B,()=>{_(M),b(B!==S.initialValue),C(B),T()?k.commit(B):k.commit(B,!0)});let{getButtonProps:ee,buttonRef:H}=wq({disabled:j,native:c}),te={id:c?R:L,role:`switch`,"aria-checked":B,"aria-readonly":u||void 0,"aria-required":d||void 0,"aria-labelledby":A,onFocus(){j||w(!0)},onBlur(){let e=P.current;!e||j||(y(!0),w(!1),E===`onBlur`&&k.commit(e.checked))},onClick(e){u||j||(e.preventDefault(),P.current?.dispatchEvent(new PointerEvent(`click`,{bubbles:!0,shiftKey:e.shiftKey,ctrlKey:e.ctrlKey,altKey:e.altKey,metaKey:e.metaKey})))}},U=x.useMemo(()=>JK({checked:B,disabled:j,id:z,name:M,required:d,style:M?IK:FK,tabIndex:-1,type:`checkbox`,"aria-hidden":!0,ref:F,onChange(e){if(e.nativeEvent.defaultPrevented)return;let t=e.target.checked,n=Uq(Hq,e.nativeEvent);N?.(t,n),!n.isCanceled&&V(t)},onFocus(){I.current?.focus()}},k.getInputValidationProps,h===void 0?RK:{value:h}),[B,j,F,z,M,N,d,V,k,h]),ne=x.useMemo(()=>({...v,checked:B,disabled:j,readOnly:u,required:d}),[v,B,j,u,d]),re=aq(`span`,e,{state:ne,ref:[t,I,H],props:[te,k.getValidationProps,g,ee],stateAttributesMapping:Mq});return(0,G.jsxs)(Eq.Provider,{value:ne,children:[re,!B&&M&&m!==void 0&&(0,G.jsx)(`input`,{type:`hidden`,name:M,value:m}),(0,G.jsx)(`input`,{...U})]})}),Kq=x.forwardRef(function(e,t){let{render:n,className:r,...i}=e,{state:a}=Lq(),o=Dq();return aq(`span`,e,{state:{...a,...o},ref:t,stateAttributesMapping:Mq,props:i})});function qq({checked:e,onCheckedChange:t,disabled:n,className:r,ariaLabel:i}){return(0,G.jsx)(Gq,{checked:e,onCheckedChange:t,disabled:n,"aria-label":i,className:kg(`group relative inline-flex h-6 w-10 shrink-0 cursor-pointer items-center rounded-full transition-colors`,`bg-border data-[checked]:bg-accent`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-bg-base`,`disabled:cursor-not-allowed disabled:opacity-50`,r),children:(0,G.jsx)(Kq,{className:kg(`pointer-events-none block size-4 rounded-full bg-white shadow-sm transition-transform`,`translate-x-1 group-data-[checked]:translate-x-5`)})})}var Jq=null,Yq=!1,Xq={},Zq=500;function Qq(){if(typeof window>`u`)return null;if(Jq?.state===`closed`&&(Jq=null),!Jq){let e=window.AudioContext??window.webkitAudioContext;if(!e)return null;Jq=new e}return Jq}function $q(){Jq&&=(Jq.close().catch(()=>{}),null),Qq()}function eJ(){return Yq}function tJ(){Jq&&($q(),Yq=!0)}if(typeof window<`u`){window.addEventListener(`pageshow`,e=>{e.persisted&&tJ()}),document.addEventListener(`visibilitychange`,()=>{document.visibilityState===`visible`&&tJ()});let e=Date.now();setInterval(()=>{let t=Date.now();t-e>15e3&&tJ(),e=t},5e3)}async function nJ(){let e=Qq();e&&e.state===`suspended`&&await e.resume().catch(()=>{}),Yq=!1}async function rJ(e){e.state===`suspended`&&await e.resume().catch(()=>{})}async function iJ(e){let t=Qq();if(!t||(await rJ(t),t.state!==`running`))return;let{frequencies:n,durationMs:r,attackMs:i,peakGain:a,type:o=`sine`}=e,s=t.currentTime,c=r/1e3,l=i/1e3,u=t.createGain();u.connect(t.destination);let d=s+c*.7;u.gain.setValueAtTime(0,s),u.gain.linearRampToValueAtTime(a,s+l),u.gain.setValueAtTime(a,d),u.gain.linearRampToValueAtTime(0,s+c);let f=n.map(e=>{let n=t.createOscillator();return n.type=o,n.frequency.setValueAtTime(e,s),n.connect(u),n});for(let e of f)e.start(s),e.stop(s+c);let p=f[f.length-1];p.onended=()=>{for(let e of f)e.disconnect();u.disconnect()}}async function aJ(){let e=Date.now();if(!(e-(Xq.permission||0)<Zq)){Xq.permission=e;try{await iJ({frequencies:[880],durationMs:150,attackMs:5,peakGain:.15,type:`sine`})}catch{}}}async function oJ(){let e=Date.now();if(!(e-(Xq.idle||0)<Zq)){Xq.idle=e;try{await iJ({frequencies:[440,550],durationMs:300,attackMs:10,peakGain:.08,type:`sine`})}catch{}}}function sJ({isOpen:e,onClose:t}){let n=U(e=>e.defaultProjectDir),r=U(e=>e.setDefaultProjectDir),i=U(e=>e.commandPresets),a=U(e=>e.setCommandPresets),o=U(e=>e.defaultPresetId),s=U(e=>e.setDefaultPresetId),c=U(e=>e.sessionSortMode),l=U(e=>e.setSessionSortMode),u=U(e=>e.sessionSortDirection),d=U(e=>e.setSessionSortDirection),f=U(e=>e.useWebGL),p=U(e=>e.setUseWebGL),m=U(e=>e.fontSize),h=U(e=>e.setFontSize),g=U(e=>e.lineHeight),_=U(e=>e.setLineHeight),v=U(e=>e.letterSpacing),y=U(e=>e.setLetterSpacing),b=U(e=>e.fontOption),S=U(e=>e.setFontOption),C=U(e=>e.customFontFamily),w=U(e=>e.setCustomFontFamily),T=U(e=>e.shortcutModifier),E=U(e=>e.setShortcutModifier),D=U(e=>e.showProjectName),O=U(e=>e.setShowProjectName),k=U(e=>e.showLastUserMessage),A=U(e=>e.setShowLastUserMessage),j=U(e=>e.showSessionIdPrefix),M=U(e=>e.setShowSessionIdPrefix),N=RW(e=>e.theme),F=RW(e=>e.setTheme),I=U(e=>e.soundOnPermission),R=U(e=>e.setSoundOnPermission),z=U(e=>e.soundOnIdle),B=U(e=>e.setSoundOnIdle),[V,ee]=(0,x.useState)(n),[H,te]=(0,x.useState)(i),[ne,re]=(0,x.useState)(o),[ie,ae]=(0,x.useState)(c),[W,oe]=(0,x.useState)(u),[se,ce]=(0,x.useState)(f),[le,ue]=(0,x.useState)(m),[de,fe]=(0,x.useState)(g),[pe,me]=(0,x.useState)(v),[he,ge]=(0,x.useState)(b),[_e,ve]=(0,x.useState)(C),[ye,be]=(0,x.useState)(T),[xe,Se]=(0,x.useState)(D),[Ce,we]=(0,x.useState)(k),[Te,Ee]=(0,x.useState)(j),[De,Oe]=(0,x.useState)(N),[ke,Ae]=(0,x.useState)(I),[je,Me]=(0,x.useState)(z),[Ne,Pe]=(0,x.useState)(!0),[Fe,Ie]=(0,x.useState)(!1),[Le,Re]=(0,x.useState)(!0),[ze,Be]=(0,x.useState)(!0),[Ve,He]=(0,x.useState)(!1),[Ue,We]=(0,x.useState)(!1),[Ge,Ke]=(0,x.useState)(24),[qe,Ye]=(0,x.useState)(!1),[Ze,Qe]=(0,x.useState)(!1),[$e,et]=(0,x.useState)(``),[tt,nt]=(0,x.useState)(``),[rt,it]=(0,x.useState)(``),at=(0,x.useRef)(null),ot=(0,x.useRef)(0),st=(0,x.useRef)(!1);if((0,x.useEffect)(()=>{let t=++ot.current,r=st.current;if(st.current=e,at.current&&=(clearTimeout(at.current),null),e){if(ee(n),te(i),re(o),ae(c),oe(u),ce(f),ue(m),fe(g),me(v),ge(b),ve(C),be(T),Se(D),we(k),Ee(j),Oe(N),Ae(I),Me(z),Qe(!1),et(``),nt(``),it(``),fetch(`/api/settings/tmux-mouse-mode`).then(e=>e.json()).then(e=>Pe(e.enabled)).catch(()=>{}),Be(!0),fetch(`/api/settings/terminal-colors`).then(e=>{if(!e.ok)throw Error(`HTTP ${e.status}`);return e.json()}).then(e=>{ot.current===t&&Re(e.enabled)}).catch(()=>{}).finally(()=>{ot.current===t&&Be(!1)}),fetch(`/api/settings/history-max-age-hours`).then(e=>e.json()).then(e=>Ke(e.hours)).catch(()=>{}),fetch(`/api/settings/prefer-window-name`).then(e=>e.json()).then(e=>He(e.enabled)).catch(()=>{}),typeof document<`u`){let e=document.querySelector(`.xterm-helper-textarea`);e&&typeof e.setAttribute==`function`&&(typeof e.blur==`function`&&e.blur(),e.setAttribute(`disabled`,`true`))}}else r&&typeof document<`u`&&(at.current=setTimeout(()=>{if(typeof document>`u`)return;let e=document.querySelector(`.xterm-helper-textarea`);e&&(e.removeAttribute(`disabled`),e.focus())},300));return()=>{at.current&&=(clearTimeout(at.current),null)}},[i,o,n,c,u,f,m,g,v,b,C,T,D,k,j,N,I,z,e]),(0,x.useEffect)(()=>{if(!e||typeof window>`u`||typeof window.addEventListener!=`function`)return;let n=e=>{e.key===`Escape`&&(typeof e.stopPropagation==`function`&&e.stopPropagation(),t())};return window.addEventListener(`keydown`,n),()=>window.removeEventListener(`keydown`,n)},[e,t]),!e)return null;let ct=e=>{e.preventDefault();let n=V.trim(),i=se!==f;r(n||`~/Documents/GitHub`),a(H),s(ne),l(ie),d(W),p(se),h(le),_(de),y(pe),S(he),w(_e),E(ye),O(xe),A(Ce),M(Te),F(De),R(ke),B(je),t({webglChanged:i})},lt=(e,t)=>{te(n=>n.map(n=>n.id===e?{...n,...t}:n))},ut=e=>{let t=H.find(t=>t.id===e);if(!t||t.isBuiltIn)return;let n=H.filter(t=>t.id!==e);te(n),e===ne&&re(n[0]?.id||`claude`)},dt=()=>{if(!$e.trim()||!tt.trim()||H.length>=50)return;let e={id:`custom-${Date.now()}-${Math.random().toString(36).slice(2,6)}`,label:$e.trim(),command:tt.trim(),isBuiltIn:!1,agentType:rt||void 0};te([...H,e]),Qe(!1),et(``),nt(``),it(``)},ft=H.length<50,pt=e=>{Ie(!0),Pe(e),fetch(`/api/settings/tmux-mouse-mode`,{method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify({enabled:e})}).then(e=>{if(!e.ok)throw Error(`HTTP ${e.status}`)}).catch(()=>Pe(!e)).finally(()=>Ie(!1))},mt=e=>{We(!0),He(e),fetch(`/api/settings/prefer-window-name`,{method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify({enabled:e})}).then(e=>{if(!e.ok)throw Error(`HTTP ${e.status}`)}).catch(()=>He(!e)).finally(()=>We(!1))},ht=e=>{Be(!0),Re(e),fetch(`/api/settings/terminal-colors`,{method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify({enabled:e})}).then(e=>{if(!e.ok)throw Error(`HTTP ${e.status}`)}).catch(()=>Re(!e)).finally(()=>Be(!1))},gt=e=>{let t=Ge;Ye(!0),Ke(e),fetch(`/api/settings/history-max-age-hours`,{method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify({hours:e})}).then(e=>{if(!e.ok)throw Error(`HTTP ${e.status}`)}).catch(()=>Ke(t)).finally(()=>Ye(!1))};return(0,G.jsx)(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center bg-black/60 p-4`,onClick:e=>{e.target===e.currentTarget&&t()},children:(0,G.jsxs)(`form`,{onSubmit:ct,className:`w-full max-w-lg max-h-[90vh] flex flex-col border border-border bg-elevated`,children:[(0,G.jsxs)(`div`,{className:`p-6 pb-0`,children:[(0,G.jsx)(`h2`,{className:`text-sm font-semibold uppercase tracking-wider text-primary text-balance`,children:`Settings`}),(0,G.jsx)(`p`,{className:`mt-2 text-xs text-muted text-pretty`,children:`Configure default directory, command presets, and display options.`})]}),(0,G.jsx)(`div`,{className:`flex-1 overflow-y-auto px-6 pb-4`,children:(0,G.jsxs)(`div`,{className:`mt-5 space-y-4`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`label`,{className:`mb-1.5 block text-xs text-secondary`,children:`Default Project Directory`}),(0,G.jsx)(`input`,{value:V,onChange:e=>ee(e.target.value),placeholder:P,className:`input`,autoFocus:!0})]}),(0,G.jsxs)(`div`,{className:`border-t border-border pt-4`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between mb-2`,children:[(0,G.jsx)(`label`,{className:`text-xs text-secondary`,children:`Command Presets`}),(0,G.jsx)(`select`,{value:ne,onChange:e=>re(e.target.value),className:`input text-xs py-1 px-2 w-auto`,children:H.map(e=>(0,G.jsx)(`option`,{value:e.id,children:e.label},e.id))})]}),(0,G.jsx)(`p`,{className:`text-[10px] text-muted mb-3`,children:`Default preset is pre-selected when creating new sessions.`}),(0,G.jsx)(`div`,{className:`space-y-3`,children:H.map(e=>(0,G.jsxs)(`div`,{className:`border border-border p-3 space-y-2`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,G.jsx)(`div`,{className:`flex items-center gap-2`,children:(0,G.jsx)(`input`,{value:e.label,onChange:t=>lt(e.id,{label:t.target.value}),className:`input text-sm py-1 px-2 w-32`,placeholder:`Label`})}),!e.isBuiltIn&&(0,G.jsx)(`button`,{type:`button`,onClick:()=>ut(e.id),className:`btn text-xs px-2 py-1 text-error hover:bg-error/10`,children:`Delete`})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`label`,{className:`text-[10px] text-muted block mb-1`,children:`Command`}),(0,G.jsx)(`input`,{value:e.command,onChange:t=>lt(e.id,{command:t.target.value}),className:`input text-xs py-1 px-2 font-mono w-full`,placeholder:`command --flags`})]}),!e.isBuiltIn&&(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`label`,{className:`text-[10px] text-muted block mb-1`,children:`Icon`}),(0,G.jsxs)(`select`,{value:e.agentType||``,onChange:t=>lt(e.id,{agentType:t.target.value||void 0}),className:`input text-xs py-1 px-2 w-auto`,children:[(0,G.jsx)(`option`,{value:``,children:`Terminal`}),(0,G.jsx)(`option`,{value:`claude`,children:`Claude`}),(0,G.jsx)(`option`,{value:`codex`,children:`Codex`}),(0,G.jsx)(`option`,{value:`pi`,children:`Pi`}),(0,G.jsx)(`option`,{value:`devin`,children:`Devin`}),(0,G.jsx)(`option`,{value:`grok`,children:`Grok`}),(0,G.jsx)(`option`,{value:`omp`,children:`OMP`})]})]})]},e.id))}),Ze?(0,G.jsxs)(`div`,{className:`mt-3 border border-border p-3 space-y-2`,children:[(0,G.jsx)(`div`,{className:`text-xs text-secondary mb-2`,children:`New Preset`}),(0,G.jsx)(`input`,{value:$e,onChange:e=>et(e.target.value),className:`input text-xs py-1 px-2 w-full`,placeholder:`Label`}),(0,G.jsx)(`input`,{value:tt,onChange:e=>nt(e.target.value),className:`input text-xs py-1 px-2 font-mono w-full`,placeholder:`command --flags`}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsxs)(`select`,{value:rt,onChange:e=>it(e.target.value),className:`input text-xs py-1 px-2 w-auto`,children:[(0,G.jsx)(`option`,{value:``,children:`Terminal Icon`}),(0,G.jsx)(`option`,{value:`claude`,children:`Claude Icon`}),(0,G.jsx)(`option`,{value:`codex`,children:`Codex Icon`}),(0,G.jsx)(`option`,{value:`pi`,children:`Pi Icon`}),(0,G.jsx)(`option`,{value:`devin`,children:`Devin Icon`}),(0,G.jsx)(`option`,{value:`grok`,children:`Grok Icon`}),(0,G.jsx)(`option`,{value:`omp`,children:`OMP Icon`})]}),(0,G.jsx)(`div`,{className:`flex-1`}),(0,G.jsx)(`button`,{type:`button`,onClick:()=>Qe(!1),className:`btn text-xs px-2 py-1`,children:`Cancel`}),(0,G.jsx)(`button`,{type:`button`,onClick:dt,disabled:!$e.trim()||!tt.trim(),className:`btn btn-primary text-xs px-2 py-1`,children:`Add`})]})]}):(0,G.jsx)(`button`,{type:`button`,onClick:()=>Qe(!0),disabled:!ft,className:`btn text-xs mt-3 w-full`,children:ft?`+ Add Preset`:`Max 50 presets`})]}),(0,G.jsxs)(`div`,{className:`border-t border-border pt-4`,children:[(0,G.jsx)(`label`,{className:`mb-2 block text-xs text-secondary`,children:`Session List Order`}),(0,G.jsxs)(`div`,{className:`flex gap-2`,children:[(0,G.jsx)(`button`,{type:`button`,className:`btn flex-1 ${ie===`created`?`btn-primary`:``}`,onClick:()=>ae(`created`),children:`Created`}),(0,G.jsx)(`button`,{type:`button`,className:`btn flex-1 ${ie===`status`?`btn-primary`:``}`,onClick:()=>ae(`status`),children:`Status`}),(0,G.jsx)(`button`,{type:`button`,className:`btn flex-1 ${ie===`manual`?`btn-primary`:``}`,onClick:()=>ae(`manual`),children:`Manual`})]}),(0,G.jsx)(`p`,{className:`mt-1.5 text-[10px] text-muted`,children:ie===`status`?`Sessions auto-resort by status (waiting, working, unknown)`:ie===`manual`?`Drag sessions to reorder manually`:`Sessions stay in creation order`})]}),ie===`created`&&(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`label`,{className:`mb-2 block text-xs text-secondary`,children:`Sort Direction`}),(0,G.jsxs)(`div`,{className:`flex gap-2`,children:[(0,G.jsx)(`button`,{type:`button`,className:`btn flex-1 ${W===`desc`?`btn-primary`:``}`,onClick:()=>oe(`desc`),children:`Newest First`}),(0,G.jsx)(`button`,{type:`button`,className:`btn flex-1 ${W===`asc`?`btn-primary`:``}`,onClick:()=>oe(`asc`),children:`Oldest First`})]})]}),(0,G.jsxs)(`div`,{className:`border-t border-border pt-4 space-y-3`,children:[(0,G.jsx)(`label`,{className:`mb-1 block text-xs text-secondary`,children:`Session List Details`}),(0,G.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`div`,{className:`text-sm text-primary`,children:`Project Name`}),(0,G.jsx)(`div`,{className:`text-[10px] text-muted`,children:`Show the project folder name under each session.`})]}),(0,G.jsx)(qq,{checked:xe,onCheckedChange:Se})]}),(0,G.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`div`,{className:`text-sm text-primary`,children:`Last User Message`}),(0,G.jsx)(`div`,{className:`text-[10px] text-muted`,children:`Show the most recent user input next to the project name.`})]}),(0,G.jsx)(qq,{checked:Ce,onCheckedChange:we})]}),(0,G.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`div`,{className:`text-sm text-primary`,children:`Session ID Prefix`}),(0,G.jsx)(`div`,{className:`text-[10px] text-muted`,children:`Show first 5 characters of agent session IDs in the list.`})]}),(0,G.jsx)(qq,{checked:Te,onCheckedChange:Ee})]}),(0,G.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`div`,{className:`text-sm text-primary`,children:`History Sessions Lookback`}),(0,G.jsxs)(`div`,{className:`text-[10px] text-muted`,children:[`Show history sessions from the last N hours (`,1,`-`,168,`).`]})]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(`input`,{type:`number`,min:1,max:168,value:Ge,onChange:e=>{let t=parseInt(e.target.value,10);t>=1&&t<=168&>(t)},disabled:qe,className:`input text-xs py-1 px-2 w-16 text-center`}),(0,G.jsx)(`span`,{className:`text-xs text-muted`,children:`hrs`})]})]})]}),(0,G.jsxs)(`div`,{className:`border-t border-border pt-4 space-y-3`,children:[(0,G.jsx)(`label`,{className:`mb-1 block text-xs text-secondary`,children:`Notifications`}),(0,G.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,G.jsxs)(`div`,{className:`flex-1`,children:[(0,G.jsx)(`div`,{className:`text-sm text-primary`,children:`Permission Sound`}),(0,G.jsx)(`div`,{className:`text-[10px] text-muted`,children:`Play a ping when any session needs permission.`})]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(`button`,{type:`button`,onClick:()=>void aJ(),className:`btn text-xs px-2 py-1`,children:`Test`}),(0,G.jsx)(qq,{checked:ke,onCheckedChange:e=>{Ae(e),e&&nJ()}})]})]}),(0,G.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,G.jsxs)(`div`,{className:`flex-1`,children:[(0,G.jsx)(`div`,{className:`text-sm text-primary`,children:`Idle Sound`}),(0,G.jsx)(`div`,{className:`text-[10px] text-muted`,children:`Play a chime when a session finishes working.`})]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(`button`,{type:`button`,onClick:()=>void oJ(),className:`btn text-xs px-2 py-1`,children:`Test`}),(0,G.jsx)(qq,{checked:je,onCheckedChange:e=>{Me(e),e&&nJ()}})]})]})]}),(0,G.jsxs)(`div`,{className:`border-t border-border pt-4`,children:[(0,G.jsx)(`label`,{className:`mb-2 block text-xs text-secondary`,children:`Terminal Rendering`}),(0,G.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`div`,{className:`text-sm text-primary`,children:`WebGL Acceleration`}),(0,G.jsx)(`div`,{className:`text-[10px] text-muted`,children:`GPU rendering for better performance. Turn off if text looks fuzzy or flickering.`})]}),(0,G.jsx)(qq,{checked:se,onCheckedChange:ce})]}),se!==f&&(0,G.jsx)(`p`,{className:`mt-2 text-[10px] text-approval`,children:`Terminal will reload when saved`}),(0,G.jsxs)(`div`,{className:`mt-4 flex items-center justify-between`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`div`,{className:`text-sm text-primary`,children:`Mouse Mode`}),(0,G.jsx)(`div`,{className:`text-[10px] text-muted`,children:`Enable tmux mouse mode for trackpad/scroll wheel support.`})]}),(0,G.jsx)(qq,{checked:Ne,onCheckedChange:pt,disabled:Fe})]}),(0,G.jsxs)(`div`,{className:`mt-4 flex items-center justify-between gap-4`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`div`,{className:`text-sm text-primary`,children:`Terminal Colors`}),(0,G.jsx)(`div`,{className:`text-[10px] text-muted`,children:`Preserve ANSI colors for terminal output. Hibernate then Wake running agents after changing this setting.`})]}),(0,G.jsx)(qq,{checked:Le,onCheckedChange:ht,disabled:ze,ariaLabel:`Enable terminal colors`})]}),(0,G.jsxs)(`div`,{className:`mt-4 flex items-center justify-between`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`div`,{className:`text-sm text-primary`,children:`Prefer Window Names`}),(0,G.jsx)(`div`,{className:`text-[10px] text-muted`,children:`Label discovered sessions with their tmux window name instead of the session name. Applies immediately.`})]}),(0,G.jsx)(qq,{checked:Ve,onCheckedChange:mt,disabled:Ue})]}),(0,G.jsxs)(`div`,{className:`mt-4 flex items-center justify-between`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`div`,{className:`text-sm text-primary`,children:`Font Size`}),(0,G.jsx)(`div`,{className:`text-[10px] text-muted`,children:`Terminal text size in pixels (6-24)`})]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(`button`,{type:`button`,onClick:()=>ue(Math.max(6,le-1)),className:`flex h-7 w-7 items-center justify-center rounded bg-surface border border-border text-secondary hover:bg-hover`,children:(0,G.jsx)(`span`,{className:`text-sm font-bold`,children:`−`})}),(0,G.jsx)(`span`,{className:`text-sm text-secondary w-6 text-center`,children:le}),(0,G.jsx)(`button`,{type:`button`,onClick:()=>ue(Math.min(24,le+1)),className:`flex h-7 w-7 items-center justify-center rounded bg-surface border border-border text-secondary hover:bg-hover`,children:(0,G.jsx)(`span`,{className:`text-sm font-bold`,children:`+`})})]})]}),(0,G.jsxs)(`div`,{className:`mt-4 flex items-center justify-between`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`div`,{className:`text-sm text-primary`,children:`Line Height`}),(0,G.jsx)(`div`,{className:`text-[10px] text-muted`,children:`Vertical spacing (1.0 = compact, 2.0 = spacious)`})]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(`input`,{type:`range`,min:`1.0`,max:`2.0`,step:`0.1`,value:de,onChange:e=>fe(parseFloat(e.target.value)),className:`w-20 h-1 bg-border rounded-lg appearance-none cursor-pointer accent-accent`}),(0,G.jsx)(`span`,{className:`text-xs text-secondary w-8 text-right`,children:de.toFixed(1)})]})]}),(0,G.jsxs)(`div`,{className:`mt-4 flex items-center justify-between`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`div`,{className:`text-sm text-primary`,children:`Letter Spacing`}),(0,G.jsx)(`div`,{className:`text-[10px] text-muted`,children:`Horizontal spacing between characters in pixels`})]}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(`input`,{type:`range`,min:`-3`,max:`3`,step:`1`,value:pe,onChange:e=>me(parseInt(e.target.value,10)),className:`w-20 h-1 bg-border rounded-lg appearance-none cursor-pointer accent-accent`}),(0,G.jsxs)(`span`,{className:`text-xs text-secondary w-8 text-right`,children:[pe,`px`]})]})]}),(0,G.jsxs)(`div`,{className:`mt-4`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`div`,{className:`text-sm text-primary`,children:`Font Family`}),(0,G.jsx)(`div`,{className:`text-[10px] text-muted`,children:`Terminal typeface`})]}),(0,G.jsx)(`select`,{value:he,onChange:e=>ge(e.target.value),className:`input text-xs py-1 px-2 w-auto`,children:L.map(e=>(0,G.jsx)(`option`,{value:e.id,children:e.label},e.id))})]}),he===`custom`&&(0,G.jsx)(`input`,{value:_e,onChange:e=>ve(e.target.value),placeholder:`"Fira Code", monospace`,className:`input text-xs mt-2 font-mono`})]}),(0,G.jsxs)(`div`,{className:`mt-4 flex items-center justify-between`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`div`,{className:`text-sm text-primary`,children:`Dark Mode`}),(0,G.jsx)(`div`,{className:`text-[10px] text-muted`,children:`Switch between dark and light themes.`})]}),(0,G.jsx)(qq,{checked:De===`dark`,onCheckedChange:e=>Oe(e?`dark`:`light`)})]})]}),(0,G.jsxs)(`div`,{className:`border-t border-border pt-4`,children:[(0,G.jsx)(`label`,{className:`mb-2 block text-xs text-secondary`,children:`Keyboard Shortcut Modifier`}),(0,G.jsx)(`div`,{className:`grid grid-cols-5 gap-1`,children:[`auto`,`ctrl-option`,`ctrl-shift`,`cmd-option`,`cmd-shift`].map(e=>(0,G.jsx)(`button`,{type:`button`,className:`btn text-xs px-2 ${ye===e?`btn-primary`:``}`,onClick:()=>be(e),children:e===`auto`?`Auto`:Xe(e)},e))}),(0,G.jsx)(`p`,{className:`mt-1.5 text-[10px] text-muted`,children:ye===`auto`?`Shortcuts: ${Xe(Je(`auto`))}+[1-9/N/X/[/]]`:`Shortcuts: ${Xe(ye)}+[1-9/N/X/[/]]`})]})]})}),(0,G.jsxs)(`div`,{className:`flex justify-end gap-2 p-6 pt-4 border-t border-border bg-elevated`,children:[(0,G.jsx)(`button`,{type:`button`,onClick:()=>t(),className:`btn`,children:`Cancel`}),(0,G.jsx)(`button`,{type:`submit`,className:`btn btn-primary`,children:`Save`})]})]})})}var cJ=[];function lJ(e){x.useEffect(e,cJ)}var uJ=x.createContext(void 0);function dJ(){let e=x.useContext(uJ);if(!e)throw Error(zK(73));return e}var fJ=Symbol(`NOT_FOUND`);function pJ(e,t=`expected a function, instead received ${typeof e}`){if(typeof e!=`function`)throw TypeError(t)}function mJ(e,t=`expected an object, instead received ${typeof e}`){if(typeof e!=`object`)throw TypeError(t)}function hJ(e,t=`expected all items to be functions, instead received the following types: `){if(!e.every(e=>typeof e==`function`)){let n=e.map(e=>typeof e==`function`?`function ${e.name||`unnamed`}()`:typeof e).join(`, `);throw TypeError(`${t}[${n}]`)}}var gJ=e=>Array.isArray(e)?e:[e];function _J(e){let t=Array.isArray(e[0])?e[0]:e;return hJ(t,`createSelector expects all input-selectors to be functions, but received the following types: `),t}function vJ(e,t){let n=[],{length:r}=e;for(let i=0;i<r;i++)n.push(e[i].apply(null,t));return n}function yJ(e){let t;return{get(n){return t&&e(t.key,n)?t.value:fJ},put(e,n){t={key:e,value:n}},getEntries(){return t?[t]:[]},clear(){t=void 0}}}function bJ(e,t){let n=[];function r(e){let r=n.findIndex(n=>t(e,n.key));if(r>-1){let e=n[r];return r>0&&(n.splice(r,1),n.unshift(e)),e.value}return fJ}function i(t,i){r(t)===fJ&&(n.unshift({key:t,value:i}),n.length>e&&n.pop())}function a(){return n}function o(){n=[]}return{get:r,put:i,getEntries:a,clear:o}}var xJ=(e,t)=>e===t;function SJ(e){return function(t,n){if(t===null||n===null||t.length!==n.length)return!1;let{length:r}=t;for(let i=0;i<r;i++)if(!e(t[i],n[i]))return!1;return!0}}function CJ(e,t){let{equalityCheck:n=xJ,maxSize:r=1,resultEqualityCheck:i}=typeof t==`object`?t:{equalityCheck:t},a=SJ(n),o=0,s=r<=1?yJ(a):bJ(r,a);function c(){let t=s.get(arguments);if(t===fJ){if(t=e.apply(null,arguments),o++,i){let e=s.getEntries().find(e=>i(e.value,t));e&&(t=e.value,o!==0&&o--)}s.put(arguments,t)}return t}return c.clearCache=()=>{s.clear(),c.resetResultsCount()},c.resultsCount=()=>o,c.resetResultsCount=()=>{o=0},c}var wJ=class{constructor(e){this.value=e}deref(){return this.value}},TJ=typeof WeakRef<`u`?WeakRef:wJ,EJ=0,DJ=1;function OJ(){return{s:EJ,v:void 0,o:null,p:null}}function kJ(e,t={}){let n=OJ(),{resultEqualityCheck:r}=t,i,a=0;function o(){let t=n,{length:o}=arguments;for(let e=0,n=o;e<n;e++){let n=arguments[e];if(typeof n==`function`||typeof n==`object`&&n){let e=t.o;e===null&&(t.o=e=new WeakMap);let r=e.get(n);r===void 0?(t=OJ(),e.set(n,t)):t=r}else{let e=t.p;e===null&&(t.p=e=new Map);let r=e.get(n);r===void 0?(t=OJ(),e.set(n,t)):t=r}}let s=t,c;if(t.s===DJ)c=t.v;else if(c=e.apply(null,arguments),a++,r){let e=i?.deref?.()??i;e!=null&&r(e,c)&&(c=e,a!==0&&a--),i=typeof c==`object`&&c||typeof c==`function`?new TJ(c):c}return s.s=DJ,s.v=c,c}return o.clearCache=()=>{n=OJ(),o.resetResultsCount()},o.resultsCount=()=>a,o.resetResultsCount=()=>{a=0},o}function AJ(e,...t){let n=typeof e==`function`?{memoize:e,memoizeOptions:t}:e,r=(...e)=>{let t=0,r=0,i,a={},o=e.pop();typeof o==`object`&&(a=o,o=e.pop()),pJ(o,`createSelector expects an output function after the inputs, but received: [${typeof o}]`);let{memoize:s,memoizeOptions:c=[],argsMemoize:l=kJ,argsMemoizeOptions:u=[],devModeChecks:d={}}={...n,...a},f=gJ(c),p=gJ(u),m=_J(e),h=s(function(){return t++,o.apply(null,arguments)},...f),g=l(function(){r++;let e=vJ(m,arguments);return i=h.apply(null,e),i},...p);return Object.assign(g,{resultFunc:o,memoizedResultFunc:h,dependencies:m,dependencyRecomputations:()=>r,resetDependencyRecomputations:()=>{r=0},lastResult:()=>i,recomputations:()=>t,resetRecomputations:()=>{t=0},memoize:s,argsMemoize:l})};return Object.assign(r,{withTypes:()=>r}),r}var jJ=AJ(kJ),MJ=Object.assign((e,t=jJ)=>{mJ(e,`createStructuredSelector expects first argument to be an object where each property is a selector, instead received a ${typeof e}`);let n=Object.keys(e);return t(n.map(t=>e[t]),(...e)=>e.reduce((e,t,r)=>(e[n[r]]=t,e),{}))},{withTypes:()=>MJ}),NJ=AJ({memoize:CJ,memoizeOptions:{maxSize:1,equalityCheck:Object.is}}),PJ=(e,t,n,r,i,a,...o)=>{if(o.length>0)throw Error(zK(1));let s;if(e&&t&&n&&r&&i&&a)s=(o,s,c,l)=>a(e(o,s,c,l),t(o,s,c,l),n(o,s,c,l),r(o,s,c,l),i(o,s,c,l),s,c,l);else if(e&&t&&n&&r&&i)s=(a,o,s,c)=>i(e(a,o,s,c),t(a,o,s,c),n(a,o,s,c),r(a,o,s,c),o,s,c);else if(e&&t&&n&&r)s=(i,a,o,s)=>r(e(i,a,o,s),t(i,a,o,s),n(i,a,o,s),a,o,s);else if(e&&t&&n)s=(r,i,a,o)=>n(e(r,i,a,o),t(r,i,a,o),i,a,o);else if(e&&t)s=(n,r,i,a)=>t(e(n,r,i,a),r,i,a);else if(e)s=e;else throw Error(`Missing arguments`);return s},FJ=(...e)=>{let t=new WeakMap,n=1,r=e[e.length-1],i=e.length-1||1,a=r.length-i;if(a>3)throw Error(zK(2));return(i,o,s,c)=>{let l=i.__cacheKey__;l||(l={id:n},i.__cacheKey__=l,n+=1);let u=t.get(l);if(!u){let n=e,i=[void 0,void 0,void 0];switch(a){case 0:break;case 1:n=[...e.slice(0,-1),()=>i[0],r];break;case 2:n=[...e.slice(0,-1),()=>i[0],()=>i[1],r];break;case 3:n=[...e.slice(0,-1),()=>i[0],()=>i[1],()=>i[2],r];break;default:throw Error(zK(2))}u=NJ(...n),u.selectorArgs=i,t.set(l,u)}switch(u.selectorArgs[0]=o,u.selectorArgs[1]=s,u.selectorArgs[2]=c,a){case 0:return u(i);case 1:return u(i,o);case 2:return u(i,o,s);case 3:return u(i,o,s,c);default:throw Error(`unreachable`)}}},IJ=s((e=>{var t=p();function n(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var r=typeof Object.is==`function`?Object.is:n,i=t.useState,a=t.useEffect,o=t.useLayoutEffect,s=t.useDebugValue;function c(e,t){var n=t(),r=i({inst:{value:n,getSnapshot:t}}),c=r[0].inst,u=r[1];return o(function(){c.value=n,c.getSnapshot=t,l(c)&&u({inst:c})},[e,n,t]),a(function(){return l(c)&&u({inst:c}),e(function(){l(c)&&u({inst:c})})},[e]),s(n),n}function l(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!r(e,n)}catch{return!0}}function u(e,t){return t()}var d=typeof window>`u`||window.document===void 0||window.document.createElement===void 0?u:c;e.useSyncExternalStore=t.useSyncExternalStore===void 0?d:t.useSyncExternalStore})),LJ=s(((e,t)=>{t.exports=IJ()})),RJ=s((e=>{var t=p(),n=LJ();function r(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var i=typeof Object.is==`function`?Object.is:r,a=n.useSyncExternalStore,o=t.useRef,s=t.useEffect,c=t.useMemo,l=t.useDebugValue;e.useSyncExternalStoreWithSelector=function(e,t,n,r,u){var d=o(null);if(d.current===null){var f={hasValue:!1,value:null};d.current=f}else f=d.current;d=c(function(){function e(e){if(!a){if(a=!0,o=e,e=r(e),u!==void 0&&f.hasValue){var t=f.value;if(u(t,e))return s=t}return s=e}if(t=s,i(o,e))return t;var n=r(e);return u!==void 0&&u(t,n)?(o=e,t):(o=e,s=n)}var a=!1,o,s,c=n===void 0?null:n;return[function(){return e(t())},c===null?void 0:function(){return e(c())}]},[t,n,r,u]);var p=a(e,d[0],d[1]);return s(function(){f.hasValue=!0,f.value=p},[p]),l(p),p}})),zJ=s(((e,t)=>{t.exports=RJ()})),BJ=[],VJ=void 0;function HJ(){return VJ}function UJ(e){BJ.push(e)}var WJ=LJ(),GJ=zJ(),KJ=VK(19)?YJ:XJ;function qJ(e,t,n,r,i){return KJ(e,t,n,r,i)}function JJ(e,t,n,r,i){let a=x.useCallback(()=>t(e.getSnapshot(),n,r,i),[e,t,n,r,i]);return(0,WJ.useSyncExternalStore)(e.subscribe,a,a)}UJ({before(e){e.syncIndex=0,e.didInitialize||(e.syncTick=1,e.syncHooks=[],e.didChangeStore=!0,e.getSnapshot=()=>{let t=!1;for(let n=0;n<e.syncHooks.length;n+=1){let r=e.syncHooks[n],i=r.selector(r.store.state,r.a1,r.a2,r.a3);(r.didChange||!Object.is(r.value,i))&&(t=!0,r.value=i,r.didChange=!1)}return t&&(e.syncTick+=1),e.syncTick})},after(e){e.syncHooks.length>0&&(e.didChangeStore&&(e.didChangeStore=!1,e.subscribe=t=>{let n=new Set;for(let t of e.syncHooks)n.add(t.store);let r=[];for(let e of n)r.push(e.subscribe(t));return()=>{for(let e of r)e()}}),(0,WJ.useSyncExternalStore)(e.subscribe,e.getSnapshot,e.getSnapshot))}});function YJ(e,t,n,r,i){let a=HJ();if(!a)return JJ(e,t,n,r,i);let o=a.syncIndex;a.syncIndex+=1;let s;return a.didInitialize?(s=a.syncHooks[o],(s.store!==e||s.selector!==t||!Object.is(s.a1,n)||!Object.is(s.a2,r)||!Object.is(s.a3,i))&&(s.store!==e&&(a.didChangeStore=!0),s.store=e,s.selector=t,s.a1=n,s.a2=r,s.a3=i,s.didChange=!0)):(s={store:e,selector:t,a1:n,a2:r,a3:i,value:t(e.getSnapshot(),n,r,i),didChange:!1},a.syncHooks.push(s)),s.value}function XJ(e,t,n,r,i){return(0,GJ.useSyncExternalStoreWithSelector)(e.subscribe,e.getSnapshot,e.getSnapshot,e=>t(e,n,r,i))}var ZJ=class{constructor(e){this.state=e,this.listeners=new Set,this.updateTick=0}subscribe=e=>(this.listeners.add(e),()=>{this.listeners.delete(e)});getSnapshot=()=>this.state;setState(e){if(this.state===e)return;this.state=e,this.updateTick+=1;let t=this.updateTick;for(let n of this.listeners){if(t!==this.updateTick)return;n(e)}}update(e){for(let t in e)if(!Object.is(this.state[t],e[t])){this.setState({...this.state,...e});return}}set(e,t){Object.is(this.state[e],t)||this.setState({...this.state,[e]:t})}notifyAll(){let e={...this.state};this.setState(e)}use(e,t,n,r){return qJ(this,e,t,n,r)}},QJ=class extends ZJ{constructor(e,t={},n){super(e),this.context=t,this.selectors=n}useSyncedValue(e,t){x.useDebugValue(e),NK(()=>{this.state[e]!==t&&this.set(e,t)},[e,t])}useSyncedValueWithCleanup(e,t){let n=this;NK(()=>(n.state[e]!==t&&n.set(e,t),()=>{n.set(e,void 0)}),[n,e,t])}useSyncedValues(e){let t=this;NK(()=>{t.update(e)},[t,...Object.values(e)])}useControlledProp(e,t){x.useDebugValue(e);let n=t!==void 0;NK(()=>{n&&!Object.is(this.state[e],t)&&super.setState({...this.state,[e]:t})},[e,t,n])}select(e,t,n,r){let i=this.selectors[e];return i(this.state,t,n,r)}useState(e,t,n,r){return x.useDebugValue(e),qJ(this,this.selectors[e],t,n,r)}useContextCallback(e,t){x.useDebugValue(e);let n=wK(t??LK);this.context[e]=n}useStateSetter(e){let t=x.useRef(void 0);return t.current===void 0&&(t.current=t=>{this.set(e,t)}),t.current}observe(e,t){let n;n=typeof e==`function`?e:this.selectors[e];let r=n(this.state);return t(r,r,this),this.subscribe(e=>{let i=n(e);if(!Object.is(r,i)){let e=r;r=i,t(i,e,this)}})}},$J=null;globalThis.requestAnimationFrame;var eY=new class{callbacks=[];callbacksCount=0;nextId=1;startId=1;isScheduled=!1;tick=e=>{this.isScheduled=!1;let t=this.callbacks,n=this.callbacksCount;if(this.callbacks=[],this.callbacksCount=0,this.startId=this.nextId,n>0)for(let n=0;n<t.length;n+=1)t[n]?.(e)};request(e){let t=this.nextId;return this.nextId+=1,this.callbacks.push(e),this.callbacksCount+=1,this.isScheduled||=(requestAnimationFrame(this.tick),!0),t}cancel(e){let t=e-this.startId;t<0||t>=this.callbacks.length||(this.callbacks[t]=null,--this.callbacksCount)}},tY=class e{static create(){return new e}static request(e){return eY.request(e)}static cancel(e){return eY.cancel(e)}currentId=$J;request(e){this.cancel(),this.currentId=eY.request(()=>{this.currentId=$J,e()})}cancel=()=>{this.currentId!==$J&&(eY.cancel(this.currentId),this.currentId=$J)};disposeEffect=()=>this.cancel};function nY(){let e=xK(tY.create).current;return lJ(e.disposeEffect),e}var rY=0,iY=class e{static create(){return new e}currentId=rY;start(e,t){this.clear(),this.currentId=setTimeout(()=>{this.currentId=rY,t()},e)}isStarted(){return this.currentId!==rY}clear=()=>{this.currentId!==rY&&(clearTimeout(this.currentId),this.currentId=rY)};disposeEffect=()=>this.clear};function aY(){let e=xK(iY.create).current;return lJ(e.disposeEffect),e}var oY=0;function sY(e){return oY+=1,`${e}-${Math.random().toString(36).slice(2,6)}-${oY}`}function cY(e){return e?.ownerDocument||document}function lY(e,t){if(typeof e==`string`)return{description:e};if(typeof e==`function`){let n=e(t);return typeof n==`string`?{description:n}:n}return e}var uY=typeof navigator<`u`,dY=gY(),fY=vY(),pY=_Y();typeof CSS>`u`||!CSS.supports||CSS.supports(`-webkit-backdrop-filter:none`),dY.platform===`MacIntel`&&dY.maxTouchPoints>1||/iP(hone|ad|od)|iOS/.test(dY.platform),uY&&/firefox/i.test(pY);var mY=uY&&/apple/i.test(navigator.vendor);uY&&/Edg/i.test(pY),uY&&/android/i.test(fY)||/android/i.test(pY),uY&&fY.toLowerCase().startsWith(`mac`)&&navigator.maxTouchPoints;var hY=pY.includes(`jsdom/`);function gY(){if(!uY)return{platform:``,maxTouchPoints:-1};let e=navigator.userAgentData;return e?.platform?{platform:e.platform,maxTouchPoints:navigator.maxTouchPoints}:{platform:navigator.platform??``,maxTouchPoints:navigator.maxTouchPoints??-1}}function _Y(){if(!uY)return``;let e=navigator.userAgentData;return e&&Array.isArray(e.brands)?e.brands.map(({brand:e,version:t})=>`${e}/${t}`).join(` `):navigator.userAgent}function vY(){if(!uY)return``;let e=navigator.userAgentData;return e?.platform?e.platform:navigator.platform??``}function yY(e){let t=e.activeElement;for(;t?.shadowRoot?.activeElement!=null;)t=t.shadowRoot.activeElement;return t}function bY(e,t){if(!e||!t)return!1;let n=t.getRootNode?.();if(e.contains(t))return!0;if(n&&bq(n)){let n=t;for(;n;){if(e===n)return!0;n=n.parentNode||n.host}}return!1}function xY(e){return`composedPath`in e?e.composedPath()[0]:e.target}function SY(e){if(!e||hY)return!0;try{return e.matches(`:focus-visible`)}catch{return!0}}var CY=FJ(e=>e.toasts,e=>{let t=new Map,n=0,r=0;return e.forEach((e,i)=>{let a=e.transitionStatus===`ending`;t.set(e.id,{value:e,domIndex:i,visibleIndex:a?-1:n,offsetY:r}),r+=e.height||0,a||(n+=1)}),t}),wY={toasts:PJ(e=>e.toasts),isEmpty:PJ(e=>e.toasts.length===0),toast:PJ(CY,(e,t)=>e.get(t)?.value),toastIndex:PJ(CY,(e,t)=>e.get(t)?.domIndex??-1),toastOffsetY:PJ(CY,(e,t)=>e.get(t)?.offsetY??0),toastVisibleIndex:PJ(CY,(e,t)=>e.get(t)?.visibleIndex??-1),hovering:PJ(e=>e.hovering),focused:PJ(e=>e.focused),expanded:PJ(e=>e.hovering||e.focused),expandedOrOutOfFocus:PJ(e=>e.hovering||e.focused||!e.isWindowFocused),prevFocusElement:PJ(e=>e.prevFocusElement)},TY=class extends QJ{timers=new Map;areTimersPaused=!1;constructor(e){super(e,{},wY)}setFocused(e){this.set(`focused`,e)}setHovering(e){this.set(`hovering`,e)}setIsWindowFocused(e){this.set(`isWindowFocused`,e)}setPrevFocusElement(e){this.set(`prevFocusElement`,e)}setViewport=e=>{this.set(`viewport`,e)};disposeEffect=()=>()=>{this.timers.forEach(e=>{e.timeout?.clear()}),this.timers.clear()};removeToast(e){let t=wY.toastIndex(this.state,e);if(t===-1)return;this.state.toasts[t]?.onRemove?.();let n=[...this.state.toasts];n.splice(t,1),this.setToasts(n)}addToast=e=>{let{toasts:t,timeout:n,limit:r}=this.state,i=e.id||sY(`toast`),a={...e,id:i,transitionStatus:`starting`},o=[a,...t],s=o.filter(e=>e.transitionStatus!==`ending`);if(s.length>r){let e=s.length-r,t=s.slice(-e),n=new Set(t.map(e=>e.id));this.setToasts(o.map(e=>{let t=n.has(e.id);return e.limited===t?e:{...e,limited:t}}))}else this.setToasts(o.map(e=>e.limited?{...e,limited:!1}:e));let c=a.timeout??n;return a.type!==`loading`&&c>0&&this.scheduleTimer(i,c,()=>this.closeToast(i)),wY.expandedOrOutOfFocus(this.state)&&this.pauseTimers(),i};updateToast=(e,t)=>{this.updateToastInternal(e,t)};updateToastInternal=(e,t)=>{let{timeout:n,toasts:r}=this.state,i=wY.toast(this.state,e)??null;if(!i||i.transitionStatus===`ending`)return;let a={...i,...t};this.setToasts(r.map(n=>n.id===e?{...n,...t}:n));let o=a.timeout??n,s=i?.timeout??n,c=Object.hasOwn(t,`timeout`),l=a.transitionStatus!==`ending`&&a.type!==`loading`&&o>0,u=this.timers.has(e),d=s!==o,f=i?.type===`loading`;if(!l&&u){this.timers.get(e)?.timeout?.clear(),this.timers.delete(e);return}if(l&&(!u||d||c||f)){let t=this.timers.get(e);t&&(t.timeout?.clear(),this.timers.delete(e)),this.scheduleTimer(e,o,()=>this.closeToast(e)),wY.expandedOrOutOfFocus(this.state)&&this.pauseTimers()}};closeToast=e=>{wY.toast(this.state,e)?.onClose?.();let{limit:t,toasts:n}=this.state,r=0,i=n.map(n=>{if(n.id===e)return{...n,transitionStatus:`ending`,height:0};if(n.transitionStatus===`ending`)return n;let i=r>=t;return r+=1,n.limited===i?n:{...n,limited:i}}),a=this.timers.get(e);a&&a.timeout&&(a.timeout.clear(),this.timers.delete(e)),this.handleFocusManagement(e),this.setToasts(i)};promiseToast=(e,t)=>{let n=lY(t.loading),r=this.addToast({...n,type:`loading`}),i=e.then(e=>{let n=lY(t.success,e);return this.updateToast(r,{...n,type:`success`,timeout:n.timeout}),e}).catch(e=>{let n=lY(t.error,e);return this.updateToast(r,{...n,type:`error`,timeout:n.timeout}),Promise.reject(e)});return{}.hasOwnProperty.call(t,`setPromise`)&&t.setPromise(i),i};pauseTimers(){this.areTimersPaused||(this.areTimersPaused=!0,this.timers.forEach(e=>{if(e.timeout){e.timeout.clear();let t=Date.now()-e.start,n=e.delay-t;e.remaining=n>0?n:0}}))}resumeTimers(){this.areTimersPaused&&(this.areTimersPaused=!1,this.timers.forEach((e,t)=>{e.remaining=e.remaining>0?e.remaining:e.delay,e.timeout??=iY.create(),e.timeout.start(e.remaining,()=>{this.timers.delete(t),e.callback()}),e.start=Date.now()}))}restoreFocusToPrevElement(){this.state.prevFocusElement?.focus({preventScroll:!0})}handleDocumentPointerDown=e=>{if(e.pointerType!==`touch`)return;let t=xY(e);bY(this.state.viewport,t)||(this.resumeTimers(),this.update({hovering:!1,focused:!1}))};scheduleTimer(e,t,n){let r=Date.now(),i=!wY.expandedOrOutOfFocus(this.state),a=i?iY.create():void 0;a?.start(t,()=>{this.timers.delete(e),n()}),this.timers.set(e,{timeout:a,start:i?r:0,delay:t,remaining:t,callback:n})}setToasts(e){let t={toasts:e};e.length===0&&(t.hovering=!1,t.focused=!1),this.update(t)}handleFocusManagement(e){let t=yY(cY(this.state.viewport));if(!this.state.viewport||!bY(this.state.viewport,t)||!SY(t))return;let n=wY.toasts(this.state),r=wY.toastIndex(this.state,e),i=null,a=r+1;for(;a<n.length;){if(n[a].transitionStatus!==`ending`){i=n[a];break}a+=1}if(!i)for(a=r-1;a>=0;){if(n[a].transitionStatus!==`ending`){i=n[a];break}--a}i?i.ref?.current?.focus():this.restoreFocusToPrevElement()}},EY=function(e){let{children:t,timeout:n=5e3,limit:r=3,toastManager:i}=e,a=xK(()=>new TY({timeout:n,limit:r,viewport:null,toasts:[],hovering:!1,focused:!1,isWindowFocused:!0,prevFocusElement:null})).current;return lJ(a.disposeEffect),x.useEffect(function(){if(i)return i[` subscribe`](({action:e,options:t})=>{let n=t.id;e===`promise`&&t.promise?a.promiseToast(t.promise,t):e===`update`&&n?a.updateToast(n,t):e===`close`&&n?a.closeToast(n):a.addToast(t)})},[a,n,i]),a.useSyncedValues({timeout:n,limit:r}),(0,G.jsx)(uJ.Provider,{value:a,children:t})},DY=x.forwardRef(function(e,t){let[n,r]=x.useState();NK(()=>{mY&&r(`button`)},[]);let i={tabIndex:0,role:n};return(0,G.jsx)(`span`,{...e,ref:t,style:FK,"aria-hidden":n?void 0:!0,...i,"data-base-ui-focus-guard":``})}),OY=function(e){return e.frontmostHeight=`--toast-frontmost-height`,e}({}),kY=x.forwardRef(function(e,t){let{render:n,className:r,children:i,...a}=e,o=dJ(),s=aY(),c=x.useRef(!1),l=x.useRef(!1),u=o.useState(`isEmpty`),d=o.useState(`toasts`),f=o.useState(`focused`),p=o.useState(`expanded`),m=o.useState(`prevFocusElement`),h=d[0]?.height??0,g=x.useMemo(()=>d.some(e=>e.transitionStatus===`ending`),[d]);x.useEffect(()=>{let e=o.state.viewport;if(!e)return;function t(t){u||t.key===`F6`&&t.target!==e&&(t.preventDefault(),o.setPrevFocusElement(yY(cY(e))),e?.focus({preventScroll:!0}),o.pauseTimers(),o.setFocused(!0))}let n=_q(e);return n.addEventListener(`keydown`,t),()=>{n.removeEventListener(`keydown`,t)}},[o,u]),x.useEffect(()=>{let e=o.state.viewport;if(!e||u)return;let t=_q(e);function n(e){e.target===t&&(o.setIsWindowFocused(!1),o.pauseTimers())}function r(n){if(n.relatedTarget||n.target===t)return;let r=xY(n),i=yY(cY(e));(!bY(e,r)||!SY(i))&&o.resumeTimers(),s.start(0,()=>o.setIsWindowFocused(!0))}return t.addEventListener(`blur`,n,!0),t.addEventListener(`focus`,r,!0),()=>{t.removeEventListener(`blur`,n,!0),t.removeEventListener(`focus`,r,!0)}},[o,s,u]),x.useEffect(()=>{let e=o.state.viewport;if(!e||u)return;let t=cY(e);return t.addEventListener(`pointerdown`,o.handleDocumentPointerDown,!0),()=>{t.removeEventListener(`pointerdown`,o.handleDocumentPointerDown,!0)}},[u,o]);function _(e){let t=o.state.viewport;t&&(c.current=!0,e.relatedTarget===t?d[0]?.ref?.current?.focus():o.restoreFocusToPrevElement())}function v(e){e.key===`Tab`&&e.shiftKey&&e.target===o.state.viewport&&(e.preventDefault(),o.restoreFocusToPrevElement(),o.resumeTimers())}x.useEffect(()=>{!o.state.isWindowFocused||g||!l.current||(o.resumeTimers(),o.setHovering(!1),l.current=!1)},[g,o]);function y(){o.pauseTimers(),o.setHovering(!0),l.current=!1}function b(){g?l.current=!0:(o.resumeTimers(),o.setHovering(!1))}function S(){if(c.current){c.current=!1;return}f||SY(cY(o.state.viewport).activeElement)&&(o.setFocused(!0),o.pauseTimers())}function C(e){!f||bY(o.state.viewport,e.relatedTarget)||(o.setFocused(!1),o.resumeTimers())}let w={tabIndex:-1,role:`region`,"aria-live":`polite`,"aria-atomic":!1,"aria-relevant":`additions text`,"aria-label":`Notifications`,onMouseEnter:y,onMouseMove:y,onMouseLeave:b,onFocus:S,onBlur:C,onKeyDown:v,onClick:S},T={expanded:p},E=aq(`div`,e,{ref:[t,o.setViewport],state:T,props:[w,{style:{[OY.frontmostHeight]:h?`${h}px`:void 0}},a,{children:(0,G.jsxs)(x.Fragment,{children:[!u&&m&&(0,G.jsx)(DY,{onFocus:_}),i,!u&&m&&(0,G.jsx)(DY,{onFocus:_})]})}]}),D=x.useMemo(()=>d.filter(e=>e.priority===`high`),[d]);return(0,G.jsxs)(x.Fragment,{children:[!u&&m&&(0,G.jsx)(DY,{onFocus:_}),E,!f&&D.length>0&&(0,G.jsx)(`div`,{style:FK,children:D.map(e=>(0,G.jsxs)(`div`,{role:`alert`,"aria-atomic":!0,children:[(0,G.jsx)(`div`,{children:e.title}),(0,G.jsx)(`div`,{children:e.description})]},e.id))})]})});function AY(e){return VK(19)?e:e?`true`:void 0}var jY=x.createContext(void 0);function MY(){let e=x.useContext(jY);if(!e)throw Error(zK(66));return e}var NY=function(e){return e.startingStyle=`data-starting-style`,e.endingStyle=`data-ending-style`,e}({}),PY={[NY.startingStyle]:``},FY={[NY.endingStyle]:``},IY={transitionStatus(e){return e===`starting`?PY:e===`ending`?FY:null}};function LY(e){return e==null?e:`current`in e?e.current:e}function RY(e,t=!1,n=!0){let r=nY();return wK((i,a=null)=>{r.cancel();function o(){re.flushSync(i)}let s=LY(e);if(s==null)return;let c=s;if(typeof c.getAnimations!=`function`||globalThis.BASE_UI_ANIMATIONS_DISABLED)i();else{function e(){let e=NY.startingStyle;if(!c.hasAttribute(e)){r.request(i);return}let t=new MutationObserver(()=>{c.hasAttribute(e)||(t.disconnect(),i())});t.observe(c,{attributes:!0,attributeFilter:[e]}),a?.addEventListener(`abort`,()=>t.disconnect(),{once:!0})}function i(){Promise.all(c.getAnimations().map(e=>e.finished)).then(()=>{a?.aborted||o()}).catch(()=>{let e=c.getAnimations();if(n){if(a?.aborted)return;o()}else e.length>0&&e.some(e=>e.pending||e.playState!==`finished`)&&i()})}if(t){e();return}r.request(i)}})}function zY(e){let{enabled:t=!0,open:n,ref:r,onComplete:i}=e,a=wK(i),o=RY(r,n,!1);x.useEffect(()=>{if(!t)return;let e=new AbortController;return o(a,e.signal),()=>{e.abort()}},[t,n,a,o])}var BY=function(e){return e.index=`--toast-index`,e.offsetY=`--toast-offset-y`,e.height=`--toast-height`,e.swipeMovementX=`--toast-swipe-movement-x`,e.swipeMovementY=`--toast-swipe-movement-y`,e}({}),VY={...IY,swipeDirection(e){return e?{"data-swipe-direction":e}:null}},HY=40,UY=10,WY=.5,GY=1;function KY(e,t,n){switch(e){case`up`:return-n;case`down`:return n;case`left`:return-t;case`right`:return t;default:return 0}}function qY(e){let t=window.getComputedStyle(e).transform,n=0,r=0,i=1;if(t&&t!==`none`){let e=t.match(/matrix(?:3d)?\(([^)]+)\)/);if(e){let t=e[1].split(`, `).map(parseFloat);t.length===6?(n=t[4],r=t[5],i=Math.sqrt(t[0]*t[0]+t[1]*t[1])):t.length===16&&(n=t[12],r=t[13],i=t[0])}}return{x:n,y:r,scale:i}}var JY=x.forwardRef(function(e,t){let{toast:n,render:r,className:i,swipeDirection:a=[`down`,`right`],...o}=e,s=n.positionerProps?.anchor!==void 0,c=[];s||(c=Array.isArray(a)?a:[a]);let l=c.length>0,u=dJ(),[d,f]=x.useState(void 0),[p,m]=x.useState(!1),[h,g]=x.useState(!1),[_,v]=x.useState(!1),[y,b]=x.useState({x:0,y:0}),[S,C]=x.useState({x:0,y:0,scale:1}),[w,T]=x.useState(),[E,D]=x.useState(),[O,k]=x.useState(null),A=x.useRef(null),j=x.useRef({x:0,y:0}),M=x.useRef({x:0,y:0,scale:1}),N=x.useRef(void 0),P=x.useRef(0),F=x.useRef(!1),I=x.useRef({x:0,y:0}),L=x.useRef(!1),R=u.useState(`toastIndex`,n.id),z=u.useState(`toastVisibleIndex`,n.id),B=u.useState(`toastOffsetY`,n.id),V=u.useState(`focused`),ee=u.useState(`expanded`);zY({open:n.transitionStatus!==`ending`,ref:A,onComplete(){n.transitionStatus===`ending`&&u.removeToast(n.id)}});let H=wK((e=!1)=>{let t=A.current;if(!t)return;let r=t.style.height;t.style.height=`auto`;let i=t.offsetHeight;t.style.height=r;function a(){u.updateToastInternal(n.id,{ref:A,height:i,...n.transitionStatus===`starting`?{transitionStatus:void 0}:{}})}e?re.flushSync(a):a()});NK(H,[H]);function te(e,t){let n=e,r=t;return!c.includes(`left`)&&!c.includes(`right`)?n=e>0?e**WY:-(Math.abs(e)**WY):(!c.includes(`right`)&&e>0&&(n=e**WY),!c.includes(`left`)&&e<0&&(n=-(Math.abs(e)**WY))),!c.includes(`up`)&&!c.includes(`down`)?r=t>0?t**WY:-(Math.abs(t)**WY):(!c.includes(`down`)&&t>0&&(r=t**WY),!c.includes(`up`)&&t<0&&(r=-(Math.abs(t)**WY))),{x:n,y:r}}function U(e){if(e.button!==0)return;e.pointerType===`touch`&&u.pauseTimers();let t=xY(e.nativeEvent);if(!(t&&t.closest(`button,a,input,textarea,[role="button"],[data-swipe-ignore]`))){if(F.current=!1,N.current=void 0,P.current=0,j.current={x:e.clientX,y:e.clientY},I.current=j.current,A.current){let e=qY(A.current);M.current=e,C(e),b({x:e.x,y:e.y})}u.setHovering(!0),m(!0),g(!1),k(null),L.current=!0,A.current?.setPointerCapture(e.pointerId)}}function ne(e){if(!p)return;e.preventDefault(),L.current&&=(j.current={x:e.clientX,y:e.clientY},!1);let{clientY:t,clientX:n,movementX:r,movementY:i}=e;(i<0&&t>I.current.y||i>0&&t<I.current.y)&&(I.current={x:I.current.x,y:t}),(r<0&&n>I.current.x||r>0&&n<I.current.x)&&(I.current={x:n,y:I.current.y});let a=n-j.current.x,o=t-j.current.y,s=t-I.current.y,l=n-I.current.x;if(!h&&Math.sqrt(a*a+o*o)>=GY&&(g(!0),O===null)){let e=c.includes(`left`)||c.includes(`right`),t=c.includes(`up`)||c.includes(`down`);e&&t&&k(Math.abs(a)>Math.abs(o)?`horizontal`:`vertical`)}let u;if(!N.current)O===`vertical`?o>0?u=`down`:o<0&&(u=`up`):O===`horizontal`?a>0?u=`right`:a<0&&(u=`left`):u=Math.abs(a)>=Math.abs(o)?a>0?`right`:`left`:o>0?`down`:`up`,u&&c.includes(u)&&(N.current=u,P.current=KY(u,a,o),f(u));else{let e=N.current,t=KY(e,l,s);t>HY?(F.current=!1,f(e)):!(c.includes(`left`)&&c.includes(`right`))&&!(c.includes(`up`)&&c.includes(`down`))&&P.current-t>=UY&&(F.current=!0)}let d=te(a,o),m=M.current.x,_=M.current.y;O===`horizontal`?(c.includes(`left`)||c.includes(`right`))&&(m+=d.x):(O===`vertical`||(c.includes(`left`)||c.includes(`right`))&&(m+=d.x),(c.includes(`up`)||c.includes(`down`))&&(_+=d.y)),b({x:m,y:_})}function ie(e){if(!p)return;if(m(!1),g(!1),k(null),A.current?.releasePointerCapture(e.pointerId),F.current){b({x:S.x,y:S.y}),f(void 0);return}let t=!1,r=y.x-S.x,i=y.y-S.y,a;for(let e of c){switch(e){case`right`:r>HY&&(t=!0,a=`right`);break;case`left`:r<-HY&&(t=!0,a=`left`);break;case`down`:i>HY&&(t=!0,a=`down`);break;case`up`:i<-HY&&(t=!0,a=`up`);break;default:break}if(t)break}t?(f(a),v(!0),u.closeToast(n.id)):(b({x:S.x,y:S.y}),f(void 0))}function ae(e){if(e.key===`Escape`){if(!A.current||!bY(A.current,yY(cY(A.current))))return;u.closeToast(n.id)}}x.useEffect(()=>{if(!l)return;let e=A.current;if(!e)return;function t(t){bY(e,t.target)&&t.preventDefault()}return e.addEventListener(`touchmove`,t,{passive:!1}),()=>{e.removeEventListener(`touchmove`,t)}},[l]);function W(){if(!p&&y.x===S.x&&y.y===S.y&&!_)return{[BY.swipeMovementX]:`0px`,[BY.swipeMovementY]:`0px`};let e=y.x-S.x,t=y.y-S.y;return{transition:p?`none`:void 0,transform:p?`translateX(${y.x}px) translateY(${y.y}px) scale(${S.scale})`:void 0,[BY.swipeMovementX]:`${e}px`,[BY.swipeMovementY]:`${t}px`}}let oe=n.priority===`high`,se={role:oe?`alertdialog`:`dialog`,tabIndex:0,"aria-modal":!1,"aria-labelledby":w,"aria-describedby":E,"aria-hidden":oe&&!V?!0:void 0,onPointerDown:l?U:void 0,onPointerMove:l?ne:void 0,onPointerUp:l?ie:void 0,onKeyDown:ae,inert:AY(n.limited),style:{...W(),[BY.index]:n.transitionStatus===`ending`?R:z,[BY.offsetY]:`${B}px`,[BY.height]:n.height?`${n.height}px`:void 0}},ce=x.useMemo(()=>({rootRef:A,toast:n,titleId:w,setTitleId:T,descriptionId:E,setDescriptionId:D,swiping:p,swipeDirection:d,recalculateHeight:H,index:R,visibleIndex:z,expanded:ee}),[n,w,E,p,d,H,R,z,ee]),le={transitionStatus:n.transitionStatus,expanded:ee,limited:n.limited||!1,type:n.type,swiping:ce.swiping,swipeDirection:ce.swipeDirection},ue=aq(`div`,e,{ref:[t,ce.rootRef],state:le,stateAttributesMapping:VY,props:[se,o]});return(0,G.jsx)(jY.Provider,{value:ce,children:ue})}),YY=x.forwardRef(function(e,t){let{render:n,className:r,id:i,children:a,...o}=e,{toast:s,setDescriptionId:c}=MY(),l=a??s.description,u=!!l,d=mq(i);NK(()=>{if(u)return c(d),()=>{c(void 0)}},[u,d,c]);let f=aq(`p`,e,{ref:t,state:{type:s.type},props:{...o,id:d,children:l}});return u?f:null}),XY=x.forwardRef(function(e,t){let{render:n,className:r,id:i,children:a,...o}=e,{toast:s,setTitleId:c}=MY(),l=a??s.title,u=!!l,d=mq(i);NK(()=>{if(u)return c(d),()=>{c(void 0)}},[u,d,c]);let f=aq(`h2`,e,{ref:t,state:{type:s.type},props:{...o,id:d,children:l}});return u?f:null}),ZY=x.forwardRef(function(e,t){let{render:n,className:r,disabled:i,nativeButton:a=!0,...o}=e,s=dJ(),{toast:c}=MY(),l=s.useState(`expanded`),[u,d]=x.useState(!1),{getButtonProps:f,buttonRef:p}=wq({disabled:i,native:a}),m={type:c.type};return aq(`button`,e,{ref:[t,p],state:m,props:[{"aria-hidden":!l&&!u,onClick(){s.closeToast(c.id)},onFocus(){d(!0)},onBlur(){d(!1)}},o,f]})});function QY(){let e=x.useContext(uJ);if(!e)throw Error(zK(73));let t=e.useState(`toasts`);return x.useMemo(()=>({toasts:t,add:e.addToast,close:e.closeToast,update:e.updateToast,promise:e.promiseToast}),[t,e])}function $Y(){let e=new Set;function t(t){e.forEach(e=>e(t))}return{" subscribe":function(t){return e.add(t),()=>{e.delete(t)}},add(e){let n=e.id||sY(`toast`);return t({action:`add`,options:{...e,id:n,transitionStatus:`starting`}}),n},close(e){t({action:`close`,options:{id:e}})},update(e,n){t({action:`update`,options:{...n,id:e}})},promise(e,n){let r=e;return t({action:`promise`,options:{...n,promise:e,setPromise(e){r=e}}}),r}}}var eX=5e3,tX=$Y();function nX({toast:e}){return(0,G.jsxs)(JY,{toast:e,className:kg(`relative flex w-80 items-start gap-3 border bg-elevated p-4 shadow-lg`,`data-[swipe=move]:translate-x-[var(--toast-swipe-move-x)]`,`data-[ending-style]:translate-x-[var(--toast-swipe-end-x)]`,`data-[ending-style]:opacity-0`,`data-[starting-style]:translate-y-2 data-[starting-style]:opacity-0`,`transition-all duration-200`,e.type===`error`&&`border-error/50`,e.type===`success`&&`border-approval/50`,(!e.type||e.type===`info`)&&`border-border`),children:[(0,G.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,G.jsx)(XY,{className:kg(`text-sm font-medium`,e.type===`error`&&`text-error`,e.type===`success`&&`text-approval`,(!e.type||e.type===`info`)&&`text-primary`),children:e.title}),e.description&&(0,G.jsx)(YY,{className:`mt-1 text-xs text-muted line-clamp-2`,children:e.description})]}),(0,G.jsx)(ZY,{className:`shrink-0 text-muted hover:text-primary transition-colors`,"aria-label":`Close`,children:(0,G.jsxs)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:`16`,height:`16`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,G.jsx)(`line`,{x1:`18`,y1:`6`,x2:`6`,y2:`18`}),(0,G.jsx)(`line`,{x1:`6`,y1:`6`,x2:`18`,y2:`18`})]})})]})}function rX(){let{toasts:e}=QY();return(0,G.jsx)(G.Fragment,{children:e.map(e=>(0,G.jsx)(nX,{toast:e},e.id))})}function iX(){return(0,G.jsxs)(EY,{timeout:eX,toastManager:tX,children:[(0,G.jsx)(rX,{}),(0,G.jsx)(kY,{className:`fixed bottom-4 right-4 z-[100] flex flex-col gap-2`})]})}var aX=[`CONNECTING`,`OPEN`,`CLOSING`,`CLOSED`],oX=3e3,sX=8e3,cX=15e3,lX=5e3,uX=2e4,dX=1e4,fX=1500,pX=5e3,mX=750,hX=4,gX=5e3,_X=new class{constructor(){this.ws=null,this.listeners=new Set,this.statusListeners=new Set,this.status=`connecting`,this.error=null,this.reconnectAttempts=0,this.reconnectTimer=null,this.connectTimer=null,this.manualClose=!1,this.lastTick=Date.now(),this.wakeCheckInterval=null,this.lifecycleStarted=!1,this.heartbeatTimer=null,this.pongTimer=null,this.lastForceReconnectTs=0,this.lastConnectTs=0,this.pingSeq=0,this.connectionEpoch=0,this.consecutiveFailures=0,this.stallCount=0,this.isResumeAttempt=!1,this.leakedSockets=new Set,this.verifyTimer=null,this.onVisibilityChange=()=>{if(XD(`ws_visibility`,{state:document.visibilityState,...this.wsSnap()},`info`),document.visibilityState===`visible`){let e=Date.now(),t=e-this.lastTick;this.lastTick=e,XD(`ws_resume`,{gapMs:t,...this.wsSnap()},`info`),this.ws?.readyState===WebSocket.OPEN?this.verifyConnection():this.forceReconnect(`visibilitychange`,!0)}else this.stopHeartbeat(),this.cancelVerify(),this.reconnectTimer&&=(window.clearTimeout(this.reconnectTimer),null)},this.onPageShow=e=>{XD(`ws_pageshow`,{persisted:e.persisted,...this.wsSnap()},`info`),e.persisted&&(this.lastTick=Date.now(),this.forceReconnect(`pageshow`,!0))}}wsSnap(){return{status:this.status,ws:this.ws?aX[this.ws.readyState]:null,attempt:this.reconnectAttempts,failures:this.consecutiveFailures,stalls:this.stallCount,leaked:this.leakedSockets.size,online:typeof navigator<`u`?navigator.onLine:void 0,verifying:this.verifyTimer!==null,buffered:this.ws?this.ws.bufferedAmount:void 0}}connect(){if(this.ws){let e=this.ws.readyState===WebSocket.OPEN;if(e&&this.status===`connected`){XD(`ws_connect_skip`,{reason:`already_open`,...this.wsSnap()});return}let t=Date.now();if(this.ws.readyState===WebSocket.CONNECTING&&t-this.lastConnectTs<200){XD(`ws_connect_skip`,{reason:`already_connecting`,...this.wsSnap()});return}XD(`ws_connect_destroy_zombie`,{reason:e?`open_desynced`:`not_open`,...this.wsSnap()}),this.destroySocket()}this.manualClose=!1,this.clearConnectTimer(),this.setStatus(`connecting`);let e=`${window.location.protocol===`https:`?`wss`:`ws`}://${window.location.host}/ws`;XD(`ws_connect`,{url:e,resume:this.isResumeAttempt,...this.wsSnap()},`info`);let t=new WebSocket(e);this.ws=t,this.lastConnectTs=Date.now(),this.leakedSockets.add(t);let n=this.isResumeAttempt?sX:oX;this.isResumeAttempt=!1,this.connectTimer=window.setTimeout(()=>{this.ws===t&&(this.connectTimer=null,t.readyState===WebSocket.OPEN&&this.status===`connected`||(XD(`ws_connect_timeout`,{wsState:aX[t.readyState],managerStatus:this.status,timeoutMs:n,...this.wsSnap()},`info`),this.consecutiveFailures+=1,this.destroySocket(),this.scheduleReconnect()))},n),t.onopen=()=>{if(this.ws!==t){XD(`ws_onopen_stale`,this.wsSnap(),`info`);return}XD(`ws_onopen`,this.wsSnap(),`info`),this.clearConnectTimer(),this.reconnectAttempts=0,this.consecutiveFailures=0,this.stallCount=0,this.connectionEpoch+=1,this.leakedSockets.delete(t),this.setStatus(`connected`),this.startHeartbeat()},t.onmessage=e=>{try{let t=e.data,n=performance.now(),r=JSON.parse(t),i=performance.now()-n,a=r;if(a._parseMs=Math.round(i),a._rawLength=t.length,r.type===`pong`){r.seq===this.pingSeq&&(this.clearPongTimer(),this.verifyTimer!==null&&(this.cancelVerify(),XD(`ws_verify_ok`,this.wsSnap(),`info`),this.startHeartbeat(pX)));return}this.listeners.forEach(e=>e(r))}catch{}},t.onerror=()=>{this.ws===t&&(XD(`ws_onerror`,this.wsSnap(),`info`),this.clearConnectTimer())},t.onclose=e=>{if(this.ws!==t){XD(`ws_onclose_stale`,{code:e.code,...this.wsSnap()},`info`);return}XD(`ws_onclose`,{code:e.code,reason:e.reason,clean:e.wasClean,...this.wsSnap()},`info`),this.clearConnectTimer(),this.cancelVerify(),this.consecutiveFailures+=1,this.ws=null,this.manualClose?this.setStatus(`disconnected`):this.scheduleReconnect()}}disconnect(){this.manualClose=!0,this.clearConnectTimer(),this.cancelVerify(),this.reconnectTimer&&=(window.clearTimeout(this.reconnectTimer),null),this.destroySocket(),this.setStatus(`disconnected`)}startLifecycleListeners(){this.lifecycleStarted||typeof document>`u`||typeof window>`u`||(this.lifecycleStarted=!0,document.addEventListener(`visibilitychange`,this.onVisibilityChange),window.addEventListener(`pageshow`,this.onPageShow),this.lastTick=Date.now(),this.wakeCheckInterval=window.setInterval(()=>{let e=Date.now(),t=e-this.lastTick;this.isHidden()||(t>cX&&(XD(`ws_time_jump`,{gapMs:t,...this.wsSnap()},`info`),this.forceReconnect(`time_jump`,!0)),this.lastTick=e)},lX))}stopLifecycleListeners(){this.lifecycleStarted&&(this.lifecycleStarted=!1,document.removeEventListener(`visibilitychange`,this.onVisibilityChange),window.removeEventListener(`pageshow`,this.onPageShow),this.wakeCheckInterval!==null&&(window.clearInterval(this.wakeCheckInterval),this.wakeCheckInterval=null))}send(e){if(this.ws?.readyState!==WebSocket.OPEN)return!1;try{return this.ws.send(JSON.stringify(e)),!0}catch(t){return XD(`ws_send_error`,{messageType:e.type,error:t instanceof Error?t.message:String(t),...this.wsSnap()},`info`),this.destroySocket(),this.scheduleReconnect(),!1}}subscribe(e){return this.listeners.add(e),()=>this.listeners.delete(e)}subscribeStatus(e){return this.statusListeners.add(e),e(this.status,this.error,this.connectionEpoch),()=>this.statusListeners.delete(e)}getStatus(){return this.status}getConnectionEpoch(){return this.connectionEpoch}verifyConnection(){this.cancelVerify(),this.stopHeartbeat(),this.pingSeq+=1;let e=this.pingSeq,t=this.ws;if(XD(`ws_verify`,{seq:e,...this.wsSnap()},`info`),!this.send({type:`ping`,seq:e})){XD(`ws_verify_send_fail`,this.wsSnap(),`info`),this.forceReconnect(`verify_send_fail`,!0);return}this.verifyTimer=window.setTimeout(()=>{this.verifyTimer=null,this.ws===t&&(XD(`ws_verify_timeout`,this.wsSnap(),`info`),this.forceReconnect(`verify_timeout`,!0))},fX)}cancelVerify(){this.verifyTimer!==null&&(window.clearTimeout(this.verifyTimer),this.verifyTimer=null)}forceReconnect(e=`unknown`,t=!1){if(this.manualClose){XD(`ws_force_skip`,{trigger:e,reason:`manual_close`});return}let n=Date.now(),r=t?200:500;if(n-this.lastForceReconnectTs<r){XD(`ws_force_skip`,{trigger:e,reason:`debounce`,force:t});return}if(!t&&this.ws?.readyState===WebSocket.OPEN&&this.status===`connected`){XD(`ws_force_skip`,{trigger:e,reason:`already_connected`});return}this.lastForceReconnectTs=n,XD(`ws_force_reconnect`,{trigger:e,force:t,...this.wsSnap()},`info`),this.reconnectAttempts=0,this.consecutiveFailures=0,this.stallCount=0,this.reconnectTimer&&=(window.clearTimeout(this.reconnectTimer),null),this.destroySocket(),t?(this.purgeLeakedSockets(),this.isResumeAttempt=!0,this.setStatus(`reconnecting`),this.reconnectTimer=window.setTimeout(()=>{this.reconnectTimer=null,this.connect()},mX)):this.connect()}startHeartbeat(e){this.stopHeartbeat();let t=()=>{this.ws?.readyState===WebSocket.OPEN&&(this.pingSeq+=1,this.send({type:`ping`,seq:this.pingSeq})&&(this.clearPongTimer(),this.pongTimer=window.setTimeout(()=>{this.pongTimer=null,XD(`ws_pong_timeout`,this.wsSnap(),`info`),this.destroySocket(),this.scheduleReconnect()},dX)))};e!==void 0&&e<uX?this.heartbeatTimer=window.setTimeout(()=>{t(),this.heartbeatTimer=window.setInterval(t,uX)},e):this.heartbeatTimer=window.setInterval(t,uX)}stopHeartbeat(){this.heartbeatTimer!==null&&(window.clearTimeout(this.heartbeatTimer),this.heartbeatTimer=null),this.clearPongTimer()}clearPongTimer(){this.pongTimer!==null&&(window.clearTimeout(this.pongTimer),this.pongTimer=null)}setStatus(e,t=null){this.status=e,this.error=t,this.statusListeners.forEach(n=>n(e,t,this.connectionEpoch))}scheduleReconnect(){if(this.stopHeartbeat(),this.isHidden()){XD(`ws_schedule_skip`,{reason:`hidden`,...this.wsSnap()}),this.setStatus(`reconnecting`);return}if(this.consecutiveFailures>=hX){XD(`ws_stall_detected`,this.wsSnap(),`info`),this.purgeLeakedSockets();let e=Math.min(gX*2**this.stallCount,3e4);this.stallCount+=1,this.consecutiveFailures=0,this.reconnectAttempts=0,this.isResumeAttempt=!0,this.setStatus(`reconnecting`),this.reconnectTimer=window.setTimeout(()=>{this.reconnectTimer=null,this.connect()},e);return}this.reconnectAttempts+=1;let e=Math.min(1e3*2**(this.reconnectAttempts-1),3e4);XD(`ws_schedule_reconnect`,{delay:e,...this.wsSnap()}),this.setStatus(`reconnecting`),this.reconnectTimer&&window.clearTimeout(this.reconnectTimer),this.reconnectTimer=window.setTimeout(()=>{this.reconnectTimer=null,this.connect()},e)}isHidden(){return typeof document<`u`&&document.visibilityState===`hidden`}clearConnectTimer(){this.connectTimer&&=(window.clearTimeout(this.connectTimer),null)}destroySocket(){if(this.clearConnectTimer(),this.stopHeartbeat(),this.cancelVerify(),!this.ws)return;let e=this.ws;this.ws=null,this.leakedSockets.add(e),e.onopen=null,e.onmessage=null,e.onerror=null,e.onclose=null;try{e.close()}catch{}}purgeLeakedSockets(){if(this.leakedSockets.size!==0){XD(`ws_purge_leaked`,{count:this.leakedSockets.size},`info`);for(let e of this.leakedSockets)try{e.onopen=null,e.onmessage=null,e.onerror=null,e.onclose=null,e.close()}catch{}this.leakedSockets.clear()}}};function vX(){let e=Jm(e=>e.setConnectionState);return(0,x.useEffect)(()=>{_X.connect(),_X.startLifecycleListeners();let t=_X.subscribeStatus((t,n,r)=>{e(t,n,r)});return()=>{t(),_X.stopLifecycleListeners()}},[e]),{sendMessage:(0,x.useMemo)(()=>e=>{_X.send(e)},[]),subscribe:(0,x.useMemo)(()=>_X.subscribe.bind(_X),[]),getConnectionEpoch:(0,x.useMemo)(()=>()=>_X.getConnectionEpoch(),[])}}var yX=100;function bX({viewport:e,win:t,doc:n}){if(!e)return!1;let r=Math.max(0,e.offsetTop||0),i=Math.max(0,e.offsetLeft||0),a=t.innerHeight-(e.height+r),o=Math.max(0,a),s=Math.max(0,e.height||0),c=Math.max(0,e.width||0);return n.documentElement.style.setProperty(`--keyboard-inset`,`${o}px`),n.documentElement.style.setProperty(`--viewport-offset-top`,`${r}px`),n.documentElement.style.setProperty(`--viewport-offset-left`,`${i}px`),n.documentElement.style.setProperty(`--visual-viewport-height`,`${s}px`),n.documentElement.style.setProperty(`--visual-viewport-width`,`${c}px`),o>yX?n.documentElement.classList.add(`keyboard-visible`):n.documentElement.classList.remove(`keyboard-visible`),!0}function xX(e){e.documentElement.style.removeProperty(`--keyboard-inset`),e.documentElement.style.removeProperty(`--viewport-offset-top`),e.documentElement.style.removeProperty(`--viewport-offset-left`),e.documentElement.style.removeProperty(`--visual-viewport-height`),e.documentElement.style.removeProperty(`--visual-viewport-width`),e.documentElement.classList.remove(`keyboard-visible`)}function SX(){(0,x.useEffect)(()=>{let e=window.visualViewport;if(!e)return;let t=null,n=null,r=()=>{let e=document.activeElement;if(!e)return!1;let t=e.tagName?.toLowerCase();return t===`input`||t===`textarea`?!0:!!e.isContentEditable},i=()=>{bX({viewport:e,win:window,doc:document})},a=()=>{if(typeof window.requestAnimationFrame!=`function`){i();return}t!==null&&window.cancelAnimationFrame(t);let e=performance.now(),n=()=>{i(),t=performance.now()-e<1500?window.requestAnimationFrame(n):null};t=window.requestAnimationFrame(n)},o=()=>{if(!r()){c();return}i()},s=()=>{n!==null||typeof window.setInterval!=`function`||(n=window.setInterval(o,250),o())},c=()=>{n===null||typeof window.clearInterval!=`function`||(window.clearInterval(n),n=null)},l=()=>{r()?(a(),s(),i()):c()},u=()=>{l()},d=()=>{l()},f=()=>{a()};return i(),l(),e.addEventListener(`resize`,i),e.addEventListener(`scroll`,i),typeof window.addEventListener==`function`&&(window.addEventListener(`resize`,i),window.addEventListener(`orientationchange`,f)),typeof document.addEventListener==`function`&&(document.addEventListener(`focusin`,u),document.addEventListener(`focusout`,d),document.addEventListener(`focus`,u,!0),document.addEventListener(`blur`,d,!0)),()=>{e.removeEventListener(`resize`,i),e.removeEventListener(`scroll`,i),typeof window.removeEventListener==`function`&&(window.removeEventListener(`resize`,i),window.removeEventListener(`orientationchange`,f)),typeof document.removeEventListener==`function`&&(document.removeEventListener(`focusin`,u),document.removeEventListener(`focusout`,d),document.removeEventListener(`focus`,u,!0),document.removeEventListener(`blur`,d,!0)),t!==null&&typeof window.cancelAnimationFrame==`function`&&window.cancelAnimationFrame(t),c(),xX(document)}},[])}var CX=[`theme`,`commandPresets`,`defaultPresetId`,`defaultProjectDir`,`lastProjectPath`,`recentPaths`,`sessionSortMode`,`sessionSortDirection`,`manualSessionOrder`,`projectFilters`,`hostFilters`],wX=[`claude`,`claude-rp`,`codex`,`pi`,`devin`,`grok`,`omp`];function TX(e,t){return Array.isArray(e)&&e.length<=t&&e.every(e=>typeof e==`string`)}function EX(e){if(typeof e!=`object`||!e)return!1;let t=e;return typeof t.id==`string`&&t.id.length>=1&&t.id.length<=128&&typeof t.label==`string`&&t.label.trim().length>=1&&t.label.length<=64&&typeof t.command==`string`&&t.command.trim().length>=1&&t.command.length<=1024&&typeof t.isBuiltIn==`boolean`&&(t.agentType===void 0||wX.includes(t.agentType))}var DX={theme:e=>e===`dark`||e===`light`,commandPresets:e=>Array.isArray(e)&&e.length<=50&&e.every(EX),defaultPresetId:e=>typeof e==`string`&&e.length<=128,defaultProjectDir:e=>typeof e==`string`&&e.length<=4096,lastProjectPath:e=>e===null||typeof e==`string`&&e.length<=4096,recentPaths:e=>TX(e,50),sessionSortMode:e=>e===`status`||e===`created`||e===`manual`,sessionSortDirection:e=>e===`asc`||e===`desc`,manualSessionOrder:e=>TX(e,1e3),projectFilters:e=>TX(e,500),hostFilters:e=>TX(e,500)};function OX(e){return CX.includes(e)}function kX(e,t){return DX[e](t)}var AX=`agentboard-theme`,jX=`agentboard-settings`,MX=200,NX=new Map,PX=new Set,FX=null,IX=!1;function LX(e){return e===`theme`?RW.getState().theme:U.getState()[e]}function RX(e){let t=e===`theme`?AX:jX;return M.getItem(t)!==null}function zX(){if(FX=null,PX.size===0)return;let e={};for(let t of PX){let n=LX(t);e[t]=n,NX.set(t,JSON.stringify(n))}PX.clear();try{fetch(`/api/settings/synced`,{method:`PUT`,headers:{"content-type":`application/json`},body:JSON.stringify({settings:e})}).then(e=>{e.ok||XD(`synced_settings_push_rejected`,{status:e.status},`warn`)}).catch(e=>{XD(`synced_settings_push_failed`,{message:e instanceof Error?e.message:String(e)},`warn`)})}catch(e){XD(`synced_settings_push_failed`,{message:e instanceof Error?e.message:String(e)},`warn`)}}function BX(e){PX.add(e),!FX&&(FX=setTimeout(zX,MX))}function VX(e){let t=new Map;for(let e of CX)t.set(e,RX(e));let n={},r;for(let[t,i]of Object.entries(e))!OX(t)||!kX(t,i)||(NX.set(t,JSON.stringify(i)),t===`theme`?r=i:n[t]=i);r!==void 0&&RW.setState({theme:r}),Object.keys(n).length>0&&U.setState(n);for(let n of CX){if(n in e||!t.get(n))continue;let r=LX(n);kX(n,r)&&NX.get(n)!==JSON.stringify(r)&&BX(n)}}function HX(){if(IX)return()=>{};IX=!0;let e=U.subscribe((e,t)=>{let n=e,r=t;for(let e of CX)e!==`theme`&&n[e]!==r[e]&&NX.get(e)!==JSON.stringify(n[e])&&BX(e)}),t=RW.subscribe((e,t)=>{e.theme!==t.theme&&NX.get(`theme`)!==JSON.stringify(e.theme)&&BX(`theme`)});return()=>{e(),t(),IX=!1,FX&&=(clearTimeout(FX),null),PX.clear(),NX.clear()}}function UX(e,t,n){let r=e;return t.length>0&&(r=r.filter(e=>t.includes(e.projectPath))),n.length>0&&(r=r.filter(e=>n.includes(e.host??``))),r}function WX(){let[e,t]=(0,x.useState)(!1),[n,r]=(0,x.useState)(void 0),[i,a]=(0,x.useState)(void 0),[o,s]=(0,x.useState)(void 0),[c,l]=(0,x.useState)(!1),[u,d]=(0,x.useState)(null),[f,p]=(0,x.useState)(null),[m,h]=(0,x.useState)(null),g=Jm(e=>e.sessions),_=Jm(e=>e.agentSessions),v=Jm(e=>e.agentSessionsEpoch),y=Jm(e=>e.selectedSessionId),b=Jm(e=>e.selectedHibernatingSessionId),S=Jm(e=>e.setSessions),C=Jm(e=>e.setAgentSessions),w=Jm(e=>e.setActiveAgentSessions),T=Jm(e=>e.setHostStatuses),E=Jm(e=>e.updateSession),D=Jm(e=>e.setSelectedSessionId),O=Jm(e=>e.setSelectedHibernatingSessionId),k=Jm(e=>e.hasLoaded),A=Jm(e=>e.connectionStatus),j=Jm(e=>e.connectionError),M=Jm(e=>e.clearExitingSession),N=Jm(e=>e.markSessionExiting),P=Jm(e=>e.setRemoteAllowControl),F=Jm(e=>e.setRemoteAllowAttach),I=Jm(e=>e.setHostLabel),L=Jm(e=>e.setPreferWindowName),R=Jm(e=>e.hostStatuses),z=Jm(e=>e.remoteAllowControl),B=Jm(e=>e.hostLabel),V=RW(e=>e.theme),ee=ne(),H=U(e=>e.defaultProjectDir),te=U(e=>e.commandPresets),ie=U(e=>e.defaultPresetId),ae=U(e=>e.lastProjectPath),W=U(e=>e.setLastProjectPath),oe=U(e=>e.addRecentPath),se=U(e=>e.shortcutModifier),ce=U(e=>e.sidebarWidth),le=U(e=>e.setSidebarWidth),ue=U(e=>e.projectFilters),de=U(e=>e.hostFilters),fe=U(e=>e.soundOnPermission),pe=U(e=>e.soundOnIdle),me=Jm(e=>e.connectionEpoch),{sendMessage:he,subscribe:ge,getConnectionEpoch:_e}=vX();(0,x.useEffect)(()=>HX(),[]),SX(),(0,x.useEffect)(()=>{if(typeof document>`u`||!fe&&!pe)return;let e=!1,t=()=>{e&&!eJ()||(e=!0,nJ())};return document.addEventListener(`click`,t,{passive:!0}),document.addEventListener(`keydown`,t,{passive:!0}),document.addEventListener(`touchstart`,t,{passive:!0}),()=>{document.removeEventListener(`click`,t),document.removeEventListener(`keydown`,t),document.removeEventListener(`touchstart`,t)}},[fe,pe]);let ve=(0,x.useRef)(!1),ye=(0,x.useCallback)(e=>{e.preventDefault(),ve.current=!0,document.body.style.cursor=`col-resize`,document.body.style.userSelect=`none`},[]);(0,x.useEffect)(()=>{if(typeof document>`u`||typeof document.addEventListener!=`function`)return;let e=e=>{if(!ve.current)return;let t=e.clientX;le(Math.max(180,Math.min(400,t)))},t=()=>{ve.current&&(ve.current=!1,document.body.style.cursor=``,document.body.style.userSelect=``)};return document.addEventListener(`mousemove`,e),document.addEventListener(`mouseup`,t),()=>{document.removeEventListener(`mousemove`,e),document.removeEventListener(`mouseup`,t)}},[le]),(0,x.useEffect)(()=>{let e=ge(e=>{if(e.type!==`terminal-output`){if(e.type===`sessions`){let t=Jm.getState().sessions,{soundOnPermission:n,soundOnIdle:r}=U.getState();if(n||r)for(let i of e.sessions){let e=t.find(e=>e.id===i.id);e&&e.status!==i.status&&(e.status!==`permission`&&i.status===`permission`&&n&&aJ(),e.status===`working`&&i.status===`waiting`&&r&&oJ())}if(Fe.current.size>0){let e=_e();for(let[t,n]of Fe.current)n.epoch!==e&&Fe.current.delete(t)}let i=Fe.current.size>0?e.sessions.filter(e=>!Fe.current.has(e.id)):e.sessions,{selectedSessionId:a,selectedHibernatingSessionId:o}=Jm.getState(),s=a!==null&&o===null&&!i.some(e=>e.id===a)?t.find(e=>e.id===a)?.agentSessionId?.trim()??null:null;s&&(je.current=s),S(i);let c=Me.current,{selectedSessionId:l,selectedHibernatingSessionId:u}=Jm.getState(),{projectFilters:d,hostFilters:f}=U.getState();if(c&&l===null&&u===null){let e=i.find(e=>!(e.agentSessionId?.trim()!==c||d.length>0&&!d.includes(e.projectPath)||f.length>0&&!f.includes(e.host??``)));e&&(Me.current=null,D(e.id))}}if(e.type===`host-status`&&T(e.hosts),e.type===`server-config`&&(P(e.remoteAllowControl),F(e.remoteAllowAttach),I(e.hostLabel),L(e.preferWindowName),e.clientLogLevel&&YD(e.clientLogLevel)),e.type===`synced-settings`&&VX(e.settings),e.type===`session-update`){let t=Jm.getState().sessions.find(t=>t.id===e.session.id)?.status,n=e.session.status;if(E(e.session),t){let{soundOnPermission:e,soundOnIdle:r}=U.getState();t!==`permission`&&n===`permission`&&e&&aJ(),t===`working`&&n===`waiting`&&r&&oJ()}}if(e.type===`session-created`){let t=Jm.getState().sessions;t.some(t=>t.id===e.session.id)||S([e.session,...t]),D(e.session.id),oe(e.session.projectPath);let{projectFilters:n,setProjectFilters:r}=U.getState();n.length>0&&!n.includes(e.session.projectPath)&&r([...n,e.session.projectPath])}if(e.type===`session-removed`){lW(e.sessionId);let t=Jm.getState().sessions,n=t.filter(t=>t.id!==e.sessionId);n.length!==t.length&&S(n)}if(e.type===`agent-sessions`){let t=Array.isArray(e.active)?e.active:[],n=Array.isArray(e.hibernating)?e.hibernating:[],r=Array.isArray(e.history)?e.history:[],{selectedHibernatingSessionId:i}=Jm.getState(),a=je.current;i&&!n.some(e=>e.sessionId===i)&&(Me.current=i),C(t,n,r),h(e=>e&&n.some(t=>t.sessionId===e.sessionId)?null:e),a&&n.some(e=>e.sessionId===a)?(je.current=null,O(a)):a&&(je.current=null)}if(e.type===`agent-sessions-active`&&w(Array.isArray(e.active)?e.active:[]),e.type===`session-orphaned`&&!e.supersededBy){let t=Jm.getState().sessions,n=t.filter(t=>t.agentSessionId?.trim()!==e.session.sessionId);n.length!==t.length&&S(n)}if(e.type===`session-activated`){let t=Jm.getState().sessions.find(t=>t.tmuxWindow===e.window);t&&E({...t,agentSessionId:e.session.sessionId,agentSessionName:e.session.displayName,logFilePath:e.session.logFilePath,isHibernating:e.session.isHibernating,lastUserMessage:e.session.lastUserMessage??t.lastUserMessage})}if(e.type===`session-wake-result`)if(e.ok&&e.session){h(t=>t?.sessionId===e.sessionId?null:t);let t=Jm.getState().sessions;t.some(t=>t.id===e.session.id)||S([e.session,...t]),D(e.session.id)}else e.ok||(d(`${e.error?.code}: ${e.error?.message}`),window.setTimeout(()=>d(null),6e3));if(e.type===`session-hibernate-result`&&(e.ok?(e.session&&h(e.session),O(e.sessionId)):(d(e.error??`Failed to hibernate session`),window.setTimeout(()=>d(null),6e3))),e.type===`terminal-error`&&(!e.sessionId||e.sessionId===y)&&(d(`${e.code}: ${e.message}`),window.setTimeout(()=>d(null),6e3)),e.type===`terminal-ready`&&e.sessionId===y&&d(null),e.type===`error`&&(d(e.message),window.setTimeout(()=>d(null),6e3)),e.type===`kill-failed`){let t=Fe.current.get(e.sessionId);if(t){let n=Jm.getState().sessions;n.some(t=>t.id===e.sessionId)||S([t.session,...n]),t.wasSelected&&D(e.sessionId),Fe.current.delete(e.sessionId)}M(e.sessionId),d(e.message),window.setTimeout(()=>d(null),6e3)}e.type===`session-move-to-history-result`&&!e.ok&&e.error&&(d(e.error),window.setTimeout(()=>d(null),6e3))}});return()=>{e()}},[y,b,oe,M,he,D,O,h,S,C,w,T,P,F,I,L,ge,E]);let be=(0,x.useMemo)(()=>g.find(e=>e.id===y)||null,[y,g]),xe=_.hibernating??[],Se=_.history??[],Ce=(0,x.useMemo)(()=>UX(xe,ue,de),[xe,ue,de]),we=(0,x.useMemo)(()=>Ce.find(e=>e.sessionId===b)||(m?.sessionId===b?m:null),[Ce,m,b]);(0,x.useEffect)(()=>{be?.projectPath&&!be.remote&&W(be.projectPath)},[be?.projectPath,be?.remote,W]);let Te=U(e=>e.sessionSortMode),Ee=U(e=>e.sessionSortDirection),De=U(e=>e.manualSessionOrder),Oe=(0,x.useMemo)(()=>Nm(g,{mode:Te,direction:Ee,manualOrder:De}),[g,Te,Ee,De]),ke=(0,x.useMemo)(()=>{let e=Oe;return ue.length>0&&(e=e.filter(e=>ue.includes(e.projectPath))),de.length>0&&(e=e.filter(e=>de.includes(e.host??``))),e},[Oe,ue,de]),Ae=(0,x.useRef)(b),je=(0,x.useRef)(null),Me=(0,x.useRef)(null),Ne=(0,x.useRef)(me),Pe=(0,x.useCallback)(()=>ke.length>0?(D(ke[0].id),!0):Ce.length>0?(O(Ce[0].sessionId),!0):!1,[ke,Ce,D,O]);(0,x.useEffect)(()=>{let e=Ae.current;e&&b===null&&!xe.some(t=>t.sessionId===e)?Me.current=e:b!==null&&(Me.current=null),Ae.current=b},[xe,b]),(0,x.useEffect)(()=>{m&&b!==m.sessionId&&h(null)},[m,b]),(0,x.useEffect)(()=>{Ne.current!==me&&(Ne.current=me,je.current=null,Me.current=null,h(null))},[me]),(0,x.useEffect)(()=>{k&&(b||y&&(ke.some(e=>e.id===y)||Pe()||D(null)))},[k,y,b,Pe,D]),(0,x.useEffect)(()=>{if(!b||m?.sessionId===b||v!==me||Ce.some(e=>e.sessionId===b))return;let e=ke.find(e=>e.agentSessionId?.trim()===b);if(e){D(e.id);return}Pe()||O(null)},[Ce,ke,v,m,b,Pe,D,O,me]),(0,x.useEffect)(()=>{let e=Me.current;if(!e)return;if(b!==null){Me.current=null;return}let t=ke.find(t=>t.agentSessionId?.trim()===e);if(t){Me.current=null,D(t.id);return}if(y!==null){Me.current=null;return}Pe()&&(Me.current=null)},[ke,y,b,Pe,D]),(0,x.useEffect)(()=>{window.matchMedia(`(max-width: 767px)`).matches&&k&&y===null&&b===null&&(ke.length>0||Ce.length>0)&&Pe()},[Ce.length,ke.length,k,Pe,y,b]);let Fe=(0,x.useRef)(new Map),Ie=(0,x.useCallback)((e,t=`unknown`)=>{lW(e);let{sessions:n,selectedSessionId:r}=Jm.getState(),i=n.find(t=>t.id===e);i&&Fe.current.set(e,{session:i,wasSelected:r===e,epoch:_e()}),(0,re.flushSync)(()=>{N(e),S(n.filter(t=>t.id!==e))}),he({type:`session-kill`,sessionId:e,source:t})},[N,S,he]);(0,x.useEffect)(()=>{let n=Je(se),r=r=>{if(r.defaultPrevented)return;let i=r.code,a=Ze(r,n);if(a&&(i===`BracketLeft`||i===`BracketRight`)){r.preventDefault();let e=i===`BracketLeft`?-1:1,t=ke;if(t.length===0){let t=Ce;if(t.length===0)return;let n=t.findIndex(e=>e.sessionId===b);if(n===-1){O(t[0].sessionId);return}O(t[(n+e+t.length)%t.length].sessionId);return}let n=t.findIndex(e=>e.id===y);if(n===-1){D(t[0].id);return}D(t[(n+e+t.length)%t.length].id);return}if(a&&/^Digit[1-9]$/.test(i)){let e=Number(i.slice(5))-1;if(ke.length>0){let t=ke[e];if(!t)return;r.preventDefault(),D(t.id);return}let t=Ce[e];if(!t)return;r.preventDefault(),O(t.sessionId);return}if(a&&i===`KeyN`){r.preventDefault(),!e&&ee&&t(!0);return}if(a&&i===`KeyX`){r.preventDefault(),y&&!e&&Ie(y,`keyboard_shortcut`);return}};return window.addEventListener(`keydown`,r),()=>window.removeEventListener(`keydown`,r)},[e,y,b,D,O,ke,Ce,Ie,se,ee]);let Le=()=>ee?(r(void 0),a(void 0),s(void 0),t(!0),!0):!1,Re=()=>l(!0),ze=(e,t,n,r)=>{he({type:`session-create`,projectPath:e,name:t,command:n,host:r}),r||W(e)},Be=e=>{he({type:`session-wake`,sessionId:e})},Ve=(0,x.useCallback)(e=>{he({type:`session-hibernate`,sessionId:e})},[he]),He=(e,t)=>{he({type:`session-rename`,sessionId:e,newName:t})},Ue=(0,x.useCallback)(e=>{let t=g.find(t=>t.id===e);t&&he({type:`session-create`,projectPath:t.projectPath,command:t.command||void 0,host:t.remote&&t.host?t.host:void 0})},[g,he]),We=(0,x.useCallback)(e=>{he({type:`session-move-to-history`,sessionId:e})},[he]);(0,x.useEffect)(()=>{document.documentElement.setAttribute(`data-theme`,V)},[V]),(0,x.useEffect)(()=>{fetch(`/api/server-info`).then(e=>e.json()).then(e=>p(e)).catch(()=>{})},[]);let Ge=(0,x.useMemo)(()=>B?R.filter(e=>e.host!==B):R,[R,B]);return(0,G.jsxs)(`div`,{className:`flex h-full overflow-hidden`,children:[(0,G.jsxs)(`div`,{className:`hidden h-full flex-col md:flex md:shrink-0`,style:{width:ce},children:[(0,G.jsx)(et,{connectionStatus:A,onNewSession:Le,onOpenSettings:Re,tailscaleIp:f?.tailscaleIp??null}),(0,G.jsx)(WD,{sessions:g,hibernatingSessions:xe,historySessions:Se,selectedSessionId:y,selectedHibernatingSessionId:b,onSelect:D,onSelectHibernating:O,onRename:He,onResume:Be,onHibernate:Ve,onKill:Ie,onDuplicate:Ue,onMoveToHistory:We,onNewSession:Le,loading:!k,error:j||u})]}),(0,G.jsx)(`div`,{className:`hidden md:block w-1 shrink-0 cursor-col-resize bg-transparent transition-colors hover:bg-white/10 active:bg-white/20`,onMouseDown:ye}),(0,G.jsx)($G,{session:be,sessions:ke,hibernatingSession:we,hibernatingSessions:xe,connectionStatus:A,connectionEpoch:me,sendMessage:he,subscribe:ge,onClose:()=>D(null),onSelectSession:D,onSelectHibernatingSession:O,onNewSession:Le,onKillSession:Ie,onRenameSession:He,onDuplicateSession:Ue,onOpenSettings:Re,onResumeSession:Be,onHibernateSession:Ve,onMoveToHistory:We,historySessions:Se,loading:!k,error:j||u}),(0,G.jsx)(vK,{isOpen:e,onClose:()=>t(!1),onCreate:ze,defaultProjectDir:H,commandPresets:te,defaultPresetId:ie,lastProjectPath:ae,activeProjectPath:be&&!be.remote?be.projectPath:void 0,remoteHosts:Ge,remoteAllowControl:z,initialHost:n,initialPath:i,initialCommand:o}),(0,G.jsx)(sJ,{isOpen:c,onClose:()=>l(!1)}),(0,G.jsx)(iX,{})]})}var GX=`modulepreload`,KX=function(e){return`/`+e},qX={},JX=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){let e=document.getElementsByTagName(`link`),i=document.querySelector(`meta[property=csp-nonce]`),a=i?.nonce||i?.getAttribute(`nonce`);function o(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}r=o(t.map(t=>{if(t=KX(t,n),t in qX)return;qX[t]=!0;let r=t.endsWith(`.css`),i=r?`[rel="stylesheet"]`:``;if(n)for(let n=e.length-1;n>=0;n--){let i=e[n];if(i.href===t&&(!r||i.rel===`stylesheet`))return}else if(document.querySelector(`link[href="${t}"]${i}`))return;let o=document.createElement(`link`);if(o.rel=r?`stylesheet`:GX,r||(o.as=`script`),o.crossOrigin=``,o.href=t,a&&o.setAttribute(`nonce`,a),document.head.appendChild(o),r)return new Promise((e,n)=>{o.addEventListener(`load`,e),o.addEventListener(`error`,()=>n(Error(`Unable to preload CSS for ${t}`)))})}))}function i(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return r.then(t=>{for(let e of t||[])e.status===`rejected`&&i(e.reason);return e().catch(i)})},YX=`true`,XX=`false`,ZX=YX===`true`,QX=XX===`true`;function $X(e={}){let{immediate:t=!1,onNeedRefresh:n,onOfflineReady:r,onRegistered:i,onRegisteredSW:a,onRegisterError:o}=e,s,c,l,u=async(e=!0)=>{await c,ZX||l?.()};async function d(){if(`serviceWorker`in navigator){if(s=await JX(async()=>{let{Workbox:e}=await import(`./workbox-window.prod.es5-Bq4GJJid.js`);return{Workbox:e}},[]).then(({Workbox:e})=>new e(`/sw.js`,{scope:`/`,type:`classic`})).catch(e=>{o?.(e)}),!s)return;if(l=()=>{s?.messageSkipWaiting()},!QX)if(ZX)s.addEventListener(`activated`,e=>{(e.isUpdate||e.isExternal)&&window.location.reload()}),s.addEventListener(`installed`,e=>{e.isUpdate||r?.()});else{let e=!1,t=()=>{e=!0,s?.addEventListener(`controlling`,e=>{e.isUpdate&&window.location.reload()}),n?.()};s.addEventListener(`installed`,n=>{n.isUpdate===void 0?n.isExternal===void 0?!e&&r?.():n.isExternal?t():!e&&r?.():n.isUpdate||r?.()}),s.addEventListener(`waiting`,t)}s.register({immediate:t}).then(e=>{a?a(`/sw.js`,e):i?.(e)}).catch(e=>{o?.(e)})}}return c=d(),u}Ge()&&document.documentElement.classList.add(`ios`),Ke()&&document.documentElement.classList.add(`ios-pwa`),$X({immediate:!0,onRegisteredSW(e,t){t&&(setInterval(()=>{t.update()},300*1e3),document.addEventListener(`visibilitychange`,()=>{document.visibilityState===`visible`&&t.update()}))}});var eZ=document.getElementById(`root`);if(!eZ)throw Error(`Root element not found`);(0,E.createRoot)(eZ).render((0,G.jsx)(x.StrictMode,{children:(0,G.jsx)(WX,{})}));
|