opencode-webui 2.3.0 → 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +68 -1
- package/dist/assets/TerminalView-46ee1Rko.js +18 -0
- package/dist/assets/TerminalView-BrP-ENHg.css +1 -0
- package/dist/assets/client-DkhM26jE.js +2 -0
- package/dist/assets/index-BpbA074E.css +2 -0
- package/dist/assets/index-NnlYGssZ.js +113 -0
- package/dist/assets/report-D38Le2zy.js +2 -0
- package/dist/icons/apple-touch-icon.png +0 -0
- package/dist/icons/badge-96.png +0 -0
- package/dist/icons/icon-192.png +0 -0
- package/dist/icons/icon-512.png +0 -0
- package/dist/icons/maskable-512.png +0 -0
- package/dist/index.html +10 -3
- package/dist/manifest.webmanifest +1 -0
- package/dist/sw.js +143 -0
- package/package.json +4 -1
- package/server/auth.ts +39 -22
- package/server/config.ts +498 -0
- package/server/index.ts +500 -36
- package/server/lifecyclePlugin.ts +118 -0
- package/server/setup.ts +774 -0
- package/server/userExtensions.ts +198 -5
- package/skills/webui/SKILL.md +35 -12
- package/webui-extensions/README.md +245 -15
- package/dist/assets/index-CGOluhS1.js +0 -128
- package/dist/assets/index-Cn0VQKKh.css +0 -1
- package/dist/assets/report-BVuI-XUQ.js +0 -2
|
@@ -1,128 +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,o)=>(o=n==null?{}:e(i(n)),c(r||!n||!n.__esModule||!a.call(n,`default`)?t(o,`default`,{value:n,enumerable:!0}):o,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),t.credentials=e.crossOrigin===`use-credentials`?`include`:e.crossOrigin===`anonymous`?`omit`:`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var u=o((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.portal`),r=Symbol.for(`react.fragment`),i=Symbol.for(`react.strict_mode`),a=Symbol.for(`react.profiler`),o=Symbol.for(`react.consumer`),s=Symbol.for(`react.context`),c=Symbol.for(`react.forward_ref`),l=Symbol.for(`react.suspense`),u=Symbol.for(`react.memo`),d=Symbol.for(`react.lazy`),f=Symbol.for(`react.activity`),p=Symbol.iterator;function m(e){return typeof e!=`object`||!e?null:(e=p&&e[p]||e[`@@iterator`],typeof e==`function`?e:null)}var h={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},g=Object.assign,_={};function v(e,t,n){this.props=e,this.context=t,this.refs=_,this.updater=n||h}v.prototype.isReactComponent={},v.prototype.setState=function(e,t){if(typeof e!=`object`&&typeof e!=`function`&&e!=null)throw Error(`takes an object of state variables to update or a function which returns an object of state variables.`);this.updater.enqueueSetState(this,e,t,`setState`)},v.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,`forceUpdate`)};function y(){}y.prototype=v.prototype;function b(e,t,n){this.props=e,this.context=t,this.refs=_,this.updater=n||h}var x=b.prototype=new y;x.constructor=b,g(x,v.prototype),x.isPureReactComponent=!0;var S=Array.isArray;function C(){}var w={H:null,A:null,T:null,S:null},T=Object.prototype.hasOwnProperty;function E(e,n,r){var i=r.ref;return{$$typeof:t,type:e,key:n,ref:i===void 0?null:i,props:r}}function D(e,t){return E(e.type,t,e.props)}function O(e){return typeof e==`object`&&!!e&&e.$$typeof===t}function k(e){var t={"=":`=0`,":":`=2`};return`$`+e.replace(/[=:]/g,function(e){return t[e]})}var ee=/\/+/g;function A(e,t){return typeof e==`object`&&e&&e.key!=null?k(``+e.key):t.toString(36)}function j(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 M(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,M(c(e._payload),r,i,a,o)}}if(c)return o=o(e),c=a===``?`.`+A(e,0):a,S(o)?(i=``,c!=null&&(i=c.replace(ee,`$&/`)+`/`),M(o,r,i,``,function(e){return e})):o!=null&&(O(o)&&(o=D(o,i+(o.key==null||e&&e.key===o.key?``:(``+o.key).replace(ee,`$&/`)+`/`)+c)),r.push(o)),1;c=0;var l=a===``?`.`:a+`:`;if(S(e))for(var u=0;u<e.length;u++)a=e[u],s=l+A(a,u),c+=M(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+A(a,u++),c+=M(a,r,i,s,o);else if(s===`object`){if(typeof e.then==`function`)return M(j(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 te(e,t,n){if(e==null)return e;var r=[],i=0;return M(e,r,``,``,function(e){return t.call(n,e,i++)}),r}function ne(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 N=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)},P={map:te,forEach:function(e,t,n){te(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return te(e,function(){t++}),t},toArray:function(e){return te(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=P,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:ne}},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,N)}catch(e){N(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.8`})),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&&A(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&&A(x,u.startTime-t),i=!1}}break a}finally{d=null,f=a,p=!1}}}finally{i?O():S=!1}}}var O;if(typeof y==`function`)O=function(){y(D)};else if(typeof MessageChannel<`u`){var k=new MessageChannel,ee=k.port2;k.port1.onmessage=D,O=function(){ee.postMessage(null)}}else O=function(){_(D,0)};function A(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,A(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.8`})),h=o(((e,t)=>{function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>`u`||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!=`function`))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}n(),t.exports=m()})),g=o((e=>{var t=p(),n=d(),r=h();function i(e){var t=`https://react.dev/errors/`+e;if(1<arguments.length){t+=`?args[]=`+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+=`&args[]=`+encodeURIComponent(arguments[n])}return`Minified React error #`+e+`; visit `+t+` for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`}function a(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function o(e){var t=e,n=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,t.flags&4098&&(n=t.return),e=t.return;while(e)}return t.tag===3?n:null}function s(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function c(e){if(e.tag===31){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function l(e){if(o(e)!==e)throw Error(i(188))}function u(e){var t=e.alternate;if(!t){if(t=o(e),t===null)throw Error(i(188));return t===e?e:null}for(var n=e,r=t;;){var a=n.return;if(a===null)break;var s=a.alternate;if(s===null){if(r=a.return,r!==null){n=r;continue}break}if(a.child===s.child){for(s=a.child;s;){if(s===n)return l(a),e;if(s===r)return l(a),t;s=s.sibling}throw Error(i(188))}if(n.return!==r.return)n=a,r=s;else{for(var c=!1,u=a.child;u;){if(u===n){c=!0,n=a,r=s;break}if(u===r){c=!0,r=a,n=s;break}u=u.sibling}if(!c){for(u=s.child;u;){if(u===n){c=!0,n=s,r=a;break}if(u===r){c=!0,r=s,n=a;break}u=u.sibling}if(!c)throw Error(i(189))}}if(n.alternate!==r)throw Error(i(190))}if(n.tag!==3)throw Error(i(188));return n.stateNode.current===n?e:t}function f(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=f(e),t!==null)return t;e=e.sibling}return null}var m=Object.assign,g=Symbol.for(`react.element`),_=Symbol.for(`react.transitional.element`),v=Symbol.for(`react.portal`),y=Symbol.for(`react.fragment`),b=Symbol.for(`react.strict_mode`),x=Symbol.for(`react.profiler`),S=Symbol.for(`react.consumer`),C=Symbol.for(`react.context`),w=Symbol.for(`react.forward_ref`),T=Symbol.for(`react.suspense`),E=Symbol.for(`react.suspense_list`),D=Symbol.for(`react.memo`),O=Symbol.for(`react.lazy`),k=Symbol.for(`react.activity`),ee=Symbol.for(`react.memo_cache_sentinel`),A=Symbol.iterator;function j(e){return typeof e!=`object`||!e?null:(e=A&&e[A]||e[`@@iterator`],typeof e==`function`?e:null)}var M=Symbol.for(`react.client.reference`);function te(e){if(e==null)return null;if(typeof e==`function`)return e.$$typeof===M?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?te(e.type)||`Memo`:t;case O:t=e._payload,e=e._init;try{return te(e(t))}catch{}}return null}var ne=Array.isArray,N=n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,P=r.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,re={pending:!1,data:null,method:null,action:null},ie=[],ae=-1;function F(e){return{current:e}}function I(e){0>ae||(e.current=ie[ae],ie[ae]=null,ae--)}function oe(e,t){ae++,ie[ae]=e.current,e.current=t}var se=F(null),ce=F(null),le=F(null),ue=F(null);function de(e,t){switch(oe(le,t),oe(ce,e),oe(se,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?$d(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=$d(t),e=ef(t,e);else switch(e){case`svg`:e=1;break;case`math`:e=2;break;default:e=0}}I(se),oe(se,e)}function fe(){I(se),I(ce),I(le)}function pe(e){e.memoizedState!==null&&oe(ue,e);var t=se.current,n=ef(t,e.type);t!==n&&(oe(ce,e),oe(se,n))}function me(e){ce.current===e&&(I(se),I(ce)),ue.current===e&&(I(ue),up._currentValue=re)}var he,ge;function _e(e){if(he===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);he=t&&t[1]||``,ge=-1<e.stack.indexOf(`
|
|
2
|
-
at`)?` (<anonymous>)`:-1<e.stack.indexOf(`@`)?`@unknown:0:0`:``}return`
|
|
3
|
-
`+he+e+ge}var ve=!1;function ye(e,t){if(!e||ve)return``;ve=!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{ve=!1,Error.prepareStackTrace=n}return(n=e?e.displayName||e.name:``)?_e(n):``}function be(e,t){switch(e.tag){case 26:case 27:case 5:return _e(e.type);case 16:return _e(`Lazy`);case 13:return e.child!==t&&t!==null?_e(`Suspense Fallback`):_e(`Suspense`);case 19:return _e(`SuspenseList`);case 0:case 15:return ye(e.type,!1);case 11:return ye(e.type.render,!1);case 1:return ye(e.type,!0);case 31:return _e(`Activity`);default:return``}}function xe(e){try{var t=``,n=null;do t+=be(e,n),n=e,e=e.return;while(e);return t}catch(e){return`
|
|
7
|
-
Error generating stack: `+e.message+`
|
|
8
|
-
`+e.stack}}var Se=Object.prototype.hasOwnProperty,Ce=t.unstable_scheduleCallback,we=t.unstable_cancelCallback,Te=t.unstable_shouldYield,Ee=t.unstable_requestPaint,De=t.unstable_now,Oe=t.unstable_getCurrentPriorityLevel,ke=t.unstable_ImmediatePriority,Ae=t.unstable_UserBlockingPriority,je=t.unstable_NormalPriority,Me=t.unstable_LowPriority,Ne=t.unstable_IdlePriority,Pe=t.log,Fe=t.unstable_setDisableYieldValue,Ie=null,Le=null;function Re(e){if(typeof Pe==`function`&&Fe(e),Le&&typeof Le.setStrictMode==`function`)try{Le.setStrictMode(Ie,e)}catch{}}var ze=Math.clz32?Math.clz32:He,Be=Math.log,Ve=Math.LN2;function He(e){return e>>>=0,e===0?32:31-(Be(e)/Ve|0)|0}var Ue=256,We=262144,Ge=4194304;function Ke(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 qe(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=Ke(n))):i=Ke(o):i=Ke(s)):(r=s&~a,r===0?(o&=s,o===0?n||(n=s&~e,n!==0&&(i=Ke(n))):i=Ke(o)):i=Ke(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 Je(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function Ye(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 Xe(){var e=Ge;return Ge<<=1,!(Ge&62914560)&&(Ge=4194304),e}function Ze(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 $e(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-ze(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&&et(e,r,0),a!==0&&i===0&&e.tag!==0&&(e.suspendedLanes|=a&~(o&~t))}function et(e,t,n){e.pendingLanes|=t,e.suspendedLanes&=~t;var r=31-ze(t);e.entangledLanes|=t,e.entanglements[r]=e.entanglements[r]|1073741824|n&261930}function tt(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var r=31-ze(n),i=1<<r;i&t|e[r]&t&&(e[r]|=t),n&=~i}}function nt(e,t){var n=t&-t;return n=n&42?1:rt(n),(n&(e.suspendedLanes|t))===0?n:0}function rt(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 it(e){return e&=-e,2<e?8<e?e&134217727?32:268435456:8:2}function at(){var e=P.p;return e===0?(e=window.event,e===void 0?32:Ep(e.type)):e}function ot(e,t){var n=P.p;try{return P.p=e,t()}finally{P.p=n}}var st=Math.random().toString(36).slice(2),ct=`__reactFiber$`+st,lt=`__reactProps$`+st,L=`__reactContainer$`+st,ut=`__reactEvents$`+st,dt=`__reactListeners$`+st,ft=`__reactHandles$`+st,pt=`__reactResources$`+st,mt=`__reactMarker$`+st;function ht(e){delete e[ct],delete e[lt],delete e[ut],delete e[dt],delete e[ft]}function gt(e){var t=e[ct];if(t)return t;for(var n=e.parentNode;n;){if(t=n[L]||n[ct]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=Cf(e);e!==null;){if(n=e[ct])return n;e=Cf(e)}return t}e=n,n=e.parentNode}return null}function _t(e){if(e=e[ct]||e[L]){var t=e.tag;if(t===5||t===6||t===13||t===31||t===26||t===27||t===3)return e}return null}function vt(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e.stateNode;throw Error(i(33))}function yt(e){var t=e[pt];return t||=e[pt]={hoistableStyles:new Map,hoistableScripts:new Map},t}function bt(e){e[mt]=!0}var xt=new Set,St={};function Ct(e,t){wt(e,t),wt(e+`Capture`,t)}function wt(e,t){for(St[e]=t,e=0;e<t.length;e++)xt.add(t[e])}var Tt=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]*$`),Et={},Dt={};function Ot(e){return Se.call(Dt,e)?!0:Se.call(Et,e)?!1:Tt.test(e)?Dt[e]=!0:(Et[e]=!0,!1)}function kt(e,t,n){if(Ot(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 At(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 jt(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 Mt(e){switch(typeof e){case`bigint`:case`boolean`:case`number`:case`string`:case`undefined`:return e;case`object`:return e;default:return``}}function Nt(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()===`input`&&(t===`checkbox`||t===`radio`)}function Pt(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 Ft(e){if(!e._valueTracker){var t=Nt(e)?`checked`:`value`;e._valueTracker=Pt(e,t,``+e[t])}}function It(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r=``;return e&&(r=Nt(e)?e.checked?`true`:`false`:e.value),e=r,e!==n&&(t.setValue(e),!0)}function Lt(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 Rt=/[\n"\\]/g;function zt(e){return e.replace(Rt,function(e){return`\\`+e.charCodeAt(0).toString(16)+` `})}function Bt(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=``+Mt(t)):e.value!==``+Mt(t)&&(e.value=``+Mt(t)),t==null?n==null?r!=null&&e.removeAttribute(`value`):Ht(e,o,Mt(n)):Ht(e,o,Mt(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=``+Mt(s):e.removeAttribute(`name`)}function Vt(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)){Ft(e);return}n=n==null?``:``+Mt(n),t=t==null?n:``+Mt(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),Ft(e)}function Ht(e,t,n){t===`number`&&Lt(e.ownerDocument)===e||e.defaultValue===``+n||(e.defaultValue=``+n)}function Ut(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=``+Mt(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 Wt(e,t,n){if(t!=null&&(t=``+Mt(t),t!==e.value&&(e.value=t),n==null)){e.defaultValue!==t&&(e.defaultValue=t);return}e.defaultValue=n==null?``:``+Mt(n)}function Gt(e,t,n,r){if(t==null){if(r!=null){if(n!=null)throw Error(i(92));if(ne(r)){if(1<r.length)throw Error(i(93));r=r[0]}n=r}n??=``,t=n}n=Mt(t),e.defaultValue=n,r=e.textContent,r===n&&r!==``&&r!==null&&(e.value=r),Ft(e)}function Kt(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var qt=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 Jt(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||qt.has(t)?t===`float`?e.cssFloat=n:e[t]=(``+n).trim():e[t]=n+`px`}function Yt(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&&Jt(e,a,r)}else for(var o in t)t.hasOwnProperty(o)&&Jt(e,o,t[o])}function Xt(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 Zt=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`]]),Qt=/^[\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 $t(e){return Qt.test(``+e)?`javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')`:e}function en(){}var tn=null;function nn(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var rn=null,an=null;function on(e){var t=_t(e);if(t&&(e=t.stateNode)){var n=e[lt]||null;a:switch(e=t.stateNode,t.type){case`input`:if(Bt(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="`+zt(``+t)+`"][type="radio"]`),t=0;t<n.length;t++){var r=n[t];if(r!==e&&r.form===e.form){var a=r[lt]||null;if(!a)throw Error(i(90));Bt(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&&It(r)}break a;case`textarea`:Wt(e,n.value,n.defaultValue);break a;case`select`:t=n.value,t!=null&&Ut(e,!!n.multiple,t,!1)}}}var sn=!1;function cn(e,t,n){if(sn)return e(t,n);sn=!0;try{return e(t)}finally{if(sn=!1,(rn!==null||an!==null)&&(ku(),rn&&(t=rn,e=an,an=rn=null,on(t),e)))for(t=0;t<e.length;t++)on(e[t])}}function ln(e,t){var n=e.stateNode;if(n===null)return null;var r=n[lt]||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 un=!(typeof window>`u`||window.document===void 0||window.document.createElement===void 0),dn=!1;if(un)try{var fn={};Object.defineProperty(fn,"passive",{get:function(){dn=!0}}),window.addEventListener(`test`,fn,fn),window.removeEventListener(`test`,fn,fn)}catch{dn=!1}var pn=null,mn=null,hn=null;function gn(){if(hn)return hn;var e,t=mn,n=t.length,r,i=`value`in pn?pn.value:pn.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 hn=i.slice(e,1<r?1-r:void 0)}function _n(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 vn(){return!0}function yn(){return!1}function bn(e){function t(t,n,r,i,a){for(var o in this._reactName=t,this._targetInst=r,this.type=n,this.nativeEvent=i,this.target=a,this.currentTarget=null,e)e.hasOwnProperty(o)&&(t=e[o],this[o]=t?t(i):i[o]);return this.isDefaultPrevented=(i.defaultPrevented==null?!1===i.returnValue:i.defaultPrevented)?vn:yn,this.isPropagationStopped=yn,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=vn)},stopPropagation:function(){var e=this.nativeEvent;e&&(e.stopPropagation?e.stopPropagation():typeof e.cancelBubble!=`unknown`&&(e.cancelBubble=!0),this.isPropagationStopped=vn)},persist:function(){},isPersistent:vn}),t}var xn={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Sn=bn(xn),Cn=m({},xn,{view:0,detail:0}),wn=bn(Cn),Tn,En,Dn,On=m({},Cn,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Rn,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!==Dn&&(Dn&&e.type===`mousemove`?(Tn=e.screenX-Dn.screenX,En=e.screenY-Dn.screenY):En=Tn=0,Dn=e),Tn)},movementY:function(e){return`movementY`in e?e.movementY:En}}),kn=bn(On),An=bn(m({},On,{dataTransfer:0})),jn=bn(m({},Cn,{relatedTarget:0})),Mn=bn(m({},xn,{animationName:0,elapsedTime:0,pseudoElement:0})),Nn=bn(m({},xn,{clipboardData:function(e){return`clipboardData`in e?e.clipboardData:window.clipboardData}})),Pn=bn(m({},xn,{data:0})),R={Esc:`Escape`,Spacebar:` `,Left:`ArrowLeft`,Up:`ArrowUp`,Right:`ArrowRight`,Down:`ArrowDown`,Del:`Delete`,Win:`OS`,Menu:`ContextMenu`,Apps:`ContextMenu`,Scroll:`ScrollLock`,MozPrintableKey:`Unidentified`},Fn={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`},In={Alt:`altKey`,Control:`ctrlKey`,Meta:`metaKey`,Shift:`shiftKey`};function Ln(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=In[e])?!!t[e]:!1}function Rn(){return Ln}var zn=bn(m({},Cn,{key:function(e){if(e.key){var t=R[e.key]||e.key;if(t!==`Unidentified`)return t}return e.type===`keypress`?(e=_n(e),e===13?`Enter`:String.fromCharCode(e)):e.type===`keydown`||e.type===`keyup`?Fn[e.keyCode]||`Unidentified`:``},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Rn,charCode:function(e){return e.type===`keypress`?_n(e):0},keyCode:function(e){return e.type===`keydown`||e.type===`keyup`?e.keyCode:0},which:function(e){return e.type===`keypress`?_n(e):e.type===`keydown`||e.type===`keyup`?e.keyCode:0}})),Bn=bn(m({},On,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0})),Vn=bn(m({},Cn,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Rn})),z=bn(m({},xn,{propertyName:0,elapsedTime:0,pseudoElement:0})),Hn=bn(m({},On,{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})),Un=bn(m({},xn,{newState:0,oldState:0})),Wn=[9,13,27,32],Gn=un&&`CompositionEvent`in window,Kn=null;un&&`documentMode`in document&&(Kn=document.documentMode);var qn=un&&`TextEvent`in window&&!Kn,Jn=un&&(!Gn||Kn&&8<Kn&&11>=Kn),Yn=` `,Xn=!1;function Zn(e,t){switch(e){case`keyup`:return Wn.indexOf(t.keyCode)!==-1;case`keydown`:return t.keyCode!==229;case`keypress`:case`mousedown`:case`focusout`:return!0;default:return!1}}function Qn(e){return e=e.detail,typeof e==`object`&&`data`in e?e.data:null}var $n=!1;function er(e,t){switch(e){case`compositionend`:return Qn(t);case`keypress`:return t.which===32?(Xn=!0,Yn):null;case`textInput`:return e=t.data,e===Yn&&Xn?null:e;default:return null}}function tr(e,t){if($n)return e===`compositionend`||!Gn&&Zn(e,t)?(e=gn(),hn=mn=pn=null,$n=!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 Jn&&t.locale!==`ko`?null:t.data;default:return null}}var nr={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 rr(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t===`input`?!!nr[e.type]:t===`textarea`}function ir(e,t,n,r){rn?an?an.push(r):an=[r]:rn=r,t=Ld(t,`onChange`),0<t.length&&(n=new Sn(`onChange`,`change`,null,n,r),e.push({event:n,listeners:t}))}var ar=null,B=null;function or(e){kd(e,0)}function sr(e){if(It(vt(e)))return e}function cr(e,t){if(e===`change`)return t}var lr=!1;if(un){var ur;if(un){var dr=`oninput`in document;if(!dr){var fr=document.createElement(`div`);fr.setAttribute(`oninput`,`return;`),dr=typeof fr.oninput==`function`}ur=dr}else ur=!1;lr=ur&&(!document.documentMode||9<document.documentMode)}function pr(){ar&&(ar.detachEvent(`onpropertychange`,mr),B=ar=null)}function mr(e){if(e.propertyName===`value`&&sr(B)){var t=[];ir(t,B,e,nn(e)),cn(or,t)}}function hr(e,t,n){e===`focusin`?(pr(),ar=t,B=n,ar.attachEvent(`onpropertychange`,mr)):e===`focusout`&&pr()}function gr(e){if(e===`selectionchange`||e===`keyup`||e===`keydown`)return sr(B)}function _r(e,t){if(e===`click`)return sr(t)}function vr(e,t){if(e===`input`||e===`change`)return sr(t)}function yr(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var br=typeof Object.is==`function`?Object.is:yr;function xr(e,t){if(br(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(!Se.call(t,i)||!br(e[i],t[i]))return!1}return!0}function Sr(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function Cr(e,t){var n=Sr(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=Sr(n)}}function wr(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?wr(e,t.parentNode):`contains`in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Tr(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=Lt(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=Lt(e.document)}return t}function Er(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 Dr=un&&`documentMode`in document&&11>=document.documentMode,Or=null,kr=null,Ar=null,jr=!1;function Mr(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;jr||Or==null||Or!==Lt(r)||(r=Or,`selectionStart`in r&&Er(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}),Ar&&xr(Ar,r)||(Ar=r,r=Ld(kr,`onSelect`),0<r.length&&(t=new Sn(`onSelect`,`select`,null,t,n),e.push({event:t,listeners:r}),t.target=Or)))}function Nr(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n[`Webkit`+e]=`webkit`+t,n[`Moz`+e]=`moz`+t,n}var Pr={animationend:Nr(`Animation`,`AnimationEnd`),animationiteration:Nr(`Animation`,`AnimationIteration`),animationstart:Nr(`Animation`,`AnimationStart`),transitionrun:Nr(`Transition`,`TransitionRun`),transitionstart:Nr(`Transition`,`TransitionStart`),transitioncancel:Nr(`Transition`,`TransitionCancel`),transitionend:Nr(`Transition`,`TransitionEnd`)},Fr={},Ir={};un&&(Ir=document.createElement(`div`).style,`AnimationEvent`in window||(delete Pr.animationend.animation,delete Pr.animationiteration.animation,delete Pr.animationstart.animation),`TransitionEvent`in window||delete Pr.transitionend.transition);function Lr(e){if(Fr[e])return Fr[e];if(!Pr[e])return e;var t=Pr[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in Ir)return Fr[e]=t[n];return e}var Rr=Lr(`animationend`),zr=Lr(`animationiteration`),Br=Lr(`animationstart`),Vr=Lr(`transitionrun`),Hr=Lr(`transitionstart`),Ur=Lr(`transitioncancel`),Wr=Lr(`transitionend`),Gr=new Map,Kr=`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(` `);Kr.push(`scrollEnd`);function qr(e,t){Gr.set(e,t),Ct(t,[e])}var Jr=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)},Yr=[],Xr=0,Zr=0;function Qr(){for(var e=Xr,t=Zr=Xr=0;t<e;){var n=Yr[t];Yr[t++]=null;var r=Yr[t];Yr[t++]=null;var i=Yr[t];Yr[t++]=null;var a=Yr[t];if(Yr[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 V(e,t,n,r){Yr[Xr++]=e,Yr[Xr++]=t,Yr[Xr++]=n,Yr[Xr++]=r,Zr|=r,e.lanes|=r,e=e.alternate,e!==null&&(e.lanes|=r)}function $r(e,t,n,r){return V(e,t,n,r),ni(e)}function ei(e,t){return V(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-ze(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=tp(e,n,se.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:xe(t)},mi.set(e,t),t):n}return{value:e,source:t,stack:xe(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-ze(r)-1;r&=~(1<<i),n+=1;var a=32-ze(t)+i;if(30<a){var o=i-i%5;a=(r&(1<<o)-1).toString(32),r>>=o,i-=o,Ci=1<<32-ze(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[ct]=e,t[lt]=r,n){case`dialog`:Ad(`cancel`,t),Ad(`close`,t);break;case`iframe`:case`object`:case`embed`:Ad(`load`,t);break;case`video`:case`audio`:for(n=0;n<Dd.length;n++)Ad(Dd[n],t);break;case`source`:Ad(`error`,t);break;case`img`:case`image`:case`link`:Ad(`error`,t),Ad(`load`,t);break;case`details`:Ad(`toggle`,t);break;case`input`:Ad(`invalid`,t),Vt(t,r.value,r.defaultValue,r.checked,r.defaultChecked,r.type,r.name,!0);break;case`select`:Ad(`invalid`,t);break;case`textarea`:Ad(`invalid`,t),Gt(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||Ud(t.textContent,n)?(r.popover!=null&&(Ad(`beforetoggle`,t),Ad(`toggle`,t)),r.onScroll!=null&&Ad(`scroll`,t),r.onScrollEnd!=null&&Ad(`scrollend`,t),r.onClick!=null&&(t.onclick=en),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`||tf(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=Sf(e)}else if(t===31){if(e=e.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(i(317));ji=Sf(e)}else t===27?(t=ji,uf(e.type)?(e=xf,xf=null,ji=e):ji=t):ji=Ai?bf(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=F(null),Wi=null,Gi=null;function Ki(e,t,n){oe(Ui,t._currentValue),t._currentValue=n}function qi(e){e._currentValue=Ui.current,I(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;br(a.pendingProps.value,s.value)||(e===null?e=[c]:e.push(c))}}else if(a===ue.current){if(s=a.alternate,s===null)throw Error(i(387));s.memoizedState.memoizedState!==a.memoizedState.memoizedState&&(e===null?e=[up]:e.push(up))}a=a.return}e!==null&&Yi(t,e,n,r),t.flags|=262144}function Zi(e){for(e=e.firstContext;e!==null;){if(!br(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=N.S;N.S=function(e,t){lu=De(),typeof t==`object`&&t&&typeof t.then==`function`&&fa(e,t),ha!==null&&ha(e,t)};var ga=F(null);function _a(){var e=ga.current;return e===null?Wl.pooledCache:e}function va(e,t){t===null?oe(ga,ga.current):oe(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(en,en),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(en,en);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(ne(t)||j(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(ne(n)||j(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(ne(r)||j(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}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}n(e,r);break}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(ne(o))return h(e,r,o,c);if(j(o)){if(l=j(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 V(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,tt(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=F(null),Za=F(0);function Qa(e,t){e=Ql,oe(Za,e),oe(Xa,t),Ql=e|t.baseLanes}function $a(){oe(Za,Ql),oe(Xa,Xa.current)}function eo(){Ql=Za.current,I(Xa),I(Za)}var to=F(null),no=null;function ro(e){var t=e.alternate;oe(co,co.current&1),oe(to,e),no===null&&(t===null||Xa.current!==null||t.memoizedState!==null)&&(no=e)}function io(e){oe(co,co.current),oe(to,e),no===null&&(no=e)}function ao(e){e.tag===22?(oe(co,co.current),oe(to,e),no===null&&(no=e)):oo(e)}function oo(){oe(co,co.current),oe(to,to.current)}function so(e){I(to),no===e&&(no=null),I(co)}var co=F(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||_f(n)||vf(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(!br(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,N.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){N.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)}N.H=Us,o=t(n,r)}while(go);return o}function Do(){var e=N.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,N.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]=ee;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,!br(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);br(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=!br((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!br(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){Re(!0);try{n()}finally{Re(!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)}};N.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=N.T,o={};N.T=o;try{var s=n(i,r),c=N.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),N.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=bf(i.nextSibling),i===null){i=null;break b}}a=i.data,i=a===`F!`||a===`F`?i:null}if(i){ji=bf(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){Re(!0);try{e()}finally{Re(!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 br(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),br(e,t)||(ac=!0),e)}function ws(e,t,n,r,i){var a=P.p;P.p=a!==0&&8>a?a:8;var o=N.T,s={};N.T=s,Is(e,!1,t,n);try{var c=i(),l=N.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{P.p=a,o!==null&&s.types!==null&&(o.types=s.types),N.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,re,n===null?Ts:function(){return Os(e),n(r)})}function Ds(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:re,baseState:re,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Lo,lastRenderedState:re},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(up)}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,br(s,o))return V(e,t,i,0),Wl===null&&Qr(),!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,tt(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){Re(!0);try{e()}finally{Re(!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){Re(!0);try{n(t)}finally{Re(!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-ze(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?!xr(n,r)||!xr(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){Jr(e)}function Xs(e){console.error(e)}function Zs(e){Jr(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?xr: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(xr(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);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=gf(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=nt(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=bf(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),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),s;if((s=o)||(s=e!==null&&e.memoizedState===null?!1:!!(co.current&2)),s&&(a=!0,t.flags&=-129),s=!!(t.flags&32),t.flags&=-33,e===null){if(Mi){if(a?ro(t):oo(t),(e=ji)?(e=gf(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 vf(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),vf(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=nt(s,n),r!==0&&r!==l.retryLane))throw l.retryLane=r,ei(e,r),wu(s,e,r),ic;_f(c)||Iu(),t=Dc(e,t,n)}else _f(c)?(t.flags|=192,t.child=e.child,t=null):(e=l.treeContext,ji=bf(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);if(s?(o=o&1|2,t.flags|=128):o&=1,oe(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)))}function Nc(e,t,n){switch(t.tag){case 3:de(t,t.stateNode.containerInfo),Ki(t,aa,e.memoizedState.cache),Bi();break;case 27:case 5:pe(t);break;case 4:de(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);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),oe(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}if(a===D){t.tag=14,t=cc(null,t,e,r,n);break a}}throw t=te(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(de(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}if(r!==a){a=hi(Error(i(424)),t),Hi(a),t=bc(e,t,r,n);break a}switch(e=t.stateNode.containerInfo,e.nodeType){case 9:e=e.body;break;default:e=e.nodeName===`HTML`?e.ownerDocument.body:e}for(ji=bf(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=Vf(t.type,null,t.pendingProps,null))?t.memoizedState=n:Mi||(n=t.type,e=t.pendingProps,r=Qd(le.current).createElement(n),r[ct]=t,r[lt]=e,Kd(r,n,e),bt(r),t.stateNode=r):t.memoizedState=Vf(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return pe(t),e===null&&Mi&&(r=t.stateNode=wf(t.type,t.pendingProps,le.current),Ai=t,Pi=!0,a=ji,uf(t.type)?(xf=a,ji=bf(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=mf(r,t.type,t.pendingProps,Pi),r===null?a=!1:(t.stateNode=r,Ai=t,ji=bf(r.firstChild),Pi=!1,a=!0)),a||Ii(t)),pe(t),a=t.type,o=t.pendingProps,s=e===null?null:e.memoizedProps,r=o.children,tf(a,o)?r=null:s!==null&&tf(a,s)&&(t.flags|=32),t.memoizedState!==null&&(a=wo(e,t,Do,null,null,n),up._currentValue=a),gc(e,t),oc(e,t,r,n),t.child;case 6:return e===null&&Mi&&((e=n=ji)&&(n=hf(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 de(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))&&(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,!np(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:Xe(),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),fe(),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(me(t),n=le.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=se.current,zi(t)?Li(t,e):(e=wf(a,r,n),t.stateNode=e,Fc(t))}return Bc(t),null;case 5:if(me(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=se.current,zi(t))Li(t,o);else{var s=Qd(le.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[ct]=t,o[lt]=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(Kd(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=le.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[ct]=t,e=!!(e.nodeValue===n||r!==null&&!0===r.suppressHydrationWarning||Ud(e.nodeValue,n)),e||Ii(t,!0)}else e=Qd(e).createTextNode(r),e[ct]=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[ct]=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[ct]=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 fe(),e===null&&Nd(t.stateNode.containerInfo),Bc(t),null;case 10:return qi(t.type),Bc(t),null;case 19:if(I(co),r=t.memoizedState,r===null)return Bc(t),null;if(a=!!(t.flags&128),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 oe(co,co.current&1|2),Mi&&Ti(t,r.treeForkCount),t.child}e=e.sibling}r.tail!==null&&De()>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*De()-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=De(),e.sibling=null,n=co.current,oe(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&&I(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),fe(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return me(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 I(co),null;case 4:return fe(),null;case 10:return qi(t.type),null;case 22:case 23:return so(t),eo(),e!==null&&I(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),fe();break;case 26:case 27:case 5:me(t);break;case 4:fe();break;case 31:t.memoizedState!==null&&so(t);break;case 13:so(t);break;case 19:I(co);break;case 10:qi(t.type);break;case 22:case 23:so(t),eo(),e!==null&&I(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;qd(r,e.type,n,t),r[lt]=t}catch(t){ed(e,e.return,t)}}function Qc(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&uf(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&&uf(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=en));else if(r!==4&&(r===27&&uf(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&&uf(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]);Kd(t,r,n),t[ct]=e,t[lt]=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,Xd=yp,e=Tr(e),Er(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(Zd={focusedElem:e,selectionRange:n},yp=!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)pf(e);else if(n===1)switch(e.nodeName){case`HEAD`:case`HTML`:case`BODY`:pf(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),yf(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)):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&&ht(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(Le&&typeof Le.onCommitFiberUnmount==`function`)try{Le.onCommitFiberUnmount(Ie,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;uf(n.type)&&(dl=n.stateNode,fl=!1),pl(e,t,n),Tf(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,df(e.nodeType===9?e.body:e.nodeName===`HTML`?e.ownerDocument.body:e,n.stateNode),Gp(e)):df(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{Gp(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{Gp(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(uf(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[mt]||o[ct]||o.namespaceURI===`http://www.w3.org/2000/svg`||o.hasAttribute(`itemprop`))&&(o=a.createElement(r),a.head.insertBefore(o,a.querySelector(`head > title`))),Kd(o,r,n),o[ct]=e,bt(o),r=o;break a;case`link`:var s=$f(`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),Kd(o,r,n),a.head.appendChild(o);break;case`meta`:if(s=$f(`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),Kd(o,r,n),a.head.appendChild(o);break;default:throw Error(i(468,r))}o[ct]=e,bt(o),r=o}e.stateNode=r}else ep(a,e.type,e.stateNode)}else e.stateNode=Jf(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?ep(a,e.type,e.stateNode):Jf(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{Kt(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(Qf=null,a=bl,bl=Of(t.containerInfo),yl(t,e),bl=a,Sl(e),r&4&&n!==null&&n.memoizedState.isDehydrated)try{Gp(t.containerInfo)}catch(t){ed(e,e.return,t)}al&&(al=!1,Cl(e));break;case 4:r=bl,bl=Of(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=De()),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?ff(m,!0):ff(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&&(Kt(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:Tf(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),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)||!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)||!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&&rp(n,bl,e.memoizedState,e.memoizedProps);break;case 5:Pl(e,t,n);break;case 3:case 4:var r=bl;bl=Of(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:N.T===null?at():xd()}function Cu(){if(ru===0){if(!(Kl&536870912)||Mi){var e=We;We<<=1,!(We&3932160)&&(We=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)&&(t&e.expiredLanes)===0||Je(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}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-De(),10<a)){if(Ou(r,t,ru,!Yl),qe(r,0,!0)!==0)break a;gu=t,r.timeoutHandle=af(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:en},Fl(t,a,d);var m=(a&62914560)===a?cu-De():(a&4194048)===a?lu-De():0;if(m=ap(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(!br(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-ze(i),o=1<<a;r[a]=-1,i&=~o}n!==0&&et(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,of(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=Je(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-ze(r),a=1<<i;t|=e[i],r&=~a}return Ql=t,Qr(),n}function Mu(e,t){fo=null,N.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=N.H;return N.H=Bs,e===null?Bs:e}function Fu(){var e=N.A;return N.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,N.H=i,N.A=a,Gl===null&&(Wl=null,Kl=0,Qr()),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=De()+500,ju(e,t)):Xl=Je(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?np(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,N.H=r,N.A=a,Ul=n,Gl===null?(Wl=null,Kl=0,Qr(),$l):0}function Bu(){for(;Gl!==null&&!Te();)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|=Zr,$e(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(je,function(){return Qu(),null})):(e.callbackNode=null,e.callbackPriority=0),r=!!(t.flags&13878),t.subtreeFlags&13878||r){r=N.T,N.T=null,a=P.p,P.p=2,s=Ul,Ul|=4;try{cl(e,t,n)}finally{Ul=s,P.p=a,N.T=r}}pu=1,qu(),Ju(),Yu()}}function qu(){if(pu===1){pu=0;var e=mu,t=hu,n=!!(t.flags&13878);if(t.subtreeFlags&13878||n){n=N.T,N.T=null;var r=P.p;P.p=2;var i=Ul;Ul|=4;try{xl(t,e);var a=Zd,o=Tr(e.containerInfo),s=a.focusedElem,c=a.selectionRange;if(o!==s&&s&&s.ownerDocument&&wr(s.ownerDocument.documentElement,s)){if(c!==null&&Er(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 _=Cr(s,h),v=Cr(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}}yp=!!Xd,Zd=Xd=null}finally{Ul=i,P.p=r,N.T=n}}e.current=t,pu=2}}function Ju(){if(pu===2){pu=0;var e=mu,t=hu,n=!!(t.flags&8772);if(t.subtreeFlags&8772||n){n=N.T,N.T=null;var r=P.p;P.p=2;var i=Ul;Ul|=4;try{ll(e,t.alternate,t)}finally{Ul=i,P.p=r,N.T=n}}pu=3}}function Yu(){if(pu===4||pu===3){pu=0,Ee();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),it(n),t=t.stateNode,Le&&typeof Le.onCommitFiberRoot==`function`)try{Le.onCommitFiberRoot(Ie,t,void 0,(t.current.flags&128)==128)}catch{}if(r!==null){t=N.T,i=P.p,P.p=2,N.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{N.T=t,P.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=it(gu),r=N.T,a=P.p;try{P.p=32>n?32:n,N.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),Le&&typeof Le.onPostCommitFiberRoot==`function`)try{Le.onPostCommitFiberRoot(Ie,o)}catch{}return!0}finally{P.p=a,N.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}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>De()-cu?!(Ul&2)&&ju(e,0):nu|=n,iu===Kl&&(iu=0)),pd(e)}function rd(e,t){t===0&&(t=Xe()),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 Ce(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-ze(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=qe(r,r===Wl?a:0,r.cancelPendingCommit!==null||r.timeoutHandle!==-1),!(a&3)||Je(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&&rf()&&(e=fd);for(var t=De(),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-ze(a),s=1<<o,c=i[o];c===-1?((s&n)===0||(s&r)!==0)&&(i[o]=Ye(s,t)):c<=t&&(e.expiredLanes|=s),a&=~s}if(t=Wl,n=Kl,n=qe(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&&we(r),e.callbackNode=null,e.callbackPriority=0;if(!(n&3)||Je(e,n)){if(t=n&-n,t===e.callbackPriority)return t;switch(r!==null&&we(r),it(n)){case 2:case 8:n=Ae;break;case 32:n=je;break;case 268435456:n=Ne;break;default:n=je}return r=vd.bind(null,e),n=Ce(n,r),e.callbackPriority=t,e.callbackNode=n,t}return r!==null&&r!==null&&we(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=qe(e,e===Wl?r:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),r===0?null:(Tu(e,r,t),_d(e,De()),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(){cf(function(){Ul&6?Ce(ke,hd):gd()})}function xd(){if(fd===0){var e=ua;e===0&&(e=Ue,Ue<<=1,!(Ue&261888)&&(Ue=256)),fd=e}return fd}function Sd(e){return e==null||typeof e==`symbol`||typeof e==`boolean`?null:typeof e==`function`?e:$t(``+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[lt]||null).action),o=r.submitter;o&&(t=(t=o[lt]||null)?Sd(t.formAction):o.getAttribute(`formAction`),t!==null&&(a=t,o=null));var s=new Sn(`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<Kr.length;Td++){var Ed=Kr[Td];qr(Ed.toLowerCase(),`on`+(Ed[0].toUpperCase()+Ed.slice(1)))}qr(Rr,`onAnimationEnd`),qr(zr,`onAnimationIteration`),qr(Br,`onAnimationStart`),qr(`dblclick`,`onDoubleClick`),qr(`focusin`,`onFocus`),qr(`focusout`,`onBlur`),qr(Vr,`onTransitionRun`),qr(Hr,`onTransitionStart`),qr(Ur,`onTransitionCancel`),qr(Wr,`onTransitionEnd`),wt(`onMouseEnter`,[`mouseout`,`mouseover`]),wt(`onMouseLeave`,[`mouseout`,`mouseover`]),wt(`onPointerEnter`,[`pointerout`,`pointerover`]),wt(`onPointerLeave`,[`pointerout`,`pointerover`]),Ct(`onChange`,`change click focusin focusout input keydown keyup selectionchange`.split(` `)),Ct(`onSelect`,`focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange`.split(` `)),Ct(`onBeforeInput`,[`compositionend`,`keypress`,`textInput`,`paste`]),Ct(`onCompositionEnd`,`compositionend focusout keydown keypress keyup mousedown`.split(` `)),Ct(`onCompositionStart`,`compositionstart focusout keydown keypress keyup mousedown`.split(` `)),Ct(`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 kd(e,t){t=!!(t&4);for(var n=0;n<e.length;n++){var r=e[n],i=r.event;r=r.listeners;a:{var a=void 0;if(t)for(var o=r.length-1;0<=o;o--){var s=r[o],c=s.instance,l=s.currentTarget;if(s=s.listener,c!==a&&i.isPropagationStopped())break a;a=s,i.currentTarget=l;try{a(i)}catch(e){Jr(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){Jr(e)}i.currentTarget=null,a=c}}}}function Ad(e,t){var n=t[ut];n===void 0&&(n=t[ut]=new Set);var r=e+`__bubble`;n.has(r)||(Pd(t,e,2,!1),n.add(r))}function jd(e,t,n){var r=0;t&&(r|=4),Pd(n,e,r,t)}var Md=`_reactListening`+Math.random().toString(36).slice(2);function Nd(e){if(!e[Md]){e[Md]=!0,xt.forEach(function(t){t!==`selectionchange`&&(Od.has(t)||jd(t,!1,e),jd(t,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[Md]||(t[Md]=!0,jd(`selectionchange`,!1,t))}}function Pd(e,t,n,r){switch(Ep(t)){case 2:var i=bp;break;case 8:i=xp;break;default:i=Sp}n=i.bind(null,t,n,e),i=void 0,!dn||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 Fd(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=gt(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}cn(function(){var r=a,i=nn(n),s=[];a:{var c=Gr.get(e);if(c!==void 0){var l=Sn,u=e;switch(e){case`keypress`:if(_n(n)===0)break a;case`keydown`:case`keyup`:l=zn;break;case`focusin`:u=`focus`,l=jn;break;case`focusout`:u=`blur`,l=jn;break;case`beforeblur`:case`afterblur`:l=jn;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=kn;break;case`drag`:case`dragend`:case`dragenter`:case`dragexit`:case`dragleave`:case`dragover`:case`dragstart`:case`drop`:l=An;break;case`touchcancel`:case`touchend`:case`touchmove`:case`touchstart`:l=Vn;break;case Rr:case zr:case Br:l=Mn;break;case Wr:l=z;break;case`scroll`:case`scrollend`:l=wn;break;case`wheel`:l=Hn;break;case`copy`:case`cut`:case`paste`:l=Nn;break;case`gotpointercapture`:case`lostpointercapture`:case`pointercancel`:case`pointerdown`:case`pointermove`:case`pointerout`:case`pointerover`:case`pointerup`:l=Bn;break;case`toggle`:case`beforetoggle`:l=Un}var d=!!(t&4),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=ln(m,p),g!=null&&d.push(Id(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!==tn&&(u=n.relatedTarget||n.fromElement)&&(gt(u)||u[L]))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?gt(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=kn,g=`onMouseLeave`,p=`onMouseEnter`,m=`mouse`,(e===`pointerout`||e===`pointerover`)&&(d=Bn,g=`onPointerLeave`,p=`onPointerEnter`,m=`pointer`),f=l==null?c:vt(l),h=u==null?c:vt(u),c=new d(g,m+`leave`,l,n,i),c.target=f,c.relatedTarget=h,g=null,gt(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=Rd,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&&zd(s,c,l,d,!1),u!==null&&f!==null&&zd(s,f,u,d,!0)}}a:{if(c=r?vt(r):window,l=c.nodeName&&c.nodeName.toLowerCase(),l===`select`||l===`input`&&c.type===`file`)var v=cr;else if(rr(c)){if(lr)v=vr;else{v=gr;var y=hr}}else l=c.nodeName,!l||l.toLowerCase()!==`input`||c.type!==`checkbox`&&c.type!==`radio`?r&&Xt(r.elementType)&&(v=cr):v=_r;if(v&&=v(e,r)){ir(s,v,n,i);break a}y&&y(e,c,r),e===`focusout`&&r&&c.type===`number`&&r.memoizedProps.value!=null&&Ht(c,`number`,c.value)}switch(y=r?vt(r):window,e){case`focusin`:(rr(y)||y.contentEditable===`true`)&&(Or=y,kr=r,Ar=null);break;case`focusout`:Ar=kr=Or=null;break;case`mousedown`:jr=!0;break;case`contextmenu`:case`mouseup`:case`dragend`:jr=!1,Mr(s,n,i);break;case`selectionchange`:if(Dr)break;case`keydown`:case`keyup`:Mr(s,n,i)}var b;if(Gn)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 $n?Zn(e,n)&&(x=`onCompositionEnd`):e===`keydown`&&n.keyCode===229&&(x=`onCompositionStart`);x&&(Jn&&n.locale!==`ko`&&($n||x!==`onCompositionStart`?x===`onCompositionEnd`&&$n&&(b=gn()):(pn=i,mn=`value`in pn?pn.value:pn.textContent,$n=!0)),y=Ld(r,x),0<y.length&&(x=new Pn(x,e,null,n,i),s.push({event:x,listeners:y}),b?x.data=b:(b=Qn(n),b!==null&&(x.data=b)))),(b=qn?er(e,n):tr(e,n))&&(x=Ld(r,`onBeforeInput`),0<x.length&&(y=new Pn(`onBeforeInput`,`beforeinput`,null,n,i),s.push({event:y,listeners:x}),y.data=b)),wd(s,e,r,n,i)}kd(s,t)})}function Id(e,t,n){return{instance:e,listener:t,currentTarget:n}}function Ld(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=ln(e,n),i!=null&&r.unshift(Id(e,i,a)),i=ln(e,t),i!=null&&r.push(Id(e,i,a))),e.tag===3)return r;e=e.return}return[]}function Rd(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function zd(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=ln(n,a),l!=null&&o.unshift(Id(n,l,c))):i||(l=ln(n,a),l!=null&&o.push(Id(n,l,c)))),n=n.return}o.length!==0&&e.push({event:t,listeners:o})}var Bd=/\r\n?/g,Vd=/\u0000|\uFFFD/g;function Hd(e){return(typeof e==`string`?e:``+e).replace(Bd,`
|
|
9
|
-
`).replace(Vd,``)}function Ud(e,t){return t=Hd(t),Hd(e)===t}function Wd(e,t,n,r,a,o){switch(n){case`children`:typeof r==`string`?t===`body`||t===`textarea`&&r===``||Kt(e,r):(typeof r==`number`||typeof r==`bigint`)&&t!==`body`&&Kt(e,``+r);break;case`className`:At(e,`class`,r);break;case`tabIndex`:At(e,`tabindex`,r);break;case`dir`:case`role`:case`viewBox`:case`width`:case`height`:At(e,n,r);break;case`style`:Yt(e,r,o);break;case`data`:if(t!==`object`){At(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=$t(``+r),e.setAttribute(n,r);break;case`action`:case`formAction`:if(typeof r==`function`){e.setAttribute(n,`javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')`);break}if(typeof o==`function`&&(n===`formAction`?(t!==`input`&&Wd(e,t,`name`,a.name,a,null),Wd(e,t,`formEncType`,a.formEncType,a,null),Wd(e,t,`formMethod`,a.formMethod,a,null),Wd(e,t,`formTarget`,a.formTarget,a,null)):(Wd(e,t,`encType`,a.encType,a,null),Wd(e,t,`method`,a.method,a,null),Wd(e,t,`target`,a.target,a,null))),r==null||typeof r==`symbol`||typeof r==`boolean`){e.removeAttribute(n);break}r=$t(``+r),e.setAttribute(n,r);break;case`onClick`:r!=null&&(e.onclick=en);break;case`onScroll`:r!=null&&Ad(`scroll`,e);break;case`onScrollEnd`:r!=null&&Ad(`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=$t(``+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`:Ad(`beforetoggle`,e),Ad(`toggle`,e),kt(e,`popover`,r);break;case`xlinkActuate`:jt(e,`http://www.w3.org/1999/xlink`,`xlink:actuate`,r);break;case`xlinkArcrole`:jt(e,`http://www.w3.org/1999/xlink`,`xlink:arcrole`,r);break;case`xlinkRole`:jt(e,`http://www.w3.org/1999/xlink`,`xlink:role`,r);break;case`xlinkShow`:jt(e,`http://www.w3.org/1999/xlink`,`xlink:show`,r);break;case`xlinkTitle`:jt(e,`http://www.w3.org/1999/xlink`,`xlink:title`,r);break;case`xlinkType`:jt(e,`http://www.w3.org/1999/xlink`,`xlink:type`,r);break;case`xmlBase`:jt(e,`http://www.w3.org/XML/1998/namespace`,`xml:base`,r);break;case`xmlLang`:jt(e,`http://www.w3.org/XML/1998/namespace`,`xml:lang`,r);break;case`xmlSpace`:jt(e,`http://www.w3.org/XML/1998/namespace`,`xml:space`,r);break;case`is`:kt(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=Zt.get(n)||n,kt(e,n,r))}}function Gd(e,t,n,r,a,o){switch(n){case`style`:Yt(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`?Kt(e,r):(typeof r==`number`||typeof r==`bigint`)&&Kt(e,``+r);break;case`onScroll`:r!=null&&Ad(`scroll`,e);break;case`onScrollEnd`:r!=null&&Ad(`scrollend`,e);break;case`onClick`:r!=null&&(e.onclick=en);break;case`suppressContentEditableWarning`:case`suppressHydrationWarning`:case`innerHTML`:case`ref`:break;case`innerText`:case`textContent`:break;default:if(!St.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[lt]||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,``):kt(e,n,r)}}}function Kd(e,t,n){switch(t){case`div`:case`span`:case`svg`:case`path`:case`a`:case`g`:case`p`:case`li`:break;case`img`:Ad(`error`,e),Ad(`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:Wd(e,t,o,s,n,null)}}a&&Wd(e,t,`srcSet`,n.srcSet,n,null),r&&Wd(e,t,`src`,n.src,n,null);return;case`input`:Ad(`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:Wd(e,t,r,d,n,null)}}Vt(e,o,c,l,u,s,a,!1);return;case`select`:for(a in Ad(`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:Wd(e,t,a,c,n,null)}t=o,n=s,e.multiple=!!r,t==null?n!=null&&Ut(e,!!r,n,!0):Ut(e,!!r,t,!1);return;case`textarea`:for(s in Ad(`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:Wd(e,t,s,c,n,null)}Gt(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:Wd(e,t,l,r,n,null)}return;case`dialog`:Ad(`beforetoggle`,e),Ad(`toggle`,e),Ad(`cancel`,e),Ad(`close`,e);break;case`iframe`:case`object`:Ad(`load`,e);break;case`video`:case`audio`:for(r=0;r<Dd.length;r++)Ad(Dd[r],e);break;case`image`:Ad(`error`,e),Ad(`load`,e);break;case`details`:Ad(`toggle`,e);break;case`embed`:case`source`:case`link`:Ad(`error`,e),Ad(`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:Wd(e,t,u,r,n,null)}return;default:if(Xt(t)){for(d in n)n.hasOwnProperty(d)&&(r=n[d],r!==void 0&&Gd(e,t,d,r,n,void 0));return}}for(c in n)n.hasOwnProperty(c)&&(r=n[c],r!=null&&Wd(e,t,c,r,n,null))}function qd(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)||Wd(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&&Wd(e,t,p,m,r,f)}}Bt(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)||Wd(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&&Wd(e,t,a,o,r,l)}t=c,n=s,r=m,p==null?!!r!=!!n&&(t==null?Ut(e,!!n,n?[]:``,!1):Ut(e,!!n,t,!0)):Ut(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:Wd(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&&Wd(e,t,s,a,r,o)}Wt(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:Wd(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:Wd(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)&&Wd(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:Wd(e,t,u,p,r,m)}return;default:if(Xt(t)){for(var _ in n)p=n[_],n.hasOwnProperty(_)&&p!==void 0&&!r.hasOwnProperty(_)&&Gd(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||Gd(e,t,d,p,r,m);return}}for(var v in n)p=n[v],n.hasOwnProperty(v)&&p!=null&&!r.hasOwnProperty(v)&&Wd(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||Wd(e,t,f,p,r,m)}function Jd(e){switch(e){case`css`:case`script`:case`font`:case`img`:case`image`:case`input`:case`link`:return!0;default:return!1}}function Yd(){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&&Jd(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&&Jd(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 Xd=null,Zd=null;function Qd(e){return e.nodeType===9?e:e.ownerDocument}function $d(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 ef(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 tf(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 nf=null;function rf(){var e=window.event;return e&&e.type===`popstate`?e!==nf&&(nf=e,!0):(nf=null,!1)}var af=typeof setTimeout==`function`?setTimeout:void 0,of=typeof clearTimeout==`function`?clearTimeout:void 0,sf=typeof Promise==`function`?Promise:void 0,cf=typeof queueMicrotask==`function`?queueMicrotask:sf===void 0?af:function(e){return sf.resolve(null).then(e).catch(lf)};function lf(e){setTimeout(function(){throw e})}function uf(e){return e===`head`}function df(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),Gp(t);return}r--}else if(n===`$`||n===`$?`||n===`$~`||n===`$!`||n===`&`)r++;else if(n===`html`)Tf(e.ownerDocument.documentElement);else if(n===`head`){n=e.ownerDocument.head,Tf(n);for(var a=n.firstChild;a;){var o=a.nextSibling,s=a.nodeName;a[mt]||s===`SCRIPT`||s===`STYLE`||s===`LINK`&&a.rel.toLowerCase()===`stylesheet`||n.removeChild(a),a=o}}else n===`body`&&Tf(e.ownerDocument.body)}n=i}while(n);Gp(t)}function ff(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 pf(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`:pf(n),ht(n);continue;case`SCRIPT`:case`STYLE`:continue;case`LINK`:if(n.rel.toLowerCase()===`stylesheet`)continue}e.removeChild(n)}}function mf(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[mt])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=bf(e.nextSibling),e===null)break}return null}function hf(e,t,n){if(t===``)return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!==`INPUT`||e.type!==`hidden`)&&!n||(e=bf(e.nextSibling),e===null))return null;return e}function gf(e,t){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!==`INPUT`||e.type!==`hidden`)&&!t||(e=bf(e.nextSibling),e===null))return null;return e}function _f(e){return e.data===`$?`||e.data===`$~`}function vf(e){return e.data===`$!`||e.data===`$?`&&e.ownerDocument.readyState!==`loading`}function yf(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 bf(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 xf=null;function Sf(e){e=e.nextSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n===`/$`||n===`/&`){if(t===0)return bf(e.nextSibling);t--}else n!==`$`&&n!==`$!`&&n!==`$?`&&n!==`$~`&&n!==`&`||t++}e=e.nextSibling}return null}function Cf(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 wf(e,t,n){switch(t=Qd(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 Tf(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);ht(e)}var Ef=new Map,Df=new Set;function Of(e){return typeof e.getRootNode==`function`?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var kf=P.d;P.d={f:Af,r:jf,D:Pf,C:Ff,L:If,m:Lf,X:zf,S:Rf,M:Bf};function Af(){var e=kf.f(),t=ku();return e||t}function jf(e){var t=_t(e);t!==null&&t.tag===5&&t.type===`form`?Os(t):kf.r(e)}var Mf=typeof document>`u`?null:document;function Nf(e,t,n){var r=Mf;if(r&&typeof t==`string`&&t){var i=zt(t);i=`link[rel="`+e+`"][href="`+i+`"]`,typeof n==`string`&&(i+=`[crossorigin="`+n+`"]`),Df.has(i)||(Df.add(i),e={rel:e,crossOrigin:n,href:t},r.querySelector(i)===null&&(t=r.createElement(`link`),Kd(t,`link`,e),bt(t),r.head.appendChild(t)))}}function Pf(e){kf.D(e),Nf(`dns-prefetch`,e,null)}function Ff(e,t){kf.C(e,t),Nf(`preconnect`,e,t)}function If(e,t,n){kf.L(e,t,n);var r=Mf;if(r&&e&&t){var i=`link[rel="preload"][as="`+zt(t)+`"]`;t===`image`&&n&&n.imageSrcSet?(i+=`[imagesrcset="`+zt(n.imageSrcSet)+`"]`,typeof n.imageSizes==`string`&&(i+=`[imagesizes="`+zt(n.imageSizes)+`"]`)):i+=`[href="`+zt(e)+`"]`;var a=i;switch(t){case`style`:a=Hf(e);break;case`script`:a=Kf(e)}Ef.has(a)||(e=m({rel:`preload`,href:t===`image`&&n&&n.imageSrcSet?void 0:e,as:t},n),Ef.set(a,e),r.querySelector(i)!==null||t===`style`&&r.querySelector(Uf(a))||t===`script`&&r.querySelector(qf(a))||(t=r.createElement(`link`),Kd(t,`link`,e),bt(t),r.head.appendChild(t)))}}function Lf(e,t){kf.m(e,t);var n=Mf;if(n&&e){var r=t&&typeof t.as==`string`?t.as:`script`,i=`link[rel="modulepreload"][as="`+zt(r)+`"][href="`+zt(e)+`"]`,a=i;switch(r){case`audioworklet`:case`paintworklet`:case`serviceworker`:case`sharedworker`:case`worker`:case`script`:a=Kf(e)}if(!Ef.has(a)&&(e=m({rel:`modulepreload`,href:e},t),Ef.set(a,e),n.querySelector(i)===null)){switch(r){case`audioworklet`:case`paintworklet`:case`serviceworker`:case`sharedworker`:case`worker`:case`script`:if(n.querySelector(qf(a)))return}r=n.createElement(`link`),Kd(r,`link`,e),bt(r),n.head.appendChild(r)}}}function Rf(e,t,n){kf.S(e,t,n);var r=Mf;if(r&&e){var i=yt(r).hoistableStyles,a=Hf(e);t||=`default`;var o=i.get(a);if(!o){var s={loading:0,preload:null};if(o=r.querySelector(Uf(a)))s.loading=5;else{e=m({rel:`stylesheet`,href:e,"data-precedence":t},n),(n=Ef.get(a))&&Xf(e,n);var c=o=r.createElement(`link`);bt(c),Kd(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,Yf(o,t,r)}o={type:`stylesheet`,instance:o,count:1,state:s},i.set(a,o)}}}function zf(e,t){kf.X(e,t);var n=Mf;if(n&&e){var r=yt(n).hoistableScripts,i=Kf(e),a=r.get(i);a||(a=n.querySelector(qf(i)),a||(e=m({src:e,async:!0},t),(t=Ef.get(i))&&Zf(e,t),a=n.createElement(`script`),bt(a),Kd(a,`link`,e),n.head.appendChild(a)),a={type:`script`,instance:a,count:1,state:null},r.set(i,a))}}function Bf(e,t){kf.M(e,t);var n=Mf;if(n&&e){var r=yt(n).hoistableScripts,i=Kf(e),a=r.get(i);a||(a=n.querySelector(qf(i)),a||(e=m({src:e,async:!0,type:`module`},t),(t=Ef.get(i))&&Zf(e,t),a=n.createElement(`script`),bt(a),Kd(a,`link`,e),n.head.appendChild(a)),a={type:`script`,instance:a,count:1,state:null},r.set(i,a))}}function Vf(e,t,n,r){var a=(a=le.current)?Of(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=Hf(n.href),n=yt(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=Hf(n.href);var o=yt(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(Uf(e)))&&!o._p&&(s.instance=o,s.state.loading=5),Ef.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},Ef.set(e,n),o||Gf(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=Kf(n),n=yt(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 Hf(e){return`href="`+zt(e)+`"`}function Uf(e){return`link[rel="stylesheet"][`+e+`]`}function Wf(e){return m({},e,{"data-precedence":e.precedence,precedence:null})}function Gf(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}),Kd(t,`link`,n),bt(t),e.head.appendChild(t))}function Kf(e){return`[src="`+zt(e)+`"]`}function qf(e){return`script[async]`+e}function Jf(e,t,n){if(t.count++,t.instance===null)switch(t.type){case`style`:var r=e.querySelector(`style[data-href~="`+zt(n.href)+`"]`);if(r)return t.instance=r,bt(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`),bt(r),Kd(r,`style`,a),Yf(r,n.precedence,e),t.instance=r;case`stylesheet`:a=Hf(n.href);var o=e.querySelector(Uf(a));if(o)return t.state.loading|=4,t.instance=o,bt(o),o;r=Wf(n),(a=Ef.get(a))&&Xf(r,a),o=(e.ownerDocument||e).createElement(`link`),bt(o);var s=o;return s._p=new Promise(function(e,t){s.onload=e,s.onerror=t}),Kd(o,`link`,r),t.state.loading|=4,Yf(o,n.precedence,e),t.instance=o;case`script`:return o=Kf(n.src),(a=e.querySelector(qf(o)))?(t.instance=a,bt(a),a):(r=n,(a=Ef.get(o))&&(r=m({},n),Zf(r,a)),e=e.ownerDocument||e,a=e.createElement(`script`),bt(a),Kd(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,Yf(r,n.precedence,e));return t.instance}function Yf(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 Xf(e,t){e.crossOrigin??=t.crossOrigin,e.referrerPolicy??=t.referrerPolicy,e.title??=t.title}function Zf(e,t){e.crossOrigin??=t.crossOrigin,e.referrerPolicy??=t.referrerPolicy,e.integrity??=t.integrity}var Qf=null;function $f(e,t,n){if(Qf===null){var r=new Map,i=Qf=new Map;i.set(n,r)}else i=Qf,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[mt]||a[ct]||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 ep(e,t,n){e=e.ownerDocument||e,e.head.insertBefore(n,t===`title`?e.querySelector(`head > title`):null)}function tp(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 np(e){return!(e.type===`stylesheet`&&!(e.state.loading&3))}function rp(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=Hf(r.href),a=t.querySelector(Uf(i));if(a){t=a._p,typeof t==`object`&&t&&typeof t.then==`function`&&(e.count++,e=op.bind(e),t.then(e,e)),n.state.loading|=4,n.instance=a,bt(a);return}a=t.ownerDocument||t,r=Wf(r),(i=Ef.get(i))&&Xf(r,i),a=a.createElement(`link`),bt(a);var o=a;o._p=new Promise(function(e,t){o.onload=e,o.onerror=t}),Kd(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=op.bind(e),t.addEventListener(`load`,n),t.addEventListener(`error`,n))}}var ip=0;function ap(e,t){return e.stylesheets&&e.count===0&&cp(e,e.stylesheets),0<e.count||0<e.imgCount?function(n){var r=setTimeout(function(){if(e.stylesheets&&cp(e,e.stylesheets),e.unsuspend){var t=e.unsuspend;e.unsuspend=null,t()}},6e4+t);0<e.imgBytes&&ip===0&&(ip=62500*Yd());var i=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&cp(e,e.stylesheets),e.unsuspend)){var t=e.unsuspend;e.unsuspend=null,t()}},(e.imgBytes>ip?50:800)+t);return e.unsuspend=n,function(){e.unsuspend=null,clearTimeout(r),clearTimeout(i)}}:null}function op(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)cp(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var sp=null;function cp(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,sp=new Map,t.forEach(lp,e),sp=null,op.call(e))}function lp(e,t){if(!(t.state.loading&4)){var n=sp.get(e);if(n)var r=n.get(null);else{n=new Map,sp.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=op.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 up={$$typeof:C,Provider:null,Consumer:null,_currentValue:re,_currentValue2:re,_threadCount:0};function dp(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=Ze(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Ze(0),this.hiddenUpdates=Ze(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 fp(e,t,n,r,i,a,o,s,c,l,u,d){return e=new dp(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 pp(e){return e?(e=ri,e):ri}function mp(e,t,n,r,i,a){i=pp(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 hp(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function gp(e,t){hp(e,t),(e=e.alternate)&&hp(e,t)}function _p(e){if(e.tag===13||e.tag===31){var t=ei(e,67108864);t!==null&&wu(t,e,67108864),gp(e,67108864)}}function vp(e){if(e.tag===13||e.tag===31){var t=Su();t=rt(t);var n=ei(e,t);n!==null&&wu(n,e,t),gp(e,t)}}var yp=!0;function bp(e,t,n,r){var i=N.T;N.T=null;var a=P.p;try{P.p=2,Sp(e,t,n,r)}finally{P.p=a,N.T=i}}function xp(e,t,n,r){var i=N.T;N.T=null;var a=P.p;try{P.p=8,Sp(e,t,n,r)}finally{P.p=a,N.T=i}}function Sp(e,t,n,r){if(yp){var i=Cp(r);if(i===null)Fd(e,t,r,wp,n),Fp(e,r);else if(Lp(i,e,t,n,r))r.stopPropagation();else if(Fp(e,r),t&4&&-1<Pp.indexOf(e)){for(;i!==null;){var a=_t(i);if(a!==null)switch(a.tag){case 3:if(a=a.stateNode,a.current.memoizedState.isDehydrated){var o=Ke(a.pendingLanes);if(o!==0){var s=a;for(s.pendingLanes|=2,s.entangledLanes|=2;o;){var c=1<<31-ze(o);s.entanglements[1]|=c,o&=~c}pd(a),!(Ul&6)&&(uu=De()+500,md(0,!1))}}break;case 31:case 13:s=ei(a,2),s!==null&&wu(s,a,2),ku(),gp(a,2)}if(a=Cp(r),a===null&&Fd(e,t,r,wp,n),a===i)break;i=a}i!==null&&r.stopPropagation()}else Fd(e,t,r,null,n)}}function Cp(e){return e=nn(e),Tp(e)}var wp=null;function Tp(e){if(wp=null,e=gt(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 wp=e,null}function Ep(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(Oe()){case ke:return 2;case Ae:return 8;case je:case Me:return 32;case Ne:return 268435456;default:return 32}default:return 32}}var Dp=!1,Op=null,kp=null,Ap=null,jp=new Map,Mp=new Map,Np=[],Pp=`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 Fp(e,t){switch(e){case`focusin`:case`focusout`:Op=null;break;case`dragenter`:case`dragleave`:kp=null;break;case`mouseover`:case`mouseout`:Ap=null;break;case`pointerover`:case`pointerout`:jp.delete(t.pointerId);break;case`gotpointercapture`:case`lostpointercapture`:Mp.delete(t.pointerId)}}function Ip(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=_t(t),t!==null&&_p(t)),e):(e.eventSystemFlags|=r,t=e.targetContainers,i!==null&&t.indexOf(i)===-1&&t.push(i),e)}function Lp(e,t,n,r,i){switch(t){case`focusin`:return Op=Ip(Op,e,t,n,r,i),!0;case`dragenter`:return kp=Ip(kp,e,t,n,r,i),!0;case`mouseover`:return Ap=Ip(Ap,e,t,n,r,i),!0;case`pointerover`:var a=i.pointerId;return jp.set(a,Ip(jp.get(a)||null,e,t,n,r,i)),!0;case`gotpointercapture`:return a=i.pointerId,Mp.set(a,Ip(Mp.get(a)||null,e,t,n,r,i)),!0}return!1}function Rp(e){var t=gt(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,ot(e.priority,function(){vp(n)});return}}else if(t===31){if(t=c(n),t!==null){e.blockedOn=t,ot(e.priority,function(){vp(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 zp(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=Cp(e.nativeEvent);if(n===null){n=e.nativeEvent;var r=new n.constructor(n.type,n);tn=r,n.target.dispatchEvent(r),tn=null}else return t=_t(n),t!==null&&_p(t),e.blockedOn=n,!1;t.shift()}return!0}function Bp(e,t,n){zp(e)&&n.delete(t)}function Vp(){Dp=!1,Op!==null&&zp(Op)&&(Op=null),kp!==null&&zp(kp)&&(kp=null),Ap!==null&&zp(Ap)&&(Ap=null),jp.forEach(Bp),Mp.forEach(Bp)}function Hp(e,n){e.blockedOn===n&&(e.blockedOn=null,Dp||(Dp=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,Vp)))}var Up=null;function Wp(e){Up!==e&&(Up=e,t.unstable_scheduleCallback(t.unstable_NormalPriority,function(){Up===e&&(Up=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(Tp(r||n)===null)continue;break}var a=_t(n);a!==null&&(e.splice(t,3),t-=3,Es(a,{pending:!0,data:i,method:n.method,action:r},r,i))}}))}function Gp(e){function t(t){return Hp(t,e)}Op!==null&&Hp(Op,e),kp!==null&&Hp(kp,e),Ap!==null&&Hp(Ap,e),jp.forEach(t),Mp.forEach(t);for(var n=0;n<Np.length;n++){var r=Np[n];r.blockedOn===e&&(r.blockedOn=null)}for(;0<Np.length&&(n=Np[0],n.blockedOn===null);)Rp(n),n.blockedOn===null&&Np.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[lt]||null;if(typeof a==`function`)o||Wp(n);else if(o){var s=null;if(a&&a.hasAttribute(`formAction`)){if(i=a,o=a[lt]||null)s=o.formAction;else if(Tp(i)!==null)continue}else s=o.action;typeof s==`function`?n[r+1]=s:(n.splice(r,3),r-=3),Wp(n)}}}function Kp(){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 qp(e){this._internalRoot=e}Jp.prototype.render=qp.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(i(409));var n=t.current;mp(n,Su(),e,t,null,null)},Jp.prototype.unmount=qp.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;mp(e.current,2,null,e,null,null),ku(),t[L]=null}};function Jp(e){this._internalRoot=e}Jp.prototype.unstable_scheduleHydration=function(e){if(e){var t=at();e={blockedOn:null,target:e,priority:t};for(var n=0;n<Np.length&&t!==0&&t<Np[n].priority;n++);Np.splice(n,0,e),n===0&&Rp(e)}};var Yp=n.version;if(Yp!==`19.2.8`)throw Error(i(527,Yp,`19.2.8`));P.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 Xp={bundleType:0,version:`19.2.8`,rendererPackageName:`react-dom`,currentDispatcherRef:N,reconcilerVersion:`19.2.8`};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<`u`){var Zp=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Zp.isDisabled&&Zp.supportsFiber)try{Ie=Zp.inject(Xp),Le=Zp}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=fp(e,1,!1,null,null,n,r,null,o,s,c,Kp),e[L]=t.current,Nd(e),new qp(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=(...e)=>e.filter((e,t,n)=>!!e&&e.trim()!==``&&n.indexOf(e)===t).join(` `).trim(),y=e=>e.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).toLowerCase(),b=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,t,n)=>n?n.toUpperCase():t.toLowerCase()),x=e=>{let t=b(e);return t.charAt(0).toUpperCase()+t.slice(1)},S={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`},C=e=>{for(let t in e)if(t.startsWith(`aria-`)||t===`role`||t===`title`)return!0;return!1},w=l(d(),1),T=(0,w.createContext)({}),E=()=>(0,w.useContext)(T),D=(0,w.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=``}=E()??{},m=r??d?Number(n??u)*24/Number(t??l):n??u;return(0,w.createElement)(`svg`,{ref:c,...S,width:t??l??S.width,height:t??l??S.height,stroke:e??f,strokeWidth:m,className:v(`lucide`,p,i),...!a&&!C(s)&&{"aria-hidden":`true`},...s},[...o.map(([e,t])=>(0,w.createElement)(e,t)),...Array.isArray(a)?a:[a]])}),O=(e,t)=>{let n=(0,w.forwardRef)(({className:n,...r},i)=>(0,w.createElement)(D,{ref:i,iconNode:t,className:v(`lucide-${y(x(e))}`,`lucide-${e}`,n),...r}));return n.displayName=x(e),n},k=O(`archive`,[[`rect`,{width:`20`,height:`5`,x:`2`,y:`3`,rx:`1`,key:`1wp1u1`}],[`path`,{d:`M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8`,key:`1s80jp`}],[`path`,{d:`M10 12h4`,key:`a56b0p`}]]),ee=O(`arrow-down-to-line`,[[`path`,{d:`M12 17V3`,key:`1cwfxf`}],[`path`,{d:`m6 11 6 6 6-6`,key:`12ii2o`}],[`path`,{d:`M19 21H5`,key:`150jfl`}]]),A=O(`arrow-down`,[[`path`,{d:`M12 5v14`,key:`s699le`}],[`path`,{d:`m19 12-7 7-7-7`,key:`1idqje`}]]),j=O(`arrow-left`,[[`path`,{d:`m12 19-7-7 7-7`,key:`1l729n`}],[`path`,{d:`M19 12H5`,key:`x3x0zl`}]]),M=O(`arrow-up-to-line`,[[`path`,{d:`M5 3h14`,key:`7usisc`}],[`path`,{d:`m18 13-6-6-6 6`,key:`1kf1n9`}],[`path`,{d:`M12 7v14`,key:`1akyts`}]]),te=O(`arrow-up`,[[`path`,{d:`m5 12 7-7 7 7`,key:`hav0vg`}],[`path`,{d:`M12 19V5`,key:`x0mq9r`}]]),ne=O(`blocks`,[[`path`,{d:`M10 22V7a1 1 0 0 0-1-1H4a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-5a1 1 0 0 0-1-1H2`,key:`1ah6g2`}],[`rect`,{x:`14`,y:`2`,width:`8`,height:`8`,rx:`1`,key:`88lufb`}]]),N=O(`boxes`,[[`path`,{d:`M2.97 12.92A2 2 0 0 0 2 14.63v3.24a2 2 0 0 0 .97 1.71l3 1.8a2 2 0 0 0 2.06 0L12 19v-5.5l-5-3-4.03 2.42Z`,key:`lc1i9w`}],[`path`,{d:`m7 16.5-4.74-2.85`,key:`1o9zyk`}],[`path`,{d:`m7 16.5 5-3`,key:`va8pkn`}],[`path`,{d:`M7 16.5v5.17`,key:`jnp8gn`}],[`path`,{d:`M12 13.5V19l3.97 2.38a2 2 0 0 0 2.06 0l3-1.8a2 2 0 0 0 .97-1.71v-3.24a2 2 0 0 0-.97-1.71L17 10.5l-5 3Z`,key:`8zsnat`}],[`path`,{d:`m17 16.5-5-3`,key:`8arw3v`}],[`path`,{d:`m17 16.5 4.74-2.85`,key:`8rfmw`}],[`path`,{d:`M17 16.5v5.17`,key:`k6z78m`}],[`path`,{d:`M7.97 4.42A2 2 0 0 0 7 6.13v4.37l5 3 5-3V6.13a2 2 0 0 0-.97-1.71l-3-1.8a2 2 0 0 0-2.06 0l-3 1.8Z`,key:`1xygjf`}],[`path`,{d:`M12 8 7.26 5.15`,key:`1vbdud`}],[`path`,{d:`m12 8 4.74-2.85`,key:`3rx089`}],[`path`,{d:`M12 13.5V8`,key:`1io7kd`}]]),P=O(`brain`,[[`path`,{d:`M12 18V5`,key:`adv99a`}],[`path`,{d:`M15 13a4.17 4.17 0 0 1-3-4 4.17 4.17 0 0 1-3 4`,key:`1e3is1`}],[`path`,{d:`M17.598 6.5A3 3 0 1 0 12 5a3 3 0 1 0-5.598 1.5`,key:`1gqd8o`}],[`path`,{d:`M17.997 5.125a4 4 0 0 1 2.526 5.77`,key:`iwvgf7`}],[`path`,{d:`M18 18a4 4 0 0 0 2-7.464`,key:`efp6ie`}],[`path`,{d:`M19.967 17.483A4 4 0 1 1 12 18a4 4 0 1 1-7.967-.517`,key:`1gq6am`}],[`path`,{d:`M6 18a4 4 0 0 1-2-7.464`,key:`k1g0md`}],[`path`,{d:`M6.003 5.125a4 4 0 0 0-2.526 5.77`,key:`q97ue3`}]]),re=O(`cable`,[[`path`,{d:`M17 19a1 1 0 0 1-1-1v-2a2 2 0 0 1 2-2h2a2 2 0 0 1 2 2v2a1 1 0 0 1-1 1z`,key:`trhst0`}],[`path`,{d:`M17 21v-2`,key:`ds4u3f`}],[`path`,{d:`M19 14V6.5a1 1 0 0 0-7 0v11a1 1 0 0 1-7 0V10`,key:`1mo9zo`}],[`path`,{d:`M21 21v-2`,key:`eo0ou`}],[`path`,{d:`M3 5V3`,key:`1k5hjh`}],[`path`,{d:`M4 10a2 2 0 0 1-2-2V6a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v2a2 2 0 0 1-2 2z`,key:`1dd30t`}],[`path`,{d:`M7 5V3`,key:`1t1388`}]]),ie=O(`check`,[[`path`,{d:`M20 6 9 17l-5-5`,key:`1gmf2c`}]]),ae=O(`chevron-down`,[[`path`,{d:`m6 9 6 6 6-6`,key:`qrunsl`}]]),F=O(`chevron-right`,[[`path`,{d:`m9 18 6-6-6-6`,key:`mthhwq`}]]),I=O(`chevron-up`,[[`path`,{d:`m18 15-6-6-6 6`,key:`153udz`}]]),oe=O(`circle-question-mark`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3`,key:`1u773s`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]]),se=O(`clipboard-list`,[[`rect`,{width:`8`,height:`4`,x:`8`,y:`2`,rx:`1`,ry:`1`,key:`tgr4d6`}],[`path`,{d:`M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2`,key:`116196`}],[`path`,{d:`M12 11h4`,key:`1jrz19`}],[`path`,{d:`M12 16h4`,key:`n85exb`}],[`path`,{d:`M8 11h.01`,key:`1dfujw`}],[`path`,{d:`M8 16h.01`,key:`18s6g9`}]]),ce=O(`columns-2`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M12 3v18`,key:`108xh3`}]]),le=O(`copy`,[[`rect`,{width:`14`,height:`14`,x:`8`,y:`8`,rx:`2`,ry:`2`,key:`17jyea`}],[`path`,{d:`M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2`,key:`zix9uf`}]]),ue=O(`cpu`,[[`path`,{d:`M12 20v2`,key:`1lh1kg`}],[`path`,{d:`M12 2v2`,key:`tus03m`}],[`path`,{d:`M17 20v2`,key:`1rnc9c`}],[`path`,{d:`M17 2v2`,key:`11trls`}],[`path`,{d:`M2 12h2`,key:`1t8f8n`}],[`path`,{d:`M2 17h2`,key:`7oei6x`}],[`path`,{d:`M2 7h2`,key:`asdhe0`}],[`path`,{d:`M20 12h2`,key:`1q8mjw`}],[`path`,{d:`M20 17h2`,key:`1fpfkl`}],[`path`,{d:`M20 7h2`,key:`1o8tra`}],[`path`,{d:`M7 20v2`,key:`4gnj0m`}],[`path`,{d:`M7 2v2`,key:`1i4yhu`}],[`rect`,{x:`4`,y:`4`,width:`16`,height:`16`,rx:`2`,key:`1vbyd7`}],[`rect`,{x:`8`,y:`8`,width:`8`,height:`8`,rx:`1`,key:`z9xiuo`}]]),de=O(`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`}]]),fe=O(`ellipsis-vertical`,[[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}],[`circle`,{cx:`12`,cy:`5`,r:`1`,key:`gxeob9`}],[`circle`,{cx:`12`,cy:`19`,r:`1`,key:`lyex9k`}]]),pe=O(`external-link`,[[`path`,{d:`M15 3h6v6`,key:`1q9fwt`}],[`path`,{d:`M10 14 21 3`,key:`gplh6r`}],[`path`,{d:`M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6`,key:`a6xqqp`}]]),me=O(`eye-off`,[[`path`,{d:`M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49`,key:`ct8e1f`}],[`path`,{d:`M14.084 14.158a3 3 0 0 1-4.242-4.242`,key:`151rxh`}],[`path`,{d:`M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143`,key:`13bj9a`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]),he=O(`eye`,[[`path`,{d:`M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0`,key:`1nclc0`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]),ge=O(`file-archive`,[[`path`,{d:`M13.659 22H18a2 2 0 0 0 2-2V8a2.4 2.4 0 0 0-.706-1.706l-3.588-3.588A2.4 2.4 0 0 0 14 2H6a2 2 0 0 0-2 2v11.5`,key:`4pqfef`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M8 12v-1`,key:`1ej8lb`}],[`path`,{d:`M8 18v-2`,key:`qcmpov`}],[`path`,{d:`M8 7V6`,key:`1nbb54`}],[`circle`,{cx:`8`,cy:`20`,r:`2`,key:`ckkr5m`}]]),_e=O(`file-braces`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1`,key:`1oajmo`}],[`path`,{d:`M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1`,key:`mpwhp6`}]]),ve=O(`file-braces-corner`,[[`path`,{d:`M14 22h4a2 2 0 0 0 2-2V8a2.4 2.4 0 0 0-.706-1.706l-3.588-3.588A2.4 2.4 0 0 0 14 2H6a2 2 0 0 0-2 2v6`,key:`14cnrg`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M5 14a1 1 0 0 0-1 1v2a1 1 0 0 1-1 1 1 1 0 0 1 1 1v2a1 1 0 0 0 1 1`,key:`sr0ebq`}],[`path`,{d:`M9 22a1 1 0 0 0 1-1v-2a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-2a1 1 0 0 0-1-1`,key:`w793db`}]]),ye=O(`file-code`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M10 12.5 8 15l2 2.5`,key:`1tg20x`}],[`path`,{d:`m14 12.5 2 2.5-2 2.5`,key:`yinavb`}]]),be=O(`file-image`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`circle`,{cx:`10`,cy:`12`,r:`2`,key:`737tya`}],[`path`,{d:`m20 17-1.296-1.296a2.41 2.41 0 0 0-3.408 0L9 22`,key:`wt3hpn`}]]),xe=O(`file-plus-corner`,[[`path`,{d:`M11.35 22H6a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.706.706l3.588 3.588A2.4 2.4 0 0 1 20 8v5.35`,key:`17jvcc`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M14 19h6`,key:`bvotb8`}],[`path`,{d:`M17 16v6`,key:`18yu1i`}]]),Se=O(`file-text`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M10 9H8`,key:`b1mrlr`}],[`path`,{d:`M16 13H8`,key:`t4e002`}],[`path`,{d:`M16 17H8`,key:`z1uh3a`}]]),Ce=O(`file`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}]]),we=O(`folder-git-2`,[[`path`,{d:`M18 19a5 5 0 0 1-5-5v8`,key:`sz5oeg`}],[`path`,{d:`M9 20H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v5`,key:`1w6njk`}],[`circle`,{cx:`13`,cy:`12`,r:`2`,key:`1j92g6`}],[`circle`,{cx:`20`,cy:`19`,r:`2`,key:`1obnsp`}]]),Te=O(`folder-tree`,[[`path`,{d:`M20 10a1 1 0 0 0 1-1V6a1 1 0 0 0-1-1h-2.5a1 1 0 0 1-.8-.4l-.9-1.2A1 1 0 0 0 15 3h-2a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z`,key:`hod4my`}],[`path`,{d:`M20 21a1 1 0 0 0 1-1v-3a1 1 0 0 0-1-1h-2.9a1 1 0 0 1-.88-.55l-.42-.85a1 1 0 0 0-.92-.6H13a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z`,key:`w4yl2u`}],[`path`,{d:`M3 5a2 2 0 0 0 2 2h3`,key:`f2jnh7`}],[`path`,{d:`M3 3v13a2 2 0 0 0 2 2h3`,key:`k8epm1`}]]),Ee=O(`folder`,[[`path`,{d:`M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z`,key:`1kt360`}]]),De=O(`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`}]]),Oe=O(`git-fork`,[[`circle`,{cx:`12`,cy:`18`,r:`3`,key:`1mpf1b`}],[`circle`,{cx:`6`,cy:`6`,r:`3`,key:`1lh9wr`}],[`circle`,{cx:`18`,cy:`6`,r:`3`,key:`1h7g24`}],[`path`,{d:`M18 9v2c0 .6-.4 1-1 1H7c-.6 0-1-.4-1-1V9`,key:`1uq4wg`}],[`path`,{d:`M12 12v3`,key:`158kv8`}]]),ke=O(`globe`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20`,key:`13o1zl`}],[`path`,{d:`M2 12h20`,key:`9i4pu4`}]]),Ae=O(`link-2`,[[`path`,{d:`M9 17H7A5 5 0 0 1 7 7h2`,key:`8i5ue5`}],[`path`,{d:`M15 7h2a5 5 0 1 1 0 10h-2`,key:`1b9ql8`}],[`line`,{x1:`8`,x2:`16`,y1:`12`,y2:`12`,key:`1jonct`}]]),je=O(`list-tree`,[[`path`,{d:`M8 5h13`,key:`1pao27`}],[`path`,{d:`M13 12h8`,key:`h98zly`}],[`path`,{d:`M13 19h8`,key:`c3s6r1`}],[`path`,{d:`M3 10a2 2 0 0 0 2 2h3`,key:`1npucw`}],[`path`,{d:`M3 5v12a2 2 0 0 0 2 2h3`,key:`x1gjn2`}]]),Me=O(`loader-circle`,[[`path`,{d:`M21 12a9 9 0 1 1-6.219-8.56`,key:`13zald`}]]),Ne=O(`menu`,[[`path`,{d:`M4 5h16`,key:`1tepv9`}],[`path`,{d:`M4 12h16`,key:`1lakjw`}],[`path`,{d:`M4 19h16`,key:`1djgab`}]]),Pe=O(`message-square`,[[`path`,{d:`M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z`,key:`18887p`}]]),Fe=O(`palette`,[[`path`,{d:`M12 22a1 1 0 0 1 0-20 10 9 0 0 1 10 9 5 5 0 0 1-5 5h-2.25a1.75 1.75 0 0 0-1.4 2.8l.3.4a1.75 1.75 0 0 1-1.4 2.8z`,key:`e79jfc`}],[`circle`,{cx:`13.5`,cy:`6.5`,r:`.5`,fill:`currentColor`,key:`1okk4w`}],[`circle`,{cx:`17.5`,cy:`10.5`,r:`.5`,fill:`currentColor`,key:`f64h9f`}],[`circle`,{cx:`6.5`,cy:`12.5`,r:`.5`,fill:`currentColor`,key:`qy21gx`}],[`circle`,{cx:`8.5`,cy:`7.5`,r:`.5`,fill:`currentColor`,key:`fotxhn`}]]),Ie=O(`panel-left-close`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M9 3v18`,key:`fh3hqa`}],[`path`,{d:`m16 15-3-3 3-3`,key:`14y99z`}]]),Le=O(`panel-left-open`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M9 3v18`,key:`fh3hqa`}],[`path`,{d:`m14 9 3 3-3 3`,key:`8010ee`}]]),Re=O(`paperclip`,[[`path`,{d:`m16 6-8.414 8.586a2 2 0 0 0 2.829 2.829l8.414-8.586a4 4 0 1 0-5.657-5.657l-8.379 8.551a6 6 0 1 0 8.485 8.485l8.379-8.551`,key:`1miecu`}]]),ze=O(`pencil`,[[`path`,{d:`M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z`,key:`1a8usu`}],[`path`,{d:`m15 5 4 4`,key:`1mk7zo`}]]),Be=O(`picture-in-picture-2`,[[`path`,{d:`M21 9V6a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v10c0 1.1.9 2 2 2h4`,key:`daa4of`}],[`rect`,{width:`10`,height:`7`,x:`12`,y:`13`,rx:`2`,key:`1nb8gs`}]]),Ve=O(`play`,[[`path`,{d:`M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z`,key:`10ikf1`}]]),He=O(`plug`,[[`path`,{d:`M12 22v-5`,key:`1ega77`}],[`path`,{d:`M15 8V2`,key:`18g5xt`}],[`path`,{d:`M17 8a1 1 0 0 1 1 1v4a4 4 0 0 1-4 4h-4a4 4 0 0 1-4-4V9a1 1 0 0 1 1-1z`,key:`1xoxul`}],[`path`,{d:`M9 8V2`,key:`14iosj`}]]),Ue=O(`plus`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`M12 5v14`,key:`s699le`}]]),We=O(`power`,[[`path`,{d:`M12 2v10`,key:`mnfbl`}],[`path`,{d:`M18.4 6.6a9 9 0 1 1-12.77.04`,key:`obofu9`}]]),Ge=O(`puzzle`,[[`path`,{d:`M15.39 4.39a1 1 0 0 0 1.68-.474 2.5 2.5 0 1 1 3.014 3.015 1 1 0 0 0-.474 1.68l1.683 1.682a2.414 2.414 0 0 1 0 3.414L19.61 15.39a1 1 0 0 1-1.68-.474 2.5 2.5 0 1 0-3.014 3.015 1 1 0 0 1 .474 1.68l-1.683 1.682a2.414 2.414 0 0 1-3.414 0L8.61 19.61a1 1 0 0 0-1.68.474 2.5 2.5 0 1 1-3.014-3.015 1 1 0 0 0 .474-1.68l-1.683-1.682a2.414 2.414 0 0 1 0-3.414L4.39 8.61a1 1 0 0 1 1.68.474 2.5 2.5 0 1 0 3.014-3.015 1 1 0 0 1-.474-1.68l1.683-1.682a2.414 2.414 0 0 1 3.414 0z`,key:`w46dr5`}]]),Ke=O(`refresh-cw`,[[`path`,{d:`M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8`,key:`v9h5vc`}],[`path`,{d:`M21 3v5h-5`,key:`1q7to0`}],[`path`,{d:`M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16`,key:`3uifl3`}],[`path`,{d:`M8 16H3v5`,key:`1cv678`}]]),qe=O(`rotate-cw`,[[`path`,{d:`M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8`,key:`1p45f6`}],[`path`,{d:`M21 3v5h-5`,key:`1q7to0`}]]),Je=O(`search`,[[`path`,{d:`m21 21-4.34-4.34`,key:`14j7rj`}],[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}]]),Ye=O(`send`,[[`path`,{d:`M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z`,key:`1ffxy3`}],[`path`,{d:`m21.854 2.147-10.94 10.939`,key:`12cjpa`}]]),Xe=O(`server`,[[`rect`,{width:`20`,height:`8`,x:`2`,y:`2`,rx:`2`,ry:`2`,key:`ngkwjq`}],[`rect`,{width:`20`,height:`8`,x:`2`,y:`14`,rx:`2`,ry:`2`,key:`iecqi9`}],[`line`,{x1:`6`,x2:`6.01`,y1:`6`,y2:`6`,key:`16zg32`}],[`line`,{x1:`6`,x2:`6.01`,y1:`18`,y2:`18`,key:`nzw8ys`}]]),Ze=O(`settings`,[[`path`,{d:`M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915`,key:`1i5ecw`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]),Qe=O(`shield-alert`,[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}],[`path`,{d:`M12 8v4`,key:`1got3b`}],[`path`,{d:`M12 16h.01`,key:`1drbdi`}]]),$e=O(`square-split-horizontal`,[[`path`,{d:`M8 19H5c-1 0-2-1-2-2V7c0-1 1-2 2-2h3`,key:`lubmu8`}],[`path`,{d:`M16 5h3c1 0 2 1 2 2v10c0 1-1 2-2 2h-3`,key:`1ag34g`}],[`line`,{x1:`12`,x2:`12`,y1:`4`,y2:`20`,key:`1tx1rr`}]]),et=O(`square-terminal`,[[`path`,{d:`m7 11 2-2-2-2`,key:`1lz0vl`}],[`path`,{d:`M11 13h4`,key:`1p7l4v`}],[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,ry:`2`,key:`1m3agn`}]]),tt=O(`square`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}]]),nt=O(`terminal`,[[`path`,{d:`M12 19h8`,key:`baeox8`}],[`path`,{d:`m4 17 6-6-6-6`,key:`1yngyt`}]]),rt=O(`timer`,[[`line`,{x1:`10`,x2:`14`,y1:`2`,y2:`2`,key:`14vaq8`}],[`line`,{x1:`12`,x2:`15`,y1:`14`,y2:`11`,key:`17fdiu`}],[`circle`,{cx:`12`,cy:`14`,r:`8`,key:`1e1u0o`}]]),it=O(`trash-2`,[[`path`,{d:`M10 11v6`,key:`nco0om`}],[`path`,{d:`M14 11v6`,key:`outv1u`}],[`path`,{d:`M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6`,key:`miytrc`}],[`path`,{d:`M3 6h18`,key:`d0wm0j`}],[`path`,{d:`M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2`,key:`e791ji`}]]),at=O(`user`,[[`path`,{d:`M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2`,key:`975kel`}],[`circle`,{cx:`12`,cy:`7`,r:`4`,key:`17ys0d`}]]),ot=O(`x`,[[`path`,{d:`M18 6 6 18`,key:`1bl5f8`}],[`path`,{d:`m6 6 12 12`,key:`d8bk6v`}]]),st=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})),ct=o(((e,t)=>{t.exports=st()})),lt=_(),L=ct(),ut=[],dt=new Map,ft=0,pt=new Set;function mt(e){return pt.add(e),()=>pt.delete(e)}function ht(){ft++;for(let e of pt)e()}function gt(e){if(e.length===0)return;let t=new Set(e),n=!1;for(let e=ut.length-1;e>=0;e--)t.has(ut[e].id)&&(ut.splice(e,1),n=!0);n&&ht()}function _t(){return ut.map(e=>e.id)}function vt(e){for(let[t,n]of Object.entries(e))dt.set(t,n);ht()}function yt(e){return{wraps:ut.filter(t=>t.kind===`wrap`&&t.target===e).sort((e,t)=>(e.order??100)-(t.order??100)||e.id.localeCompare(t.id)),replaces:ut.filter(t=>t.kind===`replace`&&t.target===e).sort((e,t)=>(e.priority??100)-(t.priority??100)||e.id.localeCompare(t.id)),core:dt.get(e)}}function bt(e,t){let n=e.core??(()=>null);for(let r of e.replaces){let e=null;try{e=r.render(t,n)}catch(e){console.error(`[extensions] replace "${r.id}" crashed:`,e);continue}if(e!==null)return e}try{return n(t)}catch(e){return console.error(`[extensions] core target crashed:`,e),null}}function xt(e,t,n,r){if(t>=e.length)return r();let i=e[t];try{return i.render(n,()=>xt(e,t+1,n,r))}catch(a){return console.error(`[extensions] wrap "${i.id}" crashed, falling through:`,a),xt(e,t+1,n,r)}}var St=new Set;function Ct(e,t={}){let n=yt(e);return!n.core&&n.replaces.length===0&&!St.has(e)&&(St.add(e),console.warn(`[extensions] target "${e}" has no core default — its module's autoRegister never ran (is it imported at boot?). Rendering null.`)),xt(n.wraps,0,t,()=>bt(n,t))}function wt(e){(0,w.useSyncExternalStore)(mt,()=>ft);let{id:t,...n}=e;return(0,L.jsx)(At,{id:t,children:Ct(t,n)})}function Tt(e){return ut.filter(t=>t.kind===`contribute`&&t.collection===e).map(e=>({id:e.id,item:e.item,order:e.order??100})).sort((e,t)=>e.order-t.order||e.id.localeCompare(t.id))}function Et(e){let t,n=-1/0;for(let r of ut){if(r.kind!==`service`)continue;let i=r;if(i.service!==e)continue;let a=i.precedence??0;a>n&&(t=i,n=a)}return t?.value}function Dt(e){return ut.filter(t=>t.kind===`service`&&t.service===e).map(e=>({id:e.id,value:e.value,precedence:e.precedence??0})).sort((e,t)=>t.precedence-e.precedence||e.id.localeCompare(t.id))}function Ot(e){return ut.filter(t=>t.kind===`hook`&&t.event===e)}function kt(e){let t=e,n=ut.findIndex(e=>e.id===t.id);if(n!==-1){let e=ut[n];(e.kind!==t.kind||e.target!==t.target)&&console.warn(`[extensions] id "${t.id}" re-registered as ${t.kind} (was ${e.kind}) — same-id re-register SWAPS, so the previous entry is gone. Use distinct ids per entry.`),ut[n]=t,ht();return}ut.push(t),ht()}var At=class extends w.Component{state={failed:!1};static getDerivedStateFromError(){return{failed:!0}}componentDidCatch(e){console.error(`[extensions] target "${this.props.id}" crashed:`,e)}render(){return this.state.failed?null:this.props.children}};function jt(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=jt(e[t]))&&(r&&(r+=` `),r+=n)}else for(n in e)e[n]&&(r&&(r+=` `),r+=n)}return r}function Mt(){for(var e,t,n=0,r=``,i=arguments.length;n<i;n++)(e=arguments[n])&&(t=jt(e))&&(r&&(r+=` `),r+=t);return r}var Nt=(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},Pt=(e,t)=>({classGroupId:e,validator:t}),Ft=(e=new Map,t=null,n)=>({nextPart:e,validators:t,classGroupId:n}),It=`-`,Lt=[],Rt=`arbitrary..`,zt=e=>{let t=Ht(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:e=>{if(e.startsWith(`[`)&&e.endsWith(`]`))return Vt(e);let n=e.split(It);return Bt(n,+(n[0]===``&&n.length>1),t)},getConflictingClassGroupIds:(e,t)=>{if(t){let t=r[e],i=n[e];return t?i?Nt(i,t):t:i||Lt}return n[e]||Lt}}},Bt=(e,t,n)=>{if(e.length-t===0)return n.classGroupId;let r=e[t],i=n.nextPart.get(r);if(i){let n=Bt(e,t+1,i);if(n)return n}let a=n.validators;if(a===null)return;let o=t===0?e.join(It):e.slice(t).join(It),s=a.length;for(let e=0;e<s;e++){let t=a[e];if(t.validator(o))return t.classGroupId}},Vt=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?Rt+r:void 0})(),Ht=e=>{let{theme:t,classGroups:n}=e;return Ut(n,t)},Ut=(e,t)=>{let n=Ft();for(let r in e){let i=e[r];Wt(i,n,r,t)}return n},Wt=(e,t,n,r)=>{let i=e.length;for(let a=0;a<i;a++){let i=e[a];Gt(i,t,n,r)}},Gt=(e,t,n,r)=>{if(typeof e==`string`){Kt(e,t,n);return}if(typeof e==`function`){qt(e,t,n,r);return}Jt(e,t,n,r)},Kt=(e,t,n)=>{let r=e===``?t:Yt(t,e);r.classGroupId=n},qt=(e,t,n,r)=>{if(Xt(e)){Wt(e(r),t,n,r);return}t.validators===null&&(t.validators=[]),t.validators.push(Pt(n,e))},Jt=(e,t,n,r)=>{let i=Object.entries(e),a=i.length;for(let e=0;e<a;e++){let[a,o]=i[e];Wt(o,Yt(t,a),n,r)}},Yt=(e,t)=>{let n=e,r=t.split(It),i=r.length;for(let e=0;e<i;e++){let t=r[e],i=n.nextPart.get(t);i||(i=Ft(),n.nextPart.set(t,i)),n=i}return n},Xt=e=>`isThemeGetter`in e&&e.isThemeGetter===!0,Zt=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)}}},Qt=`!`,$t=`:`,en=[],tn=(e,t,n,r,i)=>({modifiers:e,hasImportantModifier:t,baseClassName:n,maybePostfixModifierPosition:r,isExternal:i}),nn=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===$t){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(Qt)?(c=s.slice(0,-1),l=!0):s.startsWith(Qt)&&(c=s.slice(1),l=!0);let u=a&&a>i?a-i:void 0;return tn(t,l,c,u)};if(t){let e=t+$t,n=r;r=t=>t.startsWith(e)?n(t.slice(e.length)):tn(en,!1,t,void 0,!0)}if(n){let e=r;r=t=>n({className:t,parseClassName:e})}return r},rn=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}},an=e=>({cache:Zt(e.cacheSize),parseClassName:nn(e),sortModifiers:rn(e),postfixLookupClassGroupIds:on(e),...zt(e)}),on=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},sn=/\s+/,cn=(e,t)=>{let{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:i,sortModifiers:a,postfixLookupClassGroupIds:o}=t,s=[],c=e.trim().split(sn),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?_+Qt:_,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},ln=(...e)=>{let t=0,n,r,i=``;for(;t<e.length;)(n=e[t++])&&(r=un(n))&&(i&&(i+=` `),i+=r);return i},un=e=>{if(typeof e==`string`)return e;let t,n=``;for(let r=0;r<e.length;r++)e[r]&&(t=un(e[r]))&&(n&&(n+=` `),n+=t);return n},dn=(e,...t)=>{let n,r,i,a,o=o=>(n=an(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=cn(e,n);return i(e,a),a};return a=o,(...e)=>a(ln(...e))},fn=[],pn=e=>{let t=t=>t[e]||fn;return t.isThemeGetter=!0,t},mn=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,hn=/^\((?:(\w[\w-]*):)?(.+)\)$/i,gn=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,_n=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,vn=/\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$/,yn=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,bn=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,xn=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Sn=e=>gn.test(e),Cn=e=>!!e&&!Number.isNaN(Number(e)),wn=e=>!!e&&Number.isInteger(Number(e)),Tn=e=>e.endsWith(`%`)&&Cn(e.slice(0,-1)),En=e=>_n.test(e),Dn=()=>!0,On=e=>vn.test(e)&&!yn.test(e),kn=()=>!1,An=e=>bn.test(e),jn=e=>xn.test(e),Mn=e=>!R(e)&&!z(e),Nn=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)),Pn=e=>Yn(e,$n,kn),R=e=>mn.test(e),Fn=e=>Yn(e,er,On),In=e=>Yn(e,tr,Cn),Ln=e=>Yn(e,rr,Dn),Rn=e=>Yn(e,nr,kn),zn=e=>Yn(e,Zn,kn),Bn=e=>Yn(e,Qn,jn),Vn=e=>Yn(e,ir,An),z=e=>hn.test(e),Hn=e=>Xn(e,er),Un=e=>Xn(e,nr),Wn=e=>Xn(e,Zn),Gn=e=>Xn(e,$n),Kn=e=>Xn(e,Qn),qn=e=>Xn(e,ir,!0),Jn=e=>Xn(e,rr,!0),Yn=(e,t,n)=>{let r=mn.exec(e);return r?r[1]?t(r[1]):n(r[2]):!1},Xn=(e,t,n=!1)=>{let r=hn.exec(e);return r?r[1]?t(r[1]):n:!1},Zn=e=>e===`position`||e===`percentage`,Qn=e=>e===`image`||e===`url`,$n=e=>e===`length`||e===`size`||e===`bg-size`,er=e=>e===`length`,tr=e=>e===`number`,nr=e=>e===`family-name`,rr=e=>e===`number`||e===`weight`,ir=e=>e===`shadow`,ar=dn(()=>{let e=pn(`color`),t=pn(`font`),n=pn(`text`),r=pn(`font-weight`),i=pn(`tracking`),a=pn(`leading`),o=pn(`breakpoint`),s=pn(`container`),c=pn(`spacing`),l=pn(`radius`),u=pn(`shadow`),d=pn(`inset-shadow`),f=pn(`text-shadow`),p=pn(`drop-shadow`),m=pn(`blur`),h=pn(`perspective`),g=pn(`aspect`),_=pn(`ease`),v=pn(`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(),z,R],S=()=>[`auto`,`hidden`,`clip`,`visible`,`scroll`],C=()=>[`auto`,`contain`,`none`],w=()=>[z,R,c],T=()=>[Sn,`full`,`auto`,...w()],E=()=>[wn,`none`,`subgrid`,z,R],D=()=>[`auto`,{span:[`full`,wn,z,R]},wn,z,R],O=()=>[wn,`auto`,z,R],k=()=>[`auto`,`min`,`max`,`fr`,z,R],ee=()=>[`start`,`end`,`center`,`between`,`around`,`evenly`,`stretch`,`baseline`,`center-safe`,`end-safe`],A=()=>[`start`,`end`,`center`,`stretch`,`center-safe`,`end-safe`],j=()=>[`auto`,...w()],M=()=>[Sn,`auto`,`full`,`dvw`,`dvh`,`lvw`,`lvh`,`svw`,`svh`,`min`,`max`,`fit`,...w()],te=()=>[Sn,`screen`,`full`,`dvw`,`lvw`,`svw`,`min`,`max`,`fit`,...w()],ne=()=>[Sn,`screen`,`full`,`lh`,`dvh`,`lvh`,`svh`,`min`,`max`,`fit`,...w()],N=()=>[e,z,R],P=()=>[...b(),Wn,zn,{position:[z,R]}],re=()=>[`no-repeat`,{repeat:[``,`x`,`y`,`space`,`round`]}],ie=()=>[`auto`,`cover`,`contain`,Gn,Pn,{size:[z,R]}],ae=()=>[Tn,Hn,Fn],F=()=>[``,`none`,`full`,l,z,R],I=()=>[``,Cn,Hn,Fn],oe=()=>[`solid`,`dashed`,`dotted`,`double`],se=()=>[`normal`,`multiply`,`screen`,`overlay`,`darken`,`lighten`,`color-dodge`,`color-burn`,`hard-light`,`soft-light`,`difference`,`exclusion`,`hue`,`saturation`,`color`,`luminosity`],ce=()=>[Cn,Tn,Wn,zn],le=()=>[``,`none`,m,z,R],ue=()=>[`none`,Cn,z,R],de=()=>[`none`,Cn,z,R],fe=()=>[Cn,z,R],pe=()=>[Sn,`full`,...w()];return{cacheSize:500,theme:{animate:[`spin`,`ping`,`pulse`,`bounce`],aspect:[`video`],blur:[En],breakpoint:[En],color:[Dn],container:[En],"drop-shadow":[En],ease:[`in`,`out`,`in-out`],font:[Mn],"font-weight":[`thin`,`extralight`,`light`,`normal`,`medium`,`semibold`,`bold`,`extrabold`,`black`],"inset-shadow":[En],leading:[`none`,`tight`,`snug`,`normal`,`relaxed`,`loose`],perspective:[`dramatic`,`near`,`normal`,`midrange`,`distant`,`none`],radius:[En],shadow:[En],spacing:[`px`,Cn],text:[En],"text-shadow":[En],tracking:[`tighter`,`tight`,`normal`,`wide`,`wider`,`widest`]},classGroups:{aspect:[{aspect:[`auto`,`square`,Sn,R,z,g]}],container:[`container`],"container-type":[{"@container":[``,`normal`,`size`,z,R]}],"container-named":[Nn],columns:[{columns:[Cn,R,z,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:[wn,`auto`,z,R]}],basis:[{basis:[Sn,`full`,`auto`,s,...w()]}],"flex-direction":[{flex:[`row`,`row-reverse`,`col`,`col-reverse`]}],"flex-wrap":[{flex:[`nowrap`,`wrap`,`wrap-reverse`]}],flex:[{flex:[Cn,Sn,`auto`,`initial`,`none`,R]}],grow:[{grow:[``,Cn,z,R]}],shrink:[{shrink:[``,Cn,z,R]}],order:[{order:[wn,`first`,`last`,`none`,z,R]}],"grid-cols":[{"grid-cols":E()}],"col-start-end":[{col:D()}],"col-start":[{"col-start":O()}],"col-end":[{"col-end":O()}],"grid-rows":[{"grid-rows":E()}],"row-start-end":[{row:D()}],"row-start":[{"row-start":O()}],"row-end":[{"row-end":O()}],"grid-flow":[{"grid-flow":[`row`,`col`,`dense`,`row-dense`,`col-dense`]}],"auto-cols":[{"auto-cols":k()}],"auto-rows":[{"auto-rows":k()}],gap:[{gap:w()}],"gap-x":[{"gap-x":w()}],"gap-y":[{"gap-y":w()}],"justify-content":[{justify:[...ee(),`normal`]}],"justify-items":[{"justify-items":[...A(),`normal`]}],"justify-self":[{"justify-self":[`auto`,...A()]}],"align-content":[{content:[`normal`,...ee()]}],"align-items":[{items:[...A(),{baseline:[``,`last`]}]}],"align-self":[{self:[`auto`,...A(),{baseline:[``,`last`]}]}],"place-content":[{"place-content":ee()}],"place-items":[{"place-items":[...A(),`baseline`]}],"place-self":[{"place-self":[`auto`,...A()]}],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:j()}],mx:[{mx:j()}],my:[{my:j()}],ms:[{ms:j()}],me:[{me:j()}],mbs:[{mbs:j()}],mbe:[{mbe:j()}],mt:[{mt:j()}],mr:[{mr:j()}],mb:[{mb:j()}],ml:[{ml:j()}],"space-x":[{"space-x":w()}],"space-x-reverse":[`space-x-reverse`],"space-y":[{"space-y":w()}],"space-y-reverse":[`space-y-reverse`],size:[{size:M()}],"inline-size":[{inline:[`auto`,...te()]}],"min-inline-size":[{"min-inline":[`auto`,...te()]}],"max-inline-size":[{"max-inline":[`none`,...te()]}],"block-size":[{block:[`auto`,...ne()]}],"min-block-size":[{"min-block":[`auto`,...ne()]}],"max-block-size":[{"max-block":[`none`,...ne()]}],w:[{w:[s,`screen`,...M()]}],"min-w":[{"min-w":[s,`screen`,`none`,...M()]}],"max-w":[{"max-w":[s,`screen`,`none`,`prose`,{screen:[o]},...M()]}],h:[{h:[`screen`,`lh`,...M()]}],"min-h":[{"min-h":[`screen`,`lh`,`none`,...M()]}],"max-h":[{"max-h":[`screen`,`lh`,...M()]}],"font-size":[{text:[`base`,n,Hn,Fn]}],"font-smoothing":[`antialiased`,`subpixel-antialiased`],"font-style":[`italic`,`not-italic`],"font-weight":[{font:[r,Jn,Ln]}],"font-stretch":[{"font-stretch":[`ultra-condensed`,`extra-condensed`,`condensed`,`semi-condensed`,`normal`,`semi-expanded`,`expanded`,`extra-expanded`,`ultra-expanded`,Tn,R]}],"font-family":[{font:[Un,Rn,t]}],"font-features":[{"font-features":[R]}],"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,z,R]}],"line-clamp":[{"line-clamp":[Cn,`none`,z,In]}],leading:[{leading:[a,...w()]}],"list-image":[{"list-image":[`none`,z,R]}],"list-style-position":[{list:[`inside`,`outside`]}],"list-style-type":[{list:[`disc`,`decimal`,`none`,z,R]}],"text-alignment":[{text:[`left`,`center`,`right`,`justify`,`start`,`end`]}],"placeholder-color":[{placeholder:N()}],"text-color":[{text:N()}],"text-decoration":[`underline`,`overline`,`line-through`,`no-underline`],"text-decoration-style":[{decoration:[...oe(),`wavy`]}],"text-decoration-thickness":[{decoration:[Cn,`from-font`,`auto`,z,Fn]}],"text-decoration-color":[{decoration:N()}],"underline-offset":[{"underline-offset":[Cn,`auto`,z,R]}],"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:[wn,z,R]}],"vertical-align":[{align:[`baseline`,`top`,`middle`,`bottom`,`text-top`,`text-bottom`,`sub`,`super`,z,R]}],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`,z,R]}],"bg-attachment":[{bg:[`fixed`,`local`,`scroll`]}],"bg-clip":[{"bg-clip":[`border`,`padding`,`content`,`text`]}],"bg-origin":[{"bg-origin":[`border`,`padding`,`content`]}],"bg-position":[{bg:P()}],"bg-repeat":[{bg:re()}],"bg-size":[{bg:ie()}],"bg-image":[{bg:[`none`,{linear:[{to:[`t`,`tr`,`r`,`br`,`b`,`bl`,`l`,`tl`]},wn,z,R],radial:[``,z,R],conic:[wn,z,R]},Kn,Bn]}],"bg-color":[{bg:N()}],"gradient-from-pos":[{from:ae()}],"gradient-via-pos":[{via:ae()}],"gradient-to-pos":[{to:ae()}],"gradient-from":[{from:N()}],"gradient-via":[{via:N()}],"gradient-to":[{to:N()}],rounded:[{rounded:F()}],"rounded-s":[{"rounded-s":F()}],"rounded-e":[{"rounded-e":F()}],"rounded-t":[{"rounded-t":F()}],"rounded-r":[{"rounded-r":F()}],"rounded-b":[{"rounded-b":F()}],"rounded-l":[{"rounded-l":F()}],"rounded-ss":[{"rounded-ss":F()}],"rounded-se":[{"rounded-se":F()}],"rounded-ee":[{"rounded-ee":F()}],"rounded-es":[{"rounded-es":F()}],"rounded-tl":[{"rounded-tl":F()}],"rounded-tr":[{"rounded-tr":F()}],"rounded-br":[{"rounded-br":F()}],"rounded-bl":[{"rounded-bl":F()}],"border-w":[{border:I()}],"border-w-x":[{"border-x":I()}],"border-w-y":[{"border-y":I()}],"border-w-s":[{"border-s":I()}],"border-w-e":[{"border-e":I()}],"border-w-bs":[{"border-bs":I()}],"border-w-be":[{"border-be":I()}],"border-w-t":[{"border-t":I()}],"border-w-r":[{"border-r":I()}],"border-w-b":[{"border-b":I()}],"border-w-l":[{"border-l":I()}],"divide-x":[{"divide-x":I()}],"divide-x-reverse":[`divide-x-reverse`],"divide-y":[{"divide-y":I()}],"divide-y-reverse":[`divide-y-reverse`],"border-style":[{border:[...oe(),`hidden`,`none`]}],"divide-style":[{divide:[...oe(),`hidden`,`none`]}],"border-color":[{border:N()}],"border-color-x":[{"border-x":N()}],"border-color-y":[{"border-y":N()}],"border-color-s":[{"border-s":N()}],"border-color-e":[{"border-e":N()}],"border-color-bs":[{"border-bs":N()}],"border-color-be":[{"border-be":N()}],"border-color-t":[{"border-t":N()}],"border-color-r":[{"border-r":N()}],"border-color-b":[{"border-b":N()}],"border-color-l":[{"border-l":N()}],"divide-color":[{divide:N()}],"outline-style":[{outline:[...oe(),`none`,`hidden`]}],"outline-offset":[{"outline-offset":[Cn,z,R]}],"outline-w":[{outline:[``,Cn,Hn,Fn]}],"outline-color":[{outline:N()}],shadow:[{shadow:[``,`none`,u,qn,Vn]}],"shadow-color":[{shadow:N()}],"inset-shadow":[{"inset-shadow":[`none`,d,qn,Vn]}],"inset-shadow-color":[{"inset-shadow":N()}],"ring-w":[{ring:I()}],"ring-w-inset":[`ring-inset`],"ring-color":[{ring:N()}],"ring-offset-w":[{"ring-offset":[Cn,Fn]}],"ring-offset-color":[{"ring-offset":N()}],"inset-ring-w":[{"inset-ring":I()}],"inset-ring-color":[{"inset-ring":N()}],"text-shadow":[{"text-shadow":[`none`,f,qn,Vn]}],"text-shadow-color":[{"text-shadow":N()}],opacity:[{opacity:[Cn,z,R]}],"mix-blend":[{"mix-blend":[...se(),`plus-darker`,`plus-lighter`]}],"bg-blend":[{"bg-blend":se()}],"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":[Cn]}],"mask-image-linear-from-pos":[{"mask-linear-from":ce()}],"mask-image-linear-to-pos":[{"mask-linear-to":ce()}],"mask-image-linear-from-color":[{"mask-linear-from":N()}],"mask-image-linear-to-color":[{"mask-linear-to":N()}],"mask-image-t-from-pos":[{"mask-t-from":ce()}],"mask-image-t-to-pos":[{"mask-t-to":ce()}],"mask-image-t-from-color":[{"mask-t-from":N()}],"mask-image-t-to-color":[{"mask-t-to":N()}],"mask-image-r-from-pos":[{"mask-r-from":ce()}],"mask-image-r-to-pos":[{"mask-r-to":ce()}],"mask-image-r-from-color":[{"mask-r-from":N()}],"mask-image-r-to-color":[{"mask-r-to":N()}],"mask-image-b-from-pos":[{"mask-b-from":ce()}],"mask-image-b-to-pos":[{"mask-b-to":ce()}],"mask-image-b-from-color":[{"mask-b-from":N()}],"mask-image-b-to-color":[{"mask-b-to":N()}],"mask-image-l-from-pos":[{"mask-l-from":ce()}],"mask-image-l-to-pos":[{"mask-l-to":ce()}],"mask-image-l-from-color":[{"mask-l-from":N()}],"mask-image-l-to-color":[{"mask-l-to":N()}],"mask-image-x-from-pos":[{"mask-x-from":ce()}],"mask-image-x-to-pos":[{"mask-x-to":ce()}],"mask-image-x-from-color":[{"mask-x-from":N()}],"mask-image-x-to-color":[{"mask-x-to":N()}],"mask-image-y-from-pos":[{"mask-y-from":ce()}],"mask-image-y-to-pos":[{"mask-y-to":ce()}],"mask-image-y-from-color":[{"mask-y-from":N()}],"mask-image-y-to-color":[{"mask-y-to":N()}],"mask-image-radial":[{"mask-radial":[z,R]}],"mask-image-radial-from-pos":[{"mask-radial-from":ce()}],"mask-image-radial-to-pos":[{"mask-radial-to":ce()}],"mask-image-radial-from-color":[{"mask-radial-from":N()}],"mask-image-radial-to-color":[{"mask-radial-to":N()}],"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":[Cn]}],"mask-image-conic-from-pos":[{"mask-conic-from":ce()}],"mask-image-conic-to-pos":[{"mask-conic-to":ce()}],"mask-image-conic-from-color":[{"mask-conic-from":N()}],"mask-image-conic-to-color":[{"mask-conic-to":N()}],"mask-mode":[{mask:[`alpha`,`luminance`,`match`]}],"mask-origin":[{"mask-origin":[`border`,`padding`,`content`,`fill`,`stroke`,`view`]}],"mask-position":[{mask:P()}],"mask-repeat":[{mask:re()}],"mask-size":[{mask:ie()}],"mask-type":[{"mask-type":[`alpha`,`luminance`]}],"mask-image":[{mask:[`none`,z,R]}],filter:[{filter:[``,`none`,z,R]}],blur:[{blur:le()}],brightness:[{brightness:[Cn,z,R]}],contrast:[{contrast:[Cn,z,R]}],"drop-shadow":[{"drop-shadow":[``,`none`,p,qn,Vn]}],"drop-shadow-color":[{"drop-shadow":N()}],grayscale:[{grayscale:[``,Cn,z,R]}],"hue-rotate":[{"hue-rotate":[Cn,z,R]}],invert:[{invert:[``,Cn,z,R]}],saturate:[{saturate:[Cn,z,R]}],sepia:[{sepia:[``,Cn,z,R]}],"backdrop-filter":[{"backdrop-filter":[``,`none`,z,R]}],"backdrop-blur":[{"backdrop-blur":le()}],"backdrop-brightness":[{"backdrop-brightness":[Cn,z,R]}],"backdrop-contrast":[{"backdrop-contrast":[Cn,z,R]}],"backdrop-grayscale":[{"backdrop-grayscale":[``,Cn,z,R]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[Cn,z,R]}],"backdrop-invert":[{"backdrop-invert":[``,Cn,z,R]}],"backdrop-opacity":[{"backdrop-opacity":[Cn,z,R]}],"backdrop-saturate":[{"backdrop-saturate":[Cn,z,R]}],"backdrop-sepia":[{"backdrop-sepia":[``,Cn,z,R]}],"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`,z,R]}],"transition-behavior":[{transition:[`normal`,`discrete`]}],duration:[{duration:[Cn,`initial`,z,R]}],ease:[{ease:[`linear`,`initial`,_,z,R]}],delay:[{delay:[Cn,z,R]}],animate:[{animate:[`none`,v,z,R]}],backface:[{backface:[`hidden`,`visible`]}],perspective:[{perspective:[h,z,R]}],"perspective-origin":[{"perspective-origin":x()}],rotate:[{rotate:ue()}],"rotate-x":[{"rotate-x":ue()}],"rotate-y":[{"rotate-y":ue()}],"rotate-z":[{"rotate-z":ue()}],scale:[{scale:de()}],"scale-x":[{"scale-x":de()}],"scale-y":[{"scale-y":de()}],"scale-z":[{"scale-z":de()}],"scale-3d":[`scale-3d`],skew:[{skew:fe()}],"skew-x":[{"skew-x":fe()}],"skew-y":[{"skew-y":fe()}],transform:[{transform:[z,R,``,`none`,`gpu`,`cpu`]}],"transform-origin":[{origin:x()}],"transform-style":[{transform:[`3d`,`flat`]}],translate:[{translate:pe()}],"translate-x":[{"translate-x":pe()}],"translate-y":[{"translate-y":pe()}],"translate-z":[{"translate-z":pe()}],"translate-none":[`translate-none`],zoom:[{zoom:[wn,z,R]}],accent:[{accent:N()}],appearance:[{appearance:[`none`,`auto`]}],"caret-color":[{caret:N()}],"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`,z,R]}],"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":N()}],"scrollbar-track-color":[{"scrollbar-track":N()}],"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`,z,R]}],fill:[{fill:[`none`,...N()]}],"stroke-w":[{stroke:[Cn,Hn,Fn,In]}],stroke:[{stroke:[`none`,...N()]}],"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 B(...e){return ar(Mt(e))}var or=Object.defineProperty,sr=(e,t)=>or(e,`name`,{value:t,configurable:!0});function cr(e,t){if(typeof e==`function`)return e(t);e!=null&&(e.current=t)}sr(cr,`setRef`);function lr(...e){return t=>{let n=!1,r=e.map(e=>{let r=cr(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():cr(e[t],null)}}}}sr(lr,`composeRefs`);function ur(...e){return w.useCallback(lr(...e),e)}sr(ur,`useComposedRefs`);var dr=Object.defineProperty,fr=(e,t)=>dr(e,`name`,{value:t,configurable:!0});function pr(e){let t=w.forwardRef((t,n)=>{let{children:r,...i}=t,a=null,o=!1,s=[];Sr(r)&&typeof Er==`function`&&(r=Er(r._payload)),w.Children.forEach(r,e=>{if(br(e)){o=!0;let t=e,n=`child`in t.props?t.props.child:t.props.children;Sr(n)&&typeof Er==`function`&&(n=Er(n._payload)),a=_r(t,n),s.push(a?.props?.children)}else s.push(e)}),a?a=w.cloneElement(a,void 0,s):!o&&w.Children.count(r)===1&&w.isValidElement(r)&&(a=r);let c=a?yr(a):void 0,l=ur(n,c);if(!a){if(r||r===0)throw Error(o?Tr(e):wr(e));return r}let u=vr(i,a.props??{});return a.type!==w.Fragment&&(u.ref=n?l:c),w.cloneElement(a,u)});return t.displayName=`${e}.Slot`,t}fr(pr,`createSlot`);var mr=pr(`Slot`),hr=Symbol.for(`radix.slottable`);function gr(e){let t=fr(e=>`child`in e?e.children(e.child):e.children,`Slottable`);return t.displayName=`${e}.Slottable`,t.__radixId=hr,t}fr(gr,`createSlottable`);var _r=fr((e,t)=>{if(`child`in e.props){let t=e.props.child;return w.isValidElement(t)?w.cloneElement(t,void 0,e.props.children(t.props.children)):null}return w.isValidElement(t)?t:null},`getSlottableElementFromSlottable`);function vr(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}}fr(vr,`mergeProps`);function yr(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)}fr(yr,`getElementRef`);function br(e){return w.isValidElement(e)&&typeof e.type==`function`&&`__radixId`in e.type&&e.type.__radixId===hr}fr(br,`isSlottable`);var xr=Symbol.for(`react.lazy`);function Sr(e){return typeof e==`object`&&!!e&&`$$typeof`in e&&e.$$typeof===xr&&`_payload`in e&&Cr(e._payload)}fr(Sr,`isLazyComponent`);function Cr(e){return typeof e==`object`&&!!e&&`then`in e}fr(Cr,`isPromiseLike`);var wr=fr(e=>`${e} failed to slot onto its children. Expected a single React element child or \`Slottable\`.`,`createSlotError`),Tr=fr(e=>`${e} failed to slot onto its \`Slottable\`. Expected \`Slottable\` to receive a single React element child.`,`createSlottableError`),Er=w.use,Dr=l(h(),1),Or=Object.defineProperty,kr=(e,t)=>Or(e,`name`,{value:t,configurable:!0}),Ar=[`a`,`button`,`div`,`form`,`h2`,`h3`,`img`,`input`,`label`,`li`,`nav`,`ol`,`p`,`select`,`span`,`svg`,`ul`].reduce((e,t)=>{let n=pr(`Primitive.${t}`),r=w.forwardRef((e,r)=>{let{asChild:i,...a}=e,o=i?n:t;return typeof window<`u`&&(window[Symbol.for(`radix-ui`)]=!0),(0,L.jsx)(o,{...a,ref:r})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function jr(e,t){e&&Dr.flushSync(()=>e.dispatchEvent(t))}kr(jr,`dispatchDiscreteCustomEvent`);var Mr=Object.defineProperty,Nr=(e,t)=>Mr(e,`name`,{value:t,configurable:!0});function Pr(e,t){let n=w.createContext(t);n.displayName=e+`Context`;let r=Nr(e=>{let{children:t,...r}=e,i=w.useMemo(()=>r,Object.values(r));return(0,L.jsx)(n.Provider,{value:i,children:t})},`Provider`);r.displayName=e+`Provider`;function i(r,i={}){let{optional:a=!1}=i,o=w.useContext(n);if(o)return o;if(t!==void 0)return t;if(!a)throw Error(`\`${r}\` must be used within \`${e}\``)}return Nr(i,`useContext`),[r,i]}Nr(Pr,`createContext`);function Fr(e,t=[]){let n=[];function r(t,r){let i=w.createContext(r);i.displayName=t+`Context`;let a=n.length;n=[...n,r];let o=Nr(t=>{let{scope:n,children:r,...o}=t,s=n?.[e]?.[a]||i,c=w.useMemo(()=>o,Object.values(o));return(0,L.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=w.useContext(l);if(u)return u;if(r!==void 0)return r;if(!c)throw Error(`\`${n}\` must be used within \`${t}\``)}return Nr(s,`useContext`),[o,s]}Nr(r,`createContext`);let i=Nr(()=>{let t=n.map(e=>w.createContext(e));return Nr(function(n){let r=n?.[e]||t;return w.useMemo(()=>({[`__scope${e}`]:{...n,[e]:r}}),[n,r])},`useScope`)},`createScope`);return i.scopeName=e,[r,Ir(i,...t)]}Nr(Fr,`createContextScope`);function Ir(...e){let t=e[0];if(e.length===1)return t;let n=Nr(()=>{let n=e.map(e=>({useScope:e(),scopeName:e.scopeName}));return Nr(function(e){let r=n.reduce((t,{useScope:n,scopeName:r})=>{let i=n(e)[`__scope${r}`];return{...t,...i}},{});return w.useMemo(()=>({[`__scope${t.scopeName}`]:r}),[r])},`useComposedScopes`)},`createScope`);return n.scopeName=t.scopeName,n}Nr(Ir,`composeContextScopes`);var Lr=Object.defineProperty,Rr=(e,t)=>Lr(e,`name`,{value:t,configurable:!0});function zr(e){let t=e+`CollectionProvider`,[n,r]=Fr(t),[i,a]=n(t,{collectionRef:{current:null},itemMap:new Map}),o=Rr(e=>{let{scope:t,children:n}=e,r=w.useRef(null),a=w.useRef(new Map).current;return(0,L.jsx)(i,{scope:t,itemMap:a,collectionRef:r,children:n})},`CollectionProvider`);o.displayName=t;let s=e+`CollectionSlot`,c=pr(s),l=w.forwardRef((e,t)=>{let{scope:n,children:r}=e,i=ur(t,a(s,n).collectionRef);return(0,L.jsx)(c,{ref:i,children:r})});l.displayName=s;let u=e+`CollectionItemSlot`,d=`data-radix-collection-item`,f=pr(u),p=w.forwardRef((e,t)=>{let{scope:n,children:r,...i}=e,o=w.useRef(null),s=ur(t,o),c=a(u,n);return w.useEffect(()=>(c.itemMap.set(o,{ref:o,...i}),()=>void c.itemMap.delete(o))),(0,L.jsx)(f,{[d]:``,ref:s,children:r})});p.displayName=u;function m(t){let n=a(e+`CollectionConsumer`,t);return w.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 Rr(m,`useCollection`),[{Provider:o,Slot:l,ItemSlot:p},m,r]}Rr(zr,`createCollection`);var Br=new WeakMap,Vr=class e extends Map{static{Rr(this,`OrderedDict`)}#e;constructor(e){super(e),this.#e=[...super.keys()],Br.set(this,!0)}set(e,t){return Br.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=Wr(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=Hr(this.#e,e);if(t!==void 0)return this.get(t)}entryAt(e){let t=Hr(this.#e,e);if(t!==void 0)return[t,this.get(t)]}indexOf(e){return this.#e.indexOf(e)}keyAt(e){return Hr(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 Hr(e,t){if(`at`in Array.prototype)return Array.prototype.at.call(e,t);let n=Ur(e,t);return n===-1?void 0:e[n]}Rr(Hr,`at`);function Ur(e,t){let n=e.length,r=Wr(t),i=r>=0?r:n+r;return i<0||i>=n?-1:i}Rr(Ur,`toSafeIndex`);function Wr(e){return e!==e||e===0?0:Math.trunc(e)}Rr(Wr,`toSafeInteger`);function Gr(e){let t=e+`CollectionProvider`,[n,r]=Fr(t),[i,a]=n(t,{collectionElement:null,collectionRef:{current:null},collectionRefObject:{current:null},itemMap:new Vr,setItemMap:Rr(()=>void 0,`setItemMap`)}),o=Rr(({state:e,...t})=>e?(0,L.jsx)(c,{...t,state:e}):(0,L.jsx)(s,{...t}),`CollectionProvider`);o.displayName=t;let s=Rr(e=>{let t=h();return(0,L.jsx)(c,{...e,state:t})},`CollectionInit`);s.displayName=t+`Init`;let c=Rr(e=>{let{scope:t,children:n,state:r}=e,a=w.useRef(null),[o,s]=w.useState(null),c=ur(a,s),[l,u]=r;return w.useEffect(()=>{if(!o)return;let e=Yr(()=>{});return e.observe(o,{childList:!0,subtree:!0}),()=>{e.disconnect()}},[o]),(0,L.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=pr(l),d=w.forwardRef((e,t)=>{let{scope:n,children:r}=e,i=ur(t,a(l,n).collectionRef);return(0,L.jsx)(u,{ref:i,children:r})});d.displayName=l;let f=e+`CollectionItemSlot`,p=pr(f),m=w.forwardRef((e,t)=>{let{scope:n,children:r,...i}=e,o=w.useRef(null),[s,c]=w.useState(null),l=ur(t,o,c),{setItemMap:u}=a(f,n),d=w.useRef(i);Kr(d.current,i)||(d.current=i);let m=d.current;return w.useEffect(()=>{let e=m;return u(t=>s?t.has(s)?t.set(s,{...e,element:s}).toSorted(Jr):(t.set(s,{...e,element:s}),t.toSorted(Jr)):t),()=>{u(e=>!s||!e.has(s)?e:(e.delete(s),new Vr(e)))}},[s,m,u]),(0,L.jsx)(p,{"data-radix-collection-item":``,ref:l,children:r})});m.displayName=f;function h(){return w.useState(new Vr)}Rr(h,`useInitCollection`);function g(t){let{itemMap:n}=a(e+`CollectionConsumer`,t);return n}return Rr(g,`useCollection`),[{Provider:o,Slot:d,ItemSlot:m},{createCollectionScope:r,useCollection:g,useInitCollection:h}]}Rr(Gr,`createCollection`);function Kr(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}Rr(Kr,`shallowEqual`);function qr(e,t){return!!(t.compareDocumentPosition(e)&Node.DOCUMENT_POSITION_PRECEDING)}Rr(qr,`isElementPreceding`);function Jr(e,t){return!e[1].element||!t[1].element?0:qr(e[1].element,t[1].element)?-1:1}Rr(Jr,`sortByDocumentPosition`);function Yr(e){return new MutationObserver(t=>{for(let n of t)if(n.type===`childList`){e();return}})}Rr(Yr,`getChildListObserver`);var Xr=Object.defineProperty,Zr=(e,t)=>Xr(e,`name`,{value:t,configurable:!0}),Qr=!!(typeof window<`u`&&window.document&&window.document.createElement);function V(e,t,{checkForDefaultPrevented:n=!0}={}){return Zr(function(r){if(e?.(r),n===!1||!r||!r.defaultPrevented)return t?.(r)},`handleEvent`)}Zr(V,`composeEventHandlers`);function $r(e){if(!Qr)throw Error(`Cannot access window outside of the DOM`);return e?.ownerDocument?.defaultView??window}Zr($r,`getOwnerWindow`);function ei(e){if(!Qr)throw Error(`Cannot access document outside of the DOM`);return e?.ownerDocument??document}Zr(ei,`getOwnerDocument`);function ti(e,t=!1){let{activeElement:n}=ei(e);if(!n?.nodeName)return null;if(ni(n)&&n.contentDocument)return ti(n.contentDocument.body,t);if(t){let e=n.getAttribute(`aria-activedescendant`);if(e){let t=ei(n).getElementById(e);if(t)return t}}return n}Zr(ti,`getActiveElement`);function ni(e){return e.tagName===`IFRAME`}Zr(ni,`isFrame`);var ri=globalThis?.document?w.useLayoutEffect:()=>{},ii=Object.defineProperty,ai=(e,t)=>ii(e,`name`,{value:t,configurable:!0}),oi=w.useEffectEvent,si=w.useInsertionEffect;function ci(e){if(typeof oi==`function`)return oi(e);let t=w.useRef(()=>{throw Error(`Cannot call an event handler while rendering.`)});return typeof si==`function`?si(()=>{t.current=e}):ri(()=>{t.current=e}),w.useMemo(()=>((...e)=>t.current?.(...e)),[])}ai(ci,`useEffectEvent`);var li=Object.defineProperty,ui=(e,t)=>li(e,`name`,{value:t,configurable:!0}),di=w.useInsertionEffect||ri;function fi({prop:e,defaultProp:t,onChange:n=ui(()=>{},`onChange`),caller:r}){let[i,a,o]=pi({defaultProp:t,onChange:n}),s=e!==void 0;return[s?e:i,w.useCallback(t=>{if(s){let n=mi(t)?t(e):t;n!==e&&o.current?.(n)}else a(t)},[s,e,a,o])]}ui(fi,`useControllableState`);function pi({defaultProp:e,onChange:t}){let[n,r]=w.useState(e),i=w.useRef(n),a=w.useRef(t);return di(()=>{a.current=t},[t]),w.useEffect(()=>{i.current!==n&&(a.current?.(n),i.current=n)},[n,i]),[n,r,a]}ui(pi,`useUncontrolledState`);function mi(e){return typeof e==`function`}ui(mi,`isFunction`);var hi=Symbol(`RADIX:SYNC_STATE`);function gi(e,t,n,r){let{prop:i,defaultProp:a,onChange:o,caller:s}=t,c=i!==void 0,l=ci(o),u=[{...n,state:a}];r&&u.push(r);let[d,f]=w.useReducer((t,n)=>{if(n.type===hi)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=w.useRef(p);w.useEffect(()=>{m.current!==p&&(m.current=p,c||l(p))},[p,m,c]);let h=w.useMemo(()=>i===void 0?d:{...d,state:i},[d,i]);return w.useEffect(()=>{c&&!Object.is(i,d.state)&&f({type:hi,state:i})},[i,d.state,c]),[h,f]}ui(gi,`useControllableStateReducer`);var _i=Object.defineProperty,vi=(e,t)=>_i(e,`name`,{value:t,configurable:!0});function yi(e,t){return w.useReducer((e,n)=>t[e][n]??e,e)}vi(yi,`useStateMachine`);var bi=vi(e=>{let{present:t,children:n}=e,r=xi(t),i=typeof n==`function`?n({present:r.isPresent}):w.Children.only(n),a=Ci(r.ref,Ti(i));return typeof n==`function`||r.isPresent?w.cloneElement(i,{ref:a}):null},`Presence`);function xi(e){let[t,n]=w.useState(),r=w.useRef(null),i=w.useRef(e),a=w.useRef(`none`),o=w.useRef(void 0),[s,c]=yi(e?`mounted`:`unmounted`,{mounted:{UNMOUNT:`unmounted`,ANIMATION_OUT:`unmountSuspended`},unmountSuspended:{MOUNT:`mounted`,ANIMATION_END:`unmounted`},unmounted:{MOUNT:`mounted`}});return w.useEffect(()=>{s===`mounted`?(a.current=o.current??wi(r.current),o.current=void 0):a.current=`none`},[s]),ri(()=>{let t=r.current,n=i.current;if(n!==e){let r=a.current,s=wi(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]),ri(()=>{if(t){let e,n=t.ownerDocument.defaultView??window,o=vi(a=>{let o=wi(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=vi(e=>{e.target===t&&(a.current=wi(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)}}c(`ANIMATION_END`)},[t,c]),{isPresent:[`mounted`,`unmountSuspended`].includes(s),ref:w.useCallback(e=>{if(e){let t=getComputedStyle(e);r.current=t,o.current=wi(t)}else r.current=null;n(e)},[])}}vi(xi,`usePresence`);function Si(e,t){if(typeof e==`function`)return e(t);e!=null&&(e.current=t)}vi(Si,`setRef`);function Ci(...e){let t=w.useRef(e);return t.current=e,w.useCallback(e=>{let n=t.current,r=!1,i=n.map(t=>{let n=Si(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():Si(n[e],null)}}},[])}vi(Ci,`useStableComposedRefs`);function wi(e){return e?.animationName||`none`}vi(wi,`getAnimationName`);function Ti(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)}vi(Ti,`getElementRef`);var Ei=Object.defineProperty,Di=(e,t)=>Ei(e,`name`,{value:t,configurable:!0}),Oi=w.useId||(()=>void 0),ki=0;function Ai(e){let[t,n]=w.useState(Oi());return ri(()=>{e||n(e=>e??String(ki++))},[e]),e||(t?`radix-${t}`:``)}Di(Ai,`useId`);var ji=Object.defineProperty,Mi=(e,t)=>ji(e,`name`,{value:t,configurable:!0}),Ni=w.createContext(void 0);function Pi(e){let t=w.useContext(Ni);return e||t||`ltr`}Mi(Pi,`useDirection`);var Fi=Object.defineProperty,Ii=(e,t)=>Fi(e,`name`,{value:t,configurable:!0});function Li(e){let t=w.useRef(e);return w.useEffect(()=>{t.current=e}),w.useMemo(()=>((...e)=>t.current?.(...e)),[])}Ii(Li,`useCallbackRef`);var Ri=Object.defineProperty,zi=(e,t)=>Ri(e,`name`,{value:t,configurable:!0}),Bi=`dismissableLayer.update`,Vi=`dismissableLayer.pointerDownOutside`,Hi=`dismissableLayer.focusOutside`,Ui,Wi=w.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set,dismissableSurfaces:new Set}),Gi=w.forwardRef(zi(function(e,t){let{disableOutsidePointerEvents:n=!1,deferPointerDownOutside:r=!1,onEscapeKeyDown:i,onPointerDownOutside:a,onFocusOutside:o,onInteractOutside:s,onDismiss:c,...l}=e,u=w.useContext(Wi),[d,f]=w.useState(null),p=d?.ownerDocument??globalThis?.document,[,m]=w.useState({}),h=ur(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=w.useRef(!1),C=Ji(e=>{a?.(e),s?.(e),e.defaultPrevented||c?.()},{ownerDocument:p,deferPointerDownOutside:r,isDeferredPointerDownOutsideRef:S,dismissableSurfaces:u.dismissableSurfaces,shouldHandlePointerDownOutside:w.useCallback(e=>{if(!(e instanceof Node))return!1;let t=[...u.branches].some(t=>t.contains(e));return x&&!t},[u.branches,x])}),T=Yi(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),E=d?y===g.length-1:!1,D=Li(e=>{e.key===`Escape`&&(i?.(e),!e.defaultPrevented&&c&&(e.preventDefault(),c()))});return w.useEffect(()=>{if(E)return p.addEventListener(`keydown`,D,{capture:!0}),()=>p.removeEventListener(`keydown`,D,{capture:!0})},[p,E,D]),w.useEffect(()=>{if(d)return n&&(u.layersWithOutsidePointerEventsDisabled.size===0&&(Ui=p.body.style.pointerEvents,p.body.style.pointerEvents=`none`),u.layersWithOutsidePointerEventsDisabled.add(d)),u.layers.add(d),Xi(),()=>{n&&(u.layersWithOutsidePointerEventsDisabled.delete(d),u.layersWithOutsidePointerEventsDisabled.size===0&&(p.body.style.pointerEvents=Ui))}},[d,p,n,u]),w.useEffect(()=>()=>{d&&(u.layers.delete(d),u.layersWithOutsidePointerEventsDisabled.delete(d),Xi())},[d,u]),w.useEffect(()=>{let e=zi(()=>m({}),`handleUpdate`);return document.addEventListener(Bi,e),()=>document.removeEventListener(Bi,e)},[]),(0,L.jsx)(Ar.div,{...l,ref:h,style:{pointerEvents:b?x?`auto`:`none`:void 0,...e.style},onFocusCapture:V(e.onFocusCapture,T.onFocusCapture),onBlurCapture:V(e.onBlurCapture,T.onBlurCapture),onPointerDownCapture:V(e.onPointerDownCapture,C.onPointerDownCapture)})},`DismissableLayer`));function Ki(){let e=w.useContext(Wi),[t,n]=w.useState(null);return w.useEffect(()=>{if(t)return e.dismissableSurfaces.add(t),()=>{e.dismissableSurfaces.delete(t)}},[t,e.dismissableSurfaces]),n}zi(Ki,`useDismissableLayerSurface`);var qi=zi(()=>!0,`IS_TRUE`);function Ji(e,t){let{ownerDocument:n=globalThis?.document,deferPointerDownOutside:r=!1,isDeferredPointerDownOutsideRef:i,dismissableSurfaces:a,shouldHandlePointerDownOutside:o=qi}=t,s=Li(e),c=w.useRef(!1),l=w.useRef(!1),u=w.useRef(new Map),d=w.useRef(()=>{});return w.useEffect(()=>{function e(){l.current=!1,i.current=!1,u.current.clear()}zi(e,`resetOutsideInteraction`);function t(){return Array.from(u.current.values()).some(Boolean)}zi(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)}zi(f,`handleInteractionCapture`);function p(e){l.current&&u.current.set(e.type,!1)}zi(p,`handleInteractionBubble`);let m=zi(a=>{if(a.target&&!c.current){let f=function(){n.removeEventListener(`click`,d.current);let r=t();e(),r||Zi(Vi,s,p,{discrete:!0})};if(zi(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:zi(()=>c.current=!0,`onPointerDownCapture`)}}zi(Ji,`usePointerDownOutside`);function Yi(e,t=globalThis?.document){let n=Li(e),r=w.useRef(!1);return w.useEffect(()=>{let e=zi(e=>{e.target&&!r.current&&Zi(Hi,n,{originalEvent:e},{discrete:!1})},`handleFocus`);return t.addEventListener(`focusin`,e),()=>t.removeEventListener(`focusin`,e)},[t,n]),{onFocusCapture:zi(()=>r.current=!0,`onFocusCapture`),onBlurCapture:zi(()=>r.current=!1,`onBlurCapture`)}}zi(Yi,`useFocusOutside`);function Xi(){let e=new CustomEvent(Bi);document.dispatchEvent(e)}zi(Xi,`dispatchUpdate`);function Zi(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?jr(i,a):i.dispatchEvent(a)}zi(Zi,`handleAndDispatchCustomEvent`);var Qi=Object.defineProperty,$i=(e,t)=>Qi(e,`name`,{value:t,configurable:!0}),ea=`focusScope.autoFocusOnMount`,ta=`focusScope.autoFocusOnUnmount`,na={bubbles:!1,cancelable:!0},ra=w.forwardRef($i(function(e,t){let{loop:n=!1,trapped:r=!1,onMountAutoFocus:i,onUnmountAutoFocus:a,...o}=e,[s,c]=w.useState(null),l=Li(i),u=Li(a),d=w.useRef(null),f=ur(t,c),p=w.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;w.useEffect(()=>{if(r){let e=function(e){if(p.paused||!s)return;let t=e.target;s.contains(t)?d.current=t:ua(d.current,{select:!0})},t=function(e){if(p.paused||!s)return;let t=e.relatedTarget;t!==null&&(s.contains(t)||ua(d.current,{select:!0}))},n=function(e){if(document.activeElement===document.body)for(let t of e)t.removedNodes.length>0&&ua(s)};$i(e,`handleFocusIn`),$i(t,`handleFocusOut`),$i(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]),w.useEffect(()=>{if(s){da.add(p);let e=document.activeElement;if(!s.contains(e)){let t=new CustomEvent(ea,na);s.addEventListener(ea,l),s.dispatchEvent(t),t.defaultPrevented||(ia(ma(oa(s)),{select:!0}),document.activeElement===e&&ua(s))}return()=>{s.removeEventListener(ea,l),setTimeout(()=>{let t=new CustomEvent(ta,na);s.addEventListener(ta,u),s.dispatchEvent(t),t.defaultPrevented||ua(e??document.body,{select:!0}),s.removeEventListener(ta,u),da.remove(p)},0)}}},[s,l,u,p]);let m=w.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]=aa(t);r&&a?!e.shiftKey&&i===a?(e.preventDefault(),n&&ua(r,{select:!0})):e.shiftKey&&i===r&&(e.preventDefault(),n&&ua(a,{select:!0})):i===t&&e.preventDefault()}},[n,r,p.paused]);return(0,L.jsx)(Ar.div,{tabIndex:-1,...o,ref:f,onKeyDown:m})},`FocusScope`));function ia(e,{select:t=!1}={}){let n=document.activeElement;for(let r of e)if(ua(r,{select:t}),document.activeElement!==n)return}$i(ia,`focusFirst`);function aa(e){let t=oa(e);return[sa(t,e),sa(t.reverse(),e)]}$i(aa,`getTabbableEdges`);function oa(e){let t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:$i(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}$i(oa,`getTabbableCandidates`);function sa(e,t){let n=typeof t.checkVisibility==`function`&&t.checkVisibility({checkVisibilityCSS:!0});for(let r of e)if(!(n?!r.checkVisibility({checkVisibilityCSS:!0}):ca(r,{upTo:t})))return r}$i(sa,`findVisible`);function ca(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}$i(ca,`isHidden`);function la(e){return e instanceof HTMLInputElement&&`select`in e}$i(la,`isSelectableInput`);function ua(e,{select:t=!1}={}){if(e&&e.focus){let n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&la(e)&&t&&e.select()}}$i(ua,`focus`);var da=fa();function fa(){let e=[];return{add(t){let n=e[0];t!==n&&n?.pause(),e=pa(e,t),e.unshift(t)},remove(t){e=pa(e,t),e[0]?.resume()}}}$i(fa,`createFocusScopesStack`);function pa(e,t){let n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}$i(pa,`arrayRemove`);function ma(e){return e.filter(e=>e.tagName!==`A`)}$i(ma,`removeLinks`);var ha=Object.defineProperty,ga=w.forwardRef(((e,t)=>ha(e,`name`,{value:t,configurable:!0}))(function(e,t){let{container:n,...r}=e,[i,a]=w.useState(!1);ri(()=>a(!0),[]);let o=n||i&&globalThis?.document?.body;return o?Dr.createPortal((0,L.jsx)(Ar.div,{...r,ref:t}),o):null},`Portal`)),_a=Object.defineProperty,va=(e,t)=>_a(e,`name`,{value:t,configurable:!0}),ya=0,ba=null;function xa(e){return Sa(),e.children}va(xa,`FocusGuards`);function Sa(){w.useEffect(()=>{ba||={start:Ca(),end:Ca()};let{start:e,end:t}=ba;return document.body.firstElementChild!==e&&document.body.insertAdjacentElement(`afterbegin`,e),document.body.lastElementChild!==t&&document.body.insertAdjacentElement(`beforeend`,t),ya++,()=>{ya===1&&(ba?.start.remove(),ba?.end.remove(),ba=null),ya=Math.max(0,ya-1)}},[])}va(Sa,`useFocusGuards`);function Ca(){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}va(Ca,`createFocusGuard`);var wa=function(){return wa=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},wa.apply(this,arguments)};function Ta(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 Ea(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 Da=`right-scroll-bar-position`,Oa=`width-before-scroll-bar`,ka=`with-scroll-bars-hidden`,Aa=`--removed-body-scroll-bar-size`;function ja(e,t){return typeof e==`function`?e(t):e&&(e.current=t),e}function Ma(e,t){var n=(0,w.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 Na=typeof window<`u`?w.useLayoutEffect:w.useEffect,Pa=new WeakMap;function Fa(e,t){var n=Ma(t||null,function(t){return e.forEach(function(e){return ja(e,t)})});return Na(function(){var t=Pa.get(n);if(t){var r=new Set(t),i=new Set(e),a=n.current;r.forEach(function(e){i.has(e)||ja(e,null)}),i.forEach(function(e){r.has(e)||ja(e,a)})}Pa.set(n,e)},[e]),n}function Ia(e){return e}function La(e,t){t===void 0&&(t=Ia);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 Ra(e){e===void 0&&(e={});var t=La(null);return t.options=wa({async:!0,ssr:!1},e),t}var za=function(e){var t=e.sideCar,n=Ta(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 w.createElement(r,wa({},n))};za.isSideCarExport=!0;function Ba(e,t){return e.useMedium(t),za}var Va=Ra(),Ha=function(){},Ua=w.forwardRef(function(e,t){var n=w.useRef(null),r=w.useState({onScrollCapture:Ha,onWheelCapture:Ha,onTouchMoveCapture:Ha}),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=Ta(e,[`forwardProps`,`children`,`className`,`removeScrollBar`,`enabled`,`shards`,`sideCar`,`noRelative`,`noIsolation`,`inert`,`allowPinchZoom`,`as`,`gapMode`]),x=f,S=Fa([n,t]),C=wa(wa({},b),i);return w.createElement(w.Fragment,null,u&&w.createElement(x,{sideCar:Va,removeScrollBar:l,shards:d,noRelative:p,noIsolation:m,inert:h,setCallbacks:a,allowPinchZoom:!!g,lockRef:n,gapMode:y}),o?w.cloneElement(w.Children.only(s),wa(wa({},C),{ref:S})):w.createElement(v,wa({},C,{className:c,ref:S}),s))});Ua.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1},Ua.classNames={fullWidth:Oa,zeroRight:Da};var Wa,Ga=function(){if(Wa)return Wa;if(typeof __webpack_nonce__<`u`)return __webpack_nonce__};function Ka(){if(!document)return null;var e=document.createElement(`style`);e.type=`text/css`;var t=Ga();return t&&e.setAttribute(`nonce`,t),e}function qa(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function Ja(e){(document.head||document.getElementsByTagName(`head`)[0]).appendChild(e)}var Ya=function(){var e=0,t=null;return{add:function(n){e==0&&(t=Ka())&&(qa(t,n),Ja(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},Xa=function(){var e=Ya();return function(t,n){w.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},Za=function(){var e=Xa();return function(t){var n=t.styles,r=t.dynamic;return e(n,r),null}},Qa={left:0,top:0,right:0,gap:0},$a=function(e){return parseInt(e||``,10)||0},eo=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[$a(n),$a(r),$a(i)]},to=function(e){if(e===void 0&&(e=`margin`),typeof window>`u`)return Qa;var t=eo(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])}},no=Za(),ro=`data-scroll-locked`,io=function(e,t,n,r){var i=e.left,a=e.top,o=e.right,s=e.gap;return n===void 0&&(n=`margin`),`
|
|
10
|
-
.${ka} {
|
|
11
|
-
overflow: hidden ${r};
|
|
12
|
-
padding-right: ${s}px ${r};
|
|
13
|
-
}
|
|
14
|
-
body[${ro}] {
|
|
15
|
-
overflow: hidden ${r};
|
|
16
|
-
overscroll-behavior: contain;
|
|
17
|
-
${[t&&`position: relative ${r};`,n===`margin`&&`
|
|
18
|
-
padding-left: ${i}px;
|
|
19
|
-
padding-top: ${a}px;
|
|
20
|
-
padding-right: ${o}px;
|
|
21
|
-
margin-left:0;
|
|
22
|
-
margin-top:0;
|
|
23
|
-
margin-right: ${s}px ${r};
|
|
24
|
-
`,n===`padding`&&`padding-right: ${s}px ${r};`].filter(Boolean).join(``)}
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
.${Da} {
|
|
28
|
-
right: ${s}px ${r};
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
.${Oa} {
|
|
32
|
-
margin-right: ${s}px ${r};
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
.${Da} .${Da} {
|
|
36
|
-
right: 0 ${r};
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
.${Oa} .${Oa} {
|
|
40
|
-
margin-right: 0 ${r};
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
body[${ro}] {
|
|
44
|
-
${Aa}: ${s}px;
|
|
45
|
-
}
|
|
46
|
-
`},ao=function(){var e=parseInt(document.body.getAttribute(`data-scroll-locked`)||`0`,10);return isFinite(e)?e:0},oo=function(){w.useEffect(function(){return document.body.setAttribute(ro,(ao()+1).toString()),function(){var e=ao()-1;e<=0?document.body.removeAttribute(ro):document.body.setAttribute(ro,e.toString())}},[])},so=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,i=r===void 0?`margin`:r;oo();var a=w.useMemo(function(){return to(i)},[i]);return w.createElement(no,{styles:io(a,!t,i,n?``:`!important`)})},co=!1;if(typeof window<`u`)try{var lo=Object.defineProperty({},"passive",{get:function(){return co=!0,!0}});window.addEventListener(`test`,lo,lo),window.removeEventListener(`test`,lo,lo)}catch{co=!1}var uo=co?{passive:!1}:!1,fo=function(e){return e.tagName===`TEXTAREA`},po=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!==`hidden`&&!(n.overflowY===n.overflowX&&!fo(e)&&n[t]===`visible`)},mo=function(e){return po(e,`overflowY`)},ho=function(e){return po(e,`overflowX`)},go=function(e,t){var n=t.ownerDocument,r=t;do{if(typeof ShadowRoot<`u`&&r instanceof ShadowRoot&&(r=r.host),yo(e,r)){var i=bo(e,r);if(i[1]>i[2])return!0}r=r.parentNode}while(r&&r!==n.body);return!1},_o=function(e){return[e.scrollTop,e.scrollHeight,e.clientHeight]},vo=function(e){return[e.scrollLeft,e.scrollWidth,e.clientWidth]},yo=function(e,t){return e===`v`?mo(t):ho(t)},bo=function(e,t){return e===`v`?_o(t):vo(t)},xo=function(e,t){return e===`h`&&t===`rtl`?-1:1},So=function(e,t,n,r,i){var a=xo(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=bo(e,s),m=p[0],h=p[1]-p[2]-a*m;(m||h)&&yo(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},Co=function(e){return`changedTouches`in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},wo=function(e){return[e.deltaX,e.deltaY]},To=function(e){return e&&`current`in e?e.current:e},Eo=function(e,t){return e[0]===t[0]&&e[1]===t[1]},Do=function(e){return`
|
|
47
|
-
.block-interactivity-${e} {pointer-events: none;}
|
|
48
|
-
.allow-interactivity-${e} {pointer-events: all;}
|
|
49
|
-
`},Oo=0,ko=[];function Ao(e){var t=w.useRef([]),n=w.useRef([0,0]),r=w.useRef(),i=w.useState(Oo++)[0],a=w.useState(Za)[0],o=w.useRef(e);w.useEffect(function(){o.current=e},[e]),w.useEffect(function(){if(e.inert){document.body.classList.add(`block-interactivity-${i}`);var t=Ea([e.lockRef.current],(e.shards||[]).map(To),!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=w.useCallback(function(e,t){if(`touches`in e&&e.touches.length===2||e.type===`wheel`&&e.ctrlKey)return!o.current.allowPinchZoom;var i=Co(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=go(d,u);if(!m)return!0;if(m?l=d:(l=d===`v`?`h`:`v`,m=go(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 So(h,t,e,h===`h`?s:c,!0)},[]),c=w.useCallback(function(e){var n=e;if(!(!ko.length||ko[ko.length-1]!==a)){var r=`deltaY`in n?wo(n):Co(n),i=t.current.filter(function(e){return e.name===n.type&&(e.target===n.target||n.target===e.shadowParent)&&Eo(e.delta,r)})[0];if(i&&i.should){n.cancelable&&n.preventDefault();return}if(!i){var c=(o.current.shards||[]).map(To).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=w.useCallback(function(e,n,r,i){var a={name:e,delta:n,target:r,should:i,shadowParent:jo(r)};t.current.push(a),setTimeout(function(){t.current=t.current.filter(function(e){return e!==a})},1)},[]),u=w.useCallback(function(e){n.current=Co(e),r.current=void 0},[]),d=w.useCallback(function(t){l(t.type,wo(t),t.target,s(t,e.lockRef.current))},[]),f=w.useCallback(function(t){l(t.type,Co(t),t.target,s(t,e.lockRef.current))},[]);w.useEffect(function(){return ko.push(a),e.setCallbacks({onScrollCapture:d,onWheelCapture:d,onTouchMoveCapture:f}),document.addEventListener(`wheel`,c,uo),document.addEventListener(`touchmove`,c,uo),document.addEventListener(`touchstart`,u,uo),function(){ko=ko.filter(function(e){return e!==a}),document.removeEventListener(`wheel`,c,uo),document.removeEventListener(`touchmove`,c,uo),document.removeEventListener(`touchstart`,u,uo)}},[]);var p=e.removeScrollBar,m=e.inert;return w.createElement(w.Fragment,null,m?w.createElement(a,{styles:Do(i)}):null,p?w.createElement(so,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function jo(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}var Mo=Ba(Va,Ao),No=w.forwardRef(function(e,t){return w.createElement(Ua,wa({},e,{ref:t,sideCar:Mo}))});No.classNames=Ua.classNames;var Po=function(e){return typeof document>`u`?null:(Array.isArray(e)?e[0]:e).ownerDocument.body},Fo=new WeakMap,Io=new WeakMap,Lo={},Ro=0,zo=function(e){return e&&(e.host||zo(e.parentNode))},Bo=function(e,t){return t.map(function(t){if(e.contains(t))return t;var n=zo(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})},Vo=function(e,t,n,r){var i=Bo(t,Array.isArray(e)?e:[e]);Lo[n]||(Lo[n]=new WeakMap);var a=Lo[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=(Fo.get(e)||0)+1,l=(a.get(e)||0)+1;Fo.set(e,c),a.set(e,l),o.push(e),c===1&&i&&Io.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(),Ro++,function(){o.forEach(function(e){var t=Fo.get(e)-1,i=a.get(e)-1;Fo.set(e,t),a.set(e,i),t||(Io.has(e)||e.removeAttribute(r),Io.delete(e)),i||e.removeAttribute(n)}),Ro--,Ro||(Fo=new WeakMap,Fo=new WeakMap,Io=new WeakMap,Lo={})}},Ho=function(e,t,n){n===void 0&&(n=`data-aria-hidden`);var r=Array.from(Array.isArray(e)?e:[e]),i=t||Po(e);return i?(r.push.apply(r,Array.from(i.querySelectorAll(`[aria-live], script`))),Vo(r,i,n,`aria-hidden`)):function(){return null}},Uo=Object.defineProperty,Wo=(e,t)=>Uo(e,`name`,{value:t,configurable:!0}),Go=`Dialog`,[Ko,qo]=Fr(Go),[Jo,Yo]=Ko(Go),Xo=Wo(e=>{let{__scopeDialog:t,children:n,open:r,defaultOpen:i,onOpenChange:a,modal:o=!0}=e,s=w.useRef(null),c=w.useRef(null),[l,u]=fi({prop:r,defaultProp:i??!1,onChange:a,caller:Go}),[d,f]=w.useState(0),[p,m]=w.useState(0);return(0,L.jsx)(Jo,{scope:t,triggerRef:s,contentRef:c,contentId:Ai(),titleId:Ai(),descriptionId:Ai(),titlePresent:d>0,descriptionPresent:p>0,setTitleCount:f,setDescriptionCount:m,open:l,onOpenChange:u,onOpenToggle:w.useCallback(()=>u(e=>!e),[u]),modal:o,children:n})},`Dialog`),Zo=`DialogTrigger`,Qo=w.forwardRef(Wo(function(e,t){let{__scopeDialog:n,...r}=e,i=Yo(Zo,n),a=ur(t,i.triggerRef);return(0,L.jsx)(Ar.button,{type:`button`,"aria-haspopup":`dialog`,"aria-expanded":i.open,"aria-controls":i.open?i.contentId:void 0,"data-state":vs(i.open),...r,ref:a,onClick:V(e.onClick,i.onOpenToggle)})},`DialogTrigger`)),$o=`DialogPortal`,[es,ts]=Ko($o,{forceMount:void 0}),ns=Wo(e=>{let{__scopeDialog:t,forceMount:n,children:r,container:i}=e,a=Yo($o,t);return(0,L.jsx)(es,{scope:t,forceMount:n,children:w.Children.map(r,e=>(0,L.jsx)(bi,{present:n||a.open,children:(0,L.jsx)(ga,{asChild:!0,container:i,children:e})}))})},`DialogPortal`),rs=`DialogOverlay`,is=w.forwardRef(Wo(function(e,t){let n=ts(rs,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,a=Yo(rs,e.__scopeDialog);return a.modal?(0,L.jsx)(bi,{present:r||a.open,children:(0,L.jsx)(os,{...i,ref:t})}):null},`DialogOverlay`)),as=pr(`DialogOverlay.RemoveScroll`),os=w.forwardRef(Wo(function(e,t){let{__scopeDialog:n,...r}=e,i=Yo(rs,n),a=ur(t,Ki());return(0,L.jsx)(No,{as,allowPinchZoom:!0,shards:[i.contentRef],children:(0,L.jsx)(Ar.div,{"data-state":vs(i.open),...r,ref:a,style:{pointerEvents:`auto`,...r.style}})})},`DialogOverlayImpl`)),ss=`DialogContent`,cs=w.forwardRef(Wo(function(e,t){let n=ts(ss,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,a=Yo(ss,e.__scopeDialog);return(0,L.jsx)(bi,{present:r||a.open,children:a.modal?(0,L.jsx)(ls,{...i,ref:t}):(0,L.jsx)(us,{...i,ref:t})})},`DialogContent`)),ls=w.forwardRef(Wo(function(e,t){let n=Yo(ss,e.__scopeDialog),r=w.useRef(null),i=ur(t,n.contentRef,r);return w.useEffect(()=>{let e=r.current;if(e)return Ho(e)},[]),(0,L.jsx)(ds,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:n.open,onCloseAutoFocus:V(e.onCloseAutoFocus,e=>{e.preventDefault(),n.triggerRef.current?.focus()}),onPointerDownOutside:V(e.onPointerDownOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0;(t.button===2||n)&&e.preventDefault()}),onFocusOutside:V(e.onFocusOutside,e=>e.preventDefault())})},`DialogContentModal`)),us=w.forwardRef(Wo(function(e,t){let n=Yo(ss,e.__scopeDialog),r=w.useRef(!1),i=w.useRef(!1);return(0,L.jsx)(ds,{...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`)),ds=w.forwardRef(Wo(function(e,t){let{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:a,...o}=e,s=Yo(ss,n);return Sa(),(0,L.jsx)(L.Fragment,{children:(0,L.jsx)(ra,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:a,children:(0,L.jsx)(Gi,{role:`dialog`,id:s.contentId,"aria-describedby":s.descriptionPresent?s.descriptionId:void 0,"aria-labelledby":s.titlePresent?s.titleId:void 0,"data-state":vs(s.open),...o,ref:t,deferPointerDownOutside:!0,onDismiss:()=>s.onOpenChange(!1)})})})},`DialogContentImpl`)),fs=`DialogTitle`,ps=w.forwardRef(Wo(function(e,t){let{__scopeDialog:n,...r}=e,i=Yo(fs,n),{setTitleCount:a}=i;return ri(()=>(a(e=>e+1),()=>a(e=>e-1)),[a]),(0,L.jsx)(Ar.h2,{id:i.titleId,...r,ref:t})},`DialogTitle`)),ms=`DialogDescription`,hs=w.forwardRef(Wo(function(e,t){let{__scopeDialog:n,...r}=e,i=Yo(ms,n),{setDescriptionCount:a}=i;return ri(()=>(a(e=>e+1),()=>a(e=>e-1)),[a]),(0,L.jsx)(Ar.p,{id:i.descriptionId,...r,ref:t})},`DialogDescription`)),gs=`DialogClose`,_s=w.forwardRef(Wo(function(e,t){let{__scopeDialog:n,...r}=e,i=Yo(gs,n);return(0,L.jsx)(Ar.button,{type:`button`,...r,ref:t,onClick:V(e.onClick,()=>i.onOpenChange(!1))})},`DialogClose`));function vs(e){return e?`open`:`closed`}Wo(vs,`getState`);var ys=Object.defineProperty,bs=(e,t)=>ys(e,`name`,{value:t,configurable:!0});function xs(e){let[t,n]=w.useState(void 0);return ri(()=>{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)}n(void 0)},[e]),t}bs(xs,`useSize`);var Ss=[`top`,`right`,`bottom`,`left`],Cs=Math.min,ws=Math.max,Ts=Math.round,Es=Math.floor,Ds=e=>({x:e,y:e}),Os={left:`right`,right:`left`,bottom:`top`,top:`bottom`};function ks(e,t,n){return ws(e,Cs(t,n))}function As(e,t){return typeof e==`function`?e(t):e}function js(e){return e.split(`-`)[0]}function Ms(e){return e.split(`-`)[1]}function Ns(e){return e===`x`?`y`:`x`}function Ps(e){return e===`y`?`height`:`width`}function Fs(e){let t=e[0];return t===`t`||t===`b`?`y`:`x`}function Is(e){return Ns(Fs(e))}function Ls(e,t,n){n===void 0&&(n=!1);let r=Ms(e),i=Is(e),a=Ps(i),o=i===`x`?r===(n?`end`:`start`)?`right`:`left`:r===`start`?`bottom`:`top`;return t.reference[a]>t.floating[a]&&(o=Ks(o)),[o,Ks(o)]}function Rs(e){let t=Ks(e);return[zs(e),t,zs(t)]}function zs(e){return e.includes(`start`)?e.replace(`start`,`end`):e.replace(`end`,`start`)}var Bs=[`left`,`right`],Vs=[`right`,`left`],Hs=[`top`,`bottom`],Us=[`bottom`,`top`];function Ws(e,t,n){switch(e){case`top`:case`bottom`:return n?t?Vs:Bs:t?Bs:Vs;case`left`:case`right`:return t?Hs:Us;default:return[]}}function Gs(e,t,n,r){let i=Ms(e),a=Ws(js(e),n===`start`,r);return i&&(a=a.map(e=>e+`-`+i),t&&(a=a.concat(a.map(zs)))),a}function Ks(e){let t=js(e);return Os[t]+e.slice(t.length)}function qs(e){return{top:e.top??0,right:e.right??0,bottom:e.bottom??0,left:e.left??0}}function Js(e){return typeof e==`number`?{top:e,right:e,bottom:e,left:e}:qs(e)}function Ys(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 Xs(e,t,n){let{reference:r,floating:i}=e,a=Fs(t),o=Is(t),s=Ps(o),c=js(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=Ms(t);return m&&(p[o]+=f*(m===`end`?1:-1)*(n&&l?-1:1)),p}async function Zs(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}=As(t,e),p=Js(f),m=o[d?u===`floating`?`reference`:`floating`:u],h=Ys(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=Ys(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 Qs=50,$s=async(e,t,n)=>{let{placement:r=`bottom`,strategy:i=`absolute`,middleware:a=[],platform:o}=n,s=o.detectOverflow?o:{...o,detectOverflow:Zs},c=await(o.isRTL==null?void 0:o.isRTL(t)),l=await o.getElementRects({reference:e,floating:t,strategy:i}),{x:u,y:d}=Xs(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<Qs&&(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}=Xs(l,f,c)),n=-1)}return{x:u,y:d,placement:f,strategy:i,middlewareData:m}},ec=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}=As(e,t)||{};if(l==null)return{};let d=Js(u),f={x:n,y:r},p=Is(i),m=Ps(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=Cs(d[_],T),D=Cs(d[v],T),O=C-h[m]-D,k=C/2-h[m]/2+w,ee=ks(E,k,O),A=!c.arrow&&Ms(i)!=null&&k!==ee&&a.reference[m]/2-(k<E?E:D)-h[m]/2<0,j=A?k<E?k-E:k-O:0;return{[p]:f[p]+j,data:{[p]:ee,centerOffset:k-ee-j,...A&&{alignmentOffset:j}},reset:A}}}),tc=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}=As(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};let g=js(r),_=Fs(o),v=js(o)===o,y=await(s.isRTL==null?void 0:s.isRTL(c.floating)),b=d||(v||!m?[Ks(o)]:Rs(o)),x=p!==`none`;!d&&x&&b.push(...Gs(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=Ls(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`||_===Fs(t)||T.every(e=>Fs(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=Fs(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}if(r!==n)return{reset:{placement:n}}}return{}}}};function nc(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function rc(e){return Ss.some(t=>e[t]>=0)}var ic=function(e){return e===void 0&&(e={}),{name:`hide`,options:e,async fn(t){let{rects:n,platform:r}=t,{strategy:i=`referenceHidden`,...a}=As(e,t);switch(i){case`referenceHidden`:{let e=nc(await r.detectOverflow(t,{...a,elementContext:`reference`}),n.reference);return{data:{referenceHiddenOffsets:e,referenceHidden:rc(e)}}}case`escaped`:{let e=nc(await r.detectOverflow(t,{...a,altBoundary:!0}),n.floating);return{data:{escapedOffsets:e,escaped:rc(e)}}}default:return{}}}}},ac=new Set([`left`,`top`]);async function oc(e,t){let{placement:n,platform:r,elements:i}=e,a=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=js(n),s=Ms(n),c=Fs(n)===`y`,l=ac.has(o)?-1:1,u=a&&c?-1:1,d=As(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 sc=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 oc(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}}}}},cc=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}=As(e,t),u={x:n,y:r},d=await a.detectOverflow(t,l),f=Fs(i),p=Ns(f),m=u[p],h=u[f],g=(e,t)=>ks(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}}}}}},lc=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}=As(e,t),u={x:n,y:r},d=Fs(i),f=Ns(d),p=u[f],m=u[d],h=As(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=ac.has(js(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}}}},uc=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}=As(e,t),c=await i.detectOverflow(t,s),l=js(n),u=Ms(n),d=Fs(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=Cs(p-c[m],g),y=Cs(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*ws(c.left,c.right):S=p-2*ws(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 dc(){return typeof window<`u`}function fc(e){return hc(e)?(e.nodeName||``).toLowerCase():`#document`}function pc(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function mc(e){return((hc(e)?e.ownerDocument:e.document)||window.document)?.documentElement}function hc(e){return dc()?e instanceof Node||e instanceof pc(e).Node:!1}function gc(e){return dc()?e instanceof Element||e instanceof pc(e).Element:!1}function _c(e){return dc()?e instanceof HTMLElement||e instanceof pc(e).HTMLElement:!1}function vc(e){return!dc()||typeof ShadowRoot>`u`?!1:e instanceof ShadowRoot||e instanceof pc(e).ShadowRoot}function yc(e){let{overflow:t,overflowX:n,overflowY:r,display:i}=Ac(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&i!==`inline`&&i!==`contents`}function bc(e){return/^(table|td|th)$/.test(fc(e))}function xc(e){try{if(e.matches(`:popover-open`))return!0}catch{}try{return e.matches(`:modal`)}catch{return!1}}var Sc=/transform|translate|scale|rotate|perspective|filter/,Cc=/paint|layout|strict|content/,wc=e=>!!e&&e!==`none`,Tc;function Ec(e){let t=gc(e)?Ac(e):e;return wc(t.transform)||wc(t.translate)||wc(t.scale)||wc(t.rotate)||wc(t.perspective)||!Oc()&&(wc(t.backdropFilter)||wc(t.filter))||Sc.test(t.willChange||``)||Cc.test(t.contain||``)}function Dc(e){let t=Mc(e);for(;_c(t)&&!kc(t);){if(Ec(t))return t;if(xc(t))return null;t=Mc(t)}return null}function Oc(){return Tc??=typeof CSS<`u`&&CSS.supports&&CSS.supports(`-webkit-backdrop-filter`,`none`),Tc}function kc(e){return/^(html|body|#document)$/.test(fc(e))}function Ac(e){return pc(e).getComputedStyle(e)}function jc(e){return gc(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Mc(e){if(fc(e)===`html`)return e;let t=e.assignedSlot||e.parentNode||vc(e)&&e.host||mc(e);return vc(t)?t.host:t}function Nc(e){let t=Mc(e);return kc(t)?(e.ownerDocument||e).body:_c(t)&&yc(t)?t:Nc(t)}function Pc(e,t,n){t===void 0&&(t=[]),n===void 0&&(n=!0);let r=Nc(e),i=r===e.ownerDocument?.body,a=pc(r);if(i){let e=Fc(a);return t.concat(a,a.visualViewport||[],yc(r)?r:[],e&&n?Pc(e):[])}return t.concat(r,Pc(r,[],n))}function Fc(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function Ic(e){let t=Ac(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,i=_c(e),a=i?e.offsetWidth:n,o=i?e.offsetHeight:r,s=Ts(n)!==a||Ts(r)!==o;return s&&(n=a,r=o),{width:n,height:r,$:s}}function Lc(e){return gc(e)?e:e.contextElement}function Rc(e){let t=Lc(e);if(!_c(t))return Ds(1);let n=t.getBoundingClientRect(),{width:r,height:i,$:a}=Ic(t),o=(a?Ts(n.width):n.width)/r,s=(a?Ts(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!s||!Number.isFinite(s))&&(s=1),{x:o,y:s}}var zc=Ds(0);function Bc(e){let t=pc(e);return!Oc()||!t.visualViewport?zc:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function Vc(e,t,n){return t===void 0&&(t=!1),!!n&&t&&n===pc(e)}function Hc(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);let i=e.getBoundingClientRect(),a=Lc(e),o=Ds(1);t&&(r?gc(r)&&(o=Rc(r)):o=Rc(e));let s=Vc(a,n,r)?Bc(a):Ds(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=pc(a),t=gc(r)?pc(r):r,n=e,i=Fc(n);for(;i&&t!==n;){let e=Rc(i),t=i.getBoundingClientRect(),r=Ac(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=pc(i),i=Fc(n)}}return Ys({width:u,height:d,x:c,y:l})}function Uc(e,t){let n=jc(e).scrollLeft;return t?t.left+n:Hc(mc(e)).left+n}function Wc(e,t){let n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-Uc(e,n),y:n.top+t.scrollTop}}function Gc(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e,a=i===`fixed`,o=mc(r),s=t?xc(t.floating):!1;if(r===o||s&&a)return n;let c={scrollLeft:0,scrollTop:0},l=Ds(1),u=Ds(0),d=_c(r);if((d||!a)&&((fc(r)!==`body`||yc(o))&&(c=jc(r)),d)){let e=Hc(r);l=Rc(r),u.x=e.x+r.clientLeft,u.y=e.y+r.clientTop}let f=o&&!d&&!a?Wc(o,c):Ds(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 Kc(e){return e.getClientRects?Array.from(e.getClientRects()):[]}function qc(e){let t=jc(e),n=e.ownerDocument.body,r=ws(e.scrollWidth,e.clientWidth,n.scrollWidth,n.clientWidth),i=ws(e.scrollHeight,e.clientHeight,n.scrollHeight,n.clientHeight),a=-t.scrollLeft+Uc(e),o=-t.scrollTop;return Ac(n).direction===`rtl`&&(a+=ws(e.clientWidth,n.clientWidth)-r),{width:r,height:i,x:a,y:o}}var Jc=25;function Yc(e,t,n){n===void 0&&(n=`viewport`);let r=n===`layoutViewport`,i=pc(e),a=mc(e),o=i.visualViewport,s=a.clientWidth,c=a.clientHeight,l=0,u=0;if(o){let e=!Oc()||t===`fixed`;r?e||(l=-o.offsetLeft,u=-o.offsetTop):(s=o.width,c=o.height,e&&(l=o.offsetLeft,u=o.offsetTop))}if(Uc(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<=Jc&&(s-=o)}return{width:s,height:c,x:l,y:u}}function Xc(e,t){let n=Hc(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 Zc(e,t,n){let r;if(t===`viewport`||t===`layoutViewport`)r=Yc(e,n,t);else if(t===`document`)r=qc(mc(e));else if(gc(t))r=Xc(t,n);else{let n=Bc(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return Ys(r)}function Qc(e,t){let n=t.get(e);if(n)return n;let r=Pc(e,[],!1).filter(e=>gc(e)&&fc(e)!==`body`),i=null,a=Ac(e).position===`fixed`,o=a?Mc(e):e;for(;gc(o)&&!kc(o);){let e=Ac(o),t=Ec(o),n=i?i.position:a?`fixed`:``;!t&&(n===`fixed`||n===`absolute`&&e.position===`static`)?r=r.filter(e=>e!==o):i=e,o=Mc(o)}return t.set(e,r),r}function $c(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e,a=[...n===`clippingAncestors`?xc(t)?[]:Qc(t,this._c):[].concat(n),r],o=Zc(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=Zc(t,a[e],i);s=ws(n.top,s),c=Cs(n.right,c),l=Cs(n.bottom,l),u=ws(n.left,u)}return{width:c-u,height:l-s,x:u,y:s}}function el(e){let{width:t,height:n}=Ic(e);return{width:t,height:n}}function tl(e,t,n){let r=_c(t),i=mc(t),a=n===`fixed`,o=Hc(e,!0,a,t),s={scrollLeft:0,scrollTop:0},c=Ds(0);if((r||!a)&&((fc(t)!==`body`||yc(i))&&(s=jc(t)),r)){let e=Hc(t,!0,a,t);c.x=e.x+t.clientLeft,c.y=e.y+t.clientTop}!r&&i&&(c.x=Uc(i));let l=i&&!r&&!a?Wc(i,s):Ds(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 nl(e){return Ac(e).position===`static`}function rl(e,t){if(!_c(e)||Ac(e).position===`fixed`)return null;if(t)return t(e);let n=e.offsetParent;return mc(e)===n&&(n=n.ownerDocument.body),n}function il(e,t){let n=pc(e);if(xc(e))return n;if(!_c(e)){let t=Mc(e);for(;t&&!kc(t);){if(gc(t)&&!nl(t))return t;t=Mc(t)}return n}let r=rl(e,t);for(;r&&bc(r)&&nl(r);)r=rl(r,t);return r&&kc(r)&&nl(r)&&!Ec(r)?n:r||Dc(e)||n}var al=async function(e){let t=this.getOffsetParent||il,n=this.getDimensions,r=await n(e.floating);return{reference:tl(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function ol(e){return Ac(e).direction===`rtl`}var sl={convertOffsetParentRelativeRectToViewportRelativeRect:Gc,getDocumentElement:mc,getClippingRect:$c,getOffsetParent:il,getElementRects:al,getClientRects:Kc,getDimensions:el,getScale:Rc,isElement:gc,isRTL:ol};function cl(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function ll(e,t,n){let r=null,i,a=mc(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=Es(d),h=Es(a.clientWidth-(u+f)),g=Es(a.clientHeight-(d+p)),_=Es(u),v={rootMargin:-m+`px `+-h+`px `+-g+`px `+-_+`px`,threshold:ws(0,Cs(1,c))||1},y=!0;function b(t){let n=t[0].intersectionRatio;if(!cl(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=pc(e),l=()=>s(n);return c.addEventListener(`resize`,l),s(!0),()=>{c.removeEventListener(`resize`,l),o()}}function ul(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=Lc(e),u=i||a?[...l?Pc(l):[],...t?Pc(t):[]]:[];u.forEach(e=>{i&&e.addEventListener(`scroll`,n),a&&e.addEventListener(`resize`,n)});let d=l&&s?ll(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?Hc(e):null;c&&g();function g(){let t=Hc(e);h&&!cl(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 dl=sc,fl=cc,pl=tc,ml=uc,hl=ic,gl=ec,_l=lc,vl=(e,t,n)=>{let r=new Map,i=n??{},a={...sl,...i.platform,_c:r};return $s(e,t,{...i,platform:a})},yl=typeof document<`u`?w.useLayoutEffect:function(){};function bl(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(!bl(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)&&!bl(e[n],t[n]))return!1}return!0}return e!==e&&t!==t}function xl(e){return typeof window>`u`?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Sl(e,t){let n=xl(e);return Math.round(t*n)/n}function Cl(e){let t=w.useRef(e);return yl(()=>{t.current=e}),t}function wl(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]=w.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[f,p]=w.useState(r);bl(f,r)||p(r);let[m,h]=w.useState(null),[g,_]=w.useState(null),v=w.useCallback(e=>{e!==S.current&&(S.current=e,h(e))},[]),y=w.useCallback(e=>{e!==C.current&&(C.current=e,_(e))},[]),b=a||m,x=o||g,S=w.useRef(null),C=w.useRef(null),T=w.useRef(u),E=c!=null,D=Cl(c),O=Cl(i),k=Cl(l),ee=w.useCallback(()=>{if(!S.current||!C.current)return;let e={placement:t,strategy:n,middleware:f};O.current&&(e.platform=O.current),vl(S.current,C.current,e).then(e=>{let t={...e,isPositioned:k.current!==!1};A.current&&!bl(T.current,t)&&(T.current=t,Dr.flushSync(()=>{d(t)}))})},[f,t,n,O,k]);yl(()=>{l===!1&&T.current.isPositioned&&(T.current.isPositioned=!1,d(e=>({...e,isPositioned:!1})))},[l]);let A=w.useRef(!1);yl(()=>(A.current=!0,()=>{A.current=!1}),[]),yl(()=>{if(b&&(S.current=b),x&&(C.current=x),b&&x){if(D.current)return D.current(b,x,ee);ee()}},[b,x,ee,D,E]);let j=w.useMemo(()=>({reference:S,floating:C,setReference:v,setFloating:y}),[v,y]),M=w.useMemo(()=>({reference:b,floating:x}),[b,x]),te=w.useMemo(()=>{let e={position:n,left:0,top:0};if(!M.floating)return e;let t=Sl(M.floating,u.x),r=Sl(M.floating,u.y);return s?{...e,transform:`translate(`+t+`px, `+r+`px)`,...xl(M.floating)>=1.5&&{willChange:`transform`}}:{position:n,left:t,top:r}},[n,s,M.floating,u.x,u.y]);return w.useMemo(()=>({...u,update:ee,refs:j,elements:M,floatingStyles:te}),[u,ee,j,M,te])}var Tl=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?{}:gl({element:r.current,padding:i}).fn(n):r?gl({element:r,padding:i}).fn(n):{}}}},El=(e,t)=>{let n=dl(e);return{name:n.name,fn:n.fn,options:[e,t]}},Dl=(e,t)=>{let n=fl(e);return{name:n.name,fn:n.fn,options:[e,t]}},Ol=(e,t)=>({fn:_l(e).fn,options:[e,t]}),kl=(e,t)=>{let n=pl(e);return{name:n.name,fn:n.fn,options:[e,t]}},Al=(e,t)=>{let n=ml(e);return{name:n.name,fn:n.fn,options:[e,t]}},jl=(e,t)=>{let n=hl(e);return{name:n.name,fn:n.fn,options:[e,t]}},Ml=(e,t)=>{let n=Tl(e);return{name:n.name,fn:n.fn,options:[e,t]}},Nl=Object.defineProperty,Pl=(e,t)=>Nl(e,`name`,{value:t,configurable:!0}),Fl=`Popper`,[Il,Ll]=Fr(Fl),[Rl,zl]=Il(Fl),Bl=Pl(e=>{let{__scopePopper:t,children:n}=e,[r,i]=w.useState(null),[a,o]=w.useState(void 0);return(0,L.jsx)(Rl,{scope:t,anchor:r,onAnchorChange:i,placementState:a,setPlacementState:o,children:n})},`Popper`),Vl=`PopperAnchor`,Hl=w.forwardRef(Pl(function(e,t){let{__scopePopper:n,virtualRef:r,...i}=e,a=zl(Vl,n),o=w.useRef(null),s=a.onAnchorChange,c=ur(t,w.useCallback(e=>{o.current=e,e&&s(e)},[s])),l=w.useRef(null);w.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,L.jsx)(Ar.div,{"data-radix-popper-side":d,"data-radix-popper-align":f,...i,ref:c})},`PopperAnchor`)),Ul=`PopperContent`,[Wl,Gl]=Il(Ul),Kl=w.forwardRef(Pl(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=zl(Ul,n),[_,v]=w.useState(null),y=ur(t,v),[b,x]=w.useState(null),S=xs(b),C=S?.width??0,T=S?.height??0,E=r+(a===`center`?``:`-`+a),D=typeof u==`number`?u:{top:0,right:0,bottom:0,left:0,...u},O=Array.isArray(l)?l:[l],k=O.length>0,ee={padding:D,boundary:O.filter(ql),altBoundary:k},{refs:A,floatingStyles:j,placement:M,isPositioned:te,middlewareData:ne}=wl({strategy:`fixed`,placement:E,whileElementsMounted:Pl((...e)=>ul(...e,{animationFrame:p===`always`}),`whileElementsMounted`),elements:{reference:g.anchor},middleware:[El({mainAxis:i+T,alignmentAxis:o}),c&&Dl({mainAxis:!0,crossAxis:!1,limiter:d===`partial`?Ol():void 0,...ee}),c&&kl({...ee}),Al({...ee,apply:Pl(({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&&Ml({element:b,padding:s}),Jl({arrowWidth:C,arrowHeight:T}),f&&jl({strategy:`referenceHidden`,...ee,boundary:k?ee.boundary:void 0})]}),N=g.setPlacementState;ri(()=>(N(M),()=>{N(void 0)}),[M,N]);let[P,re]=Yl(M),ie=Li(m);ri(()=>{te&&ie?.()},[te,ie]);let ae=ne.arrow?.x,F=ne.arrow?.y,I=ne.arrow?.centerOffset!==0,[oe,se]=w.useState();return ri(()=>{_&&se(window.getComputedStyle(_).zIndex)},[_]),(0,L.jsx)(`div`,{ref:A.setFloating,"data-radix-popper-content-wrapper":``,style:{...j,transform:te?j.transform:`translate(0, -200%)`,minWidth:`max-content`,zIndex:oe,"--radix-popper-transform-origin":[ne.transformOrigin?.x,ne.transformOrigin?.y].join(` `),...ne.hide?.referenceHidden&&{visibility:`hidden`,pointerEvents:`none`}},dir:e.dir,children:(0,L.jsx)(Wl,{scope:n,placedSide:P,placedAlign:re,onArrowChange:x,arrowX:ae,arrowY:F,shouldHideArrow:I,children:(0,L.jsx)(Ar.div,{"data-side":P,"data-align":re,...h,ref:y,style:{...h.style,animation:te?h.style?.animation:`none`}})})})},`PopperContent`));function ql(e){return e!==null}Pl(ql,`isNotNull`);var Jl=Pl(e=>({name:`transformOrigin`,options:e,fn(t){let{placement:n,rects:r,middlewareData:i}=t,a=i.arrow?.centerOffset!==0,o=a?0:e.arrowWidth,s=a?0:e.arrowHeight,[c,l]=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}}}}),`transformOrigin`);function Yl(e){let[t,n=`center`]=e.split(`-`);return[t,n]}Pl(Yl,`getSideAndAlignFromPlacement`);var Xl=Bl,Zl=Hl,Ql=Kl,$l=Object.defineProperty,eu=(e,t)=>$l(e,`name`,{value:t,configurable:!0}),tu=!1;function nu(){let[e,t]=w.useState(tu);return w.useEffect(()=>{tu||(tu=!0,t(!0))},[]),e}eu(nu,`useIsHydrated`);var ru=w.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]=zr(du),[hu,gu]=Fr(du,[mu]),[_u,vu]=hu(du),yu=w.forwardRef(cu(function(e,t){return(0,L.jsx)(fu.Provider,{scope:e.__scopeRovingFocusGroup,children:(0,L.jsx)(fu.Slot,{scope:e.__scopeRovingFocusGroup,children:(0,L.jsx)(bu,{...e,ref:t})})})},`RovingFocusGroup`)),bu=w.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=w.useRef(null),p=ur(t,f),m=Pi(a),[h,g]=fi({prop:o,defaultProp:s??null,onChange:c,caller:du}),[_,v]=w.useState(!1),y=Li(l),b=pu(n),x=w.useRef(!1),[S,C]=w.useState(0);return w.useEffect(()=>{let e=f.current;if(e)return e.addEventListener(lu,y),()=>e.removeEventListener(lu,y)},[y]),(0,L.jsx)(_u,{scope:n,orientation:r,dir:m,loop:i,currentTabStopId:h,onItemFocus:w.useCallback(e=>g(e),[g]),onItemShiftTab:w.useCallback(()=>v(!0),[]),onFocusableItemAdd:w.useCallback(()=>C(e=>e+1),[]),onFocusableItemRemove:w.useCallback(()=>C(e=>e-1),[]),children:(0,L.jsx)(Ar.div,{tabIndex:_||S===0?-1:0,"data-orientation":r,...d,ref:p,style:{outline:`none`,...e.style},onMouseDown:V(e.onMouseDown,()=>{x.current=!0}),onFocus:V(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:V(e.onBlur,()=>v(!1))})})},`RovingFocusGroupImpl`)),xu=`RovingFocusGroupItem`,Su=w.forwardRef(cu(function(e,t){let{__scopeRovingFocusGroup:n,focusable:r=!0,active:i=!1,tabStopId:a,children:o,...s}=e,c=Ai(),l=a||c,u=vu(xu,n),d=u.currentTabStopId===l,f=pu(n),{onFocusableItemAdd:p,onFocusableItemRemove:m,currentTabStopId:h}=u,g=ou();return ri(()=>{if(!(!g||!r))return p(),()=>m()},[g,r,p,m]),w.useEffect(()=>{if(!(g||!r))return p(),()=>m()},[g,r,p,m]),(0,L.jsx)(fu.ItemSlot,{scope:n,id:l,focusable:r,active:i,children:(0,L.jsx)(Ar.span,{tabIndex:d?0:-1,"data-orientation":u.orientation,...s,ref:t,onMouseDown:V(e.onMouseDown,e=>{r?u.onItemFocus(l):e.preventDefault()}),onFocus:V(e.onFocus,()=>u.onItemFocus(l)),onKeyDown:V(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]=zr(Iu),[Bu,Vu]=Fr(Iu,[zu,Ll,gu]),Hu=Ll(),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]=w.useState(null),u=w.useRef(!1),d=Li(a),f=Pi(i);return w.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})}},[]),w.useEffect(()=>{if(!n)return;let e=ju(()=>d(!1),`handleBlur`);return window.addEventListener(`blur`,e),()=>window.removeEventListener(`blur`,e)},[n,d]),(0,L.jsx)(Xl,{...s,children:(0,L.jsx)(Wu,{scope:t,open:n,onOpenChange:d,content:c,onContentChange:l,children:(0,L.jsx)(Ku,{scope:t,onClose:w.useCallback(()=>d(!1),[d]),isUsingKeyboardRef:u,dir:f,modal:o,children:r})})})},`Menu`),Yu=w.forwardRef(ju(function(e,t){let{__scopeMenu:n,...r}=e,i=Hu(n);return(0,L.jsx)(Zl,{...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,L.jsx)(Zu,{scope:t,forceMount:n,children:(0,L.jsx)(bi,{present:n||a.open,children:(0,L.jsx)(ga,{asChild:!0,container:i,children:r})})})},`MenuPortal`),ed=`MenuContent`,[td,nd]=Bu(ed),rd=w.forwardRef(ju(function(e,t){let n=Qu(ed,e.__scopeMenu),{forceMount:r=n.forceMount,...i}=e,a=Gu(ed,e.__scopeMenu),o=qu(ed,e.__scopeMenu);return(0,L.jsx)(Lu.Provider,{scope:e.__scopeMenu,children:(0,L.jsx)(bi,{present:r||a.open,children:(0,L.jsx)(Lu.Slot,{scope:e.__scopeMenu,children:o.modal?(0,L.jsx)(id,{...i,ref:t}):(0,L.jsx)(ad,{...i,ref:t})})})})},`MenuContent`)),id=w.forwardRef(ju(function(e,t){let n=Gu(ed,e.__scopeMenu),r=w.useRef(null),i=ur(t,r);return w.useEffect(()=>{let e=r.current;if(e)return Ho(e)},[]),(0,L.jsx)(sd,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:V(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})},`MenuRootContentModal`)),ad=w.forwardRef(ju(function(e,t){let n=Gu(ed,e.__scopeMenu);return(0,L.jsx)(sd,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})},`MenuRootContentNonModal`)),od=pr(`MenuContent.ScrollLock`),sd=w.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(ed,n),_=qu(ed,n),v=Hu(n),y=Uu(n),b=Ru(n),[x,S]=w.useState(null),C=w.useRef(null),T=ur(t,C,g.onContentChange),E=w.useRef(0),D=w.useRef(``),O=w.useRef(0),k=w.useRef(null),ee=w.useRef(`right`),A=w.useRef(0),j=m?No:w.Fragment,M=m?{as:od,allowPinchZoom:!0}:void 0,te=ju(e=>{let t=D.current+e,n=b().filter(e=>!e.disabled),r=document.activeElement,i=n.find(e=>e.ref.current===r)?.textValue,a=Td(n.map(e=>e.textValue),t,i),o=n.find(e=>e.textValue===a)?.ref.current;ju((function e(t){D.current=t,window.clearTimeout(E.current),t!==``&&(E.current=window.setTimeout(()=>e(``),1e3))}),`updateSearch`)(t),o&&setTimeout(()=>o.focus())},`handleTypeaheadSearch`);w.useEffect(()=>()=>window.clearTimeout(E.current),[]),Sa();let ne=w.useCallback(e=>ee.current===k.current?.side&&Dd(e,k.current?.area),[]);return(0,L.jsx)(td,{scope:n,searchRef:D,onItemEnter:w.useCallback(e=>{ne(e)&&e.preventDefault()},[ne]),onItemLeave:w.useCallback(e=>{ne(e)||(C.current?.focus(),S(null))},[ne]),onTriggerLeave:w.useCallback(e=>{ne(e)&&e.preventDefault()},[ne]),pointerGraceTimerRef:O,onPointerGraceIntentChange:w.useCallback(e=>{k.current=e},[]),children:(0,L.jsx)(j,{...M,children:(0,L.jsx)(ra,{asChild:!0,trapped:i,onMountAutoFocus:V(a,e=>{e.preventDefault(),C.current?.focus({preventScroll:!0})}),onUnmountAutoFocus:o,children:(0,L.jsx)(Gi,{asChild:!0,disableOutsidePointerEvents:s,onEscapeKeyDown:l,onPointerDownOutside:u,onFocusOutside:d,onInteractOutside:f,onDismiss:p,children:(0,L.jsx)(Ou,{asChild:!0,...y,dir:_.dir,orientation:`vertical`,loop:r,currentTabStopId:x,onCurrentTabStopIdChange:S,onEntryFocus:V(c,e=>{_.isUsingKeyboardRef.current||e.preventDefault()}),preventScrollOnEntryFocus:!0,children:(0,L.jsx)(Ql,{role:`menu`,"aria-orientation":`vertical`,"data-state":bd(g.open),"data-radix-menu-content":``,dir:_.dir,...v,...h,ref:T,style:{outline:`none`,...h.style},onKeyDown:V(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&&te(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(),Cd(a)}),onBlur:V(e.onBlur,e=>{e.currentTarget.contains(e.target)||(window.clearTimeout(E.current),D.current=``)}),onPointerMove:V(e.onPointerMove,Od(e=>{let t=e.target,n=A.current!==e.clientX;if(e.currentTarget.contains(t)&&n){let t=e.clientX>A.current?`right`:`left`;ee.current=t,A.current=e.clientX}}))})})})})})})},`MenuContentImpl`)),cd=w.forwardRef(ju(function(e,t){let{__scopeMenu:n,...r}=e;return(0,L.jsx)(Ar.div,{...r,ref:t})},`MenuLabel`)),ld=`MenuItem`,ud=`menu.itemSelect`,dd=w.forwardRef(ju(function(e,t){let{disabled:n=!1,onSelect:r,...i}=e,a=w.useRef(null),o=qu(ld,e.__scopeMenu),s=nd(ld,e.__scopeMenu),c=ur(t,a),l=w.useRef(!1),u=ju(()=>{let e=a.current;if(!n&&e){let t=new CustomEvent(ud,{bubbles:!0,cancelable:!0});e.addEventListener(ud,e=>r?.(e),{once:!0}),jr(e,t),t.defaultPrevented?l.current=!1:o.onClose()}},`handleSelect`);return(0,L.jsx)(fd,{...i,ref:c,disabled:n,onClick:V(e.onClick,u),onPointerDown:t=>{e.onPointerDown?.(t),l.current=!0},onPointerUp:V(e.onPointerUp,e=>{l.current||e.currentTarget?.click()}),onKeyDown:V(e.onKeyDown,e=>{n||e.target!==e.currentTarget||(s.searchRef.current===``||e.key!==` `)&&Mu.includes(e.key)&&(e.currentTarget.click(),e.preventDefault())})})},`MenuItem`)),fd=w.forwardRef(ju(function(e,t){let{__scopeMenu:n,disabled:r=!1,textValue:i,...a}=e,o=nd(ld,n),s=Uu(n),c=w.useRef(null),l=ur(t,c),[u,d]=w.useState(!1),[f,p]=w.useState(``);return w.useEffect(()=>{let e=c.current;e&&p((e.textContent??``).trim())},[a.children]),(0,L.jsx)(Lu.ItemSlot,{scope:n,disabled:r,textValue:i??f,children:(0,L.jsx)(ku,{asChild:!0,...s,focusable:!r,children:(0,L.jsx)(Ar.div,{role:`menuitem`,"data-highlighted":u?``:void 0,"aria-disabled":r||void 0,"data-disabled":r?``:void 0,...a,ref:l,onPointerMove:V(e.onPointerMove,Od(e=>{r?o.onItemLeave(e):(o.onItemEnter(e),e.defaultPrevented||e.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:V(e.onPointerLeave,Od(e=>o.onItemLeave(e))),onFocus:V(e.onFocus,()=>d(!0)),onBlur:V(e.onBlur,()=>d(!1))})})})},`MenuItemImpl`)),[pd,md]=Bu(`MenuRadioGroup`,{value:void 0,onValueChange:ju(()=>{},`onValueChange`)}),[hd,gd]=Bu(`MenuItemIndicator`,{checked:!1}),_d=w.forwardRef(ju(function(e,t){let{__scopeMenu:n,...r}=e;return(0,L.jsx)(Ar.div,{role:`separator`,"aria-orientation":`horizontal`,...r,ref:t})},`MenuSeparator`)),[vd,yd]=Bu(`MenuSub`);function bd(e){return e?`open`:`closed`}ju(bd,`getOpenState`);function xd(e){return e===`indeterminate`}ju(xd,`isIndeterminate`);function Sd(e){return xd(e)?`indeterminate`:e?`checked`:`unchecked`}ju(Sd,`getCheckedState`);function Cd(e){let t=document.activeElement;for(let n of e)if(n===t||(n.focus(),document.activeElement!==t))return}ju(Cd,`focusFirst`);function wd(e,t){return e.map((n,r)=>e[(t+r)%e.length])}ju(wd,`wrapArray`);function Td(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=wd(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(Td,`getNextMatch`);function Ed(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(Ed,`isPointInPolygon`);function Dd(e,t){return t?Ed({x:e.clientX,y:e.clientY},t):!1}ju(Dd,`isPointerInGraceArea`);function Od(e){return t=>t.pointerType===`mouse`?e(t):void 0}ju(Od,`whenMouse`);var kd=Ju,Ad=Yu,jd=$u,Md=rd,Nd=cd,Pd=dd,Fd=_d,Id=Object.defineProperty,Ld=(e,t)=>Id(e,`name`,{value:t,configurable:!0}),Rd=`ContextMenu`,[zd,Bd]=Fr(Rd,[Vu]),Vd=Vu(),[Hd,Ud]=zd(Rd),Wd=Ld(e=>{let{__scopeContextMenu:t,children:n,onOpenChange:r,open:i,dir:a,modal:o=!0}=e,s=w.useRef(!1),[c,l]=fi({prop:i,defaultProp:!1,onChange:r,caller:Rd}),u=Vd(t);return(0,L.jsx)(Hd,{scope:t,open:c,onOpenChange:l,modal:o,hasInteractedRef:s,children:(0,L.jsx)(kd,{...u,dir:a,open:c,onOpenChange:l,modal:o,children:n})})},`ContextMenu`),Gd=`ContextMenuTrigger`,Kd=w.forwardRef(Ld(function(e,t){let{__scopeContextMenu:n,disabled:r=!1,...i}=e,a=Ud(Gd,n),o=Vd(n),[s,c]=w.useState({x:0,y:0}),l=w.useMemo(()=>({current:{getBoundingClientRect:Ld(()=>DOMRect.fromRect({width:0,height:0,...s}),`getBoundingClientRect`)}}),[s]),u=w.useRef(0),d=w.useCallback(()=>window.clearTimeout(u.current),[]),f=Ld(e=>{a.hasInteractedRef.current=!0,c({x:e.clientX,y:e.clientY}),a.onOpenChange(!0)},`handleOpen`);return w.useEffect(()=>d,[d]),w.useEffect(()=>void(r&&d()),[r,d]),(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(Ad,{...o,virtualRef:l}),(0,L.jsx)(Ar.span,{"data-state":a.open?`open`:`closed`,"data-disabled":r?``:void 0,...i,ref:t,style:{WebkitTouchCallout:`none`,...e.style},onContextMenu:r?e.onContextMenu:V(e.onContextMenu,e=>{d(),f(e),e.preventDefault()}),onPointerDown:r?e.onPointerDown:V(e.onPointerDown,Qd(e=>{d(),a.open&&a.onOpenChange(!1),u.current=window.setTimeout(()=>f(e),700)})),onPointerMove:r?e.onPointerMove:V(e.onPointerMove,Qd(d)),onPointerCancel:r?e.onPointerCancel:V(e.onPointerCancel,Qd(d)),onPointerUp:r?e.onPointerUp:V(e.onPointerUp,Qd(d))})]})},`ContextMenuTrigger`)),qd=Ld(e=>{let{__scopeContextMenu:t,...n}=e,r=Vd(t);return(0,L.jsx)(jd,{...r,...n})},`ContextMenuPortal`),Jd=`ContextMenuContent`,Yd=w.forwardRef(Ld(function(e,t){let{__scopeContextMenu:n,...r}=e,i=Ud(Jd,n),a=Vd(n),o=w.useRef(!1);return(0,L.jsx)(Md,{...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`)),Xd=w.forwardRef(Ld(function(e,t){let{__scopeContextMenu:n,...r}=e,i=Vd(n);return(0,L.jsx)(Pd,{...i,...r,ref:t})},`ContextMenuItem`)),Zd=w.forwardRef(Ld(function(e,t){let{__scopeContextMenu:n,...r}=e,i=Vd(n);return(0,L.jsx)(Fd,{...i,...r,ref:t})},`ContextMenuSeparator`));function Qd(e){return t=>t.pointerType===`mouse`?void 0:e(t)}Ld(Qd,`whenTouchOrPen`);var $d=Wd,ef=Kd,tf=qd,nf=Yd,rf=Xd,af=Zd,of=Object.defineProperty,sf=(e,t)=>of(e,`name`,{value:t,configurable:!0}),cf=`DropdownMenu`,[lf,uf]=Fr(cf,[Vu]),df=Vu(),[ff,pf]=lf(cf),mf=sf(e=>{let{__scopeDropdownMenu:t,children:n,dir:r,open:i,defaultOpen:a,onOpenChange:o,modal:s=!0}=e,c=df(t),l=w.useRef(null),[u,d]=fi({prop:i,defaultProp:a??!1,onChange:o,caller:cf});return(0,L.jsx)(ff,{scope:t,triggerId:Ai(),triggerRef:l,contentId:Ai(),open:u,onOpenChange:d,onOpenToggle:w.useCallback(()=>d(e=>!e),[d]),modal:s,children:(0,L.jsx)(kd,{...c,open:u,onOpenChange:d,dir:r,modal:s,children:n})})},`DropdownMenu`),hf=`DropdownMenuTrigger`,gf=w.forwardRef(sf(function(e,t){let{__scopeDropdownMenu:n,disabled:r=!1,...i}=e,a=pf(hf,n),o=df(n),s=ur(t,a.triggerRef);return(0,L.jsx)(Ad,{asChild:!0,...o,children:(0,L.jsx)(Ar.button,{type:`button`,id:a.triggerId,"aria-haspopup":`menu`,"aria-expanded":a.open,"aria-controls":a.open?a.contentId:void 0,"data-state":a.open?`open`:`closed`,"data-disabled":r?``:void 0,disabled:r,...i,ref:s,onPointerDown:V(e.onPointerDown,e=>{!r&&e.button===0&&e.ctrlKey===!1&&(a.onOpenToggle(),a.open||e.preventDefault())}),onKeyDown:V(e.onKeyDown,e=>{r||([`Enter`,` `].includes(e.key)&&a.onOpenToggle(),e.key===`ArrowDown`&&a.onOpenChange(!0),[`Enter`,` `,`ArrowDown`].includes(e.key)&&e.preventDefault())})})})},`DropdownMenuTrigger`)),_f=sf(e=>{let{__scopeDropdownMenu:t,...n}=e,r=df(t);return(0,L.jsx)(jd,{...r,...n})},`DropdownMenuPortal`),vf=`DropdownMenuContent`,yf=w.forwardRef(sf(function(e,t){let{__scopeDropdownMenu:n,...r}=e,i=pf(vf,n),a=df(n),o=w.useRef(!1);return(0,L.jsx)(Md,{id:i.contentId,"aria-labelledby":i.triggerId,...a,...r,ref:t,onCloseAutoFocus:V(e.onCloseAutoFocus,e=>{o.current||i.triggerRef.current?.focus(),o.current=!1,e.preventDefault()}),onInteractOutside:V(e.onInteractOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0,r=t.button===2||n;(!i.modal||r)&&(o.current=!0)}),style:{...e.style,"--radix-dropdown-menu-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-dropdown-menu-content-available-width":`var(--radix-popper-available-width)`,"--radix-dropdown-menu-content-available-height":`var(--radix-popper-available-height)`,"--radix-dropdown-menu-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-dropdown-menu-trigger-height":`var(--radix-popper-anchor-height)`}})},`DropdownMenuContent`)),bf=w.forwardRef(sf(function(e,t){let{__scopeDropdownMenu:n,...r}=e,i=df(n);return(0,L.jsx)(Nd,{...i,...r,ref:t})},`DropdownMenuLabel`)),xf=w.forwardRef(sf(function(e,t){let{__scopeDropdownMenu:n,...r}=e,i=df(n);return(0,L.jsx)(Pd,{...i,...r,ref:t})},`DropdownMenuItem`)),Sf=w.forwardRef(sf(function(e,t){let{__scopeDropdownMenu:n,...r}=e,i=df(n);return(0,L.jsx)(Fd,{...i,...r,ref:t})},`DropdownMenuSeparator`)),Cf=mf,wf=gf,Tf=_f,Ef=yf,Df=bf,Of=xf,kf=Sf,Af=Object.defineProperty,jf=(e,t)=>Af(e,`name`,{value:t,configurable:!0});function Mf(e,[t,n]){return Math.min(n,Math.max(t,e))}jf(Mf,`clamp`);var Nf=Object.defineProperty,Pf=(e,t)=>Nf(e,`name`,{value:t,configurable:!0}),Ff=`Popover`,[If,Lf]=Fr(Ff,[Ll]),Rf=Ll(),[zf,Bf]=If(Ff),Vf=Pf(e=>{let{__scopePopover:t,children:n,open:r,defaultOpen:i,onOpenChange:a,modal:o=!1}=e,s=Rf(t),c=w.useRef(null),[l,u]=w.useState(!1),[d,f]=fi({prop:r,defaultProp:i??!1,onChange:a,caller:Ff});return(0,L.jsx)(Xl,{...s,children:(0,L.jsx)(zf,{scope:t,contentId:Ai(),triggerRef:c,open:d,onOpenChange:f,onOpenToggle:w.useCallback(()=>f(e=>!e),[f]),hasCustomAnchor:l,onCustomAnchorAdd:w.useCallback(()=>u(!0),[]),onCustomAnchorRemove:w.useCallback(()=>u(!1),[]),modal:o,children:n})})},`Popover`),Hf=`PopoverAnchor`,Uf=w.forwardRef(Pf(function(e,t){let{__scopePopover:n,...r}=e,i=Bf(Hf,n),a=Rf(n),{onCustomAnchorAdd:o,onCustomAnchorRemove:s}=i;return w.useEffect(()=>(o(),()=>s()),[o,s]),(0,L.jsx)(Zl,{...a,...r,ref:t})},`PopoverAnchor`)),Wf=`PopoverPortal`,[Gf,Kf]=If(Wf,{forceMount:void 0}),qf=Pf(e=>{let{__scopePopover:t,forceMount:n,children:r,container:i}=e,a=Bf(Wf,t);return(0,L.jsx)(Gf,{scope:t,forceMount:n,children:(0,L.jsx)(bi,{present:n||a.open,children:(0,L.jsx)(ga,{asChild:!0,container:i,children:r})})})},`PopoverPortal`),Jf=`PopoverContent`,Yf=w.forwardRef(Pf(function(e,t){let n=Kf(Jf,e.__scopePopover),{forceMount:r=n.forceMount,...i}=e,a=Bf(Jf,e.__scopePopover);return(0,L.jsx)(bi,{present:r||a.open,children:a.modal?(0,L.jsx)(Zf,{...i,ref:t}):(0,L.jsx)(Qf,{...i,ref:t})})},`PopoverContent`)),Xf=pr(`PopoverContent.RemoveScroll`),Zf=w.forwardRef(Pf(function(e,t){let n=Bf(Jf,e.__scopePopover),r=w.useRef(null),i=ur(t,r),a=w.useRef(!1);return w.useEffect(()=>{let e=r.current;if(e)return Ho(e)},[]),(0,L.jsx)(No,{as:Xf,allowPinchZoom:!0,children:(0,L.jsx)($f,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:V(e.onCloseAutoFocus,e=>{e.preventDefault(),a.current||n.triggerRef.current?.focus()}),onPointerDownOutside:V(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:V(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1})})})},`PopoverContentModal`)),Qf=w.forwardRef(Pf(function(e,t){let n=Bf(Jf,e.__scopePopover),r=w.useRef(!1),i=w.useRef(!1);return(0,L.jsx)($f,{...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()}})},`PopoverContentNonModal`)),$f=w.forwardRef(Pf(function(e,t){let{__scopePopover:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:a,disableOutsidePointerEvents:o,onEscapeKeyDown:s,onPointerDownOutside:c,onFocusOutside:l,onInteractOutside:u,...d}=e,f=Bf(Jf,n),p=Rf(n);return Sa(),(0,L.jsx)(ra,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:a,children:(0,L.jsx)(Gi,{asChild:!0,disableOutsidePointerEvents:o,onInteractOutside:u,onEscapeKeyDown:s,onPointerDownOutside:c,onFocusOutside:l,onDismiss:()=>f.onOpenChange(!1),deferPointerDownOutside:!0,children:(0,L.jsx)(Ql,{"data-state":ep(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)`}})})})},`PopoverContentImpl`));function ep(e){return e?`open`:`closed`}Pf(ep,`getState`);var tp=Vf,np=Uf,rp=qf,ip=Yf,ap=Object.defineProperty,op=(e,t)=>ap(e,`name`,{value:t,configurable:!0});function sp(e,t){return w.useReducer((e,n)=>t[e][n]??e,e)}op(sp,`useStateMachine`);var cp=`ScrollArea`,[lp,up]=Fr(cp),[dp,fp]=lp(cp),pp=w.forwardRef(op(function(e,t){let{__scopeScrollArea:n,type:r=`hover`,dir:i,scrollHideDelay:a=600,...o}=e,[s,c]=w.useState(null),[l,u]=w.useState(null),[d,f]=w.useState(null),[p,m]=w.useState(null),[h,g]=w.useState(null),[_,v]=w.useState(0),[y,b]=w.useState(0),[x,S]=w.useState(!1),[C,T]=w.useState(!1),E=ur(t,c),D=Pi(i);return(0,L.jsx)(dp,{scope:n,type:r,dir:D,scrollHideDelay:a,scrollArea:s,viewport:l,onViewportChange:u,content:d,onContentChange:f,scrollbarX:p,onScrollbarXChange:m,scrollbarXEnabled:x,onScrollbarXEnabledChange:S,scrollbarY:h,onScrollbarYChange:g,scrollbarYEnabled:C,onScrollbarYEnabledChange:T,onCornerWidthChange:v,onCornerHeightChange:b,children:(0,L.jsx)(Ar.div,{dir:D,...o,ref:E,style:{position:`relative`,"--radix-scroll-area-corner-width":_+`px`,"--radix-scroll-area-corner-height":y+`px`,...e.style}})})},`ScrollArea`)),mp=`ScrollAreaViewport`,hp=w.forwardRef(op(function(e,t){let{__scopeScrollArea:n,children:r,nonce:i,...a}=e,o=fp(mp,n),s=ur(t,w.useRef(null),o.onViewportChange);return(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(gp,{nonce:i}),(0,L.jsx)(Ar.div,{"data-radix-scroll-area-viewport":``,...a,ref:s,style:{overflowX:o.scrollbarXEnabled?`scroll`:`hidden`,overflowY:o.scrollbarYEnabled?`scroll`:`hidden`,...e.style},children:(0,L.jsx)(`div`,{ref:o.onContentChange,style:{minWidth:`100%`,display:`table`},children:r})})]})},`ScrollAreaViewport`)),gp=w.memo(op(function({nonce:e}){return(0,L.jsx)(`style`,{dangerouslySetInnerHTML:{__html:`[data-radix-scroll-area-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-scroll-area-viewport]::-webkit-scrollbar{display:none}`},nonce:e})},`ScrollAreaViewportStyle`),(e,t)=>e.nonce===t.nonce),_p=`ScrollAreaScrollbar`,vp=w.forwardRef(op(function(e,t){let{forceMount:n,...r}=e,i=fp(_p,e.__scopeScrollArea),{onScrollbarXEnabledChange:a,onScrollbarYEnabledChange:o}=i,s=e.orientation===`horizontal`;return w.useEffect(()=>(s?a(!0):o(!0),()=>{s?a(!1):o(!1)}),[s,a,o]),i.type===`hover`?(0,L.jsx)(yp,{...r,ref:t,forceMount:n}):i.type===`scroll`?(0,L.jsx)(bp,{...r,ref:t,forceMount:n}):i.type===`auto`?(0,L.jsx)(xp,{...r,ref:t,forceMount:n}):i.type===`always`?(0,L.jsx)(Sp,{...r,ref:t,"data-state":`visible`}):null},`ScrollAreaScrollbar`)),yp=w.forwardRef(op(function(e,t){let{forceMount:n,...r}=e,i=fp(_p,e.__scopeScrollArea),[a,o]=w.useState(!1);return w.useEffect(()=>{let e=i.scrollArea,t=0;if(e){let n=op(()=>{window.clearTimeout(t),o(!0)},`handlePointerEnter`),r=op(()=>{t=window.setTimeout(()=>o(!1),i.scrollHideDelay)},`handlePointerLeave`);return e.addEventListener(`pointerenter`,n),e.addEventListener(`pointerleave`,r),()=>{window.clearTimeout(t),e.removeEventListener(`pointerenter`,n),e.removeEventListener(`pointerleave`,r)}}},[i.scrollArea,i.scrollHideDelay]),(0,L.jsx)(bi,{present:n||a,children:(0,L.jsx)(xp,{"data-state":a?`visible`:`hidden`,...r,ref:t})})},`ScrollAreaScrollbarHover`)),bp=w.forwardRef(op(function(e,t){let{forceMount:n,...r}=e,i=fp(_p,e.__scopeScrollArea),a=e.orientation===`horizontal`,o=Hp(()=>c(`SCROLL_END`),100),[s,c]=sp(`hidden`,{hidden:{SCROLL:`scrolling`},scrolling:{SCROLL_END:`idle`,POINTER_ENTER:`interacting`},interacting:{SCROLL:`interacting`,POINTER_LEAVE:`idle`},idle:{HIDE:`hidden`,SCROLL:`scrolling`,POINTER_ENTER:`interacting`}});return w.useEffect(()=>{if(s===`idle`){let e=window.setTimeout(()=>c(`HIDE`),i.scrollHideDelay);return()=>window.clearTimeout(e)}},[s,i.scrollHideDelay,c]),w.useEffect(()=>{let e=i.viewport,t=a?`scrollLeft`:`scrollTop`;if(e){let n=e[t],r=op(()=>{let r=e[t];n!==r&&(c(`SCROLL`),o()),n=r},`handleScroll`);return e.addEventListener(`scroll`,r),()=>e.removeEventListener(`scroll`,r)}},[i.viewport,a,c,o]),(0,L.jsx)(bi,{present:n||s!==`hidden`,children:(0,L.jsx)(Sp,{"data-state":s===`hidden`?`hidden`:`visible`,...r,ref:t,onPointerEnter:V(e.onPointerEnter,()=>c(`POINTER_ENTER`)),onPointerLeave:V(e.onPointerLeave,()=>c(`POINTER_LEAVE`))})})},`ScrollAreaScrollbarScroll`)),xp=w.forwardRef(op(function(e,t){let n=fp(_p,e.__scopeScrollArea),{forceMount:r,...i}=e,[a,o]=w.useState(!1),s=e.orientation===`horizontal`,c=Hp(()=>{if(n.viewport){let e=n.viewport.offsetWidth<n.viewport.scrollWidth,t=n.viewport.offsetHeight<n.viewport.scrollHeight;o(s?e:t)}},10);return Up(n.viewport,c),Up(n.content,c),(0,L.jsx)(bi,{present:r||a,children:(0,L.jsx)(Sp,{"data-state":a?`visible`:`hidden`,...i,ref:t})})},`ScrollAreaScrollbarAuto`)),Sp=w.forwardRef(op(function(e,t){let{orientation:n=`vertical`,...r}=e,i=fp(_p,e.__scopeScrollArea),a=w.useRef(null),o=w.useRef(0),[s,c]=w.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),l=Fp(s.viewport,s.content),u={...r,sizes:s,onSizesChange:c,hasThumb:l>0&&l<1,onThumbChange:op(e=>a.current=e,`onThumbChange`),onThumbPointerUp:op(()=>o.current=0,`onThumbPointerUp`),onThumbPointerDown:op(e=>o.current=e,`onThumbPointerDown`)};function d(e,t){return Lp(e,o.current,s,t)}return op(d,`getScrollPosition`),n===`horizontal`?(0,L.jsx)(Cp,{...u,ref:t,onThumbPositionChange:()=>{if(i.viewport&&a.current){let e=i.viewport.scrollLeft,t=Rp(e,s,i.dir);a.current.style.transform=`translate3d(${t}px, 0, 0)`}},onWheelScroll:e=>{i.viewport&&(i.viewport.scrollLeft=e)},onDragScroll:e=>{i.viewport&&(i.viewport.scrollLeft=d(e,i.dir))}}):n===`vertical`?(0,L.jsx)(wp,{...u,ref:t,onThumbPositionChange:()=>{if(i.viewport&&a.current){let e=i.viewport.scrollTop,t=Rp(e,s);a.current.style.transform=`translate3d(0, ${t}px, 0)`}},onWheelScroll:e=>{i.viewport&&(i.viewport.scrollTop=e)},onDragScroll:e=>{i.viewport&&(i.viewport.scrollTop=d(e))}}):null},`ScrollAreaScrollbarVisible`)),Cp=w.forwardRef(op(function(e,t){let{sizes:n,onSizesChange:r,...i}=e,a=fp(_p,e.__scopeScrollArea),[o,s]=w.useState(),c=w.useRef(null),l=ur(t,c,a.onScrollbarXChange);return w.useEffect(()=>{c.current&&s(getComputedStyle(c.current))},[c]),(0,L.jsx)(Dp,{"data-orientation":`horizontal`,...i,ref:l,sizes:n,style:{bottom:0,left:a.dir===`rtl`?`var(--radix-scroll-area-corner-width)`:0,right:a.dir===`ltr`?`var(--radix-scroll-area-corner-width)`:0,"--radix-scroll-area-thumb-width":Ip(n)+`px`,...e.style},onThumbPointerDown:t=>e.onThumbPointerDown(t.x),onDragScroll:t=>e.onDragScroll(t.x),onWheelScroll:(t,n)=>{if(a.viewport){let r=a.viewport.scrollLeft+t.deltaX;e.onWheelScroll(r),Bp(r,n)&&t.preventDefault()}},onResize:()=>{c.current&&a.viewport&&o&&r({content:a.viewport.scrollWidth,viewport:a.viewport.offsetWidth,scrollbar:{size:c.current.clientWidth,paddingStart:Pp(o.paddingLeft),paddingEnd:Pp(o.paddingRight)}})}})},`ScrollAreaScrollbarX`)),wp=w.forwardRef(op(function(e,t){let{sizes:n,onSizesChange:r,...i}=e,a=fp(_p,e.__scopeScrollArea),[o,s]=w.useState(),c=w.useRef(null),l=ur(t,c,a.onScrollbarYChange);return w.useEffect(()=>{c.current&&s(getComputedStyle(c.current))},[c]),(0,L.jsx)(Dp,{"data-orientation":`vertical`,...i,ref:l,sizes:n,style:{top:0,right:a.dir===`ltr`?0:void 0,left:a.dir===`rtl`?0:void 0,bottom:`var(--radix-scroll-area-corner-height)`,"--radix-scroll-area-thumb-height":Ip(n)+`px`,...e.style},onThumbPointerDown:t=>e.onThumbPointerDown(t.y),onDragScroll:t=>e.onDragScroll(t.y),onWheelScroll:(t,n)=>{if(a.viewport){let r=a.viewport.scrollTop+t.deltaY;e.onWheelScroll(r),Bp(r,n)&&t.preventDefault()}},onResize:()=>{c.current&&a.viewport&&o&&r({content:a.viewport.scrollHeight,viewport:a.viewport.offsetHeight,scrollbar:{size:c.current.clientHeight,paddingStart:Pp(o.paddingTop),paddingEnd:Pp(o.paddingBottom)}})}})},`ScrollAreaScrollbarY`)),[Tp,Ep]=lp(_p),Dp=w.forwardRef(op(function(e,t){let{__scopeScrollArea:n,sizes:r,hasThumb:i,onThumbChange:a,onThumbPointerUp:o,onThumbPointerDown:s,onThumbPositionChange:c,onDragScroll:l,onWheelScroll:u,onResize:d,...f}=e,p=fp(_p,n),[m,h]=w.useState(null),g=ur(t,h),_=w.useRef(null),v=w.useRef(``),y=p.viewport,b=r.content-r.viewport,x=Li(u),S=Li(c),C=Hp(d,10);function T(e){if(_.current){let t=e.clientX-_.current.left,n=e.clientY-_.current.top;l({x:t,y:n})}}return op(T,`handleDragScroll`),w.useEffect(()=>{let e=op(e=>{let t=e.target;m?.contains(t)&&x(e,b)},`handleWheel`);return document.addEventListener(`wheel`,e,{passive:!1}),()=>document.removeEventListener(`wheel`,e,{passive:!1})},[y,m,b,x]),w.useEffect(S,[r,S]),Up(m,C),Up(p.content,C),(0,L.jsx)(Tp,{scope:n,scrollbar:m,hasThumb:i,onThumbChange:Li(a),onThumbPointerUp:Li(o),onThumbPositionChange:S,onThumbPointerDown:Li(s),children:(0,L.jsx)(Ar.div,{...f,ref:g,style:{position:`absolute`,...f.style},onPointerDown:V(e.onPointerDown,e=>{e.button===0&&(e.target.setPointerCapture(e.pointerId),_.current=m.getBoundingClientRect(),v.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect=`none`,p.viewport&&(p.viewport.style.scrollBehavior=`auto`),T(e))}),onPointerMove:V(e.onPointerMove,T),onPointerUp:V(e.onPointerUp,e=>{let t=e.target;t.hasPointerCapture(e.pointerId)&&t.releasePointerCapture(e.pointerId),document.body.style.webkitUserSelect=v.current,p.viewport&&(p.viewport.style.scrollBehavior=``),_.current=null})})})},`ScrollAreaScrollbarImpl`)),Op=`ScrollAreaThumb`,kp=w.forwardRef(op(function(e,t){let{forceMount:n,...r}=e,i=Ep(Op,e.__scopeScrollArea);return(0,L.jsx)(bi,{present:n||i.hasThumb,children:(0,L.jsx)(Ap,{ref:t,...r})})},`ScrollAreaThumb`)),Ap=w.forwardRef(op(function(e,t){let{__scopeScrollArea:n,style:r,...i}=e,a=fp(Op,n),o=Ep(Op,n),{onThumbPositionChange:s}=o,c=ur(t,o.onThumbChange),l=w.useRef(void 0),u=Hp(()=>{l.current&&=(l.current(),void 0)},100);return w.useEffect(()=>{let e=a.viewport;if(e){let t=op(()=>{if(u(),!l.current){let t=Vp(e,s);l.current=t,s()}},`handleScroll`);return s(),e.addEventListener(`scroll`,t),()=>e.removeEventListener(`scroll`,t)}},[a.viewport,u,s]),(0,L.jsx)(Ar.div,{"data-state":o.hasThumb?`visible`:`hidden`,...i,ref:c,style:{width:`var(--radix-scroll-area-thumb-width)`,height:`var(--radix-scroll-area-thumb-height)`,...r},onPointerDownCapture:V(e.onPointerDownCapture,e=>{let t=e.target.getBoundingClientRect(),n=e.clientX-t.left,r=e.clientY-t.top;o.onThumbPointerDown({x:n,y:r})}),onPointerUp:V(e.onPointerUp,o.onThumbPointerUp)})},`ScrollAreaThumbImpl`)),jp=`ScrollAreaCorner`,Mp=w.forwardRef(op(function(e,t){let n=fp(jp,e.__scopeScrollArea),r=!!(n.scrollbarX&&n.scrollbarY);return n.type!==`scroll`&&r?(0,L.jsx)(Np,{...e,ref:t}):null},`ScrollAreaCorner`)),Np=w.forwardRef(op(function(e,t){let{__scopeScrollArea:n,...r}=e,i=fp(jp,n),[a,o]=w.useState(0),[s,c]=w.useState(0),l=!!(a&&s),{onCornerWidthChange:u,onCornerHeightChange:d}=i;return Up(i.scrollbarX,()=>{let e=i.scrollbarX?.offsetHeight||0;i.onCornerHeightChange(e),c(e)}),Up(i.scrollbarY,()=>{let e=i.scrollbarY?.offsetWidth||0;i.onCornerWidthChange(e),o(e)}),w.useEffect(()=>()=>{u(0),d(0)},[u,d]),l?(0,L.jsx)(Ar.div,{...r,ref:t,style:{width:a,height:s,position:`absolute`,right:i.dir===`ltr`?0:void 0,left:i.dir===`rtl`?0:void 0,bottom:0,...e.style}}):null},`ScrollAreaCornerImpl`));function Pp(e){return e?parseInt(e,10):0}op(Pp,`toInt`);function Fp(e,t){let n=e/t;return isNaN(n)?0:n}op(Fp,`getThumbRatio`);function Ip(e){let t=Fp(e.viewport,e.content),n=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,r=(e.scrollbar.size-n)*t;return Math.max(r,18)}op(Ip,`getThumbSize`);function Lp(e,t,n,r=`ltr`){let i=Ip(n),a=i/2,o=t||a,s=i-o,c=n.scrollbar.paddingStart+o,l=n.scrollbar.size-n.scrollbar.paddingEnd-s,u=n.content-n.viewport,d=r===`ltr`?[0,u]:[u*-1,0];return zp([c,l],d)(e)}op(Lp,`getScrollPositionFromPointer`);function Rp(e,t,n=`ltr`){let r=Ip(t),i=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,a=t.scrollbar.size-i,o=t.content-t.viewport,s=a-r,c=Mf(e,n===`ltr`?[0,o]:[o*-1,0]);return zp([0,o],[0,s])(c)}op(Rp,`getThumbOffsetFromScroll`);function zp(e,t){return n=>{if(e[0]===e[1]||t[0]===t[1])return t[0];let r=(t[1]-t[0])/(e[1]-e[0]);return t[0]+r*(n-e[0])}}op(zp,`linearScale`);function Bp(e,t){return e>0&&e<t}op(Bp,`isScrollingWithinScrollbarBounds`);var Vp=op((e,t=()=>{})=>{let n={left:e.scrollLeft,top:e.scrollTop},r=0;return op((function i(){let a={left:e.scrollLeft,top:e.scrollTop},o=n.left!==a.left,s=n.top!==a.top;(o||s)&&t(),n=a,r=window.requestAnimationFrame(i)}),`loop`)(),()=>window.cancelAnimationFrame(r)},`addUnlinkedScrollListener`);function Hp(e,t){let n=Li(e),r=w.useRef(0);return w.useEffect(()=>()=>window.clearTimeout(r.current),[]),w.useCallback(()=>{window.clearTimeout(r.current),r.current=window.setTimeout(n,t)},[n,t])}op(Hp,`useDebounceCallback`);function Up(e,t){let n=Li(t);ri(()=>{let t=0;if(e){let r=new ResizeObserver(()=>{cancelAnimationFrame(t),t=window.requestAnimationFrame(n)});return r.observe(e),()=>{window.cancelAnimationFrame(t),r.unobserve(e)}}},[e,n])}op(Up,`useResizeObserver`);var Wp=pp,Gp=hp,Kp=Mp,qp=Object.defineProperty,Jp=(e,t)=>qp(e,`name`,{value:t,configurable:!0}),Yp=`horizontal`,Xp=[`horizontal`,`vertical`],Zp=w.forwardRef(Jp(function(e,t){let{decorative:n,orientation:r=Yp,...i}=e,a=Qp(r)?r:Yp,o=n?{role:`none`}:{"aria-orientation":a===`vertical`?a:void 0,role:`separator`};return(0,L.jsx)(Ar.div,{"data-orientation":a,...o,...i,ref:t})},`Separator`));function Qp(e){return Xp.includes(e)}Jp(Qp,`isValidOrientation`);var $p=Zp,em=Object.defineProperty,tm=(e,t)=>em(e,`name`,{value:t,configurable:!0}),nm=`Tabs`,[rm,im]=Fr(nm,[gu]),am=gu(),[om,sm]=rm(nm),cm=w.forwardRef(tm(function(e,t){let{__scopeTabs:n,value:r,onValueChange:i,defaultValue:a,orientation:o=`horizontal`,dir:s,activationMode:c=`automatic`,...l}=e,u=Pi(s),[d,f]=fi({prop:r,onChange:i,defaultProp:a??``,caller:nm});return(0,L.jsx)(om,{scope:n,baseId:Ai(),value:d,onValueChange:f,orientation:o,dir:u,activationMode:c,children:(0,L.jsx)(Ar.div,{dir:u,"data-orientation":o,...l,ref:t})})},`Tabs`)),lm=`TabsList`,um=w.forwardRef(tm(function(e,t){let{__scopeTabs:n,loop:r=!0,...i}=e,a=sm(lm,n),o=am(n);return(0,L.jsx)(Ou,{asChild:!0,...o,orientation:a.orientation,dir:a.dir,loop:r,children:(0,L.jsx)(Ar.div,{role:`tablist`,"aria-orientation":a.orientation,...i,ref:t})})},`TabsList`)),dm=`TabsTrigger`,fm=w.forwardRef(tm(function(e,t){let{__scopeTabs:n,value:r,disabled:i=!1,...a}=e,o=sm(dm,n),s=am(n),c=hm(o.baseId,r),l=gm(o.baseId,r),u=r===o.value;return(0,L.jsx)(ku,{asChild:!0,...s,focusable:!i,active:u,children:(0,L.jsx)(Ar.button,{type:`button`,role:`tab`,"aria-selected":u,"aria-controls":l,"data-state":u?`active`:`inactive`,"data-disabled":i?``:void 0,disabled:i,id:c,...a,ref:t,onMouseDown:V(e.onMouseDown,e=>{!i&&e.button===0&&e.ctrlKey===!1?o.onValueChange(r):e.preventDefault()}),onKeyDown:V(e.onKeyDown,e=>{i||e.target!==e.currentTarget||[` `,`Enter`].includes(e.key)&&o.onValueChange(r)}),onFocus:V(e.onFocus,()=>{let e=o.activationMode!==`manual`;!u&&!i&&e&&o.onValueChange(r)})})})},`TabsTrigger`)),pm=`TabsContent`,mm=w.forwardRef(tm(function(e,t){let{__scopeTabs:n,value:r,forceMount:i,children:a,...o}=e,s=sm(pm,n),c=hm(s.baseId,r),l=gm(s.baseId,r),u=r===s.value,d=w.useRef(u);return w.useEffect(()=>{let e=requestAnimationFrame(()=>d.current=!1);return()=>cancelAnimationFrame(e)},[]),(0,L.jsx)(bi,{present:i||u,children:({present:n})=>(0,L.jsx)(Ar.div,{"data-state":u?`active`:`inactive`,"data-orientation":s.orientation,role:`tabpanel`,"aria-labelledby":c,hidden:!n,id:l,tabIndex:0,...o,ref:t,style:{...e.style,animationDuration:d.current?`0s`:void 0},children:n&&a})})},`TabsContent`));function hm(e,t){return`${e}-trigger-${t}`}tm(hm,`makeTriggerId`);function gm(e,t){return`${e}-content-${t}`}tm(gm,`makeContentId`);var _m=cm,vm=um,ym=fm,bm=mm,xm=e=>typeof e==`boolean`?`${e}`:e===0?`0`:e,Sm=Mt,Cm=(e,t)=>n=>{if(t?.variants==null)return Sm(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=xm(t)||xm(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 Sm(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)},wm=Cm(`group/button inline-flex shrink-0 items-center justify-center rounded-lg border border-transparent bg-clip-padding text-sm font-medium whitespace-nowrap transition-all outline-none select-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 active:not-aria-[haspopup]:translate-y-px disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,{variants:{variant:{default:`bg-primary text-primary-foreground hover:bg-primary/80`,outline:`border-border bg-background hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:border-input dark:bg-input/30 dark:hover:bg-input/50`,secondary:`bg-secondary text-secondary-foreground hover:bg-[color-mix(in_oklch,var(--secondary),var(--foreground)_5%)] aria-expanded:bg-secondary aria-expanded:text-secondary-foreground`,ghost:`hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:hover:bg-muted/50`,destructive:`bg-destructive/10 text-destructive hover:bg-destructive/20 focus-visible:border-destructive/40 focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:hover:bg-destructive/30 dark:focus-visible:ring-destructive/40`,link:`text-primary underline-offset-4 hover:underline`},size:{default:`h-8 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2`,xs:`h-6 gap-1 rounded-[min(var(--radius-md),10px)] px-2 text-xs in-data-[slot=button-group]:rounded-lg has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3`,sm:`h-7 gap-1 rounded-[min(var(--radius-md),12px)] px-2.5 text-[0.8rem] in-data-[slot=button-group]:rounded-lg has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3.5`,lg:`h-9 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2`,icon:`size-8`,"icon-xs":`size-6 rounded-[min(var(--radius-md),10px)] in-data-[slot=button-group]:rounded-lg [&_svg:not([class*='size-'])]:size-3`,"icon-sm":`size-7 rounded-[min(var(--radius-md),12px)] in-data-[slot=button-group]:rounded-lg`,"icon-lg":`size-9`}},defaultVariants:{variant:`default`,size:`default`}});function H({className:e,variant:t=`default`,size:n=`default`,asChild:r=!1,...i}){let a=r?mr:`button`;return(0,L.jsx)(a,{"data-slot":`button`,"data-variant":t,"data-size":n,className:B(wm({variant:t,size:n,className:e})),...i})}function Tm({...e}){return(0,L.jsx)(Xo,{"data-slot":`dialog`,...e})}function Em({...e}){return(0,L.jsx)(Qo,{"data-slot":`dialog-trigger`,...e})}function Dm({...e}){return(0,L.jsx)(ns,{"data-slot":`dialog-portal`,...e})}function Om({...e}){return(0,L.jsx)(_s,{"data-slot":`dialog-close`,...e})}function km({className:e,...t}){return(0,L.jsx)(is,{"data-slot":`dialog-overlay`,className:B(`fixed inset-0 isolate z-50 bg-black/10 duration-100 supports-backdrop-filter:backdrop-blur-xs data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0`,e),...t})}function Am({className:e,children:t,showCloseButton:n=!0,...r}){return(0,L.jsxs)(Dm,{children:[(0,L.jsx)(km,{}),(0,L.jsxs)(cs,{"data-slot":`dialog-content`,className:B(`fixed top-1/2 left-1/2 z-50 grid w-full max-w-[calc(100%-2rem)] -translate-x-1/2 -translate-y-1/2 gap-4 rounded-xl bg-popover p-4 text-sm text-popover-foreground ring-1 ring-foreground/10 duration-100 outline-none sm:max-w-sm data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95`,e),...r,children:[t,n&&(0,L.jsx)(_s,{"data-slot":`dialog-close`,asChild:!0,children:(0,L.jsxs)(H,{variant:`ghost`,className:`absolute top-2 right-2`,size:`icon-sm`,children:[(0,L.jsx)(ot,{}),(0,L.jsx)(`span`,{className:`sr-only`,children:`Close`})]})})]})]})}function jm({className:e,...t}){return(0,L.jsx)(`div`,{"data-slot":`dialog-header`,className:B(`flex flex-col gap-2`,e),...t})}function Mm({className:e,showCloseButton:t=!1,children:n,...r}){return(0,L.jsxs)(`div`,{"data-slot":`dialog-footer`,className:B(`-mx-4 -mb-4 flex flex-col-reverse gap-2 rounded-b-xl border-t bg-muted/50 p-4 sm:flex-row sm:justify-end`,e),...r,children:[n,t&&(0,L.jsx)(_s,{asChild:!0,children:(0,L.jsx)(H,{variant:`outline`,children:`Close`})})]})}function Nm({className:e,...t}){return(0,L.jsx)(ps,{"data-slot":`dialog-title`,className:B(`font-heading text-base leading-none font-medium`,e),...t})}function Pm({className:e,...t}){return(0,L.jsx)(hs,{"data-slot":`dialog-description`,className:B(`text-sm text-muted-foreground *:[a]:underline *:[a]:underline-offset-3 *:[a]:hover:text-foreground`,e),...t})}function Fm({className:e,type:t,...n}){return(0,L.jsx)(`input`,{type:t,"data-slot":`input`,className:B(`h-8 w-full min-w-0 rounded-lg border border-input bg-transparent px-2.5 py-1 text-base transition-colors outline-none file:inline-flex file:h-6 file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:pointer-events-none disabled:cursor-not-allowed disabled:bg-input/50 disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 md:text-sm dark:bg-input/30 dark:disabled:bg-input/80 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40`,e),...n})}function Im({className:e,...t}){return(0,L.jsx)(`textarea`,{"data-slot":`textarea`,className:B(`flex field-sizing-content min-h-16 w-full rounded-lg border border-input bg-transparent px-2.5 py-2 text-base transition-colors outline-none placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:bg-input/50 disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 md:text-sm dark:bg-input/30 dark:disabled:bg-input/80 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40`,e),...t})}function Lm({className:e,...t}){return(0,L.jsx)(`div`,{"data-slot":`input-group`,role:`group`,className:B(`group/input-group relative flex h-8 w-full min-w-0 items-center rounded-lg border border-input transition-colors outline-none in-data-[slot=combobox-content]:focus-within:border-inherit in-data-[slot=combobox-content]:focus-within:ring-0 has-disabled:bg-input/50 has-disabled:opacity-50 has-[[data-slot=input-group-control]:focus-visible]:border-ring has-[[data-slot=input-group-control]:focus-visible]:ring-3 has-[[data-slot=input-group-control]:focus-visible]:ring-ring/50 has-[[data-slot][aria-invalid=true]]:border-destructive has-[[data-slot][aria-invalid=true]]:ring-3 has-[[data-slot][aria-invalid=true]]:ring-destructive/20 has-[>[data-align=block-end]]:h-auto has-[>[data-align=block-end]]:flex-col has-[>[data-align=block-start]]:h-auto has-[>[data-align=block-start]]:flex-col has-[>textarea]:h-auto dark:bg-input/30 dark:has-disabled:bg-input/80 dark:has-[[data-slot][aria-invalid=true]]:ring-destructive/40 has-[>[data-align=block-end]]:[&>input]:pt-3 has-[>[data-align=block-start]]:[&>input]:pb-3 has-[>[data-align=inline-end]]:[&>input]:pr-1.5 has-[>[data-align=inline-start]]:[&>input]:pl-1.5`,e),...t})}var Rm=Cm(`flex h-auto cursor-text items-center justify-center gap-2 py-1.5 text-sm font-medium text-muted-foreground select-none group-data-[disabled=true]/input-group:opacity-50 [&>kbd]:rounded-[calc(var(--radius)-5px)] [&>svg:not([class*='size-'])]:size-4`,{variants:{align:{"inline-start":`order-first pl-2 has-[>button]:ml-[-0.3rem] has-[>kbd]:ml-[-0.15rem]`,"inline-end":`order-last pr-2 has-[>button]:mr-[-0.3rem] has-[>kbd]:mr-[-0.15rem]`,"block-start":`order-first w-full justify-start px-2.5 pt-2 group-has-[>input]/input-group:pt-2 [.border-b]:pb-2`,"block-end":`order-last w-full justify-start px-2.5 pb-2 group-has-[>input]/input-group:pb-2 [.border-t]:pt-2`}},defaultVariants:{align:`inline-start`}});function zm({className:e,align:t=`inline-start`,...n}){return(0,L.jsx)(`div`,{role:`group`,"data-slot":`input-group-addon`,"data-align":t,className:B(Rm({align:t}),e),onClick:e=>{e.target.closest(`button`)||e.currentTarget.parentElement?.querySelector(`input`)?.focus()},...n})}var Bm=w.createContext(null);function Vm(){let e=w.useContext(Bm);if(!e)throw Error(`Command components must be used inside <Command>`);return e}var Hm=null;function Um(e){Hm?.move(e)}function Wm(){Hm?.selectActive()}function Gm(e){return e?Array.from(e.querySelectorAll(`[data-slot="command-item"]`)).filter(e=>e.dataset.disabled!==`true`):[]}function Km({className:e,children:t,...n}){let[r,i]=w.useState(``),[a,o]=w.useState(-1),s=w.useRef(null),c=w.useCallback(()=>{let e=Gm(s.current);e.length!==0&&(a>=0&&a<e.length?e[a]:e[0])?.click()},[a]),l=w.useMemo(()=>({query:r,setQuery:i,rootRef:s,activeIndex:a,setActiveIndex:o,selectActive:c}),[r,a,c]),u=w.useRef({activeIndex:a,setActiveIndex:o,selectActive:c});u.current={activeIndex:a,setActiveIndex:o,selectActive:c};let d=w.useMemo(()=>({move(e){let t=u.current,n=Gm(s.current);if(n.length===0)return;let r=n.length,i=t.activeIndex>=0&&t.activeIndex<r?t.activeIndex:-1;t.setActiveIndex(e===1?(i+1)%r:i<=0?r-1:i-1)},selectActive(){u.current.selectActive()}}),[]);return w.useEffect(()=>(Hm=d,()=>{Hm===d&&(Hm=null)}),[d]),w.useEffect(()=>{Gm(s.current)[a]?.scrollIntoView({block:`nearest`})},[a]),(0,L.jsx)(Bm.Provider,{value:l,children:(0,L.jsx)(`div`,{ref:s,"data-slot":`command`,className:B(`flex size-full flex-col overflow-hidden rounded-xl! bg-popover p-1 text-popover-foreground`,e),...n,children:t})})}function qm({title:e=`Command Palette`,description:t=`Search for a command to run...`,children:n,className:r,showCloseButton:i=!1,...a}){return(0,L.jsxs)(Tm,{...a,children:[(0,L.jsxs)(jm,{className:`sr-only`,children:[(0,L.jsx)(Nm,{children:e}),(0,L.jsx)(Pm,{children:t})]}),(0,L.jsx)(Am,{className:B(`top-1/3 translate-y-0 overflow-hidden rounded-xl! p-0`,r),showCloseButton:i,children:(0,L.jsx)(Km,{className:`[&_[data-slot=command-group-heading]]:px-2 [&_[data-slot=command-group-heading]]:font-medium [&_[data-slot=command-group-heading]]:text-muted-foreground [&_[data-slot=command-group]]:px-2 [&_[data-slot=command-input-wrapper]_svg]:size-5 [&_[data-slot=command-input]]:h-12 [&_[data-slot=command-item]]:px-2 [&_[data-slot=command-item]]:py-3 [&_[data-slot=command-item]_svg]:size-5`,children:n})})]})}function Jm({className:e,value:t,onValueChange:n,...r}){let i=Vm(),a=t!==void 0,o=a?t:i.query;return(0,L.jsxs)(`div`,{"data-slot":`command-input-wrapper`,className:`flex h-9 items-center gap-2 border-b px-3`,children:[(0,L.jsx)(zm,{className:`[&_svg]:size-4 shrink-0 [&_svg]:text-muted-foreground`,children:(0,L.jsx)(Je,{})}),(0,L.jsx)(Lm,{children:(0,L.jsx)(`input`,{"data-slot":`command-input`,className:B(`flex h-9 w-full bg-transparent text-sm outline-hidden placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50`,e),value:o,onChange:e=>{let t=e.target.value;a||i.setQuery(t),n?.(t)},...r})})]})}function Ym({className:e,...t}){return(0,L.jsx)(`div`,{"data-slot":`command-list`,className:B(`max-h-[300px] overflow-y-auto overflow-x-hidden p-1`,e),...t})}function Xm({className:e,...t}){let n=Vm(),[r,i]=w.useState(0);w.useEffect(()=>i(e=>e+1),[n.query]);let a=n.query.trim().toLowerCase();return w.useMemo(()=>{let e=document.querySelector(`[data-slot=command]`);return!e||[...e.querySelectorAll(`[data-slot=command-item]`)].some(e=>!a||(e.dataset.value??``).toLowerCase().includes(a))},[n.query,r])?null:(0,L.jsx)(`div`,{"data-slot":`command-empty`,className:B(`py-6 text-center text-sm text-muted-foreground`,e),...t})}function Zm({className:e,heading:t,children:n,...r}){let i=Vm(),a=w.useRef(null);return w.useMemo(()=>{let e=i.query.trim().toLowerCase();return!a.current||[...a.current.querySelectorAll(`[data-slot=command-item]`)].some(t=>!e||(t.dataset.value??``).toLowerCase().includes(e))},[i.query])?(0,L.jsxs)(`div`,{ref:a,"data-slot":`command-group`,className:B(`overflow-hidden p-1 text-foreground **:[[data-slot=command-group-heading]]:px-2 **:[[data-slot=command-group-heading]]:py-1.5 **:[[data-slot=command-group-heading]]:text-xs **:[[data-slot=command-group-heading]]:font-medium **:[[data-slot=command-group-heading]]:text-muted-foreground`,e),...r,children:[t!==void 0&&(0,L.jsx)(`div`,{"data-slot":`command-group-heading`,className:`px-2 py-1.5 text-xs font-medium text-muted-foreground`,children:t}),n]}):null}function Qm({className:e,...t}){return(0,L.jsx)(`div`,{"data-slot":`command-separator`,className:B(`h-px bg-border`,e),...t})}function $m({className:e,value:t,disabled:n,onSelect:r,children:i,...a}){let o=Vm(),s=w.useRef(null),[c,l]=w.useState(-1);w.useLayoutEffect(()=>{let e=s.current;if(!e||!o.rootRef.current){l(-1);return}let t=o.rootRef.current.querySelectorAll(`[data-slot="command-item"]:not([data-disabled="true"])`);l(Array.prototype.indexOf.call(t,e))});let u=!n&&c>=0&&c===o.activeIndex,d=t??s.current?.textContent??``;w.useEffect(()=>{let e=s.current;e&&(u?(e.dataset.selected=`true`,e.dataset.state=`active`,e.setAttribute(`aria-selected`,`true`)):(delete e.dataset.selected,e.dataset.state=``,e.setAttribute(`aria-selected`,`false`)))},[u]);let f=o.query.trim().toLowerCase();return f&&!d.toLowerCase().includes(f)?null:(0,L.jsx)(`div`,{ref:s,"data-slot":`command-item`,"data-value":d,role:`option`,"aria-selected":u,"data-disabled":n||void 0,"data-state":u?`active`:void 0,onClick:()=>{n||r?.()},className:B(`relative flex cursor-pointer select-none items-center gap-2 rounded-md px-2 py-1.5 text-sm outline-hidden data-[disabled=true]:pointer-events-none data-[selected=true]:bg-[color:var(--surface-raised-base-active)] data-[selected=true]:text-[color:var(--text-strong)] data-[disabled=true]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='text-'])]:text-muted-foreground`,e),...a,children:i})}function eh({className:e,...t}){return(0,L.jsx)(`span`,{"data-slot":`command-shortcut`,className:B(`ml-auto text-xs tracking-widest text-muted-foreground`,e),...t})}var th={showReasoning:!0,showToolDetails:!0,showTimestamps:!1},nh=`webui.prefs`;function rh(){try{let e=localStorage.getItem(nh);if(!e)return{...th};let t=JSON.parse(e);return{...th,...t}}catch{return{...th}}}var ih=rh(),ah=new Set;function oh(){return{...ih}}function sh(e,t){ih={...ih,[e]:t};try{localStorage.setItem(nh,JSON.stringify(ih))}catch{}for(let e of ah)e()}function ch(e){return ah.add(e),()=>ah.delete(e)}async function lh(e,t){let n=Ot(e);if(n.length!==0)for(let r of n)try{await r.handler(t,()=>{})}catch(t){console.error(`[extensions] hook "${r.id}" (${e}) failed:`,t)}}function uh(e,t){let n=new URLSearchParams;if(e&&(e.directory!=null&&n.set(`location[directory]`,e.directory),e.workspace!=null&&n.set(`location[workspace]`,e.workspace)),t)for(let[e,r]of Object.entries(t))r!=null&&n.set(e,String(r));return n.toString()}async function U(e,t){let n=await fetch(e,t);if(!n.ok){let e=`${n.status} ${n.statusText}`;try{let t=await n.json();t.message&&(e=t.message)}catch{}throw Error(e)}if(n.status!==204)return await n.json()}function dh(e,t){return U(e,{method:`POST`,headers:{"content-type":`application/json`},body:t==null?void 0:JSON.stringify(t)})}function fh(e,t){return U(e,{method:`PATCH`,headers:{"content-type":`application/json`},body:JSON.stringify(t)})}var ph={health:()=>U(`/api/webui/status`),webuiReplay:(e,t)=>U(`/api/webui/replay?sessionID=${encodeURIComponent(e)}${t?`&since=${encodeURIComponent(t)}`:``}`),listSessions:(e={})=>{let t=new URLSearchParams;return t.set(`limit`,String(e.limit??50)),e.cursor?t.set(`cursor`,e.cursor):(t.set(`order`,`desc`),e.search&&t.set(`search`,e.search)),U(`/api/session?${t.toString()}`)},activeSessions:()=>U(`/api/session/active`),sessionWait:(e,t)=>fetch(`/api/session/${encodeURIComponent(e)}/wait`,{method:`POST`,signal:t}).then(e=>e.status,()=>-1),sessionLogHead:async e=>{try{let t=await fetch(`/api/experimental/session/${encodeURIComponent(e)}/log?follow=false`);if(!t.ok)return null;let n=await t.text();for(let e of n.split(`
|
|
50
|
-
`))if(e.startsWith(`data:`))try{let t=JSON.parse(e.slice(5).trim());if(t.type===`log.synced`&&typeof t.seq==`number`)return t.seq}catch{}return null}catch{return null}},createSession:e=>U(`/api/session`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify(e)}),getSession:e=>U(`/api/session/${e}`),renameSession:(e,t)=>U(`/api/session/${e}/rename`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({title:t})}),forkSession:(e,t)=>U(`/api/session/${e}/fork`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({boundary:t})}),exportSession:(e,t=!1)=>U(`/api/session/${e}/export?sanitize=${t}`),compactSession:(e,t=`steer`)=>U(`/api/session/${e}/compact`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({id:null,delivery:t})}),deleteSession:e=>U(`/api/session/${e}`,{method:`DELETE`}),switchAgent:(e,t)=>U(`/api/session/${e}/agent`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({agent:t})}),switchModel:(e,t)=>U(`/api/session/${e}/model`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({model:t})}),interrupt:(e,t)=>U(`/api/session/${e}/interrupt${t===void 0?``:`?continue=${t}`}`,{method:`POST`}),moveSession:(e,t)=>U(`/api/session/${e}/move`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({directory:t})}),revertStage:(e,t)=>U(`/api/session/${e}/revert/stage`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({messageID:t})}),revertClear:e=>U(`/api/session/${e}/revert/clear`,{method:`POST`}),revertCommit:e=>U(`/api/session/${e}/revert/commit`,{method:`POST`}),sessionBackground:e=>U(`/api/session/${e}/background`,{method:`POST`}),sessionShell:(e,t)=>U(`/api/session/${e}/shell`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({id:crypto.randomUUID(),command:t})}),messages:(e,t=100)=>U(`/api/session/${e}/message?limit=${t}&order=desc`),messagesWithCursor:(e,t=100,n)=>{let r=new URLSearchParams({limit:String(t)});return n?r.set(`cursor`,n):r.set(`order`,`desc`),U(`/api/session/${e}/message?${r.toString()}`)},prompt:(e,t,n)=>U(`/api/session/${e}/prompt`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify(n?{text:t,delivery:n}:{text:t})}).then(e=>e.data),promptWithFiles:(e,t,n,r)=>U(`/api/session/${e}/prompt`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify(r?{text:t,files:n,delivery:r}:{text:t,files:n})}).then(e=>e.data),runCommand:(e,t,n)=>U(`/api/session/${e}/command`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({command:t,arguments:n??null})}),activateSkill:(e,t)=>U(`/api/session/${e}/skill`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({skill:t})}),pendingPermissions:()=>U(`/api/permission/request`),replyPermission:(e,t,n)=>U(`/api/session/${e}/permission/${t}/reply`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({reply:n,message:null})}),pendingForms:()=>U(`/api/form/request`),sessionForms:e=>U(`/api/session/${e}/form`),formState:(e,t)=>U(`/api/session/${e}/form/${t}/state`),replyForm:(e,t,n)=>U(`/api/session/${e}/form/${t}/reply`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({answer:n})}),cancelForm:(e,t)=>U(`/api/session/${e}/form/${t}/cancel`,{method:`POST`}),questionRequestGet:()=>U(`/api/question/request`),sessionQuestionList:e=>U(`/api/session/${e}/question`),sessionQuestionReply:(e,t,n)=>U(`/api/session/${e}/question/${t}/reply`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({answers:n})}),sessionQuestionReject:(e,t)=>U(`/api/session/${e}/question/${t}/reject`,{method:`POST`}),inboxList:e=>U(`/api/session/${e}/inbox`),inboxQueue:(e,t)=>U(`/api/session/${e}/inbox/${t}/queue`,{method:`POST`}),inboxSteer:(e,t)=>U(`/api/session/${e}/inbox/${t}/steer`,{method:`POST`}),inboxDelete:(e,t)=>U(`/api/session/${e}/inbox/${t}`,{method:`DELETE`}),inboxPrompt:(e,t)=>ph.prompt(e,t,`queue`),location:()=>U(`/api/location`),locationInfo:()=>U(`/api/location`),projectCurrent:()=>U(`/api/project/current`),projectList:()=>U(`/api/project`),fsFind:(e,t)=>{let n=new URLSearchParams({query:e});return t?.location&&n.set(`location[directory]`,t.location),t?.type&&n.set(`type`,t.type),t?.limit!==void 0&&n.set(`limit`,String(t.limit)),U(`/api/fs/find?${n.toString()}`)},fsList:e=>{let t=new URLSearchParams;return e?.location&&t.set(`location[directory]`,e.location),e?.path&&t.set(`path`,e.path),U(`/api/fs/list?${t.toString()}`)},fsRead:async(e,t)=>{let n=e.split(`/`).map(encodeURIComponent).join(`/`),r=new URLSearchParams;t&&r.set(`location[directory]`,t);let i=r.toString(),a=await fetch(`/api/fs/read/${n}${i?`?${i}`:``}`);if(!a.ok){let e=`${a.status} ${a.statusText}`;try{let t=await a.json();t.message&&(e=t.message)}catch{}throw Error(e)}return a.text()},fsReadBytes:async(e,t)=>{let n=e.split(`/`).map(encodeURIComponent).join(`/`),r=new URLSearchParams;t&&r.set(`location[directory]`,t);let i=r.toString(),a=await fetch(`/api/fs/read/${n}${i?`?${i}`:``}`);if(!a.ok)throw Error(`${a.status} ${a.statusText}`);return a.arrayBuffer()},models:async()=>(await U(`/api/model`)).data,agents:async()=>(await U(`/api/agent`)).data,commands:async()=>(await U(`/api/command`)).data,skills:async()=>(await U(`/api/skill`)).data,vcsStatus:e=>U(`/api/vcs/status?${uh(e)}`),vcsDiff:(e,t,n,r)=>U(`/api/vcs/diff?${uh(t,{mode:e,context:n,base:r})}`),vcsBase:e=>U(`/api/vcs/base?${uh(e)}`),shellList:e=>U(`/api/shell?${uh(e)}`),shellCreate:(e,t)=>U(`/api/shell?${uh(t)}`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify(e)}),shellGet:(e,t)=>U(`/api/shell/${e}?${uh(t)}`),shellDelete:(e,t)=>U(`/api/shell/${e}?${uh(t)}`,{method:`DELETE`}),shellOutput:(e,t,n)=>U(`/api/shell/${e}/output?${uh(n,{cursor:t?.cursor,limit:t?.limit})}`),shellTimeout:(e,t,n)=>U(`/api/shell/${e}/timeout?${uh(n)}`,{method:`PATCH`,headers:{"content-type":`application/json`},body:JSON.stringify({timeout:t})}),ptyList:e=>U(`/api/pty?${uh(e)}`),ptyCreate:(e,t)=>U(`/api/pty?${uh(t)}`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify(e)}),ptyDelete:(e,t)=>U(`/api/pty/${e}?${uh(t)}`,{method:`DELETE`}),ptyConnectToken:(e,t)=>U(`/api/pty/${e}/connect-token?${uh(t)}`,{method:`POST`,headers:{"x-opencode-ticket":`1`}}),ptyUpdate:(e,t,n)=>U(`/api/pty/${e}?${uh(n)}`,{method:`PUT`,headers:{"content-type":`application/json`},body:JSON.stringify(t)}),providerList:()=>U(`/api/provider`),providerGet:e=>U(`/api/provider/${e}`),integrationList:()=>U(`/api/integration`),integrationConnectKey:(e,t)=>dh(`/api/integration/${e}/connect/key`,{key:t.key,answer:t.answer??null,label:t.label??null}),integrationConnectOauth:(e,t)=>dh(`/api/integration/${e}/connect/oauth`,{methodID:t.methodID,answer:t.answer??null,label:t.label??null}),integrationConnectCommand:(e,t)=>dh(`/api/integration/${e}/connect/command`,{methodID:t.methodID,label:t.label??null}),integrationOauthAttempt:(e,t)=>U(`/api/integration/${e}/connect/oauth/${t}`),integrationCommandAttempt:(e,t)=>U(`/api/integration/${e}/connect/command/${t}`),mcpList:()=>U(`/api/mcp`),mcpResource:()=>U(`/api/mcp/resource`),mcpPut:(e,t)=>fh(`/api/mcp/${e}`,{config:t}),mcpDelete:e=>U(`/api/mcp/${e}`,{method:`DELETE`}),mcpConnect:e=>dh(`/api/mcp/${e}/connect`,null),mcpDisconnect:e=>dh(`/api/mcp/${e}/disconnect`,null),pluginList:()=>U(`/api/plugin`),websearchProviders:()=>U(`/api/websearch/provider`),websearch:(e,t)=>dh(`/api/websearch`,{query:e,providerID:t}),configGet:()=>U(`/api/config`),credentialPatch:(e,t)=>fh(`/api/credential/${e}`,{label:t}),credentialActivate:e=>dh(`/api/credential/${e}/activate`,void 0),credentialDelete:e=>U(`/api/credential/${e}`,{method:`DELETE`}),serverInfo:()=>U(`/api/server`),serviceStop:e=>dh(`/api/service/stop`,{instanceID:e??``}),generate:(e,t)=>dh(`/api/generate`,{prompt:e,model:t??null}),referenceList:()=>U(`/api/reference`)};function mh(e){let t={};for(let n of Object.keys(e)){let r=e[n];if(typeof r!=`function`){t[n]=r;continue}t[n]=async(...e)=>{let t={name:n,args:e};await lh(`api.pre`,t);let i=Array.isArray(t.args)?t.args:e;try{let e=await r(...i);return await lh(`api.post`,{name:n,args:i,result:e}),e}catch(e){throw await lh(`api.error`,{name:n,args:i,error:e}),e}}}return t}var W=mh(ph),hh=[],gh=null,_h=new Map,vh=new Map;function yh(e){return e.length===0?``:` `+e.map(e=>typeof e==`string`?e:bh(e)).join(` `)}function bh(e){if(e instanceof Error)return e.message;try{return JSON.stringify(e)}catch{return String(e)}}function xh(e){hh.push(e),gh||=setTimeout(()=>{gh=null,Sh()},400)}async function Sh(){if(hh.length===0)return;let e=hh.splice(0);try{await fetch(`/api/debug`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify(e)})}catch{}}var Ch=1e3;function G(e,t,...n){let r=e+`|`+t,i=Date.now(),a=(_h.get(r)??0)+1;_h.set(r,a);let o=vh.get(r)??0;if(a===1||i-o>=Ch){vh.set(r,i);let o=`[${new Date().toISOString().slice(11,23)}] [${e}] ${t}${a>1?` (x${a})`:``}${yh(n)}`;typeof window<`u`&&window.__WEBUI_DEBUG_CONSOLE__&&console.debug(o),xh(o)}}var wh=2e4,Th=3e4,Eh=0;function Dh(){return Eh===0?1/0:Date.now()-Eh}function Oh(){return Dh()>Th}async function kh(e,t={}){for(;!t.signal?.aborted;){let n=!1,r=0;try{let i=await fetch(`/api/event`,{signal:t.signal});if(!i.ok||!i.body)throw Error(`event stream: ${i.status}`);G(`sse`,`connected`,i.status),Eh=Date.now(),t.onOpen?.();let a=i.body.getReader(),o=new TextDecoder,s=``,c=()=>setTimeout(()=>{n=!0,G(`sse`,`STALLED - no data for ${wh/1e3}s (rx=${r}B total); forcing reconnect`),console.warn(`[events] no data for ${wh/1e3}s; forcing reconnect`),a.cancel()},wh),l=c(),u=null,d=t=>{let n;try{n=JSON.parse(t)}catch{return!1}let r=typeof n.type==`string`?n.type:null;if(!r)return!1;let i={id:typeof n.id==`string`?n.id:``,created:typeof n.created==`number`?n.created:Date.now(),type:r,data:n.data??{}};return e({id:i.id,event:r,data:i}),!0};for(;;){let{done:e,value:t}=await a.read();if(e)break;clearTimeout(l),Eh=Date.now(),r+=t.byteLength,s+=o.decode(t,{stream:!0});let n=s.split(`
|
|
51
|
-
`);s=n.pop()??``;for(let e of n){let t=e.trim();if(!t){u=null;continue}if(!t.startsWith(`data:`))continue;let n=t.slice(5).trim();u=d(u?u+n:n)?null:u?u+n:n}l=c()}if(clearTimeout(l),a.releaseLock(),n)throw Error(`event stream stalled`);G(`sse`,`stream ended cleanly; reconnecting (rx=${r}B)`)}catch(e){if(t.signal?.aborted)return;G(`sse`,`reconnect`,String(e)),console.warn(`[events] stream ended, reconnecting:`,e)}n?await new Promise(e=>setTimeout(e,500)):await new Promise(e=>setTimeout(e,1500))}}var Ah=new Map,jh=1,Mh=null,Nh=null,Ph=1e3;function Fh(){return typeof document<`u`&&document.hidden?`hidden`:Nh?Nh.isBusy()||Nh.isSseStale()?`live`:`idle`:`live`}function Ih(e,t){return Math.max(e.minInterval,e.intervals[t]??e.minInterval)}function Lh(e,t){e.lastRun=t,e.inFlight=!0;let n;try{n=e.run()}catch(t){e.inFlight=!1,G(`poll`,`${e.name} failed: ${t instanceof Error?t.message:String(t)}`);return}n instanceof Promise?n.catch(t=>{G(`poll`,`${e.name} failed: ${t instanceof Error?t.message:String(t)}`)}).finally(()=>{e.inFlight=!1}):e.inFlight=!1}function Rh(){let e=Fh(),t=Date.now();for(let n of Ah.values())e===`hidden`&&!n.whenHidden||n.inFlight||t-n.lastRun<Ih(n,e)||Lh(n,t)}function zh(e){Nh=e,!Mh&&(Mh=setInterval(Rh,Ph),typeof document<`u`&&document.addEventListener(`visibilitychange`,Bh))}function Bh(){document.hidden||Rh()}function Vh(e){let t=jh++,n={name:e.name,minInterval:e.minInterval,intervals:e.intervals??{},whenHidden:e.whenHidden??!1,run:e.run,lastRun:Date.now()-Math.random()*e.minInterval,inFlight:!1};return Ah.set(t,n),()=>{Ah.delete(t)}}var Hh=`modulepreload`,Uh=function(e){return`/`+e},Wh={},Gh=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){let e=document.getElementsByTagName(`link`),i=document.querySelector(`meta[property=csp-nonce]`),a=i?.nonce||i?.getAttribute(`nonce`);function o(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}function s(e){return import.meta.resolve?import.meta.resolve(e):new URL(e,import.meta.url).href}r=o(t.map(t=>{if(t=Uh(t,n),t=s(t),t in Wh)return;Wh[t]=!0;let r=t.endsWith(`.css`);for(let n=e.length-1;n>=0;n--){let i=e[n];if(i.href===t&&(!r||i.rel===`stylesheet`))return}let i=document.createElement(`link`);if(i.rel=r?`stylesheet`:Hh,r||(i.as=`script`),i.crossOrigin=``,i.href=t,a&&i.setAttribute(`nonce`,a),document.head.appendChild(i),r)return new Promise((e,n)=>{i.addEventListener(`load`,e),i.addEventListener(`error`,()=>n(Error(`Unable to preload CSS for ${t}`)))})}))}function i(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return r.then(t=>{for(let e of t||[])e.status===`rejected`&&i(e.reason);return e().catch(i)})},Kh=s({DRAFT_SESSION_ID:()=>og,MAIN_PANE:()=>ag,MAX_SPLITS:()=>3,NEW_SESSION_HREF:()=>hg,activateSkill:()=>gy,addSplitPane:()=>kv,applyRevertView:()=>mv,backgroundSubagents:()=>Sy,cancelForm:()=>Ty,cancelPendingRequest:()=>Oy,childSessionsOf:()=>fv,clearHighlightMessage:()=>My,clearPendingEdit:()=>Ky,clearSendError:()=>ry,closeMobileSidebar:()=>cv,closeRunsPanel:()=>av,closeSplitPicker:()=>Ov,commitPendingEdit:()=>qy,compactSession:()=>Hy,consumeRevertPrompt:()=>dv,createRealSession:()=>Py,dismissRunNotice:()=>E_,editAtMessage:()=>Jy,ensureSessionWait:()=>V_,exportSession:()=>Vy,fetchReplay:()=>I_,flushSteersNow:()=>sy,focusPane:()=>Ev,focusedPaneKey:()=>Nv,forkAtMessage:()=>Yy,forkSession:()=>By,getState:()=>mg,handleEvent:()=>P_,interrupt:()=>_y,isDraftSession:()=>sg,lastLiveSignalAt:()=>kg,liveToolPart:()=>d_,loadMessages:()=>Ng,loadMoreSessions:()=>jg,loadSessionDetail:()=>p_,materializeDraft:()=>Fy,navigateFocused:()=>Mv,newSession:()=>Iy,openMobileSidebar:()=>sv,openRunsPanel:()=>iv,openSplitPicker:()=>Dv,pendingDelete:()=>iy,pendingRequests:()=>rg,pendingSendNow:()=>oy,pendingSetDelivery:()=>ay,prefetchSession:()=>Pv,reconcileInbox:()=>Xv,redoSession:()=>Wy,refreshSessions:()=>Ag,rejectQuestion:()=>Dy,removeSplitPane:()=>Av,renameSession:()=>zy,replyForm:()=>wy,replyPermission:()=>Cy,replyQuestion:()=>Ey,requestInterrupt:()=>xy,requestShellPanel:()=>nv,resolveDefaultModel:()=>h_,revealSubagentComposer:()=>uv,revertMarkerFor:()=>hv,selectSession:()=>vv,sendCommand:()=>ey,sendPrompt:()=>Rv,sendPromptTo:()=>zv,sendPromptWithFiles:()=>ny,sendShell:()=>ty,sessionHref:()=>gg,sessionLabel:()=>ig,sessionOrSubagentsLive:()=>pv,setHighlightMessage:()=>jy,setMobileSidebarOpen:()=>ov,setPaneSession:()=>jv,setPendingWorkspace:()=>Ay,setRunsSelection:()=>lv,signalUI:()=>rv,startDraftSession:()=>ky,startEditAtMessage:()=>Gy,startStore:()=>Y_,switchAgent:()=>Ly,switchModel:()=>Ry,toolStateFor:()=>Xy,undoSession:()=>Uy,useStore:()=>J}),qh=0,Jh=()=>++qh,Yh=new Map,Xh=6e4;function Zh(e){let t=Date.now();for(let n of e)Yh.has(n)||Yh.set(n,t);if(Yh.size>500)for(let[e,n]of Yh)t-n>10*Xh&&Yh.delete(e)}var Qh=new Map;function $h(e,t){let n=new Map(e.map(e=>[e.id,e]));return t.map(e=>n.get(e.id)||{...e,seq:Jh()})}function eg(e){return e.metadata?.kind===`question`}function tg(e){let t=e.metadata;return{id:e.id,sessionID:e.sessionID,seq:e.seq,channel:`form`,tool:t?.tool,questions:e.fields.map(e=>{let t=e;return{header:(`title`in e?e.title:void 0)??e.key,question:(`description`in e?e.description:void 0)??``,options:(`options`in e?e.options??[]:[]).map(e=>({label:e.label,value:e.value,description:e.description??``})),multiple:`type`in e&&e.type===`multiselect`,custom:t.custom===!0}})}}var ng=null;function rg(e){if(ng&&ng.permissions===e.permissions&&ng.forms===e.forms&&ng.questions===e.questions)return ng.out;let t=[];for(let n of e.permissions)t.push({kind:`permission`,req:n});for(let n of e.questions)t.push({kind:`question`,req:n});for(let n of e.forms)eg(n)?t.push({kind:`question`,req:tg(n)}):t.push({kind:`form`,req:n});let n=t.sort((e,t)=>e.req.seq-t.req.seq);return ng={permissions:e.permissions,forms:e.forms,questions:e.questions,out:n},n}function ig(e,t){return sg(t)?`New session`:e.sessions.find(e=>e.id===t)?.title??e.sessionDetails[t]?.title??`session ${t.slice(0,8)}…`}var ag=`main`,og=`__draft__`;function sg(e){return e===og}var K={connected:!1,serviceOK:!1,sessions:[],sessionsCursor:null,activeIDs:[],messages:{},sessionDetails:{},live:[],running:{},queued:{},permissions:[],forms:[],questions:[],currentSessionID:null,panes:[{id:ag,sessionID:null}],focusedPane:ag,splitPickerOpen:!1,shellPanelTick:0,uiSignals:{models:0,agents:0,themes:0,explorer:0,runsDialog:0,help:0,variants:0},revertPrompt:null,runsPanelOpen:!1,mobileSidebarOpen:!1,runsSelection:null,subagentComposerOpen:!1,draftWorkspace:null,pendingAgent:null,pendingModel:null,sendErrors:{},pending:{},runNotices:{},pendingWorkspace:null,interruptArmed:!1,highlightMessageID:null,highlightSessionID:null,highlightQuery:null,highlightTick:0,pendingEdit:null,revertMarkers:{}},cg=new Set,lg=0,ug=!1;function q(e){if(K={...K,...e},lh(`store.dispatch`,{patch:e,state:K}),lg>0){ug=!0;return}dg()}function dg(){for(let e of cg)e()}function fg(e){lg+=1;try{e()}finally{--lg,lg===0&&ug&&(ug=!1,dg())}}function pg(e,t){if(Object.is(e,t))return!0;if(e===null||t===null||typeof e!=`object`||typeof t!=`object`)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.is(e[r],t[r]))return!1;return!0}function J(e){let t=(0,w.useRef)(null);return(0,w.useSyncExternalStore)(e=>(cg.add(e),()=>cg.delete(e)),()=>{let n=e(K);return t.current&&pg(t.current.value,n)?t.current.value:(t.current={value:n},n)})}function mg(){return K}var hg=`/new-session`;function gg(e){return`/session/${encodeURIComponent(e)}`}function _g(){if(typeof window>`u`)return null;let e=window.location.pathname.match(/^\/session\/([^/]+)\/?$/);if(!e)return null;let t=e[1];if(!t)return null;try{return decodeURIComponent(t)}catch{return null}}function vg(){return typeof window<`u`&&window.location.pathname===`/new-session`}function yg(e,t){if(typeof window>`u`)return;let n=e===`__draft__`?hg:e?gg(e):`/`;window.location.pathname===n&&!window.location.search&&!window.location.hash||window.history[t===`replace`?`replaceState`:`pushState`]({},``,n)}var bg=null;function xg(){bg&&clearTimeout(bg),bg=setTimeout(()=>void Ag(),400)}var Sg=100,Cg=3e4,wg=15e3,Tg=45e3,Eg=new Map,Dg=new Map;function Og(e){e&&Eg.set(e,Date.now())}function kg(e){return Dg.get(e)??0}async function Ag(){try{let e=await W.listSessions({limit:Math.max(Sg,K.sessions.length+1)}),t=await W.activeSessions(),n=new Set(Object.keys(t.data)),r=Date.now(),i={...K.running},a=[];for(let e of n)i[e]||r-(Eg.get(e)??0)<Cg||(i[e]=!0,a.push(e));for(let e of a)V_(e);for(let[e,t]of Object.entries(i))!t||n.has(e)||r-kg(e)<wg||delete i[e];let o={...K.queued};for(let[e,t]of Object.entries(o))!t||n.has(e)||i[e]||r-kg(e)<Tg||delete o[e];let s=[...e.data].sort((e,t)=>t.time.updated-e.time.updated),c=K.sessions.length!==s.length||K.sessions.some((e,t)=>{let n=s[t];return!n||n.id!==e.id||n.time.updated!==e.time.updated||n.title!==e.title}),l=(e,t)=>{let n=Object.keys(e).filter(t=>e[t]),r=Object.keys(t).filter(e=>t[e]);return n.length===r.length&&n.every(e=>t[e])},u=[...n],d=K.activeIDs.length!==u.length||K.activeIDs.some((e,t)=>e!==u[t]);if(!c&&!d&&l(K.running,i)&&l(K.queued,o))return;q({...c?{sessions:s,sessionsCursor:e.cursor.next}:{},...d?{activeIDs:u}:{},...l(K.running,i)?{}:{running:i},...l(K.queued,o)?{}:{queued:o}})}catch(e){console.warn(`refreshSessions failed:`,e)}}async function jg(){try{let e=await W.listSessions({limit:Sg,cursor:K.sessionsCursor}),t=new Map;for(let e of K.sessions)t.set(e.id,e);for(let n of e.data)t.set(n.id,n);q({sessions:[...t.values()].sort((e,t)=>t.time.updated-e.time.updated),sessionsCursor:e.cursor.next})}catch(e){console.warn(`loadMoreSessions failed:`,e)}}async function Mg(){let e=new Set(K.panes.map(e=>e.sessionID).filter(e=>!!e)),[t,n,...r]=await Promise.allSettled([W.pendingPermissions(),W.pendingForms(),...[...e].map(e=>W.sessionForms(e))]);function i(e,t){let n=new Map($h(e,t).map(e=>[e.id,e]));for(let t of e)n.has(t.id)||n.set(t.id,t);return[...n.values()]}if(t.status===`fulfilled`){let e=t.value.data;q({permissions:i(K.permissions,e)})}else console.warn(`refreshQueues permissions failed:`,t.reason);if(n.status===`fulfilled`){let e=new Map,t=t=>{e.has(t.id)||e.set(t.id,t)};n.value.data.forEach(t);for(let e of r)e.status===`fulfilled`?e.value.data.forEach(t):console.warn(`refreshQueues session forms failed:`,e.reason);let a=[...e.values()],o=K.forms;Zh([...o.map(e=>e.id),...a.map(e=>e.id)]);let s=new Set(o.map(e=>e.id)),c=new Set;await Promise.all([...s].map(async t=>{let n=K.forms.find(e=>e.id===t)??e.get(t);if(n)try{((await W.formState(n.sessionID,t)).data?.status??`pending`)!==`pending`&&c.add(t)}catch(e){let n=e instanceof Error?e.message:String(e),r=Yh.get(t)??Date.now();n.includes(`404`)&&Date.now()-r>Xh&&c.add(t)}}));let l=Date.now();for(let e of c)Qh.set(e,l);if(Qh.size>500)for(let[e,t]of Qh)l-t>Xh&&Qh.delete(e);let u=a.filter(e=>{let t=Qh.get(e.id);return t===void 0||Date.now()-t>Xh});G(`queue`,`refresh forms=${o.length} listed=${a.length} settled=${c.size}`),q({forms:i(K.forms,u).filter(e=>!c.has(e.id))})}else console.warn(`refreshQueues forms failed:`,n.reason)}async function Ng(e){if(sg(e))return;let t=Fg(e),n=[],r,i=0;try{do{let a=r?await W.messagesWithCursor(e,200,r):await W.messages(e,200);if(Pg.get(e)!==t)return;let o=a.data;if(n.push(...o),r=a.cursor?.next,i++,o.length<200)break}while(r&&i<5)}catch(e){if(n.length===0){console.warn(`loadMessages failed:`,e);return}console.warn(`loadMessages partial failure, using`,n.length,`messages:`,e)}if(Pg.get(e)!==t)return;let a=[...n].reverse();G(`load`,`messages ${e}: ${a.length} (${i} pages)`),r_(e,a)}var Pg=new Map;function Fg(e){let t=(Pg.get(e)??0)+1;return Pg.set(e,t),t}function Ig(e){return e?.type===`assistant`&&e.time.completed===void 0}function Lg(e){return K.panes.some(t=>t.sessionID===e)}function Rg(e){return K.live.filter(t=>t.sessionID===e)}function zg(e){return e?!!(Lg(e)||e===K.currentSessionID||Rg(e).length>0||K.running[e]||K.queued[e]||K.activeIDs.includes(e)):!1}function Bg(e){let t=new Set(e.map(e=>e.sessionID));return K.live.filter(e=>t.has(e.sessionID)||!!K.running[e.sessionID]||!!K.queued[e.sessionID]||K.activeIDs.includes(e.sessionID))}var Vg=`webui.live.`;function Hg(e){return`${Vg}${e}`}function Ug(e){if(!(!e||sg(e)))try{if(typeof localStorage>`u`)return;let t=Rg(e);if(t.length===0){localStorage.removeItem(Hg(e));return}let n=t.map(e=>({id:e.id,sessionID:e.sessionID,agent:e.agent,model:e.model,started:e.started,completed:e.completed,finish:e.finish,cost:e.cost,error:e.error,content:e.content.map(e=>e.type===`tool`?{type:`tool`,tool:{id:e.tool.id,name:e.tool.name,inputText:e.tool.inputText,input:e.tool.input,status:e.tool.status,content:e.tool.content,metadata:e.tool.metadata,error:e.tool.error,executed:e.tool.executed,created:e.tool.created,ran:e.tool.ran,completed:e.tool.completed}}:{type:e.type,ordinal:e.ordinal,text:e.text})}));localStorage.setItem(Hg(e),JSON.stringify(n))}catch{}}function Wg(e){try{if(typeof localStorage>`u`)return;localStorage.removeItem(Hg(e))}catch{}}function Gg(e){if(!e||sg(e)||Rg(e).length>0)return!1;try{if(typeof localStorage>`u`)return!1;let t=localStorage.getItem(Hg(e));if(!t)return!1;let n=JSON.parse(t);if(!Array.isArray(n)||n.length===0)return!1;let r=[];for(let t of n){if(!t||typeof t.id!=`string`||typeof t.sessionID!=`string`||t.sessionID!==e)continue;let n=Array.isArray(t.content)?t.content:[],i=[],a=new Map;for(let e of n)if(!(!e||typeof e.type!=`string`)){if(e.type===`tool`&&e.tool&&typeof e.tool.id==`string`){let t=e.tool,n={id:t.id,name:t.name??`tool`,inputText:t.inputText??``,input:t.input,status:t.status??`streaming`,content:t.content,metadata:t.metadata,error:t.error,executed:t.executed,created:t.created,ran:t.ran,completed:t.completed};a.set(n.id,n),i.push({type:`tool`,tool:n})}else(e.type===`text`||e.type===`reasoning`)&&typeof e.ordinal==`number`&&typeof e.text==`string`&&i.push({type:e.type,ordinal:e.ordinal,text:e.text})}let o={sessionID:t.sessionID,id:t.id,agent:t.agent,model:t.model,content:i,text:``,reasoning:``,tools:a,finish:t.finish,cost:t.cost,error:t.error,started:typeof t.started==`number`?t.started:Date.now(),completed:t.completed};r.push(qg(o,i))}return r.length!==0&&(q({live:[...K.live,...r]}),G(`load`,`restored ${r.length} live assistant(s) for ${e} from localStorage`),!0)}catch{return!1}}function Kg(e){return{text:e.filter(e=>e.type===`text`).map(e=>e.text).join(``),reasoning:e.filter(e=>e.type===`reasoning`).map(e=>e.text).join(``),tools:new Map(e.filter(e=>e.type===`tool`).map(e=>[e.tool.id,e.tool]))}}function qg(e,t){return{...e,content:t,...Kg(t)}}function Jg(e){let t=e.state,n=t.status===`streaming`?t.input:JSON.stringify(t.input);return{id:e.id,name:e.name,inputText:n,input:t.status===`streaming`?void 0:t.input,status:t.status,content:`content`in t?t.content:void 0,metadata:`metadata`in t?t.metadata:void 0,error:t.status===`error`?t.error:void 0,executed:e.executed,created:e.time.created,ran:e.time.ran,completed:e.time.completed}}function Yg(e,t){let n={text:0,reasoning:0},r=t.content.map(e=>{if(e.type===`tool`)return{type:`tool`,tool:Jg(e)};let t=n[e.type]++;return{type:e.type,ordinal:t,text:e.text}});return qg({sessionID:e,id:t.id,agent:t.agent,model:t.model,content:[],text:``,reasoning:``,tools:new Map,finish:t.finish,cost:t.cost,error:t.error,started:t.time.created,completed:t.time.completed},r)}function Xg(e,t){return e?t?t.startsWith(e)||e.endsWith(t)?t.length>=e.length?t:e:e.startsWith(t)?e:`${e}${t}`:e:t}function Zg(e,t){if(!t)return e;if(!e)return t;if(e.endsWith(t))return e;let n=Math.min(e.length,t.length-1);for(let r=n;r>0;r--)if(e.endsWith(t.slice(0,r)))return e+t.slice(r);return e+t}function Qg(e){return e.type===`tool`?`tool:${e.tool.id}`:`${e.type}:${e.ordinal}`}function $g(e,t){let n=Yg(e.sessionID,t);if(e.content.length===0)return{...n,id:e.id,started:e.started,sessionID:e.sessionID};let r=new Map(e.content.map(e=>[Qg(e),e])),i=n.content.map(e=>{let t=r.get(Qg(e));if(!t)return e;if(e.type===`tool`&&t.type===`tool`){let n=e.tool,r=t.tool;return{type:`tool`,tool:{...n,...r,inputText:Xg(n.inputText,r.inputText),input:r.input??n.input,status:r.status===`streaming`&&n.status!==`streaming`?n.status:r.status,content:r.content??n.content,metadata:r.metadata??n.metadata,error:r.error??n.error,executed:r.executed??n.executed,created:n.created??r.created,ran:r.ran??n.ran,completed:r.completed??n.completed}}}return e.type!==`tool`&&t.type!==`tool`?{...e,text:Xg(e.text,t.text)}:e}),a=new Set(i.map(Qg));return i.push(...e.content.filter(e=>!a.has(Qg(e)))),qg({...e,agent:e.agent??n.agent,model:e.model??n.model,finish:e.finish??n.finish,cost:e.cost??n.cost,error:e.error??n.error,completed:e.completed??n.completed},i)}function e_(e,t){if(Rg(e).length===0&&Gg(e),!zg(e)&&!Lg(e))return;let n=Rg(e).length>0,r=e===K.currentSessionID;if(!(K.running[e]||K.queued[e]||K.activeIDs.includes(e)||n)&&!(r&&n))return;let i=new Map(t.filter(e=>e.type===`assistant`&&Ig(e)).map(e=>[e.id,e])),a=new Set(Rg(e).map(e=>e.id)),o=[];for(let n of t)n.type!==`assistant`||!Ig(n)||a.has(n.id)||(a.add(n.id),o.push(Yg(e,n)));let s=!1,c=K.live.map(t=>{if(t.sessionID!==e)return t;let n=i.get(t.id);if(!n)return t;let r=$g(t,n);return s||=r!==t,r});o.length>0&&(G(`load`,`seeded ${o.length} in-flight assistant(s) for ${e}`),c=[...c,...o],s=!0),s&&q({live:c})}function t_(e,t){let n=new Map(t.map(e=>[e.id,e]));return new Set(Rg(e).filter(e=>{let t=n.get(e.id);return e.id!==`pending`&&(!t||Ig(t))}).map(e=>e.id))}function n_(e,t){let n=K.messages[e]??[],r=t_(e,t),i=new Map,a=new Map;for(let e of n)e.type===`user`&&!e.id.startsWith(`msg_local_`)&&i.set(e.text,(i.get(e.text)??0)+1);for(let e of t)e.type===`user`&&a.set(e.text,(a.get(e.text)??0)+1);let o=new Map;for(let[e,t]of a){let n=t-(i.get(e)??0);n>0&&o.set(e,n)}let s=new Map;for(let e of n)if(!r.has(e.id)){if(e.id.startsWith(`msg_local_`)&&e.type===`user`){let t=o.get(e.text)??0;if(t>0){o.set(e.text,t-1);continue}}s.set(e.id,e)}for(let e of t)r.has(e.id)||s.set(e.id,e);return[...s.values()].sort((e,t)=>e.time.created-t.time.created||e.id.localeCompare(t.id))}function r_(e,t){e_(e,t);let n=n_(e,t);if(!Lg(e)){let r=new Map(t.map(e=>[e.id,e])),i=!K.running[e]&&!K.queued[e],a=Rg(e),o=new Set(a.filter(e=>{if(e.id===`pending`)return!1;if(i&&!r.has(e.id)&&Date.now()-e.started>3e4)return!0;let t=r.get(e.id);return t?.type===`assistant`&&t.time.completed!==void 0}).map(e=>e.id)),s=o.size>0?K.live.filter(t=>!(t.sessionID===e&&o.has(t.id))):K.live;q({messages:{...K.messages,[e]:n},...s===K.live?{}:{live:s}}),a.length>0&&o.size===a.length&&Wg(e);return}let r=new Map(t.map(e=>[e.id,e])),i=Rg(e),a=i.find(e=>e.id===`pending`),o=!!a&&t.some(e=>e.type===`assistant`&&e.time.completed!==void 0&&e.time.created>=a.started-5e3),s=new Set(i.filter(e=>{let t=r.get(e.id);return t?.type===`assistant`&&t.time.completed!==void 0}).map(e=>e.id)),c=!K.running[e]&&!K.queued[e],l=new Set(c?i.filter(e=>e.id!==`pending`&&!r.has(e.id)&&Date.now()-e.started>3e4).map(e=>e.id):[]),u={...K.running};o&&(delete u[e],D_.delete(e));let d=K.live.filter(t=>t.sessionID!==e||(t.id===`pending`?!o:!(s.has(t.id)||l.has(t.id)))),f=K.live.some(t=>t.sessionID===e),p=d.some(t=>t.sessionID===e);q({messages:{...K.messages,[e]:n},live:d,running:u}),(f&&!p&&(s.size>0||l.size>0||o)||f&&!p&&t.some(e=>e.type===`assistant`&&e.time.completed!==void 0))&&Wg(e)}function i_(e,t,n=Date.now()){let r=K.live.find(n=>n.sessionID===e&&n.id===t);if(r)return r;let i=K.messages[e],a=i?.find(e=>e.id===t&&e.type===`assistant`&&Ig(e)),o=a?Yg(e,a):{sessionID:e,id:t,content:[],text:``,reasoning:``,tools:new Map,started:n};return q({live:[...K.live,o],...a?{messages:{...K.messages,[e]:i.filter(e=>e.id!==t)}}:{}}),o.id!==`pending`&&Ug(e),o}function a_(e,t){let n=K.messages[e];n?.some(e=>e.id===t&&Ig(e))&&q({messages:{...K.messages,[e]:n.filter(e=>e.id!==t)}})}function o_(e,t){let n=K.live.find(t=>t.id===e)?.sessionID;q({live:K.live.map(n=>{if(n.id!==e)return n;let r={...n,...t,tools:new Map(n.tools)};return t.content?qg(r,t.content):r})}),n&&Ug(n)}function s_(e,t,n,r){let i=i_(e,t),a=i.content.find(e=>e.type===n&&e.ordinal===r);if(a)return a;let o={type:n,ordinal:r,text:``};return o_(t,{content:[...i.content,o]}),o}function c_(e,t,n,r,i){let a=K.live.find(t=>t.id===e);a&&o_(e,{content:a.content.map(e=>e.type!==t||e.ordinal!==n?e:{...e,text:i===`append`?Zg(e.text,r):r})})}function l_(e,t,n,r){let i=i_(e,t),a=i.tools.get(n);if(a)return a;let o={id:n,name:r??`tool`,inputText:``,status:`streaming`,created:Date.now()};return o_(t,{content:[...i.content,{type:`tool`,tool:o}]}),o}function u_(e,t,n){let r=K.live.find(t=>t.id===e);if(!r)return;let i=r.tools.get(t);if(!i)return;let a=Object.fromEntries(Object.entries(n).filter(([,e])=>e!==void 0)),o={...i,...a};o_(e,{content:r.content.map(e=>e.type===`tool`&&e.tool.id===t?{type:`tool`,tool:o}:e)})}function d_(e){let t=e.status===`streaming`?e.inputText:e.input===void 0?{}:e.input,n=e.status===`error`?{status:`error`,input:t,error:e.error??{type:`error`,message:`tool failed`},content:e.content}:e.status===`completed`?{status:`completed`,input:t,content:e.content??[],metadata:e.metadata}:e.status===`running`?{status:`running`,input:t,metadata:e.metadata}:{status:`streaming`,input:e.inputText};return{type:`tool`,id:e.id,name:e.name,executed:e.executed,state:n,time:{created:e.created??Date.now(),ran:e.ran,completed:e.completed}}}function f_(e,t,n){let r=K.live.find(t=>t.sessionID===e&&t.id===`pending`&&t.text===``&&t.reasoning===``&&t.tools.size===0);if(!r){i_(e,t),o_(t,n);return}let i=K.live.find(n=>n.sessionID===e&&n.id===t);if(i&&(i.content.length>0||i.tools.size>0)){q({live:K.live.filter(e=>e!==r).map(e=>e===i?{...e,...n,tools:new Map(e.tools)}:e)}),Ug(e);return}q({live:K.live.map(i=>i===r?{...i,...n,id:t}:i.sessionID===e&&i.id===t?null:i).filter(e=>e!==null)}),t!==`pending`&&Ug(e)}async function p_(e){if(!sg(e))try{let t=(await W.getSession(e)).data,n=K.revertMarkers;if(n[e]===void 0){let r=t.revert?.messageID;r&&(n={...n,[e]:r})}q({sessionDetails:{...K.sessionDetails,[e]:t},...n===K.revertMarkers?{}:{revertMarkers:n}})}catch(e){console.warn(`loadSessionDetail failed:`,e)}}var m_=null;function h_(){return m_??=(async()=>{try{let e=(await W.agents()).find(e=>e.mode===`primary`&&!e.hidden);if(e?.model)return e.model}catch{}try{let e=(await W.models()).filter(e=>e.enabled);if(e.length>0)return{id:e[0].modelID,providerID:e[0].providerID}}catch{}})(),m_}async function g_(e){if(K.pendingAgent&&!sg(e)){let t=K.pendingAgent;try{await W.switchAgent(e,t),G(`model`,`committed agent ${t} on send`)}catch(e){console.warn(`switchAgent on send failed:`,e)}q({pendingAgent:null})}if(K.pendingModel&&!sg(e)){let t=K.pendingModel;try{await W.switchModel(e,t),G(`model`,`committed model ${t.providerID}/${t.id} on send`)}catch(e){console.warn(`switchModel on send failed:`,e)}q({pendingModel:null})}}async function __(e){if(sg(e))return;if(K.sessions.find(t=>t.id===e)?.model||K.pendingModel){await g_(e);return}let t=await h_();if(t)try{await W.switchModel(e,t),G(`model`,`pinned ${e} -> ${t.providerID}/${t.id}`)}catch(e){console.warn(`ensureSessionModel failed:`,e)}}async function v_(e){await Ng(e);let t=Rg(e).filter(e=>e.id!==`pending`).map(e=>e.id);if(t.length===0)return;let n=K.messages[e]??[];t.filter(e=>!n.some(t=>t.id===e)).length>0&&setTimeout(()=>void Ng(e),1500)}var y_=15e3,b_=0;function x_(e,t){let n={...K.runNotices};t&&t.length>0?n[e]=t:delete n[e],q({runNotices:n})}function S_(e){K.runNotices[e]&&x_(e,null)}function C_(e){let t=K.runNotices[e];t?.some(e=>e.kind===`retry`)&&x_(e,t.filter(e=>e.kind!==`retry`))}function w_(e){if(!e||typeof e!=`object`)return!1;let t=e,n=(t.type??``).toLowerCase(),r=(t.message??``).toLowerCase();return n===`aborted`||n===`abort`||r.includes(`aborted`)||r.includes(`step interrupted`)||r.includes(`run interrupted`)||r.includes(`interrupted`)}function T_(e,t,n,r=Date.now()){if(!e||sg(e)||t===`interrupted`||t===`failed`&&/aborted|step interrupted|run interrupted/i.test(n))return;let i=K.runNotices[e]??[],a=i[i.length-1];if(a&&a.kind===t&&a.text===n&&r-a.at<y_)return;let o={id:`rn_${++b_}`,kind:t,text:n,at:r};x_(e,[...i,o].slice(-3))}function E_(e,t){let n=K.runNotices[e];n?.some(e=>e.id===t)&&x_(e,n.filter(e=>e.id!==t))}var D_=new Set,O_=new Set,k_=new Set([`session.execution.started`,`session.execution.succeeded`,`session.execution.failed`,`session.execution.interrupted`,`session.step.started`,`session.step.ended`,`session.step.failed`,`session.text.started`,`session.text.delta`,`session.text.ended`,`session.reasoning.started`,`session.reasoning.delta`,`session.reasoning.ended`,`session.tool.called`,`session.tool.input.started`,`session.tool.input.delta`,`session.tool.input.ended`,`session.tool.progress`,`session.tool.success`,`session.tool.failed`,`session.retry.scheduled`]);function A_(e){return[...K.live].reverse().find(t=>t.sessionID===e&&t.id!==`pending`)}function j_(e){!e||K.running[e]||(G(`run`,`live via stream delta ${e}`),q({running:{...K.running,[e]:!0},queued:{...K.queued,[e]:!1}}))}function M_(e){C_(e);let t={...K.running};delete t[e],D_.delete(e),Og(e),q({running:t,queued:{...K.queued,[e]:!1}}),K.live.some(t=>t.sessionID===e&&t.id===`pending`)&&q({live:K.live.filter(t=>t.sessionID!==e||t.id!==`pending`)}),v_(e),uy(e),xg()}function N_(e,t,n){let r={...K.running};delete r[e],D_.delete(e),Og(e),q({running:r,queued:{...K.queued,[e]:!1}}),K.live.some(t=>t.sessionID===e&&t.id===`pending`)&&q({live:K.live.filter(t=>t.sessionID!==e||t.id!==`pending`)});let i=A_(e);i&&o_(i.id,{finish:t===`session.execution.succeeded`?`stop`:t===`session.execution.failed`?`error`:`interrupted`,error:n??(t===`session.execution.succeeded`?void 0:i.error)}),v_(e),uy(e),xg()}function P_(e){let{type:t,data:n}=e,r=n.sessionID;r&&(k_.has(t)||t===`session.status`)&&Dg.set(r,Date.now());let i=r?zg(r)||Lg(r):!1;if(e.id&&r&&i&&O_.has(e.id))return;e.id&&r&&i&&(O_.size>2e4&&O_.clear(),O_.add(e.id));let a=e=>!!e&&Lg(e),o=e=>!!e&&zg(e);switch(G(`evt`,t,`sid=${n.sessionID??`-`}`,`current=${K.currentSessionID??`-`}`,`mid=${n.assistantMessageID??`-`}`),r&&k_.has(t)&&!Lg(r)&&!zg(r)?G(`gate`,`${t} for non-pane session ${r} — skipped`):r&&k_.has(t)&&!Lg(r)&&G(`gate`,`${t} for non-pane session ${r} — tracked via shouldTrackLive`),t){case`session.created`:case`session.renamed`:case`session.deleted`:case`session.moved`:case`session.forked`:case`session.usage.updated`:xg(),r&&(K.messages[r]?.length??0)>0&&Ng(r),t!==`session.usage.updated`&&p_(n.sessionID);break;case`session.revert.staged`:{let e=n.revert?.messageID;r&&e&&gv(r,e),xg(),r&&(K.messages[r]?.length??0)>0&&Ng(r),r&&p_(n.sessionID);break}case`session.revert.committed`:{let e=n.to;if(r&&e){let t=K.messages[r]??[],n=t.findIndex(t=>t.id===e);if(n!==-1){let e=[...t.slice(0,n),...t.slice(n).filter(e=>e.id.startsWith(`msg_local_`))];q({messages:{...K.messages,[r]:e},revertMarkers:{...K.revertMarkers,[r]:null}})}else gv(r,null)}xg(),r&&(Ng(r),p_(r));break}case`session.revert.cleared`:r&&gv(r,null),xg(),r&&(K.messages[r]?.length??0)>0&&Ng(r),r&&p_(n.sessionID);break;case`session.agent.selected`:case`session.model.selected`:xg(),p_(n.sessionID);break;case`session.inbox.enqueued`:{let e=n,t=typeof e.id==`string`&&e.id?e.id:typeof e.inboxID==`string`&&e.inboxID?e.inboxID:void 0;e.sessionID&&!sg(e.sessionID)&&t&&typeof e.payload?.text==`string`&&Zv(e.sessionID,{id:t,text:e.payload.text,delivery:e.delivery}),a(n.sessionID)&&(G(`run`,`queued ${n.sessionID}`),q({queued:{...K.queued,[n.sessionID]:!0}}));break}case`session.inbox.delivered`:{let e=n,t=typeof e.id==`string`&&e.id?e.id:typeof e.inboxID==`string`&&e.inboxID?e.inboxID:void 0;t&&Qv(t);break}case`session.error`:if(n.sessionID){let t=n.error;t&&!w_(t)?(q({sendErrors:{...K.sendErrors,[n.sessionID]:{type:t.type??`error`,message:t.message,status:t.status}}}),T_(n.sessionID,`error`,`${t.type}: ${t.message}`,e.created)):t&&w_(t),my(n.sessionID)}break;case`session.execution.started`:D_.add(n.sessionID),G(`run`,`started ${n.sessionID}`),q({running:{...K.running,[n.sessionID]:!0},queued:{...K.queued,[n.sessionID]:!1}}),V_(n.sessionID),o(n.sessionID)&&i_(n.sessionID,n.assistantMessageID??`pending`,e.created);break;case`session.retry.scheduled`:if(n.sessionID&&n.error){let t=n.attempt;T_(n.sessionID,`retry`,`Retry attempt ${t??`?`} scheduled — ${n.error.message}`,e.created)}o(n.sessionID)&&n.assistantMessageID&&n.error&&o_(n.assistantMessageID,{error:{type:n.error.type,message:`Retrying${n.at?` at ${new Date(n.at).toLocaleTimeString()}`:``} — ${n.error.message}`,status:n.error.status}});break;case`session.execution.succeeded`:case`session.execution.failed`:case`session.execution.interrupted`:if(G(`run`,`finished ${n.sessionID} (${t})`),t===`session.execution.succeeded`)S_(n.sessionID);else if(C_(n.sessionID),t===`session.execution.failed`){let t=n.error;t&&!w_(t)?T_(n.sessionID,`failed`,`${t.type}: ${t.message}`,e.created):t||T_(n.sessionID,`failed`,`Run failed`,e.created)}N_(n.sessionID,t,n.error);break;case`session.step.started`:o(n.sessionID)&&n.assistantMessageID&&(f_(n.sessionID,n.assistantMessageID,{agent:n.agent,model:n.model}),i_(n.sessionID,n.assistantMessageID,e.created),a_(n.sessionID,n.assistantMessageID),o_(n.assistantMessageID,{agent:n.agent,model:n.model,finish:void 0,error:void 0,completed:void 0}),K.running[n.sessionID]||(G(`run`,`live via step.started ${n.sessionID}`),q({running:{...K.running,[n.sessionID]:!0},queued:{...K.queued,[n.sessionID]:!1}}),V_(n.sessionID)));break;case`session.step.ended`:if(o(n.sessionID)&&n.assistantMessageID&&(o_(n.assistantMessageID,{finish:n.finish,cost:n.cost,completed:e.created}),!D_.has(n.sessionID)&&n.finish===`stop`)){let e={...K.running};delete e[n.sessionID],q({running:e})}break;case`session.step.failed`:if(n.sessionID&&n.error&&!w_(n.error)&&T_(n.sessionID,`failed`,`${n.error.type}: ${n.error.message}`,e.created),o(n.sessionID)&&n.assistantMessageID&&(o_(n.assistantMessageID,{finish:`error`,error:n.error,cost:n.cost,completed:e.created}),!D_.has(n.sessionID))){let e={...K.running};delete e[n.sessionID],q({running:e})}break;case`session.text.started`:o(n.sessionID)&&n.assistantMessageID&&(j_(n.sessionID),s_(n.sessionID,n.assistantMessageID,`text`,n.ordinal??0),K.queued[n.sessionID]&&q({queued:{...K.queued,[n.sessionID]:!1}}));break;case`session.text.delta`:o(n.sessionID)&&n.assistantMessageID&&(s_(n.sessionID,n.assistantMessageID,`text`,n.ordinal??0),c_(n.assistantMessageID,`text`,n.ordinal??0,n.delta??``,`append`));break;case`session.text.ended`:o(n.sessionID)&&n.assistantMessageID&&(s_(n.sessionID,n.assistantMessageID,`text`,n.ordinal??0),c_(n.assistantMessageID,`text`,n.ordinal??0,n.text??``,`replace`));break;case`session.reasoning.started`:o(n.sessionID)&&n.assistantMessageID&&(j_(n.sessionID),s_(n.sessionID,n.assistantMessageID,`reasoning`,n.ordinal??0));break;case`session.reasoning.delta`:o(n.sessionID)&&n.assistantMessageID&&(s_(n.sessionID,n.assistantMessageID,`reasoning`,n.ordinal??0),c_(n.assistantMessageID,`reasoning`,n.ordinal??0,n.delta??``,`append`));break;case`session.reasoning.ended`:o(n.sessionID)&&n.assistantMessageID&&(s_(n.sessionID,n.assistantMessageID,`reasoning`,n.ordinal??0),c_(n.assistantMessageID,`reasoning`,n.ordinal??0,n.text??``,`replace`));break;case`session.tool.input.started`:o(n.sessionID)&&n.assistantMessageID&&n.id&&(j_(n.sessionID),l_(n.sessionID,n.assistantMessageID,n.id,n.name));break;case`session.tool.input.delta`:if(o(n.sessionID)&&n.assistantMessageID&&n.id){l_(n.sessionID,n.assistantMessageID,n.id);let e=K.live.find(e=>e.id===n.assistantMessageID)?.tools.get(n.id);u_(n.assistantMessageID,n.id,{inputText:Zg(e?.inputText??``,n.delta??``)})}break;case`session.tool.input.ended`:if(o(n.sessionID)&&n.assistantMessageID&&n.id){let e=l_(n.sessionID,n.assistantMessageID,n.id),t;try{t=JSON.parse(n.text??``)}catch{t=n.text}u_(n.assistantMessageID,n.id,{input:t,inputText:n.text??``,status:e.status===`streaming`?`running`:e.status})}break;case`session.tool.called`:if(o(n.sessionID)&&n.assistantMessageID&&n.id){let t=l_(n.sessionID,n.assistantMessageID,n.id);u_(n.assistantMessageID,n.id,{input:n.input,inputText:n.input===void 0?t.inputText:JSON.stringify(n.input),status:t.status===`streaming`?`running`:t.status,executed:n.executed,ran:e.created})}break;case`session.tool.progress`:o(n.sessionID)&&n.assistantMessageID&&n.id&&(l_(n.sessionID,n.assistantMessageID,n.id),u_(n.assistantMessageID,n.id,{metadata:n.metadata}));break;case`session.tool.success`:o(n.sessionID)&&n.assistantMessageID&&n.id&&(j_(n.sessionID),u_(n.assistantMessageID,n.id,{...typeof n.name==`string`?{name:n.name}:{},status:`completed`,content:n.content??void 0,metadata:n.metadata,executed:n.executed,completed:e.created}));break;case`session.tool.failed`:o(n.sessionID)&&n.assistantMessageID&&n.id&&u_(n.assistantMessageID,n.id,{...typeof n.name==`string`?{name:n.name}:{},status:`error`,error:n.error,content:n.content??void 0,metadata:n.metadata,executed:n.executed,completed:e.created});break;case`session.status`:{let e=n.status?.type;e===`busy`?q({running:{...K.running,[n.sessionID]:!0},queued:{...K.queued,[n.sessionID]:!1}}):e===`idle`&&M_(n.sessionID);break}case`session.idle`:M_(n.sessionID);break;case`permission.asked`:K.permissions.some(e=>e.id===n.id)||q({permissions:[...K.permissions,{id:n.id,sessionID:n.sessionID,action:n.action??``,resources:n.resources??[],seq:Jh()}]});break;case`form.created`:{let e=n.form;e?.id&&!K.forms.some(t=>t.id===e.id)&&q({forms:[...K.forms,{...e,seq:Jh()}]});break}case`form.replied`:case`form.cancelled`:case`form.deleted`:q({forms:K.forms.filter(e=>e.id!==n.id)});break;case`permission.replied`:q({permissions:K.permissions.filter(e=>e.id!==n.id)});break;case`question.asked`:if(!K.questions.some(e=>e.id===n.id)){let e=n;q({questions:[...K.questions,{id:n.id,sessionID:n.sessionID,questions:e.questions??[],tool:e.tool,seq:Jh()}]})}break;case`question.replied`:case`question.rejected`:q({questions:K.questions.filter(e=>e.id!==n.requestID)});break;case`session.shell.started`:case`session.shell.ended`:r&&Ng(r);break;case`session.compaction.started`:case`session.compaction.ended`:case`session.compaction.failed`:r&&(Ng(r),p_(r));break;default:(t.startsWith(`form.`)||t.startsWith(`question.`)||t===`session.skill.activated`)&&Mg()}}var F_=new Map;async function I_(e){if(!(!e||sg(e))){W_(e);try{let t=(await W.webuiReplay(e,F_.get(e))).data??[];for(let n of t)n.id&&F_.set(e,n.id),J_({id:n.id,created:n.created,type:n.type,data:n.data});t.length>0&&G(`sse`,`replay ${e}: ${t.length} event(s)`)}catch{}}}function L_(){let e=new Set;for(let t of K.panes)t.sessionID&&e.add(t.sessionID);K.currentSessionID&&e.add(K.currentSessionID);for(let[t,n]of Object.entries(K.running))n&&e.add(t);return[...e].filter(e=>!!e&&!sg(e))}var R_=new Set,z_=1e3,B_=3e5;function V_(e){!e||sg(e)||R_.has(e)||(R_.add(e),H_(e).finally(()=>R_.delete(e)))}async function H_(e){for(;;){if(!K.running[e]&&!K.queued[e])return;let t=await W.sessionWait(e,AbortSignal.timeout(B_)).catch(()=>-1);if(t===204){if(K.running[e]){G(`run`,`wait: engine idle ${e}`),Og(e);let t={...K.running};delete t[e],D_.delete(e),q({running:t}),v_(e),uy(e)}if(!K.running[e]&&!K.queued[e])return;await new Promise(e=>setTimeout(e,z_));continue}if(t===404){tv(e,`wait 404`);return}if(!K.running[e]&&!K.queued[e])return;await new Promise(e=>setTimeout(e,z_))}}var U_=new Map;function W_(e){!e||sg(e)||W.sessionLogHead(e).then(t=>{t!==null&&U_.get(e)!==t&&(U_.set(e,t),G(`sse`,`log head ${e}: ${t}`))}).catch(()=>void 0)}var G_=!1,K_=[],q_=null;function J_(e){K_.push(e),!q_&&(q_=setTimeout(()=>{q_=null;let e=K_.splice(0,K_.length);fg(()=>{for(let t of e)try{P_(t)}catch(e){console.warn(`event handler failed:`,t.type,e)}})},16))}function Y_(){if(!G_){if(G_=!0,G(`boot`,`start`),G(`boot`,`build pending-panel-v6`),typeof window<`u`){let e=()=>{let e=_g();e?vv(e,{history:`none`}):vg()?(ky(null),Lv().catch(()=>void 0)):(vv(null,{history:`none`}),Lv())};window.addEventListener(`popstate`,e);let t=Cv();t.length>0&&q({panes:[{id:ag,sessionID:null},...t]}),e()}Ag().then(wv).catch(()=>void 0),Mg(),W.health().then(e=>q({serviceOK:e.ok})).catch(()=>q({serviceOK:!1})),kh(e=>J_(e.data),{onOpen:()=>{q({connected:!0}),Ag(),Mg();for(let e of L_())I_(e)}}).then(()=>q({connected:!1})),X_()}}function X_(){zh({isBusy:()=>{let e=K;for(let t of Object.values(e.running))if(t)return!0;for(let t of Object.values(e.queued))if(t)return!0;for(let t of Object.values(e.pending))if(t.length>0)return!0;return e.live.length>0},isSseStale:Oh}),Vh({name:`messages`,minInterval:2e3,intervals:{live:2e3,idle:12e3,hidden:6e4},run:()=>$_()}),Vh({name:`queues`,minInterval:1e4,intervals:{live:1e4,idle:12e3,hidden:6e4},run:()=>Mg()}),Vh({name:`sessions`,minInterval:1e4,intervals:{live:1e4,idle:2e4,hidden:6e4},run:()=>Ag()})}async function Z_(e,t){K.panes.some(t=>t.sessionID===e)&&r_(e,t)}var Q_=!1;async function $_(){if(Q_)return;let e=new Set;for(let[t,n]of Object.entries(K.running))n&&e.add(t);for(let t of Object.keys(K.pending))(K.pending[t]?.length??0)>0&&!sg(t)&&e.add(t);for(let t of K.panes){let n=t.sessionID;n&&!sg(n)&&(Rg(n).length>0||K.queued[n])&&e.add(n)}for(let t of K.live)sg(t.sessionID)||e.add(t.sessionID);if(e.size!==0){Q_=!0;try{for(let t of e){let e=Fg(t);try{let n=await W.messages(t,50);if(Pg.get(t)!==e)continue;ev.delete(t);let r=K.messages[t]?.length??0,i=[...n.data].reverse();await Z_(t,i);let a=K.messages[t]?.length??0;a!==r&&G(`poll`,`reconcile ${t}: ${r} -> ${a} messages`),((K.pending[t]?.length??0)>0||K.queued[t])&&await Xv(t,i)}catch(e){let n=e instanceof Error?e.message:String(e),r=ev.get(t)??{count:0};r.count+=1,ev.set(t,r),(n.includes(`404`)||r.count>=3)&&(tv(t,n),ev.delete(t))}}}finally{Q_=!1}}}var ev=new Map;function tv(e,t){G(`poll`,`retiring vanished session ${e} (${t})`);let n={...K.running};delete n[e];let r={...K.queued};delete r[e];let i={...K.pending};delete i[e],D_.delete(e),Eg.delete(e),Dg.delete(e),F_.delete(e);let a=ly.get(e);a&&(clearTimeout(a),ly.delete(e)),q({running:n,queued:r,pending:i,live:K.live.filter(t=>t.sessionID!==e)}),Wg(e),ev.delete(e)}function nv(){q({shellPanelTick:K.shellPanelTick+1})}function rv(e){if(e===`runsDialog`){q({runsPanelOpen:!0,uiSignals:{...K.uiSignals,[e]:K.uiSignals[e]+1}});return}q({uiSignals:{...K.uiSignals,[e]:K.uiSignals[e]+1}})}function iv(){q({runsPanelOpen:!0,uiSignals:{...K.uiSignals,runsDialog:K.uiSignals.runsDialog+1}})}function av(){K.runsPanelOpen&&q({runsPanelOpen:!1})}function ov(e){K.mobileSidebarOpen!==e&&q({mobileSidebarOpen:e})}function sv(){ov(!0)}function cv(){ov(!1)}function lv(e){q({runsSelection:e})}function uv(){K.subagentComposerOpen||q({subagentComposerOpen:!0})}function dv(){let e=K.revertPrompt;return K.revertPrompt!==null&&q({revertPrompt:null}),e}function fv(e,t){return e.filter(e=>e.parentID===t).sort((e,t)=>t.time.updated-e.time.updated)}function pv(e,t){if(!t)return!1;if(e.running[t]||e.queued[t])return!0;for(let n of e.sessions)if(n.parentID===t&&(e.running[n.id]||e.queued[n.id]))return!0;return!1}function mv(e,t){if(!t)return e;let n=e.findIndex(e=>e.id===t);return n===-1?e:e.slice(0,n)}function hv(e,t,n){let r=e.revertMarkers[t];return r===void 0?(n??e.sessionDetails[t])?.revert?.messageID:r??void 0}function gv(e,t){K.revertMarkers[e]!==t&&q({revertMarkers:{...K.revertMarkers,[e]:t}})}function _v(e){let t=hv(K,e);if(!t)return;let n=mv(K.messages[e]??[],t);q({messages:{...K.messages,[e]:n}})}async function vv(e,t={}){if(G(`session`,`select`,e??`null`),t.history!==`none`&&yg(e,t.history??`push`),O_.clear(),e===`__draft__`){let e=xv(og);q({currentSessionID:og,live:Bg(e),subagentComposerOpen:!1,mobileSidebarOpen:!1,panes:e,focusedPane:ag});return}let n=xv(e);q({currentSessionID:e,live:Bg(n),subagentComposerOpen:!1,mobileSidebarOpen:!1,panes:n,focusedPane:ag,queued:e?{...K.queued,[e]:!1}:K.queued}),e?(Iv(e),Gg(e),I_(e),K.draftWorkspace!==null&&q({draftWorkspace:null}),!K.sessions.some(t=>t.id===e)&&!K.sessionDetails[e]&&p_(e),await Ng(e),Xv(e).catch(()=>void 0),lh(`session.adopted`,{sessionID:e})):K.draftWorkspace!==null&&q({draftWorkspace:null})}var yv=`webui.splits`,bv=0;function xv(e){let t=K.panes.length>0?K.panes.slice():[{id:ag,sessionID:null}];return t[0]={id:ag,sessionID:e},t}function Sv(){try{localStorage.setItem(yv,JSON.stringify(K.panes.slice(1)))}catch{}}function Cv(){try{let e=localStorage.getItem(yv);if(!e)return[];let t=JSON.parse(e);return Array.isArray(t)?t.filter(e=>!!e&&typeof e.id==`string`&&typeof e.sessionID==`string`&&e.id!==`main`):[]}catch{return[]}}function wv(){let e=e=>K.sessions.some(t=>t.id===e)||!!K.sessionDetails[e],t=K.panes.filter((t,n)=>n===0||e(t.sessionID));t.length!==K.panes.length&&q({panes:t,...t.some(e=>e.id===K.focusedPane)?{}:{focusedPane:ag}})}async function Tv(e){K.currentSessionID!==e&&(q({currentSessionID:e,live:Bg(K.panes),subagentComposerOpen:!1,pendingAgent:null,pendingModel:null,...e?{queued:{...K.queued,[e]:!1}}:{}}),e&&!sg(e)&&(Gg(e),I_(e),await Ng(e),Xv(e).catch(()=>void 0)),lh(`session.adopted`,{sessionID:e}))}async function Ev(e){let t=K.panes.find(t=>t.id===e);t&&K.focusedPane!==e&&(G(`pane`,`focus ${e}`),q({focusedPane:e}),lh(`pane.focused`,{paneID:e,sessionID:t.sessionID}),await Tv(t.sessionID))}function Dv(){q({splitPickerOpen:!0})}function Ov(){K.splitPickerOpen&&q({splitPickerOpen:!1})}async function kv(e){if(!e||sg(e)||K.panes.length-1>=3||K.panes.some(t=>t.sessionID===e))return!1;let t={id:`${ag}-${Date.now().toString(36)}-${++bv}`,sessionID:e};return G(`pane`,`split open ${e} (${t.id})`),q({panes:[...K.panes,t],focusedPane:t.id,splitPickerOpen:!1}),Sv(),!K.sessions.some(t=>t.id===e)&&!K.sessionDetails[e]&&p_(e),await Tv(e),!0}async function Av(e){if(e===`main`)return;let t=K.panes.filter(t=>t.id!==e);if(t.length===K.panes.length)return;G(`pane`,`close ${e}`);let n=K.focusedPane===e;q({panes:t,...n?{focusedPane:ag}:{}}),Sv(),n&&await Tv(K.panes[0].sessionID)}async function jv(e,t){let n=K.panes.findIndex(t=>t.id===e);if(n<=0||!t||sg(t))return;let r=K.panes.slice();r[n]={...r[n],sessionID:t},q({panes:r}),Sv(),K.focusedPane===e?await Tv(t):Ng(t)}async function Mv(e){if(K.focusedPane===`main`||K.panes.length<=1){await vv(e);return}await jv(K.focusedPane,e)}function Nv(e=mg()){return e.focusedPane}function Pv(e){sg(e)||(K.messages[e]?.length??0)>0||Ng(e)}var Fv=`webui.last-session`;function Iv(e){try{localStorage.setItem(Fv,e)}catch{}}async function Lv(){if(/^\/ext\//.test(window.location.pathname))return;let e=null;try{e=localStorage.getItem(Fv)}catch{return}!e||K.currentSessionID||(await Ag(),!(K.currentSessionID||!e)&&K.sessions.some(t=>t.id===e)&&(G(`session`,`reopen last session ${e}`),await vv(e,{history:`replace`})))}async function Rv(e){let t=K.currentSessionID;t&&await zv(t,e)}async function zv(e,t,n){G(`send`,`prompt ${e}: ${t.slice(0,80)}${n?.delivery?` (${n.delivery})`:``}`);let r={sessionID:e,text:t,...n?.delivery?{delivery:n.delivery}:{}};await lh(`session.prompt`,r),t=typeof r.text==`string`?r.text:t;let i=r.delivery===`steer`||r.delivery===`queue`?r.delivery:n?.delivery;if(await __(e),!sg(e)&&Bv(e)){_v(e),await Gv(e,t,i);return}_v(e),fy(e,t),py(e);try{if(await W.prompt(e,t),V_(e),e===`__draft__`||(K.messages.__draft__?.length??0)===0)try{let{clearDraft:e}=await Gh(async()=>{let{clearDraft:e}=await Promise.resolve().then(()=>wW);return{clearDraft:e}},void 0);e(og)}catch{}}catch(t){throw my(e),hy(e,t),t}}function Bv(e){return K.running[e]||K.queued[e]||K.activeIDs.includes(e)?!0:Lg(e)&&Rg(e).length>0}var Vv=0;function Hv(e,t){let n={...K.pending};t&&t.length>0?n[e]=t:delete n[e],q({pending:n})}function Uv(e,t){Hv(e,[...K.pending[e]??[],t])}function Wv(e,t,n){let r=K.pending[e];if(!r?.some(e=>e.key===t))return;let i=!1,a=r.map(e=>{if(e.key!==t)return e;let r=n(e);return r!==e&&(i=!0),r});i&&Hv(e,a)}async function Gv(e,t,n){let r=`pend_${Date.now().toString(36)}_${++Vv}`;Uv(e,{key:r,text:t,state:`sending`,admittedAt:Date.now(),...n?{delivery:n}:{}});try{let i=await W.prompt(e,t,n);V_(e);let a=i?.data??i;a?.id&&Wv(e,r,e=>({...e,state:`tracked`,inboxID:a.id,delivery:a.delivery??n}))}catch(t){throw Kv(e,r),hy(e,t),t}}function Kv(e,t){let n=K.pending[e];n?.some(e=>e.key===t)&&Hv(e,n.filter(e=>e.key!==t))}function qv(e){let t=e.payload;return typeof t?.text==`string`?t.text:``}function Jv(e,t){return t===``||Bv(e)?!1:(K.messages[e]??[]).some(e=>e.type===`user`&&e.id.startsWith(`msg_local_`)&&e.text===t)}function Yv(e,t){return e.length===t.length&&e.every((e,n)=>{let r=t[n];return e.key===r.key&&e.text===r.text&&e.state===r.state&&e.inboxID===r.inboxID&&e.delivery===r.delivery})}async function Xv(e,t){let n=(await W.inboxList(e)).data.filter(e=>e.type===`user`),r=new Set(n.map(e=>e.id)),i=K.pending[e]??[],a=[...i],o=null,s=new Set;if(t){o=new Set(t.filter(e=>e.type===`user`&&!e.id.startsWith(`msg_local_`)).map(e=>e.id));for(let e of i)(e.inboxID&&o.has(e.inboxID)||!e.inboxID&&e.admittedAt!==void 0&&t.some(t=>t.type===`user`&&!t.id.startsWith(`msg_local_`)&&t.text===e.text&&t.time.created>=e.admittedAt-6e4))&&s.add(e.key)}let c=new Set(a.filter(e=>e.inboxID).map(e=>e.inboxID));a=a.map(e=>{if(e.state!==`sending`)return e;let t=n.filter(t=>!c.has(t.id)&&qv(t)===e.text);if(t.length===0)return e;let r=t.reduce((e,t)=>t.timeCreated>=e.timeCreated?t:e);return c.add(r.id),{...e,state:`tracked`,inboxID:r.id,delivery:r.delivery}}),a=a.filter(e=>!s.has(e.key)&&!(e.state===`tracked`&&e.inboxID&&!r.has(e.inboxID)));for(let t of[...n].sort((e,t)=>e.timeCreated-t.timeCreated)){if(a.some(e=>e.inboxID===t.id)||o?.has(t.id))continue;let n=qv(t);Jv(e,n)||a.push({key:`inbox_${t.id}`,text:n,state:`tracked`,inboxID:t.id,delivery:t.delivery,admittedAt:Date.now()})}let l=new Set(s);for(let e of i)e.state===`tracked`&&e.inboxID&&!r.has(e.inboxID)&&l.add(e.key);let u=new Set(a.map(e=>e.key));for(let t of K.pending[e]??[])!u.has(t.key)&&!l.has(t.key)&&a.push(t);Yv(i,a)||Hv(e,a)}function Zv(e,t){let n=K.pending[e];n?.some(e=>e.inboxID===t.id)||n?.some(e=>e.state===`sending`&&e.text===t.text)||Jv(e,t.text)||Uv(e,{key:`inbox_${t.id}`,text:t.text,state:`tracked`,inboxID:t.id,delivery:t.delivery??`steer`,admittedAt:Date.now()})}function Qv(e){let t=!1,n={...K.pending};for(let[r,i]of Object.entries(n)){if(!i.some(t=>t.inboxID===e))continue;let a=i.filter(t=>t.inboxID!==e);t=!0,a.length>0?n[r]=a:delete n[r]}t&&q({pending:n})}function $v(e){if(!e||sg(e))throw Error(`send before materialize`);return!0}async function ey(e,t){let n=K.currentSessionID;if(n){$v(n),G(`send`,`command ${n}: /${e} ${t??``}`.trim()),await __(n),_v(n),fy(n,t?`/${e} ${t}`:`/${e}`),py(n);try{await W.runCommand(n,e,t)}catch(e){throw my(n),hy(n,e),e}}}async function ty(e){let t=K.currentSessionID;if(t){$v(t),G(`send`,`shell ${t}: !${e.slice(0,60)}`),await __(t),_v(t),fy(t,`!${e}`),py(t);try{await W.sessionShell(t,e)}catch(e){throw my(t),hy(t,e),e}}}async function ny(e,t){let n=K.currentSessionID;if(n){$v(n),G(`send`,`prompt+files ${n}: ${e.slice(0,80)}`),await __(n),_v(n),fy(n,e),py(n);try{await W.promptWithFiles(n,e,t);try{let{clearDraft:e}=await Gh(async()=>{let{clearDraft:e}=await Promise.resolve().then(()=>wW);return{clearDraft:e}},void 0);e(og)}catch{}}catch(e){throw my(n),hy(n,e),e}}}function ry(e){if(!K.sendErrors[e])return;let t={...K.sendErrors};delete t[e],q({sendErrors:t})}function iy(e,t){let n=K.pending[e]?.find(e=>e.key===t);n&&(Kv(e,t),n.state===`tracked`&&n.inboxID&&W.inboxDelete(e,n.inboxID).catch(t=>{hy(e,t),Uv(e,n)}))}function ay(e,t,n){let r=K.pending[e]?.find(e=>e.key===t);if(!r||(r.delivery??`steer`)===n)return;let i=r.delivery??`steer`;Wv(e,t,e=>({...e,delivery:n})),(r.state===`tracked`&&r.inboxID?n===`steer`?W.inboxSteer(e,r.inboxID):W.inboxQueue(e,r.inboxID):Promise.resolve()).catch(n=>{Wv(e,t,e=>({...e,delivery:i})),hy(e,n)})}function oy(e,t){let n=K.pending[e]?.find(e=>e.key===t);!n||n.state!==`tracked`||(n.delivery??`steer`)===`queue`&&ay(e,t,`steer`)}async function sy(e){!e||sg(e)||(by(),await W.interrupt(e,!0),Og(e),q({running:{...K.running,[e]:!1},queued:{...K.queued,[e]:!1}}))}var cy=1800,ly=new Map;function uy(e){if(sg(e))return;let t=ly.get(e);t&&clearTimeout(t);let n=setTimeout(()=>{ly.delete(e),dy(e)},cy);ly.set(e,n)}async function dy(e){let t=(K.pending[e]??[]).find(e=>e.delivery===`queue`&&e.state===`tracked`&&!!e.inboxID);if(t?.inboxID&&!(K.running[e]||K.queued[e]))try{if(!(await W.inboxList(e)).data.some(e=>e.id===t.inboxID)||K.running[e]||K.queued[e])return;G(`run`,`drain ${e}: steering parked queue item ${t.inboxID}`),Wv(e,t.key,e=>({...e,delivery:`steer`})),await W.inboxSteer(e,t.inboxID)}catch(e){console.warn(`queue drain failed:`,e)}}function fy(e,t){let n={id:`msg_local_${Date.now()}`,type:`user`,text:t,time:{created:Date.now()}};q({messages:{...K.messages,[e]:[...K.messages[e]??[],n]}})}function py(e){G(`run`,`pending ${e} (awaiting run start)`),S_(e),q({queued:{...K.queued,[e]:!0}})}function my(e){q({queued:{...K.queued,[e]:!1}})}function hy(e,t){let n=t instanceof Error?t.message:String(t),r;t&&typeof t==`object`&&`payload`in t&&(r=t.payload);let i=r&&typeof r==`object`&&`message`in r?{type:String(r.name??`error`),message:String(r.message??n)}:{type:`request-failed`,message:n};console.warn(`send failed:`,i.type,i.message),q({sendErrors:{...K.sendErrors,[e]:i}})}async function gy(e){let t=K.currentSessionID;!t||sg(t)||(await W.activateSkill(t,e),Mg())}async function _y(e){let t=e??K.currentSessionID;!t||sg(t)||(by(),await W.interrupt(t),Og(t),q({running:{...K.running,[t]:!1},queued:{...K.queued,[t]:!1}}))}var vy=2500,yy=null;function by(){yy&&=(clearTimeout(yy),null),K.interruptArmed&&q({interruptArmed:!1})}function xy(){let e=K.currentSessionID;if(!(!e||!K.running[e])){if(!K.interruptArmed){yy&&clearTimeout(yy),q({interruptArmed:!0}),yy=setTimeout(()=>{yy=null,q({interruptArmed:!1})},vy);return}_y()}}async function Sy(e){try{await W.sessionBackground(e),xg()}catch(e){console.warn(`backgroundSubagents failed:`,e)}}async function Cy(e,t){let n=K.permissions.find(t=>t.id===e);if(n)try{await W.replyPermission(n.sessionID,e,t)}finally{q({permissions:K.permissions.filter(t=>t.id!==e)})}}async function wy(e,t){let n=K.forms.find(t=>t.id===e);if(n)try{await W.replyForm(n.sessionID,e,t)}finally{q({forms:K.forms.filter(t=>t.id!==e)})}}async function Ty(e){let t=K.forms.find(t=>t.id===e);if(t)try{await W.cancelForm(t.sessionID,e)}finally{q({forms:K.forms.filter(t=>t.id!==e)})}}async function Ey(e,t){let n=K.questions.find(t=>t.id===e);if(n){try{await W.sessionQuestionReply(n.sessionID,e,t)}catch(t){return G(`panel`,`question reply FAILED ${e}:`,t instanceof Error?t.message:String(t)),!1}return q({questions:K.questions.filter(t=>t.id!==e)}),!0}let r=K.forms.find(t=>t.id===e&&eg(t));if(!r)return!1;let i={};r.fields.forEach((e,n)=>{let r=t[n]??[],a=e.type===`multiselect`;i[e.key]=a?r:r[0]??``});try{await W.replyForm(r.sessionID,r.id,i)}catch(e){return G(`panel`,`question reply FAILED ${r.id}:`,e instanceof Error?e.message:String(e)),!1}return q({forms:K.forms.filter(e=>e.id!==r.id)}),!0}async function Dy(e){let t=K.questions.find(t=>t.id===e);if(t){try{await W.sessionQuestionReject(t.sessionID,e)}finally{q({questions:K.questions.filter(t=>t.id!==e)})}return}let n=K.forms.find(t=>t.id===e&&eg(t));n&&await Ty(n.id)}function Oy(e){e.kind===`permission`?Cy(e.req.id,`reject`):e.kind===`question`?Dy(e.req.id):Ty(e.req.id)}function ky(e){let t=e=>{if(!(!e||sg(e)))return(K.sessions.find(t=>t.id===e)??K.sessionDetails[e])?.location?.directory},n=K.currentSessionID&&!sg(K.currentSessionID)?K.sessions.find(e=>e.id===K.currentSessionID)??K.sessionDetails[K.currentSessionID]:void 0,r=t(K.currentSessionID)??(n?.parentID?t(n.parentID):void 0),i=e??K.pendingWorkspace??K.draftWorkspace??r??null,a=sg(K.currentSessionID);G(`session`,`draft ${a?`retarget`:`open`} (workspace=${i??`default`})`);let o=xv(og);q({currentSessionID:og,panes:o,focusedPane:ag,draftWorkspace:i,pendingWorkspace:null,live:Bg(o),...a?{}:{pendingAgent:null,pendingModel:null}}),typeof window<`u`&&yg(og,`push`)}function Ay(e){q({pendingWorkspace:e})}function jy(e,t,n){let r=(n??``).trim();K.highlightMessageID===t&&K.highlightSessionID===e&&K.highlightQuery,q({highlightSessionID:e,highlightMessageID:t,highlightQuery:r||null,highlightTick:K.highlightTick+1})}function My(){q({highlightSessionID:null,highlightMessageID:null,highlightQuery:null})}var Ny=!1;async function Py(e){let t=await h_(),n=(await W.createSession({title:null,agent:null,model:t??null,location:e?{directory:e}:null})).data.id;return t&&G(`model`,`new session ${n} -> ${t.providerID}/${t.id}`),await Ag(),await p_(n),n}async function Fy(e){if(!sg(K.currentSessionID)&&K.draftWorkspace===null)throw Error(`no draft session`);if(Ny)throw Error(`draft already materializing`);Ny=!0;try{let e=K.draftWorkspace;G(`session`,`draft -> create (workspace=${e??`default`})`);let t=await Py(e),n=K.messages.__draft__??[];O_.clear();let r=xv(t);return q({currentSessionID:t,panes:r,focusedPane:ag,draftWorkspace:null,live:Bg(r),messages:{...K.messages,[t]:n,[og]:[]}}),Iv(t),typeof window<`u`&&yg(t,`replace`),t}finally{Ny=!1}}async function Iy(e={}){ky(null)}async function Ly(e,t){q({pendingAgent:t})}async function Ry(e,t){q({pendingModel:t})}async function zy(e,t){await W.renameSession(e,t),await Ag()}async function By(e,t){let n=await W.forkSession(e,t);return await Ag(),n.data.id}async function Vy(e){return(await W.exportSession(e)).data}async function Hy(e,t=`steer`){await W.compactSession(e,t),await Ag()}async function Uy(e){K.running[e]&&await _y(e);let t=K.sessionDetails[e]??await W.getSession(e).then(e=>e.data).catch(()=>void 0),n=hv(K,e,t??void 0),r=[...mv(K.messages[e]??[],n)].reverse().find(e=>e.type===`user`);if(!(!r||r.id.startsWith(`msg_local_`))){try{await W.revertStage(e,r.id),gv(e,r.id)}finally{p_(e),Ng(e),xg()}q({revertPrompt:r.text??null})}}async function Wy(e){let t=K.sessionDetails[e]??await W.getSession(e).then(e=>e.data).catch(()=>void 0),n=hv(K,e,t??void 0);if(n)try{let t=(K.messages[e]??[]).find(e=>e.type===`user`&&e.id>n);t?(await W.revertStage(e,t.id),gv(e,t.id)):(await W.revertClear(e),gv(e,null))}finally{p_(e),Ng(e),xg()}}function Gy(e,t,n){q({pendingEdit:{sessionID:e,messageID:t,originalText:n??``},revertPrompt:n??null})}function Ky(){q({pendingEdit:null})}async function qy(e){let t=K.pendingEdit;if(!t||t.sessionID!==e)return;K.running[e]&&await _y(e);try{await W.revertStage(e,t.messageID)}finally{p_(e),Ng(e),xg()}let n=K.messages[e]??[],r=n.findIndex(e=>e.id===t.messageID),i=r===-1?n:n.slice(0,r);q({messages:{...K.messages,[e]:i},revertMarkers:{...K.revertMarkers,[e]:t.messageID},pendingEdit:null})}async function Jy(e,t,n){Gy(e,t,n)}async function Yy(e,t){let n=(await W.forkSession(e,{type:`before`,messageID:t})).data.id;return n&&await vv(n),n}function Xy(e){return e.state}var Zy=[`ctrl`,`shift`,`meta`,`alt`],Qy={control:`ctrl`,cmd:`meta`,command:`meta`,super:`meta`,esc:`escape`,return:`enter`,up:`arrowup`,down:`arrowdown`,left:`arrowleft`,right:`arrowright`};function $y(e){let t=e.trim().toLowerCase();return Qy[t]??t}function eb(e){let t=new Set,n=``;for(let r of e.split(`+`).map($y))Zy.includes(r)?t.add(r):n=r;return{mods:t,key:n}}function tb(e,t){let{mods:n,key:r}=eb(e);return!(!r||r!==$y(t.key)||n.has(`ctrl`)!==t.ctrlKey||n.has(`shift`)!==t.shiftKey||n.has(`meta`)!==t.metaKey||n.has(`alt`)!==t.altKey)}function nb(e){let t=(0,w.useRef)(e);t.current=e,(0,w.useEffect)(()=>{let e=e=>{if(e.repeat)return;let n=Object.keys(t.current).find(t=>tb(t,e));if(!n)return;let r=t.current[n];if(!r)return;let{mods:i}=eb(n);i.size===0&&rb(e.target)||(e.preventDefault(),r(e))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[])}function rb(e){let t=e;return t?t.tagName===`INPUT`||t.tagName===`TEXTAREA`||t.isContentEditable:!1}function ib(){let[e,t]=(0,w.useState)(oh);return(0,w.useEffect)(()=>ch(()=>t(oh())),[]),e}var ab=`../theme/themes`;function ob(){let[e,t]=(0,w.useState)(!1),n=J(e=>e.sessions),r=J(e=>e.currentSessionID),i=ib(),[a,o]=(0,w.useState)(null);nb({"ctrl+p":()=>t(e=>!e),escape:()=>t(!1)}),(0,w.useEffect)(()=>{let e=!1;return Gh(()=>import(ab).then(t=>{if(e)return;let n=t;if(typeof n.applyTheme!=`function`)return;let r=n.listThemes?n.listThemes():(n.THEMES??[]).map(e=>({id:e.id,label:e.label}));r.length&&o({list:r,apply:n.applyTheme,current:n.getTheme?.()??null})}),[]).catch(()=>{}),()=>{e=!0}},[]);let s=[...n].filter(e=>!e.parentID).sort((e,t)=>t.time.updated-e.time.updated),c=Tt(`palette`);return(0,L.jsxs)(qm,{open:e,onOpenChange:t,children:[(0,L.jsx)(Jm,{placeholder:`Type a command or search…`,onKeyDown:e=>{e.key===`ArrowDown`?(e.preventDefault(),Um(1)):e.key===`ArrowUp`?(e.preventDefault(),Um(-1)):e.key===`Enter`&&!e.shiftKey&&!e.ctrlKey&&!e.metaKey&&!e.altKey&&(e.preventDefault(),Wm())}}),(0,L.jsxs)(Ym,{children:[(0,L.jsx)(Xm,{children:`No results found.`}),(0,L.jsxs)(Zm,{heading:`Actions`,children:[(0,L.jsxs)($m,{onSelect:()=>{t(!1),Iy()},children:[(0,L.jsx)(xe,{}),(0,L.jsx)(`span`,{children:`New session`}),(0,L.jsx)(eh,{children:`Ctrl N`})]}),(0,L.jsxs)($m,{onSelect:()=>sh(`showReasoning`,!i.showReasoning),children:[i.showReasoning?(0,L.jsx)(me,{}):(0,L.jsx)(he,{}),(0,L.jsxs)(`span`,{children:[i.showReasoning?`Hide`:`Show`,` thinking`]})]}),(0,L.jsxs)($m,{onSelect:()=>sh(`showToolDetails`,!i.showToolDetails),children:[i.showToolDetails?(0,L.jsx)(me,{}):(0,L.jsx)(he,{}),(0,L.jsxs)(`span`,{children:[i.showToolDetails?`Hide`:`Show`,` tool details`]})]})]}),(0,L.jsx)(Qm,{}),(0,L.jsxs)(Zm,{heading:`Sessions`,children:[s.length===0&&(0,L.jsxs)($m,{disabled:!0,children:[(0,L.jsx)(we,{}),(0,L.jsx)(`span`,{children:`No sessions yet`})]}),s.map(e=>(0,L.jsxs)($m,{value:`${e.title??`Untitled session`} ${e.id}`,onSelect:()=>{t(!1),vv(e.id)},children:[(0,L.jsx)(we,{}),(0,L.jsx)(`span`,{className:`truncate`,children:e.title??`Untitled session`})]},e.id))]}),c.length>0&&(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(Qm,{}),(0,L.jsx)(Zm,{heading:`Extension commands`,children:c.map(e=>{let n=e.item.keybind;return(0,L.jsxs)($m,{value:`${e.item.title} ${e.id} ${n??``}`,onSelect:()=>{t(!1);try{e.item.run({sessionID:r??void 0})}catch(e){console.error(`[extensions] command failed:`,e)}},children:[(0,L.jsx)(Ge,{}),(0,L.jsx)(`span`,{className:`truncate`,children:e.item.title}),n?(0,L.jsx)(eh,{children:n}):null]},e.id)})})]}),a&&(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(Qm,{}),(0,L.jsx)(Zm,{heading:`Themes`,children:a.list.map(e=>(0,L.jsxs)($m,{onSelect:()=>a.apply(e.id),children:[(0,L.jsx)(Fe,{}),(0,L.jsx)(`span`,{children:e.label}),a.current===e.id&&(0,L.jsx)(ie,{className:`ml-auto size-4 opacity-100`})]},e.id))})]})]})]})}var sb=[[`Enter`,`Send · queue while the agent works`],[`Esc`,`Interrupt the running agent`],[`Tab / Shift+Tab`,`Next / previous agent`],[`↑ / ↓ (input at start/end)`,`Prompt history`],[`↓ (outside input)`,`Subagents & shells dialog`],[`← / → (outside input)`,`Cycle subagent sessions`],[`↑ (outside input)`,`Parent session`],[`Ctrl+B`,`Background synchronous subagents`],[`Ctrl+P`,`Command palette`],[`Ctrl+N`,`New session`],[`⌘F / Ctrl+F`,`Search sessions`],[`/`,`Slash commands & skills`],[`@`,`Reference files`],[`!`,`Shell mode`]];function cb(){let e=J(e=>e.uiSignals.help),[t,n]=(0,w.useState)(!1);return(0,w.useEffect)(()=>{e&&n(!0)},[e]),(0,L.jsx)(Tm,{open:t,onOpenChange:n,children:(0,L.jsxs)(Dm,{children:[(0,L.jsx)(km,{className:`bg-black/40`}),(0,L.jsxs)(cs,{className:`fixed top-1/2 left-1/2 z-50 max-h-[80vh] w-[min(24rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 overflow-y-auto rounded-lg border border-[var(--border-weak-base)] bg-[var(--surface-float-base)] p-4 shadow-xl outline-none duration-100 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95`,children:[(0,L.jsx)(Nm,{className:`mb-3 text-sm font-medium text-[var(--text-strong)]`,children:`Keybinds`}),(0,L.jsx)(`dl`,{className:`space-y-1.5 text-xs`,children:sb.map(([e,t])=>(0,L.jsxs)(`div`,{className:`flex items-baseline justify-between gap-3`,children:[(0,L.jsx)(`dt`,{className:`shrink-0 rounded border border-[var(--border-weak-base)] bg-[var(--surface-inset-base)] px-1.5 py-0.5 font-mono text-[10px] text-[var(--text-base)]`,children:e}),(0,L.jsx)(`dd`,{className:`text-right text-[var(--text-weak)]`,children:t})]},e))})]})]})})}var lb=Cm(`group/badge inline-flex h-5 w-fit shrink-0 items-center justify-center gap-1 overflow-hidden rounded-4xl border border-transparent px-2 py-0.5 text-xs font-medium whitespace-nowrap transition-all focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&>svg]:pointer-events-none [&>svg]:size-3!`,{variants:{variant:{default:`bg-primary text-primary-foreground [a]:hover:bg-primary/80`,secondary:`bg-secondary text-secondary-foreground [a]:hover:bg-secondary/80`,destructive:`bg-destructive/10 text-destructive focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:focus-visible:ring-destructive/40 [a]:hover:bg-destructive/20`,outline:`border-border text-foreground [a]:hover:bg-muted [a]:hover:text-muted-foreground`,ghost:`hover:bg-muted hover:text-muted-foreground dark:hover:bg-muted/50`,link:`text-primary underline-offset-4 hover:underline`}},defaultVariants:{variant:`default`}});function ub({className:e,variant:t=`default`,asChild:n=!1,...r}){let i=n?mr:`span`;return(0,L.jsx)(i,{"data-slot":`badge`,"data-variant":t,className:B(lb({variant:t}),e),...r})}var db={primary:`default`,secondary:`secondary`,ghost:`ghost`,outline:`outline`,danger:`destructive`};function fb({children:e,onClick:t,variant:n=`ghost`,disabled:r,className:i=``,title:a,type:o=`button`}){return(0,L.jsx)(H,{type:o,title:a,variant:db[n],className:i,onClick:t,disabled:r,children:e})}function pb({className:e=`size-4`}){return(0,L.jsx)(`span`,{className:`inline-block animate-spin rounded-full border-2 border-[color-mix(in_oklch,var(--border-selected)_30%,transparent)] border-t-[var(--border-selected)] ${e}`})}var mb={neutral:`bg-[var(--surface-raised-base)] text-[var(--text-weak)]`,green:`bg-[color-mix(in_oklch,var(--surface-success-strong)_12%,transparent)] text-[var(--surface-success-strong)]`,red:`bg-[color-mix(in_oklch,var(--surface-critical-strong)_12%,transparent)] text-[var(--surface-critical-strong)]`,blue:`bg-[color-mix(in_oklch,var(--border-selected)_12%,transparent)] text-[var(--text-interactive-base)]`,amber:`bg-[color-mix(in_oklch,var(--surface-warning-strong)_12%,transparent)] text-[var(--surface-warning-strong)]`};function hb({children:e,tone:t=`neutral`}){return(0,L.jsx)(ub,{variant:`secondary`,className:B(mb[t]),children:e})}function gb(e){let t=Math.max(1,Math.floor((Date.now()-e)/1e3));return t<60?`${t}s`:t<3600?`${Math.floor(t/60)}m`:t<86400?`${Math.floor(t/3600)}h`:`${Math.floor(t/86400)}d`}function _b(e){return new Date(e).toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`})}function vb({className:e,orientation:t=`horizontal`,decorative:n=!0,...r}){return(0,L.jsx)($p,{"data-slot":`separator`,decorative:n,orientation:t,className:B(`shrink-0 bg-border data-horizontal:h-px data-horizontal:w-full data-vertical:w-px data-vertical:self-stretch`,e),...r})}var yb=Object.defineProperty,bb=Object.getOwnPropertyDescriptor,xb=(e,t)=>{for(var n in t)yb(e,n,{get:t[n],enumerable:!0})},Sb=(e,t,n,r)=>{for(var i=r>1?void 0:r?bb(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&&yb(t,n,i),i},Y=(e,t)=>(n,r)=>t(n,r,e),Cb=`Terminal input`,wb={get:()=>Cb,set:e=>Cb=e},Tb=`Too much output to announce, navigate to rows manually to read`,Eb={get:()=>Tb,set:e=>Tb=e};function Db(e){return e.replace(/\r?\n/g,`\r`)}function Ob(e,t){return t?`\x1B[200~`+e+`\x1B[201~`:e}function kb(e,t){e.clipboardData&&e.clipboardData.setData(`text/plain`,t.selectionText),e.preventDefault()}function Ab(e,t,n,r){e.stopPropagation(),e.clipboardData&&jb(e.clipboardData.getData(`text/plain`),t,n,r)}function jb(e,t,n,r){e=Db(e),e=Ob(e,n.decPrivateModes.bracketedPasteMode&&r.rawOptions.ignoreBracketedPasteMode!==!0),n.triggerDataEvent(e,!0),t.value=``}function Mb(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 Nb(e,t,n,r,i){Mb(e,t,n),i&&r.rightClickSelect(e),t.value=r.selectionText,t.select()}function Pb(e){return e>65535?(e-=65536,String.fromCharCode((e>>10)+55296)+String.fromCharCode(e%1024+56320)):String.fromCharCode(e)}function Fb(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 Ib=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}},Lb=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(e,t){let n=e.length;if(!n)return 0;let r=0,i,a,o,s,c=0,l=0;if(this.interim[0]){let i=!1,a=this.interim[0];a&=(a&224)==192?31:(a&240)==224?15:7;let o=0,s;for(;(s=this.interim[++o]&63)&&o<4;)a<<=6,a|=s;let c=(this.interim[0]&224)==192?2:(this.interim[0]&240)==224?3:4,u=c-o;for(;l<u;){if(l>=n)return 0;if(s=e[l++],(s&192)!=128){l--,i=!0;break}this.interim[o++]=s,a<<=6,a|=s&63}i||(c===2?a<128?l--:t[r++]=a:c===3?a<2048||a>=55296&&a<=57343||a===65279||(t[r++]=a):a<65536||a>1114111||(t[r++]=a)),this.interim.fill(0)}let u=n-4,d=l;for(;d<n;){for(;d<u&&!((i=e[d])&128)&&!((a=e[d+1])&128)&&!((o=e[d+2])&128)&&!((s=e[d+3])&128);)t[r++]=i,t[r++]=a,t[r++]=o,t[r++]=s,d+=4;if(i=e[d++],i<128)t[r++]=i;else if((i&224)==192){if(d>=n)return this.interim[0]=i,r;if(a=e[d++],(a&192)!=128){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}},Rb=``,zb=` `,Bb=class e{constructor(){this.fg=0,this.bg=0,this.extended=new Vb}static toColorRGB(e){return[e>>>16&255,e>>>8&255,e&255]}static fromColorRGB(e){return(e[0]&255)<<16|(e[1]&255)<<8|e[2]&255}clone(){let t=new e;return t.fg=this.fg,t.bg=this.bg,t.extended=this.extended.clone(),t}isInverse(){return this.fg&67108864}isBold(){return this.fg&134217728}isUnderline(){return this.hasExtendedAttrs()&&this.extended.underlineStyle!==0?1:this.fg&268435456}isBlink(){return this.fg&536870912}isInvisible(){return this.fg&1073741824}isItalic(){return this.bg&67108864}isDim(){return this.bg&134217728}isStrikethrough(){return this.fg&2147483648}isProtected(){return this.bg&536870912}isOverline(){return this.bg&1073741824}getFgColorMode(){return this.fg&50331648}getBgColorMode(){return this.bg&50331648}isFgRGB(){return(this.fg&50331648)==50331648}isBgRGB(){return(this.bg&50331648)==50331648}isFgPalette(){return(this.fg&50331648)==16777216||(this.fg&50331648)==33554432}isBgPalette(){return(this.bg&50331648)==16777216||(this.bg&50331648)==33554432}isFgDefault(){return!(this.fg&50331648)}isBgDefault(){return!(this.bg&50331648)}isAttributeDefault(){return this.fg===0&&this.bg===0}getFgColor(){switch(this.fg&50331648){case 16777216:case 33554432:return this.fg&255;case 50331648:return this.fg&16777215;default:return-1}}getBgColor(){switch(this.bg&50331648){case 16777216:case 33554432:return this.bg&255;case 50331648:return this.bg&16777215;default:return-1}}hasExtendedAttrs(){return this.bg&268435456}updateExtended(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456}getUnderlineColor(){if(this.bg&268435456&&~this.extended.underlineColor)switch(this.extended.underlineColor&50331648){case 16777216:case 33554432:return this.extended.underlineColor&255;case 50331648:return this.extended.underlineColor&16777215;default:return this.getFgColor()}return this.getFgColor()}getUnderlineColorMode(){return this.bg&268435456&&~this.extended.underlineColor?this.extended.underlineColor&50331648:this.getFgColorMode()}isUnderlineColorRGB(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)==50331648:this.isFgRGB()}isUnderlineColorPalette(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)==16777216||(this.extended.underlineColor&50331648)==33554432:this.isFgPalette()}isUnderlineColorDefault(){return this.bg&268435456&&~this.extended.underlineColor?!(this.extended.underlineColor&50331648):this.isFgDefault()}getUnderlineStyle(){return this.fg&268435456?this.bg&268435456?this.extended.underlineStyle:1:0}getUnderlineVariantOffset(){return this.extended.underlineVariantOffset}},Vb=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}},Hb=class e extends Bb{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new Vb,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?Pb(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()]}},Ub=`di$target`,Wb=`di$dependencies`,Gb=new Map;function Kb(e){return e[Wb]||[]}function qb(e){if(Gb.has(e))return Gb.get(e);let t=function(e,n,r){if(arguments.length!==3)throw Error(`@IServiceName-decorator can only be used to decorate a parameter`);Jb(t,e,r)};return t._id=e,Gb.set(e,t),t}function Jb(e,t,n){t[Ub]===t?t[Wb].push({id:e,index:n}):(t[Wb]=[{id:e,index:n}],t[Ub]=t)}var Yb=qb(`BufferService`),Xb=qb(`CoreMouseService`),Zb=qb(`CoreService`),Qb=qb(`CharsetService`),$b=qb(`InstantiationService`),ex=qb(`LogService`),tx=qb(`OptionsService`),nx=qb(`OscLinkService`),rx=qb(`UnicodeService`),ix=qb(`DecorationService`),ax=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 Hb,o=n.getTrimmedLength(),s=-1,c=-1,l=!1;for(let t=0;t<o;t++)if(!(c===-1&&!n.hasContent(t))){if(n.loadCell(t,a),a.hasExtendedAttrs()&&a.extended.urlId){if(c===-1){c=t,s=a.extended.urlId;continue}l=a.extended.urlId!==s}else c!==-1&&(l=!0);if(l||c!==-1&&t===o-1){let n=this._oscLinkService.getLinkData(s)?.uri;if(n){let a={start:{x:c+1,y:e},end:{x:t+ +(!l&&t===o-1),y:e}},s=!1;if(!i?.allowNonHttpProtocols)try{let e=new URL(n);[`http:`,`https:`].includes(e.protocol)||(s=!0)}catch{s=!0}s||r.push({text:n,range:a,activate:(e,t)=>i?i.activate(e,t,a):ox(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)}};ax=Sb([Y(0,Yb),Y(1,tx),Y(2,nx)],ax);function ox(e,t){if(confirm(`Do you want to navigate to ${t}?
|
|
52
|
-
|
|
53
|
-
WARNING: This link could potentially be dangerous`)){let e=window.open();if(e){try{e.opener=null}catch{}e.location.href=t}else console.warn(`Opening link blocked as opener could not be cleared`)}}var sx=qb(`CharSizeService`),cx=qb(`CoreBrowserService`),lx=qb(`MouseService`),ux=qb(`RenderService`),dx=qb(`SelectionService`),fx=qb(`CharacterJoinerService`),px=qb(`ThemeService`),mx=qb(`LinkProviderService`),hx=new class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?xx.isErrorNoTelemetry(e)?new xx(e.message+`
|
|
54
|
-
|
|
55
|
-
`+e.stack):Error(e.message+`
|
|
56
|
-
|
|
57
|
-
`+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 gx(e){vx(e)||hx.onUnexpectedError(e)}var _x=`Canceled`;function vx(e){return e instanceof yx||e instanceof Error&&e.name===_x&&e.message===_x}var yx=class extends Error{constructor(){super(_x),this.name=this.message}};function bx(e){return Error(e?`Illegal argument: ${e}`:`Illegal argument`)}var xx=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`}},Sx=class e extends Error{constructor(t){super(t||`An unexpected bug occurred.`),Object.setPrototypeOf(this,e.prototype)}};function Cx(e,t=0){return e[e.length-(1+t)]}var wx;(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})(wx||={});var Tx=class e{constructor(e){this.iterate=e}forEach(e){this.iterate(t=>(e(t),!0))}toArray(){let e=[];return this.iterate(t=>(e.push(t),!0)),e}filter(t){return new e(e=>this.iterate(n=>!t(n)||e(n)))}map(t){return new e(e=>this.iterate(n=>e(t(n))))}some(e){let t=!1;return this.iterate(n=>(t=e(n),!t)),t}findFirst(e){let t;return this.iterate(n=>!e(n)||(t=n,!1)),t}findLast(e){let t;return this.iterate(n=>(e(n)&&(t=n),!0)),t}findLastMaxBy(e){let t,n=!0;return this.iterate(r=>((n||wx.isGreaterThan(e(r,t)))&&(n=!1,t=r),!0)),t}};Tx.empty=new Tx(e=>{});function Ex(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 Dx;(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})(Dx||={});var Ox=null;function kx(e){return Ox?.trackDisposable(e),e}function Ax(e){Ox?.markAsDisposed(e)}function jx(e,t){Ox?.setParent(e,t)}function Mx(e){return Ox?.markAsSingleton(e),e}function Nx(e){if(Dx.is(e)){let t=[];for(let n of e)if(n)try{n.dispose()}catch(e){t.push(e)}if(t.length===1)throw t[0];if(t.length>1)throw AggregateError(t,`Encountered errors while disposing of store`);return Array.isArray(e)?[]:e}if(e)return e.dispose(),e}function Px(...e){return Fx(()=>Nx(e))}function Fx(e){let t=kx({dispose:Ex(()=>{Ax(t),e()})});return t}var Ix=class e{constructor(){this._toDispose=new Set,this._isDisposed=!1,kx(this)}dispose(){this._isDisposed||(Ax(this),this._isDisposed=!0,this.clear())}get isDisposed(){return this._isDisposed}clear(){if(this._toDispose.size!==0)try{Nx(this._toDispose)}finally{this._toDispose.clear()}}add(t){if(!t)return t;if(t===this)throw Error(`Cannot register a disposable on itself!`);return jx(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),jx(e,null))}};Ix.DISABLE_DISPOSED_WARNING=!1;var Lx=Ix,Rx=class{constructor(){this._store=new Lx,kx(this),jx(this._store,this)}dispose(){Ax(this),this._store.dispose()}_register(e){if(e===this)throw Error(`Cannot register a disposable on itself!`);return this._store.add(e)}};Rx.None=Object.freeze({dispose(){}});var zx=class{constructor(){this._isDisposed=!1,kx(this)}get value(){return this._isDisposed?void 0:this._value}set value(e){this._isDisposed||e===this._value||(this._value?.dispose(),e&&jx(e,this),this._value=e)}clear(){this.value=void 0}dispose(){this._isDisposed=!0,Ax(this),this._value?.dispose(),this._value=void 0}clearAndLeak(){let e=this._value;return this._value=void 0,e&&jx(e,null),e}},Bx=typeof window==`object`?window:globalThis,Vx=class e{constructor(t){this.element=t,this.next=e.Undefined,this.prev=e.Undefined}};Vx.Undefined=new Vx(void 0);var Hx=Vx,Ux=class{constructor(){this._first=Hx.Undefined,this._last=Hx.Undefined,this._size=0}get size(){return this._size}isEmpty(){return this._first===Hx.Undefined}clear(){let e=this._first;for(;e!==Hx.Undefined;){let t=e.next;e.prev=Hx.Undefined,e.next=Hx.Undefined,e=t}this._first=Hx.Undefined,this._last=Hx.Undefined,this._size=0}unshift(e){return this._insert(e,!1)}push(e){return this._insert(e,!0)}_insert(e,t){let n=new Hx(e);if(this._first===Hx.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!==Hx.Undefined){let e=this._first.element;return this._remove(this._first),e}}pop(){if(this._last!==Hx.Undefined){let e=this._last.element;return this._remove(this._last),e}}_remove(e){if(e.prev!==Hx.Undefined&&e.next!==Hx.Undefined){let t=e.prev;t.next=e.next,e.next.prev=t}else e.prev===Hx.Undefined&&e.next===Hx.Undefined?(this._first=Hx.Undefined,this._last=Hx.Undefined):e.next===Hx.Undefined?(this._last=this._last.prev,this._last.next=Hx.Undefined):e.prev===Hx.Undefined&&(this._first=this._first.next,this._first.prev=Hx.Undefined);--this._size}*[Symbol.iterator](){let e=this._first;for(;e!==Hx.Undefined;)yield e.element,e=e.next}},Wx=globalThis.performance&&typeof globalThis.performance.now==`function`,Gx=class e{static create(t){return new e(t)}constructor(e){this._now=Wx&&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}},Kx;(e=>{e.None=()=>Rx.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(Px(...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 X({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 X({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 X({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 X({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 X({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 X;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 X(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 Lx?r.add(s):Array.isArray(r)&&r.push(s),s}}e.fromObservableLight=D})(Kx||={});var qx=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 Gx,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}}};qx.all=new Set,qx._idPool=0;var Jx=qx,Yx=-1,Xx=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 $x(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}};Xx._idPool=1;var Zx=Xx,Qx=class e{constructor(e){this.value=e}static create(){return new e(Error().stack??``)}print(){console.warn(this.value.split(`
|
|
58
|
-
`).slice(2).join(`
|
|
59
|
-
`))}},$x=class extends Error{constructor(e,t){super(e),this.name=`ListenerLeakError`,this.stack=t}},eS=class extends Error{constructor(e,t){super(e),this.name=`ListenerRefusalError`,this.stack=t}},tS=0,nS=class{constructor(e){this.value=e,this.id=tS++}},rS=2,iS,X=class{constructor(e){this._size=0,this._options=e,this._leakageMon=Yx>0||this._options?.leakWarningThreshold?new Zx(e?.onListenerError??gx,this._options?.leakWarningThreshold??Yx):void 0,this._perfMon=this._options?._profName?new Jx(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 eS(`${e}. HINT: Stack shows most frequent listener (${t[1]}-times)`,t[0]);return(this._options?.onListenerError||gx)(n),Rx.None}if(this._disposed)return Rx.None;t&&(e=e.bind(t));let r=new nS(e),i;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(r.stack=Qx.create(),i=this._leakageMon.check(r.stack,this._size+1)),this._listeners?this._listeners instanceof nS?(this._deliveryQueue??=new aS,this._listeners=[this._listeners,r]):this._listeners.push(r):(this._options?.onWillAddFirstListener?.(this),this._listeners=r,this._options?.onDidAddFirstListener?.(this)),this._size++;let a=Fx(()=>{iS?.unregister(a),i?.(),this._removeListener(r)});if(n instanceof Lx?n.add(a):Array.isArray(n)&&n.push(a),iS){let e=Error().stack.split(`
|
|
60
|
-
`).slice(2,3).join(`
|
|
61
|
-
`).trim(),t=/(file:|vscode-file:\/\/vscode-app)?(\/[^:]*:\d+:\d+)/.exec(e);iS.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*rS<=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||gx;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 nS)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}},aS=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}},oS=class{constructor(){this.mapWindowIdToZoomLevel=new Map,this._onDidChangeZoomLevel=new X,this.onDidChangeZoomLevel=this._onDidChangeZoomLevel.event,this.mapWindowIdToZoomFactor=new Map,this._onDidChangeFullscreen=new X,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}};oS.INSTANCE=new oS;var sS=oS;function cS(e,t,n){typeof t==`string`&&(t=e.matchMedia(t)),t.addEventListener(`change`,n)}sS.INSTANCE.onDidChangeZoomLevel;function lS(e){return sS.INSTANCE.getZoomFactor(e)}sS.INSTANCE.onDidChangeFullscreen;var uS=typeof navigator==`object`?navigator.userAgent:``,dS=uS.indexOf(`Firefox`)>=0,fS=uS.indexOf(`AppleWebKit`)>=0,pS=uS.indexOf(`Chrome`)>=0,mS=!pS&&uS.indexOf(`Safari`)>=0;uS.indexOf(`Electron/`),uS.indexOf(`Android`);var hS=!1;if(typeof Bx.matchMedia==`function`){let e=Bx.matchMedia(`(display-mode: standalone) or (display-mode: window-controls-overlay)`),t=Bx.matchMedia(`(display-mode: fullscreen)`);hS=e.matches,cS(Bx,e,({matches:e})=>{hS&&t.matches||(hS=e)})}function gS(){return hS}var _S=`en`,vS=!1,yS=!1,bS=!1,xS=!1,SS=!1,CS=_S,wS,TS=globalThis,ES;typeof TS.vscode<`u`&&typeof TS.vscode.process<`u`?ES=TS.vscode.process:typeof process<`u`&&typeof process?.versions?.node==`string`&&(ES=process);var DS=typeof ES?.versions?.electron==`string`&&ES?.type===`renderer`;if(typeof ES==`object`){vS=ES.platform===`win32`,yS=ES.platform===`darwin`,bS=ES.platform===`linux`,bS&&ES.env.SNAP&&ES.env.SNAP_REVISION,ES.env.CI||ES.env.BUILD_ARTIFACTSTAGINGDIRECTORY,CS=_S;let e=ES.env.VSCODE_NLS_CONFIG;if(e)try{let t=JSON.parse(e);t.userLocale,t.osLocale,CS=t.resolvedLanguage||_S,t.languagePack?.translationsConfigFile}catch{}xS=!0}else typeof navigator==`object`&&!DS?(wS=navigator.userAgent,vS=wS.indexOf(`Windows`)>=0,yS=wS.indexOf(`Macintosh`)>=0,(wS.indexOf(`Macintosh`)>=0||wS.indexOf(`iPad`)>=0||wS.indexOf(`iPhone`)>=0)&&navigator.maxTouchPoints&&navigator.maxTouchPoints,bS=wS.indexOf(`Linux`)>=0,wS?.indexOf(`Mobi`),SS=!0,CS=globalThis._VSCODE_NLS_LANGUAGE||_S,navigator.language.toLowerCase()):console.error(`Unable to resolve platform.`);var OS=vS,kS=yS,AS=bS,jS=xS;SS&&typeof TS.importScripts==`function`&&TS.origin;var MS=wS,NS=CS,PS;(e=>{function t(){return NS}e.value=t;function n(){return NS.length===2?NS===`en`:NS.length>=3&&NS[0]===`e`&&NS[1]===`n`&&NS[2]===`-`}e.isDefaultVariant=n;function r(){return NS===`en`}e.isDefault=r})(PS||={});var FS=typeof TS.postMessage==`function`&&!TS.importScripts;(()=>{if(FS){let e=[];TS.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}),TS.postMessage({vscodeScheduleAsyncWork:r},`*`)}}return e=>setTimeout(e)})();var IS=!!(MS&&MS.indexOf(`Chrome`)>=0);MS&&MS.indexOf(`Firefox`),!IS&&MS&&MS.indexOf(`Safari`),MS&&MS.indexOf(`Edg/`),MS&&MS.indexOf(`Android`);var LS=typeof navigator==`object`?navigator:{};jS||document.queryCommandSupported&&document.queryCommandSupported(`copy`)||LS&&LS.clipboard&&LS.clipboard.writeText,jS||LS&&LS.clipboard&&LS.clipboard.readText,jS||gS()||LS.keyboard,`ontouchstart`in Bx||LS.maxTouchPoints,Bx.PointerEvent&&(`ontouchstart`in Bx||navigator.maxTouchPoints);var RS=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}},zS=new RS,BS=new RS,VS=new RS,HS=Array(230),US;(e=>{function t(e){return zS.keyCodeToStr(e)}e.toString=t;function n(e){return zS.strToKeyCode(e)}e.fromString=n;function r(e){return BS.keyCodeToStr(e)}e.toUserSettingsUS=r;function i(e){return VS.keyCodeToStr(e)}e.toUserSettingsGeneral=i;function a(e){return BS.strToKeyCode(e)||VS.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 zS.keyCodeToStr(e)}e.toElectronAccelerator=o})(US||={});var WS=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 GS([this])}isDuplicateModifierCase(){return this.ctrlKey&&this.keyCode===5||this.shiftKey&&this.keyCode===4||this.altKey&&this.keyCode===6||this.metaKey&&this.keyCode===57}},GS=class{constructor(e){if(e.length===0)throw bx(`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 KS(e){if(e.charCode){let t=String.fromCharCode(e.charCode).toUpperCase();return US.fromString(t)}let t=e.keyCode;if(t===3)return 7;if(dS)switch(t){case 59:return 85;case 60:if(AS)return 97;break;case 61:return 86;case 107:return 109;case 109:return 111;case 173:return 88;case 224:if(kS)return 57;break}else if(fS&&(kS&&t===93||!kS&&t===92))return 57;return HS[t]||0}var qS=kS?256:2048,JS=512,YS=1024,XS=kS?2048:256,ZS=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=KS(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|=qS),this.altKey&&(t|=JS),this.shiftKey&&(t|=YS),this.metaKey&&(t|=XS),t|=e,t}_computeKeyCodeChord(){let e=0;return this.keyCode!==5&&this.keyCode!==4&&this.keyCode!==6&&this.keyCode!==57&&(e=this.keyCode),new WS(this.ctrlKey,this.shiftKey,this.altKey,this.metaKey,e)}},QS=new WeakMap;function $S(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 eC=class{static getSameOriginWindowChain(e){let t=QS.get(e);if(!t){t=[],QS.set(e,t);let n=e,r;do r=$S(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}}},tC=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=eC.getPositionOfChildWindowRelativeToAncestorWindow(e,t.view);this.posx-=n.left,this.posy-=n.top}preventDefault(){this.browserEvent.preventDefault()}stopPropagation(){this.browserEvent.stopPropagation()}},nC=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(pS){let e=navigator.userAgent.match(/Chrome\/(\d+)/);r=(e?parseInt(e[1]):123)<=122}if(e){let t=e,n=e,i=e.view?.devicePixelRatio||1;if(typeof t.wheelDeltaY<`u`)this.deltaY=r?t.wheelDeltaY/(120*i):t.wheelDeltaY/120;else if(typeof n.VERTICAL_AXIS<`u`&&n.axis===n.VERTICAL_AXIS)this.deltaY=-n.detail/3;else if(e.type===`wheel`){let t=e;this.deltaY=t.deltaMode===t.DOM_DELTA_LINE?dS&&!kS?-e.deltaY/3:-e.deltaY:-e.deltaY/40}if(typeof t.wheelDeltaX<`u`)this.deltaX=mS&&OS?-(t.wheelDeltaX/120):r?t.wheelDeltaX/(120*i):t.wheelDeltaX/120;else if(typeof n.HORIZONTAL_AXIS<`u`&&n.axis===n.HORIZONTAL_AXIS)this.deltaX=-e.detail/3;else if(e.type===`wheel`){let t=e;this.deltaX=t.deltaMode===t.DOM_DELTA_LINE?dS&&!kS?-e.deltaX/3:-e.deltaX:-e.deltaX/40}this.deltaY===0&&this.deltaX===0&&e.wheelDelta&&(this.deltaY=r?e.wheelDelta/(120*i):e.wheelDelta/120)}}preventDefault(){this.browserEvent?.preventDefault()}stopPropagation(){this.browserEvent?.stopPropagation()}},rC=Object.freeze(function(e,t){let n=setTimeout(e.bind(t),0);return{dispose(){clearTimeout(n)}}}),iC;(e=>{function t(t){return t===e.None||t===e.Cancelled||t instanceof aC?!0:!t||typeof t!=`object`?!1:typeof t.isCancellationRequested==`boolean`&&typeof t.onCancellationRequested==`function`}e.isCancellationToken=t,e.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:Kx.None}),e.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:rC})})(iC||={});var aC=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?rC:(this._emitter||=new X,this._emitter.event)}dispose(){this._emitter&&=(this._emitter.dispose(),null)}},oC=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 Sx(`Calling 'cancelAndSet' on a disposed TimeoutTimer`);this.cancel(),this._token=setTimeout(()=>{this._token=-1,e()},t)}setIfNotSet(e,t){if(this._isDisposed)throw new Sx(`Calling 'setIfNotSet' on a disposed TimeoutTimer`);this._token===-1&&(this._token=setTimeout(()=>{this._token=-1,e()},t))}},sC=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 Sx(`Calling 'cancelAndSet' on a disposed IntervalTimer`);this.cancel();let r=n.setInterval(()=>{e()},t);this.disposable=Fx(()=>{n.clearInterval(r),this.disposable=void 0})}dispose(){this.cancel(),this.isDisposed=!0}};(function(){typeof globalThis.requestIdleCallback!=`function`||globalThis.cancelIdleCallback})();var cC;(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})(cC||={});var lC=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 X,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 Kx.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())}};lC.EMPTY=lC.fromArray([]);function uC(e){return dC(e,0)}function dC(e,t){switch(typeof e){case`object`:return e===null?fC(349,t):Array.isArray(e)?hC(e,t):gC(e,t);case`string`:return mC(e,t);case`boolean`:return pC(e,t);case`number`:return fC(e,t);case`undefined`:return fC(937,t);default:return fC(617,t)}}function fC(e,t){return(t<<5)-t+e|0}function pC(e,t){return fC(e?433:863,t)}function mC(e,t){t=fC(149417,t);for(let n=0,r=e.length;n<r;n++)t=fC(e.charCodeAt(n),t);return t}function hC(e,t){return t=fC(104579,t),e.reduce((e,t)=>dC(t,e),t)}function gC(e,t){return t=fC(181387,t),Object.keys(e).sort().reduce((t,n)=>(t=mC(n,t),dC(e[n],t)),t)}var{registerWindow:_C,getWindow:vC,getDocument:yC,getWindows:bC,getWindowsCount:xC,getWindowId:SC,getWindowById:CC,hasWindow:wC,onDidRegisterWindow:TC,onWillUnregisterWindow:EC,onDidUnregisterWindow:DC}=function(){let e=new Map,t={window:Bx,disposables:new Lx};e.set(Bx.vscodeWindowId,t);let n=new X,r=new X,i=new X;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 Rx.None;let a=new Lx,o={window:t,disposables:a.add(new Lx)};return e.set(t.vscodeWindowId,o),a.add(Fx(()=>{e.delete(t.vscodeWindowId),r.fire(t)})),a.add(kC(t,RC.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:Bx},getDocument(e){return vC(e).document}}}(),OC=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 kC(e,t,n,r){return new OC(e,t,n,r)}function AC(e,t){return function(n){return t(new tC(e,n))}}function jC(e){return function(t){return e(new ZS(t))}}var MC=function(e,t,n,r){let i=n;return t===`click`||t===`mousedown`||t===`contextmenu`?i=AC(vC(e),n):(t===`keydown`||t===`keypress`||t===`keyup`)&&(i=jC(n)),kC(e,t,i,r)},NC,PC=class extends sC{constructor(e){super(),this.defaultTarget=e&&vC(e)}cancelAndSet(e,t,n){return super.cancelAndSet(e,t,n??this.defaultTarget)}},FC=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){gx(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(FC.sort),a.shift().execute();r.set(i,!1)};NC=(t,r,a=0)=>{let o=SC(t),s=new FC(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 IC=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}};IC.None=new IC(0,0);function LC(e){let t=e.getBoundingClientRect(),n=vC(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=uC(n),a=r.get(i);if(a)a.users+=1;else{let o=new X,s=new MutationObserver(e=>o.fire(e));s.observe(e,n);let c=a={users:1,observer:s,onDidMutate:o.event};t.add(Fx(()=>{--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 RC={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:fS?`webkitAnimationStart`:`animationstart`,ANIMATION_END:fS?`webkitAnimationEnd`:`animationend`,ANIMATION_ITERATION:fS?`webkitAnimationIteration`:`animationiteration`},zC=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=BC(e);this._maxWidth!==t&&(this._maxWidth=t,this.domNode.style.maxWidth=this._maxWidth)}setWidth(e){let t=BC(e);this._width!==t&&(this._width=t,this.domNode.style.width=this._width)}setHeight(e){let t=BC(e);this._height!==t&&(this._height=t,this.domNode.style.height=this._height)}setTop(e){let t=BC(e);this._top!==t&&(this._top=t,this.domNode.style.top=this._top)}setLeft(e){let t=BC(e);this._left!==t&&(this._left=t,this.domNode.style.left=this._left)}setBottom(e){let t=BC(e);this._bottom!==t&&(this._bottom=t,this.domNode.style.bottom=this._bottom)}setRight(e){let t=BC(e);this._right!==t&&(this._right=t,this.domNode.style.right=this._right)}setPaddingTop(e){let t=BC(e);this._paddingTop!==t&&(this._paddingTop=t,this.domNode.style.paddingTop=this._paddingTop)}setPaddingLeft(e){let t=BC(e);this._paddingLeft!==t&&(this._paddingLeft=t,this.domNode.style.paddingLeft=this._paddingLeft)}setPaddingBottom(e){let t=BC(e);this._paddingBottom!==t&&(this._paddingBottom=t,this.domNode.style.paddingBottom=this._paddingBottom)}setPaddingRight(e){let t=BC(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=BC(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=BC(e);this._lineHeight!==t&&(this._lineHeight=t,this.domNode.style.lineHeight=this._lineHeight)}setLetterSpacing(e){let t=BC(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 BC(e){return typeof e==`number`?`${e}px`:e}function VC(e){return new zC(e)}var HC=class{constructor(){this._hooks=new Lx,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(Fx(()=>{try{e.releasePointerCapture(t)}catch{}}))}catch{a=vC(e)}this._hooks.add(kC(a,RC.POINTER_MOVE,e=>{if(e.buttons!==n){this.stopMonitoring(!0);return}e.preventDefault(),this._pointerMoveCallback(e)})),this._hooks.add(kC(a,RC.POINTER_UP,e=>this.stopMonitoring(!0)))}};function UC(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 WC;(e=>(e.Tap=`-xterm-gesturetap`,e.Change=`-xterm-gesturechange`,e.Start=`-xterm-gesturestart`,e.End=`-xterm-gesturesend`,e.Contextmenu=`-xterm-gesturecontextmenu`))(WC||={});var GC=class e extends Rx{constructor(){super(),this.dispatched=!1,this.targets=new Ux,this.ignoreTargets=new Ux,this.activeTouches={},this.handle=null,this._lastSetTapCountTime=0,this._register(Kx.runAndSubscribe(TC,({window:e,disposables:t})=>{t.add(kC(e.document,`touchstart`,e=>this.onTouchStart(e),{passive:!1})),t.add(kC(e.document,`touchend`,t=>this.onTouchEnd(e,t))),t.add(kC(e.document,`touchmove`,e=>this.onTouchMove(e),{passive:!1}))},{window:Bx,disposables:this._store}))}static addTarget(t){return e.isTouchDevice()?(e.INSTANCE||=Mx(new e),Fx(e.INSTANCE.targets.push(t))):Rx.None}static ignoreTarget(t){return e.isTouchDevice()?(e.INSTANCE||=Mx(new e),Fx(e.INSTANCE.ignoreTargets.push(t))):Rx.None}static isTouchDevice(){return`ontouchstart`in Bx||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(WC.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-Cx(s.rollingPageX))<30&&Math.abs(s.initialPageY-Cx(s.rollingPageY))<30){let e=this.newGestureEvent(WC.Tap,s.initialTarget);e.pageX=Cx(s.rollingPageX),e.pageY=Cx(s.rollingPageY),this.dispatchEvent(e)}else if(c>=e.HOLD_DELAY&&Math.abs(s.initialPageX-Cx(s.rollingPageX))<30&&Math.abs(s.initialPageY-Cx(s.rollingPageY))<30){let e=this.newGestureEvent(WC.Contextmenu,s.initialTarget);e.pageX=Cx(s.rollingPageX),e.pageY=Cx(s.rollingPageY),this.dispatchEvent(e)}else if(i===1){let e=Cx(s.rollingPageX),n=Cx(s.rollingPageY),i=Cx(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(WC.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===WC.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===WC.Change||t.type===WC.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=NC(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(WC.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(WC.Change,i.initialTarget);a.translationX=r.pageX-Cx(i.rollingPageX),a.translationY=r.pageY-Cx(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)}};GC.SCROLL_FRICTION=-.005,GC.HOLD_DELAY=700,GC.CLEAR_TAP_COUNT_TIME=400,Sb([UC],GC,`isTouchDevice`,1);var KC=GC,qC=class extends Rx{onclick(e,t){this._register(kC(e,RC.CLICK,n=>t(new tC(vC(e),n))))}onmousedown(e,t){this._register(kC(e,RC.MOUSE_DOWN,n=>t(new tC(vC(e),n))))}onmouseover(e,t){this._register(kC(e,RC.MOUSE_OVER,n=>t(new tC(vC(e),n))))}onmouseleave(e,t){this._register(kC(e,RC.MOUSE_LEAVE,n=>t(new tC(vC(e),n))))}onkeydown(e,t){this._register(kC(e,RC.KEY_DOWN,e=>t(new ZS(e))))}onkeyup(e,t){this._register(kC(e,RC.KEY_UP,e=>t(new ZS(e))))}oninput(e,t){this._register(kC(e,RC.INPUT,t))}onblur(e,t){this._register(kC(e,RC.BLUR,t))}onfocus(e,t){this._register(kC(e,RC.FOCUS,t))}onchange(e,t){this._register(kC(e,RC.CHANGE,t))}ignoreGesture(e){return KC.ignoreTarget(e)}},JC=11,YC=class extends qC{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=JC+`px`,this.domNode.style.height=JC+`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 HC),this._register(MC(this.bgDomNode,RC.POINTER_DOWN,e=>this._arrowPointerDown(e))),this._register(MC(this.domNode,RC.POINTER_DOWN,e=>this._arrowPointerDown(e))),this._pointerdownRepeatTimer=this._register(new PC),this._pointerdownScheduleRepeatTimer=this._register(new oC)}_arrowPointerDown(e){!e.target||!(e.target instanceof Element)||(this._onActivate(),this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancelAndSet(()=>{this._pointerdownRepeatTimer.cancelAndSet(()=>this._onActivate(),1e3/24,vC(e))},200),this._pointerMoveMonitor.startMonitoring(e.target,e.pointerId,e.buttons,e=>{},()=>{this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancel()}),e.preventDefault())}},XC=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}}},ZC=class extends Rx{constructor(e){super(),this._scrollableBrand=void 0,this._onScroll=this._register(new X),this.onScroll=this._onScroll.event,this._smoothScrollDuration=e.smoothScrollDuration,this._scheduleAtNextAnimationFrame=e.scheduleAtNextAnimationFrame,this._state=new XC(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 tw(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=tw.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)))}},QC=class{constructor(e,t,n){this.scrollLeft=e,this.scrollTop=t,this.isDone=n}};function $C(e,t){let n=t-e;return function(t){return e+n*rw(t)}}function ew(e,t,n){return function(r){return r<n?e(r/n):t((r-n)/(1-n))}}var tw=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),ew($C(e,r),$C(i,t),.33)}return $C(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 QC(this.scrollLeft(t),this.scrollTop(t),!1):new QC(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 nw(e){return e**3}function rw(e){return 1-nw(1-e)}var iw=class extends Rx{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 oC)}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`:``)))}},aw=140,ow=class extends qC{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 iw(e.visibility,`visible scrollbar `+e.extraScrollbarClassName,`invisible scrollbar `+e.extraScrollbarClassName)),this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._pointerMoveMonitor=this._register(new HC),this._shouldRender=!0,this.domNode=VC(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(kC(this.domNode.domNode,RC.POINTER_DOWN,e=>this._domNodePointerDown(e)))}_createArrow(e){let t=this._register(new YC(e));this.domNode.domNode.appendChild(t.bgDomNode),this.domNode.domNode.appendChild(t.domNode)}_createSlider(e,t,n,r){this.slider=VC(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(kC(this.slider.domNode,RC.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=LC(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(OS&&a>aw){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()}},sw=class e{constructor(e,t,n,r,i,a){this._scrollbarSize=Math.round(t),this._oppositeScrollbarSize=Math.round(n),this._arrowSize=Math.round(e),this._visibleSize=r,this._scrollSize=i,this._scrollPosition=a,this._computedAvailableSize=0,this._computedIsNeeded=!1,this._computedSliderSize=0,this._computedSliderRatio=0,this._computedSliderPosition=0,this._refreshComputedValues()}clone(){return new e(this._arrowSize,this._scrollbarSize,this._oppositeScrollbarSize,this._visibleSize,this._scrollSize,this._scrollPosition)}setVisibleSize(e){let t=Math.round(e);return this._visibleSize!==t&&(this._visibleSize=t,this._refreshComputedValues(),!0)}setScrollSize(e){let t=Math.round(e);return this._scrollSize!==t&&(this._scrollSize=t,this._refreshComputedValues(),!0)}setScrollPosition(e){let t=Math.round(e);return this._scrollPosition!==t&&(this._scrollPosition=t,this._refreshComputedValues(),!0)}setScrollbarSize(e){this._scrollbarSize=Math.round(e)}setOppositeScrollbarSize(e){this._oppositeScrollbarSize=Math.round(e)}static _computeValues(e,t,n,r,i){let a=Math.max(0,n-e),o=Math.max(0,a-2*t),s=r>0&&r>n;if(!s)return{computedAvailableSize:Math.round(a),computedIsNeeded:s,computedSliderSize:Math.round(o),computedSliderRatio:0,computedSliderPosition:0};let c=Math.round(Math.max(20,Math.floor(n*o/r))),l=(o-c)/(r-n),u=i*l;return{computedAvailableSize:Math.round(a),computedIsNeeded:s,computedSliderSize:Math.round(c),computedSliderRatio:l,computedSliderPosition:Math.round(u)}}_refreshComputedValues(){let t=e._computeValues(this._oppositeScrollbarSize,this._arrowSize,this._visibleSize,this._scrollSize,this._scrollPosition);this._computedAvailableSize=t.computedAvailableSize,this._computedIsNeeded=t.computedIsNeeded,this._computedSliderSize=t.computedSliderSize,this._computedSliderRatio=t.computedSliderRatio,this._computedSliderPosition=t.computedSliderPosition}getArrowSize(){return this._arrowSize}getScrollPosition(){return this._scrollPosition}getRectangleLargeSize(){return this._computedAvailableSize}getRectangleSmallSize(){return this._scrollbarSize}isNeeded(){return this._computedIsNeeded}getSliderSize(){return this._computedSliderSize}getSliderPosition(){return this._computedSliderPosition}getDesiredScrollPositionFromOffset(e){if(!this._computedIsNeeded)return 0;let t=e-this._arrowSize-this._computedSliderSize/2;return Math.round(t/this._computedSliderRatio)}getDesiredScrollPositionFromOffsetPaged(e){if(!this._computedIsNeeded)return 0;let t=e-this._arrowSize,n=this._scrollPosition;return t<this._computedSliderPosition?n-=this._visibleSize:n+=this._visibleSize,n}getDesiredScrollPositionFromDelta(e){if(!this._computedIsNeeded)return 0;let t=this._computedSliderPosition+e;return Math.round(t/this._computedSliderRatio)}},cw=class extends ow{constructor(e,t,n){let r=e.getScrollDimensions(),i=e.getCurrentScrollPosition();if(super({lazyRender:t.lazyRender,host:n,scrollbarState:new sw(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}},lw=class extends ow{constructor(e,t,n){let r=e.getScrollDimensions(),i=e.getCurrentScrollPosition();if(super({lazyRender:t.lazyRender,host:n,scrollbarState:new sw(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}},uw=500,dw=50,fw=!0,pw=class{constructor(e,t,n){this.timestamp=e,this.deltaX=t,this.deltaY=n,this.score=0}},mw=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(pS){let t=lS(vC(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 pw(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}};mw.INSTANCE=new mw;var hw=mw,gw=class extends qC{constructor(e,t,n){super(),this._onScroll=this._register(new X),this.onScroll=this._onScroll.event,this._onWillScroll=this._register(new X),this.onWillScroll=this._onWillScroll.event,this._options=vw(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 lw(this._scrollable,this._options,r)),this._horizontalScrollbar=this._register(new cw(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=VC(document.createElement(`div`)),this._leftShadowDomNode.setClassName(`shadow`),this._domNode.appendChild(this._leftShadowDomNode.domNode),this._topShadowDomNode=VC(document.createElement(`div`)),this._topShadowDomNode.setClassName(`shadow`),this._domNode.appendChild(this._topShadowDomNode.domNode),this._topLeftShadowDomNode=VC(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 oC),this._isDragging=!1,this._mouseIsOver=!1,this._shouldRender=!0,this._revealOnScroll=!0}get options(){return this._options}dispose(){this._mouseWheelToDispose=Nx(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,kS&&(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 nC(e))}_setListeningToMouseWheel(e){this._mouseWheelToDispose.length>0!==e&&(this._mouseWheelToDispose=Nx(this._mouseWheelToDispose),e)&&this._mouseWheelToDispose.push(kC(this._listenOnDomNode,RC.MOUSE_WHEEL,e=>{this._onMouseWheel(new nC(e))},{passive:!1}))}_onMouseWheel(e){if(e.browserEvent?.defaultPrevented)return;let t=hw.INSTANCE;fw&&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=!kS&&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=dw*r,t=o.scrollTop-(e<0?Math.floor(e):Math.ceil(e));this._verticalScrollbar.writeScrollPosition(s,t)}if(i){let e=dw*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)&&(fw&&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(),uw)}},_w=class extends gw{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 vw(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,kS&&(t.className+=` mac`),t}var yw=class extends Rx{constructor(e,t,n,r,i,a,o,s){super(),this._bufferService=n,this._optionsService=o,this._renderService=s,this._onRequestScrollLines=this._register(new X),this.onRequestScrollLines=this._onRequestScrollLines.event,this._isSyncing=!1,this._isHandlingScroll=!1,this._suppressOnScrollHandler=!1;let c=this._register(new ZC({forceIntegerValues:!1,smoothScrollDuration:this._optionsService.rawOptions.smoothScrollDuration,scheduleAtNextAnimationFrame:e=>NC(r.window,e)}));this._register(this._optionsService.onSpecificOptionChange(`smoothScrollDuration`,()=>{c.setSmoothScrollDuration(this._optionsService.rawOptions.smoothScrollDuration)})),this._scrollableElement=this._register(new _w(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(Kx.runAndSubscribe(a.onChangeColors,()=>{this._scrollableElement.getDomNode().style.backgroundColor=a.colors.background.css})),e.appendChild(this._scrollableElement.getDomNode()),this._register(Fx(()=>this._scrollableElement.getDomNode().remove())),this._styleElement=r.mainDocument.createElement(`style`),t.appendChild(this._styleElement),this._register(Fx(()=>this._styleElement.remove())),this._register(Kx.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(`
|
|
62
|
-
`)})),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}};yw=Sb([Y(2,Yb),Y(3,cx),Y(4,Xb),Y(5,px),Y(6,tx),Y(7,ux)],yw);var bw=class extends Rx{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(Fx(()=>{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()}};bw=Sb([Y(1,Yb),Y(2,cx),Y(3,ix),Y(4,ux)],bw);var xw=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)}},Sw={full:0,left:0,center:0,right:0},Cw={full:0,left:0,center:0,right:0},ww={full:0,left:0,center:0,right:0},Tw=class extends Rx{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 xw,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(Fx(()=>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);Cw.full=this._canvas.width,Cw.left=e,Cw.center=t,Cw.right=e,this._refreshDrawHeightConstants(),ww.full=1,ww.left=1,ww.center=1+Cw.left,ww.right=1+Cw.left+Cw.center}_refreshDrawHeightConstants(){Sw.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);Sw.left=t,Sw.center=t,Sw.right=t}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*Sw.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*Sw.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*Sw.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*Sw.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(ww[e.position||`full`],Math.round((this._canvas.height-1)*(e.startBufferLine/this._bufferService.buffers.active.lines.length)-Sw[e.position||`full`]/2),Cw[e.position||`full`],Math.round((this._canvas.height-1)*((e.endBufferLine-e.startBufferLine)/this._bufferService.buffers.active.lines.length)+Sw[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}))}};Tw=Sb([Y(2,Yb),Y(3,ix),Y(4,ux),Y(5,tx),Y(6,px),Y(7,cx)],Tw);var Z;(e=>(e.NUL=`\0`,e.SOH=``,e.STX=``,e.ETX=``,e.EOT=``,e.ENQ=``,e.ACK=``,e.BEL=`\x07`,e.BS=`\b`,e.HT=` `,e.LF=`
|
|
63
|
-
`,e.VT=`\v`,e.FF=`\f`,e.CR=`\r`,e.SO=``,e.SI=``,e.DLE=``,e.DC1=``,e.DC2=``,e.DC3=``,e.DC4=``,e.NAK=``,e.SYN=``,e.ETB=``,e.CAN=``,e.EM=``,e.SUB=``,e.ESC=`\x1B`,e.FS=``,e.GS=``,e.RS=``,e.US=``,e.SP=` `,e.DEL=``))(Z||={});var Ew;(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=``))(Ew||={});var Dw;(e=>e.ST=`${Z.ESC}\\`)(Dw||={});var Ow=class{constructor(e,t,n,r,i,a){this._textarea=e,this._compositionView=t,this._bufferService=n,this._optionsService=r,this._coreService=i,this._renderService=a,this._isComposing=!1,this._isSendingComposition=!1,this._compositionPosition={start:0,end:0},this._dataAlreadySent=``}get isComposing(){return this._isComposing}compositionstart(){this._isComposing=!0,this._compositionPosition.start=this._textarea.value.length,this._compositionView.textContent=``,this._dataAlreadySent=``,this._compositionView.classList.add(`active`)}compositionupdate(e){this._compositionView.textContent=e.data,this.updateCompositionElements(),setTimeout(()=>{this._compositionPosition.end=this._textarea.value.length},0)}compositionend(){this._finalizeComposition(!0)}keydown(e){if(this._isComposing||this._isSendingComposition){if(e.keyCode===20||e.keyCode===229||e.keyCode===16||e.keyCode===17||e.keyCode===18)return!1;this._finalizeComposition(!1)}return e.keyCode!==229||(this._handleAnyTextareaChanges(),!1)}_finalizeComposition(e){if(this._compositionView.classList.remove(`active`),this._isComposing=!1,e){let e={start:this._compositionPosition.start,end:this._compositionPosition.end};this._isSendingComposition=!0,setTimeout(()=>{if(this._isSendingComposition){this._isSendingComposition=!1;let t;e.start+=this._dataAlreadySent.length,t=this._isComposing?this._textarea.value.substring(e.start,this._compositionPosition.start):this._textarea.value.substring(e.start),t.length>0&&this._coreService.triggerDataEvent(t,!0)}},0)}else{this._isSendingComposition=!1;let e=this._textarea.value.substring(this._compositionPosition.start,this._compositionPosition.end);this._coreService.triggerDataEvent(e,!0)}}_handleAnyTextareaChanges(){let e=this._textarea.value;setTimeout(()=>{if(!this._isComposing){let t=this._textarea.value,n=t.replace(e,``);this._dataAlreadySent=n,t.length>e.length?this._coreService.triggerDataEvent(n,!0):t.length<e.length?this._coreService.triggerDataEvent(`${Z.DEL}`,!0):t.length===e.length&&t!==e&&this._coreService.triggerDataEvent(t,!0)}},0)}updateCompositionElements(e){if(this._isComposing){if(this._bufferService.buffer.isCursorInViewport){let e=Math.min(this._bufferService.buffer.x,this._bufferService.cols-1),t=this._renderService.dimensions.css.cell.height,n=this._bufferService.buffer.y*this._renderService.dimensions.css.cell.height,r=e*this._renderService.dimensions.css.cell.width;this._compositionView.style.left=r+`px`,this._compositionView.style.top=n+`px`,this._compositionView.style.height=t+`px`,this._compositionView.style.lineHeight=t+`px`,this._compositionView.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._compositionView.style.fontSize=this._optionsService.rawOptions.fontSize+`px`;let i=this._compositionView.getBoundingClientRect();this._textarea.style.left=r+`px`,this._textarea.style.top=n+`px`,this._textarea.style.width=Math.max(i.width,1)+`px`,this._textarea.style.height=Math.max(i.height,1)+`px`,this._textarea.style.lineHeight=i.height+`px`}e||setTimeout(()=>this.updateCompositionElements(!0),0)}}};Ow=Sb([Y(2,Yb),Y(3,tx),Y(4,Zb),Y(5,ux)],Ow);var kw=0,Aw=0,jw=0,Mw=0,Nw={css:`#00000000`,rgba:0},Pw;(e=>{function t(e,t,n,r){return r===void 0?`#${zw(e)}${zw(t)}${zw(n)}`:`#${zw(e)}${zw(t)}${zw(n)}${zw(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})(Pw||={});var Fw;(e=>{function t(e,t){if(Mw=(t.rgba&255)/255,Mw===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 kw=a+Math.round((n-a)*Mw),Aw=o+Math.round((r-o)*Mw),jw=s+Math.round((i-s)*Mw),{css:Pw.toCss(kw,Aw,jw),rgba:Pw.toRgba(kw,Aw,jw)}}e.blend=t;function n(e){return(e.rgba&255)==255}e.isOpaque=n;function r(e,t,n){let r=Rw.ensureContrastRatio(e.rgba,t.rgba,n);if(r)return Pw.toColor(r>>24&255,r>>16&255,r>>8&255)}e.ensureContrastRatio=r;function i(e){let t=(e.rgba|255)>>>0;return[kw,Aw,jw]=Rw.toChannels(t),{css:Pw.toCss(kw,Aw,jw),rgba:t}}e.opaque=i;function a(e,t){return Mw=Math.round(t*255),[kw,Aw,jw]=Rw.toChannels(e.rgba),{css:Pw.toCss(kw,Aw,jw,Mw),rgba:Pw.toRgba(kw,Aw,jw,Mw)}}e.opacity=a;function o(e,t){return Mw=e.rgba&255,a(e,Mw*t/255)}e.multiplyOpacity=o;function s(e){return[e.rgba>>24&255,e.rgba>>16&255,e.rgba>>8&255]}e.toColorRGB=s})(Fw||={});var Iw;(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 kw=parseInt(e.slice(1,2).repeat(2),16),Aw=parseInt(e.slice(2,3).repeat(2),16),jw=parseInt(e.slice(3,4).repeat(2),16),Pw.toColor(kw,Aw,jw);case 5:return kw=parseInt(e.slice(1,2).repeat(2),16),Aw=parseInt(e.slice(2,3).repeat(2),16),jw=parseInt(e.slice(3,4).repeat(2),16),Mw=parseInt(e.slice(4,5).repeat(2),16),Pw.toColor(kw,Aw,jw,Mw);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 kw=parseInt(r[1]),Aw=parseInt(r[2]),jw=parseInt(r[3]),Mw=Math.round((r[5]===void 0?1:parseFloat(r[5]))*255),Pw.toColor(kw,Aw,jw,Mw);if(!t||!n||(t.fillStyle=n,t.fillStyle=e,typeof t.fillStyle!=`string`)||(t.fillRect(0,0,1,1),[kw,Aw,jw,Mw]=t.getImageData(0,0,1,1).data,Mw!==255))throw Error(`css.toColor: Unsupported css format`);return{rgba:Pw.toRgba(kw,Aw,jw,Mw),css:e}}e.toColor=r})(Iw||={});var Lw;(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})(Lw||={});var Rw;(e=>{function t(e,t){if(Mw=(t&255)/255,Mw===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 kw=a+Math.round((n-a)*Mw),Aw=o+Math.round((r-o)*Mw),jw=s+Math.round((i-s)*Mw),Pw.toRgba(kw,Aw,jw)}e.blend=t;function n(e,t,n){let a=Lw.relativeLuminance(e>>8),o=Lw.relativeLuminance(t>>8);if(Bw(a,o)<n){if(o<a){let o=r(e,t,n),s=Bw(a,Lw.relativeLuminance(o>>8));if(s<n){let r=i(e,t,n);return s>Bw(a,Lw.relativeLuminance(r>>8))?o:r}return o}let s=i(e,t,n),c=Bw(a,Lw.relativeLuminance(s>>8));if(c<n){let i=r(e,t,n);return c>Bw(a,Lw.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=Bw(Lw.relativeLuminance2(o,s,c),Lw.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=Bw(Lw.relativeLuminance2(o,s,c),Lw.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=Bw(Lw.relativeLuminance2(o,s,c),Lw.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=Bw(Lw.relativeLuminance2(o,s,c),Lw.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})(Rw||={});function zw(e){let t=e.toString(16);return t.length<2?`0`+t:t}function Bw(e,t){return e<t?(t+.05)/(e+.05):(e+.05)/(t+.05)}var Vw=class extends Bb{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()]}},Hw=class{constructor(e){this._bufferService=e,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new Hb}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||zb.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++)Hw._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||zb.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}};Hw=Sb([Y(0,Yb)],Hw);function Uw(e){return 57508<=e&&e<=57558}function Ww(e){return 9472<=e&&e<=9631}function Gw(e){return Uw(e)||Ww(e)}function Kw(){return{css:{canvas:qw(),cell:qw()},device:{canvas:qw(),cell:qw(),char:{width:0,height:0,left:0,top:0}}}}function qw(){return{width:0,height:0}}var Jw=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 Hb,this._columnSelectMode=!1,this.defaultSpacing=0}handleSelectionChanged(e,t,n){this._selectionStart=e,this._selectionEnd=t,this._columnSelectMode=n}createRow(e,t,n,r,i,a,o,s,c,l,u){let d=[],f=this._characterJoinerService.getJoinedCharacters(t),p=this._themeService.colors,m=e.getNoBgTrimmedLength();n&&m<a+1&&(m=a+1);let h,g=0,_=``,v=0,y=0,b=0,x=0,S=!1,C=0,w=!1,T=0,E=0,D=[],O=l!==-1&&u!==-1;for(let k=0;k<m;k++){e.loadCell(k,this._workCell);let m=this._workCell.getWidth();if(m===0)continue;let ee=!1,A=k>=E,j=k,M=this._workCell;if(f.length>0&&k===f[0][0]&&A){let r=f.shift(),i=this._isCellInSelection(r[0],t);for(v=r[0]+1;v<r[1];v++)A&&=i===this._isCellInSelection(v,t);A&&=!n||a<r[0]||a>=r[1],A?(ee=!0,M=new Vw(this._workCell,e.translateToString(!0,r[0],r[1]),r[1]-r[0]),j=r[1]-1,m=M.getWidth()):E=r[1]}let te=this._isCellInSelection(k,t),ne=n&&k===a,N=O&&k>=l&&k<=u,P=!1;this._decorationService.forEachDecorationAtCell(k,t,void 0,e=>{P=!0});let re=M.getChars()||zb;if(re===` `&&(M.isUnderline()||M.isOverline())&&(re=`\xA0`),T=m*s-c.get(re,M.isBold(),M.isItalic()),!h)h=this._document.createElement(`span`);else if(g&&(te&&w||!te&&!w&&M.bg===y)&&(te&&w&&p.selectionForeground||M.fg===b)&&M.extended.ext===x&&N===S&&T===C&&!ne&&!ee&&!P&&A){M.isInvisible()?_+=zb:_+=re,g++;continue}else g&&(h.textContent=_),h=this._document.createElement(`span`),g=0,_=``;if(y=M.bg,b=M.fg,x=M.extended.ext,S=N,C=T,w=te,ee&&a>=k&&a<=j&&(a=k),!this._coreService.isCursorHidden&&ne&&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(M.isBold()&&D.push(`xterm-bold`),M.isItalic()&&D.push(`xterm-italic`),M.isDim()&&D.push(`xterm-dim`),_=M.isInvisible()?zb:M.getChars()||zb,M.isUnderline()&&(D.push(`xterm-underline-${M.extended.underlineStyle}`),_===` `&&(_=`\xA0`),!M.isUnderlineColorDefault())){if(M.isUnderlineColorRGB())h.style.textDecorationColor=`rgb(${Bb.toColorRGB(M.getUnderlineColor()).join(`,`)})`;else{let e=M.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&M.isBold()&&e<8&&(e+=8),h.style.textDecorationColor=p.ansi[e].css}}M.isOverline()&&(D.push(`xterm-overline`),_===` `&&(_=`\xA0`)),M.isStrikethrough()&&D.push(`xterm-strikethrough`),N&&(h.style.textDecoration=`underline`);let ie=M.getFgColor(),ae=M.getFgColorMode(),F=M.getBgColor(),I=M.getBgColorMode(),oe=!!M.isInverse();if(oe){let e=ie;ie=F,F=e;let t=ae;ae=I,I=t}let se,ce,le=!1;this._decorationService.forEachDecorationAtCell(k,t,void 0,e=>{e.options.layer!==`top`&&le||(e.backgroundColorRGB&&(I=50331648,F=e.backgroundColorRGB.rgba>>8&16777215,se=e.backgroundColorRGB),e.foregroundColorRGB&&(ae=50331648,ie=e.foregroundColorRGB.rgba>>8&16777215,ce=e.foregroundColorRGB),le=e.options.layer===`top`)}),!le&&te&&(se=this._coreBrowserService.isFocused?p.selectionBackgroundOpaque:p.selectionInactiveBackgroundOpaque,F=se.rgba>>8&16777215,I=50331648,le=!0,p.selectionForeground&&(ae=50331648,ie=p.selectionForeground.rgba>>8&16777215,ce=p.selectionForeground)),le&&D.push(`xterm-decoration-top`);let ue;switch(I){case 16777216:case 33554432:ue=p.ansi[F],D.push(`xterm-bg-${F}`);break;case 50331648:ue=Pw.toColor(F>>16,F>>8&255,F&255),this._addStyle(h,`background-color:#${Yw((F>>>0).toString(16),`0`,6)}`);break;default:oe?(ue=p.foreground,D.push(`xterm-bg-257`)):ue=p.background}switch(se||M.isDim()&&(se=Fw.multiplyOpacity(ue,.5)),ae){case 16777216:case 33554432:M.isBold()&&ie<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(ie+=8),this._applyMinimumContrast(h,ue,p.ansi[ie],M,se,void 0)||D.push(`xterm-fg-${ie}`);break;case 50331648:let e=Pw.toColor(ie>>16&255,ie>>8&255,ie&255);this._applyMinimumContrast(h,ue,e,M,se,ce)||this._addStyle(h,`color:#${Yw(ie.toString(16),`0`,6)}`);break;default:this._applyMinimumContrast(h,ue,p.foreground,M,se,ce)||oe&&D.push(`xterm-fg-257`)}D.length&&=(h.className=D.join(` `),0),!ne&&!ee&&!P&&A?g++:h.textContent=_,T!==this.defaultSpacing&&(h.style.letterSpacing=`${T}px`),d.push(h),k=j}return h&&g&&(h.textContent=_),d}_applyMinimumContrast(e,t,n,r,i,a){if(this._optionsService.rawOptions.minimumContrastRatio===1||Gw(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=Fw.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]}};Jw=Sb([Y(1,fx),Y(2,tx),Y(3,cx),Y(4,Zb),Y(5,ix),Y(6,px)],Jw);function Yw(e,t,n){for(;e.length<n;)e=t+e;return e}var Xw=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}},Zw=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 Qw(){return new Zw}var $w=`xterm-dom-renderer-owner-`,eT=`xterm-rows`,tT=`xterm-fg-`,nT=`xterm-bg-`,rT=`xterm-focus`,iT=`xterm-selection`,aT=1,oT=class extends Rx{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=aT++,this._rowElements=[],this._selectionRenderModel=Qw(),this.onRequestRedraw=this._register(new X).event,this._rowContainer=this._document.createElement(`div`),this._rowContainer.classList.add(eT),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(iT),this._selectionContainer.setAttribute(`aria-hidden`,`true`),this.dimensions=Kw(),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(Jw,document),this._element.classList.add($w+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(Fx(()=>{this._element.classList.remove($w+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()})),this._widthCache=new Xw(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} .${eT} 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} .${eT} { 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} .${eT} .xterm-dim { color: ${Fw.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} .${eT}.${rT} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${n} 1s step-end infinite;}${this._terminalSelector} .${eT}.${rT} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${r} 1s step-end infinite;}${this._terminalSelector} .${eT}.${rT} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${i} 1s step-end infinite;}${this._terminalSelector} .${eT} .xterm-cursor.xterm-cursor-block { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css};}${this._terminalSelector} .${eT} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${e.cursor.css} !important; color: ${e.cursorAccent.css} !important;}${this._terminalSelector} .${eT} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${e.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${eT} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${e.cursor.css} inset;}${this._terminalSelector} .${eT} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${e.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,t+=`${this._terminalSelector} .${iT} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${iT} div { position: absolute; background-color: ${e.selectionBackgroundOpaque.css};}${this._terminalSelector} .${iT} div { position: absolute; background-color: ${e.selectionInactiveBackgroundOpaque.css};}`;for(let[n,r]of e.ansi.entries())t+=`${this._terminalSelector} .${tT}${n} { color: ${r.css}; }${this._terminalSelector} .${tT}${n}.xterm-dim { color: ${Fw.multiplyOpacity(r,.5).css}; }${this._terminalSelector} .${nT}${n} { background-color: ${r.css}; }`;t+=`${this._terminalSelector} .${tT}257 { color: ${Fw.opaque(e.background).css}; }${this._terminalSelector} .${tT}257.xterm-dim { color: ${Fw.multiplyOpacity(Fw.opaque(e.background),.5).css}; }${this._terminalSelector} .${nT}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(rT),this.renderRows(0,this._bufferService.rows-1)}handleFocus(){this._rowContainer.classList.add(rT),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`.${$w}${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))}}};oT=Sb([Y(7,$b),Y(8,sx),Y(9,tx),Y(10,Yb),Y(11,Zb),Y(12,cx),Y(13,px)],oT);var sT=class extends Rx{constructor(e,t,n){super(),this._optionsService=n,this.width=0,this.height=0,this._onCharSizeChange=this._register(new X),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this._register(new uT(this._optionsService))}catch{this._measureStrategy=this._register(new lT(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())}};sT=Sb([Y(2,tx)],sT);var cT=class extends Rx{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)}},lT=class extends cT{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}},uT=class extends cT{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}},dT=class extends Rx{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 fT(this._window)),this._onDprChange=this._register(new X),this.onDprChange=this._onDprChange.event,this._onWindowChange=this._register(new X),this.onWindowChange=this._onWindowChange.event,this._register(this.onWindowChange(e=>this._screenDprMonitor.setWindow(e))),this._register(Kx.forward(this._screenDprMonitor.onDprChange,this._onDprChange)),this._register(kC(this._textarea,`focus`,()=>this._isFocused=!0)),this._register(kC(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}},fT=class extends Rx{constructor(e){super(),this._parentWindow=e,this._windowResizeListener=this._register(new zx),this._onDprChange=this._register(new X),this.onDprChange=this._onDprChange.event,this._outerListener=()=>this._setDprAndFireIfDiffers(),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._updateDpr(),this._setWindowResizeListener(),this._register(Fx(()=>this.clearListener()))}setWindow(e){this._parentWindow=e,this._setWindowResizeListener(),this._setDprAndFireIfDiffers()}_setWindowResizeListener(){this._windowResizeListener.value=kC(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)}},pT=class extends Rx{constructor(){super(),this.linkProviders=[],this._register(Fx(()=>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 mT(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 hT(e,t,n,r,i,a,o,s,c){if(!a)return;let l=mT(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 gT=class{constructor(e,t){this._renderService=e,this._charSizeService=t}getCoords(e,t,n,r,i){return hT(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=mT(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])}}};gT=Sb([Y(0,ux),Y(1,sx)],gT);var _T=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=[]}},vT={};xb(vT,{getSafariVersion:()=>TT,isChromeOS:()=>jT,isFirefox:()=>ST,isIpad:()=>DT,isIphone:()=>OT,isLegacyEdge:()=>CT,isLinux:()=>AT,isMac:()=>ET,isNode:()=>yT,isSafari:()=>wT,isWindows:()=>kT});var yT=typeof process<`u`&&`title`in process,bT=yT?`node`:navigator.userAgent,xT=yT?`node`:navigator.platform,ST=bT.includes(`Firefox`),CT=bT.includes(`Edge`),wT=/^((?!chrome|android).)*safari/i.test(bT);function TT(){if(!wT)return 0;let e=bT.match(/Version\/(\d+)/);return e===null||e.length<2?0:parseInt(e[1])}var ET=[`Macintosh`,`MacIntel`,`MacPPC`,`Mac68K`].includes(xT),DT=xT===`iPad`,OT=xT===`iPhone`,kT=[`Windows`,`Win16`,`Win32`,`WinCE`].includes(xT),AT=xT.indexOf(`Linux`)>=0,jT=/\bCrOS\b/.test(bT),MT=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()}},NT=class extends MT{_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())}}},PT=class extends MT{_requestCallback(e){return requestIdleCallback(e)}_cancelCallback(e){cancelIdleCallback(e)}},FT=!yT&&`requestIdleCallback`in window?PT:NT,IT=class{constructor(){this._queue=new FT}set(e){this._queue.clear(),this._queue.enqueue(e)}flush(){this._queue.flush()}},LT=class extends Rx{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 zx),this._pausedResizeTask=new IT,this._observerDisposable=this._register(new zx),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 X),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this._register(new X),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this._register(new X),this.onRender=this._onRender.event,this._onRefreshRequest=this._register(new X),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new _T((e,t)=>this._renderRows(e,t),this._coreBrowserService),this._register(this._renderDebouncer),this._syncOutputHandler=new RT(this._coreBrowserService,this._coreService,()=>this._fullRefresh()),this._register(Fx(()=>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=Fx(()=>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()}};LT=Sb([Y(2,tx),Y(3,sx),Y(4,Zb),Y(5,ix),Y(6,Yb),Y(7,cx),Y(8,px)],LT);var RT=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 zT(e,t,n,r){let i=n.buffer.x,a=n.buffer.y;if(!n.buffer.hasScrollback)return HT(i,a,e,t,n,r)+UT(a,t,n,r)+WT(i,a,e,t,n,r);let o;if(a===t)return o=i>e?`D`:`C`,ZT(Math.abs(i-e),XT(o,r));o=a>t?`D`:`C`;let s=Math.abs(a-t);return ZT(VT(a>t?e:i,n)+(s-1)*n.cols+1+BT(a>t?i:e,n),XT(o,r))}function BT(e,t){return e-1}function VT(e,t){return t.cols-e}function HT(e,t,n,r,i,a){return UT(t,r,i,a).length===0?``:ZT(YT(e,t,e,t-KT(t,i),!1,i).length,XT(`D`,a))}function UT(e,t,n,r){let i=e-KT(e,n),a=t-KT(t,n);return ZT(Math.abs(i-a)-GT(e,t,n),XT(JT(e,t),r))}function WT(e,t,n,r,i,a){let o;o=UT(t,r,i,a).length>0?r-KT(r,i):t;let s=r,c=qT(e,t,n,r,i,a);return ZT(YT(e,o,n,s,c===`C`,i).length,XT(c,a))}function GT(e,t,n){let r=0,i=e-KT(e,n),a=t-KT(t,n);for(let o=0;o<Math.abs(i-a);o++){let a=JT(e,t)===`A`?-1:1;n.buffer.lines.get(i+a*o)?.isWrapped&&r++}return r}function KT(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 qT(e,t,n,r,i,a){let o;return o=UT(n,r,i,a).length>0?r-KT(r,i):t,e<n&&o<=r||e>=n&&o<r?`C`:`D`}function JT(e,t){return e>t?`A`:`B`}function YT(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 XT(e,t){let n=t?`O`:`[`;return Z.ESC+n+e}function ZT(e,t){e=Math.floor(e);let n=``;for(let r=0;r<e;r++)n+=t;return n}var QT=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 $T(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 eE=50,tE=15,nE=50,rE=500,iE=RegExp(`\xA0`,`g`),aE=class extends Rx{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 Hb,this._mouseDownTimeStamp=0,this._oldHasSelection=!1,this._oldSelectionStart=void 0,this._oldSelectionEnd=void 0,this._onLinuxMouseSelection=this._register(new X),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this._register(new X),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this._register(new X),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this._register(new X),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 QT(this._bufferService),this._activeSelectionMode=0,this._register(Fx(()=>{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(iE,` `)).join(kT?`\r
|
|
64
|
-
`:`
|
|
65
|
-
`)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(e){this._refreshAnimationFrame||=this._coreBrowserService.window.requestAnimationFrame(()=>this._refresh()),AT&&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=$T(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=mT(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,-eE),eE),t/=eE,t/Math.abs(t)+Math.round(t*(tE-1)))}shouldForceSelection(e){return ET?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(),nE)}_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&&!(ET&&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<rE&&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=zT(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=$T(n,this._bufferService.cols)}};aE=Sb([Y(3,Yb),Y(4,Zb),Y(5,lx),Y(6,tx),Y(7,ux),Y(8,cx)],aE);var oE=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={}}},sE=class{constructor(){this._color=new oE,this._css=new oE}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()}},cE=Object.freeze((()=>{let e=[Iw.toColor(`#2e3436`),Iw.toColor(`#cc0000`),Iw.toColor(`#4e9a06`),Iw.toColor(`#c4a000`),Iw.toColor(`#3465a4`),Iw.toColor(`#75507b`),Iw.toColor(`#06989a`),Iw.toColor(`#d3d7cf`),Iw.toColor(`#555753`),Iw.toColor(`#ef2929`),Iw.toColor(`#8ae234`),Iw.toColor(`#fce94f`),Iw.toColor(`#729fcf`),Iw.toColor(`#ad7fa8`),Iw.toColor(`#34e2e2`),Iw.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:Pw.toCss(r,i,a),rgba:Pw.toRgba(r,i,a)})}for(let t=0;t<24;t++){let n=8+t*10;e.push({css:Pw.toCss(n,n,n),rgba:Pw.toRgba(n,n,n)})}return e})()),lE=Iw.toColor(`#ffffff`),uE=Iw.toColor(`#000000`),dE=Iw.toColor(`#ffffff`),fE=uE,pE={css:`rgba(255, 255, 255, 0.3)`,rgba:4294967117},mE=lE,hE=class extends Rx{constructor(e){super(),this._optionsService=e,this._contrastCache=new sE,this._halfContrastCache=new sE,this._onChangeColors=this._register(new X),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:lE,background:uE,cursor:dE,cursorAccent:fE,selectionForeground:void 0,selectionBackgroundTransparent:pE,selectionBackgroundOpaque:Fw.blend(uE,pE),selectionInactiveBackgroundTransparent:pE,selectionInactiveBackgroundOpaque:Fw.blend(uE,pE),scrollbarSliderBackground:Fw.opacity(lE,.2),scrollbarSliderHoverBackground:Fw.opacity(lE,.4),scrollbarSliderActiveBackground:Fw.opacity(lE,.5),overviewRulerBorder:lE,ansi:cE.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=gE(e.foreground,lE),t.background=gE(e.background,uE),t.cursor=Fw.blend(t.background,gE(e.cursor,dE)),t.cursorAccent=Fw.blend(t.background,gE(e.cursorAccent,fE)),t.selectionBackgroundTransparent=gE(e.selectionBackground,pE),t.selectionBackgroundOpaque=Fw.blend(t.background,t.selectionBackgroundTransparent),t.selectionInactiveBackgroundTransparent=gE(e.selectionInactiveBackground,t.selectionBackgroundTransparent),t.selectionInactiveBackgroundOpaque=Fw.blend(t.background,t.selectionInactiveBackgroundTransparent),t.selectionForeground=e.selectionForeground?gE(e.selectionForeground,Nw):void 0,t.selectionForeground===Nw&&(t.selectionForeground=void 0),Fw.isOpaque(t.selectionBackgroundTransparent)&&(t.selectionBackgroundTransparent=Fw.opacity(t.selectionBackgroundTransparent,.3)),Fw.isOpaque(t.selectionInactiveBackgroundTransparent)&&(t.selectionInactiveBackgroundTransparent=Fw.opacity(t.selectionInactiveBackgroundTransparent,.3)),t.scrollbarSliderBackground=gE(e.scrollbarSliderBackground,Fw.opacity(t.foreground,.2)),t.scrollbarSliderHoverBackground=gE(e.scrollbarSliderHoverBackground,Fw.opacity(t.foreground,.4)),t.scrollbarSliderActiveBackground=gE(e.scrollbarSliderActiveBackground,Fw.opacity(t.foreground,.5)),t.overviewRulerBorder=gE(e.overviewRulerBorder,mE),t.ansi=cE.slice(),t.ansi[0]=gE(e.black,cE[0]),t.ansi[1]=gE(e.red,cE[1]),t.ansi[2]=gE(e.green,cE[2]),t.ansi[3]=gE(e.yellow,cE[3]),t.ansi[4]=gE(e.blue,cE[4]),t.ansi[5]=gE(e.magenta,cE[5]),t.ansi[6]=gE(e.cyan,cE[6]),t.ansi[7]=gE(e.white,cE[7]),t.ansi[8]=gE(e.brightBlack,cE[8]),t.ansi[9]=gE(e.brightRed,cE[9]),t.ansi[10]=gE(e.brightGreen,cE[10]),t.ansi[11]=gE(e.brightYellow,cE[11]),t.ansi[12]=gE(e.brightBlue,cE[12]),t.ansi[13]=gE(e.brightMagenta,cE[13]),t.ansi[14]=gE(e.brightCyan,cE[14]),t.ansi[15]=gE(e.brightWhite,cE[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]=gE(e.extendedAnsi[r],cE[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()}}};hE=Sb([Y(0,tx)],hE);function gE(e,t){if(e!==void 0)try{return Iw.toColor(e)}catch{}return t}var _E=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)}},vE=class{constructor(){this._services=new _E,this._services.set($b,this)}setService(e,t){this._services.set(e,t)}getService(e){return this._services.get(e)}createInstance(e,...t){let n=Kb(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)}},yE={trace:0,debug:1,info:2,warn:3,error:4,off:5},bE=`xterm.js: `,xE=class extends Rx{constructor(e){super(),this._optionsService=e,this._logLevel=5,this._updateLogLevel(),this._register(this._optionsService.onSpecificOptionChange(`logLevel`,()=>this._updateLogLevel())),SE=this}get logLevel(){return this._logLevel}_updateLogLevel(){this._logLevel=yE[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?``:bE)+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)}};xE=Sb([Y(0,tx)],xE);var SE,CE=class extends Rx{constructor(e){super(),this._maxLength=e,this.onDeleteEmitter=this._register(new X),this.onDelete=this.onDeleteEmitter.event,this.onInsertEmitter=this._register(new X),this.onInsert=this.onInsertEmitter.event,this.onTrimEmitter=this._register(new X),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}},wE=3,TE=Object.freeze(new Bb),EE=0,DE=2,OE=class e{constructor(e,t,n=!1){this.isWrapped=n,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(e*wE);let r=t||Hb.fromCharData([0,Rb,1,0]);for(let t=0;t<e;++t)this.setCell(t,r);this.length=e}get(e){let t=this._data[e*wE+0],n=t&2097151;return[this._data[e*wE+1],t&2097152?this._combined[e]:n?Pb(n):``,t>>22,t&2097152?this._combined[e].charCodeAt(this._combined[e].length-1):n]}set(e,t){this._data[e*wE+1]=t[0],t[1].length>1?(this._combined[e]=t[1],this._data[e*wE+0]=e|2097152|t[2]<<22):this._data[e*wE+0]=t[1].charCodeAt(0)|t[2]<<22}getWidth(e){return this._data[e*wE+0]>>22}hasWidth(e){return this._data[e*wE+0]&12582912}getFg(e){return this._data[e*wE+1]}getBg(e){return this._data[e*wE+2]}hasContent(e){return this._data[e*wE+0]&4194303}getCodePoint(e){let t=this._data[e*wE+0];return t&2097152?this._combined[e].charCodeAt(this._combined[e].length-1):t&2097151}isCombined(e){return this._data[e*wE+0]&2097152}getString(e){let t=this._data[e*wE+0];return t&2097152?this._combined[e]:t&2097151?Pb(t&2097151):``}isProtected(e){return this._data[e*wE+2]&536870912}loadCell(e,t){return EE=e*wE,t.content=this._data[EE+0],t.fg=this._data[EE+1],t.bg=this._data[EE+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*wE+0]=t.content,this._data[e*wE+1]=t.fg,this._data[e*wE+2]=t.bg}setCellFromCodepoint(e,t,n,r){r.bg&268435456&&(this._extendedAttrs[e]=r.extended),this._data[e*wE+0]=t|n<<22,this._data[e*wE+1]=r.fg,this._data[e*wE+2]=r.bg}addCodepointToCell(e,t,n){let r=this._data[e*wE+0];r&2097152?this._combined[e]+=Pb(t):r&2097151?(this._combined[e]=Pb(r&2097151)+Pb(t),r&=-2097152,r|=2097152):r=t|1<<22,n&&(r&=-12582913,r|=n<<22),this._data[e*wE+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 Hb;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 Hb;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*DE<this._data.buffer.byteLength;let n=e*wE;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*DE<this._data.buffer.byteLength}cleanupMemory(){if(this._data.length*4*DE<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*wE+0]&4194303)return e+(this._data[e*wE+0]>>22);return 0}getNoBgTrimmedLength(){for(let e=this.length-1;e>=0;--e)if(this._data[e*wE+0]&4194303||this._data[e*wE+2]&50331648)return e+(this._data[e*wE+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<wE;e++)this._data[(n+i)*wE+e]=a[(t+i)*wE+e];a[(t+i)*wE+2]&268435456&&(this._extendedAttrs[n+i]=e._extendedAttrs[t+i])}else for(let i=0;i<r;i++){for(let e=0;e<wE;e++)this._data[(n+i)*wE+e]=a[(t+i)*wE+e];a[(t+i)*wE+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*wE+0],n=e&2097151,a=e&2097152?this._combined[t]:n?Pb(n):zb;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 kE(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=NE(u,d,t),p=1,m=0;for(;p<u.length;){let e=NE(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 AE(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 jE(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 ME(e,t,n){let r=[],i=e.map((n,r)=>NE(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=NE(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 NE(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 PE=class e{constructor(t){this.line=t,this.isDisposed=!1,this._disposables=[],this._id=e._nextId++,this._onDispose=this.register(new X),this.onDispose=this._onDispose.event}get id(){return this._id}dispose(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire(),Nx(this._disposables),this._disposables.length=0)}register(e){return this._disposables.push(e),e}};PE._nextId=1;var FE=PE,IE={},LE=IE.B;IE[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:`≥`,"{":`π`,"|":`≠`,"}":`£`,"~":`·`},IE.A={"#":`£`},IE.B=void 0,IE[4]={"#":`£`,"@":`¾`,"[":`ij`,"\\":`½`,"]":`|`,"{":`¨`,"|":`f`,"}":`¼`,"~":`´`},IE.C=IE[5]={"[":`Ä`,"\\":`Ö`,"]":`Å`,"^":`Ü`,"`":`é`,"{":`ä`,"|":`ö`,"}":`å`,"~":`ü`},IE.R={"#":`£`,"@":`à`,"[":`°`,"\\":`ç`,"]":`§`,"{":`é`,"|":`ù`,"}":`è`,"~":`¨`},IE.Q={"@":`à`,"[":`â`,"\\":`ç`,"]":`ê`,"^":`î`,"`":`ô`,"{":`é`,"|":`ù`,"}":`è`,"~":`û`},IE.K={"@":`§`,"[":`Ä`,"\\":`Ö`,"]":`Ü`,"{":`ä`,"|":`ö`,"}":`ü`,"~":`ß`},IE.Y={"#":`£`,"@":`§`,"[":`°`,"\\":`ç`,"]":`é`,"`":`ù`,"{":`à`,"|":`ò`,"}":`è`,"~":`ì`},IE.E=IE[6]={"@":`Ä`,"[":`Æ`,"\\":`Ø`,"]":`Å`,"^":`Ü`,"`":`ä`,"{":`æ`,"|":`ø`,"}":`å`,"~":`ü`},IE.Z={"#":`£`,"@":`§`,"[":`¡`,"\\":`Ñ`,"]":`¿`,"{":`°`,"|":`ñ`,"}":`ç`},IE.H=IE[7]={"@":`É`,"[":`Ä`,"\\":`Ö`,"]":`Å`,"^":`Ü`,"`":`é`,"{":`ä`,"|":`ö`,"}":`å`,"~":`ü`},IE[`=`]={"#":`ù`,"@":`à`,"[":`é`,"\\":`ç`,"]":`ê`,"^":`î`,_:`è`,"`":`ô`,"{":`ä`,"|":`ö`,"}":`ü`,"~":`û`};var RE=4294967295,zE=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=TE.clone(),this.savedCharset=LE,this.markers=[],this._nullCell=Hb.fromCharData([0,Rb,1,0]),this._whitespaceCell=Hb.fromCharData([0,zb,1,32]),this._isClearing=!1,this._memoryCleanupQueue=new FT,this._memoryCleanupPosition=0,this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new CE(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 Vb),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 Vb),this._whitespaceCell}getBlankLine(e,t){return new OE(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>RE?RE:t}fillViewportRows(e){if(this.lines.length===0){e===void 0&&(e=TE);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 CE(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(e,t){let n=this.getNullCell(TE),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 OE(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 OE(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=kE(this.lines,this._cols,e,this.ybase+this.y,this.getNullCell(TE),n);if(r.length>0){let n=AE(this.lines,r);jE(this.lines,n.layout),this._reflowLargerAdjustViewport(e,t,n.countRemoved)}}_reflowLargerAdjustViewport(e,t,n){let r=this.getNullCell(TE),i=n;for(;i-->0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length<t&&this.lines.push(new OE(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(TE),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=ME(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(TE,!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--,_=NE(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 FE(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)}},BE=class extends Rx{constructor(e,t){super(),this._optionsService=e,this._bufferService=t,this._onBufferActivate=this._register(new X),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 zE(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new zE(!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)}},VE=2,HE=1,UE=class extends Rx{constructor(e){super(),this.isUserScrolling=!1,this._onResize=this._register(new X),this.onResize=this._onResize.event,this._onScroll=this._register(new X),this.onScroll=this._onScroll.event,this.cols=Math.max(e.rawOptions.cols||0,VE),this.rows=Math.max(e.rawOptions.rows||0,HE),this.buffers=this._register(new BE(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))}};UE=Sb([Y(0,tx)],UE);var WE={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:ET,windowOptions:{},windowsMode:!1,windowsPty:{},wordSeparator:` ()[]{}',"\``,altClickMovesCursor:!0,convertEol:!1,termName:`xterm`,cancelEvents:!1,overviewRuler:{}},GE=[`normal`,`bold`,`100`,`200`,`300`,`400`,`500`,`600`,`700`,`800`,`900`],KE=class extends Rx{constructor(e){super(),this._onOptionChange=this._register(new X),this.onOptionChange=this._onOptionChange.event;let t={...WE};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(Fx(()=>{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 WE))throw Error(`No option with key "${e}"`);return this.rawOptions[e]},t=(e,t)=>{if(!(e in WE))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||=WE[e],!qE(t))throw Error(`"${t}" is not a valid value for ${e}`);break;case`wordSeparator`:t||=WE[e];break;case`fontWeight`:case`fontWeightBold`:if(typeof t==`number`&&1<=t&&t<=1e3)break;t=GE.includes(t)?t:WE[e];break;case`cursorWidth`:t=Math.floor(t);case`lineHeight`:case`tabStopWidth`:if(t<1)throw Error(`${e} cannot be less than 1, value: ${t}`);break;case`minimumContrastRatio`:t=Math.max(1,Math.min(21,Math.round(t*10)/10));break;case`scrollback`:if(t=Math.min(t,4294967295),t<0)throw Error(`${e} cannot be less than 0, value: ${t}`);break;case`fastScrollSensitivity`:case`scrollSensitivity`:if(t<=0)throw Error(`${e} cannot be less than or equal to 0, value: ${t}`);break;case`rows`:case`cols`:if(!t&&t!==0)throw Error(`${e} must be numeric, value: ${t}`);break;case`windowsPty`:t??={}}return t}};function qE(e){return e===`block`||e===`underline`||e===`bar`}function JE(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]&&JE(e[r],t-1);return n}var YE=Object.freeze({insertMode:!1}),XE=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,cursorBlink:void 0,cursorStyle:void 0,origin:!1,reverseWraparound:!1,sendFocus:!1,synchronizedOutput:!1,wraparound:!0}),ZE=class extends Rx{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 X),this.onData=this._onData.event,this._onUserInput=this._register(new X),this.onUserInput=this._onUserInput.event,this._onBinary=this._register(new X),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this._register(new X),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=JE(YE),this.decPrivateModes=JE(XE)}reset(){this.modes=JE(YE),this.decPrivateModes=JE(XE)}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))}};ZE=Sb([Y(0,Yb),Y(1,ex),Y(2,tx)],ZE);var QE={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 $E(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 eD=String.fromCharCode,tD={DEFAULT:e=>{let t=[$E(e,!1)+32,e.col+32,e.row+32];return t[0]>255||t[1]>255||t[2]>255?``:`\x1B[M${eD(t[0])}${eD(t[1])}${eD(t[2])}`},SGR:e=>{let t=e.action===0&&e.button!==4?`m`:`M`;return`\x1B[<${$E(e,!0)};${e.col};${e.row}${t}`},SGR_PIXELS:e=>{let t=e.action===0&&e.button!==4?`m`:`M`;return`\x1B[<${$E(e,!0)};${e.x};${e.y}${t}`}},nD=class extends Rx{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 X),this.onProtocolChange=this._onProtocolChange.event;for(let e of Object.keys(QE))this.addProtocol(e,QE[e]);for(let e of Object.keys(tD))this.addEncoding(e,tD[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}};nD=Sb([Y(0,Yb),Y(1,Zb),Y(2,tx)],nD);var rD=[[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]],iD=[[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]],aD;function oD(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 sD=class{constructor(){if(this.version=`6`,!aD){aD=new Uint8Array(65536),aD.fill(1),aD[0]=0,aD.fill(0,1,32),aD.fill(0,127,160),aD.fill(2,4352,4448),aD[9001]=2,aD[9002]=2,aD.fill(2,11904,42192),aD[12351]=1,aD.fill(2,44032,55204),aD.fill(2,63744,64256),aD.fill(2,65040,65050),aD.fill(2,65072,65136),aD.fill(2,65280,65377),aD.fill(2,65504,65511);for(let e=0;e<rD.length;++e)aD.fill(0,rD[e][0],rD[e][1]+1)}}wcwidth(e){return e<32?0:e<127?1:e<65536?aD[e]:oD(e,iD)?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=cD.extractWidth(t);e===0?r=!1:e>n&&(n=e)}return cD.createPropertyValue(0,n,r)}},cD=class e{constructor(){this._providers=Object.create(null),this._active=``,this._onChange=new X,this.onChange=this._onChange.event;let e=new sD;this.register(e),this._active=e.version,this._activeProvider=e}static extractShouldJoin(e){return!!(e&1)}static extractWidth(e){return e>>1&3}static extractCharKind(e){return e>>3}static createPropertyValue(e,t,n=!1){return(e&16777215)<<3|(t&3)<<1|!!n}dispose(){this._onChange.dispose()}get versions(){return Object.keys(this._providers)}get activeVersion(){return this._active}set activeVersion(e){if(!this._providers[e])throw Error(`unknown Unicode version "${e}"`);this._active=e,this._activeProvider=this._providers[e],this._onChange.fire(e)}register(e){this._providers[e.version]=e}wcwidth(e){return this._activeProvider.wcwidth(e)}getStringCellWidth(t){let n=0,r=0,i=t.length;for(let a=0;a<i;++a){let o=t.charCodeAt(a);if(55296<=o&&o<=56319){if(++a>=i)return n+this.wcwidth(o);let e=t.charCodeAt(a);56320<=e&&e<=57343?o=(o-55296)*1024+e-56320+65536:n+=this.wcwidth(e)}let s=this.charProperties(o,r),c=e.extractWidth(s);e.extractShouldJoin(s)&&(c-=e.extractWidth(r)),n+=c,r=s}return n}charProperties(e,t){return this._activeProvider.charProperties(e,t)}},lD=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 uD(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 dD=2147483647,fD=256,pD=class e{constructor(e=32,t=32){if(this.maxLength=e,this.maxSubParamsLength=t,t>fD)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>dD?dD: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>dD?dD: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,dD):e}},mD=[],hD=class{constructor(){this._state=0,this._active=mD,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=mD}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=mD,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||mD,!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`,Fb(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=mD,this._id=-1,this._state=0}}},gD=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+=Fb(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}},_D=[],vD=class{constructor(){this._handlers=Object.create(null),this._active=_D,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=_D}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=_D,this._ident=0}hook(e,t){if(this.reset(),this._ident=e,this._active=this._handlers[e]||_D,!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`,Fb(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=_D,this._ident=0}},yD=new pD;yD.addParam(0);var bD=class{constructor(e){this._handler=e,this._data=``,this._params=yD,this._hitLimit=!1}hook(e){this._params=e.length>1||e.params[0]?e.clone():yD,this._data=``,this._hitLimit=!1}put(e,t,n){this._hitLimit||(this._data+=Fb(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=yD,this._data=``,this._hitLimit=!1,e));return this._params=yD,this._data=``,this._hitLimit=!1,t}},xD=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}},SD=160,CD=function(){let e=new xD(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(SD,0,2,0),e.add(SD,8,5,8),e.add(SD,6,0,6),e.add(SD,11,0,11),e.add(SD,13,13,13),e}(),wD=class extends Rx{constructor(e=CD){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 pD,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(Fx(()=>{this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null)})),this._oscParser=this._register(new hD),this._dcsParser=this._register(new vD),this._errorHandler=this._errorHandlerFb,this.registerEscHandler({final:`\\`},()=>!0)}_identifier(e,t=[64,126]){let n=0;if(e.prefix){if(e.prefix.length>1)throw Error(`only one byte as prefix supported`);if(n=e.prefix.charCodeAt(0),n&&60>n||n>63)throw Error(`prefix must be in range 0x3c .. 0x3f`)}if(e.intermediates){if(e.intermediates.length>2)throw Error(`only two bytes as intermediates are supported`);for(let t=0;t<e.intermediates.length;++t){let r=e.intermediates.charCodeAt(t);if(32>r||r>47)throw Error(`intermediate must be in range 0x20 .. 0x2f`);n<<=8,n|=r}}if(e.final.length!==1)throw Error(`final must be a single byte`);let r=e.final.charCodeAt(0);if(t[0]>r||r>t[1])throw Error(`final must be in range ${t[0]} .. ${t[1]}`);return n<<=8,n|=r,n}identToString(e){let t=[];for(;e;)t.push(String.fromCharCode(e&255)),e>>=8;return t.reverse().join(``)}setPrintHandler(e){this._printHandler=e}clearPrintHandler(){this._printHandler=this._printHandlerFb}registerEscHandler(e,t){let n=this._identifier(e,[48,126]);this._escHandlers[n]===void 0&&(this._escHandlers[n]=[]);let r=this._escHandlers[n];return r.push(t),{dispose:()=>{let e=r.indexOf(t);e!==-1&&r.splice(e,1)}}}clearEscHandler(e){this._escHandlers[this._identifier(e,[48,126])]&&delete this._escHandlers[this._identifier(e,[48,126])]}setEscHandlerFallback(e){this._escHandlerFb=e}setExecuteHandler(e,t){this._executeHandlers[e.charCodeAt(0)]=t}clearExecuteHandler(e){this._executeHandlers[e.charCodeAt(0)]&&delete this._executeHandlers[e.charCodeAt(0)]}setExecuteHandlerFallback(e){this._executeHandlerFb=e}registerCsiHandler(e,t){let n=this._identifier(e);this._csiHandlers[n]===void 0&&(this._csiHandlers[n]=[]);let r=this._csiHandlers[n];return r.push(t),{dispose:()=>{let e=r.indexOf(t);e!==-1&&r.splice(e,1)}}}clearCsiHandler(e){this._csiHandlers[this._identifier(e)]&&delete this._csiHandlers[this._identifier(e)]}setCsiHandlerFallback(e){this._csiHandlerFb=e}registerDcsHandler(e,t){return this._dcsParser.registerHandler(this._identifier(e),t)}clearDcsHandler(e){this._dcsParser.clearHandler(this._identifier(e))}setDcsHandlerFallback(e){this._dcsParser.setHandlerFallback(e)}registerOscHandler(e,t){return this._oscParser.registerHandler(e,t)}clearOscHandler(e){this._oscParser.clearHandler(e)}setOscHandlerFallback(e){this._oscParser.setHandlerFallback(e)}setErrorHandler(e){this._errorHandler=e}clearErrorHandler(){this._errorHandler=this._errorHandlerFb}reset(){this.currentState=this.initialState,this._oscParser.reset(),this._dcsParser.reset(),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._parseStack.state!==0&&(this._parseStack.state=2,this._parseStack.handlers=[])}_preserveStack(e,t,n,r,i){this._parseStack.state=e,this._parseStack.handlers=t,this._parseStack.handlerPos=n,this._parseStack.transition=r,this._parseStack.chunkPos=i}parse(e,t,n){let r=0,i=0,a=0,o;if(this._parseStack.state){if(this._parseStack.state===2)this._parseStack.state=0,a=this._parseStack.chunkPos+1;else{if(n===void 0||this._parseStack.state===1)throw this._parseStack.state=1,Error(`improper continuation due to previous async handler, giving up parsing`);let t=this._parseStack.handlers,i=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(n===!1&&i>-1){for(;i>=0&&(o=t[i](this._params),o!==!0);i--)if(o instanceof Promise)return this._parseStack.handlerPos=i,o}this._parseStack.handlers=[];break;case 4:if(n===!1&&i>-1){for(;i>=0&&(o=t[i](),o!==!0);i--)if(o instanceof Promise)return this._parseStack.handlerPos=i,o}this._parseStack.handlers=[];break;case 6:if(r=e[this._parseStack.chunkPos],o=this._dcsParser.unhook(r!==24&&r!==26,n),o)return o;r===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break;case 5:if(r=e[this._parseStack.chunkPos],o=this._oscParser.end(r!==24&&r!==26,n),o)return o;r===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0}this._parseStack.state=0,a=this._parseStack.chunkPos+1,this.precedingJoinState=0,this.currentState=this._parseStack.transition&15}}for(let n=a;n<t;++n){switch(r=e[n],i=this._transitions.table[this.currentState<<8|(r<160?r:SD)],i>>4){case 2:for(let i=n+1;;++i){if(i>=t||(r=e[i])<32||r>126&&r<SD){this._printHandler(e,n,i),n=i-1;break}if(++i>=t||(r=e[i])<32||r>126&&r<SD){this._printHandler(e,n,i),n=i-1;break}if(++i>=t||(r=e[i])<32||r>126&&r<SD){this._printHandler(e,n,i),n=i-1;break}if(++i>=t||(r=e[i])<32||r>126&&r<SD){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<SD){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<SD){this._oscParser.put(e,n,i),n=i-1;break}break;case 6:if(o=this._oscParser.end(r!==24&&r!==26),o)return this._preserveStack(5,[],0,i,n),o;r===27&&(i|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0}this.currentState=i&15}}},TD=/^([\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})$/,ED=/^[\da-f]+$/;function DD(e){if(!e)return;let t=e.toLowerCase();if(t.indexOf(`rgb:`)===0){t=t.slice(4);let e=TD.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),ED.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 OD(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 kD(e,t=16){let[n,r,i]=e;return`rgb:${OD(n,t)}/${OD(r,t)}/${OD(i,t)}`}var AD={"(":0,")":1,"*":2,"+":3,"-":1,".":2},jD=131072,MD=10;function ND(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 PD=5e3,FD=0,ID=class extends Rx{constructor(e,t,n,r,i,a,o,s,c=new wD){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 Ib,this._utf8Decoder=new Lb,this._windowTitle=``,this._iconName=``,this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=TE.clone(),this._eraseAttrDataInternal=TE.clone(),this._onRequestBell=this._register(new X),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this._register(new X),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this._register(new X),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this._register(new X),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this._register(new X),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this._register(new X),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this._register(new X),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this._register(new X),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this._register(new X),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this._register(new X),this.onLineFeed=this._onLineFeed.event,this._onScroll=this._register(new X),this.onScroll=this._onScroll.event,this._onTitleChange=this._register(new X),this.onTitleChange=this._onTitleChange.event,this._onColor=this._register(new X),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 LD(this._bufferService),this._activeBuffer=this._bufferService.buffer,this._register(this._bufferService.buffers.onBufferActivate(e=>this._activeBuffer=e.activeBuffer)),this._parser.setCsiHandlerFallback((e,t)=>{this._logService.debug(`Unknown CSI code: `,{identifier:this._parser.identToString(e),params:t.toArray()})}),this._parser.setEscHandlerFallback(e=>{this._logService.debug(`Unknown ESC code: `,{identifier:this._parser.identToString(e)})}),this._parser.setExecuteHandlerFallback(e=>{this._logService.debug(`Unknown EXECUTE code: `,{code:e})}),this._parser.setOscHandlerFallback((e,t,n)=>{this._logService.debug(`Unknown OSC code: `,{identifier:e,action:t,data:n})}),this._parser.setDcsHandlerFallback((e,t,n)=>{t===`HOOK`&&(n=n.toArray()),this._logService.debug(`Unknown DCS code: `,{identifier:this._parser.identToString(e),action:t,payload:n})}),this._parser.setPrintHandler((e,t,n)=>this.print(e,t,n)),this._parser.registerCsiHandler({final:`@`},e=>this.insertChars(e)),this._parser.registerCsiHandler({intermediates:` `,final:`@`},e=>this.scrollLeft(e)),this._parser.registerCsiHandler({final:`A`},e=>this.cursorUp(e)),this._parser.registerCsiHandler({intermediates:` `,final:`A`},e=>this.scrollRight(e)),this._parser.registerCsiHandler({final:`B`},e=>this.cursorDown(e)),this._parser.registerCsiHandler({final:`C`},e=>this.cursorForward(e)),this._parser.registerCsiHandler({final:`D`},e=>this.cursorBackward(e)),this._parser.registerCsiHandler({final:`E`},e=>this.cursorNextLine(e)),this._parser.registerCsiHandler({final:`F`},e=>this.cursorPrecedingLine(e)),this._parser.registerCsiHandler({final:`G`},e=>this.cursorCharAbsolute(e)),this._parser.registerCsiHandler({final:`H`},e=>this.cursorPosition(e)),this._parser.registerCsiHandler({final:`I`},e=>this.cursorForwardTab(e)),this._parser.registerCsiHandler({final:`J`},e=>this.eraseInDisplay(e,!1)),this._parser.registerCsiHandler({prefix:`?`,final:`J`},e=>this.eraseInDisplay(e,!0)),this._parser.registerCsiHandler({final:`K`},e=>this.eraseInLine(e,!1)),this._parser.registerCsiHandler({prefix:`?`,final:`K`},e=>this.eraseInLine(e,!0)),this._parser.registerCsiHandler({final:`L`},e=>this.insertLines(e)),this._parser.registerCsiHandler({final:`M`},e=>this.deleteLines(e)),this._parser.registerCsiHandler({final:`P`},e=>this.deleteChars(e)),this._parser.registerCsiHandler({final:`S`},e=>this.scrollUp(e)),this._parser.registerCsiHandler({final:`T`},e=>this.scrollDown(e)),this._parser.registerCsiHandler({final:`X`},e=>this.eraseChars(e)),this._parser.registerCsiHandler({final:`Z`},e=>this.cursorBackwardTab(e)),this._parser.registerCsiHandler({final:"`"},e=>this.charPosAbsolute(e)),this._parser.registerCsiHandler({final:`a`},e=>this.hPositionRelative(e)),this._parser.registerCsiHandler({final:`b`},e=>this.repeatPrecedingCharacter(e)),this._parser.registerCsiHandler({final:`c`},e=>this.sendDeviceAttributesPrimary(e)),this._parser.registerCsiHandler({prefix:`>`,final:`c`},e=>this.sendDeviceAttributesSecondary(e)),this._parser.registerCsiHandler({final:`d`},e=>this.linePosAbsolute(e)),this._parser.registerCsiHandler({final:`e`},e=>this.vPositionRelative(e)),this._parser.registerCsiHandler({final:`f`},e=>this.hVPosition(e)),this._parser.registerCsiHandler({final:`g`},e=>this.tabClear(e)),this._parser.registerCsiHandler({final:`h`},e=>this.setMode(e)),this._parser.registerCsiHandler({prefix:`?`,final:`h`},e=>this.setModePrivate(e)),this._parser.registerCsiHandler({final:`l`},e=>this.resetMode(e)),this._parser.registerCsiHandler({prefix:`?`,final:`l`},e=>this.resetModePrivate(e)),this._parser.registerCsiHandler({final:`m`},e=>this.charAttributes(e)),this._parser.registerCsiHandler({final:`n`},e=>this.deviceStatus(e)),this._parser.registerCsiHandler({prefix:`?`,final:`n`},e=>this.deviceStatusPrivate(e)),this._parser.registerCsiHandler({intermediates:`!`,final:`p`},e=>this.softReset(e)),this._parser.registerCsiHandler({intermediates:` `,final:`q`},e=>this.setCursorStyle(e)),this._parser.registerCsiHandler({final:`r`},e=>this.setScrollRegion(e)),this._parser.registerCsiHandler({final:`s`},e=>this.saveCursor(e)),this._parser.registerCsiHandler({final:`t`},e=>this.windowOptions(e)),this._parser.registerCsiHandler({final:`u`},e=>this.restoreCursor(e)),this._parser.registerCsiHandler({intermediates:`'`,final:`}`},e=>this.insertColumns(e)),this._parser.registerCsiHandler({intermediates:`'`,final:`~`},e=>this.deleteColumns(e)),this._parser.registerCsiHandler({intermediates:`"`,final:`q`},e=>this.selectProtected(e)),this._parser.registerCsiHandler({intermediates:`$`,final:`p`},e=>this.requestMode(e,!0)),this._parser.registerCsiHandler({prefix:`?`,intermediates:`$`,final:`p`},e=>this.requestMode(e,!1)),this._parser.setExecuteHandler(Z.BEL,()=>this.bell()),this._parser.setExecuteHandler(Z.LF,()=>this.lineFeed()),this._parser.setExecuteHandler(Z.VT,()=>this.lineFeed()),this._parser.setExecuteHandler(Z.FF,()=>this.lineFeed()),this._parser.setExecuteHandler(Z.CR,()=>this.carriageReturn()),this._parser.setExecuteHandler(Z.BS,()=>this.backspace()),this._parser.setExecuteHandler(Z.HT,()=>this.tab()),this._parser.setExecuteHandler(Z.SO,()=>this.shiftOut()),this._parser.setExecuteHandler(Z.SI,()=>this.shiftIn()),this._parser.setExecuteHandler(Ew.IND,()=>this.index()),this._parser.setExecuteHandler(Ew.NEL,()=>this.nextLine()),this._parser.setExecuteHandler(Ew.HTS,()=>this.tabSet()),this._parser.registerOscHandler(0,new gD(e=>(this.setTitle(e),this.setIconName(e),!0))),this._parser.registerOscHandler(1,new gD(e=>this.setIconName(e))),this._parser.registerOscHandler(2,new gD(e=>this.setTitle(e))),this._parser.registerOscHandler(4,new gD(e=>this.setOrReportIndexedColor(e))),this._parser.registerOscHandler(8,new gD(e=>this.setHyperlink(e))),this._parser.registerOscHandler(10,new gD(e=>this.setOrReportFgColor(e))),this._parser.registerOscHandler(11,new gD(e=>this.setOrReportBgColor(e))),this._parser.registerOscHandler(12,new gD(e=>this.setOrReportCursorColor(e))),this._parser.registerOscHandler(104,new gD(e=>this.restoreIndexedColor(e))),this._parser.registerOscHandler(110,new gD(e=>this.restoreFgColor(e))),this._parser.registerOscHandler(111,new gD(e=>this.restoreBgColor(e))),this._parser.registerOscHandler(112,new gD(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 IE)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 bD((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`),PD))]).catch(e=>{if(e!==`#SLOW_TIMEOUT`)throw e;console.warn(`async parser handler taking longer than ${PD} 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>jD&&(a=this._parseStack.position+jD)}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<jD&&(this._parseBuffer=new Uint32Array(Math.min(e.length,jD))),o||this._dirtyRowTracker.clearRange(),e.length>jD)for(let t=a;t<e.length;t+=jD){let a=t+jD<e.length?t+jD: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=cD.extractWidth(t);let n=cD.extractShouldJoin(t),m=n?cD.extractWidth(f):0;if(f=t,o&&this._onA11yChar.fire(Pb(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 OE&&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=>!ND(e.params[0],this._optionsService.rawOptions.windowOptions)||t(e)):this._parser.registerCsiHandler(e,t)}registerDcsHandler(e,t){return this._parser.registerDcsHandler(e,new bD(t))}registerEscHandler(e,t){return this._parser.registerEscHandler(e,t)}registerOscHandler(e,t){return this._parser.registerOscHandler(e,new gD(t))}bell(){return this._onRequestBell.fire(),!0}lineFeed(){return this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._optionsService.rawOptions.convertEol&&(this._activeBuffer.x=0),this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData())):this._activeBuffer.y>=this._bufferService.rows?this._activeBuffer.y=this._bufferService.rows-1:this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.x>=this._bufferService.cols&&this._activeBuffer.x--,this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._onLineFeed.fire(),!0}carriageReturn(){return this._activeBuffer.x=0,!0}backspace(){if(!this._coreService.decPrivateModes.reverseWraparound)return this._restrictCursor(),this._activeBuffer.x>0&&this._activeBuffer.x--,!0;if(this._restrictCursor(this._bufferService.cols),this._activeBuffer.x>0)this._activeBuffer.x--;else if(this._activeBuffer.x===0&&this._activeBuffer.y>this._activeBuffer.scrollTop&&this._activeBuffer.y<=this._activeBuffer.scrollBottom&&this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y)?.isWrapped){this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.y--,this._activeBuffer.x=this._bufferService.cols-1;let e=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);e.hasWidth(this._activeBuffer.x)&&!e.hasContent(this._activeBuffer.x)&&this._activeBuffer.x--}return this._restrictCursor(),!0}tab(){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let e=this._activeBuffer.x;return this._activeBuffer.x=this._activeBuffer.nextStop(),this._optionsService.rawOptions.screenReaderMode&&this._onA11yTab.fire(this._activeBuffer.x-e),!0}shiftOut(){return this._charsetService.setgLevel(1),!0}shiftIn(){return this._charsetService.setgLevel(0),!0}_restrictCursor(e=this._bufferService.cols-1){this._activeBuffer.x=Math.min(e,Math.max(0,this._activeBuffer.x)),this._activeBuffer.y=this._coreService.decPrivateModes.origin?Math.min(this._activeBuffer.scrollBottom,Math.max(this._activeBuffer.scrollTop,this._activeBuffer.y)):Math.min(this._bufferService.rows-1,Math.max(0,this._activeBuffer.y)),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_setCursor(e,t){this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._coreService.decPrivateModes.origin?(this._activeBuffer.x=e,this._activeBuffer.y=this._activeBuffer.scrollTop+t):(this._activeBuffer.x=e,this._activeBuffer.y=t),this._restrictCursor(),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_moveCursor(e,t){this._restrictCursor(),this._setCursor(this._activeBuffer.x+e,this._activeBuffer.y+t)}cursorUp(e){let t=this._activeBuffer.y-this._activeBuffer.scrollTop;return t>=0?this._moveCursor(0,-Math.min(t,e.params[0]||1)):this._moveCursor(0,-(e.params[0]||1)),!0}cursorDown(e){let t=this._activeBuffer.scrollBottom-this._activeBuffer.y;return t>=0?this._moveCursor(0,Math.min(t,e.params[0]||1)):this._moveCursor(0,e.params[0]||1),!0}cursorForward(e){return this._moveCursor(e.params[0]||1,0),!0}cursorBackward(e){return this._moveCursor(-(e.params[0]||1),0),!0}cursorNextLine(e){return this.cursorDown(e),this._activeBuffer.x=0,!0}cursorPrecedingLine(e){return this.cursorUp(e),this._activeBuffer.x=0,!0}cursorCharAbsolute(e){return this._setCursor((e.params[0]||1)-1,this._activeBuffer.y),!0}cursorPosition(e){return this._setCursor(e.length>=2?(e.params[1]||1)-1:0,(e.params[0]||1)-1),!0}charPosAbsolute(e){return this._setCursor((e.params[0]||1)-1,this._activeBuffer.y),!0}hPositionRelative(e){return this._moveCursor(e.params[0]||1,0),!0}linePosAbsolute(e){return this._setCursor(this._activeBuffer.x,(e.params[0]||1)-1),!0}vPositionRelative(e){return this._moveCursor(0,e.params[0]||1),!0}hVPosition(e){return this.cursorPosition(e),!0}tabClear(e){let t=e.params[0];return t===0?delete this._activeBuffer.tabs[this._activeBuffer.x]:t===3&&(this._activeBuffer.tabs={}),!0}cursorForwardTab(e){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let t=e.params[0]||1;for(;t--;)this._activeBuffer.x=this._activeBuffer.nextStop();return!0}cursorBackwardTab(e){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let t=e.params[0]||1;for(;t--;)this._activeBuffer.x=this._activeBuffer.prevStop();return!0}selectProtected(e){let t=e.params[0];return t===1&&(this._curAttrData.bg|=536870912),(t===2||t===0)&&(this._curAttrData.bg&=-536870913),!0}_eraseInBufferLine(e,t,n,r=!1,i=!1){let a=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);a.replaceCells(t,n,this._activeBuffer.getNullCell(this._eraseAttrData()),i),r&&(a.isWrapped=!1)}_resetBufferLine(e,t=!1){let n=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);n&&(n.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),t),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+e),n.isWrapped=!1)}eraseInDisplay(e,t=!1){this._restrictCursor(this._bufferService.cols);let n;switch(e.params[0]){case 0:for(n=this._activeBuffer.y,this._dirtyRowTracker.markDirty(n),this._eraseInBufferLine(n++,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,t);n<this._bufferService.rows;n++)this._resetBufferLine(n,t);this._dirtyRowTracker.markDirty(n);break;case 1:for(n=this._activeBuffer.y,this._dirtyRowTracker.markDirty(n),this._eraseInBufferLine(n,0,this._activeBuffer.x+1,!0,t),this._activeBuffer.x+1>=this._bufferService.cols&&(this._activeBuffer.lines.get(n+1).isWrapped=!1);n--;)this._resetBufferLine(n,t);this._dirtyRowTracker.markDirty(0);break;case 2:if(this._optionsService.rawOptions.scrollOnEraseInDisplay){for(n=this._bufferService.rows,this._dirtyRowTracker.markRangeDirty(0,n-1);n--&&!this._activeBuffer.lines.get(this._activeBuffer.ybase+n)?.getTrimmedLength(););for(;n>=0;n--)this._bufferService.scroll(this._eraseAttrData())}else{for(n=this._bufferService.rows,this._dirtyRowTracker.markDirty(n-1);n--;)this._resetBufferLine(n,t);this._dirtyRowTracker.markDirty(0)}break;case 3:let e=this._activeBuffer.lines.length-this._bufferService.rows;e>0&&(this._activeBuffer.lines.trimStart(e),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-e,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-e,0),this._onScroll.fire(0))}return!0}eraseInLine(e,t=!1){switch(this._restrictCursor(this._bufferService.cols),e.params[0]){case 0:this._eraseInBufferLine(this._activeBuffer.y,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,t);break;case 1:this._eraseInBufferLine(this._activeBuffer.y,0,this._activeBuffer.x+1,!1,t);break;case 2:this._eraseInBufferLine(this._activeBuffer.y,0,this._bufferService.cols,!0,t)}return this._dirtyRowTracker.markDirty(this._activeBuffer.y),!0}insertLines(e){this._restrictCursor();let t=e.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let n=this._activeBuffer.ybase+this._activeBuffer.y,r=this._bufferService.rows-1-this._activeBuffer.scrollBottom,i=this._bufferService.rows-1+this._activeBuffer.ybase-r+1;for(;t--;)this._activeBuffer.lines.splice(i-1,1),this._activeBuffer.lines.splice(n,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}deleteLines(e){this._restrictCursor();let t=e.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let n=this._activeBuffer.ybase+this._activeBuffer.y,r;for(r=this._bufferService.rows-1-this._activeBuffer.scrollBottom,r=this._bufferService.rows-1+this._activeBuffer.ybase-r;t--;)this._activeBuffer.lines.splice(n,1),this._activeBuffer.lines.splice(r,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}insertChars(e){this._restrictCursor();let t=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return t&&(t.insertCells(this._activeBuffer.x,e.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}deleteChars(e){this._restrictCursor();let t=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return t&&(t.deleteCells(this._activeBuffer.x,e.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}scrollUp(e){let t=e.params[0]||1;for(;t--;)this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollTop,1),this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollBottom,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollDown(e){let t=e.params[0]||1;for(;t--;)this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollBottom,1),this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollTop,0,this._activeBuffer.getBlankLine(TE));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=cD.extractWidth(t),i=this._activeBuffer.x-r,a=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).getString(i),o=new Uint32Array(a.length*n),s=0;for(let e=0;e<a.length;){let t=a.codePointAt(e)||0;o[s++]=t,e+=t>65535?2:1}let c=s;for(let e=1;e<n;++e)o.copyWithin(c,0,s),c+=s;return this.print(o,0,c),!0}sendDeviceAttributesPrimary(e){return e.params[0]>0||(this._is(`xterm`)||this._is(`rxvt-unicode`)||this._is(`screen`)?this._coreService.triggerDataEvent(Z.ESC+`[?1;2c`):this._is(`linux`)&&this._coreService.triggerDataEvent(Z.ESC+`[?6c`)),!0}sendDeviceAttributesSecondary(e){return e.params[0]>0||(this._is(`xterm`)?this._coreService.triggerDataEvent(Z.ESC+`[>0;276;0c`):this._is(`rxvt-unicode`)?this._coreService.triggerDataEvent(Z.ESC+`[>85;95;0c`):this._is(`linux`)?this._coreService.triggerDataEvent(e.params[0]+`c`):this._is(`screen`)&&this._coreService.triggerDataEvent(Z.ESC+`[>83;40003;0c`)),!0}_is(e){return(this._optionsService.rawOptions.termName+``).indexOf(e)===0}setMode(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 4:this._coreService.modes.insertMode=!0;break;case 20:this._optionsService.options.convertEol=!0;break}return!0}setModePrivate(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!0;break;case 2:this._charsetService.setgCharset(0,LE),this._charsetService.setgCharset(1,LE),this._charsetService.setgCharset(2,LE),this._charsetService.setgCharset(3,LE);break;case 3:this._optionsService.rawOptions.windowOptions.setWinLines&&(this._bufferService.resize(132,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!0,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!0;break;case 12:this._optionsService.options.cursorBlink=!0;break;case 45:this._coreService.decPrivateModes.reverseWraparound=!0;break;case 66:this._logService.debug(`Serial port requested application keypad.`),this._coreService.decPrivateModes.applicationKeypad=!0,this._onRequestSyncScrollBar.fire();break;case 9:this._coreMouseService.activeProtocol=`X10`;break;case 1e3:this._coreMouseService.activeProtocol=`VT200`;break;case 1002:this._coreMouseService.activeProtocol=`DRAG`;break;case 1003:this._coreMouseService.activeProtocol=`ANY`;break;case 1004:this._coreService.decPrivateModes.sendFocus=!0,this._onRequestSendFocus.fire();break;case 1005:this._logService.debug(`DECSET 1005 not supported (see #2507)`);break;case 1006:this._coreMouseService.activeEncoding=`SGR`;break;case 1015:this._logService.debug(`DECSET 1015 not supported (see #2507)`);break;case 1016:this._coreMouseService.activeEncoding=`SGR_PIXELS`;break;case 25:this._coreService.isCursorHidden=!1;break;case 1048:this.saveCursor();break;case 1049:this.saveCursor();case 47:case 1047:this._bufferService.buffers.activateAltBuffer(this._eraseAttrData()),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(void 0),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!0;break;case 2026:this._coreService.decPrivateModes.synchronizedOutput=!0;break}return!0}resetMode(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 4:this._coreService.modes.insertMode=!1;break;case 20:this._optionsService.options.convertEol=!1;break}return!0}resetModePrivate(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!1;break;case 3:this._optionsService.rawOptions.windowOptions.setWinLines&&(this._bufferService.resize(80,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!1,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!1;break;case 12:this._optionsService.options.cursorBlink=!1;break;case 45:this._coreService.decPrivateModes.reverseWraparound=!1;break;case 66:this._logService.debug(`Switching back to normal keypad.`),this._coreService.decPrivateModes.applicationKeypad=!1,this._onRequestSyncScrollBar.fire();break;case 9:case 1e3:case 1002:case 1003:this._coreMouseService.activeProtocol=`NONE`;break;case 1004:this._coreService.decPrivateModes.sendFocus=!1;break;case 1005:this._logService.debug(`DECRST 1005 not supported (see #2507)`);break;case 1006:this._coreMouseService.activeEncoding=`DEFAULT`;break;case 1015:this._logService.debug(`DECRST 1015 not supported (see #2507)`);break;case 1016:this._coreMouseService.activeEncoding=`DEFAULT`;break;case 25:this._coreService.isCursorHidden=!0;break;case 1048:this.restoreCursor();break;case 1049:case 47:case 1047:this._bufferService.buffers.activateNormalBuffer(),e.params[t]===1049&&this.restoreCursor(),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(void 0),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!1;break;case 2026:this._coreService.decPrivateModes.synchronizedOutput=!1,this._onRequestRefreshRows.fire(void 0);break}return!0}requestMode(e,t){let n;(e=>(e[e.NOT_RECOGNIZED=0]=`NOT_RECOGNIZED`,e[e.SET=1]=`SET`,e[e.RESET=2]=`RESET`,e[e.PERMANENTLY_SET=3]=`PERMANENTLY_SET`,e[e.PERMANENTLY_RESET=4]=`PERMANENTLY_RESET`))(n||={});let r=this._coreService.decPrivateModes,{activeProtocol:i,activeEncoding:a}=this._coreMouseService,o=this._coreService,{buffers:s,cols:c}=this._bufferService,{active:l,alt:u}=s,d=this._optionsService.rawOptions,f=(e,n)=>(o.triggerDataEvent(`${Z.ESC}[${t?``:`?`}${e};${n}$y`),!0),p=e=>e?1:2,m=e.params[0];return t?m===2?f(m,4):m===4?f(m,p(o.modes.insertMode)):m===12?f(m,3):m===20?f(m,p(d.convertEol)):f(m,0):m===1?f(m,p(r.applicationCursorKeys)):m===3?f(m,d.windowOptions.setWinLines?c===80?2:+(c===132):0):m===6?f(m,p(r.origin)):m===7?f(m,p(r.wraparound)):m===8?f(m,3):m===9?f(m,p(i===`X10`)):m===12?f(m,p(d.cursorBlink)):m===25?f(m,p(!o.isCursorHidden)):m===45?f(m,p(r.reverseWraparound)):m===66?f(m,p(r.applicationKeypad)):m===67?f(m,4):m===1e3?f(m,p(i===`VT200`)):m===1002?f(m,p(i===`DRAG`)):m===1003?f(m,p(i===`ANY`)):m===1004?f(m,p(r.sendFocus)):m===1005?f(m,4):m===1006?f(m,p(a===`SGR`)):m===1015?f(m,4):m===1016?f(m,p(a===`SGR_PIXELS`)):m===1048?f(m,1):m===47||m===1047||m===1049?f(m,p(l===u)):m===2004?f(m,p(r.bracketedPasteMode)):m===2026?f(m,p(r.synchronizedOutput)):f(m,0)}_updateAttrColor(e,t,n,r,i){return t===2?(e|=50331648,e&=-16777216,e|=Bb.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=TE.fg,e.bg=TE.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|=TE.fg&16777215):n===49?(r.bg&=-67108864,r.bg|=TE.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|=TE.fg&16777215,r.bg&=-67108864,r.bg|=TE.bg&16777215):this._logService.debug(`Unknown SGR attribute: %d.`,n);return!0}deviceStatus(e){switch(e.params[0]){case 5:this._coreService.triggerDataEvent(`${Z.ESC}[0n`);break;case 6:let e=this._activeBuffer.y+1,t=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${Z.ESC}[${e};${t}R`)}return!0}deviceStatusPrivate(e){if(e.params[0]===6){let e=this._activeBuffer.y+1,t=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${Z.ESC}[?${e};${t}R`)}return!0}softReset(e){return this._coreService.isCursorHidden=!1,this._onRequestSyncScrollBar.fire(),this._activeBuffer.scrollTop=0,this._activeBuffer.scrollBottom=this._bufferService.rows-1,this._curAttrData=TE.clone(),this._coreService.reset(),this._charsetService.reset(),this._activeBuffer.savedX=0,this._activeBuffer.savedY=this._activeBuffer.ybase,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,this._coreService.decPrivateModes.origin=!1,!0}setCursorStyle(e){let t=e.length===0?1:e.params[0];if(t===0)this._coreService.decPrivateModes.cursorStyle=void 0,this._coreService.decPrivateModes.cursorBlink=void 0;else{switch(t){case 1:case 2:this._coreService.decPrivateModes.cursorStyle=`block`;break;case 3:case 4:this._coreService.decPrivateModes.cursorStyle=`underline`;break;case 5:case 6:this._coreService.decPrivateModes.cursorStyle=`bar`}let e=t%2==1;this._coreService.decPrivateModes.cursorBlink=e}return!0}setScrollRegion(e){let t=e.params[0]||1,n;return(e.length<2||(n=e.params[1])>this._bufferService.rows||n===0)&&(n=this._bufferService.rows),n>t&&(this._activeBuffer.scrollTop=t-1,this._activeBuffer.scrollBottom=n-1,this._setCursor(0,0)),!0}windowOptions(e){if(!ND(e.params[0],this._optionsService.rawOptions.windowOptions))return!0;let t=e.length>1?e.params[1]:0;switch(e.params[0]){case 14:t!==2&&this._onRequestWindowsOptionsReport.fire(0);break;case 16:this._onRequestWindowsOptionsReport.fire(1);break;case 18:this._bufferService&&this._coreService.triggerDataEvent(`${Z.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);break;case 22:(t===0||t===2)&&(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>MD&&this._windowTitleStack.shift()),(t===0||t===1)&&(this._iconNameStack.push(this._iconName),this._iconNameStack.length>MD&&this._iconNameStack.shift());break;case 23:(t===0||t===2)&&this._windowTitleStack.length&&this.setTitle(this._windowTitleStack.pop()),(t===0||t===1)&&this._iconNameStack.length&&this.setIconName(this._iconNameStack.pop())}return!0}saveCursor(e){return this._activeBuffer.savedX=this._activeBuffer.x,this._activeBuffer.savedY=this._activeBuffer.ybase+this._activeBuffer.y,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,!0}restoreCursor(e){return this._activeBuffer.x=this._activeBuffer.savedX||0,this._activeBuffer.y=Math.max(this._activeBuffer.savedY-this._activeBuffer.ybase,0),this._curAttrData.fg=this._activeBuffer.savedCurAttrData.fg,this._curAttrData.bg=this._activeBuffer.savedCurAttrData.bg,this._charsetService.charset=this._savedCharset,this._activeBuffer.savedCharset&&(this._charsetService.charset=this._activeBuffer.savedCharset),this._restrictCursor(),!0}setTitle(e){return this._windowTitle=e,this._onTitleChange.fire(e),!0}setIconName(e){return this._iconName=e,!0}setOrReportIndexedColor(e){let t=[],n=e.split(`;`);for(;n.length>1;){let e=n.shift(),r=n.shift();if(/^\d+$/.exec(e)){let n=parseInt(e);if(RD(n)){if(r===`?`)t.push({type:0,index:n});else{let e=DD(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=DD(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]);RD(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,LE),!0}selectCharset(e){return e.length===2?(e[0]===`/`||this._charsetService.setgCharset(AD[e[0]],IE[e[1]]||LE),!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=TE.clone(),this._eraseAttrDataInternal=TE.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 Hb;e.content=4194373,e.fg=this._curAttrData.fg,e.bg=this._curAttrData.bg,this._setCursor(0,0);for(let t=0;t<this._bufferService.rows;++t){let n=this._activeBuffer.ybase+this._activeBuffer.y+t,r=this._activeBuffer.lines.get(n);r&&(r.fill(e),r.isWrapped=!1)}return this._dirtyRowTracker.markAllDirty(),this._setCursor(0,0),!0}requestStatusString(e,t){let n=e=>(this._coreService.triggerDataEvent(`${Z.ESC}${e}${Z.ESC}\\`),!0),r=this._bufferService.buffer,i=this._optionsService.rawOptions;return n(e===`"q`?`P1$r${+!!this._curAttrData.isProtected()}"q`:e===`"p`?`P1$r61;1"p`:e===`r`?`P1$r${r.scrollTop+1};${r.scrollBottom+1}r`:e===`m`?`P1$r0m`:e===` q`?`P1$r${{block:2,underline:4,bar:6}[i.cursorStyle]-+!!i.cursorBlink} q`:`P0$r`)}markRangeDirty(e,t){this._dirtyRowTracker.markRangeDirty(e,t)}},LD=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&&(FD=e,e=t,t=FD),e<this.start&&(this.start=e),t>this.end&&(this.end=t)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};LD=Sb([Y(0,Yb)],LD);function RD(e){return 0<=e&&e<256}var zD=5e7,BD=12,VD=50,HD=class extends Rx{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 X),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>zD)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>=BD?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>=BD)break}this._writeBuffer.length>this._bufferOffset?(this._bufferOffset>VD&&(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()}},UD=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)))}};UD=Sb([Y(0,Yb)],UD);var WD=!1,GD=class extends Rx{constructor(e){super(),this._windowsWrappingHeuristics=this._register(new zx),this._onBinary=this._register(new X),this.onBinary=this._onBinary.event,this._onData=this._register(new X),this.onData=this._onData.event,this._onLineFeed=this._register(new X),this.onLineFeed=this._onLineFeed.event,this._onResize=this._register(new X),this.onResize=this._onResize.event,this._onWriteParsed=this._register(new X),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this._register(new X),this._instantiationService=new vE,this.optionsService=this._register(new KE(e)),this._instantiationService.setService(tx,this.optionsService),this._bufferService=this._register(this._instantiationService.createInstance(UE)),this._instantiationService.setService(Yb,this._bufferService),this._logService=this._register(this._instantiationService.createInstance(xE)),this._instantiationService.setService(ex,this._logService),this.coreService=this._register(this._instantiationService.createInstance(ZE)),this._instantiationService.setService(Zb,this.coreService),this.coreMouseService=this._register(this._instantiationService.createInstance(nD)),this._instantiationService.setService(Xb,this.coreMouseService),this.unicodeService=this._register(this._instantiationService.createInstance(cD)),this._instantiationService.setService(rx,this.unicodeService),this._charsetService=this._instantiationService.createInstance(lD),this._instantiationService.setService(Qb,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(UD),this._instantiationService.setService(nx,this._oscLinkService),this._inputHandler=this._register(new ID(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService)),this._register(Kx.forward(this._inputHandler.onLineFeed,this._onLineFeed)),this._register(this._inputHandler),this._register(Kx.forward(this._bufferService.onResize,this._onResize)),this._register(Kx.forward(this.coreService.onData,this._onData)),this._register(Kx.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 HD((e,t)=>this._inputHandler.parse(e,t))),this._register(Kx.forward(this._writeBuffer.onWriteParsed,this._onWriteParsed))}get onScroll(){return this._onScrollApi||(this._onScrollApi=this._register(new X),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&&!WD&&(this._logService.warn(`writeSync is unreliable and will be removed soon.`),WD=!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,VE),t=Math.max(t,HE),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(uD.bind(null,this._bufferService))),e.push(this.registerCsiHandler({final:`H`},()=>(uD(this._bufferService),!1))),this._windowsWrappingHeuristics.value=Fx(()=>{for(let t of e)t.dispose()})}}},KD={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 qD(e,t,n,r){let i={type:0,cancel:!1,key:void 0},a=!!e.shiftKey|(e.altKey?2:0)|(e.ctrlKey?4:0)|(e.metaKey?8:0);switch(e.keyCode){case 0:e.key===`UIKeyInputUpArrow`?i.key=t?Z.ESC+`OA`:Z.ESC+`[A`:e.key===`UIKeyInputLeftArrow`?i.key=t?Z.ESC+`OD`:Z.ESC+`[D`:e.key===`UIKeyInputRightArrow`?i.key=t?Z.ESC+`OC`:Z.ESC+`[C`:e.key===`UIKeyInputDownArrow`&&(i.key=t?Z.ESC+`OB`:Z.ESC+`[B`);break;case 8:i.key=e.ctrlKey?`\b`:Z.DEL,e.altKey&&(i.key=Z.ESC+i.key);break;case 9:if(e.shiftKey){i.key=Z.ESC+`[Z`;break}i.key=Z.HT,i.cancel=!0;break;case 13:i.key=e.altKey?Z.ESC+Z.CR:Z.CR,i.cancel=!0;break;case 27:i.key=Z.ESC,e.altKey&&(i.key=Z.ESC+Z.ESC),i.cancel=!0;break;case 37:if(e.metaKey)break;i.key=a?Z.ESC+`[1;`+(a+1)+`D`:t?Z.ESC+`OD`:Z.ESC+`[D`;break;case 39:if(e.metaKey)break;i.key=a?Z.ESC+`[1;`+(a+1)+`C`:t?Z.ESC+`OC`:Z.ESC+`[C`;break;case 38:if(e.metaKey)break;i.key=a?Z.ESC+`[1;`+(a+1)+`A`:t?Z.ESC+`OA`:Z.ESC+`[A`;break;case 40:if(e.metaKey)break;i.key=a?Z.ESC+`[1;`+(a+1)+`B`:t?Z.ESC+`OB`:Z.ESC+`[B`;break;case 45:!e.shiftKey&&!e.ctrlKey&&(i.key=Z.ESC+`[2~`);break;case 46:i.key=a?Z.ESC+`[3;`+(a+1)+`~`:Z.ESC+`[3~`;break;case 36:i.key=a?Z.ESC+`[1;`+(a+1)+`H`:t?Z.ESC+`OH`:Z.ESC+`[H`;break;case 35:i.key=a?Z.ESC+`[1;`+(a+1)+`F`:t?Z.ESC+`OF`:Z.ESC+`[F`;break;case 33:e.shiftKey?i.type=2:i.key=e.ctrlKey?Z.ESC+`[5;`+(a+1)+`~`:Z.ESC+`[5~`;break;case 34:e.shiftKey?i.type=3:i.key=e.ctrlKey?Z.ESC+`[6;`+(a+1)+`~`:Z.ESC+`[6~`;break;case 112:i.key=a?Z.ESC+`[1;`+(a+1)+`P`:Z.ESC+`OP`;break;case 113:i.key=a?Z.ESC+`[1;`+(a+1)+`Q`:Z.ESC+`OQ`;break;case 114:i.key=a?Z.ESC+`[1;`+(a+1)+`R`:Z.ESC+`OR`;break;case 115:i.key=a?Z.ESC+`[1;`+(a+1)+`S`:Z.ESC+`OS`;break;case 116:i.key=a?Z.ESC+`[15;`+(a+1)+`~`:Z.ESC+`[15~`;break;case 117:i.key=a?Z.ESC+`[17;`+(a+1)+`~`:Z.ESC+`[17~`;break;case 118:i.key=a?Z.ESC+`[18;`+(a+1)+`~`:Z.ESC+`[18~`;break;case 119:i.key=a?Z.ESC+`[19;`+(a+1)+`~`:Z.ESC+`[19~`;break;case 120:i.key=a?Z.ESC+`[20;`+(a+1)+`~`:Z.ESC+`[20~`;break;case 121:i.key=a?Z.ESC+`[21;`+(a+1)+`~`:Z.ESC+`[21~`;break;case 122:i.key=a?Z.ESC+`[23;`+(a+1)+`~`:Z.ESC+`[23~`;break;case 123:i.key=a?Z.ESC+`[24;`+(a+1)+`~`:Z.ESC+`[24~`;break;default:if(e.ctrlKey&&!e.shiftKey&&!e.altKey&&!e.metaKey)e.keyCode>=65&&e.keyCode<=90?i.key=String.fromCharCode(e.keyCode-64):e.keyCode===32?i.key=Z.NUL:e.keyCode>=51&&e.keyCode<=55?i.key=String.fromCharCode(e.keyCode-51+27):e.keyCode===56?i.key=Z.DEL:e.keyCode===219?i.key=Z.ESC:e.keyCode===220?i.key=Z.FS:e.keyCode===221&&(i.key=Z.GS);else if((!n||r)&&e.altKey&&!e.metaKey){let t=KD[e.keyCode]?.[+!!e.shiftKey];if(t)i.key=Z.ESC+t;else if(e.keyCode>=65&&e.keyCode<=90){let t=e.ctrlKey?e.keyCode-64:e.keyCode+32,n=String.fromCharCode(t);e.shiftKey&&(n=n.toUpperCase()),i.key=Z.ESC+n}else if(e.keyCode===32)i.key=Z.ESC+(e.ctrlKey?Z.NUL:` `);else if(e.key===`Dead`&&e.code.startsWith(`Key`)){let t=e.code.slice(3,4);e.shiftKey||(t=t.toLowerCase()),i.key=Z.ESC+t,i.cancel=!0}}else n&&!e.altKey&&!e.ctrlKey&&!e.shiftKey&&e.metaKey?e.keyCode===65&&(i.type=1):e.key&&!e.ctrlKey&&!e.altKey&&!e.metaKey&&e.keyCode>=48&&e.key.length===1?i.key=e.key:e.key&&e.ctrlKey&&(e.key===`_`&&(i.key=Z.US),e.key===`@`&&(i.key=Z.NUL))}return i}var JD=0,YD=class{constructor(e){this._getKey=e,this._array=[],this._insertedValues=[],this._flushInsertedTask=new FT,this._isFlushingInserted=!1,this._deletedIndices=[],this._flushDeletedTask=new FT,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||(JD=this._search(t),JD===-1)||this._getKey(this._array[JD])!==t)return!1;do if(this._array[JD]===e)return this._deletedIndices.length===0&&this._flushDeletedTask.enqueue(()=>this._flushDeleted()),this._deletedIndices.push(JD),!0;while(++JD<this._array.length&&this._getKey(this._array[JD])===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&&(JD=this._search(e),!(JD<0||JD>=this._array.length)&&this._getKey(this._array[JD])===e))do yield this._array[JD];while(++JD<this._array.length&&this._getKey(this._array[JD])===e)}forEachByKey(e,t){if(this._flushCleanupInserted(),this._flushCleanupDeleted(),this._array.length!==0&&(JD=this._search(e),!(JD<0||JD>=this._array.length)&&this._getKey(this._array[JD])===e))do t(this._array[JD]);while(++JD<this._array.length&&this._getKey(this._array[JD])===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}},XD=0,ZD=0,QD=class extends Rx{constructor(){super(),this._decorations=new YD(e=>e?.marker.line),this._onDecorationRegistered=this._register(new X),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this._register(new X),this.onDecorationRemoved=this._onDecorationRemoved.event,this._register(Fx(()=>this.reset()))}get decorations(){return this._decorations.values()}registerDecoration(e){if(e.marker.isDisposed)return;let t=new $D(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=>{XD=t.options.x??0,ZD=XD+(t.options.width??1),e>=XD&&e<ZD&&(!n||(t.options.layer??`bottom`)===n)&&r(t)})}},$D=class extends Lx{constructor(e){super(),this.options=e,this.onRenderEmitter=this.add(new X),this.onRender=this.onRenderEmitter.event,this._onDispose=this.add(new X),this.onDispose=this._onDispose.event,this._cachedBg=null,this._cachedFg=null,this.marker=e.marker,this.options.overviewRulerOptions&&!this.options.overviewRulerOptions.position&&(this.options.overviewRulerOptions.position=`full`)}get backgroundColorRGB(){return this._cachedBg===null&&(this._cachedBg=this.options.backgroundColor?Iw.toColor(this.options.backgroundColor):void 0),this._cachedBg}get foregroundColorRGB(){return this._cachedFg===null&&(this._cachedFg=this.options.foregroundColor?Iw.toColor(this.options.foregroundColor):void 0),this._cachedFg}dispose(){this._onDispose.fire(),super.dispose()}},eO=1e3,tO=class{constructor(e,t=eO){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)}},nO=20,rO=class extends Rx{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 tO(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(`
|
|
66
|
-
`))),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(kC(i,`selectionchange`,()=>this._handleSelectionChange())),this._register(this._coreBrowserService.onDprChange(()=>this._refreshRowsDimensions())),this._refreshRowsDimensions(),this._refreshRows(),this._register(Fx(()=>{this._accessibilityContainer.remove(),this._rowElements.length=0}))}_handleTab(e){for(let t=0;t<e;t++)this._handleChar(` `)}_handleChar(e){this._liveRegionLineCount<nO+1&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==e&&(this._charsToAnnounce+=e):this._charsToAnnounce+=e,e===`
|
|
67
|
-
`&&(this._liveRegionLineCount++,this._liveRegionLineCount===nO+1&&(this._liveRegion.textContent+=Eb.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})`}};rO=Sb([Y(1,$b),Y(2,cx),Y(3,ux)],rO);var iO=class extends Rx{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 X),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this._register(new X),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this._register(Fx(()=>{Nx(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(kC(this._element,`mouseleave`,()=>{this._isMouseOut=!0,this._clearCurrentLink()})),this._register(kC(this._element,`mousemove`,this._handleMouseMove.bind(this))),this._register(kC(this._element,`mousedown`,this._handleMouseDown.bind(this))),this._register(kC(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&&aO(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,Nx(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}}};iO=Sb([Y(1,lx),Y(2,ux),Y(3,Yb),Y(4,mx)],iO);function aO(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 oO=class extends GD{constructor(e={}){super(e),this._linkifier=this._register(new zx),this.browser=vT,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this._register(new zx),this._onCursorMove=this._register(new X),this.onCursorMove=this._onCursorMove.event,this._onKey=this._register(new X),this.onKey=this._onKey.event,this._onRender=this._register(new X),this.onRender=this._onRender.event,this._onSelectionChange=this._register(new X),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this._register(new X),this.onTitleChange=this._onTitleChange.event,this._onBell=this._register(new X),this.onBell=this._onBell.event,this._onFocus=this._register(new X),this._onBlur=this._register(new X),this._onA11yCharEmitter=this._register(new X),this._onA11yTabEmitter=this._register(new X),this._onWillOpen=this._register(new X),this._setup(),this._decorationService=this._instantiationService.createInstance(QD),this._instantiationService.setService(ix,this._decorationService),this._linkProviderService=this._instantiationService.createInstance(pT),this._instantiationService.setService(mx,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(ax)),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(Kx.forward(this._inputHandler.onCursorMove,this._onCursorMove)),this._register(Kx.forward(this._inputHandler.onTitleChange,this._onTitleChange)),this._register(Kx.forward(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this._register(Kx.forward(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this._register(this._bufferService.onResize(e=>this._afterResize(e.cols,e.rows))),this._register(Fx(()=>{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=Fw.toColorRGB(e===`ansi`?this._themeService.colors.ansi[t.index]:this._themeService.colors[e]);this.coreService.triggerDataEvent(`${Z.ESC}]${n};${kD(r)}${Dw.ST}`);break;case 1:if(e===`ansi`)this._themeService.modifyColors(e=>e.ansi[t.index]=Pw.toColor(...t.color));else{let n=e;this._themeService.modifyColors(e=>e[n]=Pw.toColor(...t.color))}break;case 2:this._themeService.restoreColor(t.index)}}}_setup(){super._setup(),this._customKeyEventHandler=void 0}get buffer(){return this.buffers.active}focus(){this.textarea&&this.textarea.focus({preventScroll:!0})}_handleScreenReaderModeOptionChange(e){e?!this._accessibilityManager.value&&this._renderService&&(this._accessibilityManager.value=this._instantiationService.createInstance(rO,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(e){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(Z.ESC+`[I`),this.element.classList.add(`focus`),this._showCursor(),this._onFocus.fire()}blur(){return this.textarea?.blur()}_handleTextAreaBlur(){this.textarea.value=``,this.refresh(this.buffer.y,this.buffer.y),this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(Z.ESC+`[O`),this.element.classList.remove(`focus`),this._onBlur.fire()}_syncTextArea(){if(!this.textarea||!this.buffer.isCursorInViewport||this._compositionHelper.isComposing||!this._renderService)return;let e=this.buffer.ybase+this.buffer.y,t=this.buffer.lines.get(e);if(!t)return;let n=Math.min(this.buffer.x,this.cols-1),r=this._renderService.dimensions.css.cell.height,i=t.getWidth(n),a=this._renderService.dimensions.css.cell.width*i,o=this.buffer.y*this._renderService.dimensions.css.cell.height,s=n*this._renderService.dimensions.css.cell.width;this.textarea.style.left=s+`px`,this.textarea.style.top=o+`px`,this.textarea.style.width=a+`px`,this.textarea.style.height=r+`px`,this.textarea.style.lineHeight=r+`px`,this.textarea.style.zIndex=`-5`}_initGlobal(){this._bindKeys(),this._register(kC(this.element,`copy`,e=>{this.hasSelection()&&kb(e,this._selectionService)}));let e=e=>Ab(e,this.textarea,this.coreService,this.optionsService);this._register(kC(this.textarea,`paste`,e)),this._register(kC(this.element,`paste`,e)),ST?this._register(kC(this.element,`mousedown`,e=>{e.button===2&&Nb(e,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})):this._register(kC(this.element,`contextmenu`,e=>{Nb(e,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})),AT&&this._register(kC(this.element,`auxclick`,e=>{e.button===1&&Mb(e,this.textarea,this.screenElement)}))}_bindKeys(){this._register(kC(this.textarea,`keyup`,e=>this._keyUp(e),!0)),this._register(kC(this.textarea,`keydown`,e=>this._keyDown(e),!0)),this._register(kC(this.textarea,`keypress`,e=>this._keyPress(e),!0)),this._register(kC(this.textarea,`compositionstart`,()=>this._compositionHelper.compositionstart())),this._register(kC(this.textarea,`compositionupdate`,e=>this._compositionHelper.compositionupdate(e))),this._register(kC(this.textarea,`compositionend`,()=>this._compositionHelper.compositionend())),this._register(kC(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(kC(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`,wb.get()),jT||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(dT,this.textarea,e.ownerDocument.defaultView??window,this._document??typeof window<`u`?window.document:null)),this._instantiationService.setService(cx,this._coreBrowserService),this._register(kC(this.textarea,`focus`,e=>this._handleTextAreaFocus(e))),this._register(kC(this.textarea,`blur`,()=>this._handleTextAreaBlur())),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(sT,this._document,this._helperContainer),this._instantiationService.setService(sx,this._charSizeService),this._themeService=this._instantiationService.createInstance(hE),this._instantiationService.setService(px,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(Hw),this._instantiationService.setService(fx,this._characterJoinerService),this._renderService=this._register(this._instantiationService.createInstance(LT,this.rows,this.screenElement)),this._instantiationService.setService(ux,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(Ow,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseService=this._instantiationService.createInstance(gT),this._instantiationService.setService(lx,this._mouseService);let r=this._linkifier.value=this._register(this._instantiationService.createInstance(iO,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(yw,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(aE,this.element,this.screenElement,r)),this._instantiationService.setService(dx,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(Kx.any(this._onScroll.event,this._inputHandler.onScroll)(()=>{this._selectionService.refresh(),this._viewport?.queueSync()})),this._register(this._instantiationService.createInstance(bw,this.screenElement)),this._register(kC(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(rO,this)),this._register(this.optionsService.onSpecificOptionChange(`screenReaderMode`,e=>this._handleScreenReaderModeOptionChange(e))),this.options.overviewRuler.width&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(Tw,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange(`overviewRuler`,e=>{!this._overviewRulerRenderer&&e&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(Tw,this._viewportElement,this.screenElement)))}),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()}_createRenderer(){return this._instantiationService.createInstance(oT,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(kC(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(kC(t,`wheel`,t=>{if(!r.wheel){if(this._customWheelEventHandler&&this._customWheelEventHandler(t)===!1)return!1;if(!this.buffer.hasScrollback){if(t.deltaY===0)return!1;if(e.coreMouseService.consumeWheelEvent(t,e._renderService?.dimensions?.device?.cell?.height,e._coreBrowserService?.dpr)===0)return this.cancel(t,!0);let n=Z.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?`O`:`[`)+(t.deltaY<0?`A`:`B`);return this.coreService.triggerDataEvent(n,!0),this.cancel(t,!0)}}},{passive:!1}))}refresh(e,t){this._renderService?.refreshRows(e,t)}updateCursorStyle(e){this._selectionService?.shouldColumnSelect(e)?this.element.classList.add(`column-select`):this.element.classList.remove(`column-select`)}_showCursor(){this.coreService.isCursorInitialized||(this.coreService.isCursorInitialized=!0,this.refresh(this.buffer.y,this.buffer.y))}scrollLines(e,t){this._viewport?this._viewport.scrollLines(e):super.scrollLines(e,t),this.refresh(0,this.rows-1)}scrollPages(e){this.scrollLines(e*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(e){e&&this._viewport?this._viewport.scrollToLine(this.buffer.ybase,!0):this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(e){let t=e-this._bufferService.buffer.ydisp;t!==0&&this.scrollLines(t)}paste(e){jb(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=qD(e,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(e),n.type===3||n.type===2){let t=this.rows-1;return this.scrollLines(n.type===2?-t:t),this.cancel(e,!0)}if(n.type===1&&this.selectAll(),this._isThirdLevelShift(this.browser,e)||(n.cancel&&this.cancel(e,!0),!n.key)||e.key&&!e.ctrlKey&&!e.altKey&&!e.metaKey&&e.key.length===1&&e.key.charCodeAt(0)>=65&&e.key.charCodeAt(0)<=90)return!0;if(this._unprocessedDeadKey)return this._unprocessedDeadKey=!1,!0;if((n.key===Z.ETX||n.key===Z.CR)&&(this.textarea.value=``),this._onKey.fire({key:n.key,domEvent:e}),this._showCursor(),this.coreService.triggerDataEvent(n.key,!0),!this.optionsService.rawOptions.screenReaderMode||e.altKey||e.ctrlKey)return this.cancel(e,!0);this._keyDownHandled=!0}_isThirdLevelShift(e,t){let n=e.isMac&&!this.options.macOptionIsMeta&&t.altKey&&!t.ctrlKey&&!t.metaKey||e.isWindows&&t.altKey&&t.ctrlKey&&!t.metaKey||e.isWindows&&t.getModifierState(`AltGraph`);return t.type===`keypress`?n:n&&(!t.keyCode||t.keyCode>47)}_keyUp(e){this._keyDownSeen=!1,!(this._customKeyEventHandler&&this._customKeyEventHandler(e)===!1)&&(sO(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(TE));this._onScroll.fire({position:this.buffer.ydisp}),this.refresh(0,this.rows-1)}}reset(){this.options.rows=this.rows,this.options.cols=this.cols;let e=this._customKeyEventHandler;this._setup(),super.reset(),this._selectionService?.reset(),this._decorationService.reset(),this._customKeyEventHandler=e,this.refresh(0,this.rows-1)}clearTextureAtlas(){this._renderService?.clearTextureAtlas()}_reportFocus(){this.element?.classList.contains(`focus`)?this.coreService.triggerDataEvent(Z.ESC+`[I`):this.coreService.triggerDataEvent(Z.ESC+`[O`)}_reportWindowsOptions(e){if(this._renderService)switch(e){case 0:let e=this._renderService.dimensions.css.canvas.width.toFixed(0),t=this._renderService.dimensions.css.canvas.height.toFixed(0);this.coreService.triggerDataEvent(`${Z.ESC}[4;${t};${e}t`);break;case 1:let n=this._renderService.dimensions.css.cell.width.toFixed(0),r=this._renderService.dimensions.css.cell.height.toFixed(0);this.coreService.triggerDataEvent(`${Z.ESC}[6;${r};${n}t`);break}}cancel(e,t){if(!(!this.options.cancelEvents&&!t))return e.preventDefault(),e.stopPropagation(),!1}};function sO(e){return e.keyCode===16||e.keyCode===17||e.keyCode===18}var cO=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)}},lO=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 Hb)}translateToString(e,t,n){return this._line.translateToString(e,t,n)}},uO=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 lO(t)}getNullCell(){return new Hb}},dO=class extends Rx{constructor(e){super(),this._core=e,this._onBufferChange=this._register(new X),this.onBufferChange=this._onBufferChange.event,this._normal=new uO(this._core.buffers.normal,`normal`),this._alternate=new uO(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)}},fO=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)}},pO=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}},mO=[`cols`,`rows`],hO=0,gO=class extends Rx{constructor(e){super(),this._core=this._register(new oO(e)),this._addonManager=this._register(new cO),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(mO.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 fO(this._core),this._parser}get unicode(){return this._checkProposedApi(),new pO(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 dO(this._core)),this._buffer}get markers(){return this._checkProposedApi(),this._core.markers}get modes(){let e=this._core.coreService.decPrivateModes,t=`none`;switch(this._core.coreMouseService.activeProtocol){case`X10`:t=`x10`;break;case`VT200`:t=`vt200`;break;case`DRAG`:t=`drag`;break;case`ANY`:t=`any`}return{applicationCursorKeysMode:e.applicationCursorKeys,applicationKeypadMode:e.applicationKeypad,bracketedPasteMode:e.bracketedPasteMode,insertMode:this._core.coreService.modes.insertMode,mouseTrackingMode:t,originMode:e.origin,reverseWraparoundMode:e.reverseWraparound,sendFocusMode:e.sendFocus,synchronizedOutputMode:e.synchronizedOutput,wraparoundMode:e.wraparound}}get options(){return this._publicOptions}set options(e){for(let t in e)this._publicOptions[t]=e[t]}blur(){this._core.blur()}focus(){this._core.focus()}input(e,t=!0){this._core.input(e,t)}resize(e,t){this._verifyIntegers(e,t),this._core.resize(e,t)}open(e){this._core.open(e)}attachCustomKeyEventHandler(e){this._core.attachCustomKeyEventHandler(e)}attachCustomWheelEventHandler(e){this._core.attachCustomWheelEventHandler(e)}registerLinkProvider(e){return this._core.registerLinkProvider(e)}registerCharacterJoiner(e){return this._checkProposedApi(),this._core.registerCharacterJoiner(e)}deregisterCharacterJoiner(e){this._checkProposedApi(),this._core.deregisterCharacterJoiner(e)}registerMarker(e=0){return this._verifyIntegers(e),this._core.registerMarker(e)}registerDecoration(e){return this._checkProposedApi(),this._verifyPositiveIntegers(e.x??0,e.width??0,e.height??0),this._core.registerDecoration(e)}hasSelection(){return this._core.hasSelection()}select(e,t,n){this._verifyIntegers(e,t,n),this._core.select(e,t,n)}getSelection(){return this._core.getSelection()}getSelectionPosition(){return this._core.getSelectionPosition()}clearSelection(){this._core.clearSelection()}selectAll(){this._core.selectAll()}selectLines(e,t){this._verifyIntegers(e,t),this._core.selectLines(e,t)}dispose(){super.dispose()}scrollLines(e){this._verifyIntegers(e),this._core.scrollLines(e)}scrollPages(e){this._verifyIntegers(e),this._core.scrollPages(e)}scrollToTop(){this._core.scrollToTop()}scrollToBottom(){this._core.scrollToBottom()}scrollToLine(e){this._verifyIntegers(e),this._core.scrollToLine(e)}clear(){this._core.clear()}write(e,t){this._core.write(e,t)}writeln(e,t){this._core.write(e),this._core.write(`\r
|
|
68
|
-
`,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 wb.get()},set promptLabel(e){wb.set(e)},get tooMuchOutput(){return Eb.get()},set tooMuchOutput(e){Eb.set(e)}}}_verifyIntegers(...e){for(hO of e)if(hO===1/0||isNaN(hO)||hO%1!=0)throw Error(`This API only accepts integers`)}_verifyPositiveIntegers(...e){for(hO of e)if(hO&&(hO===1/0||isNaN(hO)||hO%1!=0||hO<0))throw Error(`This API only accepts positive integers`)}},_O=2,vO=1,yO=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(_O,Math.floor(u/e.css.cell.width)),rows:Math.max(vO,Math.floor(l/e.css.cell.height))}}},bO={background:`#101010`,foreground:`#e6e6e6`,cursor:`#9dbefe`,cursorAccent:`#101010`,selectionBackground:`rgba(157, 190, 254, 0.25)`,black:`#101010`,red:`#fc533a`,green:`#12c905`,yellow:`#fcd53a`,blue:`#9dbefe`,magenta:`#edb2f1`,cyan:`#94e2d5`,white:`#e6e6e6`,brightBlack:`#555555`,brightRed:`#ff8a77`,brightGreen:`#6bff5c`,brightYellow:`#ffe57a`,brightBlue:`#c6dcff`,brightMagenta:`#ffd3f8`,brightCyan:`#b9fff2`,brightWhite:`#ffffff`};function xO({ptyID:e,onClose:t,onError:n}){let r=(0,w.useRef)(null),i=(0,w.useRef)(null),a=(0,w.useRef)(null),o=(0,w.useRef)(null),s=(0,w.useRef)(e);s.current=e;let[c,l]=(0,w.useState)(!1),u=async()=>{if(!c){l(!0);try{await W.ptyDelete(e),a.current?.close()}catch(e){l(!1),n?.(e instanceof Error?e.message:String(e))}}};return(0,w.useEffect)(()=>{let e=r.current;if(!e)return;let c=new gO({fontFamily:`"JetBrainsMono Nerd Font Mono", monospace`,fontSize:13,lineHeight:1.3,cursorBlink:!0,theme:bO,scrollback:5e3}),l=new yO;c.loadAddon(l),c.open(e);try{l.fit()}catch{}i.current=c,o.current=l,c.focus();let u=()=>{try{l.fit()}catch{return}let e=c.cols>0&&c.rows>0?{cols:c.cols,rows:c.rows}:null;e&&W.ptyUpdate(s.current,{size:e}).catch(()=>{})},d=new ResizeObserver(u);d.observe(e);let f=null,p=!1,m=!1,h=async()=>{try{let e=await W.ptyConnectToken(s.current),r=`${location.protocol===`https:`?`wss`:`ws`}://${location.host}/api/pty/${s.current}/connect?ticket=${e.data.ticket}`;if(p)return;f=new WebSocket(r),a.current=f,f.onopen=()=>u(),f.onmessage=e=>{typeof e.data==`string`?c.write(e.data):e.data instanceof Blob?e.data.arrayBuffer().then(e=>g(new Uint8Array(e),c)):g(new Uint8Array(e.data),c)},f.onclose=()=>{p||t()},f.onerror=()=>{n?.(`Terminal connection lost`)}}catch(e){n?.(e instanceof Error?e.message:String(e))}},g=(e,t)=>{if(e[0]===0){let t=new TextDecoder().decode(e.subarray(1));try{typeof JSON.parse(t).cursor==`number`&&!m&&(m=!0,u())}catch{}return}t.write(new Uint8Array(e))},_=c.onData(e=>{a.current?.readyState===WebSocket.OPEN&&a.current.send(e)});return h(),()=>{p=!0,_.dispose(),d.disconnect(),a.current?.close(),c.dispose(),i.current=null}},[e]),(0,L.jsxs)(`div`,{className:`flex h-full flex-col`,children:[(0,L.jsxs)(`div`,{className:`flex items-center justify-between border-b border-border px-3 py-1.5`,children:[(0,L.jsx)(`span`,{className:`truncate font-mono text-xs text-[var(--text-weak)]`,children:e}),(0,L.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1`,children:[(0,L.jsxs)(H,{variant:`ghost`,size:`sm`,onClick:()=>void u(),disabled:c,title:`Kill process`,"aria-label":`Kill terminal`,className:`text-[color:var(--surface-critical-strong)]`,children:[(0,L.jsx)(tt,{}),`Kill`]}),(0,L.jsx)(H,{variant:`ghost`,size:`sm`,onClick:t,children:`Close`})]})]}),(0,L.jsx)(`div`,{ref:r,className:`min-h-0 flex-1 bg-[var(--background-base)] p-2`})]})}function SO({className:e,orientation:t=`horizontal`,...n}){return(0,L.jsx)(_m,{"data-slot":`tabs`,"data-orientation":t,className:B(`group/tabs flex gap-2 data-horizontal:flex-col`,e),...n})}var CO=Cm(`group/tabs-list inline-flex w-fit items-center justify-center rounded-lg p-[3px] text-muted-foreground group-data-horizontal/tabs:h-8 group-data-vertical/tabs:h-fit group-data-vertical/tabs:flex-col data-[variant=line]:rounded-none`,{variants:{variant:{default:`bg-muted`,line:`gap-1 bg-transparent`}},defaultVariants:{variant:`default`}});function wO({className:e,variant:t=`default`,...n}){return(0,L.jsx)(vm,{"data-slot":`tabs-list`,"data-variant":t,className:B(CO({variant:t}),e),...n})}function TO({className:e,...t}){return(0,L.jsx)(ym,{"data-slot":`tabs-trigger`,className:B(`relative inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center gap-1.5 rounded-md border border-transparent px-1.5 py-0.5 text-sm font-medium whitespace-nowrap text-foreground/60 transition-all group-data-vertical/tabs:w-full group-data-vertical/tabs:justify-start hover:text-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-1 focus-visible:outline-ring disabled:pointer-events-none disabled:opacity-50 has-data-[icon=inline-end]:pr-1 has-data-[icon=inline-start]:pl-1 dark:text-muted-foreground dark:hover:text-foreground group-data-[variant=default]/tabs-list:data-active:shadow-sm group-data-[variant=line]/tabs-list:data-active:shadow-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,`group-data-[variant=line]/tabs-list:bg-transparent group-data-[variant=line]/tabs-list:data-active:bg-transparent dark:group-data-[variant=line]/tabs-list:data-active:border-transparent dark:group-data-[variant=line]/tabs-list:data-active:bg-transparent`,`data-active:bg-background data-active:text-foreground dark:data-active:border-input dark:data-active:bg-input/30 dark:data-active:text-foreground`,`after:absolute after:bg-foreground after:opacity-0 after:transition-opacity group-data-horizontal/tabs:after:inset-x-0 group-data-horizontal/tabs:after:bottom-[-5px] group-data-horizontal/tabs:after:h-0.5 group-data-vertical/tabs:after:inset-y-0 group-data-vertical/tabs:after:-right-1 group-data-vertical/tabs:after:w-0.5 group-data-[variant=line]/tabs-list:data-active:after:opacity-100`,e),...t})}function EO({className:e,...t}){return(0,L.jsx)(bm,{"data-slot":`tabs-content`,className:B(`flex-1 text-sm outline-none`,e),...t})}var DO=12e4,OO={running:`blue`,exited:`green`,timeout:`amber`,killed:`red`};function kO(e){let t=e.time.completed??Date.now(),n=Math.max(0,Math.floor((t-e.time.started)/1e3));if(n<60)return`${n}s`;let r=Math.floor(n/60);return r<60?`${r}m ${n%60}s`:`${Math.floor(r/60)}h ${r%60}m`}function AO({trigger:e}){let[t,n]=(0,w.useState)(!1),[r,i]=(0,w.useState)(`shell`),a=J(e=>e.shellPanelTick);return(0,w.useEffect)(()=>{a>0&&n(!0)},[a]),(0,L.jsxs)(Tm,{open:t,onOpenChange:n,children:[e===void 0?(0,L.jsx)(Em,{asChild:!0,children:(0,L.jsxs)(H,{variant:`ghost`,size:`sm`,children:[(0,L.jsx)(nt,{}),`Shell`]})}):(0,L.jsx)(Em,{asChild:!0,children:e}),(0,L.jsxs)(Am,{className:`flex max-h-[85vh] flex-col gap-0 overflow-hidden p-0 sm:max-w-2xl md:max-w-3xl`,children:[(0,L.jsxs)(jm,{className:`border-b border-(--border-weak-base) px-4 py-3`,children:[(0,L.jsxs)(Nm,{className:`flex items-center gap-2`,children:[(0,L.jsx)(nt,{className:`size-4 text-(color:--text-interactive-base)`}),`Shell & Terminals`]}),(0,L.jsx)(Pm,{children:`Run shell commands and manage PTY sessions.`})]}),(0,L.jsxs)(SO,{value:r,onValueChange:i,className:`flex min-h-0 flex-1 flex-col`,children:[(0,L.jsxs)(wO,{variant:`line`,className:`mx-4 mt-3`,children:[(0,L.jsx)(TO,{value:`shell`,children:`Shell`}),(0,L.jsx)(TO,{value:`terminals`,children:`Terminals`})]}),(0,L.jsx)(EO,{value:`shell`,forceMount:!0,className:B(`min-h-0`,r!==`shell`&&`hidden`),children:(0,L.jsx)(jO,{active:r===`shell`})}),(0,L.jsx)(EO,{value:`terminals`,forceMount:!0,className:B(`min-h-0`,r!==`terminals`&&`hidden`),children:(0,L.jsx)(NO,{active:r===`terminals`})})]})]})]})}function jO({active:e}){let[t,n]=(0,w.useState)([]),[r,i]=(0,w.useState)(!0),[a,o]=(0,w.useState)(null),[s,c]=(0,w.useState)(``),[l,u]=(0,w.useState)(String(DO)),[d,f]=(0,w.useState)(!1),[p,m]=(0,w.useState)(null),[h,g]=(0,w.useState)({}),_=(0,w.useRef)({}),v=(0,w.useCallback)(async()=>{try{let e=await W.shellList();n(e.data),o(null)}catch(e){o(e instanceof Error?e.message:String(e))}finally{i(!1)}},[]);(0,w.useEffect)(()=>{if(e)return v(),Vh({name:`shell-panel-list`,minInterval:5e3,run:()=>v()})},[e,v]);let y=(0,w.useCallback)(async e=>{try{let t=(await W.shellOutput(e,{cursor:_.current[e]})).data,n=t.truncated||_.current[e]===void 0;g(r=>({...r,[e]:(n?``:r[e]??``)+t.output})),_.current[e]=t.cursor}catch{g(t=>({...t,[e]:(t[e]??``)+`
|
|
69
|
-
[output stream unavailable]`}))}},[]);(0,w.useEffect)(()=>{if(!e||!p)return;let n=t.find(e=>e.id===p);if(!(!n||n.status!==`running`))return Vh({name:`shell-panel-output`,minInterval:1200,run:()=>y(p)})},[e,p,t,y]);let b=async()=>{if(!(!s.trim()||d)){f(!0),o(null);try{let e=Number(l),t=await W.shellCreate({command:s.trim(),timeout:Number.isFinite(e)&&e>0?e:DO});c(``),await v(),m(t.data.id)}catch(e){o(e instanceof Error?e.message:String(e))}finally{f(!1)}}},x=async e=>{try{await W.shellDelete(e),g(t=>{let n={...t};return delete n[e],n}),delete _.current[e],p===e&&m(null),await v()}catch(e){o(e instanceof Error?e.message:String(e))}},S=async(e,t)=>{let n=Number(t);if(!(!Number.isFinite(n)||n<0))try{await W.shellTimeout(e,n),await v()}catch(e){o(e instanceof Error?e.message:String(e))}};return(0,L.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-3 p-4`,children:[(0,L.jsxs)(`div`,{className:`flex gap-2`,children:[(0,L.jsx)(Fm,{value:s,onChange:e=>c(e.target.value),onKeyDown:e=>{e.key===`Enter`&&b()},placeholder:`command to run`,className:`flex-1 font-mono text-xs`}),(0,L.jsx)(Fm,{value:l,onChange:e=>u(e.target.value),onKeyDown:e=>{e.key===`Enter`&&b()},placeholder:`timeout ms`,title:`Timeout in milliseconds`,className:`w-24 font-mono text-xs`}),(0,L.jsxs)(H,{onClick:()=>void b(),disabled:!s.trim()||d,children:[(0,L.jsx)(Ve,{}),`Run`]}),(0,L.jsx)(H,{variant:`ghost`,size:`icon`,title:`Refresh`,onClick:()=>void v(),children:(0,L.jsx)(qe,{})})]}),a&&(0,L.jsx)(`p`,{className:`text-xs text-(color:--surface-critical-strong)`,children:a}),(0,L.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-1 overflow-y-auto`,children:r?(0,L.jsxs)(`div`,{className:`flex items-center gap-2 px-1 py-2 text-xs text-(color:--text-weaker)`,children:[(0,L.jsx)(pb,{}),` Loading shells…`]}):t.length===0?(0,L.jsx)(`p`,{className:`px-1 py-2 text-xs text-(color:--text-weaker)`,children:`No shell sessions yet — run a command above.`}):t.map(e=>(0,L.jsx)(MO,{shell:e,expanded:p===e.id,output:h[e.id]??``,onToggle:()=>{m(t=>t===e.id?null:e.id),_.current[e.id]||y(e.id)},onKill:()=>void x(e.id),onSetTimeout:t=>void S(e.id,t)},e.id))})]})}function MO({shell:e,expanded:t,output:n,onToggle:r,onKill:i,onSetTimeout:a}){let[o,s]=(0,w.useState)(``),c=(0,w.useRef)(null);return(0,w.useEffect)(()=>{let e=c.current;e&&(e.scrollTop=e.scrollHeight)},[n]),(0,L.jsxs)(`div`,{className:`rounded-md border border-(--border-weak-base) bg-(--surface-base)`,children:[(0,L.jsxs)(`div`,{className:`flex cursor-pointer items-center gap-2 px-2.5 py-1.5 hover:bg-(--surface-base-hover)`,onClick:r,children:[t?(0,L.jsx)(ae,{className:`size-3.5 shrink-0 text-(color:--text-weaker)`}):(0,L.jsx)(F,{className:`size-3.5 shrink-0 text-(color:--text-weaker)`}),(0,L.jsx)(hb,{tone:OO[e.status],children:e.status}),(0,L.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-mono text-xs text-(color:--text-strong)`,children:e.command}),(0,L.jsx)(`span`,{className:`hidden max-w-40 truncate font-mono text-xs text-(color:--text-weaker) sm:inline`,children:e.cwd}),(0,L.jsxs)(`span`,{className:`shrink-0 text-xs text-(color:--text-weak)`,children:[_b(e.time.started),` · `,kO(e)]}),e.status===`running`&&(0,L.jsx)(H,{variant:`ghost`,size:`icon-xs`,title:`Kill`,"aria-label":`Kill`,onClick:e=>{e.stopPropagation(),i()},className:`text-(color:--surface-critical-strong)`,children:(0,L.jsx)(tt,{})})]}),t&&(0,L.jsxs)(`div`,{className:`flex flex-col gap-2 border-t border-(--border-weak-base) p-2.5`,children:[(0,L.jsx)(`pre`,{ref:c,className:B(`max-h-56 min-h-10 overflow-auto rounded-md border border-(--border-weak-base) bg-(--surface-inset-base) p-2 font-mono text-xs whitespace-pre-wrap text-(color:--text-base)`,!n&&`text-(color:--text-weaker)`),children:n||`No output yet…`}),(0,L.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,L.jsx)(rt,{className:`size-3.5 text-(color:--text-weaker)`}),(0,L.jsx)(Fm,{value:o,onChange:e=>s(e.target.value),onKeyDown:e=>{e.key===`Enter`&&(a(o),s(``))},placeholder:`set timeout (ms)`,className:`h-6 w-36 font-mono text-xs`}),(0,L.jsx)(H,{variant:`ghost`,size:`xs`,disabled:!o.trim(),onClick:()=>{a(o),s(``)},children:`Apply`})]})]})]})}function NO({active:e}){let[t,n]=(0,w.useState)([]),[r,i]=(0,w.useState)(!0),[a,o]=(0,w.useState)(null),[s,c]=(0,w.useState)(``),[l,u]=(0,w.useState)(``),[d,f]=(0,w.useState)(``),[p,m]=(0,w.useState)(!1),[h,g]=(0,w.useState)({}),[_,v]=(0,w.useState)(Date.now()),[y,b]=(0,w.useState)(null),x=(0,w.useCallback)(async()=>{try{let e=await W.ptyList();n(e.data),o(null)}catch(e){o(e instanceof Error?e.message:String(e))}finally{i(!1)}},[]);(0,w.useEffect)(()=>{if(e)return x(),Vh({name:`pty-panel-list`,minInterval:5e3,run:()=>{x(),v(Date.now())}})},[e,x]);let S=async()=>{if(!(!l.trim()||p)){m(!0),o(null);try{await W.ptyCreate({command:l.trim(),cwd:d.trim()||void 0,title:s.trim()||void 0}),c(``),u(``),f(``),await x()}catch(e){o(e instanceof Error?e.message:String(e))}finally{m(!1)}}},C=async e=>{try{await W.ptyDelete(e),g(t=>{let n={...t};return delete n[e],n}),await x()}catch(e){o(e instanceof Error?e.message:String(e))}},T=async e=>{try{let t=await W.ptyConnectToken(e);g(n=>({...n,[e]:{kind:`connected`,ticket:t.data.ticket,expiresAt:Date.now()+t.data.expires_in*1e3}})),o(null)}catch(t){g(n=>({...n,[e]:{kind:`error`,message:t instanceof Error?t.message:String(t)}}))}};return(0,L.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-3 p-4`,children:y?(0,L.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:(0,L.jsx)(xO,{ptyID:y,onClose:()=>b(null),onError:e=>o(e)})}):(0,L.jsxs)(L.Fragment,{children:[(0,L.jsxs)(`div`,{className:`flex gap-2`,children:[(0,L.jsx)(Fm,{value:s,onChange:e=>c(e.target.value),onKeyDown:e=>{e.key===`Enter`&&S()},placeholder:`title`,className:`w-28 text-xs`}),(0,L.jsx)(Fm,{value:l,onChange:e=>u(e.target.value),onKeyDown:e=>{e.key===`Enter`&&S()},placeholder:`command (e.g. bash)`,className:`flex-1 font-mono text-xs`}),(0,L.jsx)(Fm,{value:d,onChange:e=>f(e.target.value),onKeyDown:e=>{e.key===`Enter`&&S()},placeholder:`cwd (optional)`,className:`w-36 font-mono text-xs`}),(0,L.jsxs)(H,{onClick:()=>void S(),disabled:!l.trim()||p,children:[(0,L.jsx)(nt,{}),`Create`]}),(0,L.jsx)(H,{variant:`ghost`,size:`icon`,title:`Refresh`,onClick:()=>void x(),children:(0,L.jsx)(qe,{})})]}),a&&(0,L.jsx)(`p`,{className:`text-xs text-(color:--surface-critical-strong)`,children:a}),(0,L.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-1 overflow-y-auto`,children:r?(0,L.jsxs)(`div`,{className:`flex items-center gap-2 px-1 py-2 text-xs text-(color:--text-weaker)`,children:[(0,L.jsx)(pb,{}),` Loading terminals…`]}):t.length===0?(0,L.jsx)(`p`,{className:`px-1 py-2 text-xs text-(color:--text-weaker)`,children:`No PTY sessions yet — create one above.`}):t.map(e=>(0,L.jsx)(PO,{pty:e,connection:h[e.id],now:_,onConnect:()=>void T(e.id),onOpen:()=>b(e.id),onDelete:()=>void C(e.id)},e.id))}),(0,L.jsx)(vb,{className:`bg-(--border-weak-base)`}),(0,L.jsx)(`p`,{className:`text-xs text-(color:--text-weaker)`,children:`Live terminals stream over a websocket — open one to interact.`})]})})}function PO({pty:e,connection:t,now:n,onConnect:r,onOpen:i,onDelete:a}){let o=e.args.length>0?` ${e.args.join(` `)}`:``,s=t?.kind===`connected`?Math.max(0,Math.ceil((t.expiresAt-n)/1e3)):0;return(0,L.jsxs)(`div`,{className:`rounded-md border border-(--border-weak-base) bg-(--surface-base) px-2.5 py-2`,children:[(0,L.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,L.jsx)(hb,{tone:e.status===`running`?`blue`:`neutral`,children:e.status}),(0,L.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-xs text-(color:--text-strong)`,children:e.title||e.command}),(0,L.jsxs)(`span`,{className:`hidden shrink-0 text-xs text-(color:--text-weaker) md:inline`,children:[`pid `,e.pid,e.exitCode===void 0?``:` · exit ${e.exitCode}`]}),(0,L.jsxs)(H,{variant:`ghost`,size:`xs`,onClick:i,disabled:e.status!==`running`,children:[(0,L.jsx)(et,{}),`Open`]}),(0,L.jsxs)(H,{variant:`ghost`,size:`xs`,onClick:r,disabled:e.status!==`running`,children:[(0,L.jsx)(re,{}),`Connect`]}),(0,L.jsx)(H,{variant:`ghost`,size:`icon-xs`,title:e.status===`running`?`Kill`:`Delete`,"aria-label":e.status===`running`?`Kill terminal`:`Delete terminal record`,onClick:a,className:`text-(color:--surface-critical-strong)`,children:e.status===`running`?(0,L.jsx)(tt,{}):(0,L.jsx)(it,{})})]}),(0,L.jsxs)(`div`,{className:`mt-1 flex items-center gap-2 pl-5`,children:[(0,L.jsxs)(`span`,{className:`min-w-0 flex-1 truncate font-mono text-xs text-(color:--text-weak)`,children:[e.command,o,e.cwd?` — ${e.cwd}`:``]}),t?.kind===`connected`?(0,L.jsxs)(`span`,{className:`flex shrink-0 items-center gap-1.5 text-xs`,children:[(0,L.jsx)(He,{className:`size-3 text-(color:--surface-success-strong)`}),(0,L.jsx)(hb,{tone:`green`,children:`connected`}),(0,L.jsxs)(`span`,{className:`hidden font-mono text-(color:--text-weaker) sm:inline`,children:[t.ticket.slice(0,10),`… · `,s,`s`]})]}):t?.kind===`error`?(0,L.jsx)(`span`,{className:`max-w-56 shrink-0 truncate`,title:t.message,children:(0,L.jsx)(hb,{tone:`red`,children:t.message})}):(0,L.jsx)(`span`,{className:`shrink-0 text-xs text-(color:--text-weaker)`,children:`disconnected`})]})]})}var FO=`fixed top-1/2 left-1/2 z-50 flex w-full max-w-[calc(100%-2rem)] -translate-x-1/2 -translate-y-1/2 flex-col gap-2 rounded-lg border border-[var(--border-weak-base)] bg-[var(--surface-float-base)] p-4 text-sm text-popover-foreground duration-100 outline-none sm:max-w-lg data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95`,IO=`w-full rounded-md border border-[var(--border-base)] bg-[var(--input-base)] px-2.5 py-1.5 text-sm text-[var(--text-strong)] outline-none transition-colors placeholder:text-[var(--text-weaker)] focus:border-[var(--border-selected)]`,LO=`flex w-full cursor-pointer items-center gap-2 rounded-md px-2 py-1.5 text-left text-sm transition-colors text-[color:var(--text-base)] hover:bg-[color:var(--surface-base-hover)]`,RO=`flex w-full cursor-pointer items-center gap-2 rounded-md px-2 py-1.5 text-left text-sm transition-colors bg-[color:var(--surface-raised-base-active)] text-[color:var(--text-strong)]`;function zO(){return J(e=>e.splitPickerOpen)?(0,L.jsx)(BO,{}):null}function BO(){let e=J(e=>e.sessions),t=J(e=>e.panes),n=J(e=>e.running),r=J(e=>e.queued),i=J(e=>e.activeIDs),a=J(e=>e.currentSessionID&&!sg(e.currentSessionID)?e.sessions.find(t=>t.id===e.currentSessionID)??e.sessionDetails[e.currentSessionID]:void 0),[o,s]=(0,w.useState)(`sessions`),[c,l]=(0,w.useState)(``),[u,d]=(0,w.useState)(0),[f,p]=(0,w.useState)(null),[m,h]=(0,w.useState)([]),[g,_]=(0,w.useState)(!1),[v,y]=(0,w.useState)(null),[b,x]=(0,w.useState)(null),S=(0,w.useRef)(null),C=(0,w.useRef)(!1),T=(0,w.useMemo)(()=>new Set(t.map(e=>e.sessionID)),[t]),E=c.trim().toLowerCase(),D=(0,w.useMemo)(()=>e.filter(e=>!T.has(e.id)&&!e.parentID&&(!E||(e.title??``).toLowerCase().includes(E)||e.id.toLowerCase().includes(E)||e.location.directory.toLowerCase().includes(E))).sort((e,t)=>t.time.updated-e.time.updated),[e,T,E]),O=Math.min(u,Math.max(0,D.length-1));(0,w.useEffect)(()=>d(0),[E]);let k=a?.location?.directory;function ee(){s(`workspace`),x(null),!C.current&&(C.current=!0,_(!0),Promise.all([W.locationInfo(),W.projectList()]).then(([e,t])=>{p(e),h(t)}).catch(()=>x(`Could not load workspaces`)).finally(()=>_(!1)))}function A(){s(`sessions`),x(null)}function M(e){kv(e).then(e=>{e||x(`Already open in a pane, or no free slots`)})}async function te(e,t){if(!v){y(e),x(null);try{await kv(await Py(t))||x(`No free split slots`)}catch(e){x(e instanceof Error?e.message:String(e))}finally{y(null)}}}let ne=(0,w.useMemo)(()=>{let e=new Set;for(let t of m)t.directory&&e.add(t.directory);return[...e]},[m]);return(0,L.jsx)(Xo,{open:!0,onOpenChange:e=>{e||Ov()},children:(0,L.jsxs)(ns,{children:[(0,L.jsx)(is,{className:`bg-black/60`}),(0,L.jsxs)(cs,{tabIndex:-1,"data-slot":`dialog-content`,className:FO,"aria-describedby":void 0,onOpenAutoFocus:e=>{e.preventDefault(),S.current?.focus()},children:[(0,L.jsxs)(ps,{className:`flex items-center gap-2 text-[var(--font-size-large)] font-medium text-[var(--text-strong)]`,children:[(0,L.jsx)($e,{className:`size-4 shrink-0 text-[var(--text-interactive-base)]`,"aria-hidden":!0}),`Split view`,(0,L.jsx)(`span`,{className:`truncate text-xs font-normal text-[var(--text-weaker)]`,children:`open a session beside this one`})]}),o===`sessions`?(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(`input`,{ref:S,value:c,onChange:e=>l(e.target.value),onKeyDown:e=>{if(e.key===`ArrowDown`)e.preventDefault(),d(Math.min(O+1,D.length-1));else if(e.key===`ArrowUp`)e.preventDefault(),d(Math.max(O-1,0));else if(e.key===`Enter`){e.preventDefault();let t=D[O];t&&M(t.id)}},placeholder:`Filter sessions… (title, id, workspace)`,className:IO,autoComplete:`off`,spellCheck:!1}),(0,L.jsxs)(`button`,{type:`button`,onClick:ee,disabled:v!==null,className:`flex w-full cursor-pointer items-center gap-2 rounded-md border border-dashed border-[var(--border-weak-base)] px-2 py-1.5 text-left text-sm text-[var(--text-weak)] transition-colors hover:border-[var(--border-selected)] hover:text-[var(--text-strong)] disabled:pointer-events-none disabled:opacity-50`,children:[(0,L.jsx)(Ue,{className:`size-3.5 shrink-0`}),`Start new session`]}),(0,L.jsx)(`div`,{className:`-mx-1 max-h-72 overflow-y-auto px-1`,children:D.length===0?(0,L.jsx)(`p`,{className:`px-2 py-6 text-center text-xs text-[var(--text-weaker)]`,children:E?`No matching sessions`:`Every session is already in a pane`}):D.map((e,t)=>(0,L.jsx)(HO,{title:e.title||`session ${e.id.slice(0,8)}…`,dir:e.location.directory,at:e.time.updated,running:!!n[e.id]||!!r[e.id]||i.includes(e.id),highlighted:t===O,onHover:()=>d(t),onPick:()=>M(e.id)},e.id))})]}):(0,L.jsxs)(L.Fragment,{children:[(0,L.jsxs)(`button`,{type:`button`,onClick:A,className:`flex cursor-pointer items-center gap-1 self-start rounded-md px-1 py-0.5 text-xs text-[var(--text-weaker)] transition-colors hover:text-[var(--text-strong)]`,children:[(0,L.jsx)(j,{className:`size-3`}),` all sessions`]}),(0,L.jsx)(`div`,{className:`-mx-1 max-h-80 overflow-y-auto px-1`,children:g?(0,L.jsxs)(`div`,{className:`flex items-center gap-2 px-2 py-6 text-xs text-[var(--text-weaker)]`,children:[(0,L.jsx)(pb,{className:`size-3`}),` Loading workspaces…`]}):(0,L.jsxs)(`div`,{className:`flex flex-col gap-0.5`,children:[(0,L.jsx)(UO,{label:`Default workspace`,sub:f?.directory,busy:v==="default",disabled:v!==null,onChoose:()=>te(`default`,null)}),k&&a&&(0,L.jsx)(UO,{label:`same as ${a.title??`current session`}`,sub:k,busy:v===`focused`,disabled:v!==null,onChoose:()=>te(`focused`,k)}),ne.map(e=>(0,L.jsx)(UO,{label:VO(e),sub:e,busy:v===e,disabled:v!==null,onChoose:()=>te(e,e)},e)),ne.length===0&&!k&&(0,L.jsx)(`p`,{className:`px-2 py-4 text-center text-xs text-[var(--text-weaker)]`,children:`No workspaces`})]})})]}),b&&(0,L.jsx)(`p`,{className:`text-xs text-[var(--surface-critical-strong)]`,children:b}),(0,L.jsxs)(`p`,{className:`text-xs text-[var(--text-weaker)]`,children:[(0,L.jsx)(`span`,{className:`font-mono`,children:`↑↓`}),` select · `,(0,L.jsx)(`span`,{className:`font-mono`,children:`↵`}),` open ·`,` `,(0,L.jsx)(`span`,{className:`font-mono`,children:`esc`}),` close`]}),(0,L.jsx)(_s,{asChild:!0,children:(0,L.jsx)(`button`,{type:`button`,"aria-label":`Close`,className:`absolute top-2 right-2 flex size-7 cursor-pointer items-center justify-center rounded-md text-[var(--text-weaker)] transition-colors hover:bg-[color:var(--surface-base-hover)] hover:text-[var(--text-strong)]`,children:(0,L.jsx)(ot,{className:`size-4`})})})]})]})})}function VO(e){let t=e.split(`/`).filter(Boolean);return t.length>0?t[t.length-1]:e}function HO({title:e,dir:t,at:n,running:r,highlighted:i,onHover:a,onPick:o}){let s=(0,w.useRef)(null);return(0,w.useEffect)(()=>{i&&s.current?.scrollIntoView({block:`nearest`})},[i]),(0,L.jsxs)(`button`,{ref:s,type:`button`,onMouseMove:a,onClick:o,title:t,className:i?RO:LO,children:[(0,L.jsx)(`span`,{className:`size-1.5 shrink-0 rounded-full ${r?`animate-pulse bg-emerald-500`:`bg-[color:var(--border-base)]`}`}),(0,L.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e}),(0,L.jsx)(`span`,{className:`max-w-44 shrink-0 truncate font-mono text-[10px] text-[var(--text-weaker)]`,children:t}),r&&(0,L.jsx)(`span`,{className:`shrink-0 font-mono text-[10px] text-[var(--text-weaker)]`,children:`running`}),(0,L.jsx)(`span`,{className:`w-8 shrink-0 text-right font-mono text-[10px] text-[var(--text-weaker)]`,children:gb(n)})]})}function UO({label:e,sub:t,busy:n,disabled:r,onChoose:i}){return(0,L.jsxs)(`button`,{type:`button`,onClick:i,disabled:r,className:n?RO:LO,children:[n?(0,L.jsx)(pb,{className:`size-3.5 shrink-0`}):(0,L.jsx)(Ee,{className:`size-3.5 shrink-0 text-[var(--text-weaker)]`}),(0,L.jsx)(`span`,{className:`min-w-0 shrink truncate`,children:e}),t&&(0,L.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-mono text-[10px] text-[var(--text-weaker)]`,children:t})]})}var WO=`webui.activityStrip.collapsed`,GO=15e3;function KO(e){return e?e.replace(/\/+$/,``).replace(/^\/(home|Users)\/[^/]+/,`~`):``}function qO(e){let t=Math.max(0,Math.floor((Date.now()-e)/1e3));if(t<60)return`${t}s`;let n=Math.floor(t/60),r=t%60;return r?`${n}m ${r}s`:`${n}m`}function JO(e){let t=e.name||`tool`;if(e.status===`streaming`&&e.inputText){let n=e.inputText.replace(/\s+/g,` `).trim().slice(0,80);return n?`${t} ${n}…`:t}let n=e.input;if(n){if(typeof n.path==`string`)return`${t} ${String(n.path).split(`/`).pop()}`;if(typeof n.command==`string`)return`${t} ${String(n.command).slice(0,48)}`;if(typeof n.pattern==`string`)return`${t} "${String(n.pattern).slice(0,32)}"`;if(typeof n.description==`string`)return`${t} ${n.description.slice(0,40)}`;if(typeof n.agent==`string`&&typeof n.description==`string`)return`${t} ${String(n.agent)} — ${String(n.description).slice(0,24)}`}if(e.inputText){try{let n=JSON.parse(e.inputText);if(typeof n.path==`string`)return`${t} ${String(n.path).split(`/`).pop()}`;if(typeof n.command==`string`)return`${t} ${String(n.command).slice(0,48)}`}catch{}let n=e.inputText.replace(/\s+/g,` `).trim().slice(0,80);if(n&&n!==`{}`&&n!==`[]`)return`${t} ${n}`}return t}function YO(e){document.querySelectorAll(`link[rel="stylesheet"], style`).forEach(t=>{e.document.head.appendChild(t.cloneNode(!0))});try{document.adoptedStyleSheets?.length&&(e.document.adoptedStyleSheets=document.adoptedStyleSheets)}catch{}}function XO({tool:e}){let t=e.status===`running`||e.status===`streaming`,n=e.status===`error`,r=n?`✗`:t?`⠋`:e.name===`subagent`?`→`:e.name===`shell`||e.name===`bash`?`$`:e.name===`edit`?`←`:`·`;return(0,L.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1.5 truncate py-0.5 text-[11px] ${n?`text-[var(--surface-critical-strong)]`:t?`text-[var(--text-base)]`:`text-[var(--text-weak)]`}`,children:[(0,L.jsx)(`span`,{className:`w-3 shrink-0 text-center font-mono text-[10px] ${t?`animate-pulse`:``}`,children:t?`●`:r}),(0,L.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-mono`,children:JO(e)}),t&&(0,L.jsx)(`span`,{className:`size-1.5 shrink-0 animate-pulse rounded-full bg-emerald-500`,"aria-hidden":!0})]})}function ZO({assistants:e}){if(e.length===0)return(0,L.jsx)(`span`,{className:`text-[11px] italic text-[var(--text-weaker)]`,children:`waiting…`});let t=e.flatMap(e=>e.content),n=t.filter(e=>e.type===`reasoning`).slice(-1),r=t.filter(e=>e.type===`text`).slice(-2),i=t.filter(e=>e.type===`tool`).slice(-6),a=i.filter(e=>e.tool.status===`running`||e.tool.status===`streaming`),o=[...i.filter(e=>e.tool.status!==`running`&&e.tool.status!==`streaming`).slice(-3),...a];return(0,L.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-0.5`,children:[n.length>0&&(0,L.jsx)(`div`,{className:`line-clamp-1 truncate text-[11px] italic text-[var(--text-weaker)]`,children:(()=>{let e=n[0].text.replace(/\s+/g,` `).trim();return`thought: ${e.length>140?`…${e.slice(-140)}`:e}`})()}),r.map(e=>{let t=e.text.replace(/\s+/g,` `).trim();if(!t)return null;let n=t.length>220?`…${t.slice(-220)}`:t;return(0,L.jsx)(`div`,{className:`line-clamp-2 break-words text-xs leading-snug text-[var(--text-base)]`,children:n},`t-${e.ordinal}`)}),o.map(e=>(0,L.jsx)(XO,{tool:e.tool},e.tool.id)),t.length===0&&(0,L.jsx)(`span`,{className:`text-[11px] text-[var(--text-weaker)]`,children:`working…`})]})}function QO({session:e,assistants:t,running:n,queued:r,onOpen:i}){let[a,o]=(0,w.useState)(0);(0,w.useEffect)(()=>{if(n)return Vh({name:`activity-row-elapsed`,minInterval:1e3,run:()=>o(e=>e+1)})},[n]);let s=t[0]?.started??e.time?.updated??Date.now(),c=n?`running`:r?`queued`:`idle`;return(0,L.jsxs)(`div`,{className:`group flex min-w-0 flex-col gap-1 rounded-md border border-[var(--border-weak-base)] bg-[var(--surface-base)] px-2 py-1.5 hover:border-[var(--border-base)]`,children:[(0,L.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1.5`,children:[(0,L.jsx)(`span`,{className:`size-1.5 shrink-0 rounded-full ${c===`running`?`bg-emerald-500 animate-pulse`:c===`queued`?`bg-amber-500 animate-pulse`:`bg-[var(--border-base)]`}`,"aria-hidden":!0}),(0,L.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-xs font-medium text-[var(--text-strong)]`,title:e.title??e.id,children:e.title||`Untitled session`}),e.location?.directory&&(0,L.jsx)(`span`,{className:`hidden max-w-[14ch] truncate font-mono text-[10px] text-[var(--text-weaker)] sm:inline`,title:e.location.directory,children:KO(e.location.directory)}),(0,L.jsx)(`span`,{className:`shrink-0 font-mono text-[10px] text-[var(--text-weaker)]`,children:n?qO(s):r?`queued`:``}),(0,L.jsxs)(`button`,{type:`button`,onClick:()=>i(e.id),title:`Open session`,className:`inline-flex shrink-0 cursor-pointer items-center gap-1 rounded-md border border-transparent px-1 py-0.5 text-[11px] text-[var(--text-weaker)] hover:border-[var(--border-weak-base)] hover:text-[var(--text-strong)]`,children:[(0,L.jsx)(pe,{className:`size-3`}),` open`]})]}),(0,L.jsx)(`div`,{className:`min-w-0 pl-3`,children:(0,L.jsx)(ZO,{assistants:t})})]})}function $O({onOpen:e}){let t=J(e=>e.sessions),n=J(e=>e.running),r=J(e=>e.queued),i=J(e=>e.activeIDs),a=J(e=>e.live),o=(0,w.useMemo)(()=>{let e=new Map;for(let t of a){let n=e.get(t.sessionID)??[];n.push(t),e.set(t.sessionID,n)}for(let t of e.values())t.sort((e,t)=>e.started-t.started);return e},[a]),s=e=>n[e]||r[e]||(o.get(e)??[]).some(e=>e.finish===void 0)?!0:i.includes(e)&&Date.now()-kg(e)<GO,c=(0,w.useMemo)(()=>{let e=t.filter(e=>!e.parentID),r=[];for(let n of e){let e=fv(t,n.id).filter(e=>s(e.id)),i=s(n.id);(i||e.length>0)&&r.push({parent:n,parentLive:i,children:e})}let i=new Set(r.flatMap(e=>e.children.map(e=>e.id))),a=t.filter(e=>!!e.parentID&&s(e.id)&&!i.has(e.id));for(let e of a){let n=t.find(t=>t.id===e.parentID)??{id:e.parentID,title:`Parent`,time:{updated:0}};r.find(t=>t.parent.id===e.parentID)||r.push({parent:n,parentLive:!1,children:[e]})}return r.sort((e,t)=>{let r=e.parentLive&&n[e.parent.id]?1:+!!e.children.some(e=>!!n[e.id]),i=t.parentLive&&n[t.parent.id]?1:+!!t.children.some(e=>!!n[e.id]);return r===i?(t.parent.time?.updated??0)-(e.parent.time?.updated??0):i-r}),r},[t,n,r,i,a,o]);return c.length===0?(0,L.jsx)(`div`,{className:`px-3 py-2 text-xs text-[var(--text-weaker)]`,children:`No active agents.`}):(0,L.jsx)(`div`,{className:`flex flex-col gap-2`,children:c.map(t=>(0,L.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[t.parentLive?(0,L.jsx)(QO,{session:t.parent,assistants:o.get(t.parent.id)??[],running:!!n[t.parent.id],queued:!!r[t.parent.id],onOpen:e}):(0,L.jsxs)(`div`,{className:`flex items-center gap-1.5 px-1 text-[11px] font-medium text-[var(--text-weaker)]`,children:[(0,L.jsx)(`span`,{className:`truncate`,children:t.parent.title||KO(t.parent.location?.directory)||t.parent.id.slice(0,8)}),(0,L.jsxs)(`span`,{className:`font-mono text-[10px]`,children:[`· `,t.children.length,` subagent`,t.children.length===1?``:`s`]})]}),t.children.length>0&&(0,L.jsx)(`div`,{className:`ml-3 flex flex-col gap-1 border-l border-[var(--border-weak-base)] pl-2`,children:t.children.map(t=>(0,L.jsx)(QO,{session:t,assistants:o.get(t.id)??[],running:!!n[t.id],queued:!!r[t.id],onOpen:e},t.id))})]},t.parent.id))})}function ek(){let e=J(e=>e.running),t=J(e=>e.queued),n=J(e=>e.live),r=J(e=>e.activeIDs),[,i]=(0,w.useState)(0),a=(0,w.useMemo)(()=>{let e=new Map;for(let t of n){let n=e.get(t.sessionID)??[];n.push(t),e.set(t.sessionID,n)}return e},[n]),o=n=>e[n]||t[n]||(a.get(n)??[]).some(e=>e.finish===void 0)?!0:r.includes(n)&&Date.now()-kg(n)<GO,s=(0,w.useMemo)(()=>{let i=new Set([...Object.keys(e),...Object.keys(t),...r,...n.map(e=>e.sessionID)]);for(let e of i)if(o(e))return!0;return!1},[e,t,r,n,a]);(0,w.useEffect)(()=>{if(s)return Vh({name:`activity-strip-tick`,minInterval:1e3,run:()=>i(e=>e+1)})},[s]);let[c,l]=(0,w.useState)(()=>{try{return localStorage.getItem(WO)===`1`}catch{return!1}}),[u,d]=(0,w.useState)(null),[f,p]=(0,w.useState)(null),m=typeof window<`u`&&`documentPictureInPicture`in window;(0,w.useEffect)(()=>{try{localStorage.setItem(WO,c?`1`:`0`)}catch{}},[c]);let h=(0,w.useMemo)(()=>{let i=new Set([...Object.keys(e),...Object.keys(t),...r,...n.map(e=>e.sessionID)]),a=0;for(let e of i)o(e)&&a++;return a},[e,t,r,n,a]);if(!s)return null;let g=e=>void Mv(e),_=async()=>{if(u){u.close(),d(null),p(null);return}try{let e=await window.documentPictureInPicture.requestWindow({width:380,height:560});YO(e),e.document.body.style.margin=`0`,e.document.documentElement.style.background=`var(--background-base)`,e.document.body.style.background=`var(--background-base)`,e.document.body.style.fontFamily=getComputedStyle(document.body).fontFamily;let t=e.document.createElement(`div`);t.id=`activity-strip-pip-root`,t.style.height=`100vh`,t.style.overflow=`auto`,t.style.background=`var(--background-base)`,e.document.body.appendChild(t),p(t),d(e),e.addEventListener(`pagehide`,()=>{d(null),p(null)})}catch(e){console.warn(`PiP failed`,e)}};return(0,L.jsxs)(L.Fragment,{children:[(0,L.jsxs)(`div`,{className:`shrink-0 border-t border-[var(--border-base)] bg-[var(--background-base)]`,children:[(0,L.jsxs)(`div`,{className:`flex items-center justify-between gap-2 px-3 py-1.5`,children:[(0,L.jsxs)(`div`,{className:`flex items-center gap-1.5 text-xs font-medium text-[var(--text-strong)]`,children:[(0,L.jsx)(`span`,{className:`size-1.5 animate-pulse rounded-full bg-emerald-500`,"aria-hidden":!0}),h,` active`,(0,L.jsx)(`span`,{className:`font-normal text-[var(--text-weaker)]`,children:`· streaming`})]}),(0,L.jsxs)(`div`,{className:`flex items-center gap-1`,children:[m&&(0,L.jsxs)(`button`,{type:`button`,onClick:_,title:u?`Close picture-in-picture`:`Pop out — always on top outside Chrome`,className:`inline-flex cursor-pointer items-center gap-1 rounded-md border px-1.5 py-0.5 text-[11px] ${u?`border-[var(--border-selected)] bg-[var(--surface-interactive-weak)] text-[var(--text-interactive-base)]`:`border-[var(--border-weak-base)] text-[var(--text-weaker)] hover:text-[var(--text-strong)]`}`,children:[(0,L.jsx)(Be,{className:`size-3`}),` `,u?`popped`:`pop out`]}),(0,L.jsx)(`button`,{type:`button`,onClick:()=>l(e=>!e),title:c?`Expand`:`Collapse`,className:`flex size-6 cursor-pointer items-center justify-center rounded-md text-[var(--text-weaker)] hover:bg-[var(--surface-base-hover)] hover:text-[var(--text-strong)]`,children:c?(0,L.jsx)(ae,{className:`size-3.5`}):(0,L.jsx)(I,{className:`size-3.5`})})]})]}),c?null:(0,L.jsx)(`div`,{className:`max-h-[42vh] overflow-auto px-2 pb-2`,children:(0,L.jsx)($O,{onOpen:g})})]}),u&&f?(0,Dr.createPortal)((0,L.jsxs)(`div`,{className:`min-h-screen bg-[var(--background-base)] p-2`,children:[(0,L.jsxs)(`div`,{className:`mb-2 flex items-center justify-between`,children:[(0,L.jsxs)(`span`,{className:`text-xs font-medium text-[var(--text-strong)]`,children:[`Live — `,h,` active`]}),(0,L.jsx)(`button`,{type:`button`,onClick:_,className:`rounded-md border border-[var(--border-weak-base)] px-1.5 py-0.5 text-[11px] text-[var(--text-weaker)]`,children:`close`})]}),(0,L.jsx)($O,{onOpen:e=>{Mv(e);try{window.focus()}catch{}}})]}),f):null]})}function tk(e){let t=e.toLowerCase().split(`+`).map(e=>e.trim()).filter(Boolean),n=!1,r=!1,i=!1,a=!1,o=``;for(let e of t)e===`ctrl`||e===`control`?n=!0:e===`meta`||e===`cmd`||e===`command`||e===`super`?r=!0:e===`shift`?i=!0:e===`alt`||e===`option`?a=!0:o=e;return{ctrl:n,meta:r,shift:i,alt:a,key:o}}function nk(e,t){let n=tk(e);return!n.key||n.ctrl!==t.ctrlKey||n.meta!==t.metaKey||n.shift!==t.shiftKey||n.alt!==t.altKey?!1:t.key.toLowerCase()===n.key.toLowerCase()}function rk(e){let t=e;return t?t.isContentEditable||t.closest?.(`input, textarea, select, [contenteditable=true]`)?!0:t.tagName===`INPUT`||t.tagName===`TEXTAREA`||t.tagName===`SELECT`:!1}function ik(){return(0,w.useEffect)(()=>{let e=Tt(`palette`),t=mt(()=>{e=Tt(`palette`)}),n=t=>{if(!t.repeat&&!rk(t.target)&&!document.querySelector(`[role="dialog"], [cmdk-root], [data-radix-popper-content-wrapper], [role="menu"], [role="listbox"]`))for(let n of e){let e=n.item.keybind;if(e&&nk(e,t)){t.preventDefault();try{let e=mg().currentSessionID??void 0;n.item.run({sessionID:e})}catch(e){console.error(`[extensions] command "${n.id}" keybind failed:`,e)}break}}};return window.addEventListener(`keydown`,n),()=>{t(),window.removeEventListener(`keydown`,n)}},[]),null}var ak=[],ok=new Set,sk=0;function ck(){for(let e of ok)e()}function lk(e){return ok.add(e),()=>ok.delete(e)}function uk(){return ak}function dk(e){let t=ak.length;ak=ak.filter(t=>t.id!==e),ak.length!==t&&ck()}function fk(e){let t=`toast_${Date.now().toString(36)}_${++sk}`,n={id:t,title:e.title,description:e.description,variant:e.variant??`default`,created:Date.now()};return ak=[...ak,n],ck(),setTimeout(()=>dk(t),3e3),t}function pk(){let e=(0,w.useSyncExternalStore)(lk,uk,uk);return e.length===0?null:(0,L.jsx)(`div`,{className:`pointer-events-none fixed right-4 bottom-4 z-50 flex w-[min(22rem,calc(100vw-2rem))] flex-col gap-2`,children:e.map(e=>(0,L.jsxs)(`div`,{role:`status`,className:`pointer-events-auto flex flex-col gap-0.5 rounded-md border px-3 py-2.5 shadow-lg backdrop-blur-sm transition-all ${e.variant===`destructive`?`border-[color:var(--surface-critical-strong)] bg-[color-mix(in_oklch,var(--surface-critical-strong)_12%,var(--surface-float-base))] text-[var(--text-strong)]`:`border-[var(--border-weak-base)] bg-[var(--surface-float-base)] text-[var(--text-strong)]`}`,children:[(0,L.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[(0,L.jsx)(`span`,{className:`text-sm font-medium leading-tight`,children:e.title}),(0,L.jsx)(`button`,{type:`button`,onClick:()=>dk(e.id),className:`shrink-0 cursor-pointer text-[var(--text-weaker)] transition-colors hover:text-[var(--text-strong)]`,"aria-label":`Dismiss`,children:`✕`})]}),e.description?(0,L.jsx)(`span`,{className:`text-xs leading-snug text-[var(--text-weak)]`,children:e.description}):null]},e.id))})}function mk(e,t=`main`){let n=mg();if(n.currentSessionID&&rg(n).some(e=>e.req.sessionID===n.currentSessionID))return;av();let r=document.getElementById(`composer-input-${t}`);if(r){r.focus({preventScroll:!0});return}gk(e,t)}function hk(){let e=!1,t=null,n=e=>{let n=e.target;n?.id?.startsWith(`composer-input-`)&&(t=n)};document.addEventListener(`focusin`,n,!0);let r=e=>!!e&&(e.tagName===`TEXTAREA`||e.tagName===`INPUT`||e.isContentEditable),i=()=>{if(t&&document.contains(t))return t;let e=Nv(),n=document.getElementById(`composer-input-${e}`);if(n)return n;let r=document.getElementById(`composer-input-main`);if(r)return r;let i=document.querySelectorAll(`textarea[id^="composer-input-"]`);for(let e of i)if(e.offsetParent!==null)return e;return i[0]??null},a=t=>{if(e||r(t.target))return;if(document.querySelector(`[role="dialog"], [cmdk-root], [data-radix-popper-content-wrapper], [role="menu"]`)){let e=document.activeElement;if(e&&r(e))return}let n=i();if(!n)return;let a=t.clipboardData;if(!a)return;let o=a.files&&a.files.length>0,s=``;try{s=a.getData(`text/plain`)||``}catch{s=``}if(!(!o&&!s)){t.preventDefault(),e=!0;try{if(av(),n.focus({preventScroll:!0}),o)try{let e=new ClipboardEvent(`paste`,{bubbles:!0,cancelable:!0,clipboardData:a});n.dispatchEvent(e)}catch{}if(s){let e=n.value.length;n.setSelectionRange(e,e);let t=!1;try{t=document.execCommand(`insertText`,!1,s)}catch{t=!1}if(!t){let e=Object.getOwnPropertyDescriptor(HTMLTextAreaElement.prototype,`value`)?.set;if(e){e.call(n,n.value+s),n.dispatchEvent(new Event(`input`,{bubbles:!0}));let t=n.value.length;n.setSelectionRange(t,t)}}}}finally{setTimeout(()=>{e=!1},0)}}};return document.addEventListener(`paste`,a,!0),()=>{document.removeEventListener(`paste`,a,!0),document.removeEventListener(`focusin`,n,!0)}}function gk(e,t){let n=0,r=()=>{let i=document.getElementById(`composer-input-${t}`);if(!i){n++===2&&uv(),n<30&&requestAnimationFrame(r);return}i.focus({preventScroll:!0});let a=Object.getOwnPropertyDescriptor(HTMLTextAreaElement.prototype,`value`)?.set;if(a){a.call(i,i.value+e),i.dispatchEvent(new Event(`input`,{bubbles:!0}));let t=i.value.length;i.setSelectionRange(t,t)}};requestAnimationFrame(r)}var _k=/^\/ext\/([A-Za-z0-9_-]+)$/,vk=`webui:navigate`;function yk(){let[e,t]=(0,w.useState)(()=>window.location.pathname);return(0,w.useEffect)(()=>{let e=()=>t(window.location.pathname);return window.addEventListener(`popstate`,e),window.addEventListener(vk,e),()=>{window.removeEventListener(`popstate`,e),window.removeEventListener(vk,e)}},[]),e}function bk(){let e=J(e=>e.currentSessionID),t=J(e=>e.connected),n=J(e=>e.currentSessionID?e.sessions.find(t=>t.id===e.currentSessionID)??e.sessionDetails[e.currentSessionID]:void 0),r=J(e=>e.sessions),i=J(e=>e.runsPanelOpen),a=J(t=>pv(t,e)),o=J(e=>e.panes[0]?.sessionID??null),s=J(e=>e.panes.slice(1)),c=J(e=>e.focusedPane),l=yk(),u=_k.exec(l)?.[1]??null,d=(u?Tt(`pages`).find(e=>e.id===u):void 0)?.item.title;(0,w.useEffect)(()=>{if(d!==void 0){document.title=d;return}document.title=e?`${a?`● `:``}${sg(e)?`New session`:n?.title??`Untitled session`}`:`OpenCode Web`},[e,n?.title,a,d]);function f(){return!!document.querySelector(`[role="dialog"]`)||i}let p=e=>void Mv(e);function m(t){if(!e||!n?.parentID||f())return;let i=fv(r,n.parentID).slice().sort((e,t)=>e.id<t.id?-1:1);if(i.length===0)return;let a=i.findIndex(t=>t.id===e),o=(((a===-1?0:a)+t)%i.length+i.length)%i.length;p(i[o].id)}(0,w.useEffect)(()=>{let e=e=>{if(e.key.length!==1||e.metaKey)return;let t=e.ctrlKey&&e.altKey;if(e.ctrlKey&&!t||e.altKey&&!t)return;let n=e.target;n&&(n.isContentEditable||n.closest(`input, textarea, select, [contenteditable=true]`))||document.querySelector(`[role="dialog"], [cmdk-root], [data-radix-popper-content-wrapper], [role="menu"], [role="listbox"]`)||mk(e.key,Nv())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[]),(0,w.useEffect)(()=>hk(),[]);function h(){if(f())return;let e=document.getElementById(`session-search`);e&&(e.focus(),e.select())}nb({arrowup:()=>{!n?.parentID||!e||f()||p(n.parentID)},arrowdown:()=>{!e||f()||iv()},arrowleft:()=>m(-1),arrowright:()=>m(1),enter:()=>{!n?.parentID||!e||f()||uv()},backspace:()=>{if(!n?.parentID||!e||f())return;let t=document.getElementById(`composer-input-${Nv()}`);t&&t.value!==``||p(n.parentID)},"ctrl+n":()=>ky(null),"ctrl+\\":()=>Dv(),"meta+f":h,"ctrl+f":h,escape:e=>{let t=e?.target;document.querySelector(`[role="dialog"]`)||t&&(t.id.startsWith(`composer-input`)||t.closest(`[data-radix-popper-content-wrapper], [cmdk-root], [data-slot="command"]`))||xy()}});let g=e=>()=>void Ev(e);return(0,L.jsxs)(`div`,{className:`flex h-dvh flex-col overflow-hidden`,children:[(0,L.jsxs)(`div`,{className:`flex min-h-0 flex-1 overflow-hidden`,children:[(0,L.jsx)(wt,{id:`sidebar`}),(0,L.jsxs)(`div`,{className:`flex min-w-0 flex-1 overflow-hidden`,children:[(0,L.jsx)(`section`,{className:`flex min-w-0 flex-1 flex-col`,onPointerDownCapture:g(ag),onFocusCapture:g(ag),children:u?(0,L.jsx)(Ck,{id:u}):o?(0,L.jsx)(wt,{id:`conversation`,sessionID:o,paneKey:`main`,focused:c===ag,onNavigate:p},o):(0,L.jsx)(Sk,{connected:t})}),s.map(e=>(0,L.jsx)(`section`,{className:`pane-surface hidden min-w-0 border-l border-[var(--border-base)] lg:flex`,style:{flex:`1 1 0`,maxWidth:`50%`},onPointerDownCapture:g(e.id),onFocusCapture:g(e.id),children:e.sessionID?(0,L.jsx)(wt,{id:`conversation`,sessionID:e.sessionID,paneKey:e.id,focused:c===e.id,onClose:()=>void Av(e.id),onNavigate:p},`${e.id}:${e.sessionID}`):(0,L.jsx)(`div`,{className:`flex flex-1 items-center justify-center text-sm text-[var(--text-weaker)]`,children:`Empty pane`})},e.id)),(0,L.jsx)(`div`,{className:`hidden w-9 shrink-0 flex-col items-center border-l border-[var(--border-base)] pt-2 lg:flex`,children:(0,L.jsx)(`button`,{type:`button`,onClick:Dv,disabled:s.length>=3,title:`Split view — open a session beside this one`,className:`flex size-7 cursor-pointer items-center justify-center rounded-md text-[var(--text-weaker)] transition-colors hover:bg-[color:var(--surface-base-hover)] hover:text-[var(--text-strong)] disabled:pointer-events-none disabled:opacity-40`,children:(0,L.jsx)(ce,{className:`size-4`})})})]})]}),(0,L.jsx)(ek,{}),(0,L.jsx)(xk,{}),(0,L.jsx)(zO,{}),(0,L.jsx)(ob,{}),(0,L.jsx)(ik,{}),(0,L.jsx)(pk,{}),(0,L.jsx)(cb,{}),(0,L.jsx)(AO,{trigger:(0,L.jsx)(`span`,{className:`hidden`})})]})}function xk(){let e=J(e=>rg(e).filter(t=>t.req.sessionID!==e.currentSessionID)),t=e.map(e=>e.req.id).join(`,`);return(0,w.useEffect)(()=>{t&&G(`chip`,`foreign waiting: ${t}`)},[t]),e.length===0?null:(0,L.jsxs)(`button`,{type:`button`,onClick:()=>void vv(e[0].req.sessionID,{history:`push`}),title:e.map(e=>`${e.kind} — ${e.req.sessionID}`).join(`
|
|
70
|
-
`),className:`fixed right-4 bottom-10 z-40 flex items-center gap-1.5 rounded-full border border-[color-mix(in_oklch,var(--surface-warning-strong)_45%,transparent)] bg-[var(--surface-float-base)] px-2.5 py-1 text-xs text-[var(--text-weak)] shadow-md transition-colors hover:text-[var(--text-strong)]`,children:[(0,L.jsx)(`span`,{className:`size-1.5 animate-pulse rounded-full bg-[color:var(--surface-warning-strong)]`,"aria-hidden":!0}),e.length,` waiting in other session`,e.length>1?`s`:``,` — switch`]})}function Sk({connected:e}){return(0,L.jsxs)(`div`,{className:`flex flex-1 flex-col items-center justify-center gap-3 text-neutral-500`,children:[(0,L.jsx)(`div`,{className:`size-2.5 rounded-full ${e?`bg-emerald-500`:`bg-amber-500`}`}),(0,L.jsx)(`p`,{className:`text-sm`,children:e?`Select or create a session on the left`:`Connecting to the opencode service…`})]})}function Ck({id:e}){wk();let t=Tt(`pages`),n=t.find(t=>t.id===e);return(0,L.jsx)(`div`,{className:`pane-surface flex min-h-0 min-w-0 flex-1 flex-col overflow-y-auto`,children:(0,L.jsxs)(`div`,{className:`mx-auto w-full max-w-3xl px-6 py-6`,children:[(0,L.jsx)(`div`,{className:`flex items-start justify-between gap-4`,children:(0,L.jsxs)(`div`,{className:`min-w-0`,children:[(0,L.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,L.jsxs)(`button`,{type:`button`,onClick:()=>window.history.back(),title:`Go back`,className:`inline-flex cursor-pointer items-center gap-1 rounded-md border border-[var(--border-weak-base)] px-1.5 py-0.5 text-xs text-[var(--text-weak)] transition-colors hover:border-[var(--border-selected)] hover:text-[var(--text-strong)]`,children:[(0,L.jsx)(j,{className:`size-3`}),`Back`]}),(0,L.jsx)(`h1`,{className:`truncate text-[var(--font-size-large)] font-medium text-[var(--text-strong)]`,children:n?n.item.title:`Unknown extension page`})]}),n?.item.description&&(0,L.jsx)(`p`,{className:`mt-1 text-sm text-[var(--text-weaker)]`,children:n.item.description})]})}),(0,L.jsx)(`div`,{className:`mt-4`,children:n?n.item.render({}):(0,L.jsxs)(`div`,{className:`flex flex-col gap-2 text-sm text-[var(--text-weak)]`,children:[(0,L.jsxs)(`p`,{children:[`No extension registered “`,e,`”. Available pages:`]}),t.length===0?(0,L.jsx)(`p`,{className:`text-[var(--text-weaker)]`,children:`No extension pages are registered.`}):(0,L.jsx)(`ul`,{className:`flex flex-col gap-1`,children:t.map(e=>(0,L.jsx)(`li`,{children:(0,L.jsxs)(`a`,{href:`/ext/${e.id}`,title:e.item.description??e.item.title,className:`text-[var(--text-interactive-base)] underline underline-offset-2`,children:[`/ext/`,e.id,` — `,e.item.title]})},e.id))})]})})]})})}function wk(){let[e,t]=(0,w.useState)(0);return(0,w.useEffect)(()=>mt(()=>t(e=>e+1)),[]),[e]}var Tk=class extends w.Component{state={error:null};static getDerivedStateFromError(e){return{error:e}}componentDidCatch(e){console.error(`[app] render error:`,e)}render(){return this.state.error?(0,L.jsxs)(`div`,{className:`flex size-full flex-col items-center justify-center gap-3 bg-background p-6 text-center`,children:[(0,L.jsx)(`p`,{className:`text-sm text-foreground`,children:`The UI hit a render error.`}),(0,L.jsx)(`pre`,{className:`max-h-48 max-w-full overflow-auto rounded-md border border-border bg-muted p-3 font-mono text-xs whitespace-pre-wrap text-muted-foreground`,children:this.state.error.message}),(0,L.jsx)(`button`,{type:`button`,onClick:()=>this.setState({error:null}),className:`cursor-pointer rounded-md border border-border px-3 py-1.5 text-xs text-foreground transition-colors hover:bg-muted`,children:`Retry`})]}):this.props.children}},Ek=Object.assign({"./report/index.tsx":()=>Gh(()=>import(`./report-BVuI-XUQ.js`),[])});async function Dk(){let e=new Map(Object.entries({}).map(([e,t])=>[e,new Set(t)])),t=new Set;for(let n of Object.values(Ek)){let r=new Set(_t()),i;try{i=await n()}catch{continue}if(!i||typeof i.id!=`string`)continue;t.add(i.id);let a=_t(),o=e.get(i.id);o||(o=new Set,e.set(i.id,o));for(let e of a)r.has(e)||o.add(e)}let n=[...new Set([])].filter(e=>!t.has(e));if(n.length>0){let t=new Set;for(let r of n){let n=e.get(r);if(n&&n.size>0)for(let e of n)t.add(e);else t.add(r);e.delete(r)}gt([...t])}}Dk();var Ok=300,kk=4,Ak=40,jk=new Map;function Mk(e){switch(e.type){case`user`:case`system`:case`synthetic`:case`skill`:return e.text??``;case`shell`:return e.command??``;case`compaction`:return e.summary??``;case`assistant`:{let t=``;for(let n of e.content??[])n?.type===`text`&&(t+=n.text+`
|
|
71
|
-
`);return t}default:return``}}function Nk(e,t,n){let r=e.toLowerCase().indexOf(t);if(r===-1)return null;let i=Math.max(0,r-Ak),a=Math.min(e.length,r+n+Ak),o=e.slice(i,a).replace(/\s+/g,` `),s=o.toLowerCase().indexOf(t),c=s===-1?r-i:s,l=c+n;c<0&&(c=0),l>o.length&&(l=o.length);let u=i>0?`… `:``,d=a<e.length?` …`:``;return u&&(o=u+o,c+=u.length,l+=u.length),d&&(o+=d),{snippet:o,matchStart:c,matchEnd:l}}async function Pk(e){try{let t=(await W.messages(e,100)).data.map(e=>{let t=Mk(e);return t?{id:e.id,text:t,lower:t.toLowerCase()}:null}).filter(e=>!!e),n=t.map(e=>e.lower).join(`
|
|
72
|
-
`);jk.set(e,{messages:t,combinedLower:n})}catch{jk.set(e,{messages:[],combinedLower:``})}}function Fk(e){let t=new Map,n=e.length;for(let[r,i]of jk){if(!i.combinedLower.includes(e))continue;let a=[];for(let t of i.messages){if(!t.lower.includes(e))continue;let r=Nk(t.text,e,n);r&&a.push({messageID:t.id,snippet:r.snippet,matchStart:r.matchStart,matchEnd:r.matchEnd})}a.length>0&&t.set(r,a)}return t}function Ik(e,t,n){let r=e.trim().toLowerCase();if(!r)return Promise.resolve(new Map);let i=[...t].sort((e,t)=>t.time.updated-e.time.updated).slice(0,Ok).map(e=>e.id).filter(e=>!jk.has(e));return(async()=>{for(let e=0;e<i.length;e+=kk){let t=i.slice(e,e+kk);await Promise.all(t.map(Pk)),n?.(Fk(r))}return Fk(r)})()}var Lk=/mac|iphone|ipad|ipod/i.test(typeof navigator>`u`?``:navigator.userAgent),Rk=Lk?`⌘F`:`Ctrl F`;function zk({...e}){return(0,L.jsx)($d,{"data-slot":`context-menu`,...e})}function Bk({...e}){return(0,L.jsx)(ef,{"data-slot":`context-menu-trigger`,...e})}function Vk({className:e,...t}){return(0,L.jsx)(tf,{children:(0,L.jsx)(nf,{"data-slot":`context-menu-content`,className:B(`z-50 min-w-32 overflow-hidden rounded-lg bg-popover p-1 text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95`,e),...t})})}function Hk({className:e,inset:t,variant:n=`default`,...r}){return(0,L.jsx)(rf,{"data-slot":`context-menu-item`,"data-inset":t,"data-variant":n,className:B(`relative flex cursor-pointer items-center gap-1.5 rounded-md px-2 py-1.5 text-sm outline-none select-none focus:bg-accent focus:text-accent-foreground data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 dark:data-[variant=destructive]:focus:bg-destructive/20 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,e),...r})}function Uk({className:e,...t}){return(0,L.jsx)(af,{"data-slot":`context-menu-separator`,className:B(`-mx-1 my-1 h-px bg-border`,e),...t})}function Wk({className:e,children:t,...n}){return(0,L.jsxs)(Wp,{"data-slot":`scroll-area`,className:B(`relative`,e),...n,children:[(0,L.jsx)(Gp,{"data-slot":`scroll-area-viewport`,className:`size-full min-w-0 max-w-full overflow-x-hidden rounded-[inherit] transition-[color,box-shadow] outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-1`,children:t}),(0,L.jsx)(Gk,{}),(0,L.jsx)(Kp,{})]})}function Gk({className:e,orientation:t=`vertical`,...n}){return(0,L.jsx)(vp,{"data-slot":`scroll-area-scrollbar`,"data-orientation":t,orientation:t,className:B(`flex touch-none p-px transition-colors select-none data-horizontal:h-2.5 data-horizontal:flex-col data-horizontal:border-t data-horizontal:border-t-transparent data-vertical:h-full data-vertical:w-2.5 data-vertical:border-l data-vertical:border-l-transparent`,e),...n,children:(0,L.jsx)(kp,{"data-slot":`scroll-area-thumb`,className:`relative flex-1 rounded-full bg-border`})})}function Kk({className:e,...t}){return(0,L.jsx)(`div`,{"data-slot":`skeleton`,className:B(`animate-pulse rounded-md bg-muted`,e),...t})}function qk({...e}){return(0,L.jsx)(Xo,{"data-slot":`sheet`,...e})}function Jk({...e}){return(0,L.jsx)(ns,{"data-slot":`sheet-portal`,...e})}function Yk({className:e,...t}){return(0,L.jsx)(is,{"data-slot":`sheet-overlay`,className:B(`fixed inset-0 z-50 bg-black/10 duration-100 supports-backdrop-filter:backdrop-blur-xs data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0`,e),...t})}function Xk({className:e,children:t,side:n=`right`,showCloseButton:r=!0,...i}){return(0,L.jsxs)(Jk,{children:[(0,L.jsx)(Yk,{}),(0,L.jsxs)(cs,{"data-slot":`sheet-content`,"data-side":n,className:B(`fixed z-50 flex flex-col gap-4 bg-popover bg-clip-padding text-sm text-popover-foreground shadow-lg transition duration-200 ease-in-out data-[side=bottom]:inset-x-0 data-[side=bottom]:bottom-0 data-[side=bottom]:h-auto data-[side=bottom]:border-t data-[side=left]:inset-y-0 data-[side=left]:left-0 data-[side=left]:h-full data-[side=left]:w-3/4 data-[side=left]:border-r data-[side=right]:inset-y-0 data-[side=right]:right-0 data-[side=right]:h-full data-[side=right]:w-3/4 data-[side=right]:border-l data-[side=top]:inset-x-0 data-[side=top]:top-0 data-[side=top]:h-auto data-[side=top]:border-b data-[side=left]:sm:max-w-sm data-[side=right]:sm:max-w-sm data-open:animate-in data-open:fade-in-0 data-[side=bottom]:data-open:slide-in-from-bottom-10 data-[side=left]:data-open:slide-in-from-left-10 data-[side=right]:data-open:slide-in-from-right-10 data-[side=top]:data-open:slide-in-from-top-10 data-closed:animate-out data-closed:fade-out-0 data-[side=bottom]:data-closed:slide-out-to-bottom-10 data-[side=left]:data-closed:slide-out-to-left-10 data-[side=right]:data-closed:slide-out-to-right-10 data-[side=top]:data-closed:slide-out-to-top-10`,e),...i,children:[t,r&&(0,L.jsx)(_s,{"data-slot":`sheet-close`,asChild:!0,children:(0,L.jsxs)(H,{variant:`ghost`,className:`absolute top-3 right-3`,size:`icon-sm`,children:[(0,L.jsx)(ot,{}),(0,L.jsx)(`span`,{className:`sr-only`,children:`Close`})]})})]})]})}function Zk({className:e,...t}){return(0,L.jsx)(`div`,{"data-slot":`sheet-header`,className:B(`flex flex-col gap-0.5 p-4`,e),...t})}function Qk({className:e,...t}){return(0,L.jsx)(ps,{"data-slot":`sheet-title`,className:B(`font-heading text-base font-medium text-foreground`,e),...t})}function $k({className:e,...t}){return(0,L.jsx)(hs,{"data-slot":`sheet-description`,className:B(`text-sm text-muted-foreground`,e),...t})}var eA=/^@@ -(\d+)(?:,(\d+))? \+(\d+)(?:,(\d+))? @@/;function tA(e){let t=[],n=0,r=0;for(let i of e.split(`
|
|
73
|
-
`))if(!(i.startsWith(`Index: `)||i.startsWith(`=======`)||i.startsWith(`diff --git `))){if(i.startsWith(`+++ `)||i.startsWith(`--- `)){t.push({text:i,kind:`file`});continue}if(i.startsWith(`@@`)){let e=eA.exec(i);n=e?Number(e[1]):0,r=e?Number(e[3]):0,t.push({text:i,kind:`hunk`});continue}i.startsWith(`+`)?(t.push({text:i,kind:`add`,newNo:r}),r+=1):i.startsWith(`-`)?(t.push({text:i,kind:`delete`,oldNo:n}),n+=1):(t.push({text:i,kind:`context`,oldNo:n>0?n:void 0,newNo:r>0?r:void 0}),n>0&&(n+=1),r>0&&(r+=1))}return t}var nA={file:`bg-(--surface-diff-unchanged-base) text-(color:--text-strong)`,hunk:`bg-(--surface-diff-hidden-base) text-(color:--text-weak)`,add:`bg-(--surface-diff-add-weak) text-(color:--text-diff-add-base)`,delete:`bg-(--surface-diff-delete-weak) text-(color:--text-diff-delete-base)`,context:`bg-(--surface-diff-unchanged-base) text-(color:--text-base)`};function rA({diff:e,className:t}){let n=(0,w.useMemo)(()=>tA(e),[e]);return(0,L.jsx)(`div`,{className:B(`overflow-x-auto font-mono text-xs`,t),children:(0,L.jsx)(`div`,{className:`min-w-max`,children:n.map((e,t)=>(0,L.jsx)(iA,{row:e},t))})})}function iA({row:e}){let t=e.kind===`add`||e.kind===`delete`||e.kind===`context`;return(0,L.jsxs)(`div`,{className:B(`flex items-center whitespace-pre`,nA[e.kind]),children:[t&&(0,L.jsxs)(`span`,{className:`shrink-0 select-none pl-2 pr-1 text-right text-(color:--text-weaker)`,children:[(0,L.jsx)(`span`,{className:`inline-block w-9`,children:e.oldNo??``}),(0,L.jsx)(`span`,{className:`inline-block w-9`,children:e.newNo??``})]}),(0,L.jsx)(`span`,{className:B(`min-w-0`,t&&`pr-2`),children:e.text||` `})]})}var aA=e=>e.replace(/\/+$/,``),oA=e=>aA(e).split(`/`).filter(Boolean).pop()??e,sA=e=>e instanceof Error?e.message:String(e);function cA(e,t){let n=aA(e.replace(/^\.\//,``)),r=aA(t.replace(/^\.\//,``));return n===r||n.endsWith(`/${r}`)||r.endsWith(`/${n}`)}function lA(e){return[...e].sort((e,t)=>e.type===t.type?aA(e.path).localeCompare(aA(t.path)):e.type===`directory`?-1:1)}function uA(e){let t=e.includes(`.`)?(e.split(`.`).pop()??``).toLowerCase():``,n=`size-3.5 shrink-0 text-[var(--text-weaker)]`;return[`png`,`jpg`,`jpeg`,`gif`,`svg`,`webp`,`ico`,`avif`].includes(t)?(0,L.jsx)(be,{className:n}):[`json`,`jsonc`,`yaml`,`yml`,`toml`].includes(t)?(0,L.jsx)(_e,{className:n}):[`zip`,`tar`,`gz`,`tgz`,`bz2`,`xz`,`7z`].includes(t)?(0,L.jsx)(ge,{className:n}):[`txt`,`log`,`csv`,`tsv`,`ini`,`env`,`conf`,`lock`,`gitignore`].includes(t)?(0,L.jsx)(Se,{className:n}):`ts.tsx.js.jsx.mjs.cjs.go.rs.py.rb.java.c.h.hpp.cc.cpp.css.scss.html.vue.svelte.sh.bash.zsh.sql.graphql.gql.md.mdx.zig`.split(`.`).includes(t)?(0,L.jsx)(ye,{className:n}):(0,L.jsx)(Ce,{className:n})}function dA({entry:e,depth:t,nodes:n,selectedPath:r,onToggle:i,onOpen:a}){let o=e.type===`directory`,s=aA(e.path),c=n[s],l=oA(e.path),u=r===s,d=6+t*13,f=()=>o?i(e):a(e);return(0,L.jsxs)(`div`,{children:[(0,L.jsxs)(`div`,{role:`button`,tabIndex:0,onClick:f,onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),f())},className:B(`flex cursor-pointer items-center gap-1 rounded-sm py-[3px] pr-2`,u?`bg-[var(--surface-raised-base)] text-[var(--text-strong)]`:`text-[var(--text-base)] hover:bg-[var(--surface-base-hover)]`),style:{paddingLeft:d},children:[o?(0,L.jsx)(F,{className:B(`size-3 shrink-0 text-[var(--text-weaker)] transition-transform`,c?.expanded&&`rotate-90`)}):(0,L.jsx)(`span`,{className:`w-3 shrink-0`}),o?(0,L.jsx)(Ee,{className:B(`size-3.5 shrink-0`,c?.expanded?`text-[var(--text-interactive-base)]`:`text-[var(--text-weak)]`)}):uA(l),(0,L.jsx)(`span`,{className:B(`truncate font-mono text-xs`,o?`text-[var(--text-strong)]`:`text-[var(--text-base)]`),children:l}),c?.loading&&(0,L.jsx)(Me,{className:`ml-auto size-3 shrink-0 animate-spin text-[var(--text-weaker)]`}),c?.error&&(0,L.jsx)(`span`,{className:`ml-auto shrink-0 text-[10px] text-[var(--text-on-critical-base)]`,children:`!`})]}),o&&c?.expanded&&(0,L.jsx)(`div`,{children:c.loading?(0,L.jsxs)(`div`,{className:`space-y-1.5 py-1`,style:{paddingLeft:d+13},children:[(0,L.jsx)(Kk,{className:`h-3 w-3/4`}),(0,L.jsx)(Kk,{className:`h-3 w-1/2`})]}):c.error?(0,L.jsx)(`div`,{className:`py-1 text-[11px] text-[var(--text-on-critical-base)]`,style:{paddingLeft:d+13},children:c.error}):c.children&&c.children.length===0?(0,L.jsx)(`div`,{className:`py-0.5 text-[11px] italic text-[var(--text-weaker)]`,style:{paddingLeft:d+13},children:`empty`}):c.children?.map(e=>(0,L.jsx)(dA,{entry:e,depth:t+1,nodes:n,selectedPath:r,onToggle:i,onOpen:a},aA(e.path)))})]})}function fA({count:e,error:t}){return t?(0,L.jsx)(ub,{variant:`outline`,title:t,className:`border-border/50 text-[var(--text-weaker)]`,children:`vcs n/a`}):e===null?null:e===0?(0,L.jsx)(ub,{className:`border-transparent bg-[var(--surface-success-base)] text-[var(--text-on-success-base)]`,children:`clean`}):(0,L.jsxs)(ub,{className:`border-transparent bg-[var(--surface-critical-base)] text-[var(--text-on-critical-base)]`,children:[e,` changed`]})}function pA({open:e,onOpenChange:t}){let n=J(e=>e.sessions.find(t=>t.id===e.currentSessionID)?.location?.directory),[r,i]=(0,w.useState)(null),[a,o]=(0,w.useState)(null),[s,c]=(0,w.useState)(null),[l,u]=(0,w.useState)({}),[d,f]=(0,w.useState)(null),[p,m]=(0,w.useState)({loading:!1}),[h,g]=(0,w.useState)({loading:!1}),[_,v]=(0,w.useState)(null),[y,b]=(0,w.useState)(null),x=(0,w.useRef)(null),S=(0,w.useRef)(null);(0,w.useEffect)(()=>{if(!e)return;let t=!1,r=e=>{t||(S.current!==e&&(S.current=e,o(null),c(null),u({}),v(null),b(null),f(null),x.current=null),i(e),W.fsList({location:e}).then(e=>{t||(o(e.data),c(null))}).catch(e=>{t||c(sA(e))}),W.vcsStatus({directory:e}).then(e=>{t||v(e.data.length)}).catch(e=>{t||b(sA(e))}))};return n?r(n):W.location().then(e=>{t||r(e.directory)}).catch(e=>{t||c(sA(e))}),()=>{t=!0}},[e,n]),(0,w.useEffect)(()=>{e||(f(null),x.current=null,m({loading:!1}),g({loading:!1}))},[e]);let C=e=>{let t=aA(e.path),n=l[t];if(n?.expanded){u(e=>{let n={...e};return delete n[t],n});return}u(e=>({...e,[t]:{expanded:!0,loading:!e[t]?.children,children:e[t]?.children}})),n?.children||W.fsList({location:r??void 0,path:t}).then(e=>u(n=>n[t]?{...n,[t]:{...n[t],children:e.data,loading:!1}}:n)).catch(e=>u(n=>n[t]?{...n,[t]:{...n[t],error:sA(e),loading:!1}}:n))},T=e=>{x.current=e,f(e),m({loading:!0}),g({loading:!0}),W.fsRead(e.path,r??void 0).then(t=>{x.current?.path===e.path&&m({content:t,loading:!1})}).catch(t=>{x.current?.path===e.path&&m({error:sA(t),loading:!1})}),W.vcsBase(r?{directory:r}:void 0).then(e=>e.data).catch(()=>null).then(e=>W.vcsDiff(`working`,r?{directory:r}:void 0,3,e?.ref??null)).then(t=>{if(x.current?.path!==e.path)return;let n=t.data.find(t=>cA(t.file,e.path));g({patch:n?.patch,loading:!1})}).catch(t=>{x.current?.path===e.path&&g({error:sA(t),loading:!1})})};return(0,L.jsx)(qk,{open:e,onOpenChange:t,children:(0,L.jsxs)(Xk,{side:`left`,className:`w-[min(44rem,calc(100vw-0.5rem))]! gap-0 p-0 sm:max-w-[44rem]!`,children:[(0,L.jsxs)(Zk,{className:`border-b border-border px-4 py-3 pr-12`,children:[(0,L.jsxs)(Qk,{className:`flex items-center gap-2 text-sm`,children:[(0,L.jsx)(Te,{className:`size-4 text-[var(--text-weak)]`}),`Files`,(0,L.jsx)(fA,{count:_,error:y})]}),r&&(0,L.jsx)($k,{className:`truncate font-mono text-[11px] text-[var(--text-weaker)]`,children:r})]}),(0,L.jsxs)(`div`,{className:`flex min-h-0 flex-1`,children:[(0,L.jsx)(`div`,{className:`flex w-[40%] min-w-56 shrink-0 flex-col border-r border-border`,children:(0,L.jsx)(Wk,{className:`min-h-0 flex-1`,children:(0,L.jsx)(`div`,{className:`p-1.5`,children:s?(0,L.jsx)(`div`,{className:`px-2 py-3 text-xs text-[var(--text-on-critical-base)]`,children:s}):a===null?(0,L.jsx)(`div`,{className:`space-y-1.5 p-1`,children:[0,1,2,3,4].map(e=>(0,L.jsx)(Kk,{className:`h-4 w-full`},e))}):a.length===0?(0,L.jsx)(`div`,{className:`px-2 py-3 text-xs text-[var(--text-weak)]`,children:`Empty directory`}):lA(a).map(e=>(0,L.jsx)(dA,{entry:e,depth:0,nodes:l,selectedPath:d?aA(d.path):null,onToggle:C,onOpen:T},aA(e.path)))})})}),(0,L.jsx)(`div`,{className:`flex min-w-0 flex-1 flex-col`,children:d?(0,L.jsxs)(SO,{defaultValue:`preview`,className:`flex min-h-0 flex-1 flex-col`,children:[(0,L.jsxs)(`div`,{className:`flex items-center justify-between gap-2 border-b border-border px-3 py-1.5`,children:[(0,L.jsx)(`span`,{className:`truncate font-mono text-[11px] text-[var(--text-weak)]`,children:d.path}),(0,L.jsxs)(wO,{variant:`line`,className:`h-6 shrink-0`,children:[(0,L.jsx)(TO,{value:`preview`,className:`text-xs`,children:`Preview`}),(0,L.jsx)(TO,{value:`diff`,className:`text-xs`,children:`Diff`})]})]}),(0,L.jsx)(EO,{value:`preview`,className:`flex min-h-0 flex-1 flex-col`,children:p.loading?(0,L.jsxs)(`div`,{className:`space-y-1.5 p-3`,children:[(0,L.jsx)(Kk,{className:`h-3 w-3/4`}),(0,L.jsx)(Kk,{className:`h-3 w-2/3`}),(0,L.jsx)(Kk,{className:`h-3 w-5/6`}),(0,L.jsx)(Kk,{className:`h-3 w-1/2`})]}):p.error?(0,L.jsx)(`div`,{className:`p-4 text-xs text-[var(--text-on-critical-base)]`,children:p.error}):(0,L.jsx)(Wk,{className:`min-h-0 flex-1`,children:(0,L.jsx)(`pre`,{className:`p-3 font-mono text-xs leading-[1.6] whitespace-pre text-[var(--text-base)]`,children:p.content??``})})}),(0,L.jsx)(EO,{value:`diff`,className:`flex min-h-0 flex-1 flex-col`,children:h.loading?(0,L.jsxs)(`div`,{className:`space-y-1.5 p-3`,children:[(0,L.jsx)(Kk,{className:`h-3 w-11/12`}),(0,L.jsx)(Kk,{className:`h-3 w-3/4`}),(0,L.jsx)(Kk,{className:`h-3 w-2/3`}),(0,L.jsx)(Kk,{className:`h-3 w-5/6`})]}):h.error?(0,L.jsxs)(`div`,{className:`p-4 text-xs text-[var(--text-on-critical-base)]`,children:[`Diff unavailable: `,h.error]}):h.patch?(0,L.jsx)(Wk,{className:`min-h-0 flex-1`,children:(0,L.jsx)(rA,{diff:h.patch,className:`p-3`})}):(0,L.jsx)(`div`,{className:`p-4 text-xs text-[var(--text-weak)]`,children:`No uncommitted changes for this file.`})})]}):(0,L.jsx)(`div`,{className:`flex flex-1 items-center justify-center px-6 text-xs text-[var(--text-weak)]`,children:`Select a file to preview`})})]})]})})}var mA=`w-full rounded-md border border-[var(--border-weak-base)] bg-[var(--input-base)] px-2.5 py-1.5 text-sm text-[var(--text-strong)] outline-none transition-colors placeholder:text-[var(--text-weaker)] focus:border-[var(--border-selected)] focus:ring-1 focus:ring-[var(--border-selected)]`;function hA({title:e,note:t,onRefresh:n,loading:r}){return(0,L.jsxs)(`div`,{className:`mb-2 flex items-center justify-between gap-2`,children:[(0,L.jsxs)(`div`,{className:`flex min-w-0 items-baseline gap-2`,children:[(0,L.jsx)(`h3`,{className:`shrink-0 text-[13px] font-medium text-[var(--text-strong)]`,children:e}),t&&(0,L.jsx)(`span`,{className:`truncate text-[11px] text-[var(--text-weaker)]`,children:t})]}),n&&(0,L.jsx)(H,{variant:`ghost`,size:`icon-sm`,title:`Refresh`,disabled:r,onClick:n,children:(0,L.jsx)(Ke,{className:r?`animate-spin`:``})})]})}function gA({children:e}){return(0,L.jsx)(`p`,{className:`py-3 text-center text-xs text-[var(--text-weaker)]`,children:e})}function _A(e){let[t,n]=(0,w.useState)(null),[r,i]=(0,w.useState)(null),[a,o]=(0,w.useState)(!0),[s,c]=(0,w.useState)(0);return(0,w.useEffect)(()=>{let t=!1;return o(!0),i(null),e().then(e=>{t||n(e)}).catch(e=>{t||i(e instanceof Error?e.message:String(e))}).finally(()=>{t||o(!1)}),()=>{t=!0}},[s]),{data:t,error:r,loading:a,refresh:(0,w.useCallback)(()=>c(e=>e+1),[])}}function vA({message:e}){return(0,L.jsx)(`p`,{className:`rounded-md border border-[var(--surface-critical-base)] bg-[var(--surface-critical-weak)] px-2.5 py-1.5 text-xs text-[var(--surface-critical-strong)]`,children:e})}function yA({text:e}){let[t,n]=(0,w.useState)(!1);return(0,L.jsx)(H,{variant:`ghost`,size:`xs`,title:`Copy`,onClick:()=>{navigator.clipboard.writeText(e).then(()=>{n(!0),setTimeout(()=>n(!1),1200)})},children:t?`copied`:`copy`})}function bA(){let{data:e,error:t,loading:n,refresh:r}=_A(()=>W.configGet());return(0,L.jsxs)(`div`,{children:[(0,L.jsx)(hA,{title:`Configuration`,note:`Read-only — edit server-side in opencode.jsonc`,onRefresh:r,loading:n}),t&&(0,L.jsx)(vA,{message:t}),!t&&e&&e.length===0&&(0,L.jsx)(gA,{children:`No configuration found.`}),(0,L.jsx)(`div`,{className:`space-y-2`,children:e?.map((e,t)=>(0,L.jsx)(xA,{entry:e},t))})]})}function xA({entry:e}){return(0,L.jsxs)(`div`,{className:`rounded-md border border-[var(--border-weak-base)] bg-[var(--surface-raised-base)] p-2.5`,children:[(0,L.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,L.jsx)(hb,{tone:e.type===`document`?`blue`:`neutral`,children:e.type}),e.path&&(0,L.jsx)(`span`,{className:`min-w-0 truncate font-mono text-[11px] text-[var(--text-weak)]`,children:e.path})]}),e.type===`document`&&(0,L.jsx)(`pre`,{className:`max-h-56 overflow-auto rounded-md border border-[var(--border-weak-base)] bg-[var(--surface-inset-base)] p-2.5 font-mono text-[11px] leading-relaxed whitespace-pre-wrap break-all text-[var(--text-base)] mt-2 max-h-72`,children:JSON.stringify(e.info,null,2)})]})}var SA=e=>e instanceof Error?e.message:String(e),CA=`fixed top-1/2 left-1/2 z-50 grid w-full max-w-[calc(100%-2rem)] -translate-x-1/2 -translate-y-1/2 gap-3 rounded-lg border border-[var(--border-weak-base)] bg-[var(--surface-float-base)] p-4 text-sm text-popover-foreground duration-100 outline-none sm:max-w-md data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95`;function wA(e,t,n,r){let[i,a]=(0,w.useState)({kind:`idle`}),o=i.kind===`active`?i.attemptID:null,s=i.kind===`active`?i.status:null;return(0,w.useEffect)(()=>{if(!e){a({kind:`idle`});return}let n=!1;return a({kind:`starting`}),t(e).then(e=>{n||a({kind:`active`,attemptID:e.attemptID,url:e.url,instructions:e.instructions,status:`pending`})}).catch(e=>a({kind:`starting`,error:e instanceof Error?e.message:String(e)})),()=>{n=!0}},[e?.integrationID,e?.methodID]),(0,w.useEffect)(()=>{if(!e||!o||s!==`pending`)return;let t=async()=>{try{let t=await n(e,o);a(e=>e.kind===`active`?{...e,status:t.status,message:t.message}:e),t.status===`complete`&&r()}catch{}};return Vh({name:`integration-attempt`,minInterval:2e3,run:()=>t()})},[e?.integrationID,e?.methodID,o,s]),i}function TA({state:e,onCancel:t,label:n}){return e.kind===`idle`?null:e.kind===`starting`?(0,L.jsxs)(`div`,{className:`space-y-2 rounded-md border border-[var(--border-weak-base)] bg-[var(--surface-base)] p-2.5`,children:[e.error?(0,L.jsx)(vA,{message:e.error}):(0,L.jsxs)(`div`,{className:`flex items-center gap-2 text-xs text-[var(--text-base)]`,children:[(0,L.jsx)(Me,{className:`size-3.5 animate-spin`}),` starting `,n,`…`]}),(0,L.jsx)(H,{variant:`ghost`,size:`xs`,onClick:t,children:`cancel`})]}):(0,L.jsxs)(`div`,{className:`space-y-2 rounded-md border border-[var(--border-weak-base)] bg-[var(--surface-base)] p-2.5`,children:[(0,L.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,L.jsxs)(`span`,{className:`text-xs text-[var(--text-base)]`,children:[n,` attempt`]}),(0,L.jsx)(hb,{tone:e.status===`complete`?`green`:e.status===`pending`?`amber`:`red`,children:e.status})]}),e.url&&(0,L.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,L.jsx)(`a`,{className:`min-w-0 truncate text-xs text-[var(--text-interactive-base)] underline underline-offset-2`,href:e.url,target:`_blank`,rel:`noreferrer`,children:e.url}),(0,L.jsx)(pe,{className:`size-3 shrink-0 text-[var(--text-weaker)]`}),(0,L.jsx)(yA,{text:e.url})]}),e.instructions&&(0,L.jsx)(`p`,{className:`text-xs text-[var(--text-weak)]`,children:e.instructions}),e.message&&(0,L.jsx)(`p`,{className:`text-xs text-[var(--text-weak)]`,children:e.message}),e.status===`pending`&&(0,L.jsx)(H,{variant:`ghost`,size:`xs`,onClick:t,children:`cancel`})]})}function EA({integration:e,method:t,open:n,onClose:r,onDone:i}){let[a,o]=(0,w.useState)(``),[s,c]=(0,w.useState)(``),[l,u]=(0,w.useState)(!1),[d,f]=(0,w.useState)(null);return(0,L.jsx)(Tm,{open:n,onOpenChange:e=>!e&&r(),children:(0,L.jsxs)(Dm,{children:[(0,L.jsx)(km,{className:`bg-black/60`}),(0,L.jsxs)(cs,{"data-slot":`dialog-content`,className:CA,children:[(0,L.jsxs)(jm,{children:[(0,L.jsxs)(Nm,{children:[e.name,` · API key`]}),(0,L.jsx)(`p`,{className:`text-xs text-[var(--text-weaker)]`,children:t.label??`Connect with an API key for ${e.id}`})]}),(0,L.jsxs)(`div`,{className:`space-y-2`,children:[(0,L.jsx)(`input`,{className:mA,placeholder:`API key`,type:`password`,autoComplete:`off`,value:a,onChange:e=>o(e.target.value)}),(0,L.jsx)(`input`,{className:mA,placeholder:`Label (optional)`,value:s,onChange:e=>c(e.target.value)}),d&&(0,L.jsx)(vA,{message:d})]}),(0,L.jsxs)(Mm,{className:`rounded-b-lg`,children:[(0,L.jsx)(H,{variant:`ghost`,onClick:r,disabled:l,children:`Cancel`}),(0,L.jsx)(H,{disabled:a.trim().length===0||l,onClick:()=>{u(!0),f(null),W.integrationConnectKey(e.id,{key:a.trim(),label:s.trim()||null}).then(()=>{r(),i()}).catch(e=>f(e instanceof Error?e.message:String(e))).finally(()=>u(!1))},children:l?`Connecting…`:`Connect`})]}),(0,L.jsx)(Om,{asChild:!0,children:(0,L.jsxs)(H,{variant:`ghost`,size:`icon-sm`,className:`absolute top-2 right-2`,children:[(0,L.jsx)(ot,{}),(0,L.jsx)(`span`,{className:`sr-only`,children:`Close`})]})})]})]})})}function DA(){let{data:e,error:t,loading:n,refresh:r}=_A(()=>W.integrationList().then(e=>e.data)),[i,a]=(0,w.useState)(null),[o,s]=(0,w.useState)(``),c=_A(()=>W.models()),l=_A(()=>W.providerList().then(e=>e.data)),[u,d]=(0,w.useState)(null),[f,p]=(0,w.useState)(null),[m,h]=(0,w.useState)(null),g=wA(f,e=>W.integrationConnectOauth(e.integrationID,{methodID:e.methodID}).then(e=>({attemptID:e.data.attemptID,url:e.data.url,instructions:e.data.instructions})),(e,t)=>W.integrationOauthAttempt(e.integrationID,t).then(e=>e.data),r),_=wA(m,e=>W.integrationConnectCommand(e.integrationID,{methodID:e.methodID}).then(e=>({attemptID:e.data.attemptID})),(e,t)=>W.integrationCommandAttempt(e.integrationID,t).then(e=>e.data),r),v=(0,w.useMemo)(()=>{let e=new Map;if(!c.data||!l.data)return e;let t=new Map;for(let e of l.data){if(!e.integrationID)continue;let n=t.get(e.integrationID)??new Set;n.add(e.id),t.set(e.integrationID,n)}for(let n of c.data)for(let[r,i]of t)i.has(n.providerID)&&e.set(r,(e.get(r)??0)+1);return e},[c.data,l.data]),y=(0,w.useMemo)(()=>e?[...e].sort((e,t)=>{let n=+(e.connections.length>0),r=+(t.connections.length>0);return n===r?(e.name||e.id).localeCompare(t.name||t.id):r-n}):[],[e]),b=o.trim().toLowerCase(),x=(0,w.useMemo)(()=>b?y.filter(e=>e.name.toLowerCase().includes(b)||e.id.toLowerCase().includes(b)):y,[y,b]);return(0,L.jsxs)(`div`,{children:[(0,L.jsx)(hA,{title:`Integrations`,note:`Connect providers — API keys, OAuth, CLI commands`,onRefresh:r,loading:n}),(0,L.jsx)(`p`,{className:`-mt-1 mb-2 text-xs text-[var(--text-weaker)]`,children:`An integration is how the engine authenticates to a model provider. Connect one to enable its models.`}),(0,L.jsxs)(`div`,{className:`relative mb-2`,children:[(0,L.jsx)(Je,{className:`pointer-events-none absolute top-1/2 left-2.5 size-3.5 -translate-y-1/2 text-muted-foreground`}),(0,L.jsx)(`input`,{className:`${mA} h-7 pl-7`,placeholder:`Search integrations`,value:o,onChange:e=>s(e.target.value)})]}),b&&(0,L.jsxs)(`p`,{className:`mb-1 px-1 text-[11px] text-[var(--text-weaker)]`,"aria-live":`polite`,children:[x.length,` of `,y.length]}),t&&(0,L.jsx)(vA,{message:t}),!t&&e&&e.length===0&&(0,L.jsx)(gA,{children:`No integrations available.`}),!t&&e&&e.length>0&&x.length===0&&(0,L.jsxs)(gA,{children:[`No integrations match “`,o.trim(),`”.`]}),(0,L.jsx)(`div`,{className:`space-y-1`,children:x.map(e=>(0,L.jsxs)(`div`,{children:[(0,L.jsxs)(`button`,{type:`button`,className:`flex w-full items-center justify-between gap-2 rounded-md border border-[var(--border-weak-base)] bg-[var(--surface-raised-base)] px-2.5 py-2 text-left transition-colors hover:bg-[var(--surface-raised-base-hover)]`,onClick:()=>a(i===e.id?null:e.id),children:[(0,L.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,L.jsx)(F,{className:`size-3.5 shrink-0 text-[var(--text-weaker)] transition-transform ${i===e.id?`rotate-90`:``}`}),(0,L.jsx)(`span`,{className:`truncate text-[13px] text-[var(--text-strong)]`,children:e.name}),(0,L.jsx)(`span`,{className:`shrink-0 font-mono text-[11px] text-[var(--text-weaker)]`,children:e.id})]}),(0,L.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1.5`,children:[(v.get(e.id)??0)>0&&(0,L.jsxs)(`span`,{className:`text-[11px] text-[var(--text-weaker)]`,children:[`· `,v.get(e.id),` models`]}),e.connections.length>0?(0,L.jsxs)(hb,{tone:`green`,children:[`connected`,e.connections.length>1?` · ${e.connections.length}`:``]}):(0,L.jsx)(hb,{children:`not connected`}),e.connections.map((e,t)=>(0,L.jsx)(hb,{tone:`blue`,children:e.type===`credential`?e.label:e.name},t))]})]}),i===e.id&&(0,L.jsxs)(`div`,{className:`mt-1 ml-4 space-y-1.5 rounded-md border border-[var(--border-weak-base)] bg-[var(--surface-base)] p-2.5`,children:[e.connections.length===0&&(0,L.jsx)(`p`,{className:`text-xs text-[var(--text-weaker)]`,children:`No connections yet.`}),e.connections.length>0&&(0,L.jsx)(`div`,{className:`space-y-1`,children:e.connections.map((e,t)=>(0,L.jsxs)(`div`,{className:`flex items-center gap-2 text-xs`,children:[(0,L.jsx)(hb,{tone:e.type===`credential`?`blue`:`neutral`,children:e.type===`credential`?`credential`:`env`}),(0,L.jsx)(`span`,{className:`font-mono text-[var(--text-base)]`,children:e.type===`credential`?e.label:e.name}),e.type===`credential`&&(0,L.jsx)(`span`,{className:`font-mono text-[10px] text-[var(--text-weaker)]`,children:e.id}),e.type===`credential`&&(0,L.jsx)(`button`,{type:`button`,className:`rounded border border-[var(--border-weak-base)] px-1.5 py-0.5 text-[10px] text-[var(--text-weak)] transition-colors hover:bg-[var(--surface-raised-base-hover)] hover:text-[var(--text-strong)]`,onClick:()=>{W.credentialActivate(e.id).then(r).catch(e=>fk({title:`Activate failed`,description:SA(e),variant:`destructive`}))},children:`activate`})]},t))}),(0,L.jsx)(`div`,{className:`flex flex-wrap items-center gap-1.5 pt-1`,children:e.methods.map((t,n)=>(0,L.jsx)(OA,{method:t,onKey:()=>d({integration:e,method:t}),onOauth:()=>p({integrationID:e.id,methodID:t.id}),onCommand:()=>h({integrationID:e.id,methodID:t.id})},n))}),f?.integrationID===e.id&&(0,L.jsx)(TA,{state:g,onCancel:()=>p(null),label:`OAuth`}),m?.integrationID===e.id&&(0,L.jsx)(TA,{state:_,onCancel:()=>h(null),label:`Command`})]})]},e.id))}),u&&(0,L.jsx)(EA,{integration:u.integration,method:u.method,open:!0,onClose:()=>d(null),onDone:r})]})}function OA({method:e,onKey:t,onOauth:n,onCommand:r}){let i=e.type===`env`?`env: ${e.names.join(`, `)}`:e.label??e.type;return e.type===`env`?(0,L.jsx)(H,{size:`xs`,variant:`outline`,disabled:!0,title:`Configured via environment variables`,children:i}):(0,L.jsx)(H,{size:`xs`,variant:`outline`,onClick:e.type===`key`?t:e.type===`oauth`?n:r,children:i})}var kA=`fixed top-1/2 left-1/2 z-50 grid w-full max-w-[calc(100%-2rem)] -translate-x-1/2 -translate-y-1/2 gap-3 rounded-lg border border-[var(--border-weak-base)] bg-[var(--surface-float-base)] p-4 text-sm text-popover-foreground duration-100 outline-none sm:max-w-sm data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95`;function AA(e){switch(e.status){case`connected`:return`green`;case`pending`:case`needs_auth`:return`amber`;case`failed`:return`red`;default:return`neutral`}}function jA(e){return e.status===`needs_auth`?`needs auth`:e.status}function MA(){let e=_A(()=>W.mcpList().then(e=>e.data)),t=_A(()=>W.mcpResource().then(e=>e.data)),[n,r]=(0,w.useState)(null),[i,a]=(0,w.useState)(null),[o,s]=(0,w.useState)(null),c=()=>{e.refresh(),t.refresh()},l=(e,t)=>{r(e),a(null),t().catch(e=>a(e instanceof Error?e.message:String(e))).finally(()=>{r(null),c()})};return(0,L.jsxs)(`div`,{className:`space-y-4`,children:[(0,L.jsxs)(`div`,{children:[(0,L.jsx)(hA,{title:`MCP servers`,note:`Model Context Protocol endpoints`,onRefresh:c,loading:e.loading}),e.error&&(0,L.jsx)(vA,{message:e.error}),i&&(0,L.jsx)(vA,{message:i}),!e.error&&e.data&&e.data.length===0&&(0,L.jsx)(gA,{children:`No MCP servers configured.`}),(0,L.jsx)(`div`,{className:`space-y-1`,children:e.data?.map(e=>(0,L.jsxs)(`div`,{className:`flex items-center justify-between gap-2 rounded-md border border-[var(--border-weak-base)] bg-[var(--surface-raised-base)] px-2.5 py-2`,children:[(0,L.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,L.jsx)(`span`,{className:`truncate font-mono text-[13px] text-[var(--text-strong)]`,children:e.name}),(0,L.jsx)(hb,{tone:AA(e.status),children:jA(e.status)}),e.status.status===`failed`&&(0,L.jsx)(`span`,{className:`max-w-40 truncate text-[10px] text-[var(--text-on-critical-base)]`,children:e.status.error})]}),(0,L.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1`,children:[e.status.status!==`connected`&&(0,L.jsx)(H,{size:`xs`,variant:`outline`,disabled:n!==null,onClick:()=>l(`connect:${e.name}`,()=>W.mcpConnect(e.name)),children:n===`connect:${e.name}`?`Connecting…`:`Connect`}),e.status.status===`connected`&&(0,L.jsx)(H,{size:`xs`,variant:`outline`,disabled:n!==null,onClick:()=>l(`disconnect:${e.name}`,()=>W.mcpDisconnect(e.name)),children:n===`disconnect:${e.name}`?`Disconnecting…`:`Disconnect`}),(0,L.jsx)(H,{size:`xs`,variant:`ghost`,disabled:n!==null,className:`text-[var(--surface-critical-strong)]`,onClick:()=>s(e),children:`Remove`})]})]},e.name))})]}),(0,L.jsxs)(`div`,{children:[(0,L.jsx)(hA,{title:`Resources`,note:`Read-only catalog`,onRefresh:t.refresh,loading:t.loading}),t.error&&(0,L.jsx)(vA,{message:t.error}),!t.error&&t.data&&t.data.resources.length===0&&(0,L.jsx)(gA,{children:`No resources exposed.`}),(0,L.jsxs)(`div`,{className:`space-y-1`,children:[t.data?.resources.map(e=>(0,L.jsx)(NA,{resource:e},`${e.server}:${e.name}`)),t.data?.templates.map(e=>(0,L.jsx)(PA,{template:e},`${e.server}:${e.name}`))]})]}),o&&(0,L.jsx)(Tm,{open:!0,onOpenChange:e=>!e&&s(null),children:(0,L.jsxs)(Dm,{children:[(0,L.jsx)(km,{className:`bg-black/60`}),(0,L.jsxs)(cs,{"data-slot":`dialog-content`,className:kA,children:[(0,L.jsxs)(jm,{children:[(0,L.jsx)(Nm,{children:`Remove MCP server`}),(0,L.jsxs)(`p`,{className:`text-xs text-[var(--text-weaker)]`,children:[`Remove`,` `,(0,L.jsx)(`span`,{className:`font-mono text-[var(--text-base)]`,children:o.name}),` `,`from the config? This affects the server-side configuration.`]})]}),(0,L.jsxs)(Mm,{className:`rounded-b-lg`,children:[(0,L.jsx)(H,{variant:`ghost`,onClick:()=>s(null),children:`Cancel`}),(0,L.jsx)(H,{variant:`destructive`,onClick:()=>{l(`remove:${o.name}`,()=>W.mcpDelete(o.name)),s(null)},children:`Remove`})]}),(0,L.jsx)(Om,{asChild:!0,children:(0,L.jsxs)(H,{variant:`ghost`,size:`icon-sm`,className:`absolute top-2 right-2`,children:[(0,L.jsx)(ot,{}),(0,L.jsx)(`span`,{className:`sr-only`,children:`Close`})]})})]})]})})]})}function NA({resource:e}){return(0,L.jsxs)(`div`,{className:`rounded-md border border-[var(--border-weak-base)] bg-[var(--surface-base)] px-2.5 py-1.5`,children:[(0,L.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,L.jsx)(`span`,{className:`truncate text-xs text-[var(--text-strong)]`,children:e.name}),(0,L.jsx)(`span`,{className:`shrink-0 font-mono text-[10px] text-[var(--text-weaker)]`,children:e.server})]}),(0,L.jsxs)(`div`,{className:`mt-0.5 flex items-center gap-1.5`,children:[(0,L.jsx)(Ae,{className:`size-3 shrink-0 text-[var(--text-weaker)]`}),(0,L.jsx)(`span`,{className:`truncate font-mono text-[11px] text-[var(--text-weak)]`,children:e.uri})]}),e.description&&(0,L.jsx)(`p`,{className:`mt-0.5 truncate text-[11px] text-[var(--text-weaker)]`,children:e.description})]})}function PA({template:e}){return(0,L.jsxs)(`div`,{className:`rounded-md border border-[var(--border-weak-base)] bg-[var(--surface-base)] px-2.5 py-1.5`,children:[(0,L.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,L.jsx)(`span`,{className:`truncate text-xs text-[var(--text-strong)]`,children:e.name}),(0,L.jsx)(`span`,{className:`shrink-0 font-mono text-[10px] text-[var(--text-weaker)]`,children:e.server})]}),(0,L.jsxs)(`div`,{className:`mt-0.5 flex items-center gap-1.5`,children:[(0,L.jsx)(Ae,{className:`size-3 shrink-0 text-[var(--text-weaker)]`}),(0,L.jsx)(`span`,{className:`truncate font-mono text-[11px] text-[var(--text-weak)]`,children:e.uriTemplate})]})]})}function FA(){let{data:e,error:t,loading:n,refresh:r}=_A(()=>W.pluginList().then(e=>e.data));return(0,L.jsxs)(`div`,{children:[(0,L.jsx)(hA,{title:`Plugins`,note:`Read-only — installed plugins`,onRefresh:r,loading:n}),t&&(0,L.jsx)(vA,{message:t}),!t&&e&&e.length===0&&(0,L.jsx)(gA,{children:`No plugins installed.`}),(0,L.jsx)(`div`,{className:`space-y-1`,children:e?.map(e=>(0,L.jsxs)(`div`,{className:`flex items-center gap-2 rounded-md border border-[var(--border-weak-base)] bg-[var(--surface-raised-base)] px-2.5 py-1.5`,children:[(0,L.jsx)(Ge,{className:`size-3.5 shrink-0 text-[var(--text-weaker)]`}),(0,L.jsx)(`span`,{className:`min-w-0 truncate font-mono text-xs text-[var(--text-strong)]`,children:e.id})]},e.id))})]})}function IA(){let{data:e,error:t,loading:n,refresh:r}=_A(()=>W.providerList().then(e=>e.data)),[i,a]=(0,w.useState)(null),[o,s]=(0,w.useState)(null),[c,l]=(0,w.useState)(null);return(0,L.jsxs)(`div`,{children:[(0,L.jsx)(hA,{title:`Providers`,note:`Registered model providers`,onRefresh:r,loading:n}),t&&(0,L.jsx)(vA,{message:t}),!t&&e&&e.length===0&&(0,L.jsx)(gA,{children:`No providers registered.`}),(0,L.jsx)(`div`,{className:`space-y-1`,children:e?.map(e=>(0,L.jsxs)(`div`,{children:[(0,L.jsxs)(`button`,{type:`button`,className:`flex w-full items-center justify-between gap-2 rounded-md border border-[var(--border-weak-base)] bg-[var(--surface-raised-base)] px-2.5 py-2 text-left transition-colors hover:bg-[var(--surface-raised-base-hover)]`,onClick:()=>{if(i===e.id){a(null),s(null);return}a(e.id),s(null),l(null),W.providerGet(e.id).then(e=>s(e.data)).catch(e=>l(e instanceof Error?e.message:String(e)))},children:[(0,L.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,L.jsx)(F,{className:`size-3.5 shrink-0 text-[var(--text-weaker)] transition-transform ${i===e.id?`rotate-90`:``}`}),(0,L.jsx)(`span`,{className:`truncate text-[13px] text-[var(--text-strong)]`,children:e.name}),(0,L.jsx)(`span`,{className:`shrink-0 font-mono text-[11px] text-[var(--text-weaker)]`,children:e.id})]}),(0,L.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2`,children:[e.disabled&&(0,L.jsx)(`span`,{className:`rounded border border-[var(--border-weak-base)] px-1.5 py-0.5 text-[10px] text-[var(--text-weaker)]`,children:`disabled`}),(0,L.jsx)(`span`,{className:`max-w-48 truncate font-mono text-[10px] text-[var(--text-weak)]`,children:e.package})]})]}),i===e.id&&(0,L.jsxs)(`div`,{className:`mt-1 ml-4 space-y-1.5 rounded-md border border-[var(--border-weak-base)] bg-[var(--surface-base)] p-2.5`,children:[c&&(0,L.jsx)(vA,{message:c}),!o&&!c&&(0,L.jsxs)(`div`,{className:`flex items-center gap-2 text-xs text-[var(--text-weaker)]`,children:[(0,L.jsx)(Me,{className:`size-3.5 animate-spin`}),` loading…`]}),o&&(0,L.jsxs)(L.Fragment,{children:[o.integrationID&&(0,L.jsxs)(`p`,{className:`text-[11px] text-[var(--text-weak)]`,children:[`integration:`,` `,(0,L.jsx)(`span`,{className:`font-mono text-[var(--text-base)]`,children:o.integrationID})]}),o.settings&&Object.keys(o.settings).length>0&&(0,L.jsx)(`pre`,{className:`max-h-56 overflow-auto rounded-md border border-[var(--border-weak-base)] bg-[var(--surface-inset-base)] p-2.5 font-mono text-[11px] leading-relaxed whitespace-pre-wrap break-all text-[var(--text-base)]`,children:JSON.stringify(o.settings,null,2)}),o.headers&&Object.keys(o.headers).length>0&&(0,L.jsx)(`pre`,{className:`max-h-56 overflow-auto rounded-md border border-[var(--border-weak-base)] bg-[var(--surface-inset-base)] p-2.5 font-mono text-[11px] leading-relaxed whitespace-pre-wrap break-all text-[var(--text-base)]`,children:JSON.stringify(o.headers,null,2)}),o.body&&Object.keys(o.body).length>0&&(0,L.jsx)(`pre`,{className:`max-h-56 overflow-auto rounded-md border border-[var(--border-weak-base)] bg-[var(--surface-inset-base)] p-2.5 font-mono text-[11px] leading-relaxed whitespace-pre-wrap break-all text-[var(--text-base)]`,children:JSON.stringify(o.body,null,2)}),(!o.settings||Object.keys(o.settings).length===0)&&(!o.headers||Object.keys(o.headers).length===0)&&(!o.body||Object.keys(o.body).length===0)&&(0,L.jsx)(`p`,{className:`text-xs text-[var(--text-weaker)]`,children:`No settings.`})]})]})]},e.id))})]})}var LA=`fixed top-1/2 left-1/2 z-50 grid w-full max-w-[calc(100%-2rem)] -translate-x-1/2 -translate-y-1/2 gap-3 rounded-lg border border-[var(--border-weak-base)] bg-[var(--surface-float-base)] p-4 text-sm text-popover-foreground duration-100 outline-none sm:max-w-sm data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95`;function RA(){let{data:e,error:t,loading:n,refresh:r}=_A(()=>W.serverInfo()),[i,a]=(0,w.useState)(!1),[o,s]=(0,w.useState)(!1),[c,l]=(0,w.useState)(null),[u,d]=(0,w.useState)(null);return(0,L.jsxs)(`div`,{className:`space-y-4`,children:[(0,L.jsxs)(`div`,{children:[(0,L.jsx)(hA,{title:`Server`,note:`Backend service`,onRefresh:r,loading:n}),t&&(0,L.jsx)(vA,{message:t}),!t&&e&&e.urls.length===0&&(0,L.jsx)(gA,{children:`No server endpoints.`}),(0,L.jsx)(`div`,{className:`space-y-1`,children:e?.urls.map(e=>(0,L.jsx)(`div`,{className:`flex items-center gap-2 rounded-md border border-[var(--border-weak-base)] bg-[var(--surface-raised-base)] px-2.5 py-1.5`,children:(0,L.jsx)(`span`,{className:`min-w-0 truncate font-mono text-xs text-[var(--text-strong)]`,children:e})},e))})]}),(0,L.jsxs)(`div`,{className:`space-y-2 rounded-md border border-[var(--border-weak-base)] bg-[var(--surface-base)] p-2.5`,children:[(0,L.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,L.jsxs)(`div`,{children:[(0,L.jsx)(`p`,{className:`text-[13px] font-medium text-[var(--text-strong)]`,children:`Stop service`}),(0,L.jsx)(`p`,{className:`text-[11px] text-[var(--text-weaker)]`,children:`Request the managed opencode service to shut down. The web UI itself keeps running.`})]}),(0,L.jsxs)(H,{variant:`destructive`,onClick:()=>a(!0),disabled:o,children:[(0,L.jsx)(We,{}),o?`Stopping…`:`Stop`]})]}),c&&(0,L.jsx)(`p`,{className:`text-xs text-[var(--text-base)]`,children:c}),u&&(0,L.jsx)(vA,{message:u})]}),i&&(0,L.jsx)(Tm,{open:!0,onOpenChange:e=>!e&&a(!1),children:(0,L.jsxs)(Dm,{children:[(0,L.jsx)(km,{className:`bg-black/60`}),(0,L.jsxs)(cs,{"data-slot":`dialog-content`,className:LA,children:[(0,L.jsxs)(jm,{children:[(0,L.jsx)(Nm,{children:`Stop the service?`}),(0,L.jsx)(`p`,{className:`text-xs text-[var(--text-weaker)]`,children:`This stops the background opencode service. Running sessions will be interrupted.`})]}),(0,L.jsxs)(Mm,{className:`rounded-b-lg`,children:[(0,L.jsx)(H,{variant:`ghost`,onClick:()=>a(!1),disabled:o,children:`Cancel`}),(0,L.jsx)(H,{variant:`destructive`,disabled:o,onClick:()=>{s(!0),l(null),d(null),W.serviceStop().then(e=>{l(e.accepted?`Stop accepted — the service is shutting down.`:`Stop not accepted — this instance is not the service owner.`)}).catch(e=>d(e instanceof Error?e.message:String(e))).finally(()=>{s(!1),a(!1)})},children:`Stop service`})]}),(0,L.jsx)(Om,{asChild:!0,children:(0,L.jsxs)(H,{variant:`ghost`,size:`icon-sm`,className:`absolute top-2 right-2`,children:[(0,L.jsx)(ot,{}),(0,L.jsx)(`span`,{className:`sr-only`,children:`Close`})]})})]})]})})]})}function zA(){let{data:e,error:t,loading:n,refresh:r}=_A(()=>W.websearchProviders().then(e=>e.data)),[i,a]=(0,w.useState)(``),[o,s]=(0,w.useState)(``),[c,l]=(0,w.useState)(null),[u,d]=(0,w.useState)(!1),[f,p]=(0,w.useState)(null),m=i||e?.[0]?.id||``;return(0,L.jsxs)(`div`,{className:`space-y-4`,children:[(0,L.jsxs)(`div`,{children:[(0,L.jsx)(hA,{title:`Websearch`,note:`Test search providers`,onRefresh:r,loading:n}),t&&(0,L.jsx)(vA,{message:t}),!t&&e&&e.length===0&&(0,L.jsx)(gA,{children:`No websearch providers available.`}),(0,L.jsx)(`div`,{className:`space-y-1`,children:e?.map(e=>(0,L.jsxs)(`div`,{className:`flex items-center justify-between gap-2 rounded-md border border-[var(--border-weak-base)] bg-[var(--surface-raised-base)] px-2.5 py-1.5`,children:[(0,L.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,L.jsx)(`span`,{className:`truncate text-xs text-[var(--text-strong)]`,children:e.name}),(0,L.jsx)(`span`,{className:`shrink-0 font-mono text-[11px] text-[var(--text-weaker)]`,children:e.id})]}),(0,L.jsx)(H,{size:`xs`,variant:i===e.id?`default`:`outline`,onClick:()=>a(i===e.id?``:e.id),children:i===e.id?`selected`:`select`})]},e.id))})]}),e&&e.length>0&&(0,L.jsxs)(`div`,{className:`space-y-2`,children:[(0,L.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,L.jsx)(`input`,{className:`w-full rounded-md border border-[var(--border-weak-base)] bg-[var(--input-base)] px-2.5 py-1.5 text-sm text-[var(--text-strong)] outline-none transition-colors placeholder:text-[var(--text-weaker)] focus:border-[var(--border-selected)] focus:ring-1 focus:ring-[var(--border-selected)] h-8 flex-1`,placeholder:`Search query…`,value:o,onChange:e=>s(e.target.value),onKeyDown:e=>{e.key===`Enter`&&o.trim()&&!u&&h()}}),(0,L.jsxs)(H,{variant:`default`,disabled:!o.trim()||u||!m,onClick:h,children:[(0,L.jsx)(Je,{}),u?`Searching…`:`Search`]})]}),!m&&(0,L.jsx)(`p`,{className:`text-[11px] text-[var(--text-weaker)]`,children:`Select a provider to search.`}),f&&(0,L.jsx)(vA,{message:f}),c&&(0,L.jsxs)(`div`,{className:`space-y-1`,children:[(0,L.jsxs)(`p`,{className:`text-[11px] text-[var(--text-weaker)]`,children:[c.results.length,` results · provider `,c.providerID]}),c.results.length===0&&(0,L.jsx)(gA,{children:`No results.`}),c.results.map((e,t)=>(0,L.jsxs)(`div`,{className:`rounded-md border border-[var(--border-weak-base)] bg-[var(--surface-base)] px-2.5 py-2`,children:[(0,L.jsx)(`a`,{className:`block truncate text-xs text-[var(--text-interactive-base)] underline underline-offset-2`,href:e.url,target:`_blank`,rel:`noreferrer`,children:e.title??e.url}),(0,L.jsx)(`p`,{className:`mt-0.5 line-clamp-2 text-[11px] text-[var(--text-weak)]`,children:e.content}),(0,L.jsx)(`p`,{className:`mt-0.5 truncate font-mono text-[10px] text-[var(--text-weaker)]`,children:e.url})]},`${e.url}:${t}`))]})]}),(0,L.jsx)(`div`,{className:`flex items-center justify-between gap-2 rounded-md border border-[var(--border-weak-base)] bg-[var(--surface-base)] px-2.5 py-2`,children:(0,L.jsxs)(`p`,{className:`text-[11px] text-[var(--text-weaker)]`,children:[`Searching with`,` `,(0,L.jsx)(`span`,{className:`font-mono text-[var(--text-base)]`,children:e?.find(e=>e.id===m)?.name??m})]})})]});function h(){!o.trim()||u||(d(!0),p(null),W.websearch(o.trim(),m).then(e=>l(e.data)).catch(e=>p(e instanceof Error?e.message:String(e))).finally(()=>d(!1)))}}var BA=null;function VA(e){BA?.(e)}var HA=`fixed top-1/2 left-1/2 z-50 grid w-full max-w-[calc(100%-2rem)] -translate-x-1/2 -translate-y-1/2 grid-rows-[auto_minmax(0,1fr)] gap-3 rounded-lg border border-[var(--border-weak-base)] bg-[var(--surface-float-base)] p-4 text-sm text-popover-foreground duration-100 outline-none sm:max-w-3xl h-[min(84vh,660px)] data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95`,UA=[{id:`providers`,label:`Providers`,icon:ue},{id:`integrations`,label:`Integrations`,icon:He},{id:`mcp`,label:`MCP`,icon:N},{id:`plugins`,label:`Plugins`,icon:Ge},{id:`extensions`,label:`Extensions`,icon:ne},{id:`config`,label:`Config`,icon:ve},{id:`websearch`,label:`Websearch`,icon:ke},{id:`server`,label:`Server`,icon:Xe}];function WA(){let[e,t]=(0,w.useState)(!1),[n,r]=(0,w.useState)(`providers`);return(0,w.useEffect)(()=>(BA=e=>{e&&r(e),t(!0)},()=>{BA=null}),[]),(0,L.jsx)(Tm,{open:e,onOpenChange:e=>{t(e),e||r(`providers`)},children:(0,L.jsxs)(Dm,{children:[(0,L.jsx)(km,{className:`bg-black/60`}),(0,L.jsxs)(cs,{"data-slot":`dialog-content`,className:HA,children:[(0,L.jsxs)(jm,{className:`pr-8`,children:[(0,L.jsx)(Nm,{children:`Settings`}),(0,L.jsx)(`p`,{className:`text-xs text-[var(--text-weaker)]`,children:`Providers · integrations · MCP · plugins · extensions · config`})]}),(0,L.jsxs)(SO,{value:n,onValueChange:r,className:`flex min-h-0 flex-col`,children:[(0,L.jsx)(wO,{className:`no-scrollbar mb-2 flex w-full flex-nowrap justify-start gap-1 overflow-x-auto rounded-md bg-[var(--surface-base)] p-1 [&>*]:shrink-0`,children:UA.map(e=>(0,L.jsxs)(TO,{value:e.id,title:e.id===`integrations`?`Connect providers`:void 0,className:`h-7 gap-1.5 rounded px-2 text-xs`,children:[(0,L.jsx)(e.icon,{className:`size-3.5`}),e.label]},e.id))}),(0,L.jsxs)(Wk,{className:`min-h-0 flex-1 rounded-md border border-[var(--border-weak-base)] bg-[var(--surface-base)] p-3`,children:[(0,L.jsx)(EO,{value:`providers`,children:(0,L.jsx)(IA,{})}),(0,L.jsx)(EO,{value:`integrations`,children:(0,L.jsx)(DA,{})}),(0,L.jsx)(EO,{value:`mcp`,children:(0,L.jsx)(MA,{})}),(0,L.jsx)(EO,{value:`plugins`,children:(0,L.jsx)(FA,{})}),(0,L.jsx)(EO,{value:`extensions`,children:(0,L.jsx)(KA,{})}),(0,L.jsx)(EO,{value:`config`,children:(0,L.jsx)(bA,{})}),(0,L.jsx)(EO,{value:`websearch`,children:(0,L.jsx)(zA,{})}),(0,L.jsx)(EO,{value:`server`,children:(0,L.jsx)(RA,{})})]})]}),(0,L.jsx)(Om,{asChild:!0,children:(0,L.jsxs)(H,{variant:`ghost`,size:`icon-sm`,className:`absolute top-2 right-2`,children:[(0,L.jsx)(ot,{}),(0,L.jsx)(`span`,{className:`sr-only`,children:`Close`})]})})]})]})})}function GA(){let[e,t]=(0,w.useState)(0);return(0,w.useEffect)(()=>mt(()=>t(e=>e+1)),[]),e}function KA(){let e=GA(),[t,n]=(0,w.useState)(null);(0,w.useEffect)(()=>{let e=async()=>{if(!document.hidden)try{let e=await fetch(`/api/webui/extensions`);if(!e.ok)throw Error(String(e.status));let t=await e.json();n(t.data??[])}catch{n([])}};return e(),Vh({name:`extensions-runtime-list`,minInterval:1e4,run:()=>e()})},[]);let r=(0,w.useMemo)(()=>Tt(`settings`),[e]),i=(0,w.useMemo)(()=>_t(),[e]);return(0,L.jsxs)(`div`,{className:`space-y-5`,children:[(0,L.jsxs)(`div`,{children:[(0,L.jsx)(hA,{title:`Extensions`,note:`one folder per extension — presence installs, manifest paused disables`}),t===null?null:t.length===0?(0,L.jsx)(gA,{children:`No folder extensions installed.`}):(0,L.jsx)(`div`,{className:`space-y-1`,children:t.map(e=>(0,L.jsxs)(`div`,{className:`flex items-center justify-between gap-2 rounded-md border border-[var(--border-weak-base)] bg-[var(--surface-raised-base)] px-2.5 py-1.5`,children:[(0,L.jsxs)(`div`,{className:`min-w-0`,children:[(0,L.jsx)(`p`,{className:`truncate font-mono text-xs text-[var(--text-strong)]`,children:e.id}),(0,L.jsx)(`p`,{className:`truncate text-[11px] text-[var(--text-weaker)]`,children:e.source??e.url??``})]}),e.disabled?(0,L.jsx)(`span`,{className:`shrink-0 rounded-sm border border-[var(--border-weak-base)] px-1.5 py-0.5 font-mono text-[10px] text-[var(--text-weaker)]`,children:`paused`}):(0,L.jsx)(`span`,{className:`shrink-0 rounded-sm border border-transparent bg-[var(--surface-success-base)] px-1.5 py-0.5 font-mono text-[10px] text-[var(--text-on-success-base)]`,children:`on`})]},e.id))}),(0,L.jsx)(`p`,{className:`mt-1 text-[11px] text-[var(--text-weaker)]`,children:'pause with `"disabled": true` in the folder\'s manifest.json; delete the folder to uninstall.'})]}),(0,L.jsxs)(`div`,{children:[(0,L.jsx)(hA,{title:`Registered in this page`}),i.length>0?(0,L.jsx)(`div`,{className:`mb-1 flex flex-wrap gap-1`,children:i.map(e=>(0,L.jsx)(`span`,{className:`rounded-md border border-[var(--border-weak-base)] bg-[var(--surface-raised-base)] px-2 py-1 font-mono text-xs text-[var(--text-strong)]`,children:e},e))}):(0,L.jsx)(gA,{children:`No registrations.`})]}),r.length>0&&(0,L.jsxs)(`div`,{children:[(0,L.jsx)(hA,{title:`Extension settings`,note:`contributed by installed extensions`}),(0,L.jsx)(`div`,{className:`space-y-2`,children:r.map(t=>(0,L.jsx)(qA,{id:t.id,children:(0,L.jsxs)(`section`,{className:`rounded-md border border-[var(--border-weak-base)] bg-[var(--surface-raised-base)] p-2.5`,children:[(0,L.jsx)(`h4`,{className:`text-xs font-medium text-[var(--text-strong)]`,children:t.item.title}),t.item.description&&(0,L.jsx)(`p`,{className:`mt-0.5 text-[11px] text-[var(--text-weaker)]`,children:t.item.description}),(0,L.jsx)(`div`,{className:`mt-2`,children:t.item.render()})]})},`${e}:${t.id}`))})]})]})}var qA=class extends w.Component{state={failed:!1};static getDerivedStateFromError(){return{failed:!0}}componentDidCatch(e){console.error(`[extensions] settings section "${this.props.id}" crashed:`,e)}render(){return this.state.failed?(0,L.jsx)(`p`,{className:`rounded-md border border-[var(--border-weak-base)] bg-[var(--surface-raised-base)] px-2.5 py-2 text-xs text-[var(--text-weaker)]`,children:`This extension's settings crashed.`}):this.props.children}},JA=3,YA=20,XA=2,ZA=`webui:navigate`,QA=288,$A=240,ej=480,tj=56,nj=0,rj=new Set,ij=!1;function aj(){ij||(ij=!0,mt(()=>{nj++;for(let e of rj)e()}))}function oj(e){return aj(),rj.add(e),()=>rj.delete(e)}function sj(){return nj}function cj(){return 0}function lj(){return(0,w.useSyncExternalStore)(oj,sj,cj)}function uj({sessionID:e,children:t}){let n=lj(),r=(0,w.useMemo)(()=>Tt(`contextMenu.session`),[n]);return r.length===0?(0,L.jsx)(L.Fragment,{children:t}):(0,L.jsxs)(zk,{children:[(0,L.jsx)(Bk,{asChild:!0,children:t}),(0,L.jsx)(Vk,{className:`min-w-36`,children:r.map(t=>(0,L.jsx)(Hk,{onSelect:()=>{try{t.item.run({sessionID:e})}catch(e){console.error(`[extensions] contextMenu "${t.id}" crashed:`,e)}},children:t.item.label},t.id))})]})}function dj(e){return/^\/home\/[^/]+$/.test(e)||/^\/Users\/[^/]+$/.test(e)}function fj(e){let t=new Map;for(let n of e){if(!n)continue;let e=n.replace(/\/+$/,``);dj(e)&&t.set(e,(t.get(e)??0)+1)}let n,r=0;for(let[e,i]of t)i>r&&(n=e,r=i);return n}function pj(e,t){if(!e)return`Other`;let n=e.replace(/\/+$/,``);return t&&dj(t)&&n===t?`~`:t&&dj(t)&&n.startsWith(t+`/`)?`~/`+n.slice(t.length+1):n}function mj(e,t){return!!e&&!!t&&e.replace(/\/+$/,``)===t.replace(/\/+$/,``)}function hj(){let e=J(e=>e.sessions),t=J(e=>e.sessionsCursor),n=J(e=>e.activeIDs),r=J(e=>e.currentSessionID),i=J(e=>e.connected),a=J(e=>e.pendingWorkspace),o=J(e=>e.running),s=J(e=>e.queued),[c,l]=(0,w.useState)(``),[u,d]=(0,w.useState)([]),[f,p]=(0,w.useState)(new Map),[m,h]=(0,w.useState)(!1),[g,_]=(0,w.useState)(new Set),v=(0,w.useRef)(null),[y,b]=(0,w.useState)({}),[x,S]=(0,w.useState)({}),[C,T]=(0,w.useState)(!1),[E,D]=(0,w.useState)(QA),[O,k]=(0,w.useState)(!1),[ee,A]=(0,w.useState)(!1),j=J(e=>e.uiSignals.explorer),M=J(e=>e.mobileSidebarOpen);(0,w.useEffect)(()=>{cv()},[r]),(0,w.useEffect)(()=>{if(!M)return;let e=e=>{e.key===`Escape`&&(e.preventDefault(),e.stopPropagation(),cv())};window.addEventListener(`keydown`,e,!0);let t=document.body.style.overflow;return document.body.style.overflow=`hidden`,()=>{window.removeEventListener(`keydown`,e,!0),document.body.style.overflow=t}},[M]),(0,w.useEffect)(()=>{j&&A(!0)},[j]);let te=(0,w.useMemo)(()=>fj(e.map(e=>e.location?.directory)),[e]),ne=e=>!!o[e]||!!s[e],N=(0,w.useMemo)(()=>{let t=new Set;for(let n of e)n.parentID&&ne(n.id)&&t.add(n.parentID);return t},[e,o,s]),P=c.trim(),re=P.toLowerCase();(0,w.useEffect)(()=>{if(P.length<2){d([]);return}let e=!1,t=setTimeout(()=>{W.listSessions({search:P,limit:100}).then(t=>{e||d(t.data.filter(e=>!e.parentID))}).catch(()=>{e||d([])})},250);return()=>{e=!0,clearTimeout(t)}},[P]),(0,w.useEffect)(()=>{if(P.length<2){p(new Map),h(!1);return}let t=!1;h(!0);let n=setTimeout(()=>{Ik(P,e,e=>{t||p(new Map(e))}).catch(()=>new Map).then(e=>{t||(p(new Map(e)),h(!1))})},250);return()=>{t=!0,clearTimeout(n)}},[P,e]),(0,w.useEffect)(()=>{if(!a)return;let e=e=>{v.current&&!v.current.contains(e.target)&&Ay(null)};return document.addEventListener(`mousedown`,e,!0),()=>document.removeEventListener(`mousedown`,e,!0)},[a]);let ie=(0,w.useMemo)(()=>{let t=new Map,r=new Set;for(let n of e){if(n.parentID||re&&!(n.title??`Untitled session`).toLowerCase().includes(re)&&!pj(n.location?.directory,te).toLowerCase().includes(re)&&!(n.location?.directory??``).toLowerCase().includes(re))continue;r.add(n.id);let e=pj(n.location?.directory,te),i=t.get(e)??[];i.push(n),t.set(e,i)}for(let e of u){if(r.has(e.id))continue;r.add(e.id);let n=pj(e.location?.directory,te),i=t.get(n)??[];i.push(e),t.set(n,i)}let i=e=>!!(o[e]||n.includes(e)),a=[...t.entries()].map(([e,t])=>({name:e,list:[...t].sort((e,t)=>{let n=i(e.id),r=i(t.id);return n===r?t.time.updated-e.time.updated:Number(r)-Number(n)})}));return a.sort((e,n)=>{let r=t.get(e.name)?.some(e=>i(e.id))??!1,a=t.get(n.name)?.some(e=>i(e.id))??!1;return r===a?0:Number(a)-Number(r)}),a},[e,u,re,te,o,n]),F=(0,w.useMemo)(()=>{if(!re||f.size===0)return[];let t=new Set(ie.flatMap(e=>e.list.map(e=>e.id))),n=new Map(e.map(e=>[e.id,e])),r=[];for(let e of f.keys()){if(t.has(e))continue;let i=n.get(e);i&&r.push(i)}return r.sort((e,t)=>t.time.updated-e.time.updated).slice(0,YA)},[e,ie,f,re]),I=ie.reduce((e,t)=>e+t.list.length,0)+F.length,oe=e=>{_(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},se=(e,t)=>{jy(e,t,P),vv(e)},ce=t!=null,le=e=>{let t=!x[e];S(n=>({...n,[e]:t})),t&&b(t=>({...t,[e]:!1}))},ue=e=>{let t=e??null;Ay(t),r===`__draft__`&&ky(t)},de=e=>b(t=>({...t,[e]:!t[e]})),fe=e=>{e.button===0&&(e.currentTarget.setPointerCapture(e.pointerId),k(!0))},pe=e=>{e.currentTarget.hasPointerCapture(e.pointerId)&&D(Math.min(ej,Math.max($A,e.clientX)))},me=e=>{e.currentTarget.hasPointerCapture(e.pointerId)&&e.currentTarget.releasePointerCapture(e.pointerId),k(!1)},he=()=>T(e=>!e);return(0,L.jsxs)(L.Fragment,{children:[M&&(0,L.jsx)(`div`,{className:`fixed inset-0 z-40 bg-black/50 md:hidden`,onClick:cv,"aria-hidden":!0}),(0,L.jsxs)(`aside`,{ref:v,"data-oc-sidebar":!0,className:`fixed inset-y-0 left-0 z-50 flex min-w-0 shrink-0 flex-col overflow-hidden border-r border-border bg-background transition-transform duration-200 md:static md:z-auto md:translate-x-0 ${M?`translate-x-0`:`-translate-x-full`} ${O?`select-none`:``}`,style:{width:C?tj:E,maxWidth:`85vw`},children:[(0,L.jsxs)(`div`,{className:`border-b border-border ${C?`flex flex-col items-center gap-2 px-2 py-2.5`:`flex items-center justify-between gap-2 px-3 py-2.5`}`,children:[(0,L.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,L.jsx)(`span`,{className:`size-1.5 shrink-0 rounded-full ${i?`bg-[var(--surface-success-strong)]`:`bg-[var(--surface-warning-strong)]`}`}),C?(0,L.jsx)(`span`,{className:`font-mono text-xs font-semibold text-foreground`,title:`OpenCode`,children:`OC`}):(0,L.jsx)(`span`,{className:`truncate text-sm font-semibold text-foreground`,children:`OpenCode`})]}),C?(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(_j,{collapsed:!0}),(0,L.jsx)(H,{variant:`ghost`,size:`icon`,onClick:he,title:`Expand sidebar`,children:(0,L.jsx)(Le,{})})]}):(0,L.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1`,children:[(0,L.jsx)(H,{variant:`ghost`,size:`icon`,onClick:he,title:`Collapse sidebar`,children:(0,L.jsx)(Ie,{})}),(0,L.jsx)(_j,{})]})]}),C?(0,L.jsx)(vj,{groups:ie,current:r,activeIDs:n,onExpand:he}):(0,L.jsxs)(L.Fragment,{children:[(0,L.jsxs)(`div`,{className:`border-b border-border p-2`,children:[(0,L.jsxs)(`div`,{className:`relative`,children:[(0,L.jsx)(Je,{className:`pointer-events-none absolute top-1/2 left-2.5 size-3.5 -translate-y-1/2 text-muted-foreground`}),(0,L.jsx)(Fm,{id:`session-search`,value:c,onChange:e=>l(e.target.value),placeholder:`Search sessions`,className:`h-7 pl-7 ${Lk?`pr-8`:`pr-12`}`}),(0,L.jsx)(`kbd`,{"aria-hidden":!0,title:`Focus session search (${Lk?`Cmd+F`:`Ctrl+F`})`,className:`pointer-events-none absolute top-1/2 right-1.5 -translate-y-1/2 rounded border border-[var(--border-weak-base)] bg-[var(--surface-inset-base)] px-1 py-px font-mono text-[9px] leading-[1.4] text-[var(--text-weaker)]`,children:Rk})]}),P.length>=XA&&(0,L.jsxs)(`p`,{className:`mt-1 px-1 text-[10px] text-[var(--text-weaker)]`,"aria-live":`polite`,children:[I,` matched`,m?` · searching messages…`:``]})]}),(0,L.jsx)(Wk,{className:`min-h-0 min-w-0 flex-1`,children:(0,L.jsxs)(`div`,{className:`w-full min-w-0 max-w-full p-2`,children:[F.length>0&&(0,L.jsxs)(`section`,{className:`mb-4 w-full min-w-0 max-w-full last:mb-1`,children:[(0,L.jsxs)(`div`,{className:`mb-1 flex min-w-0 items-center gap-2 border-b border-[var(--border-weak-base)] px-2 py-1.5`,children:[(0,L.jsx)(`span`,{className:`min-w-0 truncate text-[11px] font-medium tracking-wide text-[var(--text-weaker)] uppercase`,children:`Content matches`}),(0,L.jsx)(`span`,{className:`shrink-0 font-mono text-[10px] text-[var(--text-weaker)]`,children:F.length})]}),F.map(e=>{let t=f.get(e.id)??[],i=g.has(e.id);return(0,L.jsxs)(`div`,{className:`mb-1`,children:[(0,L.jsx)(wt,{id:`sidebar.sessionRow`,sessionID:e.id,title:e.title??`Untitled session`,updated:e.time.updated,active:n.includes(e.id),selected:e.id===r,subagentsActive:N.has(e.id),onSelect:()=>void vv(e.id)}),t.length>0&&(0,L.jsxs)(`div`,{className:`ml-2 border-l border-[var(--border-weak-base)] pl-2`,children:[(0,L.jsxs)(`button`,{type:`button`,onClick:()=>oe(e.id),className:`mb-1 flex w-full cursor-pointer items-center gap-1 text-[10px] text-[var(--text-weaker)] hover:text-[var(--text-weak)]`,children:[(0,L.jsx)(ae,{className:`size-3 shrink-0 transition-transform ${i?`-rotate-90`:``}`}),t.length,` `,t.length===1?`message`:`messages`,` match`,t.length===1?``:`es`]}),!i&&(0,L.jsxs)(`div`,{className:`flex flex-col gap-1 pb-1`,children:[t.slice(0,5).map(t=>(0,L.jsx)(`button`,{type:`button`,onClick:()=>se(e.id,t.messageID),className:`cursor-pointer rounded-md bg-[var(--surface-inset-base)] px-2 py-1 text-left text-xs leading-relaxed text-[var(--text-weak)] hover:bg-[var(--surface-base-hover)] hover:text-[var(--text-strong)]`,title:`Open session and scroll to message`,children:(0,L.jsxs)(`span`,{className:`line-clamp-2`,children:[t.snippet.slice(0,t.matchStart),(0,L.jsx)(`mark`,{className:`rounded-sm bg-yellow-500/30 px-0.5 font-medium text-[var(--text-strong)]`,children:t.snippet.slice(t.matchStart,t.matchEnd)}),t.snippet.slice(t.matchEnd)]})},t.messageID)),t.length>5&&(0,L.jsxs)(`span`,{className:`px-2 text-[10px] text-[var(--text-weaker)]`,children:[`+`,t.length-5,` more in this session`]})]})]})]},e.id)})]}),ie.length===0&&F.length===0&&(0,L.jsx)(`p`,{className:`px-2.5 py-4 text-xs text-[var(--text-weak)]`,children:e.length===0?`No sessions yet.`:`No matches.`}),ie.map(e=>{let t=!!x[e.name],i=!!y[e.name],o=t?[]:i?e.list:e.list.filter((e,t)=>t<JA||ne(e.id)),s=e.list.length-o.length,c=e.list.find(e=>e.location?.directory)?.location?.directory??null,l=!!a&&!!c&&mj(a,c);return(0,L.jsxs)(`section`,{className:`mb-4 w-full min-w-0 max-w-full last:mb-1`,children:[(0,L.jsxs)(`div`,{onClick:()=>l?le(e.name):ue(c??void 0),"aria-pressed":l,title:l?`Collapse / expand workspace`:`New session here`,className:`mb-1 flex min-w-0 cursor-pointer select-none items-center gap-2 border-b px-2 py-1.5 text-[11px] font-medium uppercase tracking-wide transition-colors ${l?`ring-1 ring-inset ring-[var(--border-selected)] bg-[var(--surface-raised-base)]`:``} ${l?``:`border-[var(--border-weak-base)]`}`,children:[(0,L.jsx)(`span`,{className:`min-w-0 truncate ${l?`text-[var(--text-weak)]`:`text-[var(--text-weaker)]`}`,children:e.name}),(0,L.jsx)(`button`,{type:`button`,"aria-expanded":!t,"aria-label":t?`Expand ${e.name}`:`Collapse ${e.name}`,onClick:t=>{t.stopPropagation(),le(e.name)},title:t?`Expand workspace`:`Collapse workspace`,className:`ml-auto inline-flex shrink-0 cursor-pointer items-center justify-center rounded-sm p-0.5 hover:bg-[var(--surface-base-hover)] hover:text-[var(--text-weak)]`,children:(0,L.jsx)(ae,{className:`size-3 shrink-0 text-[var(--text-weaker)] transition-transform ${t?`-rotate-90`:``}`})}),l&&(0,L.jsx)(`span`,{className:`shrink-0 cursor-pointer text-[var(--text-weaker)] hover:text-foreground`,title:`New session here`,onClick:e=>{e.stopPropagation(),ky(c)},children:(0,L.jsx)(Ue,{className:`size-3.5`})}),(0,L.jsx)(`span`,{className:`shrink-0 font-mono text-[10px] text-[var(--text-weaker)]`,children:e.list.length})]}),o.map(e=>{let t=n.includes(e.id),i=f.get(e.id)??[],a=g.has(e.id),o=i.length>0&&P.length>=XA;return(0,L.jsxs)(`div`,{className:`mb-0.5`,children:[(0,L.jsx)(wt,{id:`sidebar.sessionRow`,sessionID:e.id,title:e.title??`Untitled session`,updated:e.time.updated,active:t,selected:e.id===r,subagentsActive:N.has(e.id),onSelect:()=>void vv(e.id)}),o&&(0,L.jsxs)(`div`,{className:`ml-2 border-l border-[var(--border-weak-base)] pl-2`,children:[(0,L.jsxs)(`button`,{type:`button`,onClick:()=>oe(e.id),className:`mb-1 flex w-full cursor-pointer items-center gap-1 text-[10px] text-[var(--text-weaker)] hover:text-[var(--text-weak)]`,children:[(0,L.jsx)(ae,{className:`size-3 shrink-0 transition-transform ${a?`-rotate-90`:``}`}),i.length,` `,i.length===1?`message`:`messages`,` match`,i.length===1?``:`es`]}),!a&&(0,L.jsxs)(`div`,{className:`flex flex-col gap-1 pb-1`,children:[i.slice(0,5).map(t=>(0,L.jsx)(`button`,{type:`button`,onClick:()=>se(e.id,t.messageID),className:`cursor-pointer rounded-md bg-[var(--surface-inset-base)] px-2 py-1 text-left text-xs leading-relaxed text-[var(--text-weak)] hover:bg-[var(--surface-base-hover)] hover:text-[var(--text-strong)]`,title:`Open session and scroll to message`,children:(0,L.jsxs)(`span`,{className:`line-clamp-2`,children:[t.snippet.slice(0,t.matchStart),(0,L.jsx)(`mark`,{className:`rounded-sm bg-yellow-500/30 px-0.5 font-medium text-[var(--text-strong)]`,children:t.snippet.slice(t.matchStart,t.matchEnd)}),t.snippet.slice(t.matchEnd)]})},t.messageID)),i.length>5&&(0,L.jsxs)(`span`,{className:`px-2 text-[10px] text-[var(--text-weaker)]`,children:[`+`,i.length-5,` more in this session`]})]})]})]},e.id)}),!t&&s>0&&(0,L.jsx)(`button`,{type:`button`,onClick:()=>de(e.name),className:`mt-1 w-full cursor-pointer rounded-md px-2.5 py-1.5 text-left text-xs text-[var(--text-weaker)] transition-colors hover:bg-[var(--surface-base-hover)] hover:text-[var(--text-weak)]`,children:i?`Show less`:`Show ${s} more…`})]},e.name)}),ce&&(0,L.jsx)(`button`,{type:`button`,onClick:()=>void jg(),className:`w-full cursor-pointer rounded-md px-2.5 py-2 text-center text-xs text-[var(--text-weaker)] transition-colors hover:bg-[var(--surface-base-hover)] hover:text-[var(--text-weak)]`,children:`Load more sessions`})]})}),(0,L.jsx)(yj,{onFiles:()=>A(!0)})]}),C&&(0,L.jsxs)(`div`,{className:`flex flex-col items-center gap-1 border-t border-border p-2`,children:[(0,L.jsx)(`button`,{type:`button`,onClick:()=>A(!0),className:`inline-flex cursor-pointer rounded-md p-1.5 text-[var(--text-weak)] hover:bg-[var(--surface-base-hover)] hover:text-foreground`,title:`Files`,children:(0,L.jsx)(Te,{className:`size-4`})}),(0,L.jsx)(`button`,{type:`button`,onClick:()=>VA(),className:`inline-flex cursor-pointer rounded-md p-1.5 text-[var(--text-weak)] hover:bg-[var(--surface-base-hover)] hover:text-foreground`,title:`Settings`,children:(0,L.jsx)(Ze,{className:`size-4`})})]}),(0,L.jsx)(pA,{open:ee,onOpenChange:A}),(0,L.jsx)(WA,{}),!C&&(0,L.jsx)(`div`,{role:`separator`,"aria-orientation":`vertical`,"aria-label":`Resize sidebar`,"aria-valuemin":$A,"aria-valuemax":ej,"aria-valuenow":E,tabIndex:0,onPointerDown:fe,onPointerMove:pe,onPointerUp:me,onPointerCancel:me,onDoubleClick:()=>D(QA),onKeyDown:e=>{if(e.key!==`ArrowLeft`&&e.key!==`ArrowRight`)return;e.preventDefault();let t=e.key===`ArrowRight`?16:-16;D(e=>Math.min(ej,Math.max($A,e+t)))},className:`absolute top-0 right-0 z-20 hidden h-full w-1 cursor-col-resize touch-none bg-transparent transition-colors hover:bg-[var(--border-hover)] focus:bg-[var(--border-selected)] focus:outline-none md:block`})]})]})}function gj(){let[e,t]=(0,w.useState)(null);return(0,w.useEffect)(()=>{let e=!1;return fetch(`/api/webui/config`).then(e=>e.ok?e.json():null).then(n=>{!e&&n?.version&&t(n.version)}).catch(()=>{}),()=>{e=!0}},[]),e?(0,L.jsxs)(`span`,{className:`shrink-0 font-mono text-[10px] text-[var(--text-weaker)]`,title:`webui v${e}`,children:[`v`,e]}):null}function _j({collapsed:e=!1}){return(0,L.jsx)(H,{asChild:!0,variant:`default`,size:e?`icon`:`sm`,children:(0,L.jsxs)(`a`,{href:hg,"aria-label":`New session`,title:e?`New session`:void 0,onClick:e=>{e.button!==0||e.metaKey||e.ctrlKey||e.shiftKey||e.altKey||(e.preventDefault(),ky(null))},children:[(0,L.jsx)(Ue,{}),!e&&(0,L.jsx)(`span`,{className:`truncate`,children:`New session`})]})})}function vj({groups:e,current:t,activeIDs:n,onExpand:r}){return(0,L.jsx)(Wk,{className:`min-h-0 min-w-0 flex-1`,children:(0,L.jsx)(`div`,{className:`flex w-full min-w-0 flex-col items-center gap-3 p-2`,children:e.map(e=>(0,L.jsxs)(`section`,{className:`flex w-full flex-col items-center gap-1.5 border-b border-[var(--border-weak-base)] pb-3 last:border-b-0`,children:[(0,L.jsx)(`button`,{type:`button`,onClick:r,title:`${e.name} (${e.list.length} sessions)`,className:`inline-flex size-8 cursor-pointer items-center justify-center rounded-md text-[var(--text-weak)] hover:bg-[var(--surface-base-hover)] hover:text-foreground`,children:(0,L.jsx)(Te,{className:`size-4`})}),e.list.slice(0,JA).map(e=>(0,L.jsx)(Sj,{id:e.id,title:e.title??`Untitled session`,selected:e.id===t,active:n.includes(e.id),onSelect:()=>void vv(e.id)},e.id)),e.list.length>JA&&(0,L.jsxs)(`button`,{type:`button`,onClick:r,title:`Open workspace to see ${e.list.length-JA} more sessions`,className:`inline-flex size-8 cursor-pointer items-center justify-center rounded-md text-[10px] text-[var(--text-weaker)] hover:bg-[var(--surface-base-hover)] hover:text-foreground`,children:[`+`,e.list.length-JA]})]},e.name))})})}function yj({onFiles:e}){return(0,L.jsx)(`div`,{className:`flex min-w-0 flex-wrap items-center justify-between gap-x-3 gap-y-1 border-t border-border px-3 py-2 text-xs text-[var(--text-weak)]`,children:(0,L.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-x-3 gap-y-1`,children:[(0,L.jsxs)(`button`,{type:`button`,onClick:e,className:`inline-flex cursor-pointer items-center gap-1.5 hover:text-foreground`,children:[(0,L.jsx)(Te,{className:`size-3`}),`Files`]}),(0,L.jsxs)(`button`,{type:`button`,onClick:()=>VA(),className:`inline-flex cursor-pointer items-center gap-1.5 hover:text-foreground`,children:[(0,L.jsx)(Ze,{className:`size-3`}),`Settings`]}),(0,L.jsx)(gj,{}),(0,L.jsx)(xj,{})]})})}function bj(){let[e,t]=(0,w.useState)(0);return(0,w.useEffect)(()=>mt(()=>t(e=>e+1)),[]),e}function xj(){let e=bj(),t=(0,w.useMemo)(()=>Tt(`pages`),[e]);return t.length===0?null:(0,L.jsx)(L.Fragment,{children:t.map(e=>(0,L.jsxs)(`a`,{href:`/ext/${e.id}`,title:e.item.description?`${e.item.title} — ${e.item.description}`:e.item.title,onClick:t=>{t.button!==0||t.metaKey||t.ctrlKey||t.shiftKey||t.altKey||(t.preventDefault(),window.history.pushState({},``,`/ext/${e.id}`),window.dispatchEvent(new Event(ZA)))},className:`inline-flex cursor-pointer items-center gap-1.5 hover:text-foreground`,children:[(0,L.jsx)(Ge,{className:`size-3`}),e.item.title]},e.id))})}function Sj({id:e,title:t,selected:n,active:r,onSelect:i}){return(0,L.jsxs)(`a`,{href:gg(e),title:t,"aria-label":t,"aria-current":n?`page`:void 0,onClick:e=>Cj(e,i),onMouseEnter:()=>Pv(e),onFocus:()=>Pv(e),className:`relative inline-flex size-8 items-center justify-center rounded-md text-xs font-medium transition-colors ${n?`bg-[var(--surface-raised-base)] text-foreground`:`text-[var(--text-weak)] hover:bg-[var(--surface-base-hover)] hover:text-foreground`}`,children:[(t.trim()[0]??`S`).toUpperCase(),r&&(0,L.jsx)(`span`,{className:`absolute right-0.5 bottom-0.5 size-1.5 rounded-full bg-[var(--surface-success-strong)]`})]})}function Cj(e,t){e.button!==0||e.metaKey||e.ctrlKey||e.shiftKey||e.altKey||(e.preventDefault(),t())}function wj({id:e,title:t,updated:n,active:r,selected:i,subagentsActive:a,onSelect:o}){let[s,c]=(0,w.useState)(!1);return(0,L.jsx)(uj,{sessionID:e,children:(0,L.jsxs)(`div`,{className:`group relative mb-0.5 w-full min-w-0 max-w-full`,children:[(0,L.jsxs)(`a`,{href:gg(e),title:t,"aria-current":i?`page`:void 0,onClick:e=>Cj(e,o),onMouseEnter:()=>Pv(e),onFocus:()=>Pv(e),className:`block w-full min-w-0 max-w-full overflow-hidden rounded-md px-2.5 py-2 pr-12 transition-colors ${i?`bg-[var(--surface-raised-base)]`:`hover:bg-[var(--surface-base-hover)]`}`,children:[(0,L.jsxs)(`div`,{className:`flex min-w-0 max-w-full items-center gap-2`,children:[a&&(0,L.jsx)(`span`,{title:`Subagents running`,"aria-label":`Subagents running`,className:`size-1.5 shrink-0 animate-pulse rounded-full bg-[var(--surface-success-strong)]`}),(0,L.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-[13px] font-medium text-foreground`,children:t}),r&&(0,L.jsx)(ub,{className:`shrink-0 border-transparent bg-[var(--surface-success-base)] text-[var(--text-on-success-base)]`,children:`run`})]}),(0,L.jsxs)(`div`,{className:`mt-0.5 flex min-w-0 max-w-full items-center gap-2 text-xs text-[var(--text-weak)]`,children:[(0,L.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-mono text-[11px] text-[var(--text-weaker)]`,children:e.slice(0,12)}),(0,L.jsx)(`span`,{className:`shrink-0`,children:gb(n)})]})]}),(0,L.jsx)(`div`,{className:`invisible absolute right-2 bottom-1.5 flex items-center gap-1 group-hover:visible group-focus-within:visible`,children:s?(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(`button`,{type:`button`,className:`cursor-pointer text-[var(--text-on-critical-strong)] hover:text-[var(--text-on-critical-base)]`,onClick:()=>{W.deleteSession(e).then(Ag),i&&vv(null)},children:`yes`}),(0,L.jsx)(`button`,{type:`button`,className:`cursor-pointer text-[var(--text-weak)] hover:text-foreground`,onClick:()=>c(!1),children:`no`})]}):(0,L.jsx)(`button`,{type:`button`,title:`Delete session`,"aria-label":`Delete ${t}`,className:`cursor-pointer text-[var(--text-weaker)] hover:text-[var(--text-on-critical-base)]`,onClick:()=>c(!0),children:(0,L.jsx)(ot,{className:`size-3.5`})})})]})})}vt({sidebar:e=>(0,L.jsx)(hj,{}),"sidebar.sessionRow":e=>(0,L.jsx)(wj,{id:e.sessionID,title:e.title,updated:e.updated,active:e.active,selected:e.selected,subagentsActive:e.subagentsActive,onSelect:e.onSelect})});function Tj({defaultTagName:e,props:t,render:n,state:r={},stateAttributesMapping:i}){let a=Ej(Dj(r,i),t);if(!n)return w.createElement(e,a);if(typeof n==`function`)return n(a,r);if(!w.isValidElement(n))return null;let o=n.props,s={...Ej(a,o),ref:Aj(a.ref,o.ref)};return w.cloneElement(n,s)}function Ej(...e){let t={};for(let n of e){if(!n)continue;let e=n;for(let n of Object.keys(e)){let r=e[n];if(r===void 0)continue;let i=t[n];t[n]=n===`className`?[i,r].filter(Boolean).join(` `):n===`style`?{...i,...r}:n===`ref`?Aj(i,r):kj(n)&&typeof i==`function`&&typeof r==`function`?Oj(r,i):r}}return t}function Dj(e,t){let n={};for(let r of Object.keys(e)){let i=e[r],a=t?.[r]?.(i);if(a){Object.assign(n,a);continue}if(r===`slot`){n[`data-slot`]=i;continue}let o=`data-${String(r).replace(/[A-Z]/g,e=>`-${e.toLowerCase()}`)}`;typeof i==`boolean`?n[o]=i?``:void 0:i!=null&&(n[o]=String(i))}return n}function Oj(e,t){return function(n){e(n),n.defaultPrevented||t(n)}}function kj(e){return/^on[A-Z]/.test(e)}function Aj(...e){let t=e.filter(Boolean);if(t.length!==0)return e=>{for(let n of t)typeof n==`function`?n(e):n&&(n.current=e)}}var jj=8,Mj=64,Nj=0,Pj=.5,Fj=180,Ij=new Set([`ArrowDown`,`ArrowUp`,`End`,`Home`,`PageDown`,`PageUp`,` `]),Lj={start:!1,end:!1},Rj={currentAnchorId:null,visibleMessageIds:[]};function zj({content:e,scrollEdgeThreshold:t,spacer:n,viewport:r}){if(!r||!e)return Lj;let i=Zj({content:e,spacer:n,viewport:r});return{start:r.scrollTop>t,end:i-r.scrollTop-r.clientHeight>t}}function Bj({content:e,scrollMargin:t,scrollPreviousItemPeek:n,spacer:r,viewport:i,visibleMessageIds:a}){if(!e||!i)return Rj;let o=i.getBoundingClientRect(),s=o.top+t+n,c=typeof IntersectionObserver>`u`,l=[],u=null;for(let t of Vj(e,r)){let e=t.dataset.messageId;if(!e)continue;let n=t.dataset.scrollAnchor===`true`,r=n||c?t.getBoundingClientRect():null;(c&&r?r.bottom>s&&r.top<o.bottom:a.has(e))&&l.push(e),n&&r&&r.top<=s+Pj&&(u=e)}return l.length===0&&u===null?Rj:{currentAnchorId:u,visibleMessageIds:l}}function Vj(e,t){return Array.from(e.children).filter(e=>e instanceof HTMLElement&&e!==t)}function Hj(e,t){for(let n=t;n<e.length;n++){let t=e[n];if(t?.dataset.scrollAnchor===`true`)return t}return null}function Uj(e,t){for(let n of e)if(n.dataset.scrollAnchor===`true`&&!t.has(n))return n;return null}function Wj(e,t){let n=0;for(let r=t;r<e.length;r++)if(e[r]?.dataset.scrollAnchor===`true`&&(n+=1,n>1))return!0;return!1}function Gj(e){for(let t=e.length-1;t>=0;t--){let n=e[t];if(n?.dataset.scrollAnchor===`true`)return n}return null}function Kj({content:e,spacer:t,viewport:n}){let r=n.getBoundingClientRect();for(let n of Vj(e,t)){if(!n.dataset.messageId)continue;let e=n.getBoundingClientRect();if(e.bottom>r.top&&e.top<r.bottom)return n}return null}function qj({align:e,element:t,scrollMargin:n,spacer:r,viewport:i}){let a=Jj(t,i),o=t.getBoundingClientRect().height,s=eM(r);if(e===`center`){let e=Math.max(0,i.clientHeight-s.start-s.end);return a-s.start-(e-o)/2-n}if(e===`end`)return a-i.clientHeight+o+s.end+n;if(e===`nearest`){let e=a+o,t=i.scrollTop+s.start,r=i.scrollTop+i.clientHeight-s.end;return a>=t&&e<=r?i.scrollTop:a<t?a-s.start-n:e-i.clientHeight+s.end+n}return a-s.start-n}function Jj(e,t){let n=e.getBoundingClientRect(),r=t.getBoundingClientRect();return n.top-r.top+t.scrollTop}function Yj(e,t){return e.getBoundingClientRect().top-t.getBoundingClientRect().top}function Xj({content:e,scrollTop:t,spacer:n,viewport:r}){let i=Zj({content:e,spacer:n,viewport:r});return t+r.clientHeight-i}function Zj({content:e,spacer:t,viewport:n}){let r=Vj(e,t),i=$j(e),a=n.getBoundingClientRect(),o=n.scrollTop,s=i.start+i.end;for(let e of r){let t=e.getBoundingClientRect();s=Math.max(s,t.bottom-a.top+o+i.end)}return s}function Qj(e){return Math.max(0,e.scrollHeight-e.clientHeight)}function $j(e){let t=window.getComputedStyle(e);return{end:nM(t.paddingBlockEnd||t.paddingBottom),start:nM(t.paddingBlockStart||t.paddingTop)}}function eM(e){let t=e?.parentElement;return t?$j(t):{end:0,start:0}}function tM(e){if(!e)return 0;let t=window.getComputedStyle(e);return nM(t.rowGap===`normal`?t.gap:t.rowGap)}function nM(e){if(!e)return 0;let t=Number.parseFloat(e);return Number.isFinite(t)?t:0}function rM({refs:e,commitScrollState:t,scheduleStateCommit:n,scheduleVisibilitySync:r}){let{streamingTurnRef:i,autoScrollRef:a,autoscrollingRef:o,autoscrollingTimeoutRef:s,contentRef:c,defaultScrollPositionAppliedRef:l,itemCountRef:u,messageElementsRef:d,modeRef:f,pendingScrollToMessageRef:p,prependRestoreRef:m,scrollMarginRef:h,scrollPreviousItemPeekRef:g,spacerGapRef:_,spacerHeightRef:v,spacerRef:y,viewportRef:b}=e,x=w.useCallback(e=>{s.current!==null&&(window.clearTimeout(s.current),s.current=null),o.current!==e&&(o.current=e,t()),e&&(s.current=window.setTimeout(()=>{s.current=null,o.current=!1,t()},Fj))},[t]),S=w.useCallback(e=>{let t=y.current;if(!t)return;let n=Math.max(0,Math.ceil(e));v.current!==n&&(v.current=n,t.hidden=n===0,t.style.height=`${n}px`,t.style.marginTop=n>0?`${-_.current}px`:``)},[]),C=w.useCallback((e,{behavior:r=`auto`,autoscrolling:i=!1}={})=>{let a=b.current;if(!a)return;let o=Math.max(0,e);if(Math.abs(a.scrollTop-o)<=Pj){a.scrollTop=o,t();return}i&&x(!0),a.scrollTo({top:o,behavior:r}),n()},[t,n,x]),T=w.useCallback(({behavior:e=`auto`}={})=>b.current?(S(0),i.current=null,f.current=`free-scrolling`,C(0,{behavior:e}),r(),!0):!1,[r,C,S]),E=w.useCallback(({behavior:e=`auto`}={})=>{let t=b.current;return t?(S(0),i.current=null,f.current=a.current?`following-bottom`:`free-scrolling`,C(Qj(t),{autoscrolling:!0,behavior:e}),r(),!0):!1},[r,C,S]),D=w.useCallback((e,{align:t=`start`,behavior:n=`auto`,scrollMargin:a=h.current}={},{keepPreviousPeek:o=!1}={})=>{let s=c.current,l=b.current;if(!s||!l||!s.contains(e))return!1;let u=qj({align:t,element:e,scrollMargin:o?a+g.current:a,spacer:y.current,viewport:l}),d=Xj({content:s,scrollTop:u,spacer:y.current,viewport:l});return S(d),m.current={element:e,viewportTop:Yj(e,l)},f.current=o?`anchored-to-message`:`settling-jump`,i.current=o?e:null,C(u,{behavior:n}),r(),!0},[r,C,S]),O=w.useCallback(()=>{let e=i.current;return!e||!e.isConnected||f.current!==`anchored-to-message`?!1:D(e,{align:`start`},{keepPreviousPeek:!0})},[D]),k=w.useCallback((e,t)=>{let n=d.current.get(e);return n?(l.current=!0,D(n,t)?(p.current=null,!0):(p.current={messageId:e,options:t},!0)):u.current===0&&(p.current={messageId:e,options:t},l.current=!0,!0)},[D]);return{flushPendingScrollToMessage:w.useCallback(()=>{let e=p.current;if(!e)return!1;let t=d.current.get(e.messageId);return!t||!D(t,e.options)?!1:(p.current=null,l.current=!0,!0)},[D]),reanchorToAnchoredMessage:O,scrollToElement:D,scrollToEnd:E,scrollToMessage:k,scrollToStart:T}}function iM(e,t){let n=e,r=new Set;return{getSnapshot:()=>n,hasListeners:()=>r.size>0,setSnapshot:e=>{t(n,e)||(n=e,r.forEach(e=>e()))},subscribe:(e,t,n)=>{let i=r.size===0;return r.add(e),i&&t?.(),()=>{r.delete(e),r.size===0&&n?.()}}}}function aM(e,t){return iM(e,t)}function oM(){return iM(Rj,cM)}function sM(e,t){return e.start===t.start&&e.end===t.end}function cM(e,t){return e.currentAnchorId!==t.currentAnchorId||e.visibleMessageIds.length!==t.visibleMessageIds.length?!1:e.visibleMessageIds.every((e,n)=>e===t.visibleMessageIds[n])}function lM({autoScroll:e,scrollEdgeThreshold:t,scrollMargin:n,scrollPreviousItemPeek:r}){let i=w.useRef(e),a=w.useRef(!1),o=w.useRef(null),s=w.useRef(!1),c=w.useRef(t),l=w.useRef(0),u=w.useRef(null),d=w.useRef(0),f=w.useRef(e?`following-bottom`:`free-scrolling`),p=w.useRef(new Map),m=w.useRef(null),h=w.useRef(null),g=w.useRef(null),_=w.useRef(r),v=w.useRef(!0),y=w.useRef(null),b=w.useRef(n),x=w.useRef(null),S=w.useRef(0),C=w.useRef(0),T=w.useRef(null),E=w.useRef(null),D=w.useRef(null),O=w.useRef(null),k=w.useRef(null),ee=w.useRef(null),A=w.useRef(null),j=w.useRef(null),M=w.useRef(new Set),te=w.useRef(new WeakSet);return D.current===null&&(D.current=aM(Lj,sM)),j.current===null&&(j.current=oM()),i.current=e,c.current=t,b.current=n,_.current=r,{autoScrollRef:i,autoscrollingRef:a,autoscrollingTimeoutRef:O,streamingTurnRef:g,contentRef:o,defaultScrollPositionAppliedRef:s,firstItemRef:u,itemCountRef:l,lastScrollTopRef:d,messageElementsRef:p,modeRef:f,pendingScrollFrameRef:x,pendingScrollToMessageRef:m,prependRestoreRef:h,preserveScrollOnPrependRef:v,rootRef:y,scrollEdgeThresholdRef:c,scrollMarginRef:b,scrollPreviousItemPeekRef:_,spacerGapRef:S,spacerHeightRef:C,spacerRef:T,stateFrameRef:E,stateStore:D.current,viewportRef:k,visibilityFrameRef:ee,visibilityObserverRef:A,visibilityStore:j.current,visibleMessageIdsRef:M,handledScrollAnchorsRef:te}}function uM(e,t){return w.useCallback(n=>{e.current=n,n&&t()},[e,t])}function dM({autoScroll:e=!1,defaultScrollPosition:t=`end`,scrollEdgeThreshold:n=jj,scrollPreviousItemPeek:r=Mj,scrollMargin:i=Nj}){let a=lM({autoScroll:e,scrollEdgeThreshold:n,scrollMargin:i,scrollPreviousItemPeek:r}),{streamingTurnRef:o,autoScrollRef:s,autoscrollingRef:c,autoscrollingTimeoutRef:l,contentRef:u,defaultScrollPositionAppliedRef:d,firstItemRef:f,itemCountRef:p,lastScrollTopRef:m,messageElementsRef:h,modeRef:g,pendingScrollFrameRef:_,pendingScrollToMessageRef:v,prependRestoreRef:y,preserveScrollOnPrependRef:b,rootRef:x,scrollEdgeThresholdRef:S,scrollMarginRef:C,scrollPreviousItemPeekRef:T,spacerGapRef:E,spacerHeightRef:D,spacerRef:O,stateFrameRef:k,stateStore:ee,viewportRef:A,visibilityFrameRef:j,visibilityObserverRef:M,visibilityStore:te,visibleMessageIdsRef:ne,handledScrollAnchorsRef:N}=a,P=w.useRef(t);P.current!==t&&(P.current=t,d.current=!1);let re=w.useCallback(e=>{let t=x.current,n=A.current,r=[e.start&&`start`,e.end&&`end`].filter(Boolean).join(` `),i=c.current;for(let e of[t,n])e&&(r?e.setAttribute(`data-scrollable`,r):e.removeAttribute(`data-scrollable`),e.toggleAttribute(`data-autoscrolling`,i))},[]),ie=w.useCallback(e=>{let t=A.current?.scrollTop??0,n=t<m.current-Pj;m.current=t,s.current&&!e.end&&g.current!==`settling-jump`&&g.current!==`anchored-to-message`?g.current=`following-bottom`:g.current===`following-bottom`&&e.end&&n&&!c.current&&(g.current=`free-scrolling`)},[]),ae=w.useCallback(()=>{let e=zj({content:u.current,scrollEdgeThreshold:S.current,spacer:O.current,viewport:A.current});ie(e);let t=g.current===`following-bottom`?{...e,end:!1}:e;re(t),ee.setSnapshot(t)},[ie,ee,re]),F=w.useCallback(()=>{k.current===null&&(k.current=window.requestAnimationFrame(()=>{k.current=null,ae()}))},[ae]),I=w.useCallback(()=>{te.hasListeners()&&j.current===null&&(j.current=window.requestAnimationFrame(()=>{j.current=null,te.hasListeners()&&te.setSnapshot(Bj({content:u.current,scrollMargin:C.current,scrollPreviousItemPeek:T.current,spacer:O.current,viewport:A.current,visibleMessageIds:ne.current}))}))},[te]),{flushPendingScrollToMessage:oe,reanchorToAnchoredMessage:se,scrollToElement:ce,scrollToEnd:le,scrollToMessage:ue,scrollToStart:de}=rM({refs:a,commitScrollState:ae,scheduleStateCommit:F,scheduleVisibilitySync:I}),fe=w.useCallback(()=>{let e=y.current,t=A.current;if(!e||!t||!e.element.isConnected)return!1;let n=Yj(e.element,t)-e.viewportTop;return Math.abs(n)<=Pj?!1:(t.scrollTop+=n,e.viewportTop=Yj(e.element,t),F(),I(),!0)},[F,I]),pe=w.useCallback(()=>{let e=u.current,t=A.current;if(!e||!t){y.current=null;return}let n=Kj({content:e,spacer:O.current,viewport:t});y.current=n?{element:n,viewportTop:Yj(n,t)}:null},[]),me=w.useCallback(()=>{_.current===null&&(_.current=window.requestAnimationFrame(()=>{_.current=null,oe()&&pe()}))},[pe,oe]),he=w.useCallback(()=>{if(!t||d.current||p.current===0)return!1;let e=!1;if(t===`last-anchor`){let t=u.current,n=A.current,r=t&&n?Gj(Vj(t,O.current)):null;if(!t||!n||!r)e=le({behavior:`auto`});else{let i=Jj(r,n);e=Zj({content:t,spacer:O.current,viewport:n})-i<=n.clientHeight?le({behavior:`auto`}):ce(r,{align:`start`},{keepPreviousPeek:!0})}}else e=t===`end`?le({behavior:`auto`}):de({behavior:`auto`});return e?(d.current=!0,!0):!1},[t,ce,le,de]),ge=w.useCallback(()=>{let e=u.current;if(!e)return;let t=Vj(e,O.current),n=p.current,r=f.current;p.current=t.length,f.current=t[0]??null,(()=>{if(oe())return;if(n===0){if(he()||t.length>0&&s.current&&le({behavior:`auto`}))return;ae(),I();return}let e=r?t.indexOf(r):-1;if(b.current&&e>0){fe();return}if(t.length>n){let e=Hj(t,n);if(e){if(s.current&&g.current===`following-bottom`&&Wj(t,n)){le({behavior:`auto`});return}ce(e,{align:`start`},{keepPreviousPeek:!0}),N.current.add(e);return}}if(t.length===n){let e=Uj(t,N.current);if(e){ce(e,{align:`start`},{keepPreviousPeek:!0}),N.current.add(e);return}}g.current===`following-bottom`&&s.current?le({behavior:`auto`}):(ae(),I())})(),pe()},[he,pe,ae,oe,fe,I,ce,le]),_e=w.useCallback(()=>{if(g.current===`following-bottom`&&s.current){le({behavior:`auto`});return}let e=D.current;if(se()){s.current&&e>0&&D.current===0&&le({behavior:`auto`});return}F(),I()},[se,F,I,le]),ve=w.useCallback(()=>{let e=A.current;if(!(!e||!te.hasListeners())){if(typeof IntersectionObserver>`u`){I();return}M.current||=new IntersectionObserver(e=>{for(let t of e){let e=t.target.dataset.messageId;e&&(t.isIntersecting?ne.current.add(e):ne.current.delete(e))}I()},{root:e,rootMargin:`${-(C.current+T.current)}px 0px 0px 0px`,threshold:[0,.01,.5,1]}),h.current.forEach(e=>{M.current?.observe(e)}),I()}},[I,te]),ye=w.useCallback(()=>{j.current!==null&&(window.cancelAnimationFrame(j.current),j.current=null),M.current?.disconnect(),M.current=null,ne.current.clear(),te.setSnapshot(Rj)},[te]),be=w.useCallback((e,t,n)=>{if(t){h.current.set(e,t),M.current?.observe(t),I(),v.current?.messageId===e&&me();return}n&&h.current.get(e)===n&&(h.current.delete(e),ne.current.delete(e),M.current?.unobserve(n),I())},[me,I]),xe=w.useCallback(()=>{(g.current===`following-bottom`||g.current===`anchored-to-message`||g.current===`settling-jump`)&&(o.current=null,g.current=`free-scrolling`)},[]),Se=w.useCallback(()=>re(ee.getSnapshot()),[ee,re]),Ce=uM(x,Se),we=uM(A,Se),Te=w.useCallback(e=>{u.current=e},[]),Ee=w.useCallback(e=>{O.current=e,E.current=tM(e?.parentElement??null)},[]),De=w.useCallback(()=>{ae(),I(),pe()},[pe,ae,I]),Oe=w.useMemo(()=>({handleContentChange:ge,handleResize:_e,observeVisibility:ve,preserveScrollOnPrependRef:b,scrollToEnd:le,scrollToMessage:ue,scrollToStart:de,setContentElement:Te,setRootElement:Ce,setSpacerElement:Ee,setViewportElement:we,stateStore:ee,syncAfterScroll:De,unobserveVisibility:ye,userScrollIntent:xe,viewportRef:A,visibilityStore:te}),[ge,_e,ve,le,ue,de,Te,Ce,Ee,we,ee,De,ye,xe,te]);return w.useLayoutEffect(()=>{he()},[he]),w.useEffect(()=>()=>{k.current!==null&&(window.cancelAnimationFrame(k.current),k.current=null),j.current!==null&&(window.cancelAnimationFrame(j.current),j.current=null),l.current!==null&&(window.clearTimeout(l.current),l.current=null),_.current!==null&&(window.cancelAnimationFrame(_.current),_.current=null),M.current?.disconnect(),M.current=null},[]),w.useLayoutEffect(()=>{if(e&&g.current===`following-bottom`&&p.current>0){le({behavior:`auto`});return}ae()},[e,ae,le]),{context:Oe,registerMessage:be}}function fM(e){let t=w.useRef(e);return t.current=e,t}var pM=w.createContext(null),mM=w.createContext(null);function hM(){let e=w.useContext(pM);if(!e)throw Error(`useMessageScroller must be used within a MessageScroller.`);return e}function gM(){let e=w.useContext(mM);if(!e)throw Error(`MessageScrollerItem must be used within a MessageScroller.`);return e}function _M(){let{scrollToEnd:e,scrollToMessage:t,scrollToStart:n}=hM();return w.useMemo(()=>({scrollToEnd:e,scrollToMessage:t,scrollToStart:n}),[e,t,n])}function vM({autoScroll:e=!1,children:t,defaultScrollPosition:n=`end`,scrollEdgeThreshold:r,scrollPreviousItemPeek:i,scrollMargin:a}){let{context:o,registerMessage:s}=dM({autoScroll:e,defaultScrollPosition:n,scrollEdgeThreshold:r,scrollPreviousItemPeek:i,scrollMargin:a});return(0,L.jsx)(pM.Provider,{value:o,children:(0,L.jsx)(mM.Provider,{value:s,children:t})})}function yM({children:e,...t}){let{setRootElement:n}=hM();return(0,L.jsx)(`div`,{ref:n,...t,children:e})}function bM({"aria-label":e,children:t,onKeyDown:n,onScroll:r,onTouchMove:i,onWheel:a,preserveScrollOnPrepend:o=!0,ref:s,role:c,tabIndex:l,...u}){let{handleResize:d,preserveScrollOnPrependRef:f,setViewportElement:p,syncAfterScroll:m,userScrollIntent:h,viewportRef:g}=hM();f.current=o;let _=w.useCallback(e=>{p(e),Aj(s)?.(e)},[s,p]);function v(e){m(),r?.(e)}function y(e){h(),a?.(e)}function b(e){h(),i?.(e)}function x(e){Ij.has(e.key)&&h(),n?.(e)}return w.useEffect(()=>{let e=g.current;if(!e||typeof ResizeObserver>`u`)return;let t=0,n=new ResizeObserver(()=>{window.cancelAnimationFrame(t),t=window.requestAnimationFrame(d)});return n.observe(e),()=>{window.cancelAnimationFrame(t),n.disconnect()}},[d,g]),(0,L.jsx)(`div`,{ref:_,role:c??`region`,"aria-label":e??`Messages`,tabIndex:l??0,onKeyDown:x,onScroll:v,onTouchMove:b,onWheel:y,...u,children:t})}function xM({"aria-relevant":e,children:t,ref:n,role:r,spacerClassName:i,...a}){let{handleContentChange:o,handleResize:s,setContentElement:c,setSpacerElement:l}=hM(),u=w.useRef(null),d=w.useCallback(e=>{u.current=e,c(e),Aj(n)?.(e)},[n,c]);return w.useLayoutEffect(()=>{let e=u.current;if(!e||(o(),typeof MutationObserver>`u`))return;let t=new MutationObserver(()=>{o()});return t.observe(e,{childList:!0}),()=>t.disconnect()},[o]),w.useEffect(()=>{let e=u.current;if(!e||typeof ResizeObserver>`u`)return;let t=0,n=new ResizeObserver(()=>{window.cancelAnimationFrame(t),t=window.requestAnimationFrame(s)});return n.observe(e),()=>{window.cancelAnimationFrame(t),n.disconnect()}},[s]),(0,L.jsxs)(`div`,{ref:d,role:r??`log`,"aria-relevant":e??`additions`,...a,children:[t,(0,L.jsx)(`div`,{ref:l,"aria-hidden":`true`,"data-message-scroller-spacer":``,hidden:!0,className:i})]})}function SM({messageId:e,ref:t,scrollAnchor:n=!1,...r}){let i=gM(),a=w.useRef(null),o=w.useCallback(n=>{let r=a.current;a.current=n,e&&i(e,n,r),Aj(t)?.(n)},[e,t,i]);return(0,L.jsx)(`div`,{ref:o,"data-message-id":e,"data-scroll-anchor":n?`true`:`false`,...r})}function CM({behavior:e=`smooth`,children:t,direction:n=`end`,onClick:r,render:i,tabIndex:a,type:o=`button`,...s}){let{scrollToEnd:c,scrollToStart:l,stateStore:u}=hM(),d=fM(r),f=w.useCallback(e=>u.subscribe(e),[u]),p=w.useCallback(()=>{let e=u.getSnapshot();return n===`start`?e.start:e.end},[n,u]),m=w.useSyncExternalStore(f,p,p),h=w.useCallback(t=>{m&&(d.current?.(t),t.defaultPrevented||(t.currentTarget.blur(),n===`start`?l({behavior:e}):c({behavior:e})))},[e,n,m,d,c,l]);return Tj({defaultTagName:`button`,props:Ej({type:o,inert:!m,tabIndex:m?a:-1,children:t??(0,L.jsxs)(`span`,{children:[`Scroll to `,n]}),onClick:h},s),render:i,state:{active:m,direction:n},stateAttributesMapping:{active:e=>({"data-active":e?`true`:`false`})}})}var wM={Provider:vM,Root:yM,Viewport:bM,Content:xM,Item:SM,Button:CM};function TM(e){return(0,L.jsx)(wM.Provider,{...e})}function EM({className:e,...t}){return(0,L.jsx)(wM.Root,{"data-slot":`message-scroller`,className:B(`group/message-scroller relative flex size-full min-h-0 flex-col overflow-hidden`,e),...t})}function DM({className:e,...t}){return(0,L.jsx)(wM.Viewport,{"data-slot":`message-scroller-viewport`,className:B(`size-full min-h-0 min-w-0 scroll-fade-b scrollbar-thin scrollbar-gutter-stable overflow-y-auto overscroll-contain contain-content [overflow-anchor:none]`,e),...t})}function OM({className:e,...t}){return(0,L.jsx)(wM.Content,{"data-slot":`message-scroller-content`,className:B(`flex h-max min-h-full flex-col gap-6`,e),...t})}function kM({className:e,scrollAnchor:t=!1,...n}){return(0,L.jsx)(wM.Item,{"data-slot":`message-scroller-item`,scrollAnchor:t,className:B(`min-w-0 shrink-0 [contain-intrinsic-size:auto_10rem] [content-visibility:auto]`,e),...n})}function AM({direction:e=`end`,className:t,children:n,render:r,variant:i=`secondary`,size:a=`icon-sm`,...o}){return(0,L.jsx)(wM.Button,{"data-slot":`message-scroller-button`,"data-direction":e,"data-variant":i,"data-size":a,direction:e,className:B(`absolute inset-s-1/2 -translate-x-1/2 border-border bg-background text-foreground transition-[translate,scale,opacity] duration-200 hover:bg-muted hover:text-foreground data-[active=false]:pointer-events-none data-[active=false]:scale-95 data-[active=false]:opacity-0 data-[active=false]:duration-400 data-[active=false]:ease-[cubic-bezier(0.7,0,0.84,0)] data-[active=true]:translate-y-0 data-[active=true]:scale-100 data-[active=true]:opacity-100 data-[active=true]:ease-[cubic-bezier(0.23,1,0.32,1)] data-[direction=end]:bottom-4 data-[direction=end]:data-[active=false]:translate-y-full data-[direction=start]:top-4 data-[direction=start]:data-[active=false]:-translate-y-full rtl:translate-x-1/2 data-[direction=start]:[&_svg]:rotate-180`,t),render:r??(0,L.jsx)(H,{variant:i,size:a}),...o,children:n??(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(A,{}),(0,L.jsx)(`span`,{className:`sr-only`,children:e===`end`?`Scroll to end`:`Scroll to start`})]})})}function jM(e,t){let n=t||{};return(e[e.length-1]===``?[...e,``]:e).join((n.padRight?` `:``)+`,`+(n.padLeft===!1?``:` `)).trim()}var MM=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,NM=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,PM={};function FM(e,t){return((t||PM).jsx?NM:MM).test(e)}var IM=/[ \t\n\f\r]/g;function LM(e){return typeof e==`object`?e.type===`text`&&RM(e.value):RM(e)}function RM(e){return e.replace(IM,``)===``}var zM=class{constructor(e,t,n){this.normal=t,this.property=e,n&&(this.space=n)}};zM.prototype.normal={},zM.prototype.property={},zM.prototype.space=void 0;function BM(e,t){let n={},r={};for(let t of e)Object.assign(n,t.property),Object.assign(r,t.normal);return new zM(n,r,t)}function VM(e){return e.toLowerCase()}var HM=class{constructor(e,t){this.attribute=t,this.property=e}};HM.prototype.attribute=``,HM.prototype.booleanish=!1,HM.prototype.boolean=!1,HM.prototype.commaOrSpaceSeparated=!1,HM.prototype.commaSeparated=!1,HM.prototype.defined=!1,HM.prototype.mustUseProperty=!1,HM.prototype.number=!1,HM.prototype.overloadedBoolean=!1,HM.prototype.property=``,HM.prototype.spaceSeparated=!1,HM.prototype.space=void 0;var UM=s({boolean:()=>GM,booleanish:()=>KM,commaOrSpaceSeparated:()=>XM,commaSeparated:()=>YM,number:()=>Q,overloadedBoolean:()=>qM,spaceSeparated:()=>JM}),WM=0,GM=ZM(),KM=ZM(),qM=ZM(),Q=ZM(),JM=ZM(),YM=ZM(),XM=ZM();function ZM(){return 2**++WM}var QM=Object.keys(UM),$M=class extends HM{constructor(e,t,n,r){let i=-1;if(super(e,t),eN(this,`space`,r),typeof n==`number`)for(;++i<QM.length;){let e=QM[i];eN(this,QM[i],(n&UM[e])===UM[e])}}};$M.prototype.defined=!0;function eN(e,t,n){n&&(e[t]=n)}function tN(e){let t={},n={};for(let[r,i]of Object.entries(e.properties)){let a=new $M(r,e.transform(e.attributes||{},r),i,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(a.mustUseProperty=!0),t[r]=a,n[VM(r)]=r,n[VM(a.attribute)]=r}return new zM(t,n,e.space)}var nN=tN({properties:{ariaActiveDescendant:null,ariaAtomic:KM,ariaAutoComplete:null,ariaBusy:KM,ariaChecked:KM,ariaColCount:Q,ariaColIndex:Q,ariaColSpan:Q,ariaControls:JM,ariaCurrent:null,ariaDescribedBy:JM,ariaDetails:null,ariaDisabled:KM,ariaDropEffect:JM,ariaErrorMessage:null,ariaExpanded:KM,ariaFlowTo:JM,ariaGrabbed:KM,ariaHasPopup:null,ariaHidden:KM,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:JM,ariaLevel:Q,ariaLive:null,ariaModal:KM,ariaMultiLine:KM,ariaMultiSelectable:KM,ariaOrientation:null,ariaOwns:JM,ariaPlaceholder:null,ariaPosInSet:Q,ariaPressed:KM,ariaReadOnly:KM,ariaRelevant:null,ariaRequired:KM,ariaRoleDescription:JM,ariaRowCount:Q,ariaRowIndex:Q,ariaRowSpan:Q,ariaSelected:KM,ariaSetSize:Q,ariaSort:null,ariaValueMax:Q,ariaValueMin:Q,ariaValueNow:Q,ariaValueText:null,role:null},transform(e,t){return t===`role`?t:`aria-`+t.slice(4).toLowerCase()}});function rN(e,t){return t in e?e[t]:t}function iN(e,t){return rN(e,t.toLowerCase())}var aN=tN({attributes:{acceptcharset:`accept-charset`,classname:`class`,htmlfor:`for`,httpequiv:`http-equiv`},mustUseProperty:[`checked`,`multiple`,`muted`,`selected`],properties:{abbr:null,accept:YM,acceptCharset:JM,accessKey:JM,action:null,allow:null,allowFullScreen:GM,allowPaymentRequest:GM,allowUserMedia:GM,alpha:GM,alt:null,as:null,async:GM,autoCapitalize:null,autoComplete:JM,autoFocus:GM,autoPlay:GM,blocking:JM,capture:null,charSet:null,checked:GM,cite:null,className:JM,closedBy:null,colorSpace:null,cols:Q,colSpan:Q,command:null,commandFor:null,content:null,contentEditable:KM,controls:GM,controlsList:JM,coords:Q|YM,crossOrigin:null,data:null,dateTime:null,decoding:null,default:GM,defer:GM,dir:null,dirName:null,disabled:GM,download:qM,draggable:KM,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:GM,formTarget:null,headers:JM,height:Q,hidden:qM,high:Q,href:null,hrefLang:null,htmlFor:JM,httpEquiv:JM,id:null,imageSizes:null,imageSrcSet:null,inert:GM,inputMode:null,integrity:null,is:null,isMap:GM,itemId:null,itemProp:JM,itemRef:JM,itemScope:GM,itemType:JM,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:GM,low:Q,manifest:null,max:null,maxLength:Q,media:null,method:null,min:null,minLength:Q,multiple:GM,muted:GM,name:null,nonce:null,noModule:GM,noValidate:GM,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:GM,optimum:Q,pattern:null,ping:JM,placeholder:null,playsInline:GM,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:GM,referrerPolicy:null,rel:JM,required:GM,reversed:GM,rows:Q,rowSpan:Q,sandbox:JM,scope:null,scoped:GM,seamless:GM,selected:GM,shadowRootClonable:GM,shadowRootCustomElementRegistry:GM,shadowRootDelegatesFocus:GM,shadowRootMode:null,shadowRootSerializable:GM,shape:null,size:Q,sizes:null,slot:null,span:Q,spellCheck:KM,src:null,srcDoc:null,srcLang:null,srcSet:null,start:Q,step:null,style:null,tabIndex:Q,target:null,title:null,translate:null,type:null,typeMustMatch:GM,useMap:null,value:KM,width:Q,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:JM,axis:null,background:null,bgColor:null,border:Q,borderColor:null,bottomMargin:Q,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:GM,declare:GM,event:null,face:null,frame:null,frameBorder:null,hSpace:Q,leftMargin:Q,link:null,longDesc:null,lowSrc:null,marginHeight:Q,marginWidth:Q,noResize:GM,noHref:GM,noShade:GM,noWrap:GM,object:null,profile:null,prompt:null,rev:null,rightMargin:Q,rules:null,scheme:null,scrolling:KM,standby:null,summary:null,text:null,topMargin:Q,valueType:null,version:null,vAlign:null,vLink:null,vSpace:Q,allowTransparency:null,autoCorrect:null,autoSave:null,credentialless:GM,disablePictureInPicture:GM,disableRemotePlayback:GM,exportParts:YM,part:JM,prefix:null,property:null,results:Q,security:null,unselectable:null},space:`html`,transform:iN}),oN=tN({attributes:{accentHeight:`accent-height`,alignmentBaseline:`alignment-baseline`,arabicForm:`arabic-form`,baselineShift:`baseline-shift`,capHeight:`cap-height`,className:`class`,clipPath:`clip-path`,clipRule:`clip-rule`,colorInterpolation:`color-interpolation`,colorInterpolationFilters:`color-interpolation-filters`,colorProfile:`color-profile`,colorRendering:`color-rendering`,crossOrigin:`crossorigin`,dataType:`datatype`,dominantBaseline:`dominant-baseline`,enableBackground:`enable-background`,fillOpacity:`fill-opacity`,fillRule:`fill-rule`,floodColor:`flood-color`,floodOpacity:`flood-opacity`,fontFamily:`font-family`,fontSize:`font-size`,fontSizeAdjust:`font-size-adjust`,fontStretch:`font-stretch`,fontStyle:`font-style`,fontVariant:`font-variant`,fontWeight:`font-weight`,glyphName:`glyph-name`,glyphOrientationHorizontal:`glyph-orientation-horizontal`,glyphOrientationVertical:`glyph-orientation-vertical`,hrefLang:`hreflang`,horizAdvX:`horiz-adv-x`,horizOriginX:`horiz-origin-x`,horizOriginY:`horiz-origin-y`,imageRendering:`image-rendering`,letterSpacing:`letter-spacing`,lightingColor:`lighting-color`,markerEnd:`marker-end`,markerMid:`marker-mid`,markerStart:`marker-start`,maskType:`mask-type`,navDown:`nav-down`,navDownLeft:`nav-down-left`,navDownRight:`nav-down-right`,navLeft:`nav-left`,navNext:`nav-next`,navPrev:`nav-prev`,navRight:`nav-right`,navUp:`nav-up`,navUpLeft:`nav-up-left`,navUpRight:`nav-up-right`,onAbort:`onabort`,onActivate:`onactivate`,onAfterPrint:`onafterprint`,onBeforePrint:`onbeforeprint`,onBegin:`onbegin`,onCancel:`oncancel`,onCanPlay:`oncanplay`,onCanPlayThrough:`oncanplaythrough`,onChange:`onchange`,onClick:`onclick`,onClose:`onclose`,onCopy:`oncopy`,onCueChange:`oncuechange`,onCut:`oncut`,onDblClick:`ondblclick`,onDrag:`ondrag`,onDragEnd:`ondragend`,onDragEnter:`ondragenter`,onDragExit:`ondragexit`,onDragLeave:`ondragleave`,onDragOver:`ondragover`,onDragStart:`ondragstart`,onDrop:`ondrop`,onDurationChange:`ondurationchange`,onEmptied:`onemptied`,onEnd:`onend`,onEnded:`onended`,onError:`onerror`,onFocus:`onfocus`,onFocusIn:`onfocusin`,onFocusOut:`onfocusout`,onHashChange:`onhashchange`,onInput:`oninput`,onInvalid:`oninvalid`,onKeyDown:`onkeydown`,onKeyPress:`onkeypress`,onKeyUp:`onkeyup`,onLoad:`onload`,onLoadedData:`onloadeddata`,onLoadedMetadata:`onloadedmetadata`,onLoadStart:`onloadstart`,onMessage:`onmessage`,onMouseDown:`onmousedown`,onMouseEnter:`onmouseenter`,onMouseLeave:`onmouseleave`,onMouseMove:`onmousemove`,onMouseOut:`onmouseout`,onMouseOver:`onmouseover`,onMouseUp:`onmouseup`,onMouseWheel:`onmousewheel`,onOffline:`onoffline`,onOnline:`ononline`,onPageHide:`onpagehide`,onPageShow:`onpageshow`,onPaste:`onpaste`,onPause:`onpause`,onPlay:`onplay`,onPlaying:`onplaying`,onPopState:`onpopstate`,onProgress:`onprogress`,onRateChange:`onratechange`,onRepeat:`onrepeat`,onReset:`onreset`,onResize:`onresize`,onScroll:`onscroll`,onSeeked:`onseeked`,onSeeking:`onseeking`,onSelect:`onselect`,onShow:`onshow`,onStalled:`onstalled`,onStorage:`onstorage`,onSubmit:`onsubmit`,onSuspend:`onsuspend`,onTimeUpdate:`ontimeupdate`,onToggle:`ontoggle`,onUnload:`onunload`,onVolumeChange:`onvolumechange`,onWaiting:`onwaiting`,onZoom:`onzoom`,overlinePosition:`overline-position`,overlineThickness:`overline-thickness`,paintOrder:`paint-order`,panose1:`panose-1`,pointerEvents:`pointer-events`,referrerPolicy:`referrerpolicy`,renderingIntent:`rendering-intent`,shapeRendering:`shape-rendering`,stopColor:`stop-color`,stopOpacity:`stop-opacity`,strikethroughPosition:`strikethrough-position`,strikethroughThickness:`strikethrough-thickness`,strokeDashArray:`stroke-dasharray`,strokeDashOffset:`stroke-dashoffset`,strokeLineCap:`stroke-linecap`,strokeLineJoin:`stroke-linejoin`,strokeMiterLimit:`stroke-miterlimit`,strokeOpacity:`stroke-opacity`,strokeWidth:`stroke-width`,tabIndex:`tabindex`,textAnchor:`text-anchor`,textDecoration:`text-decoration`,textRendering:`text-rendering`,transformOrigin:`transform-origin`,typeOf:`typeof`,underlinePosition:`underline-position`,underlineThickness:`underline-thickness`,unicodeBidi:`unicode-bidi`,unicodeRange:`unicode-range`,unitsPerEm:`units-per-em`,vAlphabetic:`v-alphabetic`,vHanging:`v-hanging`,vIdeographic:`v-ideographic`,vMathematical:`v-mathematical`,vectorEffect:`vector-effect`,vertAdvY:`vert-adv-y`,vertOriginX:`vert-origin-x`,vertOriginY:`vert-origin-y`,wordSpacing:`word-spacing`,writingMode:`writing-mode`,xHeight:`x-height`,playbackOrder:`playbackorder`,timelineBegin:`timelinebegin`},properties:{about:XM,accentHeight:Q,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:Q,amplitude:Q,arabicForm:null,ascent:Q,attributeName:null,attributeType:null,azimuth:Q,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:Q,by:null,calcMode:null,capHeight:Q,className:JM,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:Q,diffuseConstant:Q,direction:null,display:null,dur:null,divisor:Q,dominantBaseline:null,download:GM,dx:null,dy:null,edgeMode:null,editable:null,elevation:Q,enableBackground:null,end:null,event:null,exponent:Q,externalResourcesRequired:null,fill:null,fillOpacity:Q,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:YM,g2:YM,glyphName:YM,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:Q,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:Q,horizOriginX:Q,horizOriginY:Q,id:null,ideographic:Q,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:Q,k:Q,k1:Q,k2:Q,k3:Q,k4:Q,kernelMatrix:XM,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:Q,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskType:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:Q,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:Q,overlineThickness:Q,paintOrder:null,panose1:null,path:null,pathLength:Q,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:JM,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:Q,pointsAtY:Q,pointsAtZ:Q,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:XM,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:XM,rev:XM,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:XM,requiredFeatures:XM,requiredFonts:XM,requiredFormats:XM,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:Q,specularExponent:Q,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:Q,strikethroughThickness:Q,string:null,stroke:null,strokeDashArray:XM,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:Q,strokeOpacity:Q,strokeWidth:null,style:null,surfaceScale:Q,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:XM,tabIndex:Q,tableValues:null,target:null,targetX:Q,targetY:Q,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:XM,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:Q,underlineThickness:Q,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:Q,values:null,vAlphabetic:Q,vMathematical:Q,vectorEffect:null,vHanging:Q,vIdeographic:Q,version:null,vertAdvY:Q,vertOriginX:Q,vertOriginY:Q,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:Q,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:`svg`,transform:rN}),sN=tN({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:`xlink`,transform(e,t){return`xlink:`+t.slice(5).toLowerCase()}}),cN=tN({attributes:{xmlnsxlink:`xmlns:xlink`},properties:{xmlnsXLink:null,xmlns:null},space:`xmlns`,transform:iN}),lN=tN({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:`xml`,transform(e,t){return`xml:`+t.slice(3).toLowerCase()}}),uN={classId:`classID`,dataType:`datatype`,itemId:`itemID`,strokeDashArray:`strokeDasharray`,strokeDashOffset:`strokeDashoffset`,strokeLineCap:`strokeLinecap`,strokeLineJoin:`strokeLinejoin`,strokeMiterLimit:`strokeMiterlimit`,typeOf:`typeof`,xLinkActuate:`xlinkActuate`,xLinkArcRole:`xlinkArcrole`,xLinkHref:`xlinkHref`,xLinkRole:`xlinkRole`,xLinkShow:`xlinkShow`,xLinkTitle:`xlinkTitle`,xLinkType:`xlinkType`,xmlnsXLink:`xmlnsXlink`},dN=/[A-Z]/g,fN=/-[a-z]/g,pN=/^data[-\w.:]+$/i;function mN(e,t){let n=VM(t),r=t,i=HM;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)===`data`&&pN.test(t)){if(t.charAt(4)===`-`){let e=t.slice(5).replace(fN,gN);r=`data`+e.charAt(0).toUpperCase()+e.slice(1)}else{let e=t.slice(4);if(!fN.test(e)){let n=e.replace(dN,hN);n.charAt(0)!==`-`&&(n=`-`+n),t=`data`+n}}i=$M}return new i(r,t)}function hN(e){return`-`+e.toLowerCase()}function gN(e){return e.charAt(1).toUpperCase()}var _N=BM([nN,aN,sN,cN,lN],`html`),vN=BM([nN,oN,sN,cN,lN],`svg`);function yN(e){return e.join(` `).trim()}var bN=o(((e,t)=>{var n=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,r=/\n/g,i=/^\s*/,a=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,o=/^:\s*/,s=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,c=/^[;\s]*/,l=/^\s+|\s+$/g;function u(e,t){if(typeof e!=`string`)throw TypeError(`First argument must be a string`);if(!e)return[];t||={};var l=1,u=1;function f(e){var t=e.match(r);t&&(l+=t.length);var n=e.lastIndexOf(`
|
|
74
|
-
`);u=~n?e.length-n:u+e.length}function p(){var e={line:l,column:u};return function(t){return t.position=new m(e),_(),t}}function m(e){this.start=e,this.end={line:l,column:u},this.source=t.source}m.prototype.content=e;function h(n){var r=Error(t.source+`:`+l+`:`+u+`: `+n);if(r.reason=n,r.filename=t.source,r.line=l,r.column=u,r.source=e,!t.silent)throw r}function g(t){var n=t.exec(e);if(n){var r=n[0];return f(r),e=e.slice(r.length),n}}function _(){g(i)}function v(e){var t;for(e||=[];t=y();)t!==!1&&e.push(t);return e}function y(){var t=p();if(e.charAt(0)==`/`&&e.charAt(1)==`*`){for(var n=2;e.charAt(n)!=``&&(e.charAt(n)!=`*`||e.charAt(n+1)!=`/`);)++n;if(n+=2,e.charAt(n-1)===``)return h(`End of comment missing`);var r=e.slice(2,n-2);return u+=2,f(r),e=e.slice(n),u+=2,t({type:`comment`,comment:r})}}function b(){var e=p(),t=g(a);if(t){if(y(),!g(o))return h(`property missing ':'`);var r=g(s),i=e({type:`declaration`,property:d(t[0].replace(n,``)),value:r?d(r[0].replace(n,``)):``});return g(c),i}}function x(){var e=[];v(e);for(var t;t=b();)t!==!1&&(e.push(t),v(e));return e}return _(),x()}function d(e){return e?e.replace(l,``):``}t.exports=u})),xN=o((e=>{var t=e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(e,"__esModule",{value:!0}),e.default=r;var n=t(bN());function r(e,t){let r=null;if(!e||typeof e!=`string`)return r;let i=(0,n.default)(e),a=typeof t==`function`;return i.forEach(e=>{if(e.type!==`declaration`)return;let{property:n,value:i}=e;a?t(n,i,e):i&&(r||={},r[n]=i)}),r}})),SN=o((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.camelCase=void 0;var t=/^--[a-zA-Z0-9_-]+$/,n=/-([a-z])/g,r=/^[^-]+$/,i=/^-(webkit|moz|ms|o|khtml)-/,a=/^-(ms)-/,o=function(e){return!e||r.test(e)||t.test(e)},s=function(e,t){return t.toUpperCase()},c=function(e,t){return`${t}-`};e.camelCase=function(e,t){return t===void 0&&(t={}),o(e)?e:(e=e.toLowerCase(),e=t.reactCompat?e.replace(a,c):e.replace(i,c),e.replace(n,s))}})),CN=o(((e,t)=>{var n=(e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}})(xN()),r=SN();function i(e,t){var i={};return!e||typeof e!=`string`||(0,n.default)(e,function(e,n){e&&n&&(i[(0,r.camelCase)(e,t)]=n)}),i}i.default=i,t.exports=i})),wN=EN(`end`),TN=EN(`start`);function EN(e){return t;function t(t){let n=t&&t.position&&t.position[e]||{};if(typeof n.line==`number`&&n.line>0&&typeof n.column==`number`&&n.column>0)return{line:n.line,column:n.column,offset:typeof n.offset==`number`&&n.offset>-1?n.offset:void 0}}}function DN(e){let t=TN(e),n=wN(e);if(t&&n)return{start:t,end:n}}function ON(e){return!e||typeof e!=`object`?``:`position`in e||`type`in e?AN(e.position):`start`in e||`end`in e?AN(e):`line`in e||`column`in e?kN(e):``}function kN(e){return jN(e&&e.line)+`:`+jN(e&&e.column)}function AN(e){return kN(e&&e.start)+`-`+kN(e&&e.end)}function jN(e){return e&&typeof e==`number`?e:1}var MN=class extends Error{constructor(e,t,n){super(),typeof t==`string`&&(n=t,t=void 0);let r=``,i={},a=!1;if(t&&(i=`line`in t&&`column`in t||`start`in t&&`end`in t?{place:t}:`type`in t?{ancestors:[t],place:t.position}:{...t}),typeof e==`string`?r=e:!i.cause&&e&&(a=!0,r=e.message,i.cause=e),!i.ruleId&&!i.source&&typeof n==`string`){let e=n.indexOf(`:`);e===-1?i.ruleId=n:(i.source=n.slice(0,e),i.ruleId=n.slice(e+1))}if(!i.place&&i.ancestors&&i.ancestors){let e=i.ancestors[i.ancestors.length-1];e&&(i.place=e.position)}let o=i.place&&`start`in i.place?i.place.start:i.place;this.ancestors=i.ancestors||void 0,this.cause=i.cause||void 0,this.column=o?o.column:void 0,this.fatal=void 0,this.file=``,this.message=r,this.line=o?o.line:void 0,this.name=ON(i.place)||`1:1`,this.place=i.place||void 0,this.reason=this.message,this.ruleId=i.ruleId||void 0,this.source=i.source||void 0,this.stack=a&&i.cause&&typeof i.cause.stack==`string`?i.cause.stack:``,this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}};MN.prototype.file=``,MN.prototype.name=``,MN.prototype.reason=``,MN.prototype.message=``,MN.prototype.stack=``,MN.prototype.column=void 0,MN.prototype.line=void 0,MN.prototype.ancestors=void 0,MN.prototype.cause=void 0,MN.prototype.fatal=void 0,MN.prototype.place=void 0,MN.prototype.ruleId=void 0,MN.prototype.source=void 0;var NN=l(CN(),1),PN={}.hasOwnProperty,FN=new Map,IN=/[A-Z]/g,LN=new Set([`table`,`tbody`,`thead`,`tfoot`,`tr`]),RN=new Set([`td`,`th`]);function zN(e,t){if(!t||t.Fragment===void 0)throw TypeError("Expected `Fragment` in options");let n=t.filePath||void 0,r;if(t.development){if(typeof t.jsxDEV!=`function`)throw TypeError("Expected `jsxDEV` in options when `development: true`");r=XN(n,t.jsxDEV)}else{if(typeof t.jsx!=`function`)throw TypeError("Expected `jsx` in production options");if(typeof t.jsxs!=`function`)throw TypeError("Expected `jsxs` in production options");r=YN(n,t.jsx,t.jsxs)}let i={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:r,elementAttributeNameCase:t.elementAttributeNameCase||`react`,evaluater:t.createEvaluater?t.createEvaluater():void 0,filePath:n,ignoreInvalidStyle:t.ignoreInvalidStyle||!1,passKeys:t.passKeys!==!1,passNode:t.passNode||!1,schema:t.space===`svg`?vN:_N,stylePropertyNameCase:t.stylePropertyNameCase||`dom`,tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},a=BN(i,e,void 0);return a&&typeof a!=`string`?a:i.create(e,i.Fragment,{children:a||void 0},void 0)}function BN(e,t,n){if(t.type===`element`)return VN(e,t,n);if(t.type===`mdxFlowExpression`||t.type===`mdxTextExpression`)return HN(e,t);if(t.type===`mdxJsxFlowElement`||t.type===`mdxJsxTextElement`)return WN(e,t,n);if(t.type===`mdxjsEsm`)return UN(e,t);if(t.type===`root`)return GN(e,t,n);if(t.type===`text`)return KN(e,t)}function VN(e,t,n){let r=e.schema,i=r;t.tagName.toLowerCase()===`svg`&&r.space===`html`&&(i=vN,e.schema=i),e.ancestors.push(t);let a=nP(e,t.tagName,!1),o=ZN(e,t),s=$N(e,t);return LN.has(t.tagName)&&(s=s.filter(function(e){return typeof e!=`string`||!LM(e)})),qN(e,o,a,t),JN(o,s),e.ancestors.pop(),e.schema=r,e.create(t,a,o,n)}function HN(e,t){if(t.data&&t.data.estree&&e.evaluater){let n=t.data.estree.body[0];return n.type,e.evaluater.evaluateExpression(n.expression)}rP(e,t.position)}function UN(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);rP(e,t.position)}function WN(e,t,n){let r=e.schema,i=r;t.name===`svg`&&r.space===`html`&&(i=vN,e.schema=i),e.ancestors.push(t);let a=t.name===null?e.Fragment:nP(e,t.name,!0),o=QN(e,t),s=$N(e,t);return qN(e,o,a,t),JN(o,s),e.ancestors.pop(),e.schema=r,e.create(t,a,o,n)}function GN(e,t,n){let r={};return JN(r,$N(e,t)),e.create(t,e.Fragment,r,n)}function KN(e,t){return t.value}function qN(e,t,n,r){typeof n!=`string`&&n!==e.Fragment&&e.passNode&&(t.node=r)}function JN(e,t){if(t.length>0){let n=t.length>1?t:t[0];n&&(e.children=n)}}function YN(e,t,n){return r;function r(e,r,i,a){let o=Array.isArray(i.children)?n:t;return a?o(r,i,a):o(r,i)}}function XN(e,t){return n;function n(n,r,i,a){let o=Array.isArray(i.children),s=TN(n);return t(r,i,a,o,{columnNumber:s?s.column-1:void 0,fileName:e,lineNumber:s?s.line:void 0},void 0)}}function ZN(e,t){let n={},r,i;for(i in t.properties)if(i!==`children`&&PN.call(t.properties,i)){let a=eP(e,i,t.properties[i]);if(a){let[i,o]=a;e.tableCellAlignToStyle&&i===`align`&&typeof o==`string`&&RN.has(t.tagName)?r=o:n[i]=o}}if(r){let t=n.style||={};t[e.stylePropertyNameCase===`css`?`text-align`:`textAlign`]=r}return n}function QN(e,t){let n={};for(let r of t.attributes)if(r.type===`mdxJsxExpressionAttribute`){if(r.data&&r.data.estree&&e.evaluater){let t=r.data.estree.body[0];t.type;let i=t.expression;i.type;let a=i.properties[0];a.type,Object.assign(n,e.evaluater.evaluateExpression(a.argument))}else rP(e,t.position)}else{let i=r.name,a;if(r.value&&typeof r.value==`object`){if(r.value.data&&r.value.data.estree&&e.evaluater){let t=r.value.data.estree.body[0];t.type,a=e.evaluater.evaluateExpression(t.expression)}else rP(e,t.position)}else a=r.value===null||r.value;n[i]=a}return n}function $N(e,t){let n=[],r=-1,i=e.passKeys?new Map:FN;for(;++r<t.children.length;){let a=t.children[r],o;if(e.passKeys){let e=a.type===`element`?a.tagName:a.type===`mdxJsxFlowElement`||a.type===`mdxJsxTextElement`?a.name:void 0;if(e){let t=i.get(e)||0;o=e+`-`+t,i.set(e,t+1)}}let s=BN(e,a,o);s!==void 0&&n.push(s)}return n}function eP(e,t,n){let r=mN(e.schema,t);if(!(n==null||typeof n==`number`&&Number.isNaN(n))){if(Array.isArray(n)&&(n=r.commaSeparated?jM(n):yN(n)),r.property===`style`){let t=typeof n==`object`?n:tP(e,String(n));return e.stylePropertyNameCase===`css`&&(t=iP(t)),[`style`,t]}return[e.elementAttributeNameCase===`react`&&r.space?uN[r.property]||r.property:r.attribute,n]}}function tP(e,t){try{return(0,NN.default)(t,{reactCompat:!0})}catch(t){if(e.ignoreInvalidStyle)return{};let n=t,r=new MN("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:n,ruleId:`style`,source:`hast-util-to-jsx-runtime`});throw r.file=e.filePath||void 0,r.url=`https://github.com/syntax-tree/hast-util-to-jsx-runtime#cannot-parse-style-attribute`,r}}function nP(e,t,n){let r;if(!n)r={type:`Literal`,value:t};else if(t.includes(`.`)){let e=t.split(`.`),n=-1,i;for(;++n<e.length;){let t=FM(e[n])?{type:`Identifier`,name:e[n]}:{type:`Literal`,value:e[n]};i=i?{type:`MemberExpression`,object:i,property:t,computed:!!(n&&t.type===`Literal`),optional:!1}:t}r=i}else r=FM(t)&&!/^[a-z]/.test(t)?{type:`Identifier`,name:t}:{type:`Literal`,value:t};if(r.type===`Literal`){let t=r.value;return PN.call(e.components,t)?e.components[t]:t}if(e.evaluater)return e.evaluater.evaluateExpression(r);rP(e)}function rP(e,t){let n=new MN("Cannot handle MDX estrees without `createEvaluater`",{ancestors:e.ancestors,place:t,ruleId:`mdx-estree`,source:`hast-util-to-jsx-runtime`});throw n.file=e.filePath||void 0,n.url=`https://github.com/syntax-tree/hast-util-to-jsx-runtime#cannot-handle-mdx-estrees-without-createevaluater`,n}function iP(e){let t={},n;for(n in e)PN.call(e,n)&&(t[aP(n)]=e[n]);return t}function aP(e){let t=e.replace(IN,oP);return t.slice(0,3)===`ms-`&&(t=`-`+t),t}function oP(e){return`-`+e.toLowerCase()}var sP={action:[`form`],cite:[`blockquote`,`del`,`ins`,`q`],data:[`object`],formAction:[`button`,`input`],href:[`a`,`area`,`base`,`link`],icon:[`menuitem`],itemId:null,manifest:[`html`],ping:[`a`,`area`],poster:[`video`],src:[`audio`,`embed`,`iframe`,`img`,`input`,`script`,`source`,`track`,`video`]},cP={};function lP(e,t){let n=t||cP;return uP(e,typeof n.includeImageAlt!=`boolean`||n.includeImageAlt,typeof n.includeHtml!=`boolean`||n.includeHtml)}function uP(e,t,n){if(fP(e)){if(`value`in e)return e.type===`html`&&!n?``:e.value;if(t&&`alt`in e&&e.alt)return e.alt;if(`children`in e)return dP(e.children,t,n)}return Array.isArray(e)?dP(e,t,n):``}function dP(e,t,n){let r=[],i=-1;for(;++i<e.length;)r[i]=uP(e[i],t,n);return r.join(``)}function fP(e){return!!(e&&typeof e==`object`)}var pP=document.createElement(`i`);function mP(e){let t=`&`+e+`;`;pP.innerHTML=t;let n=pP.textContent;return n.charCodeAt(n.length-1)===59&&e!==`semi`?!1:n!==t&&n}function hP(e,t,n,r){let i=e.length,a=0,o;if(t=t<0?-t>i?0:i+t:t>i?i:t,n=n>0?n:0,r.length<1e4)o=Array.from(r),o.unshift(t,n),e.splice(...o);else for(n&&e.splice(t,n);a<r.length;)o=r.slice(a,a+1e4),o.unshift(t,0),e.splice(...o),a+=1e4,t+=1e4}function gP(e,t){return e.length>0?(hP(e,e.length,0,t),e):t}var _P={}.hasOwnProperty;function vP(e){let t={},n=-1;for(;++n<e.length;)yP(t,e[n]);return t}function yP(e,t){let n;for(n in t){let r=(_P.call(e,n)?e[n]:void 0)||(e[n]={}),i=t[n],a;if(i)for(a in i){_P.call(r,a)||(r[a]=[]);let e=i[a];bP(r[a],Array.isArray(e)?e:e?[e]:[])}}}function bP(e,t){let n=-1,r=[];for(;++n<t.length;)(t[n].add===`after`?e:r).push(t[n]);hP(e,0,0,r)}function xP(e,t){let n=Number.parseInt(e,t);return n<9||n===11||n>13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(n&65535)==65535||(n&65535)==65534||n>1114111?`�`:String.fromCodePoint(n)}function SP(e){return e.replace(/[\t\n\r ]+/g,` `).replace(/^ | $/g,``).toLowerCase().toUpperCase()}var CP=PP(/[A-Za-z]/),wP=PP(/[\dA-Za-z]/),TP=PP(/[#-'*+\--9=?A-Z^-~]/);function EP(e){return e!==null&&(e<32||e===127)}var DP=PP(/\d/),OP=PP(/[\dA-Fa-f]/),kP=PP(/[!-/:-@[-`{-~]/);function $(e){return e!==null&&e<-2}function AP(e){return e!==null&&(e<0||e===32)}function jP(e){return e===-2||e===-1||e===32}var MP=PP(/\p{P}|\p{S}/u),NP=PP(/\s/);function PP(e){return t;function t(t){return t!==null&&t>-1&&e.test(String.fromCharCode(t))}}function FP(e){let t=[],n=-1,r=0,i=0;for(;++n<e.length;){let a=e.charCodeAt(n),o=``;if(a===37&&wP(e.charCodeAt(n+1))&&wP(e.charCodeAt(n+2)))i=2;else if(a<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(a))||(o=String.fromCharCode(a));else if(a>55295&&a<57344){let t=e.charCodeAt(n+1);a<56320&&t>56319&&t<57344?(o=String.fromCharCode(a,t),i=1):o=`�`}else o=String.fromCharCode(a);o&&=(t.push(e.slice(r,n),encodeURIComponent(o)),r=n+i+1,``),i&&=(n+=i,0)}return t.join(``)+e.slice(r)}function IP(e,t,n,r){let i=r?r-1:1/0,a=0;return o;function o(r){return jP(r)?(e.enter(n),s(r)):t(r)}function s(r){return jP(r)&&a++<i?(e.consume(r),s):(e.exit(n),t(r))}}var LP={tokenize:RP};function RP(e){let t=e.attempt(this.parser.constructs.contentInitial,r,i),n;return t;function r(n){if(n===null){e.consume(n);return}return e.enter(`lineEnding`),e.consume(n),e.exit(`lineEnding`),IP(e,t,`linePrefix`)}function i(t){return e.enter(`paragraph`),a(t)}function a(t){let r=e.enter(`chunkText`,{contentType:`text`,previous:n});return n&&(n.next=r),n=r,o(t)}function o(t){if(t===null){e.exit(`chunkText`),e.exit(`paragraph`),e.consume(t);return}return $(t)?(e.consume(t),e.exit(`chunkText`),a):(e.consume(t),o)}}var zP={tokenize:VP},BP={tokenize:HP};function VP(e){let t=this,n=[],r=0,i,a,o;return s;function s(i){if(r<n.length){let a=n[r];return t.containerState=a[1],e.attempt(a[0].continuation,c,l)(i)}return l(i)}function c(e){if(r++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,i&&v();let n=t.events.length,a=n,o;for(;a--;)if(t.events[a][0]===`exit`&&t.events[a][1].type===`chunkFlow`){o=t.events[a][1].end;break}_(r);let s=n;for(;s<t.events.length;)t.events[s][1].end={...o},s++;return hP(t.events,a+1,0,t.events.slice(n)),t.events.length=s,l(e)}return s(e)}function l(a){if(r===n.length){if(!i)return f(a);if(i.currentConstruct&&i.currentConstruct.concrete)return m(a);t.interrupt=!!(i.currentConstruct&&!i._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(BP,u,d)(a)}function u(e){return i&&v(),_(r),f(e)}function d(e){return t.parser.lazy[t.now().line]=r!==n.length,o=t.now().offset,m(e)}function f(n){return t.containerState={},e.attempt(BP,p,m)(n)}function p(e){return r++,n.push([t.currentConstruct,t.containerState]),f(e)}function m(n){if(n===null){i&&v(),_(0),e.consume(n);return}return i||=t.parser.flow(t.now()),e.enter(`chunkFlow`,{_tokenizer:i,contentType:`flow`,previous:a}),h(n)}function h(n){if(n===null){g(e.exit(`chunkFlow`),!0),_(0),e.consume(n);return}return $(n)?(e.consume(n),g(e.exit(`chunkFlow`)),r=0,t.interrupt=void 0,s):(e.consume(n),h)}function g(e,n){let s=t.sliceStream(e);if(n&&s.push(null),e.previous=a,a&&(a.next=e),a=e,i.defineSkip(e.start),i.write(s),t.parser.lazy[e.start.line]){let e=i.events.length;for(;e--;)if(i.events[e][1].start.offset<o&&(!i.events[e][1].end||i.events[e][1].end.offset>o))return;let n=t.events.length,a=n,s,c;for(;a--;)if(t.events[a][0]===`exit`&&t.events[a][1].type===`chunkFlow`){if(s){c=t.events[a][1].end;break}s=!0}for(_(r),e=n;e<t.events.length;)t.events[e][1].end={...c},e++;hP(t.events,a+1,0,t.events.slice(n)),t.events.length=e}}function _(r){let i=n.length;for(;i-->r;){let r=n[i];t.containerState=r[1],r[0].exit.call(t,e)}n.length=r}function v(){i.write([null]),a=void 0,i=void 0,t.containerState._closeFlow=void 0}}function HP(e,t,n){return IP(e,e.attempt(this.parser.constructs.document,t,n),`linePrefix`,this.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)}function UP(e){if(e===null||AP(e)||NP(e))return 1;if(MP(e))return 2}function WP(e,t,n){let r=[],i=-1;for(;++i<e.length;){let a=e[i].resolveAll;a&&!r.includes(a)&&(t=a(t,n),r.push(a))}return t}var GP={name:`attention`,resolveAll:KP,tokenize:qP};function KP(e,t){let n=-1,r,i,a,o,s,c,l,u;for(;++n<e.length;)if(e[n][0]===`enter`&&e[n][1].type===`attentionSequence`&&e[n][1]._close){for(r=n;r--;)if(e[r][0]===`exit`&&e[r][1].type===`attentionSequence`&&e[r][1]._open&&t.sliceSerialize(e[r][1]).charCodeAt(0)===t.sliceSerialize(e[n][1]).charCodeAt(0)){if((e[r][1]._close||e[n][1]._open)&&(e[n][1].end.offset-e[n][1].start.offset)%3&&!((e[r][1].end.offset-e[r][1].start.offset+e[n][1].end.offset-e[n][1].start.offset)%3))continue;c=e[r][1].end.offset-e[r][1].start.offset>1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;let d={...e[r][1].end},f={...e[n][1].start};JP(d,-c),JP(f,c),o={type:c>1?`strongSequence`:`emphasisSequence`,start:d,end:{...e[r][1].end}},s={type:c>1?`strongSequence`:`emphasisSequence`,start:{...e[n][1].start},end:f},a={type:c>1?`strongText`:`emphasisText`,start:{...e[r][1].end},end:{...e[n][1].start}},i={type:c>1?`strong`:`emphasis`,start:{...o.start},end:{...s.end}},e[r][1].end={...o.start},e[n][1].start={...s.end},l=[],e[r][1].end.offset-e[r][1].start.offset&&(l=gP(l,[[`enter`,e[r][1],t],[`exit`,e[r][1],t]])),l=gP(l,[[`enter`,i,t],[`enter`,o,t],[`exit`,o,t],[`enter`,a,t]]),l=gP(l,WP(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),l=gP(l,[[`exit`,a,t],[`enter`,s,t],[`exit`,s,t],[`exit`,i,t]]),e[n][1].end.offset-e[n][1].start.offset?(u=2,l=gP(l,[[`enter`,e[n][1],t],[`exit`,e[n][1],t]])):u=0,hP(e,r-1,n-r+3,l),n=r+l.length-u-2;break}}for(n=-1;++n<e.length;)e[n][1].type===`attentionSequence`&&(e[n][1].type=`data`);return e}function qP(e,t){let n=this.parser.constructs.attentionMarkers.null,r=this.previous,i=UP(r),a;return o;function o(t){return a=t,e.enter(`attentionSequence`),s(t)}function s(o){if(o===a)return e.consume(o),s;let c=e.exit(`attentionSequence`),l=UP(o),u=!l||l===2&&i||n.includes(o),d=!i||i===2&&l||n.includes(r);return c._open=!!(a===42?u:u&&(i||!d)),c._close=!!(a===42?d:d&&(l||!u)),t(o)}}function JP(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}var YP={name:`autolink`,tokenize:XP};function XP(e,t,n){let r=0;return i;function i(t){return e.enter(`autolink`),e.enter(`autolinkMarker`),e.consume(t),e.exit(`autolinkMarker`),e.enter(`autolinkProtocol`),a}function a(t){return CP(t)?(e.consume(t),o):t===64?n(t):l(t)}function o(e){return e===43||e===45||e===46||wP(e)?(r=1,s(e)):l(e)}function s(t){return t===58?(e.consume(t),r=0,c):(t===43||t===45||t===46||wP(t))&&r++<32?(e.consume(t),s):(r=0,l(t))}function c(r){return r===62?(e.exit(`autolinkProtocol`),e.enter(`autolinkMarker`),e.consume(r),e.exit(`autolinkMarker`),e.exit(`autolink`),t):r===null||r===32||r===60||EP(r)?n(r):(e.consume(r),c)}function l(t){return t===64?(e.consume(t),u):TP(t)?(e.consume(t),l):n(t)}function u(e){return wP(e)?d(e):n(e)}function d(n){return n===46?(e.consume(n),r=0,u):n===62?(e.exit(`autolinkProtocol`).type=`autolinkEmail`,e.enter(`autolinkMarker`),e.consume(n),e.exit(`autolinkMarker`),e.exit(`autolink`),t):f(n)}function f(t){if((t===45||wP(t))&&r++<63){let n=t===45?f:d;return e.consume(t),n}return n(t)}}var ZP={partial:!0,tokenize:QP};function QP(e,t,n){return r;function r(t){return jP(t)?IP(e,i,`linePrefix`)(t):i(t)}function i(e){return e===null||$(e)?t(e):n(e)}}var $P={continuation:{tokenize:tF},exit:nF,name:`blockQuote`,tokenize:eF};function eF(e,t,n){let r=this;return i;function i(t){if(t===62){let n=r.containerState;return n.open||=(e.enter(`blockQuote`,{_container:!0}),!0),e.enter(`blockQuotePrefix`),e.enter(`blockQuoteMarker`),e.consume(t),e.exit(`blockQuoteMarker`),a}return n(t)}function a(n){return jP(n)?(e.enter(`blockQuotePrefixWhitespace`),e.consume(n),e.exit(`blockQuotePrefixWhitespace`),e.exit(`blockQuotePrefix`),t):(e.exit(`blockQuotePrefix`),t(n))}}function tF(e,t,n){let r=this;return i;function i(t){return jP(t)?IP(e,a,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):a(t)}function a(r){return e.attempt($P,t,n)(r)}}function nF(e){e.exit(`blockQuote`)}var rF={name:`characterEscape`,tokenize:iF};function iF(e,t,n){return r;function r(t){return e.enter(`characterEscape`),e.enter(`escapeMarker`),e.consume(t),e.exit(`escapeMarker`),i}function i(r){return kP(r)?(e.enter(`characterEscapeValue`),e.consume(r),e.exit(`characterEscapeValue`),e.exit(`characterEscape`),t):n(r)}}var aF={name:`characterReference`,tokenize:oF};function oF(e,t,n){let r=this,i=0,a,o;return s;function s(t){return e.enter(`characterReference`),e.enter(`characterReferenceMarker`),e.consume(t),e.exit(`characterReferenceMarker`),c}function c(t){return t===35?(e.enter(`characterReferenceMarkerNumeric`),e.consume(t),e.exit(`characterReferenceMarkerNumeric`),l):(e.enter(`characterReferenceValue`),a=31,o=wP,u(t))}function l(t){return t===88||t===120?(e.enter(`characterReferenceMarkerHexadecimal`),e.consume(t),e.exit(`characterReferenceMarkerHexadecimal`),e.enter(`characterReferenceValue`),a=6,o=OP,u):(e.enter(`characterReferenceValue`),a=7,o=DP,u(t))}function u(s){if(s===59&&i){let i=e.exit(`characterReferenceValue`);return o===wP&&!mP(r.sliceSerialize(i))?n(s):(e.enter(`characterReferenceMarker`),e.consume(s),e.exit(`characterReferenceMarker`),e.exit(`characterReference`),t)}return o(s)&&i++<a?(e.consume(s),u):n(s)}}var sF={partial:!0,tokenize:uF},cF={concrete:!0,name:`codeFenced`,tokenize:lF};function lF(e,t,n){let r=this,i={partial:!0,tokenize:x},a=0,o=0,s;return c;function c(e){return l(e)}function l(t){let n=r.events[r.events.length-1];return a=n&&n[1].type===`linePrefix`?n[2].sliceSerialize(n[1],!0).length:0,s=t,e.enter(`codeFenced`),e.enter(`codeFencedFence`),e.enter(`codeFencedFenceSequence`),u(t)}function u(t){return t===s?(o++,e.consume(t),u):o<3?n(t):(e.exit(`codeFencedFenceSequence`),jP(t)?IP(e,d,`whitespace`)(t):d(t))}function d(n){return n===null||$(n)?(e.exit(`codeFencedFence`),r.interrupt?t(n):e.check(sF,h,b)(n)):(e.enter(`codeFencedFenceInfo`),e.enter(`chunkString`,{contentType:`string`}),f(n))}function f(t){return t===null||$(t)?(e.exit(`chunkString`),e.exit(`codeFencedFenceInfo`),d(t)):jP(t)?(e.exit(`chunkString`),e.exit(`codeFencedFenceInfo`),IP(e,p,`whitespace`)(t)):t===96&&t===s?n(t):(e.consume(t),f)}function p(t){return t===null||$(t)?d(t):(e.enter(`codeFencedFenceMeta`),e.enter(`chunkString`,{contentType:`string`}),m(t))}function m(t){return t===null||$(t)?(e.exit(`chunkString`),e.exit(`codeFencedFenceMeta`),d(t)):t===96&&t===s?n(t):(e.consume(t),m)}function h(t){return e.attempt(i,b,g)(t)}function g(t){return e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),_}function _(t){return a>0&&jP(t)?IP(e,v,`linePrefix`,a+1)(t):v(t)}function v(t){return t===null||$(t)?e.check(sF,h,b)(t):(e.enter(`codeFlowValue`),y(t))}function y(t){return t===null||$(t)?(e.exit(`codeFlowValue`),v(t)):(e.consume(t),y)}function b(n){return e.exit(`codeFenced`),t(n)}function x(e,t,n){let i=0;return a;function a(t){return e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),c}function c(t){return e.enter(`codeFencedFence`),jP(t)?IP(e,l,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):l(t)}function l(t){return t===s?(e.enter(`codeFencedFenceSequence`),u(t)):n(t)}function u(t){return t===s?(i++,e.consume(t),u):i>=o?(e.exit(`codeFencedFenceSequence`),jP(t)?IP(e,d,`whitespace`)(t):d(t)):n(t)}function d(r){return r===null||$(r)?(e.exit(`codeFencedFence`),t(r)):n(r)}}}function uF(e,t,n){let r=this;return i;function i(t){return t===null?n(t):(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),a)}function a(e){return r.parser.lazy[r.now().line]?n(e):t(e)}}var dF={name:`codeIndented`,tokenize:pF},fF={partial:!0,tokenize:mF};function pF(e,t,n){let r=this;return i;function i(t){return e.enter(`codeIndented`),IP(e,a,`linePrefix`,5)(t)}function a(e){let t=r.events[r.events.length-1];return t&&t[1].type===`linePrefix`&&t[2].sliceSerialize(t[1],!0).length>=4?o(e):n(e)}function o(t){return t===null?c(t):$(t)?e.attempt(fF,o,c)(t):(e.enter(`codeFlowValue`),s(t))}function s(t){return t===null||$(t)?(e.exit(`codeFlowValue`),o(t)):(e.consume(t),s)}function c(n){return e.exit(`codeIndented`),t(n)}}function mF(e,t,n){let r=this;return i;function i(t){return r.parser.lazy[r.now().line]?n(t):$(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),i):IP(e,a,`linePrefix`,5)(t)}function a(e){let a=r.events[r.events.length-1];return a&&a[1].type===`linePrefix`&&a[2].sliceSerialize(a[1],!0).length>=4?t(e):$(e)?i(e):n(e)}}var hF={name:`codeText`,previous:_F,resolve:gF,tokenize:vF};function gF(e){let t=e.length-4,n=3,r,i;if((e[n][1].type===`lineEnding`||e[n][1].type===`space`)&&(e[t][1].type===`lineEnding`||e[t][1].type===`space`)){for(r=n;++r<t;)if(e[r][1].type===`codeTextData`){e[n][1].type=`codeTextPadding`,e[t][1].type=`codeTextPadding`,n+=2,t-=2;break}}for(r=n-1,t++;++r<=t;)i===void 0?r!==t&&e[r][1].type!==`lineEnding`&&(i=r):(r===t||e[r][1].type===`lineEnding`)&&(e[i][1].type=`codeTextData`,r!==i+2&&(e[i][1].end=e[r-1][1].end,e.splice(i+2,r-i-2),t-=r-i-2,r=i+2),i=void 0);return e}function _F(e){return e!==96||this.events[this.events.length-1][1].type===`characterEscape`}function vF(e,t,n){let r=0,i,a;return o;function o(t){return e.enter(`codeText`),e.enter(`codeTextSequence`),s(t)}function s(t){return t===96?(e.consume(t),r++,s):(e.exit(`codeTextSequence`),c(t))}function c(t){return t===null?n(t):t===32?(e.enter(`space`),e.consume(t),e.exit(`space`),c):t===96?(a=e.enter(`codeTextSequence`),i=0,u(t)):$(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),c):(e.enter(`codeTextData`),l(t))}function l(t){return t===null||t===32||t===96||$(t)?(e.exit(`codeTextData`),c(t)):(e.consume(t),l)}function u(n){return n===96?(e.consume(n),i++,u):i===r?(e.exit(`codeTextSequence`),e.exit(`codeText`),t(n)):(a.type=`codeTextData`,l(n))}}var yF=class{constructor(e){this.left=e?[...e]:[],this.right=[]}get(e){if(e<0||e>=this.left.length+this.right.length)throw RangeError("Cannot access index `"+e+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return e<this.left.length?this.left[e]:this.right[this.right.length-e+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(e,t){let n=t??1/0;return n<this.left.length?this.left.slice(e,n):e>this.left.length?this.right.slice(this.right.length-n+this.left.length,this.right.length-e+this.left.length).reverse():this.left.slice(e).concat(this.right.slice(this.right.length-n+this.left.length).reverse())}splice(e,t,n){let r=t||0;this.setCursor(Math.trunc(e));let i=this.right.splice(this.right.length-r,1/0);return n&&bF(this.left,n),i.reverse()}pop(){return this.setCursor(1/0),this.left.pop()}push(e){this.setCursor(1/0),this.left.push(e)}pushMany(e){this.setCursor(1/0),bF(this.left,e)}unshift(e){this.setCursor(0),this.right.push(e)}unshiftMany(e){this.setCursor(0),bF(this.right,e.reverse())}setCursor(e){if(!(e===this.left.length||e>this.left.length&&this.right.length===0||e<0&&this.left.length===0)){if(e<this.left.length){let t=this.left.splice(e,1/0);bF(this.right,t.reverse())}else{let t=this.right.splice(this.left.length+this.right.length-e,1/0);bF(this.left,t.reverse())}}}};function bF(e,t){let n=0;if(t.length<1e4)e.push(...t);else for(;n<t.length;)e.push(...t.slice(n,n+1e4)),n+=1e4}function xF(e){let t={},n=-1,r,i,a,o,s,c,l,u=new yF(e);for(;++n<u.length;){for(;n in t;)n=t[n];if(r=u.get(n),n&&r[1].type===`chunkFlow`&&u.get(n-1)[1].type===`listItemPrefix`&&(c=r[1]._tokenizer.events,a=0,a<c.length&&c[a][1].type===`lineEndingBlank`&&(a+=2),a<c.length&&c[a][1].type===`content`))for(;++a<c.length&&c[a][1].type!==`content`;)c[a][1].type===`chunkText`&&(c[a][1]._isInFirstContentOfListItem=!0,a++);if(r[0]===`enter`)r[1].contentType&&(Object.assign(t,SF(u,n)),n=t[n],l=!0);else if(r[1]._container){for(a=n,i=void 0;a--;)if(o=u.get(a),o[1].type===`lineEnding`||o[1].type===`lineEndingBlank`)o[0]===`enter`&&(i&&(u.get(i)[1].type=`lineEndingBlank`),o[1].type=`lineEnding`,i=a);else if(o[1].type!==`linePrefix`&&o[1].type!==`listItemIndent`)break;i&&(r[1].end={...u.get(i)[1].start},s=u.slice(i,n),s.unshift(r),u.splice(i,n-i+1,s))}}return hP(e,0,1/0,u.slice(0)),!l}function SF(e,t){let n=e.get(t)[1],r=e.get(t)[2],i=t-1,a=[],o=n._tokenizer;o||(o=r.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(o._contentTypeTextTrailing=!0));let s=o.events,c=[],l={},u,d,f=-1,p=n,m=0,h=0,g=[h];for(;p;){for(;e.get(++i)[1]!==p;);a.push(i),p._tokenizer||(u=r.sliceStream(p),p.next||u.push(null),d&&o.defineSkip(p.start),p._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=!0),o.write(u),p._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=void 0)),d=p,p=p.next}for(p=n;++f<s.length;)s[f][0]===`exit`&&s[f-1][0]===`enter`&&s[f][1].type===s[f-1][1].type&&s[f][1].start.line!==s[f][1].end.line&&(h=f+1,g.push(h),p._tokenizer=void 0,p.previous=void 0,p=p.next);for(o.events=[],p?(p._tokenizer=void 0,p.previous=void 0):g.pop(),f=g.length;f--;){let t=s.slice(g[f],g[f+1]),n=a.pop();c.push([n,n+t.length-1]),e.splice(n,2,t)}for(c.reverse(),f=-1;++f<c.length;)l[m+c[f][0]]=m+c[f][1],m+=c[f][1]-c[f][0]-1;return l}var CF={resolve:TF,tokenize:EF},wF={partial:!0,tokenize:DF};function TF(e){return xF(e),e}function EF(e,t){let n;return r;function r(t){return e.enter(`content`),n=e.enter(`chunkContent`,{contentType:`content`}),i(t)}function i(t){return t===null?a(t):$(t)?e.check(wF,o,a)(t):(e.consume(t),i)}function a(n){return e.exit(`chunkContent`),e.exit(`content`),t(n)}function o(t){return e.consume(t),e.exit(`chunkContent`),n.next=e.enter(`chunkContent`,{contentType:`content`,previous:n}),n=n.next,i}}function DF(e,t,n){let r=this;return i;function i(t){return e.exit(`chunkContent`),e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),IP(e,a,`linePrefix`)}function a(i){if(i===null||$(i))return n(i);let a=r.events[r.events.length-1];return!r.parser.constructs.disable.null.includes(`codeIndented`)&&a&&a[1].type===`linePrefix`&&a[2].sliceSerialize(a[1],!0).length>=4?t(i):e.interrupt(r.parser.constructs.flow,n,t)(i)}}function OF(e,t,n,r,i,a,o,s,c){let l=c||1/0,u=0;return d;function d(t){return t===60?(e.enter(r),e.enter(i),e.enter(a),e.consume(t),e.exit(a),f):t===null||t===32||t===41||EP(t)?n(t):(e.enter(r),e.enter(o),e.enter(s),e.enter(`chunkString`,{contentType:`string`}),h(t))}function f(n){return n===62?(e.enter(a),e.consume(n),e.exit(a),e.exit(i),e.exit(r),t):(e.enter(s),e.enter(`chunkString`,{contentType:`string`}),p(n))}function p(t){return t===62?(e.exit(`chunkString`),e.exit(s),f(t)):t===null||t===60||$(t)?n(t):(e.consume(t),t===92?m:p)}function m(t){return t===60||t===62||t===92?(e.consume(t),p):p(t)}function h(i){return!u&&(i===null||i===41||AP(i))?(e.exit(`chunkString`),e.exit(s),e.exit(o),e.exit(r),t(i)):u<l&&i===40?(e.consume(i),u++,h):i===41?(e.consume(i),u--,h):i===null||i===32||i===40||EP(i)?n(i):(e.consume(i),i===92?g:h)}function g(t){return t===40||t===41||t===92?(e.consume(t),h):h(t)}}function kF(e,t,n,r,i,a){let o=this,s=0,c;return l;function l(t){return e.enter(r),e.enter(i),e.consume(t),e.exit(i),e.enter(a),u}function u(l){return s>999||l===null||l===91||l===93&&!c||l===94&&!s&&`_hiddenFootnoteSupport`in o.parser.constructs?n(l):l===93?(e.exit(a),e.enter(i),e.consume(l),e.exit(i),e.exit(r),t):$(l)?(e.enter(`lineEnding`),e.consume(l),e.exit(`lineEnding`),u):(e.enter(`chunkString`,{contentType:`string`}),d(l))}function d(t){return t===null||t===91||t===93||$(t)||s++>999?(e.exit(`chunkString`),u(t)):(e.consume(t),c||=!jP(t),t===92?f:d)}function f(t){return t===91||t===92||t===93?(e.consume(t),s++,d):d(t)}}function AF(e,t,n,r,i,a){let o;return s;function s(t){return t===34||t===39||t===40?(e.enter(r),e.enter(i),e.consume(t),e.exit(i),o=t===40?41:t,c):n(t)}function c(n){return n===o?(e.enter(i),e.consume(n),e.exit(i),e.exit(r),t):(e.enter(a),l(n))}function l(t){return t===o?(e.exit(a),c(o)):t===null?n(t):$(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),IP(e,l,`linePrefix`)):(e.enter(`chunkString`,{contentType:`string`}),u(t))}function u(t){return t===o||t===null||$(t)?(e.exit(`chunkString`),l(t)):(e.consume(t),t===92?d:u)}function d(t){return t===o||t===92?(e.consume(t),u):u(t)}}function jF(e,t){let n;return r;function r(i){return $(i)?(e.enter(`lineEnding`),e.consume(i),e.exit(`lineEnding`),n=!0,r):jP(i)?IP(e,r,n?`linePrefix`:`lineSuffix`)(i):t(i)}}var MF={name:`definition`,tokenize:PF},NF={partial:!0,tokenize:FF};function PF(e,t,n){let r=this,i;return a;function a(t){return e.enter(`definition`),o(t)}function o(t){return kF.call(r,e,s,n,`definitionLabel`,`definitionLabelMarker`,`definitionLabelString`)(t)}function s(t){return i=SP(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),t===58?(e.enter(`definitionMarker`),e.consume(t),e.exit(`definitionMarker`),c):n(t)}function c(t){return AP(t)?jF(e,l)(t):l(t)}function l(t){return OF(e,u,n,`definitionDestination`,`definitionDestinationLiteral`,`definitionDestinationLiteralMarker`,`definitionDestinationRaw`,`definitionDestinationString`)(t)}function u(t){return e.attempt(NF,d,d)(t)}function d(t){return jP(t)?IP(e,f,`whitespace`)(t):f(t)}function f(a){return a===null||$(a)?(e.exit(`definition`),r.parser.defined.push(i),t(a)):n(a)}}function FF(e,t,n){return r;function r(t){return AP(t)?jF(e,i)(t):n(t)}function i(t){return AF(e,a,n,`definitionTitle`,`definitionTitleMarker`,`definitionTitleString`)(t)}function a(t){return jP(t)?IP(e,o,`whitespace`)(t):o(t)}function o(e){return e===null||$(e)?t(e):n(e)}}var IF={name:`hardBreakEscape`,tokenize:LF};function LF(e,t,n){return r;function r(t){return e.enter(`hardBreakEscape`),e.consume(t),i}function i(r){return $(r)?(e.exit(`hardBreakEscape`),t(r)):n(r)}}var RF={name:`headingAtx`,resolve:zF,tokenize:BF};function zF(e,t){let n=e.length-2,r=3,i,a;return e[r][1].type===`whitespace`&&(r+=2),n-2>r&&e[n][1].type===`whitespace`&&(n-=2),e[n][1].type===`atxHeadingSequence`&&(r===n-1||n-4>r&&e[n-2][1].type===`whitespace`)&&(n-=r+1===n?2:4),n>r&&(i={type:`atxHeadingText`,start:e[r][1].start,end:e[n][1].end},a={type:`chunkText`,start:e[r][1].start,end:e[n][1].end,contentType:`text`},hP(e,r,n-r+1,[[`enter`,i,t],[`enter`,a,t],[`exit`,a,t],[`exit`,i,t]])),e}function BF(e,t,n){let r=0;return i;function i(t){return e.enter(`atxHeading`),a(t)}function a(t){return e.enter(`atxHeadingSequence`),o(t)}function o(t){return t===35&&r++<6?(e.consume(t),o):t===null||AP(t)?(e.exit(`atxHeadingSequence`),s(t)):n(t)}function s(n){return n===35?(e.enter(`atxHeadingSequence`),c(n)):n===null||$(n)?(e.exit(`atxHeading`),t(n)):jP(n)?IP(e,s,`whitespace`)(n):(e.enter(`atxHeadingText`),l(n))}function c(t){return t===35?(e.consume(t),c):(e.exit(`atxHeadingSequence`),s(t))}function l(t){return t===null||t===35||AP(t)?(e.exit(`atxHeadingText`),s(t)):(e.consume(t),l)}}var VF=`address.article.aside.base.basefont.blockquote.body.caption.center.col.colgroup.dd.details.dialog.dir.div.dl.dt.fieldset.figcaption.figure.footer.form.frame.frameset.h1.h2.h3.h4.h5.h6.head.header.hr.html.iframe.legend.li.link.main.menu.menuitem.nav.noframes.ol.optgroup.option.p.param.search.section.summary.table.tbody.td.tfoot.th.thead.title.tr.track.ul`.split(`.`),HF=[`pre`,`script`,`style`,`textarea`],UF={concrete:!0,name:`htmlFlow`,resolveTo:KF,tokenize:qF},WF={partial:!0,tokenize:YF},GF={partial:!0,tokenize:JF};function KF(e){let t=e.length;for(;t--&&(e[t][0]!==`enter`||e[t][1].type!==`htmlFlow`););return t>1&&e[t-2][1].type===`linePrefix`&&(e[t][1].start=e[t-2][1].start,e[t+1][1].start=e[t-2][1].start,e.splice(t-2,2)),e}function qF(e,t,n){let r=this,i,a,o,s,c;return l;function l(e){return u(e)}function u(t){return e.enter(`htmlFlow`),e.enter(`htmlFlowData`),e.consume(t),d}function d(s){return s===33?(e.consume(s),f):s===47?(e.consume(s),a=!0,h):s===63?(e.consume(s),i=3,r.interrupt?t:N):CP(s)?(e.consume(s),o=String.fromCharCode(s),g):n(s)}function f(a){return a===45?(e.consume(a),i=2,p):a===91?(e.consume(a),i=5,s=0,m):CP(a)?(e.consume(a),i=4,r.interrupt?t:N):n(a)}function p(i){return i===45?(e.consume(i),r.interrupt?t:N):n(i)}function m(i){return i===`CDATA[`.charCodeAt(s++)?(e.consume(i),s===6?r.interrupt?t:O:m):n(i)}function h(t){return CP(t)?(e.consume(t),o=String.fromCharCode(t),g):n(t)}function g(s){if(s===null||s===47||s===62||AP(s)){let c=s===47,l=o.toLowerCase();return!c&&!a&&HF.includes(l)?(i=1,r.interrupt?t(s):O(s)):VF.includes(o.toLowerCase())?(i=6,c?(e.consume(s),_):r.interrupt?t(s):O(s)):(i=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(s):a?v(s):y(s))}return s===45||wP(s)?(e.consume(s),o+=String.fromCharCode(s),g):n(s)}function _(i){return i===62?(e.consume(i),r.interrupt?t:O):n(i)}function v(t){return jP(t)?(e.consume(t),v):E(t)}function y(t){return t===47?(e.consume(t),E):t===58||t===95||CP(t)?(e.consume(t),b):jP(t)?(e.consume(t),y):E(t)}function b(t){return t===45||t===46||t===58||t===95||wP(t)?(e.consume(t),b):x(t)}function x(t){return t===61?(e.consume(t),S):jP(t)?(e.consume(t),x):y(t)}function S(t){return t===null||t===60||t===61||t===62||t===96?n(t):t===34||t===39?(e.consume(t),c=t,C):jP(t)?(e.consume(t),S):w(t)}function C(t){return t===c?(e.consume(t),c=null,T):t===null||$(t)?n(t):(e.consume(t),C)}function w(t){return t===null||t===34||t===39||t===47||t===60||t===61||t===62||t===96||AP(t)?x(t):(e.consume(t),w)}function T(e){return e===47||e===62||jP(e)?y(e):n(e)}function E(t){return t===62?(e.consume(t),D):n(t)}function D(t){return t===null||$(t)?O(t):jP(t)?(e.consume(t),D):n(t)}function O(t){return t===45&&i===2?(e.consume(t),j):t===60&&i===1?(e.consume(t),M):t===62&&i===4?(e.consume(t),P):t===63&&i===3?(e.consume(t),N):t===93&&i===5?(e.consume(t),ne):$(t)&&(i===6||i===7)?(e.exit(`htmlFlowData`),e.check(WF,re,k)(t)):t===null||$(t)?(e.exit(`htmlFlowData`),k(t)):(e.consume(t),O)}function k(t){return e.check(GF,ee,re)(t)}function ee(t){return e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),A}function A(t){return t===null||$(t)?k(t):(e.enter(`htmlFlowData`),O(t))}function j(t){return t===45?(e.consume(t),N):O(t)}function M(t){return t===47?(e.consume(t),o=``,te):O(t)}function te(t){if(t===62){let n=o.toLowerCase();return HF.includes(n)?(e.consume(t),P):O(t)}return CP(t)&&o.length<8?(e.consume(t),o+=String.fromCharCode(t),te):O(t)}function ne(t){return t===93?(e.consume(t),N):O(t)}function N(t){return t===62?(e.consume(t),P):t===45&&i===2?(e.consume(t),N):O(t)}function P(t){return t===null||$(t)?(e.exit(`htmlFlowData`),re(t)):(e.consume(t),P)}function re(n){return e.exit(`htmlFlow`),t(n)}}function JF(e,t,n){let r=this;return i;function i(t){return $(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),a):n(t)}function a(e){return r.parser.lazy[r.now().line]?n(e):t(e)}}function YF(e,t,n){return r;function r(r){return e.enter(`lineEnding`),e.consume(r),e.exit(`lineEnding`),e.attempt(ZP,t,n)}}var XF={name:`htmlText`,tokenize:ZF};function ZF(e,t,n){let r=this,i,a,o;return s;function s(t){return e.enter(`htmlText`),e.enter(`htmlTextData`),e.consume(t),c}function c(t){return t===33?(e.consume(t),l):t===47?(e.consume(t),x):t===63?(e.consume(t),y):CP(t)?(e.consume(t),w):n(t)}function l(t){return t===45?(e.consume(t),u):t===91?(e.consume(t),a=0,m):CP(t)?(e.consume(t),v):n(t)}function u(t){return t===45?(e.consume(t),p):n(t)}function d(t){return t===null?n(t):t===45?(e.consume(t),f):$(t)?(o=d,M(t)):(e.consume(t),d)}function f(t){return t===45?(e.consume(t),p):d(t)}function p(e){return e===62?j(e):e===45?f(e):d(e)}function m(t){return t===`CDATA[`.charCodeAt(a++)?(e.consume(t),a===6?h:m):n(t)}function h(t){return t===null?n(t):t===93?(e.consume(t),g):$(t)?(o=h,M(t)):(e.consume(t),h)}function g(t){return t===93?(e.consume(t),_):h(t)}function _(t){return t===62?j(t):t===93?(e.consume(t),_):h(t)}function v(t){return t===null||t===62?j(t):$(t)?(o=v,M(t)):(e.consume(t),v)}function y(t){return t===null?n(t):t===63?(e.consume(t),b):$(t)?(o=y,M(t)):(e.consume(t),y)}function b(e){return e===62?j(e):y(e)}function x(t){return CP(t)?(e.consume(t),S):n(t)}function S(t){return t===45||wP(t)?(e.consume(t),S):C(t)}function C(t){return $(t)?(o=C,M(t)):jP(t)?(e.consume(t),C):j(t)}function w(t){return t===45||wP(t)?(e.consume(t),w):t===47||t===62||AP(t)?T(t):n(t)}function T(t){return t===47?(e.consume(t),j):t===58||t===95||CP(t)?(e.consume(t),E):$(t)?(o=T,M(t)):jP(t)?(e.consume(t),T):j(t)}function E(t){return t===45||t===46||t===58||t===95||wP(t)?(e.consume(t),E):D(t)}function D(t){return t===61?(e.consume(t),O):$(t)?(o=D,M(t)):jP(t)?(e.consume(t),D):T(t)}function O(t){return t===null||t===60||t===61||t===62||t===96?n(t):t===34||t===39?(e.consume(t),i=t,k):$(t)?(o=O,M(t)):jP(t)?(e.consume(t),O):(e.consume(t),ee)}function k(t){return t===i?(e.consume(t),i=void 0,A):t===null?n(t):$(t)?(o=k,M(t)):(e.consume(t),k)}function ee(t){return t===null||t===34||t===39||t===60||t===61||t===96?n(t):t===47||t===62||AP(t)?T(t):(e.consume(t),ee)}function A(e){return e===47||e===62||AP(e)?T(e):n(e)}function j(r){return r===62?(e.consume(r),e.exit(`htmlTextData`),e.exit(`htmlText`),t):n(r)}function M(t){return e.exit(`htmlTextData`),e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),te}function te(t){return jP(t)?IP(e,ne,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):ne(t)}function ne(t){return e.enter(`htmlTextData`),o(t)}}var QF={name:`labelEnd`,resolveAll:nI,resolveTo:rI,tokenize:iI},$F={tokenize:aI},eI={tokenize:oI},tI={tokenize:sI};function nI(e){let t=-1,n=[];for(;++t<e.length;){let r=e[t][1];if(n.push(e[t]),r.type===`labelImage`||r.type===`labelLink`||r.type===`labelEnd`){let e=r.type===`labelImage`?4:2;r.type=`data`,t+=e}}return e.length!==n.length&&hP(e,0,e.length,n),e}function rI(e,t){let n=e.length,r=0,i,a,o,s;for(;n--;)if(i=e[n][1],a){if(i.type===`link`||i.type===`labelLink`&&i._inactive)break;e[n][0]===`enter`&&i.type===`labelLink`&&(i._inactive=!0)}else if(o){if(e[n][0]===`enter`&&(i.type===`labelImage`||i.type===`labelLink`)&&!i._balanced&&(a=n,i.type!==`labelLink`)){r=2;break}}else i.type===`labelEnd`&&(o=n);let c={type:e[a][1].type===`labelLink`?`link`:`image`,start:{...e[a][1].start},end:{...e[e.length-1][1].end}},l={type:`label`,start:{...e[a][1].start},end:{...e[o][1].end}},u={type:`labelText`,start:{...e[a+r+2][1].end},end:{...e[o-2][1].start}};return s=[[`enter`,c,t],[`enter`,l,t]],s=gP(s,e.slice(a+1,a+r+3)),s=gP(s,[[`enter`,u,t]]),s=gP(s,WP(t.parser.constructs.insideSpan.null,e.slice(a+r+4,o-3),t)),s=gP(s,[[`exit`,u,t],e[o-2],e[o-1],[`exit`,l,t]]),s=gP(s,e.slice(o+1)),s=gP(s,[[`exit`,c,t]]),hP(e,a,e.length,s),e}function iI(e,t,n){let r=this,i=r.events.length,a,o;for(;i--;)if((r.events[i][1].type===`labelImage`||r.events[i][1].type===`labelLink`)&&!r.events[i][1]._balanced){a=r.events[i][1];break}return s;function s(t){return a?a._inactive?d(t):(o=r.parser.defined.includes(SP(r.sliceSerialize({start:a.end,end:r.now()}))),e.enter(`labelEnd`),e.enter(`labelMarker`),e.consume(t),e.exit(`labelMarker`),e.exit(`labelEnd`),c):n(t)}function c(t){return t===40?e.attempt($F,u,o?u:d)(t):t===91?e.attempt(eI,u,o?l:d)(t):o?u(t):d(t)}function l(t){return e.attempt(tI,u,d)(t)}function u(e){return t(e)}function d(e){return a._balanced=!0,n(e)}}function aI(e,t,n){return r;function r(t){return e.enter(`resource`),e.enter(`resourceMarker`),e.consume(t),e.exit(`resourceMarker`),i}function i(t){return AP(t)?jF(e,a)(t):a(t)}function a(t){return t===41?u(t):OF(e,o,s,`resourceDestination`,`resourceDestinationLiteral`,`resourceDestinationLiteralMarker`,`resourceDestinationRaw`,`resourceDestinationString`,32)(t)}function o(t){return AP(t)?jF(e,c)(t):u(t)}function s(e){return n(e)}function c(t){return t===34||t===39||t===40?AF(e,l,n,`resourceTitle`,`resourceTitleMarker`,`resourceTitleString`)(t):u(t)}function l(t){return AP(t)?jF(e,u)(t):u(t)}function u(r){return r===41?(e.enter(`resourceMarker`),e.consume(r),e.exit(`resourceMarker`),e.exit(`resource`),t):n(r)}}function oI(e,t,n){let r=this;return i;function i(t){return kF.call(r,e,a,o,`reference`,`referenceMarker`,`referenceString`)(t)}function a(e){return r.parser.defined.includes(SP(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(e):n(e)}function o(e){return n(e)}}function sI(e,t,n){return r;function r(t){return e.enter(`reference`),e.enter(`referenceMarker`),e.consume(t),e.exit(`referenceMarker`),i}function i(r){return r===93?(e.enter(`referenceMarker`),e.consume(r),e.exit(`referenceMarker`),e.exit(`reference`),t):n(r)}}var cI={name:`labelStartImage`,resolveAll:QF.resolveAll,tokenize:lI};function lI(e,t,n){let r=this;return i;function i(t){return e.enter(`labelImage`),e.enter(`labelImageMarker`),e.consume(t),e.exit(`labelImageMarker`),a}function a(t){return t===91?(e.enter(`labelMarker`),e.consume(t),e.exit(`labelMarker`),e.exit(`labelImage`),o):n(t)}function o(e){return e===94&&`_hiddenFootnoteSupport`in r.parser.constructs?n(e):t(e)}}var uI={name:`labelStartLink`,resolveAll:QF.resolveAll,tokenize:dI};function dI(e,t,n){let r=this;return i;function i(t){return e.enter(`labelLink`),e.enter(`labelMarker`),e.consume(t),e.exit(`labelMarker`),e.exit(`labelLink`),a}function a(e){return e===94&&`_hiddenFootnoteSupport`in r.parser.constructs?n(e):t(e)}}var fI={name:`lineEnding`,tokenize:pI};function pI(e,t){return n;function n(n){return e.enter(`lineEnding`),e.consume(n),e.exit(`lineEnding`),IP(e,t,`linePrefix`)}}var mI={name:`thematicBreak`,tokenize:hI};function hI(e,t,n){let r=0,i;return a;function a(t){return e.enter(`thematicBreak`),o(t)}function o(e){return i=e,s(e)}function s(a){return a===i?(e.enter(`thematicBreakSequence`),c(a)):r>=3&&(a===null||$(a))?(e.exit(`thematicBreak`),t(a)):n(a)}function c(t){return t===i?(e.consume(t),r++,c):(e.exit(`thematicBreakSequence`),jP(t)?IP(e,s,`whitespace`)(t):s(t))}}var gI={continuation:{tokenize:bI},exit:SI,name:`list`,tokenize:yI},_I={partial:!0,tokenize:CI},vI={partial:!0,tokenize:xI};function yI(e,t,n){let r=this,i=r.events[r.events.length-1],a=i&&i[1].type===`linePrefix`?i[2].sliceSerialize(i[1],!0).length:0,o=0;return s;function s(t){let i=r.containerState.type||(t===42||t===43||t===45?`listUnordered`:`listOrdered`);if(i===`listUnordered`?!r.containerState.marker||t===r.containerState.marker:DP(t)){if(r.containerState.type||(r.containerState.type=i,e.enter(i,{_container:!0})),i===`listUnordered`)return e.enter(`listItemPrefix`),t===42||t===45?e.check(mI,n,l)(t):l(t);if(!r.interrupt||t===49)return e.enter(`listItemPrefix`),e.enter(`listItemValue`),c(t)}return n(t)}function c(t){return DP(t)&&++o<10?(e.consume(t),c):(!r.interrupt||o<2)&&(r.containerState.marker?t===r.containerState.marker:t===41||t===46)?(e.exit(`listItemValue`),l(t)):n(t)}function l(t){return e.enter(`listItemMarker`),e.consume(t),e.exit(`listItemMarker`),r.containerState.marker=r.containerState.marker||t,e.check(ZP,r.interrupt?n:u,e.attempt(_I,f,d))}function u(e){return r.containerState.initialBlankLine=!0,a++,f(e)}function d(t){return jP(t)?(e.enter(`listItemPrefixWhitespace`),e.consume(t),e.exit(`listItemPrefixWhitespace`),f):n(t)}function f(n){return r.containerState.size=a+r.sliceSerialize(e.exit(`listItemPrefix`),!0).length,t(n)}}function bI(e,t,n){let r=this;return r.containerState._closeFlow=void 0,e.check(ZP,i,a);function i(n){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,IP(e,t,`listItemIndent`,r.containerState.size+1)(n)}function a(n){return r.containerState.furtherBlankLines||!jP(n)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,o(n)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(vI,t,o)(n))}function o(i){return r.containerState._closeFlow=!0,r.interrupt=void 0,IP(e,e.attempt(gI,t,n),`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(i)}}function xI(e,t,n){let r=this;return IP(e,i,`listItemIndent`,r.containerState.size+1);function i(e){let i=r.events[r.events.length-1];return i&&i[1].type===`listItemIndent`&&i[2].sliceSerialize(i[1],!0).length===r.containerState.size?t(e):n(e)}}function SI(e){e.exit(this.containerState.type)}function CI(e,t,n){let r=this;return IP(e,i,`listItemPrefixWhitespace`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:5);function i(e){let i=r.events[r.events.length-1];return!jP(e)&&i&&i[1].type===`listItemPrefixWhitespace`?t(e):n(e)}}var wI={name:`setextUnderline`,resolveTo:TI,tokenize:EI};function TI(e,t){let n=e.length,r,i,a;for(;n--;)if(e[n][0]===`enter`){if(e[n][1].type===`content`){r=n;break}e[n][1].type===`paragraph`&&(i=n)}else e[n][1].type===`content`&&e.splice(n,1),!a&&e[n][1].type===`definition`&&(a=n);let o={type:`setextHeading`,start:{...e[r][1].start},end:{...e[e.length-1][1].end}};return e[i][1].type=`setextHeadingText`,a?(e.splice(i,0,[`enter`,o,t]),e.splice(a+1,0,[`exit`,e[r][1],t]),e[r][1].end={...e[a][1].end}):e[r][1]=o,e.push([`exit`,o,t]),e}function EI(e,t,n){let r=this,i;return a;function a(t){let a=r.events.length,s;for(;a--;)if(r.events[a][1].type!==`lineEnding`&&r.events[a][1].type!==`linePrefix`&&r.events[a][1].type!==`content`){s=r.events[a][1].type===`paragraph`;break}return!r.parser.lazy[r.now().line]&&(r.interrupt||s)?(e.enter(`setextHeadingLine`),i=t,o(t)):n(t)}function o(t){return e.enter(`setextHeadingLineSequence`),s(t)}function s(t){return t===i?(e.consume(t),s):(e.exit(`setextHeadingLineSequence`),jP(t)?IP(e,c,`lineSuffix`)(t):c(t))}function c(r){return r===null||$(r)?(e.exit(`setextHeadingLine`),t(r)):n(r)}}var DI={tokenize:OI};function OI(e){let t=this,n=e.attempt(ZP,r,e.attempt(this.parser.constructs.flowInitial,i,IP(e,e.attempt(this.parser.constructs.flow,i,e.attempt(CF,i)),`linePrefix`)));return n;function r(r){if(r===null){e.consume(r);return}return e.enter(`lineEndingBlank`),e.consume(r),e.exit(`lineEndingBlank`),t.currentConstruct=void 0,n}function i(r){if(r===null){e.consume(r);return}return e.enter(`lineEnding`),e.consume(r),e.exit(`lineEnding`),t.currentConstruct=void 0,n}}var kI={resolveAll:NI()},AI=MI(`string`),jI=MI(`text`);function MI(e){return{resolveAll:NI(e===`text`?PI:void 0),tokenize:t};function t(t){let n=this,r=this.parser.constructs[e],i=t.attempt(r,a,o);return a;function a(e){return c(e)?i(e):o(e)}function o(e){if(e===null){t.consume(e);return}return t.enter(`data`),t.consume(e),s}function s(e){return c(e)?(t.exit(`data`),i(e)):(t.consume(e),s)}function c(e){if(e===null)return!0;let t=r[e],i=-1;if(t)for(;++i<t.length;){let e=t[i];if(!e.previous||e.previous.call(n,n.previous))return!0}return!1}}}function NI(e){return t;function t(t,n){let r=-1,i;for(;++r<=t.length;)i===void 0?t[r]&&t[r][1].type===`data`&&(i=r,r++):(!t[r]||t[r][1].type!==`data`)&&(r!==i+2&&(t[i][1].end=t[r-1][1].end,t.splice(i+2,r-i-2),r=i+2),i=void 0);return e?e(t,n):t}}function PI(e,t){let n=0;for(;++n<=e.length;)if((n===e.length||e[n][1].type===`lineEnding`)&&e[n-1][1].type===`data`){let r=e[n-1][1],i=t.sliceStream(r),a=i.length,o=-1,s=0,c;for(;a--;){let e=i[a];if(typeof e==`string`){for(o=e.length;e.charCodeAt(o-1)===32;)s++,o--;if(o)break;o=-1}else if(e===-2)c=!0,s++;else if(e!==-1){a++;break}}if(t._contentTypeTextTrailing&&n===e.length&&(s=0),s){let i={type:n===e.length||c||s<2?`lineSuffix`:`hardBreakTrailing`,start:{_bufferIndex:a?o:r.start._bufferIndex+o,_index:r.start._index+a,line:r.end.line,column:r.end.column-s,offset:r.end.offset-s},end:{...r.end}};r.end={...i.start},r.start.offset===r.end.offset?Object.assign(r,i):(e.splice(n,0,[`enter`,i,t],[`exit`,i,t]),n+=2)}n++}return e}var FI=s({attentionMarkers:()=>UI,contentInitial:()=>LI,disable:()=>WI,document:()=>II,flow:()=>zI,flowInitial:()=>RI,insideSpan:()=>HI,string:()=>BI,text:()=>VI}),II={42:gI,43:gI,45:gI,48:gI,49:gI,50:gI,51:gI,52:gI,53:gI,54:gI,55:gI,56:gI,57:gI,62:$P},LI={91:MF},RI={[-2]:dF,[-1]:dF,32:dF},zI={35:RF,42:mI,45:[wI,mI],60:UF,61:wI,95:mI,96:cF,126:cF},BI={38:aF,92:rF},VI={[-5]:fI,[-4]:fI,[-3]:fI,33:cI,38:aF,42:GP,60:[YP,XF],91:uI,92:[IF,rF],93:QF,95:GP,96:hF},HI={null:[GP,kI]},UI={null:[42,95]},WI={null:[]};function GI(e,t,n){let r={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0},i={},a=[],o=[],s=[],c={attempt:C(x),check:C(S),consume:v,enter:y,exit:b,interrupt:C(S,{interrupt:!0})},l={code:null,containerState:{},defineSkip:h,events:[],now:m,parser:e,previous:null,sliceSerialize:f,sliceStream:p,write:d},u=t.tokenize.call(l,c);return t.resolveAll&&a.push(t),l;function d(e){return o=gP(o,e),g(),o[o.length-1]===null?(w(t,0),l.events=WP(a,l.events,l),l.events):[]}function f(e,t){return qI(p(e),t)}function p(e){return KI(o,e)}function m(){let{_bufferIndex:e,_index:t,line:n,column:i,offset:a}=r;return{_bufferIndex:e,_index:t,line:n,column:i,offset:a}}function h(e){i[e.line]=e.column,E()}function g(){let e;for(;r._index<o.length;){let t=o[r._index];if(typeof t==`string`)for(e=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===e&&r._bufferIndex<t.length;)_(t.charCodeAt(r._bufferIndex));else _(t)}}function _(e){u=u(e)}function v(e){$(e)?(r.line++,r.column=1,r.offset+=e===-3?2:1,E()):e!==-1&&(r.column++,r.offset++),r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===o[r._index].length&&(r._bufferIndex=-1,r._index++)),l.previous=e}function y(e,t){let n=t||{};return n.type=e,n.start=m(),l.events.push([`enter`,n,l]),s.push(n),n}function b(e){let t=s.pop();return t.end=m(),l.events.push([`exit`,t,l]),t}function x(e,t){w(e,t.from)}function S(e,t){t.restore()}function C(e,t){return n;function n(n,r,i){let a,o,s,u;return Array.isArray(n)?f(n):`tokenize`in n?f([n]):d(n);function d(e){return t;function t(t){let n=t!==null&&e[t],r=t!==null&&e.null;return f([...Array.isArray(n)?n:n?[n]:[],...Array.isArray(r)?r:r?[r]:[]])(t)}}function f(e){return a=e,o=0,e.length===0?i:p(e[o])}function p(e){return n;function n(n){return u=T(),s=e,e.partial||(l.currentConstruct=e),e.name&&l.parser.constructs.disable.null.includes(e.name)?h(n):e.tokenize.call(t?Object.assign(Object.create(l),t):l,c,m,h)(n)}}function m(t){return e(s,u),r}function h(e){return u.restore(),++o<a.length?p(a[o]):i}}}function w(e,t){e.resolveAll&&!a.includes(e)&&a.push(e),e.resolve&&hP(l.events,t,l.events.length-t,e.resolve(l.events.slice(t),l)),e.resolveTo&&(l.events=e.resolveTo(l.events,l))}function T(){let e=m(),t=l.previous,n=l.currentConstruct,i=l.events.length,a=Array.from(s);return{from:i,restore:o};function o(){r=e,l.previous=t,l.currentConstruct=n,l.events.length=i,s=a,E()}}function E(){r.line in i&&r.column<2&&(r.column=i[r.line],r.offset+=i[r.line]-1)}}function KI(e,t){let n=t.start._index,r=t.start._bufferIndex,i=t.end._index,a=t.end._bufferIndex,o;if(n===i)o=[e[n].slice(r,a)];else{if(o=e.slice(n,i),r>-1){let e=o[0];typeof e==`string`?o[0]=e.slice(r):o.shift()}a>0&&o.push(e[i].slice(0,a))}return o}function qI(e,t){let n=-1,r=[],i;for(;++n<e.length;){let a=e[n],o;if(typeof a==`string`)o=a;else switch(a){case-5:o=`\r`;break;case-4:o=`
|
|
75
|
-
`;break;case-3:o=`\r
|
|
76
|
-
`;break;case-2:o=t?` `:` `;break;case-1:if(!t&&i)continue;o=` `;break;default:o=String.fromCharCode(a)}i=a===-2,r.push(o)}return r.join(``)}function JI(e){let t={constructs:vP([FI,...(e||{}).extensions||[]]),content:n(LP),defined:[],document:n(zP),flow:n(DI),lazy:{},string:n(AI),text:n(jI)};return t;function n(e){return n;function n(n){return GI(t,e,n)}}}function YI(e){for(;!xF(e););return e}var XI=/[\0\t\n\r]/g;function ZI(){let e=1,t=``,n=!0,r;return i;function i(i,a,o){let s=[],c,l,u,d,f;for(i=t+(typeof i==`string`?i.toString():new TextDecoder(a||void 0).decode(i)),u=0,t=``,n&&=(i.charCodeAt(0)===65279&&u++,void 0);u<i.length;){if(XI.lastIndex=u,c=XI.exec(i),d=c&&c.index!==void 0?c.index:i.length,f=i.charCodeAt(d),!c){t=i.slice(u);break}if(f===10&&u===d&&r)s.push(-3),r=void 0;else switch(r&&=(s.push(-5),void 0),u<d&&(s.push(i.slice(u,d)),e+=d-u),f){case 0:s.push(65533),e++;break;case 9:for(l=Math.ceil(e/4)*4,s.push(-2);e++<l;)s.push(-1);break;case 10:s.push(-4),e=1;break;default:r=!0,e=1}u=d+1}return o&&(r&&s.push(-5),t&&s.push(t),s.push(null)),s}}var QI=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function $I(e){return e.replace(QI,eL)}function eL(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){let e=n.charCodeAt(1),t=e===120||e===88;return xP(n.slice(t?2:1),t?16:10)}return mP(n)||e}var tL={}.hasOwnProperty;function nL(e,t,n){return t&&typeof t==`object`&&(n=t,t=void 0),rL(n)(YI(JI(n).document().write(ZI()(e,t,!0))))}function rL(e){let t={transforms:[],canContainEols:[`emphasis`,`fragment`,`heading`,`paragraph`,`strong`],enter:{autolink:a(ve),autolinkProtocol:T,autolinkEmail:T,atxHeading:a(me),blockQuote:a(le),characterEscape:T,characterReference:T,codeFenced:a(ue),codeFencedFenceInfo:o,codeFencedFenceMeta:o,codeIndented:a(ue,o),codeText:a(de,o),codeTextData:T,data:T,codeFlowValue:T,definition:a(fe),definitionDestinationString:o,definitionLabelString:o,definitionTitleString:o,emphasis:a(pe),hardBreakEscape:a(he),hardBreakTrailing:a(he),htmlFlow:a(ge,o),htmlFlowData:T,htmlText:a(ge,o),htmlTextData:T,image:a(_e),label:o,link:a(ve),listItem:a(be),listItemValue:f,listOrdered:a(ye,d),listUnordered:a(ye),paragraph:a(xe),reference:ie,referenceString:o,resourceDestinationString:o,resourceTitleString:o,setextHeading:a(me),strong:a(Se),thematicBreak:a(we)},exit:{atxHeading:c(),atxHeadingSequence:x,autolink:c(),autolinkEmail:ce,autolinkProtocol:se,blockQuote:c(),characterEscapeValue:E,characterReferenceMarkerHexadecimal:F,characterReferenceMarkerNumeric:F,characterReferenceValue:I,characterReference:oe,codeFenced:c(g),codeFencedFence:h,codeFencedFenceInfo:p,codeFencedFenceMeta:m,codeFlowValue:E,codeIndented:c(_),codeText:c(A),codeTextData:E,data:E,definition:c(),definitionDestinationString:b,definitionLabelString:v,definitionTitleString:y,emphasis:c(),hardBreakEscape:c(O),hardBreakTrailing:c(O),htmlFlow:c(k),htmlFlowData:E,htmlText:c(ee),htmlTextData:E,image:c(M),label:ne,labelText:te,lineEnding:D,link:c(j),listItem:c(),listOrdered:c(),listUnordered:c(),paragraph:c(),referenceString:ae,resourceDestinationString:N,resourceTitleString:P,resource:re,setextHeading:c(w),setextHeadingLineSequence:C,setextHeadingText:S,strong:c(),thematicBreak:c()}};aL(t,(e||{}).mdastExtensions||[]);let n={};return r;function r(e){let r={type:`root`,children:[]},a={stack:[r],tokenStack:[],config:t,enter:s,exit:l,buffer:o,resume:u,data:n},c=[],d=-1;for(;++d<e.length;)(e[d][1].type===`listOrdered`||e[d][1].type===`listUnordered`)&&(e[d][0]===`enter`?c.push(d):d=i(e,c.pop(),d));for(d=-1;++d<e.length;){let n=t[e[d][0]];tL.call(n,e[d][1].type)&&n[e[d][1].type].call(Object.assign({sliceSerialize:e[d][2].sliceSerialize},a),e[d][1])}if(a.tokenStack.length>0){let e=a.tokenStack[a.tokenStack.length-1];(e[1]||sL).call(a,void 0,e[0])}for(r.position={start:iL(e.length>0?e[0][1].start:{line:1,column:1,offset:0}),end:iL(e.length>0?e[e.length-2][1].end:{line:1,column:1,offset:0})},d=-1;++d<t.transforms.length;)r=t.transforms[d](r)||r;return r}function i(e,t,n){let r=t-1,i=-1,a=!1,o,s,c,l;for(;++r<=n;){let t=e[r];switch(t[1].type){case`listUnordered`:case`listOrdered`:case`blockQuote`:t[0]===`enter`?i++:i--,l=void 0;break;case`lineEndingBlank`:t[0]===`enter`&&(o&&!l&&!i&&!c&&(c=r),l=void 0);break;case`linePrefix`:case`listItemValue`:case`listItemMarker`:case`listItemPrefix`:case`listItemPrefixWhitespace`:break;default:l=void 0}if(!i&&t[0]===`enter`&&t[1].type===`listItemPrefix`||i===-1&&t[0]===`exit`&&(t[1].type===`listUnordered`||t[1].type===`listOrdered`)){if(o){let i=r;for(s=void 0;i--;){let t=e[i];if(t[1].type===`lineEnding`||t[1].type===`lineEndingBlank`){if(t[0]===`exit`)continue;s&&(e[s][1].type=`lineEndingBlank`,a=!0),t[1].type=`lineEnding`,s=i}else if(t[1].type!==`linePrefix`&&t[1].type!==`blockQuotePrefix`&&t[1].type!==`blockQuotePrefixWhitespace`&&t[1].type!==`blockQuoteMarker`&&t[1].type!==`listItemIndent`)break}c&&(!s||c<s)&&(o._spread=!0),o.end=Object.assign({},s?e[s][1].start:t[1].end),e.splice(s||r,0,[`exit`,o,t[2]]),r++,n++}if(t[1].type===`listItemPrefix`){let i={type:`listItem`,_spread:!1,start:Object.assign({},t[1].start),end:void 0};o=i,e.splice(r,0,[`enter`,i,t[2]]),r++,n++,c=void 0,l=!0}}}return e[t][1]._spread=a,n}function a(e,t){return n;function n(n){s.call(this,e(n),n),t&&t.call(this,n)}}function o(){this.stack.push({type:`fragment`,children:[]})}function s(e,t,n){this.stack[this.stack.length-1].children.push(e),this.stack.push(e),this.tokenStack.push([t,n||void 0]),e.position={start:iL(t.start),end:void 0}}function c(e){return t;function t(t){e&&e.call(this,t),l.call(this,t)}}function l(e,t){let n=this.stack.pop(),r=this.tokenStack.pop();if(r)r[0].type!==e.type&&(t?t.call(this,e,r[0]):(r[1]||sL).call(this,e,r[0]));else throw Error("Cannot close `"+e.type+"` ("+ON({start:e.start,end:e.end})+`): it’s not open`);n.position.end=iL(e.end)}function u(){return lP(this.stack.pop())}function d(){this.data.expectingFirstListItemValue=!0}function f(e){if(this.data.expectingFirstListItemValue){let t=this.stack[this.stack.length-2];t.start=Number.parseInt(this.sliceSerialize(e),10),this.data.expectingFirstListItemValue=void 0}}function p(){let e=this.resume(),t=this.stack[this.stack.length-1];t.lang=e}function m(){let e=this.resume(),t=this.stack[this.stack.length-1];t.meta=e}function h(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function g(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,``),this.data.flowCodeInside=void 0}function _(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e.replace(/(\r?\n|\r)$/g,``)}function v(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.label=t,n.identifier=SP(this.sliceSerialize(e)).toLowerCase()}function y(){let e=this.resume(),t=this.stack[this.stack.length-1];t.title=e}function b(){let e=this.resume(),t=this.stack[this.stack.length-1];t.url=e}function x(e){let t=this.stack[this.stack.length-1];t.depth||=this.sliceSerialize(e).length}function S(){this.data.setextHeadingSlurpLineEnding=!0}function C(e){let t=this.stack[this.stack.length-1];t.depth=this.sliceSerialize(e).codePointAt(0)===61?1:2}function w(){this.data.setextHeadingSlurpLineEnding=void 0}function T(e){let t=this.stack[this.stack.length-1].children,n=t[t.length-1];(!n||n.type!==`text`)&&(n=Ce(),n.position={start:iL(e.start),end:void 0},t.push(n)),this.stack.push(n)}function E(e){let t=this.stack.pop();t.value+=this.sliceSerialize(e),t.position.end=iL(e.end)}function D(e){let n=this.stack[this.stack.length-1];if(this.data.atHardBreak){let t=n.children[n.children.length-1];t.position.end=iL(e.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(n.type)&&(T.call(this,e),E.call(this,e))}function O(){this.data.atHardBreak=!0}function k(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e}function ee(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e}function A(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e}function j(){let e=this.stack[this.stack.length-1];if(this.data.inReference){let t=this.data.referenceType||`shortcut`;e.type+=`Reference`,e.referenceType=t,delete e.url,delete e.title}else delete e.identifier,delete e.label;this.data.referenceType=void 0}function M(){let e=this.stack[this.stack.length-1];if(this.data.inReference){let t=this.data.referenceType||`shortcut`;e.type+=`Reference`,e.referenceType=t,delete e.url,delete e.title}else delete e.identifier,delete e.label;this.data.referenceType=void 0}function te(e){let t=this.sliceSerialize(e),n=this.stack[this.stack.length-2];n.label=$I(t),n.identifier=SP(t).toLowerCase()}function ne(){let e=this.stack[this.stack.length-1],t=this.resume(),n=this.stack[this.stack.length-1];this.data.inReference=!0,n.type===`link`?n.children=e.children:n.alt=t}function N(){let e=this.resume(),t=this.stack[this.stack.length-1];t.url=e}function P(){let e=this.resume(),t=this.stack[this.stack.length-1];t.title=e}function re(){this.data.inReference=void 0}function ie(){this.data.referenceType=`collapsed`}function ae(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.label=t,n.identifier=SP(this.sliceSerialize(e)).toLowerCase(),this.data.referenceType=`full`}function F(e){this.data.characterReferenceType=e.type}function I(e){let t=this.sliceSerialize(e),n=this.data.characterReferenceType,r;n?(r=xP(t,n===`characterReferenceMarkerNumeric`?10:16),this.data.characterReferenceType=void 0):r=mP(t);let i=this.stack[this.stack.length-1];i.value+=r}function oe(e){let t=this.stack.pop();t.position.end=iL(e.end)}function se(e){E.call(this,e);let t=this.stack[this.stack.length-1];t.url=this.sliceSerialize(e)}function ce(e){E.call(this,e);let t=this.stack[this.stack.length-1];t.url=`mailto:`+this.sliceSerialize(e)}function le(){return{type:`blockquote`,children:[]}}function ue(){return{type:`code`,lang:null,meta:null,value:``}}function de(){return{type:`inlineCode`,value:``}}function fe(){return{type:`definition`,identifier:``,label:null,title:null,url:``}}function pe(){return{type:`emphasis`,children:[]}}function me(){return{type:`heading`,depth:0,children:[]}}function he(){return{type:`break`}}function ge(){return{type:`html`,value:``}}function _e(){return{type:`image`,title:null,url:``,alt:null}}function ve(){return{type:`link`,title:null,url:``,children:[]}}function ye(e){return{type:`list`,ordered:e.type===`listOrdered`,start:null,spread:e._spread,children:[]}}function be(e){return{type:`listItem`,spread:e._spread,checked:null,children:[]}}function xe(){return{type:`paragraph`,children:[]}}function Se(){return{type:`strong`,children:[]}}function Ce(){return{type:`text`,value:``}}function we(){return{type:`thematicBreak`}}}function iL(e){return{line:e.line,column:e.column,offset:e.offset}}function aL(e,t){let n=-1;for(;++n<t.length;){let r=t[n];Array.isArray(r)?aL(e,r):oL(e,r)}}function oL(e,t){let n;for(n in t)if(tL.call(t,n))switch(n){case`canContainEols`:{let r=t[n];r&&e[n].push(...r);break}case`transforms`:{let r=t[n];r&&e[n].push(...r);break}case`enter`:case`exit`:{let r=t[n];r&&Object.assign(e[n],r);break}}}function sL(e,t){throw Error(e?"Cannot close `"+e.type+"` ("+ON({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+ON({start:t.start,end:t.end})+`) is open`:"Cannot close document, a token (`"+t.type+"`, "+ON({start:t.start,end:t.end})+`) is still open`)}function cL(e){let t=this;t.parser=n;function n(n){return nL(n,{...t.data(`settings`),...e,extensions:t.data(`micromarkExtensions`)||[],mdastExtensions:t.data(`fromMarkdownExtensions`)||[]})}}function lL(e,t){let n={type:`element`,tagName:`blockquote`,properties:{},children:e.wrap(e.all(t),!0)};return e.patch(t,n),e.applyData(t,n)}function uL(e,t){let n={type:`element`,tagName:`br`,properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:`text`,value:`
|
|
77
|
-
`}]}function dL(e,t){let n=t.value?t.value+`
|
|
78
|
-
`:``,r={},i=t.lang?t.lang.split(/\s+/):[];i.length>0&&(r.className=[`language-`+i[0]]);let a={type:`element`,tagName:`code`,properties:r,children:[{type:`text`,value:n}]};return t.meta&&(a.data={meta:t.meta}),e.patch(t,a),a=e.applyData(t,a),a={type:`element`,tagName:`pre`,properties:{},children:[a]},e.patch(t,a),a}function fL(e,t){let n={type:`element`,tagName:`del`,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function pL(e,t){let n={type:`element`,tagName:`em`,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function mL(e,t){let n=typeof e.options.clobberPrefix==`string`?e.options.clobberPrefix:`user-content-`,r=String(t.identifier).toUpperCase(),i=FP(r.toLowerCase()),a=e.footnoteOrder.indexOf(r),o,s=e.footnoteCounts.get(r);s===void 0?(s=0,e.footnoteOrder.push(r),o=e.footnoteOrder.length):o=a+1,s+=1,e.footnoteCounts.set(r,s);let c={type:`element`,tagName:`a`,properties:{href:`#`+n+`fn-`+i,id:n+`fnref-`+i+(s>1?`-`+s:``),dataFootnoteRef:!0,ariaDescribedBy:[`footnote-label`]},children:[{type:`text`,value:String(o)}]};e.patch(t,c);let l={type:`element`,tagName:`sup`,properties:{},children:[c]};return e.patch(t,l),e.applyData(t,l)}function hL(e,t){let n={type:`element`,tagName:`h`+t.depth,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function gL(e,t){if(e.options.allowDangerousHtml){let n={type:`raw`,value:t.value};return e.patch(t,n),e.applyData(t,n)}}function _L(e,t){let n=t.referenceType,r=`]`;if(n===`collapsed`?r+=`[]`:n===`full`&&(r+=`[`+(t.label||t.identifier)+`]`),t.type===`imageReference`)return[{type:`text`,value:`![`+t.alt+r}];let i=e.all(t),a=i[0];a&&a.type===`text`?a.value=`[`+a.value:i.unshift({type:`text`,value:`[`});let o=i[i.length-1];return o&&o.type===`text`?o.value+=r:i.push({type:`text`,value:r}),i}function vL(e,t){let n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return _L(e,t);let i={src:FP(r.url||``),alt:t.alt};r.title!==null&&r.title!==void 0&&(i.title=r.title);let a={type:`element`,tagName:`img`,properties:i,children:[]};return e.patch(t,a),e.applyData(t,a)}function yL(e,t){let n={src:FP(t.url)};t.alt!==null&&t.alt!==void 0&&(n.alt=t.alt),t.title!==null&&t.title!==void 0&&(n.title=t.title);let r={type:`element`,tagName:`img`,properties:n,children:[]};return e.patch(t,r),e.applyData(t,r)}function bL(e,t){let n={type:`text`,value:t.value.replace(/\r?\n|\r/g,` `)};e.patch(t,n);let r={type:`element`,tagName:`code`,properties:{},children:[n]};return e.patch(t,r),e.applyData(t,r)}function xL(e,t){let n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return _L(e,t);let i={href:FP(r.url||``)};r.title!==null&&r.title!==void 0&&(i.title=r.title);let a={type:`element`,tagName:`a`,properties:i,children:e.all(t)};return e.patch(t,a),e.applyData(t,a)}function SL(e,t){let n={href:FP(t.url)};t.title!==null&&t.title!==void 0&&(n.title=t.title);let r={type:`element`,tagName:`a`,properties:n,children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function CL(e,t,n){let r=e.all(t),i=n?wL(n):TL(t),a={},o=[];if(typeof t.checked==`boolean`){let e=r[0],n;e&&e.type===`element`&&e.tagName===`p`?n=e:(n={type:`element`,tagName:`p`,properties:{},children:[]},r.unshift(n)),n.children.length>0&&n.children.unshift({type:`text`,value:` `}),n.children.unshift({type:`element`,tagName:`input`,properties:{type:`checkbox`,checked:t.checked,disabled:!0},children:[]}),a.className=[`task-list-item`]}let s=-1;for(;++s<r.length;){let e=r[s];(i||s!==0||e.type!==`element`||e.tagName!==`p`)&&o.push({type:`text`,value:`
|
|
79
|
-
`}),e.type===`element`&&e.tagName===`p`&&!i?o.push(...e.children):o.push(e)}let c=r[r.length-1];c&&(i||c.type!==`element`||c.tagName!==`p`)&&o.push({type:`text`,value:`
|
|
80
|
-
`});let l={type:`element`,tagName:`li`,properties:a,children:o};return e.patch(t,l),e.applyData(t,l)}function wL(e){let t=!1;if(e.type===`list`){t=e.spread||!1;let n=e.children,r=-1;for(;!t&&++r<n.length;)t=TL(n[r])}return t}function TL(e){return e.spread??e.children.length>1}function EL(e,t){let n={},r=e.all(t),i=-1;for(typeof t.start==`number`&&t.start!==1&&(n.start=t.start);++i<r.length;){let e=r[i];if(e.type===`element`&&e.tagName===`li`&&e.properties&&Array.isArray(e.properties.className)&&e.properties.className.includes(`task-list-item`)){n.className=[`contains-task-list`];break}}let a={type:`element`,tagName:t.ordered?`ol`:`ul`,properties:n,children:e.wrap(r,!0)};return e.patch(t,a),e.applyData(t,a)}function DL(e,t){let n={type:`element`,tagName:`p`,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function OL(e,t){let n={type:`root`,children:e.wrap(e.all(t))};return e.patch(t,n),e.applyData(t,n)}function kL(e,t){let n={type:`element`,tagName:`strong`,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function AL(e,t){let n=e.all(t),r=n.shift(),i=[];if(r){let n={type:`element`,tagName:`thead`,properties:{},children:e.wrap([r],!0)};e.patch(t.children[0],n),i.push(n)}if(n.length>0){let r={type:`element`,tagName:`tbody`,properties:{},children:e.wrap(n,!0)},a=TN(t.children[1]),o=wN(t.children[t.children.length-1]);a&&o&&(r.position={start:a,end:o}),i.push(r)}let a={type:`element`,tagName:`table`,properties:{},children:e.wrap(i,!0)};return e.patch(t,a),e.applyData(t,a)}function jL(e,t,n){let r=n?n.children:void 0,i=(r?r.indexOf(t):1)===0?`th`:`td`,a=n&&n.type===`table`?n.align:void 0,o=a?a.length:t.children.length,s=-1,c=[];for(;++s<o;){let n=t.children[s],r={},o=a?a[s]:void 0;o&&(r.align=o);let l={type:`element`,tagName:i,properties:r,children:[]};n&&(l.children=e.all(n),e.patch(n,l),l=e.applyData(n,l)),c.push(l)}let l={type:`element`,tagName:`tr`,properties:{},children:e.wrap(c,!0)};return e.patch(t,l),e.applyData(t,l)}function ML(e,t){let n={type:`element`,tagName:`td`,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}var NL=9,PL=32;function FL(e){let t=String(e),n=/\r?\n|\r/g,r=n.exec(t),i=0,a=[];for(;r;)a.push(IL(t.slice(i,r.index),i>0,!0),r[0]),i=r.index+r[0].length,r=n.exec(t);return a.push(IL(t.slice(i),i>0,!1)),a.join(``)}function IL(e,t,n){let r=0,i=e.length;if(t){let t=e.codePointAt(r);for(;t===NL||t===PL;)r++,t=e.codePointAt(r)}if(n){let t=e.codePointAt(i-1);for(;t===NL||t===PL;)i--,t=e.codePointAt(i-1)}return i>r?e.slice(r,i):``}function LL(e,t){let n={type:`text`,value:FL(String(t.value))};return e.patch(t,n),e.applyData(t,n)}function RL(e,t){let n={type:`element`,tagName:`hr`,properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)}var zL={blockquote:lL,break:uL,code:dL,delete:fL,emphasis:pL,footnoteReference:mL,heading:hL,html:gL,imageReference:vL,image:yL,inlineCode:bL,linkReference:xL,link:SL,listItem:CL,list:EL,paragraph:DL,root:OL,strong:kL,table:AL,tableCell:ML,tableRow:jL,text:LL,thematicBreak:RL,toml:BL,yaml:BL,definition:BL,footnoteDefinition:BL};function BL(){}var VL=typeof self==`object`?self:globalThis,HL=(e,t)=>{switch(e){case`Function`:case`SharedWorker`:case`Worker`:case`eval`:case`setInterval`:case`setTimeout`:throw TypeError(`unable to deserialize `+e)}return new VL[e](t)},UL=(e,t)=>{let n=(t,n)=>(e.set(n,t),t),r=i=>{if(e.has(i))return e.get(i);let[a,o]=t[i];switch(a){case 0:case-1:return n(o,i);case 1:{let e=n([],i);for(let t of o)e.push(r(t));return e}case 2:{let e=n({},i);for(let[t,n]of o)e[r(t)]=r(n);return e}case 3:return n(new Date(o),i);case 4:{let{source:e,flags:t}=o;return n(new RegExp(e,t),i)}case 5:{let e=n(new Map,i);for(let[t,n]of o)e.set(r(t),r(n));return e}case 6:{let e=n(new Set,i);for(let t of o)e.add(r(t));return e}case 7:{let{name:e,message:t}=o;return n(typeof VL[e]==`function`?HL(e,t):Error(t),i)}case 8:return n(BigInt(o),i);case`BigInt`:return n(Object(BigInt(o)),i);case`ArrayBuffer`:return n(new Uint8Array(o).buffer,o);case`DataView`:{let{buffer:e}=new Uint8Array(o);return n(new DataView(e),o)}}return n(HL(a,o),i)};return r},WL=e=>UL(new Map,e)(0),GL=``,{toString:KL}={},{keys:qL}=Object,JL=e=>{let t=typeof e;if(t!==`object`||!e)return[0,t];let n=KL.call(e).slice(8,-1);switch(n){case`Array`:return[1,GL];case`Object`:return[2,GL];case`Date`:return[3,GL];case`RegExp`:return[4,GL];case`Map`:return[5,GL];case`Set`:return[6,GL];case`DataView`:return[1,n]}return n.includes(`Array`)?[1,n]:e instanceof Error?[7,e.name||`Error`]:[2,n]},YL=([e,t])=>e===0&&(t===`function`||t===`symbol`),XL=(e,t,n,r)=>{let i=(e,t)=>{let i=r.push(e)-1;return n.set(t,i),i},a=r=>{if(n.has(r))return n.get(r);let[o,s]=JL(r);switch(o){case 0:{let t=r;switch(s){case`bigint`:o=8,t=r.toString();break;case`function`:case`symbol`:if(e)throw TypeError(`unable to serialize `+s);t=null;break;case`undefined`:return i([-1],r)}return i([o,t],r)}case 1:{if(s){let e=r;return s===`DataView`?e=new Uint8Array(r.buffer):s===`ArrayBuffer`&&(e=new Uint8Array(r)),i([s,[...e]],r)}let e=[],t=i([o,e],r);for(let t of r)e.push(a(t));return t}case 2:{if(s)switch(s){case`BigInt`:return i([s,r.toString()],r);case`Boolean`:case`Number`:case`String`:return i([s,r.valueOf()],r)}if(t&&`toJSON`in r)return a(r.toJSON());let n=[],c=i([o,n],r);for(let t of qL(r))(e||!YL(JL(r[t])))&&n.push([a(t),a(r[t])]);return c}case 3:return i([o,isNaN(r.getTime())?GL:r.toISOString()],r);case 4:{let{source:e,flags:t}=r;return i([o,{source:e,flags:t}],r)}case 5:{let t=[],n=i([o,t],r);for(let[n,i]of r)(e||!(YL(JL(n))||YL(JL(i))))&&t.push([a(n),a(i)]);return n}case 6:{let t=[],n=i([o,t],r);for(let n of r)(e||!YL(JL(n)))&&t.push(a(n));return n}}let{message:c}=r;return i([o,{name:s,message:c}],r)};return a},ZL=(e,{json:t,lossy:n}={})=>{let r=[];return XL(!(t||n),!!t,new Map,r)(e),r},QL=typeof structuredClone==`function`?(e,t)=>t&&(`json`in t||`lossy`in t)?WL(ZL(e,t)):structuredClone(e):(e,t)=>WL(ZL(e,t));function $L(e,t){let n=[{type:`text`,value:`↩`}];return t>1&&n.push({type:`element`,tagName:`sup`,properties:{},children:[{type:`text`,value:String(t)}]}),n}function eR(e,t){return`Back to reference `+(e+1)+(t>1?`-`+t:``)}function tR(e){let t=typeof e.options.clobberPrefix==`string`?e.options.clobberPrefix:`user-content-`,n=e.options.footnoteBackContent||$L,r=e.options.footnoteBackLabel||eR,i=e.options.footnoteLabel||`Footnotes`,a=e.options.footnoteLabelTagName||`h2`,o=e.options.footnoteLabelProperties||{className:[`sr-only`]},s=[],c=-1;for(;++c<e.footnoteOrder.length;){let i=e.footnoteById.get(e.footnoteOrder[c]);if(!i)continue;let a=e.all(i),o=String(i.identifier).toUpperCase(),l=FP(o.toLowerCase()),u=0,d=[],f=e.footnoteCounts.get(o);for(;f!==void 0&&++u<=f;){d.length>0&&d.push({type:`text`,value:` `});let e=typeof n==`string`?n:n(c,u);typeof e==`string`&&(e={type:`text`,value:e}),d.push({type:`element`,tagName:`a`,properties:{href:`#`+t+`fnref-`+l+(u>1?`-`+u:``),dataFootnoteBackref:``,ariaLabel:typeof r==`string`?r:r(c,u),className:[`data-footnote-backref`]},children:Array.isArray(e)?e:[e]})}let p=a[a.length-1];if(p&&p.type===`element`&&p.tagName===`p`){let e=p.children[p.children.length-1];e&&e.type===`text`?e.value+=` `:p.children.push({type:`text`,value:` `}),p.children.push(...d)}else a.push(...d);let m={type:`element`,tagName:`li`,properties:{id:t+`fn-`+l},children:e.wrap(a,!0)};e.patch(i,m),s.push(m)}if(s.length!==0)return{type:`element`,tagName:`section`,properties:{dataFootnotes:!0,className:[`footnotes`]},children:[{type:`element`,tagName:a,properties:{...QL(o),id:`footnote-label`},children:[{type:`text`,value:i}]},{type:`text`,value:`
|
|
81
|
-
`},{type:`element`,tagName:`ol`,properties:{},children:e.wrap(s,!0)},{type:`text`,value:`
|
|
82
|
-
`}]}}var nR=(function(e){if(e==null)return sR;if(typeof e==`function`)return oR(e);if(typeof e==`object`)return Array.isArray(e)?rR(e):iR(e);if(typeof e==`string`)return aR(e);throw Error(`Expected function, string, or object as test`)});function rR(e){let t=[],n=-1;for(;++n<e.length;)t[n]=nR(e[n]);return oR(r);function r(...e){let n=-1;for(;++n<t.length;)if(t[n].apply(this,e))return!0;return!1}}function iR(e){let t=e;return oR(n);function n(n){let r=n,i;for(i in e)if(r[i]!==t[i])return!1;return!0}}function aR(e){return oR(t);function t(t){return t&&t.type===e}}function oR(e){return t;function t(t,n,r){return!!(cR(t)&&e.call(this,t,typeof n==`number`?n:void 0,r||void 0))}}function sR(){return!0}function cR(e){return typeof e==`object`&&!!e&&`type`in e}function lR(e){return e}var uR=[];function dR(e,t,n,r){let i;typeof t==`function`&&typeof n!=`function`?(r=n,n=t):i=t;let a=nR(i),o=r?-1:1;s(e,void 0,[])();function s(e,i,c){let l=e&&typeof e==`object`?e:{};if(typeof l.type==`string`){let t=typeof l.tagName==`string`?l.tagName:typeof l.name==`string`?l.name:void 0;Object.defineProperty(u,"name",{value:`node (`+lR(e.type+(t?`<`+t+`>`:``))+`)`})}return u;function u(){let l=uR,u,d,f;if((!t||a(e,i,c[c.length-1]||void 0))&&(l=fR(n(e,c)),l[0]===!1))return l;if(`children`in e&&e.children){let t=e;if(t.children&&l[0]!==`skip`)for(d=(r?t.children.length:-1)+o,f=c.concat(t);d>-1&&d<t.children.length;){let e=t.children[d];if(u=s(e,d,f)(),u[0]===!1)return u;d=typeof u[1]==`number`?u[1]:d+o}}return l}}}function fR(e){return Array.isArray(e)?e:typeof e==`number`?[!0,e]:e==null?uR:[e]}function pR(e,t,n,r){let i,a,o;typeof t==`function`&&typeof n!=`function`?(a=void 0,o=t,i=n):(a=t,o=n,i=r),dR(e,a,s,i);function s(e,t){let n=t[t.length-1],r=n?n.children.indexOf(e):void 0;return o(e,r,n)}}var mR={}.hasOwnProperty,hR={};function gR(e,t){let n=t||hR,r=new Map,i=new Map,a={all:s,applyData:vR,definitionById:r,footnoteById:i,footnoteCounts:new Map,footnoteOrder:[],handlers:{...zL,...n.handlers},one:o,options:n,patch:_R,wrap:bR};return pR(e,function(e){if(e.type===`definition`||e.type===`footnoteDefinition`){let t=e.type===`definition`?r:i,n=String(e.identifier).toUpperCase();t.has(n)||t.set(n,e)}}),a;function o(e,t){let n=e.type,r=a.handlers[n];if(mR.call(a.handlers,n)&&r)return r(a,e,t);if(a.options.passThrough&&a.options.passThrough.includes(n)){if(`children`in e){let{children:t,...n}=e,r=QL(n);return r.children=a.all(e),r}return QL(e)}return(a.options.unknownHandler||yR)(a,e,t)}function s(e){let t=[];if(`children`in e){let n=e.children,r=-1;for(;++r<n.length;){let i=a.one(n[r],e);if(i){if(r&&n[r-1].type===`break`&&(!Array.isArray(i)&&i.type===`text`&&(i.value=xR(i.value)),!Array.isArray(i)&&i.type===`element`)){let e=i.children[0];e&&e.type===`text`&&(e.value=xR(e.value))}Array.isArray(i)?t.push(...i):t.push(i)}}}return t}}function _R(e,t){e.position&&(t.position=DN(e))}function vR(e,t){let n=t;if(e&&e.data){let t=e.data.hName,r=e.data.hChildren,i=e.data.hProperties;typeof t==`string`&&(n.type===`element`?n.tagName=t:n={type:`element`,tagName:t,properties:{},children:`children`in n?n.children:[n]}),n.type===`element`&&i&&Object.assign(n.properties,QL(i)),`children`in n&&n.children&&r!=null&&(n.children=r)}return n}function yR(e,t){let n=t.data||{},r=`value`in t&&!(mR.call(n,`hProperties`)||mR.call(n,`hChildren`))?{type:`text`,value:t.value}:{type:`element`,tagName:`div`,properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function bR(e,t){let n=[],r=-1;for(t&&n.push({type:`text`,value:`
|
|
83
|
-
`});++r<e.length;)r&&n.push({type:`text`,value:`
|
|
84
|
-
`}),n.push(e[r]);return t&&e.length>0&&n.push({type:`text`,value:`
|
|
85
|
-
`}),n}function xR(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function SR(e,t){let n=gR(e,t),r=n.one(e,void 0),i=tR(n),a=Array.isArray(r)?{type:`root`,children:r}:r||{type:`root`,children:[]};return i&&(`children`in a,a.children.push({type:`text`,value:`
|
|
86
|
-
`},i)),a}function CR(e,t){return e&&`run`in e?async function(n,r){let i=SR(n,{file:r,...t});await e.run(i,r)}:function(n,r){return SR(n,{file:r,...e||t})}}function wR(e){if(e)throw e}var TR=o(((e,t)=>{var n=Object.prototype.hasOwnProperty,r=Object.prototype.toString,i=Object.defineProperty,a=Object.getOwnPropertyDescriptor,o=function(e){return typeof Array.isArray==`function`?Array.isArray(e):r.call(e)===`[object Array]`},s=function(e){if(!e||r.call(e)!==`[object Object]`)return!1;var t=n.call(e,`constructor`),i=e.constructor&&e.constructor.prototype&&n.call(e.constructor.prototype,`isPrototypeOf`);if(e.constructor&&!t&&!i)return!1;for(var a in e);return a===void 0||n.call(e,a)},c=function(e,t){i&&t.name===`__proto__`?i(e,t.name,{enumerable:!0,configurable:!0,value:t.newValue,writable:!0}):e[t.name]=t.newValue},l=function(e,t){if(t===`__proto__`){if(!n.call(e,t))return;if(a)return a(e,t).value}return e[t]};t.exports=function e(){var t,n,r,i,a,u,d=arguments[0],f=1,p=arguments.length,m=!1;for(typeof d==`boolean`&&(m=d,d=arguments[1]||{},f=2),(d==null||typeof d!=`object`&&typeof d!=`function`)&&(d={});f<p;++f)if(t=arguments[f],t!=null)for(n in t)r=l(d,n),i=l(t,n),d!==i&&(m&&i&&(s(i)||(a=o(i)))?(a?(a=!1,u=r&&o(r)?r:[]):u=r&&s(r)?r:{},c(d,{name:n,newValue:e(m,u,i)})):i!==void 0&&c(d,{name:n,newValue:i}));return d}}));function ER(e){if(typeof e!=`object`||!e)return!1;let t=Object.getPrototypeOf(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}function DR(){let e=[],t={run:n,use:r};return t;function n(...t){let n=-1,r=t.pop();if(typeof r!=`function`)throw TypeError(`Expected function as last argument, not `+r);i(null,...t);function i(a,...o){let s=e[++n],c=-1;if(a){r(a);return}for(;++c<t.length;)(o[c]===null||o[c]===void 0)&&(o[c]=t[c]);t=o,s?OR(s,i)(...o):r(null,...o)}}function r(n){if(typeof n!=`function`)throw TypeError("Expected `middelware` to be a function, not "+n);return e.push(n),t}}function OR(e,t){let n;return r;function r(...t){let r=e.length>t.length,o;r&&t.push(i);try{o=e.apply(this,t)}catch(e){let t=e;if(r&&n)throw t;return i(t)}r||(o&&o.then&&typeof o.then==`function`?o.then(a,i):o instanceof Error?i(o):a(o))}function i(e,...r){n||(n=!0,t(e,...r))}function a(e){i(null,e)}}var kR={basename:AR,dirname:jR,extname:MR,join:NR,sep:`/`};function AR(e,t){if(t!==void 0&&typeof t!=`string`)throw TypeError(`"ext" argument must be a string`);IR(e);let n=0,r=-1,i=e.length,a;if(t===void 0||t.length===0||t.length>e.length){for(;i--;)if(e.codePointAt(i)===47){if(a){n=i+1;break}}else r<0&&(a=!0,r=i+1);return r<0?``:e.slice(n,r)}if(t===e)return``;let o=-1,s=t.length-1;for(;i--;)if(e.codePointAt(i)===47){if(a){n=i+1;break}}else o<0&&(a=!0,o=i+1),s>-1&&(e.codePointAt(i)===t.codePointAt(s--)?s<0&&(r=i):(s=-1,r=o));return n===r?r=o:r<0&&(r=e.length),e.slice(n,r)}function jR(e){if(IR(e),e.length===0)return`.`;let t=-1,n=e.length,r;for(;--n;)if(e.codePointAt(n)===47){if(r){t=n;break}}else r||=!0;return t<0?e.codePointAt(0)===47?`/`:`.`:t===1&&e.codePointAt(0)===47?`//`:e.slice(0,t)}function MR(e){IR(e);let t=e.length,n=-1,r=0,i=-1,a=0,o;for(;t--;){let s=e.codePointAt(t);if(s===47){if(o){r=t+1;break}continue}n<0&&(o=!0,n=t+1),s===46?i<0?i=t:a!==1&&(a=1):i>-1&&(a=-1)}return i<0||n<0||a===0||a===1&&i===n-1&&i===r+1?``:e.slice(i,n)}function NR(...e){let t=-1,n;for(;++t<e.length;)IR(e[t]),e[t]&&(n=n===void 0?e[t]:n+`/`+e[t]);return n===void 0?`.`:PR(n)}function PR(e){IR(e);let t=e.codePointAt(0)===47,n=FR(e,!t);return n.length===0&&!t&&(n=`.`),n.length>0&&e.codePointAt(e.length-1)===47&&(n+=`/`),t?`/`+n:n}function FR(e,t){let n=``,r=0,i=-1,a=0,o=-1,s,c;for(;++o<=e.length;){if(o<e.length)s=e.codePointAt(o);else if(s===47)break;else s=47;if(s===47){if(i!==o-1&&a!==1){if(i!==o-1&&a===2){if(n.length<2||r!==2||n.codePointAt(n.length-1)!==46||n.codePointAt(n.length-2)!==46){if(n.length>2){if(c=n.lastIndexOf(`/`),c!==n.length-1){c<0?(n=``,r=0):(n=n.slice(0,c),r=n.length-1-n.lastIndexOf(`/`)),i=o,a=0;continue}}else if(n.length>0){n=``,r=0,i=o,a=0;continue}}t&&(n=n.length>0?n+`/..`:`..`,r=2)}else n.length>0?n+=`/`+e.slice(i+1,o):n=e.slice(i+1,o),r=o-i-1}i=o,a=0}else s===46&&a>-1?a++:a=-1}return n}function IR(e){if(typeof e!=`string`)throw TypeError(`Path must be a string. Received `+JSON.stringify(e))}var LR={cwd:RR};function RR(){return`/`}function zR(e){return!!(typeof e==`object`&&e&&`href`in e&&e.href&&`protocol`in e&&e.protocol&&e.auth===void 0)}function BR(e){if(typeof e==`string`)e=new URL(e);else if(!zR(e)){let t=TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw t.code=`ERR_INVALID_ARG_TYPE`,t}if(e.protocol!==`file:`){let e=TypeError(`The URL must be of scheme file`);throw e.code=`ERR_INVALID_URL_SCHEME`,e}return VR(e)}function VR(e){if(e.hostname!==``){let e=TypeError(`File URL host must be "localhost" or empty on darwin`);throw e.code=`ERR_INVALID_FILE_URL_HOST`,e}let t=e.pathname,n=-1;for(;++n<t.length;)if(t.codePointAt(n)===37&&t.codePointAt(n+1)===50){let e=t.codePointAt(n+2);if(e===70||e===102){let e=TypeError(`File URL path must not include encoded / characters`);throw e.code=`ERR_INVALID_FILE_URL_PATH`,e}}return decodeURIComponent(t)}var HR=[`history`,`path`,`basename`,`stem`,`extname`,`dirname`],UR=class{constructor(e){let t;t=e?zR(e)?{path:e}:typeof e==`string`||qR(e)?{value:e}:e:{},this.cwd=`cwd`in t?``:LR.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let n=-1;for(;++n<HR.length;){let e=HR[n];e in t&&t[e]!==void 0&&t[e]!==null&&(this[e]=e===`history`?[...t[e]]:t[e])}let r;for(r in t)HR.includes(r)||(this[r]=t[r])}get basename(){return typeof this.path==`string`?kR.basename(this.path):void 0}set basename(e){GR(e,`basename`),WR(e,`basename`),this.path=kR.join(this.dirname||``,e)}get dirname(){return typeof this.path==`string`?kR.dirname(this.path):void 0}set dirname(e){KR(this.basename,`dirname`),this.path=kR.join(e||``,this.basename)}get extname(){return typeof this.path==`string`?kR.extname(this.path):void 0}set extname(e){if(WR(e,`extname`),KR(this.dirname,`extname`),e){if(e.codePointAt(0)!==46)throw Error("`extname` must start with `.`");if(e.includes(`.`,1))throw Error("`extname` cannot contain multiple dots")}this.path=kR.join(this.dirname,this.stem+(e||``))}get path(){return this.history[this.history.length-1]}set path(e){zR(e)&&(e=BR(e)),GR(e,`path`),this.path!==e&&this.history.push(e)}get stem(){return typeof this.path==`string`?kR.basename(this.path,this.extname):void 0}set stem(e){GR(e,`stem`),WR(e,`stem`),this.path=kR.join(this.dirname||``,e+(this.extname||``))}fail(e,t,n){let r=this.message(e,t,n);throw r.fatal=!0,r}info(e,t,n){let r=this.message(e,t,n);return r.fatal=void 0,r}message(e,t,n){let r=new MN(e,t,n);return this.path&&(r.name=this.path+`:`+r.name,r.file=this.path),r.fatal=!1,this.messages.push(r),r}toString(e){return this.value===void 0?``:typeof this.value==`string`?this.value:new TextDecoder(e||void 0).decode(this.value)}};function WR(e,t){if(e&&e.includes(kR.sep))throw Error("`"+t+"` cannot be a path: did not expect `"+kR.sep+"`")}function GR(e,t){if(!e)throw Error("`"+t+"` cannot be empty")}function KR(e,t){if(!e)throw Error("Setting `"+t+"` requires `path` to be set too")}function qR(e){return!!(e&&typeof e==`object`&&`byteLength`in e&&`byteOffset`in e)}var JR=(function(e){let t=this.constructor.prototype,n=t[e],r=function(){return n.apply(r,arguments)};return Object.setPrototypeOf(r,t),r}),YR=l(TR(),1),XR={}.hasOwnProperty,ZR=new class e extends JR{constructor(){super(`copy`),this.Compiler=void 0,this.Parser=void 0,this.attachers=[],this.compiler=void 0,this.freezeIndex=-1,this.frozen=void 0,this.namespace={},this.parser=void 0,this.transformers=DR()}copy(){let t=new e,n=-1;for(;++n<this.attachers.length;){let e=this.attachers[n];t.use(...e)}return t.data((0,YR.default)(!0,{},this.namespace)),t}data(e,t){return typeof e==`string`?arguments.length===2?(ez(`data`,this.frozen),this.namespace[e]=t,this):XR.call(this.namespace,e)&&this.namespace[e]||void 0:e?(ez(`data`,this.frozen),this.namespace=e,this):this.namespace}freeze(){if(this.frozen)return this;let e=this;for(;++this.freezeIndex<this.attachers.length;){let[t,...n]=this.attachers[this.freezeIndex];if(n[0]===!1)continue;n[0]===!0&&(n[0]=void 0);let r=t.call(e,...n);typeof r==`function`&&this.transformers.use(r)}return this.frozen=!0,this.freezeIndex=1/0,this}parse(e){this.freeze();let t=rz(e),n=this.parser||this.Parser;return QR(`parse`,n),n(String(t),t)}process(e,t){let n=this;return this.freeze(),QR(`process`,this.parser||this.Parser),$R(`process`,this.compiler||this.Compiler),t?r(void 0,t):new Promise(r);function r(r,i){let a=rz(e),o=n.parse(a);n.run(o,a,function(e,t,r){if(e||!t||!r)return s(e);let i=t,a=n.stringify(i,r);az(a)?r.value=a:r.result=a,s(e,r)});function s(e,n){e||!n?i(e):r?r(n):t(void 0,n)}}}processSync(e){let t=!1,n;return this.freeze(),QR(`processSync`,this.parser||this.Parser),$R(`processSync`,this.compiler||this.Compiler),this.process(e,r),nz(`processSync`,`process`,t),n;function r(e,r){t=!0,wR(e),n=r}}run(e,t,n){tz(e),this.freeze();let r=this.transformers;return!n&&typeof t==`function`&&(n=t,t=void 0),n?i(void 0,n):new Promise(i);function i(i,a){let o=rz(t);r.run(e,o,s);function s(t,r,o){let s=r||e;t?a(t):i?i(s):n(void 0,s,o)}}}runSync(e,t){let n=!1,r;return this.run(e,t,i),nz(`runSync`,`run`,n),r;function i(e,t){wR(e),r=t,n=!0}}stringify(e,t){this.freeze();let n=rz(t),r=this.compiler||this.Compiler;return $R(`stringify`,r),tz(e),r(e,n)}use(e,...t){let n=this.attachers,r=this.namespace;if(ez(`use`,this.frozen),e!=null){if(typeof e==`function`)s(e,t);else if(typeof e==`object`)Array.isArray(e)?o(e):a(e);else throw TypeError("Expected usable value, not `"+e+"`")}return this;function i(e){if(typeof e==`function`)s(e,[]);else if(typeof e==`object`){if(Array.isArray(e)){let[t,...n]=e;s(t,n)}else a(e)}else throw TypeError("Expected usable value, not `"+e+"`")}function a(e){if(!(`plugins`in e)&&!(`settings`in e))throw Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");o(e.plugins),e.settings&&(r.settings=(0,YR.default)(!0,r.settings,e.settings))}function o(e){let t=-1;if(e!=null){if(Array.isArray(e))for(;++t<e.length;){let n=e[t];i(n)}else throw TypeError("Expected a list of plugins, not `"+e+"`")}}function s(e,t){let r=-1,i=-1;for(;++r<n.length;)if(n[r][0]===e){i=r;break}if(i===-1)n.push([e,...t]);else if(t.length>0){let[r,...a]=t,o=n[i][1];ER(o)&&ER(r)&&(r=(0,YR.default)(!0,o,r)),n[i]=[e,r,...a]}}}}().freeze();function QR(e,t){if(typeof t!=`function`)throw TypeError("Cannot `"+e+"` without `parser`")}function $R(e,t){if(typeof t!=`function`)throw TypeError("Cannot `"+e+"` without `compiler`")}function ez(e,t){if(t)throw Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function tz(e){if(!ER(e)||typeof e.type!=`string`)throw TypeError("Expected node, got `"+e+"`")}function nz(e,t,n){if(!n)throw Error("`"+e+"` finished async. Use `"+t+"` instead")}function rz(e){return iz(e)?e:new UR(e)}function iz(e){return!!(e&&typeof e==`object`&&`message`in e&&`messages`in e)}function az(e){return typeof e==`string`||oz(e)}function oz(e){return!!(e&&typeof e==`object`&&`byteLength`in e&&`byteOffset`in e)}var sz=[],cz={allowDangerousHtml:!0},lz=/^(https?|ircs?|mailto|xmpp)$/i,uz=[{from:`astPlugins`,id:`remove-buggy-html-in-markdown-parser`},{from:`allowDangerousHtml`,id:`remove-buggy-html-in-markdown-parser`},{from:`allowNode`,id:`replace-allownode-allowedtypes-and-disallowedtypes`,to:`allowElement`},{from:`allowedTypes`,id:`replace-allownode-allowedtypes-and-disallowedtypes`,to:`allowedElements`},{from:`className`,id:`remove-classname`},{from:`disallowedTypes`,id:`replace-allownode-allowedtypes-and-disallowedtypes`,to:`disallowedElements`},{from:`escapeHtml`,id:`remove-buggy-html-in-markdown-parser`},{from:`includeElementIndex`,id:`#remove-includeelementindex`},{from:`includeNodeIndex`,id:`change-includenodeindex-to-includeelementindex`},{from:`linkTarget`,id:`remove-linktarget`},{from:`plugins`,id:`change-plugins-to-remarkplugins`,to:`remarkPlugins`},{from:`rawSourcePos`,id:`#remove-rawsourcepos`},{from:`renderers`,id:`change-renderers-to-components`,to:`components`},{from:`source`,id:`change-source-to-children`,to:`children`},{from:`sourcePos`,id:`#remove-sourcepos`},{from:`transformImageUri`,id:`#add-urltransform`,to:`urlTransform`},{from:`transformLinkUri`,id:`#add-urltransform`,to:`urlTransform`}];function dz(e){let t=fz(e),n=pz(e);return mz(t.runSync(t.parse(n),n),e)}function fz(e){let t=e.rehypePlugins||sz,n=e.remarkPlugins||sz,r=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...cz}:cz;return ZR().use(cL).use(n).use(CR,r).use(t)}function pz(e){let t=e.children||``,n=new UR;return typeof t==`string`?n.value=t:``+t,n}function mz(e,t){let n=t.allowedElements,r=t.allowElement,i=t.components,a=t.disallowedElements,o=t.skipHtml,s=t.unwrapDisallowed,c=t.urlTransform||hz;for(let e of uz)Object.hasOwn(t,e.from)&&``+e.from+(e.to?"use `"+e.to+"` instead":`remove it`)+e.id;return pR(e,l),zN(e,{Fragment:L.Fragment,components:i,ignoreInvalidStyle:!0,jsx:L.jsx,jsxs:L.jsxs,passKeys:!0,passNode:!0});function l(e,t,i){if(e.type===`raw`&&i&&typeof t==`number`)return o?i.children.splice(t,1):i.children[t]={type:`text`,value:e.value},t;if(e.type===`element`){let t;for(t in sP)if(Object.hasOwn(sP,t)&&Object.hasOwn(e.properties,t)){let n=e.properties[t],r=sP[t];(r===null||r.includes(e.tagName))&&(e.properties[t]=c(String(n||``),t,e))}}if(e.type===`element`){let o=n?!n.includes(e.tagName):a?a.includes(e.tagName):!1;if(!o&&r&&typeof t==`number`&&(o=!r(e,t,i)),o&&i&&typeof t==`number`)return s&&e.children?i.children.splice(t,1,...e.children):i.children.splice(t,1),t}}}function hz(e){let t=e.indexOf(`:`),n=e.indexOf(`?`),r=e.indexOf(`#`),i=e.indexOf(`/`);return t===-1||i!==-1&&t>i||n!==-1&&t>n||r!==-1&&t>r||lz.test(e.slice(0,t))?e:``}function gz(e,t){let n=String(e);if(typeof t!=`string`)throw TypeError(`Expected character`);let r=0,i=n.indexOf(t);for(;i!==-1;)r++,i=n.indexOf(t,i+t.length);return r}function _z(e){if(typeof e!=`string`)throw TypeError(`Expected a string`);return e.replace(/[|\\{}()[\]^$+*?.]/g,`\\$&`).replace(/-/g,`\\x2d`)}function vz(e,t,n){let r=nR((n||{}).ignore||[]),i=yz(t),a=-1;for(;++a<i.length;)dR(e,`text`,o);function o(e,t){let n=-1,i;for(;++n<t.length;){let e=t[n],a=i?i.children:void 0;if(r(e,a?a.indexOf(e):void 0,i))return;i=e}if(i)return s(e,t)}function s(e,t){let n=t[t.length-1],r=i[a][0],o=i[a][1],s=0,c=n.children.indexOf(e),l=!1,u=[];r.lastIndex=0;let d=r.exec(e.value);for(;d;){let n=d.index,i={index:d.index,input:d.input,stack:[...t,e]},a=o(...d,i);if(typeof a==`string`&&(a=a.length>0?{type:`text`,value:a}:void 0),a===!1?r.lastIndex=n+1:(s!==n&&u.push({type:`text`,value:e.value.slice(s,n)}),Array.isArray(a)?u.push(...a):a&&u.push(a),s=n+d[0].length,l=!0),!r.global)break;d=r.exec(e.value)}return l?(s<e.value.length&&u.push({type:`text`,value:e.value.slice(s)}),n.children.splice(c,1,...u)):u=[e],c+u.length}}function yz(e){let t=[];if(!Array.isArray(e))throw TypeError(`Expected find and replace tuple or list of tuples`);let n=!e[0]||Array.isArray(e[0])?e:[e],r=-1;for(;++r<n.length;){let e=n[r];t.push([bz(e[0]),xz(e[1])])}return t}function bz(e){return typeof e==`string`?new RegExp(_z(e),`g`):e}function xz(e){return typeof e==`function`?e:function(){return e}}var Sz=`phrasing`,Cz=[`autolink`,`link`,`image`,`label`];function wz(){return{transforms:[Mz],enter:{literalAutolink:Ez,literalAutolinkEmail:Dz,literalAutolinkHttp:Dz,literalAutolinkWww:Dz},exit:{literalAutolink:jz,literalAutolinkEmail:Az,literalAutolinkHttp:Oz,literalAutolinkWww:kz}}}function Tz(){return{unsafe:[{character:`@`,before:`[+\\-.\\w]`,after:`[\\-.\\w]`,inConstruct:Sz,notInConstruct:Cz},{character:`.`,before:`[Ww]`,after:`[\\-.\\w]`,inConstruct:Sz,notInConstruct:Cz},{character:`:`,before:`[ps]`,after:`\\/`,inConstruct:Sz,notInConstruct:Cz}]}}function Ez(e){this.enter({type:`link`,title:null,url:``,children:[]},e)}function Dz(e){this.config.enter.autolinkProtocol.call(this,e)}function Oz(e){this.config.exit.autolinkProtocol.call(this,e)}function kz(e){this.config.exit.data.call(this,e);let t=this.stack[this.stack.length-1];t.type,t.url=`http://`+this.sliceSerialize(e)}function Az(e){this.config.exit.autolinkEmail.call(this,e)}function jz(e){this.exit(e)}function Mz(e){vz(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,Nz],[/(?<=^|\s|\p{P}|\p{S})([-.\w+]+)@([-\w]+(?:\.[-\w]+)+)/gu,Pz]],{ignore:[`link`,`linkReference`]})}function Nz(e,t,n,r,i){let a=``;if(!Lz(i)||(/^w/i.test(t)&&(n=t+n,t=``,a=`http://`),!Fz(n)))return!1;let o=Iz(n+r);if(!o[0])return!1;let s={type:`link`,title:null,url:a+t+o[0],children:[{type:`text`,value:t+o[0]}]};return o[1]?[s,{type:`text`,value:o[1]}]:s}function Pz(e,t,n,r){return!Lz(r,!0)||/[-\d_]$/.test(n)?!1:{type:`link`,title:null,url:`mailto:`+t+`@`+n,children:[{type:`text`,value:t+`@`+n}]}}function Fz(e){let t=e.split(`.`);return!(t.length<2||t[t.length-1]&&(/_/.test(t[t.length-1])||!/[a-zA-Z\d]/.test(t[t.length-1]))||t[t.length-2]&&(/_/.test(t[t.length-2])||!/[a-zA-Z\d]/.test(t[t.length-2])))}function Iz(e){let t=/[!"&'),.:;<>?\]}]+$/.exec(e);if(!t)return[e,void 0];e=e.slice(0,t.index);let n=t[0],r=n.indexOf(`)`),i=gz(e,`(`),a=gz(e,`)`);for(;r!==-1&&i>a;)e+=n.slice(0,r+1),n=n.slice(r+1),r=n.indexOf(`)`),a++;return[e,n]}function Lz(e,t){let n=e.input.charCodeAt(e.index-1);return(e.index===0||NP(n)||MP(n))&&(!t||n!==47)}qz.peek=Kz;function Rz(){this.buffer()}function zz(e){this.enter({type:`footnoteReference`,identifier:``,label:``},e)}function Bz(){this.buffer()}function Vz(e){this.enter({type:`footnoteDefinition`,identifier:``,label:``,children:[]},e)}function Hz(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=SP(this.sliceSerialize(e)).toLowerCase(),n.label=t}function Uz(e){this.exit(e)}function Wz(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=SP(this.sliceSerialize(e)).toLowerCase(),n.label=t}function Gz(e){this.exit(e)}function Kz(){return`[`}function qz(e,t,n,r){let i=n.createTracker(r),a=i.move(`[^`),o=n.enter(`footnoteReference`),s=n.enter(`reference`);return a+=i.move(n.safe(n.associationId(e),{after:`]`,before:a})),s(),o(),a+=i.move(`]`),a}function Jz(){return{enter:{gfmFootnoteCallString:Rz,gfmFootnoteCall:zz,gfmFootnoteDefinitionLabelString:Bz,gfmFootnoteDefinition:Vz},exit:{gfmFootnoteCallString:Hz,gfmFootnoteCall:Uz,gfmFootnoteDefinitionLabelString:Wz,gfmFootnoteDefinition:Gz}}}function Yz(e){let t=!1;return e&&e.firstLineBlank&&(t=!0),{handlers:{footnoteDefinition:n,footnoteReference:qz},unsafe:[{character:`[`,inConstruct:[`label`,`phrasing`,`reference`]}]};function n(e,n,r,i){let a=r.createTracker(i),o=a.move(`[^`),s=r.enter(`footnoteDefinition`),c=r.enter(`label`);return o+=a.move(r.safe(r.associationId(e),{before:o,after:`]`})),c(),o+=a.move(`]:`),e.children&&e.children.length>0&&(a.shift(4),o+=a.move((t?`
|
|
87
|
-
`:` `)+r.indentLines(r.containerFlow(e,a.current()),t?Zz:Xz))),s(),o}}function Xz(e,t,n){return t===0?e:Zz(e,t,n)}function Zz(e,t,n){return(n?``:` `)+e}var Qz=[`autolink`,`destinationLiteral`,`destinationRaw`,`reference`,`titleQuote`,`titleApostrophe`];rB.peek=iB;function $z(){return{canContainEols:[`delete`],enter:{strikethrough:tB},exit:{strikethrough:nB}}}function eB(){return{unsafe:[{character:`~`,inConstruct:`phrasing`,notInConstruct:Qz}],handlers:{delete:rB}}}function tB(e){this.enter({type:`delete`,children:[]},e)}function nB(e){this.exit(e)}function rB(e,t,n,r){let i=n.createTracker(r),a=n.enter(`strikethrough`),o=i.move(`~~`);return o+=n.containerPhrasing(e,{...i.current(),before:o,after:`~`}),o+=i.move(`~~`),a(),o}function iB(){return`~`}function aB(e){return e.length}function oB(e,t){let n=t||{},r=(n.align||[]).concat(),i=n.stringLength||aB,a=[],o=[],s=[],c=[],l=0,u=-1;for(;++u<e.length;){let t=[],r=[],a=-1;for(e[u].length>l&&(l=e[u].length);++a<e[u].length;){let o=sB(e[u][a]);if(n.alignDelimiters!==!1){let e=i(o);r[a]=e,(c[a]===void 0||e>c[a])&&(c[a]=e)}t.push(o)}o[u]=t,s[u]=r}let d=-1;if(typeof r==`object`&&`length`in r)for(;++d<l;)a[d]=cB(r[d]);else{let e=cB(r);for(;++d<l;)a[d]=e}d=-1;let f=[],p=[];for(;++d<l;){let e=a[d],t=``,r=``;e===99?(t=`:`,r=`:`):e===108?t=`:`:e===114&&(r=`:`);let i=n.alignDelimiters===!1?1:Math.max(1,c[d]-t.length-r.length),o=t+`-`.repeat(i)+r;n.alignDelimiters!==!1&&(i=t.length+i+r.length,i>c[d]&&(c[d]=i),p[d]=i),f[d]=o}o.splice(1,0,f),s.splice(1,0,p),u=-1;let m=[];for(;++u<o.length;){let e=o[u],t=s[u];d=-1;let r=[];for(;++d<l;){let i=e[d]||``,o=``,s=``;if(n.alignDelimiters!==!1){let e=c[d]-(t[d]||0),n=a[d];n===114?o=` `.repeat(e):n===99?e%2?(o=` `.repeat(e/2+.5),s=` `.repeat(e/2-.5)):(o=` `.repeat(e/2),s=o):s=` `.repeat(e)}n.delimiterStart!==!1&&!d&&r.push(`|`),n.padding!==!1&&(n.alignDelimiters!==!1||i!==``)&&(n.delimiterStart!==!1||d)&&r.push(` `),n.alignDelimiters!==!1&&r.push(o),r.push(i),n.alignDelimiters!==!1&&r.push(s),n.padding!==!1&&r.push(` `),(n.delimiterEnd!==!1||d!==l-1)&&r.push(`|`)}m.push(n.delimiterEnd===!1?r.join(``).replace(/ +$/,``):r.join(``))}return m.join(`
|
|
88
|
-
`)}function sB(e){return e==null?``:String(e)}function cB(e){let t=typeof e==`string`?e.codePointAt(0):0;return t===67||t===99?99:t===76||t===108?108:t===82||t===114?114:0}function lB(e,t,n,r){let i=n.enter(`blockquote`),a=n.createTracker(r);a.move(`> `),a.shift(2);let o=n.indentLines(n.containerFlow(e,a.current()),uB);return i(),o}function uB(e,t,n){return`>`+(n?``:` `)+e}function dB(e,t){return fB(e,t.inConstruct,!0)&&!fB(e,t.notInConstruct,!1)}function fB(e,t,n){if(typeof t==`string`&&(t=[t]),!t||t.length===0)return n;let r=-1;for(;++r<t.length;)if(e.includes(t[r]))return!0;return!1}function pB(e,t,n,r){let i=-1;for(;++i<n.unsafe.length;)if(n.unsafe[i].character===`
|
|
89
|
-
`&&dB(n.stack,n.unsafe[i]))return/[ \t]/.test(r.before)?``:` `;return`\\
|
|
90
|
-
`}function mB(e,t){let n=String(e),r=n.indexOf(t),i=r,a=0,o=0;if(typeof t!=`string`)throw TypeError(`Expected substring`);for(;r!==-1;)r===i?++a>o&&(o=a):a=1,i=r+t.length,r=n.indexOf(t,i);return o}function hB(e,t){return!!(t.options.fences===!1&&e.value&&!e.lang&&/[^ \r\n]/.test(e.value)&&!/^[\t ]*(?:[\r\n]|$)|(?:^|[\r\n])[\t ]*$/.test(e.value))}function gB(e){let t=e.options.fence||"`";if(t!=="`"&&t!==`~`)throw Error("Cannot serialize code with `"+t+"` for `options.fence`, expected `` ` `` or `~`");return t}function _B(e,t,n,r){let i=gB(n),a=e.value||``,o=i==="`"?`GraveAccent`:`Tilde`;if(hB(e,n)){let e=n.enter(`codeIndented`),t=n.indentLines(a,vB);return e(),t}let s=n.createTracker(r),c=i.repeat(Math.max(mB(a,i)+1,3)),l=n.enter(`codeFenced`),u=s.move(c);if(e.lang){let t=n.enter(`codeFencedLang${o}`);u+=s.move(n.safe(e.lang,{before:u,after:` `,encode:["`"],...s.current()})),t()}if(e.lang&&e.meta){let t=n.enter(`codeFencedMeta${o}`);u+=s.move(` `),u+=s.move(n.safe(e.meta,{before:u,after:`
|
|
91
|
-
`,encode:["`"],...s.current()})),t()}return u+=s.move(`
|
|
92
|
-
`),a&&(u+=s.move(a+`
|
|
93
|
-
`)),u+=s.move(c),l(),u}function vB(e,t,n){return(n?``:` `)+e}function yB(e){let t=e.options.quote||`"`;if(t!==`"`&&t!==`'`)throw Error("Cannot serialize title with `"+t+"` for `options.quote`, expected `\"`, or `'`");return t}function bB(e,t,n,r){let i=yB(n),a=i===`"`?`Quote`:`Apostrophe`,o=n.enter(`definition`),s=n.enter(`label`),c=n.createTracker(r),l=c.move(`[`);return l+=c.move(n.safe(n.associationId(e),{before:l,after:`]`,...c.current()})),l+=c.move(`]: `),s(),!e.url||/[\0- \u007F]/.test(e.url)?(s=n.enter(`destinationLiteral`),l+=c.move(`<`),l+=c.move(n.safe(e.url,{before:l,after:`>`,...c.current()})),l+=c.move(`>`)):(s=n.enter(`destinationRaw`),l+=c.move(n.safe(e.url,{before:l,after:e.title?` `:`
|
|
94
|
-
`,...c.current()}))),s(),e.title&&(s=n.enter(`title${a}`),l+=c.move(` `+i),l+=c.move(n.safe(e.title,{before:l,after:i,...c.current()})),l+=c.move(i),s()),o(),l}function xB(e){let t=e.options.emphasis||`*`;if(t!==`*`&&t!==`_`)throw Error("Cannot serialize emphasis with `"+t+"` for `options.emphasis`, expected `*`, or `_`");return t}function SB(e){return`&#x`+e.toString(16).toUpperCase()+`;`}function CB(e,t,n){let r=UP(e),i=UP(t);return r===void 0?i===void 0?n===`_`?{inside:!0,outside:!0}:{inside:!1,outside:!1}:i===1?{inside:!0,outside:!0}:{inside:!1,outside:!0}:r===1?i===void 0?{inside:!1,outside:!1}:i===1?{inside:!0,outside:!0}:{inside:!1,outside:!1}:i===void 0?{inside:!1,outside:!1}:i===1?{inside:!0,outside:!1}:{inside:!1,outside:!1}}wB.peek=TB;function wB(e,t,n,r){let i=xB(n),a=n.enter(`emphasis`),o=n.createTracker(r),s=o.move(i),c=o.move(n.containerPhrasing(e,{after:i,before:s,...o.current()})),l=c.charCodeAt(0),u=CB(r.before.charCodeAt(r.before.length-1),l,i);u.inside&&(c=SB(l)+c.slice(1));let d=c.charCodeAt(c.length-1),f=CB(r.after.charCodeAt(0),d,i);f.inside&&(c=c.slice(0,-1)+SB(d));let p=o.move(i);return a(),n.attentionEncodeSurroundingInfo={after:f.outside,before:u.outside},s+c+p}function TB(e,t,n){return n.options.emphasis||`*`}function EB(e,t){let n=!1;return pR(e,function(e){if(`value`in e&&/\r?\n|\r/.test(e.value)||e.type===`break`)return n=!0,!1}),!!((!e.depth||e.depth<3)&&lP(e)&&(t.options.setext||n))}function DB(e,t,n,r){let i=Math.max(Math.min(6,e.depth||1),1),a=n.createTracker(r);if(EB(e,n)){let t=n.enter(`headingSetext`),r=n.enter(`phrasing`),o=n.containerPhrasing(e,{...a.current(),before:`
|
|
95
|
-
`,after:`
|
|
96
|
-
`});return r(),t(),o+`
|
|
97
|
-
`+(i===1?`=`:`-`).repeat(o.length-(Math.max(o.lastIndexOf(`\r`),o.lastIndexOf(`
|
|
98
|
-
`))+1))}let o=`#`.repeat(i),s=n.enter(`headingAtx`),c=n.enter(`phrasing`);a.move(o+` `);let l=n.containerPhrasing(e,{before:`# `,after:`
|
|
99
|
-
`,...a.current()});return/^[\t ]/.test(l)&&(l=SB(l.charCodeAt(0))+l.slice(1)),l=l?o+` `+l:o,n.options.closeAtx&&(l+=` `+o),c(),s(),l}OB.peek=kB;function OB(e){return e.value||``}function kB(){return`<`}AB.peek=jB;function AB(e,t,n,r){let i=yB(n),a=i===`"`?`Quote`:`Apostrophe`,o=n.enter(`image`),s=n.enter(`label`),c=n.createTracker(r),l=c.move(`![`);return l+=c.move(n.safe(e.alt,{before:l,after:`]`,...c.current()})),l+=c.move(`](`),s(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(s=n.enter(`destinationLiteral`),l+=c.move(`<`),l+=c.move(n.safe(e.url,{before:l,after:`>`,...c.current()})),l+=c.move(`>`)):(s=n.enter(`destinationRaw`),l+=c.move(n.safe(e.url,{before:l,after:e.title?` `:`)`,...c.current()}))),s(),e.title&&(s=n.enter(`title${a}`),l+=c.move(` `+i),l+=c.move(n.safe(e.title,{before:l,after:i,...c.current()})),l+=c.move(i),s()),l+=c.move(`)`),o(),l}function jB(){return`!`}MB.peek=NB;function MB(e,t,n,r){let i=e.referenceType,a=n.enter(`imageReference`),o=n.enter(`label`),s=n.createTracker(r),c=s.move(`![`),l=n.safe(e.alt,{before:c,after:`]`,...s.current()});c+=s.move(l+`][`),o();let u=n.stack;n.stack=[],o=n.enter(`reference`);let d=n.safe(n.associationId(e),{before:c,after:`]`,...s.current()});return o(),n.stack=u,a(),i===`full`||!l||l!==d?c+=s.move(d+`]`):i===`shortcut`?c=c.slice(0,-1):c+=s.move(`]`),c}function NB(){return`!`}PB.peek=FB;function PB(e,t,n){let r=e.value||``,i="`",a=-1;for(;RegExp("(^|[^`])"+i+"([^`]|$)").test(r);)i+="`";for(/[^ \r\n]/.test(r)&&(/^[ \r\n]/.test(r)&&/[ \r\n]$/.test(r)||/^`|`$/.test(r))&&(r=` `+r+` `);++a<n.unsafe.length;){let e=n.unsafe[a],t=n.compilePattern(e),i;if(e.atBreak)for(;i=t.exec(r);){let e=i.index;r.charCodeAt(e)===10&&r.charCodeAt(e-1)===13&&e--,r=r.slice(0,e)+` `+r.slice(i.index+1)}}return i+r+i}function FB(){return"`"}function IB(e,t){let n=lP(e);return!!(!t.options.resourceLink&&e.url&&!e.title&&e.children&&e.children.length===1&&e.children[0].type===`text`&&(n===e.url||`mailto:`+n===e.url)&&/^[a-z][a-z+.-]+:/i.test(e.url)&&!/[\0- <>\u007F]/.test(e.url))}LB.peek=RB;function LB(e,t,n,r){let i=yB(n),a=i===`"`?`Quote`:`Apostrophe`,o=n.createTracker(r),s,c;if(IB(e,n)){let t=n.stack;n.stack=[],s=n.enter(`autolink`);let r=o.move(`<`);return r+=o.move(n.containerPhrasing(e,{before:r,after:`>`,...o.current()})),r+=o.move(`>`),s(),n.stack=t,r}s=n.enter(`link`),c=n.enter(`label`);let l=o.move(`[`);return l+=o.move(n.containerPhrasing(e,{before:l,after:`](`,...o.current()})),l+=o.move(`](`),c(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(c=n.enter(`destinationLiteral`),l+=o.move(`<`),l+=o.move(n.safe(e.url,{before:l,after:`>`,...o.current()})),l+=o.move(`>`)):(c=n.enter(`destinationRaw`),l+=o.move(n.safe(e.url,{before:l,after:e.title?` `:`)`,...o.current()}))),c(),e.title&&(c=n.enter(`title${a}`),l+=o.move(` `+i),l+=o.move(n.safe(e.title,{before:l,after:i,...o.current()})),l+=o.move(i),c()),l+=o.move(`)`),s(),l}function RB(e,t,n){return IB(e,n)?`<`:`[`}zB.peek=BB;function zB(e,t,n,r){let i=e.referenceType,a=n.enter(`linkReference`),o=n.enter(`label`),s=n.createTracker(r),c=s.move(`[`),l=n.containerPhrasing(e,{before:c,after:`]`,...s.current()});c+=s.move(l+`][`),o();let u=n.stack;n.stack=[],o=n.enter(`reference`);let d=n.safe(n.associationId(e),{before:c,after:`]`,...s.current()});return o(),n.stack=u,a(),i===`full`||!l||l!==d?c+=s.move(d+`]`):i===`shortcut`?c=c.slice(0,-1):c+=s.move(`]`),c}function BB(){return`[`}function VB(e){let t=e.options.bullet||`*`;if(t!==`*`&&t!==`+`&&t!==`-`)throw Error("Cannot serialize items with `"+t+"` for `options.bullet`, expected `*`, `+`, or `-`");return t}function HB(e){let t=VB(e),n=e.options.bulletOther;if(!n)return t===`*`?`-`:`*`;if(n!==`*`&&n!==`+`&&n!==`-`)throw Error("Cannot serialize items with `"+n+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(n===t)throw Error("Expected `bullet` (`"+t+"`) and `bulletOther` (`"+n+"`) to be different");return n}function UB(e){let t=e.options.bulletOrdered||`.`;if(t!==`.`&&t!==`)`)throw Error("Cannot serialize items with `"+t+"` for `options.bulletOrdered`, expected `.` or `)`");return t}function WB(e){let t=e.options.rule||`*`;if(t!==`*`&&t!==`-`&&t!==`_`)throw Error("Cannot serialize rules with `"+t+"` for `options.rule`, expected `*`, `-`, or `_`");return t}function GB(e,t,n,r){let i=n.enter(`list`),a=n.bulletCurrent,o=e.ordered?UB(n):VB(n),s=e.ordered?o===`.`?`)`:`.`:HB(n),c=t&&n.bulletLastUsed?o===n.bulletLastUsed:!1;if(!e.ordered){let t=e.children?e.children[0]:void 0;if((o===`*`||o===`-`)&&t&&(!t.children||!t.children[0])&&n.stack[n.stack.length-1]===`list`&&n.stack[n.stack.length-2]===`listItem`&&n.stack[n.stack.length-3]===`list`&&n.stack[n.stack.length-4]===`listItem`&&n.indexStack[n.indexStack.length-1]===0&&n.indexStack[n.indexStack.length-2]===0&&n.indexStack[n.indexStack.length-3]===0&&(c=!0),WB(n)===o&&t){let t=-1;for(;++t<e.children.length;){let n=e.children[t];if(n&&n.type===`listItem`&&n.children&&n.children[0]&&n.children[0].type===`thematicBreak`){c=!0;break}}}}c&&(o=s),n.bulletCurrent=o;let l=n.containerFlow(e,r);return n.bulletLastUsed=o,n.bulletCurrent=a,i(),l}function KB(e){let t=e.options.listItemIndent||`one`;if(t!==`tab`&&t!==`one`&&t!==`mixed`)throw Error("Cannot serialize items with `"+t+"` for `options.listItemIndent`, expected `tab`, `one`, or `mixed`");return t}function qB(e,t,n,r){let i=KB(n),a=n.bulletCurrent||VB(n);t&&t.type===`list`&&t.ordered&&(a=(typeof t.start==`number`&&t.start>-1?t.start:1)+(n.options.incrementListMarker===!1?0:t.children.indexOf(e))+a);let o=a.length+1;(i===`tab`||i===`mixed`&&(t&&t.type===`list`&&t.spread||e.spread))&&(o=Math.ceil(o/4)*4);let s=n.createTracker(r);s.move(a+` `.repeat(o-a.length)),s.shift(o);let c=n.enter(`listItem`),l=n.indentLines(n.containerFlow(e,s.current()),u);return c(),l;function u(e,t,n){return t?(n?``:` `.repeat(o))+e:(n?a:a+` `.repeat(o-a.length))+e}}function JB(e,t,n,r){let i=n.enter(`paragraph`),a=n.enter(`phrasing`),o=n.containerPhrasing(e,r);return a(),i(),o}var YB=nR([`break`,`delete`,`emphasis`,`footnote`,`footnoteReference`,`image`,`imageReference`,`inlineCode`,`inlineMath`,`link`,`linkReference`,`mdxJsxTextElement`,`mdxTextExpression`,`strong`,`text`,`textDirective`]);function XB(e,t,n,r){return(e.children.some(function(e){return YB(e)})?n.containerPhrasing:n.containerFlow).call(n,e,r)}function ZB(e){let t=e.options.strong||`*`;if(t!==`*`&&t!==`_`)throw Error("Cannot serialize strong with `"+t+"` for `options.strong`, expected `*`, or `_`");return t}QB.peek=$B;function QB(e,t,n,r){let i=ZB(n),a=n.enter(`strong`),o=n.createTracker(r),s=o.move(i+i),c=o.move(n.containerPhrasing(e,{after:i,before:s,...o.current()})),l=c.charCodeAt(0),u=CB(r.before.charCodeAt(r.before.length-1),l,i);u.inside&&(c=SB(l)+c.slice(1));let d=c.charCodeAt(c.length-1),f=CB(r.after.charCodeAt(0),d,i);f.inside&&(c=c.slice(0,-1)+SB(d));let p=o.move(i+i);return a(),n.attentionEncodeSurroundingInfo={after:f.outside,before:u.outside},s+c+p}function $B(e,t,n){return n.options.strong||`*`}function eV(e,t,n,r){return n.safe(e.value,r)}function tV(e){let t=e.options.ruleRepetition||3;if(t<3)throw Error("Cannot serialize rules with repetition `"+t+"` for `options.ruleRepetition`, expected `3` or more");return t}function nV(e,t,n){let r=(WB(n)+(n.options.ruleSpaces?` `:``)).repeat(tV(n));return n.options.ruleSpaces?r.slice(0,-1):r}var rV={blockquote:lB,break:pB,code:_B,definition:bB,emphasis:wB,hardBreak:pB,heading:DB,html:OB,image:AB,imageReference:MB,inlineCode:PB,link:LB,linkReference:zB,list:GB,listItem:qB,paragraph:JB,root:XB,strong:QB,text:eV,thematicBreak:nV};function iV(){return{enter:{table:aV,tableData:lV,tableHeader:lV,tableRow:sV},exit:{codeText:uV,table:oV,tableData:cV,tableHeader:cV,tableRow:cV}}}function aV(e){let t=e._align;this.enter({type:`table`,align:t.map(function(e){return e===`none`?null:e}),children:[]},e),this.data.inTable=!0}function oV(e){this.exit(e),this.data.inTable=void 0}function sV(e){this.enter({type:`tableRow`,children:[]},e)}function cV(e){this.exit(e)}function lV(e){this.enter({type:`tableCell`,children:[]},e)}function uV(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,dV));let n=this.stack[this.stack.length-1];n.type,n.value=t,this.exit(e)}function dV(e,t){return t===`|`?t:e}function fV(e){let t=e||{},n=t.tableCellPadding,r=t.tablePipeAlign,i=t.stringLength,a=n?` `:`|`;return{unsafe:[{character:`\r`,inConstruct:`tableCell`},{character:`
|
|
100
|
-
`,inConstruct:`tableCell`},{atBreak:!0,character:`|`,after:`[ :-]`},{character:`|`,inConstruct:`tableCell`},{atBreak:!0,character:`:`,after:`-`},{atBreak:!0,character:`-`,after:`[:|-]`}],handlers:{inlineCode:f,table:o,tableCell:c,tableRow:s}};function o(e,t,n,r){return l(u(e,n,r),e.align)}function s(e,t,n,r){let i=l([d(e,n,r)]);return i.slice(0,i.indexOf(`
|
|
101
|
-
`))}function c(e,t,n,r){let i=n.enter(`tableCell`),o=n.enter(`phrasing`),s=n.containerPhrasing(e,{...r,before:a,after:a});return o(),i(),s}function l(e,t){return oB(e,{align:t,alignDelimiters:r,padding:n,stringLength:i})}function u(e,t,n){let r=e.children,i=-1,a=[],o=t.enter(`table`);for(;++i<r.length;)a[i]=d(r[i],t,n);return o(),a}function d(e,t,n){let r=e.children,i=-1,a=[],o=t.enter(`tableRow`);for(;++i<r.length;)a[i]=c(r[i],e,t,n);return o(),a}function f(e,t,n){let r=rV.inlineCode(e,t,n);return n.stack.includes(`tableCell`)&&(r=r.replace(/\|/g,`\\$&`)),r}}function pV(){return{exit:{taskListCheckValueChecked:hV,taskListCheckValueUnchecked:hV,paragraph:gV}}}function mV(){return{unsafe:[{atBreak:!0,character:`-`,after:`[:|-]`}],handlers:{listItem:_V}}}function hV(e){let t=this.stack[this.stack.length-2];t.type,t.checked=e.type===`taskListCheckValueChecked`}function gV(e){let t=this.stack[this.stack.length-2];if(t&&t.type===`listItem`&&typeof t.checked==`boolean`){let e=this.stack[this.stack.length-1];e.type;let n=e.children[0];if(n&&n.type===`text`){let r=t.children,i=-1,a;for(;++i<r.length;){let e=r[i];if(e.type===`paragraph`){a=e;break}}a===e&&(n.value=n.value.slice(1),n.value.length===0?e.children.shift():e.position&&n.position&&typeof n.position.start.offset==`number`&&(n.position.start.column++,n.position.start.offset++,e.position.start=Object.assign({},n.position.start)))}}this.exit(e)}function _V(e,t,n,r){let i=e.children[0],a=typeof e.checked==`boolean`&&i&&i.type===`paragraph`,o=`[`+(e.checked?`x`:` `)+`] `,s=n.createTracker(r);a&&s.move(o);let c=rV.listItem(e,t,n,{...r,...s.current()});return a&&(c=c.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,l)),c;function l(e){return e+o}}function vV(){return[wz(),Jz(),$z(),iV(),pV()]}function yV(e){return{extensions:[Tz(),Yz(e),eB(),fV(e),mV()]}}var bV={tokenize:PV,partial:!0},xV={tokenize:FV,partial:!0},SV={tokenize:IV,partial:!0},CV={tokenize:LV,partial:!0},wV={tokenize:RV,partial:!0},TV={name:`wwwAutolink`,tokenize:MV,previous:zV},EV={name:`protocolAutolink`,tokenize:NV,previous:BV},DV={name:`emailAutolink`,tokenize:jV,previous:VV},OV={};function kV(){return{text:OV}}for(var AV=48;AV<123;)OV[AV]=DV,AV++,AV===58?AV=65:AV===91&&(AV=97);OV[43]=DV,OV[45]=DV,OV[46]=DV,OV[95]=DV,OV[72]=[DV,EV],OV[104]=[DV,EV],OV[87]=[DV,TV],OV[119]=[DV,TV];function jV(e,t,n){let r=this,i,a;return o;function o(t){return!HV(t)||!VV.call(r,r.previous)||UV(r.events)?n(t):(e.enter(`literalAutolink`),e.enter(`literalAutolinkEmail`),s(t))}function s(t){return HV(t)?(e.consume(t),s):t===64?(e.consume(t),c):n(t)}function c(t){return t===46?e.check(wV,u,l)(t):t===45||t===95||wP(t)?(a=!0,e.consume(t),c):u(t)}function l(t){return e.consume(t),i=!0,c}function u(o){return a&&i&&CP(r.previous)?(e.exit(`literalAutolinkEmail`),e.exit(`literalAutolink`),t(o)):n(o)}}function MV(e,t,n){let r=this;return i;function i(t){return t!==87&&t!==119||!zV.call(r,r.previous)||UV(r.events)?n(t):(e.enter(`literalAutolink`),e.enter(`literalAutolinkWww`),e.check(bV,e.attempt(xV,e.attempt(SV,a),n),n)(t))}function a(n){return e.exit(`literalAutolinkWww`),e.exit(`literalAutolink`),t(n)}}function NV(e,t,n){let r=this,i=``,a=!1;return o;function o(t){return(t===72||t===104)&&BV.call(r,r.previous)&&!UV(r.events)?(e.enter(`literalAutolink`),e.enter(`literalAutolinkHttp`),i+=String.fromCodePoint(t),e.consume(t),s):n(t)}function s(t){if(CP(t)&&i.length<5)return i+=String.fromCodePoint(t),e.consume(t),s;if(t===58){let n=i.toLowerCase();if(n===`http`||n===`https`)return e.consume(t),c}return n(t)}function c(t){return t===47?(e.consume(t),a?l:(a=!0,c)):n(t)}function l(t){return t===null||EP(t)||AP(t)||NP(t)||MP(t)?n(t):e.attempt(xV,e.attempt(SV,u),n)(t)}function u(n){return e.exit(`literalAutolinkHttp`),e.exit(`literalAutolink`),t(n)}}function PV(e,t,n){let r=0;return i;function i(t){return(t===87||t===119)&&r<3?(r++,e.consume(t),i):t===46&&r===3?(e.consume(t),a):n(t)}function a(e){return e===null?n(e):t(e)}}function FV(e,t,n){let r,i,a;return o;function o(t){return t===46||t===95?e.check(CV,c,s)(t):t===null||AP(t)||NP(t)||t!==45&&MP(t)?c(t):(a=!0,e.consume(t),o)}function s(t){return t===95?r=!0:(i=r,r=void 0),e.consume(t),o}function c(e){return i||r||!a?n(e):t(e)}}function IV(e,t){let n=0,r=0;return i;function i(o){return o===40?(n++,e.consume(o),i):o===41&&r<n?a(o):o===33||o===34||o===38||o===39||o===41||o===42||o===44||o===46||o===58||o===59||o===60||o===63||o===93||o===95||o===126?e.check(CV,t,a)(o):o===null||AP(o)||NP(o)?t(o):(e.consume(o),i)}function a(t){return t===41&&r++,e.consume(t),i}}function LV(e,t,n){return r;function r(o){return o===33||o===34||o===39||o===41||o===42||o===44||o===46||o===58||o===59||o===63||o===95||o===126?(e.consume(o),r):o===38?(e.consume(o),a):o===93?(e.consume(o),i):o===60||o===null||AP(o)||NP(o)?t(o):n(o)}function i(e){return e===null||e===40||e===91||AP(e)||NP(e)?t(e):r(e)}function a(e){return CP(e)?o(e):n(e)}function o(t){return t===59?(e.consume(t),r):CP(t)?(e.consume(t),o):n(t)}}function RV(e,t,n){return r;function r(t){return e.consume(t),i}function i(e){return wP(e)?n(e):t(e)}}function zV(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||AP(e)}function BV(e){return!CP(e)}function VV(e){return!(e===47||HV(e))}function HV(e){return e===43||e===45||e===46||e===95||wP(e)}function UV(e){let t=e.length,n=!1;for(;t--;){let r=e[t][1];if((r.type===`labelLink`||r.type===`labelImage`)&&!r._balanced){n=!0;break}if(r._gfmAutolinkLiteralWalkedInto){n=!1;break}}return e.length>0&&!n&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),n}var WV={tokenize:QV,partial:!0};function GV(){return{document:{91:{name:`gfmFootnoteDefinition`,tokenize:YV,continuation:{tokenize:XV},exit:ZV}},text:{91:{name:`gfmFootnoteCall`,tokenize:JV},93:{name:`gfmPotentialFootnoteCall`,add:`after`,tokenize:KV,resolveTo:qV}}}}function KV(e,t,n){let r=this,i=r.events.length,a=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]),o;for(;i--;){let e=r.events[i][1];if(e.type===`labelImage`){o=e;break}if(e.type===`gfmFootnoteCall`||e.type===`labelLink`||e.type===`label`||e.type===`image`||e.type===`link`)break}return s;function s(i){if(!o||!o._balanced)return n(i);let s=SP(r.sliceSerialize({start:o.end,end:r.now()}));return s.codePointAt(0)!==94||!a.includes(s.slice(1))?n(i):(e.enter(`gfmFootnoteCallLabelMarker`),e.consume(i),e.exit(`gfmFootnoteCallLabelMarker`),t(i))}}function qV(e,t){let n=e.length;for(;n--;)if(e[n][1].type===`labelImage`&&e[n][0]===`enter`){e[n][1];break}e[n+1][1].type=`data`,e[n+3][1].type=`gfmFootnoteCallLabelMarker`;let r={type:`gfmFootnoteCall`,start:Object.assign({},e[n+3][1].start),end:Object.assign({},e[e.length-1][1].end)},i={type:`gfmFootnoteCallMarker`,start:Object.assign({},e[n+3][1].end),end:Object.assign({},e[n+3][1].end)};i.end.column++,i.end.offset++,i.end._bufferIndex++;let a={type:`gfmFootnoteCallString`,start:Object.assign({},i.end),end:Object.assign({},e[e.length-1][1].start)},o={type:`chunkString`,contentType:`string`,start:Object.assign({},a.start),end:Object.assign({},a.end)},s=[e[n+1],e[n+2],[`enter`,r,t],e[n+3],e[n+4],[`enter`,i,t],[`exit`,i,t],[`enter`,a,t],[`enter`,o,t],[`exit`,o,t],[`exit`,a,t],e[e.length-2],e[e.length-1],[`exit`,r,t]];return e.splice(n,e.length-n+1,...s),e}function JV(e,t,n){let r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]),a=0,o;return s;function s(t){return e.enter(`gfmFootnoteCall`),e.enter(`gfmFootnoteCallLabelMarker`),e.consume(t),e.exit(`gfmFootnoteCallLabelMarker`),c}function c(t){return t===94?(e.enter(`gfmFootnoteCallMarker`),e.consume(t),e.exit(`gfmFootnoteCallMarker`),e.enter(`gfmFootnoteCallString`),e.enter(`chunkString`).contentType=`string`,l):n(t)}function l(s){if(a>999||s===93&&!o||s===null||s===91||AP(s))return n(s);if(s===93){e.exit(`chunkString`);let a=e.exit(`gfmFootnoteCallString`);return i.includes(SP(r.sliceSerialize(a)))?(e.enter(`gfmFootnoteCallLabelMarker`),e.consume(s),e.exit(`gfmFootnoteCallLabelMarker`),e.exit(`gfmFootnoteCall`),t):n(s)}return AP(s)||(o=!0),a++,e.consume(s),s===92?u:l}function u(t){return t===91||t===92||t===93?(e.consume(t),a++,l):l(t)}}function YV(e,t,n){let r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]),a,o=0,s;return c;function c(t){return e.enter(`gfmFootnoteDefinition`)._container=!0,e.enter(`gfmFootnoteDefinitionLabel`),e.enter(`gfmFootnoteDefinitionLabelMarker`),e.consume(t),e.exit(`gfmFootnoteDefinitionLabelMarker`),l}function l(t){return t===94?(e.enter(`gfmFootnoteDefinitionMarker`),e.consume(t),e.exit(`gfmFootnoteDefinitionMarker`),e.enter(`gfmFootnoteDefinitionLabelString`),e.enter(`chunkString`).contentType=`string`,u):n(t)}function u(t){if(o>999||t===93&&!s||t===null||t===91||AP(t))return n(t);if(t===93){e.exit(`chunkString`);let n=e.exit(`gfmFootnoteDefinitionLabelString`);return a=SP(r.sliceSerialize(n)),e.enter(`gfmFootnoteDefinitionLabelMarker`),e.consume(t),e.exit(`gfmFootnoteDefinitionLabelMarker`),e.exit(`gfmFootnoteDefinitionLabel`),f}return AP(t)||(s=!0),o++,e.consume(t),t===92?d:u}function d(t){return t===91||t===92||t===93?(e.consume(t),o++,u):u(t)}function f(t){return t===58?(e.enter(`definitionMarker`),e.consume(t),e.exit(`definitionMarker`),i.includes(a)||i.push(a),IP(e,p,`gfmFootnoteDefinitionWhitespace`)):n(t)}function p(e){return t(e)}}function XV(e,t,n){return e.check(ZP,t,e.attempt(WV,t,n))}function ZV(e){e.exit(`gfmFootnoteDefinition`)}function QV(e,t,n){let r=this;return IP(e,i,`gfmFootnoteDefinitionIndent`,5);function i(e){let i=r.events[r.events.length-1];return i&&i[1].type===`gfmFootnoteDefinitionIndent`&&i[2].sliceSerialize(i[1],!0).length===4?t(e):n(e)}}function $V(e){let t=(e||{}).singleTilde,n={name:`strikethrough`,tokenize:i,resolveAll:r};return t??=!0,{text:{126:n},insideSpan:{null:[n]},attentionMarkers:{null:[126]}};function r(e,t){let n=-1;for(;++n<e.length;)if(e[n][0]===`enter`&&e[n][1].type===`strikethroughSequenceTemporary`&&e[n][1]._close){let r=n;for(;r--;)if(e[r][0]===`exit`&&e[r][1].type===`strikethroughSequenceTemporary`&&e[r][1]._open&&e[n][1].end.offset-e[n][1].start.offset===e[r][1].end.offset-e[r][1].start.offset){e[n][1].type=`strikethroughSequence`,e[r][1].type=`strikethroughSequence`;let i={type:`strikethrough`,start:Object.assign({},e[r][1].start),end:Object.assign({},e[n][1].end)},a={type:`strikethroughText`,start:Object.assign({},e[r][1].end),end:Object.assign({},e[n][1].start)},o=[[`enter`,i,t],[`enter`,e[r][1],t],[`exit`,e[r][1],t],[`enter`,a,t]],s=t.parser.constructs.insideSpan.null;s&&hP(o,o.length,0,WP(s,e.slice(r+1,n),t)),hP(o,o.length,0,[[`exit`,a,t],[`enter`,e[n][1],t],[`exit`,e[n][1],t],[`exit`,i,t]]),hP(e,r-1,n-r+3,o),n=r+o.length-2;break}}for(n=-1;++n<e.length;)e[n][1].type===`strikethroughSequenceTemporary`&&(e[n][1].type=`data`);return e}function i(e,n,r){let i=this.previous,a=this.events,o=0;return s;function s(t){return i===126&&a[a.length-1][1].type!==`characterEscape`?r(t):(e.enter(`strikethroughSequenceTemporary`),c(t))}function c(a){let s=UP(i);if(a===126)return o>1?r(a):(e.consume(a),o++,c);if(o<2&&!t)return r(a);let l=e.exit(`strikethroughSequenceTemporary`),u=UP(a);return l._open=!u||u===2&&!!s,l._close=!s||s===2&&!!u,n(a)}}}var eH=class{constructor(){this.map=[]}add(e,t,n){tH(this,e,t,n)}consume(e){if(this.map.sort(function(e,t){return e[0]-t[0]}),this.map.length===0)return;let t=this.map.length,n=[];for(;t>0;)--t,n.push(e.slice(this.map[t][0]+this.map[t][1]),this.map[t][2]),e.length=this.map[t][0];n.push(e.slice()),e.length=0;let r=n.pop();for(;r;){for(let t of r)e.push(t);r=n.pop()}this.map.length=0}};function tH(e,t,n,r){let i=0;if(n!==0||r.length!==0){for(;i<e.map.length;){if(e.map[i][0]===t){e.map[i][1]+=n,e.map[i][2].push(...r);return}i+=1}e.map.push([t,n,r])}}function nH(e,t){let n=!1,r=[];for(;t<e.length;){let i=e[t];if(n){if(i[0]===`enter`)i[1].type===`tableContent`&&r.push(e[t+1][1].type===`tableDelimiterMarker`?`left`:`none`);else if(i[1].type===`tableContent`){if(e[t-1][1].type===`tableDelimiterMarker`){let e=r.length-1;r[e]=r[e]===`left`?`center`:`right`}}else if(i[1].type===`tableDelimiterRow`)break}else i[0]===`enter`&&i[1].type===`tableDelimiterRow`&&(n=!0);t+=1}return r}function rH(){return{flow:{null:{name:`table`,tokenize:iH,resolveAll:aH}}}}function iH(e,t,n){let r=this,i=0,a=0,o;return s;function s(e){let t=r.events.length-1;for(;t>-1;){let e=r.events[t][1].type;if(e===`lineEnding`||e===`linePrefix`)t--;else break}let i=t>-1?r.events[t][1].type:null,a=i===`tableHead`||i===`tableRow`?S:c;return a===S&&r.parser.lazy[r.now().line]?n(e):a(e)}function c(t){return e.enter(`tableHead`),e.enter(`tableRow`),l(t)}function l(e){return e===124?u(e):(o=!0,a+=1,u(e))}function u(t){return t===null?n(t):$(t)?a>1?(a=0,r.interrupt=!0,e.exit(`tableRow`),e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),p):n(t):jP(t)?IP(e,u,`whitespace`)(t):(a+=1,o&&(o=!1,i+=1),t===124?(e.enter(`tableCellDivider`),e.consume(t),e.exit(`tableCellDivider`),o=!0,u):(e.enter(`data`),d(t)))}function d(t){return t===null||t===124||AP(t)?(e.exit(`data`),u(t)):(e.consume(t),t===92?f:d)}function f(t){return t===92||t===124?(e.consume(t),d):d(t)}function p(t){return r.interrupt=!1,r.parser.lazy[r.now().line]?n(t):(e.enter(`tableDelimiterRow`),o=!1,jP(t)?IP(e,m,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):m(t))}function m(t){return t===45||t===58?g(t):t===124?(o=!0,e.enter(`tableCellDivider`),e.consume(t),e.exit(`tableCellDivider`),h):x(t)}function h(t){return jP(t)?IP(e,g,`whitespace`)(t):g(t)}function g(t){return t===58?(a+=1,o=!0,e.enter(`tableDelimiterMarker`),e.consume(t),e.exit(`tableDelimiterMarker`),_):t===45?(a+=1,_(t)):t===null||$(t)?b(t):x(t)}function _(t){return t===45?(e.enter(`tableDelimiterFiller`),v(t)):x(t)}function v(t){return t===45?(e.consume(t),v):t===58?(o=!0,e.exit(`tableDelimiterFiller`),e.enter(`tableDelimiterMarker`),e.consume(t),e.exit(`tableDelimiterMarker`),y):(e.exit(`tableDelimiterFiller`),y(t))}function y(t){return jP(t)?IP(e,b,`whitespace`)(t):b(t)}function b(n){return n===124?m(n):n===null||$(n)?!o||i!==a?x(n):(e.exit(`tableDelimiterRow`),e.exit(`tableHead`),t(n)):x(n)}function x(e){return n(e)}function S(t){return e.enter(`tableRow`),C(t)}function C(n){return n===124?(e.enter(`tableCellDivider`),e.consume(n),e.exit(`tableCellDivider`),C):n===null||$(n)?(e.exit(`tableRow`),t(n)):jP(n)?IP(e,C,`whitespace`)(n):(e.enter(`data`),w(n))}function w(t){return t===null||t===124||AP(t)?(e.exit(`data`),C(t)):(e.consume(t),t===92?T:w)}function T(t){return t===92||t===124?(e.consume(t),w):w(t)}}function aH(e,t){let n=-1,r=!0,i=0,a=[0,0,0,0],o=[0,0,0,0],s=!1,c=0,l,u,d,f=new eH;for(;++n<e.length;){let p=e[n],m=p[1];p[0]===`enter`?m.type===`tableHead`?(s=!1,c!==0&&(sH(f,t,c,l,u),u=void 0,c=0),l={type:`table`,start:Object.assign({},m.start),end:Object.assign({},m.end)},f.add(n,0,[[`enter`,l,t]])):m.type===`tableRow`||m.type===`tableDelimiterRow`?(r=!0,d=void 0,a=[0,0,0,0],o=[0,n+1,0,0],s&&(s=!1,u={type:`tableBody`,start:Object.assign({},m.start),end:Object.assign({},m.end)},f.add(n,0,[[`enter`,u,t]])),i=m.type===`tableDelimiterRow`?2:u?3:1):i&&(m.type===`data`||m.type===`tableDelimiterMarker`||m.type===`tableDelimiterFiller`)?(r=!1,o[2]===0&&(a[1]!==0&&(o[0]=o[1],d=oH(f,t,a,i,void 0,d),a=[0,0,0,0]),o[2]=n)):m.type===`tableCellDivider`&&(r?r=!1:(a[1]!==0&&(o[0]=o[1],d=oH(f,t,a,i,void 0,d)),a=o,o=[a[1],n,0,0])):m.type===`tableHead`?(s=!0,c=n):m.type===`tableRow`||m.type===`tableDelimiterRow`?(c=n,a[1]===0?o[1]!==0&&(d=oH(f,t,o,i,n,d)):(o[0]=o[1],d=oH(f,t,a,i,n,d)),i=0):i&&(m.type===`data`||m.type===`tableDelimiterMarker`||m.type===`tableDelimiterFiller`)&&(o[3]=n)}for(c!==0&&sH(f,t,c,l,u),f.consume(t.events),n=-1;++n<t.events.length;){let e=t.events[n];e[0]===`enter`&&e[1].type===`table`&&(e[1]._align=nH(t.events,n))}return e}function oH(e,t,n,r,i,a){let o=r===1?`tableHeader`:r===2?`tableDelimiter`:`tableData`;n[0]!==0&&(a.end=Object.assign({},cH(t.events,n[0])),e.add(n[0],0,[[`exit`,a,t]]));let s=cH(t.events,n[1]);if(a={type:o,start:Object.assign({},s),end:Object.assign({},s)},e.add(n[1],0,[[`enter`,a,t]]),n[2]!==0){let i=cH(t.events,n[2]),a=cH(t.events,n[3]),o={type:`tableContent`,start:Object.assign({},i),end:Object.assign({},a)};if(e.add(n[2],0,[[`enter`,o,t]]),r!==2){let r=t.events[n[2]],i=t.events[n[3]];if(r[1].end=Object.assign({},i[1].end),r[1].type=`chunkText`,r[1].contentType=`text`,n[3]>n[2]+1){let t=n[2]+1,r=n[3]-n[2]-1;e.add(t,r,[])}}e.add(n[3]+1,0,[[`exit`,o,t]])}return i!==void 0&&(a.end=Object.assign({},cH(t.events,i)),e.add(i,0,[[`exit`,a,t]]),a=void 0),a}function sH(e,t,n,r,i){let a=[],o=cH(t.events,n);i&&(i.end=Object.assign({},o),a.push([`exit`,i,t])),r.end=Object.assign({},o),a.push([`exit`,r,t]),e.add(n+1,0,a)}function cH(e,t){let n=e[t],r=n[0]===`enter`?`start`:`end`;return n[1][r]}var lH={name:`tasklistCheck`,tokenize:dH};function uH(){return{text:{91:lH}}}function dH(e,t,n){let r=this;return i;function i(t){return r.previous!==null||!r._gfmTasklistFirstContentOfListItem?n(t):(e.enter(`taskListCheck`),e.enter(`taskListCheckMarker`),e.consume(t),e.exit(`taskListCheckMarker`),a)}function a(t){return AP(t)?(e.enter(`taskListCheckValueUnchecked`),e.consume(t),e.exit(`taskListCheckValueUnchecked`),o):t===88||t===120?(e.enter(`taskListCheckValueChecked`),e.consume(t),e.exit(`taskListCheckValueChecked`),o):n(t)}function o(t){return t===93?(e.enter(`taskListCheckMarker`),e.consume(t),e.exit(`taskListCheckMarker`),e.exit(`taskListCheck`),s):n(t)}function s(r){return $(r)?t(r):jP(r)?e.check({tokenize:fH},t,n)(r):n(r)}}function fH(e,t,n){return IP(e,r,`whitespace`);function r(e){return e===null?n(e):t(e)}}function pH(e){return vP([kV(),GV(),$V(e),rH(),uH()])}var mH={};function hH(e){let t=this,n=e||mH,r=t.data(),i=r.micromarkExtensions||=[],a=r.fromMarkdownExtensions||=[],o=r.toMarkdownExtensions||=[];i.push(pH(n)),a.push(vV()),o.push(yV(n))}var gH=/\.(png|jpe?g|gif|webp|avif|bmp|svg)$/i;function _H(e){return!!e&&e.startsWith(`image/`)}function vH(e){return e?gH.test(e.split(`?`)[0]??``):!1}function yH(e){return _H(e.type)||vH(e.name)}function bH(e){return new Promise((t,n)=>{let r=new FileReader;r.onerror=()=>n(Error(`could not read ${e.name}`)),r.onload=()=>{let i=String(r.result??``);if(!i.startsWith(`data:`)){n(Error(`unexpected read result for ${e.name}`));return}t({id:`att_${Date.now()}_${Math.random().toString(36).slice(2,8)}`,name:e.name||`image`,mime:e.type||CH(e.name)||`application/octet-stream`,uri:i})},r.readAsDataURL(e)})}async function xH(e){let t=[];for(let n of Array.from(e))if(yH(n))try{t.push(await bH(n))}catch{}return t}function SH(e){return{uri:e.uri,name:e.name}}function CH(e){switch((e.split(`.`).pop()??``).toLowerCase()){case`png`:return`image/png`;case`jpg`:case`jpeg`:return`image/jpeg`;case`gif`:return`image/gif`;case`webp`:return`image/webp`;case`avif`:return`image/avif`;case`bmp`:return`image/bmp`;case`svg`:return`image/svg+xml`;default:return}}function wH(e){if(!_H(e.mime)&&!vH(e.name))return null;if(e.data)return`data:${e.mime};base64,${e.data}`;if(e.source?.type===`uri`){let t=e.source.uri;if(/^(https?:|blob:|data:image\/)/i.test(t))return t}return null}function TH(e){if(!_H(e.mime)&&!vH(e.name)||e.data)return null;if(e.source?.type===`uri`){let t=e.source.uri;if(/^file:\/\//i.test(t))try{return decodeURIComponent(new URL(t).pathname)}catch{return null}if(/^\//.test(t)||vH(t))return t}return null}function EH(e){let t=new Uint8Array(e),n=32768,r=``;for(let e=0;e<t.length;e+=n)r+=String.fromCharCode(...t.subarray(e,e+n));return btoa(r)}function DH(e){let t=e.variant&&e.variant!=="default"?e.variant:`default`;return`${e.providerID}/${e.id}@${t}`}var OH=Cm(`group/marker relative flex min-h-4 w-full items-center gap-2 text-left text-sm text-muted-foreground [&_svg:not([class*='size-'])]:size-4 [a]:underline [a]:underline-offset-3 [a]:hover:text-foreground`,{variants:{variant:{default:``,separator:`before:mr-1 before:h-px before:min-w-0 before:flex-1 before:bg-border after:ml-1 after:h-px after:min-w-0 after:flex-1 after:bg-border`,border:`border-b border-border pb-2`}}});function kH({className:e,variant:t=`default`,asChild:n=!1,...r}){let i=n?mr:`div`;return(0,L.jsx)(i,{"data-slot":`marker`,"data-variant":t,className:B(OH({variant:t,className:e})),...r})}function AH({className:e,...t}){return(0,L.jsx)(`span`,{"data-slot":`marker-content`,className:B(`min-w-0 wrap-break-word group-data-[variant=separator]/marker:flex-none group-data-[variant=separator]/marker:text-center *:[a]:underline *:[a]:underline-offset-3 *:[a]:hover:text-foreground`,e),...t})}function jH(){let[e,t]=(0,w.useState)(oh().showTimestamps);return(0,w.useEffect)(()=>ch(()=>t(oh().showTimestamps)),[]),e}function MH(){let[e,t]=(0,w.useState)(0);return(0,w.useEffect)(()=>mt(()=>t(e=>e+1)),[]),e}var NH=0,PH=new Set,FH=!1;function IH(){FH||(FH=!0,mt(()=>{NH++;for(let e of PH)e()}))}function LH(e){return IH(),PH.add(e),()=>PH.delete(e)}function RH(){return NH}function zH(){return 0}function BH(){return(0,w.useSyncExternalStore)(LH,RH,zH)}function VH({message:e,sessionID:t,children:n}){let r=BH(),i=(0,w.useMemo)(()=>Tt(`contextMenu.message`),[r]),a=e.type===`user`&&!e.id.startsWith(`msg_local_`),o=a&&!!t&&t!==`__draft__`;if(i.length===0&&!o)return(0,L.jsx)(L.Fragment,{children:n});let s=e.id,c=a?e.text:``;return(0,L.jsxs)(zk,{children:[(0,L.jsx)(Bk,{asChild:!0,children:(0,L.jsx)(`div`,{children:n})}),(0,L.jsxs)(Vk,{className:`min-w-40`,children:[o&&(0,L.jsxs)(L.Fragment,{children:[(0,L.jsxs)(Hk,{onSelect:()=>{Jy(t,s,c).catch(e=>fk({title:`Edit failed`,description:e instanceof Error?e.message:String(e),variant:`destructive`}))},children:[(0,L.jsx)(ze,{className:`size-3.5`}),` Edit`]}),(0,L.jsxs)(Hk,{onSelect:()=>{Yy(t,s).catch(e=>fk({title:`Fork failed`,description:e instanceof Error?e.message:String(e),variant:`destructive`}))},children:[(0,L.jsx)(De,{className:`size-3.5`}),` Fork`]}),i.length>0&&(0,L.jsx)(Uk,{})]}),i.map(e=>(0,L.jsx)(Hk,{onSelect:()=>{try{e.item.run({messageID:s})}catch(t){console.error(`[extensions] contextMenu "${e.id}" crashed:`,t)}},children:e.item.label},e.id))]})]})}function HH({message:e,part:t,partIndex:n}){let r=BH(),i=(0,w.useMemo)(()=>Tt(`message.part`),[r]);if(i.length===0)return null;let a=[];for(let r=0;r<i.length;r++){let o=i[r],s=null;try{s=o.item.render({messageID:e.id,message:e,part:t,partIndex:n})}catch(e){console.error(`[extensions] message.part "${o.id??r}" crashed:`,e)}s!=null&&a.push((0,L.jsx)(w.Fragment,{children:s},o.id??r))}return a.length===0?null:(0,L.jsx)(`div`,{className:`mt-1 flex flex-wrap items-center gap-1 text-xs text-[var(--text-weak)]`,children:a})}function UH(e){return new Date(e).toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`})}async function WH(e){try{return await navigator.clipboard.writeText(e),!0}catch{}try{let t=document.createElement(`textarea`);t.value=e,t.style.position=`fixed`,t.style.opacity=`0`,document.body.appendChild(t),t.focus(),t.select();let n=document.execCommand(`copy`);return t.remove(),n}catch{return!1}}function GH(e){return e.content.filter(e=>e.type===`text`&&typeof e.text==`string`&&e.text.trim()!==``).map(e=>e.text).join(`
|
|
102
|
-
|
|
103
|
-
`)}function KH({text:e}){let[t,n]=(0,w.useState)(!1);return e?(0,L.jsx)(`button`,{type:`button`,onClick:t=>{t.stopPropagation(),WH(e).then(e=>{if(!e){fk({title:`Copy failed`,variant:`destructive`});return}n(!0),setTimeout(()=>n(!1),1400)})},title:t?`Copied`:`Copy message`,className:`flex size-7 cursor-pointer items-center justify-center rounded-md border border-[var(--border-weak-base)] bg-[var(--surface-float-base)] text-[var(--text-weak)] shadow-sm transition-colors hover:text-[var(--text-strong)]`,children:t?(0,L.jsx)(ie,{className:`size-3.5 text-[var(--text-on-success-base)]`}):(0,L.jsx)(le,{className:`size-3.5`})}):null}function qH({text:e}){let[t,n]=(0,w.useState)(!1);return e?(0,L.jsxs)(`button`,{type:`button`,onClick:t=>{t.stopPropagation(),WH(e).then(e=>{if(!e){fk({title:`Copy failed`,variant:`destructive`});return}n(!0),setTimeout(()=>n(!1),1400)})},title:t?`Copied`:`Copy response`,className:`inline-flex cursor-pointer items-center gap-1 rounded-md border border-[var(--border-weak-base)] bg-[var(--surface-float-base)] px-1.5 py-1 text-xs text-[var(--text-weaker)] shadow-sm transition-colors hover:text-[var(--text-strong)] opacity-0 group-hover:opacity-100 focus:opacity-100 focus-visible:opacity-100`,children:[t?(0,L.jsx)(ie,{className:`size-3`}):(0,L.jsx)(le,{className:`size-3`}),t?`Copied`:`Copy`]}):null}function JH({message:e,compact:t=!1,sessionID:n,isTail:r=!1,responseText:i}){let a=MH(),o=(0,w.useMemo)(()=>Tt(`message.decoration`),[a]),s=e,c=(0,w.useMemo)(()=>Ot(`message.render`),[a]);if(c.length>0){let t={message:{...e},sessionID:n};for(let e of c)try{let n=e.handler(t,()=>{});n instanceof Promise&&n.catch(t=>console.error(`[extensions] hook "${e.id}" failed:`,t))}catch(t){console.error(`[extensions] hook "${e.id}" crashed:`,t)}s=t.message}let l=(0,w.useMemo)(()=>{for(let e of[`message:${s.type}`,`message:*`]){let t=yt(e);if(t.replaces.length>0||t.wraps.length>0)return e}return null},[a,s.type,s.id]),u=()=>YH(s,t,n,r,i),d;return d=l?Ct(l,{message:s,sessionID:n})??u():u(),(0,L.jsx)(VH,{message:s,sessionID:n,children:(0,L.jsx)(`div`,{"data-oc-message":!0,"data-oc-message-id":s.id,"data-oc-message-type":s.type,children:(0,L.jsxs)(L.Fragment,{children:[d,o.length>0&&(0,L.jsx)(`div`,{className:`mt-1 flex flex-wrap items-center gap-1`,children:o.map((e,t)=>{let n=null;try{n=e.item.render({messageID:s.id,message:s})}catch(n){console.error(`[extensions] message decoration "${e.id??t}" crashed:`,n)}return n==null?null:(0,L.jsx)(w.Fragment,{children:n},e.id??t)})})]})})})}function YH(e,t,n,r,i){switch(e.type){case`user`:{let t=!!n&&!e.id.startsWith(`msg_local_`)&&!e.id.startsWith(`__draft__`);return(0,L.jsx)(`div`,{className:`group flex w-full justify-end mb-3.5`,children:(0,L.jsxs)(`div`,{className:`relative max-w-[92%] min-w-0 rounded-lg px-3 py-2 sm:max-w-[85%]`,children:[t&&(0,L.jsxs)(`div`,{className:`absolute top-1/2 right-full mr-3 hidden -translate-y-1/2 items-center gap-1.5 group-hover:flex`,children:[(0,L.jsx)(wt,{id:`message.copyButton`,text:e.text??``,variant:`user`}),(0,L.jsx)(`button`,{type:`button`,onClick:()=>{n&&Gh(async()=>{let{startEditAtMessage:e}=await Promise.resolve().then(()=>Kh);return{startEditAtMessage:e}},void 0).then(({startEditAtMessage:t})=>t(n,e.id,e.text??``))},title:`Edit from here`,className:`flex size-7 cursor-pointer items-center justify-center rounded-md border border-[var(--border-weak-base)] bg-[var(--surface-float-base)] text-[var(--text-weak)] shadow-sm hover:text-[var(--text-strong)]`,children:(0,L.jsx)(ze,{className:`size-3.5`})}),(0,L.jsx)(`button`,{type:`button`,onClick:()=>{n&&Gh(async()=>{let{forkAtMessage:e}=await Promise.resolve().then(()=>Kh);return{forkAtMessage:e}},void 0).then(({forkAtMessage:t})=>void t(n,e.id).catch(()=>{}))},title:`Fork from here`,className:`flex size-7 cursor-pointer items-center justify-center rounded-md border border-[var(--border-weak-base)] bg-[var(--surface-float-base)] text-[var(--text-weak)] shadow-sm hover:text-[var(--text-strong)]`,children:(0,L.jsx)(De,{className:`size-3.5`})})]}),(0,L.jsxs)(`div`,{className:`flex items-center justify-end gap-1.5 text-xs text-[var(--text-weak)]`,children:[(0,L.jsx)(wt,{id:`message.timestamp`,time:e.time.created}),(0,L.jsx)(at,{className:`size-3.5`}),`You`]}),e.files&&e.files.length>0&&(0,L.jsx)(QH,{files:e.files}),(0,L.jsx)(`div`,{className:`mt-1 text-sm leading-relaxed text-[var(--text-strong)] whitespace-pre-wrap break-words`,children:e.text})]})})}case`assistant`:{let n=e.time.completed!==void 0||e.finish!==void 0,a=!!r&&n,o=a?GH(e):``,s=a?i??o:``,c=s.trim().length>0;return(0,L.jsx)(cU,{message:e,compact:t,showCopy:a&&c,copyText:s})}case`system`:case`synthetic`:{let t=e.text??``,n=e.description,r=t.length>500||t.includes(`The Code Mode tool catalog has changed`),i=(n??``).startsWith(`Instructions updated`)||t.startsWith(`Instructions updated`);return(r||i)&&t.length>200?(0,L.jsx)(hU,{children:(0,L.jsx)(XH,{message:e})}):(0,L.jsx)(hU,{children:(0,L.jsxs)(`div`,{className:`w-full rounded-md border border-[var(--border-weak-base)] bg-[var(--surface-base)] px-3 py-2 text-xs text-[var(--text-weak)]`,children:[e.description??e.type,e.text&&(0,L.jsx)(`div`,{className:`mt-1 text-[var(--text-base)] whitespace-pre-wrap`,children:e.text})]})})}case`skill`:return(0,L.jsx)(hU,{children:(0,L.jsxs)(`div`,{className:`w-full rounded-md border border-[var(--border-weak-base)] bg-[var(--surface-interactive-weak)] px-3 py-2 text-xs text-[var(--text-interactive-base)]`,children:[`Activated skill `,(0,L.jsx)(`b`,{className:`font-medium text-[var(--text-strong)]`,children:e.name}),e.text&&(0,L.jsx)(`div`,{className:`mt-0.5 whitespace-pre-wrap text-[var(--text-weaker)]`,children:e.text})]})});case`shell`:return(0,L.jsx)(hU,{children:(0,L.jsx)(oU,{message:e})});case`agent-switched`:return(0,L.jsxs)(ZH,{children:[`Agent switched to `,(0,L.jsx)(`b`,{children:e.agent})]});case`model-switched`:return(0,L.jsxs)(ZH,{children:[`Model switched to `,(0,L.jsxs)(`b`,{children:[e.model.providerID,`/`,e.model.id]})]});case`location-switched`:return(0,L.jsxs)(ZH,{children:[`Moved to `,(0,L.jsx)(`b`,{children:e.location.directory})]});case`compaction`:{let t=e.status===`running`,n=e.status===`failed`,r=n?`Compaction failed`:t?`Compacting…`:`Conversation compacted`,i=e.reason===`auto`||e.reason===`manual`?` (${e.reason})`:``,a=e.summary,o=e.recent;return n?(0,L.jsxs)(ZH,{children:[r,i,e.error&&(0,L.jsxs)(`span`,{className:`text-[var(--text-on-critical-base)]`,children:[` — `,e.error.type,`: `,e.error.message]})]}):!a&&!o?(0,L.jsxs)(ZH,{children:[r,i]}):(0,L.jsx)(hU,{children:(0,L.jsx)(sU,{label:r,reason:i,summary:a,recent:o,running:t})})}default:return null}}function XH({message:e}){let[t,n]=(0,w.useState)(!1),r=e.description??e.text.split(`
|
|
104
|
-
`)[0]??`Instructions updated`,i=e.description?e.text:e.text.split(`
|
|
105
|
-
`).slice(1).join(`
|
|
106
|
-
`).trim(),a=i.length>0;return(0,L.jsxs)(`div`,{className:`w-full overflow-hidden rounded-md border border-[var(--border-weak-base)] bg-[var(--surface-base)]`,children:[(0,L.jsxs)(`button`,{type:`button`,onClick:()=>a&&n(e=>!e),className:`flex w-full items-center gap-1.5 px-3 py-1.5 text-left text-xs ${a?`cursor-pointer hover:bg-[color:var(--surface-base-hover)]`:``}`,children:[(0,L.jsx)(`span`,{className:`flex-1 truncate text-[var(--text-weak)]`,children:(0,L.jsx)(`b`,{className:`font-medium text-[var(--text-base)]`,children:r})}),a&&(0,L.jsx)(F,{className:`size-3 shrink-0 text-[var(--text-weaker)] transition-transform ${t?`rotate-90`:``}`})]}),a&&t&&(0,L.jsx)(`pre`,{className:`max-h-64 overflow-auto whitespace-pre-wrap border-t border-[var(--border-weak-base)] bg-[var(--surface-inset-base)] px-3 py-2 font-mono text-[11px] leading-relaxed text-[var(--text-weak)]`,children:i})]})}function ZH({children:e}){return(0,L.jsx)(hU,{children:(0,L.jsx)(kH,{variant:`separator`,children:(0,L.jsx)(AH,{className:`text-xs text-[var(--text-weak)] [&_b]:text-[var(--text-base)]`,children:e})})})}function QH({files:e}){return(0,L.jsx)(`div`,{className:`mt-1.5 flex flex-wrap justify-end gap-1.5`,children:e.map((e,t)=>(0,L.jsx)($H,{file:e},`${e.name??`file`}:${t}`))})}function $H({file:e}){let t=wH(e),n=t?null:TH(e);return!t&&!n?(0,L.jsx)(nU,{name:e.name,mime:e.mime}):t?(0,L.jsx)(eU,{src:t,name:e.name,alt:e.name??`attached image`}):(0,L.jsx)(tU,{filePath:n,name:e.name})}function eU({src:e,name:t,alt:n}){let[r,i]=(0,w.useState)(!1);return(0,L.jsx)(`button`,{type:`button`,onClick:()=>i(e=>!e),title:r?`${t??`image`} — click to shrink`:`${t??`image`} — click to enlarge`,className:`block cursor-pointer ${r?``:`cursor-zoom-in`}`,children:(0,L.jsx)(`img`,{src:e,alt:n??t??`image`,draggable:!1,className:`rounded-md border border-[color:var(--border-weak-base)] bg-[var(--surface-inset-base)] object-contain ${r?`max-h-[70vh] max-w-full`:`max-h-48 max-w-[16rem]`}`})})}function tU({filePath:e,name:t}){let n=J(e=>e.sessions.find(t=>t.id===e.currentSessionID)?.location?.directory),[r,i]=(0,w.useState)(null),[a,o]=(0,w.useState)(!1);return(0,w.useEffect)(()=>{let t=!1,r=null;return(async()=>{for(let a of[void 0,n]){if(t)return;try{let n=await W.fsReadBytes(e,a);if(t)return;r=URL.createObjectURL(new Blob([n])),i(r);return}catch{}}t||o(!0)})(),()=>{t=!0,r&&URL.revokeObjectURL(r)}},[e,n]),a||!r?(0,L.jsx)(nU,{name:t}):(0,L.jsx)(eU,{src:r,name:t,alt:t??`attached image`})}function nU({name:e,mime:t}){return(0,L.jsxs)(`span`,{title:t,className:`inline-flex max-w-full items-center gap-1.5 rounded-md border border-[color:var(--border-weak-base)] bg-[var(--surface-inset-base)] px-2 py-1 text-xs text-[var(--text-weak)]`,children:[(0,L.jsx)(Re,{className:`size-3 shrink-0`}),(0,L.jsx)(`span`,{className:`truncate`,children:e??`file`}),t&&(0,L.jsx)(`span`,{className:`shrink-0 font-mono text-[10px] text-[var(--text-weaker)]`,children:t})]})}function rU({time:e}){if(!jH())return null;let t=Et(`format.timestamp`)??UH;return(0,L.jsx)(`span`,{className:`font-mono text-[var(--text-weaker)]`,children:t(e)})}function iU({cost:e}){return(0,L.jsxs)(`span`,{className:`font-mono text-[var(--text-weaker)]`,children:[`$`,e.toFixed(4)]})}function aU({tokens:e}){let t=e.input+e.cache.read+e.cache.write,n=e.output+e.reasoning;if(t===0&&n===0)return null;let r=e=>e>=1e3?`${(e/1e3).toFixed(1)}k`:String(e);return(0,L.jsxs)(`span`,{className:`font-mono text-[10px] text-[var(--text-weaker)]`,title:`${t.toLocaleString()} in · ${n.toLocaleString()} out`,children:[r(t),` in / `,r(n),` out`]})}function oU({message:e}){let{command:t,status:n,exit:r,output:i}=e,a=n===`exited`&&r!==0||n===`timeout`||n===`killed`,o=n===`running`,s=i?.output??``,c=s.length>0,[l,u]=(0,w.useState)(!1),d=o?``:a?`text-[var(--text-on-critical-base)]`:`text-[var(--text-on-success-base)]`,f=c&&s.split(`
|
|
107
|
-
`).length>10,p=l||!f,m=p?s:s.split(`
|
|
108
|
-
`).slice(0,10).join(`
|
|
109
|
-
`),h=i?.truncated;return(0,L.jsxs)(`div`,{className:`w-full max-w-full overflow-hidden rounded-lg border border-[var(--border-weak-base)] bg-[var(--background-strong)] sm:max-w-[85%]`,children:[(0,L.jsxs)(`button`,{type:`button`,onClick:()=>u(e=>!e),title:l?`Click to collapse`:t,className:`flex w-full items-center justify-between gap-2 bg-[var(--surface-base)] px-2.5 py-1.5 text-left font-mono text-xs text-[var(--text-weak)] transition-colors hover:bg-[color:var(--surface-base-hover)] hover:text-[var(--text-strong)]`,children:[(0,L.jsxs)(`span`,{className:`min-w-0 flex-1 ${l?`whitespace-pre-wrap break-all`:`truncate`}`,children:[(0,L.jsx)(`span`,{className:`text-[var(--text-weaker)]`,children:`$`}),` `,t]}),(0,L.jsxs)(`span`,{className:`flex shrink-0 items-center gap-1.5`,children:[a&&typeof r==`number`&&(0,L.jsxs)(`span`,{className:`rounded-sm bg-[color-mix(in_oklch,var(--surface-critical-strong)_12%,transparent)] px-1 py-px text-[10px] text-[color:var(--surface-critical-strong)]`,children:[`exit `,r]}),(0,L.jsxs)(`span`,{className:`inline-flex items-center gap-1 ${d}`,title:n===`timeout`?`Command timed out`:n===`killed`?`Command was killed`:void 0,children:[o&&(0,L.jsx)(pb,{className:`size-3`}),n]}),(0,L.jsx)(F,{className:`size-3 shrink-0 text-[var(--text-weaker)] transition-transform ${l?`rotate-90`:``}`})]})]}),o&&!c&&(0,L.jsx)(`div`,{className:`px-2.5 py-2 font-mono text-xs text-[var(--text-weaker)]`,children:`Running…`}),c&&(0,L.jsx)(`div`,{className:`border-t border-[var(--border-weak-base)]`,children:(0,L.jsxs)(`pre`,{onClick:()=>f&&u(e=>!e),className:`max-h-64 overflow-auto whitespace-pre-wrap px-2.5 py-2 font-mono text-xs leading-relaxed text-[var(--text-base)] ${f?`cursor-pointer hover:bg-[color:var(--surface-base-hover)]`:``}`,title:f?l?`Click to collapse`:`Click to expand full output`:void 0,children:[m,!p&&f&&`
|
|
110
|
-
…`,h&&(0,L.jsx)(`span`,{className:`text-[var(--text-weaker)]`,children:` (truncated)`})]})}),!c&&!o&&(0,L.jsx)(`div`,{className:`border-t border-[var(--border-weak-base)] px-2.5 py-2 font-mono text-xs text-[var(--text-weaker)]`,children:`(no output)`})]})}function sU({label:e,reason:t,summary:n,recent:r,running:i}){let[a,o]=(0,w.useState)(!1),s=!!n&&n.length>400,c=!s||a?n:n?`${n.slice(0,400).trim()}…`:void 0;return(0,L.jsxs)(`div`,{className:`w-full max-w-full overflow-hidden rounded-lg border border-[var(--border-weak-base)] bg-[var(--background-strong)] sm:max-w-[85%]`,children:[(0,L.jsxs)(`button`,{type:`button`,onClick:()=>o(e=>!e),className:`flex w-full items-center gap-2 bg-[var(--surface-base)] px-2.5 py-1.5 text-left text-xs text-[var(--text-weak)] transition-colors hover:bg-[color:var(--surface-base-hover)]`,children:[(0,L.jsxs)(`span`,{className:`flex items-center gap-1.5 font-medium text-[var(--text-strong)]`,children:[i&&(0,L.jsx)(pb,{className:`size-3`}),e,(0,L.jsx)(`span`,{className:`font-normal text-[var(--text-weaker)]`,children:t})]}),s&&(0,L.jsx)(F,{className:`ml-auto size-3 shrink-0 text-[var(--text-weaker)] transition-transform ${a?`rotate-90`:``}`})]}),c&&(0,L.jsxs)(`div`,{className:`border-t border-[var(--border-weak-base)] px-2.5 py-2 text-xs leading-relaxed text-[var(--text-base)] whitespace-pre-wrap`,children:[c,s&&!a&&(0,L.jsx)(`button`,{type:`button`,onClick:()=>o(!0),className:`ml-1 cursor-pointer text-[var(--text-interactive-base)] hover:underline`,children:`show more`})]}),r&&(0,L.jsxs)(`div`,{className:`border-t border-[var(--border-weak-base)] bg-[var(--surface-inset-base)] px-2.5 py-2`,children:[(0,L.jsx)(`div`,{className:`mb-1 text-[10px] font-medium uppercase tracking-wide text-[var(--text-weaker)]`,children:`Recent context`}),(0,L.jsx)(`pre`,{className:`max-h-32 overflow-auto whitespace-pre-wrap font-mono text-[11px] leading-relaxed text-[var(--text-weak)]`,children:r})]})]})}function cU({message:e,compact:t,showCopy:n,copyText:r}){let i=jH();return(0,L.jsx)(hU,{align:`left`,children:(0,L.jsxs)(`div`,{className:`group w-full min-w-0 space-y-2.5 text-sm leading-relaxed`,children:[!t&&(0,L.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-2 gap-y-1 text-xs text-[var(--text-weak)]`,children:[(0,L.jsx)(`span`,{className:`font-medium text-[var(--text-strong)]`,children:e.agent??`assistant`}),e.model&&(0,L.jsx)(`span`,{className:`font-mono text-[var(--text-weaker)]`,children:DH(e.model)}),i&&(0,L.jsx)(wt,{id:`message.timestamp`,time:e.time.created}),e.cost!==void 0&&e.cost>0&&(0,L.jsx)(wt,{id:`message.cost`,cost:e.cost}),e.tokens&&(0,L.jsx)(wt,{id:`message.tokens`,tokens:e.tokens}),e.finish&&e.finish!==`stop`&&(0,L.jsx)(`span`,{className:`rounded-sm border border-[var(--border-weak-base)] px-1 py-px font-mono text-[10px] text-[var(--text-weak)]`,children:e.finish})]}),e.error&&(0,L.jsxs)(`div`,{className:`rounded-md border border-[color-mix(in_oklch,var(--surface-critical-strong)_40%,transparent)] bg-[var(--surface-critical-weak)] px-3 py-2 text-xs text-[var(--text-on-critical-strong)]`,children:[e.error.type,`: `,e.error.message]}),(()=>{let t={text:0,reasoning:0};return e.content.map((n,r)=>{let i=n.type===`tool`?`${e.id}:tool:${n.id}`:`${e.id}:${n.type}:${t[n.type]++}`;return(0,L.jsxs)(w.Fragment,{children:[(0,L.jsx)(lU,{stateKey:i,part:n,messageID:e.id,partIndex:r,message:e}),(0,L.jsx)(HH,{message:e,part:n,partIndex:r})]},i)})})(),n&&r&&(0,L.jsx)(`div`,{className:`flex justify-start pt-1`,children:(0,L.jsx)(wt,{id:`message.copyButton`,text:r,variant:`assistant`})})]})})}function lU({part:e,stateKey:t,messageID:n,partIndex:r,message:i}){return e.type===`reasoning`?(0,L.jsx)(fU,{text:e.text,stateKey:t}):e.type===`tool`?(0,L.jsx)(wt,{id:`tool.card`,part:e,stateKey:t}):!e.text||!e.text.trim()?null:(0,L.jsx)(wt,{id:`message.markdown`,text:e.text,messageID:n,partIndex:r,message:i})}var uU=new Map;function dU(e,t){for(uU.delete(e),uU.set(e,t);uU.size>2e3;){let e=uU.keys().next().value;if(!e)break;uU.delete(e)}}function fU({text:e,stateKey:t}){let[n,r]=(0,w.useState)(oh().showReasoning),[i,a]=(0,w.useState)(()=>t?uU.get(t)??null:null);(0,w.useEffect)(()=>ch(()=>{r(oh().showReasoning),a(null)}),[]);let o=i??n;return e?(0,L.jsxs)(`div`,{className:`overflow-hidden rounded-md border border-[var(--border-weak-base)] bg-[var(--surface-inset-base)]`,children:[(0,L.jsxs)(`button`,{type:`button`,onClick:()=>{let e=!o;a(e),t&&dU(t,e)},className:`flex w-full cursor-pointer items-center gap-1.5 px-2.5 py-1.5 text-left text-xs text-[var(--text-weak)] transition-colors hover:text-[var(--text-base)]`,children:[(0,L.jsx)(F,{className:`size-3 shrink-0 transition-transform ${o?`rotate-90`:``}`}),(0,L.jsx)(P,{className:`size-3.5 shrink-0`}),`Reasoning`]}),o&&(0,L.jsx)(`div`,{className:`border-t border-[var(--border-weak-base)] px-2.5 py-2 text-xs leading-relaxed text-[var(--text-weak)] italic whitespace-pre-wrap`,children:e})]}):null}function pU(e){let t=e.trim();return/^data:image\/[a-z0-9.+-]+;/i.test(t)?t:hz(e)}function mU({text:e}){return(0,L.jsx)(`div`,{className:`min-w-0 text-sm leading-relaxed break-words text-[var(--text-base)] [&_h1]:text-[var(--text-strong)] [&_h2]:text-[var(--text-strong)] [&_h3]:text-[var(--text-strong)] [&_strong]:text-[var(--text-strong)] [&_a]:text-[var(--text-interactive-base)] [&_a]:underline [&_a]:underline-offset-2 [&_a]:break-all [&_ul]:list-disc [&_ul]:pl-5 [&_ol]:list-decimal [&_ol]:pl-5 [&_blockquote]:border-l-2 [&_blockquote]:border-[var(--border-weak-base)] [&_blockquote]:pl-3 [&_blockquote]:text-[var(--text-weak)] [&_pre]:my-2 [&_pre]:max-w-full [&_pre]:overflow-x-auto [&_pre]:rounded-md [&_pre]:border [&_pre]:border-[var(--border-weak-base)] [&_pre]:bg-[var(--surface-inset-base)] [&_pre]:p-3 [&_pre]:font-mono [&_pre]:text-xs [&_pre]:text-[var(--text-base)] [&_code]:rounded [&_code]:bg-[var(--surface-base)] [&_code]:px-1 [&_code]:py-0.5 [&_code]:font-mono [&_code]:text-[0.85em] [&_code]:break-all [&_code]:text-[var(--text-base)] [&_pre_code]:bg-transparent [&_pre_code]:p-0 [&_pre_code]:break-normal [&_pre_code]:text-inherit [&_table]:block [&_table]:max-w-full [&_table]:overflow-x-auto [&_img]:max-h-96 [&_img]:max-w-full [&_img]:rounded-md [&_img]:border [&_img]:border-[color:var(--border-weak-base)]`,children:(0,L.jsx)(dz,{remarkPlugins:[hH],urlTransform:pU,children:e})})}function hU({align:e=`left`,children:t}){return(0,L.jsxs)(`div`,{className:`mb-3.5 flex w-full ${e===`right`?`justify-end`:`justify-start`}`,children:[t,e===`right`&&(0,L.jsx)(`span`,{className:`sr-only`,children:`user message`})]})}vt({"message.markdown":e=>(0,L.jsx)(mU,{text:e.text}),"message.timestamp":e=>(0,L.jsx)(rU,{time:e.time}),"message.tokens":e=>(0,L.jsx)(aU,{tokens:e.tokens}),"message.cost":e=>(0,L.jsx)(iU,{cost:e.cost}),"message.copyButton":e=>e.variant===`assistant`?(0,L.jsx)(qH,{text:e.text}):(0,L.jsx)(KH,{text:e.text})});var gU={permission:`var(--surface-critical-strong)`,question:`var(--text-interactive-base)`,form:`var(--surface-warning-strong)`},_U={permission:{icon:Qe,label:`Permission required`,hint:`esc rejects`},question:{icon:oe,label:`Question`,hint:`esc rejects`},form:{icon:se,label:`Form`,hint:`esc cancels`}},vU=`overflow-x-auto rounded-md border border-[var(--border-weak-base)] bg-[var(--surface-inset-base)] px-2.5 py-1.5 font-mono text-xs text-[var(--text-base)]`;function yU({sessionID:e}){let t=J(t=>rg(t).find(t=>t.req.sessionID===e)),n=J(t=>rg(t).filter(t=>t.req.sessionID===e).length-1);return t?(0,L.jsx)(bU,{item:t,behind:n},`${t.kind}:${t.req.id}`):null}function bU({item:e,behind:t}){let n=_U[e.kind],r=n.icon,i=gU[e.kind],a=(0,w.useRef)(null),o=J(t=>ig(t,e.req.sessionID));(0,w.useEffect)(()=>{let t=t=>{t.key===`Escape`&&(document.querySelector(`[role="dialog"]`)||(t.preventDefault(),t.stopPropagation(),Oy(e)))};return window.addEventListener(`keydown`,t,!0),()=>window.removeEventListener(`keydown`,t,!0)},[e]);let s=`${e.kind}:${e.req.id}`;return(0,w.useEffect)(()=>{G(`panel`,`show ${s}`);let e=requestAnimationFrame(()=>a.current?.focus({preventScroll:!0}));return()=>{cancelAnimationFrame(e),G(`panel`,`hide ${s}`)}},[s]),(0,L.jsx)(`div`,{className:`border-t border-[color:var(--border-weak-base)] px-3 pb-2 pt-2`,children:(0,L.jsx)(`div`,{className:`mx-auto max-w-3xl`,children:(0,L.jsxs)(`div`,{ref:a,tabIndex:-1,className:`max-h-72 overflow-y-auto border-l-2 bg-[color:var(--background-strong)] px-4 py-2 font-mono text-sm outline-none`,style:{borderLeftColor:i},children:[(0,L.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,L.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2`,children:[(0,L.jsxs)(`span`,{className:`flex shrink-0 items-center gap-1.5 font-medium ${e.kind===`permission`?`text-[color:var(--surface-critical-strong)]`:e.kind===`question`?`text-[color:var(--text-interactive-base)]`:`text-[color:var(--surface-warning-strong)]`}`,children:[(0,L.jsx)(r,{className:`size-3.5`,"aria-hidden":!0}),e.kind===`form`?e.req.title||`Form`:n.label]}),(0,L.jsx)(ub,{variant:`outline`,className:`max-w-52 truncate border-[var(--border-weak-base)] font-normal text-[var(--text-weak)]`,children:o})]}),(0,L.jsxs)(`button`,{type:`button`,onClick:()=>Oy(e),title:n.hint,className:`flex shrink-0 cursor-pointer items-center gap-1 font-mono text-xs text-[color:var(--text-weaker)] hover:text-[color:var(--text-weak)]`,children:[n.hint.replace(`esc `,``),(0,L.jsx)(ot,{className:`size-3.5`})]})]}),(0,L.jsxs)(`div`,{className:`pt-1.5`,children:[e.kind===`permission`&&(0,L.jsx)(xU,{req:e.req}),e.kind===`question`&&(0,L.jsx)(SU,{req:e.req}),e.kind===`form`&&(0,L.jsx)(CU,{req:e.req})]}),t>0&&(0,L.jsxs)(`p`,{className:`pt-1.5 text-xs text-[color:var(--text-weaker)]`,children:[`+`,t,` more queued in this session`]})]})})})}function xU({req:e}){return(0,L.jsxs)(L.Fragment,{children:[e.resources.length>0&&(0,L.jsx)(`div`,{className:`space-y-1 pb-1.5`,children:e.resources.map((e,t)=>(0,L.jsx)(`pre`,{className:vU,children:e},t))}),e.metadata&&Object.keys(e.metadata).length>0&&(0,L.jsx)(`pre`,{className:`max-h-40 overflow-auto rounded-md border border-[var(--border-weak-base)] bg-[var(--surface-inset-base)] p-2.5 mb-1.5 font-mono text-xs whitespace-pre-wrap text-[var(--text-weak)]`,children:JSON.stringify(e.metadata,null,2)}),(0,L.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,L.jsx)(`span`,{className:`font-sans text-xs text-[color:var(--text-weak)]`,children:e.source?(0,L.jsxs)(L.Fragment,{children:[`by tool `,(0,L.jsx)(`span`,{className:`font-mono`,children:e.source.id})]}):e.action||null}),(0,L.jsxs)(`div`,{className:`flex gap-1.5`,children:[(0,L.jsx)(H,{variant:`destructive`,size:`sm`,onClick:()=>void Cy(e.id,`reject`),children:`Reject`}),(0,L.jsx)(H,{variant:`secondary`,size:`sm`,onClick:()=>void Cy(e.id,`once`),children:`Once`}),(0,L.jsx)(H,{size:`sm`,onClick:()=>void Cy(e.id,`always`),children:`Always allow`})]})]})]})}function SU({req:e}){let t=e.questions.length,[n,r]=(0,w.useState)(()=>e.questions.map(()=>[])),[i,a]=(0,w.useState)(()=>e.questions.map(()=>``)),[o,s]=(0,w.useState)(0),[c,l]=(0,w.useState)(0),[u,d]=(0,w.useState)(!1),f=e=>e.value??e.label,p=e.questions[Math.min(o,t-1)],m=o>=t-1,h=t=>{let r=e.questions[t];return n[t].length>0||r.custom&&i[t].trim().length>0},g=t=>e.questions.map((e,r)=>{let a=t&&t.qi===r?t.picked:n[r],o=i[r].trim();return e.multiple?[...a,...o?[o]:[]]:t?.explicit&&t.qi===r?a.slice(0,1):o?[o]:a.slice(0,1)}),_=t=>{d(!1),Ey(e.id,t).then(e=>{e||d(!0)})},v=(e,n)=>{e>=t?_(g(n)):(d(!1),s(e),l(t=>Math.max(t,e)))},y=(e,t,i)=>{if(d(!1),t.multiple){r(t=>t.map((t,n)=>n===e?t.includes(i)?t.filter(e=>e!==i):[...t,i]:t));return}let a=n[e].includes(i)?[]:[i];r(t=>t.map((t,n)=>n===e?a:t)),v(e+1,{qi:e,picked:a,explicit:!0})},b=(0,w.useRef)(()=>{});return b.current=()=>{m?e.questions.every((e,t)=>h(t))?_(g()):d(!1):h(o)&&v(o+1)},(0,w.useEffect)(()=>{let e=e=>{e.key!==`Enter`||!(e.ctrlKey||e.metaKey)||(e.preventDefault(),e.stopPropagation(),b.current())};return window.addEventListener(`keydown`,e,!0),()=>window.removeEventListener(`keydown`,e,!0)},[]),(0,L.jsxs)(L.Fragment,{children:[t>1&&(0,L.jsx)(`div`,{className:`flex flex-wrap items-center gap-1 pb-1.5`,children:e.questions.map((e,t)=>(0,L.jsxs)(`button`,{type:`button`,disabled:t>c,onClick:()=>t<=c&&(s(t),d(!1)),title:e.question||e.header,className:`max-w-40 cursor-pointer truncate rounded px-1.5 py-0.5 font-mono text-xs transition-colors ${t===o?`bg-[color:var(--surface-inset-strong,var(--surface-inset-base))] text-[color:var(--text-strong)] outline outline-1 outline-[var(--border-selected,var(--border-weak-base))]`:t<c||t===c&&t!==o?`text-[color:var(--text-weak)] hover:bg-[color:var(--surface-base-hover)] hover:text-[color:var(--text-strong)]`:`cursor-default text-[color:var(--text-weaker)] opacity-60`}`,children:[h(t)&&t!==o?`✓ `:``,e.header||`Q${t+1}`]},t))}),e.tool&&(0,L.jsxs)(`p`,{className:`pb-1.5 font-sans text-xs text-[color:var(--text-weak)]`,children:[`by tool `,(0,L.jsx)(`span`,{className:`font-mono`,children:e.tool.id})]}),(0,L.jsxs)(`div`,{children:[(0,L.jsxs)(`div`,{className:`flex items-baseline gap-2`,children:[p.header&&t>1&&(0,L.jsxs)(`span`,{className:`shrink-0 text-xs text-[color:var(--text-weaker)]`,children:[o+1,`/`,t]}),(0,L.jsx)(`span`,{className:`min-w-0 break-words text-sm text-[color:var(--text-strong)]`,children:p.question})]}),p.options.length>0&&(0,L.jsx)(`div`,{className:`flex flex-wrap gap-1 pt-1`,children:p.options.map(e=>{let t=f(e),r=n[o].includes(t);return(0,L.jsx)(H,{type:`button`,variant:r?`default`:`secondary`,size:`xs`,title:e.description,onClick:()=>y(o,p,t),children:e.label},t)})}),p.custom&&(0,L.jsx)(Im,{value:i[o],onChange:e=>{d(!1),a(t=>t.map((t,n)=>n===o?e.target.value:t))},placeholder:`Custom answer…`,className:`mt-1 min-h-12 font-mono text-xs`})]}),(0,L.jsxs)(`div`,{className:`flex items-center justify-end gap-1.5 pt-1.5`,children:[u&&(0,L.jsx)(`p`,{className:`mr-auto font-sans text-xs text-[color:var(--surface-critical-strong)]`,children:`answer rejected — request still open, adjust and retry`}),t>1&&o>0&&(0,L.jsx)(H,{variant:`ghost`,size:`sm`,onClick:()=>s(o-1),children:`Back`}),(0,L.jsx)(H,{variant:`destructive`,size:`sm`,onClick:()=>void Oy(x()),children:`Reject`}),m?(0,L.jsx)(H,{size:`sm`,disabled:!e.questions.every((e,t)=>h(t)),onClick:()=>_(g()),children:`Reply`}):(0,L.jsx)(H,{size:`sm`,disabled:!h(o),onClick:()=>v(o+1),children:`Next`})]})]});function x(){return{kind:`question`,req:e}}}function CU({req:e}){let t=e.fields,[n,r]=(0,w.useState)(()=>{let e={};for(let n of t)n.type!==`external`&&(n.default===void 0?n.type===`multiselect`?e[n.key]=[]:n.type===`boolean`?e[n.key]=!1:e[n.key]=``:e[n.key]=n.default);return e}),[i,a]=(0,w.useState)(!1),o=t.filter(e=>e.type!==`external`&&e.required===!0).every(e=>{let t=n[e.key];return e.type===`boolean`?!0:Array.isArray(t)?t.length>0:typeof t==`number`||typeof t==`string`&&t.trim().length>0});function s(e,t){r(n=>({...n,[e]:t}))}return(0,L.jsxs)(`form`,{onSubmit:t=>{t.preventDefault(),!(!o||i)&&(a(!0),wy(e.id,n).finally(()=>a(!1)))},children:[t.map(e=>(0,L.jsx)(`div`,{className:`pb-1.5`,children:(0,L.jsx)(wU,{field:e,value:n[e.key],onChange:t=>s(e.key,t)})},e.key)),(0,L.jsxs)(`div`,{className:`flex justify-end gap-1.5 pt-1`,children:[(0,L.jsx)(H,{type:`button`,variant:`ghost`,size:`sm`,onClick:()=>Oy({kind:`form`,req:e}),children:`Cancel`}),(0,L.jsx)(H,{type:`submit`,size:`sm`,disabled:!o||i,children:`Submit`})]})]})}function wU({field:e,value:t,onChange:n}){let r=`w-full rounded-md border border-[var(--border-weak-base)] bg-[var(--input-base)] px-2.5 py-1.5 font-mono text-xs text-[var(--text-strong)] outline-none transition-colors placeholder:text-[var(--text-weaker)] focus:border-[var(--border-selected)] focus:ring-1 focus:ring-[var(--border-selected)]`,i=(0,L.jsxs)(`label`,{className:`mb-1 block font-sans text-xs font-medium text-[var(--text-base)]`,children:[e.title??e.key,e.type!==`external`&&e.required&&(0,L.jsx)(`span`,{className:`text-[var(--surface-critical-strong)]`,children:` *`})]});switch(e.type){case`string`:return(0,L.jsxs)(`div`,{children:[i,e.options&&e.options.length>0?(0,L.jsxs)(`select`,{className:r,value:t??``,onChange:e=>n(e.target.value),children:[(0,L.jsx)(`option`,{value:``,children:`—`}),e.options.map(e=>(0,L.jsx)(`option`,{value:e.value,children:e.label},e.value))]}):(0,L.jsx)(`input`,{className:r,placeholder:e.placeholder,value:t??``,onChange:e=>n(e.target.value)})]});case`number`:case`integer`:return(0,L.jsxs)(`div`,{children:[i,(0,L.jsx)(`input`,{type:`number`,className:r,value:t??``,onChange:e=>n(e.target.value===``?0:Number(e.target.value))})]});case`boolean`:return(0,L.jsxs)(`label`,{className:`flex cursor-pointer items-center gap-2 font-sans text-sm text-[var(--text-base)]`,children:[(0,L.jsx)(`input`,{type:`checkbox`,className:`accent-[var(--text-interactive-base)]`,checked:!!t,onChange:e=>n(e.target.checked)}),e.title??e.key]});case`multiselect`:return(0,L.jsxs)(`div`,{children:[i,(0,L.jsx)(`div`,{className:`space-y-1`,children:e.options.map(e=>{let r=(t??[]).includes(e.value);return(0,L.jsxs)(`label`,{className:`flex cursor-pointer items-center gap-2 font-sans text-sm text-[var(--text-base)]`,children:[(0,L.jsx)(`input`,{type:`checkbox`,className:`accent-[var(--text-interactive-base)]`,checked:r,onChange:r=>{let i=t??[];n(r.target.checked?[...i,e.value]:i.filter(t=>t!==e.value))}}),e.label]},e.value)})})]});case`external`:return(0,L.jsxs)(`div`,{className:`rounded-md border border-[var(--border-weak-base)] bg-[var(--surface-base)] px-3 py-2 font-sans text-xs text-[var(--text-base)]`,children:[e.title??`External input`,`:`,` `,(0,L.jsx)(`a`,{className:`text-[var(--text-interactive-base)] underline`,href:e.url,target:`_blank`,rel:`noreferrer`,children:e.url})]});default:return null}}var TU=`flex size-6 shrink-0 cursor-pointer items-center justify-center rounded-md text-[var(--text-weaker)] transition-colors hover:bg-[color:var(--surface-base-hover)] hover:text-[var(--text-strong)] focus-visible:text-[var(--text-strong)] focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-[color:var(--border-selected)]`,EU=[{delivery:`steer`,caption:`⚡ steer · sent at the next step`,accent:`border-l-[color:var(--surface-warning-strong)]`},{delivery:`queue`,caption:`⏳ queue · sent after this turn`,accent:`border-l-[color:var(--text-interactive-base)]`}];function DU({sessionID:e}){let t=J(t=>t.pending[e]),n=J(t=>t.running[e]??!1);if(!t||t.length===0)return null;let r=t.filter(e=>(e.delivery??`steer`)===`steer`),i=t.filter(e=>e.delivery===`queue`);return r.length===0&&i.length===0?null:(0,L.jsx)(`div`,{className:`border-t border-[color:var(--border-weak-base)] px-3 pb-1 pt-1`,"data-oc-queue-strip":!0,children:(0,L.jsx)(`div`,{className:`mx-auto max-w-3xl overflow-hidden rounded-md border border-[color-mix(in_oklch,var(--border-base)_55%,transparent)] bg-[color-mix(in_oklch,var(--surface-base)_40%,transparent)]`,children:(0,L.jsx)(`div`,{className:`divide-y divide-[color:var(--border-weak-base)]`,children:EU.map(t=>{let a=t.delivery===`steer`?r:i;return a.length===0?null:(0,L.jsxs)(`div`,{className:`${t.accent} border-l-2`,children:[(0,L.jsxs)(`div`,{className:`flex items-center gap-2 px-2 pb-0.5 pt-1`,children:[(0,L.jsxs)(`span`,{className:`truncate font-mono text-[10px] tracking-wide uppercase text-[var(--text-weaker)]`,children:[t.caption,a.length>1?` (${a.length})`:``]}),t.delivery===`steer`&&n&&(0,L.jsxs)(`button`,{type:`button`,onClick:()=>void sy(e),title:`Interrupt the current step and deliver all steered messages now (queued ones stay parked)`,className:`${TU} ml-auto h-5 w-auto gap-1 px-1.5 font-mono text-[10px] normal-case`,children:[(0,L.jsx)(Ve,{className:`size-3`}),`interrupt & send now`]})]}),a.map(t=>(0,L.jsx)(OU,{sessionID:e,row:t},t.key))]},t.delivery)})})})})}function OU({sessionID:e,row:t}){let n=t.state===`sending`,r=t.delivery===`queue`;return(0,L.jsxs)(`div`,{className:`group flex items-center gap-2 py-1 pr-1 pl-2.5 text-xs text-[var(--text-base)]`,children:[n?(0,L.jsx)(Me,{className:`size-3 shrink-0 animate-spin text-[var(--text-weaker)]`}):(0,L.jsx)(`span`,{"aria-hidden":!0,className:`size-1.5 shrink-0 rounded-full ${r?`bg-[color:var(--text-interactive-base)]`:`bg-[color:var(--surface-warning-strong)]`}`}),(0,L.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,title:t.text,children:t.text}),(0,L.jsxs)(`div`,{className:`flex shrink-0 items-center gap-0.5 opacity-0 transition-opacity group-hover:opacity-100 focus-within:opacity-100 max-md:opacity-100`,children:[(0,L.jsx)(`button`,{type:`button`,disabled:n,onClick:()=>ay(e,t.key,r?`steer`:`queue`),title:r?`send at next step`:`move to queue`,className:`${TU} ${n?`pointer-events-none opacity-40`:``}`,children:r?(0,L.jsx)(M,{className:`size-3.5`}):(0,L.jsx)(ee,{className:`size-3.5`})}),r&&!n&&(0,L.jsx)(`button`,{type:`button`,onClick:()=>oy(e,t.key),title:`send now`,className:TU,children:(0,L.jsx)(Ve,{className:`size-3.5`})}),(0,L.jsx)(`button`,{type:`button`,onClick:()=>iy(e,t.key),title:n?`cancel send`:`cancel`,className:TU,children:(0,L.jsx)(it,{className:`size-3.5`})})]})]})}function kU(e){requestAnimationFrame(()=>{let t=document.getElementById(`composer-input-${e}`);if(!(t instanceof HTMLTextAreaElement))return;t.focus();let n=t.value.length;t.setSelectionRange(n,n)})}function AU({sessionID:e,paneKey:t=`main`}){let n=J(e=>e.sessions),r=J(e=>e.running),i=J(e=>e.activeIDs),a=J(e=>e.runsPanelOpen),o=J(e=>e.runsSelection),s=J(t=>t.sessions.find(t=>t.id===e)??t.sessionDetails[e]),c=J(t=>t.sessions.find(t=>t.id===e)?.location?.directory),[l,u]=(0,w.useState)(`subagents`),[d,f]=(0,w.useState)(null),[p,m]=(0,w.useState)(0),[h,g]=(0,w.useState)([]),_=(0,w.useRef)(null),v=fv(n,s?.parentID??e),y=e=>r[e]||i.includes(e),b=[...v].sort((e,t)=>Number(y(t.id))-Number(y(e.id))),x=Math.max(0,b.findIndex(e=>e.id===d));(0,w.useEffect)(()=>{if(!a)return;let t=b.length>0?`subagents`:`shells`,n=b.some(t=>t.id===e)?e:b[0]?.id??null,r=0,i=o,s=i?.section===`subagents`?i.subID:null;s&&b.some(e=>e.id===s)?(t=`subagents`,n=s):i?.section===`shells`&&(t=`shells`,r=Math.max(0,i.shellIndex)),u(t),f(n),m(r),document.activeElement?.blur?.(),requestAnimationFrame(()=>_.current?.focus({preventScroll:!0}))},[a]),(0,w.useEffect)(()=>{a&&lv({section:l,subID:d,shellIndex:p})},[a,l,d,p]),(0,w.useEffect)(()=>{l===`shells`&&h.length>0&&p>h.length-1&&m(h.length-1)},[l,p,h.length]);let S=(0,w.useCallback)(async()=>{try{let e=c?{directory:c}:void 0,[t,n]=await Promise.all([W.shellList(e),W.ptyList(e)]);g([...t.data.map(e=>({id:e.id,label:e.command||e.shell,running:e.status===`running`,kind:`shell`})),...n.data.map(e=>({id:e.id,label:e.title||e.command,running:e.status===`running`,kind:`pty`}))])}catch{}},[c]);(0,w.useEffect)(()=>{if(!a){g([]);return}return S(),Vh({name:`runs-panel-shells`,minInterval:5e3,run:()=>S()})},[a,S]);let C=(0,w.useCallback)(async e=>{let t=c?{directory:c}:void 0;try{e.kind===`shell`?await W.shellDelete(e.id,t):await W.ptyDelete(e.id,t)}catch{}S()},[c,S]);(0,w.useEffect)(()=>{if(!a)return;let e=e=>{if(e.ctrlKey&&!e.metaKey&&!e.altKey&&e.key.toLowerCase()===`k`){if(e.preventDefault(),e.stopPropagation(),l===`shells`){let e=h[p];e?.running&&C(e)}return}if([`ArrowLeft`,`ArrowRight`,`ArrowUp`,`ArrowDown`,`Enter`,`Escape`].includes(e.key)){if(e.preventDefault(),e.stopPropagation(),e.key===`Escape`){av(),kU(t);return}if(e.key===`ArrowLeft`||e.key===`ArrowRight`){u(e=>e===`subagents`?`shells`:`subagents`);return}if(e.key===`ArrowUp`){(l===`subagents`?b.length===0||x===0:h.length===0||p===0)?(av(),kU(t)):l===`subagents`?f(b[x-1].id):m(e=>e-1);return}if(e.key===`ArrowDown`){l===`subagents`?b.length>0&&f(b[(x+1)%b.length].id):h.length>0&&m(e=>(e+1)%h.length);return}l===`subagents`&&b[x]?(av(),vv(b[x].id)):l===`shells`&&h[p]&&(av(),nv())}};return window.addEventListener(`keydown`,e,!0),()=>window.removeEventListener(`keydown`,e,!0)},[a,l,x,p,b,h,C]);let T=(0,w.useRef)(e);(0,w.useEffect)(()=>{T.current!==e&&(T.current=e,av())},[e]);let E=(0,w.useRef)(null);return(0,w.useEffect)(()=>{if(!a)return;function e(e){let t=e.target;t instanceof Element&&(E.current?.contains(t)||t.closest(`[data-runs-panel-trigger]`)||av())}return document.addEventListener(`mousedown`,e),()=>document.removeEventListener(`mousedown`,e)},[a]),a?(0,L.jsx)(`div`,{ref:E,className:`border-t border-[color:var(--border-weak-base)] px-3 pb-2 pt-2`,"data-oc-runs-panel":!0,children:(0,L.jsxs)(`div`,{className:`mx-auto max-w-3xl`,children:[(0,L.jsxs)(`div`,{ref:_,tabIndex:-1,className:`min-h-44 max-h-64 overflow-y-auto border-l-2 border-[color:var(--border-strong)] bg-[color:var(--background-strong)] px-4 py-2 font-mono text-sm outline-none`,children:[(0,L.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,L.jsxs)(`div`,{className:`flex items-center gap-4`,children:[(0,L.jsx)(jU,{active:l===`subagents`,onClick:()=>u(`subagents`),children:`Subagents`}),(0,L.jsx)(jU,{active:l===`shells`,onClick:()=>u(`shells`),children:`Shell`})]}),(0,L.jsx)(`button`,{type:`button`,onClick:()=>{av(),kU(t)},className:`cursor-pointer font-mono text-xs text-[color:var(--text-weaker)] hover:text-[color:var(--text-weak)]`,children:`esc`})]}),l===`subagents`&&(b.length===0?(0,L.jsx)(`p`,{className:`pt-2 text-[color:var(--text-weak)]`,children:`No active subagents`}):b.map((t,n)=>(0,L.jsx)(MU,{selected:n===x,current:t.id===e,running:y(t.id),label:t.agent&&t.title?`${t.agent} — ${t.title}`:t.title||t.agent||t.id,onClick:()=>{av(),vv(t.id)}},t.id))),l===`shells`&&(h.length===0?(0,L.jsx)(`p`,{className:`pt-2 text-[color:var(--text-weak)]`,children:`No shell commands`}):h.map((e,t)=>(0,L.jsx)(MU,{selected:t===p,running:e.running,label:e.label,onKill:e.running?()=>void C(e):void 0,onClick:()=>{av(),nv()}},e.id)))]}),(0,L.jsxs)(`p`,{className:`mt-1 pl-1 font-mono text-[10px] text-[color:var(--text-weaker)]`,children:[`tabs `,(0,L.jsx)(`span`,{className:`text-[color:var(--text-weak)]`,children:`←/→`}),(l===`subagents`?b.length:h.length)>0&&(0,L.jsxs)(L.Fragment,{children:[` · `,`↑↓ select`,` · `,(0,L.jsx)(`span`,{className:`text-[color:var(--text-weak)]`,children:`↵`}),` open`]}),l===`shells`&&h.some(e=>e.running)&&(0,L.jsxs)(L.Fragment,{children:[` · `,(0,L.jsx)(`span`,{className:`text-[color:var(--text-weak)]`,children:`ctrl+k`}),` kill`]}),` · `,(0,L.jsx)(`span`,{className:`text-[color:var(--text-weak)]`,children:`type`}),` → composer`]})]})}):null}function jU({active:e,onClick:t,children:n}){return(0,L.jsx)(`button`,{type:`button`,onClick:t,className:`cursor-pointer bg-transparent p-0 font-mono text-sm transition-colors ${e?`font-bold text-[color:var(--text-strong)]`:`font-normal text-[color:var(--text-weaker)] hover:text-[color:var(--text-weak)]`}`,children:n})}function MU({selected:e,current:t,running:n,label:r,hint:i,onClick:a,onKill:o}){let s=(0,w.useRef)(null);return(0,w.useEffect)(()=>{e&&s.current?.scrollIntoView({block:`nearest`})},[e]),(0,L.jsxs)(`div`,{className:`flex w-full items-center gap-1`,children:[(0,L.jsxs)(`button`,{ref:s,type:`button`,onClick:a,title:t?`Currently open session`:void 0,className:`flex min-w-0 flex-1 cursor-pointer items-center gap-2 rounded-sm px-1 py-1 text-left font-mono text-xs transition-colors ${e?`bg-[color:var(--surface-raised-base-active)] text-[color:var(--text-strong)]`:`text-[color:var(--text-base)] hover:bg-[color:var(--surface-base-hover)]`}`,children:[(0,L.jsx)(`span`,{className:`size-1.5 shrink-0 rounded-full ${n?`bg-emerald-500`:`bg-[color:var(--text-weaker)]`}`}),t&&(0,L.jsx)(F,{className:`size-3 shrink-0 text-[color:var(--text-weak)]`,"aria-label":`current session`}),(0,L.jsx)(`span`,{className:`min-w-0 flex-1 truncate ${t&&!e?`font-medium text-[color:var(--text-strong)]`:``}`,children:r}),i&&(0,L.jsx)(`span`,{className:`shrink-0 font-mono text-[10px] text-[color:var(--text-weaker)]`,children:i})]}),o!==void 0&&(0,L.jsx)(`button`,{type:`button`,"aria-label":`Kill`,title:`Kill`,onClick:e=>{e.stopPropagation(),o()},className:`shrink-0 cursor-pointer rounded-sm p-0.5 text-[color:var(--text-weaker)] transition-colors hover:bg-[color:var(--surface-base-hover)] hover:text-[color:var(--surface-critical-strong)]`,children:(0,L.jsx)(tt,{className:`size-3`})})]})}var NU=1e4,PU=250,FU={retry:{icon:`⚠`,label:`Retry`,iconClass:`text-[color:var(--surface-warning-strong)]`,labelClass:`font-medium text-[color:var(--surface-warning-strong)]`,rowClass:`border-l-[color:var(--surface-warning-strong)] border-y border-r border-[color-mix(in_oklch,var(--surface-warning-strong)_30%,transparent)] bg-[color-mix(in_oklch,var(--surface-warning-strong)_8%,transparent)]`,barClass:`bg-[color:var(--surface-warning-strong)]`},error:{icon:`⚠`,label:`Error`,iconClass:`text-[color:var(--surface-critical-strong)]`,labelClass:`font-medium text-[color:var(--surface-critical-strong)]`,rowClass:`border-l-[color:var(--surface-critical-strong)] border-y border-r border-[color-mix(in_oklch,var(--surface-critical-strong)_30%,transparent)] bg-[color-mix(in_oklch,var(--surface-critical-strong)_8%,transparent)]`,barClass:`bg-[color:var(--surface-critical-strong)]`},failed:{icon:`⚠`,label:`Failed`,iconClass:`text-[color:var(--surface-critical-strong)]`,labelClass:`font-medium text-[color:var(--surface-critical-strong)]`,rowClass:`border-l-[color:var(--surface-critical-strong)] border-y border-r border-[color-mix(in_oklch,var(--surface-critical-strong)_30%,transparent)] bg-[color-mix(in_oklch,var(--surface-critical-strong)_8%,transparent)]`,barClass:`bg-[color:var(--surface-critical-strong)]`},interrupted:{icon:`⏹`,label:`Interrupted`,iconClass:`text-[var(--text-weaker)]`,labelClass:`font-medium text-[var(--text-weaker)]`,rowClass:`border-l-[color:var(--text-weaker)] border-y border-r border-[color-mix(in_oklch,var(--text-weaker)_25%,transparent)] bg-transparent`,barClass:`bg-[color:var(--text-weaker)]`}};function IU(e){let t=Math.max(0,Math.round((Date.now()-e)/1e3));if(t<10)return`just now`;if(t<60)return`${t}s ago`;let n=Math.floor(t/60);if(n<60)return`${n}m ago`;let r=Math.floor(n/60);return r<24?`${r}h ago`:`${Math.floor(r/24)}d ago`}function LU(e){let[,t]=(0,w.useState)(0);(0,w.useEffect)(()=>{if(e)return Vh({name:`run-notices-age`,minInterval:15e3,run:()=>t(e=>e+1)})},[e])}function RU(e,t){let[n,r]=(0,w.useState)({}),i=(0,w.useRef)({}),a=t?t.map(e=>e.id).join(`
|
|
111
|
-
`):``;return(0,w.useEffect)(()=>{let t=a?a.split(`
|
|
112
|
-
`):[];for(let e of t)e in i.current||(i.current[e]=NU);for(let e of Object.keys(i.current))t.includes(e)||delete i.current[e];if(t.length===0){r({});return}let n=Date.now(),o=setInterval(()=>{let a=Date.now(),o=a-n;if(n=a,typeof document<`u`&&document.hidden)return;let s={},c=[];for(let e of t){let t=Math.max(0,(i.current[e]??NU)-o);i.current[e]=t,s[e]=NU-t,t===0&&c.push(e)}r(s);for(let t of c)E_(e,t)},PU);return()=>clearInterval(o)},[a,e]),n}function zU({sessionID:e}){let t=J(t=>t.runNotices[e]);LU(!!t&&t.length>0);let n=RU(e,t);return!t||t.length===0?null:(0,L.jsx)(`div`,{className:`border-t border-[color:var(--border-weak-base)] px-3 pb-1 pt-2`,children:(0,L.jsx)(`div`,{className:`mx-auto flex max-h-32 max-w-3xl flex-col gap-1 overflow-y-auto`,children:t.map(t=>{let r=FU[t.kind],i=Math.min(100,(n[t.id]??0)/NU*100);return(0,L.jsxs)(`div`,{className:`relative flex items-start gap-2 rounded-md border-l-2 py-1 pl-2.5 pr-2 pb-1.5 text-xs text-[var(--text-base)] ${r.rowClass}`,children:[(0,L.jsx)(`span`,{"aria-hidden":!0,className:`shrink-0 ${r.iconClass}`,children:r.icon}),(0,L.jsxs)(`span`,{className:`min-w-0 flex-1 break-words`,children:[(0,L.jsx)(`span`,{className:r.labelClass,children:r.label}),`: `,t.text]}),(0,L.jsx)(`span`,{className:`shrink-0 whitespace-nowrap tabular-nums text-[var(--text-weaker)]`,children:IU(t.at)}),(0,L.jsx)(`button`,{type:`button`,onClick:()=>E_(e,t.id),title:`Dismiss`,className:`shrink-0 cursor-pointer text-[var(--text-weaker)] transition-colors hover:text-[var(--text-strong)]`,children:`✕`}),(0,L.jsx)(`span`,{"aria-hidden":!0,className:`pointer-events-none absolute inset-x-0 bottom-0 h-[2px] opacity-40 ${r.barClass}`,style:{width:`${i}%`}})]},t.id)})})})}function BU({sessionID:e}){let t=J(t=>t.sendErrors[e]);return(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(zU,{sessionID:e}),t?(0,L.jsx)(`div`,{className:`border-t border-[color:var(--border-weak-base)] px-3 pb-2 pt-2`,children:(0,L.jsxs)(`div`,{className:`mx-auto flex max-w-3xl items-start gap-2 rounded-md border-l-2 border-l-[color:var(--surface-critical-strong)] border-y border-r border-[color-mix(in_oklch,var(--surface-critical-strong)_30%,transparent)] bg-[color-mix(in_oklch,var(--surface-critical-strong)_8%,transparent)] py-1.5 pl-2.5 pr-2 text-xs text-[var(--text-base)]`,children:[(0,L.jsx)(`span`,{"aria-hidden":!0,className:`shrink-0 text-[color:var(--surface-warning-strong)]`,children:`⚠`}),(0,L.jsxs)(`span`,{className:`min-w-0 flex-1 break-words`,children:[(0,L.jsx)(`span`,{className:`font-medium text-[color:var(--surface-critical-strong)]`,children:t.type}),`: `,t.message]}),(0,L.jsx)(`button`,{type:`button`,onClick:()=>ry(e),title:`Dismiss`,className:`shrink-0 cursor-pointer text-[var(--text-weaker)] transition-colors hover:text-[var(--text-strong)]`,children:`✕`})]})}):null]})}function VU({...e}){return(0,L.jsx)(Cf,{"data-slot":`dropdown-menu`,...e})}function HU({...e}){return(0,L.jsx)(wf,{"data-slot":`dropdown-menu-trigger`,...e})}function UU({className:e,align:t=`start`,sideOffset:n=4,...r}){return(0,L.jsx)(Tf,{children:(0,L.jsx)(Ef,{"data-slot":`dropdown-menu-content`,sideOffset:n,align:t,className:B(`z-50 max-h-(--radix-dropdown-menu-content-available-height) w-(--radix-dropdown-menu-trigger-width) min-w-32 origin-(--radix-dropdown-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-lg bg-popover p-1 text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-[state=closed]:overflow-hidden data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95`,e),...r})})}function WU({className:e,inset:t,variant:n=`default`,...r}){return(0,L.jsx)(Of,{"data-slot":`dropdown-menu-item`,"data-inset":t,"data-variant":n,className:B(`group/dropdown-menu-item relative flex cursor-default items-center gap-1.5 rounded-md px-1.5 py-1 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground data-inset:pl-7 data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 data-[variant=destructive]:focus:text-destructive dark:data-[variant=destructive]:focus:bg-destructive/20 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 data-[variant=destructive]:*:[svg]:text-destructive`,e),...r})}function GU({className:e,inset:t,...n}){return(0,L.jsx)(Df,{"data-slot":`dropdown-menu-label`,"data-inset":t,className:B(`px-1.5 py-1 text-xs font-medium text-muted-foreground data-inset:pl-7`,e),...n})}function KU({className:e,...t}){return(0,L.jsx)(kf,{"data-slot":`dropdown-menu-separator`,className:B(`-mx-1 my-1 h-px bg-border`,e),...t})}function qU({sessionID:e}){let t=J(t=>t.sessions.find(t=>t.id===e)),[n,r]=(0,w.useState)(!1),[i,a]=(0,w.useState)(null);return(0,L.jsxs)(L.Fragment,{children:[(0,L.jsxs)(VU,{open:n,onOpenChange:r,children:[(0,L.jsx)(HU,{asChild:!0,children:(0,L.jsx)(H,{variant:`ghost`,size:`icon`,title:`Session actions`,children:(0,L.jsx)(fe,{})})}),(0,L.jsxs)(UU,{align:`end`,className:`w-48`,children:[(0,L.jsxs)(WU,{onSelect:()=>a(`rename`),children:[(0,L.jsx)(ze,{}),` Rename…`]}),(0,L.jsxs)(WU,{onSelect:()=>a(`fork`),children:[(0,L.jsx)(Oe,{}),` Fork…`]}),(0,L.jsxs)(WU,{onSelect:()=>void ZU(e),children:[(0,L.jsx)(de,{}),` Export`]}),(0,L.jsx)(KU,{}),(0,L.jsxs)(WU,{onSelect:()=>a(`compact`),children:[(0,L.jsx)(k,{}),` Compact`]})]})]}),i===`rename`&&(0,L.jsx)(JU,{sessionID:e,initialTitle:t?.title??``,onClose:()=>a(null)}),i===`fork`&&(0,L.jsx)(YU,{sessionID:e,onClose:()=>a(null)}),i===`compact`&&(0,L.jsx)(XU,{sessionID:e,onClose:()=>a(null)})]})}function JU({sessionID:e,initialTitle:t,onClose:n}){let[r,i]=(0,w.useState)(t),[a,o]=(0,w.useState)(!1),s=async()=>{let t=r.trim();if(!(!t||a)){o(!0);try{await zy(e,t),n()}finally{o(!1)}}};return(0,L.jsx)(Tm,{open:!0,onOpenChange:e=>!e&&!a&&n(),children:(0,L.jsxs)(Am,{children:[(0,L.jsxs)(jm,{children:[(0,L.jsx)(Nm,{children:`Rename session`}),(0,L.jsx)(Pm,{children:`Give this session a new title.`})]}),(0,L.jsx)(Fm,{value:r,onChange:e=>i(e.target.value),onKeyDown:e=>{e.key===`Enter`&&s()},placeholder:`Untitled session`,autoFocus:!0}),(0,L.jsxs)(Mm,{children:[(0,L.jsx)(Om,{asChild:!0,children:(0,L.jsx)(H,{variant:`outline`,disabled:a,children:`Cancel`})}),(0,L.jsx)(H,{onClick:()=>void s(),disabled:a||!r.trim(),children:`Rename`})]})]})})}function YU({sessionID:e,onClose:t}){let[n,r]=(0,w.useState)(``),[i,a]=(0,w.useState)(!1),o=async()=>{if(!i){a(!0);try{await vv(await By(e,n.trim()?{type:`before`,messageID:n.trim()}:{type:`through`})),t()}finally{a(!1)}}};return(0,L.jsx)(Tm,{open:!0,onOpenChange:e=>!e&&!i&&t(),children:(0,L.jsxs)(Am,{children:[(0,L.jsxs)(jm,{children:[(0,L.jsx)(Nm,{children:`Fork session`}),(0,L.jsx)(Pm,{children:`Copies the conversation into a new session. Leave the boundary empty to fork the full session.`})]}),(0,L.jsx)(Im,{value:n,onChange:e=>r(e.target.value),placeholder:`Boundary message ID (msg_…) — empty forks the full session`,rows:3,autoFocus:!0}),(0,L.jsxs)(Mm,{children:[(0,L.jsx)(Om,{asChild:!0,children:(0,L.jsx)(H,{variant:`outline`,disabled:i,children:`Cancel`})}),(0,L.jsx)(H,{onClick:()=>void o(),disabled:i,children:`Fork`})]})]})})}function XU({sessionID:e,onClose:t}){let[n,r]=(0,w.useState)(!1),i=async()=>{if(!n){r(!0);try{await Hy(e,`steer`),t()}finally{r(!1)}}};return(0,L.jsx)(Tm,{open:!0,onOpenChange:e=>!e&&!n&&t(),children:(0,L.jsxs)(Am,{children:[(0,L.jsxs)(jm,{children:[(0,L.jsx)(Nm,{children:`Compact session`}),(0,L.jsx)(Pm,{children:`Summarizes the conversation so far into a single compact message so the agent can keep going with full context.`})]}),(0,L.jsxs)(Mm,{children:[(0,L.jsx)(Om,{asChild:!0,children:(0,L.jsx)(H,{variant:`outline`,disabled:n,children:`Cancel`})}),(0,L.jsx)(H,{onClick:()=>void i(),disabled:n,children:`Compact`})]})]})})}async function ZU(e){try{let t=await Vy(e),n=new Blob([QU(t)],{type:`text/markdown`}),r=URL.createObjectURL(n),i=document.createElement(`a`);i.href=r,i.download=`session-${e.slice(0,8)}.md`,i.click(),URL.revokeObjectURL(r)}catch(e){console.warn(`session export failed:`,e)}}function QU(e){let{info:t,messages:n}=e,r=[`# ${t.title||`Untitled session`}`,``];r.push(`Session \`${t.id}\` · exported ${new Date(t.time.created).toISOString()}`,``);for(let e of n)if(e.type===`assistant`){r.push(`## assistant`,``);for(let t of e.content)t.type===`text`&&t.text?r.push(t.text,``):t.type===`reasoning`&&t.text?r.push("```reasoning",t.text,"```",``):t.type===`tool`&&r.push(`> tool: \`${t.name}\` (\`${t.id}\`)`,``)}else`text`in e&&typeof e.text==`string`&&e.text?r.push(`## ${e.type}`,``,e.text,``):e.type===`shell`&&r.push(`## shell`,``,`> \`${e.command}\``,``);return r.join(`
|
|
113
|
-
`)}function $U({sessionID:e,onNavigate:t}){let n=J(t=>fv(t.sessions,e)),r=J(e=>e.running),i=J(e=>e.activeIDs),[a,o]=(0,w.useState)(()=>{try{return localStorage.getItem(`webui.subagentStripCollapsed`)!==`1`}catch{return!1}}),s=e=>t?t(e):void vv(e);if(n.length===0)return null;let c=n.filter(e=>r[e.id]||i.includes(e.id)).length;return(0,L.jsxs)(`div`,{className:`border-b border-[color:var(--border-weak-base)] px-4 py-1`,"data-oc-subagent-strip":!0,children:[(0,L.jsxs)(`button`,{type:`button`,"aria-expanded":a,onClick:()=>{o(e=>{let t=!e;try{localStorage.setItem(`webui.subagentStripCollapsed`,t?`0`:`1`)}catch{}return t})},className:`flex cursor-pointer items-center gap-1.5 rounded-md px-1 py-0.5 text-[11px] text-[color:var(--text-weaker)] transition-colors hover:bg-[color:var(--surface-base-hover)] hover:text-[color:var(--text-weak)]`,title:`Subagent sessions of this session`,children:[a?(0,L.jsx)(ae,{className:`size-3`}):(0,L.jsx)(F,{className:`size-3`}),(0,L.jsxs)(`span`,{className:`font-medium`,children:[`Subagents (`,n.length,`)`]}),c>0&&(0,L.jsxs)(`span`,{className:`flex items-center gap-1 text-[color:var(--surface-brand-base)]`,children:[(0,L.jsx)(`span`,{className:`size-1.5 animate-pulse rounded-full bg-[color:var(--surface-brand-base)]`}),c,` running`]})]}),a&&(0,L.jsx)(`div`,{className:`mt-0.5 mb-1 flex flex-col gap-0.5`,children:n.map(e=>(0,L.jsx)(eW,{id:e.id,title:e.title,agent:e.agent,running:!!r[e.id]||i.includes(e.id),onOpen:()=>s(e.id)},e.id))})]})}function eW({id:e,title:t,agent:n,running:r,onOpen:i}){let[a,o]=(0,w.useState)(!1),[s,c]=(0,w.useState)(``),l=()=>{let t=s.trim();t&&(zv(e,t),c(``),o(!1))};return(0,L.jsxs)(`div`,{className:`rounded-md px-1 py-0.5 transition-colors hover:bg-[color:var(--surface-base-hover)]`,children:[(0,L.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,L.jsx)(`span`,{className:`size-1.5 shrink-0 rounded-full ${r?`animate-pulse bg-[color:var(--surface-success-strong)]`:`bg-[color:var(--border-base)]`}`,title:r?`Running`:`Idle`}),(0,L.jsxs)(`button`,{type:`button`,onClick:i,className:`min-w-0 flex-1 cursor-pointer truncate text-left text-xs text-[color:var(--text-weak)] hover:text-[color:var(--text-strong)]`,title:`Open ${t??e}`,children:[n&&t?`${n} — ${t}`:t||n||`subagent`,(0,L.jsx)(`span`,{className:`ml-2 hidden font-mono text-[10px] text-[color:var(--text-weaker)] sm:inline`,children:e.slice(0,12)})]}),(0,L.jsxs)(H,{variant:`ghost`,size:`xs`,onClick:()=>{o(e=>!e),c(``)},title:a?`Cancel`:`Message this subagent`,children:[(0,L.jsx)(Pe,{}),`Message`]}),(0,L.jsx)(H,{variant:`ghost`,size:`xs`,onClick:i,title:`Open session`,children:`Open`})]}),a&&(0,L.jsx)(`input`,{autoFocus:!0,value:s,onChange:e=>c(e.target.value),onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),l()),e.key===`Escape`&&(e.preventDefault(),o(!1))},placeholder:`message this subagent… (enter to send)`,className:`mt-1 w-full rounded-md border border-[color:var(--border-base)] bg-[color:var(--input-base)] px-2 py-1 font-mono text-xs text-[color:var(--text-strong)] outline-none placeholder:text-[color:var(--text-weaker)] focus:border-[color:var(--border-selected)]`})]})}var tW=`webui.theme`,nW=`oc-theme`,rW=[{id:`opencode`,label:`Opencode`,vars:{}},{id:`catppuccin`,label:`Catppuccin`,vars:{"--background-base":`#1e1e2e`,"--surface-float-base":`#181825`,"--background-weak":`#11111b`,"--text-strong":`#cdd6f4`,"--text-weak":`#9399b2`,"--border-selected":`#89b4fa`,"--surface-brand-base":`#f5c2e7`,"--surface-success-strong":`#a6e3a1`,"--surface-critical-strong":`#f38ba8`,"--surface-warning-strong":`#f9e2af`,"--surface-info-strong":`#94e2d5`}},{id:`nord`,label:`Nord`,vars:{"--background-base":`#2e3440`,"--surface-float-base":`#3b4252`,"--background-weak":`#434c5e`,"--text-strong":`#eceff4`,"--text-weak":`#8b95a7`,"--border-selected":`#88c0d0`,"--surface-brand-base":`#8fbcbb`,"--surface-success-strong":`#a3be8c`,"--surface-critical-strong":`#bf616a`,"--surface-warning-strong":`#d08770`,"--surface-info-strong":`#88c0d0`}},{id:`tokyonight`,label:`Tokyo Night`,vars:{"--background-base":`#1a1b26`,"--surface-float-base":`#1e2030`,"--background-weak":`#222436`,"--text-strong":`#c8d3f5`,"--text-weak":`#828bb8`,"--border-selected":`#82aaff`,"--surface-brand-base":`#ff966c`,"--surface-success-strong":`#c3e88d`,"--surface-critical-strong":`#ff757f`,"--surface-warning-strong":`#ffc777`,"--surface-info-strong":`#82aaff`}},{id:`dracula`,label:`Dracula`,vars:{"--background-base":`#282a36`,"--surface-float-base":`#21222c`,"--background-weak":`#44475a`,"--text-strong":`#f8f8f2`,"--text-weak":`#6272a4`,"--border-selected":`#bd93f9`,"--surface-brand-base":`#8be9fd`,"--surface-success-strong":`#50fa7b`,"--surface-critical-strong":`#ff5555`,"--surface-warning-strong":`#f1fa8c`,"--surface-info-strong":`#ffb86c`}},{id:`gruvbox`,label:`Gruvbox`,vars:{"--background-base":`#282828`,"--surface-float-base":`#3c3836`,"--background-weak":`#504945`,"--text-strong":`#ebdbb2`,"--text-weak":`#928374`,"--border-selected":`#83a598`,"--surface-brand-base":`#8ec07c`,"--surface-success-strong":`#b8bb26`,"--surface-critical-strong":`#fb4934`,"--surface-warning-strong":`#fe8019`,"--surface-info-strong":`#fabd2f`}},{id:`github`,label:`GitHub`,vars:{"--background-base":`#0d1117`,"--surface-float-base":`#010409`,"--background-weak":`#161b22`,"--text-strong":`#c9d1d9`,"--text-weak":`#8b949e`,"--border-selected":`#58a6ff`,"--surface-brand-base":`#39c5cf`,"--surface-success-strong":`#3fb950`,"--surface-critical-strong":`#f85149`,"--surface-warning-strong":`#e3b341`,"--surface-info-strong":`#d29922`}}];function iW(){let e=localStorage.getItem(tW);return rW.find(t=>t.id===e)??rW[0]}function aW(e){let t=rW.find(t=>t.id===e)??rW[0],n=document.getElementById(nW);n||(n=document.createElement(`style`),n.id=nW,document.head.appendChild(n));let r=Object.entries(t.vars);return n.textContent=r.length>0?`:root:root {\n ${r.map(([e,t])=>`${e}: ${t};`).join(`
|
|
114
|
-
`)}\n}`:``,localStorage.setItem(tW,t.id),t}aW(iW().id);function oW(){let[e,t]=(0,w.useState)(iW().id),n=J(e=>e.uiSignals.themes),[r,i]=(0,w.useState)(!1);(0,w.useEffect)(()=>{n&&i(!0)},[n]);let a=rW.find(t=>t.id===e)?.label??rW[0].label;return(0,L.jsxs)(VU,{open:r,onOpenChange:i,children:[(0,L.jsx)(HU,{asChild:!0,children:(0,L.jsxs)(H,{variant:`ghost`,size:`sm`,className:`text-xs text-muted-foreground`,children:[(0,L.jsx)(Fe,{}),(0,L.jsx)(`span`,{className:`hidden lg:inline`,children:a})]})}),(0,L.jsx)(UU,{align:`end`,className:`min-w-40`,children:rW.map(n=>(0,L.jsxs)(WU,{className:`justify-between`,onSelect:()=>t(aW(n.id).id),children:[(0,L.jsx)(`span`,{children:n.label}),n.id===e&&(0,L.jsx)(ie,{className:`size-3.5`})]},n.id))})]})}function sW(e){let t=e.split(`/`).filter(Boolean);return t.length>0?t[t.length-1]:e}function cW(e){let t=sW(e.directory??e.canonical);return t&&t!==`/`?t:e.id}function lW({sessionID:e}){let t=J(t=>t.sessions.find(t=>t.id===e)),[n,r]=(0,w.useState)(null),[i,a]=(0,w.useState)(null),[o,s]=(0,w.useState)([]),[c,l]=(0,w.useState)(!1),u=t?.location.directory??n?.directory;function d(){l(!0),Promise.all([W.locationInfo(),W.projectCurrent(),W.projectList()]).then(([e,t,n])=>{r(e),a(t),s(n)}).catch(()=>void 0).finally(()=>l(!1))}return(0,L.jsxs)(VU,{onOpenChange:e=>e&&d(),children:[(0,L.jsx)(HU,{asChild:!0,children:(0,L.jsxs)(H,{variant:`ghost`,size:`sm`,title:u,className:`max-w-44 text-xs text-muted-foreground`,children:[(0,L.jsx)(Ee,{}),(0,L.jsx)(`span`,{className:`hidden truncate font-mono lg:inline`,children:u||`workspace`})]})}),(0,L.jsxs)(UU,{align:`end`,className:`min-w-56`,children:[(0,L.jsx)(GU,{children:`Location`}),(0,L.jsxs)(`div`,{className:`flex items-center gap-1.5 px-1.5 py-1 text-sm text-[var(--text-base)]`,children:[(0,L.jsx)(Ee,{className:`size-3.5 shrink-0 text-[var(--text-weak)]`}),(0,L.jsx)(`span`,{className:`truncate font-mono text-xs`,children:n?.directory??u??`…`})]}),n?.workspaceID&&(0,L.jsx)(`div`,{className:`px-1.5 pb-1 font-mono text-[11px] text-[var(--text-weaker)]`,children:n.workspaceID}),(0,L.jsx)(KU,{}),(0,L.jsx)(GU,{children:`Project`}),c&&o.length===0?(0,L.jsxs)(`div`,{className:`flex flex-col gap-1.5 px-1.5 py-1`,children:[(0,L.jsx)(Kk,{className:`h-6 w-full`}),(0,L.jsx)(Kk,{className:`h-6 w-full`}),(0,L.jsx)(Kk,{className:`h-6 w-3/4`})]}):o.length===0?(0,L.jsx)(`div`,{className:`px-1.5 py-1 text-xs text-[var(--text-weaker)]`,children:`No projects`}):o.map(e=>{let t=i?.id===e.id;return(0,L.jsxs)(WU,{className:`justify-between font-mono text-xs`,onSelect:e=>e.preventDefault(),children:[(0,L.jsx)(`span`,{className:`truncate`,children:cW(e)}),t&&(0,L.jsx)(ie,{className:`size-3.5 text-[var(--text-interactive-base)]`})]},e.id)})]})]})}function uW({sessionID:e,paneKey:t=`main`,focused:n=!0,onClose:r,onNavigate:i}){let a=e=>i?i(e):void vv(e),o=J(t=>t.sessions.find(t=>t.id===e)??t.sessionDetails[e]),s=J(t=>t.messages[e]??[]),c=J(t=>t.live.filter(t=>t.sessionID===e)),l=J(t=>t.running[e]??!1),u=J(t=>!!t.queued[e]),d=J(e=>e.runsPanelOpen),f=J(e=>e.subagentComposerOpen),p=J(t=>n?rg(t).some(t=>t.req.sessionID===e):!1),m=J(t=>hv(t,e)),h=(0,w.useMemo)(()=>mv(s,m),[s,m]);(0,w.useEffect)(()=>{Ng(e)},[e]);let g=J(e=>e.highlightMessageID),_=J(e=>e.highlightSessionID),v=J(e=>e.highlightQuery),y=J(e=>e.highlightTick);return(0,w.useEffect)(()=>{if(!g||_!==e)return;let t=!1,n=()=>{document.querySelectorAll(`[data-search-highlight="true"]`).forEach(e=>{let t=e.parentNode;if(!t)return;let n=document.createTextNode(e.textContent??``);t.replaceChild(n,e),t.normalize?.()})},r=(e,t)=>{let n=t.toLowerCase();if(!n)return null;let r=document.createTreeWalker(e,NodeFilter.SHOW_TEXT),i,a=[];for(;i=r.nextNode();)i.parentElement?.closest(`[data-search-highlight="true"]`)||!i.nodeValue||i.nodeValue.trim()===``||a.push(i);for(let e of a){let r=e.nodeValue??``,i=r.toLowerCase().indexOf(n);if(i===-1)continue;let a=r.slice(0,i),o=r.slice(i,i+t.length),s=r.slice(i+t.length),c=document.createDocumentFragment();a&&c.appendChild(document.createTextNode(a));let l=document.createElement(`span`);return l.setAttribute(`data-search-highlight`,`true`),l.textContent=o,c.appendChild(l),s&&c.appendChild(document.createTextNode(s)),e.parentNode?.replaceChild(c,e),l}return null},i=()=>{let e=document.getElementById(`msg-${g}`);if(!e)return!1;if(n(),v){let t=r(e,v);if(t)return t.scrollIntoView({behavior:`smooth`,block:`center`,inline:`nearest`}),setTimeout(()=>{let e=t.parentNode;if(e){let n=document.createTextNode(t.textContent??``);e.replaceChild(n,t),e.normalize?.()}},2800),!0}return e.scrollIntoView({behavior:`smooth`,block:`center`}),e.classList.add(`ring-1`,`ring-[var(--surface-warning-strong)]`,`rounded-lg`),setTimeout(()=>e.classList.remove(`ring-1`,`ring-[var(--surface-warning-strong)]`,`rounded-lg`),1800),!0},a=0,o=0,s=()=>{t||i()||++o>=60||(a=requestAnimationFrame(s))};return a=requestAnimationFrame(s),()=>{t=!0,a&&cancelAnimationFrame(a)}},[e,g,_,v,y,h]),(0,L.jsxs)(`div`,{className:`pane-surface flex min-h-0 min-w-0 flex-1 flex-col`,children:[(0,L.jsx)(wt,{id:`conversation.header`,title:o?.title,sessionID:e,running:l,queued:u,parentID:o?.parentID,go:a,onClose:r}),!sg(e)&&(0,L.jsx)($U,{sessionID:e,onNavigate:i}),(0,L.jsx)(TM,{defaultScrollPosition:`end`,autoScroll:!0,children:(0,L.jsxs)(`div`,{className:`relative flex flex-1 flex-col overflow-hidden`,children:[(0,L.jsxs)(EM,{className:`flex-1`,children:[(0,L.jsx)(DM,{children:(0,L.jsx)(_W,{sessionID:e,messages:h,live:c,running:l})}),(0,L.jsx)(AM,{direction:`end`}),(0,L.jsx)(dW,{sessionID:e,messages:h})]}),(0,L.jsx)(SW,{messages:s})]})}),(0,L.jsx)(BU,{sessionID:e}),(0,L.jsx)(DU,{sessionID:e}),n?p?(0,L.jsx)(yU,{sessionID:e}):d?(0,L.jsx)(AU,{sessionID:e,paneKey:t}):o?.parentID&&!f?(0,L.jsx)(fW,{sessionID:e,parentID:o.parentID,go:a}):(0,L.jsx)(wt,{id:`composer`,sessionID:e,paneKey:t}):(0,L.jsx)(wt,{id:`composer`,sessionID:e,paneKey:t})]})}function dW({sessionID:e,messages:t}){let{scrollToEnd:n}=_M(),r=(0,w.useRef)(null);return(0,w.useEffect)(()=>{let i=t[t.length-1],a=i?.id??null,o=r.current;r.current={sessionID:e,id:a},!(!o||o.sessionID!==e||o.id===a)&&i?.type===`user`&&n({behavior:`smooth`})},[e,t,n]),null}function fW({sessionID:e,parentID:t,go:n}){let r=J(e=>e.sessions),i=J(e=>e.running),a=J(e=>e.activeIDs),o=J(e=>e.sessions.find(e=>e.id===t)?.title??e.sessionDetails[t]?.title),s=e=>i[e]||a.includes(e),c=[...fv(r,t)].sort((e,t)=>e.id<t.id?-1:1);return(0,L.jsx)(`div`,{className:`border-t border-[var(--border-base)] px-2.5 py-1.5 sm:px-4`,children:(0,L.jsxs)(`div`,{className:`mx-auto flex max-w-3xl flex-col gap-1`,children:[(0,L.jsx)(`div`,{className:`flex flex-wrap items-center gap-x-1 gap-y-0.5`,children:c.map(t=>(0,L.jsx)(pW,{id:t.id,label:t.title||t.agent||t.id,current:t.id===e,running:s(t.id),go:n},t.id))}),(0,L.jsxs)(`div`,{className:`flex items-center justify-center gap-2 text-xs text-[var(--text-weaker)]`,children:[(0,L.jsx)(`button`,{type:`button`,onClick:()=>uv(),className:`cursor-pointer rounded-md border border-dashed border-[var(--border-weak-base)] px-1.5 py-0.5 font-mono transition-colors hover:border-[var(--border-selected)] hover:text-[var(--text-strong)]`,title:`Show the message composer`,children:`enter`}),(0,L.jsx)(`span`,{children:`to message this subagent`}),(0,L.jsx)(`span`,{"aria-hidden":!0,children:`·`}),(0,L.jsxs)(`button`,{type:`button`,onClick:()=>n(t),title:`Back to parent${o?`: ${o}`:``}`,className:`flex cursor-pointer items-center gap-1 rounded-md border border-[var(--border-weak-base)] px-1.5 py-0.5 transition-colors hover:border-[var(--border-selected)] hover:text-[var(--text-strong)]`,children:[(0,L.jsx)(te,{className:`size-3`}),`back to parent`]}),(0,L.jsx)(`span`,{"aria-hidden":!0,children:`·`}),(0,L.jsx)(`span`,{className:`font-mono text-[10px]`,children:`←/→ switch`})]})]})})}function pW({id:e,label:t,current:n,running:r,go:i}){let a=(0,w.useRef)(null);return(0,w.useEffect)(()=>{n&&a.current?.scrollIntoView({block:`nearest`,inline:`nearest`})},[n]),(0,L.jsxs)(`button`,{ref:a,type:`button`,onClick:()=>i(e),title:n?`Currently open — ←/→ to switch`:t,className:`flex cursor-pointer items-center gap-1 rounded-full px-1.5 py-0.5 font-mono text-[11px] transition-colors ${n?`bg-[color:var(--surface-raised-base-active)] font-medium text-[color:var(--text-strong)]`:`text-[color:var(--text-weaker)] hover:bg-[color:var(--surface-base-hover)] hover:text-[color:var(--text-weak)]`}`,children:[(0,L.jsx)(`span`,{className:`size-1.5 shrink-0 rounded-full ${r?`animate-pulse bg-emerald-500`:`bg-[color:var(--border-base)]`}`}),(0,L.jsx)(`span`,{className:`max-w-44 truncate`,children:t})]})}function mW(e,t){let n=[],r=e=>n.push(String(e));for(let t of e)if(r(t.id),t.type===`assistant`){r(t.content.length),r(t.finish??``);for(let e of t.content)e.type===`tool`?(r(`t${e.id}:${e.state.status}`),e.state.status===`streaming`?r(e.state.input.length):(r(hW(e.state.input)),`metadata`in e.state&&r(hW(e.state.metadata)),`content`in e.state&&e.state.content&&r(e.state.content.length),e.state.status===`error`&&r(hW(e.state.error)))):r(`${e.type}:${e.text.length}`)}else`text`in t&&typeof t.text==`string`?(r(t.text.length),`files`in t&&t.files&&r(t.files.length)):r(hW(t));for(let e of t){r(`live:${e.id}:${e.content.length}`),r(e.error?`${e.error.type}:${hW(e.error.message)}`:``);for(let t of e.content)t.type===`tool`?r(`t${t.tool.id}:${t.tool.status}:${+!!t.tool.executed}:${hW(t.tool.inputText)}:${hW(t.tool.metadata)}:${t.tool.content?.length??0}:${t.tool.error?hW(t.tool.error.message):0}`):r(`${t.type}:${t.ordinal}:${t.text.length}`)}return n.join(`|`)}function hW(e){if(e==null)return 0;if(typeof e==`string`)return e.length;try{return JSON.stringify(e)?.length??0}catch{return-1}}function gW(e,t){return e.sessionID===t.sessionID&&e.running===t.running&&mW(e.messages,e.live)===mW(t.messages,t.live)}var _W=w.memo(function({sessionID:e,messages:t,live:n,running:r}){return(0,L.jsxs)(OM,{className:`mx-auto w-full max-w-3xl px-3 py-4 sm:px-4 sm:py-6`,"data-oc-transcript":!0,children:[t.length===0&&n.length===0&&!r&&(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(kM,{children:(0,L.jsx)(vW,{})}),(0,L.jsx)(wt,{id:`conversation.empty`,sessionID:e})]}),(()=>{let i=!1,a=[];for(let n=0;n<t.length;n++){let r=t[n],o=r.type===`assistant`,s=o&&i;i=o;let c=t[n+1],l=o&&c?.type!==`assistant`,u;if(l){let e=[];for(let r=n;r>=0;r--){let n=t[r];if(n.type!==`assistant`)break;let i=n.content?.filter(e=>e.type===`text`&&e.text?.trim()).map(e=>e.text.trim());i&&i.length>0&&e.unshift(i.join(`
|
|
115
|
-
|
|
116
|
-
`))}let r=e.join(`
|
|
117
|
-
|
|
118
|
-
`);r&&(u=r)}a.push((0,L.jsx)(kM,{messageId:r.id,id:`msg-${r.id}`,children:(0,L.jsx)(JH,{message:r,compact:s,sessionID:e,isTail:l,responseText:u})},r.id))}return n.length>0&&a.push((0,L.jsx)(kM,{children:(0,L.jsx)(xW,{assistants:n,running:r})},`live`)),a})()]})},gW);function vW(){return(0,L.jsx)(`div`,{className:`flex justify-center px-2 pt-10 sm:pt-16`,children:(0,L.jsxs)(`div`,{className:`flex w-full max-w-md flex-col items-center gap-1.5 rounded-lg border border-[var(--border-weak-base)] bg-[var(--background-weak)] px-5 py-8 text-center sm:px-8 sm:py-10`,children:[(0,L.jsx)(`h1`,{className:`text-[var(--font-size-large)] font-medium text-[var(--text-base)]`,children:`Start a conversation`}),(0,L.jsx)(`p`,{className:`text-[var(--font-size-base)] text-[var(--text-weaker)]`,children:`The agent can read, edit, and run commands in the session workspace.`})]})})}function yW(e){return e.replace(/\/+$/,``).replace(/^\/(home|Users)\/[^/]+/,`~`)}function bW({title:e,sessionID:t,running:n,queued:r,parentID:i,go:a,onClose:o}){let s=J(e=>e.sessionDetails[i??``]?.title),c=sg(t),l=J(e=>e.draftWorkspace);return(0,L.jsxs)(`div`,{className:`flex items-center justify-between gap-2 border-b border-[var(--border-base)] px-2.5 py-2 sm:px-4 sm:py-2.5`,"data-oc-session-header":!0,children:[(0,L.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-center gap-1.5 sm:gap-2`,children:[(0,L.jsx)(`button`,{type:`button`,onClick:sv,title:`Open sessions`,"aria-label":`Open sessions`,className:`flex size-8 shrink-0 cursor-pointer items-center justify-center rounded-md text-[var(--text-weak)] transition-colors hover:bg-[color:var(--surface-base-hover)] hover:text-[var(--text-strong)] md:hidden`,children:(0,L.jsx)(Ne,{className:`size-4`})}),i&&(0,L.jsx)(`button`,{type:`button`,onClick:()=>a(i),title:`Back to parent session${s?`: ${s}`:``}`,className:`cursor-pointer rounded-md border border-[var(--border-weak-base)] px-1.5 py-0.5 text-xs text-[var(--text-weak)] transition-colors hover:border-[var(--border-selected)] hover:text-[var(--text-strong)]`,children:`↑ Parent`}),(0,L.jsx)(`button`,{type:`button`,className:`mr-1 cursor-pointer text-[var(--text-weaker)] transition-colors hover:text-[var(--text-strong)] lg:hidden`,onClick:()=>o?o():a(null),children:`←`}),(0,L.jsx)(`span`,{className:`truncate text-[var(--font-size-base)] font-medium text-[var(--text-strong)]`,children:c?`New session`:e??`Untitled session`}),c?(0,L.jsx)(`span`,{className:`hidden truncate font-mono text-xs text-[var(--text-weaker)] lg:inline`,children:l?yW(l):`default workspace`}):(0,L.jsx)(`span`,{className:`hidden font-mono text-xs text-[var(--text-weaker)] lg:inline`,children:t.slice(0,12)}),r&&!n&&(0,L.jsx)(ub,{className:`border-transparent bg-[var(--surface-warning-weak)] text-[var(--surface-warning-strong)]`,title:`Message sent — waiting for the agent to start responding`,children:`waiting`}),n&&(0,L.jsx)(ub,{className:`border-transparent bg-[var(--surface-interactive-weak)] text-[var(--text-interactive-base)]`,children:`working`})]}),(0,L.jsxs)(`div`,{className:`flex shrink-0 items-center gap-0.5 sm:gap-1.5`,children:[o&&(0,L.jsx)(`button`,{type:`button`,onClick:o,title:`Close split`,className:`flex size-6 cursor-pointer items-center justify-center rounded-md text-[var(--text-weaker)] transition-colors hover:bg-[color:var(--surface-base-hover)] hover:text-[var(--text-strong)]`,children:(0,L.jsx)(ot,{className:`size-3.5`})}),(0,L.jsx)(lW,{sessionID:t}),(0,L.jsx)(oW,{}),(0,L.jsx)(qU,{sessionID:t})]})]})}function xW({assistants:e,running:t}){let n=e.flatMap(e=>e.content.map(t=>({key:CW(e.id,t),part:t}))),r=e.filter(e=>e.error).map(e=>({id:e.id,error:e.error}));return n.length===0&&!t&&r.length===0?null:(0,L.jsxs)(`div`,{children:[r.map(({id:e,error:t})=>(0,L.jsxs)(`div`,{className:`mb-2 rounded-md border border-[color-mix(in_oklch,var(--surface-critical-strong)_40%,transparent)] bg-[var(--surface-critical-weak)] px-3 py-2 text-xs text-[var(--text-on-critical-strong)]`,children:[(0,L.jsx)(`span`,{className:`font-medium`,children:t.type}),(0,L.jsx)(`div`,{className:`mt-0.5`,children:t.message})]},e)),n.length===0&&t&&r.length===0&&(0,L.jsx)(`div`,{className:`flex items-center gap-2 py-1 text-[var(--font-size-base)] text-[var(--text-weak)] animate-pulse`,children:`thinking…`}),n.map(({key:e,part:t})=>(0,L.jsx)(lU,{stateKey:e,part:t.type===`tool`?d_(t.tool):t},e))]})}function SW({messages:e}){let t=(0,w.useMemo)(()=>e.filter(e=>e.type===`user`),[e]),[n,r]=(0,w.useState)(null);if((0,w.useEffect)(()=>{if(t.length===0)return;let e=new IntersectionObserver(e=>{let t=e.filter(e=>e.isIntersecting).sort((e,t)=>t.intersectionRatio-e.intersectionRatio);if(t[0]?.target){let e=t[0].target.id.replace(/^msg-/,``);r(e)}},{root:null,rootMargin:`-30% 0px -60% 0px`,threshold:[0,.25,.5,1]}),n=[];for(let r of t){let t=document.getElementById(`msg-${r.id}`);t&&(e.observe(t),n.push(t))}return()=>{for(let t of n)e.unobserve(t);e.disconnect()}},[t]),t.length<3)return null;let i=e=>{let t=document.getElementById(`msg-${e}`);if(t)t.scrollIntoView({behavior:`smooth`,block:`start`});else try{let t=`[data-message-id="${CSS.escape(e)}"]`;document.querySelector(t)?.scrollIntoView({behavior:`smooth`,block:`start`})}catch{}};return(0,L.jsx)(`div`,{className:`pointer-events-none absolute top-1/2 right-3 hidden -translate-y-1/2 flex-col items-center justify-center md:flex`,style:{maxHeight:`min(70vh, 560px)`},children:(0,L.jsxs)(`div`,{className:`pointer-events-auto flex flex-col items-center gap-2 rounded-full border border-[var(--border-weak-base)] bg-[var(--background-base)]/95 px-2 py-3 shadow-md backdrop-blur`,children:[(0,L.jsx)(`div`,{className:`absolute inset-y-3 w-px bg-[var(--border-weak-base)]`}),t.map(e=>{let t=(e.text??``).replace(/\s+/g,` `).slice(0,400)||e.id.slice(0,8),r=e.id===n;return(0,L.jsxs)(`button`,{type:`button`,onClick:()=>i(e.id),title:t,className:`group relative flex size-4 items-center justify-center`,children:[(0,L.jsx)(`span`,{className:`rounded-full ring-1 transition-all ${r?`size-3 bg-[var(--surface-brand-base)] ring-[var(--surface-brand-base)] shadow-sm`:`size-2 bg-[var(--text-weaker)] ring-[var(--border-weak-base)] group-hover:size-2.5 group-hover:bg-[var(--text-strong)]`}`}),(0,L.jsx)(`span`,{className:`pointer-events-none absolute right-full mr-4 hidden max-w-[560px] whitespace-pre-wrap rounded-xl border border-[var(--border-weak-base)] bg-[var(--surface-float-base)] px-4 py-3 text-sm leading-relaxed text-[var(--text-weak)] shadow-xl group-hover:block`,children:t})]},e.id)})]})})}function CW(e,t){return t.type===`tool`?`${e}:tool:${t.tool.id}`:`${e}:${t.type}:${t.ordinal}`}vt({conversation:e=>(0,L.jsx)(uW,{...e}),"conversation.header":e=>(0,L.jsx)(bW,{...e}),"conversation.empty":e=>(0,L.jsx)(vW,{...e})});var wW=s({clearDraft:()=>jW,loadDraft:()=>kW,saveDraft:()=>AW}),TW=`webui.drafts`,EW=50;function DW(){try{let e=localStorage.getItem(TW);if(!e)return{};let t=JSON.parse(e);return t&&typeof t==`object`?t:{}}catch{return{}}}function OW(e){try{let t=Object.entries(e).sort((e,t)=>t[1].at-e[1].at).slice(0,EW);localStorage.setItem(TW,JSON.stringify(Object.fromEntries(t)))}catch{}}function kW(e){return DW()[e]?.text??``}function AW(e,t){let n=DW();if(t)n[e]={text:t,at:Date.now()};else{if(!(e in n))return;delete n[e]}OW(n)}function jW(e){let t=DW();e in t&&(delete t[e],OW(t))}function MW(e){let t=(0,w.useRef)(null);return(0,w.useEffect)(()=>{function n(n){t.current&&!t.current.contains(n.target)&&e()}return document.addEventListener(`mousedown`,n),()=>document.removeEventListener(`mousedown`,n)},[e]),t}function NW({open:e,onClose:t,count:n,onSelect:r,listId:i,query:a,onQueryChange:o}){let[s,c]=(0,w.useState)(0),l=(0,w.useRef)(0);l.current=s;let u=(0,w.useRef)({prefix:``,at:0});(0,w.useEffect)(()=>{e&&c(0)},[e,a]),(0,w.useEffect)(()=>{e&&document.getElementById(`${i}-item-${s}`)?.scrollIntoView({block:`nearest`})},[e,s,i]);function d(e){let t=e.currentTarget,n=Array.from(t.querySelectorAll(`[role="option"]`));for(let t of n){let r=t.getBoundingClientRect();if(e.clientY>=r.top&&e.clientY<r.bottom){c(n.indexOf(t));return}}}return(0,w.useEffect)(()=>{if(!e)return;let s=null,d=e=>{if(e.key===`Escape`||e.key===`Tab`){if(e.preventDefault(),e.stopPropagation(),e.key===`Escape`&&o&&a){o(``);return}t();return}if(n===0)return;if(e.key===`ArrowDown`){e.preventDefault(),e.stopPropagation(),c(e=>(e+1)%n);return}if(e.key===`ArrowUp`){e.preventDefault(),e.stopPropagation(),c(e=>e<=0?n-1:e-1);return}if(e.key===`Home`){e.preventDefault(),e.stopPropagation(),c(0);return}if(e.key===`End`){e.preventDefault(),e.stopPropagation(),c(n-1);return}if(e.key===`Enter`){e.preventDefault(),e.stopPropagation(),r(l.current<n?l.current:0);return}if(o)return;let d=e.key.length===1&&!e.ctrlKey&&!e.metaKey&&!e.altKey?e.key.toLowerCase():null;if(!d)return;let f=Date.now(),p=u.current,m=f-p.at<1e3?p.prefix+d:d;p.prefix=m,p.at=f,s??=Array.from(document.querySelectorAll(`#${i} > button`)).map(e=>(e.textContent??``).trim().toLowerCase()),c(e=>{for(let t=1;t<=n;t++){let r=(e+t)%n;if((s?.[r]??``).startsWith(m))return r}return e})};return window.addEventListener(`keydown`,d,!0),()=>window.removeEventListener(`keydown`,d,!0)},[e,n,t,r,i,a,o]),[s,c,d]}async function PW(){try{let e=await W.agents();return e.find(e=>e.mode===`primary`&&!e.hidden)??e[0]}catch{return}}function FW(e){let t=J(t=>t.sessions.find(t=>t.id===e)),n=J(t=>t.sessionDetails[e]);return(0,w.useEffect)(()=>{p_(e)},[e]),{session:t,detail:n}}var IW=`flex w-full cursor-pointer items-center justify-between px-3 py-2 text-left transition-colors hover:bg-[color:var(--surface-base-hover)] data-[hl=true]:bg-[color:var(--surface-raised-base-active)]`;function LW({sessionID:e,openUp:t=!1,align:n=`right`}){let{session:r,detail:i}=FW(e),a=J(e=>e.pendingModel),[o,s]=(0,w.useState)(!1),[c,l]=(0,w.useState)([]),[u,d]=(0,w.useState)(null),f=MW(()=>s(!1)),p=J(e=>e.uiSignals.models);(0,w.useEffect)(()=>{p&&s(!0)},[p]);let m=(0,w.useMemo)(()=>c.filter(e=>e.enabled),[c]),h=`menu-models`;function g(e,t){if(t.includes(e)){let n=t.indexOf(e),r=1e3-n*2;return(n===0||t[n-1]===` `||t[n-1]===`/`||t[n-1]===`-`)&&(r+=20),r}let n=0,r=-2,i=0,a=0,o=0,s=0,c=0;for(let l=0;l<t.length&&n<e.length;l++)t[l]===e[n]&&((l===0||t[l-1]===` `||t[l-1]===`/`||t[l-1]===`-`)&&c++,r+1===l?(a++,s++,o=Math.max(o,s)):(i+=l-r-1,s=1),r=l,n++);return n===e.length?500-r*.5-i*2+a*10+c*2+o*3:null}let[_,v]=(0,w.useState)(``),y=_.trim().toLowerCase(),b=(0,w.useMemo)(()=>{if(!y)return m;let e=[];for(let t=0;t<m.length;t++){let n=m[t],r=`${n.name} ${n.modelID} ${n.providerID} ${n.id}`.toLowerCase(),i=g(y,r);i!==null&&e.push({m:n,s:i,i:t})}return e.sort((e,t)=>t.s-e.s||e.i-t.i),e.map(e=>e.m)},[m,y]),x=(0,w.useRef)(null);(0,w.useEffect)(()=>{o&&(v(``),x.current?.focus())},[o]);let S=a??i?.model??r?.model??u??void 0;(0,w.useEffect)(()=>{o&&c.length===0&&W.models().then(l)},[o,c.length]),(0,w.useEffect)(()=>{!r?.model&&u===null&&h_().then(e=>{e&&d(e)})},[r?.model,u]);let C=t=>{let n=b[t];n&&(Ry(e,{id:n.modelID,providerID:n.providerID}).then(Ag),s(!1))},[T,,E]=NW({open:o,onClose:()=>s(!1),count:b.length,onSelect:C,listId:h,query:_,onQueryChange:v}),D=`${t?`bottom-full mb-1`:`mt-1`} ${n===`right`?`right-0`:`left-0`}`;return(0,L.jsxs)(`div`,{ref:f,className:`relative`,children:[(0,L.jsx)(fb,{variant:`outline`,onClick:()=>s(!o),"aria-expanded":o,"aria-haspopup":`listbox`,title:`Switch model`,className:`h-7 max-w-48 gap-1 px-2 font-mono text-[11px]`,children:(0,L.jsx)(`span`,{className:`truncate`,children:S?DH(S):`model`})}),o&&(0,L.jsxs)(`div`,{className:`absolute z-40 w-72 overflow-hidden rounded-lg border border-[color:var(--border-weak-base)] bg-[color:var(--surface-float-base)] shadow-xl ${D}`,children:[(0,L.jsxs)(`div`,{className:`flex h-8 shrink-0 items-center gap-2 border-b border-[color:var(--border-weak-base)] px-2.5`,children:[(0,L.jsx)(Je,{className:`size-3.5 shrink-0 text-[color:var(--text-weaker)]`}),(0,L.jsx)(`input`,{ref:x,value:_,onChange:e=>v(e.target.value),placeholder:`Filter models…`,"aria-label":`Filter models`,autoComplete:`off`,spellCheck:!1,className:`h-full w-full bg-transparent font-mono text-[11px] text-[color:var(--text-strong)] outline-none placeholder:text-[color:var(--text-weaker)]`})]}),(0,L.jsx)(`div`,{id:h,role:`listbox`,"aria-label":`Switch model`,"aria-activedescendant":b.length>0?`${h}-item-${T}`:void 0,className:`max-h-72 overflow-y-auto`,onMouseMove:E,children:b.length===0?(0,L.jsx)(`div`,{className:`px-3 py-4 text-center text-xs text-[color:var(--text-weaker)]`,children:`No matching models`}):b.map((e,t)=>(0,L.jsxs)(`button`,{id:`${h}-item-${t}`,type:`button`,role:`option`,"aria-selected":S?.id===e.modelID&&S?.providerID===e.providerID,"data-hl":t===T||void 0,className:IW,onClick:()=>C(t),children:[(0,L.jsxs)(`span`,{children:[(0,L.jsx)(`span`,{className:`font-mono text-[color:var(--text-strong)]`,children:e.name}),(0,L.jsx)(`span`,{className:`ml-2 font-mono text-[color:var(--text-weaker)]`,children:e.providerID})]}),S?.id===e.modelID&&S?.providerID===e.providerID&&(0,L.jsx)(`span`,{className:`text-emerald-500`,children:`✓`})]},`${e.providerID}/${e.modelID}`))})]})]})}function RW({sessionID:e,openUp:t=!1,align:n=`right`}){let{session:r,detail:i}=FW(e),a=J(e=>e.pendingModel),[o,s]=(0,w.useState)(!1),[c,l]=(0,w.useState)([]),u=MW(()=>s(!1)),d=J(e=>e.uiSignals.variants);(0,w.useEffect)(()=>{d&&s(!0)},[d]),(0,w.useEffect)(()=>{o&&c.length===0&&W.models().then(l)},[o,c.length]);let f=a??i?.model??r?.model,p=c.find(e=>e.enabled&&e.modelID===f?.id&&e.providerID===f?.providerID)?.variants??[],m=f?.variant&&f.variant!=="default"?f.variant:void 0;function h(t){Ry(e,{id:f.id,providerID:f.providerID,...t?{variant:t}:{}}),s(!1)}let g=`menu-variants`,[_,,v]=NW({open:o,onClose:()=>s(!1),count:p.length+1,onSelect:e=>{e===0?h():h(p[e-1]?.id)},listId:g});if(!f||p.length===0)return null;let y=`${t?`bottom-full mb-1`:`mt-1`} ${n===`right`?`right-0`:`left-0`}`;return(0,L.jsxs)(`div`,{ref:u,className:`relative`,children:[(0,L.jsx)(fb,{variant:`outline`,onClick:()=>s(!o),"aria-expanded":o,"aria-haspopup":`listbox`,title:`Switch model variant`,className:`h-7 max-w-20 px-2 font-mono text-[11px]`,children:(0,L.jsx)(`span`,{className:`truncate`,children:m?`@${m}`:`@default`})}),o&&(0,L.jsxs)(`div`,{id:g,role:`listbox`,"aria-label":`Switch model variant`,"aria-activedescendant":`${g}-item-${_}`,className:`absolute z-40 max-h-80 w-48 overflow-y-auto rounded-lg border border-[color:var(--border-weak-base)] bg-[color:var(--surface-float-base)] shadow-xl ${y}`,onMouseMove:v,children:[(0,L.jsxs)(`button`,{id:`${g}-item-0`,type:`button`,role:`option`,"aria-selected":!m,"data-hl":_===0||void 0,className:IW,onClick:()=>h(),children:[(0,L.jsx)(`span`,{className:`text-[color:var(--text-strong)]`,children:`Default`}),!m&&(0,L.jsx)(`span`,{className:`text-emerald-500`,children:`✓`})]}),p.map((e,t)=>(0,L.jsxs)(`button`,{id:`${g}-item-${t+1}`,type:`button`,role:`option`,"aria-selected":m===e.id,"data-hl":_===t+1||void 0,className:`${IW} font-mono text-xs`,onClick:()=>h(e.id),children:[(0,L.jsx)(`span`,{className:`text-[color:var(--text-strong)]`,children:e.id}),m===e.id&&(0,L.jsx)(`span`,{className:`text-emerald-500`,children:`✓`})]},e.id))]})]})}function zW({sessionID:e,openUp:t=!1,align:n=`right`}){let{session:r,detail:i}=FW(e),a=J(e=>e.pendingAgent),[o,s]=(0,w.useState)(!1),[c,l]=(0,w.useState)([]),[u,d]=(0,w.useState)(null),f=MW(()=>s(!1)),p=J(e=>e.uiSignals.agents);(0,w.useEffect)(()=>{p&&s(!0)},[p]);let m=(0,w.useMemo)(()=>c.filter(e=>e.mode===`primary`&&!e.hidden),[c]),h=`menu-agents`,g=a??i?.agent??r?.agent??u??void 0;(0,w.useEffect)(()=>{o&&c.length===0&&W.agents().then(l)},[o,c.length]),(0,w.useEffect)(()=>{!r?.agent&&u===null&&PW().then(e=>{e&&d(e.id)})},[r?.agent,u]);let _=t=>{let n=m[t];n&&(Ly(e,n.id).then(Ag),s(!1))},[v,,y]=NW({open:o,onClose:()=>s(!1),count:m.length,onSelect:_,listId:h}),b=`${t?`bottom-full mb-1`:`mt-1`} ${n===`right`?`right-0`:`left-0`}`;return(0,L.jsxs)(`div`,{ref:f,className:`relative`,children:[(0,L.jsx)(fb,{variant:`outline`,onClick:()=>s(!o),"aria-expanded":o,"aria-haspopup":`listbox`,title:`Switch agent (Tab)`,className:`h-7 max-w-28 px-2 text-[11px]`,children:(0,L.jsx)(`span`,{className:`truncate`,children:g??`agent`})}),o&&(0,L.jsx)(`div`,{id:h,role:`listbox`,"aria-label":`Switch agent`,"aria-activedescendant":`${h}-item-${v}`,className:`absolute z-40 max-h-80 w-60 overflow-y-auto rounded-lg border border-[color:var(--border-weak-base)] bg-[color:var(--surface-float-base)] shadow-xl ${b}`,onMouseMove:y,children:m.map((e,t)=>(0,L.jsxs)(`button`,{id:`${h}-item-${t}`,type:`button`,role:`option`,"aria-selected":g===e.id,"data-hl":t===v||void 0,className:IW,onClick:()=>_(t),children:[(0,L.jsx)(`span`,{className:`text-[color:var(--text-strong)]`,children:e.name}),g===e.id&&(0,L.jsx)(`span`,{className:`text-emerald-500`,children:`✓`})]},e.id))})]})}function BW({...e}){return(0,L.jsx)(tp,{"data-slot":`popover`,...e})}function VW({className:e,align:t=`center`,sideOffset:n=4,...r}){return(0,L.jsx)(rp,{children:(0,L.jsx)(ip,{"data-slot":`popover-content`,align:t,sideOffset:n,className:B(`z-50 flex w-72 origin-(--radix-popover-content-transform-origin) flex-col gap-2.5 rounded-lg bg-popover p-2.5 text-sm text-popover-foreground shadow-md ring-1 ring-foreground/10 outline-hidden duration-100 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95`,e),...r})})}function HW({...e}){return(0,L.jsx)(np,{"data-slot":`popover-anchor`,...e})}function UW({open:e,query:t,location:n,onOpenChange:r,onPick:i,children:a}){let[o,s]=(0,w.useState)([]),[c,l]=(0,w.useState)(n);return(0,w.useEffect)(()=>{e&&!n&&!c&&W.location().then(e=>l(e.directory)).catch(()=>void 0)},[e,n,c]),(0,w.useEffect)(()=>{if(!e){s([]);return}let n=!1,r=setTimeout(()=>{W.fsFind(t,{location:c,limit:20}).then(e=>{n||s(e.data)}).catch(()=>{n||s([])})},120);return()=>{n=!0,clearTimeout(r)}},[e,t,c]),(0,L.jsxs)(BW,{open:e,onOpenChange:r,children:[(0,L.jsx)(HW,{asChild:!0,children:a}),(0,L.jsx)(VW,{side:`top`,align:`start`,sideOffset:8,className:`w-[min(26rem,calc(100vw-2rem))] p-0`,children:(0,L.jsx)(Km,{children:(0,L.jsxs)(Ym,{children:[o.length>0&&(0,L.jsx)(Zm,{heading:`Files`,children:o.map(e=>(0,L.jsxs)($m,{value:e.path,onSelect:()=>i(e),children:[e.type===`directory`?(0,L.jsx)(Ee,{className:`text-[color:var(--text-weak)]`}):(0,L.jsx)(Ce,{className:`text-[color:var(--text-weak)]`}),(0,L.jsx)(`span`,{className:`font-mono text-[color:var(--text-strong)]`,children:e.path})]},e.path))}),o.length===0&&(0,L.jsx)(Xm,{children:`No matching files`})]})})})]})}var WW=null;function GW(){return WW??=W.models().catch(()=>[]),WW}var KW=null;function qW(){return KW??=W.agents().catch(()=>[]),KW}var JW=e=>e>=1e3?`${(e/1e3).toFixed(1)}k`:String(e);async function YW(e){try{let t=await Vy(e);await navigator.clipboard.writeText(QU(t))}catch{}}var XW=10;function ZW(e,t){let n=0;for(let r of t)if(r===e[n]&&(n+=1),n===e.length)return!0;return n===e.length}function QW(e,t){let n=t.trim().toLowerCase();if(!n)return e.slice(0,XW);let r=[];for(let t of e){let e=0,i=`/${t.names[0]}`;if(i.startsWith(`/${n}`))e=1e3;else if(i.includes(n))e=600;else if(ZW(n,i))e=200;else for(let r of t.names.slice(1)){let t=`/${r}`;t.startsWith(`/${n}`)?e=Math.max(e,800):t.includes(n)&&(e=Math.max(e,400))}e<100&&t.description?.toLowerCase().includes(n)&&(e=100),e>0&&r.push({entry:t,score:e})}return r.sort((e,t)=>t.score-e.score||e.entry.display.localeCompare(t.entry.display)),r.slice(0,XW).map(e=>e.entry)}function $W(){let[e,t]=(0,w.useState)(oh);return(0,w.useEffect)(()=>ch(()=>t(oh())),[]),e}function eG(e){let[t,n]=(0,w.useState)({shells:[],ptys:[]});return(0,w.useEffect)(()=>{async function t(){try{let t=e?{directory:e}:void 0,[r,i]=await Promise.all([W.shellList(t),W.ptyList(t)]);n({shells:r.data,ptys:i.data})}catch{}}return t(),Vh({name:`composer-runs`,minInterval:5e3,intervals:{live:5e3,idle:15e3},run:()=>t()})},[e]),t}function tG(e,t){let n=(0,w.useRef)(null);return(0,w.useEffect)(()=>{if(!e)return;function r(e){n.current&&!n.current.contains(e.target)&&t()}return document.addEventListener(`mousedown`,r),()=>document.removeEventListener(`mousedown`,r)},[e,t]),n}function nG(e){let t=e.value.length;e.setSelectionRange(t,t)}function rG({sessionID:e,paneKey:t=`main`,onNavigate:n}){let r=e=>n?n(e):void vv(e),[i,a]=(0,w.useState)(()=>kW(e)),[o,s]=(0,w.useState)(!1),[c,l]=(0,w.useState)([]),[u,d]=(0,w.useState)([]),f=$W(),[p,m]=(0,w.useState)(null),[h,g]=(0,w.useState)([]),[_,v]=(0,w.useState)([]),[y,b]=(0,w.useState)(0),[x,S]=(0,w.useState)(!1),[C,T]=(0,w.useState)(!1),[E,D]=(0,w.useState)([]),[O,k]=(0,w.useState)([]),ee=J(t=>t.running[e]??!1),A=J(t=>!!t.queued[e]),j=J(e=>e.interruptArmed),M=J(t=>t.messages[e]),te=J(t=>t.sessionDetails[e]),ne=J(t=>t.sessions.find(t=>t.id===e)?.parentID??t.sessionDetails[e]?.parentID),[N,P]=(0,w.useState)(0);(0,w.useEffect)(()=>mt(()=>P(e=>e+1)),[]);let re=(0,w.useMemo)(()=>Tt(`slash`),[N]),ie=J(t=>t.sessions.find(t=>t.id===e)?.location?.directory),ae=(0,w.useRef)(null),[F,I]=(0,w.useState)(0);function oe(e){I(e.selectionStart??e.value.length)}let se=(0,w.useMemo)(()=>(M??[]).filter(e=>e.type===`user`&&!e.id.startsWith(`msg_local_`)).map(e=>e.text).filter(e=>e&&!e.startsWith(`/`)).reverse(),[M]),[ce,le]=(0,w.useState)(null),ue=(0,w.useRef)(``),de=(0,w.useRef)(e);(0,w.useEffect)(()=>{le(null),de.current!==e&&(de.current=e,a(kW(e)))},[e]),(0,w.useEffect)(()=>{de.current===e&&AW(e,i)},[e,i]);let fe=J(t=>fv(t.sessions,e)),pe=J(e=>e.running),me=J(e=>e.activeIDs),he=eG(ie),ge=e=>pe[e]||me.includes(e),_e=fe.filter(e=>ge(e.id)).length,ve=he.shells.filter(e=>e.status===`running`).length+he.ptys.filter(e=>e.status===`running`).length,ye=he.shells.length+he.ptys.length,be=[fe.length>0?_e>0?`${_e}/${fe.length} agents`:`${fe.length} agents`:null,ye>0?ve>0?`${ve}/${ye} shells`:`${ye} shells`:null].filter(Boolean).join(` · `)||`runs`,xe=_e>0||ve>0,Se=J(e=>e.runsPanelOpen),[Ce,we]=(0,w.useState)(!1),Te=tG(Ce,()=>we(!1)),[Ee,De]=(0,w.useState)(!1),Oe=J(e=>e.pendingEdit),ke=Oe?.sessionID===e;(0,w.useEffect)(()=>{W.commands().then(l),W.skills().then(d),GW().then(D),qW().then(k)},[]);function Ae(){let e=ae.current;e&&(e.focus(),nG(e),I(e.value.length))}function Me(e){let t=e.trim();t&&(le(null),a(e=>{let n=e.replace(/\s+$/,``);return n===``?t:`${n} ${t}`}),requestAnimationFrame(()=>{let e=ae.current;e&&(e.focus(),nG(e),I(e.value.length))}))}(0,w.useEffect)(()=>{let e=ae.current;e&&(e.focus(),nG(e),I(e.value.length))},[e]);let Ne=J(e=>e.revertPrompt);(0,w.useEffect)(()=>{Ne&&(a(Ne),dv(),I(0),requestAnimationFrame(()=>ae.current?.setSelectionRange(0,0)))},[Ne]);let Pe=Math.min(F,i.length),Fe=i.slice(0,Pe),Ie=!C&&Fe.startsWith(`/`)&&!/^\S+\s+\S/.test(Fe)&&p!==Fe,Le=Fe.slice(1),Re=(0,w.useMemo)(()=>[{name:`new`,aliases:[`clear`],description:`New session`,run:()=>void Iy()},{name:`sessions`,aliases:[`resume`,`continue`],description:`Switch session`,run:()=>r(null)},{name:`move`,description:`Move session to another workspace`,run:t=>{let n=t.trim();if(sg(e)){window.dispatchEvent(new CustomEvent(`opencode:notify`,{detail:{title:`Create a session first`,variant:`destructive`}}));return}if(n){W.moveSession(e,n).then(()=>{window.dispatchEvent(new CustomEvent(`opencode:notify`,{detail:{title:`Moved to ${n}`}})),p_(e),Ag()}).catch(e=>{let t=e instanceof Error?e.message:String(e);window.dispatchEvent(new CustomEvent(`opencode:notify`,{detail:{title:`Move failed: ${t}`,variant:`destructive`}}))});return}De(!0)}},{name:`undo`,description:`Undo previous message`,run:()=>void Uy(e)},{name:`redo`,description:`Redo`,run:()=>void Wy(e)},{name:`thinking`,aliases:[`toggle-thinking`],description:f.showReasoning?`Collapse all thinking`:`Expand all thinking`,run:()=>sh(`showReasoning`,!oh().showReasoning)},{name:`timestamps`,aliases:[`toggle-timestamps`],description:f.showTimestamps?`Hide timestamps`:`Show timestamps`,run:()=>sh(`showTimestamps`,!oh().showTimestamps)},{name:`rename`,description:`Rename session`,run:t=>{let n=t.trim();n&&zy(e,n)}},{name:`fork`,description:`Fork session`,run:()=>void By(e,{type:`through`}).then(e=>r(e))},{name:`export`,description:`Export session transcript`,run:()=>void ZU(e)},{name:`copy`,description:`Copy session transcript`,run:()=>void YW(e)},{name:`compact`,aliases:[`summarize`],description:`Compact session`,run:()=>void Hy(e,`steer`)},{name:`connect`,description:`Connect providers & integrations`,run:()=>VA(`integrations`)},{name:`models`,aliases:[`mo`],description:`Switch model`,run:()=>rv(`models`)},{name:`variants`,description:`Switch model variant`,run:()=>rv(`variants`)},{name:`agents`,description:`Switch agent`,run:()=>rv(`agents`)},{name:`themes`,description:`Switch theme`,run:()=>rv(`themes`)},{name:`skills`,description:`Browse skills`,run:()=>we(!0)},{name:`mcps`,description:`Toggle MCPs`,run:()=>VA(`mcp`)},{name:`status`,description:`View status`,run:()=>VA(`server`)},{name:`diff`,description:`Open diff viewer`,run:()=>rv(`explorer`)},{name:`help`,description:`Help`,run:()=>rv(`help`)}],[e,f.showReasoning,f.showTimestamps]),Be=(0,w.useMemo)(()=>new Set(c.map(e=>e.name)),[c]);function Ve(e){Be.has(e.name)?(a(`/${e.name} `),m(`/${e.name} `),Ae()):(a(``),gy(e.id))}let He=te?.model,Ue=(0,w.useMemo)(()=>He?(E.find(e=>e.enabled&&e.modelID===He.id&&e.providerID===He.providerID)?.variants?.length??0)>0:!1,[E,He]),We=(0,w.useMemo)(()=>{let t=[];for(let e of Re)e.name===`variants`&&!Ue||t.push({key:`action:${e.name}`,display:`/${e.name}`,names:[e.name,...e.aliases??[]],description:e.description,onSelect:()=>{a(``),e.run(``)}});for(let n of re)t.push({key:`slash:${n.id}`,display:`/${n.item.name}`,names:[n.item.name,...n.item.aliases??[]],description:n.item.description,onSelect:()=>{a(``),n.item.run(``,{sessionID:e})}});for(let e of c)t.push({key:`command:${e.name}`,display:`/${e.name}`,names:[e.name],description:e.description,onSelect:()=>{a(`/${e.name} `),m(`/${e.name} `),Ae()}});for(let e of u)t.push({key:`skill:${e.id}`,display:`/${e.name}`,names:[e.name],description:e.description,onSelect:()=>Ve(e)});return t.sort((e,t)=>e.display.localeCompare(t.display))},[Re,re,c,u,Be,Ue,e]),Ge=(0,w.useMemo)(()=>QW(We,Le),[We,Le]),Ke=(0,w.useMemo)(()=>{let e=i.lastIndexOf(`@`);if(e===-1)return;let t=e===0?``:i[e-1],n=i.slice(e+1);if((e===0||/\s/.test(t))&&!/\s/.test(n))return n},[i]);(0,w.useEffect)(()=>{S(!1)},[i]);let qe=(0,w.useMemo)(()=>{let e=M??[];for(let t=e.length-1;t>=0;t--){let n=e[t];if(n.type===`assistant`)return n}},[M]),Je=qe?.type===`assistant`?qe.tokens:void 0,Xe=Je?Je.input+Je.output+Je.reasoning+Je.cache.read+Je.cache.write:void 0,Ze=(qe?.type===`assistant`?qe.cost:void 0)??te?.cost??0,Qe=E.find(e=>e.enabled&&e.modelID===He?.id&&e.providerID===He?.providerID)?.limit?.context,$e=Xe&&Qe?Math.round(Xe/Qe*100):void 0,et=[Xe===void 0?void 0:`${JW(Xe)} tok`,$e===void 0?void 0:`${$e}% ctx`,Ze>0?`$${Ze.toFixed(4)}`:void 0].filter(Boolean),tt=te?.agent;function rt(t){let n=O.filter(e=>e.mode===`primary`&&!e.hidden);if(n.length===0)return;let r=n.findIndex(e=>e.id===tt),i=n[(((r===-1?0:r)+t)%n.length+n.length)%n.length];Ly(e,i.id).then(()=>void p_(e))}function it(e,t){let n=CH(e)??`application/octet-stream`;v(r=>[...r,{id:`att_${Date.now()}_${Math.random().toString(36).slice(2,8)}`,name:e.split(`/`).pop()||e,mime:n,uri:`data:${n};base64,${EH(t)}`}])}function at(e){let t=i.lastIndexOf(`@`);if(t===-1)return;if(e.type===`file`&&vH(e.path)){a(i.slice(0,t)+i.slice(t+1+(Ke?.length??0))),Ae(),W.fsReadBytes(e.path,ie).then(t=>it(e.path,t)).catch(()=>void 0);return}let n=`@${e.path}`;a(i.slice(0,t)+n+` `),g(t=>[...t,{path:e.path}]),ie&&W.fsRead(e.path,ie).then(t=>g(n=>n.map(n=>n.path===e.path?{path:n.path,content:t}:n))).catch(()=>void 0),Ae()}async function st(){if(sg(e))try{return await Fy(i)}catch{return null}return e||null}async function ct(t){let n=i.trim();if(!(!n&&_.length===0||o)){s(!0),le(null);try{if(!C&&n.startsWith(`/`)){let t=n.slice(1).split(` `),r=t[0],i=Re.find(e=>e.name===r||e.aliases?.includes(r));if(i){i.run(t.slice(1).join(` `)),a(``),g([]),v([]);return}let o=re.find(e=>e.item.name===r||e.item.aliases?.includes(r));if(o){await o.item.run(t.slice(1).join(` `),{sessionID:e}),a(``),g([]),v([]);return}}let r=await st();if(!r)return;let i=mg().pendingEdit;if(i&&i.sessionID===r){let{commitPendingEdit:e}=await Gh(async()=>{let{commitPendingEdit:e}=await Promise.resolve().then(()=>Kh);return{commitPendingEdit:e}},void 0);await e(r)}if(C)await ty(n.startsWith(`!`)?n.slice(1):n);else if(n.startsWith(`!`))await ty(n.slice(1));else if(n.startsWith(`/`)){let e=n.slice(1).split(` `),t=e[0];await ey(t,e.slice(1).join(` `)||void 0)}else if(h.length>0||_.length>0){let e=mg().draftWorkspace,i=ie??e??void 0,a=[];for(let e of h){if(!i)continue;let t=`@${e.path}`,r=n.indexOf(t);a.push({uri:`file://${encodeURI(`${i.replace(/\/+$/,``)}/${e.path}`)}`,name:e.path,mention:r===-1?void 0:{start:r,end:r+t.length,text:t}})}for(let e of _)a.push(SH(e));a.length>0?await ny(n,a):await zv(r,n,t)}else await zv(r,n,t);a(``),g([]),v([])}catch{a(n)}finally{s(!1),Ae()}}}let lt=C?`bash — esc to exit`:ee?`Agent is working… — ↵ steers · ctrl+↵ queues`:A?`Waiting for the agent… — ↵ steers · ctrl+↵ queues`:`Message the agent…`,ut=C?(0,L.jsxs)(`p`,{children:[(0,L.jsx)(`span`,{className:`font-medium text-[color:var(--surface-brand-base)]`,children:`Shell`}),` · esc to exit`]}):ee&&j?(0,L.jsx)(`p`,{className:`font-medium text-[color:var(--surface-warning-strong)]`,children:`Press esc again to interrupt`}):ee||A?(0,L.jsxs)(`p`,{className:`flex items-center gap-1.5`,children:[(0,L.jsx)(pb,{className:`size-3`}),ee?`Working… · esc to interrupt`:`Waiting…`,i.trim()?` · ↵ steer · ctrl+↵ queue`:``]}):(0,L.jsxs)(`p`,{children:[(0,L.jsx)(`span`,{className:`font-medium text-[color:var(--text-weak)]`,children:`Tab`}),` agent,`,` `,(0,L.jsx)(`span`,{className:`font-medium text-[color:var(--text-weak)]`,children:`/`}),` commands,`,` `,(0,L.jsx)(`span`,{className:`font-medium text-[color:var(--text-weak)]`,children:`@`}),` files,`,` `,(0,L.jsx)(`span`,{className:`font-medium text-[color:var(--text-weak)]`,children:`!`}),` bash`]}),dt=ie?.split(`/`).filter(Boolean).pop();return(0,L.jsxs)(`div`,{className:`border-t border-[color:var(--border-weak-base)] px-2 pt-2 pb-[max(0.625rem,env(safe-area-inset-bottom))] sm:px-3`,children:[(0,L.jsxs)(`div`,{className:`mx-auto max-w-3xl`,children:[(0,L.jsx)(`div`,{className:`relative`,children:Ce&&(0,L.jsxs)(`div`,{ref:Te,className:`absolute bottom-full left-0 z-40 mb-2 max-h-80 w-[min(26rem,calc(100vw-2rem))] overflow-y-auto rounded-lg border border-[color:var(--border-weak-base)] bg-[color:var(--surface-float-base)] p-1 shadow-xl`,children:[u.length===0&&(0,L.jsx)(`p`,{className:`px-2.5 py-1.5 text-xs text-[color:var(--text-weaker)]`,children:`No skills available`}),u.map(e=>(0,L.jsxs)(`button`,{type:`button`,onClick:()=>{we(!1),Ve(e)},className:`flex w-full items-baseline gap-2 rounded-md px-2 py-1.5 text-left transition-colors hover:bg-[color:var(--surface-base-hover)]`,children:[(0,L.jsxs)(`span`,{className:`shrink-0 font-mono text-xs text-[color:var(--text-strong)]`,children:[`/`,e.name]}),e.description&&(0,L.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-xs text-[color:var(--text-weaker)]`,children:e.description})]},e.id))]})}),(0,L.jsxs)(BW,{open:Ie,children:[(0,L.jsx)(HW,{asChild:!0,children:(0,L.jsxs)(`div`,{"data-oc-composer":!0,onDragEnter:e=>{Array.from(e.dataTransfer.types).includes(`Files`)&&b(e=>e+1)},onDragOver:e=>{Array.from(e.dataTransfer.types).includes(`Files`)&&e.preventDefault()},onDragLeave:()=>b(e=>Math.max(0,e-1)),onDrop:e=>{b(0),e.dataTransfer.files.length!==0&&(e.preventDefault(),xH(e.dataTransfer.files).then(e=>{e.length>0&&v(t=>[...t,...e])}))},className:`rounded-lg border bg-[color:var(--input-base)] p-2 transition-colors focus-within:border-[color:var(--border-selected)] ${y>0||C?`border-[color:var(--surface-brand-base)]`:`border-[color:var(--border-base)]`}`,children:[ke&&Oe&&(0,L.jsxs)(`div`,{className:`mb-2 flex items-center gap-2 rounded-md border border-amber-500/30 bg-amber-500/10 px-2.5 py-1.5 text-xs`,children:[(0,L.jsxs)(`span`,{className:`flex items-center gap-1.5 font-medium text-amber-700 dark:text-amber-300`,children:[(0,L.jsx)(ze,{className:`size-3`}),` Editing`]}),(0,L.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-mono text-[var(--text-weaker)]`,title:Oe.originalText,children:Oe.originalText.slice(0,80).replace(/\s+/g,` `)||`(empty)`}),(0,L.jsx)(`span`,{className:`hidden text-[10px] text-[var(--text-weaker)] sm:inline`,children:`will revert on send`}),(0,L.jsx)(`button`,{type:`button`,onClick:()=>{Gh(()=>Promise.resolve().then(()=>Kh).then(e=>e.clearPendingEdit()),void 0)},title:`Dismiss edit — next send is a normal message`,className:`ml-auto flex size-6 cursor-pointer items-center justify-center rounded-md hover:bg-black/10 dark:hover:bg-white/10`,children:(0,L.jsx)(ot,{className:`size-3`})})]}),_.length>0&&(0,L.jsxs)(`div`,{className:`mb-1.5 flex flex-wrap items-start gap-2 border-b border-[color:var(--border-weak-base)] pb-1.5`,children:[_.map(e=>(0,L.jsxs)(`span`,{className:`relative inline-block`,title:`${e.name} (${e.mime})`,children:[(0,L.jsx)(`img`,{src:e.uri,alt:e.name,draggable:!1,className:`size-12 rounded-md border border-[color:var(--border-weak-base)] object-cover`}),(0,L.jsx)(`button`,{type:`button`,onClick:()=>v(t=>t.filter(t=>t.id!==e.id)),title:`Remove attachment`,className:`absolute -right-1.5 -top-1.5 flex size-4 cursor-pointer items-center justify-center rounded-full border border-[color:var(--border-weak-base)] bg-[color:var(--surface-float-base)] text-[color:var(--text-weak)] transition-colors hover:text-[color:var(--text-strong)]`,children:(0,L.jsx)(ot,{className:`size-2.5`})})]},e.id)),(0,L.jsxs)(`span`,{className:`self-center text-[11px] text-[color:var(--text-weaker)]`,children:[`image`,_.length===1?``:`s`,` attached`]})]}),(0,L.jsx)(UW,{open:Ke!==void 0&&!x&&!Ie,query:Ke??``,location:ie,onOpenChange:S,onPick:at,children:(0,L.jsxs)(`div`,{className:`flex items-end gap-2`,children:[(0,L.jsx)(Im,{id:`composer-input-${t}`,"data-oc-composer-input":!0,ref:ae,value:i,placeholder:lt,className:`max-h-40 min-h-0 flex-1 resize-none border-0 bg-transparent px-1.5 py-1 text-sm placeholder:text-[color:var(--text-weaker)] focus-visible:ring-0 ${C?`font-mono`:``}`,onChange:e=>{le(null),a(e.target.value),oe(e.currentTarget)},onSelect:e=>oe(e.currentTarget),onClick:e=>oe(e.currentTarget),onKeyUp:e=>oe(e.currentTarget),onPaste:e=>{let t=[];for(let n of Array.from(e.clipboardData?.items??[])){if(n.kind!==`file`)continue;let e=n.getAsFile();e&&t.push(e)}t.some(e=>e.type.startsWith(`image/`)||vH(e.name))&&(e.preventDefault(),xH(t).then(e=>{e.length>0&&v(t=>[...t,...e])}))},onKeyDown:t=>{if(Ie){if(t.key===`Escape`){t.preventDefault(),Pe===i.length&&!i.endsWith(` `)?a(``):m(Fe);return}if(t.key===`ArrowDown`){t.preventDefault(),Um(1);return}if(t.key===`ArrowUp`){t.preventDefault(),Um(-1);return}if(t.key===`Enter`){t.preventDefault(),Wm();return}if(t.key===`Tab`){t.preventDefault(),Wm();return}}if(Ke!==void 0&&!x&&!Ie&&document.querySelector(`[data-slot="command-item"]`)){if(t.key===`ArrowDown`){t.preventDefault(),Um(1);return}if(t.key===`ArrowUp`){t.preventDefault(),Um(-1);return}if(t.key===`Enter`&&!t.shiftKey&&!t.ctrlKey&&!t.metaKey&&!t.altKey){t.preventDefault(),Wm();return}}if(Ce&&t.key===`Escape`){t.preventDefault(),we(!1);return}if(!Ie&&Ke===void 0&&!t.ctrlKey&&!t.metaKey&&!t.altKey&&!t.shiftKey){if(t.key===`ArrowUp`){let e=t.currentTarget;if(e.selectionStart===0&&e.selectionEnd===0&&se.length>0){t.preventDefault(),ce===null&&(ue.current=i);let n=ce===null?0:Math.min(ce+1,se.length-1);le(n);let r=se[n]??``;a(r),I(0),requestAnimationFrame(()=>e.setSelectionRange(0,0))}return}if(t.key===`ArrowDown`){let e=t.currentTarget;if(e.selectionStart===i.length&&e.selectionEnd===i.length){if(ce===null)t.preventDefault(),iv();else if(ce<=0)t.preventDefault(),le(null),a(ue.current),I(ue.current.length),requestAnimationFrame(()=>e.setSelectionRange(ue.current.length,ue.current.length));else{t.preventDefault();let n=Math.min(ce-1,se.length-1);le(n);let r=se[Math.max(n,0)]??``;a(r),I(r.length),requestAnimationFrame(()=>e.setSelectionRange(r.length,r.length))}}return}}if(t.key.toLowerCase()===`b`&&t.ctrlKey&&!t.metaKey&&!t.altKey&&!t.shiftKey){Ie||(t.preventDefault(),(ee||A)&&Sy(e));return}if(t.key===`Escape`){if(t.preventDefault(),C){T(!1);return}if(ee){xy();return}return}if(t.key===`Tab`){t.preventDefault(),rt(t.shiftKey?-1:1);return}if(t.key===`Backspace`&&!i&&ne){t.preventDefault(),r(ne);return}if(t.key===`Enter`&&!t.shiftKey&&!t.altKey&&(t.ctrlKey||t.metaKey)&&!Ie&&Ke===void 0){t.preventDefault(),ct(C?void 0:{delivery:`queue`});return}t.key===`Enter`&&!t.shiftKey&&(t.preventDefault(),ct())}}),(0,L.jsx)(wt,{id:`composer.sendActions`,sessionID:e,appendDraft:Me}),o?(0,L.jsx)(pb,{className:`mb-1.5 mr-2`}):(0,L.jsxs)(H,{variant:`default`,size:`sm`,"data-oc-composer-send":!0,disabled:!i.trim()&&_.length===0,onClick:()=>void ct(),title:ee?`Send (↵ steer · ctrl+↵ queue)`:`Send (Enter)`,children:[(0,L.jsx)(Ye,{}),`Send`]})]})}),(0,L.jsxs)(`div`,{className:`no-scrollbar mt-1 flex flex-nowrap items-center gap-1 overflow-x-auto border-t border-[color:var(--border-weak-base)] px-1 pt-1 [&>*]:shrink-0`,children:[(0,L.jsxs)(`button`,{type:`button`,"data-runs-panel-trigger":!0,onClick:()=>Se?av():iv(),title:Se?`Close subagents & shells (↓)`:`Subagents & shells — opens the runs panel (↓)`,className:`flex h-6 cursor-pointer items-center gap-1 rounded-md px-1.5 font-mono text-[11px] transition-colors ${xe?`text-[color:var(--surface-brand-base)] hover:bg-[color:var(--surface-base-hover)]`:`text-[color:var(--text-weaker)] hover:bg-[color:var(--surface-base-hover)] hover:text-[color:var(--text-weak)]`}`,children:[(0,L.jsx)(je,{className:`size-3`}),be]}),(0,L.jsx)(`button`,{type:`button`,title:`Shell mode (! command)`,onClick:()=>T(e=>!e),className:`flex size-6 cursor-pointer items-center justify-center rounded-md transition-colors ${C?`bg-[color:var(--surface-brand-weak)] text-[color:var(--surface-brand-strong)]`:`text-[color:var(--text-weaker)] hover:bg-[color:var(--surface-base-hover)] hover:text-[color:var(--text-weak)]`}`,children:(0,L.jsx)(nt,{className:`size-3.5`})}),(0,L.jsx)(zW,{sessionID:e,openUp:!0,align:`left`}),(0,L.jsx)(LW,{sessionID:e,openUp:!0,align:`left`}),(0,L.jsx)(RW,{sessionID:e,openUp:!0,align:`left`}),(0,L.jsx)(wt,{id:`composer.contextReadout`,parts:et})]})]})}),(0,L.jsx)(VW,{side:`top`,align:`start`,sideOffset:8,className:`w-[min(26rem,calc(100vw-2rem))] p-0`,onOpenAutoFocus:e=>e.preventDefault(),children:(0,L.jsx)(Km,{children:(0,L.jsxs)(Ym,{children:[Ge.map(e=>(0,L.jsxs)($m,{value:e.key,onSelect:e.onSelect,children:[(0,L.jsx)(`span`,{className:`font-mono text-[color:var(--text-base)]`,children:e.display}),e.description&&(0,L.jsx)(`span`,{className:`ml-auto max-w-[55%] truncate pl-3 text-xs text-[color:var(--text-weaker)]`,children:e.description})]},e.key)),Ge.length===0&&(0,L.jsx)(Xm,{children:`No matching items`})]})})})]}),(0,L.jsxs)(`div`,{className:`mt-1.5 flex items-center justify-between px-1 text-[11px] text-[color:var(--text-weaker)]`,children:[ut,dt&&(0,L.jsx)(`p`,{className:`hidden truncate font-mono sm:block`,children:dt})]})]}),Ee&&(0,L.jsx)(iG,{sessionID:e,currentDirectory:ie,onClose:()=>De(!1),onMoved:t=>{De(!1),window.dispatchEvent(new CustomEvent(`opencode:notify`,{detail:{title:`Moved to ${t}`}})),p_(e),Ag()}})]})}function iG({sessionID:e,currentDirectory:t,onClose:n,onMoved:r}){let[i,a]=(0,w.useState)([]),[o,s]=(0,w.useState)(``),[c,l]=(0,w.useState)(!0);(0,w.useEffect)(()=>{let e=!1;return(async()=>{try{let[n,r]=await Promise.all([W.projectList().catch(()=>[]),W.location().catch(()=>null)]);if(e)return;let i=new Set;for(let e of n){let t=e.directory;t&&i.add(t)}r?.directory&&i.add(r.directory),t&&i.add(t),a([...i].sort())}catch{}e||l(!1)})(),()=>{e=!0}},[t]);let u=t=>{let n=t.trim();n&&W.moveSession(e,n).then(()=>r(n)).catch(e=>{let t=e instanceof Error?e.message:String(e);window.dispatchEvent(new CustomEvent(`opencode:notify`,{detail:{title:`Move failed: ${t}`,variant:`destructive`}}))})};return(0,L.jsx)(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center bg-black/40 p-4`,onClick:n,children:(0,L.jsxs)(`div`,{className:`w-full max-w-lg rounded-lg border border-[var(--border-weak-base)] bg-[var(--surface-float-base)] p-4 shadow-xl`,onClick:e=>e.stopPropagation(),children:[(0,L.jsx)(`h3`,{className:`text-sm font-medium text-[var(--text-strong)]`,children:`Move session`}),(0,L.jsx)(`p`,{className:`mt-1 text-xs text-[var(--text-weaker)]`,children:`Pick a workspace or enter a path. Mirrors the TUI picker.`}),c?(0,L.jsx)(`p`,{className:`mt-4 text-xs text-[var(--text-weaker)]`,children:`Loading workspaces…`}):(0,L.jsxs)(`div`,{className:`mt-3 max-h-56 overflow-y-auto rounded-md border border-[var(--border-weak-base)]`,children:[i.map(e=>(0,L.jsxs)(`button`,{type:`button`,onClick:()=>u(e),className:`flex w-full items-center justify-between px-3 py-2 text-left text-xs hover:bg-[var(--surface-base-hover)] ${e===t?`bg-[var(--surface-raised-base-active)] font-medium`:``}`,children:[(0,L.jsx)(`span`,{className:`truncate font-mono text-[var(--text-strong)]`,children:e.replace(/^\/(home|Users)\/[^/]+/,`~`)}),e===t&&(0,L.jsx)(`span`,{className:`ml-2 text-[10px] text-[var(--text-weaker)]`,children:`current`})]},e)),i.length===0&&(0,L.jsx)(`p`,{className:`px-3 py-2 text-xs text-[var(--text-weaker)]`,children:`No workspaces found`})]}),(0,L.jsxs)(`div`,{className:`mt-3 flex gap-2`,children:[(0,L.jsx)(`input`,{value:o,onChange:e=>s(e.target.value),onKeyDown:e=>{e.key===`Enter`&&u(o),e.key===`Escape`&&n()},placeholder:`Custom path — e.g. /home/z/projects/foo`,className:`flex-1 rounded-md border border-[var(--border-base)] bg-[var(--input-base)] px-2.5 py-1.5 font-mono text-xs outline-none focus:border-[var(--border-selected)]`,autoFocus:!0}),(0,L.jsx)(`button`,{type:`button`,onClick:()=>u(o),disabled:!o.trim(),className:`rounded-md bg-[var(--surface-brand-base)] px-3 py-1.5 text-xs font-medium text-white disabled:opacity-50`,children:`Move`}),(0,L.jsx)(`button`,{type:`button`,onClick:n,className:`rounded-md border border-[var(--border-weak-base)] px-3 py-1.5 text-xs`,children:`Cancel`})]})]})})}function aG({parts:e}){return e.length===0?null:(0,L.jsx)(`span`,{className:`ml-auto font-mono text-[11px] text-[color:var(--text-weaker)]`,title:`Tokens used · share of model context window · session cost`,children:e.join(` · `)})}vt({composer:e=>(0,L.jsx)(rG,{...e}),"composer.contextReadout":e=>(0,L.jsx)(aG,{parts:e.parts}),"composer.sendActions":()=>null});var oG=new Map;function sG(e,t){for(oG.delete(e),oG.set(e,t);oG.size>2e3;){let e=oG.keys().next().value;if(!e)break;oG.delete(e)}}function cG({part:e,stateKey:t}){let[n,r]=(0,w.useState)(oh().showToolDetails);(0,w.useEffect)(()=>ch(()=>r(oh().showToolDetails)),[]);let[,i]=(0,w.useState)(0);(0,w.useEffect)(()=>mt(()=>i(e=>e+1)),[]);let a=yt(`tool:${e.name}`);if(a.replaces.length>0||a.wraps.length>0){let t=Ct(`tool:${e.name}`,{part:e});if(t!=null)return(0,L.jsx)(L.Fragment,{children:t})}if(!e.state)return null;let o=e.state,s=o.status===`completed`&&o.content?.some(e=>e.type===`file`&&_G(e.mime));if(!n&&o.status===`completed`&&!s)return null;let c=o.status===`streaming`?{}:o.input??{},l=o.status===`streaming`?{}:`metadata`in o?o.metadata??{}:{},u={part:e,state:o,stateKey:t,input:c,meta:l,output:o.status===`completed`||o.status===`error`?uG(o.content):void 0,error:o.status===`error`?o.error:void 0,streamingText:o.status===`streaming`?o.input:void 0},d=(()=>{switch(e.name){case`edit`:return(0,L.jsx)(wt,{id:`tool.edit`,...u});case`write`:return(0,L.jsx)(wt,{id:`tool.write`,...u});case`shell`:case`bash`:return(0,L.jsx)(wt,{id:`tool.shell`,...u});case`subagent`:case`task`:return(0,L.jsx)(wt,{id:`tool.subagent`,...u});case`execute`:return(0,L.jsx)(wt,{id:`tool.execute`,...u});case`read`:return(0,L.jsx)(fG,{...u,icon:`→`,pending:`Reading file…`,label:(0,L.jsxs)(L.Fragment,{children:[`Read `,(0,L.jsx)(dG,{value:c.path}),c.offset!==void 0&&(0,L.jsxs)(`span`,{className:`text-[var(--text-weaker)]`,children:[` from `,String(c.offset)]})]})});case`grep`:return(0,L.jsx)(fG,{...u,icon:`✱`,pending:`Searching content…`,label:(0,L.jsxs)(L.Fragment,{children:[`Grep "`,c.pattern,`" `,(0,L.jsx)(dG,{value:c.path,prefix:`in `}),l.matches!==void 0&&(0,L.jsxs)(`span`,{className:`text-[var(--text-weaker)]`,children:[` (`,String(l.matches),` matches)`]})]})});case`glob`:return(0,L.jsx)(fG,{...u,icon:`✱`,pending:`Finding files…`,label:(0,L.jsxs)(L.Fragment,{children:[`Glob "`,c.pattern,`" `,(0,L.jsx)(dG,{value:c.path,prefix:`in `}),l.count!==void 0&&(0,L.jsxs)(`span`,{className:`text-[var(--text-weaker)]`,children:[` (`,String(l.count),`)`]})]})});case`webfetch`:return(0,L.jsx)(fG,{...u,icon:`%`,pending:`Fetching from the web…`,label:(0,L.jsxs)(L.Fragment,{children:[e.name,` `,c.url]})});case`websearch`:return(0,L.jsx)(fG,{...u,icon:`◈`,pending:`Searching web…`,label:(0,L.jsxs)(L.Fragment,{children:[`Search "`,c.query,`"`]})});default:return(0,L.jsx)(wt,{id:`tool.generic`,...u,name:e.name})}})();return(0,L.jsx)(`div`,{"data-oc-tool-card":!0,"data-oc-tool-name":e.name,children:d})}function lG(e){return typeof e==`string`&&e?e:void 0}function uG(e){return(e??[]).filter(e=>e.type===`text`).map(e=>e.text??``).join(`
|
|
119
|
-
`).trim()||void 0}function dG({value:e,prefix:t}){let n=lG(e);if(!n)return null;let r=n.startsWith(`/`)?n.replace(/^\/home\/[^/]+/,`~`):n;return(0,L.jsxs)(`span`,{className:`font-mono`,children:[t,r]})}function fG({icon:e,label:t,pending:n,streamingText:r,error:i,output:a,complete:o=!0,onClick:s,children:c,state:l,runningLabel:u,runningIcon:d,input:f,part:p}){let[m,h]=(0,w.useState)(!1),[g,_]=(0,w.useState)(!1),v=!!i,y=l.status===`running`||l.status===`streaming`,b=(()=>{let e=Object.entries(f??{}).filter(([,e])=>e!=null&&e!==``);if(e.length>0){let t=[];for(let[n,r]of e){if(t.length>=3)break;let e=typeof r==`string`?r:(()=>{try{return JSON.stringify(r)??String(r)}catch{return String(r)}})();!e||e===`{}`||e===`[]`||t.push(`[${n}=${gG(e,40)}]`)}if(t.length>0)return t.join(` `)}if(r&&r.trim())return gG(r,80)})(),x=y&&u!==void 0?(0,L.jsx)(`span`,{className:`text-[var(--text-base)]`,children:u}):y?(0,L.jsxs)(`span`,{className:`flex items-center gap-2 text-[var(--text-base)]`,children:[(0,L.jsx)(pb,{className:`size-3`}),(0,L.jsx)(`span`,{className:`font-medium`,children:p.name}),b?(0,L.jsx)(`span`,{className:`truncate font-mono text-[var(--text-weaker)]`,children:b}):(0,L.jsx)(`span`,{className:`text-[var(--text-weaker)]`,children:n})]}):(0,L.jsx)(`span`,{className:v?``:o?`text-[var(--text-weak)]`:`text-[var(--text-base)]`,children:t??c}),S=!v&&!s&&r!==void 0&&r.trim().length>0,C=!!(s||v||S);return(0,L.jsxs)(`div`,{className:`py-0.5 pl-1 text-xs`,children:[(0,L.jsxs)(`div`,{role:C?`button`:void 0,onClick:()=>{v?h(e=>!e):S?_(e=>!e):s?.()},className:`flex min-w-0 items-center gap-2 ${C?`cursor-pointer rounded px-1 -mx-1 hover:bg-[color:var(--surface-base-hover)]`:``} ${v?`text-[color:var(--surface-critical-strong)]`:``}`,children:[(0,L.jsx)(`span`,{className:`w-3 shrink-0 text-center font-mono ${v?`text-[color:var(--surface-critical-strong)]`:`text-[var(--text-weaker)]`}`,children:y&&d!==void 0?d:e}),(0,L.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:x}),S&&(0,L.jsx)(F,{className:`size-3 shrink-0 text-[var(--text-weaker)] transition-transform ${g?`rotate-90`:``}`})]}),v&&m&&(0,L.jsxs)(`pre`,{className:`ml-5 mt-1 max-h-40 overflow-auto whitespace-pre-wrap rounded-md border border-[color-mix(in_oklch,var(--surface-critical-strong)_30%,transparent)] bg-[var(--surface-critical-weak)] p-2 font-mono text-[10px] text-[color:var(--surface-critical-strong)]`,children:[i.type,`: `,i.message]}),v&&!m&&a&&(0,L.jsx)(pG,{output:a}),S&&g&&(0,L.jsx)(`pre`,{className:`ml-5 mt-1 max-h-40 overflow-auto whitespace-pre-wrap rounded-md border border-[color-mix(in_oklch,var(--border-selected)_20%,transparent)] bg-[var(--background-strong)] p-2 font-mono text-[10px] leading-relaxed text-[var(--text-weak)]`,children:r})]})}function pG({output:e}){let t=e.split(`
|
|
120
|
-
`),n=t.slice(0,10).join(`
|
|
121
|
-
`)+(t.length>10?`
|
|
122
|
-
…`:``);return(0,L.jsx)(`pre`,{className:`ml-5 mt-1 max-h-40 overflow-auto whitespace-pre-wrap rounded-md border border-[color-mix(in_oklch,var(--border-selected)_20%,transparent)] bg-[var(--background-strong)] p-2 font-mono text-[10px] leading-relaxed text-[var(--text-weak)]`,children:n})}function mG({title:e,children:t,collapsible:n,collapsedByDefault:r,stateKey:i}){let[a,o]=(0,w.useState)(()=>n?i?oG.get(i)??!r:!r:!0);return n?(0,L.jsx)(hG,{title:(0,L.jsxs)(`button`,{type:`button`,onClick:()=>{o(!a),i&&sG(i,!a)},className:`flex w-full cursor-pointer items-center gap-1 text-left`,children:[(0,L.jsx)(F,{className:`size-3 shrink-0 transition-transform ${a?`rotate-90`:``}`}),(0,L.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e})]}),children:a&&t}):(0,L.jsx)(hG,{title:e,children:t})}function hG({title:e,children:t}){return(0,L.jsxs)(`div`,{className:`my-1 overflow-hidden rounded-lg border border-[var(--border-weak-base)] bg-[var(--background-strong)]`,children:[(0,L.jsx)(`div`,{className:`flex items-center gap-1.5 border-b border-[var(--border-weak-base)] bg-[var(--surface-base)] px-2.5 py-1.5 text-xs text-[var(--text-weak)]`,children:e}),t]})}function gG(e,t=120){let n=e.replace(/\s+/g,` `).trim();return n.length>t?n.slice(0,t)+`…`:n}function _G(e){return!!e&&e.startsWith(`image/`)}function vG(e){return e?e.filter(e=>e.type===`file`&&_G(e.mime)):[]}function yG(e){if(e.uri)return e.uri;if(e.data)return`data:${e.mime};base64,${e.data}`}function bG({content:e}){let t=vG(e);return t.length===0?null:(0,L.jsx)(`div`,{className:`mt-1.5 flex flex-wrap gap-2 pl-1`,children:t.map((e,t)=>{let n=yG(e);return n?(0,L.jsx)(xG,{src:n,name:e.name},t):null})})}function xG({src:e,name:t}){let[n,r]=(0,w.useState)(!1);return(0,L.jsx)(`button`,{type:`button`,onClick:()=>r(e=>!e),title:n?`${t??`image`} — click to shrink`:`${t??`image`} — click to enlarge`,className:`block cursor-pointer ${n?``:`cursor-zoom-in`}`,children:(0,L.jsx)(`img`,{src:e,alt:t??`image`,draggable:!1,className:`rounded-md border border-[color:var(--border-weak-base)] bg-[var(--surface-inset-base)] object-contain ${n?`max-h-[70vh] max-w-full`:`max-h-48 max-w-[16rem]`}`})})}function SG(e){let t=Array.isArray(e.meta.files)?e.meta.files:[],n=lG(e.input.path);return t.length>0?(0,L.jsx)(L.Fragment,{children:t.map((e,t)=>(0,L.jsx)(mG,{title:(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(`span`,{className:`font-mono`,children:`←`}),`Edit `,(0,L.jsx)(`span`,{className:`font-mono text-[var(--text-base)]`,children:e.file??n}),e.additions!==void 0&&e.deletions!==void 0&&(0,L.jsxs)(`span`,{className:`ml-auto shrink-0 font-mono text-[10px]`,children:[(0,L.jsxs)(`span`,{className:`text-[color:var(--text-diff-add-base)]`,children:[`+`,e.additions]}),` `,(0,L.jsxs)(`span`,{className:`text-[color:var(--text-diff-delete-base)]`,children:[`−`,e.deletions]})]})]}),children:e.patch?(0,L.jsx)(rA,{diff:e.patch,className:`max-h-80 overflow-y-auto py-1`}):(0,L.jsx)(`p`,{className:`px-2.5 py-2 text-xs text-[var(--text-weaker)]`,children:e.status===`deleted`?`File deleted`:`(no diff)`})},e.file??t))}):(0,L.jsx)(fG,{...e,icon:`←`,pending:`Preparing edit…`,label:(0,L.jsxs)(L.Fragment,{children:[`Edit `,(0,L.jsx)(dG,{value:e.input.path}),e.input.replaceAll!=null&&e.input.replaceAll!==!1&&(0,L.jsx)(`span`,{className:`text-[var(--text-weaker)]`,children:` (replace all)`})]})})}function CG(e){let t=lG(e.input.content),n=lG(e.input.path);return e.state.status===`completed`&&t!==void 0?(0,L.jsx)(mG,{title:(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(`span`,{className:`font-mono`,children:`#`}),`Wrote `,(0,L.jsx)(`span`,{className:`font-mono text-[var(--text-base)]`,children:n}),(0,L.jsxs)(`span`,{className:`ml-auto shrink-0 font-mono text-[10px] text-[var(--text-weaker)]`,children:[t.split(`
|
|
123
|
-
`).length,` lines`]})]}),collapsible:!0,stateKey:e.stateKey,children:(0,L.jsx)(IG,{code:t})}):(0,L.jsx)(fG,{...e,icon:`←`,pending:`Preparing write…`,label:(0,L.jsxs)(L.Fragment,{children:[`Write `,(0,L.jsx)(dG,{value:e.input.path})]})})}function wG(e){let t=lG(e.input.command),n=e.meta.exit;return e.state.status===`completed`?(0,L.jsx)(mG,{title:(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(`span`,{className:`font-mono`,children:`$`}),(0,L.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-mono text-[var(--text-base)]`,children:t}),typeof n==`number`&&n!==0&&(0,L.jsxs)(`span`,{className:`ml-auto shrink-0 font-mono text-[10px] text-[color:var(--surface-critical-strong)]`,children:[`exit `,n]})]}),collapsible:!0,collapsedByDefault:!!e.output&&e.output.split(`
|
|
124
|
-
`).length>10,stateKey:e.stateKey,children:e.output?(0,L.jsx)(`pre`,{className:`max-h-64 overflow-auto whitespace-pre-wrap px-2.5 py-2 font-mono text-xs leading-relaxed text-[var(--text-base)]`,children:e.output}):(0,L.jsx)(`p`,{className:`px-2.5 py-2 text-xs text-[var(--text-weaker)]`,children:`(no output)`})}):(0,L.jsx)(fG,{...e,icon:`$`,pending:`Writing command…`,label:(0,L.jsx)(`span`,{className:`font-mono`,children:t})})}function TG(e){let t=e??[];for(let e=t.length-1;e>=0;e--){let n=t[e];if(n){if(n.type===`user`){if(n.text.trim())return n.text}else if(n.type===`assistant`){let e=n.content.filter(e=>e.type===`text`).map(e=>e.text).join(` `).trim();if(e)return e}}}}function EG(e){let t=lG(e.input.agent)??`subagent`,n=lG(e.input.description),r=lG(e.meta.sessionID)??lG(e.input.sessionID),i=J(e=>r?e.sessions.find(e=>e.id===r)??e.sessionDetails[r]:void 0),a=J(e=>r?e.messages[r]:void 0),o=e.state.status===`running`||e.state.status===`streaming`,s=lG(i?.title)??TG(a)??n,c=e=>(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(`span`,{className:`font-medium`,children:t}),e&&(0,L.jsxs)(`span`,{children:[` — `,e]}),r&&(0,L.jsx)(`span`,{className:`ml-1 text-[10px] text-[var(--text-weaker)]`,children:`↗ open`})]});return(0,L.jsx)(fG,{...e,icon:e.state.status===`completed`?`✓`:`│`,runningIcon:o?(0,L.jsx)(pb,{className:`size-3`}):void 0,pending:`Delegating…`,onClick:r?()=>{vv(r)}:void 0,label:c(n),runningLabel:o?s?c(s):(0,L.jsx)(L.Fragment,{children:`Delegating…`}):void 0})}function DG(e){try{return JSON.stringify(e)??String(e)}catch{return String(e)}}function OG(e){if(e==null)return``;let t=typeof e==`object`&&!Array.isArray(e)?Object.entries(e):[[`input`,e]],n=[];for(let[e,r]of t){if(n.length>=3)break;if(r==null||r===``)continue;let t=typeof r==`string`?r:DG(r);!t||t===`{}`||t===`[]`||n.push(`[${e}=${gG(t,80)}]`)}return n.length>0?` ${n.join(` `)}`:``}function kG(e){if(typeof e==`string`)return e.trim()||void 0;if(e!=null)try{let t=JSON.stringify(e,null,2);return t&&t!==`{}`?t:void 0}catch{return DG(e)}}function AG(e){if(e!=null){if(Array.isArray(e))return e.map(e=>{if(typeof e==`string`)return e;if(e&&typeof e==`object`&&`text`in e){let t=e.text;if(typeof t==`string`)return t}return DG(e)}).join(`
|
|
125
|
-
`).trim()||void 0;if(typeof e==`string`)return e.trim()||void 0;try{let t=JSON.stringify(e,null,2);return t&&t!==`{}`?t:void 0}catch{return String(e)}}}function jG(e){if(e!=null&&e!==!1){if(typeof e==`string`)return e.trim()||void 0;if(typeof e==`object`){let t=e,n=lG(t.message)??lG(t.text);if(n){let e=lG(t.type);return e?`${e}: ${n}`:n}return AG(e)}return String(e)}}var MG=`ml-5 mt-1 max-h-40 overflow-auto whitespace-pre-wrap rounded-md border border-[color-mix(in_oklch,var(--border-selected)_20%,transparent)] bg-[var(--background-strong)] p-2 font-mono text-[10px] leading-relaxed text-[var(--text-weak)]`;function NG({call:e,index:t,stateKey:n}){let r=n?`${n}:call:${t}`:void 0,[i,a]=(0,w.useState)(()=>r?oG.get(r)??!1:!1),o=kG(e.input),s=AG(e.output??e.result),c=jG(e.error),l=!!(o||s||c);return(0,L.jsxs)(`div`,{children:[(0,L.jsxs)(`div`,{role:l?`button`:void 0,onClick:l?()=>{a(e=>(r&&sG(r,!e),!e))}:void 0,className:`flex min-w-0 items-center gap-1 ${l?`-mx-1 cursor-pointer rounded px-1 transition-colors hover:bg-[color:var(--surface-base-hover)]`:``}`,children:[(0,L.jsxs)(`span`,{className:`ml-5 min-w-0 flex-1 truncate text-[var(--text-weaker)]`,children:[`↳ `,lG(e.tool)??`tool`,OG(e.input),e.status===`error`&&(0,L.jsx)(`span`,{className:`text-[color:var(--surface-critical-strong)]`,children:` (failed)`})]}),l&&(0,L.jsx)(F,{className:`size-3 shrink-0 text-[var(--text-weaker)] transition-transform ${i?`rotate-90`:``}`})]}),l&&i&&(0,L.jsxs)(L.Fragment,{children:[o&&(0,L.jsx)(`pre`,{className:MG,children:o}),s&&(0,L.jsx)(`pre`,{className:MG,children:s}),c&&(0,L.jsx)(`pre`,{className:`ml-5 mt-1 max-h-40 overflow-auto whitespace-pre-wrap rounded-md border border-[color-mix(in_oklch,var(--surface-critical-strong)_30%,transparent)] bg-[var(--surface-critical-weak)] p-2 font-mono text-[10px] text-[color:var(--surface-critical-strong)]`,children:c})]})]})}function PG(e){let t=Array.isArray(e.meta.toolCalls)?e.meta.toolCalls:[],n=typeof e.meta.error==`object`&&e.meta.error!==null?e.meta.error:void 0,r=e.meta.error===!0||!!n?.message||!!e.error,i=e.error??(n?.message?{type:n.type??`error`,message:n.message}:void 0);return(0,L.jsxs)(`div`,{className:`py-0.5 pl-1 text-xs`,children:[(0,L.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,L.jsx)(`span`,{className:`w-3 shrink-0 text-center font-mono ${r?`text-[color:var(--surface-critical-strong)]`:`text-[var(--text-weaker)]`}`,children:r?`✗`:e.state.status===`completed`?`✓`:`│`}),e.state.status===`completed`?(0,L.jsx)(`span`,{className:`text-[var(--text-weak)]`,children:`execute`}):(0,L.jsxs)(`span`,{className:`flex items-center gap-2 text-[var(--text-base)]`,children:[(0,L.jsx)(pb,{className:`size-3`}),` execute`]})]}),t.map((t,n)=>(0,L.jsx)(NG,{call:t,index:n,stateKey:e.stateKey},n)),i&&(0,L.jsxs)(`pre`,{className:`ml-5 mt-1 max-h-24 overflow-auto whitespace-pre-wrap font-mono text-[10px] text-[color:var(--surface-critical-strong)]`,children:[i.type,`: `,i.message]}),r&&e.output&&i===void 0&&(0,L.jsx)(`pre`,{className:`ml-5 mt-1 max-h-24 overflow-auto whitespace-pre-wrap font-mono text-[10px] text-[color:var(--surface-critical-strong)]`,children:e.output.split(`
|
|
126
|
-
`).slice(0,4).join(`
|
|
127
|
-
`)}),(0,L.jsx)(bG,{content:e.state.status===`completed`||e.state.status===`error`?e.state.content:void 0})]})}function FG(e){let t=Object.entries(e.input).filter(([,e])=>typeof e==`string`||typeof e==`number`).slice(0,2).map(([e,t])=>`${e}: ${gG(String(t),40)}`).join(` `);return(0,L.jsxs)(`div`,{children:[(0,L.jsx)(fG,{...e,icon:`⚙`,pending:`${e.name}…`,label:(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(`span`,{className:`font-medium`,children:e.name}),t&&(0,L.jsxs)(`span`,{className:`font-mono text-[var(--text-weaker)]`,children:[` `,t]})]})}),e.state.status===`completed`&&e.output&&(0,L.jsx)(mG,{title:`${e.name} output`,collapsible:!0,stateKey:e.stateKey,children:(0,L.jsx)(`pre`,{className:`max-h-64 overflow-auto whitespace-pre-wrap px-2.5 py-2 font-mono text-xs leading-relaxed text-[var(--text-base)]`,children:e.output})}),(0,L.jsx)(bG,{content:e.state.status===`completed`||e.state.status===`error`?e.state.content:void 0})]})}function IG({code:e}){let t=e.split(`
|
|
128
|
-
`);return(0,L.jsx)(`div`,{className:`max-h-64 overflow-auto font-mono text-xs leading-relaxed`,children:(0,L.jsx)(`table`,{className:`w-full border-collapse`,children:(0,L.jsx)(`tbody`,{children:t.map((e,t)=>(0,L.jsxs)(`tr`,{children:[(0,L.jsx)(`td`,{className:`w-10 shrink-0 select-none border-r border-[var(--border-weak-base)] pr-2 text-right align-top text-[var(--text-weaker)]`,children:t+1}),(0,L.jsx)(`td`,{className:`whitespace-pre-wrap break-all pl-2.5 text-[var(--text-base)]`,children:e||` `})]},t))})})})}vt({"tool.card":e=>(0,L.jsx)(cG,{...e}),"tool.edit":e=>(0,L.jsx)(SG,{...e}),"tool.write":e=>(0,L.jsx)(CG,{...e}),"tool.shell":e=>(0,L.jsx)(wG,{...e}),"tool.subagent":e=>(0,L.jsx)(EG,{...e}),"tool.execute":e=>(0,L.jsx)(PG,{...e}),"tool.generic":e=>(0,L.jsx)(FG,{...e})});var LG={transcript:`data-oc-transcript`,message:`data-oc-message`,messageId:`data-oc-message-id`,messageType:`data-oc-message-type`,composer:`data-oc-composer`,composerInput:`data-oc-composer-input`,composerSend:`data-oc-composer-send`,toolCard:`data-oc-tool-card`,toolName:`data-oc-tool-name`,sessionHeader:`data-oc-session-header`,sidebar:`data-oc-sidebar`,queueStrip:`data-oc-queue-strip`,subagentStrip:`data-oc-subagent-strip`,runsPanel:`data-oc-runs-panel`},RG=new Map;function zG(e,t){let n=RG.get(e)??[];return n.push(t),RG.set(e,n),()=>{let e=n.indexOf(t);e>=0&&n.splice(e,1),t()}}function BG(e){return{foreign(t,n,r){let i=Array.isArray(n)?n:[n],a=r?.position??`after`,o=r?.onRemove,s=t.parentNode;if(!s)return()=>{};if(a===`before`)for(let e of i)s.insertBefore(e,t);else{let e=t.nextSibling;for(let t of i)s.insertBefore(t,e)}let c=()=>{for(let e of i)e.parentNode?.removeChild(e)},l=VG(t,()=>{if(c(),l(),o)try{o()}catch(t){console.error(`[dom-ext] onRemove "${e}" failed:`,t)}});return zG(e,()=>{l(),c()})},watch(t,n){let r=t.join(`,`),i=new MutationObserver(e=>{for(let t of e){let e=[];for(let n of Array.from(t.addedNodes))if(n instanceof HTMLElement){n.matches(r)&&e.push(n);for(let t of Array.from(n.querySelectorAll(r)))e.push(t)}e.length>0&&n(e,t)}});return i.observe(document.body,{childList:!0,subtree:!0}),zG(e,()=>i.disconnect())},styles(t){let n=document.createElement(`style`);return n.setAttribute(`data-oc-dom-ext`,e),n.textContent=t,document.head.appendChild(n),zG(e,()=>n.remove())},onStreamingSettled(t,n=800){let r=null,i=()=>{r&&clearTimeout(r),r=setTimeout(()=>{r=null,t()},n)},a=new MutationObserver(i);return a.observe(document.body,{childList:!0,subtree:!0,characterData:!0}),i(),zG(e,()=>{r&&clearTimeout(r),a.disconnect()})}}}function VG(e,t){let n=new MutationObserver(()=>{document.body.contains(e)||t()});return n.observe(document.body,{childList:!0,subtree:!0}),()=>n.disconnect()}async function HG(e,t){UG(e),RG.set(e,[]);let n=BG(e);try{let r=await t.mount(n);typeof r==`function`&&zG(e,r)}catch(t){console.error(`[dom-ext] mount "${e}" failed:`,t),UG(e)}}function UG(e,t){let n=RG.get(e)??[];RG.delete(e);for(let t of n.splice(0))try{t()}catch(t){console.error(`[dom-ext] cleanup "${e}" failed:`,t)}try{t?.dispose?.()}catch(t){console.error(`[dom-ext] dispose "${e}" failed:`,t)}for(let t of Array.from(document.querySelectorAll(`[data-oc-dom-ext="${CSS.escape(e)}"]`)))t.remove()}function WG(e){return typeof e!=`object`||!e?!1:typeof e.mount==`function`}var GG=`webui.extkv.`,KG=new Map;function qG(){try{return typeof localStorage<`u`}catch{return!1}}function JG(e,t){if(qG())try{return localStorage.getItem(GG+e+`.`+t)??void 0}catch{}return KG.get(e)?.get(t)}function YG(e,t,n){if(qG())try{localStorage.setItem(GG+e+`.`+t,n);return}catch{}let r=KG.get(e);r||(r=new Map,KG.set(e,r)),r.set(t,n)}function XG(e,t){if(qG())try{localStorage.removeItem(GG+e+`.`+t)}catch{}KG.get(e)?.delete(t)}function ZG(e){return{get(t){let n=JG(e,t);if(n!==void 0)try{return JSON.parse(n)}catch{return}},set(t,n){try{YG(e,t,JSON.stringify(n))}catch{}},delete(t){XG(e,t)},keys(){let t=new Set;if(qG())try{let n=GG+e+`.`;for(let e=0;e<localStorage.length;e++){let r=localStorage.key(e);r?.startsWith(n)&&t.add(r.slice(n.length))}}catch{}for(let n of KG.get(e)?.keys()??[])t.add(n);return[...t]},clear(){for(let t of this.keys())XG(e,t)}}}function QG(){return{version:1,register:kt,react:w,api:W,store:Kh,prefs:{getPrefs:oh,setPref:sh,subscribePrefs:ch},notify:fk,services:{getService:Et,getServiceProviders:Dt},dom:{mount:HG,dispose:UG,isModule:WG,anchors:LG,version:1},kv:{forExt:ZG}}}function $G(){let e=window;return e.__opencodeUI??=QG(),e.__opencodeUI}function eK(){return $G()}var tK=new Map,nK=new Map,rK=new Map;function iK(){$G()}var aK=!1;async function oK(e){if(iK(),!e?.force&&aK&&document.hidden)return;let t;try{let e=await fetch(`/api/webui/extensions`);if(!e.ok)return;let n=(await e.json())?.data;t=Array.isArray(n)?n:[]}catch{return}let n=new Set,r=new Set,i=new Set;for(let e of t)if(typeof e?.id==`string`){if(e.disabled){i.add(e.id);continue}if(typeof e?.url==`string`||typeof e?.domUrl==`string`){if(typeof e.url==`string`&&e.origin!==`shipped`&&(n.add(e.id),tK.get(e.id)!==e.url)){let t=new Set(_t());try{await Gh(()=>import(e.url),[]),tK.set(e.id,e.url);let n=_t(),r=nK.get(e.id);r||(r=new Set,nK.set(e.id,r));for(let e of n)t.has(e)||r.add(e);lh(`extension.loaded`,{id:e.id,url:e.url})}catch{}}typeof e.domUrl==`string`&&(r.add(e.id),await sK(e.id,e.domUrl))}}let a=new Set;for(let e of tK.keys())if(!n.has(e)){let t=nK.get(e);if(t&&t.size>0)for(let e of t)a.add(e);else a.add(e);tK.delete(e),nK.delete(e)}a.size>0&>([...a]),i.size>0&>([...i]);for(let[e,t]of rK)r.has(e)||(rK.delete(e),UG(e,t.module))}async function sK(e,t){if(rK.get(e)?.url===t)return;let n;try{let e=await Gh(()=>import(t),[]);if(!WG(e.default))return;n=e.default}catch{return}let r=rK.get(e);r&&UG(e,r.module),rK.set(e,{url:t,module:n}),await HG(e,n)}function cK(){let e=null;try{e=new EventSource(`/api/webui/extensions/events`)}catch{return}e.onmessage=()=>{oK({force:!0})},e.onerror=()=>{},document.addEventListener(`visibilitychange`,()=>{document.hidden||oK()})}function lK(){aK||(aK=!0,iK(),oK({force:!0}),cK())}var uK=typeof localStorage<`u`&&localStorage.getItem(`webui.debug`)===`1`;window.__WEBUI_DEBUG_CONSOLE__=uK,$G(),lK(),Y_(),G(`boot`,`app render (console mirror: ${uK?`on`:`off`})`),(0,lt.createRoot)(document.getElementById(`root`)).render((0,L.jsx)(w.StrictMode,{children:(0,L.jsx)(Tk,{children:(0,L.jsx)(bk,{})})}));export{_t as n,eK as t};
|