@treeport/treeport 0.6.1 → 0.8.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/dist-BsLn2Gbc.js +1630 -0
- package/dist/node/cli/index.js +172 -125
- package/dist/node/server/core/launcher.js +11 -49
- package/dist/node/server/index.js +9125 -7162
- package/dist/node/server/terminal-host-entry.js +979 -0
- package/dist/{shell-integration-Be_c91lw.js → shell-integration-CPmrVa3B.js} +46 -46
- package/dist/terminal-host-protocol-DZkQRAUF.js +378 -0
- package/dist/{update-qVp7yL5D.js → update-BYHlwpAq.js} +568 -147
- package/dist/web/assets/index-BWYDUD7N.css +2 -0
- package/dist/web/assets/index-BtAAdn1A.js +84 -0
- package/dist/web/index.html +2 -2
- package/drizzle/0012_terminal_host_cutover.sql +41 -0
- package/drizzle/0013_workspace_item_order.sql +13 -0
- package/drizzle/meta/0012_snapshot.json +919 -0
- package/drizzle/meta/0013_snapshot.json +987 -0
- package/drizzle/meta/_journal.json +14 -0
- package/package.json +19 -13
- package/skills/treeport/SKILL.md +4 -4
- package/dist/dist-Crk_Xr82.js +0 -735
- package/dist/web/assets/index-2LLiNn3-.js +0 -146
- package/dist/web/assets/index-DmDs47YU.css +0 -2
|
@@ -1,146 +0,0 @@
|
|
|
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 A=/\/+/g;function j(e,t){return typeof e==`object`&&e&&e.key!=null?k(``+e.key):t.toString(36)}function M(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 N(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,N(c(e._payload),r,i,a,o)}}if(c)return o=o(e),c=a===``?`.`+j(e,0):a,S(o)?(i=``,c!=null&&(i=c.replace(A,`$&/`)+`/`),N(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(A,`$&/`)+`/`)+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+j(a,u),c+=N(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+j(a,u++),c+=N(a,r,i,s,o);else if(s===`object`){if(typeof e.then==`function`)return N(M(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 P(e,t,n){if(e==null)return e;var r=[],i=0;return N(e,r,``,``,function(e){return t.call(n,e,i++)}),r}function ee(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 F=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)},I={map:P,forEach:function(e,t,n){P(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return P(e,function(){t++}),t},toArray:function(e){return P(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=I,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:ee}},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,F)}catch(e){F(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&&j(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&&j(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,A=k.port2;k.port1.onmessage=D,O=function(){A.postMessage(null)}}else O=function(){_(D,0)};function j(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,j(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`),A=Symbol.for(`react.memo_cache_sentinel`),j=Symbol.iterator;function M(e){return typeof e!=`object`||!e?null:(e=j&&e[j]||e[`@@iterator`],typeof e==`function`?e:null)}var N=Symbol.for(`react.client.reference`);function P(e){if(e==null)return null;if(typeof e==`function`)return e.$$typeof===N?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?P(e.type)||`Memo`:t;case O:t=e._payload,e=e._init;try{return P(e(t))}catch{}}return null}var ee=Array.isArray,F=n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,I=r.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,te={pending:!1,data:null,method:null,action:null},L=[],ne=-1;function R(e){return{current:e}}function re(e){0>ne||(e.current=L[ne],L[ne]=null,ne--)}function z(e,t){ne++,L[ne]=e.current,e.current=t}var ie=R(null),ae=R(null),oe=R(null),se=R(null);function ce(e,t){switch(z(oe,t),z(ae,e),z(ie,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?Zd(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=Zd(t),e=Qd(t,e);else switch(e){case`svg`:e=1;break;case`math`:e=2;break;default:e=0}}re(ie),z(ie,e)}function le(){re(ie),re(ae),re(oe)}function ue(e){e.memoizedState!==null&&z(se,e);var t=ie.current,n=Qd(t,e.type);t!==n&&(z(ae,e),z(ie,n))}function de(e){ae.current===e&&(re(ie),re(ae)),se.current===e&&(re(se),op._currentValue=te)}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 Ue(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 We(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=Ue(n))):i=Ue(o):i=Ue(s)):(r=s&~a,r===0?(o&=s,o===0?n||(n=s&~e,n!==0&&(i=Ue(n))):i=Ue(o)):i=Ue(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 Ge(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function B(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 V(){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=I.p;return e===0?(e=window.event,e===void 0?32:xp(e.type)):e}function tt(e,t){var n=I.p;try{return I.p=e,t()}finally{I.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=bf(e);e!==null;){if(n=e[rt])return n;e=bf(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(ee(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)&&(ku(),$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=U(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){H(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=U(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<bu)throw bu=0,xu=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=Zf(e,n,ie.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`:kd(`cancel`,t),kd(`close`,t);break;case`iframe`:case`object`:case`embed`:kd(`load`,t);break;case`video`:case`audio`:for(n=0;n<Dd.length;n++)kd(Dd[n],t);break;case`source`:kd(`error`,t);break;case`img`:case`image`:case`link`:kd(`error`,t),kd(`load`,t);break;case`details`:kd(`toggle`,t);break;case`input`:kd(`invalid`,t),Lt(t,r.value,r.defaultValue,r.checked,r.defaultChecked,r.type,r.name,!0);break;case`select`:kd(`invalid`,t);break;case`textarea`:kd(`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||Vd(t.textContent,n)?(r.popover!=null&&(kd(`beforetoggle`,t),kd(`toggle`,t)),r.onScroll!=null&&kd(`scroll`,t),r.onScrollEnd!=null&&kd(`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`)||$d(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=yf(e)}else if(t===31){if(e=e.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(i(317));ji=yf(e)}else t===27?(t=ji,sf(e.type)?(e=vf,vf=null,ji=e):ji=t):ji=Ai?_f(e.stateNode.nextSibling):null;return!0}function Bi(){ji=Ai=null,Mi=!1}function Vi(){var e=Ni;return e!==null&&(ou===null?ou=e:ou.push.apply(ou,e),Ni=null),e}function Hi(e){Ni===null?Ni=[e]:Ni.push(e)}var Ui=R(null),Wi=null,Gi=null;function Ki(e,t,n){z(Ui,t._currentValue),t._currentValue=n}function qi(e){e._currentValue=Ui.current,re(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=[op]:e.push(op))}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=xd(),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=F.S;F.S=function(e,t){lu=we(),typeof t==`object`&&t&&typeof t.then==`function`&&fa(e,t),ha!==null&&ha(e,t)};var ga=R(null);function _a(){var e=ga.current;return e===null?Wl.pooledCache:e}function va(e,t){t===null?z(ga,ga.current):z(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=Wl,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(ee(t)||M(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(ee(n)||M(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(ee(r)||M(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(ee(o))return h(e,r,o,c);if(M(o)){if(l=M(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,Ul&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?(Kl&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),eu|=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=R(null),Za=R(0);function Qa(e,t){e=Ql,z(Za,e),z(Xa,t),Ql=e|t.baseLanes}function $a(){z(Za,Ql),z(Xa,Xa.current)}function eo(){Ql=Za.current,re(Xa),re(Za)}var to=R(null),no=null;function ro(e){var t=e.alternate;z(co,co.current&1),z(to,e),no===null&&(t===null||Xa.current!==null||t.memoizedState!==null)&&(no=e)}function io(e){z(co,co.current),z(to,e),no===null&&(no=e)}function ao(e){e.tag===22?(z(co,co.current),z(to,e),no===null&&(no=e)):oo(e)}function oo(){z(co,co.current),z(to,to.current)}function so(e){re(to),no===e&&(no=null),re(co)}var co=R(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||mf(n)||hf(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,fo=null,po=null,mo=null,ho=!1,go=!1,_o=!1,vo=0,yo=0,bo=null,xo=0;function So(){throw Error(i(321))}function Co(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 wo(e,t,n,r,i,a){return uo=a,fo=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,F.H=e===null||e.memoizedState===null?Vs:Hs,_o=!1,a=n(r,i),_o=!1,go&&(a=Eo(t,n,r,i)),To(e),a}function To(e){F.H=Bs;var t=po!==null&&po.next!==null;if(uo=0,mo=po=fo=null,ho=!1,yo=0,bo=null,t)throw Error(i(300));e===null||ac||(e=e.dependencies,e!==null&&Zi(e)&&(ac=!0))}function Eo(e,t,n,r){fo=e;var a=0;do{if(go&&(bo=null),yo=0,go=!1,25<=a)throw Error(i(301));if(a+=1,mo=po=null,e.updateQueue!=null){var o=e.updateQueue;o.lastEffect=null,o.events=null,o.stores=null,o.memoCache!=null&&(o.memoCache.index=0)}F.H=Us,o=t(n,r)}while(go);return o}function Do(){var e=F.H,t=e.useState()[0];return t=typeof t.then==`function`?Po(t):t,e=e.useState()[0],(po===null?null:po.memoizedState)!==e&&(fo.flags|=1024),t}function Oo(){var e=vo!==0;return vo=0,e}function ko(e,t,n){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~n}function Ao(e){if(ho){for(e=e.memoizedState;e!==null;){var t=e.queue;t!==null&&(t.pending=null),e=e.next}ho=!1}uo=0,mo=po=fo=null,go=!1,yo=vo=0,bo=null}function jo(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return mo===null?fo.memoizedState=mo=e:mo=mo.next=e,mo}function Mo(){if(po===null){var e=fo.alternate;e=e===null?null:e.memoizedState}else e=po.next;var t=mo===null?fo.memoizedState:mo.next;if(t!==null)mo=t,po=e;else{if(e===null)throw fo.alternate===null?Error(i(467)):Error(i(310));po=e,e={memoizedState:po.memoizedState,baseState:po.baseState,baseQueue:po.baseQueue,queue:po.queue,next:null},mo===null?fo.memoizedState=mo=e:mo=mo.next=e}return mo}function No(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Po(e){var t=yo;return yo+=1,bo===null&&(bo=[]),e=Ta(bo,e,t),t=fo,(mo===null?t.memoizedState:mo.next)===null&&(t=t.alternate,F.H=t===null||t.memoizedState===null?Vs:Hs),e}function Fo(e){if(typeof e==`object`&&e){if(typeof e.then==`function`)return Po(e);if(e.$$typeof===C)return $i(e)}throw Error(i(438,String(e)))}function Io(e){var t=null,n=fo.updateQueue;if(n!==null&&(t=n.memoCache),t==null){var r=fo.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=No(),fo.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]=A;return t.index++,n}function Lo(e,t){return typeof t==`function`?t(e):t}function Ro(e){return zo(Mo(),po,e)}function zo(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:(Kl&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,fo.lanes|=p,eu|=p;f=u.action,_o&&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,fo.lanes|=f,eu|=f;u=u.next}while(u!==null&&u!==t);if(l===null?s=o:l.next=c,!yr(o,e.memoizedState)&&(ac=!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 Bo(e){var t=Mo(),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)||(ac=!0),t.memoizedState=o,t.baseQueue===null&&(t.baseState=o),n.lastRenderedState=o}return[o,r]}function Vo(e,t,n){var r=fo,a=Mo(),o=Mi;if(o){if(n===void 0)throw Error(i(407));n=n()}else n=t();var s=!yr((po||a).memoizedState,n);if(s&&(a.memoizedState=n,ac=!0),a=a.queue,fs(Wo.bind(null,r,a,e),[e]),a.getSnapshot!==t||s||mo!==null&&mo.memoizedState.tag&1){if(r.flags|=2048,ss(9,{destroy:void 0},Uo.bind(null,r,a,n,t),null),Wl===null)throw Error(i(349));o||uo&127||Ho(r,t,n)}return n}function Ho(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=fo.updateQueue,t===null?(t=No(),fo.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function Uo(e,t,n,r){t.value=n,t.getSnapshot=r,Go(t)&&Ko(e)}function Wo(e,t,n){return n(function(){Go(t)&&Ko(e)})}function Go(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!yr(e,n)}catch{return!0}}function Ko(e){var t=ei(e,2);t!==null&&wu(t,e,2)}function qo(e){var t=jo();if(typeof e==`function`){var n=e;if(e=n(),_o){Fe(!0);try{n()}finally{Fe(!1)}}}return t.memoizedState=t.baseState=e,t.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Lo,lastRenderedState:e},t}function Jo(e,t,n,r){return e.baseState=n,zo(e,po,typeof r==`function`?r:Lo)}function Yo(e,t,n,r,a){if(Ls(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)}};F.T===null?o.isTransition=!1:n(!0),r(o),n=t.pending,n===null?(o.next=t.pending=o,Xo(t,o)):(o.next=n.next,t.pending=n.next=o)}}function Xo(e,t){var n=t.action,r=t.payload,i=e.state;if(t.isTransition){var a=F.T,o={};F.T=o;try{var s=n(i,r),c=F.S;c!==null&&c(o,s),Zo(e,t,s)}catch(n){$o(e,t,n)}finally{a!==null&&o.types!==null&&(a.types=o.types),F.T=a}}else try{a=n(i,r),Zo(e,t,a)}catch(n){$o(e,t,n)}}function Zo(e,t,n){typeof n==`object`&&n&&typeof n.then==`function`?n.then(function(n){Qo(e,t,n)},function(n){return $o(e,t,n)}):Qo(e,t,n)}function Qo(e,t,n){t.status=`fulfilled`,t.value=n,es(t),e.state=n,t=e.pending,t!==null&&(n=t.next,n===t?e.pending=null:(n=n.next,t.next=n,Xo(e,n)))}function $o(e,t,n){var r=e.pending;if(e.pending=null,r!==null){r=r.next;do t.status=`rejected`,t.reason=n,es(t),t=t.next;while(t!==r)}e.action=null}function es(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function ts(e,t){return t}function ns(e,t){if(Mi){var n=Wl.formState;if(n!==null){a:{var r=fo;if(Mi){if(ji){b:{for(var i=ji,a=Pi;i.nodeType!==8;){if(!a){i=null;break b}if(i=_f(i.nextSibling),i===null){i=null;break b}}a=i.data,i=a===`F!`||a===`F`?i:null}if(i){ji=_f(i.nextSibling),r=i.data===`F!`;break a}}Ii(r)}r=!1}r&&(t=n[0])}}return n=jo(),n.memoizedState=n.baseState=t,r={pending:null,lanes:0,dispatch:null,lastRenderedReducer:ts,lastRenderedState:t},n.queue=r,n=Ps.bind(null,fo,r),r.dispatch=n,r=qo(!1),a=Is.bind(null,fo,!1,r.queue),r=jo(),i={state:t,dispatch:null,action:e,pending:null},r.queue=i,n=Yo.bind(null,fo,i,a,n),i.dispatch=n,r.memoizedState=e,[t,n,!1]}function rs(e){return is(Mo(),po,e)}function is(e,t,n){if(t=zo(e,t,ts)[0],e=Ro(Lo)[0],typeof t==`object`&&t&&typeof t.then==`function`)try{var r=Po(t)}catch(e){throw e===ba?Sa:e}else r=t;t=Mo();var i=t.queue,a=i.dispatch;return n!==t.memoizedState&&(fo.flags|=2048,ss(9,{destroy:void 0},as.bind(null,i,n),null)),[r,a,e]}function as(e,t){e.action=t}function os(e){var t=Mo(),n=po;if(n!==null)return is(t,n,e);Mo(),t=t.memoizedState,n=Mo();var r=n.queue.dispatch;return n.memoizedState=e,[t,r,!1]}function ss(e,t,n,r){return e={tag:e,create:n,deps:r,inst:t,next:null},t=fo.updateQueue,t===null&&(t=No(),fo.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 cs(){return Mo().memoizedState}function ls(e,t,n,r){var i=jo();fo.flags|=e,i.memoizedState=ss(1|t,{destroy:void 0},n,r===void 0?null:r)}function us(e,t,n,r){var i=Mo();r=r===void 0?null:r;var a=i.memoizedState.inst;po!==null&&r!==null&&Co(r,po.memoizedState.deps)?i.memoizedState=ss(t,a,n,r):(fo.flags|=e,i.memoizedState=ss(1|t,a,n,r))}function ds(e,t){ls(8390656,8,e,t)}function fs(e,t){us(2048,8,e,t)}function ps(e){fo.flags|=4;var t=fo.updateQueue;if(t===null)t=No(),fo.updateQueue=t,t.events=[e];else{var n=t.events;n===null?t.events=[e]:n.push(e)}}function ms(e){var t=Mo().memoizedState;return ps({ref:t,nextImpl:e}),function(){if(Ul&2)throw Error(i(440));return t.impl.apply(void 0,arguments)}}function hs(e,t){return us(4,2,e,t)}function gs(e,t){return us(4,4,e,t)}function _s(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 vs(e,t,n){n=n==null?null:n.concat([e]),us(4,4,_s.bind(null,t,e),n)}function ys(){}function bs(e,t){var n=Mo();t=t===void 0?null:t;var r=n.memoizedState;return t!==null&&Co(t,r[1])?r[0]:(n.memoizedState=[e,t],e)}function xs(e,t){var n=Mo();t=t===void 0?null:t;var r=n.memoizedState;if(t!==null&&Co(t,r[1]))return r[0];if(r=e(),_o){Fe(!0);try{e()}finally{Fe(!1)}}return n.memoizedState=[r,t],r}function Ss(e,t,n){return n===void 0||uo&1073741824&&!(Kl&261930)?e.memoizedState=t:(e.memoizedState=n,e=Cu(),fo.lanes|=e,eu|=e,n)}function Cs(e,t,n,r){return yr(n,t)?n:Xa.current===null?!(uo&42)||uo&1073741824&&!(Kl&261930)?(ac=!0,e.memoizedState=n):(e=Cu(),fo.lanes|=e,eu|=e,t):(e=Ss(e,n,r),yr(e,t)||(ac=!0),e)}function ws(e,t,n,r,i){var a=I.p;I.p=a!==0&&8>a?a:8;var o=F.T,s={};F.T=s,Is(e,!1,t,n);try{var c=i(),l=F.S;l!==null&&l(s,c),typeof c==`object`&&c&&typeof c.then==`function`?Fs(e,t,ma(c,r),Su(e)):Fs(e,t,r,Su(e))}catch(n){Fs(e,t,{then:function(){},status:`rejected`,reason:n},Su())}finally{I.p=a,o!==null&&s.types!==null&&(o.types=s.types),F.T=o}}function Ts(){}function Es(e,t,n,r){if(e.tag!==5)throw Error(i(476));var a=Ds(e).queue;ws(e,a,t,te,n===null?Ts:function(){return Os(e),n(r)})}function Ds(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:te,baseState:te,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Lo,lastRenderedState:te},next:null};var n={};return t.next={memoizedState:n,baseState:n,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Lo,lastRenderedState:n},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function Os(e){var t=Ds(e);t.next===null&&(t=e.alternate.memoizedState),Fs(e,t.next.queue,{},Su())}function ks(){return $i(op)}function As(){return Mo().memoizedState}function js(){return Mo().memoizedState}function Ms(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var n=Su();e=Va(n);var r=Ha(t,e,n);r!==null&&(wu(r,t,n),Ua(r,t,n)),t={cache:oa()},e.payload=t;return}t=t.return}}function Ns(e,t,n){var r=Su();n={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null},Ls(e)?Rs(t,n):(n=$r(e,t,n,r),n!==null&&(wu(n,e,r),zs(n,t,r)))}function Ps(e,t,n){Fs(e,t,n,Su())}function Fs(e,t,n,r){var i={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null};if(Ls(e))Rs(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),Wl===null&&Zr(),!1}catch{}if(n=$r(e,t,i,r),n!==null)return wu(n,e,r),zs(n,t,r),!0}return!1}function Is(e,t,n,r){if(r={lane:2,revertLane:xd(),gesture:null,action:r,hasEagerState:!1,eagerState:null,next:null},Ls(e)){if(t)throw Error(i(479))}else t=$r(e,n,r,2),t!==null&&wu(t,e,2)}function Ls(e){var t=e.alternate;return e===fo||t!==null&&t===fo}function Rs(e,t){go=ho=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function zs(e,t,n){if(n&4194048){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Xe(e,n)}}var Bs={readContext:$i,use:Fo,useCallback:So,useContext:So,useEffect:So,useImperativeHandle:So,useLayoutEffect:So,useInsertionEffect:So,useMemo:So,useReducer:So,useRef:So,useState:So,useDebugValue:So,useDeferredValue:So,useTransition:So,useSyncExternalStore:So,useId:So,useHostTransitionStatus:So,useFormState:So,useActionState:So,useOptimistic:So,useMemoCache:So,useCacheRefresh:So};Bs.useEffectEvent=So;var Vs={readContext:$i,use:Fo,useCallback:function(e,t){return jo().memoizedState=[e,t===void 0?null:t],e},useContext:$i,useEffect:ds,useImperativeHandle:function(e,t,n){n=n==null?null:n.concat([e]),ls(4194308,4,_s.bind(null,t,e),n)},useLayoutEffect:function(e,t){return ls(4194308,4,e,t)},useInsertionEffect:function(e,t){ls(4,2,e,t)},useMemo:function(e,t){var n=jo();t=t===void 0?null:t;var r=e();if(_o){Fe(!0);try{e()}finally{Fe(!1)}}return n.memoizedState=[r,t],r},useReducer:function(e,t,n){var r=jo();if(n!==void 0){var i=n(t);if(_o){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=Ns.bind(null,fo,e),[r.memoizedState,e]},useRef:function(e){var t=jo();return e={current:e},t.memoizedState=e},useState:function(e){e=qo(e);var t=e.queue,n=Ps.bind(null,fo,t);return t.dispatch=n,[e.memoizedState,n]},useDebugValue:ys,useDeferredValue:function(e,t){return Ss(jo(),e,t)},useTransition:function(){var e=qo(!1);return e=ws.bind(null,fo,e.queue,!0,!1),jo().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,n){var r=fo,a=jo();if(Mi){if(n===void 0)throw Error(i(407));n=n()}else{if(n=t(),Wl===null)throw Error(i(349));Kl&127||Ho(r,t,n)}a.memoizedState=n;var o={value:n,getSnapshot:t};return a.queue=o,ds(Wo.bind(null,r,o,e),[e]),r.flags|=2048,ss(9,{destroy:void 0},Uo.bind(null,r,o,n,t),null),n},useId:function(){var e=jo(),t=Wl.identifierPrefix;if(Mi){var n=wi,r=Ci;n=(r&~(1<<32-Ie(r)-1)).toString(32)+n,t=`_`+t+`R_`+n,n=vo++,0<n&&(t+=`H`+n.toString(32)),t+=`_`}else n=xo++,t=`_`+t+`r_`+n.toString(32)+`_`;return e.memoizedState=t},useHostTransitionStatus:ks,useFormState:ns,useActionState:ns,useOptimistic:function(e){var t=jo();t.memoizedState=t.baseState=e;var n={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return t.queue=n,t=Is.bind(null,fo,!0,n),n.dispatch=t,[e,t]},useMemoCache:Io,useCacheRefresh:function(){return jo().memoizedState=Ms.bind(null,fo)},useEffectEvent:function(e){var t=jo(),n={impl:e};return t.memoizedState=n,function(){if(Ul&2)throw Error(i(440));return n.impl.apply(void 0,arguments)}}},Hs={readContext:$i,use:Fo,useCallback:bs,useContext:$i,useEffect:fs,useImperativeHandle:vs,useInsertionEffect:hs,useLayoutEffect:gs,useMemo:xs,useReducer:Ro,useRef:cs,useState:function(){return Ro(Lo)},useDebugValue:ys,useDeferredValue:function(e,t){return Cs(Mo(),po.memoizedState,e,t)},useTransition:function(){var e=Ro(Lo)[0],t=Mo().memoizedState;return[typeof e==`boolean`?e:Po(e),t]},useSyncExternalStore:Vo,useId:As,useHostTransitionStatus:ks,useFormState:rs,useActionState:rs,useOptimistic:function(e,t){return Jo(Mo(),po,e,t)},useMemoCache:Io,useCacheRefresh:js};Hs.useEffectEvent=ms;var Us={readContext:$i,use:Fo,useCallback:bs,useContext:$i,useEffect:fs,useImperativeHandle:vs,useInsertionEffect:hs,useLayoutEffect:gs,useMemo:xs,useReducer:Bo,useRef:cs,useState:function(){return Bo(Lo)},useDebugValue:ys,useDeferredValue:function(e,t){var n=Mo();return po===null?Ss(n,e,t):Cs(n,po.memoizedState,e,t)},useTransition:function(){var e=Bo(Lo)[0],t=Mo().memoizedState;return[typeof e==`boolean`?e:Po(e),t]},useSyncExternalStore:Vo,useId:As,useHostTransitionStatus:ks,useFormState:os,useActionState:os,useOptimistic:function(e,t){var n=Mo();return po===null?(n.baseState=e,[e,n.queue.dispatch]):Jo(n,po,e,t)},useMemoCache:Io,useCacheRefresh:js};Us.useEffectEvent=ms;function Ws(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 Gs={enqueueSetState:function(e,t,n){e=e._reactInternals;var r=Su(),i=Va(r);i.payload=t,n!=null&&(i.callback=n),t=Ha(e,i,r),t!==null&&(wu(t,e,r),Ua(t,e,r))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var r=Su(),i=Va(r);i.tag=1,i.payload=t,n!=null&&(i.callback=n),t=Ha(e,i,r),t!==null&&(wu(t,e,r),Ua(t,e,r))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=Su(),r=Va(n);r.tag=2,t!=null&&(r.callback=t),t=Ha(e,r,n),t!==null&&(wu(t,e,n),Ua(t,e,n))}};function Ks(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 qs(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&&Gs.enqueueReplaceState(t,t.state,null)}function Js(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 Ys(e){qr(e)}function Xs(e){console.error(e)}function Zs(e){qr(e)}function Qs(e,t){try{var n=e.onUncaughtError;n(t.value,{componentStack:t.stack})}catch(e){setTimeout(function(){throw e})}}function $s(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 ec(e,t,n){return n=Va(n),n.tag=3,n.payload={element:null},n.callback=function(){Qs(e,t)},n}function tc(e){return e=Va(e),e.tag=3,e}function nc(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(){$s(t,n,r)}}var o=n.stateNode;o!==null&&typeof o.componentDidCatch==`function`&&(e.callback=function(){$s(t,n,r),typeof i!=`function`&&(fu===null?fu=new Set([this]):fu.add(this));var e=r.stack;this.componentDidCatch(r.value,{componentStack:e===null?``:e})})}function rc(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?Iu():n.alternate===null&&$l===0&&($l=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),td(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)),td(e,r,a)),!1}throw Error(i(435,n.tag))}return td(e,r,a),Iu(),!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=ec(e.stateNode,r,a),Wa(e,a),$l!==4&&($l=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),au===null?au=[o]:au.push(o),$l!==4&&($l=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=ec(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`&&(fu===null||!fu.has(o))))return n.flags|=65536,a&=-a,n.lanes|=a,a=tc(a),nc(a,e,n,r),Wa(n,a),!1}n=n.return}while(n!==null);return!1}var ic=Error(i(461)),ac=!1;function oc(e,t,n,r){t.child=e===null?La(t,null,n,r):Ia(t,e.child,n,r)}function sc(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=wo(e,t,n,o,a,i),s=Oo(),e!==null&&!ac?(ko(e,t,i),jc(e,t,i)):(Mi&&s&&Di(t),t.flags|=1,oc(e,t,r,i),t.child)}function cc(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,lc(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,!Mc(e,i)){var o=a.memoizedProps;if(n=n.compare,n=n===null?br:n,n(o,r)&&e.ref===t.ref)return jc(e,t,i)}return t.flags|=1,e=si(a,r),e.ref=t.ref,e.return=t,t.child=e}function lc(e,t,n,r,i){if(e!==null){var a=e.memoizedProps;if(br(a,r)&&e.ref===t.ref)if(ac=!1,t.pendingProps=r=a,Mc(e,i))e.flags&131072&&(ac=!0);else return t.lanes=e.lanes,jc(e,t,i)}return _c(e,t,n,r,i)}function uc(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 fc(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,fc(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 oc(e,t,i,n),t.child}function dc(e,t){return e!==null&&e.tag===22||t.stateNode!==null||(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),t.sibling}function fc(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 pc(e,t){return t=Ec({mode:t.mode,children:t.children},e.mode),t.ref=e.ref,e.child=t,t.return=e,t}function mc(e,t,n){return Ia(t,e.child,null,n),e=pc(t,t.pendingProps),e.flags|=2,so(t),t.memoizedState=null,e}function hc(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=pc(t,r),t.lanes=536870912,dc(null,e);if(io(t),(e=ji)?(e=pf(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 pc(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=mc(e,t,n);else if(t.memoizedState!==null)t.child=e.child,t.flags|=128,t=null;else throw Error(i(558));else if(ac||Xi(e,t,n,!1),a=(n&e.childLanes)!==0,ac||a){if(r=Wl,r!==null&&(s=Ze(r,n),s!==0&&s!==o.retryLane))throw o.retryLane=s,ei(e,s),wu(r,e,s),ic;Iu(),t=mc(e,t,n)}else e=o.treeContext,ji=_f(s.nextSibling),Ai=t,Mi=!0,Ni=null,Pi=!1,e!==null&&ki(t,e),t=pc(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 gc(e,t){var n=t.ref;if(n===null)e!==null&&e.ref!==null&&(t.flags|=4194816);else{if(typeof n!=`function`&&typeof n!=`object`)throw Error(i(284));(e===null||e.ref!==n)&&(t.flags|=4194816)}}function _c(e,t,n,r,i){return Qi(t),n=wo(e,t,n,r,void 0,i),r=Oo(),e!==null&&!ac?(ko(e,t,i),jc(e,t,i)):(Mi&&r&&Di(t),t.flags|=1,oc(e,t,n,i),t.child)}function vc(e,t,n,r,i,a){return Qi(t),t.updateQueue=null,n=Eo(t,r,n,i),To(e),r=Oo(),e!==null&&!ac?(ko(e,t,a),jc(e,t,a)):(Mi&&r&&Di(t),t.flags|=1,oc(e,t,n,a),t.child)}function yc(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=Gs,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`&&(Ws(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&&Gs.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=Js(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)&&qs(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`&&(Ws(t,n,d,r),l=t.memoizedState),(c=Ra||Ks(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=Js(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)&&qs(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`&&(Ws(t,n,s,r),p=t.memoizedState),(u=Ra||Ks(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,gc(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)):oc(e,t,n,i),t.memoizedState=a.state,e=t.child):e=jc(e,t,i),e}function bc(e,t,n,r){return Bi(),t.flags|=256,oc(e,t,n,r),t.child}var xc={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Sc(e){return{baseLanes:e,cachePool:ya()}}function Cc(e,t,n){return e=e===null?0:e.childLanes&~n,t&&(e|=ru),e}function wc(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=pf(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 hf(e)?t.lanes=32:t.lanes=536870912,null}var c=r.children;return r=r.fallback,a?(oo(t),a=t.mode,c=Ec({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=Sc(n),r.childLanes=Cc(e,s,n),t.memoizedState=xc,dc(null,r)):(ro(t),Tc(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=Dc(e,t,n)):t.memoizedState===null?(oo(t),c=r.fallback,a=t.mode,r=Ec({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=Sc(n),r.childLanes=Cc(e,s,n),t.memoizedState=xc,t=dc(null,r)):(oo(t),t.child=e.child,t.flags|=128,t=null);else if(ro(t),hf(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=Dc(e,t,n)}else if(ac||Xi(e,t,n,!1),s=(n&e.childLanes)!==0,ac||s){if(s=Wl,s!==null&&(r=Ze(s,n),r!==0&&r!==l.retryLane))throw l.retryLane=r,ei(e,r),wu(s,e,r),ic;mf(c)||Iu(),t=Dc(e,t,n)}else mf(c)?(t.flags|=192,t.child=e.child,t=null):(e=l.treeContext,ji=_f(c.nextSibling),Ai=t,Mi=!0,Ni=null,Pi=!1,e!==null&&ki(t,e),t=Tc(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,dc(null,r),r=t.child,c=e.child.memoizedState,c===null?c=Sc(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=Cc(e,s,n),t.memoizedState=xc,dc(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 Tc(e,t){return t=Ec({mode:`visible`,children:t},e.mode),t.return=e,e.child=t}function Ec(e,t){return e=ai(22,e,null,t),e.lanes=0,e}function Dc(e,t,n){return Ia(t,e.child,null,n),e=Tc(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function Oc(e,t,n){e.lanes|=t;var r=e.alternate;r!==null&&(r.lanes|=t),Ji(e.return,t,n)}function kc(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 Ac(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,z(co,o),oc(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&&Oc(e,n,t);else if(e.tag===19)Oc(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),kc(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}kc(t,!0,n,null,a,r);break;case`together`:kc(t,!1,null,null,void 0,r);break;default:t.memoizedState=null}return t.child}function jc(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),eu|=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 Mc(e,t){return(e.lanes&t)===0?(e=e.dependencies,!!(e!==null&&Zi(e))):!0}function Nc(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=jc(e,t,n),e===null?null:e.sibling):wc(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 Ac(e,t,n);t.flags|=128}if(i=t.memoizedState,i!==null&&(i.rendering=null,i.tail=null,i.lastEffect=null),z(co,co.current),r)break;return null;case 22:return t.lanes=0,uc(e,t,n,t.pendingProps);case 24:Ki(t,aa,e.memoizedState.cache)}return jc(e,t,n)}function Pc(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps)ac=!0;else{if(!Mc(e,n)&&!(t.flags&128))return ac=!1,Nc(e,t,n);ac=!!(e.flags&131072)}else ac=!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=Js(e,r),t.tag=1,t=yc(null,t,e,r,n)):(t.tag=0,t=_c(null,t,e,r,n));else{if(e!=null){var a=e.$$typeof;if(a===w){t.tag=11,t=sc(null,t,e,r,n);break a}else if(a===D){t.tag=14,t=cc(null,t,e,r,n);break a}}throw t=P(e)||e,Error(i(306,t,``))}}return t;case 0:return _c(e,t,t.type,t.pendingProps,n);case 1:return r=t.type,a=Js(r,t.pendingProps),yc(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=bc(e,t,r,n);break a}else if(r!==a){a=hi(Error(i(424)),t),Hi(a),t=bc(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=_f(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=jc(e,t,n);break a}oc(e,t,r,n)}t=t.child}return t;case 26:return gc(e,t),e===null?(n=Lf(t.type,null,t.pendingProps,null))?t.memoizedState=n:Mi||(n=t.type,e=t.pendingProps,r=Xd(oe.current).createElement(n),r[rt]=t,r[it]=e,Wd(r,n,e),gt(r),t.stateNode=r):t.memoizedState=Lf(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return ue(t),e===null&&Mi&&(r=t.stateNode=xf(t.type,t.pendingProps,oe.current),Ai=t,Pi=!0,a=ji,sf(t.type)?(vf=a,ji=_f(r.firstChild)):ji=a),oc(e,t,t.pendingProps.children,n),gc(e,t),e===null&&(t.flags|=4194304),t.child;case 5:return e===null&&Mi&&((a=r=ji)&&(r=df(r,t.type,t.pendingProps,Pi),r===null?a=!1:(t.stateNode=r,Ai=t,ji=_f(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,$d(a,o)?r=null:s!==null&&$d(a,s)&&(t.flags|=32),t.memoizedState!==null&&(a=wo(e,t,Do,null,null,n),op._currentValue=a),gc(e,t),oc(e,t,r,n),t.child;case 6:return e===null&&Mi&&((e=n=ji)&&(n=ff(n,t.pendingProps,Pi),n===null?e=!1:(t.stateNode=n,Ai=t,ji=null,e=!0)),e||Ii(t)),null;case 13:return wc(e,t,n);case 4:return ce(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=Ia(t,null,r,n):oc(e,t,r,n),t.child;case 11:return sc(e,t,t.type,t.pendingProps,n);case 7:return oc(e,t,t.pendingProps,n),t.child;case 8:return oc(e,t,t.pendingProps.children,n),t.child;case 12:return oc(e,t,t.pendingProps.children,n),t.child;case 10:return r=t.pendingProps,Ki(t,t.type,r.value),oc(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,oc(e,t,r,n),t.child;case 14:return cc(e,t,t.type,t.pendingProps,n);case 15:return lc(e,t,t.type,t.pendingProps,n);case 19:return Ac(e,t,n);case 31:return hc(e,t,n);case 22:return uc(e,t,n,t.pendingProps);case 24:return Qi(t),r=$i(aa),e===null?(a=_a(),a===null&&(a=Wl,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))),oc(e,t,t.pendingProps.children,n),t.child;case 29:throw t.pendingProps}throw Error(i(156,t.tag))}function Fc(e){e.flags|=4}function Ic(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(Nu())e.flags|=8192;else throw Da=Ca,xa}else e.flags&=-16777217}function Lc(e,t){if(t.type!==`stylesheet`||t.state.loading&4)e.flags&=-16777217;else if(e.flags|=16777216,!Qf(t))if(Nu())e.flags|=8192;else throw Da=Ca,xa}function Rc(e,t){t!==null&&(e.flags|=4),e.flags&16384&&(t=e.tag===22?536870912:V(),e.lanes|=t,iu|=t)}function zc(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 Bc(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 Vc(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 Bc(t),null;case 1:return Bc(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)?Fc(t):e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,Vi())),Bc(t),null;case 26:var a=t.type,o=t.memoizedState;return e===null?(Fc(t),o===null?(Bc(t),Ic(t,a,null,r,n)):(Bc(t),Lc(t,o))):o?o===e.memoizedState?(Bc(t),t.flags&=-16777217):(Fc(t),Bc(t),Lc(t,o)):(e=e.memoizedProps,e!==r&&Fc(t),Bc(t),Ic(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&&Fc(t);else{if(!r){if(t.stateNode===null)throw Error(i(166));return Bc(t),null}e=ie.current,zi(t)?Li(t,e):(e=xf(a,r,n),t.stateNode=e,Fc(t))}return Bc(t),null;case 5:if(de(t),a=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==r&&Fc(t);else{if(!r){if(t.stateNode===null)throw Error(i(166));return Bc(t),null}if(o=ie.current,zi(t))Li(t,o);else{var s=Xd(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(Wd(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&&Fc(t)}}return Bc(t),Ic(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,n),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==r&&Fc(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||Vd(e.nodeValue,n)),e||Ii(t,!0)}else e=Xd(e).createTextNode(r),e[rt]=t,t.stateNode=e}return Bc(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;Bc(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 Bc(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;Bc(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),Rc(t,t.updateQueue),Bc(t),null);case 4:return le(),e===null&&Md(t.stateNode.containerInfo),Bc(t),null;case 10:return qi(t.type),Bc(t),null;case 19:if(re(co),r=t.memoizedState,r===null)return Bc(t),null;if(a=(t.flags&128)!=0,o=r.rendering,o===null)if(a)zc(r,!1);else{if($l!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(o=lo(e),o!==null){for(t.flags|=128,zc(r,!1),e=o.updateQueue,t.updateQueue=e,Rc(t,e),t.subtreeFlags=0,e=n,n=t.child;n!==null;)ci(n,e),n=n.sibling;return z(co,co.current&1|2),Mi&&Ti(t,r.treeForkCount),t.child}e=e.sibling}r.tail!==null&&we()>uu&&(t.flags|=128,a=!0,zc(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,Rc(t,e),zc(r,!0),r.tail===null&&r.tailMode===`hidden`&&!o.alternate&&!Mi)return Bc(t),null}else 2*we()-r.renderingStartTime>uu&&n!==536870912&&(t.flags|=128,a=!0,zc(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?(Bc(t),null):(e=r.tail,r.rendering=e,r.tail=e.sibling,r.renderingStartTime=we(),e.sibling=null,n=co.current,z(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)&&(Bc(t),t.subtreeFlags&6&&(t.flags|=8192)):Bc(t),n=t.updateQueue,n!==null&&Rc(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&&re(ga),null;case 24:return n=null,e!==null&&(n=e.memoizedState.cache),t.memoizedState.cache!==n&&(t.flags|=2048),qi(aa),Bc(t),null;case 25:return null;case 30:return null}throw Error(i(156,t.tag))}function Hc(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 re(co),null;case 4:return le(),null;case 10:return qi(t.type),null;case 22:case 23:return so(t),eo(),e!==null&&re(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 Uc(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:re(co);break;case 10:qi(t.type);break;case 22:case 23:so(t),eo(),e!==null&&re(ga);break;case 24:qi(aa)}}function Wc(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){ed(t,t.return,e)}}function Gc(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){ed(i,c,e)}}}r=r.next}while(r!==a)}}catch(e){ed(t,t.return,e)}}function Kc(e){var t=e.updateQueue;if(t!==null){var n=e.stateNode;try{Ya(t,n)}catch(t){ed(e,e.return,t)}}}function qc(e,t,n){n.props=Js(e.type,e.memoizedProps),n.state=e.memoizedState;try{n.componentWillUnmount()}catch(n){ed(e,t,n)}}function Jc(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){ed(e,t,n)}}function Yc(e,t){var n=e.ref,r=e.refCleanup;if(n!==null)if(typeof r==`function`)try{r()}catch(n){ed(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){ed(e,t,n)}else n.current=null}function Xc(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){ed(e,e.return,t)}}function Zc(e,t,n){try{var r=e.stateNode;Gd(r,e.type,n,t),r[it]=t}catch(t){ed(e,e.return,t)}}function Qc(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&sf(e.type)||e.tag===4}function $c(e){a:for(;;){for(;e.sibling===null;){if(e.return===null||Qc(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&&sf(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 el(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&&sf(e.type)&&(n=e.stateNode,t=null),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,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&&sf(e.type)&&(n=e.stateNode),e=e.child,e!==null))for(tl(e,t,n),e=e.sibling;e!==null;)tl(e,t,n),e=e.sibling}function nl(e){var t=e.stateNode,n=e.memoizedProps;try{for(var r=e.type,i=t.attributes;i.length;)t.removeAttributeNode(i[0]);Wd(t,r,n),t[rt]=e,t[it]=n}catch(t){ed(e,e.return,t)}}var rl=!1,il=!1,al=!1,ol=typeof WeakSet==`function`?WeakSet:Set,sl=null;function cl(e,t){if(e=e.containerInfo,Jd=mp,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(Yd={focusedElem:e,selectionRange:n},mp=!1,sl=t;sl!==null;)if(t=sl,e=t.child,t.subtreeFlags&1028&&e!==null)e.return=t,sl=e;else for(;sl!==null;){switch(t=sl,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=Js(n.type,a);e=r.getSnapshotBeforeUpdate(h,o),r.__reactInternalSnapshotBeforeUpdate=e}catch(e){ed(n,n.return,e)}}break;case 3:if(e&1024){if(e=t.stateNode.containerInfo,n=e.nodeType,n===9)uf(e);else if(n===1)switch(e.nodeName){case`HEAD`:case`HTML`:case`BODY`:uf(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,sl=e;break}sl=t.return}}function ll(e,t,n){var r=n.flags;switch(n.tag){case 0:case 11:case 15:wl(e,n),r&4&&Wc(5,n);break;case 1:if(wl(e,n),r&4)if(e=n.stateNode,t===null)try{e.componentDidMount()}catch(e){ed(n,n.return,e)}else{var i=Js(n.type,t.memoizedProps);t=t.memoizedState;try{e.componentDidUpdate(i,t,e.__reactInternalSnapshotBeforeUpdate)}catch(e){ed(n,n.return,e)}}r&64&&Kc(n),r&512&&Jc(n,n.return);break;case 3:if(wl(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){ed(n,n.return,e)}}break;case 27:t===null&&r&4&&nl(n);case 26:case 5:wl(e,n),t===null&&r&4&&Xc(n),r&512&&Jc(n,n.return);break;case 12:wl(e,n);break;case 31:wl(e,n),r&4&&hl(e,n);break;case 13:wl(e,n),r&4&&gl(e,n),r&64&&(e=n.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(n=id.bind(null,n),gf(e,n))));break;case 22:if(r=n.memoizedState!==null||rl,!r){t=t!==null&&t.memoizedState!==null||il,i=rl;var a=il;rl=r,(il=t)&&!a?El(e,n,(n.subtreeFlags&8772)!=0):wl(e,n),rl=i,il=a}break;case 30:break;default:wl(e,n)}}function ul(e){var t=e.alternate;t!==null&&(e.alternate=null,ul(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 dl=null,fl=!1;function pl(e,t,n){for(n=n.child;n!==null;)ml(e,t,n),n=n.sibling}function ml(e,t,n){if(Pe&&typeof Pe.onCommitFiberUnmount==`function`)try{Pe.onCommitFiberUnmount(Ne,n)}catch{}switch(n.tag){case 26:il||Yc(n,t),pl(e,t,n),n.memoizedState?n.memoizedState.count--:n.stateNode&&(n=n.stateNode,n.parentNode.removeChild(n));break;case 27:il||Yc(n,t);var r=dl,i=fl;sf(n.type)&&(dl=n.stateNode,fl=!1),pl(e,t,n),Sf(n.stateNode),dl=r,fl=i;break;case 5:il||Yc(n,t);case 6:if(r=dl,i=fl,dl=null,pl(e,t,n),dl=r,fl=i,dl!==null)if(fl)try{(dl.nodeType===9?dl.body:dl.nodeName===`HTML`?dl.ownerDocument.body:dl).removeChild(n.stateNode)}catch(e){ed(n,t,e)}else try{dl.removeChild(n.stateNode)}catch(e){ed(n,t,e)}break;case 18:dl!==null&&(fl?(e=dl,cf(e.nodeType===9?e.body:e.nodeName===`HTML`?e.ownerDocument.body:e,n.stateNode),Bp(e)):cf(dl,n.stateNode));break;case 4:r=dl,i=fl,dl=n.stateNode.containerInfo,fl=!0,pl(e,t,n),dl=r,fl=i;break;case 0:case 11:case 14:case 15:Gc(2,n,t),il||Gc(4,n,t),pl(e,t,n);break;case 1:il||(Yc(n,t),r=n.stateNode,typeof r.componentWillUnmount==`function`&&qc(n,t,r)),pl(e,t,n);break;case 21:pl(e,t,n);break;case 22:il=(r=il)||n.memoizedState!==null,pl(e,t,n),il=r;break;default:pl(e,t,n)}}function hl(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{Bp(e)}catch(e){ed(t,t.return,e)}}}function gl(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{Bp(e)}catch(e){ed(t,t.return,e)}}function _l(e){switch(e.tag){case 31:case 13:case 19:var t=e.stateNode;return t===null&&(t=e.stateNode=new ol),t;case 22:return e=e.stateNode,t=e._retryCache,t===null&&(t=e._retryCache=new ol),t;default:throw Error(i(435,e.tag))}}function vl(e,t){var n=_l(e);t.forEach(function(t){if(!n.has(t)){n.add(t);var r=ad.bind(null,e,t);t.then(r,r)}})}function yl(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(sf(c.type)){dl=c.stateNode,fl=!1;break a}break;case 5:dl=c.stateNode,fl=!1;break a;case 3:case 4:dl=c.stateNode.containerInfo,fl=!0;break a}c=c.return}if(dl===null)throw Error(i(160));ml(o,s,a),dl=null,fl=!1,o=a.alternate,o!==null&&(o.return=null),a.return=null}if(t.subtreeFlags&13886)for(t=t.child;t!==null;)xl(t,e),t=t.sibling}var bl=null;function xl(e,t){var n=e.alternate,r=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:yl(t,e),Sl(e),r&4&&(Gc(3,e,e.return),Wc(3,e),Gc(5,e,e.return));break;case 1:yl(t,e),Sl(e),r&512&&(il||n===null||Yc(n,n.return)),r&64&&rl&&(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=bl;if(yl(t,e),Sl(e),r&512&&(il||n===null||Yc(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`))),Wd(o,r,n),o[rt]=e,gt(o),r=o;break a;case`link`:var s=Yf(`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),Wd(o,r,n),a.head.appendChild(o);break;case`meta`:if(s=Yf(`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),Wd(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 Xf(a,e.type,e.stateNode);else e.stateNode=Wf(a,r,e.memoizedProps);else o===r?r===null&&e.stateNode!==null&&Zc(e,e.memoizedProps,n.memoizedProps):(o===null?n.stateNode!==null&&(n=n.stateNode,n.parentNode.removeChild(n)):o.count--,r===null?Xf(a,e.type,e.stateNode):Wf(a,r,e.memoizedProps))}break;case 27:yl(t,e),Sl(e),r&512&&(il||n===null||Yc(n,n.return)),n!==null&&r&4&&Zc(e,e.memoizedProps,n.memoizedProps);break;case 5:if(yl(t,e),Sl(e),r&512&&(il||n===null||Yc(n,n.return)),e.flags&32){a=e.stateNode;try{Ht(a,``)}catch(t){ed(e,e.return,t)}}r&4&&e.stateNode!=null&&(a=e.memoizedProps,Zc(e,a,n===null?a:n.memoizedProps)),r&1024&&(al=!0);break;case 6:if(yl(t,e),Sl(e),r&4){if(e.stateNode===null)throw Error(i(162));r=e.memoizedProps,n=e.stateNode;try{n.nodeValue=r}catch(t){ed(e,e.return,t)}}break;case 3:if(Jf=null,a=bl,bl=Tf(t.containerInfo),yl(t,e),bl=a,Sl(e),r&4&&n!==null&&n.memoizedState.isDehydrated)try{Bp(t.containerInfo)}catch(t){ed(e,e.return,t)}al&&(al=!1,Cl(e));break;case 4:r=bl,bl=Tf(e.stateNode.containerInfo),yl(t,e),Sl(e),bl=r;break;case 12:yl(t,e),Sl(e);break;case 31:yl(t,e),Sl(e),r&4&&(r=e.updateQueue,r!==null&&(e.updateQueue=null,vl(e,r)));break;case 13:yl(t,e),Sl(e),e.child.flags&8192&&e.memoizedState!==null!=(n!==null&&n.memoizedState!==null)&&(cu=we()),r&4&&(r=e.updateQueue,r!==null&&(e.updateQueue=null,vl(e,r)));break;case 22:a=e.memoizedState!==null;var l=n!==null&&n.memoizedState!==null,u=rl,d=il;if(rl=u||a,il=d||l,yl(t,e),il=d,rl=u,Sl(e),r&8192)a:for(t=e.stateNode,t._visibility=a?t._visibility&-2:t._visibility|1,a&&(n===null||l||rl||il||Tl(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){ed(l,l.return,e)}}}else if(t.tag===6){if(n===null){l=t;try{l.stateNode.nodeValue=a?``:l.memoizedProps}catch(e){ed(l,l.return,e)}}}else if(t.tag===18){if(n===null){l=t;try{var m=l.stateNode;a?lf(m,!0):lf(l.stateNode,!1)}catch(e){ed(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,vl(e,n))));break;case 19:yl(t,e),Sl(e),r&4&&(r=e.updateQueue,r!==null&&(e.updateQueue=null,vl(e,r)));break;case 30:break;case 21:break;default:yl(t,e),Sl(e)}}function Sl(e){var t=e.flags;if(t&2){try{for(var n,r=e.return;r!==null;){if(Qc(r)){n=r;break}r=r.return}if(n==null)throw Error(i(160));switch(n.tag){case 27:var a=n.stateNode;tl(e,$c(e),a);break;case 5:var o=n.stateNode;n.flags&32&&(Ht(o,``),n.flags&=-33),tl(e,$c(e),o);break;case 3:case 4:var s=n.stateNode.containerInfo;el(e,$c(e),s);break;default:throw Error(i(161))}}catch(t){ed(e,e.return,t)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function Cl(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var t=e;Cl(t),t.tag===5&&t.flags&1024&&t.stateNode.reset(),e=e.sibling}}function wl(e,t){if(t.subtreeFlags&8772)for(t=t.child;t!==null;)ll(e,t.alternate,t),t=t.sibling}function Tl(e){for(e=e.child;e!==null;){var t=e;switch(t.tag){case 0:case 11:case 14:case 15:Gc(4,t,t.return),Tl(t);break;case 1:Yc(t,t.return);var n=t.stateNode;typeof n.componentWillUnmount==`function`&&qc(t,t.return,n),Tl(t);break;case 27:Sf(t.stateNode);case 26:case 5:Yc(t,t.return),Tl(t);break;case 22:t.memoizedState===null&&Tl(t);break;case 30:Tl(t);break;default:Tl(t)}e=e.sibling}}function El(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:El(i,a,n),Wc(4,a);break;case 1:if(El(i,a,n),r=a,i=r.stateNode,typeof i.componentDidMount==`function`)try{i.componentDidMount()}catch(e){ed(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){ed(r,r.return,e)}}n&&o&64&&Kc(a),Jc(a,a.return);break;case 27:nl(a);case 26:case 5:El(i,a,n),n&&r===null&&o&4&&Xc(a),Jc(a,a.return);break;case 12:El(i,a,n);break;case 31:El(i,a,n),n&&o&4&&hl(i,a);break;case 13:El(i,a,n),n&&o&4&&gl(i,a);break;case 22:a.memoizedState===null&&El(i,a,n),Jc(a,a.return);break;case 30:break;default:El(i,a,n)}t=t.sibling}}function Dl(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 Ol(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 kl(e,t,n,r){if(t.subtreeFlags&10256)for(t=t.child;t!==null;)Al(e,t,n,r),t=t.sibling}function Al(e,t,n,r){var i=t.flags;switch(t.tag){case 0:case 11:case 15:kl(e,t,n,r),i&2048&&Wc(9,t);break;case 1:kl(e,t,n,r);break;case 3:kl(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){kl(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){ed(t,t.return,e)}}else kl(e,t,n,r);break;case 31:kl(e,t,n,r);break;case 13:kl(e,t,n,r);break;case 23:break;case 22:a=t.stateNode,o=t.alternate,t.memoizedState===null?a._visibility&2?kl(e,t,n,r):(a._visibility|=2,jl(e,t,n,r,(t.subtreeFlags&10256)!=0||!1)):a._visibility&2?kl(e,t,n,r):Ml(e,t),i&2048&&Dl(o,t);break;case 24:kl(e,t,n,r),i&2048&&Ol(t.alternate,t);break;default:kl(e,t,n,r)}}function jl(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:jl(a,o,s,c,i),Wc(8,o);break;case 23:break;case 22:var u=o.stateNode;o.memoizedState===null?(u._visibility|=2,jl(a,o,s,c,i)):u._visibility&2?jl(a,o,s,c,i):Ml(a,o),i&&l&2048&&Dl(o.alternate,o);break;case 24:jl(a,o,s,c,i),i&&l&2048&&Ol(o.alternate,o);break;default:jl(a,o,s,c,i)}t=t.sibling}}function Ml(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:Ml(n,r),i&2048&&Dl(r.alternate,r);break;case 24:Ml(n,r),i&2048&&Ol(r.alternate,r);break;default:Ml(n,r)}t=t.sibling}}var Nl=8192;function Pl(e,t,n){if(e.subtreeFlags&Nl)for(e=e.child;e!==null;)Fl(e,t,n),e=e.sibling}function Fl(e,t,n){switch(e.tag){case 26:Pl(e,t,n),e.flags&Nl&&e.memoizedState!==null&&$f(n,bl,e.memoizedState,e.memoizedProps);break;case 5:Pl(e,t,n);break;case 3:case 4:var r=bl;bl=Tf(e.stateNode.containerInfo),Pl(e,t,n),bl=r;break;case 22:e.memoizedState===null&&(r=e.alternate,r!==null&&r.memoizedState!==null?(r=Nl,Nl=16777216,Pl(e,t,n),Nl=r):Pl(e,t,n));break;default:Pl(e,t,n)}}function Il(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 Ll(e){var t=e.deletions;if(e.flags&16){if(t!==null)for(var n=0;n<t.length;n++){var r=t[n];sl=r,Bl(r,e)}Il(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)Rl(e),e=e.sibling}function Rl(e){switch(e.tag){case 0:case 11:case 15:Ll(e),e.flags&2048&&Gc(9,e,e.return);break;case 3:Ll(e);break;case 12:Ll(e);break;case 22:var t=e.stateNode;e.memoizedState!==null&&t._visibility&2&&(e.return===null||e.return.tag!==13)?(t._visibility&=-3,zl(e)):Ll(e);break;default:Ll(e)}}function zl(e){var t=e.deletions;if(e.flags&16){if(t!==null)for(var n=0;n<t.length;n++){var r=t[n];sl=r,Bl(r,e)}Il(e)}for(e=e.child;e!==null;){switch(t=e,t.tag){case 0:case 11:case 15:Gc(8,t,t.return),zl(t);break;case 22:n=t.stateNode,n._visibility&2&&(n._visibility&=-3,zl(t));break;default:zl(t)}e=e.sibling}}function Bl(e,t){for(;sl!==null;){var n=sl;switch(n.tag){case 0:case 11:case 15:Gc(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,sl=r;else a:for(n=e;sl!==null;){r=sl;var i=r.sibling,a=r.return;if(ul(r),r===n){sl=null;break a}if(i!==null){i.return=a,sl=i;break a}sl=a}}}var Vl={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}},Hl=typeof WeakMap==`function`?WeakMap:Map,Ul=0,Wl=null,Gl=null,Kl=0,ql=0,Jl=null,Yl=!1,Xl=!1,Zl=!1,Ql=0,$l=0,eu=0,tu=0,nu=0,ru=0,iu=0,au=null,ou=null,su=!1,cu=0,lu=0,uu=1/0,du=null,fu=null,pu=0,mu=null,hu=null,gu=0,_u=0,vu=null,yu=null,bu=0,xu=null;function Su(){return Ul&2&&Kl!==0?Kl&-Kl:F.T===null?et():xd()}function Cu(){if(ru===0)if(!(Kl&536870912)||Mi){var e=Ve;Ve<<=1,!(Ve&3932160)&&(Ve=262144),ru=e}else ru=536870912;return e=to.current,e!==null&&(e.flags|=32),ru}function wu(e,t,n){(e===Wl&&(ql===2||ql===9)||e.cancelPendingCommit!==null)&&(ju(e,0),Ou(e,Kl,ru,!1)),qe(e,n),(!(Ul&2)||e!==Wl)&&(e===Wl&&(!(Ul&2)&&(tu|=n),$l===4&&Ou(e,Kl,ru,!1)),pd(e))}function Tu(e,t,n){if(Ul&6)throw Error(i(327));var r=!n&&(t&127)==0&&(t&e.expiredLanes)===0||Ge(e,t),a=r?zu(e,t):Lu(e,t,!0),o=r;do{if(a===0){Xl&&!r&&Ou(e,t,0,!1);break}else{if(n=e.current.alternate,o&&!Du(n)){a=Lu(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=au;var l=c.current.memoizedState.isDehydrated;if(l&&(ju(c,s).flags|=256),s=Lu(c,s,!1),s!==2){if(Zl&&!l){c.errorRecoveryDisabledLanes|=o,tu|=o,a=4;break a}o=ou,ou=a,o!==null&&(ou===null?ou=o:ou.push.apply(ou,o))}a=s}if(o=!1,a!==2)continue}}if(a===1){ju(e,0),Ou(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:Ou(r,t,ru,!Yl);break a;case 2:ou=null;break;case 3:case 5:break;default:throw Error(i(329))}if((t&62914560)===t&&(a=cu+300-we(),10<a)){if(Ou(r,t,ru,!Yl),We(r,0,!0)!==0)break a;gu=t,r.timeoutHandle=tf(Eu.bind(null,r,n,ou,du,su,t,ru,tu,iu,Yl,o,`Throttled`,-0,0),a);break a}Eu(r,n,ou,du,su,t,ru,tu,iu,Yl,o,null,-0,0)}}break}while(1);pd(e)}function Eu(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},Fl(t,a,d);var m=(a&62914560)===a?cu-we():(a&4194048)===a?lu-we():0;if(m=tp(d,m),m!==null){gu=a,e.cancelPendingCommit=m(Ku.bind(null,e,t,a,n,r,i,o,s,c,u,d,null,f,p)),Ou(e,a,o,!l);return}}Ku(e,t,a,n,r,i,o,s,c)}function Du(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 Ou(e,t,n,r){t&=~nu,t&=~tu,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 ku(){return Ul&6?!0:(md(0,!1),!1)}function Au(){if(Gl!==null){if(ql===0)var e=Gl.return;else e=Gl,Gi=Wi=null,Ao(e),Aa=null,ja=0,e=Gl;for(;e!==null;)Uc(e.alternate,e),e=e.return;Gl=null}}function ju(e,t){var n=e.timeoutHandle;n!==-1&&(e.timeoutHandle=-1,nf(n)),n=e.cancelPendingCommit,n!==null&&(e.cancelPendingCommit=null,n()),gu=0,Au(),Wl=e,Gl=n=si(e.current,null),Kl=t,ql=0,Jl=null,Yl=!1,Xl=Ge(e,t),Zl=!1,iu=ru=nu=tu=eu=$l=0,ou=au=null,su=!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 Ql=t,Zr(),n}function Mu(e,t){fo=null,F.H=Bs,t===ba||t===Sa?(t=Oa(),ql=3):t===xa?(t=Oa(),ql=4):ql=t===ic?8:typeof t==`object`&&t&&typeof t.then==`function`?6:1,Jl=t,Gl===null&&($l=1,Qs(e,hi(t,e.current)))}function Nu(){var e=to.current;return e===null?!0:(Kl&4194048)===Kl?no===null:(Kl&62914560)===Kl||Kl&536870912?e===no:!1}function Pu(){var e=F.H;return F.H=Bs,e===null?Bs:e}function Fu(){var e=F.A;return F.A=Vl,e}function Iu(){$l=4,Yl||(Kl&4194048)!==Kl&&to.current!==null||(Xl=!0),!(eu&134217727)&&!(tu&134217727)||Wl===null||Ou(Wl,Kl,ru,!1)}function Lu(e,t,n){var r=Ul;Ul|=2;var i=Pu(),a=Fu();(Wl!==e||Kl!==t)&&(du=null,ju(e,t)),t=!1;var o=$l;a:do try{if(ql!==0&&Gl!==null){var s=Gl,c=Jl;switch(ql){case 8:Au(),o=6;break a;case 3:case 2:case 9:case 6:to.current===null&&(t=!0);var l=ql;if(ql=0,Jl=null,Uu(e,s,c,l),n&&Xl){o=0;break a}break;default:l=ql,ql=0,Jl=null,Uu(e,s,c,l)}}Ru(),o=$l;break}catch(t){Mu(e,t)}while(1);return t&&e.shellSuspendCounter++,Gi=Wi=null,Ul=r,F.H=i,F.A=a,Gl===null&&(Wl=null,Kl=0,Zr()),o}function Ru(){for(;Gl!==null;)Vu(Gl)}function zu(e,t){var n=Ul;Ul|=2;var r=Pu(),a=Fu();Wl!==e||Kl!==t?(du=null,uu=we()+500,ju(e,t)):Xl=Ge(e,t);a:do try{if(ql!==0&&Gl!==null){t=Gl;var o=Jl;b:switch(ql){case 1:ql=0,Jl=null,Uu(e,t,o,1);break;case 2:case 9:if(wa(o)){ql=0,Jl=null,Hu(t);break}t=function(){ql!==2&&ql!==9||Wl!==e||(ql=7),pd(e)},o.then(t,t);break a;case 3:ql=7;break a;case 4:ql=5;break a;case 7:wa(o)?(ql=0,Jl=null,Hu(t)):(ql=0,Jl=null,Uu(e,t,o,7));break;case 5:var s=null;switch(Gl.tag){case 26:s=Gl.memoizedState;case 5:case 27:var c=Gl;if(s?Qf(s):c.stateNode.complete){ql=0,Jl=null;var l=c.sibling;if(l!==null)Gl=l;else{var u=c.return;u===null?Gl=null:(Gl=u,Wu(u))}break b}}ql=0,Jl=null,Uu(e,t,o,5);break;case 6:ql=0,Jl=null,Uu(e,t,o,6);break;case 8:Au(),$l=6;break a;default:throw Error(i(462))}}Bu();break}catch(t){Mu(e,t)}while(1);return Gi=Wi=null,F.H=r,F.A=a,Ul=n,Gl===null?(Wl=null,Kl=0,Zr(),$l):0}function Bu(){for(;Gl!==null&&!Se();)Vu(Gl)}function Vu(e){var t=Pc(e.alternate,e,Ql);e.memoizedProps=e.pendingProps,t===null?Wu(e):Gl=t}function Hu(e){var t=e,n=t.alternate;switch(t.tag){case 15:case 0:t=vc(n,t,t.pendingProps,t.type,void 0,Kl);break;case 11:t=vc(n,t,t.pendingProps,t.type.render,t.ref,Kl);break;case 5:Ao(t);default:Uc(n,t),t=Gl=ci(t,Ql),t=Pc(n,t,Ql)}e.memoizedProps=e.pendingProps,t===null?Wu(e):Gl=t}function Uu(e,t,n,r){Gi=Wi=null,Ao(t),Aa=null,ja=0;var i=t.return;try{if(rc(e,i,t,n,Kl)){$l=1,Qs(e,hi(n,e.current)),Gl=null;return}}catch(t){if(i!==null)throw Gl=i,t;$l=1,Qs(e,hi(n,e.current)),Gl=null;return}t.flags&32768?(Mi||r===1?e=!0:Xl||Kl&536870912?e=!1:(Yl=e=!0,(r===2||r===9||r===3||r===6)&&(r=to.current,r!==null&&r.tag===13&&(r.flags|=16384))),Gu(t,e)):Wu(t)}function Wu(e){var t=e;do{if(t.flags&32768){Gu(t,Yl);return}e=t.return;var n=Vc(t.alternate,t,Ql);if(n!==null){Gl=n;return}if(t=t.sibling,t!==null){Gl=t;return}Gl=t=e}while(t!==null);$l===0&&($l=5)}function Gu(e,t){do{var n=Hc(e.alternate,e);if(n!==null){n.flags&=32767,Gl=n;return}if(n=e.return,n!==null&&(n.flags|=32768,n.subtreeFlags=0,n.deletions=null),!t&&(e=e.sibling,e!==null)){Gl=e;return}Gl=e=n}while(e!==null);$l=6,Gl=null}function Ku(e,t,n,r,a,o,s,c,l){e.cancelPendingCommit=null;do Zu();while(pu!==0);if(Ul&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===Wl&&(Gl=Wl=null,Kl=0),hu=t,mu=e,gu=n,_u=o,vu=a,yu=r,t.subtreeFlags&10256||t.flags&10256?(e.callbackNode=null,e.callbackPriority=0,od(Oe,function(){return Qu(),null})):(e.callbackNode=null,e.callbackPriority=0),r=(t.flags&13878)!=0,t.subtreeFlags&13878||r){r=F.T,F.T=null,a=I.p,I.p=2,s=Ul,Ul|=4;try{cl(e,t,n)}finally{Ul=s,I.p=a,F.T=r}}pu=1,qu(),Ju(),Yu()}}function qu(){if(pu===1){pu=0;var e=mu,t=hu,n=(t.flags&13878)!=0;if(t.subtreeFlags&13878||n){n=F.T,F.T=null;var r=I.p;I.p=2;var i=Ul;Ul|=4;try{xl(t,e);var a=Yd,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}}mp=!!Jd,Yd=Jd=null}finally{Ul=i,I.p=r,F.T=n}}e.current=t,pu=2}}function Ju(){if(pu===2){pu=0;var e=mu,t=hu,n=(t.flags&8772)!=0;if(t.subtreeFlags&8772||n){n=F.T,F.T=null;var r=I.p;I.p=2;var i=Ul;Ul|=4;try{ll(e,t.alternate,t)}finally{Ul=i,I.p=r,F.T=n}}pu=3}}function Yu(){if(pu===4||pu===3){pu=0,Ce();var e=mu,t=hu,n=gu,r=yu;t.subtreeFlags&10256||t.flags&10256?pu=5:(pu=0,hu=mu=null,Xu(e,e.pendingLanes));var i=e.pendingLanes;if(i===0&&(fu=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=F.T,i=I.p,I.p=2,F.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{F.T=t,I.p=i}}gu&3&&Zu(),pd(e),i=e.pendingLanes,n&261930&&i&42?e===xu?bu++:(bu=0,xu=e):bu=0,md(0,!1)}}function Xu(e,t){(e.pooledCacheLanes&=t)===0&&(t=e.pooledCache,t!=null&&(e.pooledCache=null,sa(t)))}function Zu(){return qu(),Ju(),Yu(),Qu()}function Qu(){if(pu!==5)return!1;var e=mu,t=_u;_u=0;var n=$e(gu),r=F.T,a=I.p;try{I.p=32>n?32:n,F.T=null,n=vu,vu=null;var o=mu,s=gu;if(pu=0,hu=mu=null,gu=0,Ul&6)throw Error(i(331));var c=Ul;if(Ul|=4,Rl(o.current),Al(o,o.current,s,n),Ul=c,md(0,!1),Pe&&typeof Pe.onPostCommitFiberRoot==`function`)try{Pe.onPostCommitFiberRoot(Ne,o)}catch{}return!0}finally{I.p=a,F.T=r,Xu(e,t)}}function $u(e,t,n){t=hi(n,t),t=ec(e.stateNode,t,2),e=Ha(e,t,2),e!==null&&(qe(e,2),pd(e))}function ed(e,t,n){if(e.tag===3)$u(e,e,n);else for(;t!==null;){if(t.tag===3){$u(t,e,n);break}else if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError==`function`||typeof r.componentDidCatch==`function`&&(fu===null||!fu.has(r))){e=hi(n,e),n=tc(2),r=Ha(t,n,2),r!==null&&(nc(n,r,t,e),qe(r,2),pd(r));break}}t=t.return}}function td(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new Hl;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)||(Zl=!0,i.add(n),e=nd.bind(null,e,t,n),t.then(e,e))}function nd(e,t,n){var r=e.pingCache;r!==null&&r.delete(t),e.pingedLanes|=e.suspendedLanes&n,e.warmLanes&=~n,Wl===e&&(Kl&n)===n&&($l===4||$l===3&&(Kl&62914560)===Kl&&300>we()-cu?!(Ul&2)&&ju(e,0):nu|=n,iu===Kl&&(iu=0)),pd(e)}function rd(e,t){t===0&&(t=V()),e=ei(e,t),e!==null&&(qe(e,t),pd(e))}function id(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),rd(e,n)}function ad(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),rd(e,n)}function od(e,t){return be(e,t)}var sd=null,cd=null,ld=!1,ud=!1,dd=!1,fd=0;function pd(e){e!==cd&&e.next===null&&(cd===null?sd=cd=e:cd=cd.next=e),ud=!0,ld||(ld=!0,bd())}function md(e,t){if(!dd&&ud){dd=!0;do for(var n=!1,r=sd;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,yd(r,a))}else a=Kl,a=We(r,r===Wl?a:0,r.cancelPendingCommit!==null||r.timeoutHandle!==-1),!(a&3)||Ge(r,a)||(n=!0,yd(r,a));r=r.next}while(n);dd=!1}}function hd(){gd()}function gd(){ud=ld=!1;var e=0;fd!==0&&ef()&&(e=fd);for(var t=we(),n=null,r=sd;r!==null;){var i=r.next,a=_d(r,t);a===0?(r.next=null,n===null?sd=i:n.next=i,i===null&&(cd=n)):(n=r,(e!==0||a&3)&&(ud=!0)),r=i}pu!==0&&pu!==5||md(e,!1),fd!==0&&(fd=0)}function _d(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]=B(s,t)):c<=t&&(e.expiredLanes|=s),a&=~s}if(t=Wl,n=Kl,n=We(e,e===t?n:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),r=e.callbackNode,n===0||e===t&&(ql===2||ql===9)||e.cancelPendingCommit!==null)return r!==null&&r!==null&&xe(r),e.callbackNode=null,e.callbackPriority=0;if(!(n&3)||Ge(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=vd.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 vd(e,t){if(pu!==0&&pu!==5)return e.callbackNode=null,e.callbackPriority=0,null;var n=e.callbackNode;if(Zu()&&e.callbackNode!==n)return null;var r=Kl;return r=We(e,e===Wl?r:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),r===0?null:(Tu(e,r,t),_d(e,we()),e.callbackNode!=null&&e.callbackNode===n?vd.bind(null,e):null)}function yd(e,t){if(Zu())return null;Tu(e,t,!0)}function bd(){af(function(){Ul&6?be(Ee,hd):gd()})}function xd(){if(fd===0){var e=ua;e===0&&(e=Be,Be<<=1,!(Be&261888)&&(Be=256)),fd=e}return fd}function Sd(e){return e==null||typeof e==`symbol`||typeof e==`boolean`?null:typeof e==`function`?e:Yt(``+e)}function Cd(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 wd(e,t,n,r,i){if(t===`submit`&&n&&n.stateNode===i){var a=Sd((i[it]||null).action),o=r.submitter;o&&(t=(t=o[it]||null)?Sd(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(fd!==0){var e=o?Cd(i,o):new FormData(i);Es(n,{pending:!0,data:e,method:i.method,action:a},null,e)}}else typeof a==`function`&&(s.preventDefault(),e=o?Cd(i,o):new FormData(i),Es(n,{pending:!0,data:e,method:i.method,action:a},a,e))},currentTarget:i}]})}}for(var Td=0;Td<Gr.length;Td++){var Ed=Gr[Td];Kr(Ed.toLowerCase(),`on`+(Ed[0].toUpperCase()+Ed.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 Dd=`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(` `),Od=new Set(`beforetoggle cancel close invalid load scroll scrollend toggle`.split(` `).concat(Dd));function H(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 kd(e,t){var n=t[ot];n===void 0&&(n=t[ot]=new Set);var r=e+`__bubble`;n.has(r)||(Nd(t,e,2,!1),n.add(r))}function Ad(e,t,n){var r=0;t&&(r|=4),Nd(n,e,r,t)}var jd=`_reactListening`+Math.random().toString(36).slice(2);function Md(e){if(!e[jd]){e[jd]=!0,_t.forEach(function(t){t!==`selectionchange`&&(Od.has(t)||Ad(t,!1,e),Ad(t,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[jd]||(t[jd]=!0,Ad(`selectionchange`,!1,t))}}function Nd(e,t,n,r){switch(xp(t)){case 2:var i=hp;break;case 8:i=gp;break;default:i=_p}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 Pd(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(Fd(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=Id,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&&Ld(s,c,l,d,!1),u!==null&&f!==null&&Ld(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=U(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=U(r,`onBeforeInput`),0<x.length&&(y=new An(`onBeforeInput`,`beforeinput`,null,n,i),s.push({event:y,listeners:x}),y.data=b)),wd(s,e,r,n,i)}H(s,t)})}function Fd(e,t,n){return{instance:e,listener:t,currentTarget:n}}function U(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(Fd(e,i,a)),i=an(e,t),i!=null&&r.push(Fd(e,i,a))),e.tag===3)return r;e=e.return}return[]}function Id(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function Ld(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(Fd(n,l,c))):i||(l=an(n,a),l!=null&&o.push(Fd(n,l,c)))),n=n.return}o.length!==0&&e.push({event:t,listeners:o})}var Rd=/\r\n?/g,zd=/\u0000|\uFFFD/g;function Bd(e){return(typeof e==`string`?e:``+e).replace(Rd,`
|
|
9
|
-
`).replace(zd,``)}function Vd(e,t){return t=Bd(t),Bd(e)===t}function Hd(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`&&Hd(e,t,`name`,a.name,a,null),Hd(e,t,`formEncType`,a.formEncType,a,null),Hd(e,t,`formMethod`,a.formMethod,a,null),Hd(e,t,`formTarget`,a.formTarget,a,null)):(Hd(e,t,`encType`,a.encType,a,null),Hd(e,t,`method`,a.method,a,null),Hd(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&&kd(`scroll`,e);break;case`onScrollEnd`:r!=null&&kd(`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`:kd(`beforetoggle`,e),kd(`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 Ud(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&&kd(`scroll`,e);break;case`onScrollEnd`:r!=null&&kd(`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 Wd(e,t,n){switch(t){case`div`:case`span`:case`svg`:case`path`:case`a`:case`g`:case`p`:case`li`:break;case`img`:kd(`error`,e),kd(`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:Hd(e,t,o,s,n,null)}}a&&Hd(e,t,`srcSet`,n.srcSet,n,null),r&&Hd(e,t,`src`,n.src,n,null);return;case`input`:kd(`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:Hd(e,t,r,d,n,null)}}Lt(e,o,c,l,u,s,a,!1);return;case`select`:for(a in kd(`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:Hd(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 kd(`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:Hd(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:Hd(e,t,l,r,n,null)}return;case`dialog`:kd(`beforetoggle`,e),kd(`toggle`,e),kd(`cancel`,e),kd(`close`,e);break;case`iframe`:case`object`:kd(`load`,e);break;case`video`:case`audio`:for(r=0;r<Dd.length;r++)kd(Dd[r],e);break;case`image`:kd(`error`,e),kd(`load`,e);break;case`details`:kd(`toggle`,e);break;case`embed`:case`source`:case`link`:kd(`error`,e),kd(`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:Hd(e,t,u,r,n,null)}return;default:if(Kt(t)){for(d in n)n.hasOwnProperty(d)&&(r=n[d],r!==void 0&&Ud(e,t,d,r,n,void 0));return}}for(c in n)n.hasOwnProperty(c)&&(r=n[c],r!=null&&Hd(e,t,c,r,n,null))}function Gd(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)||Hd(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&&Hd(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)||Hd(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&&Hd(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:Hd(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&&Hd(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:Hd(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:Hd(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)&&Hd(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:Hd(e,t,u,p,r,m)}return;default:if(Kt(t)){for(var _ in n)p=n[_],n.hasOwnProperty(_)&&p!==void 0&&!r.hasOwnProperty(_)&&Ud(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||Ud(e,t,d,p,r,m);return}}for(var v in n)p=n[v],n.hasOwnProperty(v)&&p!=null&&!r.hasOwnProperty(v)&&Hd(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||Hd(e,t,f,p,r,m)}function Kd(e){switch(e){case`css`:case`script`:case`font`:case`img`:case`image`:case`input`:case`link`:return!0;default:return!1}}function qd(){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&&Kd(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&&Kd(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 Jd=null,Yd=null;function Xd(e){return e.nodeType===9?e:e.ownerDocument}function Zd(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 Qd(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 $d(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 W=null;function ef(){var e=window.event;return e&&e.type===`popstate`?e===W?!1:(W=e,!0):(W=null,!1)}var tf=typeof setTimeout==`function`?setTimeout:void 0,nf=typeof clearTimeout==`function`?clearTimeout:void 0,rf=typeof Promise==`function`?Promise:void 0,af=typeof queueMicrotask==`function`?queueMicrotask:rf===void 0?tf:function(e){return rf.resolve(null).then(e).catch(of)};function of(e){setTimeout(function(){throw e})}function sf(e){return e===`head`}function cf(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),Bp(t);return}r--}else if(n===`$`||n===`$?`||n===`$~`||n===`$!`||n===`&`)r++;else if(n===`html`)Sf(e.ownerDocument.documentElement);else if(n===`head`){n=e.ownerDocument.head,Sf(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`&&Sf(e.ownerDocument.body);n=i}while(n);Bp(t)}function lf(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 uf(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`:uf(n),dt(n);continue;case`SCRIPT`:case`STYLE`:continue;case`LINK`:if(n.rel.toLowerCase()===`stylesheet`)continue}e.removeChild(n)}}function df(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=_f(e.nextSibling),e===null)break}return null}function ff(e,t,n){if(t===``)return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!==`INPUT`||e.type!==`hidden`)&&!n||(e=_f(e.nextSibling),e===null))return null;return e}function pf(e,t){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!==`INPUT`||e.type!==`hidden`)&&!t||(e=_f(e.nextSibling),e===null))return null;return e}function mf(e){return e.data===`$?`||e.data===`$~`}function hf(e){return e.data===`$!`||e.data===`$?`&&e.ownerDocument.readyState!==`loading`}function gf(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 _f(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 vf=null;function yf(e){e=e.nextSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n===`/$`||n===`/&`){if(t===0)return _f(e.nextSibling);t--}else n!==`$`&&n!==`$!`&&n!==`$?`&&n!==`$~`&&n!==`&`||t++}e=e.nextSibling}return null}function bf(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 xf(e,t,n){switch(t=Xd(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 Sf(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);dt(e)}var Cf=new Map,wf=new Set;function Tf(e){return typeof e.getRootNode==`function`?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var Ef=I.d;I.d={f:Df,r:Of,D:jf,C:Mf,L:Nf,m:Pf,X:If,S:Ff,M:G};function Df(){var e=Ef.f(),t=ku();return e||t}function Of(e){var t=pt(e);t!==null&&t.tag===5&&t.type===`form`?Os(t):Ef.r(e)}var kf=typeof document>`u`?null:document;function Af(e,t,n){var r=kf;if(r&&typeof t==`string`&&t){var i=Ft(t);i=`link[rel="`+e+`"][href="`+i+`"]`,typeof n==`string`&&(i+=`[crossorigin="`+n+`"]`),wf.has(i)||(wf.add(i),e={rel:e,crossOrigin:n,href:t},r.querySelector(i)===null&&(t=r.createElement(`link`),Wd(t,`link`,e),gt(t),r.head.appendChild(t)))}}function jf(e){Ef.D(e),Af(`dns-prefetch`,e,null)}function Mf(e,t){Ef.C(e,t),Af(`preconnect`,e,t)}function Nf(e,t,n){Ef.L(e,t,n);var r=kf;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=Rf(e);break;case`script`:a=Hf(e)}Cf.has(a)||(e=m({rel:`preload`,href:t===`image`&&n&&n.imageSrcSet?void 0:e,as:t},n),Cf.set(a,e),r.querySelector(i)!==null||t===`style`&&r.querySelector(zf(a))||t===`script`&&r.querySelector(Uf(a))||(t=r.createElement(`link`),Wd(t,`link`,e),gt(t),r.head.appendChild(t)))}}function Pf(e,t){Ef.m(e,t);var n=kf;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=Hf(e)}if(!Cf.has(a)&&(e=m({rel:`modulepreload`,href:e},t),Cf.set(a,e),n.querySelector(i)===null)){switch(r){case`audioworklet`:case`paintworklet`:case`serviceworker`:case`sharedworker`:case`worker`:case`script`:if(n.querySelector(Uf(a)))return}r=n.createElement(`link`),Wd(r,`link`,e),gt(r),n.head.appendChild(r)}}}function Ff(e,t,n){Ef.S(e,t,n);var r=kf;if(r&&e){var i=ht(r).hoistableStyles,a=Rf(e);t||=`default`;var o=i.get(a);if(!o){var s={loading:0,preload:null};if(o=r.querySelector(zf(a)))s.loading=5;else{e=m({rel:`stylesheet`,href:e,"data-precedence":t},n),(n=Cf.get(a))&&Kf(e,n);var c=o=r.createElement(`link`);gt(c),Wd(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,Gf(o,t,r)}o={type:`stylesheet`,instance:o,count:1,state:s},i.set(a,o)}}}function If(e,t){Ef.X(e,t);var n=kf;if(n&&e){var r=ht(n).hoistableScripts,i=Hf(e),a=r.get(i);a||(a=n.querySelector(Uf(i)),a||(e=m({src:e,async:!0},t),(t=Cf.get(i))&&qf(e,t),a=n.createElement(`script`),gt(a),Wd(a,`link`,e),n.head.appendChild(a)),a={type:`script`,instance:a,count:1,state:null},r.set(i,a))}}function G(e,t){Ef.M(e,t);var n=kf;if(n&&e){var r=ht(n).hoistableScripts,i=Hf(e),a=r.get(i);a||(a=n.querySelector(Uf(i)),a||(e=m({src:e,async:!0,type:`module`},t),(t=Cf.get(i))&&qf(e,t),a=n.createElement(`script`),gt(a),Wd(a,`link`,e),n.head.appendChild(a)),a={type:`script`,instance:a,count:1,state:null},r.set(i,a))}}function Lf(e,t,n,r){var a=(a=oe.current)?Tf(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=Rf(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=Rf(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(zf(e)))&&!o._p&&(s.instance=o,s.state.loading=5),Cf.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},Cf.set(e,n),o||Vf(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=Hf(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 Rf(e){return`href="`+Ft(e)+`"`}function zf(e){return`link[rel="stylesheet"][`+e+`]`}function Bf(e){return m({},e,{"data-precedence":e.precedence,precedence:null})}function Vf(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}),Wd(t,`link`,n),gt(t),e.head.appendChild(t))}function Hf(e){return`[src="`+Ft(e)+`"]`}function Uf(e){return`script[async]`+e}function Wf(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),Wd(r,`style`,a),Gf(r,n.precedence,e),t.instance=r;case`stylesheet`:a=Rf(n.href);var o=e.querySelector(zf(a));if(o)return t.state.loading|=4,t.instance=o,gt(o),o;r=Bf(n),(a=Cf.get(a))&&Kf(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}),Wd(o,`link`,r),t.state.loading|=4,Gf(o,n.precedence,e),t.instance=o;case`script`:return o=Hf(n.src),(a=e.querySelector(Uf(o)))?(t.instance=a,gt(a),a):(r=n,(a=Cf.get(o))&&(r=m({},n),qf(r,a)),e=e.ownerDocument||e,a=e.createElement(`script`),gt(a),Wd(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,Gf(r,n.precedence,e));return t.instance}function Gf(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 Kf(e,t){e.crossOrigin??=t.crossOrigin,e.referrerPolicy??=t.referrerPolicy,e.title??=t.title}function qf(e,t){e.crossOrigin??=t.crossOrigin,e.referrerPolicy??=t.referrerPolicy,e.integrity??=t.integrity}var Jf=null;function Yf(e,t,n){if(Jf===null){var r=new Map,i=Jf=new Map;i.set(n,r)}else i=Jf,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 Xf(e,t,n){e=e.ownerDocument||e,e.head.insertBefore(n,t===`title`?e.querySelector(`head > title`):null)}function Zf(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 Qf(e){return!(e.type===`stylesheet`&&!(e.state.loading&3))}function $f(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=Rf(r.href),a=t.querySelector(zf(i));if(a){t=a._p,typeof t==`object`&&t&&typeof t.then==`function`&&(e.count++,e=np.bind(e),t.then(e,e)),n.state.loading|=4,n.instance=a,gt(a);return}a=t.ownerDocument||t,r=Bf(r),(i=Cf.get(i))&&Kf(r,i),a=a.createElement(`link`),gt(a);var o=a;o._p=new Promise(function(e,t){o.onload=e,o.onerror=t}),Wd(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=np.bind(e),t.addEventListener(`load`,n),t.addEventListener(`error`,n))}}var ep=0;function tp(e,t){return e.stylesheets&&e.count===0&&ip(e,e.stylesheets),0<e.count||0<e.imgCount?function(n){var r=setTimeout(function(){if(e.stylesheets&&ip(e,e.stylesheets),e.unsuspend){var t=e.unsuspend;e.unsuspend=null,t()}},6e4+t);0<e.imgBytes&&ep===0&&(ep=62500*qd());var i=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&ip(e,e.stylesheets),e.unsuspend)){var t=e.unsuspend;e.unsuspend=null,t()}},(e.imgBytes>ep?50:800)+t);return e.unsuspend=n,function(){e.unsuspend=null,clearTimeout(r),clearTimeout(i)}}:null}function np(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)ip(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var rp=null;function ip(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,rp=new Map,t.forEach(ap,e),rp=null,np.call(e))}function ap(e,t){if(!(t.state.loading&4)){var n=rp.get(e);if(n)var r=n.get(null);else{n=new Map,rp.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=np.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 op={$$typeof:C,Provider:null,Consumer:null,_currentValue:te,_currentValue2:te,_threadCount:0};function K(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 sp(e,t,n,r,i,a,o,s,c,l,u,d){return e=new K(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 cp(e){return e?(e=ri,e):ri}function lp(e,t,n,r,i,a){i=cp(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&&(wu(n,e,t),Ua(n,e,t))}function up(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function dp(e,t){up(e,t),(e=e.alternate)&&up(e,t)}function fp(e){if(e.tag===13||e.tag===31){var t=ei(e,67108864);t!==null&&wu(t,e,67108864),dp(e,67108864)}}function pp(e){if(e.tag===13||e.tag===31){var t=Su();t=Qe(t);var n=ei(e,t);n!==null&&wu(n,e,t),dp(e,t)}}var mp=!0;function hp(e,t,n,r){var i=F.T;F.T=null;var a=I.p;try{I.p=2,_p(e,t,n,r)}finally{I.p=a,F.T=i}}function gp(e,t,n,r){var i=F.T;F.T=null;var a=I.p;try{I.p=8,_p(e,t,n,r)}finally{I.p=a,F.T=i}}function _p(e,t,n,r){if(mp){var i=vp(r);if(i===null)Pd(e,t,r,yp,n),Ap(e,r);else if(Mp(i,e,t,n,r))r.stopPropagation();else if(Ap(e,r),t&4&&-1<kp.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=Ue(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}pd(a),!(Ul&6)&&(uu=we()+500,md(0,!1))}}break;case 31:case 13:s=ei(a,2),s!==null&&wu(s,a,2),ku(),dp(a,2)}if(a=vp(r),a===null&&Pd(e,t,r,yp,n),a===i)break;i=a}i!==null&&r.stopPropagation()}else Pd(e,t,r,null,n)}}function vp(e){return e=Qt(e),bp(e)}var yp=null;function bp(e){if(yp=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 yp=e,null}function xp(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 Sp=!1,Cp=null,wp=null,Tp=null,Ep=new Map,Dp=new Map,Op=[],kp=`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 Ap(e,t){switch(e){case`focusin`:case`focusout`:Cp=null;break;case`dragenter`:case`dragleave`:wp=null;break;case`mouseover`:case`mouseout`:Tp=null;break;case`pointerover`:case`pointerout`:Ep.delete(t.pointerId);break;case`gotpointercapture`:case`lostpointercapture`:Dp.delete(t.pointerId)}}function jp(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&&fp(t)),e):(e.eventSystemFlags|=r,t=e.targetContainers,i!==null&&t.indexOf(i)===-1&&t.push(i),e)}function Mp(e,t,n,r,i){switch(t){case`focusin`:return Cp=jp(Cp,e,t,n,r,i),!0;case`dragenter`:return wp=jp(wp,e,t,n,r,i),!0;case`mouseover`:return Tp=jp(Tp,e,t,n,r,i),!0;case`pointerover`:var a=i.pointerId;return Ep.set(a,jp(Ep.get(a)||null,e,t,n,r,i)),!0;case`gotpointercapture`:return a=i.pointerId,Dp.set(a,jp(Dp.get(a)||null,e,t,n,r,i)),!0}return!1}function Np(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(){pp(n)});return}}else if(t===31){if(t=c(n),t!==null){e.blockedOn=t,tt(e.priority,function(){pp(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 Pp(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=vp(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&&fp(t),e.blockedOn=n,!1;t.shift()}return!0}function Fp(e,t,n){Pp(e)&&n.delete(t)}function Ip(){Sp=!1,Cp!==null&&Pp(Cp)&&(Cp=null),wp!==null&&Pp(wp)&&(wp=null),Tp!==null&&Pp(Tp)&&(Tp=null),Ep.forEach(Fp),Dp.forEach(Fp)}function Lp(e,n){e.blockedOn===n&&(e.blockedOn=null,Sp||(Sp=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,Ip)))}var Rp=null;function zp(e){Rp!==e&&(Rp=e,t.unstable_scheduleCallback(t.unstable_NormalPriority,function(){Rp===e&&(Rp=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(bp(r||n)===null)continue;break}var a=pt(n);a!==null&&(e.splice(t,3),t-=3,Es(a,{pending:!0,data:i,method:n.method,action:r},r,i))}}))}function Bp(e){function t(t){return Lp(t,e)}Cp!==null&&Lp(Cp,e),wp!==null&&Lp(wp,e),Tp!==null&&Lp(Tp,e),Ep.forEach(t),Dp.forEach(t);for(var n=0;n<Op.length;n++){var r=Op[n];r.blockedOn===e&&(r.blockedOn=null)}for(;0<Op.length&&(n=Op[0],n.blockedOn===null);)Np(n),n.blockedOn===null&&Op.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||zp(n);else if(o){var s=null;if(a&&a.hasAttribute(`formAction`)){if(i=a,o=a[it]||null)s=o.formAction;else if(bp(i)!==null)continue}else s=o.action;typeof s==`function`?n[r+1]=s:(n.splice(r,3),r-=3),zp(n)}}}function Vp(){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 Hp(e){this._internalRoot=e}Up.prototype.render=Hp.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(i(409));var n=t.current;lp(n,Su(),e,t,null,null)},Up.prototype.unmount=Hp.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;lp(e.current,2,null,e,null,null),ku(),t[at]=null}};function Up(e){this._internalRoot=e}Up.prototype.unstable_scheduleHydration=function(e){if(e){var t=et();e={blockedOn:null,target:e,priority:t};for(var n=0;n<Op.length&&t!==0&&t<Op[n].priority;n++);Op.splice(n,0,e),n===0&&Np(e)}};var Wp=n.version;if(Wp!==`19.2.7`)throw Error(i(527,Wp,`19.2.7`));I.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 Gp={bundleType:0,version:`19.2.7`,rendererPackageName:`react-dom`,currentDispatcherRef:F,reconcilerVersion:`19.2.7`};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<`u`){var Kp=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Kp.isDisabled&&Kp.supportsFiber)try{Ne=Kp.inject(Gp),Pe=Kp}catch{}}e.createRoot=function(e,t){if(!a(e))throw Error(i(299));var n=!1,r=``,o=Ys,s=Xs,c=Zs;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=sp(e,1,!1,null,null,n,r,null,o,s,c,Vp),e[at]=t.current,Md(e),new Hp(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 A(e,t){let{type:n=`all`,exact:r,fetchStatus:i,predicate:a,queryKey:o,stale:s}=e;if(o){if(r){if(t.queryHash!==M(o,t.options))return!1}else if(!P(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 j(e,t){let{exact:n,status:r,predicate:i,mutationKey:a}=e;if(a){if(!t.options.mutationKey)return!1;if(n){if(N(t.options.mutationKey)!==N(a))return!1}else if(!P(t.options.mutationKey,a))return!1}return!(r&&t.state.status!==r||i&&!i(t))}function M(e,t){return(t?.queryKeyHashFn||N)(e)}function N(e){return JSON.stringify(e,(e,t)=>L(t)?Object.keys(t).sort().reduce((e,n)=>(e[n]=t[n],e),{}):t)}function P(e,t){return e===t?!0:typeof e==typeof t&&e&&t&&typeof e==`object`&&typeof t==`object`?Object.keys(t).every(n=>P(e[n],t[n])):!1}var ee=Object.prototype.hasOwnProperty;function F(e,t,n=0){if(e===t)return e;if(n>500)return t;let r=te(e)&&te(t);if(!r&&!(L(e)&&L(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:ee.call(e,o))&&c++;continue}if(u===null||d===null||typeof u!=`object`||typeof d!=`object`){s[o]=d;continue}let f=F(u,d,n+1);s[o]=f,f===u&&c++}return i===o&&c===i?e:s}function I(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 te(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function L(e){if(!ne(e))return!1;let t=e.constructor;if(t===void 0)return!0;let n=t.prototype;return!(!ne(n)||!n.hasOwnProperty(`isPrototypeOf`)||Object.getPrototypeOf(e)!==Object.prototype)}function ne(e){return Object.prototype.toString.call(e)===`[object Object]`}function R(e){return new Promise(t=>{x.setTimeout(t,e)})}function re(e,t,n){return typeof n.structuralSharing==`function`?n.structuralSharing(e,t):n.structuralSharing===!1?t:F(e,t)}function z(e,t,n=0){let r=[...e,t];return n&&r.length>n?r.slice(1):r}function ie(e,t,n=0){let r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var ae=Symbol();function oe(e,t){return!e.queryFn&&t?.initialPromise?()=>t.initialPromise:!e.queryFn||e.queryFn===ae?()=>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),R(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?ie:z;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=re(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===ae||!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&&!I(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=re(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=re(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),!I(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!I(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=>j(t,e))}findAll(e={}){return this.getAll().filter(t=>j(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),I(this.options,t)||this.#e.getMutationCache().notify({type:`observerOptionsUpdated`,mutation:this.#n,observer:this}),t?.mutationKey&&this.options.mutationKey&&N(t.mutationKey)!==N(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)})})}};function ze(e,t){let n=new Set(t);return e.filter(e=>!n.has(e))}function Be(e,t,n){let r=e.slice(0);return r[t]=n,r}var Ve=class extends v{#e;#t;#n;#r;#i;#a;#o;#s;#c;#l=[];constructor(e,t,n){super(),this.#e=e,this.#r=n,this.#n=[],this.#i=[],this.#t=[],this.setQueries(t)}onSubscribe(){this.listeners.size===1&&this.#i.forEach(e=>{e.subscribe(t=>{this.#m(e,t)})})}onUnsubscribe(){this.listeners.size||this.destroy()}destroy(){this.listeners=new Set,this.#i.forEach(e=>{e.destroy()})}setQueries(e,t){this.#n=e,this.#r=t,pe.batch(()=>{let e=this.#i,t=this.#p(this.#n);t.forEach(e=>e.observer.setOptions(e.defaultedQueryOptions));let n=t.map(e=>e.observer),r=n.map(e=>e.getCurrentResult()),i=e.length!==n.length,a=n.some((t,n)=>t!==e[n]),o=i||a,s=o?!0:r.some((e,t)=>{let n=this.#t[t];return!n||!I(e,n)});!o&&!s||(o&&(this.#l=t,this.#i=n),this.#t=r,this.hasListeners()&&(o&&(ze(e,n).forEach(e=>{e.destroy()}),ze(n,e).forEach(e=>{e.subscribe(t=>{this.#m(e,t)})})),this.#h()))})}getCurrentResult(){return this.#t}getQueries(){return this.#i.map(e=>e.getCurrentQuery())}getObservers(){return this.#i}getOptimisticResult(e,t){let n=this.#p(e),r=n.map(e=>e.observer.getOptimisticResult(e.defaultedQueryOptions)),i=n.map(e=>e.defaultedQueryOptions.queryHash);return[r,e=>this.#d(e??r,t,i),()=>this.#u(r,n)]}#u(e,t){return t.map((n,r)=>{let i=e[r];return n.defaultedQueryOptions.notifyOnChangeProps?i:n.observer.trackResult(i,e=>{t.forEach(t=>{t.observer.trackProp(e)})})})}#d(e,t,n){if(t){let r=this.#c,i=n!==void 0&&r!==void 0&&(r.length!==n.length||n.some((e,t)=>e!==r[t]));return(!this.#a||this.#t!==this.#s||i||t!==this.#o)&&(this.#o=t,this.#s=this.#t,n!==void 0&&(this.#c=n),this.#a=F(this.#a,t(e))),this.#a}return e}#f(){return this.#r?.combine!==void 0&&this.#i.some((e,t)=>e.options.suspense&&this.#t[t]?.data===void 0)}#p(e){let t=new Map;this.#i.forEach(e=>{let n=e.options.queryHash;if(!n)return;let r=t.get(n);r?r.push(e):t.set(n,[e])});let n=[];return e.forEach(e=>{let r=this.#e.defaultQueryOptions(e),i=t.get(r.queryHash)?.shift()??new De(this.#e,r);n.push({defaultedQueryOptions:r,observer:i})}),n}#m(e,t){let n=this.#i.indexOf(e);n!==-1&&(this.#t=Be(this.#t,n,t),this.#h())}#h(){if(this.hasListeners()){let e=this.#u(this.#t,this.#l),t=this.#f(),n=this.#a,r=t?n:this.#d(e,this.#r?.combine);(t||n!==r)&&pe.batch(()=>{this.listeners.forEach(e=>{e(this.#t)})})}}},He=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??M(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=>A(t,e))}findAll(e={}){let t=this.getAll();return Object.keys(e).length>0?t.filter(t=>A(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()})})}},Ue=class{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e={}){this.#e=e.queryCache||new He,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(N(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){let t=[...this.#r.values()],n={};return t.forEach(t=>{P(e,t.queryKey)&&Object.assign(n,t.defaultOptions)}),n}setMutationDefaults(e,t){this.#i.set(N(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){let t=[...this.#i.values()],n={};return t.forEach(t=>{P(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||=M(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===ae&&(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()}},We=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})),Ge=o(((e,t)=>{t.exports=We()})),B=l(d(),1),V=Ge(),Ke=B.createContext(void 0),qe=e=>{let t=B.useContext(Ke);if(e)return e;if(!t)throw Error(`No QueryClient set, use QueryClientProvider to set one`);return t},Je=({client:e,children:t})=>(B.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),(0,V.jsx)(Ke.Provider,{value:e,children:t})),Ye=B.createContext(!1),Xe=()=>B.useContext(Ye);Ye.Provider;function Ze(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var Qe=B.createContext(Ze()),$e=()=>B.useContext(Qe),et=(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))},tt=e=>{B.useEffect(()=>{e.clearReset()},[e])},nt=({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])),rt=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))}},it=(e,t)=>e.isLoading&&e.isFetching&&!t,at=(e,t)=>e?.suspense&&t.isPending,ot=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function st({queries:e,...t},n){let r=qe(n),i=Xe(),a=$e(),o=B.useMemo(()=>e.map(e=>{let t=r.defaultQueryOptions(e);return t._optimisticResults=i?`isRestoring`:`optimistic`,t}),[e,r,i]);o.forEach(e=>{rt(e);let t=r.getQueryCache().get(e.queryHash);et(e,a,t)}),tt(a);let[s]=B.useState(()=>new Ve(r,o,t)),[c,l,u]=s.getOptimisticResult(o,t.combine),d=!i&&t.subscribed!==!1;B.useSyncExternalStore(B.useCallback(e=>d?s.subscribe(pe.batchCalls(e)):w,[s,d]),()=>s.getCurrentResult(),()=>s.getCurrentResult()),B.useEffect(()=>{s.setQueries(o,t)},[o,t,s]);let f=c.some((e,t)=>at(o[t],e))?c.flatMap((e,t)=>{let n=o[t];return n&&at(n,e)?ot(n,new De(r,n),a):[]}):[];if(f.length>0)throw Promise.all(f);let p=c.find((e,t)=>{let n=o[t];return n&&nt({result:e,errorResetBoundary:a,throwOnError:n.throwOnError,query:r.getQueryCache().get(n.queryHash),suspense:n.suspense})});if(p?.error)throw p.error;return l(u())}function ct(e,t,n){let r=Xe(),i=$e(),a=qe(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,rt(o),et(o,i,s),tt(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]),at(o,d))throw ot(o,u,i);if(nt({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()&&it(d,r)&&(l?ot(o,u,i):s?.promise)?.catch(w).finally(()=>{u.updateResult()}),o.notifyOnChangeProps?d:u.trackResult(d)}function lt(e,t){return ct(e,De,t)}function ut(e){return e}function dt(e,t){let n=qe(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 ft=typeof window<`u`?B.useLayoutEffect:B.useEffect;function pt(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 mt(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 ht(e){let t=B.useRef(null);return B.useImperativeHandle(e,()=>t.current,[]),t}function gt(e){return e[e.length-1]}function _t(e){return typeof e==`function`}function vt(e,t){return _t(e)?e(t):e}var yt=Object.prototype.hasOwnProperty,bt=Object.prototype.propertyIsEnumerable;function xt(e){for(let t in e)if(yt.call(e,t))return!0;return!1}var St=()=>Object.create(null),Ct=(e,t)=>wt(e,t,St);function wt(e,t,n=()=>({}),r=0){if(e===t)return e;if(r>500)return t;let i=t,a=Ot(e)&&Ot(i);if(!a&&!(Et(e)&&Et(i)))return i;let o=a?e:Tt(e);if(!o)return i;let s=a?i:Tt(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:yt.call(e,o))&&d++;continue}if(l===null||f===null||typeof l!=`object`||typeof f!=`object`){u[o]=f;continue}let p=wt(l,f,n,r+1);u[o]=p,p===l&&d++}return c===l&&d===c?e:u}function Tt(e){let t=Object.getOwnPropertyNames(e);for(let n of t)if(!bt.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(!bt.call(e,t))return!1;r.push(t)}return r}function Et(e){if(!Dt(e))return!1;let t=e.constructor;if(t===void 0)return!0;let n=t.prototype;return!(!Dt(n)||!n.hasOwnProperty(`isPrototypeOf`))}function Dt(e){return Object.prototype.toString.call(e)===`[object Object]`}function Ot(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function kt(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(!kt(e[r],t[r],n))return!1;return!0}if(Et(e)&&Et(t)){let r=n?.ignoreUndefined??!0;if(n?.partial){for(let i in t)if((!r||t[i]!==void 0)&&!kt(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||!kt(e[o],t[o],n)))return!1;return i===a}return!1}function At(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 jt(e){return!!(e&&typeof e==`object`&&typeof e.then==`function`)}var Mt=/[\x00-\x1f\x7f"<>`{}]/g;function Nt(e){return e.replace(Mt,e=>`%`+e.charCodeAt(0).toString(16).toUpperCase().padStart(2,`0`))}function Pt(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 Nt(t)}var Ft=[`http:`,`https:`,`mailto:`,`tel:`];function It(e,t){if(!e)return!1;try{let n=new URL(e);return!t.has(n.protocol)}catch{return!1}}function Lt(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+=Pt(e.slice(n,i.index))+i[0],n=t.lastIndex;r+=Pt(n?e.slice(n):e);let a=!1;return r.startsWith(`//`)&&(a=!0,r=`/`+r.replace(/^\/+/,``)),{path:r,handledProtocolRelativeURL:a}}function Rt(e){return/\s|[^\u0000-\u007F]/.test(e)?e.replace(/\s|[^\u0000-\u007F]/gu,encodeURIComponent):e}function zt(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 Bt(){throw Error(`Invariant failed`)}function Vt(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 Ht=4,Ut=5;function Wt(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 Gt(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=Wt(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 Kt(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=Gt(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=Yt(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=Yt(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=Xt(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=Xt(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=Xt(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=Yt(n.fullPath??n.from);e.kind=Ut,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=Yt(n.fullPath??n.from);e.kind=Ht,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)Kt(e,t,r,s,i,a,o)}function qt(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 Jt(e){if(e.pathless)for(let t of e.pathless)Jt(t);if(e.static)for(let t of e.static.values())Jt(t);if(e.staticInsensitive)for(let t of e.staticInsensitive.values())Jt(t);if(e.dynamic?.length){e.dynamic.sort(qt);for(let t of e.dynamic)Jt(t)}if(e.optional?.length){e.optional.sort(qt);for(let t of e.optional)Jt(t)}if(e.wildcard?.length){e.wildcard.sort(qt);for(let t of e.wildcard)Jt(t)}}function Yt(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 Xt(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 Zt(e,t){let n=Yt(`/`),r=new Uint16Array(6);for(let t of e)Kt(!1,r,t,1,n,0);Jt(n),t.masksTree=n,t.flatCache=Vt(1e3)}function Qt(e,t){e||=`/`;let n=t.flatCache.get(e);if(n)return n;let r=rn(e,t.masksTree);return t.flatCache.set(e,r),r}function $t(e,t,n,r,i){e||=`/`,r||=`/`;let a=t?`case\0${e}`:e,o=i.singleCache.get(a);return o||(o=Yt(`/`),Kt(t,new Uint16Array(6),{from:e},1,o,0),i.singleCache.set(a,o)),rn(r,o,n)}function en(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=rn(e,t.segmentTree,n)}catch(e){if(e instanceof URIError)a=null;else throw e}return a&&(a.branch=on(a.route)),t.matchCache.set(r,a),a}function tn(e){return e===`/`?e:e.replace(/\/{1,}$/,``)}function nn(e,t=!1,n){let r=Yt(e.fullPath),i=new Uint16Array(6),a={},o={},s=0;return Kt(t,i,e,1,r,0,e=>{if(n?.(e,s),e.id in a&&Bt(),a[e.id]=e,s!==0&&e.path){let t=tn(e.fullPath);(!o[t]||e.fullPath.endsWith(`/`))&&(o[t]=e)}s++}),Jt(r),{processedTree:{segmentTree:r,singleCache:Vt(1e3),matchCache:Vt(1e3),flatCache:null,masksTree:null},routesById:a,routesByPath:o}}function rn(e,t,n=!1){let r=e.split(`/`),i=cn(e,r,t,n);if(!i)return null;let[a]=an(e,r,i);return{route:i.node.route,rawParams:a}}function an(e,t,n){let r=sn(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===Ht)break;if(u.kind===Ut){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 on(e){let t=[e];for(;e.parentRoute;)e=e.parentRoute,t.push(e);return t.reverse(),t}function sn(e){let t=Array(e.depth+1);do t[e.depth]=e,e=e.parent;while(e);return t}function cn(e,t,n,r){if(e===`/`&&n.index)return{node:n.index,skipped:0};let i=!gt(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&&!fn(l,n))continue;if(i.parse){if(!dn(e,t,n))continue;_=n.rawParams,g=n.extract}r&&i.route&&i.kind!==Ht&&fn(c,n)&&(c=n);let v=u===o;if(v&&(i.route&&(!a||i.kind===Ht||i.kind===2)&&fn(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&&(dn(e,t,n)||(r=!1)),r){if(!m&&!h&&!d&&un(p,o))return n;fn(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+ln(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+ln(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+ln(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+ln(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 ln(e,t){return 2**(e-t-1)}function un(e,t){return e===2**(t-1)-1}function dn(e,t,n){let r,i;try{[r,i]=an(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 fn(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===Ht)>(e.node.kind===Ht)||t.node.kind===Ht==(e.node.kind===Ht)&&t.depth>e.depth)))}function pn(e){return mn(e.filter(e=>e!==void 0).join(`/`))}function mn(e){return e.replace(/\/{2,}/g,`/`)}function hn(e){return e===`/`?e:e.replace(/^\/{1,}/,``)}function gn(e){let t=e.length;return t>1&&e[t-1]===`/`?e.replace(/\/{1,}$/,``):e}function _n(e){return gn(hn(e))}function vn(e,t){return e?.endsWith(`/`)&&e!==`/`&&e!==`${t}/`?e.slice(0,-1):e}function yn(e,t,n){return vn(e,n)===vn(t,n)}function bn({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&>(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&&(gt(s)===``?n===`never`&&s.pop():n===`always`&&s.push(``));let c=mn(s.join(`/`))||`/`;return o&&r&&r.set(o,c),c}function xn(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 Sn(e,t,n){let r=t[e];return typeof r==`string`?e===`_splat`?/^[a-zA-Z0-9\-._~!/]*$/.test(r)?r:r.split(`/`).map(e=>wn(e,n)).join(`/`):wn(r,n):r}function Cn({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=Gt(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=Sn(`_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=Sn(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=Sn(i,t,n)??``;l+=`/`+u+f+d;continue}}return e.endsWith(`/`)&&(l+=`/`),{usedParams:a,interpolatedPath:l||`/`,isMissingParams:i}}function wn(e,t){let n=encodeURIComponent(e);return t?.(n)??n}function Tn(e){return e?.isNotFound===!0}function En(){try{return sessionStorage}catch{return}}var Dn=`tsr-scroll-restoration-v1_3`,On=En();function kn(){try{return JSON.parse(On?.getItem(`tsr-scroll-restoration-v1_3`)||`{}`)}catch{return{}}}function An(){try{On?.setItem(Dn,JSON.stringify(jn))}catch{}}var jn=kn(),Mn=`data-scroll-restoration-id`,Nn=e=>e.state.__TSR_key||e.href;function Pn(e){let t=e.getAttribute(Mn);if(t)return`[${Mn}="${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 Fn=!1,In=`window`;function Ln(e){try{return typeof e==`function`?e():document.querySelector(e)}catch{}}function Rn(e){let t=new Set;for(let n of e){if(n===In)continue;let e=Ln(n);e&&t.add(e)}return t}function zn(e,t){let n=t??e.options.scrollRestoration,r=e._scroll;n&&(r.restoring=!0);let i=e.options.getScrollRestorationKey||Nn,a=new Set,o=e=>{let t=jn[e]||={};for(let e of a)e===document?t[In]={scrollX,scrollY}:e.isConnected&&(t[Pn(e)]={scrollX:e.scrollLeft,scrollY:e.scrollTop})};n&&!r.restoration&&(r.restoration=!0,Fn=!1,history.scrollRestoration=`manual`,document.addEventListener(`scroll`,e=>{Fn||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())),An()})),!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=jn[d];if(e){let t=jn[u];for(let n in e){if(n===In){if(s)continue}else{let e=Ln(n);if(!e||s&&o&&(l??=Rn(o),l.has(e)))continue}t||=jn[u]={},t[n]??=e[n]}}}Fn=!0;try{let e=t.toLocation.hash,i=t.toLocation.state.__hashScrollIntoViewOptions??!0,a=!1;if(s){!e&&o&&(l??=Rn(o));let t=e&&i&&c,s=r.restoring?jn[u]:void 0;if(s)for(let e in s){let{scrollX:r,scrollY:i}=s[e];if(e===In){if(t)continue;scrollTo({top:i,left:r,behavior:n}),a=!0}else{let t=Ln(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{Fn=!1}}))}function Bn(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 Vn(e){return e?e===`false`?!1:e===`true`?!0:e*0==0&&+e+``===e?+e:e:``}function Hn(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]=Vn(r):Array.isArray(t)?t.push(Vn(r)):n[e]=[t,Vn(r)]}return n}var Un=Gn(JSON.parse),Wn=Kn(JSON.stringify,JSON.parse);function Gn(e){return t=>{t[0]===`?`&&(t=t.substring(1));let n=Hn(t);for(let t in n){let r=n[t];if(typeof r==`string`)try{n[t]=e(r)}catch{}}return n}}function Kn(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=Bn(e,r);return t?`?${t}`:``}}var qn=`__root__`;function Jn(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 Yn(e){return e instanceof Response&&!!e.options}function Xn(e){return{input:({url:t})=>{for(let n of e)t=Qn(n,t);return t},output:({url:t})=>{for(let n=e.length-1;n>=0;n--)t=$n(e[n],t);return t}}}function Zn(e){let t=_n(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=pn([`/`,t,e.pathname]),e)}}function Qn(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 $n(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 er(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(()=>tr(o,_.get())),x=r(()=>tr(s,v.get())),S=r(()=>tr(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=Vt(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:A,setPending:j,setCached:M};A(e.matches),a?.(k);function A(e){nr(e,o,_,n,i)}function j(e){nr(e,s,v,n,i)}function M(e){nr(e,c,y,n,i)}return k}function tr(e,t){let n=[];for(let r of t){let t=e.get(r);t&&n.push(t.get())}return n}function nr(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)}zt(n.get(),a)||n.set(a)})}var rr=e=>{if(!e.rendered)return e.rendered=!0,e.onReady?.()},ir=e=>e.stores.matchesId.get().some(t=>e.stores.matchStores.get(t)?.get()._forcePending),ar=(e,t)=>!!(e.preload&&!e.router.stores.matchStores.has(t)),or=(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},sr=(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},cr=(e,t,n)=>{if(!(!Yn(n)&&!Tn(n)))throw Yn(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:Yn(n)?`redirected`:Tn(n)?`notFound`:r.status===`pending`?`success`:r.status,context:or(e,t.index),isFetching:!1,error:n})),Tn(n)&&!n.routeId&&(n.routeId=t.routeId),t._nonReactive.loadPromise?.resolve()),Yn(n)&&(e.rendered=!0,n.options._fromLocation=e.location,n.redirectHandled=!0,n=e.router.resolveRedirect(n)),n)},lr=(e,t)=>{let n=e.router.getMatch(t);return!!(!n||n._nonReactive.dehydrated)},ur=(e,t,n)=>{let r=or(e,n);e.updateMatch(t,e=>({...e,context:r}))},dr=(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,cr(e,e.router.getMatch(r),n);try{a.options.onError?.(n)}catch(t){n=t,cr(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&&!Yn(n)&&!Tn(n)&&(e.serialError??=n)},fr=(e,t,n,r)=>{if(r._nonReactive.pendingTimeout!==void 0)return;let i=n.options.pendingMs??e.router.options.defaultPendingMs;if(e.onReady&&!ar(e,t)&&(n.options.loader||n.options.beforeLoad||Cr(n))&&typeof i==`number`&&i!==1/0&&(n.options.pendingComponent??e.router.options?.defaultPendingComponent)){let t=setTimeout(()=>{rr(e)},i);r._nonReactive.pendingTimeout=t}},pr=(e,t,n)=>{let r=e.router.getMatch(t);if(!r._nonReactive.beforeLoadPromise&&!r._nonReactive.loaderPromise)return;fr(e,t,n,r);let i=()=>{let n=e.router.getMatch(t);n.preload&&(n.status===`redirected`||n.status===`notFound`)&&cr(e,n,n.error)};return r._nonReactive.beforeLoadPromise?r._nonReactive.beforeLoadPromise.then(i):i()},mr=(e,t,n,r)=>{let i=e.router.getMatch(t),a=i._nonReactive.loadPromise;i._nonReactive.loadPromise=At(()=>{a?.resolve(),a=void 0});let{paramsError:o,searchError:s}=i;o&&dr(e,n,o),s&&dr(e,n,s),fr(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=At();let f={...or(e,n,!1),...i.__routeContext},{search:p,params:m,cause:h}=i,g=ar(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}(Yn(r)||Tn(r))&&(u(),dr(e,n,r)),e.router.batch(()=>{u(),e.updateMatch(t,e=>({...e,__beforeLoadContext:r})),d()})},y;try{if(y=r.options.beforeLoad(_),jt(y))return u(),y.catch(t=>{dr(e,n,t)}).then(v)}catch(t){u(),dr(e,n,t)}v(y)},hr=(e,t)=>{let{id:n,routeId:r}=e.matches[t],i=e.router.looseRoutesById[r],a=()=>s(),o=()=>mr(e,n,t,i),s=()=>{if(lr(e,n))return;let t=pr(e,n,i);return jt(t)?t.then(o):o()};return a()},gr=(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}))},_r=(e,t,n,r,i)=>{let a=t[r-1],{params:o,loaderDeps:s,abortController:c,cause:l}=e.router.getMatch(n),u=or(e,r),d=ar(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}},vr=async(e,t,n,r,i)=>{try{let a=e.router.getMatch(n);try{Sr(i);let o=i.options.loader,s=typeof o==`function`?o:o?.handler,c=s?.(_r(e,t,n,r,i)),l=!!s&&jt(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;cr(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:or(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:or(e,r)}));return}let s=a._nonReactive.minPendingPromise;s&&await s,Tn(t)&&await i.options.notFoundComponent?.preload?.(),cr(e,e.router.getMatch(n),t);try{i.options.onError?.(t)}catch(t){o=t,cr(e,e.router.getMatch(n),t)}!Yn(o)&&!Tn(o)&&await Sr(i,[`errorComponent`]),e.updateMatch(n,t=>({...t,error:o,context:or(e,r),status:`error`,isFetching:!1}))}}catch(t){let r=e.router.getMatch(n);r&&(r._nonReactive.loaderPromise=void 0),cr(e,r,t)}},yr=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(_r(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 vr(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){Yn(t)&&await e.router.navigate(t.options)}})()):g!==`success`||o?await vr(e,t,i,n,d):ur(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(lr(e,i)){if(!e.router.getMatch(i))return e.matches[n];ur(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=ar(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&&cr(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=At(),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 br(e){let t=e,n=[];ir(t.router)&&rr(t);let r;for(let e=0;e<t.matches.length;e++){try{let n=hr(t,e);jt(n)&&await n}catch(e){if(Yn(e))throw e;if(Tn(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?sr(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(yr(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(Yn(e))throw e;Tn(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=sr(t,l);e===void 0&&Bt();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 Sr(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 Sr(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=gr(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=rr(t);if(jt(d)&&await d,l)throw l;if(t.serialError&&!t.preload&&!t.onReady)throw t.serialError;return t.matches}function xr(e,t){let n=t.map(t=>e.options[t]?.preload?.()).filter(Boolean);if(n.length!==0)return Promise.all(n)}function Sr(e,t=wr){!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===wr?(()=>{if(e._componentsPromise===void 0){let t=xr(e,wr);t?e._componentsPromise=t.then(()=>{e._componentsLoaded=!0,e._componentsPromise=void 0}):e._componentsLoaded=!0}return e._componentsPromise})():xr(e,t);return e._lazyPromise?e._lazyPromise.then(n):n()}function Cr(e){for(let t of wr)if(e.options[t]?.preload)return!0;return!1}var wr=[`component`,`errorComponent`,`pendingComponent`,`notFoundComponent`],Tr=`__TSR_index`,Er=`popstate`,Dr=`beforeunload`;function Or(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=Mr(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[Tr];i=kr(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[Tr];i=kr(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[Tr]!==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 kr(e,t){t||={};let n=Nr();return{...t,key:n,__TSR_key:n,[Tr]:e}}function Ar(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??(()=>Mr(`${t.location.pathname}${t.location.search}${t.location.hash}`,t.history.state));if(!t.history.state?.__TSR_key&&!t.history.state?.key){let e=Nr();t.history.replaceState({[Tr]: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=Mr(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[Tr]-l.state[Tr],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=Or({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(Dr,S,{capture:!0}),t.removeEventListener(Er,x)},onBlocked:()=>{u&&l!==u&&(l=u)},getBlockers:a,setBlockers:o,notifyOnIndexChange:!1});return t.addEventListener(Dr,S,{capture:!0}),t.addEventListener(Er,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 jr(e){let t=e.replace(/[\x00-\x1f\x7f]/g,``);return t.startsWith(`//`)&&(t=`/`+t.replace(/^\/+/,``)),t}function Mr(e,t){let n=jr(e),r=n.indexOf(`#`),i=n.indexOf(`?`),a=Nr();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||{[Tr]:0,key:a,__TSR_key:a}}}function Nr(){return(Math.random()+1).toString(36).substring(7)}function Pr(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 Fr=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=xn(this.options.pathParamsAllowedCharacters)),(!this.history||this.options.history&&this.options.history!==this.history)&&(this.options.history?this.history=this.options.history:this.history=Ar()),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=Vt(1e3),e=this.buildRouteTree(),this.setRoutes(e)}if(!this.stores&&this.latestLocation){let e=this.getStoreConfig(this);this.batch=e.batch,this.stores=er(Rr(this.latestLocation),e),zn(this)}let a=!1,o=this.options.basepath??`/`,s=this.options.rewrite;if(r||n!==o||i!==s){this.basepath=o;let e=[],t=_n(o);t&&t!==`/`&&e.push(Zn({basepath:o})),s&&e.push(s),this.rewrite=e.length===0?void 0:e.length===1?e[0]:Xn(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=nn(this.routeTree,this.options.caseSensitive,(e,t)=>{e.init({originalIndex:t})});return this.options.routeMasks&&Zt(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:Lt(e).path,external:!1,searchStr:o,search:Ct(t?.search,i),hash:Lt(r.slice(1)).path,state:wt(t?.state,a)}}let o=new URL(i,this.origin),s=Qn(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:Lt(s.pathname).path,external:!!this.rewrite&&s.origin!==this.origin,searchStr:l,search:Ct(t?.search,c),hash:Lt(s.hash.slice(1)).path,state:wt(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)=>bn({base:e,to:t.includes(`//`)?mn(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=>Br({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,vt(t.params,s)),d=this.routesByPath[gn(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&&xt(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:Lt(Cn({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,zr(t.options.validateSearch,{...e,...m}))}catch{}}),m=e}m=Vr({search:m,dest:t,destRoutes:f,_includeValidateSearch:e._includeValidateSearch}),m=Ct(o,m);let h=this.options.stringifySearch(m),g=t.hash===!0?n.hash:t.hash?vt(t.hash,n.hash):void 0,_=g?`#${g}`:``,v=t.state===!0?n.state:t.state?vt(t.state,n.state):{};v=wt(n.state,v);let y=`${p}${h}${_}`,b,x,S=!1;if(this.rewrite){let e=new URL(y,this.origin),t=$n(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=Rt(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=Qt(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,vt(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=kt(n.state,this.latestLocation.state);return e.forEach(e=>{delete n.state[e]}),t},a=gn(this.latestLocation.href)===gn(n.href),o=this.commitLocationPromise;if(this.commitLocationPromise=At(()=>{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=Mr(a,{__TSR_index:e?t:t+1}),r=new URL(n.pathname,this.origin);o.to=Qn(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(It(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=Pr(n,this.stores.resolvedLocation.get());this.stores.redirect.get()||this.emit({type:`onBeforeNavigate`,...r}),this.emit({type:`onBeforeLoad`,...r}),await br({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){Yn(e)?(n=e,this.navigate({...n.options,replace:!0,ignoreBlocker:!0})):Tn(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(Pr(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&&It(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=Sr,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 br({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(Yn(e))return e.options.reloadDocument?void 0:await this.preloadRoute({...e.options,_fromLocation:t});Tn(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=$t(r.pathname,t?.caseSensitive??!1,t?.fuzzy??!1,i.pathname,this.processedTree);return!a||e.params&&!kt(a.rawParams,e.params,{partial:!0})?!1:t?.includeSearch??!0?kt(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??Wn,parseSearch:e.parseSearch??Un,protocolAllowlist:e.protocolAllowlist??Ft}),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=on(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[`**`]:gn(e.pathname))&&(this.options.notFoundRoute?a=[...a,this.options.notFoundRoute]:o=!0);let s=o?Ur(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=zr(r.options.validateSearch,{...n})??void 0;u={...n,...e},d={...i,...e},f=void 0}catch(e){let r=e;if(e instanceof Ir||(r=new Ir(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}=Cn({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{Wr(r,b)}catch(e){if(x=Tn(e)||Yn(e)?e:new Lr(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:Ct(y?y.search:v.search,u),_strictSearch:d};else{let e=r.options.loader||r.options.beforeLoad||r.lazyFn||Cr(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?Ct(y.search,u):u,_strictSearch:d,searchError:void 0,status:e,isFetching:!1,error:void 0,paramsError:x,__routeContext:void 0,_nonReactive:{loadPromise:At()},__beforeLoadContext:void 0,context:{},abortController:new AbortController,fetchCount:0,cause:S,loaderDeps:y?wt(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?Ct(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=gt(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=gt(r),o={...e.search};for(let e of r)try{Object.assign(o,zr(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{Wr(t,e)}catch{}l=e}let u={matchedRoutes:r,fullPath:a.fullPath,search:o,params:l};return this.lightweightCache.set(e,[t,u]),u}},Ir=class extends Error{},Lr=class extends Error{};function Rr(e){return{loadedAt:0,isLoading:!1,isTransitioning:!1,status:`idle`,resolvedLocation:void 0,location:e,matches:[],statusCode:200}}function zr(e,t){if(e==null)return{};if(`~standard`in e){let n=e[`~standard`].validate(t);if(n instanceof Promise)throw new Ir(`Async validation not supported`);if(n.issues)throw new Ir(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 Br({pathname:e,routesById:t,processedTree:n}){let r=Object.create(null),i=gn(e),a,o=en(i,n,!0);return o&&(a=o.route,Object.assign(r,o.rawParams)),{matchedRoutes:o?.branch||[t.__root__],routeParams:r,foundRoute:a}}function Vr({search:e,dest:t,destRoutes:n,_includeValidateSearch:r}){return Hr(n)(e,t,r??!1)}function Hr(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=zr(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=vt(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 Ur(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 qn}function Wr(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 Gr=`Error preloading route! ☝️`,Kr=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=qn:this.parentRoute||Bt();let r=n?qn:t?.path;r&&r!==`/`&&(r=hn(r));let i=t?.id||r,a=n?qn:pn([this.parentRoute.id===`__root__`?``:this.parentRoute.id,i]);r===`__root__`&&(r=`/`),a!==`__root__`&&(a=pn([`/`,a]));let o=a===`__root__`?`/`:pn([this.parentRoute.fullPath,r]);this._path=r,this._id=a,this._fullPath=o,this._to=gn(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=>Jn({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.`)}},qr=class extends Kr{constructor(e){super(e)}};function Jr(e){let t=e.errorComponent??Xr;return(0,V.jsx)(Yr,{getResetKey:e.getResetKey,onCatch:e.onCatch,children:({error:n,reset:r})=>n?B.createElement(t,{error:n,reset:r}):e.children})}var Yr=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 Xr({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 Zr({children:e,fallback:t=null}){return Qr()?(0,V.jsx)(B.Fragment,{children:e}):(0,V.jsx)(B.Fragment,{children:t})}function Qr(){return B.useSyncExternalStore($r,()=>!0,()=>!1)}function $r(){return()=>{}}var ei=B.createContext(null);function ti(e){return B.useContext(ei)}var ni=B.createContext(void 0),ri=B.createContext(void 0),ii=(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))(ii||{});function ai({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 oi(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 si=[],ci=0,{link:li,unlink:ui,propagate:di,checkDirty:fi,shallowPropagate:pi}=ai({update(e){return e._update()},notify(e){si[hi++]=e,e.flags&=~ii.Watching},unwatched(e){e.depsTail!==void 0&&(e.depsTail=void 0,e.flags=ii.Mutable|ii.Dirty,yi(e))}}),mi=0,hi=0,gi,_i=0;function vi(e){try{++_i,e()}finally{--_i||bi()}}function yi(e){let t=e.depsTail,n=t===void 0?e.deps:t.nextDep;for(;n!==void 0;)n=ui(n,e)}function bi(){if(!(_i>0)){for(;mi<hi;){let e=si[mi];si[mi++]=void 0,e.notify()}mi=0,hi=0}}function xi(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?ii.None:ii.Mutable,get(){return gi!==void 0&&li(i,gi,ci),i._snapshot},subscribe(e){let t=oi(e),n={current:!1},r=Si(()=>{i.get(),n.current?t.next?.(i._snapshot):n.current=!0});return{unsubscribe:()=>{r.stop()}}},_update(e){let a=gi,o=t?.compare??Object.is;if(n)gi=i,++ci,i.depsTail=void 0;else if(e===void 0)return!1;n&&(i.flags=ii.Mutable|ii.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{gi=a,n&&(i.flags&=~ii.RecursedCheck),yi(i)}}};return n?(i.flags=ii.Mutable|ii.Dirty,i.get=function(){let e=i.flags;if(e&ii.Dirty||e&ii.Pending&&fi(i.deps,i)){if(i._update()){let e=i.subs;e!==void 0&&pi(e)}}else e&ii.Pending&&(i.flags=e&~ii.Pending);return gi!==void 0&&li(i,gi,ci),i._snapshot}):i.set=function(e){if(i._update(e)){let e=i.subs;e!==void 0&&(di(e),pi(e),bi())}},i}function Si(e){let t=()=>{let t=gi;gi=n,++ci,n.depsTail=void 0,n.flags=ii.Watching|ii.RecursedCheck;try{return e()}finally{gi=t,n.flags&=~ii.RecursedCheck,yi(n)}},n={deps:void 0,depsTail:void 0,subs:void 0,subsTail:void 0,flags:ii.Watching|ii.RecursedCheck,notify(){let e=this.flags;e&ii.Dirty||e&ii.Pending&&fi(this.deps,this)?t():this.flags=ii.Watching},stop(){this.flags=ii.None,this.depsTail=void 0,yi(this)}};return t(),n}var Ci=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})),wi=o(((e,t)=>{t.exports=Ci()})),Ti=o((e=>{var t=d(),n=wi();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}})),Ei=o(((e,t)=>{t.exports=Ti()}))();function Di(e,t){return e===t}function Oi(e,t,n=Di){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,Ei.useSyncExternalStoreWithSelector)(r,i,i,t,n)}var ki={get(){},subscribe(){return{unsubscribe(){}}}};function Ai(e,t){let n=B.useRef();return r=>{let i=e?.select?e.select(r):r;return e?.structuralSharing??t.options.defaultStructuralSharing?n.current=wt(n.current,i):i}}function ji(e){let t=ti(),n=B.useContext(e.from?ri:ni),r=e.from?t.stores.getRouteMatchStore(e.from):t.stores.matchStores.get(n),i=Ai(e,t),a=Oi(r??ki,e=>e?i(e):ki);if(a!==ki)return a;(e.shouldThrow??!0)&&Bt()}function Mi(e){return ji({from:e.from,strict:e.strict,structuralSharing:e.structuralSharing,select:t=>e.select?e.select(t.loaderData):t.loaderData})}function Ni(e){let{select:t,...n}=e;return ji({...n,select:e=>t?t(e.loaderDeps):e.loaderDeps})}function Pi(e){return ji({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 Fi(e){return ji({from:e.from,strict:e.strict,shouldThrow:e.shouldThrow,structuralSharing:e.structuralSharing,select:t=>e.select?e.select(t.search):t.search})}function Ii(e){let t=ti();return B.useCallback(n=>t.navigate({...n,from:n.from??e?.from}),[e?.from,t])}function Li(e){return ji({...e,select:t=>e.select?e.select(t.context):t.context})}var Ri=l(h(),1);function zi(e,t){let n=ti(),r=ht(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:A,state:j,mask:M,reloadDocument:N,unsafeRelative:P,from:ee,_fromLocation:F,...I}=e,te=Qr(),L=B.useMemo(()=>e,[n,e.from,e._fromLocation,e.hash,e.to,e.search,e.params,e.state,e.mask,e.unsafeRelative]),ne=Oi(n.stores.location,e=>e,(e,t)=>e.href===t.href),R=B.useMemo(()=>{let e={_fromLocation:ne,...L};return n.buildLocation(e)},[n,ne,L]),re=R.maskedLocation?R.maskedLocation.publicHref:R.publicHref,z=R.maskedLocation?R.maskedLocation.external:R.external,ie=B.useMemo(()=>Ji(re,z,n.history,v),[v,z,re,n.history]),ae=B.useMemo(()=>{if(ie?.external)return It(ie.href,n.protocolAllowlist)?void 0:ie.href;if(!Yi(s)&&!(typeof s!=`string`||s.indexOf(`:`)===-1))try{return new URL(s),It(s,n.protocolAllowlist)?void 0:s}catch{}},[s,ie,n.protocolAllowlist]),oe=B.useMemo(()=>{if(ae)return!1;if(o?.exact){if(!yn(ne.pathname,R.pathname,n.basepath))return!1}else{let e=vn(ne.pathname,n.basepath),t=vn(R.pathname,n.basepath);if(!(e.startsWith(t)&&(e.length===t.length||e[t.length]===`/`)))return!1}return(o?.includeSearch??!0)&&!kt(ne.search,R.search,{partial:!o?.exact,ignoreUndefined:!o?.explicitUndefined})?!1:!o?.includeHash||te&&ne.hash===R.hash},[o?.exact,o?.explicitUndefined,o?.includeHash,o?.includeSearch,ne,ae,te,R.hash,R.pathname,R.search,n.basepath]),se=oe?vt(i,{})??Vi:Bi,ce=oe?Bi:vt(a,{})??Bi,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||ae?!1:c??n.options.defaultPreload,he=l??n.options.defaultPreloadDelay??0,ge=B.useCallback(()=>{n.preloadRoute({...L,_builtLocation:R}).catch(e=>{console.warn(e),console.warn(Gr)})},[n,L,R]);mt(r,B.useCallback(e=>{e?.isIntersecting&&ge()},[ge]),Ki,{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&&!Zi(e)&&!e.defaultPrevented&&(!r||r===`_self`)&&e.button===0){e.preventDefault(),(0,Ri.flushSync)(()=>{fe(!0)});let t=n.subscribe(`onResolved`,()=>{t(),fe(!1)});n.navigate({...L,replace:f,resetScroll:m,hashScrollIntoView:d,startTransition:p,viewTransition:h,ignoreBlocker:D})}};if(ae)return{...I,ref:r,href:ae,...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(Gi.has(t))return;let n=setTimeout(()=>{Gi.delete(t),ge()},he);Gi.set(t,n)},ye=e=>{v||me!==`intent`||ge()},be=e=>{if(v||!me||!he)return;let t=e.currentTarget,n=Gi.get(t);n&&(clearTimeout(n),Gi.delete(t))};return{...I,...se,...ce,href:ie?.href,ref:r,onClick:qi([x,_e]),onBlur:qi([S,be]),onFocus:qi([C,ve]),onMouseEnter:qi([w,ve]),onMouseLeave:qi([T,be]),onTouchStart:qi([E,ye]),disabled:!!v,target:_,...ue&&{style:ue},...le&&{className:le},...v&&Hi,...oe&&Ui,...te&&de&&Wi}}var Bi={},Vi={className:`active`},Hi={role:`link`,"aria-disabled":!0},Ui={"data-status":`active`,"aria-current":`page`},Wi={"data-transitioning":`transitioning`},Gi=new WeakMap,Ki={rootMargin:`100px`},qi=e=>t=>{for(let n of e)if(n){if(t.defaultPrevented)return;n(t)}};function Ji(e,t,n,r){if(!r)return t?{href:e,external:!0}:{href:n.createHref(e)||`/`,external:!1}}function Yi(e){if(typeof e!=`string`)return!1;let t=e.charCodeAt(0);return t===47?e.charCodeAt(1)!==47:t===46}var Xi=B.forwardRef((e,t)=>{let{_asChild:n,...r}=e,{type:i,...a}=zi(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 Zi(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}var Qi=class extends Kr{constructor(e){super(e),this.useMatch=e=>ji({select:e?.select,from:this.id,structuralSharing:e?.structuralSharing}),this.useRouteContext=e=>Li({...e,from:this.id}),this.useSearch=e=>Fi({select:e?.select,structuralSharing:e?.structuralSharing,from:this.id}),this.useParams=e=>Pi({select:e?.select,structuralSharing:e?.structuralSharing,from:this.id}),this.useLoaderDeps=e=>Ni({...e,from:this.id}),this.useLoaderData=e=>Mi({...e,from:this.id}),this.useNavigate=()=>Ii({from:this.fullPath}),this.Link=B.forwardRef((e,t)=>(0,V.jsx)(Xi,{ref:t,from:this.fullPath,...e}))}};function $i(e){return new Qi(e)}var ea=class extends qr{constructor(e){super(e),this.useMatch=e=>ji({select:e?.select,from:this.id,structuralSharing:e?.structuralSharing}),this.useRouteContext=e=>Li({...e,from:this.id}),this.useSearch=e=>Fi({select:e?.select,structuralSharing:e?.structuralSharing,from:this.id}),this.useParams=e=>Pi({select:e?.select,structuralSharing:e?.structuralSharing,from:this.id}),this.useLoaderDeps=e=>Ni({...e,from:this.id}),this.useLoaderData=e=>Mi({...e,from:this.id}),this.useNavigate=()=>Ii({from:this.fullPath}),this.Link=B.forwardRef((e,t)=>(0,V.jsx)(Xi,{ref:t,from:this.fullPath,...e}))}};function ta(e){return new ea(e)}function na(e){let t=ti(),n=`not-found-${Oi(t.stores.location,e=>e.pathname)}-${Oi(t.stores.status,e=>e)}`;return(0,V.jsx)(Jr,{getResetKey:()=>n,onCatch:(t,n)=>{if(Tn(t))e.onCatch?.(t,n);else throw t},errorComponent:({error:t})=>{if(Tn(t))return e.fallback?.(t);throw t},children:e.children})}function ra(){return(0,V.jsx)(`p`,{children:`Not Found`})}function ia(e){return(0,V.jsx)(V.Fragment,{children:e.children})}function aa(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)(ra,{})}var oa=(e,t)=>e.routeId===t.routeId&&e._displayPending===t._displayPending,sa=(e,t)=>e[0]===t[0]&&e[1]===t[1],ca=B.memo(function({matchId:e}){let t=ti(),n=t.stores.matchStores.get(e);n||Bt();let r=Oi(t.stores.loadedAt,e=>e),i=Oi(n,e=>e,oa);return(0,V.jsx)(la,{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 la({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:ia,f=s?Jr:ia,p=l?na:ia;return(0,V.jsxs)(i.isRoot?i.options.shellComponent??ia:ia,{children:[(0,V.jsx)(ni.Provider,{value:t,children:(0,V.jsx)(d,{fallback:o,children:(0,V.jsx)(f,{getResetKey:()=>n,errorComponent:s||Xr,onCatch:(e,t)=>{if(Tn(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)(Zr,{fallback:o,children:(0,V.jsx)(da,{matchId:t})}):(0,V.jsx)(da,{matchId:t})})})})}),r.parentRouteId===`__root__`?(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(ua,{}),(e.options.scrollRestoration,null)]}):null]})}function ua(){let e=ti(),t=B.useRef();return ft(()=>{let n=e.stores.resolvedLocation.get(),r=t.current;n&&(!r||r.href!==n.href)&&e.emit({type:`onRendered`,...Pr(e.stores.location.get(),r??n)}),t.current=n},[Oi(e.stores.resolvedLocation,e=>e?.state.__TSR_key),e]),null}var da=B.memo(function({matchId:e}){let t=ti(),n=(e,n)=>t.getMatch(e.id)?._nonReactive[n]??e._nonReactive[n],r=t.stores.matchStores.get(e);r||Bt();let i=Oi(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)(fa,{})},[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=At();n._nonReactive.minPendingPromise=t,setTimeout(()=>{t.resolve(),n._nonReactive.minPendingPromise=void 0},e)}}throw n(i,`loadPromise`)}if(i.status===`notFound`)return Tn(i.error)||Bt(),aa(t,o,i.error);if(i.status===`redirected`)throw Yn(i.error)||Bt(),n(i,`loadPromise`);if(i.status===`error`)throw i.error;return c}),fa=B.memo(function(){let e=ti(),t=B.useContext(ni),n,r=!1,i;{let a=t?e.stores.matchStores.get(t):void 0;[n,r]=Oi(a,e=>[e?.routeId,e?.globalNotFound??!1],sa),i=Oi(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||Bt(),aa(e,a,void 0);if(!i)return null;let s=(0,V.jsx)(ca,{matchId:i});return n===`__root__`?(0,V.jsx)(B.Suspense,{fallback:o,children:s}):s});function pa(){let e=ti(),t=B.useRef({router:e,mounted:!1}),[n,r]=B.useState(!1),i=Oi(e.stores.isLoading,e=>e),a=Oi(e.stores.hasPending,e=>e),o=pt(i),s=i||n||a,c=pt(s),l=i||a,u=pt(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 gn(e.latestLocation.publicHref)!==gn(n.publicHref)&&e.commitLocation({...n,replace:!0}),()=>{t()}},[e,e.history]),ft(()=>{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]),ft(()=>{o&&!i&&e.emit({type:`onLoad`,...Pr(e.stores.location.get(),e.stores.resolvedLocation.get())})},[o,e,i]),ft(()=>{u&&!l&&e.emit({type:`onBeforeRouteMount`,...Pr(e.stores.location.get(),e.stores.resolvedLocation.get())})},[l,u,e]),ft(()=>{if(c&&!s){let t=Pr(e.stores.location.get(),e.stores.resolvedLocation.get());e.emit({type:`onResolved`,...t}),vi(()=>{e.stores.status.set(`idle`),e.stores.resolvedLocation.set(e.stores.location.get())})}},[s,c,e]),null}function ma(){let e=ti(),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?ia:B.Suspense,{fallback:n,children:[(0,V.jsx)(pa,{}),(0,V.jsx)(ha,{})]});return e.options.InnerWrap?(0,V.jsx)(e.options.InnerWrap,{children:r}):r}function ha(){let e=ti(),t=Oi(e.stores.firstId,e=>e),n=Oi(e.stores.loadedAt,e=>e),r=t?(0,V.jsx)(ca,{matchId:t}):null;return(0,V.jsx)(ni.Provider,{value:t,children:e.options.disableGlobalCatchBoundary?r:(0,V.jsx)(Jr,{getResetKey:()=>n,errorComponent:Xr,onCatch:void 0,children:r})})}var ga=e=>({createMutableStore:xi,createReadonlyStore:xi,batch:vi}),_a=e=>new va(e),va=class extends Fr{constructor(e){super(e,ga)}};function ya({router:e,children:t,...n}){xt(n)&&e.update({...e.options,...n,context:{...e.options.context,...n.context}});let r=(0,V.jsx)(ei.Provider,{value:e,children:t});return e.options.Wrap?(0,V.jsx)(e.options.Wrap,{children:r}):r}function ba({router:e,...t}){return(0,V.jsx)(ya,{router:e,...t,children:(0,V.jsx)(ma,{})})}function xa(e){let t=ti();return Oi(t.stores.location,Ai(e,t))}var Sa=_();function Ca(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 wa=e=>{switch(e){case`success`:return Da;case`info`:return ka;case`warning`:return Oa;case`error`:return Aa;default:return null}},Ta=Array(12).fill(0),Ea=({visible:e,className:t})=>B.createElement(`div`,{className:[`sonner-loading-wrapper`,t].filter(Boolean).join(` `),"data-visible":e},B.createElement(`div`,{className:`sonner-spinner`},Ta.map((e,t)=>B.createElement(`div`,{className:`sonner-loading-bar`,key:`spinner-bar-${t}`})))),Da=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`})),Oa=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`})),ka=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`})),Aa=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`})),ja=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`})),Ma=()=>{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},Na=1,Pa=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:Na++,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(Ia(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||Na++;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}},Fa=(e,t)=>{let n=t?.id||Na++;return Pa.addToast({title:e,...t,id:n}),n},Ia=e=>e&&typeof e==`object`&&`ok`in e&&typeof e.ok==`boolean`&&`status`in e&&typeof e.status==`number`,La=Object.assign(Fa,{success:Pa.success,info:Pa.info,warning:Pa.warning,error:Pa.error,custom:Pa.custom,message:Pa.message,promise:Pa.promise,dismiss:Pa.dismiss,loading:Pa.loading},{getHistory:()=>Pa.toasts,getToasts:()=>Pa.getActiveToasts()});Ca(`[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 Ra(e){return e.label!==void 0}var za=3,Ba=`24px`,Va=`16px`,Ha=4e3,Ua=356,Wa=14,Ga=45,Ka=200;function qa(...e){return e.filter(Boolean).join(` `)}function Ja(e){let[t,n]=e.split(`-`),r=[];return t&&r.push(t),n&&r.push(n),r}var Ya=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),[A,j]=B.useState(!1),[M,N]=B.useState(!1),[P,ee]=B.useState(!1),[F,I]=B.useState(!1),[te,L]=B.useState(!1),[ne,R]=B.useState(0),[re,z]=B.useState(0),ie=B.useRef(n.duration||y||Ha),ae=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||Ha,[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=Ma(),we=n.invert||t,Te=le===`loading`;_e.current=B.useMemo(()=>pe*x+Se,[pe,Se]),B.useEffect(()=>{ie.current=he},[he]),B.useEffect(()=>{j(!0)},[]),B.useEffect(()=>{let e=oe.current;if(e){let t=e.getBoundingClientRect().height;return z(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(!A)return;let e=oe.current,t=e.style.height;e.style.height=`auto`;let r=e.getBoundingClientRect().height;e.style.height=t,z(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])},[A,n.title,n.description,a,n.id,n.jsx,n.action,n.cancel]);let Ee=B.useCallback(()=>{N(!0),R(_e.current),a(e=>e.filter(e=>e.toastId!==n.id)),setTimeout(()=>{d(n)},Ka)},[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;ie.current-=e}ve.current=new Date().getTime()})():ie.current!==1/0&&(ge.current=new Date().getTime(),e=setTimeout(()=>{n.onAutoClose==null||n.onAutoClose.call(n,n),Ee()},ie.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:qa(C?.loader,n?.classNames?.loader,`sonner-loader`),"data-visible":le===`loading`},w.loading):B.createElement(Ea,{className:qa(C?.loader,n?.classNames?.loader),visible:le===`loading`})}let Oe=n.icon||w?.[le]||wa(le);return B.createElement(`li`,{tabIndex:0,ref:oe,className:qa(_,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":A,"data-promise":!!n.promise,"data-swiped":te,"data-removed":M,"data-visible":ce,"data-y-position":be,"data-x-position":xe,"data-index":c,"data-front":se,"data-swiping":P,"data-dismissible":ue,"data-type":le,"data-invert":we,"data-swipe-out":F,"data-swipe-direction":O,"data-expanded":!!(u||S&&A),"data-testid":n.testId,style:{"--index":c,"--toasts-before":c,"--z-index":l.length-c,"--offset":`${M?ne:_e.current}px`,"--initial-height":S?`auto`:`${re}px`,...m,...n.style},onDragEnd:()=>{ee(!1),D(null),ye.current=null},onPointerDown:e=>{e.button!==2&&(Te||!ue||(ae.current=new Date,R(_e.current),e.target.setPointerCapture(e.pointerId),e.target.tagName!==`BUTTON`&&(ee(!0),ye.current={x:e.clientX,y:e.clientY})))},onPointerUp:()=>{if(F||!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()-ae.current?.getTime(),i=E===`x`?e:t,a=Math.abs(i)/r;if(Math.abs(i)>=Ga||a>.11){R(_e.current),n.onDismiss==null||n.onDismiss.call(n,n),k(E===`x`?e>0?`right`:`left`:t>0?`down`:`up`),Ee(),I(!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`)}L(!1),ee(!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??Ja(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)&&L(!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:qa(C?.closeButton,n?.classNames?.closeButton)},w?.close??ja):null,(le||n.icon||n.promise)&&n.icon!==null&&(w?.[le]!==null||n.icon)?B.createElement(`div`,{"data-icon":``,className:qa(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:qa(C?.content,n?.classNames?.content)},B.createElement(`div`,{"data-title":``,className:qa(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:qa(v,fe,C?.description,n?.classNames?.description)},typeof n.description==`function`?n.description():n.description):null),B.isValidElement(n.cancel)?n.cancel:n.cancel&&Ra(n.cancel)?B.createElement(`button`,{"data-button":!0,"data-cancel":!0,style:n.cancelButtonStyle||h,onClick:e=>{Ra(n.cancel)&&ue&&(n.cancel.onClick==null||n.cancel.onClick.call(n.cancel,e),Ee())},className:qa(C?.cancelButton,n?.classNames?.cancelButton)},n.cancel.label):null,B.isValidElement(n.action)?n.action:n.action&&Ra(n.action)?B.createElement(`button`,{"data-button":!0,"data-action":!0,style:n.actionButtonStyle||g,onClick:e=>{Ra(n.action)&&(n.action.onClick==null||n.action.onClick.call(n.action,e),!e.defaultPrevented&&Ee())},className:qa(C?.actionButton,n?.classNames?.actionButton)},n.action.label):null)};function Xa(){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 Za(e,t){let n={};return[e,t].forEach((e,t)=>{let r=t===1,i=r?`--mobile-offset`:`--offset`,a=r?Va:Ba;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 Qa=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=za,toastOptions:g,dir:_=Xa(),gap:v=Wa,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,A]=B.useState(!1),[j,M]=B.useState(d===`system`?typeof window<`u`&&window.matchMedia&&window.matchMedia(`(prefers-color-scheme: dark)`).matches?`dark`:`light`:d),N=B.useRef(null),P=a.join(`+`).replace(/Key/g,``).replace(/Digit/g,``),ee=B.useRef(null),F=B.useRef(!1),I=B.useCallback(e=>{S(t=>(t.find(t=>t.id===e.id)?.delete||Pa.dismiss(e.id),t.filter(({id:t})=>t!==e.id)))},[]);return B.useEffect(()=>Pa.subscribe(e=>{if(e.dismiss){requestAnimationFrame(()=>{S(t=>t.map(t=>t.id===e.id?{...t,delete:!0}:t))});return}setTimeout(()=>{Ri.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`){M(d);return}if(d===`system`&&(window.matchMedia&&window.matchMedia(`(prefers-color-scheme: dark)`).matches?M(`dark`):M(`light`)),typeof window>`u`)return;let e=window.matchMedia(`(prefers-color-scheme: dark)`);try{e.addEventListener(`change`,({matches:e})=>{M(e?`dark`:`light`)})}catch{e.addListener(({matches:e})=>{try{M(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=N.current)==null||t.focus()}e.code===`Escape`&&(document.activeElement===N.current||N.current?.contains(document.activeElement))&&O(!1)};return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[a]),B.useEffect(()=>{if(N.current)return()=>{ee.current&&(ee.current.focus({preventScroll:!0}),ee.current=null,F.current=!1)}},[N.current]),B.createElement(`section`,{ref:t,"aria-label":`${b} ${P}`,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`?Xa():_,tabIndex:-1,ref:N,className:c,"data-sonner-toaster":!0,"data-sonner-theme":j,"data-y-position":i,"data-x-position":a,style:{"--front-toast-height":`${T[0]?.height||0}px`,"--width":`${Ua}px`,"--gap":`${v}px`,...m,...Za(l,u)},onBlur:e=>{F.current&&!e.currentTarget.contains(e.relatedTarget)&&(F.current=!1,ee.current&&=(ee.current.focus({preventScroll:!0}),null))},onFocus:e=>{e.target instanceof HTMLElement&&e.target.dataset.dismissible===`false`||F.current||(F.current=!0,ee.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`||A(!0)},onPointerUp:()=>A(!1)},C.filter(e=>!e.position&&n===0||e.position===t).map((n,i)=>B.createElement(Ya,{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:I,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 $a(e){return(0,V.jsx)(Qa,{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 eo(e,t,{checkForDefaultPrevented:n=!0}={}){return function(r){if(e?.(r),n===!1||!r||!r.defaultPrevented)return t?.(r)}}function to(e,t){if(typeof e==`function`)return e(t);e!=null&&(e.current=t)}function no(...e){return t=>{let n=!1,r=e.map(e=>{let r=to(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():to(e[t],null)}}}}function ro(...e){return B.useCallback(no(...e),e)}function io(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,ao(i,...t)]}function ao(...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 oo(e){let t=B.forwardRef((t,n)=>{let{children:r,...i}=t,a=null,o=!1,s=[];ho(r)&&typeof yo==`function`&&(r=yo(r._payload)),B.Children.forEach(r,e=>{if(po(e)){o=!0;let t=e,n=`child`in t.props?t.props.child:t.props.children;ho(n)&&typeof yo==`function`&&(n=yo(n._payload)),a=lo(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?fo(a):void 0,l=ro(n,c);if(!a){if(r||r===0)throw Error(o?vo(e):_o(e));return r}let u=uo(i,a.props??{});return a.type!==B.Fragment&&(u.ref=n?l:c),B.cloneElement(a,u)});return t.displayName=`${e}.Slot`,t}var so=Symbol.for(`radix.slottable`);function co(e){let t=e=>`child`in e?e.children(e.child):e.children;return t.displayName=`${e}.Slottable`,t.__radixId=so,t}var lo=(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 uo(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 fo(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 po(e){return B.isValidElement(e)&&typeof e.type==`function`&&`__radixId`in e.type&&e.type.__radixId===so}var mo=Symbol.for(`react.lazy`);function ho(e){return typeof e==`object`&&!!e&&`$$typeof`in e&&e.$$typeof===mo&&`_payload`in e&&go(e._payload)}function go(e){return typeof e==`object`&&!!e&&`then`in e}var _o=e=>`${e} failed to slot onto its children. Expected a single React element child or \`Slottable\`.`,vo=e=>`${e} failed to slot onto its \`Slottable\`. Expected \`Slottable\` to receive a single React element child.`,yo=B.use,bo=[`a`,`button`,`div`,`form`,`h2`,`h3`,`img`,`input`,`label`,`li`,`nav`,`ol`,`p`,`select`,`span`,`svg`,`ul`].reduce((e,t)=>{let n=oo(`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 xo(e,t){e&&Ri.flushSync(()=>e.dispatchEvent(t))}function So(e){let t=B.useRef(e);return B.useEffect(()=>{t.current=e}),B.useMemo(()=>((...e)=>t.current?.(...e)),[])}var Co=`DismissableLayer`,wo=`dismissableLayer.update`,To=`dismissableLayer.pointerDownOutside`,Eo=`dismissableLayer.focusOutside`,Do,Oo=B.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set,dismissableSurfaces:new Set}),ko=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(Oo),[d,f]=B.useState(null),p=d?.ownerDocument??globalThis?.document,[,m]=B.useState({}),h=ro(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=No(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=Po(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=So(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&&(Do=p.body.style.pointerEvents,p.body.style.pointerEvents=`none`),u.layersWithOutsidePointerEventsDisabled.add(d)),u.layers.add(d),Fo(),()=>{n&&(u.layersWithOutsidePointerEventsDisabled.delete(d),u.layersWithOutsidePointerEventsDisabled.size===0&&(p.body.style.pointerEvents=Do))}},[d,p,n,u]),B.useEffect(()=>()=>{d&&(u.layers.delete(d),u.layersWithOutsidePointerEventsDisabled.delete(d),Fo())},[d,u]),B.useEffect(()=>{let e=()=>m({});return document.addEventListener(wo,e),()=>document.removeEventListener(wo,e)},[]),(0,V.jsx)(bo.div,{...l,ref:h,style:{pointerEvents:b?x?`auto`:`none`:void 0,...e.style},onFocusCapture:eo(e.onFocusCapture,w.onFocusCapture),onBlurCapture:eo(e.onBlurCapture,w.onBlurCapture),onPointerDownCapture:eo(e.onPointerDownCapture,C.onPointerDownCapture)})});ko.displayName=Co;var Ao=`DismissableLayerBranch`,jo=B.forwardRef((e,t)=>{let n=B.useContext(Oo),r=B.useRef(null),i=ro(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)(bo.div,{...e,ref:i})});jo.displayName=Ao;var Mo=()=>!0;function No(e,t){let{ownerDocument:n=globalThis?.document,deferPointerDownOutside:r=!1,isDeferredPointerDownOutsideRef:i,dismissableSurfaces:a,shouldHandlePointerDownOutside:o=Mo}=t,s=So(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||Io(To,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 Po(e,t=globalThis?.document){let n=So(e),r=B.useRef(!1);return B.useEffect(()=>{let e=e=>{e.target&&!r.current&&Io(Eo,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 Fo(){let e=new CustomEvent(wo);document.dispatchEvent(e)}function Io(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?xo(i,a):i.dispatchEvent(a)}var Lo=globalThis?.document?B.useLayoutEffect:()=>{},Ro=B.useId||(()=>void 0),zo=0;function Bo(e){let[t,n]=B.useState(Ro());return Lo(()=>{e||n(e=>e??String(zo++))},[e]),e||(t?`radix-${t}`:``)}var Vo=[`top`,`right`,`bottom`,`left`],Ho=Math.min,Uo=Math.max,Wo=Math.round,Go=Math.floor,Ko=e=>({x:e,y:e}),qo={left:`right`,right:`left`,bottom:`top`,top:`bottom`};function Jo(e,t,n){return Uo(e,Ho(t,n))}function Yo(e,t){return typeof e==`function`?e(t):e}function Xo(e){return e.split(`-`)[0]}function Zo(e){return e.split(`-`)[1]}function Qo(e){return e===`x`?`y`:`x`}function $o(e){return e===`y`?`height`:`width`}function es(e){let t=e[0];return t===`t`||t===`b`?`y`:`x`}function ts(e){return Qo(es(e))}function ns(e,t,n){n===void 0&&(n=!1);let r=Zo(e),i=ts(e),a=$o(i),o=i===`x`?r===(n?`end`:`start`)?`right`:`left`:r===`start`?`bottom`:`top`;return t.reference[a]>t.floating[a]&&(o=ds(o)),[o,ds(o)]}function rs(e){let t=ds(e);return[is(e),t,is(t)]}function is(e){return e.includes(`start`)?e.replace(`start`,`end`):e.replace(`end`,`start`)}var as=[`left`,`right`],os=[`right`,`left`],ss=[`top`,`bottom`],cs=[`bottom`,`top`];function ls(e,t,n){switch(e){case`top`:case`bottom`:return n?t?os:as:t?as:os;case`left`:case`right`:return t?ss:cs;default:return[]}}function us(e,t,n,r){let i=Zo(e),a=ls(Xo(e),n===`start`,r);return i&&(a=a.map(e=>e+`-`+i),t&&(a=a.concat(a.map(is)))),a}function ds(e){let t=Xo(e);return qo[t]+e.slice(t.length)}function fs(e){return{top:e.top??0,right:e.right??0,bottom:e.bottom??0,left:e.left??0}}function ps(e){return typeof e==`number`?{top:e,right:e,bottom:e,left:e}:fs(e)}function ms(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 hs(e,t,n){let{reference:r,floating:i}=e,a=es(t),o=ts(t),s=$o(o),c=Xo(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=Zo(t);return m&&(p[o]+=f*(m===`end`?1:-1)*(n&&l?-1:1)),p}async function gs(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}=Yo(t,e),p=ps(f),m=o[d?u===`floating`?`reference`:`floating`:u],h=ms(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=ms(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 _s=50,vs=async(e,t,n)=>{let{placement:r=`bottom`,strategy:i=`absolute`,middleware:a=[],platform:o}=n,s=o.detectOverflow?o:{...o,detectOverflow:gs},c=await(o.isRTL==null?void 0:o.isRTL(t)),l=await o.getElementRects({reference:e,floating:t,strategy:i}),{x:u,y:d}=hs(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<_s&&(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}=hs(l,f,c)),n=-1)}return{x:u,y:d,placement:f,strategy:i,middlewareData:m}},ys=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}=Yo(e,t)||{};if(l==null)return{};let d=ps(u),f={x:n,y:r},p=ts(i),m=$o(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=Ho(d[_],T),D=Ho(d[v],T),O=C-h[m]-D,k=C/2-h[m]/2+w,A=Jo(E,k,O),j=!c.arrow&&Zo(i)!=null&&k!==A&&a.reference[m]/2-(k<E?E:D)-h[m]/2<0,M=j?k<E?k-E:k-O:0;return{[p]:f[p]+M,data:{[p]:A,centerOffset:k-A-M,...j&&{alignmentOffset:M}},reset:j}}}),bs=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}=Yo(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};let g=Xo(r),_=es(o),v=Xo(o)===o,y=await(s.isRTL==null?void 0:s.isRTL(c.floating)),b=d||(v||!m?[ds(o)]:rs(o)),x=p!==`none`;!d&&x&&b.push(...us(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=ns(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`&&_!==es(t))||T.every(e=>es(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=es(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 xs(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function Ss(e){return Vo.some(t=>e[t]>=0)}var Cs=function(e){return e===void 0&&(e={}),{name:`hide`,options:e,async fn(t){let{rects:n,platform:r}=t,{strategy:i=`referenceHidden`,...a}=Yo(e,t);switch(i){case`referenceHidden`:{let e=xs(await r.detectOverflow(t,{...a,elementContext:`reference`}),n.reference);return{data:{referenceHiddenOffsets:e,referenceHidden:Ss(e)}}}case`escaped`:{let e=xs(await r.detectOverflow(t,{...a,altBoundary:!0}),n.floating);return{data:{escapedOffsets:e,escaped:Ss(e)}}}default:return{}}}}},ws=new Set([`left`,`top`]);async function Ts(e,t){let{placement:n,platform:r,elements:i}=e,a=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=Xo(n),s=Zo(n),c=es(n)===`y`,l=ws.has(o)?-1:1,u=a&&c?-1:1,d=Yo(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 Es=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 Ts(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}}}}},Ds=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}=Yo(e,t),u={x:n,y:r},d=await a.detectOverflow(t,l),f=es(i),p=Qo(f),m=u[p],h=u[f],g=(e,t)=>Jo(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}}}}}},Os=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}=Yo(e,t),u={x:n,y:r},d=es(i),f=Qo(d),p=u[f],m=u[d],h=Yo(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=ws.has(Xo(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}}}},ks=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}=Yo(e,t),c=await i.detectOverflow(t,s),l=Xo(n),u=Zo(n),d=es(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=Ho(p-c[m],g),y=Ho(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*Uo(c.left,c.right):S=p-2*Uo(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 As(){return typeof window<`u`}function js(e){return Ps(e)?(e.nodeName||``).toLowerCase():`#document`}function Ms(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Ns(e){return((Ps(e)?e.ownerDocument:e.document)||window.document)?.documentElement}function Ps(e){return As()?e instanceof Node||e instanceof Ms(e).Node:!1}function Fs(e){return As()?e instanceof Element||e instanceof Ms(e).Element:!1}function Is(e){return As()?e instanceof HTMLElement||e instanceof Ms(e).HTMLElement:!1}function Ls(e){return!As()||typeof ShadowRoot>`u`?!1:e instanceof ShadowRoot||e instanceof Ms(e).ShadowRoot}function Rs(e){let{overflow:t,overflowX:n,overflowY:r,display:i}=Ys(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&i!==`inline`&&i!==`contents`}function zs(e){return/^(table|td|th)$/.test(js(e))}function Bs(e){try{if(e.matches(`:popover-open`))return!0}catch{}try{return e.matches(`:modal`)}catch{return!1}}var Vs=/transform|translate|scale|rotate|perspective|filter/,Hs=/paint|layout|strict|content/,Us=e=>!!e&&e!==`none`,Ws;function Gs(e){let t=Fs(e)?Ys(e):e;return Us(t.transform)||Us(t.translate)||Us(t.scale)||Us(t.rotate)||Us(t.perspective)||!qs()&&(Us(t.backdropFilter)||Us(t.filter))||Vs.test(t.willChange||``)||Hs.test(t.contain||``)}function Ks(e){let t=Zs(e);for(;Is(t)&&!Js(t);){if(Gs(t))return t;if(Bs(t))return null;t=Zs(t)}return null}function qs(){return Ws??=typeof CSS<`u`&&CSS.supports&&CSS.supports(`-webkit-backdrop-filter`,`none`),Ws}function Js(e){return/^(html|body|#document)$/.test(js(e))}function Ys(e){return Ms(e).getComputedStyle(e)}function Xs(e){return Fs(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Zs(e){if(js(e)===`html`)return e;let t=e.assignedSlot||e.parentNode||Ls(e)&&e.host||Ns(e);return Ls(t)?t.host:t}function Qs(e){let t=Zs(e);return Js(t)?(e.ownerDocument||e).body:Is(t)&&Rs(t)?t:Qs(t)}function $s(e,t,n){t===void 0&&(t=[]),n===void 0&&(n=!0);let r=Qs(e),i=r===e.ownerDocument?.body,a=Ms(r);if(i){let e=ec(a);return t.concat(a,a.visualViewport||[],Rs(r)?r:[],e&&n?$s(e):[])}else return t.concat(r,$s(r,[],n))}function ec(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function tc(e){let t=Ys(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,i=Is(e),a=i?e.offsetWidth:n,o=i?e.offsetHeight:r,s=Wo(n)!==a||Wo(r)!==o;return s&&(n=a,r=o),{width:n,height:r,$:s}}function nc(e){return Fs(e)?e:e.contextElement}function rc(e){let t=nc(e);if(!Is(t))return Ko(1);let n=t.getBoundingClientRect(),{width:r,height:i,$:a}=tc(t),o=(a?Wo(n.width):n.width)/r,s=(a?Wo(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!s||!Number.isFinite(s))&&(s=1),{x:o,y:s}}var ic=Ko(0);function ac(e){let t=Ms(e);return!qs()||!t.visualViewport?ic:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function oc(e,t,n){return t===void 0&&(t=!1),!!n&&t&&n===Ms(e)}function sc(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);let i=e.getBoundingClientRect(),a=nc(e),o=Ko(1);t&&(r?Fs(r)&&(o=rc(r)):o=rc(e));let s=oc(a,n,r)?ac(a):Ko(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=Ms(a),t=Fs(r)?Ms(r):r,n=e,i=ec(n);for(;i&&t!==n;){let e=rc(i),t=i.getBoundingClientRect(),r=Ys(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=Ms(i),i=ec(n)}}return ms({width:u,height:d,x:c,y:l})}function cc(e,t){let n=Xs(e).scrollLeft;return t?t.left+n:sc(Ns(e)).left+n}function lc(e,t){let n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-cc(e,n),y:n.top+t.scrollTop}}function uc(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e,a=i===`fixed`,o=Ns(r),s=t?Bs(t.floating):!1;if(r===o||s&&a)return n;let c={scrollLeft:0,scrollTop:0},l=Ko(1),u=Ko(0),d=Is(r);if((d||!a)&&((js(r)!==`body`||Rs(o))&&(c=Xs(r)),d)){let e=sc(r);l=rc(r),u.x=e.x+r.clientLeft,u.y=e.y+r.clientTop}let f=o&&!d&&!a?lc(o,c):Ko(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 dc(e){return e.getClientRects?Array.from(e.getClientRects()):[]}function fc(e){let t=Xs(e),n=e.ownerDocument.body,r=Uo(e.scrollWidth,e.clientWidth,n.scrollWidth,n.clientWidth),i=Uo(e.scrollHeight,e.clientHeight,n.scrollHeight,n.clientHeight),a=-t.scrollLeft+cc(e),o=-t.scrollTop;return Ys(n).direction===`rtl`&&(a+=Uo(e.clientWidth,n.clientWidth)-r),{width:r,height:i,x:a,y:o}}var pc=25;function mc(e,t,n){n===void 0&&(n=`viewport`);let r=n===`layoutViewport`,i=Ms(e),a=Ns(e),o=i.visualViewport,s=a.clientWidth,c=a.clientHeight,l=0,u=0;if(o){let e=!qs()||t===`fixed`;r?e||(l=-o.offsetLeft,u=-o.offsetTop):(s=o.width,c=o.height,e&&(l=o.offsetLeft,u=o.offsetTop))}if(cc(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<=pc&&(s-=o)}return{width:s,height:c,x:l,y:u}}function hc(e,t){let n=sc(e,!0,t===`fixed`),r=n.top+e.clientTop,i=n.left+e.clientLeft,a=rc(e);return{width:e.clientWidth*a.x,height:e.clientHeight*a.y,x:i*a.x,y:r*a.y}}function gc(e,t,n){let r;if(t===`viewport`||t===`layoutViewport`)r=mc(e,n,t);else if(t===`document`)r=fc(Ns(e));else if(Fs(t))r=hc(t,n);else{let n=ac(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return ms(r)}function _c(e,t){let n=t.get(e);if(n)return n;let r=$s(e,[],!1).filter(e=>Fs(e)&&js(e)!==`body`),i=null,a=Ys(e).position===`fixed`,o=a?Zs(e):e;for(;Fs(o)&&!Js(o);){let e=Ys(o),t=Gs(o),n=i?i.position:a?`fixed`:``;!t&&(n===`fixed`||n===`absolute`&&e.position===`static`)?r=r.filter(e=>e!==o):i=e,o=Zs(o)}return t.set(e,r),r}function vc(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e,a=[...n===`clippingAncestors`?Bs(t)?[]:_c(t,this._c):[].concat(n),r],o=gc(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=gc(t,a[e],i);s=Uo(n.top,s),c=Ho(n.right,c),l=Ho(n.bottom,l),u=Uo(n.left,u)}return{width:c-u,height:l-s,x:u,y:s}}function yc(e){let{width:t,height:n}=tc(e);return{width:t,height:n}}function bc(e,t,n){let r=Is(t),i=Ns(t),a=n===`fixed`,o=sc(e,!0,a,t),s={scrollLeft:0,scrollTop:0},c=Ko(0);if((r||!a)&&((js(t)!==`body`||Rs(i))&&(s=Xs(t)),r)){let e=sc(t,!0,a,t);c.x=e.x+t.clientLeft,c.y=e.y+t.clientTop}!r&&i&&(c.x=cc(i));let l=i&&!r&&!a?lc(i,s):Ko(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 xc(e){return Ys(e).position===`static`}function Sc(e,t){if(!Is(e)||Ys(e).position===`fixed`)return null;if(t)return t(e);let n=e.offsetParent;return Ns(e)===n&&(n=n.ownerDocument.body),n}function Cc(e,t){let n=Ms(e);if(Bs(e))return n;if(!Is(e)){let t=Zs(e);for(;t&&!Js(t);){if(Fs(t)&&!xc(t))return t;t=Zs(t)}return n}let r=Sc(e,t);for(;r&&zs(r)&&xc(r);)r=Sc(r,t);return r&&Js(r)&&xc(r)&&!Gs(r)?n:r||Ks(e)||n}var wc=async function(e){let t=this.getOffsetParent||Cc,n=this.getDimensions,r=await n(e.floating);return{reference:bc(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function Tc(e){return Ys(e).direction===`rtl`}var Ec={convertOffsetParentRelativeRectToViewportRelativeRect:uc,getDocumentElement:Ns,getClippingRect:vc,getOffsetParent:Cc,getElementRects:wc,getClientRects:dc,getDimensions:yc,getScale:rc,isElement:Fs,isRTL:Tc};function Dc(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function Oc(e,t,n){let r=null,i,a=Ns(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=Go(d),h=Go(a.clientWidth-(u+f)),g=Go(a.clientHeight-(d+p)),_=Go(u),v={rootMargin:-m+`px `+-h+`px `+-g+`px `+-_+`px`,threshold:Uo(0,Ho(1,c))||1},y=!0;function b(t){let n=t[0].intersectionRatio;if(!Dc(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=Ms(e),l=()=>s(n);return c.addEventListener(`resize`,l),s(!0),()=>{c.removeEventListener(`resize`,l),o()}}function kc(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=nc(e),u=i||a?[...l?$s(l):[],...t?$s(t):[]]:[];u.forEach(e=>{i&&e.addEventListener(`scroll`,n),a&&e.addEventListener(`resize`,n)});let d=l&&s?Oc(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?sc(e):null;c&&g();function g(){let t=sc(e);h&&!Dc(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 Ac=Es,jc=Ds,Mc=bs,Nc=ks,Pc=Cs,Fc=ys,Ic=Os,Lc=(e,t,n)=>{let r=new Map,i=n??{},a={...Ec,...i.platform,_c:r};return vs(e,t,{...i,platform:a})},Rc=typeof document<`u`?B.useLayoutEffect:function(){};function zc(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(!zc(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)&&!zc(e[n],t[n]))return!1}return!0}return e!==e&&t!==t}function Bc(e){return typeof window>`u`?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Vc(e,t){let n=Bc(e);return Math.round(t*n)/n}function Hc(e){let t=B.useRef(e);return Rc(()=>{t.current=e}),t}function Uc(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);zc(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=Hc(c),D=Hc(i),O=Hc(l),k=B.useCallback(()=>{if(!S.current||!C.current)return;let e={placement:t,strategy:n,middleware:f};D.current&&(e.platform=D.current),Lc(S.current,C.current,e).then(e=>{let t={...e,isPositioned:O.current!==!1};A.current&&!zc(w.current,t)&&(w.current=t,Ri.flushSync(()=>{d(t)}))})},[f,t,n,D,O]);Rc(()=>{l===!1&&w.current.isPositioned&&(w.current.isPositioned=!1,d(e=>({...e,isPositioned:!1})))},[l]);let A=B.useRef(!1);Rc(()=>(A.current=!0,()=>{A.current=!1}),[]),Rc(()=>{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 j=B.useMemo(()=>({reference:S,floating:C,setReference:v,setFloating:y}),[v,y]),M=B.useMemo(()=>({reference:b,floating:x}),[b,x]),N=B.useMemo(()=>{let e={position:n,left:0,top:0};if(!M.floating)return e;let t=Vc(M.floating,u.x),r=Vc(M.floating,u.y);return s?{...e,transform:`translate(`+t+`px, `+r+`px)`,...Bc(M.floating)>=1.5&&{willChange:`transform`}}:{position:n,left:t,top:r}},[n,s,M.floating,u.x,u.y]);return B.useMemo(()=>({...u,update:k,refs:j,elements:M,floatingStyles:N}),[u,k,j,M,N])}var Wc=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?{}:Fc({element:r.current,padding:i}).fn(n):r?Fc({element:r,padding:i}).fn(n):{}}}},Gc=(e,t)=>{let n=Ac(e);return{name:n.name,fn:n.fn,options:[e,t]}},Kc=(e,t)=>{let n=jc(e);return{name:n.name,fn:n.fn,options:[e,t]}},qc=(e,t)=>({fn:Ic(e).fn,options:[e,t]}),Jc=(e,t)=>{let n=Mc(e);return{name:n.name,fn:n.fn,options:[e,t]}},Yc=(e,t)=>{let n=Nc(e);return{name:n.name,fn:n.fn,options:[e,t]}},Xc=(e,t)=>{let n=Pc(e);return{name:n.name,fn:n.fn,options:[e,t]}},Zc=(e,t)=>{let n=Wc(e);return{name:n.name,fn:n.fn,options:[e,t]}},Qc=`Arrow`,$c=B.forwardRef((e,t)=>{let{children:n,width:r=10,height:i=5,...a}=e;return(0,V.jsx)(bo.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`})})});$c.displayName=Qc;var el=$c;function tl(e){let[t,n]=B.useState(void 0);return Lo(()=>{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 nl=`Popper`,[rl,il]=io(nl),[al,ol]=rl(nl),sl=e=>{let{__scopePopper:t,children:n}=e,[r,i]=B.useState(null),[a,o]=B.useState(void 0);return(0,V.jsx)(al,{scope:t,anchor:r,onAnchorChange:i,placementState:a,setPlacementState:o,children:n})};sl.displayName=nl;var cl=`PopperAnchor`,ll=B.forwardRef((e,t)=>{let{__scopePopper:n,virtualRef:r,...i}=e,a=ol(cl,n),o=B.useRef(null),s=a.onAnchorChange,c=ro(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&&yl(a.placementState),d=u?.[0],f=u?.[1];return r?null:(0,V.jsx)(bo.div,{"data-radix-popper-side":d,"data-radix-popper-align":f,...i,ref:c})});ll.displayName=cl;var ul=`PopperContent`,[dl,fl]=rl(ul),pl=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=ol(ul,n),[_,v]=B.useState(null),y=ro(t,v),[b,x]=B.useState(null),S=tl(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(_l),altBoundary:O},{refs:A,floatingStyles:j,placement:M,isPositioned:N,middlewareData:P}=Uc({strategy:`fixed`,placement:T,whileElementsMounted:(...e)=>kc(...e,{animationFrame:p===`always`}),elements:{reference:g.anchor},middleware:[Gc({mainAxis:i+w,alignmentAxis:o}),c&&Kc({mainAxis:!0,crossAxis:!1,limiter:d===`partial`?qc():void 0,...k}),c&&Jc({...k}),Yc({...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&&Zc({element:b,padding:s}),vl({arrowWidth:C,arrowHeight:w}),f&&Xc({strategy:`referenceHidden`,...k,boundary:O?k.boundary:void 0})]}),ee=g.setPlacementState;Lo(()=>(ee(M),()=>{ee(void 0)}),[M,ee]);let[F,I]=yl(M),te=So(m);Lo(()=>{N&&te?.()},[N,te]);let L=P.arrow?.x,ne=P.arrow?.y,R=P.arrow?.centerOffset!==0,[re,z]=B.useState();return Lo(()=>{_&&z(window.getComputedStyle(_).zIndex)},[_]),(0,V.jsx)(`div`,{ref:A.setFloating,"data-radix-popper-content-wrapper":``,style:{...j,transform:N?j.transform:`translate(0, -200%)`,minWidth:`max-content`,zIndex:re,"--radix-popper-transform-origin":[P.transformOrigin?.x,P.transformOrigin?.y].join(` `),...P.hide?.referenceHidden&&{visibility:`hidden`,pointerEvents:`none`}},dir:e.dir,children:(0,V.jsx)(dl,{scope:n,placedSide:F,placedAlign:I,onArrowChange:x,arrowX:L,arrowY:ne,shouldHideArrow:R,children:(0,V.jsx)(bo.div,{"data-side":F,"data-align":I,...h,ref:y,style:{...h.style,animation:N?void 0:`none`}})})})});pl.displayName=ul;var ml=`PopperArrow`,hl={top:`bottom`,right:`left`,bottom:`top`,left:`right`},gl=B.forwardRef(function(e,t){let{__scopePopper:n,...r}=e,i=fl(ml,n),a=hl[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)(el,{...r,ref:t,style:{...r.style,display:`block`}})})});gl.displayName=ml;function _l(e){return e!==null}var vl=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]=yl(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 yl(e){let[t,n=`center`]=e.split(`-`);return[t,n]}var bl=sl,xl=ll,Sl=pl,Cl=gl,wl=`Portal`,Tl=B.forwardRef((e,t)=>{let{container:n,...r}=e,[i,a]=B.useState(!1);Lo(()=>a(!0),[]);let o=n||i&&globalThis?.document?.body;return o?Ri.createPortal((0,V.jsx)(bo.div,{...r,ref:t}),o):null});Tl.displayName=wl;function El(e,t){return B.useReducer((e,n)=>t[e][n]??e,e)}var Dl=e=>{let{present:t,children:n}=e,r=Ol(t),i=typeof n==`function`?n({present:r.isPresent}):B.Children.only(n),a=Al(r.ref,Ml(i));return typeof n==`function`||r.isPresent?B.cloneElement(i,{ref:a}):null};Dl.displayName=`Presence`;function Ol(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]=El(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??jl(r.current),o.current=void 0):a.current=`none`},[s]),Lo(()=>{let t=r.current,n=i.current;if(n!==e){let r=a.current,s=jl(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]),Lo(()=>{if(t){let e,n=t.ownerDocument.defaultView??window,o=a=>{let o=jl(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=jl(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=jl(t)}else r.current=null;n(e)},[])}}function kl(e,t){if(typeof e==`function`)return e(t);e!=null&&(e.current=t)}function Al(...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=kl(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():kl(n[e],null)}}},[])}function jl(e){return e?.animationName||`none`}function Ml(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 Nl=B.useInsertionEffect||Lo;function Pl({prop:e,defaultProp:t,onChange:n=()=>{},caller:r}){let[i,a,o]=Fl({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=Il(t)?t(e):t;n!==e&&o.current?.(n)}else a(t)},[s,e,a,o])]}function Fl({defaultProp:e,onChange:t}){let[n,r]=B.useState(e),i=B.useRef(n),a=B.useRef(t);return Nl(()=>{a.current=t},[t]),B.useEffect(()=>{i.current!==n&&(a.current?.(n),i.current=n)},[n,i]),[n,r,a]}function Il(e){return typeof e==`function`}var Ll=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`}),Rl=`VisuallyHidden`,zl=B.forwardRef((e,t)=>(0,V.jsx)(bo.span,{...e,ref:t,style:{...Ll,...e.style}}));zl.displayName=Rl;var Bl=zl,[Vl,Hl]=io(`Tooltip`,[il]),Ul=il(),Wl=`TooltipProvider`,Gl=700,Kl=`tooltip.open`,[ql,Jl]=Vl(Wl),Yl=e=>{let{__scopeTooltip:t,delayDuration:n=Gl,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)(ql,{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})};Yl.displayName=Wl;var Xl=`Tooltip`,[Zl,Ql]=Vl(Xl),$l=e=>{let{__scopeTooltip:t,children:n,open:r,defaultOpen:i,onOpenChange:a,disableHoverableContent:o,delayDuration:s}=e,c=Jl(Xl,e.__scopeTooltip),l=Ul(t),[u,d]=B.useState(null),f=Bo(),p=B.useRef(0),m=o??c.disableHoverableContent,h=s??c.delayDuration,g=B.useRef(!1),[_,v]=Pl({prop:r,defaultProp:i??!1,onChange:e=>{e?(c.onOpen(),document.dispatchEvent(new CustomEvent(Kl))):c.onClose(),a?.(e)},caller:Xl}),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)(bl,{...l,children:(0,V.jsx)(Zl,{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})})};$l.displayName=Xl;var eu=`TooltipTrigger`,tu=B.forwardRef((e,t)=>{let{__scopeTooltip:n,...r}=e,i=Ql(eu,n),a=Jl(eu,n),o=Ul(n),s=ro(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)(xl,{asChild:!0,...o,children:(0,V.jsx)(bo.button,{"aria-describedby":i.open?i.contentId:void 0,"data-state":i.stateAttribute,...r,ref:s,onPointerMove:eo(e.onPointerMove,e=>{e.pointerType!==`touch`&&!l.current&&!a.isPointerInTransitRef.current&&(i.onTriggerEnter(),l.current=!0)}),onPointerLeave:eo(e.onPointerLeave,()=>{i.onTriggerLeave(),l.current=!1}),onPointerDown:eo(e.onPointerDown,()=>{i.open&&i.onClose(),c.current=!0,document.addEventListener(`pointerup`,u,{once:!0})}),onFocus:eo(e.onFocus,()=>{c.current||i.onOpen()}),onBlur:eo(e.onBlur,i.onClose),onClick:eo(e.onClick,i.onClose)})})});tu.displayName=eu;var nu=`TooltipPortal`,[ru,iu]=Vl(nu,{forceMount:void 0}),au=e=>{let{__scopeTooltip:t,forceMount:n,children:r,container:i}=e,a=Ql(nu,t);return(0,V.jsx)(ru,{scope:t,forceMount:n,children:(0,V.jsx)(Dl,{present:n||a.open,children:(0,V.jsx)(Tl,{asChild:!0,container:i,children:r})})})};au.displayName=nu;var ou=`TooltipContent`,su=B.forwardRef((e,t)=>{let n=iu(ou,e.__scopeTooltip),{forceMount:r=n.forceMount,side:i=`top`,...a}=e,o=Ql(ou,e.__scopeTooltip);return(0,V.jsx)(Dl,{present:r||o.open,children:o.disableHoverableContent?(0,V.jsx)(fu,{side:i,...a,ref:t}):(0,V.jsx)(cu,{side:i,...a,ref:t})})}),cu=B.forwardRef((e,t)=>{let n=Ql(ou,e.__scopeTooltip),r=Jl(ou,e.__scopeTooltip),i=B.useRef(null),a=ro(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=gu(r,hu(r,n.getBoundingClientRect())),a=_u(t.getBoundingClientRect()),o=yu([...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=!vu(n,o);r?f():i&&(f(),l())};return document.addEventListener(`pointermove`,e),()=>document.removeEventListener(`pointermove`,e)}},[c,u,o,l,f]),(0,V.jsx)(fu,{...e,ref:a})}),[lu,uu]=Vl(Xl,{isInside:!1}),du=co(`TooltipContent`),fu=B.forwardRef((e,t)=>{let{__scopeTooltip:n,children:r,"aria-label":i,onEscapeKeyDown:a,onPointerDownOutside:o,...s}=e,c=Ql(ou,n),l=Ul(n),{onClose:u}=c;return B.useEffect(()=>(document.addEventListener(Kl,u),()=>document.removeEventListener(Kl,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)(ko,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:a,onPointerDownOutside:o,onFocusOutside:e=>e.preventDefault(),onDismiss:u,children:(0,V.jsxs)(Sl,{"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)(du,{children:r}),(0,V.jsx)(lu,{scope:n,isInside:!0,children:(0,V.jsx)(Bl,{id:c.contentId,role:`tooltip`,children:i||r})})]})})});su.displayName=ou;var pu=`TooltipArrow`,mu=B.forwardRef((e,t)=>{let{__scopeTooltip:n,...r}=e,i=Ul(n);return uu(pu,n).isInside?null:(0,V.jsx)(Cl,{...i,...r,ref:t})});mu.displayName=pu;function hu(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 gu(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 _u(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 vu(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 yu(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)),bu(t)}function bu(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 xu=Yl,Su=$l,Cu=tu,wu=au,Tu=su;function Eu(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=Eu(e[t]))&&(r&&(r+=` `),r+=n)}else for(n in e)e[n]&&(r&&(r+=` `),r+=n);return r}function Du(){for(var e,t,n=0,r=``,i=arguments.length;n<i;n++)(e=arguments[n])&&(t=Eu(e))&&(r&&(r+=` `),r+=t);return r}var Ou=(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},ku=(e,t)=>({classGroupId:e,validator:t}),Au=(e=new Map,t=null,n)=>({nextPart:e,validators:t,classGroupId:n}),ju=`-`,Mu=[],Nu=`arbitrary..`,Pu=e=>{let t=Lu(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:e=>{if(e.startsWith(`[`)&&e.endsWith(`]`))return Iu(e);let n=e.split(ju);return Fu(n,+(n[0]===``&&n.length>1),t)},getConflictingClassGroupIds:(e,t)=>{if(t){let t=r[e],i=n[e];return t?i?Ou(i,t):t:i||Mu}return n[e]||Mu}}},Fu=(e,t,n)=>{if(e.length-t===0)return n.classGroupId;let r=e[t],i=n.nextPart.get(r);if(i){let n=Fu(e,t+1,i);if(n)return n}let a=n.validators;if(a===null)return;let o=t===0?e.join(ju):e.slice(t).join(ju),s=a.length;for(let e=0;e<s;e++){let t=a[e];if(t.validator(o))return t.classGroupId}},Iu=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?Nu+r:void 0})(),Lu=e=>{let{theme:t,classGroups:n}=e;return Ru(n,t)},Ru=(e,t)=>{let n=Au();for(let r in e){let i=e[r];zu(i,n,r,t)}return n},zu=(e,t,n,r)=>{let i=e.length;for(let a=0;a<i;a++){let i=e[a];Bu(i,t,n,r)}},Bu=(e,t,n,r)=>{if(typeof e==`string`){Vu(e,t,n);return}if(typeof e==`function`){Hu(e,t,n,r);return}Uu(e,t,n,r)},Vu=(e,t,n)=>{let r=e===``?t:Wu(t,e);r.classGroupId=n},Hu=(e,t,n,r)=>{if(Gu(e)){zu(e(r),t,n,r);return}t.validators===null&&(t.validators=[]),t.validators.push(ku(n,e))},Uu=(e,t,n,r)=>{let i=Object.entries(e),a=i.length;for(let e=0;e<a;e++){let[a,o]=i[e];zu(o,Wu(t,a),n,r)}},Wu=(e,t)=>{let n=e,r=t.split(ju),i=r.length;for(let e=0;e<i;e++){let t=r[e],i=n.nextPart.get(t);i||(i=Au(),n.nextPart.set(t,i)),n=i}return n},Gu=e=>`isThemeGetter`in e&&e.isThemeGetter===!0,Ku=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)}}},qu=`!`,Ju=`:`,Yu=[],Xu=(e,t,n,r,i)=>({modifiers:e,hasImportantModifier:t,baseClassName:n,maybePostfixModifierPosition:r,isExternal:i}),Zu=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===Ju){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(qu)?(c=s.slice(0,-1),l=!0):s.startsWith(qu)&&(c=s.slice(1),l=!0);let u=a&&a>i?a-i:void 0;return Xu(t,l,c,u)};if(t){let e=t+Ju,n=r;r=t=>t.startsWith(e)?n(t.slice(e.length)):Xu(Yu,!1,t,void 0,!0)}if(n){let e=r;r=t=>n({className:t,parseClassName:e})}return r},Qu=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}},$u=e=>({cache:Ku(e.cacheSize),parseClassName:Zu(e),sortModifiers:Qu(e),postfixLookupClassGroupIds:ed(e),...Pu(e)}),ed=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},td=/\s+/,nd=(e,t)=>{let{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:i,sortModifiers:a,postfixLookupClassGroupIds:o}=t,s=[],c=e.trim().split(td),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?_+qu:_,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},rd=(...e)=>{let t=0,n,r,i=``;for(;t<e.length;)(n=e[t++])&&(r=id(n))&&(i&&(i+=` `),i+=r);return i},id=e=>{if(typeof e==`string`)return e;let t,n=``;for(let r=0;r<e.length;r++)e[r]&&(t=id(e[r]))&&(n&&(n+=` `),n+=t);return n},ad=(e,...t)=>{let n,r,i,a,o=o=>(n=$u(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=nd(e,n);return i(e,a),a};return a=o,(...e)=>a(rd(...e))},od=[],sd=e=>{let t=t=>t[e]||od;return t.isThemeGetter=!0,t},cd=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,ld=/^\((?:(\w[\w-]*):)?(.+)\)$/i,ud=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,dd=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,fd=/\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$/,pd=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,md=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,hd=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,gd=e=>ud.test(e),_d=e=>!!e&&!Number.isNaN(Number(e)),vd=e=>!!e&&Number.isInteger(Number(e)),yd=e=>e.endsWith(`%`)&&_d(e.slice(0,-1)),bd=e=>dd.test(e),xd=()=>!0,Sd=e=>fd.test(e)&&!pd.test(e),Cd=()=>!1,wd=e=>md.test(e),Td=e=>hd.test(e),Ed=e=>!H(e)&&!U(e),Dd=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)),Od=e=>Ud(e,qd,Cd),H=e=>cd.test(e),kd=e=>Ud(e,Jd,Sd),Ad=e=>Ud(e,Yd,_d),jd=e=>Ud(e,Zd,xd),Md=e=>Ud(e,Xd,Cd),Nd=e=>Ud(e,Gd,Cd),Pd=e=>Ud(e,Kd,Td),Fd=e=>Ud(e,Qd,wd),U=e=>ld.test(e),Id=e=>Wd(e,Jd),Ld=e=>Wd(e,Xd),Rd=e=>Wd(e,Gd),zd=e=>Wd(e,qd),Bd=e=>Wd(e,Kd),Vd=e=>Wd(e,Qd,!0),Hd=e=>Wd(e,Zd,!0),Ud=(e,t,n)=>{let r=cd.exec(e);return r?r[1]?t(r[1]):n(r[2]):!1},Wd=(e,t,n=!1)=>{let r=ld.exec(e);return r?r[1]?t(r[1]):n:!1},Gd=e=>e===`position`||e===`percentage`,Kd=e=>e===`image`||e===`url`,qd=e=>e===`length`||e===`size`||e===`bg-size`,Jd=e=>e===`length`,Yd=e=>e===`number`,Xd=e=>e===`family-name`,Zd=e=>e===`number`||e===`weight`,Qd=e=>e===`shadow`,$d=ad(()=>{let e=sd(`color`),t=sd(`font`),n=sd(`text`),r=sd(`font-weight`),i=sd(`tracking`),a=sd(`leading`),o=sd(`breakpoint`),s=sd(`container`),c=sd(`spacing`),l=sd(`radius`),u=sd(`shadow`),d=sd(`inset-shadow`),f=sd(`text-shadow`),p=sd(`drop-shadow`),m=sd(`blur`),h=sd(`perspective`),g=sd(`aspect`),_=sd(`ease`),v=sd(`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(),U,H],S=()=>[`auto`,`hidden`,`clip`,`visible`,`scroll`],C=()=>[`auto`,`contain`,`none`],w=()=>[U,H,c],T=()=>[gd,`full`,`auto`,...w()],E=()=>[vd,`none`,`subgrid`,U,H],D=()=>[`auto`,{span:[`full`,vd,U,H]},vd,U,H],O=()=>[vd,`auto`,U,H],k=()=>[`auto`,`min`,`max`,`fr`,U,H],A=()=>[`start`,`end`,`center`,`between`,`around`,`evenly`,`stretch`,`baseline`,`center-safe`,`end-safe`],j=()=>[`start`,`end`,`center`,`stretch`,`center-safe`,`end-safe`],M=()=>[`auto`,...w()],N=()=>[gd,`auto`,`full`,`dvw`,`dvh`,`lvw`,`lvh`,`svw`,`svh`,`min`,`max`,`fit`,...w()],P=()=>[gd,`screen`,`full`,`dvw`,`lvw`,`svw`,`min`,`max`,`fit`,...w()],ee=()=>[gd,`screen`,`full`,`lh`,`dvh`,`lvh`,`svh`,`min`,`max`,`fit`,...w()],F=()=>[e,U,H],I=()=>[...b(),Rd,Nd,{position:[U,H]}],te=()=>[`no-repeat`,{repeat:[``,`x`,`y`,`space`,`round`]}],L=()=>[`auto`,`cover`,`contain`,zd,Od,{size:[U,H]}],ne=()=>[yd,Id,kd],R=()=>[``,`none`,`full`,l,U,H],re=()=>[``,_d,Id,kd],z=()=>[`solid`,`dashed`,`dotted`,`double`],ie=()=>[`normal`,`multiply`,`screen`,`overlay`,`darken`,`lighten`,`color-dodge`,`color-burn`,`hard-light`,`soft-light`,`difference`,`exclusion`,`hue`,`saturation`,`color`,`luminosity`],ae=()=>[_d,yd,Rd,Nd],oe=()=>[``,`none`,m,U,H],se=()=>[`none`,_d,U,H],ce=()=>[`none`,_d,U,H],le=()=>[_d,U,H],ue=()=>[gd,`full`,...w()];return{cacheSize:500,theme:{animate:[`spin`,`ping`,`pulse`,`bounce`],aspect:[`video`],blur:[bd],breakpoint:[bd],color:[xd],container:[bd],"drop-shadow":[bd],ease:[`in`,`out`,`in-out`],font:[Ed],"font-weight":[`thin`,`extralight`,`light`,`normal`,`medium`,`semibold`,`bold`,`extrabold`,`black`],"inset-shadow":[bd],leading:[`none`,`tight`,`snug`,`normal`,`relaxed`,`loose`],perspective:[`dramatic`,`near`,`normal`,`midrange`,`distant`,`none`],radius:[bd],shadow:[bd],spacing:[`px`,_d],text:[bd],"text-shadow":[bd],tracking:[`tighter`,`tight`,`normal`,`wide`,`wider`,`widest`]},classGroups:{aspect:[{aspect:[`auto`,`square`,gd,H,U,g]}],container:[`container`],"container-type":[{"@container":[``,`normal`,`size`,U,H]}],"container-named":[Dd],columns:[{columns:[_d,H,U,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:[vd,`auto`,U,H]}],basis:[{basis:[gd,`full`,`auto`,s,...w()]}],"flex-direction":[{flex:[`row`,`row-reverse`,`col`,`col-reverse`]}],"flex-wrap":[{flex:[`nowrap`,`wrap`,`wrap-reverse`]}],flex:[{flex:[_d,gd,`auto`,`initial`,`none`,H]}],grow:[{grow:[``,_d,U,H]}],shrink:[{shrink:[``,_d,U,H]}],order:[{order:[vd,`first`,`last`,`none`,U,H]}],"grid-cols":[{"grid-cols":E()}],"col-start-end":[{col:D()}],"col-start":[{"col-start":O()}],"col-end":[{"col-end":O()}],"grid-rows":[{"grid-rows":E()}],"row-start-end":[{row:D()}],"row-start":[{"row-start":O()}],"row-end":[{"row-end":O()}],"grid-flow":[{"grid-flow":[`row`,`col`,`dense`,`row-dense`,`col-dense`]}],"auto-cols":[{"auto-cols":k()}],"auto-rows":[{"auto-rows":k()}],gap:[{gap:w()}],"gap-x":[{"gap-x":w()}],"gap-y":[{"gap-y":w()}],"justify-content":[{justify:[...A(),`normal`]}],"justify-items":[{"justify-items":[...j(),`normal`]}],"justify-self":[{"justify-self":[`auto`,...j()]}],"align-content":[{content:[`normal`,...A()]}],"align-items":[{items:[...j(),{baseline:[``,`last`]}]}],"align-self":[{self:[`auto`,...j(),{baseline:[``,`last`]}]}],"place-content":[{"place-content":A()}],"place-items":[{"place-items":[...j(),`baseline`]}],"place-self":[{"place-self":[`auto`,...j()]}],p:[{p:w()}],px:[{px:w()}],py:[{py:w()}],ps:[{ps:w()}],pe:[{pe:w()}],pbs:[{pbs:w()}],pbe:[{pbe:w()}],pt:[{pt:w()}],pr:[{pr:w()}],pb:[{pb:w()}],pl:[{pl:w()}],m:[{m:M()}],mx:[{mx:M()}],my:[{my:M()}],ms:[{ms:M()}],me:[{me:M()}],mbs:[{mbs:M()}],mbe:[{mbe:M()}],mt:[{mt:M()}],mr:[{mr:M()}],mb:[{mb:M()}],ml:[{ml:M()}],"space-x":[{"space-x":w()}],"space-x-reverse":[`space-x-reverse`],"space-y":[{"space-y":w()}],"space-y-reverse":[`space-y-reverse`],size:[{size:N()}],"inline-size":[{inline:[`auto`,...P()]}],"min-inline-size":[{"min-inline":[`auto`,...P()]}],"max-inline-size":[{"max-inline":[`none`,...P()]}],"block-size":[{block:[`auto`,...ee()]}],"min-block-size":[{"min-block":[`auto`,...ee()]}],"max-block-size":[{"max-block":[`none`,...ee()]}],w:[{w:[s,`screen`,...N()]}],"min-w":[{"min-w":[s,`screen`,`none`,...N()]}],"max-w":[{"max-w":[s,`screen`,`none`,`prose`,{screen:[o]},...N()]}],h:[{h:[`screen`,`lh`,...N()]}],"min-h":[{"min-h":[`screen`,`lh`,`none`,...N()]}],"max-h":[{"max-h":[`screen`,`lh`,...N()]}],"font-size":[{text:[`base`,n,Id,kd]}],"font-smoothing":[`antialiased`,`subpixel-antialiased`],"font-style":[`italic`,`not-italic`],"font-weight":[{font:[r,Hd,jd]}],"font-stretch":[{"font-stretch":[`ultra-condensed`,`extra-condensed`,`condensed`,`semi-condensed`,`normal`,`semi-expanded`,`expanded`,`extra-expanded`,`ultra-expanded`,yd,H]}],"font-family":[{font:[Ld,Md,t]}],"font-features":[{"font-features":[H]}],"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,U,H]}],"line-clamp":[{"line-clamp":[_d,`none`,U,Ad]}],leading:[{leading:[a,...w()]}],"list-image":[{"list-image":[`none`,U,H]}],"list-style-position":[{list:[`inside`,`outside`]}],"list-style-type":[{list:[`disc`,`decimal`,`none`,U,H]}],"text-alignment":[{text:[`left`,`center`,`right`,`justify`,`start`,`end`]}],"placeholder-color":[{placeholder:F()}],"text-color":[{text:F()}],"text-decoration":[`underline`,`overline`,`line-through`,`no-underline`],"text-decoration-style":[{decoration:[...z(),`wavy`]}],"text-decoration-thickness":[{decoration:[_d,`from-font`,`auto`,U,kd]}],"text-decoration-color":[{decoration:F()}],"underline-offset":[{"underline-offset":[_d,`auto`,U,H]}],"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:[vd,U,H]}],"vertical-align":[{align:[`baseline`,`top`,`middle`,`bottom`,`text-top`,`text-bottom`,`sub`,`super`,U,H]}],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`,U,H]}],"bg-attachment":[{bg:[`fixed`,`local`,`scroll`]}],"bg-clip":[{"bg-clip":[`border`,`padding`,`content`,`text`]}],"bg-origin":[{"bg-origin":[`border`,`padding`,`content`]}],"bg-position":[{bg:I()}],"bg-repeat":[{bg:te()}],"bg-size":[{bg:L()}],"bg-image":[{bg:[`none`,{linear:[{to:[`t`,`tr`,`r`,`br`,`b`,`bl`,`l`,`tl`]},vd,U,H],radial:[``,U,H],conic:[vd,U,H]},Bd,Pd]}],"bg-color":[{bg:F()}],"gradient-from-pos":[{from:ne()}],"gradient-via-pos":[{via:ne()}],"gradient-to-pos":[{to:ne()}],"gradient-from":[{from:F()}],"gradient-via":[{via:F()}],"gradient-to":[{to:F()}],rounded:[{rounded:R()}],"rounded-s":[{"rounded-s":R()}],"rounded-e":[{"rounded-e":R()}],"rounded-t":[{"rounded-t":R()}],"rounded-r":[{"rounded-r":R()}],"rounded-b":[{"rounded-b":R()}],"rounded-l":[{"rounded-l":R()}],"rounded-ss":[{"rounded-ss":R()}],"rounded-se":[{"rounded-se":R()}],"rounded-ee":[{"rounded-ee":R()}],"rounded-es":[{"rounded-es":R()}],"rounded-tl":[{"rounded-tl":R()}],"rounded-tr":[{"rounded-tr":R()}],"rounded-br":[{"rounded-br":R()}],"rounded-bl":[{"rounded-bl":R()}],"border-w":[{border:re()}],"border-w-x":[{"border-x":re()}],"border-w-y":[{"border-y":re()}],"border-w-s":[{"border-s":re()}],"border-w-e":[{"border-e":re()}],"border-w-bs":[{"border-bs":re()}],"border-w-be":[{"border-be":re()}],"border-w-t":[{"border-t":re()}],"border-w-r":[{"border-r":re()}],"border-w-b":[{"border-b":re()}],"border-w-l":[{"border-l":re()}],"divide-x":[{"divide-x":re()}],"divide-x-reverse":[`divide-x-reverse`],"divide-y":[{"divide-y":re()}],"divide-y-reverse":[`divide-y-reverse`],"border-style":[{border:[...z(),`hidden`,`none`]}],"divide-style":[{divide:[...z(),`hidden`,`none`]}],"border-color":[{border:F()}],"border-color-x":[{"border-x":F()}],"border-color-y":[{"border-y":F()}],"border-color-s":[{"border-s":F()}],"border-color-e":[{"border-e":F()}],"border-color-bs":[{"border-bs":F()}],"border-color-be":[{"border-be":F()}],"border-color-t":[{"border-t":F()}],"border-color-r":[{"border-r":F()}],"border-color-b":[{"border-b":F()}],"border-color-l":[{"border-l":F()}],"divide-color":[{divide:F()}],"outline-style":[{outline:[...z(),`none`,`hidden`]}],"outline-offset":[{"outline-offset":[_d,U,H]}],"outline-w":[{outline:[``,_d,Id,kd]}],"outline-color":[{outline:F()}],shadow:[{shadow:[``,`none`,u,Vd,Fd]}],"shadow-color":[{shadow:F()}],"inset-shadow":[{"inset-shadow":[`none`,d,Vd,Fd]}],"inset-shadow-color":[{"inset-shadow":F()}],"ring-w":[{ring:re()}],"ring-w-inset":[`ring-inset`],"ring-color":[{ring:F()}],"ring-offset-w":[{"ring-offset":[_d,kd]}],"ring-offset-color":[{"ring-offset":F()}],"inset-ring-w":[{"inset-ring":re()}],"inset-ring-color":[{"inset-ring":F()}],"text-shadow":[{"text-shadow":[`none`,f,Vd,Fd]}],"text-shadow-color":[{"text-shadow":F()}],opacity:[{opacity:[_d,U,H]}],"mix-blend":[{"mix-blend":[...ie(),`plus-darker`,`plus-lighter`]}],"bg-blend":[{"bg-blend":ie()}],"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":[_d]}],"mask-image-linear-from-pos":[{"mask-linear-from":ae()}],"mask-image-linear-to-pos":[{"mask-linear-to":ae()}],"mask-image-linear-from-color":[{"mask-linear-from":F()}],"mask-image-linear-to-color":[{"mask-linear-to":F()}],"mask-image-t-from-pos":[{"mask-t-from":ae()}],"mask-image-t-to-pos":[{"mask-t-to":ae()}],"mask-image-t-from-color":[{"mask-t-from":F()}],"mask-image-t-to-color":[{"mask-t-to":F()}],"mask-image-r-from-pos":[{"mask-r-from":ae()}],"mask-image-r-to-pos":[{"mask-r-to":ae()}],"mask-image-r-from-color":[{"mask-r-from":F()}],"mask-image-r-to-color":[{"mask-r-to":F()}],"mask-image-b-from-pos":[{"mask-b-from":ae()}],"mask-image-b-to-pos":[{"mask-b-to":ae()}],"mask-image-b-from-color":[{"mask-b-from":F()}],"mask-image-b-to-color":[{"mask-b-to":F()}],"mask-image-l-from-pos":[{"mask-l-from":ae()}],"mask-image-l-to-pos":[{"mask-l-to":ae()}],"mask-image-l-from-color":[{"mask-l-from":F()}],"mask-image-l-to-color":[{"mask-l-to":F()}],"mask-image-x-from-pos":[{"mask-x-from":ae()}],"mask-image-x-to-pos":[{"mask-x-to":ae()}],"mask-image-x-from-color":[{"mask-x-from":F()}],"mask-image-x-to-color":[{"mask-x-to":F()}],"mask-image-y-from-pos":[{"mask-y-from":ae()}],"mask-image-y-to-pos":[{"mask-y-to":ae()}],"mask-image-y-from-color":[{"mask-y-from":F()}],"mask-image-y-to-color":[{"mask-y-to":F()}],"mask-image-radial":[{"mask-radial":[U,H]}],"mask-image-radial-from-pos":[{"mask-radial-from":ae()}],"mask-image-radial-to-pos":[{"mask-radial-to":ae()}],"mask-image-radial-from-color":[{"mask-radial-from":F()}],"mask-image-radial-to-color":[{"mask-radial-to":F()}],"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":[_d]}],"mask-image-conic-from-pos":[{"mask-conic-from":ae()}],"mask-image-conic-to-pos":[{"mask-conic-to":ae()}],"mask-image-conic-from-color":[{"mask-conic-from":F()}],"mask-image-conic-to-color":[{"mask-conic-to":F()}],"mask-mode":[{mask:[`alpha`,`luminance`,`match`]}],"mask-origin":[{"mask-origin":[`border`,`padding`,`content`,`fill`,`stroke`,`view`]}],"mask-position":[{mask:I()}],"mask-repeat":[{mask:te()}],"mask-size":[{mask:L()}],"mask-type":[{"mask-type":[`alpha`,`luminance`]}],"mask-image":[{mask:[`none`,U,H]}],filter:[{filter:[``,`none`,U,H]}],blur:[{blur:oe()}],brightness:[{brightness:[_d,U,H]}],contrast:[{contrast:[_d,U,H]}],"drop-shadow":[{"drop-shadow":[``,`none`,p,Vd,Fd]}],"drop-shadow-color":[{"drop-shadow":F()}],grayscale:[{grayscale:[``,_d,U,H]}],"hue-rotate":[{"hue-rotate":[_d,U,H]}],invert:[{invert:[``,_d,U,H]}],saturate:[{saturate:[_d,U,H]}],sepia:[{sepia:[``,_d,U,H]}],"backdrop-filter":[{"backdrop-filter":[``,`none`,U,H]}],"backdrop-blur":[{"backdrop-blur":oe()}],"backdrop-brightness":[{"backdrop-brightness":[_d,U,H]}],"backdrop-contrast":[{"backdrop-contrast":[_d,U,H]}],"backdrop-grayscale":[{"backdrop-grayscale":[``,_d,U,H]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[_d,U,H]}],"backdrop-invert":[{"backdrop-invert":[``,_d,U,H]}],"backdrop-opacity":[{"backdrop-opacity":[_d,U,H]}],"backdrop-saturate":[{"backdrop-saturate":[_d,U,H]}],"backdrop-sepia":[{"backdrop-sepia":[``,_d,U,H]}],"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`,U,H]}],"transition-behavior":[{transition:[`normal`,`discrete`]}],duration:[{duration:[_d,`initial`,U,H]}],ease:[{ease:[`linear`,`initial`,_,U,H]}],delay:[{delay:[_d,U,H]}],animate:[{animate:[`none`,v,U,H]}],backface:[{backface:[`hidden`,`visible`]}],perspective:[{perspective:[h,U,H]}],"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:[U,H,``,`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:[vd,U,H]}],accent:[{accent:F()}],appearance:[{appearance:[`none`,`auto`]}],"caret-color":[{caret:F()}],"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`,U,H]}],"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":F()}],"scrollbar-track-color":[{"scrollbar-track":F()}],"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`,U,H]}],fill:[{fill:[`none`,...F()]}],"stroke-w":[{stroke:[_d,Id,kd,Ad]}],stroke:[{stroke:[`none`,...F()]}],"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 W(...e){return $d(Du(e))}function ef({delayDuration:e=250,...t}){return(0,V.jsx)(xu,{delayDuration:e,...t})}function tf(e){return(0,V.jsx)(Su,{...e})}function nf(e){return(0,V.jsx)(Cu,{...e})}function rf({className:e,sideOffset:t=6,...n}){return(0,V.jsx)(wu,{children:(0,V.jsx)(Tu,{sideOffset:t,className:W(`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 af=(0,B.createContext)(null);function of({children:e}){let[t,n]=(0,B.useState)(!1),r=(0,B.useCallback)(()=>n(!1),[]),i=(0,B.useMemo)(()=>({open:t,setOpen:n,dismiss:r}),[r,t]);return(0,V.jsx)(af.Provider,{value:i,children:e})}function sf(){let e=(0,B.useContext)(af);if(!e)throw Error(`useToolPicker requires ToolPickerProvider`);return e}var cf=(0,B.createContext)(null);function lf({children:e}){let[t,n]=(0,B.useState)(`terminal`),r=(0,B.useRef)(`terminal`),[i,a]=(0,B.useState)(0),o=(0,B.useCallback)(e=>{r.current=e,n(e)},[]),s=(0,B.useCallback)(()=>a(e=>e+1),[]),c=(0,B.useMemo)(()=>({focusedSurface:t,focusedSurfaceRef:r,emptyToolFocusRevision:i,focusSurface:o,restoreEmptyToolFocus:s}),[i,o,t,s]);return(0,V.jsx)(cf.Provider,{value:c,children:e})}function uf(){let e=(0,B.useContext)(cf);if(!e)throw Error(`useWorkspaceSurfaceFocus requires WorkspaceSurfaceFocusProvider`);return e}var df=/^[\w!#$%&'*.^`|~+-]+$/,ff=(e,t,n={})=>{if(!df.test(e))throw Error(`Invalid cookie name`);let r=`${e}=${t}`;if(e.startsWith(`__Secure-`)&&!n.secure)throw Error(`__Secure- Cookie must have Secure attributes`);if(e.startsWith(`__Host-`)){if(!n.secure)throw Error(`__Host- Cookie must have Secure attributes`);if(n.path!==`/`)throw Error(`__Host- Cookie must have Path attributes with "/"`);if(n.domain)throw Error(`__Host- Cookie must not have Domain attributes`)}for(let e of[`domain`,`path`,`sameSite`,`priority`])if(n[e]&&/[;\r\n]/.test(n[e]))throw Error(`${e} must not contain ";", "\\r", or "\\n"`);if(n&&typeof n.maxAge==`number`&&n.maxAge>=0){if(n.maxAge>3456e4)throw Error(`Cookies Max-Age SHOULD NOT be greater than 400 days (34560000 seconds) in duration.`);r+=`; Max-Age=${n.maxAge|0}`}if(n.domain&&n.prefix!==`host`&&(r+=`; Domain=${n.domain}`),n.path&&(r+=`; Path=${n.path}`),n.expires){if(n.expires.getTime()-Date.now()>3456e7)throw Error(`Cookies Expires SHOULD NOT be greater than 400 days (34560000 seconds) in the future.`);r+=`; Expires=${n.expires.toUTCString()}`}if(n.httpOnly&&(r+=`; HttpOnly`),n.secure&&(r+=`; Secure`),n.sameSite&&(r+=`; SameSite=${n.sameSite.charAt(0).toUpperCase()+n.sameSite.slice(1)}`),n.priority&&(r+=`; Priority=${n.priority.charAt(0).toUpperCase()+n.priority.slice(1)}`),n.partitioned){if(!n.secure)throw Error(`Partitioned Cookie must have Secure attributes`);r+=`; Partitioned`}return r},pf=(e,t,n)=>(t=encodeURIComponent(t),ff(e,t,n)),mf=new Set([101,204,205,304]);async function hf(e){let t=await e;if((t.body||t._bodyInit)&&!mf.has(t.status)&&(t._data=await t[vf(t)]()),!t.ok)throw new gf(`${t.status} ${t.statusText}`,{statusCode:t?.status,detail:{data:t?._data,statusText:t?.statusText}});return t._data}var gf=class extends Error{detail;code;log;statusCode;constructor(e,t={}){super(e),this.name=`DetailedError`,this.log=t.log,this.detail=t.detail,this.code=t.code,this.statusCode=t.statusCode}},_f=/^application\/(?:[\w!#$%&*.^`~-]*\+)?json(?:;.+)?$/i;function vf(e){let t=e.headers.get(`content-type`);if(!t)return`text`;let n=t.split(`;`).shift();return _f.test(n)?`json`:`text`}var yf=(e,t)=>(e=e.replace(/\/+$/,``),e+=`/`,t=t.replace(/^\/+/,``),e+t),bf=(e,t)=>{for(let[n,r]of Object.entries(t)){let t=RegExp(`/:`+n+`(?:{[^/]+})?\\??(?=/|$)`);e=e.replace(t,r?`/${r}`:``)}return e},xf=e=>{let t=new URLSearchParams;for(let[n,r]of Object.entries(e))if(r!==void 0)if(Array.isArray(r))for(let e of r)t.append(n,e);else t.set(n,r);return t},Sf=(e,t)=>{switch(t){case`ws`:return e.replace(/^http/,`ws`);case`http`:return e.replace(/^ws/,`http`)}},Cf=e=>/^https?:\/\/[^\/]+?\/index(?=\?|$)/.test(e)?e.replace(/\/index(?=\?|$)/,`/`):e.replace(/\/index(?=\?|$)/,``);function wf(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Tf(e,t){if(!wf(e)&&!wf(t))return t;let n={...e};for(let e in t){let r=t[e];wf(n[e])&&wf(r)?n[e]=Tf(n[e],r):n[e]=r}return n}async function Ef(e){return hf(e)}var Df=(e,t)=>new Proxy(()=>{},{get(n,r){if(!(typeof r!=`string`||r===`then`))return Df(e,[...t,r])},apply(n,r,i){return e({path:t,args:i})}}),Of=class{url;method;buildSearchParams;queryParams=void 0;pathParams={};rBody;cType=void 0;constructor(e,t,n){this.url=e,this.method=t,this.buildSearchParams=n.buildSearchParams}fetch=async(e,t)=>{if(e){if(e.query&&(this.queryParams=this.buildSearchParams(e.query)),e.form){let t=new FormData;for(let[n,r]of Object.entries(e.form))if(r!==void 0)if(Array.isArray(r))for(let e of r)t.append(n,e);else t.append(n,r);this.rBody=t}e.json&&(this.rBody=JSON.stringify(e.json),this.cType=`application/json`),e.param&&(this.pathParams=e.param)}let n=this.method.toUpperCase(),r={...e?.header,...typeof t?.headers==`function`?await t.headers():t?.headers};if(e?.cookie){let t=[];for(let[n,r]of Object.entries(e.cookie))t.push(pf(n,r,{path:`/`}));r.Cookie=t.join(`,`)}this.cType&&(r[`Content-Type`]=this.cType);let i=new Headers(r??void 0),a=this.url;a=Cf(a),a=bf(a,this.pathParams),this.queryParams&&(a=a+`?`+this.queryParams.toString()),n=this.method.toUpperCase();let o=!(n===`GET`||n===`HEAD`);return(t?.fetch||fetch)(a,{body:o?this.rBody:void 0,method:n,headers:i,...t?.init})}},kf=(e,t)=>Df(function n(r){let i=t?.buildSearchParams??xf,a=[...r.path],o=a.slice(-3).reverse();if(o[0]===`toString`)return o[1]===`name`?o[2]||``:n.toString();if(o[0]===`valueOf`)return o[1]===`name`?o[2]||``:n;let s=``;if(/^\$/.test(o[0])){let e=a.pop();e&&(s=e.replace(/^\$/,``))}let c=yf(e,a.join(`/`));if(s===`url`||s===`path`){let t=c;return r.args[0]&&(r.args[0].param&&(t=bf(c,r.args[0].param)),r.args[0].query&&(t=t+`?`+i(r.args[0].query).toString())),t=Cf(t),s===`url`?new URL(t):t.slice(e.replace(/\/+$/,``).length).replace(/^\/?/,`/`)}if(s===`ws`){let e=Sf(r.args[0]&&r.args[0].param?bf(c,r.args[0].param):c,`ws`),n=new URL(e),i=r.args[0]?.query;return i&&Object.entries(i).forEach(([e,t])=>{Array.isArray(t)?t.forEach(t=>n.searchParams.append(e,t)):n.searchParams.set(e,t)}),((...e)=>t?.webSocket!==void 0&&typeof t.webSocket==`function`?t.webSocket(...e):new WebSocket(...e))(n.toString())}let l=new Of(c,s,{buildSearchParams:i});if(s){t??={};let e={...r.args[1]},n=t.headers,i=e.headers;n&&i&&(e.headers=async()=>({...typeof n==`function`?await n():n,...typeof i==`function`?await i():i}));let a=Tf(t,e);return l.fetch(r.args[0],a)}return l},[]),Af=3e4,jf=75,Mf=3e3;function Nf(e,t){if(e>=2)return!1;if(!(t instanceof gf))return!0;let n=t.statusCode??500;return n===408||n===429||n>=500}function Pf(e){return Math.min(2e3,500*2**Math.max(0,e))}function Ff(e,t=jf){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 If;function G(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 Lf=class extends Error{constructor(){super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`)}},Rf=class extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name=`ZodEncodeError`}};(If=globalThis).__zod_globalConfig??(If.__zod_globalConfig={});var zf=globalThis.__zod_globalConfig;function Bf(e){return e&&Object.assign(zf,e),zf}function Vf(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 Hf(e,t){return typeof t==`bigint`?t.toString():t}function Uf(e){return{get value(){{let t=e();return Object.defineProperty(this,"value",{value:t}),t}throw Error(`cached value already set`)}}}function Wf(e){return e==null}function Gf(e){let t=+!!e.startsWith(`^`),n=e.endsWith(`$`)?e.length-1:e.length;return e.slice(t,n)}function Kf(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 qf=Symbol(`evaluating`);function Jf(e,t,n){let r;Object.defineProperty(e,t,{get(){if(r!==qf)return r===void 0&&(r=qf,r=n()),r},set(n){Object.defineProperty(e,t,{value:n})},configurable:!0})}function Yf(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function Xf(...e){let t={};for(let n of e){let e=Object.getOwnPropertyDescriptors(n);Object.assign(t,e)}return Object.defineProperties({},t)}function Zf(e){return JSON.stringify(e)}function Qf(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,``).replace(/[\s_-]+/g,`-`).replace(/^-+|-+$/g,``)}var $f=`captureStackTrace`in Error?Error.captureStackTrace:(...e)=>{};function ep(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}var tp=Uf(()=>{if(zf.jitless||typeof navigator<`u`&&navigator?.userAgent?.includes(`Cloudflare`))return!1;try{return Function(``),!0}catch{return!1}});function np(e){if(ep(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!=`function`)return!0;let n=t.prototype;return!(ep(n)===!1||Object.prototype.hasOwnProperty.call(n,`isPrototypeOf`)===!1)}function rp(e){return np(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}var ip=new Set([`string`,`number`,`symbol`]);function ap(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function op(e,t,n){let r=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(r._zod.parent=e),r}function K(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 sp(e){return Object.keys(e).filter(t=>e[t]._zod.optin===`optional`&&e[t]._zod.optout===`optional`)}var cp={safeint:[-(2**53-1),2**53-1],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function lp(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 op(e,Xf(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 Yf(this,`shape`,e),e},checks:[]}))}function up(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 op(e,Xf(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 Yf(this,`shape`,r),r},checks:[]}))}function dp(e,t){if(!np(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 op(e,Xf(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return Yf(this,`shape`,n),n}}))}function fp(e,t){if(!np(t))throw Error(`Invalid input to safeExtend: expected a plain object`);return op(e,Xf(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return Yf(this,`shape`,n),n}}))}function pp(e,t){if(e._zod.def.checks?.length)throw Error(`.merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.`);return op(e,Xf(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t._zod.def.shape};return Yf(this,`shape`,n),n},get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]}))}function mp(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 op(t,Xf(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 Yf(this,`shape`,i),i},checks:[]}))}function hp(e,t,n){return op(t,Xf(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 Yf(this,`shape`,i),i}}))}function gp(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 _p(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 vp(e,t){return t.map(t=>{var n;return(n=t).path??(n.path=[]),t.path.unshift(e),t})}function yp(e){return typeof e==`string`?e:e?.message}function bp(e,t,n){let r=e.message?e.message:yp(e.inst?._zod.def?.error?.(e))??yp(t?.error?.(e))??yp(n.customError?.(e))??yp(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 xp(e){return Array.isArray(e)?`array`:typeof e==`string`?`string`:`unknown`}function Sp(...e){let[t,n,r]=e;return typeof t==`string`?{message:t,code:`custom`,input:n,inst:r}:{...t}}var Cp=(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,Hf,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},wp=G(`$ZodError`,Cp),Tp=G(`$ZodError`,Cp,{Parent:Error});function Ep(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 Dp(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 Op=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 Lf;if(o.issues.length){let t=new((i?.Err)??e)(o.issues.map(e=>bp(e,a,Bf())));throw $f(t,i?.callee),t}return o.value},kp=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=>bp(e,a,Bf())));throw $f(t,i?.callee),t}return o.value},Ap=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 Lf;return a.issues.length?{success:!1,error:new(e??wp)(a.issues.map(e=>bp(e,i,Bf())))}:{success:!0,data:a.value}},jp=Ap(Tp),Mp=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=>bp(e,i,Bf())))}:{success:!0,data:a.value}},Np=Mp(Tp),Pp=e=>(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return Op(e)(t,n,i)},Fp=e=>(t,n,r)=>Op(e)(t,n,r),Ip=e=>async(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return kp(e)(t,n,i)},Lp=e=>async(t,n,r)=>kp(e)(t,n,r),Rp=e=>(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return Ap(e)(t,n,i)},zp=e=>(t,n,r)=>Ap(e)(t,n,r),Bp=e=>async(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return Mp(e)(t,n,i)},Vp=e=>async(t,n,r)=>Mp(e)(t,n,r),Hp=/^[cC][0-9a-z]{6,}$/,Up=/^[0-9a-z]+$/,Wp=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,Gp=/^[0-9a-vA-V]{20}$/,Kp=/^[A-Za-z0-9]{27}$/,qp=/^[a-zA-Z0-9_-]{21}$/,Jp=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,Yp=/^([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})$/,Xp=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)$/,Zp=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,Qp=`^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`;function $p(){return new RegExp(Qp,`u`)}var em=/^(?:(?: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])$/,tm=/^(([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}|:))$/,nm=/^((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])$/,rm=/^(([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])$/,im=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,am=/^[A-Za-z0-9_-]*$/,om=/^https?$/,sm=/^\+[1-9]\d{6,14}$/,cm=`(?:(?:\\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])))`,lm=RegExp(`^${cm}$`);function um(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 dm(e){return RegExp(`^${um(e)}$`)}function fm(e){let t=um({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(`^${cm}T(?:${r})$`)}var pm=e=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??``}}`:`[\\s\\S]*`;return RegExp(`^${t}$`)},mm=/^-?\d+$/,hm=/^-?\d+(?:\.\d+)?$/,gm=/^(?:true|false)$/i,_m=/^null$/i,vm=/^[^A-Z]*$/,ym=/^[^a-z]*$/,bm=G(`$ZodCheck`,(e,t)=>{var n;e._zod??={},e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),xm={number:`number`,bigint:`bigint`,object:`date`},Sm=G(`$ZodCheckLessThan`,(e,t)=>{bm.init(e,t);let n=xm[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})}}),Cm=G(`$ZodCheckGreaterThan`,(e,t)=>{bm.init(e,t);let n=xm[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})}}),wm=G(`$ZodCheckMultipleOf`,(e,t)=>{bm.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):Kf(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})}}),Tm=G(`$ZodCheckNumberFormat`,(e,t)=>{bm.init(e,t),t.format=t.format||`float64`;let n=t.format?.includes(`int`),r=n?`int`:`number`,[i,a]=cp[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=mm)}),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})}}),Em=G(`$ZodCheckMaxLength`,(e,t)=>{var n;bm.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!Wf(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=xp(r);n.issues.push({origin:i,code:`too_big`,maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),Dm=G(`$ZodCheckMinLength`,(e,t)=>{var n;bm.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!Wf(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=xp(r);n.issues.push({origin:i,code:`too_small`,minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),Om=G(`$ZodCheckLengthEquals`,(e,t)=>{var n;bm.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!Wf(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=xp(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})}}),km=G(`$ZodCheckStringFormat`,(e,t)=>{var n,r;bm.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=()=>{})}),Am=G(`$ZodCheckRegex`,(e,t)=>{km.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})}}),jm=G(`$ZodCheckLowerCase`,(e,t)=>{t.pattern??=vm,km.init(e,t)}),Mm=G(`$ZodCheckUpperCase`,(e,t)=>{t.pattern??=ym,km.init(e,t)}),Nm=G(`$ZodCheckIncludes`,(e,t)=>{bm.init(e,t);let n=ap(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})}}),Pm=G(`$ZodCheckStartsWith`,(e,t)=>{bm.init(e,t);let n=RegExp(`^${ap(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})}}),Fm=G(`$ZodCheckEndsWith`,(e,t)=>{bm.init(e,t);let n=RegExp(`.*${ap(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})}}),Im=G(`$ZodCheckOverwrite`,(e,t)=>{bm.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}}),Lm=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(`
|
|
10
|
-
`).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(`
|
|
11
|
-
`))}},Rm={major:4,minor:4,patch:3},zm=G(`$ZodType`,(e,t)=>{var n;e??={},e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=Rm;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=gp(e),i;for(let a of t){if(a._zod.def.when){if(_p(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 Lf;if(i||o instanceof Promise)i=(i??Promise.resolve()).then(async()=>{await o,e.issues.length!==t&&(r||=gp(e,t))});else{if(e.issues.length===t)continue;r||=gp(e,t)}}return i?i.then(()=>e):e},n=(n,i,a)=>{if(gp(n))return n.aborted=!0,n;let o=t(i,r,a);if(o instanceof Promise){if(a.async===!1)throw new Lf;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 Lf;return o.then(e=>t(e,r,a))}return t(o,r,a)}}Jf(e,`~standard`,()=>({validate:t=>{try{let n=jp(e,t);return n.success?{value:n.data}:{issues:n.error?.issues}}catch{return Np(e,t).then(e=>e.success?{value:e.data}:{issues:e.error?.issues})}},vendor:`zod`,version:1}))}),Bm=G(`$ZodString`,(e,t)=>{zm.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??pm(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}}),Vm=G(`$ZodStringFormat`,(e,t)=>{km.init(e,t),Bm.init(e,t)}),Hm=G(`$ZodGUID`,(e,t)=>{t.pattern??=Yp,Vm.init(e,t)}),Um=G(`$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??=Xp(e)}else t.pattern??=Xp();Vm.init(e,t)}),Wm=G(`$ZodEmail`,(e,t)=>{t.pattern??=Zp,Vm.init(e,t)}),Gm=G(`$ZodURL`,(e,t)=>{Vm.init(e,t),e._zod.check=n=>{try{let r=n.value.trim();if(!t.normalize&&t.protocol?.source===om.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})}}}),Km=G(`$ZodEmoji`,(e,t)=>{t.pattern??=$p(),Vm.init(e,t)}),qm=G(`$ZodNanoID`,(e,t)=>{t.pattern??=qp,Vm.init(e,t)}),Jm=G(`$ZodCUID`,(e,t)=>{t.pattern??=Hp,Vm.init(e,t)}),Ym=G(`$ZodCUID2`,(e,t)=>{t.pattern??=Up,Vm.init(e,t)}),Xm=G(`$ZodULID`,(e,t)=>{t.pattern??=Wp,Vm.init(e,t)}),Zm=G(`$ZodXID`,(e,t)=>{t.pattern??=Gp,Vm.init(e,t)}),Qm=G(`$ZodKSUID`,(e,t)=>{t.pattern??=Kp,Vm.init(e,t)}),$m=G(`$ZodISODateTime`,(e,t)=>{t.pattern??=fm(t),Vm.init(e,t)}),eh=G(`$ZodISODate`,(e,t)=>{t.pattern??=lm,Vm.init(e,t)}),th=G(`$ZodISOTime`,(e,t)=>{t.pattern??=dm(t),Vm.init(e,t)}),nh=G(`$ZodISODuration`,(e,t)=>{t.pattern??=Jp,Vm.init(e,t)}),rh=G(`$ZodIPv4`,(e,t)=>{t.pattern??=em,Vm.init(e,t),e._zod.bag.format=`ipv4`}),ih=G(`$ZodIPv6`,(e,t)=>{t.pattern??=tm,Vm.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})}}}),ah=G(`$ZodCIDRv4`,(e,t)=>{t.pattern??=nm,Vm.init(e,t)}),oh=G(`$ZodCIDRv6`,(e,t)=>{t.pattern??=rm,Vm.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 sh(e){if(e===``)return!0;if(/\s/.test(e)||e.length%4!=0)return!1;try{return atob(e),!0}catch{return!1}}var ch=G(`$ZodBase64`,(e,t)=>{t.pattern??=im,Vm.init(e,t),e._zod.bag.contentEncoding=`base64`,e._zod.check=n=>{sh(n.value)||n.issues.push({code:`invalid_format`,format:`base64`,input:n.value,inst:e,continue:!t.abort})}});function lh(e){if(!am.test(e))return!1;let t=e.replace(/[-_]/g,e=>e===`-`?`+`:`/`);return sh(t.padEnd(Math.ceil(t.length/4)*4,`=`))}var uh=G(`$ZodBase64URL`,(e,t)=>{t.pattern??=am,Vm.init(e,t),e._zod.bag.contentEncoding=`base64url`,e._zod.check=n=>{lh(n.value)||n.issues.push({code:`invalid_format`,format:`base64url`,input:n.value,inst:e,continue:!t.abort})}}),dh=G(`$ZodE164`,(e,t)=>{t.pattern??=sm,Vm.init(e,t)});function fh(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 ph=G(`$ZodJWT`,(e,t)=>{Vm.init(e,t),e._zod.check=n=>{fh(n.value,t.alg)||n.issues.push({code:`invalid_format`,format:`jwt`,input:n.value,inst:e,continue:!t.abort})}}),mh=G(`$ZodNumber`,(e,t)=>{zm.init(e,t),e._zod.pattern=e._zod.bag.pattern??hm,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}}),hh=G(`$ZodNumberFormat`,(e,t)=>{Tm.init(e,t),mh.init(e,t)}),gh=G(`$ZodBoolean`,(e,t)=>{zm.init(e,t),e._zod.pattern=gm,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}}),_h=G(`$ZodNull`,(e,t)=>{zm.init(e,t),e._zod.pattern=_m,e._zod.values=new Set([null]),e._zod.parse=(t,n)=>{let r=t.value;return r===null||t.issues.push({expected:`null`,code:`invalid_type`,input:r,inst:e}),t}}),vh=G(`$ZodUnknown`,(e,t)=>{zm.init(e,t),e._zod.parse=e=>e}),yh=G(`$ZodNever`,(e,t)=>{zm.init(e,t),e._zod.parse=(t,n)=>(t.issues.push({expected:`never`,code:`invalid_type`,input:t.value,inst:e}),t)});function bh(e,t,n){e.issues.length&&t.issues.push(...vp(n,e.issues)),t.value[n]=e.value}var xh=G(`$ZodArray`,(e,t)=>{zm.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=>bh(t,n,e))):bh(s,n,e)}return a.length?Promise.all(a).then(()=>n):n}});function Sh(e,t,n,r,i,a){let o=n in r;if(e.issues.length){if(i&&a&&!o)return;t.issues.push(...vp(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 Ch(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=sp(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(n)}}function wh(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=>Sh(e,n,i,t,u,d))):Sh(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 Th=G(`$ZodObject`,(e,t)=>{if(zm.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=Uf(()=>Ch(t));Jf(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=ep,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=>Sh(n,t,e,s,r,i))):Sh(a,t,e,s,r,i)}return i?wh(c,s,t,o,n.value,e):c.length?Promise.all(c).then(()=>t):t}}),Eh=G(`$ZodObjectJIT`,(e,t)=>{Th.init(e,t);let n=e._zod.parse,r=Uf(()=>Ch(t)),i=e=>{let t=new Lm([`shape`,`payload`,`ctx`]),n=r.value,i=e=>{let t=Zf(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=Zf(r),s=e[r],c=s?._zod?.optin===`optional`,l=s?._zod?.optout===`optional`;t.write(`const ${n} = ${i(r)};`),c&&l?t.write(`
|
|
12
|
-
if (${n}.issues.length) {
|
|
13
|
-
if (${o} in input) {
|
|
14
|
-
payload.issues = payload.issues.concat(${n}.issues.map(iss => ({
|
|
15
|
-
...iss,
|
|
16
|
-
path: iss.path ? [${o}, ...iss.path] : [${o}]
|
|
17
|
-
})));
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
if (${n}.value === undefined) {
|
|
22
|
-
if (${o} in input) {
|
|
23
|
-
newResult[${o}] = undefined;
|
|
24
|
-
}
|
|
25
|
-
} else {
|
|
26
|
-
newResult[${o}] = ${n}.value;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
`):c?t.write(`
|
|
30
|
-
if (${n}.issues.length) {
|
|
31
|
-
payload.issues = payload.issues.concat(${n}.issues.map(iss => ({
|
|
32
|
-
...iss,
|
|
33
|
-
path: iss.path ? [${o}, ...iss.path] : [${o}]
|
|
34
|
-
})));
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
if (${n}.value === undefined) {
|
|
38
|
-
if (${o} in input) {
|
|
39
|
-
newResult[${o}] = undefined;
|
|
40
|
-
}
|
|
41
|
-
} else {
|
|
42
|
-
newResult[${o}] = ${n}.value;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
`):t.write(`
|
|
46
|
-
const ${n}_present = ${o} in input;
|
|
47
|
-
if (${n}.issues.length) {
|
|
48
|
-
payload.issues = payload.issues.concat(${n}.issues.map(iss => ({
|
|
49
|
-
...iss,
|
|
50
|
-
path: iss.path ? [${o}, ...iss.path] : [${o}]
|
|
51
|
-
})));
|
|
52
|
-
}
|
|
53
|
-
if (!${n}_present && !${n}.issues.length) {
|
|
54
|
-
payload.issues.push({
|
|
55
|
-
code: "invalid_type",
|
|
56
|
-
expected: "nonoptional",
|
|
57
|
-
input: undefined,
|
|
58
|
-
path: [${o}]
|
|
59
|
-
});
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
if (${n}_present) {
|
|
63
|
-
if (${n}.value === undefined) {
|
|
64
|
-
newResult[${o}] = undefined;
|
|
65
|
-
} else {
|
|
66
|
-
newResult[${o}] = ${n}.value;
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
`)}t.write(`payload.value = newResult;`),t.write(`return payload;`);let s=t.compile();return(t,n)=>s(e,t,n)},a,o=ep,s=!zf.jitless,c=s&&tp.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?wh([],p,d,f,u,e):d):n(d,f):(d.issues.push({expected:`object`,code:`invalid_type`,input:p,inst:e}),d)}});function Dh(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=>!gp(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=>bp(e,r,Bf())))}),t)}var Oh=G(`$ZodUnion`,(e,t)=>{zm.init(e,t),Jf(e._zod,`optin`,()=>t.options.some(e=>e._zod.optin===`optional`)?`optional`:void 0),Jf(e._zod,`optout`,()=>t.options.some(e=>e._zod.optout===`optional`)?`optional`:void 0),Jf(e._zod,`values`,()=>{if(t.options.every(e=>e._zod.values))return new Set(t.options.flatMap(e=>Array.from(e._zod.values)))}),Jf(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=>Gf(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=>Dh(t,r,e,i)):Dh(o,r,e,i)}}),kh=G(`$ZodDiscriminatedUnion`,(e,t)=>{t.inclusive=!1,Oh.init(e,t);let n=e._zod.parse;Jf(e._zod,`propValues`,()=>{let e={};for(let n of t.options){let r=n._zod.propValues;if(!r||Object.keys(r).length===0)throw Error(`Invalid discriminated union option at index "${t.options.indexOf(n)}"`);for(let[t,n]of Object.entries(r)){e[t]||(e[t]=new Set);for(let r of n)e[t].add(r)}}return e});let r=Uf(()=>{let e=t.options,n=new Map;for(let r of e){let e=r._zod.propValues?.[t.discriminator];if(!e||e.size===0)throw Error(`Invalid discriminated union option at index "${t.options.indexOf(r)}"`);for(let t of e){if(n.has(t))throw Error(`Duplicate discriminator value "${String(t)}"`);n.set(t,r)}}return n});e._zod.parse=(i,a)=>{let o=i.value;if(!ep(o))return i.issues.push({code:`invalid_type`,expected:`object`,input:o,inst:e}),i;let s=r.value.get(o?.[t.discriminator]);return s?s._zod.run(i,a):t.unionFallback||a.direction===`backward`?n(i,a):(i.issues.push({code:`invalid_union`,errors:[],note:`No matching discriminator`,discriminator:t.discriminator,options:Array.from(r.value.keys()),input:o,path:[t.discriminator],inst:e}),i)}}),Ah=G(`$ZodIntersection`,(e,t)=>{zm.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])=>Mh(e,t,n)):Mh(e,i,a)}});function jh(e,t){if(e===t||e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(np(e)&&np(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=jh(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=jh(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 Mh(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}),gp(e))return e;let o=jh(t.value,n.value);if(!o.valid)throw Error(`Unmergable intersection. Error path: ${JSON.stringify(o.mergeErrorPath)}`);return e.value=o.data,e}var Nh=G(`$ZodTuple`,(e,t)=>{zm.init(e,t);let n=t.items;e._zod.parse=(r,i)=>{let a=r.value;if(!Array.isArray(a))return r.issues.push({input:a,inst:e,expected:`tuple`,code:`invalid_type`}),r;r.value=[];let o=[],s=Ph(n,`optin`),c=Ph(n,`optout`);if(!t.rest){if(a.length<s)return r.issues.push({code:`too_small`,minimum:s,inclusive:!0,input:a,inst:e,origin:`array`}),r;a.length>n.length&&r.issues.push({code:`too_big`,maximum:n.length,inclusive:!0,input:a,inst:e,origin:`array`})}let l=Array(n.length);for(let e=0;e<n.length;e++){let t=n[e]._zod.run({value:a[e],issues:[]},i);t instanceof Promise?o.push(t.then(t=>{l[e]=t})):l[e]=t}if(t.rest){let e=n.length-1,s=a.slice(n.length);for(let n of s){e++;let a=t.rest._zod.run({value:n,issues:[]},i);a instanceof Promise?o.push(a.then(t=>Fh(t,r,e))):Fh(a,r,e)}}return o.length?Promise.all(o).then(()=>Ih(l,r,n,a,c)):Ih(l,r,n,a,c)}});function Ph(e,t){for(let n=e.length-1;n>=0;n--)if(e[n]._zod[t]!==`optional`)return n+1;return 0}function Fh(e,t,n){e.issues.length&&t.issues.push(...vp(n,e.issues)),t.value[n]=e.value}function Ih(e,t,n,r,i){for(let a=0;a<n.length;a++){let n=e[a],o=a<r.length;if(n.issues.length){if(!o&&a>=i){t.value.length=a;break}t.issues.push(...vp(a,n.issues))}t.value[a]=n.value}for(let e=t.value.length-1;e>=r.length&&n[e]._zod.optout===`optional`&&t.value[e]===void 0;e--)t.value.length=e;return t}var Lh=G(`$ZodRecord`,(e,t)=>{zm.init(e,t),e._zod.parse=(n,r)=>{let i=n.value;if(!np(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=>bp(e,r,Bf())),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(...vp(c,e.issues)),n.value[l]=e.value})):(u.issues.length&&n.issues.push(...vp(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`&&hm.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=>bp(e,r,Bf())),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(...vp(o,e.issues)),n.value[s.value]=e.value})):(c.issues.length&&n.issues.push(...vp(o,c.issues)),n.value[s.value]=c.value)}}return a.length?Promise.all(a).then(()=>n):n}}),Rh=G(`$ZodEnum`,(e,t)=>{zm.init(e,t);let n=Vf(t.entries),r=new Set(n);e._zod.values=r,e._zod.pattern=RegExp(`^(${n.filter(e=>ip.has(typeof e)).map(e=>typeof e==`string`?ap(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}}),zh=G(`$ZodLiteral`,(e,t)=>{if(zm.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`?ap(e):e?ap(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}}),Bh=G(`$ZodTransform`,(e,t)=>{zm.init(e,t),e._zod.optin=`optional`,e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new Rf(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 Lf;return n.value=i,n.fallback=!0,n}});function Vh(e,t){return t===void 0&&(e.issues.length||e.fallback)?{issues:[],value:void 0}:e}var Hh=G(`$ZodOptional`,(e,t)=>{zm.init(e,t),e._zod.optin=`optional`,e._zod.optout=`optional`,Jf(e._zod,`values`,()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),Jf(e._zod,`pattern`,()=>{let e=t.innerType._zod.pattern;return e?RegExp(`^(${Gf(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=>Vh(e,r)):Vh(i,r)}return e.value===void 0?e:t.innerType._zod.run(e,n)}}),Uh=G(`$ZodExactOptional`,(e,t)=>{Hh.init(e,t),Jf(e._zod,`values`,()=>t.innerType._zod.values),Jf(e._zod,`pattern`,()=>t.innerType._zod.pattern),e._zod.parse=(e,n)=>t.innerType._zod.run(e,n)}),Wh=G(`$ZodNullable`,(e,t)=>{zm.init(e,t),Jf(e._zod,`optin`,()=>t.innerType._zod.optin),Jf(e._zod,`optout`,()=>t.innerType._zod.optout),Jf(e._zod,`pattern`,()=>{let e=t.innerType._zod.pattern;return e?RegExp(`^(${Gf(e.source)}|null)$`):void 0}),Jf(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)}),Gh=G(`$ZodDefault`,(e,t)=>{zm.init(e,t),e._zod.optin=`optional`,Jf(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=>Kh(e,t)):Kh(r,t)}});function Kh(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}var qh=G(`$ZodPrefault`,(e,t)=>{zm.init(e,t),e._zod.optin=`optional`,Jf(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))}),Jh=G(`$ZodNonOptional`,(e,t)=>{zm.init(e,t),Jf(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=>Yh(t,e)):Yh(i,e)}});function Yh(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 Xh=G(`$ZodCatch`,(e,t)=>{zm.init(e,t),e._zod.optin=`optional`,Jf(e._zod,`optout`,()=>t.innerType._zod.optout),Jf(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=>bp(e,n,Bf()))},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=>bp(e,n,Bf()))},input:e.value}),e.issues=[],e.fallback=!0),e)}}),Zh=G(`$ZodPipe`,(e,t)=>{zm.init(e,t),Jf(e._zod,`values`,()=>t.in._zod.values),Jf(e._zod,`optin`,()=>t.in._zod.optin),Jf(e._zod,`optout`,()=>t.out._zod.optout),Jf(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=>Qh(e,t.in,n)):Qh(r,t.in,n)}let r=t.in._zod.run(e,n);return r instanceof Promise?r.then(e=>Qh(e,t.out,n)):Qh(r,t.out,n)}});function Qh(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 $h=G(`$ZodReadonly`,(e,t)=>{zm.init(e,t),Jf(e._zod,`propValues`,()=>t.innerType._zod.propValues),Jf(e._zod,`values`,()=>t.innerType._zod.values),Jf(e._zod,`optin`,()=>t.innerType?._zod?.optin),Jf(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(eg):eg(r)}});function eg(e){return e.value=Object.freeze(e.value),e}var tg=G(`$ZodLazy`,(e,t)=>{zm.init(e,t),Jf(e._zod,`innerType`,()=>{let e=t;return e._cachedInner||=t.getter(),e._cachedInner}),Jf(e._zod,`pattern`,()=>e._zod.innerType?._zod?.pattern),Jf(e._zod,`propValues`,()=>e._zod.innerType?._zod?.propValues),Jf(e._zod,`optin`,()=>e._zod.innerType?._zod?.optin??void 0),Jf(e._zod,`optout`,()=>e._zod.innerType?._zod?.optout??void 0),e._zod.parse=(t,n)=>e._zod.innerType._zod.run(t,n)}),ng=G(`$ZodCustom`,(e,t)=>{bm.init(e,t),zm.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=>rg(t,n,r,e));rg(i,n,r,e)}});function rg(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(Sp(e))}}var ig,ag=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 og(){return new ag}(ig=globalThis).__zod_globalRegistry??(ig.__zod_globalRegistry=og());var sg=globalThis.__zod_globalRegistry;function cg(e,t){return new e({type:`string`,...K(t)})}function lg(e,t){return new e({type:`string`,format:`email`,check:`string_format`,abort:!1,...K(t)})}function ug(e,t){return new e({type:`string`,format:`guid`,check:`string_format`,abort:!1,...K(t)})}function dg(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,...K(t)})}function fg(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v4`,...K(t)})}function pg(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v6`,...K(t)})}function mg(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v7`,...K(t)})}function hg(e,t){return new e({type:`string`,format:`url`,check:`string_format`,abort:!1,...K(t)})}function gg(e,t){return new e({type:`string`,format:`emoji`,check:`string_format`,abort:!1,...K(t)})}function _g(e,t){return new e({type:`string`,format:`nanoid`,check:`string_format`,abort:!1,...K(t)})}function vg(e,t){return new e({type:`string`,format:`cuid`,check:`string_format`,abort:!1,...K(t)})}function yg(e,t){return new e({type:`string`,format:`cuid2`,check:`string_format`,abort:!1,...K(t)})}function bg(e,t){return new e({type:`string`,format:`ulid`,check:`string_format`,abort:!1,...K(t)})}function xg(e,t){return new e({type:`string`,format:`xid`,check:`string_format`,abort:!1,...K(t)})}function Sg(e,t){return new e({type:`string`,format:`ksuid`,check:`string_format`,abort:!1,...K(t)})}function Cg(e,t){return new e({type:`string`,format:`ipv4`,check:`string_format`,abort:!1,...K(t)})}function wg(e,t){return new e({type:`string`,format:`ipv6`,check:`string_format`,abort:!1,...K(t)})}function Tg(e,t){return new e({type:`string`,format:`cidrv4`,check:`string_format`,abort:!1,...K(t)})}function Eg(e,t){return new e({type:`string`,format:`cidrv6`,check:`string_format`,abort:!1,...K(t)})}function Dg(e,t){return new e({type:`string`,format:`base64`,check:`string_format`,abort:!1,...K(t)})}function Og(e,t){return new e({type:`string`,format:`base64url`,check:`string_format`,abort:!1,...K(t)})}function kg(e,t){return new e({type:`string`,format:`e164`,check:`string_format`,abort:!1,...K(t)})}function Ag(e,t){return new e({type:`string`,format:`jwt`,check:`string_format`,abort:!1,...K(t)})}function jg(e,t){return new e({type:`string`,format:`datetime`,check:`string_format`,offset:!1,local:!1,precision:null,...K(t)})}function Mg(e,t){return new e({type:`string`,format:`date`,check:`string_format`,...K(t)})}function Ng(e,t){return new e({type:`string`,format:`time`,check:`string_format`,precision:null,...K(t)})}function Pg(e,t){return new e({type:`string`,format:`duration`,check:`string_format`,...K(t)})}function Fg(e,t){return new e({type:`number`,checks:[],...K(t)})}function Ig(e,t){return new e({type:`number`,coerce:!0,checks:[],...K(t)})}function Lg(e,t){return new e({type:`number`,check:`number_format`,abort:!1,format:`safeint`,...K(t)})}function Rg(e,t){return new e({type:`boolean`,...K(t)})}function zg(e,t){return new e({type:`null`,...K(t)})}function Bg(e){return new e({type:`unknown`})}function Vg(e,t){return new e({type:`never`,...K(t)})}function Hg(e,t){return new Sm({check:`less_than`,...K(t),value:e,inclusive:!1})}function Ug(e,t){return new Sm({check:`less_than`,...K(t),value:e,inclusive:!0})}function Wg(e,t){return new Cm({check:`greater_than`,...K(t),value:e,inclusive:!1})}function Gg(e,t){return new Cm({check:`greater_than`,...K(t),value:e,inclusive:!0})}function Kg(e,t){return new wm({check:`multiple_of`,...K(t),value:e})}function qg(e,t){return new Em({check:`max_length`,...K(t),maximum:e})}function Jg(e,t){return new Dm({check:`min_length`,...K(t),minimum:e})}function Yg(e,t){return new Om({check:`length_equals`,...K(t),length:e})}function Xg(e,t){return new Am({check:`string_format`,format:`regex`,...K(t),pattern:e})}function Zg(e){return new jm({check:`string_format`,format:`lowercase`,...K(e)})}function Qg(e){return new Mm({check:`string_format`,format:`uppercase`,...K(e)})}function $g(e,t){return new Nm({check:`string_format`,format:`includes`,...K(t),includes:e})}function e_(e,t){return new Pm({check:`string_format`,format:`starts_with`,...K(t),prefix:e})}function t_(e,t){return new Fm({check:`string_format`,format:`ends_with`,...K(t),suffix:e})}function n_(e){return new Im({check:`overwrite`,tx:e})}function r_(e){return n_(t=>t.normalize(e))}function i_(){return n_(e=>e.trim())}function a_(){return n_(e=>e.toLowerCase())}function o_(){return n_(e=>e.toUpperCase())}function s_(){return n_(e=>Qf(e))}function c_(e,t,n){return new e({type:`array`,element:t,...K(n)})}function l_(e,t,n){return new e({type:`custom`,check:`custom`,fn:t,...K(n)})}function u_(e,t){let n=d_(t=>(t.addIssue=e=>{if(typeof e==`string`)t.issues.push(Sp(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(Sp(r))}},e(t.value,t)),t);return n}function d_(e,t){let n=new bm({check:`custom`,...K(t)});return n._zod.check=e,n}function f_(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??sg,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 p_(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,p_(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`&&g_(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 m_(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>
|
|
71
|
-
|
|
72
|
-
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 h_(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:v_(t,`input`,e.processors),output:v_(t,`output`,e.processors)}},enumerable:!1,writable:!1}),n}catch{throw Error(`Error converting schema to JSON.`)}}function g_(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 g_(r.element,n);if(r.type===`set`)return g_(r.valueType,n);if(r.type===`lazy`)return g_(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 g_(r.innerType,n);if(r.type===`intersection`)return g_(r.left,n)||g_(r.right,n);if(r.type===`record`||r.type===`map`)return g_(r.keyType,n)||g_(r.valueType,n);if(r.type===`pipe`)return e._zod.traits.has(`$ZodCodec`)?!0:g_(r.in,n)||g_(r.out,n);if(r.type===`object`){for(let e in r.shape)if(g_(r.shape[e],n))return!0;return!1}if(r.type===`union`){for(let e of r.options)if(g_(e,n))return!0;return!1}if(r.type===`tuple`){for(let e of r.items)if(g_(e,n))return!0;return!!(r.rest&&g_(r.rest,n))}return!1}var __=(e,t={})=>n=>{let r=f_({...n,processors:t});return p_(e,r),m_(r,e),h_(r,e)},v_=(e,t,n={})=>r=>{let{libraryOptions:i,target:a}=r??{},o=f_({...i??{},target:a,io:t,processors:n});return p_(e,o),m_(o,e),h_(o,e)},y_={guid:`uuid`,url:`uri`,datetime:`date-time`,json_string:`json-string`,regex:``},b_=(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=y_[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}))])}},x_=(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)},S_=(e,t,n,r)=>{n.type=`boolean`},C_=(e,t,n,r)=>{t.target===`openapi-3.0`?(n.type=`string`,n.nullable=!0,n.enum=[null]):n.type=`null`},w_=(e,t,n,r)=>{n.not={}},T_=(e,t,n,r)=>{let i=e._zod.def,a=Vf(i.entries);a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),n.enum=a},E_=(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},D_=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Custom types cannot be represented in JSON Schema`)},O_=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Transforms cannot be represented in JSON Schema`)},k_=(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=p_(a.element,t,{...r,path:[...r.path,`items`]})},A_=(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]=p_(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=p_(a.catchall,t,{...r,path:[...r.path,`additionalProperties`]})):t.io===`output`&&(i.additionalProperties=!1)},j_=(e,t,n,r)=>{let i=e._zod.def,a=i.inclusive===!1,o=i.options.map((e,n)=>p_(e,t,{...r,path:[...r.path,a?`oneOf`:`anyOf`,n]}));a?n.oneOf=o:n.anyOf=o},M_=(e,t,n,r)=>{let i=e._zod.def,a=p_(i.left,t,{...r,path:[...r.path,`allOf`,0]}),o=p_(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]]},N_=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`array`;let o=t.target===`draft-2020-12`?`prefixItems`:`items`,s=t.target===`draft-2020-12`||t.target===`openapi-3.0`?`items`:`additionalItems`,c=a.items.map((e,n)=>p_(e,t,{...r,path:[...r.path,o,n]})),l=a.rest?p_(a.rest,t,{...r,path:[...r.path,s,...t.target===`openapi-3.0`?[a.items.length]:[]]}):null;t.target===`draft-2020-12`?(i.prefixItems=c,l&&(i.items=l)):t.target===`openapi-3.0`?(i.items={anyOf:c},l&&i.items.anyOf.push(l),i.minItems=c.length,l||(i.maxItems=c.length)):(i.items=c,l&&(i.additionalItems=l));let{minimum:u,maximum:d}=e._zod.bag;typeof u==`number`&&(i.minItems=u),typeof d==`number`&&(i.maxItems=d)},P_=(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=p_(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=p_(a.keyType,t,{...r,path:[...r.path,`propertyNames`]})),i.additionalProperties=p_(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)}},F_=(e,t,n,r)=>{let i=e._zod.def,a=p_(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`}]},I_=(e,t,n,r)=>{let i=e._zod.def;p_(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},L_=(e,t,n,r)=>{let i=e._zod.def;p_(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.default=JSON.parse(JSON.stringify(i.defaultValue))},R_=(e,t,n,r)=>{let i=e._zod.def;p_(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)))},z_=(e,t,n,r)=>{let i=e._zod.def;p_(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},B_=(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;p_(o,t,r);let s=t.seen.get(e);s.ref=o},V_=(e,t,n,r)=>{let i=e._zod.def;p_(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.readOnly=!0},H_=(e,t,n,r)=>{let i=e._zod.def;p_(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},U_=(e,t,n,r)=>{let i=e._zod.innerType;p_(i,t,r);let a=t.seen.get(e);a.ref=i},W_=G(`ZodISODateTime`,(e,t)=>{$m.init(e,t),gv.init(e,t)});function G_(e){return jg(W_,e)}var K_=G(`ZodISODate`,(e,t)=>{eh.init(e,t),gv.init(e,t)});function q_(e){return Mg(K_,e)}var J_=G(`ZodISOTime`,(e,t)=>{th.init(e,t),gv.init(e,t)});function Y_(e){return Ng(J_,e)}var X_=G(`ZodISODuration`,(e,t)=>{nh.init(e,t),gv.init(e,t)});function Z_(e){return Pg(X_,e)}var Q_=G(`ZodError`,(e,t)=>{wp.init(e,t),e.name=`ZodError`,Object.defineProperties(e,{format:{value:t=>Dp(e,t)},flatten:{value:t=>Ep(e,t)},addIssue:{value:t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,Hf,2)}},addIssues:{value:t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,Hf,2)}},isEmpty:{get(){return e.issues.length===0}}})},{Parent:Error}),$_=Op(Q_),ev=kp(Q_),tv=Ap(Q_),nv=Mp(Q_),rv=Pp(Q_),iv=Fp(Q_),av=Ip(Q_),ov=Lp(Q_),sv=Rp(Q_),cv=zp(Q_),lv=Bp(Q_),uv=Vp(Q_),dv=new WeakMap;function fv(e,t,n){let r=Object.getPrototypeOf(e),i=dv.get(r);if(i||(i=new Set,dv.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 pv=G(`ZodType`,(e,t)=>(zm.init(e,t),Object.assign(e[`~standard`],{jsonSchema:{input:v_(e,`input`),output:v_(e,`output`)}}),e.toJSONSchema=__(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.parse=(t,n)=>$_(e,t,n,{callee:e.parse}),e.safeParse=(t,n)=>tv(e,t,n),e.parseAsync=async(t,n)=>ev(e,t,n,{callee:e.parseAsync}),e.safeParseAsync=async(t,n)=>nv(e,t,n),e.spa=e.safeParseAsync,e.encode=(t,n)=>rv(e,t,n),e.decode=(t,n)=>iv(e,t,n),e.encodeAsync=async(t,n)=>av(e,t,n),e.decodeAsync=async(t,n)=>ov(e,t,n),e.safeEncode=(t,n)=>sv(e,t,n),e.safeDecode=(t,n)=>cv(e,t,n),e.safeEncodeAsync=async(t,n)=>lv(e,t,n),e.safeDecodeAsync=async(t,n)=>uv(e,t,n),fv(e,`ZodType`,{check(...e){let t=this.def;return this.clone(Xf(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 op(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(Py(e,t))},superRefine(e,t){return this.check(Fy(e,t))},overwrite(e){return this.check(n_(e))},optional(){return my(this)},exactOptional(){return gy(this)},nullable(){return vy(this)},nullish(){return my(vy(this))},nonoptional(e){return wy(this,e)},array(){return Yv(this)},or(e){return $v([this,e])},and(e){return ry(this,e)},transform(e){return Oy(this,fy(e))},default(e){return by(this,e)},prefault(e){return Sy(this,e)},catch(e){return Ey(this,e)},pipe(e){return Oy(this,e)},readonly(){return Ay(this)},describe(e){let t=this.clone();return sg.add(t,{description:e}),t},meta(...e){if(e.length===0)return sg.get(this);let t=this.clone();return sg.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 sg.get(e)?.description},configurable:!0}),e)),mv=G(`_ZodString`,(e,t)=>{Bm.init(e,t),pv.init(e,t),e._zod.processJSONSchema=(t,n,r)=>b_(e,t,n,r);let n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null,fv(e,`_ZodString`,{regex(...e){return this.check(Xg(...e))},includes(...e){return this.check($g(...e))},startsWith(...e){return this.check(e_(...e))},endsWith(...e){return this.check(t_(...e))},min(...e){return this.check(Jg(...e))},max(...e){return this.check(qg(...e))},length(...e){return this.check(Yg(...e))},nonempty(...e){return this.check(Jg(1,...e))},lowercase(e){return this.check(Zg(e))},uppercase(e){return this.check(Qg(e))},trim(){return this.check(i_())},normalize(...e){return this.check(r_(...e))},toLowerCase(){return this.check(a_())},toUpperCase(){return this.check(o_())},slugify(){return this.check(s_())}})}),hv=G(`ZodString`,(e,t)=>{Bm.init(e,t),mv.init(e,t),e.email=t=>e.check(lg(_v,t)),e.url=t=>e.check(hg(bv,t)),e.jwt=t=>e.check(Ag(Fv,t)),e.emoji=t=>e.check(gg(xv,t)),e.guid=t=>e.check(ug(vv,t)),e.uuid=t=>e.check(dg(yv,t)),e.uuidv4=t=>e.check(fg(yv,t)),e.uuidv6=t=>e.check(pg(yv,t)),e.uuidv7=t=>e.check(mg(yv,t)),e.nanoid=t=>e.check(_g(Sv,t)),e.guid=t=>e.check(ug(vv,t)),e.cuid=t=>e.check(vg(Cv,t)),e.cuid2=t=>e.check(yg(wv,t)),e.ulid=t=>e.check(bg(Tv,t)),e.base64=t=>e.check(Dg(Mv,t)),e.base64url=t=>e.check(Og(Nv,t)),e.xid=t=>e.check(xg(Ev,t)),e.ksuid=t=>e.check(Sg(Dv,t)),e.ipv4=t=>e.check(Cg(Ov,t)),e.ipv6=t=>e.check(wg(kv,t)),e.cidrv4=t=>e.check(Tg(Av,t)),e.cidrv6=t=>e.check(Eg(jv,t)),e.e164=t=>e.check(kg(Pv,t)),e.datetime=t=>e.check(G_(t)),e.date=t=>e.check(q_(t)),e.time=t=>e.check(Y_(t)),e.duration=t=>e.check(Z_(t))});function q(e){return cg(hv,e)}var gv=G(`ZodStringFormat`,(e,t)=>{Vm.init(e,t),mv.init(e,t)}),_v=G(`ZodEmail`,(e,t)=>{Wm.init(e,t),gv.init(e,t)}),vv=G(`ZodGUID`,(e,t)=>{Hm.init(e,t),gv.init(e,t)}),yv=G(`ZodUUID`,(e,t)=>{Um.init(e,t),gv.init(e,t)}),bv=G(`ZodURL`,(e,t)=>{Gm.init(e,t),gv.init(e,t)}),xv=G(`ZodEmoji`,(e,t)=>{Km.init(e,t),gv.init(e,t)}),Sv=G(`ZodNanoID`,(e,t)=>{qm.init(e,t),gv.init(e,t)}),Cv=G(`ZodCUID`,(e,t)=>{Jm.init(e,t),gv.init(e,t)}),wv=G(`ZodCUID2`,(e,t)=>{Ym.init(e,t),gv.init(e,t)}),Tv=G(`ZodULID`,(e,t)=>{Xm.init(e,t),gv.init(e,t)}),Ev=G(`ZodXID`,(e,t)=>{Zm.init(e,t),gv.init(e,t)}),Dv=G(`ZodKSUID`,(e,t)=>{Qm.init(e,t),gv.init(e,t)}),Ov=G(`ZodIPv4`,(e,t)=>{rh.init(e,t),gv.init(e,t)}),kv=G(`ZodIPv6`,(e,t)=>{ih.init(e,t),gv.init(e,t)}),Av=G(`ZodCIDRv4`,(e,t)=>{ah.init(e,t),gv.init(e,t)}),jv=G(`ZodCIDRv6`,(e,t)=>{oh.init(e,t),gv.init(e,t)}),Mv=G(`ZodBase64`,(e,t)=>{ch.init(e,t),gv.init(e,t)}),Nv=G(`ZodBase64URL`,(e,t)=>{uh.init(e,t),gv.init(e,t)}),Pv=G(`ZodE164`,(e,t)=>{dh.init(e,t),gv.init(e,t)}),Fv=G(`ZodJWT`,(e,t)=>{ph.init(e,t),gv.init(e,t)}),Iv=G(`ZodNumber`,(e,t)=>{mh.init(e,t),pv.init(e,t),e._zod.processJSONSchema=(t,n,r)=>x_(e,t,n,r),fv(e,`ZodNumber`,{gt(e,t){return this.check(Wg(e,t))},gte(e,t){return this.check(Gg(e,t))},min(e,t){return this.check(Gg(e,t))},lt(e,t){return this.check(Hg(e,t))},lte(e,t){return this.check(Ug(e,t))},max(e,t){return this.check(Ug(e,t))},int(e){return this.check(zv(e))},safe(e){return this.check(zv(e))},positive(e){return this.check(Wg(0,e))},nonnegative(e){return this.check(Gg(0,e))},negative(e){return this.check(Hg(0,e))},nonpositive(e){return this.check(Ug(0,e))},multipleOf(e,t){return this.check(Kg(e,t))},step(e,t){return this.check(Kg(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 Lv(e){return Fg(Iv,e)}var Rv=G(`ZodNumberFormat`,(e,t)=>{hh.init(e,t),Iv.init(e,t)});function zv(e){return Lg(Rv,e)}var Bv=G(`ZodBoolean`,(e,t)=>{gh.init(e,t),pv.init(e,t),e._zod.processJSONSchema=(t,n,r)=>S_(e,t,n,r)});function Vv(e){return Rg(Bv,e)}var Hv=G(`ZodNull`,(e,t)=>{_h.init(e,t),pv.init(e,t),e._zod.processJSONSchema=(t,n,r)=>C_(e,t,n,r)});function Uv(e){return zg(Hv,e)}var Wv=G(`ZodUnknown`,(e,t)=>{vh.init(e,t),pv.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function Gv(){return Bg(Wv)}var Kv=G(`ZodNever`,(e,t)=>{yh.init(e,t),pv.init(e,t),e._zod.processJSONSchema=(t,n,r)=>w_(e,t,n,r)});function qv(e){return Vg(Kv,e)}var Jv=G(`ZodArray`,(e,t)=>{xh.init(e,t),pv.init(e,t),e._zod.processJSONSchema=(t,n,r)=>k_(e,t,n,r),e.element=t.element,fv(e,`ZodArray`,{min(e,t){return this.check(Jg(e,t))},nonempty(e){return this.check(Jg(1,e))},max(e,t){return this.check(qg(e,t))},length(e,t){return this.check(Yg(e,t))},unwrap(){return this.element}})});function Yv(e,t){return c_(Jv,e,t)}var Xv=G(`ZodObject`,(e,t)=>{Eh.init(e,t),pv.init(e,t),e._zod.processJSONSchema=(t,n,r)=>A_(e,t,n,r),Jf(e,`shape`,()=>t.shape),fv(e,`ZodObject`,{keyof(){return ly(Object.keys(this._zod.def.shape))},catchall(e){return this.clone({...this._zod.def,catchall:e})},passthrough(){return this.clone({...this._zod.def,catchall:Gv()})},loose(){return this.clone({...this._zod.def,catchall:Gv()})},strict(){return this.clone({...this._zod.def,catchall:qv()})},strip(){return this.clone({...this._zod.def,catchall:void 0})},extend(e){return dp(this,e)},safeExtend(e){return fp(this,e)},merge(e){return pp(this,e)},pick(e){return lp(this,e)},omit(e){return up(this,e)},partial(...e){return mp(py,this,e[0])},required(...e){return hp(Cy,this,e[0])}})});function Zv(e,t){return new Xv({type:`object`,shape:e??{},...K(t)})}function J(e,t){return new Xv({type:`object`,shape:e,catchall:qv(),...K(t)})}var Qv=G(`ZodUnion`,(e,t)=>{Oh.init(e,t),pv.init(e,t),e._zod.processJSONSchema=(t,n,r)=>j_(e,t,n,r),e.options=t.options});function $v(e,t){return new Qv({type:`union`,options:e,...K(t)})}var ey=G(`ZodDiscriminatedUnion`,(e,t)=>{Qv.init(e,t),kh.init(e,t)});function ty(e,t,n){return new ey({type:`union`,options:t,discriminator:e,...K(n)})}var ny=G(`ZodIntersection`,(e,t)=>{Ah.init(e,t),pv.init(e,t),e._zod.processJSONSchema=(t,n,r)=>M_(e,t,n,r)});function ry(e,t){return new ny({type:`intersection`,left:e,right:t})}var iy=G(`ZodTuple`,(e,t)=>{Nh.init(e,t),pv.init(e,t),e._zod.processJSONSchema=(t,n,r)=>N_(e,t,n,r),e.rest=t=>e.clone({...e._zod.def,rest:t})});function ay(e,t,n){let r=t instanceof zm;return new iy({type:`tuple`,items:e,rest:r?t:null,...K(r?n:t)})}var oy=G(`ZodRecord`,(e,t)=>{Lh.init(e,t),pv.init(e,t),e._zod.processJSONSchema=(t,n,r)=>P_(e,t,n,r),e.keyType=t.keyType,e.valueType=t.valueType});function sy(e,t,n){return!t||!t._zod?new oy({type:`record`,keyType:q(),valueType:e,...K(t)}):new oy({type:`record`,keyType:e,valueType:t,...K(n)})}var cy=G(`ZodEnum`,(e,t)=>{Rh.init(e,t),pv.init(e,t),e._zod.processJSONSchema=(t,n,r)=>T_(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 cy({...t,checks:[],...K(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 cy({...t,checks:[],...K(r),entries:i})}});function ly(e,t){return new cy({type:`enum`,entries:Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e,...K(t)})}var uy=G(`ZodLiteral`,(e,t)=>{zh.init(e,t),pv.init(e,t),e._zod.processJSONSchema=(t,n,r)=>E_(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 Y(e,t){return new uy({type:`literal`,values:Array.isArray(e)?e:[e],...K(t)})}var dy=G(`ZodTransform`,(e,t)=>{Bh.init(e,t),pv.init(e,t),e._zod.processJSONSchema=(t,n,r)=>O_(e,t,n,r),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new Rf(e.constructor.name);n.addIssue=r=>{if(typeof r==`string`)n.issues.push(Sp(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(Sp(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 fy(e){return new dy({type:`transform`,transform:e})}var py=G(`ZodOptional`,(e,t)=>{Hh.init(e,t),pv.init(e,t),e._zod.processJSONSchema=(t,n,r)=>H_(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function my(e){return new py({type:`optional`,innerType:e})}var hy=G(`ZodExactOptional`,(e,t)=>{Uh.init(e,t),pv.init(e,t),e._zod.processJSONSchema=(t,n,r)=>H_(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function gy(e){return new hy({type:`optional`,innerType:e})}var _y=G(`ZodNullable`,(e,t)=>{Wh.init(e,t),pv.init(e,t),e._zod.processJSONSchema=(t,n,r)=>F_(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function vy(e){return new _y({type:`nullable`,innerType:e})}var yy=G(`ZodDefault`,(e,t)=>{Gh.init(e,t),pv.init(e,t),e._zod.processJSONSchema=(t,n,r)=>L_(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function by(e,t){return new yy({type:`default`,innerType:e,get defaultValue(){return typeof t==`function`?t():rp(t)}})}var xy=G(`ZodPrefault`,(e,t)=>{qh.init(e,t),pv.init(e,t),e._zod.processJSONSchema=(t,n,r)=>R_(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Sy(e,t){return new xy({type:`prefault`,innerType:e,get defaultValue(){return typeof t==`function`?t():rp(t)}})}var Cy=G(`ZodNonOptional`,(e,t)=>{Jh.init(e,t),pv.init(e,t),e._zod.processJSONSchema=(t,n,r)=>I_(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function wy(e,t){return new Cy({type:`nonoptional`,innerType:e,...K(t)})}var Ty=G(`ZodCatch`,(e,t)=>{Xh.init(e,t),pv.init(e,t),e._zod.processJSONSchema=(t,n,r)=>z_(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function Ey(e,t){return new Ty({type:`catch`,innerType:e,catchValue:typeof t==`function`?t:()=>t})}var Dy=G(`ZodPipe`,(e,t)=>{Zh.init(e,t),pv.init(e,t),e._zod.processJSONSchema=(t,n,r)=>B_(e,t,n,r),e.in=t.in,e.out=t.out});function Oy(e,t){return new Dy({type:`pipe`,in:e,out:t})}var ky=G(`ZodReadonly`,(e,t)=>{$h.init(e,t),pv.init(e,t),e._zod.processJSONSchema=(t,n,r)=>V_(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Ay(e){return new ky({type:`readonly`,innerType:e})}var jy=G(`ZodLazy`,(e,t)=>{tg.init(e,t),pv.init(e,t),e._zod.processJSONSchema=(t,n,r)=>U_(e,t,n,r),e.unwrap=()=>e._zod.def.getter()});function My(e){return new jy({type:`lazy`,getter:e})}var Ny=G(`ZodCustom`,(e,t)=>{ng.init(e,t),pv.init(e,t),e._zod.processJSONSchema=(t,n,r)=>D_(e,t,n,r)});function Py(e,t={}){return l_(Ny,e,t)}function Fy(e,t){return u_(e,t)}function Iy(e,t={}){let n=new Ny({type:`custom`,check:`custom`,fn:t=>t instanceof e,abort:!0,...K(t)});return n._zod.bag.Class=e,n._zod.check=t=>{t.value instanceof e||t.issues.push({code:`invalid_type`,expected:e.name,input:t.value,inst:n,path:[...n._zod.def.path??[]]})},n}function Ly(e){let t=My(()=>$v([q(e),Lv(),Vv(),Uv(),Yv(t),sy(q(),t)]));return t}function Ry(e){return Ig(Iv,e)}var zy=(...e)=>e.filter((e,t,n)=>!!e&&e.trim()!==``&&n.indexOf(e)===t).join(` `).trim(),By=e=>e.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).toLowerCase(),Vy=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,t,n)=>n?n.toUpperCase():t.toLowerCase()),Hy=e=>{let t=Vy(e);return t.charAt(0).toUpperCase()+t.slice(1)},Uy={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`},Wy=e=>{for(let t in e)if(t.startsWith(`aria-`)||t===`role`||t===`title`)return!0;return!1},Gy=(0,B.createContext)({}),Ky=()=>(0,B.useContext)(Gy),qy=(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=``}=Ky()??{},m=r??d?Number(n??u)*24/Number(t??l):n??u;return(0,B.createElement)(`svg`,{ref:c,...Uy,width:t??l??Uy.width,height:t??l??Uy.height,stroke:e??f,strokeWidth:m,className:zy(`lucide`,p,i),...!a&&!Wy(s)&&{"aria-hidden":`true`},...s},[...o.map(([e,t])=>(0,B.createElement)(e,t)),...Array.isArray(a)?a:[a]])}),Jy=(e,t)=>{let n=(0,B.forwardRef)(({className:n,...r},i)=>(0,B.createElement)(qy,{ref:i,iconNode:t,className:zy(`lucide-${By(Hy(e))}`,`lucide-${e}`,n),...r}));return n.displayName=Hy(e),n},Yy=Jy(`bell`,[[`path`,{d:`M10.268 21a2 2 0 0 0 3.464 0`,key:`vwvbt9`}],[`path`,{d:`M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326`,key:`11g9vi`}]]),Xy=Jy(`check`,[[`path`,{d:`M20 6 9 17l-5-5`,key:`1gmf2c`}]]),Zy=Jy(`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`}]]),Qy=Jy(`download`,[[`path`,{d:`M12 15V3`,key:`m9g1x1`}],[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`,key:`ih7n3h`}],[`path`,{d:`m7 10 5 5 5-5`,key:`brsn70`}]]),$y=Jy(`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`}]]),eb=Jy(`loader-circle`,[[`path`,{d:`M21 12a9 9 0 1 1-6.219-8.56`,key:`13zald`}]]),tb=Jy(`panel-left`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M9 3v18`,key:`fh3hqa`}]]),nb=Jy(`panel-right`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M15 3v18`,key:`14nvp0`}]]),rb=Jy(`triangle-alert`,[[`path`,{d:`m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3`,key:`wmoenq`}],[`path`,{d:`M12 9v4`,key:`juzpu7`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]]),ib=Jy(`x`,[[`path`,{d:`M18 6 6 18`,key:`1bl5f8`}],[`path`,{d:`m6 6 12 12`,key:`d8bk6v`}]]),ab=Object.defineProperty,ob=(e,t)=>ab(e,`name`,{value:t,configurable:!0});function sb(e,t){if(typeof e==`function`)return e(t);e!=null&&(e.current=t)}ob(sb,`setRef`);function cb(...e){return t=>{let n=!1,r=e.map(e=>{let r=sb(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():sb(e[t],null)}}}}ob(cb,`composeRefs`);function lb(...e){return B.useCallback(cb(...e),e)}ob(lb,`useComposedRefs`);var ub=Object.defineProperty,db=(e,t)=>ub(e,`name`,{value:t,configurable:!0});function fb(e){let t=B.forwardRef((t,n)=>{let{children:r,...i}=t,a=null,o=!1,s=[];xb(r)&&typeof Tb==`function`&&(r=Tb(r._payload)),B.Children.forEach(r,e=>{if(yb(e)){o=!0;let t=e,n=`child`in t.props?t.props.child:t.props.children;xb(n)&&typeof Tb==`function`&&(n=Tb(n._payload)),a=gb(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?vb(a):void 0,l=lb(n,c);if(!a){if(r||r===0)throw Error(o?wb(e):Cb(e));return r}let u=_b(i,a.props??{});return a.type!==B.Fragment&&(u.ref=n?l:c),B.cloneElement(a,u)});return t.displayName=`${e}.Slot`,t}db(fb,`createSlot`);var pb=fb(`Slot`),mb=Symbol.for(`radix.slottable`);function hb(e){let t=db(e=>`child`in e?e.children(e.child):e.children,`Slottable`);return t.displayName=`${e}.Slottable`,t.__radixId=mb,t}db(hb,`createSlottable`);var gb=db((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 _b(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}}db(_b,`mergeProps`);function vb(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)}db(vb,`getElementRef`);function yb(e){return B.isValidElement(e)&&typeof e.type==`function`&&`__radixId`in e.type&&e.type.__radixId===mb}db(yb,`isSlottable`);var bb=Symbol.for(`react.lazy`);function xb(e){return typeof e==`object`&&!!e&&`$$typeof`in e&&e.$$typeof===bb&&`_payload`in e&&Sb(e._payload)}db(xb,`isLazyComponent`);function Sb(e){return typeof e==`object`&&!!e&&`then`in e}db(Sb,`isPromiseLike`);var Cb=db(e=>`${e} failed to slot onto its children. Expected a single React element child or \`Slottable\`.`,`createSlotError`),wb=db(e=>`${e} failed to slot onto its \`Slottable\`. Expected \`Slottable\` to receive a single React element child.`,`createSlottableError`),Tb=B.use,Eb=e=>typeof e==`boolean`?`${e}`:e===0?`0`:e,Db=Du,Ob=(e,t)=>n=>{if(t?.variants==null)return Db(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=Eb(t)||Eb(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 Db(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)},kb=Ob(`inline-flex shrink-0 items-center justify-center rounded-full font-medium whitespace-nowrap`,{variants:{variant:{default:`bg-cyan-600 text-white`,secondary:`bg-zinc-800 text-zinc-200`,outline:`text-zinc-200 ring-1 ring-white/12`},size:{default:`px-1.5 py-0.5 text-xs`,counter:`h-4 min-w-4 px-1 text-[0.625rem] font-semibold tabular-nums`}},defaultVariants:{variant:`default`,size:`default`}});function Ab({className:e,variant:t,size:n,asChild:r=!1,...i}){return(0,V.jsx)(r?pb:`span`,{"data-slot":`badge`,className:W(kb({variant:t,size:n,className:e})),...i})}var jb=Ob(`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 X({className:e,variant:t,size:n,asChild:r=!1,...i}){return(0,V.jsx)(r?pb:`button`,{"data-slot":`button`,className:W(jb({variant:t,size:n,className:e})),...i})}function Mb({className:e,...t}){return(0,V.jsx)(`div`,{"data-slot":`empty`,className:W(`flex min-w-0 flex-1 flex-col items-center justify-center gap-2 p-6 text-center`,e),...t})}function Nb({className:e,...t}){return(0,V.jsx)(`h3`,{"data-slot":`empty-title`,className:W(`text-sm font-medium text-zinc-200`,e),...t})}function Pb({className:e,...t}){return(0,V.jsx)(`p`,{"data-slot":`empty-description`,className:W(`text-sm text-zinc-400`,e),...t})}var Fb=0,Ib=null;function Lb(){B.useEffect(()=>{Ib||={start:Rb(),end:Rb()};let{start:e,end:t}=Ib;return document.body.firstElementChild!==e&&document.body.insertAdjacentElement(`afterbegin`,e),document.body.lastElementChild!==t&&document.body.insertAdjacentElement(`beforeend`,t),Fb++,()=>{Fb===1&&(Ib?.start.remove(),Ib?.end.remove(),Ib=null),Fb=Math.max(0,Fb-1)}},[])}function Rb(){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 zb=`focusScope.autoFocusOnMount`,Bb=`focusScope.autoFocusOnUnmount`,Vb={bubbles:!1,cancelable:!0},Hb=`FocusScope`,Ub=B.forwardRef((e,t)=>{let{loop:n=!1,trapped:r=!1,onMountAutoFocus:i,onUnmountAutoFocus:a,...o}=e,[s,c]=B.useState(null),l=So(i),u=So(a),d=B.useRef(null),f=ro(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:Xb(d.current,{select:!0})},t=function(e){if(p.paused||!s)return;let t=e.relatedTarget;t!==null&&(s.contains(t)||Xb(d.current,{select:!0}))},n=function(e){if(document.activeElement===document.body)for(let t of e)t.removedNodes.length>0&&Xb(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){Zb.add(p);let e=document.activeElement;if(!s.contains(e)){let t=new CustomEvent(zb,Vb);s.addEventListener(zb,l),s.dispatchEvent(t),t.defaultPrevented||(Wb(ex(Kb(s)),{select:!0}),document.activeElement===e&&Xb(s))}return()=>{s.removeEventListener(zb,l),setTimeout(()=>{let t=new CustomEvent(Bb,Vb);s.addEventListener(Bb,u),s.dispatchEvent(t),t.defaultPrevented||Xb(e??document.body,{select:!0}),s.removeEventListener(Bb,u),Zb.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]=Gb(t);r&&a?!e.shiftKey&&i===a?(e.preventDefault(),n&&Xb(r,{select:!0})):e.shiftKey&&i===r&&(e.preventDefault(),n&&Xb(a,{select:!0})):i===t&&e.preventDefault()}},[n,r,p.paused]);return(0,V.jsx)(bo.div,{tabIndex:-1,...o,ref:f,onKeyDown:m})});Ub.displayName=Hb;function Wb(e,{select:t=!1}={}){let n=document.activeElement;for(let r of e)if(Xb(r,{select:t}),document.activeElement!==n)return}function Gb(e){let t=Kb(e);return[qb(t,e),qb(t.reverse(),e)]}function Kb(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 qb(e,t){let n=typeof t.checkVisibility==`function`&&t.checkVisibility({checkVisibilityCSS:!0});for(let r of e)if(!(n?!r.checkVisibility({checkVisibilityCSS:!0}):Jb(r,{upTo:t})))return r}function Jb(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 Yb(e){return e instanceof HTMLInputElement&&`select`in e}function Xb(e,{select:t=!1}={}){if(e&&e.focus){let n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&Yb(e)&&t&&e.select()}}var Zb=Qb();function Qb(){let e=[];return{add(t){let n=e[0];t!==n&&n?.pause(),e=$b(e,t),e.unshift(t)},remove(t){e=$b(e,t),e[0]?.resume()}}}function $b(e,t){let n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}function ex(e){return e.filter(e=>e.tagName!==`A`)}var tx=function(e){return typeof document>`u`?null:(Array.isArray(e)?e[0]:e).ownerDocument.body},nx=new WeakMap,rx=new WeakMap,ix={},ax=0,ox=function(e){return e&&(e.host||ox(e.parentNode))},sx=function(e,t){return t.map(function(t){if(e.contains(t))return t;var n=ox(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})},cx=function(e,t,n,r){var i=sx(t,Array.isArray(e)?e:[e]);ix[n]||(ix[n]=new WeakMap);var a=ix[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=(nx.get(e)||0)+1,l=(a.get(e)||0)+1;nx.set(e,c),a.set(e,l),o.push(e),c===1&&i&&rx.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(),ax++,function(){o.forEach(function(e){var t=nx.get(e)-1,i=a.get(e)-1;nx.set(e,t),a.set(e,i),t||(rx.has(e)||e.removeAttribute(r),rx.delete(e)),i||e.removeAttribute(n)}),ax--,ax||(nx=new WeakMap,nx=new WeakMap,rx=new WeakMap,ix={})}},lx=function(e,t,n){n===void 0&&(n=`data-aria-hidden`);var r=Array.from(Array.isArray(e)?e:[e]),i=t||tx(e);return i?(r.push.apply(r,Array.from(i.querySelectorAll(`[aria-live], script`))),cx(r,i,n,`aria-hidden`)):function(){return null}},ux=function(){return ux=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},ux.apply(this,arguments)};function dx(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 fx(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 px=`right-scroll-bar-position`,mx=`width-before-scroll-bar`,hx=`with-scroll-bars-hidden`,gx=`--removed-body-scroll-bar-size`;function _x(e,t){return typeof e==`function`?e(t):e&&(e.current=t),e}function vx(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 yx=typeof window<`u`?B.useLayoutEffect:B.useEffect,bx=new WeakMap;function xx(e,t){var n=vx(t||null,function(t){return e.forEach(function(e){return _x(e,t)})});return yx(function(){var t=bx.get(n);if(t){var r=new Set(t),i=new Set(e),a=n.current;r.forEach(function(e){i.has(e)||_x(e,null)}),i.forEach(function(e){r.has(e)||_x(e,a)})}bx.set(n,e)},[e]),n}function Sx(e){return e}function Cx(e,t){t===void 0&&(t=Sx);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 wx(e){e===void 0&&(e={});var t=Cx(null);return t.options=ux({async:!0,ssr:!1},e),t}var Tx=function(e){var t=e.sideCar,n=dx(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,ux({},n))};Tx.isSideCarExport=!0;function Ex(e,t){return e.useMedium(t),Tx}var Dx=wx(),Ox=function(){},kx=B.forwardRef(function(e,t){var n=B.useRef(null),r=B.useState({onScrollCapture:Ox,onWheelCapture:Ox,onTouchMoveCapture:Ox}),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=dx(e,[`forwardProps`,`children`,`className`,`removeScrollBar`,`enabled`,`shards`,`sideCar`,`noRelative`,`noIsolation`,`inert`,`allowPinchZoom`,`as`,`gapMode`]),x=f,S=xx([n,t]),C=ux(ux({},b),i);return B.createElement(B.Fragment,null,u&&B.createElement(x,{sideCar:Dx,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),ux(ux({},C),{ref:S})):B.createElement(v,ux({},C,{className:c,ref:S}),s))});kx.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1},kx.classNames={fullWidth:mx,zeroRight:px};var Ax,jx=function(){if(Ax)return Ax;if(typeof __webpack_nonce__<`u`)return __webpack_nonce__};function Mx(){if(!document)return null;var e=document.createElement(`style`);e.type=`text/css`;var t=jx();return t&&e.setAttribute(`nonce`,t),e}function Nx(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function Px(e){(document.head||document.getElementsByTagName(`head`)[0]).appendChild(e)}var Fx=function(){var e=0,t=null;return{add:function(n){e==0&&(t=Mx())&&(Nx(t,n),Px(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},Ix=function(){var e=Fx();return function(t,n){B.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},Lx=function(){var e=Ix();return function(t){var n=t.styles,r=t.dynamic;return e(n,r),null}},Rx={left:0,top:0,right:0,gap:0},zx=function(e){return parseInt(e||``,10)||0},Bx=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[zx(n),zx(r),zx(i)]},Vx=function(e){if(e===void 0&&(e=`margin`),typeof window>`u`)return Rx;var t=Bx(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])}},Hx=Lx(),Ux=`data-scroll-locked`,Wx=function(e,t,n,r){var i=e.left,a=e.top,o=e.right,s=e.gap;return n===void 0&&(n=`margin`),`
|
|
73
|
-
.${hx} {
|
|
74
|
-
overflow: hidden ${r};
|
|
75
|
-
padding-right: ${s}px ${r};
|
|
76
|
-
}
|
|
77
|
-
body[${Ux}] {
|
|
78
|
-
overflow: hidden ${r};
|
|
79
|
-
overscroll-behavior: contain;
|
|
80
|
-
${[t&&`position: relative ${r};`,n===`margin`&&`
|
|
81
|
-
padding-left: ${i}px;
|
|
82
|
-
padding-top: ${a}px;
|
|
83
|
-
padding-right: ${o}px;
|
|
84
|
-
margin-left:0;
|
|
85
|
-
margin-top:0;
|
|
86
|
-
margin-right: ${s}px ${r};
|
|
87
|
-
`,n===`padding`&&`padding-right: ${s}px ${r};`].filter(Boolean).join(``)}
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
.${px} {
|
|
91
|
-
right: ${s}px ${r};
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
.${mx} {
|
|
95
|
-
margin-right: ${s}px ${r};
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
.${px} .${px} {
|
|
99
|
-
right: 0 ${r};
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
.${mx} .${mx} {
|
|
103
|
-
margin-right: 0 ${r};
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
body[${Ux}] {
|
|
107
|
-
${gx}: ${s}px;
|
|
108
|
-
}
|
|
109
|
-
`},Gx=function(){var e=parseInt(document.body.getAttribute(`data-scroll-locked`)||`0`,10);return isFinite(e)?e:0},Kx=function(){B.useEffect(function(){return document.body.setAttribute(Ux,(Gx()+1).toString()),function(){var e=Gx()-1;e<=0?document.body.removeAttribute(Ux):document.body.setAttribute(Ux,e.toString())}},[])},qx=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,i=r===void 0?`margin`:r;Kx();var a=B.useMemo(function(){return Vx(i)},[i]);return B.createElement(Hx,{styles:Wx(a,!t,i,n?``:`!important`)})},Jx=!1;if(typeof window<`u`)try{var Yx=Object.defineProperty({},"passive",{get:function(){return Jx=!0,!0}});window.addEventListener(`test`,Yx,Yx),window.removeEventListener(`test`,Yx,Yx)}catch{Jx=!1}var Xx=Jx?{passive:!1}:!1,Zx=function(e){return e.tagName===`TEXTAREA`},Qx=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!==`hidden`&&!(n.overflowY===n.overflowX&&!Zx(e)&&n[t]===`visible`)},$x=function(e){return Qx(e,`overflowY`)},eS=function(e){return Qx(e,`overflowX`)},tS=function(e,t){var n=t.ownerDocument,r=t;do{if(typeof ShadowRoot<`u`&&r instanceof ShadowRoot&&(r=r.host),iS(e,r)){var i=aS(e,r);if(i[1]>i[2])return!0}r=r.parentNode}while(r&&r!==n.body);return!1},nS=function(e){return[e.scrollTop,e.scrollHeight,e.clientHeight]},rS=function(e){return[e.scrollLeft,e.scrollWidth,e.clientWidth]},iS=function(e,t){return e===`v`?$x(t):eS(t)},aS=function(e,t){return e===`v`?nS(t):rS(t)},oS=function(e,t){return e===`h`&&t===`rtl`?-1:1},sS=function(e,t,n,r,i){var a=oS(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=aS(e,s),m=p[0],h=p[1]-p[2]-a*m;(m||h)&&iS(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},cS=function(e){return`changedTouches`in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},lS=function(e){return[e.deltaX,e.deltaY]},uS=function(e){return e&&`current`in e?e.current:e},dS=function(e,t){return e[0]===t[0]&&e[1]===t[1]},fS=function(e){return`
|
|
110
|
-
.block-interactivity-${e} {pointer-events: none;}
|
|
111
|
-
.allow-interactivity-${e} {pointer-events: all;}
|
|
112
|
-
`},pS=0,mS=[];function hS(e){var t=B.useRef([]),n=B.useRef([0,0]),r=B.useRef(),i=B.useState(pS++)[0],a=B.useState(Lx)[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=fx([e.lockRef.current],(e.shards||[]).map(uS),!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=cS(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=tS(d,u);if(!m)return!0;if(m?l=d:(l=d===`v`?`h`:`v`,m=tS(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 sS(h,t,e,h===`h`?s:c,!0)},[]),c=B.useCallback(function(e){var n=e;if(!(!mS.length||mS[mS.length-1]!==a)){var r=`deltaY`in n?lS(n):cS(n),i=t.current.filter(function(e){return e.name===n.type&&(e.target===n.target||n.target===e.shadowParent)&&dS(e.delta,r)})[0];if(i&&i.should){n.cancelable&&n.preventDefault();return}if(!i){var c=(o.current.shards||[]).map(uS).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:gS(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=cS(e),r.current=void 0},[]),d=B.useCallback(function(t){l(t.type,lS(t),t.target,s(t,e.lockRef.current))},[]),f=B.useCallback(function(t){l(t.type,cS(t),t.target,s(t,e.lockRef.current))},[]);B.useEffect(function(){return mS.push(a),e.setCallbacks({onScrollCapture:d,onWheelCapture:d,onTouchMoveCapture:f}),document.addEventListener(`wheel`,c,Xx),document.addEventListener(`touchmove`,c,Xx),document.addEventListener(`touchstart`,u,Xx),function(){mS=mS.filter(function(e){return e!==a}),document.removeEventListener(`wheel`,c,Xx),document.removeEventListener(`touchmove`,c,Xx),document.removeEventListener(`touchstart`,u,Xx)}},[]);var p=e.removeScrollBar,m=e.inert;return B.createElement(B.Fragment,null,m?B.createElement(a,{styles:fS(i)}):null,p?B.createElement(qx,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function gS(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}var _S=Ex(Dx,hS),vS=B.forwardRef(function(e,t){return B.createElement(kx,ux({},e,{ref:t,sideCar:_S}))});vS.classNames=kx.classNames;var yS=`Popover`,[bS,xS]=io(yS,[il]),SS=il(),[CS,wS]=bS(yS),TS=e=>{let{__scopePopover:t,children:n,open:r,defaultOpen:i,onOpenChange:a,modal:o=!1}=e,s=SS(t),c=B.useRef(null),[l,u]=B.useState(!1),[d,f]=Pl({prop:r,defaultProp:i??!1,onChange:a,caller:yS});return(0,V.jsx)(bl,{...s,children:(0,V.jsx)(CS,{scope:t,contentId:Bo(),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})})};TS.displayName=yS;var ES=`PopoverAnchor`,DS=B.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=wS(ES,n),a=SS(n),{onCustomAnchorAdd:o,onCustomAnchorRemove:s}=i;return B.useEffect(()=>(o(),()=>s()),[o,s]),(0,V.jsx)(xl,{...a,...r,ref:t})});DS.displayName=ES;var OS=`PopoverTrigger`,kS=B.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=wS(OS,n),a=SS(n),o=ro(t,i.triggerRef),s=(0,V.jsx)(bo.button,{type:`button`,"aria-haspopup":`dialog`,"aria-expanded":i.open,"aria-controls":i.open?i.contentId:void 0,"data-state":WS(i.open),...r,ref:o,onClick:eo(e.onClick,i.onOpenToggle)});return i.hasCustomAnchor?s:(0,V.jsx)(xl,{asChild:!0,...a,children:s})});kS.displayName=OS;var AS=`PopoverPortal`,[jS,MS]=bS(AS,{forceMount:void 0}),NS=e=>{let{__scopePopover:t,forceMount:n,children:r,container:i}=e,a=wS(AS,t);return(0,V.jsx)(jS,{scope:t,forceMount:n,children:(0,V.jsx)(Dl,{present:n||a.open,children:(0,V.jsx)(Tl,{asChild:!0,container:i,children:r})})})};NS.displayName=AS;var PS=`PopoverContent`,FS=B.forwardRef((e,t)=>{let n=MS(PS,e.__scopePopover),{forceMount:r=n.forceMount,...i}=e,a=wS(PS,e.__scopePopover);return(0,V.jsx)(Dl,{present:r||a.open,children:a.modal?(0,V.jsx)(LS,{...i,ref:t}):(0,V.jsx)(RS,{...i,ref:t})})});FS.displayName=PS;var IS=oo(`PopoverContent.RemoveScroll`),LS=B.forwardRef((e,t)=>{let n=wS(PS,e.__scopePopover),r=B.useRef(null),i=ro(t,r),a=B.useRef(!1);return B.useEffect(()=>{let e=r.current;if(e)return lx(e)},[]),(0,V.jsx)(vS,{as:IS,allowPinchZoom:!0,children:(0,V.jsx)(zS,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:eo(e.onCloseAutoFocus,e=>{e.preventDefault(),a.current||n.triggerRef.current?.focus()}),onPointerDownOutside:eo(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:eo(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1})})})}),RS=B.forwardRef((e,t)=>{let n=wS(PS,e.__scopePopover),r=B.useRef(!1),i=B.useRef(!1);return(0,V.jsx)(zS,{...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()}})}),zS=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=wS(PS,n),p=SS(n);return Lb(),(0,V.jsx)(Ub,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:a,children:(0,V.jsx)(ko,{asChild:!0,disableOutsidePointerEvents:o,onInteractOutside:u,onEscapeKeyDown:s,onPointerDownOutside:c,onFocusOutside:l,onDismiss:()=>f.onOpenChange(!1),deferPointerDownOutside:!0,children:(0,V.jsx)(Sl,{"data-state":WS(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)`}})})})}),BS=`PopoverClose`,VS=B.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=wS(BS,n);return(0,V.jsx)(bo.button,{type:`button`,...r,ref:t,onClick:eo(e.onClick,()=>i.onOpenChange(!1))})});VS.displayName=BS;var HS=`PopoverArrow`,US=B.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=SS(n);return(0,V.jsx)(Cl,{...i,...r,ref:t})});US.displayName=HS;function WS(e){return e?`open`:`closed`}var GS=TS,KS=kS,qS=NS,JS=FS;function YS(e){return(0,V.jsx)(GS,{...e})}function XS(e){return(0,V.jsx)(KS,{...e})}function ZS({className:e,align:t=`start`,sideOffset:n=6,portalled:r=!0,...i}){let a=(0,V.jsx)(JS,{align:t,sideOffset:n,className:W(`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)(qS,{children:a}):a}var QS=(0,B.createRef)();function $S(e){if(!QS.current)throw Error(`ForceSpecificCursor is not mounted`);QS.current.style.cursor=e,QS.current.style.pointerEvents=`auto`}function eC(){if(!QS.current)throw Error(`ForceSpecificCursor is not mounted`);QS.current.style.cursor=``,QS.current.style.pointerEvents=`none`}function tC(){return(0,V.jsx)(`div`,{ref:QS,"aria-hidden":`true`,className:`pointer-events-none fixed inset-0`,style:{zIndex:2147483647}})}var nC=1,rC=450,iC=550,aC=10;function oC(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 sC(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(cC()){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 cC(){return/Mac|iPhone|iPad|iPod/.test(globalThis.navigator?.platform??``)}function lC(e,t,n){if(!globalThis.matchMedia?.(`(pointer: coarse)`).matches&&(cC()?!e.metaKey:!e.ctrlKey))return;let r;try{r=new URL(t)}catch{return}if(r.protocol===`file:`){window.treeportDesktop?.openFileUrl(t).catch(()=>void 0);return}n&&(r.protocol===`http:`||r.protocol===`https:`)&&fetch(`/api/terminals/${encodeURIComponent(n)}/browser-panels/open`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({url:t})}).catch(()=>void 0)}function uC(e,t){!t.element?.classList.contains(`enable-mouse-events`)||e.button!==0||e.altKey||e.ctrlKey||e.metaKey||e.shiftKey||Object.defineProperty(e,cC()?`altKey`:`shiftKey`,{configurable:!0,value:!0})}var dC=50,fC=3;function pC(e,t,n){let r=null,i=null,a=null,o,s=(e,n)=>{let r=(t.element?.querySelector(`.xterm-screen`))?.getBoundingClientRect();if(!r?.width||!r.height)return null;let i=Math.ceil((e-r.left)/r.width*t.cols+.5);return{column:Math.max(1,Math.min(t.cols,i)),endOfLine:i>t.cols,row:Math.max(1,Math.min(t.rows,Math.floor((n-r.top)/r.height*t.rows)+1)),bounds:r}},c=()=>{a!==null&&(window.clearInterval(a),a=null)};function l(){if(!i)return;let u=s(i.clientX,i.clientY);if(!u)return;let f=i.clientY<u.bounds.top||i.clientY>u.bounds.bottom,p=i.clientX<u.bounds.left||i.clientX>u.bounds.right,m=f&&!p;m||c();let h=u.endOfLine?`\x1B[F`:``;if(i.tmux)n.canInput()&&n.sendInput(`\u001b[<32;${u.column};${u.row}M${h}`);else{if(Math.hypot(i.clientX-i.startClientX,i.clientY-i.startClientY)<fC||!n.canInput())return;n.sendInput(`${n.selectionStartSequence}\u001b[<0;${i.startColumn};${i.startRow}M\u001b[<32;${i.startColumn};${i.startRow}M\u001b[<32;${u.column};${u.row}M${h}`),t.clearSelection(),r!==null&&e.setPointerCapture(r),i.tmux=!0,o??=window.treeportDesktop?.onTerminalSelectionRelease(d),window.treeportDesktop?.setTerminalSelectionActive(!0),n.onTmuxSelectionStart()}m&&a===null&&(a=window.setInterval(l,dC))}let u=()=>{let t=r;r=null,t!==null&&e.hasPointerCapture(t)&&e.releasePointerCapture(t)},d=()=>{if(!i){u();return}let e=i.tmux;if(e&&n.canInput()){let e=s(i.clientX,i.clientY);if(e){let r=e.row===1?Math.min(2,t.rows):e.row===t.rows?Math.max(1,t.rows-1):e.row;n.onTmuxSelectionFinish(),n.sendInput(`${n.selectionStopSequence}\u001b[<32;${e.column};${r}M\u001b[<0;${e.column};${r}m`)}}c(),i=null,eC(),e&&window.treeportDesktop?.setTerminalSelectionActive(!1),u(),document.removeEventListener(`mousemove`,f,!0),document.removeEventListener(`mouseup`,p,!0),window.removeEventListener(`blur`,_)},f=e=>{if(i){if(!(e.buttons&1)){d();return}i.clientX=e.clientX,i.clientY=e.clientY,l()}},p=()=>d(),m=e=>{e.isPrimary&&e.button===0&&(d(),r=e.pointerId)},h=()=>d(),g=()=>d(),_=()=>d();return e.addEventListener(`pointerdown`,m,!0),e.addEventListener(`pointerup`,h,!0),e.addEventListener(`pointercancel`,h,!0),e.addEventListener(`lostpointercapture`,g,!0),e.addEventListener(`mousedown`,e=>{n.requestControl(),uC(e,t);let r=s(e.clientX,e.clientY);e.button!==0||e.ctrlKey||e.metaKey||!r||e.clientX<r.bounds.left||e.clientX>r.bounds.right||e.clientY<r.bounds.top||e.clientY>r.bounds.bottom||(n.onSelectionStart(),$S(`text`),i={startColumn:r.column,startRow:r.row,startClientX:e.clientX,startClientY:e.clientY,clientX:e.clientX,clientY:e.clientY,tmux:!1},document.addEventListener(`mousemove`,f,!0),document.addEventListener(`mouseup`,p,!0),window.addEventListener(`blur`,_))},!0),()=>{i?.tmux&&n.canInput()&&n.onTmuxSelectionCancel(),i?.tmux&&window.treeportDesktop?.setTerminalSelectionActive(!1),o?.(),c(),i&&=(eC(),null),u(),e.removeEventListener(`pointerdown`,m,!0),e.removeEventListener(`pointerup`,h,!0),e.removeEventListener(`pointercancel`,h,!0),e.removeEventListener(`lostpointercapture`,g,!0),document.removeEventListener(`mousemove`,f,!0),document.removeEventListener(`mouseup`,p,!0),window.removeEventListener(`blur`,_)}}function mC(e,t,n,r,i){let a=null,o=0,s=0,c=[],l=new WeakSet,u=null,d=null,f=null,p=null,m=[],h=(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)))}},g=()=>{d!==null&&(window.clearTimeout(d),d=null)},_=()=>{p!==null&&(window.clearTimeout(p),p=null),m=[]};t.attachCustomWheelEventHandler(e=>{let n=t.element;if(!n?.classList.contains(`enable-mouse-events`)||l.has(e)||e.deltaY===0)return!0;let r=n.getBoundingClientRect().height/t.rows||16,i=e.deltaMode===WheelEvent.DOM_DELTA_PIXEL?e.deltaY/r:e.deltaMode===WheelEvent.DOM_DELTA_PAGE?e.deltaY*t.rows:e.deltaY;s+=i;let a=Math.trunc(s);if(s-=a,a===0)return!1;let o=new WheelEvent(`wheel`,{bubbles:!0,cancelable:!0,composed:!0,clientX:e.clientX,clientY:e.clientY,deltaMode:WheelEvent.DOM_DELTA_LINE,deltaY:Math.sign(a),altKey:e.altKey,ctrlKey:e.ctrlKey,metaKey:e.metaKey,shiftKey:e.shiftKey});return l.add(o),c.push(Math.abs(a)),queueMicrotask(()=>n.dispatchEvent(o)),!1}),e.addEventListener(`wheel`,n,{capture:!0,passive:!0}),e.addEventListener(`touchstart`,e=>{if(e.touches.length===2){g(),_(),a=null,o=0,u=null,f=null,m=Array.from(e.touches,e=>({identifier:e.identifier,x:e.clientX,y:e.clientY})),p=window.setTimeout(()=>{p=null,m=[],navigator.vibrate?.(10),i()},iC);return}if(e.touches.length!==1){g(),_(),a=null,o=0,u=null,f=null;return}_();let n=e.touches[0];a=n.clientY,o=0,u={x:n.clientX,y:n.clientY},f=null,g(),d=window.setTimeout(()=>{d=null,u&&(f=h(u.x,u.y),f&&(t.select(f.column,f.row,1),navigator.vibrate?.(10)))},rC)},{capture:!0,passive:!0}),e.addEventListener(`touchmove`,e=>{if(e.touches.length===2&&m.length===2){m.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)>aC})?_():e.preventDefault();return}if(e.touches.length!==1||a===null){g(),_(),a=null,o=0,u=null,f=null;return}let n=t.element;if(!n)return;let r=e.touches[0];if(f){e.preventDefault();let n=h(r.clientX,r.clientY);if(!n)return;let i=f.row*t.cols+f.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}u&&Math.hypot(r.clientX-u.x,r.clientY-u.y)>aC&&(g(),u=null),o+=a-r.clientY,a=r.clientY,e.preventDefault();let i=n.getBoundingClientRect(),s=(i.height/t.rows||16)*(n.classList.contains(`enable-mouse-events`)?nC:1),c=Math.trunc(o/s);if(c===0)return;o-=c*s;let l=Math.min(Math.max(r.clientX,i.left),i.right-1),d=Math.min(Math.max(r.clientY,i.top),i.bottom-1);for(let e=0;e<Math.abs(c);e+=1)n.dispatchEvent(new WheelEvent(`wheel`,{bubbles:!0,cancelable:!0,composed:!0,clientX:l,clientY:d,deltaMode:WheelEvent.DOM_DELTA_LINE,deltaY:Math.sign(c)}))},{capture:!0,passive:!1});let v=e=>{if(f)e.preventDefault();else if(e.type===`touchend`&&u){e.preventDefault();let n=t.element?.querySelector(`.xterm-screen`);if(n)for(let e of[`mousemove`,`mousedown`,`mouseup`])n.dispatchEvent(new MouseEvent(e,{bubbles:!0,cancelable:!0,clientX:u.x,clientY:u.y,buttons:+(e===`mousedown`)}))}g(),_(),a=null,o=0,u=null,f=null};return e.addEventListener(`touchend`,v,{capture:!0,passive:!1}),e.addEventListener(`touchcancel`,v,{capture:!0,passive:!1}),e.addEventListener(`paste`,r,!0),e=>{let t=c.shift()??1;return t===1?e:e.repeat(t)}}function hC(e){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:(t,n)=>lC(t,n,e),allowNonHttpProtocols:!0},theme:{background:`#09090b`,foreground:`#e4e4e7`,cursor:`#67e8f9`,selectionBackground:`#f4f4f5`,selectionForeground:`#09090b`,scrollbarSliderBackground:`#3f3f46`,scrollbarSliderHoverBackground:`#52525b`,scrollbarSliderActiveBackground:`#71717a`,black:`#18181b`,red:`#fb7185`,green:`#86efac`,yellow:`#fde047`,blue:`#7dd3fc`,magenta:`#d8b4fe`,cyan:`#67e8f9`,white:`#f4f4f5`}}}var gC=2,_C=1,vC=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(gC,Math.floor(u/e.css.cell.width)),rows:Math.max(_C,Math.floor(l/e.css.cell.height))}}},yC=class{constructor(e,t,n,r={}){this._terminal=e,this._regex=t,this._handler=n,this._options=r}provideLinks(e,t){let n=xC.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 bC(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 xC=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(!bC(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]}},SC=/(https?|HTTPS?):[/]{2}[^\s"'!*(){}|\\\^<>`]*[^\s"':,.!?{}|\\\^~\[\]`()<>]/;function CC(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 wC=class{constructor(e=CC,t={}){this._handler=e,this._options=t}activate(e){this._terminal=e;let t=this._options,n=t.urlRegex||SC;this._linkProvider=this._terminal.registerLinkProvider(new yC(this._terminal,n,this._handler,t))}dispose(){this._linkProvider?.dispose()}},TC=Object.defineProperty,EC=Object.getOwnPropertyDescriptor,DC=(e,t)=>{for(var n in t)TC(e,n,{get:t[n],enumerable:!0})},OC=(e,t,n,r)=>{for(var i=r>1?void 0:r?EC(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&&TC(t,n,i),i},Z=(e,t)=>(n,r)=>t(n,r,e),kC=`Terminal input`,AC={get:()=>kC,set:e=>kC=e},jC=`Too much output to announce, navigate to rows manually to read`,MC={get:()=>jC,set:e=>jC=e};function NC(e){return e.replace(/\r?\n/g,`\r`)}function PC(e,t){return t?`\x1B[200~`+e+`\x1B[201~`:e}function FC(e,t){e.clipboardData&&e.clipboardData.setData(`text/plain`,t.selectionText),e.preventDefault()}function IC(e,t,n,r){e.stopPropagation(),e.clipboardData&&LC(e.clipboardData.getData(`text/plain`),t,n,r)}function LC(e,t,n,r){e=NC(e),e=PC(e,n.decPrivateModes.bracketedPasteMode&&r.rawOptions.ignoreBracketedPasteMode!==!0),n.triggerDataEvent(e,!0),t.value=``}function RC(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 zC(e,t,n,r,i){RC(e,t,n),i&&r.rightClickSelect(e),t.value=r.selectionText,t.select()}function BC(e){return e>65535?(e-=65536,String.fromCharCode((e>>10)+55296)+String.fromCharCode(e%1024+56320)):String.fromCharCode(e)}function VC(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 HC=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}},UC=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}},WC=``,GC=` `,KC=class e{constructor(){this.fg=0,this.bg=0,this.extended=new qC}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}},qC=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}},JC=class e extends KC{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new qC,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?BC(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()]}},YC=`di$target`,XC=`di$dependencies`,ZC=new Map;function QC(e){return e[XC]||[]}function $C(e){if(ZC.has(e))return ZC.get(e);let t=function(e,n,r){if(arguments.length!==3)throw Error(`@IServiceName-decorator can only be used to decorate a parameter`);ew(t,e,r)};return t._id=e,ZC.set(e,t),t}function ew(e,t,n){t[YC]===t?t[XC].push({id:e,index:n}):(t[XC]=[{id:e,index:n}],t[YC]=t)}var tw=$C(`BufferService`),nw=$C(`CoreMouseService`),rw=$C(`CoreService`),iw=$C(`CharsetService`),aw=$C(`InstantiationService`),ow=$C(`LogService`),sw=$C(`OptionsService`),cw=$C(`OscLinkService`),lw=$C(`UnicodeService`),uw=$C(`DecorationService`),dw=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 JC,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):fw(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)}};dw=OC([Z(0,tw),Z(1,sw),Z(2,cw)],dw);function fw(e,t){if(confirm(`Do you want to navigate to ${t}?
|
|
113
|
-
|
|
114
|
-
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 pw=$C(`CharSizeService`),mw=$C(`CoreBrowserService`),hw=$C(`MouseService`),gw=$C(`RenderService`),_w=$C(`SelectionService`),vw=$C(`CharacterJoinerService`),yw=$C(`ThemeService`),bw=$C(`LinkProviderService`),xw=new class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?Dw.isErrorNoTelemetry(e)?new Dw(e.message+`
|
|
115
|
-
|
|
116
|
-
`+e.stack):Error(e.message+`
|
|
117
|
-
|
|
118
|
-
`+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 Sw(e){ww(e)||xw.onUnexpectedError(e)}var Cw=`Canceled`;function ww(e){return e instanceof Tw||e instanceof Error&&e.name===Cw&&e.message===Cw}var Tw=class extends Error{constructor(){super(Cw),this.name=this.message}};function Ew(e){return Error(e?`Illegal argument: ${e}`:`Illegal argument`)}var Dw=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`}},Ow=class e extends Error{constructor(t){super(t||`An unexpected bug occurred.`),Object.setPrototypeOf(this,e.prototype)}};function kw(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 Aw=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=kw(this._array,t,this._findLastMonotonousLastIdx);return this._findLastMonotonousLastIdx=n+1,n===-1?void 0:this._array[n]}};Aw.assertInvariants=!1;function jw(e,t=0){return e[e.length-(1+t)]}var Mw;(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})(Mw||={});function Nw(e,t){return(n,r)=>t(e(n),e(r))}var Pw=(e,t)=>e-t,Fw=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||Mw.isGreaterThan(e(r,t)))&&(n=!1,t=r),!0)),t}};Fw.empty=new Fw(e=>{});function Iw(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 Lw=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 Rw(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 zw;(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})(zw||={});var Bw=null,Vw=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(`
|
|
119
|
-
`).map(e=>e.trim().replace(`at `,``)).filter(e=>e!==``);return t(n,[`Error`,/^trackDisposable \(.*\)$/,/^DisposableTracker.trackDisposable \(.*\)$/]),n.reverse()}let i=new Lw;for(let e of n){let t=r(e);for(let n=0;n<=t.length;n++)i.add(t.slice(0,n).join(`
|
|
120
|
-
`),e)}n.sort(Nw(e=>e.idx,Pw));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(`
|
|
121
|
-
`)).size}/${n.length} leaks) at ${a}`;let o=Iw([...i.get(e.slice(0,t).join(`
|
|
122
|
-
`))].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+=`
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
==================== Leaking disposable ${o}/${n.length}: ${t.value.constructor.name} ====================
|
|
126
|
-
${s.join(`
|
|
127
|
-
`)}
|
|
128
|
-
============================================================
|
|
129
|
-
|
|
130
|
-
`}return n.length>e&&(a+=`
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
... and ${n.length-e} more leaking disposables
|
|
134
|
-
|
|
135
|
-
`),{leaks:n,details:a}}};Vw.idx=0;function Hw(e){return Bw?.trackDisposable(e),e}function Uw(e){Bw?.markAsDisposed(e)}function Ww(e,t){Bw?.setParent(e,t)}function Gw(e){return Bw?.markAsSingleton(e),e}function Kw(e){if(zw.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 qw(...e){return Jw(()=>Kw(e))}function Jw(e){let t=Hw({dispose:Rw(()=>{Uw(t),e()})});return t}var Yw=class e{constructor(){this._toDispose=new Set,this._isDisposed=!1,Hw(this)}dispose(){this._isDisposed||(Uw(this),this._isDisposed=!0,this.clear())}get isDisposed(){return this._isDisposed}clear(){if(this._toDispose.size!==0)try{Kw(this._toDispose)}finally{this._toDispose.clear()}}add(t){if(!t)return t;if(t===this)throw Error(`Cannot register a disposable on itself!`);return Ww(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),Ww(e,null))}};Yw.DISABLE_DISPOSED_WARNING=!1;var Xw=Yw,Zw=class{constructor(){this._store=new Xw,Hw(this),Ww(this._store,this)}dispose(){Uw(this),this._store.dispose()}_register(e){if(e===this)throw Error(`Cannot register a disposable on itself!`);return this._store.add(e)}};Zw.None=Object.freeze({dispose(){}});var Qw=class{constructor(){this._isDisposed=!1,Hw(this)}get value(){return this._isDisposed?void 0:this._value}set value(e){this._isDisposed||e===this._value||(this._value?.dispose(),e&&Ww(e,this),this._value=e)}clear(){this.value=void 0}dispose(){this._isDisposed=!0,Uw(this),this._value?.dispose(),this._value=void 0}clearAndLeak(){let e=this._value;return this._value=void 0,e&&Ww(e,null),e}},$w=typeof window==`object`?window:globalThis,eT=class e{constructor(t){this.element=t,this.next=e.Undefined,this.prev=e.Undefined}};eT.Undefined=new eT(void 0);var tT=eT,nT=class{constructor(){this._first=tT.Undefined,this._last=tT.Undefined,this._size=0}get size(){return this._size}isEmpty(){return this._first===tT.Undefined}clear(){let e=this._first;for(;e!==tT.Undefined;){let t=e.next;e.prev=tT.Undefined,e.next=tT.Undefined,e=t}this._first=tT.Undefined,this._last=tT.Undefined,this._size=0}unshift(e){return this._insert(e,!1)}push(e){return this._insert(e,!0)}_insert(e,t){let n=new tT(e);if(this._first===tT.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!==tT.Undefined){let e=this._first.element;return this._remove(this._first),e}}pop(){if(this._last!==tT.Undefined){let e=this._last.element;return this._remove(this._last),e}}_remove(e){if(e.prev!==tT.Undefined&&e.next!==tT.Undefined){let t=e.prev;t.next=e.next,e.next.prev=t}else e.prev===tT.Undefined&&e.next===tT.Undefined?(this._first=tT.Undefined,this._last=tT.Undefined):e.next===tT.Undefined?(this._last=this._last.prev,this._last.next=tT.Undefined):e.prev===tT.Undefined&&(this._first=this._first.next,this._first.prev=tT.Undefined);--this._size}*[Symbol.iterator](){let e=this._first;for(;e!==tT.Undefined;)yield e.element,e=e.next}},rT=globalThis.performance&&typeof globalThis.performance.now==`function`,iT=class e{static create(t){return new e(t)}constructor(e){this._now=rT&&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}},aT;(e=>{e.None=()=>Zw.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(qw(...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 Q({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 Q({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 Q({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 Q({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 Q({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 Q;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 Q(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 Xw?r.add(s):Array.isArray(r)&&r.push(s),s}}e.fromObservableLight=D})(aT||={});var oT=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 iT,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}}};oT.all=new Set,oT._idPool=0;var sT=oT,cT=-1,lT=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 fT(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}};lT._idPool=1;var uT=lT,dT=class e{constructor(e){this.value=e}static create(){return new e(Error().stack??``)}print(){console.warn(this.value.split(`
|
|
136
|
-
`).slice(2).join(`
|
|
137
|
-
`))}},fT=class extends Error{constructor(e,t){super(e),this.name=`ListenerLeakError`,this.stack=t}},pT=class extends Error{constructor(e,t){super(e),this.name=`ListenerRefusalError`,this.stack=t}},mT=0,hT=class{constructor(e){this.value=e,this.id=mT++}},gT=2,_T,Q=class{constructor(e){this._size=0,this._options=e,this._leakageMon=cT>0||this._options?.leakWarningThreshold?new uT(e?.onListenerError??Sw,this._options?.leakWarningThreshold??cT):void 0,this._perfMon=this._options?._profName?new sT(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 pT(`${e}. HINT: Stack shows most frequent listener (${t[1]}-times)`,t[0]);return(this._options?.onListenerError||Sw)(n),Zw.None}if(this._disposed)return Zw.None;t&&(e=e.bind(t));let r=new hT(e),i;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(r.stack=dT.create(),i=this._leakageMon.check(r.stack,this._size+1)),this._listeners?this._listeners instanceof hT?(this._deliveryQueue??=new vT,this._listeners=[this._listeners,r]):this._listeners.push(r):(this._options?.onWillAddFirstListener?.(this),this._listeners=r,this._options?.onDidAddFirstListener?.(this)),this._size++;let a=Jw(()=>{_T?.unregister(a),i?.(),this._removeListener(r)});if(n instanceof Xw?n.add(a):Array.isArray(n)&&n.push(a),_T){let e=Error().stack.split(`
|
|
138
|
-
`).slice(2,3).join(`
|
|
139
|
-
`).trim(),t=/(file:|vscode-file:\/\/vscode-app)?(\/[^:]*:\d+:\d+)/.exec(e);_T.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*gT<=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||Sw;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 hT)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}},vT=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}},yT=class{constructor(){this.mapWindowIdToZoomLevel=new Map,this._onDidChangeZoomLevel=new Q,this.onDidChangeZoomLevel=this._onDidChangeZoomLevel.event,this.mapWindowIdToZoomFactor=new Map,this._onDidChangeFullscreen=new Q,this.onDidChangeFullscreen=this._onDidChangeFullscreen.event,this.mapWindowIdToFullScreen=new Map}getZoomLevel(e){return this.mapWindowIdToZoomLevel.get(this.getWindowId(e))??0}setZoomLevel(e,t){if(this.getZoomLevel(t)===e)return;let n=this.getWindowId(t);this.mapWindowIdToZoomLevel.set(n,e),this._onDidChangeZoomLevel.fire(n)}getZoomFactor(e){return this.mapWindowIdToZoomFactor.get(this.getWindowId(e))??1}setZoomFactor(e,t){this.mapWindowIdToZoomFactor.set(this.getWindowId(t),e)}setFullscreen(e,t){if(this.isFullscreen(t)===e)return;let n=this.getWindowId(t);this.mapWindowIdToFullScreen.set(n,e),this._onDidChangeFullscreen.fire(n)}isFullscreen(e){return!!this.mapWindowIdToFullScreen.get(this.getWindowId(e))}getWindowId(e){return e.vscodeWindowId}};yT.INSTANCE=new yT;var bT=yT;function xT(e,t,n){typeof t==`string`&&(t=e.matchMedia(t)),t.addEventListener(`change`,n)}bT.INSTANCE.onDidChangeZoomLevel;function ST(e){return bT.INSTANCE.getZoomFactor(e)}bT.INSTANCE.onDidChangeFullscreen;var CT=typeof navigator==`object`?navigator.userAgent:``,wT=CT.indexOf(`Firefox`)>=0,TT=CT.indexOf(`AppleWebKit`)>=0,ET=CT.indexOf(`Chrome`)>=0,DT=!ET&&CT.indexOf(`Safari`)>=0;CT.indexOf(`Electron/`),CT.indexOf(`Android`);var OT=!1;if(typeof $w.matchMedia==`function`){let e=$w.matchMedia(`(display-mode: standalone) or (display-mode: window-controls-overlay)`),t=$w.matchMedia(`(display-mode: fullscreen)`);OT=e.matches,xT($w,e,({matches:e})=>{OT&&t.matches||(OT=e)})}function kT(){return OT}var AT=`en`,jT=!1,MT=!1,NT=!1,PT=!1,FT=!1,IT=AT,LT,RT=globalThis,zT;typeof RT.vscode<`u`&&typeof RT.vscode.process<`u`?zT=RT.vscode.process:typeof process<`u`&&typeof process?.versions?.node==`string`&&(zT=process);var BT=typeof zT?.versions?.electron==`string`&&zT?.type===`renderer`;if(typeof zT==`object`){jT=zT.platform===`win32`,MT=zT.platform===`darwin`,NT=zT.platform===`linux`,NT&&zT.env.SNAP&&zT.env.SNAP_REVISION,zT.env.CI||zT.env.BUILD_ARTIFACTSTAGINGDIRECTORY,IT=AT;let e=zT.env.VSCODE_NLS_CONFIG;if(e)try{let t=JSON.parse(e);t.userLocale,t.osLocale,IT=t.resolvedLanguage||AT,t.languagePack?.translationsConfigFile}catch{}PT=!0}else typeof navigator==`object`&&!BT?(LT=navigator.userAgent,jT=LT.indexOf(`Windows`)>=0,MT=LT.indexOf(`Macintosh`)>=0,(LT.indexOf(`Macintosh`)>=0||LT.indexOf(`iPad`)>=0||LT.indexOf(`iPhone`)>=0)&&navigator.maxTouchPoints&&navigator.maxTouchPoints,NT=LT.indexOf(`Linux`)>=0,LT?.indexOf(`Mobi`),FT=!0,IT=globalThis._VSCODE_NLS_LANGUAGE||AT,navigator.language.toLowerCase()):console.error(`Unable to resolve platform.`);var VT=jT,HT=MT,UT=NT,WT=PT;FT&&typeof RT.importScripts==`function`&&RT.origin;var GT=LT,KT=IT,qT;(e=>{function t(){return KT}e.value=t;function n(){return KT.length===2?KT===`en`:KT.length>=3&&KT[0]===`e`&&KT[1]===`n`&&KT[2]===`-`}e.isDefaultVariant=n;function r(){return KT===`en`}e.isDefault=r})(qT||={});var JT=typeof RT.postMessage==`function`&&!RT.importScripts;(()=>{if(JT){let e=[];RT.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}),RT.postMessage({vscodeScheduleAsyncWork:r},`*`)}}return e=>setTimeout(e)})();var YT=!!(GT&>.indexOf(`Chrome`)>=0);GT&>.indexOf(`Firefox`),!YT&>&>.indexOf(`Safari`),GT&>.indexOf(`Edg/`),GT&>.indexOf(`Android`);var XT=typeof navigator==`object`?navigator:{};WT||document.queryCommandSupported&&document.queryCommandSupported(`copy`)||XT&&XT.clipboard&&XT.clipboard.writeText,WT||XT&&XT.clipboard&&XT.clipboard.readText,WT||kT()||XT.keyboard,`ontouchstart`in $w||XT.maxTouchPoints,$w.PointerEvent&&(`ontouchstart`in $w||navigator.maxTouchPoints);var ZT=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}},QT=new ZT,$T=new ZT,eE=new ZT,tE=Array(230),nE;(e=>{function t(e){return QT.keyCodeToStr(e)}e.toString=t;function n(e){return QT.strToKeyCode(e)}e.fromString=n;function r(e){return $T.keyCodeToStr(e)}e.toUserSettingsUS=r;function i(e){return eE.keyCodeToStr(e)}e.toUserSettingsGeneral=i;function a(e){return $T.strToKeyCode(e)||eE.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 QT.keyCodeToStr(e)}e.toElectronAccelerator=o})(nE||={});var rE=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 iE([this])}isDuplicateModifierCase(){return this.ctrlKey&&this.keyCode===5||this.shiftKey&&this.keyCode===4||this.altKey&&this.keyCode===6||this.metaKey&&this.keyCode===57}},iE=class{constructor(e){if(e.length===0)throw Ew(`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 aE(e){if(e.charCode){let t=String.fromCharCode(e.charCode).toUpperCase();return nE.fromString(t)}let t=e.keyCode;if(t===3)return 7;if(wT)switch(t){case 59:return 85;case 60:if(UT)return 97;break;case 61:return 86;case 107:return 109;case 109:return 111;case 173:return 88;case 224:if(HT)return 57;break}else if(TT&&(HT&&t===93||!HT&&t===92))return 57;return tE[t]||0}var oE=HT?256:2048,sE=512,cE=1024,lE=HT?2048:256,uE=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=aE(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|=oE),this.altKey&&(t|=sE),this.shiftKey&&(t|=cE),this.metaKey&&(t|=lE),t|=e,t}_computeKeyCodeChord(){let e=0;return this.keyCode!==5&&this.keyCode!==4&&this.keyCode!==6&&this.keyCode!==57&&(e=this.keyCode),new rE(this.ctrlKey,this.shiftKey,this.altKey,this.metaKey,e)}},dE=new WeakMap;function fE(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 pE=class{static getSameOriginWindowChain(e){let t=dE.get(e);if(!t){t=[],dE.set(e,t);let n=e,r;do r=fE(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}}},mE=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=pE.getPositionOfChildWindowRelativeToAncestorWindow(e,t.view);this.posx-=n.left,this.posy-=n.top}preventDefault(){this.browserEvent.preventDefault()}stopPropagation(){this.browserEvent.stopPropagation()}},hE=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(ET){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?wT&&!HT?this.deltaY=-e.deltaY/3:this.deltaY=-e.deltaY:this.deltaY=-e.deltaY/40}if(typeof t.wheelDeltaX<`u`)DT&&VT?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?wT&&!HT?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()}},gE=Object.freeze(function(e,t){let n=setTimeout(e.bind(t),0);return{dispose(){clearTimeout(n)}}}),_E;(e=>{function t(t){return t===e.None||t===e.Cancelled||t instanceof vE?!0:!t||typeof t!=`object`?!1:typeof t.isCancellationRequested==`boolean`&&typeof t.onCancellationRequested==`function`}e.isCancellationToken=t,e.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:aT.None}),e.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:gE})})(_E||={});var vE=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?gE:(this._emitter||=new Q,this._emitter.event)}dispose(){this._emitter&&=(this._emitter.dispose(),null)}},yE=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 Ow(`Calling 'cancelAndSet' on a disposed TimeoutTimer`);this.cancel(),this._token=setTimeout(()=>{this._token=-1,e()},t)}setIfNotSet(e,t){if(this._isDisposed)throw new Ow(`Calling 'setIfNotSet' on a disposed TimeoutTimer`);this._token===-1&&(this._token=setTimeout(()=>{this._token=-1,e()},t))}},bE=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 Ow(`Calling 'cancelAndSet' on a disposed IntervalTimer`);this.cancel();let r=n.setInterval(()=>{e()},t);this.disposable=Jw(()=>{n.clearInterval(r),this.disposable=void 0})}dispose(){this.cancel(),this.isDisposed=!0}};(function(){typeof globalThis.requestIdleCallback!=`function`||globalThis.cancelIdleCallback})();var xE;(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})(xE||={});var SE=class e{static fromArray(t){return new e(e=>{e.emitMany(t)})}static fromPromise(t){return new e(async e=>{e.emitMany(await t)})}static fromPromises(t){return new e(async e=>{await Promise.all(t.map(async t=>e.emitOne(await t)))})}static merge(t){return new e(async e=>{await Promise.all(t.map(async t=>{for await(let n of t)e.emitOne(n)}))})}constructor(e,t){this._state=0,this._results=[],this._error=null,this._onReturn=t,this._onStateChanged=new Q,queueMicrotask(async()=>{let t={emitOne:e=>this.emitOne(e),emitMany:e=>this.emitMany(e),reject:e=>this.reject(e)};try{await Promise.resolve(e(t)),this.resolve()}catch(e){this.reject(e)}finally{t.emitOne=void 0,t.emitMany=void 0,t.reject=void 0}})}[Symbol.asyncIterator](){let e=0;return{next:async()=>{do{if(this._state===2)throw this._error;if(e<this._results.length)return{done:!1,value:this._results[e++]};if(this._state===1)return{done:!0,value:void 0};await aT.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())}};SE.EMPTY=SE.fromArray([]);function CE(e){return 55296<=e&&e<=56319}function wE(e){return 56320<=e&&e<=57343}function TE(e,t){return(e-55296<<10)+(t-56320)+65536}function EE(e){return DE(e,0)}function DE(e,t){switch(typeof e){case`object`:return e===null?OE(349,t):Array.isArray(e)?jE(e,t):ME(e,t);case`string`:return AE(e,t);case`boolean`:return kE(e,t);case`number`:return OE(e,t);case`undefined`:return OE(937,t);default:return OE(617,t)}}function OE(e,t){return(t<<5)-t+e|0}function kE(e,t){return OE(e?433:863,t)}function AE(e,t){t=OE(149417,t);for(let n=0,r=e.length;n<r;n++)t=OE(e.charCodeAt(n),t);return t}function jE(e,t){return t=OE(104579,t),e.reduce((e,t)=>DE(t,e),t)}function ME(e,t){return t=OE(181387,t),Object.keys(e).sort().reduce((t,n)=>(t=AE(n,t),DE(e[n],t)),t)}function NE(e,t,n=32){let r=n-t,i=~((1<<r)-1);return(e<<t|(i&e)>>>r)>>>0}function PE(e,t=0,n=e.byteLength,r=0){for(let i=0;i<n;i++)e[t+i]=r}function FE(e,t,n=`0`){for(;e.length<t;)e=n+e;return e}function IE(e,t=32){return e instanceof ArrayBuffer?Array.from(new Uint8Array(e)).map(e=>e.toString(16).padStart(2,`0`)).join(``):FE((e>>>0).toString(16),t/4)}var LE=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(CE(a))if(o+1<t){let t=e.charCodeAt(o+1);wE(t)?(o++,s=TE(a,t)):s=65533}else{i=a;break}else wE(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()),IE(this._h0)+IE(this._h1)+IE(this._h2)+IE(this._h3)+IE(this._h4)}_wrapUp(){this._buff[this._buffLen++]=128,PE(this._buff,this._buffLen),this._buffLen>56&&(this._step(),PE(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,NE(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=NE(r,5)+c+s+l+t.getUint32(e*4,!1)&4294967295,s=o,o=a,a=NE(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}};LE._bigBlock32=new DataView(new ArrayBuffer(320));var{registerWindow:RE,getWindow:zE,getDocument:BE,getWindows:VE,getWindowsCount:HE,getWindowId:UE,getWindowById:WE,hasWindow:GE,onDidRegisterWindow:KE,onWillUnregisterWindow:qE,onDidUnregisterWindow:JE}=function(){let e=new Map,t={window:$w,disposables:new Xw};e.set($w.vscodeWindowId,t);let n=new Q,r=new Q,i=new Q;function a(n,r){return(typeof n==`number`?e.get(n):void 0)??(r?t:void 0)}return{onDidRegisterWindow:n.event,onWillUnregisterWindow:i.event,onDidUnregisterWindow:r.event,registerWindow(t){if(e.has(t.vscodeWindowId))return Zw.None;let a=new Xw,o={window:t,disposables:a.add(new Xw)};return e.set(t.vscodeWindowId,o),a.add(Jw(()=>{e.delete(t.vscodeWindowId),r.fire(t)})),a.add(XE(t,aD.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:$w},getDocument(e){return zE(e).document}}}(),YE=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 XE(e,t,n,r){return new YE(e,t,n,r)}function ZE(e,t){return function(n){return t(new mE(e,n))}}function QE(e){return function(t){return e(new uE(t))}}var $E=function(e,t,n,r){let i=n;return t===`click`||t===`mousedown`||t===`contextmenu`?i=ZE(zE(e),n):(t===`keydown`||t===`keypress`||t===`keyup`)&&(i=QE(n)),XE(e,t,i,r)},eD,tD=class extends bE{constructor(e){super(),this.defaultTarget=e&&zE(e)}cancelAndSet(e,t,n){return super.cancelAndSet(e,t,n??this.defaultTarget)}},nD=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){Sw(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(nD.sort),a.shift().execute();r.set(i,!1)};eD=(t,r,a=0)=>{let o=UE(t),s=new nD(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 rD=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}};rD.None=new rD(0,0);function iD(e){let t=e.getBoundingClientRect(),n=zE(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=EE(n),a=r.get(i);if(a)a.users+=1;else{let o=new Q,s=new MutationObserver(e=>o.fire(e));s.observe(e,n);let c=a={users:1,observer:s,onDidMutate:o.event};t.add(Jw(()=>{--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 aD={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:TT?`webkitAnimationStart`:`animationstart`,ANIMATION_END:TT?`webkitAnimationEnd`:`animationend`,ANIMATION_ITERATION:TT?`webkitAnimationIteration`:`animationiteration`},oD=/([\w\-]+)?(#([\w\-]+))?((\.([\w\-]+))*)/;function sD(e,t,n,...r){let i=oD.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 cD(e,t,...n){return sD(`http://www.w3.org/1999/xhtml`,e,t,...n)}cD.SVG=function(e,t,...n){return sD(`http://www.w3.org/2000/svg`,e,t,...n)};var lD=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=uD(e);this._maxWidth!==t&&(this._maxWidth=t,this.domNode.style.maxWidth=this._maxWidth)}setWidth(e){let t=uD(e);this._width!==t&&(this._width=t,this.domNode.style.width=this._width)}setHeight(e){let t=uD(e);this._height!==t&&(this._height=t,this.domNode.style.height=this._height)}setTop(e){let t=uD(e);this._top!==t&&(this._top=t,this.domNode.style.top=this._top)}setLeft(e){let t=uD(e);this._left!==t&&(this._left=t,this.domNode.style.left=this._left)}setBottom(e){let t=uD(e);this._bottom!==t&&(this._bottom=t,this.domNode.style.bottom=this._bottom)}setRight(e){let t=uD(e);this._right!==t&&(this._right=t,this.domNode.style.right=this._right)}setPaddingTop(e){let t=uD(e);this._paddingTop!==t&&(this._paddingTop=t,this.domNode.style.paddingTop=this._paddingTop)}setPaddingLeft(e){let t=uD(e);this._paddingLeft!==t&&(this._paddingLeft=t,this.domNode.style.paddingLeft=this._paddingLeft)}setPaddingBottom(e){let t=uD(e);this._paddingBottom!==t&&(this._paddingBottom=t,this.domNode.style.paddingBottom=this._paddingBottom)}setPaddingRight(e){let t=uD(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=uD(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=uD(e);this._lineHeight!==t&&(this._lineHeight=t,this.domNode.style.lineHeight=this._lineHeight)}setLetterSpacing(e){let t=uD(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 uD(e){return typeof e==`number`?`${e}px`:e}function dD(e){return new lD(e)}var fD=class{constructor(){this._hooks=new Xw,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(Jw(()=>{try{e.releasePointerCapture(t)}catch{}}))}catch{a=zE(e)}this._hooks.add(XE(a,aD.POINTER_MOVE,e=>{if(e.buttons!==n){this.stopMonitoring(!0);return}e.preventDefault(),this._pointerMoveCallback(e)})),this._hooks.add(XE(a,aD.POINTER_UP,e=>this.stopMonitoring(!0)))}};function pD(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 mD;(e=>(e.Tap=`-xterm-gesturetap`,e.Change=`-xterm-gesturechange`,e.Start=`-xterm-gesturestart`,e.End=`-xterm-gesturesend`,e.Contextmenu=`-xterm-gesturecontextmenu`))(mD||={});var hD=class e extends Zw{constructor(){super(),this.dispatched=!1,this.targets=new nT,this.ignoreTargets=new nT,this.activeTouches={},this.handle=null,this._lastSetTapCountTime=0,this._register(aT.runAndSubscribe(KE,({window:e,disposables:t})=>{t.add(XE(e.document,`touchstart`,e=>this.onTouchStart(e),{passive:!1})),t.add(XE(e.document,`touchend`,t=>this.onTouchEnd(e,t))),t.add(XE(e.document,`touchmove`,e=>this.onTouchMove(e),{passive:!1}))},{window:$w,disposables:this._store}))}static addTarget(t){return e.isTouchDevice()?(e.INSTANCE||=Gw(new e),Jw(e.INSTANCE.targets.push(t))):Zw.None}static ignoreTarget(t){return e.isTouchDevice()?(e.INSTANCE||=Gw(new e),Jw(e.INSTANCE.ignoreTargets.push(t))):Zw.None}static isTouchDevice(){return`ontouchstart`in $w||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(mD.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-jw(s.rollingPageX))<30&&Math.abs(s.initialPageY-jw(s.rollingPageY))<30){let e=this.newGestureEvent(mD.Tap,s.initialTarget);e.pageX=jw(s.rollingPageX),e.pageY=jw(s.rollingPageY),this.dispatchEvent(e)}else if(c>=e.HOLD_DELAY&&Math.abs(s.initialPageX-jw(s.rollingPageX))<30&&Math.abs(s.initialPageY-jw(s.rollingPageY))<30){let e=this.newGestureEvent(mD.Contextmenu,s.initialTarget);e.pageX=jw(s.rollingPageX),e.pageY=jw(s.rollingPageY),this.dispatchEvent(e)}else if(i===1){let e=jw(s.rollingPageX),n=jw(s.rollingPageY),i=jw(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(mD.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===mD.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===mD.Change||t.type===mD.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=eD(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(mD.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(mD.Change,i.initialTarget);a.translationX=r.pageX-jw(i.rollingPageX),a.translationY=r.pageY-jw(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)}};hD.SCROLL_FRICTION=-.005,hD.HOLD_DELAY=700,hD.CLEAR_TAP_COUNT_TIME=400,OC([pD],hD,`isTouchDevice`,1);var gD=hD,_D=class extends Zw{onclick(e,t){this._register(XE(e,aD.CLICK,n=>t(new mE(zE(e),n))))}onmousedown(e,t){this._register(XE(e,aD.MOUSE_DOWN,n=>t(new mE(zE(e),n))))}onmouseover(e,t){this._register(XE(e,aD.MOUSE_OVER,n=>t(new mE(zE(e),n))))}onmouseleave(e,t){this._register(XE(e,aD.MOUSE_LEAVE,n=>t(new mE(zE(e),n))))}onkeydown(e,t){this._register(XE(e,aD.KEY_DOWN,e=>t(new uE(e))))}onkeyup(e,t){this._register(XE(e,aD.KEY_UP,e=>t(new uE(e))))}oninput(e,t){this._register(XE(e,aD.INPUT,t))}onblur(e,t){this._register(XE(e,aD.BLUR,t))}onfocus(e,t){this._register(XE(e,aD.FOCUS,t))}onchange(e,t){this._register(XE(e,aD.CHANGE,t))}ignoreGesture(e){return gD.ignoreTarget(e)}},vD=11,yD=class extends _D{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=vD+`px`,this.domNode.style.height=vD+`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 fD),this._register($E(this.bgDomNode,aD.POINTER_DOWN,e=>this._arrowPointerDown(e))),this._register($E(this.domNode,aD.POINTER_DOWN,e=>this._arrowPointerDown(e))),this._pointerdownRepeatTimer=this._register(new tD),this._pointerdownScheduleRepeatTimer=this._register(new yE)}_arrowPointerDown(e){!e.target||!(e.target instanceof Element)||(this._onActivate(),this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancelAndSet(()=>{this._pointerdownRepeatTimer.cancelAndSet(()=>this._onActivate(),1e3/24,zE(e))},200),this._pointerMoveMonitor.startMonitoring(e.target,e.pointerId,e.buttons,e=>{},()=>{this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancel()}),e.preventDefault())}},bD=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}}},xD=class extends Zw{constructor(e){super(),this._scrollableBrand=void 0,this._onScroll=this._register(new Q),this.onScroll=this._onScroll.event,this._smoothScrollDuration=e.smoothScrollDuration,this._scheduleAtNextAnimationFrame=e.scheduleAtNextAnimationFrame,this._state=new bD(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 TD(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=TD.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)))}},SD=class{constructor(e,t,n){this.scrollLeft=e,this.scrollTop=t,this.isDone=n}};function CD(e,t){let n=t-e;return function(t){return e+n*DD(t)}}function wD(e,t,n){return function(r){return r<n?e(r/n):t((r-n)/(1-n))}}var TD=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),wD(CD(e,r),CD(i,t),.33)}return CD(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 SD(this.scrollLeft(t),this.scrollTop(t),!1):new SD(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 ED(e){return e**3}function DD(e){return 1-ED(1-e)}var OD=class extends Zw{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 yE)}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`:``)))}},kD=140,AD=class extends _D{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 OD(e.visibility,`visible scrollbar `+e.extraScrollbarClassName,`invisible scrollbar `+e.extraScrollbarClassName)),this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._pointerMoveMonitor=this._register(new fD),this._shouldRender=!0,this.domNode=dD(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(XE(this.domNode.domNode,aD.POINTER_DOWN,e=>this._domNodePointerDown(e)))}_createArrow(e){let t=this._register(new yD(e));this.domNode.domNode.appendChild(t.bgDomNode),this.domNode.domNode.appendChild(t.domNode)}_createSlider(e,t,n,r){this.slider=dD(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(XE(this.slider.domNode,aD.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=iD(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(VT&&a>kD){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()}},jD=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)}},MD=class extends AD{constructor(e,t,n){let r=e.getScrollDimensions(),i=e.getCurrentScrollPosition();if(super({lazyRender:t.lazyRender,host:n,scrollbarState:new jD(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}},ND=class extends AD{constructor(e,t,n){let r=e.getScrollDimensions(),i=e.getCurrentScrollPosition();if(super({lazyRender:t.lazyRender,host:n,scrollbarState:new jD(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}},PD=500,FD=50,ID=!0,LD=class{constructor(e,t,n){this.timestamp=e,this.deltaX=t,this.deltaY=n,this.score=0}},RD=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(ET){let t=ST(zE(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 LD(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}};RD.INSTANCE=new RD;var zD=RD,BD=class extends _D{constructor(e,t,n){super(),this._onScroll=this._register(new Q),this.onScroll=this._onScroll.event,this._onWillScroll=this._register(new Q),this.onWillScroll=this._onWillScroll.event,this._options=HD(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 ND(this._scrollable,this._options,r)),this._horizontalScrollbar=this._register(new MD(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=dD(document.createElement(`div`)),this._leftShadowDomNode.setClassName(`shadow`),this._domNode.appendChild(this._leftShadowDomNode.domNode),this._topShadowDomNode=dD(document.createElement(`div`)),this._topShadowDomNode.setClassName(`shadow`),this._domNode.appendChild(this._topShadowDomNode.domNode),this._topLeftShadowDomNode=dD(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 yE),this._isDragging=!1,this._mouseIsOver=!1,this._shouldRender=!0,this._revealOnScroll=!0}get options(){return this._options}dispose(){this._mouseWheelToDispose=Kw(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,HT&&(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 hE(e))}_setListeningToMouseWheel(e){this._mouseWheelToDispose.length>0!==e&&(this._mouseWheelToDispose=Kw(this._mouseWheelToDispose),e)&&this._mouseWheelToDispose.push(XE(this._listenOnDomNode,aD.MOUSE_WHEEL,e=>{this._onMouseWheel(new hE(e))},{passive:!1}))}_onMouseWheel(e){if(e.browserEvent?.defaultPrevented)return;let t=zD.INSTANCE;ID&&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=!HT&&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=FD*r,t=o.scrollTop-(e<0?Math.floor(e):Math.ceil(e));this._verticalScrollbar.writeScrollPosition(s,t)}if(i){let e=FD*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)&&(ID&&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(),PD)}},VD=class extends BD{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 HD(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,HT&&(t.className+=` mac`),t}var UD=class extends Zw{constructor(e,t,n,r,i,a,o,s){super(),this._bufferService=n,this._optionsService=o,this._renderService=s,this._onRequestScrollLines=this._register(new Q),this.onRequestScrollLines=this._onRequestScrollLines.event,this._isSyncing=!1,this._isHandlingScroll=!1,this._suppressOnScrollHandler=!1;let c=this._register(new xD({forceIntegerValues:!1,smoothScrollDuration:this._optionsService.rawOptions.smoothScrollDuration,scheduleAtNextAnimationFrame:e=>eD(r.window,e)}));this._register(this._optionsService.onSpecificOptionChange(`smoothScrollDuration`,()=>{c.setSmoothScrollDuration(this._optionsService.rawOptions.smoothScrollDuration)})),this._scrollableElement=this._register(new VD(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(aT.runAndSubscribe(a.onChangeColors,()=>{this._scrollableElement.getDomNode().style.backgroundColor=a.colors.background.css})),e.appendChild(this._scrollableElement.getDomNode()),this._register(Jw(()=>this._scrollableElement.getDomNode().remove())),this._styleElement=r.mainDocument.createElement(`style`),t.appendChild(this._styleElement),this._register(Jw(()=>this._styleElement.remove())),this._register(aT.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(`
|
|
140
|
-
`)})),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}};UD=OC([Z(2,tw),Z(3,mw),Z(4,nw),Z(5,yw),Z(6,sw),Z(7,gw)],UD);var WD=class extends Zw{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(Jw(()=>{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()}};WD=OC([Z(1,tw),Z(2,mw),Z(3,uw),Z(4,gw)],WD);var GD=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)}},KD={full:0,left:0,center:0,right:0},qD={full:0,left:0,center:0,right:0},JD={full:0,left:0,center:0,right:0},YD=class extends Zw{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 GD,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(Jw(()=>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);qD.full=this._canvas.width,qD.left=e,qD.center=t,qD.right=e,this._refreshDrawHeightConstants(),JD.full=1,JD.left=1,JD.center=1+qD.left,JD.right=1+qD.left+qD.center}_refreshDrawHeightConstants(){KD.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);KD.left=t,KD.center=t,KD.right=t}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*KD.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*KD.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*KD.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*KD.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(JD[e.position||`full`],Math.round((this._canvas.height-1)*(e.startBufferLine/this._bufferService.buffers.active.lines.length)-KD[e.position||`full`]/2),qD[e.position||`full`],Math.round((this._canvas.height-1)*((e.endBufferLine-e.startBufferLine)/this._bufferService.buffers.active.lines.length)+KD[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}))}};YD=OC([Z(2,tw),Z(3,uw),Z(4,gw),Z(5,sw),Z(6,yw),Z(7,mw)],YD);var $;(e=>(e.NUL=`\0`,e.SOH=``,e.STX=``,e.ETX=``,e.EOT=``,e.ENQ=``,e.ACK=``,e.BEL=`\x07`,e.BS=`\b`,e.HT=` `,e.LF=`
|
|
141
|
-
`,e.VT=`\v`,e.FF=`\f`,e.CR=`\r`,e.SO=``,e.SI=``,e.DLE=``,e.DC1=``,e.DC2=``,e.DC3=``,e.DC4=``,e.NAK=``,e.SYN=``,e.ETB=``,e.CAN=``,e.EM=``,e.SUB=``,e.ESC=`\x1B`,e.FS=``,e.GS=``,e.RS=``,e.US=``,e.SP=` `,e.DEL=``))($||={});var XD;(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=``))(XD||={});var ZD;(e=>e.ST=`${$.ESC}\\`)(ZD||={});var QD=class{constructor(e,t,n,r,i,a){this._textarea=e,this._compositionView=t,this._bufferService=n,this._optionsService=r,this._coreService=i,this._renderService=a,this._isComposing=!1,this._isSendingComposition=!1,this._compositionPosition={start:0,end:0},this._dataAlreadySent=``}get isComposing(){return this._isComposing}compositionstart(){this._isComposing=!0,this._compositionPosition.start=this._textarea.value.length,this._compositionView.textContent=``,this._dataAlreadySent=``,this._compositionView.classList.add(`active`)}compositionupdate(e){this._compositionView.textContent=e.data,this.updateCompositionElements(),setTimeout(()=>{this._compositionPosition.end=this._textarea.value.length},0)}compositionend(){this._finalizeComposition(!0)}keydown(e){if(this._isComposing||this._isSendingComposition){if(e.keyCode===20||e.keyCode===229||e.keyCode===16||e.keyCode===17||e.keyCode===18)return!1;this._finalizeComposition(!1)}return e.keyCode===229?(this._handleAnyTextareaChanges(),!1):!0}_finalizeComposition(e){if(this._compositionView.classList.remove(`active`),this._isComposing=!1,e){let e={start:this._compositionPosition.start,end:this._compositionPosition.end};this._isSendingComposition=!0,setTimeout(()=>{if(this._isSendingComposition){this._isSendingComposition=!1;let t;e.start+=this._dataAlreadySent.length,t=this._isComposing?this._textarea.value.substring(e.start,this._compositionPosition.start):this._textarea.value.substring(e.start),t.length>0&&this._coreService.triggerDataEvent(t,!0)}},0)}else{this._isSendingComposition=!1;let e=this._textarea.value.substring(this._compositionPosition.start,this._compositionPosition.end);this._coreService.triggerDataEvent(e,!0)}}_handleAnyTextareaChanges(){let e=this._textarea.value;setTimeout(()=>{if(!this._isComposing){let t=this._textarea.value,n=t.replace(e,``);this._dataAlreadySent=n,t.length>e.length?this._coreService.triggerDataEvent(n,!0):t.length<e.length?this._coreService.triggerDataEvent(`${$.DEL}`,!0):t.length===e.length&&t!==e&&this._coreService.triggerDataEvent(t,!0)}},0)}updateCompositionElements(e){if(this._isComposing){if(this._bufferService.buffer.isCursorInViewport){let e=Math.min(this._bufferService.buffer.x,this._bufferService.cols-1),t=this._renderService.dimensions.css.cell.height,n=this._bufferService.buffer.y*this._renderService.dimensions.css.cell.height,r=e*this._renderService.dimensions.css.cell.width;this._compositionView.style.left=r+`px`,this._compositionView.style.top=n+`px`,this._compositionView.style.height=t+`px`,this._compositionView.style.lineHeight=t+`px`,this._compositionView.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._compositionView.style.fontSize=this._optionsService.rawOptions.fontSize+`px`;let i=this._compositionView.getBoundingClientRect();this._textarea.style.left=r+`px`,this._textarea.style.top=n+`px`,this._textarea.style.width=Math.max(i.width,1)+`px`,this._textarea.style.height=Math.max(i.height,1)+`px`,this._textarea.style.lineHeight=i.height+`px`}e||setTimeout(()=>this.updateCompositionElements(!0),0)}}};QD=OC([Z(2,tw),Z(3,sw),Z(4,rw),Z(5,gw)],QD);var $D=0,eO=0,tO=0,nO=0,rO={css:`#00000000`,rgba:0},iO;(e=>{function t(e,t,n,r){return r===void 0?`#${lO(e)}${lO(t)}${lO(n)}`:`#${lO(e)}${lO(t)}${lO(n)}${lO(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})(iO||={});var aO;(e=>{function t(e,t){if(nO=(t.rgba&255)/255,nO===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 $D=a+Math.round((n-a)*nO),eO=o+Math.round((r-o)*nO),tO=s+Math.round((i-s)*nO),{css:iO.toCss($D,eO,tO),rgba:iO.toRgba($D,eO,tO)}}e.blend=t;function n(e){return(e.rgba&255)==255}e.isOpaque=n;function r(e,t,n){let r=cO.ensureContrastRatio(e.rgba,t.rgba,n);if(r)return iO.toColor(r>>24&255,r>>16&255,r>>8&255)}e.ensureContrastRatio=r;function i(e){let t=(e.rgba|255)>>>0;return[$D,eO,tO]=cO.toChannels(t),{css:iO.toCss($D,eO,tO),rgba:t}}e.opaque=i;function a(e,t){return nO=Math.round(t*255),[$D,eO,tO]=cO.toChannels(e.rgba),{css:iO.toCss($D,eO,tO,nO),rgba:iO.toRgba($D,eO,tO,nO)}}e.opacity=a;function o(e,t){return nO=e.rgba&255,a(e,nO*t/255)}e.multiplyOpacity=o;function s(e){return[e.rgba>>24&255,e.rgba>>16&255,e.rgba>>8&255]}e.toColorRGB=s})(aO||={});var oO;(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 $D=parseInt(e.slice(1,2).repeat(2),16),eO=parseInt(e.slice(2,3).repeat(2),16),tO=parseInt(e.slice(3,4).repeat(2),16),iO.toColor($D,eO,tO);case 5:return $D=parseInt(e.slice(1,2).repeat(2),16),eO=parseInt(e.slice(2,3).repeat(2),16),tO=parseInt(e.slice(3,4).repeat(2),16),nO=parseInt(e.slice(4,5).repeat(2),16),iO.toColor($D,eO,tO,nO);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 $D=parseInt(r[1]),eO=parseInt(r[2]),tO=parseInt(r[3]),nO=Math.round((r[5]===void 0?1:parseFloat(r[5]))*255),iO.toColor($D,eO,tO,nO);if(!t||!n||(t.fillStyle=n,t.fillStyle=e,typeof t.fillStyle!=`string`)||(t.fillRect(0,0,1,1),[$D,eO,tO,nO]=t.getImageData(0,0,1,1).data,nO!==255))throw Error(`css.toColor: Unsupported css format`);return{rgba:iO.toRgba($D,eO,tO,nO),css:e}}e.toColor=r})(oO||={});var sO;(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})(sO||={});var cO;(e=>{function t(e,t){if(nO=(t&255)/255,nO===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 $D=a+Math.round((n-a)*nO),eO=o+Math.round((r-o)*nO),tO=s+Math.round((i-s)*nO),iO.toRgba($D,eO,tO)}e.blend=t;function n(e,t,n){let a=sO.relativeLuminance(e>>8),o=sO.relativeLuminance(t>>8);if(uO(a,o)<n){if(o<a){let o=r(e,t,n),s=uO(a,sO.relativeLuminance(o>>8));if(s<n){let r=i(e,t,n);return s>uO(a,sO.relativeLuminance(r>>8))?o:r}return o}let s=i(e,t,n),c=uO(a,sO.relativeLuminance(s>>8));if(c<n){let i=r(e,t,n);return c>uO(a,sO.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=uO(sO.relativeLuminance2(o,s,c),sO.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=uO(sO.relativeLuminance2(o,s,c),sO.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=uO(sO.relativeLuminance2(o,s,c),sO.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=uO(sO.relativeLuminance2(o,s,c),sO.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})(cO||={});function lO(e){let t=e.toString(16);return t.length<2?`0`+t:t}function uO(e,t){return e<t?(t+.05)/(e+.05):(e+.05)/(t+.05)}var dO=class extends KC{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()]}},fO=class{constructor(e){this._bufferService=e,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new JC}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||GC.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++)fO._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||GC.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}};fO=OC([Z(0,tw)],fO);function pO(e){return 57508<=e&&e<=57558}function mO(e){return 9472<=e&&e<=9631}function hO(e){return pO(e)||mO(e)}function gO(){return{css:{canvas:_O(),cell:_O()},device:{canvas:_O(),cell:_O(),char:{width:0,height:0,left:0,top:0}}}}function _O(){return{width:0,height:0}}var vO=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 JC,this._columnSelectMode=!1,this.defaultSpacing=0}handleSelectionChanged(e,t,n){this._selectionStart=e,this._selectionEnd=t,this._columnSelectMode=n}createRow(e,t,n,r,i,a,o,s,c,l,u){let d=[],f=this._characterJoinerService.getJoinedCharacters(t),p=this._themeService.colors,m=e.getNoBgTrimmedLength();n&&m<a+1&&(m=a+1);let h,g=0,_=``,v=0,y=0,b=0,x=0,S=!1,C=0,w=!1,T=0,E=0,D=[],O=l!==-1&&u!==-1;for(let k=0;k<m;k++){e.loadCell(k,this._workCell);let m=this._workCell.getWidth();if(m===0)continue;let A=!1,j=k>=E,M=k,N=this._workCell;if(f.length>0&&k===f[0][0]&&j){let r=f.shift(),i=this._isCellInSelection(r[0],t);for(v=r[0]+1;v<r[1];v++)j&&=i===this._isCellInSelection(v,t);j&&=!n||a<r[0]||a>=r[1],j?(A=!0,N=new dO(this._workCell,e.translateToString(!0,r[0],r[1]),r[1]-r[0]),M=r[1]-1,m=N.getWidth()):E=r[1]}let P=this._isCellInSelection(k,t),ee=n&&k===a,F=O&&k>=l&&k<=u,I=!1;this._decorationService.forEachDecorationAtCell(k,t,void 0,e=>{I=!0});let te=N.getChars()||GC;if(te===` `&&(N.isUnderline()||N.isOverline())&&(te=`\xA0`),T=m*s-c.get(te,N.isBold(),N.isItalic()),!h)h=this._document.createElement(`span`);else if(g&&(P&&w||!P&&!w&&N.bg===y)&&(P&&w&&p.selectionForeground||N.fg===b)&&N.extended.ext===x&&F===S&&T===C&&!ee&&!A&&!I&&j){N.isInvisible()?_+=GC:_+=te,g++;continue}else g&&(h.textContent=_),h=this._document.createElement(`span`),g=0,_=``;if(y=N.bg,b=N.fg,x=N.extended.ext,S=F,C=T,w=P,A&&a>=k&&a<=M&&(a=k),!this._coreService.isCursorHidden&&ee&&this._coreService.isCursorInitialized){if(D.push(`xterm-cursor`),this._coreBrowserService.isFocused)o&&D.push(`xterm-cursor-blink`),D.push(r===`bar`?`xterm-cursor-bar`:r===`underline`?`xterm-cursor-underline`:`xterm-cursor-block`);else if(i)switch(i){case`outline`:D.push(`xterm-cursor-outline`);break;case`block`:D.push(`xterm-cursor-block`);break;case`bar`:D.push(`xterm-cursor-bar`);break;case`underline`:D.push(`xterm-cursor-underline`);break;default:break}}if(N.isBold()&&D.push(`xterm-bold`),N.isItalic()&&D.push(`xterm-italic`),N.isDim()&&D.push(`xterm-dim`),_=N.isInvisible()?GC:N.getChars()||GC,N.isUnderline()&&(D.push(`xterm-underline-${N.extended.underlineStyle}`),_===` `&&(_=`\xA0`),!N.isUnderlineColorDefault()))if(N.isUnderlineColorRGB())h.style.textDecorationColor=`rgb(${KC.toColorRGB(N.getUnderlineColor()).join(`,`)})`;else{let e=N.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&N.isBold()&&e<8&&(e+=8),h.style.textDecorationColor=p.ansi[e].css}N.isOverline()&&(D.push(`xterm-overline`),_===` `&&(_=`\xA0`)),N.isStrikethrough()&&D.push(`xterm-strikethrough`),F&&(h.style.textDecoration=`underline`);let L=N.getFgColor(),ne=N.getFgColorMode(),R=N.getBgColor(),re=N.getBgColorMode(),z=!!N.isInverse();if(z){let e=L;L=R,R=e;let t=ne;ne=re,re=t}let ie,ae,oe=!1;this._decorationService.forEachDecorationAtCell(k,t,void 0,e=>{e.options.layer!==`top`&&oe||(e.backgroundColorRGB&&(re=50331648,R=e.backgroundColorRGB.rgba>>8&16777215,ie=e.backgroundColorRGB),e.foregroundColorRGB&&(ne=50331648,L=e.foregroundColorRGB.rgba>>8&16777215,ae=e.foregroundColorRGB),oe=e.options.layer===`top`)}),!oe&&P&&(ie=this._coreBrowserService.isFocused?p.selectionBackgroundOpaque:p.selectionInactiveBackgroundOpaque,R=ie.rgba>>8&16777215,re=50331648,oe=!0,p.selectionForeground&&(ne=50331648,L=p.selectionForeground.rgba>>8&16777215,ae=p.selectionForeground)),oe&&D.push(`xterm-decoration-top`);let se;switch(re){case 16777216:case 33554432:se=p.ansi[R],D.push(`xterm-bg-${R}`);break;case 50331648:se=iO.toColor(R>>16,R>>8&255,R&255),this._addStyle(h,`background-color:#${yO((R>>>0).toString(16),`0`,6)}`);break;default:z?(se=p.foreground,D.push(`xterm-bg-257`)):se=p.background}switch(ie||N.isDim()&&(ie=aO.multiplyOpacity(se,.5)),ne){case 16777216:case 33554432:N.isBold()&&L<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(L+=8),this._applyMinimumContrast(h,se,p.ansi[L],N,ie,void 0)||D.push(`xterm-fg-${L}`);break;case 50331648:let e=iO.toColor(L>>16&255,L>>8&255,L&255);this._applyMinimumContrast(h,se,e,N,ie,ae)||this._addStyle(h,`color:#${yO(L.toString(16),`0`,6)}`);break;default:this._applyMinimumContrast(h,se,p.foreground,N,ie,ae)||z&&D.push(`xterm-fg-257`)}D.length&&=(h.className=D.join(` `),0),!ee&&!A&&!I&&j?g++:h.textContent=_,T!==this.defaultSpacing&&(h.style.letterSpacing=`${T}px`),d.push(h),k=M}return h&&g&&(h.textContent=_),d}_applyMinimumContrast(e,t,n,r,i,a){if(this._optionsService.rawOptions.minimumContrastRatio===1||hO(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=aO.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]}};vO=OC([Z(1,vw),Z(2,sw),Z(3,mw),Z(4,rw),Z(5,uw),Z(6,yw)],vO);function yO(e,t,n){for(;e.length<n;)e=t+e;return e}var bO=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}},xO=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 SO(){return new xO}var CO=`xterm-dom-renderer-owner-`,wO=`xterm-rows`,TO=`xterm-fg-`,EO=`xterm-bg-`,DO=`xterm-focus`,OO=`xterm-selection`,kO=1,AO=class extends Zw{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=kO++,this._rowElements=[],this._selectionRenderModel=SO(),this.onRequestRedraw=this._register(new Q).event,this._rowContainer=this._document.createElement(`div`),this._rowContainer.classList.add(wO),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(OO),this._selectionContainer.setAttribute(`aria-hidden`,`true`),this.dimensions=gO(),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(vO,document),this._element.classList.add(CO+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(Jw(()=>{this._element.classList.remove(CO+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()})),this._widthCache=new bO(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} .${wO} 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} .${wO} { 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} .${wO} .xterm-dim { color: ${aO.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} .${wO}.${DO} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${n} 1s step-end infinite;}${this._terminalSelector} .${wO}.${DO} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${r} 1s step-end infinite;}${this._terminalSelector} .${wO}.${DO} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${i} 1s step-end infinite;}${this._terminalSelector} .${wO} .xterm-cursor.xterm-cursor-block { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css};}${this._terminalSelector} .${wO} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${e.cursor.css} !important; color: ${e.cursorAccent.css} !important;}${this._terminalSelector} .${wO} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${e.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${wO} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${e.cursor.css} inset;}${this._terminalSelector} .${wO} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${e.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,t+=`${this._terminalSelector} .${OO} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${OO} div { position: absolute; background-color: ${e.selectionBackgroundOpaque.css};}${this._terminalSelector} .${OO} div { position: absolute; background-color: ${e.selectionInactiveBackgroundOpaque.css};}`;for(let[n,r]of e.ansi.entries())t+=`${this._terminalSelector} .${TO}${n} { color: ${r.css}; }${this._terminalSelector} .${TO}${n}.xterm-dim { color: ${aO.multiplyOpacity(r,.5).css}; }${this._terminalSelector} .${EO}${n} { background-color: ${r.css}; }`;t+=`${this._terminalSelector} .${TO}257 { color: ${aO.opaque(e.background).css}; }${this._terminalSelector} .${TO}257.xterm-dim { color: ${aO.multiplyOpacity(aO.opaque(e.background),.5).css}; }${this._terminalSelector} .${EO}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(DO),this.renderRows(0,this._bufferService.rows-1)}handleFocus(){this._rowContainer.classList.add(DO),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`.${CO}${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))}}};AO=OC([Z(7,aw),Z(8,pw),Z(9,sw),Z(10,tw),Z(11,rw),Z(12,mw),Z(13,yw)],AO);var jO=class extends Zw{constructor(e,t,n){super(),this._optionsService=n,this.width=0,this.height=0,this._onCharSizeChange=this._register(new Q),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this._register(new PO(this._optionsService))}catch{this._measureStrategy=this._register(new NO(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())}};jO=OC([Z(2,sw)],jO);var MO=class extends Zw{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)}},NO=class extends MO{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}},PO=class extends MO{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}},FO=class extends Zw{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 IO(this._window)),this._onDprChange=this._register(new Q),this.onDprChange=this._onDprChange.event,this._onWindowChange=this._register(new Q),this.onWindowChange=this._onWindowChange.event,this._register(this.onWindowChange(e=>this._screenDprMonitor.setWindow(e))),this._register(aT.forward(this._screenDprMonitor.onDprChange,this._onDprChange)),this._register(XE(this._textarea,`focus`,()=>this._isFocused=!0)),this._register(XE(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}},IO=class extends Zw{constructor(e){super(),this._parentWindow=e,this._windowResizeListener=this._register(new Qw),this._onDprChange=this._register(new Q),this.onDprChange=this._onDprChange.event,this._outerListener=()=>this._setDprAndFireIfDiffers(),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._updateDpr(),this._setWindowResizeListener(),this._register(Jw(()=>this.clearListener()))}setWindow(e){this._parentWindow=e,this._setWindowResizeListener(),this._setDprAndFireIfDiffers()}_setWindowResizeListener(){this._windowResizeListener.value=XE(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)}},LO=class extends Zw{constructor(){super(),this.linkProviders=[],this._register(Jw(()=>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 RO(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 zO(e,t,n,r,i,a,o,s,c){if(!a)return;let l=RO(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 BO=class{constructor(e,t){this._renderService=e,this._charSizeService=t}getCoords(e,t,n,r,i){return zO(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=RO(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])}}};BO=OC([Z(0,gw),Z(1,pw)],BO);var VO=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=[]}},HO={};DC(HO,{getSafariVersion:()=>YO,isChromeOS:()=>tk,isFirefox:()=>KO,isIpad:()=>ZO,isIphone:()=>QO,isLegacyEdge:()=>qO,isLinux:()=>ek,isMac:()=>XO,isNode:()=>UO,isSafari:()=>JO,isWindows:()=>$O});var UO=typeof process<`u`&&`title`in process,WO=UO?`node`:navigator.userAgent,GO=UO?`node`:navigator.platform,KO=WO.includes(`Firefox`),qO=WO.includes(`Edge`),JO=/^((?!chrome|android).)*safari/i.test(WO);function YO(){if(!JO)return 0;let e=WO.match(/Version\/(\d+)/);return e===null||e.length<2?0:parseInt(e[1])}var XO=[`Macintosh`,`MacIntel`,`MacPPC`,`Mac68K`].includes(GO),ZO=GO===`iPad`,QO=GO===`iPhone`,$O=[`Windows`,`Win16`,`Win32`,`WinCE`].includes(GO),ek=GO.indexOf(`Linux`)>=0,tk=/\bCrOS\b/.test(WO),nk=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()}},rk=class extends nk{_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())}}},ik=class extends nk{_requestCallback(e){return requestIdleCallback(e)}_cancelCallback(e){cancelIdleCallback(e)}},ak=!UO&&`requestIdleCallback`in window?ik:rk,ok=class{constructor(){this._queue=new ak}set(e){this._queue.clear(),this._queue.enqueue(e)}flush(){this._queue.flush()}},sk=class extends Zw{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 Qw),this._pausedResizeTask=new ok,this._observerDisposable=this._register(new Qw),this._isPaused=!1,this._needsFullRefresh=!1,this._isNextRenderRedrawOnly=!0,this._needsSelectionRefresh=!1,this._canvasWidth=0,this._canvasHeight=0,this._selectionState={start:void 0,end:void 0,columnSelectMode:!1},this._onDimensionsChange=this._register(new Q),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this._register(new Q),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this._register(new Q),this.onRender=this._onRender.event,this._onRefreshRequest=this._register(new Q),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new VO((e,t)=>this._renderRows(e,t),this._coreBrowserService),this._register(this._renderDebouncer),this._syncOutputHandler=new ck(this._coreBrowserService,this._coreService,()=>this._fullRefresh()),this._register(Jw(()=>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=Jw(()=>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()}};sk=OC([Z(2,sw),Z(3,pw),Z(4,rw),Z(5,uw),Z(6,tw),Z(7,mw),Z(8,yw)],sk);var ck=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 lk(e,t,n,r){let i=n.buffer.x,a=n.buffer.y;if(!n.buffer.hasScrollback)return fk(i,a,e,t,n,r)+pk(a,t,n,r)+mk(i,a,e,t,n,r);let o;if(a===t)return o=i>e?`D`:`C`,xk(Math.abs(i-e),bk(o,r));o=a>t?`D`:`C`;let s=Math.abs(a-t);return xk(dk(a>t?e:i,n)+(s-1)*n.cols+1+uk(a>t?i:e,n),bk(o,r))}function uk(e,t){return e-1}function dk(e,t){return t.cols-e}function fk(e,t,n,r,i,a){return pk(t,r,i,a).length===0?``:xk(yk(e,t,e,t-gk(t,i),!1,i).length,bk(`D`,a))}function pk(e,t,n,r){let i=e-gk(e,n),a=t-gk(t,n);return xk(Math.abs(i-a)-hk(e,t,n),bk(vk(e,t),r))}function mk(e,t,n,r,i,a){let o;o=pk(t,r,i,a).length>0?r-gk(r,i):t;let s=r,c=_k(e,t,n,r,i,a);return xk(yk(e,o,n,s,c===`C`,i).length,bk(c,a))}function hk(e,t,n){let r=0,i=e-gk(e,n),a=t-gk(t,n);for(let o=0;o<Math.abs(i-a);o++){let a=vk(e,t)===`A`?-1:1;n.buffer.lines.get(i+a*o)?.isWrapped&&r++}return r}function gk(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 _k(e,t,n,r,i,a){let o;return o=pk(n,r,i,a).length>0?r-gk(r,i):t,e<n&&o<=r||e>=n&&o<r?`C`:`D`}function vk(e,t){return e>t?`A`:`B`}function yk(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 bk(e,t){let n=t?`O`:`[`;return $.ESC+n+e}function xk(e,t){e=Math.floor(e);let n=``;for(let r=0;r<e;r++)n+=t;return n}var Sk=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 Ck(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 wk=50,Tk=15,Ek=50,Dk=500,Ok=RegExp(`\xA0`,`g`),kk=class extends Zw{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 JC,this._mouseDownTimeStamp=0,this._oldHasSelection=!1,this._oldSelectionStart=void 0,this._oldSelectionEnd=void 0,this._onLinuxMouseSelection=this._register(new Q),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this._register(new Q),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this._register(new Q),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this._register(new Q),this.onRequestScrollLines=this._onRequestScrollLines.event,this._mouseMoveListener=e=>this._handleMouseMove(e),this._mouseUpListener=e=>this._handleMouseUp(e),this._coreService.onUserInput(()=>{this.hasSelection&&this.clearSelection()}),this._trimListener=this._bufferService.buffer.lines.onTrim(e=>this._handleTrim(e)),this._register(this._bufferService.buffers.onBufferActivate(e=>this._handleBufferActivate(e))),this.enable(),this._model=new Sk(this._bufferService),this._activeSelectionMode=0,this._register(Jw(()=>{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(Ok,` `)).join($O?`\r
|
|
142
|
-
`:`
|
|
143
|
-
`)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(e){this._refreshAnimationFrame||=this._coreBrowserService.window.requestAnimationFrame(()=>this._refresh()),ek&&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=Ck(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=RO(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,-wk),wk),t/=wk,t/Math.abs(t)+Math.round(t*(Tk-1)))}shouldForceSelection(e){return XO?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(),Ek)}_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&&!(XO&&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<Dk&&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=lk(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=Ck(n,this._bufferService.cols)}};kk=OC([Z(3,tw),Z(4,rw),Z(5,hw),Z(6,sw),Z(7,gw),Z(8,mw)],kk);var Ak=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={}}},jk=class{constructor(){this._color=new Ak,this._css=new Ak}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()}},Mk=Object.freeze((()=>{let e=[oO.toColor(`#2e3436`),oO.toColor(`#cc0000`),oO.toColor(`#4e9a06`),oO.toColor(`#c4a000`),oO.toColor(`#3465a4`),oO.toColor(`#75507b`),oO.toColor(`#06989a`),oO.toColor(`#d3d7cf`),oO.toColor(`#555753`),oO.toColor(`#ef2929`),oO.toColor(`#8ae234`),oO.toColor(`#fce94f`),oO.toColor(`#729fcf`),oO.toColor(`#ad7fa8`),oO.toColor(`#34e2e2`),oO.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:iO.toCss(r,i,a),rgba:iO.toRgba(r,i,a)})}for(let t=0;t<24;t++){let n=8+t*10;e.push({css:iO.toCss(n,n,n),rgba:iO.toRgba(n,n,n)})}return e})()),Nk=oO.toColor(`#ffffff`),Pk=oO.toColor(`#000000`),Fk=oO.toColor(`#ffffff`),Ik=Pk,Lk={css:`rgba(255, 255, 255, 0.3)`,rgba:4294967117},Rk=Nk,zk=class extends Zw{constructor(e){super(),this._optionsService=e,this._contrastCache=new jk,this._halfContrastCache=new jk,this._onChangeColors=this._register(new Q),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:Nk,background:Pk,cursor:Fk,cursorAccent:Ik,selectionForeground:void 0,selectionBackgroundTransparent:Lk,selectionBackgroundOpaque:aO.blend(Pk,Lk),selectionInactiveBackgroundTransparent:Lk,selectionInactiveBackgroundOpaque:aO.blend(Pk,Lk),scrollbarSliderBackground:aO.opacity(Nk,.2),scrollbarSliderHoverBackground:aO.opacity(Nk,.4),scrollbarSliderActiveBackground:aO.opacity(Nk,.5),overviewRulerBorder:Nk,ansi:Mk.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=Bk(e.foreground,Nk),t.background=Bk(e.background,Pk),t.cursor=aO.blend(t.background,Bk(e.cursor,Fk)),t.cursorAccent=aO.blend(t.background,Bk(e.cursorAccent,Ik)),t.selectionBackgroundTransparent=Bk(e.selectionBackground,Lk),t.selectionBackgroundOpaque=aO.blend(t.background,t.selectionBackgroundTransparent),t.selectionInactiveBackgroundTransparent=Bk(e.selectionInactiveBackground,t.selectionBackgroundTransparent),t.selectionInactiveBackgroundOpaque=aO.blend(t.background,t.selectionInactiveBackgroundTransparent),t.selectionForeground=e.selectionForeground?Bk(e.selectionForeground,rO):void 0,t.selectionForeground===rO&&(t.selectionForeground=void 0),aO.isOpaque(t.selectionBackgroundTransparent)&&(t.selectionBackgroundTransparent=aO.opacity(t.selectionBackgroundTransparent,.3)),aO.isOpaque(t.selectionInactiveBackgroundTransparent)&&(t.selectionInactiveBackgroundTransparent=aO.opacity(t.selectionInactiveBackgroundTransparent,.3)),t.scrollbarSliderBackground=Bk(e.scrollbarSliderBackground,aO.opacity(t.foreground,.2)),t.scrollbarSliderHoverBackground=Bk(e.scrollbarSliderHoverBackground,aO.opacity(t.foreground,.4)),t.scrollbarSliderActiveBackground=Bk(e.scrollbarSliderActiveBackground,aO.opacity(t.foreground,.5)),t.overviewRulerBorder=Bk(e.overviewRulerBorder,Rk),t.ansi=Mk.slice(),t.ansi[0]=Bk(e.black,Mk[0]),t.ansi[1]=Bk(e.red,Mk[1]),t.ansi[2]=Bk(e.green,Mk[2]),t.ansi[3]=Bk(e.yellow,Mk[3]),t.ansi[4]=Bk(e.blue,Mk[4]),t.ansi[5]=Bk(e.magenta,Mk[5]),t.ansi[6]=Bk(e.cyan,Mk[6]),t.ansi[7]=Bk(e.white,Mk[7]),t.ansi[8]=Bk(e.brightBlack,Mk[8]),t.ansi[9]=Bk(e.brightRed,Mk[9]),t.ansi[10]=Bk(e.brightGreen,Mk[10]),t.ansi[11]=Bk(e.brightYellow,Mk[11]),t.ansi[12]=Bk(e.brightBlue,Mk[12]),t.ansi[13]=Bk(e.brightMagenta,Mk[13]),t.ansi[14]=Bk(e.brightCyan,Mk[14]),t.ansi[15]=Bk(e.brightWhite,Mk[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]=Bk(e.extendedAnsi[r],Mk[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()}}};zk=OC([Z(0,sw)],zk);function Bk(e,t){if(e!==void 0)try{return oO.toColor(e)}catch{}return t}var Vk=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)}},Hk=class{constructor(){this._services=new Vk,this._services.set(aw,this)}setService(e,t){this._services.set(e,t)}getService(e){return this._services.get(e)}createInstance(e,...t){let n=QC(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)}},Uk={trace:0,debug:1,info:2,warn:3,error:4,off:5},Wk=`xterm.js: `,Gk=class extends Zw{constructor(e){super(),this._optionsService=e,this._logLevel=5,this._updateLogLevel(),this._register(this._optionsService.onSpecificOptionChange(`logLevel`,()=>this._updateLogLevel())),Kk=this}get logLevel(){return this._logLevel}_updateLogLevel(){this._logLevel=Uk[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?``:Wk)+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)}};Gk=OC([Z(0,sw)],Gk);var Kk,qk=class extends Zw{constructor(e){super(),this._maxLength=e,this.onDeleteEmitter=this._register(new Q),this.onDelete=this.onDeleteEmitter.event,this.onInsertEmitter=this._register(new Q),this.onInsert=this.onInsertEmitter.event,this.onTrimEmitter=this._register(new Q),this.onTrim=this.onTrimEmitter.event,this._array=Array(this._maxLength),this._startIndex=0,this._length=0}get maxLength(){return this._maxLength}set maxLength(e){if(this._maxLength===e)return;let t=Array(e);for(let n=0;n<Math.min(e,this.length);n++)t[n]=this._array[this._getCyclicIndex(n)];this._array=t,this._maxLength=e,this._startIndex=0}get length(){return this._length}set length(e){if(e>this._length)for(let t=this._length;t<e;t++)this._array[t]=void 0;this._length=e}get(e){return this._array[this._getCyclicIndex(e)]}set(e,t){this._array[this._getCyclicIndex(e)]=t}push(e){this._array[this._getCyclicIndex(this._length)]=e,this._length===this._maxLength?(this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1)):this._length++}recycle(){if(this._length!==this._maxLength)throw Error(`Can only recycle when the buffer is full`);return this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1),this._array[this._getCyclicIndex(this._length-1)]}get isFull(){return this._length===this._maxLength}pop(){return this._array[this._getCyclicIndex(this._length---1)]}splice(e,t,...n){if(t){for(let n=e;n<this._length-t;n++)this._array[this._getCyclicIndex(n)]=this._array[this._getCyclicIndex(n+t)];this._length-=t,this.onDeleteEmitter.fire({index:e,amount:t})}for(let t=this._length-1;t>=e;t--)this._array[this._getCyclicIndex(t+n.length)]=this._array[this._getCyclicIndex(t)];for(let t=0;t<n.length;t++)this._array[this._getCyclicIndex(e+t)]=n[t];if(n.length&&this.onInsertEmitter.fire({index:e,amount:n.length}),this._length+n.length>this._maxLength){let e=this._length+n.length-this._maxLength;this._startIndex+=e,this._length=this._maxLength,this.onTrimEmitter.fire(e)}else this._length+=n.length}trimStart(e){e>this._length&&(e=this._length),this._startIndex+=e,this._length-=e,this.onTrimEmitter.fire(e)}shiftElements(e,t,n){if(!(t<=0)){if(e<0||e>=this._length)throw Error(`start argument out of range`);if(e+n<0)throw Error(`Cannot shift elements in list beyond index 0`);if(n>0){for(let r=t-1;r>=0;r--)this.set(e+r+n,this.get(e+r));let r=e+t+n-this._length;if(r>0)for(this._length+=r;this._length>this._maxLength;)this._length--,this._startIndex++,this.onTrimEmitter.fire(1)}else for(let r=0;r<t;r++)this.set(e+r+n,this.get(e+r))}}_getCyclicIndex(e){return(this._startIndex+e)%this._maxLength}},Jk=3,Yk=Object.freeze(new KC),Xk=0,Zk=2,Qk=class e{constructor(e,t,n=!1){this.isWrapped=n,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(e*Jk);let r=t||JC.fromCharData([0,WC,1,0]);for(let t=0;t<e;++t)this.setCell(t,r);this.length=e}get(e){let t=this._data[e*Jk+0],n=t&2097151;return[this._data[e*Jk+1],t&2097152?this._combined[e]:n?BC(n):``,t>>22,t&2097152?this._combined[e].charCodeAt(this._combined[e].length-1):n]}set(e,t){this._data[e*Jk+1]=t[0],t[1].length>1?(this._combined[e]=t[1],this._data[e*Jk+0]=e|2097152|t[2]<<22):this._data[e*Jk+0]=t[1].charCodeAt(0)|t[2]<<22}getWidth(e){return this._data[e*Jk+0]>>22}hasWidth(e){return this._data[e*Jk+0]&12582912}getFg(e){return this._data[e*Jk+1]}getBg(e){return this._data[e*Jk+2]}hasContent(e){return this._data[e*Jk+0]&4194303}getCodePoint(e){let t=this._data[e*Jk+0];return t&2097152?this._combined[e].charCodeAt(this._combined[e].length-1):t&2097151}isCombined(e){return this._data[e*Jk+0]&2097152}getString(e){let t=this._data[e*Jk+0];return t&2097152?this._combined[e]:t&2097151?BC(t&2097151):``}isProtected(e){return this._data[e*Jk+2]&536870912}loadCell(e,t){return Xk=e*Jk,t.content=this._data[Xk+0],t.fg=this._data[Xk+1],t.bg=this._data[Xk+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*Jk+0]=t.content,this._data[e*Jk+1]=t.fg,this._data[e*Jk+2]=t.bg}setCellFromCodepoint(e,t,n,r){r.bg&268435456&&(this._extendedAttrs[e]=r.extended),this._data[e*Jk+0]=t|n<<22,this._data[e*Jk+1]=r.fg,this._data[e*Jk+2]=r.bg}addCodepointToCell(e,t,n){let r=this._data[e*Jk+0];r&2097152?this._combined[e]+=BC(t):r&2097151?(this._combined[e]=BC(r&2097151)+BC(t),r&=-2097152,r|=2097152):r=t|1<<22,n&&(r&=-12582913,r|=n<<22),this._data[e*Jk+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 JC;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 JC;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*Zk<this._data.buffer.byteLength;let n=e*Jk;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*Zk<this._data.buffer.byteLength}cleanupMemory(){if(this._data.length*4*Zk<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*Jk+0]&4194303)return e+(this._data[e*Jk+0]>>22);return 0}getNoBgTrimmedLength(){for(let e=this.length-1;e>=0;--e)if(this._data[e*Jk+0]&4194303||this._data[e*Jk+2]&50331648)return e+(this._data[e*Jk+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<Jk;e++)this._data[(n+i)*Jk+e]=a[(t+i)*Jk+e];a[(t+i)*Jk+2]&268435456&&(this._extendedAttrs[n+i]=e._extendedAttrs[t+i])}else for(let i=0;i<r;i++){for(let e=0;e<Jk;e++)this._data[(n+i)*Jk+e]=a[(t+i)*Jk+e];a[(t+i)*Jk+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*Jk+0],n=e&2097151,a=e&2097152?this._combined[t]:n?BC(n):GC;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 $k(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=rA(u,d,t),p=1,m=0;for(;p<u.length;){let e=rA(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 eA(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 tA(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 nA(e,t,n){let r=[],i=e.map((n,r)=>rA(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=rA(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 rA(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 iA=class e{constructor(t){this.line=t,this.isDisposed=!1,this._disposables=[],this._id=e._nextId++,this._onDispose=this.register(new Q),this.onDispose=this._onDispose.event}get id(){return this._id}dispose(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire(),Kw(this._disposables),this._disposables.length=0)}register(e){return this._disposables.push(e),e}};iA._nextId=1;var aA=iA,oA={},sA=oA.B;oA[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:`≥`,"{":`π`,"|":`≠`,"}":`£`,"~":`·`},oA.A={"#":`£`},oA.B=void 0,oA[4]={"#":`£`,"@":`¾`,"[":`ij`,"\\":`½`,"]":`|`,"{":`¨`,"|":`f`,"}":`¼`,"~":`´`},oA.C=oA[5]={"[":`Ä`,"\\":`Ö`,"]":`Å`,"^":`Ü`,"`":`é`,"{":`ä`,"|":`ö`,"}":`å`,"~":`ü`},oA.R={"#":`£`,"@":`à`,"[":`°`,"\\":`ç`,"]":`§`,"{":`é`,"|":`ù`,"}":`è`,"~":`¨`},oA.Q={"@":`à`,"[":`â`,"\\":`ç`,"]":`ê`,"^":`î`,"`":`ô`,"{":`é`,"|":`ù`,"}":`è`,"~":`û`},oA.K={"@":`§`,"[":`Ä`,"\\":`Ö`,"]":`Ü`,"{":`ä`,"|":`ö`,"}":`ü`,"~":`ß`},oA.Y={"#":`£`,"@":`§`,"[":`°`,"\\":`ç`,"]":`é`,"`":`ù`,"{":`à`,"|":`ò`,"}":`è`,"~":`ì`},oA.E=oA[6]={"@":`Ä`,"[":`Æ`,"\\":`Ø`,"]":`Å`,"^":`Ü`,"`":`ä`,"{":`æ`,"|":`ø`,"}":`å`,"~":`ü`},oA.Z={"#":`£`,"@":`§`,"[":`¡`,"\\":`Ñ`,"]":`¿`,"{":`°`,"|":`ñ`,"}":`ç`},oA.H=oA[7]={"@":`É`,"[":`Ä`,"\\":`Ö`,"]":`Å`,"^":`Ü`,"`":`é`,"{":`ä`,"|":`ö`,"}":`å`,"~":`ü`},oA[`=`]={"#":`ù`,"@":`à`,"[":`é`,"\\":`ç`,"]":`ê`,"^":`î`,_:`è`,"`":`ô`,"{":`ä`,"|":`ö`,"}":`ü`,"~":`û`};var cA=4294967295,lA=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=Yk.clone(),this.savedCharset=sA,this.markers=[],this._nullCell=JC.fromCharData([0,WC,1,0]),this._whitespaceCell=JC.fromCharData([0,GC,1,32]),this._isClearing=!1,this._memoryCleanupQueue=new ak,this._memoryCleanupPosition=0,this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new qk(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 qC),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 qC),this._whitespaceCell}getBlankLine(e,t){return new Qk(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>cA?cA:t}fillViewportRows(e){if(this.lines.length===0){e===void 0&&(e=Yk);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 qk(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(e,t){let n=this.getNullCell(Yk),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 Qk(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 Qk(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=$k(this.lines,this._cols,e,this.ybase+this.y,this.getNullCell(Yk),n);if(r.length>0){let n=eA(this.lines,r);tA(this.lines,n.layout),this._reflowLargerAdjustViewport(e,t,n.countRemoved)}}_reflowLargerAdjustViewport(e,t,n){let r=this.getNullCell(Yk),i=n;for(;i-->0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length<t&&this.lines.push(new Qk(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(Yk),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=nA(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(Yk,!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--,_=rA(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 aA(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)}},uA=class extends Zw{constructor(e,t){super(),this._optionsService=e,this._bufferService=t,this._onBufferActivate=this._register(new Q),this.onBufferActivate=this._onBufferActivate.event,this.reset(),this._register(this._optionsService.onSpecificOptionChange(`scrollback`,()=>this.resize(this._bufferService.cols,this._bufferService.rows))),this._register(this._optionsService.onSpecificOptionChange(`tabStopWidth`,()=>this.setupTabStops()))}reset(){this._normal=new lA(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new lA(!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)}},dA=2,fA=1,pA=class extends Zw{constructor(e){super(),this.isUserScrolling=!1,this._onResize=this._register(new Q),this.onResize=this._onResize.event,this._onScroll=this._register(new Q),this.onScroll=this._onScroll.event,this.cols=Math.max(e.rawOptions.cols||0,dA),this.rows=Math.max(e.rawOptions.rows||0,fA),this.buffers=this._register(new uA(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))}};pA=OC([Z(0,sw)],pA);var mA={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:XO,windowOptions:{},windowsMode:!1,windowsPty:{},wordSeparator:` ()[]{}',"\``,altClickMovesCursor:!0,convertEol:!1,termName:`xterm`,cancelEvents:!1,overviewRuler:{}},hA=[`normal`,`bold`,`100`,`200`,`300`,`400`,`500`,`600`,`700`,`800`,`900`],gA=class extends Zw{constructor(e){super(),this._onOptionChange=this._register(new Q),this.onOptionChange=this._onOptionChange.event;let t={...mA};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(Jw(()=>{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 mA))throw Error(`No option with key "${e}"`);return this.rawOptions[e]},t=(e,t)=>{if(!(e in mA))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||=mA[e],!_A(t))throw Error(`"${t}" is not a valid value for ${e}`);break;case`wordSeparator`:t||=mA[e];break;case`fontWeight`:case`fontWeightBold`:if(typeof t==`number`&&1<=t&&t<=1e3)break;t=hA.includes(t)?t:mA[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 _A(e){return e===`block`||e===`underline`||e===`bar`}function vA(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]&&vA(e[r],t-1);return n}var yA=Object.freeze({insertMode:!1}),bA=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,cursorBlink:void 0,cursorStyle:void 0,origin:!1,reverseWraparound:!1,sendFocus:!1,synchronizedOutput:!1,wraparound:!0}),xA=class extends Zw{constructor(e,t,n){super(),this._bufferService=e,this._logService=t,this._optionsService=n,this.isCursorInitialized=!1,this.isCursorHidden=!1,this._onData=this._register(new Q),this.onData=this._onData.event,this._onUserInput=this._register(new Q),this.onUserInput=this._onUserInput.event,this._onBinary=this._register(new Q),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this._register(new Q),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=vA(yA),this.decPrivateModes=vA(bA)}reset(){this.modes=vA(yA),this.decPrivateModes=vA(bA)}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))}};xA=OC([Z(0,tw),Z(1,ow),Z(2,sw)],xA);var SA={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 CA(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 wA=String.fromCharCode,TA={DEFAULT:e=>{let t=[CA(e,!1)+32,e.col+32,e.row+32];return t[0]>255||t[1]>255||t[2]>255?``:`\x1B[M${wA(t[0])}${wA(t[1])}${wA(t[2])}`},SGR:e=>{let t=e.action===0&&e.button!==4?`m`:`M`;return`\x1B[<${CA(e,!0)};${e.col};${e.row}${t}`},SGR_PIXELS:e=>{let t=e.action===0&&e.button!==4?`m`:`M`;return`\x1B[<${CA(e,!0)};${e.x};${e.y}${t}`}},EA=class extends Zw{constructor(e,t,n){super(),this._bufferService=e,this._coreService=t,this._optionsService=n,this._protocols={},this._encodings={},this._activeProtocol=``,this._activeEncoding=``,this._lastEvent=null,this._wheelPartialScroll=0,this._onProtocolChange=this._register(new Q),this.onProtocolChange=this._onProtocolChange.event;for(let e of Object.keys(SA))this.addProtocol(e,SA[e]);for(let e of Object.keys(TA))this.addEncoding(e,TA[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)}};EA=OC([Z(0,tw),Z(1,rw),Z(2,sw)],EA);var DA=[[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]],OA=[[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]],kA;function AA(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 jA=class{constructor(){if(this.version=`6`,!kA){kA=new Uint8Array(65536),kA.fill(1),kA[0]=0,kA.fill(0,1,32),kA.fill(0,127,160),kA.fill(2,4352,4448),kA[9001]=2,kA[9002]=2,kA.fill(2,11904,42192),kA[12351]=1,kA.fill(2,44032,55204),kA.fill(2,63744,64256),kA.fill(2,65040,65050),kA.fill(2,65072,65136),kA.fill(2,65280,65377),kA.fill(2,65504,65511);for(let e=0;e<DA.length;++e)kA.fill(0,DA[e][0],DA[e][1]+1)}}wcwidth(e){return e<32?0:e<127?1:e<65536?kA[e]:AA(e,OA)?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=MA.extractWidth(t);e===0?r=!1:e>n&&(n=e)}return MA.createPropertyValue(0,n,r)}},MA=class e{constructor(){this._providers=Object.create(null),this._active=``,this._onChange=new Q,this.onChange=this._onChange.event;let e=new jA;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)}},NA=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 PA(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 FA=2147483647,IA=256,LA=class e{constructor(e=32,t=32){if(this.maxLength=e,this.maxSubParamsLength=t,t>IA)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>FA?FA: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>FA?FA: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,FA):e}},RA=[],zA=class{constructor(){this._state=0,this._active=RA,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=RA}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=RA,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||RA,!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`,VC(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=RA,this._id=-1,this._state=0}}},BA=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+=VC(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}},VA=[],HA=class{constructor(){this._handlers=Object.create(null),this._active=VA,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=VA}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=VA,this._ident=0}hook(e,t){if(this.reset(),this._ident=e,this._active=this._handlers[e]||VA,!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`,VC(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=VA,this._ident=0}},UA=new LA;UA.addParam(0);var WA=class{constructor(e){this._handler=e,this._data=``,this._params=UA,this._hitLimit=!1}hook(e){this._params=e.length>1||e.params[0]?e.clone():UA,this._data=``,this._hitLimit=!1}put(e,t,n){this._hitLimit||(this._data+=VC(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=UA,this._data=``,this._hitLimit=!1,e));return this._params=UA,this._data=``,this._hitLimit=!1,t}},GA=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}},KA=160,qA=function(){let e=new GA(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(KA,0,2,0),e.add(KA,8,5,8),e.add(KA,6,0,6),e.add(KA,11,0,11),e.add(KA,13,13,13),e}(),JA=class extends Zw{constructor(e=qA){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 LA,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(Jw(()=>{this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null)})),this._oscParser=this._register(new zA),this._dcsParser=this._register(new HA),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:KA)],i>>4){case 2:for(let i=n+1;;++i){if(i>=t||(r=e[i])<32||r>126&&r<KA){this._printHandler(e,n,i),n=i-1;break}if(++i>=t||(r=e[i])<32||r>126&&r<KA){this._printHandler(e,n,i),n=i-1;break}if(++i>=t||(r=e[i])<32||r>126&&r<KA){this._printHandler(e,n,i),n=i-1;break}if(++i>=t||(r=e[i])<32||r>126&&r<KA){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<KA){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<KA){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}}},YA=/^([\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})$/,XA=/^[\da-f]+$/;function ZA(e){if(!e)return;let t=e.toLowerCase();if(t.indexOf(`rgb:`)===0){t=t.slice(4);let e=YA.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),XA.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 QA(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 $A(e,t=16){let[n,r,i]=e;return`rgb:${QA(n,t)}/${QA(r,t)}/${QA(i,t)}`}var ej={"(":0,")":1,"*":2,"+":3,"-":1,".":2},tj=131072,nj=10;function rj(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 ij=5e3,aj=0,oj=class extends Zw{constructor(e,t,n,r,i,a,o,s,c=new JA){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 HC,this._utf8Decoder=new UC,this._windowTitle=``,this._iconName=``,this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=Yk.clone(),this._eraseAttrDataInternal=Yk.clone(),this._onRequestBell=this._register(new Q),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this._register(new Q),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this._register(new Q),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this._register(new Q),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this._register(new Q),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this._register(new Q),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this._register(new Q),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this._register(new Q),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this._register(new Q),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this._register(new Q),this.onLineFeed=this._onLineFeed.event,this._onScroll=this._register(new Q),this.onScroll=this._onScroll.event,this._onTitleChange=this._register(new Q),this.onTitleChange=this._onTitleChange.event,this._onColor=this._register(new Q),this.onColor=this._onColor.event,this._parseStack={paused:!1,cursorStartX:0,cursorStartY:0,decodedLength:0,position:0},this._specialColors=[256,257,258],this._register(this._parser),this._dirtyRowTracker=new sj(this._bufferService),this._activeBuffer=this._bufferService.buffer,this._register(this._bufferService.buffers.onBufferActivate(e=>this._activeBuffer=e.activeBuffer)),this._parser.setCsiHandlerFallback((e,t)=>{this._logService.debug(`Unknown CSI code: `,{identifier:this._parser.identToString(e),params:t.toArray()})}),this._parser.setEscHandlerFallback(e=>{this._logService.debug(`Unknown ESC code: `,{identifier:this._parser.identToString(e)})}),this._parser.setExecuteHandlerFallback(e=>{this._logService.debug(`Unknown EXECUTE code: `,{code:e})}),this._parser.setOscHandlerFallback((e,t,n)=>{this._logService.debug(`Unknown OSC code: `,{identifier:e,action:t,data:n})}),this._parser.setDcsHandlerFallback((e,t,n)=>{t===`HOOK`&&(n=n.toArray()),this._logService.debug(`Unknown DCS code: `,{identifier:this._parser.identToString(e),action:t,payload:n})}),this._parser.setPrintHandler((e,t,n)=>this.print(e,t,n)),this._parser.registerCsiHandler({final:`@`},e=>this.insertChars(e)),this._parser.registerCsiHandler({intermediates:` `,final:`@`},e=>this.scrollLeft(e)),this._parser.registerCsiHandler({final:`A`},e=>this.cursorUp(e)),this._parser.registerCsiHandler({intermediates:` `,final:`A`},e=>this.scrollRight(e)),this._parser.registerCsiHandler({final:`B`},e=>this.cursorDown(e)),this._parser.registerCsiHandler({final:`C`},e=>this.cursorForward(e)),this._parser.registerCsiHandler({final:`D`},e=>this.cursorBackward(e)),this._parser.registerCsiHandler({final:`E`},e=>this.cursorNextLine(e)),this._parser.registerCsiHandler({final:`F`},e=>this.cursorPrecedingLine(e)),this._parser.registerCsiHandler({final:`G`},e=>this.cursorCharAbsolute(e)),this._parser.registerCsiHandler({final:`H`},e=>this.cursorPosition(e)),this._parser.registerCsiHandler({final:`I`},e=>this.cursorForwardTab(e)),this._parser.registerCsiHandler({final:`J`},e=>this.eraseInDisplay(e,!1)),this._parser.registerCsiHandler({prefix:`?`,final:`J`},e=>this.eraseInDisplay(e,!0)),this._parser.registerCsiHandler({final:`K`},e=>this.eraseInLine(e,!1)),this._parser.registerCsiHandler({prefix:`?`,final:`K`},e=>this.eraseInLine(e,!0)),this._parser.registerCsiHandler({final:`L`},e=>this.insertLines(e)),this._parser.registerCsiHandler({final:`M`},e=>this.deleteLines(e)),this._parser.registerCsiHandler({final:`P`},e=>this.deleteChars(e)),this._parser.registerCsiHandler({final:`S`},e=>this.scrollUp(e)),this._parser.registerCsiHandler({final:`T`},e=>this.scrollDown(e)),this._parser.registerCsiHandler({final:`X`},e=>this.eraseChars(e)),this._parser.registerCsiHandler({final:`Z`},e=>this.cursorBackwardTab(e)),this._parser.registerCsiHandler({final:"`"},e=>this.charPosAbsolute(e)),this._parser.registerCsiHandler({final:`a`},e=>this.hPositionRelative(e)),this._parser.registerCsiHandler({final:`b`},e=>this.repeatPrecedingCharacter(e)),this._parser.registerCsiHandler({final:`c`},e=>this.sendDeviceAttributesPrimary(e)),this._parser.registerCsiHandler({prefix:`>`,final:`c`},e=>this.sendDeviceAttributesSecondary(e)),this._parser.registerCsiHandler({final:`d`},e=>this.linePosAbsolute(e)),this._parser.registerCsiHandler({final:`e`},e=>this.vPositionRelative(e)),this._parser.registerCsiHandler({final:`f`},e=>this.hVPosition(e)),this._parser.registerCsiHandler({final:`g`},e=>this.tabClear(e)),this._parser.registerCsiHandler({final:`h`},e=>this.setMode(e)),this._parser.registerCsiHandler({prefix:`?`,final:`h`},e=>this.setModePrivate(e)),this._parser.registerCsiHandler({final:`l`},e=>this.resetMode(e)),this._parser.registerCsiHandler({prefix:`?`,final:`l`},e=>this.resetModePrivate(e)),this._parser.registerCsiHandler({final:`m`},e=>this.charAttributes(e)),this._parser.registerCsiHandler({final:`n`},e=>this.deviceStatus(e)),this._parser.registerCsiHandler({prefix:`?`,final:`n`},e=>this.deviceStatusPrivate(e)),this._parser.registerCsiHandler({intermediates:`!`,final:`p`},e=>this.softReset(e)),this._parser.registerCsiHandler({intermediates:` `,final:`q`},e=>this.setCursorStyle(e)),this._parser.registerCsiHandler({final:`r`},e=>this.setScrollRegion(e)),this._parser.registerCsiHandler({final:`s`},e=>this.saveCursor(e)),this._parser.registerCsiHandler({final:`t`},e=>this.windowOptions(e)),this._parser.registerCsiHandler({final:`u`},e=>this.restoreCursor(e)),this._parser.registerCsiHandler({intermediates:`'`,final:`}`},e=>this.insertColumns(e)),this._parser.registerCsiHandler({intermediates:`'`,final:`~`},e=>this.deleteColumns(e)),this._parser.registerCsiHandler({intermediates:`"`,final:`q`},e=>this.selectProtected(e)),this._parser.registerCsiHandler({intermediates:`$`,final:`p`},e=>this.requestMode(e,!0)),this._parser.registerCsiHandler({prefix:`?`,intermediates:`$`,final:`p`},e=>this.requestMode(e,!1)),this._parser.setExecuteHandler($.BEL,()=>this.bell()),this._parser.setExecuteHandler($.LF,()=>this.lineFeed()),this._parser.setExecuteHandler($.VT,()=>this.lineFeed()),this._parser.setExecuteHandler($.FF,()=>this.lineFeed()),this._parser.setExecuteHandler($.CR,()=>this.carriageReturn()),this._parser.setExecuteHandler($.BS,()=>this.backspace()),this._parser.setExecuteHandler($.HT,()=>this.tab()),this._parser.setExecuteHandler($.SO,()=>this.shiftOut()),this._parser.setExecuteHandler($.SI,()=>this.shiftIn()),this._parser.setExecuteHandler(XD.IND,()=>this.index()),this._parser.setExecuteHandler(XD.NEL,()=>this.nextLine()),this._parser.setExecuteHandler(XD.HTS,()=>this.tabSet()),this._parser.registerOscHandler(0,new BA(e=>(this.setTitle(e),this.setIconName(e),!0))),this._parser.registerOscHandler(1,new BA(e=>this.setIconName(e))),this._parser.registerOscHandler(2,new BA(e=>this.setTitle(e))),this._parser.registerOscHandler(4,new BA(e=>this.setOrReportIndexedColor(e))),this._parser.registerOscHandler(8,new BA(e=>this.setHyperlink(e))),this._parser.registerOscHandler(10,new BA(e=>this.setOrReportFgColor(e))),this._parser.registerOscHandler(11,new BA(e=>this.setOrReportBgColor(e))),this._parser.registerOscHandler(12,new BA(e=>this.setOrReportCursorColor(e))),this._parser.registerOscHandler(104,new BA(e=>this.restoreIndexedColor(e))),this._parser.registerOscHandler(110,new BA(e=>this.restoreFgColor(e))),this._parser.registerOscHandler(111,new BA(e=>this.restoreBgColor(e))),this._parser.registerOscHandler(112,new BA(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 oA)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 WA((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`),ij))]).catch(e=>{if(e!==`#SLOW_TIMEOUT`)throw e;console.warn(`async parser handler taking longer than ${ij} 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>tj&&(a=this._parseStack.position+tj)}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<tj&&(this._parseBuffer=new Uint32Array(Math.min(e.length,tj))),o||this._dirtyRowTracker.clearRange(),e.length>tj)for(let t=a;t<e.length;t+=tj){let a=t+tj<e.length?t+tj: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=MA.extractWidth(t);let n=MA.extractShouldJoin(t),m=n?MA.extractWidth(f):0;if(f=t,o&&this._onA11yChar.fire(BC(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 Qk&&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=>!rj(e.params[0],this._optionsService.rawOptions.windowOptions)||t(e)):this._parser.registerCsiHandler(e,t)}registerDcsHandler(e,t){return this._parser.registerDcsHandler(e,new WA(t))}registerEscHandler(e,t){return this._parser.registerEscHandler(e,t)}registerOscHandler(e,t){return this._parser.registerOscHandler(e,new BA(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(Yk));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=MA.extractWidth(t),i=this._activeBuffer.x-r,a=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).getString(i),o=new Uint32Array(a.length*n),s=0;for(let e=0;e<a.length;){let t=a.codePointAt(e)||0;o[s++]=t,e+=t>65535?2:1}let c=s;for(let e=1;e<n;++e)o.copyWithin(c,0,s),c+=s;return this.print(o,0,c),!0}sendDeviceAttributesPrimary(e){return e.params[0]>0||(this._is(`xterm`)||this._is(`rxvt-unicode`)||this._is(`screen`)?this._coreService.triggerDataEvent($.ESC+`[?1;2c`):this._is(`linux`)&&this._coreService.triggerDataEvent($.ESC+`[?6c`)),!0}sendDeviceAttributesSecondary(e){return e.params[0]>0||(this._is(`xterm`)?this._coreService.triggerDataEvent($.ESC+`[>0;276;0c`):this._is(`rxvt-unicode`)?this._coreService.triggerDataEvent($.ESC+`[>85;95;0c`):this._is(`linux`)?this._coreService.triggerDataEvent(e.params[0]+`c`):this._is(`screen`)&&this._coreService.triggerDataEvent($.ESC+`[>83;40003;0c`)),!0}_is(e){return(this._optionsService.rawOptions.termName+``).indexOf(e)===0}setMode(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 4:this._coreService.modes.insertMode=!0;break;case 20:this._optionsService.options.convertEol=!0;break}return!0}setModePrivate(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!0;break;case 2:this._charsetService.setgCharset(0,sA),this._charsetService.setgCharset(1,sA),this._charsetService.setgCharset(2,sA),this._charsetService.setgCharset(3,sA);break;case 3:this._optionsService.rawOptions.windowOptions.setWinLines&&(this._bufferService.resize(132,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!0,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!0;break;case 12:this._optionsService.options.cursorBlink=!0;break;case 45:this._coreService.decPrivateModes.reverseWraparound=!0;break;case 66:this._logService.debug(`Serial port requested application keypad.`),this._coreService.decPrivateModes.applicationKeypad=!0,this._onRequestSyncScrollBar.fire();break;case 9:this._coreMouseService.activeProtocol=`X10`;break;case 1e3:this._coreMouseService.activeProtocol=`VT200`;break;case 1002:this._coreMouseService.activeProtocol=`DRAG`;break;case 1003:this._coreMouseService.activeProtocol=`ANY`;break;case 1004:this._coreService.decPrivateModes.sendFocus=!0,this._onRequestSendFocus.fire();break;case 1005:this._logService.debug(`DECSET 1005 not supported (see #2507)`);break;case 1006:this._coreMouseService.activeEncoding=`SGR`;break;case 1015:this._logService.debug(`DECSET 1015 not supported (see #2507)`);break;case 1016:this._coreMouseService.activeEncoding=`SGR_PIXELS`;break;case 25:this._coreService.isCursorHidden=!1;break;case 1048:this.saveCursor();break;case 1049:this.saveCursor();case 47:case 1047:this._bufferService.buffers.activateAltBuffer(this._eraseAttrData()),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(void 0),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!0;break;case 2026:this._coreService.decPrivateModes.synchronizedOutput=!0;break}return!0}resetMode(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 4:this._coreService.modes.insertMode=!1;break;case 20:this._optionsService.options.convertEol=!1;break}return!0}resetModePrivate(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!1;break;case 3:this._optionsService.rawOptions.windowOptions.setWinLines&&(this._bufferService.resize(80,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!1,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!1;break;case 12:this._optionsService.options.cursorBlink=!1;break;case 45:this._coreService.decPrivateModes.reverseWraparound=!1;break;case 66:this._logService.debug(`Switching back to normal keypad.`),this._coreService.decPrivateModes.applicationKeypad=!1,this._onRequestSyncScrollBar.fire();break;case 9:case 1e3:case 1002:case 1003:this._coreMouseService.activeProtocol=`NONE`;break;case 1004:this._coreService.decPrivateModes.sendFocus=!1;break;case 1005:this._logService.debug(`DECRST 1005 not supported (see #2507)`);break;case 1006:this._coreMouseService.activeEncoding=`DEFAULT`;break;case 1015:this._logService.debug(`DECRST 1015 not supported (see #2507)`);break;case 1016:this._coreMouseService.activeEncoding=`DEFAULT`;break;case 25:this._coreService.isCursorHidden=!0;break;case 1048:this.restoreCursor();break;case 1049:case 47:case 1047:this._bufferService.buffers.activateNormalBuffer(),e.params[t]===1049&&this.restoreCursor(),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(void 0),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!1;break;case 2026:this._coreService.decPrivateModes.synchronizedOutput=!1,this._onRequestRefreshRows.fire(void 0);break}return!0}requestMode(e,t){let n;(e=>(e[e.NOT_RECOGNIZED=0]=`NOT_RECOGNIZED`,e[e.SET=1]=`SET`,e[e.RESET=2]=`RESET`,e[e.PERMANENTLY_SET=3]=`PERMANENTLY_SET`,e[e.PERMANENTLY_RESET=4]=`PERMANENTLY_RESET`))(n||={});let r=this._coreService.decPrivateModes,{activeProtocol:i,activeEncoding:a}=this._coreMouseService,o=this._coreService,{buffers:s,cols:c}=this._bufferService,{active:l,alt:u}=s,d=this._optionsService.rawOptions,f=(e,n)=>(o.triggerDataEvent(`${$.ESC}[${t?``:`?`}${e};${n}$y`),!0),p=e=>e?1:2,m=e.params[0];return t?m===2?f(m,4):m===4?f(m,p(o.modes.insertMode)):m===12?f(m,3):m===20?f(m,p(d.convertEol)):f(m,0):m===1?f(m,p(r.applicationCursorKeys)):m===3?f(m,d.windowOptions.setWinLines?c===80?2:+(c===132):0):m===6?f(m,p(r.origin)):m===7?f(m,p(r.wraparound)):m===8?f(m,3):m===9?f(m,p(i===`X10`)):m===12?f(m,p(d.cursorBlink)):m===25?f(m,p(!o.isCursorHidden)):m===45?f(m,p(r.reverseWraparound)):m===66?f(m,p(r.applicationKeypad)):m===67?f(m,4):m===1e3?f(m,p(i===`VT200`)):m===1002?f(m,p(i===`DRAG`)):m===1003?f(m,p(i===`ANY`)):m===1004?f(m,p(r.sendFocus)):m===1005?f(m,4):m===1006?f(m,p(a===`SGR`)):m===1015?f(m,4):m===1016?f(m,p(a===`SGR_PIXELS`)):m===1048?f(m,1):m===47||m===1047||m===1049?f(m,p(l===u)):m===2004?f(m,p(r.bracketedPasteMode)):m===2026?f(m,p(r.synchronizedOutput)):f(m,0)}_updateAttrColor(e,t,n,r,i){return t===2?(e|=50331648,e&=-16777216,e|=KC.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=Yk.fg,e.bg=Yk.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|=Yk.fg&16777215):n===49?(r.bg&=-67108864,r.bg|=Yk.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|=Yk.fg&16777215,r.bg&=-67108864,r.bg|=Yk.bg&16777215):this._logService.debug(`Unknown SGR attribute: %d.`,n);return!0}deviceStatus(e){switch(e.params[0]){case 5:this._coreService.triggerDataEvent(`${$.ESC}[0n`);break;case 6:let e=this._activeBuffer.y+1,t=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${$.ESC}[${e};${t}R`);break}return!0}deviceStatusPrivate(e){switch(e.params[0]){case 6:let e=this._activeBuffer.y+1,t=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${$.ESC}[?${e};${t}R`);break;case 15:break;case 25:break;case 26:break;case 53:break}return!0}softReset(e){return this._coreService.isCursorHidden=!1,this._onRequestSyncScrollBar.fire(),this._activeBuffer.scrollTop=0,this._activeBuffer.scrollBottom=this._bufferService.rows-1,this._curAttrData=Yk.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(!rj(e.params[0],this._optionsService.rawOptions.windowOptions))return!0;let t=e.length>1?e.params[1]:0;switch(e.params[0]){case 14:t!==2&&this._onRequestWindowsOptionsReport.fire(0);break;case 16:this._onRequestWindowsOptionsReport.fire(1);break;case 18:this._bufferService&&this._coreService.triggerDataEvent(`${$.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);break;case 22:(t===0||t===2)&&(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>nj&&this._windowTitleStack.shift()),(t===0||t===1)&&(this._iconNameStack.push(this._iconName),this._iconNameStack.length>nj&&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(cj(n))if(r===`?`)t.push({type:0,index:n});else{let e=ZA(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=ZA(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]);cj(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,sA),!0}selectCharset(e){return e.length===2?(e[0]===`/`||this._charsetService.setgCharset(ej[e[0]],oA[e[1]]||sA),!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=Yk.clone(),this._eraseAttrDataInternal=Yk.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 JC;e.content=4194373,e.fg=this._curAttrData.fg,e.bg=this._curAttrData.bg,this._setCursor(0,0);for(let t=0;t<this._bufferService.rows;++t){let n=this._activeBuffer.ybase+this._activeBuffer.y+t,r=this._activeBuffer.lines.get(n);r&&(r.fill(e),r.isWrapped=!1)}return this._dirtyRowTracker.markAllDirty(),this._setCursor(0,0),!0}requestStatusString(e,t){let n=e=>(this._coreService.triggerDataEvent(`${$.ESC}${e}${$.ESC}\\`),!0),r=this._bufferService.buffer,i=this._optionsService.rawOptions;return n(e===`"q`?`P1$r${+!!this._curAttrData.isProtected()}"q`:e===`"p`?`P1$r61;1"p`:e===`r`?`P1$r${r.scrollTop+1};${r.scrollBottom+1}r`:e===`m`?`P1$r0m`:e===` q`?`P1$r${{block:2,underline:4,bar:6}[i.cursorStyle]-+!!i.cursorBlink} q`:`P0$r`)}markRangeDirty(e,t){this._dirtyRowTracker.markRangeDirty(e,t)}},sj=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&&(aj=e,e=t,t=aj),e<this.start&&(this.start=e),t>this.end&&(this.end=t)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};sj=OC([Z(0,tw)],sj);function cj(e){return 0<=e&&e<256}var lj=5e7,uj=12,dj=50,fj=class extends Zw{constructor(e){super(),this._action=e,this._writeBuffer=[],this._callbacks=[],this._pendingData=0,this._bufferOffset=0,this._isSyncWriting=!1,this._syncCalls=0,this._didUserInput=!1,this._onWriteParsed=this._register(new Q),this.onWriteParsed=this._onWriteParsed.event}handleUserInput(){this._didUserInput=!0}writeSync(e,t){if(t!==void 0&&this._syncCalls>t){this._syncCalls=0;return}if(this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(void 0),this._syncCalls++,this._isSyncWriting)return;this._isSyncWriting=!0;let n;for(;n=this._writeBuffer.shift();){this._action(n);let e=this._callbacks.shift();e&&e()}this._pendingData=0,this._bufferOffset=2147483647,this._isSyncWriting=!1,this._syncCalls=0}write(e,t){if(this._pendingData>lj)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>=uj?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>=uj)break}this._writeBuffer.length>this._bufferOffset?(this._bufferOffset>dj&&(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()}},pj=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)))}};pj=OC([Z(0,tw)],pj);var mj=!1,hj=class extends Zw{constructor(e){super(),this._windowsWrappingHeuristics=this._register(new Qw),this._onBinary=this._register(new Q),this.onBinary=this._onBinary.event,this._onData=this._register(new Q),this.onData=this._onData.event,this._onLineFeed=this._register(new Q),this.onLineFeed=this._onLineFeed.event,this._onResize=this._register(new Q),this.onResize=this._onResize.event,this._onWriteParsed=this._register(new Q),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this._register(new Q),this._instantiationService=new Hk,this.optionsService=this._register(new gA(e)),this._instantiationService.setService(sw,this.optionsService),this._bufferService=this._register(this._instantiationService.createInstance(pA)),this._instantiationService.setService(tw,this._bufferService),this._logService=this._register(this._instantiationService.createInstance(Gk)),this._instantiationService.setService(ow,this._logService),this.coreService=this._register(this._instantiationService.createInstance(xA)),this._instantiationService.setService(rw,this.coreService),this.coreMouseService=this._register(this._instantiationService.createInstance(EA)),this._instantiationService.setService(nw,this.coreMouseService),this.unicodeService=this._register(this._instantiationService.createInstance(MA)),this._instantiationService.setService(lw,this.unicodeService),this._charsetService=this._instantiationService.createInstance(NA),this._instantiationService.setService(iw,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(pj),this._instantiationService.setService(cw,this._oscLinkService),this._inputHandler=this._register(new oj(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService)),this._register(aT.forward(this._inputHandler.onLineFeed,this._onLineFeed)),this._register(this._inputHandler),this._register(aT.forward(this._bufferService.onResize,this._onResize)),this._register(aT.forward(this.coreService.onData,this._onData)),this._register(aT.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 fj((e,t)=>this._inputHandler.parse(e,t))),this._register(aT.forward(this._writeBuffer.onWriteParsed,this._onWriteParsed))}get onScroll(){return this._onScrollApi||(this._onScrollApi=this._register(new Q),this._onScroll.event(e=>{this._onScrollApi?.fire(e.position)})),this._onScrollApi.event}get cols(){return this._bufferService.cols}get rows(){return this._bufferService.rows}get buffers(){return this._bufferService.buffers}get options(){return this.optionsService.options}set options(e){for(let t in e)this.optionsService.options[t]=e[t]}write(e,t){this._writeBuffer.write(e,t)}writeSync(e,t){this._logService.logLevel<=3&&!mj&&(this._logService.warn(`writeSync is unreliable and will be removed soon.`),mj=!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,dA),t=Math.max(t,fA),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(PA.bind(null,this._bufferService))),e.push(this.registerCsiHandler({final:`H`},()=>(PA(this._bufferService),!1))),this._windowsWrappingHeuristics.value=Jw(()=>{for(let t of e)t.dispose()})}}},gj={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 _j(e,t,n,r){let i={type:0,cancel:!1,key:void 0},a=!!e.shiftKey|(e.altKey?2:0)|(e.ctrlKey?4:0)|(e.metaKey?8:0);switch(e.keyCode){case 0:e.key===`UIKeyInputUpArrow`?t?i.key=$.ESC+`OA`:i.key=$.ESC+`[A`:e.key===`UIKeyInputLeftArrow`?t?i.key=$.ESC+`OD`:i.key=$.ESC+`[D`:e.key===`UIKeyInputRightArrow`?t?i.key=$.ESC+`OC`:i.key=$.ESC+`[C`:e.key===`UIKeyInputDownArrow`&&(t?i.key=$.ESC+`OB`:i.key=$.ESC+`[B`);break;case 8:i.key=e.ctrlKey?`\b`:$.DEL,e.altKey&&(i.key=$.ESC+i.key);break;case 9:if(e.shiftKey){i.key=$.ESC+`[Z`;break}i.key=$.HT,i.cancel=!0;break;case 13:i.key=e.altKey?$.ESC+$.CR:$.CR,i.cancel=!0;break;case 27:i.key=$.ESC,e.altKey&&(i.key=$.ESC+$.ESC),i.cancel=!0;break;case 37:if(e.metaKey)break;a?i.key=$.ESC+`[1;`+(a+1)+`D`:t?i.key=$.ESC+`OD`:i.key=$.ESC+`[D`;break;case 39:if(e.metaKey)break;a?i.key=$.ESC+`[1;`+(a+1)+`C`:t?i.key=$.ESC+`OC`:i.key=$.ESC+`[C`;break;case 38:if(e.metaKey)break;a?i.key=$.ESC+`[1;`+(a+1)+`A`:t?i.key=$.ESC+`OA`:i.key=$.ESC+`[A`;break;case 40:if(e.metaKey)break;a?i.key=$.ESC+`[1;`+(a+1)+`B`:t?i.key=$.ESC+`OB`:i.key=$.ESC+`[B`;break;case 45:!e.shiftKey&&!e.ctrlKey&&(i.key=$.ESC+`[2~`);break;case 46:a?i.key=$.ESC+`[3;`+(a+1)+`~`:i.key=$.ESC+`[3~`;break;case 36:a?i.key=$.ESC+`[1;`+(a+1)+`H`:t?i.key=$.ESC+`OH`:i.key=$.ESC+`[H`;break;case 35:a?i.key=$.ESC+`[1;`+(a+1)+`F`:t?i.key=$.ESC+`OF`:i.key=$.ESC+`[F`;break;case 33:e.shiftKey?i.type=2:e.ctrlKey?i.key=$.ESC+`[5;`+(a+1)+`~`:i.key=$.ESC+`[5~`;break;case 34:e.shiftKey?i.type=3:e.ctrlKey?i.key=$.ESC+`[6;`+(a+1)+`~`:i.key=$.ESC+`[6~`;break;case 112:a?i.key=$.ESC+`[1;`+(a+1)+`P`:i.key=$.ESC+`OP`;break;case 113:a?i.key=$.ESC+`[1;`+(a+1)+`Q`:i.key=$.ESC+`OQ`;break;case 114:a?i.key=$.ESC+`[1;`+(a+1)+`R`:i.key=$.ESC+`OR`;break;case 115:a?i.key=$.ESC+`[1;`+(a+1)+`S`:i.key=$.ESC+`OS`;break;case 116:a?i.key=$.ESC+`[15;`+(a+1)+`~`:i.key=$.ESC+`[15~`;break;case 117:a?i.key=$.ESC+`[17;`+(a+1)+`~`:i.key=$.ESC+`[17~`;break;case 118:a?i.key=$.ESC+`[18;`+(a+1)+`~`:i.key=$.ESC+`[18~`;break;case 119:a?i.key=$.ESC+`[19;`+(a+1)+`~`:i.key=$.ESC+`[19~`;break;case 120:a?i.key=$.ESC+`[20;`+(a+1)+`~`:i.key=$.ESC+`[20~`;break;case 121:a?i.key=$.ESC+`[21;`+(a+1)+`~`:i.key=$.ESC+`[21~`;break;case 122:a?i.key=$.ESC+`[23;`+(a+1)+`~`:i.key=$.ESC+`[23~`;break;case 123:a?i.key=$.ESC+`[24;`+(a+1)+`~`:i.key=$.ESC+`[24~`;break;default:if(e.ctrlKey&&!e.shiftKey&&!e.altKey&&!e.metaKey)e.keyCode>=65&&e.keyCode<=90?i.key=String.fromCharCode(e.keyCode-64):e.keyCode===32?i.key=$.NUL:e.keyCode>=51&&e.keyCode<=55?i.key=String.fromCharCode(e.keyCode-51+27):e.keyCode===56?i.key=$.DEL:e.keyCode===219?i.key=$.ESC:e.keyCode===220?i.key=$.FS:e.keyCode===221&&(i.key=$.GS);else if((!n||r)&&e.altKey&&!e.metaKey){let t=gj[e.keyCode]?.[+!!e.shiftKey];if(t)i.key=$.ESC+t;else if(e.keyCode>=65&&e.keyCode<=90){let t=e.ctrlKey?e.keyCode-64:e.keyCode+32,n=String.fromCharCode(t);e.shiftKey&&(n=n.toUpperCase()),i.key=$.ESC+n}else if(e.keyCode===32)i.key=$.ESC+(e.ctrlKey?$.NUL:` `);else if(e.key===`Dead`&&e.code.startsWith(`Key`)){let t=e.code.slice(3,4);e.shiftKey||(t=t.toLowerCase()),i.key=$.ESC+t,i.cancel=!0}}else n&&!e.altKey&&!e.ctrlKey&&!e.shiftKey&&e.metaKey?e.keyCode===65&&(i.type=1):e.key&&!e.ctrlKey&&!e.altKey&&!e.metaKey&&e.keyCode>=48&&e.key.length===1?i.key=e.key:e.key&&e.ctrlKey&&(e.key===`_`&&(i.key=$.US),e.key===`@`&&(i.key=$.NUL));break}return i}var vj=0,yj=class{constructor(e){this._getKey=e,this._array=[],this._insertedValues=[],this._flushInsertedTask=new ak,this._isFlushingInserted=!1,this._deletedIndices=[],this._flushDeletedTask=new ak,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||(vj=this._search(t),vj===-1)||this._getKey(this._array[vj])!==t)return!1;do if(this._array[vj]===e)return this._deletedIndices.length===0&&this._flushDeletedTask.enqueue(()=>this._flushDeleted()),this._deletedIndices.push(vj),!0;while(++vj<this._array.length&&this._getKey(this._array[vj])===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&&(vj=this._search(e),!(vj<0||vj>=this._array.length)&&this._getKey(this._array[vj])===e))do yield this._array[vj];while(++vj<this._array.length&&this._getKey(this._array[vj])===e)}forEachByKey(e,t){if(this._flushCleanupInserted(),this._flushCleanupDeleted(),this._array.length!==0&&(vj=this._search(e),!(vj<0||vj>=this._array.length)&&this._getKey(this._array[vj])===e))do t(this._array[vj]);while(++vj<this._array.length&&this._getKey(this._array[vj])===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}},bj=0,xj=0,Sj=class extends Zw{constructor(){super(),this._decorations=new yj(e=>e?.marker.line),this._onDecorationRegistered=this._register(new Q),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this._register(new Q),this.onDecorationRemoved=this._onDecorationRemoved.event,this._register(Jw(()=>this.reset()))}get decorations(){return this._decorations.values()}registerDecoration(e){if(e.marker.isDisposed)return;let t=new Cj(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=>{bj=t.options.x??0,xj=bj+(t.options.width??1),e>=bj&&e<xj&&(!n||(t.options.layer??`bottom`)===n)&&r(t)})}},Cj=class extends Xw{constructor(e){super(),this.options=e,this.onRenderEmitter=this.add(new Q),this.onRender=this.onRenderEmitter.event,this._onDispose=this.add(new Q),this.onDispose=this._onDispose.event,this._cachedBg=null,this._cachedFg=null,this.marker=e.marker,this.options.overviewRulerOptions&&!this.options.overviewRulerOptions.position&&(this.options.overviewRulerOptions.position=`full`)}get backgroundColorRGB(){return this._cachedBg===null&&(this.options.backgroundColor?this._cachedBg=oO.toColor(this.options.backgroundColor):this._cachedBg=void 0),this._cachedBg}get foregroundColorRGB(){return this._cachedFg===null&&(this.options.foregroundColor?this._cachedFg=oO.toColor(this.options.foregroundColor):this._cachedFg=void 0),this._cachedFg}dispose(){this._onDispose.fire(),super.dispose()}},wj=1e3,Tj=class{constructor(e,t=wj){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)}},Ej=20,Dj=class extends Zw{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 Tj(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(`
|
|
144
|
-
`))),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(XE(i,`selectionchange`,()=>this._handleSelectionChange())),this._register(this._coreBrowserService.onDprChange(()=>this._refreshRowsDimensions())),this._refreshRowsDimensions(),this._refreshRows(),this._register(Jw(()=>{this._accessibilityContainer.remove(),this._rowElements.length=0}))}_handleTab(e){for(let t=0;t<e;t++)this._handleChar(` `)}_handleChar(e){this._liveRegionLineCount<Ej+1&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==e&&(this._charsToAnnounce+=e):this._charsToAnnounce+=e,e===`
|
|
145
|
-
`&&(this._liveRegionLineCount++,this._liveRegionLineCount===Ej+1&&(this._liveRegion.textContent+=MC.get())))}_clearLiveRegion(){this._liveRegion.textContent=``,this._liveRegionLineCount=0}_handleKey(e){this._clearLiveRegion(),/\p{Control}/u.test(e)||this._charsToConsume.push(e)}_refreshRows(e,t){this._liveRegionDebouncer.refresh(e,t,this._terminal.rows)}_renderRows(e,t){let n=this._terminal.buffer,r=n.lines.length.toString();for(let i=e;i<=t;i++){let e=n.lines.get(n.ydisp+i),t=[],a=e?.translateToString(!0,void 0,void 0,t)||``,o=(n.ydisp+i+1).toString(),s=this._rowElements[i];s&&(a.length===0?(s.textContent=`\xA0`,this._rowColumns.set(s,[0,1])):(s.textContent=a,this._rowColumns.set(s,t)),s.setAttribute(`aria-posinset`,o),s.setAttribute(`aria-setsize`,r),this._alignRowWidth(s))}this._announceCharacters()}_announceCharacters(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce=``)}_handleBoundaryFocus(e,t){let n=e.target,r=this._rowElements[t===0?1:this._rowElements.length-2];if(n.getAttribute(`aria-posinset`)===(t===0?`1`:`${this._terminal.buffer.lines.length}`)||e.relatedTarget!==r)return;let i,a;if(t===0?(i=n,a=this._rowElements.pop(),this._rowContainer.removeChild(a)):(i=this._rowElements.shift(),a=n,this._rowContainer.removeChild(i)),i.removeEventListener(`focus`,this._topBoundaryFocusListener),a.removeEventListener(`focus`,this._bottomBoundaryFocusListener),t===0){let e=this._createAccessibilityTreeNode();this._rowElements.unshift(e),this._rowContainer.insertAdjacentElement(`afterbegin`,e)}else{let e=this._createAccessibilityTreeNode();this._rowElements.push(e),this._rowContainer.appendChild(e)}this._rowElements[0].addEventListener(`focus`,this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener(`focus`,this._bottomBoundaryFocusListener),this._terminal.scrollLines(t===0?-1:1),this._rowElements[t===0?1:this._rowElements.length-2].focus(),e.preventDefault(),e.stopImmediatePropagation()}_handleSelectionChange(){if(this._rowElements.length===0)return;let e=this._coreBrowserService.mainDocument.getSelection();if(!e)return;if(e.isCollapsed){this._rowContainer.contains(e.anchorNode)&&this._terminal.clearSelection();return}if(!e.anchorNode||!e.focusNode){console.error(`anchorNode and/or focusNode are null`);return}let t={node:e.anchorNode,offset:e.anchorOffset},n={node:e.focusNode,offset:e.focusOffset};if((t.node.compareDocumentPosition(n.node)&Node.DOCUMENT_POSITION_PRECEDING||t.node===n.node&&t.offset>n.offset)&&([t,n]=[n,t]),t.node.compareDocumentPosition(this._rowElements[0])&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_FOLLOWING)&&(t={node:this._rowElements[0].childNodes[0],offset:0}),!this._rowContainer.contains(t.node))return;let r=this._rowElements.slice(-1)[0];if(n.node.compareDocumentPosition(r)&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_PRECEDING)&&(n={node:r,offset:r.textContent?.length??0}),!this._rowContainer.contains(n.node))return;let i=({node:e,offset:t})=>{let n=e instanceof Text?e.parentNode:e,r=parseInt(n?.getAttribute(`aria-posinset`),10)-1;if(isNaN(r))return console.warn(`row is invalid. Race condition?`),null;let i=this._rowColumns.get(n);if(!i)return console.warn(`columns is null. Race condition?`),null;let a=t<i.length?i[t]:i.slice(-1)[0]+1;return a>=this._terminal.cols&&(++r,a=0),{row:r,column:a}},a=i(t),o=i(n);if(!(!a||!o)){if(a.row>o.row||a.row===o.row&&a.column>=o.column)throw Error(`invalid range`);this._terminal.select(a.column,a.row,(o.row-a.row)*this._terminal.cols-a.column+o.column)}}_handleResize(e){this._rowElements[this._rowElements.length-1].removeEventListener(`focus`,this._bottomBoundaryFocusListener);for(let e=this._rowContainer.children.length;e<this._terminal.rows;e++)this._rowElements[e]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[e]);for(;this._rowElements.length>e;)this._rowContainer.removeChild(this._rowElements.pop());this._rowElements[this._rowElements.length-1].addEventListener(`focus`,this._bottomBoundaryFocusListener),this._refreshRowsDimensions()}_createAccessibilityTreeNode(){let e=this._coreBrowserService.mainDocument.createElement(`div`);return e.setAttribute(`role`,`listitem`),e.tabIndex=-1,this._refreshRowDimensions(e),e}_refreshRowsDimensions(){if(this._renderService.dimensions.css.cell.height){Object.assign(this._accessibilityContainer.style,{width:`${this._renderService.dimensions.css.canvas.width}px`,fontSize:`${this._terminal.options.fontSize}px`}),this._rowElements.length!==this._terminal.rows&&this._handleResize(this._terminal.rows);for(let e=0;e<this._terminal.rows;e++)this._refreshRowDimensions(this._rowElements[e]),this._alignRowWidth(this._rowElements[e])}}_refreshRowDimensions(e){e.style.height=`${this._renderService.dimensions.css.cell.height}px`}_alignRowWidth(e){e.style.transform=``;let t=e.getBoundingClientRect().width,n=this._rowColumns.get(e)?.slice(-1)?.[0];if(!n)return;let r=n*this._renderService.dimensions.css.cell.width;e.style.transform=`scaleX(${r/t})`}};Dj=OC([Z(1,aw),Z(2,mw),Z(3,gw)],Dj);var Oj=class extends Zw{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 Q),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this._register(new Q),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this._register(Jw(()=>{Kw(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(XE(this._element,`mouseleave`,()=>{this._isMouseOut=!0,this._clearCurrentLink()})),this._register(XE(this._element,`mousemove`,this._handleMouseMove.bind(this))),this._register(XE(this._element,`mousedown`,this._handleMouseDown.bind(this))),this._register(XE(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&&kj(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,Kw(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}}};Oj=OC([Z(1,hw),Z(2,gw),Z(3,tw),Z(4,bw)],Oj);function kj(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 Aj=class extends hj{constructor(e={}){super(e),this._linkifier=this._register(new Qw),this.browser=HO,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this._register(new Qw),this._onCursorMove=this._register(new Q),this.onCursorMove=this._onCursorMove.event,this._onKey=this._register(new Q),this.onKey=this._onKey.event,this._onRender=this._register(new Q),this.onRender=this._onRender.event,this._onSelectionChange=this._register(new Q),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this._register(new Q),this.onTitleChange=this._onTitleChange.event,this._onBell=this._register(new Q),this.onBell=this._onBell.event,this._onFocus=this._register(new Q),this._onBlur=this._register(new Q),this._onA11yCharEmitter=this._register(new Q),this._onA11yTabEmitter=this._register(new Q),this._onWillOpen=this._register(new Q),this._setup(),this._decorationService=this._instantiationService.createInstance(Sj),this._instantiationService.setService(uw,this._decorationService),this._linkProviderService=this._instantiationService.createInstance(LO),this._instantiationService.setService(bw,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(dw)),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(aT.forward(this._inputHandler.onCursorMove,this._onCursorMove)),this._register(aT.forward(this._inputHandler.onTitleChange,this._onTitleChange)),this._register(aT.forward(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this._register(aT.forward(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this._register(this._bufferService.onResize(e=>this._afterResize(e.cols,e.rows))),this._register(Jw(()=>{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=aO.toColorRGB(e===`ansi`?this._themeService.colors.ansi[t.index]:this._themeService.colors[e]);this.coreService.triggerDataEvent(`${$.ESC}]${n};${$A(r)}${ZD.ST}`);break;case 1:if(e===`ansi`)this._themeService.modifyColors(e=>e.ansi[t.index]=iO.toColor(...t.color));else{let n=e;this._themeService.modifyColors(e=>e[n]=iO.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(Dj,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(e){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent($.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($.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(XE(this.element,`copy`,e=>{this.hasSelection()&&FC(e,this._selectionService)}));let e=e=>IC(e,this.textarea,this.coreService,this.optionsService);this._register(XE(this.textarea,`paste`,e)),this._register(XE(this.element,`paste`,e)),KO?this._register(XE(this.element,`mousedown`,e=>{e.button===2&&zC(e,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})):this._register(XE(this.element,`contextmenu`,e=>{zC(e,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})),ek&&this._register(XE(this.element,`auxclick`,e=>{e.button===1&&RC(e,this.textarea,this.screenElement)}))}_bindKeys(){this._register(XE(this.textarea,`keyup`,e=>this._keyUp(e),!0)),this._register(XE(this.textarea,`keydown`,e=>this._keyDown(e),!0)),this._register(XE(this.textarea,`keypress`,e=>this._keyPress(e),!0)),this._register(XE(this.textarea,`compositionstart`,()=>this._compositionHelper.compositionstart())),this._register(XE(this.textarea,`compositionupdate`,e=>this._compositionHelper.compositionupdate(e))),this._register(XE(this.textarea,`compositionend`,()=>this._compositionHelper.compositionend())),this._register(XE(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(XE(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`,AC.get()),tk||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(FO,this.textarea,e.ownerDocument.defaultView??window,this._document??typeof window<`u`?window.document:null)),this._instantiationService.setService(mw,this._coreBrowserService),this._register(XE(this.textarea,`focus`,e=>this._handleTextAreaFocus(e))),this._register(XE(this.textarea,`blur`,()=>this._handleTextAreaBlur())),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(jO,this._document,this._helperContainer),this._instantiationService.setService(pw,this._charSizeService),this._themeService=this._instantiationService.createInstance(zk),this._instantiationService.setService(yw,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(fO),this._instantiationService.setService(vw,this._characterJoinerService),this._renderService=this._register(this._instantiationService.createInstance(sk,this.rows,this.screenElement)),this._instantiationService.setService(gw,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(QD,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseService=this._instantiationService.createInstance(BO),this._instantiationService.setService(hw,this._mouseService);let r=this._linkifier.value=this._register(this._instantiationService.createInstance(Oj,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(UD,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(kk,this.element,this.screenElement,r)),this._instantiationService.setService(_w,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(aT.any(this._onScroll.event,this._inputHandler.onScroll)(()=>{this._selectionService.refresh(),this._viewport?.queueSync()})),this._register(this._instantiationService.createInstance(WD,this.screenElement)),this._register(XE(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(Dj,this)),this._register(this.optionsService.onSpecificOptionChange(`screenReaderMode`,e=>this._handleScreenReaderModeOptionChange(e))),this.options.overviewRuler.width&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(YD,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange(`overviewRuler`,e=>{!this._overviewRulerRenderer&&e&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(YD,this._viewportElement,this.screenElement)))}),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()}_createRenderer(){return this._instantiationService.createInstance(AO,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(XE(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(XE(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=$.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){LC(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=_j(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===$.ETX||n.key===$.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)&&(jj(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(Yk));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($.ESC+`[I`):this.coreService.triggerDataEvent($.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(`${$.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(`${$.ESC}[6;${r};${n}t`);break}}cancel(e,t){if(!(!this.options.cancelEvents&&!t))return e.preventDefault(),e.stopPropagation(),!1}};function jj(e){return e.keyCode===16||e.keyCode===17||e.keyCode===18}var Mj=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)}},Nj=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 JC)}translateToString(e,t,n){return this._line.translateToString(e,t,n)}},Pj=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 Nj(t)}getNullCell(){return new JC}},Fj=class extends Zw{constructor(e){super(),this._core=e,this._onBufferChange=this._register(new Q),this.onBufferChange=this._onBufferChange.event,this._normal=new Pj(this._core.buffers.normal,`normal`),this._alternate=new Pj(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)}},Ij=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)}},Lj=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}},Rj=[`cols`,`rows`],zj=0,Bj=class extends Zw{constructor(e){super(),this._core=this._register(new Aj(e)),this._addonManager=this._register(new Mj),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(Rj.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 Ij(this._core),this._parser}get unicode(){return this._checkProposedApi(),new Lj(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 Fj(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
|
|
146
|
-
`,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 AC.get()},set promptLabel(e){AC.set(e)},get tooMuchOutput(){return MC.get()},set tooMuchOutput(e){MC.set(e)}}}_verifyIntegers(...e){for(zj of e)if(zj===1/0||isNaN(zj)||zj%1!=0)throw Error(`This API only accepts integers`)}_verifyPositiveIntegers(...e){for(zj of e)if(zj&&(zj===1/0||isNaN(zj)||zj%1!=0||zj<0))throw Error(`This API only accepts positive integers`)}},Vj=Object.create(null);Vj.open=`0`,Vj.close=`1`,Vj.ping=`2`,Vj.pong=`3`,Vj.message=`4`,Vj.upgrade=`5`,Vj.noop=`6`;var Hj=Object.create(null);Object.keys(Vj).forEach(e=>{Hj[Vj[e]]=e});var Uj={type:`error`,data:`parser error`},Wj=typeof Blob==`function`||typeof Blob<`u`&&Object.prototype.toString.call(Blob)===`[object BlobConstructor]`,Gj=typeof ArrayBuffer==`function`,Kj=e=>typeof ArrayBuffer.isView==`function`?ArrayBuffer.isView(e):e&&e.buffer instanceof ArrayBuffer,qj=({type:e,data:t},n,r)=>Wj&&t instanceof Blob?n?r(t):Jj(t,r):Gj&&(t instanceof ArrayBuffer||Kj(t))?n?r(t):Jj(new Blob([t]),r):r(Vj[e]+(t||``)),Jj=(e,t)=>{let n=new FileReader;return n.onload=function(){let e=n.result.split(`,`)[1];t(`b`+(e||``))},n.readAsDataURL(e)};function Yj(e){return e instanceof Uint8Array?e:e instanceof ArrayBuffer?new Uint8Array(e):new Uint8Array(e.buffer,e.byteOffset,e.byteLength)}var Xj;function Zj(e,t){if(Wj&&e.data instanceof Blob)return e.data.arrayBuffer().then(Yj).then(t);if(Gj&&(e.data instanceof ArrayBuffer||Kj(e.data)))return t(Yj(e.data));qj(e,!1,e=>{Xj||=new TextEncoder,t(Xj.encode(e))})}var Qj=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/`,$j=typeof Uint8Array>`u`?[]:new Uint8Array(256);for(let e=0;e<64;e++)$j[Qj.charCodeAt(e)]=e;var eM=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=$j[e.charCodeAt(r)],o=$j[e.charCodeAt(r+1)],s=$j[e.charCodeAt(r+2)],c=$j[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},tM=typeof ArrayBuffer==`function`,nM=(e,t)=>{if(typeof e!=`string`)return{type:`message`,data:iM(e,t)};let n=e.charAt(0);return n===`b`?{type:`message`,data:rM(e.substring(1),t)}:Hj[n]?e.length>1?{type:Hj[n],data:e.substring(1)}:{type:Hj[n]}:Uj},rM=(e,t)=>tM?iM(eM(e),t):{base64:!0,data:e},iM=(e,t)=>{switch(t){case`blob`:return e instanceof Blob?e:new Blob([e]);default:return e instanceof ArrayBuffer?e:e.buffer}},aM=``,oM=(e,t)=>{let n=e.length,r=Array(n),i=0;e.forEach((e,a)=>{qj(e,!1,e=>{r[a]=e,++i===n&&t(r.join(aM))})})},sM=(e,t)=>{let n=e.split(aM),r=[];for(let e=0;e<n.length;e++){let i=nM(n[e],t);if(r.push(i),i.type===`error`)break}return r};function cM(){return new TransformStream({transform(e,t){Zj(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 lM;function uM(e){return e.reduce((e,t)=>e+t.length,0)}function dM(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 fM(e,t){lM||=new TextDecoder;let n=[],r=0,i=-1,a=!1;return new TransformStream({transform(o,s){for(n.push(o);;){if(r===0){if(uM(n)<1)break;let e=dM(n,1);a=(e[0]&128)==128,i=e[0]&127,r=i<126?3:i===126?1:2}else if(r===1){if(uM(n)<2)break;let e=dM(n,2);i=new DataView(e.buffer,e.byteOffset,e.length).getUint16(0),r=3}else if(r===2){if(uM(n)<8)break;let e=dM(n,8),t=new DataView(e.buffer,e.byteOffset,e.length),a=t.getUint32(0);if(a>2**21-1){s.enqueue(Uj);break}i=a*2**32+t.getUint32(4),r=3}else{if(uM(n)<i)break;let e=dM(n,i);s.enqueue(nM(a?e:lM.decode(e),t)),r=0}if(i===0||i>e){s.enqueue(Uj);break}}}})}function pM(e){if(e)return mM(e)}function mM(e){for(var t in pM.prototype)e[t]=pM.prototype[t];return e}pM.prototype.on=pM.prototype.addEventListener=function(e,t){return this._callbacks=this._callbacks||{},(this._callbacks[`$`+e]=this._callbacks[`$`+e]||[]).push(t),this},pM.prototype.once=function(e,t){function n(){this.off(e,n),t.apply(this,arguments)}return n.fn=t,this.on(e,n),this},pM.prototype.off=pM.prototype.removeListener=pM.prototype.removeAllListeners=pM.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},pM.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},pM.prototype.emitReserved=pM.prototype.emit,pM.prototype.listeners=function(e){return this._callbacks=this._callbacks||{},this._callbacks[`$`+e]||[]},pM.prototype.hasListeners=function(e){return!!this.listeners(e).length};var hM=typeof Promise==`function`&&typeof Promise.resolve==`function`?e=>Promise.resolve().then(e):(e,t)=>t(e,0),gM=typeof self<`u`?self:typeof window<`u`?window:Function(`return this`)(),_M=`arraybuffer`;function vM(e,...t){return t.reduce((t,n)=>(e.hasOwnProperty(n)&&(t[n]=e[n]),t),{})}var yM=gM.setTimeout,bM=gM.clearTimeout;function xM(e,t){t.useNativeTimers?(e.setTimeoutFn=yM.bind(gM),e.clearTimeoutFn=bM.bind(gM)):(e.setTimeoutFn=gM.setTimeout.bind(gM),e.clearTimeoutFn=gM.clearTimeout.bind(gM))}var SM=1.33;function CM(e){return typeof e==`string`?wM(e):Math.ceil((e.byteLength||e.size)*SM)}function wM(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 TM(){return Date.now().toString(36).substring(3)+Math.random().toString(36).substring(2,5)}function EM(e){let t=``;for(let n in e)e.hasOwnProperty(n)&&(t.length&&(t+=`&`),t+=encodeURIComponent(n)+`=`+encodeURIComponent(e[n]));return t}function DM(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 OM=class extends Error{constructor(e,t,n){super(e),this.description=t,this.context=n,this.type=`TransportError`}},kM=class extends pM{constructor(e){super(),this.writable=!1,xM(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 OM(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=nM(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=EM(e);return t.length?`?`+t:``}},AM=class extends kM{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){sM(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,oM(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]=TM()),!this.supportsBinary&&!t.sid&&(t.b64=1),this.createUri(e,t)}},jM=!1;try{jM=typeof XMLHttpRequest<`u`&&`withCredentials`in new XMLHttpRequest}catch{}var MM=jM;function NM(){}var PM=class extends AM{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}},FM=class e extends pM{constructor(e,t,n){super(),this.createRequest=e,xM(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=vM(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=NM,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(FM.requestsCount=0,FM.requests={},typeof document<`u`){if(typeof attachEvent==`function`)attachEvent(`onunload`,IM);else if(typeof addEventListener==`function`){let e=`onpagehide`in gM?`pagehide`:`unload`;addEventListener(e,IM,!1)}}function IM(){for(let e in FM.requests)FM.requests.hasOwnProperty(e)&&FM.requests[e].abort()}var LM=(function(){let e=zM({xdomain:!1});return e&&e.responseType!==null})(),RM=class extends PM{constructor(e){super(e);let t=e&&e.forceBase64;this.supportsBinary=LM&&!t}request(e={}){return Object.assign(e,{xd:this.xd},this.opts),new FM(zM,this.uri(),e)}};function zM(e){let t=e.xdomain;try{if(typeof XMLHttpRequest<`u`&&(!t||MM))return new XMLHttpRequest}catch{}if(!t)try{return new gM[[`Active`,`Object`].join(`X`)](`Microsoft.XMLHTTP`)}catch{}}var BM=typeof navigator<`u`&&typeof navigator.product==`string`&&navigator.product.toLowerCase()===`reactnative`,VM=class extends kM{get name(){return`websocket`}doOpen(){let e=this.uri(),t=this.opts.protocols,n=BM?{}:vM(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;qj(n,this.supportsBinary,e=>{try{this.doWrite(n,e)}catch{}r&&hM(()=>{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]=TM()),this.supportsBinary||(t.b64=1),this.createUri(e,t)}},HM=gM.WebSocket||gM.MozWebSocket,UM={websocket:class extends VM{createSocket(e,t,n){return BM?new HM(e,t,n):t?new HM(e,t):new HM(e)}doWrite(e,t){this.ws.send(t)}},webtransport:class extends kM{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=fM(2**53-1,this.socket.binaryType),n=e.readable.pipeThrough(t).getReader(),r=cM();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&&hM(()=>{this.writable=!0,this.emitReserved(`drain`)},this.setTimeoutFn)})}}doClose(){var e;(e=this._transport)==null||e.close()}},polling:RM},WM=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,GM=[`source`,`protocol`,`authority`,`userInfo`,`user`,`password`,`host`,`port`,`relative`,`path`,`directory`,`file`,`query`,`anchor`];function KM(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=WM.exec(e||``),a={},o=14;for(;o--;)a[GM[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=qM(a,a.path),a.queryKey=JM(a,a.query),a}function qM(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 JM(e,t){let n={};return t.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(e,t,r){t&&(n[t]=r)}),n}var YM=typeof addEventListener==`function`&&typeof removeEventListener==`function`,XM=[];YM&&addEventListener(`offline`,()=>{XM.forEach(e=>e())},!1);var ZM=class e extends pM{constructor(e,t){if(super(),this.binaryType=_M,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=KM(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=KM(t.host).host);xM(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=DM(this.opts.query)),YM&&(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`})},XM.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+=CM(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,hM(()=>{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(),YM&&(this._beforeunloadEventListener&&removeEventListener(`beforeunload`,this._beforeunloadEventListener,!1),this._offlineEventListener)){let e=XM.indexOf(this._offlineEventListener);e!==-1&&XM.splice(e,1)}this.readyState=`closed`,this.id=null,this.emitReserved(`close`,e,t),this.writeBuffer=[],this._prevBufferLen=0}}};ZM.protocol=4;var QM=class extends ZM{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;ZM.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;ZM.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}},$M=class extends QM{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=>UM[e]).filter(e=>!!e)),super(n?r:e,r)}};$M.protocol;function eN(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=KM(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 tN=typeof ArrayBuffer==`function`,nN=e=>typeof ArrayBuffer.isView==`function`?ArrayBuffer.isView(e):e.buffer instanceof ArrayBuffer,rN=Object.prototype.toString,iN=typeof Blob==`function`||typeof Blob<`u`&&rN.call(Blob)===`[object BlobConstructor]`,aN=typeof File==`function`||typeof File<`u`&&rN.call(File)===`[object FileConstructor]`;function oN(e){return tN&&(e instanceof ArrayBuffer||nN(e))||iN&&e instanceof Blob||aN&&e instanceof File}function sN(e,t){if(!e||typeof e!=`object`)return!1;if(Array.isArray(e)){for(let t=0,n=e.length;t<n;t++)if(sN(e[t]))return!0;return!1}if(oN(e))return!0;if(e.toJSON&&typeof e.toJSON==`function`&&arguments.length===1)return sN(e.toJSON(),!0);for(let t in e)if(Object.prototype.hasOwnProperty.call(e,t)&&sN(e[t]))return!0;return!1}function cN(e){let t=[],n=e.data,r=e;return r.data=lN(n,t),r.attachments=t.length,{packet:r,buffers:t}}function lN(e,t,n){if(!e)return e;if(oN(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]=lN(e[r],t);return n}else if(typeof e==`object`&&!(e instanceof Date)){if(e.toJSON&&typeof e.toJSON==`function`&&!n)return lN(e.toJSON(),t,!0);let r={};for(let n in e)Object.prototype.hasOwnProperty.call(e,n)&&(r[n]=lN(e[n],t));return r}return e}function uN(e,t){return e.data=dN(e.data,t),delete e.attachments,e}function dN(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]=dN(e[n],t);else if(typeof e==`object`)for(let n in e)Object.prototype.hasOwnProperty.call(e,n)&&(e[n]=dN(e[n],t));return e}var fN=s({Decoder:()=>gN,Encoder:()=>hN,PacketType:()=>mN,isPacketValid:()=>CN,protocol:()=>5}),pN=[`connect`,`connect_error`,`disconnect`,`disconnecting`,`newListener`,`removeListener`],mN;(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`})(mN||={});var hN=class{constructor(e){this.replacer=e}encode(e){return(e.type===mN.EVENT||e.type===mN.ACK)&&sN(e)?this.encodeAsBinary({type:e.type===mN.EVENT?mN.BINARY_EVENT:mN.BINARY_ACK,nsp:e.nsp,data:e.data,id:e.id}):[this.encodeAsString(e)]}encodeAsString(e){let t=``+e.type;return(e.type===mN.BINARY_EVENT||e.type===mN.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=cN(e),n=this.encodeAsString(t.packet),r=t.buffers;return r.unshift(n),r}},gN=class e extends pM{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===mN.BINARY_EVENT;n||t.type===mN.BINARY_ACK?(t.type=n?mN.EVENT:mN.ACK,this.reconstructor=new _N(t)):super.emitReserved(`decoded`,t)}else if(oN(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(mN[r.type]===void 0)throw Error(`unknown packet type `+r.type);if(r.type===mN.BINARY_EVENT||r.type===mN.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(!yN(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 mN.CONNECT:return xN(t);case mN.DISCONNECT:return t===void 0;case mN.CONNECT_ERROR:return typeof t==`string`||xN(t);case mN.EVENT:case mN.BINARY_EVENT:return Array.isArray(t)&&(typeof t[0]==`number`||typeof t[0]==`string`&&pN.indexOf(t[0])===-1);case mN.ACK:case mN.BINARY_ACK:return Array.isArray(t)}}destroy(){this.reconstructor&&=(this.reconstructor.finishedReconstruction(),null)}},_N=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=uN(this.reconPack,this.buffers);return this.finishedReconstruction(),e}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}};function vN(e){return typeof e==`string`}var yN=Number.isInteger||function(e){return typeof e==`number`&&isFinite(e)&&Math.floor(e)===e};function bN(e){return e===void 0||yN(e)}function xN(e){return Object.prototype.toString.call(e)===`[object Object]`}function SN(e,t){switch(e){case mN.CONNECT:return t===void 0||xN(t);case mN.DISCONNECT:return t===void 0;case mN.EVENT:return Array.isArray(t)&&(typeof t[0]==`number`||typeof t[0]==`string`&&pN.indexOf(t[0])===-1);case mN.ACK:return Array.isArray(t);case mN.CONNECT_ERROR:return typeof t==`string`||xN(t);default:return!1}}function CN(e){return vN(e.nsp)&&bN(e.id)&&SN(e.type,e.data)}function wN(e,t,n){return e.on(t,n),function(){e.off(t,n)}}var TN=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1}),EN=class extends pM{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=[wN(e,`open`,this.onopen.bind(this)),wN(e,`packet`,this.onpacket.bind(this)),wN(e,`error`,this.onerror.bind(this)),wN(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(TN.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:mN.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:mN.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 mN.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 mN.EVENT:case mN.BINARY_EVENT:this.onevent(e);break;case mN.ACK:case mN.BINARY_ACK:this.onack(e);break;case mN.DISCONNECT:this.ondisconnect();break;case mN.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:mN.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:mN.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 DN(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}DN.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},DN.prototype.reset=function(){this.attempts=0},DN.prototype.setMin=function(e){this.ms=e},DN.prototype.setMax=function(e){this.max=e},DN.prototype.setJitter=function(e){this.jitter=e};var ON=class extends pM{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,xM(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 DN({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||fN;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 $M(this.uri,this.opts);let t=this.engine,n=this;this._readyState=`opening`,this.skipReconnect=!1;let r=wN(t,`open`,function(){n.onopen(),e&&e()}),i=t=>{this.cleanup(),this._readyState=`closed`,this.emitReserved(`error`,t),e?e(t):this.maybeReconnectOnOpen()},a=wN(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(wN(e,`ping`,this.onping.bind(this)),wN(e,`data`,this.ondata.bind(this)),wN(e,`error`,this.onerror.bind(this)),wN(e,`close`,this.onclose.bind(this)),wN(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){hM(()=>{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 EN(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)}},kN={};function AN(e,t){typeof e==`object`&&(t=e,e=void 0),t||={};let n=eN(e,t.path||`/socket.io`),r=n.source,i=n.id,a=n.path,o=kN[i]&&a in kN[i].nsps,s=t.forceNew||t[`force new connection`]||!1===t.multiplex||o,c;return s?c=new ON(r,t):(kN[i]||(kN[i]=new ON(r,t)),c=kN[i]),n.query&&!t.query&&(t.query=n.queryKey),c.socket(n.path,t)}Object.assign(AN,{Manager:ON,Socket:EN,io:AN,connect:AN});var jN=class extends Error{method;path;constructor(e,t,n){super(`Treeport could not be reached`,{cause:n}),this.method=e,this.path=t,this.name=`RpcNetworkError`}},MN=async(e,t)=>{try{return await fetch(e,t)}catch(n){if(n instanceof Error&&n.name===`AbortError`)throw n;let r=e instanceof Request?e:null,i=new URL(r?.url??String(e),globalThis.location?.href??`http://localhost`);throw new jN(String(t?.method??r?.method??`GET`).toUpperCase().slice(0,16),i.pathname.slice(0,2048),n)}},NN=kf(`/`,{fetch:MN}),PN=kf(`/`,{fetch:MN}),FN=500,IN=80,LN=128,RN=Zv({error:Zv({code:Gv().optional(),message:Gv().optional(),details:Gv().optional()}).optional()}),zN=Zv({data:Gv().optional(),statusText:Gv().optional()}),BN=e=>Gv().transform(t=>{let n=q().safeParse(t);if(!n.success)return null;let r=``;for(let e of n.data){let t=e.charCodeAt(0);r+=t<32||t===127?` `:e}let i=r.replace(/\s+/g,` `).trim();return i?i.length<=e?i:`${i.slice(0,e-1)}…`:null}).parse,VN=Gv().transform(e=>{let t=Zv({requestId:q()}).safeParse(e);if(!t.success)return null;let n=t.data.requestId;return n.length<=LN&&/^[A-Za-z0-9_=-]+$/.test(n)?n:null}).parse;function HN(e){if(e instanceof jN)return{message:`Treeport could not be reached.`,code:null,details:null,status:null,statusText:null,requestId:null,method:e.method,path:e.path,networkFailure:!0,recoveryHint:`Check that it is running and reachable, then retry.`};if(e instanceof gf){let t=zN.safeParse(e.detail),n=t.success?t.data:null,r=RN.safeParse(n?.data),i=r.success?r.data.error:null,a=BN(FN)(i?.message),o=BN(100)(i?.code),s=i?.details??null,c=Lv().int().min(100).max(599).safeParse(e.statusCode),l=c.success?c.data:null,u=BN(IN)(n?.statusText),d=VN(s);if(a)return{message:a,code:o,details:s,status:l,statusText:u,requestId:d,method:null,path:null,networkFailure:!1,recoveryHint:o===`INTERNAL_ERROR`?`Retry. If the problem continues, use the reference when checking Treeport logs.`:null};let f=l?`${l}${u?` ${u}`:``}`:BN(IN)(e.message);return{message:l&&[502,503,504].includes(l)?`The server or proxy returned ${f}.`:f?`The Treeport server returned ${f}.`:`The Treeport server returned an unexpected response.`,code:o,details:s,status:l,statusText:u,requestId:d,method:null,path:null,networkFailure:!1,recoveryHint:l&&[502,503,504].includes(l)?`Check that Treeport is running, then retry.`:null}}return{message:BN(FN)(e instanceof Error?e.message:String(e))??`Unexpected error.`,code:null,details:null,status:null,statusText:null,requestId:null,method:null,path:null,networkFailure:!1,recoveryHint:null}}function UN(e){return HN(e).message}var WN=8*1024*1024,GN=q().min(1).max(4096).refine(e=>{if(!URL.canParse(e))return!1;let t=new URL(e);return(t.protocol===`http:`||t.protocol===`https:`)&&t.username===``&&t.password===``},`Expected an absolute HTTP or HTTPS URL without credentials`),KN=ty(`type`,[J({type:Y(`navigate`),url:GN}),J({type:Y(`back`)}),J({type:Y(`forward`)}),J({type:Y(`reload`)}),J({type:Y(`stop`)}),J({type:Y(`resize`),width:Lv().int().min(320).max(3840),height:Lv().int().min(200).max(2160)}),J({type:Y(`pointer`),phase:ly([`move`,`down`,`up`]),x:Lv().finite().min(0).max(3840),y:Lv().finite().min(0).max(2160),button:ly([`left`,`right`,`middle`]).optional()}),J({type:Y(`wheel`),deltaX:Lv().finite().min(-1e4).max(1e4),deltaY:Lv().finite().min(-1e4).max(1e4)}),J({type:Y(`key`),phase:ly([`down`,`up`]),key:q().min(1).max(128)}),J({type:Y(`insertText`),text:q().max(64*1024)}),J({type:Y(`takeControl`)}),J({type:Y(`setVisible`),visible:Vv()}),J({type:Y(`frameAck`),sequence:Lv().int().positive()})]),qN=J({url:$v([Y(`about:blank`),GN]),title:q().max(256),loading:Vv(),canGoBack:Vv(),canGoForward:Vv(),viewport:J({width:Lv().finite().min(0).max(3840),height:Lv().finite().min(0).max(2160)})}),JN=qN.extend({controlled:Vv(),hasController:Vv(),controller:ly([`you`,`agent`,`other`,`none`])}),YN=ty(`type`,[J({type:Y(`ready`),state:JN}),J({type:Y(`state`),state:JN}),J({type:Y(`controlChanged`),state:JN}),J({type:Y(`navigationError`),message:q()}),J({type:Y(`browserUnavailable`),message:q(),installCommand:q().nullable()}),J({type:Y(`browserCrashed`),message:q()}),J({type:Y(`closed`),reason:q()})]),XN=J({sequence:Lv().int().positive(),mimeType:Y(`image/jpeg`),timestamp:Lv(),width:Lv().int().positive(),height:Lv().int().positive(),data:$v([Iy(Uint8Array),Iy(ArrayBuffer)]).transform(e=>e instanceof Uint8Array?e:new Uint8Array(e)).refine(e=>e.byteLength<=WN)});J({clientId:q().min(1).max(128),visible:Vv()}),J({clientId:q().min(1).max(128)});var ZN=q().min(32).max(256),QN=q().min(1).max(128),$N=q().min(1).max(128),eP=Lv().int().positive(),tP=Lv().int().nonnegative(),nP=q().url().max(1024).refine(e=>{let t=new URL(e);return t.protocol===`http:`&&t.hostname===`127.0.0.1`&&t.username===``&&t.password===``&&t.search===``&&t.hash===``&&t.pathname!==`/`},`Expected a private loopback Browser endpoint`),rP=q().max(4096);ty(`command`,[J({command:Y(`snapshot`),args:ay([])}),J({command:Y(`click`),args:ay([rP])}),J({command:Y(`fill`),args:ay([rP,rP])}),J({command:Y(`press`),args:ay([rP])}),J({command:Y(`console`),args:$v([ay([]),ay([rP.max(32)])])}),J({command:Y(`requests`),args:ay([])}),J({command:Y(`screenshot`),args:ay([])}),J({command:Y(`goto`),args:ay([GN])}),J({command:Y(`go-back`),args:ay([])}),J({command:Y(`go-forward`),args:ay([])}),J({command:Y(`reload`),args:ay([])})]),J({ticket:ZN,protocolVersion:Y(3)}),J({ticket:ZN,protocolVersion:Y(3),endpoint:nP,challenge:ZN}),ty(`type`,[J({type:Y(`ready`),generation:eP,revision:tP,state:qN}),J({type:Y(`state`),generation:eP,revision:tP,state:qN}),J({type:Y(`popup`),generation:eP,url:GN}),J({type:Y(`crashed`),generation:eP,message:q().min(1).max(1024)}),J({type:Y(`runtimeControlResult`),generation:eP,requestId:$N,accepted:Vv()}),J({type:Y(`takeControl`),generation:eP}),J({type:Y(`released`),generation:eP}),J({type:Y(`closeResult`),generation:eP,requestId:$N,canClose:Vv()})]);var iP=ty(`type`,[J({type:Y(`claimGranted`),panelId:QN,generation:eP,resumed:Vv(),state:qN}),J({type:Y(`claimRejected`),message:q().min(1).max(1024)}),J({type:Y(`runtimeControl`),generation:eP,requestId:$N,controller:ly([`agent`,`other`,`none`]),retainPaint:Vv()}),J({type:Y(`closeRequest`),generation:eP,requestId:$N,force:Vv()}),J({type:Y(`closed`),reason:q().max(1024)})]);function aP(e){let t=KN.safeParse(e);return t.success?t.data:null}var oP=ly([`same-origin`,`tree-files`]),sP=`/api/socket.io/`,cP=64*1024,lP=`\x1B[9000~`,uP=`\x1B[9001~`,dP=`\x1B[9002~`,fP=`\x1B[9003~`,pP=`\x1B[9004~`,mP=q().min(1).max(128),hP=q().min(1).max(128),gP=q().min(1).max(128),_P=Lv().int().nonnegative(),vP={cols:Lv().int().min(2).max(1e3),rows:Lv().int().min(2).max(500)},yP=J(vP),bP=J({state:ly([`normal`,`error`,`indeterminate`,`paused`]),value:Lv().int().min(0).max(100).nullable()}),xP=ly([`pi`,`claude`,`codex`]),SP=J({terminalId:q().min(1),title:q().max(256).nullable(),program:xP.nullable().default(null),hasForegroundProcess:Vv().nullable().optional(),progress:bP.nullable(),progressStartedAt:q().datetime().nullable().default(null),progressClearedAt:q().datetime().nullable().default(null),bell:J({sequence:Lv().int().positive(),at:q().datetime(),unread:Vv()}).nullable().default(null)});J({sequence:Lv().int().positive()}),J({terminalId:mP,clientId:hP,...vP}),J({generation:_P,data:q().max(cP)}),J({generation:_P,data:q().max(cP)}),J({generation:_P,...vP}),J({generation:_P,...vP}),J({generation:_P}),J({streamId:gP,sequence:Lv().int().nonnegative()});var CP={connectionId:q().min(1).max(128),streamId:gP,generation:_P,controller:Vv(),reset:Y(`full`)},wP=$v([J(CP),J({...CP,...vP,revision:Lv().int().positive()})]),TP=J({...vP,revision:Lv().int().positive()}),EP=J({streamId:gP,sequence:Lv().int().positive(),data:q()}),DP=J({title:q().max(256)}),OP=J({progress:bP.nullable()}),kP=J({viewing:Vv()}),AP=J({generation:_P,controller:Vv()}),jP=J({exitCode:Lv().int().nullable()}),MP=J({code:q().min(1).max(80),message:q().min(1).max(1e3),retryable:Vv()});function NP(e,t){let n={ready:wP,dimensions:TP,output:EP,title:DP,progress:OP,history:kP,control:AP,exit:jP,terminal_error:MP}[e].safeParse(t);return n.success?n.data:null}var PP=q().min(1).max(128),FP=(e,t)=>J({id:PP,type:Y(e),at:q().datetime(),data:t}),IP=J({projectId:PP,worktreeId:Uv()}),LP=J({worktreeId:PP}),RP=J({projectId:PP,worktreeId:PP}),zP=J({operationId:PP,worktreeId:PP}),BP=J({id:q().min(1),kind:Y(`web`),worktreeId:q().min(1),definitionId:q().min(1),title:q().min(1),launch:J({input:sy(q(),Ly()).nullable(),cwd:q().nullable()}),permissions:Yv(oP),sandbox:J({allowSameOrigin:Vv()}),createdAt:q(),updatedAt:q()}),VP=J({id:q().min(1),kind:Y(`browser`),worktreeId:q().min(1),title:q().min(1).max(256),url:$v([Y(`about:blank`),GN]),createdAt:q(),updatedAt:q()}),HP=ty(`kind`,[BP,VP]),UP=ty(`type`,[FP(`project.created`,IP),FP(`project.updated`,IP),FP(`project.removed`,IP),FP(`worktree.created`,RP),FP(`worktree.updated`,LP),FP(`worktree.removed`,RP),FP(`create.started`,J({projectId:PP,operationId:PP,worktreeId:Uv()})),FP(`create.completed`,J({projectId:PP,operationId:PP,worktreeId:PP})),FP(`create.failed`,J({projectId:PP,operationId:PP,worktreeId:Uv()})),FP(`terminal.created`,J({projectId:PP.optional(),worktreeId:PP,terminalId:PP})),FP(`terminal.updated`,J({worktreeId:PP,terminalId:PP})),FP(`terminal.removed`,J({worktreeId:PP,terminalId:PP})),FP(`terminal.metadata`,SP.extend({worktreeId:Uv()})),FP(`terminal.controller_changed`,J({terminalId:PP,controlled:Vv(),worktreeId:Uv()})),FP(`panel.created`,J({worktreeId:PP,panelId:PP})),FP(`panel.updated`,J({worktreeId:PP,panelId:PP})),FP(`panel.open_requested`,J({worktreeId:PP,panelId:PP,panel:HP,sourceTerminalId:PP.nullable(),sourcePanelId:PP.nullable()})),FP(`panel.removed`,J({worktreeId:PP,panelId:PP})),FP(`workspace.open_requested`,J({worktreeId:PP,sourceTerminalId:PP})),FP(`remove.started`,zP.extend({kind:Y(`remove`)})),FP(`remove.completed`,zP),FP(`remove.failed`,zP.extend({error:q()}))]),WP=J({at:q().datetime(),terminalMetadata:Yv(SP),webPanels:Yv(BP),browserPanels:Yv(VP)});function GP(e){let t=WP.safeParse(e);return t.success?t.data:null}function KP(e){let t=UP.safeParse(e);return t.success?t.data:null}var qP=50*1024*1024,JP=4096,YP=4096,XP=5e3,ZP=16*1024,QP=64*1024;function $P(e){return e.map(e=>e===``?`""`:/[\s"'\\]/.test(e)?`"${e.replace(/["\\]/g,`\\$&`)}"`:e).join(` `)}Zv({input:q().trim().min(1).max(4096),hidden:ly([`true`,`false`]).optional().default(`false`).transform(e=>e===`true`)}),Zv({lines:Ry().int().min(1).max(XP).optional().default(200)}),Zv({path:q().trim().min(1),name:q().trim().min(1).max(120).optional()}),Zv({color:ly([`rose`,`orange`,`amber`,`emerald`,`cyan`,`blue`,`violet`,`pink`]).nullable()});var eF=q().trim().min(1).max(120),tF=Yv(q()).min(1).max(128),nF=q().max(YP),rF={name:eF,executable:q().min(1).max(JP).refine(e=>e.trim().length>0,{message:`Executable cannot be blank`}),args:Yv(nF).max(127),closeOnSuccess:Vv().default(!1)};J(rF);var iF=q().regex(/^[a-z0-9][a-z0-9._-]{0,119}$/,{message:`Preset IDs must contain only lowercase letters, numbers, dots, underscores, and hyphens`});J({version:Y(1),presets:sy(iF,Gv())});var aF=q().min(1).max(64),oF=q().trim().regex(/^[a-z0-9][a-z0-9._-]{0,119}$/,{message:`Field IDs must contain only lowercase letters, numbers, dots, underscores, and hyphens`});J({id:oF,label:q().trim().min(1).max(120).refine(e=>!e.includes(`\0`),{message:`Field labels cannot contain NUL`}),input:ly([`text`,`textarea`])});var sF=sy(oF,q().trim().min(1).max(ZP).refine(e=>!e.includes(`\0`),{message:`Tree context values cannot contain NUL`})).superRefine((e,t)=>{let n=Object.entries(e);n.length>64&&t.addIssue({code:`custom`,message:`Tree context cannot contain more than 64 values`}),n.reduce((e,[t,n])=>e+t.length+n.length,0)>65536&&t.addIssue({code:`custom`,message:`Tree context cannot contain more than ${QP} characters`})}),cF=Zv({name:eF,initialTitle:eF.optional(),argv:tF.optional(),returnToShell:Vv().optional(),initialSize:yP.optional()});Zv({name:q().trim().min(1).max(120),base:ly([`default`,`current`]).default(`default`),context:sF.optional(),sourceWorktreeId:q().min(1).optional(),initialTerminal:cF.optional()}).superRefine((e,t)=>{e.base===`current`&&!e.sourceWorktreeId&&t.addIssue({code:`custom`,path:[`sourceWorktreeId`],message:`A source tree is required when starting from current`})});var lF=q().min(1).max(4096).refine(e=>e.trim().length>0&&!e.includes(`\0`),{message:`Working directory cannot be blank or contain NUL`}),uF=q().min(1).max(256).refine(e=>!e.includes(`=`)&&!e.includes(`\0`),{message:`Environment keys cannot contain equals or NUL`}),dF=q().min(1).max(YP).refine(e=>e.trim().length>0&&!e.includes(`\0`),{message:`Shell command cannot be blank or contain NUL`}),fF=sy(uF,q().max(YP).refine(e=>!e.includes(`\0`),{message:`Environment values cannot contain NUL`})).refine(e=>Object.keys(e).length<=128,{message:`Environment cannot contain more than 128 variables`});Zv({name:eF,initialTitle:eF.optional(),argv:tF.optional(),shellCommand:dF.optional(),cwd:lF.optional(),env:fF.optional(),returnToShell:Vv().optional(),closeOnSuccess:Vv().optional(),initialSize:yP.optional()}).refine(e=>!(e.argv&&e.shellCommand),{message:`A terminal cannot have both argv and a shell command`}).refine(e=>!(e.returnToShell&&e.closeOnSuccess),{message:`A terminal cannot return to a shell and close on success`}),Zv({name:eF});var pF=sy(q(),Ly()),mF=Zv({definitionId:q().min(1).max(256),input:pF.nullable().optional(),launchCwd:q().max(4096).nullable().optional()});J({granted:Vv(),permissions:Yv(oP)}),J({url:GN.optional(),sourceTerminalId:q().min(1).max(128).nullable().optional()}),J({url:GN}),mF.extend({newInstance:Vv().optional(),sourceTerminalId:q().min(1).max(128).nullable().optional()}),Zv({sourceTerminalId:q().min(1).max(128)});var hF=q().min(1).max(128);Zv({key:hF}),Zv({key:hF,value:Ly()}),Zv({key:hF});var gF=q().min(1).max(4096).refine(e=>!e.includes(`\0`)&&!e.startsWith(`/`)&&e.split(`/`).every(e=>e!==``&&e!==`..`),{message:`File path must be a relative path inside the tree`});J({path:gF}),J({path:gF,content:q(),expectedRevision:q().min(1).max(128)}),Zv(rF),Zv({...rF,closeOnSuccess:Vv().optional(),expectedUpdatedAt:aF}),Zv({expectedUpdatedAt:aF}),Zv({path:q().trim().min(1).max(4096)}),Zv({source:q().trim().min(1).max(4096),projectId:q().min(1).optional()}),Zv({source:q().trim().min(1).max(4096),projectId:q().min(1).optional()}),Zv({source:q().trim().min(1).max(4096).optional()}),Zv({projectId:q().min(1).optional()}),Zv({confirmationToken:q().length(64),confirmDestructive:Vv()}),Zv({project:q().min(1),worktreeName:q().trim().min(1).max(120),name:eF,argv:tF.optional(),base:ly([`default`,`current`]).default(`default`),sourceWorktreeId:q().min(1).optional()}).superRefine((e,t)=>{e.base===`current`&&!e.sourceWorktreeId&&t.addIssue({code:`custom`,path:[`sourceWorktreeId`],message:`A source tree is required when starting from current`})});var _F=8,vF=q().max(16384).startsWith(`/`).refine(e=>Array.from(e).every(e=>{let t=e.codePointAt(0);return t>31&&t!==127})),yF=new Set([`127.0.0.1`,`localhost`,`[::1]`]),bF=8*1024*1024,xF=4,SF=2,CF=1e3,wF=2,TF=500,EF=150,DF=44;function OF(e,t={cols:100,rows:30}){return{cols:Number.isFinite(e.cols)?Math.min(CF,Math.max(SF,Math.trunc(e.cols))):t.cols,rows:Number.isFinite(e.rows)?Math.min(TF,Math.max(wF,Math.trunc(e.rows))):t.rows}}var kF={phase:`closed`,degraded:!1,controller:!1,controlPending:!1,title:null,bellActive:!1,bellSerial:0,exitSerial:0,fileTransfer:null,hasSelection:!1,selecting:!1,viewingHistory:!1,pasteRequestSerial:0,error:null},AF=null;function jF(){if(AF)return AF;try{let e=sessionStorage.getItem(`treeport-terminal-client-id`);if(e)return sessionStorage.setItem(`treeport-terminal-client-id`,e),AF=e}catch{}let e=new Uint8Array(16);if(globalThis.crypto?.getRandomValues)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 AF=n}var MF=50,NF=250,PF=class{createSocket;terminalId;listeners=new Set;snapshotValue=kF;terminal=null;fitAddon=null;wrapper=null;host=null;resizeObserver=null;keyboardViewportCleanup=null;desktopLocalFilePasteCleanup=null;socket=null;degradedTimer=null;bellTimer=null;fileTransferTimer=null;cursorRestoreTimer=null;cursorRestoreStartedAt=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;historyExitRequested=!1;selectionClearRequested=!1;selectionDragCancel=null;tmuxSelectionPending=!1;tmuxSelectionText=null;pendingPaste=``;inputModifiers=null;lastBellAt=0;wakeListenersAttached=!1;reconnectWhenOnline=()=>this.reconnectImmediately();reconnectWhenVisible=()=>{document.visibilityState===`visible`&&this.reconnectImmediately()};constructor(e,t=AN){this.createSocket=t,this.terminalId=e}getSnapshot=()=>this.snapshotValue;getInitialSize(){return!this.host||!this.terminal?null:OF(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.socket?.io.reconnection(!0),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,r=document.querySelector(`.app-frame`);if(t&&n&&r){let e=null,t=()=>{e!==null&&window.cancelAnimationFrame(e),e=window.requestAnimationFrame(()=>{e=null;let t=this.wrapper?.querySelector(`.xterm-helper-textarea`);if(!(document.activeElement===t&&n.height<document.documentElement.clientHeight-100)){r.style.removeProperty(`--app-visual-viewport-height`),r.style.removeProperty(`--app-visual-viewport-offset-top`);return}let i=window.matchMedia(`(display-mode: standalone)`).matches||navigator.standalone?0:DF;r.style.setProperty(`--app-visual-viewport-height`,`${Math.max(0,n.height-i)}px`),r.style.setProperty(`--app-visual-viewport-offset-top`,`${n.offsetTop}px`)})};n.addEventListener(`resize`,t),n.addEventListener(`scroll`,t),t(),this.keyboardViewportCleanup=()=>{n.removeEventListener(`resize`,t),n.removeEventListener(`scroll`,t),e!==null&&window.cancelAnimationFrame(e),r.style.removeProperty(`--app-visual-viewport-height`),r.style.removeProperty(`--app-visual-viewport-offset-top`)}}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.socket?.io.reconnection(!1),this.wakeListenersAttached&&=(window.removeEventListener(`online`,this.reconnectWhenOnline),document.removeEventListener(`visibilitychange`,this.reconnectWhenVisible),!1),this.keyboardViewportCleanup?.(),this.keyboardViewportCleanup=null,this.cancelControllerResizeIntent(!1),this.selectionDragCancel?.(),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=OF(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,t={}){this.requestControl(),this.clearSelection(),this.prepareScrollExit(),this.canInput()&&this.send(`input`,{generation:this.controllerGeneration,data:this.withScrollExit(e)}),t.focus!==!1&&this.focus()}pasteText(e){e&&(this.requestControl(),this.clearSelection(),this.prepareScrollExit(),this.canInput()?this.terminal?.paste(e):this.pendingPaste+=e,this.focus())}pasteFiles(e){e.length&&(this.requestControl(),this.queueFileTransfer(e))}sendArrow(e,t=!1,n={}){let r={up:`A`,down:`B`,right:`C`,left:`D`}[e],i=this.terminal?.modes.applicationCursorKeysMode?`\x1BO`:`\x1B[`;this.sendText(`${t?`\x1B`:``}${i}${r}`,n)}jumpToLatest(){this.ready&&(this.historyExitRequested=!0,this.requestControl(),this.canInput()&&this.sendHistoryExit(),this.focus())}copySelection(){let e=this.tmuxSelectionText??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`);t.remove(),!n&&navigator.clipboard&&navigator.clipboard.writeText(e),this.focus()}clearSelectionAndJumpToLatest(){this.ready&&(this.historyExitRequested=!0,this.selectionClearRequested=!0,this.requestControl(),this.canInput()&&(this.send(`input`,{generation:this.controllerGeneration,data:`${lP}${fP}`}),this.historyExitRequested=!1,this.selectionClearRequested=!1,this.setViewingHistory(!1)),this.tmuxSelectionPending=!1,this.tmuxSelectionText=null,this.terminal?.clearSelection(),this.update({selecting:!1,hasSelection:!1}),this.focus())}clearSelection(){let e=this.tmuxSelectionPending||this.tmuxSelectionText!==null;!e&&!this.terminal?.hasSelection?.()||(e&&(this.selectionClearRequested=!0,this.sendSelectionClear()),this.tmuxSelectionPending=!1,this.tmuxSelectionText=null,this.update({selecting:!1}),this.terminal?.clearSelection(),this.updateSelectionState())}dispose(){this.disposed||(this.disposed=!0,this.reconnectAllowed=!1,this.clearTimers(),this.selectionDragCancel?.(),this.selectionDragCancel=null,this.resizeObserver?.disconnect(),this.wakeListenersAttached&&=(window.removeEventListener(`online`,this.reconnectWhenOnline),document.removeEventListener(`visibilitychange`,this.reconnectWhenVisible),!1),this.keyboardViewportCleanup?.(),this.keyboardViewportCleanup=null,this.desktopLocalFilePasteCleanup?.(),this.desktopLocalFilePasteCleanup=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 Bj(hC(this.terminalId)),t=new vC;e.loadAddon(t),e.loadAddon(new wC((e,t)=>lC(e,t,this.terminalId))),e.open(this.wrapper),e.onSelectionChange(()=>this.updateSelectionState()),e.onRender(()=>{this.wrapper?.classList.contains(`terminal-scrolling`)&&this.hideTerminalCursor()}),e.onWriteParsed(()=>{this.cursorRestoreTimer!==null&&this.scheduleTerminalCursorRestore()}),this.selectionDragCancel=pC(this.wrapper,e,{canInput:()=>this.canInput(),sendInput:e=>{this.send(`input`,{generation:this.controllerGeneration,data:e})},requestControl:()=>this.requestControl(),onSelectionStart:()=>this.clearSelection(),onTmuxSelectionStart:()=>{this.scrollExitPending=!0,this.update({selecting:!0}),this.setTerminalScrolling(!0)},onTmuxSelectionFinish:()=>{this.tmuxSelectionPending=!0,this.update({selecting:!1,hasSelection:!0})},onTmuxSelectionCancel:()=>{this.update({selecting:!1}),this.sendHistoryExit()},selectionStartSequence:uP,selectionStopSequence:dP}),this.wrapper.addEventListener(`copy`,e=>{this.tmuxSelectionText===null||!e.clipboardData||(e.preventDefault(),e.stopImmediatePropagation(),e.clipboardData.setData(`text/plain`,this.tmuxSelectionText))},!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=sC(t,e.modes.applicationCursorKeysMode),a=t.metaKey&&i===null,o=t.ctrlKey&&t.shiftKey&&(n===`c`||n===`v`);!r&&!a&&!o&&(this.clearSelection(),this.requestControl())},!0);let n=mC(this.wrapper,e,e=>{e.deltaY<0&&this.canInput()&&(!this.snapshotValue.viewingHistory&&this.tmuxSelectionText!==null&&this.send(`input`,{generation:this.controllerGeneration,data:pP}),this.scrollExitPending=!0)},()=>{this.requestControl(),this.clearSelection(),this.prepareScrollExit()},()=>{this.requestControl(),this.update({pasteRequestSerial:this.snapshotValue.pasteRequestSerial+1})}),r=this.wrapper;this.desktopLocalFilePasteCleanup=window.treeportDesktop?.onLocalFilePaste?.(e=>{this.wrapper?.contains(document.activeElement)&&(this.requestControl(),this.pasteResolvedFilePaths(e))})??null;let i=e=>!!(e&&(Array.from(e.types).includes(`Files`)||Array.from(e.items).some(e=>e.kind===`file`))),a=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]:[]})};r.addEventListener(`dragover`,e=>{i(e.dataTransfer)&&(this.requestControl(),e.preventDefault(),e.dataTransfer.dropEffect=`copy`,r.classList.add(`terminal-file-drag`))}),r.addEventListener(`dragleave`,e=>{(!(e.relatedTarget instanceof Node)||!r.contains(e.relatedTarget))&&r.classList.remove(`terminal-file-drag`)}),r.addEventListener(`drop`,e=>{i(e.dataTransfer)&&(e.preventDefault(),e.stopPropagation(),r.classList.remove(`terminal-file-drag`),this.pasteFiles(a(e.dataTransfer)))}),r.addEventListener(`paste`,e=>{let t=a(e.clipboardData);t.length&&(e.preventDefault(),e.stopPropagation(),this.pasteFiles(t))},!0),this.terminal=e,this.fitAddon=t,this.opened=!0,e.parser.registerOscHandler(52,e=>{if(!this.tmuxSelectionPending)return!1;this.tmuxSelectionPending=!1;let t=e.indexOf(`;`),n=t===-1?``:e.slice(t+1),r=n.replace(/=+$/,``);if(!n||n===`?`||n.length>bF||e.indexOf(`;`,t+1)!==-1||!/^[A-Za-z0-9+/]*={0,2}$/.test(n)||r.length%4==1)return this.updateSelectionState(),!0;let i=r.padEnd(Math.ceil(r.length/4)*4,`=`),a=atob(i);return this.tmuxSelectionText=new TextDecoder().decode(Uint8Array.from(a,e=>e.charCodeAt(0))),this.update({selecting:!1}),this.updateSelectionState(),!0}),e.attachCustomKeyEventHandler(t=>{let n=sC(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()){e=n(e);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())}queueFileTransfer(e){this.fileTransferQueue=this.fileTransferQueue.catch(()=>void 0).then(()=>this.transferFiles(e))}async transferFiles(e){if(!(!e.length||this.disposed)){if(e.length>_F){this.showFileTransferError(`Choose no more than ${_F} files at a time`);return}if(e.some(e=>e.size>52428800)){this.showFileTransferError(`Files are limited to ${qP} bytes`);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);try{let t=window.treeportDesktop,n;n=t?.getPathForFile?await Promise.all(e.map(e=>Promise.resolve().then(()=>t.getPathForFile?.(e)??null).catch(()=>null))):yF.has(window.location.hostname)?e.map(e=>{let t=e,n=vF.safeParse(t.path);return n.success?n.data:null}):e.map(()=>null);let r=n.filter(e=>!e).length;r>0&&this.update({fileTransfer:{state:`uploading`,message:`Uploading ${r===1?`file`:`${r} files`}…`}});let i=[];for(let[t,r]of e.entries()){let e=n[t];if(e){i.push(e);continue}let a=/\.([a-z0-9]{1,16})$/i.exec(r.name)?.[1],o=new Headers({"content-type":r.type||`application/octet-stream`});a&&o.set(`x-treeport-file-extension`,a.toLowerCase());let s=await Ef(NN.api.terminals[`:terminalId`].files.$post({param:{terminalId:this.terminalId}},{init:{body:r,headers:o}}));i.push(s.file.path)}this.pasteResolvedFilePaths(i,`Terminal control was lost during the upload`)}catch(e){this.disposed||this.showFileTransferError(UN(e))}}}pasteResolvedFilePaths(e,t){if(!e.length||this.disposed)return;if(e.length>_F){this.showFileTransferError(`Choose no more than ${_F} files at a time`);return}if(!this.ready||!this.snapshotValue.controller){this.showFileTransferError(t??(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}let n=e.map(e=>/^[A-Za-z0-9_+,./:@%=-]+$/u.test(e)?e:`'${e.replaceAll(`'`,`'\\''`)}'`).join(` `);if(new TextEncoder().encode(n).byteLength>65504){this.showFileTransferError(`The file paths are too long`);return}this.clearSelection(),this.prepareScrollExit(),this.terminal?.paste(n),this.focus(),this.update({fileTransfer:null})}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.snapshotValue.viewingHistory)&&(this.resumeOnNextInput=!0)}withScrollExit(e){return this.resumeOnNextInput?(this.setViewingHistory(!1),`${lP}${e}`):e}sendHistoryExit(){this.canInput()&&(this.send(`input`,{generation:this.controllerGeneration,data:lP}),this.historyExitRequested=!1,this.setViewingHistory(!1))}sendSelectionClear(){this.canInput()&&(this.send(`input`,{generation:this.controllerGeneration,data:fP}),this.selectionClearRequested=!1)}hideTerminalCursor(){this.terminal?.element?.querySelector(`.xterm-cursor`)?.classList.remove(`xterm-cursor`)}scheduleTerminalCursorRestore(){this.cursorRestoreTimer!==null&&window.clearTimeout(this.cursorRestoreTimer),this.cursorRestoreStartedAt??=Date.now();let e=Math.max(0,NF-(Date.now()-this.cursorRestoreStartedAt));this.cursorRestoreTimer=window.setTimeout(()=>{this.cursorRestoreTimer=null,this.cursorRestoreStartedAt=null,!(!this.wrapper||this.scrollExitPending||this.snapshotValue.viewingHistory)&&(this.wrapper.classList.remove(`terminal-scrolling`),this.terminal?.refresh(0,this.terminal.rows-1))},Math.min(MF,e))}setTerminalScrolling(e){if(this.wrapper){if(e){this.cursorRestoreTimer!==null&&(window.clearTimeout(this.cursorRestoreTimer),this.cursorRestoreTimer=null),this.cursorRestoreStartedAt=null,this.wrapper.classList.add(`terminal-scrolling`),this.hideTerminalCursor();return}this.wrapper.classList.contains(`terminal-scrolling`)&&this.scheduleTerminalCursorRestore()}}setViewingHistory(e){e?this.scrollExitPending=!0:(this.scrollExitPending=!1,this.resumeOnNextInput=!1,this.historyExitRequested=!1),this.setTerminalScrolling(e),e!==this.snapshotValue.viewingHistory&&this.update({viewingHistory: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=this.createSocket(`/terminals`,{path:sP,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=OF(this.proposedDimensions??{cols:this.terminal?.cols??100,rows:this.terminal?.rows??30});e({terminalId:this.terminalId,clientId:jF(),...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(`history`,e=>this.handleServerEvent(`history`,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.selectionDragCancel?.(),this.tmuxSelectionPending=!1,this.tmuxSelectionText=null,this.setViewingHistory(!1),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,hasSelection:!1,selecting:!1,viewingHistory:!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=NP(`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}:OF(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.selectionDragCancel?.(),this.tmuxSelectionPending=!1,this.tmuxSelectionText=null,this.setViewingHistory(!1),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,hasSelection:!1,selecting:!1,viewingHistory:!1,error:null});return}if(e===`dimensions`){if(this.serverProtocolVersion!==2){this.failProtocol(`The legacy terminal server sent dimensions`);return}let e=NP(`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=NP(`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=NP(`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`){NP(`progress`,t)||this.failProtocol(`The terminal server sent invalid progress`);return}if(e===`history`){let e=NP(`history`,t);if(!e){this.failProtocol(`The terminal server sent invalid history state`);return}this.setViewingHistory(e.viewing);return}if(e===`control`){let e=NP(`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}),n&&!e.controller&&(this.selectionDragCancel?.(),this.tmuxSelectionPending=!1),e.controller&&this.selectionClearRequested&&this.sendSelectionClear(),e.controller&&this.historyExitRequested&&this.sendHistoryExit(),e.controller&&this.pendingPaste){let e=this.pendingPaste;this.pendingPaste=``,this.terminal?.paste(e)}n&&this.scheduleFit();return}if(e===`exit`){if(!NP(`exit`,t)){this.failProtocol(`The terminal server sent an invalid exit event`);return}this.update({exitSerial:this.snapshotValue.exitSerial+1});return}let n=NP(`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.bind(this.socket)(e,t);return}this.socket.volatile.emit.bind(this.socket.volatile)(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()},EF)}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>=SF&&this.terminal.rows>=wF&&(this.proposedDimensions=OF({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<SF||this.terminal.rows<wF){this.cancelControllerResizeIntent(!1);return}let t=OF({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<SF||t.rows<wF){this.snapshotValue.controller&&this.cancelControllerResizeIntent(!1);return}let n=OF(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(xF,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})}updateSelectionState(){this.update({hasSelection:this.tmuxSelectionPending||this.tmuxSelectionText!==null||!!this.terminal?.hasSelection()})}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.cursorRestoreTimer!==null&&window.clearTimeout(this.cursorRestoreTimer),this.resizeFrame!==null&&cancelAnimationFrame(this.resizeFrame),this.resizeSettleTimer!==null&&window.clearTimeout(this.resizeSettleTimer),this.degradedTimer=null,this.bellTimer=null,this.fileTransferTimer=null,this.cursorRestoreTimer=null,this.cursorRestoreStartedAt=null,this.resizeFrame=null,this.resizeSettleTimer=null,this.resizePending=!1,this.resizeIntentDirty=!1,this.resizeQuietElapsed=!1,this.resizeIntentGeneration=0,this.proposedDimensions=null}},FF=class{maxSessions;idleMs;createSession;onTitleChange;entries=new Map;constructor(e=8,t=5*6e4,n=e=>new PF(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])}}},IF=class{sendBellAcknowledgement;listeners=new Set;bellEventListeners=new Set;attentionSnapshot=new Set;titleSnapshot=new Map;programSnapshot=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=async(e,t)=>{await Ef(NN.api.terminals[`:terminalId`].bell.acknowledge.$post({param:{terminalId:e},json:{sequence: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;getProgramSnapshot=()=>this.programSnapshot;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.setProgram(e.terminalId,e.program??null),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 Map,r=new Set,i=new Map,a=new Map,o=new Set;for(let s of e){let e=s.title?.trim().slice(0,256);if(e&&t.set(s.terminalId,e),s.program&&n.set(s.terminalId,s.program),s.hasForegroundProcess&&r.add(s.terminalId),s.progress){let e=this.progressSnapshot.get(s.terminalId);i.set(s.terminalId,e?.state===s.progress.state&&e.value===s.progress.value?e:s.progress)}s.bell&&(a.set(s.terminalId,{sequence:s.bell.sequence,at:s.bell.at,unread:s.bell.unread}),s.bell.unread&&o.add(s.terminalId))}let s=t.size!==this.titleSnapshot.size||[...t].some(([e,t])=>this.titleSnapshot.get(e)!==t),c=n.size!==this.programSnapshot.size||[...n].some(([e,t])=>this.programSnapshot.get(e)!==t),l=r.size!==this.foregroundProcessSnapshot.size||[...r].some(e=>!this.foregroundProcessSnapshot.has(e)),u=i.size!==this.progressSnapshot.size||[...i].some(([e,t])=>{let n=this.progressSnapshot.get(e);return n?.state!==t.state||n.value!==t.value}),d=o.size!==this.attentionSnapshot.size||[...o].some(e=>!this.attentionSnapshot.has(e)),f=a.size!==this.bellMetadata.size||[...a].some(([e,t])=>{let n=this.bellMetadata.get(e);return n?.sequence!==t.sequence||n?.at!==t.at||n?.unread!==t.unread});f&&(this.bellMetadata=a),this.bellAcknowledgementEpoch+=1,this.bellAcknowledgementTargets.clear(),s&&(this.titleSnapshot=t),c&&(this.programSnapshot=n),l&&(this.foregroundProcessSnapshot=r),u&&(this.progressSnapshot=i),d&&(this.attentionSnapshot=o),(s||c||l||u||d||f)&&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.setProgram(e,null),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 Map(this.programSnapshot),o=new Set(this.foregroundProcessSnapshot),s=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.keys())t.has(e)||(a.delete(e),n=!0);for(let e of o)t.has(e)||(o.delete(e),n=!0);for(let e of s.keys())t.has(e)||(s.delete(e),n=!0);let c=new Map(this.bellMetadata);for(let e of c.keys())t.has(e)||(c.delete(e),this.bellAcknowledgementTargets.delete(e),this.bellAcknowledgementQueues.delete(e),n=!0);n&&(this.attentionSnapshot=r,this.titleSnapshot=i,this.programSnapshot=a,this.foregroundProcessSnapshot=o,this.progressSnapshot=s,this.bellMetadata=c,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()}setProgram(e,t){if(this.programSnapshot.get(e)===t)return;let n=new Map(this.programSnapshot);t?n.set(e,t):n.delete(e),this.programSnapshot=n,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())}},LF=new class{pool;runtimeMetadata;constructor(e=8,t=5*6e4,n=e=>new PF(e),r){this.runtimeMetadata=new IF(r),this.pool=new FF(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();getProgramSnapshot=()=>this.runtimeMetadata.getProgramSnapshot();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)}},RF=new Set,zF=new Map,BF=new Map,VF=new Map,HF=new Map,UF={attention:RF,titles:zF,programs:BF,progress:VF},WF={bells:HF,titles:zF},GF=UF,KF=WF;function qF(){let e=LF.getAttentionSnapshot(),t=LF.getTitleSnapshot(),n=LF.getProgramSnapshot(),r=LF.getProgressSnapshot();return(GF.attention!==e||GF.titles!==t||GF.programs!==n||GF.progress!==r)&&(GF={attention:e,titles:t,programs:n,progress:r}),GF}function JF(){let e=LF.getBellSnapshot(),t=LF.getTitleSnapshot();return(KF.bells!==e||KF.titles!==t)&&(KF={bells:e,titles:t}),KF}function YF(){return(0,B.useSyncExternalStore)(LF.subscribe,qF,()=>UF)}function XF(){return(0,B.useSyncExternalStore)(LF.subscribe,JF,()=>WF)}var ZF=`treeport-last-workspace-route`,QF=`treeport-last-project-terminal:`;function $F(e,t){return e!==null&&e===t}function eI(e,t,n,r){return $F(e,n)||t!==null&&t===r}function tI(e){return encodeURIComponent(e)}function nI(e){return{kind:`project`,pathname:`/projects/${tI(e)}`,projectId:e}}function rI(e,t){return{kind:`worktree`,pathname:`/projects/${tI(e)}/worktrees/${tI(t)}`,projectId:e,worktreeId:t}}function iI(e,t,n){return{kind:`terminal`,pathname:`/projects/${tI(e)}/worktrees/${tI(t)}/terminals/${tI(n)}`,projectId:e,worktreeId:t,terminalId:n}}function aI(e,t,n){return{kind:`panel`,pathname:`/projects/${tI(e)}/worktrees/${tI(t)}/panels/${tI(n)}`,projectId:e,worktreeId:t,panelId:n}}function oI(e){let t=e.worktrees[0];if(!t)return nI(e.id);let n=t.terminals[0];return n?iI(e.id,t.id,n.id):rI(e.id,t.id)}function sI(e,t){if(t)for(let n of e.worktrees){let r=n.terminals.find(e=>e.id===t);if(r)return iI(e.id,n.id,r.id)}return oI(e)}function cI(e,t){let n=t.terminals[0];return n?iI(e.id,t.id,n.id):rI(e.id,t.id)}function lI(e,t){for(let n of e){let e=n.worktrees.find(e=>e.id===t.worktreeId);if(e?.panels.some(e=>e.kind!==`terminal`&&e.id===t.id))return aI(n.id,e.id,t.id)}return null}function uI(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 iI(n.id,e.id,t.id)}return null}function dI(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?iI(r.id,t.id,i.id):rI(r.id,t.id)}function fI(e,t){if(t.kind===`root`)return{project:null,worktree:null,terminal:null,panel:null};let n=e.find(e=>e.id===t.projectId)??null;if(!n||t.kind===`project`)return{project:n,worktree:null,terminal:null,panel:null};let r=n.worktrees.find(e=>e.id===t.worktreeId)??null;return!r||t.kind===`worktree`?{project:n,worktree:r,terminal:null,panel:null}:t.kind===`panel`?{project:n,worktree:r,terminal:null,panel:r.panels.find(e=>e.kind!==`terminal`&&e.id===t.panelId)??null}:{project:n,worktree:r,terminal:r.terminals.find(e=>e.id===t.terminalId)??null,panel:null}}function pI(e){try{return decodeURIComponent(e)}catch{return null}}function mI(e){if(e===`/`)return{kind:`root`,pathname:`/`};let t=e.split(`/`).filter(Boolean);if(t[0]!==`projects`)return null;let n=t[1]?pI(t[1]):null;if(!n)return null;if(t.length===2)return nI(n);if(t[2]!==`worktrees`)return null;let r=t[3]?pI(t[3]):null;if(!r)return null;if(t.length===4)return rI(n,r);let i=t[5]?pI(t[5]):null;return!i||t.length!==6?null:t[4]===`terminals`?iI(n,r,i):t[4]===`panels`?aI(n,r,i):null}function hI(e){return e[0]?oI(e[0]):{kind:`root`,pathname:`/`}}function gI(e,t){if(!t||t.kind===`root`)return hI(e);let n=e.find(e=>e.id===t.projectId);if(!n)return hI(e);if(t.kind===`project`)return n.worktrees.length?oI(n):nI(n.id);let r=n.worktrees.find(e=>e.id===t.worktreeId);if(!r)return n.worktrees[0]?cI(n,n.worktrees[0]):nI(n.id);if(t.kind===`worktree`)return cI(n,r);if(t.kind===`panel`){let e=r.panels.find(e=>e.kind!==`terminal`&&e.id===t.panelId);return e?aI(n.id,r.id,e.id):cI(n,r)}let i=r.terminals.find(e=>e.id===t.terminalId);return i?iI(n.id,r.id,i.id):cI(n,r)}function _I(e,t,n){let r=mI(t),i;if(r?.kind===`root`&&e.length&&n){let t=mI(n);i=t?.kind!==`root`&&e.some(e=>e.id===t?.projectId)?gI(e,t):hI(e)}else i=gI(e,r);return{target:i,selection:fI(e,i),canonical:i.pathname===t}}function vI(e,{operation:t}){let n=HN(e),r=[n.message,n.recoveryHint,n.requestId?`Reference: ${n.requestId}.`:null].filter(e=>!!e).join(` `);La.error(`Couldn’t ${t}`,{description:r})}function yI(e){let t=new Date(e);if(Number.isNaN(t.getTime()))return e;let n=new Date,r=t.toDateString()===n.toDateString();return new Intl.DateTimeFormat(void 0,r?{hour:`numeric`,minute:`2-digit`}:{month:`short`,day:`numeric`,hour:`numeric`,minute:`2-digit`}).format(t)}function bI({projects:e,navigateToWorkspace:t,open:n,onOpenChange:r}){let{bells:i,titles:a}=XF(),[o,s]=(0,B.useState)(()=>new Set),c=(0,B.useMemo)(()=>e.flatMap(t=>t.worktrees.flatMap(n=>n.terminals.flatMap(r=>{let o=i.get(r.id),s=uI(e,r);return o?.unread&&s?[{terminalId:r.id,sequence:o.sequence,occurredAt:o.at,title:a.get(r.id)??r.name,context:`${t.name} · ${n.name}`,target:s}]:[]}))).sort((e,t)=>t.occurredAt.localeCompare(e.occurredAt)||e.terminalId.localeCompare(t.terminalId)),[i,e,a]),l=c.length,u=l===0?`Notifications, no unread notifications`:`Notifications, ${l} unread`,d=async(e,t,n)=>{s(t=>new Set(t).add(e)),await LF.acknowledgeBell(e,t).catch(e=>{vI(e,{operation:`mark notification for terminal “${n}” as read`})}),s(t=>{let n=new Set(t);return n.delete(e),n})};return(0,V.jsxs)(YS,{modal:!0,open:n,onOpenChange:r,children:[(0,V.jsx)(XS,{asChild:!0,children:(0,V.jsxs)(X,{type:`button`,size:`icon`,variant:`ghost`,className:`icon-button text-zinc-400 hover:bg-white/5 hover:text-zinc-100`,"aria-label":u,children:[(0,V.jsx)(Yy,{}),l>0?(0,V.jsx)(Ab,{size:`counter`,className:`pointer-events-none absolute -top-0.5 -right-0.5`,"aria-hidden":!0,children:l>99?`99+`:l}):null]})}),(0,V.jsxs)(ZS,{align:`end`,className:`flex max-h-[min(26rem,calc(100dvh-1rem))] w-[min(22rem,calc(100vw-1rem))] touch-manipulation flex-col overflow-hidden p-0 select-none`,"aria-label":`Notifications`,children:[(0,V.jsx)(`div`,{className:`shrink-0 px-3 pt-3 pb-2`,children:(0,V.jsx)(`h2`,{className:`text-sm font-semibold`,children:`Notifications`})}),c.length===0?(0,V.jsxs)(Mb,{className:`min-h-28 p-4`,children:[(0,V.jsx)(Nb,{children:`All caught up`}),(0,V.jsx)(Pb,{children:`No unread notifications.`})]}):(0,V.jsx)(`div`,{className:`min-h-0 overflow-y-auto overscroll-contain px-1.5 pb-1.5`,children:(0,V.jsx)(`ul`,{role:`list`,className:`flex flex-col gap-0.5`,children:c.map(e=>(0,V.jsx)(`li`,{className:`min-w-0`,children:(0,V.jsxs)(`button`,{type:`button`,className:`w-full min-w-0 cursor-default rounded-md px-2 py-2 text-left outline-none hover:bg-white/5 focus-visible:bg-white/5 focus-visible:outline-2 focus-visible:outline-cyan-400 disabled:opacity-45`,disabled:o.has(e.terminalId),"aria-label":`Open ${e.title}`,onClick:()=>{r(!1),d(e.terminalId,e.sequence,e.title).then(()=>t(e.target))},children:[(0,V.jsx)(`h3`,{className:`truncate text-sm font-medium text-zinc-100`,children:e.title}),(0,V.jsxs)(`div`,{className:`flex min-w-0 items-baseline gap-1.5 text-xs text-zinc-500`,children:[(0,V.jsx)(`p`,{className:`min-w-0 truncate`,children:e.context}),(0,V.jsx)(`span`,{className:`shrink-0`,"aria-hidden":!0,children:`·`}),(0,V.jsx)(`time`,{dateTime:e.occurredAt,className:`shrink-0 tabular-nums`,children:yI(e.occurredAt)})]})]})},e.terminalId))})})]})]})}function xI(e,t,n){for(let r of e)for(let e of r.worktrees){let r=e.terminals.find(e=>e.id===n);if(r)return t.get(n)??r.name}return null}function SI({projects:e,selectedTerminalId:t}){let{bells:n,titles:r}=XF(),i=(0,B.useRef)({projects:e,selectedTerminalId:t,titles:r,presence:{focused:document.hasFocus(),visible:document.visibilityState===`visible`}});i.current.projects=e,i.current.selectedTerminalId=t,i.current.titles=r;let a=()=>{let e=i.current,t=e.selectedTerminalId;if(!t||!e.presence.focused||!e.presence.visible)return;let n=LF.getBellSnapshot().get(t);if(!n?.unread)return;let r=xI(e.projects,e.titles,t);LF.acknowledgeBell(t,n.sequence).catch(e=>{vI(e,{operation:r?`acknowledge notification for terminal “${r}”`:`acknowledge terminal notification`})})};return(0,B.useEffect)(()=>{let e=()=>{i.current.presence={focused:document.hasFocus(),visible:document.visibilityState===`visible`},a()};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)(()=>{a()},[n,t]),(0,B.useEffect)(()=>LF.subscribeBellEvents(e=>{let t=i.current;if(t.selectedTerminalId===e.terminalId&&t.presence.focused&&t.presence.visible){let n=xI(t.projects,LF.getTitleSnapshot(),e.terminalId);LF.acknowledgeBell(e.terminalId,e.sequence).catch(e=>{vI(e,{operation:n?`acknowledge notification for terminal “${n}”`:`acknowledge terminal notification`})});return}window.treeportDesktop?.requestAttention()}),[]),null}function CI({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:`M14 8a.75.75 0 0 1-.75.75H4.56l3.22 3.22a.75.75 0 1 1-1.06 1.06l-4.5-4.5a.75.75 0 0 1 0-1.06l4.5-4.5a.75.75 0 0 1 1.06 1.06L4.56 7.25h8.69A.75.75 0 0 1 14 8Z`,clipRule:`evenodd`}))}var wI=B.forwardRef(CI);function TI({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 EI=B.forwardRef(TI);function DI({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 8a.75.75 0 0 1 .75-.75h8.69L8.22 4.03a.75.75 0 0 1 1.06-1.06l4.5 4.5a.75.75 0 0 1 0 1.06l-4.5 4.5a.75.75 0 0 1-1.06-1.06l3.22-3.22H2.75A.75.75 0 0 1 2 8Z`,clipRule:`evenodd`}))}var OI=B.forwardRef(DI);function kI({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 AI=B.forwardRef(kI);function jI({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 MI=B.forwardRef(jI);function NI({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:`M7.25 3.688a8.035 8.035 0 0 0-4.872-.523A.48.48 0 0 0 2 3.64v7.994c0 .345.342.588.679.512a6.02 6.02 0 0 1 4.571.81V3.688ZM8.75 12.956a6.02 6.02 0 0 1 4.571-.81c.337.075.679-.167.679-.512V3.64a.48.48 0 0 0-.378-.475 8.034 8.034 0 0 0-4.872.523v9.268Z`}))}var PI=B.forwardRef(NI);function FI({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 II=B.forwardRef(FI);function LI({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 RI=B.forwardRef(LI);function zI({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 BI=B.forwardRef(zI);function VI({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 HI=B.forwardRef(VI);function UI({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 WI=B.forwardRef(UI);function GI({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 KI=B.forwardRef(GI);function qI({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 JI=B.forwardRef(qI);function YI({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:`M3.757 4.5c.18.217.376.42.586.608.153-.61.354-1.175.596-1.678A5.53 5.53 0 0 0 3.757 4.5ZM8 1a6.994 6.994 0 0 0-7 7 7 7 0 1 0 7-7Zm0 1.5c-.476 0-1.091.386-1.633 1.427-.293.564-.531 1.267-.683 2.063A5.48 5.48 0 0 0 8 6.5a5.48 5.48 0 0 0 2.316-.51c-.152-.796-.39-1.499-.683-2.063C9.09 2.886 8.476 2.5 8 2.5Zm3.657 2.608a8.823 8.823 0 0 0-.596-1.678c.444.298.842.659 1.182 1.07-.18.217-.376.42-.586.608Zm-1.166 2.436A6.983 6.983 0 0 1 8 8a6.983 6.983 0 0 1-2.49-.456 10.703 10.703 0 0 0 .202 2.6c.72.231 1.49.356 2.288.356.798 0 1.568-.125 2.29-.356a10.705 10.705 0 0 0 .2-2.6Zm1.433 1.85a12.652 12.652 0 0 0 .018-2.609c.405-.276.78-.594 1.117-.947a5.48 5.48 0 0 1 .44 2.262 7.536 7.536 0 0 1-1.575 1.293Zm-2.172 2.435a9.046 9.046 0 0 1-3.504 0c.039.084.078.166.12.244C6.907 13.114 7.523 13.5 8 13.5s1.091-.386 1.633-1.427c.04-.078.08-.16.12-.244Zm1.31.74a8.5 8.5 0 0 0 .492-1.298c.457-.197.893-.43 1.307-.696a5.526 5.526 0 0 1-1.8 1.995Zm-6.123 0a8.507 8.507 0 0 1-.493-1.298 8.985 8.985 0 0 1-1.307-.696 5.526 5.526 0 0 0 1.8 1.995ZM2.5 8.1c.463.5.993.935 1.575 1.293a12.652 12.652 0 0 1-.018-2.608 7.037 7.037 0 0 1-1.117-.947 5.48 5.48 0 0 0-.44 2.262Z`,clipRule:`evenodd`}))}var XI=B.forwardRef(YI);function ZI({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 QI=B.forwardRef(ZI);function $I({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 eL=B.forwardRef($I);function tL({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 nL=B.forwardRef(tL);function rL({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.354 2a2 2 0 0 0-1.857 1.257l-.338.845C3.43 4.035 3.71 4 4 4h8c.29 0 .571.035.84.102l-.337-.845A2 2 0 0 0 10.646 2H5.354Z`}),B.createElement(`path`,{fillRule:`evenodd`,d:`M2 13a2 2 0 0 1 2-2h8a2 2 0 1 1 0 4H4a2 2 0 0 1-2-2Zm10.75 0a.75.75 0 1 1-1.5 0 .75.75 0 0 1 1.5 0ZM9 13.75a.75.75 0 1 0 0-1.5.75.75 0 0 0 0 1.5ZM4 5.5a2 2 0 1 0 0 4h8a2 2 0 1 0 0-4H4Zm8 2.75a.75.75 0 1 0 0-1.5.75.75 0 0 0 0 1.5ZM9.75 7.5a.75.75 0 1 1-1.5 0 .75.75 0 0 1 1.5 0Z`,clipRule:`evenodd`}))}var iL=B.forwardRef(rL);function aL({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 oL=B.forwardRef(aL);function sL({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 12V4a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2Zm1.5-5.5V12a.5.5 0 0 0 .5.5h8a.5.5 0 0 0 .5-.5V6.5A.5.5 0 0 0 12 6H4a.5.5 0 0 0-.5.5Zm.75-1.75a.75.75 0 1 0 0-1.5.75.75 0 0 0 0 1.5ZM7 4a.75.75 0 1 1-1.5 0A.75.75 0 0 1 7 4Zm1.25.75a.75.75 0 1 0 0-1.5.75.75 0 0 0 0 1.5Z`,clipRule:`evenodd`}))}var cL=B.forwardRef(sL);function lL({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 uL=B.forwardRef(lL);function dL({className:e,type:t,...n}){return(0,V.jsx)(`input`,{type:t,"data-slot":`input`,className:W(`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})}var fL=Zv({ticket:q().optional(),error:Zv({message:q().optional()}).optional()}),pL=(e,t)=>AN(e,t);function mL(e,t,n,r=pL){let i=crypto.randomUUID(),a=!1,o=null,s=t,c=!1,l=!1,u=!1,d=null,f=[],p=e=>{n.message({type:`browserUnavailable`,message:e instanceof Error?e.message:String(e),installCommand:null})},m=()=>{a||o||(o=setTimeout(()=>{o=null,h().catch(e=>{u=!1,p(e),m()})},500))},h=async()=>{if(a||u)return;u=!0;let t=await fetch(`/api/panels/${encodeURIComponent(e)}/browser-ticket`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({clientId:i,visible:s})}),o=fL.parse(await t.json());if(!t.ok||!o.ticket)throw Error(o.error?.message??`Could not attach hosted browser`);if(a){u=!1;return}let h=r(`/browsers`,{path:sP,transports:[`websocket`],forceNew:!0,reconnection:!1,auth:{ticket:o.ticket,protocolVersion:3}});d=h,u=!1,h.on(`message`,e=>{if(d!==h)return;let t=YN.safeParse(e);if(!t.success){h.disconnect();return}let r=t.data;if(n.message(r),r.type===`ready`)for(c=!0,l=!0,h.emit(`command`,{type:`setVisible`,visible:s});f.length;)h.emit(`command`,f.shift())}),h.on(`frame`,e=>{if(d!==h)return;let t=XN.safeParse(e);t.success?n.frame(t.data):h.disconnect()}),h.on(`disconnect`,()=>{d===h&&(d=null,c=!1,f.length=0,m())}),h.on(`connect_error`,e=>{d===h&&(p(e),h.disconnect(),d=null,c=!1,m())})};return h().catch(e=>{u=!1,p(e),m()}),{send(e){let t=aP(e);if(!(!t||a)){if(d?.connected&&c){d.emit(`command`,t);return}l||(f.push(t),f.length>32&&f.shift())}},setVisible(e){s=e,c&&d?.emit(`command`,{type:`setVisible`,visible:e})},dispose(){c&&d?.emit(`command`,{type:`setVisible`,visible:!1}),a=!0,f.length=0,o&&clearTimeout(o),d?.disconnect()}}}var hL=(0,B.createContext)({computerId:null,localBrowser:!1});function gL(){return(0,B.useContext)(hL)}var _L=J({ticket:q().min(32).max(256),challenge:q().min(32).max(256)});async function vL(e,t){let n=await fetch(`/api/panels/${encodeURIComponent(e)}/browser-owner-ticket`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({clientId:t})});if(!n.ok){let e=Zv({error:Zv({message:q()})}).safeParse(await n.json().catch(()=>null));throw Error(e.success?e.data.error.message:`Could not request Browser ownership.`)}return _L.parse(await n.json())}function yL(e,t,n,r){let i=AN(`/browser-owners`,{path:sP,transports:[`websocket`],forceNew:!0,reconnection:!1,auth:{ticket:t.ticket,protocolVersion:3,endpoint:n,challenge:t.challenge}}),a=!1,o=!1,s=null;return new Promise((t,n)=>{let c=e=>{a||(a=!0,i.disconnect(),n(e instanceof Error?e:Error(String(e))))};i.on(`ownerMessage`,n=>{let l=iP.safeParse(n);if(!l.success){c(Error(`The Browser owner protocol is invalid.`));return}let u=l.data;if(u.type===`claimRejected`){c(Error(u.message));return}if(u.type===`closed`){a?r.closed(u.reason):c(Error(u.reason));return}if(u.type===`claimGranted`){if(a||u.panelId!==e){i.disconnect();return}a=!0;let n=0,r=u.generation;s=r;let c=e=>{!o&&i.connected&&i.emit(`ownerMessage`,e)};t({generation:r,resumed:u.resumed,initialState:u.state,sendReady(e){c({type:`ready`,generation:r,revision:++n,state:e})},sendState(e){c({type:`state`,generation:r,revision:++n,state:e})},sendPopup(e){c({type:`popup`,generation:r,url:e})},sendCrash(e){c({type:`crashed`,generation:r,message:e})},takeControl(){c({type:`takeControl`,generation:r})},dispose(){c({type:`released`,generation:r}),o=!0,i.disconnect()}});return}if(!((u.type===`runtimeControl`||u.type===`closeRequest`)&&u.generation!==s)){if(u.type===`runtimeControl`){r.setRuntimeControl(u.controller,u.retainPaint).then(e=>bL(i,{type:`runtimeControlResult`,generation:u.generation,requestId:u.requestId,accepted:e}),()=>bL(i,{type:`runtimeControlResult`,generation:u.generation,requestId:u.requestId,accepted:!1}));return}u.type===`closeRequest`&&r.requestClose(u.force).then(e=>bL(i,{type:`closeResult`,generation:u.generation,requestId:u.requestId,canClose:e}),()=>bL(i,{type:`closeResult`,generation:u.generation,requestId:u.requestId,canClose:!1}))}}),i.on(`connect_error`,c),i.on(`disconnect`,()=>{a?o||r.disconnected():c(Error(`The Browser owner connection closed.`))})})}function bL(e,t){e.connected&&e.emit(`ownerMessage`,t)}function xL(e,t,n=e.isLoading()){let r=e.getURL(),i=n&&r===`about:blank`&&t!==`about:blank`?t:r||t,a=i===`about:blank`||GN.safeParse(i).success?i:t,o=e.getBoundingClientRect();return{url:a,title:e.getTitle(),loading:n,canGoBack:e.canGoBack(),canGoForward:e.canGoForward(),viewport:{width:Math.max(0,Math.min(3840,Math.round(o.width))),height:Math.max(0,Math.min(2160,Math.round(o.height)))}}}function SL({panel:e,inputBlocked:t,onConnection:n,onMessage:r,onPaintRetentionChange:i,onFocusSurface:a}){let{dismiss:o}=sf(),s=(0,B.useRef)(null),c=(0,B.useRef)(t);c.current=t;let l=(0,B.useRef)(e),u=(0,B.useRef)(crypto.randomUUID()),[d,f]=(0,B.useState)(null),p=(0,B.useRef)(null),m=(0,B.useRef)(!1),h=(0,B.useRef)(()=>void 0),g=(0,B.useCallback)(t=>{s.current=t,t&&(t.setAttribute(`partition`,`persist:treeport-browser`),t.setAttribute(`allowpopups`,`true`),t.src=`about:blank#treeport-panel=${encodeURIComponent(e.id)}`)},[e.id]);return(0,B.useEffect)(()=>{let t=s.current,d=window.treeportDesktop;if(!t||!d)return;let g=!1,_=!1,v=!1,y=!1,b=!1,x=l.current.url,S=null,C=null,w=null,T=null,E=null,D=!1,O=!1,k=e=>{g||r({type:`browserUnavailable`,message:e instanceof Error?e.message:String(e),installCommand:null})},A=e=>({...e,controlled:p.current===null,hasController:!0,controller:p.current??`you`}),j=(e=`state`,n=!0)=>{if(g||!v)return;let i=xL(t,x,b);x=i.url,r({type:e,state:A(i)}),n&&(e===`ready`?C?.sendReady(i):C?.sendState(i))},M=()=>{b=!0,j()},N=()=>{b=!1,j()},P=()=>j(),ee=()=>{p.current=null,m.current=!1,g||f(null),d.setBrowserInputControl(e.id,!1).catch(()=>!1),i(!1),S=null},F=async(n,r)=>{let a=p.current,o=m.current,s=n!==`none`,c=s||r;if(!await d.setBrowserInputControl(e.id,c).then(e=>e,()=>!1)||g)return!1;if(!await i(r).then(e=>e,()=>!1)||g)return await d.setBrowserInputControl(e.id,a!==null).catch(()=>!1),await i(o).catch(()=>!1),!1;if(s&&a===null&&(S=document.activeElement instanceof HTMLElement&&document.activeElement!==t?document.activeElement:null),r){let e=t.closest(`section`),n=e?.inert===!0;n&&(e.inert=!1),t.focus({preventScroll:!0}),n&&(e.inert=!0)}return!s&&c&&(!await d.setBrowserInputControl(e.id,!1).then(e=>e,()=>!1)||g)?(await d.setBrowserInputControl(e.id,a!==null).catch(()=>!1),await i(o).catch(()=>!1),!1):(p.current=s?n:null,m.current=r,f(s?n:null),s||(a===`other`&&t.checkVisibility()&&!t.closest(`[inert]`)?t.focus({preventScroll:!0}):S?.isConnected&&!S.closest(`[inert]`)&&S.focus({preventScroll:!0}),S=null),j(`controlChanged`,!1),!0)},I=()=>{let e=`The local Browser page stopped.`;C?.sendCrash(e),ee(),r({type:`browserCrashed`,message:e})},te={send(t){g||!y||p.current!==null||t.type!==`navigate`&&t.type!==`back`&&t.type!==`forward`&&t.type!==`reload`&&t.type!==`stop`||(t.type===`navigate`?(x=t.url,M()):t.type===`back`||t.type===`forward`||t.type===`reload`?M():N(),d.browserCommand(e.id,t).then(e=>{!e.ok&&e.error&&r({type:`navigationError`,message:e.error})}))},setVisible(){},dispose(){g||(g=!0,ee(),C?.dispose(),d.disposeBrowser(e.id))}};n(te);let L=e=>{g||(C=null,h.current=()=>void 0,k(e),E===null&&(E=window.setTimeout(()=>{E=null,ne()},500)))},ne=()=>{g||_||C||!D||(_=!0,(async()=>{let n=await vL(e.id,u.current);if((!w||T!==n.challenge)&&(w=await d.registerBrowser(e.id,t.getWebContentsId(),n.challenge),T=n.challenge),!w||w.panelId!==e.id)throw Error(`The desktop app rejected this Browser.`);let i=null;if(i=await yL(e.id,n,w.endpoint,{setRuntimeControl:F,requestClose:t=>d.requestBrowserClose(e.id,t),closed(t){g||(ee(),r({type:`closed`,reason:t}),d.disposeBrowser(e.id))},disconnected(){(!C||C===i)&&L(`The local Browser owner disconnected.`)}}),g){i.dispose();return}if(C=i,h.current=()=>C?.takeControl(),O||i.resumed){b=t.isLoading(),y=!0,v=!0,j(`ready`);return}O=!0;let a=i.initialState.url;if(x=a,b=a!==`about:blank`,v=!0,a===`about:blank`){y=!0,j(`ready`);return}j();let o=await d.browserCommand(e.id,{type:`navigate`,url:a});g||(b=!1,y=!0,j(`ready`),!o.ok&&o.error&&r({type:`navigationError`,message:o.error}))})().catch(e=>{w=null,T=null,L(e)}).finally(()=>{_=!1}))},R=()=>{c.current||p.current!==null||(o(),a())},re=d.onBrowserFocus(t=>{t===e.id&&R()}),z=[`did-navigate`,`did-navigate-in-page`,`page-title-updated`];t.addEventListener(`focus`,R),t.addEventListener(`did-start-loading`,M),t.addEventListener(`did-stop-loading`,N),t.addEventListener(`render-process-gone`,I);for(let e of z)t.addEventListener(e,P);let ie=()=>{D=!0,ne()};t.addEventListener(`dom-ready`,ie);let ae=new ResizeObserver(()=>j());ae.observe(t);let oe=d.onBrowserPopup(t=>{!g&&t.panelId===e.id&&C?.sendPopup(t.url)});return()=>{n(null),h.current=()=>void 0,E!==null&&window.clearTimeout(E),ae.disconnect(),re(),oe(),t.removeEventListener(`focus`,R),t.removeEventListener(`did-start-loading`,M),t.removeEventListener(`did-stop-loading`,N),t.removeEventListener(`render-process-gone`,I);for(let e of z)t.removeEventListener(e,P);t.removeEventListener(`dom-ready`,ie),te.dispose()}},[n,r,i,a,o,e.id]),(0,V.jsxs)(`div`,{className:`relative size-full`,children:[(0,V.jsx)(`webview`,{ref:g,"aria-label":`Browser page`,className:`flex size-full bg-zinc-950 ${t||d?`pointer-events-none`:``}`}),d?(0,V.jsx)(`button`,{type:`button`,className:`absolute inset-0 cursor-pointer bg-transparent`,"aria-label":`Take control of Browser`,title:`Take control of Browser`,onClick:()=>h.current()}):null]})}var CL=J({supported:Vv(),message:q().nullable(),listeners:Yv(J({pid:Lv().int(),command:q(),host:q(),port:Lv().int().min(1).max(65535),terminalId:q().nullable()}))});function wL(e){let t=e.trim(),n=/^[a-z][a-z\d+.-]*:\/\//i.test(t)?t:`http://${t}`,r=GN.safeParse(n);return r.success?new URL(r.data):null}function TL(e){let t=e.host;[`*`,`0.0.0.0`,`::`,`::1`,`127.0.0.1`].includes(t)?t=`localhost`:t.includes(`:`)&&(t=`[${t}]`);let n=`http://${t}:${e.port}/`;return GN.safeParse(n).success?new URL(n):null}function EL({panel:e,active:t,autoFocusBlocked:n,inputBlocked:r,onLoadingChange:i,onFocusSurface:a}){let o=(0,B.useRef)(null),s=(0,B.useRef)(null),c=(0,B.useRef)(null),l=(0,B.useRef)(null),u=(0,B.useRef)(null),d=(0,B.useRef)({width:1280,height:800}),f=(0,B.useRef)(!1),p=(0,B.useRef)(!1),m=(0,B.useRef)(!1),h=(0,B.useRef)(e.url===`about:blank`),g=(0,B.useRef)(null),[_,v]=(0,B.useState)(0),[y,b]=(0,B.useState)(0),[x,S]=(0,B.useState)(!1),[C,w]=(0,B.useState)(null),[T,E]=(0,B.useState)(e.url===`about:blank`?``:e.url),[D,O]=(0,B.useState)(!1),[k,A]=(0,B.useState)(null),[j,M]=(0,B.useState)(null),[N,P]=(0,B.useState)(!1),[ee,F]=(0,B.useState)(null),[I,te]=(0,B.useState)(!1),{localBrowser:L,computerId:ne}=gL(),R=(0,B.useCallback)(e=>{l.current?.send(e)},[]),re=(0,B.useCallback)(()=>{(s.current??o.current?.querySelector(`webview`))?.focus({preventScroll:!0})},[]),z=(0,B.useCallback)(()=>{c.current?.focus({preventScroll:!0}),c.current?.select()},[]),ie=(0,B.useCallback)(t=>{if(t.type===`ready`||t.type===`state`||t.type===`controlChanged`){let n=u.current?.url??e.url;u.current=t.state,w(t.state),t.type===`ready`&&b(e=>e+1),i(e.id,t.state.loading),M(null),P(!1),m.current||A(null);let r=g.current,a=GN.safeParse(t.state.url).success;if(!(r===null||a&&(t.state.url===r.targetUrl||t.state.url!==r.startUrl)))return;g.current=null;let o=t.state.url===`about:blank`?``:a?t.state.url:null;if(o===null)return;if(m.current){if(document.activeElement===c.current||t.state.url===n)return;m.current=!1,A(null)}E(o);return}if(g.current=null,i(e.id,!1),P(!1),t.type===`browserUnavailable`){M({message:t.message,installCommand:t.installCommand});return}A(t.type===`closed`?t.reason:t.message)},[i,e.id]),ae=(0,B.useCallback)(e=>{d.current={width:e.width,height:e.height};let t=s.current,n=t?.getContext(`2d`,{alpha:!1});if(!t||!n){R({type:`frameAck`,sequence:e.sequence});return}let r=e.data.slice();createImageBitmap(new Blob([r],{type:e.mimeType})).then(r=>{(t.width!==e.width||t.height!==e.height)&&(t.width=e.width,t.height=e.height),n.drawImage(r,0,0,e.width,e.height),r.close()}).finally(()=>R({type:`frameAck`,sequence:e.sequence}))},[R]);(0,B.useEffect)(()=>{if(L)return;let t=mL(e.id,!1,{message:ie,frame:ae});return l.current=t,()=>{l.current===t&&(l.current=null),t.dispose()}},[_,L,e.id,ae,ie]);let oe=(0,B.useCallback)(e=>{l.current=e},[]),se=(0,B.useCallback)(async e=>{if(S(e),!e)return!0;let t=null,n=await Promise.race([new Promise(e=>window.requestAnimationFrame(()=>window.requestAnimationFrame(()=>e(!0)))),new Promise(e=>{t=window.setTimeout(()=>e(!1),2e3)})]);t&&window.clearTimeout(t);let r=o.current,i=r?.querySelector(`webview`);if(!n||!r?.isConnected||!i?.isConnected||!r.checkVisibility()||!i.checkVisibility())return!1;let a=r.getBoundingClientRect(),s=i.getBoundingClientRect();return a.width>0&&a.height>0&&s.width>0&&s.height>0},[]);(0,B.useEffect)(()=>{L||l.current?.setVisible(t&&!r)},[t,r,L]),(0,B.useEffect)(()=>{let e=s.current;if(L||!e||!t)return;let n=null,r=new ResizeObserver(([e])=>{n&&clearTimeout(n),!(!e||e.contentRect.width<=0||e.contentRect.height<=0)&&(n=setTimeout(()=>{let t={width:Math.max(320,Math.min(3840,Math.round(e.contentRect.width))),height:Math.max(200,Math.min(2160,Math.round(e.contentRect.height)))};d.current=t,R({type:`resize`,...t})},100))});return r.observe(e),()=>{r.disconnect(),n&&clearTimeout(n)}},[t,L,R]),(0,B.useEffect)(()=>{if(!t||n||!h.current||u.current===null)return;if(u.current.url!==`about:blank`){h.current=!1;return}let e=0,r=null,i=()=>{if(document.querySelector(`[role="dialog"], [role="alertdialog"]`)){e=window.requestAnimationFrame(i);return}r=setTimeout(()=>{let e=c.current;!e||e.value!==``||u.current?.url!==`about:blank`||(z(),h.current=!1)},50)};return e=window.requestAnimationFrame(i),()=>{window.cancelAnimationFrame(e),r&&clearTimeout(r)}},[t,y,n,z]),(0,B.useEffect)(()=>{if(!t)return;let e=e=>{!(/Mac|iPhone|iPad|iPod/.test(navigator.platform)?e.metaKey&&!e.ctrlKey:e.ctrlKey&&!e.metaKey)||e.altKey||e.shiftKey||e.key.toLowerCase()!==`l`||n||document.querySelector(`[role="dialog"], [role="alertdialog"]`)||(e.preventDefault(),e.stopPropagation(),z())};return document.addEventListener(`keydown`,e,!0),()=>document.removeEventListener(`keydown`,e,!0)},[t,n,z]),(0,B.useEffect)(()=>{let e=window.treeportDesktop;if(!(!t||!e))return e.onCommand(e=>{e!==`focus-location`||n||document.querySelector(`[role="dialog"], [role="alertdialog"]`)||z()})},[t,n,z]);let ce=(0,B.useCallback)(async()=>{te(!0);try{let t=await fetch(`/api/panels/${encodeURIComponent(e.id)}/network/listeners`),n=Zv({discovery:CL}).parse(await t.json());if(!t.ok)throw Error(`Could not scan for development servers`);F(n.discovery)}catch(e){F({supported:!1,message:e instanceof Error?e.message:String(e),listeners:[]})}finally{te(!1)}},[e.id]),le=t=>{let n=wL(t);if(!n){m.current=!0,A(`Enter an HTTP or HTTPS address without credentials.`),c.current?.focus({preventScroll:!0});return}let r=n.href;A(null),M(null),m.current=!1,g.current={startUrl:u.current?.url??e.url,targetUrl:r},E(r),R({type:`takeControl`}),R({type:`navigate`,url:r}),re()},ue=e=>{let t=e.currentTarget.getBoundingClientRect(),n=d.current,r=Math.min(t.width/n.width,t.height/n.height),i=n.width*r,a=n.height*r,o=t.left+(t.width-i)/2,s=t.top+(t.height-a)/2;return{x:Math.max(0,Math.min(n.width,(e.clientX-o)/r)),y:Math.max(0,Math.min(n.height,(e.clientY-s)/r))}},de=e=>e===2?`right`:e===1?`middle`:`left`,fe=e=>{e.preventDefault(),le(T)},pe=(e,t)=>{e.preventDefault(),t===`down`&&R({type:`takeControl`}),R({type:`key`,phase:t,key:e.key})},me=e=>{e.preventDefault(),R({type:`takeControl`}),R({type:`wheel`,deltaX:e.deltaX,deltaY:e.deltaY})},he=new Map;for(let e of ee?.listeners??[]){let t=TL(e);if(!t)continue;let n=he.get(t.href);(!n||!n.listener.terminalId&&e.terminalId)&&he.set(t.href,{url:t,listener:e})}let ge=[...he.values()].sort((e,t)=>e.listener.port-t.listener.port||e.url.href.localeCompare(t.url.href));return(0,V.jsxs)(`section`,{ref:o,className:t?`relative z-10 flex h-full min-h-0 flex-col`:x?`pointer-events-none absolute inset-0 z-0 flex h-full min-h-0 flex-col opacity-0`:`hidden`,"aria-label":e.title,"aria-hidden":!t||void 0,inert:!t||void 0,children:[(0,V.jsxs)(`form`,{className:`flex min-w-0 items-center gap-1.5 border-b border-white/8 bg-zinc-900 px-2 py-1.5`,"aria-label":`Browser controls`,onSubmit:fe,children:[(0,V.jsx)(X,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":`Go back`,title:`Go back`,disabled:!C?.canGoBack||!C.controlled,onClick:()=>R({type:`back`}),children:(0,V.jsx)(wI,{})}),(0,V.jsx)(X,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":`Go forward`,title:`Go forward`,disabled:!C?.canGoForward||!C.controlled,onClick:()=>R({type:`forward`}),children:(0,V.jsx)(OI,{})}),C?.loading?(0,V.jsx)(X,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":`Stop loading`,title:`Stop loading`,disabled:!C.controlled,onClick:()=>R({type:`stop`}),children:(0,V.jsx)(uL,{})}):(0,V.jsx)(X,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":`Reload application`,title:`Reload application`,disabled:!C?.controlled,onClick:()=>R({type:`reload`}),children:(0,V.jsx)(EI,{})}),(0,V.jsx)(dL,{ref:c,type:`text`,inputMode:`url`,autoCapitalize:`none`,spellCheck:!1,name:`url`,"aria-label":`Application URL`,className:`rounded-full focus:ring-2 focus:ring-cyan-400`,placeholder:`localhost:3000`,maxLength:4096,value:T,onPointerDown:e=>{p.current=e.button===0&&document.activeElement!==e.currentTarget},onPointerUp:e=>{let t=p.current;p.current=!1,t&&e.currentTarget.selectionStart===e.currentTarget.selectionEnd&&e.currentTarget.select()},onPointerCancel:()=>{p.current=!1},onChange:e=>{m.current=!0,E(e.target.value)},onKeyDown:t=>{if(t.key!==`Escape`||t.shiftKey||t.altKey||t.metaKey||t.ctrlKey)return;if(t.preventDefault(),!m.current){re();return}let n=g.current?.targetUrl??u.current?.url??e.url;m.current=!1,A(null),E(n===`about:blank`?``:n),window.requestAnimationFrame(()=>c.current?.select())}}),(0,V.jsxs)(YS,{open:D,onOpenChange:e=>{O(e),e&&!I&&ce()},children:[(0,V.jsx)(XS,{asChild:!0,children:(0,V.jsx)(X,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":`Development servers`,title:`Development servers`,children:(0,V.jsx)(iL,{})})}),(0,V.jsxs)(ZS,{align:`end`,className:`flex max-h-[min(28rem,50dvh)] w-[min(22rem,calc(100vw-1rem))] flex-col overflow-hidden p-0`,"aria-label":`Development servers`,children:[(0,V.jsxs)(`div`,{className:`flex shrink-0 items-start justify-between gap-3 px-3 pt-3 pb-2`,children:[(0,V.jsxs)(`div`,{className:`min-w-0`,children:[(0,V.jsx)(`h2`,{className:`text-sm font-semibold`,children:`Development servers`}),(0,V.jsx)(`p`,{className:`text-xs text-zinc-400`,children:`Select a listening server from this tree.`})]}),(0,V.jsx)(X,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":`Refresh development servers`,title:`Refresh development servers`,disabled:I,onClick:()=>void ce(),children:(0,V.jsx)(EI,{})})]}),(0,V.jsxs)(`div`,{className:`min-h-0 overflow-y-auto overscroll-contain px-1.5 pb-1.5`,children:[I?(0,V.jsx)(`p`,{className:`px-2 py-4 text-sm text-zinc-400`,role:`status`,children:`Scanning for development servers…`}):null,!I&&ee&&!ee.supported?(0,V.jsxs)(Mb,{className:`min-h-28 p-4`,children:[(0,V.jsx)(Nb,{children:`Server discovery unavailable`}),(0,V.jsx)(Pb,{children:ee.message??`TCP listener discovery is unavailable.`})]}):null,!I&&ee?.supported&&ge.length===0?(0,V.jsxs)(Mb,{className:`min-h-28 p-4`,children:[(0,V.jsx)(Nb,{children:`No development servers`}),(0,V.jsx)(Pb,{children:`Start a server in a Treeport terminal. Then, refresh this list.`})]}):null,!I&&ge.length>0?(0,V.jsx)(`ul`,{role:`list`,className:`flex flex-col gap-0.5`,children:ge.map(({url:e,listener:t})=>(0,V.jsx)(`li`,{className:`min-w-0`,children:(0,V.jsx)(X,{type:`button`,variant:`ghost`,className:`h-auto w-full justify-start px-2 py-2 text-left`,"aria-label":`Open ${e.href}, ${t.command||`unknown command`}`,onClick:()=>{O(!1),le(e.href)},children:(0,V.jsxs)(`span`,{className:`min-w-0`,children:[(0,V.jsx)(`strong`,{className:`block truncate`,children:e.href}),(0,V.jsx)(`span`,{className:`mt-0.5 block truncate text-xs text-zinc-400`,children:t.command||`Unknown command`})]})})},e.href))}):null]})]})]})]}),k?(0,V.jsx)(`p`,{className:`bg-red-950 px-2.5 py-1.5 text-red-200`,role:`alert`,children:k}):null,C?.hasController&&!C.controlled?(0,V.jsx)(`p`,{className:`bg-amber-950 px-2.5 py-1.5 text-amber-200`,role:`status`,children:C.controller===`agent`?`A coding agent controls this browser. Interact with the viewport to take control.`:`Another Treeport client controls this browser. Interact with the viewport to take control.`}):null,(0,V.jsxs)(`div`,{className:`relative min-h-0 flex-1 overflow-hidden bg-zinc-950`,children:[L&&ne?(0,V.jsx)(SL,{panel:e,inputBlocked:r,onConnection:oe,onMessage:ie,onPaintRetentionChange:se,onFocusSurface:a},_):(0,V.jsx)(`canvas`,{ref:s,tabIndex:0,className:`block size-full bg-zinc-950 object-contain outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-cyan-300`,"aria-label":`Browser viewport. Streamed page content is not available to assistive technology.`,onFocus:a,onPointerMove:e=>{!u.current?.controlled&&!f.current||R({type:`pointer`,phase:`move`,...ue(e)})},onPointerDown:e=>{e.preventDefault(),a(),e.currentTarget.focus(),e.currentTarget.setPointerCapture(e.pointerId),f.current=!0,R({type:`takeControl`}),R({type:`pointer`,phase:`down`,...ue(e),button:de(e.button)})},onPointerUp:e=>{e.preventDefault(),R({type:`pointer`,phase:`up`,...ue(e),button:de(e.button)}),f.current=!1,e.currentTarget.hasPointerCapture(e.pointerId)&&e.currentTarget.releasePointerCapture(e.pointerId)},onPointerCancel:e=>{R({type:`pointer`,phase:`up`,...ue(e),button:de(e.button)}),f.current=!1,e.currentTarget.hasPointerCapture(e.pointerId)&&e.currentTarget.releasePointerCapture(e.pointerId)},onContextMenu:e=>e.preventDefault(),onWheel:me,onKeyDown:e=>pe(e,`down`),onKeyUp:e=>pe(e,`up`),onPaste:e=>{e.preventDefault(),R({type:`takeControl`}),R({type:`insertText`,text:e.clipboardData.getData(`text/plain`)})}}),C===null||C.url===`about:blank`?(0,V.jsx)(`div`,{className:`pointer-events-none absolute inset-0 bg-zinc-950`,"aria-hidden":`true`}):null,j?(0,V.jsxs)(`div`,{className:`absolute inset-0 flex flex-col items-center justify-center gap-3 bg-zinc-950 p-6 text-center text-zinc-400`,role:`alert`,children:[(0,V.jsx)(`strong`,{className:`text-zinc-50`,children:`Browser unavailable`}),(0,V.jsx)(`span`,{children:j.message}),(0,V.jsxs)(`div`,{className:`flex items-center gap-2`,children:[j.installCommand?(0,V.jsx)(X,{type:`button`,disabled:N,onClick:()=>{P(!0),fetch(`/api/browser/install`,{method:`POST`}).then(e=>{if(!e.ok)throw Error(`Could not install Chromium.`);v(e=>e+1)}).catch(e=>{P(!1),M(t=>t?{...t,message:e instanceof Error?e.message:`Could not install Chromium.`}:null)})},children:N?(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(EI,{className:`animate-spin`,"data-icon":`inline-start`}),`Installing Chromium…`]}):`Install Chromium`}):null,(0,V.jsx)(X,{type:`button`,variant:`outline`,disabled:N,onClick:()=>{M(null),v(e=>e+1)},children:`Retry`})]})]}):null]})]})}var DL=Object.defineProperty,OL=(e,t)=>DL(e,`name`,{value:t,configurable:!0});function kL(e,t){let n=B.createContext(t);n.displayName=e+`Context`;let r=OL(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 OL(i,`useContext`),[r,i]}OL(kL,`createContext`);function AL(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=OL(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 OL(s,`useContext`),[o,s]}OL(r,`createContext`);let i=OL(()=>{let t=n.map(e=>B.createContext(e));return OL(function(n){let r=n?.[e]||t;return B.useMemo(()=>({[`__scope${e}`]:{...n,[e]:r}}),[n,r])},`useScope`)},`createScope`);return i.scopeName=e,[r,jL(i,...t)]}OL(AL,`createContextScope`);function jL(...e){let t=e[0];if(e.length===1)return t;let n=OL(()=>{let n=e.map(e=>({useScope:e(),scopeName:e.scopeName}));return OL(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}OL(jL,`composeContextScopes`);var ML=Object.defineProperty,NL=(e,t)=>ML(e,`name`,{value:t,configurable:!0}),PL=!!(typeof window<`u`&&window.document&&window.document.createElement);function FL(e,t,{checkForDefaultPrevented:n=!0}={}){return NL(function(r){if(e?.(r),n===!1||!r||!r.defaultPrevented)return t?.(r)},`handleEvent`)}NL(FL,`composeEventHandlers`);function IL(e){if(!PL)throw Error(`Cannot access window outside of the DOM`);return e?.ownerDocument?.defaultView??window}NL(IL,`getOwnerWindow`);function LL(e){if(!PL)throw Error(`Cannot access document outside of the DOM`);return e?.ownerDocument??document}NL(LL,`getOwnerDocument`);function RL(e,t=!1){let{activeElement:n}=LL(e);if(!n?.nodeName)return null;if(zL(n)&&n.contentDocument)return RL(n.contentDocument.body,t);if(t){let e=n.getAttribute(`aria-activedescendant`);if(e){let t=LL(n).getElementById(e);if(t)return t}}return n}NL(RL,`getActiveElement`);function zL(e){return e.tagName===`IFRAME`}NL(zL,`isFrame`);var BL=globalThis?.document?B.useLayoutEffect:()=>{},VL=Object.defineProperty,HL=(e,t)=>VL(e,`name`,{value:t,configurable:!0}),UL=B.useId||(()=>void 0),WL=0;function GL(e){let[t,n]=B.useState(UL());return BL(()=>{e||n(e=>e??String(WL++))},[e]),e||(t?`radix-${t}`:``)}HL(GL,`useId`);var KL=Object.defineProperty,qL=(e,t)=>KL(e,`name`,{value:t,configurable:!0}),JL=B.useEffectEvent,YL=B.useInsertionEffect;function XL(e){if(typeof JL==`function`)return JL(e);let t=B.useRef(()=>{throw Error(`Cannot call an event handler while rendering.`)});return typeof YL==`function`?YL(()=>{t.current=e}):BL(()=>{t.current=e}),B.useMemo(()=>((...e)=>t.current?.(...e)),[])}qL(XL,`useEffectEvent`);var ZL=Object.defineProperty,QL=(e,t)=>ZL(e,`name`,{value:t,configurable:!0}),$L=B.useInsertionEffect||BL;function eR({prop:e,defaultProp:t,onChange:n=QL(()=>{},`onChange`),caller:r}){let[i,a,o]=tR({defaultProp:t,onChange:n}),s=e!==void 0;return[s?e:i,B.useCallback(t=>{if(s){let n=nR(t)?t(e):t;n!==e&&o.current?.(n)}else a(t)},[s,e,a,o])]}QL(eR,`useControllableState`);function tR({defaultProp:e,onChange:t}){let[n,r]=B.useState(e),i=B.useRef(n),a=B.useRef(t);return $L(()=>{a.current=t},[t]),B.useEffect(()=>{i.current!==n&&(a.current?.(n),i.current=n)},[n,i]),[n,r,a]}QL(tR,`useUncontrolledState`);function nR(e){return typeof e==`function`}QL(nR,`isFunction`);var rR=Symbol(`RADIX:SYNC_STATE`);function iR(e,t,n,r){let{prop:i,defaultProp:a,onChange:o,caller:s}=t,c=i!==void 0,l=XL(o),u=[{...n,state:a}];r&&u.push(r);let[d,f]=B.useReducer((t,n)=>{if(n.type===rR)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:rR,state:i})},[i,d.state,c]),[h,f]}QL(iR,`useControllableStateReducer`);var aR=Object.defineProperty,oR=(e,t)=>aR(e,`name`,{value:t,configurable:!0}),sR=[`a`,`button`,`div`,`form`,`h2`,`h3`,`img`,`input`,`label`,`li`,`nav`,`ol`,`p`,`select`,`span`,`svg`,`ul`].reduce((e,t)=>{let n=fb(`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 cR(e,t){e&&Ri.flushSync(()=>e.dispatchEvent(t))}oR(cR,`dispatchDiscreteCustomEvent`);var lR=Object.defineProperty,uR=(e,t)=>lR(e,`name`,{value:t,configurable:!0});function dR(e){let t=B.useRef(e);return B.useEffect(()=>{t.current=e}),B.useMemo(()=>((...e)=>t.current?.(...e)),[])}uR(dR,`useCallbackRef`);var fR=Object.defineProperty,pR=(e,t)=>fR(e,`name`,{value:t,configurable:!0}),mR=`dismissableLayer.update`,hR=`dismissableLayer.pointerDownOutside`,gR=`dismissableLayer.focusOutside`,_R,vR=B.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set,dismissableSurfaces:new Set}),yR=B.forwardRef(pR(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(vR),[d,f]=B.useState(null),p=d?.ownerDocument??globalThis?.document,[,m]=B.useState({}),h=lb(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=SR(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=CR(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=dR(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&&(_R=p.body.style.pointerEvents,p.body.style.pointerEvents=`none`),u.layersWithOutsidePointerEventsDisabled.add(d)),u.layers.add(d),wR(),()=>{n&&(u.layersWithOutsidePointerEventsDisabled.delete(d),u.layersWithOutsidePointerEventsDisabled.size===0&&(p.body.style.pointerEvents=_R))}},[d,p,n,u]),B.useEffect(()=>()=>{d&&(u.layers.delete(d),u.layersWithOutsidePointerEventsDisabled.delete(d),wR())},[d,u]),B.useEffect(()=>{let e=pR(()=>m({}),`handleUpdate`);return document.addEventListener(mR,e),()=>document.removeEventListener(mR,e)},[]),(0,V.jsx)(sR.div,{...l,ref:h,style:{pointerEvents:b?x?`auto`:`none`:void 0,...e.style},onFocusCapture:FL(e.onFocusCapture,w.onFocusCapture),onBlurCapture:FL(e.onBlurCapture,w.onBlurCapture),onPointerDownCapture:FL(e.onPointerDownCapture,C.onPointerDownCapture)})},`DismissableLayer`));function bR(){let e=B.useContext(vR),[t,n]=B.useState(null);return B.useEffect(()=>{if(t)return e.dismissableSurfaces.add(t),()=>{e.dismissableSurfaces.delete(t)}},[t,e.dismissableSurfaces]),n}pR(bR,`useDismissableLayerSurface`);var xR=pR(()=>!0,`IS_TRUE`);function SR(e,t){let{ownerDocument:n=globalThis?.document,deferPointerDownOutside:r=!1,isDeferredPointerDownOutsideRef:i,dismissableSurfaces:a,shouldHandlePointerDownOutside:o=xR}=t,s=dR(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()}pR(e,`resetOutsideInteraction`);function t(){return Array.from(u.current.values()).some(Boolean)}pR(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)}pR(f,`handleInteractionCapture`);function p(e){l.current&&u.current.set(e.type,!1)}pR(p,`handleInteractionBubble`);let m=pR(a=>{if(a.target&&!c.current){let f=function(){n.removeEventListener(`click`,d.current);let r=t();e(),r||TR(hR,s,p,{discrete:!0})};if(pR(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:pR(()=>c.current=!0,`onPointerDownCapture`)}}pR(SR,`usePointerDownOutside`);function CR(e,t=globalThis?.document){let n=dR(e),r=B.useRef(!1);return B.useEffect(()=>{let e=pR(e=>{e.target&&!r.current&&TR(gR,n,{originalEvent:e},{discrete:!1})},`handleFocus`);return t.addEventListener(`focusin`,e),()=>t.removeEventListener(`focusin`,e)},[t,n]),{onFocusCapture:pR(()=>r.current=!0,`onFocusCapture`),onBlurCapture:pR(()=>r.current=!1,`onBlurCapture`)}}pR(CR,`useFocusOutside`);function wR(){let e=new CustomEvent(mR);document.dispatchEvent(e)}pR(wR,`dispatchUpdate`);function TR(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?cR(i,a):i.dispatchEvent(a)}pR(TR,`handleAndDispatchCustomEvent`);var ER=Object.defineProperty,DR=(e,t)=>ER(e,`name`,{value:t,configurable:!0}),OR=`focusScope.autoFocusOnMount`,kR=`focusScope.autoFocusOnUnmount`,AR={bubbles:!1,cancelable:!0},jR=B.forwardRef(DR(function(e,t){let{loop:n=!1,trapped:r=!1,onMountAutoFocus:i,onUnmountAutoFocus:a,...o}=e,[s,c]=B.useState(null),l=dR(i),u=dR(a),d=B.useRef(null),f=lb(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:RR(d.current,{select:!0})},t=function(e){if(p.paused||!s)return;let t=e.relatedTarget;t!==null&&(s.contains(t)||RR(d.current,{select:!0}))},n=function(e){if(document.activeElement===document.body)for(let t of e)t.removedNodes.length>0&&RR(s)};DR(e,`handleFocusIn`),DR(t,`handleFocusOut`),DR(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){zR.add(p);let e=document.activeElement;if(!s.contains(e)){let t=new CustomEvent(OR,AR);s.addEventListener(OR,l),s.dispatchEvent(t),t.defaultPrevented||(MR(HR(PR(s)),{select:!0}),document.activeElement===e&&RR(s))}return()=>{s.removeEventListener(OR,l),setTimeout(()=>{let t=new CustomEvent(kR,AR);s.addEventListener(kR,u),s.dispatchEvent(t),t.defaultPrevented||RR(e??document.body,{select:!0}),s.removeEventListener(kR,u),zR.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]=NR(t);r&&a?!e.shiftKey&&i===a?(e.preventDefault(),n&&RR(r,{select:!0})):e.shiftKey&&i===r&&(e.preventDefault(),n&&RR(a,{select:!0})):i===t&&e.preventDefault()}},[n,r,p.paused]);return(0,V.jsx)(sR.div,{tabIndex:-1,...o,ref:f,onKeyDown:m})},`FocusScope`));function MR(e,{select:t=!1}={}){let n=document.activeElement;for(let r of e)if(RR(r,{select:t}),document.activeElement!==n)return}DR(MR,`focusFirst`);function NR(e){let t=PR(e);return[FR(t,e),FR(t.reverse(),e)]}DR(NR,`getTabbableEdges`);function PR(e){let t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:DR(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}DR(PR,`getTabbableCandidates`);function FR(e,t){let n=typeof t.checkVisibility==`function`&&t.checkVisibility({checkVisibilityCSS:!0});for(let r of e)if(!(n?!r.checkVisibility({checkVisibilityCSS:!0}):IR(r,{upTo:t})))return r}DR(FR,`findVisible`);function IR(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}DR(IR,`isHidden`);function LR(e){return e instanceof HTMLInputElement&&`select`in e}DR(LR,`isSelectableInput`);function RR(e,{select:t=!1}={}){if(e&&e.focus){let n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&LR(e)&&t&&e.select()}}DR(RR,`focus`);var zR=BR();function BR(){let e=[];return{add(t){let n=e[0];t!==n&&n?.pause(),e=VR(e,t),e.unshift(t)},remove(t){e=VR(e,t),e[0]?.resume()}}}DR(BR,`createFocusScopesStack`);function VR(e,t){let n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}DR(VR,`arrayRemove`);function HR(e){return e.filter(e=>e.tagName!==`A`)}DR(HR,`removeLinks`);var UR=Object.defineProperty,WR=B.forwardRef(((e,t)=>UR(e,`name`,{value:t,configurable:!0}))(function(e,t){let{container:n,...r}=e,[i,a]=B.useState(!1);BL(()=>a(!0),[]);let o=n||i&&globalThis?.document?.body;return o?Ri.createPortal((0,V.jsx)(sR.div,{...r,ref:t}),o):null},`Portal`)),GR=Object.defineProperty,KR=(e,t)=>GR(e,`name`,{value:t,configurable:!0});function qR(e,t){return B.useReducer((e,n)=>t[e][n]??e,e)}KR(qR,`useStateMachine`);var JR=KR(e=>{let{present:t,children:n}=e,r=YR(t),i=typeof n==`function`?n({present:r.isPresent}):B.Children.only(n),a=ZR(r.ref,$R(i));return typeof n==`function`||r.isPresent?B.cloneElement(i,{ref:a}):null},`Presence`);function YR(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]=qR(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??QR(r.current),o.current=void 0):a.current=`none`},[s]),BL(()=>{let t=r.current,n=i.current;if(n!==e){let r=a.current,s=QR(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]),BL(()=>{if(t){let e,n=t.ownerDocument.defaultView??window,o=KR(a=>{let o=QR(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=KR(e=>{e.target===t&&(a.current=QR(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=QR(t)}else r.current=null;n(e)},[])}}KR(YR,`usePresence`);function XR(e,t){if(typeof e==`function`)return e(t);e!=null&&(e.current=t)}KR(XR,`setRef`);function ZR(...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=XR(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():XR(n[e],null)}}},[])}KR(ZR,`useStableComposedRefs`);function QR(e){return e?.animationName||`none`}KR(QR,`getAnimationName`);function $R(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)}KR($R,`getElementRef`);var ez=Object.defineProperty,tz=(e,t)=>ez(e,`name`,{value:t,configurable:!0}),nz=0,rz=null;function iz(e){return az(),e.children}tz(iz,`FocusGuards`);function az(){B.useEffect(()=>{rz||={start:oz(),end:oz()};let{start:e,end:t}=rz;return document.body.firstElementChild!==e&&document.body.insertAdjacentElement(`afterbegin`,e),document.body.lastElementChild!==t&&document.body.insertAdjacentElement(`beforeend`,t),nz++,()=>{nz===1&&(rz?.start.remove(),rz?.end.remove(),rz=null),nz=Math.max(0,nz-1)}},[])}tz(az,`useFocusGuards`);function oz(){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}tz(oz,`createFocusGuard`);var sz=Object.defineProperty,cz=(e,t)=>sz(e,`name`,{value:t,configurable:!0}),lz=`Dialog`,[uz,dz]=AL(lz),[fz,pz]=uz(lz),mz=cz(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]=eR({prop:r,defaultProp:i??!1,onChange:a,caller:lz}),[d,f]=B.useState(0),[p,m]=B.useState(0);return(0,V.jsx)(fz,{scope:t,triggerRef:s,contentRef:c,contentId:GL(),titleId:GL(),descriptionId:GL(),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`),hz=`DialogTrigger`,gz=B.forwardRef(cz(function(e,t){let{__scopeDialog:n,...r}=e,i=pz(hz,n),a=lb(t,i.triggerRef);return(0,V.jsx)(sR.button,{type:`button`,"aria-haspopup":`dialog`,"aria-expanded":i.open,"aria-controls":i.open?i.contentId:void 0,"data-state":Iz(i.open),...r,ref:a,onClick:FL(e.onClick,i.onOpenToggle)})},`DialogTrigger`)),_z=`DialogPortal`,[vz,yz]=uz(_z,{forceMount:void 0}),bz=cz(e=>{let{__scopeDialog:t,forceMount:n,children:r,container:i}=e,a=pz(_z,t);return(0,V.jsx)(vz,{scope:t,forceMount:n,children:B.Children.map(r,e=>(0,V.jsx)(JR,{present:n||a.open,children:(0,V.jsx)(WR,{asChild:!0,container:i,children:e})}))})},`DialogPortal`),xz=`DialogOverlay`,Sz=B.forwardRef(cz(function(e,t){let n=yz(xz,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,a=pz(xz,e.__scopeDialog);return a.modal?(0,V.jsx)(JR,{present:r||a.open,children:(0,V.jsx)(wz,{...i,ref:t})}):null},`DialogOverlay`)),Cz=fb(`DialogOverlay.RemoveScroll`),wz=B.forwardRef(cz(function(e,t){let{__scopeDialog:n,...r}=e,i=pz(xz,n),a=lb(t,bR());return(0,V.jsx)(vS,{as:Cz,allowPinchZoom:!0,shards:[i.contentRef],children:(0,V.jsx)(sR.div,{"data-state":Iz(i.open),...r,ref:a,style:{pointerEvents:`auto`,...r.style}})})},`DialogOverlayImpl`)),Tz=`DialogContent`,Ez=B.forwardRef(cz(function(e,t){let n=yz(Tz,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,a=pz(Tz,e.__scopeDialog);return(0,V.jsx)(JR,{present:r||a.open,children:a.modal?(0,V.jsx)(Dz,{...i,ref:t}):(0,V.jsx)(Oz,{...i,ref:t})})},`DialogContent`)),Dz=B.forwardRef(cz(function(e,t){let n=pz(Tz,e.__scopeDialog),r=B.useRef(null),i=lb(t,n.contentRef,r);return B.useEffect(()=>{let e=r.current;if(e)return lx(e)},[]),(0,V.jsx)(kz,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:n.open,onCloseAutoFocus:FL(e.onCloseAutoFocus,e=>{e.preventDefault(),n.triggerRef.current?.focus()}),onPointerDownOutside:FL(e.onPointerDownOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0;(t.button===2||n)&&e.preventDefault()}),onFocusOutside:FL(e.onFocusOutside,e=>e.preventDefault())})},`DialogContentModal`)),Oz=B.forwardRef(cz(function(e,t){let n=pz(Tz,e.__scopeDialog),r=B.useRef(!1),i=B.useRef(!1);return(0,V.jsx)(kz,{...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`)),kz=B.forwardRef(cz(function(e,t){let{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:a,...o}=e,s=pz(Tz,n);return az(),(0,V.jsx)(V.Fragment,{children:(0,V.jsx)(jR,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:a,children:(0,V.jsx)(yR,{role:`dialog`,id:s.contentId,"aria-describedby":s.descriptionPresent?s.descriptionId:void 0,"aria-labelledby":s.titlePresent?s.titleId:void 0,"data-state":Iz(s.open),...o,ref:t,deferPointerDownOutside:!0,onDismiss:()=>s.onOpenChange(!1)})})})},`DialogContentImpl`)),Az=`DialogTitle`,jz=B.forwardRef(cz(function(e,t){let{__scopeDialog:n,...r}=e,i=pz(Az,n),{setTitleCount:a}=i;return BL(()=>(a(e=>e+1),()=>a(e=>e-1)),[a]),(0,V.jsx)(sR.h2,{id:i.titleId,...r,ref:t})},`DialogTitle`)),Mz=`DialogDescription`,Nz=B.forwardRef(cz(function(e,t){let{__scopeDialog:n,...r}=e,i=pz(Mz,n),{setDescriptionCount:a}=i;return BL(()=>(a(e=>e+1),()=>a(e=>e-1)),[a]),(0,V.jsx)(sR.p,{id:i.descriptionId,...r,ref:t})},`DialogDescription`)),Pz=`DialogClose`,Fz=B.forwardRef(cz(function(e,t){let{__scopeDialog:n,...r}=e,i=pz(Pz,n);return(0,V.jsx)(sR.button,{type:`button`,...r,ref:t,onClick:FL(e.onClick,()=>i.onOpenChange(!1))})},`DialogClose`));function Iz(e){return e?`open`:`closed`}cz(Iz,`getState`);var Lz=Object.defineProperty,Rz=(e,t)=>Lz(e,`name`,{value:t,configurable:!0}),[zz,Bz]=AL(`AlertDialog`,[dz]),Vz=dz(),Hz=Rz(e=>{let{__scopeAlertDialog:t,...n}=e,r=Vz(t);return(0,V.jsx)(mz,{...r,...n,modal:!0})},`AlertDialog`);B.forwardRef(Rz(function(e,t){let{__scopeAlertDialog:n,...r}=e,i=Vz(n);return(0,V.jsx)(gz,{...i,...r,ref:t})},`AlertDialogTrigger`));var Uz=Rz(e=>{let{__scopeAlertDialog:t,...n}=e,r=Vz(t);return(0,V.jsx)(bz,{...r,...n})},`AlertDialogPortal`),Wz=B.forwardRef(Rz(function(e,t){let{__scopeAlertDialog:n,...r}=e,i=Vz(n);return(0,V.jsx)(Sz,{...i,...r,ref:t})},`AlertDialogOverlay`)),[Gz,Kz]=zz(`AlertDialogContent`),qz=B.forwardRef(Rz(function(e,t){let{__scopeAlertDialog:n,children:r,...i}=e,a=Vz(n),o=lb(t,B.useRef(null)),s=B.useRef(null);return(0,V.jsx)(Gz,{scope:n,cancelRef:s,children:(0,V.jsx)(Ez,{role:`alertdialog`,...a,...i,ref:o,onOpenAutoFocus:FL(i.onOpenAutoFocus,e=>{e.preventDefault(),s.current?.focus({preventScroll:!0})}),onPointerDownOutside:e=>e.preventDefault(),onInteractOutside:e=>e.preventDefault(),children:r})})},`AlertDialogContent`)),Jz=B.forwardRef(Rz(function(e,t){let{__scopeAlertDialog:n,...r}=e,i=Vz(n);return(0,V.jsx)(jz,{...i,...r,ref:t})},`AlertDialogTitle`)),Yz=B.forwardRef(Rz(function(e,t){let{__scopeAlertDialog:n,...r}=e,i=Vz(n);return(0,V.jsx)(Nz,{...i,...r,ref:t})},`AlertDialogDescription`)),Xz=B.forwardRef(Rz(function(e,t){let{__scopeAlertDialog:n,...r}=e,i=Vz(n);return(0,V.jsx)(Fz,{...i,...r,ref:t})},`AlertDialogAction`)),Zz=`AlertDialogCancel`,Qz=B.forwardRef(Rz(function(e,t){let{__scopeAlertDialog:n,...r}=e,{cancelRef:i}=Kz(Zz,n),a=Vz(n),o=lb(t,i);return(0,V.jsx)(Fz,{...a,...r,ref:o})},`AlertDialogCancel`)),$z=Hz,eB=Uz,tB=Wz,nB=qz,rB=Xz,iB=Qz,aB=Jz,oB=Yz,sB=$z,cB=eB,lB=B.forwardRef(({className:e,...t},n)=>(0,V.jsx)(tB,{ref:n,className:W(`fixed inset-0 z-50 bg-black/70 backdrop-blur-sm`,e),...t}));lB.displayName=tB.displayName;var uB=B.forwardRef(({className:e,restoreFocusTo:t,onCloseAutoFocus:n,...r},i)=>(0,V.jsxs)(cB,{children:[(0,V.jsx)(lB,{}),(0,V.jsx)(nB,{ref:i,className:W(`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})]}));uB.displayName=nB.displayName;function dB({className:e,...t}){return(0,V.jsx)(`div`,{className:W(`flex flex-col gap-1.5 text-left`,e),...t})}function fB({className:e,...t}){return(0,V.jsx)(`div`,{className:W(`flex flex-col-reverse gap-2 sm:flex-row sm:justify-end`,e),...t})}var pB=B.forwardRef(({className:e,...t},n)=>(0,V.jsx)(aB,{ref:n,className:W(`text-balance text-xl font-semibold tracking-tight text-zinc-50 sm:text-2xl`,e),...t}));pB.displayName=aB.displayName;var mB=B.forwardRef(({className:e,...t},n)=>(0,V.jsx)(oB,{ref:n,className:W(`text-base text-pretty text-zinc-400 sm:text-sm`,e),...t}));mB.displayName=oB.displayName;var hB=B.forwardRef(({className:e,...t},n)=>(0,V.jsx)(rB,{ref:n,className:W(jb(),e),...t}));hB.displayName=rB.displayName;var gB=B.forwardRef(({className:e,...t},n)=>(0,V.jsx)(iB,{ref:n,className:W(jb({variant:`outline`}),e),...t}));gB.displayName=iB.displayName;function _B({panel:e,reason:t,busy:n,restoreFocusTo:r,onOpenChange:i,onConfirm:a}){return(0,V.jsx)(sB,{open:e!==null,onOpenChange:i,children:e?(0,V.jsxs)(uB,{restoreFocusTo:r,children:[(0,V.jsxs)(dB,{children:[(0,V.jsx)(pB,{children:t===`browser-before-unload`?`Leave site?`:`Close ${e.title}?`}),(0,V.jsx)(mB,{children:t===`browser-before-unload`?`Changes you made may not be saved.`:t===`unsaved-changes`?`Changes in this panel have not been saved.`:`This panel has saved data. Closing it permanently deletes that data, including any comments or drafts.`})]}),(0,V.jsxs)(fB,{children:[(0,V.jsx)(gB,{children:`Cancel`}),(0,V.jsx)(hB,{asChild:!0,children:(0,V.jsx)(X,{type:`button`,variant:`destructive`,disabled:n,onClick:t=>{t.preventDefault(),a(e)},children:n?`Closing…`:t===`browser-before-unload`?`Leave`:t===`unsaved-changes`?`Close without saving`:`Close and delete data`})})]})]}):null})}var vB=Zv({source:Y(`treeport-panel-v1`),method:Y(`panel.title.set`),title:q().nullable()}),yB=Zv({source:Y(`treeport-panel-v1`),method:Y(`workspace.select`),index:Lv().int().min(0).max(8)}),bB=J({source:Y(`treeport-panel-v1`),method:Y(`panel.dirty.set`),dirty:Vv()}),xB={source:Y(`treeport-panel-v1`),id:q()},SB=ty(`method`,[J({...xB,method:Y(`context`)}),J({...xB,method:Y(`diff`)}),J({...xB,method:Y(`network.listeners`)}),J({...xB,method:Y(`files.list`)}),J({...xB,method:Y(`files.read`),path:q()}),J({...xB,method:Y(`files.write`),path:q(),content:q(),expectedRevision:q()}),J({...xB,method:Y(`storage.get`),key:q()}),J({...xB,method:Y(`storage.set`),key:q(),value:Ly()}),J({...xB,method:Y(`storage.delete`),key:q()})]);function CB({panel:e,active:t,title:n,reloadRevision:r,autoFocusBlocked:i,onTitleChange:a,onDirtyChange:o,onSelectWorkspace:s,onFocusSurface:c}){let l=(0,B.useRef)(null),u=(0,B.useRef)(null),d=`${e.id}:${r}`,[f,p]=(0,B.useState)(null);return(0,B.useEffect)(()=>{a(e.id,null),o(e.id,!1)},[o,a,e.id,d]),(0,B.useEffect)(()=>{if(!t||i||f!==d)return;let e=window.requestAnimationFrame(()=>l.current?.focus());return()=>window.cancelAnimationFrame(e)},[t,i,f,d]),(0,B.useEffect)(()=>{if(!t)return;let e=()=>{window.requestAnimationFrame(()=>{document.activeElement===l.current&&c()})};return window.addEventListener(`blur`,e),()=>window.removeEventListener(`blur`,e)},[t,c]),(0,B.useEffect)(()=>{if(!t)return;let e=e=>{e.key.toLowerCase()!==`f`||!e.metaKey&&!e.ctrlKey||e.altKey||document.querySelector(`[role="dialog"]`)||(e.preventDefault(),(l.current?.contentWindow??u.current)?.postMessage({source:`treeport-host-v1`,method:`shortcut`,shortcut:`find`},`*`))};return window.addEventListener(`keydown`,e,!0),()=>window.removeEventListener(`keydown`,e,!0)},[t]),(0,B.useEffect)(()=>{let t=t=>{let n=l.current?.contentWindow??u.current;if(t.source!==n||t.data?.source!==`treeport-panel-v1`)return;let r=vB.safeParse(t.data);if(r.success){a(e.id,r.data.title?.trim().slice(0,256)||null);return}let i=bB.safeParse(t.data);if(i.success){o(e.id,i.data.dirty);return}let c=yB.safeParse(t.data);if(c.success){s(c.data.index);return}let d=SB.safeParse(t.data);if(!d.success)return;let f=d.data,{method:p}=f,m;m=p===`context`?Ef(NN.api.panels[`:panelId`].context.$get({param:{panelId:e.id}})).then(e=>e.context):p===`diff`?Ef(NN.api.panels[`:panelId`].diff.$get({param:{panelId:e.id}})).then(e=>e.diff):p===`network.listeners`?Ef(NN.api.panels[`:panelId`].network.listeners.$get({param:{panelId:e.id}})).then(e=>e.discovery):p===`files.list`?Ef(PN.api.panels[`:panelId`].files.$get({param:{panelId:e.id}})):p===`files.read`?Ef(PN.api.panels[`:panelId`].files.read.$post({param:{panelId:e.id},json:{path:f.path}})):p===`files.write`?Ef(PN.api.panels[`:panelId`].files.$put({param:{panelId:e.id},json:{path:f.path,content:f.content,expectedRevision:f.expectedRevision}})):p===`storage.get`?Ef(NN.api.panels[`:panelId`].storage.get.$post({param:{panelId:e.id},json:{key:f.key}})).then(e=>e.value):p===`storage.set`?Ef(NN.api.panels[`:panelId`].storage.$put({param:{panelId:e.id},json:{key:f.key,value:f.value}})).then(()=>void 0):p===`storage.delete`?Ef(NN.api.panels[`:panelId`].storage.$delete({param:{panelId:e.id},json:{key:f.key}})).then(()=>void 0):Promise.reject(Error(`Unsupported Treeport SDK method`)),m.then(e=>n?.postMessage({source:`treeport-host-v1`,id:f.id,ok:!0,value:e},`*`),e=>n?.postMessage({source:`treeport-host-v1`,id:f.id,ok:!1,error:UN(e),errorCode:HN(e).code},`*`))};return window.addEventListener(`message`,t),()=>window.removeEventListener(`message`,t)},[t,o,s,a,e.id,e.permissions]),(0,V.jsx)(B.Activity,{mode:t?`visible`:`hidden`,children:(0,V.jsx)(`main`,{className:`min-h-0 min-w-0 bg-zinc-950`,"aria-label":`${n} web panel`,children:(0,V.jsx)(`iframe`,{ref:l,title:n,src:`/api/web-panels/${encodeURIComponent(e.id)}/assets/`,sandbox:`allow-scripts allow-forms allow-popups allow-popups-to-escape-sandbox allow-downloads${e.sandbox.allowSameOrigin?` allow-same-origin`:``}`,allow:`clipboard-read; clipboard-write; fullscreen`,onFocus:c,className:W(`h-full w-full border-0 bg-zinc-950`,f===d?`opacity-100`:`opacity-0`),onLoad:()=>{u.current=l.current?.contentWindow??null,p(d)}},d)})})}var wB=mz,TB=bz;function EB(e){let t=window.visualViewport;return t?(t.addEventListener(`resize`,e),t.addEventListener(`scroll`,e),()=>{t.removeEventListener(`resize`,e),t.removeEventListener(`scroll`,e)}):()=>void 0}function DB(){let e=window.visualViewport;return e?`${e.offsetTop}:${e.height}`:null}var OB=B.forwardRef(({className:e,...t},n)=>(0,V.jsx)(Sz,{ref:n,className:W(`fixed inset-0 z-50 bg-black/70 backdrop-blur-sm`,e),...t}));OB.displayName=Sz.displayName;var kB=B.forwardRef(({className:e,children:t,restoreFocusTo:n,mobilePresentation:r=`sheet`,overlayClassName:i,onCloseAutoFocus:a,style:o,...s},c)=>{let[l,u]=B.useSyncExternalStore(EB,DB,()=>null)?.split(`:`).map(Number)??[null,null];return(0,V.jsxs)(TB,{children:[(0,V.jsx)(OB,{className:i}),(0,V.jsxs)(Ez,{ref:c,className:W(`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))]`,r===`dialog`&&`keyboard-safe-dialog`,e),style:{...o,"--dialog-visual-viewport-top":r===`dialog`&&l!==null?`${l}px`:void 0,"--dialog-visual-viewport-height":r===`dialog`&&u!==null?`${u}px`:void 0},onCloseAutoFocus:e=>{a?.(e),!e.defaultPrevented&&n?.isConnected&&(e.preventDefault(),n.focus())},...s,children:[t,(0,V.jsxs)(Fz,{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)(ib,{}),(0,V.jsx)(`span`,{className:`sr-only`,children:`Close`})]})]})]})});kB.displayName=Ez.displayName;function AB({className:e,...t}){return(0,V.jsx)(`div`,{className:W(`flex flex-col gap-1.5 pr-12 text-left`,e),...t})}var jB=B.forwardRef(({className:e,...t},n)=>(0,V.jsx)(jz,{ref:n,className:W(`text-balance text-xl font-semibold tracking-tight text-zinc-50 sm:text-2xl`,e),...t}));jB.displayName=jz.displayName;var MB=B.forwardRef(({className:e,...t},n)=>(0,V.jsx)(Nz,{ref:n,className:W(`text-base text-pretty text-zinc-400 sm:text-sm`,e),...t}));MB.displayName=Nz.displayName;function NB({children:e}){return(0,V.jsx)(`div`,{className:`grid gap-2`,children:e})}function PB({className:e,...t}){return(0,V.jsx)(`label`,{"data-slot":`label`,className:W(`flex text-base font-medium text-zinc-300 sm:text-sm`,e),...t})}function FB({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=lt({queryKey:[`filesystem-directories`,i,o],queryFn:()=>{let e={input:i};return o&&(e.hidden=`true`),Ef(NN.api.filesystem.directories.$get({query:e}))},enabled:!!i,retry:!1}),l=dt({mutationFn:async e=>(await Ef(NN.api.projects.$post({json:{path:e}}))).project,onSuccess:e,onError:(e,t)=>{vI(e,{operation:`open project at “${t}”`})}}),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.project.state===`valid`?d.project:null,p=l.isPending,m=e=>{r(e),a(e),window.requestAnimationFrame(()=>{t.current?.focus(),t.current?.setSelectionRange(e.length,e.length)})};return(0,V.jsxs)(`form`,{className:`flex flex-col gap-3 max-[700px]:gap-4`,onSubmit:e=>{e.preventDefault(),!(!f||p)&&l.mutate(f.path)},children:[(0,V.jsxs)(NB,{children:[(0,V.jsx)(PB,{htmlFor:`project-path`,children:`Server folder`}),(0,V.jsx)(dL,{ref:t,id:`project-path`,name:`project-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":`project-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)(X,{type:`button`,variant:`outline`,size:`sm`,onClick:()=>m(d.directory.homePath),disabled:p,children:[(0,V.jsx)(QI,{"data-icon":`inline-start`}),`Home`]}),(0,V.jsx)(X,{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)(X,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":`Parent folder`,onClick:()=>m(d.directory.parentPath),disabled:p,children:(0,V.jsx)(AI,{})}),d.directory.breadcrumbs.map((e,t)=>(0,V.jsxs)(`div`,{className:`flex items-center gap-1`,children:[t>0&&(0,V.jsx)(BI,{className:`size-3.5 shrink-0 fill-zinc-600`}),(0,V.jsx)(X,{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:UN(c.error)}),(0,V.jsx)(X,{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)(JI,{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:`project-path-status`,className:W(`form-note min-h-5 truncate`,d?.project.state===`valid`?`text-emerald-300`:c.isError?`text-rose-300`:void 0),title:d?.project.state===`valid`?d.project.path:void 0,"aria-live":`polite`,children:i?c.isFetching||!u?`Checking folder…`:c.isError?UN(c.error):d?.project.state===`valid`?d.project.kind===`repository`?`Will open Git repository: ${d.project.path}`:`Will open folder: ${d.project.path}`:d?.project.message:`Enter a folder path on the Treeport server.`}),(0,V.jsx)(X,{type:`submit`,className:`self-end`,disabled:!f||p,children:p?`Opening…`:`Open project`})]})}function IB({open:e,onOpenChange:t,restoreFocusTo:n,onOpened:r}){return(0,V.jsx)(wB,{open:e,onOpenChange:t,children:(0,V.jsxs)(kB,{className:`max-w-xl gap-3 p-4 max-[700px]:gap-4`,restoreFocusTo:n,children:[(0,V.jsxs)(AB,{children:[(0,V.jsx)(jB,{className:`text-lg tracking-normal sm:text-lg`,children:`Open project`}),(0,V.jsx)(MB,{children:`Browse folders on the Treeport server.`})]}),(0,V.jsx)(FB,{onOpened:r})]})})}var LB=[`projects`],RB=[`recent-projects`],zB=[`terminal-presets`],BB=ut({queryKey:LB,queryFn:async()=>(await Ef(NN.api.projects.$get())).projects,staleTime:Af,refetchInterval:5e3,refetchOnReconnect:!0,refetchOnWindowFocus:!0}),VB=ut({queryKey:RB,queryFn:async()=>(await Ef(NN.api.projects.recent.$get())).projects}),HB=ut({queryKey:zB,queryFn:async()=>(await Ef(NN.api[`terminal-presets`].$get())).presets,staleTime:0,refetchInterval:5e3,refetchOnReconnect:!0,refetchOnWindowFocus:!0}),UB=e=>ut({queryKey:[`tree-context-fields`,e??`none`],queryFn:async()=>await Ef(NN.api[`tree-context-fields`].$get({query:{projectId:e}})),enabled:e!==null,staleTime:0,refetchInterval:5e3,refetchOnReconnect:!0,refetchOnWindowFocus:!0}),WB=e=>ut({queryKey:[`terminal-preset-definitions`,e?.worktreeId??e?.projectId??`global`],queryFn:async()=>{let t={};return e?.projectId&&(t.projectId=e.projectId),e?.worktreeId&&(t.worktreeId=e.worktreeId),await Ef(NN.api[`terminal-preset-definitions`].$get({query:t}))},staleTime:0,refetchInterval:5e3,refetchOnReconnect:!0,refetchOnWindowFocus:!0}),GB=(0,B.createContext)(null),KB=(0,B.createContext)(null);function qB({children:e}){let[t,n]=(0,B.useState)(null),r=(0,B.useCallback)((e,t)=>{n(n=>({terminalId:e,focus:t,sequence:(n?.sequence??0)+1}))},[]);return(0,V.jsx)(GB,{value:r,children:(0,V.jsx)(KB,{value:t,children:e})})}function JB(){let e=(0,B.useContext)(GB);if(!e)throw Error(`useSetTerminalFocusIntent must be used within TerminalFocusProvider`);return e}function YB({terminalId:e,session:t,blocked:n}){let r=(0,B.useContext)(KB),i=(0,B.useRef)(null),a=(0,B.useRef)(0),o=(0,B.useRef)(null),s=(0,B.useRef)(null),c=(0,B.useRef)(e),l=(0,B.useRef)(t),u=(0,B.useRef)(n);(0,B.useLayoutEffect)(()=>{c.current=e,l.current=t,u.current=n},[n,t,e]),(0,B.useEffect)(()=>{if(r&&a.current!==r.sequence&&(a.current=r.sequence,o.current=r.focus?r.terminalId:null,s.current=r.focus||i.current===r.terminalId?null:r.terminalId),i.current!==e&&(i.current=e,o.current=s.current===e?null:e,s.current===e&&(s.current=null)),!e||!t||t.terminalId!==e||n||o.current!==e)return;let d=window.requestAnimationFrame(()=>{u.current||c.current!==e||l.current!==t||o.current!==e||(t.focus(),o.current=null)});return()=>window.cancelAnimationFrame(d)},[n,r,t,e])}function XB(){let e=Ii(),t=JB();return(0,B.useCallback)((n,r=!1,i=!0)=>{switch(n.kind===`terminal`&&t(n.terminalId,i),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});case`panel`:return e({to:`/projects/$projectId/worktrees/$worktreeId/panels/$panelId`,params:{projectId:n.projectId,worktreeId:n.worktreeId,panelId:n.panelId},replace:r})}},[e,t])}function ZB({projects:e,selectedProject:t,targetForProject:n,projectSwitcherTriggerRef:r,closeProjectUi:i,openedProjectUi:a}){let o=qe(),s=xa(),c=XB(),l=dt({mutationFn:e=>Ef(NN.api.projects[`:projectId`].close.$post({param:{projectId:e.id}})),onSuccess:async(a,s)=>{let l=o.getQueryData(LB)??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(LB,u);for(let e of s.worktrees.flatMap(e=>e.terminals))LF.forget(e.id);await Promise.all([o.invalidateQueries({queryKey:LB}),o.invalidateQueries({queryKey:RB})]),(p||!u.length)&&window.requestAnimationFrame(()=>r.current?.focus())},onError:(e,t)=>{vI(e,{operation:`close project “${t.name}”`}),HN(e).code===`PROJECT_CLOSE_FAILED`&&o.invalidateQueries({queryKey:LB})}});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`}. Folders, Git worktrees, and files will remain on disk. You can reopen the project from Recent projects.`)||l.mutate(e)},projectOpened:async(t,r=!0)=>{let i=e.length===0&&s.pathname===`/`;o.setQueryData(LB,e=>[...(e??[]).filter(e=>e.id!==t.id),t]),o.setQueryData(RB,e=>e?.filter(e=>e.id!==t.id)),await c(n(t),i,r),await Promise.all([o.invalidateQueries({queryKey:LB}),o.invalidateQueries({queryKey:RB})]),a()}}}function QB({program:e,progress:t,attention:n,exited:r,className:i,title:a}){let o=t!==null&&!n&&t.state!==`paused`&&t.state!==`error`,s=n?`text-amber-300`:t?.state===`error`?`text-rose-300`:t?.state===`paused`?`text-amber-300`:r&&!t?`text-rose-300`:o?`text-cyan-400`:`text-zinc-500`;return(0,V.jsxs)(`svg`,{viewBox:`0 0 24 24`,fill:`none`,className:W(`shrink-0 overflow-visible`,i),"aria-hidden":!a||void 0,children:[a?(0,V.jsx)(`title`,{children:a}):null,(0,V.jsx)(`g`,{className:W(`origin-center transition-[color,transform] duration-500`,s,o&&`scale-[0.62]`),children:e===`pi`?(0,V.jsxs)(`svg`,{viewBox:`0 0 800 800`,width:`24`,height:`24`,children:[(0,V.jsx)(`path`,{fill:`currentColor`,fillRule:`evenodd`,d:`M165.29 165.29H517.36V400H400V517.36H282.65V634.72H165.29ZM282.65 282.65V400H400V282.65Z`}),(0,V.jsx)(`path`,{fill:`currentColor`,d:`M517.36 400H634.72V634.72H517.36Z`})]}):e===`claude`?(0,V.jsx)(`path`,{fill:`currentColor`,fillRule:`evenodd`,clipRule:`evenodd`,d:`M20.998 10.949H24v3.102h-3v3.028h-1.487V20H18v-2.921h-1.487V20H15v-2.921H9V20H7.488v-2.921H6V20H4.487v-2.921H3V14.05H0V10.95h3V5h17.998v5.949zM6 10.949h1.488V8.102H6v2.847zm10.51 0H18V8.102h-1.49v2.847z`}):e===`codex`?(0,V.jsx)(`path`,{fill:`currentColor`,fillRule:`evenodd`,clipRule:`evenodd`,d:`M8.086.457a6.105 6.105 0 013.046-.415c1.333.153 2.521.72 3.564 1.7a.117.117 0 00.107.029c1.408-.346 2.762-.224 4.061.366l.063.03.154.076c1.357.703 2.33 1.77 2.918 3.198.278.679.418 1.388.421 2.126a5.655 5.655 0 01-.18 1.631.167.167 0 00.04.155 5.982 5.982 0 011.578 2.891c.385 1.901-.01 3.615-1.183 5.14l-.182.22a6.063 6.063 0 01-2.934 1.851.162.162 0 00-.108.102c-.255.736-.511 1.364-.987 1.992-1.199 1.582-2.962 2.462-4.948 2.451-1.583-.008-2.986-.587-4.21-1.736a.145.145 0 00-.14-.032c-.518.167-1.04.191-1.604.185a5.924 5.924 0 01-2.595-.622 6.058 6.058 0 01-2.146-1.781c-.203-.269-.404-.522-.551-.821a7.74 7.74 0 01-.495-1.283 6.11 6.11 0 01-.017-3.064.166.166 0 00.008-.074.115.115 0 00-.037-.064 5.958 5.958 0 01-1.38-2.202 5.196 5.196 0 01-.333-1.589 6.915 6.915 0 01.188-2.132c.45-1.484 1.309-2.648 2.577-3.493.282-.188.55-.334.802-.438.286-.12.573-.22.861-.304a.129.129 0 00.087-.087A6.016 6.016 0 015.635 2.31C6.315 1.464 7.132.846 8.086.457zm-.804 7.85a.848.848 0 00-1.473.842l1.694 2.965-1.688 2.848a.849.849 0 001.46.864l1.94-3.272a.849.849 0 00.007-.854l-1.94-3.393zm5.446 6.24a.849.849 0 000 1.695h4.848a.849.849 0 000-1.696h-4.848z`}):(0,V.jsxs)(`g`,{stroke:`currentColor`,strokeWidth:`1.5`,strokeLinecap:`round`,strokeLinejoin:`round`,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.jsxs)(`g`,{fill:`none`,stroke:`currentColor`,strokeWidth:`1.5`,className:`text-cyan-400`,children:[(0,V.jsx)(`rect`,{x:`3`,y:`3`,width:`18`,height:`18`,rx:`5`,className:W(`opacity-0 transition-opacity duration-500`,o&&`opacity-25`)}),(0,V.jsx)(`rect`,{x:`3`,y:`3`,width:`18`,height:`18`,rx:`5`,pathLength:`100`,strokeDasharray:`30 70`,className:W(`opacity-0 transition-opacity duration-500`,o&&`animate-comet opacity-100 motion-reduce:animate-none`)})]})]})}var $B=Object.defineProperty,eV=(e,t)=>$B(e,`name`,{value:t,configurable:!0}),tV=`horizontal`,nV=[`horizontal`,`vertical`],rV=B.forwardRef(eV(function(e,t){let{decorative:n,orientation:r=tV,...i}=e,a=iV(r)?r:tV,o=n?{role:`none`}:{"aria-orientation":a===`vertical`?a:void 0,role:`separator`};return(0,V.jsx)(sR.div,{"data-orientation":a,...o,...i,ref:t})},`Separator`));function iV(e){return nV.includes(e)}eV(iV,`isValidOrientation`);var aV=rV,oV=B.forwardRef(({className:e,orientation:t=`horizontal`,decorative:n=!0,...r},i)=>(0,V.jsx)(aV,{ref:i,decorative:n,orientation:t,className:W(`shrink-0 bg-border`,t===`horizontal`?`h-[1px] w-full`:`h-full w-[1px]`,e),...r}));oV.displayName=aV.displayName;var sV=`(max-width: 700px)`;function cV(e){let t=window.matchMedia(sV);return t.addEventListener(`change`,e),()=>t.removeEventListener(`change`,e)}function lV(){return window.matchMedia(sV).matches}function uV(){return(0,B.useSyncExternalStore)(cV,lV,()=>!1)}var dV=mz,fV=bz,pV=B.forwardRef(({className:e,...t},n)=>(0,V.jsx)(Sz,{className:W(`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}));pV.displayName=Sz.displayName;var mV=Ob(`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`}}),hV=B.forwardRef(({side:e=`right`,className:t,children:n,showCloseButton:r=!0,...i},a)=>(0,V.jsxs)(fV,{children:[(0,V.jsx)(pV,{}),(0,V.jsxs)(Ez,{ref:a,className:W(mV({side:e}),t),...i,children:[r?(0,V.jsxs)(Fz,{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)(ib,{className:`size-4`}),(0,V.jsx)(`span`,{className:`sr-only`,children:`Close`})]}):null,n]})]}));hV.displayName=Ez.displayName;var gV=({className:e,...t})=>(0,V.jsx)(`div`,{className:W(`flex flex-col gap-2 text-center sm:text-left`,e),...t});gV.displayName=`SheetHeader`;var _V=({className:e,...t})=>(0,V.jsx)(`div`,{className:W(`flex flex-col-reverse gap-2 sm:flex-row sm:justify-end`,e),...t});_V.displayName=`SheetFooter`;var vV=B.forwardRef(({className:e,...t},n)=>(0,V.jsx)(jz,{ref:n,className:W(`text-lg font-semibold text-foreground`,e),...t}));vV.displayName=jz.displayName;var yV=B.forwardRef(({className:e,...t},n)=>(0,V.jsx)(Nz,{ref:n,className:W(`text-sm text-muted-foreground`,e),...t}));yV.displayName=Nz.displayName;function bV({className:e,...t}){return(0,V.jsx)(`div`,{className:W(`animate-pulse rounded-md bg-primary/10`,e),...t})}var xV=`16rem`,SV=`min(88vw, 21rem)`,CV=`3rem`,wV=B.createContext(null);function TV(){let e=B.useContext(wV);if(!e)throw Error(`useSidebar must be used within a SidebarProvider.`);return e}var EV=B.forwardRef(({defaultOpen:e=!0,open:t,onOpenChange:n,className:r,style:i,children:a,...o},s)=>{let c=uV(),[l,u]=B.useState(!1),d=B.useRef(null),f=B.useRef(!1),p=B.useCallback(e=>{u(t=>{let n=e instanceof 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=e instanceof 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)(wV.Provider,{value:x,children:(0,V.jsx)(ef,{delayDuration:0,children:(0,V.jsx)(`div`,{style:{"--sidebar-width":xV,"--sidebar-width-icon":CV,...i},className:W(`group/sidebar-wrapper flex min-h-svh w-full has-[[data-variant=inset]]:bg-sidebar`,r),ref:s,...o,children:a})})})});EV.displayName=`SidebarProvider`;var DV=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}=TV();return l?(0,V.jsx)(dV,{open:d,onOpenChange:f,children:(0,V.jsxs)(hV,{"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":SV},side:e,showCloseButton:!1,onCloseAutoFocus:e=>{e.preventDefault(),m.current?m.current=!1:p.current?.isConnected&&p.current.focus()},children:[(0,V.jsxs)(gV,{className:`sr-only`,children:[(0,V.jsx)(vV,{children:a}),(0,V.jsx)(yV,{children:o})]}),(0,V.jsx)(`div`,{ref:c,className:W(`flex h-full w-full flex-col`,r),...s,children:i})]})}):n===`none`?(0,V.jsx)(`div`,{className:W(`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:W(`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:W(`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})})]})});DV.displayName=`Sidebar`;var OV=B.forwardRef(({className:e,onClick:t,children:n,...r},i)=>{let{toggleSidebar:a}=TV();return(0,V.jsxs)(X,{ref:i,"data-sidebar":`trigger`,variant:`ghost`,size:`icon`,className:W(`size-7`,e),onClick:e=>{t?.(e),a()},...r,children:[n??(0,V.jsx)(tb,{}),r[`aria-label`]?null:(0,V.jsx)(`span`,{className:`sr-only`,children:`Toggle Sidebar`})]})});OV.displayName=`SidebarTrigger`;var kV=B.forwardRef(({className:e,...t},n)=>{let{toggleSidebar:r}=TV();return(0,V.jsx)(`button`,{ref:n,"data-sidebar":`rail`,"aria-label":`Toggle Sidebar`,tabIndex:-1,onClick:r,title:`Toggle Sidebar`,className:W(`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})});kV.displayName=`SidebarRail`;var AV=B.forwardRef(({className:e,asChild:t=!1,...n},r)=>(0,V.jsx)(t?pb:`main`,{ref:r,className:W(`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}));AV.displayName=`SidebarInset`;var jV=B.forwardRef(({className:e,...t},n)=>(0,V.jsx)(dL,{ref:n,"data-sidebar":`input`,className:W(`h-8 w-full bg-background shadow-none focus-visible:ring-2 focus-visible:ring-sidebar-ring`,e),...t}));jV.displayName=`SidebarInput`;var MV=B.forwardRef(({className:e,...t},n)=>(0,V.jsx)(`div`,{ref:n,"data-sidebar":`header`,className:W(`flex flex-col gap-2 p-2`,e),...t}));MV.displayName=`SidebarHeader`;var NV=B.forwardRef(({className:e,...t},n)=>(0,V.jsx)(`div`,{ref:n,"data-sidebar":`footer`,className:W(`flex flex-col gap-2 p-2`,e),...t}));NV.displayName=`SidebarFooter`;var PV=B.forwardRef(({className:e,...t},n)=>(0,V.jsx)(oV,{ref:n,"data-sidebar":`separator`,className:W(`mx-2 w-auto bg-sidebar-border`,e),...t}));PV.displayName=`SidebarSeparator`;var FV=B.forwardRef(({className:e,...t},n)=>(0,V.jsx)(`div`,{ref:n,"data-sidebar":`content`,className:W(`flex min-h-0 flex-1 flex-col gap-2 overflow-auto group-data-[collapsible=icon]:overflow-hidden`,e),...t}));FV.displayName=`SidebarContent`;var IV=B.forwardRef(({className:e,...t},n)=>(0,V.jsx)(`div`,{ref:n,"data-sidebar":`group`,className:W(`relative flex w-full min-w-0 flex-col p-2`,e),...t}));IV.displayName=`SidebarGroup`;var LV=B.forwardRef(({className:e,asChild:t=!1,...n},r)=>(0,V.jsx)(t?pb:`div`,{ref:r,"data-sidebar":`group-label`,className:W(`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}));LV.displayName=`SidebarGroupLabel`;var RV=B.forwardRef(({className:e,asChild:t=!1,...n},r)=>(0,V.jsx)(t?pb:`button`,{ref:r,"data-sidebar":`group-action`,className:W(`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}));RV.displayName=`SidebarGroupAction`;var zV=B.forwardRef(({className:e,...t},n)=>(0,V.jsx)(`div`,{ref:n,"data-sidebar":`group-content`,className:W(`w-full text-sm`,e),...t}));zV.displayName=`SidebarGroupContent`;var BV=B.forwardRef(({className:e,...t},n)=>(0,V.jsx)(`ul`,{ref:n,"data-sidebar":`menu`,className:W(`flex w-full min-w-0 flex-col gap-1`,e),...t}));BV.displayName=`SidebarMenu`;var VV=B.forwardRef(({className:e,...t},n)=>(0,V.jsx)(`li`,{ref:n,"data-sidebar":`menu-item`,className:W(`group/menu-item relative`,e),...t}));VV.displayName=`SidebarMenuItem`;var HV=Ob(`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`}}),UV=B.forwardRef(({asChild:e=!1,isActive:t=!1,variant:n=`default`,size:r=`default`,tooltip:i,className:a,...o},s)=>{let c=e?pb:`button`,{isMobile:l,state:u}=TV(),d=(0,V.jsx)(c,{ref:s,"data-sidebar":`menu-button`,"data-size":r,"data-active":t,className:W(HV({variant:n,size:r}),a),...o});if(!i)return d;let f=q().safeParse(i),p;return p=f.success?{children:f.data}:i,(0,V.jsxs)(tf,{children:[(0,V.jsx)(nf,{asChild:!0,children:d}),(0,V.jsx)(rf,{side:`right`,align:`center`,hidden:u!==`collapsed`||l,...p})]})});UV.displayName=`SidebarMenuButton`;var WV=B.forwardRef(({className:e,asChild:t=!1,showOnHover:n=!1,...r},i)=>(0,V.jsx)(t?pb:`button`,{ref:i,"data-sidebar":`menu-action`,className:W(`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}));WV.displayName=`SidebarMenuAction`;var GV=B.forwardRef(({className:e,...t},n)=>(0,V.jsx)(`div`,{ref:n,"data-sidebar":`menu-badge`,className:W(`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}));GV.displayName=`SidebarMenuBadge`;var KV=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:W(`flex h-8 items-center gap-2 rounded-md px-2`,e),...n,children:[t&&(0,V.jsx)(bV,{className:`size-4 rounded-md`,"data-sidebar":`menu-skeleton-icon`}),(0,V.jsx)(bV,{className:`h-4 max-w-[--skeleton-width] flex-1`,"data-sidebar":`menu-skeleton-text`,style:{"--skeleton-width":i}})]})});KV.displayName=`SidebarMenuSkeleton`;var qV=B.forwardRef(({className:e,...t},n)=>(0,V.jsx)(`ul`,{ref:n,"data-sidebar":`menu-sub`,className:W(`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}));qV.displayName=`SidebarMenuSub`;var JV=B.forwardRef(({...e},t)=>(0,V.jsx)(`li`,{ref:t,...e}));JV.displayName=`SidebarMenuSubItem`;var YV=B.forwardRef(({asChild:e=!1,size:t=`md`,isActive:n,className:r,...i},a)=>(0,V.jsx)(e?pb:`a`,{ref:a,"data-sidebar":`menu-sub-button`,"data-size":t,"data-active":n,className:W(`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}));YV.displayName=`SidebarMenuSubButton`;function XV({label:e,tooltip:t=e,className:n,disabled:r,keyShortcuts:i,onClick:a,children:o}){return(0,V.jsxs)(tf,{children:[(0,V.jsx)(nf,{asChild:!0,children:(0,V.jsxs)(X,{type:`button`,variant:`ghost`,size:`icon-sm`,className:n,"aria-label":e,"aria-keyshortcuts":i,disabled:r,onClick:e=>a(e.currentTarget),children:[o,(0,V.jsx)(`span`,{className:`touch-target`,"aria-hidden":`true`})]})}),(0,V.jsx)(rf,{side:`top`,children:t})]})}var ZV=240,QV=420,$V=272,eH=`treeport-sidebar-width`,tH=(0,B.createContext)(null),nH=(0,B.createContext)(null);function rH(e){return Math.min(QV,Math.max(ZV,e))}function iH(){let e=(0,B.useContext)(tH);if(!e)throw Error(`useProjectSwitcher must be used within WorkspaceShell.`);return e}function aH({children:e}){let[t,n]=(0,B.useState)(!1),r=(0,B.useRef)(null),i=(0,B.useRef)(!1),[a,o]=(0,B.useState)(()=>{let e=Number.parseInt(localStorage.getItem(eH)??``,10);return Number.isFinite(e)?rH(e):$V}),[s,c]=(0,B.useState)(!1);return(0,V.jsx)(tH.Provider,{value:{open:t,setOpen:n,triggerRef:r,dismissedIntoTerminalRef:i},children:(0,V.jsx)(nH.Provider,{value:{width:a,resizing:s,setWidth:e=>{let t=rH(e);o(t),localStorage.setItem(eH,String(t))},setResizing:c},children:(0,V.jsx)(EV,{className:W(`app-frame isolate grid min-h-0 grid-cols-[var(--sidebar-width)_minmax(0,1fr)] bg-zinc-950 max-[700px]:grid-cols-1 max-[700px]:grid-rows-[3.25rem_minmax(0,1fr)]`,s&&`select-none`),style:{"--sidebar-width":`${a}px`,"--sidebar-width-mobile":`min(88vw, 21rem)`},children:e})})})}function oH({children:e}){let{isMobile:t,openMobile:n}=TV(),r=iH();return(0,V.jsx)(AV,{asChild:!0,children:(0,V.jsx)(`div`,{className:`relative 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 sH(){let e=(0,B.useContext)(nH),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:W(`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":ZV,"aria-valuemax":QV,"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=ZV;else if(t.key===`End`)n=QV;else return;t.preventDefault(),e.setWidth(n)},onDoubleClick:()=>e.setWidth($V)})}function cH({blocked:e}){let t=/Mac|iPhone|iPad|iPod/.test(navigator.platform),{isMobile:n,setOpenMobile:r}=TV(),i=iH();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 lH({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}=TV(),l=iH(),u=qe(),{attention:d,progress:f}=YF(),[p,m]=(0,B.useState)(``),[h,g]=(0,B.useState)(null),_=lt({...VB,enabled:l.open}),v=dt({mutationFn:async e=>(await Ef(NN.api.projects[`:projectId`].open.$post({param:{projectId:e.id}}))).project,onSuccess:i,onError:(e,t)=>{vI(e,{operation:`reopen project “${t.name}”`})}}),y=dt({mutationFn:e=>Ef(NN.api.projects[`:projectId`].recent.$delete({param:{projectId:e.id}})),onSuccess:async(e,t)=>{u.setQueryData(RB,e=>e?.filter(e=>e.id!==t.id)),g(null),await u.invalidateQueries({queryKey:RB})},onError:(e,t)=>{vI(e,{operation:`remove project “${t.name}” from Recent projects`})}}),b=e=>{r(e),m(``),g(null)},x=e=>{v.mutate(e),m(``),g(null)},S=p.trim().toLocaleLowerCase(),C=e.filter(e=>!S||e.name.toLocaleLowerCase().includes(S)||e.rootPath.toLocaleLowerCase().includes(S)),w=new Set(e.map(e=>e.id)),T=(_.data??[]).filter(e=>!w.has(e.id)),E=T.filter(e=>!S||e.name.toLocaleLowerCase().includes(S)||e.rootPath.toLocaleLowerCase().includes(S)),D=[...C.map(e=>({kind:`open`,project:e})),...E.map(e=>({kind:`recent`,project:e}))],O=D.find(e=>e.project.id===h)??D[0]??null;return(0,V.jsxs)(YS,{open:l.open,onOpenChange:e=>{l.setOpen(e),g(null),m(``)},children:[(0,V.jsx)(XS,{asChild:!0,children:(0,V.jsxs)(X,{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?.rootPath??`Open project`} — ${s?`⌘⇧P`:`Ctrl+Shift+P`}`,children:[(0,V.jsx)(`span`,{className:`truncate font-medium`,children:t?.name??`Open project`}),(0,V.jsx)(HI,{className:`ml-auto shrink-0 fill-zinc-600`,"data-icon":`inline-end`})]})}),(0,V.jsxs)(ZS,{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)(eL,{className:`pointer-events-none absolute top-1/2 left-2 size-4 -translate-y-1/2 fill-zinc-600`}),(0,V.jsx)(dL,{name:`project-search`,value:p,onChange:e=>{m(e.target.value),g(null)},onKeyDown:e=>{if(e.nativeEvent.isComposing||!D.length)return;if(e.key===`Enter`){e.preventDefault(),O?.kind===`open`?b(O.project):O?.kind===`recent`&&!v.isPending&&!y.isPending&&x(O.project);return}if(e.key!==`ArrowDown`&&e.key!==`ArrowUp`)return;e.preventDefault();let t=Math.max(0,D.findIndex(e=>e.project.id===O?.project.id)),n=e.key===`ArrowDown`?Math.min(t+1,D.length-1):Math.max(t-1,0),r=D[n];g(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":O?`project-switcher-option-${O.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:[C.length?(0,V.jsx)(`ul`,{role:`list`,className:`grid gap-1 min-[701px]:gap-0.5`,children:C.map(e=>{let r=e.worktrees.flatMap(e=>e.terminals),i=r.some(e=>d.has(e.id)),o=r.map(e=>f.get(e.id)).find(e=>e!==void 0);return(0,V.jsxs)(`li`,{className:W(`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`,O?.project.id===e.id&&`bg-white/8`),onMouseEnter:()=>g(e.id),children:[(0,V.jsxs)(X,{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":O?.project.id===e.id||void 0,onClick:()=>b(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)(II,{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)(QB,{program:null,progress:o,attention:!1,exited:!1,className:`size-4`,title:oC(o)}):null,i?(0,V.jsx)(QB,{program:null,progress:null,attention:!0,exited:!1,className:`size-4`,title:`Terminal needs attention`}):null]}):null]}),(0,V.jsx)(XV,{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)(EI,{className:`animate-spin`}):(0,V.jsx)(uL,{})})]},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.`}),!_.isSuccess||T.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`}),_.isFetching?(0,V.jsx)(EI,{className:`size-4 shrink-0 animate-spin fill-zinc-600`,"aria-label":`Refreshing recent projects`}):null]}),_.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)(X,{type:`button`,variant:`ghost`,size:`sm`,className:`h-9 text-base min-[701px]:h-7 min-[701px]:text-sm`,onClick:()=>void _.refetch(),children:`Retry`})]}):null,_.isSuccess&&E.length?(0,V.jsx)(`ul`,{role:`list`,className:`grid gap-1 min-[701px]:gap-0.5`,children:E.map(e=>(0,V.jsxs)(`li`,{className:W(`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`,O?.project.id===e.id&&`bg-white/8`),onMouseEnter:()=>g(e.id),children:[(0,V.jsx)(X,{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":O?.project.id===e.id||void 0,disabled:v.isPending||y.isPending,onClick:()=>x(e),children:(0,V.jsx)(`span`,{className:`truncate font-medium text-zinc-200`,children:e.name})}),(0,V.jsx)(XV,{label:`Remove recent project ${e.name}`,tooltip:`Remove recent project`,disabled:y.isPending,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:()=>y.mutate(e),children:y.isPending&&y.variables?.id===e.id?(0,V.jsx)(EI,{className:`animate-spin`}):(0,V.jsx)(uL,{})})]},e.id))}):null,_.isSuccess&&!E.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)(oV,{className:`bg-white/8`}),(0,V.jsxs)(X,{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)(nL,{"data-icon":`inline-start`}),` Open project…`]})]})]})}function uH({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:W(`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)(RI,{className:`pointer-events-none col-start-2 row-start-1 size-4 place-self-center text-zinc-500`})]})}function dH({projectSwitcher:e,updateControl:t,notificationCenter:n,children:r}){return(0,V.jsxs)(DV,{id:`worktree-sidebar`,collapsible:`none`,mobileTitle:`Projects and trees`,mobileDescription:`Navigate projects, trees, 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)(MV,{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)(OV,{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)(uL,{}),(0,V.jsx)(`span`,{className:`touch-target`,"aria-hidden":`true`})]})}),(0,V.jsxs)(`div`,{className:`flex items-center gap-1 p-2 max-[700px]:pt-0`,children:[(0,V.jsx)(`div`,{className:`min-w-0 flex-1`,children:e}),(0,V.jsx)(`div`,{className:`max-[700px]:hidden`,children:t}),(0,V.jsx)(`div`,{className:`max-[700px]:hidden`,children:n})]})]}),(0,V.jsx)(FV,{className:`gap-0 overflow-hidden`,children:r}),(0,V.jsx)(sH,{})]})}function fH({selectedTerminalId:e,terminals:t,onSelectTerminal:n,updateControl:r,notificationCenter:i}){let{isMobile:a,openMobile:o}=TV(),{titles:s}=YF();return(0,V.jsxs)(`header`,{className:`mobile-bar hidden min-w-0 grid-cols-[2.75rem_minmax(0,1fr)_2.25rem_2.75rem] items-center gap-2 border-b border-white/8 bg-zinc-900/95 px-2 backdrop-blur max-[700px]:grid`,inert:a&&o?!0:void 0,children:[(0,V.jsxs)(OV,{type:`button`,size:`icon`,className:`icon-button text-zinc-400 hover:bg-white/5 hover:text-zinc-100`,"aria-label":`Open tree drawer`,children:[(0,V.jsx)(MI,{}),(0,V.jsx)(`span`,{className:`touch-target`,"aria-hidden":`true`})]}),(0,V.jsxs)(uH,{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:s.get(e.id)||e.name},e.id))]}),r,i]})}var pH=Object.defineProperty,mH=(e,t)=>pH(e,`name`,{value:t,configurable:!0});function hH(e){let t=e+`CollectionProvider`,[n,r]=AL(t),[i,a]=n(t,{collectionRef:{current:null},itemMap:new Map}),o=mH(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})},`CollectionProvider`);o.displayName=t;let s=e+`CollectionSlot`,c=fb(s),l=B.forwardRef((e,t)=>{let{scope:n,children:r}=e,i=lb(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=fb(u),p=B.forwardRef((e,t)=>{let{scope:n,children:r,...i}=e,o=B.useRef(null),s=lb(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 mH(m,`useCollection`),[{Provider:o,Slot:l,ItemSlot:p},m,r]}mH(hH,`createCollection`);var gH=new WeakMap,_H=class e extends Map{static{mH(this,`OrderedDict`)}#e;constructor(e){super(e),this.#e=[...super.keys()],gH.set(this,!0)}set(e,t){return gH.get(this)&&(this.has(e)?this.#e[this.#e.indexOf(e)]=e:this.#e.push(e)),super.set(e,t),this}insert(e,t,n){let r=this.has(t),i=this.#e.length,a=bH(e),o=a>=0?a:i+a,s=o<0||o>=i?-1:o;if(s===this.size||r&&s===this.size-1||s===-1)return this.set(t,n),this;let c=this.size+ +!r;a<0&&o++;let l=[...this.#e],u,d=!1;for(let e=o;e<c;e++)if(o===e){let i=l[e];l[e]===t&&(i=l[e+1]),r&&this.delete(t),u=this.get(i),this.set(t,n)}else{!d&&l[e-1]===t&&(d=!0);let n=l[d?e:e-1],r=u;u=this.get(n),this.delete(n),this.set(n,r)}return this}with(t,n,r){let i=new e(this);return i.insert(t,n,r),i}before(e){let t=this.#e.indexOf(e)-1;if(!(t<0))return this.entryAt(t)}setBefore(e,t,n){let r=this.#e.indexOf(e);return r===-1?this:this.insert(r,t,n)}after(e){let t=this.#e.indexOf(e);if(t=t===-1||t===this.size-1?-1:t+1,t!==-1)return this.entryAt(t)}setAfter(e,t,n){let r=this.#e.indexOf(e);return r===-1?this:this.insert(r+1,t,n)}first(){return this.entryAt(0)}last(){return this.entryAt(-1)}clear(){return this.#e=[],super.clear()}delete(e){let t=super.delete(e);return t&&this.#e.splice(this.#e.indexOf(e),1),t}deleteAt(e){let t=this.keyAt(e);return t!==void 0&&this.delete(t)}at(e){let t=vH(this.#e,e);if(t!==void 0)return this.get(t)}entryAt(e){let t=vH(this.#e,e);if(t!==void 0)return[t,this.get(t)]}indexOf(e){return this.#e.indexOf(e)}keyAt(e){return vH(this.#e,e)}from(e,t){let n=this.indexOf(e);if(n===-1)return;let r=n+t;return r<0&&(r=0),r>=this.size&&(r=this.size-1),this.at(r)}keyFrom(e,t){let n=this.indexOf(e);if(n===-1)return;let r=n+t;return r<0&&(r=0),r>=this.size&&(r=this.size-1),this.keyAt(r)}find(e,t){let n=0;for(let r of this){if(Reflect.apply(e,t,[r,n,this]))return r;n++}}findIndex(e,t){let n=0;for(let r of this){if(Reflect.apply(e,t,[r,n,this]))return n;n++}return-1}filter(t,n){let r=[],i=0;for(let e of this)Reflect.apply(t,n,[e,i,this])&&r.push(e),i++;return new e(r)}map(t,n){let r=[],i=0;for(let e of this)r.push([e[0],Reflect.apply(t,n,[e,i,this])]),i++;return new e(r)}reduce(...e){let[t,n]=e,r=0,i=n??this.at(0);for(let n of this)i=r===0&&e.length===1?n:Reflect.apply(t,this,[i,n,r,this]),r++;return i}reduceRight(...e){let[t,n]=e,r=n??this.at(-1);for(let n=this.size-1;n>=0;n--){let i=this.at(n);r=n===this.size-1&&e.length===1?i:Reflect.apply(t,this,[r,i,n,this])}return r}toSorted(t){let n=[...this.entries()].sort(t);return new e(n)}toReversed(){let t=new e;for(let e=this.size-1;e>=0;e--){let n=this.keyAt(e),r=this.get(n);t.set(n,r)}return t}toSpliced(...t){let n=[...this.entries()];return n.splice(...t),new e(n)}slice(t,n){let r=new e,i=this.size-1;if(t===void 0)return r;t<0&&(t+=this.size),n!==void 0&&n>0&&(i=n-1);for(let e=t;e<=i;e++){let t=this.keyAt(e),n=this.get(t);r.set(t,n)}return r}every(e,t){let n=0;for(let r of this){if(!Reflect.apply(e,t,[r,n,this]))return!1;n++}return!0}some(e,t){let n=0;for(let r of this){if(Reflect.apply(e,t,[r,n,this]))return!0;n++}return!1}};function vH(e,t){if(`at`in Array.prototype)return Array.prototype.at.call(e,t);let n=yH(e,t);return n===-1?void 0:e[n]}mH(vH,`at`);function yH(e,t){let n=e.length,r=bH(t),i=r>=0?r:n+r;return i<0||i>=n?-1:i}mH(yH,`toSafeIndex`);function bH(e){return e!==e||e===0?0:Math.trunc(e)}mH(bH,`toSafeInteger`);function xH(e){let t=e+`CollectionProvider`,[n,r]=AL(t),[i,a]=n(t,{collectionElement:null,collectionRef:{current:null},collectionRefObject:{current:null},itemMap:new _H,setItemMap:mH(()=>void 0,`setItemMap`)}),o=mH(({state:e,...t})=>e?(0,V.jsx)(c,{...t,state:e}):(0,V.jsx)(s,{...t}),`CollectionProvider`);o.displayName=t;let s=mH(e=>{let t=h();return(0,V.jsx)(c,{...e,state:t})},`CollectionInit`);s.displayName=t+`Init`;let c=mH(e=>{let{scope:t,children:n,state:r}=e,a=B.useRef(null),[o,s]=B.useState(null),c=lb(a,s),[l,u]=r;return B.useEffect(()=>{if(!o)return;let e=TH(()=>{});return e.observe(o,{childList:!0,subtree:!0}),()=>{e.disconnect()}},[o]),(0,V.jsx)(i,{scope:t,itemMap:l,setItemMap:u,collectionRef:c,collectionRefObject:a,collectionElement:o,children:n})},`CollectionProviderImpl`);c.displayName=t+`Impl`;let l=e+`CollectionSlot`,u=fb(l),d=B.forwardRef((e,t)=>{let{scope:n,children:r}=e,i=lb(t,a(l,n).collectionRef);return(0,V.jsx)(u,{ref:i,children:r})});d.displayName=l;let f=e+`CollectionItemSlot`,p=fb(f),m=B.forwardRef((e,t)=>{let{scope:n,children:r,...i}=e,o=B.useRef(null),[s,c]=B.useState(null),l=lb(t,o,c),{setItemMap:u}=a(f,n),d=B.useRef(i);SH(d.current,i)||(d.current=i);let m=d.current;return B.useEffect(()=>{let e=m;return u(t=>s?t.has(s)?t.set(s,{...e,element:s}).toSorted(wH):(t.set(s,{...e,element:s}),t.toSorted(wH)):t),()=>{u(e=>!s||!e.has(s)?e:(e.delete(s),new _H(e)))}},[s,m,u]),(0,V.jsx)(p,{"data-radix-collection-item":``,ref:l,children:r})});m.displayName=f;function h(){return B.useState(new _H)}mH(h,`useInitCollection`);function g(t){let{itemMap:n}=a(e+`CollectionConsumer`,t);return n}return mH(g,`useCollection`),[{Provider:o,Slot:d,ItemSlot:m},{createCollectionScope:r,useCollection:g,useInitCollection:h}]}mH(xH,`createCollection`);function SH(e,t){if(e===t)return!0;if(typeof e!=`object`||typeof t!=`object`||e==null||t==null)return!1;let n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(let r of n)if(!Object.prototype.hasOwnProperty.call(t,r)||e[r]!==t[r])return!1;return!0}mH(SH,`shallowEqual`);function CH(e,t){return!!(t.compareDocumentPosition(e)&Node.DOCUMENT_POSITION_PRECEDING)}mH(CH,`isElementPreceding`);function wH(e,t){return!e[1].element||!t[1].element?0:CH(e[1].element,t[1].element)?-1:1}mH(wH,`sortByDocumentPosition`);function TH(e){return new MutationObserver(t=>{for(let n of t)if(n.type===`childList`){e();return}})}mH(TH,`getChildListObserver`);var EH=Object.defineProperty,DH=(e,t)=>EH(e,`name`,{value:t,configurable:!0}),OH=B.createContext(void 0);function kH(e){let t=B.useContext(OH);return e||t||`ltr`}DH(kH,`useDirection`);var AH=Object.defineProperty,jH=(e,t)=>AH(e,`name`,{value:t,configurable:!0});function MH(e){let[t,n]=B.useState(void 0);return BL(()=>{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}jH(MH,`useSize`);var NH=Object.defineProperty,PH=(e,t)=>NH(e,`name`,{value:t,configurable:!0}),FH=`Popper`,[IH,LH]=AL(FH),[RH,zH]=IH(FH),BH=PH(e=>{let{__scopePopper:t,children:n}=e,[r,i]=B.useState(null),[a,o]=B.useState(void 0);return(0,V.jsx)(RH,{scope:t,anchor:r,onAnchorChange:i,placementState:a,setPlacementState:o,children:n})},`Popper`),VH=`PopperAnchor`,HH=B.forwardRef(PH(function(e,t){let{__scopePopper:n,virtualRef:r,...i}=e,a=zH(VH,n),o=B.useRef(null),s=a.onAnchorChange,c=lb(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&&YH(a.placementState),d=u?.[0],f=u?.[1];return r?null:(0,V.jsx)(sR.div,{"data-radix-popper-side":d,"data-radix-popper-align":f,...i,ref:c})},`PopperAnchor`)),UH=`PopperContent`,[WH,GH]=IH(UH),KH=B.forwardRef(PH(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=zH(UH,n),[_,v]=B.useState(null),y=lb(t,v),[b,x]=B.useState(null),S=MH(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(qH),altBoundary:O},{refs:A,floatingStyles:j,placement:M,isPositioned:N,middlewareData:P}=Uc({strategy:`fixed`,placement:T,whileElementsMounted:PH((...e)=>kc(...e,{animationFrame:p===`always`}),`whileElementsMounted`),elements:{reference:g.anchor},middleware:[Gc({mainAxis:i+w,alignmentAxis:o}),c&&Kc({mainAxis:!0,crossAxis:!1,limiter:d===`partial`?qc():void 0,...k}),c&&Jc({...k}),Yc({...k,apply:PH(({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&&Zc({element:b,padding:s}),JH({arrowWidth:C,arrowHeight:w}),f&&Xc({strategy:`referenceHidden`,...k,boundary:O?k.boundary:void 0})]}),ee=g.setPlacementState;BL(()=>(ee(M),()=>{ee(void 0)}),[M,ee]);let[F,I]=YH(M),te=dR(m);BL(()=>{N&&te?.()},[N,te]);let L=P.arrow?.x,ne=P.arrow?.y,R=P.arrow?.centerOffset!==0,[re,z]=B.useState();return BL(()=>{_&&z(window.getComputedStyle(_).zIndex)},[_]),(0,V.jsx)(`div`,{ref:A.setFloating,"data-radix-popper-content-wrapper":``,style:{...j,transform:N?j.transform:`translate(0, -200%)`,minWidth:`max-content`,zIndex:re,"--radix-popper-transform-origin":[P.transformOrigin?.x,P.transformOrigin?.y].join(` `),...P.hide?.referenceHidden&&{visibility:`hidden`,pointerEvents:`none`}},dir:e.dir,children:(0,V.jsx)(WH,{scope:n,placedSide:F,placedAlign:I,onArrowChange:x,arrowX:L,arrowY:ne,shouldHideArrow:R,children:(0,V.jsx)(sR.div,{"data-side":F,"data-align":I,...h,ref:y,style:{...h.style,animation:N?h.style?.animation:`none`}})})})},`PopperContent`));function qH(e){return e!==null}PH(qH,`isNotNull`);var JH=PH(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]=YH(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 YH(e){let[t,n=`center`]=e.split(`-`);return[t,n]}PH(YH,`getSideAndAlignFromPlacement`);var XH=BH,ZH=HH,QH=KH,$H=Object.defineProperty,eU=(e,t)=>$H(e,`name`,{value:t,configurable:!0}),tU=!1;function nU(){let[e,t]=B.useState(tU);return B.useEffect(()=>{tU||(tU=!0,t(!0))},[]),e}eU(nU,`useIsHydrated`);var rU=B.useSyncExternalStore;function iU(){return()=>{}}eU(iU,`subscribe`);function aU(){return rU(iU,()=>!0,()=>!1)}eU(aU,`useIsHydratedModern`);var oU=typeof rU==`function`?aU:nU,sU=Object.defineProperty,cU=(e,t)=>sU(e,`name`,{value:t,configurable:!0}),lU=`rovingFocusGroup.onEntryFocus`,uU={bubbles:!1,cancelable:!0},dU=`RovingFocusGroup`,[fU,pU,mU]=hH(dU),[hU,gU]=AL(dU,[mU]),[_U,vU]=hU(dU),yU=B.forwardRef(cU(function(e,t){return(0,V.jsx)(fU.Provider,{scope:e.__scopeRovingFocusGroup,children:(0,V.jsx)(fU.Slot,{scope:e.__scopeRovingFocusGroup,children:(0,V.jsx)(bU,{...e,ref:t})})})},`RovingFocusGroup`)),bU=B.forwardRef(cU(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=lb(t,f),m=kH(a),[h,g]=eR({prop:o,defaultProp:s??null,onChange:c,caller:dU}),[_,v]=B.useState(!1),y=dR(l),b=pU(n),x=B.useRef(!1),[S,C]=B.useState(0);return B.useEffect(()=>{let e=f.current;if(e)return e.addEventListener(lU,y),()=>e.removeEventListener(lU,y)},[y]),(0,V.jsx)(_U,{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)(sR.div,{tabIndex:_||S===0?-1:0,"data-orientation":r,...d,ref:p,style:{outline:`none`,...e.style},onMouseDown:FL(e.onMouseDown,()=>{x.current=!0}),onFocus:FL(e.onFocus,e=>{let t=!x.current;if(e.target===e.currentTarget&&t&&!_){let t=new CustomEvent(lU,uU);if(e.currentTarget.dispatchEvent(t),!t.defaultPrevented){let e=b().filter(e=>e.focusable);EU([e.find(e=>e.active),e.find(e=>e.id===h),...e].filter(Boolean).map(e=>e.ref.current),u)}}x.current=!1}),onBlur:FL(e.onBlur,()=>v(!1))})})},`RovingFocusGroupImpl`)),xU=`RovingFocusGroupItem`,SU=B.forwardRef(cU(function(e,t){let{__scopeRovingFocusGroup:n,focusable:r=!0,active:i=!1,tabStopId:a,children:o,...s}=e,c=GL(),l=a||c,u=vU(xU,n),d=u.currentTabStopId===l,f=pU(n),{onFocusableItemAdd:p,onFocusableItemRemove:m,currentTabStopId:h}=u,g=oU();return BL(()=>{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)(fU.ItemSlot,{scope:n,id:l,focusable:r,active:i,children:(0,V.jsx)(sR.span,{tabIndex:d?0:-1,"data-orientation":u.orientation,...s,ref:t,onMouseDown:FL(e.onMouseDown,e=>{r?u.onItemFocus(l):e.preventDefault()}),onFocus:FL(e.onFocus,()=>u.onItemFocus(l)),onKeyDown:FL(e.onKeyDown,e=>{if(e.key===`Tab`&&e.shiftKey){u.onItemShiftTab();return}if(e.target!==e.currentTarget)return;let t=TU(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(()=>EU(n))}}),children:typeof o==`function`?o({isCurrentTabStop:d,hasTabStop:h!=null}):o})})},`RovingFocusGroupItem`)),CU={ArrowLeft:`prev`,ArrowUp:`prev`,ArrowRight:`next`,ArrowDown:`next`,PageUp:`first`,Home:`first`,PageDown:`last`,End:`last`};function wU(e,t){return t===`rtl`?e===`ArrowLeft`?`ArrowRight`:e===`ArrowRight`?`ArrowLeft`:e:e}cU(wU,`getDirectionAwareKey`);function TU(e,t,n){let r=wU(e.key,n);if(!(t===`vertical`&&[`ArrowLeft`,`ArrowRight`].includes(r))&&!(t===`horizontal`&&[`ArrowUp`,`ArrowDown`].includes(r)))return CU[r]}cU(TU,`getFocusIntent`);function EU(e,t=!1){let n=document.activeElement;for(let r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}cU(EU,`focusFirst`);function DU(e,t){return e.map((n,r)=>e[(t+r)%e.length])}cU(DU,`wrapArray`);var OU=yU,kU=SU,AU=Object.defineProperty,jU=(e,t)=>AU(e,`name`,{value:t,configurable:!0}),MU=[`Enter`,` `],NU=[`ArrowDown`,`PageUp`,`Home`],PU=[`ArrowUp`,`PageDown`,`End`],FU=[...NU,...PU];[...MU],[...MU];var IU=`Menu`,[LU,RU,zU]=hH(IU),[BU,VU]=AL(IU,[zU,LH,gU]),HU=LH(),UU=gU(),[WU,GU]=BU(IU),[KU,qU]=BU(IU),JU=jU(e=>{let{__scopeMenu:t,open:n=!1,children:r,dir:i,onOpenChange:a,modal:o=!0}=e,s=HU(t),[c,l]=B.useState(null),u=B.useRef(!1),d=dR(a),f=kH(i);return B.useEffect(()=>{let e=jU(()=>{u.current=!0,document.addEventListener(`pointerdown`,t,{capture:!0,once:!0}),document.addEventListener(`pointermove`,t,{capture:!0,once:!0})},`handleKeyDown`),t=jU(()=>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=jU(()=>d(!1),`handleBlur`);return window.addEventListener(`blur`,e),()=>window.removeEventListener(`blur`,e)},[n,d]),(0,V.jsx)(XH,{...s,children:(0,V.jsx)(WU,{scope:t,open:n,onOpenChange:d,content:c,onContentChange:l,children:(0,V.jsx)(KU,{scope:t,onClose:B.useCallback(()=>d(!1),[d]),isUsingKeyboardRef:u,dir:f,modal:o,children:r})})})},`Menu`),YU=B.forwardRef(jU(function(e,t){let{__scopeMenu:n,...r}=e,i=HU(n);return(0,V.jsx)(ZH,{...i,...r,ref:t})},`MenuAnchor`)),XU=`MenuPortal`,[ZU,QU]=BU(XU,{forceMount:void 0}),$U=jU(e=>{let{__scopeMenu:t,forceMount:n,children:r,container:i}=e,a=GU(XU,t);return(0,V.jsx)(ZU,{scope:t,forceMount:n,children:(0,V.jsx)(JR,{present:n||a.open,children:(0,V.jsx)(WR,{asChild:!0,container:i,children:r})})})},`MenuPortal`),eW=`MenuContent`,[tW,nW]=BU(eW),rW=B.forwardRef(jU(function(e,t){let n=QU(eW,e.__scopeMenu),{forceMount:r=n.forceMount,...i}=e,a=GU(eW,e.__scopeMenu),o=qU(eW,e.__scopeMenu);return(0,V.jsx)(LU.Provider,{scope:e.__scopeMenu,children:(0,V.jsx)(JR,{present:r||a.open,children:(0,V.jsx)(LU.Slot,{scope:e.__scopeMenu,children:o.modal?(0,V.jsx)(iW,{...i,ref:t}):(0,V.jsx)(aW,{...i,ref:t})})})})},`MenuContent`)),iW=B.forwardRef(jU(function(e,t){let n=GU(eW,e.__scopeMenu),r=B.useRef(null),i=lb(t,r);return B.useEffect(()=>{let e=r.current;if(e)return lx(e)},[]),(0,V.jsx)(sW,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:FL(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})},`MenuRootContentModal`)),aW=B.forwardRef(jU(function(e,t){let n=GU(eW,e.__scopeMenu);return(0,V.jsx)(sW,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})},`MenuRootContentNonModal`)),oW=fb(`MenuContent.ScrollLock`),sW=B.forwardRef(jU(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=GU(eW,n),_=qU(eW,n),v=HU(n),y=UU(n),b=RU(n),[x,S]=B.useState(null),C=B.useRef(null),w=lb(t,C,g.onContentChange),T=B.useRef(0),E=B.useRef(``),D=B.useRef(0),O=B.useRef(null),k=B.useRef(`right`),A=B.useRef(0),j=m?vS:B.Fragment,M=m?{as:oW,allowPinchZoom:!0}:void 0,N=jU(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=wW(n.map(e=>e.textValue),t,i),o=n.find(e=>e.textValue===a)?.ref.current;jU((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),[]),az();let P=B.useCallback(e=>k.current===O.current?.side&&EW(e,O.current?.area),[]);return(0,V.jsx)(tW,{scope:n,searchRef:E,onItemEnter:B.useCallback(e=>{P(e)&&e.preventDefault()},[P]),onItemLeave:B.useCallback(e=>{P(e)||(C.current?.focus(),S(null))},[P]),onTriggerLeave:B.useCallback(e=>{P(e)&&e.preventDefault()},[P]),pointerGraceTimerRef:D,onPointerGraceIntentChange:B.useCallback(e=>{O.current=e},[]),children:(0,V.jsx)(j,{...M,children:(0,V.jsx)(jR,{asChild:!0,trapped:i,onMountAutoFocus:FL(a,e=>{e.preventDefault(),C.current?.focus({preventScroll:!0})}),onUnmountAutoFocus:o,children:(0,V.jsx)(yR,{asChild:!0,disableOutsidePointerEvents:s,onEscapeKeyDown:l,onPointerDownOutside:u,onFocusOutside:d,onInteractOutside:f,onDismiss:p,children:(0,V.jsx)(OU,{asChild:!0,...y,dir:_.dir,orientation:`vertical`,loop:r,currentTabStopId:x,onCurrentTabStopIdChange:S,onEntryFocus:FL(c,e=>{_.isUsingKeyboardRef.current||e.preventDefault()}),preventScrollOnEntryFocus:!0,children:(0,V.jsx)(QH,{role:`menu`,"aria-orientation":`vertical`,"data-state":yW(g.open),"data-radix-menu-content":``,dir:_.dir,...v,...h,ref:w,style:{outline:`none`,...h.style},onKeyDown:FL(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&&N(e.key));let i=C.current;if(e.target!==i||!FU.includes(e.key))return;e.preventDefault();let a=b().filter(e=>!e.disabled).map(e=>e.ref.current);PU.includes(e.key)&&a.reverse(),SW(a)}),onBlur:FL(e.onBlur,e=>{e.currentTarget.contains(e.target)||(window.clearTimeout(T.current),E.current=``)}),onPointerMove:FL(e.onPointerMove,DW(e=>{let t=e.target,n=A.current!==e.clientX;if(e.currentTarget.contains(t)&&n){let t=e.clientX>A.current?`right`:`left`;k.current=t,A.current=e.clientX}}))})})})})})})},`MenuContentImpl`)),cW=B.forwardRef(jU(function(e,t){let{__scopeMenu:n,...r}=e;return(0,V.jsx)(sR.div,{role:`group`,...r,ref:t})},`MenuGroup`)),lW=`MenuItem`,uW=`menu.itemSelect`,dW=B.forwardRef(jU(function(e,t){let{disabled:n=!1,onSelect:r,...i}=e,a=B.useRef(null),o=qU(lW,e.__scopeMenu),s=nW(lW,e.__scopeMenu),c=lb(t,a),l=B.useRef(!1),u=jU(()=>{let e=a.current;if(!n&&e){let t=new CustomEvent(uW,{bubbles:!0,cancelable:!0});e.addEventListener(uW,e=>r?.(e),{once:!0}),cR(e,t),t.defaultPrevented?l.current=!1:o.onClose()}},`handleSelect`);return(0,V.jsx)(fW,{...i,ref:c,disabled:n,onClick:FL(e.onClick,u),onPointerDown:t=>{e.onPointerDown?.(t),l.current=!0},onPointerUp:FL(e.onPointerUp,e=>{l.current||e.currentTarget?.click()}),onKeyDown:FL(e.onKeyDown,e=>{n||e.target!==e.currentTarget||s.searchRef.current!==``&&e.key===` `||MU.includes(e.key)&&(e.currentTarget.click(),e.preventDefault())})})},`MenuItem`)),fW=B.forwardRef(jU(function(e,t){let{__scopeMenu:n,disabled:r=!1,textValue:i,...a}=e,o=nW(lW,n),s=UU(n),c=B.useRef(null),l=lb(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)(LU.ItemSlot,{scope:n,disabled:r,textValue:i??f,children:(0,V.jsx)(kU,{asChild:!0,...s,focusable:!r,children:(0,V.jsx)(sR.div,{role:`menuitem`,"data-highlighted":u?``:void 0,"aria-disabled":r||void 0,"data-disabled":r?``:void 0,...a,ref:l,onPointerMove:FL(e.onPointerMove,DW(e=>{r?o.onItemLeave(e):(o.onItemEnter(e),e.defaultPrevented||e.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:FL(e.onPointerLeave,DW(e=>o.onItemLeave(e))),onFocus:FL(e.onFocus,()=>d(!0)),onBlur:FL(e.onBlur,()=>d(!1))})})})},`MenuItemImpl`)),[pW,mW]=BU(`MenuRadioGroup`,{value:void 0,onValueChange:jU(()=>{},`onValueChange`)}),[hW,gW]=BU(`MenuItemIndicator`,{checked:!1}),[_W,vW]=BU(`MenuSub`);function yW(e){return e?`open`:`closed`}jU(yW,`getOpenState`);function bW(e){return e===`indeterminate`}jU(bW,`isIndeterminate`);function xW(e){return bW(e)?`indeterminate`:e?`checked`:`unchecked`}jU(xW,`getCheckedState`);function SW(e){let t=document.activeElement;for(let n of e)if(n===t||(n.focus(),document.activeElement!==t))return}jU(SW,`focusFirst`);function CW(e,t){return e.map((n,r)=>e[(t+r)%e.length])}jU(CW,`wrapArray`);function wW(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=CW(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}jU(wW,`getNextMatch`);function TW(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}jU(TW,`isPointInPolygon`);function EW(e,t){return t?TW({x:e.clientX,y:e.clientY},t):!1}jU(EW,`isPointerInGraceArea`);function DW(e){return t=>t.pointerType===`mouse`?e(t):void 0}jU(DW,`whenMouse`);var OW=JU,kW=YU,AW=$U,jW=rW,MW=cW,NW=dW,PW=Object.defineProperty,FW=(e,t)=>PW(e,`name`,{value:t,configurable:!0}),IW=`ContextMenu`,[LW,RW]=AL(IW,[VU]),zW=VU(),[BW,VW]=LW(IW),HW=FW(e=>{let{__scopeContextMenu:t,children:n,onOpenChange:r,open:i,dir:a,modal:o=!0}=e,s=B.useRef(!1),[c,l]=eR({prop:i,defaultProp:!1,onChange:r,caller:IW}),u=zW(t);return(0,V.jsx)(BW,{scope:t,open:c,onOpenChange:l,modal:o,hasInteractedRef:s,children:(0,V.jsx)(OW,{...u,dir:a,open:c,onOpenChange:l,modal:o,children:n})})},`ContextMenu`),UW=`ContextMenuTrigger`,WW=B.forwardRef(FW(function(e,t){let{__scopeContextMenu:n,disabled:r=!1,...i}=e,a=VW(UW,n),o=zW(n),[s,c]=B.useState({x:0,y:0}),l=B.useMemo(()=>({current:{getBoundingClientRect:FW(()=>DOMRect.fromRect({width:0,height:0,...s}),`getBoundingClientRect`)}}),[s]),u=B.useRef(0),d=B.useCallback(()=>window.clearTimeout(u.current),[]),f=FW(e=>{a.hasInteractedRef.current=!0,c({x:e.clientX,y:e.clientY}),a.onOpenChange(!0)},`handleOpen`);return B.useEffect(()=>d,[d]),B.useEffect(()=>void(r&&d()),[r,d]),(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(kW,{...o,virtualRef:l}),(0,V.jsx)(sR.span,{"data-state":a.open?`open`:`closed`,"data-disabled":r?``:void 0,...i,ref:t,style:{WebkitTouchCallout:`none`,...e.style},onContextMenu:r?e.onContextMenu:FL(e.onContextMenu,e=>{d(),f(e),e.preventDefault()}),onPointerDown:r?e.onPointerDown:FL(e.onPointerDown,XW(e=>{d(),a.open&&a.onOpenChange(!1),u.current=window.setTimeout(()=>f(e),700)})),onPointerMove:r?e.onPointerMove:FL(e.onPointerMove,XW(d)),onPointerCancel:r?e.onPointerCancel:FL(e.onPointerCancel,XW(d)),onPointerUp:r?e.onPointerUp:FL(e.onPointerUp,XW(d))})]})},`ContextMenuTrigger`)),GW=FW(e=>{let{__scopeContextMenu:t,...n}=e,r=zW(t);return(0,V.jsx)(AW,{...r,...n})},`ContextMenuPortal`),KW=`ContextMenuContent`,qW=B.forwardRef(FW(function(e,t){let{__scopeContextMenu:n,...r}=e,i=VW(KW,n),a=zW(n),o=B.useRef(!1);return(0,V.jsx)(jW,{...a,...r,ref:t,side:`right`,sideOffset:2,align:`start`,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),!t.defaultPrevented&&o.current&&t.preventDefault(),o.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),!t.defaultPrevented&&!i.modal&&(o.current=!0)},style:{...e.style,"--radix-context-menu-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-context-menu-content-available-width":`var(--radix-popper-available-width)`,"--radix-context-menu-content-available-height":`var(--radix-popper-available-height)`,"--radix-context-menu-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-context-menu-trigger-height":`var(--radix-popper-anchor-height)`}})},`ContextMenuContent`)),JW=B.forwardRef(FW(function(e,t){let{__scopeContextMenu:n,...r}=e,i=zW(n);return(0,V.jsx)(MW,{...i,...r,ref:t})},`ContextMenuGroup`)),YW=B.forwardRef(FW(function(e,t){let{__scopeContextMenu:n,...r}=e,i=zW(n);return(0,V.jsx)(NW,{...i,...r,ref:t})},`ContextMenuItem`));function XW(e){return t=>t.pointerType===`mouse`?void 0:e(t)}FW(XW,`whenTouchOrPen`);var ZW=HW,QW=WW,$W=GW,eG=qW,tG=JW,nG=YW;function rG(e){return(0,V.jsx)(ZW,{...e})}function iG(e){return(0,V.jsx)(QW,{...e})}function aG({className:e,...t}){return(0,V.jsx)($W,{children:(0,V.jsx)(eG,{className:W(`z-100 min-w-44 max-w-[calc(100vw-1rem)] rounded-md bg-zinc-900 p-1 text-zinc-200 shadow-xl ring-1 ring-white/10 outline-none`,e),...t})})}function oG(e){return(0,V.jsx)(tG,{...e})}function sG({className:e,variant:t=`default`,...n}){return(0,V.jsx)(nG,{"data-variant":t,className:W(`relative flex min-h-8 cursor-default items-center gap-1.5 rounded-sm px-2 py-1.5 text-sm outline-none select-none [&_svg]:size-3.5 [&_svg]:shrink-0 data-[disabled]:pointer-events-none data-[disabled]:opacity-45 data-[highlighted]:bg-white/7 data-[highlighted]:text-zinc-50 data-[variant=destructive]:text-rose-300`,e),...n})}function cG({name:e,title:t,icon:n,status:r,selected:i=!1,pending:a=!1,busy:o=!1,id:s,className:c,ariaLabel:l,onClick:u}){let d=W(`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?`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`,(a||o)&&`motion-safe:animate-pulse`,a&&`pointer-events-none`,c),f=(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)(UV,{asChild:!0,isActive:i,children:(0,V.jsx)(X,{id:s,variant:`ghost`,type:`button`,className:d,onClick:a?void 0:u,title:t,role:a?`status`:void 0,"aria-label":a?`Creating tree ${e}`:l,"aria-live":a||l?`polite`:void 0,"aria-disabled":a||void 0,tabIndex:a?-1:void 0,children:f})})}function lG({projects:e,projectsPending:t,projectsError:n,projectsLoaded:r,activeProject:i,selectedWorktree:a,selectedTerminalId:o,selectedPendingTerminalId:s,pendingTerminals:c,pendingWorktrees:l,pendingRemovals:u,onRetryProjects:d,onSelectTerminal:f,onSelectPendingTerminal:p,onCloseTerminal:m,onSelectWorktree:h,onPrepareRemoval:g,onOpenPanelDialog:_,onOpenWorktreeDialog:v}){let{focusedSurface:y}=uf(),{attention:b,titles:x,programs:S,progress:C}=YF(),w=window.treeportDesktop,T=w?w.platform===`darwin`?`⌘N`:`Ctrl+N`:null,E=w?w.platform===`darwin`?`⌘⇧T`:`Ctrl+Shift+T`: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 trees`,children:[t?(0,V.jsx)(`p`,{className:`sidebar-note px-2 py-3 text-base text-zinc-500 min-[701px]:text-sm`,children:`Loading projects…`}):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)(X,{type:`button`,variant:`secondary`,size:`sm`,onClick:d,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 folder or 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||`Project folder unavailable`}):null,(0,V.jsxs)(BV,{className:`gap-2 min-[701px]:gap-1`,children:[e.worktrees.map(t=>(0,V.jsxs)(VV,{className:`group/worktree min-w-0`,children:[(0,V.jsxs)(rG,{children:[(0,V.jsx)(iG,{asChild:!0,disabled:t.kind!==`linked`,children:(0,V.jsxs)(`div`,{className:W(`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)(cG,{id:`worktree-${t.id}`,name:t.name,title:t.kind===`folder`?t.path:`${t.path}${t.branch?` · ${t.branch}`:` · detached at ${t.head.slice(0,8)}`}`,selected:a?.id===t.id,className:W(a?.id===t.id&&`min-[701px]:pr-6`),busy:!!u[t.id],ariaLabel:u[t.id]===`checking`?`${t.name}, preparing removal`:u[t.id]?`${t.name}, removing`:void 0,onClick:()=>h(t),icon:u[t.id]?(0,V.jsx)($y,{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===`folder`?(0,V.jsx)(JI,{className:`size-4 shrink-0 fill-zinc-600 min-[701px]:size-3.5!`,"aria-hidden":`true`}):t.kind===`main`?(0,V.jsx)(Zy,{className:`size-4 shrink-0 stroke-zinc-600 stroke-[1.5] min-[701px]:size-3.5!`,"aria-hidden":`true`}):(0,V.jsx)($y,{className:`shrink-0 stroke-zinc-600 stroke-[1.5] min-[701px]:size-3.5!`,"aria-hidden":`true`})}),a?.id===t.id?(0,V.jsx)(`div`,{className:`worktree-actions absolute inset-y-0 right-0 z-10 flex items-center max-[700px]:static max-[700px]:shrink-0`,children:(0,V.jsx)(XV,{label:`New panel in ${t.name}`,tooltip:`New panel in ${t.name}${E?` — ${E}`:``}`,...E?{keyShortcuts:w?.platform===`darwin`?`Meta+Shift+T`:`Control+Shift+T`}:{},className:`text-zinc-500 hover:bg-transparent hover:text-zinc-100 min-[701px]:size-6`,onClick:n=>_(e,t,n),children:(0,V.jsx)(nL,{})})}):null]})}),t.kind===`linked`?(0,V.jsx)(aG,{children:(0,V.jsx)(oG,{children:(0,V.jsxs)(sG,{variant:`destructive`,disabled:e.availability.state===`unavailable`||!!u[t.id],onSelect:()=>void g(t,document.getElementById(`worktree-${t.id}`)),children:[(0,V.jsx)(oL,{}),e.availability.state===`unavailable`?`Git repository unavailable`:u[t.id]?`Removal in progress`:`Remove tree…`]})})}):null]}),(0,V.jsxs)(qV,{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`,"aria-label":`${t.name} terminal tabs`,children:[t.terminals.map((e,n)=>{let r=x.get(e.id)||e.name,i=b.has(e.id),s=C.get(e.id),c=!!s&&!i&&s.state!==`paused`&&s.state!==`error`,l=[s?oC(s):e.status,i?`bell`:null].filter(Boolean).join(`, `),u=a?.id===t.id&&n<9?n+1:null;return(0,V.jsxs)(JV,{className:`group/terminal relative min-w-0`,children:[(0,V.jsx)(YV,{asChild:!0,isActive:o===e.id,children:(0,V.jsxs)(X,{variant:`ghost`,type:`button`,className:W(`terminal-row grid h-auto min-h-11 w-full min-w-0 grid-cols-[1.25rem_minmax(0,1fr)_2rem] 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)_1.75rem] 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:()=>f(e),onMouseDown:e=>{e.button===1&&e.preventDefault()},onAuxClick:t=>{t.button===1&&(t.preventDefault(),m(e))},"aria-label":`${r}, ${l}`,"aria-keyshortcuts":y===`terminal`&&u?`Meta+${u}`:void 0,children:[(0,V.jsx)(QB,{program:S.get(e.id)??null,progress:s??null,attention:i,exited:e.status===`exited`,className:`size-4! min-[701px]:size-3.5!`}),(0,V.jsx)(`span`,{className:W(`truncate`,c&&`text-cyan-300`,i&&`text-amber-200`),"aria-hidden":`true`,children:r}),y===`terminal`&&u?(0,V.jsxs)(`kbd`,{className:`justify-self-end font-sans text-[0.6875rem] font-normal text-zinc-500 tabular-nums group-hover/terminal:opacity-0 group-focus-within/terminal:opacity-0 max-[700px]:opacity-0`,"aria-hidden":`true`,children:[`⌘`,u]}):(0,V.jsx)(`span`,{"aria-hidden":`true`})]})}),(0,V.jsx)(`div`,{className:`absolute inset-y-0 right-0 z-10 flex items-center opacity-0 group-hover/terminal:opacity-100 group-focus-within/terminal:opacity-100 max-[700px]:opacity-100`,children:(0,V.jsx)(XV,{label:`Close ${r}`,tooltip:t.terminals.length===1?`Every tree keeps at least one terminal`:`Close terminal`,disabled:t.terminals.length===1,className:`text-zinc-500 hover:bg-transparent hover:text-zinc-200`,onClick:()=>m(e),children:(0,V.jsx)(uL,{})})})]},e.id)}),c.filter(e=>e.worktreeId===t.id).map((e,n)=>{let r=t.terminals.length+n;return(0,V.jsx)(JV,{className:`min-w-0`,children:(0,V.jsx)(YV,{asChild:!0,isActive:s===e.id,children:(0,V.jsxs)(X,{variant:`ghost`,type:`button`,className:W(`terminal-row grid h-auto min-h-11 w-full min-w-0 grid-cols-[1.25rem_minmax(0,1fr)_auto] 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)_auto] min-[701px]:gap-1 min-[701px]:py-0 min-[701px]:text-xs/4`,s===e.id?`selected bg-cyan-400/8! text-cyan-50`:`text-zinc-300 hover:bg-white/5 hover:text-zinc-100`),onClick:()=>p(e.id),"aria-label":`${e.name}, starting`,"aria-keyshortcuts":a?.id===t.id&&r<9?`Meta+${r+1}`:void 0,children:[(0,V.jsx)(EI,{className:`animate-spin fill-zinc-500`,"aria-hidden":`true`}),(0,V.jsx)(`span`,{className:`truncate`,"aria-hidden":`true`,children:e.name}),(0,V.jsx)(`span`,{className:`text-[0.6875rem] text-zinc-500`,"aria-hidden":`true`,children:`Starting…`})]})})},e.id)})]})]},t.id)),a?null:(0,V.jsx)(VV,{className:`min-w-0`,children:(0,V.jsx)(UV,{asChild:!0,children:(0,V.jsxs)(X,{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`,"aria-label":`New panel`,onClick:t=>_(e,null,t.currentTarget),children:[(0,V.jsx)(nL,{className:`min-[701px]:size-3.5!`}),(0,V.jsx)(`span`,{children:`New panel`})]})})}),l.filter(t=>t.projectId===e.id).map(e=>(0,V.jsx)(VV,{className:`min-w-0`,children:(0,V.jsx)(cG,{id:`pending-worktree-${e.id}`,name:e.typedName,title:`Creating ${e.typedName}`,pending:!0,icon:(0,V.jsx)($y,{className:`worktree-progress-icon size-4 shrink-0 stroke-cyan-400 stroke-[1.5] min-[701px]:size-3.5!`,"aria-hidden":`true`})})},e.id)),e.kind===`repository`?(0,V.jsx)(VV,{className:`min-w-0`,children:(0,V.jsx)(UV,{asChild:!0,children:(0,V.jsxs)(X,{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":T?w?.platform===`darwin`?`Meta+N`:`Control+N`:void 0,title:T?`New tree — ${T}`:void 0,onClick:t=>v(e,t.currentTarget),children:[(0,V.jsx)(nL,{className:`min-[701px]:size-3.5!`}),(0,V.jsx)(`span`,{children:`New tree`}),T?(0,V.jsx)(`kbd`,{className:`ml-auto font-sans text-[0.6875rem] text-zinc-500`,"aria-hidden":`true`,children:T}):null]})})}):null]})]},e.id))})]})}function uG(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})}var dG=Object.defineProperty,fG=(e,t)=>dG(e,`name`,{value:t,configurable:!0}),pG=`Checkbox`,[mG,hG]=AL(pG),[gG,_G]=mG(pG);function vG(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]=eR({prop:n,defaultProp:i??!1,onChange:c,caller:pG}),[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:!DG(i)&&i,isFormControl:x,bubbleInput:g,setBubbleInput:_};return(0,V.jsx)(gG,{scope:t,...S,children:EG(d)?d(S):r})}fG(vG,`CheckboxProvider`);var yG=`CheckboxTrigger`,bG=B.forwardRef(fG(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}=_G(yG,e),g=lb(i,u),_=B.useRef(c);return B.useEffect(()=>{let e=a?.form;if(e){let t=fG(()=>d(_.current),`reset`);return e.addEventListener(`reset`,t),()=>e.removeEventListener(`reset`,t)}},[a,d]),(0,V.jsx)(sR.button,{type:`button`,role:`checkbox`,"aria-checked":DG(c)?`mixed`:c,"aria-required":l,"data-state":OG(c),"data-disabled":s?``:void 0,disabled:s,value:o,...r,ref:g,onKeyDown:FL(t,e=>{e.key===`Enter`&&e.preventDefault()}),onClick:FL(n,e=>{p(),d(e=>DG(e)?!0:!e),h&&m&&(f.current=e.isPropagationStopped(),f.current||e.stopPropagation())})})},`CheckboxTrigger`)),xG=B.forwardRef(fG(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)(vG,{__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)(bG,{...d,ref:t,__scopeCheckbox:n}),e&&(0,V.jsx)(TG,{__scopeCheckbox:n})]})})},`Checkbox`)),SG=`CheckboxIndicator`,CG=B.forwardRef(fG(function(e,t){let{__scopeCheckbox:n,forceMount:r,...i}=e,a=_G(SG,n);return(0,V.jsx)(JR,{present:r||DG(a.checked)||a.checked===!0,children:(0,V.jsx)(sR.span,{"data-state":OG(a.checked),"data-disabled":a.disabled?``:void 0,...i,ref:t,style:{pointerEvents:`none`,...e.style}})})},`CheckboxIndicator`)),wG=`CheckboxBubbleInput`,TG=B.forwardRef(fG(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}=_G(wG,e),g=lb(r,h),_=MH(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=DG(s),n.call(e,!DG(s)&&s),e.dispatchEvent(t),v.current=!1}},[m,s,a,o]);let x=B.useRef(!DG(s)&&s);return(0,V.jsx)(sR.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:FL(t,e=>{v.current&&e.stopPropagation()}),style:{...n.style,..._,position:`absolute`,pointerEvents:`none`,opacity:0,margin:0,transform:`translateX(-100%)`}})},`CheckboxBubbleInput`));function EG(e){return typeof e==`function`}fG(EG,`isFunction`);function DG(e){return e===`indeterminate`}fG(DG,`isIndeterminate`);function OG(e){return DG(e)?`indeterminate`:e?`checked`:`unchecked`}fG(OG,`getState`);var kG=B.forwardRef(({className:e,...t},n)=>(0,V.jsx)(xG,{ref:n,className:W(`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)(CG,{className:`grid place-content-center text-current`,children:(0,V.jsx)(Xy,{className:`size-3.5`})})}));kG.displayName=xG.displayName;function AG({presets:e,loading:t,loadError:n,onRetry:r}){let i=qe(),[a,o]=(0,B.useState)({editingId:null,loadedUpdatedAt:null,name:``,command:``,closeOnSuccess:!1,commandError:null,notice:null}),{editingId:s,loadedUpdatedAt:c,name:l,command:u,closeOnSuccess:d,commandError:f,notice:p}=a,m=()=>{o({editingId:null,loadedUpdatedAt:null,name:``,command:``,closeOnSuccess:!1,commandError:null,notice:null})};if(s){let t=e.find(e=>e.id===s);t?t.updatedAt!==c&&o({editingId:t.id,loadedUpdatedAt:t.updatedAt,name:t.name,command:$P([t.executable,...t.args]),closeOnSuccess:t.closeOnSuccess,commandError:null,notice:c?`This preset changed, so the latest saved values were loaded.`:p}):o({editingId:null,loadedUpdatedAt:null,name:``,command:``,closeOnSuccess:!1,commandError:null,notice:`That preset was deleted. You can create a new one.`})}let h=dt({mutationFn:({presetId:e,input:t,expectedUpdatedAt:n})=>e?Ef(NN.api[`terminal-presets`][`:presetId`].$patch({param:{presetId:e},json:{...t,expectedUpdatedAt:n}})).then(e=>e.preset):Ef(NN.api[`terminal-presets`].$post({json:t})).then(e=>e.preset),onSuccess:(e,t)=>{i.setQueryData(zB,n=>t.presetId?n?.map(t=>t.id===e.id?e:t):[...n??[],e]),o({editingId:e.id,loadedUpdatedAt:e.updatedAt,name:e.name,command:$P([e.executable,...e.args]),closeOnSuccess:e.closeOnSuccess,commandError:null,notice:`Preset saved.`})},onError:(e,{presetId:t,input:n})=>{i.invalidateQueries({queryKey:zB}),vI(e,{operation:`${t?`update`:`create`} terminal preset “${n.name}”`})},onSettled:async()=>{await Promise.all([i.invalidateQueries({queryKey:zB}),i.invalidateQueries({queryKey:[`terminal-preset-definitions`]})])}}),g=dt({mutationFn:e=>Ef(NN.api[`terminal-presets`][`:presetId`].$delete({param:{presetId:e.id},json:{expectedUpdatedAt:e.updatedAt}})),onSuccess:(e,t)=>{i.setQueryData(zB,e=>e?.filter(e=>e.id!==t.id)),s===t.id&&o({editingId:null,loadedUpdatedAt:null,name:``,command:``,closeOnSuccess:!1,commandError:null,notice:`Preset deleted.`})},onError:(e,t)=>{i.invalidateQueries({queryKey:zB}),vI(e,{operation:`delete terminal preset “${t.name}”`})},onSettled:async()=>{await Promise.all([i.invalidateQueries({queryKey:zB}),i.invalidateQueries({queryKey:[`terminal-preset-definitions`]})])}}),_=h.isPending||g.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)(X,{type:`button`,variant:`secondary`,size:`sm`,disabled:_,onClick:m,children:[(0,V.jsx)(nL,{}),` 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:W(`group/preset flex min-h-14 items-center rounded-md px-1 transition-colors hover:bg-white/5`,s===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":s===e.id?`true`:void 0,disabled:_,onClick:()=>{o({editingId:e.id,loadedUpdatedAt:e.updatedAt,name:e.name,command:$P([e.executable,...e.args]),closeOnSuccess:e.closeOnSuccess,commandError:null,notice: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:$P([e.executable,...e.args])})]}),(0,V.jsx)(X,{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:_,onClick:()=>{window.confirm(`Delete terminal preset “${e.name}”?`)&&g.mutate(e)},children:(0,V.jsx)(oL,{})})]},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)(X,{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=uG(u);if(t.argv===null){o(e=>({...e,commandError:t.error}));return}let[n,...r]=t.argv;h.mutate({presetId:s,input:{name:l,executable:n,args:r,closeOnSuccess:d},expectedUpdatedAt:c})},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`}),p&&(0,V.jsx)(`span`,{className:`text-xs text-zinc-400`,role:`status`,children:p})]}),(0,V.jsxs)(NB,{children:[(0,V.jsx)(PB,{htmlFor:`preset-name`,children:`Name`}),(0,V.jsx)(dL,{id:`preset-name`,name:`preset-name`,value:l,maxLength:120,disabled:_,autoFocus:!0,required:!0,onChange:e=>{o(t=>({...t,name:e.target.value,notice:null}))},placeholder:`Code review`})]}),(0,V.jsxs)(NB,{children:[(0,V.jsx)(PB,{htmlFor:`preset-command`,children:`Command`}),(0,V.jsx)(dL,{id:`preset-command`,name:`preset-command`,value:u,disabled:_,required:!0,"aria-invalid":f?!0:void 0,"aria-describedby":f?`preset-command-error`:void 0,onChange:e=>{o(t=>({...t,command:e.target.value,commandError:null,notice:null}))},placeholder:`diff main --mode split`}),f&&(0,V.jsx)(`p`,{id:`preset-command-error`,className:`text-xs text-rose-300`,role:`alert`,children:f})]}),(0,V.jsx)(NB,{children:(0,V.jsxs)(`div`,{className:`flex items-start gap-2.5`,children:[(0,V.jsx)(kG,{id:`preset-close-on-success`,checked:d,disabled:_,onCheckedChange:e=>{o(t=>({...t,closeOnSuccess:e===!0,notice:null}))}}),(0,V.jsxs)(`div`,{className:`grid gap-1`,children:[(0,V.jsx)(PB,{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)(X,{type:`submit`,className:`self-end`,disabled:_||!l.trim()||!u.trim()||s!==null&&c===null,children:h.isPending?`Saving…`:s?`Save changes`:`Create preset`})]})]})})}function jG({open:e,onOpenChange:t,restoreFocusTo:n,presets:r,loading:i,loadError:a,onRetry:o}){return(0,V.jsx)(wB,{open:e,onOpenChange:t,children:(0,V.jsxs)(kB,{className:`max-w-3xl`,restoreFocusTo:n,children:[(0,V.jsxs)(AB,{children:[(0,V.jsx)(jB,{children:`Global terminal presets`}),(0,V.jsx)(MB,{children:`Create commands available in every repository. Arguments are passed exactly as entered.`})]}),(0,V.jsx)(AG,{presets:r,loading:i,loadError:a,onRetry:o})]})})}var MG=`treeport:pending-application-update`;async function NG(){return Ef(NN.api.update.$get())}async function PG(){return Ef(NN.api.update.$post())}var FG=new Set([`starting`,`inspect`,`resolve`,`stage`,`verify`,`stop`,`activate`,`restart`,`health_check`,`rollback`]);function IG(e,t){return!e||[`127.0.0.1`,`localhost`,`::1`,`[::1]`].includes(t)}function LG(){let e=IG(!!window.treeportDesktop,window.location.hostname),t=qe(),[n,r]=(0,B.useState)(!1),[i,a]=(0,B.useState)(null),o=lt({queryKey:[`application-update`],queryFn:NG,enabled:e,refetchInterval:e=>{let t=e.state.data;return FG.has(t?.phase??`idle`)?1e3:t?.checkedAt?6e4:5e3},refetchIntervalInBackground:!0,staleTime:3e4}).data,s=dt({mutationFn:PG,onMutate:()=>{a(null),o?.latestVersion&&sessionStorage.setItem(MG,o.latestVersion)},onSuccess:e=>{t.setQueryData([`application-update`],e)},onError:e=>{sessionStorage.removeItem(MG),a(UN(e))}});(0,B.useEffect)(()=>{let e=sessionStorage.getItem(MG);if(!(!e||!o)){if(o.currentVersion===(o.targetVersion??e)&&o.phase===`complete`){sessionStorage.removeItem(MG),window.location.reload();return}(o.phase===`failed`||o.phase===`recovery_required`)&&sessionStorage.removeItem(MG)}},[o]);let c=!!(s.isPending||o&&FG.has(o.phase)),l=!!(i||o?.phase===`failed`||o?.phase===`recovery_required`),u=!!(e&&(o?.updateAvailable||c||l)),d=i??o?.error??null,f=s.isPending||o?.phase===`starting`?`Starting the update…`:o?.phase===`inspect`||o?.phase===`resolve`?`Preparing the update…`:o?.phase===`stage`?`Downloading the update…`:o?.phase===`verify`?`Verifying the update…`:o?.phase===`stop`||o?.phase===`activate`?`Installing the update…`:o?.phase===`restart`||o?.phase===`health_check`?`Restarting Treeport and reconnecting…`:o?.phase===`rollback`?`Restoring the previous version…`:null;return u?(0,V.jsx)(`div`,{className:`size-9 shrink-0`,children:(0,V.jsxs)(YS,{open:n,onOpenChange:r,children:[(0,V.jsx)(XS,{asChild:!0,children:(0,V.jsxs)(X,{type:`button`,size:`icon`,variant:`ghost`,className:l?`icon-button text-amber-300 hover:bg-white/5 hover:text-amber-100`:`icon-button text-cyan-300 hover:bg-white/5 hover:text-cyan-100`,"aria-label":l?`Treeport update failed`:c?`Treeport update in progress`:`Treeport ${o?.latestVersion??``} update available`,children:[l?(0,V.jsx)(rb,{}):c?(0,V.jsx)(eb,{className:`animate-spin`}):(0,V.jsx)(Qy,{}),(0,V.jsx)(`span`,{className:`touch-target`,"aria-hidden":!0})]})}),(0,V.jsxs)(ZS,{align:`end`,className:`flex w-[min(20rem,calc(100vw-1rem))] flex-col gap-3`,"aria-label":`Treeport update`,children:[(0,V.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,V.jsx)(`h2`,{className:`text-sm font-semibold text-zinc-100`,children:l?`Treeport update failed`:c?`Updating Treeport`:`Treeport ${o?.latestVersion} is available`}),o?.latestVersion?(0,V.jsxs)(`p`,{className:`text-sm text-zinc-400`,children:[`Installed `,o.currentVersion,` · Available`,` `,o.latestVersion]}):null]}),(0,V.jsx)(`div`,{"aria-live":`polite`,children:f?(0,V.jsx)(`p`,{className:`text-sm text-zinc-300`,children:f}):d?(0,V.jsx)(`p`,{className:`text-sm text-amber-200`,children:d}):o?.canUpdate?(0,V.jsx)(`p`,{className:`text-sm text-zinc-300`,children:`Treeport will restart. Running terminals will stay active.`}):(0,V.jsx)(`p`,{className:`text-sm text-amber-200`,children:o?.blockedReason??`Treeport cannot install this update.`})}),!c&&o?.updateAvailable?(0,V.jsxs)(X,{type:`button`,disabled:!o.canUpdate,onClick:()=>s.mutate(),children:[(0,V.jsx)(Qy,{"data-icon":`inline-start`}),`Update Treeport`]}):null]})]})}):(0,V.jsx)(`div`,{className:`size-9 shrink-0`,"aria-hidden":!0})}function RG(e){return e.shellCommand===null?e.executable?$P([e.executable,...e.args]):``:e.shellCommand}function zG(e){return e.source.type===`repository`?e.source.format===`zed`?`Repository · Zed`:`Repository`:e.source.type===`user`?`Global`:`${e.source.scope===`project`?`Repository`:`Global`} · ${e.source.packageId}`}function BG(e){return e.map(e=>e===`same-origin`?`It will share Treeport's web origin. It can access Treeport browser storage, the Treeport page, and API routes available to this client.`:`It can read and change existing files in this tree.`).join(` `)}function VG({open:e,onOpenChange:t,restoreFocusTo:n,worktreeName:r,presets:i,presetDiagnostics:a,presetsLoading:o,presetsError:s,webPanelDefinitions:c,webPanelDefinitionsLoading:l,webPanelDefinitionsError:u,launchDisabled:d,onCreateTerminal:f,onCreateBrowserPanel:p,onCreateWebPanel:m,onManagePresets:h}){let[g,_]=(0,B.useState)(``),[v,y]=(0,B.useState)(0),[b,x]=(0,B.useState)(null),S=b?b.source.type===`package`?`${b.source.scope} package ${b.source.source}`:`this project`:``,C=BG(b?.permissions??[]),w=g.trim().toLocaleLowerCase(),T=`shell`.includes(w),E=i.filter(e=>[e.name,e.executable??``,zG(e),RG(e)].some(e=>e.toLocaleLowerCase().includes(w))),D=`browser`.includes(w),O=c.filter(e=>[e.title,e.id].some(e=>e.toLocaleLowerCase().includes(w))),k=E.length+ +!!T,A=k===0&&!D&&O.length===0;return(0,V.jsx)(wB,{open:e,onOpenChange:e=>{e||(_(``),y(0)),t(e)},children:(0,V.jsxs)(kB,{className:`max-w-xl gap-0 overflow-hidden rounded-xl bg-zinc-800/95 p-0 shadow-2xl ring-white/15 backdrop-blur-2xl max-[700px]:p-0 max-[700px]:pb-0 [&>button.absolute]:hidden`,mobilePresentation:`dialog`,overlayClassName:`bg-transparent backdrop-blur-[1px]`,restoreFocusTo:n,children:[(0,V.jsx)(jB,{className:`sr-only`,children:`New panel`}),(0,V.jsxs)(MB,{className:`sr-only`,children:[`Search for a terminal, Browser, or web panel to start`,r?` in ${r}`:``,`.`]}),(0,V.jsxs)(`div`,{className:`flex min-w-0 items-center gap-3 border-b border-white/8 px-4`,children:[(0,V.jsx)(eL,{className:`size-4 shrink-0 fill-zinc-400`,"aria-hidden":`true`}),(0,V.jsx)(`input`,{type:`search`,name:`panel-launcher-search`,className:`h-14 min-w-0 flex-1 bg-transparent text-base text-zinc-50 outline-none placeholder:text-zinc-500 sm:h-12 sm:text-sm`,value:g,autoComplete:`off`,autoFocus:!0,"aria-label":`Search panels`,placeholder:r?`New panel in ${r}`:`New panel`,onChange:e=>{_(e.target.value),y(0)},onKeyDown:e=>{let t=Array.from(e.currentTarget.closest(`[role="dialog"]`)?.querySelectorAll(`[data-panel-launch]:not(:disabled)`)??[]);if(t.length===0)return;if(e.key===`Enter`){e.preventDefault(),t[v]?.click();return}if(e.key!==`ArrowDown`&&e.key!==`ArrowUp`)return;e.preventDefault();let n=e.key===`ArrowDown`?1:-1;y((v+n+t.length)%t.length)}}),(0,V.jsx)(`kbd`,{className:`hidden shrink-0 rounded bg-white/6 px-1.5 py-0.5 font-sans text-[0.6875rem] text-zinc-500 ring-1 ring-white/8 sm:inline`,children:`esc`})]}),(0,V.jsxs)(`div`,{className:`max-h-[min(22rem,55dvh)] overflow-y-auto p-1.5 [scrollbar-color:var(--color-zinc-600)_transparent] [&_[data-selected]]:bg-white/8`,onKeyDown:e=>{if(e.key!==`ArrowDown`&&e.key!==`ArrowUp`)return;let t=Array.from(e.currentTarget.querySelectorAll(`[data-panel-launch]:not(:disabled)`)),n=t.indexOf(e.target);n<0||t.length<2||(e.preventDefault(),t[(n+(e.key===`ArrowDown`?1:-1)+t.length)%t.length]?.focus())},children:[(0,V.jsxs)(`div`,{role:`group`,"aria-label":`Terminals`,children:[k>0||o||s||a.length>0?(0,V.jsx)(`p`,{className:`px-2 py-1 text-xs font-medium text-zinc-500`,children:`Terminals`}):null,T?(0,V.jsxs)(X,{type:`button`,variant:`ghost`,className:`h-12 w-full justify-start gap-3 rounded-lg py-2 pr-3 pl-2 text-base font-normal text-zinc-100 hover:bg-white/8 focus-visible:bg-white/8 sm:h-9 sm:text-sm`,"aria-label":`Shell`,"data-panel-launch":!0,"data-selected":v===0?``:void 0,disabled:d,onFocus:()=>y(0),onMouseMove:()=>y(0),onClick:()=>{_(``),y(0),f({name:`Shell`})},children:[(0,V.jsx)(KI,{className:`size-4 shrink-0 fill-zinc-400`,"aria-hidden":`true`}),(0,V.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-left`,children:`Shell`}),(0,V.jsx)(`span`,{className:`shrink-0 text-zinc-500`,children:`Login shell`})]}):null,E.map((e,t)=>{let n=t+ +!!T,r=zG(e),i=RG(e);return(0,V.jsxs)(X,{type:`button`,variant:`ghost`,className:`h-12 w-full justify-start gap-3 rounded-lg py-2 pr-3 pl-2 text-base font-normal text-zinc-100 hover:bg-white/8 focus-visible:bg-white/8 sm:h-9 sm:text-sm`,"aria-label":`${e.name}, ${r}, ${i}`,"data-panel-launch":!0,"data-selected":v===n?``:void 0,disabled:d,onFocus:()=>y(n),onMouseMove:()=>y(n),onClick:()=>{_(``),y(0);let t={name:e.name,initialTitle:e.name};if(e.shellCommand!==null)t.shellCommand=e.shellCommand;else if(e.executable)t.argv=[e.executable,...e.args];else return;e.cwd&&(t.cwd=e.cwd),Object.keys(e.env).length&&(t.env={...e.env}),e.closeOnSuccess?t.closeOnSuccess=!0:t.returnToShell=!0,f(t)},children:[(0,V.jsx)(KI,{className:`size-4 shrink-0 fill-zinc-400`,"aria-hidden":`true`}),(0,V.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-left`,children:e.name}),(0,V.jsxs)(`span`,{className:`min-w-0 max-w-1/2 truncate text-zinc-500`,children:[r,` · `,i]})]},e.id)}),o?(0,V.jsx)(`p`,{className:`px-3 py-2 text-base text-zinc-500 sm:text-sm`,role:`status`,children:`Loading presets…`}):null,s?(0,V.jsx)(`p`,{className:`px-3 py-2 text-base text-zinc-500 sm:text-sm`,role:`status`,children:`Presets unavailable`}):null,a.map(e=>(0,V.jsx)(`p`,{className:`px-3 py-2 text-base text-amber-300 sm:text-sm`,role:`status`,children:e.message},`${e.path}:${e.itemId??`file`}:${e.message}`))]}),(0,V.jsx)(`div`,{role:`group`,"aria-label":`Browser`,children:D?(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`p`,{className:`mt-1 px-2 py-1 text-xs font-medium text-zinc-500`,children:`Browser`}),(0,V.jsxs)(X,{type:`button`,variant:`ghost`,className:`h-12 w-full justify-start gap-3 rounded-lg py-2 pr-3 pl-2 text-base font-normal text-zinc-100 hover:bg-white/8 focus-visible:bg-white/8 sm:h-9 sm:text-sm`,"aria-label":`Browser, hosted browser`,"data-panel-launch":!0,"data-selected":v===k?``:void 0,disabled:d,onFocus:()=>y(k),onMouseMove:()=>y(k),onClick:()=>{_(``),y(0),p()},children:[(0,V.jsx)(XI,{"aria-hidden":`true`}),(0,V.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-left`,children:`Browser`}),(0,V.jsx)(`span`,{className:`min-w-0 max-w-1/2 truncate text-zinc-500`,children:`Runs on the daemon computer`})]})]}):null}),(0,V.jsxs)(`div`,{role:`group`,"aria-label":`Web panels`,children:[O.length>0||l||u?(0,V.jsx)(`p`,{className:`mt-1 px-2 py-1 text-xs font-medium text-zinc-500`,children:`Web panels`}):null,O.map((e,t)=>{let n=k+ +!!D+t;return(0,V.jsxs)(X,{type:`button`,variant:`ghost`,className:`h-12 w-full justify-start gap-3 rounded-lg py-2 pr-3 pl-2 text-base font-normal text-zinc-100 hover:bg-white/8 focus-visible:bg-white/8 sm:h-9 sm:text-sm`,"aria-label":`${e.title}, web panel`,"data-panel-launch":!0,"data-selected":v===n?``:void 0,disabled:d,onFocus:()=>y(n),onMouseMove:()=>y(n),onClick:()=>{if(e.permissions.length>0&&!e.permissionsGranted){x(e);return}_(``),y(0),m(e)},children:[(0,V.jsx)(cL,{className:`size-4 shrink-0 fill-zinc-400`,"aria-hidden":`true`}),(0,V.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-left`,children:e.title}),(0,V.jsx)(`span`,{className:`min-w-0 max-w-1/2 truncate text-zinc-500`,children:e.source.type===`project`?`Project`:`${e.source.scope===`project`?`Project`:`Global`} · ${e.source.packageId}`})]},e.id)}),l?(0,V.jsx)(`p`,{className:`px-3 py-2 text-base text-zinc-500 sm:text-sm`,role:`status`,children:`Loading web panels…`}):null,u?(0,V.jsx)(`p`,{className:`px-3 py-2 text-base text-zinc-500 sm:text-sm`,role:`status`,children:`Web panels unavailable`}):null]}),A&&!o&&!l?(0,V.jsx)(`p`,{className:`px-3 py-8 text-center text-base text-zinc-500 sm:text-sm`,children:`No matching panels.`}):null]}),(0,V.jsxs)(`div`,{className:`border-t border-white/8 p-1.5`,children:[(0,V.jsxs)(X,{type:`button`,variant:`ghost`,className:`h-12 w-full justify-start gap-3 rounded-lg py-2 pr-3 pl-2 text-base font-normal text-zinc-400 hover:bg-white/8 hover:text-zinc-100 sm:h-9 sm:text-sm`,onClick:()=>{_(``),y(0),h()},children:[(0,V.jsx)(WI,{className:`size-4 shrink-0 fill-zinc-500`,"aria-hidden":`true`}),(0,V.jsx)(`span`,{children:`Manage global presets`})]}),(0,V.jsx)(X,{asChild:!0,variant:`ghost`,className:`h-12 w-full justify-start gap-3 rounded-lg py-2 pr-3 pl-2 text-base font-normal text-zinc-400 hover:bg-white/8 hover:text-zinc-100 sm:h-9 sm:text-sm`,children:(0,V.jsxs)(`a`,{href:`https://treeport.app/features/terminal-presets/#repository-presets`,target:`_blank`,rel:`noreferrer`,children:[(0,V.jsx)(PI,{className:`size-4 shrink-0 fill-zinc-500`,"aria-hidden":`true`}),(0,V.jsx)(`span`,{children:`Configure repository presets`})]})})]}),(0,V.jsx)(sB,{open:b!==null,onOpenChange:e=>{e||x(null)},children:(0,V.jsxs)(uB,{children:[(0,V.jsxs)(dB,{children:[(0,V.jsx)(pB,{children:`Allow privileged panel access?`}),(0,V.jsx)(mB,{children:`${b?.title??`This panel`} is from ${S}. ${C}`})]}),(0,V.jsxs)(fB,{children:[(0,V.jsx)(gB,{children:`Cancel`}),(0,V.jsx)(hB,{onClick:()=>{let e=b;x(null),e&&(_(``),y(0),m(e))},children:`Allow and open`})]})]})})]})})}var HG=1,UG=.9,WG=.8,GG=.17,KG=.1,qG=.999,JG=.9999,YG=.99,XG=/[\\\/_+.#"@\[\(\{&]/,ZG=/[\\\/_+.#"@\[\(\{&]/g,QG=/[\s-]/,$G=/[\s-]/g;function eK(e,t,n,r,i,a,o){if(a===t.length)return i===e.length?HG:YG;var s=`${i},${a}`;if(o[s]!==void 0)return o[s];for(var c=r.charAt(a),l=n.indexOf(c,i),u=0,d,f,p,m;l>=0;)d=eK(e,t,n,r,l+1,a+1,o),d>u&&(l===i?d*=HG:XG.test(e.charAt(l-1))?(d*=WG,p=e.slice(i,l-1).match(ZG),p&&i>0&&(d*=qG**+p.length)):QG.test(e.charAt(l-1))?(d*=UG,m=e.slice(i,l-1).match($G),m&&i>0&&(d*=qG**+m.length)):(d*=GG,i>0&&(d*=qG**+(l-i))),e.charAt(l)!==t.charAt(a)&&(d*=JG)),(d<KG&&n.charAt(l-1)===r.charAt(a+1)||r.charAt(a+1)===r.charAt(a)&&n.charAt(l-1)!==r.charAt(a))&&(f=eK(e,t,n,r,l+1,a+2,o),f*KG>d&&(d=f*KG)),d>u&&(u=d),l=n.indexOf(c,l+1);return o[s]=u,u}function tK(e){return e.toLowerCase().replace($G,` `)}function nK(e,t,n){return e=n&&n.length>0?`${e+` `+n.join(` `)}`:e,eK(e,t,tK(e),tK(t),0,0,{})}var rK=`[cmdk-group=""]`,iK=`[cmdk-group-items=""]`,aK=`[cmdk-group-heading=""]`,oK=`[cmdk-item=""]`,sK=`${oK}:not([aria-disabled="true"])`,cK=`cmdk-item-select`,lK=`data-value`,uK=(e,t,n)=>nK(e,t,n),dK=B.createContext(void 0),fK=()=>B.useContext(dK),pK=B.createContext(void 0),mK=()=>B.useContext(pK),hK=B.createContext(void 0),gK=B.forwardRef((e,t)=>{let n=AK(()=>({search:``,value:e.value??e.defaultValue??``,selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}})),r=AK(()=>new Set),i=AK(()=>new Map),a=AK(()=>new Map),o=AK(()=>new Set),s=OK(e),{label:c,children:l,value:u,onValueChange:d,filter:f,shouldFilter:p,loop:m,disablePointerSelection:h=!1,vimBindings:g=!0,..._}=e,v=GL(),y=GL(),b=GL(),x=B.useRef(null),S=NK();kK(()=>{if(u!==void 0){let e=u.trim();n.current.value=e,C.emit()}},[u]),kK(()=>{S(6,k)},[]);let C=B.useMemo(()=>({subscribe:e=>(o.current.add(e),()=>o.current.delete(e)),snapshot:()=>n.current,setState:(e,t,r)=>{var i,a,o;if(!Object.is(n.current[e],t)){if(n.current[e]=t,e===`search`)O(),E(),S(1,D);else if(e===`value`){if(document.activeElement.hasAttribute(`cmdk-input`)||document.activeElement.hasAttribute(`cmdk-root`)){let e=document.getElementById(b);e?e.focus():(i=document.getElementById(v))==null||i.focus()}if(S(7,()=>{n.current.selectedItemId=A()?.id,C.emit()}),r||S(5,k),s.current?.value!==void 0){let e=t??``;(o=(a=s.current).onValueChange)==null||o.call(a,e);return}}C.emit()}},emit:()=>{o.current.forEach(e=>e())}}),[]),w=B.useMemo(()=>({value:(e,t,r)=>{t!==a.current.get(e)?.value&&(a.current.set(e,{value:t,keywords:r}),n.current.filtered.items.set(e,T(t,r)),S(2,()=>{E(),C.emit()}))},item:(e,t)=>(r.current.add(e),t&&(i.current.has(t)?i.current.get(t).add(e):i.current.set(t,new Set([e]))),S(3,()=>{O(),E(),n.current.value||D(),C.emit()}),()=>{a.current.delete(e),r.current.delete(e),n.current.filtered.items.delete(e);let t=A();S(4,()=>{O(),t?.getAttribute(`id`)===e&&D(),C.emit()})}),group:e=>(i.current.has(e)||i.current.set(e,new Set),()=>{a.current.delete(e),i.current.delete(e)}),filter:()=>s.current.shouldFilter,label:c||e[`aria-label`],getDisablePointerSelection:()=>s.current.disablePointerSelection,listId:v,inputId:b,labelId:y,listInnerRef:x}),[]);function T(e,t){let r=s.current?.filter??uK;return e?r(e,n.current.search,t):0}function E(){if(!n.current.search||s.current.shouldFilter===!1)return;let e=n.current.filtered.items,t=[];n.current.filtered.groups.forEach(n=>{let r=i.current.get(n),a=0;r.forEach(t=>{let n=e.get(t);a=Math.max(n,a)}),t.push([n,a])});let r=x.current;j().sort((t,n)=>{let r=t.getAttribute(`id`),i=n.getAttribute(`id`);return(e.get(i)??0)-(e.get(r)??0)}).forEach(e=>{let t=e.closest(iK);t?t.appendChild(e.parentElement===t?e:e.closest(`${iK} > *`)):r.appendChild(e.parentElement===r?e:e.closest(`${iK} > *`))}),t.sort((e,t)=>t[1]-e[1]).forEach(e=>{let t=x.current?.querySelector(`${rK}[${lK}="${encodeURIComponent(e[0])}"]`);t?.parentElement.appendChild(t)})}function D(){let e=j().find(e=>e.getAttribute(`aria-disabled`)!==`true`)?.getAttribute(lK);C.setState(`value`,e||void 0)}function O(){if(!n.current.search||s.current.shouldFilter===!1){n.current.filtered.count=r.current.size;return}n.current.filtered.groups=new Set;let e=0;for(let t of r.current){let r=T(a.current.get(t)?.value??``,a.current.get(t)?.keywords??[]);n.current.filtered.items.set(t,r),r>0&&e++}for(let[e,t]of i.current)for(let r of t)if(n.current.filtered.items.get(r)>0){n.current.filtered.groups.add(e);break}n.current.filtered.count=e}function k(){var e;let t=A();t&&(t.parentElement?.firstChild===t&&((e=t.closest(rK)?.querySelector(aK))==null||e.scrollIntoView({block:`nearest`})),t.scrollIntoView({block:`nearest`}))}function A(){return x.current?.querySelector(`${oK}[aria-selected="true"]`)}function j(){return Array.from(x.current?.querySelectorAll(sK)||[])}function M(e){let t=j()[e];t&&C.setState(`value`,t.getAttribute(lK))}function N(e){var t;let n=A(),r=j(),i=r.findIndex(e=>e===n),a=r[i+e];(t=s.current)!=null&&t.loop&&(a=i+e<0?r[r.length-1]:i+e===r.length?r[0]:r[i+e]),a&&C.setState(`value`,a.getAttribute(lK))}function P(e){let t=A()?.closest(rK),n;for(;t&&!n;)t=e>0?EK(t,rK):DK(t,rK),n=t?.querySelector(sK);n?C.setState(`value`,n.getAttribute(lK)):N(e)}let ee=()=>M(j().length-1),F=e=>{e.preventDefault(),e.metaKey?ee():e.altKey?P(1):N(1)},I=e=>{e.preventDefault(),e.metaKey?M(0):e.altKey?P(-1):N(-1)};return B.createElement(sR.div,{ref:t,tabIndex:-1,..._,"cmdk-root":``,onKeyDown:e=>{var t;(t=_.onKeyDown)==null||t.call(_,e);let n=e.nativeEvent.isComposing||e.keyCode===229;if(!(e.defaultPrevented||n))switch(e.key){case`n`:case`j`:g&&e.ctrlKey&&F(e);break;case`ArrowDown`:F(e);break;case`p`:case`k`:g&&e.ctrlKey&&I(e);break;case`ArrowUp`:I(e);break;case`Home`:e.preventDefault(),M(0);break;case`End`:e.preventDefault(),ee();break;case`Enter`:{e.preventDefault();let t=A();if(t){let e=new Event(cK);t.dispatchEvent(e)}}}}},B.createElement(`label`,{"cmdk-label":``,htmlFor:w.inputId,id:w.labelId,style:IK},c),FK(e,e=>B.createElement(pK.Provider,{value:C},B.createElement(dK.Provider,{value:w},e))))}),_K=B.forwardRef((e,t)=>{let n=GL(),r=B.useRef(null),i=B.useContext(hK),a=fK(),o=OK(e),s=o.current?.forceMount??i?.forceMount;kK(()=>{if(!s)return a.item(n,i?.id)},[s]);let c=MK(n,r,[e.value,e.children,r],e.keywords),l=mK(),u=jK(e=>e.value&&e.value===c.current),d=jK(e=>s||a.filter()===!1?!0:!e.search||e.filtered.items.get(n)>0);B.useEffect(()=>{let t=r.current;if(!(!t||e.disabled))return t.addEventListener(cK,f),()=>t.removeEventListener(cK,f)},[d,e.onSelect,e.disabled]);function f(){var e,t;p(),(t=(e=o.current).onSelect)==null||t.call(e,c.current)}function p(){l.setState(`value`,c.current,!0)}if(!d)return null;let{disabled:m,value:h,onSelect:g,forceMount:_,keywords:v,...y}=e;return B.createElement(sR.div,{ref:cb(r,t),...y,id:n,"cmdk-item":``,role:`option`,"aria-disabled":!!m,"aria-selected":!!u,"data-disabled":!!m,"data-selected":!!u,onPointerMove:m||a.getDisablePointerSelection()?void 0:p,onClick:m?void 0:f},e.children)}),vK=B.forwardRef((e,t)=>{let{heading:n,children:r,forceMount:i,...a}=e,o=GL(),s=B.useRef(null),c=B.useRef(null),l=GL(),u=fK(),d=jK(e=>i||u.filter()===!1?!0:!e.search||e.filtered.groups.has(o));kK(()=>u.group(o),[]),MK(o,s,[e.value,e.heading,c]);let f=B.useMemo(()=>({id:o,forceMount:i}),[i]);return B.createElement(sR.div,{ref:cb(s,t),...a,"cmdk-group":``,role:`presentation`,hidden:!d||void 0},n&&B.createElement(`div`,{ref:c,"cmdk-group-heading":``,"aria-hidden":!0,id:l},n),FK(e,e=>B.createElement(`div`,{"cmdk-group-items":``,role:`group`,"aria-labelledby":n?l:void 0},B.createElement(hK.Provider,{value:f},e))))}),yK=B.forwardRef((e,t)=>{let{alwaysRender:n,...r}=e,i=B.useRef(null),a=jK(e=>!e.search);return!n&&!a?null:B.createElement(sR.div,{ref:cb(i,t),...r,"cmdk-separator":``,role:`separator`})}),bK=B.forwardRef((e,t)=>{let{onValueChange:n,...r}=e,i=e.value!=null,a=mK(),o=jK(e=>e.search),s=jK(e=>e.selectedItemId),c=fK();return B.useEffect(()=>{e.value!=null&&a.setState(`search`,e.value)},[e.value]),B.createElement(sR.input,{ref:t,...r,"cmdk-input":``,autoComplete:`off`,autoCorrect:`off`,spellCheck:!1,"aria-autocomplete":`list`,role:`combobox`,"aria-expanded":!0,"aria-controls":c.listId,"aria-labelledby":c.labelId,"aria-activedescendant":s,id:c.inputId,type:`text`,value:i?e.value:o,onChange:e=>{i||a.setState(`search`,e.target.value),n?.(e.target.value)}})}),xK=B.forwardRef((e,t)=>{let{children:n,label:r=`Suggestions`,...i}=e,a=B.useRef(null),o=B.useRef(null),s=jK(e=>e.selectedItemId),c=fK();return B.useEffect(()=>{if(o.current&&a.current){let e=o.current,t=a.current,n,r=new ResizeObserver(()=>{n=requestAnimationFrame(()=>{let n=e.offsetHeight;t.style.setProperty(`--cmdk-list-height`,n.toFixed(1)+`px`)})});return r.observe(e),()=>{cancelAnimationFrame(n),r.unobserve(e)}}},[]),B.createElement(sR.div,{ref:cb(a,t),...i,"cmdk-list":``,role:`listbox`,tabIndex:-1,"aria-activedescendant":s,"aria-label":r,id:c.listId},FK(e,e=>B.createElement(`div`,{ref:cb(o,c.listInnerRef),"cmdk-list-sizer":``},e)))}),SK=B.forwardRef((e,t)=>{let{open:n,onOpenChange:r,overlayClassName:i,contentClassName:a,container:o,...s}=e;return B.createElement(mz,{open:n,onOpenChange:r},B.createElement(bz,{container:o},B.createElement(Sz,{"cmdk-overlay":``,className:i}),B.createElement(Ez,{"aria-label":e.label,"cmdk-dialog":``,className:a},B.createElement(gK,{ref:t,...s}))))}),CK=B.forwardRef((e,t)=>jK(e=>e.filtered.count===0)?B.createElement(sR.div,{ref:t,...e,"cmdk-empty":``,role:`presentation`}):null),wK=B.forwardRef((e,t)=>{let{progress:n,children:r,label:i=`Loading...`,...a}=e;return B.createElement(sR.div,{ref:t,...a,"cmdk-loading":``,role:`progressbar`,"aria-valuenow":n,"aria-valuemin":0,"aria-valuemax":100,"aria-label":i},FK(e,e=>B.createElement(`div`,{"aria-hidden":!0},e)))}),TK=Object.assign(gK,{List:xK,Item:_K,Input:bK,Group:vK,Separator:yK,Dialog:SK,Empty:CK,Loading:wK});function EK(e,t){let n=e.nextElementSibling;for(;n;){if(n.matches(t))return n;n=n.nextElementSibling}}function DK(e,t){let n=e.previousElementSibling;for(;n;){if(n.matches(t))return n;n=n.previousElementSibling}}function OK(e){let t=B.useRef(e);return kK(()=>{t.current=e}),t}var kK=typeof window>`u`?B.useEffect:B.useLayoutEffect;function AK(e){let t=B.useRef();return t.current===void 0&&(t.current=e()),t}function jK(e){let t=mK(),n=()=>e(t.snapshot());return B.useSyncExternalStore(t.subscribe,n,n)}function MK(e,t,n,r=[]){let i=B.useRef(),a=fK();return kK(()=>{var o;let s=(()=>{for(let e of n){if(typeof e==`string`)return e.trim();if(typeof e==`object`&&`current`in e)return e.current?e.current.textContent?.trim():i.current}})(),c=r.map(e=>e.trim());a.value(e,s,c),(o=t.current)==null||o.setAttribute(lK,s),i.current=s}),i}var NK=()=>{let[e,t]=B.useState(),n=AK(()=>new Map);return kK(()=>{n.current.forEach(e=>e()),n.current=new Map},[e]),(e,r)=>{n.current.set(e,r),t({})}};function PK(e){let t=e.type;return typeof t==`function`?t(e.props):`render`in t?t.render(e.props):e}function FK({asChild:e,children:t},n){return e&&B.isValidElement(t)?B.cloneElement(PK(t),{ref:t.ref},n(t.props.children)):n(t)}var IK={position:`absolute`,width:`1px`,height:`1px`,padding:`0`,margin:`-1px`,overflow:`hidden`,clip:`rect(0, 0, 0, 0)`,whiteSpace:`nowrap`,borderWidth:`0`};function LK({className:e,...t}){return(0,V.jsx)(TK,{className:W(`flex w-full flex-col overflow-hidden rounded-md outline-none focus:outline-none focus-visible:outline-none [&_[cmdk-item]:focus]:outline-none [&_[cmdk-list]:focus]:outline-none`,e),...t})}function RK({className:e,...t}){return(0,V.jsx)(TK.List,{className:W(`max-h-72 overflow-y-auto overflow-x-hidden`,e),...t})}function zK({className:e,...t}){return(0,V.jsx)(TK.Group,{className:W(`overflow-hidden p-1`,e),...t})}function BK({className:e,...t}){return(0,V.jsx)(TK.Item,{className:W(`relative flex cursor-default items-center gap-2 rounded-md px-2 py-1.5 text-sm outline-none select-none data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50 data-[selected=true]:bg-white/8 [&_svg]:size-4 [&_svg]:shrink-0`,e),...t})}function VK(e){return e.source.type===`project`?`Project`:`${e.source.scope===`project`?`Project`:`Global`} · ${e.source.packageId}`}function HK({definitions:e,definitionsLoading:t,definitionsError:n,launchDisabled:r,commandRef:i,onCreateBrowserPanel:a,onSelectWebPanel:o}){return i?(0,V.jsxs)(LK,{ref:i,tabIndex:0,"aria-label":`Available tools`,children:[(0,V.jsx)(RK,{children:(0,V.jsxs)(zK,{children:[(0,V.jsxs)(BK,{value:`browser`,"aria-label":`Browser, new tab`,disabled:r,onSelect:a,children:[(0,V.jsx)(XI,{"data-icon":`inline-start`}),(0,V.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:`Browser`}),(0,V.jsx)(`span`,{className:`text-xs text-zinc-500`,children:`New tab`})]}),e.map(e=>(0,V.jsxs)(BK,{value:`${e.title} ${VK(e)}`,"aria-label":`${e.title}, web panel, ${VK(e)}`,disabled:r,onSelect:()=>o(e),children:[(0,V.jsx)(cL,{"data-icon":`inline-start`}),(0,V.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e.title}),(0,V.jsx)(`span`,{className:`max-w-1/2 truncate text-xs text-zinc-500`,children:VK(e)})]},e.id))]})}),t?(0,V.jsx)(`p`,{className:`px-2 py-2 text-sm text-zinc-500`,role:`status`,children:`Loading web panels…`}):null,n?(0,V.jsx)(`p`,{className:`px-2 py-2 text-sm text-zinc-500`,role:`status`,children:`Web panels unavailable`}):null]}):(0,V.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-1`,"aria-label":`Available tools`,children:[(0,V.jsxs)(X,{type:`button`,variant:`ghost`,className:`h-auto w-full justify-start px-2 py-1.5 text-left`,"aria-label":`Browser, new tab`,disabled:r,onClick:a,children:[(0,V.jsx)(XI,{"data-icon":`inline-start`}),(0,V.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:`Browser`}),(0,V.jsx)(`span`,{className:`text-xs text-zinc-500`,children:`New tab`})]}),e.map(e=>(0,V.jsxs)(X,{type:`button`,variant:`ghost`,className:`h-auto w-full justify-start px-2 py-1.5 text-left`,"aria-label":`${e.title}, web panel, ${VK(e)}`,disabled:r,onClick:()=>o(e),children:[(0,V.jsx)(cL,{"data-icon":`inline-start`}),(0,V.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e.title}),(0,V.jsx)(`span`,{className:`max-w-1/2 truncate text-xs text-zinc-500`,children:VK(e)})]},e.id)),t?(0,V.jsx)(`p`,{className:`px-2 py-2 text-sm text-zinc-500`,role:`status`,children:`Loading web panels…`}):null,n?(0,V.jsx)(`p`,{className:`px-2 py-2 text-sm text-zinc-500`,role:`status`,children:`Web panels unavailable`}):null]})}function UK(){let[e,t]=(0,B.useState)(!1);return(0,B.useEffect)(()=>{let e=window.setTimeout(()=>t(!0),200);return()=>window.clearTimeout(e)},[]),e?(0,V.jsx)(eb,{className:`shrink-0 text-zinc-500 motion-safe:animate-spin`,"aria-hidden":`true`}):(0,V.jsx)(XI,{className:`shrink-0 fill-zinc-500`,"aria-hidden":`true`})}function WK({open:e,disabled:t,onToggle:n}){let r=/Mac|iPhone|iPad|iPod/.test(navigator.platform)?`⌥⌘B`:`Ctrl+Alt+B`;return(0,V.jsxs)(tf,{children:[(0,V.jsx)(nf,{asChild:!0,children:(0,V.jsx)(X,{type:`button`,variant:e?`secondary`:`ghost`,size:`icon-sm`,className:`absolute top-1 right-1 z-40`,"aria-label":`Toggle side panel`,"aria-expanded":e,"aria-controls":`worktree-side-panel`,disabled:t,onClick:n,children:(0,V.jsx)(nb,{})})}),(0,V.jsxs)(rf,{side:`left`,children:[`Toggle side panel · `,r]})]})}var GK=320,KK=96,qK=560,JK=`treeport-side-panel-width`;function YK(e){let t=e.parentElement?.parentElement?.getBoundingClientRect().width;return Math.max(GK,(t??window.innerWidth)-KK)}function XK(e,t){return Math.min(t,Math.max(GK,e))}function ZK({width:e,onWidthChange:t}){let n=(0,B.useRef)(null),r=t=>{t.button===0&&(n.current={pointerX:t.clientX,width:t.currentTarget.parentElement?.getBoundingClientRect().width??e,maxWidth:YK(t.currentTarget)},t.currentTarget.setPointerCapture(t.pointerId))},i=e=>{n.current&&t(XK(n.current.width+n.current.pointerX-e.clientX,n.current.maxWidth))},a=e=>{n.current=null,e.currentTarget.hasPointerCapture(e.pointerId)&&e.currentTarget.releasePointerCapture(e.pointerId)};return(0,V.jsx)(`div`,{className:`absolute inset-y-0 left-0 z-30 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`,role:`separator`,"aria-label":`Resize side panel`,"aria-orientation":`vertical`,"aria-controls":`worktree-side-panel`,"aria-valuemin":GK,"aria-valuemax":Math.max(GK,window.innerWidth-KK),"aria-valuenow":e,"aria-valuetext":`${e} pixels`,title:`Drag to resize; double-click to reset`,tabIndex:0,onPointerDown:r,onPointerMove:i,onPointerUp:a,onPointerCancel:a,onKeyDown:n=>{let r=YK(n.currentTarget),i=n.currentTarget.parentElement?.getBoundingClientRect().width??e;if(n.key===`ArrowLeft`)i+=n.shiftKey?32:16;else if(n.key===`ArrowRight`)i-=n.shiftKey?32:16;else if(n.key===`Home`)i=GK;else if(n.key===`End`)i=r;else return;n.preventDefault(),t(XK(i,r))},onDoubleClick:()=>t(qK)})}function QK({worktreeName:e,visible:t,tools:n,activePanelId:r,webPanelRuntimeTitles:i,browserPanelLoading:a,definitions:o,definitionsLoading:s,definitionsError:c,launchDisabled:l,children:u,onSelectPanel:d,onClosePanel:f,onCreateBrowserPanel:p,onOpenWebPanel:m,onFocusSurface:h}){let{open:g,setOpen:_,dismiss:v}=sf(),{focusedSurface:y,emptyToolFocusRevision:b}=uf(),x=y===`tool`,S=(0,B.useRef)(null),C=(0,B.useRef)(null),w=(0,B.useRef)(0),[T,E]=(0,B.useState)(()=>{let e=Number.parseInt(localStorage.getItem(JK)??``,10);return Number.isFinite(e)?XK(e,Math.max(GK,window.innerWidth-KK)):qK}),D=e=>{E(e),localStorage.setItem(JK,String(e))},[O,k]=(0,B.useState)(null),A=O?O.source.type===`package`?`${O.source.scope} package ${O.source.source}`:`this project`:``,j=BG(O?.permissions??[]),M=()=>{v(),p()},N=e=>{if(v(),e.permissions.length>0&&!e.permissionsGranted){k(e);return}m(e)};(0,B.useEffect)(()=>{if(b<=w.current||n.length>0||!t)return;w.current=b;let e=window.requestAnimationFrame(()=>{let e=C.current;if(!e||e.contains(document.activeElement))return;let t=e.querySelector(`button:not(:disabled)`);t?t.focus():e.focus()});return()=>window.cancelAnimationFrame(e)},[b,n.length,t]);let P=(0,V.jsx)(HK,{definitions:o,definitionsLoading:s,definitionsError:c,launchDisabled:l,onCreateBrowserPanel:M,onSelectWebPanel:N});return(0,V.jsxs)(`section`,{ref:C,id:`worktree-side-panel`,className:W(`relative grid min-h-0 min-w-0 w-[var(--side-panel-width)] border-l border-white/8 bg-zinc-950 outline-none max-[700px]:w-full max-[700px]:border-l-0`,n.length>0?`grid-rows-[auto_minmax(0,1fr)]`:`grid-rows-[minmax(0,1fr)]`,!t&&`pointer-events-none absolute inset-0 opacity-0`),style:{"--side-panel-width":`${T}px`},role:`region`,tabIndex:-1,"aria-label":`${e} tool tab group`,"aria-hidden":!t||void 0,inert:!t||void 0,onPointerDownCapture:h,onFocusCapture:h,children:[(0,V.jsx)(ZK,{width:T,onWidthChange:D}),n.length>0?(0,V.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1.5 border-b border-white/8 bg-zinc-900 py-1.5 pr-10 pl-2`,children:[(0,V.jsx)(`div`,{className:`flex min-w-0 items-center gap-1.5 overflow-x-auto`,role:`tablist`,"aria-label":`${e} tool tabs`,children:n.map((e,t)=>{let n=e.kind===`web`?i[e.id]??e.title:e.title,o=e.id===r,s=e.kind===`browser`&&!!a[e.id];return(0,V.jsxs)(`div`,{className:W(`group/tool relative flex min-w-28 max-w-56 shrink-0 items-center rounded-md`,o?`bg-white/8 hover:bg-white/10`:`hover:bg-white/6`),children:[(0,V.jsxs)(X,{type:`button`,variant:`ghost`,size:`sm`,className:`min-w-0 flex-1 justify-start pr-8 hover:bg-transparent hover:text-zinc-400`,role:`tab`,"aria-selected":o,"aria-keyshortcuts":x&&t<9?`Meta+${t+1}`:void 0,"aria-label":e.kind===`browser`?`${n===`Browser`?`Browser`:`${n}, Browser`}${s?`, loading`:``}`:`${n}, web panel`,title:n,onClick:()=>d(e),onMouseDown:e=>{e.button===1&&e.preventDefault()},onAuxClick:t=>{t.button===1&&(t.preventDefault(),f(e,t.currentTarget))},children:[e.kind===`browser`?s?(0,V.jsx)(UK,{}):(0,V.jsx)(XI,{"data-icon":`inline-start`}):(0,V.jsx)(cL,{"data-icon":`inline-start`}),(0,V.jsx)(`span`,{className:`min-w-0 flex-1 overflow-hidden whitespace-nowrap [mask-image:linear-gradient(to_right,black_calc(100%_-_1rem),transparent)]`,children:n}),t<9?(0,V.jsxs)(`kbd`,{className:W(`font-sans text-[0.6875rem] font-normal text-zinc-500 tabular-nums group-hover/tool:opacity-0 group-focus-within/tool:opacity-0 max-[700px]:hidden pointer-coarse:hidden`,!x&&`invisible`),"aria-hidden":`true`,children:[`⌘`,t+1]}):null]}),(0,V.jsx)(X,{type:`button`,variant:`link`,size:`icon-sm`,className:`absolute top-1/2 right-1 -translate-y-1/2 opacity-0 group-hover/tool:opacity-100 group-focus-within/tool:opacity-100 pointer-coarse:opacity-100`,"aria-label":`Close ${n}`,onClick:t=>f(e,t.currentTarget),children:(0,V.jsx)(uL,{})})]},e.id)})}),(0,V.jsxs)(YS,{open:g,onOpenChange:_,children:[(0,V.jsx)(XS,{asChild:!0,children:(0,V.jsx)(X,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":`Open another tool`,children:(0,V.jsx)(nL,{})})}),(0,V.jsx)(ZS,{align:`end`,className:`w-[min(17rem,calc(100vw-1rem))] p-0`,"aria-label":`Open a tool`,onOpenAutoFocus:e=>{e.preventDefault(),S.current?.focus()},children:(0,V.jsx)(HK,{definitions:o,definitionsLoading:s,definitionsError:c,launchDisabled:l,commandRef:S,onCreateBrowserPanel:M,onSelectWebPanel:N})})]})]}):null,(0,V.jsxs)(`div`,{className:`relative grid min-h-0 min-w-0 grid-rows-[minmax(0,1fr)]`,onPointerDownCapture:v,onFocusCapture:v,children:[n.length===0?(0,V.jsxs)(Mb,{className:`mx-auto w-full max-w-md items-stretch text-left`,children:[(0,V.jsx)(Nb,{children:`Open a tool`}),(0,V.jsx)(Pb,{children:`Open Browser or a web panel beside the terminal.`}),(0,V.jsx)(`div`,{className:`mt-2`,children:P})]}):null,u]}),(0,V.jsx)(sB,{open:O!==null,onOpenChange:e=>{e||k(null)},children:(0,V.jsxs)(uB,{children:[(0,V.jsxs)(dB,{children:[(0,V.jsx)(pB,{children:`Allow privileged panel access?`}),(0,V.jsx)(mB,{children:`${O?.title??`This panel`} is from ${A}. ${j}`})]}),(0,V.jsxs)(fB,{children:[(0,V.jsx)(gB,{children:`Cancel`}),(0,V.jsx)(hB,{onClick:()=>{let e=O;k(null),e&&m(e)},children:`Allow and open`})]})]})})]})}var $K={phase:`closed`,degraded:!1,controller:!1,controlPending:!1,title:null,bellActive:!1,bellSerial:0,exitSerial:0,fileTransfer:null,hasSelection:!1,selecting:!1,viewingHistory:!1,pasteRequestSerial:0,error:null};function eq({worktree:e,terminal:t,pendingTerminals:n,selectedPendingTerminalId:r,loading:i,autoFocusBlocked:a,onStatusChange:o}){let s=(0,B.useRef)(null),c=(0,B.useRef)(null),l=(0,B.useRef)(null),u=(0,B.useRef)(null),[d,f]=(0,B.useState)(null),[p,m]=(0,B.useState)(!1),[h,g]=(0,B.useState)(!1),[_,v]=(0,B.useState)({terminalId:null,open:!1,value:``}),y=(0,B.useRef)(o);y.current=o;let b=uV();(0,B.useLayoutEffect)(()=>{if(!t){f(null);return}let e=LF.acquire(t.id);return f(e),()=>LF.release(t.id)},[t?.id]);let x=d?.terminalId===t?.id?d:null,S=(0,B.useSyncExternalStore)((0,B.useCallback)(e=>{if(!x)return()=>void 0;let t=x.getSnapshot();return x.subscribe(()=>{let n=x.getSnapshot();n.pasteRequestSerial>t.pasteRequestSerial&&v(e=>({terminalId:x.terminalId,open:!0,value:e.terminalId===x.terminalId?e.value:``})),n.exitSerial>t.exitSerial&&y.current(),t=n,e()})},[x]),x?.getSnapshot??(()=>$K),()=>$K),C=_.terminalId===t?.id&&_.open,w=_.terminalId===t?.id?_.value:``,{titles:T}=YF();(0,B.useLayoutEffect)(()=>{let e=c.current;if(!(!e||!x))return x.mount(e),()=>x.unmount(e)},[x]),YB({terminalId:t?.id??null,session:x,blocked:a}),(0,B.useEffect)(()=>{if(x)return x.setInputModifiers(p,h,()=>{m(!1),g(!1)}),()=>x.setInputModifiers(!1,!1,()=>void 0)},[x,h,p]);let E=e=>{let t=e;p&&e.length===1&&(t=String.fromCharCode(e.toUpperCase().charCodeAt(0)&31)),h&&(t=`\u001b${t}`),x?.sendText(t,{focus:!1}),m(!1),g(!1)},D=e=>{x?.sendArrow(e,h,{focus:!1}),m(!1),g(!1)},O=e=>{e&&(x?.pasteText(e),v({terminalId:t?.id??null,open:!1,value:``}))},k=()=>{x?.requestControl(),v(e=>({terminalId:t?.id??null,open:!0,value:e.terminalId===t?.id?e.value:``})),navigator.clipboard&&navigator.clipboard.readText().then(e=>O(e),()=>void 0)},A=(0,V.jsxs)(V.Fragment,{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:w,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=>v({terminalId:t?.id??null,open:!0,value:e.target.value}),onPaste:e=>{let t=e.clipboardData.getData(`text`);t&&(e.preventDefault(),O(t))}}),(0,V.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,V.jsx)(X,{type:`button`,variant:`ghost`,size:`sm`,onClick:()=>v({terminalId:t?.id??null,open:!1,value:``}),children:`Cancel`}),(0,V.jsx)(X,{type:`button`,size:`sm`,disabled:!w,onClick:()=>O(w),children:`Send`})]})]}),j=n.find(e=>e.id===r),M=t?T.get(t.id)||t.name:j?.name??``;return(0,V.jsxs)(`main`,{ref:s,className:W(`terminal-shell grid min-h-0 min-w-0 grid-rows-[minmax(0,1fr)] bg-zinc-950 max-[700px]:grid-rows-[minmax(0,1fr)_3.25rem]`,S.bellActive&&`terminal-bell`),"aria-label":j?`Starting ${j.name} terminal`:t?`${M} terminal`:`Terminal panel`,children:[j?(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)(EI,{className:`size-4 animate-spin fill-zinc-500`,"aria-hidden":`true`}),`Starting `,j.name,`…`]})}):t?(0,V.jsxs)(`div`,{className:`relative min-h-0 min-w-0 overflow-hidden`,children:[(0,V.jsx)(`div`,{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:c,onMouseDown:()=>x?.focus({requestControl:!0})},t.id),S.viewingHistory&&!C?(0,V.jsxs)(`div`,{className:`absolute top-3 left-1/2 z-20 flex -translate-x-1/2 items-center gap-2 rounded-full bg-zinc-900/95 py-1 pr-1 pl-3 text-xs text-zinc-300 shadow-lg ring-1 ring-amber-400/20 backdrop-blur`,children:[(0,V.jsxs)(`span`,{role:`status`,className:`whitespace-nowrap leading-tight`,children:[(0,V.jsx)(`strong`,{className:`block font-medium text-zinc-100`,children:S.hasSelection||S.selecting?`Selection is active`:`Scrolled back in tmux`}),(0,V.jsx)(`span`,{className:`block text-[0.6875rem] text-zinc-400`,children:`New output is continuing off-screen`})]}),(0,V.jsx)(X,{type:`button`,variant:`ghost`,size:`sm`,className:`h-7 rounded-full px-2.5 text-xs text-cyan-200 hover:bg-white/8 hover:text-cyan-100`,onClick:()=>{S.hasSelection||S.selecting?x?.clearSelectionAndJumpToLatest():x?.jumpToLatest()},children:S.hasSelection||S.selecting?`Clear`:`Follow latest`})]}):null,S.phase===`ready`&&!S.controller?(0,V.jsxs)(`span`,{className:`absolute top-3 right-14 z-10 inline-flex shrink-0 items-center gap-1.5 rounded-full bg-zinc-900/90 px-2 py-1 text-[0.6875rem] font-medium text-zinc-400 shadow ring-1 ring-white/8 backdrop-blur`,title:`Interact with the terminal to control it`,children:[(0,V.jsx)(`span`,{className:W(`size-1.5 rounded-full bg-zinc-500`,S.controlPending&&`animate-pulse bg-cyan-400`),"aria-hidden":`true`}),S.controlPending?`Taking control…`:`Viewing`]}):null,C&&(b?(0,V.jsx)(wB,{open:!0,onOpenChange:e=>{e||v({terminalId:t.id,open:!1,value:``})},children:(0,V.jsxs)(kB,{className:`max-w-sm gap-3 p-4`,mobilePresentation:`dialog`,restoreFocusTo:u.current,children:[(0,V.jsxs)(AB,{children:[(0,V.jsx)(jB,{className:`text-lg sm:text-lg`,children:`Paste into terminal`}),(0,V.jsx)(MB,{className:`sr-only`,children:`Paste text and send it to the active terminal.`})]}),A]})}):(0,V.jsx)(`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:A})),S.hasSelection&&!C&&(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)(X,{type:`button`,variant:`ghost`,size:`sm`,className:`rounded-none border-r border-white/10 px-3 text-zinc-100`,onClick:()=>x?.copySelection(),children:`Copy`}),(0,V.jsx)(X,{type:`button`,variant:`ghost`,size:`sm`,className:`rounded-none px-3 text-zinc-300`,onClick:()=>x?.clearSelection(),children:`Clear`})]}),(S.degraded||S.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:[S.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:S.error?`${S.error} Retrying…`:S.phase===`connecting`?`Connecting…`:`Reconnecting…`}),S.fileTransfer&&(0,V.jsx)(`span`,{className:W(`rounded-full bg-zinc-900/90 px-3 py-1 text-xs shadow ring-1 backdrop-blur`,S.fileTransfer.state===`error`?`text-rose-100 ring-rose-400/30`:`text-cyan-100 ring-cyan-400/20`),role:S.fileTransfer.state===`error`?`alert`:`status`,children:S.fileTransfer.message})]}),S.phase===`closed`&&S.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:S.error}),(0,V.jsx)(X,{type:`button`,variant:`ghost`,size:`sm`,className:`h-6 px-2 text-xs text-rose-100 hover:bg-rose-900`,onClick:()=>x?.retry(),children:`Retry`})]})}),(0,V.jsxs)(`span`,{className:`sr-only`,"aria-live":`polite`,children:[S.phase===`ready`?S.controller?`Controlling terminal`:S.controlPending?`Taking control of terminal`:`Viewing terminal`:``,S.bellActive?` Bell from ${M}`:``]})]}):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)(EI,{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 tree.`:`Choose a tree.`}),(0,V.jsx)(`p`,{className:`max-w-[52ch] text-base text-pretty text-zinc-400 sm:text-sm`,children:e?`Use New panel in the sidebar to start a login shell, preset, or web panel.`:`Select a tree 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:()=>x?.requestControl(),onMouseDownCapture:e=>e.preventDefault(),children:[(0,V.jsx)(X,{variant:`ghost`,type:`button`,onClick:()=>E(`\x1B`),children:`Esc`}),(0,V.jsx)(X,{variant:`ghost`,type:`button`,className:p?`latched bg-cyan-950 text-cyan-100`:``,"aria-pressed":p,onClick:()=>m(e=>!e),children:`Ctrl`}),(0,V.jsx)(X,{variant:`ghost`,type:`button`,className:h?`latched bg-cyan-950 text-cyan-100`:``,"aria-pressed":h,onClick:()=>g(e=>!e),children:`Alt`}),(0,V.jsx)(`input`,{ref:l,type:`file`,multiple:!0,hidden:!0,onChange:e=>{let t=Array.from(e.currentTarget.files??[]);e.currentTarget.value=``,x?.pasteFiles(t)}}),(0,V.jsx)(X,{variant:`ghost`,type:`button`,onClick:()=>l.current?.click(),children:`Upload`}),(0,V.jsx)(X,{ref:u,variant:`ghost`,type:`button`,onClick:k,children:`Paste`}),(0,V.jsx)(X,{variant:`ghost`,type:`button`,onClick:()=>E(` `),children:`Tab`}),(0,V.jsx)(X,{variant:`ghost`,type:`button`,onClick:()=>{x?.sendText(`\x1B[Z`,{focus:!1}),m(!1),g(!1)},children:`Shift+Tab`}),(0,V.jsx)(X,{variant:`ghost`,type:`button`,onClick:()=>E(`\r`),children:`Enter`}),(0,V.jsx)(X,{variant:`ghost`,type:`button`,"aria-label":`Arrow left`,onClick:()=>D(`left`),children:`←`}),(0,V.jsx)(X,{variant:`ghost`,type:`button`,"aria-label":`Arrow up`,onClick:()=>D(`up`),children:`↑`}),(0,V.jsx)(X,{variant:`ghost`,type:`button`,"aria-label":`Arrow down`,onClick:()=>D(`down`),children:`↓`}),(0,V.jsx)(X,{variant:`ghost`,type:`button`,"aria-label":`Arrow right`,onClick:()=>D(`right`),children:`→`})]})]})}function tq({projects:e,selectedWorktree:t,selectedTerminal:n}){let r=qe(),{closeMobileWithoutFocusRestore:i}=TV(),a=xa(),o=XB(),s=(0,B.useRef)(new Set),c=(0,B.useRef)(0),l=(0,B.useRef)(null),u=(0,B.useRef)(a.pathname),[d,f]=(0,B.useState)([]),[p,m]=(0,B.useState)(null);u.current=a.pathname;let h=d.find(e=>e.id===p&&e.worktreeId===t?.id),g=n?.id??null,_=dt({mutationFn:async({worktreeId:e,name:t,initialTitle:n,argv:r,shellCommand:i,cwd:a,env:o,returnToShell:s,closeOnSuccess:c,initialSize:l})=>{let u={name:t};return n&&(u.initialTitle=n),r&&(u.argv=r),i&&(u.shellCommand=i),a&&(u.cwd=a),o&&(u.env=o),s&&(u.returnToShell=!0),c&&(u.closeOnSuccess=!0),l&&(u.initialSize=l),(await Ef(NN.api.worktrees[`:worktreeId`].terminals.$post({param:{worktreeId:e},json:u}))).terminal},onSuccess:async(t,{pendingTerminal:n})=>{let i=l.current===n.id,a=i&&u.current===n.originPath;f(e=>e.filter(e=>e.id!==n.id)),i&&(l.current=null,m(null));let s=e.find(e=>e.id===n.projectId),c=s?.worktrees.find(e=>e.id===n.worktreeId);if(!s||!c){await r.invalidateQueries({queryKey:LB});return}let d=n.originPath===rI(s.id,c.id).pathname;r.setQueryData(LB,e=>e?.map(e=>({...e,worktrees:e.worktrees.map(e=>e.id===c.id?{...e,terminals:[...e.terminals.filter(e=>e.id!==t.id),t]}:e)}))),a&&await o(iI(s.id,c.id,t.id),d),await r.invalidateQueries({queryKey:LB})},onError:async(e,{pendingTerminal:t})=>{f(e=>e.filter(e=>e.id!==t.id)),l.current===t.id&&(l.current=null,m(null)),vI(e,{operation:`create terminal “${t.name}”`}),await r.invalidateQueries({queryKey:LB})}}),v=dt({mutationFn:({terminal:e})=>Ef(NN.api.terminals[`:terminalId`].$delete({param:{terminalId:e.id}})),onSuccess:async()=>{await r.invalidateQueries({queryKey:LB})},onError:(e,t)=>{r.setQueryData(LB,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}})}))),vI(e,{operation:`close terminal “${t.terminal.name}”`})},onSettled:(e,t,n)=>{s.current.delete(n.terminal.id)}});return{pendingTerminals:d,selectedPendingTerminal:h,createTerminalInWorktree:(t,r,o)=>{let s=e.find(e=>e.id===t.id),u=s?.worktrees.find(e=>e.id===r.id);if(!s||!u||s.availability.state===`unavailable`||u.prunable)return;let d=n?.worktreeId===u.id?LF.getInitialSize(n.id):null,p={id:`pending-terminal-${++c.current}`,projectId:s.id,worktreeId:u.id,name:o.name,originPath:a.pathname};l.current=p.id,f(e=>[...e,p]),m(p.id),i();let h={worktreeId:u.id,name:o.name,pendingTerminal:p};o.initialTitle&&(h.initialTitle=o.initialTitle),o.argv&&(h.argv=[...o.argv]),o.shellCommand&&(h.shellCommand=o.shellCommand),o.cwd&&(h.cwd=o.cwd),o.env&&(h.env={...o.env}),o.returnToShell&&(h.returnToShell=!0),o.closeOnSuccess&&(h.closeOnSuccess=!0),d&&(h.initialSize=d),_.mutate(h)},requestCloseTerminal:(t,n)=>{let i=e.find(e=>e.worktrees.some(e=>e.id===t.worktreeId)),a=i?.worktrees.find(e=>e.id===t.worktreeId),c=a?.terminals.filter(e=>e.id!==t.id&&!s.current.has(e.id));if(!i||!a||s.current.has(t.id)||!c?.length)return;let l=n?.title??LF.getTitleSnapshot().get(t.id)??t.name;if((n?.hasForegroundProcess??LF.getForegroundProcessSnapshot().has(t.id))&&!window.confirm(`Close terminal “${l}”? Its foreground process will be terminated.`))return;let u=a.terminals.findIndex(e=>e.id===t.id);if(s.current.add(t.id),r.cancelQueries({queryKey:LB}),g===t.id){let e=a.terminals.slice(u+1).find(e=>!s.current.has(e.id))??a.terminals.slice(0,u).reverse().find(e=>!s.current.has(e.id));e&&o(iI(i.id,a.id,e.id),!0)}LF.forget(t.id),r.setQueryData(LB,e=>e?.map(e=>({...e,worktrees:e.worktrees.map(e=>e.id===a.id?{...e,terminals:e.terminals.filter(e=>e.id!==t.id)}:e)}))),v.mutate({terminal:t,index:u})},clearPendingTerminalSelection:()=>{l.current=null,m(null)},selectPendingTerminal:e=>{d.some(t=>t.id===e)&&(l.current=e,m(e),i())}}}function nq({selectedWorktree:e,selectedTerminal:t,selectedPendingTerminal:n,pendingTerminals:r,loading:i,dialogOpen:a}){let o=qe(),{focusedSurface:s}=uf(),{isMobile:c,openMobile:l}=TV(),{open:u}=iH();return(0,V.jsx)(eq,{worktree:e,terminal:t,pendingTerminals:r.filter(t=>t.worktreeId===e?.id),selectedPendingTerminalId:t?null:n?.id??null,loading:i,autoFocusBlocked:s===`tool`||a||u||c&&l,onStatusChange:()=>void o.invalidateQueries({queryKey:LB})})}function rq({className:e,...t}){return(0,V.jsx)(`textarea`,{"data-slot":`textarea`,className:W(`min-h-24 w-full resize-y 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:text-sm`,e),...t})}var iq=`treeport-initial-terminal-preset`;function aq({project:e,presets:t,presetDiagnostics:n,presetsLoading:r,presetsError:i,onRetryPresets:a,contextFields:o,contextFieldDiagnostics:s,contextFieldsLoading:c,contextFieldsError:l,onRetryContextFields:u,busy:d,onSubmit:f}){let[p,m]=(0,B.useState)(``),[h,g]=(0,B.useState)(`default`),[_,v]=(0,B.useState)({}),[y,b]=(0,B.useState)(()=>localStorage.getItem(iq)??`shell`),x=t.filter(e=>!e.closeOnSuccess&&e.executable!==null&&e.shellCommand===null),S=x.some(e=>e.id===y),C=y!==`shell`&&!S,w=C&&r,T=C&&!r&&!i,E=C&&!r?`shell`:y,D=h==="default"?`default`:`current`;return(0,V.jsxs)(`form`,{className:`flex flex-col gap-5`,autoComplete:`off`,onSubmit:e=>{e.preventDefault();let t=p.trim();if(d||!t)return;let n=x.find(e=>e.id===E);T&&localStorage.setItem(iq,`shell`);let r=Object.fromEntries(o.flatMap(e=>{let t=_[e.id]?.trim();return t?[[e.id,t]]:[]}));f(t,D,n?{name:n.name,initialTitle:n.name,argv:[n.executable,...n.args],returnToShell:!0}:{name:`Shell`},D===`current`?h:void 0,r)},children:[(0,V.jsxs)(NB,{children:[(0,V.jsx)(PB,{htmlFor:`worktree-name`,children:`Name`}),(0,V.jsx)(dL,{id:`worktree-name`,name:`worktree-name`,value:p,onChange:e=>m(e.target.value),placeholder:`feature-name`,"aria-label":`Tree name`,autoCapitalize:`none`,spellCheck:!1,required:!0,autoFocus:!0,disabled:d})]}),(0,V.jsxs)(NB,{children:[(0,V.jsx)(PB,{htmlFor:`worktree-base`,children:`Start from`}),(0,V.jsxs)(uH,{id:`worktree-base`,name:`worktree-base`,value:h,onChange:e=>g(e.target.value),disabled:d,children:[(0,V.jsxs)(`option`,{value:`default`,children:[e.defaultBranch,` · latest from origin`]}),e.worktrees.map(e=>(0,V.jsxs)(`option`,{value:e.id,children:[e.name,` · current commit`]},e.id))]})]}),o.map(e=>(0,V.jsxs)(NB,{children:[(0,V.jsx)(PB,{htmlFor:`tree-context-${e.id}`,children:e.label}),e.input===`textarea`?(0,V.jsx)(rq,{id:`tree-context-${e.id}`,name:`tree-context-${e.id}`,value:_[e.id]??``,onChange:t=>v(n=>({...n,[e.id]:t.target.value})),maxLength:ZP,disabled:d,rows:4}):(0,V.jsx)(dL,{id:`tree-context-${e.id}`,name:`tree-context-${e.id}`,value:_[e.id]??``,onChange:t=>v(n=>({...n,[e.id]:t.target.value})),maxLength:ZP,disabled:d})]},e.id)),c&&(0,V.jsx)(`p`,{className:`form-note`,role:`status`,children:`Loading tree context fields…`}),l&&(0,V.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,V.jsx)(`p`,{className:`form-note`,children:`Tree context fields could not be loaded. You can still create the tree.`}),(0,V.jsx)(X,{type:`button`,variant:`secondary`,size:`sm`,onClick:u,children:`Retry`})]}),s.map(e=>(0,V.jsx)(`p`,{className:`form-note`,role:`status`,children:e.message},`${e.scope}:${e.path}:${e.message}`)),(0,V.jsxs)(NB,{children:[(0,V.jsx)(PB,{htmlFor:`initial-terminal-preset`,children:`Initial terminal`}),(0,V.jsxs)(uH,{id:`initial-terminal-preset`,name:`initial-terminal-preset`,value:E,onChange:e=>{b(e.target.value),localStorage.setItem(iq,e.target.value)},disabled:d,children:[w&&(0,V.jsx)(`option`,{value:y,children:`Loading saved preset…`}),(0,V.jsx)(`option`,{value:`shell`,children:`Shell`}),x.map(e=>(0,V.jsxs)(`option`,{value:e.id,children:[e.name,` — `,zG(e),` —`,` `,RG(e)]},e.id))]}),T&&(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.`}),r&&(0,V.jsx)(`p`,{className:`form-note`,role:`status`,children:`Loading terminal presets…`}),i&&(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)(X,{type:`button`,variant:`secondary`,size:`sm`,onClick:a,children:`Retry`})]}),n.map(e=>(0,V.jsx)(`p`,{className:`form-note`,role:`status`,children:e.message},`${e.path}:${e.itemId??`file`}:${e.message}`))]}),(0,V.jsx)(`div`,{className:`flex items-center justify-end pt-1`,children:(0,V.jsx)(X,{type:`submit`,disabled:d||c||w||!p.trim(),children:d?`Creating…`:`Create tree`})})]})}function oq({project:e,onOpenChange:t,restoreFocusTo:n,presets:r,presetDiagnostics:i,presetsLoading:a,presetsError:o,onRetryPresets:s,contextFields:c,contextFieldDiagnostics:l,contextFieldsLoading:u,contextFieldsError:d,onRetryContextFields:f,onSubmit:p}){let m=(0,B.useRef)(!1);return(0,V.jsx)(wB,{open:e!==null,onOpenChange:t,children:e?(0,V.jsxs)(kB,{className:`max-w-md`,mobilePresentation:`dialog`,restoreFocusTo:n,onCloseAutoFocus:e=>{m.current&&(m.current=!1,e.preventDefault())},children:[(0,V.jsxs)(AB,{children:[(0,V.jsx)(jB,{children:`Create tree`}),(0,V.jsx)(MB,{className:`sr-only`,children:`Create a linked tree and choose its starting point and initial terminal.`})]}),(0,V.jsx)(aq,{project:e,presets:r,presetDiagnostics:i,presetsLoading:a,presetsError:o,onRetryPresets:s,contextFields:c,contextFieldDiagnostics:l,contextFieldsLoading:u,contextFieldsError:d,onRetryContextFields:f,busy:!1,onSubmit:(t,n,r,i,a)=>{m.current=!0,p(e,t,n,r,i,a)}})]}):null})}function sq({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)(sB,{open:e!==null,onOpenChange:r,children:e&&t?(0,V.jsxs)(uB,{restoreFocusTo:i,children:[(0,V.jsxs)(dB,{children:[(0,V.jsx)(`p`,{className:`eyebrow`,children:o?`Destructive removal`:`Tree`}),(0,V.jsx)(pB,{children:`Remove tree`}),(0,V.jsx)(mB,{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)(fB,{children:[(0,V.jsx)(gB,{children:`Cancel`}),(0,V.jsx)(hB,{asChild:!0,children:(0,V.jsx)(X,{type:`button`,variant:`destructive`,disabled:n||!t.eligible,onClick:n=>{n.preventDefault(),a(e,t)},children:n?`Removing…`:o?`Remove anyway`:`Remove tree`})})]})]}):null})}function cq({projects:e,setDrawerOpen:t,onWorktreeSubmitted:n,onRemovalNeedsConfirmation:r,onRemovalCompleted:i,selectedTerminalId:a}){let o=qe(),s=lt({queryKey:[`worktree-creations`],queryFn:async()=>(await Ef(NN.api.operations.$get({query:{kind:`create`}}))).operations,refetchInterval:2e3,refetchOnReconnect:!0,refetchOnWindowFocus:!0}),c=lt({queryKey:[`worktree-removals`],queryFn:async()=>(await Ef(NN.api.operations.$get({query:{kind:`remove`}}))).operations,refetchInterval:2e3,refetchOnReconnect:!0,refetchOnWindowFocus:!0}),[l,u]=(0,B.useState)([]),d=(s.data??[]).flatMap(e=>{if(e.kind!==`create`)return[];let t=e.request.name;return e.projectId?[{id:e.id,projectId:e.projectId,typedName:t}]:[]}),f=(0,B.useRef)(new Set),p=(0,B.useRef)(new Set),m=st({queries:l.map(e=>({queryKey:[`operation`,e.id],queryFn:async()=>(await Ef(NN.api.operations[`:operationId`].$get({param:{operationId:e.id}}))).operation,refetchInterval:500}))}),h=new Set(m.flatMap(t=>{let n=t.data;if(n?.status!==`completed`||n.kind!==`create`)return[];let r=n.result?.worktreeId??n.worktreeId;return r&&e.some(e=>e.worktrees.some(e=>e.id===r))?[n.id]:[]})),g=d.filter(e=>!h.has(e.id)),_=new Set(g.map(e=>e.id)),v=[...g,...l.filter(e=>!_.has(e.id)&&!h.has(e.id)).map(({id:e,projectId:t,typedName:n})=>({id:e,projectId:t,typedName:n}))],[y,b]=(0,B.useState)({}),x=(c.data??[]).reduce((e,t)=>(t.kind===`remove`&&t.request.preview&&(e[t.request.preview.worktreeId]=`removing`),e),{...y}),S=(0,B.useRef)(new Set),C=dt({mutationFn:e=>{let t={name:e.typedName,base:e.base,initialTerminal:e.initialTerminal};return e.sourceWorktreeId&&Object.assign(t,{sourceWorktreeId:e.sourceWorktreeId}),e.treeContext&&Object.keys(e.treeContext).length>0&&Object.assign(t,{context:e.treeContext}),Ef(NN.api.projects[`:projectId`][`worktree-operations`].$post({param:{projectId:e.projectId},json:t})).then(e=>e.operation)},onSuccess:(e,t)=>{let n=e.kind===`create`?e.request.name:t.typedName;u(r=>[...r,{id:e.id,projectId:t.projectId,typedName:n}]),o.invalidateQueries({queryKey:[`worktree-creations`]})},onError:(e,n)=>{t(!1),vI(e,{operation:`create tree “${n.typedName}”`})}});(0,B.useEffect)(()=>{for(let e of v)l.some(t=>t.id===e.id)&&!p.current.has(e.id)&&(p.current.add(e.id),window.requestAnimationFrame(()=>{document.getElementById(`pending-worktree-${e.id}`)?.focus()}))},[l,v]),(0,B.useEffect)(()=>{m.forEach((e,n)=>{let r=e.data,i=l[n];!r||r.kind!==`create`||!i||r.status!==`completed`&&r.status!==`failed`||f.current.has(r.id)||(f.current.add(r.id),(async()=>{if(await o.invalidateQueries({queryKey:[`worktree-creations`]}),r.status===`failed`)vI(r.error??`Tree creation failed`,{operation:`create tree “${i.typedName}”`});else{await o.invalidateQueries({queryKey:LB});let e=(await Ef(NN.api.projects.$get())).projects;o.setQueryData(LB,e);let n=r.result;t(!1),n?.setupError?vI(n.setupError,{operation:`start setup for newly created tree “${i.typedName}”`}):n?.terminalError&&vI(n.terminalError,{operation:`start a terminal for newly created tree “${i.typedName}”`})}u(e=>e.filter(e=>e.id!==r.id))})())})},[m,l,o,t]);let w=(e,t,r,i,o,s)=>{let c=a?LF.getInitialSize(a):null,l={name:i.name};i.initialTitle&&(l.initialTitle=i.initialTitle),i.argv&&(l.argv=[...i.argv]),i.returnToShell&&(l.returnToShell=!0),c&&(l.initialSize=c);let u={projectId:e.id,typedName:t,base:r,initialTerminal:l};o&&(u.sourceWorktreeId=o),s&&Object.keys(s).length>0&&(u.treeContext=s),n(),C.mutate(u)},T=(e,t)=>b(n=>({...n,[e]:t})),E=e=>{S.current.delete(e),b(t=>{if(!(e in t))return t;let n={...t};return delete n[e],n})},D=async(e,t,n,a)=>{T(e.id,`removing`);try{await Ef(NN.api.worktrees[`:worktreeId`].remove.$post({param:{worktreeId:e.id},json:{confirmationToken:t.confirmationToken,confirmDestructive:n}})),await o.invalidateQueries({queryKey:[`worktree-removals`]}),E(e.id),i(e.id),o.invalidateQueries({queryKey:LB},{cancelRefetch:!1})}catch(t){if(HN(t).code===`REMOVE_PREVIEW_STALE`&&a>0){T(e.id,`checking`);try{let t=(await Ef(NN.api.worktrees[`:worktreeId`][`remove-preview`].$get({param:{worktreeId:e.id}}))).preview;if(t.eligible&&t.warnings.length===0){await D(e,t,!1,a-1);return}E(e.id),r(e,t);return}catch(t){E(e.id),vI(t,{operation:`refresh removal details for tree “${e.name}”`});return}}E(e.id),vI(t,{operation:`remove tree “${e.name}”`})}};return{pendingWorktrees:v,pendingRemovals:x,submitWorktreeCreation:w,prepareRemoval:async(e,t)=>{if(!(S.current.has(e.id)||x[e.id])){S.current.add(e.id),T(e.id,`checking`);try{let n=(await Ef(NN.api.worktrees[`:worktreeId`][`remove-preview`].$get({param:{worktreeId:e.id}}))).preview;if(n.eligible&&n.warnings.length===0){await D(e,n,!1,1);return}E(e.id),r(e,n,t)}catch(t){E(e.id),vI(t,{operation:`check whether tree “${e.name}” can be removed`})}}},confirmRemoval:(e,t)=>{S.current.has(e.id)||(S.current.add(e.id),D(e,t,t.warnings.length>0,1))}}}function lq(e,t,n){let r=qe(),i=(0,B.useRef)(t);i.current=t;let a=(0,B.useRef)(n);a.current=n;let[o,s]=(0,B.useState)(!1);return(0,B.useEffect)(()=>{let e=AN(`/events`,{path:sP,transports:[`websocket`],autoConnect:!1,retries:0}),t=Ff(()=>r.invalidateQueries({queryKey:LB},{cancelRefetch:!1})),n=Ff(()=>Promise.all([r.invalidateQueries({queryKey:LB},{cancelRefetch:!1}),r.invalidateQueries({queryKey:RB},{cancelRefetch:!1}),r.invalidateQueries({queryKey:[`terminal-preset-definitions`]},{cancelRefetch:!1}),r.invalidateQueries({queryKey:[`tree-context-fields`]},{cancelRefetch:!1}),r.invalidateQueries({queryKey:[`web-panel-definitions`]},{cancelRefetch:!1})]).then(()=>void 0)),o=()=>{t.schedule(),Promise.all([r.invalidateQueries({queryKey:[`worktree-creations`]}),r.invalidateQueries({queryKey:[`worktree-removals`]})])},c=()=>n.schedule(),l=e=>{let t=GP(e);if(!t){s(!0);return}LF.replaceRuntimeMetadata(t.terminalMetadata),s(!1),o()},u=e=>{let t=KP(e);if(t){if(t.type===`terminal.metadata`){LF.applyRuntimeMetadata({terminalId:t.data.terminalId,title:t.data.title,program:t.data.program,hasForegroundProcess:t.data.hasForegroundProcess,progress:t.data.progress,progressStartedAt:t.data.progressStartedAt,progressClearedAt:t.data.progressClearedAt,bell:t.data.bell});return}if(t.type===`panel.open_requested`){o(),i.current?.(t.data);return}if(t.type===`workspace.open_requested`){o(),a.current?.(t.data);return}if(t.type===`project.updated`){c();return}if(t.type===`project.removed`){c();return}t.type!==`terminal.controller_changed`&&o()}},d=()=>s(!0);return e.on(`snapshot`,l),e.on(`product_event`,u),e.on(`disconnect`,d),e.on(`connect_error`,d),e.connect(),()=>{t.dispose(),n.dispose(),e.disconnect()}},[r]),(0,B.useEffect)(()=>{e&&LF.reconcile(e.flatMap(e=>e.worktrees.flatMap(e=>e.terminals)))},[e]),o}var uq=Zv({error:Zv({message:q()})}),dq=`treeport-tool-pane-open:`;function fq(){return(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(aH,{children:(0,V.jsx)(pq,{})}),(0,V.jsx)(tC,{})]})}function pq(){let{dismiss:e,setOpen:t}=sf(),{focusedSurfaceRef:n,focusSurface:r,restoreEmptyToolFocus:i}=uf(),a=window.treeportDesktop,o=XB(),s=qe(),c=xa(),l=lt(BB),u=l.data??[],d=lt(HB),f=d.data??[],p=localStorage.getItem(ZF),m=l.data?_I(u,c.pathname,p):null,h=m?.selection.project??null,g=m?.selection.worktree??null,_=m?.selection.terminal??g?.terminals.find(e=>e.id===localStorage.getItem(`treeport-last-project-terminal:${h?.id}`))??g?.terminals[0]??null,v=_?.id??null,y=m?.selection.panel??null,b=h,{isMobile:x,openMobile:S,setOpenMobile:C,closeMobileWithoutFocusRestore:w}=TV(),T=iH(),E=T.open,[D,O]=(0,B.useState)(null),[k,A]=(0,B.useState)(!1),[j,M]=(0,B.useState)(!1),N=D!==null||E||x&&S,[P,ee]=(0,B.useState)(()=>new Set),[F,I]=(0,B.useState)({}),te=(0,B.useCallback)((e,t)=>{I(n=>n[e]===t?n:{...n,[e]:t}),localStorage.setItem(`${dq}${e}`,String(t))},[]),L=g?F[g.id]??localStorage.getItem(`${dq}${g.id}`)===`true`:!1,[ne,R]=(0,B.useState)({}),[re,z]=(0,B.useState)(null),ie=(0,B.useMemo)(()=>g?.panels.filter(e=>e.kind!==`terminal`)??[],[g]),ae=ie.find(e=>e.id===ne[g?.id??``]),oe=y??ae??(L?ie.at(-1):null)??null,se=oe?.id??null,ce=(0,B.useCallback)(e=>{ee(t=>{if(t.has(e))return t;let n=new Set(t);return n.add(e),n})},[]),le=(0,B.useCallback)((e,t)=>{ce(e.id),R(t=>({...t,[e.worktreeId]:e.id})),te(e.worktreeId,!0),z(t?e.id:null)},[ce,te]),[ue,de]=(0,B.useState)({}),[fe,pe]=(0,B.useState)({}),[me,he]=(0,B.useState)(()=>new Set),ge=(0,B.useCallback)((e,t)=>{he(n=>{if(n.has(e)===t)return n;let r=new Set(n);return t?r.add(e):r.delete(e),r})},[]),[_e,ve]=(0,B.useState)({}),ye=(0,B.useCallback)((e,t)=>{ve(n=>{if(!!n[e]===t)return n;let r={...n};return t?r[e]=!0:delete r[e],r})},[]),be=(0,B.useCallback)((e,t)=>{pe(n=>{if(t===null){if(n[e]===void 0)return n;let t={...n};return delete t[e],t}return n[e]===t?n:{...n,[e]:t}})},[]);(0,B.useEffect)(()=>{let e=u.flatMap(e=>e.worktrees.flatMap(e=>e.panels)),t=new Set(e.map(e=>e.id)),n=new Set(e.filter(e=>e.kind===`web`).map(e=>e.id));pe(e=>{let t=Object.keys(e).filter(e=>!n.has(e));if(t.length===0)return e;let r={...e};return t.forEach(e=>delete r[e]),r}),ve(e=>{let n=Object.keys(e).filter(e=>!t.has(e));if(n.length===0)return e;let r={...e};return n.forEach(e=>delete r[e]),r}),he(e=>{let t=new Set([...e].filter(e=>n.has(e)));return t.size===e.size?e:t})},[u]);let xe=D?.type===`panel`?u.find(e=>e.id===D.projectId)??null:null,Se=D?.type===`panel`&&D.worktreeId?xe?.worktrees.find(e=>e.id===D.worktreeId)??null:null,Ce=Se??(L?g:null),we=lt(WB(D?.type===`worktree`?{projectId:D.project.id}:Se?{worktreeId:Se.id}:g?{worktreeId:g.id}:h?{projectId:h.id}:void 0)),Te=lt(UB(D?.type===`worktree`?D.project.id:null)),Ee=we.data?.definitions??[],De=we.data?.diagnostics??[],Oe=lt({queryKey:[`web-panel-definitions`,Ce?.id],queryFn:async()=>(await Ef(NN.api.worktrees[`:worktreeId`][`web-panel-definitions`].$get({param:{worktreeId:Ce.id}}))).definitions,enabled:!!Ce}),ke=dt({mutationFn:({worktree:e,definition:t,input:n})=>(async()=>{if(t.permissions.length>0&&!t.permissionsGranted){let n=await fetch(`/api/worktrees/${encodeURIComponent(e.id)}/web-panel-definitions/${encodeURIComponent(t.id)}/permission-grant`,{method:`PUT`,headers:{"content-type":`application/json`},body:JSON.stringify({granted:!0,permissions:t.permissions})});if(!n.ok){let e=uq.safeParse(await n.json().catch(()=>null));throw Error(e.success?e.data.error.message:`Could not grant web panel permission`)}}return(await Ef(NN.api.worktrees[`:worktreeId`].panels.open.$post({param:{worktreeId:e.id},json:{definitionId:t.id,input:n,launchCwd:null}}))).panel})(),onSuccess:async(e,{worktree:t})=>{O(null),le(e,!1),s.setQueryData(BB.queryKey,n=>n?.map(n=>n.id===t.projectId?{...n,worktrees:n.worktrees.map(n=>n.id!==t.id||n.panels.some(t=>t.id===e.id)?n:{...n,panels:[...n.panels,e]})}:n));let n=lI(s.getQueryData(BB.queryKey)??u,e),r=n?o(n):Promise.resolve();s.invalidateQueries({queryKey:BB.queryKey}),await r},onError:(e,{worktree:t,definition:n})=>{vI(e,{operation:`create web panel “${n.title}” in tree “${t.name}”`})}}),Ae=dt({mutationFn:({worktree:e})=>Ef(NN.api.worktrees[`:worktreeId`][`browser-panels`].$post({param:{worktreeId:e.id},json:{}})),onSuccess:async({panel:e},{worktree:t})=>{O(null),le(e,!1),s.setQueryData(BB.queryKey,n=>n?.map(n=>n.id===t.projectId?{...n,worktrees:n.worktrees.map(n=>n.id!==t.id||n.panels.some(t=>t.id===e.id)?n:{...n,panels:[...n.panels,e]})}:n));let n=lI(s.getQueryData(BB.queryKey)??u,e),r=n?o(n):Promise.resolve();s.invalidateQueries({queryKey:BB.queryKey}),await r},onError:(e,{worktree:t})=>{vI(e,{operation:`create Browser in tree “${t.name}”`})}}),je=dt({mutationFn:({panel:e,discardStoredData:t=!1,force:n=!1})=>{let r={};return t&&(r.discardStoredData=`true`),n&&(r.force=`true`),Ef(NN.api.panels[`:panelId`].$delete({param:{panelId:e.id},query:r}))},onSuccess:async(e,{panel:t})=>{be(t.id,null),ge(t.id,!1),z(e=>e===t.id?null:e),ee(e=>{if(!e.has(t.id))return e;let n=new Set(e);return n.delete(t.id),n}),O(e=>e?.type===`close-panel`&&e.panel.id===t.id?null:e);let n=u.flatMap(e=>e.worktrees).find(e=>e.id===t.worktreeId),r=n?.panels.filter(e=>e.kind!==`terminal`)??[],a=r.findIndex(e=>e.id===t.id),c=r.filter(e=>e.id!==t.id),l=c[a]??c[a-1]??null;if(R(e=>e[t.worktreeId]===t.id?{...e,[t.worktreeId]:l?.id??null}:e),s.setQueryData(BB.queryKey,e=>e?.map(e=>({...e,worktrees:e.worktrees.map(e=>e.id===t.worktreeId?{...e,panels:e.panels.filter(e=>e.id!==t.id)}:e)}))),y?.id===t.id){let e=n?dI(u,n,v):null;e&&await o(e,!0)}l||i(),s.invalidateQueries({queryKey:BB.queryKey})},onError:(e,{panel:t,trigger:n})=>{if(t.kind===`browser`&&HN(e).code===`BROWSER_BEFORE_UNLOAD`){ze({type:`close-panel`,panel:t,reason:`browser-before-unload`},n);return}vI(e,{operation:`close panel “${t.title}”`})}}),Me=(e,t)=>{if(e.kind===`browser`){je.mutate(t?{panel:e,trigger:t}:{panel:e});return}if(me.has(e.id)){ze({type:`close-panel`,panel:e,reason:`unsaved-changes`},t);return}Ef(NN.api.panels[`:panelId`].storage.$get({param:{panelId:e.id}})).then(({hasData:n})=>{n?ze({type:`close-panel`,panel:e,reason:`stored-data`},t):je.mutate({panel:e})},t=>{vI(t,{operation:`check stored data for web panel “${e.title}”`})})},Ne=(0,B.useCallback)(e=>{if(!eI(e.sourceTerminalId,e.sourcePanelId,v,se))return;le(e.panel,e.sourceTerminalId!==null&&e.sourceTerminalId===v),de(t=>({...t,[e.panelId]:(t[e.panelId]??0)+1})),s.setQueryData(BB.queryKey,t=>t?.map(t=>({...t,worktrees:t.worktrees.map(t=>t.id===e.worktreeId?{...t,panels:t.panels.some(t=>t.id===e.panelId)?t.panels.map(t=>t.id===e.panelId?e.panel:t):[...t.panels,e.panel]}:t)})));let t=lI(s.getQueryData(BB.queryKey)??[],e.panel);(t?o(t):s.invalidateQueries({queryKey:BB.queryKey}).then(async()=>{let t=lI(s.getQueryData(BB.queryKey)??[],e.panel);t&&await o(t)})).catch(e=>{vI(e,{operation:`open panel`})})},[se,o,s,le,v]),Pe=(0,B.useCallback)(e=>{$F(e.sourceTerminalId,v)&&s.invalidateQueries({queryKey:BB.queryKey}).then(async()=>{let t=s.getQueryData(BB.queryKey)??[],n=t.flatMap(e=>e.worktrees).find(t=>t.id===e.worktreeId),r=n?dI(t,n):null;r&&await o(r)}).catch(e=>{vI(e,{operation:`open workspace`})})},[o,s,v]),Fe=lq(l.data,Ne,Pe),[Ie,Le]=(0,B.useState)(!1),Re=(0,B.useRef)(null),ze=(e,t)=>{Re.current=t??document.activeElement,O(e)};(0,B.useEffect)(()=>{!m?.canonical||!y||(ce(y.id),R(e=>e[y.worktreeId]===y.id?e:{...e,[y.worktreeId]:y.id}),te(y.worktreeId,!0))},[ce,y,te,m?.canonical]),(0,B.useEffect)(()=>{!m||m.canonical||o(m.target,!0)},[o,m?.canonical,m?.target.pathname]),(0,B.useEffect)(()=>{m?.canonical&&(m.target.kind===`root`?localStorage.removeItem(ZF):localStorage.setItem(ZF,m.target.pathname),m.target.kind===`terminal`&&localStorage.setItem(`${QF}${m.target.projectId}`,m.target.terminalId))},[m?.canonical,m?.target.pathname]),(0,B.useEffect)(()=>{if(!(l.data!==void 0&&(Fe||l.isRefetchError))){Le(!1);return}let e=window.setTimeout(()=>Le(!0),Mf);return()=>window.clearTimeout(e)},[Fe,l.data,l.isRefetchError]);let Be=(0,B.useMemo)(()=>b?.worktrees.flatMap(e=>e.terminals)??[],[b]),Ve=(0,B.useMemo)(()=>u.flatMap(e=>e.worktrees).flatMap(e=>e.panels).filter(e=>e.kind!==`terminal`&&(P.has(e.id)||e.id===se)),[se,u,P]),He=(0,B.useCallback)(e=>{let t=uI(u,e);t&&o(t),w()},[w,o,u]),Ue=e=>{r(`terminal`);let t=dI(u,e,v);t&&o(t),w()},We=e=>sI(e,localStorage.getItem(`${QF}${e.id}`)),Ge=e=>{r(`terminal`);let t=We(e);T.dismissedIntoTerminalRef.current=!x&&t.kind===`terminal`,o(t,!1,!x),T.setOpen(!1),w()},{closingProjectId:Ke,requestProjectClose:Je,projectOpened:Ye}=ZB({projects:u,selectedProject:h,targetForProject:We,projectSwitcherTriggerRef:T.triggerRef,closeProjectUi:()=>T.setOpen(!1),openedProjectUi:()=>{T.setOpen(!1),w(),O(null)}}),Xe=e=>{r(`terminal`);let t=We(e);return T.dismissedIntoTerminalRef.current=!x&&t.kind===`terminal`,Ye(e,!x)},{pendingWorktrees:Ze,pendingRemovals:Qe,submitWorktreeCreation:$e,prepareRemoval:et,confirmRemoval:tt}=cq({projects:u,setDrawerOpen:e=>{e?C(!0):w()},onWorktreeSubmitted:()=>O(null),onRemovalNeedsConfirmation:(e,t,n)=>ze({type:`remove`,worktree:e,preview:t},n),onRemovalCompleted:e=>O(t=>t?.type===`remove`&&t.worktree.id===e?null:t),selectedTerminalId:v}),nt=tq({projects:u,selectedWorktree:g,selectedTerminal:_}),rt=(0,B.useCallback)(e=>{r(`terminal`),A(!1),M(!1),nt.clearPendingTerminalSelection(),He(e)},[r,He,nt.clearPendingTerminalSelection]),it=(0,B.useCallback)(e=>{nt.clearPendingTerminalSelection(),r(`tool`),le(e,!1);let t=lI(u,e);t&&o(t),w()},[w,r,o,u,le,nt.clearPendingTerminalSelection]),at=(0,B.useCallback)(e=>{if(N||!g)return!1;let t=g.terminals[e];if(t)return rt(t),!0;let n=nt.pendingTerminals.filter(e=>e.worktreeId===g.id)[e-g.terminals.length];return n?(r(`terminal`),nt.selectPendingTerminal(n.id),!0):!1},[r,g,rt,nt.pendingTerminals,nt.selectPendingTerminal,N]),ot=(0,B.useCallback)(e=>{if(N||!g)return!1;if(L&&!nt.selectedPendingTerminal&&n.current===`tool`){let t=ie[e];return t?(it(t),!0):!1}return at(e)},[g,it,ie,at,nt.selectedPendingTerminal,L,N]);(0,B.useEffect)(()=>{let e=e=>{if(!e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)return;let t=Number(e.key)-1;!Number.isInteger(t)||t<0||t>8||ot(t)&&(e.preventDefault(),e.stopPropagation())};return document.addEventListener(`keydown`,e,!0),()=>document.removeEventListener(`keydown`,e,!0)},[ot]);let st=!xe||!Se||xe.availability.state===`unavailable`||!!Se.prunable||!!Qe[Se.id],ct=!h||!g||h.availability.state===`unavailable`||!!g.prunable||!!Qe[g.id],ut=(0,B.useCallback)(()=>{if(!g)return;if(L){te(g.id,!1),r(`terminal`);return}let e=oe??ie.at(-1)??null;e&&(ce(e.id),R(t=>({...t,[e.worktreeId]:e.id}))),te(g.id,!0)},[oe,r,ce,g,ie,te,L]),ft=(0,B.useCallback)(()=>{r(`tool`),z(null)},[r]);return(0,B.useEffect)(()=>{if(a)return;let e=/Mac|iPhone|iPad|iPod/.test(navigator.platform),t=t=>{let n=e?t.metaKey&&!t.ctrlKey:t.ctrlKey&&!t.metaKey;t.isComposing||t.key.toLocaleLowerCase()!==`b`||!t.altKey||t.shiftKey||!n||N||!g||(t.preventDefault(),t.stopPropagation(),ut())};return document.addEventListener(`keydown`,t,!0),()=>document.removeEventListener(`keydown`,t,!0)},[a,g,ut,N]),(0,B.useEffect)(()=>{if(a)return a.onCommand(e=>{if(N)return;if(e===`new-worktree`){b?.kind===`repository`&&b.availability.state!==`unavailable`&&ze({type:`worktree`,project:b});return}if(!h||!g)return;let r=L&&n.current===`tool`,i=e.startsWith(`select-tab-`)?Number(e.at(-1))-1:null;i===null?e===`toggle-side-panel`?ut():e===`new-terminal`?r?ie.length>0&&t(!0):nt.createTerminalInWorktree(h,g,{name:`Shell`}):e===`new-panel`?ze({type:`panel`,projectId:h.id,worktreeId:g.id}):e===`close-panel`&&(r&&oe?Me(oe):!nt.selectedPendingTerminal&&_&&nt.requestCloseTerminal(_)):ot(i)})},[b,oe,h,_,g,ie.length,ot,t,nt.selectedPendingTerminal,ut,L,N]),(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(SI,{projects:u,selectedTerminalId:v}),(0,V.jsx)(cH,{blocked:D!==null}),(0,V.jsx)(fH,{selectedTerminalId:nt.selectedPendingTerminal?null:v,terminals:Be,onSelectTerminal:rt,updateControl:(0,V.jsx)(LG,{}),notificationCenter:(0,V.jsx)(bI,{projects:u,navigateToWorkspace:o,open:j,onOpenChange:M})}),(0,V.jsx)(dH,{updateControl:(0,V.jsx)(LG,{}),notificationCenter:(0,V.jsx)(bI,{projects:u,navigateToWorkspace:o,open:k,onOpenChange:A}),projectSwitcher:(0,V.jsx)(lH,{projects:u,activeProject:b,closingProjectId:Ke,onSelectProject:Ge,onProjectOpened:Xe,onRequestProjectClose:Je,onOpenProjectDialog:e=>ze({type:`project`},e)}),children:(0,V.jsx)(lG,{projects:u,projectsPending:l.isPending,projectsError:l.isError,projectsLoaded:l.data!==void 0,activeProject:b,selectedWorktree:g,selectedTerminalId:nt.selectedPendingTerminal?null:v,selectedPendingTerminalId:nt.selectedPendingTerminal?.id??null,pendingTerminals:nt.pendingTerminals,pendingWorktrees:Ze,pendingRemovals:Qe,onRetryProjects:()=>void l.refetch(),onSelectTerminal:rt,onSelectPendingTerminal:e=>{r(`terminal`),nt.selectPendingTerminal(e)},onCloseTerminal:nt.requestCloseTerminal,onSelectWorktree:Ue,onPrepareRemoval:et,onOpenPanelDialog:(e,t,n)=>ze({type:`panel`,projectId:e.id,worktreeId:t?.id??null},n),onOpenWorktreeDialog:(e,t)=>ze({type:`worktree`,project:e},t)})}),(0,V.jsx)(oH,{children:(0,V.jsxs)(`div`,{className:`relative grid min-h-0 min-w-0 grid-rows-[minmax(0,1fr)]`,children:[(0,V.jsx)(WK,{open:L,disabled:!h||!g,onToggle:ut}),(0,V.jsxs)(`div`,{className:W(`relative grid min-h-0 min-w-0 grid-cols-1`,L&&`min-[701px]:grid-cols-[minmax(0,1fr)_auto]`),children:[(0,V.jsx)(`div`,{className:W(`relative grid min-h-0 min-w-0 grid-rows-[minmax(0,1fr)]`,L&&`max-[700px]:hidden`),role:`group`,"aria-label":`Terminal tab group`,onPointerDownCapture:()=>{e(),r(`terminal`)},onFocusCapture:()=>{e(),r(`terminal`)},children:(0,V.jsx)(nq,{selectedWorktree:g,selectedTerminal:_,selectedPendingTerminal:nt.selectedPendingTerminal,pendingTerminals:nt.pendingTerminals,loading:l.isPending,dialogOpen:D!==null})}),g?(0,V.jsx)(QK,{worktreeName:g.name,visible:L,tools:ie,activePanelId:se,webPanelRuntimeTitles:fe,browserPanelLoading:_e,definitions:Oe.data??[],definitionsLoading:L&&Oe.isPending,definitionsError:Oe.isError,launchDisabled:ct||ke.isPending||Ae.isPending,onSelectPanel:it,onClosePanel:Me,onCreateBrowserPanel:()=>Ae.mutate({worktree:g}),onOpenWebPanel:e=>ke.mutate({worktree:g,definition:e,input:null}),onFocusSurface:ft,children:Ve.map(e=>{let t=e.id===se&&L,n=N||re===e.id;return e.kind===`browser`?(0,V.jsx)(EL,{panel:e,active:t,autoFocusBlocked:n,inputBlocked:N,onLoadingChange:ye,onFocusSurface:ft},e.id):(0,V.jsx)(CB,{panel:e,active:t,title:fe[e.id]??e.title,reloadRevision:ue[e.id]??0,autoFocusBlocked:n,onTitleChange:be,onDirtyChange:ge,onSelectWorkspace:at,onFocusSurface:ft},e.id)})}):null]})]})}),Ie?(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:x&&S?!0:void 0,"aria-hidden":x&&S?!0:void 0,children:(0,V.jsx)(`span`,{children:`Updates paused; showing the last known project state.`})}):null,(0,V.jsx)(IB,{open:D?.type===`project`,onOpenChange:e=>!e&&O(null),restoreFocusTo:Re.current,onOpened:Ye}),(0,V.jsx)(oq,{project:D?.type===`worktree`?D.project:null,onOpenChange:e=>!e&&O(null),restoreFocusTo:Re.current,presets:Ee,presetDiagnostics:De,presetsLoading:we.isPending,presetsError:we.isError,onRetryPresets:()=>void we.refetch(),contextFields:Te.data?.fields??[],contextFieldDiagnostics:Te.data?.diagnostics??[],contextFieldsLoading:Te.isPending,contextFieldsError:Te.isError,onRetryContextFields:()=>void Te.refetch(),onSubmit:$e}),(0,V.jsx)(VG,{open:D?.type===`panel`,onOpenChange:e=>!e&&O(null),restoreFocusTo:Re.current,worktreeName:Se?.name??null,presets:Ee,presetDiagnostics:De,presetsLoading:we.isPending,presetsError:we.isError,webPanelDefinitions:Oe.data??[],webPanelDefinitionsLoading:!!Se&&Oe.isPending,webPanelDefinitionsError:Oe.isError,launchDisabled:st||ke.isPending||Ae.isPending,onCreateTerminal:e=>{!xe||!Se||(O(null),nt.createTerminalInWorktree(xe,Se,e))},onCreateBrowserPanel:()=>{Se&&Ae.mutate({worktree:Se})},onCreateWebPanel:e=>{Se&&ke.mutate({worktree:Se,definition:e,input:null})},onManagePresets:()=>O({type:`presets`})}),(0,V.jsx)(jG,{open:D?.type===`presets`,onOpenChange:e=>!e&&O(null),restoreFocusTo:Re.current,presets:f,loading:d.isPending,loadError:d.isError,onRetry:()=>void d.refetch()}),(0,V.jsx)(_B,{panel:D?.type===`close-panel`?D.panel:null,reason:D?.type===`close-panel`?D.reason:null,busy:je.isPending,onOpenChange:e=>!e&&O(null),restoreFocusTo:Re.current,onConfirm:e=>{je.mutate(e.kind===`browser`?{panel:e,force:!0}:{panel:e,discardStoredData:!0})}}),(0,V.jsx)(sq,{worktree:D?.type===`remove`?D.worktree:null,preview:D?.type===`remove`?D.preview:null,busy:D?.type===`remove`&&Qe[D.worktree.id]!==void 0,onOpenChange:e=>!e&&O(null),restoreFocusTo:Re.current,onConfirm:tt})]})}function mq({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)(X,{type:`button`,onClick:e,children:`Try again`}),(0,V.jsx)(X,{type:`button`,variant:`secondary`,onClick:()=>window.location.reload(),children:`Reload Treeport`})]})]})})}var hq=ta({component:fq,errorComponent:mq,onCatch:e=>console.error(`Unexpected application crash`,e)}),gq=$i({getParentRoute:()=>hq,path:`/`}),_q=$i({getParentRoute:()=>hq,path:`projects/$projectId`}),vq=$i({getParentRoute:()=>_q,path:`worktrees/$worktreeId`}),yq=$i({getParentRoute:()=>vq,path:`terminals/$terminalId`}),bq=$i({getParentRoute:()=>vq,path:`panels/$panelId`}),xq=_a({routeTree:hq.addChildren([gq,_q.addChildren([vq.addChildren([yq,bq])])]),defaultPreload:!1,scrollRestoration:!1}),Sq=new Ue({defaultOptions:{queries:{retry:Nf,retryDelay:Pf,refetchOnReconnect:!0},mutations:{retry:!1}}});function Cq(){return(0,V.jsx)(Je,{client:Sq,children:(0,V.jsx)(ef,{children:(0,V.jsx)(qB,{children:(0,V.jsx)(lf,{children:(0,V.jsxs)(of,{children:[(0,V.jsx)(ba,{router:xq}),(0,V.jsx)($a,{})]})})})})})}var wq=/iPad|iPhone|iPod/.test(navigator.userAgent)||navigator.platform===`MacIntel`&&navigator.maxTouchPoints>1,Tq=document.querySelector(`meta[name="viewport"]`);wq&&Tq&&!Tq.content.includes(`maximum-scale`)&&(Tq.content=`${Tq.content}, maximum-scale=1`),(0,Sa.createRoot)(document.getElementById(`root`)).render((0,V.jsx)(B.StrictMode,{children:(0,V.jsx)(Cq,{})}));
|