@treeport/treeport 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,146 @@
1
+ var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports),s=(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},c=(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},l=(n,r,a)=>(a=n==null?{}:e(i(n)),c(r||!n||!n.__esModule?t(a,`default`,{value:n,enumerable:!0}):a,n));(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 u=o((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.portal`),r=Symbol.for(`react.fragment`),i=Symbol.for(`react.strict_mode`),a=Symbol.for(`react.profiler`),o=Symbol.for(`react.consumer`),s=Symbol.for(`react.context`),c=Symbol.for(`react.forward_ref`),l=Symbol.for(`react.suspense`),u=Symbol.for(`react.memo`),d=Symbol.for(`react.lazy`),f=Symbol.for(`react.activity`),p=Symbol.iterator;function m(e){return typeof e!=`object`||!e?null:(e=p&&e[p]||e[`@@iterator`],typeof e==`function`?e:null)}var h={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},g=Object.assign,_={};function v(e,t,n){this.props=e,this.context=t,this.refs=_,this.updater=n||h}v.prototype.isReactComponent={},v.prototype.setState=function(e,t){if(typeof e!=`object`&&typeof e!=`function`&&e!=null)throw Error(`takes an object of state variables to update or a function which returns an object of state variables.`);this.updater.enqueueSetState(this,e,t,`setState`)},v.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,`forceUpdate`)};function y(){}y.prototype=v.prototype;function b(e,t,n){this.props=e,this.context=t,this.refs=_,this.updater=n||h}var x=b.prototype=new y;x.constructor=b,g(x,v.prototype),x.isPureReactComponent=!0;var S=Array.isArray;function C(){}var w={H:null,A:null,T:null,S:null},T=Object.prototype.hasOwnProperty;function E(e,n,r){var i=r.ref;return{$$typeof:t,type:e,key:n,ref:i===void 0?null:i,props:r}}function D(e,t){return E(e.type,t,e.props)}function O(e){return typeof e==`object`&&!!e&&e.$$typeof===t}function k(e){var t={"=":`=0`,":":`=2`};return`$`+e.replace(/[=:]/g,function(e){return t[e]})}var ee=/\/+/g;function te(e,t){return typeof e==`object`&&e&&e.key!=null?k(``+e.key):t.toString(36)}function A(e){switch(e.status){case`fulfilled`:return e.value;case`rejected`:throw e.reason;default:switch(typeof e.status==`string`?e.then(C,C):(e.status=`pending`,e.then(function(t){e.status===`pending`&&(e.status=`fulfilled`,e.value=t)},function(t){e.status===`pending`&&(e.status=`rejected`,e.reason=t)})),e.status){case`fulfilled`:return e.value;case`rejected`:throw e.reason}}throw e}function 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`bigint`:case`string`:case`number`:c=!0;break;case`object`:switch(e.$$typeof){case t:case n:c=!0;break;case d:return c=e._init,j(c(e._payload),r,i,a,o)}}if(c)return o=o(e),c=a===``?`.`+te(e,0):a,S(o)?(i=``,c!=null&&(i=c.replace(ee,`$&/`)+`/`),j(o,r,i,``,function(e){return e})):o!=null&&(O(o)&&(o=D(o,i+(o.key==null||e&&e.key===o.key?``:(``+o.key).replace(ee,`$&/`)+`/`)+c)),r.push(o)),1;c=0;var l=a===``?`.`:a+`:`;if(S(e))for(var u=0;u<e.length;u++)a=e[u],s=l+te(a,u),c+=j(a,r,i,s,o);else if(u=m(e),typeof u==`function`)for(e=u.call(e),u=0;!(a=e.next()).done;)a=a.value,s=l+te(a,u++),c+=j(a,r,i,s,o);else if(s===`object`){if(typeof e.then==`function`)return j(A(e),r,i,a,o);throw r=String(e),Error(`Objects are not valid as a React child (found: `+(r===`[object Object]`?`object with keys {`+Object.keys(e).join(`, `)+`}`:r)+`). If you meant to render a collection of children, use an array instead.`)}return c}function 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=typeof reportError==`function`?reportError:function(e){if(typeof window==`object`&&typeof window.ErrorEvent==`function`){var t=new window.ErrorEvent(`error`,{bubbles:!0,cancelable:!0,message:typeof e==`object`&&e&&typeof e.message==`string`?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if(typeof process==`object`&&typeof process.emit==`function`){process.emit(`uncaughtException`,e);return}console.error(e)},F={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(!O(e))throw Error(`React.Children.only expected to receive a single React element child.`);return e}};e.Activity=f,e.Children=F,e.Component=v,e.Fragment=r,e.Profiler=a,e.PureComponent=b,e.StrictMode=i,e.Suspense=l,e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=w,e.__COMPILER_RUNTIME={__proto__:null,c:function(e){return w.H.useMemoCache(e)}},e.cache=function(e){return function(){return e.apply(null,arguments)}},e.cacheSignal=function(){return null},e.cloneElement=function(e,t,n){if(e==null)throw Error(`The argument must be a React element, but you passed `+e+`.`);var r=g({},e.props),i=e.key;if(t!=null)for(a in t.key!==void 0&&(i=``+t.key),t)!T.call(t,a)||a===`key`||a===`__self`||a===`__source`||a===`ref`&&t.ref===void 0||(r[a]=t[a]);var a=arguments.length-2;if(a===1)r.children=n;else if(1<a){for(var o=Array(a),s=0;s<a;s++)o[s]=arguments[s+2];r.children=o}return E(e.type,i,r)},e.createContext=function(e){return e={$$typeof:s,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null},e.Provider=e,e.Consumer={$$typeof:o,_context:e},e},e.createElement=function(e,t,n){var r,i={},a=null;if(t!=null)for(r in t.key!==void 0&&(a=``+t.key),t)T.call(t,r)&&r!==`key`&&r!==`__self`&&r!==`__source`&&(i[r]=t[r]);var o=arguments.length-2;if(o===1)i.children=n;else if(1<o){for(var s=Array(o),c=0;c<o;c++)s[c]=arguments[c+2];i.children=s}if(e&&e.defaultProps)for(r in o=e.defaultProps,o)i[r]===void 0&&(i[r]=o[r]);return E(e,a,i)},e.createRef=function(){return{current:null}},e.forwardRef=function(e){return{$$typeof:c,render:e}},e.isValidElement=O,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=w.T,n={};w.T=n;try{var r=e(),i=w.S;i!==null&&i(n,r),typeof r==`object`&&r&&typeof r.then==`function`&&r.then(C,P)}catch(e){P(e)}finally{t!==null&&n.types!==null&&(t.types=n.types),w.T=t}},e.unstable_useCacheRefresh=function(){return w.H.useCacheRefresh()},e.use=function(e){return w.H.use(e)},e.useActionState=function(e,t,n){return w.H.useActionState(e,t,n)},e.useCallback=function(e,t){return w.H.useCallback(e,t)},e.useContext=function(e){return w.H.useContext(e)},e.useDebugValue=function(){},e.useDeferredValue=function(e,t){return w.H.useDeferredValue(e,t)},e.useEffect=function(e,t){return w.H.useEffect(e,t)},e.useEffectEvent=function(e){return w.H.useEffectEvent(e)},e.useId=function(){return w.H.useId()},e.useImperativeHandle=function(e,t,n){return w.H.useImperativeHandle(e,t,n)},e.useInsertionEffect=function(e,t){return w.H.useInsertionEffect(e,t)},e.useLayoutEffect=function(e,t){return w.H.useLayoutEffect(e,t)},e.useMemo=function(e,t){return w.H.useMemo(e,t)},e.useOptimistic=function(e,t){return w.H.useOptimistic(e,t)},e.useReducer=function(e,t,n){return w.H.useReducer(e,t,n)},e.useRef=function(e){return w.H.useRef(e)},e.useState=function(e){return w.H.useState(e)},e.useSyncExternalStore=function(e,t,n){return w.H.useSyncExternalStore(e,t,n)},e.useTransition=function(){return w.H.useTransition()},e.version=`19.2.7`})),d=o(((e,t)=>{t.exports=u()})),f=o((e=>{function t(e,t){var n=e.length;e.push(t);a:for(;0<n;){var r=n-1>>>1,a=e[r];if(0<i(a,t))e[r]=t,e[n]=a,n=r;else break a}}function n(e){return e.length===0?null:e[0]}function r(e){if(e.length===0)return null;var t=e[0],n=e.pop();if(n!==t){e[0]=n;a:for(var r=0,a=e.length,o=a>>>1;r<o;){var s=2*(r+1)-1,c=e[s],l=s+1,u=e[l];if(0>i(c,n))l<a&&0>i(u,c)?(e[r]=u,e[l]=n,r=l):(e[r]=c,e[s]=n,r=s);else if(l<a&&0>i(u,n))e[r]=u,e[l]=n,r=l;else break a}}return t}function i(e,t){var n=e.sortIndex-t.sortIndex;return n===0?e.id-t.id:n}if(e.unstable_now=void 0,typeof performance==`object`&&typeof performance.now==`function`){var a=performance;e.unstable_now=function(){return a.now()}}else{var o=Date,s=o.now();e.unstable_now=function(){return o.now()-s}}var c=[],l=[],u=1,d=null,f=3,p=!1,m=!1,h=!1,g=!1,_=typeof setTimeout==`function`?setTimeout:null,v=typeof clearTimeout==`function`?clearTimeout:null,y=typeof setImmediate<`u`?setImmediate:null;function b(e){for(var i=n(l);i!==null;){if(i.callback===null)r(l);else if(i.startTime<=e)r(l),i.sortIndex=i.expirationTime,t(c,i);else break;i=n(l)}}function x(e){if(h=!1,b(e),!m)if(n(c)!==null)m=!0,S||(S=!0,O());else{var t=n(l);t!==null&&te(x,t.startTime-e)}}var S=!1,C=-1,w=5,T=-1;function E(){return g?!0:!(e.unstable_now()-T<w)}function D(){if(g=!1,S){var t=e.unstable_now();T=t;var i=!0;try{a:{m=!1,h&&(h=!1,v(C),C=-1),p=!0;var a=f;try{b:{for(b(t),d=n(c);d!==null&&!(d.expirationTime>t&&E());){var o=d.callback;if(typeof o==`function`){d.callback=null,f=d.priorityLevel;var s=o(d.expirationTime<=t);if(t=e.unstable_now(),typeof s==`function`){d.callback=s,b(t),i=!0;break b}d===n(c)&&r(c),b(t)}else r(c);d=n(c)}if(d!==null)i=!0;else{var u=n(l);u!==null&&te(x,u.startTime-t),i=!1}}break a}finally{d=null,f=a,p=!1}i=void 0}}finally{i?O():S=!1}}}var O;if(typeof y==`function`)O=function(){y(D)};else if(typeof MessageChannel<`u`){var k=new MessageChannel,ee=k.port2;k.port1.onmessage=D,O=function(){ee.postMessage(null)}}else O=function(){_(D,0)};function te(t,n){C=_(function(){t(e.unstable_now())},n)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(e){e.callback=null},e.unstable_forceFrameRate=function(e){0>e||125<e?console.error(`forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported`):w=0<e?Math.floor(1e3/e):5},e.unstable_getCurrentPriorityLevel=function(){return f},e.unstable_next=function(e){switch(f){case 1:case 2:case 3:var t=3;break;default:t=f}var n=f;f=t;try{return e()}finally{f=n}},e.unstable_requestPaint=function(){g=!0},e.unstable_runWithPriority=function(e,t){switch(e){case 1:case 2:case 3:case 4:case 5:break;default:e=3}var n=f;f=e;try{return t()}finally{f=n}},e.unstable_scheduleCallback=function(r,i,a){var o=e.unstable_now();switch(typeof a==`object`&&a?(a=a.delay,a=typeof a==`number`&&0<a?o+a:o):a=o,r){case 1:var s=-1;break;case 2:s=250;break;case 5:s=1073741823;break;case 4:s=1e4;break;default:s=5e3}return s=a+s,r={id:u++,callback:i,priorityLevel:r,startTime:a,expirationTime:s,sortIndex:-1},a>o?(r.sortIndex=a,t(l,r),n(c)===null&&r===n(l)&&(h?(v(C),C=-1):h=!0,te(x,a-o))):(r.sortIndex=s,t(c,r),m||p||(m=!0,S||(S=!0,O()))),r},e.unstable_shouldYield=E,e.unstable_wrapCallback=function(e){var t=f;return function(){var n=f;f=t;try{return e.apply(this,arguments)}finally{f=n}}}})),p=o(((e,t)=>{t.exports=f()})),m=o((e=>{var t=d();function n(e){var t=`https://react.dev/errors/`+e;if(1<arguments.length){t+=`?args[]=`+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+=`&args[]=`+encodeURIComponent(arguments[n])}return`Minified React error #`+e+`; visit `+t+` for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`}function r(){}var i={d:{f:r,r:function(){throw Error(n(522))},D:r,C:r,L:r,m:r,X:r,S:r,M:r},p:0,findDOMNode:null},a=Symbol.for(`react.portal`);function o(e,t,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:a,key:r==null?null:``+r,children:e,containerInfo:t,implementation:n}}var s=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function c(e,t){if(e===`font`)return``;if(typeof t==`string`)return t===`use-credentials`?t:``}e.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=i,e.createPortal=function(e,t){var r=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)throw Error(n(299));return o(e,t,null,r)},e.flushSync=function(e){var t=s.T,n=i.p;try{if(s.T=null,i.p=2,e)return e()}finally{s.T=t,i.p=n,i.d.f()}},e.preconnect=function(e,t){typeof e==`string`&&(t?(t=t.crossOrigin,t=typeof t==`string`?t===`use-credentials`?t:``:void 0):t=null,i.d.C(e,t))},e.prefetchDNS=function(e){typeof e==`string`&&i.d.D(e)},e.preinit=function(e,t){if(typeof e==`string`&&t&&typeof t.as==`string`){var n=t.as,r=c(n,t.crossOrigin),a=typeof t.integrity==`string`?t.integrity:void 0,o=typeof t.fetchPriority==`string`?t.fetchPriority:void 0;n===`style`?i.d.S(e,typeof t.precedence==`string`?t.precedence:void 0,{crossOrigin:r,integrity:a,fetchPriority:o}):n===`script`&&i.d.X(e,{crossOrigin:r,integrity:a,fetchPriority:o,nonce:typeof t.nonce==`string`?t.nonce:void 0})}},e.preinitModule=function(e,t){if(typeof e==`string`)if(typeof t==`object`&&t){if(t.as==null||t.as===`script`){var n=c(t.as,t.crossOrigin);i.d.M(e,{crossOrigin:n,integrity:typeof t.integrity==`string`?t.integrity:void 0,nonce:typeof t.nonce==`string`?t.nonce:void 0})}}else t??i.d.M(e)},e.preload=function(e,t){if(typeof e==`string`&&typeof t==`object`&&t&&typeof t.as==`string`){var n=t.as,r=c(n,t.crossOrigin);i.d.L(e,n,{crossOrigin:r,integrity:typeof t.integrity==`string`?t.integrity:void 0,nonce:typeof t.nonce==`string`?t.nonce:void 0,type:typeof t.type==`string`?t.type:void 0,fetchPriority:typeof t.fetchPriority==`string`?t.fetchPriority:void 0,referrerPolicy:typeof t.referrerPolicy==`string`?t.referrerPolicy:void 0,imageSrcSet:typeof t.imageSrcSet==`string`?t.imageSrcSet:void 0,imageSizes:typeof t.imageSizes==`string`?t.imageSizes:void 0,media:typeof t.media==`string`?t.media:void 0})}},e.preloadModule=function(e,t){if(typeof e==`string`)if(t){var n=c(t.as,t.crossOrigin);i.d.m(e,{as:typeof t.as==`string`&&t.as!==`script`?t.as:void 0,crossOrigin:n,integrity:typeof t.integrity==`string`?t.integrity:void 0})}else i.d.m(e)},e.requestFormReset=function(e){i.d.r(e)},e.unstable_batchedUpdates=function(e,t){return e(t)},e.useFormState=function(e,t,n){return s.H.useFormState(e,t,n)},e.useFormStatus=function(){return s.H.useHostTransitionStatus()},e.version=`19.2.7`})),h=o(((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=m()})),g=o((e=>{var t=p(),n=d(),r=h();function i(e){var t=`https://react.dev/errors/`+e;if(1<arguments.length){t+=`?args[]=`+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+=`&args[]=`+encodeURIComponent(arguments[n])}return`Minified React error #`+e+`; visit `+t+` for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`}function a(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function o(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 s(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 c(e){if(e.tag===31){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function l(e){if(o(e)!==e)throw Error(i(188))}function u(e){var t=e.alternate;if(!t){if(t=o(e),t===null)throw Error(i(188));return t===e?e:null}for(var n=e,r=t;;){var a=n.return;if(a===null)break;var s=a.alternate;if(s===null){if(r=a.return,r!==null){n=r;continue}break}if(a.child===s.child){for(s=a.child;s;){if(s===n)return l(a),e;if(s===r)return l(a),t;s=s.sibling}throw Error(i(188))}if(n.return!==r.return)n=a,r=s;else{for(var c=!1,u=a.child;u;){if(u===n){c=!0,n=a,r=s;break}if(u===r){c=!0,r=a,n=s;break}u=u.sibling}if(!c){for(u=s.child;u;){if(u===n){c=!0,n=s,r=a;break}if(u===r){c=!0,r=s,n=a;break}u=u.sibling}if(!c)throw Error(i(189))}}if(n.alternate!==r)throw Error(i(190))}if(n.tag!==3)throw Error(i(188));return n.stateNode.current===n?e:t}function f(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=f(e),t!==null)return t;e=e.sibling}return null}var m=Object.assign,g=Symbol.for(`react.element`),_=Symbol.for(`react.transitional.element`),v=Symbol.for(`react.portal`),y=Symbol.for(`react.fragment`),b=Symbol.for(`react.strict_mode`),x=Symbol.for(`react.profiler`),S=Symbol.for(`react.consumer`),C=Symbol.for(`react.context`),w=Symbol.for(`react.forward_ref`),T=Symbol.for(`react.suspense`),E=Symbol.for(`react.suspense_list`),D=Symbol.for(`react.memo`),O=Symbol.for(`react.lazy`),k=Symbol.for(`react.activity`),ee=Symbol.for(`react.memo_cache_sentinel`),te=Symbol.iterator;function A(e){return typeof e!=`object`||!e?null:(e=te&&e[te]||e[`@@iterator`],typeof e==`function`?e:null)}var j=Symbol.for(`react.client.reference`);function M(e){if(e==null)return null;if(typeof e==`function`)return e.$$typeof===j?null:e.displayName||e.name||null;if(typeof e==`string`)return e;switch(e){case y:return`Fragment`;case x:return`Profiler`;case b:return`StrictMode`;case T:return`Suspense`;case E:return`SuspenseList`;case k:return`Activity`}if(typeof e==`object`)switch(e.$$typeof){case v:return`Portal`;case C:return e.displayName||`Context`;case S:return(e._context.displayName||`Context`)+`.Consumer`;case w:var t=e.render;return e=e.displayName,e||=(e=t.displayName||t.name||``,e===``?`ForwardRef`:`ForwardRef(`+e+`)`),e;case D:return t=e.displayName||null,t===null?M(e.type)||`Memo`:t;case O:t=e._payload,e=e._init;try{return M(e(t))}catch{}}return null}var N=Array.isArray,P=n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,F=r.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,ne={pending:!1,data:null,method:null,action:null},re=[],ie=-1;function I(e){return{current:e}}function L(e){0>ie||(e.current=re[ie],re[ie]=null,ie--)}function R(e,t){ie++,re[ie]=e.current,e.current=t}var ae=I(null),z=I(null),oe=I(null),se=I(null);function ce(e,t){switch(R(oe,t),R(z,e),R(ae,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?Yd(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=Yd(t),e=Xd(t,e);else switch(e){case`svg`:e=1;break;case`math`:e=2;break;default:e=0}}L(ae),R(ae,e)}function le(){L(ae),L(z),L(oe)}function ue(e){e.memoizedState!==null&&R(se,e);var t=ae.current,n=Xd(t,e.type);t!==n&&(R(z,e),R(ae,n))}function de(e){z.current===e&&(L(ae),L(z)),se.current===e&&(L(se),rp._currentValue=ne)}var fe,pe;function me(e){if(fe===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);fe=t&&t[1]||``,pe=-1<e.stack.indexOf(`
2
+ at`)?` (<anonymous>)`:-1<e.stack.indexOf(`@`)?`@unknown:0:0`:``}return`
3
+ `+fe+e+pe}var he=!1;function ge(e,t){if(!e||he)return``;he=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var r={DetermineComponentFrameRoot:function(){try{if(t){var n=function(){throw Error()};if(Object.defineProperty(n.prototype,"props",{set:function(){throw Error()}}),typeof Reflect==`object`&&Reflect.construct){try{Reflect.construct(n,[])}catch(e){var r=e}Reflect.construct(e,[],n)}else{try{n.call()}catch(e){r=e}e.call(n.prototype)}}else{try{throw Error()}catch(e){r=e}(n=e())&&typeof n.catch==`function`&&n.catch(function(){})}}catch(e){if(e&&r&&typeof e.stack==`string`)return[e.stack,r.stack]}return[null,null]}};r.DetermineComponentFrameRoot.displayName=`DetermineComponentFrameRoot`;var i=Object.getOwnPropertyDescriptor(r.DetermineComponentFrameRoot,`name`);i&&i.configurable&&Object.defineProperty(r.DetermineComponentFrameRoot,"name",{value:`DetermineComponentFrameRoot`});var a=r.DetermineComponentFrameRoot(),o=a[0],s=a[1];if(o&&s){var c=o.split(`
4
+ `),l=s.split(`
5
+ `);for(i=r=0;r<c.length&&!c[r].includes(`DetermineComponentFrameRoot`);)r++;for(;i<l.length&&!l[i].includes(`DetermineComponentFrameRoot`);)i++;if(r===c.length||i===l.length)for(r=c.length-1,i=l.length-1;1<=r&&0<=i&&c[r]!==l[i];)i--;for(;1<=r&&0<=i;r--,i--)if(c[r]!==l[i]){if(r!==1||i!==1)do if(r--,i--,0>i||c[r]!==l[i]){var u=`
6
+ `+c[r].replace(` at new `,` at `);return e.displayName&&u.includes(`<anonymous>`)&&(u=u.replace(`<anonymous>`,e.displayName)),u}while(1<=r&&0<=i);break}}}finally{he=!1,Error.prepareStackTrace=n}return(n=e?e.displayName||e.name:``)?me(n):``}function _e(e,t){switch(e.tag){case 26:case 27:case 5:return me(e.type);case 16:return me(`Lazy`);case 13:return e.child!==t&&t!==null?me(`Suspense Fallback`):me(`Suspense`);case 19:return me(`SuspenseList`);case 0:case 15:return ge(e.type,!1);case 11:return ge(e.type.render,!1);case 1:return ge(e.type,!0);case 31:return me(`Activity`);default:return``}}function ve(e){try{var t=``,n=null;do t+=_e(e,n),n=e,e=e.return;while(e);return t}catch(e){return`
7
+ Error generating stack: `+e.message+`
8
+ `+e.stack}}var ye=Object.prototype.hasOwnProperty,be=t.unstable_scheduleCallback,xe=t.unstable_cancelCallback,Se=t.unstable_shouldYield,Ce=t.unstable_requestPaint,we=t.unstable_now,Te=t.unstable_getCurrentPriorityLevel,Ee=t.unstable_ImmediatePriority,De=t.unstable_UserBlockingPriority,Oe=t.unstable_NormalPriority,ke=t.unstable_LowPriority,Ae=t.unstable_IdlePriority,je=t.log,Me=t.unstable_setDisableYieldValue,Ne=null,Pe=null;function Fe(e){if(typeof je==`function`&&Me(e),Pe&&typeof Pe.setStrictMode==`function`)try{Pe.setStrictMode(Ne,e)}catch{}}var Ie=Math.clz32?Math.clz32:ze,Le=Math.log,Re=Math.LN2;function ze(e){return e>>>=0,e===0?32:31-(Le(e)/Re|0)|0}var Be=256,Ve=262144,He=4194304;function B(e){var t=e&42;if(t!==0)return t;switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return e&261888;case 262144:case 524288:case 1048576:case 2097152:return e&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return e&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return e}}function V(e,t,n){var r=e.pendingLanes;if(r===0)return 0;var i=0,a=e.suspendedLanes,o=e.pingedLanes;e=e.warmLanes;var s=r&134217727;return s===0?(s=r&~a,s===0?o===0?n||(n=r&~e,n!==0&&(i=B(n))):i=B(o):i=B(s)):(r=s&~a,r===0?(o&=s,o===0?n||(n=s&~e,n!==0&&(i=B(n))):i=B(o)):i=B(r)),i===0?0:t!==0&&t!==i&&(t&a)===0&&(a=i&-i,n=t&-t,a>=n||a===32&&n&4194048)?t:i}function Ue(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function We(e,t){switch(e){case 1:case 2:case 4:case 8:case 64:return t+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function Ge(){var e=He;return He<<=1,!(He&62914560)&&(He=4194304),e}function Ke(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function qe(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function Je(e,t,n,r,i,a){var o=e.pendingLanes;e.pendingLanes=n,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=n,e.entangledLanes&=n,e.errorRecoveryDisabledLanes&=n,e.shellSuspendCounter=0;var s=e.entanglements,c=e.expirationTimes,l=e.hiddenUpdates;for(n=o&~n;0<n;){var u=31-Ie(n),d=1<<u;s[u]=0,c[u]=-1;var f=l[u];if(f!==null)for(l[u]=null,u=0;u<f.length;u++){var p=f[u];p!==null&&(p.lane&=-536870913)}n&=~d}r!==0&&Ye(e,r,0),a!==0&&i===0&&e.tag!==0&&(e.suspendedLanes|=a&~(o&~t))}function Ye(e,t,n){e.pendingLanes|=t,e.suspendedLanes&=~t;var r=31-Ie(t);e.entangledLanes|=t,e.entanglements[r]=e.entanglements[r]|1073741824|n&261930}function Xe(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var r=31-Ie(n),i=1<<r;i&t|e[r]&t&&(e[r]|=t),n&=~i}}function Ze(e,t){var n=t&-t;return n=n&42?1:Qe(n),(n&(e.suspendedLanes|t))===0?n:0}function Qe(e){switch(e){case 2:e=1;break;case 8:e=4;break;case 32:e=16;break;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:e=128;break;case 268435456:e=134217728;break;default:e=0}return e}function $e(e){return e&=-e,2<e?8<e?e&134217727?32:268435456:8:2}function et(){var e=F.p;return e===0?(e=window.event,e===void 0?32:yp(e.type)):e}function tt(e,t){var n=F.p;try{return F.p=e,t()}finally{F.p=n}}var nt=Math.random().toString(36).slice(2),rt=`__reactFiber$`+nt,it=`__reactProps$`+nt,at=`__reactContainer$`+nt,ot=`__reactEvents$`+nt,st=`__reactListeners$`+nt,ct=`__reactHandles$`+nt,lt=`__reactResources$`+nt,ut=`__reactMarker$`+nt;function dt(e){delete e[rt],delete e[it],delete e[ot],delete e[st],delete e[ct]}function ft(e){var t=e[rt];if(t)return t;for(var n=e.parentNode;n;){if(t=n[at]||n[rt]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=vf(e);e!==null;){if(n=e[rt])return n;e=vf(e)}return t}e=n,n=e.parentNode}return null}function pt(e){if(e=e[rt]||e[at]){var t=e.tag;if(t===5||t===6||t===13||t===31||t===26||t===27||t===3)return e}return null}function mt(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e.stateNode;throw Error(i(33))}function ht(e){var t=e[lt];return t||=e[lt]={hoistableStyles:new Map,hoistableScripts:new Map},t}function gt(e){e[ut]=!0}var _t=new Set,vt={};function yt(e,t){bt(e,t),bt(e+`Capture`,t)}function bt(e,t){for(vt[e]=t,e=0;e<t.length;e++)_t.add(t[e])}var xt=RegExp(`^[:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD][:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$`),St={},Ct={};function wt(e){return ye.call(Ct,e)?!0:ye.call(St,e)?!1:xt.test(e)?Ct[e]=!0:(St[e]=!0,!1)}function Tt(e,t,n){if(wt(t))if(n===null)e.removeAttribute(t);else{switch(typeof n){case`undefined`:case`function`:case`symbol`:e.removeAttribute(t);return;case`boolean`:var r=t.toLowerCase().slice(0,5);if(r!==`data-`&&r!==`aria-`){e.removeAttribute(t);return}}e.setAttribute(t,``+n)}}function Et(e,t,n){if(n===null)e.removeAttribute(t);else{switch(typeof n){case`undefined`:case`function`:case`symbol`:case`boolean`:e.removeAttribute(t);return}e.setAttribute(t,``+n)}}function Dt(e,t,n,r){if(r===null)e.removeAttribute(n);else{switch(typeof r){case`undefined`:case`function`:case`symbol`:case`boolean`:e.removeAttribute(n);return}e.setAttributeNS(t,n,``+r)}}function Ot(e){switch(typeof e){case`bigint`:case`boolean`:case`number`:case`string`:case`undefined`:return e;case`object`:return e;default:return``}}function kt(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()===`input`&&(t===`checkbox`||t===`radio`)}function At(e,t,n){var r=Object.getOwnPropertyDescriptor(e.constructor.prototype,t);if(!e.hasOwnProperty(t)&&r!==void 0&&typeof r.get==`function`&&typeof r.set==`function`){var i=r.get,a=r.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return i.call(this)},set:function(e){n=``+e,a.call(this,e)}}),Object.defineProperty(e,t,{enumerable:r.enumerable}),{getValue:function(){return n},setValue:function(e){n=``+e},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function jt(e){if(!e._valueTracker){var t=kt(e)?`checked`:`value`;e._valueTracker=At(e,t,``+e[t])}}function Mt(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r=``;return e&&(r=kt(e)?e.checked?`true`:`false`:e.value),e=r,e===n?!1:(t.setValue(e),!0)}function Nt(e){if(e||=typeof document<`u`?document:void 0,e===void 0)return null;try{return e.activeElement||e.body}catch{return e.body}}var Pt=/[\n"\\]/g;function Ft(e){return e.replace(Pt,function(e){return`\\`+e.charCodeAt(0).toString(16)+` `})}function It(e,t,n,r,i,a,o,s){e.name=``,o!=null&&typeof o!=`function`&&typeof o!=`symbol`&&typeof o!=`boolean`?e.type=o:e.removeAttribute(`type`),t==null?o!==`submit`&&o!==`reset`||e.removeAttribute(`value`):o===`number`?(t===0&&e.value===``||e.value!=t)&&(e.value=``+Ot(t)):e.value!==``+Ot(t)&&(e.value=``+Ot(t)),t==null?n==null?r!=null&&e.removeAttribute(`value`):Rt(e,o,Ot(n)):Rt(e,o,Ot(t)),i==null&&a!=null&&(e.defaultChecked=!!a),i!=null&&(e.checked=i&&typeof i!=`function`&&typeof i!=`symbol`),s!=null&&typeof s!=`function`&&typeof s!=`symbol`&&typeof s!=`boolean`?e.name=``+Ot(s):e.removeAttribute(`name`)}function Lt(e,t,n,r,i,a,o,s){if(a!=null&&typeof a!=`function`&&typeof a!=`symbol`&&typeof a!=`boolean`&&(e.type=a),t!=null||n!=null){if(!(a!==`submit`&&a!==`reset`||t!=null)){jt(e);return}n=n==null?``:``+Ot(n),t=t==null?n:``+Ot(t),s||t===e.value||(e.value=t),e.defaultValue=t}r??=i,r=typeof r!=`function`&&typeof r!=`symbol`&&!!r,e.checked=s?e.checked:!!r,e.defaultChecked=!!r,o!=null&&typeof o!=`function`&&typeof o!=`symbol`&&typeof o!=`boolean`&&(e.name=o),jt(e)}function Rt(e,t,n){t===`number`&&Nt(e.ownerDocument)===e||e.defaultValue===``+n||(e.defaultValue=``+n)}function zt(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=``+Ot(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 Bt(e,t,n){if(t!=null&&(t=``+Ot(t),t!==e.value&&(e.value=t),n==null)){e.defaultValue!==t&&(e.defaultValue=t);return}e.defaultValue=n==null?``:``+Ot(n)}function Vt(e,t,n,r){if(t==null){if(r!=null){if(n!=null)throw Error(i(92));if(N(r)){if(1<r.length)throw Error(i(93));r=r[0]}n=r}n??=``,t=n}n=Ot(t),e.defaultValue=n,r=e.textContent,r===n&&r!==``&&r!==null&&(e.value=r),jt(e)}function Ht(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var Ut=new Set(`animationIterationCount aspectRatio borderImageOutset borderImageSlice borderImageWidth boxFlex boxFlexGroup boxOrdinalGroup columnCount columns flex flexGrow flexPositive flexShrink flexNegative flexOrder gridArea gridRow gridRowEnd gridRowSpan gridRowStart gridColumn gridColumnEnd gridColumnSpan gridColumnStart fontWeight lineClamp lineHeight opacity order orphans scale tabSize widows zIndex zoom fillOpacity floodOpacity stopOpacity strokeDasharray strokeDashoffset strokeMiterlimit strokeOpacity strokeWidth MozAnimationIterationCount MozBoxFlex MozBoxFlexGroup MozLineClamp msAnimationIterationCount msFlex msZoom msFlexGrow msFlexNegative msFlexOrder msFlexPositive msFlexShrink msGridColumn msGridColumnSpan msGridRow msGridRowSpan WebkitAnimationIterationCount WebkitBoxFlex WebKitBoxFlexGroup WebkitBoxOrdinalGroup WebkitColumnCount WebkitColumns WebkitFlex WebkitFlexGrow WebkitFlexPositive WebkitFlexShrink WebkitLineClamp`.split(` `));function Wt(e,t,n){var r=t.indexOf(`--`)===0;n==null||typeof n==`boolean`||n===``?r?e.setProperty(t,``):t===`float`?e.cssFloat=``:e[t]=``:r?e.setProperty(t,n):typeof n!=`number`||n===0||Ut.has(t)?t===`float`?e.cssFloat=n:e[t]=(``+n).trim():e[t]=n+`px`}function Gt(e,t,n){if(t!=null&&typeof t!=`object`)throw Error(i(62));if(e=e.style,n!=null){for(var r in n)!n.hasOwnProperty(r)||t!=null&&t.hasOwnProperty(r)||(r.indexOf(`--`)===0?e.setProperty(r,``):r===`float`?e.cssFloat=``:e[r]=``);for(var a in t)r=t[a],t.hasOwnProperty(a)&&n[a]!==r&&Wt(e,a,r)}else for(var o in t)t.hasOwnProperty(o)&&Wt(e,o,t[o])}function Kt(e){if(e.indexOf(`-`)===-1)return!1;switch(e){case`annotation-xml`:case`color-profile`:case`font-face`:case`font-face-src`:case`font-face-uri`:case`font-face-format`:case`font-face-name`:case`missing-glyph`:return!1;default:return!0}}var qt=new Map([[`acceptCharset`,`accept-charset`],[`htmlFor`,`for`],[`httpEquiv`,`http-equiv`],[`crossOrigin`,`crossorigin`],[`accentHeight`,`accent-height`],[`alignmentBaseline`,`alignment-baseline`],[`arabicForm`,`arabic-form`],[`baselineShift`,`baseline-shift`],[`capHeight`,`cap-height`],[`clipPath`,`clip-path`],[`clipRule`,`clip-rule`],[`colorInterpolation`,`color-interpolation`],[`colorInterpolationFilters`,`color-interpolation-filters`],[`colorProfile`,`color-profile`],[`colorRendering`,`color-rendering`],[`dominantBaseline`,`dominant-baseline`],[`enableBackground`,`enable-background`],[`fillOpacity`,`fill-opacity`],[`fillRule`,`fill-rule`],[`floodColor`,`flood-color`],[`floodOpacity`,`flood-opacity`],[`fontFamily`,`font-family`],[`fontSize`,`font-size`],[`fontSizeAdjust`,`font-size-adjust`],[`fontStretch`,`font-stretch`],[`fontStyle`,`font-style`],[`fontVariant`,`font-variant`],[`fontWeight`,`font-weight`],[`glyphName`,`glyph-name`],[`glyphOrientationHorizontal`,`glyph-orientation-horizontal`],[`glyphOrientationVertical`,`glyph-orientation-vertical`],[`horizAdvX`,`horiz-adv-x`],[`horizOriginX`,`horiz-origin-x`],[`imageRendering`,`image-rendering`],[`letterSpacing`,`letter-spacing`],[`lightingColor`,`lighting-color`],[`markerEnd`,`marker-end`],[`markerMid`,`marker-mid`],[`markerStart`,`marker-start`],[`overlinePosition`,`overline-position`],[`overlineThickness`,`overline-thickness`],[`paintOrder`,`paint-order`],[`panose-1`,`panose-1`],[`pointerEvents`,`pointer-events`],[`renderingIntent`,`rendering-intent`],[`shapeRendering`,`shape-rendering`],[`stopColor`,`stop-color`],[`stopOpacity`,`stop-opacity`],[`strikethroughPosition`,`strikethrough-position`],[`strikethroughThickness`,`strikethrough-thickness`],[`strokeDasharray`,`stroke-dasharray`],[`strokeDashoffset`,`stroke-dashoffset`],[`strokeLinecap`,`stroke-linecap`],[`strokeLinejoin`,`stroke-linejoin`],[`strokeMiterlimit`,`stroke-miterlimit`],[`strokeOpacity`,`stroke-opacity`],[`strokeWidth`,`stroke-width`],[`textAnchor`,`text-anchor`],[`textDecoration`,`text-decoration`],[`textRendering`,`text-rendering`],[`transformOrigin`,`transform-origin`],[`underlinePosition`,`underline-position`],[`underlineThickness`,`underline-thickness`],[`unicodeBidi`,`unicode-bidi`],[`unicodeRange`,`unicode-range`],[`unitsPerEm`,`units-per-em`],[`vAlphabetic`,`v-alphabetic`],[`vHanging`,`v-hanging`],[`vIdeographic`,`v-ideographic`],[`vMathematical`,`v-mathematical`],[`vectorEffect`,`vector-effect`],[`vertAdvY`,`vert-adv-y`],[`vertOriginX`,`vert-origin-x`],[`vertOriginY`,`vert-origin-y`],[`wordSpacing`,`word-spacing`],[`writingMode`,`writing-mode`],[`xmlnsXlink`,`xmlns:xlink`],[`xHeight`,`x-height`]]),Jt=/^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*:/i;function Yt(e){return Jt.test(``+e)?`javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')`:e}function Xt(){}var Zt=null;function Qt(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var $t=null,en=null;function tn(e){var t=pt(e);if(t&&(e=t.stateNode)){var n=e[it]||null;a:switch(e=t.stateNode,t.type){case`input`:if(It(e,n.value,n.defaultValue,n.defaultValue,n.checked,n.defaultChecked,n.type,n.name),t=n.name,n.type===`radio`&&t!=null){for(n=e;n.parentNode;)n=n.parentNode;for(n=n.querySelectorAll(`input[name="`+Ft(``+t)+`"][type="radio"]`),t=0;t<n.length;t++){var r=n[t];if(r!==e&&r.form===e.form){var a=r[it]||null;if(!a)throw Error(i(90));It(r,a.value,a.defaultValue,a.defaultValue,a.checked,a.defaultChecked,a.type,a.name)}}for(t=0;t<n.length;t++)r=n[t],r.form===e.form&&Mt(r)}break a;case`textarea`:Bt(e,n.value,n.defaultValue);break a;case`select`:t=n.value,t!=null&&zt(e,!!n.multiple,t,!1)}}}var nn=!1;function rn(e,t,n){if(nn)return e(t,n);nn=!0;try{return e(t)}finally{if(nn=!1,($t!==null||en!==null)&&(Ou(),$t&&(t=$t,e=en,en=$t=null,tn(t),e)))for(t=0;t<e.length;t++)tn(e[t])}}function an(e,t){var n=e.stateNode;if(n===null)return null;var r=n[it]||null;if(r===null)return null;n=r[t];a:switch(t){case`onClick`:case`onClickCapture`:case`onDoubleClick`:case`onDoubleClickCapture`:case`onMouseDown`:case`onMouseDownCapture`:case`onMouseMove`:case`onMouseMoveCapture`:case`onMouseUp`:case`onMouseUpCapture`:case`onMouseEnter`:(r=!r.disabled)||(e=e.type,r=!(e===`button`||e===`input`||e===`select`||e===`textarea`)),e=!r;break a;default:e=!1}if(e)return null;if(n&&typeof n!=`function`)throw Error(i(231,t,typeof n));return n}var on=!(typeof window>`u`||window.document===void 0||window.document.createElement===void 0),sn=!1;if(on)try{var cn={};Object.defineProperty(cn,"passive",{get:function(){sn=!0}}),window.addEventListener(`test`,cn,cn),window.removeEventListener(`test`,cn,cn)}catch{sn=!1}var ln=null,un=null,dn=null;function fn(){if(dn)return dn;var e,t=un,n=t.length,r,i=`value`in ln?ln.value:ln.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 dn=i.slice(e,1<r?1-r:void 0)}function pn(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 mn(){return!0}function hn(){return!1}function gn(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)?mn:hn,this.isPropagationStopped=hn,this}return m(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=mn)},stopPropagation:function(){var e=this.nativeEvent;e&&(e.stopPropagation?e.stopPropagation():typeof e.cancelBubble!=`unknown`&&(e.cancelBubble=!0),this.isPropagationStopped=mn)},persist:function(){},isPersistent:mn}),t}var _n={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},vn=gn(_n),yn=m({},_n,{view:0,detail:0}),bn=gn(yn),xn,Sn,Cn,wn=m({},yn,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Fn,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!==Cn&&(Cn&&e.type===`mousemove`?(xn=e.screenX-Cn.screenX,Sn=e.screenY-Cn.screenY):Sn=xn=0,Cn=e),xn)},movementY:function(e){return`movementY`in e?e.movementY:Sn}}),Tn=gn(wn),En=gn(m({},wn,{dataTransfer:0})),Dn=gn(m({},yn,{relatedTarget:0})),On=gn(m({},_n,{animationName:0,elapsedTime:0,pseudoElement:0})),kn=gn(m({},_n,{clipboardData:function(e){return`clipboardData`in e?e.clipboardData:window.clipboardData}})),An=gn(m({},_n,{data:0})),jn={Esc:`Escape`,Spacebar:` `,Left:`ArrowLeft`,Up:`ArrowUp`,Right:`ArrowRight`,Down:`ArrowDown`,Del:`Delete`,Win:`OS`,Menu:`ContextMenu`,Apps:`ContextMenu`,Scroll:`ScrollLock`,MozPrintableKey:`Unidentified`},Mn={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`},Nn={Alt:`altKey`,Control:`ctrlKey`,Meta:`metaKey`,Shift:`shiftKey`};function Pn(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=Nn[e])?!!t[e]:!1}function Fn(){return Pn}var In=gn(m({},yn,{key:function(e){if(e.key){var t=jn[e.key]||e.key;if(t!==`Unidentified`)return t}return e.type===`keypress`?(e=pn(e),e===13?`Enter`:String.fromCharCode(e)):e.type===`keydown`||e.type===`keyup`?Mn[e.keyCode]||`Unidentified`:``},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Fn,charCode:function(e){return e.type===`keypress`?pn(e):0},keyCode:function(e){return e.type===`keydown`||e.type===`keyup`?e.keyCode:0},which:function(e){return e.type===`keypress`?pn(e):e.type===`keydown`||e.type===`keyup`?e.keyCode:0}})),Ln=gn(m({},wn,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0})),Rn=gn(m({},yn,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Fn})),zn=gn(m({},_n,{propertyName:0,elapsedTime:0,pseudoElement:0})),Bn=gn(m({},wn,{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})),Vn=gn(m({},_n,{newState:0,oldState:0})),Hn=[9,13,27,32],Un=on&&`CompositionEvent`in window,Wn=null;on&&`documentMode`in document&&(Wn=document.documentMode);var Gn=on&&`TextEvent`in window&&!Wn,Kn=on&&(!Un||Wn&&8<Wn&&11>=Wn),qn=` `,Jn=!1;function Yn(e,t){switch(e){case`keyup`:return Hn.indexOf(t.keyCode)!==-1;case`keydown`:return t.keyCode!==229;case`keypress`:case`mousedown`:case`focusout`:return!0;default:return!1}}function Xn(e){return e=e.detail,typeof e==`object`&&`data`in e?e.data:null}var Zn=!1;function Qn(e,t){switch(e){case`compositionend`:return Xn(t);case`keypress`:return t.which===32?(Jn=!0,qn):null;case`textInput`:return e=t.data,e===qn&&Jn?null:e;default:return null}}function $n(e,t){if(Zn)return e===`compositionend`||!Un&&Yn(e,t)?(e=fn(),dn=un=ln=null,Zn=!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 Kn&&t.locale!==`ko`?null:t.data;default:return null}}var er={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 tr(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t===`input`?!!er[e.type]:t===`textarea`}function nr(e,t,n,r){$t?en?en.push(r):en=[r]:$t=r,t=Nd(t,`onChange`),0<t.length&&(n=new vn(`onChange`,`change`,null,n,r),e.push({event:n,listeners:t}))}var rr=null,ir=null;function ar(e){Ed(e,0)}function or(e){if(Mt(mt(e)))return e}function sr(e,t){if(e===`change`)return t}var cr=!1;if(on){var lr;if(on){var ur=`oninput`in document;if(!ur){var dr=document.createElement(`div`);dr.setAttribute(`oninput`,`return;`),ur=typeof dr.oninput==`function`}lr=ur}else lr=!1;cr=lr&&(!document.documentMode||9<document.documentMode)}function fr(){rr&&(rr.detachEvent(`onpropertychange`,pr),ir=rr=null)}function pr(e){if(e.propertyName===`value`&&or(ir)){var t=[];nr(t,ir,e,Qt(e)),rn(ar,t)}}function mr(e,t,n){e===`focusin`?(fr(),rr=t,ir=n,rr.attachEvent(`onpropertychange`,pr)):e===`focusout`&&fr()}function hr(e){if(e===`selectionchange`||e===`keyup`||e===`keydown`)return or(ir)}function gr(e,t){if(e===`click`)return or(t)}function _r(e,t){if(e===`input`||e===`change`)return or(t)}function vr(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var yr=typeof Object.is==`function`?Object.is:vr;function br(e,t){if(yr(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(!ye.call(t,i)||!yr(e[i],t[i]))return!1}return!0}function xr(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function Sr(e,t){var n=xr(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=xr(n)}}function Cr(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Cr(e,t.parentNode):`contains`in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function wr(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=Nt(e.document);t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href==`string`}catch{n=!1}if(n)e=t.contentWindow;else break;t=Nt(e.document)}return t}function Tr(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t===`input`&&(e.type===`text`||e.type===`search`||e.type===`tel`||e.type===`url`||e.type===`password`)||t===`textarea`||e.contentEditable===`true`)}var Er=on&&`documentMode`in document&&11>=document.documentMode,Dr=null,Or=null,kr=null,Ar=!1;function jr(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Ar||Dr==null||Dr!==Nt(r)||(r=Dr,`selectionStart`in r&&Tr(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}),kr&&br(kr,r)||(kr=r,r=Nd(Or,`onSelect`),0<r.length&&(t=new vn(`onSelect`,`select`,null,t,n),e.push({event:t,listeners:r}),t.target=Dr)))}function Mr(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n[`Webkit`+e]=`webkit`+t,n[`Moz`+e]=`moz`+t,n}var Nr={animationend:Mr(`Animation`,`AnimationEnd`),animationiteration:Mr(`Animation`,`AnimationIteration`),animationstart:Mr(`Animation`,`AnimationStart`),transitionrun:Mr(`Transition`,`TransitionRun`),transitionstart:Mr(`Transition`,`TransitionStart`),transitioncancel:Mr(`Transition`,`TransitionCancel`),transitionend:Mr(`Transition`,`TransitionEnd`)},Pr={},Fr={};on&&(Fr=document.createElement(`div`).style,`AnimationEvent`in window||(delete Nr.animationend.animation,delete Nr.animationiteration.animation,delete Nr.animationstart.animation),`TransitionEvent`in window||delete Nr.transitionend.transition);function Ir(e){if(Pr[e])return Pr[e];if(!Nr[e])return e;var t=Nr[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in Fr)return Pr[e]=t[n];return e}var Lr=Ir(`animationend`),Rr=Ir(`animationiteration`),zr=Ir(`animationstart`),Br=Ir(`transitionrun`),Vr=Ir(`transitionstart`),Hr=Ir(`transitioncancel`),Ur=Ir(`transitionend`),Wr=new Map,Gr=`abort auxClick beforeToggle cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel`.split(` `);Gr.push(`scrollEnd`);function Kr(e,t){Wr.set(e,t),yt(t,[e])}var qr=typeof reportError==`function`?reportError:function(e){if(typeof window==`object`&&typeof window.ErrorEvent==`function`){var t=new window.ErrorEvent(`error`,{bubbles:!0,cancelable:!0,message:typeof e==`object`&&e&&typeof e.message==`string`?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if(typeof process==`object`&&typeof process.emit==`function`){process.emit(`uncaughtException`,e);return}console.error(e)},Jr=[],Yr=0,Xr=0;function Zr(){for(var e=Yr,t=Xr=Yr=0;t<e;){var n=Jr[t];Jr[t++]=null;var r=Jr[t];Jr[t++]=null;var i=Jr[t];Jr[t++]=null;var a=Jr[t];if(Jr[t++]=null,r!==null&&i!==null){var o=r.pending;o===null?i.next=i:(i.next=o.next,o.next=i),r.pending=i}a!==0&&ti(n,i,a)}}function Qr(e,t,n,r){Jr[Yr++]=e,Jr[Yr++]=t,Jr[Yr++]=n,Jr[Yr++]=r,Xr|=r,e.lanes|=r,e=e.alternate,e!==null&&(e.lanes|=r)}function $r(e,t,n,r){return Qr(e,t,n,r),ni(e)}function ei(e,t){return Qr(e,null,null,t),ni(e)}function ti(e,t,n){e.lanes|=n;var r=e.alternate;r!==null&&(r.lanes|=n);for(var i=!1,a=e.return;a!==null;)a.childLanes|=n,r=a.alternate,r!==null&&(r.childLanes|=n),a.tag===22&&(e=a.stateNode,e===null||e._visibility&1||(i=!0)),e=a,a=a.return;return e.tag===3?(a=e.stateNode,i&&t!==null&&(i=31-Ie(n),e=a.hiddenUpdates,r=e[i],r===null?e[i]=[t]:r.push(t),t.lane=n|536870912),a):null}function ni(e){if(50<yu)throw yu=0,bu=null,Error(i(185));for(var t=e.return;t!==null;)e=t,t=e.return;return e.tag===3?e.stateNode:null}var ri={};function ii(e,t,n,r){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function ai(e,t,n,r){return new ii(e,t,n,r)}function oi(e){return e=e.prototype,!(!e||!e.isReactComponent)}function si(e,t){var n=e.alternate;return n===null?(n=ai(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&65011712,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n.refCleanup=e.refCleanup,n}function ci(e,t){e.flags&=65011714;var n=e.alternate;return n===null?(e.childLanes=0,e.lanes=t,e.child=null,e.subtreeFlags=0,e.memoizedProps=null,e.memoizedState=null,e.updateQueue=null,e.dependencies=null,e.stateNode=null):(e.childLanes=n.childLanes,e.lanes=n.lanes,e.child=n.child,e.subtreeFlags=0,e.deletions=null,e.memoizedProps=n.memoizedProps,e.memoizedState=n.memoizedState,e.updateQueue=n.updateQueue,e.type=n.type,t=n.dependencies,e.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext}),e}function li(e,t,n,r,a,o){var s=0;if(r=e,typeof e==`function`)oi(e)&&(s=1);else if(typeof e==`string`)s=Yf(e,n,ae.current)?26:e===`html`||e===`head`||e===`body`?27:5;else a:switch(e){case k:return e=ai(31,n,t,a),e.elementType=k,e.lanes=o,e;case y:return ui(n.children,a,o,t);case b:s=8,a|=24;break;case x:return e=ai(12,n,t,a|2),e.elementType=x,e.lanes=o,e;case T:return e=ai(13,n,t,a),e.elementType=T,e.lanes=o,e;case E:return e=ai(19,n,t,a),e.elementType=E,e.lanes=o,e;default:if(typeof e==`object`&&e)switch(e.$$typeof){case C:s=10;break a;case S:s=9;break a;case w:s=11;break a;case D:s=14;break a;case O:s=16,r=null;break a}s=29,n=Error(i(130,e===null?`null`:typeof e,``)),r=null}return t=ai(s,n,t,a),t.elementType=e,t.type=r,t.lanes=o,t}function ui(e,t,n,r){return e=ai(7,e,r,t),e.lanes=n,e}function di(e,t,n){return e=ai(6,e,null,t),e.lanes=n,e}function fi(e){var t=ai(18,null,null,0);return t.stateNode=e,t}function pi(e,t,n){return t=ai(4,e.children===null?[]:e.children,e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}var mi=new WeakMap;function hi(e,t){if(typeof e==`object`&&e){var n=mi.get(e);return n===void 0?(t={value:e,source:t,stack:ve(t)},mi.set(e,t),t):n}return{value:e,source:t,stack:ve(t)}}var gi=[],_i=0,vi=null,yi=0,bi=[],xi=0,Si=null,Ci=1,wi=``;function Ti(e,t){gi[_i++]=yi,gi[_i++]=vi,vi=e,yi=t}function Ei(e,t,n){bi[xi++]=Ci,bi[xi++]=wi,bi[xi++]=Si,Si=e;var r=Ci;e=wi;var i=32-Ie(r)-1;r&=~(1<<i),n+=1;var a=32-Ie(t)+i;if(30<a){var o=i-i%5;a=(r&(1<<o)-1).toString(32),r>>=o,i-=o,Ci=1<<32-Ie(t)+i|n<<i|r,wi=a+e}else Ci=1<<a|n<<i|r,wi=e}function Di(e){e.return!==null&&(Ti(e,1),Ei(e,1,0))}function Oi(e){for(;e===vi;)vi=gi[--_i],gi[_i]=null,yi=gi[--_i],gi[_i]=null;for(;e===Si;)Si=bi[--xi],bi[xi]=null,wi=bi[--xi],bi[xi]=null,Ci=bi[--xi],bi[xi]=null}function ki(e,t){bi[xi++]=Ci,bi[xi++]=wi,bi[xi++]=Si,Ci=t.id,wi=t.overflow,Si=e}var Ai=null,ji=null,Mi=!1,Ni=null,Pi=!1,Fi=Error(i(519));function Ii(e){throw Hi(hi(Error(i(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?`text`:`HTML`,``)),e)),Fi}function Li(e){var t=e.stateNode,n=e.type,r=e.memoizedProps;switch(t[rt]=e,t[it]=r,n){case`dialog`:Dd(`cancel`,t),Dd(`close`,t);break;case`iframe`:case`object`:case`embed`:Dd(`load`,t);break;case`video`:case`audio`:for(n=0;n<Td.length;n++)Dd(Td[n],t);break;case`source`:Dd(`error`,t);break;case`img`:case`image`:case`link`:Dd(`error`,t),Dd(`load`,t);break;case`details`:Dd(`toggle`,t);break;case`input`:Dd(`invalid`,t),Lt(t,r.value,r.defaultValue,r.checked,r.defaultChecked,r.type,r.name,!0);break;case`select`:Dd(`invalid`,t);break;case`textarea`:Dd(`invalid`,t),Vt(t,r.value,r.defaultValue,r.children)}n=r.children,typeof n!=`string`&&typeof n!=`number`&&typeof n!=`bigint`||t.textContent===``+n||!0===r.suppressHydrationWarning||zd(t.textContent,n)?(r.popover!=null&&(Dd(`beforetoggle`,t),Dd(`toggle`,t)),r.onScroll!=null&&Dd(`scroll`,t),r.onScrollEnd!=null&&Dd(`scrollend`,t),r.onClick!=null&&(t.onclick=Xt),t=!0):t=!1,t||Ii(e,!0)}function Ri(e){for(Ai=e.return;Ai;)switch(Ai.tag){case 5:case 31:case 13:Pi=!1;return;case 27:case 3:Pi=!0;return;default:Ai=Ai.return}}function zi(e){if(e!==Ai)return!1;if(!Mi)return Ri(e),Mi=!0,!1;var t=e.tag,n;if((n=t!==3&&t!==27)&&((n=t===5)&&(n=e.type,n=!(n!==`form`&&n!==`button`)||K(e.type,e.memoizedProps)),n=!n),n&&ji&&Ii(e),Ri(e),t===13){if(e=e.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(i(317));ji=_f(e)}else if(t===31){if(e=e.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(i(317));ji=_f(e)}else t===27?(t=ji,af(e.type)?(e=gf,gf=null,ji=e):ji=t):ji=Ai?hf(e.stateNode.nextSibling):null;return!0}function Bi(){ji=Ai=null,Mi=!1}function Vi(){var e=Ni;return e!==null&&(au===null?au=e:au.push.apply(au,e),Ni=null),e}function Hi(e){Ni===null?Ni=[e]:Ni.push(e)}var Ui=I(null),Wi=null,Gi=null;function Ki(e,t,n){R(Ui,t._currentValue),t._currentValue=n}function qi(e){e._currentValue=Ui.current,L(Ui)}function Ji(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 Yi(e,t,n,r){var a=e.child;for(a!==null&&(a.return=e);a!==null;){var o=a.dependencies;if(o!==null){var s=a.child;o=o.firstContext;a:for(;o!==null;){var c=o;o=a;for(var l=0;l<t.length;l++)if(c.context===t[l]){o.lanes|=n,c=o.alternate,c!==null&&(c.lanes|=n),Ji(o.return,n,e),r||(s=null);break a}o=c.next}}else if(a.tag===18){if(s=a.return,s===null)throw Error(i(341));s.lanes|=n,o=s.alternate,o!==null&&(o.lanes|=n),Ji(s,n,e),s=null}else s=a.child;if(s!==null)s.return=a;else for(s=a;s!==null;){if(s===e){s=null;break}if(a=s.sibling,a!==null){a.return=s.return,s=a;break}s=s.return}a=s}}function Xi(e,t,n,r){e=null;for(var a=t,o=!1;a!==null;){if(!o){if(a.flags&524288)o=!0;else if(a.flags&262144)break}if(a.tag===10){var s=a.alternate;if(s===null)throw Error(i(387));if(s=s.memoizedProps,s!==null){var c=a.type;yr(a.pendingProps.value,s.value)||(e===null?e=[c]:e.push(c))}}else if(a===se.current){if(s=a.alternate,s===null)throw Error(i(387));s.memoizedState.memoizedState!==a.memoizedState.memoizedState&&(e===null?e=[rp]:e.push(rp))}a=a.return}e!==null&&Yi(t,e,n,r),t.flags|=262144}function Zi(e){for(e=e.firstContext;e!==null;){if(!yr(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function Qi(e){Wi=e,Gi=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function $i(e){return ta(Wi,e)}function ea(e,t){return Wi===null&&Qi(e),ta(e,t)}function ta(e,t){var n=t._currentValue;if(t={context:t,memoizedValue:n,next:null},Gi===null){if(e===null)throw Error(i(308));Gi=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else Gi=Gi.next=t;return n}var na=typeof AbortController<`u`?AbortController:function(){var e=[],t=this.signal={aborted:!1,addEventListener:function(t,n){e.push(n)}};this.abort=function(){t.aborted=!0,e.forEach(function(e){return e()})}},ra=t.unstable_scheduleCallback,ia=t.unstable_NormalPriority,aa={$$typeof:C,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function oa(){return{controller:new na,data:new Map,refCount:0}}function sa(e){e.refCount--,e.refCount===0&&ra(ia,function(){e.controller.abort()})}var ca=null,la=0,ua=0,da=null;function fa(e,t){if(ca===null){var n=ca=[];la=0,ua=yd(),da={status:`pending`,value:void 0,then:function(e){n.push(e)}}}return la++,t.then(pa,pa),t}function pa(){if(--la===0&&ca!==null){da!==null&&(da.status=`fulfilled`);var e=ca;ca=null,ua=0,da=null;for(var t=0;t<e.length;t++)(0,e[t])()}}function ma(e,t){var n=[],r={status:`pending`,value:null,reason:null,then:function(e){n.push(e)}};return e.then(function(){r.status=`fulfilled`,r.value=t;for(var e=0;e<n.length;e++)(0,n[e])(t)},function(e){for(r.status=`rejected`,r.reason=e,e=0;e<n.length;e++)(0,n[e])(void 0)}),r}var ha=P.S;P.S=function(e,t){cu=we(),typeof t==`object`&&t&&typeof t.then==`function`&&fa(e,t),ha!==null&&ha(e,t)};var ga=I(null);function _a(){var e=ga.current;return e===null?Ul.pooledCache:e}function va(e,t){t===null?R(ga,ga.current):R(ga,t.pool)}function ya(){var e=_a();return e===null?null:{parent:aa._currentValue,pool:e}}var ba=Error(i(460)),xa=Error(i(474)),Sa=Error(i(542)),Ca={then:function(){}};function wa(e){return e=e.status,e===`fulfilled`||e===`rejected`}function Ta(e,t,n){switch(n=e[n],n===void 0?e.push(t):n!==t&&(t.then(Xt,Xt),t=n),t.status){case`fulfilled`:return t.value;case`rejected`:throw e=t.reason,ka(e),e;default:if(typeof t.status==`string`)t.then(Xt,Xt);else{if(e=Ul,e!==null&&100<e.shellSuspendCounter)throw Error(i(482));e=t,e.status=`pending`,e.then(function(e){if(t.status===`pending`){var n=t;n.status=`fulfilled`,n.value=e}},function(e){if(t.status===`pending`){var n=t;n.status=`rejected`,n.reason=e}})}switch(t.status){case`fulfilled`:return t.value;case`rejected`:throw e=t.reason,ka(e),e}throw Da=t,ba}}function Ea(e){try{var t=e._init;return t(e._payload)}catch(e){throw typeof e==`object`&&e&&typeof e.then==`function`?(Da=e,ba):e}}var Da=null;function Oa(){if(Da===null)throw Error(i(459));var e=Da;return Da=null,e}function ka(e){if(e===ba||e===Sa)throw Error(i(483))}var Aa=null,ja=0;function Ma(e){var t=ja;return ja+=1,Aa===null&&(Aa=[]),Ta(Aa,e,t)}function Na(e,t){t=t.props.ref,e.ref=t===void 0?null:t}function Pa(e,t){throw t.$$typeof===g?Error(i(525)):(e=Object.prototype.toString.call(t),Error(i(31,e===`[object Object]`?`object with keys {`+Object.keys(t).join(`, `)+`}`:e)))}function Fa(e){function t(t,n){if(e){var r=t.deletions;r===null?(t.deletions=[n],t.flags|=16):r.push(n)}}function n(n,r){if(!e)return null;for(;r!==null;)t(n,r),r=r.sibling;return null}function r(e){for(var t=new Map;e!==null;)e.key===null?t.set(e.index,e):t.set(e.key,e),e=e.sibling;return t}function a(e,t){return e=si(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|=67108866,n):(r=r.index,r<n?(t.flags|=67108866,n):r)):(t.flags|=1048576,n)}function s(t){return e&&t.alternate===null&&(t.flags|=67108866),t}function c(e,t,n,r){return t===null||t.tag!==6?(t=di(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===y?d(e,t,n.props.children,r,n.key):t!==null&&(t.elementType===i||typeof i==`object`&&i&&i.$$typeof===O&&Ea(i)===t.type)?(t=a(t,n.props),Na(t,n),t.return=e,t):(t=li(n.type,n.key,n.props,null,e.mode,r),Na(t,n),t.return=e,t)}function u(e,t,n,r){return t===null||t.tag!==4||t.stateNode.containerInfo!==n.containerInfo||t.stateNode.implementation!==n.implementation?(t=pi(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=ui(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`||typeof t==`bigint`)return t=di(``+t,e.mode,n),t.return=e,t;if(typeof t==`object`&&t){switch(t.$$typeof){case _:return n=li(t.type,t.key,t.props,null,e.mode,n),Na(n,t),n.return=e,n;case v:return t=pi(t,e.mode,n),t.return=e,t;case O:return t=Ea(t),f(e,t,n)}if(N(t)||A(t))return t=ui(t,e.mode,n,null),t.return=e,t;if(typeof t.then==`function`)return f(e,Ma(t),n);if(t.$$typeof===C)return f(e,ea(e,t),n);Pa(e,t)}return null}function p(e,t,n,r){var i=t===null?null:t.key;if(typeof n==`string`&&n!==``||typeof n==`number`||typeof n==`bigint`)return i===null?c(e,t,``+n,r):null;if(typeof n==`object`&&n){switch(n.$$typeof){case _:return n.key===i?l(e,t,n,r):null;case v:return n.key===i?u(e,t,n,r):null;case O:return n=Ea(n),p(e,t,n,r)}if(N(n)||A(n))return i===null?d(e,t,n,r,null):null;if(typeof n.then==`function`)return p(e,t,Ma(n),r);if(n.$$typeof===C)return p(e,t,ea(e,n),r);Pa(e,n)}return null}function m(e,t,n,r,i){if(typeof r==`string`&&r!==``||typeof r==`number`||typeof r==`bigint`)return e=e.get(n)||null,c(t,e,``+r,i);if(typeof r==`object`&&r){switch(r.$$typeof){case _:return e=e.get(r.key===null?n:r.key)||null,l(t,e,r,i);case v:return e=e.get(r.key===null?n:r.key)||null,u(t,e,r,i);case O:return r=Ea(r),m(e,t,n,r,i)}if(N(r)||A(r))return e=e.get(n)||null,d(t,e,r,i,null);if(typeof r.then==`function`)return m(e,t,n,Ma(r),i);if(r.$$typeof===C)return m(e,t,n,ea(t,r),i);Pa(t,r)}return null}function h(i,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(i,d,s[h],c);if(_===null){d===null&&(d=g);break}e&&d&&_.alternate===null&&t(i,d),a=o(_,a,h),u===null?l=_:u.sibling=_,u=_,d=g}if(h===s.length)return n(i,d),Mi&&Ti(i,h),l;if(d===null){for(;h<s.length;h++)d=f(i,s[h],c),d!==null&&(a=o(d,a,h),u===null?l=d:u.sibling=d,u=d);return Mi&&Ti(i,h),l}for(d=r(d);h<s.length;h++)g=m(d,i,h,s[h],c),g!==null&&(e&&g.alternate!==null&&d.delete(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(i,e)}),Mi&&Ti(i,h),l}function g(a,s,c,l){if(c==null)throw Error(i(151));for(var u=null,d=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),Mi&&Ti(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 Mi&&Ti(a,g),u}for(h=r(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)}),Mi&&Ti(a,g),u}function b(e,r,o,c){if(typeof o==`object`&&o&&o.type===y&&o.key===null&&(o=o.props.children),typeof o==`object`&&o){switch(o.$$typeof){case _:a:{for(var l=o.key;r!==null;){if(r.key===l){if(l=o.type,l===y){if(r.tag===7){n(e,r.sibling),c=a(r,o.props.children),c.return=e,e=c;break a}}else if(r.elementType===l||typeof l==`object`&&l&&l.$$typeof===O&&Ea(l)===r.type){n(e,r.sibling),c=a(r,o.props),Na(c,o),c.return=e,e=c;break a}n(e,r);break}else t(e,r);r=r.sibling}o.type===y?(c=ui(o.props.children,e.mode,c,o.key),c.return=e,e=c):(c=li(o.type,o.key,o.props,null,e.mode,c),Na(c,o),c.return=e,e=c)}return s(e);case v:a:{for(l=o.key;r!==null;){if(r.key===l)if(r.tag===4&&r.stateNode.containerInfo===o.containerInfo&&r.stateNode.implementation===o.implementation){n(e,r.sibling),c=a(r,o.children||[]),c.return=e,e=c;break a}else{n(e,r);break}else t(e,r);r=r.sibling}c=pi(o,e.mode,c),c.return=e,e=c}return s(e);case O:return o=Ea(o),b(e,r,o,c)}if(N(o))return h(e,r,o,c);if(A(o)){if(l=A(o),typeof l!=`function`)throw Error(i(150));return o=l.call(o),g(e,r,o,c)}if(typeof o.then==`function`)return b(e,r,Ma(o),c);if(o.$$typeof===C)return b(e,r,ea(e,o),c);Pa(e,o)}return typeof o==`string`&&o!==``||typeof o==`number`||typeof o==`bigint`?(o=``+o,r!==null&&r.tag===6?(n(e,r.sibling),c=a(r,o),c.return=e,e=c):(n(e,r),c=di(o,e.mode,c),c.return=e,e=c),s(e)):n(e,r)}return function(e,t,n,r){try{ja=0;var i=b(e,t,n,r);return Aa=null,i}catch(t){if(t===ba||t===Sa)throw t;var a=ai(29,t,null,e.mode);return a.lanes=r,a.return=e,a}}}var Ia=Fa(!0),La=Fa(!1),Ra=!1;function za(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Ba(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,callbacks:null})}function Va(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function Ha(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,Hl&2){var i=r.pending;return i===null?t.next=t:(t.next=i.next,i.next=t),r.pending=t,t=ni(e),ti(e,null,n),t}return Qr(e,r,t,n),ni(e)}function Ua(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,n&4194048)){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Xe(e,n)}}function Wa(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var i=null,a=null;if(n=n.firstBaseUpdate,n!==null){do{var o={lane:n.lane,tag:n.tag,payload:n.payload,callback:null,next:null};a===null?i=a=o:a=a.next=o,n=n.next}while(n!==null);a===null?i=a=t:a=a.next=t}else i=a=t;n={baseState:r.baseState,firstBaseUpdate:i,lastBaseUpdate:a,shared:r.shared,callbacks:r.callbacks},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}var Ga=!1;function Ka(){if(Ga){var e=da;if(e!==null)throw e}}function qa(e,t,n,r){Ga=!1;var i=e.updateQueue;Ra=!1;var a=i.firstBaseUpdate,o=i.lastBaseUpdate,s=i.shared.pending;if(s!==null){i.shared.pending=null;var c=s,l=c.next;c.next=null,o===null?a=l:o.next=l,o=c;var u=e.alternate;u!==null&&(u=u.updateQueue,s=u.lastBaseUpdate,s!==o&&(s===null?u.firstBaseUpdate=l:s.next=l,u.lastBaseUpdate=c))}if(a!==null){var d=i.baseState;o=0,u=l=c=null,s=a;do{var f=s.lane&-536870913,p=f!==s.lane;if(p?(Gl&f)===f:(r&f)===f){f!==0&&f===ua&&(Ga=!0),u!==null&&(u=u.next={lane:0,tag:s.tag,payload:s.payload,callback:null,next:null});a:{var h=e,g=s;f=t;var _=n;switch(g.tag){case 1:if(h=g.payload,typeof h==`function`){d=h.call(_,d,f);break a}d=h;break a;case 3:h.flags=h.flags&-65537|128;case 0:if(h=g.payload,f=typeof h==`function`?h.call(_,d,f):h,f==null)break a;d=m({},d,f);break a;case 2:Ra=!0}}f=s.callback,f!==null&&(e.flags|=64,p&&(e.flags|=8192),p=i.callbacks,p===null?i.callbacks=[f]:p.push(f))}else p={lane:f,tag:s.tag,payload:s.payload,callback:s.callback,next:null},u===null?(l=u=p,c=d):u=u.next=p,o|=f;if(s=s.next,s===null){if(s=i.shared.pending,s===null)break;p=s,s=p.next,p.next=null,i.lastBaseUpdate=p,i.shared.pending=null}}while(1);u===null&&(c=d),i.baseState=c,i.firstBaseUpdate=l,i.lastBaseUpdate=u,a===null&&(i.shared.lanes=0),$l|=o,e.lanes=o,e.memoizedState=d}}function Ja(e,t){if(typeof e!=`function`)throw Error(i(191,e));e.call(t)}function Ya(e,t){var n=e.callbacks;if(n!==null)for(e.callbacks=null,e=0;e<n.length;e++)Ja(n[e],t)}var Xa=I(null),Za=I(0);function Qa(e,t){e=Zl,R(Za,e),R(Xa,t),Zl=e|t.baseLanes}function $a(){R(Za,Zl),R(Xa,Xa.current)}function eo(){Zl=Za.current,L(Xa),L(Za)}var to=I(null),no=null;function ro(e){var t=e.alternate;R(co,co.current&1),R(to,e),no===null&&(t===null||Xa.current!==null||t.memoizedState!==null)&&(no=e)}function io(e){R(co,co.current),R(to,e),no===null&&(no=e)}function ao(e){e.tag===22?(R(co,co.current),R(to,e),no===null&&(no=e)):oo(e)}function oo(){R(co,co.current),R(to,to.current)}function so(e){L(to),no===e&&(no=null),L(co)}var co=I(0);function lo(e){for(var t=e;t!==null;){if(t.tag===13){var n=t.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||ff(n)||pf(n)))return t}else if(t.tag===19&&(t.memoizedProps.revealOrder===`forwards`||t.memoizedProps.revealOrder===`backwards`||t.memoizedProps.revealOrder===`unstable_legacy-backwards`||t.memoizedProps.revealOrder===`together`)){if(t.flags&128)return t}else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var uo=0,H=null,fo=null,po=null,mo=!1,ho=!1,go=!1,_o=0,vo=0,yo=null,bo=0;function xo(){throw Error(i(321))}function So(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!yr(e[n],t[n]))return!1;return!0}function Co(e,t,n,r,i,a){return uo=a,H=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,P.H=e===null||e.memoizedState===null?Bs:Vs,go=!1,a=n(r,i),go=!1,ho&&(a=To(t,n,r,i)),wo(e),a}function wo(e){P.H=zs;var t=fo!==null&&fo.next!==null;if(uo=0,po=fo=H=null,mo=!1,vo=0,yo=null,t)throw Error(i(300));e===null||ic||(e=e.dependencies,e!==null&&Zi(e)&&(ic=!0))}function To(e,t,n,r){H=e;var a=0;do{if(ho&&(yo=null),vo=0,ho=!1,25<=a)throw Error(i(301));if(a+=1,po=fo=null,e.updateQueue!=null){var o=e.updateQueue;o.lastEffect=null,o.events=null,o.stores=null,o.memoCache!=null&&(o.memoCache.index=0)}P.H=Hs,o=t(n,r)}while(ho);return o}function Eo(){var e=P.H,t=e.useState()[0];return t=typeof t.then==`function`?No(t):t,e=e.useState()[0],(fo===null?null:fo.memoizedState)!==e&&(H.flags|=1024),t}function Do(){var e=_o!==0;return _o=0,e}function Oo(e,t,n){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~n}function ko(e){if(mo){for(e=e.memoizedState;e!==null;){var t=e.queue;t!==null&&(t.pending=null),e=e.next}mo=!1}uo=0,po=fo=H=null,ho=!1,vo=_o=0,yo=null}function Ao(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return po===null?H.memoizedState=po=e:po=po.next=e,po}function jo(){if(fo===null){var e=H.alternate;e=e===null?null:e.memoizedState}else e=fo.next;var t=po===null?H.memoizedState:po.next;if(t!==null)po=t,fo=e;else{if(e===null)throw H.alternate===null?Error(i(467)):Error(i(310));fo=e,e={memoizedState:fo.memoizedState,baseState:fo.baseState,baseQueue:fo.baseQueue,queue:fo.queue,next:null},po===null?H.memoizedState=po=e:po=po.next=e}return po}function Mo(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function No(e){var t=vo;return vo+=1,yo===null&&(yo=[]),e=Ta(yo,e,t),t=H,(po===null?t.memoizedState:po.next)===null&&(t=t.alternate,P.H=t===null||t.memoizedState===null?Bs:Vs),e}function Po(e){if(typeof e==`object`&&e){if(typeof e.then==`function`)return No(e);if(e.$$typeof===C)return $i(e)}throw Error(i(438,String(e)))}function Fo(e){var t=null,n=H.updateQueue;if(n!==null&&(t=n.memoCache),t==null){var r=H.alternate;r!==null&&(r=r.updateQueue,r!==null&&(r=r.memoCache,r!=null&&(t={data:r.data.map(function(e){return e.slice()}),index:0})))}if(t??={data:[],index:0},n===null&&(n=Mo(),H.updateQueue=n),n.memoCache=t,n=t.data[t.index],n===void 0)for(n=t.data[t.index]=Array(e),r=0;r<e;r++)n[r]=ee;return t.index++,n}function Io(e,t){return typeof t==`function`?t(e):t}function Lo(e){return Ro(jo(),fo,e)}function Ro(e,t,n){var r=e.queue;if(r===null)throw Error(i(311));r.lastRenderedReducer=n;var a=e.baseQueue,o=r.pending;if(o!==null){if(a!==null){var s=a.next;a.next=o.next,o.next=s}t.baseQueue=a=o,r.pending=null}if(o=e.baseState,a===null)e.memoizedState=o;else{t=a.next;var c=s=null,l=null,u=t,d=!1;do{var f=u.lane&-536870913;if(f===u.lane?(uo&f)===f:(Gl&f)===f){var p=u.revertLane;if(p===0)l!==null&&(l=l.next={lane:0,revertLane:0,gesture:null,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null}),f===ua&&(d=!0);else if((uo&p)===p){u=u.next,p===ua&&(d=!0);continue}else f={lane:0,revertLane:u.revertLane,gesture:null,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null},l===null?(c=l=f,s=o):l=l.next=f,H.lanes|=p,$l|=p;f=u.action,go&&n(o,f),o=u.hasEagerState?u.eagerState:n(o,f)}else p={lane:f,revertLane:u.revertLane,gesture:u.gesture,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null},l===null?(c=l=p,s=o):l=l.next=p,H.lanes|=f,$l|=f;u=u.next}while(u!==null&&u!==t);if(l===null?s=o:l.next=c,!yr(o,e.memoizedState)&&(ic=!0,d&&(n=da,n!==null)))throw n;e.memoizedState=o,e.baseState=s,e.baseQueue=l,r.lastRenderedState=o}return a===null&&(r.lanes=0),[e.memoizedState,r.dispatch]}function zo(e){var t=jo(),n=t.queue;if(n===null)throw Error(i(311));n.lastRenderedReducer=e;var r=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);yr(o,t.memoizedState)||(ic=!0),t.memoizedState=o,t.baseQueue===null&&(t.baseState=o),n.lastRenderedState=o}return[o,r]}function Bo(e,t,n){var r=H,a=jo(),o=Mi;if(o){if(n===void 0)throw Error(i(407));n=n()}else n=t();var s=!yr((fo||a).memoizedState,n);if(s&&(a.memoizedState=n,ic=!0),a=a.queue,ds(Uo.bind(null,r,a,e),[e]),a.getSnapshot!==t||s||po!==null&&po.memoizedState.tag&1){if(r.flags|=2048,os(9,{destroy:void 0},Ho.bind(null,r,a,n,t),null),Ul===null)throw Error(i(349));o||uo&127||Vo(r,t,n)}return n}function Vo(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=H.updateQueue,t===null?(t=Mo(),H.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function Ho(e,t,n,r){t.value=n,t.getSnapshot=r,Wo(t)&&Go(e)}function Uo(e,t,n){return n(function(){Wo(t)&&Go(e)})}function Wo(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!yr(e,n)}catch{return!0}}function Go(e){var t=ei(e,2);t!==null&&Cu(t,e,2)}function Ko(e){var t=Ao();if(typeof e==`function`){var n=e;if(e=n(),go){Fe(!0);try{n()}finally{Fe(!1)}}}return t.memoizedState=t.baseState=e,t.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Io,lastRenderedState:e},t}function qo(e,t,n,r){return e.baseState=n,Ro(e,fo,typeof r==`function`?r:Io)}function Jo(e,t,n,r,a){if(Is(e))throw Error(i(485));if(e=t.action,e!==null){var o={payload:a,action:e,next:null,isTransition:!0,status:`pending`,value:null,reason:null,listeners:[],then:function(e){o.listeners.push(e)}};P.T===null?o.isTransition=!1:n(!0),r(o),n=t.pending,n===null?(o.next=t.pending=o,Yo(t,o)):(o.next=n.next,t.pending=n.next=o)}}function Yo(e,t){var n=t.action,r=t.payload,i=e.state;if(t.isTransition){var a=P.T,o={};P.T=o;try{var s=n(i,r),c=P.S;c!==null&&c(o,s),Xo(e,t,s)}catch(n){Qo(e,t,n)}finally{a!==null&&o.types!==null&&(a.types=o.types),P.T=a}}else try{a=n(i,r),Xo(e,t,a)}catch(n){Qo(e,t,n)}}function Xo(e,t,n){typeof n==`object`&&n&&typeof n.then==`function`?n.then(function(n){Zo(e,t,n)},function(n){return Qo(e,t,n)}):Zo(e,t,n)}function Zo(e,t,n){t.status=`fulfilled`,t.value=n,$o(t),e.state=n,t=e.pending,t!==null&&(n=t.next,n===t?e.pending=null:(n=n.next,t.next=n,Yo(e,n)))}function Qo(e,t,n){var r=e.pending;if(e.pending=null,r!==null){r=r.next;do t.status=`rejected`,t.reason=n,$o(t),t=t.next;while(t!==r)}e.action=null}function $o(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function es(e,t){return t}function ts(e,t){if(Mi){var n=Ul.formState;if(n!==null){a:{var r=H;if(Mi){if(ji){b:{for(var i=ji,a=Pi;i.nodeType!==8;){if(!a){i=null;break b}if(i=hf(i.nextSibling),i===null){i=null;break b}}a=i.data,i=a===`F!`||a===`F`?i:null}if(i){ji=hf(i.nextSibling),r=i.data===`F!`;break a}}Ii(r)}r=!1}r&&(t=n[0])}}return n=Ao(),n.memoizedState=n.baseState=t,r={pending:null,lanes:0,dispatch:null,lastRenderedReducer:es,lastRenderedState:t},n.queue=r,n=Ns.bind(null,H,r),r.dispatch=n,r=Ko(!1),a=Fs.bind(null,H,!1,r.queue),r=Ao(),i={state:t,dispatch:null,action:e,pending:null},r.queue=i,n=Jo.bind(null,H,i,a,n),i.dispatch=n,r.memoizedState=e,[t,n,!1]}function ns(e){return rs(jo(),fo,e)}function rs(e,t,n){if(t=Ro(e,t,es)[0],e=Lo(Io)[0],typeof t==`object`&&t&&typeof t.then==`function`)try{var r=No(t)}catch(e){throw e===ba?Sa:e}else r=t;t=jo();var i=t.queue,a=i.dispatch;return n!==t.memoizedState&&(H.flags|=2048,os(9,{destroy:void 0},is.bind(null,i,n),null)),[r,a,e]}function is(e,t){e.action=t}function as(e){var t=jo(),n=fo;if(n!==null)return rs(t,n,e);jo(),t=t.memoizedState,n=jo();var r=n.queue.dispatch;return n.memoizedState=e,[t,r,!1]}function os(e,t,n,r){return e={tag:e,create:n,deps:r,inst:t,next:null},t=H.updateQueue,t===null&&(t=Mo(),H.updateQueue=t),n=t.lastEffect,n===null?t.lastEffect=e.next=e:(r=n.next,n.next=e,e.next=r,t.lastEffect=e),e}function ss(){return jo().memoizedState}function cs(e,t,n,r){var i=Ao();H.flags|=e,i.memoizedState=os(1|t,{destroy:void 0},n,r===void 0?null:r)}function ls(e,t,n,r){var i=jo();r=r===void 0?null:r;var a=i.memoizedState.inst;fo!==null&&r!==null&&So(r,fo.memoizedState.deps)?i.memoizedState=os(t,a,n,r):(H.flags|=e,i.memoizedState=os(1|t,a,n,r))}function us(e,t){cs(8390656,8,e,t)}function ds(e,t){ls(2048,8,e,t)}function fs(e){H.flags|=4;var t=H.updateQueue;if(t===null)t=Mo(),H.updateQueue=t,t.events=[e];else{var n=t.events;n===null?t.events=[e]:n.push(e)}}function ps(e){var t=jo().memoizedState;return fs({ref:t,nextImpl:e}),function(){if(Hl&2)throw Error(i(440));return t.impl.apply(void 0,arguments)}}function ms(e,t){return ls(4,2,e,t)}function hs(e,t){return ls(4,4,e,t)}function gs(e,t){if(typeof t==`function`){e=e();var n=t(e);return function(){typeof n==`function`?n():t(null)}}if(t!=null)return e=e(),t.current=e,function(){t.current=null}}function _s(e,t,n){n=n==null?null:n.concat([e]),ls(4,4,gs.bind(null,t,e),n)}function vs(){}function ys(e,t){var n=jo();t=t===void 0?null:t;var r=n.memoizedState;return t!==null&&So(t,r[1])?r[0]:(n.memoizedState=[e,t],e)}function bs(e,t){var n=jo();t=t===void 0?null:t;var r=n.memoizedState;if(t!==null&&So(t,r[1]))return r[0];if(r=e(),go){Fe(!0);try{e()}finally{Fe(!1)}}return n.memoizedState=[r,t],r}function xs(e,t,n){return n===void 0||uo&1073741824&&!(Gl&261930)?e.memoizedState=t:(e.memoizedState=n,e=Su(),H.lanes|=e,$l|=e,n)}function Ss(e,t,n,r){return yr(n,t)?n:Xa.current===null?!(uo&42)||uo&1073741824&&!(Gl&261930)?(ic=!0,e.memoizedState=n):(e=Su(),H.lanes|=e,$l|=e,t):(e=xs(e,n,r),yr(e,t)||(ic=!0),e)}function Cs(e,t,n,r,i){var a=F.p;F.p=a!==0&&8>a?a:8;var o=P.T,s={};P.T=s,Fs(e,!1,t,n);try{var c=i(),l=P.S;l!==null&&l(s,c),typeof c==`object`&&c&&typeof c.then==`function`?Ps(e,t,ma(c,r),xu(e)):Ps(e,t,r,xu(e))}catch(n){Ps(e,t,{then:function(){},status:`rejected`,reason:n},xu())}finally{F.p=a,o!==null&&s.types!==null&&(o.types=s.types),P.T=o}}function ws(){}function Ts(e,t,n,r){if(e.tag!==5)throw Error(i(476));var a=Es(e).queue;Cs(e,a,t,ne,n===null?ws:function(){return Ds(e),n(r)})}function Es(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:ne,baseState:ne,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Io,lastRenderedState:ne},next:null};var n={};return t.next={memoizedState:n,baseState:n,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Io,lastRenderedState:n},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function Ds(e){var t=Es(e);t.next===null&&(t=e.alternate.memoizedState),Ps(e,t.next.queue,{},xu())}function Os(){return $i(rp)}function ks(){return jo().memoizedState}function As(){return jo().memoizedState}function js(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var n=xu();e=Va(n);var r=Ha(t,e,n);r!==null&&(Cu(r,t,n),Ua(r,t,n)),t={cache:oa()},e.payload=t;return}t=t.return}}function Ms(e,t,n){var r=xu();n={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null},Is(e)?Ls(t,n):(n=$r(e,t,n,r),n!==null&&(Cu(n,e,r),Rs(n,t,r)))}function Ns(e,t,n){Ps(e,t,n,xu())}function Ps(e,t,n,r){var i={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null};if(Is(e))Ls(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,yr(s,o))return Qr(e,t,i,0),Ul===null&&Zr(),!1}catch{}if(n=$r(e,t,i,r),n!==null)return Cu(n,e,r),Rs(n,t,r),!0}return!1}function Fs(e,t,n,r){if(r={lane:2,revertLane:yd(),gesture:null,action:r,hasEagerState:!1,eagerState:null,next:null},Is(e)){if(t)throw Error(i(479))}else t=$r(e,n,r,2),t!==null&&Cu(t,e,2)}function Is(e){var t=e.alternate;return e===H||t!==null&&t===H}function Ls(e,t){ho=mo=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function Rs(e,t,n){if(n&4194048){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Xe(e,n)}}var zs={readContext:$i,use:Po,useCallback:xo,useContext:xo,useEffect:xo,useImperativeHandle:xo,useLayoutEffect:xo,useInsertionEffect:xo,useMemo:xo,useReducer:xo,useRef:xo,useState:xo,useDebugValue:xo,useDeferredValue:xo,useTransition:xo,useSyncExternalStore:xo,useId:xo,useHostTransitionStatus:xo,useFormState:xo,useActionState:xo,useOptimistic:xo,useMemoCache:xo,useCacheRefresh:xo};zs.useEffectEvent=xo;var Bs={readContext:$i,use:Po,useCallback:function(e,t){return Ao().memoizedState=[e,t===void 0?null:t],e},useContext:$i,useEffect:us,useImperativeHandle:function(e,t,n){n=n==null?null:n.concat([e]),cs(4194308,4,gs.bind(null,t,e),n)},useLayoutEffect:function(e,t){return cs(4194308,4,e,t)},useInsertionEffect:function(e,t){cs(4,2,e,t)},useMemo:function(e,t){var n=Ao();t=t===void 0?null:t;var r=e();if(go){Fe(!0);try{e()}finally{Fe(!1)}}return n.memoizedState=[r,t],r},useReducer:function(e,t,n){var r=Ao();if(n!==void 0){var i=n(t);if(go){Fe(!0);try{n(t)}finally{Fe(!1)}}}else i=t;return r.memoizedState=r.baseState=i,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:i},r.queue=e,e=e.dispatch=Ms.bind(null,H,e),[r.memoizedState,e]},useRef:function(e){var t=Ao();return e={current:e},t.memoizedState=e},useState:function(e){e=Ko(e);var t=e.queue,n=Ns.bind(null,H,t);return t.dispatch=n,[e.memoizedState,n]},useDebugValue:vs,useDeferredValue:function(e,t){return xs(Ao(),e,t)},useTransition:function(){var e=Ko(!1);return e=Cs.bind(null,H,e.queue,!0,!1),Ao().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,n){var r=H,a=Ao();if(Mi){if(n===void 0)throw Error(i(407));n=n()}else{if(n=t(),Ul===null)throw Error(i(349));Gl&127||Vo(r,t,n)}a.memoizedState=n;var o={value:n,getSnapshot:t};return a.queue=o,us(Uo.bind(null,r,o,e),[e]),r.flags|=2048,os(9,{destroy:void 0},Ho.bind(null,r,o,n,t),null),n},useId:function(){var e=Ao(),t=Ul.identifierPrefix;if(Mi){var n=wi,r=Ci;n=(r&~(1<<32-Ie(r)-1)).toString(32)+n,t=`_`+t+`R_`+n,n=_o++,0<n&&(t+=`H`+n.toString(32)),t+=`_`}else n=bo++,t=`_`+t+`r_`+n.toString(32)+`_`;return e.memoizedState=t},useHostTransitionStatus:Os,useFormState:ts,useActionState:ts,useOptimistic:function(e){var t=Ao();t.memoizedState=t.baseState=e;var n={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return t.queue=n,t=Fs.bind(null,H,!0,n),n.dispatch=t,[e,t]},useMemoCache:Fo,useCacheRefresh:function(){return Ao().memoizedState=js.bind(null,H)},useEffectEvent:function(e){var t=Ao(),n={impl:e};return t.memoizedState=n,function(){if(Hl&2)throw Error(i(440));return n.impl.apply(void 0,arguments)}}},Vs={readContext:$i,use:Po,useCallback:ys,useContext:$i,useEffect:ds,useImperativeHandle:_s,useInsertionEffect:ms,useLayoutEffect:hs,useMemo:bs,useReducer:Lo,useRef:ss,useState:function(){return Lo(Io)},useDebugValue:vs,useDeferredValue:function(e,t){return Ss(jo(),fo.memoizedState,e,t)},useTransition:function(){var e=Lo(Io)[0],t=jo().memoizedState;return[typeof e==`boolean`?e:No(e),t]},useSyncExternalStore:Bo,useId:ks,useHostTransitionStatus:Os,useFormState:ns,useActionState:ns,useOptimistic:function(e,t){return qo(jo(),fo,e,t)},useMemoCache:Fo,useCacheRefresh:As};Vs.useEffectEvent=ps;var Hs={readContext:$i,use:Po,useCallback:ys,useContext:$i,useEffect:ds,useImperativeHandle:_s,useInsertionEffect:ms,useLayoutEffect:hs,useMemo:bs,useReducer:zo,useRef:ss,useState:function(){return zo(Io)},useDebugValue:vs,useDeferredValue:function(e,t){var n=jo();return fo===null?xs(n,e,t):Ss(n,fo.memoizedState,e,t)},useTransition:function(){var e=zo(Io)[0],t=jo().memoizedState;return[typeof e==`boolean`?e:No(e),t]},useSyncExternalStore:Bo,useId:ks,useHostTransitionStatus:Os,useFormState:as,useActionState:as,useOptimistic:function(e,t){var n=jo();return fo===null?(n.baseState=e,[e,n.queue.dispatch]):qo(n,fo,e,t)},useMemoCache:Fo,useCacheRefresh:As};Hs.useEffectEvent=ps;function Us(e,t,n,r){t=e.memoizedState,n=n(r,t),n=n==null?t:m({},t,n),e.memoizedState=n,e.lanes===0&&(e.updateQueue.baseState=n)}var Ws={enqueueSetState:function(e,t,n){e=e._reactInternals;var r=xu(),i=Va(r);i.payload=t,n!=null&&(i.callback=n),t=Ha(e,i,r),t!==null&&(Cu(t,e,r),Ua(t,e,r))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var r=xu(),i=Va(r);i.tag=1,i.payload=t,n!=null&&(i.callback=n),t=Ha(e,i,r),t!==null&&(Cu(t,e,r),Ua(t,e,r))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=xu(),r=Va(n);r.tag=2,t!=null&&(r.callback=t),t=Ha(e,r,n),t!==null&&(Cu(t,e,n),Ua(t,e,n))}};function Gs(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?!br(n,r)||!br(i,a):!0}function Ks(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&&Ws.enqueueReplaceState(t,t.state,null)}function qs(e,t){var n=t;if(`ref`in t)for(var r in n={},t)r!==`ref`&&(n[r]=t[r]);if(e=e.defaultProps)for(var i in n===t&&(n=m({},n)),e)n[i]===void 0&&(n[i]=e[i]);return n}function Js(e){qr(e)}function Ys(e){console.error(e)}function Xs(e){qr(e)}function Zs(e,t){try{var n=e.onUncaughtError;n(t.value,{componentStack:t.stack})}catch(e){setTimeout(function(){throw e})}}function Qs(e,t,n){try{var r=e.onCaughtError;r(n.value,{componentStack:n.stack,errorBoundary:t.tag===1?t.stateNode:null})}catch(e){setTimeout(function(){throw e})}}function $s(e,t,n){return n=Va(n),n.tag=3,n.payload={element:null},n.callback=function(){Zs(e,t)},n}function ec(e){return e=Va(e),e.tag=3,e}function tc(e,t,n,r){var i=n.type.getDerivedStateFromError;if(typeof i==`function`){var a=r.value;e.payload=function(){return i(a)},e.callback=function(){Qs(t,n,r)}}var o=n.stateNode;o!==null&&typeof o.componentDidCatch==`function`&&(e.callback=function(){Qs(t,n,r),typeof i!=`function`&&(du===null?du=new Set([this]):du.add(this));var e=r.stack;this.componentDidCatch(r.value,{componentStack:e===null?``:e})})}function nc(e,t,n,r,a){if(n.flags|=32768,typeof r==`object`&&r&&typeof r.then==`function`){if(t=n.alternate,t!==null&&Xi(t,n,a,!0),n=to.current,n!==null){switch(n.tag){case 31:case 13:return no===null?Fu():n.alternate===null&&Ql===0&&(Ql=3),n.flags&=-257,n.flags|=65536,n.lanes=a,r===Ca?n.flags|=16384:(t=n.updateQueue,t===null?n.updateQueue=new Set([r]):t.add(r),ed(e,r,a)),!1;case 22:return n.flags|=65536,r===Ca?n.flags|=16384:(t=n.updateQueue,t===null?(t={transitions:null,markerInstances:null,retryQueue:new Set([r])},n.updateQueue=t):(n=t.retryQueue,n===null?t.retryQueue=new Set([r]):n.add(r)),ed(e,r,a)),!1}throw Error(i(435,n.tag))}return ed(e,r,a),Fu(),!1}if(Mi)return t=to.current,t===null?(r!==Fi&&(t=Error(i(423),{cause:r}),Hi(hi(t,n))),e=e.current.alternate,e.flags|=65536,a&=-a,e.lanes|=a,r=hi(r,n),a=$s(e.stateNode,r,a),Wa(e,a),Ql!==4&&(Ql=2)):(!(t.flags&65536)&&(t.flags|=256),t.flags|=65536,t.lanes=a,r!==Fi&&(e=Error(i(422),{cause:r}),Hi(hi(e,n)))),!1;var o=Error(i(520),{cause:r});if(o=hi(o,n),iu===null?iu=[o]:iu.push(o),Ql!==4&&(Ql=2),t===null)return!0;r=hi(r,n),n=t;do{switch(n.tag){case 3:return n.flags|=65536,e=a&-a,n.lanes|=e,e=$s(n.stateNode,r,e),Wa(n,e),!1;case 1:if(t=n.type,o=n.stateNode,!(n.flags&128)&&(typeof t.getDerivedStateFromError==`function`||o!==null&&typeof o.componentDidCatch==`function`&&(du===null||!du.has(o))))return n.flags|=65536,a&=-a,n.lanes|=a,a=ec(a),tc(a,e,n,r),Wa(n,a),!1}n=n.return}while(n!==null);return!1}var rc=Error(i(461)),ic=!1;function ac(e,t,n,r){t.child=e===null?La(t,null,n,r):Ia(t,e.child,n,r)}function oc(e,t,n,r,i){n=n.render;var a=t.ref;if(`ref`in r){var o={};for(var s in r)s!==`ref`&&(o[s]=r[s])}else o=r;return Qi(t),r=Co(e,t,n,o,a,i),s=Do(),e!==null&&!ic?(Oo(e,t,i),Ac(e,t,i)):(Mi&&s&&Di(t),t.flags|=1,ac(e,t,r,i),t.child)}function sc(e,t,n,r,i){if(e===null){var a=n.type;return typeof a==`function`&&!oi(a)&&a.defaultProps===void 0&&n.compare===null?(t.tag=15,t.type=a,cc(e,t,a,r,i)):(e=li(n.type,null,r,t,t.mode,i),e.ref=t.ref,e.return=t,t.child=e)}if(a=e.child,!jc(e,i)){var o=a.memoizedProps;if(n=n.compare,n=n===null?br:n,n(o,r)&&e.ref===t.ref)return Ac(e,t,i)}return t.flags|=1,e=si(a,r),e.ref=t.ref,e.return=t,t.child=e}function cc(e,t,n,r,i){if(e!==null){var a=e.memoizedProps;if(br(a,r)&&e.ref===t.ref)if(ic=!1,t.pendingProps=r=a,jc(e,i))e.flags&131072&&(ic=!0);else return t.lanes=e.lanes,Ac(e,t,i)}return gc(e,t,n,r,i)}function lc(e,t,n,r){var i=r.children,a=e===null?null:e.memoizedState;if(e===null&&t.stateNode===null&&(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),r.mode===`hidden`){if(t.flags&128){if(a=a===null?n:a.baseLanes|n,e!==null){for(r=t.child=e.child,i=0;r!==null;)i=i|r.lanes|r.childLanes,r=r.sibling;r=i&~a}else r=0,t.child=null;return dc(e,t,a,n,r)}if(n&536870912)t.memoizedState={baseLanes:0,cachePool:null},e!==null&&va(t,a===null?null:a.cachePool),a===null?$a():Qa(t,a),ao(t);else return r=t.lanes=536870912,dc(e,t,a===null?n:a.baseLanes|n,n,r)}else a===null?(e!==null&&va(t,null),$a(),oo(t)):(va(t,a.cachePool),Qa(t,a),oo(t),t.memoizedState=null);return ac(e,t,i,n),t.child}function uc(e,t){return e!==null&&e.tag===22||t.stateNode!==null||(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),t.sibling}function dc(e,t,n,r,i){var a=_a();return a=a===null?null:{parent:aa._currentValue,pool:a},t.memoizedState={baseLanes:n,cachePool:a},e!==null&&va(t,null),$a(),ao(t),e!==null&&Xi(e,t,r,!0),t.childLanes=i,null}function fc(e,t){return t=Tc({mode:t.mode,children:t.children},e.mode),t.ref=e.ref,e.child=t,t.return=e,t}function pc(e,t,n){return Ia(t,e.child,null,n),e=fc(t,t.pendingProps),e.flags|=2,so(t),t.memoizedState=null,e}function mc(e,t,n){var r=t.pendingProps,a=(t.flags&128)!=0;if(t.flags&=-129,e===null){if(Mi){if(r.mode===`hidden`)return e=fc(t,r),t.lanes=536870912,uc(null,e);if(io(t),(e=ji)?(e=df(e,Pi),e=e!==null&&e.data===`&`?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:Si===null?null:{id:Ci,overflow:wi},retryLane:536870912,hydrationErrors:null},n=fi(e),n.return=t,t.child=n,Ai=t,ji=null)):e=null,e===null)throw Ii(t);return t.lanes=536870912,null}return fc(t,r)}var o=e.memoizedState;if(o!==null){var s=o.dehydrated;if(io(t),a)if(t.flags&256)t.flags&=-257,t=pc(e,t,n);else if(t.memoizedState!==null)t.child=e.child,t.flags|=128,t=null;else throw Error(i(558));else if(ic||Xi(e,t,n,!1),a=(n&e.childLanes)!==0,ic||a){if(r=Ul,r!==null&&(s=Ze(r,n),s!==0&&s!==o.retryLane))throw o.retryLane=s,ei(e,s),Cu(r,e,s),rc;Fu(),t=pc(e,t,n)}else e=o.treeContext,ji=hf(s.nextSibling),Ai=t,Mi=!0,Ni=null,Pi=!1,e!==null&&ki(t,e),t=fc(t,r),t.flags|=4096;return t}return e=si(e.child,{mode:r.mode,children:r.children}),e.ref=t.ref,t.child=e,e.return=t,e}function hc(e,t){var n=t.ref;if(n===null)e!==null&&e.ref!==null&&(t.flags|=4194816);else{if(typeof n!=`function`&&typeof n!=`object`)throw Error(i(284));(e===null||e.ref!==n)&&(t.flags|=4194816)}}function gc(e,t,n,r,i){return Qi(t),n=Co(e,t,n,r,void 0,i),r=Do(),e!==null&&!ic?(Oo(e,t,i),Ac(e,t,i)):(Mi&&r&&Di(t),t.flags|=1,ac(e,t,n,i),t.child)}function _c(e,t,n,r,i,a){return Qi(t),t.updateQueue=null,n=To(t,r,n,i),wo(e),r=Do(),e!==null&&!ic?(Oo(e,t,a),Ac(e,t,a)):(Mi&&r&&Di(t),t.flags|=1,ac(e,t,n,a),t.child)}function vc(e,t,n,r,i){if(Qi(t),t.stateNode===null){var a=ri,o=n.contextType;typeof o==`object`&&o&&(a=$i(o)),a=new n(r,a),t.memoizedState=a.state!==null&&a.state!==void 0?a.state:null,a.updater=Ws,t.stateNode=a,a._reactInternals=t,a=t.stateNode,a.props=r,a.state=t.memoizedState,a.refs={},za(t),o=n.contextType,a.context=typeof o==`object`&&o?$i(o):ri,a.state=t.memoizedState,o=n.getDerivedStateFromProps,typeof o==`function`&&(Us(t,n,o,r),a.state=t.memoizedState),typeof n.getDerivedStateFromProps==`function`||typeof a.getSnapshotBeforeUpdate==`function`||typeof a.UNSAFE_componentWillMount!=`function`&&typeof a.componentWillMount!=`function`||(o=a.state,typeof a.componentWillMount==`function`&&a.componentWillMount(),typeof a.UNSAFE_componentWillMount==`function`&&a.UNSAFE_componentWillMount(),o!==a.state&&Ws.enqueueReplaceState(a,a.state,null),qa(t,r,a,i),Ka(),a.state=t.memoizedState),typeof a.componentDidMount==`function`&&(t.flags|=4194308),r=!0}else if(e===null){a=t.stateNode;var s=t.memoizedProps,c=qs(n,s);a.props=c;var l=a.context,u=n.contextType;o=ri,typeof u==`object`&&u&&(o=$i(u));var d=n.getDerivedStateFromProps;u=typeof d==`function`||typeof a.getSnapshotBeforeUpdate==`function`,s=t.pendingProps!==s,u||typeof a.UNSAFE_componentWillReceiveProps!=`function`&&typeof a.componentWillReceiveProps!=`function`||(s||l!==o)&&Ks(t,a,r,o),Ra=!1;var f=t.memoizedState;a.state=f,qa(t,r,a,i),Ka(),l=t.memoizedState,s||f!==l||Ra?(typeof d==`function`&&(Us(t,n,d,r),l=t.memoizedState),(c=Ra||Gs(t,n,c,r,f,l,o))?(u||typeof a.UNSAFE_componentWillMount!=`function`&&typeof a.componentWillMount!=`function`||(typeof a.componentWillMount==`function`&&a.componentWillMount(),typeof a.UNSAFE_componentWillMount==`function`&&a.UNSAFE_componentWillMount()),typeof a.componentDidMount==`function`&&(t.flags|=4194308)):(typeof a.componentDidMount==`function`&&(t.flags|=4194308),t.memoizedProps=r,t.memoizedState=l),a.props=r,a.state=l,a.context=o,r=c):(typeof a.componentDidMount==`function`&&(t.flags|=4194308),r=!1)}else{a=t.stateNode,Ba(e,t),o=t.memoizedProps,u=qs(n,o),a.props=u,d=t.pendingProps,f=a.context,l=n.contextType,c=ri,typeof l==`object`&&l&&(c=$i(l)),s=n.getDerivedStateFromProps,(l=typeof s==`function`||typeof a.getSnapshotBeforeUpdate==`function`)||typeof a.UNSAFE_componentWillReceiveProps!=`function`&&typeof a.componentWillReceiveProps!=`function`||(o!==d||f!==c)&&Ks(t,a,r,c),Ra=!1,f=t.memoizedState,a.state=f,qa(t,r,a,i),Ka();var p=t.memoizedState;o!==d||f!==p||Ra||e!==null&&e.dependencies!==null&&Zi(e.dependencies)?(typeof s==`function`&&(Us(t,n,s,r),p=t.memoizedState),(u=Ra||Gs(t,n,u,r,f,p,c)||e!==null&&e.dependencies!==null&&Zi(e.dependencies))?(l||typeof a.UNSAFE_componentWillUpdate!=`function`&&typeof a.componentWillUpdate!=`function`||(typeof a.componentWillUpdate==`function`&&a.componentWillUpdate(r,p,c),typeof a.UNSAFE_componentWillUpdate==`function`&&a.UNSAFE_componentWillUpdate(r,p,c)),typeof a.componentDidUpdate==`function`&&(t.flags|=4),typeof a.getSnapshotBeforeUpdate==`function`&&(t.flags|=1024)):(typeof a.componentDidUpdate!=`function`||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),typeof a.getSnapshotBeforeUpdate!=`function`||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),t.memoizedProps=r,t.memoizedState=p),a.props=r,a.state=p,a.context=c,r=u):(typeof a.componentDidUpdate!=`function`||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),typeof a.getSnapshotBeforeUpdate!=`function`||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),r=!1)}return a=r,hc(e,t),r=(t.flags&128)!=0,a||r?(a=t.stateNode,n=r&&typeof n.getDerivedStateFromError!=`function`?null:a.render(),t.flags|=1,e!==null&&r?(t.child=Ia(t,e.child,null,i),t.child=Ia(t,null,n,i)):ac(e,t,n,i),t.memoizedState=a.state,e=t.child):e=Ac(e,t,i),e}function yc(e,t,n,r){return Bi(),t.flags|=256,ac(e,t,n,r),t.child}var bc={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function xc(e){return{baseLanes:e,cachePool:ya()}}function Sc(e,t,n){return e=e===null?0:e.childLanes&~n,t&&(e|=nu),e}function Cc(e,t,n){var r=t.pendingProps,a=!1,o=(t.flags&128)!=0,s;if((s=o)||(s=e!==null&&e.memoizedState===null?!1:(co.current&2)!=0),s&&(a=!0,t.flags&=-129),s=(t.flags&32)!=0,t.flags&=-33,e===null){if(Mi){if(a?ro(t):oo(t),(e=ji)?(e=df(e,Pi),e=e!==null&&e.data!==`&`?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:Si===null?null:{id:Ci,overflow:wi},retryLane:536870912,hydrationErrors:null},n=fi(e),n.return=t,t.child=n,Ai=t,ji=null)):e=null,e===null)throw Ii(t);return pf(e)?t.lanes=32:t.lanes=536870912,null}var c=r.children;return r=r.fallback,a?(oo(t),a=t.mode,c=Tc({mode:`hidden`,children:c},a),r=ui(r,a,n,null),c.return=t,r.return=t,c.sibling=r,t.child=c,r=t.child,r.memoizedState=xc(n),r.childLanes=Sc(e,s,n),t.memoizedState=bc,uc(null,r)):(ro(t),wc(t,c))}var l=e.memoizedState;if(l!==null&&(c=l.dehydrated,c!==null)){if(o)t.flags&256?(ro(t),t.flags&=-257,t=Ec(e,t,n)):t.memoizedState===null?(oo(t),c=r.fallback,a=t.mode,r=Tc({mode:`visible`,children:r.children},a),c=ui(c,a,n,null),c.flags|=2,r.return=t,c.return=t,r.sibling=c,t.child=r,Ia(t,e.child,null,n),r=t.child,r.memoizedState=xc(n),r.childLanes=Sc(e,s,n),t.memoizedState=bc,t=uc(null,r)):(oo(t),t.child=e.child,t.flags|=128,t=null);else if(ro(t),pf(c)){if(s=c.nextSibling&&c.nextSibling.dataset,s)var u=s.dgst;s=u,r=Error(i(419)),r.stack=``,r.digest=s,Hi({value:r,source:null,stack:null}),t=Ec(e,t,n)}else if(ic||Xi(e,t,n,!1),s=(n&e.childLanes)!==0,ic||s){if(s=Ul,s!==null&&(r=Ze(s,n),r!==0&&r!==l.retryLane))throw l.retryLane=r,ei(e,r),Cu(s,e,r),rc;ff(c)||Fu(),t=Ec(e,t,n)}else ff(c)?(t.flags|=192,t.child=e.child,t=null):(e=l.treeContext,ji=hf(c.nextSibling),Ai=t,Mi=!0,Ni=null,Pi=!1,e!==null&&ki(t,e),t=wc(t,r.children),t.flags|=4096);return t}return a?(oo(t),c=r.fallback,a=t.mode,l=e.child,u=l.sibling,r=si(l,{mode:`hidden`,children:r.children}),r.subtreeFlags=l.subtreeFlags&65011712,u===null?(c=ui(c,a,n,null),c.flags|=2):c=si(u,c),c.return=t,r.return=t,r.sibling=c,t.child=r,uc(null,r),r=t.child,c=e.child.memoizedState,c===null?c=xc(n):(a=c.cachePool,a===null?a=ya():(l=aa._currentValue,a=a.parent===l?a:{parent:l,pool:l}),c={baseLanes:c.baseLanes|n,cachePool:a}),r.memoizedState=c,r.childLanes=Sc(e,s,n),t.memoizedState=bc,uc(e.child,r)):(ro(t),n=e.child,e=n.sibling,n=si(n,{mode:`visible`,children:r.children}),n.return=t,n.sibling=null,e!==null&&(s=t.deletions,s===null?(t.deletions=[e],t.flags|=16):s.push(e)),t.child=n,t.memoizedState=null,n)}function wc(e,t){return t=Tc({mode:`visible`,children:t},e.mode),t.return=e,e.child=t}function Tc(e,t){return e=ai(22,e,null,t),e.lanes=0,e}function Ec(e,t,n){return Ia(t,e.child,null,n),e=wc(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function Dc(e,t,n){e.lanes|=t;var r=e.alternate;r!==null&&(r.lanes|=t),Ji(e.return,t,n)}function Oc(e,t,n,r,i,a){var o=e.memoizedState;o===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:r,tail:n,tailMode:i,treeForkCount:a}:(o.isBackwards=t,o.rendering=null,o.renderingStartTime=0,o.last=r,o.tail=n,o.tailMode=i,o.treeForkCount=a)}function kc(e,t,n){var r=t.pendingProps,i=r.revealOrder,a=r.tail;r=r.children;var o=co.current,s=(o&2)!=0;if(s?(o=o&1|2,t.flags|=128):o&=1,R(co,o),ac(e,t,r,n),r=Mi?yi:0,!s&&e!==null&&e.flags&128)a:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&Dc(e,n,t);else if(e.tag===19)Dc(e,n,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break a;for(;e.sibling===null;){if(e.return===null||e.return===t)break a;e=e.return}e.sibling.return=e.return,e=e.sibling}switch(i){case`forwards`:for(n=t.child,i=null;n!==null;)e=n.alternate,e!==null&&lo(e)===null&&(i=n),n=n.sibling;n=i,n===null?(i=t.child,t.child=null):(i=n.sibling,n.sibling=null),Oc(t,!1,i,n,a,r);break;case`backwards`:case`unstable_legacy-backwards`:for(n=null,i=t.child,t.child=null;i!==null;){if(e=i.alternate,e!==null&&lo(e)===null){t.child=i;break}e=i.sibling,i.sibling=n,n=i,i=e}Oc(t,!0,n,null,a,r);break;case`together`:Oc(t,!1,null,null,void 0,r);break;default:t.memoizedState=null}return t.child}function Ac(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),$l|=t.lanes,(n&t.childLanes)===0)if(e!==null){if(Xi(e,t,n,!1),(n&t.childLanes)===0)return null}else return null;if(e!==null&&t.child!==e.child)throw Error(i(153));if(t.child!==null){for(e=t.child,n=si(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=si(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function jc(e,t){return(e.lanes&t)===0?(e=e.dependencies,!!(e!==null&&Zi(e))):!0}function Mc(e,t,n){switch(t.tag){case 3:ce(t,t.stateNode.containerInfo),Ki(t,aa,e.memoizedState.cache),Bi();break;case 27:case 5:ue(t);break;case 4:ce(t,t.stateNode.containerInfo);break;case 10:Ki(t,t.type,t.memoizedProps.value);break;case 31:if(t.memoizedState!==null)return t.flags|=128,io(t),null;break;case 13:var r=t.memoizedState;if(r!==null)return r.dehydrated===null?(n&t.child.childLanes)===0?(ro(t),e=Ac(e,t,n),e===null?null:e.sibling):Cc(e,t,n):(ro(t),t.flags|=128,null);ro(t);break;case 19:var i=(e.flags&128)!=0;if(r=(n&t.childLanes)!==0,r||=(Xi(e,t,n,!1),(n&t.childLanes)!==0),i){if(r)return kc(e,t,n);t.flags|=128}if(i=t.memoizedState,i!==null&&(i.rendering=null,i.tail=null,i.lastEffect=null),R(co,co.current),r)break;return null;case 22:return t.lanes=0,lc(e,t,n,t.pendingProps);case 24:Ki(t,aa,e.memoizedState.cache)}return Ac(e,t,n)}function Nc(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps)ic=!0;else{if(!jc(e,n)&&!(t.flags&128))return ic=!1,Mc(e,t,n);ic=!!(e.flags&131072)}else ic=!1,Mi&&t.flags&1048576&&Ei(t,yi,t.index);switch(t.lanes=0,t.tag){case 16:a:{var r=t.pendingProps;if(e=Ea(t.elementType),t.type=e,typeof e==`function`)oi(e)?(r=qs(e,r),t.tag=1,t=vc(null,t,e,r,n)):(t.tag=0,t=gc(null,t,e,r,n));else{if(e!=null){var a=e.$$typeof;if(a===w){t.tag=11,t=oc(null,t,e,r,n);break a}else if(a===D){t.tag=14,t=sc(null,t,e,r,n);break a}}throw t=M(e)||e,Error(i(306,t,``))}}return t;case 0:return gc(e,t,t.type,t.pendingProps,n);case 1:return r=t.type,a=qs(r,t.pendingProps),vc(e,t,r,a,n);case 3:a:{if(ce(t,t.stateNode.containerInfo),e===null)throw Error(i(387));r=t.pendingProps;var o=t.memoizedState;a=o.element,Ba(e,t),qa(t,r,null,n);var s=t.memoizedState;if(r=s.cache,Ki(t,aa,r),r!==o.cache&&Yi(t,[aa],n,!0),Ka(),r=s.element,o.isDehydrated)if(o={element:r,isDehydrated:!1,cache:s.cache},t.updateQueue.baseState=o,t.memoizedState=o,t.flags&256){t=yc(e,t,r,n);break a}else if(r!==a){a=hi(Error(i(424)),t),Hi(a),t=yc(e,t,r,n);break a}else{switch(e=t.stateNode.containerInfo,e.nodeType){case 9:e=e.body;break;default:e=e.nodeName===`HTML`?e.ownerDocument.body:e}for(ji=hf(e.firstChild),Ai=t,Mi=!0,Ni=null,Pi=!0,n=La(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling}else{if(Bi(),r===a){t=Ac(e,t,n);break a}ac(e,t,r,n)}t=t.child}return t;case 26:return hc(e,t),e===null?(n=Ff(t.type,null,t.pendingProps,null))?t.memoizedState=n:Mi||(n=t.type,e=t.pendingProps,r=Jd(oe.current).createElement(n),r[rt]=t,r[it]=e,Hd(r,n,e),gt(r),t.stateNode=r):t.memoizedState=Ff(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return ue(t),e===null&&Mi&&(r=t.stateNode=yf(t.type,t.pendingProps,oe.current),Ai=t,Pi=!0,a=ji,af(t.type)?(gf=a,ji=hf(r.firstChild)):ji=a),ac(e,t,t.pendingProps.children,n),hc(e,t),e===null&&(t.flags|=4194304),t.child;case 5:return e===null&&Mi&&((a=r=ji)&&(r=lf(r,t.type,t.pendingProps,Pi),r===null?a=!1:(t.stateNode=r,Ai=t,ji=hf(r.firstChild),Pi=!1,a=!0)),a||Ii(t)),ue(t),a=t.type,o=t.pendingProps,s=e===null?null:e.memoizedProps,r=o.children,K(a,o)?r=null:s!==null&&K(a,s)&&(t.flags|=32),t.memoizedState!==null&&(a=Co(e,t,Eo,null,null,n),rp._currentValue=a),hc(e,t),ac(e,t,r,n),t.child;case 6:return e===null&&Mi&&((e=n=ji)&&(n=uf(n,t.pendingProps,Pi),n===null?e=!1:(t.stateNode=n,Ai=t,ji=null,e=!0)),e||Ii(t)),null;case 13:return Cc(e,t,n);case 4:return ce(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=Ia(t,null,r,n):ac(e,t,r,n),t.child;case 11:return oc(e,t,t.type,t.pendingProps,n);case 7:return ac(e,t,t.pendingProps,n),t.child;case 8:return ac(e,t,t.pendingProps.children,n),t.child;case 12:return ac(e,t,t.pendingProps.children,n),t.child;case 10:return r=t.pendingProps,Ki(t,t.type,r.value),ac(e,t,r.children,n),t.child;case 9:return a=t.type._context,r=t.pendingProps.children,Qi(t),a=$i(a),r=r(a),t.flags|=1,ac(e,t,r,n),t.child;case 14:return sc(e,t,t.type,t.pendingProps,n);case 15:return cc(e,t,t.type,t.pendingProps,n);case 19:return kc(e,t,n);case 31:return mc(e,t,n);case 22:return lc(e,t,n,t.pendingProps);case 24:return Qi(t),r=$i(aa),e===null?(a=_a(),a===null&&(a=Ul,o=oa(),a.pooledCache=o,o.refCount++,o!==null&&(a.pooledCacheLanes|=n),a=o),t.memoizedState={parent:r,cache:a},za(t),Ki(t,aa,a)):((e.lanes&n)!==0&&(Ba(e,t),qa(t,null,null,n),Ka()),a=e.memoizedState,o=t.memoizedState,a.parent===r?(r=o.cache,Ki(t,aa,r),r!==a.cache&&Yi(t,[aa],n,!0)):(a={parent:r,cache:r},t.memoizedState=a,t.lanes===0&&(t.memoizedState=t.updateQueue.baseState=a),Ki(t,aa,r))),ac(e,t,t.pendingProps.children,n),t.child;case 29:throw t.pendingProps}throw Error(i(156,t.tag))}function Pc(e){e.flags|=4}function Fc(e,t,n,r,i){if((t=(e.mode&32)!=0)&&(t=!1),t){if(e.flags|=16777216,(i&335544128)===i)if(e.stateNode.complete)e.flags|=8192;else if(Mu())e.flags|=8192;else throw Da=Ca,xa}else e.flags&=-16777217}function Ic(e,t){if(t.type!==`stylesheet`||t.state.loading&4)e.flags&=-16777217;else if(e.flags|=16777216,!Xf(t))if(Mu())e.flags|=8192;else throw Da=Ca,xa}function Lc(e,t){t!==null&&(e.flags|=4),e.flags&16384&&(t=e.tag===22?536870912:Ge(),e.lanes|=t,ru|=t)}function Rc(e,t){if(!Mi)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 zc(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&65011712,r|=i.flags&65011712,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 Bc(e,t,n){var r=t.pendingProps;switch(Oi(t),t.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return zc(t),null;case 1:return zc(t),null;case 3:return n=t.stateNode,r=null,e!==null&&(r=e.memoizedState.cache),t.memoizedState.cache!==r&&(t.flags|=2048),qi(aa),le(),n.pendingContext&&(n.context=n.pendingContext,n.pendingContext=null),(e===null||e.child===null)&&(zi(t)?Pc(t):e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,Vi())),zc(t),null;case 26:var a=t.type,o=t.memoizedState;return e===null?(Pc(t),o===null?(zc(t),Fc(t,a,null,r,n)):(zc(t),Ic(t,o))):o?o===e.memoizedState?(zc(t),t.flags&=-16777217):(Pc(t),zc(t),Ic(t,o)):(e=e.memoizedProps,e!==r&&Pc(t),zc(t),Fc(t,a,e,r,n)),null;case 27:if(de(t),n=oe.current,a=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==r&&Pc(t);else{if(!r){if(t.stateNode===null)throw Error(i(166));return zc(t),null}e=ae.current,zi(t)?Li(t,e):(e=yf(a,r,n),t.stateNode=e,Pc(t))}return zc(t),null;case 5:if(de(t),a=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==r&&Pc(t);else{if(!r){if(t.stateNode===null)throw Error(i(166));return zc(t),null}if(o=ae.current,zi(t))Li(t,o);else{var s=Jd(oe.current);switch(o){case 1:o=s.createElementNS(`http://www.w3.org/2000/svg`,a);break;case 2:o=s.createElementNS(`http://www.w3.org/1998/Math/MathML`,a);break;default:switch(a){case`svg`:o=s.createElementNS(`http://www.w3.org/2000/svg`,a);break;case`math`:o=s.createElementNS(`http://www.w3.org/1998/Math/MathML`,a);break;case`script`:o=s.createElement(`div`),o.innerHTML=`<script><\/script>`,o=o.removeChild(o.firstChild);break;case`select`:o=typeof r.is==`string`?s.createElement(`select`,{is:r.is}):s.createElement(`select`),r.multiple?o.multiple=!0:r.size&&(o.size=r.size);break;default:o=typeof r.is==`string`?s.createElement(a,{is:r.is}):s.createElement(a)}}o[rt]=t,o[it]=r;a:for(s=t.child;s!==null;){if(s.tag===5||s.tag===6)o.appendChild(s.stateNode);else if(s.tag!==4&&s.tag!==27&&s.child!==null){s.child.return=s,s=s.child;continue}if(s===t)break a;for(;s.sibling===null;){if(s.return===null||s.return===t)break a;s=s.return}s.sibling.return=s.return,s=s.sibling}t.stateNode=o;a:switch(Hd(o,a,r),a){case`button`:case`input`:case`select`:case`textarea`:r=!!r.autoFocus;break a;case`img`:r=!0;break a;default:r=!1}r&&Pc(t)}}return zc(t),Fc(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,n),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==r&&Pc(t);else{if(typeof r!=`string`&&t.stateNode===null)throw Error(i(166));if(e=oe.current,zi(t)){if(e=t.stateNode,n=t.memoizedProps,r=null,a=Ai,a!==null)switch(a.tag){case 27:case 5:r=a.memoizedProps}e[rt]=t,e=!!(e.nodeValue===n||r!==null&&!0===r.suppressHydrationWarning||zd(e.nodeValue,n)),e||Ii(t,!0)}else e=Jd(e).createTextNode(r),e[rt]=t,t.stateNode=e}return zc(t),null;case 31:if(n=t.memoizedState,e===null||e.memoizedState!==null){if(r=zi(t),n!==null){if(e===null){if(!r)throw Error(i(318));if(e=t.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(i(557));e[rt]=t}else Bi(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;zc(t),e=!1}else n=Vi(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=n),e=!0;if(!e)return t.flags&256?(so(t),t):(so(t),null);if(t.flags&128)throw Error(i(558))}return zc(t),null;case 13:if(r=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(a=zi(t),r!==null&&r.dehydrated!==null){if(e===null){if(!a)throw Error(i(318));if(a=t.memoizedState,a=a===null?null:a.dehydrated,!a)throw Error(i(317));a[rt]=t}else Bi(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;zc(t),a=!1}else a=Vi(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=a),a=!0;if(!a)return t.flags&256?(so(t),t):(so(t),null)}return so(t),t.flags&128?(t.lanes=n,t):(n=r!==null,e=e!==null&&e.memoizedState!==null,n&&(r=t.child,a=null,r.alternate!==null&&r.alternate.memoizedState!==null&&r.alternate.memoizedState.cachePool!==null&&(a=r.alternate.memoizedState.cachePool.pool),o=null,r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(o=r.memoizedState.cachePool.pool),o!==a&&(r.flags|=2048)),n!==e&&n&&(t.child.flags|=8192),Lc(t,t.updateQueue),zc(t),null);case 4:return le(),e===null&&Ad(t.stateNode.containerInfo),zc(t),null;case 10:return qi(t.type),zc(t),null;case 19:if(L(co),r=t.memoizedState,r===null)return zc(t),null;if(a=(t.flags&128)!=0,o=r.rendering,o===null)if(a)Rc(r,!1);else{if(Ql!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(o=lo(e),o!==null){for(t.flags|=128,Rc(r,!1),e=o.updateQueue,t.updateQueue=e,Lc(t,e),t.subtreeFlags=0,e=n,n=t.child;n!==null;)ci(n,e),n=n.sibling;return R(co,co.current&1|2),Mi&&Ti(t,r.treeForkCount),t.child}e=e.sibling}r.tail!==null&&we()>lu&&(t.flags|=128,a=!0,Rc(r,!1),t.lanes=4194304)}else{if(!a)if(e=lo(o),e!==null){if(t.flags|=128,a=!0,e=e.updateQueue,t.updateQueue=e,Lc(t,e),Rc(r,!0),r.tail===null&&r.tailMode===`hidden`&&!o.alternate&&!Mi)return zc(t),null}else 2*we()-r.renderingStartTime>lu&&n!==536870912&&(t.flags|=128,a=!0,Rc(r,!1),t.lanes=4194304);r.isBackwards?(o.sibling=t.child,t.child=o):(e=r.last,e===null?t.child=o:e.sibling=o,r.last=o)}return r.tail===null?(zc(t),null):(e=r.tail,r.rendering=e,r.tail=e.sibling,r.renderingStartTime=we(),e.sibling=null,n=co.current,R(co,a?n&1|2:n&1),Mi&&Ti(t,r.treeForkCount),e);case 22:case 23:return so(t),eo(),r=t.memoizedState!==null,e===null?r&&(t.flags|=8192):e.memoizedState!==null!==r&&(t.flags|=8192),r?n&536870912&&!(t.flags&128)&&(zc(t),t.subtreeFlags&6&&(t.flags|=8192)):zc(t),n=t.updateQueue,n!==null&&Lc(t,n.retryQueue),n=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(n=e.memoizedState.cachePool.pool),r=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(r=t.memoizedState.cachePool.pool),r!==n&&(t.flags|=2048),e!==null&&L(ga),null;case 24:return n=null,e!==null&&(n=e.memoizedState.cache),t.memoizedState.cache!==n&&(t.flags|=2048),qi(aa),zc(t),null;case 25:return null;case 30:return null}throw Error(i(156,t.tag))}function Vc(e,t){switch(Oi(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return qi(aa),le(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return de(t),null;case 31:if(t.memoizedState!==null){if(so(t),t.alternate===null)throw Error(i(340));Bi()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(so(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(i(340));Bi()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return L(co),null;case 4:return le(),null;case 10:return qi(t.type),null;case 22:case 23:return so(t),eo(),e!==null&&L(ga),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return qi(aa),null;case 25:return null;default:return null}}function Hc(e,t){switch(Oi(t),t.tag){case 3:qi(aa),le();break;case 26:case 27:case 5:de(t);break;case 4:le();break;case 31:t.memoizedState!==null&&so(t);break;case 13:so(t);break;case 19:L(co);break;case 10:qi(t.type);break;case 22:case 23:so(t),eo(),e!==null&&L(ga);break;case 24:qi(aa)}}function Uc(e,t){try{var n=t.updateQueue,r=n===null?null:n.lastEffect;if(r!==null){var i=r.next;n=i;do{if((n.tag&e)===e){r=void 0;var a=n.create,o=n.inst;r=a(),o.destroy=r}n=n.next}while(n!==i)}}catch(e){$u(t,t.return,e)}}function Wc(e,t,n){try{var r=t.updateQueue,i=r===null?null:r.lastEffect;if(i!==null){var a=i.next;r=a;do{if((r.tag&e)===e){var o=r.inst,s=o.destroy;if(s!==void 0){o.destroy=void 0,i=t;var c=n,l=s;try{l()}catch(e){$u(i,c,e)}}}r=r.next}while(r!==a)}}catch(e){$u(t,t.return,e)}}function Gc(e){var t=e.updateQueue;if(t!==null){var n=e.stateNode;try{Ya(t,n)}catch(t){$u(e,e.return,t)}}}function Kc(e,t,n){n.props=qs(e.type,e.memoizedProps),n.state=e.memoizedState;try{n.componentWillUnmount()}catch(n){$u(e,t,n)}}function qc(e,t){try{var n=e.ref;if(n!==null){switch(e.tag){case 26:case 27:case 5:var r=e.stateNode;break;case 30:r=e.stateNode;break;default:r=e.stateNode}typeof n==`function`?e.refCleanup=n(r):n.current=r}}catch(n){$u(e,t,n)}}function Jc(e,t){var n=e.ref,r=e.refCleanup;if(n!==null)if(typeof r==`function`)try{r()}catch(n){$u(e,t,n)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof n==`function`)try{n(null)}catch(n){$u(e,t,n)}else n.current=null}function Yc(e){var t=e.type,n=e.memoizedProps,r=e.stateNode;try{a:switch(t){case`button`:case`input`:case`select`:case`textarea`:n.autoFocus&&r.focus();break a;case`img`:n.src?r.src=n.src:n.srcSet&&(r.srcset=n.srcSet)}}catch(t){$u(e,e.return,t)}}function Xc(e,t,n){try{var r=e.stateNode;Ud(r,e.type,n,t),r[it]=t}catch(t){$u(e,e.return,t)}}function Zc(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&af(e.type)||e.tag===4}function Qc(e){a:for(;;){for(;e.sibling===null;){if(e.return===null||Zc(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.tag===27&&af(e.type)||e.flags&2||e.child===null||e.tag===4)continue a;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function $c(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?(n.nodeType===9?n.body:n.nodeName===`HTML`?n.ownerDocument.body:n).insertBefore(e,t):(t=n.nodeType===9?n.body:n.nodeName===`HTML`?n.ownerDocument.body:n,t.appendChild(e),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=Xt));else if(r!==4&&(r===27&&af(e.type)&&(n=e.stateNode,t=null),e=e.child,e!==null))for($c(e,t,n),e=e.sibling;e!==null;)$c(e,t,n),e=e.sibling}function el(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&&(r===27&&af(e.type)&&(n=e.stateNode),e=e.child,e!==null))for(el(e,t,n),e=e.sibling;e!==null;)el(e,t,n),e=e.sibling}function tl(e){var t=e.stateNode,n=e.memoizedProps;try{for(var r=e.type,i=t.attributes;i.length;)t.removeAttributeNode(i[0]);Hd(t,r,n),t[rt]=e,t[it]=n}catch(t){$u(e,e.return,t)}}var nl=!1,rl=!1,il=!1,al=typeof WeakSet==`function`?WeakSet:Set,ol=null;function sl(e,t){if(e=e.containerInfo,Kd=fp,e=wr(e),Tr(e)){if(`selectionStart`in e)var n={start:e.selectionStart,end:e.selectionEnd};else a:{n=(n=e.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var a=r.anchorOffset,o=r.focusNode;r=r.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||r!==0&&f.nodeType!==3||(l=s+r),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===r&&(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(qd={focusedElem:e,selectionRange:n},fp=!1,ol=t;ol!==null;)if(t=ol,e=t.child,t.subtreeFlags&1028&&e!==null)e.return=t,ol=e;else for(;ol!==null;){switch(t=ol,o=t.alternate,e=t.flags,t.tag){case 0:if(e&4&&(e=t.updateQueue,e=e===null?null:e.events,e!==null))for(n=0;n<e.length;n++)a=e[n],a.ref.impl=a.nextImpl;break;case 11:case 15:break;case 1:if(e&1024&&o!==null){e=void 0,n=t,a=o.memoizedProps,o=o.memoizedState,r=n.stateNode;try{var h=qs(n.type,a);e=r.getSnapshotBeforeUpdate(h,o),r.__reactInternalSnapshotBeforeUpdate=e}catch(e){$u(n,n.return,e)}}break;case 3:if(e&1024){if(e=t.stateNode.containerInfo,n=e.nodeType,n===9)cf(e);else if(n===1)switch(e.nodeName){case`HEAD`:case`HTML`:case`BODY`:cf(e);break;default:e.textContent=``}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if(e&1024)throw Error(i(163))}if(e=t.sibling,e!==null){e.return=t.return,ol=e;break}ol=t.return}}function cl(e,t,n){var r=n.flags;switch(n.tag){case 0:case 11:case 15:Cl(e,n),r&4&&Uc(5,n);break;case 1:if(Cl(e,n),r&4)if(e=n.stateNode,t===null)try{e.componentDidMount()}catch(e){$u(n,n.return,e)}else{var i=qs(n.type,t.memoizedProps);t=t.memoizedState;try{e.componentDidUpdate(i,t,e.__reactInternalSnapshotBeforeUpdate)}catch(e){$u(n,n.return,e)}}r&64&&Gc(n),r&512&&qc(n,n.return);break;case 3:if(Cl(e,n),r&64&&(e=n.updateQueue,e!==null)){if(t=null,n.child!==null)switch(n.child.tag){case 27:case 5:t=n.child.stateNode;break;case 1:t=n.child.stateNode}try{Ya(e,t)}catch(e){$u(n,n.return,e)}}break;case 27:t===null&&r&4&&tl(n);case 26:case 5:Cl(e,n),t===null&&r&4&&Yc(n),r&512&&qc(n,n.return);break;case 12:Cl(e,n);break;case 31:Cl(e,n),r&4&&ml(e,n);break;case 13:Cl(e,n),r&4&&hl(e,n),r&64&&(e=n.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(n=rd.bind(null,n),mf(e,n))));break;case 22:if(r=n.memoizedState!==null||nl,!r){t=t!==null&&t.memoizedState!==null||rl,i=nl;var a=rl;nl=r,(rl=t)&&!a?Tl(e,n,(n.subtreeFlags&8772)!=0):Cl(e,n),nl=i,rl=a}break;case 30:break;default:Cl(e,n)}}function ll(e){var t=e.alternate;t!==null&&(e.alternate=null,ll(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&dt(t)),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}var ul=null,dl=!1;function fl(e,t,n){for(n=n.child;n!==null;)pl(e,t,n),n=n.sibling}function pl(e,t,n){if(Pe&&typeof Pe.onCommitFiberUnmount==`function`)try{Pe.onCommitFiberUnmount(Ne,n)}catch{}switch(n.tag){case 26:rl||Jc(n,t),fl(e,t,n),n.memoizedState?n.memoizedState.count--:n.stateNode&&(n=n.stateNode,n.parentNode.removeChild(n));break;case 27:rl||Jc(n,t);var r=ul,i=dl;af(n.type)&&(ul=n.stateNode,dl=!1),fl(e,t,n),bf(n.stateNode),ul=r,dl=i;break;case 5:rl||Jc(n,t);case 6:if(r=ul,i=dl,ul=null,fl(e,t,n),ul=r,dl=i,ul!==null)if(dl)try{(ul.nodeType===9?ul.body:ul.nodeName===`HTML`?ul.ownerDocument.body:ul).removeChild(n.stateNode)}catch(e){$u(n,t,e)}else try{ul.removeChild(n.stateNode)}catch(e){$u(n,t,e)}break;case 18:ul!==null&&(dl?(e=ul,of(e.nodeType===9?e.body:e.nodeName===`HTML`?e.ownerDocument.body:e,n.stateNode),Rp(e)):of(ul,n.stateNode));break;case 4:r=ul,i=dl,ul=n.stateNode.containerInfo,dl=!0,fl(e,t,n),ul=r,dl=i;break;case 0:case 11:case 14:case 15:Wc(2,n,t),rl||Wc(4,n,t),fl(e,t,n);break;case 1:rl||(Jc(n,t),r=n.stateNode,typeof r.componentWillUnmount==`function`&&Kc(n,t,r)),fl(e,t,n);break;case 21:fl(e,t,n);break;case 22:rl=(r=rl)||n.memoizedState!==null,fl(e,t,n),rl=r;break;default:fl(e,t,n)}}function ml(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{Rp(e)}catch(e){$u(t,t.return,e)}}}function hl(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{Rp(e)}catch(e){$u(t,t.return,e)}}function gl(e){switch(e.tag){case 31:case 13:case 19:var t=e.stateNode;return t===null&&(t=e.stateNode=new al),t;case 22:return e=e.stateNode,t=e._retryCache,t===null&&(t=e._retryCache=new al),t;default:throw Error(i(435,e.tag))}}function _l(e,t){var n=gl(e);t.forEach(function(t){if(!n.has(t)){n.add(t);var r=id.bind(null,e,t);t.then(r,r)}})}function vl(e,t){var n=t.deletions;if(n!==null)for(var r=0;r<n.length;r++){var a=n[r],o=e,s=t,c=s;a:for(;c!==null;){switch(c.tag){case 27:if(af(c.type)){ul=c.stateNode,dl=!1;break a}break;case 5:ul=c.stateNode,dl=!1;break a;case 3:case 4:ul=c.stateNode.containerInfo,dl=!0;break a}c=c.return}if(ul===null)throw Error(i(160));pl(o,s,a),ul=null,dl=!1,o=a.alternate,o!==null&&(o.return=null),a.return=null}if(t.subtreeFlags&13886)for(t=t.child;t!==null;)bl(t,e),t=t.sibling}var yl=null;function bl(e,t){var n=e.alternate,r=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:vl(t,e),xl(e),r&4&&(Wc(3,e,e.return),Uc(3,e),Wc(5,e,e.return));break;case 1:vl(t,e),xl(e),r&512&&(rl||n===null||Jc(n,n.return)),r&64&&nl&&(e=e.updateQueue,e!==null&&(r=e.callbacks,r!==null&&(n=e.shared.hiddenCallbacks,e.shared.hiddenCallbacks=n===null?r:n.concat(r))));break;case 26:var a=yl;if(vl(t,e),xl(e),r&512&&(rl||n===null||Jc(n,n.return)),r&4){var o=n===null?null:n.memoizedState;if(r=e.memoizedState,n===null)if(r===null)if(e.stateNode===null){a:{r=e.type,n=e.memoizedProps,a=a.ownerDocument||a;b:switch(r){case`title`:o=a.getElementsByTagName(`title`)[0],(!o||o[ut]||o[rt]||o.namespaceURI===`http://www.w3.org/2000/svg`||o.hasAttribute(`itemprop`))&&(o=a.createElement(r),a.head.insertBefore(o,a.querySelector(`head > title`))),Hd(o,r,n),o[rt]=e,gt(o),r=o;break a;case`link`:var s=qf(`link`,`href`,a).get(r+(n.href||``));if(s){for(var c=0;c<s.length;c++)if(o=s[c],o.getAttribute(`href`)===(n.href==null||n.href===``?null:n.href)&&o.getAttribute(`rel`)===(n.rel==null?null:n.rel)&&o.getAttribute(`title`)===(n.title==null?null:n.title)&&o.getAttribute(`crossorigin`)===(n.crossOrigin==null?null:n.crossOrigin)){s.splice(c,1);break b}}o=a.createElement(r),Hd(o,r,n),a.head.appendChild(o);break;case`meta`:if(s=qf(`meta`,`content`,a).get(r+(n.content||``))){for(c=0;c<s.length;c++)if(o=s[c],o.getAttribute(`content`)===(n.content==null?null:``+n.content)&&o.getAttribute(`name`)===(n.name==null?null:n.name)&&o.getAttribute(`property`)===(n.property==null?null:n.property)&&o.getAttribute(`http-equiv`)===(n.httpEquiv==null?null:n.httpEquiv)&&o.getAttribute(`charset`)===(n.charSet==null?null:n.charSet)){s.splice(c,1);break b}}o=a.createElement(r),Hd(o,r,n),a.head.appendChild(o);break;default:throw Error(i(468,r))}o[rt]=e,gt(o),r=o}e.stateNode=r}else Jf(a,e.type,e.stateNode);else e.stateNode=Hf(a,r,e.memoizedProps);else o===r?r===null&&e.stateNode!==null&&Xc(e,e.memoizedProps,n.memoizedProps):(o===null?n.stateNode!==null&&(n=n.stateNode,n.parentNode.removeChild(n)):o.count--,r===null?Jf(a,e.type,e.stateNode):Hf(a,r,e.memoizedProps))}break;case 27:vl(t,e),xl(e),r&512&&(rl||n===null||Jc(n,n.return)),n!==null&&r&4&&Xc(e,e.memoizedProps,n.memoizedProps);break;case 5:if(vl(t,e),xl(e),r&512&&(rl||n===null||Jc(n,n.return)),e.flags&32){a=e.stateNode;try{Ht(a,``)}catch(t){$u(e,e.return,t)}}r&4&&e.stateNode!=null&&(a=e.memoizedProps,Xc(e,a,n===null?a:n.memoizedProps)),r&1024&&(il=!0);break;case 6:if(vl(t,e),xl(e),r&4){if(e.stateNode===null)throw Error(i(162));r=e.memoizedProps,n=e.stateNode;try{n.nodeValue=r}catch(t){$u(e,e.return,t)}}break;case 3:if(Kf=null,a=yl,yl=Cf(t.containerInfo),vl(t,e),yl=a,xl(e),r&4&&n!==null&&n.memoizedState.isDehydrated)try{Rp(t.containerInfo)}catch(t){$u(e,e.return,t)}il&&(il=!1,Sl(e));break;case 4:r=yl,yl=Cf(e.stateNode.containerInfo),vl(t,e),xl(e),yl=r;break;case 12:vl(t,e),xl(e);break;case 31:vl(t,e),xl(e),r&4&&(r=e.updateQueue,r!==null&&(e.updateQueue=null,_l(e,r)));break;case 13:vl(t,e),xl(e),e.child.flags&8192&&e.memoizedState!==null!=(n!==null&&n.memoizedState!==null)&&(su=we()),r&4&&(r=e.updateQueue,r!==null&&(e.updateQueue=null,_l(e,r)));break;case 22:a=e.memoizedState!==null;var l=n!==null&&n.memoizedState!==null,u=nl,d=rl;if(nl=u||a,rl=d||l,vl(t,e),rl=d,nl=u,xl(e),r&8192)a:for(t=e.stateNode,t._visibility=a?t._visibility&-2:t._visibility|1,a&&(n===null||l||nl||rl||wl(e)),n=null,t=e;;){if(t.tag===5||t.tag===26){if(n===null){l=n=t;try{if(o=l.stateNode,a)s=o.style,typeof s.setProperty==`function`?s.setProperty(`display`,`none`,`important`):s.display=`none`;else{c=l.stateNode;var f=l.memoizedProps.style,p=f!=null&&f.hasOwnProperty(`display`)?f.display:null;c.style.display=p==null||typeof p==`boolean`?``:(``+p).trim()}}catch(e){$u(l,l.return,e)}}}else if(t.tag===6){if(n===null){l=t;try{l.stateNode.nodeValue=a?``:l.memoizedProps}catch(e){$u(l,l.return,e)}}}else if(t.tag===18){if(n===null){l=t;try{var m=l.stateNode;a?sf(m,!0):sf(l.stateNode,!1)}catch(e){$u(l,l.return,e)}}}else if((t.tag!==22&&t.tag!==23||t.memoizedState===null||t===e)&&t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break a;for(;t.sibling===null;){if(t.return===null||t.return===e)break a;n===t&&(n=null),t=t.return}n===t&&(n=null),t.sibling.return=t.return,t=t.sibling}r&4&&(r=e.updateQueue,r!==null&&(n=r.retryQueue,n!==null&&(r.retryQueue=null,_l(e,n))));break;case 19:vl(t,e),xl(e),r&4&&(r=e.updateQueue,r!==null&&(e.updateQueue=null,_l(e,r)));break;case 30:break;case 21:break;default:vl(t,e),xl(e)}}function xl(e){var t=e.flags;if(t&2){try{for(var n,r=e.return;r!==null;){if(Zc(r)){n=r;break}r=r.return}if(n==null)throw Error(i(160));switch(n.tag){case 27:var a=n.stateNode;el(e,Qc(e),a);break;case 5:var o=n.stateNode;n.flags&32&&(Ht(o,``),n.flags&=-33),el(e,Qc(e),o);break;case 3:case 4:var s=n.stateNode.containerInfo;$c(e,Qc(e),s);break;default:throw Error(i(161))}}catch(t){$u(e,e.return,t)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function Sl(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var t=e;Sl(t),t.tag===5&&t.flags&1024&&t.stateNode.reset(),e=e.sibling}}function Cl(e,t){if(t.subtreeFlags&8772)for(t=t.child;t!==null;)cl(e,t.alternate,t),t=t.sibling}function wl(e){for(e=e.child;e!==null;){var t=e;switch(t.tag){case 0:case 11:case 14:case 15:Wc(4,t,t.return),wl(t);break;case 1:Jc(t,t.return);var n=t.stateNode;typeof n.componentWillUnmount==`function`&&Kc(t,t.return,n),wl(t);break;case 27:bf(t.stateNode);case 26:case 5:Jc(t,t.return),wl(t);break;case 22:t.memoizedState===null&&wl(t);break;case 30:wl(t);break;default:wl(t)}e=e.sibling}}function Tl(e,t,n){for(n&&=(t.subtreeFlags&8772)!=0,t=t.child;t!==null;){var r=t.alternate,i=e,a=t,o=a.flags;switch(a.tag){case 0:case 11:case 15:Tl(i,a,n),Uc(4,a);break;case 1:if(Tl(i,a,n),r=a,i=r.stateNode,typeof i.componentDidMount==`function`)try{i.componentDidMount()}catch(e){$u(r,r.return,e)}if(r=a,i=r.updateQueue,i!==null){var s=r.stateNode;try{var c=i.shared.hiddenCallbacks;if(c!==null)for(i.shared.hiddenCallbacks=null,i=0;i<c.length;i++)Ja(c[i],s)}catch(e){$u(r,r.return,e)}}n&&o&64&&Gc(a),qc(a,a.return);break;case 27:tl(a);case 26:case 5:Tl(i,a,n),n&&r===null&&o&4&&Yc(a),qc(a,a.return);break;case 12:Tl(i,a,n);break;case 31:Tl(i,a,n),n&&o&4&&ml(i,a);break;case 13:Tl(i,a,n),n&&o&4&&hl(i,a);break;case 22:a.memoizedState===null&&Tl(i,a,n),qc(a,a.return);break;case 30:break;default:Tl(i,a,n)}t=t.sibling}}function El(e,t){var n=null;e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(n=e.memoizedState.cachePool.pool),e=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(e=t.memoizedState.cachePool.pool),e!==n&&(e!=null&&e.refCount++,n!=null&&sa(n))}function Dl(e,t){e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&sa(e))}function Ol(e,t,n,r){if(t.subtreeFlags&10256)for(t=t.child;t!==null;)kl(e,t,n,r),t=t.sibling}function kl(e,t,n,r){var i=t.flags;switch(t.tag){case 0:case 11:case 15:Ol(e,t,n,r),i&2048&&Uc(9,t);break;case 1:Ol(e,t,n,r);break;case 3:Ol(e,t,n,r),i&2048&&(e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&sa(e)));break;case 12:if(i&2048){Ol(e,t,n,r),e=t.stateNode;try{var a=t.memoizedProps,o=a.id,s=a.onPostCommit;typeof s==`function`&&s(o,t.alternate===null?`mount`:`update`,e.passiveEffectDuration,-0)}catch(e){$u(t,t.return,e)}}else Ol(e,t,n,r);break;case 31:Ol(e,t,n,r);break;case 13:Ol(e,t,n,r);break;case 23:break;case 22:a=t.stateNode,o=t.alternate,t.memoizedState===null?a._visibility&2?Ol(e,t,n,r):(a._visibility|=2,Al(e,t,n,r,(t.subtreeFlags&10256)!=0||!1)):a._visibility&2?Ol(e,t,n,r):jl(e,t),i&2048&&El(o,t);break;case 24:Ol(e,t,n,r),i&2048&&Dl(t.alternate,t);break;default:Ol(e,t,n,r)}}function Al(e,t,n,r,i){for(i&&=(t.subtreeFlags&10256)!=0||!1,t=t.child;t!==null;){var a=e,o=t,s=n,c=r,l=o.flags;switch(o.tag){case 0:case 11:case 15:Al(a,o,s,c,i),Uc(8,o);break;case 23:break;case 22:var u=o.stateNode;o.memoizedState===null?(u._visibility|=2,Al(a,o,s,c,i)):u._visibility&2?Al(a,o,s,c,i):jl(a,o),i&&l&2048&&El(o.alternate,o);break;case 24:Al(a,o,s,c,i),i&&l&2048&&Dl(o.alternate,o);break;default:Al(a,o,s,c,i)}t=t.sibling}}function jl(e,t){if(t.subtreeFlags&10256)for(t=t.child;t!==null;){var n=e,r=t,i=r.flags;switch(r.tag){case 22:jl(n,r),i&2048&&El(r.alternate,r);break;case 24:jl(n,r),i&2048&&Dl(r.alternate,r);break;default:jl(n,r)}t=t.sibling}}var Ml=8192;function Nl(e,t,n){if(e.subtreeFlags&Ml)for(e=e.child;e!==null;)Pl(e,t,n),e=e.sibling}function Pl(e,t,n){switch(e.tag){case 26:Nl(e,t,n),e.flags&Ml&&e.memoizedState!==null&&Zf(n,yl,e.memoizedState,e.memoizedProps);break;case 5:Nl(e,t,n);break;case 3:case 4:var r=yl;yl=Cf(e.stateNode.containerInfo),Nl(e,t,n),yl=r;break;case 22:e.memoizedState===null&&(r=e.alternate,r!==null&&r.memoizedState!==null?(r=Ml,Ml=16777216,Nl(e,t,n),Ml=r):Nl(e,t,n));break;default:Nl(e,t,n)}}function Fl(e){var t=e.alternate;if(t!==null&&(e=t.child,e!==null)){t.child=null;do t=e.sibling,e.sibling=null,e=t;while(e!==null)}}function Il(e){var t=e.deletions;if(e.flags&16){if(t!==null)for(var n=0;n<t.length;n++){var r=t[n];ol=r,zl(r,e)}Fl(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)Ll(e),e=e.sibling}function Ll(e){switch(e.tag){case 0:case 11:case 15:Il(e),e.flags&2048&&Wc(9,e,e.return);break;case 3:Il(e);break;case 12:Il(e);break;case 22:var t=e.stateNode;e.memoizedState!==null&&t._visibility&2&&(e.return===null||e.return.tag!==13)?(t._visibility&=-3,Rl(e)):Il(e);break;default:Il(e)}}function Rl(e){var t=e.deletions;if(e.flags&16){if(t!==null)for(var n=0;n<t.length;n++){var r=t[n];ol=r,zl(r,e)}Fl(e)}for(e=e.child;e!==null;){switch(t=e,t.tag){case 0:case 11:case 15:Wc(8,t,t.return),Rl(t);break;case 22:n=t.stateNode,n._visibility&2&&(n._visibility&=-3,Rl(t));break;default:Rl(t)}e=e.sibling}}function zl(e,t){for(;ol!==null;){var n=ol;switch(n.tag){case 0:case 11:case 15:Wc(8,n,t);break;case 23:case 22:if(n.memoizedState!==null&&n.memoizedState.cachePool!==null){var r=n.memoizedState.cachePool.pool;r!=null&&r.refCount++}break;case 24:sa(n.memoizedState.cache)}if(r=n.child,r!==null)r.return=n,ol=r;else a:for(n=e;ol!==null;){r=ol;var i=r.sibling,a=r.return;if(ll(r),r===n){ol=null;break a}if(i!==null){i.return=a,ol=i;break a}ol=a}}}var Bl={getCacheForType:function(e){var t=$i(aa),n=t.data.get(e);return n===void 0&&(n=e(),t.data.set(e,n)),n},cacheSignal:function(){return $i(aa).controller.signal}},Vl=typeof WeakMap==`function`?WeakMap:Map,Hl=0,Ul=null,Wl=null,Gl=0,Kl=0,ql=null,Jl=!1,Yl=!1,Xl=!1,Zl=0,Ql=0,$l=0,eu=0,tu=0,nu=0,ru=0,iu=null,au=null,ou=!1,su=0,cu=0,lu=1/0,uu=null,du=null,fu=0,pu=null,mu=null,hu=0,gu=0,_u=null,vu=null,yu=0,bu=null;function xu(){return Hl&2&&Gl!==0?Gl&-Gl:P.T===null?et():yd()}function Su(){if(nu===0)if(!(Gl&536870912)||Mi){var e=Ve;Ve<<=1,!(Ve&3932160)&&(Ve=262144),nu=e}else nu=536870912;return e=to.current,e!==null&&(e.flags|=32),nu}function Cu(e,t,n){(e===Ul&&(Kl===2||Kl===9)||e.cancelPendingCommit!==null)&&(Au(e,0),Du(e,Gl,nu,!1)),qe(e,n),(!(Hl&2)||e!==Ul)&&(e===Ul&&(!(Hl&2)&&(eu|=n),Ql===4&&Du(e,Gl,nu,!1)),fd(e))}function wu(e,t,n){if(Hl&6)throw Error(i(327));var r=!n&&(t&127)==0&&(t&e.expiredLanes)===0||Ue(e,t),a=r?Ru(e,t):Iu(e,t,!0),o=r;do{if(a===0){Yl&&!r&&Du(e,t,0,!1);break}else{if(n=e.current.alternate,o&&!Eu(n)){a=Iu(e,t,!1),o=!1;continue}if(a===2){if(o=t,e.errorRecoveryDisabledLanes&o)var s=0;else s=e.pendingLanes&-536870913,s=s===0?s&536870912?536870912:0:s;if(s!==0){t=s;a:{var c=e;a=iu;var l=c.current.memoizedState.isDehydrated;if(l&&(Au(c,s).flags|=256),s=Iu(c,s,!1),s!==2){if(Xl&&!l){c.errorRecoveryDisabledLanes|=o,eu|=o,a=4;break a}o=au,au=a,o!==null&&(au===null?au=o:au.push.apply(au,o))}a=s}if(o=!1,a!==2)continue}}if(a===1){Au(e,0),Du(e,t,0,!0);break}a:{switch(r=e,o=a,o){case 0:case 1:throw Error(i(345));case 4:if((t&4194048)!==t)break;case 6:Du(r,t,nu,!Jl);break a;case 2:au=null;break;case 3:case 5:break;default:throw Error(i(329))}if((t&62914560)===t&&(a=su+300-we(),10<a)){if(Du(r,t,nu,!Jl),V(r,0,!0)!==0)break a;hu=t,r.timeoutHandle=$d(Tu.bind(null,r,n,au,uu,ou,t,nu,eu,ru,Jl,o,`Throttled`,-0,0),a);break a}Tu(r,n,au,uu,ou,t,nu,eu,ru,Jl,o,null,-0,0)}}break}while(1);fd(e)}function Tu(e,t,n,r,i,a,o,s,c,l,u,d,f,p){if(e.timeoutHandle=-1,d=t.subtreeFlags,d&8192||(d&16785408)==16785408){d={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:Xt},Pl(t,a,d);var m=(a&62914560)===a?su-we():(a&4194048)===a?cu-we():0;if(m=$f(d,m),m!==null){hu=a,e.cancelPendingCommit=m(Gu.bind(null,e,t,a,n,r,i,o,s,c,u,d,null,f,p)),Du(e,a,o,!l);return}}Gu(e,t,a,n,r,i,o,s,c)}function Eu(e){for(var t=e;;){var n=t.tag;if((n===0||n===11||n===15)&&t.flags&16384&&(n=t.updateQueue,n!==null&&(n=n.stores,n!==null)))for(var r=0;r<n.length;r++){var i=n[r],a=i.getSnapshot;i=i.value;try{if(!yr(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 Du(e,t,n,r){t&=~tu,t&=~eu,e.suspendedLanes|=t,e.pingedLanes&=~t,r&&(e.warmLanes|=t),r=e.expirationTimes;for(var i=t;0<i;){var a=31-Ie(i),o=1<<a;r[a]=-1,i&=~o}n!==0&&Ye(e,n,t)}function Ou(){return Hl&6?!0:(pd(0,!1),!1)}function ku(){if(Wl!==null){if(Kl===0)var e=Wl.return;else e=Wl,Gi=Wi=null,ko(e),Aa=null,ja=0,e=Wl;for(;e!==null;)Hc(e.alternate,e),e=e.return;Wl=null}}function Au(e,t){var n=e.timeoutHandle;n!==-1&&(e.timeoutHandle=-1,ef(n)),n=e.cancelPendingCommit,n!==null&&(e.cancelPendingCommit=null,n()),hu=0,ku(),Ul=e,Wl=n=si(e.current,null),Gl=t,Kl=0,ql=null,Jl=!1,Yl=Ue(e,t),Xl=!1,ru=nu=tu=eu=$l=Ql=0,au=iu=null,ou=!1,t&8&&(t|=t&32);var r=e.entangledLanes;if(r!==0)for(e=e.entanglements,r&=t;0<r;){var i=31-Ie(r),a=1<<i;t|=e[i],r&=~a}return Zl=t,Zr(),n}function ju(e,t){H=null,P.H=zs,t===ba||t===Sa?(t=Oa(),Kl=3):t===xa?(t=Oa(),Kl=4):Kl=t===rc?8:typeof t==`object`&&t&&typeof t.then==`function`?6:1,ql=t,Wl===null&&(Ql=1,Zs(e,hi(t,e.current)))}function Mu(){var e=to.current;return e===null?!0:(Gl&4194048)===Gl?no===null:(Gl&62914560)===Gl||Gl&536870912?e===no:!1}function Nu(){var e=P.H;return P.H=zs,e===null?zs:e}function Pu(){var e=P.A;return P.A=Bl,e}function Fu(){Ql=4,Jl||(Gl&4194048)!==Gl&&to.current!==null||(Yl=!0),!($l&134217727)&&!(eu&134217727)||Ul===null||Du(Ul,Gl,nu,!1)}function Iu(e,t,n){var r=Hl;Hl|=2;var i=Nu(),a=Pu();(Ul!==e||Gl!==t)&&(uu=null,Au(e,t)),t=!1;var o=Ql;a:do try{if(Kl!==0&&Wl!==null){var s=Wl,c=ql;switch(Kl){case 8:ku(),o=6;break a;case 3:case 2:case 9:case 6:to.current===null&&(t=!0);var l=Kl;if(Kl=0,ql=null,Hu(e,s,c,l),n&&Yl){o=0;break a}break;default:l=Kl,Kl=0,ql=null,Hu(e,s,c,l)}}Lu(),o=Ql;break}catch(t){ju(e,t)}while(1);return t&&e.shellSuspendCounter++,Gi=Wi=null,Hl=r,P.H=i,P.A=a,Wl===null&&(Ul=null,Gl=0,Zr()),o}function Lu(){for(;Wl!==null;)Bu(Wl)}function Ru(e,t){var n=Hl;Hl|=2;var r=Nu(),a=Pu();Ul!==e||Gl!==t?(uu=null,lu=we()+500,Au(e,t)):Yl=Ue(e,t);a:do try{if(Kl!==0&&Wl!==null){t=Wl;var o=ql;b:switch(Kl){case 1:Kl=0,ql=null,Hu(e,t,o,1);break;case 2:case 9:if(wa(o)){Kl=0,ql=null,Vu(t);break}t=function(){Kl!==2&&Kl!==9||Ul!==e||(Kl=7),fd(e)},o.then(t,t);break a;case 3:Kl=7;break a;case 4:Kl=5;break a;case 7:wa(o)?(Kl=0,ql=null,Vu(t)):(Kl=0,ql=null,Hu(e,t,o,7));break;case 5:var s=null;switch(Wl.tag){case 26:s=Wl.memoizedState;case 5:case 27:var c=Wl;if(s?Xf(s):c.stateNode.complete){Kl=0,ql=null;var l=c.sibling;if(l!==null)Wl=l;else{var u=c.return;u===null?Wl=null:(Wl=u,Uu(u))}break b}}Kl=0,ql=null,Hu(e,t,o,5);break;case 6:Kl=0,ql=null,Hu(e,t,o,6);break;case 8:ku(),Ql=6;break a;default:throw Error(i(462))}}zu();break}catch(t){ju(e,t)}while(1);return Gi=Wi=null,P.H=r,P.A=a,Hl=n,Wl===null?(Ul=null,Gl=0,Zr(),Ql):0}function zu(){for(;Wl!==null&&!Se();)Bu(Wl)}function Bu(e){var t=Nc(e.alternate,e,Zl);e.memoizedProps=e.pendingProps,t===null?Uu(e):Wl=t}function Vu(e){var t=e,n=t.alternate;switch(t.tag){case 15:case 0:t=_c(n,t,t.pendingProps,t.type,void 0,Gl);break;case 11:t=_c(n,t,t.pendingProps,t.type.render,t.ref,Gl);break;case 5:ko(t);default:Hc(n,t),t=Wl=ci(t,Zl),t=Nc(n,t,Zl)}e.memoizedProps=e.pendingProps,t===null?Uu(e):Wl=t}function Hu(e,t,n,r){Gi=Wi=null,ko(t),Aa=null,ja=0;var i=t.return;try{if(nc(e,i,t,n,Gl)){Ql=1,Zs(e,hi(n,e.current)),Wl=null;return}}catch(t){if(i!==null)throw Wl=i,t;Ql=1,Zs(e,hi(n,e.current)),Wl=null;return}t.flags&32768?(Mi||r===1?e=!0:Yl||Gl&536870912?e=!1:(Jl=e=!0,(r===2||r===9||r===3||r===6)&&(r=to.current,r!==null&&r.tag===13&&(r.flags|=16384))),Wu(t,e)):Uu(t)}function Uu(e){var t=e;do{if(t.flags&32768){Wu(t,Jl);return}e=t.return;var n=Bc(t.alternate,t,Zl);if(n!==null){Wl=n;return}if(t=t.sibling,t!==null){Wl=t;return}Wl=t=e}while(t!==null);Ql===0&&(Ql=5)}function Wu(e,t){do{var n=Vc(e.alternate,e);if(n!==null){n.flags&=32767,Wl=n;return}if(n=e.return,n!==null&&(n.flags|=32768,n.subtreeFlags=0,n.deletions=null),!t&&(e=e.sibling,e!==null)){Wl=e;return}Wl=e=n}while(e!==null);Ql=6,Wl=null}function Gu(e,t,n,r,a,o,s,c,l){e.cancelPendingCommit=null;do Xu();while(fu!==0);if(Hl&6)throw Error(i(327));if(t!==null){if(t===e.current)throw Error(i(177));if(o=t.lanes|t.childLanes,o|=Xr,Je(e,n,o,s,c,l),e===Ul&&(Wl=Ul=null,Gl=0),mu=t,pu=e,hu=n,gu=o,_u=a,vu=r,t.subtreeFlags&10256||t.flags&10256?(e.callbackNode=null,e.callbackPriority=0,ad(Oe,function(){return Zu(),null})):(e.callbackNode=null,e.callbackPriority=0),r=(t.flags&13878)!=0,t.subtreeFlags&13878||r){r=P.T,P.T=null,a=F.p,F.p=2,s=Hl,Hl|=4;try{sl(e,t,n)}finally{Hl=s,F.p=a,P.T=r}}fu=1,Ku(),qu(),Ju()}}function Ku(){if(fu===1){fu=0;var e=pu,t=mu,n=(t.flags&13878)!=0;if(t.subtreeFlags&13878||n){n=P.T,P.T=null;var r=F.p;F.p=2;var i=Hl;Hl|=4;try{bl(t,e);var a=qd,o=wr(e.containerInfo),s=a.focusedElem,c=a.selectionRange;if(o!==s&&s&&s.ownerDocument&&Cr(s.ownerDocument.documentElement,s)){if(c!==null&&Tr(s)){var l=c.start,u=c.end;if(u===void 0&&(u=l),`selectionStart`in s)s.selectionStart=l,s.selectionEnd=Math.min(u,s.value.length);else{var d=s.ownerDocument||document,f=d&&d.defaultView||window;if(f.getSelection){var p=f.getSelection(),m=s.textContent.length,h=Math.min(c.start,m),g=c.end===void 0?h:Math.min(c.end,m);!p.extend&&h>g&&(o=g,g=h,h=o);var _=Sr(s,h),v=Sr(s,g);if(_&&v&&(p.rangeCount!==1||p.anchorNode!==_.node||p.anchorOffset!==_.offset||p.focusNode!==v.node||p.focusOffset!==v.offset)){var y=d.createRange();y.setStart(_.node,_.offset),p.removeAllRanges(),h>g?(p.addRange(y),p.extend(v.node,v.offset)):(y.setEnd(v.node,v.offset),p.addRange(y))}}}}for(d=[],p=s;p=p.parentNode;)p.nodeType===1&&d.push({element:p,left:p.scrollLeft,top:p.scrollTop});for(typeof s.focus==`function`&&s.focus(),s=0;s<d.length;s++){var b=d[s];b.element.scrollLeft=b.left,b.element.scrollTop=b.top}}fp=!!Kd,qd=Kd=null}finally{Hl=i,F.p=r,P.T=n}}e.current=t,fu=2}}function qu(){if(fu===2){fu=0;var e=pu,t=mu,n=(t.flags&8772)!=0;if(t.subtreeFlags&8772||n){n=P.T,P.T=null;var r=F.p;F.p=2;var i=Hl;Hl|=4;try{cl(e,t.alternate,t)}finally{Hl=i,F.p=r,P.T=n}}fu=3}}function Ju(){if(fu===4||fu===3){fu=0,Ce();var e=pu,t=mu,n=hu,r=vu;t.subtreeFlags&10256||t.flags&10256?fu=5:(fu=0,mu=pu=null,Yu(e,e.pendingLanes));var i=e.pendingLanes;if(i===0&&(du=null),$e(n),t=t.stateNode,Pe&&typeof Pe.onCommitFiberRoot==`function`)try{Pe.onCommitFiberRoot(Ne,t,void 0,(t.current.flags&128)==128)}catch{}if(r!==null){t=P.T,i=F.p,F.p=2,P.T=null;try{for(var a=e.onRecoverableError,o=0;o<r.length;o++){var s=r[o];a(s.value,{componentStack:s.stack})}}finally{P.T=t,F.p=i}}hu&3&&Xu(),fd(e),i=e.pendingLanes,n&261930&&i&42?e===bu?yu++:(yu=0,bu=e):yu=0,pd(0,!1)}}function Yu(e,t){(e.pooledCacheLanes&=t)===0&&(t=e.pooledCache,t!=null&&(e.pooledCache=null,sa(t)))}function Xu(){return Ku(),qu(),Ju(),Zu()}function Zu(){if(fu!==5)return!1;var e=pu,t=gu;gu=0;var n=$e(hu),r=P.T,a=F.p;try{F.p=32>n?32:n,P.T=null,n=_u,_u=null;var o=pu,s=hu;if(fu=0,mu=pu=null,hu=0,Hl&6)throw Error(i(331));var c=Hl;if(Hl|=4,Ll(o.current),kl(o,o.current,s,n),Hl=c,pd(0,!1),Pe&&typeof Pe.onPostCommitFiberRoot==`function`)try{Pe.onPostCommitFiberRoot(Ne,o)}catch{}return!0}finally{F.p=a,P.T=r,Yu(e,t)}}function Qu(e,t,n){t=hi(n,t),t=$s(e.stateNode,t,2),e=Ha(e,t,2),e!==null&&(qe(e,2),fd(e))}function $u(e,t,n){if(e.tag===3)Qu(e,e,n);else for(;t!==null;){if(t.tag===3){Qu(t,e,n);break}else if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError==`function`||typeof r.componentDidCatch==`function`&&(du===null||!du.has(r))){e=hi(n,e),n=ec(2),r=Ha(t,n,2),r!==null&&(tc(n,r,t,e),qe(r,2),fd(r));break}}t=t.return}}function ed(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new Vl;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)||(Xl=!0,i.add(n),e=td.bind(null,e,t,n),t.then(e,e))}function td(e,t,n){var r=e.pingCache;r!==null&&r.delete(t),e.pingedLanes|=e.suspendedLanes&n,e.warmLanes&=~n,Ul===e&&(Gl&n)===n&&(Ql===4||Ql===3&&(Gl&62914560)===Gl&&300>we()-su?!(Hl&2)&&Au(e,0):tu|=n,ru===Gl&&(ru=0)),fd(e)}function nd(e,t){t===0&&(t=Ge()),e=ei(e,t),e!==null&&(qe(e,t),fd(e))}function rd(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),nd(e,n)}function id(e,t){var n=0;switch(e.tag){case 31:case 13:var r=e.stateNode,a=e.memoizedState;a!==null&&(n=a.retryLane);break;case 19:r=e.stateNode;break;case 22:r=e.stateNode._retryCache;break;default:throw Error(i(314))}r!==null&&r.delete(t),nd(e,n)}function ad(e,t){return be(e,t)}var od=null,sd=null,cd=!1,ld=!1,ud=!1,dd=0;function fd(e){e!==sd&&e.next===null&&(sd===null?od=sd=e:sd=sd.next=e),ld=!0,cd||(cd=!0,vd())}function pd(e,t){if(!ud&&ld){ud=!0;do for(var n=!1,r=od;r!==null;){if(!t)if(e!==0){var i=r.pendingLanes;if(i===0)var a=0;else{var o=r.suspendedLanes,s=r.pingedLanes;a=(1<<31-Ie(42|e)+1)-1,a&=i&~(o&~s),a=a&201326741?a&201326741|1:a?a|2:0}a!==0&&(n=!0,_d(r,a))}else a=Gl,a=V(r,r===Ul?a:0,r.cancelPendingCommit!==null||r.timeoutHandle!==-1),!(a&3)||Ue(r,a)||(n=!0,_d(r,a));r=r.next}while(n);ud=!1}}function md(){U()}function U(){ld=cd=!1;var e=0;dd!==0&&Qd()&&(e=dd);for(var t=we(),n=null,r=od;r!==null;){var i=r.next,a=hd(r,t);a===0?(r.next=null,n===null?od=i:n.next=i,i===null&&(sd=n)):(n=r,(e!==0||a&3)&&(ld=!0)),r=i}fu!==0&&fu!==5||pd(e,!1),dd!==0&&(dd=0)}function hd(e,t){for(var n=e.suspendedLanes,r=e.pingedLanes,i=e.expirationTimes,a=e.pendingLanes&-62914561;0<a;){var o=31-Ie(a),s=1<<o,c=i[o];c===-1?((s&n)===0||(s&r)!==0)&&(i[o]=We(s,t)):c<=t&&(e.expiredLanes|=s),a&=~s}if(t=Ul,n=Gl,n=V(e,e===t?n:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),r=e.callbackNode,n===0||e===t&&(Kl===2||Kl===9)||e.cancelPendingCommit!==null)return r!==null&&r!==null&&xe(r),e.callbackNode=null,e.callbackPriority=0;if(!(n&3)||Ue(e,n)){if(t=n&-n,t===e.callbackPriority)return t;switch(r!==null&&xe(r),$e(n)){case 2:case 8:n=De;break;case 32:n=Oe;break;case 268435456:n=Ae;break;default:n=Oe}return r=gd.bind(null,e),n=be(n,r),e.callbackPriority=t,e.callbackNode=n,t}return r!==null&&r!==null&&xe(r),e.callbackPriority=2,e.callbackNode=null,2}function gd(e,t){if(fu!==0&&fu!==5)return e.callbackNode=null,e.callbackPriority=0,null;var n=e.callbackNode;if(Xu()&&e.callbackNode!==n)return null;var r=Gl;return r=V(e,e===Ul?r:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),r===0?null:(wu(e,r,t),hd(e,we()),e.callbackNode!=null&&e.callbackNode===n?gd.bind(null,e):null)}function _d(e,t){if(Xu())return null;wu(e,t,!0)}function vd(){nf(function(){Hl&6?be(Ee,md):U()})}function yd(){if(dd===0){var e=ua;e===0&&(e=Be,Be<<=1,!(Be&261888)&&(Be=256)),dd=e}return dd}function bd(e){return e==null||typeof e==`symbol`||typeof e==`boolean`?null:typeof e==`function`?e:Yt(``+e)}function xd(e,t){var n=t.ownerDocument.createElement(`input`);return n.name=t.name,n.value=t.value,e.id&&n.setAttribute(`form`,e.id),t.parentNode.insertBefore(n,t),e=new FormData(e),n.parentNode.removeChild(n),e}function Sd(e,t,n,r,i){if(t===`submit`&&n&&n.stateNode===i){var a=bd((i[it]||null).action),o=r.submitter;o&&(t=(t=o[it]||null)?bd(t.formAction):o.getAttribute(`formAction`),t!==null&&(a=t,o=null));var s=new vn(`action`,`action`,null,r,i);e.push({event:s,listeners:[{instance:null,listener:function(){if(r.defaultPrevented){if(dd!==0){var e=o?xd(i,o):new FormData(i);Ts(n,{pending:!0,data:e,method:i.method,action:a},null,e)}}else typeof a==`function`&&(s.preventDefault(),e=o?xd(i,o):new FormData(i),Ts(n,{pending:!0,data:e,method:i.method,action:a},a,e))},currentTarget:i}]})}}for(var Cd=0;Cd<Gr.length;Cd++){var wd=Gr[Cd];Kr(wd.toLowerCase(),`on`+(wd[0].toUpperCase()+wd.slice(1)))}Kr(Lr,`onAnimationEnd`),Kr(Rr,`onAnimationIteration`),Kr(zr,`onAnimationStart`),Kr(`dblclick`,`onDoubleClick`),Kr(`focusin`,`onFocus`),Kr(`focusout`,`onBlur`),Kr(Br,`onTransitionRun`),Kr(Vr,`onTransitionStart`),Kr(Hr,`onTransitionCancel`),Kr(Ur,`onTransitionEnd`),bt(`onMouseEnter`,[`mouseout`,`mouseover`]),bt(`onMouseLeave`,[`mouseout`,`mouseover`]),bt(`onPointerEnter`,[`pointerout`,`pointerover`]),bt(`onPointerLeave`,[`pointerout`,`pointerover`]),yt(`onChange`,`change click focusin focusout input keydown keyup selectionchange`.split(` `)),yt(`onSelect`,`focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange`.split(` `)),yt(`onBeforeInput`,[`compositionend`,`keypress`,`textInput`,`paste`]),yt(`onCompositionEnd`,`compositionend focusout keydown keypress keyup mousedown`.split(` `)),yt(`onCompositionStart`,`compositionstart focusout keydown keypress keyup mousedown`.split(` `)),yt(`onCompositionUpdate`,`compositionupdate focusout keydown keypress keyup mousedown`.split(` `));var Td=`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(` `),W=new Set(`beforetoggle cancel close invalid load scroll scrollend toggle`.split(` `).concat(Td));function Ed(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;a=s,i.currentTarget=l;try{a(i)}catch(e){qr(e)}i.currentTarget=null,a=c}else for(o=0;o<r.length;o++){if(s=r[o],c=s.instance,l=s.currentTarget,s=s.listener,c!==a&&i.isPropagationStopped())break a;a=s,i.currentTarget=l;try{a(i)}catch(e){qr(e)}i.currentTarget=null,a=c}}}}function Dd(e,t){var n=t[ot];n===void 0&&(n=t[ot]=new Set);var r=e+`__bubble`;n.has(r)||(jd(t,e,2,!1),n.add(r))}function Od(e,t,n){var r=0;t&&(r|=4),jd(n,e,r,t)}var kd=`_reactListening`+Math.random().toString(36).slice(2);function Ad(e){if(!e[kd]){e[kd]=!0,_t.forEach(function(t){t!==`selectionchange`&&(W.has(t)||Od(t,!1,e),Od(t,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[kd]||(t[kd]=!0,Od(`selectionchange`,!1,t))}}function jd(e,t,n,r){switch(yp(t)){case 2:var i=pp;break;case 8:i=mp;break;default:i=hp}n=i.bind(null,t,n,e),i=void 0,!sn||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 Md(e,t,n,r,i){var a=r;if(!(t&1)&&!(t&2)&&r!==null)a:for(;;){if(r===null)return;var s=r.tag;if(s===3||s===4){var c=r.stateNode.containerInfo;if(c===i)break;if(s===4)for(s=r.return;s!==null;){var l=s.tag;if((l===3||l===4)&&s.stateNode.containerInfo===i)return;s=s.return}for(;c!==null;){if(s=ft(c),s===null)return;if(l=s.tag,l===5||l===6||l===26||l===27){r=a=s;continue a}c=c.parentNode}}r=r.return}rn(function(){var r=a,i=Qt(n),s=[];a:{var c=Wr.get(e);if(c!==void 0){var l=vn,u=e;switch(e){case`keypress`:if(pn(n)===0)break a;case`keydown`:case`keyup`:l=In;break;case`focusin`:u=`focus`,l=Dn;break;case`focusout`:u=`blur`,l=Dn;break;case`beforeblur`:case`afterblur`:l=Dn;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`:l=Tn;break;case`drag`:case`dragend`:case`dragenter`:case`dragexit`:case`dragleave`:case`dragover`:case`dragstart`:case`drop`:l=En;break;case`touchcancel`:case`touchend`:case`touchmove`:case`touchstart`:l=Rn;break;case Lr:case Rr:case zr:l=On;break;case Ur:l=zn;break;case`scroll`:case`scrollend`:l=bn;break;case`wheel`:l=Bn;break;case`copy`:case`cut`:case`paste`:l=kn;break;case`gotpointercapture`:case`lostpointercapture`:case`pointercancel`:case`pointerdown`:case`pointermove`:case`pointerout`:case`pointerover`:case`pointerup`:l=Ln;break;case`toggle`:case`beforetoggle`:l=Vn}var d=(t&4)!=0,f=!d&&(e===`scroll`||e===`scrollend`),p=d?c===null?null:c+`Capture`:c;d=[];for(var m=r,h;m!==null;){var g=m;if(h=g.stateNode,g=g.tag,g!==5&&g!==26&&g!==27||h===null||p===null||(g=an(m,p),g!=null&&d.push(G(m,g,h))),f)break;m=m.return}0<d.length&&(c=new l(c,u,null,n,i),s.push({event:c,listeners:d}))}}if(!(t&7)){a:{if(c=e===`mouseover`||e===`pointerover`,l=e===`mouseout`||e===`pointerout`,c&&n!==Zt&&(u=n.relatedTarget||n.fromElement)&&(ft(u)||u[at]))break a;if((l||c)&&(c=i.window===i?i:(c=i.ownerDocument)?c.defaultView||c.parentWindow:window,l?(u=n.relatedTarget||n.toElement,l=r,u=u?ft(u):null,u!==null&&(f=o(u),d=u.tag,u!==f||d!==5&&d!==27&&d!==6)&&(u=null)):(l=null,u=r),l!==u)){if(d=Tn,g=`onMouseLeave`,p=`onMouseEnter`,m=`mouse`,(e===`pointerout`||e===`pointerover`)&&(d=Ln,g=`onPointerLeave`,p=`onPointerEnter`,m=`pointer`),f=l==null?c:mt(l),h=u==null?c:mt(u),c=new d(g,m+`leave`,l,n,i),c.target=f,c.relatedTarget=h,g=null,ft(i)===r&&(d=new d(p,m+`enter`,u,n,i),d.target=h,d.relatedTarget=f,g=d),f=g,l&&u)b:{for(d=Pd,p=l,m=u,h=0,g=p;g;g=d(g))h++;g=0;for(var _=m;_;_=d(_))g++;for(;0<h-g;)p=d(p),h--;for(;0<g-h;)m=d(m),g--;for(;h--;){if(p===m||m!==null&&p===m.alternate){d=p;break b}p=d(p),m=d(m)}d=null}else d=null;l!==null&&Fd(s,c,l,d,!1),u!==null&&f!==null&&Fd(s,f,u,d,!0)}}a:{if(c=r?mt(r):window,l=c.nodeName&&c.nodeName.toLowerCase(),l===`select`||l===`input`&&c.type===`file`)var v=sr;else if(tr(c))if(cr)v=_r;else{v=hr;var y=mr}else l=c.nodeName,!l||l.toLowerCase()!==`input`||c.type!==`checkbox`&&c.type!==`radio`?r&&Kt(r.elementType)&&(v=sr):v=gr;if(v&&=v(e,r)){nr(s,v,n,i);break a}y&&y(e,c,r),e===`focusout`&&r&&c.type===`number`&&r.memoizedProps.value!=null&&Rt(c,`number`,c.value)}switch(y=r?mt(r):window,e){case`focusin`:(tr(y)||y.contentEditable===`true`)&&(Dr=y,Or=r,kr=null);break;case`focusout`:kr=Or=Dr=null;break;case`mousedown`:Ar=!0;break;case`contextmenu`:case`mouseup`:case`dragend`:Ar=!1,jr(s,n,i);break;case`selectionchange`:if(Er)break;case`keydown`:case`keyup`:jr(s,n,i)}var b;if(Un)b:{switch(e){case`compositionstart`:var x=`onCompositionStart`;break b;case`compositionend`:x=`onCompositionEnd`;break b;case`compositionupdate`:x=`onCompositionUpdate`;break b}x=void 0}else Zn?Yn(e,n)&&(x=`onCompositionEnd`):e===`keydown`&&n.keyCode===229&&(x=`onCompositionStart`);x&&(Kn&&n.locale!==`ko`&&(Zn||x!==`onCompositionStart`?x===`onCompositionEnd`&&Zn&&(b=fn()):(ln=i,un=`value`in ln?ln.value:ln.textContent,Zn=!0)),y=Nd(r,x),0<y.length&&(x=new An(x,e,null,n,i),s.push({event:x,listeners:y}),b?x.data=b:(b=Xn(n),b!==null&&(x.data=b)))),(b=Gn?Qn(e,n):$n(e,n))&&(x=Nd(r,`onBeforeInput`),0<x.length&&(y=new An(`onBeforeInput`,`beforeinput`,null,n,i),s.push({event:y,listeners:x}),y.data=b)),Sd(s,e,r,n,i)}Ed(s,t)})}function G(e,t,n){return{instance:e,listener:t,currentTarget:n}}function Nd(e,t){for(var n=t+`Capture`,r=[];e!==null;){var i=e,a=i.stateNode;if(i=i.tag,i!==5&&i!==26&&i!==27||a===null||(i=an(e,n),i!=null&&r.unshift(G(e,i,a)),i=an(e,t),i!=null&&r.push(G(e,i,a))),e.tag===3)return r;e=e.return}return[]}function Pd(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function Fd(e,t,n,r,i){for(var a=t._reactName,o=[];n!==null&&n!==r;){var s=n,c=s.alternate,l=s.stateNode;if(s=s.tag,c!==null&&c===r)break;s!==5&&s!==26&&s!==27||l===null||(c=l,i?(l=an(n,a),l!=null&&o.unshift(G(n,l,c))):i||(l=an(n,a),l!=null&&o.push(G(n,l,c)))),n=n.return}o.length!==0&&e.push({event:t,listeners:o})}var Id=/\r\n?/g,Ld=/\u0000|\uFFFD/g;function Rd(e){return(typeof e==`string`?e:``+e).replace(Id,`
9
+ `).replace(Ld,``)}function zd(e,t){return t=Rd(t),Rd(e)===t}function Bd(e,t,n,r,a,o){switch(n){case`children`:typeof r==`string`?t===`body`||t===`textarea`&&r===``||Ht(e,r):(typeof r==`number`||typeof r==`bigint`)&&t!==`body`&&Ht(e,``+r);break;case`className`:Et(e,`class`,r);break;case`tabIndex`:Et(e,`tabindex`,r);break;case`dir`:case`role`:case`viewBox`:case`width`:case`height`:Et(e,n,r);break;case`style`:Gt(e,r,o);break;case`data`:if(t!==`object`){Et(e,`data`,r);break}case`src`:case`href`:if(r===``&&(t!==`a`||n!==`href`)){e.removeAttribute(n);break}if(r==null||typeof r==`function`||typeof r==`symbol`||typeof r==`boolean`){e.removeAttribute(n);break}r=Yt(``+r),e.setAttribute(n,r);break;case`action`:case`formAction`:if(typeof r==`function`){e.setAttribute(n,`javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')`);break}else typeof o==`function`&&(n===`formAction`?(t!==`input`&&Bd(e,t,`name`,a.name,a,null),Bd(e,t,`formEncType`,a.formEncType,a,null),Bd(e,t,`formMethod`,a.formMethod,a,null),Bd(e,t,`formTarget`,a.formTarget,a,null)):(Bd(e,t,`encType`,a.encType,a,null),Bd(e,t,`method`,a.method,a,null),Bd(e,t,`target`,a.target,a,null)));if(r==null||typeof r==`symbol`||typeof r==`boolean`){e.removeAttribute(n);break}r=Yt(``+r),e.setAttribute(n,r);break;case`onClick`:r!=null&&(e.onclick=Xt);break;case`onScroll`:r!=null&&Dd(`scroll`,e);break;case`onScrollEnd`:r!=null&&Dd(`scrollend`,e);break;case`dangerouslySetInnerHTML`:if(r!=null){if(typeof r!=`object`||!(`__html`in r))throw Error(i(61));if(n=r.__html,n!=null){if(a.children!=null)throw Error(i(60));e.innerHTML=n}}break;case`multiple`:e.multiple=r&&typeof r!=`function`&&typeof r!=`symbol`;break;case`muted`:e.muted=r&&typeof r!=`function`&&typeof r!=`symbol`;break;case`suppressContentEditableWarning`:case`suppressHydrationWarning`:case`defaultValue`:case`defaultChecked`:case`innerHTML`:case`ref`:break;case`autoFocus`:break;case`xlinkHref`:if(r==null||typeof r==`function`||typeof r==`boolean`||typeof r==`symbol`){e.removeAttribute(`xlink:href`);break}n=Yt(``+r),e.setAttributeNS(`http://www.w3.org/1999/xlink`,`xlink:href`,n);break;case`contentEditable`:case`spellCheck`:case`draggable`:case`value`:case`autoReverse`:case`externalResourcesRequired`:case`focusable`:case`preserveAlpha`:r!=null&&typeof r!=`function`&&typeof r!=`symbol`?e.setAttribute(n,``+r):e.removeAttribute(n);break;case`inert`:case`allowFullScreen`:case`async`:case`autoPlay`:case`controls`:case`default`:case`defer`:case`disabled`:case`disablePictureInPicture`:case`disableRemotePlayback`:case`formNoValidate`:case`hidden`:case`loop`:case`noModule`:case`noValidate`:case`open`:case`playsInline`:case`readOnly`:case`required`:case`reversed`:case`scoped`:case`seamless`:case`itemScope`:r&&typeof r!=`function`&&typeof r!=`symbol`?e.setAttribute(n,``):e.removeAttribute(n);break;case`capture`:case`download`:!0===r?e.setAttribute(n,``):!1!==r&&r!=null&&typeof r!=`function`&&typeof r!=`symbol`?e.setAttribute(n,r):e.removeAttribute(n);break;case`cols`:case`rows`:case`size`:case`span`:r!=null&&typeof r!=`function`&&typeof r!=`symbol`&&!isNaN(r)&&1<=r?e.setAttribute(n,r):e.removeAttribute(n);break;case`rowSpan`:case`start`:r==null||typeof r==`function`||typeof r==`symbol`||isNaN(r)?e.removeAttribute(n):e.setAttribute(n,r);break;case`popover`:Dd(`beforetoggle`,e),Dd(`toggle`,e),Tt(e,`popover`,r);break;case`xlinkActuate`:Dt(e,`http://www.w3.org/1999/xlink`,`xlink:actuate`,r);break;case`xlinkArcrole`:Dt(e,`http://www.w3.org/1999/xlink`,`xlink:arcrole`,r);break;case`xlinkRole`:Dt(e,`http://www.w3.org/1999/xlink`,`xlink:role`,r);break;case`xlinkShow`:Dt(e,`http://www.w3.org/1999/xlink`,`xlink:show`,r);break;case`xlinkTitle`:Dt(e,`http://www.w3.org/1999/xlink`,`xlink:title`,r);break;case`xlinkType`:Dt(e,`http://www.w3.org/1999/xlink`,`xlink:type`,r);break;case`xmlBase`:Dt(e,`http://www.w3.org/XML/1998/namespace`,`xml:base`,r);break;case`xmlLang`:Dt(e,`http://www.w3.org/XML/1998/namespace`,`xml:lang`,r);break;case`xmlSpace`:Dt(e,`http://www.w3.org/XML/1998/namespace`,`xml:space`,r);break;case`is`:Tt(e,`is`,r);break;case`innerText`:case`textContent`:break;default:(!(2<n.length)||n[0]!==`o`&&n[0]!==`O`||n[1]!==`n`&&n[1]!==`N`)&&(n=qt.get(n)||n,Tt(e,n,r))}}function Vd(e,t,n,r,a,o){switch(n){case`style`:Gt(e,r,o);break;case`dangerouslySetInnerHTML`:if(r!=null){if(typeof r!=`object`||!(`__html`in r))throw Error(i(61));if(n=r.__html,n!=null){if(a.children!=null)throw Error(i(60));e.innerHTML=n}}break;case`children`:typeof r==`string`?Ht(e,r):(typeof r==`number`||typeof r==`bigint`)&&Ht(e,``+r);break;case`onScroll`:r!=null&&Dd(`scroll`,e);break;case`onScrollEnd`:r!=null&&Dd(`scrollend`,e);break;case`onClick`:r!=null&&(e.onclick=Xt);break;case`suppressContentEditableWarning`:case`suppressHydrationWarning`:case`innerHTML`:case`ref`:break;case`innerText`:case`textContent`:break;default:if(!vt.hasOwnProperty(n))a:{if(n[0]===`o`&&n[1]===`n`&&(a=n.endsWith(`Capture`),t=n.slice(2,a?n.length-7:void 0),o=e[it]||null,o=o==null?null:o[n],typeof o==`function`&&e.removeEventListener(t,o,a),typeof r==`function`)){typeof o!=`function`&&o!==null&&(n in e?e[n]=null:e.hasAttribute(n)&&e.removeAttribute(n)),e.addEventListener(t,r,a);break a}n in e?e[n]=r:!0===r?e.setAttribute(n,``):Tt(e,n,r)}}}function Hd(e,t,n){switch(t){case`div`:case`span`:case`svg`:case`path`:case`a`:case`g`:case`p`:case`li`:break;case`img`:Dd(`error`,e),Dd(`load`,e);var r=!1,a=!1,o;for(o in n)if(n.hasOwnProperty(o)){var s=n[o];if(s!=null)switch(o){case`src`:r=!0;break;case`srcSet`:a=!0;break;case`children`:case`dangerouslySetInnerHTML`:throw Error(i(137,t));default:Bd(e,t,o,s,n,null)}}a&&Bd(e,t,`srcSet`,n.srcSet,n,null),r&&Bd(e,t,`src`,n.src,n,null);return;case`input`:Dd(`invalid`,e);var c=o=s=a=null,l=null,u=null;for(r in n)if(n.hasOwnProperty(r)){var d=n[r];if(d!=null)switch(r){case`name`:a=d;break;case`type`:s=d;break;case`checked`:l=d;break;case`defaultChecked`:u=d;break;case`value`:o=d;break;case`defaultValue`:c=d;break;case`children`:case`dangerouslySetInnerHTML`:if(d!=null)throw Error(i(137,t));break;default:Bd(e,t,r,d,n,null)}}Lt(e,o,c,l,u,s,a,!1);return;case`select`:for(a in Dd(`invalid`,e),r=s=o=null,n)if(n.hasOwnProperty(a)&&(c=n[a],c!=null))switch(a){case`value`:o=c;break;case`defaultValue`:s=c;break;case`multiple`:r=c;default:Bd(e,t,a,c,n,null)}t=o,n=s,e.multiple=!!r,t==null?n!=null&&zt(e,!!r,n,!0):zt(e,!!r,t,!1);return;case`textarea`:for(s in Dd(`invalid`,e),o=a=r=null,n)if(n.hasOwnProperty(s)&&(c=n[s],c!=null))switch(s){case`value`:r=c;break;case`defaultValue`:a=c;break;case`children`:o=c;break;case`dangerouslySetInnerHTML`:if(c!=null)throw Error(i(91));break;default:Bd(e,t,s,c,n,null)}Vt(e,r,a,o);return;case`option`:for(l in n)if(n.hasOwnProperty(l)&&(r=n[l],r!=null))switch(l){case`selected`:e.selected=r&&typeof r!=`function`&&typeof r!=`symbol`;break;default:Bd(e,t,l,r,n,null)}return;case`dialog`:Dd(`beforetoggle`,e),Dd(`toggle`,e),Dd(`cancel`,e),Dd(`close`,e);break;case`iframe`:case`object`:Dd(`load`,e);break;case`video`:case`audio`:for(r=0;r<Td.length;r++)Dd(Td[r],e);break;case`image`:Dd(`error`,e),Dd(`load`,e);break;case`details`:Dd(`toggle`,e);break;case`embed`:case`source`:case`link`:Dd(`error`,e),Dd(`load`,e);case`area`:case`base`:case`br`:case`col`:case`hr`:case`keygen`:case`meta`:case`param`:case`track`:case`wbr`:case`menuitem`:for(u in n)if(n.hasOwnProperty(u)&&(r=n[u],r!=null))switch(u){case`children`:case`dangerouslySetInnerHTML`:throw Error(i(137,t));default:Bd(e,t,u,r,n,null)}return;default:if(Kt(t)){for(d in n)n.hasOwnProperty(d)&&(r=n[d],r!==void 0&&Vd(e,t,d,r,n,void 0));return}}for(c in n)n.hasOwnProperty(c)&&(r=n[c],r!=null&&Bd(e,t,c,r,n,null))}function Ud(e,t,n,r){switch(t){case`div`:case`span`:case`svg`:case`path`:case`a`:case`g`:case`p`:case`li`:break;case`input`:var a=null,o=null,s=null,c=null,l=null,u=null,d=null;for(m in n){var f=n[m];if(n.hasOwnProperty(m)&&f!=null)switch(m){case`checked`:break;case`value`:break;case`defaultValue`:l=f;default:r.hasOwnProperty(m)||Bd(e,t,m,null,r,f)}}for(var p in r){var m=r[p];if(f=n[p],r.hasOwnProperty(p)&&(m!=null||f!=null))switch(p){case`type`:o=m;break;case`name`:a=m;break;case`checked`:u=m;break;case`defaultChecked`:d=m;break;case`value`:s=m;break;case`defaultValue`:c=m;break;case`children`:case`dangerouslySetInnerHTML`:if(m!=null)throw Error(i(137,t));break;default:m!==f&&Bd(e,t,p,m,r,f)}}It(e,s,c,l,u,d,o,a);return;case`select`:for(o in m=s=c=p=null,n)if(l=n[o],n.hasOwnProperty(o)&&l!=null)switch(o){case`value`:break;case`multiple`:m=l;default:r.hasOwnProperty(o)||Bd(e,t,o,null,r,l)}for(a in r)if(o=r[a],l=n[a],r.hasOwnProperty(a)&&(o!=null||l!=null))switch(a){case`value`:p=o;break;case`defaultValue`:c=o;break;case`multiple`:s=o;default:o!==l&&Bd(e,t,a,o,r,l)}t=c,n=s,r=m,p==null?!!r!=!!n&&(t==null?zt(e,!!n,n?[]:``,!1):zt(e,!!n,t,!0)):zt(e,!!n,p,!1);return;case`textarea`:for(c in m=p=null,n)if(a=n[c],n.hasOwnProperty(c)&&a!=null&&!r.hasOwnProperty(c))switch(c){case`value`:break;case`children`:break;default:Bd(e,t,c,null,r,a)}for(s in r)if(a=r[s],o=n[s],r.hasOwnProperty(s)&&(a!=null||o!=null))switch(s){case`value`:p=a;break;case`defaultValue`:m=a;break;case`children`:break;case`dangerouslySetInnerHTML`:if(a!=null)throw Error(i(91));break;default:a!==o&&Bd(e,t,s,a,r,o)}Bt(e,p,m);return;case`option`:for(var h in n)if(p=n[h],n.hasOwnProperty(h)&&p!=null&&!r.hasOwnProperty(h))switch(h){case`selected`:e.selected=!1;break;default:Bd(e,t,h,null,r,p)}for(l in r)if(p=r[l],m=n[l],r.hasOwnProperty(l)&&p!==m&&(p!=null||m!=null))switch(l){case`selected`:e.selected=p&&typeof p!=`function`&&typeof p!=`symbol`;break;default:Bd(e,t,l,p,r,m)}return;case`img`:case`link`:case`area`:case`base`:case`br`:case`col`:case`embed`:case`hr`:case`keygen`:case`meta`:case`param`:case`source`:case`track`:case`wbr`:case`menuitem`:for(var g in n)p=n[g],n.hasOwnProperty(g)&&p!=null&&!r.hasOwnProperty(g)&&Bd(e,t,g,null,r,p);for(u in r)if(p=r[u],m=n[u],r.hasOwnProperty(u)&&p!==m&&(p!=null||m!=null))switch(u){case`children`:case`dangerouslySetInnerHTML`:if(p!=null)throw Error(i(137,t));break;default:Bd(e,t,u,p,r,m)}return;default:if(Kt(t)){for(var _ in n)p=n[_],n.hasOwnProperty(_)&&p!==void 0&&!r.hasOwnProperty(_)&&Vd(e,t,_,void 0,r,p);for(d in r)p=r[d],m=n[d],!r.hasOwnProperty(d)||p===m||p===void 0&&m===void 0||Vd(e,t,d,p,r,m);return}}for(var v in n)p=n[v],n.hasOwnProperty(v)&&p!=null&&!r.hasOwnProperty(v)&&Bd(e,t,v,null,r,p);for(f in r)p=r[f],m=n[f],!r.hasOwnProperty(f)||p===m||p==null&&m==null||Bd(e,t,f,p,r,m)}function Wd(e){switch(e){case`css`:case`script`:case`font`:case`img`:case`image`:case`input`:case`link`:return!0;default:return!1}}function Gd(){if(typeof performance.getEntriesByType==`function`){for(var e=0,t=0,n=performance.getEntriesByType(`resource`),r=0;r<n.length;r++){var i=n[r],a=i.transferSize,o=i.initiatorType,s=i.duration;if(a&&s&&Wd(o)){for(o=0,s=i.responseEnd,r+=1;r<n.length;r++){var c=n[r],l=c.startTime;if(l>s)break;var u=c.transferSize,d=c.initiatorType;u&&Wd(d)&&(c=c.responseEnd,o+=u*(c<s?1:(s-l)/(c-l)))}if(--r,t+=8*(a+o)/(i.duration/1e3),e++,10<e)break}}if(0<e)return t/e/1e6}return navigator.connection&&(e=navigator.connection.downlink,typeof e==`number`)?e:5}var Kd=null,qd=null;function Jd(e){return e.nodeType===9?e:e.ownerDocument}function Yd(e){switch(e){case`http://www.w3.org/2000/svg`:return 1;case`http://www.w3.org/1998/Math/MathML`:return 2;default:return 0}}function Xd(e,t){if(e===0)switch(t){case`svg`:return 1;case`math`:return 2;default:return 0}return e===1&&t===`foreignObject`?0:e}function K(e,t){return e===`textarea`||e===`noscript`||typeof t.children==`string`||typeof t.children==`number`||typeof t.children==`bigint`||typeof t.dangerouslySetInnerHTML==`object`&&t.dangerouslySetInnerHTML!==null&&t.dangerouslySetInnerHTML.__html!=null}var Zd=null;function Qd(){var e=window.event;return e&&e.type===`popstate`?e===Zd?!1:(Zd=e,!0):(Zd=null,!1)}var $d=typeof setTimeout==`function`?setTimeout:void 0,ef=typeof clearTimeout==`function`?clearTimeout:void 0,tf=typeof Promise==`function`?Promise:void 0,nf=typeof queueMicrotask==`function`?queueMicrotask:tf===void 0?$d:function(e){return tf.resolve(null).then(e).catch(rf)};function rf(e){setTimeout(function(){throw e})}function af(e){return e===`head`}function of(e,t){var n=t,r=0;do{var i=n.nextSibling;if(e.removeChild(n),i&&i.nodeType===8)if(n=i.data,n===`/$`||n===`/&`){if(r===0){e.removeChild(i),Rp(t);return}r--}else if(n===`$`||n===`$?`||n===`$~`||n===`$!`||n===`&`)r++;else if(n===`html`)bf(e.ownerDocument.documentElement);else if(n===`head`){n=e.ownerDocument.head,bf(n);for(var a=n.firstChild;a;){var o=a.nextSibling,s=a.nodeName;a[ut]||s===`SCRIPT`||s===`STYLE`||s===`LINK`&&a.rel.toLowerCase()===`stylesheet`||n.removeChild(a),a=o}}else n===`body`&&bf(e.ownerDocument.body);n=i}while(n);Rp(t)}function sf(e,t){var n=e;e=0;do{var r=n.nextSibling;if(n.nodeType===1?t?(n._stashedDisplay=n.style.display,n.style.display=`none`):(n.style.display=n._stashedDisplay||``,n.getAttribute(`style`)===``&&n.removeAttribute(`style`)):n.nodeType===3&&(t?(n._stashedText=n.nodeValue,n.nodeValue=``):n.nodeValue=n._stashedText||``),r&&r.nodeType===8)if(n=r.data,n===`/$`){if(e===0)break;e--}else n!==`$`&&n!==`$?`&&n!==`$~`&&n!==`$!`||e++;n=r}while(n)}function cf(e){var t=e.firstChild;for(t&&t.nodeType===10&&(t=t.nextSibling);t;){var n=t;switch(t=t.nextSibling,n.nodeName){case`HTML`:case`HEAD`:case`BODY`:cf(n),dt(n);continue;case`SCRIPT`:case`STYLE`:continue;case`LINK`:if(n.rel.toLowerCase()===`stylesheet`)continue}e.removeChild(n)}}function lf(e,t,n,r){for(;e.nodeType===1;){var i=n;if(e.nodeName.toLowerCase()!==t.toLowerCase()){if(!r&&(e.nodeName!==`INPUT`||e.type!==`hidden`))break}else if(!r)if(t===`input`&&e.type===`hidden`){var a=i.name==null?null:``+i.name;if(i.type===`hidden`&&e.getAttribute(`name`)===a)return e}else return e;else if(!e[ut])switch(t){case`meta`:if(!e.hasAttribute(`itemprop`))break;return e;case`link`:if(a=e.getAttribute(`rel`),a===`stylesheet`&&e.hasAttribute(`data-precedence`)||a!==i.rel||e.getAttribute(`href`)!==(i.href==null||i.href===``?null:i.href)||e.getAttribute(`crossorigin`)!==(i.crossOrigin==null?null:i.crossOrigin)||e.getAttribute(`title`)!==(i.title==null?null:i.title))break;return e;case`style`:if(e.hasAttribute(`data-precedence`))break;return e;case`script`:if(a=e.getAttribute(`src`),(a!==(i.src==null?null:i.src)||e.getAttribute(`type`)!==(i.type==null?null:i.type)||e.getAttribute(`crossorigin`)!==(i.crossOrigin==null?null:i.crossOrigin))&&a&&e.hasAttribute(`async`)&&!e.hasAttribute(`itemprop`))break;return e;default:return e}if(e=hf(e.nextSibling),e===null)break}return null}function uf(e,t,n){if(t===``)return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!==`INPUT`||e.type!==`hidden`)&&!n||(e=hf(e.nextSibling),e===null))return null;return e}function df(e,t){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!==`INPUT`||e.type!==`hidden`)&&!t||(e=hf(e.nextSibling),e===null))return null;return e}function ff(e){return e.data===`$?`||e.data===`$~`}function pf(e){return e.data===`$!`||e.data===`$?`&&e.ownerDocument.readyState!==`loading`}function mf(e,t){var n=e.ownerDocument;if(e.data===`$~`)e._reactRetry=t;else if(e.data!==`$?`||n.readyState!==`loading`)t();else{var r=function(){t(),n.removeEventListener(`DOMContentLoaded`,r)};n.addEventListener(`DOMContentLoaded`,r),e._reactRetry=r}}function hf(e){for(;e!=null;e=e.nextSibling){var t=e.nodeType;if(t===1||t===3)break;if(t===8){if(t=e.data,t===`$`||t===`$!`||t===`$?`||t===`$~`||t===`&`||t===`F!`||t===`F`)break;if(t===`/$`||t===`/&`)return null}}return e}var gf=null;function _f(e){e=e.nextSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n===`/$`||n===`/&`){if(t===0)return hf(e.nextSibling);t--}else n!==`$`&&n!==`$!`&&n!==`$?`&&n!==`$~`&&n!==`&`||t++}e=e.nextSibling}return null}function vf(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n===`$`||n===`$!`||n===`$?`||n===`$~`||n===`&`){if(t===0)return e;t--}else n!==`/$`&&n!==`/&`||t++}e=e.previousSibling}return null}function yf(e,t,n){switch(t=Jd(n),e){case`html`:if(e=t.documentElement,!e)throw Error(i(452));return e;case`head`:if(e=t.head,!e)throw Error(i(453));return e;case`body`:if(e=t.body,!e)throw Error(i(454));return e;default:throw Error(i(451))}}function bf(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);dt(e)}var xf=new Map,Sf=new Set;function Cf(e){return typeof e.getRootNode==`function`?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var wf=F.d;F.d={f:Tf,r:Ef,D:kf,C:Af,L:jf,m:q,X:Nf,S:Mf,M:Pf};function Tf(){var e=wf.f(),t=Ou();return e||t}function Ef(e){var t=pt(e);t!==null&&t.tag===5&&t.type===`form`?Ds(t):wf.r(e)}var Df=typeof document>`u`?null:document;function Of(e,t,n){var r=Df;if(r&&typeof t==`string`&&t){var i=Ft(t);i=`link[rel="`+e+`"][href="`+i+`"]`,typeof n==`string`&&(i+=`[crossorigin="`+n+`"]`),Sf.has(i)||(Sf.add(i),e={rel:e,crossOrigin:n,href:t},r.querySelector(i)===null&&(t=r.createElement(`link`),Hd(t,`link`,e),gt(t),r.head.appendChild(t)))}}function kf(e){wf.D(e),Of(`dns-prefetch`,e,null)}function Af(e,t){wf.C(e,t),Of(`preconnect`,e,t)}function jf(e,t,n){wf.L(e,t,n);var r=Df;if(r&&e&&t){var i=`link[rel="preload"][as="`+Ft(t)+`"]`;t===`image`&&n&&n.imageSrcSet?(i+=`[imagesrcset="`+Ft(n.imageSrcSet)+`"]`,typeof n.imageSizes==`string`&&(i+=`[imagesizes="`+Ft(n.imageSizes)+`"]`)):i+=`[href="`+Ft(e)+`"]`;var a=i;switch(t){case`style`:a=If(e);break;case`script`:a=Bf(e)}xf.has(a)||(e=m({rel:`preload`,href:t===`image`&&n&&n.imageSrcSet?void 0:e,as:t},n),xf.set(a,e),r.querySelector(i)!==null||t===`style`&&r.querySelector(Lf(a))||t===`script`&&r.querySelector(Vf(a))||(t=r.createElement(`link`),Hd(t,`link`,e),gt(t),r.head.appendChild(t)))}}function q(e,t){wf.m(e,t);var n=Df;if(n&&e){var r=t&&typeof t.as==`string`?t.as:`script`,i=`link[rel="modulepreload"][as="`+Ft(r)+`"][href="`+Ft(e)+`"]`,a=i;switch(r){case`audioworklet`:case`paintworklet`:case`serviceworker`:case`sharedworker`:case`worker`:case`script`:a=Bf(e)}if(!xf.has(a)&&(e=m({rel:`modulepreload`,href:e},t),xf.set(a,e),n.querySelector(i)===null)){switch(r){case`audioworklet`:case`paintworklet`:case`serviceworker`:case`sharedworker`:case`worker`:case`script`:if(n.querySelector(Vf(a)))return}r=n.createElement(`link`),Hd(r,`link`,e),gt(r),n.head.appendChild(r)}}}function Mf(e,t,n){wf.S(e,t,n);var r=Df;if(r&&e){var i=ht(r).hoistableStyles,a=If(e);t||=`default`;var o=i.get(a);if(!o){var s={loading:0,preload:null};if(o=r.querySelector(Lf(a)))s.loading=5;else{e=m({rel:`stylesheet`,href:e,"data-precedence":t},n),(n=xf.get(a))&&Wf(e,n);var c=o=r.createElement(`link`);gt(c),Hd(c,`link`,e),c._p=new Promise(function(e,t){c.onload=e,c.onerror=t}),c.addEventListener(`load`,function(){s.loading|=1}),c.addEventListener(`error`,function(){s.loading|=2}),s.loading|=4,Uf(o,t,r)}o={type:`stylesheet`,instance:o,count:1,state:s},i.set(a,o)}}}function Nf(e,t){wf.X(e,t);var n=Df;if(n&&e){var r=ht(n).hoistableScripts,i=Bf(e),a=r.get(i);a||(a=n.querySelector(Vf(i)),a||(e=m({src:e,async:!0},t),(t=xf.get(i))&&Gf(e,t),a=n.createElement(`script`),gt(a),Hd(a,`link`,e),n.head.appendChild(a)),a={type:`script`,instance:a,count:1,state:null},r.set(i,a))}}function Pf(e,t){wf.M(e,t);var n=Df;if(n&&e){var r=ht(n).hoistableScripts,i=Bf(e),a=r.get(i);a||(a=n.querySelector(Vf(i)),a||(e=m({src:e,async:!0,type:`module`},t),(t=xf.get(i))&&Gf(e,t),a=n.createElement(`script`),gt(a),Hd(a,`link`,e),n.head.appendChild(a)),a={type:`script`,instance:a,count:1,state:null},r.set(i,a))}}function Ff(e,t,n,r){var a=(a=oe.current)?Cf(a):null;if(!a)throw Error(i(446));switch(e){case`meta`:case`title`:return null;case`style`:return typeof n.precedence==`string`&&typeof n.href==`string`?(t=If(n.href),n=ht(a).hoistableStyles,r=n.get(t),r||(r={type:`style`,instance:null,count:0,state:null},n.set(t,r)),r):{type:`void`,instance:null,count:0,state:null};case`link`:if(n.rel===`stylesheet`&&typeof n.href==`string`&&typeof n.precedence==`string`){e=If(n.href);var o=ht(a).hoistableStyles,s=o.get(e);if(s||(a=a.ownerDocument||a,s={type:`stylesheet`,instance:null,count:0,state:{loading:0,preload:null}},o.set(e,s),(o=a.querySelector(Lf(e)))&&!o._p&&(s.instance=o,s.state.loading=5),xf.has(e)||(n={rel:`preload`,as:`style`,href:n.href,crossOrigin:n.crossOrigin,integrity:n.integrity,media:n.media,hrefLang:n.hrefLang,referrerPolicy:n.referrerPolicy},xf.set(e,n),o||zf(a,e,n,s.state))),t&&r===null)throw Error(i(528,``));return s}if(t&&r!==null)throw Error(i(529,``));return null;case`script`:return t=n.async,n=n.src,typeof n==`string`&&t&&typeof t!=`function`&&typeof t!=`symbol`?(t=Bf(n),n=ht(a).hoistableScripts,r=n.get(t),r||(r={type:`script`,instance:null,count:0,state:null},n.set(t,r)),r):{type:`void`,instance:null,count:0,state:null};default:throw Error(i(444,e))}}function If(e){return`href="`+Ft(e)+`"`}function Lf(e){return`link[rel="stylesheet"][`+e+`]`}function Rf(e){return m({},e,{"data-precedence":e.precedence,precedence:null})}function zf(e,t,n,r){e.querySelector(`link[rel="preload"][as="style"][`+t+`]`)?r.loading=1:(t=e.createElement(`link`),r.preload=t,t.addEventListener(`load`,function(){return r.loading|=1}),t.addEventListener(`error`,function(){return r.loading|=2}),Hd(t,`link`,n),gt(t),e.head.appendChild(t))}function Bf(e){return`[src="`+Ft(e)+`"]`}function Vf(e){return`script[async]`+e}function Hf(e,t,n){if(t.count++,t.instance===null)switch(t.type){case`style`:var r=e.querySelector(`style[data-href~="`+Ft(n.href)+`"]`);if(r)return t.instance=r,gt(r),r;var a=m({},n,{"data-href":n.href,"data-precedence":n.precedence,href:null,precedence:null});return r=(e.ownerDocument||e).createElement(`style`),gt(r),Hd(r,`style`,a),Uf(r,n.precedence,e),t.instance=r;case`stylesheet`:a=If(n.href);var o=e.querySelector(Lf(a));if(o)return t.state.loading|=4,t.instance=o,gt(o),o;r=Rf(n),(a=xf.get(a))&&Wf(r,a),o=(e.ownerDocument||e).createElement(`link`),gt(o);var s=o;return s._p=new Promise(function(e,t){s.onload=e,s.onerror=t}),Hd(o,`link`,r),t.state.loading|=4,Uf(o,n.precedence,e),t.instance=o;case`script`:return o=Bf(n.src),(a=e.querySelector(Vf(o)))?(t.instance=a,gt(a),a):(r=n,(a=xf.get(o))&&(r=m({},n),Gf(r,a)),e=e.ownerDocument||e,a=e.createElement(`script`),gt(a),Hd(a,`link`,r),e.head.appendChild(a),t.instance=a);case`void`:return null;default:throw Error(i(443,t.type))}else t.type===`stylesheet`&&!(t.state.loading&4)&&(r=t.instance,t.state.loading|=4,Uf(r,n.precedence,e));return t.instance}function Uf(e,t,n){for(var r=n.querySelectorAll(`link[rel="stylesheet"][data-precedence],style[data-precedence]`),i=r.length?r[r.length-1]:null,a=i,o=0;o<r.length;o++){var s=r[o];if(s.dataset.precedence===t)a=s;else if(a!==i)break}a?a.parentNode.insertBefore(e,a.nextSibling):(t=n.nodeType===9?n.head:n,t.insertBefore(e,t.firstChild))}function Wf(e,t){e.crossOrigin??=t.crossOrigin,e.referrerPolicy??=t.referrerPolicy,e.title??=t.title}function Gf(e,t){e.crossOrigin??=t.crossOrigin,e.referrerPolicy??=t.referrerPolicy,e.integrity??=t.integrity}var Kf=null;function qf(e,t,n){if(Kf===null){var r=new Map,i=Kf=new Map;i.set(n,r)}else i=Kf,r=i.get(n),r||(r=new Map,i.set(n,r));if(r.has(e))return r;for(r.set(e,null),n=n.getElementsByTagName(e),i=0;i<n.length;i++){var a=n[i];if(!(a[ut]||a[rt]||e===`link`&&a.getAttribute(`rel`)===`stylesheet`)&&a.namespaceURI!==`http://www.w3.org/2000/svg`){var o=a.getAttribute(t)||``;o=e+o;var s=r.get(o);s?s.push(a):r.set(o,[a])}}return r}function Jf(e,t,n){e=e.ownerDocument||e,e.head.insertBefore(n,t===`title`?e.querySelector(`head > title`):null)}function Yf(e,t,n){if(n===1||t.itemProp!=null)return!1;switch(e){case`meta`:case`title`:return!0;case`style`:if(typeof t.precedence!=`string`||typeof t.href!=`string`||t.href===``)break;return!0;case`link`:if(typeof t.rel!=`string`||typeof t.href!=`string`||t.href===``||t.onLoad||t.onError)break;switch(t.rel){case`stylesheet`:return e=t.disabled,typeof t.precedence==`string`&&e==null;default:return!0}case`script`:if(t.async&&typeof t.async!=`function`&&typeof t.async!=`symbol`&&!t.onLoad&&!t.onError&&t.src&&typeof t.src==`string`)return!0}return!1}function Xf(e){return!(e.type===`stylesheet`&&!(e.state.loading&3))}function Zf(e,t,n,r){if(n.type===`stylesheet`&&(typeof r.media!=`string`||!1!==matchMedia(r.media).matches)&&!(n.state.loading&4)){if(n.instance===null){var i=If(r.href),a=t.querySelector(Lf(i));if(a){t=a._p,typeof t==`object`&&t&&typeof t.then==`function`&&(e.count++,e=ep.bind(e),t.then(e,e)),n.state.loading|=4,n.instance=a,gt(a);return}a=t.ownerDocument||t,r=Rf(r),(i=xf.get(i))&&Wf(r,i),a=a.createElement(`link`),gt(a);var o=a;o._p=new Promise(function(e,t){o.onload=e,o.onerror=t}),Hd(a,`link`,r),n.instance=a}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(n,t),(t=n.state.preload)&&!(n.state.loading&3)&&(e.count++,n=ep.bind(e),t.addEventListener(`load`,n),t.addEventListener(`error`,n))}}var Qf=0;function $f(e,t){return e.stylesheets&&e.count===0&&J(e,e.stylesheets),0<e.count||0<e.imgCount?function(n){var r=setTimeout(function(){if(e.stylesheets&&J(e,e.stylesheets),e.unsuspend){var t=e.unsuspend;e.unsuspend=null,t()}},6e4+t);0<e.imgBytes&&Qf===0&&(Qf=62500*Gd());var i=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&J(e,e.stylesheets),e.unsuspend)){var t=e.unsuspend;e.unsuspend=null,t()}},(e.imgBytes>Qf?50:800)+t);return e.unsuspend=n,function(){e.unsuspend=null,clearTimeout(r),clearTimeout(i)}}:null}function ep(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)J(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var tp=null;function J(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,tp=new Map,t.forEach(np,e),tp=null,ep.call(e))}function np(e,t){if(!(t.state.loading&4)){var n=tp.get(e);if(n)var r=n.get(null);else{n=new Map,tp.set(e,n);for(var i=e.querySelectorAll(`link[data-precedence],style[data-precedence]`),a=0;a<i.length;a++){var o=i[a];(o.nodeName===`LINK`||o.getAttribute(`media`)!==`not all`)&&(n.set(o.dataset.precedence,o),r=o)}r&&n.set(null,r)}i=t.instance,o=i.getAttribute(`data-precedence`),a=n.get(o)||r,a===r&&n.set(null,i),n.set(o,i),this.count++,r=ep.bind(this),i.addEventListener(`load`,r),i.addEventListener(`error`,r),a?a.parentNode.insertBefore(i,a.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(i,e.firstChild)),t.state.loading|=4}}var rp={$$typeof:C,Provider:null,Consumer:null,_currentValue:ne,_currentValue2:ne,_threadCount:0};function ip(e,t,n,r,i,a,o,s,c){this.tag=1,this.containerInfo=e,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=Ke(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Ke(0),this.hiddenUpdates=Ke(null),this.identifierPrefix=r,this.onUncaughtError=i,this.onCaughtError=a,this.onRecoverableError=o,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=c,this.incompleteTransitions=new Map}function ap(e,t,n,r,i,a,o,s,c,l,u,d){return e=new ip(e,t,n,o,c,l,u,d,s),t=1,!0===a&&(t|=24),a=ai(3,null,null,t),e.current=a,a.stateNode=e,t=oa(),t.refCount++,e.pooledCache=t,t.refCount++,a.memoizedState={element:r,isDehydrated:n,cache:t},za(a),e}function op(e){return e?(e=ri,e):ri}function sp(e,t,n,r,i,a){i=op(i),r.context===null?r.context=i:r.pendingContext=i,r=Va(t),r.payload={element:n},a=a===void 0?null:a,a!==null&&(r.callback=a),n=Ha(e,r,t),n!==null&&(Cu(n,e,t),Ua(n,e,t))}function cp(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function lp(e,t){cp(e,t),(e=e.alternate)&&cp(e,t)}function up(e){if(e.tag===13||e.tag===31){var t=ei(e,67108864);t!==null&&Cu(t,e,67108864),lp(e,67108864)}}function dp(e){if(e.tag===13||e.tag===31){var t=xu();t=Qe(t);var n=ei(e,t);n!==null&&Cu(n,e,t),lp(e,t)}}var fp=!0;function pp(e,t,n,r){var i=P.T;P.T=null;var a=F.p;try{F.p=2,hp(e,t,n,r)}finally{F.p=a,P.T=i}}function mp(e,t,n,r){var i=P.T;P.T=null;var a=F.p;try{F.p=8,hp(e,t,n,r)}finally{F.p=a,P.T=i}}function hp(e,t,n,r){if(fp){var i=gp(r);if(i===null)Md(e,t,r,_p,n),Op(e,r);else if(Ap(i,e,t,n,r))r.stopPropagation();else if(Op(e,r),t&4&&-1<Dp.indexOf(e)){for(;i!==null;){var a=pt(i);if(a!==null)switch(a.tag){case 3:if(a=a.stateNode,a.current.memoizedState.isDehydrated){var o=B(a.pendingLanes);if(o!==0){var s=a;for(s.pendingLanes|=2,s.entangledLanes|=2;o;){var c=1<<31-Ie(o);s.entanglements[1]|=c,o&=~c}fd(a),!(Hl&6)&&(lu=we()+500,pd(0,!1))}}break;case 31:case 13:s=ei(a,2),s!==null&&Cu(s,a,2),Ou(),lp(a,2)}if(a=gp(r),a===null&&Md(e,t,r,_p,n),a===i)break;i=a}i!==null&&r.stopPropagation()}else Md(e,t,r,null,n)}}function gp(e){return e=Qt(e),vp(e)}var _p=null;function vp(e){if(_p=null,e=ft(e),e!==null){var t=o(e);if(t===null)e=null;else{var n=t.tag;if(n===13){if(e=s(t),e!==null)return e;e=null}else if(n===31){if(e=c(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 _p=e,null}function yp(e){switch(e){case`beforetoggle`:case`cancel`:case`click`:case`close`:case`contextmenu`:case`copy`:case`cut`:case`auxclick`:case`dblclick`:case`dragend`:case`dragstart`:case`drop`:case`focusin`:case`focusout`:case`input`:case`invalid`:case`keydown`:case`keypress`:case`keyup`:case`mousedown`:case`mouseup`:case`paste`:case`pause`:case`play`:case`pointercancel`:case`pointerdown`:case`pointerup`:case`ratechange`:case`reset`:case`resize`:case`seeked`:case`submit`:case`toggle`:case`touchcancel`:case`touchend`:case`touchstart`:case`volumechange`:case`change`:case`selectionchange`:case`textInput`:case`compositionstart`:case`compositionend`:case`compositionupdate`:case`beforeblur`:case`afterblur`:case`beforeinput`:case`blur`:case`fullscreenchange`:case`focus`:case`hashchange`:case`popstate`:case`select`:case`selectstart`:return 2;case`drag`:case`dragenter`:case`dragexit`:case`dragleave`:case`dragover`:case`mousemove`:case`mouseout`:case`mouseover`:case`pointermove`:case`pointerout`:case`pointerover`:case`scroll`:case`touchmove`:case`wheel`:case`mouseenter`:case`mouseleave`:case`pointerenter`:case`pointerleave`:return 8;case`message`:switch(Te()){case Ee:return 2;case De:return 8;case Oe:case ke:return 32;case Ae:return 268435456;default:return 32}default:return 32}}var bp=!1,xp=null,Sp=null,Cp=null,wp=new Map,Tp=new Map,Ep=[],Dp=`mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset`.split(` `);function Op(e,t){switch(e){case`focusin`:case`focusout`:xp=null;break;case`dragenter`:case`dragleave`:Sp=null;break;case`mouseover`:case`mouseout`:Cp=null;break;case`pointerover`:case`pointerout`:wp.delete(t.pointerId);break;case`gotpointercapture`:case`lostpointercapture`:Tp.delete(t.pointerId)}}function kp(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=pt(t),t!==null&&up(t)),e):(e.eventSystemFlags|=r,t=e.targetContainers,i!==null&&t.indexOf(i)===-1&&t.push(i),e)}function Ap(e,t,n,r,i){switch(t){case`focusin`:return xp=kp(xp,e,t,n,r,i),!0;case`dragenter`:return Sp=kp(Sp,e,t,n,r,i),!0;case`mouseover`:return Cp=kp(Cp,e,t,n,r,i),!0;case`pointerover`:var a=i.pointerId;return wp.set(a,kp(wp.get(a)||null,e,t,n,r,i)),!0;case`gotpointercapture`:return a=i.pointerId,Tp.set(a,kp(Tp.get(a)||null,e,t,n,r,i)),!0}return!1}function jp(e){var t=ft(e.target);if(t!==null){var n=o(t);if(n!==null){if(t=n.tag,t===13){if(t=s(n),t!==null){e.blockedOn=t,tt(e.priority,function(){dp(n)});return}}else if(t===31){if(t=c(n),t!==null){e.blockedOn=t,tt(e.priority,function(){dp(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 Mp(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=gp(e.nativeEvent);if(n===null){n=e.nativeEvent;var r=new n.constructor(n.type,n);Zt=r,n.target.dispatchEvent(r),Zt=null}else return t=pt(n),t!==null&&up(t),e.blockedOn=n,!1;t.shift()}return!0}function Np(e,t,n){Mp(e)&&n.delete(t)}function Pp(){bp=!1,xp!==null&&Mp(xp)&&(xp=null),Sp!==null&&Mp(Sp)&&(Sp=null),Cp!==null&&Mp(Cp)&&(Cp=null),wp.forEach(Np),Tp.forEach(Np)}function Fp(e,n){e.blockedOn===n&&(e.blockedOn=null,bp||(bp=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,Pp)))}var Ip=null;function Lp(e){Ip!==e&&(Ip=e,t.unstable_scheduleCallback(t.unstable_NormalPriority,function(){Ip===e&&(Ip=null);for(var t=0;t<e.length;t+=3){var n=e[t],r=e[t+1],i=e[t+2];if(typeof r!=`function`){if(vp(r||n)===null)continue;break}var a=pt(n);a!==null&&(e.splice(t,3),t-=3,Ts(a,{pending:!0,data:i,method:n.method,action:r},r,i))}}))}function Rp(e){function t(t){return Fp(t,e)}xp!==null&&Fp(xp,e),Sp!==null&&Fp(Sp,e),Cp!==null&&Fp(Cp,e),wp.forEach(t),Tp.forEach(t);for(var n=0;n<Ep.length;n++){var r=Ep[n];r.blockedOn===e&&(r.blockedOn=null)}for(;0<Ep.length&&(n=Ep[0],n.blockedOn===null);)jp(n),n.blockedOn===null&&Ep.shift();if(n=(e.ownerDocument||e).$$reactFormReplay,n!=null)for(r=0;r<n.length;r+=3){var i=n[r],a=n[r+1],o=i[it]||null;if(typeof a==`function`)o||Lp(n);else if(o){var s=null;if(a&&a.hasAttribute(`formAction`)){if(i=a,o=a[it]||null)s=o.formAction;else if(vp(i)!==null)continue}else s=o.action;typeof s==`function`?n[r+1]=s:(n.splice(r,3),r-=3),Lp(n)}}}function zp(){function e(e){e.canIntercept&&e.info===`react-transition`&&e.intercept({handler:function(){return new Promise(function(e){return i=e})},focusReset:`manual`,scroll:`manual`})}function t(){i!==null&&(i(),i=null),r||setTimeout(n,20)}function n(){if(!r&&!navigation.transition){var e=navigation.currentEntry;e&&e.url!=null&&navigation.navigate(e.url,{state:e.getState(),info:`react-transition`,history:`replace`})}}if(typeof navigation==`object`){var r=!1,i=null;return navigation.addEventListener(`navigate`,e),navigation.addEventListener(`navigatesuccess`,t),navigation.addEventListener(`navigateerror`,t),setTimeout(n,100),function(){r=!0,navigation.removeEventListener(`navigate`,e),navigation.removeEventListener(`navigatesuccess`,t),navigation.removeEventListener(`navigateerror`,t),i!==null&&(i(),i=null)}}}function Bp(e){this._internalRoot=e}Vp.prototype.render=Bp.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(i(409));var n=t.current;sp(n,xu(),e,t,null,null)},Vp.prototype.unmount=Bp.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;sp(e.current,2,null,e,null,null),Ou(),t[at]=null}};function Vp(e){this._internalRoot=e}Vp.prototype.unstable_scheduleHydration=function(e){if(e){var t=et();e={blockedOn:null,target:e,priority:t};for(var n=0;n<Ep.length&&t!==0&&t<Ep[n].priority;n++);Ep.splice(n,0,e),n===0&&jp(e)}};var Hp=n.version;if(Hp!==`19.2.7`)throw Error(i(527,Hp,`19.2.7`));F.findDOMNode=function(e){var t=e._reactInternals;if(t===void 0)throw typeof e.render==`function`?Error(i(188)):(e=Object.keys(e).join(`,`),Error(i(268,e)));return e=u(t),e=e===null?null:f(e),e=e===null?null:e.stateNode,e};var Up={bundleType:0,version:`19.2.7`,rendererPackageName:`react-dom`,currentDispatcherRef:P,reconcilerVersion:`19.2.7`};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<`u`){var Wp=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Wp.isDisabled&&Wp.supportsFiber)try{Ne=Wp.inject(Up),Pe=Wp}catch{}}e.createRoot=function(e,t){if(!a(e))throw Error(i(299));var n=!1,r=``,o=Js,s=Ys,c=Xs;return t!=null&&(!0===t.unstable_strictMode&&(n=!0),t.identifierPrefix!==void 0&&(r=t.identifierPrefix),t.onUncaughtError!==void 0&&(o=t.onUncaughtError),t.onCaughtError!==void 0&&(s=t.onCaughtError),t.onRecoverableError!==void 0&&(c=t.onRecoverableError)),t=ap(e,1,!1,null,null,n,r,null,o,s,c,zp),e[at]=t.current,Ad(e),new Bp(t)}})),_=o(((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=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},y=new class extends v{#e;#t;#n;constructor(){super(),this.#n=e=>{if(typeof window<`u`&&window.addEventListener){let t=()=>e();return window.addEventListener(`visibilitychange`,t,!1),()=>{window.removeEventListener(`visibilitychange`,t)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(e=>{typeof e==`boolean`?this.setFocused(e):this.onFocus()})}setFocused(e){this.#e!==e&&(this.#e=e,this.onFocus())}onFocus(){let e=this.isFocused();this.listeners.forEach(t=>{t(e)})}isFocused(){return typeof this.#e==`boolean`?this.#e:globalThis.document?.visibilityState!==`hidden`}},b={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},x=new class{#e=b;setTimeoutProvider(e){this.#e=e}setTimeout(e,t){return this.#e.setTimeout(e,t)}clearTimeout(e){this.#e.clearTimeout(e)}setInterval(e,t){return this.#e.setInterval(e,t)}clearInterval(e){this.#e.clearInterval(e)}};function S(e){setTimeout(e,0)}var C=typeof window>`u`||`Deno`in globalThis;function w(){}function T(e,t){return typeof e==`function`?e(t):e}function E(e){return typeof e==`number`&&e>=0&&e!==1/0}function D(e,t){return Math.max(e+(t||0)-Date.now(),0)}function O(e,t){return typeof e==`function`?e(t):e}function k(e,t){return typeof e==`function`?e(t):e}function ee(e,t){let{type:n=`all`,exact:r,fetchStatus:i,predicate:a,queryKey:o,stale:s}=e;if(o){if(r){if(t.queryHash!==A(o,t.options))return!1}else if(!M(t.queryKey,o))return!1}if(n!==`all`){let e=t.isActive();if(n===`active`&&!e||n===`inactive`&&e)return!1}return!(typeof s==`boolean`&&t.isStale()!==s||i&&i!==t.state.fetchStatus||a&&!a(t))}function te(e,t){let{exact:n,status:r,predicate:i,mutationKey:a}=e;if(a){if(!t.options.mutationKey)return!1;if(n){if(j(t.options.mutationKey)!==j(a))return!1}else if(!M(t.options.mutationKey,a))return!1}return!(r&&t.state.status!==r||i&&!i(t))}function A(e,t){return(t?.queryKeyHashFn||j)(e)}function j(e){return JSON.stringify(e,(e,t)=>re(t)?Object.keys(t).sort().reduce((e,n)=>(e[n]=t[n],e),{}):t)}function M(e,t){return e===t?!0:typeof e==typeof t&&e&&t&&typeof e==`object`&&typeof t==`object`?Object.keys(t).every(n=>M(e[n],t[n])):!1}var N=Object.prototype.hasOwnProperty;function P(e,t,n=0){if(e===t)return e;if(n>500)return t;let r=ne(e)&&ne(t);if(!r&&!(re(e)&&re(t)))return t;let i=(r?e:Object.keys(e)).length,a=r?t:Object.keys(t),o=a.length,s=r?Array(o):{},c=0;for(let l=0;l<o;l++){let o=r?l:a[l],u=e[o],d=t[o];if(u===d){s[o]=u,(r?l<i:N.call(e,o))&&c++;continue}if(u===null||d===null||typeof u!=`object`||typeof d!=`object`){s[o]=d;continue}let f=P(u,d,n+1);s[o]=f,f===u&&c++}return i===o&&c===i?e:s}function F(e,t){if(!t||Object.keys(e).length!==Object.keys(t).length)return!1;for(let n in e)if(e[n]!==t[n])return!1;return!0}function ne(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function re(e){if(!ie(e))return!1;let t=e.constructor;if(t===void 0)return!0;let n=t.prototype;return!(!ie(n)||!n.hasOwnProperty(`isPrototypeOf`)||Object.getPrototypeOf(e)!==Object.prototype)}function ie(e){return Object.prototype.toString.call(e)===`[object Object]`}function I(e){return new Promise(t=>{x.setTimeout(t,e)})}function L(e,t,n){return typeof n.structuralSharing==`function`?n.structuralSharing(e,t):n.structuralSharing===!1?t:P(e,t)}function R(e,t,n=0){let r=[...e,t];return n&&r.length>n?r.slice(1):r}function ae(e,t,n=0){let r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var z=Symbol();function oe(e,t){return!e.queryFn&&t?.initialPromise?()=>t.initialPromise:!e.queryFn||e.queryFn===z?()=>Promise.reject(Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function se(e,t){return typeof e==`function`?e(...t):!!e}function ce(e,t,n){let r=!1,i;return Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(i??=t(),r?i:(r=!0,i.aborted?n():i.addEventListener(`abort`,n,{once:!0}),i))}),e}var le=(()=>{let e=()=>C;return{isServer(){return e()},setIsServer(t){e=t}}})();function ue(){let e,t,n=new Promise((n,r)=>{e=n,t=r});n.status=`pending`,n.catch(()=>{});function r(e){Object.assign(n,e),delete n.resolve,delete n.reject}return n.resolve=t=>{r({status:`fulfilled`,value:t}),e(t)},n.reject=e=>{r({status:`rejected`,reason:e}),t(e)},n}var de=S;function fe(){let e=[],t=0,n=e=>{e()},r=e=>{e()},i=de,a=r=>{t?e.push(r):i(()=>{n(r)})},o=()=>{let t=e;e=[],t.length&&i(()=>{r(()=>{t.forEach(e=>{n(e)})})})};return{batch:e=>{let n;t++;try{n=e()}finally{t--,t||o()}return n},batchCalls:e=>(...t)=>{a(()=>{e(...t)})},schedule:a,setNotifyFunction:e=>{n=e},setBatchNotifyFunction:e=>{r=e},setScheduler:e=>{i=e}}}var pe=fe(),me=new class extends v{#e=!0;#t;#n;constructor(){super(),this.#n=e=>{if(typeof window<`u`&&window.addEventListener){let t=()=>e(!0),n=()=>e(!1);return window.addEventListener(`online`,t,!1),window.addEventListener(`offline`,n,!1),()=>{window.removeEventListener(`online`,t),window.removeEventListener(`offline`,n)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(this.setOnline.bind(this))}setOnline(e){this.#e!==e&&(this.#e=e,this.listeners.forEach(t=>{t(e)}))}isOnline(){return this.#e}};function he(e){return Math.min(1e3*2**e,3e4)}function ge(e){return(e??`online`)!==`online`||me.isOnline()}var _e=class extends Error{constructor(e){super(`CancelledError`),this.revert=e?.revert,this.silent=e?.silent}};function ve(e){let t=!1,n=0,r,i=ue(),a=()=>i.status!==`pending`,o=t=>{if(!a()){let n=new _e(t);f(n),e.onCancel?.(n)}},s=()=>{t=!0},c=()=>{t=!1},l=()=>y.isFocused()&&(e.networkMode===`always`||me.isOnline())&&e.canRun(),u=()=>ge(e.networkMode)&&e.canRun(),d=e=>{a()||(r?.(),i.resolve(e))},f=e=>{a()||(r?.(),i.reject(e))},p=()=>new Promise(t=>{r=e=>{(a()||l())&&t(e)},e.onPause?.()}).then(()=>{r=void 0,a()||e.onContinue?.()}),m=()=>{if(a())return;let r,i=n===0?e.initialPromise:void 0;try{r=i??e.fn()}catch(e){r=Promise.reject(e)}Promise.resolve(r).then(d).catch(r=>{if(a())return;let i=e.retry??(le.isServer()?0:3),o=e.retryDelay??he,s=typeof o==`function`?o(n,r):o,c=i===!0||typeof i==`number`&&n<i||typeof i==`function`&&i(n,r);if(t||!c){f(r);return}n++,e.onFail?.(n,r),I(s).then(()=>l()?void 0:p()).then(()=>{t?f(r):m()})})};return{promise:i,status:()=>i.status,cancel:o,continue:()=>(r?.(),i),cancelRetry:s,continueRetry:c,canStart:u,start:()=>(u()?m():p().then(m),i)}}var ye=class{#e;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),E(this.gcTime)&&(this.#e=x.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(le.isServer()?1/0:300*1e3))}clearGcTimeout(){this.#e!==void 0&&(x.clearTimeout(this.#e),this.#e=void 0)}};function be(e){return{onFetch:(t,n)=>{let r=t.options,i=t.fetchOptions?.meta?.fetchMore?.direction,a=t.state.data?.pages||[],o=t.state.data?.pageParams||[],s={pages:[],pageParams:[]},c=0,l=async()=>{let n=!1,l=e=>{ce(e,()=>t.signal,()=>n=!0)},u=oe(t.options,t.fetchOptions),d=async(e,r,i)=>{if(n)return Promise.reject(t.signal.reason);if(r==null&&e.pages.length)return Promise.resolve(e);let a=(()=>{let e={client:t.client,queryKey:t.queryKey,pageParam:r,direction:i?`backward`:`forward`,meta:t.options.meta};return l(e),e})(),o=await u(a),{maxPages:s}=t.options,c=i?ae:R;return{pages:c(e.pages,o,s),pageParams:c(e.pageParams,r,s)}};if(i&&a.length){let e=i===`backward`,t=e?Se:xe,n={pages:a,pageParams:o};s=await d(n,t(r,n),e)}else{let t=e??a.length;do{let e=c===0?o[0]??r.initialPageParam:xe(r,s);if(c>0&&e==null)break;s=await d(s,e),c++}while(c<t)}return s};t.options.persister?t.fetchFn=()=>t.options.persister?.(l,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n):t.fetchFn=l}}}function xe(e,{pages:t,pageParams:n}){let r=t.length-1;return t.length>0?e.getNextPageParam(t[r],t,n[r],n):void 0}function Se(e,{pages:t,pageParams:n}){return t.length>0?e.getPreviousPageParam?.(t[0],t,n[0],n):void 0}var Ce=class extends ye{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e){super(),this.#s=!1,this.#o=e.defaultOptions,this.setOptions(e.options),this.observers=[],this.#i=e.client,this.#r=this.#i.getQueryCache(),this.queryKey=e.queryKey,this.queryHash=e.queryHash,this.#t=Ee(this.options),this.state=e.state??this.#t,this.scheduleGc()}get meta(){return this.options.meta}get queryType(){return this.#e}get promise(){return this.#a?.promise}setOptions(e){if(this.options={...this.#o,...e},e?._type&&(this.#e=e._type),this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){let e=Ee(this.options);e.data!==void 0&&(this.setState(Te(e.data,e.dataUpdatedAt)),this.#t=e)}}optionalRemove(){!this.observers.length&&this.state.fetchStatus===`idle`&&this.#r.remove(this)}setData(e,t){let n=L(this.state.data,e,this.options);return this.#l({data:n,type:`success`,dataUpdatedAt:t?.updatedAt,manual:t?.manual}),n}setState(e){this.#l({type:`setState`,state:e})}cancel(e){let t=this.#a?.promise;return this.#a?.cancel(e),t?t.then(w).catch(w):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return this.#t}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(e=>k(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===z||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0&&this.observers.some(e=>O(e.options.staleTime,this)===`static`)}isStale(){return this.getObserversCount()>0?this.observers.some(e=>e.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(e=0){return this.state.data===void 0?!0:e===`static`?!1:this.state.isInvalidated?!0:!D(this.state.dataUpdatedAt,e)}onFocus(){this.observers.find(e=>e.shouldFetchOnWindowFocus())?.refetch({cancelRefetch:!1}),this.#a?.continue()}onOnline(){this.observers.find(e=>e.shouldFetchOnReconnect())?.refetch({cancelRefetch:!1}),this.#a?.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),this.#r.notify({type:`observerAdded`,query:this,observer:e}))}removeObserver(e){this.observers.includes(e)&&(this.observers=this.observers.filter(t=>t!==e),this.observers.length||(this.#a&&(this.#s||this.#c()?this.#a.cancel({revert:!0}):this.#a.cancelRetry()),this.scheduleGc()),this.#r.notify({type:`observerRemoved`,query:this,observer:e}))}getObserversCount(){return this.observers.length}#c(){return this.state.fetchStatus===`paused`&&this.state.status===`pending`}invalidate(){this.state.isInvalidated||this.#l({type:`invalidate`})}async fetch(e,t){if(this.state.fetchStatus!==`idle`&&this.#a?.status()!==`rejected`){if(this.state.data!==void 0&&t?.cancelRefetch)this.cancel({silent:!0});else if(this.#a)return this.#a.continueRetry(),this.#a.promise}if(e&&this.setOptions(e),!this.options.queryFn){let e=this.observers.find(e=>e.options.queryFn);e&&this.setOptions(e.options)}let n=new AbortController,r=e=>{Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(this.#s=!0,n.signal)})},i=()=>{let e=oe(this.options,t),n=(()=>{let e={client:this.#i,queryKey:this.queryKey,meta:this.meta};return r(e),e})();return this.#s=!1,this.options.persister?this.options.persister(e,n,this):e(n)},a=(()=>{let e={fetchOptions:t,options:this.options,queryKey:this.queryKey,client:this.#i,state:this.state,fetchFn:i};return r(e),e})();(this.#e===`infinite`?be(this.options.pages):this.options.behavior)?.onFetch(a,this),this.#n=this.state,(this.state.fetchStatus===`idle`||this.state.fetchMeta!==a.fetchOptions?.meta)&&this.#l({type:`fetch`,meta:a.fetchOptions?.meta}),this.#a=ve({initialPromise:t?.initialPromise,fn:a.fetchFn,onCancel:e=>{e instanceof _e&&e.revert&&this.setState({...this.#n,fetchStatus:`idle`}),n.abort()},onFail:(e,t)=>{this.#l({type:`failed`,failureCount:e,error:t})},onPause:()=>{this.#l({type:`pause`})},onContinue:()=>{this.#l({type:`continue`})},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode,canRun:()=>!0});try{let e=await this.#a.start();if(e===void 0)throw Error(`${this.queryHash} data is undefined`);return this.setData(e),this.#r.config.onSuccess?.(e,this),this.#r.config.onSettled?.(e,this.state.error,this),e}catch(e){if(e instanceof _e){if(e.silent)return this.#a.promise;if(e.revert){if(this.state.data===void 0)throw e;return this.state.data}}throw this.#l({type:`error`,error:e}),this.#r.config.onError?.(e,this),this.#r.config.onSettled?.(this.state.data,e,this),e}finally{this.scheduleGc()}}#l(e){let t=t=>{switch(e.type){case`failed`:return{...t,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case`pause`:return{...t,fetchStatus:`paused`};case`continue`:return{...t,fetchStatus:`fetching`};case`fetch`:return{...t,...we(t.data,this.options),fetchMeta:e.meta??null};case`success`:let n={...t,...Te(e.data,e.dataUpdatedAt),dataUpdateCount:t.dataUpdateCount+1,...!e.manual&&{fetchStatus:`idle`,fetchFailureCount:0,fetchFailureReason:null}};return this.#n=e.manual?n:void 0,n;case`error`:let r=e.error;return{...t,error:r,errorUpdateCount:t.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:t.fetchFailureCount+1,fetchFailureReason:r,fetchStatus:`idle`,status:`error`,isInvalidated:!0};case`invalidate`:return{...t,isInvalidated:!0};case`setState`:return{...t,...e.state}}};this.state=t(this.state),pe.batch(()=>{this.observers.forEach(e=>{e.onQueryUpdate()}),this.#r.notify({query:this,type:`updated`,action:e})})}};function we(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:ge(t.networkMode)?`fetching`:`paused`,...e===void 0&&{error:null,status:`pending`}}}function Te(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:`success`}}function Ee(e){let t=typeof e.initialData==`function`?e.initialData():e.initialData,n=t!==void 0,r=n?typeof e.initialDataUpdatedAt==`function`?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:n?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?`success`:`pending`,fetchStatus:`idle`}}var De=class extends v{constructor(e,t){super(),this.options=t,this.#e=e,this.#s=null,this.#o=ue(),this.bindMethods(),this.setOptions(t)}#e;#t=void 0;#n=void 0;#r=void 0;#i;#a;#o;#s;#c;#l;#u;#d;#f;#p;#m=new Set;bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(this.#t.addObserver(this),ke(this.#t,this.options)?this.#h():this.updateResult(),this.#y())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return Ae(this.#t,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return Ae(this.#t,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#b(),this.#x(),this.#t.removeObserver(this)}setOptions(e){let t=this.options,n=this.#t;if(this.options=this.#e.defaultQueryOptions(e),this.options.enabled!==void 0&&typeof this.options.enabled!=`boolean`&&typeof this.options.enabled!=`function`&&typeof k(this.options.enabled,this.#t)!=`boolean`)throw Error(`Expected enabled to be a boolean or a callback that returns a boolean`);this.#S(),this.#t.setOptions(this.options),t._defaulted&&!F(this.options,t)&&this.#e.getQueryCache().notify({type:`observerOptionsUpdated`,query:this.#t,observer:this});let r=this.hasListeners();r&&je(this.#t,n,this.options,t)&&this.#h(),this.updateResult(),r&&(this.#t!==n||k(this.options.enabled,this.#t)!==k(t.enabled,this.#t)||O(this.options.staleTime,this.#t)!==O(t.staleTime,this.#t))&&this.#g();let i=this.#_();r&&(this.#t!==n||k(this.options.enabled,this.#t)!==k(t.enabled,this.#t)||i!==this.#p)&&this.#v(i)}getOptimisticResult(e){let t=this.#e.getQueryCache().build(this.#e,e),n=this.createResult(t,e);return Ne(this,n)&&(this.#r=n,this.#a=this.options,this.#i=this.#t.state),n}getCurrentResult(){return this.#r}trackResult(e,t){return new Proxy(e,{get:(e,n)=>(this.trackProp(n),t?.(n),n===`promise`&&(this.trackProp(`data`),!this.options.experimental_prefetchInRender&&this.#o.status===`pending`&&this.#o.reject(Error(`experimental_prefetchInRender feature flag is not enabled`))),Reflect.get(e,n))})}trackProp(e){this.#m.add(e)}getCurrentQuery(){return this.#t}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){let t=this.#e.defaultQueryOptions(e),n=this.#e.getQueryCache().build(this.#e,t);return n.fetch().then(()=>this.createResult(n,t))}fetch(e){return this.#h({...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#r))}#h(e){this.#S();let t=this.#t.fetch(this.options,e);return e?.throwOnError||(t=t.catch(w)),t}#g(){this.#b();let e=O(this.options.staleTime,this.#t);if(le.isServer()||this.#r.isStale||!E(e))return;let t=D(this.#r.dataUpdatedAt,e)+1;this.#d=x.setTimeout(()=>{this.#r.isStale||this.updateResult()},t)}#_(){return(typeof this.options.refetchInterval==`function`?this.options.refetchInterval(this.#t):this.options.refetchInterval)??!1}#v(e){this.#x(),this.#p=e,!(le.isServer()||k(this.options.enabled,this.#t)===!1||!E(this.#p)||this.#p===0)&&(this.#f=x.setInterval(()=>{(this.options.refetchIntervalInBackground||y.isFocused())&&this.#h()},this.#p))}#y(){this.#g(),this.#v(this.#_())}#b(){this.#d!==void 0&&(x.clearTimeout(this.#d),this.#d=void 0)}#x(){this.#f!==void 0&&(x.clearInterval(this.#f),this.#f=void 0)}createResult(e,t){let n=this.#t,r=this.options,i=this.#r,a=this.#i,o=this.#a,s=e===n?this.#n:e.state,{state:c}=e,l={...c},u=!1,d;if(t._optimisticResults){let i=this.hasListeners(),a=!i&&ke(e,t),o=i&&je(e,n,t,r);(a||o)&&(l={...l,...we(c.data,e.options)}),t._optimisticResults===`isRestoring`&&(l.fetchStatus=`idle`)}let{error:f,errorUpdatedAt:p,status:m}=l;d=l.data;let h=!1;if(t.placeholderData!==void 0&&d===void 0&&m===`pending`){let e;i?.isPlaceholderData&&t.placeholderData===o?.placeholderData?(e=i.data,h=!0):e=typeof t.placeholderData==`function`?t.placeholderData(this.#u?.state.data,this.#u):t.placeholderData,e!==void 0&&(m=`success`,d=L(i?.data,e,t),u=!0)}if(t.select&&d!==void 0&&!h)if(i&&d===a?.data&&t.select===this.#c)d=this.#l;else try{this.#c=t.select,d=t.select(d),d=L(i?.data,d,t),this.#l=d,this.#s=null}catch(e){this.#s=e}this.#s&&(f=this.#s,d=this.#l,p=Date.now(),m=`error`);let g=l.fetchStatus===`fetching`,_=m===`pending`,v=m===`error`,y=_&&g,b=d!==void 0,x={status:m,fetchStatus:l.fetchStatus,isPending:_,isSuccess:m===`success`,isError:v,isInitialLoading:y,isLoading:y,data:d,dataUpdatedAt:l.dataUpdatedAt,error:f,errorUpdatedAt:p,failureCount:l.fetchFailureCount,failureReason:l.fetchFailureReason,errorUpdateCount:l.errorUpdateCount,isFetched:e.isFetched(),isFetchedAfterMount:l.dataUpdateCount>s.dataUpdateCount||l.errorUpdateCount>s.errorUpdateCount,isFetching:g,isRefetching:g&&!_,isLoadingError:v&&!b,isPaused:l.fetchStatus===`paused`,isPlaceholderData:u,isRefetchError:v&&b,isStale:Me(e,t),refetch:this.refetch,promise:this.#o,isEnabled:k(t.enabled,e)!==!1};if(this.options.experimental_prefetchInRender){let t=x.data!==void 0,r=x.status===`error`&&!t,i=e=>{r?e.reject(x.error):t&&e.resolve(x.data)},a=()=>{let e=this.#o=x.promise=ue();i(e)},o=this.#o;switch(o.status){case`pending`:e.queryHash===n.queryHash&&i(o);break;case`fulfilled`:(r||x.data!==o.value)&&a();break;case`rejected`:(!r||x.error!==o.reason)&&a();break}}return x}updateResult(){let e=this.#r,t=this.createResult(this.#t,this.options);this.#i=this.#t.state,this.#a=this.options,this.#i.data!==void 0&&(this.#u=this.#t),!F(t,e)&&(this.#r=t,this.#C({listeners:(()=>{if(!e)return!0;let{notifyOnChangeProps:t}=this.options,n=typeof t==`function`?t():t;if(n===`all`||!n&&!this.#m.size)return!0;let r=new Set(n??this.#m);return this.options.throwOnError&&r.add(`error`),Object.keys(this.#r).some(t=>{let n=t;return this.#r[n]!==e[n]&&r.has(n)})})()}))}#S(){let e=this.#e.getQueryCache().build(this.#e,this.options);if(e===this.#t)return;let t=this.#t;this.#t=e,this.#n=e.state,this.hasListeners()&&(t?.removeObserver(this),e.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#y()}#C(e){pe.batch(()=>{e.listeners&&this.listeners.forEach(e=>{e(this.#r)}),this.#e.getQueryCache().notify({query:this.#t,type:`observerResultsUpdated`})})}};function Oe(e,t){return k(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status===`error`&&k(t.retryOnMount,e)===!1)}function ke(e,t){return Oe(e,t)||e.state.data!==void 0&&Ae(e,t,t.refetchOnMount)}function Ae(e,t,n){if(k(t.enabled,e)!==!1&&O(t.staleTime,e)!==`static`){let r=typeof n==`function`?n(e):n;return r===`always`||r!==!1&&Me(e,t)}return!1}function je(e,t,n,r){return(e!==t||k(r.enabled,e)===!1)&&(!n.suspense||e.state.status!==`error`)&&Me(e,n)}function Me(e,t){return k(t.enabled,e)!==!1&&e.isStaleByTime(O(t.staleTime,e))}function Ne(e,t){return!F(e.getCurrentResult(),t)}var Pe=class extends ye{#e;#t;#n;#r;constructor(e){super(),this.#e=e.client,this.mutationId=e.mutationId,this.#n=e.mutationCache,this.#t=[],this.state=e.state||Fe(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){this.#t.includes(e)||(this.#t.push(e),this.clearGcTimeout(),this.#n.notify({type:`observerAdded`,mutation:this,observer:e}))}removeObserver(e){this.#t=this.#t.filter(t=>t!==e),this.scheduleGc(),this.#n.notify({type:`observerRemoved`,mutation:this,observer:e})}optionalRemove(){this.#t.length||(this.state.status===`pending`?this.scheduleGc():this.#n.remove(this))}continue(){return this.#r?.continue()??this.execute(this.state.variables)}async execute(e){let t=()=>{this.#i({type:`continue`})},n={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};this.#r=ve({fn:()=>this.options.mutationFn?this.options.mutationFn(e,n):Promise.reject(Error(`No mutationFn found`)),onFail:(e,t)=>{this.#i({type:`failed`,failureCount:e,error:t})},onPause:()=>{this.#i({type:`pause`})},onContinue:t,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#n.canRun(this)});let r=this.state.status===`pending`,i=!this.#r.canStart();try{if(r)t();else{this.#i({type:`pending`,variables:e,isPaused:i}),this.#n.config.onMutate&&await this.#n.config.onMutate(e,this,n);let t=await this.options.onMutate?.(e,n);t!==this.state.context&&this.#i({type:`pending`,context:t,variables:e,isPaused:i})}let a=await this.#r.start();return await this.#n.config.onSuccess?.(a,e,this.state.context,this,n),await this.options.onSuccess?.(a,e,this.state.context,n),await this.#n.config.onSettled?.(a,null,this.state.variables,this.state.context,this,n),await this.options.onSettled?.(a,null,e,this.state.context,n),this.#i({type:`success`,data:a}),a}catch(t){try{await this.#n.config.onError?.(t,e,this.state.context,this,n)}catch(e){Promise.reject(e)}try{await this.options.onError?.(t,e,this.state.context,n)}catch(e){Promise.reject(e)}try{await this.#n.config.onSettled?.(void 0,t,this.state.variables,this.state.context,this,n)}catch(e){Promise.reject(e)}try{await this.options.onSettled?.(void 0,t,e,this.state.context,n)}catch(e){Promise.reject(e)}throw this.#i({type:`error`,error:t}),t}finally{this.#n.runNext(this)}}#i(e){let t=t=>{switch(e.type){case`failed`:return{...t,failureCount:e.failureCount,failureReason:e.error};case`pause`:return{...t,isPaused:!0};case`continue`:return{...t,isPaused:!1};case`pending`:return{...t,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:`pending`,variables:e.variables,submittedAt:Date.now()};case`success`:return{...t,data:e.data,failureCount:0,failureReason:null,error:null,status:`success`,isPaused:!1};case`error`:return{...t,data:void 0,error:e.error,failureCount:t.failureCount+1,failureReason:e.error,isPaused:!1,status:`error`}}};this.state=t(this.state),pe.batch(()=>{this.#t.forEach(t=>{t.onMutationUpdate(e)}),this.#n.notify({mutation:this,type:`updated`,action:e})})}};function Fe(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:`idle`,variables:void 0,submittedAt:0}}var Ie=class extends v{constructor(e={}){super(),this.config=e,this.#e=new Set,this.#t=new Map,this.#n=0}#e;#t;#n;build(e,t,n){let r=new Pe({client:e,mutationCache:this,mutationId:++this.#n,options:e.defaultMutationOptions(t),state:n});return this.add(r),r}add(e){this.#e.add(e);let t=Le(e);if(typeof t==`string`){let n=this.#t.get(t);n?n.push(e):this.#t.set(t,[e])}this.notify({type:`added`,mutation:e})}remove(e){if(this.#e.delete(e)){let t=Le(e);if(typeof t==`string`){let n=this.#t.get(t);if(n)if(n.length>1){let t=n.indexOf(e);t!==-1&&n.splice(t,1)}else n[0]===e&&this.#t.delete(t)}}this.notify({type:`removed`,mutation:e})}canRun(e){let t=Le(e);if(typeof t==`string`){let n=this.#t.get(t)?.find(e=>e.state.status===`pending`);return!n||n===e}else return!0}runNext(e){let t=Le(e);return typeof t==`string`?(this.#t.get(t)?.find(t=>t!==e&&t.state.isPaused))?.continue()??Promise.resolve():Promise.resolve()}clear(){pe.batch(()=>{this.#e.forEach(e=>{this.notify({type:`removed`,mutation:e})}),this.#e.clear(),this.#t.clear()})}getAll(){return Array.from(this.#e)}find(e){let t={exact:!0,...e};return this.getAll().find(e=>te(t,e))}findAll(e={}){return this.getAll().filter(t=>te(e,t))}notify(e){pe.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){let e=this.getAll().filter(e=>e.state.isPaused);return pe.batch(()=>Promise.all(e.map(e=>e.continue().catch(w))))}};function Le(e){return e.options.scope?.id}var Re=class extends v{#e;#t=void 0;#n;#r;constructor(e,t){super(),this.#e=e,this.setOptions(t),this.bindMethods(),this.#i()}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(e){let t=this.options;this.options=this.#e.defaultMutationOptions(e),F(this.options,t)||this.#e.getMutationCache().notify({type:`observerOptionsUpdated`,mutation:this.#n,observer:this}),t?.mutationKey&&this.options.mutationKey&&j(t.mutationKey)!==j(this.options.mutationKey)?this.reset():this.#n?.state.status===`pending`&&this.#n.setOptions(this.options)}onUnsubscribe(){this.hasListeners()||this.#n?.removeObserver(this)}onMutationUpdate(e){this.#i(),this.#a(e)}getCurrentResult(){return this.#t}reset(){this.#n?.removeObserver(this),this.#n=void 0,this.#i(),this.#a()}mutate(e,t){return this.#r=t,this.#n?.removeObserver(this),this.#n=this.#e.getMutationCache().build(this.#e,this.options),this.#n.addObserver(this),this.#n.execute(e)}#i(){let e=this.#n?.state??Fe();this.#t={...e,isPending:e.status===`pending`,isSuccess:e.status===`success`,isError:e.status===`error`,isIdle:e.status===`idle`,mutate:this.mutate,reset:this.reset}}#a(e){pe.batch(()=>{if(this.#r&&this.hasListeners()){let t=this.#t.variables,n=this.#t.context,r={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};if(e?.type===`success`){try{this.#r.onSuccess?.(e.data,t,n,r)}catch(e){Promise.reject(e)}try{this.#r.onSettled?.(e.data,null,t,n,r)}catch(e){Promise.reject(e)}}else if(e?.type===`error`){try{this.#r.onError?.(e.error,t,n,r)}catch(e){Promise.reject(e)}try{this.#r.onSettled?.(void 0,e.error,t,n,r)}catch(e){Promise.reject(e)}}}this.listeners.forEach(e=>{e(this.#t)})})}},ze=class extends v{constructor(e={}){super(),this.config=e,this.#e=new Map}#e;build(e,t,n){let r=t.queryKey,i=t.queryHash??A(r,t),a=this.get(i);return a||(a=new Ce({client:e,queryKey:r,queryHash:i,options:e.defaultQueryOptions(t),state:n,defaultOptions:e.getQueryDefaults(r)}),this.add(a)),a}add(e){this.#e.has(e.queryHash)||(this.#e.set(e.queryHash,e),this.notify({type:`added`,query:e}))}remove(e){let t=this.#e.get(e.queryHash);t&&(e.destroy(),t===e&&this.#e.delete(e.queryHash),this.notify({type:`removed`,query:e}))}clear(){pe.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return this.#e.get(e)}getAll(){return[...this.#e.values()]}find(e){let t={exact:!0,...e};return this.getAll().find(e=>ee(t,e))}findAll(e={}){let t=this.getAll();return Object.keys(e).length>0?t.filter(t=>ee(e,t)):t}notify(e){pe.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){pe.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){pe.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},Be=class{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e={}){this.#e=e.queryCache||new ze,this.#t=e.mutationCache||new Ie,this.#n=e.defaultOptions||{},this.#r=new Map,this.#i=new Map,this.#a=0}mount(){this.#a++,this.#a===1&&(this.#o=y.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#s=me.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onOnline())}))}unmount(){this.#a--,this.#a===0&&(this.#o?.(),this.#o=void 0,this.#s?.(),this.#s=void 0)}isFetching(e){return this.#e.findAll({...e,fetchStatus:`fetching`}).length}isMutating(e){return this.#t.findAll({...e,status:`pending`}).length}getQueryData(e){let t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state.data}ensureQueryData(e){let t=this.defaultQueryOptions(e),n=this.#e.build(this,t),r=n.state.data;return r===void 0?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime(O(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(r))}getQueriesData(e){return this.#e.findAll(e).map(({queryKey:e,state:t})=>[e,t.data])}setQueryData(e,t,n){let r=this.defaultQueryOptions({queryKey:e}),i=this.#e.get(r.queryHash)?.state.data,a=T(t,i);if(a!==void 0)return this.#e.build(this,r).setData(a,{...n,manual:!0})}setQueriesData(e,t,n){return pe.batch(()=>this.#e.findAll(e).map(({queryKey:e})=>[e,this.setQueryData(e,t,n)]))}getQueryState(e){let t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state}removeQueries(e){let t=this.#e;pe.batch(()=>{t.findAll(e).forEach(e=>{t.remove(e)})})}resetQueries(e,t){let n=this.#e;return pe.batch(()=>(n.findAll(e).forEach(e=>{e.reset()}),this.refetchQueries({type:`active`,...e},t)))}cancelQueries(e,t={}){let n={revert:!0,...t},r=pe.batch(()=>this.#e.findAll(e).map(e=>e.cancel(n)));return Promise.all(r).then(w).catch(w)}invalidateQueries(e,t={}){return pe.batch(()=>(this.#e.findAll(e).forEach(e=>{e.invalidate()}),e?.refetchType===`none`?Promise.resolve():this.refetchQueries({...e,type:e?.refetchType??e?.type??`active`},t)))}refetchQueries(e,t={}){let n={...t,cancelRefetch:t.cancelRefetch??!0},r=pe.batch(()=>this.#e.findAll(e).filter(e=>!e.isDisabled()&&!e.isStatic()).map(e=>{let t=e.fetch(void 0,n);return n.throwOnError||(t=t.catch(w)),e.state.fetchStatus===`paused`?Promise.resolve():t}));return Promise.all(r).then(w)}fetchQuery(e){let t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);let n=this.#e.build(this,t);return n.isStaleByTime(O(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(w).catch(w)}fetchInfiniteQuery(e){return e._type=`infinite`,this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(w).catch(w)}ensureInfiniteQueryData(e){return e._type=`infinite`,this.ensureQueryData(e)}resumePausedMutations(){return me.isOnline()?this.#t.resumePausedMutations():Promise.resolve()}getQueryCache(){return this.#e}getMutationCache(){return this.#t}getDefaultOptions(){return this.#n}setDefaultOptions(e){this.#n=e}setQueryDefaults(e,t){this.#r.set(j(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){let t=[...this.#r.values()],n={};return t.forEach(t=>{M(e,t.queryKey)&&Object.assign(n,t.defaultOptions)}),n}setMutationDefaults(e,t){this.#i.set(j(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){let t=[...this.#i.values()],n={};return t.forEach(t=>{M(e,t.mutationKey)&&Object.assign(n,t.defaultOptions)}),n}defaultQueryOptions(e){if(e._defaulted)return e;let t={...this.#n.queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||=A(t.queryKey,t),t.refetchOnReconnect===void 0&&(t.refetchOnReconnect=t.networkMode!==`always`),t.throwOnError===void 0&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode=`offlineFirst`),t.queryFn===z&&(t.enabled=!1),t}defaultMutationOptions(e){return e?._defaulted?e:{...this.#n.mutations,...e?.mutationKey&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){this.#e.clear(),this.#t.clear()}},Ve=o((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.fragment`);function r(e,n,r){var i=null;if(r!==void 0&&(i=``+r),n.key!==void 0&&(i=``+n.key),`key`in n)for(var a in r={},n)a!==`key`&&(r[a]=n[a]);else r=n;return n=r.ref,{$$typeof:t,type:e,key:i,ref:n===void 0?null:n,props:r}}e.Fragment=n,e.jsx=r,e.jsxs=r})),He=o(((e,t)=>{t.exports=Ve()})),B=l(d(),1),V=He(),Ue=B.createContext(void 0),We=e=>{let t=B.useContext(Ue);if(e)return e;if(!t)throw Error(`No QueryClient set, use QueryClientProvider to set one`);return t},Ge=({client:e,children:t})=>(B.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),(0,V.jsx)(Ue.Provider,{value:e,children:t})),Ke=B.createContext(!1),qe=()=>B.useContext(Ke);Ke.Provider;function Je(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var Ye=B.createContext(Je()),Xe=()=>B.useContext(Ye),Ze=(e,t,n)=>{let r=n?.state.error&&typeof e.throwOnError==`function`?se(e.throwOnError,[n.state.error,n]):e.throwOnError;(e.suspense||e.experimental_prefetchInRender||r)&&(t.isReset()||(e.retryOnMount=!1))},Qe=e=>{B.useEffect(()=>{e.clearReset()},[e])},$e=({result:e,errorResetBoundary:t,throwOnError:n,query:r,suspense:i})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(i&&e.data===void 0||se(n,[e.error,r])),et=e=>{if(e.suspense){let t=1e3,n=e=>e===`static`?e:Math.max(e??t,t),r=e.staleTime;e.staleTime=typeof r==`function`?(...e)=>n(r(...e)):n(r),typeof e.gcTime==`number`&&(e.gcTime=Math.max(e.gcTime,t))}},tt=(e,t)=>e.isLoading&&e.isFetching&&!t,nt=(e,t)=>e?.suspense&&t.isPending,rt=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function it(e,t,n){let r=qe(),i=Xe(),a=We(n),o=a.defaultQueryOptions(e);a.getDefaultOptions().queries?._experimental_beforeQuery?.(o);let s=a.getQueryCache().get(o.queryHash),c=e.subscribed!==!1;o._optimisticResults=r?`isRestoring`:c?`optimistic`:void 0,et(o),Ze(o,i,s),Qe(i);let l=!a.getQueryCache().get(o.queryHash),[u]=B.useState(()=>new t(a,o)),d=u.getOptimisticResult(o),f=!r&&c;if(B.useSyncExternalStore(B.useCallback(e=>{let t=f?u.subscribe(pe.batchCalls(e)):w;return u.updateResult(),t},[u,f]),()=>u.getCurrentResult(),()=>u.getCurrentResult()),B.useEffect(()=>{u.setOptions(o)},[o,u]),nt(o,d))throw rt(o,u,i);if($e({result:d,errorResetBoundary:i,throwOnError:o.throwOnError,query:s,suspense:o.suspense}))throw d.error;return a.getDefaultOptions().queries?._experimental_afterQuery?.(o,d),o.experimental_prefetchInRender&&!le.isServer()&&tt(d,r)&&(l?rt(o,u,i):s?.promise)?.catch(w).finally(()=>{u.updateResult()}),o.notifyOnChangeProps?d:u.trackResult(d)}function at(e,t){return it(e,De,t)}function ot(e){return e}function st(e,t){let n=We(t),[r]=B.useState(()=>new Re(n,e));B.useEffect(()=>{r.setOptions(e)},[r,e]);let i=B.useSyncExternalStore(B.useCallback(e=>r.subscribe(pe.batchCalls(e)),[r]),()=>r.getCurrentResult(),()=>r.getCurrentResult()),a=B.useCallback((e,t)=>{r.mutate(e,t).catch(w)},[r]);if(i.error&&se(r.options.throwOnError,[i.error]))throw i.error;return{...i,mutate:a,mutateAsync:i.mutate}}var ct=typeof window<`u`?B.useLayoutEffect:B.useEffect;function lt(e){let t=B.useRef({value:e,prev:null}),n=t.current.value;return e!==n&&(t.current={value:e,prev:n}),t.current.prev}function ut(e,t,n={},r={}){B.useEffect(()=>{if(!e.current||r.disabled||typeof IntersectionObserver!=`function`)return;let i=new IntersectionObserver(([e])=>{t(e)},n);return i.observe(e.current),()=>{i.disconnect()}},[t,n,r.disabled,e])}function dt(e){let t=B.useRef(null);return B.useImperativeHandle(e,()=>t.current,[]),t}function ft(e){return e[e.length-1]}function pt(e){return typeof e==`function`}function mt(e,t){return pt(e)?e(t):e}var ht=Object.prototype.hasOwnProperty,gt=Object.prototype.propertyIsEnumerable;function _t(e){for(let t in e)if(ht.call(e,t))return!0;return!1}var vt=()=>Object.create(null),yt=(e,t)=>bt(e,t,vt);function bt(e,t,n=()=>({}),r=0){if(e===t)return e;if(r>500)return t;let i=t,a=wt(e)&&wt(i);if(!a&&!(St(e)&&St(i)))return i;let o=a?e:xt(e);if(!o)return i;let s=a?i:xt(i);if(!s)return i;let c=o.length,l=s.length,u=a?Array(l):n(),d=0;for(let t=0;t<l;t++){let o=a?t:s[t],l=e[o],f=i[o];if(l===f){u[o]=l,(a?t<c:ht.call(e,o))&&d++;continue}if(l===null||f===null||typeof l!=`object`||typeof f!=`object`){u[o]=f;continue}let p=bt(l,f,n,r+1);u[o]=p,p===l&&d++}return c===l&&d===c?e:u}function xt(e){let t=Object.getOwnPropertyNames(e);for(let n of t)if(!gt.call(e,n))return!1;let n=Object.getOwnPropertySymbols(e);if(n.length===0)return t;let r=t;for(let t of n){if(!gt.call(e,t))return!1;r.push(t)}return r}function St(e){if(!Ct(e))return!1;let t=e.constructor;if(t===void 0)return!0;let n=t.prototype;return!(!Ct(n)||!n.hasOwnProperty(`isPrototypeOf`))}function Ct(e){return Object.prototype.toString.call(e)===`[object Object]`}function wt(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function Tt(e,t,n){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return!1;for(let r=0,i=e.length;r<i;r++)if(!Tt(e[r],t[r],n))return!1;return!0}if(St(e)&&St(t)){let r=n?.ignoreUndefined??!0;if(n?.partial){for(let i in t)if((!r||t[i]!==void 0)&&!Tt(e[i],t[i],n))return!1;return!0}let i=0;if(!r)i=Object.keys(e).length;else for(let t in e)e[t]!==void 0&&i++;let a=0;for(let o in t)if((!r||t[o]!==void 0)&&(a++,a>i||!Tt(e[o],t[o],n)))return!1;return i===a}return!1}function Et(e){let t,n,r=new Promise((e,r)=>{t=e,n=r});return r.status=`pending`,r.resolve=n=>{r.status=`resolved`,r.value=n,t(n),e?.(n)},r.reject=e=>{r.status=`rejected`,n(e)},r}function Dt(e){return!!(e&&typeof e==`object`&&typeof e.then==`function`)}var Ot=/[\x00-\x1f\x7f"<>`{}]/g;function kt(e){return e.replace(Ot,e=>`%`+e.charCodeAt(0).toString(16).toUpperCase().padStart(2,`0`))}function At(e){let t;try{t=decodeURI(e)}catch{t=e.replaceAll(/%[0-9A-F]{2}/gi,e=>{try{return decodeURI(e)}catch{return e}})}return kt(t)}var jt=[`http:`,`https:`,`mailto:`,`tel:`];function Mt(e,t){if(!e)return!1;try{let n=new URL(e);return!t.has(n.protocol)}catch{return!1}}function Nt(e){if(!e||!/[%\\\x00-\x1f\x7f]/.test(e)&&!e.startsWith(`//`))return{path:e,handledProtocolRelativeURL:!1};let t=/%25|%5C/gi,n=0,r=``,i;for(;(i=t.exec(e))!==null;)r+=At(e.slice(n,i.index))+i[0],n=t.lastIndex;r+=At(n?e.slice(n):e);let a=!1;return r.startsWith(`//`)&&(a=!0,r=`/`+r.replace(/^\/+/,``)),{path:r,handledProtocolRelativeURL:a}}function Pt(e){return/\s|[^\u0000-\u007F]/.test(e)?e.replace(/\s|[^\u0000-\u007F]/gu,encodeURIComponent):e}function Ft(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 It(){throw Error(`Invariant failed`)}function Lt(e){let t=new Map,n,r,i=e=>{e.next&&(e.prev?(e.prev.next=e.next,e.next.prev=e.prev,e.next=void 0,r&&(r.next=e,e.prev=r)):(e.next.prev=void 0,n=e.next,e.next=void 0,r&&(e.prev=r,r.next=e)),r=e)};return{get(e){let n=t.get(e);if(n)return i(n),n.value},set(a,o){if(t.size>=e&&n){let e=n;t.delete(e.key),e.next&&(n=e.next,e.next.prev=void 0),e===r&&(r=void 0)}let s=t.get(a);if(s)s.value=o,i(s);else{let e={key:a,value:o,prev:r};r&&(r.next=e),r=e,n||=e,t.set(a,e)}},clear(){t.clear(),n=void 0,r=void 0}}}var Rt=4,zt=5;function Bt(e){let t=e.indexOf(`{`);if(t===-1)return null;let n=e.indexOf(`}`,t);return n===-1||t+1>=e.length?null:[t,n]}function Vt(e,t,n=new Uint16Array(6)){let r=e.indexOf(`/`,t),i=r===-1?e.length:r,a=e.substring(t,i);if(!a||!a.includes(`$`))return n[0]=0,n[1]=t,n[2]=t,n[3]=i,n[4]=i,n[5]=i,n;if(a===`$`){let r=e.length;return n[0]=2,n[1]=t,n[2]=t,n[3]=r,n[4]=r,n[5]=r,n}if(a.charCodeAt(0)===36)return n[0]=1,n[1]=t,n[2]=t+1,n[3]=i,n[4]=i,n[5]=i,n;let o=Bt(a);if(o){let[r,s]=o,c=a.charCodeAt(r+1);if(c===45){if(r+2<a.length&&a.charCodeAt(r+2)===36){let e=r+3,a=s;if(e<a)return n[0]=3,n[1]=t+r,n[2]=t+e,n[3]=t+a,n[4]=t+s+1,n[5]=i,n}}else if(c===36){let a=r+1,o=r+2;return o===s?(n[0]=2,n[1]=t+r,n[2]=t+a,n[3]=t+o,n[4]=t+s+1,n[5]=e.length,n):(n[0]=1,n[1]=t+r,n[2]=t+o,n[3]=t+s,n[4]=t+s+1,n[5]=i,n)}}return n[0]=0,n[1]=t,n[2]=t,n[3]=i,n[4]=i,n[5]=i,n}function Ht(e,t,n,r,i,a,o){o?.(n);let s=r;{let r=n.fullPath??n.from,o=r.length,c=n.options?.caseSensitive??e,l=n.options?.params?.parse??n.options?.parseParams;for(;s<o;){let e=Vt(r,s,t),o,u=s,d=e[5];switch(s=d+1,a++,e[0]){case 0:{let t=r.substring(e[2],e[3]);if(c){let e=i.static?.get(t);if(e)o=e;else{i.static??=new Map;let e=Gt(n.fullPath??n.from);e.parent=i,e.depth=a,o=e,i.static.set(t,e)}}else{let e=t.toLowerCase(),r=i.staticInsensitive?.get(e);if(r)o=r;else{i.staticInsensitive??=new Map;let t=Gt(n.fullPath??n.from);t.parent=i,t.depth=a,o=t,i.staticInsensitive.set(e,t)}}break}case 1:{let t=r.substring(u,e[1]),s=r.substring(e[4],d),f=c&&!!(t||s),p=t?f?t:t.toLowerCase():void 0,m=s?f?s:s.toLowerCase():void 0,h=!l&&i.dynamic?.find(e=>!e.parse&&e.caseSensitive===f&&e.prefix===p&&e.suffix===m);if(h)o=h;else{let e=Kt(1,n.fullPath??n.from,f,p,m);o=e,e.depth=a,e.parent=i,i.dynamic??=[],i.dynamic.push(e)}break}case 3:{let t=r.substring(u,e[1]),s=r.substring(e[4],d),f=c&&!!(t||s),p=t?f?t:t.toLowerCase():void 0,m=s?f?s:s.toLowerCase():void 0,h=!l&&i.optional?.find(e=>!e.parse&&e.caseSensitive===f&&e.prefix===p&&e.suffix===m);if(h)o=h;else{let e=Kt(3,n.fullPath??n.from,f,p,m);o=e,e.parent=i,e.depth=a,i.optional??=[],i.optional.push(e)}break}case 2:{let t=r.substring(u,e[1]),s=r.substring(e[4],d),l=c&&!!(t||s),f=t?l?t:t.toLowerCase():void 0,p=s?l?s:s.toLowerCase():void 0,m=Kt(2,n.fullPath??n.from,l,f,p);o=m,m.parent=i,m.depth=a,i.wildcard??=[],i.wildcard.push(m)}}i=o}if(l&&n.children&&!n.isRoot&&n.id&&n.id.charCodeAt(n.id.lastIndexOf(`/`)+1)===95){let e=Gt(n.fullPath??n.from);e.kind=zt,e.parent=i,a++,e.depth=a,i.pathless??=[],i.pathless.push(e),i=e}let u=(n.path||!n.children)&&!n.isRoot;if(u&&r.endsWith(`/`)){let e=Gt(n.fullPath??n.from);e.kind=Rt,e.parent=i,a++,e.depth=a,i.index=e,i=e}i.parse=l??null,i.priority=n.options?.params?.priority??0,u&&!i.route&&(i.route=n,i.fullPath=n.fullPath??n.from)}if(n.children)for(let r of n.children)Ht(e,t,r,s,i,a,o)}function Ut(e,t){if(e.parse&&!t.parse)return-1;if(!e.parse&&t.parse)return 1;if(e.parse&&t.parse&&(e.priority||t.priority))return t.priority-e.priority;if(e.prefix&&t.prefix&&e.prefix!==t.prefix){if(e.prefix.startsWith(t.prefix))return-1;if(t.prefix.startsWith(e.prefix))return 1}if(e.suffix&&t.suffix&&e.suffix!==t.suffix){if(e.suffix.endsWith(t.suffix))return-1;if(t.suffix.endsWith(e.suffix))return 1}return e.prefix&&!t.prefix?-1:!e.prefix&&t.prefix?1:e.suffix&&!t.suffix?-1:!e.suffix&&t.suffix?1:e.caseSensitive&&!t.caseSensitive?-1:!e.caseSensitive&&t.caseSensitive?1:0}function Wt(e){if(e.pathless)for(let t of e.pathless)Wt(t);if(e.static)for(let t of e.static.values())Wt(t);if(e.staticInsensitive)for(let t of e.staticInsensitive.values())Wt(t);if(e.dynamic?.length){e.dynamic.sort(Ut);for(let t of e.dynamic)Wt(t)}if(e.optional?.length){e.optional.sort(Ut);for(let t of e.optional)Wt(t)}if(e.wildcard?.length){e.wildcard.sort(Ut);for(let t of e.wildcard)Wt(t)}}function Gt(e){return{kind:0,depth:0,pathless:null,index:null,static:null,staticInsensitive:null,dynamic:null,optional:null,wildcard:null,route:null,fullPath:e,parent:null,parse:null,priority:0}}function Kt(e,t,n,r,i){return{kind:e,depth:0,pathless:null,index:null,static:null,staticInsensitive:null,dynamic:null,optional:null,wildcard:null,route:null,fullPath:t,parent:null,parse:null,priority:0,caseSensitive:n,prefix:r,suffix:i}}function qt(e,t){let n=Gt(`/`),r=new Uint16Array(6);for(let t of e)Ht(!1,r,t,1,n,0);Wt(n),t.masksTree=n,t.flatCache=Lt(1e3)}function Jt(e,t){e||=`/`;let n=t.flatCache.get(e);if(n)return n;let r=$t(e,t.masksTree);return t.flatCache.set(e,r),r}function Yt(e,t,n,r,i){e||=`/`,r||=`/`;let a=t?`case\0${e}`:e,o=i.singleCache.get(a);return o||(o=Gt(`/`),Ht(t,new Uint16Array(6),{from:e},1,o,0),i.singleCache.set(a,o)),$t(r,o,n)}function Xt(e,t,n=!1){let r=n?e:`nofuzz\0${e}`,i=t.matchCache.get(r);if(i!==void 0)return i;e||=`/`;let a;try{a=$t(e,t.segmentTree,n)}catch(e){if(e instanceof URIError)a=null;else throw e}return a&&(a.branch=tn(a.route)),t.matchCache.set(r,a),a}function Zt(e){return e===`/`?e:e.replace(/\/{1,}$/,``)}function Qt(e,t=!1,n){let r=Gt(e.fullPath),i=new Uint16Array(6),a={},o={},s=0;return Ht(t,i,e,1,r,0,e=>{if(n?.(e,s),e.id in a&&It(),a[e.id]=e,s!==0&&e.path){let t=Zt(e.fullPath);(!o[t]||e.fullPath.endsWith(`/`))&&(o[t]=e)}s++}),Wt(r),{processedTree:{segmentTree:r,singleCache:Lt(1e3),matchCache:Lt(1e3),flatCache:null,masksTree:null},routesById:a,routesByPath:o}}function $t(e,t,n=!1){let r=e.split(`/`),i=rn(e,r,t,n);if(!i)return null;let[a]=en(e,r,i);return{route:i.node.route,rawParams:a}}function en(e,t,n){let r=nn(n.node),i=null,a=Object.create(null),o=n.extract?.part??0,s=n.extract?.node??0,c=n.extract?.path??0,l=n.extract?.segment??0;for(;s<r.length;o++,s++,c++,l++){let u=r[s];if(u.kind===Rt)break;if(u.kind===zt){l--,o--,c--;continue}let d=t[o],f=c;if(d&&(c+=d.length),u.kind===1){i??=n.node.fullPath.split(`/`);let e=i[l],t=u.prefix?.length??0;if(e.charCodeAt(t)===123){let n=u.suffix?.length??0,r=e.substring(t+2,e.length-n-1),i=d.substring(t,d.length-n);a[r]=decodeURIComponent(i)}else{let t=e.substring(1);a[t]=decodeURIComponent(d)}}else if(u.kind===3){if(n.skipped&1<<s){o--,c=f-1;continue}i??=n.node.fullPath.split(`/`);let e=i[l],t=u.prefix?.length??0,r=u.suffix?.length??0,p=e.substring(t+3,e.length-r-1),m=u.suffix||u.prefix?d.substring(t,d.length-r):d;m&&(a[p]=decodeURIComponent(m))}else if(u.kind===2){let t=u,n=e.substring(f+(t.prefix?.length??0),e.length-(t.suffix?.length??0)),r=decodeURIComponent(n);a[`*`]=r,a._splat=r;break}}return n.rawParams&&Object.assign(a,n.rawParams),[a,{part:o,node:s,path:c,segment:l}]}function tn(e){let t=[e];for(;e.parentRoute;)e=e.parentRoute,t.push(e);return t.reverse(),t}function nn(e){let t=Array(e.depth+1);do t[e.depth]=e,e=e.parent;while(e);return t}function rn(e,t,n,r){if(e===`/`&&n.index)return{node:n.index,skipped:0};let i=!ft(t),a=i&&e!==`/`,o=t.length-+!!i,s=[{node:n,index:1,skipped:0,depth:1,statics:0,dynamics:0,optionals:0}],c=null,l=null;for(;s.length;){let n=s.pop(),{node:i,index:u,skipped:d,depth:f,statics:p,dynamics:m,optionals:h}=n,{extract:g,rawParams:_}=n;if(i.kind===2&&i.route&&!cn(l,n))continue;if(i.parse){if(!sn(e,t,n))continue;_=n.rawParams,g=n.extract}r&&i.route&&i.kind!==Rt&&cn(c,n)&&(c=n);let v=u===o;if(v&&(i.route&&(!a||i.kind===Rt||i.kind===2)&&cn(l,n)&&(l=n),!i.optional&&!i.wildcard&&!i.index&&!i.pathless))continue;let y=v?void 0:t[u],b;if(v&&i.index){let n={node:i.index,index:u,skipped:d,depth:f+1,statics:p,dynamics:m,optionals:h,extract:g,rawParams:_},r=!0;if(i.index.parse&&(sn(e,t,n)||(r=!1)),r){if(!m&&!h&&!d&&on(p,o))return n;cn(l,n)&&(l=n)}}if(i.wildcard)for(let e=i.wildcard.length-1;e>=0;e--){let n=i.wildcard[e],{prefix:r,suffix:a}=n;if(!(r&&(v||!(n.caseSensitive?y:b??=y.toLowerCase()).startsWith(r)))){if(a){if(v)continue;let e=t.slice(u).join(`/`).slice(-a.length);if((n.caseSensitive?e:e.toLowerCase())!==a)continue}s.push({node:n,index:o,skipped:d,depth:f+1,statics:p,dynamics:m,optionals:h,extract:g,rawParams:_})}}if(i.optional){let e=d|1<<f,t=f+1;for(let n=i.optional.length-1;n>=0;n--){let r=i.optional[n];s.push({node:r,index:u,skipped:e,depth:t,statics:p,dynamics:m,optionals:h,extract:g,rawParams:_})}if(!v)for(let e=i.optional.length-1;e>=0;e--){let n=i.optional[e],{prefix:r,suffix:a}=n;if(r||a){let e=n.caseSensitive?y:b??=y.toLowerCase();if(r&&!e.startsWith(r)||a&&!e.endsWith(a))continue}s.push({node:n,index:u+1,skipped:d,depth:t,statics:p,dynamics:m,optionals:h+an(o,u),extract:g,rawParams:_})}}if(!v&&i.dynamic&&y)for(let e=i.dynamic.length-1;e>=0;e--){let t=i.dynamic[e],{prefix:n,suffix:r}=t;if(n||r){let e=t.caseSensitive?y:b??=y.toLowerCase();if(n&&!e.startsWith(n)||r&&!e.endsWith(r))continue}s.push({node:t,index:u+1,skipped:d,depth:f+1,statics:p,dynamics:m+an(o,u),optionals:h,extract:g,rawParams:_})}if(!v&&i.staticInsensitive){let e=i.staticInsensitive.get(b??=y.toLowerCase());e&&s.push({node:e,index:u+1,skipped:d,depth:f+1,statics:p+an(o,u),dynamics:m,optionals:h,extract:g,rawParams:_})}if(!v&&i.static){let e=i.static.get(y);e&&s.push({node:e,index:u+1,skipped:d,depth:f+1,statics:p+an(o,u),dynamics:m,optionals:h,extract:g,rawParams:_})}if(i.pathless){let e=f+1;for(let t=i.pathless.length-1;t>=0;t--){let n=i.pathless[t];s.push({node:n,index:u,skipped:d,depth:e,statics:p,dynamics:m,optionals:h,extract:g,rawParams:_})}}}if(l)return l;if(r&&c){let n=c.index;for(let e=0;e<c.index;e++)n+=t[e].length;let r=n===e.length?`/`:e.slice(n);return c.rawParams??=Object.create(null),c.rawParams[`**`]=decodeURIComponent(r),c}return null}function an(e,t){return 2**(e-t-1)}function on(e,t){return e===2**(t-1)-1}function sn(e,t,n){let r,i;try{[r,i]=en(e,t,n)}catch{return null}if(n.rawParams=r,n.extract=i,!n.node.parse)return!0;try{if(n.node.parse(r)===!1)return null}catch{}return!0}function cn(e,t){return!e||t.statics>e.statics||t.statics===e.statics&&(t.dynamics>e.dynamics||t.dynamics===e.dynamics&&(t.optionals>e.optionals||t.optionals===e.optionals&&((t.node.kind===Rt)>(e.node.kind===Rt)||t.node.kind===Rt==(e.node.kind===Rt)&&t.depth>e.depth)))}function ln(e){return un(e.filter(e=>e!==void 0).join(`/`))}function un(e){return e.replace(/\/{2,}/g,`/`)}function dn(e){return e===`/`?e:e.replace(/^\/{1,}/,``)}function fn(e){let t=e.length;return t>1&&e[t-1]===`/`?e.replace(/\/{1,}$/,``):e}function pn(e){return fn(dn(e))}function mn(e,t){return e?.endsWith(`/`)&&e!==`/`&&e!==`${t}/`?e.slice(0,-1):e}function hn(e,t,n){return mn(e,n)===mn(t,n)}function gn({base:e,to:t,trailingSlash:n=`never`,cache:r}){let i=t.startsWith(`/`),a=!i&&t===`.`,o;if(r){o=i?t:a?e:e+`\0`+t;let n=r.get(o);if(n)return n}let s;if(a)s=e.split(`/`);else if(i)s=t.split(`/`);else{for(s=e.split(`/`);s.length>1&&ft(s)===``;)s.pop();let n=t.split(`/`);for(let e=0,t=n.length;e<t;e++){let r=n[e];r===``?e?e===t-1&&s.push(r):s=[r]:r===`..`?s.pop():r===`.`||s.push(r)}}s.length>1&&(ft(s)===``?n===`never`&&s.pop():n===`always`&&s.push(``));let c=un(s.join(`/`))||`/`;return o&&r&&r.set(o,c),c}function _n(e){let t=new Map(e.map(e=>[encodeURIComponent(e),e])),n=Array.from(t.keys()).map(e=>e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)).join(`|`),r=new RegExp(n,`g`);return e=>e.replace(r,e=>t.get(e)??e)}function vn(e,t,n){let r=t[e];return typeof r==`string`?e===`_splat`?/^[a-zA-Z0-9\-._~!/]*$/.test(r)?r:r.split(`/`).map(e=>bn(e,n)).join(`/`):bn(r,n):r}function yn({path:e,params:t,decoder:n,...r}){let i=!1,a=Object.create(null);if(!e||e===`/`)return{interpolatedPath:`/`,usedParams:a,isMissingParams:i};if(!e.includes(`$`))return{interpolatedPath:e,usedParams:a,isMissingParams:i};let o=e.length,s=0,c,l=``;for(;s<o;){let r=s;c=Vt(e,r,c);let o=c[5];if(s=o+1,r===o)continue;let u=c[0];if(u===0){l+=`/`+e.substring(r,o);continue}if(u===2){let s=t._splat;a._splat=s,a[`*`]=s;let u=e.substring(r,c[1]),d=e.substring(c[4],o);if(!s){i=!0,(u||d)&&(l+=`/`+u+d);continue}let f=vn(`_splat`,t,n);l+=`/`+u+f+d;continue}if(u===1){let s=e.substring(c[2],c[3]);!i&&!(s in t)&&(i=!0),a[s]=t[s];let u=e.substring(r,c[1]),d=e.substring(c[4],o),f=vn(s,t,n)??`undefined`;l+=`/`+u+f+d;continue}if(u===3){let i=e.substring(c[2],c[3]),s=t[i];if(s==null)continue;a[i]=s;let u=e.substring(r,c[1]),d=e.substring(c[4],o),f=vn(i,t,n)??``;l+=`/`+u+f+d;continue}}return e.endsWith(`/`)&&(l+=`/`),{usedParams:a,interpolatedPath:l||`/`,isMissingParams:i}}function bn(e,t){let n=encodeURIComponent(e);return t?.(n)??n}function xn(e){return e?.isNotFound===!0}function Sn(){try{return sessionStorage}catch{return}}var Cn=`tsr-scroll-restoration-v1_3`,wn=Sn();function Tn(){try{return JSON.parse(wn?.getItem(`tsr-scroll-restoration-v1_3`)||`{}`)}catch{return{}}}function En(){try{wn?.setItem(Cn,JSON.stringify(Dn))}catch{}}var Dn=Tn(),On=`data-scroll-restoration-id`,kn=e=>e.state.__TSR_key||e.href;function An(e){let t=e.getAttribute(On);if(t)return`[${On}="${t}"]`;let n=``,r=e,i;for(;i=r.parentNode;){let e=1,t=r;for(;t=t.previousElementSibling;)e++;let a=`${r.localName}:nth-child(${e})`;n=n?`${a} > ${n}`:a,r=i}return n}var jn=!1,Mn=`window`;function Nn(e){try{return typeof e==`function`?e():document.querySelector(e)}catch{}}function Pn(e){let t=new Set;for(let n of e){if(n===Mn)continue;let e=Nn(n);e&&t.add(e)}return t}function Fn(e,t){let n=t??e.options.scrollRestoration,r=e._scroll;n&&(r.restoring=!0);let i=e.options.getScrollRestorationKey||kn,a=new Set,o=e=>{let t=Dn[e]||={};for(let e of a)e===document?t[Mn]={scrollX,scrollY}:e.isConnected&&(t[An(e)]={scrollX:e.scrollLeft,scrollY:e.scrollTop})};n&&!r.restoration&&(r.restoration=!0,jn=!1,history.scrollRestoration=`manual`,document.addEventListener(`scroll`,e=>{jn||a.add(e.target)},!0),e.subscribe(`onBeforeLoad`,e=>{e.fromLocation&&o(i(e.fromLocation)),a.clear()}),addEventListener(`pagehide`,()=>{o(i(e.stores.resolvedLocation.get()??e.stores.location.get())),En()})),!r.reset&&(r.reset=!0,e.subscribe(`onRendered`,t=>{let n=e.options.scrollRestorationBehavior,o=e.options.scrollToTopSelectors,s=r.next,c=r.hash,l;if(a.clear(),r.next=!0,r.hash=!1,typeof e.options.scrollRestoration==`function`&&!e.options.scrollRestoration({location:e.latestLocation}))return;let u=i(t.toLocation),d=t.fromLocation&&i(t.fromLocation);if(r.restoring&&d&&d!==u){let e=Dn[d];if(e){let t=Dn[u];for(let n in e){if(n===Mn){if(s)continue}else{let e=Nn(n);if(!e||s&&o&&(l??=Pn(o),l.has(e)))continue}t||=Dn[u]={},t[n]??=e[n]}}}jn=!0;try{let e=t.toLocation.hash,i=t.toLocation.state.__hashScrollIntoViewOptions??!0,a=!1;if(s){!e&&o&&(l??=Pn(o));let t=e&&i&&c,s=r.restoring?Dn[u]:void 0;if(s)for(let e in s){let{scrollX:r,scrollY:i}=s[e];if(e===Mn){if(t)continue;scrollTo({top:i,left:r,behavior:n}),a=!0}else{let t=Nn(e);t&&(t.scrollLeft=r,t.scrollTop=i,l?.delete(t))}}if(!e){let e={top:0,left:0,behavior:n};if(a||scrollTo(e),l)for(let t of l)t.scrollTo(e)}}!a&&e&&i&&document.getElementById(e)?.scrollIntoView(i)}finally{jn=!1}}))}function In(e,t=String){let n=new URLSearchParams;for(let r in e){let i=e[r];i!==void 0&&n.set(r,t(i))}return n.toString()}function Ln(e){return e?e===`false`?!1:e===`true`?!0:e*0==0&&+e+``===e?+e:e:``}function Rn(e){let t=new URLSearchParams(e),n=Object.create(null);for(let[e,r]of t.entries()){let t=n[e];t==null?n[e]=Ln(r):Array.isArray(t)?t.push(Ln(r)):n[e]=[t,Ln(r)]}return n}var zn=Vn(JSON.parse),Bn=Hn(JSON.stringify,JSON.parse);function Vn(e){return t=>{t[0]===`?`&&(t=t.substring(1));let n=Rn(t);for(let t in n){let r=n[t];if(typeof r==`string`)try{n[t]=e(r)}catch{}}return n}}function Hn(e,t){let n=typeof t==`function`;function r(r){if(typeof r==`object`&&r)try{return e(r)}catch{}else if(n&&typeof r==`string`)try{return t(r),e(r)}catch{}return r}return e=>{let t=In(e,r);return t?`?${t}`:``}}var Un=`__root__`;function Wn(e){if(e.statusCode=e.statusCode||e.code||307,!e._builtLocation&&!e.reloadDocument&&typeof e.href==`string`)try{new URL(e.href),e.reloadDocument=!0}catch{}let t=new Headers(e.headers);e.href&&t.get(`Location`)===null&&t.set(`Location`,e.href);let n=new Response(null,{status:e.statusCode,headers:t});if(n.options=e,e.throw)throw n;return n}function Gn(e){return e instanceof Response&&!!e.options}function Kn(e){return{input:({url:t})=>{for(let n of e)t=Jn(n,t);return t},output:({url:t})=>{for(let n=e.length-1;n>=0;n--)t=Yn(e[n],t);return t}}}function qn(e){let t=pn(e.basepath),n=`/${t}`,r=e.caseSensitive?n:n.toLowerCase(),i=`${r}/`;return{input:({url:t})=>{let a=e.caseSensitive?t.pathname:t.pathname.toLowerCase();return a===r?t.pathname=`/`:a.startsWith(i)&&(t.pathname=t.pathname.slice(n.length)),t},output:({url:e})=>(e.pathname=ln([`/`,t,e.pathname]),e)}}function Jn(e,t){let n=e?.input?.({url:t});if(n){if(typeof n==`string`)return new URL(n);if(n instanceof URL)return n}return t}function Yn(e,t){let n=e?.output?.({url:t});if(n){if(typeof n==`string`)return new URL(n);if(n instanceof URL)return n}return t}function Xn(e,t){let{createMutableStore:n,createReadonlyStore:r,batch:i,init:a}=t,o=new Map,s=new Map,c=new Map,l=n(e.status),u=n(e.loadedAt),d=n(e.isLoading),f=n(e.isTransitioning),p=n(e.location),m=n(e.resolvedLocation),h=n(e.statusCode),g=n(e.redirect),_=n([]),v=n([]),y=n([]),b=r(()=>Zn(o,_.get())),x=r(()=>Zn(s,v.get())),S=r(()=>Zn(c,y.get())),C=r(()=>_.get()[0]),w=r(()=>_.get().some(e=>o.get(e)?.get().status===`pending`)),T=r(()=>({locationHref:p.get().href,resolvedLocationHref:m.get()?.href,status:l.get()})),E=r(()=>({status:l.get(),loadedAt:u.get(),isLoading:d.get(),isTransitioning:f.get(),matches:b.get(),location:p.get(),resolvedLocation:m.get(),statusCode:h.get(),redirect:g.get()})),D=Lt(64);function O(e){let t=D.get(e);return t||(t=r(()=>{let t=_.get();for(let n of t){let t=o.get(n);if(t&&t.routeId===e)return t.get()}}),D.set(e,t)),t}let k={status:l,loadedAt:u,isLoading:d,isTransitioning:f,location:p,resolvedLocation:m,statusCode:h,redirect:g,matchesId:_,pendingIds:v,cachedIds:y,matches:b,pendingMatches:x,cachedMatches:S,firstId:C,hasPending:w,matchRouteDeps:T,matchStores:o,pendingMatchStores:s,cachedMatchStores:c,__store:E,getRouteMatchStore:O,setMatches:ee,setPending:te,setCached:A};ee(e.matches),a?.(k);function ee(e){Qn(e,o,_,n,i)}function te(e){Qn(e,s,v,n,i)}function A(e){Qn(e,c,y,n,i)}return k}function Zn(e,t){let n=[];for(let r of t){let t=e.get(r);t&&n.push(t.get())}return n}function Qn(e,t,n,r,i){let a=e.map(e=>e.id),o=new Set(a);i(()=>{for(let e of t.keys())o.has(e)||t.delete(e);for(let n of e){let e=t.get(n.id);if(!e){let e=r(n);e.routeId=n.routeId,t.set(n.id,e);continue}e.routeId=n.routeId,e.get()!==n&&e.set(n)}Ft(n.get(),a)||n.set(a)})}var $n=e=>{if(!e.rendered)return e.rendered=!0,e.onReady?.()},er=e=>e.stores.matchesId.get().some(t=>e.stores.matchStores.get(t)?.get()._forcePending),tr=(e,t)=>!!(e.preload&&!e.router.stores.matchStores.has(t)),nr=(e,t,n=!0)=>{let r={...e.router.options.context??{}},i=n?t:t-1;for(let t=0;t<=i;t++){let n=e.matches[t];if(!n)continue;let i=e.router.getMatch(n.id);i&&Object.assign(r,i.__routeContext,i.__beforeLoadContext)}return r},rr=(e,t)=>{if(!e.matches.length)return;let n=t.routeId,r=e.matches.findIndex(t=>t.routeId===e.router.routeTree.id),i=r>=0?r:0,a=n?e.matches.findIndex(e=>e.routeId===n):e.firstBadMatchIndex??e.matches.length-1;a<0&&(a=i);for(let t=a;t>=0;t--){let n=e.matches[t];if(e.router.looseRoutesById[n.routeId].options.notFoundComponent)return t}return n?a:i},ir=(e,t,n)=>{if(!(!Gn(n)&&!xn(n)))throw Gn(n)&&n.redirectHandled&&!n.options.reloadDocument?n:(t&&(t._nonReactive.beforeLoadPromise?.resolve(),t._nonReactive.loaderPromise?.resolve(),t._nonReactive.beforeLoadPromise=void 0,t._nonReactive.loaderPromise=void 0,t._nonReactive.error=n,e.updateMatch(t.id,r=>({...r,status:Gn(n)?`redirected`:xn(n)?`notFound`:r.status===`pending`?`success`:r.status,context:nr(e,t.index),isFetching:!1,error:n})),xn(n)&&!n.routeId&&(n.routeId=t.routeId),t._nonReactive.loadPromise?.resolve()),Gn(n)&&(e.rendered=!0,n.options._fromLocation=e.location,n.redirectHandled=!0,n=e.router.resolveRedirect(n)),n)},ar=(e,t)=>{let n=e.router.getMatch(t);return!!(!n||n._nonReactive.dehydrated)},or=(e,t,n)=>{let r=nr(e,n);e.updateMatch(t,e=>({...e,context:r}))},sr=(e,t,n)=>{let{id:r,routeId:i}=e.matches[t],a=e.router.looseRoutesById[i];if(n instanceof Promise)throw n;e.firstBadMatchIndex??=t,ir(e,e.router.getMatch(r),n);try{a.options.onError?.(n)}catch(t){n=t,ir(e,e.router.getMatch(r),n)}e.updateMatch(r,e=>(e._nonReactive.beforeLoadPromise?.resolve(),e._nonReactive.beforeLoadPromise=void 0,e._nonReactive.loadPromise?.resolve(),{...e,error:n,status:`error`,isFetching:!1,updatedAt:Date.now(),abortController:new AbortController})),!e.preload&&!Gn(n)&&!xn(n)&&(e.serialError??=n)},cr=(e,t,n,r)=>{if(r._nonReactive.pendingTimeout!==void 0)return;let i=n.options.pendingMs??e.router.options.defaultPendingMs;if(e.onReady&&!tr(e,t)&&(n.options.loader||n.options.beforeLoad||yr(n))&&typeof i==`number`&&i!==1/0&&(n.options.pendingComponent??e.router.options?.defaultPendingComponent)){let t=setTimeout(()=>{$n(e)},i);r._nonReactive.pendingTimeout=t}},lr=(e,t,n)=>{let r=e.router.getMatch(t);if(!r._nonReactive.beforeLoadPromise&&!r._nonReactive.loaderPromise)return;cr(e,t,n,r);let i=()=>{let n=e.router.getMatch(t);n.preload&&(n.status===`redirected`||n.status===`notFound`)&&ir(e,n,n.error)};return r._nonReactive.beforeLoadPromise?r._nonReactive.beforeLoadPromise.then(i):i()},ur=(e,t,n,r)=>{let i=e.router.getMatch(t),a=i._nonReactive.loadPromise;i._nonReactive.loadPromise=Et(()=>{a?.resolve(),a=void 0});let{paramsError:o,searchError:s}=i;o&&sr(e,n,o),s&&sr(e,n,s),cr(e,t,r,i);let c=new AbortController,l=!1,u=()=>{l||(l=!0,e.updateMatch(t,e=>({...e,isFetching:`beforeLoad`,fetchCount:e.fetchCount+1,abortController:c})))},d=()=>{i._nonReactive.beforeLoadPromise?.resolve(),i._nonReactive.beforeLoadPromise=void 0,e.updateMatch(t,e=>({...e,isFetching:!1}))};if(!r.options.beforeLoad){e.router.batch(()=>{u(),d()});return}i._nonReactive.beforeLoadPromise=Et();let f={...nr(e,n,!1),...i.__routeContext},{search:p,params:m,cause:h}=i,g=tr(e,t),_={search:p,abortController:c,params:m,preload:g,context:f,location:e.location,navigate:t=>e.router.navigate({...t,_fromLocation:e.location}),buildLocation:e.router.buildLocation,cause:g?`preload`:h,matches:e.matches,routeId:r.id,...e.router.options.additionalContext},v=r=>{if(r===void 0){e.router.batch(()=>{u(),d()});return}(Gn(r)||xn(r))&&(u(),sr(e,n,r)),e.router.batch(()=>{u(),e.updateMatch(t,e=>({...e,__beforeLoadContext:r})),d()})},y;try{if(y=r.options.beforeLoad(_),Dt(y))return u(),y.catch(t=>{sr(e,n,t)}).then(v)}catch(t){u(),sr(e,n,t)}v(y)},dr=(e,t)=>{let{id:n,routeId:r}=e.matches[t],i=e.router.looseRoutesById[r],a=()=>s(),o=()=>ur(e,n,t,i),s=()=>{if(ar(e,n))return;let t=lr(e,n,i);return Dt(t)?t.then(o):o()};return a()},fr=(e,t,n)=>{let r=e.router.getMatch(t);if(!r||!n.options.head&&!n.options.scripts&&!n.options.headers)return;let i={ssr:e.router.options.ssr,matches:e.matches,match:r,params:r.params,loaderData:r.loaderData};return Promise.all([n.options.head?.(i),n.options.scripts?.(i),n.options.headers?.(i)]).then(([e,t,n])=>({meta:e?.meta,links:e?.links,headScripts:e?.scripts,headers:n,scripts:t,styles:e?.styles}))},pr=(e,t,n,r,i)=>{let a=t[r-1],{params:o,loaderDeps:s,abortController:c,cause:l}=e.router.getMatch(n),u=nr(e,r),d=tr(e,n);return{params:o,deps:s,preload:!!d,parentMatchPromise:a,abortController:c,context:u,location:e.location,navigate:t=>e.router.navigate({...t,_fromLocation:e.location}),cause:d?`preload`:l,route:i,...e.router.options.additionalContext}},mr=async(e,t,n,r,i)=>{try{let a=e.router.getMatch(n);try{vr(i);let o=i.options.loader,s=typeof o==`function`?o:o?.handler,c=s?.(pr(e,t,n,r,i)),l=!!s&&Dt(c);if((l||i._lazyPromise||i._componentsPromise||i.options.head||i.options.scripts||i.options.headers||a._nonReactive.minPendingPromise)&&e.updateMatch(n,e=>({...e,isFetching:`loader`})),s){let t=l?await c:c;ir(e,e.router.getMatch(n),t),t!==void 0&&e.updateMatch(n,e=>({...e,loaderData:t}))}i._lazyPromise&&await i._lazyPromise;let u=a._nonReactive.minPendingPromise;u&&await u,i._componentsPromise&&await i._componentsPromise,e.updateMatch(n,t=>({...t,error:void 0,context:nr(e,r),status:`success`,isFetching:!1,updatedAt:Date.now()}))}catch(t){let o=t;if(o?.name===`AbortError`){if(a.abortController.signal.aborted){a._nonReactive.loaderPromise?.resolve(),a._nonReactive.loaderPromise=void 0;return}e.updateMatch(n,t=>({...t,status:t.status===`pending`?`success`:t.status,isFetching:!1,context:nr(e,r)}));return}let s=a._nonReactive.minPendingPromise;s&&await s,xn(t)&&await i.options.notFoundComponent?.preload?.(),ir(e,e.router.getMatch(n),t);try{i.options.onError?.(t)}catch(t){o=t,ir(e,e.router.getMatch(n),t)}!Gn(o)&&!xn(o)&&await vr(i,[`errorComponent`]),e.updateMatch(n,t=>({...t,error:o,context:nr(e,r),status:`error`,isFetching:!1}))}}catch(t){let r=e.router.getMatch(n);r&&(r._nonReactive.loaderPromise=void 0),ir(e,r,t)}},hr=async(e,t,n)=>{async function r(r,a,c,l,d){let f=Date.now()-a.updatedAt,p=r?d.options.preloadStaleTime??e.router.options.defaultPreloadStaleTime??3e4:d.options.staleTime??e.router.options.defaultStaleTime??0,m=d.options.shouldReload,h=typeof m==`function`?m(pr(e,t,i,n,d)):m,{status:g,invalid:_}=l,v=f>=p&&(!!e.forceStaleReload||l.cause===`enter`||c!==void 0&&c!==l.id);o=g===`success`&&(_||(h??v)),r&&d.options.preload===!1||(o&&!e.sync&&u?(s=!0,(async()=>{try{await mr(e,t,i,n,d);let r=e.router.getMatch(i);r._nonReactive.loaderPromise?.resolve(),r._nonReactive.loadPromise?.resolve(),r._nonReactive.loaderPromise=void 0,r._nonReactive.loadPromise=void 0}catch(t){Gn(t)&&await e.router.navigate(t.options)}})()):g!==`success`||o?await mr(e,t,i,n,d):or(e,i,n))}let{id:i,routeId:a}=e.matches[n],o=!1,s=!1,c=e.router.looseRoutesById[a],l=c.options.loader,u=((typeof l==`function`?void 0:l?.staleReloadMode)??e.router.options.defaultStaleReloadMode)!==`blocking`;if(ar(e,i)){if(!e.router.getMatch(i))return e.matches[n];or(e,i,n)}else{let t=e.router.getMatch(i),o=e.router.stores.matchesId.get()[n],s=(o&&e.router.stores.matchStores.get(o)||null)?.routeId===a?o:e.router.stores.matches.get().find(e=>e.routeId===a)?.id,l=tr(e,i);if(t._nonReactive.loaderPromise){if(t.status===`success`&&!e.sync&&!t.preload&&u)return t;await t._nonReactive.loaderPromise;let n=e.router.getMatch(i),a=n._nonReactive.error||n.error;a&&ir(e,n,a),n.status===`pending`&&await r(l,t,s,n,c)}else{let n=l&&!e.router.stores.matchStores.has(i),a=e.router.getMatch(i);a._nonReactive.loaderPromise=Et(),n!==a.preload&&e.updateMatch(i,e=>({...e,preload:n})),await r(l,t,s,a,c)}}let d=e.router.getMatch(i);s||(d._nonReactive.loaderPromise?.resolve(),d._nonReactive.loadPromise?.resolve(),d._nonReactive.loadPromise=void 0),clearTimeout(d._nonReactive.pendingTimeout),d._nonReactive.pendingTimeout=void 0,s||(d._nonReactive.loaderPromise=void 0),d._nonReactive.dehydrated=void 0;let f=s?d.isFetching:!1;return f!==d.isFetching||d.invalid!==!1?(e.updateMatch(i,e=>({...e,isFetching:f,invalid:!1})),e.router.getMatch(i)):d};async function gr(e){let t=e,n=[];er(t.router)&&$n(t);let r;for(let e=0;e<t.matches.length;e++){try{let n=dr(t,e);Dt(n)&&await n}catch(e){if(Gn(e))throw e;if(xn(e))r=e;else if(!t.preload)throw e;break}if(t.serialError||t.firstBadMatchIndex!=null)break}let i=t.firstBadMatchIndex??t.matches.length,a=r&&!t.preload?rr(t,r):void 0,o=r&&t.preload?0:a===void 0?i:Math.min(a+1,i),s,c;for(let e=0;e<o;e++)n.push(hr(t,n,e));try{await Promise.all(n)}catch{let e=await Promise.allSettled(n);for(let t of e){if(t.status!==`rejected`)continue;let e=t.reason;if(Gn(e))throw e;xn(e)?s??=e:c??=e}if(c!==void 0)throw c}let l=s??(r&&!t.preload?r:void 0),u=t.firstBadMatchIndex===void 0?t.matches.length-1:t.firstBadMatchIndex;if(!l&&r&&t.preload)return t.matches;if(l){let e=rr(t,l);e===void 0&&It();let n=t.matches[e],r=t.router.looseRoutesById[n.routeId],i=t.router.options?.defaultNotFoundComponent;!r.options.notFoundComponent&&i&&(r.options.notFoundComponent=i),l.routeId=n.routeId;let a=n.routeId===t.router.routeTree.id;t.updateMatch(n.id,e=>({...e,...a?{status:`success`,globalNotFound:!0,error:void 0}:{status:`notFound`,error:l},isFetching:!1})),u=e,await vr(r,[`notFoundComponent`])}else if(!t.preload){let e=t.matches[0];e.globalNotFound||t.router.getMatch(e.id)?.globalNotFound&&t.updateMatch(e.id,e=>({...e,globalNotFound:!1,error:void 0}))}if(t.serialError&&t.firstBadMatchIndex!==void 0){let e=t.router.looseRoutesById[t.matches[t.firstBadMatchIndex].routeId];await vr(e,[`errorComponent`])}for(let e=0;e<=u;e++){let{id:n,routeId:r}=t.matches[e],i=t.router.looseRoutesById[r];try{let e=fr(t,n,i);if(e){let r=await e;t.updateMatch(n,e=>({...e,...r}))}}catch(e){console.error(`Error executing head for route ${r}:`,e)}}let d=$n(t);if(Dt(d)&&await d,l)throw l;if(t.serialError&&!t.preload&&!t.onReady)throw t.serialError;return t.matches}function _r(e,t){let n=t.map(t=>e.options[t]?.preload?.()).filter(Boolean);if(n.length!==0)return Promise.all(n)}function vr(e,t=br){!e._lazyLoaded&&e._lazyPromise===void 0&&(e.lazyFn?e._lazyPromise=e.lazyFn().then(t=>{let{id:n,...r}=t.options;Object.assign(e.options,r),e._lazyLoaded=!0,e._lazyPromise=void 0}):e._lazyLoaded=!0);let n=()=>e._componentsLoaded?void 0:t===br?(()=>{if(e._componentsPromise===void 0){let t=_r(e,br);t?e._componentsPromise=t.then(()=>{e._componentsLoaded=!0,e._componentsPromise=void 0}):e._componentsLoaded=!0}return e._componentsPromise})():_r(e,t);return e._lazyPromise?e._lazyPromise.then(n):n()}function yr(e){for(let t of br)if(e.options[t]?.preload)return!0;return!1}var br=[`component`,`errorComponent`,`pendingComponent`,`notFoundComponent`],xr=`__TSR_index`,Sr=`popstate`,Cr=`beforeunload`;function wr(e){let t=e.getLocation(),n=new Set,r=r=>{t=e.getLocation(),n.forEach(e=>e({location:t,action:r}))},i=n=>{e.notifyOnIndexChange??!0?r(n):t=e.getLocation()},a=async({task:n,navigateOpts:r,...i})=>{if(r?.ignoreBlocker??!1){n();return}let a=e.getBlockers?.()??[],o=i.type===`PUSH`||i.type===`REPLACE`;if(typeof document<`u`&&a.length&&o)for(let n of a){let r=Or(i.path,i.state);if(await n.blockerFn({currentLocation:t,nextLocation:r,action:i.type})){e.onBlocked?.();return}}n()};return{get location(){return t},get length(){return e.getLength()},subscribers:n,subscribe:e=>(n.add(e),()=>{n.delete(e)}),push:(n,i,o)=>{let s=t.state[xr];i=Tr(s+1,i),a({task:()=>{e.pushState(n,i),r({type:`PUSH`})},navigateOpts:o,type:`PUSH`,path:n,state:i})},replace:(n,i,o)=>{let s=t.state[xr];i=Tr(s,i),a({task:()=>{e.replaceState(n,i),r({type:`REPLACE`})},navigateOpts:o,type:`REPLACE`,path:n,state:i})},go:(t,n)=>{a({task:()=>{e.go(t),i({type:`GO`,index:t})},navigateOpts:n,type:`GO`})},back:t=>{a({task:()=>{e.back(t?.ignoreBlocker??!1),i({type:`BACK`})},navigateOpts:t,type:`BACK`})},forward:t=>{a({task:()=>{e.forward(t?.ignoreBlocker??!1),i({type:`FORWARD`})},navigateOpts:t,type:`FORWARD`})},canGoBack:()=>t.state[xr]!==0,createHref:t=>e.createHref(t),block:t=>{if(!e.setBlockers)return()=>{};let n=e.getBlockers?.()??[];return e.setBlockers([...n,t]),()=>{let n=e.getBlockers?.()??[];e.setBlockers?.(n.filter(e=>e!==t))}},flush:()=>e.flush?.(),destroy:()=>e.destroy?.(),notify:r}}function Tr(e,t){t||={};let n=kr();return{...t,key:n,__TSR_key:n,[xr]:e}}function Er(e){let t=e?.window??(typeof document<`u`?window:void 0),n=t.history.pushState,r=t.history.replaceState,i=[],a=()=>i,o=e=>i=e,s=e?.createHref??(e=>e),c=e?.parseLocation??(()=>Or(`${t.location.pathname}${t.location.search}${t.location.hash}`,t.history.state));if(!t.history.state?.__TSR_key&&!t.history.state?.key){let e=kr();t.history.replaceState({[xr]:0,key:e,__TSR_key:e},``)}let l=c(),u,d=!1,f=!1,p=!1,m=!1,h=()=>l,g,_,v=()=>{g&&(C._ignoreSubscribers=!0,(g.isPush?t.history.pushState:t.history.replaceState)(g.state,``,g.href),C._ignoreSubscribers=!1,g=void 0,_=void 0,u=void 0)},y=(e,t,n)=>{let r=s(t);_||(u=l),l=Or(t,n),g={href:r,state:n,isPush:g?.isPush||e===`push`},_||=Promise.resolve().then(()=>v())},b=e=>{l=c(),C.notify({type:e})},x=async()=>{if(f){f=!1;return}let e=c(),n=e.state[xr]-l.state[xr],r=n===1,i=n===-1,o=!r&&!i||d;d=!1;let s=o?`GO`:i?`BACK`:`FORWARD`,u=o?{type:`GO`,index:n}:{type:i?`BACK`:`FORWARD`};if(p)p=!1;else{let n=a();if(typeof document<`u`&&n.length){for(let r of n)if(await r.blockerFn({currentLocation:l,nextLocation:e,action:s})){f=!0,t.history.go(1),C.notify(u);return}}}l=c(),C.notify(u)},S=e=>{if(m){m=!1;return}let t=!1,n=a();if(typeof document<`u`&&n.length)for(let e of n){let n=e.enableBeforeUnload??!0;if(n===!0){t=!0;break}if(typeof n==`function`&&n()===!0){t=!0;break}}if(t)return e.preventDefault(),e.returnValue=``},C=wr({getLocation:h,getLength:()=>t.history.length,pushState:(e,t)=>y(`push`,e,t),replaceState:(e,t)=>y(`replace`,e,t),back:e=>(e&&(p=!0),m=!0,t.history.back()),forward:e=>{e&&(p=!0),m=!0,t.history.forward()},go:e=>{d=!0,t.history.go(e)},createHref:e=>s(e),flush:v,destroy:()=>{t.history.pushState=n,t.history.replaceState=r,t.removeEventListener(Cr,S,{capture:!0}),t.removeEventListener(Sr,x)},onBlocked:()=>{u&&l!==u&&(l=u)},getBlockers:a,setBlockers:o,notifyOnIndexChange:!1});return t.addEventListener(Cr,S,{capture:!0}),t.addEventListener(Sr,x),t.history.pushState=function(...e){let r=n.apply(t.history,e);return C._ignoreSubscribers||b(`PUSH`),r},t.history.replaceState=function(...e){let n=r.apply(t.history,e);return C._ignoreSubscribers||b(`REPLACE`),n},C}function Dr(e){let t=e.replace(/[\x00-\x1f\x7f]/g,``);return t.startsWith(`//`)&&(t=`/`+t.replace(/^\/+/,``)),t}function Or(e,t){let n=Dr(e),r=n.indexOf(`#`),i=n.indexOf(`?`),a=kr();return{href:n,pathname:n.substring(0,r>0?i>0?Math.min(r,i):r:i>0?i:n.length),hash:r>-1?n.substring(r):``,search:i>-1?n.slice(i,r===-1?void 0:r):``,state:t||{[xr]:0,key:a,__TSR_key:a}}}function kr(){return(Math.random()+1).toString(36).substring(7)}function Ar(e,t){let n=t,r=e;return{fromLocation:n,toLocation:r,pathChanged:n?.pathname!==r.pathname,hrefChanged:n?.href!==r.href,hashChanged:n?.hash!==r.hash}}var jr=class{constructor(e,t){this.tempLocationKey=`${Math.round(Math.random()*1e7)}`,this._scroll={next:!0},this.shouldViewTransition=void 0,this.isViewTransitionTypesSupported=void 0,this.subscribers=new Set,this.routeBranchCache=new WeakMap,this.lightweightCache=new WeakMap,this.startTransition=e=>e(),this.update=e=>{let t=this.options,n=this.basepath??t?.basepath??`/`,r=this.basepath===void 0,i=t?.rewrite;if(this.options={...t,...e},this.isServer=this.options.isServer??typeof document>`u`,this.protocolAllowlist=new Set(this.options.protocolAllowlist),this.options.pathParamsAllowedCharacters&&(this.pathParamsDecoder=_n(this.options.pathParamsAllowedCharacters)),(!this.history||this.options.history&&this.options.history!==this.history)&&(this.options.history?this.history=this.options.history:this.history=Er()),this.origin=this.options.origin,this.origin||(window?.origin&&window.origin!==`null`?this.origin=window.origin:this.origin=`http://localhost`),this.history&&this.updateLatestLocation(),this.options.routeTree!==this.routeTree){this.routeTree=this.options.routeTree;let e;this.resolvePathCache=Lt(1e3),e=this.buildRouteTree(),this.setRoutes(e)}if(!this.stores&&this.latestLocation){let e=this.getStoreConfig(this);this.batch=e.batch,this.stores=Xn(Pr(this.latestLocation),e),Fn(this)}let a=!1,o=this.options.basepath??`/`,s=this.options.rewrite;if(r||n!==o||i!==s){this.basepath=o;let e=[],t=pn(o);t&&t!==`/`&&e.push(qn({basepath:o})),s&&e.push(s),this.rewrite=e.length===0?void 0:e.length===1?e[0]:Kn(e),this.history&&this.updateLatestLocation(),a=!0}a&&this.stores&&this.stores.location.set(this.latestLocation),typeof window<`u`&&`CSS`in window&&typeof window.CSS?.supports==`function`&&(this.isViewTransitionTypesSupported=window.CSS.supports(`selector(:active-view-transition-type(a))`))},this.updateLatestLocation=()=>{this.latestLocation=this.parseLocation(this.history.location,this.latestLocation)},this.buildRouteTree=()=>{let e=Qt(this.routeTree,this.options.caseSensitive,(e,t)=>{e.init({originalIndex:t})});return this.options.routeMasks&&qt(this.options.routeMasks,e.processedTree),e},this.subscribe=(e,t)=>{let n={eventType:e,fn:t};return this.subscribers.add(n),()=>{this.subscribers.delete(n)}},this.emit=e=>{this.subscribers.forEach(t=>{t.eventType===e.type&&t.fn(e)})},this.parseLocation=(e,t)=>{let n=({pathname:e,search:n,hash:r,href:i,state:a})=>{if(!this.rewrite&&!/[ \x00-\x1f\x7f\u0080-\uffff]/.test(e)){let i=this.options.parseSearch(n),o=this.options.stringifySearch(i);return{href:e+o+r,publicHref:e+o+r,pathname:Nt(e).path,external:!1,searchStr:o,search:yt(t?.search,i),hash:Nt(r.slice(1)).path,state:bt(t?.state,a)}}let o=new URL(i,this.origin),s=Jn(this.rewrite,o),c=this.options.parseSearch(s.search),l=this.options.stringifySearch(c);return s.search=l,{href:s.href.replace(s.origin,``),publicHref:i,pathname:Nt(s.pathname).path,external:!!this.rewrite&&s.origin!==this.origin,searchStr:l,search:yt(t?.search,c),hash:Nt(s.hash.slice(1)).path,state:bt(t?.state,a)}},r=n(e),{__tempLocation:i,__tempKey:a}=r.state;if(i&&(!a||a===this.tempLocationKey)){let e=n(i);return e.state.key=r.state.key,e.state.__TSR_key=r.state.__TSR_key,delete e.state.__tempLocation,{...e,maskedLocation:r}}return r},this.resolvePathWithBase=(e,t)=>gn({base:e,to:t.includes(`//`)?un(t):t,trailingSlash:this.options.trailingSlash,cache:this.resolvePathCache}),this.matchRoutes=(e,t,n)=>typeof e==`string`?this.matchRoutesInternal({pathname:e,search:t},n):this.matchRoutesInternal(e,t),this.getMatchedRoutes=e=>Ir({pathname:e,routesById:this.routesById,processedTree:this.processedTree}),this.cancelMatch=e=>{let t=this.getMatch(e);t&&(t.abortController.abort(),clearTimeout(t._nonReactive.pendingTimeout),t._nonReactive.pendingTimeout=void 0)},this.cancelMatches=()=>{this.stores.pendingIds.get().forEach(e=>{this.cancelMatch(e)}),this.stores.matchesId.get().forEach(e=>{if(this.stores.pendingMatchStores.has(e))return;let t=this.stores.matchStores.get(e)?.get();t&&(t.status===`pending`||t.isFetching===`loader`)&&this.cancelMatch(e)})},this.buildLocation=e=>{let t=(t={})=>{let n=t._fromLocation||this.pendingBuiltLocation||this.latestLocation,r=this.matchRoutesLightweight(n);t.from;let i=t.unsafeRelative===`path`?n.pathname:t.from??r.fullPath,a=t.to?`${t.to}`:void 0,o=r.search,s=Object.assign(Object.create(null),r.params),c=a?.charCodeAt(0)===47?`/`:this.resolvePathWithBase(i,`.`),l=a?this.resolvePathWithBase(c,a):c,u=t.params===!1||t.params===null?Object.create(null):(t.params??!0)===!0?s:Object.assign(s,mt(t.params,s)),d=this.routesByPath[fn(l)],f;if(d)f=this.getRouteBranch(d);else if(l.includes(`$`))f=[];else{let e=this.getMatchedRoutes(l);f=e.matchedRoutes,this.options.notFoundRoute&&(!e.foundRoute||e.foundRoute.path!==`/`&&e.routeParams[`**`])&&(f=[...f,this.options.notFoundRoute])}if(f.length&&_t(u))for(let e of f){let t=e.options.params?.stringify??e.options.stringifyParams;if(t)try{Object.assign(u,t(u))}catch{}}let p=e.leaveParams?l:Nt(yn({path:l,params:u,decoder:this.pathParamsDecoder,server:this.isServer}).interpolatedPath).path,m=o;if(e._includeValidateSearch&&this.options.search?.strict){let e={};f.forEach(t=>{if(t.options.validateSearch)try{Object.assign(e,Fr(t.options.validateSearch,{...e,...m}))}catch{}}),m=e}m=Lr({search:m,dest:t,destRoutes:f,_includeValidateSearch:e._includeValidateSearch}),m=yt(o,m);let h=this.options.stringifySearch(m),g=t.hash===!0?n.hash:t.hash?mt(t.hash,n.hash):void 0,_=g?`#${g}`:``,v=t.state===!0?n.state:t.state?mt(t.state,n.state):{};v=bt(n.state,v);let y=`${p}${h}${_}`,b,x,S=!1;if(this.rewrite){let e=new URL(y,this.origin),t=Yn(this.rewrite,e);b=e.href.replace(e.origin,``),t.origin===this.origin?x=t.pathname+t.search+t.hash:(x=t.href,S=!0)}else b=Pt(y),x=b;return{publicHref:x,href:b,pathname:p,search:m,searchStr:h,state:v,hash:g??``,external:S,unmaskOnReload:t.unmaskOnReload}},n=(n={},r)=>{let i=t(n),a=r?t(r):void 0;if(!a){let n=Object.create(null);if(this.options.routeMasks){let o=Jt(i.pathname,this.processedTree);if(o){Object.assign(n,o.rawParams);let{from:i,params:s,...c}=o.route,l=s===!1||s===null?Object.create(null):(s??!0)===!0?n:Object.assign(n,mt(s,n));r={from:e.from,...c,params:l},a=t(r)}}}return a&&(i.maskedLocation=a),i};return e.mask?n(e,{from:e.from,...e.mask}):n(e)},this.commitLocation=async({viewTransition:e,ignoreBlocker:t,...n})=>{let r,i=()=>{let e=[`key`,`__TSR_key`,`__TSR_index`,`__hashScrollIntoViewOptions`];e.forEach(e=>{n.state[e]=this.latestLocation.state[e]});let t=Tt(n.state,this.latestLocation.state);return e.forEach(e=>{delete n.state[e]}),t},a=fn(this.latestLocation.href)===fn(n.href),o=this.commitLocationPromise;if(this.commitLocationPromise=Et(()=>{o?.resolve(),o=void 0}),a&&i())this.load();else{let{maskedLocation:i,hashScrollIntoView:a,...o}=n;i&&(o={...i,state:{...i.state,__tempKey:void 0,__tempLocation:{...o,search:o.searchStr,state:{...o.state,__tempKey:void 0,__tempLocation:void 0,__TSR_key:void 0,key:void 0}}}},(o.unmaskOnReload??this.options.unmaskOnReload??!1)&&(o.state.__tempKey=this.tempLocationKey)),o.state.__hashScrollIntoViewOptions=a??this.options.defaultHashScrollIntoView??!0,this.shouldViewTransition=e,r=n.replace?`REPLACE`:`PUSH`,this.history[r===`REPLACE`?`replace`:`push`](o.publicHref,o.state,{ignoreBlocker:t})}return this._scroll.next=n.resetScroll??!0,this.history.subscribers.size||this.load(r?{action:{type:r}}:void 0),this.commitLocationPromise},this.buildAndCommitLocation=({replace:e,resetScroll:t,hashScrollIntoView:n,viewTransition:r,ignoreBlocker:i,href:a,...o}={})=>{if(a){let t=this.history.location.state.__TSR_index,n=Or(a,{__TSR_index:e?t:t+1}),r=new URL(n.pathname,this.origin);o.to=Jn(this.rewrite,r).pathname,o.search=this.options.parseSearch(n.search),o.hash=n.hash.slice(1)}let s=this.buildLocation({...o,_includeValidateSearch:!0});this.pendingBuiltLocation=s;let c=this.commitLocation({...s,viewTransition:r,replace:e,resetScroll:t,hashScrollIntoView:n,ignoreBlocker:i});return queueMicrotask(()=>{this.pendingBuiltLocation===s&&(this.pendingBuiltLocation=void 0)}),c},this.navigate=async({to:e,reloadDocument:t,href:n,publicHref:r,...i})=>{let a=!1;if(n)try{new URL(`${n}`),a=!0}catch{}if(a&&!t&&(t=!0),t){if(e!==void 0||!n){let t=this.buildLocation({to:e,...i});n??=t.publicHref,r??=t.publicHref}let t=!a&&r?r:n;if(Mt(t,this.protocolAllowlist))return;if(!i.ignoreBlocker){let e=this.history.getBlockers?.()??[];for(let t of e)if(t?.blockerFn&&await t.blockerFn({currentLocation:this.latestLocation,nextLocation:this.latestLocation,action:`PUSH`}))return}i.replace?window.location.replace(t):window.location.href=t;return}return this.buildAndCommitLocation({...i,href:n,to:e,_isNavigate:!0})},this.beforeLoad=()=>{this.cancelMatches(),this.updateLatestLocation();let e=this.matchRoutes(this.latestLocation),t=this.stores.cachedMatches.get().filter(t=>!e.some(e=>e.id===t.id));this.batch(()=>{this.stores.status.set(`pending`),this.stores.statusCode.set(200),this.stores.isLoading.set(!0),this.stores.location.set(this.latestLocation),this.stores.setPending(e),this.stores.setCached(t)})},this.load=async e=>{let t=e?.action?.type,n,r,i,a=this.stores.resolvedLocation.get()??this.stores.location.get();for(i=new Promise(o=>{this.startTransition(async()=>{try{this.beforeLoad(),t&&(this._scroll.hash=t===`PUSH`||t===`REPLACE`);let n=this.latestLocation,r=Ar(n,this.stores.resolvedLocation.get());this.stores.redirect.get()||this.emit({type:`onBeforeNavigate`,...r}),this.emit({type:`onBeforeLoad`,...r}),await gr({router:this,sync:e?.sync,forceStaleReload:a.href===n.href,matches:this.stores.pendingMatches.get(),location:n,updateMatch:this.updateMatch,onReady:async()=>{this.startTransition(()=>{this.startViewTransition(async()=>{let e=null,t=null,n=null,r=null;this.batch(()=>{let i=this.stores.pendingMatches.get(),a=i.length,o=this.stores.matches.get();e=a?o.filter(e=>!this.stores.pendingMatchStores.has(e.id)):null;let s=new Set;for(let e of this.stores.pendingMatchStores.values())e.routeId&&s.add(e.routeId);let c=new Set;for(let e of this.stores.matchStores.values())e.routeId&&c.add(e.routeId);t=a?o.filter(e=>!s.has(e.routeId)):null,n=a?i.filter(e=>!c.has(e.routeId)):null,r=a?i.filter(e=>c.has(e.routeId)):o,this.stores.isLoading.set(!1),this.stores.loadedAt.set(Date.now()),a&&(this.stores.setMatches(i),this.stores.setPending([]),this.stores.setCached([...this.stores.cachedMatches.get(),...e.filter(e=>e.status!==`error`&&e.status!==`notFound`&&e.status!==`redirected`)]),this.clearExpiredCache())});for(let[e,i]of[[t,`onLeave`],[n,`onEnter`],[r,`onStay`]])if(e)for(let t of e)this.looseRoutesById[t.routeId].options[i]?.(t)})})}})}catch(e){Gn(e)?(n=e,this.navigate({...n.options,replace:!0,ignoreBlocker:!0})):xn(e)&&(r=e);let t=n?n.status:r?404:this.stores.matches.get().some(e=>e.status===`error`)?500:200;this.batch(()=>{this.stores.statusCode.set(t),this.stores.redirect.set(n)})}this.latestLoadPromise===i&&(this.commitLocationPromise?.resolve(),this.latestLoadPromise=void 0,this.commitLocationPromise=void 0),o()})}),this.latestLoadPromise=i,await i;this.latestLoadPromise&&i!==this.latestLoadPromise;)await this.latestLoadPromise;let o;this.hasNotFoundMatch()?o=404:this.stores.matches.get().some(e=>e.status===`error`)&&(o=500),o!==void 0&&this.stores.statusCode.set(o)},this.startViewTransition=e=>{let t=this.shouldViewTransition??this.options.defaultViewTransition;if(this.shouldViewTransition=void 0,t&&typeof document<`u`&&`startViewTransition`in document&&typeof document.startViewTransition==`function`){let n;if(typeof t==`object`&&this.isViewTransitionTypesSupported){let r=this.latestLocation,i=this.stores.resolvedLocation.get(),a=typeof t.types==`function`?t.types(Ar(r,i)):t.types;if(a===!1){e();return}n={update:e,types:a}}else n=e;document.startViewTransition(n)}else e()},this.updateMatch=(e,t)=>{this.startTransition(()=>{let n=this.stores.pendingMatchStores.get(e);if(n){n.set(t);return}let r=this.stores.matchStores.get(e);if(r){r.set(t);return}let i=this.stores.cachedMatchStores.get(e);if(i){let n=t(i.get());n.status===`redirected`?this.stores.cachedMatchStores.delete(e)&&this.stores.cachedIds.set(t=>t.filter(t=>t!==e)):i.set(n)}})},this.getMatch=e=>this.stores.cachedMatchStores.get(e)?.get()??this.stores.pendingMatchStores.get(e)?.get()??this.stores.matchStores.get(e)?.get(),this.invalidate=e=>{let t=t=>e?.filter?.(t)??!0?{...t,invalid:!0,...e?.forcePending||t.status===`error`||t.status===`notFound`?{status:`pending`,error:void 0}:void 0}:t;return this.batch(()=>{this.stores.setMatches(this.stores.matches.get().map(t)),this.stores.setCached(this.stores.cachedMatches.get().map(t)),this.stores.setPending(this.stores.pendingMatches.get().map(t))}),this.shouldViewTransition=!1,this.load({sync:e?.sync})},this.getParsedLocationHref=e=>e.publicHref||`/`,this.resolveRedirect=e=>{let t=e.headers.get(`Location`);if(!e.options.href||e.options._builtLocation){let t=e.options._builtLocation??this.buildLocation(e.options),n=this.getParsedLocationHref(t);e.options.href=n,e.headers.set(`Location`,n)}else if(t)try{let n=new URL(t);if(this.origin&&n.origin===this.origin){let t=n.pathname+n.search+n.hash;e.options.href=t,e.headers.set(`Location`,t)}}catch{}if(e.options.href&&!e.options._builtLocation&&Mt(e.options.href,this.protocolAllowlist))throw Error(`Redirect blocked: unsafe protocol`);return e.headers.get(`Location`)||e.headers.set(`Location`,e.options.href),e},this.clearCache=e=>{let t=e?.filter;t===void 0?this.stores.setCached([]):this.stores.setCached(this.stores.cachedMatches.get().filter(e=>!t(e)))},this.clearExpiredCache=()=>{let e=Date.now();this.clearCache({filter:t=>{let n=this.looseRoutesById[t.routeId];if(!n.options.loader)return!0;let r=(t.preload?n.options.preloadGcTime??this.options.defaultPreloadGcTime:n.options.gcTime??this.options.defaultGcTime)??300*1e3;return t.status===`error`||e-t.updatedAt>=r}})},this.loadRouteChunk=vr,this.preloadRoute=async e=>{let t=e._builtLocation??this.buildLocation(e),n=this.matchRoutes(t,{throwOnError:!0,preload:!0,dest:e}),r=new Set([...this.stores.matchesId.get(),...this.stores.pendingIds.get()]),i=new Set([...r,...this.stores.cachedIds.get()]),a=n.filter(e=>!i.has(e.id));if(a.length){let e=this.stores.cachedMatches.get();this.stores.setCached([...e,...a])}try{return n=await gr({router:this,matches:n,location:t,preload:!0,updateMatch:(e,t)=>{r.has(e)?n=n.map(n=>n.id===e?t(n):n):this.updateMatch(e,t)}}),n}catch(e){if(Gn(e))return e.options.reloadDocument?void 0:await this.preloadRoute({...e.options,_fromLocation:t});xn(e)||console.error(e);return}},this.matchRoute=(e,t)=>{let n={...e,to:e.to?this.resolvePathWithBase(e.from||``,e.to):void 0,params:e.params||{},leaveParams:!0},r=this.buildLocation(n);if(t?.pending&&this.stores.status.get()!==`pending`)return!1;let i=(t?.pending===void 0?!this.stores.isLoading.get():t.pending)?this.latestLocation:this.stores.resolvedLocation.get()||this.stores.location.get(),a=Yt(r.pathname,t?.caseSensitive??!1,t?.fuzzy??!1,i.pathname,this.processedTree);return!a||e.params&&!Tt(a.rawParams,e.params,{partial:!0})?!1:t?.includeSearch??!0?Tt(i.search,r.search,{partial:!0})?a.rawParams:!1:a.rawParams},this.hasNotFoundMatch=()=>this.stores.matches.get().some(e=>e.status===`notFound`||e.globalNotFound),this.getStoreConfig=t,this.update({defaultPreloadDelay:50,defaultPendingMs:1e3,defaultPendingMinMs:500,context:void 0,...e,caseSensitive:e.caseSensitive??!1,notFoundMode:e.notFoundMode??`fuzzy`,stringifySearch:e.stringifySearch??Bn,parseSearch:e.parseSearch??zn,protocolAllowlist:e.protocolAllowlist??jt}),typeof document<`u`&&(self.__TSR_ROUTER__=this)}isShell(){return!!this.options.isShell}isPrerendering(){return!!this.options.isPrerendering}get state(){return this.stores.__store.get()}setRoutes({routesById:e,routesByPath:t,processedTree:n}){this.routesById=e,this.routesByPath=t,this.processedTree=n;let r=this.options.notFoundRoute;r&&(r.init({originalIndex:99999999999}),this.routesById[r.id]=r)}getRouteBranch(e){let t=this.routeBranchCache.get(e);return t||(t=tn(e),this.routeBranchCache.set(e,t)),t}get looseRoutesById(){return this.routesById}getParentContext(e){return e?.id?e.context??this.options.context??void 0:this.options.context??void 0}matchRoutesInternal(e,t){let n=this.getMatchedRoutes(e.pathname),{foundRoute:r,routeParams:i}=n,{matchedRoutes:a}=n,o=!1;(r?r.path!==`/`&&i[`**`]:fn(e.pathname))&&(this.options.notFoundRoute?a=[...a,this.options.notFoundRoute]:o=!0);let s=o?zr(this.options.notFoundMode,a):void 0,c=Array(a.length),l=new Map;for(let e of this.stores.matchStores.values())e.routeId&&l.set(e.routeId,e.get());for(let n=0;n<a.length;n++){let r=a[n],o=c[n-1],u,d,f;{let n=o?.search??e.search,i=o?._strictSearch??void 0;try{let e=Fr(r.options.validateSearch,{...n})??void 0;u={...n,...e},d={...i,...e},f=void 0}catch(e){let r=e;if(e instanceof Mr||(r=new Mr(e.message,{cause:e})),t?.throwOnError)throw r;u=n,d={},f=r}}let p=r.options.loaderDeps?.({search:u})??``,m=p?JSON.stringify(p):``,{interpolatedPath:h,usedParams:g}=yn({path:r.fullPath,params:i,decoder:this.pathParamsDecoder,server:this.isServer}),_=r.id+h+m,v=this.getMatch(_),y=l.get(r.id),b=v?._strictParams??g,x;if(!v)try{Br(r,b)}catch(e){if(x=xn(e)||Gn(e)?e:new Nr(e.message,{cause:e}),t?.throwOnError)throw x}Object.assign(i,b);let S=y?`stay`:`enter`,C;if(v)C={...v,cause:S,params:y?.params??i,_strictParams:b,search:yt(y?y.search:v.search,u),_strictSearch:d};else{let e=r.options.loader||r.options.beforeLoad||r.lazyFn||yr(r)?`pending`:`success`;C={id:_,ssr:r.options.ssr,index:n,routeId:r.id,params:y?.params??i,_strictParams:b,pathname:h,updatedAt:Date.now(),search:y?yt(y.search,u):u,_strictSearch:d,searchError:void 0,status:e,isFetching:!1,error:void 0,paramsError:x,__routeContext:void 0,_nonReactive:{loadPromise:Et()},__beforeLoadContext:void 0,context:{},abortController:new AbortController,fetchCount:0,cause:S,loaderDeps:y?bt(y.loaderDeps,p):p,invalid:!1,preload:!1,links:void 0,scripts:void 0,headScripts:void 0,meta:void 0,staticData:r.options.staticData||{},fullPath:r.fullPath}}t?.preload||(C.globalNotFound=s===r.id),C.searchError=f;let w=this.getParentContext(o);C.context={...w,...C.__routeContext,...C.__beforeLoadContext},c[n]=C}for(let t=0;t<c.length;t++){let n=c[t],r=this.looseRoutesById[n.routeId],a=this.getMatch(n.id),o=l.get(n.routeId);if(n.params=o?yt(o.params,i):i,!a){let i=c[t-1],a=this.getParentContext(i);if(r.options.context){let t={deps:n.loaderDeps,params:n.params,context:a??{},location:e,navigate:t=>this.navigate({...t,_fromLocation:e}),buildLocation:this.buildLocation,cause:n.cause,abortController:n.abortController,preload:!!n.preload,matches:c,routeId:r.id};n.__routeContext=r.options.context(t)??void 0}n.context={...a,...n.__routeContext,...n.__beforeLoadContext}}}return c}matchRoutesLightweight(e){let t=ft(this.stores.matchesId.get()),n=this.lightweightCache.get(e);if(n&&n[0]===t)return n[1];let{matchedRoutes:r,routeParams:i}=this.getMatchedRoutes(e.pathname),a=ft(r),o={...e.search};for(let e of r)try{Object.assign(o,Fr(e.options.validateSearch,o))}catch{}let s=t&&this.stores.matchStores.get(t)?.get(),c=s&&s.routeId===a.id&&s.pathname===e.pathname,l;if(c)l=s.params;else{let e=Object.assign(Object.create(null),i);for(let t of r)try{Br(t,e)}catch{}l=e}let u={matchedRoutes:r,fullPath:a.fullPath,search:o,params:l};return this.lightweightCache.set(e,[t,u]),u}},Mr=class extends Error{},Nr=class extends Error{};function Pr(e){return{loadedAt:0,isLoading:!1,isTransitioning:!1,status:`idle`,resolvedLocation:void 0,location:e,matches:[],statusCode:200}}function Fr(e,t){if(e==null)return{};if(`~standard`in e){let n=e[`~standard`].validate(t);if(n instanceof Promise)throw new Mr(`Async validation not supported`);if(n.issues)throw new Mr(JSON.stringify(n.issues,void 0,2),{cause:n});return n.value}return`parse`in e?e.parse(t):typeof e==`function`?e(t):{}}function Ir({pathname:e,routesById:t,processedTree:n}){let r=Object.create(null),i=fn(e),a,o=Xt(i,n,!0);return o&&(a=o.route,Object.assign(r,o.rawParams)),{matchedRoutes:o?.branch||[t.__root__],routeParams:r,foundRoute:a}}function Lr({search:e,dest:t,destRoutes:n,_includeValidateSearch:r}){return Rr(n)(e,t,r??!1)}function Rr(e){let t,n,r=[];for(let t of e){let e=t.options;`search`in e?e.search?.middlewares&&r.push(...e.search.middlewares):(e.preSearchFilters||e.postSearchFilters)&&r.push(({search:t,next:n})=>{let r=n(e.preSearchFilters?e.preSearchFilters.reduce((e,t)=>t(e),t):t);return e.postSearchFilters?e.postSearchFilters.reduce((e,t)=>t(e),r):r});let i=e.validateSearch;i&&r.push(({search:e,next:t,meta:r})=>{let a=t(e);if(n)try{let e=Fr(i,a);if(r&&e)for(let t in e)t in a||(r.defaulted||=new Map).set(t,e[t]);return{...a,...e}}catch{}return a})}let i=(e,n,a)=>{if(e>=r.length){if(!t.search)return{};if(t.search===!0)return n;let e=mt(t.search,n);return a&&(a.explicit=e),e}return r[e]({search:n,next:(t,n)=>{if(n){let n=a||{};return{search:i(e+1,t,n),meta:n}}return i(e+1,t,a)},meta:a})};return function(e,r,a){return t=r,n=a,i(0,e)}}function zr(e,t){if(e!==`root`)for(let e=t.length-1;e>=0;e--){let n=t[e];if(n.children)return n.id}return Un}function Br(e,t){let n=e.options.params?.parse??e.options.parseParams;if(n){let e=n(t);if(e===!1)throw Error(`Route params.parse returned false for a matched route`);Object.assign(t,e)}}var Vr=`Error preloading route! ☝️`,Hr=class{get to(){return this._to}get id(){return this._id}get path(){return this._path}get fullPath(){return this._fullPath}constructor(e){if(this.init=e=>{this.originalIndex=e.originalIndex;let t=this.options,n=!t?.path&&!t?.id;this.parentRoute=this.options.getParentRoute?.(),n?this._path=Un:this.parentRoute||It();let r=n?Un:t?.path;r&&r!==`/`&&(r=dn(r));let i=t?.id||r,a=n?Un:ln([this.parentRoute.id===`__root__`?``:this.parentRoute.id,i]);r===`__root__`&&(r=`/`),a!==`__root__`&&(a=ln([`/`,a]));let o=a===`__root__`?`/`:ln([this.parentRoute.fullPath,r]);this._path=r,this._id=a,this._fullPath=o,this._to=fn(o)},this.addChildren=e=>this._addFileChildren(e),this._addFileChildren=e=>(Array.isArray(e)&&(this.children=e),typeof e==`object`&&e&&(this.children=Object.values(e)),this),this._addFileTypes=()=>this,this.updateLoader=e=>(Object.assign(this.options,e),this),this.update=e=>(Object.assign(this.options,e),this),this.lazy=e=>(this.lazyFn=e,this),this.redirect=e=>Wn({from:this.fullPath,...e}),this.options=e||{},this.isRoot=!e?.getParentRoute,e?.id&&e?.path)throw Error(`Route cannot have both an 'id' and a 'path' option.`)}},Ur=class extends Hr{constructor(e){super(e)}};function Wr(e){let t=e.errorComponent??Kr;return(0,V.jsx)(Gr,{getResetKey:e.getResetKey,onCatch:e.onCatch,children:({error:n,reset:r})=>n?B.createElement(t,{error:n,reset:r}):e.children})}var Gr=class extends B.Component{constructor(...e){super(...e),this.state={error:null}}static getDerivedStateFromProps(e,t){let n=e.getResetKey();return t.error&&t.resetKey!==n?{resetKey:n,error:null}:{resetKey:n}}static getDerivedStateFromError(e){return{error:e}}reset(){this.setState({error:null})}componentDidCatch(e,t){this.props.onCatch&&this.props.onCatch(e,t)}render(){return this.props.children({error:this.state.error,reset:()=>{this.reset()}})}};function Kr({error:e}){let[t,n]=B.useState(!1);return(0,V.jsxs)(`div`,{style:{padding:`.5rem`,maxWidth:`100%`},children:[(0,V.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:`.5rem`},children:[(0,V.jsx)(`strong`,{style:{fontSize:`1rem`},children:`Something went wrong!`}),(0,V.jsx)(`button`,{style:{appearance:`none`,fontSize:`.6em`,border:`1px solid currentColor`,padding:`.1rem .2rem`,fontWeight:`bold`,borderRadius:`.25rem`},onClick:()=>n(e=>!e),children:t?`Hide Error`:`Show Error`})]}),(0,V.jsx)(`div`,{style:{height:`.25rem`}}),t?(0,V.jsx)(`div`,{children:(0,V.jsx)(`pre`,{style:{fontSize:`.7em`,border:`1px solid red`,borderRadius:`.25rem`,padding:`.3rem`,color:`red`,overflow:`auto`},children:e.message?(0,V.jsx)(`code`,{children:e.message}):null})}):null]})}function qr({children:e,fallback:t=null}){return Jr()?(0,V.jsx)(B.Fragment,{children:e}):(0,V.jsx)(B.Fragment,{children:t})}function Jr(){return B.useSyncExternalStore(Yr,()=>!0,()=>!1)}function Yr(){return()=>{}}var Xr=B.createContext(null);function Zr(e){return B.useContext(Xr)}var Qr=B.createContext(void 0),$r=B.createContext(void 0),ei=(e=>(e[e.None=0]=`None`,e[e.Mutable=1]=`Mutable`,e[e.Watching=2]=`Watching`,e[e.RecursedCheck=4]=`RecursedCheck`,e[e.Recursed=8]=`Recursed`,e[e.Dirty=16]=`Dirty`,e[e.Pending=32]=`Pending`,e))(ei||{});function ti({update:e,notify:t,unwatched:n}){return{link:r,unlink:i,propagate:a,checkDirty:o,shallowPropagate:s};function r(e,t,n){let r=t.depsTail;if(r!==void 0&&r.dep===e)return;let i=r===void 0?t.deps:r.nextDep;if(i!==void 0&&i.dep===e){i.version=n,t.depsTail=i;return}let a=e.subsTail;if(a!==void 0&&a.version===n&&a.sub===t)return;let o=t.depsTail=e.subsTail={version:n,dep:e,sub:t,prevDep:r,nextDep:i,prevSub:a,nextSub:void 0};i!==void 0&&(i.prevDep=o),r===void 0?t.deps=o:r.nextDep=o,a===void 0?e.subs=o:a.nextSub=o}function i(e,t=e.sub){let r=e.dep,i=e.prevDep,a=e.nextDep,o=e.nextSub,s=e.prevSub;return a===void 0?t.depsTail=i:a.prevDep=i,i===void 0?t.deps=a:i.nextDep=a,o===void 0?r.subsTail=s:o.prevSub=s,s===void 0?(r.subs=o)===void 0&&n(r):s.nextSub=o,a}function a(e){let n=e.nextSub,r;top:do{let i=e.sub,a=i.flags;if(a&60?a&12?a&4?!(a&48)&&c(e,i)?(i.flags=a|40,a&=1):a=0:i.flags=a&-9|32:a=0:i.flags=a|32,a&2&&t(i),a&1){let t=i.subs;if(t!==void 0){let i=(e=t).nextSub;i!==void 0&&(r={value:n,prev:r},n=i);continue}}if((e=n)!==void 0){n=e.nextSub;continue}for(;r!==void 0;)if(e=r.value,r=r.prev,e!==void 0){n=e.nextSub;continue top}break}while(!0)}function o(t,n){let r,i=0,a=!1;top:do{let o=t.dep,c=o.flags;if(n.flags&16)a=!0;else if((c&17)==17){if(e(o)){let e=o.subs;e.nextSub!==void 0&&s(e),a=!0}}else if((c&33)==33){(t.nextSub!==void 0||t.prevSub!==void 0)&&(r={value:t,prev:r}),t=o.deps,n=o,++i;continue}if(!a){let e=t.nextDep;if(e!==void 0){t=e;continue}}for(;i--;){let i=n.subs,o=i.nextSub!==void 0;if(o?(t=r.value,r=r.prev):t=i,a){if(e(n)){o&&s(i),n=t.sub;continue}a=!1}else n.flags&=-33;n=t.sub;let c=t.nextDep;if(c!==void 0){t=c;continue top}}return a}while(!0)}function s(e){do{let n=e.sub,r=n.flags;(r&48)==32&&(n.flags=r|16,(r&6)==2&&t(n))}while((e=e.nextSub)!==void 0)}function c(e,t){let n=t.depsTail;for(;n!==void 0;){if(n===e)return!0;n=n.prevDep}return!1}}function ni(e,t,n){let r=typeof e==`object`,i=r?e:void 0;return{next:(r?e.next:e)?.bind(i),error:(r?e.error:t)?.bind(i),complete:(r?e.complete:n)?.bind(i)}}var ri=[],ii=0,{link:ai,unlink:oi,propagate:si,checkDirty:ci,shallowPropagate:li}=ti({update(e){return e._update()},notify(e){ri[di++]=e,e.flags&=~ei.Watching},unwatched(e){e.depsTail!==void 0&&(e.depsTail=void 0,e.flags=ei.Mutable|ei.Dirty,hi(e))}}),ui=0,di=0,fi,pi=0;function mi(e){try{++pi,e()}finally{--pi||gi()}}function hi(e){let t=e.depsTail,n=t===void 0?e.deps:t.nextDep;for(;n!==void 0;)n=oi(n,e)}function gi(){if(!(pi>0)){for(;ui<di;){let e=ri[ui];ri[ui++]=void 0,e.notify()}ui=0,di=0}}function _i(e,t){let n=typeof e==`function`,r=e,i={_snapshot:n?void 0:e,subs:void 0,subsTail:void 0,deps:void 0,depsTail:void 0,flags:n?ei.None:ei.Mutable,get(){return fi!==void 0&&ai(i,fi,ii),i._snapshot},subscribe(e){let t=ni(e),n={current:!1},r=vi(()=>{i.get(),n.current?t.next?.(i._snapshot):n.current=!0});return{unsubscribe:()=>{r.stop()}}},_update(e){let a=fi,o=t?.compare??Object.is;if(n)fi=i,++ii,i.depsTail=void 0;else if(e===void 0)return!1;n&&(i.flags=ei.Mutable|ei.RecursedCheck);try{let t=i._snapshot,a=typeof e==`function`?e(t):e===void 0&&n?r(t):e;return t===void 0||!o(t,a)?(i._snapshot=a,!0):!1}finally{fi=a,n&&(i.flags&=~ei.RecursedCheck),hi(i)}}};return n?(i.flags=ei.Mutable|ei.Dirty,i.get=function(){let e=i.flags;if(e&ei.Dirty||e&ei.Pending&&ci(i.deps,i)){if(i._update()){let e=i.subs;e!==void 0&&li(e)}}else e&ei.Pending&&(i.flags=e&~ei.Pending);return fi!==void 0&&ai(i,fi,ii),i._snapshot}):i.set=function(e){if(i._update(e)){let e=i.subs;e!==void 0&&(si(e),li(e),gi())}},i}function vi(e){let t=()=>{let t=fi;fi=n,++ii,n.depsTail=void 0,n.flags=ei.Watching|ei.RecursedCheck;try{return e()}finally{fi=t,n.flags&=~ei.RecursedCheck,hi(n)}},n={deps:void 0,depsTail:void 0,subs:void 0,subsTail:void 0,flags:ei.Watching|ei.RecursedCheck,notify(){let e=this.flags;e&ei.Dirty||e&ei.Pending&&ci(this.deps,this)?t():this.flags=ei.Watching},stop(){this.flags=ei.None,this.depsTail=void 0,hi(this)}};return t(),n}var yi=o((e=>{var t=d();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 f=typeof window>`u`||window.document===void 0||window.document.createElement===void 0?u:c;e.useSyncExternalStore=t.useSyncExternalStore===void 0?f:t.useSyncExternalStore})),bi=o(((e,t)=>{t.exports=yi()})),xi=o((e=>{var t=d(),n=bi();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}})),Si=o(((e,t)=>{t.exports=xi()}))();function Ci(e,t){return e===t}function wi(e,t,n=Ci){let r=(0,B.useCallback)(t=>{if(!e)return()=>{};let{unsubscribe:n}=e.subscribe(t);return n},[e]),i=(0,B.useCallback)(()=>e?.get(),[e]);return(0,Si.useSyncExternalStoreWithSelector)(r,i,i,t,n)}var Ti={get(){},subscribe(){return{unsubscribe(){}}}};function Ei(e,t){let n=B.useRef();return r=>{let i=e?.select?e.select(r):r;return e?.structuralSharing??t.options.defaultStructuralSharing?n.current=bt(n.current,i):i}}function Di(e){let t=Zr(),n=B.useContext(e.from?$r:Qr),r=e.from?t.stores.getRouteMatchStore(e.from):t.stores.matchStores.get(n),i=Ei(e,t),a=wi(r??Ti,e=>e?i(e):Ti);if(a!==Ti)return a;(e.shouldThrow??!0)&&It()}function Oi(e){return Di({from:e.from,strict:e.strict,structuralSharing:e.structuralSharing,select:t=>e.select?e.select(t.loaderData):t.loaderData})}function ki(e){let{select:t,...n}=e;return Di({...n,select:e=>t?t(e.loaderDeps):e.loaderDeps})}function Ai(e){return Di({from:e.from,shouldThrow:e.shouldThrow,structuralSharing:e.structuralSharing,strict:e.strict,select:t=>{let n=e.strict===!1?t.params:t._strictParams;return e.select?e.select(n):n}})}function ji(e){return Di({from:e.from,strict:e.strict,shouldThrow:e.shouldThrow,structuralSharing:e.structuralSharing,select:t=>e.select?e.select(t.search):t.search})}function Mi(e){let t=Zr();return B.useCallback(n=>t.navigate({...n,from:n.from??e?.from}),[e?.from,t])}function Ni(e){return Di({...e,select:t=>e.select?e.select(t.context):t.context})}var Pi=l(h(),1);function Fi(e,t){let n=Zr(),r=dt(t),{activeProps:i,inactiveProps:a,activeOptions:o,to:s,preload:c,preloadDelay:l,preloadIntentProximity:u,hashScrollIntoView:d,replace:f,startTransition:p,resetScroll:m,viewTransition:h,children:g,target:_,disabled:v,style:y,className:b,onClick:x,onBlur:S,onFocus:C,onMouseEnter:w,onMouseLeave:T,onTouchStart:E,ignoreBlocker:D,params:O,search:k,hash:ee,state:te,mask:A,reloadDocument:j,unsafeRelative:M,from:N,_fromLocation:P,...F}=e,ne=Jr(),re=B.useMemo(()=>e,[n,e.from,e._fromLocation,e.hash,e.to,e.search,e.params,e.state,e.mask,e.unsafeRelative]),ie=wi(n.stores.location,e=>e,(e,t)=>e.href===t.href),I=B.useMemo(()=>{let e={_fromLocation:ie,...re};return n.buildLocation(e)},[n,ie,re]),L=I.maskedLocation?I.maskedLocation.publicHref:I.publicHref,R=I.maskedLocation?I.maskedLocation.external:I.external,ae=B.useMemo(()=>Wi(L,R,n.history,v),[v,R,L,n.history]),z=B.useMemo(()=>{if(ae?.external)return Mt(ae.href,n.protocolAllowlist)?void 0:ae.href;if(!Gi(s)&&!(typeof s!=`string`||s.indexOf(`:`)===-1))try{return new URL(s),Mt(s,n.protocolAllowlist)?void 0:s}catch{}},[s,ae,n.protocolAllowlist]),oe=B.useMemo(()=>{if(z)return!1;if(o?.exact){if(!hn(ie.pathname,I.pathname,n.basepath))return!1}else{let e=mn(ie.pathname,n.basepath),t=mn(I.pathname,n.basepath);if(!(e.startsWith(t)&&(e.length===t.length||e[t.length]===`/`)))return!1}return(o?.includeSearch??!0)&&!Tt(ie.search,I.search,{partial:!o?.exact,ignoreUndefined:!o?.explicitUndefined})?!1:!o?.includeHash||ne&&ie.hash===I.hash},[o?.exact,o?.explicitUndefined,o?.includeHash,o?.includeSearch,ie,z,ne,I.hash,I.pathname,I.search,n.basepath]),se=oe?mt(i,{})??Li:Ii,ce=oe?Ii:mt(a,{})??Ii,le=[b,se.className,ce.className].filter(Boolean).join(` `),ue=(y||se.style||ce.style)&&{...y,...se.style,...ce.style},[de,fe]=B.useState(!1),pe=B.useRef(!1),me=e.reloadDocument||z?!1:c??n.options.defaultPreload,he=l??n.options.defaultPreloadDelay??0,ge=B.useCallback(()=>{n.preloadRoute({...re,_builtLocation:I}).catch(e=>{console.warn(e),console.warn(Vr)})},[n,re,I]);ut(r,B.useCallback(e=>{e?.isIntersecting&&ge()},[ge]),Hi,{disabled:!!v||me!==`viewport`}),B.useEffect(()=>{pe.current||!v&&me===`render`&&(ge(),pe.current=!0)},[v,ge,me]);let _e=e=>{let t=e.currentTarget.getAttribute(`target`),r=_===void 0?t:_;if(!v&&!qi(e)&&!e.defaultPrevented&&(!r||r===`_self`)&&e.button===0){e.preventDefault(),(0,Pi.flushSync)(()=>{fe(!0)});let t=n.subscribe(`onResolved`,()=>{t(),fe(!1)});n.navigate({...re,replace:f,resetScroll:m,hashScrollIntoView:d,startTransition:p,viewTransition:h,ignoreBlocker:D})}};if(z)return{...F,ref:r,href:z,...g&&{children:g},..._&&{target:_},...v&&{disabled:v},...y&&{style:y},...b&&{className:b},...x&&{onClick:x},...S&&{onBlur:S},...C&&{onFocus:C},...w&&{onMouseEnter:w},...T&&{onMouseLeave:T},...E&&{onTouchStart:E}};let ve=e=>{if(v||me!==`intent`)return;if(!he){ge();return}let t=e.currentTarget;if(Vi.has(t))return;let n=setTimeout(()=>{Vi.delete(t),ge()},he);Vi.set(t,n)},ye=e=>{v||me!==`intent`||ge()},be=e=>{if(v||!me||!he)return;let t=e.currentTarget,n=Vi.get(t);n&&(clearTimeout(n),Vi.delete(t))};return{...F,...se,...ce,href:ae?.href,ref:r,onClick:Ui([x,_e]),onBlur:Ui([S,be]),onFocus:Ui([C,ve]),onMouseEnter:Ui([w,ve]),onMouseLeave:Ui([T,be]),onTouchStart:Ui([E,ye]),disabled:!!v,target:_,...ue&&{style:ue},...le&&{className:le},...v&&Ri,...oe&&zi,...ne&&de&&Bi}}var Ii={},Li={className:`active`},Ri={role:`link`,"aria-disabled":!0},zi={"data-status":`active`,"aria-current":`page`},Bi={"data-transitioning":`transitioning`},Vi=new WeakMap,Hi={rootMargin:`100px`},Ui=e=>t=>{for(let n of e)if(n){if(t.defaultPrevented)return;n(t)}};function Wi(e,t,n,r){if(!r)return t?{href:e,external:!0}:{href:n.createHref(e)||`/`,external:!1}}function Gi(e){if(typeof e!=`string`)return!1;let t=e.charCodeAt(0);return t===47?e.charCodeAt(1)!==47:t===46}var Ki=B.forwardRef((e,t)=>{let{_asChild:n,...r}=e,{type:i,...a}=Fi(r,t),o=typeof r.children==`function`?r.children({isActive:a[`data-status`]===`active`}):r.children;if(!n){let{disabled:e,...t}=a;return B.createElement(`a`,t,o)}return B.createElement(n,a,o)});function qi(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}var Ji=class extends Hr{constructor(e){super(e),this.useMatch=e=>Di({select:e?.select,from:this.id,structuralSharing:e?.structuralSharing}),this.useRouteContext=e=>Ni({...e,from:this.id}),this.useSearch=e=>ji({select:e?.select,structuralSharing:e?.structuralSharing,from:this.id}),this.useParams=e=>Ai({select:e?.select,structuralSharing:e?.structuralSharing,from:this.id}),this.useLoaderDeps=e=>ki({...e,from:this.id}),this.useLoaderData=e=>Oi({...e,from:this.id}),this.useNavigate=()=>Mi({from:this.fullPath}),this.Link=B.forwardRef((e,t)=>(0,V.jsx)(Ki,{ref:t,from:this.fullPath,...e}))}};function Yi(e){return new Ji(e)}var Xi=class extends Ur{constructor(e){super(e),this.useMatch=e=>Di({select:e?.select,from:this.id,structuralSharing:e?.structuralSharing}),this.useRouteContext=e=>Ni({...e,from:this.id}),this.useSearch=e=>ji({select:e?.select,structuralSharing:e?.structuralSharing,from:this.id}),this.useParams=e=>Ai({select:e?.select,structuralSharing:e?.structuralSharing,from:this.id}),this.useLoaderDeps=e=>ki({...e,from:this.id}),this.useLoaderData=e=>Oi({...e,from:this.id}),this.useNavigate=()=>Mi({from:this.fullPath}),this.Link=B.forwardRef((e,t)=>(0,V.jsx)(Ki,{ref:t,from:this.fullPath,...e}))}};function Zi(e){return new Xi(e)}function Qi(e){let t=Zr(),n=`not-found-${wi(t.stores.location,e=>e.pathname)}-${wi(t.stores.status,e=>e)}`;return(0,V.jsx)(Wr,{getResetKey:()=>n,onCatch:(t,n)=>{if(xn(t))e.onCatch?.(t,n);else throw t},errorComponent:({error:t})=>{if(xn(t))return e.fallback?.(t);throw t},children:e.children})}function $i(){return(0,V.jsx)(`p`,{children:`Not Found`})}function ea(e){return(0,V.jsx)(V.Fragment,{children:e.children})}function ta(e,t,n){return t.options.notFoundComponent?(0,V.jsx)(t.options.notFoundComponent,{...n}):e.options.defaultNotFoundComponent?(0,V.jsx)(e.options.defaultNotFoundComponent,{...n}):(0,V.jsx)($i,{})}var na=(e,t)=>e.routeId===t.routeId&&e._displayPending===t._displayPending,ra=(e,t)=>e[0]===t[0]&&e[1]===t[1],ia=B.memo(function({matchId:e}){let t=Zr(),n=t.stores.matchStores.get(e);n||It();let r=wi(t.stores.loadedAt,e=>e),i=wi(n,e=>e,na);return(0,V.jsx)(aa,{router:t,matchId:e,resetKey:r,matchState:B.useMemo(()=>{let e=i.routeId,n=t.routesById[e].parentRoute?.id;return{routeId:e,ssr:i.ssr,_displayPending:i._displayPending,parentRouteId:n}},[i._displayPending,i.routeId,i.ssr,t.routesById])})});function aa({router:e,matchId:t,resetKey:n,matchState:r}){let i=e.routesById[r.routeId],a=i.options.pendingComponent??e.options.defaultPendingComponent,o=a?(0,V.jsx)(a,{}):null,s=i.options.errorComponent??e.options.defaultErrorComponent,c=i.options.onCatch??e.options.defaultOnCatch,l=i.isRoot?i.options.notFoundComponent??e.options.notFoundRoute?.options.component:i.options.notFoundComponent,u=r.ssr===!1||r.ssr===`data-only`,d=(!i.isRoot||i.options.wrapInSuspense||u)&&(i.options.wrapInSuspense??a??(i.options.errorComponent?.preload||u))?B.Suspense:ea,f=s?Wr:ea,p=l?Qi:ea;return(0,V.jsxs)(i.isRoot?i.options.shellComponent??ea:ea,{children:[(0,V.jsx)(Qr.Provider,{value:t,children:(0,V.jsx)(d,{fallback:o,children:(0,V.jsx)(f,{getResetKey:()=>n,errorComponent:s||Kr,onCatch:(e,t)=>{if(xn(e))throw e.routeId??=r.routeId,e;c?.(e,t)},children:(0,V.jsx)(p,{fallback:e=>{if(e.routeId??=r.routeId,!l||e.routeId&&e.routeId!==r.routeId||!e.routeId&&!i.isRoot)throw e;return B.createElement(l,e)},children:u||r._displayPending?(0,V.jsx)(qr,{fallback:o,children:(0,V.jsx)(sa,{matchId:t})}):(0,V.jsx)(sa,{matchId:t})})})})}),r.parentRouteId===`__root__`?(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(oa,{}),(e.options.scrollRestoration,null)]}):null]})}function oa(){let e=Zr(),t=B.useRef();return ct(()=>{let n=e.stores.resolvedLocation.get(),r=t.current;n&&(!r||r.href!==n.href)&&e.emit({type:`onRendered`,...Ar(e.stores.location.get(),r??n)}),t.current=n},[wi(e.stores.resolvedLocation,e=>e?.state.__TSR_key),e]),null}var sa=B.memo(function({matchId:e}){let t=Zr(),n=(e,n)=>t.getMatch(e.id)?._nonReactive[n]??e._nonReactive[n],r=t.stores.matchStores.get(e);r||It();let i=wi(r,e=>e),a=i.routeId,o=t.routesById[a],s=B.useMemo(()=>{let e=(t.routesById[a].options.remountDeps??t.options.defaultRemountDeps)?.({routeId:a,loaderDeps:i.loaderDeps,params:i._strictParams,search:i._strictSearch});return e?JSON.stringify(e):void 0},[a,i.loaderDeps,i._strictParams,i._strictSearch,t.options.defaultRemountDeps,t.routesById]),c=B.useMemo(()=>{let e=o.options.component??t.options.defaultComponent;return e?(0,V.jsx)(e,{},s):(0,V.jsx)(ca,{})},[s,o.options.component,t.options.defaultComponent]);if(i._displayPending)throw n(i,`displayPendingPromise`);if(i._forcePending)throw n(i,`minPendingPromise`);if(i.status===`pending`){let e=o.options.pendingMinMs??t.options.defaultPendingMinMs;if(e){let n=t.getMatch(i.id);if(n&&!n._nonReactive.minPendingPromise){let t=Et();n._nonReactive.minPendingPromise=t,setTimeout(()=>{t.resolve(),n._nonReactive.minPendingPromise=void 0},e)}}throw n(i,`loadPromise`)}if(i.status===`notFound`)return xn(i.error)||It(),ta(t,o,i.error);if(i.status===`redirected`)throw Gn(i.error)||It(),n(i,`loadPromise`);if(i.status===`error`)throw i.error;return c}),ca=B.memo(function(){let e=Zr(),t=B.useContext(Qr),n,r=!1,i;{let a=t?e.stores.matchStores.get(t):void 0;[n,r]=wi(a,e=>[e?.routeId,e?.globalNotFound??!1],ra),i=wi(e.stores.matchesId,e=>e[e.findIndex(e=>e===t)+1])}let a=n?e.routesById[n]:void 0,o=e.options.defaultPendingComponent?(0,V.jsx)(e.options.defaultPendingComponent,{}):null;if(r)return a||It(),ta(e,a,void 0);if(!i)return null;let s=(0,V.jsx)(ia,{matchId:i});return n===`__root__`?(0,V.jsx)(B.Suspense,{fallback:o,children:s}):s});function la(){let e=Zr(),t=B.useRef({router:e,mounted:!1}),[n,r]=B.useState(!1),i=wi(e.stores.isLoading,e=>e),a=wi(e.stores.hasPending,e=>e),o=lt(i),s=i||n||a,c=lt(s),l=i||a,u=lt(l);return e.startTransition=e=>{r(!0),B.startTransition(()=>{e(),r(!1)})},B.useEffect(()=>{let t=e.history.subscribe(e.load),n=e.buildLocation({to:e.latestLocation.pathname,search:!0,params:!0,hash:!0,state:!0,_includeValidateSearch:!0});return fn(e.latestLocation.publicHref)!==fn(n.publicHref)&&e.commitLocation({...n,replace:!0}),()=>{t()}},[e,e.history]),ct(()=>{typeof window<`u`&&e.ssr||t.current.router===e&&t.current.mounted||(t.current={router:e,mounted:!0},(async()=>{try{await e.load()}catch(e){console.error(e)}})())},[e]),ct(()=>{o&&!i&&e.emit({type:`onLoad`,...Ar(e.stores.location.get(),e.stores.resolvedLocation.get())})},[o,e,i]),ct(()=>{u&&!l&&e.emit({type:`onBeforeRouteMount`,...Ar(e.stores.location.get(),e.stores.resolvedLocation.get())})},[l,u,e]),ct(()=>{if(c&&!s){let t=Ar(e.stores.location.get(),e.stores.resolvedLocation.get());e.emit({type:`onResolved`,...t}),mi(()=>{e.stores.status.set(`idle`),e.stores.resolvedLocation.set(e.stores.location.get())})}},[s,c,e]),null}function ua(){let e=Zr(),t=e.routesById.__root__.options.pendingComponent??e.options.defaultPendingComponent,n=t?(0,V.jsx)(t,{}):null,r=(0,V.jsxs)(typeof document<`u`&&e.ssr?ea:B.Suspense,{fallback:n,children:[(0,V.jsx)(la,{}),(0,V.jsx)(da,{})]});return e.options.InnerWrap?(0,V.jsx)(e.options.InnerWrap,{children:r}):r}function da(){let e=Zr(),t=wi(e.stores.firstId,e=>e),n=wi(e.stores.loadedAt,e=>e),r=t?(0,V.jsx)(ia,{matchId:t}):null;return(0,V.jsx)(Qr.Provider,{value:t,children:e.options.disableGlobalCatchBoundary?r:(0,V.jsx)(Wr,{getResetKey:()=>n,errorComponent:Kr,onCatch:void 0,children:r})})}var fa=e=>({createMutableStore:_i,createReadonlyStore:_i,batch:mi}),pa=e=>new ma(e),ma=class extends jr{constructor(e){super(e,fa)}};function ha({router:e,children:t,...n}){_t(n)&&e.update({...e.options,...n,context:{...e.options.context,...n.context}});let r=(0,V.jsx)(Xr.Provider,{value:e,children:t});return e.options.Wrap?(0,V.jsx)(e.options.Wrap,{children:r}):r}function ga({router:e,...t}){return(0,V.jsx)(ha,{router:e,...t,children:(0,V.jsx)(ua,{})})}function _a(e){let t=Zr();return wi(t.stores.location,Ei(e,t))}var va=_();function ya(e){if(!e||typeof document>`u`)return;let t=document.head||document.getElementsByTagName(`head`)[0],n=document.createElement(`style`);n.type=`text/css`,t.appendChild(n),n.styleSheet?n.styleSheet.cssText=e:n.appendChild(document.createTextNode(e))}var ba=e=>{switch(e){case`success`:return Ca;case`info`:return Ta;case`warning`:return wa;case`error`:return Ea;default:return null}},xa=Array(12).fill(0),Sa=({visible:e,className:t})=>B.createElement(`div`,{className:[`sonner-loading-wrapper`,t].filter(Boolean).join(` `),"data-visible":e},B.createElement(`div`,{className:`sonner-spinner`},xa.map((e,t)=>B.createElement(`div`,{className:`sonner-loading-bar`,key:`spinner-bar-${t}`})))),Ca=B.createElement(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 20 20`,fill:`currentColor`,height:`20`,width:`20`},B.createElement(`path`,{fillRule:`evenodd`,d:`M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z`,clipRule:`evenodd`})),wa=B.createElement(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 24 24`,fill:`currentColor`,height:`20`,width:`20`},B.createElement(`path`,{fillRule:`evenodd`,d:`M9.401 3.003c1.155-2 4.043-2 5.197 0l7.355 12.748c1.154 2-.29 4.5-2.599 4.5H4.645c-2.309 0-3.752-2.5-2.598-4.5L9.4 3.003zM12 8.25a.75.75 0 01.75.75v3.75a.75.75 0 01-1.5 0V9a.75.75 0 01.75-.75zm0 8.25a.75.75 0 100-1.5.75.75 0 000 1.5z`,clipRule:`evenodd`})),Ta=B.createElement(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 20 20`,fill:`currentColor`,height:`20`,width:`20`},B.createElement(`path`,{fillRule:`evenodd`,d:`M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a.75.75 0 000 1.5h.253a.25.25 0 01.244.304l-.459 2.066A1.75 1.75 0 0010.747 15H11a.75.75 0 000-1.5h-.253a.25.25 0 01-.244-.304l.459-2.066A1.75 1.75 0 009.253 9H9z`,clipRule:`evenodd`})),Ea=B.createElement(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 20 20`,fill:`currentColor`,height:`20`,width:`20`},B.createElement(`path`,{fillRule:`evenodd`,d:`M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z`,clipRule:`evenodd`})),Da=B.createElement(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:`12`,height:`12`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.5`,strokeLinecap:`round`,strokeLinejoin:`round`},B.createElement(`line`,{x1:`18`,y1:`6`,x2:`6`,y2:`18`}),B.createElement(`line`,{x1:`6`,y1:`6`,x2:`18`,y2:`18`})),Oa=()=>{let[e,t]=B.useState(document.hidden);return B.useEffect(()=>{let e=()=>{t(document.hidden)};return document.addEventListener(`visibilitychange`,e),()=>window.removeEventListener(`visibilitychange`,e)},[]),e},ka=1,Aa=new class{constructor(){this.subscribe=e=>(this.subscribers.push(e),()=>{let t=this.subscribers.indexOf(e);this.subscribers.splice(t,1)}),this.publish=e=>{this.subscribers.forEach(t=>t(e))},this.addToast=e=>{this.publish(e),this.toasts=[...this.toasts,e]},this.create=e=>{let{message:t,...n}=e,r=typeof e?.id==`number`||e.id?.length>0?e.id:ka++,i=this.toasts.find(e=>e.id===r),a=e.dismissible===void 0||e.dismissible;return this.dismissedToasts.has(r)&&this.dismissedToasts.delete(r),i?this.toasts=this.toasts.map(n=>n.id===r?(this.publish({...n,...e,id:r,title:t}),{...n,...e,id:r,dismissible:a,title:t}):n):this.addToast({title:t,...n,dismissible:a,id:r}),r},this.dismiss=e=>(e?(this.dismissedToasts.add(e),requestAnimationFrame(()=>this.subscribers.forEach(t=>t({id:e,dismiss:!0})))):this.toasts.forEach(e=>{this.subscribers.forEach(t=>t({id:e.id,dismiss:!0}))}),e),this.message=(e,t)=>this.create({...t,message:e}),this.error=(e,t)=>this.create({...t,message:e,type:`error`}),this.success=(e,t)=>this.create({...t,type:`success`,message:e}),this.info=(e,t)=>this.create({...t,type:`info`,message:e}),this.warning=(e,t)=>this.create({...t,type:`warning`,message:e}),this.loading=(e,t)=>this.create({...t,type:`loading`,message:e}),this.promise=(e,t)=>{if(!t)return;let n;t.loading!==void 0&&(n=this.create({...t,promise:e,type:`loading`,message:t.loading,description:typeof t.description==`function`?void 0:t.description}));let r=Promise.resolve(e instanceof Function?e():e),i=n!==void 0,a,o=r.then(async e=>{if(a=[`resolve`,e],B.isValidElement(e))i=!1,this.create({id:n,type:`default`,message:e});else if(Ma(e)&&!e.ok){i=!1;let r=typeof t.error==`function`?await t.error(`HTTP error! status: ${e.status}`):t.error,a=typeof t.description==`function`?await t.description(`HTTP error! status: ${e.status}`):t.description,o=typeof r==`object`&&!B.isValidElement(r)?r:{message:r};this.create({id:n,type:`error`,description:a,...o})}else if(e instanceof Error){i=!1;let r=typeof t.error==`function`?await t.error(e):t.error,a=typeof t.description==`function`?await t.description(e):t.description,o=typeof r==`object`&&!B.isValidElement(r)?r:{message:r};this.create({id:n,type:`error`,description:a,...o})}else if(t.success!==void 0){i=!1;let r=typeof t.success==`function`?await t.success(e):t.success,a=typeof t.description==`function`?await t.description(e):t.description,o=typeof r==`object`&&!B.isValidElement(r)?r:{message:r};this.create({id:n,type:`success`,description:a,...o})}}).catch(async e=>{if(a=[`reject`,e],t.error!==void 0){i=!1;let r=typeof t.error==`function`?await t.error(e):t.error,a=typeof t.description==`function`?await t.description(e):t.description,o=typeof r==`object`&&!B.isValidElement(r)?r:{message:r};this.create({id:n,type:`error`,description:a,...o})}}).finally(()=>{i&&(this.dismiss(n),n=void 0),t.finally==null||t.finally.call(t)}),s=()=>new Promise((e,t)=>o.then(()=>a[0]===`reject`?t(a[1]):e(a[1])).catch(t));return typeof n!=`string`&&typeof n!=`number`?{unwrap:s}:Object.assign(n,{unwrap:s})},this.custom=(e,t)=>{let n=t?.id||ka++;return this.create({jsx:e(n),id:n,...t}),n},this.getActiveToasts=()=>this.toasts.filter(e=>!this.dismissedToasts.has(e.id)),this.subscribers=[],this.toasts=[],this.dismissedToasts=new Set}},ja=(e,t)=>{let n=t?.id||ka++;return Aa.addToast({title:e,...t,id:n}),n},Ma=e=>e&&typeof e==`object`&&`ok`in e&&typeof e.ok==`boolean`&&`status`in e&&typeof e.status==`number`,Na=Object.assign(ja,{success:Aa.success,info:Aa.info,warning:Aa.warning,error:Aa.error,custom:Aa.custom,message:Aa.message,promise:Aa.promise,dismiss:Aa.dismiss,loading:Aa.loading},{getHistory:()=>Aa.toasts,getToasts:()=>Aa.getActiveToasts()});ya(`[data-sonner-toaster][dir=ltr],html[dir=ltr]{--toast-icon-margin-start:-3px;--toast-icon-margin-end:4px;--toast-svg-margin-start:-1px;--toast-svg-margin-end:0px;--toast-button-margin-start:auto;--toast-button-margin-end:0;--toast-close-button-start:0;--toast-close-button-end:unset;--toast-close-button-transform:translate(-35%, -35%)}[data-sonner-toaster][dir=rtl],html[dir=rtl]{--toast-icon-margin-start:4px;--toast-icon-margin-end:-3px;--toast-svg-margin-start:0px;--toast-svg-margin-end:-1px;--toast-button-margin-start:0;--toast-button-margin-end:auto;--toast-close-button-start:unset;--toast-close-button-end:0;--toast-close-button-transform:translate(35%, -35%)}[data-sonner-toaster]{position:fixed;width:var(--width);font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;--gray1:hsl(0, 0%, 99%);--gray2:hsl(0, 0%, 97.3%);--gray3:hsl(0, 0%, 95.1%);--gray4:hsl(0, 0%, 93%);--gray5:hsl(0, 0%, 90.9%);--gray6:hsl(0, 0%, 88.7%);--gray7:hsl(0, 0%, 85.8%);--gray8:hsl(0, 0%, 78%);--gray9:hsl(0, 0%, 56.1%);--gray10:hsl(0, 0%, 52.3%);--gray11:hsl(0, 0%, 43.5%);--gray12:hsl(0, 0%, 9%);--border-radius:8px;box-sizing:border-box;padding:0;margin:0;list-style:none;outline:0;z-index:999999999;transition:transform .4s ease}@media (hover:none) and (pointer:coarse){[data-sonner-toaster][data-lifted=true]{transform:none}}[data-sonner-toaster][data-x-position=right]{right:var(--offset-right)}[data-sonner-toaster][data-x-position=left]{left:var(--offset-left)}[data-sonner-toaster][data-x-position=center]{left:50%;transform:translateX(-50%)}[data-sonner-toaster][data-y-position=top]{top:var(--offset-top)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--offset-bottom)}[data-sonner-toast]{--y:translateY(100%);--lift-amount:calc(var(--lift) * var(--gap));z-index:var(--z-index);position:absolute;opacity:0;transform:var(--y);touch-action:none;transition:transform .4s,opacity .4s,height .4s,box-shadow .2s;box-sizing:border-box;outline:0;overflow-wrap:anywhere}[data-sonner-toast][data-styled=true]{padding:16px;background:var(--normal-bg);border:1px solid var(--normal-border);color:var(--normal-text);border-radius:var(--border-radius);box-shadow:0 4px 12px rgba(0,0,0,.1);width:var(--width);font-size:13px;display:flex;align-items:center;gap:6px}[data-sonner-toast]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-y-position=top]{top:0;--y:translateY(-100%);--lift:1;--lift-amount:calc(1 * var(--gap))}[data-sonner-toast][data-y-position=bottom]{bottom:0;--y:translateY(100%);--lift:-1;--lift-amount:calc(var(--lift) * var(--gap))}[data-sonner-toast][data-styled=true] [data-description]{font-weight:400;line-height:1.4;color:#3f3f3f}[data-rich-colors=true][data-sonner-toast][data-styled=true] [data-description]{color:inherit}[data-sonner-toaster][data-sonner-theme=dark] [data-description]{color:#e8e8e8}[data-sonner-toast][data-styled=true] [data-title]{font-weight:500;line-height:1.5;color:inherit}[data-sonner-toast][data-styled=true] [data-icon]{display:flex;height:16px;width:16px;position:relative;justify-content:flex-start;align-items:center;flex-shrink:0;margin-left:var(--toast-icon-margin-start);margin-right:var(--toast-icon-margin-end)}[data-sonner-toast][data-promise=true] [data-icon]>svg{opacity:0;transform:scale(.8);transform-origin:center;animation:sonner-fade-in .3s ease forwards}[data-sonner-toast][data-styled=true] [data-icon]>*{flex-shrink:0}[data-sonner-toast][data-styled=true] [data-icon] svg{margin-left:var(--toast-svg-margin-start);margin-right:var(--toast-svg-margin-end)}[data-sonner-toast][data-styled=true] [data-content]{display:flex;flex-direction:column;gap:2px}[data-sonner-toast][data-styled=true] [data-button]{border-radius:4px;padding-left:8px;padding-right:8px;height:24px;font-size:12px;color:var(--normal-bg);background:var(--normal-text);margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end);border:none;font-weight:500;cursor:pointer;outline:0;display:flex;align-items:center;flex-shrink:0;transition:opacity .4s,box-shadow .2s}[data-sonner-toast][data-styled=true] [data-button]:focus-visible{box-shadow:0 0 0 2px rgba(0,0,0,.4)}[data-sonner-toast][data-styled=true] [data-button]:first-of-type{margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end)}[data-sonner-toast][data-styled=true] [data-cancel]{color:var(--normal-text);background:rgba(0,0,0,.08)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-styled=true] [data-cancel]{background:rgba(255,255,255,.3)}[data-sonner-toast][data-styled=true] [data-close-button]{position:absolute;left:var(--toast-close-button-start);right:var(--toast-close-button-end);top:0;height:20px;width:20px;display:flex;justify-content:center;align-items:center;padding:0;color:var(--gray12);background:var(--normal-bg);border:1px solid var(--gray4);transform:var(--toast-close-button-transform);border-radius:50%;cursor:pointer;z-index:1;transition:opacity .1s,background .2s,border-color .2s}[data-sonner-toast][data-styled=true] [data-close-button]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-styled=true] [data-disabled=true]{cursor:not-allowed}[data-sonner-toast][data-styled=true]:hover [data-close-button]:hover{background:var(--gray2);border-color:var(--gray5)}[data-sonner-toast][data-swiping=true]::before{content:'';position:absolute;left:-100%;right:-100%;height:100%;z-index:-1}[data-sonner-toast][data-y-position=top][data-swiping=true]::before{bottom:50%;transform:scaleY(3) translateY(50%)}[data-sonner-toast][data-y-position=bottom][data-swiping=true]::before{top:50%;transform:scaleY(3) translateY(-50%)}[data-sonner-toast][data-swiping=false][data-removed=true]::before{content:'';position:absolute;inset:0;transform:scaleY(2)}[data-sonner-toast][data-expanded=true]::after{content:'';position:absolute;left:0;height:calc(var(--gap) + 1px);bottom:100%;width:100%}[data-sonner-toast][data-mounted=true]{--y:translateY(0);opacity:1}[data-sonner-toast][data-expanded=false][data-front=false]{--scale:var(--toasts-before) * 0.05 + 1;--y:translateY(calc(var(--lift-amount) * var(--toasts-before))) scale(calc(-1 * var(--scale)));height:var(--front-toast-height)}[data-sonner-toast]>*{transition:opacity .4s}[data-sonner-toast][data-x-position=right]{right:0}[data-sonner-toast][data-x-position=left]{left:0}[data-sonner-toast][data-expanded=false][data-front=false][data-styled=true]>*{opacity:0}[data-sonner-toast][data-visible=false]{opacity:0;pointer-events:none}[data-sonner-toast][data-mounted=true][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset)));height:var(--initial-height)}[data-sonner-toast][data-removed=true][data-front=true][data-swipe-out=false]{--y:translateY(calc(var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset) + var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=false]{--y:translateY(40%);opacity:0;transition:transform .5s,opacity .2s}[data-sonner-toast][data-removed=true][data-front=false]::before{height:calc(var(--initial-height) + 20%)}[data-sonner-toast][data-swiping=true]{transform:var(--y) translateY(var(--swipe-amount-y,0)) translateX(var(--swipe-amount-x,0));transition:none}[data-sonner-toast][data-swiped=true]{user-select:none}[data-sonner-toast][data-swipe-out=true][data-y-position=bottom],[data-sonner-toast][data-swipe-out=true][data-y-position=top]{animation-duration:.2s;animation-timing-function:ease-out;animation-fill-mode:forwards}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=left]{animation-name:swipe-out-left}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=right]{animation-name:swipe-out-right}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=up]{animation-name:swipe-out-up}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=down]{animation-name:swipe-out-down}@keyframes swipe-out-left{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) - 100%));opacity:0}}@keyframes swipe-out-right{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) + 100%));opacity:0}}@keyframes swipe-out-up{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) - 100%));opacity:0}}@keyframes swipe-out-down{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) + 100%));opacity:0}}@media (max-width:600px){[data-sonner-toaster]{position:fixed;right:var(--mobile-offset-right);left:var(--mobile-offset-left);width:100%}[data-sonner-toaster][dir=rtl]{left:calc(var(--mobile-offset-left) * -1)}[data-sonner-toaster] [data-sonner-toast]{left:0;right:0;width:calc(100% - var(--mobile-offset-left) * 2)}[data-sonner-toaster][data-x-position=left]{left:var(--mobile-offset-left)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--mobile-offset-bottom)}[data-sonner-toaster][data-y-position=top]{top:var(--mobile-offset-top)}[data-sonner-toaster][data-x-position=center]{left:var(--mobile-offset-left);right:var(--mobile-offset-right);transform:none}}[data-sonner-toaster][data-sonner-theme=light]{--normal-bg:#fff;--normal-border:var(--gray4);--normal-text:var(--gray12);--success-bg:hsl(143, 85%, 96%);--success-border:hsl(145, 92%, 87%);--success-text:hsl(140, 100%, 27%);--info-bg:hsl(208, 100%, 97%);--info-border:hsl(221, 91%, 93%);--info-text:hsl(210, 92%, 45%);--warning-bg:hsl(49, 100%, 97%);--warning-border:hsl(49, 91%, 84%);--warning-text:hsl(31, 92%, 45%);--error-bg:hsl(359, 100%, 97%);--error-border:hsl(359, 100%, 94%);--error-text:hsl(360, 100%, 45%)}[data-sonner-toaster][data-sonner-theme=light] [data-sonner-toast][data-invert=true]{--normal-bg:#000;--normal-border:hsl(0, 0%, 20%);--normal-text:var(--gray1)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-invert=true]{--normal-bg:#fff;--normal-border:var(--gray3);--normal-text:var(--gray12)}[data-sonner-toaster][data-sonner-theme=dark]{--normal-bg:#000;--normal-bg-hover:hsl(0, 0%, 12%);--normal-border:hsl(0, 0%, 20%);--normal-border-hover:hsl(0, 0%, 25%);--normal-text:var(--gray1);--success-bg:hsl(150, 100%, 6%);--success-border:hsl(147, 100%, 12%);--success-text:hsl(150, 86%, 65%);--info-bg:hsl(215, 100%, 6%);--info-border:hsl(223, 43%, 17%);--info-text:hsl(216, 87%, 65%);--warning-bg:hsl(64, 100%, 6%);--warning-border:hsl(60, 100%, 9%);--warning-text:hsl(46, 87%, 65%);--error-bg:hsl(358, 76%, 10%);--error-border:hsl(357, 89%, 16%);--error-text:hsl(358, 100%, 81%)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]{background:var(--normal-bg);border-color:var(--normal-border);color:var(--normal-text)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]:hover{background:var(--normal-bg-hover);border-color:var(--normal-border-hover)}[data-rich-colors=true][data-sonner-toast][data-type=success]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=success] [data-close-button]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=info]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=info] [data-close-button]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning] [data-close-button]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=error]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}[data-rich-colors=true][data-sonner-toast][data-type=error] [data-close-button]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}.sonner-loading-wrapper{--size:16px;height:var(--size);width:var(--size);position:absolute;inset:0;z-index:10}.sonner-loading-wrapper[data-visible=false]{transform-origin:center;animation:sonner-fade-out .2s ease forwards}.sonner-spinner{position:relative;top:50%;left:50%;height:var(--size);width:var(--size)}.sonner-loading-bar{animation:sonner-spin 1.2s linear infinite;background:var(--gray11);border-radius:6px;height:8%;left:-10%;position:absolute;top:-3.9%;width:24%}.sonner-loading-bar:first-child{animation-delay:-1.2s;transform:rotate(.0001deg) translate(146%)}.sonner-loading-bar:nth-child(2){animation-delay:-1.1s;transform:rotate(30deg) translate(146%)}.sonner-loading-bar:nth-child(3){animation-delay:-1s;transform:rotate(60deg) translate(146%)}.sonner-loading-bar:nth-child(4){animation-delay:-.9s;transform:rotate(90deg) translate(146%)}.sonner-loading-bar:nth-child(5){animation-delay:-.8s;transform:rotate(120deg) translate(146%)}.sonner-loading-bar:nth-child(6){animation-delay:-.7s;transform:rotate(150deg) translate(146%)}.sonner-loading-bar:nth-child(7){animation-delay:-.6s;transform:rotate(180deg) translate(146%)}.sonner-loading-bar:nth-child(8){animation-delay:-.5s;transform:rotate(210deg) translate(146%)}.sonner-loading-bar:nth-child(9){animation-delay:-.4s;transform:rotate(240deg) translate(146%)}.sonner-loading-bar:nth-child(10){animation-delay:-.3s;transform:rotate(270deg) translate(146%)}.sonner-loading-bar:nth-child(11){animation-delay:-.2s;transform:rotate(300deg) translate(146%)}.sonner-loading-bar:nth-child(12){animation-delay:-.1s;transform:rotate(330deg) translate(146%)}@keyframes sonner-fade-in{0%{opacity:0;transform:scale(.8)}100%{opacity:1;transform:scale(1)}}@keyframes sonner-fade-out{0%{opacity:1;transform:scale(1)}100%{opacity:0;transform:scale(.8)}}@keyframes sonner-spin{0%{opacity:1}100%{opacity:.15}}@media (prefers-reduced-motion){.sonner-loading-bar,[data-sonner-toast],[data-sonner-toast]>*{transition:none!important;animation:none!important}}.sonner-loader{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);transform-origin:center;transition:opacity .2s,transform .2s}.sonner-loader[data-visible=false]{opacity:0;transform:scale(.8) translate(-50%,-50%)}`);function Pa(e){return e.label!==void 0}var Fa=3,Ia=`24px`,La=`16px`,Ra=4e3,za=356,Ba=14,Va=45,Ha=200;function Ua(...e){return e.filter(Boolean).join(` `)}function Wa(e){let[t,n]=e.split(`-`),r=[];return t&&r.push(t),n&&r.push(n),r}var Ga=e=>{let{invert:t,toast:n,unstyled:r,interacting:i,setHeights:a,visibleToasts:o,heights:s,index:c,toasts:l,expanded:u,removeToast:d,defaultRichColors:f,closeButton:p,style:m,cancelButtonStyle:h,actionButtonStyle:g,className:_=``,descriptionClassName:v=``,duration:y,position:b,gap:x,expandByDefault:S,classNames:C,icons:w,closeButtonAriaLabel:T=`Close toast`}=e,[E,D]=B.useState(null),[O,k]=B.useState(null),[ee,te]=B.useState(!1),[A,j]=B.useState(!1),[M,N]=B.useState(!1),[P,F]=B.useState(!1),[ne,re]=B.useState(!1),[ie,I]=B.useState(0),[L,R]=B.useState(0),ae=B.useRef(n.duration||y||Ra),z=B.useRef(null),oe=B.useRef(null),se=c===0,ce=c+1<=o,le=n.type,ue=n.dismissible!==!1,de=n.className||``,fe=n.descriptionClassName||``,pe=B.useMemo(()=>s.findIndex(e=>e.toastId===n.id)||0,[s,n.id]),me=B.useMemo(()=>n.closeButton??p,[n.closeButton,p]),he=B.useMemo(()=>n.duration||y||Ra,[n.duration,y]),ge=B.useRef(0),_e=B.useRef(0),ve=B.useRef(0),ye=B.useRef(null),[be,xe]=b.split(`-`),Se=B.useMemo(()=>s.reduce((e,t,n)=>n>=pe?e:e+t.height,0),[s,pe]),Ce=Oa(),we=n.invert||t,Te=le===`loading`;_e.current=B.useMemo(()=>pe*x+Se,[pe,Se]),B.useEffect(()=>{ae.current=he},[he]),B.useEffect(()=>{te(!0)},[]),B.useEffect(()=>{let e=oe.current;if(e){let t=e.getBoundingClientRect().height;return R(t),a(e=>[{toastId:n.id,height:t,position:n.position},...e]),()=>a(e=>e.filter(e=>e.toastId!==n.id))}},[a,n.id]),B.useLayoutEffect(()=>{if(!ee)return;let e=oe.current,t=e.style.height;e.style.height=`auto`;let r=e.getBoundingClientRect().height;e.style.height=t,R(r),a(e=>e.find(e=>e.toastId===n.id)?e.map(e=>e.toastId===n.id?{...e,height:r}:e):[{toastId:n.id,height:r,position:n.position},...e])},[ee,n.title,n.description,a,n.id,n.jsx,n.action,n.cancel]);let Ee=B.useCallback(()=>{j(!0),I(_e.current),a(e=>e.filter(e=>e.toastId!==n.id)),setTimeout(()=>{d(n)},Ha)},[n,d,a,_e]);B.useEffect(()=>{if(n.promise&&le===`loading`||n.duration===1/0||n.type===`loading`)return;let e;return u||i||Ce?(()=>{if(ve.current<ge.current){let e=new Date().getTime()-ge.current;ae.current-=e}ve.current=new Date().getTime()})():ae.current!==1/0&&(ge.current=new Date().getTime(),e=setTimeout(()=>{n.onAutoClose==null||n.onAutoClose.call(n,n),Ee()},ae.current)),()=>clearTimeout(e)},[u,i,n,le,Ce,Ee]),B.useEffect(()=>{n.delete&&(Ee(),n.onDismiss==null||n.onDismiss.call(n,n))},[Ee,n.delete]);function De(){return w?.loading?B.createElement(`div`,{className:Ua(C?.loader,n?.classNames?.loader,`sonner-loader`),"data-visible":le===`loading`},w.loading):B.createElement(Sa,{className:Ua(C?.loader,n?.classNames?.loader),visible:le===`loading`})}let Oe=n.icon||w?.[le]||ba(le);return B.createElement(`li`,{tabIndex:0,ref:oe,className:Ua(_,de,C?.toast,n?.classNames?.toast,C?.default,C?.[le],n?.classNames?.[le]),"data-sonner-toast":``,"data-rich-colors":n.richColors??f,"data-styled":!(n.jsx||n.unstyled||r),"data-mounted":ee,"data-promise":!!n.promise,"data-swiped":ne,"data-removed":A,"data-visible":ce,"data-y-position":be,"data-x-position":xe,"data-index":c,"data-front":se,"data-swiping":M,"data-dismissible":ue,"data-type":le,"data-invert":we,"data-swipe-out":P,"data-swipe-direction":O,"data-expanded":!!(u||S&&ee),"data-testid":n.testId,style:{"--index":c,"--toasts-before":c,"--z-index":l.length-c,"--offset":`${A?ie:_e.current}px`,"--initial-height":S?`auto`:`${L}px`,...m,...n.style},onDragEnd:()=>{N(!1),D(null),ye.current=null},onPointerDown:e=>{e.button!==2&&(Te||!ue||(z.current=new Date,I(_e.current),e.target.setPointerCapture(e.pointerId),e.target.tagName!==`BUTTON`&&(N(!0),ye.current={x:e.clientX,y:e.clientY})))},onPointerUp:()=>{if(P||!ue)return;ye.current=null;let e=Number(oe.current?.style.getPropertyValue(`--swipe-amount-x`).replace(`px`,``)||0),t=Number(oe.current?.style.getPropertyValue(`--swipe-amount-y`).replace(`px`,``)||0),r=new Date().getTime()-z.current?.getTime(),i=E===`x`?e:t,a=Math.abs(i)/r;if(Math.abs(i)>=Va||a>.11){I(_e.current),n.onDismiss==null||n.onDismiss.call(n,n),k(E===`x`?e>0?`right`:`left`:t>0?`down`:`up`),Ee(),F(!0);return}else{var o,s;(o=oe.current)==null||o.style.setProperty(`--swipe-amount-x`,`0px`),(s=oe.current)==null||s.style.setProperty(`--swipe-amount-y`,`0px`)}re(!1),N(!1),D(null)},onPointerMove:t=>{var n,r;if(!ye.current||!ue||window.getSelection()?.toString().length>0)return;let i=t.clientY-ye.current.y,a=t.clientX-ye.current.x,o=e.swipeDirections??Wa(b);!E&&(Math.abs(a)>1||Math.abs(i)>1)&&D(Math.abs(a)>Math.abs(i)?`x`:`y`);let s={x:0,y:0},c=e=>1/(1.5+Math.abs(e)/20);if(E===`y`){if(o.includes(`top`)||o.includes(`bottom`))if(o.includes(`top`)&&i<0||o.includes(`bottom`)&&i>0)s.y=i;else{let e=i*c(i);s.y=Math.abs(e)<Math.abs(i)?e:i}}else if(E===`x`&&(o.includes(`left`)||o.includes(`right`)))if(o.includes(`left`)&&a<0||o.includes(`right`)&&a>0)s.x=a;else{let e=a*c(a);s.x=Math.abs(e)<Math.abs(a)?e:a}(Math.abs(s.x)>0||Math.abs(s.y)>0)&&re(!0),(n=oe.current)==null||n.style.setProperty(`--swipe-amount-x`,`${s.x}px`),(r=oe.current)==null||r.style.setProperty(`--swipe-amount-y`,`${s.y}px`)}},me&&!n.jsx&&le!==`loading`?B.createElement(`button`,{"aria-label":T,"data-disabled":Te,"data-close-button":!0,onClick:Te||!ue?()=>{}:()=>{Ee(),n.onDismiss==null||n.onDismiss.call(n,n)},className:Ua(C?.closeButton,n?.classNames?.closeButton)},w?.close??Da):null,(le||n.icon||n.promise)&&n.icon!==null&&(w?.[le]!==null||n.icon)?B.createElement(`div`,{"data-icon":``,className:Ua(C?.icon,n?.classNames?.icon)},n.promise||n.type===`loading`&&!n.icon?n.icon||De():null,n.type===`loading`?null:Oe):null,B.createElement(`div`,{"data-content":``,className:Ua(C?.content,n?.classNames?.content)},B.createElement(`div`,{"data-title":``,className:Ua(C?.title,n?.classNames?.title)},n.jsx?n.jsx:typeof n.title==`function`?n.title():n.title),n.description?B.createElement(`div`,{"data-description":``,className:Ua(v,fe,C?.description,n?.classNames?.description)},typeof n.description==`function`?n.description():n.description):null),B.isValidElement(n.cancel)?n.cancel:n.cancel&&Pa(n.cancel)?B.createElement(`button`,{"data-button":!0,"data-cancel":!0,style:n.cancelButtonStyle||h,onClick:e=>{Pa(n.cancel)&&ue&&(n.cancel.onClick==null||n.cancel.onClick.call(n.cancel,e),Ee())},className:Ua(C?.cancelButton,n?.classNames?.cancelButton)},n.cancel.label):null,B.isValidElement(n.action)?n.action:n.action&&Pa(n.action)?B.createElement(`button`,{"data-button":!0,"data-action":!0,style:n.actionButtonStyle||g,onClick:e=>{Pa(n.action)&&(n.action.onClick==null||n.action.onClick.call(n.action,e),!e.defaultPrevented&&Ee())},className:Ua(C?.actionButton,n?.classNames?.actionButton)},n.action.label):null)};function Ka(){if(typeof window>`u`||typeof document>`u`)return`ltr`;let e=document.documentElement.getAttribute(`dir`);return e===`auto`||!e?window.getComputedStyle(document.documentElement).direction:e}function qa(e,t){let n={};return[e,t].forEach((e,t)=>{let r=t===1,i=r?`--mobile-offset`:`--offset`,a=r?La:Ia;function o(e){[`top`,`right`,`bottom`,`left`].forEach(t=>{n[`${i}-${t}`]=typeof e==`number`?`${e}px`:e})}typeof e==`number`||typeof e==`string`?o(e):typeof e==`object`?[`top`,`right`,`bottom`,`left`].forEach(t=>{e[t]===void 0?n[`${i}-${t}`]=a:n[`${i}-${t}`]=typeof e[t]==`number`?`${e[t]}px`:e[t]}):o(a)}),n}var Ja=B.forwardRef(function(e,t){let{id:n,invert:r,position:i=`bottom-right`,hotkey:a=[`altKey`,`KeyT`],expand:o,closeButton:s,className:c,offset:l,mobileOffset:u,theme:d=`light`,richColors:f,duration:p,style:m,visibleToasts:h=Fa,toastOptions:g,dir:_=Ka(),gap:v=Ba,icons:y,containerAriaLabel:b=`Notifications`}=e,[x,S]=B.useState([]),C=B.useMemo(()=>n?x.filter(e=>e.toasterId===n):x.filter(e=>!e.toasterId),[x,n]),w=B.useMemo(()=>Array.from(new Set([i].concat(C.filter(e=>e.position).map(e=>e.position)))),[C,i]),[T,E]=B.useState([]),[D,O]=B.useState(!1),[k,ee]=B.useState(!1),[te,A]=B.useState(d===`system`?typeof window<`u`&&window.matchMedia&&window.matchMedia(`(prefers-color-scheme: dark)`).matches?`dark`:`light`:d),j=B.useRef(null),M=a.join(`+`).replace(/Key/g,``).replace(/Digit/g,``),N=B.useRef(null),P=B.useRef(!1),F=B.useCallback(e=>{S(t=>(t.find(t=>t.id===e.id)?.delete||Aa.dismiss(e.id),t.filter(({id:t})=>t!==e.id)))},[]);return B.useEffect(()=>Aa.subscribe(e=>{if(e.dismiss){requestAnimationFrame(()=>{S(t=>t.map(t=>t.id===e.id?{...t,delete:!0}:t))});return}setTimeout(()=>{Pi.flushSync(()=>{S(t=>{let n=t.findIndex(t=>t.id===e.id);return n===-1?[e,...t]:[...t.slice(0,n),{...t[n],...e},...t.slice(n+1)]})})})}),[x]),B.useEffect(()=>{if(d!==`system`){A(d);return}if(d===`system`&&(window.matchMedia&&window.matchMedia(`(prefers-color-scheme: dark)`).matches?A(`dark`):A(`light`)),typeof window>`u`)return;let e=window.matchMedia(`(prefers-color-scheme: dark)`);try{e.addEventListener(`change`,({matches:e})=>{A(e?`dark`:`light`)})}catch{e.addListener(({matches:e})=>{try{A(e?`dark`:`light`)}catch(e){console.error(e)}})}},[d]),B.useEffect(()=>{x.length<=1&&O(!1)},[x]),B.useEffect(()=>{let e=e=>{if(a.every(t=>e[t]||e.code===t)){var t;O(!0),(t=j.current)==null||t.focus()}e.code===`Escape`&&(document.activeElement===j.current||j.current?.contains(document.activeElement))&&O(!1)};return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[a]),B.useEffect(()=>{if(j.current)return()=>{N.current&&(N.current.focus({preventScroll:!0}),N.current=null,P.current=!1)}},[j.current]),B.createElement(`section`,{ref:t,"aria-label":`${b} ${M}`,tabIndex:-1,"aria-live":`polite`,"aria-relevant":`additions text`,"aria-atomic":`false`,suppressHydrationWarning:!0},w.map((t,n)=>{let[i,a]=t.split(`-`);return C.length?B.createElement(`ol`,{key:t,dir:_===`auto`?Ka():_,tabIndex:-1,ref:j,className:c,"data-sonner-toaster":!0,"data-sonner-theme":te,"data-y-position":i,"data-x-position":a,style:{"--front-toast-height":`${T[0]?.height||0}px`,"--width":`${za}px`,"--gap":`${v}px`,...m,...qa(l,u)},onBlur:e=>{P.current&&!e.currentTarget.contains(e.relatedTarget)&&(P.current=!1,N.current&&=(N.current.focus({preventScroll:!0}),null))},onFocus:e=>{e.target instanceof HTMLElement&&e.target.dataset.dismissible===`false`||P.current||(P.current=!0,N.current=e.relatedTarget)},onMouseEnter:()=>O(!0),onMouseMove:()=>O(!0),onMouseLeave:()=>{k||O(!1)},onDragEnd:()=>O(!1),onPointerDown:e=>{e.target instanceof HTMLElement&&e.target.dataset.dismissible===`false`||ee(!0)},onPointerUp:()=>ee(!1)},C.filter(e=>!e.position&&n===0||e.position===t).map((n,i)=>B.createElement(Ga,{key:n.id,icons:y,index:i,toast:n,defaultRichColors:f,duration:g?.duration??p,className:g?.className,descriptionClassName:g?.descriptionClassName,invert:r,visibleToasts:h,closeButton:g?.closeButton??s,interacting:k,position:t,style:g?.style,unstyled:g?.unstyled,classNames:g?.classNames,cancelButtonStyle:g?.cancelButtonStyle,actionButtonStyle:g?.actionButtonStyle,closeButtonAriaLabel:g?.closeButtonAriaLabel,removeToast:F,toasts:C.filter(e=>e.position==n.position),heights:T.filter(e=>e.position==n.position),setHeights:E,expandByDefault:o,gap:v,expanded:D,swipeDirections:e.swipeDirections}))):null}))});function Ya(e){return(0,V.jsx)(Ja,{theme:`dark`,position:`top-right`,visibleToasts:3,expand:!0,containerAriaLabel:`Notifications`,toastOptions:{classNames:{toast:`group border-zinc-700! bg-zinc-900! text-zinc-100! shadow-2xl!`,title:`text-zinc-100!`,description:`text-zinc-400!`,actionButton:`bg-cyan-600! text-white! hover:bg-cyan-500!`,cancelButton:`bg-zinc-800! text-zinc-200! hover:bg-zinc-700!`}},...e})}typeof window<`u`&&window.document&&window.document.createElement;function Xa(e,t,{checkForDefaultPrevented:n=!0}={}){return function(r){if(e?.(r),n===!1||!r||!r.defaultPrevented)return t?.(r)}}function Za(e,t){if(typeof e==`function`)return e(t);e!=null&&(e.current=t)}function Qa(...e){return t=>{let n=!1,r=e.map(e=>{let r=Za(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():Za(e[t],null)}}}}function $a(...e){return B.useCallback(Qa(...e),e)}function eo(e,t=[]){let n=[];function r(t,r){let i=B.createContext(r);i.displayName=t+`Context`;let a=n.length;n=[...n,r];let o=t=>{let{scope:n,children:r,...o}=t,s=n?.[e]?.[a]||i,c=B.useMemo(()=>o,Object.values(o));return(0,V.jsx)(s.Provider,{value:c,children:r})};o.displayName=t+`Provider`;function s(n,o,s={}){let{optional:c=!1}=s,l=o?.[e]?.[a]||i,u=B.useContext(l);if(u)return u;if(r!==void 0)return r;if(!c)throw Error(`\`${n}\` must be used within \`${t}\``)}return[o,s]}let i=()=>{let t=n.map(e=>B.createContext(e));return function(n){let r=n?.[e]||t;return B.useMemo(()=>({[`__scope${e}`]:{...n,[e]:r}}),[n,r])}};return i.scopeName=e,[r,to(i,...t)]}function to(...e){let t=e[0];if(e.length===1)return t;let n=()=>{let n=e.map(e=>({useScope:e(),scopeName:e.scopeName}));return function(e){let r=n.reduce((t,{useScope:n,scopeName:r})=>{let i=n(e)[`__scope${r}`];return{...t,...i}},{});return B.useMemo(()=>({[`__scope${t.scopeName}`]:r}),[r])}};return n.scopeName=t.scopeName,n}function no(e){let t=B.forwardRef((t,n)=>{let{children:r,...i}=t,a=null,o=!1,s=[];uo(r)&&typeof mo==`function`&&(r=mo(r._payload)),B.Children.forEach(r,e=>{if(co(e)){o=!0;let t=e,n=`child`in t.props?t.props.child:t.props.children;uo(n)&&typeof mo==`function`&&(n=mo(n._payload)),a=ao(t,n),s.push(a?.props?.children)}else s.push(e)}),a?a=B.cloneElement(a,void 0,s):!o&&B.Children.count(r)===1&&B.isValidElement(r)&&(a=r);let c=a?so(a):void 0,l=$a(n,c);if(!a){if(r||r===0)throw Error(o?po(e):fo(e));return r}let u=oo(i,a.props??{});return a.type!==B.Fragment&&(u.ref=n?l:c),B.cloneElement(a,u)});return t.displayName=`${e}.Slot`,t}var ro=Symbol.for(`radix.slottable`);function io(e){let t=e=>`child`in e?e.children(e.child):e.children;return t.displayName=`${e}.Slottable`,t.__radixId=ro,t}var ao=(e,t)=>{if(`child`in e.props){let t=e.props.child;return B.isValidElement(t)?B.cloneElement(t,void 0,e.props.children(t.props.children)):null}return B.isValidElement(t)?t:null};function oo(e,t){let n={...t};for(let r in t){let i=e[r],a=t[r];/^on[A-Z]/.test(r)?i&&a?n[r]=(...e)=>{let t=a(...e);return i(...e),t}:i&&(n[r]=i):r===`style`?n[r]={...i,...a}:r===`className`&&(n[r]=[i,a].filter(Boolean).join(` `))}return{...e,...n}}function so(e){let t=Object.getOwnPropertyDescriptor(e.props,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}function co(e){return B.isValidElement(e)&&typeof e.type==`function`&&`__radixId`in e.type&&e.type.__radixId===ro}var lo=Symbol.for(`react.lazy`);function uo(e){return typeof e==`object`&&!!e&&`$$typeof`in e&&e.$$typeof===lo&&`_payload`in e&&H(e._payload)}function H(e){return typeof e==`object`&&!!e&&`then`in e}var fo=e=>`${e} failed to slot onto its children. Expected a single React element child or \`Slottable\`.`,po=e=>`${e} failed to slot onto its \`Slottable\`. Expected \`Slottable\` to receive a single React element child.`,mo=B.use,ho=[`a`,`button`,`div`,`form`,`h2`,`h3`,`img`,`input`,`label`,`li`,`nav`,`ol`,`p`,`select`,`span`,`svg`,`ul`].reduce((e,t)=>{let n=no(`Primitive.${t}`),r=B.forwardRef((e,r)=>{let{asChild:i,...a}=e,o=i?n:t;return typeof window<`u`&&(window[Symbol.for(`radix-ui`)]=!0),(0,V.jsx)(o,{...a,ref:r})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function go(e,t){e&&Pi.flushSync(()=>e.dispatchEvent(t))}function _o(e){let t=B.useRef(e);return B.useEffect(()=>{t.current=e}),B.useMemo(()=>((...e)=>t.current?.(...e)),[])}var vo=`DismissableLayer`,yo=`dismissableLayer.update`,bo=`dismissableLayer.pointerDownOutside`,xo=`dismissableLayer.focusOutside`,So,Co=B.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set,dismissableSurfaces:new Set}),wo=B.forwardRef((e,t)=>{let{disableOutsidePointerEvents:n=!1,deferPointerDownOutside:r=!1,onEscapeKeyDown:i,onPointerDownOutside:a,onFocusOutside:o,onInteractOutside:s,onDismiss:c,...l}=e,u=B.useContext(Co),[d,f]=B.useState(null),p=d?.ownerDocument??globalThis?.document,[,m]=B.useState({}),h=$a(t,f),g=Array.from(u.layers),[_]=[...u.layersWithOutsidePointerEventsDisabled].slice(-1),v=_?g.indexOf(_):-1,y=d?g.indexOf(d):-1,b=u.layersWithOutsidePointerEventsDisabled.size>0,x=y>=v,S=B.useRef(!1),C=Oo(e=>{a?.(e),s?.(e),e.defaultPrevented||c?.()},{ownerDocument:p,deferPointerDownOutside:r,isDeferredPointerDownOutsideRef:S,dismissableSurfaces:u.dismissableSurfaces,shouldHandlePointerDownOutside:B.useCallback(e=>{if(!(e instanceof Node))return!1;let t=[...u.branches].some(t=>t.contains(e));return x&&!t},[u.branches,x])}),w=ko(e=>{if(r&&S.current)return;let t=e.target;[...u.branches].some(e=>e.contains(t))||(o?.(e),s?.(e),e.defaultPrevented||c?.())},p),T=d?y===g.length-1:!1,E=_o(e=>{e.key===`Escape`&&(i?.(e),!e.defaultPrevented&&c&&(e.preventDefault(),c()))});return B.useEffect(()=>{if(T)return p.addEventListener(`keydown`,E,{capture:!0}),()=>p.removeEventListener(`keydown`,E,{capture:!0})},[p,T,E]),B.useEffect(()=>{if(d)return n&&(u.layersWithOutsidePointerEventsDisabled.size===0&&(So=p.body.style.pointerEvents,p.body.style.pointerEvents=`none`),u.layersWithOutsidePointerEventsDisabled.add(d)),u.layers.add(d),Ao(),()=>{n&&(u.layersWithOutsidePointerEventsDisabled.delete(d),u.layersWithOutsidePointerEventsDisabled.size===0&&(p.body.style.pointerEvents=So))}},[d,p,n,u]),B.useEffect(()=>()=>{d&&(u.layers.delete(d),u.layersWithOutsidePointerEventsDisabled.delete(d),Ao())},[d,u]),B.useEffect(()=>{let e=()=>m({});return document.addEventListener(yo,e),()=>document.removeEventListener(yo,e)},[]),(0,V.jsx)(ho.div,{...l,ref:h,style:{pointerEvents:b?x?`auto`:`none`:void 0,...e.style},onFocusCapture:Xa(e.onFocusCapture,w.onFocusCapture),onBlurCapture:Xa(e.onBlurCapture,w.onBlurCapture),onPointerDownCapture:Xa(e.onPointerDownCapture,C.onPointerDownCapture)})});wo.displayName=vo;var To=`DismissableLayerBranch`,Eo=B.forwardRef((e,t)=>{let n=B.useContext(Co),r=B.useRef(null),i=$a(t,r);return B.useEffect(()=>{let e=r.current;if(e)return n.branches.add(e),()=>{n.branches.delete(e)}},[n.branches]),(0,V.jsx)(ho.div,{...e,ref:i})});Eo.displayName=To;var Do=()=>!0;function Oo(e,t){let{ownerDocument:n=globalThis?.document,deferPointerDownOutside:r=!1,isDeferredPointerDownOutsideRef:i,dismissableSurfaces:a,shouldHandlePointerDownOutside:o=Do}=t,s=_o(e),c=B.useRef(!1),l=B.useRef(!1),u=B.useRef(new Map),d=B.useRef(()=>{});return B.useEffect(()=>{function e(){l.current=!1,i.current=!1,u.current.clear()}function t(){return Array.from(u.current.values()).some(Boolean)}function f(e){if(!l.current)return;let t=e.target;t instanceof Node&&[...a].some(e=>e.contains(t))||u.current.set(e.type,!0),e.type===`click`&&window.setTimeout(()=>{l.current&&d.current()},0)}function p(e){l.current&&u.current.set(e.type,!1)}let m=a=>{if(a.target&&!c.current){let f=function(){n.removeEventListener(`click`,d.current);let r=t();e(),r||jo(bo,s,p,{discrete:!0})};if(!o(a.target)){n.removeEventListener(`click`,d.current),e(),c.current=!1;return}let p={originalEvent:a};l.current=!0,i.current=r&&a.button===0,u.current.clear(),!r||a.button!==0?f():(n.removeEventListener(`click`,d.current),d.current=f,n.addEventListener(`click`,d.current,{once:!0}))}else n.removeEventListener(`click`,d.current),e();c.current=!1},h=[`pointerup`,`mousedown`,`mouseup`,`touchstart`,`touchend`,`click`];for(let e of h)n.addEventListener(e,f,!0),n.addEventListener(e,p);let g=window.setTimeout(()=>{n.addEventListener(`pointerdown`,m)},0);return()=>{window.clearTimeout(g),n.removeEventListener(`pointerdown`,m),n.removeEventListener(`click`,d.current);for(let e of h)n.removeEventListener(e,f,!0),n.removeEventListener(e,p)}},[n,s,r,i,a,o]),{onPointerDownCapture:()=>c.current=!0}}function ko(e,t=globalThis?.document){let n=_o(e),r=B.useRef(!1);return B.useEffect(()=>{let e=e=>{e.target&&!r.current&&jo(xo,n,{originalEvent:e},{discrete:!1})};return t.addEventListener(`focusin`,e),()=>t.removeEventListener(`focusin`,e)},[t,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function Ao(){let e=new CustomEvent(yo);document.dispatchEvent(e)}function jo(e,t,n,{discrete:r}){let i=n.originalEvent.target,a=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&i.addEventListener(e,t,{once:!0}),r?go(i,a):i.dispatchEvent(a)}var Mo=globalThis?.document?B.useLayoutEffect:()=>{},No=B.useId||(()=>void 0),Po=0;function Fo(e){let[t,n]=B.useState(No());return Mo(()=>{e||n(e=>e??String(Po++))},[e]),e||(t?`radix-${t}`:``)}var Io=[`top`,`right`,`bottom`,`left`],Lo=Math.min,Ro=Math.max,zo=Math.round,Bo=Math.floor,Vo=e=>({x:e,y:e}),Ho={left:`right`,right:`left`,bottom:`top`,top:`bottom`};function Uo(e,t,n){return Ro(e,Lo(t,n))}function Wo(e,t){return typeof e==`function`?e(t):e}function Go(e){return e.split(`-`)[0]}function Ko(e){return e.split(`-`)[1]}function qo(e){return e===`x`?`y`:`x`}function Jo(e){return e===`y`?`height`:`width`}function Yo(e){let t=e[0];return t===`t`||t===`b`?`y`:`x`}function Xo(e){return qo(Yo(e))}function Zo(e,t,n){n===void 0&&(n=!1);let r=Ko(e),i=Xo(e),a=Jo(i),o=i===`x`?r===(n?`end`:`start`)?`right`:`left`:r===`start`?`bottom`:`top`;return t.reference[a]>t.floating[a]&&(o=os(o)),[o,os(o)]}function Qo(e){let t=os(e);return[$o(e),t,$o(t)]}function $o(e){return e.includes(`start`)?e.replace(`start`,`end`):e.replace(`end`,`start`)}var es=[`left`,`right`],ts=[`right`,`left`],ns=[`top`,`bottom`],rs=[`bottom`,`top`];function is(e,t,n){switch(e){case`top`:case`bottom`:return n?t?ts:es:t?es:ts;case`left`:case`right`:return t?ns:rs;default:return[]}}function as(e,t,n,r){let i=Ko(e),a=is(Go(e),n===`start`,r);return i&&(a=a.map(e=>e+`-`+i),t&&(a=a.concat(a.map($o)))),a}function os(e){let t=Go(e);return Ho[t]+e.slice(t.length)}function ss(e){return{top:e.top??0,right:e.right??0,bottom:e.bottom??0,left:e.left??0}}function cs(e){return typeof e==`number`?{top:e,right:e,bottom:e,left:e}:ss(e)}function ls(e){let{x:t,y:n,width:r,height:i}=e;return{width:r,height:i,top:n,left:t,right:t+r,bottom:n+i,x:t,y:n}}function us(e,t,n){let{reference:r,floating:i}=e,a=Yo(t),o=Xo(t),s=Jo(o),c=Go(t),l=a===`y`,u=r.x+r.width/2-i.width/2,d=r.y+r.height/2-i.height/2,f=r[s]/2-i[s]/2,p;switch(c){case`top`:p={x:u,y:r.y-i.height};break;case`bottom`:p={x:u,y:r.y+r.height};break;case`right`:p={x:r.x+r.width,y:d};break;case`left`:p={x:r.x-i.width,y:d};break;default:p={x:r.x,y:r.y}}let m=Ko(t);return m&&(p[o]+=f*(m===`end`?1:-1)*(n&&l?-1:1)),p}async function ds(e,t){t===void 0&&(t={});let{x:n,y:r,platform:i,rects:a,elements:o,strategy:s}=e,{boundary:c=`clippingAncestors`,rootBoundary:l=`viewport`,elementContext:u=`floating`,altBoundary:d=!1,padding:f=0}=Wo(t,e),p=cs(f),m=o[d?u===`floating`?`reference`:`floating`:u],h=ls(await i.getClippingRect({element:await(i.isElement==null?void 0:i.isElement(m))??!0?m:m.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(o.floating)),boundary:c,rootBoundary:l,strategy:s})),g=u===`floating`?{x:n,y:r,width:a.floating.width,height:a.floating.height}:a.reference,_=await(i.getOffsetParent==null?void 0:i.getOffsetParent(o.floating)),v=await(i.isElement==null?void 0:i.isElement(_))&&await(i.getScale==null?void 0:i.getScale(_))||{x:1,y:1},y=ls(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:o,rect:g,offsetParent:_,strategy:s}):g);return{top:(h.top-y.top+p.top)/v.y,bottom:(y.bottom-h.bottom+p.bottom)/v.y,left:(h.left-y.left+p.left)/v.x,right:(y.right-h.right+p.right)/v.x}}var fs=50,ps=async(e,t,n)=>{let{placement:r=`bottom`,strategy:i=`absolute`,middleware:a=[],platform:o}=n,s=o.detectOverflow?o:{...o,detectOverflow:ds},c=await(o.isRTL==null?void 0:o.isRTL(t)),l=await o.getElementRects({reference:e,floating:t,strategy:i}),{x:u,y:d}=us(l,r,c),f=r,p=0,m={};for(let n=0;n<a.length;n++){let h=a[n];if(!h)continue;let{name:g,fn:_}=h,{x:v,y,data:b,reset:x}=await _({x:u,y:d,initialPlacement:r,placement:f,strategy:i,middlewareData:m,rects:l,platform:s,elements:{reference:e,floating:t}});u=v??u,d=y??d,m[g]={...m[g],...b},x&&p<fs&&(p++,typeof x==`object`&&(x.placement&&(f=x.placement),x.rects&&(l=x.rects===!0?await o.getElementRects({reference:e,floating:t,strategy:i}):x.rects),{x:u,y:d}=us(l,f,c)),n=-1)}return{x:u,y:d,placement:f,strategy:i,middlewareData:m}},ms=e=>({name:`arrow`,options:e,async fn(t){let{x:n,y:r,placement:i,rects:a,platform:o,elements:s,middlewareData:c}=t,{element:l,padding:u=0}=Wo(e,t)||{};if(l==null)return{};let d=cs(u),f={x:n,y:r},p=Xo(i),m=Jo(p),h=await o.getDimensions(l),g=p===`y`,_=g?`top`:`left`,v=g?`bottom`:`right`,y=g?`clientHeight`:`clientWidth`,b=a.reference[m]+a.reference[p]-f[p]-a.floating[m],x=f[p]-a.reference[p],S=await(o.getOffsetParent==null?void 0:o.getOffsetParent(l)),C=S?S[y]:0;(!C||!await(o.isElement==null?void 0:o.isElement(S)))&&(C=s.floating[y]||a.floating[m]);let w=b/2-x/2,T=C/2-h[m]/2-1,E=Lo(d[_],T),D=Lo(d[v],T),O=C-h[m]-D,k=C/2-h[m]/2+w,ee=Uo(E,k,O),te=!c.arrow&&Ko(i)!=null&&k!==ee&&a.reference[m]/2-(k<E?E:D)-h[m]/2<0,A=te?k<E?k-E:k-O:0;return{[p]:f[p]+A,data:{[p]:ee,centerOffset:k-ee-A,...te&&{alignmentOffset:A}},reset:te}}}),hs=function(e){return e===void 0&&(e={}),{name:`flip`,options:e,async fn(t){var n;let{placement:r,middlewareData:i,rects:a,initialPlacement:o,platform:s,elements:c}=t,{mainAxis:l=!0,crossAxis:u=!0,fallbackPlacements:d,fallbackStrategy:f=`bestFit`,fallbackAxisSideDirection:p=`none`,flipAlignment:m=!0,...h}=Wo(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};let g=Go(r),_=Yo(o),v=Go(o)===o,y=await(s.isRTL==null?void 0:s.isRTL(c.floating)),b=d||(v||!m?[os(o)]:Qo(o)),x=p!==`none`;!d&&x&&b.push(...as(o,m,p,y));let S=[o,...b],C=await s.detectOverflow(t,h),w=[],T=i.flip?.overflows||[];if(l&&w.push(C[g]),u){let e=Zo(r,a,y);w.push(C[e[0]],C[e[1]])}if(T=[...T,{placement:r,overflows:w}],!w.every(e=>e<=0)){let e=(i.flip?.index||0)+1,t=S[e];if(t&&(!(u===`alignment`&&_!==Yo(t))||T.every(e=>Yo(e.placement)!==_||e.overflows[0]>0)))return{data:{index:e,overflows:T},reset:{placement:t}};let n=T.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0]?.placement;if(!n)switch(f){case`bestFit`:{let e=T.filter(e=>{if(x){let t=Yo(e.placement);return t===_||t===`y`}return!0}).map(e=>[e.placement,e.overflows.filter(e=>e>0).reduce((e,t)=>e+t,0)]).sort((e,t)=>e[1]-t[1])[0]?.[0];e&&(n=e);break}case`initialPlacement`:n=o;break}if(r!==n)return{reset:{placement:n}}}return{}}}};function gs(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function _s(e){return Io.some(t=>e[t]>=0)}var vs=function(e){return e===void 0&&(e={}),{name:`hide`,options:e,async fn(t){let{rects:n,platform:r}=t,{strategy:i=`referenceHidden`,...a}=Wo(e,t);switch(i){case`referenceHidden`:{let e=gs(await r.detectOverflow(t,{...a,elementContext:`reference`}),n.reference);return{data:{referenceHiddenOffsets:e,referenceHidden:_s(e)}}}case`escaped`:{let e=gs(await r.detectOverflow(t,{...a,altBoundary:!0}),n.floating);return{data:{escapedOffsets:e,escaped:_s(e)}}}default:return{}}}}},ys=new Set([`left`,`top`]);async function bs(e,t){let{placement:n,platform:r,elements:i}=e,a=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=Go(n),s=Ko(n),c=Yo(n)===`y`,l=ys.has(o)?-1:1,u=a&&c?-1:1,d=Wo(t,e),{mainAxis:f,crossAxis:p,alignmentAxis:m}=typeof d==`number`?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return s&&typeof m==`number`&&(p=s===`end`?m*-1:m),c?{x:p*u,y:f*l}:{x:f*l,y:p*u}}var xs=function(e){return e===void 0&&(e=0),{name:`offset`,options:e,async fn(t){var n;let{x:r,y:i,placement:a,middlewareData:o}=t,s=await bs(t,e);return a===o.offset?.placement&&(n=o.arrow)!=null&&n.alignmentOffset?{}:{x:r+s.x,y:i+s.y,data:{...s,placement:a}}}}},Ss=function(e){return e===void 0&&(e={}),{name:`shift`,options:e,async fn(t){let{x:n,y:r,placement:i,platform:a}=t,{mainAxis:o=!0,crossAxis:s=!1,limiter:c={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...l}=Wo(e,t),u={x:n,y:r},d=await a.detectOverflow(t,l),f=Yo(i),p=qo(f),m=u[p],h=u[f],g=(e,t)=>Uo(t+d[e===`y`?`top`:`left`],t,t-d[e===`y`?`bottom`:`right`]);o&&(m=g(p,m)),s&&(h=g(f,h));let _=c.fn({...t,[p]:m,[f]:h});return{..._,data:{x:_.x-n,y:_.y-r,enabled:{[p]:o,[f]:s}}}}}},Cs=function(e){return e===void 0&&(e={}),{options:e,fn(t){let{x:n,y:r,placement:i,rects:a,middlewareData:o}=t,{offset:s=0,mainAxis:c=!0,crossAxis:l=!0}=Wo(e,t),u={x:n,y:r},d=Yo(i),f=qo(d),p=u[f],m=u[d],h=Wo(s,t),g=typeof h==`number`?{mainAxis:h,crossAxis:0}:{mainAxis:h.mainAxis??0,crossAxis:h.crossAxis??0};if(c){let e=f===`y`?`height`:`width`,t=a.reference[f]-a.floating[e]+g.mainAxis,n=a.reference[f]+a.reference[e]-g.mainAxis;p<t?p=t:p>n&&(p=n)}if(l){let e=f===`y`?`width`:`height`,t=ys.has(Go(i)),n=a.reference[d]-a.floating[e]+(t&&o.offset?.[d]||0)+(t?0:g.crossAxis),r=a.reference[d]+a.reference[e]+(t?0:o.offset?.[d]||0)-(t?g.crossAxis:0);m<n?m=n:m>r&&(m=r)}return{[f]:p,[d]:m}}}},ws=function(e){return e===void 0&&(e={}),{name:`size`,options:e,async fn(t){let{placement:n,rects:r,platform:i,elements:a}=t,{apply:o=()=>{},...s}=Wo(e,t),c=await i.detectOverflow(t,s),l=Go(n),u=Ko(n),d=Yo(n)===`y`,{width:f,height:p}=r.floating,m,h;l===`top`||l===`bottom`?(m=l,h=u===(await(i.isRTL==null?void 0:i.isRTL(a.floating))?`start`:`end`)?`left`:`right`):(h=l,m=u===`end`?`top`:`bottom`);let g=p-c.top-c.bottom,_=f-c.left-c.right,v=Lo(p-c[m],g),y=Lo(f-c[h],_),b=t.middlewareData.shift,x=!b,S=v,C=y;b!=null&&b.enabled.x&&(C=_),b!=null&&b.enabled.y&&(S=g),x&&!u&&(d?C=f-2*Ro(c.left,c.right):S=p-2*Ro(c.top,c.bottom)),await o({...t,availableWidth:C,availableHeight:S});let w=await i.getDimensions(a.floating);return f!==w.width||p!==w.height?{reset:{rects:!0}}:{}}}};function Ts(){return typeof window<`u`}function Es(e){return ks(e)?(e.nodeName||``).toLowerCase():`#document`}function Ds(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Os(e){return((ks(e)?e.ownerDocument:e.document)||window.document)?.documentElement}function ks(e){return Ts()?e instanceof Node||e instanceof Ds(e).Node:!1}function As(e){return Ts()?e instanceof Element||e instanceof Ds(e).Element:!1}function js(e){return Ts()?e instanceof HTMLElement||e instanceof Ds(e).HTMLElement:!1}function Ms(e){return!Ts()||typeof ShadowRoot>`u`?!1:e instanceof ShadowRoot||e instanceof Ds(e).ShadowRoot}function Ns(e){let{overflow:t,overflowX:n,overflowY:r,display:i}=Ws(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&i!==`inline`&&i!==`contents`}function Ps(e){return/^(table|td|th)$/.test(Es(e))}function Fs(e){try{if(e.matches(`:popover-open`))return!0}catch{}try{return e.matches(`:modal`)}catch{return!1}}var Is=/transform|translate|scale|rotate|perspective|filter/,Ls=/paint|layout|strict|content/,Rs=e=>!!e&&e!==`none`,zs;function Bs(e){let t=As(e)?Ws(e):e;return Rs(t.transform)||Rs(t.translate)||Rs(t.scale)||Rs(t.rotate)||Rs(t.perspective)||!Hs()&&(Rs(t.backdropFilter)||Rs(t.filter))||Is.test(t.willChange||``)||Ls.test(t.contain||``)}function Vs(e){let t=Ks(e);for(;js(t)&&!Us(t);){if(Bs(t))return t;if(Fs(t))return null;t=Ks(t)}return null}function Hs(){return zs??=typeof CSS<`u`&&CSS.supports&&CSS.supports(`-webkit-backdrop-filter`,`none`),zs}function Us(e){return/^(html|body|#document)$/.test(Es(e))}function Ws(e){return Ds(e).getComputedStyle(e)}function Gs(e){return As(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Ks(e){if(Es(e)===`html`)return e;let t=e.assignedSlot||e.parentNode||Ms(e)&&e.host||Os(e);return Ms(t)?t.host:t}function qs(e){let t=Ks(e);return Us(t)?(e.ownerDocument||e).body:js(t)&&Ns(t)?t:qs(t)}function Js(e,t,n){t===void 0&&(t=[]),n===void 0&&(n=!0);let r=qs(e),i=r===e.ownerDocument?.body,a=Ds(r);if(i){let e=Ys(a);return t.concat(a,a.visualViewport||[],Ns(r)?r:[],e&&n?Js(e):[])}else return t.concat(r,Js(r,[],n))}function Ys(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function Xs(e){let t=Ws(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,i=js(e),a=i?e.offsetWidth:n,o=i?e.offsetHeight:r,s=zo(n)!==a||zo(r)!==o;return s&&(n=a,r=o),{width:n,height:r,$:s}}function Zs(e){return As(e)?e:e.contextElement}function Qs(e){let t=Zs(e);if(!js(t))return Vo(1);let n=t.getBoundingClientRect(),{width:r,height:i,$:a}=Xs(t),o=(a?zo(n.width):n.width)/r,s=(a?zo(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!s||!Number.isFinite(s))&&(s=1),{x:o,y:s}}var $s=Vo(0);function ec(e){let t=Ds(e);return!Hs()||!t.visualViewport?$s:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function tc(e,t,n){return t===void 0&&(t=!1),!!n&&t&&n===Ds(e)}function nc(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);let i=e.getBoundingClientRect(),a=Zs(e),o=Vo(1);t&&(r?As(r)&&(o=Qs(r)):o=Qs(e));let s=tc(a,n,r)?ec(a):Vo(0),c=(i.left+s.x)/o.x,l=(i.top+s.y)/o.y,u=i.width/o.x,d=i.height/o.y;if(a&&r){let e=Ds(a),t=As(r)?Ds(r):r,n=e,i=Ys(n);for(;i&&t!==n;){let e=Qs(i),t=i.getBoundingClientRect(),r=Ws(i),a=t.left+(i.clientLeft+parseFloat(r.paddingLeft))*e.x,o=t.top+(i.clientTop+parseFloat(r.paddingTop))*e.y;c*=e.x,l*=e.y,u*=e.x,d*=e.y,c+=a,l+=o,n=Ds(i),i=Ys(n)}}return ls({width:u,height:d,x:c,y:l})}function rc(e,t){let n=Gs(e).scrollLeft;return t?t.left+n:nc(Os(e)).left+n}function ic(e,t){let n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-rc(e,n),y:n.top+t.scrollTop}}function ac(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e,a=i===`fixed`,o=Os(r),s=t?Fs(t.floating):!1;if(r===o||s&&a)return n;let c={scrollLeft:0,scrollTop:0},l=Vo(1),u=Vo(0),d=js(r);if((d||!a)&&((Es(r)!==`body`||Ns(o))&&(c=Gs(r)),d)){let e=nc(r);l=Qs(r),u.x=e.x+r.clientLeft,u.y=e.y+r.clientTop}let f=o&&!d&&!a?ic(o,c):Vo(0);return{width:n.width*l.x,height:n.height*l.y,x:n.x*l.x-c.scrollLeft*l.x+u.x+f.x,y:n.y*l.y-c.scrollTop*l.y+u.y+f.y}}function oc(e){return e.getClientRects?Array.from(e.getClientRects()):[]}function sc(e){let t=Gs(e),n=e.ownerDocument.body,r=Ro(e.scrollWidth,e.clientWidth,n.scrollWidth,n.clientWidth),i=Ro(e.scrollHeight,e.clientHeight,n.scrollHeight,n.clientHeight),a=-t.scrollLeft+rc(e),o=-t.scrollTop;return Ws(n).direction===`rtl`&&(a+=Ro(e.clientWidth,n.clientWidth)-r),{width:r,height:i,x:a,y:o}}var cc=25;function lc(e,t,n){n===void 0&&(n=`viewport`);let r=n===`layoutViewport`,i=Ds(e),a=Os(e),o=i.visualViewport,s=a.clientWidth,c=a.clientHeight,l=0,u=0;if(o){let e=!Hs()||t===`fixed`;r?e||(l=-o.offsetLeft,u=-o.offsetTop):(s=o.width,c=o.height,e&&(l=o.offsetLeft,u=o.offsetTop))}if(rc(a)<=0){let e=a.ownerDocument,t=e.body,n=getComputedStyle(t),r=e.compatMode===`CSS1Compat`&&parseFloat(n.marginLeft)+parseFloat(n.marginRight)||0,i=Math.abs(a.clientWidth-t.clientWidth-r),o=getComputedStyle(a).scrollbarGutter===`stable both-edges`?i/2:i;o<=cc&&(s-=o)}return{width:s,height:c,x:l,y:u}}function uc(e,t){let n=nc(e,!0,t===`fixed`),r=n.top+e.clientTop,i=n.left+e.clientLeft,a=Qs(e);return{width:e.clientWidth*a.x,height:e.clientHeight*a.y,x:i*a.x,y:r*a.y}}function dc(e,t,n){let r;if(t===`viewport`||t===`layoutViewport`)r=lc(e,n,t);else if(t===`document`)r=sc(Os(e));else if(As(t))r=uc(t,n);else{let n=ec(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return ls(r)}function fc(e,t){let n=t.get(e);if(n)return n;let r=Js(e,[],!1).filter(e=>As(e)&&Es(e)!==`body`),i=null,a=Ws(e).position===`fixed`,o=a?Ks(e):e;for(;As(o)&&!Us(o);){let e=Ws(o),t=Bs(o),n=i?i.position:a?`fixed`:``;!t&&(n===`fixed`||n===`absolute`&&e.position===`static`)?r=r.filter(e=>e!==o):i=e,o=Ks(o)}return t.set(e,r),r}function pc(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e,a=[...n===`clippingAncestors`?Fs(t)?[]:fc(t,this._c):[].concat(n),r],o=dc(t,a[0],i),s=o.top,c=o.right,l=o.bottom,u=o.left;for(let e=1;e<a.length;e++){let n=dc(t,a[e],i);s=Ro(n.top,s),c=Lo(n.right,c),l=Lo(n.bottom,l),u=Ro(n.left,u)}return{width:c-u,height:l-s,x:u,y:s}}function mc(e){let{width:t,height:n}=Xs(e);return{width:t,height:n}}function hc(e,t,n){let r=js(t),i=Os(t),a=n===`fixed`,o=nc(e,!0,a,t),s={scrollLeft:0,scrollTop:0},c=Vo(0);if((r||!a)&&((Es(t)!==`body`||Ns(i))&&(s=Gs(t)),r)){let e=nc(t,!0,a,t);c.x=e.x+t.clientLeft,c.y=e.y+t.clientTop}!r&&i&&(c.x=rc(i));let l=i&&!r&&!a?ic(i,s):Vo(0);return{x:o.left+s.scrollLeft-c.x-l.x,y:o.top+s.scrollTop-c.y-l.y,width:o.width,height:o.height}}function gc(e){return Ws(e).position===`static`}function _c(e,t){if(!js(e)||Ws(e).position===`fixed`)return null;if(t)return t(e);let n=e.offsetParent;return Os(e)===n&&(n=n.ownerDocument.body),n}function vc(e,t){let n=Ds(e);if(Fs(e))return n;if(!js(e)){let t=Ks(e);for(;t&&!Us(t);){if(As(t)&&!gc(t))return t;t=Ks(t)}return n}let r=_c(e,t);for(;r&&Ps(r)&&gc(r);)r=_c(r,t);return r&&Us(r)&&gc(r)&&!Bs(r)?n:r||Vs(e)||n}var yc=async function(e){let t=this.getOffsetParent||vc,n=this.getDimensions,r=await n(e.floating);return{reference:hc(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function bc(e){return Ws(e).direction===`rtl`}var xc={convertOffsetParentRelativeRectToViewportRelativeRect:ac,getDocumentElement:Os,getClippingRect:pc,getOffsetParent:vc,getElementRects:yc,getClientRects:oc,getDimensions:mc,getScale:Qs,isElement:As,isRTL:bc};function Sc(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function Cc(e,t,n){let r=null,i,a=Os(e);function o(){var e;clearTimeout(i),(e=r)==null||e.disconnect(),r=null}function s(n,c){n===void 0&&(n=!1),c===void 0&&(c=1),o();let l=e.getBoundingClientRect(),{left:u,top:d,width:f,height:p}=l;if(n||t(),!f||!p)return;let m=Bo(d),h=Bo(a.clientWidth-(u+f)),g=Bo(a.clientHeight-(d+p)),_=Bo(u),v={rootMargin:-m+`px `+-h+`px `+-g+`px `+-_+`px`,threshold:Ro(0,Lo(1,c))||1},y=!0;function b(t){let n=t[0].intersectionRatio;if(!Sc(l,e.getBoundingClientRect()))return s();if(n!==c){if(!y)return s();n?s(!1,n):i=setTimeout(()=>{s(!1,1e-7)},1e3)}y=!1}try{r=new IntersectionObserver(b,{...v,root:a.ownerDocument})}catch{r=new IntersectionObserver(b,v)}r.observe(e)}let c=Ds(e),l=()=>s(n);return c.addEventListener(`resize`,l),s(!0),()=>{c.removeEventListener(`resize`,l),o()}}function wc(e,t,n,r){r===void 0&&(r={});let{ancestorScroll:i=!0,ancestorResize:a=!0,elementResize:o=typeof ResizeObserver==`function`,layoutShift:s=typeof IntersectionObserver==`function`,animationFrame:c=!1}=r,l=Zs(e),u=i||a?[...l?Js(l):[],...t?Js(t):[]]:[];u.forEach(e=>{i&&e.addEventListener(`scroll`,n),a&&e.addEventListener(`resize`,n)});let d=l&&s?Cc(l,n,a):null,f=-1,p=null;o&&(p=new ResizeObserver(e=>{let[r]=e;r&&r.target===l&&p&&t&&(p.unobserve(t),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var e;(e=p)==null||e.observe(t)})),n()}),l&&!c&&p.observe(l),t&&p.observe(t));let m,h=c?nc(e):null;c&&g();function g(){let t=nc(e);h&&!Sc(h,t)&&n(),h=t,m=requestAnimationFrame(g)}return n(),()=>{var e;u.forEach(e=>{i&&e.removeEventListener(`scroll`,n),a&&e.removeEventListener(`resize`,n)}),d?.(),(e=p)==null||e.disconnect(),p=null,c&&cancelAnimationFrame(m)}}var Tc=xs,Ec=Ss,Dc=hs,Oc=ws,kc=vs,Ac=ms,jc=Cs,Mc=(e,t,n)=>{let r=new Map,i=n??{},a={...xc,...i.platform,_c:r};return ps(e,t,{...i,platform:a})},Nc=typeof document<`u`?B.useLayoutEffect:function(){};function Pc(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e==`function`&&e.toString()===t.toString())return!0;let n,r,i;if(e&&t&&typeof e==`object`){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!Pc(e[r],t[r]))return!1;return!0}if(i=Object.keys(e),n=i.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,i[r]))return!1;for(r=n;r--!==0;){let n=i[r];if(!(n===`_owner`&&e.$$typeof)&&!Pc(e[n],t[n]))return!1}return!0}return e!==e&&t!==t}function Fc(e){return typeof window>`u`?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Ic(e,t){let n=Fc(e);return Math.round(t*n)/n}function Lc(e){let t=B.useRef(e);return Nc(()=>{t.current=e}),t}function Rc(e){e===void 0&&(e={});let{placement:t=`bottom`,strategy:n=`absolute`,middleware:r=[],platform:i,elements:{reference:a,floating:o}={},transform:s=!0,whileElementsMounted:c,open:l}=e,[u,d]=B.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[f,p]=B.useState(r);Pc(f,r)||p(r);let[m,h]=B.useState(null),[g,_]=B.useState(null),v=B.useCallback(e=>{e!==S.current&&(S.current=e,h(e))},[]),y=B.useCallback(e=>{e!==C.current&&(C.current=e,_(e))},[]),b=a||m,x=o||g,S=B.useRef(null),C=B.useRef(null),w=B.useRef(u),T=c!=null,E=Lc(c),D=Lc(i),O=Lc(l),k=B.useCallback(()=>{if(!S.current||!C.current)return;let e={placement:t,strategy:n,middleware:f};D.current&&(e.platform=D.current),Mc(S.current,C.current,e).then(e=>{let t={...e,isPositioned:O.current!==!1};ee.current&&!Pc(w.current,t)&&(w.current=t,Pi.flushSync(()=>{d(t)}))})},[f,t,n,D,O]);Nc(()=>{l===!1&&w.current.isPositioned&&(w.current.isPositioned=!1,d(e=>({...e,isPositioned:!1})))},[l]);let ee=B.useRef(!1);Nc(()=>(ee.current=!0,()=>{ee.current=!1}),[]),Nc(()=>{if(b&&(S.current=b),x&&(C.current=x),b&&x){if(E.current)return E.current(b,x,k);k()}},[b,x,k,E,T]);let te=B.useMemo(()=>({reference:S,floating:C,setReference:v,setFloating:y}),[v,y]),A=B.useMemo(()=>({reference:b,floating:x}),[b,x]),j=B.useMemo(()=>{let e={position:n,left:0,top:0};if(!A.floating)return e;let t=Ic(A.floating,u.x),r=Ic(A.floating,u.y);return s?{...e,transform:`translate(`+t+`px, `+r+`px)`,...Fc(A.floating)>=1.5&&{willChange:`transform`}}:{position:n,left:t,top:r}},[n,s,A.floating,u.x,u.y]);return B.useMemo(()=>({...u,update:k,refs:te,elements:A,floatingStyles:j}),[u,k,te,A,j])}var zc=e=>{function t(e){return{}.hasOwnProperty.call(e,`current`)}return{name:`arrow`,options:e,fn(n){let{element:r,padding:i}=typeof e==`function`?e(n):e;return r&&t(r)?r.current==null?{}:Ac({element:r.current,padding:i}).fn(n):r?Ac({element:r,padding:i}).fn(n):{}}}},Bc=(e,t)=>{let n=Tc(e);return{name:n.name,fn:n.fn,options:[e,t]}},Vc=(e,t)=>{let n=Ec(e);return{name:n.name,fn:n.fn,options:[e,t]}},Hc=(e,t)=>({fn:jc(e).fn,options:[e,t]}),Uc=(e,t)=>{let n=Dc(e);return{name:n.name,fn:n.fn,options:[e,t]}},Wc=(e,t)=>{let n=Oc(e);return{name:n.name,fn:n.fn,options:[e,t]}},Gc=(e,t)=>{let n=kc(e);return{name:n.name,fn:n.fn,options:[e,t]}},Kc=(e,t)=>{let n=zc(e);return{name:n.name,fn:n.fn,options:[e,t]}},qc=`Arrow`,Jc=B.forwardRef((e,t)=>{let{children:n,width:r=10,height:i=5,...a}=e;return(0,V.jsx)(ho.svg,{...a,ref:t,width:r,height:i,viewBox:`0 0 30 10`,preserveAspectRatio:`none`,children:e.asChild?n:(0,V.jsx)(`polygon`,{points:`0,0 30,0 15,10`})})});Jc.displayName=qc;var Yc=Jc;function Xc(e){let[t,n]=B.useState(void 0);return Mo(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});let t=new ResizeObserver(t=>{if(!Array.isArray(t)||!t.length)return;let r=t[0],i,a;if(`borderBoxSize`in r){let e=r.borderBoxSize,t=Array.isArray(e)?e[0]:e;i=t.inlineSize,a=t.blockSize}else i=e.offsetWidth,a=e.offsetHeight;n({width:i,height:a})});return t.observe(e,{box:`border-box`}),()=>t.unobserve(e)}else n(void 0)},[e]),t}var Zc=`Popper`,[Qc,$c]=eo(Zc),[el,tl]=Qc(Zc),nl=e=>{let{__scopePopper:t,children:n}=e,[r,i]=B.useState(null),[a,o]=B.useState(void 0);return(0,V.jsx)(el,{scope:t,anchor:r,onAnchorChange:i,placementState:a,setPlacementState:o,children:n})};nl.displayName=Zc;var rl=`PopperAnchor`,il=B.forwardRef((e,t)=>{let{__scopePopper:n,virtualRef:r,...i}=e,a=tl(rl,n),o=B.useRef(null),s=a.onAnchorChange,c=$a(t,B.useCallback(e=>{o.current=e,e&&s(e)},[s])),l=B.useRef(null);B.useEffect(()=>{if(!r)return;let e=l.current;l.current=r.current,e!==l.current&&s(l.current)});let u=a.placementState&&ml(a.placementState),d=u?.[0],f=u?.[1];return r?null:(0,V.jsx)(ho.div,{"data-radix-popper-side":d,"data-radix-popper-align":f,...i,ref:c})});il.displayName=rl;var al=`PopperContent`,[ol,sl]=Qc(al),cl=B.forwardRef((e,t)=>{let{__scopePopper:n,side:r=`bottom`,sideOffset:i=0,align:a=`center`,alignOffset:o=0,arrowPadding:s=0,avoidCollisions:c=!0,collisionBoundary:l=[],collisionPadding:u=0,sticky:d=`partial`,hideWhenDetached:f=!1,updatePositionStrategy:p=`optimized`,onPlaced:m,...h}=e,g=tl(al,n),[_,v]=B.useState(null),y=$a(t,v),[b,x]=B.useState(null),S=Xc(b),C=S?.width??0,w=S?.height??0,T=r+(a===`center`?``:`-`+a),E=typeof u==`number`?u:{top:0,right:0,bottom:0,left:0,...u},D=Array.isArray(l)?l:[l],O=D.length>0,k={padding:E,boundary:D.filter(fl),altBoundary:O},{refs:ee,floatingStyles:te,placement:A,isPositioned:j,middlewareData:M}=Rc({strategy:`fixed`,placement:T,whileElementsMounted:(...e)=>wc(...e,{animationFrame:p===`always`}),elements:{reference:g.anchor},middleware:[Bc({mainAxis:i+w,alignmentAxis:o}),c&&Vc({mainAxis:!0,crossAxis:!1,limiter:d===`partial`?Hc():void 0,...k}),c&&Uc({...k}),Wc({...k,apply:({elements:e,rects:t,availableWidth:n,availableHeight:r})=>{let{width:i,height:a}=t.reference,o=e.floating.style;o.setProperty(`--radix-popper-available-width`,`${n}px`),o.setProperty(`--radix-popper-available-height`,`${r}px`),o.setProperty(`--radix-popper-anchor-width`,`${i}px`),o.setProperty(`--radix-popper-anchor-height`,`${a}px`)}}),b&&Kc({element:b,padding:s}),pl({arrowWidth:C,arrowHeight:w}),f&&Gc({strategy:`referenceHidden`,...k,boundary:O?k.boundary:void 0})]}),N=g.setPlacementState;Mo(()=>(N(A),()=>{N(void 0)}),[A,N]);let[P,F]=ml(A),ne=_o(m);Mo(()=>{j&&ne?.()},[j,ne]);let re=M.arrow?.x,ie=M.arrow?.y,I=M.arrow?.centerOffset!==0,[L,R]=B.useState();return Mo(()=>{_&&R(window.getComputedStyle(_).zIndex)},[_]),(0,V.jsx)(`div`,{ref:ee.setFloating,"data-radix-popper-content-wrapper":``,style:{...te,transform:j?te.transform:`translate(0, -200%)`,minWidth:`max-content`,zIndex:L,"--radix-popper-transform-origin":[M.transformOrigin?.x,M.transformOrigin?.y].join(` `),...M.hide?.referenceHidden&&{visibility:`hidden`,pointerEvents:`none`}},dir:e.dir,children:(0,V.jsx)(ol,{scope:n,placedSide:P,placedAlign:F,onArrowChange:x,arrowX:re,arrowY:ie,shouldHideArrow:I,children:(0,V.jsx)(ho.div,{"data-side":P,"data-align":F,...h,ref:y,style:{...h.style,animation:j?void 0:`none`}})})})});cl.displayName=al;var ll=`PopperArrow`,ul={top:`bottom`,right:`left`,bottom:`top`,left:`right`},dl=B.forwardRef(function(e,t){let{__scopePopper:n,...r}=e,i=sl(ll,n),a=ul[i.placedSide];return(0,V.jsx)(`span`,{ref:i.onArrowChange,style:{position:`absolute`,left:i.arrowX,top:i.arrowY,[a]:0,transformOrigin:{top:``,right:`0 0`,bottom:`center 0`,left:`100% 0`}[i.placedSide],transform:{top:`translateY(100%)`,right:`translateY(50%) rotate(90deg) translateX(-50%)`,bottom:`rotate(180deg)`,left:`translateY(50%) rotate(-90deg) translateX(50%)`}[i.placedSide],visibility:i.shouldHideArrow?`hidden`:void 0},children:(0,V.jsx)(Yc,{...r,ref:t,style:{...r.style,display:`block`}})})});dl.displayName=ll;function fl(e){return e!==null}var pl=e=>({name:`transformOrigin`,options:e,fn(t){let{placement:n,rects:r,middlewareData:i}=t,a=i.arrow?.centerOffset!==0,o=a?0:e.arrowWidth,s=a?0:e.arrowHeight,[c,l]=ml(n),u={start:`0%`,center:`50%`,end:`100%`}[l],d=(i.arrow?.x??0)+o/2,f=(i.arrow?.y??0)+s/2,p=``,m=``;return c===`bottom`?(p=a?u:`${d}px`,m=`${-s}px`):c===`top`?(p=a?u:`${d}px`,m=`${r.floating.height+s}px`):c===`right`?(p=`${-s}px`,m=a?u:`${f}px`):c===`left`&&(p=`${r.floating.width+s}px`,m=a?u:`${f}px`),{data:{x:p,y:m}}}});function ml(e){let[t,n=`center`]=e.split(`-`);return[t,n]}var hl=nl,gl=il,_l=cl,vl=dl,yl=`Portal`,bl=B.forwardRef((e,t)=>{let{container:n,...r}=e,[i,a]=B.useState(!1);Mo(()=>a(!0),[]);let o=n||i&&globalThis?.document?.body;return o?Pi.createPortal((0,V.jsx)(ho.div,{...r,ref:t}),o):null});bl.displayName=yl;function xl(e,t){return B.useReducer((e,n)=>t[e][n]??e,e)}var Sl=e=>{let{present:t,children:n}=e,r=Cl(t),i=typeof n==`function`?n({present:r.isPresent}):B.Children.only(n),a=Tl(r.ref,Dl(i));return typeof n==`function`||r.isPresent?B.cloneElement(i,{ref:a}):null};Sl.displayName=`Presence`;function Cl(e){let[t,n]=B.useState(),r=B.useRef(null),i=B.useRef(e),a=B.useRef(`none`),o=B.useRef(void 0),[s,c]=xl(e?`mounted`:`unmounted`,{mounted:{UNMOUNT:`unmounted`,ANIMATION_OUT:`unmountSuspended`},unmountSuspended:{MOUNT:`mounted`,ANIMATION_END:`unmounted`},unmounted:{MOUNT:`mounted`}});return B.useEffect(()=>{s===`mounted`?(a.current=o.current??El(r.current),o.current=void 0):a.current=`none`},[s]),Mo(()=>{let t=r.current,n=i.current;if(n!==e){let r=a.current,s=El(t);e?(o.current=s,c(`MOUNT`)):s===`none`||t?.display===`none`?c(`UNMOUNT`):c(n&&r!==s?`ANIMATION_OUT`:`UNMOUNT`),i.current=e}},[e,c]),Mo(()=>{if(t){let e,n=t.ownerDocument.defaultView??window,o=a=>{let o=El(r.current).includes(CSS.escape(a.animationName));if(a.target===t&&o&&(c(`ANIMATION_END`),!i.current)){let r=t.style.animationFillMode;t.style.animationFillMode=`forwards`,e=n.setTimeout(()=>{t.style.animationFillMode===`forwards`&&(t.style.animationFillMode=r)})}},s=e=>{e.target===t&&(a.current=El(r.current))};return t.addEventListener(`animationstart`,s),t.addEventListener(`animationcancel`,o),t.addEventListener(`animationend`,o),()=>{n.clearTimeout(e),t.removeEventListener(`animationstart`,s),t.removeEventListener(`animationcancel`,o),t.removeEventListener(`animationend`,o)}}else c(`ANIMATION_END`)},[t,c]),{isPresent:[`mounted`,`unmountSuspended`].includes(s),ref:B.useCallback(e=>{if(e){let t=getComputedStyle(e);r.current=t,o.current=El(t)}else r.current=null;n(e)},[])}}function wl(e,t){if(typeof e==`function`)return e(t);e!=null&&(e.current=t)}function Tl(...e){let t=B.useRef(e);return t.current=e,B.useCallback(e=>{let n=t.current,r=!1,i=n.map(t=>{let n=wl(t,e);return!r&&typeof n==`function`&&(r=!0),n});if(r)return()=>{for(let e=0;e<i.length;e++){let t=i[e];typeof t==`function`?t():wl(n[e],null)}}},[])}function El(e){return e?.animationName||`none`}function Dl(e){let t=Object.getOwnPropertyDescriptor(e.props,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var Ol=B.useEffectEvent,kl=B.useInsertionEffect;function Al(e){if(typeof Ol==`function`)return Ol(e);let t=B.useRef(()=>{throw Error(`Cannot call an event handler while rendering.`)});return typeof kl==`function`?kl(()=>{t.current=e}):Mo(()=>{t.current=e}),B.useMemo(()=>((...e)=>t.current?.(...e)),[])}var jl=B.useInsertionEffect||Mo;function Ml({prop:e,defaultProp:t,onChange:n=()=>{},caller:r}){let[i,a,o]=Nl({defaultProp:t,onChange:n}),s=e!==void 0,c=s?e:i;{let t=B.useRef(e!==void 0);B.useEffect(()=>{let e=t.current;e!==s&&console.warn(`${r} is changing from ${e?`controlled`:`uncontrolled`} to ${s?`controlled`:`uncontrolled`}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),t.current=s},[s,r])}return[c,B.useCallback(t=>{if(s){let n=Pl(t)?t(e):t;n!==e&&o.current?.(n)}else a(t)},[s,e,a,o])]}function Nl({defaultProp:e,onChange:t}){let[n,r]=B.useState(e),i=B.useRef(n),a=B.useRef(t);return jl(()=>{a.current=t},[t]),B.useEffect(()=>{i.current!==n&&(a.current?.(n),i.current=n)},[n,i]),[n,r,a]}function Pl(e){return typeof e==`function`}var Fl=Object.freeze({position:`absolute`,border:0,width:1,height:1,padding:0,margin:-1,overflow:`hidden`,clip:`rect(0, 0, 0, 0)`,whiteSpace:`nowrap`,wordWrap:`normal`}),Il=`VisuallyHidden`,Ll=B.forwardRef((e,t)=>(0,V.jsx)(ho.span,{...e,ref:t,style:{...Fl,...e.style}}));Ll.displayName=Il;var Rl=Ll,[zl,Bl]=eo(`Tooltip`,[$c]),Vl=$c(),Hl=`TooltipProvider`,Ul=700,Wl=`tooltip.open`,[Gl,Kl]=zl(Hl),ql=e=>{let{__scopeTooltip:t,delayDuration:n=Ul,skipDelayDuration:r=300,disableHoverableContent:i=!1,children:a}=e,o=B.useRef(!0),s=B.useRef(!1),c=B.useRef(0);return B.useEffect(()=>{let e=c.current;return()=>window.clearTimeout(e)},[]),(0,V.jsx)(Gl,{scope:t,isOpenDelayedRef:o,delayDuration:n,onOpen:B.useCallback(()=>{r<=0||(window.clearTimeout(c.current),o.current=!1)},[r]),onClose:B.useCallback(()=>{r<=0||(window.clearTimeout(c.current),c.current=window.setTimeout(()=>o.current=!0,r))},[r]),isPointerInTransitRef:s,onPointerInTransitChange:B.useCallback(e=>{s.current=e},[]),disableHoverableContent:i,children:a})};ql.displayName=Hl;var Jl=`Tooltip`,[Yl,Xl]=zl(Jl),Zl=e=>{let{__scopeTooltip:t,children:n,open:r,defaultOpen:i,onOpenChange:a,disableHoverableContent:o,delayDuration:s}=e,c=Kl(Jl,e.__scopeTooltip),l=Vl(t),[u,d]=B.useState(null),f=Fo(),p=B.useRef(0),m=o??c.disableHoverableContent,h=s??c.delayDuration,g=B.useRef(!1),[_,v]=Ml({prop:r,defaultProp:i??!1,onChange:e=>{e?(c.onOpen(),document.dispatchEvent(new CustomEvent(Wl))):c.onClose(),a?.(e)},caller:Jl}),y=B.useMemo(()=>_?g.current?`delayed-open`:`instant-open`:`closed`,[_]),b=B.useCallback(()=>{window.clearTimeout(p.current),p.current=0,g.current=!1,v(!0)},[v]),x=B.useCallback(()=>{window.clearTimeout(p.current),p.current=0,v(!1)},[v]),S=B.useCallback(()=>{window.clearTimeout(p.current),p.current=window.setTimeout(()=>{g.current=!0,v(!0),p.current=0},h)},[h,v]);return B.useEffect(()=>()=>{p.current&&=(window.clearTimeout(p.current),0)},[]),(0,V.jsx)(hl,{...l,children:(0,V.jsx)(Yl,{scope:t,contentId:f,open:_,stateAttribute:y,trigger:u,onTriggerChange:d,onTriggerEnter:B.useCallback(()=>{c.isOpenDelayedRef.current?S():b()},[c.isOpenDelayedRef,S,b]),onTriggerLeave:B.useCallback(()=>{m?x():(window.clearTimeout(p.current),p.current=0)},[x,m]),onOpen:b,onClose:x,disableHoverableContent:m,children:n})})};Zl.displayName=Jl;var Ql=`TooltipTrigger`,$l=B.forwardRef((e,t)=>{let{__scopeTooltip:n,...r}=e,i=Xl(Ql,n),a=Kl(Ql,n),o=Vl(n),s=$a(t,B.useRef(null),i.onTriggerChange),c=B.useRef(!1),l=B.useRef(!1),u=B.useCallback(()=>c.current=!1,[]);return B.useEffect(()=>()=>document.removeEventListener(`pointerup`,u),[u]),(0,V.jsx)(gl,{asChild:!0,...o,children:(0,V.jsx)(ho.button,{"aria-describedby":i.open?i.contentId:void 0,"data-state":i.stateAttribute,...r,ref:s,onPointerMove:Xa(e.onPointerMove,e=>{e.pointerType!==`touch`&&!l.current&&!a.isPointerInTransitRef.current&&(i.onTriggerEnter(),l.current=!0)}),onPointerLeave:Xa(e.onPointerLeave,()=>{i.onTriggerLeave(),l.current=!1}),onPointerDown:Xa(e.onPointerDown,()=>{i.open&&i.onClose(),c.current=!0,document.addEventListener(`pointerup`,u,{once:!0})}),onFocus:Xa(e.onFocus,()=>{c.current||i.onOpen()}),onBlur:Xa(e.onBlur,i.onClose),onClick:Xa(e.onClick,i.onClose)})})});$l.displayName=Ql;var eu=`TooltipPortal`,[tu,nu]=zl(eu,{forceMount:void 0}),ru=e=>{let{__scopeTooltip:t,forceMount:n,children:r,container:i}=e,a=Xl(eu,t);return(0,V.jsx)(tu,{scope:t,forceMount:n,children:(0,V.jsx)(Sl,{present:n||a.open,children:(0,V.jsx)(bl,{asChild:!0,container:i,children:r})})})};ru.displayName=eu;var iu=`TooltipContent`,au=B.forwardRef((e,t)=>{let n=nu(iu,e.__scopeTooltip),{forceMount:r=n.forceMount,side:i=`top`,...a}=e,o=Xl(iu,e.__scopeTooltip);return(0,V.jsx)(Sl,{present:r||o.open,children:o.disableHoverableContent?(0,V.jsx)(uu,{side:i,...a,ref:t}):(0,V.jsx)(ou,{side:i,...a,ref:t})})}),ou=B.forwardRef((e,t)=>{let n=Xl(iu,e.__scopeTooltip),r=Kl(iu,e.__scopeTooltip),i=B.useRef(null),a=$a(t,i),[o,s]=B.useState(null),{trigger:c,onClose:l}=n,u=i.current,{onPointerInTransitChange:d}=r,f=B.useCallback(()=>{s(null),d(!1)},[d]),p=B.useCallback((e,t)=>{let n=e.currentTarget,r={x:e.clientX,y:e.clientY},i=mu(r,pu(r,n.getBoundingClientRect())),a=hu(t.getBoundingClientRect()),o=_u([...i,...a]);s(o),d(!0)},[d]);return B.useEffect(()=>()=>f(),[f]),B.useEffect(()=>{if(c&&u){let e=e=>p(e,u),t=e=>p(e,c);return c.addEventListener(`pointerleave`,e),u.addEventListener(`pointerleave`,t),()=>{c.removeEventListener(`pointerleave`,e),u.removeEventListener(`pointerleave`,t)}}},[c,u,p,f]),B.useEffect(()=>{if(o){let e=e=>{let t=e.target,n={x:e.clientX,y:e.clientY},r=c?.contains(t)||u?.contains(t),i=!gu(n,o);r?f():i&&(f(),l())};return document.addEventListener(`pointermove`,e),()=>document.removeEventListener(`pointermove`,e)}},[c,u,o,l,f]),(0,V.jsx)(uu,{...e,ref:a})}),[su,cu]=zl(Jl,{isInside:!1}),lu=io(`TooltipContent`),uu=B.forwardRef((e,t)=>{let{__scopeTooltip:n,children:r,"aria-label":i,onEscapeKeyDown:a,onPointerDownOutside:o,...s}=e,c=Xl(iu,n),l=Vl(n),{onClose:u}=c;return B.useEffect(()=>(document.addEventListener(Wl,u),()=>document.removeEventListener(Wl,u)),[u]),B.useEffect(()=>{if(c.trigger){let e=e=>{e.target instanceof Node&&e.target.contains(c.trigger)&&u()};return window.addEventListener(`scroll`,e,{capture:!0}),()=>window.removeEventListener(`scroll`,e,{capture:!0})}},[c.trigger,u]),(0,V.jsx)(wo,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:a,onPointerDownOutside:o,onFocusOutside:e=>e.preventDefault(),onDismiss:u,children:(0,V.jsxs)(_l,{"data-state":c.stateAttribute,...l,...s,ref:t,style:{...s.style,"--radix-tooltip-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-tooltip-content-available-width":`var(--radix-popper-available-width)`,"--radix-tooltip-content-available-height":`var(--radix-popper-available-height)`,"--radix-tooltip-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-tooltip-trigger-height":`var(--radix-popper-anchor-height)`},children:[(0,V.jsx)(lu,{children:r}),(0,V.jsx)(su,{scope:n,isInside:!0,children:(0,V.jsx)(Rl,{id:c.contentId,role:`tooltip`,children:i||r})})]})})});au.displayName=iu;var du=`TooltipArrow`,fu=B.forwardRef((e,t)=>{let{__scopeTooltip:n,...r}=e,i=Vl(n);return cu(du,n).isInside?null:(0,V.jsx)(vl,{...i,...r,ref:t})});fu.displayName=du;function pu(e,t){let n=Math.abs(t.top-e.y),r=Math.abs(t.bottom-e.y),i=Math.abs(t.right-e.x),a=Math.abs(t.left-e.x);switch(Math.min(n,r,i,a)){case a:return`left`;case i:return`right`;case n:return`top`;case r:return`bottom`;default:throw Error(`unreachable`)}}function mu(e,t,n=5){let r=[];switch(t){case`top`:r.push({x:e.x-n,y:e.y+n},{x:e.x+n,y:e.y+n});break;case`bottom`:r.push({x:e.x-n,y:e.y-n},{x:e.x+n,y:e.y-n});break;case`left`:r.push({x:e.x+n,y:e.y-n},{x:e.x+n,y:e.y+n});break;case`right`:r.push({x:e.x-n,y:e.y-n},{x:e.x-n,y:e.y+n});break}return r}function hu(e){let{top:t,right:n,bottom:r,left:i}=e;return[{x:i,y:t},{x:n,y:t},{x:n,y:r},{x:i,y:r}]}function gu(e,t){let{x:n,y:r}=e,i=!1;for(let e=0,a=t.length-1;e<t.length;a=e++){let o=t[e],s=t[a],c=o.x,l=o.y,u=s.x,d=s.y;l>r!=d>r&&n<(u-c)*(r-l)/(d-l)+c&&(i=!i)}return i}function _u(e){let t=e.slice();return t.sort((e,t)=>e.x<t.x?-1:e.x>t.x?1:e.y<t.y?-1:+(e.y>t.y)),vu(t)}function vu(e){if(e.length<=1)return e.slice();let t=[];for(let n=0;n<e.length;n++){let r=e[n];for(;t.length>=2;){let e=t[t.length-1],n=t[t.length-2];if((e.x-n.x)*(r.y-n.y)>=(e.y-n.y)*(r.x-n.x))t.pop();else break}t.push(r)}t.pop();let n=[];for(let t=e.length-1;t>=0;t--){let r=e[t];for(;n.length>=2;){let e=n[n.length-1],t=n[n.length-2];if((e.x-t.x)*(r.y-t.y)>=(e.y-t.y)*(r.x-t.x))n.pop();else break}n.push(r)}return n.pop(),t.length===1&&n.length===1&&t[0].x===n[0].x&&t[0].y===n[0].y?t:t.concat(n)}var yu=ql,bu=Zl,xu=$l,Su=ru,Cu=au;function wu(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=wu(e[t]))&&(r&&(r+=` `),r+=n)}else for(n in e)e[n]&&(r&&(r+=` `),r+=n);return r}function Tu(){for(var e,t,n=0,r=``,i=arguments.length;n<i;n++)(e=arguments[n])&&(t=wu(e))&&(r&&(r+=` `),r+=t);return r}var Eu=(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},Du=(e,t)=>({classGroupId:e,validator:t}),Ou=(e=new Map,t=null,n)=>({nextPart:e,validators:t,classGroupId:n}),ku=`-`,Au=[],ju=`arbitrary..`,Mu=e=>{let t=Fu(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:e=>{if(e.startsWith(`[`)&&e.endsWith(`]`))return Pu(e);let n=e.split(ku);return Nu(n,+(n[0]===``&&n.length>1),t)},getConflictingClassGroupIds:(e,t)=>{if(t){let t=r[e],i=n[e];return t?i?Eu(i,t):t:i||Au}return n[e]||Au}}},Nu=(e,t,n)=>{if(e.length-t===0)return n.classGroupId;let r=e[t],i=n.nextPart.get(r);if(i){let n=Nu(e,t+1,i);if(n)return n}let a=n.validators;if(a===null)return;let o=t===0?e.join(ku):e.slice(t).join(ku),s=a.length;for(let e=0;e<s;e++){let t=a[e];if(t.validator(o))return t.classGroupId}},Pu=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?ju+r:void 0})(),Fu=e=>{let{theme:t,classGroups:n}=e;return Iu(n,t)},Iu=(e,t)=>{let n=Ou();for(let r in e){let i=e[r];Lu(i,n,r,t)}return n},Lu=(e,t,n,r)=>{let i=e.length;for(let a=0;a<i;a++){let i=e[a];Ru(i,t,n,r)}},Ru=(e,t,n,r)=>{if(typeof e==`string`){zu(e,t,n);return}if(typeof e==`function`){Bu(e,t,n,r);return}Vu(e,t,n,r)},zu=(e,t,n)=>{let r=e===``?t:Hu(t,e);r.classGroupId=n},Bu=(e,t,n,r)=>{if(Uu(e)){Lu(e(r),t,n,r);return}t.validators===null&&(t.validators=[]),t.validators.push(Du(n,e))},Vu=(e,t,n,r)=>{let i=Object.entries(e),a=i.length;for(let e=0;e<a;e++){let[a,o]=i[e];Lu(o,Hu(t,a),n,r)}},Hu=(e,t)=>{let n=e,r=t.split(ku),i=r.length;for(let e=0;e<i;e++){let t=r[e],i=n.nextPart.get(t);i||(i=Ou(),n.nextPart.set(t,i)),n=i}return n},Uu=e=>`isThemeGetter`in e&&e.isThemeGetter===!0,Wu=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)}}},Gu=`!`,Ku=`:`,qu=[],Ju=(e,t,n,r,i)=>({modifiers:e,hasImportantModifier:t,baseClassName:n,maybePostfixModifierPosition:r,isExternal:i}),Yu=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===Ku){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(Gu)?(c=s.slice(0,-1),l=!0):s.startsWith(Gu)&&(c=s.slice(1),l=!0);let u=a&&a>i?a-i:void 0;return Ju(t,l,c,u)};if(t){let e=t+Ku,n=r;r=t=>t.startsWith(e)?n(t.slice(e.length)):Ju(qu,!1,t,void 0,!0)}if(n){let e=r;r=t=>n({className:t,parseClassName:e})}return r},Xu=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}},Zu=e=>({cache:Wu(e.cacheSize),parseClassName:Yu(e),sortModifiers:Xu(e),postfixLookupClassGroupIds:Qu(e),...Mu(e)}),Qu=e=>{let t=Object.create(null),n=e.postfixLookupClassGroups;if(n)for(let e=0;e<n.length;e++)t[n[e]]=!0;return t},$u=/\s+/,ed=(e,t)=>{let{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:i,sortModifiers:a,postfixLookupClassGroupIds:o}=t,s=[],c=e.trim().split($u),l=``;for(let e=c.length-1;e>=0;--e){let t=c[e],{isExternal:u,modifiers:d,hasImportantModifier:f,baseClassName:p,maybePostfixModifierPosition:m}=n(t);if(u){l=t+(l.length>0?` `+l:l);continue}let h=!!m,g;if(h){g=r(p.substring(0,m));let e=g&&o[g]?r(p):void 0;e&&e!==g&&(g=e,h=!1)}else g=r(p);if(!g){if(!h){l=t+(l.length>0?` `+l:l);continue}if(g=r(p),!g){l=t+(l.length>0?` `+l:l);continue}h=!1}let _=d.length===0?``:d.length===1?d[0]:a(d).join(`:`),v=f?_+Gu:_,y=v+g;if(s.indexOf(y)>-1)continue;s.push(y);let b=i(g,h);for(let e=0;e<b.length;++e){let t=b[e];s.push(v+t)}l=t+(l.length>0?` `+l:l)}return l},td=(...e)=>{let t=0,n,r,i=``;for(;t<e.length;)(n=e[t++])&&(r=nd(n))&&(i&&(i+=` `),i+=r);return i},nd=e=>{if(typeof e==`string`)return e;let t,n=``;for(let r=0;r<e.length;r++)e[r]&&(t=nd(e[r]))&&(n&&(n+=` `),n+=t);return n},rd=(e,...t)=>{let n,r,i,a,o=o=>(n=Zu(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=ed(e,n);return i(e,a),a};return a=o,(...e)=>a(td(...e))},id=[],ad=e=>{let t=t=>t[e]||id;return t.isThemeGetter=!0,t},od=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,sd=/^\((?:(\w[\w-]*):)?(.+)\)$/i,cd=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,ld=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,ud=/\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$/,dd=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,fd=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,pd=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,md=e=>cd.test(e),U=e=>!!e&&!Number.isNaN(Number(e)),hd=e=>!!e&&Number.isInteger(Number(e)),gd=e=>e.endsWith(`%`)&&U(e.slice(0,-1)),_d=e=>ld.test(e),vd=()=>!0,yd=e=>ud.test(e)&&!dd.test(e),bd=()=>!1,xd=e=>fd.test(e),Sd=e=>pd.test(e),Cd=e=>!W(e)&&!G(e),wd=e=>e.startsWith(`@container`)&&(e[10]===`/`&&e[11]!==void 0||e[11]===`s`&&e[16]!==void 0&&e.startsWith(`-size/`,10)||e[11]===`n`&&e[18]!==void 0&&e.startsWith(`-normal/`,10)),Td=e=>Bd(e,Wd,bd),W=e=>od.test(e),Ed=e=>Bd(e,Gd,yd),Dd=e=>Bd(e,Kd,U),Od=e=>Bd(e,Jd,vd),kd=e=>Bd(e,qd,bd),Ad=e=>Bd(e,Hd,bd),jd=e=>Bd(e,Ud,Sd),Md=e=>Bd(e,Yd,xd),G=e=>sd.test(e),Nd=e=>Vd(e,Gd),Pd=e=>Vd(e,qd),Fd=e=>Vd(e,Hd),Id=e=>Vd(e,Wd),Ld=e=>Vd(e,Ud),Rd=e=>Vd(e,Yd,!0),zd=e=>Vd(e,Jd,!0),Bd=(e,t,n)=>{let r=od.exec(e);return r?r[1]?t(r[1]):n(r[2]):!1},Vd=(e,t,n=!1)=>{let r=sd.exec(e);return r?r[1]?t(r[1]):n:!1},Hd=e=>e===`position`||e===`percentage`,Ud=e=>e===`image`||e===`url`,Wd=e=>e===`length`||e===`size`||e===`bg-size`,Gd=e=>e===`length`,Kd=e=>e===`number`,qd=e=>e===`family-name`,Jd=e=>e===`number`||e===`weight`,Yd=e=>e===`shadow`,Xd=rd(()=>{let e=ad(`color`),t=ad(`font`),n=ad(`text`),r=ad(`font-weight`),i=ad(`tracking`),a=ad(`leading`),o=ad(`breakpoint`),s=ad(`container`),c=ad(`spacing`),l=ad(`radius`),u=ad(`shadow`),d=ad(`inset-shadow`),f=ad(`text-shadow`),p=ad(`drop-shadow`),m=ad(`blur`),h=ad(`perspective`),g=ad(`aspect`),_=ad(`ease`),v=ad(`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(),G,W],S=()=>[`auto`,`hidden`,`clip`,`visible`,`scroll`],C=()=>[`auto`,`contain`,`none`],w=()=>[G,W,c],T=()=>[md,`full`,`auto`,...w()],E=()=>[hd,`none`,`subgrid`,G,W],D=()=>[`auto`,{span:[`full`,hd,G,W]},hd,G,W],O=()=>[hd,`auto`,G,W],k=()=>[`auto`,`min`,`max`,`fr`,G,W],ee=()=>[`start`,`end`,`center`,`between`,`around`,`evenly`,`stretch`,`baseline`,`center-safe`,`end-safe`],te=()=>[`start`,`end`,`center`,`stretch`,`center-safe`,`end-safe`],A=()=>[`auto`,...w()],j=()=>[md,`auto`,`full`,`dvw`,`dvh`,`lvw`,`lvh`,`svw`,`svh`,`min`,`max`,`fit`,...w()],M=()=>[md,`screen`,`full`,`dvw`,`lvw`,`svw`,`min`,`max`,`fit`,...w()],N=()=>[md,`screen`,`full`,`lh`,`dvh`,`lvh`,`svh`,`min`,`max`,`fit`,...w()],P=()=>[e,G,W],F=()=>[...b(),Fd,Ad,{position:[G,W]}],ne=()=>[`no-repeat`,{repeat:[``,`x`,`y`,`space`,`round`]}],re=()=>[`auto`,`cover`,`contain`,Id,Td,{size:[G,W]}],ie=()=>[gd,Nd,Ed],I=()=>[``,`none`,`full`,l,G,W],L=()=>[``,U,Nd,Ed],R=()=>[`solid`,`dashed`,`dotted`,`double`],ae=()=>[`normal`,`multiply`,`screen`,`overlay`,`darken`,`lighten`,`color-dodge`,`color-burn`,`hard-light`,`soft-light`,`difference`,`exclusion`,`hue`,`saturation`,`color`,`luminosity`],z=()=>[U,gd,Fd,Ad],oe=()=>[``,`none`,m,G,W],se=()=>[`none`,U,G,W],ce=()=>[`none`,U,G,W],le=()=>[U,G,W],ue=()=>[md,`full`,...w()];return{cacheSize:500,theme:{animate:[`spin`,`ping`,`pulse`,`bounce`],aspect:[`video`],blur:[_d],breakpoint:[_d],color:[vd],container:[_d],"drop-shadow":[_d],ease:[`in`,`out`,`in-out`],font:[Cd],"font-weight":[`thin`,`extralight`,`light`,`normal`,`medium`,`semibold`,`bold`,`extrabold`,`black`],"inset-shadow":[_d],leading:[`none`,`tight`,`snug`,`normal`,`relaxed`,`loose`],perspective:[`dramatic`,`near`,`normal`,`midrange`,`distant`,`none`],radius:[_d],shadow:[_d],spacing:[`px`,U],text:[_d],"text-shadow":[_d],tracking:[`tighter`,`tight`,`normal`,`wide`,`wider`,`widest`]},classGroups:{aspect:[{aspect:[`auto`,`square`,md,W,G,g]}],container:[`container`],"container-type":[{"@container":[``,`normal`,`size`,G,W]}],"container-named":[wd],columns:[{columns:[U,W,G,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:[{"inset-s":T(),start:T()}],end:[{"inset-e":T(),end:T()}],"inset-bs":[{"inset-bs":T()}],"inset-be":[{"inset-be":T()}],top:[{top:T()}],right:[{right:T()}],bottom:[{bottom:T()}],left:[{left:T()}],visibility:[`visible`,`invisible`,`collapse`],z:[{z:[hd,`auto`,G,W]}],basis:[{basis:[md,`full`,`auto`,s,...w()]}],"flex-direction":[{flex:[`row`,`row-reverse`,`col`,`col-reverse`]}],"flex-wrap":[{flex:[`nowrap`,`wrap`,`wrap-reverse`]}],flex:[{flex:[U,md,`auto`,`initial`,`none`,W]}],grow:[{grow:[``,U,G,W]}],shrink:[{shrink:[``,U,G,W]}],order:[{order:[hd,`first`,`last`,`none`,G,W]}],"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:[...ee(),`normal`]}],"justify-items":[{"justify-items":[...te(),`normal`]}],"justify-self":[{"justify-self":[`auto`,...te()]}],"align-content":[{content:[`normal`,...ee()]}],"align-items":[{items:[...te(),{baseline:[``,`last`]}]}],"align-self":[{self:[`auto`,...te(),{baseline:[``,`last`]}]}],"place-content":[{"place-content":ee()}],"place-items":[{"place-items":[...te(),`baseline`]}],"place-self":[{"place-self":[`auto`,...te()]}],p:[{p:w()}],px:[{px:w()}],py:[{py:w()}],ps:[{ps:w()}],pe:[{pe:w()}],pbs:[{pbs:w()}],pbe:[{pbe:w()}],pt:[{pt:w()}],pr:[{pr:w()}],pb:[{pb:w()}],pl:[{pl:w()}],m:[{m:A()}],mx:[{mx:A()}],my:[{my:A()}],ms:[{ms:A()}],me:[{me:A()}],mbs:[{mbs:A()}],mbe:[{mbe:A()}],mt:[{mt:A()}],mr:[{mr:A()}],mb:[{mb:A()}],ml:[{ml:A()}],"space-x":[{"space-x":w()}],"space-x-reverse":[`space-x-reverse`],"space-y":[{"space-y":w()}],"space-y-reverse":[`space-y-reverse`],size:[{size:j()}],"inline-size":[{inline:[`auto`,...M()]}],"min-inline-size":[{"min-inline":[`auto`,...M()]}],"max-inline-size":[{"max-inline":[`none`,...M()]}],"block-size":[{block:[`auto`,...N()]}],"min-block-size":[{"min-block":[`auto`,...N()]}],"max-block-size":[{"max-block":[`none`,...N()]}],w:[{w:[s,`screen`,...j()]}],"min-w":[{"min-w":[s,`screen`,`none`,...j()]}],"max-w":[{"max-w":[s,`screen`,`none`,`prose`,{screen:[o]},...j()]}],h:[{h:[`screen`,`lh`,...j()]}],"min-h":[{"min-h":[`screen`,`lh`,`none`,...j()]}],"max-h":[{"max-h":[`screen`,`lh`,...j()]}],"font-size":[{text:[`base`,n,Nd,Ed]}],"font-smoothing":[`antialiased`,`subpixel-antialiased`],"font-style":[`italic`,`not-italic`],"font-weight":[{font:[r,zd,Od]}],"font-stretch":[{"font-stretch":[`ultra-condensed`,`extra-condensed`,`condensed`,`semi-condensed`,`normal`,`semi-expanded`,`expanded`,`extra-expanded`,`ultra-expanded`,gd,W]}],"font-family":[{font:[Pd,kd,t]}],"font-features":[{"font-features":[W]}],"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,G,W]}],"line-clamp":[{"line-clamp":[U,`none`,G,Dd]}],leading:[{leading:[a,...w()]}],"list-image":[{"list-image":[`none`,G,W]}],"list-style-position":[{list:[`inside`,`outside`]}],"list-style-type":[{list:[`disc`,`decimal`,`none`,G,W]}],"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:[...R(),`wavy`]}],"text-decoration-thickness":[{decoration:[U,`from-font`,`auto`,G,Ed]}],"text-decoration-color":[{decoration:P()}],"underline-offset":[{"underline-offset":[U,`auto`,G,W]}],"text-transform":[`uppercase`,`lowercase`,`capitalize`,`normal-case`],"text-overflow":[`truncate`,`text-ellipsis`,`text-clip`],"text-wrap":[{text:[`wrap`,`nowrap`,`balance`,`pretty`]}],indent:[{indent:w()}],"tab-size":[{tab:[hd,G,W]}],"vertical-align":[{align:[`baseline`,`top`,`middle`,`bottom`,`text-top`,`text-bottom`,`sub`,`super`,G,W]}],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`,G,W]}],"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:ne()}],"bg-size":[{bg:re()}],"bg-image":[{bg:[`none`,{linear:[{to:[`t`,`tr`,`r`,`br`,`b`,`bl`,`l`,`tl`]},hd,G,W],radial:[``,G,W],conic:[hd,G,W]},Ld,jd]}],"bg-color":[{bg:P()}],"gradient-from-pos":[{from:ie()}],"gradient-via-pos":[{via:ie()}],"gradient-to-pos":[{to:ie()}],"gradient-from":[{from:P()}],"gradient-via":[{via:P()}],"gradient-to":[{to:P()}],rounded:[{rounded:I()}],"rounded-s":[{"rounded-s":I()}],"rounded-e":[{"rounded-e":I()}],"rounded-t":[{"rounded-t":I()}],"rounded-r":[{"rounded-r":I()}],"rounded-b":[{"rounded-b":I()}],"rounded-l":[{"rounded-l":I()}],"rounded-ss":[{"rounded-ss":I()}],"rounded-se":[{"rounded-se":I()}],"rounded-ee":[{"rounded-ee":I()}],"rounded-es":[{"rounded-es":I()}],"rounded-tl":[{"rounded-tl":I()}],"rounded-tr":[{"rounded-tr":I()}],"rounded-br":[{"rounded-br":I()}],"rounded-bl":[{"rounded-bl":I()}],"border-w":[{border:L()}],"border-w-x":[{"border-x":L()}],"border-w-y":[{"border-y":L()}],"border-w-s":[{"border-s":L()}],"border-w-e":[{"border-e":L()}],"border-w-bs":[{"border-bs":L()}],"border-w-be":[{"border-be":L()}],"border-w-t":[{"border-t":L()}],"border-w-r":[{"border-r":L()}],"border-w-b":[{"border-b":L()}],"border-w-l":[{"border-l":L()}],"divide-x":[{"divide-x":L()}],"divide-x-reverse":[`divide-x-reverse`],"divide-y":[{"divide-y":L()}],"divide-y-reverse":[`divide-y-reverse`],"border-style":[{border:[...R(),`hidden`,`none`]}],"divide-style":[{divide:[...R(),`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-bs":[{"border-bs":P()}],"border-color-be":[{"border-be":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:[...R(),`none`,`hidden`]}],"outline-offset":[{"outline-offset":[U,G,W]}],"outline-w":[{outline:[``,U,Nd,Ed]}],"outline-color":[{outline:P()}],shadow:[{shadow:[``,`none`,u,Rd,Md]}],"shadow-color":[{shadow:P()}],"inset-shadow":[{"inset-shadow":[`none`,d,Rd,Md]}],"inset-shadow-color":[{"inset-shadow":P()}],"ring-w":[{ring:L()}],"ring-w-inset":[`ring-inset`],"ring-color":[{ring:P()}],"ring-offset-w":[{"ring-offset":[U,Ed]}],"ring-offset-color":[{"ring-offset":P()}],"inset-ring-w":[{"inset-ring":L()}],"inset-ring-color":[{"inset-ring":P()}],"text-shadow":[{"text-shadow":[`none`,f,Rd,Md]}],"text-shadow-color":[{"text-shadow":P()}],opacity:[{opacity:[U,G,W]}],"mix-blend":[{"mix-blend":[...ae(),`plus-darker`,`plus-lighter`]}],"bg-blend":[{"bg-blend":ae()}],"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":[U]}],"mask-image-linear-from-pos":[{"mask-linear-from":z()}],"mask-image-linear-to-pos":[{"mask-linear-to":z()}],"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":z()}],"mask-image-t-to-pos":[{"mask-t-to":z()}],"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":z()}],"mask-image-r-to-pos":[{"mask-r-to":z()}],"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":z()}],"mask-image-b-to-pos":[{"mask-b-to":z()}],"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":z()}],"mask-image-l-to-pos":[{"mask-l-to":z()}],"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":z()}],"mask-image-x-to-pos":[{"mask-x-to":z()}],"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":z()}],"mask-image-y-to-pos":[{"mask-y-to":z()}],"mask-image-y-from-color":[{"mask-y-from":P()}],"mask-image-y-to-color":[{"mask-y-to":P()}],"mask-image-radial":[{"mask-radial":[G,W]}],"mask-image-radial-from-pos":[{"mask-radial-from":z()}],"mask-image-radial-to-pos":[{"mask-radial-to":z()}],"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":[U]}],"mask-image-conic-from-pos":[{"mask-conic-from":z()}],"mask-image-conic-to-pos":[{"mask-conic-to":z()}],"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:ne()}],"mask-size":[{mask:re()}],"mask-type":[{"mask-type":[`alpha`,`luminance`]}],"mask-image":[{mask:[`none`,G,W]}],filter:[{filter:[``,`none`,G,W]}],blur:[{blur:oe()}],brightness:[{brightness:[U,G,W]}],contrast:[{contrast:[U,G,W]}],"drop-shadow":[{"drop-shadow":[``,`none`,p,Rd,Md]}],"drop-shadow-color":[{"drop-shadow":P()}],grayscale:[{grayscale:[``,U,G,W]}],"hue-rotate":[{"hue-rotate":[U,G,W]}],invert:[{invert:[``,U,G,W]}],saturate:[{saturate:[U,G,W]}],sepia:[{sepia:[``,U,G,W]}],"backdrop-filter":[{"backdrop-filter":[``,`none`,G,W]}],"backdrop-blur":[{"backdrop-blur":oe()}],"backdrop-brightness":[{"backdrop-brightness":[U,G,W]}],"backdrop-contrast":[{"backdrop-contrast":[U,G,W]}],"backdrop-grayscale":[{"backdrop-grayscale":[``,U,G,W]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[U,G,W]}],"backdrop-invert":[{"backdrop-invert":[``,U,G,W]}],"backdrop-opacity":[{"backdrop-opacity":[U,G,W]}],"backdrop-saturate":[{"backdrop-saturate":[U,G,W]}],"backdrop-sepia":[{"backdrop-sepia":[``,U,G,W]}],"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`,G,W]}],"transition-behavior":[{transition:[`normal`,`discrete`]}],duration:[{duration:[U,`initial`,G,W]}],ease:[{ease:[`linear`,`initial`,_,G,W]}],delay:[{delay:[U,G,W]}],animate:[{animate:[`none`,v,G,W]}],backface:[{backface:[`hidden`,`visible`]}],perspective:[{perspective:[h,G,W]}],"perspective-origin":[{"perspective-origin":x()}],rotate:[{rotate:se()}],"rotate-x":[{"rotate-x":se()}],"rotate-y":[{"rotate-y":se()}],"rotate-z":[{"rotate-z":se()}],scale:[{scale:ce()}],"scale-x":[{"scale-x":ce()}],"scale-y":[{"scale-y":ce()}],"scale-z":[{"scale-z":ce()}],"scale-3d":[`scale-3d`],skew:[{skew:le()}],"skew-x":[{"skew-x":le()}],"skew-y":[{"skew-y":le()}],transform:[{transform:[G,W,``,`none`,`gpu`,`cpu`]}],"transform-origin":[{origin:x()}],"transform-style":[{transform:[`3d`,`flat`]}],translate:[{translate:ue()}],"translate-x":[{"translate-x":ue()}],"translate-y":[{"translate-y":ue()}],"translate-z":[{"translate-z":ue()}],"translate-none":[`translate-none`],zoom:[{zoom:[hd,G,W]}],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`,G,W]}],"field-sizing":[{"field-sizing":[`fixed`,`content`]}],"pointer-events":[{"pointer-events":[`auto`,`none`]}],resize:[{resize:[`none`,``,`y`,`x`]}],"scroll-behavior":[{scroll:[`auto`,`smooth`]}],"scrollbar-thumb-color":[{"scrollbar-thumb":P()}],"scrollbar-track-color":[{"scrollbar-track":P()}],"scrollbar-gutter":[{"scrollbar-gutter":[`auto`,`stable`,`both`]}],"scrollbar-w":[{scrollbar:[`auto`,`thin`,`none`]}],"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-mbs":[{"scroll-mbs":w()}],"scroll-mbe":[{"scroll-mbe":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-pbs":[{"scroll-pbs":w()}],"scroll-pbe":[{"scroll-pbe":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`,G,W]}],fill:[{fill:[`none`,...P()]}],"stroke-w":[{stroke:[U,Nd,Ed,Dd]}],stroke:[{stroke:[`none`,...P()]}],"forced-color-adjust":[{"forced-color-adjust":[`auto`,`none`]}]},conflictingClassGroups:{"container-named":[`container-type`],overflow:[`overflow-x`,`overflow-y`],overscroll:[`overscroll-x`,`overscroll-y`],inset:[`inset-x`,`inset-y`,`inset-bs`,`inset-be`,`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`,`pbs`,`pbe`,`pt`,`pr`,`pb`,`pl`],px:[`pr`,`pl`],py:[`pt`,`pb`],m:[`mx`,`my`,`ms`,`me`,`mbs`,`mbe`,`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-bs`,`border-w-be`,`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-bs`,`border-color-be`,`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-mbs`,`scroll-mbe`,`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-pbs`,`scroll-pbe`,`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`]},postfixLookupClassGroups:[`container-type`],orderSensitiveModifiers:[`*`,`**`,`after`,`backdrop`,`before`,`details-content`,`file`,`first-letter`,`first-line`,`marker`,`placeholder`,`selection`]}});function K(...e){return Xd(Tu(e))}function Zd({delayDuration:e=250,...t}){return(0,V.jsx)(yu,{delayDuration:e,...t})}function Qd(e){return(0,V.jsx)(bu,{...e})}function $d(e){return(0,V.jsx)(xu,{...e})}function ef({className:e,sideOffset:t=6,...n}){return(0,V.jsx)(Su,{children:(0,V.jsx)(Cu,{sideOffset:t,className:K(`z-100 rounded-md bg-zinc-800 px-2 py-1 text-xs font-medium text-zinc-100 shadow-lg ring-1 ring-white/10`,e),...n})})}var tf=(0,B.createContext)(null),nf=(0,B.createContext)(null);function rf({children:e}){let[t,n]=(0,B.useState)(null),r=(0,B.useCallback)(e=>{n(t=>({terminalId:e,sequence:(t?.sequence??0)+1}))},[]);return(0,V.jsx)(tf,{value:r,children:(0,V.jsx)(nf,{value:t,children:e})})}function af(){let e=(0,B.useContext)(tf);if(!e)throw Error(`useRequestTerminalFocus must be used within TerminalFocusProvider`);return e}function of({terminalId:e,session:t,blocked:n}){let r=(0,B.useContext)(nf),i=(0,B.useRef)(null),a=(0,B.useRef)(0),o=(0,B.useRef)(null),s=(0,B.useRef)(e),c=(0,B.useRef)(t),l=(0,B.useRef)(n);(0,B.useLayoutEffect)(()=>{s.current=e,c.current=t,l.current=n},[n,t,e]),(0,B.useEffect)(()=>{if(i.current!==e&&(i.current=e,o.current=e),r&&a.current!==r.sequence&&(a.current=r.sequence,o.current=r.terminalId),!e||!t||t.terminalId!==e||n||o.current!==e)return;let u=window.requestAnimationFrame(()=>{l.current||s.current!==e||c.current!==t||o.current!==e||(t.focus(),o.current=null)});return()=>window.cancelAnimationFrame(u)},[n,r,t,e])}var sf=Object.defineProperty,cf=(e,t)=>sf(e,`name`,{value:t,configurable:!0});function lf(e,t){if(typeof e==`function`)return e(t);e!=null&&(e.current=t)}cf(lf,`setRef`);function uf(...e){return t=>{let n=!1,r=e.map(e=>{let r=lf(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():lf(e[t],null)}}}}cf(uf,`composeRefs`);function df(...e){return B.useCallback(uf(...e),e)}cf(df,`useComposedRefs`);var ff=Object.defineProperty,pf=(e,t)=>ff(e,`name`,{value:t,configurable:!0});function mf(e){let t=B.forwardRef((t,n)=>{let{children:r,...i}=t,a=null,o=!1,s=[];Cf(r)&&typeof Df==`function`&&(r=Df(r._payload)),B.Children.forEach(r,e=>{if(xf(e)){o=!0;let t=e,n=`child`in t.props?t.props.child:t.props.children;Cf(n)&&typeof Df==`function`&&(n=Df(n._payload)),a=vf(t,n),s.push(a?.props?.children)}else s.push(e)}),a?a=B.cloneElement(a,void 0,s):!o&&B.Children.count(r)===1&&B.isValidElement(r)&&(a=r);let c=a?bf(a):void 0,l=df(n,c);if(!a){if(r||r===0)throw Error(o?Ef(e):Tf(e));return r}let u=yf(i,a.props??{});return a.type!==B.Fragment&&(u.ref=n?l:c),B.cloneElement(a,u)});return t.displayName=`${e}.Slot`,t}pf(mf,`createSlot`);var hf=mf(`Slot`),gf=Symbol.for(`radix.slottable`);function _f(e){let t=pf(e=>`child`in e?e.children(e.child):e.children,`Slottable`);return t.displayName=`${e}.Slottable`,t.__radixId=gf,t}pf(_f,`createSlottable`);var vf=pf((e,t)=>{if(`child`in e.props){let t=e.props.child;return B.isValidElement(t)?B.cloneElement(t,void 0,e.props.children(t.props.children)):null}return B.isValidElement(t)?t:null},`getSlottableElementFromSlottable`);function yf(e,t){let n={...t};for(let r in t){let i=e[r],a=t[r];/^on[A-Z]/.test(r)?i&&a?n[r]=(...e)=>{let t=a(...e);return i(...e),t}:i&&(n[r]=i):r===`style`?n[r]={...i,...a}:r===`className`&&(n[r]=[i,a].filter(Boolean).join(` `))}return{...e,...n}}pf(yf,`mergeProps`);function bf(e){let t=Object.getOwnPropertyDescriptor(e.props,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}pf(bf,`getElementRef`);function xf(e){return B.isValidElement(e)&&typeof e.type==`function`&&`__radixId`in e.type&&e.type.__radixId===gf}pf(xf,`isSlottable`);var Sf=Symbol.for(`react.lazy`);function Cf(e){return typeof e==`object`&&!!e&&`$$typeof`in e&&e.$$typeof===Sf&&`_payload`in e&&wf(e._payload)}pf(Cf,`isLazyComponent`);function wf(e){return typeof e==`object`&&!!e&&`then`in e}pf(wf,`isPromiseLike`);var Tf=pf(e=>`${e} failed to slot onto its children. Expected a single React element child or \`Slottable\`.`,`createSlotError`),Ef=pf(e=>`${e} failed to slot onto its \`Slottable\`. Expected \`Slottable\` to receive a single React element child.`,`createSlottableError`),Df=B.use,Of=e=>typeof e==`boolean`?`${e}`:e===0?`0`:e,kf=Tu,Af=(e,t)=>n=>{if(t?.variants==null)return kf(e,n?.class,n?.className);let{variants:r,defaultVariants:i}=t,a=Object.keys(r).map(e=>{let t=n?.[e],a=i?.[e];if(t===null)return null;let o=Of(t)||Of(a);return r[e][o]}),o=n&&Object.entries(n).reduce((e,t)=>{let[n,r]=t;return r===void 0||(e[n]=r),e},{});return kf(e,a,t?.compoundVariants?.reduce((e,t)=>{let{class:n,className:r,...a}=t;return Object.entries(a).every(e=>{let[t,n]=e;return Array.isArray(n)?n.includes({...i,...o}[t]):{...i,...o}[t]===n})?[...e,n,r]:e},[]),n?.class,n?.className)},jf=Af(`relative inline-flex shrink-0 items-center justify-center gap-1.5 rounded-md text-sm font-medium whitespace-nowrap outline-none disabled:pointer-events-none disabled:opacity-45 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-cyan-400`,{variants:{variant:{default:`bg-cyan-600 text-white ring-1 ring-cyan-600 hover:bg-cyan-500 hover:ring-cyan-500`,secondary:`bg-zinc-800 text-zinc-100 ring-1 ring-white/8 hover:bg-zinc-700`,destructive:`bg-rose-700 text-white ring-1 ring-rose-700 hover:bg-rose-600`,outline:`bg-transparent text-zinc-200 ring-1 ring-white/12 hover:bg-white/6`,ghost:`bg-transparent text-zinc-400 hover:bg-white/6 hover:text-zinc-100`,link:`h-auto rounded-none p-0 text-zinc-400 hover:text-zinc-100`},size:{default:`h-9 px-3 py-2 has-[>svg:first-child]:pl-2 has-[>svg:last-child]:pr-2`,sm:`h-7 px-2.5 text-sm has-[>svg:first-child]:pl-1.5 has-[>svg:last-child]:pr-1.5`,icon:`size-9 p-0`,"icon-sm":`size-7 p-0`}},defaultVariants:{variant:`default`,size:`default`}});function q({className:e,variant:t,size:n,asChild:r=!1,...i}){return(0,V.jsx)(r?hf:`button`,{"data-slot":`button`,className:K(jf({variant:t,size:n,className:e})),...i})}var Mf=3,Nf=450,Pf=550,Ff=10;function If(e){let t=e.value===null?``:`, ${e.value}% complete`;return e.state===`error`?`progress error${t}`:e.state===`paused`?`progress paused${t}`:e.value===null?`working`:`${e.value}% complete`}function Lf(e,t=!1){if(e.type!==`keydown`||e.isComposing||e.ctrlKey)return null;if(e.key===`Enter`&&e.shiftKey&&!e.altKey&&!e.metaKey)return`\x1B[13;2u`;if(e.altKey&&!e.metaKey&&!e.shiftKey){if(Rf()){if(e.key===`ArrowLeft`)return`\x1Bb`;if(e.key===`ArrowRight`)return`\x1Bf`}else{let t={ArrowUp:`A`,ArrowDown:`B`,ArrowRight:`C`,ArrowLeft:`D`}[e.key];if(t)return`\u001b[1;5${t}`}return null}if(!e.metaKey||e.altKey||e.shiftKey)return null;let n=t?`\x1BO`:`\x1B[`;return e.key===`ArrowLeft`?`${n}H`:e.key===`ArrowRight`?`${n}F`:null}function Rf(){return typeof navigator<`u`&&/Mac|iPhone|iPad|iPod/.test(navigator.platform)}function zf(e,t){if(Rf()?!e.metaKey:!e.ctrlKey)return;let n;try{n=new URL(t)}catch{return}if(n.protocol===`file:`){let e=window.treeportDesktop?.openFileUrl(t);e&&e.catch(()=>void 0);return}(n.protocol===`http:`||n.protocol===`https:`)&&window.open(t,`_blank`,`noopener,noreferrer`)}function Bf(e,t){!t.element?.classList.contains(`enable-mouse-events`)||e.button!==0||e.altKey||e.ctrlKey||e.metaKey||e.shiftKey||Object.defineProperty(e,Rf()?`altKey`:`shiftKey`,{configurable:!0,value:!0})}function Vf(e,t,n,r,i){let a=null,o=0,s=null,c=null,l=null,u=null,d=[],f=(e,n)=>{let r=t.element;if(!r)return null;let i=r.getBoundingClientRect();return{column:Math.min(t.cols-1,Math.max(0,Math.floor((e-i.left)/i.width*t.cols))),row:t.buffer.active.viewportY+Math.min(t.rows-1,Math.max(0,Math.floor((n-i.top)/i.height*t.rows)))}},p=()=>{c!==null&&(window.clearTimeout(c),c=null)},m=()=>{u!==null&&(window.clearTimeout(u),u=null),d=[]};e.addEventListener(`wheel`,()=>{e.classList.add(`terminal-scrolling`),n()},{capture:!0,passive:!0}),e.addEventListener(`touchstart`,e=>{if(e.touches.length===2){p(),m(),a=null,o=0,s=null,l=null,d=Array.from(e.touches,e=>({identifier:e.identifier,x:e.clientX,y:e.clientY})),u=window.setTimeout(()=>{u=null,d=[],navigator.vibrate?.(10),i()},Pf);return}if(e.touches.length!==1){p(),m(),a=null,o=0,s=null,l=null;return}m();let n=e.touches[0];a=n.clientY,o=0,s={x:n.clientX,y:n.clientY},l=null,p(),c=window.setTimeout(()=>{c=null,s&&(l=f(s.x,s.y),l&&(t.select(l.column,l.row,1),navigator.vibrate?.(10)))},Nf)},{capture:!0,passive:!0}),e.addEventListener(`touchmove`,e=>{if(e.touches.length===2&&d.length===2){d.some(t=>{let n=Array.from(e.touches).find(e=>e.identifier===t.identifier);return!n||Math.hypot(n.clientX-t.x,n.clientY-t.y)>Ff})?m():e.preventDefault();return}if(e.touches.length!==1||a===null){p(),m(),a=null,o=0,s=null,l=null;return}let n=t.element;if(!n)return;let r=e.touches[0];if(l){e.preventDefault();let n=f(r.clientX,r.clientY);if(!n)return;let i=l.row*t.cols+l.column,a=n.row*t.cols+n.column,o=Math.min(i,a);t.select(o%t.cols,Math.floor(o/t.cols),Math.abs(a-i)+1);return}s&&Math.hypot(r.clientX-s.x,r.clientY-s.y)>Ff&&(p(),s=null),o+=a-r.clientY,a=r.clientY,e.preventDefault();let i=n.getBoundingClientRect(),c=(i.height/t.rows||16)*(n.classList.contains(`enable-mouse-events`)?Mf:1),u=Math.trunc(o/c);if(u===0)return;o-=u*c;let h=Math.min(Math.max(r.clientX,i.left),i.right-1),g=Math.min(Math.max(r.clientY,i.top),i.bottom-1);for(let e=0;e<Math.abs(u);e+=1)n.dispatchEvent(new WheelEvent(`wheel`,{bubbles:!0,cancelable:!0,composed:!0,clientX:h,clientY:g,deltaMode:WheelEvent.DOM_DELTA_LINE,deltaY:Math.sign(u)}))},{capture:!0,passive:!1});let h=e=>{l&&e.preventDefault(),p(),m(),a=null,o=0,s=null,l=null};e.addEventListener(`touchend`,h,{capture:!0,passive:!1}),e.addEventListener(`touchcancel`,h,{capture:!0,passive:!1}),e.addEventListener(`paste`,r,!0)}function Hf(){return{cursorBlink:!0,convertEol:!1,fontFamily:`"SFMono-Regular", "Cascadia Code", "Liberation Mono", monospace`,fontSize:14,lineHeight:1.15,scrollback:0,allowProposedApi:!1,macOptionClickForcesSelection:!0,linkHandler:{activate:zf,allowNonHttpProtocols:!0},theme:{background:`#09090b`,foreground:`#e4e4e7`,cursor:`#67e8f9`,selectionBackground:`#3f3f4666`,scrollbarSliderBackground:`#3f3f46`,scrollbarSliderHoverBackground:`#52525b`,scrollbarSliderActiveBackground:`#71717a`,black:`#18181b`,red:`#fb7185`,green:`#86efac`,yellow:`#fde047`,blue:`#7dd3fc`,magenta:`#d8b4fe`,cyan:`#67e8f9`,white:`#f4f4f5`}}}var Uf=2,Wf=1,Gf=class{activate(e){this._terminal=e}dispose(){}fit(){let e=this.proposeDimensions();if(!e||!this._terminal||isNaN(e.cols)||isNaN(e.rows))return;let t=this._terminal._core;(this._terminal.rows!==e.rows||this._terminal.cols!==e.cols)&&(t._renderService.clear(),this._terminal.resize(e.cols,e.rows))}proposeDimensions(){if(!this._terminal||!this._terminal.element||!this._terminal.element.parentElement)return;let e=this._terminal._core._renderService.dimensions;if(e.css.cell.width===0||e.css.cell.height===0)return;let t=this._terminal.options.scrollback===0?0:this._terminal.options.overviewRuler?.width||14,n=window.getComputedStyle(this._terminal.element.parentElement),r=parseInt(n.getPropertyValue(`height`)),i=Math.max(0,parseInt(n.getPropertyValue(`width`))),a=window.getComputedStyle(this._terminal.element),o={top:parseInt(a.getPropertyValue(`padding-top`)),bottom:parseInt(a.getPropertyValue(`padding-bottom`)),right:parseInt(a.getPropertyValue(`padding-right`)),left:parseInt(a.getPropertyValue(`padding-left`))},s=o.top+o.bottom,c=o.right+o.left,l=r-s,u=i-c-t;return{cols:Math.max(Uf,Math.floor(u/e.css.cell.width)),rows:Math.max(Wf,Math.floor(l/e.css.cell.height))}}},Kf=class{constructor(e,t,n,r={}){this._terminal=e,this._regex=t,this._handler=n,this._options=r}provideLinks(e,t){let n=Jf.computeLink(e,this._regex,this._terminal,this._handler);t(this._addCallbacks(n))}_addCallbacks(e){return e.map(e=>(e.leave=this._options.leave,e.hover=(t,n)=>{if(this._options.hover){let{range:r}=e;this._options.hover(t,n,r)}},e))}};function qf(e){try{let t=new URL(e),n=t.password&&t.username?`${t.protocol}//${t.username}:${t.password}@${t.host}`:t.username?`${t.protocol}//${t.username}@${t.host}`:`${t.protocol}//${t.host}`;return e.toLocaleLowerCase().startsWith(n.toLocaleLowerCase())}catch{return!1}}var Jf=class e{static computeLink(t,n,r,i){let a=new RegExp(n.source,(n.flags||``)+`g`),[o,s]=e._getWindowedLineStrings(t-1,r),c=o.join(``),l,u=[];for(;l=a.exec(c);){let t=l[0];if(!qf(t))continue;let[n,a]=e._mapStrIdx(r,s,0,l.index),[o,c]=e._mapStrIdx(r,n,a,t.length);if(n===-1||a===-1||o===-1||c===-1)continue;let d={start:{x:a+1,y:n+1},end:{x:c,y:o+1}};u.push({range:d,text:t,activate:i})}return u}static _getWindowedLineStrings(e,t){let n,r=e,i=e,a=0,o=``,s=[];if(n=t.buffer.active.getLine(e)){let e=n.translateToString(!0);if(n.isWrapped&&e[0]!==` `){for(a=0;(n=t.buffer.active.getLine(--r))&&a<2048&&(o=n.translateToString(!0),a+=o.length,s.push(o),!(!n.isWrapped||o.indexOf(` `)!==-1)););s.reverse()}for(s.push(e),a=0;(n=t.buffer.active.getLine(++i))&&n.isWrapped&&a<2048&&(o=n.translateToString(!0),a+=o.length,s.push(o),o.indexOf(` `)===-1););}return[s,r]}static _mapStrIdx(e,t,n,r){let i=e.buffer.active,a=i.getNullCell(),o=n;for(;r;){let e=i.getLine(t);if(!e)return[-1,-1];for(let n=o;n<e.length;++n){e.getCell(n,a);let o=a.getChars();if(a.getWidth()&&(r-=o.length||1,n===e.length-1&&o===``)){let e=i.getLine(t+1);e&&e.isWrapped&&(e.getCell(0,a),a.getWidth()===2&&(r+=1))}if(r<0)return[t,n]}t++,o=0}return[t,o]}},Yf=/(https?|HTTPS?):[/]{2}[^\s"'!*(){}|\\\^<>`]*[^\s"':,.!?{}|\\\^~\[\]`()<>]/;function Xf(e,t){let n=window.open();if(n){try{n.opener=null}catch{}n.location.href=t}else console.warn(`Opening link blocked as opener could not be cleared`)}var Zf=class{constructor(e=Xf,t={}){this._handler=e,this._options=t}activate(e){this._terminal=e;let t=this._options,n=t.urlRegex||Yf;this._linkProvider=this._terminal.registerLinkProvider(new Kf(this._terminal,n,this._handler,t))}dispose(){this._linkProvider?.dispose()}},Qf=Object.defineProperty,$f=Object.getOwnPropertyDescriptor,ep=(e,t)=>{for(var n in t)Qf(e,n,{get:t[n],enumerable:!0})},tp=(e,t,n,r)=>{for(var i=r>1?void 0:r?$f(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&&Qf(t,n,i),i},J=(e,t)=>(n,r)=>t(n,r,e),np=`Terminal input`,rp={get:()=>np,set:e=>np=e},ip=`Too much output to announce, navigate to rows manually to read`,ap={get:()=>ip,set:e=>ip=e};function op(e){return e.replace(/\r?\n/g,`\r`)}function sp(e,t){return t?`\x1B[200~`+e+`\x1B[201~`:e}function cp(e,t){e.clipboardData&&e.clipboardData.setData(`text/plain`,t.selectionText),e.preventDefault()}function lp(e,t,n,r){e.stopPropagation(),e.clipboardData&&up(e.clipboardData.getData(`text/plain`),t,n,r)}function up(e,t,n,r){e=op(e),e=sp(e,n.decPrivateModes.bracketedPasteMode&&r.rawOptions.ignoreBracketedPasteMode!==!0),n.triggerDataEvent(e,!0),t.value=``}function dp(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 fp(e,t,n,r,i){dp(e,t,n),i&&r.rightClickSelect(e),t.value=r.selectionText,t.select()}function pp(e){return e>65535?(e-=65536,String.fromCharCode((e>>10)+55296)+String.fromCharCode(e%1024+56320)):String.fromCharCode(e)}function mp(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 hp=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}},gp=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}},_p=``,vp=` `,yp=class e{constructor(){this.fg=0,this.bg=0,this.extended=new bp}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}},bp=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}},xp=class e extends yp{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new bp,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?pp(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()]}},Sp=`di$target`,Cp=`di$dependencies`,wp=new Map;function Tp(e){return e[Cp]||[]}function Ep(e){if(wp.has(e))return wp.get(e);let t=function(e,n,r){if(arguments.length!==3)throw Error(`@IServiceName-decorator can only be used to decorate a parameter`);Dp(t,e,r)};return t._id=e,wp.set(e,t),t}function Dp(e,t,n){t[Sp]===t?t[Cp].push({id:e,index:n}):(t[Cp]=[{id:e,index:n}],t[Sp]=t)}var Op=Ep(`BufferService`),kp=Ep(`CoreMouseService`),Ap=Ep(`CoreService`),jp=Ep(`CharsetService`),Mp=Ep(`InstantiationService`),Np=Ep(`LogService`),Pp=Ep(`OptionsService`),Fp=Ep(`OscLinkService`),Ip=Ep(`UnicodeService`),Lp=Ep(`DecorationService`),Rp=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 xp,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):zp(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)}};Rp=tp([J(0,Op),J(1,Pp),J(2,Fp)],Rp);function zp(e,t){if(confirm(`Do you want to navigate to ${t}?
10
+
11
+ 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 Bp=Ep(`CharSizeService`),Vp=Ep(`CoreBrowserService`),Hp=Ep(`MouseService`),Up=Ep(`RenderService`),Wp=Ep(`SelectionService`),Gp=Ep(`CharacterJoinerService`),Kp=Ep(`ThemeService`),qp=Ep(`LinkProviderService`),Jp=new class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?em.isErrorNoTelemetry(e)?new em(e.message+`
12
+
13
+ `+e.stack):Error(e.message+`
14
+
15
+ `+e.stack):e},0)}}addListener(e){return this.listeners.push(e),()=>{this._removeListener(e)}}emit(e){this.listeners.forEach(t=>{t(e)})}_removeListener(e){this.listeners.splice(this.listeners.indexOf(e),1)}setUnexpectedErrorHandler(e){this.unexpectedErrorHandler=e}getUnexpectedErrorHandler(){return this.unexpectedErrorHandler}onUnexpectedError(e){this.unexpectedErrorHandler(e),this.emit(e)}onUnexpectedExternalError(e){this.unexpectedErrorHandler(e)}};function Yp(e){Zp(e)||Jp.onUnexpectedError(e)}var Xp=`Canceled`;function Zp(e){return e instanceof Qp||e instanceof Error&&e.name===Xp&&e.message===Xp}var Qp=class extends Error{constructor(){super(Xp),this.name=this.message}};function $p(e){return Error(e?`Illegal argument: ${e}`:`Illegal argument`)}var em=class e extends Error{constructor(e){super(e),this.name=`CodeExpectedError`}static fromError(t){if(t instanceof e)return t;let n=new e;return n.message=t.message,n.stack=t.stack,n}static isErrorNoTelemetry(e){return e.name===`CodeExpectedError`}},tm=class e extends Error{constructor(t){super(t||`An unexpected bug occurred.`),Object.setPrototypeOf(this,e.prototype)}};function nm(e,t,n=0,r=e.length){let i=n,a=r;for(;i<a;){let n=Math.floor((i+a)/2);t(e[n])?i=n+1:a=n}return i-1}var rm=class e{constructor(e){this._array=e,this._findLastMonotonousLastIdx=0}findLastMonotonous(t){if(e.assertInvariants){if(this._prevFindLastPredicate){for(let e of this._array)if(this._prevFindLastPredicate(e)&&!t(e))throw Error(`MonotonousArray: current predicate must be weaker than (or equal to) the previous predicate.`)}this._prevFindLastPredicate=t}let n=nm(this._array,t,this._findLastMonotonousLastIdx);return this._findLastMonotonousLastIdx=n+1,n===-1?void 0:this._array[n]}};rm.assertInvariants=!1;function im(e,t=0){return e[e.length-(1+t)]}var am;(e=>{function t(e){return e<0}e.isLessThan=t;function n(e){return e<=0}e.isLessThanOrEqual=n;function r(e){return e>0}e.isGreaterThan=r;function i(e){return e===0}e.isNeitherLessOrGreaterThan=i,e.greaterThan=1,e.lessThan=-1,e.neitherLessOrGreaterThan=0})(am||={});function om(e,t){return(n,r)=>t(e(n),e(r))}var sm=(e,t)=>e-t,cm=class e{constructor(e){this.iterate=e}forEach(e){this.iterate(t=>(e(t),!0))}toArray(){let e=[];return this.iterate(t=>(e.push(t),!0)),e}filter(t){return new e(e=>this.iterate(n=>!t(n)||e(n)))}map(t){return new e(e=>this.iterate(n=>e(t(n))))}some(e){let t=!1;return this.iterate(n=>(t=e(n),!t)),t}findFirst(e){let t;return this.iterate(n=>e(n)?(t=n,!1):!0),t}findLast(e){let t;return this.iterate(n=>(e(n)&&(t=n),!0)),t}findLastMaxBy(e){let t,n=!0;return this.iterate(r=>((n||am.isGreaterThan(e(r,t)))&&(n=!1,t=r),!0)),t}};cm.empty=new cm(e=>{});function lm(e,t){let n=Object.create(null);for(let r of e){let e=t(r),i=n[e];i||=n[e]=[],i.push(r)}return n}var um=class{constructor(){this.map=new Map}add(e,t){let n=this.map.get(e);n||(n=new Set,this.map.set(e,n)),n.add(t)}delete(e,t){let n=this.map.get(e);n&&(n.delete(t),n.size===0&&this.map.delete(e))}forEach(e,t){let n=this.map.get(e);n&&n.forEach(t)}get(e){return this.map.get(e)||new Set}};function dm(e,t){let n=this,r=!1,i;return function(){if(r)return i;if(r=!0,t)try{i=e.apply(n,arguments)}finally{t()}else i=e.apply(n,arguments);return i}}var fm;(e=>{function t(e){return e&&typeof e==`object`&&typeof e[Symbol.iterator]==`function`}e.is=t;let n=Object.freeze([]);function r(){return n}e.empty=r;function*i(e){yield e}e.single=i;function a(e){return t(e)?e:i(e)}e.wrap=a;function o(e){return e||n}e.from=o;function*s(e){for(let t=e.length-1;t>=0;t--)yield e[t]}e.reverse=s;function c(e){return!e||e[Symbol.iterator]().next().done===!0}e.isEmpty=c;function l(e){return e[Symbol.iterator]().next().value}e.first=l;function u(e,t){let n=0;for(let r of e)if(t(r,n++))return!0;return!1}e.some=u;function d(e,t){for(let n of e)if(t(n))return n}e.find=d;function*f(e,t){for(let n of e)t(n)&&(yield n)}e.filter=f;function*p(e,t){let n=0;for(let r of e)yield t(r,n++)}e.map=p;function*m(e,t){let n=0;for(let r of e)yield*t(r,n++)}e.flatMap=m;function*h(...e){for(let t of e)yield*t}e.concat=h;function g(e,t,n){let r=n;for(let n of e)r=t(r,n);return r}e.reduce=g;function*_(e,t,n=e.length){for(t<0&&(t+=e.length),n<0?n+=e.length:n>e.length&&(n=e.length);t<n;t++)yield e[t]}e.slice=_;function v(t,n=1/0){let r=[];if(n===0)return[r,t];let i=t[Symbol.iterator]();for(let t=0;t<n;t++){let t=i.next();if(t.done)return[r,e.empty()];r.push(t.value)}return[r,{[Symbol.iterator](){return i}}]}e.consume=v;async function y(e){let t=[];for await(let n of e)t.push(n);return Promise.resolve(t)}e.asyncToArray=y})(fm||={});var pm=null,mm=class e{constructor(){this.livingDisposables=new Map}getDisposableData(t){let n=this.livingDisposables.get(t);return n||(n={parent:null,source:null,isSingleton:!1,value:t,idx:e.idx++},this.livingDisposables.set(t,n)),n}trackDisposable(e){let t=this.getDisposableData(e);t.source||=Error().stack}setParent(e,t){let n=this.getDisposableData(e);n.parent=t}markAsDisposed(e){this.livingDisposables.delete(e)}markAsSingleton(e){this.getDisposableData(e).isSingleton=!0}getRootParent(e,t){let n=t.get(e);if(n)return n;let r=e.parent?this.getRootParent(this.getDisposableData(e.parent),t):e;return t.set(e,r),r}getTrackedDisposables(){let e=new Map;return[...this.livingDisposables.entries()].filter(([,t])=>t.source!==null&&!this.getRootParent(t,e).isSingleton).flatMap(([e])=>e)}computeLeakingDisposables(e=10,t){let n;if(t)n=t;else{let e=new Map,t=[...this.livingDisposables.values()].filter(t=>t.source!==null&&!this.getRootParent(t,e).isSingleton);if(t.length===0)return;let r=new Set(t.map(e=>e.value));if(n=t.filter(e=>!(e.parent&&r.has(e.parent))),n.length===0)throw Error(`There are cyclic diposable chains!`)}if(!n)return;function r(e){function t(e,t){for(;e.length>0&&t.some(t=>typeof t==`string`?t===e[0]:e[0].match(t));)e.shift()}let n=e.source.split(`
16
+ `).map(e=>e.trim().replace(`at `,``)).filter(e=>e!==``);return t(n,[`Error`,/^trackDisposable \(.*\)$/,/^DisposableTracker.trackDisposable \(.*\)$/]),n.reverse()}let i=new um;for(let e of n){let t=r(e);for(let n=0;n<=t.length;n++)i.add(t.slice(0,n).join(`
17
+ `),e)}n.sort(om(e=>e.idx,sm));let a=``,o=0;for(let t of n.slice(0,e)){o++;let e=r(t),s=[];for(let t=0;t<e.length;t++){let a=e[t];a=`(shared with ${i.get(e.slice(0,t+1).join(`
18
+ `)).size}/${n.length} leaks) at ${a}`;let o=lm([...i.get(e.slice(0,t).join(`
19
+ `))].map(e=>r(e)[t]),e=>e);delete o[e[t]];for(let[e,t]of Object.entries(o))s.unshift(` - stacktraces of ${t.length} other leaks continue with ${e}`);s.unshift(a)}a+=`
20
+
21
+
22
+ ==================== Leaking disposable ${o}/${n.length}: ${t.value.constructor.name} ====================
23
+ ${s.join(`
24
+ `)}
25
+ ============================================================
26
+
27
+ `}return n.length>e&&(a+=`
28
+
29
+
30
+ ... and ${n.length-e} more leaking disposables
31
+
32
+ `),{leaks:n,details:a}}};mm.idx=0;function hm(e){return pm?.trackDisposable(e),e}function gm(e){pm?.markAsDisposed(e)}function _m(e,t){pm?.setParent(e,t)}function vm(e){return pm?.markAsSingleton(e),e}function ym(e){if(fm.is(e)){let t=[];for(let n of e)if(n)try{n.dispose()}catch(e){t.push(e)}if(t.length===1)throw t[0];if(t.length>1)throw AggregateError(t,`Encountered errors while disposing of store`);return Array.isArray(e)?[]:e}else if(e)return e.dispose(),e}function bm(...e){return xm(()=>ym(e))}function xm(e){let t=hm({dispose:dm(()=>{gm(t),e()})});return t}var Sm=class e{constructor(){this._toDispose=new Set,this._isDisposed=!1,hm(this)}dispose(){this._isDisposed||(gm(this),this._isDisposed=!0,this.clear())}get isDisposed(){return this._isDisposed}clear(){if(this._toDispose.size!==0)try{ym(this._toDispose)}finally{this._toDispose.clear()}}add(t){if(!t)return t;if(t===this)throw Error(`Cannot register a disposable on itself!`);return _m(t,this),this._isDisposed?e.DISABLE_DISPOSED_WARNING||console.warn(Error(`Trying to add a disposable to a DisposableStore that has already been disposed of. The added object will be leaked!`).stack):this._toDispose.add(t),t}delete(e){if(e){if(e===this)throw Error(`Cannot dispose a disposable on itself!`);this._toDispose.delete(e),e.dispose()}}deleteAndLeak(e){e&&this._toDispose.has(e)&&(this._toDispose.delete(e),_m(e,null))}};Sm.DISABLE_DISPOSED_WARNING=!1;var Cm=Sm,wm=class{constructor(){this._store=new Cm,hm(this),_m(this._store,this)}dispose(){gm(this),this._store.dispose()}_register(e){if(e===this)throw Error(`Cannot register a disposable on itself!`);return this._store.add(e)}};wm.None=Object.freeze({dispose(){}});var Tm=class{constructor(){this._isDisposed=!1,hm(this)}get value(){return this._isDisposed?void 0:this._value}set value(e){this._isDisposed||e===this._value||(this._value?.dispose(),e&&_m(e,this),this._value=e)}clear(){this.value=void 0}dispose(){this._isDisposed=!0,gm(this),this._value?.dispose(),this._value=void 0}clearAndLeak(){let e=this._value;return this._value=void 0,e&&_m(e,null),e}},Em=typeof window==`object`?window:globalThis,Dm=class e{constructor(t){this.element=t,this.next=e.Undefined,this.prev=e.Undefined}};Dm.Undefined=new Dm(void 0);var Om=Dm,km=class{constructor(){this._first=Om.Undefined,this._last=Om.Undefined,this._size=0}get size(){return this._size}isEmpty(){return this._first===Om.Undefined}clear(){let e=this._first;for(;e!==Om.Undefined;){let t=e.next;e.prev=Om.Undefined,e.next=Om.Undefined,e=t}this._first=Om.Undefined,this._last=Om.Undefined,this._size=0}unshift(e){return this._insert(e,!1)}push(e){return this._insert(e,!0)}_insert(e,t){let n=new Om(e);if(this._first===Om.Undefined)this._first=n,this._last=n;else if(t){let e=this._last;this._last=n,n.prev=e,e.next=n}else{let e=this._first;this._first=n,n.next=e,e.prev=n}this._size+=1;let r=!1;return()=>{r||(r=!0,this._remove(n))}}shift(){if(this._first!==Om.Undefined){let e=this._first.element;return this._remove(this._first),e}}pop(){if(this._last!==Om.Undefined){let e=this._last.element;return this._remove(this._last),e}}_remove(e){if(e.prev!==Om.Undefined&&e.next!==Om.Undefined){let t=e.prev;t.next=e.next,e.next.prev=t}else e.prev===Om.Undefined&&e.next===Om.Undefined?(this._first=Om.Undefined,this._last=Om.Undefined):e.next===Om.Undefined?(this._last=this._last.prev,this._last.next=Om.Undefined):e.prev===Om.Undefined&&(this._first=this._first.next,this._first.prev=Om.Undefined);--this._size}*[Symbol.iterator](){let e=this._first;for(;e!==Om.Undefined;)yield e.element,e=e.next}},Am=globalThis.performance&&typeof globalThis.performance.now==`function`,jm=class e{static create(t){return new e(t)}constructor(e){this._now=Am&&e===!1?Date.now:globalThis.performance.now.bind(globalThis.performance),this._startTime=this._now(),this._stopTime=-1}stop(){this._stopTime=this._now()}reset(){this._startTime=this._now(),this._stopTime=-1}elapsed(){return this._stopTime===-1?this._now()-this._startTime:this._stopTime-this._startTime}},Mm;(e=>{e.None=()=>wm.None;function t(e,t){return d(e,()=>{},0,void 0,!0,void 0,t)}e.defer=t;function n(e){return(t,n=null,r)=>{let i=!1,a;return a=e(e=>{if(!i)return a?a.dispose():i=!0,t.call(n,e)},null,r),i&&a.dispose(),a}}e.once=n;function r(e,t,n){return l((n,r=null,i)=>e(e=>n.call(r,t(e)),null,i),n)}e.map=r;function i(e,t,n){return l((n,r=null,i)=>e(e=>{t(e),n.call(r,e)},null,i),n)}e.forEach=i;function a(e,t,n){return l((n,r=null,i)=>e(e=>t(e)&&n.call(r,e),null,i),n)}e.filter=a;function o(e){return e}e.signal=o;function s(...e){return(t,n=null,r)=>u(bm(...e.map(e=>e(e=>t.call(n,e)))),r)}e.any=s;function c(e,t,n,i){let a=n;return r(e,e=>(a=t(a,e),a),i)}e.reduce=c;function l(e,t){let n,r=new Y({onWillAddFirstListener(){n=e(r.fire,r)},onDidRemoveLastListener(){n?.dispose()}});return t?.add(r),r.event}function u(e,t){return t instanceof Array?t.push(e):t&&t.add(e),e}function d(e,t,n=100,r=!1,i=!1,a,o){let s,c,l,u=0,d,f=new Y({leakWarningThreshold:a,onWillAddFirstListener(){s=e(e=>{u++,c=t(c,e),r&&!l&&(f.fire(c),c=void 0),d=()=>{let e=c;c=void 0,l=void 0,(!r||u>1)&&f.fire(e),u=0},typeof n==`number`?(clearTimeout(l),l=setTimeout(d,n)):l===void 0&&(l=0,queueMicrotask(d))})},onWillRemoveListener(){i&&u>0&&d?.()},onDidRemoveLastListener(){d=void 0,s.dispose()}});return o?.add(f),f.event}e.debounce=d;function f(t,n=0,r){return e.debounce(t,(e,t)=>e?(e.push(t),e):[t],n,void 0,!0,void 0,r)}e.accumulate=f;function p(e,t=(e,t)=>e===t,n){let r=!0,i;return a(e,e=>{let n=r||!t(e,i);return r=!1,i=e,n},n)}e.latch=p;function m(t,n,r){return[e.filter(t,n,r),e.filter(t,e=>!n(e),r)]}e.split=m;function h(e,t=!1,n=[],r){let i=n.slice(),a=e(e=>{i?i.push(e):s.fire(e)});r&&r.add(a);let o=()=>{i?.forEach(e=>s.fire(e)),i=null},s=new Y({onWillAddFirstListener(){a||(a=e(e=>s.fire(e)),r&&r.add(a))},onDidAddFirstListener(){i&&(t?setTimeout(o):o())},onDidRemoveLastListener(){a&&a.dispose(),a=null}});return r&&r.add(s),s.event}e.buffer=h;function g(e,t){return(n,r,i)=>{let a=t(new v);return e(function(e){let t=a.evaluate(e);t!==_&&n.call(r,t)},void 0,i)}}e.chain=g;let _=Symbol(`HaltChainable`);class v{constructor(){this.steps=[]}map(e){return this.steps.push(e),this}forEach(e){return this.steps.push(t=>(e(t),t)),this}filter(e){return this.steps.push(t=>e(t)?t:_),this}reduce(e,t){let n=t;return this.steps.push(t=>(n=e(n,t),n)),this}latch(e=(e,t)=>e===t){let t=!0,n;return this.steps.push(r=>{let i=t||!e(r,n);return t=!1,n=r,i?r:_}),this}evaluate(e){for(let t of this.steps)if(e=t(e),e===_)break;return e}}function y(e,t,n=e=>e){let r=(...e)=>i.fire(n(...e)),i=new Y({onWillAddFirstListener:()=>e.on(t,r),onDidRemoveLastListener:()=>e.removeListener(t,r)});return i.event}e.fromNodeEventEmitter=y;function b(e,t,n=e=>e){let r=(...e)=>i.fire(n(...e)),i=new Y({onWillAddFirstListener:()=>e.addEventListener(t,r),onDidRemoveLastListener:()=>e.removeEventListener(t,r)});return i.event}e.fromDOMEventEmitter=b;function x(e){return new Promise(t=>n(e)(t))}e.toPromise=x;function S(e){let t=new Y;return e.then(e=>{t.fire(e)},()=>{t.fire(void 0)}).finally(()=>{t.dispose()}),t.event}e.fromPromise=S;function C(e,t){return e(e=>t.fire(e))}e.forward=C;function w(e,t,n){return t(n),e(e=>t(e))}e.runAndSubscribe=w;class T{constructor(e,t){this._observable=e,this._counter=0,this._hasChanged=!1;let n={onWillAddFirstListener:()=>{e.addObserver(this)},onDidRemoveLastListener:()=>{e.removeObserver(this)}};this.emitter=new Y(n),t&&t.add(this.emitter)}beginUpdate(e){this._counter++}handlePossibleChange(e){}handleChange(e,t){this._hasChanged=!0}endUpdate(e){this._counter--,this._counter===0&&(this._observable.reportChanges(),this._hasChanged&&(this._hasChanged=!1,this.emitter.fire(this._observable.get())))}}function E(e,t){return new T(e,t).emitter.event}e.fromObservable=E;function D(e){return(t,n,r)=>{let i=0,a=!1,o={beginUpdate(){i++},endUpdate(){i--,i===0&&(e.reportChanges(),a&&(a=!1,t.call(n)))},handlePossibleChange(){},handleChange(){a=!0}};e.addObserver(o),e.reportChanges();let s={dispose(){e.removeObserver(o)}};return r instanceof Cm?r.add(s):Array.isArray(r)&&r.push(s),s}}e.fromObservableLight=D})(Mm||={});var Nm=class e{constructor(t){this.listenerCount=0,this.invocationCount=0,this.elapsedOverall=0,this.durations=[],this.name=`${t}_${e._idPool++}`,e.all.add(this)}start(e){this._stopWatch=new jm,this.listenerCount=e}stop(){if(this._stopWatch){let e=this._stopWatch.elapsed();this.durations.push(e),this.elapsedOverall+=e,this.invocationCount+=1,this._stopWatch=void 0}}};Nm.all=new Set,Nm._idPool=0;var Pm=Nm,Fm=-1,Im=class e{constructor(t,n,r=(e._idPool++).toString(16).padStart(3,`0`)){this._errorHandler=t,this.threshold=n,this.name=r,this._warnCountdown=0}dispose(){this._stacks?.clear()}check(e,t){let n=this.threshold;if(n<=0||t<n)return;this._stacks||=new Map;let r=this._stacks.get(e.value)||0;if(this._stacks.set(e.value,r+1),--this._warnCountdown,this._warnCountdown<=0){this._warnCountdown=n*.5;let[e,r]=this.getMostFrequentStack(),i=`[${this.name}] potential listener LEAK detected, having ${t} listeners already. MOST frequent listener (${r}):`;console.warn(i),console.warn(e);let a=new zm(i,e);this._errorHandler(a)}return()=>{let t=this._stacks.get(e.value)||0;this._stacks.set(e.value,t-1)}}getMostFrequentStack(){if(!this._stacks)return;let e,t=0;for(let[n,r]of this._stacks)(!e||t<r)&&(e=[n,r],t=r);return e}};Im._idPool=1;var Lm=Im,Rm=class e{constructor(e){this.value=e}static create(){return new e(Error().stack??``)}print(){console.warn(this.value.split(`
33
+ `).slice(2).join(`
34
+ `))}},zm=class extends Error{constructor(e,t){super(e),this.name=`ListenerLeakError`,this.stack=t}},Bm=class extends Error{constructor(e,t){super(e),this.name=`ListenerRefusalError`,this.stack=t}},Vm=0,Hm=class{constructor(e){this.value=e,this.id=Vm++}},Um=2,Wm,Y=class{constructor(e){this._size=0,this._options=e,this._leakageMon=Fm>0||this._options?.leakWarningThreshold?new Lm(e?.onListenerError??Yp,this._options?.leakWarningThreshold??Fm):void 0,this._perfMon=this._options?._profName?new Pm(this._options._profName):void 0,this._deliveryQueue=this._options?.deliveryQueue}dispose(){this._disposed||(this._disposed=!0,this._deliveryQueue?.current===this&&this._deliveryQueue.reset(),this._listeners&&(this._listeners=void 0,this._size=0),this._options?.onDidRemoveLastListener?.(),this._leakageMon?.dispose())}get event(){return this._event??=(e,t,n)=>{if(this._leakageMon&&this._size>this._leakageMon.threshold**2){let e=`[${this._leakageMon.name}] REFUSES to accept new listeners because it exceeded its threshold by far (${this._size} vs ${this._leakageMon.threshold})`;console.warn(e);let t=this._leakageMon.getMostFrequentStack()??[`UNKNOWN stack`,-1],n=new Bm(`${e}. HINT: Stack shows most frequent listener (${t[1]}-times)`,t[0]);return(this._options?.onListenerError||Yp)(n),wm.None}if(this._disposed)return wm.None;t&&(e=e.bind(t));let r=new Hm(e),i;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(r.stack=Rm.create(),i=this._leakageMon.check(r.stack,this._size+1)),this._listeners?this._listeners instanceof Hm?(this._deliveryQueue??=new Gm,this._listeners=[this._listeners,r]):this._listeners.push(r):(this._options?.onWillAddFirstListener?.(this),this._listeners=r,this._options?.onDidAddFirstListener?.(this)),this._size++;let a=xm(()=>{Wm?.unregister(a),i?.(),this._removeListener(r)});if(n instanceof Cm?n.add(a):Array.isArray(n)&&n.push(a),Wm){let e=Error().stack.split(`
35
+ `).slice(2,3).join(`
36
+ `).trim(),t=/(file:|vscode-file:\/\/vscode-app)?(\/[^:]*:\d+:\d+)/.exec(e);Wm.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*Um<=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||Yp;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 Hm)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}},Gm=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}},Km=class{constructor(){this.mapWindowIdToZoomLevel=new Map,this._onDidChangeZoomLevel=new Y,this.onDidChangeZoomLevel=this._onDidChangeZoomLevel.event,this.mapWindowIdToZoomFactor=new Map,this._onDidChangeFullscreen=new Y,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}};Km.INSTANCE=new Km;var qm=Km;function Jm(e,t,n){typeof t==`string`&&(t=e.matchMedia(t)),t.addEventListener(`change`,n)}qm.INSTANCE.onDidChangeZoomLevel;function Ym(e){return qm.INSTANCE.getZoomFactor(e)}qm.INSTANCE.onDidChangeFullscreen;var Xm=typeof navigator==`object`?navigator.userAgent:``,Zm=Xm.indexOf(`Firefox`)>=0,Qm=Xm.indexOf(`AppleWebKit`)>=0,$m=Xm.indexOf(`Chrome`)>=0,eh=!$m&&Xm.indexOf(`Safari`)>=0;Xm.indexOf(`Electron/`),Xm.indexOf(`Android`);var th=!1;if(typeof Em.matchMedia==`function`){let e=Em.matchMedia(`(display-mode: standalone) or (display-mode: window-controls-overlay)`),t=Em.matchMedia(`(display-mode: fullscreen)`);th=e.matches,Jm(Em,e,({matches:e})=>{th&&t.matches||(th=e)})}function nh(){return th}var rh=`en`,ih=!1,ah=!1,oh=!1,sh=!1,ch=!1,lh=rh,uh,dh=globalThis,fh;typeof dh.vscode<`u`&&typeof dh.vscode.process<`u`?fh=dh.vscode.process:typeof process<`u`&&typeof process?.versions?.node==`string`&&(fh=process);var ph=typeof fh?.versions?.electron==`string`&&fh?.type===`renderer`;if(typeof fh==`object`){ih=fh.platform===`win32`,ah=fh.platform===`darwin`,oh=fh.platform===`linux`,oh&&fh.env.SNAP&&fh.env.SNAP_REVISION,fh.env.CI||fh.env.BUILD_ARTIFACTSTAGINGDIRECTORY,lh=rh;let e=fh.env.VSCODE_NLS_CONFIG;if(e)try{let t=JSON.parse(e);t.userLocale,t.osLocale,lh=t.resolvedLanguage||rh,t.languagePack?.translationsConfigFile}catch{}sh=!0}else typeof navigator==`object`&&!ph?(uh=navigator.userAgent,ih=uh.indexOf(`Windows`)>=0,ah=uh.indexOf(`Macintosh`)>=0,(uh.indexOf(`Macintosh`)>=0||uh.indexOf(`iPad`)>=0||uh.indexOf(`iPhone`)>=0)&&navigator.maxTouchPoints&&navigator.maxTouchPoints,oh=uh.indexOf(`Linux`)>=0,uh?.indexOf(`Mobi`),ch=!0,lh=globalThis._VSCODE_NLS_LANGUAGE||rh,navigator.language.toLowerCase()):console.error(`Unable to resolve platform.`);var mh=ih,hh=ah,gh=oh,_h=sh;ch&&typeof dh.importScripts==`function`&&dh.origin;var vh=uh,yh=lh,bh;(e=>{function t(){return yh}e.value=t;function n(){return yh.length===2?yh===`en`:yh.length>=3&&yh[0]===`e`&&yh[1]===`n`&&yh[2]===`-`}e.isDefaultVariant=n;function r(){return yh===`en`}e.isDefault=r})(bh||={});var xh=typeof dh.postMessage==`function`&&!dh.importScripts;(()=>{if(xh){let e=[];dh.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}),dh.postMessage({vscodeScheduleAsyncWork:r},`*`)}}return e=>setTimeout(e)})();var Sh=!!(vh&&vh.indexOf(`Chrome`)>=0);vh&&vh.indexOf(`Firefox`),!Sh&&vh&&vh.indexOf(`Safari`),vh&&vh.indexOf(`Edg/`),vh&&vh.indexOf(`Android`);var Ch=typeof navigator==`object`?navigator:{};_h||document.queryCommandSupported&&document.queryCommandSupported(`copy`)||Ch&&Ch.clipboard&&Ch.clipboard.writeText,_h||Ch&&Ch.clipboard&&Ch.clipboard.readText,_h||nh()||Ch.keyboard,`ontouchstart`in Em||Ch.maxTouchPoints,Em.PointerEvent&&(`ontouchstart`in Em||navigator.maxTouchPoints);var wh=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}},Th=new wh,Eh=new wh,Dh=new wh,Oh=Array(230),kh;(e=>{function t(e){return Th.keyCodeToStr(e)}e.toString=t;function n(e){return Th.strToKeyCode(e)}e.fromString=n;function r(e){return Eh.keyCodeToStr(e)}e.toUserSettingsUS=r;function i(e){return Dh.keyCodeToStr(e)}e.toUserSettingsGeneral=i;function a(e){return Eh.strToKeyCode(e)||Dh.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 Th.keyCodeToStr(e)}e.toElectronAccelerator=o})(kh||={});var Ah=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 jh([this])}isDuplicateModifierCase(){return this.ctrlKey&&this.keyCode===5||this.shiftKey&&this.keyCode===4||this.altKey&&this.keyCode===6||this.metaKey&&this.keyCode===57}},jh=class{constructor(e){if(e.length===0)throw $p(`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 Mh(e){if(e.charCode){let t=String.fromCharCode(e.charCode).toUpperCase();return kh.fromString(t)}let t=e.keyCode;if(t===3)return 7;if(Zm)switch(t){case 59:return 85;case 60:if(gh)return 97;break;case 61:return 86;case 107:return 109;case 109:return 111;case 173:return 88;case 224:if(hh)return 57;break}else if(Qm&&(hh&&t===93||!hh&&t===92))return 57;return Oh[t]||0}var Nh=hh?256:2048,Ph=512,Fh=1024,Ih=hh?2048:256,Lh=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=Mh(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|=Nh),this.altKey&&(t|=Ph),this.shiftKey&&(t|=Fh),this.metaKey&&(t|=Ih),t|=e,t}_computeKeyCodeChord(){let e=0;return this.keyCode!==5&&this.keyCode!==4&&this.keyCode!==6&&this.keyCode!==57&&(e=this.keyCode),new Ah(this.ctrlKey,this.shiftKey,this.altKey,this.metaKey,e)}},Rh=new WeakMap;function zh(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 Bh=class{static getSameOriginWindowChain(e){let t=Rh.get(e);if(!t){t=[],Rh.set(e,t);let n=e,r;do r=zh(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}}},Vh=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=Bh.getPositionOfChildWindowRelativeToAncestorWindow(e,t.view);this.posx-=n.left,this.posy-=n.top}preventDefault(){this.browserEvent.preventDefault()}stopPropagation(){this.browserEvent.stopPropagation()}},Hh=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($m){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?Zm&&!hh?this.deltaY=-e.deltaY/3:this.deltaY=-e.deltaY:this.deltaY=-e.deltaY/40}if(typeof t.wheelDeltaX<`u`)eh&&mh?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?Zm&&!hh?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()}},Uh=Object.freeze(function(e,t){let n=setTimeout(e.bind(t),0);return{dispose(){clearTimeout(n)}}}),Wh;(e=>{function t(t){return t===e.None||t===e.Cancelled||t instanceof Gh?!0:!t||typeof t!=`object`?!1:typeof t.isCancellationRequested==`boolean`&&typeof t.onCancellationRequested==`function`}e.isCancellationToken=t,e.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:Mm.None}),e.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:Uh})})(Wh||={});var Gh=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?Uh:(this._emitter||=new Y,this._emitter.event)}dispose(){this._emitter&&=(this._emitter.dispose(),null)}},Kh=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 tm(`Calling 'cancelAndSet' on a disposed TimeoutTimer`);this.cancel(),this._token=setTimeout(()=>{this._token=-1,e()},t)}setIfNotSet(e,t){if(this._isDisposed)throw new tm(`Calling 'setIfNotSet' on a disposed TimeoutTimer`);this._token===-1&&(this._token=setTimeout(()=>{this._token=-1,e()},t))}},qh=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 tm(`Calling 'cancelAndSet' on a disposed IntervalTimer`);this.cancel();let r=n.setInterval(()=>{e()},t);this.disposable=xm(()=>{n.clearInterval(r),this.disposable=void 0})}dispose(){this.cancel(),this.isDisposed=!0}};(function(){typeof globalThis.requestIdleCallback!=`function`||globalThis.cancelIdleCallback})();var Jh;(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})(Jh||={});var Yh=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 Y,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 Mm.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())}};Yh.EMPTY=Yh.fromArray([]);function Xh(e){return 55296<=e&&e<=56319}function Zh(e){return 56320<=e&&e<=57343}function Qh(e,t){return(e-55296<<10)+(t-56320)+65536}function $h(e){return eg(e,0)}function eg(e,t){switch(typeof e){case`object`:return e===null?tg(349,t):Array.isArray(e)?ig(e,t):ag(e,t);case`string`:return rg(e,t);case`boolean`:return ng(e,t);case`number`:return tg(e,t);case`undefined`:return tg(937,t);default:return tg(617,t)}}function tg(e,t){return(t<<5)-t+e|0}function ng(e,t){return tg(e?433:863,t)}function rg(e,t){t=tg(149417,t);for(let n=0,r=e.length;n<r;n++)t=tg(e.charCodeAt(n),t);return t}function ig(e,t){return t=tg(104579,t),e.reduce((e,t)=>eg(t,e),t)}function ag(e,t){return t=tg(181387,t),Object.keys(e).sort().reduce((t,n)=>(t=rg(n,t),eg(e[n],t)),t)}function og(e,t,n=32){let r=n-t,i=~((1<<r)-1);return(e<<t|(i&e)>>>r)>>>0}function sg(e,t=0,n=e.byteLength,r=0){for(let i=0;i<n;i++)e[t+i]=r}function cg(e,t,n=`0`){for(;e.length<t;)e=n+e;return e}function lg(e,t=32){return e instanceof ArrayBuffer?Array.from(new Uint8Array(e)).map(e=>e.toString(16).padStart(2,`0`)).join(``):cg((e>>>0).toString(16),t/4)}var ug=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(Xh(a))if(o+1<t){let t=e.charCodeAt(o+1);Zh(t)?(o++,s=Qh(a,t)):s=65533}else{i=a;break}else Zh(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()),lg(this._h0)+lg(this._h1)+lg(this._h2)+lg(this._h3)+lg(this._h4)}_wrapUp(){this._buff[this._buffLen++]=128,sg(this._buff,this._buffLen),this._buffLen>56&&(this._step(),sg(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,og(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=og(r,5)+c+s+l+t.getUint32(e*4,!1)&4294967295,s=o,o=a,a=og(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}};ug._bigBlock32=new DataView(new ArrayBuffer(320));var{registerWindow:dg,getWindow:fg,getDocument:pg,getWindows:mg,getWindowsCount:hg,getWindowId:gg,getWindowById:_g,hasWindow:vg,onDidRegisterWindow:yg,onWillUnregisterWindow:bg,onDidUnregisterWindow:xg}=function(){let e=new Map,t={window:Em,disposables:new Cm};e.set(Em.vscodeWindowId,t);let n=new Y,r=new Y,i=new Y;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 wm.None;let a=new Cm,o={window:t,disposables:a.add(new Cm)};return e.set(t.vscodeWindowId,o),a.add(xm(()=>{e.delete(t.vscodeWindowId),r.fire(t)})),a.add(X(t,jg.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:Em},getDocument(e){return fg(e).document}}}(),Sg=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 X(e,t,n,r){return new Sg(e,t,n,r)}function Cg(e,t){return function(n){return t(new Vh(e,n))}}function wg(e){return function(t){return e(new Lh(t))}}var Tg=function(e,t,n,r){let i=n;return t===`click`||t===`mousedown`||t===`contextmenu`?i=Cg(fg(e),n):(t===`keydown`||t===`keypress`||t===`keyup`)&&(i=wg(n)),X(e,t,i,r)},Eg,Dg=class extends qh{constructor(e){super(),this.defaultTarget=e&&fg(e)}cancelAndSet(e,t,n){return super.cancelAndSet(e,t,n??this.defaultTarget)}},Og=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){Yp(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(Og.sort),a.shift().execute();r.set(i,!1)};Eg=(t,r,a=0)=>{let o=gg(t),s=new Og(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 kg=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}};kg.None=new kg(0,0);function Ag(e){let t=e.getBoundingClientRect(),n=fg(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=$h(n),a=r.get(i);if(a)a.users+=1;else{let o=new Y,s=new MutationObserver(e=>o.fire(e));s.observe(e,n);let c=a={users:1,observer:s,onDidMutate:o.event};t.add(xm(()=>{--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 jg={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:Qm?`webkitAnimationStart`:`animationstart`,ANIMATION_END:Qm?`webkitAnimationEnd`:`animationend`,ANIMATION_ITERATION:Qm?`webkitAnimationIteration`:`animationiteration`},Mg=/([\w\-]+)?(#([\w\-]+))?((\.([\w\-]+))*)/;function Ng(e,t,n,...r){let i=Mg.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 Pg(e,t,...n){return Ng(`http://www.w3.org/1999/xhtml`,e,t,...n)}Pg.SVG=function(e,t,...n){return Ng(`http://www.w3.org/2000/svg`,e,t,...n)};var Fg=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=Ig(e);this._maxWidth!==t&&(this._maxWidth=t,this.domNode.style.maxWidth=this._maxWidth)}setWidth(e){let t=Ig(e);this._width!==t&&(this._width=t,this.domNode.style.width=this._width)}setHeight(e){let t=Ig(e);this._height!==t&&(this._height=t,this.domNode.style.height=this._height)}setTop(e){let t=Ig(e);this._top!==t&&(this._top=t,this.domNode.style.top=this._top)}setLeft(e){let t=Ig(e);this._left!==t&&(this._left=t,this.domNode.style.left=this._left)}setBottom(e){let t=Ig(e);this._bottom!==t&&(this._bottom=t,this.domNode.style.bottom=this._bottom)}setRight(e){let t=Ig(e);this._right!==t&&(this._right=t,this.domNode.style.right=this._right)}setPaddingTop(e){let t=Ig(e);this._paddingTop!==t&&(this._paddingTop=t,this.domNode.style.paddingTop=this._paddingTop)}setPaddingLeft(e){let t=Ig(e);this._paddingLeft!==t&&(this._paddingLeft=t,this.domNode.style.paddingLeft=this._paddingLeft)}setPaddingBottom(e){let t=Ig(e);this._paddingBottom!==t&&(this._paddingBottom=t,this.domNode.style.paddingBottom=this._paddingBottom)}setPaddingRight(e){let t=Ig(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=Ig(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=Ig(e);this._lineHeight!==t&&(this._lineHeight=t,this.domNode.style.lineHeight=this._lineHeight)}setLetterSpacing(e){let t=Ig(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 Ig(e){return typeof e==`number`?`${e}px`:e}function Lg(e){return new Fg(e)}var Rg=class{constructor(){this._hooks=new Cm,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(xm(()=>{try{e.releasePointerCapture(t)}catch{}}))}catch{a=fg(e)}this._hooks.add(X(a,jg.POINTER_MOVE,e=>{if(e.buttons!==n){this.stopMonitoring(!0);return}e.preventDefault(),this._pointerMoveCallback(e)})),this._hooks.add(X(a,jg.POINTER_UP,e=>this.stopMonitoring(!0)))}};function zg(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 Bg;(e=>(e.Tap=`-xterm-gesturetap`,e.Change=`-xterm-gesturechange`,e.Start=`-xterm-gesturestart`,e.End=`-xterm-gesturesend`,e.Contextmenu=`-xterm-gesturecontextmenu`))(Bg||={});var Vg=class e extends wm{constructor(){super(),this.dispatched=!1,this.targets=new km,this.ignoreTargets=new km,this.activeTouches={},this.handle=null,this._lastSetTapCountTime=0,this._register(Mm.runAndSubscribe(yg,({window:e,disposables:t})=>{t.add(X(e.document,`touchstart`,e=>this.onTouchStart(e),{passive:!1})),t.add(X(e.document,`touchend`,t=>this.onTouchEnd(e,t))),t.add(X(e.document,`touchmove`,e=>this.onTouchMove(e),{passive:!1}))},{window:Em,disposables:this._store}))}static addTarget(t){return e.isTouchDevice()?(e.INSTANCE||=vm(new e),xm(e.INSTANCE.targets.push(t))):wm.None}static ignoreTarget(t){return e.isTouchDevice()?(e.INSTANCE||=vm(new e),xm(e.INSTANCE.ignoreTargets.push(t))):wm.None}static isTouchDevice(){return`ontouchstart`in Em||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(Bg.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-im(s.rollingPageX))<30&&Math.abs(s.initialPageY-im(s.rollingPageY))<30){let e=this.newGestureEvent(Bg.Tap,s.initialTarget);e.pageX=im(s.rollingPageX),e.pageY=im(s.rollingPageY),this.dispatchEvent(e)}else if(c>=e.HOLD_DELAY&&Math.abs(s.initialPageX-im(s.rollingPageX))<30&&Math.abs(s.initialPageY-im(s.rollingPageY))<30){let e=this.newGestureEvent(Bg.Contextmenu,s.initialTarget);e.pageX=im(s.rollingPageX),e.pageY=im(s.rollingPageY),this.dispatchEvent(e)}else if(i===1){let e=im(s.rollingPageX),n=im(s.rollingPageY),i=im(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(Bg.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===Bg.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===Bg.Change||t.type===Bg.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=Eg(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(Bg.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(Bg.Change,i.initialTarget);a.translationX=r.pageX-im(i.rollingPageX),a.translationY=r.pageY-im(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)}};Vg.SCROLL_FRICTION=-.005,Vg.HOLD_DELAY=700,Vg.CLEAR_TAP_COUNT_TIME=400,tp([zg],Vg,`isTouchDevice`,1);var Hg=Vg,Ug=class extends wm{onclick(e,t){this._register(X(e,jg.CLICK,n=>t(new Vh(fg(e),n))))}onmousedown(e,t){this._register(X(e,jg.MOUSE_DOWN,n=>t(new Vh(fg(e),n))))}onmouseover(e,t){this._register(X(e,jg.MOUSE_OVER,n=>t(new Vh(fg(e),n))))}onmouseleave(e,t){this._register(X(e,jg.MOUSE_LEAVE,n=>t(new Vh(fg(e),n))))}onkeydown(e,t){this._register(X(e,jg.KEY_DOWN,e=>t(new Lh(e))))}onkeyup(e,t){this._register(X(e,jg.KEY_UP,e=>t(new Lh(e))))}oninput(e,t){this._register(X(e,jg.INPUT,t))}onblur(e,t){this._register(X(e,jg.BLUR,t))}onfocus(e,t){this._register(X(e,jg.FOCUS,t))}onchange(e,t){this._register(X(e,jg.CHANGE,t))}ignoreGesture(e){return Hg.ignoreTarget(e)}},Wg=11,Gg=class extends Ug{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=Wg+`px`,this.domNode.style.height=Wg+`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 Rg),this._register(Tg(this.bgDomNode,jg.POINTER_DOWN,e=>this._arrowPointerDown(e))),this._register(Tg(this.domNode,jg.POINTER_DOWN,e=>this._arrowPointerDown(e))),this._pointerdownRepeatTimer=this._register(new Dg),this._pointerdownScheduleRepeatTimer=this._register(new Kh)}_arrowPointerDown(e){!e.target||!(e.target instanceof Element)||(this._onActivate(),this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancelAndSet(()=>{this._pointerdownRepeatTimer.cancelAndSet(()=>this._onActivate(),1e3/24,fg(e))},200),this._pointerMoveMonitor.startMonitoring(e.target,e.pointerId,e.buttons,e=>{},()=>{this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancel()}),e.preventDefault())}},Kg=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}}},qg=class extends wm{constructor(e){super(),this._scrollableBrand=void 0,this._onScroll=this._register(new Y),this.onScroll=this._onScroll.event,this._smoothScrollDuration=e.smoothScrollDuration,this._scheduleAtNextAnimationFrame=e.scheduleAtNextAnimationFrame,this._state=new Kg(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 Zg(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=Zg.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)))}},Jg=class{constructor(e,t,n){this.scrollLeft=e,this.scrollTop=t,this.isDone=n}};function Yg(e,t){let n=t-e;return function(t){return e+n*$g(t)}}function Xg(e,t,n){return function(r){return r<n?e(r/n):t((r-n)/(1-n))}}var Zg=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),Xg(Yg(e,r),Yg(i,t),.33)}return Yg(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 Jg(this.scrollLeft(t),this.scrollTop(t),!1):new Jg(this.to.scrollLeft,this.to.scrollTop,!0)}combine(t,n,r){return e.start(t,n,r)}static start(t,n,r){r+=10;let i=Date.now()-10;return new e(t,n,i,r)}};function Qg(e){return e**3}function $g(e){return 1-Qg(1-e)}var e_=class extends wm{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 Kh)}setVisibility(e){this._visibility!==e&&(this._visibility=e,this._updateShouldBeVisible())}setShouldBeVisible(e){this._rawShouldBeVisible=e,this._updateShouldBeVisible()}_applyVisibilitySetting(){return this._visibility===2?!1:this._visibility===3||this._rawShouldBeVisible}_updateShouldBeVisible(){let e=this._applyVisibilitySetting();this._shouldBeVisible!==e&&(this._shouldBeVisible=e,this.ensureVisibility())}setIsNeeded(e){this._isNeeded!==e&&(this._isNeeded=e,this.ensureVisibility())}setDomNode(e){this._domNode=e,this._domNode.setClassName(this._invisibleClassName),this.setShouldBeVisible(!1)}ensureVisibility(){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`:``)))}},t_=140,n_=class extends Ug{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 e_(e.visibility,`visible scrollbar `+e.extraScrollbarClassName,`invisible scrollbar `+e.extraScrollbarClassName)),this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._pointerMoveMonitor=this._register(new Rg),this._shouldRender=!0,this.domNode=Lg(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(X(this.domNode.domNode,jg.POINTER_DOWN,e=>this._domNodePointerDown(e)))}_createArrow(e){let t=this._register(new Gg(e));this.domNode.domNode.appendChild(t.bgDomNode),this.domNode.domNode.appendChild(t.domNode)}_createSlider(e,t,n,r){this.slider=Lg(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(X(this.slider.domNode,jg.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=Ag(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(mh&&a>t_){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()}},r_=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)}},i_=class extends n_{constructor(e,t,n){let r=e.getScrollDimensions(),i=e.getCurrentScrollPosition();if(super({lazyRender:t.lazyRender,host:n,scrollbarState:new r_(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}},a_=class extends n_{constructor(e,t,n){let r=e.getScrollDimensions(),i=e.getCurrentScrollPosition();if(super({lazyRender:t.lazyRender,host:n,scrollbarState:new r_(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}},o_=500,s_=50,c_=!0,l_=class{constructor(e,t,n){this.timestamp=e,this.deltaX=t,this.deltaY=n,this.score=0}},u_=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($m){let t=Ym(fg(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 l_(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}};u_.INSTANCE=new u_;var d_=u_,f_=class extends Ug{constructor(e,t,n){super(),this._onScroll=this._register(new Y),this.onScroll=this._onScroll.event,this._onWillScroll=this._register(new Y),this.onWillScroll=this._onWillScroll.event,this._options=m_(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 a_(this._scrollable,this._options,r)),this._horizontalScrollbar=this._register(new i_(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=Lg(document.createElement(`div`)),this._leftShadowDomNode.setClassName(`shadow`),this._domNode.appendChild(this._leftShadowDomNode.domNode),this._topShadowDomNode=Lg(document.createElement(`div`)),this._topShadowDomNode.setClassName(`shadow`),this._domNode.appendChild(this._topShadowDomNode.domNode),this._topLeftShadowDomNode=Lg(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 Kh),this._isDragging=!1,this._mouseIsOver=!1,this._shouldRender=!0,this._revealOnScroll=!0}get options(){return this._options}dispose(){this._mouseWheelToDispose=ym(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,hh&&(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 Hh(e))}_setListeningToMouseWheel(e){this._mouseWheelToDispose.length>0!==e&&(this._mouseWheelToDispose=ym(this._mouseWheelToDispose),e)&&this._mouseWheelToDispose.push(X(this._listenOnDomNode,jg.MOUSE_WHEEL,e=>{this._onMouseWheel(new Hh(e))},{passive:!1}))}_onMouseWheel(e){if(e.browserEvent?.defaultPrevented)return;let t=d_.INSTANCE;c_&&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=!hh&&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=s_*r,t=o.scrollTop-(e<0?Math.floor(e):Math.ceil(e));this._verticalScrollbar.writeScrollPosition(s,t)}if(i){let e=s_*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)&&(c_&&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(),o_)}},p_=class extends f_{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 m_(e){let t={lazyRender:typeof e.lazyRender<`u`&&e.lazyRender,className:typeof e.className<`u`?e.className:``,useShadows:typeof e.useShadows<`u`?e.useShadows:!0,handleMouseWheel:typeof e.handleMouseWheel<`u`?e.handleMouseWheel:!0,flipAxes:typeof e.flipAxes<`u`&&e.flipAxes,consumeMouseWheelIfScrollbarIsNeeded:typeof e.consumeMouseWheelIfScrollbarIsNeeded<`u`&&e.consumeMouseWheelIfScrollbarIsNeeded,alwaysConsumeMouseWheel:typeof e.alwaysConsumeMouseWheel<`u`&&e.alwaysConsumeMouseWheel,scrollYToX:typeof e.scrollYToX<`u`&&e.scrollYToX,mouseWheelScrollSensitivity:typeof e.mouseWheelScrollSensitivity<`u`?e.mouseWheelScrollSensitivity:1,fastScrollSensitivity:typeof e.fastScrollSensitivity<`u`?e.fastScrollSensitivity:5,scrollPredominantAxis:typeof e.scrollPredominantAxis<`u`?e.scrollPredominantAxis:!0,mouseWheelSmoothScroll:typeof e.mouseWheelSmoothScroll<`u`?e.mouseWheelSmoothScroll:!0,arrowSize:typeof e.arrowSize<`u`?e.arrowSize:11,listenOnDomNode:typeof e.listenOnDomNode<`u`?e.listenOnDomNode:null,horizontal:typeof e.horizontal<`u`?e.horizontal:1,horizontalScrollbarSize:typeof e.horizontalScrollbarSize<`u`?e.horizontalScrollbarSize:10,horizontalSliderSize:typeof e.horizontalSliderSize<`u`?e.horizontalSliderSize:0,horizontalHasArrows:typeof e.horizontalHasArrows<`u`&&e.horizontalHasArrows,vertical:typeof e.vertical<`u`?e.vertical:1,verticalScrollbarSize:typeof e.verticalScrollbarSize<`u`?e.verticalScrollbarSize:10,verticalHasArrows:typeof e.verticalHasArrows<`u`&&e.verticalHasArrows,verticalSliderSize:typeof e.verticalSliderSize<`u`?e.verticalSliderSize:0,scrollByPage:typeof e.scrollByPage<`u`&&e.scrollByPage};return t.horizontalSliderSize=typeof e.horizontalSliderSize<`u`?e.horizontalSliderSize:t.horizontalScrollbarSize,t.verticalSliderSize=typeof e.verticalSliderSize<`u`?e.verticalSliderSize:t.verticalScrollbarSize,hh&&(t.className+=` mac`),t}var h_=class extends wm{constructor(e,t,n,r,i,a,o,s){super(),this._bufferService=n,this._optionsService=o,this._renderService=s,this._onRequestScrollLines=this._register(new Y),this.onRequestScrollLines=this._onRequestScrollLines.event,this._isSyncing=!1,this._isHandlingScroll=!1,this._suppressOnScrollHandler=!1;let c=this._register(new qg({forceIntegerValues:!1,smoothScrollDuration:this._optionsService.rawOptions.smoothScrollDuration,scheduleAtNextAnimationFrame:e=>Eg(r.window,e)}));this._register(this._optionsService.onSpecificOptionChange(`smoothScrollDuration`,()=>{c.setSmoothScrollDuration(this._optionsService.rawOptions.smoothScrollDuration)})),this._scrollableElement=this._register(new p_(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(Mm.runAndSubscribe(a.onChangeColors,()=>{this._scrollableElement.getDomNode().style.backgroundColor=a.colors.background.css})),e.appendChild(this._scrollableElement.getDomNode()),this._register(xm(()=>this._scrollableElement.getDomNode().remove())),this._styleElement=r.mainDocument.createElement(`style`),t.appendChild(this._styleElement),this._register(xm(()=>this._styleElement.remove())),this._register(Mm.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(`
37
+ `)})),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}};h_=tp([J(2,Op),J(3,Vp),J(4,kp),J(5,Kp),J(6,Pp),J(7,Up)],h_);var g_=class extends wm{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(xm(()=>{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()}};g_=tp([J(1,Op),J(2,Vp),J(3,Lp),J(4,Up)],g_);var __=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)}},v_={full:0,left:0,center:0,right:0},y_={full:0,left:0,center:0,right:0},b_={full:0,left:0,center:0,right:0},x_=class extends wm{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 __,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(xm(()=>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);y_.full=this._canvas.width,y_.left=e,y_.center=t,y_.right=e,this._refreshDrawHeightConstants(),b_.full=1,b_.left=1,b_.center=1+y_.left,b_.right=1+y_.left+y_.center}_refreshDrawHeightConstants(){v_.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);v_.left=t,v_.center=t,v_.right=t}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*v_.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*v_.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*v_.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*v_.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(b_[e.position||`full`],Math.round((this._canvas.height-1)*(e.startBufferLine/this._bufferService.buffers.active.lines.length)-v_[e.position||`full`]/2),y_[e.position||`full`],Math.round((this._canvas.height-1)*((e.endBufferLine-e.startBufferLine)/this._bufferService.buffers.active.lines.length)+v_[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}))}};x_=tp([J(2,Op),J(3,Lp),J(4,Up),J(5,Pp),J(6,Kp),J(7,Vp)],x_);var Z;(e=>(e.NUL=`\0`,e.SOH=``,e.STX=``,e.ETX=``,e.EOT=``,e.ENQ=``,e.ACK=``,e.BEL=`\x07`,e.BS=`\b`,e.HT=` `,e.LF=`
38
+ `,e.VT=`\v`,e.FF=`\f`,e.CR=`\r`,e.SO=``,e.SI=``,e.DLE=``,e.DC1=``,e.DC2=``,e.DC3=``,e.DC4=``,e.NAK=``,e.SYN=``,e.ETB=``,e.CAN=``,e.EM=``,e.SUB=``,e.ESC=`\x1B`,e.FS=``,e.GS=``,e.RS=``,e.US=``,e.SP=` `,e.DEL=``))(Z||={});var S_;(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=`Ÿ`))(S_||={});var C_;(e=>e.ST=`${Z.ESC}\\`)(C_||={});var w_=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(`${Z.DEL}`,!0):t.length===e.length&&t!==e&&this._coreService.triggerDataEvent(t,!0)}},0)}updateCompositionElements(e){if(this._isComposing){if(this._bufferService.buffer.isCursorInViewport){let e=Math.min(this._bufferService.buffer.x,this._bufferService.cols-1),t=this._renderService.dimensions.css.cell.height,n=this._bufferService.buffer.y*this._renderService.dimensions.css.cell.height,r=e*this._renderService.dimensions.css.cell.width;this._compositionView.style.left=r+`px`,this._compositionView.style.top=n+`px`,this._compositionView.style.height=t+`px`,this._compositionView.style.lineHeight=t+`px`,this._compositionView.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._compositionView.style.fontSize=this._optionsService.rawOptions.fontSize+`px`;let i=this._compositionView.getBoundingClientRect();this._textarea.style.left=r+`px`,this._textarea.style.top=n+`px`,this._textarea.style.width=Math.max(i.width,1)+`px`,this._textarea.style.height=Math.max(i.height,1)+`px`,this._textarea.style.lineHeight=i.height+`px`}e||setTimeout(()=>this.updateCompositionElements(!0),0)}}};w_=tp([J(2,Op),J(3,Pp),J(4,Ap),J(5,Up)],w_);var T_=0,E_=0,D_=0,O_=0,k_={css:`#00000000`,rgba:0},A_;(e=>{function t(e,t,n,r){return r===void 0?`#${F_(e)}${F_(t)}${F_(n)}`:`#${F_(e)}${F_(t)}${F_(n)}${F_(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})(A_||={});var j_;(e=>{function t(e,t){if(O_=(t.rgba&255)/255,O_===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 T_=a+Math.round((n-a)*O_),E_=o+Math.round((r-o)*O_),D_=s+Math.round((i-s)*O_),{css:A_.toCss(T_,E_,D_),rgba:A_.toRgba(T_,E_,D_)}}e.blend=t;function n(e){return(e.rgba&255)==255}e.isOpaque=n;function r(e,t,n){let r=P_.ensureContrastRatio(e.rgba,t.rgba,n);if(r)return A_.toColor(r>>24&255,r>>16&255,r>>8&255)}e.ensureContrastRatio=r;function i(e){let t=(e.rgba|255)>>>0;return[T_,E_,D_]=P_.toChannels(t),{css:A_.toCss(T_,E_,D_),rgba:t}}e.opaque=i;function a(e,t){return O_=Math.round(t*255),[T_,E_,D_]=P_.toChannels(e.rgba),{css:A_.toCss(T_,E_,D_,O_),rgba:A_.toRgba(T_,E_,D_,O_)}}e.opacity=a;function o(e,t){return O_=e.rgba&255,a(e,O_*t/255)}e.multiplyOpacity=o;function s(e){return[e.rgba>>24&255,e.rgba>>16&255,e.rgba>>8&255]}e.toColorRGB=s})(j_||={});var M_;(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 T_=parseInt(e.slice(1,2).repeat(2),16),E_=parseInt(e.slice(2,3).repeat(2),16),D_=parseInt(e.slice(3,4).repeat(2),16),A_.toColor(T_,E_,D_);case 5:return T_=parseInt(e.slice(1,2).repeat(2),16),E_=parseInt(e.slice(2,3).repeat(2),16),D_=parseInt(e.slice(3,4).repeat(2),16),O_=parseInt(e.slice(4,5).repeat(2),16),A_.toColor(T_,E_,D_,O_);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 T_=parseInt(r[1]),E_=parseInt(r[2]),D_=parseInt(r[3]),O_=Math.round((r[5]===void 0?1:parseFloat(r[5]))*255),A_.toColor(T_,E_,D_,O_);if(!t||!n||(t.fillStyle=n,t.fillStyle=e,typeof t.fillStyle!=`string`)||(t.fillRect(0,0,1,1),[T_,E_,D_,O_]=t.getImageData(0,0,1,1).data,O_!==255))throw Error(`css.toColor: Unsupported css format`);return{rgba:A_.toRgba(T_,E_,D_,O_),css:e}}e.toColor=r})(M_||={});var N_;(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})(N_||={});var P_;(e=>{function t(e,t){if(O_=(t&255)/255,O_===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 T_=a+Math.round((n-a)*O_),E_=o+Math.round((r-o)*O_),D_=s+Math.round((i-s)*O_),A_.toRgba(T_,E_,D_)}e.blend=t;function n(e,t,n){let a=N_.relativeLuminance(e>>8),o=N_.relativeLuminance(t>>8);if(I_(a,o)<n){if(o<a){let o=r(e,t,n),s=I_(a,N_.relativeLuminance(o>>8));if(s<n){let r=i(e,t,n);return s>I_(a,N_.relativeLuminance(r>>8))?o:r}return o}let s=i(e,t,n),c=I_(a,N_.relativeLuminance(s>>8));if(c<n){let i=r(e,t,n);return c>I_(a,N_.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=I_(N_.relativeLuminance2(o,s,c),N_.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=I_(N_.relativeLuminance2(o,s,c),N_.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=I_(N_.relativeLuminance2(o,s,c),N_.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=I_(N_.relativeLuminance2(o,s,c),N_.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})(P_||={});function F_(e){let t=e.toString(16);return t.length<2?`0`+t:t}function I_(e,t){return e<t?(t+.05)/(e+.05):(e+.05)/(t+.05)}var L_=class extends yp{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()]}},R_=class{constructor(e){this._bufferService=e,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new xp}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||vp.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++)R_._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||vp.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}};R_=tp([J(0,Op)],R_);function z_(e){return 57508<=e&&e<=57558}function B_(e){return 9472<=e&&e<=9631}function V_(e){return z_(e)||B_(e)}function H_(){return{css:{canvas:U_(),cell:U_()},device:{canvas:U_(),cell:U_(),char:{width:0,height:0,left:0,top:0}}}}function U_(){return{width:0,height:0}}var W_=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 xp,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 ee=!1,te=k>=E,A=k,j=this._workCell;if(f.length>0&&k===f[0][0]&&te){let r=f.shift(),i=this._isCellInSelection(r[0],t);for(v=r[0]+1;v<r[1];v++)te&&=i===this._isCellInSelection(v,t);te&&=!n||a<r[0]||a>=r[1],te?(ee=!0,j=new L_(this._workCell,e.translateToString(!0,r[0],r[1]),r[1]-r[0]),A=r[1]-1,m=j.getWidth()):E=r[1]}let M=this._isCellInSelection(k,t),N=n&&k===a,P=O&&k>=l&&k<=u,F=!1;this._decorationService.forEachDecorationAtCell(k,t,void 0,e=>{F=!0});let ne=j.getChars()||vp;if(ne===` `&&(j.isUnderline()||j.isOverline())&&(ne=`\xA0`),T=m*s-c.get(ne,j.isBold(),j.isItalic()),!h)h=this._document.createElement(`span`);else if(g&&(M&&w||!M&&!w&&j.bg===y)&&(M&&w&&p.selectionForeground||j.fg===b)&&j.extended.ext===x&&P===S&&T===C&&!N&&!ee&&!F&&te){j.isInvisible()?_+=vp:_+=ne,g++;continue}else g&&(h.textContent=_),h=this._document.createElement(`span`),g=0,_=``;if(y=j.bg,b=j.fg,x=j.extended.ext,S=P,C=T,w=M,ee&&a>=k&&a<=A&&(a=k),!this._coreService.isCursorHidden&&N&&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(j.isBold()&&D.push(`xterm-bold`),j.isItalic()&&D.push(`xterm-italic`),j.isDim()&&D.push(`xterm-dim`),_=j.isInvisible()?vp:j.getChars()||vp,j.isUnderline()&&(D.push(`xterm-underline-${j.extended.underlineStyle}`),_===` `&&(_=`\xA0`),!j.isUnderlineColorDefault()))if(j.isUnderlineColorRGB())h.style.textDecorationColor=`rgb(${yp.toColorRGB(j.getUnderlineColor()).join(`,`)})`;else{let e=j.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&j.isBold()&&e<8&&(e+=8),h.style.textDecorationColor=p.ansi[e].css}j.isOverline()&&(D.push(`xterm-overline`),_===` `&&(_=`\xA0`)),j.isStrikethrough()&&D.push(`xterm-strikethrough`),P&&(h.style.textDecoration=`underline`);let re=j.getFgColor(),ie=j.getFgColorMode(),I=j.getBgColor(),L=j.getBgColorMode(),R=!!j.isInverse();if(R){let e=re;re=I,I=e;let t=ie;ie=L,L=t}let ae,z,oe=!1;this._decorationService.forEachDecorationAtCell(k,t,void 0,e=>{e.options.layer!==`top`&&oe||(e.backgroundColorRGB&&(L=50331648,I=e.backgroundColorRGB.rgba>>8&16777215,ae=e.backgroundColorRGB),e.foregroundColorRGB&&(ie=50331648,re=e.foregroundColorRGB.rgba>>8&16777215,z=e.foregroundColorRGB),oe=e.options.layer===`top`)}),!oe&&M&&(ae=this._coreBrowserService.isFocused?p.selectionBackgroundOpaque:p.selectionInactiveBackgroundOpaque,I=ae.rgba>>8&16777215,L=50331648,oe=!0,p.selectionForeground&&(ie=50331648,re=p.selectionForeground.rgba>>8&16777215,z=p.selectionForeground)),oe&&D.push(`xterm-decoration-top`);let se;switch(L){case 16777216:case 33554432:se=p.ansi[I],D.push(`xterm-bg-${I}`);break;case 50331648:se=A_.toColor(I>>16,I>>8&255,I&255),this._addStyle(h,`background-color:#${G_((I>>>0).toString(16),`0`,6)}`);break;default:R?(se=p.foreground,D.push(`xterm-bg-257`)):se=p.background}switch(ae||j.isDim()&&(ae=j_.multiplyOpacity(se,.5)),ie){case 16777216:case 33554432:j.isBold()&&re<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(re+=8),this._applyMinimumContrast(h,se,p.ansi[re],j,ae,void 0)||D.push(`xterm-fg-${re}`);break;case 50331648:let e=A_.toColor(re>>16&255,re>>8&255,re&255);this._applyMinimumContrast(h,se,e,j,ae,z)||this._addStyle(h,`color:#${G_(re.toString(16),`0`,6)}`);break;default:this._applyMinimumContrast(h,se,p.foreground,j,ae,z)||R&&D.push(`xterm-fg-257`)}D.length&&=(h.className=D.join(` `),0),!N&&!ee&&!F&&te?g++:h.textContent=_,T!==this.defaultSpacing&&(h.style.letterSpacing=`${T}px`),d.push(h),k=A}return h&&g&&(h.textContent=_),d}_applyMinimumContrast(e,t,n,r,i,a){if(this._optionsService.rawOptions.minimumContrastRatio===1||V_(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=j_.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]}};W_=tp([J(1,Gp),J(2,Pp),J(3,Vp),J(4,Ap),J(5,Lp),J(6,Kp)],W_);function G_(e,t,n){for(;e.length<n;)e=t+e;return e}var K_=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}},q_=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 J_(){return new q_}var Y_=`xterm-dom-renderer-owner-`,X_=`xterm-rows`,Z_=`xterm-fg-`,Q_=`xterm-bg-`,$_=`xterm-focus`,ev=`xterm-selection`,tv=1,nv=class extends wm{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=tv++,this._rowElements=[],this._selectionRenderModel=J_(),this.onRequestRedraw=this._register(new Y).event,this._rowContainer=this._document.createElement(`div`),this._rowContainer.classList.add(X_),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(ev),this._selectionContainer.setAttribute(`aria-hidden`,`true`),this.dimensions=H_(),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(W_,document),this._element.classList.add(Y_+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(xm(()=>{this._element.classList.remove(Y_+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()})),this._widthCache=new K_(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} .${X_} 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} .${X_} { 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} .${X_} .xterm-dim { color: ${j_.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} .${X_}.${$_} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${n} 1s step-end infinite;}${this._terminalSelector} .${X_}.${$_} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${r} 1s step-end infinite;}${this._terminalSelector} .${X_}.${$_} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${i} 1s step-end infinite;}${this._terminalSelector} .${X_} .xterm-cursor.xterm-cursor-block { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css};}${this._terminalSelector} .${X_} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${e.cursor.css} !important; color: ${e.cursorAccent.css} !important;}${this._terminalSelector} .${X_} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${e.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${X_} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${e.cursor.css} inset;}${this._terminalSelector} .${X_} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${e.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,t+=`${this._terminalSelector} .${ev} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${ev} div { position: absolute; background-color: ${e.selectionBackgroundOpaque.css};}${this._terminalSelector} .${ev} div { position: absolute; background-color: ${e.selectionInactiveBackgroundOpaque.css};}`;for(let[n,r]of e.ansi.entries())t+=`${this._terminalSelector} .${Z_}${n} { color: ${r.css}; }${this._terminalSelector} .${Z_}${n}.xterm-dim { color: ${j_.multiplyOpacity(r,.5).css}; }${this._terminalSelector} .${Q_}${n} { background-color: ${r.css}; }`;t+=`${this._terminalSelector} .${Z_}257 { color: ${j_.opaque(e.background).css}; }${this._terminalSelector} .${Z_}257.xterm-dim { color: ${j_.multiplyOpacity(j_.opaque(e.background),.5).css}; }${this._terminalSelector} .${Q_}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($_),this.renderRows(0,this._bufferService.rows-1)}handleFocus(){this._rowContainer.classList.add($_),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`.${Y_}${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))}}};nv=tp([J(7,Mp),J(8,Bp),J(9,Pp),J(10,Op),J(11,Ap),J(12,Vp),J(13,Kp)],nv);var rv=class extends wm{constructor(e,t,n){super(),this._optionsService=n,this.width=0,this.height=0,this._onCharSizeChange=this._register(new Y),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this._register(new ov(this._optionsService))}catch{this._measureStrategy=this._register(new av(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())}};rv=tp([J(2,Pp)],rv);var iv=class extends wm{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)}},av=class extends iv{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}},ov=class extends iv{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}},sv=class extends wm{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 cv(this._window)),this._onDprChange=this._register(new Y),this.onDprChange=this._onDprChange.event,this._onWindowChange=this._register(new Y),this.onWindowChange=this._onWindowChange.event,this._register(this.onWindowChange(e=>this._screenDprMonitor.setWindow(e))),this._register(Mm.forward(this._screenDprMonitor.onDprChange,this._onDprChange)),this._register(X(this._textarea,`focus`,()=>this._isFocused=!0)),this._register(X(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}},cv=class extends wm{constructor(e){super(),this._parentWindow=e,this._windowResizeListener=this._register(new Tm),this._onDprChange=this._register(new Y),this.onDprChange=this._onDprChange.event,this._outerListener=()=>this._setDprAndFireIfDiffers(),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._updateDpr(),this._setWindowResizeListener(),this._register(xm(()=>this.clearListener()))}setWindow(e){this._parentWindow=e,this._setWindowResizeListener(),this._setDprAndFireIfDiffers()}_setWindowResizeListener(){this._windowResizeListener.value=X(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)}},lv=class extends wm{constructor(){super(),this.linkProviders=[],this._register(xm(()=>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 uv(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 dv(e,t,n,r,i,a,o,s,c){if(!a)return;let l=uv(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 fv=class{constructor(e,t){this._renderService=e,this._charSizeService=t}getCoords(e,t,n,r,i){return dv(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=uv(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])}}};fv=tp([J(0,Up),J(1,Bp)],fv);var pv=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=[]}},mv={};ep(mv,{getSafariVersion:()=>xv,isChromeOS:()=>Dv,isFirefox:()=>vv,isIpad:()=>Cv,isIphone:()=>wv,isLegacyEdge:()=>yv,isLinux:()=>Ev,isMac:()=>Sv,isNode:()=>hv,isSafari:()=>bv,isWindows:()=>Tv});var hv=typeof process<`u`&&`title`in process,gv=hv?`node`:navigator.userAgent,_v=hv?`node`:navigator.platform,vv=gv.includes(`Firefox`),yv=gv.includes(`Edge`),bv=/^((?!chrome|android).)*safari/i.test(gv);function xv(){if(!bv)return 0;let e=gv.match(/Version\/(\d+)/);return e===null||e.length<2?0:parseInt(e[1])}var Sv=[`Macintosh`,`MacIntel`,`MacPPC`,`Mac68K`].includes(_v),Cv=_v===`iPad`,wv=_v===`iPhone`,Tv=[`Windows`,`Win16`,`Win32`,`WinCE`].includes(_v),Ev=_v.indexOf(`Linux`)>=0,Dv=/\bCrOS\b/.test(gv),Ov=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()}},kv=class extends Ov{_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())}}},Av=class extends Ov{_requestCallback(e){return requestIdleCallback(e)}_cancelCallback(e){cancelIdleCallback(e)}},jv=!hv&&`requestIdleCallback`in window?Av:kv,Mv=class{constructor(){this._queue=new jv}set(e){this._queue.clear(),this._queue.enqueue(e)}flush(){this._queue.flush()}},Nv=class extends wm{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 Tm),this._pausedResizeTask=new Mv,this._observerDisposable=this._register(new Tm),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 Y),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this._register(new Y),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this._register(new Y),this.onRender=this._onRender.event,this._onRefreshRequest=this._register(new Y),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new pv((e,t)=>this._renderRows(e,t),this._coreBrowserService),this._register(this._renderDebouncer),this._syncOutputHandler=new Pv(this._coreBrowserService,this._coreService,()=>this._fullRefresh()),this._register(xm(()=>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=xm(()=>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()}};Nv=tp([J(2,Pp),J(3,Bp),J(4,Ap),J(5,Lp),J(6,Op),J(7,Vp),J(8,Kp)],Nv);var Pv=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 Fv(e,t,n,r){let i=n.buffer.x,a=n.buffer.y;if(!n.buffer.hasScrollback)return Rv(i,a,e,t,n,r)+zv(a,t,n,r)+Bv(i,a,e,t,n,r);let o;if(a===t)return o=i>e?`D`:`C`,qv(Math.abs(i-e),Kv(o,r));o=a>t?`D`:`C`;let s=Math.abs(a-t);return qv(Lv(a>t?e:i,n)+(s-1)*n.cols+1+Iv(a>t?i:e,n),Kv(o,r))}function Iv(e,t){return e-1}function Lv(e,t){return t.cols-e}function Rv(e,t,n,r,i,a){return zv(t,r,i,a).length===0?``:qv(Gv(e,t,e,t-Hv(t,i),!1,i).length,Kv(`D`,a))}function zv(e,t,n,r){let i=e-Hv(e,n),a=t-Hv(t,n);return qv(Math.abs(i-a)-Vv(e,t,n),Kv(Wv(e,t),r))}function Bv(e,t,n,r,i,a){let o;o=zv(t,r,i,a).length>0?r-Hv(r,i):t;let s=r,c=Uv(e,t,n,r,i,a);return qv(Gv(e,o,n,s,c===`C`,i).length,Kv(c,a))}function Vv(e,t,n){let r=0,i=e-Hv(e,n),a=t-Hv(t,n);for(let o=0;o<Math.abs(i-a);o++){let a=Wv(e,t)===`A`?-1:1;n.buffer.lines.get(i+a*o)?.isWrapped&&r++}return r}function Hv(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 Uv(e,t,n,r,i,a){let o;return o=zv(n,r,i,a).length>0?r-Hv(r,i):t,e<n&&o<=r||e>=n&&o<r?`C`:`D`}function Wv(e,t){return e>t?`A`:`B`}function Gv(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 Kv(e,t){let n=t?`O`:`[`;return Z.ESC+n+e}function qv(e,t){e=Math.floor(e);let n=``;for(let r=0;r<e;r++)n+=t;return n}var Jv=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 Yv(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 Xv=50,Zv=15,Qv=50,$v=500,ey=RegExp(`\xA0`,`g`),ty=class extends wm{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 xp,this._mouseDownTimeStamp=0,this._oldHasSelection=!1,this._oldSelectionStart=void 0,this._oldSelectionEnd=void 0,this._onLinuxMouseSelection=this._register(new Y),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this._register(new Y),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this._register(new Y),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this._register(new Y),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 Jv(this._bufferService),this._activeSelectionMode=0,this._register(xm(()=>{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(ey,` `)).join(Tv?`\r
39
+ `:`
40
+ `)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(e){this._refreshAnimationFrame||=this._coreBrowserService.window.requestAnimationFrame(()=>this._refresh()),Ev&&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=Yv(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=uv(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,-Xv),Xv),t/=Xv,t/Math.abs(t)+Math.round(t*(Zv-1)))}shouldForceSelection(e){return Sv?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(),Qv)}_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&&!(Sv&&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<$v&&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=Fv(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&&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=Yv(n,this._bufferService.cols)}};ty=tp([J(3,Op),J(4,Ap),J(5,Hp),J(6,Pp),J(7,Up),J(8,Vp)],ty);var ny=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={}}},ry=class{constructor(){this._color=new ny,this._css=new ny}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()}},iy=Object.freeze((()=>{let e=[M_.toColor(`#2e3436`),M_.toColor(`#cc0000`),M_.toColor(`#4e9a06`),M_.toColor(`#c4a000`),M_.toColor(`#3465a4`),M_.toColor(`#75507b`),M_.toColor(`#06989a`),M_.toColor(`#d3d7cf`),M_.toColor(`#555753`),M_.toColor(`#ef2929`),M_.toColor(`#8ae234`),M_.toColor(`#fce94f`),M_.toColor(`#729fcf`),M_.toColor(`#ad7fa8`),M_.toColor(`#34e2e2`),M_.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:A_.toCss(r,i,a),rgba:A_.toRgba(r,i,a)})}for(let t=0;t<24;t++){let n=8+t*10;e.push({css:A_.toCss(n,n,n),rgba:A_.toRgba(n,n,n)})}return e})()),ay=M_.toColor(`#ffffff`),oy=M_.toColor(`#000000`),sy=M_.toColor(`#ffffff`),cy=oy,ly={css:`rgba(255, 255, 255, 0.3)`,rgba:4294967117},uy=ay,dy=class extends wm{constructor(e){super(),this._optionsService=e,this._contrastCache=new ry,this._halfContrastCache=new ry,this._onChangeColors=this._register(new Y),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:ay,background:oy,cursor:sy,cursorAccent:cy,selectionForeground:void 0,selectionBackgroundTransparent:ly,selectionBackgroundOpaque:j_.blend(oy,ly),selectionInactiveBackgroundTransparent:ly,selectionInactiveBackgroundOpaque:j_.blend(oy,ly),scrollbarSliderBackground:j_.opacity(ay,.2),scrollbarSliderHoverBackground:j_.opacity(ay,.4),scrollbarSliderActiveBackground:j_.opacity(ay,.5),overviewRulerBorder:ay,ansi:iy.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=fy(e.foreground,ay),t.background=fy(e.background,oy),t.cursor=j_.blend(t.background,fy(e.cursor,sy)),t.cursorAccent=j_.blend(t.background,fy(e.cursorAccent,cy)),t.selectionBackgroundTransparent=fy(e.selectionBackground,ly),t.selectionBackgroundOpaque=j_.blend(t.background,t.selectionBackgroundTransparent),t.selectionInactiveBackgroundTransparent=fy(e.selectionInactiveBackground,t.selectionBackgroundTransparent),t.selectionInactiveBackgroundOpaque=j_.blend(t.background,t.selectionInactiveBackgroundTransparent),t.selectionForeground=e.selectionForeground?fy(e.selectionForeground,k_):void 0,t.selectionForeground===k_&&(t.selectionForeground=void 0),j_.isOpaque(t.selectionBackgroundTransparent)&&(t.selectionBackgroundTransparent=j_.opacity(t.selectionBackgroundTransparent,.3)),j_.isOpaque(t.selectionInactiveBackgroundTransparent)&&(t.selectionInactiveBackgroundTransparent=j_.opacity(t.selectionInactiveBackgroundTransparent,.3)),t.scrollbarSliderBackground=fy(e.scrollbarSliderBackground,j_.opacity(t.foreground,.2)),t.scrollbarSliderHoverBackground=fy(e.scrollbarSliderHoverBackground,j_.opacity(t.foreground,.4)),t.scrollbarSliderActiveBackground=fy(e.scrollbarSliderActiveBackground,j_.opacity(t.foreground,.5)),t.overviewRulerBorder=fy(e.overviewRulerBorder,uy),t.ansi=iy.slice(),t.ansi[0]=fy(e.black,iy[0]),t.ansi[1]=fy(e.red,iy[1]),t.ansi[2]=fy(e.green,iy[2]),t.ansi[3]=fy(e.yellow,iy[3]),t.ansi[4]=fy(e.blue,iy[4]),t.ansi[5]=fy(e.magenta,iy[5]),t.ansi[6]=fy(e.cyan,iy[6]),t.ansi[7]=fy(e.white,iy[7]),t.ansi[8]=fy(e.brightBlack,iy[8]),t.ansi[9]=fy(e.brightRed,iy[9]),t.ansi[10]=fy(e.brightGreen,iy[10]),t.ansi[11]=fy(e.brightYellow,iy[11]),t.ansi[12]=fy(e.brightBlue,iy[12]),t.ansi[13]=fy(e.brightMagenta,iy[13]),t.ansi[14]=fy(e.brightCyan,iy[14]),t.ansi[15]=fy(e.brightWhite,iy[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]=fy(e.extendedAnsi[r],iy[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()}}};dy=tp([J(0,Pp)],dy);function fy(e,t){if(e!==void 0)try{return M_.toColor(e)}catch{}return t}var py=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)}},my=class{constructor(){this._services=new py,this._services.set(Mp,this)}setService(e,t){this._services.set(e,t)}getService(e){return this._services.get(e)}createInstance(e,...t){let n=Tp(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)}},hy={trace:0,debug:1,info:2,warn:3,error:4,off:5},gy=`xterm.js: `,_y=class extends wm{constructor(e){super(),this._optionsService=e,this._logLevel=5,this._updateLogLevel(),this._register(this._optionsService.onSpecificOptionChange(`logLevel`,()=>this._updateLogLevel())),vy=this}get logLevel(){return this._logLevel}_updateLogLevel(){this._logLevel=hy[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?``:gy)+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)}};_y=tp([J(0,Pp)],_y);var vy,yy=class extends wm{constructor(e){super(),this._maxLength=e,this.onDeleteEmitter=this._register(new Y),this.onDelete=this.onDeleteEmitter.event,this.onInsertEmitter=this._register(new Y),this.onInsert=this.onInsertEmitter.event,this.onTrimEmitter=this._register(new Y),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}},by=3,xy=Object.freeze(new yp),Sy=0,Cy=2,wy=class e{constructor(e,t,n=!1){this.isWrapped=n,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(e*by);let r=t||xp.fromCharData([0,_p,1,0]);for(let t=0;t<e;++t)this.setCell(t,r);this.length=e}get(e){let t=this._data[e*by+0],n=t&2097151;return[this._data[e*by+1],t&2097152?this._combined[e]:n?pp(n):``,t>>22,t&2097152?this._combined[e].charCodeAt(this._combined[e].length-1):n]}set(e,t){this._data[e*by+1]=t[0],t[1].length>1?(this._combined[e]=t[1],this._data[e*by+0]=e|2097152|t[2]<<22):this._data[e*by+0]=t[1].charCodeAt(0)|t[2]<<22}getWidth(e){return this._data[e*by+0]>>22}hasWidth(e){return this._data[e*by+0]&12582912}getFg(e){return this._data[e*by+1]}getBg(e){return this._data[e*by+2]}hasContent(e){return this._data[e*by+0]&4194303}getCodePoint(e){let t=this._data[e*by+0];return t&2097152?this._combined[e].charCodeAt(this._combined[e].length-1):t&2097151}isCombined(e){return this._data[e*by+0]&2097152}getString(e){let t=this._data[e*by+0];return t&2097152?this._combined[e]:t&2097151?pp(t&2097151):``}isProtected(e){return this._data[e*by+2]&536870912}loadCell(e,t){return Sy=e*by,t.content=this._data[Sy+0],t.fg=this._data[Sy+1],t.bg=this._data[Sy+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*by+0]=t.content,this._data[e*by+1]=t.fg,this._data[e*by+2]=t.bg}setCellFromCodepoint(e,t,n,r){r.bg&268435456&&(this._extendedAttrs[e]=r.extended),this._data[e*by+0]=t|n<<22,this._data[e*by+1]=r.fg,this._data[e*by+2]=r.bg}addCodepointToCell(e,t,n){let r=this._data[e*by+0];r&2097152?this._combined[e]+=pp(t):r&2097151?(this._combined[e]=pp(r&2097151)+pp(t),r&=-2097152,r|=2097152):r=t|1<<22,n&&(r&=-12582913,r|=n<<22),this._data[e*by+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 xp;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 xp;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*Cy<this._data.buffer.byteLength;let n=e*by;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*Cy<this._data.buffer.byteLength}cleanupMemory(){if(this._data.length*4*Cy<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*by+0]&4194303)return e+(this._data[e*by+0]>>22);return 0}getNoBgTrimmedLength(){for(let e=this.length-1;e>=0;--e)if(this._data[e*by+0]&4194303||this._data[e*by+2]&50331648)return e+(this._data[e*by+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<by;e++)this._data[(n+i)*by+e]=a[(t+i)*by+e];a[(t+i)*by+2]&268435456&&(this._extendedAttrs[n+i]=e._extendedAttrs[t+i])}else for(let i=0;i<r;i++){for(let e=0;e<by;e++)this._data[(n+i)*by+e]=a[(t+i)*by+e];a[(t+i)*by+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*by+0],n=e&2097151,a=e&2097152?this._combined[t]:n?pp(n):vp;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 Ty(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=ky(u,d,t),p=1,m=0;for(;p<u.length;){let e=ky(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 Ey(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 Dy(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 Oy(e,t,n){let r=[],i=e.map((n,r)=>ky(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=ky(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 ky(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 Ay=class e{constructor(t){this.line=t,this.isDisposed=!1,this._disposables=[],this._id=e._nextId++,this._onDispose=this.register(new Y),this.onDispose=this._onDispose.event}get id(){return this._id}dispose(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire(),ym(this._disposables),this._disposables.length=0)}register(e){return this._disposables.push(e),e}};Ay._nextId=1;var jy=Ay,My={},Ny=My.B;My[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:`≥`,"{":`π`,"|":`≠`,"}":`£`,"~":`·`},My.A={"#":`£`},My.B=void 0,My[4]={"#":`£`,"@":`¾`,"[":`ij`,"\\":`½`,"]":`|`,"{":`¨`,"|":`f`,"}":`¼`,"~":`´`},My.C=My[5]={"[":`Ä`,"\\":`Ö`,"]":`Å`,"^":`Ü`,"`":`é`,"{":`ä`,"|":`ö`,"}":`å`,"~":`ü`},My.R={"#":`£`,"@":`à`,"[":`°`,"\\":`ç`,"]":`§`,"{":`é`,"|":`ù`,"}":`è`,"~":`¨`},My.Q={"@":`à`,"[":`â`,"\\":`ç`,"]":`ê`,"^":`î`,"`":`ô`,"{":`é`,"|":`ù`,"}":`è`,"~":`û`},My.K={"@":`§`,"[":`Ä`,"\\":`Ö`,"]":`Ü`,"{":`ä`,"|":`ö`,"}":`ü`,"~":`ß`},My.Y={"#":`£`,"@":`§`,"[":`°`,"\\":`ç`,"]":`é`,"`":`ù`,"{":`à`,"|":`ò`,"}":`è`,"~":`ì`},My.E=My[6]={"@":`Ä`,"[":`Æ`,"\\":`Ø`,"]":`Å`,"^":`Ü`,"`":`ä`,"{":`æ`,"|":`ø`,"}":`å`,"~":`ü`},My.Z={"#":`£`,"@":`§`,"[":`¡`,"\\":`Ñ`,"]":`¿`,"{":`°`,"|":`ñ`,"}":`ç`},My.H=My[7]={"@":`É`,"[":`Ä`,"\\":`Ö`,"]":`Å`,"^":`Ü`,"`":`é`,"{":`ä`,"|":`ö`,"}":`å`,"~":`ü`},My[`=`]={"#":`ù`,"@":`à`,"[":`é`,"\\":`ç`,"]":`ê`,"^":`î`,_:`è`,"`":`ô`,"{":`ä`,"|":`ö`,"}":`ü`,"~":`û`};var Py=4294967295,Fy=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=xy.clone(),this.savedCharset=Ny,this.markers=[],this._nullCell=xp.fromCharData([0,_p,1,0]),this._whitespaceCell=xp.fromCharData([0,vp,1,32]),this._isClearing=!1,this._memoryCleanupQueue=new jv,this._memoryCleanupPosition=0,this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new yy(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 bp),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 bp),this._whitespaceCell}getBlankLine(e,t){return new wy(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>Py?Py:t}fillViewportRows(e){if(this.lines.length===0){e===void 0&&(e=xy);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 yy(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(e,t){let n=this.getNullCell(xy),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 wy(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 wy(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=Ty(this.lines,this._cols,e,this.ybase+this.y,this.getNullCell(xy),n);if(r.length>0){let n=Ey(this.lines,r);Dy(this.lines,n.layout),this._reflowLargerAdjustViewport(e,t,n.countRemoved)}}_reflowLargerAdjustViewport(e,t,n){let r=this.getNullCell(xy),i=n;for(;i-->0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length<t&&this.lines.push(new wy(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(xy),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=Oy(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(xy,!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--,_=ky(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 jy(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)}},Iy=class extends wm{constructor(e,t){super(),this._optionsService=e,this._bufferService=t,this._onBufferActivate=this._register(new Y),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 Fy(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new Fy(!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)}},Ly=2,Ry=1,zy=class extends wm{constructor(e){super(),this.isUserScrolling=!1,this._onResize=this._register(new Y),this.onResize=this._onResize.event,this._onScroll=this._register(new Y),this.onScroll=this._onScroll.event,this.cols=Math.max(e.rawOptions.cols||0,Ly),this.rows=Math.max(e.rawOptions.rows||0,Ry),this.buffers=this._register(new Iy(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))}};zy=tp([J(0,Pp)],zy);var By={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:Sv,windowOptions:{},windowsMode:!1,windowsPty:{},wordSeparator:` ()[]{}',"\``,altClickMovesCursor:!0,convertEol:!1,termName:`xterm`,cancelEvents:!1,overviewRuler:{}},Vy=[`normal`,`bold`,`100`,`200`,`300`,`400`,`500`,`600`,`700`,`800`,`900`],Hy=class extends wm{constructor(e){super(),this._onOptionChange=this._register(new Y),this.onOptionChange=this._onOptionChange.event;let t={...By};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(xm(()=>{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 By))throw Error(`No option with key "${e}"`);return this.rawOptions[e]},t=(e,t)=>{if(!(e in By))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||=By[e],!Uy(t))throw Error(`"${t}" is not a valid value for ${e}`);break;case`wordSeparator`:t||=By[e];break;case`fontWeight`:case`fontWeightBold`:if(typeof t==`number`&&1<=t&&t<=1e3)break;t=Vy.includes(t)?t:By[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 Uy(e){return e===`block`||e===`underline`||e===`bar`}function Wy(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]&&Wy(e[r],t-1);return n}var Gy=Object.freeze({insertMode:!1}),Ky=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,cursorBlink:void 0,cursorStyle:void 0,origin:!1,reverseWraparound:!1,sendFocus:!1,synchronizedOutput:!1,wraparound:!0}),qy=class extends wm{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 Y),this.onData=this._onData.event,this._onUserInput=this._register(new Y),this.onUserInput=this._onUserInput.event,this._onBinary=this._register(new Y),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this._register(new Y),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=Wy(Gy),this.decPrivateModes=Wy(Ky)}reset(){this.modes=Wy(Gy),this.decPrivateModes=Wy(Ky)}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))}};qy=tp([J(0,Op),J(1,Np),J(2,Pp)],qy);var Jy={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 Yy(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 Xy=String.fromCharCode,Zy={DEFAULT:e=>{let t=[Yy(e,!1)+32,e.col+32,e.row+32];return t[0]>255||t[1]>255||t[2]>255?``:`\x1B[M${Xy(t[0])}${Xy(t[1])}${Xy(t[2])}`},SGR:e=>{let t=e.action===0&&e.button!==4?`m`:`M`;return`\x1B[<${Yy(e,!0)};${e.col};${e.row}${t}`},SGR_PIXELS:e=>{let t=e.action===0&&e.button!==4?`m`:`M`;return`\x1B[<${Yy(e,!0)};${e.x};${e.y}${t}`}},Qy=class extends wm{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 Y),this.onProtocolChange=this._onProtocolChange.event;for(let e of Object.keys(Jy))this.addProtocol(e,Jy[e]);for(let e of Object.keys(Zy))this.addEncoding(e,Zy[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)}};Qy=tp([J(0,Op),J(1,Ap),J(2,Pp)],Qy);var $y=[[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]],eb=[[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]],tb;function nb(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 rb=class{constructor(){if(this.version=`6`,!tb){tb=new Uint8Array(65536),tb.fill(1),tb[0]=0,tb.fill(0,1,32),tb.fill(0,127,160),tb.fill(2,4352,4448),tb[9001]=2,tb[9002]=2,tb.fill(2,11904,42192),tb[12351]=1,tb.fill(2,44032,55204),tb.fill(2,63744,64256),tb.fill(2,65040,65050),tb.fill(2,65072,65136),tb.fill(2,65280,65377),tb.fill(2,65504,65511);for(let e=0;e<$y.length;++e)tb.fill(0,$y[e][0],$y[e][1]+1)}}wcwidth(e){return e<32?0:e<127?1:e<65536?tb[e]:nb(e,eb)?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=ib.extractWidth(t);e===0?r=!1:e>n&&(n=e)}return ib.createPropertyValue(0,n,r)}},ib=class e{constructor(){this._providers=Object.create(null),this._active=``,this._onChange=new Y,this.onChange=this._onChange.event;let e=new rb;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)}},ab=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 ob(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 sb=2147483647,cb=256,lb=class e{constructor(e=32,t=32){if(this.maxLength=e,this.maxSubParamsLength=t,t>cb)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>sb?sb: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>sb?sb: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,sb):e}},ub=[],db=class{constructor(){this._state=0,this._active=ub,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=ub}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=ub,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||ub,!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`,mp(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=ub,this._id=-1,this._state=0}}},fb=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+=mp(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}},pb=[],mb=class{constructor(){this._handlers=Object.create(null),this._active=pb,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=pb}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=pb,this._ident=0}hook(e,t){if(this.reset(),this._ident=e,this._active=this._handlers[e]||pb,!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`,mp(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=pb,this._ident=0}},hb=new lb;hb.addParam(0);var gb=class{constructor(e){this._handler=e,this._data=``,this._params=hb,this._hitLimit=!1}hook(e){this._params=e.length>1||e.params[0]?e.clone():hb,this._data=``,this._hitLimit=!1}put(e,t,n){this._hitLimit||(this._data+=mp(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=hb,this._data=``,this._hitLimit=!1,e));return this._params=hb,this._data=``,this._hitLimit=!1,t}},_b=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}},vb=160,yb=function(){let e=new _b(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(vb,0,2,0),e.add(vb,8,5,8),e.add(vb,6,0,6),e.add(vb,11,0,11),e.add(vb,13,13,13),e}(),bb=class extends wm{constructor(e=yb){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 lb,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(xm(()=>{this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null)})),this._oscParser=this._register(new db),this._dcsParser=this._register(new mb),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:vb)],i>>4){case 2:for(let i=n+1;;++i){if(i>=t||(r=e[i])<32||r>126&&r<vb){this._printHandler(e,n,i),n=i-1;break}if(++i>=t||(r=e[i])<32||r>126&&r<vb){this._printHandler(e,n,i),n=i-1;break}if(++i>=t||(r=e[i])<32||r>126&&r<vb){this._printHandler(e,n,i),n=i-1;break}if(++i>=t||(r=e[i])<32||r>126&&r<vb){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<vb){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<vb){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}}},xb=/^([\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})$/,Sb=/^[\da-f]+$/;function Cb(e){if(!e)return;let t=e.toLowerCase();if(t.indexOf(`rgb:`)===0){t=t.slice(4);let e=xb.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),Sb.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 wb(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 Tb(e,t=16){let[n,r,i]=e;return`rgb:${wb(n,t)}/${wb(r,t)}/${wb(i,t)}`}var Eb={"(":0,")":1,"*":2,"+":3,"-":1,".":2},Db=131072,Ob=10;function kb(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 Ab=5e3,jb=0,Mb=class extends wm{constructor(e,t,n,r,i,a,o,s,c=new bb){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 hp,this._utf8Decoder=new gp,this._windowTitle=``,this._iconName=``,this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=xy.clone(),this._eraseAttrDataInternal=xy.clone(),this._onRequestBell=this._register(new Y),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this._register(new Y),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this._register(new Y),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this._register(new Y),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this._register(new Y),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this._register(new Y),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this._register(new Y),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this._register(new Y),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this._register(new Y),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this._register(new Y),this.onLineFeed=this._onLineFeed.event,this._onScroll=this._register(new Y),this.onScroll=this._onScroll.event,this._onTitleChange=this._register(new Y),this.onTitleChange=this._onTitleChange.event,this._onColor=this._register(new Y),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 Nb(this._bufferService),this._activeBuffer=this._bufferService.buffer,this._register(this._bufferService.buffers.onBufferActivate(e=>this._activeBuffer=e.activeBuffer)),this._parser.setCsiHandlerFallback((e,t)=>{this._logService.debug(`Unknown CSI code: `,{identifier:this._parser.identToString(e),params:t.toArray()})}),this._parser.setEscHandlerFallback(e=>{this._logService.debug(`Unknown ESC code: `,{identifier:this._parser.identToString(e)})}),this._parser.setExecuteHandlerFallback(e=>{this._logService.debug(`Unknown EXECUTE code: `,{code:e})}),this._parser.setOscHandlerFallback((e,t,n)=>{this._logService.debug(`Unknown OSC code: `,{identifier:e,action:t,data:n})}),this._parser.setDcsHandlerFallback((e,t,n)=>{t===`HOOK`&&(n=n.toArray()),this._logService.debug(`Unknown DCS code: `,{identifier:this._parser.identToString(e),action:t,payload:n})}),this._parser.setPrintHandler((e,t,n)=>this.print(e,t,n)),this._parser.registerCsiHandler({final:`@`},e=>this.insertChars(e)),this._parser.registerCsiHandler({intermediates:` `,final:`@`},e=>this.scrollLeft(e)),this._parser.registerCsiHandler({final:`A`},e=>this.cursorUp(e)),this._parser.registerCsiHandler({intermediates:` `,final:`A`},e=>this.scrollRight(e)),this._parser.registerCsiHandler({final:`B`},e=>this.cursorDown(e)),this._parser.registerCsiHandler({final:`C`},e=>this.cursorForward(e)),this._parser.registerCsiHandler({final:`D`},e=>this.cursorBackward(e)),this._parser.registerCsiHandler({final:`E`},e=>this.cursorNextLine(e)),this._parser.registerCsiHandler({final:`F`},e=>this.cursorPrecedingLine(e)),this._parser.registerCsiHandler({final:`G`},e=>this.cursorCharAbsolute(e)),this._parser.registerCsiHandler({final:`H`},e=>this.cursorPosition(e)),this._parser.registerCsiHandler({final:`I`},e=>this.cursorForwardTab(e)),this._parser.registerCsiHandler({final:`J`},e=>this.eraseInDisplay(e,!1)),this._parser.registerCsiHandler({prefix:`?`,final:`J`},e=>this.eraseInDisplay(e,!0)),this._parser.registerCsiHandler({final:`K`},e=>this.eraseInLine(e,!1)),this._parser.registerCsiHandler({prefix:`?`,final:`K`},e=>this.eraseInLine(e,!0)),this._parser.registerCsiHandler({final:`L`},e=>this.insertLines(e)),this._parser.registerCsiHandler({final:`M`},e=>this.deleteLines(e)),this._parser.registerCsiHandler({final:`P`},e=>this.deleteChars(e)),this._parser.registerCsiHandler({final:`S`},e=>this.scrollUp(e)),this._parser.registerCsiHandler({final:`T`},e=>this.scrollDown(e)),this._parser.registerCsiHandler({final:`X`},e=>this.eraseChars(e)),this._parser.registerCsiHandler({final:`Z`},e=>this.cursorBackwardTab(e)),this._parser.registerCsiHandler({final:"`"},e=>this.charPosAbsolute(e)),this._parser.registerCsiHandler({final:`a`},e=>this.hPositionRelative(e)),this._parser.registerCsiHandler({final:`b`},e=>this.repeatPrecedingCharacter(e)),this._parser.registerCsiHandler({final:`c`},e=>this.sendDeviceAttributesPrimary(e)),this._parser.registerCsiHandler({prefix:`>`,final:`c`},e=>this.sendDeviceAttributesSecondary(e)),this._parser.registerCsiHandler({final:`d`},e=>this.linePosAbsolute(e)),this._parser.registerCsiHandler({final:`e`},e=>this.vPositionRelative(e)),this._parser.registerCsiHandler({final:`f`},e=>this.hVPosition(e)),this._parser.registerCsiHandler({final:`g`},e=>this.tabClear(e)),this._parser.registerCsiHandler({final:`h`},e=>this.setMode(e)),this._parser.registerCsiHandler({prefix:`?`,final:`h`},e=>this.setModePrivate(e)),this._parser.registerCsiHandler({final:`l`},e=>this.resetMode(e)),this._parser.registerCsiHandler({prefix:`?`,final:`l`},e=>this.resetModePrivate(e)),this._parser.registerCsiHandler({final:`m`},e=>this.charAttributes(e)),this._parser.registerCsiHandler({final:`n`},e=>this.deviceStatus(e)),this._parser.registerCsiHandler({prefix:`?`,final:`n`},e=>this.deviceStatusPrivate(e)),this._parser.registerCsiHandler({intermediates:`!`,final:`p`},e=>this.softReset(e)),this._parser.registerCsiHandler({intermediates:` `,final:`q`},e=>this.setCursorStyle(e)),this._parser.registerCsiHandler({final:`r`},e=>this.setScrollRegion(e)),this._parser.registerCsiHandler({final:`s`},e=>this.saveCursor(e)),this._parser.registerCsiHandler({final:`t`},e=>this.windowOptions(e)),this._parser.registerCsiHandler({final:`u`},e=>this.restoreCursor(e)),this._parser.registerCsiHandler({intermediates:`'`,final:`}`},e=>this.insertColumns(e)),this._parser.registerCsiHandler({intermediates:`'`,final:`~`},e=>this.deleteColumns(e)),this._parser.registerCsiHandler({intermediates:`"`,final:`q`},e=>this.selectProtected(e)),this._parser.registerCsiHandler({intermediates:`$`,final:`p`},e=>this.requestMode(e,!0)),this._parser.registerCsiHandler({prefix:`?`,intermediates:`$`,final:`p`},e=>this.requestMode(e,!1)),this._parser.setExecuteHandler(Z.BEL,()=>this.bell()),this._parser.setExecuteHandler(Z.LF,()=>this.lineFeed()),this._parser.setExecuteHandler(Z.VT,()=>this.lineFeed()),this._parser.setExecuteHandler(Z.FF,()=>this.lineFeed()),this._parser.setExecuteHandler(Z.CR,()=>this.carriageReturn()),this._parser.setExecuteHandler(Z.BS,()=>this.backspace()),this._parser.setExecuteHandler(Z.HT,()=>this.tab()),this._parser.setExecuteHandler(Z.SO,()=>this.shiftOut()),this._parser.setExecuteHandler(Z.SI,()=>this.shiftIn()),this._parser.setExecuteHandler(S_.IND,()=>this.index()),this._parser.setExecuteHandler(S_.NEL,()=>this.nextLine()),this._parser.setExecuteHandler(S_.HTS,()=>this.tabSet()),this._parser.registerOscHandler(0,new fb(e=>(this.setTitle(e),this.setIconName(e),!0))),this._parser.registerOscHandler(1,new fb(e=>this.setIconName(e))),this._parser.registerOscHandler(2,new fb(e=>this.setTitle(e))),this._parser.registerOscHandler(4,new fb(e=>this.setOrReportIndexedColor(e))),this._parser.registerOscHandler(8,new fb(e=>this.setHyperlink(e))),this._parser.registerOscHandler(10,new fb(e=>this.setOrReportFgColor(e))),this._parser.registerOscHandler(11,new fb(e=>this.setOrReportBgColor(e))),this._parser.registerOscHandler(12,new fb(e=>this.setOrReportCursorColor(e))),this._parser.registerOscHandler(104,new fb(e=>this.restoreIndexedColor(e))),this._parser.registerOscHandler(110,new fb(e=>this.restoreFgColor(e))),this._parser.registerOscHandler(111,new fb(e=>this.restoreBgColor(e))),this._parser.registerOscHandler(112,new fb(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 My)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 gb((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`),Ab))]).catch(e=>{if(e!==`#SLOW_TIMEOUT`)throw e;console.warn(`async parser handler taking longer than ${Ab} 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>Db&&(a=this._parseStack.position+Db)}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<Db&&(this._parseBuffer=new Uint32Array(Math.min(e.length,Db))),o||this._dirtyRowTracker.clearRange(),e.length>Db)for(let t=a;t<e.length;t+=Db){let a=t+Db<e.length?t+Db: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=ib.extractWidth(t);let n=ib.extractShouldJoin(t),m=n?ib.extractWidth(f):0;if(f=t,o&&this._onA11yChar.fire(pp(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 wy&&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=>!kb(e.params[0],this._optionsService.rawOptions.windowOptions)||t(e)):this._parser.registerCsiHandler(e,t)}registerDcsHandler(e,t){return this._parser.registerDcsHandler(e,new gb(t))}registerEscHandler(e,t){return this._parser.registerEscHandler(e,t)}registerOscHandler(e,t){return this._parser.registerOscHandler(e,new fb(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(xy));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=ib.extractWidth(t),i=this._activeBuffer.x-r,a=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).getString(i),o=new Uint32Array(a.length*n),s=0;for(let e=0;e<a.length;){let t=a.codePointAt(e)||0;o[s++]=t,e+=t>65535?2:1}let c=s;for(let e=1;e<n;++e)o.copyWithin(c,0,s),c+=s;return this.print(o,0,c),!0}sendDeviceAttributesPrimary(e){return e.params[0]>0||(this._is(`xterm`)||this._is(`rxvt-unicode`)||this._is(`screen`)?this._coreService.triggerDataEvent(Z.ESC+`[?1;2c`):this._is(`linux`)&&this._coreService.triggerDataEvent(Z.ESC+`[?6c`)),!0}sendDeviceAttributesSecondary(e){return e.params[0]>0||(this._is(`xterm`)?this._coreService.triggerDataEvent(Z.ESC+`[>0;276;0c`):this._is(`rxvt-unicode`)?this._coreService.triggerDataEvent(Z.ESC+`[>85;95;0c`):this._is(`linux`)?this._coreService.triggerDataEvent(e.params[0]+`c`):this._is(`screen`)&&this._coreService.triggerDataEvent(Z.ESC+`[>83;40003;0c`)),!0}_is(e){return(this._optionsService.rawOptions.termName+``).indexOf(e)===0}setMode(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 4:this._coreService.modes.insertMode=!0;break;case 20:this._optionsService.options.convertEol=!0;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,Ny),this._charsetService.setgCharset(1,Ny),this._charsetService.setgCharset(2,Ny),this._charsetService.setgCharset(3,Ny);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(`${Z.ESC}[${t?``:`?`}${e};${n}$y`),!0),p=e=>e?1:2,m=e.params[0];return t?m===2?f(m,4):m===4?f(m,p(o.modes.insertMode)):m===12?f(m,3):m===20?f(m,p(d.convertEol)):f(m,0):m===1?f(m,p(r.applicationCursorKeys)):m===3?f(m,d.windowOptions.setWinLines?c===80?2:+(c===132):0):m===6?f(m,p(r.origin)):m===7?f(m,p(r.wraparound)):m===8?f(m,3):m===9?f(m,p(i===`X10`)):m===12?f(m,p(d.cursorBlink)):m===25?f(m,p(!o.isCursorHidden)):m===45?f(m,p(r.reverseWraparound)):m===66?f(m,p(r.applicationKeypad)):m===67?f(m,4):m===1e3?f(m,p(i===`VT200`)):m===1002?f(m,p(i===`DRAG`)):m===1003?f(m,p(i===`ANY`)):m===1004?f(m,p(r.sendFocus)):m===1005?f(m,4):m===1006?f(m,p(a===`SGR`)):m===1015?f(m,4):m===1016?f(m,p(a===`SGR_PIXELS`)):m===1048?f(m,1):m===47||m===1047||m===1049?f(m,p(l===u)):m===2004?f(m,p(r.bracketedPasteMode)):m===2026?f(m,p(r.synchronizedOutput)):f(m,0)}_updateAttrColor(e,t,n,r,i){return t===2?(e|=50331648,e&=-16777216,e|=yp.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=xy.fg,e.bg=xy.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|=xy.fg&16777215):n===49?(r.bg&=-67108864,r.bg|=xy.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|=xy.fg&16777215,r.bg&=-67108864,r.bg|=xy.bg&16777215):this._logService.debug(`Unknown SGR attribute: %d.`,n);return!0}deviceStatus(e){switch(e.params[0]){case 5:this._coreService.triggerDataEvent(`${Z.ESC}[0n`);break;case 6:let e=this._activeBuffer.y+1,t=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${Z.ESC}[${e};${t}R`);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(`${Z.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=xy.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(!kb(e.params[0],this._optionsService.rawOptions.windowOptions))return!0;let t=e.length>1?e.params[1]:0;switch(e.params[0]){case 14:t!==2&&this._onRequestWindowsOptionsReport.fire(0);break;case 16:this._onRequestWindowsOptionsReport.fire(1);break;case 18:this._bufferService&&this._coreService.triggerDataEvent(`${Z.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);break;case 22:(t===0||t===2)&&(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>Ob&&this._windowTitleStack.shift()),(t===0||t===1)&&(this._iconNameStack.push(this._iconName),this._iconNameStack.length>Ob&&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(Pb(n))if(r===`?`)t.push({type:0,index:n});else{let e=Cb(r);e&&t.push({type:1,index:n,color:e})}}}return t.length&&this._onColor.fire(t),!0}setHyperlink(e){let t=e.indexOf(`;`);if(t===-1)return!0;let n=e.slice(0,t).trim(),r=e.slice(t+1);return r?this._createHyperlink(n,r):!n.trim()&&this._finishHyperlink()}_createHyperlink(e,t){this._getCurrentLinkId()&&this._finishHyperlink();let n=e.split(`:`),r,i=n.findIndex(e=>e.startsWith(`id=`));return i!==-1&&(r=n[i].slice(3)||void 0),this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=this._oscLinkService.registerLink({id:r,uri:t}),this._curAttrData.updateExtended(),!0}_finishHyperlink(){return this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=0,this._curAttrData.updateExtended(),!0}_setOrReportSpecialColor(e,t){let n=e.split(`;`);for(let e=0;e<n.length&&!(t>=this._specialColors.length);++e,++t)if(n[e]===`?`)this._onColor.fire([{type:0,index:this._specialColors[t]}]);else{let r=Cb(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]);Pb(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,Ny),!0}selectCharset(e){return e.length===2?(e[0]===`/`||this._charsetService.setgCharset(Eb[e[0]],My[e[1]]||Ny),!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=xy.clone(),this._eraseAttrDataInternal=xy.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 xp;e.content=4194373,e.fg=this._curAttrData.fg,e.bg=this._curAttrData.bg,this._setCursor(0,0);for(let t=0;t<this._bufferService.rows;++t){let n=this._activeBuffer.ybase+this._activeBuffer.y+t,r=this._activeBuffer.lines.get(n);r&&(r.fill(e),r.isWrapped=!1)}return this._dirtyRowTracker.markAllDirty(),this._setCursor(0,0),!0}requestStatusString(e,t){let n=e=>(this._coreService.triggerDataEvent(`${Z.ESC}${e}${Z.ESC}\\`),!0),r=this._bufferService.buffer,i=this._optionsService.rawOptions;return n(e===`"q`?`P1$r${+!!this._curAttrData.isProtected()}"q`:e===`"p`?`P1$r61;1"p`:e===`r`?`P1$r${r.scrollTop+1};${r.scrollBottom+1}r`:e===`m`?`P1$r0m`:e===` q`?`P1$r${{block:2,underline:4,bar:6}[i.cursorStyle]-+!!i.cursorBlink} q`:`P0$r`)}markRangeDirty(e,t){this._dirtyRowTracker.markRangeDirty(e,t)}},Nb=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&&(jb=e,e=t,t=jb),e<this.start&&(this.start=e),t>this.end&&(this.end=t)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};Nb=tp([J(0,Op)],Nb);function Pb(e){return 0<=e&&e<256}var Fb=5e7,Ib=12,Lb=50,Rb=class extends wm{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 Y),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>Fb)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>=Ib?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>=Ib)break}this._writeBuffer.length>this._bufferOffset?(this._bufferOffset>Lb&&(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()}},zb=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)))}};zb=tp([J(0,Op)],zb);var Bb=!1,Vb=class extends wm{constructor(e){super(),this._windowsWrappingHeuristics=this._register(new Tm),this._onBinary=this._register(new Y),this.onBinary=this._onBinary.event,this._onData=this._register(new Y),this.onData=this._onData.event,this._onLineFeed=this._register(new Y),this.onLineFeed=this._onLineFeed.event,this._onResize=this._register(new Y),this.onResize=this._onResize.event,this._onWriteParsed=this._register(new Y),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this._register(new Y),this._instantiationService=new my,this.optionsService=this._register(new Hy(e)),this._instantiationService.setService(Pp,this.optionsService),this._bufferService=this._register(this._instantiationService.createInstance(zy)),this._instantiationService.setService(Op,this._bufferService),this._logService=this._register(this._instantiationService.createInstance(_y)),this._instantiationService.setService(Np,this._logService),this.coreService=this._register(this._instantiationService.createInstance(qy)),this._instantiationService.setService(Ap,this.coreService),this.coreMouseService=this._register(this._instantiationService.createInstance(Qy)),this._instantiationService.setService(kp,this.coreMouseService),this.unicodeService=this._register(this._instantiationService.createInstance(ib)),this._instantiationService.setService(Ip,this.unicodeService),this._charsetService=this._instantiationService.createInstance(ab),this._instantiationService.setService(jp,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(zb),this._instantiationService.setService(Fp,this._oscLinkService),this._inputHandler=this._register(new Mb(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService)),this._register(Mm.forward(this._inputHandler.onLineFeed,this._onLineFeed)),this._register(this._inputHandler),this._register(Mm.forward(this._bufferService.onResize,this._onResize)),this._register(Mm.forward(this.coreService.onData,this._onData)),this._register(Mm.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 Rb((e,t)=>this._inputHandler.parse(e,t))),this._register(Mm.forward(this._writeBuffer.onWriteParsed,this._onWriteParsed))}get onScroll(){return this._onScrollApi||(this._onScrollApi=this._register(new Y),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&&!Bb&&(this._logService.warn(`writeSync is unreliable and will be removed soon.`),Bb=!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,Ly),t=Math.max(t,Ry),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(ob.bind(null,this._bufferService))),e.push(this.registerCsiHandler({final:`H`},()=>(ob(this._bufferService),!1))),this._windowsWrappingHeuristics.value=xm(()=>{for(let t of e)t.dispose()})}}},Hb={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 Ub(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=Z.ESC+`OA`:i.key=Z.ESC+`[A`:e.key===`UIKeyInputLeftArrow`?t?i.key=Z.ESC+`OD`:i.key=Z.ESC+`[D`:e.key===`UIKeyInputRightArrow`?t?i.key=Z.ESC+`OC`:i.key=Z.ESC+`[C`:e.key===`UIKeyInputDownArrow`&&(t?i.key=Z.ESC+`OB`:i.key=Z.ESC+`[B`);break;case 8:i.key=e.ctrlKey?`\b`:Z.DEL,e.altKey&&(i.key=Z.ESC+i.key);break;case 9:if(e.shiftKey){i.key=Z.ESC+`[Z`;break}i.key=Z.HT,i.cancel=!0;break;case 13:i.key=e.altKey?Z.ESC+Z.CR:Z.CR,i.cancel=!0;break;case 27:i.key=Z.ESC,e.altKey&&(i.key=Z.ESC+Z.ESC),i.cancel=!0;break;case 37:if(e.metaKey)break;a?i.key=Z.ESC+`[1;`+(a+1)+`D`:t?i.key=Z.ESC+`OD`:i.key=Z.ESC+`[D`;break;case 39:if(e.metaKey)break;a?i.key=Z.ESC+`[1;`+(a+1)+`C`:t?i.key=Z.ESC+`OC`:i.key=Z.ESC+`[C`;break;case 38:if(e.metaKey)break;a?i.key=Z.ESC+`[1;`+(a+1)+`A`:t?i.key=Z.ESC+`OA`:i.key=Z.ESC+`[A`;break;case 40:if(e.metaKey)break;a?i.key=Z.ESC+`[1;`+(a+1)+`B`:t?i.key=Z.ESC+`OB`:i.key=Z.ESC+`[B`;break;case 45:!e.shiftKey&&!e.ctrlKey&&(i.key=Z.ESC+`[2~`);break;case 46:a?i.key=Z.ESC+`[3;`+(a+1)+`~`:i.key=Z.ESC+`[3~`;break;case 36:a?i.key=Z.ESC+`[1;`+(a+1)+`H`:t?i.key=Z.ESC+`OH`:i.key=Z.ESC+`[H`;break;case 35:a?i.key=Z.ESC+`[1;`+(a+1)+`F`:t?i.key=Z.ESC+`OF`:i.key=Z.ESC+`[F`;break;case 33:e.shiftKey?i.type=2:e.ctrlKey?i.key=Z.ESC+`[5;`+(a+1)+`~`:i.key=Z.ESC+`[5~`;break;case 34:e.shiftKey?i.type=3:e.ctrlKey?i.key=Z.ESC+`[6;`+(a+1)+`~`:i.key=Z.ESC+`[6~`;break;case 112:a?i.key=Z.ESC+`[1;`+(a+1)+`P`:i.key=Z.ESC+`OP`;break;case 113:a?i.key=Z.ESC+`[1;`+(a+1)+`Q`:i.key=Z.ESC+`OQ`;break;case 114:a?i.key=Z.ESC+`[1;`+(a+1)+`R`:i.key=Z.ESC+`OR`;break;case 115:a?i.key=Z.ESC+`[1;`+(a+1)+`S`:i.key=Z.ESC+`OS`;break;case 116:a?i.key=Z.ESC+`[15;`+(a+1)+`~`:i.key=Z.ESC+`[15~`;break;case 117:a?i.key=Z.ESC+`[17;`+(a+1)+`~`:i.key=Z.ESC+`[17~`;break;case 118:a?i.key=Z.ESC+`[18;`+(a+1)+`~`:i.key=Z.ESC+`[18~`;break;case 119:a?i.key=Z.ESC+`[19;`+(a+1)+`~`:i.key=Z.ESC+`[19~`;break;case 120:a?i.key=Z.ESC+`[20;`+(a+1)+`~`:i.key=Z.ESC+`[20~`;break;case 121:a?i.key=Z.ESC+`[21;`+(a+1)+`~`:i.key=Z.ESC+`[21~`;break;case 122:a?i.key=Z.ESC+`[23;`+(a+1)+`~`:i.key=Z.ESC+`[23~`;break;case 123:a?i.key=Z.ESC+`[24;`+(a+1)+`~`:i.key=Z.ESC+`[24~`;break;default:if(e.ctrlKey&&!e.shiftKey&&!e.altKey&&!e.metaKey)e.keyCode>=65&&e.keyCode<=90?i.key=String.fromCharCode(e.keyCode-64):e.keyCode===32?i.key=Z.NUL:e.keyCode>=51&&e.keyCode<=55?i.key=String.fromCharCode(e.keyCode-51+27):e.keyCode===56?i.key=Z.DEL:e.keyCode===219?i.key=Z.ESC:e.keyCode===220?i.key=Z.FS:e.keyCode===221&&(i.key=Z.GS);else if((!n||r)&&e.altKey&&!e.metaKey){let t=Hb[e.keyCode]?.[+!!e.shiftKey];if(t)i.key=Z.ESC+t;else if(e.keyCode>=65&&e.keyCode<=90){let t=e.ctrlKey?e.keyCode-64:e.keyCode+32,n=String.fromCharCode(t);e.shiftKey&&(n=n.toUpperCase()),i.key=Z.ESC+n}else if(e.keyCode===32)i.key=Z.ESC+(e.ctrlKey?Z.NUL:` `);else if(e.key===`Dead`&&e.code.startsWith(`Key`)){let t=e.code.slice(3,4);e.shiftKey||(t=t.toLowerCase()),i.key=Z.ESC+t,i.cancel=!0}}else n&&!e.altKey&&!e.ctrlKey&&!e.shiftKey&&e.metaKey?e.keyCode===65&&(i.type=1):e.key&&!e.ctrlKey&&!e.altKey&&!e.metaKey&&e.keyCode>=48&&e.key.length===1?i.key=e.key:e.key&&e.ctrlKey&&(e.key===`_`&&(i.key=Z.US),e.key===`@`&&(i.key=Z.NUL));break}return i}var Wb=0,Gb=class{constructor(e){this._getKey=e,this._array=[],this._insertedValues=[],this._flushInsertedTask=new jv,this._isFlushingInserted=!1,this._deletedIndices=[],this._flushDeletedTask=new jv,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||(Wb=this._search(t),Wb===-1)||this._getKey(this._array[Wb])!==t)return!1;do if(this._array[Wb]===e)return this._deletedIndices.length===0&&this._flushDeletedTask.enqueue(()=>this._flushDeleted()),this._deletedIndices.push(Wb),!0;while(++Wb<this._array.length&&this._getKey(this._array[Wb])===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&&(Wb=this._search(e),!(Wb<0||Wb>=this._array.length)&&this._getKey(this._array[Wb])===e))do yield this._array[Wb];while(++Wb<this._array.length&&this._getKey(this._array[Wb])===e)}forEachByKey(e,t){if(this._flushCleanupInserted(),this._flushCleanupDeleted(),this._array.length!==0&&(Wb=this._search(e),!(Wb<0||Wb>=this._array.length)&&this._getKey(this._array[Wb])===e))do t(this._array[Wb]);while(++Wb<this._array.length&&this._getKey(this._array[Wb])===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}},Kb=0,qb=0,Jb=class extends wm{constructor(){super(),this._decorations=new Gb(e=>e?.marker.line),this._onDecorationRegistered=this._register(new Y),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this._register(new Y),this.onDecorationRemoved=this._onDecorationRemoved.event,this._register(xm(()=>this.reset()))}get decorations(){return this._decorations.values()}registerDecoration(e){if(e.marker.isDisposed)return;let t=new Yb(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=>{Kb=t.options.x??0,qb=Kb+(t.options.width??1),e>=Kb&&e<qb&&(!n||(t.options.layer??`bottom`)===n)&&r(t)})}},Yb=class extends Cm{constructor(e){super(),this.options=e,this.onRenderEmitter=this.add(new Y),this.onRender=this.onRenderEmitter.event,this._onDispose=this.add(new Y),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=M_.toColor(this.options.backgroundColor):this._cachedBg=void 0),this._cachedBg}get foregroundColorRGB(){return this._cachedFg===null&&(this.options.foregroundColor?this._cachedFg=M_.toColor(this.options.foregroundColor):this._cachedFg=void 0),this._cachedFg}dispose(){this._onDispose.fire(),super.dispose()}},Xb=1e3,Zb=class{constructor(e,t=Xb){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)}},Qb=20,$b=class extends wm{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 Zb(this._renderRows.bind(this))),!this._terminal.element)throw Error(`Cannot enable accessibility before Terminal.open`);this._terminal.element.insertAdjacentElement(`afterbegin`,this._accessibilityContainer),this._register(this._terminal.onResize(e=>this._handleResize(e.rows))),this._register(this._terminal.onRender(e=>this._refreshRows(e.start,e.end))),this._register(this._terminal.onScroll(()=>this._refreshRows())),this._register(this._terminal.onA11yChar(e=>this._handleChar(e))),this._register(this._terminal.onLineFeed(()=>this._handleChar(`
41
+ `))),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(X(i,`selectionchange`,()=>this._handleSelectionChange())),this._register(this._coreBrowserService.onDprChange(()=>this._refreshRowsDimensions())),this._refreshRowsDimensions(),this._refreshRows(),this._register(xm(()=>{this._accessibilityContainer.remove(),this._rowElements.length=0}))}_handleTab(e){for(let t=0;t<e;t++)this._handleChar(` `)}_handleChar(e){this._liveRegionLineCount<Qb+1&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==e&&(this._charsToAnnounce+=e):this._charsToAnnounce+=e,e===`
42
+ `&&(this._liveRegionLineCount++,this._liveRegionLineCount===Qb+1&&(this._liveRegion.textContent+=ap.get())))}_clearLiveRegion(){this._liveRegion.textContent=``,this._liveRegionLineCount=0}_handleKey(e){this._clearLiveRegion(),/\p{Control}/u.test(e)||this._charsToConsume.push(e)}_refreshRows(e,t){this._liveRegionDebouncer.refresh(e,t,this._terminal.rows)}_renderRows(e,t){let n=this._terminal.buffer,r=n.lines.length.toString();for(let i=e;i<=t;i++){let e=n.lines.get(n.ydisp+i),t=[],a=e?.translateToString(!0,void 0,void 0,t)||``,o=(n.ydisp+i+1).toString(),s=this._rowElements[i];s&&(a.length===0?(s.textContent=`\xA0`,this._rowColumns.set(s,[0,1])):(s.textContent=a,this._rowColumns.set(s,t)),s.setAttribute(`aria-posinset`,o),s.setAttribute(`aria-setsize`,r),this._alignRowWidth(s))}this._announceCharacters()}_announceCharacters(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce=``)}_handleBoundaryFocus(e,t){let n=e.target,r=this._rowElements[t===0?1:this._rowElements.length-2];if(n.getAttribute(`aria-posinset`)===(t===0?`1`:`${this._terminal.buffer.lines.length}`)||e.relatedTarget!==r)return;let i,a;if(t===0?(i=n,a=this._rowElements.pop(),this._rowContainer.removeChild(a)):(i=this._rowElements.shift(),a=n,this._rowContainer.removeChild(i)),i.removeEventListener(`focus`,this._topBoundaryFocusListener),a.removeEventListener(`focus`,this._bottomBoundaryFocusListener),t===0){let e=this._createAccessibilityTreeNode();this._rowElements.unshift(e),this._rowContainer.insertAdjacentElement(`afterbegin`,e)}else{let e=this._createAccessibilityTreeNode();this._rowElements.push(e),this._rowContainer.appendChild(e)}this._rowElements[0].addEventListener(`focus`,this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener(`focus`,this._bottomBoundaryFocusListener),this._terminal.scrollLines(t===0?-1:1),this._rowElements[t===0?1:this._rowElements.length-2].focus(),e.preventDefault(),e.stopImmediatePropagation()}_handleSelectionChange(){if(this._rowElements.length===0)return;let e=this._coreBrowserService.mainDocument.getSelection();if(!e)return;if(e.isCollapsed){this._rowContainer.contains(e.anchorNode)&&this._terminal.clearSelection();return}if(!e.anchorNode||!e.focusNode){console.error(`anchorNode and/or focusNode are null`);return}let t={node:e.anchorNode,offset:e.anchorOffset},n={node:e.focusNode,offset:e.focusOffset};if((t.node.compareDocumentPosition(n.node)&Node.DOCUMENT_POSITION_PRECEDING||t.node===n.node&&t.offset>n.offset)&&([t,n]=[n,t]),t.node.compareDocumentPosition(this._rowElements[0])&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_FOLLOWING)&&(t={node:this._rowElements[0].childNodes[0],offset:0}),!this._rowContainer.contains(t.node))return;let r=this._rowElements.slice(-1)[0];if(n.node.compareDocumentPosition(r)&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_PRECEDING)&&(n={node:r,offset:r.textContent?.length??0}),!this._rowContainer.contains(n.node))return;let i=({node:e,offset:t})=>{let n=e instanceof Text?e.parentNode:e,r=parseInt(n?.getAttribute(`aria-posinset`),10)-1;if(isNaN(r))return console.warn(`row is invalid. Race condition?`),null;let i=this._rowColumns.get(n);if(!i)return console.warn(`columns is null. Race condition?`),null;let a=t<i.length?i[t]:i.slice(-1)[0]+1;return a>=this._terminal.cols&&(++r,a=0),{row:r,column:a}},a=i(t),o=i(n);if(!(!a||!o)){if(a.row>o.row||a.row===o.row&&a.column>=o.column)throw Error(`invalid range`);this._terminal.select(a.column,a.row,(o.row-a.row)*this._terminal.cols-a.column+o.column)}}_handleResize(e){this._rowElements[this._rowElements.length-1].removeEventListener(`focus`,this._bottomBoundaryFocusListener);for(let e=this._rowContainer.children.length;e<this._terminal.rows;e++)this._rowElements[e]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[e]);for(;this._rowElements.length>e;)this._rowContainer.removeChild(this._rowElements.pop());this._rowElements[this._rowElements.length-1].addEventListener(`focus`,this._bottomBoundaryFocusListener),this._refreshRowsDimensions()}_createAccessibilityTreeNode(){let e=this._coreBrowserService.mainDocument.createElement(`div`);return e.setAttribute(`role`,`listitem`),e.tabIndex=-1,this._refreshRowDimensions(e),e}_refreshRowsDimensions(){if(this._renderService.dimensions.css.cell.height){Object.assign(this._accessibilityContainer.style,{width:`${this._renderService.dimensions.css.canvas.width}px`,fontSize:`${this._terminal.options.fontSize}px`}),this._rowElements.length!==this._terminal.rows&&this._handleResize(this._terminal.rows);for(let e=0;e<this._terminal.rows;e++)this._refreshRowDimensions(this._rowElements[e]),this._alignRowWidth(this._rowElements[e])}}_refreshRowDimensions(e){e.style.height=`${this._renderService.dimensions.css.cell.height}px`}_alignRowWidth(e){e.style.transform=``;let t=e.getBoundingClientRect().width,n=this._rowColumns.get(e)?.slice(-1)?.[0];if(!n)return;let r=n*this._renderService.dimensions.css.cell.width;e.style.transform=`scaleX(${r/t})`}};$b=tp([J(1,Mp),J(2,Vp),J(3,Up)],$b);var ex=class extends wm{constructor(e,t,n,r,i){super(),this._element=e,this._mouseService=t,this._renderService=n,this._bufferService=r,this._linkProviderService=i,this._linkCacheDisposables=[],this._isMouseOut=!0,this._wasResized=!1,this._activeLine=-1,this._onShowLinkUnderline=this._register(new Y),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this._register(new Y),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this._register(xm(()=>{ym(this._linkCacheDisposables),this._linkCacheDisposables.length=0,this._lastMouseEvent=void 0,this._activeProviderReplies?.clear()})),this._register(this._bufferService.onResize(()=>{this._clearCurrentLink(),this._wasResized=!0})),this._register(X(this._element,`mouseleave`,()=>{this._isMouseOut=!0,this._clearCurrentLink()})),this._register(X(this._element,`mousemove`,this._handleMouseMove.bind(this))),this._register(X(this._element,`mousedown`,this._handleMouseDown.bind(this))),this._register(X(this._element,`mouseup`,this._handleMouseUp.bind(this)))}get currentLink(){return this._currentLink}_handleMouseMove(e){this._lastMouseEvent=e;let t=this._positionFromMouseEvent(e,this._element,this._mouseService);if(!t)return;this._isMouseOut=!1;let n=e.composedPath();for(let e=0;e<n.length;e++){let t=n[e];if(t.classList.contains(`xterm`))break;if(t.classList.contains(`xterm-hover`))return}(!this._lastBufferCell||t.x!==this._lastBufferCell.x||t.y!==this._lastBufferCell.y)&&(this._handleHover(t),this._lastBufferCell=t)}_handleHover(e){if(this._activeLine!==e.y||this._wasResized){this._clearCurrentLink(),this._askForLink(e,!1),this._wasResized=!1;return}this._currentLink&&this._linkAtPosition(this._currentLink.link,e)||(this._clearCurrentLink(),this._askForLink(e,!0))}_askForLink(e,t){(!this._activeProviderReplies||!t)&&(this._activeProviderReplies?.forEach(e=>{e?.forEach(e=>{e.link.dispose&&e.link.dispose()})}),this._activeProviderReplies=new Map,this._activeLine=e.y);let n=!1;for(let[r,i]of this._linkProviderService.linkProviders.entries())t?this._activeProviderReplies?.get(r)&&(n=this._checkLinkProviderResult(r,e,n)):i.provideLinks(e.y,t=>{if(this._isMouseOut)return;let i=t?.map(e=>({link:e}));this._activeProviderReplies?.set(r,i),n=this._checkLinkProviderResult(r,e,n),this._activeProviderReplies?.size===this._linkProviderService.linkProviders.length&&this._removeIntersectingLinks(e.y,this._activeProviderReplies)})}_removeIntersectingLinks(e,t){let n=new Set;for(let r=0;r<t.size;r++){let i=t.get(r);if(i)for(let t=0;t<i.length;t++){let r=i[t],a=r.link.range.start.y<e?0:r.link.range.start.x,o=r.link.range.end.y>e?this._bufferService.cols:r.link.range.end.x;for(let e=a;e<=o;e++){if(n.has(e)){i.splice(t--,1);break}n.add(e)}}}}_checkLinkProviderResult(e,t,n){if(!this._activeProviderReplies)return n;let r=this._activeProviderReplies.get(e),i=!1;for(let t=0;t<e;t++)(!this._activeProviderReplies.has(t)||this._activeProviderReplies.get(t))&&(i=!0);if(!i&&r){let e=r.find(e=>this._linkAtPosition(e.link,t));e&&(n=!0,this._handleNewLink(e))}if(this._activeProviderReplies.size===this._linkProviderService.linkProviders.length&&!n)for(let e=0;e<this._activeProviderReplies.size;e++){let r=this._activeProviderReplies.get(e)?.find(e=>this._linkAtPosition(e.link,t));if(r){n=!0,this._handleNewLink(r);break}}return n}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(e){if(!this._currentLink)return;let t=this._positionFromMouseEvent(e,this._element,this._mouseService);t&&this._mouseDownLink&&tx(this._mouseDownLink.link,this._currentLink.link)&&this._linkAtPosition(this._currentLink.link,t)&&this._currentLink.link.activate(e,this._currentLink.link.text)}_clearCurrentLink(e,t){!this._currentLink||!this._lastMouseEvent||(!e||!t||this._currentLink.link.range.start.y>=e&&this._currentLink.link.range.end.y<=t)&&(this._linkLeave(this._element,this._currentLink.link,this._lastMouseEvent),this._currentLink=void 0,ym(this._linkCacheDisposables),this._linkCacheDisposables.length=0)}_handleNewLink(e){if(!this._lastMouseEvent)return;let t=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);t&&this._linkAtPosition(e.link,t)&&(this._currentLink=e,this._currentLink.state={decorations:{underline:e.link.decorations===void 0||e.link.decorations.underline,pointerCursor:e.link.decorations===void 0||e.link.decorations.pointerCursor},isHovered:!0},this._linkHover(this._element,e.link,this._lastMouseEvent),e.link.decorations={},Object.defineProperties(e.link.decorations,{pointerCursor:{get:()=>this._currentLink?.state?.decorations.pointerCursor,set:e=>{this._currentLink?.state&&this._currentLink.state.decorations.pointerCursor!==e&&(this._currentLink.state.decorations.pointerCursor=e,this._currentLink.state.isHovered&&this._element.classList.toggle(`xterm-cursor-pointer`,e))}},underline:{get:()=>this._currentLink?.state?.decorations.underline,set:t=>{this._currentLink?.state&&this._currentLink?.state?.decorations.underline!==t&&(this._currentLink.state.decorations.underline=t,this._currentLink.state.isHovered&&this._fireUnderlineEvent(e.link,t))}}}),this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange(e=>{if(!this._currentLink)return;let t=e.start===0?0:e.start+1+this._bufferService.buffer.ydisp,n=this._bufferService.buffer.ydisp+1+e.end;if(this._currentLink.link.range.start.y>=t&&this._currentLink.link.range.end.y<=n&&(this._clearCurrentLink(t,n),this._lastMouseEvent)){let e=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);e&&this._askForLink(e,!1)}})))}_linkHover(e,t,n){this._currentLink?.state&&(this._currentLink.state.isHovered=!0,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(t,!0),this._currentLink.state.decorations.pointerCursor&&e.classList.add(`xterm-cursor-pointer`)),t.hover&&t.hover(n,t.text)}_fireUnderlineEvent(e,t){let n=e.range,r=this._bufferService.buffer.ydisp,i=this._createLinkUnderlineEvent(n.start.x-1,n.start.y-r-1,n.end.x,n.end.y-r-1,void 0);(t?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(i)}_linkLeave(e,t,n){this._currentLink?.state&&(this._currentLink.state.isHovered=!1,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(t,!1),this._currentLink.state.decorations.pointerCursor&&e.classList.remove(`xterm-cursor-pointer`)),t.leave&&t.leave(n,t.text)}_linkAtPosition(e,t){let n=e.range.start.y*this._bufferService.cols+e.range.start.x,r=e.range.end.y*this._bufferService.cols+e.range.end.x,i=t.y*this._bufferService.cols+t.x;return n<=i&&i<=r}_positionFromMouseEvent(e,t,n){let r=n.getCoords(e,t,this._bufferService.cols,this._bufferService.rows);if(r)return{x:r[0],y:r[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(e,t,n,r,i){return{x1:e,y1:t,x2:n,y2:r,cols:this._bufferService.cols,fg:i}}};ex=tp([J(1,Hp),J(2,Up),J(3,Op),J(4,qp)],ex);function tx(e,t){return e.text===t.text&&e.range.start.x===t.range.start.x&&e.range.start.y===t.range.start.y&&e.range.end.x===t.range.end.x&&e.range.end.y===t.range.end.y}var nx=class extends Vb{constructor(e={}){super(e),this._linkifier=this._register(new Tm),this.browser=mv,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this._register(new Tm),this._onCursorMove=this._register(new Y),this.onCursorMove=this._onCursorMove.event,this._onKey=this._register(new Y),this.onKey=this._onKey.event,this._onRender=this._register(new Y),this.onRender=this._onRender.event,this._onSelectionChange=this._register(new Y),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this._register(new Y),this.onTitleChange=this._onTitleChange.event,this._onBell=this._register(new Y),this.onBell=this._onBell.event,this._onFocus=this._register(new Y),this._onBlur=this._register(new Y),this._onA11yCharEmitter=this._register(new Y),this._onA11yTabEmitter=this._register(new Y),this._onWillOpen=this._register(new Y),this._setup(),this._decorationService=this._instantiationService.createInstance(Jb),this._instantiationService.setService(Lp,this._decorationService),this._linkProviderService=this._instantiationService.createInstance(lv),this._instantiationService.setService(qp,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(Rp)),this._register(this._inputHandler.onRequestBell(()=>this._onBell.fire())),this._register(this._inputHandler.onRequestRefreshRows(e=>this.refresh(e?.start??0,e?.end??this.rows-1))),this._register(this._inputHandler.onRequestSendFocus(()=>this._reportFocus())),this._register(this._inputHandler.onRequestReset(()=>this.reset())),this._register(this._inputHandler.onRequestWindowsOptionsReport(e=>this._reportWindowsOptions(e))),this._register(this._inputHandler.onColor(e=>this._handleColorEvent(e))),this._register(Mm.forward(this._inputHandler.onCursorMove,this._onCursorMove)),this._register(Mm.forward(this._inputHandler.onTitleChange,this._onTitleChange)),this._register(Mm.forward(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this._register(Mm.forward(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this._register(this._bufferService.onResize(e=>this._afterResize(e.cols,e.rows))),this._register(xm(()=>{this._customKeyEventHandler=void 0,this.element?.parentNode?.removeChild(this.element)}))}get linkifier(){return this._linkifier.value}get onFocus(){return this._onFocus.event}get onBlur(){return this._onBlur.event}get onA11yChar(){return this._onA11yCharEmitter.event}get onA11yTab(){return this._onA11yTabEmitter.event}get onWillOpen(){return this._onWillOpen.event}_handleColorEvent(e){if(this._themeService)for(let t of e){let e,n=``;switch(t.index){case 256:e=`foreground`,n=`10`;break;case 257:e=`background`,n=`11`;break;case 258:e=`cursor`,n=`12`;break;default:e=`ansi`,n=`4;`+t.index}switch(t.type){case 0:let r=j_.toColorRGB(e===`ansi`?this._themeService.colors.ansi[t.index]:this._themeService.colors[e]);this.coreService.triggerDataEvent(`${Z.ESC}]${n};${Tb(r)}${C_.ST}`);break;case 1:if(e===`ansi`)this._themeService.modifyColors(e=>e.ansi[t.index]=A_.toColor(...t.color));else{let n=e;this._themeService.modifyColors(e=>e[n]=A_.toColor(...t.color))}break;case 2:this._themeService.restoreColor(t.index);break}}}_setup(){super._setup(),this._customKeyEventHandler=void 0}get buffer(){return this.buffers.active}focus(){this.textarea&&this.textarea.focus({preventScroll:!0})}_handleScreenReaderModeOptionChange(e){e?!this._accessibilityManager.value&&this._renderService&&(this._accessibilityManager.value=this._instantiationService.createInstance($b,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(e){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(Z.ESC+`[I`),this.element.classList.add(`focus`),this._showCursor(),this._onFocus.fire()}blur(){return this.textarea?.blur()}_handleTextAreaBlur(){this.textarea.value=``,this.refresh(this.buffer.y,this.buffer.y),this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(Z.ESC+`[O`),this.element.classList.remove(`focus`),this._onBlur.fire()}_syncTextArea(){if(!this.textarea||!this.buffer.isCursorInViewport||this._compositionHelper.isComposing||!this._renderService)return;let e=this.buffer.ybase+this.buffer.y,t=this.buffer.lines.get(e);if(!t)return;let n=Math.min(this.buffer.x,this.cols-1),r=this._renderService.dimensions.css.cell.height,i=t.getWidth(n),a=this._renderService.dimensions.css.cell.width*i,o=this.buffer.y*this._renderService.dimensions.css.cell.height,s=n*this._renderService.dimensions.css.cell.width;this.textarea.style.left=s+`px`,this.textarea.style.top=o+`px`,this.textarea.style.width=a+`px`,this.textarea.style.height=r+`px`,this.textarea.style.lineHeight=r+`px`,this.textarea.style.zIndex=`-5`}_initGlobal(){this._bindKeys(),this._register(X(this.element,`copy`,e=>{this.hasSelection()&&cp(e,this._selectionService)}));let e=e=>lp(e,this.textarea,this.coreService,this.optionsService);this._register(X(this.textarea,`paste`,e)),this._register(X(this.element,`paste`,e)),vv?this._register(X(this.element,`mousedown`,e=>{e.button===2&&fp(e,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})):this._register(X(this.element,`contextmenu`,e=>{fp(e,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})),Ev&&this._register(X(this.element,`auxclick`,e=>{e.button===1&&dp(e,this.textarea,this.screenElement)}))}_bindKeys(){this._register(X(this.textarea,`keyup`,e=>this._keyUp(e),!0)),this._register(X(this.textarea,`keydown`,e=>this._keyDown(e),!0)),this._register(X(this.textarea,`keypress`,e=>this._keyPress(e),!0)),this._register(X(this.textarea,`compositionstart`,()=>this._compositionHelper.compositionstart())),this._register(X(this.textarea,`compositionupdate`,e=>this._compositionHelper.compositionupdate(e))),this._register(X(this.textarea,`compositionend`,()=>this._compositionHelper.compositionend())),this._register(X(this.textarea,`input`,e=>this._inputEvent(e),!0)),this._register(this.onRender(()=>this._compositionHelper.updateCompositionElements()))}open(e){if(!e)throw Error(`Terminal requires a parent element.`);if(e.isConnected||this._logService.debug(`Terminal.open was called on an element that was not attached to the DOM`),this.element?.ownerDocument.defaultView&&this._coreBrowserService){this.element.ownerDocument.defaultView!==this._coreBrowserService.window&&(this._coreBrowserService.window=this.element.ownerDocument.defaultView);return}this._document=e.ownerDocument,this.options.documentOverride&&this.options.documentOverride instanceof Document&&(this._document=this.optionsService.rawOptions.documentOverride),this.element=this._document.createElement(`div`),this.element.dir=`ltr`,this.element.classList.add(`terminal`),this.element.classList.add(`xterm`),e.appendChild(this.element);let t=this._document.createDocumentFragment();this._viewportElement=this._document.createElement(`div`),this._viewportElement.classList.add(`xterm-viewport`),t.appendChild(this._viewportElement),this.screenElement=this._document.createElement(`div`),this.screenElement.classList.add(`xterm-screen`),this._register(X(this.screenElement,`mousemove`,e=>this.updateCursorStyle(e))),this._helperContainer=this._document.createElement(`div`),this._helperContainer.classList.add(`xterm-helpers`),this.screenElement.appendChild(this._helperContainer),t.appendChild(this.screenElement);let n=this.textarea=this._document.createElement(`textarea`);this.textarea.classList.add(`xterm-helper-textarea`),this.textarea.setAttribute(`aria-label`,rp.get()),Dv||this.textarea.setAttribute(`aria-multiline`,`false`),this.textarea.setAttribute(`autocorrect`,`off`),this.textarea.setAttribute(`autocapitalize`,`off`),this.textarea.setAttribute(`spellcheck`,`false`),this.textarea.tabIndex=0,this._register(this.optionsService.onSpecificOptionChange(`disableStdin`,()=>n.readOnly=this.optionsService.rawOptions.disableStdin)),this.textarea.readOnly=this.optionsService.rawOptions.disableStdin,this._coreBrowserService=this._register(this._instantiationService.createInstance(sv,this.textarea,e.ownerDocument.defaultView??window,this._document??typeof window<`u`?window.document:null)),this._instantiationService.setService(Vp,this._coreBrowserService),this._register(X(this.textarea,`focus`,e=>this._handleTextAreaFocus(e))),this._register(X(this.textarea,`blur`,()=>this._handleTextAreaBlur())),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(rv,this._document,this._helperContainer),this._instantiationService.setService(Bp,this._charSizeService),this._themeService=this._instantiationService.createInstance(dy),this._instantiationService.setService(Kp,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(R_),this._instantiationService.setService(Gp,this._characterJoinerService),this._renderService=this._register(this._instantiationService.createInstance(Nv,this.rows,this.screenElement)),this._instantiationService.setService(Up,this._renderService),this._register(this._renderService.onRenderedViewportChange(e=>this._onRender.fire(e))),this.onResize(e=>this._renderService.resize(e.cols,e.rows)),this._compositionView=this._document.createElement(`div`),this._compositionView.classList.add(`composition-view`),this._compositionHelper=this._instantiationService.createInstance(w_,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseService=this._instantiationService.createInstance(fv),this._instantiationService.setService(Hp,this._mouseService);let r=this._linkifier.value=this._register(this._instantiationService.createInstance(ex,this.screenElement));this.element.appendChild(t);try{this._onWillOpen.fire(this.element)}catch{}this._renderService.hasRenderer()||this._renderService.setRenderer(this._createRenderer()),this._register(this.onCursorMove(()=>{this._renderService.handleCursorMove(),this._syncTextArea()})),this._register(this.onResize(()=>this._renderService.handleResize(this.cols,this.rows))),this._register(this.onBlur(()=>this._renderService.handleBlur())),this._register(this.onFocus(()=>this._renderService.handleFocus())),this._viewport=this._register(this._instantiationService.createInstance(h_,this.element,this.screenElement)),this._register(this._viewport.onRequestScrollLines(e=>{super.scrollLines(e,!1),this.refresh(0,this.rows-1)})),this._selectionService=this._register(this._instantiationService.createInstance(ty,this.element,this.screenElement,r)),this._instantiationService.setService(Wp,this._selectionService),this._register(this._selectionService.onRequestScrollLines(e=>this.scrollLines(e.amount,e.suppressScrollEvent))),this._register(this._selectionService.onSelectionChange(()=>this._onSelectionChange.fire())),this._register(this._selectionService.onRequestRedraw(e=>this._renderService.handleSelectionChanged(e.start,e.end,e.columnSelectMode))),this._register(this._selectionService.onLinuxMouseSelection(e=>{this.textarea.value=e,this.textarea.focus(),this.textarea.select()})),this._register(Mm.any(this._onScroll.event,this._inputHandler.onScroll)(()=>{this._selectionService.refresh(),this._viewport?.queueSync()})),this._register(this._instantiationService.createInstance(g_,this.screenElement)),this._register(X(this.element,`mousedown`,e=>this._selectionService.handleMouseDown(e))),this.coreMouseService.areMouseEventsActive?(this._selectionService.disable(),this.element.classList.add(`enable-mouse-events`)):this._selectionService.enable(),this.options.screenReaderMode&&(this._accessibilityManager.value=this._instantiationService.createInstance($b,this)),this._register(this.optionsService.onSpecificOptionChange(`screenReaderMode`,e=>this._handleScreenReaderModeOptionChange(e))),this.options.overviewRuler.width&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(x_,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange(`overviewRuler`,e=>{!this._overviewRulerRenderer&&e&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(x_,this._viewportElement,this.screenElement)))}),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()}_createRenderer(){return this._instantiationService.createInstance(nv,this,this._document,this.element,this.screenElement,this._viewportElement,this._helperContainer,this.linkifier)}bindMouse(){let e=this,t=this.element;function n(t){let n=e._mouseService.getMouseReportCoords(t,e.screenElement);if(!n)return!1;let r,i;switch(t.overrideType||t.type){case`mousemove`:i=32,t.buttons===void 0?(r=3,t.button!==void 0&&(r=t.button<3?t.button:3)):r=t.buttons&1?0:t.buttons&4?1:t.buttons&2?2:3;break;case`mouseup`:i=0,r=t.button<3?t.button:3;break;case`mousedown`:i=1,r=t.button<3?t.button:3;break;case`wheel`:if(e._customWheelEventHandler&&e._customWheelEventHandler(t)===!1)return!1;let n=t.deltaY;if(n===0||e.coreMouseService.consumeWheelEvent(t,e._renderService?.dimensions?.device?.cell?.height,e._coreBrowserService?.dpr)===0)return!1;i=n<0?0:1,r=4;break;default:return!1}return i===void 0||r===void 0||r>4?!1:e.coreMouseService.triggerMouseEvent({col:n.col,row:n.row,x:n.x,y:n.y,button:r,action:i,ctrl:t.ctrlKey,alt:t.altKey,shift:t.shiftKey})}let r={mouseup:null,wheel:null,mousedrag:null,mousemove:null},i={mouseup:e=>(n(e),e.buttons||(this._document.removeEventListener(`mouseup`,r.mouseup),r.mousedrag&&this._document.removeEventListener(`mousemove`,r.mousedrag)),this.cancel(e)),wheel:e=>(n(e),this.cancel(e,!0)),mousedrag:e=>{e.buttons&&n(e)},mousemove:e=>{e.buttons||n(e)}};this._register(this.coreMouseService.onProtocolChange(e=>{e?(this.optionsService.rawOptions.logLevel===`debug`&&this._logService.debug(`Binding to mouse events:`,this.coreMouseService.explainEvents(e)),this.element.classList.add(`enable-mouse-events`),this._selectionService.disable()):(this._logService.debug(`Unbinding from mouse events.`),this.element.classList.remove(`enable-mouse-events`),this._selectionService.enable()),e&8?r.mousemove||=(t.addEventListener(`mousemove`,i.mousemove),i.mousemove):(t.removeEventListener(`mousemove`,r.mousemove),r.mousemove=null),e&16?r.wheel||=(t.addEventListener(`wheel`,i.wheel,{passive:!1}),i.wheel):(t.removeEventListener(`wheel`,r.wheel),r.wheel=null),e&2?r.mouseup||=i.mouseup:(this._document.removeEventListener(`mouseup`,r.mouseup),r.mouseup=null),e&4?r.mousedrag||=i.mousedrag:(this._document.removeEventListener(`mousemove`,r.mousedrag),r.mousedrag=null)})),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this._register(X(t,`mousedown`,e=>{if(e.preventDefault(),this.focus(),!(!this.coreMouseService.areMouseEventsActive||this._selectionService.shouldForceSelection(e)))return n(e),r.mouseup&&this._document.addEventListener(`mouseup`,r.mouseup),r.mousedrag&&this._document.addEventListener(`mousemove`,r.mousedrag),this.cancel(e)})),this._register(X(t,`wheel`,t=>{if(!r.wheel){if(this._customWheelEventHandler&&this._customWheelEventHandler(t)===!1)return!1;if(!this.buffer.hasScrollback){if(t.deltaY===0)return!1;if(e.coreMouseService.consumeWheelEvent(t,e._renderService?.dimensions?.device?.cell?.height,e._coreBrowserService?.dpr)===0)return this.cancel(t,!0);let n=Z.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?`O`:`[`)+(t.deltaY<0?`A`:`B`);return this.coreService.triggerDataEvent(n,!0),this.cancel(t,!0)}}},{passive:!1}))}refresh(e,t){this._renderService?.refreshRows(e,t)}updateCursorStyle(e){this._selectionService?.shouldColumnSelect(e)?this.element.classList.add(`column-select`):this.element.classList.remove(`column-select`)}_showCursor(){this.coreService.isCursorInitialized||(this.coreService.isCursorInitialized=!0,this.refresh(this.buffer.y,this.buffer.y))}scrollLines(e,t){this._viewport?this._viewport.scrollLines(e):super.scrollLines(e,t),this.refresh(0,this.rows-1)}scrollPages(e){this.scrollLines(e*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(e){e&&this._viewport?this._viewport.scrollToLine(this.buffer.ybase,!0):this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(e){let t=e-this._bufferService.buffer.ydisp;t!==0&&this.scrollLines(t)}paste(e){up(e,this.textarea,this.coreService,this.optionsService)}attachCustomKeyEventHandler(e){this._customKeyEventHandler=e}attachCustomWheelEventHandler(e){this._customWheelEventHandler=e}registerLinkProvider(e){return this._linkProviderService.registerLinkProvider(e)}registerCharacterJoiner(e){if(!this._characterJoinerService)throw Error(`Terminal must be opened first`);let t=this._characterJoinerService.register(e);return this.refresh(0,this.rows-1),t}deregisterCharacterJoiner(e){if(!this._characterJoinerService)throw Error(`Terminal must be opened first`);this._characterJoinerService.deregister(e)&&this.refresh(0,this.rows-1)}get markers(){return this.buffer.markers}registerMarker(e){return this.buffer.addMarker(this.buffer.ybase+this.buffer.y+e)}registerDecoration(e){return this._decorationService.registerDecoration(e)}hasSelection(){return this._selectionService?this._selectionService.hasSelection:!1}select(e,t,n){this._selectionService.setSelection(e,t,n)}getSelection(){return this._selectionService?this._selectionService.selectionText:``}getSelectionPosition(){if(!(!this._selectionService||!this._selectionService.hasSelection))return{start:{x:this._selectionService.selectionStart[0],y:this._selectionService.selectionStart[1]},end:{x:this._selectionService.selectionEnd[0],y:this._selectionService.selectionEnd[1]}}}clearSelection(){this._selectionService?.clearSelection()}selectAll(){this._selectionService?.selectAll()}selectLines(e,t){this._selectionService?.selectLines(e,t)}_keyDown(e){if(this._keyDownHandled=!1,this._keyDownSeen=!0,this._customKeyEventHandler&&this._customKeyEventHandler(e)===!1)return!1;let t=this.browser.isMac&&this.options.macOptionIsMeta&&e.altKey;if(!t&&!this._compositionHelper.keydown(e))return this.options.scrollOnUserInput&&this.buffer.ybase!==this.buffer.ydisp&&this.scrollToBottom(!0),!1;!t&&(e.key===`Dead`||e.key===`AltGraph`)&&(this._unprocessedDeadKey=!0);let n=Ub(e,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(e),n.type===3||n.type===2){let t=this.rows-1;return this.scrollLines(n.type===2?-t:t),this.cancel(e,!0)}if(n.type===1&&this.selectAll(),this._isThirdLevelShift(this.browser,e)||(n.cancel&&this.cancel(e,!0),!n.key)||e.key&&!e.ctrlKey&&!e.altKey&&!e.metaKey&&e.key.length===1&&e.key.charCodeAt(0)>=65&&e.key.charCodeAt(0)<=90)return!0;if(this._unprocessedDeadKey)return this._unprocessedDeadKey=!1,!0;if((n.key===Z.ETX||n.key===Z.CR)&&(this.textarea.value=``),this._onKey.fire({key:n.key,domEvent:e}),this._showCursor(),this.coreService.triggerDataEvent(n.key,!0),!this.optionsService.rawOptions.screenReaderMode||e.altKey||e.ctrlKey)return this.cancel(e,!0);this._keyDownHandled=!0}_isThirdLevelShift(e,t){let n=e.isMac&&!this.options.macOptionIsMeta&&t.altKey&&!t.ctrlKey&&!t.metaKey||e.isWindows&&t.altKey&&t.ctrlKey&&!t.metaKey||e.isWindows&&t.getModifierState(`AltGraph`);return t.type===`keypress`?n:n&&(!t.keyCode||t.keyCode>47)}_keyUp(e){this._keyDownSeen=!1,!(this._customKeyEventHandler&&this._customKeyEventHandler(e)===!1)&&(rx(e)||this.focus(),this.updateCursorStyle(e),this._keyPressHandled=!1)}_keyPress(e){let t;if(this._keyPressHandled=!1,this._keyDownHandled||this._customKeyEventHandler&&this._customKeyEventHandler(e)===!1)return!1;if(this.cancel(e),e.charCode)t=e.charCode;else if(e.which===null||e.which===void 0)t=e.keyCode;else if(e.which!==0&&e.charCode!==0)t=e.which;else return!1;return!t||(e.altKey||e.ctrlKey||e.metaKey)&&!this._isThirdLevelShift(this.browser,e)?!1:(t=String.fromCharCode(t),this._onKey.fire({key:t,domEvent:e}),this._showCursor(),this.coreService.triggerDataEvent(t,!0),this._keyPressHandled=!0,this._unprocessedDeadKey=!1,!0)}_inputEvent(e){if(e.data&&e.inputType===`insertText`&&(!e.composed||!this._keyDownSeen)&&!this.optionsService.rawOptions.screenReaderMode){if(this._keyPressHandled)return!1;this._unprocessedDeadKey=!1;let t=e.data;return this.coreService.triggerDataEvent(t,!0),this.cancel(e),!0}return!1}resize(e,t){if(e===this.cols&&t===this.rows){this._charSizeService&&!this._charSizeService.hasValidSize&&this._charSizeService.measure();return}super.resize(e,t)}_afterResize(e,t){this._charSizeService?.measure()}clear(){if(!(this.buffer.ybase===0&&this.buffer.y===0)){this.buffer.clearAllMarkers(),this.buffer.lines.set(0,this.buffer.lines.get(this.buffer.ybase+this.buffer.y)),this.buffer.lines.length=1,this.buffer.ydisp=0,this.buffer.ybase=0,this.buffer.y=0;for(let e=1;e<this.rows;e++)this.buffer.lines.push(this.buffer.getBlankLine(xy));this._onScroll.fire({position:this.buffer.ydisp}),this.refresh(0,this.rows-1)}}reset(){this.options.rows=this.rows,this.options.cols=this.cols;let e=this._customKeyEventHandler;this._setup(),super.reset(),this._selectionService?.reset(),this._decorationService.reset(),this._customKeyEventHandler=e,this.refresh(0,this.rows-1)}clearTextureAtlas(){this._renderService?.clearTextureAtlas()}_reportFocus(){this.element?.classList.contains(`focus`)?this.coreService.triggerDataEvent(Z.ESC+`[I`):this.coreService.triggerDataEvent(Z.ESC+`[O`)}_reportWindowsOptions(e){if(this._renderService)switch(e){case 0:let e=this._renderService.dimensions.css.canvas.width.toFixed(0),t=this._renderService.dimensions.css.canvas.height.toFixed(0);this.coreService.triggerDataEvent(`${Z.ESC}[4;${t};${e}t`);break;case 1:let n=this._renderService.dimensions.css.cell.width.toFixed(0),r=this._renderService.dimensions.css.cell.height.toFixed(0);this.coreService.triggerDataEvent(`${Z.ESC}[6;${r};${n}t`);break}}cancel(e,t){if(!(!this.options.cancelEvents&&!t))return e.preventDefault(),e.stopPropagation(),!1}};function rx(e){return e.keyCode===16||e.keyCode===17||e.keyCode===18}var ix=class{constructor(){this._addons=[]}dispose(){for(let e=this._addons.length-1;e>=0;e--)this._addons[e].instance.dispose()}loadAddon(e,t){let n={instance:t,dispose:t.dispose,isDisposed:!1};this._addons.push(n),t.dispose=()=>this._wrappedAddonDispose(n),t.activate(e)}_wrappedAddonDispose(e){if(e.isDisposed)return;let t=-1;for(let n=0;n<this._addons.length;n++)if(this._addons[n]===e){t=n;break}if(t===-1)throw Error(`Could not dispose an addon that has not been loaded`);e.isDisposed=!0,e.dispose.apply(e.instance),this._addons.splice(t,1)}},ax=class{constructor(e){this._line=e}get isWrapped(){return this._line.isWrapped}get length(){return this._line.length}getCell(e,t){if(!(e<0||e>=this._line.length))return t?(this._line.loadCell(e,t),t):this._line.loadCell(e,new xp)}translateToString(e,t,n){return this._line.translateToString(e,t,n)}},ox=class{constructor(e,t){this._buffer=e,this.type=t}init(e){return this._buffer=e,this}get cursorY(){return this._buffer.y}get cursorX(){return this._buffer.x}get viewportY(){return this._buffer.ydisp}get baseY(){return this._buffer.ybase}get length(){return this._buffer.lines.length}getLine(e){let t=this._buffer.lines.get(e);if(t)return new ax(t)}getNullCell(){return new xp}},sx=class extends wm{constructor(e){super(),this._core=e,this._onBufferChange=this._register(new Y),this.onBufferChange=this._onBufferChange.event,this._normal=new ox(this._core.buffers.normal,`normal`),this._alternate=new ox(this._core.buffers.alt,`alternate`),this._core.buffers.onBufferActivate(()=>this._onBufferChange.fire(this.active))}get active(){if(this._core.buffers.active===this._core.buffers.normal)return this.normal;if(this._core.buffers.active===this._core.buffers.alt)return this.alternate;throw Error(`Active buffer is neither normal nor alternate`)}get normal(){return this._normal.init(this._core.buffers.normal)}get alternate(){return this._alternate.init(this._core.buffers.alt)}},cx=class{constructor(e){this._core=e}registerCsiHandler(e,t){return this._core.registerCsiHandler(e,e=>t(e.toArray()))}addCsiHandler(e,t){return this.registerCsiHandler(e,t)}registerDcsHandler(e,t){return this._core.registerDcsHandler(e,(e,n)=>t(e,n.toArray()))}addDcsHandler(e,t){return this.registerDcsHandler(e,t)}registerEscHandler(e,t){return this._core.registerEscHandler(e,t)}addEscHandler(e,t){return this.registerEscHandler(e,t)}registerOscHandler(e,t){return this._core.registerOscHandler(e,t)}addOscHandler(e,t){return this.registerOscHandler(e,t)}},lx=class{constructor(e){this._core=e}register(e){this._core.unicodeService.register(e)}get versions(){return this._core.unicodeService.versions}get activeVersion(){return this._core.unicodeService.activeVersion}set activeVersion(e){this._core.unicodeService.activeVersion=e}},ux=[`cols`,`rows`],dx=0,fx=class extends wm{constructor(e){super(),this._core=this._register(new nx(e)),this._addonManager=this._register(new ix),this._publicOptions={...this._core.options};let t=e=>this._core.options[e],n=(e,t)=>{this._checkReadonlyOptions(e),this._core.options[e]=t};for(let e in this._core.options){let r={get:t.bind(this,e),set:n.bind(this,e)};Object.defineProperty(this._publicOptions,e,r)}}_checkReadonlyOptions(e){if(ux.includes(e))throw Error(`Option "${e}" can only be set in the constructor`)}_checkProposedApi(){if(!this._core.optionsService.rawOptions.allowProposedApi)throw Error(`You must set the allowProposedApi option to true to use proposed API`)}get onBell(){return this._core.onBell}get onBinary(){return this._core.onBinary}get onCursorMove(){return this._core.onCursorMove}get onData(){return this._core.onData}get onKey(){return this._core.onKey}get onLineFeed(){return this._core.onLineFeed}get onRender(){return this._core.onRender}get onResize(){return this._core.onResize}get onScroll(){return this._core.onScroll}get onSelectionChange(){return this._core.onSelectionChange}get onTitleChange(){return this._core.onTitleChange}get onWriteParsed(){return this._core.onWriteParsed}get element(){return this._core.element}get parser(){return this._parser||=new cx(this._core),this._parser}get unicode(){return this._checkProposedApi(),new lx(this._core)}get textarea(){return this._core.textarea}get rows(){return this._core.rows}get cols(){return this._core.cols}get buffer(){return this._buffer||=this._register(new sx(this._core)),this._buffer}get markers(){return this._checkProposedApi(),this._core.markers}get modes(){let e=this._core.coreService.decPrivateModes,t=`none`;switch(this._core.coreMouseService.activeProtocol){case`X10`:t=`x10`;break;case`VT200`:t=`vt200`;break;case`DRAG`:t=`drag`;break;case`ANY`:t=`any`;break}return{applicationCursorKeysMode:e.applicationCursorKeys,applicationKeypadMode:e.applicationKeypad,bracketedPasteMode:e.bracketedPasteMode,insertMode:this._core.coreService.modes.insertMode,mouseTrackingMode:t,originMode:e.origin,reverseWraparoundMode:e.reverseWraparound,sendFocusMode:e.sendFocus,synchronizedOutputMode:e.synchronizedOutput,wraparoundMode:e.wraparound}}get options(){return this._publicOptions}set options(e){for(let t in e)this._publicOptions[t]=e[t]}blur(){this._core.blur()}focus(){this._core.focus()}input(e,t=!0){this._core.input(e,t)}resize(e,t){this._verifyIntegers(e,t),this._core.resize(e,t)}open(e){this._core.open(e)}attachCustomKeyEventHandler(e){this._core.attachCustomKeyEventHandler(e)}attachCustomWheelEventHandler(e){this._core.attachCustomWheelEventHandler(e)}registerLinkProvider(e){return this._core.registerLinkProvider(e)}registerCharacterJoiner(e){return this._checkProposedApi(),this._core.registerCharacterJoiner(e)}deregisterCharacterJoiner(e){this._checkProposedApi(),this._core.deregisterCharacterJoiner(e)}registerMarker(e=0){return this._verifyIntegers(e),this._core.registerMarker(e)}registerDecoration(e){return this._checkProposedApi(),this._verifyPositiveIntegers(e.x??0,e.width??0,e.height??0),this._core.registerDecoration(e)}hasSelection(){return this._core.hasSelection()}select(e,t,n){this._verifyIntegers(e,t,n),this._core.select(e,t,n)}getSelection(){return this._core.getSelection()}getSelectionPosition(){return this._core.getSelectionPosition()}clearSelection(){this._core.clearSelection()}selectAll(){this._core.selectAll()}selectLines(e,t){this._verifyIntegers(e,t),this._core.selectLines(e,t)}dispose(){super.dispose()}scrollLines(e){this._verifyIntegers(e),this._core.scrollLines(e)}scrollPages(e){this._verifyIntegers(e),this._core.scrollPages(e)}scrollToTop(){this._core.scrollToTop()}scrollToBottom(){this._core.scrollToBottom()}scrollToLine(e){this._verifyIntegers(e),this._core.scrollToLine(e)}clear(){this._core.clear()}write(e,t){this._core.write(e,t)}writeln(e,t){this._core.write(e),this._core.write(`\r
43
+ `,t)}paste(e){this._core.paste(e)}refresh(e,t){this._verifyIntegers(e,t),this._core.refresh(e,t)}reset(){this._core.reset()}clearTextureAtlas(){this._core.clearTextureAtlas()}loadAddon(e){this._addonManager.loadAddon(this,e)}static get strings(){return{get promptLabel(){return rp.get()},set promptLabel(e){rp.set(e)},get tooMuchOutput(){return ap.get()},set tooMuchOutput(e){ap.set(e)}}}_verifyIntegers(...e){for(dx of e)if(dx===1/0||isNaN(dx)||dx%1!=0)throw Error(`This API only accepts integers`)}_verifyPositiveIntegers(...e){for(dx of e)if(dx&&(dx===1/0||isNaN(dx)||dx%1!=0||dx<0))throw Error(`This API only accepts positive integers`)}},px=Object.create(null);px.open=`0`,px.close=`1`,px.ping=`2`,px.pong=`3`,px.message=`4`,px.upgrade=`5`,px.noop=`6`;var mx=Object.create(null);Object.keys(px).forEach(e=>{mx[px[e]]=e});var hx={type:`error`,data:`parser error`},gx=typeof Blob==`function`||typeof Blob<`u`&&Object.prototype.toString.call(Blob)===`[object BlobConstructor]`,_x=typeof ArrayBuffer==`function`,vx=e=>typeof ArrayBuffer.isView==`function`?ArrayBuffer.isView(e):e&&e.buffer instanceof ArrayBuffer,yx=({type:e,data:t},n,r)=>gx&&t instanceof Blob?n?r(t):bx(t,r):_x&&(t instanceof ArrayBuffer||vx(t))?n?r(t):bx(new Blob([t]),r):r(px[e]+(t||``)),bx=(e,t)=>{let n=new FileReader;return n.onload=function(){let e=n.result.split(`,`)[1];t(`b`+(e||``))},n.readAsDataURL(e)};function xx(e){return e instanceof Uint8Array?e:e instanceof ArrayBuffer?new Uint8Array(e):new Uint8Array(e.buffer,e.byteOffset,e.byteLength)}var Sx;function Cx(e,t){if(gx&&e.data instanceof Blob)return e.data.arrayBuffer().then(xx).then(t);if(_x&&(e.data instanceof ArrayBuffer||vx(e.data)))return t(xx(e.data));yx(e,!1,e=>{Sx||=new TextEncoder,t(Sx.encode(e))})}var wx=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/`,Tx=typeof Uint8Array>`u`?[]:new Uint8Array(256);for(let e=0;e<64;e++)Tx[wx.charCodeAt(e)]=e;var Ex=e=>{let t=e.length*.75,n=e.length,r,i=0,a,o,s,c;e[e.length-1]===`=`&&(t--,e[e.length-2]===`=`&&t--);let l=new ArrayBuffer(t),u=new Uint8Array(l);for(r=0;r<n;r+=4)a=Tx[e.charCodeAt(r)],o=Tx[e.charCodeAt(r+1)],s=Tx[e.charCodeAt(r+2)],c=Tx[e.charCodeAt(r+3)],u[i++]=a<<2|o>>4,u[i++]=(o&15)<<4|s>>2,u[i++]=(s&3)<<6|c&63;return l},Dx=typeof ArrayBuffer==`function`,Ox=(e,t)=>{if(typeof e!=`string`)return{type:`message`,data:Ax(e,t)};let n=e.charAt(0);return n===`b`?{type:`message`,data:kx(e.substring(1),t)}:mx[n]?e.length>1?{type:mx[n],data:e.substring(1)}:{type:mx[n]}:hx},kx=(e,t)=>Dx?Ax(Ex(e),t):{base64:!0,data:e},Ax=(e,t)=>{switch(t){case`blob`:return e instanceof Blob?e:new Blob([e]);default:return e instanceof ArrayBuffer?e:e.buffer}},jx=``,Mx=(e,t)=>{let n=e.length,r=Array(n),i=0;e.forEach((e,a)=>{yx(e,!1,e=>{r[a]=e,++i===n&&t(r.join(jx))})})},Nx=(e,t)=>{let n=e.split(jx),r=[];for(let e=0;e<n.length;e++){let i=Ox(n[e],t);if(r.push(i),i.type===`error`)break}return r};function Px(){return new TransformStream({transform(e,t){Cx(e,n=>{let r=n.length,i;if(r<126)i=new Uint8Array(1),new DataView(i.buffer).setUint8(0,r);else if(r<65536){i=new Uint8Array(3);let e=new DataView(i.buffer);e.setUint8(0,126),e.setUint16(1,r)}else{i=new Uint8Array(9);let e=new DataView(i.buffer);e.setUint8(0,127),e.setBigUint64(1,BigInt(r))}e.data&&typeof e.data!=`string`&&(i[0]|=128),t.enqueue(i),t.enqueue(n)})}})}var Fx;function Ix(e){return e.reduce((e,t)=>e+t.length,0)}function Lx(e,t){if(e[0].length===t)return e.shift();let n=new Uint8Array(t),r=0;for(let i=0;i<t;i++)n[i]=e[0][r++],r===e[0].length&&(e.shift(),r=0);return e.length&&r<e[0].length&&(e[0]=e[0].slice(r)),n}function Rx(e,t){Fx||=new TextDecoder;let n=[],r=0,i=-1,a=!1;return new TransformStream({transform(o,s){for(n.push(o);;){if(r===0){if(Ix(n)<1)break;let e=Lx(n,1);a=(e[0]&128)==128,i=e[0]&127,r=i<126?3:i===126?1:2}else if(r===1){if(Ix(n)<2)break;let e=Lx(n,2);i=new DataView(e.buffer,e.byteOffset,e.length).getUint16(0),r=3}else if(r===2){if(Ix(n)<8)break;let e=Lx(n,8),t=new DataView(e.buffer,e.byteOffset,e.length),a=t.getUint32(0);if(a>2**21-1){s.enqueue(hx);break}i=a*2**32+t.getUint32(4),r=3}else{if(Ix(n)<i)break;let e=Lx(n,i);s.enqueue(Ox(a?e:Fx.decode(e),t)),r=0}if(i===0||i>e){s.enqueue(hx);break}}}})}function zx(e){if(e)return Bx(e)}function Bx(e){for(var t in zx.prototype)e[t]=zx.prototype[t];return e}zx.prototype.on=zx.prototype.addEventListener=function(e,t){return this._callbacks=this._callbacks||{},(this._callbacks[`$`+e]=this._callbacks[`$`+e]||[]).push(t),this},zx.prototype.once=function(e,t){function n(){this.off(e,n),t.apply(this,arguments)}return n.fn=t,this.on(e,n),this},zx.prototype.off=zx.prototype.removeListener=zx.prototype.removeAllListeners=zx.prototype.removeEventListener=function(e,t){if(this._callbacks=this._callbacks||{},arguments.length==0)return this._callbacks={},this;var n=this._callbacks[`$`+e];if(!n)return this;if(arguments.length==1)return delete this._callbacks[`$`+e],this;for(var r,i=0;i<n.length;i++)if(r=n[i],r===t||r.fn===t){n.splice(i,1);break}return n.length===0&&delete this._callbacks[`$`+e],this},zx.prototype.emit=function(e){this._callbacks=this._callbacks||{};for(var t=Array(arguments.length-1),n=this._callbacks[`$`+e],r=1;r<arguments.length;r++)t[r-1]=arguments[r];if(n){n=n.slice(0);for(var r=0,i=n.length;r<i;++r)n[r].apply(this,t)}return this},zx.prototype.emitReserved=zx.prototype.emit,zx.prototype.listeners=function(e){return this._callbacks=this._callbacks||{},this._callbacks[`$`+e]||[]},zx.prototype.hasListeners=function(e){return!!this.listeners(e).length};var Vx=typeof Promise==`function`&&typeof Promise.resolve==`function`?e=>Promise.resolve().then(e):(e,t)=>t(e,0),Hx=typeof self<`u`?self:typeof window<`u`?window:Function(`return this`)(),Ux=`arraybuffer`;function Wx(e,...t){return t.reduce((t,n)=>(e.hasOwnProperty(n)&&(t[n]=e[n]),t),{})}var Gx=Hx.setTimeout,Kx=Hx.clearTimeout;function qx(e,t){t.useNativeTimers?(e.setTimeoutFn=Gx.bind(Hx),e.clearTimeoutFn=Kx.bind(Hx)):(e.setTimeoutFn=Hx.setTimeout.bind(Hx),e.clearTimeoutFn=Hx.clearTimeout.bind(Hx))}var Jx=1.33;function Yx(e){return typeof e==`string`?Xx(e):Math.ceil((e.byteLength||e.size)*Jx)}function Xx(e){let t=0,n=0;for(let r=0,i=e.length;r<i;r++)t=e.charCodeAt(r),t<128?n+=1:t<2048?n+=2:t<55296||t>=57344?n+=3:(r++,n+=4);return n}function Zx(){return Date.now().toString(36).substring(3)+Math.random().toString(36).substring(2,5)}function Qx(e){let t=``;for(let n in e)e.hasOwnProperty(n)&&(t.length&&(t+=`&`),t+=encodeURIComponent(n)+`=`+encodeURIComponent(e[n]));return t}function $x(e){let t={},n=e.split(`&`);for(let e=0,r=n.length;e<r;e++){let r=n[e].split(`=`);t[decodeURIComponent(r[0])]=decodeURIComponent(r[1])}return t}var eS=class extends Error{constructor(e,t,n){super(e),this.description=t,this.context=n,this.type=`TransportError`}},tS=class extends zx{constructor(e){super(),this.writable=!1,qx(this,e),this.opts=e,this.query=e.query,this.socket=e.socket,this.supportsBinary=!e.forceBase64}onError(e,t,n){return super.emitReserved(`error`,new eS(e,t,n)),this}open(){return this.readyState=`opening`,this.doOpen(),this}close(){return(this.readyState===`opening`||this.readyState===`open`)&&(this.doClose(),this.onClose()),this}send(e){this.readyState===`open`&&this.write(e)}onOpen(){this.readyState=`open`,this.writable=!0,super.emitReserved(`open`)}onData(e){let t=Ox(e,this.socket.binaryType);this.onPacket(t)}onPacket(e){super.emitReserved(`packet`,e)}onClose(e){this.readyState=`closed`,super.emitReserved(`close`,e)}pause(e){}createUri(e,t={}){return e+`://`+this._hostname()+this._port()+this.opts.path+this._query(t)}_hostname(){let e=this.opts.hostname;return e.indexOf(`:`)===-1?e:`[`+e+`]`}_port(){return this.opts.port&&(this.opts.secure&&Number(this.opts.port)!==443||!this.opts.secure&&Number(this.opts.port)!==80)?`:`+this.opts.port:``}_query(e){let t=Qx(e);return t.length?`?`+t:``}},nS=class extends tS{constructor(){super(...arguments),this._polling=!1}get name(){return`polling`}doOpen(){this._poll()}pause(e){this.readyState=`pausing`;let t=()=>{this.readyState=`paused`,e()};if(this._polling||!this.writable){let e=0;this._polling&&(e++,this.once(`pollComplete`,function(){--e||t()})),this.writable||(e++,this.once(`drain`,function(){--e||t()}))}else t()}_poll(){this._polling=!0,this.doPoll(),this.emitReserved(`poll`)}onData(e){Nx(e,this.socket.binaryType).forEach(e=>{if(this.readyState===`opening`&&e.type===`open`&&this.onOpen(),e.type===`close`)return this.onClose({description:`transport closed by the server`}),!1;this.onPacket(e)}),this.readyState!==`closed`&&(this._polling=!1,this.emitReserved(`pollComplete`),this.readyState===`open`&&this._poll())}doClose(){let e=()=>{this.write([{type:`close`}])};this.readyState===`open`?e():this.once(`open`,e)}write(e){this.writable=!1,Mx(e,e=>{this.doWrite(e,()=>{this.writable=!0,this.emitReserved(`drain`)})})}uri(){let e=this.opts.secure?`https`:`http`,t=this.query||{};return!1!==this.opts.timestampRequests&&(t[this.opts.timestampParam]=Zx()),!this.supportsBinary&&!t.sid&&(t.b64=1),this.createUri(e,t)}},rS=!1;try{rS=typeof XMLHttpRequest<`u`&&`withCredentials`in new XMLHttpRequest}catch{}var iS=rS;function aS(){}var oS=class extends nS{constructor(e){if(super(e),typeof location<`u`){let t=location.protocol===`https:`,n=location.port;n||=t?`443`:`80`,this.xd=typeof location<`u`&&e.hostname!==location.hostname||n!==e.port}}doWrite(e,t){let n=this.request({method:`POST`,data:e});n.on(`success`,t),n.on(`error`,(e,t)=>{this.onError(`xhr post error`,e,t)})}doPoll(){let e=this.request();e.on(`data`,this.onData.bind(this)),e.on(`error`,(e,t)=>{this.onError(`xhr poll error`,e,t)}),this.pollXhr=e}},sS=class e extends zx{constructor(e,t,n){super(),this.createRequest=e,qx(this,n),this._opts=n,this._method=n.method||`GET`,this._uri=t,this._data=n.data===void 0?null:n.data,this._create()}_create(){var t;let n=Wx(this._opts,`agent`,`pfx`,`key`,`passphrase`,`cert`,`ca`,`ciphers`,`rejectUnauthorized`,`autoUnref`);n.xdomain=!!this._opts.xd;let r=this._xhr=this.createRequest(n);try{r.open(this._method,this._uri,!0);try{if(this._opts.extraHeaders){r.setDisableHeaderCheck&&r.setDisableHeaderCheck(!0);for(let e in this._opts.extraHeaders)this._opts.extraHeaders.hasOwnProperty(e)&&r.setRequestHeader(e,this._opts.extraHeaders[e])}}catch{}if(this._method===`POST`)try{r.setRequestHeader(`Content-type`,`text/plain;charset=UTF-8`)}catch{}try{r.setRequestHeader(`Accept`,`*/*`)}catch{}(t=this._opts.cookieJar)==null||t.addCookies(r),`withCredentials`in r&&(r.withCredentials=this._opts.withCredentials),this._opts.requestTimeout&&(r.timeout=this._opts.requestTimeout),r.onreadystatechange=()=>{var e;r.readyState===3&&((e=this._opts.cookieJar)==null||e.parseCookies(r.getResponseHeader(`set-cookie`))),r.readyState===4&&(r.status===200||r.status===1223?this._onLoad():this.setTimeoutFn(()=>{this._onError(typeof r.status==`number`?r.status:0)},0))},r.send(this._data)}catch(e){this.setTimeoutFn(()=>{this._onError(e)},0);return}typeof document<`u`&&(this._index=e.requestsCount++,e.requests[this._index]=this)}_onError(e){this.emitReserved(`error`,e,this._xhr),this._cleanup(!0)}_cleanup(t){if(!(this._xhr===void 0||this._xhr===null)){if(this._xhr.onreadystatechange=aS,t)try{this._xhr.abort()}catch{}typeof document<`u`&&delete e.requests[this._index],this._xhr=null}}_onLoad(){let e=this._xhr.responseText;e!==null&&(this.emitReserved(`data`,e),this.emitReserved(`success`),this._cleanup())}abort(){this._cleanup()}};if(sS.requestsCount=0,sS.requests={},typeof document<`u`){if(typeof attachEvent==`function`)attachEvent(`onunload`,cS);else if(typeof addEventListener==`function`){let e=`onpagehide`in Hx?`pagehide`:`unload`;addEventListener(e,cS,!1)}}function cS(){for(let e in sS.requests)sS.requests.hasOwnProperty(e)&&sS.requests[e].abort()}var lS=(function(){let e=dS({xdomain:!1});return e&&e.responseType!==null})(),uS=class extends oS{constructor(e){super(e);let t=e&&e.forceBase64;this.supportsBinary=lS&&!t}request(e={}){return Object.assign(e,{xd:this.xd},this.opts),new sS(dS,this.uri(),e)}};function dS(e){let t=e.xdomain;try{if(typeof XMLHttpRequest<`u`&&(!t||iS))return new XMLHttpRequest}catch{}if(!t)try{return new Hx[[`Active`,`Object`].join(`X`)](`Microsoft.XMLHTTP`)}catch{}}var fS=typeof navigator<`u`&&typeof navigator.product==`string`&&navigator.product.toLowerCase()===`reactnative`,pS=class extends tS{get name(){return`websocket`}doOpen(){let e=this.uri(),t=this.opts.protocols,n=fS?{}:Wx(this.opts,`agent`,`perMessageDeflate`,`pfx`,`key`,`passphrase`,`cert`,`ca`,`ciphers`,`rejectUnauthorized`,`localAddress`,`protocolVersion`,`origin`,`maxPayload`,`family`,`checkServerIdentity`);this.opts.extraHeaders&&(n.headers=this.opts.extraHeaders);try{this.ws=this.createSocket(e,t,n)}catch(e){return this.emitReserved(`error`,e)}this.ws.binaryType=this.socket.binaryType,this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=e=>this.onClose({description:`websocket connection closed`,context:e}),this.ws.onmessage=e=>this.onData(e.data),this.ws.onerror=e=>this.onError(`websocket error`,e)}write(e){this.writable=!1;for(let t=0;t<e.length;t++){let n=e[t],r=t===e.length-1;yx(n,this.supportsBinary,e=>{try{this.doWrite(n,e)}catch{}r&&Vx(()=>{this.writable=!0,this.emitReserved(`drain`)},this.setTimeoutFn)})}}doClose(){this.ws!==void 0&&(this.ws.onerror=()=>{},this.ws.close(),this.ws=null)}uri(){let e=this.opts.secure?`wss`:`ws`,t=this.query||{};return this.opts.timestampRequests&&(t[this.opts.timestampParam]=Zx()),this.supportsBinary||(t.b64=1),this.createUri(e,t)}},mS=Hx.WebSocket||Hx.MozWebSocket,hS={websocket:class extends pS{createSocket(e,t,n){return fS?new mS(e,t,n):t?new mS(e,t):new mS(e)}doWrite(e,t){this.ws.send(t)}},webtransport:class extends tS{get name(){return`webtransport`}doOpen(){try{this._transport=new WebTransport(this.createUri(`https`),this.opts.transportOptions[this.name])}catch(e){return this.emitReserved(`error`,e)}this._transport.closed.then(()=>{this.onClose()}).catch(e=>{this.onError(`webtransport error`,e)}),this._transport.ready.then(()=>{this._transport.createBidirectionalStream().then(e=>{let t=Rx(2**53-1,this.socket.binaryType),n=e.readable.pipeThrough(t).getReader(),r=Px();r.readable.pipeTo(e.writable),this._writer=r.writable.getWriter();let i=()=>{n.read().then(({done:e,value:t})=>{e||(this.onPacket(t),i())}).catch(e=>{})};i();let a={type:`open`};this.query.sid&&(a.data=`{"sid":"${this.query.sid}"}`),this._writer.write(a).then(()=>this.onOpen())})})}write(e){this.writable=!1;for(let t=0;t<e.length;t++){let n=e[t],r=t===e.length-1;this._writer.write(n).then(()=>{r&&Vx(()=>{this.writable=!0,this.emitReserved(`drain`)},this.setTimeoutFn)})}}doClose(){var e;(e=this._transport)==null||e.close()}},polling:uS},gS=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,_S=[`source`,`protocol`,`authority`,`userInfo`,`user`,`password`,`host`,`port`,`relative`,`path`,`directory`,`file`,`query`,`anchor`];function vS(e){if(e.length>8e3)throw`URI too long`;let t=e,n=e.indexOf(`[`),r=e.indexOf(`]`);n!=-1&&r!=-1&&(e=e.substring(0,n)+e.substring(n,r).replace(/:/g,`;`)+e.substring(r,e.length));let i=gS.exec(e||``),a={},o=14;for(;o--;)a[_S[o]]=i[o]||``;return n!=-1&&r!=-1&&(a.source=t,a.host=a.host.substring(1,a.host.length-1).replace(/;/g,`:`),a.authority=a.authority.replace(`[`,``).replace(`]`,``).replace(/;/g,`:`),a.ipv6uri=!0),a.pathNames=yS(a,a.path),a.queryKey=bS(a,a.query),a}function yS(e,t){let n=t.replace(/\/{2,9}/g,`/`).split(`/`);return(t.slice(0,1)==`/`||t.length===0)&&n.splice(0,1),t.slice(-1)==`/`&&n.splice(n.length-1,1),n}function bS(e,t){let n={};return t.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(e,t,r){t&&(n[t]=r)}),n}var xS=typeof addEventListener==`function`&&typeof removeEventListener==`function`,SS=[];xS&&addEventListener(`offline`,()=>{SS.forEach(e=>e())},!1);var CS=class e extends zx{constructor(e,t){if(super(),this.binaryType=Ux,this.writeBuffer=[],this._prevBufferLen=0,this._pingInterval=-1,this._pingTimeout=-1,this._maxPayload=-1,this._pingTimeoutTime=1/0,e&&typeof e==`object`&&(t=e,e=null),e){let n=vS(e);t.hostname=n.host,t.secure=n.protocol===`https`||n.protocol===`wss`,t.port=n.port,n.query&&(t.query=n.query)}else t.host&&(t.hostname=vS(t.host).host);qx(this,t),this.secure=t.secure==null?typeof location<`u`&&location.protocol===`https:`:t.secure,t.hostname&&!t.port&&(t.port=this.secure?`443`:`80`),this.hostname=t.hostname||(typeof location<`u`?location.hostname:`localhost`),this.port=t.port||(typeof location<`u`&&location.port?location.port:this.secure?`443`:`80`),this.transports=[],this._transportsByName={},t.transports.forEach(e=>{let t=e.prototype.name;this.transports.push(t),this._transportsByName[t]=e}),this.opts=Object.assign({path:`/engine.io`,agent:!1,withCredentials:!1,upgrade:!0,timestampParam:`t`,rememberUpgrade:!1,addTrailingSlash:!0,rejectUnauthorized:!0,perMessageDeflate:{threshold:1024},transportOptions:{},closeOnBeforeunload:!1},t),this.opts.path=this.opts.path.replace(/\/$/,``)+(this.opts.addTrailingSlash?`/`:``),typeof this.opts.query==`string`&&(this.opts.query=$x(this.opts.query)),xS&&(this.opts.closeOnBeforeunload&&(this._beforeunloadEventListener=()=>{this.transport&&(this.transport.removeAllListeners(),this.transport.close())},addEventListener(`beforeunload`,this._beforeunloadEventListener,!1)),this.hostname!==`localhost`&&(this._offlineEventListener=()=>{this._onClose(`transport close`,{description:`network connection lost`})},SS.push(this._offlineEventListener))),this.opts.withCredentials&&(this._cookieJar=void 0),this._open()}createTransport(e){let t=Object.assign({},this.opts.query);t.EIO=4,t.transport=e,this.id&&(t.sid=this.id);let n=Object.assign({},this.opts,{query:t,socket:this,hostname:this.hostname,secure:this.secure,port:this.port},this.opts.transportOptions[e]);return new this._transportsByName[e](n)}_open(){if(this.transports.length===0){this.setTimeoutFn(()=>{this.emitReserved(`error`,`No transports available`)},0);return}let t=this.opts.rememberUpgrade&&e.priorWebsocketSuccess&&this.transports.indexOf(`websocket`)!==-1?`websocket`:this.transports[0];this.readyState=`opening`;let n=this.createTransport(t);n.open(),this.setTransport(n)}setTransport(e){this.transport&&this.transport.removeAllListeners(),this.transport=e,e.on(`drain`,this._onDrain.bind(this)).on(`packet`,this._onPacket.bind(this)).on(`error`,this._onError.bind(this)).on(`close`,e=>this._onClose(`transport close`,e))}onOpen(){this.readyState=`open`,e.priorWebsocketSuccess=this.transport.name===`websocket`,this.emitReserved(`open`),this.flush()}_onPacket(e){if(this.readyState===`opening`||this.readyState===`open`||this.readyState===`closing`)switch(this.emitReserved(`packet`,e),this.emitReserved(`heartbeat`),e.type){case`open`:this.onHandshake(JSON.parse(e.data));break;case`ping`:this._sendPacket(`pong`),this.emitReserved(`ping`),this.emitReserved(`pong`),this._resetPingTimeout();break;case`error`:let t=Error(`server error`);t.code=e.data,this._onError(t);break;case`message`:this.emitReserved(`data`,e.data),this.emitReserved(`message`,e.data);break}}onHandshake(e){this.emitReserved(`handshake`,e),this.id=e.sid,this.transport.query.sid=e.sid,this._pingInterval=e.pingInterval,this._pingTimeout=e.pingTimeout,this._maxPayload=e.maxPayload,this.onOpen(),this.readyState!==`closed`&&this._resetPingTimeout()}_resetPingTimeout(){this.clearTimeoutFn(this._pingTimeoutTimer);let e=this._pingInterval+this._pingTimeout;this._pingTimeoutTime=Date.now()+e,this._pingTimeoutTimer=this.setTimeoutFn(()=>{this._onClose(`ping timeout`)},e),this.opts.autoUnref&&this._pingTimeoutTimer.unref()}_onDrain(){this.writeBuffer.splice(0,this._prevBufferLen),this._prevBufferLen=0,this.writeBuffer.length===0?this.emitReserved(`drain`):this.flush()}flush(){if(this.readyState!==`closed`&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length){let e=this._getWritablePackets();this.transport.send(e),this._prevBufferLen=e.length,this.emitReserved(`flush`)}}_getWritablePackets(){if(!(this._maxPayload&&this.transport.name===`polling`&&this.writeBuffer.length>1))return this.writeBuffer;let e=1;for(let t=0;t<this.writeBuffer.length;t++){let n=this.writeBuffer[t].data;if(n&&(e+=Yx(n)),t>0&&e>this._maxPayload)return this.writeBuffer.slice(0,t);e+=2}return this.writeBuffer}_hasPingExpired(){if(!this._pingTimeoutTime)return!0;let e=Date.now()>this._pingTimeoutTime;return e&&(this._pingTimeoutTime=0,Vx(()=>{this._onClose(`ping timeout`)},this.setTimeoutFn)),e}write(e,t,n){return this._sendPacket(`message`,e,t,n),this}send(e,t,n){return this._sendPacket(`message`,e,t,n),this}_sendPacket(e,t,n,r){if(typeof t==`function`&&(r=t,t=void 0),typeof n==`function`&&(r=n,n=null),this.readyState===`closing`||this.readyState===`closed`)return;n||={},n.compress=!1!==n.compress;let i={type:e,data:t,options:n};this.emitReserved(`packetCreate`,i),this.writeBuffer.push(i),r&&this.once(`flush`,r),this.flush()}close(){let e=()=>{this._onClose(`forced close`),this.transport.close()},t=()=>{this.off(`upgrade`,t),this.off(`upgradeError`,t),e()},n=()=>{this.once(`upgrade`,t),this.once(`upgradeError`,t)};return(this.readyState===`opening`||this.readyState===`open`)&&(this.readyState=`closing`,this.writeBuffer.length?this.once(`drain`,()=>{this.upgrading?n():e()}):this.upgrading?n():e()),this}_onError(t){if(e.priorWebsocketSuccess=!1,this.opts.tryAllTransports&&this.transports.length>1&&this.readyState===`opening`)return this.transports.shift(),this._open();this.emitReserved(`error`,t),this._onClose(`transport error`,t)}_onClose(e,t){if(this.readyState===`opening`||this.readyState===`open`||this.readyState===`closing`){if(this.clearTimeoutFn(this._pingTimeoutTimer),this.transport.removeAllListeners(`close`),this.transport.close(),this.transport.removeAllListeners(),xS&&(this._beforeunloadEventListener&&removeEventListener(`beforeunload`,this._beforeunloadEventListener,!1),this._offlineEventListener)){let e=SS.indexOf(this._offlineEventListener);e!==-1&&SS.splice(e,1)}this.readyState=`closed`,this.id=null,this.emitReserved(`close`,e,t),this.writeBuffer=[],this._prevBufferLen=0}}};CS.protocol=4;var wS=class extends CS{constructor(){super(...arguments),this._upgrades=[]}onOpen(){if(super.onOpen(),this.readyState===`open`&&this.opts.upgrade)for(let e=0;e<this._upgrades.length;e++)this._probe(this._upgrades[e])}_probe(e){let t=this.createTransport(e),n=!1;CS.priorWebsocketSuccess=!1;let r=()=>{n||(t.send([{type:`ping`,data:`probe`}]),t.once(`packet`,e=>{if(!n)if(e.type===`pong`&&e.data===`probe`){if(this.upgrading=!0,this.emitReserved(`upgrading`,t),!t)return;CS.priorWebsocketSuccess=t.name===`websocket`,this.transport.pause(()=>{n||this.readyState!==`closed`&&(l(),this.setTransport(t),t.send([{type:`upgrade`}]),this.emitReserved(`upgrade`,t),t=null,this.upgrading=!1,this.flush())})}else{let e=Error(`probe error`);e.transport=t.name,this.emitReserved(`upgradeError`,e)}}))};function i(){n||(n=!0,l(),t.close(),t=null)}let a=e=>{let n=Error(`probe error: `+e);n.transport=t.name,i(),this.emitReserved(`upgradeError`,n)};function o(){a(`transport closed`)}function s(){a(`socket closed`)}function c(e){t&&e.name!==t.name&&i()}let l=()=>{t.removeListener(`open`,r),t.removeListener(`error`,a),t.removeListener(`close`,o),this.off(`close`,s),this.off(`upgrading`,c)};t.once(`open`,r),t.once(`error`,a),t.once(`close`,o),this.once(`close`,s),this.once(`upgrading`,c),this._upgrades.indexOf(`webtransport`)!==-1&&e!==`webtransport`?this.setTimeoutFn(()=>{n||t.open()},200):t.open()}onHandshake(e){this._upgrades=this._filterUpgrades(e.upgrades),super.onHandshake(e)}_filterUpgrades(e){let t=[];for(let n=0;n<e.length;n++)~this.transports.indexOf(e[n])&&t.push(e[n]);return t}},TS=class extends wS{constructor(e,t={}){let n=typeof e==`object`,r=n?{...e}:{...t};(!r.transports||r.transports&&typeof r.transports[0]==`string`)&&(r.transports=(r.transports||[`polling`,`websocket`,`webtransport`]).map(e=>hS[e]).filter(e=>!!e)),super(n?r:e,r)}};TS.protocol;function ES(e,t=``,n){let r=e;n||=typeof location<`u`&&location,e??=n.protocol+`//`+n.host,typeof e==`string`&&(e.charAt(0)===`/`&&(e=e.charAt(1)===`/`?n.protocol+e:n.host+e),/^(https?|wss?):\/\//.test(e)||(e=n===void 0?`https://`+e:n.protocol+`//`+e),r=vS(e)),r.port||(/^(http|ws)$/.test(r.protocol)?r.port=`80`:/^(http|ws)s$/.test(r.protocol)&&(r.port=`443`)),r.path=r.path||`/`;let i=r.host.indexOf(`:`)===-1?r.host:`[`+r.host+`]`;return r.id=r.protocol+`://`+i+`:`+r.port+t,r.href=r.protocol+`://`+i+(n&&n.port===r.port?``:`:`+r.port),r}var DS=typeof ArrayBuffer==`function`,OS=e=>typeof ArrayBuffer.isView==`function`?ArrayBuffer.isView(e):e.buffer instanceof ArrayBuffer,kS=Object.prototype.toString,AS=typeof Blob==`function`||typeof Blob<`u`&&kS.call(Blob)===`[object BlobConstructor]`,jS=typeof File==`function`||typeof File<`u`&&kS.call(File)===`[object FileConstructor]`;function MS(e){return DS&&(e instanceof ArrayBuffer||OS(e))||AS&&e instanceof Blob||jS&&e instanceof File}function NS(e,t){if(!e||typeof e!=`object`)return!1;if(Array.isArray(e)){for(let t=0,n=e.length;t<n;t++)if(NS(e[t]))return!0;return!1}if(MS(e))return!0;if(e.toJSON&&typeof e.toJSON==`function`&&arguments.length===1)return NS(e.toJSON(),!0);for(let t in e)if(Object.prototype.hasOwnProperty.call(e,t)&&NS(e[t]))return!0;return!1}function PS(e){let t=[],n=e.data,r=e;return r.data=FS(n,t),r.attachments=t.length,{packet:r,buffers:t}}function FS(e,t,n){if(!e)return e;if(MS(e)){let n={_placeholder:!0,num:t.length};return t.push(e),n}else if(Array.isArray(e)){let n=Array(e.length);for(let r=0;r<e.length;r++)n[r]=FS(e[r],t);return n}else if(typeof e==`object`&&!(e instanceof Date)){if(e.toJSON&&typeof e.toJSON==`function`&&!n)return FS(e.toJSON(),t,!0);let r={};for(let n in e)Object.prototype.hasOwnProperty.call(e,n)&&(r[n]=FS(e[n],t));return r}return e}function IS(e,t){return e.data=LS(e.data,t),delete e.attachments,e}function LS(e,t){if(!e)return e;if(e&&e._placeholder===!0){if(typeof e.num==`number`&&e.num>=0&&e.num<t.length)return t[e.num];throw Error(`illegal attachments`)}else if(Array.isArray(e))for(let n=0;n<e.length;n++)e[n]=LS(e[n],t);else if(typeof e==`object`)for(let n in e)Object.prototype.hasOwnProperty.call(e,n)&&(e[n]=LS(e[n],t));return e}var RS=s({Decoder:()=>HS,Encoder:()=>VS,PacketType:()=>BS,isPacketValid:()=>YS,protocol:()=>5}),zS=[`connect`,`connect_error`,`disconnect`,`disconnecting`,`newListener`,`removeListener`],BS;(function(e){e[e.CONNECT=0]=`CONNECT`,e[e.DISCONNECT=1]=`DISCONNECT`,e[e.EVENT=2]=`EVENT`,e[e.ACK=3]=`ACK`,e[e.CONNECT_ERROR=4]=`CONNECT_ERROR`,e[e.BINARY_EVENT=5]=`BINARY_EVENT`,e[e.BINARY_ACK=6]=`BINARY_ACK`})(BS||={});var VS=class{constructor(e){this.replacer=e}encode(e){return(e.type===BS.EVENT||e.type===BS.ACK)&&NS(e)?this.encodeAsBinary({type:e.type===BS.EVENT?BS.BINARY_EVENT:BS.BINARY_ACK,nsp:e.nsp,data:e.data,id:e.id}):[this.encodeAsString(e)]}encodeAsString(e){let t=``+e.type;return(e.type===BS.BINARY_EVENT||e.type===BS.BINARY_ACK)&&(t+=e.attachments+`-`),e.nsp&&e.nsp!==`/`&&(t+=e.nsp+`,`),e.id!=null&&(t+=e.id),e.data!=null&&(t+=JSON.stringify(e.data,this.replacer)),t}encodeAsBinary(e){let t=PS(e),n=this.encodeAsString(t.packet),r=t.buffers;return r.unshift(n),r}},HS=class e extends zx{constructor(e){super(),this.opts=Object.assign({reviver:void 0,maxAttachments:10},typeof e==`function`?{reviver:e}:e)}add(e){let t;if(typeof e==`string`){if(this.reconstructor)throw Error(`got plaintext data when reconstructing a packet`);t=this.decodeString(e);let n=t.type===BS.BINARY_EVENT;n||t.type===BS.BINARY_ACK?(t.type=n?BS.EVENT:BS.ACK,this.reconstructor=new US(t)):super.emitReserved(`decoded`,t)}else if(MS(e)||e.base64)if(this.reconstructor)t=this.reconstructor.takeBinaryData(e),t&&(this.reconstructor=null,super.emitReserved(`decoded`,t));else throw Error(`got binary data when not reconstructing a packet`);else throw Error(`Unknown type: `+e)}decodeString(t){let n=0,r={type:Number(t.charAt(0))};if(BS[r.type]===void 0)throw Error(`unknown packet type `+r.type);if(r.type===BS.BINARY_EVENT||r.type===BS.BINARY_ACK){let e=n+1;for(;t.charAt(++n)!==`-`&&n!=t.length;);let i=t.substring(e,n);if(i!=Number(i)||t.charAt(n)!==`-`)throw Error(`Illegal attachments`);let a=Number(i);if(!GS(a)||a<1)throw Error(`Illegal attachments`);if(a>this.opts.maxAttachments)throw Error(`too many attachments`);r.attachments=a}if(t.charAt(n+1)===`/`){let e=n+1;for(;++n&&!(t.charAt(n)===`,`||n===t.length););r.nsp=t.substring(e,n)}else r.nsp=`/`;let i=t.charAt(n+1);if(i!==``&&Number(i)==i){let e=n+1;for(;++n;){let e=t.charAt(n);if(e==null||Number(e)!=e){--n;break}if(n===t.length)break}r.id=Number(t.substring(e,n+1))}if(t.charAt(++n)){let i=this.tryParse(t.substr(n));if(e.isPayloadValid(r.type,i))r.data=i;else throw Error(`invalid payload`)}return r}tryParse(e){try{return JSON.parse(e,this.opts.reviver)}catch{return!1}}static isPayloadValid(e,t){switch(e){case BS.CONNECT:return qS(t);case BS.DISCONNECT:return t===void 0;case BS.CONNECT_ERROR:return typeof t==`string`||qS(t);case BS.EVENT:case BS.BINARY_EVENT:return Array.isArray(t)&&(typeof t[0]==`number`||typeof t[0]==`string`&&zS.indexOf(t[0])===-1);case BS.ACK:case BS.BINARY_ACK:return Array.isArray(t)}}destroy(){this.reconstructor&&=(this.reconstructor.finishedReconstruction(),null)}},US=class{constructor(e){this.packet=e,this.buffers=[],this.reconPack=e}takeBinaryData(e){if(this.buffers.push(e),this.buffers.length===this.reconPack.attachments){let e=IS(this.reconPack,this.buffers);return this.finishedReconstruction(),e}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}};function WS(e){return typeof e==`string`}var GS=Number.isInteger||function(e){return typeof e==`number`&&isFinite(e)&&Math.floor(e)===e};function KS(e){return e===void 0||GS(e)}function qS(e){return Object.prototype.toString.call(e)===`[object Object]`}function JS(e,t){switch(e){case BS.CONNECT:return t===void 0||qS(t);case BS.DISCONNECT:return t===void 0;case BS.EVENT:return Array.isArray(t)&&(typeof t[0]==`number`||typeof t[0]==`string`&&zS.indexOf(t[0])===-1);case BS.ACK:return Array.isArray(t);case BS.CONNECT_ERROR:return typeof t==`string`||qS(t);default:return!1}}function YS(e){return WS(e.nsp)&&KS(e.id)&&JS(e.type,e.data)}function XS(e,t,n){return e.on(t,n),function(){e.off(t,n)}}var ZS=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1}),QS=class extends zx{constructor(e,t,n){super(),this.connected=!1,this.recovered=!1,this.receiveBuffer=[],this.sendBuffer=[],this._queue=[],this._queueSeq=0,this.ids=0,this.acks={},this.flags={},this.io=e,this.nsp=t,n&&n.auth&&(this.auth=n.auth),this._opts=Object.assign({},n),this.io._autoConnect&&this.open()}get disconnected(){return!this.connected}subEvents(){if(this.subs)return;let e=this.io;this.subs=[XS(e,`open`,this.onopen.bind(this)),XS(e,`packet`,this.onpacket.bind(this)),XS(e,`error`,this.onerror.bind(this)),XS(e,`close`,this.onclose.bind(this))]}get active(){return!!this.subs}connect(){return this.connected?this:(this.subEvents(),this.io._reconnecting||this.io.open(),this.io._readyState===`open`&&this.onopen(),this)}open(){return this.connect()}send(...e){return e.unshift(`message`),this.emit.apply(this,e),this}emit(e,...t){if(ZS.hasOwnProperty(e))throw Error(`"`+e.toString()+`" is a reserved event name`);if(t.unshift(e),this._opts.retries&&!this.flags.fromQueue&&!this.flags.volatile)return this._addToQueue(t),this;let n={type:BS.EVENT,data:t};if(n.options={},n.options.compress=this.flags.compress!==!1,typeof t[t.length-1]==`function`){let e=this.ids++,r=t.pop();this._registerAckCallback(e,r),n.id=e}let r=this.io.engine?.transport?.writable,i=this.connected&&!this.io.engine?._hasPingExpired();return this.flags.volatile&&!r||(i?(this.notifyOutgoingListeners(n),this.packet(n)):this.sendBuffer.push(n)),this.flags={},this}_registerAckCallback(e,t){let n=this.flags.timeout??this._opts.ackTimeout;if(n===void 0){this.acks[e]=t;return}let r=this.io.setTimeoutFn(()=>{delete this.acks[e];for(let t=0;t<this.sendBuffer.length;t++)this.sendBuffer[t].id===e&&this.sendBuffer.splice(t,1);t.call(this,Error(`operation has timed out`))},n),i=(...e)=>{this.io.clearTimeoutFn(r),t.apply(this,e)};i.withError=!0,this.acks[e]=i}emitWithAck(e,...t){return new Promise((n,r)=>{let i=(e,t)=>e?r(e):n(t);i.withError=!0,t.push(i),this.emit(e,...t)})}_addToQueue(e){let t;typeof e[e.length-1]==`function`&&(t=e.pop());let n={id:this._queueSeq++,tryCount:0,pending:!1,args:e,flags:Object.assign({fromQueue:!0},this.flags)};e.push((e,...r)=>(this._queue[0],e===null?(this._queue.shift(),t&&t(null,...r)):n.tryCount>this._opts.retries&&(this._queue.shift(),t&&t(e)),n.pending=!1,this._drainQueue())),this._queue.push(n),this._drainQueue()}_drainQueue(e=!1){if(!this.connected||this._queue.length===0)return;let t=this._queue[0];t.pending&&!e||(t.pending=!0,t.tryCount++,this.flags=t.flags,this.emit.apply(this,t.args))}packet(e){e.nsp=this.nsp,this.io._packet(e)}onopen(){typeof this.auth==`function`?this.auth(e=>{this._sendConnectPacket(e)}):this._sendConnectPacket(this.auth)}_sendConnectPacket(e){this.packet({type:BS.CONNECT,data:this._pid?Object.assign({pid:this._pid,offset:this._lastOffset},e):e})}onerror(e){this.connected||this.emitReserved(`connect_error`,e)}onclose(e,t){this.connected=!1,delete this.id,this.emitReserved(`disconnect`,e,t),this._clearAcks()}_clearAcks(){Object.keys(this.acks).forEach(e=>{if(!this.sendBuffer.some(t=>String(t.id)===e)){let t=this.acks[e];delete this.acks[e],t.withError&&t.call(this,Error(`socket has been disconnected`))}})}onpacket(e){if(e.nsp===this.nsp)switch(e.type){case BS.CONNECT:e.data&&e.data.sid?this.onconnect(e.data.sid,e.data.pid):this.emitReserved(`connect_error`,Error(`It seems you are trying to reach a Socket.IO server in v2.x with a v3.x client, but they are not compatible (more information here: https://socket.io/docs/v3/migrating-from-2-x-to-3-0/)`));break;case BS.EVENT:case BS.BINARY_EVENT:this.onevent(e);break;case BS.ACK:case BS.BINARY_ACK:this.onack(e);break;case BS.DISCONNECT:this.ondisconnect();break;case BS.CONNECT_ERROR:this.destroy();let t=Error(e.data.message);t.data=e.data.data,this.emitReserved(`connect_error`,t);break}}onevent(e){let t=e.data||[];e.id!=null&&t.push(this.ack(e.id)),this.connected?this.emitEvent(t):this.receiveBuffer.push(Object.freeze(t))}emitEvent(e){if(this._anyListeners&&this._anyListeners.length){let t=this._anyListeners.slice();for(let n of t)n.apply(this,e)}super.emit.apply(this,e),this._pid&&e.length&&typeof e[e.length-1]==`string`&&(this._lastOffset=e[e.length-1])}ack(e){let t=this,n=!1;return function(...r){n||(n=!0,t.packet({type:BS.ACK,id:e,data:r}))}}onack(e){let t=this.acks[e.id];typeof t==`function`&&(delete this.acks[e.id],t.withError&&e.data.unshift(null),t.apply(this,e.data))}onconnect(e,t){this.id=e,this.recovered=t&&this._pid===t,this._pid=t,this.connected=!0,this.emitBuffered(),this._drainQueue(!0),this.emitReserved(`connect`)}emitBuffered(){this.receiveBuffer.forEach(e=>this.emitEvent(e)),this.receiveBuffer=[],this.sendBuffer.forEach(e=>{this.notifyOutgoingListeners(e),this.packet(e)}),this.sendBuffer=[]}ondisconnect(){this.destroy(),this.onclose(`io server disconnect`)}destroy(){this.subs&&=(this.subs.forEach(e=>e()),void 0),this.io._destroy(this)}disconnect(){return this.connected&&this.packet({type:BS.DISCONNECT}),this.destroy(),this.connected&&this.onclose(`io client disconnect`),this}close(){return this.disconnect()}compress(e){return this.flags.compress=e,this}get volatile(){return this.flags.volatile=!0,this}timeout(e){return this.flags.timeout=e,this}onAny(e){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(e),this}prependAny(e){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(e),this}offAny(e){if(!this._anyListeners)return this;if(e){let t=this._anyListeners;for(let n=0;n<t.length;n++)if(e===t[n])return t.splice(n,1),this}else this._anyListeners=[];return this}listenersAny(){return this._anyListeners||[]}onAnyOutgoing(e){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.push(e),this}prependAnyOutgoing(e){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.unshift(e),this}offAnyOutgoing(e){if(!this._anyOutgoingListeners)return this;if(e){let t=this._anyOutgoingListeners;for(let n=0;n<t.length;n++)if(e===t[n])return t.splice(n,1),this}else this._anyOutgoingListeners=[];return this}listenersAnyOutgoing(){return this._anyOutgoingListeners||[]}notifyOutgoingListeners(e){if(this._anyOutgoingListeners&&this._anyOutgoingListeners.length){let t=this._anyOutgoingListeners.slice();for(let n of t)n.apply(this,e.data)}}};function $S(e){e||={},this.ms=e.min||100,this.max=e.max||1e4,this.factor=e.factor||2,this.jitter=e.jitter>0&&e.jitter<=1?e.jitter:0,this.attempts=0}$S.prototype.duration=function(){var e=this.ms*this.factor**+this.attempts++;if(this.jitter){var t=Math.random(),n=Math.floor(t*this.jitter*e);e=Math.floor(t*10)&1?e+n:e-n}return Math.min(e,this.max)|0},$S.prototype.reset=function(){this.attempts=0},$S.prototype.setMin=function(e){this.ms=e},$S.prototype.setMax=function(e){this.max=e},$S.prototype.setJitter=function(e){this.jitter=e};var eC=class extends zx{constructor(e,t){super(),this.nsps={},this.subs=[],e&&typeof e==`object`&&(t=e,e=void 0),t||={},t.path=t.path||`/socket.io`,this.opts=t,qx(this,t),this.reconnection(t.reconnection!==!1),this.reconnectionAttempts(t.reconnectionAttempts||1/0),this.reconnectionDelay(t.reconnectionDelay||1e3),this.reconnectionDelayMax(t.reconnectionDelayMax||5e3),this.randomizationFactor(t.randomizationFactor??.5),this.backoff=new $S({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(t.timeout==null?2e4:t.timeout),this._readyState=`closed`,this.uri=e;let n=t.parser||RS;this.encoder=new n.Encoder,this.decoder=new n.Decoder,this._autoConnect=t.autoConnect!==!1,this._autoConnect&&this.open()}reconnection(e){return arguments.length?(this._reconnection=!!e,e||(this.skipReconnect=!0),this):this._reconnection}reconnectionAttempts(e){return e===void 0?this._reconnectionAttempts:(this._reconnectionAttempts=e,this)}reconnectionDelay(e){var t;return e===void 0?this._reconnectionDelay:(this._reconnectionDelay=e,(t=this.backoff)==null||t.setMin(e),this)}randomizationFactor(e){var t;return e===void 0?this._randomizationFactor:(this._randomizationFactor=e,(t=this.backoff)==null||t.setJitter(e),this)}reconnectionDelayMax(e){var t;return e===void 0?this._reconnectionDelayMax:(this._reconnectionDelayMax=e,(t=this.backoff)==null||t.setMax(e),this)}timeout(e){return arguments.length?(this._timeout=e,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&this.backoff.attempts===0&&this.reconnect()}open(e){if(~this._readyState.indexOf(`open`))return this;this.engine=new TS(this.uri,this.opts);let t=this.engine,n=this;this._readyState=`opening`,this.skipReconnect=!1;let r=XS(t,`open`,function(){n.onopen(),e&&e()}),i=t=>{this.cleanup(),this._readyState=`closed`,this.emitReserved(`error`,t),e?e(t):this.maybeReconnectOnOpen()},a=XS(t,`error`,i);if(!1!==this._timeout){let e=this._timeout,n=this.setTimeoutFn(()=>{r(),i(Error(`timeout`)),t.close()},e);this.opts.autoUnref&&n.unref(),this.subs.push(()=>{this.clearTimeoutFn(n)})}return this.subs.push(r),this.subs.push(a),this}connect(e){return this.open(e)}onopen(){this.cleanup(),this._readyState=`open`,this.emitReserved(`open`);let e=this.engine;this.subs.push(XS(e,`ping`,this.onping.bind(this)),XS(e,`data`,this.ondata.bind(this)),XS(e,`error`,this.onerror.bind(this)),XS(e,`close`,this.onclose.bind(this)),XS(this.decoder,`decoded`,this.ondecoded.bind(this)))}onping(){this.emitReserved(`ping`)}ondata(e){try{this.decoder.add(e)}catch(e){this.onclose(`parse error`,e)}}ondecoded(e){Vx(()=>{this.emitReserved(`packet`,e)},this.setTimeoutFn)}onerror(e){this.emitReserved(`error`,e)}socket(e,t){let n=this.nsps[e];return n?this._autoConnect&&!n.active&&n.connect():(n=new QS(this,e,t),this.nsps[e]=n),n}_destroy(e){let t=Object.keys(this.nsps);for(let e of t)if(this.nsps[e].active)return;this._close()}_packet(e){let t=this.encoder.encode(e);for(let n=0;n<t.length;n++)this.engine.write(t[n],e.options)}cleanup(){this.subs.forEach(e=>e()),this.subs.length=0,this.decoder.destroy()}_close(){this.skipReconnect=!0,this._reconnecting=!1,this.onclose(`forced close`)}disconnect(){return this._close()}onclose(e,t){var n;this.cleanup(),(n=this.engine)==null||n.close(),this.backoff.reset(),this._readyState=`closed`,this.emitReserved(`close`,e,t),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;let e=this;if(this.backoff.attempts>=this._reconnectionAttempts)this.backoff.reset(),this.emitReserved(`reconnect_failed`),this._reconnecting=!1;else{let t=this.backoff.duration();this._reconnecting=!0;let n=this.setTimeoutFn(()=>{e.skipReconnect||(this.emitReserved(`reconnect_attempt`,e.backoff.attempts),!e.skipReconnect&&e.open(t=>{t?(e._reconnecting=!1,e.reconnect(),this.emitReserved(`reconnect_error`,t)):e.onreconnect()}))},t);this.opts.autoUnref&&n.unref(),this.subs.push(()=>{this.clearTimeoutFn(n)})}}onreconnect(){let e=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved(`reconnect`,e)}},tC={};function nC(e,t){typeof e==`object`&&(t=e,e=void 0),t||={};let n=ES(e,t.path||`/socket.io`),r=n.source,i=n.id,a=n.path,o=tC[i]&&a in tC[i].nsps,s=t.forceNew||t[`force new connection`]||!1===t.multiplex||o,c;return s?c=new eC(r,t):(tC[i]||(tC[i]=new eC(r,t)),c=tC[i]),n.query&&!t.query&&(t.query=n.queryKey),c.socket(n.path,t)}Object.assign(nC,{Manager:eC,Socket:QS,io:nC,connect:nC});var rC=class extends Error{code;status;details;constructor(e,t,n,r){super(t),this.code=e,this.status=n,this.details=r}};async function iC(e,t={}){let n=await fetch(e,{...t,headers:{accept:`application/json`,...t.body?{"content-type":`application/json`}:{},...t.headers}}),r=await n.json().catch(()=>({}));if(!n.ok){let e=r.error;throw new rC(e?.code||`HTTP_ERROR`,e?.message||`HTTP ${n.status}`,n.status,e?.details)}return r}var aC={projects:async()=>(await iC(`/api/projects`)).projects,recentProjects:async()=>(await iC(`/api/projects/recent`)).projects,browseDirectories:async(e,t=!1)=>iC(`/api/filesystem/directories?${new URLSearchParams({input:e,...t?{hidden:`true`}:{}}).toString()}`),terminalPresets:async()=>(await iC(`/api/terminal-presets`)).presets,createTerminalPreset:async e=>(await iC(`/api/terminal-presets`,{method:`POST`,body:JSON.stringify(e)})).preset,updateTerminalPreset:async(e,t,n)=>(await iC(`/api/terminal-presets/${e}`,{method:`PATCH`,body:JSON.stringify({...t,expectedUpdatedAt:n})})).preset,deleteTerminalPreset:async(e,t)=>iC(`/api/terminal-presets/${e}`,{method:`DELETE`,body:JSON.stringify({expectedUpdatedAt:t})}),addProject:async e=>(await iC(`/api/projects`,{method:`POST`,body:JSON.stringify({path:e})})).project,openProject:async e=>(await iC(`/api/projects/${e}/open`,{method:`POST`})).project,closeProject:async e=>iC(`/api/projects/${e}/close`,{method:`POST`}),updateProjectColor:async(e,t)=>(await iC(`/api/projects/${e}`,{method:`PATCH`,body:JSON.stringify({color:t})})).project,createWorktree:async(e,t,n,r,i)=>iC(`/api/projects/${e}/worktrees`,{method:`POST`,body:JSON.stringify({name:t,base:n,initialTerminal:r,...i?{sourceWorktreeId:i}:{}})}),createTerminal:async(e,t,n,r=!1,i=!1,a)=>(await iC(`/api/worktrees/${e}/terminals`,{method:`POST`,body:JSON.stringify({name:t,...n?{argv:n}:{},...r?{returnToShell:!0}:{},...i?{closeOnSuccess:!0}:{},...a?{initialSize:a}:{}})})).terminal,renameTerminal:async(e,t)=>(await iC(`/api/terminals/${e}`,{method:`PATCH`,body:JSON.stringify({name:t})})).terminal,deleteTerminal:async e=>iC(`/api/terminals/${e}`,{method:`DELETE`}),acknowledgeTerminalBell:async(e,t)=>iC(`/api/terminals/${e}/bell/acknowledge`,{method:`POST`,body:JSON.stringify({sequence:t})}),uploadTerminalFile:async(e,t)=>{let n=/\.([a-z0-9]{1,16})$/i.exec(t.name)?.[1];return(await iC(`/api/terminals/${e}/files`,{method:`POST`,headers:{"content-type":t.type||`application/octet-stream`,...n?{"x-treeport-file-extension":n.toLowerCase()}:{}},body:t})).file.path},removePreview:async e=>(await iC(`/api/worktrees/${e}/remove-preview`)).preview,removeWorktree:async(e,t,n)=>(await iC(`/api/worktrees/${e}/remove`,{method:`POST`,body:JSON.stringify({confirmationToken:t.confirmationToken,confirmDestructive:n})})).operation},oC;function Q(e,t,n){function r(n,r){if(n._zod||Object.defineProperty(n,"_zod",{value:{def:r,constr:o,traits:new Set},enumerable:!1}),n._zod.traits.has(e))return;n._zod.traits.add(e),t(n,r);let i=o.prototype,a=Object.keys(i);for(let e=0;e<a.length;e++){let t=a[e];t in n||(n[t]=i[t].bind(n))}}let i=n?.Parent??Object;class a extends i{}Object.defineProperty(a,"name",{value:e});function o(e){var t;let i=n?.Parent?new a:this;r(i,e),(t=i._zod).deferred??(t.deferred=[]);for(let e of i._zod.deferred)e();return i}return Object.defineProperty(o,"init",{value:r}),Object.defineProperty(o,Symbol.hasInstance,{value:t=>n?.Parent&&t instanceof n.Parent?!0:t?._zod?.traits?.has(e)}),Object.defineProperty(o,"name",{value:e}),o}var sC=class extends Error{constructor(){super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`)}},cC=class extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name=`ZodEncodeError`}};(oC=globalThis).__zod_globalConfig??(oC.__zod_globalConfig={});var lC=globalThis.__zod_globalConfig;function uC(e){return e&&Object.assign(lC,e),lC}function dC(e){let t=Object.values(e).filter(e=>typeof e==`number`);return Object.entries(e).filter(([e,n])=>t.indexOf(+e)===-1).map(([e,t])=>t)}function fC(e,t){return typeof t==`bigint`?t.toString():t}function pC(e){return{get value(){{let t=e();return Object.defineProperty(this,"value",{value:t}),t}throw Error(`cached value already set`)}}}function mC(e){return e==null}function hC(e){let t=+!!e.startsWith(`^`),n=e.endsWith(`$`)?e.length-1:e.length;return e.slice(t,n)}function gC(e,t){let n=e/t,r=Math.round(n),i=2**-52*Math.max(Math.abs(n),1);return Math.abs(n-r)<i?0:n-r}var _C=Symbol(`evaluating`);function vC(e,t,n){let r;Object.defineProperty(e,t,{get(){if(r!==_C)return r===void 0&&(r=_C,r=n()),r},set(n){Object.defineProperty(e,t,{value:n})},configurable:!0})}function yC(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function bC(...e){let t={};for(let n of e){let e=Object.getOwnPropertyDescriptors(n);Object.assign(t,e)}return Object.defineProperties({},t)}function xC(e){return JSON.stringify(e)}function SC(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,``).replace(/[\s_-]+/g,`-`).replace(/^-+|-+$/g,``)}var CC=`captureStackTrace`in Error?Error.captureStackTrace:(...e)=>{};function wC(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}var TC=pC(()=>{if(lC.jitless||typeof navigator<`u`&&navigator?.userAgent?.includes(`Cloudflare`))return!1;try{return Function(``),!0}catch{return!1}});function EC(e){if(wC(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!=`function`)return!0;let n=t.prototype;return!(wC(n)===!1||Object.prototype.hasOwnProperty.call(n,`isPrototypeOf`)===!1)}function DC(e){return EC(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}var OC=new Set([`string`,`number`,`symbol`]);function kC(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function AC(e,t,n){let r=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(r._zod.parent=e),r}function $(e){let t=e;if(!t)return{};if(typeof t==`string`)return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error==`string`?{...t,error:()=>t.error}:t}function jC(e){return Object.keys(e).filter(t=>e[t]._zod.optin===`optional`&&e[t]._zod.optout===`optional`)}var MC={safeint:[-(2**53-1),2**53-1],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function NC(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.pick() cannot be used on object schemas containing refinements`);return AC(e,bC(e._zod.def,{get shape(){let e={};for(let r in t){if(!(r in n.shape))throw Error(`Unrecognized key: "${r}"`);t[r]&&(e[r]=n.shape[r])}return yC(this,`shape`,e),e},checks:[]}))}function PC(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.omit() cannot be used on object schemas containing refinements`);return AC(e,bC(e._zod.def,{get shape(){let r={...e._zod.def.shape};for(let e in t){if(!(e in n.shape))throw Error(`Unrecognized key: "${e}"`);t[e]&&delete r[e]}return yC(this,`shape`,r),r},checks:[]}))}function FC(e,t){if(!EC(t))throw Error(`Invalid input to extend: expected a plain object`);let n=e._zod.def.checks;if(n&&n.length>0){let n=e._zod.def.shape;for(let e in t)if(Object.getOwnPropertyDescriptor(n,e)!==void 0)throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return AC(e,bC(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return yC(this,`shape`,n),n}}))}function IC(e,t){if(!EC(t))throw Error(`Invalid input to safeExtend: expected a plain object`);return AC(e,bC(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return yC(this,`shape`,n),n}}))}function LC(e,t){if(e._zod.def.checks?.length)throw Error(`.merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.`);return AC(e,bC(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t._zod.def.shape};return yC(this,`shape`,n),n},get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]}))}function RC(e,t,n){let r=t._zod.def.checks;if(r&&r.length>0)throw Error(`.partial() cannot be used on object schemas containing refinements`);return AC(t,bC(t._zod.def,{get shape(){let r=t._zod.def.shape,i={...r};if(n)for(let t in n){if(!(t in r))throw Error(`Unrecognized key: "${t}"`);n[t]&&(i[t]=e?new e({type:`optional`,innerType:r[t]}):r[t])}else for(let t in r)i[t]=e?new e({type:`optional`,innerType:r[t]}):r[t];return yC(this,`shape`,i),i},checks:[]}))}function zC(e,t,n){return AC(t,bC(t._zod.def,{get shape(){let r=t._zod.def.shape,i={...r};if(n)for(let t in n){if(!(t in i))throw Error(`Unrecognized key: "${t}"`);n[t]&&(i[t]=new e({type:`nonoptional`,innerType:r[t]}))}else for(let t in r)i[t]=new e({type:`nonoptional`,innerType:r[t]});return yC(this,`shape`,i),i}}))}function BC(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue!==!0)return!0;return!1}function VC(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue===!1)return!0;return!1}function HC(e,t){return t.map(t=>{var n;return(n=t).path??(n.path=[]),t.path.unshift(e),t})}function UC(e){return typeof e==`string`?e:e?.message}function WC(e,t,n){let r=e.message?e.message:UC(e.inst?._zod.def?.error?.(e))??UC(t?.error?.(e))??UC(n.customError?.(e))??UC(n.localeError?.(e))??`Invalid input`,{inst:i,continue:a,input:o,...s}=e;return s.path??=[],s.message=r,t?.reportInput&&(s.input=o),s}function GC(e){return Array.isArray(e)?`array`:typeof e==`string`?`string`:`unknown`}function KC(...e){let[t,n,r]=e;return typeof t==`string`?{message:t,code:`custom`,input:n,inst:r}:{...t}}var qC=(e,t)=>{e.name=`$ZodError`,Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,fC,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},JC=Q(`$ZodError`,qC),YC=Q(`$ZodError`,qC,{Parent:Error});function XC(e,t=e=>e.message){let n={},r=[];for(let i of e.issues)i.path.length>0?(n[i.path[0]]=n[i.path[0]]||[],n[i.path[0]].push(t(i))):r.push(t(i));return{formErrors:r,fieldErrors:n}}function ZC(e,t=e=>e.message){let n={_errors:[]},r=(e,i=[])=>{for(let a of e.issues)if(a.code===`invalid_union`&&a.errors.length)a.errors.map(e=>r({issues:e},[...i,...a.path]));else if(a.code===`invalid_key`)r({issues:a.issues},[...i,...a.path]);else if(a.code===`invalid_element`)r({issues:a.issues},[...i,...a.path]);else{let e=[...i,...a.path];if(e.length===0)n._errors.push(t(a));else{let r=n,i=0;for(;i<e.length;){let n=e[i];i===e.length-1?(r[n]=r[n]||{_errors:[]},r[n]._errors.push(t(a))):r[n]=r[n]||{_errors:[]},r=r[n],i++}}}};return r(e),n}var QC=e=>(t,n,r,i)=>{let a=r?{...r,async:!1}:{async:!1},o=t._zod.run({value:n,issues:[]},a);if(o instanceof Promise)throw new sC;if(o.issues.length){let t=new((i?.Err)??e)(o.issues.map(e=>WC(e,a,uC())));throw CC(t,i?.callee),t}return o.value},$C=e=>async(t,n,r,i)=>{let a=r?{...r,async:!0}:{async:!0},o=t._zod.run({value:n,issues:[]},a);if(o instanceof Promise&&(o=await o),o.issues.length){let t=new((i?.Err)??e)(o.issues.map(e=>WC(e,a,uC())));throw CC(t,i?.callee),t}return o.value},ew=e=>(t,n,r)=>{let i=r?{...r,async:!1}:{async:!1},a=t._zod.run({value:n,issues:[]},i);if(a instanceof Promise)throw new sC;return a.issues.length?{success:!1,error:new(e??JC)(a.issues.map(e=>WC(e,i,uC())))}:{success:!0,data:a.value}},tw=ew(YC),nw=e=>async(t,n,r)=>{let i=r?{...r,async:!0}:{async:!0},a=t._zod.run({value:n,issues:[]},i);return a instanceof Promise&&(a=await a),a.issues.length?{success:!1,error:new e(a.issues.map(e=>WC(e,i,uC())))}:{success:!0,data:a.value}},rw=nw(YC),iw=e=>(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return QC(e)(t,n,i)},aw=e=>(t,n,r)=>QC(e)(t,n,r),ow=e=>async(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return $C(e)(t,n,i)},sw=e=>async(t,n,r)=>$C(e)(t,n,r),cw=e=>(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return ew(e)(t,n,i)},lw=e=>(t,n,r)=>ew(e)(t,n,r),uw=e=>async(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return nw(e)(t,n,i)},dw=e=>async(t,n,r)=>nw(e)(t,n,r),fw=/^[cC][0-9a-z]{6,}$/,pw=/^[0-9a-z]+$/,mw=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,hw=/^[0-9a-vA-V]{20}$/,gw=/^[A-Za-z0-9]{27}$/,_w=/^[a-zA-Z0-9_-]{21}$/,vw=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,yw=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,bw=e=>e?RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,xw=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,Sw=`^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`;function Cw(){return new RegExp(Sw,`u`)}var ww=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,Tw=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,Ew=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,Dw=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Ow=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,kw=/^[A-Za-z0-9_-]*$/,Aw=/^https?$/,jw=/^\+[1-9]\d{6,14}$/,Mw=`(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))`,Nw=RegExp(`^${Mw}$`);function Pw(e){let t=`(?:[01]\\d|2[0-3]):[0-5]\\d`;return typeof e.precision==`number`?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function Fw(e){return RegExp(`^${Pw(e)}$`)}function Iw(e){let t=Pw({precision:e.precision}),n=[`Z`];e.local&&n.push(``),e.offset&&n.push(`([+-](?:[01]\\d|2[0-3]):[0-5]\\d)`);let r=`${t}(?:${n.join(`|`)})`;return RegExp(`^${Mw}T(?:${r})$`)}var Lw=e=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??``}}`:`[\\s\\S]*`;return RegExp(`^${t}$`)},Rw=/^-?\d+$/,zw=/^-?\d+(?:\.\d+)?$/,Bw=/^(?:true|false)$/i,Vw=/^[^A-Z]*$/,Hw=/^[^a-z]*$/,Uw=Q(`$ZodCheck`,(e,t)=>{var n;e._zod??={},e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),Ww={number:`number`,bigint:`bigint`,object:`date`},Gw=Q(`$ZodCheckLessThan`,(e,t)=>{Uw.init(e,t);let n=Ww[typeof t.value];e._zod.onattach.push(e=>{let n=e._zod.bag,r=(t.inclusive?n.maximum:n.exclusiveMaximum)??1/0;t.value<r&&(t.inclusive?n.maximum=t.value:n.exclusiveMaximum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value<=t.value:r.value<t.value)||r.issues.push({origin:n,code:`too_big`,maximum:typeof t.value==`object`?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Kw=Q(`$ZodCheckGreaterThan`,(e,t)=>{Uw.init(e,t);let n=Ww[typeof t.value];e._zod.onattach.push(e=>{let n=e._zod.bag,r=(t.inclusive?n.minimum:n.exclusiveMinimum)??-1/0;t.value>r&&(t.inclusive?n.minimum=t.value:n.exclusiveMinimum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value>=t.value:r.value>t.value)||r.issues.push({origin:n,code:`too_small`,minimum:typeof t.value==`object`?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),qw=Q(`$ZodCheckMultipleOf`,(e,t)=>{Uw.init(e,t),e._zod.onattach.push(e=>{var n;(n=e._zod.bag).multipleOf??(n.multipleOf=t.value)}),e._zod.check=n=>{if(typeof n.value!=typeof t.value)throw Error(`Cannot mix number and bigint in multiple_of check.`);(typeof n.value==`bigint`?n.value%t.value===BigInt(0):gC(n.value,t.value)===0)||n.issues.push({origin:typeof n.value,code:`not_multiple_of`,divisor:t.value,input:n.value,inst:e,continue:!t.abort})}}),Jw=Q(`$ZodCheckNumberFormat`,(e,t)=>{Uw.init(e,t),t.format=t.format||`float64`;let n=t.format?.includes(`int`),r=n?`int`:`number`,[i,a]=MC[t.format];e._zod.onattach.push(e=>{let r=e._zod.bag;r.format=t.format,r.minimum=i,r.maximum=a,n&&(r.pattern=Rw)}),e._zod.check=o=>{let s=o.value;if(n){if(!Number.isInteger(s)){o.issues.push({expected:r,format:t.format,code:`invalid_type`,continue:!1,input:s,inst:e});return}if(!Number.isSafeInteger(s)){s>0?o.issues.push({input:s,code:`too_big`,maximum:2**53-1,note:`Integers must be within the safe integer range.`,inst:e,origin:r,inclusive:!0,continue:!t.abort}):o.issues.push({input:s,code:`too_small`,minimum:-(2**53-1),note:`Integers must be within the safe integer range.`,inst:e,origin:r,inclusive:!0,continue:!t.abort});return}}s<i&&o.issues.push({origin:`number`,input:s,code:`too_small`,minimum:i,inclusive:!0,inst:e,continue:!t.abort}),s>a&&o.issues.push({origin:`number`,input:s,code:`too_big`,maximum:a,inclusive:!0,inst:e,continue:!t.abort})}}),Yw=Q(`$ZodCheckMaxLength`,(e,t)=>{var n;Uw.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!mC(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag.maximum??1/0;t.maximum<n&&(e._zod.bag.maximum=t.maximum)}),e._zod.check=n=>{let r=n.value;if(r.length<=t.maximum)return;let i=GC(r);n.issues.push({origin:i,code:`too_big`,maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),Xw=Q(`$ZodCheckMinLength`,(e,t)=>{var n;Uw.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!mC(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag.minimum??-1/0;t.minimum>n&&(e._zod.bag.minimum=t.minimum)}),e._zod.check=n=>{let r=n.value;if(r.length>=t.minimum)return;let i=GC(r);n.issues.push({origin:i,code:`too_small`,minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),Zw=Q(`$ZodCheckLengthEquals`,(e,t)=>{var n;Uw.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!mC(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag;n.minimum=t.length,n.maximum=t.length,n.length=t.length}),e._zod.check=n=>{let r=n.value,i=r.length;if(i===t.length)return;let a=GC(r),o=i>t.length;n.issues.push({origin:a,...o?{code:`too_big`,maximum:t.length}:{code:`too_small`,minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),Qw=Q(`$ZodCheckStringFormat`,(e,t)=>{var n,r;Uw.init(e,t),e._zod.onattach.push(e=>{let n=e._zod.bag;n.format=t.format,t.pattern&&(n.patterns??=new Set,n.patterns.add(t.pattern))}),t.pattern?(n=e._zod).check??(n.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:t.format,input:n.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(r=e._zod).check??(r.check=()=>{})}),$w=Q(`$ZodCheckRegex`,(e,t)=>{Qw.init(e,t),e._zod.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:`regex`,input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),eT=Q(`$ZodCheckLowerCase`,(e,t)=>{t.pattern??=Vw,Qw.init(e,t)}),tT=Q(`$ZodCheckUpperCase`,(e,t)=>{t.pattern??=Hw,Qw.init(e,t)}),nT=Q(`$ZodCheckIncludes`,(e,t)=>{Uw.init(e,t);let n=kC(t.includes),r=new RegExp(typeof t.position==`number`?`^.{${t.position}}${n}`:n);t.pattern=r,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(r)}),e._zod.check=n=>{n.value.includes(t.includes,t.position)||n.issues.push({origin:`string`,code:`invalid_format`,format:`includes`,includes:t.includes,input:n.value,inst:e,continue:!t.abort})}}),rT=Q(`$ZodCheckStartsWith`,(e,t)=>{Uw.init(e,t);let n=RegExp(`^${kC(t.prefix)}.*`);t.pattern??=n,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(n)}),e._zod.check=n=>{n.value.startsWith(t.prefix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`starts_with`,prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}}),iT=Q(`$ZodCheckEndsWith`,(e,t)=>{Uw.init(e,t);let n=RegExp(`.*${kC(t.suffix)}$`);t.pattern??=n,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(n)}),e._zod.check=n=>{n.value.endsWith(t.suffix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`ends_with`,suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}}),aT=Q(`$ZodCheckOverwrite`,(e,t)=>{Uw.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}}),oT=class{constructor(e=[]){this.content=[],this.indent=0,this&&(this.args=e)}indented(e){this.indent+=1,e(this),--this.indent}write(e){if(typeof e==`function`){e(this,{execution:`sync`}),e(this,{execution:`async`});return}let t=e.split(`
44
+ `).filter(e=>e),n=Math.min(...t.map(e=>e.length-e.trimStart().length)),r=t.map(e=>e.slice(n)).map(e=>` `.repeat(this.indent*2)+e);for(let e of r)this.content.push(e)}compile(){let e=Function,t=this?.args,n=[...(this?.content??[``]).map(e=>` ${e}`)];return new e(...t,n.join(`
45
+ `))}},sT={major:4,minor:4,patch:3},cT=Q(`$ZodType`,(e,t)=>{var n;e??={},e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=sT;let r=[...e._zod.def.checks??[]];e._zod.traits.has(`$ZodCheck`)&&r.unshift(e);for(let t of r)for(let n of t._zod.onattach)n(e);if(r.length===0)(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let t=(e,t,n)=>{let r=BC(e),i;for(let a of t){if(a._zod.def.when){if(VC(e)||!a._zod.def.when(e))continue}else if(r)continue;let t=e.issues.length,o=a._zod.check(e);if(o instanceof Promise&&n?.async===!1)throw new sC;if(i||o instanceof Promise)i=(i??Promise.resolve()).then(async()=>{await o,e.issues.length!==t&&(r||=BC(e,t))});else{if(e.issues.length===t)continue;r||=BC(e,t)}}return i?i.then(()=>e):e},n=(n,i,a)=>{if(BC(n))return n.aborted=!0,n;let o=t(i,r,a);if(o instanceof Promise){if(a.async===!1)throw new sC;return o.then(t=>e._zod.parse(t,a))}return e._zod.parse(o,a)};e._zod.run=(i,a)=>{if(a.skipChecks)return e._zod.parse(i,a);if(a.direction===`backward`){let t=e._zod.parse({value:i.value,issues:[]},{...a,skipChecks:!0});return t instanceof Promise?t.then(e=>n(e,i,a)):n(t,i,a)}let o=e._zod.parse(i,a);if(o instanceof Promise){if(a.async===!1)throw new sC;return o.then(e=>t(e,r,a))}return t(o,r,a)}}vC(e,`~standard`,()=>({validate:t=>{try{let n=tw(e,t);return n.success?{value:n.data}:{issues:n.error?.issues}}catch{return rw(e,t).then(e=>e.success?{value:e.data}:{issues:e.error?.issues})}},vendor:`zod`,version:1}))}),lT=Q(`$ZodString`,(e,t)=>{cT.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??Lw(e._zod.bag),e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=String(n.value)}catch{}return typeof n.value==`string`||n.issues.push({expected:`string`,code:`invalid_type`,input:n.value,inst:e}),n}}),uT=Q(`$ZodStringFormat`,(e,t)=>{Qw.init(e,t),lT.init(e,t)}),dT=Q(`$ZodGUID`,(e,t)=>{t.pattern??=yw,uT.init(e,t)}),fT=Q(`$ZodUUID`,(e,t)=>{if(t.version){let e={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(e===void 0)throw Error(`Invalid UUID version: "${t.version}"`);t.pattern??=bw(e)}else t.pattern??=bw();uT.init(e,t)}),pT=Q(`$ZodEmail`,(e,t)=>{t.pattern??=xw,uT.init(e,t)}),mT=Q(`$ZodURL`,(e,t)=>{uT.init(e,t),e._zod.check=n=>{try{let r=n.value.trim();if(!t.normalize&&t.protocol?.source===Aw.source&&!/^https?:\/\//i.test(r)){n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid URL format`,input:n.value,inst:e,continue:!t.abort});return}let i=new URL(r);t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(i.hostname)||n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid hostname`,pattern:t.hostname.source,input:n.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(i.protocol.endsWith(`:`)?i.protocol.slice(0,-1):i.protocol)||n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid protocol`,pattern:t.protocol.source,input:n.value,inst:e,continue:!t.abort})),t.normalize?n.value=i.href:n.value=r;return}catch{n.issues.push({code:`invalid_format`,format:`url`,input:n.value,inst:e,continue:!t.abort})}}}),hT=Q(`$ZodEmoji`,(e,t)=>{t.pattern??=Cw(),uT.init(e,t)}),gT=Q(`$ZodNanoID`,(e,t)=>{t.pattern??=_w,uT.init(e,t)}),_T=Q(`$ZodCUID`,(e,t)=>{t.pattern??=fw,uT.init(e,t)}),vT=Q(`$ZodCUID2`,(e,t)=>{t.pattern??=pw,uT.init(e,t)}),yT=Q(`$ZodULID`,(e,t)=>{t.pattern??=mw,uT.init(e,t)}),bT=Q(`$ZodXID`,(e,t)=>{t.pattern??=hw,uT.init(e,t)}),xT=Q(`$ZodKSUID`,(e,t)=>{t.pattern??=gw,uT.init(e,t)}),ST=Q(`$ZodISODateTime`,(e,t)=>{t.pattern??=Iw(t),uT.init(e,t)}),CT=Q(`$ZodISODate`,(e,t)=>{t.pattern??=Nw,uT.init(e,t)}),wT=Q(`$ZodISOTime`,(e,t)=>{t.pattern??=Fw(t),uT.init(e,t)}),TT=Q(`$ZodISODuration`,(e,t)=>{t.pattern??=vw,uT.init(e,t)}),ET=Q(`$ZodIPv4`,(e,t)=>{t.pattern??=ww,uT.init(e,t),e._zod.bag.format=`ipv4`}),DT=Q(`$ZodIPv6`,(e,t)=>{t.pattern??=Tw,uT.init(e,t),e._zod.bag.format=`ipv6`,e._zod.check=n=>{try{new URL(`http://[${n.value}]`)}catch{n.issues.push({code:`invalid_format`,format:`ipv6`,input:n.value,inst:e,continue:!t.abort})}}}),OT=Q(`$ZodCIDRv4`,(e,t)=>{t.pattern??=Ew,uT.init(e,t)}),kT=Q(`$ZodCIDRv6`,(e,t)=>{t.pattern??=Dw,uT.init(e,t),e._zod.check=n=>{let r=n.value.split(`/`);try{if(r.length!==2)throw Error();let[e,t]=r;if(!t)throw Error();let n=Number(t);if(`${n}`!==t||n<0||n>128)throw Error();new URL(`http://[${e}]`)}catch{n.issues.push({code:`invalid_format`,format:`cidrv6`,input:n.value,inst:e,continue:!t.abort})}}});function AT(e){if(e===``)return!0;if(/\s/.test(e)||e.length%4!=0)return!1;try{return atob(e),!0}catch{return!1}}var jT=Q(`$ZodBase64`,(e,t)=>{t.pattern??=Ow,uT.init(e,t),e._zod.bag.contentEncoding=`base64`,e._zod.check=n=>{AT(n.value)||n.issues.push({code:`invalid_format`,format:`base64`,input:n.value,inst:e,continue:!t.abort})}});function MT(e){if(!kw.test(e))return!1;let t=e.replace(/[-_]/g,e=>e===`-`?`+`:`/`);return AT(t.padEnd(Math.ceil(t.length/4)*4,`=`))}var NT=Q(`$ZodBase64URL`,(e,t)=>{t.pattern??=kw,uT.init(e,t),e._zod.bag.contentEncoding=`base64url`,e._zod.check=n=>{MT(n.value)||n.issues.push({code:`invalid_format`,format:`base64url`,input:n.value,inst:e,continue:!t.abort})}}),PT=Q(`$ZodE164`,(e,t)=>{t.pattern??=jw,uT.init(e,t)});function FT(e,t=null){try{let n=e.split(`.`);if(n.length!==3)return!1;let[r]=n;if(!r)return!1;let i=JSON.parse(atob(r));return!(`typ`in i&&i?.typ!==`JWT`||!i.alg||t&&(!(`alg`in i)||i.alg!==t))}catch{return!1}}var IT=Q(`$ZodJWT`,(e,t)=>{uT.init(e,t),e._zod.check=n=>{FT(n.value,t.alg)||n.issues.push({code:`invalid_format`,format:`jwt`,input:n.value,inst:e,continue:!t.abort})}}),LT=Q(`$ZodNumber`,(e,t)=>{cT.init(e,t),e._zod.pattern=e._zod.bag.pattern??zw,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=Number(n.value)}catch{}let i=n.value;if(typeof i==`number`&&!Number.isNaN(i)&&Number.isFinite(i))return n;let a=typeof i==`number`?Number.isNaN(i)?`NaN`:Number.isFinite(i)?void 0:`Infinity`:void 0;return n.issues.push({expected:`number`,code:`invalid_type`,input:i,inst:e,...a?{received:a}:{}}),n}}),RT=Q(`$ZodNumberFormat`,(e,t)=>{Jw.init(e,t),LT.init(e,t)}),zT=Q(`$ZodBoolean`,(e,t)=>{cT.init(e,t),e._zod.pattern=Bw,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=!!n.value}catch{}let i=n.value;return typeof i==`boolean`||n.issues.push({expected:`boolean`,code:`invalid_type`,input:i,inst:e}),n}}),BT=Q(`$ZodUnknown`,(e,t)=>{cT.init(e,t),e._zod.parse=e=>e}),VT=Q(`$ZodNever`,(e,t)=>{cT.init(e,t),e._zod.parse=(t,n)=>(t.issues.push({expected:`never`,code:`invalid_type`,input:t.value,inst:e}),t)});function HT(e,t,n){e.issues.length&&t.issues.push(...HC(n,e.issues)),t.value[n]=e.value}var UT=Q(`$ZodArray`,(e,t)=>{cT.init(e,t),e._zod.parse=(n,r)=>{let i=n.value;if(!Array.isArray(i))return n.issues.push({expected:`array`,code:`invalid_type`,input:i,inst:e}),n;n.value=Array(i.length);let a=[];for(let e=0;e<i.length;e++){let o=i[e],s=t.element._zod.run({value:o,issues:[]},r);s instanceof Promise?a.push(s.then(t=>HT(t,n,e))):HT(s,n,e)}return a.length?Promise.all(a).then(()=>n):n}});function WT(e,t,n,r,i,a){let o=n in r;if(e.issues.length){if(i&&a&&!o)return;t.issues.push(...HC(n,e.issues))}if(!o&&!i){e.issues.length||t.issues.push({code:`invalid_type`,expected:`nonoptional`,input:void 0,path:[n]});return}e.value===void 0?o&&(t.value[n]=void 0):t.value[n]=e.value}function GT(e){let t=Object.keys(e.shape);for(let n of t)if(!e.shape?.[n]?._zod?.traits?.has(`$ZodType`))throw Error(`Invalid element at key "${n}": expected a Zod schema`);let n=jC(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(n)}}function KT(e,t,n,r,i,a){let o=[],s=i.keySet,c=i.catchall._zod,l=c.def.type,u=c.optin===`optional`,d=c.optout===`optional`;for(let i in t){if(i===`__proto__`||s.has(i))continue;if(l===`never`){o.push(i);continue}let a=c.run({value:t[i],issues:[]},r);a instanceof Promise?e.push(a.then(e=>WT(e,n,i,t,u,d))):WT(a,n,i,t,u,d)}return o.length&&n.issues.push({code:`unrecognized_keys`,keys:o,input:t,inst:a}),e.length?Promise.all(e).then(()=>n):n}var qT=Q(`$ZodObject`,(e,t)=>{if(cT.init(e,t),!Object.getOwnPropertyDescriptor(t,`shape`)?.get){let e=t.shape;Object.defineProperty(t,"shape",{get:()=>{let n={...e};return Object.defineProperty(t,"shape",{value:n}),n}})}let n=pC(()=>GT(t));vC(e._zod,`propValues`,()=>{let e=t.shape,n={};for(let t in e){let r=e[t]._zod;if(r.values){n[t]??(n[t]=new Set);for(let e of r.values)n[t].add(e)}}return n});let r=wC,i=t.catchall,a;e._zod.parse=(t,o)=>{a??=n.value;let s=t.value;if(!r(s))return t.issues.push({expected:`object`,code:`invalid_type`,input:s,inst:e}),t;t.value={};let c=[],l=a.shape;for(let e of a.keys){let n=l[e],r=n._zod.optin===`optional`,i=n._zod.optout===`optional`,a=n._zod.run({value:s[e],issues:[]},o);a instanceof Promise?c.push(a.then(n=>WT(n,t,e,s,r,i))):WT(a,t,e,s,r,i)}return i?KT(c,s,t,o,n.value,e):c.length?Promise.all(c).then(()=>t):t}}),JT=Q(`$ZodObjectJIT`,(e,t)=>{qT.init(e,t);let n=e._zod.parse,r=pC(()=>GT(t)),i=e=>{let t=new oT([`shape`,`payload`,`ctx`]),n=r.value,i=e=>{let t=xC(e);return`shape[${t}]._zod.run({ value: input[${t}], issues: [] }, ctx)`};t.write(`const input = payload.value;`);let a=Object.create(null),o=0;for(let e of n.keys)a[e]=`key_${o++}`;t.write(`const newResult = {};`);for(let r of n.keys){let n=a[r],o=xC(r),s=e[r],c=s?._zod?.optin===`optional`,l=s?._zod?.optout===`optional`;t.write(`const ${n} = ${i(r)};`),c&&l?t.write(`
46
+ if (${n}.issues.length) {
47
+ if (${o} in input) {
48
+ payload.issues = payload.issues.concat(${n}.issues.map(iss => ({
49
+ ...iss,
50
+ path: iss.path ? [${o}, ...iss.path] : [${o}]
51
+ })));
52
+ }
53
+ }
54
+
55
+ if (${n}.value === undefined) {
56
+ if (${o} in input) {
57
+ newResult[${o}] = undefined;
58
+ }
59
+ } else {
60
+ newResult[${o}] = ${n}.value;
61
+ }
62
+
63
+ `):c?t.write(`
64
+ if (${n}.issues.length) {
65
+ payload.issues = payload.issues.concat(${n}.issues.map(iss => ({
66
+ ...iss,
67
+ path: iss.path ? [${o}, ...iss.path] : [${o}]
68
+ })));
69
+ }
70
+
71
+ if (${n}.value === undefined) {
72
+ if (${o} in input) {
73
+ newResult[${o}] = undefined;
74
+ }
75
+ } else {
76
+ newResult[${o}] = ${n}.value;
77
+ }
78
+
79
+ `):t.write(`
80
+ const ${n}_present = ${o} in input;
81
+ if (${n}.issues.length) {
82
+ payload.issues = payload.issues.concat(${n}.issues.map(iss => ({
83
+ ...iss,
84
+ path: iss.path ? [${o}, ...iss.path] : [${o}]
85
+ })));
86
+ }
87
+ if (!${n}_present && !${n}.issues.length) {
88
+ payload.issues.push({
89
+ code: "invalid_type",
90
+ expected: "nonoptional",
91
+ input: undefined,
92
+ path: [${o}]
93
+ });
94
+ }
95
+
96
+ if (${n}_present) {
97
+ if (${n}.value === undefined) {
98
+ newResult[${o}] = undefined;
99
+ } else {
100
+ newResult[${o}] = ${n}.value;
101
+ }
102
+ }
103
+
104
+ `)}t.write(`payload.value = newResult;`),t.write(`return payload;`);let s=t.compile();return(t,n)=>s(e,t,n)},a,o=wC,s=!lC.jitless,c=s&&TC.value,l=t.catchall,u;e._zod.parse=(d,f)=>{u??=r.value;let p=d.value;return o(p)?s&&c&&f?.async===!1&&f.jitless!==!0?(a||=i(t.shape),d=a(d,f),l?KT([],p,d,f,u,e):d):n(d,f):(d.issues.push({expected:`object`,code:`invalid_type`,input:p,inst:e}),d)}});function YT(e,t,n,r){for(let n of e)if(n.issues.length===0)return t.value=n.value,t;let i=e.filter(e=>!BC(e));return i.length===1?(t.value=i[0].value,i[0]):(t.issues.push({code:`invalid_union`,input:t.value,inst:n,errors:e.map(e=>e.issues.map(e=>WC(e,r,uC())))}),t)}var XT=Q(`$ZodUnion`,(e,t)=>{cT.init(e,t),vC(e._zod,`optin`,()=>t.options.some(e=>e._zod.optin===`optional`)?`optional`:void 0),vC(e._zod,`optout`,()=>t.options.some(e=>e._zod.optout===`optional`)?`optional`:void 0),vC(e._zod,`values`,()=>{if(t.options.every(e=>e._zod.values))return new Set(t.options.flatMap(e=>Array.from(e._zod.values)))}),vC(e._zod,`pattern`,()=>{if(t.options.every(e=>e._zod.pattern)){let e=t.options.map(e=>e._zod.pattern);return RegExp(`^(${e.map(e=>hC(e.source)).join(`|`)})$`)}});let n=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(r,i)=>{if(n)return n(r,i);let a=!1,o=[];for(let e of t.options){let t=e._zod.run({value:r.value,issues:[]},i);if(t instanceof Promise)o.push(t),a=!0;else{if(t.issues.length===0)return t;o.push(t)}}return a?Promise.all(o).then(t=>YT(t,r,e,i)):YT(o,r,e,i)}}),ZT=Q(`$ZodIntersection`,(e,t)=>{cT.init(e,t),e._zod.parse=(e,n)=>{let r=e.value,i=t.left._zod.run({value:r,issues:[]},n),a=t.right._zod.run({value:r,issues:[]},n);return i instanceof Promise||a instanceof Promise?Promise.all([i,a]).then(([t,n])=>$T(e,t,n)):$T(e,i,a)}});function QT(e,t){if(e===t||e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(EC(e)&&EC(t)){let n=Object.keys(t),r=Object.keys(e).filter(e=>n.indexOf(e)!==-1),i={...e,...t};for(let n of r){let r=QT(e[n],t[n]);if(!r.valid)return{valid:!1,mergeErrorPath:[n,...r.mergeErrorPath]};i[n]=r.data}return{valid:!0,data:i}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};let n=[];for(let r=0;r<e.length;r++){let i=e[r],a=t[r],o=QT(i,a);if(!o.valid)return{valid:!1,mergeErrorPath:[r,...o.mergeErrorPath]};n.push(o.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function $T(e,t,n){let r=new Map,i;for(let n of t.issues)if(n.code===`unrecognized_keys`){i??=n;for(let e of n.keys)r.has(e)||r.set(e,{}),r.get(e).l=!0}else e.issues.push(n);for(let t of n.issues)if(t.code===`unrecognized_keys`)for(let e of t.keys)r.has(e)||r.set(e,{}),r.get(e).r=!0;else e.issues.push(t);let a=[...r].filter(([,e])=>e.l&&e.r).map(([e])=>e);if(a.length&&i&&e.issues.push({...i,keys:a}),BC(e))return e;let o=QT(t.value,n.value);if(!o.valid)throw Error(`Unmergable intersection. Error path: ${JSON.stringify(o.mergeErrorPath)}`);return e.value=o.data,e}var eE=Q(`$ZodRecord`,(e,t)=>{cT.init(e,t),e._zod.parse=(n,r)=>{let i=n.value;if(!EC(i))return n.issues.push({expected:`record`,code:`invalid_type`,input:i,inst:e}),n;let a=[],o=t.keyType._zod.values;if(o){n.value={};let s=new Set;for(let c of o)if(typeof c==`string`||typeof c==`number`||typeof c==`symbol`){s.add(typeof c==`number`?c.toString():c);let o=t.keyType._zod.run({value:c,issues:[]},r);if(o instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);if(o.issues.length){n.issues.push({code:`invalid_key`,origin:`record`,issues:o.issues.map(e=>WC(e,r,uC())),input:c,path:[c],inst:e});continue}let l=o.value,u=t.valueType._zod.run({value:i[c],issues:[]},r);u instanceof Promise?a.push(u.then(e=>{e.issues.length&&n.issues.push(...HC(c,e.issues)),n.value[l]=e.value})):(u.issues.length&&n.issues.push(...HC(c,u.issues)),n.value[l]=u.value)}let c;for(let e in i)s.has(e)||(c??=[],c.push(e));c&&c.length>0&&n.issues.push({code:`unrecognized_keys`,input:i,inst:e,keys:c})}else{n.value={};for(let o of Reflect.ownKeys(i)){if(o===`__proto__`||!Object.prototype.propertyIsEnumerable.call(i,o))continue;let s=t.keyType._zod.run({value:o,issues:[]},r);if(s instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);if(typeof o==`string`&&zw.test(o)&&s.issues.length){let e=t.keyType._zod.run({value:Number(o),issues:[]},r);if(e instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);e.issues.length===0&&(s=e)}if(s.issues.length){t.mode===`loose`?n.value[o]=i[o]:n.issues.push({code:`invalid_key`,origin:`record`,issues:s.issues.map(e=>WC(e,r,uC())),input:o,path:[o],inst:e});continue}let c=t.valueType._zod.run({value:i[o],issues:[]},r);c instanceof Promise?a.push(c.then(e=>{e.issues.length&&n.issues.push(...HC(o,e.issues)),n.value[s.value]=e.value})):(c.issues.length&&n.issues.push(...HC(o,c.issues)),n.value[s.value]=c.value)}}return a.length?Promise.all(a).then(()=>n):n}}),tE=Q(`$ZodEnum`,(e,t)=>{cT.init(e,t);let n=dC(t.entries),r=new Set(n);e._zod.values=r,e._zod.pattern=RegExp(`^(${n.filter(e=>OC.has(typeof e)).map(e=>typeof e==`string`?kC(e):e.toString()).join(`|`)})$`),e._zod.parse=(t,i)=>{let a=t.value;return r.has(a)||t.issues.push({code:`invalid_value`,values:n,input:a,inst:e}),t}}),nE=Q(`$ZodLiteral`,(e,t)=>{if(cT.init(e,t),t.values.length===0)throw Error(`Cannot create literal schema with no valid values`);let n=new Set(t.values);e._zod.values=n,e._zod.pattern=RegExp(`^(${t.values.map(e=>typeof e==`string`?kC(e):e?kC(e.toString()):String(e)).join(`|`)})$`),e._zod.parse=(r,i)=>{let a=r.value;return n.has(a)||r.issues.push({code:`invalid_value`,values:t.values,input:a,inst:e}),r}}),rE=Q(`$ZodTransform`,(e,t)=>{cT.init(e,t),e._zod.optin=`optional`,e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new cC(e.constructor.name);let i=t.transform(n.value,n);if(r.async)return(i instanceof Promise?i:Promise.resolve(i)).then(e=>(n.value=e,n.fallback=!0,n));if(i instanceof Promise)throw new sC;return n.value=i,n.fallback=!0,n}});function iE(e,t){return t===void 0&&(e.issues.length||e.fallback)?{issues:[],value:void 0}:e}var aE=Q(`$ZodOptional`,(e,t)=>{cT.init(e,t),e._zod.optin=`optional`,e._zod.optout=`optional`,vC(e._zod,`values`,()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),vC(e._zod,`pattern`,()=>{let e=t.innerType._zod.pattern;return e?RegExp(`^(${hC(e.source)})?$`):void 0}),e._zod.parse=(e,n)=>{if(t.innerType._zod.optin===`optional`){let r=e.value,i=t.innerType._zod.run(e,n);return i instanceof Promise?i.then(e=>iE(e,r)):iE(i,r)}return e.value===void 0?e:t.innerType._zod.run(e,n)}}),oE=Q(`$ZodExactOptional`,(e,t)=>{aE.init(e,t),vC(e._zod,`values`,()=>t.innerType._zod.values),vC(e._zod,`pattern`,()=>t.innerType._zod.pattern),e._zod.parse=(e,n)=>t.innerType._zod.run(e,n)}),sE=Q(`$ZodNullable`,(e,t)=>{cT.init(e,t),vC(e._zod,`optin`,()=>t.innerType._zod.optin),vC(e._zod,`optout`,()=>t.innerType._zod.optout),vC(e._zod,`pattern`,()=>{let e=t.innerType._zod.pattern;return e?RegExp(`^(${hC(e.source)}|null)$`):void 0}),vC(e._zod,`values`,()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(e,n)=>e.value===null?e:t.innerType._zod.run(e,n)}),cE=Q(`$ZodDefault`,(e,t)=>{cT.init(e,t),e._zod.optin=`optional`,vC(e._zod,`values`,()=>t.innerType._zod.values),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);if(e.value===void 0)return e.value=t.defaultValue,e;let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(e=>lE(e,t)):lE(r,t)}});function lE(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}var uE=Q(`$ZodPrefault`,(e,t)=>{cT.init(e,t),e._zod.optin=`optional`,vC(e._zod,`values`,()=>t.innerType._zod.values),e._zod.parse=(e,n)=>(n.direction===`backward`||e.value===void 0&&(e.value=t.defaultValue),t.innerType._zod.run(e,n))}),dE=Q(`$ZodNonOptional`,(e,t)=>{cT.init(e,t),vC(e._zod,`values`,()=>{let e=t.innerType._zod.values;return e?new Set([...e].filter(e=>e!==void 0)):void 0}),e._zod.parse=(n,r)=>{let i=t.innerType._zod.run(n,r);return i instanceof Promise?i.then(t=>fE(t,e)):fE(i,e)}});function fE(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:`invalid_type`,expected:`nonoptional`,input:e.value,inst:t}),e}var pE=Q(`$ZodCatch`,(e,t)=>{cT.init(e,t),e._zod.optin=`optional`,vC(e._zod,`optout`,()=>t.innerType._zod.optout),vC(e._zod,`values`,()=>t.innerType._zod.values),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(r=>(e.value=r.value,r.issues.length&&(e.value=t.catchValue({...e,error:{issues:r.issues.map(e=>WC(e,n,uC()))},input:e.value}),e.issues=[],e.fallback=!0),e)):(e.value=r.value,r.issues.length&&(e.value=t.catchValue({...e,error:{issues:r.issues.map(e=>WC(e,n,uC()))},input:e.value}),e.issues=[],e.fallback=!0),e)}}),mE=Q(`$ZodPipe`,(e,t)=>{cT.init(e,t),vC(e._zod,`values`,()=>t.in._zod.values),vC(e._zod,`optin`,()=>t.in._zod.optin),vC(e._zod,`optout`,()=>t.out._zod.optout),vC(e._zod,`propValues`,()=>t.in._zod.propValues),e._zod.parse=(e,n)=>{if(n.direction===`backward`){let r=t.out._zod.run(e,n);return r instanceof Promise?r.then(e=>hE(e,t.in,n)):hE(r,t.in,n)}let r=t.in._zod.run(e,n);return r instanceof Promise?r.then(e=>hE(e,t.out,n)):hE(r,t.out,n)}});function hE(e,t,n){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues,fallback:e.fallback},n)}var gE=Q(`$ZodReadonly`,(e,t)=>{cT.init(e,t),vC(e._zod,`propValues`,()=>t.innerType._zod.propValues),vC(e._zod,`values`,()=>t.innerType._zod.values),vC(e._zod,`optin`,()=>t.innerType?._zod?.optin),vC(e._zod,`optout`,()=>t.innerType?._zod?.optout),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(_E):_E(r)}});function _E(e){return e.value=Object.freeze(e.value),e}var vE=Q(`$ZodCustom`,(e,t)=>{Uw.init(e,t),cT.init(e,t),e._zod.parse=(e,t)=>e,e._zod.check=n=>{let r=n.value,i=t.fn(r);if(i instanceof Promise)return i.then(t=>yE(t,n,r,e));yE(i,n,r,e)}});function yE(e,t,n,r){if(!e){let e={code:`custom`,input:n,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};r._zod.def.params&&(e.params=r._zod.def.params),t.issues.push(KC(e))}}var bE,xE=class{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...t){let n=t[0];return this._map.set(e,n),n&&typeof n==`object`&&`id`in n&&this._idmap.set(n.id,e),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){let t=this._map.get(e);return t&&typeof t==`object`&&`id`in t&&this._idmap.delete(t.id),this._map.delete(e),this}get(e){let t=e._zod.parent;if(t){let n={...this.get(t)??{}};delete n.id;let r={...n,...this._map.get(e)};return Object.keys(r).length?r:void 0}return this._map.get(e)}has(e){return this._map.has(e)}};function SE(){return new xE}(bE=globalThis).__zod_globalRegistry??(bE.__zod_globalRegistry=SE());var CE=globalThis.__zod_globalRegistry;function wE(e,t){return new e({type:`string`,...$(t)})}function TE(e,t){return new e({type:`string`,format:`email`,check:`string_format`,abort:!1,...$(t)})}function EE(e,t){return new e({type:`string`,format:`guid`,check:`string_format`,abort:!1,...$(t)})}function DE(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,...$(t)})}function OE(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v4`,...$(t)})}function kE(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v6`,...$(t)})}function AE(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v7`,...$(t)})}function jE(e,t){return new e({type:`string`,format:`url`,check:`string_format`,abort:!1,...$(t)})}function ME(e,t){return new e({type:`string`,format:`emoji`,check:`string_format`,abort:!1,...$(t)})}function NE(e,t){return new e({type:`string`,format:`nanoid`,check:`string_format`,abort:!1,...$(t)})}function PE(e,t){return new e({type:`string`,format:`cuid`,check:`string_format`,abort:!1,...$(t)})}function FE(e,t){return new e({type:`string`,format:`cuid2`,check:`string_format`,abort:!1,...$(t)})}function IE(e,t){return new e({type:`string`,format:`ulid`,check:`string_format`,abort:!1,...$(t)})}function LE(e,t){return new e({type:`string`,format:`xid`,check:`string_format`,abort:!1,...$(t)})}function RE(e,t){return new e({type:`string`,format:`ksuid`,check:`string_format`,abort:!1,...$(t)})}function zE(e,t){return new e({type:`string`,format:`ipv4`,check:`string_format`,abort:!1,...$(t)})}function BE(e,t){return new e({type:`string`,format:`ipv6`,check:`string_format`,abort:!1,...$(t)})}function VE(e,t){return new e({type:`string`,format:`cidrv4`,check:`string_format`,abort:!1,...$(t)})}function HE(e,t){return new e({type:`string`,format:`cidrv6`,check:`string_format`,abort:!1,...$(t)})}function UE(e,t){return new e({type:`string`,format:`base64`,check:`string_format`,abort:!1,...$(t)})}function WE(e,t){return new e({type:`string`,format:`base64url`,check:`string_format`,abort:!1,...$(t)})}function GE(e,t){return new e({type:`string`,format:`e164`,check:`string_format`,abort:!1,...$(t)})}function KE(e,t){return new e({type:`string`,format:`jwt`,check:`string_format`,abort:!1,...$(t)})}function qE(e,t){return new e({type:`string`,format:`datetime`,check:`string_format`,offset:!1,local:!1,precision:null,...$(t)})}function JE(e,t){return new e({type:`string`,format:`date`,check:`string_format`,...$(t)})}function YE(e,t){return new e({type:`string`,format:`time`,check:`string_format`,precision:null,...$(t)})}function XE(e,t){return new e({type:`string`,format:`duration`,check:`string_format`,...$(t)})}function ZE(e,t){return new e({type:`number`,checks:[],...$(t)})}function QE(e,t){return new e({type:`number`,coerce:!0,checks:[],...$(t)})}function $E(e,t){return new e({type:`number`,check:`number_format`,abort:!1,format:`safeint`,...$(t)})}function eD(e,t){return new e({type:`boolean`,...$(t)})}function tD(e){return new e({type:`unknown`})}function nD(e,t){return new e({type:`never`,...$(t)})}function rD(e,t){return new Gw({check:`less_than`,...$(t),value:e,inclusive:!1})}function iD(e,t){return new Gw({check:`less_than`,...$(t),value:e,inclusive:!0})}function aD(e,t){return new Kw({check:`greater_than`,...$(t),value:e,inclusive:!1})}function oD(e,t){return new Kw({check:`greater_than`,...$(t),value:e,inclusive:!0})}function sD(e,t){return new qw({check:`multiple_of`,...$(t),value:e})}function cD(e,t){return new Yw({check:`max_length`,...$(t),maximum:e})}function lD(e,t){return new Xw({check:`min_length`,...$(t),minimum:e})}function uD(e,t){return new Zw({check:`length_equals`,...$(t),length:e})}function dD(e,t){return new $w({check:`string_format`,format:`regex`,...$(t),pattern:e})}function fD(e){return new eT({check:`string_format`,format:`lowercase`,...$(e)})}function pD(e){return new tT({check:`string_format`,format:`uppercase`,...$(e)})}function mD(e,t){return new nT({check:`string_format`,format:`includes`,...$(t),includes:e})}function hD(e,t){return new rT({check:`string_format`,format:`starts_with`,...$(t),prefix:e})}function gD(e,t){return new iT({check:`string_format`,format:`ends_with`,...$(t),suffix:e})}function _D(e){return new aT({check:`overwrite`,tx:e})}function vD(e){return _D(t=>t.normalize(e))}function yD(){return _D(e=>e.trim())}function bD(){return _D(e=>e.toLowerCase())}function xD(){return _D(e=>e.toUpperCase())}function SD(){return _D(e=>SC(e))}function CD(e,t,n){return new e({type:`array`,element:t,...$(n)})}function wD(e,t,n){return new e({type:`custom`,check:`custom`,fn:t,...$(n)})}function TD(e,t){let n=ED(t=>(t.addIssue=e=>{if(typeof e==`string`)t.issues.push(KC(e,t.value,n._zod.def));else{let r=e;r.fatal&&(r.continue=!1),r.code??=`custom`,r.input??=t.value,r.inst??=n,r.continue??=!n._zod.def.abort,t.issues.push(KC(r))}},e(t.value,t)),t);return n}function ED(e,t){let n=new Uw({check:`custom`,...$(t)});return n._zod.check=e,n}function DD(e){let t=e?.target??`draft-2020-12`;return t===`draft-4`&&(t=`draft-04`),t===`draft-7`&&(t=`draft-07`),{processors:e.processors??{},metadataRegistry:e?.metadata??CE,target:t,unrepresentable:e?.unrepresentable??`throw`,override:e?.override??(()=>{}),io:e?.io??`output`,counter:0,seen:new Map,cycles:e?.cycles??`ref`,reused:e?.reused??`inline`,external:e?.external??void 0}}function OD(e,t,n={path:[],schemaPath:[]}){var r;let i=e._zod.def,a=t.seen.get(e);if(a)return a.count++,n.schemaPath.includes(e)&&(a.cycle=n.path),a.schema;let o={schema:{},count:1,cycle:void 0,path:n.path};t.seen.set(e,o);let s=e._zod.toJSONSchema?.();if(s)o.schema=s;else{let r={...n,schemaPath:[...n.schemaPath,e],path:n.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,o.schema,r);else{let n=o.schema,a=t.processors[i.type];if(!a)throw Error(`[toJSONSchema]: Non-representable type encountered: ${i.type}`);a(e,t,n,r)}let a=e._zod.parent;a&&(o.ref||=a,OD(a,t,r),t.seen.get(a).isParent=!0)}let c=t.metadataRegistry.get(e);return c&&Object.assign(o.schema,c),t.io===`input`&&jD(e)&&(delete o.schema.examples,delete o.schema.default),t.io===`input`&&`_prefault`in o.schema&&((r=o.schema).default??(r.default=o.schema._prefault)),delete o.schema._prefault,t.seen.get(e).schema}function kD(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);let r=new Map;for(let t of e.seen.entries()){let n=e.metadataRegistry.get(t[0])?.id;if(n){let e=r.get(n);if(e&&e!==t[0])throw Error(`Duplicate schema id "${n}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);r.set(n,t[0])}}let i=t=>{let r=e.target===`draft-2020-12`?`$defs`:`definitions`;if(e.external){let n=e.external.registry.get(t[0])?.id,i=e.external.uri??(e=>e);if(n)return{ref:i(n)};let a=t[1].defId??t[1].schema.id??`schema${e.counter++}`;return t[1].defId=a,{defId:a,ref:`${i(`__shared`)}#/${r}/${a}`}}if(t[1]===n)return{ref:`#`};let i=`#/${r}/`,a=t[1].schema.id??`__schema${e.counter++}`;return{defId:a,ref:i+a}},a=e=>{if(e[1].schema.$ref)return;let t=e[1],{ref:n,defId:r}=i(e);t.def={...t.schema},r&&(t.defId=r);let a=t.schema;for(let e in a)delete a[e];a.$ref=n};if(e.cycles===`throw`)for(let t of e.seen.entries()){let e=t[1];if(e.cycle)throw Error(`Cycle detected: #/${e.cycle?.join(`/`)}/<root>
105
+
106
+ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let n of e.seen.entries()){let r=n[1];if(t===n[0]){a(n);continue}if(e.external){let r=e.external.registry.get(n[0])?.id;if(t!==n[0]&&r){a(n);continue}}if(e.metadataRegistry.get(n[0])?.id){a(n);continue}if(r.cycle){a(n);continue}if(r.count>1&&e.reused===`ref`){a(n);continue}}}function AD(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);let r=t=>{let n=e.seen.get(t);if(n.ref===null)return;let i=n.def??n.schema,a={...i},o=n.ref;if(n.ref=null,o){r(o);let n=e.seen.get(o),s=n.schema;if(s.$ref&&(e.target===`draft-07`||e.target===`draft-04`||e.target===`openapi-3.0`)?(i.allOf=i.allOf??[],i.allOf.push(s)):Object.assign(i,s),Object.assign(i,a),t._zod.parent===o)for(let e in i)e===`$ref`||e===`allOf`||e in a||delete i[e];if(s.$ref&&n.def)for(let e in i)e===`$ref`||e===`allOf`||e in n.def&&JSON.stringify(i[e])===JSON.stringify(n.def[e])&&delete i[e]}let s=t._zod.parent;if(s&&s!==o){r(s);let t=e.seen.get(s);if(t?.schema.$ref&&(i.$ref=t.schema.$ref,t.def))for(let e in i)e===`$ref`||e===`allOf`||e in t.def&&JSON.stringify(i[e])===JSON.stringify(t.def[e])&&delete i[e]}e.override({zodSchema:t,jsonSchema:i,path:n.path??[]})};for(let t of[...e.seen.entries()].reverse())r(t[0]);let i={};if(e.target===`draft-2020-12`?i.$schema=`https://json-schema.org/draft/2020-12/schema`:e.target===`draft-07`?i.$schema=`http://json-schema.org/draft-07/schema#`:e.target===`draft-04`?i.$schema=`http://json-schema.org/draft-04/schema#`:e.target,e.external?.uri){let n=e.external.registry.get(t)?.id;if(!n)throw Error("Schema is missing an `id` property");i.$id=e.external.uri(n)}Object.assign(i,n.def??n.schema);let a=e.metadataRegistry.get(t)?.id;a!==void 0&&i.id===a&&delete i.id;let o=e.external?.defs??{};for(let t of e.seen.entries()){let e=t[1];e.def&&e.defId&&(e.def.id===e.defId&&delete e.def.id,o[e.defId]=e.def)}e.external||Object.keys(o).length>0&&(e.target===`draft-2020-12`?i.$defs=o:i.definitions=o);try{let n=JSON.parse(JSON.stringify(i));return Object.defineProperty(n,"~standard",{value:{...t[`~standard`],jsonSchema:{input:ND(t,`input`,e.processors),output:ND(t,`output`,e.processors)}},enumerable:!1,writable:!1}),n}catch{throw Error(`Error converting schema to JSON.`)}}function jD(e,t){let n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);let r=e._zod.def;if(r.type===`transform`)return!0;if(r.type===`array`)return jD(r.element,n);if(r.type===`set`)return jD(r.valueType,n);if(r.type===`lazy`)return jD(r.getter(),n);if(r.type===`promise`||r.type===`optional`||r.type===`nonoptional`||r.type===`nullable`||r.type===`readonly`||r.type==="default"||r.type===`prefault`)return jD(r.innerType,n);if(r.type===`intersection`)return jD(r.left,n)||jD(r.right,n);if(r.type===`record`||r.type===`map`)return jD(r.keyType,n)||jD(r.valueType,n);if(r.type===`pipe`)return e._zod.traits.has(`$ZodCodec`)?!0:jD(r.in,n)||jD(r.out,n);if(r.type===`object`){for(let e in r.shape)if(jD(r.shape[e],n))return!0;return!1}if(r.type===`union`){for(let e of r.options)if(jD(e,n))return!0;return!1}if(r.type===`tuple`){for(let e of r.items)if(jD(e,n))return!0;return!!(r.rest&&jD(r.rest,n))}return!1}var MD=(e,t={})=>n=>{let r=DD({...n,processors:t});return OD(e,r),kD(r,e),AD(r,e)},ND=(e,t,n={})=>r=>{let{libraryOptions:i,target:a}=r??{},o=DD({...i??{},target:a,io:t,processors:n});return OD(e,o),kD(o,e),AD(o,e)},PD={guid:`uuid`,url:`uri`,datetime:`date-time`,json_string:`json-string`,regex:``},FD=(e,t,n,r)=>{let i=n;i.type=`string`;let{minimum:a,maximum:o,format:s,patterns:c,contentEncoding:l}=e._zod.bag;if(typeof a==`number`&&(i.minLength=a),typeof o==`number`&&(i.maxLength=o),s&&(i.format=PD[s]??s,i.format===``&&delete i.format,s===`time`&&delete i.format),l&&(i.contentEncoding=l),c&&c.size>0){let e=[...c];e.length===1?i.pattern=e[0].source:e.length>1&&(i.allOf=[...e.map(e=>({...t.target===`draft-07`||t.target===`draft-04`||t.target===`openapi-3.0`?{type:`string`}:{},pattern:e.source}))])}},ID=(e,t,n,r)=>{let i=n,{minimum:a,maximum:o,format:s,multipleOf:c,exclusiveMaximum:l,exclusiveMinimum:u}=e._zod.bag;typeof s==`string`&&s.includes(`int`)?i.type=`integer`:i.type=`number`;let d=typeof u==`number`&&u>=(a??-1/0),f=typeof l==`number`&&l<=(o??1/0),p=t.target===`draft-04`||t.target===`openapi-3.0`;d?p?(i.minimum=u,i.exclusiveMinimum=!0):i.exclusiveMinimum=u:typeof a==`number`&&(i.minimum=a),f?p?(i.maximum=l,i.exclusiveMaximum=!0):i.exclusiveMaximum=l:typeof o==`number`&&(i.maximum=o),typeof c==`number`&&(i.multipleOf=c)},LD=(e,t,n,r)=>{n.type=`boolean`},RD=(e,t,n,r)=>{n.not={}},zD=(e,t,n,r)=>{let i=e._zod.def,a=dC(i.entries);a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),n.enum=a},BD=(e,t,n,r)=>{let i=e._zod.def,a=[];for(let e of i.values)if(e===void 0){if(t.unrepresentable===`throw`)throw Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof e==`bigint`){if(t.unrepresentable===`throw`)throw Error(`BigInt literals cannot be represented in JSON Schema`);a.push(Number(e))}else a.push(e);if(a.length!==0)if(a.length===1){let e=a[0];n.type=e===null?`null`:typeof e,t.target===`draft-04`||t.target===`openapi-3.0`?n.enum=[e]:n.const=e}else a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),a.every(e=>typeof e==`boolean`)&&(n.type=`boolean`),a.every(e=>e===null)&&(n.type=`null`),n.enum=a},VD=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Custom types cannot be represented in JSON Schema`)},HD=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Transforms cannot be represented in JSON Schema`)},UD=(e,t,n,r)=>{let i=n,a=e._zod.def,{minimum:o,maximum:s}=e._zod.bag;typeof o==`number`&&(i.minItems=o),typeof s==`number`&&(i.maxItems=s),i.type=`array`,i.items=OD(a.element,t,{...r,path:[...r.path,`items`]})},WD=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`object`,i.properties={};let o=a.shape;for(let e in o)i.properties[e]=OD(o[e],t,{...r,path:[...r.path,`properties`,e]});let s=new Set(Object.keys(o)),c=new Set([...s].filter(e=>{let n=a.shape[e]._zod;return t.io===`input`?n.optin===void 0:n.optout===void 0}));c.size>0&&(i.required=Array.from(c)),a.catchall?._zod.def.type===`never`?i.additionalProperties=!1:a.catchall?a.catchall&&(i.additionalProperties=OD(a.catchall,t,{...r,path:[...r.path,`additionalProperties`]})):t.io===`output`&&(i.additionalProperties=!1)},GD=(e,t,n,r)=>{let i=e._zod.def,a=i.inclusive===!1,o=i.options.map((e,n)=>OD(e,t,{...r,path:[...r.path,a?`oneOf`:`anyOf`,n]}));a?n.oneOf=o:n.anyOf=o},KD=(e,t,n,r)=>{let i=e._zod.def,a=OD(i.left,t,{...r,path:[...r.path,`allOf`,0]}),o=OD(i.right,t,{...r,path:[...r.path,`allOf`,1]}),s=e=>`allOf`in e&&Object.keys(e).length===1;n.allOf=[...s(a)?a.allOf:[a],...s(o)?o.allOf:[o]]},qD=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`object`;let o=a.keyType,s=o._zod.bag?.patterns;if(a.mode===`loose`&&s&&s.size>0){let e=OD(a.valueType,t,{...r,path:[...r.path,`patternProperties`,`*`]});i.patternProperties={};for(let t of s)i.patternProperties[t.source]=e}else(t.target===`draft-07`||t.target===`draft-2020-12`)&&(i.propertyNames=OD(a.keyType,t,{...r,path:[...r.path,`propertyNames`]})),i.additionalProperties=OD(a.valueType,t,{...r,path:[...r.path,`additionalProperties`]});let c=o._zod.values;if(c){let e=[...c].filter(e=>typeof e==`string`||typeof e==`number`);e.length>0&&(i.required=e)}},JD=(e,t,n,r)=>{let i=e._zod.def,a=OD(i.innerType,t,r),o=t.seen.get(e);t.target===`openapi-3.0`?(o.ref=i.innerType,n.nullable=!0):n.anyOf=[a,{type:`null`}]},YD=(e,t,n,r)=>{let i=e._zod.def;OD(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},XD=(e,t,n,r)=>{let i=e._zod.def;OD(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.default=JSON.parse(JSON.stringify(i.defaultValue))},ZD=(e,t,n,r)=>{let i=e._zod.def;OD(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,t.io===`input`&&(n._prefault=JSON.parse(JSON.stringify(i.defaultValue)))},QD=(e,t,n,r)=>{let i=e._zod.def;OD(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o;try{o=i.catchValue(void 0)}catch{throw Error(`Dynamic catch values are not supported in JSON Schema`)}n.default=o},$D=(e,t,n,r)=>{let i=e._zod.def,a=i.in._zod.traits.has(`$ZodTransform`),o=t.io===`input`?a?i.out:i.in:i.out;OD(o,t,r);let s=t.seen.get(e);s.ref=o},eO=(e,t,n,r)=>{let i=e._zod.def;OD(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.readOnly=!0},tO=(e,t,n,r)=>{let i=e._zod.def;OD(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},nO=Q(`ZodISODateTime`,(e,t)=>{ST.init(e,t),kO.init(e,t)});function rO(e){return qE(nO,e)}var iO=Q(`ZodISODate`,(e,t)=>{CT.init(e,t),kO.init(e,t)});function aO(e){return JE(iO,e)}var oO=Q(`ZodISOTime`,(e,t)=>{wT.init(e,t),kO.init(e,t)});function sO(e){return YE(oO,e)}var cO=Q(`ZodISODuration`,(e,t)=>{TT.init(e,t),kO.init(e,t)});function lO(e){return XE(cO,e)}var uO=Q(`ZodError`,(e,t)=>{JC.init(e,t),e.name=`ZodError`,Object.defineProperties(e,{format:{value:t=>ZC(e,t)},flatten:{value:t=>XC(e,t)},addIssue:{value:t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,fC,2)}},addIssues:{value:t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,fC,2)}},isEmpty:{get(){return e.issues.length===0}}})},{Parent:Error}),dO=QC(uO),fO=$C(uO),pO=ew(uO),mO=nw(uO),hO=iw(uO),gO=aw(uO),_O=ow(uO),vO=sw(uO),yO=cw(uO),bO=lw(uO),xO=uw(uO),SO=dw(uO),CO=new WeakMap;function wO(e,t,n){let r=Object.getPrototypeOf(e),i=CO.get(r);if(i||(i=new Set,CO.set(r,i)),!i.has(t)){i.add(t);for(let e in n){let t=n[e];Object.defineProperty(r,e,{configurable:!0,enumerable:!1,get(){let n=t.bind(this);return Object.defineProperty(this,e,{configurable:!0,writable:!0,enumerable:!0,value:n}),n},set(t){Object.defineProperty(this,e,{configurable:!0,writable:!0,enumerable:!0,value:t})}})}}}var TO=Q(`ZodType`,(e,t)=>(cT.init(e,t),Object.assign(e[`~standard`],{jsonSchema:{input:ND(e,`input`),output:ND(e,`output`)}}),e.toJSONSchema=MD(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.parse=(t,n)=>dO(e,t,n,{callee:e.parse}),e.safeParse=(t,n)=>pO(e,t,n),e.parseAsync=async(t,n)=>fO(e,t,n,{callee:e.parseAsync}),e.safeParseAsync=async(t,n)=>mO(e,t,n),e.spa=e.safeParseAsync,e.encode=(t,n)=>hO(e,t,n),e.decode=(t,n)=>gO(e,t,n),e.encodeAsync=async(t,n)=>_O(e,t,n),e.decodeAsync=async(t,n)=>vO(e,t,n),e.safeEncode=(t,n)=>yO(e,t,n),e.safeDecode=(t,n)=>bO(e,t,n),e.safeEncodeAsync=async(t,n)=>xO(e,t,n),e.safeDecodeAsync=async(t,n)=>SO(e,t,n),wO(e,`ZodType`,{check(...e){let t=this.def;return this.clone(bC(t,{checks:[...t.checks??[],...e.map(e=>typeof e==`function`?{_zod:{check:e,def:{check:`custom`},onattach:[]}}:e)]}),{parent:!0})},with(...e){return this.check(...e)},clone(e,t){return AC(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(Vk(e,t))},superRefine(e,t){return this.check(Hk(e,t))},overwrite(e){return this.check(_D(e))},optional(){return Ck(this)},exactOptional(){return Tk(this)},nullable(){return Dk(this)},nullish(){return Ck(Dk(this))},nonoptional(e){return Nk(this,e)},array(){return ok(this)},or(e){return dk([this,e])},and(e){return pk(this,e)},transform(e){return Lk(this,xk(e))},default(e){return kk(this,e)},prefault(e){return jk(this,e)},catch(e){return Fk(this,e)},pipe(e){return Lk(this,e)},readonly(){return zk(this)},describe(e){let t=this.clone();return CE.add(t,{description:e}),t},meta(...e){if(e.length===0)return CE.get(this);let t=this.clone();return CE.add(t,e[0]),t},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(e){return e(this)}}),Object.defineProperty(e,"description",{get(){return CE.get(e)?.description},configurable:!0}),e)),EO=Q(`_ZodString`,(e,t)=>{lT.init(e,t),TO.init(e,t),e._zod.processJSONSchema=(t,n,r)=>FD(e,t,n,r);let n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null,wO(e,`_ZodString`,{regex(...e){return this.check(dD(...e))},includes(...e){return this.check(mD(...e))},startsWith(...e){return this.check(hD(...e))},endsWith(...e){return this.check(gD(...e))},min(...e){return this.check(lD(...e))},max(...e){return this.check(cD(...e))},length(...e){return this.check(uD(...e))},nonempty(...e){return this.check(lD(1,...e))},lowercase(e){return this.check(fD(e))},uppercase(e){return this.check(pD(e))},trim(){return this.check(yD())},normalize(...e){return this.check(vD(...e))},toLowerCase(){return this.check(bD())},toUpperCase(){return this.check(xD())},slugify(){return this.check(SD())}})}),DO=Q(`ZodString`,(e,t)=>{lT.init(e,t),EO.init(e,t),e.email=t=>e.check(TE(AO,t)),e.url=t=>e.check(jE(NO,t)),e.jwt=t=>e.check(KE(JO,t)),e.emoji=t=>e.check(ME(PO,t)),e.guid=t=>e.check(EE(jO,t)),e.uuid=t=>e.check(DE(MO,t)),e.uuidv4=t=>e.check(OE(MO,t)),e.uuidv6=t=>e.check(kE(MO,t)),e.uuidv7=t=>e.check(AE(MO,t)),e.nanoid=t=>e.check(NE(FO,t)),e.guid=t=>e.check(EE(jO,t)),e.cuid=t=>e.check(PE(IO,t)),e.cuid2=t=>e.check(FE(LO,t)),e.ulid=t=>e.check(IE(RO,t)),e.base64=t=>e.check(UE(GO,t)),e.base64url=t=>e.check(WE(KO,t)),e.xid=t=>e.check(LE(zO,t)),e.ksuid=t=>e.check(RE(BO,t)),e.ipv4=t=>e.check(zE(VO,t)),e.ipv6=t=>e.check(BE(HO,t)),e.cidrv4=t=>e.check(VE(UO,t)),e.cidrv6=t=>e.check(HE(WO,t)),e.e164=t=>e.check(GE(qO,t)),e.datetime=t=>e.check(rO(t)),e.date=t=>e.check(aO(t)),e.time=t=>e.check(sO(t)),e.duration=t=>e.check(lO(t))});function OO(e){return wE(DO,e)}var kO=Q(`ZodStringFormat`,(e,t)=>{uT.init(e,t),EO.init(e,t)}),AO=Q(`ZodEmail`,(e,t)=>{pT.init(e,t),kO.init(e,t)}),jO=Q(`ZodGUID`,(e,t)=>{dT.init(e,t),kO.init(e,t)}),MO=Q(`ZodUUID`,(e,t)=>{fT.init(e,t),kO.init(e,t)}),NO=Q(`ZodURL`,(e,t)=>{mT.init(e,t),kO.init(e,t)}),PO=Q(`ZodEmoji`,(e,t)=>{hT.init(e,t),kO.init(e,t)}),FO=Q(`ZodNanoID`,(e,t)=>{gT.init(e,t),kO.init(e,t)}),IO=Q(`ZodCUID`,(e,t)=>{_T.init(e,t),kO.init(e,t)}),LO=Q(`ZodCUID2`,(e,t)=>{vT.init(e,t),kO.init(e,t)}),RO=Q(`ZodULID`,(e,t)=>{yT.init(e,t),kO.init(e,t)}),zO=Q(`ZodXID`,(e,t)=>{bT.init(e,t),kO.init(e,t)}),BO=Q(`ZodKSUID`,(e,t)=>{xT.init(e,t),kO.init(e,t)}),VO=Q(`ZodIPv4`,(e,t)=>{ET.init(e,t),kO.init(e,t)}),HO=Q(`ZodIPv6`,(e,t)=>{DT.init(e,t),kO.init(e,t)}),UO=Q(`ZodCIDRv4`,(e,t)=>{OT.init(e,t),kO.init(e,t)}),WO=Q(`ZodCIDRv6`,(e,t)=>{kT.init(e,t),kO.init(e,t)}),GO=Q(`ZodBase64`,(e,t)=>{jT.init(e,t),kO.init(e,t)}),KO=Q(`ZodBase64URL`,(e,t)=>{NT.init(e,t),kO.init(e,t)}),qO=Q(`ZodE164`,(e,t)=>{PT.init(e,t),kO.init(e,t)}),JO=Q(`ZodJWT`,(e,t)=>{IT.init(e,t),kO.init(e,t)}),YO=Q(`ZodNumber`,(e,t)=>{LT.init(e,t),TO.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ID(e,t,n,r),wO(e,`ZodNumber`,{gt(e,t){return this.check(aD(e,t))},gte(e,t){return this.check(oD(e,t))},min(e,t){return this.check(oD(e,t))},lt(e,t){return this.check(rD(e,t))},lte(e,t){return this.check(iD(e,t))},max(e,t){return this.check(iD(e,t))},int(e){return this.check(QO(e))},safe(e){return this.check(QO(e))},positive(e){return this.check(aD(0,e))},nonnegative(e){return this.check(oD(0,e))},negative(e){return this.check(rD(0,e))},nonpositive(e){return this.check(iD(0,e))},multipleOf(e,t){return this.check(sD(e,t))},step(e,t){return this.check(sD(e,t))},finite(){return this}});let n=e._zod.bag;e.minValue=Math.max(n.minimum??-1/0,n.exclusiveMinimum??-1/0)??null,e.maxValue=Math.min(n.maximum??1/0,n.exclusiveMaximum??1/0)??null,e.isInt=(n.format??``).includes(`int`)||Number.isSafeInteger(n.multipleOf??.5),e.isFinite=!0,e.format=n.format??null});function XO(e){return ZE(YO,e)}var ZO=Q(`ZodNumberFormat`,(e,t)=>{RT.init(e,t),YO.init(e,t)});function QO(e){return $E(ZO,e)}var $O=Q(`ZodBoolean`,(e,t)=>{zT.init(e,t),TO.init(e,t),e._zod.processJSONSchema=(t,n,r)=>LD(e,t,n,r)});function ek(e){return eD($O,e)}var tk=Q(`ZodUnknown`,(e,t)=>{BT.init(e,t),TO.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function nk(){return tD(tk)}var rk=Q(`ZodNever`,(e,t)=>{VT.init(e,t),TO.init(e,t),e._zod.processJSONSchema=(t,n,r)=>RD(e,t,n,r)});function ik(e){return nD(rk,e)}var ak=Q(`ZodArray`,(e,t)=>{UT.init(e,t),TO.init(e,t),e._zod.processJSONSchema=(t,n,r)=>UD(e,t,n,r),e.element=t.element,wO(e,`ZodArray`,{min(e,t){return this.check(lD(e,t))},nonempty(e){return this.check(lD(1,e))},max(e,t){return this.check(cD(e,t))},length(e,t){return this.check(uD(e,t))},unwrap(){return this.element}})});function ok(e,t){return CD(ak,e,t)}var sk=Q(`ZodObject`,(e,t)=>{JT.init(e,t),TO.init(e,t),e._zod.processJSONSchema=(t,n,r)=>WD(e,t,n,r),vC(e,`shape`,()=>t.shape),wO(e,`ZodObject`,{keyof(){return _k(Object.keys(this._zod.def.shape))},catchall(e){return this.clone({...this._zod.def,catchall:e})},passthrough(){return this.clone({...this._zod.def,catchall:nk()})},loose(){return this.clone({...this._zod.def,catchall:nk()})},strict(){return this.clone({...this._zod.def,catchall:ik()})},strip(){return this.clone({...this._zod.def,catchall:void 0})},extend(e){return FC(this,e)},safeExtend(e){return IC(this,e)},merge(e){return LC(this,e)},pick(e){return NC(this,e)},omit(e){return PC(this,e)},partial(...e){return RC(Sk,this,e[0])},required(...e){return zC(Mk,this,e[0])}})});function ck(e,t){return new sk({type:`object`,shape:e??{},...$(t)})}function lk(e,t){return new sk({type:`object`,shape:e,catchall:ik(),...$(t)})}var uk=Q(`ZodUnion`,(e,t)=>{XT.init(e,t),TO.init(e,t),e._zod.processJSONSchema=(t,n,r)=>GD(e,t,n,r),e.options=t.options});function dk(e,t){return new uk({type:`union`,options:e,...$(t)})}var fk=Q(`ZodIntersection`,(e,t)=>{ZT.init(e,t),TO.init(e,t),e._zod.processJSONSchema=(t,n,r)=>KD(e,t,n,r)});function pk(e,t){return new fk({type:`intersection`,left:e,right:t})}var mk=Q(`ZodRecord`,(e,t)=>{eE.init(e,t),TO.init(e,t),e._zod.processJSONSchema=(t,n,r)=>qD(e,t,n,r),e.keyType=t.keyType,e.valueType=t.valueType});function hk(e,t,n){return!t||!t._zod?new mk({type:`record`,keyType:OO(),valueType:e,...$(t)}):new mk({type:`record`,keyType:e,valueType:t,...$(n)})}var gk=Q(`ZodEnum`,(e,t)=>{tE.init(e,t),TO.init(e,t),e._zod.processJSONSchema=(t,n,r)=>zD(e,t,n,r),e.enum=t.entries,e.options=Object.values(t.entries);let n=new Set(Object.keys(t.entries));e.extract=(e,r)=>{let i={};for(let r of e)if(n.has(r))i[r]=t.entries[r];else throw Error(`Key ${r} not found in enum`);return new gk({...t,checks:[],...$(r),entries:i})},e.exclude=(e,r)=>{let i={...t.entries};for(let t of e)if(n.has(t))delete i[t];else throw Error(`Key ${t} not found in enum`);return new gk({...t,checks:[],...$(r),entries:i})}});function _k(e,t){return new gk({type:`enum`,entries:Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e,...$(t)})}var vk=Q(`ZodLiteral`,(e,t)=>{nE.init(e,t),TO.init(e,t),e._zod.processJSONSchema=(t,n,r)=>BD(e,t,n,r),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function yk(e,t){return new vk({type:`literal`,values:Array.isArray(e)?e:[e],...$(t)})}var bk=Q(`ZodTransform`,(e,t)=>{rE.init(e,t),TO.init(e,t),e._zod.processJSONSchema=(t,n,r)=>HD(e,t,n,r),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new cC(e.constructor.name);n.addIssue=r=>{if(typeof r==`string`)n.issues.push(KC(r,n.value,t));else{let t=r;t.fatal&&(t.continue=!1),t.code??=`custom`,t.input??=n.value,t.inst??=e,n.issues.push(KC(t))}};let i=t.transform(n.value,n);return i instanceof Promise?i.then(e=>(n.value=e,n.fallback=!0,n)):(n.value=i,n.fallback=!0,n)}});function xk(e){return new bk({type:`transform`,transform:e})}var Sk=Q(`ZodOptional`,(e,t)=>{aE.init(e,t),TO.init(e,t),e._zod.processJSONSchema=(t,n,r)=>tO(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Ck(e){return new Sk({type:`optional`,innerType:e})}var wk=Q(`ZodExactOptional`,(e,t)=>{oE.init(e,t),TO.init(e,t),e._zod.processJSONSchema=(t,n,r)=>tO(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Tk(e){return new wk({type:`optional`,innerType:e})}var Ek=Q(`ZodNullable`,(e,t)=>{sE.init(e,t),TO.init(e,t),e._zod.processJSONSchema=(t,n,r)=>JD(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Dk(e){return new Ek({type:`nullable`,innerType:e})}var Ok=Q(`ZodDefault`,(e,t)=>{cE.init(e,t),TO.init(e,t),e._zod.processJSONSchema=(t,n,r)=>XD(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function kk(e,t){return new Ok({type:`default`,innerType:e,get defaultValue(){return typeof t==`function`?t():DC(t)}})}var Ak=Q(`ZodPrefault`,(e,t)=>{uE.init(e,t),TO.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ZD(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function jk(e,t){return new Ak({type:`prefault`,innerType:e,get defaultValue(){return typeof t==`function`?t():DC(t)}})}var Mk=Q(`ZodNonOptional`,(e,t)=>{dE.init(e,t),TO.init(e,t),e._zod.processJSONSchema=(t,n,r)=>YD(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Nk(e,t){return new Mk({type:`nonoptional`,innerType:e,...$(t)})}var Pk=Q(`ZodCatch`,(e,t)=>{pE.init(e,t),TO.init(e,t),e._zod.processJSONSchema=(t,n,r)=>QD(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function Fk(e,t){return new Pk({type:`catch`,innerType:e,catchValue:typeof t==`function`?t:()=>t})}var Ik=Q(`ZodPipe`,(e,t)=>{mE.init(e,t),TO.init(e,t),e._zod.processJSONSchema=(t,n,r)=>$D(e,t,n,r),e.in=t.in,e.out=t.out});function Lk(e,t){return new Ik({type:`pipe`,in:e,out:t})}var Rk=Q(`ZodReadonly`,(e,t)=>{gE.init(e,t),TO.init(e,t),e._zod.processJSONSchema=(t,n,r)=>eO(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function zk(e){return new Rk({type:`readonly`,innerType:e})}var Bk=Q(`ZodCustom`,(e,t)=>{vE.init(e,t),TO.init(e,t),e._zod.processJSONSchema=(t,n,r)=>VD(e,t,n,r)});function Vk(e,t={}){return wD(Bk,e,t)}function Hk(e,t){return TD(e,t)}function Uk(e){return QE(YO,e)}var Wk=`/api/socket.io/`,Gk=64*1024,Kk=OO().min(1).max(128),qk=OO().min(1).max(128),Jk=OO().min(1).max(128),Yk=XO().int().nonnegative(),Xk={cols:XO().int().min(2).max(1e3),rows:XO().int().min(2).max(500)},Zk=lk(Xk),Qk=lk({state:_k([`normal`,`error`,`indeterminate`,`paused`]),value:XO().int().min(0).max(100).nullable()}),$k=lk({terminalId:OO().min(1),title:OO().max(256).nullable(),hasForegroundProcess:ek().nullable().optional(),progress:Qk.nullable(),progressStartedAt:OO().datetime().nullable().default(null),progressClearedAt:OO().datetime().nullable().default(null),bell:lk({sequence:XO().int().positive(),at:OO().datetime(),unread:ek()}).nullable().default(null)});lk({sequence:XO().int().positive()});function eA(e){let t=$k.safeParse(e);return t.success?t.data:null}lk({terminalId:Kk,clientId:qk,...Xk}),lk({generation:Yk,data:OO().max(Gk)}),lk({generation:Yk,data:OO().max(Gk)}),lk({generation:Yk,...Xk}),lk({generation:Yk,...Xk}),lk({generation:Yk}),lk({streamId:Jk,sequence:XO().int().nonnegative()});var tA={connectionId:OO().min(1).max(128),streamId:Jk,generation:Yk,controller:ek(),reset:yk(`full`)},nA=dk([lk(tA),lk({...tA,...Xk,revision:XO().int().positive()})]),rA=lk({...Xk,revision:XO().int().positive()}),iA=lk({streamId:Jk,sequence:XO().int().positive(),data:OO()}),aA=lk({title:OO().max(256)}),oA=lk({progress:Qk.nullable()}),sA=lk({generation:Yk,controller:ek()}),cA=lk({exitCode:XO().int().nullable()}),lA=lk({code:OO().min(1).max(80),message:OO().min(1).max(1e3),retryable:ek()});function uA(e,t){let n={ready:nA,dimensions:rA,output:iA,title:aA,progress:oA,control:sA,exit:cA,terminal_error:lA}[e].safeParse(t);return n.success?n.data:null}var dA=_k([`project.created`,`project.updated`,`project.removed`,`worktree.created`,`worktree.updated`,`worktree.removed`,`terminal.created`,`terminal.updated`,`terminal.removed`,`terminal.metadata`,`terminal.controller_changed`,`remove.started`,`remove.completed`,`remove.failed`]),fA=lk({id:OO().min(1).max(128),type:dA,at:OO().datetime(),data:hk(OO(),nk())}),pA=lk({at:OO().datetime(),terminalMetadata:ok($k)});function mA(e){let t=pA.safeParse(e);return t.success?t.data:null}function hA(e){let t=fA.safeParse(e);return t.success?t.data:null}var gA=4096,_A=4096;ck({input:OO().trim().min(1).max(4096),hidden:_k([`true`,`false`]).optional().default(`false`).transform(e=>e===`true`)}),ck({lines:Uk().int().min(1).max(5e3).optional().default(200)}),ck({path:OO().trim().min(1),name:OO().trim().min(1).max(120).optional()}),ck({color:_k([`rose`,`orange`,`amber`,`emerald`,`cyan`,`blue`,`violet`,`pink`]).nullable()});var vA=OO().trim().min(1).max(120),yA=ok(OO()).min(1).max(128),bA=OO().max(_A),xA={name:vA,executable:OO().min(1).max(gA).refine(e=>e.trim().length>0,{message:`Executable cannot be blank`}),args:ok(bA).max(127),closeOnSuccess:ek().default(!1)},SA=OO().min(1).max(64),CA=ck({name:vA,argv:yA.optional(),returnToShell:ek().optional(),initialSize:Zk.optional()});ck({name:OO().trim().min(1).max(120),base:_k([`default`,`current`]).default(`default`),sourceWorktreeId:OO().min(1).optional(),initialTerminal:CA.optional()}).superRefine((e,t)=>{e.base===`current`&&!e.sourceWorktreeId&&t.addIssue({code:`custom`,path:[`sourceWorktreeId`],message:`A source worktree is required when starting from current`})}),ck({name:vA,argv:yA.optional(),returnToShell:ek().optional(),closeOnSuccess:ek().optional(),initialSize:Zk.optional()}).refine(e=>!(e.returnToShell&&e.closeOnSuccess),{message:`A terminal cannot return to a shell and close on success`}),ck({name:vA}),ck(xA),ck({...xA,closeOnSuccess:ek().optional(),expectedUpdatedAt:SA}),ck({expectedUpdatedAt:SA}),ck({confirmationToken:OO().length(64),confirmDestructive:ek()}),ck({project:OO().min(1),worktreeName:OO().trim().min(1).max(120),name:vA,argv:yA.optional(),base:_k([`default`,`current`]).default(`default`),sourceWorktreeId:OO().min(1).optional()}).superRefine((e,t)=>{e.base===`current`&&!e.sourceWorktreeId&&t.addIssue({code:`custom`,path:[`sourceWorktreeId`],message:`A source worktree is required when starting from current`})});var wA=`\x1B[9000~`,TA=8,EA=4,DA=2,OA=1e3,kA=2,AA=500,jA=150,MA=24,NA=44;function PA(e,t={cols:100,rows:30}){return{cols:Number.isFinite(e.cols)?Math.min(OA,Math.max(DA,Math.trunc(e.cols))):t.cols,rows:Number.isFinite(e.rows)?Math.min(AA,Math.max(kA,Math.trunc(e.rows))):t.rows}}var FA={phase:`closed`,degraded:!1,controller:!1,controlPending:!1,title:null,bellActive:!1,bellSerial:0,exitSerial:0,fileTransfer:null,hasSelection:!1,pasteRequestSerial:0,error:null},IA=null;function LA(){if(IA)return IA;try{let e=sessionStorage.getItem(`treeport-terminal-client-id`);if(e)return sessionStorage.setItem(`treeport-terminal-client-id`,e),IA=e}catch{}let e=new Uint8Array(16);if(typeof globalThis.crypto?.getRandomValues==`function`)globalThis.crypto.getRandomValues(e);else for(let t=0;t<e.length;t+=1)e[t]=Math.floor(Math.random()*256);e[6]=e[6]&15|64,e[8]=e[8]&63|128;let t=Array.from(e,e=>e.toString(16).padStart(2,`0`)),n=`${t.slice(0,4).join(``)}-${t.slice(4,6).join(``)}-${t.slice(6,8).join(``)}-${t.slice(8,10).join(``)}-${t.slice(10).join(``)}`;try{sessionStorage.setItem(`treeport-terminal-client-id`,n)}catch{}return IA=n}var RA=class{terminalId;listeners=new Set;snapshotValue=FA;terminal=null;fitAddon=null;wrapper=null;host=null;resizeObserver=null;keyboardViewportCleanup=null;socket=null;degradedTimer=null;bellTimer=null;fileTransferTimer=null;fileTransferQueue=Promise.resolve();resizeFrame=null;resizeSettleTimer=null;disposed=!1;opened=!1;ready=!1;reconnectAllowed=!0;streamId=null;controllerGeneration=0;controlRequestGeneration=null;canonicalCols=100;canonicalRows=30;canonicalRevision=0;appliedRevision=0;proposedDimensions=null;resizePending=!1;serverProtocolVersion=2;resizeIntentDirty=!1;resizeQuietElapsed=!1;resizeIntentGeneration=0;renderEpoch=0;renderQueue=Promise.resolve();renderFailed=!1;pendingTerminalWrites=0;expectedSequence=1;lastParsedSequence=0;parsedSequences=new Set;scrollExitPending=!1;resumeOnNextInput=!1;pendingPaste=``;inputModifiers=null;lastBellAt=0;wakeListenersAttached=!1;reconnectWhenOnline=()=>this.reconnectImmediately();reconnectWhenVisible=()=>{document.visibilityState===`visible`&&this.reconnectImmediately()};constructor(e){this.terminalId=e}getSnapshot=()=>this.snapshotValue;getInitialSize(){return!this.host||!this.terminal?null:PA(this.proposedDimensions??{cols:this.terminal.cols,rows:this.terminal.rows})}subscribe=e=>(this.listeners.add(e),()=>this.listeners.delete(e));mount(e){if(this.disposed)return;this.host=e,this.wrapper||(this.wrapper=document.createElement(`div`),this.wrapper.className=`terminal-session-host h-full min-h-0 min-w-0`),e.appendChild(this.wrapper),this.opened||this.openTerminal(),this.keyboardViewportCleanup?.(),this.keyboardViewportCleanup=null;let t=/iPad|iPhone|iPod/.test(navigator.userAgent)||navigator.platform===`MacIntel`&&navigator.maxTouchPoints>1,n=window.visualViewport;if(t&&n){let e=null,t=null,r=()=>{t!==null&&window.cancelAnimationFrame(t),t=window.requestAnimationFrame(()=>{t=null;let r=this.wrapper?.querySelector(`.xterm-helper-textarea`);if(!(document.activeElement===r&&n.height<document.documentElement.clientHeight-100)){e?.remove(),e=null,document.querySelector(`.app-frame`)?.scrollIntoView({block:`start`,inline:`nearest`});return}let i=document.querySelector(`.accessory-row`);if(!i)return;e??=document.createElement(`div`),e.className=`ios-keyboard-viewport-spacer`,e.setAttribute(`aria-hidden`,`true`);let a=window.matchMedia(`(display-mode: standalone)`).matches||navigator.standalone?0:NA;e.style.height=`${i.getBoundingClientRect().height+MA+a}px`,document.body.appendChild(e),e.scrollIntoView({block:`end`,inline:`nearest`})})};n.addEventListener(`resize`,r),r(),this.keyboardViewportCleanup=()=>{n.removeEventListener(`resize`,r),t!==null&&window.cancelAnimationFrame(t),e?.remove()}}this.resizeObserver?.disconnect(),this.resizeObserver=new ResizeObserver(()=>this.scheduleFit()),this.resizeObserver.observe(e),this.wakeListenersAttached||=(window.addEventListener(`online`,this.reconnectWhenOnline),document.addEventListener(`visibilitychange`,this.reconnectWhenVisible),!0),this.scheduleFit(),!this.socket&&this.opened?this.connect():this.reconnectImmediately()}unmount(e){this.host===e&&(this.resizeObserver?.disconnect(),this.resizeObserver=null,this.wakeListenersAttached&&=(window.removeEventListener(`online`,this.reconnectWhenOnline),document.removeEventListener(`visibilitychange`,this.reconnectWhenVisible),!1),this.keyboardViewportCleanup?.(),this.keyboardViewportCleanup=null,this.cancelControllerResizeIntent(!1),this.wrapper?.remove(),this.host=null)}focus(e={}){e.requestControl&&this.requestControl(),this.terminal?.focus()}requestControl(){if(!this.ready||!this.socket?.connected||this.snapshotValue.controller||this.controlRequestGeneration===this.controllerGeneration)return;let e=PA(this.proposedDimensions??{cols:this.canonicalCols,rows:this.canonicalRows});this.controlRequestGeneration=this.controllerGeneration,this.update({controlPending:!0}),this.send(`take_control`,this.serverProtocolVersion===2?{generation:this.controllerGeneration,...e}:{generation:this.controllerGeneration})}retry(){if(!(this.disposed||this.ready)){if(this.renderFailed){window.location.reload();return}this.reconnectAllowed=!0,this.update({error:null,phase:`connecting`,degraded:!1}),this.socket?this.socket.connect():this.connect()}}setInputModifiers(e,t,n){this.inputModifiers=e||t?{ctrl:e,alt:t,onConsumed:n}:null}sendText(e){this.requestControl(),this.prepareScrollExit(),this.canInput()&&this.send(`input`,{generation:this.controllerGeneration,data:e}),this.focus()}pasteText(e){e&&(this.requestControl(),this.prepareScrollExit(),this.canInput()?this.terminal?.paste(e):this.pendingPaste+=e,this.focus())}sendArrow(e,t=!1){let n={up:`A`,down:`B`,right:`C`,left:`D`}[e],r=this.terminal?.modes.applicationCursorKeysMode?`\x1BO`:`\x1B[`;this.sendText(`${t?`\x1B`:``}${r}${n}`)}copySelection(){let e=this.terminal?.getSelection();if(!e)return;let t=document.createElement(`textarea`);t.value=e,t.readOnly=!0,t.style.position=`fixed`,t.style.left=`-9999px`,t.style.opacity=`0`,document.body.appendChild(t),t.focus({preventScroll:!0}),t.select(),t.setSelectionRange(0,e.length);let n=document.execCommand(`copy`);if(t.remove(),n){this.terminal?.clearSelection();return}navigator.clipboard&&navigator.clipboard.writeText(e).then(()=>{this.terminal?.clearSelection()})}clearSelection(){this.terminal?.clearSelection()}dispose(){this.disposed||(this.disposed=!0,this.reconnectAllowed=!1,this.clearTimers(),this.resizeObserver?.disconnect(),this.wakeListenersAttached&&=(window.removeEventListener(`online`,this.reconnectWhenOnline),document.removeEventListener(`visibilitychange`,this.reconnectWhenVisible),!1),this.keyboardViewportCleanup?.(),this.keyboardViewportCleanup=null,this.socket?.disconnect(),this.socket=null,this.wrapper?.remove(),this.terminal?.dispose(),this.terminal=null,this.fitAddon=null,this.wrapper=null,this.listeners.clear())}openTerminal(){if(!this.wrapper||this.opened)return;let e=new fx(Hf()),t=new Gf;e.loadAddon(t),e.loadAddon(new Zf(zf)),e.open(this.wrapper),e.onSelectionChange(()=>{this.update({hasSelection:e.hasSelection()})}),this.wrapper.addEventListener(`mousedown`,t=>{this.requestControl(),Bf(t,e)},!0),this.wrapper.addEventListener(`click`,()=>this.requestControl(),!0),this.wrapper.addEventListener(`keydown`,t=>{let n=t.key.toLowerCase(),r=[`alt`,`altgraph`,`control`,`meta`,`shift`].includes(n),i=Lf(t,e.modes.applicationCursorKeysMode),a=t.metaKey&&i===null,o=t.ctrlKey&&t.shiftKey&&(n===`c`||n===`v`);!r&&!a&&!o&&this.requestControl()},!0),Vf(this.wrapper,e,()=>{this.scrollExitPending=!0},()=>{this.requestControl(),this.prepareScrollExit()},()=>{this.requestControl(),this.update({pasteRequestSerial:this.snapshotValue.pasteRequestSerial+1})});let n=this.wrapper,r=e=>!!(e&&(Array.from(e.types).includes(`Files`)||Array.from(e.items).some(e=>e.kind===`file`))),i=e=>{let t=Array.from(e?.files??[]);return t.length?t:Array.from(e?.items??[]).flatMap(e=>{let t=e.kind===`file`?e.getAsFile():null;return t?[t]:[]})};n.addEventListener(`dragover`,e=>{r(e.dataTransfer)&&(this.requestControl(),e.preventDefault(),e.dataTransfer.dropEffect=`copy`,n.classList.add(`terminal-file-drag`))}),n.addEventListener(`dragleave`,e=>{(!(e.relatedTarget instanceof Node)||!n.contains(e.relatedTarget))&&n.classList.remove(`terminal-file-drag`)}),n.addEventListener(`drop`,e=>{r(e.dataTransfer)&&(e.preventDefault(),e.stopPropagation(),n.classList.remove(`terminal-file-drag`),this.requestControl(),this.queueFileUpload(i(e.dataTransfer)))}),n.addEventListener(`paste`,e=>{let t=i(e.clipboardData);t.length&&(e.preventDefault(),e.stopPropagation(),this.requestControl(),this.queueFileUpload(t))},!0),this.terminal=e,this.fitAddon=t,this.opened=!0,e.attachCustomKeyEventHandler(t=>{let n=Lf(t,e.modes.applicationCursorKeysMode);return n===null?!0:(t.preventDefault(),t.stopPropagation(),this.prepareScrollExit(),e.input(n,!0),!1)}),e.onKey(()=>this.prepareScrollExit()),e.onData(e=>{if(this.canInput()){let t=this.inputModifiers;t&&(this.inputModifiers=null,t.ctrl&&e.length===1&&(e=String.fromCharCode(e.toUpperCase().charCodeAt(0)&31)),t.alt&&(e=`\u001b${e}`),t.onConsumed()),this.send(`input`,{generation:this.controllerGeneration,data:this.withScrollExit(e)})}}),e.onBinary(e=>{this.canInput()&&this.send(`binary`,{generation:this.controllerGeneration,data:this.withScrollExit(e)})}),e.onTitleChange(e=>this.update({title:e.trim().slice(0,256)})),e.onBell(()=>this.handleBell())}queueFileUpload(e){this.fileTransferQueue=this.fileTransferQueue.catch(()=>void 0).then(()=>this.uploadFiles(e))}async uploadFiles(e){if(!(!e.length||this.disposed)){if(e.length>TA){this.showFileTransferError(`Choose no more than ${TA} files at a time`);return}if(!this.ready||!this.snapshotValue.controller){this.showFileTransferError(this.snapshotValue.controlPending?`taking control; try again in a moment`:`interact with the terminal to take control first`);return}if(!this.canInput()){this.showFileTransferError(`Wait for the terminal resize to finish`);return}this.fileTransferTimer!==null&&(window.clearTimeout(this.fileTransferTimer),this.fileTransferTimer=null),this.update({fileTransfer:{state:`uploading`,message:`Uploading ${e.length===1?`file`:`${e.length} files`}…`}});try{let t=[];for(let n of e)t.push(await aC.uploadTerminalFile(this.terminalId,n));if(this.disposed)return;if(!this.ready||!this.snapshotValue.controller){this.showFileTransferError(`Terminal control was lost during the upload`);return}if(!this.canInput()){this.showFileTransferError(`Wait for the terminal resize to finish`);return}let n=t.join(` `);if(new TextEncoder().encode(n).byteLength>65504){this.showFileTransferError(`The uploaded file paths are too long`);return}this.prepareScrollExit(),this.terminal?.paste(n),this.focus(),this.update({fileTransfer:null})}catch(e){this.disposed||this.showFileTransferError(e instanceof Error?e.message:`File upload failed`)}}}showFileTransferError(e){this.fileTransferTimer!==null&&window.clearTimeout(this.fileTransferTimer),this.update({fileTransfer:{state:`error`,message:`Couldn’t paste file: ${e}`}}),this.fileTransferTimer=window.setTimeout(()=>{this.fileTransferTimer=null,this.update({fileTransfer:null})},6e3)}prepareScrollExit(){this.scrollExitPending&&(this.resumeOnNextInput=!0)}withScrollExit(e){return this.resumeOnNextInput?(this.scrollExitPending=!1,this.resumeOnNextInput=!1,this.wrapper?.classList.remove(`terminal-scrolling`),`${wA}${e}`):e}reconnectImmediately(){if(!this.host||this.disposed||!this.reconnectAllowed||this.ready||this.socket?.connected)return;let e=this.socket;e&&(e.disconnect(),this.socket===e&&(this.socket=null)),this.opened&&this.connect()}connect(){if(this.disposed||!this.reconnectAllowed||this.socket)return;this.ready=!1,this.controlRequestGeneration=null,this.update({phase:`connecting`,controller:!1,controlPending:!1,error:null}),this.startDegradedTimer();let e=nC(`/terminals`,{path:Wk,transports:[`websocket`],forceNew:!0,multiplex:!1,autoConnect:!1,reconnection:!0,reconnectionDelay:100,reconnectionDelayMax:1e3,randomizationFactor:.2,retries:0,query:{terminalProtocol:`2`},auth:e=>{let t=PA(this.proposedDimensions??{cols:this.terminal?.cols??100,rows:this.terminal?.rows??30});e({terminalId:this.terminalId,clientId:LA(),...t})}});this.socket=e,e.on(`connect`,()=>{this.socket===e&&this.fit()}),e.on(`ready`,e=>this.handleServerEvent(`ready`,e)),e.on(`dimensions`,e=>this.handleServerEvent(`dimensions`,e)),e.on(`output`,e=>this.handleServerEvent(`output`,e)),e.on(`title`,e=>this.handleServerEvent(`title`,e)),e.on(`progress`,e=>this.handleServerEvent(`progress`,e)),e.on(`control`,e=>this.handleServerEvent(`control`,e)),e.on(`exit`,e=>this.handleServerEvent(`exit`,e)),e.on(`terminal_error`,e=>this.handleServerEvent(`terminal_error`,e)),e.on(`connect_error`,t=>{this.socket!==e||!this.reconnectAllowed||(this.controlRequestGeneration=null,this.update({phase:`reconnecting`,controller:!1,controlPending:!1,error:`Terminal connection failed: ${t.message}`}))}),e.on(`disconnect`,t=>{if(this.socket!==e)return;let n=this.ready;this.ready=!1,this.streamId=null,this.controllerGeneration=0,this.controlRequestGeneration=null,this.cancelControllerResizeIntent(),this.reconnectAllowed||this.clearDegraded(),this.update({phase:this.reconnectAllowed&&!this.disposed?`reconnecting`:`closed`,controller:!1,controlPending:!1,degraded:this.reconnectAllowed?this.snapshotValue.degraded:!1,error:!n&&!this.snapshotValue.error?`Terminal connection closed: ${t}`:this.snapshotValue.error})}),e.io.on(`reconnect_attempt`,()=>{this.socket===e&&this.reconnectAllowed&&(this.controlRequestGeneration=null,this.startDegradedTimer(),this.update({phase:`reconnecting`,controller:!1,controlPending:!1}))}),e.connect()}handleServerEvent(e,t){if(e===`ready`){let e=uA(`ready`,t);if(!e){this.failProtocol(`The terminal server sent an invalid ready event`);return}this.cancelControllerResizeIntent(),this.controlRequestGeneration=null;let n=`revision`in e;this.serverProtocolVersion=n?2:1;let r=n?{cols:e.cols,rows:e.rows}:PA(this.proposedDimensions??{cols:this.terminal?.cols??100,rows:this.terminal?.rows??30}),i=n?e.revision:1;this.streamId=e.streamId,this.controllerGeneration=e.generation,this.canonicalCols=r.cols,this.canonicalRows=r.rows,this.canonicalRevision=i,this.appliedRevision=n?0:i,this.expectedSequence=1,this.lastParsedSequence=0,this.parsedSequences.clear(),this.ready=!0,this.renderEpoch+=1;let a=this.renderEpoch;this.enqueueRender(a,async()=>{await this.drainTerminalWrites(),!(this.disposed||a!==this.renderEpoch)&&(this.terminal?.reset(),n?this.applyCanonicalDimensions(r.cols,r.rows,i,!0):this.fit(!0))}),this.clearDegraded(),this.update({phase:`ready`,controller:e.controller,controlPending:!1,error:null});return}if(e===`dimensions`){if(this.serverProtocolVersion!==2){this.failProtocol(`The legacy terminal server sent dimensions`);return}let e=uA(`dimensions`,t);if(!e){this.failProtocol(`The terminal server sent invalid dimensions`);return}if(e.revision<=this.canonicalRevision)return;this.canonicalCols=e.cols,this.canonicalRows=e.rows,this.canonicalRevision=e.revision,this.resizePending=!1;let n=this.renderEpoch;this.enqueueRender(n,async()=>{await this.drainTerminalWrites(),!(this.disposed||n!==this.renderEpoch)&&(this.applyCanonicalDimensions(e.cols,e.rows,e.revision),this.flushControllerResize())});return}if(e===`output`){let e=uA(`output`,t);if(!e){this.failProtocol(`The terminal server sent invalid output`);return}this.handleOutput(e.streamId,e.sequence,e.data);return}if(e===`title`){let e=uA(`title`,t);if(!e){this.failProtocol(`The terminal server sent an invalid title`);return}this.update({title:e.title.trim().slice(0,256)});return}if(e===`progress`){uA(`progress`,t)||this.failProtocol(`The terminal server sent invalid progress`);return}if(e===`control`){let e=uA(`control`,t);if(!e){this.failProtocol(`The terminal server sent invalid controller state`);return}let n=e.controller!==this.snapshotValue.controller||e.generation!==this.controllerGeneration;if(n&&this.cancelControllerResizeIntent(),this.controllerGeneration=e.generation,this.controlRequestGeneration=null,this.update({controller:e.controller,controlPending:!1}),e.controller&&this.pendingPaste){let e=this.pendingPaste;this.pendingPaste=``,this.terminal?.paste(e)}n&&this.scheduleFit();return}if(e===`exit`){if(!uA(`exit`,t)){this.failProtocol(`The terminal server sent an invalid exit event`);return}this.update({exitSerial:this.snapshotValue.exitSerial+1});return}let n=uA(`terminal_error`,t);if(!n){this.failProtocol(`The terminal server sent an invalid error event`);return}this.reconnectAllowed=n.retryable,this.terminal?.writeln(`\r\n\x1b[31m${n.message}\x1b[0m`),n.retryable?(this.controlRequestGeneration=null,this.update({controlPending:!1,error:n.message})):(this.stopWithError(n.message),this.socket?.disconnect())}handleOutput(e,t,n){if(!this.ready||e!==this.streamId||t!==this.expectedSequence){this.failProtocol(`Terminal output arrived out of order`);return}this.expectedSequence+=1;let r=this.renderEpoch;this.enqueueRender(r,()=>{let i=this.terminal;i&&(this.pendingTerminalWrites+=1,i.write(n,()=>{if(this.pendingTerminalWrites=Math.max(0,this.pendingTerminalWrites-1),this.ready&&r===this.renderEpoch&&e===this.streamId){for(this.parsedSequences.add(t);this.parsedSequences.delete(this.lastParsedSequence+1);)this.lastParsedSequence+=1;this.send(`output_ack`,{streamId:e,sequence:this.lastParsedSequence})}}))})}async drainTerminalWrites(){let e=this.terminal;!e||this.pendingTerminalWrites===0||await new Promise(t=>e.write(``,t))}enqueueRender(e,t){let n=this.renderQueue.then(async()=>{this.disposed||this.renderFailed||e!==this.renderEpoch||await t()});this.renderQueue=n,n.catch(e=>this.failRendering(e))}applyCanonicalDimensions(e,t,n,r=!1){!this.terminal||n<=this.appliedRevision||(this.terminal.resize(e,t),this.appliedRevision=n,this.wrapper&&(this.wrapper.dataset.terminalCols=String(e),this.wrapper.dataset.terminalRows=String(t),this.wrapper.dataset.terminalRevision=String(n)),n===this.canonicalRevision&&this.fit(r))}canInput(){return this.ready&&this.snapshotValue.controller&&!this.resizePending&&this.appliedRevision===this.canonicalRevision}send(e,t){if(!(!this.socket?.connected||!this.ready)){if(e===`output_ack`||e===`resize`||e===`take_control`){this.socket.emit(e,t);return}this.socket.volatile.emit(e,t)}}scheduleFit(){this.resizeFrame!==null&&cancelAnimationFrame(this.resizeFrame),this.resizeFrame=requestAnimationFrame(()=>{this.resizeFrame=null,this.fit(!0)})}queueControllerResizeIntent(){this.resizeSettleTimer!==null&&window.clearTimeout(this.resizeSettleTimer),this.resizeIntentDirty=!0,this.resizeQuietElapsed=!1,this.resizeIntentGeneration=this.controllerGeneration,this.resizeSettleTimer=window.setTimeout(()=>{this.resizeSettleTimer=null,this.resizeQuietElapsed=!0,this.flushControllerResize()},jA)}flushControllerResize(){let e=this.proposedDimensions;if(!(!this.resizeIntentDirty||!this.resizeQuietElapsed||!e||!this.host||!this.ready||!this.socket?.connected||!this.snapshotValue.controller||this.resizeIntentGeneration!==this.controllerGeneration||this.appliedRevision!==this.canonicalRevision||this.resizePending)){if(e.cols===this.canonicalCols&&e.rows===this.canonicalRows){this.resizeIntentDirty=!1,this.resizeQuietElapsed=!1;return}this.resizeIntentDirty=!1,this.resizeQuietElapsed=!1,this.serverProtocolVersion===2?this.resizePending=!0:(this.canonicalCols=e.cols,this.canonicalRows=e.rows,this.appliedRevision=this.canonicalRevision),this.send(`resize`,{generation:this.controllerGeneration,cols:e.cols,rows:e.rows})}}cancelControllerResizeIntent(e=!0){this.resizeSettleTimer!==null&&window.clearTimeout(this.resizeSettleTimer),this.resizeSettleTimer=null,e&&(this.resizePending=!1),this.resizeIntentDirty=!1,this.resizeQuietElapsed=!1,this.resizeIntentGeneration=0,this.proposedDimensions=null}fit(e=!1){if(!(!this.host||!this.fitAddon||!this.terminal))try{if(!this.ready){this.terminal.options.fontSize=14,this.fitAddon.fit(),this.terminal.cols>=DA&&this.terminal.rows>=kA&&(this.proposedDimensions=PA({cols:this.terminal.cols,rows:this.terminal.rows}));return}if(this.serverProtocolVersion===1){if(this.terminal.options.fontSize=14,this.fitAddon.fit(),this.terminal.cols<DA||this.terminal.rows<kA){this.cancelControllerResizeIntent(!1);return}let t=PA({cols:this.terminal.cols,rows:this.terminal.rows});this.proposedDimensions=t,this.snapshotValue.controller&&e&&this.queueControllerResizeIntent();return}if(this.appliedRevision!==this.canonicalRevision)return;this.terminal.options.fontSize=14;let t=this.fitAddon.proposeDimensions();if(!t||!Number.isFinite(t.cols)||!Number.isFinite(t.rows)||t.cols<DA||t.rows<kA){this.snapshotValue.controller&&this.cancelControllerResizeIntent(!1);return}let n=PA(t);if(this.proposedDimensions=n,this.snapshotValue.controller){if(!e)return;if(!this.resizePending&&n.cols===this.canonicalCols&&n.rows===this.canonicalRows){this.resizeSettleTimer!==null&&window.clearTimeout(this.resizeSettleTimer),this.resizeSettleTimer=null,this.resizeIntentDirty=!1,this.resizeQuietElapsed=!1;return}this.queueControllerResizeIntent();return}let r=Math.min(1,n.cols/this.canonicalCols,n.rows/this.canonicalRows);this.terminal.options.fontSize=Math.max(EA,Math.floor(14*r*100)/100),(this.terminal.cols!==this.canonicalCols||this.terminal.rows!==this.canonicalRows)&&this.terminal.resize(this.canonicalCols,this.canonicalRows)}catch(e){this.failRendering(e)}}startDegradedTimer(){this.degradedTimer===null&&(this.degradedTimer=window.setTimeout(()=>{this.degradedTimer=null,this.ready||this.update({degraded:!0})},500))}clearDegraded(){this.degradedTimer!==null&&window.clearTimeout(this.degradedTimer),this.degradedTimer=null,this.update({degraded:!1})}handleBell(){let e=Date.now();e-this.lastBellAt<1e3||(this.lastBellAt=e,this.bellTimer!==null&&window.clearTimeout(this.bellTimer),this.update({bellActive:!0,bellSerial:this.snapshotValue.bellSerial+1}),this.bellTimer=window.setTimeout(()=>{this.bellTimer=null,this.update({bellActive:!1})},180))}failRendering(e){if(this.renderFailed||this.disposed)return;this.renderFailed=!0;let t=(e instanceof Error?e.message:String(e)).trim();this.reconnectAllowed=!1,this.stopWithError(t?`Terminal rendering failed: ${t.slice(0,500)}`:`Terminal rendering failed`),this.socket?.disconnect()}failProtocol(e){this.reconnectAllowed=!1,this.stopWithError(e),this.socket?.disconnect()}stopWithError(e){this.ready=!1,this.clearDegraded(),this.controlRequestGeneration=null,this.update({error:e,phase:`closed`,degraded:!1,controller:!1,controlPending:!1})}update(e){this.snapshotValue={...this.snapshotValue,...e},this.listeners.forEach(e=>e())}clearTimers(){this.degradedTimer!==null&&window.clearTimeout(this.degradedTimer),this.bellTimer!==null&&window.clearTimeout(this.bellTimer),this.fileTransferTimer!==null&&window.clearTimeout(this.fileTransferTimer),this.resizeFrame!==null&&cancelAnimationFrame(this.resizeFrame),this.resizeSettleTimer!==null&&window.clearTimeout(this.resizeSettleTimer),this.degradedTimer=null,this.bellTimer=null,this.fileTransferTimer=null,this.resizeFrame=null,this.resizeSettleTimer=null,this.resizePending=!1,this.resizeIntentDirty=!1,this.resizeQuietElapsed=!1,this.resizeIntentGeneration=0,this.proposedDimensions=null}},zA=class{maxSessions;idleMs;createSession;onTitleChange;entries=new Map;constructor(e=8,t=5*6e4,n=e=>new RA(e),r=()=>void 0){this.maxSessions=e,this.idleMs=t,this.createSession=n,this.onTitleChange=r}getInitialSize(e){return this.entries.get(e)?.session.getInitialSize()??null}acquire(e){let t=this.entries.get(e);if(!t){let n=this.createSession(e);t={session:n,references:0,lastUsed:Date.now(),idleTimer:null,lastTitle:n.getSnapshot().title,unsubscribe:()=>void 0};let r=t;t.unsubscribe=n.subscribe(()=>{let t=n.getSnapshot();t.title!==r.lastTitle&&(r.lastTitle=t.title,this.onTitleChange(e,t.title))}),this.entries.set(e,t),t.lastTitle&&this.onTitleChange(e,t.lastTitle)}return t.references+=1,t.lastUsed=Date.now(),t.idleTimer!==null&&window.clearTimeout(t.idleTimer),t.idleTimer=null,this.evictOverCapacity(e),t.session}release(e){let t=this.entries.get(e);t&&(t.references=Math.max(0,t.references-1),t.lastUsed=Date.now(),t.references===0&&t.idleTimer===null&&(t.idleTimer=window.setTimeout(()=>this.disposeEntry(e),this.idleMs)))}forget(e){this.disposeEntry(e)}reconcile(e){let t=new Set(e);for(let e of this.entries.keys())t.has(e)||this.disposeEntry(e)}disposeEntry(e){let t=this.entries.get(e);t&&(t.idleTimer!==null&&window.clearTimeout(t.idleTimer),t.unsubscribe(),t.session.dispose(),this.entries.delete(e))}evictOverCapacity(e){for(;this.entries.size>this.maxSessions;){let t=[...this.entries.entries()].filter(([t,n])=>t!==e&&n.references===0).sort((e,t)=>e[1].lastUsed-t[1].lastUsed)[0];if(!t)return;this.disposeEntry(t[0])}}},BA=class{sendBellAcknowledgement;listeners=new Set;bellEventListeners=new Set;attentionSnapshot=new Set;titleSnapshot=new Map;foregroundProcessSnapshot=new Set;progressSnapshot=new Map;bellMetadata=new Map;bellAcknowledgementTargets=new Map;bellAcknowledgementQueues=new Map;bellAcknowledgementEpoch=0;notificationBatchDepth=0;notificationPending=!1;constructor(e=(e,t)=>aC.acknowledgeTerminalBell(e,t)){this.sendBellAcknowledgement=e}subscribe=e=>(this.listeners.add(e),()=>this.listeners.delete(e));subscribeBellEvents=e=>(this.bellEventListeners.add(e),()=>this.bellEventListeners.delete(e));getAttentionSnapshot=()=>this.attentionSnapshot;getBellSnapshot=()=>this.bellMetadata;getTitleSnapshot=()=>this.titleSnapshot;getForegroundProcessSnapshot=()=>this.foregroundProcessSnapshot;getProgressSnapshot=()=>this.progressSnapshot;applyRuntimeMetadata(e){this.notificationBatchDepth+=1;let t=this.bellMetadata.get(e.terminalId),n=e.bell,r=n!==null&&(!t||n.sequence>t.sequence||n.sequence===t.sequence&&(t.unread||!n.unread)),i=r&&(t?.sequence!==n.sequence||t?.at!==n.at||t?.unread!==n.unread),a=r&&n.unread&&(!t||n.sequence>t.sequence)?{terminalId:e.terminalId,sequence:n.sequence,at:n.at}:null;if(r){if(i){let t=new Map(this.bellMetadata);t.set(e.terminalId,{sequence:n.sequence,at:n.at,unread:n.unread}),this.bellMetadata=t,this.emit()}this.setAttention(e.terminalId,n.unread)}else!t&&n===null&&this.setAttention(e.terminalId,!1);this.setRuntimeTitle(e.terminalId,e.title),this.setForegroundProcess(e.terminalId,e.hasForegroundProcess===!0),this.setProgress(e.terminalId,e.progress),--this.notificationBatchDepth,this.notificationBatchDepth===0&&this.notificationPending&&(this.notificationPending=!1,this.listeners.forEach(e=>e())),a&&this.bellEventListeners.forEach(e=>e(a))}replaceRuntimeMetadata(e){let t=new Map,n=new Set,r=new Map,i=new Map,a=new Set;for(let o of e){let e=o.title?.trim().slice(0,256);if(e&&t.set(o.terminalId,e),o.hasForegroundProcess&&n.add(o.terminalId),o.progress){let e=this.progressSnapshot.get(o.terminalId);r.set(o.terminalId,e?.state===o.progress.state&&e.value===o.progress.value?e:o.progress)}o.bell&&(i.set(o.terminalId,{sequence:o.bell.sequence,at:o.bell.at,unread:o.bell.unread}),o.bell.unread&&a.add(o.terminalId))}let o=t.size!==this.titleSnapshot.size||[...t].some(([e,t])=>this.titleSnapshot.get(e)!==t),s=n.size!==this.foregroundProcessSnapshot.size||[...n].some(e=>!this.foregroundProcessSnapshot.has(e)),c=r.size!==this.progressSnapshot.size||[...r].some(([e,t])=>{let n=this.progressSnapshot.get(e);return n?.state!==t.state||n.value!==t.value}),l=a.size!==this.attentionSnapshot.size||[...a].some(e=>!this.attentionSnapshot.has(e)),u=i.size!==this.bellMetadata.size||[...i].some(([e,t])=>{let n=this.bellMetadata.get(e);return n?.sequence!==t.sequence||n?.at!==t.at||n?.unread!==t.unread});u&&(this.bellMetadata=i),this.bellAcknowledgementEpoch+=1,this.bellAcknowledgementTargets.clear(),o&&(this.titleSnapshot=t),s&&(this.foregroundProcessSnapshot=n),c&&(this.progressSnapshot=r),l&&(this.attentionSnapshot=a),(o||s||c||l||u)&&this.emit()}setRuntimeTitle(e,t){let n=t?.trim().slice(0,256)||null;if(n===null){this.clearRuntimeTitle(e);return}this.titleSnapshot.get(e)!==n&&(this.titleSnapshot=new Map(this.titleSnapshot).set(e,n),this.emit())}forget(e){if(this.bellMetadata.has(e)){let t=new Map(this.bellMetadata);t.delete(e),this.bellMetadata=t,this.emit()}this.bellAcknowledgementTargets.delete(e),this.bellAcknowledgementQueues.delete(e),this.clearAttention(e),this.clearRuntimeTitle(e),this.setForegroundProcess(e,!1),this.setProgress(e,null)}reconcile(e){let t=new Set(e),n=!1,r=new Set(this.attentionSnapshot),i=new Map(this.titleSnapshot),a=new Set(this.foregroundProcessSnapshot),o=new Map(this.progressSnapshot);for(let e of r)t.has(e)||(r.delete(e),n=!0);for(let e of i.keys())t.has(e)||(i.delete(e),n=!0);for(let e of a)t.has(e)||(a.delete(e),n=!0);for(let e of o.keys())t.has(e)||(o.delete(e),n=!0);let s=new Map(this.bellMetadata);for(let e of s.keys())t.has(e)||(s.delete(e),this.bellAcknowledgementTargets.delete(e),this.bellAcknowledgementQueues.delete(e),n=!0);n&&(this.attentionSnapshot=r,this.titleSnapshot=i,this.foregroundProcessSnapshot=a,this.progressSnapshot=o,this.bellMetadata=s,this.emit())}acknowledgeBell(e,t){let n=this.bellMetadata.get(e);if(!n?.unread||n.sequence!==t)return Promise.resolve();let r=this.bellAcknowledgementTargets.get(e)??0,i=this.bellAcknowledgementQueues.get(e);if(t<=r)return i??Promise.resolve();let a=this.bellAcknowledgementEpoch;this.bellAcknowledgementTargets.set(e,t);let o=(i??Promise.resolve()).catch(()=>void 0).then(async()=>{let n=this.bellMetadata.get(e);if(this.bellAcknowledgementEpoch!==a||n?.sequence!==t||!n.unread){this.bellAcknowledgementTargets.get(e)===t&&this.bellAcknowledgementTargets.delete(e);return}await this.sendBellAcknowledgement(e,t)}).catch(n=>{throw this.bellAcknowledgementTargets.get(e)===t&&this.bellAcknowledgementTargets.delete(e),n}).finally(()=>{this.bellAcknowledgementQueues.get(e)===o&&this.bellAcknowledgementQueues.delete(e)});return this.bellAcknowledgementQueues.set(e,o),o}clearAttention(e){if(!this.attentionSnapshot.has(e))return;let t=new Set(this.attentionSnapshot);t.delete(e),this.attentionSnapshot=t,this.emit()}clearRuntimeTitle(e){if(!this.titleSnapshot.has(e))return;let t=new Map(this.titleSnapshot);t.delete(e),this.titleSnapshot=t,this.emit()}setForegroundProcess(e,t){if(this.foregroundProcessSnapshot.has(e)===t)return;let n=new Set(this.foregroundProcessSnapshot);t?n.add(e):n.delete(e),this.foregroundProcessSnapshot=n,this.emit()}setAttention(e,t){if(t||this.bellAcknowledgementTargets.delete(e),this.attentionSnapshot.has(e)===t)return;let n=new Set(this.attentionSnapshot);t?n.add(e):n.delete(e),this.attentionSnapshot=n,this.emit()}setProgress(e,t){let n=this.progressSnapshot.get(e);if(t&&n?.state===t.state&&n.value===t.value||!t&&!n)return;let r=new Map(this.progressSnapshot);t?r.set(e,t):r.delete(e),this.progressSnapshot=r,this.emit()}emit(){if(this.notificationBatchDepth>0){this.notificationPending=!0;return}this.listeners.forEach(e=>e())}},VA=new class{pool;runtimeMetadata;constructor(e=8,t=5*6e4,n=e=>new RA(e),r){this.runtimeMetadata=new BA(r),this.pool=new zA(e,t,n,(e,t)=>this.runtimeMetadata.setRuntimeTitle(e,t))}subscribe=e=>this.runtimeMetadata.subscribe(e);subscribeBellEvents=e=>this.runtimeMetadata.subscribeBellEvents(e);getAttentionSnapshot=()=>this.runtimeMetadata.getAttentionSnapshot();getBellSnapshot=()=>this.runtimeMetadata.getBellSnapshot();getTitleSnapshot=()=>this.runtimeMetadata.getTitleSnapshot();getForegroundProcessSnapshot=()=>this.runtimeMetadata.getForegroundProcessSnapshot();getProgressSnapshot=()=>this.runtimeMetadata.getProgressSnapshot();getInitialSize(e){return this.pool.getInitialSize(e)}applyRuntimeMetadata(e){this.runtimeMetadata.applyRuntimeMetadata(e)}replaceRuntimeMetadata(e){this.runtimeMetadata.replaceRuntimeMetadata(e)}acquire(e){return this.pool.acquire(e)}release(e){this.pool.release(e)}forget(e){this.pool.forget(e),this.runtimeMetadata.forget(e)}reconcile(e){let t=[...e].map(e=>e.id);this.pool.reconcile(t),this.runtimeMetadata.reconcile(t)}acknowledgeBell(e,t){return this.runtimeMetadata.acknowledgeBell(e,t)}},HA=new Set,UA=new Map,WA=new Map,GA=new Map,KA={attention:HA,titles:UA,progress:WA},qA={bells:GA,titles:UA},JA=KA,YA=qA;function XA(){let e=VA.getAttentionSnapshot(),t=VA.getTitleSnapshot(),n=VA.getProgressSnapshot();return(JA.attention!==e||JA.titles!==t||JA.progress!==n)&&(JA={attention:e,titles:t,progress:n}),JA}function ZA(){let e=VA.getBellSnapshot(),t=VA.getTitleSnapshot();return(YA.bells!==e||YA.titles!==t)&&(YA={bells:e,titles:t}),YA}function QA(e){let t=(0,B.useCallback)(()=>e?VA.getForegroundProcessSnapshot().has(e):!1,[e]);return(0,B.useSyncExternalStore)(VA.subscribe,t,()=>!1)}function $A(){return(0,B.useSyncExternalStore)(VA.subscribe,XA,()=>KA)}function ej(){return(0,B.useSyncExternalStore)(VA.subscribe,ZA,()=>qA)}function tj(e){return e instanceof Error?e.message:String(e)}function nj(e){Na.error(tj(e))}var rj=`treeport-last-workspace-route`,ij=`treeport-last-project-terminal:`;function aj(e){return encodeURIComponent(e)}function oj(e){return{kind:`project`,pathname:`/projects/${aj(e)}`,projectId:e}}function sj(e,t){return{kind:`worktree`,pathname:`/projects/${aj(e)}/worktrees/${aj(t)}`,projectId:e,worktreeId:t}}function cj(e,t,n){return{kind:`terminal`,pathname:`/projects/${aj(e)}/worktrees/${aj(t)}/terminals/${aj(n)}`,projectId:e,worktreeId:t,terminalId:n}}function lj(e){let t=e.worktrees[0];if(!t)return oj(e.id);let n=t.terminals[0];return n?cj(e.id,t.id,n.id):sj(e.id,t.id)}function uj(e,t){if(t)for(let n of e.worktrees){let r=n.terminals.find(e=>e.id===t);if(r)return cj(e.id,n.id,r.id)}return lj(e)}function dj(e,t){let n=t.terminals[0];return n?cj(e.id,t.id,n.id):sj(e.id,t.id)}function fj(e,t){for(let n of e){let e=n.worktrees.find(e=>e.id===t.worktreeId);if(e?.terminals.some(e=>e.id===t.id))return cj(n.id,e.id,t.id)}return null}function pj(e,t,n){let r=e.find(e=>e.id===t.projectId&&e.worktrees.some(e=>e.id===t.id));if(!r)return null;let i=t.terminals.find(e=>e.id===n)??t.terminals[0];return i?cj(r.id,t.id,i.id):sj(r.id,t.id)}function mj(e,t){if(t.kind===`root`)return{project:null,worktree:null,terminal:null};let n=e.find(e=>e.id===t.projectId)??null;if(!n||t.kind===`project`)return{project:n,worktree:null,terminal:null};let r=n.worktrees.find(e=>e.id===t.worktreeId)??null;return!r||t.kind===`worktree`?{project:n,worktree:r,terminal:null}:{project:n,worktree:r,terminal:r.terminals.find(e=>e.id===t.terminalId)??null}}function hj(e){try{return decodeURIComponent(e)}catch{return null}}function gj(e){if(e===`/`)return{kind:`root`,pathname:`/`};let t=e.split(`/`).filter(Boolean);if(t[0]!==`projects`)return null;let n=t[1]?hj(t[1]):null;if(!n)return null;if(t.length===2)return oj(n);if(t[2]!==`worktrees`)return null;let r=t[3]?hj(t[3]):null;if(!r)return null;if(t.length===4)return sj(n,r);if(t[4]!==`terminals`)return null;let i=t[5]?hj(t[5]):null;return!i||t.length!==6?null:cj(n,r,i)}function _j(e){return e[0]?lj(e[0]):{kind:`root`,pathname:`/`}}function vj(e,t){if(!t||t.kind===`root`)return _j(e);let n=e.find(e=>e.id===t.projectId);if(!n)return _j(e);if(t.kind===`project`)return n.worktrees.length?lj(n):oj(n.id);let r=n.worktrees.find(e=>e.id===t.worktreeId);if(!r)return n.worktrees[0]?dj(n,n.worktrees[0]):oj(n.id);if(t.kind===`worktree`)return dj(n,r);let i=r.terminals.find(e=>e.id===t.terminalId);return i?cj(n.id,r.id,i.id):r.terminals[0]?cj(n.id,r.id,r.terminals[0].id):sj(n.id,r.id)}function yj(e,t,n){let r=gj(t),i;if(r?.kind===`root`&&e.length&&n){let t=gj(n);i=t?.kind!==`root`&&e.some(e=>e.id===t?.projectId)?vj(e,t):_j(e)}else i=vj(e,r);return{target:i,selection:mj(e,i),canonical:i.pathname===t}}function bj(e,t){return`bell:${e}:${t}`}function xj(e,t,n){for(let r of e)for(let e of r.worktrees){let i=e.terminals.find(e=>e.id===n);if(i)return{projectName:r.name,worktreeName:e.name,terminal:i,title:t.get(n)??i.name}}return null}function Sj({projects:e,projectsLoaded:t,selectedTerminalId:n,navigateToWorkspace:r}){let{bells:i,titles:a}=ej(),[o,s]=(0,B.useState)(()=>({focused:document.hasFocus(),visible:document.visibilityState===`visible`})),c=(0,B.useRef)({projects:e,projectsLoaded:t,selectedTerminalId:n,runtimeTitles:a,navigateToWorkspace:r,presence:o});c.current={projects:e,projectsLoaded:t,selectedTerminalId:n,runtimeTitles:a,navigateToWorkspace:r,presence:o};let l=(0,B.useRef)(new Map),u=(0,B.useRef)(new Map),d=(0,B.useRef)(()=>void 0);return(0,B.useEffect)(()=>{let e=()=>{let e={focused:document.hasFocus(),visible:document.visibilityState===`visible`};c.current.presence=e,s(t=>t.focused===e.focused&&t.visible===e.visible?t:e)};return document.addEventListener(`visibilitychange`,e),window.addEventListener(`focus`,e),window.addEventListener(`blur`,e),()=>{document.removeEventListener(`visibilitychange`,e),window.removeEventListener(`focus`,e),window.removeEventListener(`blur`,e)}},[]),(0,B.useEffect)(()=>{if(!o.focused||!o.visible||!n)return;let e=l.current.get(n);e!==void 0&&Na.dismiss(bj(n,e));let t=i.get(n);t?.unread&&VA.acknowledgeBell(n,t.sequence).catch(nj)},[i,o.focused,o.visible,n]),(0,B.useEffect)(()=>{let e=(t,n,r=!1)=>{let i=l.current.get(n.terminalId);l.current.set(n.terminalId,n.sequence),i!==void 0&&i!==n.sequence&&Na.dismiss(bj(n.terminalId,i));let a=bj(n.terminalId,n.sequence),o=`${t.projectName} · ${t.worktreeName}`;Na.custom(()=>(0,V.jsxs)(`div`,{className:`w-(--width) max-w-[calc(100vw-2rem)] rounded-lg border border-white/10 bg-zinc-900 p-3.5 text-zinc-100`,children:[(0,V.jsx)(`p`,{className:`m-0 truncate text-sm font-medium`,children:t.title}),(0,V.jsxs)(`div`,{className:`flex flex-col gap-0.5`,children:[(0,V.jsx)(`p`,{className:`m-0 truncate text-sm text-zinc-400`,children:o}),r?(0,V.jsx)(`p`,{className:`m-0 text-sm text-amber-300`,children:`Couldn’t dismiss this notification.`}):null,(0,V.jsxs)(`div`,{className:`flex justify-end gap-1.5 pt-2.5`,children:[(0,V.jsx)(q,{size:`sm`,variant:`ghost`,onClick:()=>{Na.dismiss(a),VA.acknowledgeBell(n.terminalId,n.sequence).catch(t=>{nj(t);let r=VA.getBellSnapshot().get(n.terminalId),i=xj(c.current.projects,c.current.runtimeTitles,n.terminalId);r?.unread&&r.sequence===n.sequence&&i&&e(i,n,!0)})},children:r?`Try again`:`Dismiss`}),(0,V.jsx)(q,{size:`sm`,onClick:()=>{Na.dismiss(a);let e=fj(c.current.projects,t.terminal);e&&c.current.navigateToWorkspace(e)},children:`View`})]})]})]}),{id:a,duration:1/0,dismissible:!0,onDismiss:()=>{l.current.get(n.terminalId)===n.sequence&&l.current.delete(n.terminalId)}})},t=t=>{let n=c.current,r=xj(n.projects,VA.getTitleSnapshot(),t.terminalId);if(!r){n.projectsLoaded||u.current.set(t.terminalId,t);return}if(u.current.delete(t.terminalId),n.selectedTerminalId===t.terminalId&&n.presence.focused&&n.presence.visible){VA.acknowledgeBell(t.terminalId,t.sequence).catch(nj);return}e(r,t),window.treeportDesktop?.requestAttention()};d.current=t;let n=VA.subscribeBellEvents(t);return()=>{d.current=()=>void 0,n()}},[]),(0,B.useEffect)(()=>{if(t)for(let e of u.current.values()){let t=i.get(e.terminalId);t?.unread&&t.sequence===e.sequence?d.current(e):u.current.delete(e.terminalId)}},[i,t]),null}var Cj=Object.defineProperty,wj=(e,t)=>Cj(e,`name`,{value:t,configurable:!0}),Tj=!!(typeof window<`u`&&window.document&&window.document.createElement);function Ej(e,t,{checkForDefaultPrevented:n=!0}={}){return wj(function(r){if(e?.(r),n===!1||!r||!r.defaultPrevented)return t?.(r)},`handleEvent`)}wj(Ej,`composeEventHandlers`);function Dj(e){if(!Tj)throw Error(`Cannot access window outside of the DOM`);return e?.ownerDocument?.defaultView??window}wj(Dj,`getOwnerWindow`);function Oj(e){if(!Tj)throw Error(`Cannot access document outside of the DOM`);return e?.ownerDocument??document}wj(Oj,`getOwnerDocument`);function kj(e,t=!1){let{activeElement:n}=Oj(e);if(!n?.nodeName)return null;if(Aj(n)&&n.contentDocument)return kj(n.contentDocument.body,t);if(t){let e=n.getAttribute(`aria-activedescendant`);if(e){let t=Oj(n).getElementById(e);if(t)return t}}return n}wj(kj,`getActiveElement`);function Aj(e){return e.tagName===`IFRAME`}wj(Aj,`isFrame`);var jj=Object.defineProperty,Mj=(e,t)=>jj(e,`name`,{value:t,configurable:!0});function Nj(e,t){let n=B.createContext(t);n.displayName=e+`Context`;let r=Mj(e=>{let{children:t,...r}=e,i=B.useMemo(()=>r,Object.values(r));return(0,V.jsx)(n.Provider,{value:i,children:t})},`Provider`);r.displayName=e+`Provider`;function i(r,i={}){let{optional:a=!1}=i,o=B.useContext(n);if(o)return o;if(t!==void 0)return t;if(!a)throw Error(`\`${r}\` must be used within \`${e}\``)}return Mj(i,`useContext`),[r,i]}Mj(Nj,`createContext`);function Pj(e,t=[]){let n=[];function r(t,r){let i=B.createContext(r);i.displayName=t+`Context`;let a=n.length;n=[...n,r];let o=Mj(t=>{let{scope:n,children:r,...o}=t,s=n?.[e]?.[a]||i,c=B.useMemo(()=>o,Object.values(o));return(0,V.jsx)(s.Provider,{value:c,children:r})},`Provider`);o.displayName=t+`Provider`;function s(n,o,s={}){let{optional:c=!1}=s,l=o?.[e]?.[a]||i,u=B.useContext(l);if(u)return u;if(r!==void 0)return r;if(!c)throw Error(`\`${n}\` must be used within \`${t}\``)}return Mj(s,`useContext`),[o,s]}Mj(r,`createContext`);let i=Mj(()=>{let t=n.map(e=>B.createContext(e));return Mj(function(n){let r=n?.[e]||t;return B.useMemo(()=>({[`__scope${e}`]:{...n,[e]:r}}),[n,r])},`useScope`)},`createScope`);return i.scopeName=e,[r,Fj(i,...t)]}Mj(Pj,`createContextScope`);function Fj(...e){let t=e[0];if(e.length===1)return t;let n=Mj(()=>{let n=e.map(e=>({useScope:e(),scopeName:e.scopeName}));return Mj(function(e){let r=n.reduce((t,{useScope:n,scopeName:r})=>{let i=n(e)[`__scope${r}`];return{...t,...i}},{});return B.useMemo(()=>({[`__scope${t.scopeName}`]:r}),[r])},`useComposedScopes`)},`createScope`);return n.scopeName=t.scopeName,n}Mj(Fj,`composeContextScopes`);var Ij=globalThis?.document?B.useLayoutEffect:()=>{},Lj=Object.defineProperty,Rj=(e,t)=>Lj(e,`name`,{value:t,configurable:!0}),zj=B.useId||(()=>void 0),Bj=0;function Vj(e){let[t,n]=B.useState(zj());return Ij(()=>{e||n(e=>e??String(Bj++))},[e]),e||(t?`radix-${t}`:``)}Rj(Vj,`useId`);var Hj=Object.defineProperty,Uj=(e,t)=>Hj(e,`name`,{value:t,configurable:!0}),Wj=B.useEffectEvent,Gj=B.useInsertionEffect;function Kj(e){if(typeof Wj==`function`)return Wj(e);let t=B.useRef(()=>{throw Error(`Cannot call an event handler while rendering.`)});return typeof Gj==`function`?Gj(()=>{t.current=e}):Ij(()=>{t.current=e}),B.useMemo(()=>((...e)=>t.current?.(...e)),[])}Uj(Kj,`useEffectEvent`);var qj=Object.defineProperty,Jj=(e,t)=>qj(e,`name`,{value:t,configurable:!0}),Yj=B.useInsertionEffect||Ij;function Xj({prop:e,defaultProp:t,onChange:n=Jj(()=>{},`onChange`),caller:r}){let[i,a,o]=Zj({defaultProp:t,onChange:n}),s=e!==void 0;return[s?e:i,B.useCallback(t=>{if(s){let n=Qj(t)?t(e):t;n!==e&&o.current?.(n)}else a(t)},[s,e,a,o])]}Jj(Xj,`useControllableState`);function Zj({defaultProp:e,onChange:t}){let[n,r]=B.useState(e),i=B.useRef(n),a=B.useRef(t);return Yj(()=>{a.current=t},[t]),B.useEffect(()=>{i.current!==n&&(a.current?.(n),i.current=n)},[n,i]),[n,r,a]}Jj(Zj,`useUncontrolledState`);function Qj(e){return typeof e==`function`}Jj(Qj,`isFunction`);var $j=Symbol(`RADIX:SYNC_STATE`);function eM(e,t,n,r){let{prop:i,defaultProp:a,onChange:o,caller:s}=t,c=i!==void 0,l=Kj(o),u=[{...n,state:a}];r&&u.push(r);let[d,f]=B.useReducer((t,n)=>{if(n.type===$j)return{...t,state:n.state};let r=e(t,n);return c&&!Object.is(r.state,t.state)&&l(r.state),r},...u),p=d.state,m=B.useRef(p);B.useEffect(()=>{m.current!==p&&(m.current=p,c||l(p))},[p,m,c]);let h=B.useMemo(()=>i===void 0?d:{...d,state:i},[d,i]);return B.useEffect(()=>{c&&!Object.is(i,d.state)&&f({type:$j,state:i})},[i,d.state,c]),[h,f]}Jj(eM,`useControllableStateReducer`);var tM=Object.defineProperty,nM=(e,t)=>tM(e,`name`,{value:t,configurable:!0}),rM=[`a`,`button`,`div`,`form`,`h2`,`h3`,`img`,`input`,`label`,`li`,`nav`,`ol`,`p`,`select`,`span`,`svg`,`ul`].reduce((e,t)=>{let n=mf(`Primitive.${t}`),r=B.forwardRef((e,r)=>{let{asChild:i,...a}=e,o=i?n:t;return typeof window<`u`&&(window[Symbol.for(`radix-ui`)]=!0),(0,V.jsx)(o,{...a,ref:r})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function iM(e,t){e&&Pi.flushSync(()=>e.dispatchEvent(t))}nM(iM,`dispatchDiscreteCustomEvent`);var aM=Object.defineProperty,oM=(e,t)=>aM(e,`name`,{value:t,configurable:!0});function sM(e){let t=B.useRef(e);return B.useEffect(()=>{t.current=e}),B.useMemo(()=>((...e)=>t.current?.(...e)),[])}oM(sM,`useCallbackRef`);var cM=Object.defineProperty,lM=(e,t)=>cM(e,`name`,{value:t,configurable:!0}),uM=`dismissableLayer.update`,dM=`dismissableLayer.pointerDownOutside`,fM=`dismissableLayer.focusOutside`,pM,mM=B.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set,dismissableSurfaces:new Set}),hM=B.forwardRef(lM(function(e,t){let{disableOutsidePointerEvents:n=!1,deferPointerDownOutside:r=!1,onEscapeKeyDown:i,onPointerDownOutside:a,onFocusOutside:o,onInteractOutside:s,onDismiss:c,...l}=e,u=B.useContext(mM),[d,f]=B.useState(null),p=d?.ownerDocument??globalThis?.document,[,m]=B.useState({}),h=df(t,f),g=Array.from(u.layers),[_]=[...u.layersWithOutsidePointerEventsDisabled].slice(-1),v=_?g.indexOf(_):-1,y=d?g.indexOf(d):-1,b=u.layersWithOutsidePointerEventsDisabled.size>0,x=y>=v,S=B.useRef(!1),C=vM(e=>{a?.(e),s?.(e),e.defaultPrevented||c?.()},{ownerDocument:p,deferPointerDownOutside:r,isDeferredPointerDownOutsideRef:S,dismissableSurfaces:u.dismissableSurfaces,shouldHandlePointerDownOutside:B.useCallback(e=>{if(!(e instanceof Node))return!1;let t=[...u.branches].some(t=>t.contains(e));return x&&!t},[u.branches,x])}),w=yM(e=>{if(r&&S.current)return;let t=e.target;[...u.branches].some(e=>e.contains(t))||(o?.(e),s?.(e),e.defaultPrevented||c?.())},p),T=d?y===g.length-1:!1,E=sM(e=>{e.key===`Escape`&&(i?.(e),!e.defaultPrevented&&c&&(e.preventDefault(),c()))});return B.useEffect(()=>{if(T)return p.addEventListener(`keydown`,E,{capture:!0}),()=>p.removeEventListener(`keydown`,E,{capture:!0})},[p,T,E]),B.useEffect(()=>{if(d)return n&&(u.layersWithOutsidePointerEventsDisabled.size===0&&(pM=p.body.style.pointerEvents,p.body.style.pointerEvents=`none`),u.layersWithOutsidePointerEventsDisabled.add(d)),u.layers.add(d),bM(),()=>{n&&(u.layersWithOutsidePointerEventsDisabled.delete(d),u.layersWithOutsidePointerEventsDisabled.size===0&&(p.body.style.pointerEvents=pM))}},[d,p,n,u]),B.useEffect(()=>()=>{d&&(u.layers.delete(d),u.layersWithOutsidePointerEventsDisabled.delete(d),bM())},[d,u]),B.useEffect(()=>{let e=lM(()=>m({}),`handleUpdate`);return document.addEventListener(uM,e),()=>document.removeEventListener(uM,e)},[]),(0,V.jsx)(rM.div,{...l,ref:h,style:{pointerEvents:b?x?`auto`:`none`:void 0,...e.style},onFocusCapture:Ej(e.onFocusCapture,w.onFocusCapture),onBlurCapture:Ej(e.onBlurCapture,w.onBlurCapture),onPointerDownCapture:Ej(e.onPointerDownCapture,C.onPointerDownCapture)})},`DismissableLayer`));function gM(){let e=B.useContext(mM),[t,n]=B.useState(null);return B.useEffect(()=>{if(t)return e.dismissableSurfaces.add(t),()=>{e.dismissableSurfaces.delete(t)}},[t,e.dismissableSurfaces]),n}lM(gM,`useDismissableLayerSurface`);var _M=lM(()=>!0,`IS_TRUE`);function vM(e,t){let{ownerDocument:n=globalThis?.document,deferPointerDownOutside:r=!1,isDeferredPointerDownOutsideRef:i,dismissableSurfaces:a,shouldHandlePointerDownOutside:o=_M}=t,s=sM(e),c=B.useRef(!1),l=B.useRef(!1),u=B.useRef(new Map),d=B.useRef(()=>{});return B.useEffect(()=>{function e(){l.current=!1,i.current=!1,u.current.clear()}lM(e,`resetOutsideInteraction`);function t(){return Array.from(u.current.values()).some(Boolean)}lM(t,`isOutsideInteractionIntercepted`);function f(e){if(!l.current)return;let t=e.target;t instanceof Node&&[...a].some(e=>e.contains(t))||u.current.set(e.type,!0),e.type===`click`&&window.setTimeout(()=>{l.current&&d.current()},0)}lM(f,`handleInteractionCapture`);function p(e){l.current&&u.current.set(e.type,!1)}lM(p,`handleInteractionBubble`);let m=lM(a=>{if(a.target&&!c.current){let f=function(){n.removeEventListener(`click`,d.current);let r=t();e(),r||xM(dM,s,p,{discrete:!0})};if(lM(f,`handleAndDispatchPointerDownOutsideEvent`),!o(a.target)){n.removeEventListener(`click`,d.current),e(),c.current=!1;return}let p={originalEvent:a};l.current=!0,i.current=r&&a.button===0,u.current.clear(),!r||a.button!==0?f():(n.removeEventListener(`click`,d.current),d.current=f,n.addEventListener(`click`,d.current,{once:!0}))}else n.removeEventListener(`click`,d.current),e();c.current=!1},`handlePointerDown`),h=[`pointerup`,`mousedown`,`mouseup`,`touchstart`,`touchend`,`click`];for(let e of h)n.addEventListener(e,f,!0),n.addEventListener(e,p);let g=window.setTimeout(()=>{n.addEventListener(`pointerdown`,m)},0);return()=>{window.clearTimeout(g),n.removeEventListener(`pointerdown`,m),n.removeEventListener(`click`,d.current);for(let e of h)n.removeEventListener(e,f,!0),n.removeEventListener(e,p)}},[n,s,r,i,a,o]),{onPointerDownCapture:lM(()=>c.current=!0,`onPointerDownCapture`)}}lM(vM,`usePointerDownOutside`);function yM(e,t=globalThis?.document){let n=sM(e),r=B.useRef(!1);return B.useEffect(()=>{let e=lM(e=>{e.target&&!r.current&&xM(fM,n,{originalEvent:e},{discrete:!1})},`handleFocus`);return t.addEventListener(`focusin`,e),()=>t.removeEventListener(`focusin`,e)},[t,n]),{onFocusCapture:lM(()=>r.current=!0,`onFocusCapture`),onBlurCapture:lM(()=>r.current=!1,`onBlurCapture`)}}lM(yM,`useFocusOutside`);function bM(){let e=new CustomEvent(uM);document.dispatchEvent(e)}lM(bM,`dispatchUpdate`);function xM(e,t,n,{discrete:r}){let i=n.originalEvent.target,a=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&i.addEventListener(e,t,{once:!0}),r?iM(i,a):i.dispatchEvent(a)}lM(xM,`handleAndDispatchCustomEvent`);var SM=Object.defineProperty,CM=(e,t)=>SM(e,`name`,{value:t,configurable:!0}),wM=`focusScope.autoFocusOnMount`,TM=`focusScope.autoFocusOnUnmount`,EM={bubbles:!1,cancelable:!0},DM=B.forwardRef(CM(function(e,t){let{loop:n=!1,trapped:r=!1,onMountAutoFocus:i,onUnmountAutoFocus:a,...o}=e,[s,c]=B.useState(null),l=sM(i),u=sM(a),d=B.useRef(null),f=df(t,c),p=B.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;B.useEffect(()=>{if(r){let e=function(e){if(p.paused||!s)return;let t=e.target;s.contains(t)?d.current=t:PM(d.current,{select:!0})},t=function(e){if(p.paused||!s)return;let t=e.relatedTarget;t!==null&&(s.contains(t)||PM(d.current,{select:!0}))},n=function(e){if(document.activeElement===document.body)for(let t of e)t.removedNodes.length>0&&PM(s)};CM(e,`handleFocusIn`),CM(t,`handleFocusOut`),CM(n,`handleMutations`),document.addEventListener(`focusin`,e),document.addEventListener(`focusout`,t);let r=new MutationObserver(n);return s&&r.observe(s,{childList:!0,subtree:!0}),()=>{document.removeEventListener(`focusin`,e),document.removeEventListener(`focusout`,t),r.disconnect()}}},[r,s,p.paused]),B.useEffect(()=>{if(s){FM.add(p);let e=document.activeElement;if(!s.contains(e)){let t=new CustomEvent(wM,EM);s.addEventListener(wM,l),s.dispatchEvent(t),t.defaultPrevented||(OM(RM(AM(s)),{select:!0}),document.activeElement===e&&PM(s))}return()=>{s.removeEventListener(wM,l),setTimeout(()=>{let t=new CustomEvent(TM,EM);s.addEventListener(TM,u),s.dispatchEvent(t),t.defaultPrevented||PM(e??document.body,{select:!0}),s.removeEventListener(TM,u),FM.remove(p)},0)}}},[s,l,u,p]);let m=B.useCallback(e=>{if(!n&&!r||p.paused)return;let t=e.key===`Tab`&&!e.altKey&&!e.ctrlKey&&!e.metaKey,i=document.activeElement;if(t&&i){let t=e.currentTarget,[r,a]=kM(t);r&&a?!e.shiftKey&&i===a?(e.preventDefault(),n&&PM(r,{select:!0})):e.shiftKey&&i===r&&(e.preventDefault(),n&&PM(a,{select:!0})):i===t&&e.preventDefault()}},[n,r,p.paused]);return(0,V.jsx)(rM.div,{tabIndex:-1,...o,ref:f,onKeyDown:m})},`FocusScope`));function OM(e,{select:t=!1}={}){let n=document.activeElement;for(let r of e)if(PM(r,{select:t}),document.activeElement!==n)return}CM(OM,`focusFirst`);function kM(e){let t=AM(e);return[jM(t,e),jM(t.reverse(),e)]}CM(kM,`getTabbableEdges`);function AM(e){let t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:CM(e=>{let t=e.tagName===`INPUT`&&e.type===`hidden`;return e.disabled||e.hidden||t?NodeFilter.FILTER_SKIP:e.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP},`acceptNode`)});for(;n.nextNode();)t.push(n.currentNode);return t}CM(AM,`getTabbableCandidates`);function jM(e,t){let n=typeof t.checkVisibility==`function`&&t.checkVisibility({checkVisibilityCSS:!0});for(let r of e)if(!(n?!r.checkVisibility({checkVisibilityCSS:!0}):MM(r,{upTo:t})))return r}CM(jM,`findVisible`);function MM(e,{upTo:t}){if(getComputedStyle(e).visibility===`hidden`)return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display===`none`)return!0;e=e.parentElement}return!1}CM(MM,`isHidden`);function NM(e){return e instanceof HTMLInputElement&&`select`in e}CM(NM,`isSelectableInput`);function PM(e,{select:t=!1}={}){if(e&&e.focus){let n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&NM(e)&&t&&e.select()}}CM(PM,`focus`);var FM=IM();function IM(){let e=[];return{add(t){let n=e[0];t!==n&&n?.pause(),e=LM(e,t),e.unshift(t)},remove(t){e=LM(e,t),e[0]?.resume()}}}CM(IM,`createFocusScopesStack`);function LM(e,t){let n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}CM(LM,`arrayRemove`);function RM(e){return e.filter(e=>e.tagName!==`A`)}CM(RM,`removeLinks`);var zM=Object.defineProperty,BM=B.forwardRef(((e,t)=>zM(e,`name`,{value:t,configurable:!0}))(function(e,t){let{container:n,...r}=e,[i,a]=B.useState(!1);Ij(()=>a(!0),[]);let o=n||i&&globalThis?.document?.body;return o?Pi.createPortal((0,V.jsx)(rM.div,{...r,ref:t}),o):null},`Portal`)),VM=Object.defineProperty,HM=(e,t)=>VM(e,`name`,{value:t,configurable:!0});function UM(e,t){return B.useReducer((e,n)=>t[e][n]??e,e)}HM(UM,`useStateMachine`);var WM=HM(e=>{let{present:t,children:n}=e,r=GM(t),i=typeof n==`function`?n({present:r.isPresent}):B.Children.only(n),a=qM(r.ref,YM(i));return typeof n==`function`||r.isPresent?B.cloneElement(i,{ref:a}):null},`Presence`);function GM(e){let[t,n]=B.useState(),r=B.useRef(null),i=B.useRef(e),a=B.useRef(`none`),o=B.useRef(void 0),[s,c]=UM(e?`mounted`:`unmounted`,{mounted:{UNMOUNT:`unmounted`,ANIMATION_OUT:`unmountSuspended`},unmountSuspended:{MOUNT:`mounted`,ANIMATION_END:`unmounted`},unmounted:{MOUNT:`mounted`}});return B.useEffect(()=>{s===`mounted`?(a.current=o.current??JM(r.current),o.current=void 0):a.current=`none`},[s]),Ij(()=>{let t=r.current,n=i.current;if(n!==e){let r=a.current,s=JM(t);e?(o.current=s,c(`MOUNT`)):s===`none`||t?.display===`none`?c(`UNMOUNT`):c(n&&r!==s?`ANIMATION_OUT`:`UNMOUNT`),i.current=e}},[e,c]),Ij(()=>{if(t){let e,n=t.ownerDocument.defaultView??window,o=HM(a=>{let o=JM(r.current).includes(CSS.escape(a.animationName));if(a.target===t&&o&&(c(`ANIMATION_END`),!i.current)){let r=t.style.animationFillMode;t.style.animationFillMode=`forwards`,e=n.setTimeout(()=>{t.style.animationFillMode===`forwards`&&(t.style.animationFillMode=r)})}},`handleAnimationEnd`),s=HM(e=>{e.target===t&&(a.current=JM(r.current))},`handleAnimationStart`);return t.addEventListener(`animationstart`,s),t.addEventListener(`animationcancel`,o),t.addEventListener(`animationend`,o),()=>{n.clearTimeout(e),t.removeEventListener(`animationstart`,s),t.removeEventListener(`animationcancel`,o),t.removeEventListener(`animationend`,o)}}else c(`ANIMATION_END`)},[t,c]),{isPresent:[`mounted`,`unmountSuspended`].includes(s),ref:B.useCallback(e=>{if(e){let t=getComputedStyle(e);r.current=t,o.current=JM(t)}else r.current=null;n(e)},[])}}HM(GM,`usePresence`);function KM(e,t){if(typeof e==`function`)return e(t);e!=null&&(e.current=t)}HM(KM,`setRef`);function qM(...e){let t=B.useRef(e);return t.current=e,B.useCallback(e=>{let n=t.current,r=!1,i=n.map(t=>{let n=KM(t,e);return!r&&typeof n==`function`&&(r=!0),n});if(r)return()=>{for(let e=0;e<i.length;e++){let t=i[e];typeof t==`function`?t():KM(n[e],null)}}},[])}HM(qM,`useStableComposedRefs`);function JM(e){return e?.animationName||`none`}HM(JM,`getAnimationName`);function YM(e){let t=Object.getOwnPropertyDescriptor(e.props,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}HM(YM,`getElementRef`);var XM=Object.defineProperty,ZM=(e,t)=>XM(e,`name`,{value:t,configurable:!0}),QM=0,$M=null;function eN(e){return tN(),e.children}ZM(eN,`FocusGuards`);function tN(){B.useEffect(()=>{$M||={start:nN(),end:nN()};let{start:e,end:t}=$M;return document.body.firstElementChild!==e&&document.body.insertAdjacentElement(`afterbegin`,e),document.body.lastElementChild!==t&&document.body.insertAdjacentElement(`beforeend`,t),QM++,()=>{QM===1&&($M?.start.remove(),$M?.end.remove(),$M=null),QM=Math.max(0,QM-1)}},[])}ZM(tN,`useFocusGuards`);function nN(){let e=document.createElement(`span`);return e.setAttribute(`data-radix-focus-guard`,``),e.tabIndex=0,e.style.outline=`none`,e.style.opacity=`0`,e.style.position=`fixed`,e.style.pointerEvents=`none`,e}ZM(nN,`createFocusGuard`);var rN=function(){return rN=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n],t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},rN.apply(this,arguments)};function iN(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols==`function`)for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n}function aN(e,t,n){if(n||arguments.length===2)for(var r=0,i=t.length,a;r<i;r++)(a||!(r in t))&&(a||=Array.prototype.slice.call(t,0,r),a[r]=t[r]);return e.concat(a||Array.prototype.slice.call(t))}var oN=`right-scroll-bar-position`,sN=`width-before-scroll-bar`,cN=`with-scroll-bars-hidden`,lN=`--removed-body-scroll-bar-size`;function uN(e,t){return typeof e==`function`?e(t):e&&(e.current=t),e}function dN(e,t){var n=(0,B.useState)(function(){return{value:e,callback:t,facade:{get current(){return n.value},set current(e){var t=n.value;t!==e&&(n.value=e,n.callback(e,t))}}}})[0];return n.callback=t,n.facade}var fN=typeof window<`u`?B.useLayoutEffect:B.useEffect,pN=new WeakMap;function mN(e,t){var n=dN(t||null,function(t){return e.forEach(function(e){return uN(e,t)})});return fN(function(){var t=pN.get(n);if(t){var r=new Set(t),i=new Set(e),a=n.current;r.forEach(function(e){i.has(e)||uN(e,null)}),i.forEach(function(e){r.has(e)||uN(e,a)})}pN.set(n,e)},[e]),n}function hN(e){return e}function gN(e,t){t===void 0&&(t=hN);var n=[],r=!1;return{read:function(){if(r)throw Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:e},useMedium:function(e){var i=t(e,r);return n.push(i),function(){n=n.filter(function(e){return e!==i})}},assignSyncMedium:function(e){for(r=!0;n.length;){var t=n;n=[],t.forEach(e)}n={push:function(t){return e(t)},filter:function(){return n}}},assignMedium:function(e){r=!0;var t=[];if(n.length){var i=n;n=[],i.forEach(e),t=n}var a=function(){var n=t;t=[],n.forEach(e)},o=function(){return Promise.resolve().then(a)};o(),n={push:function(e){t.push(e),o()},filter:function(e){return t=t.filter(e),n}}}}}function _N(e){e===void 0&&(e={});var t=gN(null);return t.options=rN({async:!0,ssr:!1},e),t}var vN=function(e){var t=e.sideCar,n=iN(e,[`sideCar`]);if(!t)throw Error("Sidecar: please provide `sideCar` property to import the right car");var r=t.read();if(!r)throw Error(`Sidecar medium not found`);return B.createElement(r,rN({},n))};vN.isSideCarExport=!0;function yN(e,t){return e.useMedium(t),vN}var bN=_N(),xN=function(){},SN=B.forwardRef(function(e,t){var n=B.useRef(null),r=B.useState({onScrollCapture:xN,onWheelCapture:xN,onTouchMoveCapture:xN}),i=r[0],a=r[1],o=e.forwardProps,s=e.children,c=e.className,l=e.removeScrollBar,u=e.enabled,d=e.shards,f=e.sideCar,p=e.noRelative,m=e.noIsolation,h=e.inert,g=e.allowPinchZoom,_=e.as,v=_===void 0?`div`:_,y=e.gapMode,b=iN(e,[`forwardProps`,`children`,`className`,`removeScrollBar`,`enabled`,`shards`,`sideCar`,`noRelative`,`noIsolation`,`inert`,`allowPinchZoom`,`as`,`gapMode`]),x=f,S=mN([n,t]),C=rN(rN({},b),i);return B.createElement(B.Fragment,null,u&&B.createElement(x,{sideCar:bN,removeScrollBar:l,shards:d,noRelative:p,noIsolation:m,inert:h,setCallbacks:a,allowPinchZoom:!!g,lockRef:n,gapMode:y}),o?B.cloneElement(B.Children.only(s),rN(rN({},C),{ref:S})):B.createElement(v,rN({},C,{className:c,ref:S}),s))});SN.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1},SN.classNames={fullWidth:sN,zeroRight:oN};var CN,wN=function(){if(CN)return CN;if(typeof __webpack_nonce__<`u`)return __webpack_nonce__};function TN(){if(!document)return null;var e=document.createElement(`style`);e.type=`text/css`;var t=wN();return t&&e.setAttribute(`nonce`,t),e}function EN(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function DN(e){(document.head||document.getElementsByTagName(`head`)[0]).appendChild(e)}var ON=function(){var e=0,t=null;return{add:function(n){e==0&&(t=TN())&&(EN(t,n),DN(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},kN=function(){var e=ON();return function(t,n){B.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},AN=function(){var e=kN();return function(t){var n=t.styles,r=t.dynamic;return e(n,r),null}},jN={left:0,top:0,right:0,gap:0},MN=function(e){return parseInt(e||``,10)||0},NN=function(e){var t=window.getComputedStyle(document.body),n=t[e===`padding`?`paddingLeft`:`marginLeft`],r=t[e===`padding`?`paddingTop`:`marginTop`],i=t[e===`padding`?`paddingRight`:`marginRight`];return[MN(n),MN(r),MN(i)]},PN=function(e){if(e===void 0&&(e=`margin`),typeof window>`u`)return jN;var t=NN(e),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,r-n+t[2]-t[0])}},FN=AN(),IN=`data-scroll-locked`,LN=function(e,t,n,r){var i=e.left,a=e.top,o=e.right,s=e.gap;return n===void 0&&(n=`margin`),`
107
+ .${cN} {
108
+ overflow: hidden ${r};
109
+ padding-right: ${s}px ${r};
110
+ }
111
+ body[${IN}] {
112
+ overflow: hidden ${r};
113
+ overscroll-behavior: contain;
114
+ ${[t&&`position: relative ${r};`,n===`margin`&&`
115
+ padding-left: ${i}px;
116
+ padding-top: ${a}px;
117
+ padding-right: ${o}px;
118
+ margin-left:0;
119
+ margin-top:0;
120
+ margin-right: ${s}px ${r};
121
+ `,n===`padding`&&`padding-right: ${s}px ${r};`].filter(Boolean).join(``)}
122
+ }
123
+
124
+ .${oN} {
125
+ right: ${s}px ${r};
126
+ }
127
+
128
+ .${sN} {
129
+ margin-right: ${s}px ${r};
130
+ }
131
+
132
+ .${oN} .${oN} {
133
+ right: 0 ${r};
134
+ }
135
+
136
+ .${sN} .${sN} {
137
+ margin-right: 0 ${r};
138
+ }
139
+
140
+ body[${IN}] {
141
+ ${lN}: ${s}px;
142
+ }
143
+ `},RN=function(){var e=parseInt(document.body.getAttribute(`data-scroll-locked`)||`0`,10);return isFinite(e)?e:0},zN=function(){B.useEffect(function(){return document.body.setAttribute(IN,(RN()+1).toString()),function(){var e=RN()-1;e<=0?document.body.removeAttribute(IN):document.body.setAttribute(IN,e.toString())}},[])},BN=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,i=r===void 0?`margin`:r;zN();var a=B.useMemo(function(){return PN(i)},[i]);return B.createElement(FN,{styles:LN(a,!t,i,n?``:`!important`)})},VN=!1;if(typeof window<`u`)try{var HN=Object.defineProperty({},"passive",{get:function(){return VN=!0,!0}});window.addEventListener(`test`,HN,HN),window.removeEventListener(`test`,HN,HN)}catch{VN=!1}var UN=VN?{passive:!1}:!1,WN=function(e){return e.tagName===`TEXTAREA`},GN=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!==`hidden`&&!(n.overflowY===n.overflowX&&!WN(e)&&n[t]===`visible`)},KN=function(e){return GN(e,`overflowY`)},qN=function(e){return GN(e,`overflowX`)},JN=function(e,t){var n=t.ownerDocument,r=t;do{if(typeof ShadowRoot<`u`&&r instanceof ShadowRoot&&(r=r.host),ZN(e,r)){var i=QN(e,r);if(i[1]>i[2])return!0}r=r.parentNode}while(r&&r!==n.body);return!1},YN=function(e){return[e.scrollTop,e.scrollHeight,e.clientHeight]},XN=function(e){return[e.scrollLeft,e.scrollWidth,e.clientWidth]},ZN=function(e,t){return e===`v`?KN(t):qN(t)},QN=function(e,t){return e===`v`?YN(t):XN(t)},$N=function(e,t){return e===`h`&&t===`rtl`?-1:1},eP=function(e,t,n,r,i){var a=$N(e,window.getComputedStyle(t).direction),o=a*r,s=n.target,c=t.contains(s),l=!1,u=o>0,d=0,f=0;do{if(!s)break;var p=QN(e,s),m=p[0],h=p[1]-p[2]-a*m;(m||h)&&ZN(e,s)&&(d+=h,f+=m);var g=s.parentNode;s=g&&g.nodeType===Node.DOCUMENT_FRAGMENT_NODE?g.host:g}while(!c&&s!==document.body||c&&(t.contains(s)||t===s));return(u&&(i&&Math.abs(d)<1||!i&&o>d)||!u&&(i&&Math.abs(f)<1||!i&&-o>f))&&(l=!0),l},tP=function(e){return`changedTouches`in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},nP=function(e){return[e.deltaX,e.deltaY]},rP=function(e){return e&&`current`in e?e.current:e},iP=function(e,t){return e[0]===t[0]&&e[1]===t[1]},aP=function(e){return`
144
+ .block-interactivity-${e} {pointer-events: none;}
145
+ .allow-interactivity-${e} {pointer-events: all;}
146
+ `},oP=0,sP=[];function cP(e){var t=B.useRef([]),n=B.useRef([0,0]),r=B.useRef(),i=B.useState(oP++)[0],a=B.useState(AN)[0],o=B.useRef(e);B.useEffect(function(){o.current=e},[e]),B.useEffect(function(){if(e.inert){document.body.classList.add(`block-interactivity-${i}`);var t=aN([e.lockRef.current],(e.shards||[]).map(rP),!0).filter(Boolean);return t.forEach(function(e){return e.classList.add(`allow-interactivity-${i}`)}),function(){document.body.classList.remove(`block-interactivity-${i}`),t.forEach(function(e){return e.classList.remove(`allow-interactivity-${i}`)})}}},[e.inert,e.lockRef.current,e.shards]);var s=B.useCallback(function(e,t){if(`touches`in e&&e.touches.length===2||e.type===`wheel`&&e.ctrlKey)return!o.current.allowPinchZoom;var i=tP(e),a=n.current,s=`deltaX`in e?e.deltaX:a[0]-i[0],c=`deltaY`in e?e.deltaY:a[1]-i[1],l,u=e.target,d=Math.abs(s)>Math.abs(c)?`h`:`v`;if(`touches`in e&&d===`h`&&u.type===`range`)return!1;var f=window.getSelection(),p=f&&f.anchorNode;if(p&&(p===u||p.contains(u)))return!1;var m=JN(d,u);if(!m)return!0;if(m?l=d:(l=d===`v`?`h`:`v`,m=JN(d,u)),!m)return!1;if(!r.current&&`changedTouches`in e&&(s||c)&&(r.current=l),!l)return!0;var h=r.current||l;return eP(h,t,e,h===`h`?s:c,!0)},[]),c=B.useCallback(function(e){var n=e;if(!(!sP.length||sP[sP.length-1]!==a)){var r=`deltaY`in n?nP(n):tP(n),i=t.current.filter(function(e){return e.name===n.type&&(e.target===n.target||n.target===e.shadowParent)&&iP(e.delta,r)})[0];if(i&&i.should){n.cancelable&&n.preventDefault();return}if(!i){var c=(o.current.shards||[]).map(rP).filter(Boolean).filter(function(e){return e.contains(n.target)});(c.length>0?s(n,c[0]):!o.current.noIsolation)&&n.cancelable&&n.preventDefault()}}},[]),l=B.useCallback(function(e,n,r,i){var a={name:e,delta:n,target:r,should:i,shadowParent:lP(r)};t.current.push(a),setTimeout(function(){t.current=t.current.filter(function(e){return e!==a})},1)},[]),u=B.useCallback(function(e){n.current=tP(e),r.current=void 0},[]),d=B.useCallback(function(t){l(t.type,nP(t),t.target,s(t,e.lockRef.current))},[]),f=B.useCallback(function(t){l(t.type,tP(t),t.target,s(t,e.lockRef.current))},[]);B.useEffect(function(){return sP.push(a),e.setCallbacks({onScrollCapture:d,onWheelCapture:d,onTouchMoveCapture:f}),document.addEventListener(`wheel`,c,UN),document.addEventListener(`touchmove`,c,UN),document.addEventListener(`touchstart`,u,UN),function(){sP=sP.filter(function(e){return e!==a}),document.removeEventListener(`wheel`,c,UN),document.removeEventListener(`touchmove`,c,UN),document.removeEventListener(`touchstart`,u,UN)}},[]);var p=e.removeScrollBar,m=e.inert;return B.createElement(B.Fragment,null,m?B.createElement(a,{styles:aP(i)}):null,p?B.createElement(BN,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function lP(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}var uP=yN(bN,cP),dP=B.forwardRef(function(e,t){return B.createElement(SN,rN({},e,{ref:t,sideCar:uP}))});dP.classNames=SN.classNames;var fP=function(e){return typeof document>`u`?null:(Array.isArray(e)?e[0]:e).ownerDocument.body},pP=new WeakMap,mP=new WeakMap,hP={},gP=0,_P=function(e){return e&&(e.host||_P(e.parentNode))},vP=function(e,t){return t.map(function(t){if(e.contains(t))return t;var n=_P(t);return n&&e.contains(n)?n:(console.error(`aria-hidden`,t,`in not contained inside`,e,`. Doing nothing`),null)}).filter(function(e){return!!e})},yP=function(e,t,n,r){var i=vP(t,Array.isArray(e)?e:[e]);hP[n]||(hP[n]=new WeakMap);var a=hP[n],o=[],s=new Set,c=new Set(i),l=function(e){!e||s.has(e)||(s.add(e),l(e.parentNode))};i.forEach(l);var u=function(e){!e||c.has(e)||Array.prototype.forEach.call(e.children,function(e){if(s.has(e))u(e);else try{var t=e.getAttribute(r),i=t!==null&&t!==`false`,c=(pP.get(e)||0)+1,l=(a.get(e)||0)+1;pP.set(e,c),a.set(e,l),o.push(e),c===1&&i&&mP.set(e,!0),l===1&&e.setAttribute(n,`true`),i||e.setAttribute(r,`true`)}catch(t){console.error(`aria-hidden: cannot operate on `,e,t)}})};return u(t),s.clear(),gP++,function(){o.forEach(function(e){var t=pP.get(e)-1,i=a.get(e)-1;pP.set(e,t),a.set(e,i),t||(mP.has(e)||e.removeAttribute(r),mP.delete(e)),i||e.removeAttribute(n)}),gP--,gP||(pP=new WeakMap,pP=new WeakMap,mP=new WeakMap,hP={})}},bP=function(e,t,n){n===void 0&&(n=`data-aria-hidden`);var r=Array.from(Array.isArray(e)?e:[e]),i=t||fP(e);return i?(r.push.apply(r,Array.from(i.querySelectorAll(`[aria-live], script`))),yP(r,i,n,`aria-hidden`)):function(){return null}},xP=Object.defineProperty,SP=(e,t)=>xP(e,`name`,{value:t,configurable:!0}),CP=`Dialog`,[wP,TP]=Pj(CP),[EP,DP]=wP(CP),OP=SP(e=>{let{__scopeDialog:t,children:n,open:r,defaultOpen:i,onOpenChange:a,modal:o=!0}=e,s=B.useRef(null),c=B.useRef(null),[l,u]=Xj({prop:r,defaultProp:i??!1,onChange:a,caller:CP}),[d,f]=B.useState(0),[p,m]=B.useState(0);return(0,V.jsx)(EP,{scope:t,triggerRef:s,contentRef:c,contentId:Vj(),titleId:Vj(),descriptionId:Vj(),titlePresent:d>0,descriptionPresent:p>0,setTitleCount:f,setDescriptionCount:m,open:l,onOpenChange:u,onOpenToggle:B.useCallback(()=>u(e=>!e),[u]),modal:o,children:n})},`Dialog`),kP=`DialogTrigger`,AP=B.forwardRef(SP(function(e,t){let{__scopeDialog:n,...r}=e,i=DP(kP,n),a=df(t,i.triggerRef);return(0,V.jsx)(rM.button,{type:`button`,"aria-haspopup":`dialog`,"aria-expanded":i.open,"aria-controls":i.open?i.contentId:void 0,"data-state":XP(i.open),...r,ref:a,onClick:Ej(e.onClick,i.onOpenToggle)})},`DialogTrigger`)),jP=`DialogPortal`,[MP,NP]=wP(jP,{forceMount:void 0}),PP=SP(e=>{let{__scopeDialog:t,forceMount:n,children:r,container:i}=e,a=DP(jP,t);return(0,V.jsx)(MP,{scope:t,forceMount:n,children:B.Children.map(r,e=>(0,V.jsx)(WM,{present:n||a.open,children:(0,V.jsx)(BM,{asChild:!0,container:i,children:e})}))})},`DialogPortal`),FP=`DialogOverlay`,IP=B.forwardRef(SP(function(e,t){let n=NP(FP,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,a=DP(FP,e.__scopeDialog);return a.modal?(0,V.jsx)(WM,{present:r||a.open,children:(0,V.jsx)(RP,{...i,ref:t})}):null},`DialogOverlay`)),LP=mf(`DialogOverlay.RemoveScroll`),RP=B.forwardRef(SP(function(e,t){let{__scopeDialog:n,...r}=e,i=DP(FP,n),a=df(t,gM());return(0,V.jsx)(dP,{as:LP,allowPinchZoom:!0,shards:[i.contentRef],children:(0,V.jsx)(rM.div,{"data-state":XP(i.open),...r,ref:a,style:{pointerEvents:`auto`,...r.style}})})},`DialogOverlayImpl`)),zP=`DialogContent`,BP=B.forwardRef(SP(function(e,t){let n=NP(zP,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,a=DP(zP,e.__scopeDialog);return(0,V.jsx)(WM,{present:r||a.open,children:a.modal?(0,V.jsx)(VP,{...i,ref:t}):(0,V.jsx)(HP,{...i,ref:t})})},`DialogContent`)),VP=B.forwardRef(SP(function(e,t){let n=DP(zP,e.__scopeDialog),r=B.useRef(null),i=df(t,n.contentRef,r);return B.useEffect(()=>{let e=r.current;if(e)return bP(e)},[]),(0,V.jsx)(UP,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:n.open,onCloseAutoFocus:Ej(e.onCloseAutoFocus,e=>{e.preventDefault(),n.triggerRef.current?.focus()}),onPointerDownOutside:Ej(e.onPointerDownOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0;(t.button===2||n)&&e.preventDefault()}),onFocusOutside:Ej(e.onFocusOutside,e=>e.preventDefault())})},`DialogContentModal`)),HP=B.forwardRef(SP(function(e,t){let n=DP(zP,e.__scopeDialog),r=B.useRef(!1),i=B.useRef(!1);return(0,V.jsx)(UP,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),t.defaultPrevented||(r.current||n.triggerRef.current?.focus(),t.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),t.defaultPrevented||(r.current=!0,t.detail.originalEvent.type===`pointerdown`&&(i.current=!0));let a=t.target;n.triggerRef.current?.contains(a)&&t.preventDefault(),t.detail.originalEvent.type===`focusin`&&i.current&&t.preventDefault()}})},`DialogContentNonModal`)),UP=B.forwardRef(SP(function(e,t){let{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:a,...o}=e,s=DP(zP,n);return tN(),(0,V.jsx)(V.Fragment,{children:(0,V.jsx)(DM,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:a,children:(0,V.jsx)(hM,{role:`dialog`,id:s.contentId,"aria-describedby":s.descriptionPresent?s.descriptionId:void 0,"aria-labelledby":s.titlePresent?s.titleId:void 0,"data-state":XP(s.open),...o,ref:t,deferPointerDownOutside:!0,onDismiss:()=>s.onOpenChange(!1)})})})},`DialogContentImpl`)),WP=`DialogTitle`,GP=B.forwardRef(SP(function(e,t){let{__scopeDialog:n,...r}=e,i=DP(WP,n),{setTitleCount:a}=i;return Ij(()=>(a(e=>e+1),()=>a(e=>e-1)),[a]),(0,V.jsx)(rM.h2,{id:i.titleId,...r,ref:t})},`DialogTitle`)),KP=`DialogDescription`,qP=B.forwardRef(SP(function(e,t){let{__scopeDialog:n,...r}=e,i=DP(KP,n),{setDescriptionCount:a}=i;return Ij(()=>(a(e=>e+1),()=>a(e=>e-1)),[a]),(0,V.jsx)(rM.p,{id:i.descriptionId,...r,ref:t})},`DialogDescription`)),JP=`DialogClose`,YP=B.forwardRef(SP(function(e,t){let{__scopeDialog:n,...r}=e,i=DP(JP,n);return(0,V.jsx)(rM.button,{type:`button`,...r,ref:t,onClick:Ej(e.onClick,()=>i.onOpenChange(!1))})},`DialogClose`));function XP(e){return e?`open`:`closed`}SP(XP,`getState`);var ZP=(...e)=>e.filter((e,t,n)=>!!e&&e.trim()!==``&&n.indexOf(e)===t).join(` `).trim(),QP=e=>e.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).toLowerCase(),$P=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,t,n)=>n?n.toUpperCase():t.toLowerCase()),eF=e=>{let t=$P(e);return t.charAt(0).toUpperCase()+t.slice(1)},tF={xmlns:`http://www.w3.org/2000/svg`,width:24,height:24,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:2,strokeLinecap:`round`,strokeLinejoin:`round`},nF=e=>{for(let t in e)if(t.startsWith(`aria-`)||t===`role`||t===`title`)return!0;return!1},rF=(0,B.createContext)({}),iF=()=>(0,B.useContext)(rF),aF=(0,B.forwardRef)(({color:e,size:t,strokeWidth:n,absoluteStrokeWidth:r,className:i=``,children:a,iconNode:o,...s},c)=>{let{size:l=24,strokeWidth:u=2,absoluteStrokeWidth:d=!1,color:f=`currentColor`,className:p=``}=iF()??{},m=r??d?Number(n??u)*24/Number(t??l):n??u;return(0,B.createElement)(`svg`,{ref:c,...tF,width:t??l??tF.width,height:t??l??tF.height,stroke:e??f,strokeWidth:m,className:ZP(`lucide`,p,i),...!a&&!nF(s)&&{"aria-hidden":`true`},...s},[...o.map(([e,t])=>(0,B.createElement)(e,t)),...Array.isArray(a)?a:[a]])}),oF=(e,t)=>{let n=(0,B.forwardRef)(({className:n,...r},i)=>(0,B.createElement)(aF,{ref:i,iconNode:t,className:ZP(`lucide-${QP(eF(e))}`,`lucide-${e}`,n),...r}));return n.displayName=eF(e),n},sF=oF(`check`,[[`path`,{d:`M20 6 9 17l-5-5`,key:`1gmf2c`}]]),cF=oF(`crown`,[[`path`,{d:`M11.562 3.266a.5.5 0 0 1 .876 0L15.39 8.87a1 1 0 0 0 1.516.294L21.183 5.5a.5.5 0 0 1 .798.519l-2.834 10.246a1 1 0 0 1-.956.734H5.81a1 1 0 0 1-.957-.734L2.02 6.02a.5.5 0 0 1 .798-.519l4.276 3.664a1 1 0 0 0 1.516-.294z`,key:`1vdc57`}],[`path`,{d:`M5 21h14`,key:`11awu3`}]]),lF=oF(`git-branch`,[[`path`,{d:`M15 6a9 9 0 0 0-9 9V3`,key:`1cii5b`}],[`circle`,{cx:`18`,cy:`6`,r:`3`,key:`1h7g24`}],[`circle`,{cx:`6`,cy:`18`,r:`3`,key:`fqmcym`}]]),uF=oF(`panel-left`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M9 3v18`,key:`fh3hqa`}]]),dF=oF(`x`,[[`path`,{d:`M18 6 6 18`,key:`1bl5f8`}],[`path`,{d:`m6 6 12 12`,key:`d8bk6v`}]]),fF=OP,pF=PP,mF=B.forwardRef(({className:e,...t},n)=>(0,V.jsx)(IP,{ref:n,className:K(`fixed inset-0 z-50 bg-black/70 backdrop-blur-sm`,e),...t}));mF.displayName=IP.displayName;var hF=B.forwardRef(({className:e,children:t,restoreFocusTo:n,onCloseAutoFocus:r,...i},a)=>(0,V.jsxs)(pF,{children:[(0,V.jsx)(mF,{}),(0,V.jsxs)(BP,{ref:a,className:K(`fixed top-1/2 left-1/2 z-50 grid max-h-[calc(100dvh-2rem)] w-[calc(100%-2rem)] max-w-lg -translate-x-1/2 -translate-y-1/2 gap-4 overflow-y-auto rounded-xl bg-zinc-900 p-6 text-zinc-200 shadow-2xl ring-1 ring-white/10 outline-none max-[700px]:top-auto max-[700px]:bottom-0 max-[700px]:left-0 max-[700px]:max-h-[90dvh] max-[700px]:w-full max-[700px]:max-w-none max-[700px]:translate-x-0 max-[700px]:translate-y-0 max-[700px]:rounded-b-none max-[700px]:p-5 max-[700px]:pb-[calc(1.25rem+env(safe-area-inset-bottom))]`,e),onCloseAutoFocus:e=>{r?.(e),!e.defaultPrevented&&n?.isConnected&&(e.preventDefault(),n.focus())},...i,children:[t,(0,V.jsxs)(YP,{className:`absolute top-3 right-3 inline-flex size-9 items-center justify-center rounded-md text-zinc-500 outline-none hover:bg-white/5 hover:text-zinc-100 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-cyan-400 disabled:pointer-events-none [&_svg]:size-4`,children:[(0,V.jsx)(dF,{}),(0,V.jsx)(`span`,{className:`sr-only`,children:`Close`})]})]})]}));hF.displayName=BP.displayName;function gF({className:e,...t}){return(0,V.jsx)(`div`,{className:K(`flex flex-col gap-1.5 pr-12 text-left`,e),...t})}var _F=B.forwardRef(({className:e,...t},n)=>(0,V.jsx)(GP,{ref:n,className:K(`text-balance text-xl font-semibold tracking-tight text-zinc-50 sm:text-2xl`,e),...t}));_F.displayName=GP.displayName;var vF=B.forwardRef(({className:e,...t},n)=>(0,V.jsx)(qP,{ref:n,className:K(`text-base text-pretty text-zinc-400 sm:text-sm`,e),...t}));vF.displayName=qP.displayName;function yF({title:e,titleId:t,...n},r){return B.createElement(`svg`,Object.assign({xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 16 16`,fill:`currentColor`,"aria-hidden":`true`,"data-slot":`icon`,ref:r,"aria-labelledby":t},n),e?B.createElement(`title`,{id:t},e):null,B.createElement(`path`,{fillRule:`evenodd`,d:`M13.836 2.477a.75.75 0 0 1 .75.75v3.182a.75.75 0 0 1-.75.75h-3.182a.75.75 0 0 1 0-1.5h1.37l-.84-.841a4.5 4.5 0 0 0-7.08.932.75.75 0 0 1-1.3-.75 6 6 0 0 1 9.44-1.242l.842.84V3.227a.75.75 0 0 1 .75-.75Zm-.911 7.5A.75.75 0 0 1 13.199 11a6 6 0 0 1-9.44 1.241l-.84-.84v1.371a.75.75 0 0 1-1.5 0V9.591a.75.75 0 0 1 .75-.75H5.35a.75.75 0 0 1 0 1.5H3.98l.841.841a4.5 4.5 0 0 0 7.08-.932.75.75 0 0 1 1.025-.273Z`,clipRule:`evenodd`}))}var bF=B.forwardRef(yF);function xF({title:e,titleId:t,...n},r){return B.createElement(`svg`,Object.assign({xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 16 16`,fill:`currentColor`,"aria-hidden":`true`,"data-slot":`icon`,ref:r,"aria-labelledby":t},n),e?B.createElement(`title`,{id:t},e):null,B.createElement(`path`,{fillRule:`evenodd`,d:`M8 14a.75.75 0 0 1-.75-.75V4.56L4.03 7.78a.75.75 0 0 1-1.06-1.06l4.5-4.5a.75.75 0 0 1 1.06 0l4.5 4.5a.75.75 0 0 1-1.06 1.06L8.75 4.56v8.69A.75.75 0 0 1 8 14Z`,clipRule:`evenodd`}))}var SF=B.forwardRef(xF);function CF({title:e,titleId:t,...n},r){return B.createElement(`svg`,Object.assign({xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 16 16`,fill:`currentColor`,"aria-hidden":`true`,"data-slot":`icon`,ref:r,"aria-labelledby":t},n),e?B.createElement(`title`,{id:t},e):null,B.createElement(`path`,{fillRule:`evenodd`,d:`M2 3.75A.75.75 0 0 1 2.75 3h10.5a.75.75 0 0 1 0 1.5H2.75A.75.75 0 0 1 2 3.75ZM2 8a.75.75 0 0 1 .75-.75h10.5a.75.75 0 0 1 0 1.5H2.75A.75.75 0 0 1 2 8Zm0 4.25a.75.75 0 0 1 .75-.75h10.5a.75.75 0 0 1 0 1.5H2.75a.75.75 0 0 1-.75-.75Z`,clipRule:`evenodd`}))}var wF=B.forwardRef(CF);function TF({title:e,titleId:t,...n},r){return B.createElement(`svg`,Object.assign({xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 16 16`,fill:`currentColor`,"aria-hidden":`true`,"data-slot":`icon`,ref:r,"aria-labelledby":t},n),e?B.createElement(`title`,{id:t},e):null,B.createElement(`path`,{fillRule:`evenodd`,d:`M12.416 3.376a.75.75 0 0 1 .208 1.04l-5 7.5a.75.75 0 0 1-1.154.114l-3-3a.75.75 0 0 1 1.06-1.06l2.353 2.353 4.493-6.74a.75.75 0 0 1 1.04-.207Z`,clipRule:`evenodd`}))}var EF=B.forwardRef(TF);function DF({title:e,titleId:t,...n},r){return B.createElement(`svg`,Object.assign({xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 16 16`,fill:`currentColor`,"aria-hidden":`true`,"data-slot":`icon`,ref:r,"aria-labelledby":t},n),e?B.createElement(`title`,{id:t},e):null,B.createElement(`path`,{fillRule:`evenodd`,d:`M4.22 6.22a.75.75 0 0 1 1.06 0L8 8.94l2.72-2.72a.75.75 0 1 1 1.06 1.06l-3.25 3.25a.75.75 0 0 1-1.06 0L4.22 7.28a.75.75 0 0 1 0-1.06Z`,clipRule:`evenodd`}))}var OF=B.forwardRef(DF);function kF({title:e,titleId:t,...n},r){return B.createElement(`svg`,Object.assign({xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 16 16`,fill:`currentColor`,"aria-hidden":`true`,"data-slot":`icon`,ref:r,"aria-labelledby":t},n),e?B.createElement(`title`,{id:t},e):null,B.createElement(`path`,{fillRule:`evenodd`,d:`M6.22 4.22a.75.75 0 0 1 1.06 0l3.25 3.25a.75.75 0 0 1 0 1.06l-3.25 3.25a.75.75 0 0 1-1.06-1.06L8.94 8 6.22 5.28a.75.75 0 0 1 0-1.06Z`,clipRule:`evenodd`}))}var AF=B.forwardRef(kF);function jF({title:e,titleId:t,...n},r){return B.createElement(`svg`,Object.assign({xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 16 16`,fill:`currentColor`,"aria-hidden":`true`,"data-slot":`icon`,ref:r,"aria-labelledby":t},n),e?B.createElement(`title`,{id:t},e):null,B.createElement(`path`,{fillRule:`evenodd`,d:`M5.22 10.22a.75.75 0 0 1 1.06 0L8 11.94l1.72-1.72a.75.75 0 1 1 1.06 1.06l-2.25 2.25a.75.75 0 0 1-1.06 0l-2.25-2.25a.75.75 0 0 1 0-1.06ZM10.78 5.78a.75.75 0 0 1-1.06 0L8 4.06 6.28 5.78a.75.75 0 0 1-1.06-1.06l2.25-2.25a.75.75 0 0 1 1.06 0l2.25 2.25a.75.75 0 0 1 0 1.06Z`,clipRule:`evenodd`}))}var MF=B.forwardRef(jF);function NF({title:e,titleId:t,...n},r){return B.createElement(`svg`,Object.assign({xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 16 16`,fill:`currentColor`,"aria-hidden":`true`,"data-slot":`icon`,ref:r,"aria-labelledby":t},n),e?B.createElement(`title`,{id:t},e):null,B.createElement(`path`,{fillRule:`evenodd`,d:`M6.455 1.45A.5.5 0 0 1 6.952 1h2.096a.5.5 0 0 1 .497.45l.186 1.858a4.996 4.996 0 0 1 1.466.848l1.703-.769a.5.5 0 0 1 .639.206l1.047 1.814a.5.5 0 0 1-.14.656l-1.517 1.09a5.026 5.026 0 0 1 0 1.694l1.516 1.09a.5.5 0 0 1 .141.656l-1.047 1.814a.5.5 0 0 1-.639.206l-1.703-.768c-.433.36-.928.649-1.466.847l-.186 1.858a.5.5 0 0 1-.497.45H6.952a.5.5 0 0 1-.497-.45l-.186-1.858a4.993 4.993 0 0 1-1.466-.848l-1.703.769a.5.5 0 0 1-.639-.206l-1.047-1.814a.5.5 0 0 1 .14-.656l1.517-1.09a5.033 5.033 0 0 1 0-1.694l-1.516-1.09a.5.5 0 0 1-.141-.656L2.46 3.593a.5.5 0 0 1 .639-.206l1.703.769c.433-.36.928-.65 1.466-.848l.186-1.858Zm-.177 7.567-.022-.037a2 2 0 0 1 3.466-1.997l.022.037a2 2 0 0 1-3.466 1.997Z`,clipRule:`evenodd`}))}var PF=B.forwardRef(NF);function FF({title:e,titleId:t,...n},r){return B.createElement(`svg`,Object.assign({xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 16 16`,fill:`currentColor`,"aria-hidden":`true`,"data-slot":`icon`,ref:r,"aria-labelledby":t},n),e?B.createElement(`title`,{id:t},e):null,B.createElement(`path`,{fillRule:`evenodd`,d:`M2 4a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V4Zm2.22 1.97a.75.75 0 0 0 0 1.06l.97.97-.97.97a.75.75 0 1 0 1.06 1.06l1.5-1.5a.75.75 0 0 0 0-1.06l-1.5-1.5a.75.75 0 0 0-1.06 0ZM8.75 8.5a.75.75 0 0 0 0 1.5h2.5a.75.75 0 0 0 0-1.5h-2.5Z`,clipRule:`evenodd`}))}var IF=B.forwardRef(FF);function LF({title:e,titleId:t,...n},r){return B.createElement(`svg`,Object.assign({xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 16 16`,fill:`currentColor`,"aria-hidden":`true`,"data-slot":`icon`,ref:r,"aria-labelledby":t},n),e?B.createElement(`title`,{id:t},e):null,B.createElement(`path`,{d:`M2 3.5A1.5 1.5 0 0 1 3.5 2h2.879a1.5 1.5 0 0 1 1.06.44l1.122 1.12A1.5 1.5 0 0 0 9.62 4H12.5A1.5 1.5 0 0 1 14 5.5v1.401a2.986 2.986 0 0 0-1.5-.401h-9c-.546 0-1.059.146-1.5.401V3.5ZM2 9.5v3A1.5 1.5 0 0 0 3.5 14h9a1.5 1.5 0 0 0 1.5-1.5v-3A1.5 1.5 0 0 0 12.5 8h-9A1.5 1.5 0 0 0 2 9.5Z`}))}var RF=B.forwardRef(LF);function zF({title:e,titleId:t,...n},r){return B.createElement(`svg`,Object.assign({xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 16 16`,fill:`currentColor`,"aria-hidden":`true`,"data-slot":`icon`,ref:r,"aria-labelledby":t},n),e?B.createElement(`title`,{id:t},e):null,B.createElement(`path`,{d:`M8.543 2.232a.75.75 0 0 0-1.085 0l-5.25 5.5A.75.75 0 0 0 2.75 9H4v4a1 1 0 0 0 1 1h1a1 1 0 0 0 1-1v-1a1 1 0 1 1 2 0v1a1 1 0 0 0 1 1h1a1 1 0 0 0 1-1V9h1.25a.75.75 0 0 0 .543-1.268l-5.25-5.5Z`}))}var BF=B.forwardRef(zF);function VF({title:e,titleId:t,...n},r){return B.createElement(`svg`,Object.assign({xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 16 16`,fill:`currentColor`,"aria-hidden":`true`,"data-slot":`icon`,ref:r,"aria-labelledby":t},n),e?B.createElement(`title`,{id:t},e):null,B.createElement(`path`,{fillRule:`evenodd`,d:`M9.965 11.026a5 5 0 1 1 1.06-1.06l2.755 2.754a.75.75 0 1 1-1.06 1.06l-2.755-2.754ZM10.5 7a3.5 3.5 0 1 1-7 0 3.5 3.5 0 0 1 7 0Z`,clipRule:`evenodd`}))}var HF=B.forwardRef(VF);function UF({title:e,titleId:t,...n},r){return B.createElement(`svg`,Object.assign({xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 16 16`,fill:`currentColor`,"aria-hidden":`true`,"data-slot":`icon`,ref:r,"aria-labelledby":t},n),e?B.createElement(`title`,{id:t},e):null,B.createElement(`path`,{d:`M8.75 3.75a.75.75 0 0 0-1.5 0v3.5h-3.5a.75.75 0 0 0 0 1.5h3.5v3.5a.75.75 0 0 0 1.5 0v-3.5h3.5a.75.75 0 0 0 0-1.5h-3.5v-3.5Z`}))}var WF=B.forwardRef(UF);function GF({title:e,titleId:t,...n},r){return B.createElement(`svg`,Object.assign({xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 16 16`,fill:`currentColor`,"aria-hidden":`true`,"data-slot":`icon`,ref:r,"aria-labelledby":t},n),e?B.createElement(`title`,{id:t},e):null,B.createElement(`path`,{fillRule:`evenodd`,d:`M5 3.25V4H2.75a.75.75 0 0 0 0 1.5h.3l.815 8.15A1.5 1.5 0 0 0 5.357 15h5.285a1.5 1.5 0 0 0 1.493-1.35l.815-8.15h.3a.75.75 0 0 0 0-1.5H11v-.75A2.25 2.25 0 0 0 8.75 1h-1.5A2.25 2.25 0 0 0 5 3.25Zm2.25-.75a.75.75 0 0 0-.75.75V4h3v-.75a.75.75 0 0 0-.75-.75h-1.5ZM6.05 6a.75.75 0 0 1 .787.713l.275 5.5a.75.75 0 0 1-1.498.075l-.275-5.5A.75.75 0 0 1 6.05 6Zm3.9 0a.75.75 0 0 1 .712.787l-.275 5.5a.75.75 0 0 1-1.498-.075l.275-5.5a.75.75 0 0 1 .786-.711Z`,clipRule:`evenodd`}))}var KF=B.forwardRef(GF);function qF({title:e,titleId:t,...n},r){return B.createElement(`svg`,Object.assign({xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 16 16`,fill:`currentColor`,"aria-hidden":`true`,"data-slot":`icon`,ref:r,"aria-labelledby":t},n),e?B.createElement(`title`,{id:t},e):null,B.createElement(`path`,{d:`M5.28 4.22a.75.75 0 0 0-1.06 1.06L6.94 8l-2.72 2.72a.75.75 0 1 0 1.06 1.06L8 9.06l2.72 2.72a.75.75 0 1 0 1.06-1.06L9.06 8l2.72-2.72a.75.75 0 0 0-1.06-1.06L8 6.94 5.28 4.22Z`}))}var JF=B.forwardRef(qF);function YF({children:e}){return(0,V.jsx)(`div`,{className:`grid gap-2`,children:e})}function XF({className:e,type:t,...n}){return(0,V.jsx)(`input`,{type:t,"data-slot":`input`,className:K(`h-11 w-full rounded-md bg-zinc-950/70 px-3 py-2 text-base text-zinc-100 ring-1 ring-white/12 outline-none transition-shadow placeholder:text-zinc-600 focus-visible:ring-2 focus-visible:ring-cyan-400 disabled:cursor-not-allowed disabled:opacity-50 sm:h-9 sm:text-sm`,e),...n})}function ZF({className:e,...t}){return(0,V.jsx)(`label`,{"data-slot":`label`,className:K(`flex text-base font-medium text-zinc-300 sm:text-sm`,e),...t})}function QF({onOpened:e}){let t=(0,B.useRef)(null),[n,r]=(0,B.useState)(`~`),[i,a]=(0,B.useState)(`~`),[o,s]=(0,B.useState)(!1);(0,B.useEffect)(()=>{let e=window.setTimeout(()=>a(n.trim()),250);return()=>window.clearTimeout(e)},[n]);let c=at({queryKey:[`filesystem-directories`,i,o],queryFn:()=>aC.browseDirectories(i,o),enabled:!!i,retry:!1}),l=st({mutationFn:e=>aC.addProject(e),onSuccess:e,onError:nj}),u=n.trim()===i,d=u&&!c.isError&&c.data?.input===i?c.data:void 0,f=u&&c.isSuccess&&!c.isFetching&&d?.exact&&d.repository.state===`valid`?d.repository:null,p=l.isPending,m=e=>{r(e),a(e),window.requestAnimationFrame(()=>t.current?.focus())};return(0,V.jsxs)(`form`,{className:`flex flex-col gap-3 max-[700px]:gap-4`,onSubmit:e=>{e.preventDefault(),!(!f||p)&&l.mutate(f.repositoryPath)},children:[(0,V.jsxs)(YF,{children:[(0,V.jsx)(ZF,{htmlFor:`repository-path`,children:`Server folder`}),(0,V.jsx)(XF,{ref:t,id:`repository-path`,name:`repository-path`,value:n,onChange:e=>r(e.target.value),onKeyDown:e=>{if(!e.nativeEvent.isComposing){if(e.key===`Enter`&&!f){e.preventDefault(),a(n.trim());return}if(e.key===`ArrowDown`){let t=document.querySelector(`#project-directory-list button`);t&&(e.preventDefault(),t.focus());return}e.key===`Escape`&&d&&n.trim()!==d.directory.path&&(e.preventDefault(),e.stopPropagation(),m(d.directory.path))}},placeholder:`/Users/you/Projects/example`,"aria-label":`Server folder path`,"aria-describedby":`repository-path-status`,"aria-invalid":c.isError,autoFocus:!0,disabled:p})]}),(0,V.jsx)(`div`,{className:`flex min-h-8 flex-wrap items-center gap-2 min-[701px]:min-h-7`,children:d&&(0,V.jsxs)(V.Fragment,{children:[(0,V.jsxs)(q,{type:`button`,variant:`outline`,size:`sm`,onClick:()=>m(d.directory.homePath),disabled:p,children:[(0,V.jsx)(BF,{"data-icon":`inline-start`}),`Home`]}),(0,V.jsx)(q,{type:`button`,variant:`outline`,size:`sm`,onClick:()=>m(d.directory.rootPath),disabled:p,children:`Root`}),(0,V.jsxs)(`label`,{className:`ml-auto flex cursor-pointer items-center gap-2 text-base text-zinc-400 min-[701px]:text-sm`,children:[(0,V.jsx)(`input`,{type:`checkbox`,checked:o,onChange:e=>s(e.target.checked),disabled:p}),`Show hidden folders`]})]})}),(0,V.jsxs)(`div`,{className:`overflow-hidden rounded-lg bg-zinc-950/50 ring-1 ring-white/10`,children:[(0,V.jsx)(`div`,{className:`flex min-h-10 items-center gap-1 overflow-x-auto border-b border-white/8 px-2 py-1.5 min-[701px]:min-h-8 min-[701px]:p-1`,children:d&&(0,V.jsxs)(V.Fragment,{children:[d.directory.parentPath&&(0,V.jsx)(q,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":`Parent folder`,onClick:()=>m(d.directory.parentPath),disabled:p,children:(0,V.jsx)(SF,{})}),d.directory.breadcrumbs.map((e,t)=>(0,V.jsxs)(`div`,{className:`flex items-center gap-1`,children:[t>0&&(0,V.jsx)(AF,{className:`size-3.5 shrink-0 fill-zinc-600`}),(0,V.jsx)(q,{type:`button`,variant:`ghost`,size:`sm`,className:`max-w-48`,title:e.path,onClick:()=>m(e.path),disabled:p,children:(0,V.jsx)(`span`,{className:`truncate`,children:e.name})})]},e.path))]})}),(0,V.jsxs)(`div`,{id:`project-directory-list`,className:`grid h-64 content-start gap-0.5 overflow-y-auto p-1.5 min-[701px]:h-56 min-[701px]:p-1 [scrollbar-color:var(--color-zinc-700)_transparent]`,"aria-label":`Folders`,children:[c.isFetching&&(0,V.jsx)(`p`,{className:`form-note p-3`,role:`status`,children:`Looking for folders…`}),c.isError&&(0,V.jsxs)(`div`,{className:`flex items-center justify-between gap-3 p-3`,children:[(0,V.jsx)(`p`,{className:`text-base text-rose-300 min-[701px]:text-sm`,role:`alert`,children:c.error.message}),(0,V.jsx)(q,{type:`button`,variant:`secondary`,size:`sm`,onClick:()=>c.refetch(),children:`Retry`})]}),!c.isFetching&&d?.directory.entries.map(e=>(0,V.jsxs)(`button`,{type:`button`,className:`flex min-w-0 items-center gap-2 rounded-md px-2.5 py-2 text-left text-base text-zinc-200 outline-none hover:bg-white/6 focus-visible:bg-white/6 focus-visible:outline-2 focus-visible:outline-cyan-400 min-[701px]:px-2 min-[701px]:py-1.5 min-[701px]:text-sm`,title:e.path,onClick:()=>m(e.path),onKeyDown:e=>{if(e.key===`Escape`){e.preventDefault(),e.stopPropagation(),t.current?.focus();return}if(e.key!==`ArrowDown`&&e.key!==`ArrowUp`)return;e.preventDefault();let n=[...document.querySelectorAll(`#project-directory-list button`)],r=n.indexOf(e.currentTarget),i=e.key===`ArrowDown`?Math.min(r+1,n.length-1):r-1;i>=0?n[i]?.focus():t.current?.focus()},disabled:p,children:[(0,V.jsx)(RF,{className:`size-4 shrink-0 fill-cyan-500/80`}),(0,V.jsx)(`span`,{className:`truncate`,children:e.name})]},e.path)),!c.isFetching&&d&&d.directory.entries.length===0&&(0,V.jsx)(`p`,{className:`form-note p-3`,role:`status`,children:d.exact?`This folder has no subfolders.`:`No matching folders.`}),d?.directory.truncated&&(0,V.jsx)(`p`,{className:`form-note p-3`,role:`status`,children:`More folders are available. Type more of the path to narrow the list.`})]})]}),(0,V.jsx)(`p`,{id:`repository-path-status`,className:K(`form-note min-h-5 truncate`,d?.repository.state===`valid`?`text-emerald-300`:c.isError||d?.repository.state===`not-repository`?`text-rose-300`:void 0),title:d?.repository.state===`valid`?d.repository.repositoryPath:void 0,"aria-live":`polite`,children:i?c.isFetching||!u?`Checking folder…`:c.isError?c.error.message:d?.repository.state===`valid`?`Will open repository: ${d.repository.repositoryPath}`:d?.repository.message:`Enter a folder path on the Treeport server.`}),(0,V.jsx)(q,{type:`submit`,className:`self-end`,disabled:!f||p,children:p?`Opening…`:`Open project`})]})}function $F({open:e,onOpenChange:t,restoreFocusTo:n,onOpened:r}){return(0,V.jsx)(fF,{open:e,onOpenChange:t,children:(0,V.jsxs)(hF,{className:`max-w-xl gap-3 p-4 max-[700px]:gap-4`,restoreFocusTo:n,children:[(0,V.jsxs)(gF,{children:[(0,V.jsx)(_F,{className:`text-lg tracking-normal sm:text-lg`,children:`Open project`}),(0,V.jsx)(vF,{children:`Browse folders on the Treeport server.`})]}),(0,V.jsx)(QF,{onOpened:r})]})})}var eI=3e4,tI=75,nI=3e3;function rI(e,t){return e>=2?!1:t instanceof rC?t.status===408||t.status===429||t.status>=500:!0}function iI(e){return Math.min(2e3,500*2**Math.max(0,e))}function aI(e,t=tI){let n=null,r=!1,i=!1,a=!1,o=async()=>{if(n=null,!a){if(r){i=!0;return}r=!0;try{await e()}catch{}finally{r=!1,i&&!a&&(i=!1,n=setTimeout(()=>void o(),t))}}};return{schedule(){if(!a){if(r){i=!0;return}n===null&&(n=setTimeout(()=>void o(),t))}},dispose(){a=!0,i=!1,n!==null&&clearTimeout(n),n=null}}}var oI=[`projects`],sI=[`recent-projects`],cI=[`terminal-presets`],lI=ot({queryKey:oI,queryFn:aC.projects,staleTime:eI,retry:rI,retryDelay:iI,refetchInterval:5e3,refetchOnReconnect:!0,refetchOnWindowFocus:!0}),uI=ot({queryKey:sI,queryFn:aC.recentProjects,retry:!1}),dI=ot({queryKey:cI,queryFn:aC.terminalPresets,staleTime:0,refetchInterval:5e3,refetchOnReconnect:!0,refetchOnWindowFocus:!0});function fI(){let e=Mi(),t=af();return(0,B.useCallback)((n,r=!1)=>{switch(n.kind===`terminal`&&t(n.terminalId),n.kind){case`root`:return e({to:`/`,replace:r});case`project`:return e({to:`/projects/$projectId`,params:{projectId:n.projectId},replace:r});case`worktree`:return e({to:`/projects/$projectId/worktrees/$worktreeId`,params:{projectId:n.projectId,worktreeId:n.worktreeId},replace:r});case`terminal`:return e({to:`/projects/$projectId/worktrees/$worktreeId/terminals/$terminalId`,params:{projectId:n.projectId,worktreeId:n.worktreeId,terminalId:n.terminalId},replace:r})}},[e,t])}function pI({projects:e,selectedProject:t,targetForProject:n,projectSwitcherTriggerRef:r,closeProjectUi:i,openedProjectUi:a}){let o=We(),s=_a(),c=fI(),l=st({mutationFn:e=>aC.closeProject(e.id),onSuccess:async(a,s)=>{let l=o.getQueryData(oI)??e,u=l.filter(e=>e.id!==s.id),d=l.findIndex(e=>e.id===s.id),f=u[Math.min(Math.max(d,0),u.length-1)]??null,p=t?.id===s.id;p&&(await c(f?n(f):{kind:`root`,pathname:`/`},!0),i()),o.setQueryData(oI,u);for(let e of s.worktrees.flatMap(e=>e.terminals))VA.forget(e.id);await Promise.all([o.invalidateQueries({queryKey:oI}),o.invalidateQueries({queryKey:sI})]),(p||!u.length)&&window.requestAnimationFrame(()=>r.current?.focus())},onError:e=>{nj(e),e instanceof rC&&e.code===`PROJECT_CLOSE_FAILED`&&o.invalidateQueries({queryKey:oI})}});return{closingProjectId:l.isPending?l.variables?.id??null:null,requestProjectClose:e=>{let t=e.worktrees.reduce((e,t)=>e+t.terminals.length,0);t>0&&!window.confirm(`Close “${e.name}”? This will terminate ${t} Treeport terminal ${t===1?`session and its process`:`sessions and their processes`}. Git worktrees and files will remain on disk, and you can reopen the project from Recent projects.`)||l.mutate(e)},projectOpened:async t=>{let r=e.length===0&&s.pathname===`/`;o.setQueryData(oI,e=>[...(e??[]).filter(e=>e.id!==t.id),t]),o.setQueryData(sI,e=>e?.filter(e=>e.id!==t.id)),await c(n(t),r),await Promise.all([o.invalidateQueries({queryKey:oI}),o.invalidateQueries({queryKey:sI})]),a()}}}function mI({working:e,className:t,title:n}){return(0,V.jsxs)(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.5`,strokeLinecap:`round`,strokeLinejoin:`round`,className:K(`transition-colors duration-300`,t),"aria-hidden":!n||void 0,children:[n?(0,V.jsx)(`title`,{children:n}):null,(0,V.jsxs)(`g`,{className:K(`origin-center transition-transform duration-500`,e&&`scale-[0.62]`),children:[(0,V.jsx)(`polyline`,{points:`4 17 10 11 4 5`}),(0,V.jsx)(`line`,{x1:`12`,y1:`19`,x2:`20`,y2:`19`})]}),(0,V.jsx)(`rect`,{x:`3`,y:`3`,width:`18`,height:`18`,rx:`5`,className:K(`opacity-0 transition-opacity duration-500`,e&&`opacity-25`)}),(0,V.jsx)(`rect`,{x:`3`,y:`3`,width:`18`,height:`18`,rx:`5`,pathLength:`100`,strokeDasharray:`30 70`,className:K(`opacity-0 transition-opacity duration-500`,e&&`opacity-100 animate-comet motion-reduce:animate-none`)})]})}var hI=Object.defineProperty,gI=(e,t)=>hI(e,`name`,{value:t,configurable:!0}),_I=`horizontal`,vI=[`horizontal`,`vertical`],yI=B.forwardRef(gI(function(e,t){let{decorative:n,orientation:r=_I,...i}=e,a=bI(r)?r:_I,o=n?{role:`none`}:{"aria-orientation":a===`vertical`?a:void 0,role:`separator`};return(0,V.jsx)(rM.div,{"data-orientation":a,...o,...i,ref:t})},`Separator`));function bI(e){return vI.includes(e)}gI(bI,`isValidOrientation`);var xI=yI,SI=B.forwardRef(({className:e,orientation:t=`horizontal`,decorative:n=!0,...r},i)=>(0,V.jsx)(xI,{ref:i,decorative:n,orientation:t,className:K(`shrink-0 bg-border`,t===`horizontal`?`h-[1px] w-full`:`h-full w-[1px]`,e),...r}));SI.displayName=xI.displayName;var CI=0,wI=null;function TI(){B.useEffect(()=>{wI||={start:EI(),end:EI()};let{start:e,end:t}=wI;return document.body.firstElementChild!==e&&document.body.insertAdjacentElement(`afterbegin`,e),document.body.lastElementChild!==t&&document.body.insertAdjacentElement(`beforeend`,t),CI++,()=>{CI===1&&(wI?.start.remove(),wI?.end.remove(),wI=null),CI=Math.max(0,CI-1)}},[])}function EI(){let e=document.createElement(`span`);return e.setAttribute(`data-radix-focus-guard`,``),e.tabIndex=0,e.style.outline=`none`,e.style.opacity=`0`,e.style.position=`fixed`,e.style.pointerEvents=`none`,e}var DI=`focusScope.autoFocusOnMount`,OI=`focusScope.autoFocusOnUnmount`,kI={bubbles:!1,cancelable:!0},AI=`FocusScope`,jI=B.forwardRef((e,t)=>{let{loop:n=!1,trapped:r=!1,onMountAutoFocus:i,onUnmountAutoFocus:a,...o}=e,[s,c]=B.useState(null),l=_o(i),u=_o(a),d=B.useRef(null),f=$a(t,c),p=B.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;B.useEffect(()=>{if(r){let e=function(e){if(p.paused||!s)return;let t=e.target;s.contains(t)?d.current=t:RI(d.current,{select:!0})},t=function(e){if(p.paused||!s)return;let t=e.relatedTarget;t!==null&&(s.contains(t)||RI(d.current,{select:!0}))},n=function(e){if(document.activeElement===document.body)for(let t of e)t.removedNodes.length>0&&RI(s)};document.addEventListener(`focusin`,e),document.addEventListener(`focusout`,t);let r=new MutationObserver(n);return s&&r.observe(s,{childList:!0,subtree:!0}),()=>{document.removeEventListener(`focusin`,e),document.removeEventListener(`focusout`,t),r.disconnect()}}},[r,s,p.paused]),B.useEffect(()=>{if(s){zI.add(p);let e=document.activeElement;if(!s.contains(e)){let t=new CustomEvent(DI,kI);s.addEventListener(DI,l),s.dispatchEvent(t),t.defaultPrevented||(MI(HI(PI(s)),{select:!0}),document.activeElement===e&&RI(s))}return()=>{s.removeEventListener(DI,l),setTimeout(()=>{let t=new CustomEvent(OI,kI);s.addEventListener(OI,u),s.dispatchEvent(t),t.defaultPrevented||RI(e??document.body,{select:!0}),s.removeEventListener(OI,u),zI.remove(p)},0)}}},[s,l,u,p]);let m=B.useCallback(e=>{if(!n&&!r||p.paused)return;let t=e.key===`Tab`&&!e.altKey&&!e.ctrlKey&&!e.metaKey,i=document.activeElement;if(t&&i){let t=e.currentTarget,[r,a]=NI(t);r&&a?!e.shiftKey&&i===a?(e.preventDefault(),n&&RI(r,{select:!0})):e.shiftKey&&i===r&&(e.preventDefault(),n&&RI(a,{select:!0})):i===t&&e.preventDefault()}},[n,r,p.paused]);return(0,V.jsx)(ho.div,{tabIndex:-1,...o,ref:f,onKeyDown:m})});jI.displayName=AI;function MI(e,{select:t=!1}={}){let n=document.activeElement;for(let r of e)if(RI(r,{select:t}),document.activeElement!==n)return}function NI(e){let t=PI(e);return[FI(t,e),FI(t.reverse(),e)]}function PI(e){let t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:e=>{let t=e.tagName===`INPUT`&&e.type===`hidden`;return e.disabled||e.hidden||t?NodeFilter.FILTER_SKIP:e.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function FI(e,t){let n=typeof t.checkVisibility==`function`&&t.checkVisibility({checkVisibilityCSS:!0});for(let r of e)if(!(n?!r.checkVisibility({checkVisibilityCSS:!0}):II(r,{upTo:t})))return r}function II(e,{upTo:t}){if(getComputedStyle(e).visibility===`hidden`)return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display===`none`)return!0;e=e.parentElement}return!1}function LI(e){return e instanceof HTMLInputElement&&`select`in e}function RI(e,{select:t=!1}={}){if(e&&e.focus){let n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&LI(e)&&t&&e.select()}}var zI=BI();function BI(){let e=[];return{add(t){let n=e[0];t!==n&&n?.pause(),e=VI(e,t),e.unshift(t)},remove(t){e=VI(e,t),e[0]?.resume()}}}function VI(e,t){let n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}function HI(e){return e.filter(e=>e.tagName!==`A`)}var UI=`Popover`,[WI,GI]=eo(UI,[$c]),KI=$c(),[qI,JI]=WI(UI),YI=e=>{let{__scopePopover:t,children:n,open:r,defaultOpen:i,onOpenChange:a,modal:o=!1}=e,s=KI(t),c=B.useRef(null),[l,u]=B.useState(!1),[d,f]=Ml({prop:r,defaultProp:i??!1,onChange:a,caller:UI});return(0,V.jsx)(hl,{...s,children:(0,V.jsx)(qI,{scope:t,contentId:Fo(),triggerRef:c,open:d,onOpenChange:f,onOpenToggle:B.useCallback(()=>f(e=>!e),[f]),hasCustomAnchor:l,onCustomAnchorAdd:B.useCallback(()=>u(!0),[]),onCustomAnchorRemove:B.useCallback(()=>u(!1),[]),modal:o,children:n})})};YI.displayName=UI;var XI=`PopoverAnchor`,ZI=B.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=JI(XI,n),a=KI(n),{onCustomAnchorAdd:o,onCustomAnchorRemove:s}=i;return B.useEffect(()=>(o(),()=>s()),[o,s]),(0,V.jsx)(gl,{...a,...r,ref:t})});ZI.displayName=XI;var QI=`PopoverTrigger`,$I=B.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=JI(QI,n),a=KI(n),o=$a(t,i.triggerRef),s=(0,V.jsx)(ho.button,{type:`button`,"aria-haspopup":`dialog`,"aria-expanded":i.open,"aria-controls":i.open?i.contentId:void 0,"data-state":mL(i.open),...r,ref:o,onClick:Xa(e.onClick,i.onOpenToggle)});return i.hasCustomAnchor?s:(0,V.jsx)(gl,{asChild:!0,...a,children:s})});$I.displayName=QI;var eL=`PopoverPortal`,[tL,nL]=WI(eL,{forceMount:void 0}),rL=e=>{let{__scopePopover:t,forceMount:n,children:r,container:i}=e,a=JI(eL,t);return(0,V.jsx)(tL,{scope:t,forceMount:n,children:(0,V.jsx)(Sl,{present:n||a.open,children:(0,V.jsx)(bl,{asChild:!0,container:i,children:r})})})};rL.displayName=eL;var iL=`PopoverContent`,aL=B.forwardRef((e,t)=>{let n=nL(iL,e.__scopePopover),{forceMount:r=n.forceMount,...i}=e,a=JI(iL,e.__scopePopover);return(0,V.jsx)(Sl,{present:r||a.open,children:a.modal?(0,V.jsx)(sL,{...i,ref:t}):(0,V.jsx)(cL,{...i,ref:t})})});aL.displayName=iL;var oL=no(`PopoverContent.RemoveScroll`),sL=B.forwardRef((e,t)=>{let n=JI(iL,e.__scopePopover),r=B.useRef(null),i=$a(t,r),a=B.useRef(!1);return B.useEffect(()=>{let e=r.current;if(e)return bP(e)},[]),(0,V.jsx)(dP,{as:oL,allowPinchZoom:!0,children:(0,V.jsx)(lL,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:Xa(e.onCloseAutoFocus,e=>{e.preventDefault(),a.current||n.triggerRef.current?.focus()}),onPointerDownOutside:Xa(e.onPointerDownOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0,r=t.button===2||n;a.current=r},{checkForDefaultPrevented:!1}),onFocusOutside:Xa(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1})})})}),cL=B.forwardRef((e,t)=>{let n=JI(iL,e.__scopePopover),r=B.useRef(!1),i=B.useRef(!1);return(0,V.jsx)(lL,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),t.defaultPrevented||(r.current||n.triggerRef.current?.focus(),t.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),t.defaultPrevented||(r.current=!0,t.detail.originalEvent.type===`pointerdown`&&(i.current=!0));let a=t.target;n.triggerRef.current?.contains(a)&&t.preventDefault(),t.detail.originalEvent.type===`focusin`&&i.current&&t.preventDefault()}})}),lL=B.forwardRef((e,t)=>{let{__scopePopover:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:a,disableOutsidePointerEvents:o,onEscapeKeyDown:s,onPointerDownOutside:c,onFocusOutside:l,onInteractOutside:u,...d}=e,f=JI(iL,n),p=KI(n);return TI(),(0,V.jsx)(jI,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:a,children:(0,V.jsx)(wo,{asChild:!0,disableOutsidePointerEvents:o,onInteractOutside:u,onEscapeKeyDown:s,onPointerDownOutside:c,onFocusOutside:l,onDismiss:()=>f.onOpenChange(!1),deferPointerDownOutside:!0,children:(0,V.jsx)(_l,{"data-state":mL(f.open),role:`dialog`,id:f.contentId,...p,...d,ref:t,style:{...d.style,"--radix-popover-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-popover-content-available-width":`var(--radix-popper-available-width)`,"--radix-popover-content-available-height":`var(--radix-popper-available-height)`,"--radix-popover-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-popover-trigger-height":`var(--radix-popper-anchor-height)`}})})})}),uL=`PopoverClose`,dL=B.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=JI(uL,n);return(0,V.jsx)(ho.button,{type:`button`,...r,ref:t,onClick:Xa(e.onClick,()=>i.onOpenChange(!1))})});dL.displayName=uL;var fL=`PopoverArrow`,pL=B.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=KI(n);return(0,V.jsx)(vl,{...i,...r,ref:t})});pL.displayName=fL;function mL(e){return e?`open`:`closed`}var hL=YI,gL=$I,_L=rL,vL=aL;function yL(e){return(0,V.jsx)(hL,{...e})}function bL(e){return(0,V.jsx)(gL,{...e})}function xL({className:e,align:t=`start`,sideOffset:n=6,portalled:r=!0,...i}){let a=(0,V.jsx)(vL,{align:t,sideOffset:n,className:K(`z-100 w-52 rounded-lg bg-zinc-900 p-3 text-zinc-200 shadow-xl ring-1 ring-white/10 outline-none`,e),...i});return r?(0,V.jsx)(_L,{children:a}):a}var SL=`(max-width: 700px)`;function CL(e){let t=window.matchMedia(SL);return t.addEventListener(`change`,e),()=>t.removeEventListener(`change`,e)}function wL(){return window.matchMedia(SL).matches}function TL(){return(0,B.useSyncExternalStore)(CL,wL,()=>!1)}var EL=OP,DL=PP,OL=B.forwardRef(({className:e,...t},n)=>(0,V.jsx)(IP,{className:K(`fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0`,e),...t,ref:n}));OL.displayName=IP.displayName;var kL=Af(`fixed z-50 gap-4 bg-background p-6 shadow-lg transition ease-in-out data-[state=closed]:duration-300 data-[state=open]:duration-500 data-[state=open]:animate-in data-[state=closed]:animate-out`,{variants:{side:{top:`inset-x-0 top-0 border-b data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top`,bottom:`inset-x-0 bottom-0 border-t data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom`,left:`inset-y-0 left-0 h-full w-3/4 border-r data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left sm:max-w-sm`,right:`inset-y-0 right-0 h-full w-3/4 border-l data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right sm:max-w-sm`}},defaultVariants:{side:`right`}}),AL=B.forwardRef(({side:e=`right`,className:t,children:n,showCloseButton:r=!0,...i},a)=>(0,V.jsxs)(DL,{children:[(0,V.jsx)(OL,{}),(0,V.jsxs)(BP,{ref:a,className:K(kL({side:e}),t),...i,children:[r?(0,V.jsxs)(YP,{className:`absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-secondary`,children:[(0,V.jsx)(dF,{className:`size-4`}),(0,V.jsx)(`span`,{className:`sr-only`,children:`Close`})]}):null,n]})]}));AL.displayName=BP.displayName;var jL=({className:e,...t})=>(0,V.jsx)(`div`,{className:K(`flex flex-col gap-2 text-center sm:text-left`,e),...t});jL.displayName=`SheetHeader`;var ML=({className:e,...t})=>(0,V.jsx)(`div`,{className:K(`flex flex-col-reverse gap-2 sm:flex-row sm:justify-end`,e),...t});ML.displayName=`SheetFooter`;var NL=B.forwardRef(({className:e,...t},n)=>(0,V.jsx)(GP,{ref:n,className:K(`text-lg font-semibold text-foreground`,e),...t}));NL.displayName=GP.displayName;var PL=B.forwardRef(({className:e,...t},n)=>(0,V.jsx)(qP,{ref:n,className:K(`text-sm text-muted-foreground`,e),...t}));PL.displayName=qP.displayName;function FL({className:e,...t}){return(0,V.jsx)(`div`,{className:K(`animate-pulse rounded-md bg-primary/10`,e),...t})}var IL=`16rem`,LL=`min(88vw, 21rem)`,RL=`3rem`,zL=B.createContext(null);function BL(){let e=B.useContext(zL);if(!e)throw Error(`useSidebar must be used within a SidebarProvider.`);return e}var VL=B.forwardRef(({defaultOpen:e=!0,open:t,onOpenChange:n,className:r,style:i,children:a,...o},s)=>{let c=TL(),[l,u]=B.useState(!1),d=B.useRef(null),f=B.useRef(!1),p=B.useCallback(e=>{u(t=>{let n=typeof e==`function`?e(t):e;return!t&&n&&(d.current=document.activeElement instanceof HTMLElement?document.activeElement:null),n})},[]),m=B.useCallback(()=>{f.current=!0,u(!1)},[]),[h,g]=B.useState(e),_=t??h,v=B.useCallback(e=>{let t=typeof e==`function`?e(_):e;n?n(t):g(t)},[n,_]),y=B.useCallback(()=>{c&&p(e=>!e)},[c,p]),b=_?`expanded`:`collapsed`,x=B.useMemo(()=>({state:b,open:_,setOpen:v,isMobile:c,openMobile:l,setOpenMobile:p,mobileRestoreFocusRef:d,skipMobileFocusRestoreRef:f,closeMobileWithoutFocusRestore:m,toggleSidebar:y}),[b,_,v,c,l,p,y]);return(0,V.jsx)(zL.Provider,{value:x,children:(0,V.jsx)(Zd,{delayDuration:0,children:(0,V.jsx)(`div`,{style:{"--sidebar-width":IL,"--sidebar-width-icon":RL,...i},className:K(`group/sidebar-wrapper flex min-h-svh w-full has-[[data-variant=inset]]:bg-sidebar`,r),ref:s,...o,children:a})})})});VL.displayName=`SidebarProvider`;var HL=B.forwardRef(({side:e=`left`,variant:t=`sidebar`,collapsible:n=`offcanvas`,className:r,children:i,mobileTitle:a=`Sidebar`,mobileDescription:o=`Displays the mobile sidebar.`,...s},c)=>{let{isMobile:l,state:u,openMobile:d,setOpenMobile:f,mobileRestoreFocusRef:p,skipMobileFocusRestoreRef:m}=BL();return l?(0,V.jsx)(EL,{open:d,onOpenChange:f,children:(0,V.jsxs)(AL,{"data-sidebar":`sidebar`,"data-mobile":`true`,className:`w-(--sidebar-width-mobile) bg-zinc-900/95 p-0 text-zinc-100 backdrop-blur-xl`,style:{"--sidebar-width-mobile":LL},side:e,showCloseButton:!1,onCloseAutoFocus:e=>{e.preventDefault(),m.current?m.current=!1:p.current?.isConnected&&p.current.focus()},children:[(0,V.jsxs)(jL,{className:`sr-only`,children:[(0,V.jsx)(NL,{children:a}),(0,V.jsx)(PL,{children:o})]}),(0,V.jsx)(`div`,{ref:c,className:K(`flex h-full w-full flex-col`,r),...s,children:i})]})}):n===`none`?(0,V.jsx)(`div`,{className:K(`flex h-full w-(--sidebar-width) flex-col bg-sidebar text-sidebar-foreground`,r),ref:c,...s,children:i}):(0,V.jsxs)(`div`,{ref:c,className:`group peer hidden text-sidebar-foreground min-[701px]:block`,"data-state":u,"data-collapsible":u===`collapsed`?n:``,"data-variant":t,"data-side":e,children:[(0,V.jsx)(`div`,{className:K(`relative w-[--sidebar-width] bg-transparent transition-[width] duration-200 ease-linear`,`group-data-[collapsible=offcanvas]:w-0`,`group-data-[side=right]:rotate-180`,t===`floating`||t===`inset`?`group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)_+_theme(spacing.4))]`:`group-data-[collapsible=icon]:w-[--sidebar-width-icon]`)}),(0,V.jsx)(`div`,{className:K(`fixed inset-y-0 z-10 hidden h-svh w-[--sidebar-width] transition-[left,right,width] duration-200 ease-linear min-[701px]:flex`,e===`left`?`left-0 group-data-[collapsible=offcanvas]:left-[calc(var(--sidebar-width)*-1)]`:`right-0 group-data-[collapsible=offcanvas]:right-[calc(var(--sidebar-width)*-1)]`,t===`floating`||t===`inset`?`p-2 group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)_+_theme(spacing.4)_+2px)]`:`group-data-[collapsible=icon]:w-[--sidebar-width-icon] group-data-[side=left]:border-r group-data-[side=right]:border-l`,r),...s,children:(0,V.jsx)(`div`,{"data-sidebar":`sidebar`,className:`flex h-full w-full flex-col bg-sidebar group-data-[variant=floating]:rounded-lg group-data-[variant=floating]:border group-data-[variant=floating]:border-sidebar-border group-data-[variant=floating]:shadow`,children:i})})]})});HL.displayName=`Sidebar`;var UL=B.forwardRef(({className:e,onClick:t,children:n,...r},i)=>{let{toggleSidebar:a}=BL();return(0,V.jsxs)(q,{ref:i,"data-sidebar":`trigger`,variant:`ghost`,size:`icon`,className:K(`size-7`,e),onClick:e=>{t?.(e),a()},...r,children:[n??(0,V.jsx)(uF,{}),r[`aria-label`]?null:(0,V.jsx)(`span`,{className:`sr-only`,children:`Toggle Sidebar`})]})});UL.displayName=`SidebarTrigger`;var WL=B.forwardRef(({className:e,...t},n)=>{let{toggleSidebar:r}=BL();return(0,V.jsx)(`button`,{ref:n,"data-sidebar":`rail`,"aria-label":`Toggle Sidebar`,tabIndex:-1,onClick:r,title:`Toggle Sidebar`,className:K(`absolute inset-y-0 z-20 hidden w-4 -translate-x-1/2 transition-all ease-linear after:absolute after:inset-y-0 after:left-1/2 after:w-[2px] hover:after:bg-sidebar-border group-data-[side=left]:-right-4 group-data-[side=right]:left-0 min-[701px]:flex`,`[[data-side=left]_&]:cursor-w-resize [[data-side=right]_&]:cursor-e-resize`,`[[data-side=left][data-state=collapsed]_&]:cursor-e-resize [[data-side=right][data-state=collapsed]_&]:cursor-w-resize`,`group-data-[collapsible=offcanvas]:translate-x-0 group-data-[collapsible=offcanvas]:after:left-full group-data-[collapsible=offcanvas]:hover:bg-sidebar`,`[[data-side=left][data-collapsible=offcanvas]_&]:-right-2`,`[[data-side=right][data-collapsible=offcanvas]_&]:-left-2`,e),...t})});WL.displayName=`SidebarRail`;var GL=B.forwardRef(({className:e,asChild:t=!1,...n},r)=>(0,V.jsx)(t?hf:`main`,{ref:r,className:K(`relative flex w-full flex-1 flex-col bg-background`,`min-[701px]:peer-data-[variant=inset]:m-2 min-[701px]:peer-data-[state=collapsed]:peer-data-[variant=inset]:ml-2 min-[701px]:peer-data-[variant=inset]:ml-0 min-[701px]:peer-data-[variant=inset]:rounded-xl min-[701px]:peer-data-[variant=inset]:shadow`,e),...n}));GL.displayName=`SidebarInset`;var KL=B.forwardRef(({className:e,...t},n)=>(0,V.jsx)(XF,{ref:n,"data-sidebar":`input`,className:K(`h-8 w-full bg-background shadow-none focus-visible:ring-2 focus-visible:ring-sidebar-ring`,e),...t}));KL.displayName=`SidebarInput`;var qL=B.forwardRef(({className:e,...t},n)=>(0,V.jsx)(`div`,{ref:n,"data-sidebar":`header`,className:K(`flex flex-col gap-2 p-2`,e),...t}));qL.displayName=`SidebarHeader`;var JL=B.forwardRef(({className:e,...t},n)=>(0,V.jsx)(`div`,{ref:n,"data-sidebar":`footer`,className:K(`flex flex-col gap-2 p-2`,e),...t}));JL.displayName=`SidebarFooter`;var YL=B.forwardRef(({className:e,...t},n)=>(0,V.jsx)(SI,{ref:n,"data-sidebar":`separator`,className:K(`mx-2 w-auto bg-sidebar-border`,e),...t}));YL.displayName=`SidebarSeparator`;var XL=B.forwardRef(({className:e,...t},n)=>(0,V.jsx)(`div`,{ref:n,"data-sidebar":`content`,className:K(`flex min-h-0 flex-1 flex-col gap-2 overflow-auto group-data-[collapsible=icon]:overflow-hidden`,e),...t}));XL.displayName=`SidebarContent`;var ZL=B.forwardRef(({className:e,...t},n)=>(0,V.jsx)(`div`,{ref:n,"data-sidebar":`group`,className:K(`relative flex w-full min-w-0 flex-col p-2`,e),...t}));ZL.displayName=`SidebarGroup`;var QL=B.forwardRef(({className:e,asChild:t=!1,...n},r)=>(0,V.jsx)(t?hf:`div`,{ref:r,"data-sidebar":`group-label`,className:K(`flex h-8 shrink-0 items-center rounded-md px-2 text-xs font-medium text-sidebar-foreground/70 outline-none ring-sidebar-ring transition-[margin,opacity] duration-200 ease-linear focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0`,`group-data-[collapsible=icon]:-mt-8 group-data-[collapsible=icon]:opacity-0`,e),...n}));QL.displayName=`SidebarGroupLabel`;var $L=B.forwardRef(({className:e,asChild:t=!1,...n},r)=>(0,V.jsx)(t?hf:`button`,{ref:r,"data-sidebar":`group-action`,className:K(`absolute right-3 top-3.5 flex size-5 items-center justify-center rounded-md p-0 text-sidebar-foreground outline-none ring-sidebar-ring transition-transform hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0`,`after:absolute after:-inset-2 after:min-[701px]:hidden`,`group-data-[collapsible=icon]:hidden`,e),...n}));$L.displayName=`SidebarGroupAction`;var eR=B.forwardRef(({className:e,...t},n)=>(0,V.jsx)(`div`,{ref:n,"data-sidebar":`group-content`,className:K(`w-full text-sm`,e),...t}));eR.displayName=`SidebarGroupContent`;var tR=B.forwardRef(({className:e,...t},n)=>(0,V.jsx)(`ul`,{ref:n,"data-sidebar":`menu`,className:K(`flex w-full min-w-0 flex-col gap-1`,e),...t}));tR.displayName=`SidebarMenu`;var nR=B.forwardRef(({className:e,...t},n)=>(0,V.jsx)(`li`,{ref:n,"data-sidebar":`menu-item`,className:K(`group/menu-item relative`,e),...t}));nR.displayName=`SidebarMenuItem`;var rR=Af(`peer/menu-button flex w-full items-center gap-2 overflow-hidden rounded-md p-2 text-left text-sm outline-none ring-sidebar-ring transition-[width,height,padding] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 active:bg-sidebar-accent active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 group-has-[[data-sidebar=menu-action]]/menu-item:pr-8 aria-disabled:pointer-events-none aria-disabled:opacity-50 data-[active=true]:bg-sidebar-accent data-[active=true]:font-medium data-[active=true]:text-sidebar-accent-foreground data-[state=open]:hover:bg-sidebar-accent data-[state=open]:hover:text-sidebar-accent-foreground group-data-[collapsible=icon]:!size-8 group-data-[collapsible=icon]:!p-2 [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0`,{variants:{variant:{default:`hover:bg-sidebar-accent hover:text-sidebar-accent-foreground`,outline:`bg-background shadow-[0_0_0_1px_hsl(var(--sidebar-border))] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground hover:shadow-[0_0_0_1px_hsl(var(--sidebar-accent))]`},size:{default:`h-8 text-sm`,sm:`h-7 text-xs`,lg:`h-12 text-sm group-data-[collapsible=icon]:!p-0`}},defaultVariants:{variant:`default`,size:`default`}}),iR=B.forwardRef(({asChild:e=!1,isActive:t=!1,variant:n=`default`,size:r=`default`,tooltip:i,className:a,...o},s)=>{let c=e?hf:`button`,{isMobile:l,state:u}=BL(),d=(0,V.jsx)(c,{ref:s,"data-sidebar":`menu-button`,"data-size":r,"data-active":t,className:K(rR({variant:n,size:r}),a),...o});return i?(typeof i==`string`&&(i={children:i}),(0,V.jsxs)(Qd,{children:[(0,V.jsx)($d,{asChild:!0,children:d}),(0,V.jsx)(ef,{side:`right`,align:`center`,hidden:u!==`collapsed`||l,...i})]})):d});iR.displayName=`SidebarMenuButton`;var aR=B.forwardRef(({className:e,asChild:t=!1,showOnHover:n=!1,...r},i)=>(0,V.jsx)(t?hf:`button`,{ref:i,"data-sidebar":`menu-action`,className:K(`absolute right-1 top-1.5 flex size-5 items-center justify-center rounded-md p-0 text-sidebar-foreground outline-none ring-sidebar-ring transition-transform hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 peer-hover/menu-button:text-sidebar-accent-foreground [&>svg]:size-4 [&>svg]:shrink-0`,`after:absolute after:-inset-2 after:min-[701px]:hidden`,`peer-data-[size=sm]/menu-button:top-1`,`peer-data-[size=default]/menu-button:top-1.5`,`peer-data-[size=lg]/menu-button:top-2.5`,`group-data-[collapsible=icon]:hidden`,n&&`group-focus-within/menu-item:opacity-100 group-hover/menu-item:opacity-100 data-[state=open]:opacity-100 peer-data-[active=true]/menu-button:text-sidebar-accent-foreground min-[701px]:opacity-0`,e),...r}));aR.displayName=`SidebarMenuAction`;var oR=B.forwardRef(({className:e,...t},n)=>(0,V.jsx)(`div`,{ref:n,"data-sidebar":`menu-badge`,className:K(`pointer-events-none absolute right-1 flex h-5 min-w-5 select-none items-center justify-center rounded-md px-1 text-xs font-medium tabular-nums text-sidebar-foreground`,`peer-hover/menu-button:text-sidebar-accent-foreground peer-data-[active=true]/menu-button:text-sidebar-accent-foreground`,`peer-data-[size=sm]/menu-button:top-1`,`peer-data-[size=default]/menu-button:top-1.5`,`peer-data-[size=lg]/menu-button:top-2.5`,`group-data-[collapsible=icon]:hidden`,e),...t}));oR.displayName=`SidebarMenuBadge`;var sR=B.forwardRef(({className:e,showIcon:t=!1,...n},r)=>{let i=B.useMemo(()=>`${Math.floor(Math.random()*40)+50}%`,[]);return(0,V.jsxs)(`div`,{ref:r,"data-sidebar":`menu-skeleton`,className:K(`flex h-8 items-center gap-2 rounded-md px-2`,e),...n,children:[t&&(0,V.jsx)(FL,{className:`size-4 rounded-md`,"data-sidebar":`menu-skeleton-icon`}),(0,V.jsx)(FL,{className:`h-4 max-w-[--skeleton-width] flex-1`,"data-sidebar":`menu-skeleton-text`,style:{"--skeleton-width":i}})]})});sR.displayName=`SidebarMenuSkeleton`;var cR=B.forwardRef(({className:e,...t},n)=>(0,V.jsx)(`ul`,{ref:n,"data-sidebar":`menu-sub`,className:K(`mx-3.5 flex min-w-0 translate-x-px flex-col gap-1 border-l border-sidebar-border px-2.5 py-0.5`,`group-data-[collapsible=icon]:hidden`,e),...t}));cR.displayName=`SidebarMenuSub`;var lR=B.forwardRef(({...e},t)=>(0,V.jsx)(`li`,{ref:t,...e}));lR.displayName=`SidebarMenuSubItem`;var uR=B.forwardRef(({asChild:e=!1,size:t=`md`,isActive:n,className:r,...i},a)=>(0,V.jsx)(e?hf:`a`,{ref:a,"data-sidebar":`menu-sub-button`,"data-size":t,"data-active":n,className:K(`flex h-7 min-w-0 -translate-x-px items-center gap-2 overflow-hidden rounded-md px-2 text-sidebar-foreground outline-none ring-sidebar-ring hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 active:bg-sidebar-accent active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0 [&>svg]:text-sidebar-accent-foreground`,`data-[active=true]:bg-sidebar-accent data-[active=true]:text-sidebar-accent-foreground`,t===`sm`&&`text-xs`,t===`md`&&`text-sm`,`group-data-[collapsible=icon]:hidden`,r),...i}));uR.displayName=`SidebarMenuSubButton`;function dR({label:e,tooltip:t=e,className:n,disabled:r,onClick:i,children:a}){return(0,V.jsxs)(Qd,{children:[(0,V.jsx)($d,{asChild:!0,children:(0,V.jsxs)(q,{type:`button`,variant:`ghost`,size:`icon-sm`,className:n,"aria-label":e,disabled:r,onClick:e=>i(e.currentTarget),children:[a,(0,V.jsx)(`span`,{className:`touch-target`,"aria-hidden":`true`})]})}),(0,V.jsx)(ef,{side:`top`,children:t})]})}var fR=240,pR=420,mR=272,hR=`treeport-sidebar-width`,gR=(0,B.createContext)(null),_R=(0,B.createContext)(null);function vR(e){return Math.min(pR,Math.max(fR,e))}function yR(){let e=(0,B.useContext)(gR);if(!e)throw Error(`useProjectSwitcher must be used within WorkspaceShell.`);return e}function bR({children:e}){let t=window.treeportDesktop,[n,r]=(0,B.useState)(!1),[i,a]=(0,B.useState)(!1),o=(0,B.useRef)(null),s=(0,B.useRef)(!1),[c,l]=(0,B.useState)(()=>{let e=Number.parseInt(localStorage.getItem(hR)??``,10);return Number.isFinite(e)?vR(e):mR}),[u,d]=(0,B.useState)(!1),f=t!==void 0&&!(t.platform===`darwin`&&n);return(0,B.useEffect)(()=>t?.onFullscreenChange(r),[]),(0,V.jsx)(gR.Provider,{value:{open:i,setOpen:a,triggerRef:o,dismissedIntoTerminalRef:s},children:(0,V.jsx)(_R.Provider,{value:{width:c,resizing:u,setWidth:e=>{let t=vR(e);l(t),localStorage.setItem(hR,String(t))},setResizing:d},children:(0,V.jsxs)(VL,{className:K(`app-frame isolate grid h-dvh min-h-0 grid-cols-[var(--sidebar-width)_minmax(0,1fr)] bg-zinc-950 max-[700px]:grid-cols-1`,f?`grid-rows-[2rem_minmax(0,1fr)] max-[700px]:grid-rows-[2rem_3.25rem_minmax(0,1fr)]`:`max-[700px]:grid-rows-[3.25rem_minmax(0,1fr)]`,u&&`select-none`),style:{"--sidebar-width":`${c}px`,"--sidebar-width-mobile":`min(88vw, 21rem)`},children:[f?(0,V.jsx)(`div`,{className:`desktop-titlebar col-span-full h-8 bg-zinc-950`,"data-treeport-desktop-titlebar":!0,"aria-hidden":`true`}):null,e]})})})}function xR({children:e}){let{isMobile:t,openMobile:n}=BL(),r=yR();return(0,V.jsx)(GL,{asChild:!0,children:(0,V.jsx)(`div`,{className:`grid min-h-0 min-w-0 grid-rows-[minmax(0,1fr)] overflow-hidden bg-zinc-950`,inert:t&&n?!0:void 0,"aria-hidden":t&&n?!0:void 0,onPointerDownCapture:()=>{r.open&&(r.dismissedIntoTerminalRef.current=!0,r.setOpen(!1))},children:e})})}function SR(){let e=(0,B.useContext)(_R),t=(0,B.useRef)(null);if(!e)throw Error(`ResizableSidebarRail must be used within WorkspaceShell.`);let n=n=>{n.button===0&&(t.current={pointerX:n.clientX,width:e.width},n.currentTarget.setPointerCapture(n.pointerId),e.setResizing(!0))},r=n=>{t.current&&e.setWidth(t.current.width+n.clientX-t.current.pointerX)},i=n=>{t.current=null,n.currentTarget.hasPointerCapture(n.pointerId)&&n.currentTarget.releasePointerCapture(n.pointerId),e.setResizing(!1)};return(0,V.jsx)(`div`,{className:K(`absolute inset-y-0 right-0 z-20 hidden w-3 translate-x-1/2 touch-none cursor-col-resize outline-none before:absolute before:inset-y-0 before:left-1/2 before:w-px before:-translate-x-1/2 before:bg-white/8 after:absolute after:top-1/2 after:left-1/2 after:h-8 after:w-1 after:-translate-1/2 after:rounded-full after:bg-zinc-700 hover:before:w-0.5 hover:before:bg-cyan-400/60 hover:after:bg-cyan-400 focus-visible:before:w-0.5 focus-visible:before:bg-cyan-400 focus-visible:after:bg-cyan-400 min-[701px]:block`,e.resizing&&`before:w-0.5 before:bg-cyan-400`),role:`separator`,"aria-label":`Resize sidebar`,"aria-orientation":`vertical`,"aria-controls":`worktree-sidebar`,"aria-valuemin":fR,"aria-valuemax":pR,"aria-valuenow":e.width,"aria-valuetext":`${e.width} pixels`,title:`Drag to resize; double-click to reset`,tabIndex:0,onPointerDown:n,onPointerMove:r,onPointerUp:i,onPointerCancel:i,onKeyDown:t=>{let n=e.width;if(t.key===`ArrowLeft`)n-=t.shiftKey?32:16;else if(t.key===`ArrowRight`)n+=t.shiftKey?32:16;else if(t.key===`Home`)n=fR;else if(t.key===`End`)n=pR;else return;t.preventDefault(),e.setWidth(n)},onDoubleClick:()=>e.setWidth(mR)})}function CR({blocked:e}){let t=/Mac|iPhone|iPad|iPod/.test(navigator.platform),{isMobile:n,setOpenMobile:r}=BL(),i=yR();return(0,B.useEffect)(()=>{let a=a=>{let o=t?a.metaKey&&!a.ctrlKey:a.ctrlKey&&!a.metaKey;a.isComposing||a.key.toLocaleLowerCase()!==`p`||!a.shiftKey||a.altKey||!o||e||(a.preventDefault(),a.stopPropagation(),n?(r(!0),window.requestAnimationFrame(()=>i.setOpen(!0))):i.setOpen(!0))};return document.addEventListener(`keydown`,a,!0),()=>document.removeEventListener(`keydown`,a,!0)},[e,n,i.setOpen,r]),null}function wR({projects:e,activeProject:t,closingProjectId:n,onSelectProject:r,onProjectOpened:i,onRequestProjectClose:a,onOpenProjectDialog:o}){let s=/Mac|iPhone|iPad|iPod/.test(navigator.platform),{isMobile:c}=BL(),l=yR(),{attention:u,progress:d}=$A(),[f,p]=(0,B.useState)(``),[m,h]=(0,B.useState)(null),g=at({...uI,enabled:l.open}),_=st({mutationFn:e=>aC.openProject(e.id),onSuccess:i,onError:nj}),v=e=>{r(e),p(``),h(null)},y=e=>{_.mutate(e),p(``),h(null)},b=f.trim().toLocaleLowerCase(),x=e.filter(e=>!b||e.name.toLocaleLowerCase().includes(b)||e.repositoryPath.toLocaleLowerCase().includes(b)),S=new Set(e.map(e=>e.id)),C=(g.data??[]).filter(e=>!S.has(e.id)),w=C.filter(e=>!b||e.name.toLocaleLowerCase().includes(b)||e.repositoryPath.toLocaleLowerCase().includes(b)),T=[...x.map(e=>({kind:`open`,project:e})),...w.map(e=>({kind:`recent`,project:e}))],E=T.find(e=>e.project.id===m)??T[0]??null;return(0,V.jsxs)(yL,{open:l.open,onOpenChange:e=>{l.setOpen(e),h(null),p(``)},children:[(0,V.jsx)(bL,{asChild:!0,children:(0,V.jsxs)(q,{ref:l.triggerRef,type:`button`,variant:`ghost`,className:`h-11 min-w-0 flex-1 justify-start gap-2 px-2 text-base text-zinc-100 hover:bg-white/5 min-[701px]:h-8 min-[701px]:text-sm`,"aria-label":t?`Switch project, current project ${t.name}`:`Open project`,"aria-keyshortcuts":s?`Meta+Shift+P`:`Control+Shift+P`,title:`${t?.repositoryPath??`Open project`} — ${s?`⌘⇧P`:`Ctrl+Shift+P`}`,children:[(0,V.jsx)(`span`,{className:`truncate font-medium`,children:t?.name??`Open project`}),(0,V.jsx)(MF,{className:`ml-auto shrink-0 fill-zinc-600`,"data-icon":`inline-end`})]})}),(0,V.jsxs)(xL,{align:`start`,portalled:!c,className:`grid w-[min(17rem,calc(100vw-1rem))] gap-1 p-1 min-[701px]:w-60`,onOpenAutoFocus:e=>{c&&e.preventDefault()},onCloseAutoFocus:e=>{l.dismissedIntoTerminalRef.current&&(e.preventDefault(),l.dismissedIntoTerminalRef.current=!1)},children:[(0,V.jsxs)(`div`,{className:`relative`,children:[(0,V.jsx)(HF,{className:`pointer-events-none absolute top-1/2 left-2 size-4 -translate-y-1/2 fill-zinc-600`}),(0,V.jsx)(XF,{name:`project-search`,value:f,onChange:e=>{p(e.target.value),h(null)},onKeyDown:e=>{if(e.nativeEvent.isComposing||!T.length)return;if(e.key===`Enter`){e.preventDefault(),E?.kind===`open`?v(E.project):E?.kind===`recent`&&!_.isPending&&y(E.project);return}if(e.key!==`ArrowDown`&&e.key!==`ArrowUp`)return;e.preventDefault();let t=Math.max(0,T.findIndex(e=>e.project.id===E?.project.id)),n=e.key===`ArrowDown`?Math.min(t+1,T.length-1):Math.max(t-1,0),r=T[n];h(r.project.id),window.requestAnimationFrame(()=>document.getElementById(`project-switcher-option-${r.project.id}`)?.scrollIntoView({block:`nearest`}))},className:`h-11! bg-zinc-950/50 pr-2 pl-8 text-base! ring-white/8 focus-visible:ring-1! focus-visible:ring-white/20! min-[701px]:h-7! min-[701px]:py-1 min-[701px]:pr-2 min-[701px]:pl-7 min-[701px]:text-sm! min-[701px]:placeholder:text-sm`,placeholder:`Search projects…`,"aria-label":`Search projects`,"aria-activedescendant":E?`project-switcher-option-${E.project.id}`:void 0,autoFocus:!c})]}),(0,V.jsxs)(`div`,{className:`grid max-h-[min(28rem,70vh)] gap-1 overflow-y-auto p-0.5 min-[701px]:max-h-[min(22rem,70vh)] min-[701px]:gap-0.5 min-[701px]:p-0 [scrollbar-color:var(--color-zinc-700)_transparent]`,children:[x.length?(0,V.jsx)(`ul`,{role:`list`,className:`grid gap-1 min-[701px]:gap-0.5`,children:x.map(e=>{let r=e.worktrees.flatMap(e=>e.terminals),i=r.some(e=>u.has(e.id)),o=r.map(e=>d.get(e.id)).find(e=>e!==void 0);return(0,V.jsxs)(`li`,{className:K(`group/project-option relative flex h-11 min-w-0 items-center gap-0.5 rounded-md pr-1 has-[button:hover]:bg-white/5 focus-within:bg-white/5 min-[701px]:h-7`,E?.project.id===e.id&&`bg-white/8`),onMouseEnter:()=>h(e.id),children:[(0,V.jsxs)(q,{id:`project-switcher-option-${e.id}`,type:`button`,variant:`ghost`,className:`h-11 min-w-0 flex-1 justify-start px-2 text-left text-base hover:bg-transparent min-[701px]:h-7 min-[701px]:px-1.5 min-[701px]:text-sm max-[700px]:pr-8`,"data-highlighted":E?.project.id===e.id||void 0,onClick:()=>v(e),children:[(0,V.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1.5`,children:[(0,V.jsx)(`span`,{className:`truncate font-medium text-zinc-100`,children:e.name}),t?.id===e.id?(0,V.jsx)(EF,{className:`shrink-0 fill-zinc-400`}):null]}),o||i?(0,V.jsxs)(`span`,{className:`ml-auto flex shrink-0 items-center gap-1.5 min-[701px]:group-hover/project-option:opacity-0 min-[701px]:group-focus-within/project-option:opacity-0`,children:[o?(0,V.jsx)(mI,{working:o.state!==`paused`&&o.state!==`error`,className:K(`size-4 shrink-0 stroke-cyan-300`,o.state===`error`&&`stroke-rose-300`,o.state===`paused`&&`stroke-amber-300`),title:If(o)}):null,i?(0,V.jsx)(mI,{working:!1,className:`size-4 shrink-0 stroke-amber-300`,title:`Terminal needs attention`}):null]}):null]}),(0,V.jsx)(dR,{label:`Close project ${e.name}`,tooltip:`Close project`,disabled:n===e.id,className:`absolute right-1 shrink-0 fill-zinc-500 opacity-0 hover:bg-white/5 hover:fill-rose-300 group-hover/project-option:opacity-100 group-focus-within/project-option:opacity-100 max-[700px]:opacity-100`,onClick:()=>a(e),children:n===e.id?(0,V.jsx)(bF,{className:`animate-spin`}):(0,V.jsx)(JF,{})})]},e.id)})}):(0,V.jsx)(`p`,{className:`px-2 py-1.5 text-base text-pretty text-zinc-500 min-[701px]:px-1.5 min-[701px]:py-1 min-[701px]:text-sm`,children:`No open projects found.`}),!g.isSuccess||C.length?(0,V.jsxs)(`section`,{className:`grid gap-1 min-[701px]:gap-0.5`,"aria-labelledby":`recent-projects-switcher-title`,children:[(0,V.jsxs)(`div`,{className:`flex items-center justify-between gap-2 px-2 py-1.5 min-[701px]:px-1.5 min-[701px]:py-1`,children:[(0,V.jsx)(`h3`,{id:`recent-projects-switcher-title`,className:`text-sm font-medium text-balance text-zinc-500 min-[701px]:text-xs`,children:`Recent projects`}),g.isFetching?(0,V.jsx)(bF,{className:`size-4 shrink-0 animate-spin fill-zinc-600`,"aria-label":`Refreshing recent projects`}):null]}),g.isError?(0,V.jsxs)(`div`,{className:`flex items-center justify-between gap-2 px-2 py-1.5 min-[701px]:px-1.5 min-[701px]:py-1`,children:[(0,V.jsx)(`p`,{className:`text-base text-pretty text-zinc-500 min-[701px]:text-sm`,children:`Recent projects unavailable.`}),(0,V.jsx)(q,{type:`button`,variant:`ghost`,size:`sm`,className:`h-9 text-base min-[701px]:h-7 min-[701px]:text-sm`,onClick:()=>void g.refetch(),children:`Retry`})]}):null,g.isSuccess&&w.length?(0,V.jsx)(`ul`,{role:`list`,className:`grid gap-1 min-[701px]:gap-0.5`,children:w.map(e=>(0,V.jsx)(`li`,{onMouseEnter:()=>h(e.id),children:(0,V.jsx)(q,{id:`project-switcher-option-${e.id}`,type:`button`,variant:`ghost`,className:K(`h-11 w-full min-w-0 justify-start px-2 text-left text-base min-[701px]:h-7 min-[701px]:px-1.5 min-[701px]:text-sm`,E?.project.id===e.id&&`bg-white/8`),"data-highlighted":E?.project.id===e.id||void 0,disabled:_.isPending,onClick:()=>y(e),children:(0,V.jsx)(`span`,{className:`truncate font-medium text-zinc-200`,children:e.name})})},e.id))}):null,g.isSuccess&&!w.length?(0,V.jsx)(`p`,{className:`px-2 py-1.5 text-base text-pretty text-zinc-500 min-[701px]:px-1.5 min-[701px]:py-1 min-[701px]:text-sm`,children:`No recent projects found.`}):null]}):null]}),(0,V.jsx)(SI,{className:`bg-white/8`}),(0,V.jsxs)(q,{type:`button`,variant:`ghost`,size:`sm`,className:`h-11 w-full justify-start text-base font-normal text-zinc-500 hover:text-zinc-100 min-[701px]:h-7 min-[701px]:text-sm`,onClick:e=>{l.setOpen(!1),o(l.triggerRef.current??e.currentTarget)},children:[(0,V.jsx)(WF,{"data-icon":`inline-start`}),` Open project…`]})]})]})}function TR({className:e,children:t,...n}){return(0,V.jsxs)(`span`,{className:`grid grid-cols-[1fr_--spacing(8)]`,children:[(0,V.jsx)(`select`,{"data-slot":`native-select`,className:K(`col-span-full row-start-1 h-11 w-full appearance-none rounded-md bg-zinc-950/70 py-2 pr-8 pl-3 text-base text-zinc-100 ring-1 ring-white/12 outline-none focus-visible:ring-2 focus-visible:ring-cyan-400 sm:h-9 sm:text-sm`,e),...n,children:t}),(0,V.jsx)(OF,{className:`pointer-events-none col-start-2 row-start-1 size-4 place-self-center text-zinc-500`})]})}function ER({projectSwitcher:e,children:t}){return(0,V.jsxs)(HL,{id:`worktree-sidebar`,collapsible:`none`,mobileTitle:`Projects and worktrees`,mobileDescription:`Navigate projects, worktrees, and terminals.`,className:`sidebar relative min-h-0 border-r border-white/8 bg-zinc-900/80 text-zinc-200 backdrop-blur-xl`,children:[(0,V.jsxs)(qL,{className:`gap-0 border-b border-white/8 p-0`,children:[(0,V.jsx)(`div`,{className:`hidden justify-end p-2 max-[700px]:flex`,children:(0,V.jsxs)(UL,{type:`button`,size:`icon-sm`,className:`icon-button mobile-close text-zinc-400 hover:bg-white/5 hover:text-zinc-100`,"aria-label":`Close drawer`,children:[(0,V.jsx)(JF,{}),(0,V.jsx)(`span`,{className:`touch-target`,"aria-hidden":`true`})]})}),(0,V.jsx)(`div`,{className:`flex items-center gap-1 p-2 max-[700px]:pt-0`,children:e})]}),(0,V.jsx)(XL,{className:`gap-0 overflow-hidden`,children:t}),(0,V.jsx)(SR,{})]})}function DR({selectedTerminalId:e,terminals:t,onSelectTerminal:n}){let{isMobile:r,openMobile:i}=BL(),{titles:a}=$A();return(0,V.jsxs)(`header`,{className:`mobile-bar hidden min-w-0 grid-cols-[2.75rem_minmax(0,1fr)] items-center gap-2 border-b border-white/8 bg-zinc-900/95 px-2 backdrop-blur max-[700px]:grid`,inert:r&&i?!0:void 0,children:[(0,V.jsxs)(UL,{type:`button`,size:`icon`,className:`icon-button text-zinc-400 hover:bg-white/5 hover:text-zinc-100`,"aria-label":`Open worktree drawer`,children:[(0,V.jsx)(wF,{}),(0,V.jsx)(`span`,{className:`touch-target`,"aria-hidden":`true`})]}),(0,V.jsxs)(TR,{className:`h-9 border-0 bg-zinc-800/80 text-base ring-0`,name:`terminal-selector`,"aria-label":`Terminal selector`,value:e??``,onChange:e=>{let r=t.find(t=>t.id===e.target.value);r&&n(r)},children:[(0,V.jsx)(`option`,{value:``,children:`Select terminal`}),t.map(e=>(0,V.jsx)(`option`,{value:e.id,children:a.get(e.id)||e.name},e.id))]})]})}var OR=`Manual cleanup required:`;function kR(e){return!!e.cleanupError?.startsWith(OR)}function AR({name:e,title:t,icon:n,status:r,selected:i=!1,linked:a=!1,pending:o=!1,busy:s=!1,id:c,className:l,ariaLabel:u,onClick:d}){let f=K(`worktree-row flex h-auto min-h-11 w-full min-w-0 items-center justify-start gap-1.5 rounded-md px-2 py-1.5 text-left text-base/5 font-medium min-[701px]:min-h-8 min-[701px]:py-0.5 min-[701px]:text-sm/5`,a&&`min-[701px]:pr-9`,o?`text-zinc-300`:i?`selected text-zinc-50 min-[701px]:bg-white/8!`:`text-zinc-300 hover:bg-white/5 hover:text-zinc-50`,`max-[700px]:flex-1 max-[700px]:hover:bg-transparent`,(o||s)&&`motion-safe:animate-pulse`,o&&`pointer-events-none`,l),p=(0,V.jsxs)(V.Fragment,{children:[n,(0,V.jsxs)(`span`,{className:`flex min-w-0 flex-col`,children:[(0,V.jsx)(`span`,{className:`truncate`,children:e}),r]})]});return(0,V.jsx)(iR,{asChild:!0,isActive:i,children:(0,V.jsx)(q,{id:c,variant:`ghost`,type:`button`,className:f,onClick:o?void 0:d,title:t,role:o?`status`:void 0,"aria-label":o?`Creating worktree ${e}`:u,"aria-live":o||u?`polite`:void 0,"aria-disabled":o||void 0,tabIndex:o?-1:void 0,children:p})})}function jR({projects:e,projectsPending:t,projectsError:n,projectsLoaded:r,activeProject:i,selectedWorktree:a,selectedTerminalId:o,pendingWorktrees:s,pendingRemovals:c,onRetryProjects:l,onSelectTerminal:u,onSelectWorktree:d,onPrepareRemoval:f,onOpenWorktreeDialog:p}){let{attention:m,titles:h,progress:g}=$A(),_=window.treeportDesktop,v=_?_.platform===`darwin`?`⌘N`:`Ctrl+N`:null;return(0,V.jsxs)(`nav`,{className:`tree min-h-0 flex-1 overflow-x-hidden overflow-y-auto px-2 pt-3 pb-5 min-[701px]:px-1.5 min-[701px]:pt-2 min-[701px]:pb-4 [scrollbar-color:var(--color-zinc-700)_transparent]`,"aria-label":`Projects and worktrees`,children:[t?(0,V.jsx)(`p`,{className:`sidebar-note px-2 py-3 text-base text-zinc-500 min-[701px]:text-sm`,children:`Loading repositories…`}):null,n&&!r?(0,V.jsxs)(`div`,{className:`flex flex-col items-start gap-2 px-2 py-3`,children:[(0,V.jsx)(`p`,{className:`sidebar-note text-base text-rose-300 min-[701px]:text-sm`,children:`Projects could not be loaded.`}),(0,V.jsx)(q,{type:`button`,variant:`secondary`,size:`sm`,onClick:l,children:`Retry`})]}):null,!t&&!n&&!e.length?(0,V.jsx)(`p`,{className:`sidebar-note px-2 py-3 text-base text-pretty text-zinc-500 min-[701px]:text-sm`,children:`Open a Git repository to begin.`}):null,(0,V.jsx)(`div`,{className:`grid gap-4`,children:e.filter(e=>e.id===i?.id).map(e=>(0,V.jsxs)(`div`,{className:`project-tree min-w-0`,children:[e.availability.state===`unavailable`?(0,V.jsx)(`p`,{className:`mx-1 mb-2 rounded-md bg-amber-400/8 px-2 py-1.5 text-sm text-amber-200`,role:`status`,children:e.availability.message||`Git repository unavailable`}):null,(0,V.jsxs)(tR,{className:`gap-2 min-[701px]:gap-1`,children:[e.worktrees.map(t=>(0,V.jsxs)(nR,{className:`group/worktree min-w-0`,children:[(0,V.jsxs)(`div`,{className:K(`relative min-w-0 max-[700px]:flex max-[700px]:items-center max-[700px]:gap-0.5 max-[700px]:rounded-md max-[700px]:has-[button:hover]:bg-white/5`,a?.id===t.id&&`max-[700px]:bg-white/8`),children:[(0,V.jsx)(AR,{name:t.name,title:`${t.path}${t.branch?` · ${t.branch}`:` · detached at ${t.head.slice(0,8)}`}`,linked:t.kind===`linked`,selected:a?.id===t.id,busy:!!c[t.id]||t.status===`cleaning`,ariaLabel:c[t.id]===`checking`?`${t.name}, preparing removal`:c[t.id]||t.status===`cleaning`?`${t.name}, removing`:void 0,onClick:()=>d(t),icon:c[t.id]||t.status===`cleaning`?(0,V.jsx)(lF,{className:`worktree-progress-icon worktree-removing-icon size-4 shrink-0 stroke-rose-400 stroke-[1.5] min-[701px]:size-3.5!`,"aria-hidden":`true`}):t.kind===`main`?(0,V.jsx)(cF,{className:`size-4 shrink-0 stroke-zinc-600 stroke-[1.5] min-[701px]:size-3.5!`,"aria-hidden":`true`}):(0,V.jsx)(lF,{className:`shrink-0 stroke-zinc-600 stroke-[1.5] min-[701px]:size-3.5!`,"aria-hidden":`true`}),status:t.status===`cleanup_failed`?(0,V.jsxs)(`span`,{className:`truncate text-sm/4 font-normal text-rose-300 min-[701px]:text-[0.6875rem]`,role:`status`,title:t.cleanupError??void 0,children:[`Removal failed`,t.cleanupError?`: ${t.cleanupError}`:``]}):void 0}),t.kind===`linked`&&(0,V.jsx)(`div`,{className:`worktree-actions absolute top-0 right-0 z-10 flex items-center gap-0.5 opacity-0 group-hover/worktree:opacity-100 group-focus-within/worktree:opacity-100 max-[700px]:static max-[700px]:shrink-0 max-[700px]:opacity-100`,children:(0,V.jsx)(dR,{label:kR(t)?`Manual cleanup required for ${t.name}`:t.status===`cleanup_failed`?`Retry removal for ${t.name}`:`Remove ${t.name}`,tooltip:e.availability.state===`unavailable`?`Git repository unavailable`:t.prunable?`Git reports this worktree as prunable`:c[t.id]||t.status===`cleaning`?`Removal is already in progress`:kR(t)?t.cleanupError:t.status===`cleanup_failed`?`Retry removal`:`Remove worktree`,disabled:e.availability.state===`unavailable`||t.prunable||!!c[t.id]||t.status===`cleaning`||kR(t),className:`text-zinc-500 hover:bg-transparent hover:text-rose-300`,onClick:e=>void f(t,e),children:(0,V.jsx)(KF,{})})})]}),(0,V.jsx)(cR,{className:`terminal-list mr-0 ml-4 gap-px border-white/6 pr-0 pl-2 min-[701px]:ml-2.5 min-[701px]:pl-1.5`,children:t.terminals.map(e=>{let t=m.has(e.id),n=g.get(e.id),r=!!n&&!t&&n.state!==`paused`&&n.state!==`error`,i=[n?If(n):e.status,t?`bell`:null].filter(Boolean).join(`, `);return(0,V.jsx)(lR,{className:`min-w-0`,children:(0,V.jsx)(uR,{asChild:!0,isActive:o===e.id,children:(0,V.jsxs)(q,{variant:`ghost`,type:`button`,className:K(`terminal-row grid h-auto min-h-11 w-full min-w-0 grid-cols-[1.25rem_minmax(0,1fr)_0.5rem] gap-1.5 rounded-md px-2 py-1.5 text-left text-base/5 font-normal min-[701px]:min-h-7 min-[701px]:grid-cols-[1rem_minmax(0,1fr)_0.5rem] min-[701px]:gap-1 min-[701px]:py-0 min-[701px]:text-xs/4`,o===e.id?`selected bg-cyan-400/8! text-cyan-50`:`text-zinc-300 hover:bg-white/5 hover:text-zinc-100`),onClick:()=>u(e),"aria-label":`${h.get(e.id)||e.name}, ${i}`,children:[(0,V.jsx)(mI,{working:r,className:K(`size-4! shrink-0 stroke-zinc-500 min-[701px]:size-3.5!`,r&&`stroke-cyan-400`,n?.state===`error`&&!t&&`stroke-rose-300`,n?.state===`paused`&&!t&&`stroke-amber-300`,t&&`stroke-amber-300`)}),(0,V.jsx)(`span`,{className:K(`truncate`,r&&`text-cyan-300`,t&&`text-amber-200`),"aria-hidden":`true`,children:h.get(e.id)||e.name}),e.status!==`running`&&(0,V.jsx)(`span`,{className:K(`status-dot size-1.5 shrink-0 rounded-full bg-zinc-600`,e.status===`exited`&&`bg-rose-400`),title:i})]})})},e.id)})})]},t.id)),s.filter(t=>t.projectId===e.id).map(e=>(0,V.jsx)(nR,{className:`min-w-0`,children:(0,V.jsx)(AR,{id:`pending-worktree-${e.id}`,name:e.typedName,title:`Creating ${e.typedName}`,pending:!0,icon:(0,V.jsx)(lF,{className:`worktree-progress-icon size-4 shrink-0 stroke-cyan-400 stroke-[1.5] min-[701px]:size-3.5!`,"aria-hidden":`true`})})},e.id)),(0,V.jsx)(nR,{className:`min-w-0`,children:(0,V.jsx)(iR,{asChild:!0,children:(0,V.jsxs)(q,{type:`button`,variant:`ghost`,className:`h-auto min-h-11 w-full justify-start gap-1.5 px-2 py-1.5 text-base/5 font-normal text-zinc-500 hover:bg-white/5 hover:text-zinc-100 min-[701px]:min-h-8 min-[701px]:py-0.5 min-[701px]:text-sm/5`,disabled:e.availability.state===`unavailable`,"aria-keyshortcuts":v?_?.platform===`darwin`?`Meta+N`:`Control+N`:void 0,title:v?`New worktree — ${v}`:void 0,onClick:t=>p(e,t.currentTarget),children:[(0,V.jsx)(WF,{className:`min-[701px]:size-3.5!`}),(0,V.jsx)(`span`,{children:`New worktree`}),v?(0,V.jsx)(`kbd`,{className:`ml-auto font-sans text-[0.6875rem] text-zinc-500`,"aria-hidden":`true`,children:v}):null]})})})]})]},e.id))})]})}function MR(e){let t=[],n=``,r=null,i=!1;for(let a=0;a<e.length;a+=1){let o=e[a];if(r===`single`){o===`'`?r=null:n+=o;continue}if(r===`double`){if(o===`"`)r=null;else if(o===`\\`){if(a+=1,a>=e.length)return{argv:null,error:`The command ends with an incomplete escape.`};n+=e[a]}else n+=o;continue}if(/\s/.test(o)){i&&=(t.push(n),n=``,!1);continue}if(i=!0,o===`'`)r=`single`;else if(o===`"`)r=`double`;else if(o===`\\`){if(a+=1,a>=e.length)return{argv:null,error:`The command ends with an incomplete escape.`};n+=e[a]}else n+=o}return r?{argv:null,error:`The command has an unclosed quote.`}:(i&&t.push(n),t.length===0?{argv:null,error:`Enter a command.`}:{argv:t,error:null})}function NR(e){return e.map(e=>e===``?`""`:/[\s"'\\]/.test(e)?`"${e.replace(/["\\]/g,`\\$&`)}"`:e).join(` `)}var PR=Object.defineProperty,FR=(e,t)=>PR(e,`name`,{value:t,configurable:!0});function IR(e){let[t,n]=B.useState(void 0);return Ij(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});let t=new ResizeObserver(t=>{if(!Array.isArray(t)||!t.length)return;let r=t[0],i,a;if(`borderBoxSize`in r){let e=r.borderBoxSize,t=Array.isArray(e)?e[0]:e;i=t.inlineSize,a=t.blockSize}else i=e.offsetWidth,a=e.offsetHeight;n({width:i,height:a})});return t.observe(e,{box:`border-box`}),()=>t.unobserve(e)}else n(void 0)},[e]),t}FR(IR,`useSize`);var LR=Object.defineProperty,RR=(e,t)=>LR(e,`name`,{value:t,configurable:!0}),zR=`Checkbox`,[BR,VR]=Pj(zR),[HR,UR]=BR(zR);function WR(e){let{__scopeCheckbox:t,checked:n,children:r,defaultChecked:i,disabled:a,form:o,name:s,onCheckedChange:c,required:l,value:u=`on`,internal_do_not_use_render:d}=e,[f,p]=Xj({prop:n,defaultProp:i??!1,onChange:c,caller:zR}),[m,h]=B.useState(null),[g,_]=B.useState(null),v=B.useRef(!1),[y,b]=B.useReducer(e=>e+1,0),x=!m||!!o||!!m.closest(`form`),S={checked:f,disabled:a,setChecked:p,control:m,setControl:h,name:s,form:o,value:u,hasConsumerStoppedPropagationRef:v,userInteractionCount:y,onUserInteraction:b,required:l,defaultChecked:!$R(i)&&i,isFormControl:x,bubbleInput:g,setBubbleInput:_};return(0,V.jsx)(HR,{scope:t,...S,children:QR(d)?d(S):r})}RR(WR,`CheckboxProvider`);var GR=`CheckboxTrigger`,KR=B.forwardRef(RR(function({__scopeCheckbox:e,onKeyDown:t,onClick:n,...r},i){let{control:a,value:o,disabled:s,checked:c,required:l,setControl:u,setChecked:d,hasConsumerStoppedPropagationRef:f,onUserInteraction:p,isFormControl:m,bubbleInput:h}=UR(GR,e),g=df(i,u),_=B.useRef(c);return B.useEffect(()=>{let e=a?.form;if(e){let t=RR(()=>d(_.current),`reset`);return e.addEventListener(`reset`,t),()=>e.removeEventListener(`reset`,t)}},[a,d]),(0,V.jsx)(rM.button,{type:`button`,role:`checkbox`,"aria-checked":$R(c)?`mixed`:c,"aria-required":l,"data-state":ez(c),"data-disabled":s?``:void 0,disabled:s,value:o,...r,ref:g,onKeyDown:Ej(t,e=>{e.key===`Enter`&&e.preventDefault()}),onClick:Ej(n,e=>{p(),d(e=>$R(e)?!0:!e),h&&m&&(f.current=e.isPropagationStopped(),f.current||e.stopPropagation())})})},`CheckboxTrigger`)),qR=B.forwardRef(RR(function(e,t){let{__scopeCheckbox:n,name:r,checked:i,defaultChecked:a,required:o,disabled:s,value:c,onCheckedChange:l,form:u,...d}=e;return(0,V.jsx)(WR,{__scopeCheckbox:n,checked:i,defaultChecked:a,disabled:s,required:o,onCheckedChange:l,name:r,form:u,value:c,internal_do_not_use_render:({isFormControl:e})=>(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(KR,{...d,ref:t,__scopeCheckbox:n}),e&&(0,V.jsx)(ZR,{__scopeCheckbox:n})]})})},`Checkbox`)),JR=`CheckboxIndicator`,YR=B.forwardRef(RR(function(e,t){let{__scopeCheckbox:n,forceMount:r,...i}=e,a=UR(JR,n);return(0,V.jsx)(WM,{present:r||$R(a.checked)||a.checked===!0,children:(0,V.jsx)(rM.span,{"data-state":ez(a.checked),"data-disabled":a.disabled?``:void 0,...i,ref:t,style:{pointerEvents:`none`,...e.style}})})},`CheckboxIndicator`)),XR=`CheckboxBubbleInput`,ZR=B.forwardRef(RR(function({__scopeCheckbox:e,onClick:t,...n},r){let{control:i,hasConsumerStoppedPropagationRef:a,userInteractionCount:o,checked:s,defaultChecked:c,required:l,disabled:u,name:d,value:f,form:p,bubbleInput:m,setBubbleInput:h}=UR(XR,e),g=df(r,h),_=IR(i),v=B.useRef(!1),y=B.useRef(s),b=B.useRef(o);B.useEffect(()=>{let e=m;if(!e)return;let t=window.HTMLInputElement.prototype,n=Object.getOwnPropertyDescriptor(t,`checked`).set,r=o!==b.current;b.current=o;let i=y.current!==s;y.current=s;let c=!(r&&a.current);if(i&&n){v.current=!r;let t=new Event(`click`,{bubbles:c});e.indeterminate=$R(s),n.call(e,!$R(s)&&s),e.dispatchEvent(t),v.current=!1}},[m,s,a,o]);let x=B.useRef(!$R(s)&&s);return(0,V.jsx)(rM.input,{type:`checkbox`,"aria-hidden":!0,defaultChecked:c??x.current,required:l,disabled:u,name:d,value:f,form:p,...n,tabIndex:-1,ref:g,onClick:Ej(t,e=>{v.current&&e.stopPropagation()}),style:{...n.style,..._,position:`absolute`,pointerEvents:`none`,opacity:0,margin:0,transform:`translateX(-100%)`}})},`CheckboxBubbleInput`));function QR(e){return typeof e==`function`}RR(QR,`isFunction`);function $R(e){return e===`indeterminate`}RR($R,`isIndeterminate`);function ez(e){return $R(e)?`indeterminate`:e?`checked`:`unchecked`}RR(ez,`getState`);var tz=B.forwardRef(({className:e,...t},n)=>(0,V.jsx)(qR,{ref:n,className:K(`peer grid size-4 shrink-0 place-content-center rounded-sm border border-white/20 bg-zinc-950 text-zinc-950 outline-none disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:border-cyan-400 data-[state=checked]:bg-cyan-400 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-cyan-400`,e),...t,children:(0,V.jsx)(YR,{className:`grid place-content-center text-current`,children:(0,V.jsx)(sF,{className:`size-3.5`})})}));tz.displayName=qR.displayName;function nz({presets:e,loading:t,loadError:n,onRetry:r}){let i=We(),[a,o]=(0,B.useState)(null),[s,c]=(0,B.useState)(null),[l,u]=(0,B.useState)(``),[d,f]=(0,B.useState)(``),[p,m]=(0,B.useState)(!1),[h,g]=(0,B.useState)(null),[_,v]=(0,B.useState)(null),y=()=>{o(null),c(null),u(``),f(``),m(!1),g(null),v(null)};(0,B.useEffect)(()=>{if(!a)return;let t=e.find(e=>e.id===a);if(!t){o(null),c(null),u(``),f(``),m(!1),g(null),v(`That preset was deleted. You can create a new one.`);return}t.updatedAt!==s&&(c(t.updatedAt),u(t.name),f(NR([t.executable,...t.args])),m(t.closeOnSuccess),g(null),s&&v(`This preset changed, so the latest saved values were loaded.`))},[a,s,e]);let b=st({mutationFn:({presetId:e,input:t,expectedUpdatedAt:n})=>e?aC.updateTerminalPreset(e,t,n):aC.createTerminalPreset(t),onSuccess:(e,t)=>{i.setQueryData(cI,n=>t.presetId?n?.map(t=>t.id===e.id?e:t):[...n??[],e]),o(e.id),c(e.updatedAt),u(e.name),f(NR([e.executable,...e.args])),m(e.closeOnSuccess),g(null),v(`Preset saved.`)},onError:e=>{i.invalidateQueries({queryKey:cI}),nj(e)},onSettled:()=>i.invalidateQueries({queryKey:cI})}),x=st({mutationFn:e=>aC.deleteTerminalPreset(e.id,e.updatedAt),onSuccess:(e,t)=>{i.setQueryData(cI,e=>e?.filter(e=>e.id!==t.id)),a===t.id&&(y(),v(`Preset deleted.`))},onError:e=>{i.invalidateQueries({queryKey:cI}),nj(e)},onSettled:()=>i.invalidateQueries({queryKey:cI})}),S=b.isPending||x.isPending;return(0,V.jsx)(V.Fragment,{children:(0,V.jsxs)(`div`,{className:`grid min-h-0 gap-5 border-t border-white/8 pt-4 md:grid-cols-[minmax(12rem,0.8fr)_minmax(0,1.35fr)]`,children:[(0,V.jsxs)(`section`,{className:`flex min-w-0 flex-col gap-2`,"aria-labelledby":`saved-presets-title`,children:[(0,V.jsxs)(`div`,{className:`flex min-h-8 items-center justify-between gap-3`,children:[(0,V.jsx)(`h3`,{id:`saved-presets-title`,className:`text-sm font-medium text-zinc-200`,children:`Presets`}),(0,V.jsxs)(q,{type:`button`,variant:`secondary`,size:`sm`,disabled:S,onClick:y,children:[(0,V.jsx)(WF,{}),` New`]})]}),(0,V.jsxs)(`div`,{className:`max-h-72 overflow-y-auto rounded-lg bg-white/3 p-1 ring-1 ring-white/8 [scrollbar-color:var(--color-zinc-700)_transparent]`,children:[(0,V.jsxs)(`div`,{className:`grid min-h-14 min-w-0 content-center gap-0.5 rounded-md px-3 py-2`,children:[(0,V.jsx)(`span`,{className:`truncate text-sm font-medium text-zinc-100`,children:`Shell`}),(0,V.jsx)(`span`,{className:`truncate text-xs text-zinc-500`,children:`Built in · login shell`})]}),e.map(e=>(0,V.jsxs)(`div`,{className:K(`group/preset flex min-h-14 items-center rounded-md px-1 transition-colors hover:bg-white/5`,a===e.id&&`bg-white/7 hover:bg-white/7`),children:[(0,V.jsxs)(`button`,{type:`button`,className:`grid min-w-0 flex-1 cursor-pointer gap-0.5 rounded-sm px-2 py-2 text-left outline-none focus-visible:outline-2 focus-visible:outline-cyan-400`,"aria-current":a===e.id?`true`:void 0,disabled:S,onClick:()=>{o(e.id),c(e.updatedAt),u(e.name),f(NR([e.executable,...e.args])),m(e.closeOnSuccess),g(null),v(null)},children:[(0,V.jsx)(`span`,{className:`truncate text-sm font-medium text-zinc-100`,children:e.name}),(0,V.jsx)(`span`,{className:`truncate text-xs text-zinc-500`,children:NR([e.executable,...e.args])})]}),(0,V.jsx)(q,{type:`button`,variant:`ghost`,size:`icon-sm`,className:`mr-1 size-11 shrink-0 hover:text-rose-300 min-[701px]:size-8 min-[701px]:opacity-0 min-[701px]:group-hover/preset:opacity-100 min-[701px]:focus-visible:opacity-100`,"aria-label":`Delete ${e.name}`,disabled:S,onClick:()=>{window.confirm(`Delete terminal preset “${e.name}”?`)&&x.mutate(e)},children:(0,V.jsx)(KF,{})})]},e.id)),t&&(0,V.jsx)(`p`,{className:`px-2.5 py-3 text-sm text-zinc-500`,role:`status`,children:`Loading presets…`}),n&&(0,V.jsxs)(`div`,{className:`flex items-center justify-between gap-3 px-2.5 py-3`,children:[(0,V.jsx)(`p`,{className:`text-sm text-zinc-400`,children:`Could not load presets.`}),(0,V.jsx)(q,{type:`button`,variant:`secondary`,size:`sm`,onClick:r,children:`Retry`})]})]})]}),(0,V.jsxs)(`form`,{className:`flex min-w-0 flex-col gap-4`,onSubmit:e=>{e.preventDefault();let t=MR(d);if(t.argv===null){g(t.error);return}let[n,...r]=t.argv;b.mutate({presetId:a,input:{name:l,executable:n,args:r,closeOnSuccess:p},expectedUpdatedAt:s})},children:[(0,V.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,V.jsx)(`h3`,{className:`text-sm font-medium text-zinc-200`,children:`Preset details`}),_&&(0,V.jsx)(`span`,{className:`text-xs text-zinc-400`,role:`status`,children:_})]}),(0,V.jsxs)(YF,{children:[(0,V.jsx)(ZF,{htmlFor:`preset-name`,children:`Name`}),(0,V.jsx)(XF,{id:`preset-name`,name:`preset-name`,value:l,maxLength:120,disabled:S,autoFocus:!0,required:!0,onChange:e=>{u(e.target.value),v(null)},placeholder:`Code review`})]}),(0,V.jsxs)(YF,{children:[(0,V.jsx)(ZF,{htmlFor:`preset-command`,children:`Command`}),(0,V.jsx)(XF,{id:`preset-command`,name:`preset-command`,value:d,disabled:S,required:!0,"aria-invalid":h?!0:void 0,"aria-describedby":h?`preset-command-error`:void 0,onChange:e=>{f(e.target.value),g(null),v(null)},placeholder:`diff main --mode split`}),h&&(0,V.jsx)(`p`,{id:`preset-command-error`,className:`text-xs text-rose-300`,role:`alert`,children:h})]}),(0,V.jsx)(YF,{children:(0,V.jsxs)(`div`,{className:`flex items-start gap-2.5`,children:[(0,V.jsx)(tz,{id:`preset-close-on-success`,checked:p,disabled:S,onCheckedChange:e=>{m(e===!0),v(null)}}),(0,V.jsxs)(`div`,{className:`grid gap-1`,children:[(0,V.jsx)(ZF,{htmlFor:`preset-close-on-success`,children:`Close on success`}),(0,V.jsx)(`p`,{className:`form-note`,children:`Use for one-off commands such as opening an editor. Failed commands remain open for inspection.`})]})]})}),(0,V.jsx)(q,{type:`submit`,className:`self-end`,disabled:S||!l.trim()||!d.trim()||a!==null&&s===null,children:b.isPending?`Saving…`:a?`Save changes`:`Create preset`})]})]})})}function rz({open:e,onOpenChange:t,restoreFocusTo:n,presets:r,loading:i,loadError:a,onRetry:o}){return(0,V.jsx)(fF,{open:e,onOpenChange:t,children:(0,V.jsxs)(hF,{className:`max-w-3xl`,restoreFocusTo:n,children:[(0,V.jsxs)(gF,{children:[(0,V.jsx)(_F,{children:`Terminal presets`}),(0,V.jsx)(vF,{children:`Create reusable commands. Arguments are passed exactly as entered.`})]}),(0,V.jsx)(nz,{presets:r,loading:i,loadError:a,onRetry:o})]})})}var iz=Object.defineProperty,az=(e,t)=>iz(e,`name`,{value:t,configurable:!0}),oz=!!(typeof window<`u`&&window.document&&window.document.createElement);function sz(e,t,{checkForDefaultPrevented:n=!0}={}){return az(function(r){if(e?.(r),n===!1||!r||!r.defaultPrevented)return t?.(r)},`handleEvent`)}az(sz,`composeEventHandlers`);function cz(e){if(!oz)throw Error(`Cannot access window outside of the DOM`);return e?.ownerDocument?.defaultView??window}az(cz,`getOwnerWindow`);function lz(e){if(!oz)throw Error(`Cannot access document outside of the DOM`);return e?.ownerDocument??document}az(lz,`getOwnerDocument`);function uz(e,t=!1){let{activeElement:n}=lz(e);if(!n?.nodeName)return null;if(dz(n)&&n.contentDocument)return uz(n.contentDocument.body,t);if(t){let e=n.getAttribute(`aria-activedescendant`);if(e){let t=lz(n).getElementById(e);if(t)return t}}return n}az(uz,`getActiveElement`);function dz(e){return e.tagName===`IFRAME`}az(dz,`isFrame`);var fz=Object.defineProperty,pz=(e,t)=>fz(e,`name`,{value:t,configurable:!0}),mz=B.useInsertionEffect||Mo;function hz({prop:e,defaultProp:t,onChange:n=pz(()=>{},`onChange`),caller:r}){let[i,a,o]=gz({defaultProp:t,onChange:n}),s=e!==void 0;return[s?e:i,B.useCallback(t=>{if(s){let n=_z(t)?t(e):t;n!==e&&o.current?.(n)}else a(t)},[s,e,a,o])]}pz(hz,`useControllableState`);function gz({defaultProp:e,onChange:t}){let[n,r]=B.useState(e),i=B.useRef(n),a=B.useRef(t);return mz(()=>{a.current=t},[t]),B.useEffect(()=>{i.current!==n&&(a.current?.(n),i.current=n)},[n,i]),[n,r,a]}pz(gz,`useUncontrolledState`);function _z(e){return typeof e==`function`}pz(_z,`isFunction`);var vz=Symbol(`RADIX:SYNC_STATE`);function yz(e,t,n,r){let{prop:i,defaultProp:a,onChange:o,caller:s}=t,c=i!==void 0,l=Al(o),u=[{...n,state:a}];r&&u.push(r);let[d,f]=B.useReducer((t,n)=>{if(n.type===vz)return{...t,state:n.state};let r=e(t,n);return c&&!Object.is(r.state,t.state)&&l(r.state),r},...u),p=d.state,m=B.useRef(p);B.useEffect(()=>{m.current!==p&&(m.current=p,c||l(p))},[p,m,c]);let h=B.useMemo(()=>i===void 0?d:{...d,state:i},[d,i]);return B.useEffect(()=>{c&&!Object.is(i,d.state)&&f({type:vz,state:i})},[i,d.state,c]),[h,f]}pz(yz,`useControllableStateReducer`);function bz(e){let t=e+`CollectionProvider`,[n,r]=eo(t),[i,a]=n(t,{collectionRef:{current:null},itemMap:new Map}),o=e=>{let{scope:t,children:n}=e,r=B.useRef(null),a=B.useRef(new Map).current;return(0,V.jsx)(i,{scope:t,itemMap:a,collectionRef:r,children:n})};o.displayName=t;let s=e+`CollectionSlot`,c=no(s),l=B.forwardRef((e,t)=>{let{scope:n,children:r}=e,i=$a(t,a(s,n).collectionRef);return(0,V.jsx)(c,{ref:i,children:r})});l.displayName=s;let u=e+`CollectionItemSlot`,d=`data-radix-collection-item`,f=no(u),p=B.forwardRef((e,t)=>{let{scope:n,children:r,...i}=e,o=B.useRef(null),s=$a(t,o),c=a(u,n);return B.useEffect(()=>(c.itemMap.set(o,{ref:o,...i}),()=>void c.itemMap.delete(o))),(0,V.jsx)(f,{[d]:``,ref:s,children:r})});p.displayName=u;function m(t){let n=a(e+`CollectionConsumer`,t);return B.useCallback(()=>{let e=n.collectionRef.current;if(!e)return[];let t=Array.from(e.querySelectorAll(`[${d}]`));return Array.from(n.itemMap.values()).sort((e,n)=>t.indexOf(e.ref.current)-t.indexOf(n.ref.current))},[n.collectionRef,n.itemMap])}return[{Provider:o,Slot:l,ItemSlot:p},m,r]}var xz=B.createContext(void 0);function Sz(e){let t=B.useContext(xz);return e||t||`ltr`}var Cz=Object.defineProperty,wz=(e,t)=>Cz(e,`name`,{value:t,configurable:!0}),Tz=`dismissableLayer.update`,Ez=`dismissableLayer.pointerDownOutside`,Dz=`dismissableLayer.focusOutside`,Oz,kz=B.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set,dismissableSurfaces:new Set}),Az=B.forwardRef(wz(function(e,t){let{disableOutsidePointerEvents:n=!1,deferPointerDownOutside:r=!1,onEscapeKeyDown:i,onPointerDownOutside:a,onFocusOutside:o,onInteractOutside:s,onDismiss:c,...l}=e,u=B.useContext(kz),[d,f]=B.useState(null),p=d?.ownerDocument??globalThis?.document,[,m]=B.useState({}),h=$a(t,f),g=Array.from(u.layers),[_]=[...u.layersWithOutsidePointerEventsDisabled].slice(-1),v=_?g.indexOf(_):-1,y=d?g.indexOf(d):-1,b=u.layersWithOutsidePointerEventsDisabled.size>0,x=y>=v,S=B.useRef(!1),C=Nz(e=>{a?.(e),s?.(e),e.defaultPrevented||c?.()},{ownerDocument:p,deferPointerDownOutside:r,isDeferredPointerDownOutsideRef:S,dismissableSurfaces:u.dismissableSurfaces,shouldHandlePointerDownOutside:B.useCallback(e=>{if(!(e instanceof Node))return!1;let t=[...u.branches].some(t=>t.contains(e));return x&&!t},[u.branches,x])}),w=Pz(e=>{if(r&&S.current)return;let t=e.target;[...u.branches].some(e=>e.contains(t))||(o?.(e),s?.(e),e.defaultPrevented||c?.())},p),T=d?y===g.length-1:!1,E=_o(e=>{e.key===`Escape`&&(i?.(e),!e.defaultPrevented&&c&&(e.preventDefault(),c()))});return B.useEffect(()=>{if(T)return p.addEventListener(`keydown`,E,{capture:!0}),()=>p.removeEventListener(`keydown`,E,{capture:!0})},[p,T,E]),B.useEffect(()=>{if(d)return n&&(u.layersWithOutsidePointerEventsDisabled.size===0&&(Oz=p.body.style.pointerEvents,p.body.style.pointerEvents=`none`),u.layersWithOutsidePointerEventsDisabled.add(d)),u.layers.add(d),Fz(),()=>{n&&(u.layersWithOutsidePointerEventsDisabled.delete(d),u.layersWithOutsidePointerEventsDisabled.size===0&&(p.body.style.pointerEvents=Oz))}},[d,p,n,u]),B.useEffect(()=>()=>{d&&(u.layers.delete(d),u.layersWithOutsidePointerEventsDisabled.delete(d),Fz())},[d,u]),B.useEffect(()=>{let e=wz(()=>m({}),`handleUpdate`);return document.addEventListener(Tz,e),()=>document.removeEventListener(Tz,e)},[]),(0,V.jsx)(ho.div,{...l,ref:h,style:{pointerEvents:b?x?`auto`:`none`:void 0,...e.style},onFocusCapture:sz(e.onFocusCapture,w.onFocusCapture),onBlurCapture:sz(e.onBlurCapture,w.onBlurCapture),onPointerDownCapture:sz(e.onPointerDownCapture,C.onPointerDownCapture)})},`DismissableLayer`));function jz(){let e=B.useContext(kz),[t,n]=B.useState(null);return B.useEffect(()=>{if(t)return e.dismissableSurfaces.add(t),()=>{e.dismissableSurfaces.delete(t)}},[t,e.dismissableSurfaces]),n}wz(jz,`useDismissableLayerSurface`);var Mz=wz(()=>!0,`IS_TRUE`);function Nz(e,t){let{ownerDocument:n=globalThis?.document,deferPointerDownOutside:r=!1,isDeferredPointerDownOutsideRef:i,dismissableSurfaces:a,shouldHandlePointerDownOutside:o=Mz}=t,s=_o(e),c=B.useRef(!1),l=B.useRef(!1),u=B.useRef(new Map),d=B.useRef(()=>{});return B.useEffect(()=>{function e(){l.current=!1,i.current=!1,u.current.clear()}wz(e,`resetOutsideInteraction`);function t(){return Array.from(u.current.values()).some(Boolean)}wz(t,`isOutsideInteractionIntercepted`);function f(e){if(!l.current)return;let t=e.target;t instanceof Node&&[...a].some(e=>e.contains(t))||u.current.set(e.type,!0),e.type===`click`&&window.setTimeout(()=>{l.current&&d.current()},0)}wz(f,`handleInteractionCapture`);function p(e){l.current&&u.current.set(e.type,!1)}wz(p,`handleInteractionBubble`);let m=wz(a=>{if(a.target&&!c.current){let f=function(){n.removeEventListener(`click`,d.current);let r=t();e(),r||Iz(Ez,s,p,{discrete:!0})};if(wz(f,`handleAndDispatchPointerDownOutsideEvent`),!o(a.target)){n.removeEventListener(`click`,d.current),e(),c.current=!1;return}let p={originalEvent:a};l.current=!0,i.current=r&&a.button===0,u.current.clear(),!r||a.button!==0?f():(n.removeEventListener(`click`,d.current),d.current=f,n.addEventListener(`click`,d.current,{once:!0}))}else n.removeEventListener(`click`,d.current),e();c.current=!1},`handlePointerDown`),h=[`pointerup`,`mousedown`,`mouseup`,`touchstart`,`touchend`,`click`];for(let e of h)n.addEventListener(e,f,!0),n.addEventListener(e,p);let g=window.setTimeout(()=>{n.addEventListener(`pointerdown`,m)},0);return()=>{window.clearTimeout(g),n.removeEventListener(`pointerdown`,m),n.removeEventListener(`click`,d.current);for(let e of h)n.removeEventListener(e,f,!0),n.removeEventListener(e,p)}},[n,s,r,i,a,o]),{onPointerDownCapture:wz(()=>c.current=!0,`onPointerDownCapture`)}}wz(Nz,`usePointerDownOutside`);function Pz(e,t=globalThis?.document){let n=_o(e),r=B.useRef(!1);return B.useEffect(()=>{let e=wz(e=>{e.target&&!r.current&&Iz(Dz,n,{originalEvent:e},{discrete:!1})},`handleFocus`);return t.addEventListener(`focusin`,e),()=>t.removeEventListener(`focusin`,e)},[t,n]),{onFocusCapture:wz(()=>r.current=!0,`onFocusCapture`),onBlurCapture:wz(()=>r.current=!1,`onBlurCapture`)}}wz(Pz,`useFocusOutside`);function Fz(){let e=new CustomEvent(Tz);document.dispatchEvent(e)}wz(Fz,`dispatchUpdate`);function Iz(e,t,n,{discrete:r}){let i=n.originalEvent.target,a=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&i.addEventListener(e,t,{once:!0}),r?go(i,a):i.dispatchEvent(a)}wz(Iz,`handleAndDispatchCustomEvent`);var Lz=Object.defineProperty,Rz=(e,t)=>Lz(e,`name`,{value:t,configurable:!0}),zz=`focusScope.autoFocusOnMount`,Bz=`focusScope.autoFocusOnUnmount`,Vz={bubbles:!1,cancelable:!0},Hz=B.forwardRef(Rz(function(e,t){let{loop:n=!1,trapped:r=!1,onMountAutoFocus:i,onUnmountAutoFocus:a,...o}=e,[s,c]=B.useState(null),l=_o(i),u=_o(a),d=B.useRef(null),f=$a(t,c),p=B.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;B.useEffect(()=>{if(r){let e=function(e){if(p.paused||!s)return;let t=e.target;s.contains(t)?d.current=t:Yz(d.current,{select:!0})},t=function(e){if(p.paused||!s)return;let t=e.relatedTarget;t!==null&&(s.contains(t)||Yz(d.current,{select:!0}))},n=function(e){if(document.activeElement===document.body)for(let t of e)t.removedNodes.length>0&&Yz(s)};Rz(e,`handleFocusIn`),Rz(t,`handleFocusOut`),Rz(n,`handleMutations`),document.addEventListener(`focusin`,e),document.addEventListener(`focusout`,t);let r=new MutationObserver(n);return s&&r.observe(s,{childList:!0,subtree:!0}),()=>{document.removeEventListener(`focusin`,e),document.removeEventListener(`focusout`,t),r.disconnect()}}},[r,s,p.paused]),B.useEffect(()=>{if(s){Xz.add(p);let e=document.activeElement;if(!s.contains(e)){let t=new CustomEvent(zz,Vz);s.addEventListener(zz,l),s.dispatchEvent(t),t.defaultPrevented||(Uz($z(Gz(s)),{select:!0}),document.activeElement===e&&Yz(s))}return()=>{s.removeEventListener(zz,l),setTimeout(()=>{let t=new CustomEvent(Bz,Vz);s.addEventListener(Bz,u),s.dispatchEvent(t),t.defaultPrevented||Yz(e??document.body,{select:!0}),s.removeEventListener(Bz,u),Xz.remove(p)},0)}}},[s,l,u,p]);let m=B.useCallback(e=>{if(!n&&!r||p.paused)return;let t=e.key===`Tab`&&!e.altKey&&!e.ctrlKey&&!e.metaKey,i=document.activeElement;if(t&&i){let t=e.currentTarget,[r,a]=Wz(t);r&&a?!e.shiftKey&&i===a?(e.preventDefault(),n&&Yz(r,{select:!0})):e.shiftKey&&i===r&&(e.preventDefault(),n&&Yz(a,{select:!0})):i===t&&e.preventDefault()}},[n,r,p.paused]);return(0,V.jsx)(ho.div,{tabIndex:-1,...o,ref:f,onKeyDown:m})},`FocusScope`));function Uz(e,{select:t=!1}={}){let n=document.activeElement;for(let r of e)if(Yz(r,{select:t}),document.activeElement!==n)return}Rz(Uz,`focusFirst`);function Wz(e){let t=Gz(e);return[Kz(t,e),Kz(t.reverse(),e)]}Rz(Wz,`getTabbableEdges`);function Gz(e){let t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:Rz(e=>{let t=e.tagName===`INPUT`&&e.type===`hidden`;return e.disabled||e.hidden||t?NodeFilter.FILTER_SKIP:e.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP},`acceptNode`)});for(;n.nextNode();)t.push(n.currentNode);return t}Rz(Gz,`getTabbableCandidates`);function Kz(e,t){let n=typeof t.checkVisibility==`function`&&t.checkVisibility({checkVisibilityCSS:!0});for(let r of e)if(!(n?!r.checkVisibility({checkVisibilityCSS:!0}):qz(r,{upTo:t})))return r}Rz(Kz,`findVisible`);function qz(e,{upTo:t}){if(getComputedStyle(e).visibility===`hidden`)return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display===`none`)return!0;e=e.parentElement}return!1}Rz(qz,`isHidden`);function Jz(e){return e instanceof HTMLInputElement&&`select`in e}Rz(Jz,`isSelectableInput`);function Yz(e,{select:t=!1}={}){if(e&&e.focus){let n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&Jz(e)&&t&&e.select()}}Rz(Yz,`focus`);var Xz=Zz();function Zz(){let e=[];return{add(t){let n=e[0];t!==n&&n?.pause(),e=Qz(e,t),e.unshift(t)},remove(t){e=Qz(e,t),e[0]?.resume()}}}Rz(Zz,`createFocusScopesStack`);function Qz(e,t){let n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}Rz(Qz,`arrayRemove`);function $z(e){return e.filter(e=>e.tagName!==`A`)}Rz($z,`removeLinks`);var eB=Object.defineProperty,tB=(e,t)=>eB(e,`name`,{value:t,configurable:!0}),nB=`Popper`,[rB,iB]=eo(nB),[aB,oB]=rB(nB),sB=tB(e=>{let{__scopePopper:t,children:n}=e,[r,i]=B.useState(null),[a,o]=B.useState(void 0);return(0,V.jsx)(aB,{scope:t,anchor:r,onAnchorChange:i,placementState:a,setPlacementState:o,children:n})},`Popper`),cB=`PopperAnchor`,lB=B.forwardRef(tB(function(e,t){let{__scopePopper:n,virtualRef:r,...i}=e,a=oB(cB,n),o=B.useRef(null),s=a.onAnchorChange,c=$a(t,B.useCallback(e=>{o.current=e,e&&s(e)},[s])),l=B.useRef(null);B.useEffect(()=>{if(!r)return;let e=l.current;l.current=r.current,e!==l.current&&s(l.current)});let u=a.placementState&&gB(a.placementState),d=u?.[0],f=u?.[1];return r?null:(0,V.jsx)(ho.div,{"data-radix-popper-side":d,"data-radix-popper-align":f,...i,ref:c})},`PopperAnchor`)),uB=`PopperContent`,[dB,fB]=rB(uB),pB=B.forwardRef(tB(function(e,t){let{__scopePopper:n,side:r=`bottom`,sideOffset:i=0,align:a=`center`,alignOffset:o=0,arrowPadding:s=0,avoidCollisions:c=!0,collisionBoundary:l=[],collisionPadding:u=0,sticky:d=`partial`,hideWhenDetached:f=!1,updatePositionStrategy:p=`optimized`,onPlaced:m,...h}=e,g=oB(uB,n),[_,v]=B.useState(null),y=$a(t,v),[b,x]=B.useState(null),S=Xc(b),C=S?.width??0,w=S?.height??0,T=r+(a===`center`?``:`-`+a),E=typeof u==`number`?u:{top:0,right:0,bottom:0,left:0,...u},D=Array.isArray(l)?l:[l],O=D.length>0,k={padding:E,boundary:D.filter(mB),altBoundary:O},{refs:ee,floatingStyles:te,placement:A,isPositioned:j,middlewareData:M}=Rc({strategy:`fixed`,placement:T,whileElementsMounted:tB((...e)=>wc(...e,{animationFrame:p===`always`}),`whileElementsMounted`),elements:{reference:g.anchor},middleware:[Bc({mainAxis:i+w,alignmentAxis:o}),c&&Vc({mainAxis:!0,crossAxis:!1,limiter:d===`partial`?Hc():void 0,...k}),c&&Uc({...k}),Wc({...k,apply:tB(({elements:e,rects:t,availableWidth:n,availableHeight:r})=>{let{width:i,height:a}=t.reference,o=e.floating.style;o.setProperty(`--radix-popper-available-width`,`${n}px`),o.setProperty(`--radix-popper-available-height`,`${r}px`),o.setProperty(`--radix-popper-anchor-width`,`${i}px`),o.setProperty(`--radix-popper-anchor-height`,`${a}px`)},`apply`)}),b&&Kc({element:b,padding:s}),hB({arrowWidth:C,arrowHeight:w}),f&&Gc({strategy:`referenceHidden`,...k,boundary:O?k.boundary:void 0})]}),N=g.setPlacementState;Mo(()=>(N(A),()=>{N(void 0)}),[A,N]);let[P,F]=gB(A),ne=_o(m);Mo(()=>{j&&ne?.()},[j,ne]);let re=M.arrow?.x,ie=M.arrow?.y,I=M.arrow?.centerOffset!==0,[L,R]=B.useState();return Mo(()=>{_&&R(window.getComputedStyle(_).zIndex)},[_]),(0,V.jsx)(`div`,{ref:ee.setFloating,"data-radix-popper-content-wrapper":``,style:{...te,transform:j?te.transform:`translate(0, -200%)`,minWidth:`max-content`,zIndex:L,"--radix-popper-transform-origin":[M.transformOrigin?.x,M.transformOrigin?.y].join(` `),...M.hide?.referenceHidden&&{visibility:`hidden`,pointerEvents:`none`}},dir:e.dir,children:(0,V.jsx)(dB,{scope:n,placedSide:P,placedAlign:F,onArrowChange:x,arrowX:re,arrowY:ie,shouldHideArrow:I,children:(0,V.jsx)(ho.div,{"data-side":P,"data-align":F,...h,ref:y,style:{...h.style,animation:j?h.style?.animation:`none`}})})})},`PopperContent`));function mB(e){return e!==null}tB(mB,`isNotNull`);var hB=tB(e=>({name:`transformOrigin`,options:e,fn(t){let{placement:n,rects:r,middlewareData:i}=t,a=i.arrow?.centerOffset!==0,o=a?0:e.arrowWidth,s=a?0:e.arrowHeight,[c,l]=gB(n),u={start:`0%`,center:`50%`,end:`100%`}[l],d=(i.arrow?.x??0)+o/2,f=(i.arrow?.y??0)+s/2,p=``,m=``;return c===`bottom`?(p=a?u:`${d}px`,m=`${-s}px`):c===`top`?(p=a?u:`${d}px`,m=`${r.floating.height+s}px`):c===`right`?(p=`${-s}px`,m=a?u:`${f}px`):c===`left`&&(p=`${r.floating.width+s}px`,m=a?u:`${f}px`),{data:{x:p,y:m}}}}),`transformOrigin`);function gB(e){let[t,n=`center`]=e.split(`-`);return[t,n]}tB(gB,`getSideAndAlignFromPlacement`);var _B=sB,vB=lB,yB=pB,bB=Object.defineProperty,xB=B.forwardRef(((e,t)=>bB(e,`name`,{value:t,configurable:!0}))(function(e,t){let{container:n,...r}=e,[i,a]=B.useState(!1);Mo(()=>a(!0),[]);let o=n||i&&globalThis?.document?.body;return o?Pi.createPortal((0,V.jsx)(ho.div,{...r,ref:t}),o):null},`Portal`)),SB=Object.defineProperty,CB=(e,t)=>SB(e,`name`,{value:t,configurable:!0});function wB(e,t){return B.useReducer((e,n)=>t[e][n]??e,e)}CB(wB,`useStateMachine`);var TB=CB(e=>{let{present:t,children:n}=e,r=EB(t),i=typeof n==`function`?n({present:r.isPresent}):B.Children.only(n),a=OB(r.ref,AB(i));return typeof n==`function`||r.isPresent?B.cloneElement(i,{ref:a}):null},`Presence`);function EB(e){let[t,n]=B.useState(),r=B.useRef(null),i=B.useRef(e),a=B.useRef(`none`),o=B.useRef(void 0),[s,c]=wB(e?`mounted`:`unmounted`,{mounted:{UNMOUNT:`unmounted`,ANIMATION_OUT:`unmountSuspended`},unmountSuspended:{MOUNT:`mounted`,ANIMATION_END:`unmounted`},unmounted:{MOUNT:`mounted`}});return B.useEffect(()=>{s===`mounted`?(a.current=o.current??kB(r.current),o.current=void 0):a.current=`none`},[s]),Mo(()=>{let t=r.current,n=i.current;if(n!==e){let r=a.current,s=kB(t);e?(o.current=s,c(`MOUNT`)):s===`none`||t?.display===`none`?c(`UNMOUNT`):c(n&&r!==s?`ANIMATION_OUT`:`UNMOUNT`),i.current=e}},[e,c]),Mo(()=>{if(t){let e,n=t.ownerDocument.defaultView??window,o=CB(a=>{let o=kB(r.current).includes(CSS.escape(a.animationName));if(a.target===t&&o&&(c(`ANIMATION_END`),!i.current)){let r=t.style.animationFillMode;t.style.animationFillMode=`forwards`,e=n.setTimeout(()=>{t.style.animationFillMode===`forwards`&&(t.style.animationFillMode=r)})}},`handleAnimationEnd`),s=CB(e=>{e.target===t&&(a.current=kB(r.current))},`handleAnimationStart`);return t.addEventListener(`animationstart`,s),t.addEventListener(`animationcancel`,o),t.addEventListener(`animationend`,o),()=>{n.clearTimeout(e),t.removeEventListener(`animationstart`,s),t.removeEventListener(`animationcancel`,o),t.removeEventListener(`animationend`,o)}}else c(`ANIMATION_END`)},[t,c]),{isPresent:[`mounted`,`unmountSuspended`].includes(s),ref:B.useCallback(e=>{if(e){let t=getComputedStyle(e);r.current=t,o.current=kB(t)}else r.current=null;n(e)},[])}}CB(EB,`usePresence`);function DB(e,t){if(typeof e==`function`)return e(t);e!=null&&(e.current=t)}CB(DB,`setRef`);function OB(...e){let t=B.useRef(e);return t.current=e,B.useCallback(e=>{let n=t.current,r=!1,i=n.map(t=>{let n=DB(t,e);return!r&&typeof n==`function`&&(r=!0),n});if(r)return()=>{for(let e=0;e<i.length;e++){let t=i[e];typeof t==`function`?t():DB(n[e],null)}}},[])}CB(OB,`useStableComposedRefs`);function kB(e){return e?.animationName||`none`}CB(kB,`getAnimationName`);function AB(e){let t=Object.getOwnPropertyDescriptor(e.props,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}CB(AB,`getElementRef`);var jB=!1;function MB(){let[e,t]=B.useState(jB);return B.useEffect(()=>{jB||(jB=!0,t(!0))},[]),e}var NB=B.useSyncExternalStore;function PB(){return()=>{}}function FB(){return NB(PB,()=>!0,()=>!1)}var IB=typeof NB==`function`?FB:MB,LB=Object.defineProperty,RB=(e,t)=>LB(e,`name`,{value:t,configurable:!0}),zB=`rovingFocusGroup.onEntryFocus`,BB={bubbles:!1,cancelable:!0},VB=`RovingFocusGroup`,[HB,UB,WB]=bz(VB),[GB,KB]=eo(VB,[WB]),[qB,JB]=GB(VB),YB=B.forwardRef(RB(function(e,t){return(0,V.jsx)(HB.Provider,{scope:e.__scopeRovingFocusGroup,children:(0,V.jsx)(HB.Slot,{scope:e.__scopeRovingFocusGroup,children:(0,V.jsx)(XB,{...e,ref:t})})})},`RovingFocusGroup`)),XB=B.forwardRef(RB(function(e,t){let{__scopeRovingFocusGroup:n,orientation:r,loop:i=!1,dir:a,currentTabStopId:o,defaultCurrentTabStopId:s,onCurrentTabStopIdChange:c,onEntryFocus:l,preventScrollOnEntryFocus:u=!1,...d}=e,f=B.useRef(null),p=$a(t,f),m=Sz(a),[h,g]=hz({prop:o,defaultProp:s??null,onChange:c,caller:VB}),[_,v]=B.useState(!1),y=_o(l),b=UB(n),x=B.useRef(!1),[S,C]=B.useState(0);return B.useEffect(()=>{let e=f.current;if(e)return e.addEventListener(zB,y),()=>e.removeEventListener(zB,y)},[y]),(0,V.jsx)(qB,{scope:n,orientation:r,dir:m,loop:i,currentTabStopId:h,onItemFocus:B.useCallback(e=>g(e),[g]),onItemShiftTab:B.useCallback(()=>v(!0),[]),onFocusableItemAdd:B.useCallback(()=>C(e=>e+1),[]),onFocusableItemRemove:B.useCallback(()=>C(e=>e-1),[]),children:(0,V.jsx)(ho.div,{tabIndex:_||S===0?-1:0,"data-orientation":r,...d,ref:p,style:{outline:`none`,...e.style},onMouseDown:sz(e.onMouseDown,()=>{x.current=!0}),onFocus:sz(e.onFocus,e=>{let t=!x.current;if(e.target===e.currentTarget&&t&&!_){let t=new CustomEvent(zB,BB);if(e.currentTarget.dispatchEvent(t),!t.defaultPrevented){let e=b().filter(e=>e.focusable);nV([e.find(e=>e.active),e.find(e=>e.id===h),...e].filter(Boolean).map(e=>e.ref.current),u)}}x.current=!1}),onBlur:sz(e.onBlur,()=>v(!1))})})},`RovingFocusGroupImpl`)),ZB=`RovingFocusGroupItem`,QB=B.forwardRef(RB(function(e,t){let{__scopeRovingFocusGroup:n,focusable:r=!0,active:i=!1,tabStopId:a,children:o,...s}=e,c=Fo(),l=a||c,u=JB(ZB,n),d=u.currentTabStopId===l,f=UB(n),{onFocusableItemAdd:p,onFocusableItemRemove:m,currentTabStopId:h}=u,g=IB();return Mo(()=>{if(!(!g||!r))return p(),()=>m()},[g,r,p,m]),B.useEffect(()=>{if(!(g||!r))return p(),()=>m()},[g,r,p,m]),(0,V.jsx)(HB.ItemSlot,{scope:n,id:l,focusable:r,active:i,children:(0,V.jsx)(ho.span,{tabIndex:d?0:-1,"data-orientation":u.orientation,...s,ref:t,onMouseDown:sz(e.onMouseDown,e=>{r?u.onItemFocus(l):e.preventDefault()}),onFocus:sz(e.onFocus,()=>u.onItemFocus(l)),onKeyDown:sz(e.onKeyDown,e=>{if(e.key===`Tab`&&e.shiftKey){u.onItemShiftTab();return}if(e.target!==e.currentTarget)return;let t=tV(e,u.orientation,u.dir);if(t!==void 0){if(e.metaKey||e.ctrlKey||e.altKey||e.shiftKey)return;e.preventDefault();let n=f().filter(e=>e.focusable).map(e=>e.ref.current);if(t===`last`)n.reverse();else if(t===`prev`||t===`next`){t===`prev`&&n.reverse();let r=n.indexOf(e.currentTarget);n=u.loop?rV(n,r+1):n.slice(r+1)}setTimeout(()=>nV(n))}}),children:typeof o==`function`?o({isCurrentTabStop:d,hasTabStop:h!=null}):o})})},`RovingFocusGroupItem`)),$B={ArrowLeft:`prev`,ArrowUp:`prev`,ArrowRight:`next`,ArrowDown:`next`,PageUp:`first`,Home:`first`,PageDown:`last`,End:`last`};function eV(e,t){return t===`rtl`?e===`ArrowLeft`?`ArrowRight`:e===`ArrowRight`?`ArrowLeft`:e:e}RB(eV,`getDirectionAwareKey`);function tV(e,t,n){let r=eV(e.key,n);if(!(t===`vertical`&&[`ArrowLeft`,`ArrowRight`].includes(r))&&!(t===`horizontal`&&[`ArrowUp`,`ArrowDown`].includes(r)))return $B[r]}RB(tV,`getFocusIntent`);function nV(e,t=!1){let n=document.activeElement;for(let r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}RB(nV,`focusFirst`);function rV(e,t){return e.map((n,r)=>e[(t+r)%e.length])}RB(rV,`wrapArray`);var iV=YB,aV=QB,oV=Object.defineProperty,sV=(e,t)=>oV(e,`name`,{value:t,configurable:!0}),cV=[`Enter`,` `],lV=[`ArrowDown`,`PageUp`,`Home`],uV=[`ArrowUp`,`PageDown`,`End`],dV=[...lV,...uV];[...cV],[...cV];var fV=`Menu`,[pV,mV,hV]=bz(fV),[gV,_V]=eo(fV,[hV,iB,KB]),vV=iB(),yV=KB(),[bV,xV]=gV(fV),[SV,CV]=gV(fV),wV=sV(e=>{let{__scopeMenu:t,open:n=!1,children:r,dir:i,onOpenChange:a,modal:o=!0}=e,s=vV(t),[c,l]=B.useState(null),u=B.useRef(!1),d=_o(a),f=Sz(i);return B.useEffect(()=>{let e=sV(()=>{u.current=!0,document.addEventListener(`pointerdown`,t,{capture:!0,once:!0}),document.addEventListener(`pointermove`,t,{capture:!0,once:!0})},`handleKeyDown`),t=sV(()=>u.current=!1,`handlePointer`);return document.addEventListener(`keydown`,e,{capture:!0}),()=>{document.removeEventListener(`keydown`,e,{capture:!0}),document.removeEventListener(`pointerdown`,t,{capture:!0}),document.removeEventListener(`pointermove`,t,{capture:!0})}},[]),B.useEffect(()=>{if(!n)return;let e=sV(()=>d(!1),`handleBlur`);return window.addEventListener(`blur`,e),()=>window.removeEventListener(`blur`,e)},[n,d]),(0,V.jsx)(_B,{...s,children:(0,V.jsx)(bV,{scope:t,open:n,onOpenChange:d,content:c,onContentChange:l,children:(0,V.jsx)(SV,{scope:t,onClose:B.useCallback(()=>d(!1),[d]),isUsingKeyboardRef:u,dir:f,modal:o,children:r})})})},`Menu`),TV=B.forwardRef(sV(function(e,t){let{__scopeMenu:n,...r}=e,i=vV(n);return(0,V.jsx)(vB,{...i,...r,ref:t})},`MenuAnchor`)),EV=`MenuPortal`,[DV,OV]=gV(EV,{forceMount:void 0}),kV=sV(e=>{let{__scopeMenu:t,forceMount:n,children:r,container:i}=e,a=xV(EV,t);return(0,V.jsx)(DV,{scope:t,forceMount:n,children:(0,V.jsx)(TB,{present:n||a.open,children:(0,V.jsx)(xB,{asChild:!0,container:i,children:r})})})},`MenuPortal`),AV=`MenuContent`,[jV,MV]=gV(AV),NV=B.forwardRef(sV(function(e,t){let n=OV(AV,e.__scopeMenu),{forceMount:r=n.forceMount,...i}=e,a=xV(AV,e.__scopeMenu),o=CV(AV,e.__scopeMenu);return(0,V.jsx)(pV.Provider,{scope:e.__scopeMenu,children:(0,V.jsx)(TB,{present:r||a.open,children:(0,V.jsx)(pV.Slot,{scope:e.__scopeMenu,children:o.modal?(0,V.jsx)(PV,{...i,ref:t}):(0,V.jsx)(FV,{...i,ref:t})})})})},`MenuContent`)),PV=B.forwardRef(sV(function(e,t){let n=xV(AV,e.__scopeMenu),r=B.useRef(null),i=$a(t,r);return B.useEffect(()=>{let e=r.current;if(e)return bP(e)},[]),(0,V.jsx)(LV,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:sz(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})},`MenuRootContentModal`)),FV=B.forwardRef(sV(function(e,t){let n=xV(AV,e.__scopeMenu);return(0,V.jsx)(LV,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})},`MenuRootContentNonModal`)),IV=no(`MenuContent.ScrollLock`),LV=B.forwardRef(sV(function(e,t){let{__scopeMenu:n,loop:r=!1,trapFocus:i,onOpenAutoFocus:a,onCloseAutoFocus:o,disableOutsidePointerEvents:s,onEntryFocus:c,onEscapeKeyDown:l,onPointerDownOutside:u,onFocusOutside:d,onInteractOutside:f,onDismiss:p,disableOutsideScroll:m,...h}=e,g=xV(AV,n),_=CV(AV,n),v=vV(n),y=yV(n),b=mV(n),[x,S]=B.useState(null),C=B.useRef(null),w=$a(t,C,g.onContentChange),T=B.useRef(0),E=B.useRef(``),D=B.useRef(0),O=B.useRef(null),k=B.useRef(`right`),ee=B.useRef(0),te=m?dP:B.Fragment,A=m?{as:IV,allowPinchZoom:!0}:void 0,j=sV(e=>{let t=E.current+e,n=b().filter(e=>!e.disabled),r=document.activeElement,i=n.find(e=>e.ref.current===r)?.textValue,a=nH(n.map(e=>e.textValue),t,i),o=n.find(e=>e.textValue===a)?.ref.current;sV((function e(t){E.current=t,window.clearTimeout(T.current),t!==``&&(T.current=window.setTimeout(()=>e(``),1e3))}),`updateSearch`)(t),o&&setTimeout(()=>o.focus())},`handleTypeaheadSearch`);B.useEffect(()=>()=>window.clearTimeout(T.current),[]),TI();let M=B.useCallback(e=>k.current===O.current?.side&&iH(e,O.current?.area),[]);return(0,V.jsx)(jV,{scope:n,searchRef:E,onItemEnter:B.useCallback(e=>{M(e)&&e.preventDefault()},[M]),onItemLeave:B.useCallback(e=>{M(e)||(C.current?.focus(),S(null))},[M]),onTriggerLeave:B.useCallback(e=>{M(e)&&e.preventDefault()},[M]),pointerGraceTimerRef:D,onPointerGraceIntentChange:B.useCallback(e=>{O.current=e},[]),children:(0,V.jsx)(te,{...A,children:(0,V.jsx)(Hz,{asChild:!0,trapped:i,onMountAutoFocus:sz(a,e=>{e.preventDefault(),C.current?.focus({preventScroll:!0})}),onUnmountAutoFocus:o,children:(0,V.jsx)(Az,{asChild:!0,disableOutsidePointerEvents:s,onEscapeKeyDown:l,onPointerDownOutside:u,onFocusOutside:d,onInteractOutside:f,onDismiss:p,children:(0,V.jsx)(iV,{asChild:!0,...y,dir:_.dir,orientation:`vertical`,loop:r,currentTabStopId:x,onCurrentTabStopIdChange:S,onEntryFocus:sz(c,e=>{_.isUsingKeyboardRef.current||e.preventDefault()}),preventScrollOnEntryFocus:!0,children:(0,V.jsx)(yB,{role:`menu`,"aria-orientation":`vertical`,"data-state":ZV(g.open),"data-radix-menu-content":``,dir:_.dir,...v,...h,ref:w,style:{outline:`none`,...h.style},onKeyDown:sz(h.onKeyDown,e=>{let t=e.target.closest(`[data-radix-menu-content]`)===e.currentTarget,n=e.ctrlKey||e.altKey||e.metaKey,r=e.key.length===1;t&&(e.key===`Tab`&&e.preventDefault(),!n&&r&&j(e.key));let i=C.current;if(e.target!==i||!dV.includes(e.key))return;e.preventDefault();let a=b().filter(e=>!e.disabled).map(e=>e.ref.current);uV.includes(e.key)&&a.reverse(),eH(a)}),onBlur:sz(e.onBlur,e=>{e.currentTarget.contains(e.target)||(window.clearTimeout(T.current),E.current=``)}),onPointerMove:sz(e.onPointerMove,aH(e=>{let t=e.target,n=ee.current!==e.clientX;if(e.currentTarget.contains(t)&&n){let t=e.clientX>ee.current?`right`:`left`;k.current=t,ee.current=e.clientX}}))})})})})})})},`MenuContentImpl`)),RV=B.forwardRef(sV(function(e,t){let{__scopeMenu:n,...r}=e;return(0,V.jsx)(ho.div,{role:`group`,...r,ref:t})},`MenuGroup`)),zV=B.forwardRef(sV(function(e,t){let{__scopeMenu:n,...r}=e;return(0,V.jsx)(ho.div,{...r,ref:t})},`MenuLabel`)),BV=`MenuItem`,VV=`menu.itemSelect`,HV=B.forwardRef(sV(function(e,t){let{disabled:n=!1,onSelect:r,...i}=e,a=B.useRef(null),o=CV(BV,e.__scopeMenu),s=MV(BV,e.__scopeMenu),c=$a(t,a),l=B.useRef(!1),u=sV(()=>{let e=a.current;if(!n&&e){let t=new CustomEvent(VV,{bubbles:!0,cancelable:!0});e.addEventListener(VV,e=>r?.(e),{once:!0}),go(e,t),t.defaultPrevented?l.current=!1:o.onClose()}},`handleSelect`);return(0,V.jsx)(UV,{...i,ref:c,disabled:n,onClick:sz(e.onClick,u),onPointerDown:t=>{e.onPointerDown?.(t),l.current=!0},onPointerUp:sz(e.onPointerUp,e=>{l.current||e.currentTarget?.click()}),onKeyDown:sz(e.onKeyDown,e=>{n||e.target!==e.currentTarget||s.searchRef.current!==``&&e.key===` `||cV.includes(e.key)&&(e.currentTarget.click(),e.preventDefault())})})},`MenuItem`)),UV=B.forwardRef(sV(function(e,t){let{__scopeMenu:n,disabled:r=!1,textValue:i,...a}=e,o=MV(BV,n),s=yV(n),c=B.useRef(null),l=$a(t,c),[u,d]=B.useState(!1),[f,p]=B.useState(``);return B.useEffect(()=>{let e=c.current;e&&p((e.textContent??``).trim())},[a.children]),(0,V.jsx)(pV.ItemSlot,{scope:n,disabled:r,textValue:i??f,children:(0,V.jsx)(aV,{asChild:!0,...s,focusable:!r,children:(0,V.jsx)(ho.div,{role:`menuitem`,"data-highlighted":u?``:void 0,"aria-disabled":r||void 0,"data-disabled":r?``:void 0,...a,ref:l,onPointerMove:sz(e.onPointerMove,aH(e=>{r?o.onItemLeave(e):(o.onItemEnter(e),e.defaultPrevented||e.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:sz(e.onPointerLeave,aH(e=>o.onItemLeave(e))),onFocus:sz(e.onFocus,()=>d(!0)),onBlur:sz(e.onBlur,()=>d(!1))})})})},`MenuItemImpl`)),[WV,GV]=gV(`MenuRadioGroup`,{value:void 0,onValueChange:sV(()=>{},`onValueChange`)}),[KV,qV]=gV(`MenuItemIndicator`,{checked:!1}),JV=B.forwardRef(sV(function(e,t){let{__scopeMenu:n,...r}=e;return(0,V.jsx)(ho.div,{role:`separator`,"aria-orientation":`horizontal`,...r,ref:t})},`MenuSeparator`)),[YV,XV]=gV(`MenuSub`);function ZV(e){return e?`open`:`closed`}sV(ZV,`getOpenState`);function QV(e){return e===`indeterminate`}sV(QV,`isIndeterminate`);function $V(e){return QV(e)?`indeterminate`:e?`checked`:`unchecked`}sV($V,`getCheckedState`);function eH(e){let t=document.activeElement;for(let n of e)if(n===t||(n.focus(),document.activeElement!==t))return}sV(eH,`focusFirst`);function tH(e,t){return e.map((n,r)=>e[(t+r)%e.length])}sV(tH,`wrapArray`);function nH(e,t,n){let r=t.length>1&&Array.from(t).every(e=>e===t[0])?t[0]:t,i=n?e.indexOf(n):-1,a=tH(e,Math.max(i,0));r.length===1&&(a=a.filter(e=>e!==n));let o=a.find(e=>e.toLowerCase().startsWith(r.toLowerCase()));return o===n?void 0:o}sV(nH,`getNextMatch`);function rH(e,t){let{x:n,y:r}=e,i=!1;for(let e=0,a=t.length-1;e<t.length;a=e++){let o=t[e],s=t[a],c=o.x,l=o.y,u=s.x,d=s.y;l>r!=d>r&&n<(u-c)*(r-l)/(d-l)+c&&(i=!i)}return i}sV(rH,`isPointInPolygon`);function iH(e,t){return t?rH({x:e.clientX,y:e.clientY},t):!1}sV(iH,`isPointerInGraceArea`);function aH(e){return t=>t.pointerType===`mouse`?e(t):void 0}sV(aH,`whenMouse`);var oH=wV,sH=TV,cH=kV,lH=NV,uH=RV,dH=zV,fH=HV,pH=JV,mH=Object.defineProperty,hH=(e,t)=>mH(e,`name`,{value:t,configurable:!0}),gH=`DropdownMenu`,[_H,vH]=eo(gH,[_V]),yH=_V(),[bH,xH]=_H(gH),SH=hH(e=>{let{__scopeDropdownMenu:t,children:n,dir:r,open:i,defaultOpen:a,onOpenChange:o,modal:s=!0}=e,c=yH(t),l=B.useRef(null),[u,d]=hz({prop:i,defaultProp:a??!1,onChange:o,caller:gH});return(0,V.jsx)(bH,{scope:t,triggerId:Fo(),triggerRef:l,contentId:Fo(),open:u,onOpenChange:d,onOpenToggle:B.useCallback(()=>d(e=>!e),[d]),modal:s,children:(0,V.jsx)(oH,{...c,open:u,onOpenChange:d,dir:r,modal:s,children:n})})},`DropdownMenu`),CH=`DropdownMenuTrigger`,wH=B.forwardRef(hH(function(e,t){let{__scopeDropdownMenu:n,disabled:r=!1,...i}=e,a=xH(CH,n),o=yH(n),s=$a(t,a.triggerRef);return(0,V.jsx)(sH,{asChild:!0,...o,children:(0,V.jsx)(ho.button,{type:`button`,id:a.triggerId,"aria-haspopup":`menu`,"aria-expanded":a.open,"aria-controls":a.open?a.contentId:void 0,"data-state":a.open?`open`:`closed`,"data-disabled":r?``:void 0,disabled:r,...i,ref:s,onPointerDown:sz(e.onPointerDown,e=>{!r&&e.button===0&&e.ctrlKey===!1&&(a.onOpenToggle(),a.open||e.preventDefault())}),onKeyDown:sz(e.onKeyDown,e=>{r||([`Enter`,` `].includes(e.key)&&a.onOpenToggle(),e.key===`ArrowDown`&&a.onOpenChange(!0),[`Enter`,` `,`ArrowDown`].includes(e.key)&&e.preventDefault())})})})},`DropdownMenuTrigger`)),TH=hH(e=>{let{__scopeDropdownMenu:t,...n}=e,r=yH(t);return(0,V.jsx)(cH,{...r,...n})},`DropdownMenuPortal`),EH=`DropdownMenuContent`,DH=B.forwardRef(hH(function(e,t){let{__scopeDropdownMenu:n,...r}=e,i=xH(EH,n),a=yH(n),o=B.useRef(!1);return(0,V.jsx)(lH,{id:i.contentId,"aria-labelledby":i.triggerId,...a,...r,ref:t,onCloseAutoFocus:sz(e.onCloseAutoFocus,e=>{o.current||i.triggerRef.current?.focus(),o.current=!1,e.preventDefault()}),onInteractOutside:sz(e.onInteractOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0,r=t.button===2||n;(!i.modal||r)&&(o.current=!0)}),style:{...e.style,"--radix-dropdown-menu-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-dropdown-menu-content-available-width":`var(--radix-popper-available-width)`,"--radix-dropdown-menu-content-available-height":`var(--radix-popper-available-height)`,"--radix-dropdown-menu-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-dropdown-menu-trigger-height":`var(--radix-popper-anchor-height)`}})},`DropdownMenuContent`)),OH=B.forwardRef(hH(function(e,t){let{__scopeDropdownMenu:n,...r}=e,i=yH(n);return(0,V.jsx)(uH,{...i,...r,ref:t})},`DropdownMenuGroup`)),kH=B.forwardRef(hH(function(e,t){let{__scopeDropdownMenu:n,...r}=e,i=yH(n);return(0,V.jsx)(dH,{...i,...r,ref:t})},`DropdownMenuLabel`)),AH=B.forwardRef(hH(function(e,t){let{__scopeDropdownMenu:n,...r}=e,i=yH(n);return(0,V.jsx)(fH,{...i,...r,ref:t})},`DropdownMenuItem`)),jH=B.forwardRef(hH(function(e,t){let{__scopeDropdownMenu:n,...r}=e,i=yH(n);return(0,V.jsx)(pH,{...i,...r,ref:t})},`DropdownMenuSeparator`)),MH=SH,NH=wH,PH=TH,FH=DH,IH=OH,LH=kH,RH=AH,zH=jH;function BH(e){return(0,V.jsx)(MH,{...e})}function VH(e){return(0,V.jsx)(NH,{...e})}function HH({className:e,sideOffset:t=6,...n}){return(0,V.jsx)(PH,{children:(0,V.jsx)(FH,{sideOffset:t,className:K(`z-100 max-h-[min(28rem,calc(100dvh-1rem))] min-w-56 max-w-[calc(100vw-1rem)] overflow-y-auto rounded-lg bg-zinc-900 p-1.5 text-zinc-200 shadow-xl ring-1 ring-white/10 outline-none [scrollbar-color:var(--color-zinc-700)_transparent]`,e),...n})})}function UH(e){return(0,V.jsx)(IH,{...e})}function WH({className:e,...t}){return(0,V.jsx)(RH,{className:K(`relative flex min-h-11 cursor-default items-center gap-2 rounded-md px-2.5 py-2 text-base outline-none select-none [&_svg]:size-4 [&_svg]:shrink-0 data-[disabled]:pointer-events-none data-[disabled]:opacity-45 data-[highlighted]:bg-white/7 data-[highlighted]:text-zinc-50 sm:min-h-8 sm:py-1.5 sm:text-sm`,e),...t})}function GH({className:e,...t}){return(0,V.jsx)(LH,{className:K(`px-2.5 py-1.5 text-xs font-medium text-zinc-500`,e),...t})}function KH({className:e,...t}){return(0,V.jsx)(zH,{className:K(`-mx-1.5 my-1 h-px bg-white/8`,e),...t})}var qH=`rovingFocusGroup.onEntryFocus`,JH={bubbles:!1,cancelable:!0},YH=`RovingFocusGroup`,[XH,ZH,QH]=bz(YH),[$H,eU]=eo(YH,[QH]),[tU,nU]=$H(YH),rU=B.forwardRef((e,t)=>(0,V.jsx)(XH.Provider,{scope:e.__scopeRovingFocusGroup,children:(0,V.jsx)(XH.Slot,{scope:e.__scopeRovingFocusGroup,children:(0,V.jsx)(iU,{...e,ref:t})})}));rU.displayName=YH;var iU=B.forwardRef((e,t)=>{let{__scopeRovingFocusGroup:n,orientation:r,loop:i=!1,dir:a,currentTabStopId:o,defaultCurrentTabStopId:s,onCurrentTabStopIdChange:c,onEntryFocus:l,preventScrollOnEntryFocus:u=!1,...d}=e,f=B.useRef(null),p=$a(t,f),m=Sz(a),[h,g]=Ml({prop:o,defaultProp:s??null,onChange:c,caller:YH}),[_,v]=B.useState(!1),y=_o(l),b=ZH(n),x=B.useRef(!1),[S,C]=B.useState(0);return B.useEffect(()=>{let e=f.current;if(e)return e.addEventListener(qH,y),()=>e.removeEventListener(qH,y)},[y]),(0,V.jsx)(tU,{scope:n,orientation:r,dir:m,loop:i,currentTabStopId:h,onItemFocus:B.useCallback(e=>g(e),[g]),onItemShiftTab:B.useCallback(()=>v(!0),[]),onFocusableItemAdd:B.useCallback(()=>C(e=>e+1),[]),onFocusableItemRemove:B.useCallback(()=>C(e=>e-1),[]),children:(0,V.jsx)(ho.div,{tabIndex:_||S===0?-1:0,"data-orientation":r,...d,ref:p,style:{outline:`none`,...e.style},onMouseDown:Xa(e.onMouseDown,()=>{x.current=!0}),onFocus:Xa(e.onFocus,e=>{let t=!x.current;if(e.target===e.currentTarget&&t&&!_){let t=new CustomEvent(qH,JH);if(e.currentTarget.dispatchEvent(t),!t.defaultPrevented){let e=b().filter(e=>e.focusable);uU([e.find(e=>e.active),e.find(e=>e.id===h),...e].filter(Boolean).map(e=>e.ref.current),u)}}x.current=!1}),onBlur:Xa(e.onBlur,()=>v(!1))})})}),aU=`RovingFocusGroupItem`,oU=B.forwardRef((e,t)=>{let{__scopeRovingFocusGroup:n,focusable:r=!0,active:i=!1,tabStopId:a,children:o,...s}=e,c=Fo(),l=a||c,u=nU(aU,n),d=u.currentTabStopId===l,f=ZH(n),{onFocusableItemAdd:p,onFocusableItemRemove:m,currentTabStopId:h}=u,g=IB();return Mo(()=>{if(!(!g||!r))return p(),()=>m()},[g,r,p,m]),B.useEffect(()=>{if(!(g||!r))return p(),()=>m()},[g,r,p,m]),(0,V.jsx)(XH.ItemSlot,{scope:n,id:l,focusable:r,active:i,children:(0,V.jsx)(ho.span,{tabIndex:d?0:-1,"data-orientation":u.orientation,...s,ref:t,onMouseDown:Xa(e.onMouseDown,e=>{r?u.onItemFocus(l):e.preventDefault()}),onFocus:Xa(e.onFocus,()=>u.onItemFocus(l)),onKeyDown:Xa(e.onKeyDown,e=>{if(e.key===`Tab`&&e.shiftKey){u.onItemShiftTab();return}if(e.target!==e.currentTarget)return;let t=lU(e,u.orientation,u.dir);if(t!==void 0){if(e.metaKey||e.ctrlKey||e.altKey||e.shiftKey)return;e.preventDefault();let n=f().filter(e=>e.focusable).map(e=>e.ref.current);if(t===`last`)n.reverse();else if(t===`prev`||t===`next`){t===`prev`&&n.reverse();let r=n.indexOf(e.currentTarget);n=u.loop?dU(n,r+1):n.slice(r+1)}setTimeout(()=>uU(n))}}),children:typeof o==`function`?o({isCurrentTabStop:d,hasTabStop:h!=null}):o})})});oU.displayName=aU;var sU={ArrowLeft:`prev`,ArrowUp:`prev`,ArrowRight:`next`,ArrowDown:`next`,PageUp:`first`,Home:`first`,PageDown:`last`,End:`last`};function cU(e,t){return t===`rtl`?e===`ArrowLeft`?`ArrowRight`:e===`ArrowRight`?`ArrowLeft`:e:e}function lU(e,t,n){let r=cU(e.key,n);if(!(t===`vertical`&&[`ArrowLeft`,`ArrowRight`].includes(r))&&!(t===`horizontal`&&[`ArrowUp`,`ArrowDown`].includes(r)))return sU[r]}function uU(e,t=!1){let n=document.activeElement;for(let r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}function dU(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var fU=rU,pU=oU,mU=`Tabs`,[hU,gU]=eo(mU,[eU]),_U=eU(),[vU,yU]=hU(mU),bU=B.forwardRef((e,t)=>{let{__scopeTabs:n,value:r,onValueChange:i,defaultValue:a,orientation:o=`horizontal`,dir:s,activationMode:c=`automatic`,...l}=e,u=Sz(s),[d,f]=Ml({prop:r,onChange:i,defaultProp:a??``,caller:mU});return(0,V.jsx)(vU,{scope:n,baseId:Fo(),value:d,onValueChange:f,orientation:o,dir:u,activationMode:c,children:(0,V.jsx)(ho.div,{dir:u,"data-orientation":o,...l,ref:t})})});bU.displayName=mU;var xU=`TabsList`,SU=B.forwardRef((e,t)=>{let{__scopeTabs:n,loop:r=!0,...i}=e,a=yU(xU,n),o=_U(n);return(0,V.jsx)(fU,{asChild:!0,...o,orientation:a.orientation,dir:a.dir,loop:r,children:(0,V.jsx)(ho.div,{role:`tablist`,"aria-orientation":a.orientation,...i,ref:t})})});SU.displayName=xU;var CU=`TabsTrigger`,wU=B.forwardRef((e,t)=>{let{__scopeTabs:n,value:r,disabled:i=!1,...a}=e,o=yU(CU,n),s=_U(n),c=DU(o.baseId,r),l=OU(o.baseId,r),u=r===o.value;return(0,V.jsx)(pU,{asChild:!0,...s,focusable:!i,active:u,children:(0,V.jsx)(ho.button,{type:`button`,role:`tab`,"aria-selected":u,"aria-controls":l,"data-state":u?`active`:`inactive`,"data-disabled":i?``:void 0,disabled:i,id:c,...a,ref:t,onMouseDown:Xa(e.onMouseDown,e=>{!i&&e.button===0&&e.ctrlKey===!1?o.onValueChange(r):e.preventDefault()}),onKeyDown:Xa(e.onKeyDown,e=>{i||e.target!==e.currentTarget||[` `,`Enter`].includes(e.key)&&o.onValueChange(r)}),onFocus:Xa(e.onFocus,()=>{let e=o.activationMode!==`manual`;!u&&!i&&e&&o.onValueChange(r)})})})});wU.displayName=CU;var TU=`TabsContent`,EU=B.forwardRef((e,t)=>{let{__scopeTabs:n,value:r,forceMount:i,children:a,...o}=e,s=yU(TU,n),c=DU(s.baseId,r),l=OU(s.baseId,r),u=r===s.value,d=B.useRef(u);return B.useEffect(()=>{let e=requestAnimationFrame(()=>d.current=!1);return()=>cancelAnimationFrame(e)},[]),(0,V.jsx)(Sl,{present:i||u,children:({present:n})=>(0,V.jsx)(ho.div,{"data-state":u?`active`:`inactive`,"data-orientation":s.orientation,role:`tabpanel`,"aria-labelledby":c,hidden:!n,id:l,tabIndex:0,...o,ref:t,style:{...e.style,animationDuration:d.current?`0s`:void 0},children:n&&a})})});EU.displayName=TU;function DU(e,t){return`${e}-trigger-${t}`}function OU(e,t){return`${e}-content-${t}`}var kU=bU,AU=SU,jU=wU,MU=EU,NU=kU,PU=AU,FU=jU,IU=MU,LU={phase:`closed`,degraded:!1,controller:!1,controlPending:!1,title:null,bellActive:!1,bellSerial:0,exitSerial:0,fileTransfer:null,hasSelection:!1,pasteRequestSerial:0,error:null};function RU({terminal:e,title:t,disabled:n,selected:r,onCloseTerminal:i}){let a=QA(e.id);return(0,V.jsxs)(Qd,{children:[(0,V.jsx)($d,{asChild:!0,children:(0,V.jsx)(q,{type:`button`,variant:`ghost`,size:`icon-sm`,className:K(`mr-1 shrink-0 self-center text-zinc-600 group-hover/tab:text-zinc-400 hover:bg-transparent hover:text-zinc-200`,r&&`text-zinc-400`),"aria-label":`Close ${t}`,disabled:n,onClick:()=>i(e,{title:t,hasForegroundProcess:a}),children:(0,V.jsx)(JF,{})})}),(0,V.jsx)(ef,{side:`bottom`,children:n?`Every worktree keeps at least one terminal`:`Close terminal`})]})}function zU({worktree:e,terminal:t,pendingTerminals:n,selectedPendingTerminalId:r,loading:i,autoFocusBlocked:a,presets:o,presetsLoading:s,presetsError:c,mutationsDisabled:l,onSelectTerminal:u,onSelectPendingTerminal:d,onCreateTerminal:f,onManagePresets:p,onCloseTerminal:m,onStatusChange:h}){let g=(0,B.useRef)(null),_=(0,B.useRef)(null),v=(0,B.useRef)(null),[y,b]=(0,B.useState)(null),[x,S]=(0,B.useState)(!1),[C,w]=(0,B.useState)(!1),[T,E]=(0,B.useState)(!1),[D,O]=(0,B.useState)(``),k=(0,B.useRef)(0),ee=(0,B.useRef)(0),te=(0,B.useRef)(null),A=(0,B.useRef)(null),j=af();(0,B.useLayoutEffect)(()=>{if(!t){b(null);return}let e=VA.acquire(t.id);return b(e),()=>VA.release(t.id)},[t?.id]);let M=y?.terminalId===t?.id?y:null,N=(0,B.useSyncExternalStore)(M?.subscribe??(()=>()=>void 0),M?.getSnapshot??(()=>LU),()=>LU),{attention:P,titles:F,progress:ne}=$A();(0,B.useLayoutEffect)(()=>{let e=_.current;if(!(!e||!M))return M.mount(e),()=>M.unmount(e)},[M]),of({terminalId:t?.id??null,session:M,blocked:a}),(0,B.useEffect)(()=>{if(M)return M.setInputModifiers(x,C,()=>{S(!1),w(!1)}),()=>M.setInputModifiers(!1,!1,()=>void 0)},[M,C,x]),(0,B.useEffect)(()=>{if(te.current!==t?.id){te.current=t?.id??null,ee.current=N.pasteRequestSerial,E(!1),O(``);return}N.pasteRequestSerial>ee.current&&(ee.current=N.pasteRequestSerial,E(!0))},[N.pasteRequestSerial,t?.id]),(0,B.useEffect)(()=>{if(A.current!==t?.id){A.current=t?.id??null,k.current=N.exitSerial;return}N.exitSerial<=k.current||(k.current=N.exitSerial,h())},[h,N.exitSerial,t?.id]);let re=e=>{let t=e;x&&e.length===1&&(t=String.fromCharCode(e.toUpperCase().charCodeAt(0)&31)),C&&(t=`\u001b${t}`),M?.sendText(t),S(!1),w(!1)},ie=e=>{M?.sendArrow(e,C),S(!1),w(!1)},I=e=>{e&&(M?.pasteText(e),O(``),E(!1))},L=()=>{M?.requestControl(),E(!0),navigator.clipboard&&navigator.clipboard.readText().then(e=>I(e),()=>void 0)},R=n.find(e=>e.id===r),ae=t?F.get(t.id)||t.name:R?.name??``,z=e?.terminals??[],oe=!e||l;return(0,B.useEffect)(()=>{let e=e=>{if(!e.metaKey||e.altKey||e.ctrlKey||e.shiftKey||g.current?.closest(`[inert]`))return;let t=Number(e.key)-1;if(!Number.isInteger(t)||t<0||t>8)return;let r=z[t],i=n[t-z.length];if(!(!r&&!i)){if(e.preventDefault(),e.stopPropagation(),i){d(i.id);return}r&&(M&&M.terminalId===r.id&&M.focus(),u(r))}};return document.addEventListener(`keydown`,e,!0),()=>document.removeEventListener(`keydown`,e,!0)},[M,d,u,n,z]),(0,V.jsx)(NU,{value:r??t?.id??``,onValueChange:e=>{let t=n.find(t=>t.id===e);if(t){d(t.id);return}let r=z.find(t=>t.id===e);r&&u(r)},asChild:!0,children:(0,V.jsxs)(`main`,{ref:g,className:K(`terminal-shell grid min-h-0 min-w-0 grid-rows-[2.5rem_minmax(0,1fr)] bg-zinc-950 max-[700px]:grid-rows-[2.75rem_minmax(0,1fr)_3.25rem]`,N.bellActive&&`terminal-bell`),"aria-label":R?`Starting ${R.name} terminal`:t?`${ae} terminal`:`Terminal panel`,children:[(0,V.jsxs)(`header`,{className:`terminal-header flex min-w-0 items-stretch border-b border-white/8 bg-zinc-900/70`,children:[(0,V.jsx)(`div`,{className:`min-w-0 max-w-full flex-1 overflow-x-auto`,children:(0,V.jsxs)(PU,{className:`flex h-full min-w-full items-stretch`,"aria-label":`${e?.name??`Worktree`} terminals`,children:[z.map((e,n)=>{let r=e.id===t?.id,i=F.get(e.id)||e.name,a=P.has(e.id),o=ne.get(e.id),s=!!o&&o.state!==`paused`&&o.state!==`error`,c=[e.status,r&&N.degraded?`reconnecting`:null,o?If(o):null,a?`bell`:null].filter(Boolean).join(`, `);return(0,V.jsxs)(`div`,{className:K(`group/tab relative flex min-w-36 flex-1 basis-0 items-center border-r border-white/6 hover:bg-white/4 after:pointer-events-none after:absolute after:inset-x-0 after:top-0 after:h-0.5 after:bg-cyan-400 after:opacity-0`,r&&`bg-zinc-800 hover:bg-zinc-700/70 after:opacity-100`),children:[(0,V.jsxs)(FU,{value:e.id,onClick:()=>{r&&j(e.id)},className:`flex h-full min-w-0 flex-1 items-center gap-1.5 py-0 pr-0.5 pl-3 text-[0.8125rem] font-normal text-zinc-500 outline-none group-hover/tab:text-zinc-200 focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-cyan-400 data-[state=active]:text-zinc-50`,"aria-label":`${i}, ${c}`,"aria-keyshortcuts":n<9?`Meta+${n+1}`:void 0,title:i,children:[o?(0,V.jsx)(mI,{working:s,className:K(`size-4 shrink-0 stroke-zinc-500`,s&&`stroke-cyan-400`,o.state===`error`&&`stroke-rose-300`,o.state===`paused`&&`stroke-amber-300`,a&&`stroke-amber-300`)}):e.status!==`running`||a?(0,V.jsx)(`span`,{className:K(`size-1.5 shrink-0 rounded-full bg-zinc-600`,e.status===`exited`&&`bg-rose-400`,a&&`bg-amber-300 shadow-[0_0_0.5rem] shadow-amber-300/60`),"aria-hidden":`true`}):null,(0,V.jsx)(`span`,{className:K(`min-w-0 flex-1 truncate text-base sm:text-[0.734375rem]`,s&&!a&&`text-cyan-300`),children:i}),n<9&&(0,V.jsxs)(`span`,{className:K(`ml-1 shrink-0 text-[0.6875rem]/4 font-normal text-zinc-600 tabular-nums group-hover/tab:text-zinc-400`,r&&`text-zinc-400`),"aria-hidden":`true`,children:[`⌘`,n+1]})]}),(0,V.jsx)(RU,{terminal:e,title:i,disabled:z.length===1,selected:r,onCloseTerminal:m})]},e.id)}),n.map((e,t)=>{let n=z.length+t;return(0,V.jsx)(`div`,{className:`group/tab relative flex min-w-36 flex-1 basis-0 items-center border-r border-white/6 hover:bg-white/4`,children:(0,V.jsxs)(FU,{value:e.id,className:`flex h-full min-w-0 flex-1 items-center gap-1.5 py-0 pr-2 pl-3 text-[0.8125rem] font-normal text-zinc-400 outline-none focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-cyan-400 data-[state=active]:bg-zinc-800 data-[state=active]:text-zinc-50`,"aria-label":`${e.name}, starting`,"aria-keyshortcuts":n<9?`Meta+${n+1}`:void 0,title:`${e.name} is starting`,children:[(0,V.jsx)(bF,{className:`size-3.5 shrink-0 animate-spin fill-zinc-500`,"aria-hidden":`true`}),(0,V.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-base sm:text-[0.734375rem]`,children:e.name}),(0,V.jsx)(`span`,{className:`shrink-0 text-[0.6875rem]/4 text-zinc-500`,children:`Starting…`})]})},e.id)})]})}),(0,V.jsxs)(BH,{children:[(0,V.jsxs)(Qd,{children:[(0,V.jsx)($d,{asChild:!0,children:(0,V.jsx)(VH,{asChild:!0,children:(0,V.jsx)(q,{ref:v,type:`button`,variant:`ghost`,size:`icon-sm`,className:`m-0 size-11 shrink-0 text-zinc-500 hover:bg-white/5 hover:text-zinc-100 min-[701px]:m-1 min-[701px]:size-7`,"aria-label":`New terminal`,children:(0,V.jsx)(WF,{})})})}),(0,V.jsx)(ef,{side:`bottom`,children:`New terminal`})]}),(0,V.jsxs)(HH,{align:`end`,side:`bottom`,children:[(0,V.jsx)(GH,{children:`New terminal`}),(0,V.jsxs)(UH,{children:[(0,V.jsxs)(WH,{disabled:oe,onSelect:()=>f({name:`Shell`}),children:[(0,V.jsx)(IF,{}),`Shell`]}),o.map(e=>(0,V.jsxs)(WH,{disabled:oe,onSelect:()=>f({name:e.name,argv:[e.executable,...e.args],...e.closeOnSuccess?{closeOnSuccess:!0}:{returnToShell:!0}}),children:[(0,V.jsx)(IF,{}),(0,V.jsx)(`span`,{className:`truncate`,children:e.name})]},e.id)),s&&(0,V.jsx)(WH,{disabled:!0,children:`Loading presets…`}),c&&(0,V.jsx)(WH,{disabled:!0,children:`Presets unavailable`})]}),(0,V.jsx)(KH,{}),(0,V.jsx)(UH,{children:(0,V.jsxs)(WH,{onSelect:()=>{let e=v.current;queueMicrotask(()=>p(e))},children:[(0,V.jsx)(PF,{}),`Manage presets`]})})]})]}),t&&N.phase===`ready`&&!N.controller&&(0,V.jsxs)(`span`,{className:`my-1 mr-2 ml-auto inline-flex shrink-0 items-center gap-1.5 self-center rounded-full bg-white/5 px-2 py-1 text-[0.6875rem] font-medium text-zinc-400 ring-1 ring-white/8`,title:`Interact with the terminal to control it`,children:[(0,V.jsx)(`span`,{className:K(`size-1.5 rounded-full bg-zinc-500`,N.controlPending&&`animate-pulse bg-cyan-400`),"aria-hidden":`true`}),N.controlPending?`Taking control…`:`Viewing`]})]}),R?(0,V.jsx)(`div`,{className:`grid min-h-0 place-items-center bg-[radial-gradient(circle_at_center,var(--color-zinc-900)_0,var(--color-zinc-950)_55%)] p-8`,children:(0,V.jsxs)(`div`,{className:`flex items-center gap-2 text-sm text-zinc-300`,role:`status`,children:[(0,V.jsx)(bF,{className:`size-4 animate-spin fill-zinc-500`,"aria-hidden":`true`}),`Starting `,R.name,`…`]})}):t?(0,V.jsxs)(`div`,{className:`relative min-h-0 min-w-0 overflow-hidden`,children:[(0,V.jsx)(IU,{value:t.id,forceMount:!0,className:`xterm-host absolute inset-0 min-h-0 min-w-0 overflow-hidden p-2.5 outline-none max-[700px]:p-1.5`,ref:_,onMouseDown:()=>M?.focus({requestControl:!0})},t.id),T&&(0,V.jsxs)(`div`,{className:`absolute inset-x-3 bottom-3 z-20 grid gap-2 rounded-lg bg-zinc-900 p-3 shadow-xl ring-1 ring-white/15`,role:`dialog`,"aria-label":`Paste into terminal`,children:[(0,V.jsx)(`label`,{htmlFor:`terminal-paste-input`,className:`text-xs font-medium text-zinc-200`,children:`Paste text here`}),(0,V.jsx)(`textarea`,{id:`terminal-paste-input`,autoFocus:!0,rows:2,value:D,placeholder:`Touch and hold here, then choose Paste`,className:`min-h-16 resize-none rounded-md border border-white/10 bg-zinc-950 px-3 py-2 text-base text-zinc-100 outline-none focus:border-cyan-500`,onChange:e=>O(e.target.value),onPaste:e=>{let t=e.clipboardData.getData(`text`);t&&(e.preventDefault(),I(t))}}),(0,V.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,V.jsx)(q,{type:`button`,variant:`ghost`,size:`sm`,onClick:()=>{O(``),E(!1)},children:`Cancel`}),(0,V.jsx)(q,{type:`button`,size:`sm`,disabled:!D,onClick:()=>I(D),children:`Send`})]})]}),N.hasSelection&&!T&&(0,V.jsxs)(`div`,{className:`terminal-selection-actions absolute right-3 bottom-3 z-10 overflow-hidden rounded-md bg-zinc-800 shadow-lg ring-1 ring-white/15 max-[700px]:bottom-2`,"aria-label":`Terminal text selection`,children:[(0,V.jsx)(q,{type:`button`,variant:`ghost`,size:`sm`,className:`rounded-none border-r border-white/10 px-3 text-zinc-100`,onClick:()=>M?.copySelection(),children:`Copy`}),(0,V.jsx)(q,{type:`button`,variant:`ghost`,size:`sm`,className:`rounded-none px-3 text-zinc-300`,onClick:()=>M?.clearSelection(),children:`Clear`})]}),(N.degraded||N.fileTransfer)&&(0,V.jsxs)(`div`,{className:`pointer-events-none absolute inset-x-0 top-3 z-10 flex flex-col items-center gap-2`,children:[N.degraded&&(0,V.jsx)(`span`,{className:`max-w-[calc(100%-1.5rem)] rounded-full bg-zinc-900/90 px-3 py-1 text-center text-xs text-amber-200 shadow ring-1 ring-amber-400/20 backdrop-blur`,children:N.error?`${N.error} Retrying…`:`Reconnecting…`}),N.fileTransfer&&(0,V.jsx)(`span`,{className:K(`rounded-full bg-zinc-900/90 px-3 py-1 text-xs shadow ring-1 backdrop-blur`,N.fileTransfer.state===`error`?`text-rose-100 ring-rose-400/30`:`text-cyan-100 ring-cyan-400/20`),role:N.fileTransfer.state===`error`?`alert`:`status`,children:N.fileTransfer.message})]}),N.phase===`closed`&&N.error&&(0,V.jsx)(`div`,{className:`absolute inset-x-0 top-3 z-10 flex justify-center`,children:(0,V.jsxs)(`div`,{className:`flex items-center gap-2 rounded-full bg-rose-950/95 px-3 py-1 text-xs text-rose-100 shadow ring-1 ring-rose-400/30 backdrop-blur`,children:[(0,V.jsx)(`span`,{children:N.error}),(0,V.jsx)(q,{type:`button`,variant:`ghost`,size:`sm`,className:`h-6 px-2 text-xs text-rose-100 hover:bg-rose-900`,onClick:()=>M?.retry(),children:`Retry`})]})}),(0,V.jsxs)(`span`,{className:`sr-only`,"aria-live":`polite`,children:[N.phase===`ready`?N.controller?`Controlling terminal`:N.controlPending?`Taking control of terminal`:`Viewing terminal`:``,N.bellActive?` Bell from ${ae}`:``]})]}):i?(0,V.jsx)(`div`,{className:`grid min-h-0 place-items-center bg-[radial-gradient(circle_at_center,var(--color-zinc-900)_0,var(--color-zinc-950)_55%)] p-8`,children:(0,V.jsx)(`div`,{role:`status`,"aria-label":`Loading workspace`,children:(0,V.jsx)(bF,{className:`size-6 animate-spin fill-zinc-500`,"aria-hidden":`true`})})}):(0,V.jsx)(`div`,{className:`empty-state grid min-h-0 place-items-center bg-[radial-gradient(circle_at_center,var(--color-zinc-900)_0,var(--color-zinc-950)_55%)] p-8`,children:(0,V.jsxs)(`div`,{className:`grid max-w-lg gap-3`,children:[(0,V.jsx)(`p`,{className:`eyebrow`,children:`No terminal open`}),(0,V.jsx)(`h1`,{className:`text-balance text-2xl font-semibold tracking-tight text-zinc-50 sm:text-3xl`,children:e?`Start a terminal for this worktree.`:`Choose a worktree.`}),(0,V.jsx)(`p`,{className:`max-w-[52ch] text-base text-pretty text-zinc-400 sm:text-sm`,children:e?`Use the New terminal menu to start a login shell or preset.`:`Select a worktree from the sidebar to view its terminals.`})]})}),t&&(0,V.jsxs)(`div`,{className:`accessory-row hidden min-w-0 touch-pan-x overflow-x-auto overflow-y-hidden border-t border-white/8 bg-zinc-900 pt-1 pr-[env(safe-area-inset-right)] pb-[calc(0.25rem+env(safe-area-inset-bottom))] pl-[env(safe-area-inset-left)] max-[700px]:flex [&_button]:h-11 [&_button]:min-w-11 [&_button]:grow [&_button]:rounded-none [&_button]:border-r [&_button]:border-white/8 [&_button]:text-sm [&_button:last-child]:border-r-0`,"aria-label":`Terminal accessory keys`,onPointerDownCapture:()=>M?.requestControl(),children:[(0,V.jsx)(q,{variant:`ghost`,type:`button`,onClick:()=>re(`\x1B`),children:`Esc`}),(0,V.jsx)(q,{variant:`ghost`,type:`button`,className:x?`latched bg-cyan-950 text-cyan-100`:``,"aria-pressed":x,onClick:()=>{S(e=>!e),M?.focus()},children:`Ctrl`}),(0,V.jsx)(q,{variant:`ghost`,type:`button`,className:C?`latched bg-cyan-950 text-cyan-100`:``,"aria-pressed":C,onClick:()=>{w(e=>!e),M?.focus()},children:`Alt`}),(0,V.jsx)(q,{variant:`ghost`,type:`button`,onClick:L,children:`Paste`}),(0,V.jsx)(q,{variant:`ghost`,type:`button`,onClick:()=>re(` `),children:`Tab`}),(0,V.jsx)(q,{variant:`ghost`,type:`button`,onClick:()=>{M?.sendText(`\x1B[Z`),S(!1),w(!1)},children:`Shift+Tab`}),(0,V.jsx)(q,{variant:`ghost`,type:`button`,onClick:()=>re(`\r`),children:`Enter`}),(0,V.jsx)(q,{variant:`ghost`,type:`button`,"aria-label":`Arrow left`,onClick:()=>ie(`left`),children:`←`}),(0,V.jsx)(q,{variant:`ghost`,type:`button`,"aria-label":`Arrow up`,onClick:()=>ie(`up`),children:`↑`}),(0,V.jsx)(q,{variant:`ghost`,type:`button`,"aria-label":`Arrow down`,onClick:()=>ie(`down`),children:`↓`}),(0,V.jsx)(q,{variant:`ghost`,type:`button`,"aria-label":`Arrow right`,onClick:()=>ie(`right`),children:`→`})]})]})})}function BU({projects:e,selectedProject:t,selectedWorktree:n,selectedTerminal:r,loading:i,presets:a,presetsLoading:o,presetsError:s,dialogOpen:c,onSelectTerminal:l,onManagePresets:u}){let d=We(),{isMobile:f,openMobile:p,closeMobileWithoutFocusRestore:m}=BL(),{open:h}=yR(),g=_a(),_=fI(),v=(0,B.useRef)(new Set),y=(0,B.useRef)(0),b=(0,B.useRef)(null),x=(0,B.useRef)(g.pathname),[S,C]=(0,B.useState)([]),[w,T]=(0,B.useState)(null);x.current=g.pathname;let E=S.find(e=>e.id===w&&e.worktreeId===n?.id),D=r?.id??null,O=!!n?.prunable||n?.status!==`active`||t?.availability.state===`unavailable`,k=st({mutationFn:({worktreeId:e,name:t,argv:n,returnToShell:r,closeOnSuccess:i,initialSize:a})=>aC.createTerminal(e,t,n,r,i,a),onSuccess:async(t,{pendingTerminal:n})=>{let r=b.current===n.id&&x.current===n.originPath;C(e=>e.filter(e=>e.id!==n.id)),r&&(b.current=null,T(null));let i=e.find(e=>e.id===n.projectId),a=i?.worktrees.find(e=>e.id===n.worktreeId);if(!i||!a){await d.invalidateQueries({queryKey:oI});return}let o=n.originPath===sj(i.id,a.id).pathname;d.setQueryData(oI,e=>e?.map(e=>({...e,worktrees:e.worktrees.map(e=>e.id===a.id?{...e,terminals:[...e.terminals.filter(e=>e.id!==t.id),t]}:e)}))),r&&await _(cj(i.id,a.id,t.id),o),await d.invalidateQueries({queryKey:oI})},onError:async(e,{pendingTerminal:t})=>{C(e=>e.filter(e=>e.id!==t.id)),b.current===t.id&&(b.current=null,T(null)),nj(e),await d.invalidateQueries({queryKey:oI})}}),ee=st({mutationFn:({terminal:e})=>aC.deleteTerminal(e.id),onSuccess:async()=>{await d.invalidateQueries({queryKey:oI})},onError:(e,t)=>{d.setQueryData(oI,e=>e?.map(e=>({...e,worktrees:e.worktrees.map(e=>{if(e.id!==t.terminal.worktreeId||e.terminals.some(e=>e.id===t.terminal.id))return e;let n=[...e.terminals];return n.splice(t.index,0,t.terminal),{...e,terminals:n}})}))),nj(e)},onSettled:(e,t,n)=>{v.current.delete(n.terminal.id)}}),te=e=>{if(!t||!n||O)return;let i=r?VA.getInitialSize(r.id):null,a={id:`pending-terminal-${++y.current}`,projectId:t.id,worktreeId:n.id,name:e.name,originPath:g.pathname};b.current=a.id,C(e=>[...e,a]),T(a.id),m(),k.mutate({worktreeId:n.id,name:e.name,...e.argv?{argv:[...e.argv]}:{},...e.returnToShell?{returnToShell:!0}:{},...e.closeOnSuccess?{closeOnSuccess:!0}:{},...i?{initialSize:i}:{},pendingTerminal:a})},A=(t,n)=>{let r=e.find(e=>e.worktrees.some(e=>e.id===t.worktreeId)),i=r?.worktrees.find(e=>e.id===t.worktreeId),a=i?.terminals.filter(e=>e.id!==t.id&&!v.current.has(e.id));if(!r||!i||v.current.has(t.id)||!a?.length)return;let o=n?.title??VA.getTitleSnapshot().get(t.id)??t.name;if((n?.hasForegroundProcess??VA.getForegroundProcessSnapshot().has(t.id))&&!window.confirm(`Close terminal “${o}”? Its foreground process will be terminated.`))return;let s=i.terminals.findIndex(e=>e.id===t.id);if(v.current.add(t.id),d.cancelQueries({queryKey:oI}),D===t.id){let e=i.terminals.slice(s+1).find(e=>!v.current.has(e.id))??i.terminals.slice(0,s).reverse().find(e=>!v.current.has(e.id));e&&_(cj(r.id,i.id,e.id),!0)}VA.forget(t.id),d.setQueryData(oI,e=>e?.map(e=>({...e,worktrees:e.worktrees.map(e=>e.id===i.id?{...e,terminals:e.terminals.filter(e=>e.id!==t.id)}:e)}))),ee.mutate({terminal:t,index:s})};return(0,B.useEffect)(()=>{let e=window.treeportDesktop;if(e)return e.onCommand(e=>{e===`new-worktree`||c||h||f&&p||(e===`new-terminal`?te({name:`Shell`}):!E&&r&&A(r))})},[p,f,c,h,E,r,n,O]),(0,V.jsx)(zU,{worktree:n,terminal:E?null:r,pendingTerminals:S.filter(e=>e.worktreeId===n?.id),selectedPendingTerminalId:E?.id??null,loading:i,autoFocusBlocked:c||h||f&&p,presets:a,presetsLoading:o,presetsError:s,onSelectTerminal:e=>{b.current=null,T(null),l(e)},onSelectPendingTerminal:e=>{b.current=e,T(e)},onCreateTerminal:te,onManagePresets:u,mutationsDisabled:O,onCloseTerminal:A,onStatusChange:()=>void d.invalidateQueries({queryKey:oI})})}var VU=`treeport-initial-terminal-preset`;function HU({project:e,presets:t,presetsLoading:n,presetsError:r,onRetryPresets:i,busy:a,onSubmit:o}){let[s,c]=(0,B.useState)(``),[l,u]=(0,B.useState)(`default`),[d,f]=(0,B.useState)(()=>localStorage.getItem(VU)??`shell`),p=t.filter(e=>!e.closeOnSuccess),m=p.some(e=>e.id===d),h=d!==`shell`&&!m,g=h&&n,_=h&&!n&&!r,v=h&&!n?`shell`:d;(0,B.useEffect)(()=>{_&&localStorage.setItem(VU,`shell`)},[_]);let y=l==="default"?`default`:`current`;return(0,V.jsxs)(`form`,{className:`flex flex-col gap-5`,autoComplete:`off`,onSubmit:e=>{e.preventDefault();let t=s.trim();if(a||!t)return;let n=p.find(e=>e.id===v);o(t,y,n?{name:n.name,argv:[n.executable,...n.args],returnToShell:!0}:{name:`Shell`},y===`current`?l:void 0)},children:[(0,V.jsxs)(YF,{children:[(0,V.jsx)(ZF,{htmlFor:`worktree-name`,children:`Name`}),(0,V.jsx)(XF,{id:`worktree-name`,name:`worktree-name`,value:s,onChange:e=>c(e.target.value),placeholder:`feature-name`,"aria-label":`Worktree name`,autoCapitalize:`none`,spellCheck:!1,required:!0,autoFocus:!0,disabled:a})]}),(0,V.jsxs)(YF,{children:[(0,V.jsx)(ZF,{htmlFor:`worktree-base`,children:`Start from`}),(0,V.jsxs)(TR,{id:`worktree-base`,name:`worktree-base`,value:l,onChange:e=>u(e.target.value),disabled:a,children:[(0,V.jsxs)(`option`,{value:`default`,children:[e.defaultBranch,` · latest from origin`]}),e.worktrees.filter(e=>e.status===`active`).map(e=>(0,V.jsxs)(`option`,{value:e.id,children:[e.name,` · current commit`]},e.id))]})]}),(0,V.jsxs)(YF,{children:[(0,V.jsx)(ZF,{htmlFor:`initial-terminal-preset`,children:`Initial terminal`}),(0,V.jsxs)(TR,{id:`initial-terminal-preset`,name:`initial-terminal-preset`,value:v,onChange:e=>{f(e.target.value),localStorage.setItem(VU,e.target.value)},disabled:a,children:[g&&(0,V.jsx)(`option`,{value:d,children:`Loading saved preset…`}),(0,V.jsx)(`option`,{value:`shell`,children:`Shell`}),p.map(e=>(0,V.jsx)(`option`,{value:e.id,children:e.name},e.id))]}),_&&(0,V.jsx)(`p`,{className:`form-note`,role:`status`,children:`The selected preset cannot be used as an initial terminal. Initial terminal changed to Shell.`}),n&&(0,V.jsx)(`p`,{className:`form-note`,role:`status`,children:`Loading terminal presets…`}),r&&(0,V.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,V.jsx)(`p`,{className:`form-note`,children:`Presets could not be loaded. Shell is still available.`}),(0,V.jsx)(q,{type:`button`,variant:`secondary`,size:`sm`,onClick:i,children:`Retry`})]})]}),(0,V.jsxs)(`div`,{className:`flex items-center justify-between gap-4 pt-1`,children:[(0,V.jsx)(`p`,{className:`hidden text-xs text-zinc-600 sm:block`,children:`Press Enter to create`}),(0,V.jsx)(q,{type:`submit`,className:`ml-auto`,disabled:a||g||!s.trim(),children:a?`Creating…`:`Create worktree`})]})]})}function UU({project:e,onOpenChange:t,restoreFocusTo:n,presets:r,presetsLoading:i,presetsError:a,onRetryPresets:o,onSubmit:s}){let c=(0,B.useRef)(!1);return(0,V.jsx)(fF,{open:e!==null,onOpenChange:t,children:e?(0,V.jsxs)(hF,{className:`max-w-md`,restoreFocusTo:n,onCloseAutoFocus:e=>{c.current&&(c.current=!1,e.preventDefault())},children:[(0,V.jsxs)(gF,{children:[(0,V.jsx)(`p`,{className:`eyebrow`,children:e.name}),(0,V.jsx)(_F,{children:`Create worktree`}),(0,V.jsx)(vF,{className:`sr-only`,children:`Create a linked worktree and choose its starting point and initial terminal.`})]}),(0,V.jsx)(HU,{project:e,presets:r,presetsLoading:i,presetsError:a,onRetryPresets:o,busy:!1,onSubmit:(t,n,r,i)=>{c.current=!0,s(e,t,n,r,i)}})]}):null})}var WU=Object.defineProperty,GU=(e,t)=>WU(e,`name`,{value:t,configurable:!0}),[KU,qU]=Pj(`AlertDialog`,[TP]),JU=TP(),YU=GU(e=>{let{__scopeAlertDialog:t,...n}=e,r=JU(t);return(0,V.jsx)(OP,{...r,...n,modal:!0})},`AlertDialog`);B.forwardRef(GU(function(e,t){let{__scopeAlertDialog:n,...r}=e,i=JU(n);return(0,V.jsx)(AP,{...i,...r,ref:t})},`AlertDialogTrigger`));var XU=GU(e=>{let{__scopeAlertDialog:t,...n}=e,r=JU(t);return(0,V.jsx)(PP,{...r,...n})},`AlertDialogPortal`),ZU=B.forwardRef(GU(function(e,t){let{__scopeAlertDialog:n,...r}=e,i=JU(n);return(0,V.jsx)(IP,{...i,...r,ref:t})},`AlertDialogOverlay`)),[QU,$U]=KU(`AlertDialogContent`),eW=B.forwardRef(GU(function(e,t){let{__scopeAlertDialog:n,children:r,...i}=e,a=JU(n),o=df(t,B.useRef(null)),s=B.useRef(null);return(0,V.jsx)(QU,{scope:n,cancelRef:s,children:(0,V.jsx)(BP,{role:`alertdialog`,...a,...i,ref:o,onOpenAutoFocus:Ej(i.onOpenAutoFocus,e=>{e.preventDefault(),s.current?.focus({preventScroll:!0})}),onPointerDownOutside:e=>e.preventDefault(),onInteractOutside:e=>e.preventDefault(),children:r})})},`AlertDialogContent`)),tW=B.forwardRef(GU(function(e,t){let{__scopeAlertDialog:n,...r}=e,i=JU(n);return(0,V.jsx)(GP,{...i,...r,ref:t})},`AlertDialogTitle`)),nW=B.forwardRef(GU(function(e,t){let{__scopeAlertDialog:n,...r}=e,i=JU(n);return(0,V.jsx)(qP,{...i,...r,ref:t})},`AlertDialogDescription`)),rW=B.forwardRef(GU(function(e,t){let{__scopeAlertDialog:n,...r}=e,i=JU(n);return(0,V.jsx)(YP,{...i,...r,ref:t})},`AlertDialogAction`)),iW=`AlertDialogCancel`,aW=B.forwardRef(GU(function(e,t){let{__scopeAlertDialog:n,...r}=e,{cancelRef:i}=$U(iW,n),a=JU(n),o=df(t,i);return(0,V.jsx)(YP,{...a,...r,ref:o})},`AlertDialogCancel`)),oW=YU,sW=XU,cW=ZU,lW=eW,uW=rW,dW=aW,fW=tW,pW=nW,mW=oW,hW=sW,gW=B.forwardRef(({className:e,...t},n)=>(0,V.jsx)(cW,{ref:n,className:K(`fixed inset-0 z-50 bg-black/70 backdrop-blur-sm`,e),...t}));gW.displayName=cW.displayName;var _W=B.forwardRef(({className:e,restoreFocusTo:t,onCloseAutoFocus:n,...r},i)=>(0,V.jsxs)(hW,{children:[(0,V.jsx)(gW,{}),(0,V.jsx)(lW,{ref:i,className:K(`fixed top-1/2 left-1/2 z-50 grid max-h-[calc(100dvh-2rem)] w-[calc(100%-2rem)] max-w-lg -translate-x-1/2 -translate-y-1/2 gap-4 overflow-y-auto rounded-xl bg-zinc-900 p-6 text-zinc-200 shadow-2xl ring-1 ring-white/10 outline-none max-[700px]:top-auto max-[700px]:bottom-0 max-[700px]:left-0 max-[700px]:max-h-[90dvh] max-[700px]:w-full max-[700px]:max-w-none max-[700px]:translate-x-0 max-[700px]:translate-y-0 max-[700px]:rounded-b-none max-[700px]:p-5 max-[700px]:pb-[calc(1.25rem+env(safe-area-inset-bottom))]`,e),onCloseAutoFocus:e=>{n?.(e),!e.defaultPrevented&&t?.isConnected&&(e.preventDefault(),t.focus())},...r})]}));_W.displayName=lW.displayName;function vW({className:e,...t}){return(0,V.jsx)(`div`,{className:K(`flex flex-col gap-1.5 text-left`,e),...t})}function yW({className:e,...t}){return(0,V.jsx)(`div`,{className:K(`flex flex-col-reverse gap-2 sm:flex-row sm:justify-end`,e),...t})}var bW=B.forwardRef(({className:e,...t},n)=>(0,V.jsx)(fW,{ref:n,className:K(`text-balance text-xl font-semibold tracking-tight text-zinc-50 sm:text-2xl`,e),...t}));bW.displayName=fW.displayName;var xW=B.forwardRef(({className:e,...t},n)=>(0,V.jsx)(pW,{ref:n,className:K(`text-base text-pretty text-zinc-400 sm:text-sm`,e),...t}));xW.displayName=pW.displayName;var SW=B.forwardRef(({className:e,...t},n)=>(0,V.jsx)(uW,{ref:n,className:K(jf(),e),...t}));SW.displayName=uW.displayName;var CW=B.forwardRef(({className:e,...t},n)=>(0,V.jsx)(dW,{ref:n,className:K(jf({variant:`outline`}),e),...t}));CW.displayName=dW.displayName;function wW({worktree:e,preview:t,busy:n,onOpenChange:r,restoreFocusTo:i,onConfirm:a}){let o=!!t?.warnings.length,s=t?.name??e?.name,c=t?.branch??e?.branch,l=t?.detached??e?.detached,u=t?.head??e?.head,d=t?.path??e?.path;return(0,V.jsx)(mW,{open:e!==null,onOpenChange:r,children:e&&t?(0,V.jsxs)(_W,{restoreFocusTo:i,children:[(0,V.jsxs)(vW,{children:[(0,V.jsx)(`p`,{className:`eyebrow`,children:o?`Destructive removal`:`Worktree`}),(0,V.jsx)(bW,{children:`Remove worktree`}),(0,V.jsx)(xW,{children:`Review what will be removed before continuing.`})]}),(0,V.jsxs)(`dl`,{className:`facts`,children:[(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`dt`,{children:`Name`}),(0,V.jsx)(`dd`,{children:s})]}),(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`dt`,{children:`Git state`}),(0,V.jsx)(`dd`,{children:!l&&c?`Branch ${c} (preserved)`:`Detached at ${u?.slice(0,8)}`})]}),(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`dt`,{children:`Path`}),(0,V.jsx)(`dd`,{children:d})]}),(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`dt`,{children:`Uncommitted`}),(0,V.jsx)(`dd`,{children:`${t.dirty.total} (${t.dirty.staged} staged, ${t.dirty.unstaged} unstaged, ${t.dirty.untracked} untracked, ${t.dirty.conflicts} conflicted)`})]}),(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`dt`,{children:`Terminals stopped`}),(0,V.jsx)(`dd`,{children:t.terminals.map(e=>e.name).join(`, `)||`none`})]})]}),t.reasons.length>0?(0,V.jsxs)(`div`,{className:`warning`,children:[(0,V.jsx)(`strong`,{children:`Removal refused`}),(0,V.jsx)(`ul`,{role:`list`,children:t.reasons.map(e=>(0,V.jsx)(`li`,{children:e},e))})]}):null,t.warnings.length>0?(0,V.jsxs)(`div`,{className:`warning danger`,children:[(0,V.jsx)(`strong`,{children:`Local work may be lost.`}),(0,V.jsx)(`ul`,{role:`list`,children:t.warnings.map(e=>(0,V.jsx)(`li`,{children:e},e))})]}):null,(0,V.jsxs)(yW,{children:[(0,V.jsx)(CW,{children:`Cancel`}),(0,V.jsx)(SW,{asChild:!0,children:(0,V.jsx)(q,{type:`button`,variant:`destructive`,disabled:n||!t.eligible,onClick:n=>{n.preventDefault(),a(e,t)},children:n?`Removing…`:o?`Remove anyway`:`Remove worktree`})})]})]}):null})}var TW=`Manual cleanup required:`;function EW(e){return!!e.cleanupError?.startsWith(TW)}function DW({setDrawerOpen:e,onWorktreeSubmitted:t,onRemovalNeedsConfirmation:n,onRemovalCompleted:r,selectedTerminalId:i}){let a=We(),o=_a(),s=fI(),[c,l]=(0,B.useState)([]),[u,d]=(0,B.useState)({}),f=(0,B.useRef)(new Set),p=st({mutationFn:e=>aC.createWorktree(e.projectId,e.typedName,e.base,e.initialTerminal,e.sourceWorktreeId),onSuccess:async(t,n)=>{await a.cancelQueries({queryKey:oI});let r=t.terminal&&!t.worktree.terminals.some(e=>e.id===t.terminal?.id)?{...t.worktree,terminals:[...t.worktree.terminals,t.terminal]}:t.worktree,i=o.pathname===oj(n.projectId).pathname;l(e=>e.filter(e=>e.id!==n.id)),a.setQueryData(oI,e=>e?.map(e=>e.id===n.projectId?{...e,worktrees:[...e.worktrees.filter(e=>e.id!==r.id),r]}:e));let c=t.terminal?cj(n.projectId,r.id,t.terminal.id):sj(n.projectId,r.id);await s(c,i),e(!1),t.setupError?nj(`Worktree created, but setup could not start: ${t.setupError}`):t.terminalError&&nj(`Worktree created, but its terminal could not start: ${t.terminalError}`),await a.invalidateQueries({queryKey:oI})},onError:(t,n)=>{l(e=>e.filter(e=>e.id!==n.id)),e(!1),nj(t)}}),m=(e,n,r,a,o)=>{let s=i?VA.getInitialSize(i):null,c={id:crypto.randomUUID(),projectId:e.id,typedName:n,base:r,initialTerminal:{name:a.name,...a.argv?{argv:[...a.argv]}:{},...a.returnToShell?{returnToShell:!0}:{},...s?{initialSize:s}:{}},...o?{sourceWorktreeId:o}:{}};l(e=>[...e,c]),t(),window.requestAnimationFrame(()=>{document.getElementById(`pending-worktree-${c.id}`)?.focus()}),p.mutate(c)},h=(e,t)=>d(n=>({...n,[e]:t})),g=e=>{f.current.delete(e),d(t=>{if(!(e in t))return t;let n={...t};return delete n[e],n})},_=e=>a.setQueryData(oI,t=>t?.map(t=>({...t,worktrees:t.worktrees.map(t=>t.id===e?{...t,status:`cleaning`,cleanupError:null}:t)}))),v=async(e,t,i,o)=>{h(e.id,`removing`);try{await aC.removeWorktree(e.id,t,i),_(e.id),g(e.id),r(e.id),a.invalidateQueries({queryKey:oI},{cancelRefetch:!1})}catch(t){if(t instanceof rC&&t.code===`REMOVE_PREVIEW_STALE`&&o>0){h(e.id,`checking`);try{let t=await aC.removePreview(e.id);if(t.eligible&&t.warnings.length===0){await v(e,t,!1,o-1);return}g(e.id),n(e,t);return}catch(t){g(e.id),nj(t);return}}g(e.id),nj(t instanceof rC&&t.code===`REMOVE_PREVIEW_STALE`?Error(`The worktree kept changing during removal. Review it and try again.`):t)}};return{pendingWorktrees:c,pendingRemovals:u,submitWorktreeCreation:m,prepareRemoval:async(e,t)=>{if(!(f.current.has(e.id)||e.status===`cleaning`||EW(e))){f.current.add(e.id),h(e.id,`checking`);try{let r=await aC.removePreview(e.id);if(r.eligible&&r.warnings.length===0){await v(e,r,!1,1);return}g(e.id),n(e,r,t)}catch(t){g(e.id),nj(t)}}},confirmRemoval:(e,t)=>{f.current.has(e.id)||(f.current.add(e.id),v(e,t,t.warnings.length>0,1))}}}function OW(e){let t=We(),[n,r]=(0,B.useState)(!1);return(0,B.useEffect)(()=>{let e=nC(`/events`,{path:Wk,transports:[`websocket`],autoConnect:!1,retries:0}),n=aI(()=>t.invalidateQueries({queryKey:oI},{cancelRefetch:!1})),i=aI(()=>Promise.all([t.invalidateQueries({queryKey:oI},{cancelRefetch:!1}),t.invalidateQueries({queryKey:sI},{cancelRefetch:!1})])),a=()=>n.schedule(),o=()=>i.schedule(),s=e=>{let t=mA(e);if(!t){r(!0);return}VA.replaceRuntimeMetadata(t.terminalMetadata),r(!1),a()},c=e=>{let t=hA(e);if(t){if(t.type===`terminal.metadata`){let e=eA(t.data);e&&VA.applyRuntimeMetadata(e);return}if(t.type===`project.updated`||t.type===`project.removed`){o();return}t.type!==`terminal.controller_changed`&&a()}},l=()=>r(!0);return e.on(`snapshot`,s),e.on(`product_event`,c),e.on(`disconnect`,l),e.on(`connect_error`,l),e.connect(),()=>{n.dispose(),i.dispose(),e.disconnect()}},[t]),(0,B.useEffect)(()=>{e&&VA.reconcile(e.flatMap(e=>e.worktrees.flatMap(e=>e.terminals)))},[e]),n}function kW(){return(0,V.jsx)(bR,{children:(0,V.jsx)(AW,{})})}function AW(){let e=window.treeportDesktop,t=fI(),n=_a(),r=at(lI),i=r.data??[],a=at(dI),o=a.data??[],s=localStorage.getItem(rj),c=r.data?yj(i,n.pathname,s):null,l=c?.selection.project??null,u=c?.selection.worktree??null,d=c?.selection.terminal??null,f=d?.id??null,p=l,{isMobile:m,openMobile:h,setOpenMobile:g,closeMobileWithoutFocusRestore:_}=BL(),v=yR(),y=v.open,[b,x]=(0,B.useState)(null),S=OW(r.data),[C,w]=(0,B.useState)(!1),T=(0,B.useRef)(null),E=(e,t)=>{T.current=t??document.activeElement,x(e)};(0,B.useEffect)(()=>{!c||c.canonical||t(c.target,!0)},[t,c?.canonical,c?.target.pathname]),(0,B.useEffect)(()=>{c?.canonical&&(c.target.kind===`root`?localStorage.removeItem(rj):localStorage.setItem(rj,c.target.pathname),c.target.kind===`terminal`&&localStorage.setItem(`${ij}${c.target.projectId}`,c.target.terminalId))},[c?.canonical,c?.target.pathname]),(0,B.useEffect)(()=>{if(!(r.data!==void 0&&(S||r.isRefetchError))){w(!1);return}let e=window.setTimeout(()=>w(!0),nI);return()=>window.clearTimeout(e)},[S,r.data,r.isRefetchError]),(0,B.useEffect)(()=>{if(e)return e.onCommand(e=>{e!==`new-worktree`||!p||p.availability.state===`unavailable`||b||y||m&&h||E({type:`worktree`,project:p})})},[p,h,m,b,y]);let D=(0,B.useMemo)(()=>p?.worktrees.flatMap(e=>e.terminals)??[],[p]),O=e=>{let n=fj(i,e);n&&t(n),_()},k=e=>{let n=pj(i,e,f);n&&t(n),_()},ee=e=>uj(e,localStorage.getItem(`${ij}${e.id}`)),te=e=>{t(ee(e)),v.setOpen(!1),_()},{closingProjectId:A,requestProjectClose:j,projectOpened:M}=pI({projects:i,selectedProject:l,targetForProject:ee,projectSwitcherTriggerRef:v.triggerRef,closeProjectUi:()=>v.setOpen(!1),openedProjectUi:()=>{v.setOpen(!1),_(),x(null)}}),{pendingWorktrees:N,pendingRemovals:P,submitWorktreeCreation:F,prepareRemoval:ne,confirmRemoval:re}=DW({setDrawerOpen:e=>{e?g(!0):_()},onWorktreeSubmitted:()=>x(null),onRemovalNeedsConfirmation:(e,t,n)=>E({type:`remove`,worktree:e,preview:t},n),onRemovalCompleted:e=>x(t=>t?.type===`remove`&&t.worktree.id===e?null:t),selectedTerminalId:f});return(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(Sj,{projects:i,projectsLoaded:r.data!==void 0,selectedTerminalId:f,navigateToWorkspace:t}),(0,V.jsx)(CR,{blocked:b!==null}),(0,V.jsx)(DR,{selectedTerminalId:f,terminals:D,onSelectTerminal:O}),(0,V.jsx)(ER,{projectSwitcher:(0,V.jsx)(wR,{projects:i,activeProject:p,closingProjectId:A,onSelectProject:te,onProjectOpened:M,onRequestProjectClose:j,onOpenProjectDialog:e=>E({type:`project`},e)}),children:(0,V.jsx)(jR,{projects:i,projectsPending:r.isPending,projectsError:r.isError,projectsLoaded:r.data!==void 0,activeProject:p,selectedWorktree:u,selectedTerminalId:f,pendingWorktrees:N,pendingRemovals:P,onRetryProjects:()=>void r.refetch(),onSelectTerminal:O,onSelectWorktree:k,onPrepareRemoval:ne,onOpenWorktreeDialog:(e,t)=>E({type:`worktree`,project:e},t)})}),(0,V.jsx)(xR,{children:(0,V.jsx)(BU,{projects:i,selectedProject:l,selectedWorktree:u,selectedTerminal:d,loading:r.isPending,presets:o,presetsLoading:a.isPending,presetsError:a.isError,dialogOpen:b!==null,onSelectTerminal:O,onManagePresets:e=>E({type:`presets`},e??void 0)})}),C?(0,V.jsx)(`div`,{className:`fixed right-4 bottom-4 z-70 flex max-w-[min(30rem,calc(100vw-2rem))] items-center gap-3 rounded-lg bg-zinc-800 p-3 text-sm text-zinc-300 shadow-2xl ring-1 ring-white/10`,role:`status`,inert:m&&h?!0:void 0,"aria-hidden":m&&h?!0:void 0,children:(0,V.jsx)(`span`,{children:`Updates paused; showing the last known project state.`})}):null,(0,V.jsx)($F,{open:b?.type===`project`,onOpenChange:e=>!e&&x(null),restoreFocusTo:T.current,onOpened:M}),(0,V.jsx)(UU,{project:b?.type===`worktree`?b.project:null,onOpenChange:e=>!e&&x(null),restoreFocusTo:T.current,presets:o,presetsLoading:a.isPending,presetsError:a.isError,onRetryPresets:()=>void a.refetch(),onSubmit:F}),(0,V.jsx)(rz,{open:b?.type===`presets`,onOpenChange:e=>!e&&x(null),restoreFocusTo:T.current,presets:o,loading:a.isPending,loadError:a.isError,onRetry:()=>void a.refetch()}),(0,V.jsx)(wW,{worktree:b?.type===`remove`?b.worktree:null,preview:b?.type===`remove`?b.preview:null,busy:b?.type===`remove`&&P[b.worktree.id]!==void 0,onOpenChange:e=>!e&&x(null),restoreFocusTo:T.current,onConfirm:re})]})}function jW({reset:e}){return(0,V.jsx)(`main`,{className:`grid min-h-dvh place-items-center bg-zinc-950 p-6 text-zinc-100`,"aria-labelledby":`app-error-title`,children:(0,V.jsxs)(`section`,{className:`w-full max-w-lg rounded-xl bg-zinc-900 p-6 shadow-2xl ring-1 ring-white/10`,role:`alert`,children:[(0,V.jsx)(`p`,{className:`text-sm font-medium text-rose-300`,children:`Unexpected error`}),(0,V.jsx)(`h1`,{id:`app-error-title`,className:`mt-2 text-xl font-semibold`,children:`Treeport couldn’t display this workspace`}),(0,V.jsx)(`p`,{className:`mt-3 text-sm text-zinc-400`,children:`Try recovering the interface. If the problem continues, reload Treeport; your persistent terminal sessions will keep running.`}),(0,V.jsxs)(`div`,{className:`mt-6 flex flex-wrap gap-3`,children:[(0,V.jsx)(q,{type:`button`,onClick:e,children:`Try again`}),(0,V.jsx)(q,{type:`button`,variant:`secondary`,onClick:()=>window.location.reload(),children:`Reload Treeport`})]})]})})}var MW=Zi({component:kW,errorComponent:jW,onCatch:e=>console.error(`Unexpected application crash`,e)}),NW=Yi({getParentRoute:()=>MW,path:`/`}),PW=Yi({getParentRoute:()=>MW,path:`projects/$projectId`}),FW=Yi({getParentRoute:()=>PW,path:`worktrees/$worktreeId`}),IW=Yi({getParentRoute:()=>FW,path:`terminals/$terminalId`}),LW=pa({routeTree:MW.addChildren([NW,PW.addChildren([FW.addChildren([IW])])]),defaultPreload:!1,scrollRestoration:!1}),RW=/iPad|iPhone|iPod/.test(navigator.userAgent)||navigator.platform===`MacIntel`&&navigator.maxTouchPoints>1,zW=document.querySelector(`meta[name="viewport"]`);RW&&zW&&!zW.content.includes(`maximum-scale`)&&(zW.content=`${zW.content}, maximum-scale=1`);var BW=new Be({defaultOptions:{queries:{retry:!1},mutations:{retry:!1}}});(0,va.createRoot)(document.getElementById(`root`)).render((0,V.jsx)(B.StrictMode,{children:(0,V.jsx)(Ge,{client:BW,children:(0,V.jsx)(Zd,{children:(0,V.jsxs)(rf,{children:[(0,V.jsx)(ga,{router:LW}),(0,V.jsx)(Ya,{})]})})})}));